From a3e0bacbd8fea76169068e3e43613b90c64b8d1d Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Fri, 11 Mar 2005 18:09:34 +0000 Subject: [PATCH] Reset the round seed so that the players get new shuffle patterns if they Back out of gameplay and play again RoundSeed -> StageSeed --- stepmania/src/ArrowEffects.cpp | 2 +- stepmania/src/Course.cpp | 6 +++--- stepmania/src/GameState.cpp | 6 +++--- stepmania/src/GameState.h | 2 +- stepmania/src/NoteDataUtil.cpp | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/stepmania/src/ArrowEffects.cpp b/stepmania/src/ArrowEffects.cpp index 89171a1731..a81e6df7fc 100644 --- a/stepmania/src/ArrowEffects.cpp +++ b/stepmania/src/ArrowEffects.cpp @@ -89,7 +89,7 @@ float ArrowEffects::GetYOffset( const PlayerState* pPlayerState, int iCol, float float fScrollSpeed = pPlayerState->m_CurrentPlayerOptions.m_fScrollSpeed; if( pPlayerState->m_CurrentPlayerOptions.m_fRandomSpeed > 0 && !bAbsolute ) { - int seed = GAMESTATE->m_iRoundSeed + ( BeatToNoteRow( fNoteBeat ) << 8 ) + (iCol * 100); + int seed = GAMESTATE->m_iStageSeed + ( BeatToNoteRow( fNoteBeat ) << 8 ) + (iCol * 100); /* Temporary hack: the first call to RandomFloat isn't "random"; it takes an extra * call to get the RNG rolling. */ diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index 347efc69ce..b92ccd1c33 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -682,7 +682,7 @@ Trail* Course::GetTrail( StepsType st, CourseDifficulty cd ) const // // Check to see if the Trail cache is out of date // - if( m_iTrailCacheSeed != GAMESTATE->m_iRoundSeed ) + if( m_iTrailCacheSeed != GAMESTATE->m_iStageSeed ) { /* If we have any random entries (so that the seed matters), invalidate the cache. */ bool bHaveRandom = false; @@ -694,7 +694,7 @@ Trail* Course::GetTrail( StepsType st, CourseDifficulty cd ) const if( bHaveRandom ) m_TrailCache.clear(); - m_iTrailCacheSeed = GAMESTATE->m_iRoundSeed; + m_iTrailCacheSeed = GAMESTATE->m_iStageSeed; } // @@ -794,7 +794,7 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail ) // Construct a new Trail, add it to the cache, then return it. // /* Different seed for each course, but the same for the whole round: */ - RandomGen rnd( GAMESTATE->m_iRoundSeed + GetHashForString(m_sMainTitle) ); + RandomGen rnd( GAMESTATE->m_iStageSeed + GetHashForString(m_sMainTitle) ); vector tmp_entries; if( m_bRandomize ) diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 10413b891a..375e3f0caf 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -61,7 +61,7 @@ GameState::GameState() : ReloadCharacters(); m_iNumTimesThroughAttract = -1; // initial screen will bump this up to 0 - m_iRoundSeed = m_iGameSeed = 0; + m_iStageSeed = m_iGameSeed = 0; m_PlayMode = PLAY_MODE_INVALID; // used by IsPlayerEnabled before the first screen FOREACH_PlayerNumber( p ) @@ -157,7 +157,7 @@ void GameState::Reset() NOTESKIN->RefreshNoteSkinData( this->m_pCurGame ); m_iGameSeed = rand(); - m_iRoundSeed = rand(); + m_iStageSeed = rand(); m_pCurSong.Set( NULL ); m_pPreferredSong = NULL; @@ -647,7 +647,7 @@ void GameState::ResetStageStatistics() // Reset the round seed. Do this here and not in FinishStage so that players // get new shuffle patterns if they Back out of gameplay and play again. - GAMESTATE->m_iRoundSeed = rand(); + GAMESTATE->m_iStageSeed = rand(); } void GameState::UpdateSongPosition( float fPositionSeconds, const TimingData &timing, const RageTimer ×tamp ) diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index ccf46c9454..605f03af01 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -67,7 +67,7 @@ public: map m_mapEnv; /* This is set to a random number per-game/round; it can be used for a random seed. */ - int m_iGameSeed, m_iRoundSeed; + int m_iGameSeed, m_iStageSeed; bool PlayersCanJoin() const; // true if it's not too late for a player to join bool EnoughCreditsToJoin() const; // true if an unjoined player can join by pressint start diff --git a/stepmania/src/NoteDataUtil.cpp b/stepmania/src/NoteDataUtil.cpp index b3284e211a..2a895d6cca 100644 --- a/stepmania/src/NoteDataUtil.cpp +++ b/stepmania/src/NoteDataUtil.cpp @@ -786,7 +786,7 @@ static void GetTrackMapping( StepsType st, NoteDataUtil::TrackMapping tt, int Nu int iOrig[MAX_NOTE_TRACKS]; memcpy( iOrig, iTakeFromTrack, sizeof(iOrig) ); - int iShuffleSeed = GAMESTATE->m_iRoundSeed; + int iShuffleSeed = GAMESTATE->m_iStageSeed; do { RandomGen rnd( iShuffleSeed ); random_shuffle( &iTakeFromTrack[0], &iTakeFromTrack[NumTracks], rnd );