support changing announcer in ModeChoice

This commit is contained in:
Chris Danford
2003-07-10 03:36:41 +00:00
parent 21adf68857
commit f0a69fb1fc
4 changed files with 28 additions and 12 deletions
+9 -3
View File
@@ -26,6 +26,7 @@
#include "NoteFieldPositioning.h" #include "NoteFieldPositioning.h"
#include "Character.h" #include "Character.h"
#include "UnlockSystem.h" #include "UnlockSystem.h"
#include "AnnouncerManager.h"
GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program 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; m_CurStyle = mc.style;
if( mc.dc != DIFFICULTY_INVALID && pn != PLAYER_INVALID ) if( mc.dc != DIFFICULTY_INVALID && pn != PLAYER_INVALID )
m_PreferredDifficulty[pn] = mc.dc; m_PreferredDifficulty[pn] = mc.dc;
if( mc.sAnnouncer != "" )
ANNOUNCER->SwitchAnnouncer( mc.sAnnouncer );
} }
bool GameState::IsPlayable( const ModeChoice& mc ) bool GameState::IsPlayable( const ModeChoice& mc )
@@ -401,7 +404,7 @@ bool GameState::HasEarnedExtraStage()
return false; return false;
} }
PlayerNumber GameState::GetWinner() PlayerNumber GameState::GetBestPlayer()
{ {
PlayerNumber winner = PLAYER_1; PlayerNumber winner = PLAYER_1;
for( int p=PLAYER_1+1; p<NUM_PLAYERS; p++ ) for( int p=PLAYER_1+1; p<NUM_PLAYERS; p++ )
@@ -418,9 +421,11 @@ StageResult GameState::GetStageResult( PlayerNumber pn )
{ {
switch( GAMESTATE->m_PlayMode ) switch( GAMESTATE->m_PlayMode )
{ {
case PLAY_MODE_HUMAN_BATTLE:
case PLAY_MODE_CPU_BATTLE: case PLAY_MODE_CPU_BATTLE:
if( IsHumanPlayer(pn) )
return (m_fOpponentHealthPercent==0)?RESULT_WIN:RESULT_LOSE; return (m_fOpponentHealthPercent==0)?RESULT_WIN:RESULT_LOSE;
else
return (m_fOpponentHealthPercent==0)?RESULT_LOSE:RESULT_WIN;
case PLAY_MODE_RAVE: case PLAY_MODE_RAVE:
switch( pn ) switch( pn )
{ {
@@ -428,8 +433,9 @@ StageResult GameState::GetStageResult( PlayerNumber pn )
case PLAYER_2: return (m_fTugLifePercentP1<0.5f)?RESULT_WIN:RESULT_LOSE; case PLAYER_2: return (m_fTugLifePercentP1<0.5f)?RESULT_WIN:RESULT_LOSE;
default: ASSERT(0); return RESULT_LOSE; default: ASSERT(0); return RESULT_LOSE;
} }
case PLAY_MODE_HUMAN_BATTLE:
default: default:
return (GetWinner()==pn)?RESULT_WIN:RESULT_LOSE; return (GetBestPlayer()==pn)?RESULT_WIN:RESULT_LOSE;
} }
} }
+1 -1
View File
@@ -177,7 +177,7 @@ public:
void RemoveAllActiveAttacks(); // called on end of song void RemoveAllActiveAttacks(); // called on end of song
void RemoveAllInventory(); void RemoveAllInventory();
int GetSumOfActiveAttackLevels( PlayerNumber pn ); int GetSumOfActiveAttackLevels( PlayerNumber pn );
PlayerNumber GetWinner(); PlayerNumber GetBestPlayer();
StageResult GetStageResult( PlayerNumber pn ); StageResult GetStageResult( PlayerNumber pn );
void ResetStageStatistics(); // Call this when it's time to play a new stage. void ResetStageStatistics(); // Call this when it's time to play a new stage.
+2
View File
@@ -21,6 +21,8 @@ struct ModeChoice // used in SelectMode
Style style; Style style;
PlayMode pm; PlayMode pm;
Difficulty dc; Difficulty dc;
CString sAnnouncer;
char name[64]; char name[64];
int numSidesJoinedToPlay; int numSidesJoinedToPlay;
}; };
+15 -7
View File
@@ -33,6 +33,10 @@
#define TIMER_SECONDS THEME->GetMetricI(m_sName,"TimerSeconds") #define TIMER_SECONDS THEME->GetMetricI(m_sName,"TimerSeconds")
#define NEXT_SCREEN( choice ) THEME->GetMetric (m_sName,ssprintf("NextScreen%d",choice+1)) #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) ScreenSelect::ScreenSelect( CString sClassName ) : Screen(sClassName)
{ {
@@ -51,13 +55,14 @@ ScreenSelect::ScreenSelect( CString sClassName ) : Screen(sClassName)
{ {
CString sChoice = asChoices[c]; CString sChoice = asChoices[c];
ModeChoice mc = { // fill this in below ModeChoice mc;
GAME_INVALID, mc.game = GAME_INVALID;
STYLE_INVALID, mc.style = STYLE_INVALID;
PLAY_MODE_INVALID, mc.pm = PLAY_MODE_INVALID;
DIFFICULTY_INVALID, mc.dc = DIFFICULTY_INVALID;
"", mc.sAnnouncer = "";
1 }; strcpy( mc.name, "" );
mc.numSidesJoinedToPlay = 1;
strncpy( mc.name, sChoice, sizeof(mc.name) ); strncpy( mc.name, sChoice, sizeof(mc.name) );
@@ -106,6 +111,9 @@ ScreenSelect::ScreenSelect( CString sClassName ) : Screen(sClassName)
bChoiceIsInvalid |= true; bChoiceIsInvalid |= true;
} }
if( SPECIFY_ANNOUNCER )
mc.sAnnouncer = ANNOUNCER( c );
if( mc.style != STYLE_INVALID ) if( mc.style != STYLE_INVALID )
{ {
const StyleDef* pStyleDef = GAMEMAN->GetStyleDefForStyle(mc.style); const StyleDef* pStyleDef = GAMEMAN->GetStyleDefForStyle(mc.style);