From 43ef38383dcb1c29028dd6a7a1c37809ef7a1812 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 25 Mar 2007 09:37:14 +0000 Subject: [PATCH] separate CurrentStageIndex into separate number per game and per player. This allowed for staggered join periods. --- stepmania/src/GameState.cpp | 86 +++++++++++++----- stepmania/src/GameState.h | 10 ++- stepmania/src/LifeMeterBar.cpp | 2 +- stepmania/src/Makefile.am | 4 +- stepmania/src/MessageManager.cpp | 1 + stepmania/src/MessageManager.h | 1 + stepmania/src/MusicBannerWheel.cpp | 2 +- stepmania/src/MusicWheel.cpp | 6 +- stepmania/src/ScreenContinue.cpp | 120 +++++++++++++++++++++++++ stepmania/src/ScreenContinue.h | 45 ++++++++++ stepmania/src/ScreenEnding.cpp | 6 +- stepmania/src/ScreenEvaluation.cpp | 2 + stepmania/src/ScreenGameplayLesson.cpp | 2 + stepmania/src/ScreenSelectMusic.cpp | 2 +- stepmania/src/SongUtil.cpp | 2 +- stepmania/src/StepMania-net2003.vcproj | 6 ++ 16 files changed, 263 insertions(+), 34 deletions(-) create mode 100644 stepmania/src/ScreenContinue.cpp create mode 100644 stepmania/src/ScreenContinue.h diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index c4722fc89b..1fb86c203b 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -249,6 +249,8 @@ void GameState::Reset() m_bDemonstrationOrJukebox = false; m_bJukeboxUsesModifiers = false; m_iCurrentStageIndex = 0; + FOREACH_PlayerNumber( p ) + m_iPlayerCurrentStageIndexForCurrentCredit[p] = 0; m_bGameplayLeadIn.Set( false ); m_iNumStagesOfThisSong = 0; m_bLoadingNextSong = false; @@ -320,6 +322,7 @@ void GameState::Reset() void GameState::JoinPlayer( PlayerNumber pn ) { m_bSideIsJoined[pn] = true; + m_iPlayerCurrentStageIndexForCurrentCredit[pn] = 0; if( m_MasterPlayerNumber == PLAYER_INVALID ) m_MasterPlayerNumber = pn; @@ -340,6 +343,19 @@ void GameState::JoinPlayer( PlayerNumber pn ) MESSAGEMAN->Broadcast( msg ); } +void GameState::UnjoinPlayer( PlayerNumber pn ) +{ + m_bSideIsJoined[pn] = false; + m_iPlayerCurrentStageIndexForCurrentCredit[pn] = 0; + + if( m_MasterPlayerNumber == pn ) + m_MasterPlayerNumber = GAMESTATE->GetFirstHumanPlayer(); + + Message msg( MessageIDToString(Message_PlayerUnjoined) ); + msg.SetParam( "Player", pn ); + MESSAGEMAN->Broadcast( msg ); +} + /* Handle an input that can join a player. Return true if the player joined. */ bool GameState::JoinInput( PlayerNumber pn ) { @@ -586,7 +602,7 @@ int GameState::GetNumStagesForCurrentSongAndStepsOrCourse() * if a long/marathon song is selected explicitly in the theme with a GameCommand, * and PREFSMAN->m_iNumArcadeStages is less than the number of stages that * song takes. */ - int iNumStagesLeft = PREFSMAN->m_iSongsPerPlay - GAMESTATE->m_iCurrentStageIndex; + int iNumStagesLeft = GAMESTATE->GetSmallestNumStagesLeftForAnyHumanPlayer(); iNumStagesOfThisSong = min( iNumStagesOfThisSong, iNumStagesLeft ); iNumStagesOfThisSong = max( iNumStagesOfThisSong, 1 ); @@ -653,7 +669,10 @@ void GameState::FinishStage() // Increment the stage counter. ASSERT( m_iNumStagesOfThisSong >= 1 && m_iNumStagesOfThisSong <= 3 ); const int iOldStageIndex = m_iCurrentStageIndex; + m_iCurrentStageIndex += m_iNumStagesOfThisSong; + FOREACH_EnabledPlayer( p ) + m_iPlayerCurrentStageIndexForCurrentCredit[p] += m_iNumStagesOfThisSong; m_iNumStagesOfThisSong = 0; @@ -743,17 +762,15 @@ void GameState::ResetStageStatistics() STATSMAN->m_CurStageStats = StageStats(); if( PREFSMAN->m_bComboContinuesBetweenSongs ) { - if( GetStageIndex() == 0 ) + FOREACH_PlayerNumber( p ) { - FOREACH_PlayerNumber( p ) + bool bFirstSong = m_iPlayerCurrentStageIndexForCurrentCredit[p] == 0; + if( bFirstSong ) { Profile* pProfile = PROFILEMAN->GetProfile(p); STATSMAN->m_CurStageStats.m_player[p].m_iCurCombo = pProfile->m_iCurrentCombo; } - } - else // GetStageIndex() > 0 - { - FOREACH_PlayerNumber( p ) + else { STATSMAN->m_CurStageStats.m_player[p].m_iCurCombo = OldStats.m_player[p].m_iCurCombo; } @@ -818,18 +835,41 @@ float GameState::GetSongPercent( float beat ) const return (beat - m_pCurSong->m_fFirstBeat) / m_pCurSong->m_fLastBeat; } -int GameState::GetStageIndex() const +int GameState::GetSmallestCurrentStageIndexForAnyHumanPlayer() const { - return m_iCurrentStageIndex; + int iSmallest = INT_MAX; + FOREACH_HumanPlayer( p ) + iSmallest = min( iSmallest, m_iPlayerCurrentStageIndexForCurrentCredit[p] ); + return iSmallest; } -int GameState::GetNumStagesLeft() const +int GameState::GetNumStagesLeft( PlayerNumber pn ) const +{ + return PREFSMAN->m_iSongsPerPlay - m_iPlayerCurrentStageIndexForCurrentCredit[pn]; +} + +int GameState::GetSmallestNumStagesLeftForAnyHumanPlayer() const { if( IsAnExtraStage() ) return 1; if( IsEventMode() ) return 999; - return PREFSMAN->m_iSongsPerPlay - m_iCurrentStageIndex; + int iSmallest = INT_MAX; + FOREACH_HumanPlayer( p ) + iSmallest = min( iSmallest, GetNumStagesLeft(p) ); + return iSmallest; +} + +int GameState::GetLargestNumStagesLeftForAnyHumanPlayer() const +{ + if( IsAnExtraStage() ) + return 1; + if( IsEventMode() ) + return 999; + int iLargest = INT_MIN; + FOREACH_HumanPlayer( p ) + iLargest = max( iLargest, GetNumStagesLeft(p) ); + return iLargest; } bool GameState::IsFinalStage() const @@ -844,22 +884,22 @@ bool GameState::IsFinalStage() const int iPredictedStageForCurSong = GetNumStagesForCurrentSongAndStepsOrCourse(); if( iPredictedStageForCurSong == -1 ) iPredictedStageForCurSong = 1; - return m_iCurrentStageIndex + iPredictedStageForCurSong == PREFSMAN->m_iSongsPerPlay; + return GetSmallestCurrentStageIndexForAnyHumanPlayer() + iPredictedStageForCurSong == PREFSMAN->m_iSongsPerPlay; } bool GameState::IsAnExtraStage() const { - return !IsEventMode() && !IsCourseMode() && m_iCurrentStageIndex >= PREFSMAN->m_iSongsPerPlay; + return !IsEventMode() && !IsCourseMode() && GetSmallestCurrentStageIndexForAnyHumanPlayer() >= PREFSMAN->m_iSongsPerPlay; } bool GameState::IsExtraStage() const { - return !IsEventMode() && !IsCourseMode() && m_iCurrentStageIndex == PREFSMAN->m_iSongsPerPlay; + return !IsEventMode() && !IsCourseMode() && GetSmallestCurrentStageIndexForAnyHumanPlayer() == PREFSMAN->m_iSongsPerPlay; } bool GameState::IsExtraStage2() const { - return !IsEventMode() && !IsCourseMode() && m_iCurrentStageIndex == PREFSMAN->m_iSongsPerPlay+1; + return !IsEventMode() && !IsCourseMode() && GetSmallestCurrentStageIndexForAnyHumanPlayer() == PREFSMAN->m_iSongsPerPlay+1; } Stage GameState::GetCurrentStage() const @@ -873,7 +913,7 @@ Stage GameState::GetCurrentStage() const else if( IsFinalStage() ) return STAGE_FINAL; else if( IsExtraStage() ) return STAGE_EXTRA1; else if( IsExtraStage2() ) return STAGE_EXTRA2; - else return (Stage)(STAGE_1+m_iCurrentStageIndex); + else return (Stage)(STAGE_1+GetSmallestCurrentStageIndexForAnyHumanPlayer()); } // Return true if it's possible for GetCurrentStage() to return the given stage. @@ -1059,7 +1099,6 @@ PlayerNumber GameState::GetFirstHumanPlayer() const { FOREACH_HumanPlayer( pn ) return pn; - ASSERT(0); // there must be at least 1 human player return PLAYER_INVALID; } @@ -1343,7 +1382,7 @@ SongOptions::FailType GameState::GetPlayerFailType( const PlayerState *pPlayerSt if( m_pCurSteps[pn] ) dc = m_pCurSteps[pn]->GetDifficulty(); - bool bFirstStage = !IsEventMode() && m_iCurrentStageIndex == 0; + bool bFirstStage = !IsEventMode() && GetSmallestCurrentStageIndexForAnyHumanPlayer() == 0; /* Easy and beginner are never harder than FAIL_IMMEDIATE_CONTINUE. */ if( dc <= Difficulty_Easy ) @@ -2102,7 +2141,7 @@ public: DEFINE_METHOD( IsDemonstration, m_bDemonstrationOrJukebox ) DEFINE_METHOD( GetPlayMode, m_PlayMode ) DEFINE_METHOD( GetSortOrder, m_SortOrder ) - DEFINE_METHOD( GetStageIndex, GetStageIndex() ) + DEFINE_METHOD( GetStageIndex, m_iCurrentStageIndex ) DEFINE_METHOD( IsGoalComplete, IsGoalComplete(Enum::Check(L, 1)) ) DEFINE_METHOD( PlayerIsUsingModifier, PlayerIsUsingModifier(Enum::Check(L, 1), SArg(2)) ) DEFINE_METHOD( GetCourseSongIndex, GetCourseSongIndex() ) @@ -2232,7 +2271,13 @@ public: return 1; } static int GetNumStagesForCurrentSongAndStepsOrCourse( T* p, lua_State *L ) { lua_pushnumber(L, GameState::GetNumStagesForCurrentSongAndStepsOrCourse() ); return 1; } - + static int GetNumStagesLeft( T* p, lua_State *L ) + { + PlayerNumber pn = Enum::Check(L, 1); + lua_pushnumber(L, p->GetNumStagesLeft(pn)); + return 1; + } + LunaGameState() { ADD_METHOD( IsPlayerEnabled ); @@ -2309,6 +2354,7 @@ public: ADD_METHOD( GetCurrentStyle ); ADD_METHOD( IsAnyHumanPlayerUsingMemoryCard ); ADD_METHOD( GetNumStagesForCurrentSongAndStepsOrCourse ); + ADD_METHOD( GetNumStagesLeft ); } }; diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index 6a8887d75a..421caceaf7 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -41,6 +41,7 @@ public: void ApplyGameCommand( const RString &sCommand, PlayerNumber pn=PLAYER_INVALID ); void BeginGame(); // called when first player joins void JoinPlayer( PlayerNumber pn ); + void UnjoinPlayer( PlayerNumber pn ); bool JoinInput( PlayerNumber pn ); void PlayersFinalized(); // called after a style is chosen, which means the number of players is finalized void EndGame(); // called on ScreenGameOver, ScreenMusicScroll, ScreenCredits @@ -116,18 +117,23 @@ public: bool m_bDemonstrationOrJukebox; // ScreenGameplay does special stuff when this is true bool m_bJukeboxUsesModifiers; int m_iNumStagesOfThisSong; + // Increases every stage, doesn't reset when player continues. It's cosmetic and not used in Stage or Screen branching logic. int m_iCurrentStageIndex; + // Num stages played since player joined or conintues by using a credit. Increases every stage if the player is joined. Resets when player joins/continues. + int m_iPlayerCurrentStageIndexForCurrentCredit[NUM_PLAYERS]; static int GetNumStagesMultiplierForSong( const Song* pSong ); static int GetNumStagesForSongAndStyleType( const Song* pSong, StyleType st ); static int GetNumStagesForCurrentSongAndStepsOrCourse(); - int GetStageIndex() const; void BeginStage(); void CancelStage(); void CommitStageStats(); void FinishStage(); - int GetNumStagesLeft() const; + int GetSmallestCurrentStageIndexForAnyHumanPlayer() const; + int GetNumStagesLeft( PlayerNumber pn ) const; + int GetSmallestNumStagesLeftForAnyHumanPlayer() const; + int GetLargestNumStagesLeftForAnyHumanPlayer() const; bool IsFinalStage() const; bool IsAnExtraStage() const; bool IsExtraStage() const; diff --git a/stepmania/src/LifeMeterBar.cpp b/stepmania/src/LifeMeterBar.cpp index 209230dca9..46d1d748cd 100644 --- a/stepmania/src/LifeMeterBar.cpp +++ b/stepmania/src/LifeMeterBar.cpp @@ -304,7 +304,7 @@ void LifeMeterBar::UpdateNonstopLifebar() if( GAMESTATE->IsEventMode() || GAMESTATE->m_bDemonstrationOrJukebox ) return; - iCleared = GAMESTATE->GetStageIndex(); + iCleared = GAMESTATE->GetSmallestCurrentStageIndexForAnyHumanPlayer(); iTotal = PREFSMAN->m_iSongsPerPlay; iProgressiveLifebarDifficulty = PREFSMAN->m_iProgressiveStageLifebar; break; diff --git a/stepmania/src/Makefile.am b/stepmania/src/Makefile.am index d186665a94..bb1b393815 100644 --- a/stepmania/src/Makefile.am +++ b/stepmania/src/Makefile.am @@ -24,7 +24,9 @@ LIBS += -lpthread -lrt Screens = \ Screen.cpp Screen.h ScreenAttract.cpp ScreenAttract.h \ ScreenBookkeeping.cpp ScreenBookkeeping.h \ -ScreenCenterImage.cpp ScreenCenterImage.h ScreenCredits.cpp ScreenCredits.h \ +ScreenCenterImage.cpp ScreenCenterImage.h \ +ScreenContinue.cpp ScreenContinue.h \ +ScreenCredits.cpp ScreenCredits.h \ ScreenDebugOverlay.cpp ScreenDebugOverlay.h \ ScreenDemonstration.cpp ScreenDemonstration.h ScreenDimensions.h \ ScreenEdit.cpp ScreenEdit.h \ diff --git a/stepmania/src/MessageManager.cpp b/stepmania/src/MessageManager.cpp index b8bfccee2a..999c53bfaf 100644 --- a/stepmania/src/MessageManager.cpp +++ b/stepmania/src/MessageManager.cpp @@ -54,6 +54,7 @@ static const char *MessageIDNames[] = { "CoinInserted", "PlayerJoined", "PlayersFinalized", + "PlayerUnjoined", "AutosyncChanged", "PreferredSongGroupChanged", "PreferredCourseGroupChanged", diff --git a/stepmania/src/MessageManager.h b/stepmania/src/MessageManager.h index 841216d026..50a4cdaa39 100644 --- a/stepmania/src/MessageManager.h +++ b/stepmania/src/MessageManager.h @@ -51,6 +51,7 @@ enum MessageID Message_CoinInserted, Message_PlayerJoined, Message_PlayersFinalized, + Message_PlayerUnjoined, Message_AutosyncChanged, Message_PreferredSongGroupChanged, Message_PreferredCourseGroupChanged, diff --git a/stepmania/src/MusicBannerWheel.cpp b/stepmania/src/MusicBannerWheel.cpp index 89df6b1ba6..f98f008dbe 100644 --- a/stepmania/src/MusicBannerWheel.cpp +++ b/stepmania/src/MusicBannerWheel.cpp @@ -65,7 +65,7 @@ MusicBannerWheel::MusicBannerWheel() { vector vTempSongs; SongCriteria sc; - sc.m_iMaxStagesForSong = GAMESTATE->GetNumStagesLeft(); + sc.m_iMaxStagesForSong = GAMESTATE->GetSmallestNumStagesLeftForAnyHumanPlayer(); SongUtil::FilterSongs( sc, arraySongs, vTempSongs ); arraySongs = vTempSongs; } diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index 0449ba9314..69b3e121e6 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -159,7 +159,7 @@ void MusicWheel::BeginScreen() /* Invalidate current Song if it can't be played * because there are not enough stages remaining. */ if( GAMESTATE->m_pCurSong != NULL && - GameState::GetNumStagesMultiplierForSong( GAMESTATE->m_pCurSong ) > GAMESTATE->GetNumStagesLeft() ) + GameState::GetNumStagesMultiplierForSong( GAMESTATE->m_pCurSong ) > GAMESTATE->GetSmallestNumStagesLeftForAnyHumanPlayer() ) { GAMESTATE->m_pCurSong.Set( NULL ); } @@ -342,7 +342,7 @@ void MusicWheel::GetSongList( vector &arraySongs, SortOrder so, const RSt { vector vTempSongs; SongCriteria sc; - sc.m_iMaxStagesForSong = GAMESTATE->GetNumStagesLeft(); + sc.m_iMaxStagesForSong = GAMESTATE->GetSmallestNumStagesLeftForAnyHumanPlayer(); SongUtil::FilterSongs( sc, apAllSongs, vTempSongs ); apAllSongs = vTempSongs; } @@ -407,7 +407,7 @@ void MusicWheel::BuildWheelItemDatas( vector &arrayWheelItemDat case SORT_ONI_COURSES: case SORT_ENDLESS_COURSES: /* Don't display course modes after the first stage. */ - if( !GAMESTATE->IsEventMode() && GAMESTATE->m_iCurrentStageIndex ) + if( !GAMESTATE->IsEventMode() && GAMESTATE->GetLargestNumStagesLeftForAnyHumanPlayer() > 0 ) continue; } diff --git a/stepmania/src/ScreenContinue.cpp b/stepmania/src/ScreenContinue.cpp new file mode 100644 index 0000000000..b7c0bf8db9 --- /dev/null +++ b/stepmania/src/ScreenContinue.cpp @@ -0,0 +1,120 @@ +#include "global.h" +#include "ScreenContinue.h" +#include "ScreenManager.h" +#include "SongManager.h" +#include "GameSoundManager.h" +#include "ThemeManager.h" +#include "AnnouncerManager.h" +#include "song.h" +#include "ProfileManager.h" +#include "Profile.h" +#include "ActorUtil.h" +#include "GameState.h" +#include "MemoryCardManager.h" +#include "RageLog.h" +#include "Style.h" +#include "GameManager.h" +#include "PrefsManager.h" +#include "StatsManager.h" +#include "PlayerState.h" +#include "CommonMetrics.h" +#include "InputEventPlus.h" +#include "MenuTimer.h" + + +REGISTER_SCREEN_CLASS( ScreenContinue ); +ScreenContinue::ScreenContinue() : ScreenWithMenuElements() +{ +} + +void ScreenContinue::Init() +{ + ScreenWithMenuElements::Init(); +} + +void ScreenContinue::BeginScreen() +{ + GAMESTATE->FinishStage(); + + GAMESTATE->SetCurrentStyle( NULL ); + + // unjoin all players with 0 stages left + FOREACH_HumanPlayer( p ) + { + bool bNoStagesLeft = GAMESTATE->m_iPlayerCurrentStageIndexForCurrentCredit[p] >= PREFSMAN->m_iSongsPerPlay; + if( bNoStagesLeft ) + GAMESTATE->UnjoinPlayer( p ); + } + + ScreenWithMenuElements::BeginScreen(); +} + +void ScreenContinue::Input( const InputEventPlus &input ) +{ + if( input.MenuI == MENU_BUTTON_START && input.type == IET_FIRST_PRESS && GAMESTATE->JoinInput(input.pn) ) + { + bool bAllPlayersAreEnabled = true; + FOREACH_ENUM( PlayerNumber, p ) + { + if( !GAMESTATE->IsPlayerEnabled(p) ) + bAllPlayersAreEnabled = false; + } + if( bAllPlayersAreEnabled ) + { + m_MenuTimer->Stop(); + if( !IsTransitioning() ) + StartTransitioningScreen( SM_GoToNextScreen ); + } + return; // handled + } + + if( IsTransitioning() ) + return; + + if( input.MenuI == MENU_BUTTON_START && input.type == IET_FIRST_PRESS && GAMESTATE->IsHumanPlayer(input.pn) ) + { + m_MenuTimer->SetSeconds( m_MenuTimer->GetSeconds() - 1 ); + return; // handled + } + + ScreenWithMenuElements::Input( input ); +} + +void ScreenContinue::HandleScreenMessage( const ScreenMessage SM ) +{ + RString s = ScreenMessageHelpers::NumberToString( SM ); + + if( SM == SM_MenuTimer ) + { + if( !IsTransitioning() ) + StartTransitioningScreen( SM_GoToNextScreen ); + return; + } + + ScreenWithMenuElements::HandleScreenMessage( SM ); +} + +/* + * (c) 2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/stepmania/src/ScreenContinue.h b/stepmania/src/ScreenContinue.h new file mode 100644 index 0000000000..d88e0d42b3 --- /dev/null +++ b/stepmania/src/ScreenContinue.h @@ -0,0 +1,45 @@ +/* ScreenContinue - . */ + +#ifndef ScreenContinue_H +#define ScreenContinue_H + +#include "ScreenWithMenuElements.h" + +class ScreenContinue : public ScreenWithMenuElements +{ +public: + ScreenContinue(); + virtual void Init(); + virtual void BeginScreen(); + virtual void Input( const InputEventPlus &input ); + virtual void HandleScreenMessage( const ScreenMessage SM ); + virtual bool AllowLateJoin() const { return true; } +private: +}; + +#endif + +/* + * (c) 2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/stepmania/src/ScreenEnding.cpp b/stepmania/src/ScreenEnding.cpp index 09676b81a9..448d303797 100644 --- a/stepmania/src/ScreenEnding.cpp +++ b/stepmania/src/ScreenEnding.cpp @@ -42,6 +42,8 @@ ScreenEnding::ScreenEnding() : ScreenAttract( false/*dont reset GAMESTATE*/ ) PO_GROUP_ASSIGN( GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions, ModsLevel_Stage, m_fScrollSpeed, 2.0f ); PO_GROUP_ASSIGN( GAMESTATE->m_pPlayerState[PLAYER_2]->m_PlayerOptions, ModsLevel_Stage, m_fScrollSpeed, 2.0f ); GAMESTATE->m_iCurrentStageIndex = 0; + FOREACH_ENUM( PlayerNumber, p ) + GAMESTATE->m_iPlayerCurrentStageIndexForCurrentCredit[p] = 0; PO_GROUP_CALL( GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions, ModsLevel_Stage, ChooseRandomModifiers ); PO_GROUP_CALL( GAMESTATE->m_pPlayerState[PLAYER_2]->m_PlayerOptions, ModsLevel_Stage, ChooseRandomModifiers ); @@ -84,10 +86,6 @@ void ScreenEnding::Init() { ScreenAttract::Init(); - vector arraySongs; - SONGMAN->GetSongs( arraySongs ); - SongUtil::SortSongPointerArrayByTitle( arraySongs ); - FOREACH_HumanPlayer( p ) { if( !PROFILEMAN->IsPersistentProfile(p) ) diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 43d996c9d1..4f71386f65 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -101,6 +101,8 @@ ScreenEvaluation::ScreenEvaluation() STATSMAN->m_CurStageStats.m_vpPossibleSongs.push_back( GAMESTATE->m_pCurSong ); GAMESTATE->m_pCurCourse.Set( SONGMAN->GetRandomCourse() ); GAMESTATE->m_iCurrentStageIndex = 0; + FOREACH_ENUM( PlayerNumber, p ) + GAMESTATE->m_iPlayerCurrentStageIndexForCurrentCredit[p] = 0; FOREACH_PlayerNumber( p ) { diff --git a/stepmania/src/ScreenGameplayLesson.cpp b/stepmania/src/ScreenGameplayLesson.cpp index f02a493b41..5ba722c5f1 100644 --- a/stepmania/src/ScreenGameplayLesson.cpp +++ b/stepmania/src/ScreenGameplayLesson.cpp @@ -57,6 +57,8 @@ void ScreenGameplayLesson::Init() // Reset stage number (not relevant in lessons) GAMESTATE->m_iCurrentStageIndex = 0; + FOREACH_ENUM( PlayerNumber, p ) + GAMESTATE->m_iPlayerCurrentStageIndexForCurrentCredit[p] = 0; // Autoplay during demonstration FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi ) diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index f98690dd86..8c80cc16f1 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -180,7 +180,7 @@ void ScreenSelectMusic::Init() void ScreenSelectMusic::BeginScreen() { /* Finish any previous stage. It's OK to call this when we havn't played a stage yet. - * Do this before anything that might look at GAMESTATE->m_iCurrentStageIndex. */ + * Do this before anything that might look at GAMESTATE->m_iCurrentStageIndex or GAMESTATE->m_iPlayerCurrentStageIndexForCurrentCredit. */ GAMESTATE->FinishStage(); LIGHTSMAN->SetLightsMode( LIGHTSMODE_MENU ); diff --git a/stepmania/src/SongUtil.cpp b/stepmania/src/SongUtil.cpp index 473c63fc8a..0b23c8de6a 100644 --- a/stepmania/src/SongUtil.cpp +++ b/stepmania/src/SongUtil.cpp @@ -832,7 +832,7 @@ static void GetPlayableStepsTypes( const Song *pSong, set &vOut ) bool bShowThisStepsType = find( vstToShow.begin(), vstToShow.end(), *st ) != vstToShow.end(); const Style *pStyle = GAMEMAN->GetFirstCompatibleStyle( GAMESTATE->m_pCurGame, GAMESTATE->GetNumPlayersEnabled(), *st ); - bool bEnoughStages = GAMESTATE->GetNumStagesLeft() >= GAMESTATE->GetNumStagesForSongAndStyleType(pSong, pStyle->m_StyleType); + bool bEnoughStages = GAMESTATE->GetSmallestNumStagesLeftForAnyHumanPlayer() >= GAMESTATE->GetNumStagesForSongAndStyleType(pSong, pStyle->m_StyleType); if( bShowThisStepsType && bEnoughStages ) vOut.insert( *st ); diff --git a/stepmania/src/StepMania-net2003.vcproj b/stepmania/src/StepMania-net2003.vcproj index 851444c3fd..75380648aa 100644 --- a/stepmania/src/StepMania-net2003.vcproj +++ b/stepmania/src/StepMania-net2003.vcproj @@ -286,6 +286,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + +