diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 3c4f3093f9..3986a4b1dd 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -26,6 +26,7 @@ #include "NoteFieldPositioning.h" #include "Character.h" #include "UnlockSystem.h" +#include "AnnouncerManager.h" GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program @@ -288,6 +289,8 @@ void GameState::ApplyModeChoice( const ModeChoice& mc, PlayerNumber pn ) m_CurStyle = mc.style; if( mc.dc != DIFFICULTY_INVALID && pn != PLAYER_INVALID ) m_PreferredDifficulty[pn] = mc.dc; + if( mc.sAnnouncer != "" ) + ANNOUNCER->SwitchAnnouncer( mc.sAnnouncer ); } bool GameState::IsPlayable( const ModeChoice& mc ) @@ -401,7 +404,7 @@ bool GameState::HasEarnedExtraStage() return false; } -PlayerNumber GameState::GetWinner() +PlayerNumber GameState::GetBestPlayer() { PlayerNumber winner = PLAYER_1; for( int p=PLAYER_1+1; pm_PlayMode ) { - case PLAY_MODE_HUMAN_BATTLE: case PLAY_MODE_CPU_BATTLE: - return (m_fOpponentHealthPercent==0)?RESULT_WIN:RESULT_LOSE; + if( IsHumanPlayer(pn) ) + return (m_fOpponentHealthPercent==0)?RESULT_WIN:RESULT_LOSE; + else + return (m_fOpponentHealthPercent==0)?RESULT_LOSE:RESULT_WIN; case PLAY_MODE_RAVE: switch( pn ) { @@ -428,8 +433,9 @@ StageResult GameState::GetStageResult( PlayerNumber pn ) case PLAYER_2: return (m_fTugLifePercentP1<0.5f)?RESULT_WIN:RESULT_LOSE; default: ASSERT(0); return RESULT_LOSE; } + case PLAY_MODE_HUMAN_BATTLE: default: - return (GetWinner()==pn)?RESULT_WIN:RESULT_LOSE; + return (GetBestPlayer()==pn)?RESULT_WIN:RESULT_LOSE; } } diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index ad5f14d2f5..8af6387a6a 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -177,7 +177,7 @@ public: void RemoveAllActiveAttacks(); // called on end of song void RemoveAllInventory(); int GetSumOfActiveAttackLevels( PlayerNumber pn ); - PlayerNumber GetWinner(); + PlayerNumber GetBestPlayer(); StageResult GetStageResult( PlayerNumber pn ); void ResetStageStatistics(); // Call this when it's time to play a new stage. diff --git a/stepmania/src/ModeChoice.h b/stepmania/src/ModeChoice.h index 49a3201e58..98744154a3 100644 --- a/stepmania/src/ModeChoice.h +++ b/stepmania/src/ModeChoice.h @@ -21,6 +21,8 @@ struct ModeChoice // used in SelectMode Style style; PlayMode pm; Difficulty dc; + CString sAnnouncer; + char name[64]; int numSidesJoinedToPlay; }; diff --git a/stepmania/src/ScreenSelect.cpp b/stepmania/src/ScreenSelect.cpp index 595eaa503f..428fe1b00d 100644 --- a/stepmania/src/ScreenSelect.cpp +++ b/stepmania/src/ScreenSelect.cpp @@ -33,6 +33,10 @@ #define TIMER_SECONDS THEME->GetMetricI(m_sName,"TimerSeconds") #define NEXT_SCREEN( choice ) THEME->GetMetric (m_sName,ssprintf("NextScreen%d",choice+1)) +// Temporary hack: specify announcer in selection +#define SPECIFY_ANNOUNCER THEME->HasMetric(m_sName,"Announcer1") +#define ANNOUNCER( choice ) THEME->GetMetric (m_sName,ssprintf("Announcer%d",choice+1)) + ScreenSelect::ScreenSelect( CString sClassName ) : Screen(sClassName) { @@ -51,13 +55,14 @@ ScreenSelect::ScreenSelect( CString sClassName ) : Screen(sClassName) { CString sChoice = asChoices[c]; - ModeChoice mc = { // fill this in below - GAME_INVALID, - STYLE_INVALID, - PLAY_MODE_INVALID, - DIFFICULTY_INVALID, - "", - 1 }; + ModeChoice mc; + mc.game = GAME_INVALID; + mc.style = STYLE_INVALID; + mc.pm = PLAY_MODE_INVALID; + mc.dc = DIFFICULTY_INVALID; + mc.sAnnouncer = ""; + strcpy( mc.name, "" ); + mc.numSidesJoinedToPlay = 1; strncpy( mc.name, sChoice, sizeof(mc.name) ); @@ -106,6 +111,9 @@ ScreenSelect::ScreenSelect( CString sClassName ) : Screen(sClassName) bChoiceIsInvalid |= true; } + if( SPECIFY_ANNOUNCER ) + mc.sAnnouncer = ANNOUNCER( c ); + if( mc.style != STYLE_INVALID ) { const StyleDef* pStyleDef = GAMEMAN->GetStyleDefForStyle(mc.style);