From b5cf0b87eb88666c0b29875be438da611ffe3a9f Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 31 Jan 2005 02:00:00 +0000 Subject: [PATCH] add variables for workout --- stepmania/src/GameCommand.cpp | 47 ++++++++++++++++++++++++++++++++++- stepmania/src/GameCommand.h | 6 ++++- stepmania/src/GameState.cpp | 5 ++++ stepmania/src/GameState.h | 7 ++++++ stepmania/src/PlayerState.h | 7 ++++++ 5 files changed, 70 insertions(+), 2 deletions(-) diff --git a/stepmania/src/GameCommand.cpp b/stepmania/src/GameCommand.cpp index 488708f96b..c9a0867a94 100644 --- a/stepmania/src/GameCommand.cpp +++ b/stepmania/src/GameCommand.cpp @@ -48,6 +48,10 @@ void GameCommand::Init() m_sSoundPath = ""; m_vsScreensToPrepare.clear(); m_bDeletePreparedScreens = false; + m_iWeightPounds = -1; + m_iAddToAllCourseEntryMeters = -100; + m_iStopCourseAtSeconds = -1; + m_bAutoAdjustMeterDuringCorse = false; m_bClearBookkeepingData = false; m_bClearMachineStats = false; @@ -118,6 +122,14 @@ bool GameCommand::DescribesCurrentMode( PlayerNumber pn ) const return false; if( m_SortOrder != SORT_INVALID && GAMESTATE->m_PreferredSortOrder != m_SortOrder ) return false; + if( m_iWeightPounds != -1 && GAMESTATE->m_pPlayerState[pn]->m_iWeightPounds != m_iWeightPounds ) + return false; + if( m_iAddToAllCourseEntryMeters != -100 && GAMESTATE->m_iAddToAllCourseEntryMeters != m_iAddToAllCourseEntryMeters ) + return false; + if( m_iStopCourseAtSeconds != -1 && GAMESTATE->m_iStopCourseAtSeconds != m_iStopCourseAtSeconds ) + return false; + if( m_bAutoAdjustMeterDuringCorse && !GAMESTATE->m_bAutoAdjustMeterDuringCorse ) + return false; return true; } @@ -250,6 +262,26 @@ void GameCommand::Load( int iIndex, const Commands& cmds ) } } + else if( sName == "weight" ) + { + m_iWeightPounds = atoi( sValue ); + } + + else if( sName == "addtoallcourseentrymeters" ) + { + m_iAddToAllCourseEntryMeters = atoi( sValue ); + } + + else if( sName == "stopcourseatseconds" ) + { + m_iStopCourseAtSeconds = atoi( sValue ); + } + + else if( sName == "autoadjustmeterduringcorse" ) + { + m_bAutoAdjustMeterDuringCorse = !!atoi( sValue ); + } + else if( sName == "unlock" ) { m_iUnlockIndex = atoi( sValue ); @@ -600,6 +632,15 @@ void GameCommand::Apply( const vector &vpns ) const UNLOCKMAN->UnlockCode( m_iUnlockIndex ); if( m_sSoundPath != "" ) SOUND->PlayOnce( THEME->GetPathToS( m_sSoundPath ) ); + if( m_iWeightPounds != -1 ) + FOREACH_CONST( PlayerNumber, vpns, pn ) + GAMESTATE->m_pPlayerState[*pn]->m_iWeightPounds = m_iWeightPounds; + if( m_iAddToAllCourseEntryMeters != -100 ) + GAMESTATE->m_iAddToAllCourseEntryMeters = m_iAddToAllCourseEntryMeters; + if( m_iStopCourseAtSeconds != -1 ) + GAMESTATE->m_iStopCourseAtSeconds = m_iStopCourseAtSeconds; + if( m_bAutoAdjustMeterDuringCorse ) + GAMESTATE->m_bAutoAdjustMeterDuringCorse = m_bAutoAdjustMeterDuringCorse; /* If we're going to stop music, do so before preparing new screens, so we don't * stop music between preparing screens and loading screens. */ @@ -739,7 +780,11 @@ bool GameCommand::IsZero() const m_pCharacter != NULL || m_CourseDifficulty != DIFFICULTY_INVALID || !m_sSongGroup.empty() || - m_SortOrder != SORT_INVALID + m_SortOrder != SORT_INVALID || + m_iWeightPounds != -1 || + m_iAddToAllCourseEntryMeters != -1 || + m_iStopCourseAtSeconds != -1 || + m_bAutoAdjustMeterDuringCorse ) return false; diff --git a/stepmania/src/GameCommand.h b/stepmania/src/GameCommand.h index 17d05e9bc8..8440a56498 100644 --- a/stepmania/src/GameCommand.h +++ b/stepmania/src/GameCommand.h @@ -58,7 +58,11 @@ public: int m_iUnlockIndex; // -1 for no unlock CString m_sSoundPath; // "" for no sound vector m_vsScreensToPrepare; - bool m_bDeletePreparedScreens; + bool m_bDeletePreparedScreens; + int m_iWeightPounds; // -1 == none specified + int m_iAddToAllCourseEntryMeters; // -100 == not specified + int m_iStopCourseAtSeconds; // -1 == none specified + bool m_bAutoAdjustMeterDuringCorse; bool m_bClearBookkeepingData; bool m_bClearMachineStats; diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 80223939bb..6ea20ed3ae 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -64,6 +64,7 @@ GameState::GameState() m_pPlayerState[p]->m_PlayerNumber = p; } + /* Don't reset yet; let the first screen do it, so we can * use PREFSMAN and THEME. */ // Reset(); @@ -194,6 +195,10 @@ void GameState::Reset() ASSERT( m_pCurCharacters[p] ); } + m_iAddToAllCourseEntryMeters = 0; + m_iStopCourseAtSeconds = -1; + m_bAutoAdjustMeterDuringCorse = false; + LIGHTSMAN->SetLightsMode( LIGHTSMODE_ATTRACT ); ApplyCmdline(); diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index 51ee8007a7..9889d1ab72 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -265,6 +265,13 @@ public: // PlayerState // PlayerState* m_pPlayerState[NUM_PLAYERS]; + + // + // Workout stuff + // + int m_iAddToAllCourseEntryMeters; // 0 == no change + int m_iStopCourseAtSeconds; // -1 == don't stop early + bool m_bAutoAdjustMeterDuringCorse; }; diff --git a/stepmania/src/PlayerState.h b/stepmania/src/PlayerState.h index 52574aab08..bb778707ec 100644 --- a/stepmania/src/PlayerState.h +++ b/stepmania/src/PlayerState.h @@ -42,6 +42,8 @@ struct PlayerState for( int i=0; i