diff --git a/stepmania/src/Attack.cpp b/stepmania/src/Attack.cpp new file mode 100644 index 0000000000..8ce45f1ca3 --- /dev/null +++ b/stepmania/src/Attack.cpp @@ -0,0 +1,18 @@ +#include "global.h" +#include "Attack.h" +#include "GameState.h" +#include "song.h" + +void Attack::GetAttackBeats( const Song *song, PlayerNumber pn, float &fStartBeat, float &fEndBeat ) const +{ + if( fStartSecond >= 0 ) + { + fStartBeat = song->GetBeatFromElapsedTime( fStartSecond ); + fEndBeat = song->GetBeatFromElapsedTime( fStartSecond+fSecsRemaining ); + } else { + /* We're setting this effect on the fly. If it's an arrow-changing effect + * (transform or note skin), apply it in the future, past what's currently on + * screen, so new arrows will scroll on screen with this effect. */ + GAMESTATE->GetUndisplayedBeats( pn, fSecsRemaining, fStartBeat, fEndBeat ); + } +} diff --git a/stepmania/src/Attack.h b/stepmania/src/Attack.h new file mode 100644 index 0000000000..47fa055d7b --- /dev/null +++ b/stepmania/src/Attack.h @@ -0,0 +1,22 @@ +#ifndef ATTACK_H +#define ATTACK_H + +#include "GameConstantsAndTypes.h" +#include "PlayerNumber.h" +class Song; + +struct Attack +{ + AttackLevel level; + float fStartSecond; // -1 = now + float fSecsRemaining; + CString sModifier; + + void GetAttackBeats( const Song *song, PlayerNumber pn, float &fStartBeat, float &fEndBeat ) const; + bool IsBlank() { return sModifier.empty(); } + void MakeBlank() { sModifier=""; } + Attack() { fStartSecond = -1; } +}; +typedef vector AttackArray; + +#endif diff --git a/stepmania/src/CombinedLifeMeterEnemy.cpp b/stepmania/src/CombinedLifeMeterEnemy.cpp index eb11a37819..a7c7e3910d 100644 --- a/stepmania/src/CombinedLifeMeterEnemy.cpp +++ b/stepmania/src/CombinedLifeMeterEnemy.cpp @@ -141,7 +141,7 @@ void CombinedLifeMeterEnemy::Update( float fDelta ) if( CROSSED_SONG_SECONDS(20) || CROSSED_SONG_SECONDS(40) ) { - GameState::Attack a; + Attack a; a.fSecsRemaining = 10; a.level = ATTACK_LEVEL_1; a.sModifier = sPossibleModifiers[a.level][rand()%3]; @@ -153,7 +153,7 @@ void CombinedLifeMeterEnemy::Update( float fDelta ) } if( CROSSED_SONG_SECONDS(60) || CROSSED_SONG_SECONDS(80) ) { - GameState::Attack a; + Attack a; a.fSecsRemaining = 10; a.level = ATTACK_LEVEL_2; a.sModifier = sPossibleModifiers[a.level][rand()%3]; @@ -165,7 +165,7 @@ void CombinedLifeMeterEnemy::Update( float fDelta ) } if( CROSSED_SONG_SECONDS(100) ) { - GameState::Attack a; + Attack a; a.fSecsRemaining = 10; a.level = ATTACK_LEVEL_3; a.sModifier = sPossibleModifiers[a.level][rand()%3]; diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 83d55d5876..6a82ec25e9 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -676,20 +676,6 @@ void GameState::LaunchAttack( PlayerNumber target, Attack a ) a.sModifier.c_str(), target ); } -void GameState::Attack::GetAttackBeats( const Song *song, PlayerNumber pn, float &fStartBeat, float &fEndBeat ) const -{ - if( fStartSecond >= 0 ) - { - fStartBeat = song->GetBeatFromElapsedTime( fStartSecond ); - fEndBeat = song->GetBeatFromElapsedTime( fStartSecond+fSecsRemaining ); - } else { - /* We're setting this effect on the fly. If it's an arrow-changing effect - * (transform or note skin), apply it in the future, past what's currently on - * screen, so new arrows will scroll on screen with this effect. */ - GAMESTATE->GetUndisplayedBeats( pn, fSecsRemaining, fStartBeat, fEndBeat ); - } -} - void GameState::RemoveActiveAttacksForPlayer( PlayerNumber pn, AttackLevel al ) { for( int s=0; s @@ -168,19 +169,6 @@ public: StageStats m_CurStageStats; // current stage (not necessarily passed if Extra Stage) // used in PLAY_MODE_BATTLE and PLAY_MODE_RAVE - struct Attack - { - AttackLevel level; - float fStartSecond; // -1 = now - float fSecsRemaining; - CString sModifier; - - void GetAttackBeats( const Song *song, PlayerNumber pn, float &fStartBeat, float &fEndBeat ) const; - bool IsBlank() { return sModifier.empty(); } - void MakeBlank() { sModifier=""; } - Attack() { fStartSecond = -1; } - }; - typedef vector AttackArray; enum { MAX_SIMULTANEOUS_ATTACKS=16 }; Attack m_ActiveAttacks[NUM_PLAYERS][MAX_SIMULTANEOUS_ATTACKS]; diff --git a/stepmania/src/Inventory.cpp b/stepmania/src/Inventory.cpp index 5f05fe0c74..26df4ba5a1 100644 --- a/stepmania/src/Inventory.cpp +++ b/stepmania/src/Inventory.cpp @@ -160,7 +160,7 @@ void Inventory::AwardItem( int iItemIndex ) // search for the first open slot int iOpenSlot = -1; - GameState::Attack* asInventory = GAMESTATE->m_Inventory[m_PlayerNumber]; //[NUM_INVENTORY_SLOTS] + Attack* asInventory = GAMESTATE->m_Inventory[m_PlayerNumber]; //[NUM_INVENTORY_SLOTS] if( asInventory[NUM_INVENTORY_SLOTS/2].IsBlank() ) iOpenSlot = NUM_INVENTORY_SLOTS/2; @@ -176,7 +176,7 @@ void Inventory::AwardItem( int iItemIndex ) if( iOpenSlot != -1 ) { - GameState::Attack a; + Attack a; a.sModifier = g_Items[iItemIndex].sModifier; a.fSecsRemaining = ITEM_DURATION_SECONDS; a.level = g_Items[iItemIndex].level; @@ -188,13 +188,13 @@ void Inventory::AwardItem( int iItemIndex ) void Inventory::UseItem( int iSlot ) { - GameState::Attack* asInventory = GAMESTATE->m_Inventory[m_PlayerNumber]; //[NUM_INVENTORY_SLOTS] + Attack* asInventory = GAMESTATE->m_Inventory[m_PlayerNumber]; //[NUM_INVENTORY_SLOTS] if( asInventory[iSlot].IsBlank() ) return; PlayerNumber pnToAttack = OPPOSITE_PLAYER[m_PlayerNumber]; - GameState::Attack a = asInventory[iSlot]; + Attack a = asInventory[iSlot]; // remove the item asInventory[iSlot].MakeBlank(); diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index 6c715296ca..67197ce5a7 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -334,7 +334,7 @@ void PlayerMinus::Update( float fDeltaTime ) // process transforms that are waiting to be applied for( unsigned j=0; jm_ModsToApply[m_PlayerNumber].size(); j++ ) { - const GameState::Attack &mod = GAMESTATE->m_ModsToApply[m_PlayerNumber][j]; + const Attack &mod = GAMESTATE->m_ModsToApply[m_PlayerNumber][j]; PlayerOptions po; /* Should this default to "" always? need it blank so we know if mod.sModifier * changes the note skin. */ diff --git a/stepmania/src/ScoreDisplayBattle.cpp b/stepmania/src/ScoreDisplayBattle.cpp index b3d33b3de0..6db5a32b7d 100644 --- a/stepmania/src/ScoreDisplayBattle.cpp +++ b/stepmania/src/ScoreDisplayBattle.cpp @@ -53,7 +53,7 @@ void ScoreDisplayBattle::Update( float fDelta ) for( int s=0; sm_Inventory[m_PlayerNumber][s]; + Attack attack = GAMESTATE->m_Inventory[m_PlayerNumber][s]; CString sNewModifier = attack.sModifier; if( sNewModifier != m_iLastSeenInventory[s] ) diff --git a/stepmania/src/ScoreKeeperMAX2.cpp b/stepmania/src/ScoreKeeperMAX2.cpp index 9eb404e20e..15d2683352 100644 --- a/stepmania/src/ScoreKeeperMAX2.cpp +++ b/stepmania/src/ScoreKeeperMAX2.cpp @@ -25,7 +25,7 @@ #include "RageLog.h" -ScoreKeeperMAX2::ScoreKeeperMAX2( const vector& apSongs, const vector& apNotes_, const vector &asModifiers, PlayerNumber pn_ ): +ScoreKeeperMAX2::ScoreKeeperMAX2( const vector& apSongs, const vector& apNotes_, const vector &asModifiers, PlayerNumber pn_ ): ScoreKeeper(pn_), apNotes(apNotes_) { // @@ -57,7 +57,7 @@ ScoreKeeperMAX2::ScoreKeeperMAX2( const vector& apSongs, const vector& apSongs, const vector& apNotes, const vector &asModifiers, PlayerNumber pn); + ScoreKeeperMAX2( const vector& apSongs, const vector& apNotes, const vector &asModifiers, PlayerNumber pn); // before a song plays (called multiple times if course) void OnNextSong( int iSongInCourseIndex, const Steps* pNotes, const NoteData* pNoteData ); diff --git a/stepmania/src/ScoreKeeperRave.cpp b/stepmania/src/ScoreKeeperRave.cpp index d0a985f17f..01806ea4a3 100644 --- a/stepmania/src/ScoreKeeperRave.cpp +++ b/stepmania/src/ScoreKeeperRave.cpp @@ -93,7 +93,7 @@ void ScoreKeeperRave::LaunchAttack( AttackLevel al ) PlayerNumber pnToAttack = OPPOSITE_PLAYER[m_PlayerNumber]; - GameState::Attack a; + Attack a; a.level = al; a.fSecsRemaining = ATTACK_DURATION_SECONDS; a.sModifier = sAttackToGive; diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index ef711aeae4..4b070a279f 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -81,9 +81,9 @@ const ScreenMessage SM_GoToScreenAfterFail = ScreenMessage(SM_User+31); const ScreenMessage SM_StartHereWeGo = ScreenMessage(SM_User+40); const ScreenMessage SM_StopHereWeGo = ScreenMessage(SM_User+41); -void GetCourseAttackArray( const Course::Info &ci, GameState::AttackArray &out ) +void GetCourseAttackArray( const Course::Info &ci, AttackArray &out ) { - GameState::Attack a; + Attack a; a.fStartSecond = 0; a.fSecsRemaining = 10000; /* whole song */ a.level = ATTACK_LEVEL_1; @@ -169,7 +169,7 @@ ScreenGameplay::ScreenGameplay( CString sName, bool bDemonstration ) : Screen("S for( unsigned c=0; cm_pCurNotes[p] ); - m_asModifiersQueue[p].push_back( GameState::AttackArray() ); + m_asModifiersQueue[p].push_back( AttackArray() ); } } diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index 3229716333..2002aeaa36 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -28,7 +28,7 @@ class Inventory; #include "LyricDisplay.h" #include "TimingAssist.h" #include "Character.h" -#include "GameState.h" +#include "Attack.h" // messages sent by Combo const ScreenMessage SM_PlayToasty = ScreenMessage(SM_User+104); @@ -92,7 +92,7 @@ protected: } m_DancingState; vector m_apSongsQueue; // size may be >1 if playing a course vector m_apNotesQueue[NUM_PLAYERS]; // size may be >1 if playing a course - vector m_asModifiersQueue[NUM_PLAYERS];// size may be >1 if playing a course + vector m_asModifiersQueue[NUM_PLAYERS];// size may be >1 if playing a course bool m_bChangedOffsetOrBPM; float m_fTimeLeftBeforeDancingComment; // this counter is only running while STATE_DANCING diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 9b5723b3be..6c87a6a027 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -65,8 +65,8 @@ IntDir=.\../Debug6 TargetDir=\temp\stepmania TargetName=StepMania-debug SOURCE="$(InputPath)" -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \ - /Fo$(IntDir)\ +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \ + /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi # End Special Build Tool @@ -83,24 +83,24 @@ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -XBCP=xbecopy.exe -# ADD BASE XBCP /NOLOGO -# ADD XBCP /NOLOGO -XBE=imagebld.exe -# ADD BASE XBE /nologo /stack:0x10000 /debug -# ADD XBE /nologo /stack:0x10000 /debug /out:"../default.xbe" -LINK32=link.exe -# ADD BASE LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /subsystem:xbox /fixed:no /TMP -# ADD LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"../StepManiaXbox-debug.exe" /subsystem:xbox /fixed:no /TMP -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo CPP=cl.exe # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_XBOX" /D "_DEBUG" /YX /FD /G6 /Ztmp /c # ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /D "OGG_ONLY" /YX /FD /G6 /Ztmp /c +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /subsystem:xbox /fixed:no /TMP +# ADD LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"../StepManiaXbox-debug.exe" /subsystem:xbox /fixed:no /TMP +XBE=imagebld.exe +# ADD BASE XBE /nologo /stack:0x10000 /debug +# ADD XBE /nologo /stack:0x10000 /debug /out:"../default.xbe" +XBCP=xbecopy.exe +# ADD BASE XBCP /NOLOGO +# ADD XBCP /NOLOGO # Begin Special Build Tool -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \ - /Fo$(IntDir)\ +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \ + /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool @@ -140,8 +140,8 @@ IntDir=.\../Release6 TargetDir=\temp\stepmania TargetName=StepMania SOURCE="$(InputPath)" -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \ - /Fo$(IntDir)\ +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \ + /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi # End Special Build Tool @@ -159,27 +159,27 @@ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania # PROP Intermediate_Dir "StepMania___Xbox_Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -XBCP=xbecopy.exe -# ADD BASE XBCP /NOLOGO -# ADD XBCP /NOLOGO -XBE=imagebld.exe -# ADD BASE XBE /nologo /stack:0x10000 /debug -# ADD XBE /nologo /testid:"123456" /stack:0x10000 /debug /out:"../default.xbe" +CPP=cl.exe +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "NDEBUG" /YX"global.h" /FD /c +# SUBTRACT CPP /Fr +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 $(intdir)\verstub.obj xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:IX86 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe" # SUBTRACT BASE LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib # ADD LINK32 $(intdir)\verstub.obj xapilib.lib d3d8.lib d3dx8.lib xgraphics.lib dsound.lib dmusic.lib xnet.lib xboxkrnl.lib libcmt.lib /nologo /incremental:no /pdb:"../release6xbox/StepMania.pdb" /machine:I386 /nodefaultlib:"libc" /nodefaultlib:"libcmtd" /out:"../StepManiaXbox.exe" /subsystem:xbox /fixed:no /TMP /OPT:REF # SUBTRACT LINK32 /pdb:none /map /debug -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -CPP=cl.exe -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "NDEBUG" /YX"global.h" /FD /c -# SUBTRACT CPP /Fr +XBE=imagebld.exe +# ADD BASE XBE /nologo /stack:0x10000 /debug +# ADD XBE /nologo /testid:"123456" /stack:0x10000 /debug /out:"../default.xbe" +XBCP=xbecopy.exe +# ADD BASE XBCP /NOLOGO +# ADD XBCP /NOLOGO # Begin Special Build Tool -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \ - /Fo$(IntDir)\ +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \ + /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool @@ -939,6 +939,25 @@ SOURCE=.\ArrowBackdrop.h # End Source File # Begin Source File +SOURCE=.\Attack.cpp + +!IF "$(CFG)" == "StepMania - Win32 Debug" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Debug" + +!ELSEIF "$(CFG)" == "StepMania - Win32 Release" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Release" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\Attack.h +# End Source File +# Begin Source File + SOURCE=.\BannerCache.cpp !IF "$(CFG)" == "StepMania - Win32 Debug" diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index ce8296908e..438de85034 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -512,6 +512,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + +