clean up CPU player naming
add default CPU player modifiers
This commit is contained in:
@@ -18,6 +18,7 @@ FirstRunInitialScreen=ScreenCompany
|
|||||||
InitialScreen=ScreenCompany
|
InitialScreen=ScreenCompany
|
||||||
WindowTitle=StepMania
|
WindowTitle=StepMania
|
||||||
DefaultModifiers=
|
DefaultModifiers=
|
||||||
|
DefaultCpuModifiers=
|
||||||
JoinPauseSeconds=0.8
|
JoinPauseSeconds=0.8
|
||||||
DifficultiesToShow=beginner,easy,medium,hard,challenge
|
DifficultiesToShow=beginner,easy,medium,hard,challenge
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
#define DEFAULT_MODIFIERS THEME->GetMetric( "Common","DefaultModifiers" )
|
#define DEFAULT_MODIFIERS THEME->GetMetric( "Common","DefaultModifiers" )
|
||||||
|
#define DEFAULT_CPU_MODIFIERS THEME->GetMetric( "Common","DefaultCpuModifiers" )
|
||||||
#define DIFFICULTIES_TO_SHOW THEME->GetMetric( "Common","DifficultiesToShow" )
|
#define DIFFICULTIES_TO_SHOW THEME->GetMetric( "Common","DifficultiesToShow" )
|
||||||
|
|
||||||
GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program
|
GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program
|
||||||
@@ -168,7 +169,7 @@ void GameState::Reset()
|
|||||||
}
|
}
|
||||||
m_SongOptions.Init();
|
m_SongOptions.Init();
|
||||||
|
|
||||||
for( p=0; p<NUM_PLAYERS; p++ )
|
FOREACH_PlayerNumber(p)
|
||||||
{
|
{
|
||||||
// I can't think of a good reason to have both game-specific
|
// I can't think of a good reason to have both game-specific
|
||||||
// default mods and theme specific default mods. We should choose
|
// default mods and theme specific default mods. We should choose
|
||||||
@@ -177,11 +178,11 @@ void GameState::Reset()
|
|||||||
// The theme setting is for eg. BM being reverse by default. (This
|
// The theme setting is for eg. BM being reverse by default. (This
|
||||||
// could be done in the title menu ModeChoice, but then it wouldn't
|
// could be done in the title menu ModeChoice, but then it wouldn't
|
||||||
// affect demo, and other non-gameplay things ...) -glenn
|
// affect demo, and other non-gameplay things ...) -glenn
|
||||||
ApplyModifiers( (PlayerNumber)p, DEFAULT_MODIFIERS );
|
ApplyModifiers( p, DEFAULT_MODIFIERS );
|
||||||
ApplyModifiers( (PlayerNumber)p, PREFSMAN->m_sDefaultModifiers );
|
ApplyModifiers( p, PREFSMAN->m_sDefaultModifiers );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( p=0; p<NUM_PLAYERS; p++ )
|
FOREACH_PlayerNumber(p)
|
||||||
{
|
{
|
||||||
if( PREFSMAN->m_ShowDancingCharacters == PrefsManager::CO_RANDOM)
|
if( PREFSMAN->m_ShowDancingCharacters == PrefsManager::CO_RANDOM)
|
||||||
m_pCurCharacters[p] = GetRandomCharacter();
|
m_pCurCharacters[p] = GetRandomCharacter();
|
||||||
@@ -190,7 +191,7 @@ void GameState::Reset()
|
|||||||
ASSERT( m_pCurCharacters[p] );
|
ASSERT( m_pCurCharacters[p] );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( p=0; p<NUM_PLAYERS; p++ )
|
FOREACH_PlayerNumber(p)
|
||||||
{
|
{
|
||||||
m_fSuperMeterGrowthScale[p] = 1;
|
m_fSuperMeterGrowthScale[p] = 1;
|
||||||
m_iCpuSkill[p] = 5;
|
m_iCpuSkill[p] = 5;
|
||||||
@@ -275,7 +276,10 @@ void GameState::PlayersFinalized()
|
|||||||
m_pCurSong = pProfile->m_pLastSong;
|
m_pCurSong = pProfile->m_pLastSong;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FOREACH_CpuPlayer( pn )
|
||||||
|
{
|
||||||
|
ApplyModifiers( pn, DEFAULT_CPU_MODIFIERS );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This data is added to each player profile, and to the machine profile per-player. */
|
/* This data is added to each player profile, and to the machine profile per-player. */
|
||||||
@@ -693,6 +697,23 @@ int GameState::GetCourseSongIndex() const
|
|||||||
return iSongIndex;
|
return iSongIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CString GameState::GetPlayerDisplayName( PlayerNumber pn ) const
|
||||||
|
{
|
||||||
|
ASSERT( IsPlayerEnabled(pn) );
|
||||||
|
const CString defaultnames[NUM_PLAYERS] = { "PLAYER 1", "PLAYER 2" };
|
||||||
|
if( IsHumanPlayer(pn) )
|
||||||
|
{
|
||||||
|
if( !PROFILEMAN->GetPlayerName(pn).empty() )
|
||||||
|
return PROFILEMAN->GetPlayerName(pn);
|
||||||
|
else
|
||||||
|
return defaultnames[pn];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "CPU";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool GameState::PlayersCanJoin() const
|
bool GameState::PlayersCanJoin() const
|
||||||
{
|
{
|
||||||
return GetNumSidesJoined() == 0 || this->m_CurStyle == STYLE_INVALID; // selecting a style finalizes the players
|
return GetNumSidesJoined() == 0 || this->m_CurStyle == STYLE_INVALID; // selecting a style finalizes the players
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ public:
|
|||||||
CString GetStageText() const;
|
CString GetStageText() const;
|
||||||
void GetAllStageTexts( CStringArray &out ) const;
|
void GetAllStageTexts( CStringArray &out ) const;
|
||||||
int GetCourseSongIndex() const;
|
int GetCourseSongIndex() const;
|
||||||
|
CString GetPlayerDisplayName( PlayerNumber pn ) const;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -166,12 +166,11 @@ void PlayerMinus::Load( PlayerNumber pn, const NoteData* pNoteData, LifeMeter* p
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
case 3:
|
case 3:
|
||||||
// do shuffle
|
NoteDataUtil::Turn( *this, STEPS_TYPE_DANCE_SINGLE, NoteDataUtil::left);
|
||||||
NoteDataUtil::Turn( *this, STEPS_TYPE_DANCE_SINGLE, NoteDataUtil::mirror);
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
// don't shuffle
|
NoteDataUtil::Turn( *this, STEPS_TYPE_DANCE_SINGLE, NoteDataUtil::right);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
|
|||||||
@@ -54,3 +54,13 @@ PlayerNumber GetNextEnabledPlayer( PlayerNumber pn )
|
|||||||
return PLAYER_INVALID;
|
return PLAYER_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlayerNumber GetNextCpuPlayer( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
for( PlayerNumber p=(PlayerNumber)(pn+1); p<NUM_PLAYERS; ((int&)p)++ )
|
||||||
|
{
|
||||||
|
if( GAMESTATE->IsCpuPlayer(p) )
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
return PLAYER_INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,9 +29,11 @@ enum PlayerNumber {
|
|||||||
#define FOREACH_PlayerNumber( pn ) FOREACH_ENUM( PlayerNumber, NUM_PLAYERS, pn )
|
#define FOREACH_PlayerNumber( pn ) FOREACH_ENUM( PlayerNumber, NUM_PLAYERS, pn )
|
||||||
#define FOREACH_HumanPlayer( pn ) for( PlayerNumber pn=GetNextHumanPlayer((PlayerNumber)-1); pn!=PLAYER_INVALID; pn=GetNextHumanPlayer(pn) )
|
#define FOREACH_HumanPlayer( pn ) for( PlayerNumber pn=GetNextHumanPlayer((PlayerNumber)-1); pn!=PLAYER_INVALID; pn=GetNextHumanPlayer(pn) )
|
||||||
#define FOREACH_EnabledPlayer( pn ) for( PlayerNumber pn=GetNextEnabledPlayer((PlayerNumber)-1); pn!=PLAYER_INVALID; pn=GetNextEnabledPlayer(pn) )
|
#define FOREACH_EnabledPlayer( pn ) for( PlayerNumber pn=GetNextEnabledPlayer((PlayerNumber)-1); pn!=PLAYER_INVALID; pn=GetNextEnabledPlayer(pn) )
|
||||||
|
#define FOREACH_CpuPlayer( pn ) for( PlayerNumber pn=GetNextEnabledPlayer((PlayerNumber)-1); pn!=PLAYER_INVALID; pn=GetNextEnabledPlayer(pn) )
|
||||||
|
|
||||||
PlayerNumber GetNextHumanPlayer( PlayerNumber pn );
|
PlayerNumber GetNextHumanPlayer( PlayerNumber pn );
|
||||||
PlayerNumber GetNextEnabledPlayer( PlayerNumber pn );
|
PlayerNumber GetNextEnabledPlayer( PlayerNumber pn );
|
||||||
|
PlayerNumber GetNextCpuPlayer( PlayerNumber pn );
|
||||||
|
|
||||||
const PlayerNumber OPPOSITE_PLAYER[NUM_PLAYERS] = { PLAYER_2, PLAYER_1 };
|
const PlayerNumber OPPOSITE_PLAYER[NUM_PLAYERS] = { PLAYER_2, PLAYER_1 };
|
||||||
|
|
||||||
|
|||||||
@@ -224,11 +224,7 @@ const Profile* ProfileManager::GetProfile( PlayerNumber pn ) const
|
|||||||
CString ProfileManager::GetPlayerName( PlayerNumber pn ) const
|
CString ProfileManager::GetPlayerName( PlayerNumber pn ) const
|
||||||
{
|
{
|
||||||
const Profile *prof = GetProfile( pn );
|
const Profile *prof = GetProfile( pn );
|
||||||
if( prof )
|
return prof ? prof->GetDisplayName() : "";
|
||||||
return prof->GetDisplayName();
|
|
||||||
|
|
||||||
const char *names[NUM_PLAYERS] = { "PLAYER 1", "PLAYER 2" };
|
|
||||||
return names[pn];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -529,7 +529,7 @@ void ScreenGameplay::Init()
|
|||||||
m_sprCourseSongNumber.SetName( "CourseSongNumber" );
|
m_sprCourseSongNumber.SetName( "CourseSongNumber" );
|
||||||
SET_XY( m_sprCourseSongNumber );
|
SET_XY( m_sprCourseSongNumber );
|
||||||
|
|
||||||
for( p=0; p<NUM_PLAYERS; p++ )
|
FOREACH_EnabledPlayer(p)
|
||||||
{
|
{
|
||||||
m_textCourseSongNumber[p].LoadFromNumbers( THEME->GetPathToN("ScreenGameplay song num") );
|
m_textCourseSongNumber[p].LoadFromNumbers( THEME->GetPathToN("ScreenGameplay song num") );
|
||||||
m_textCourseSongNumber[p].SetShadowLength( 0 );
|
m_textCourseSongNumber[p].SetShadowLength( 0 );
|
||||||
@@ -542,17 +542,14 @@ void ScreenGameplay::Init()
|
|||||||
{
|
{
|
||||||
m_textPlayerName[p].LoadFromFont( THEME->GetPathToF("ScreenGameplay player") );
|
m_textPlayerName[p].LoadFromFont( THEME->GetPathToF("ScreenGameplay player") );
|
||||||
m_textPlayerName[p].SetName( ssprintf("PlayerNameP%i",p+1) );
|
m_textPlayerName[p].SetName( ssprintf("PlayerNameP%i",p+1) );
|
||||||
m_textPlayerName[p].SetText( PROFILEMAN->GetPlayerName((PlayerNumber)p) );
|
m_textPlayerName[p].SetText( GAMESTATE->GetPlayerDisplayName((PlayerNumber)p) );
|
||||||
SET_XY( m_textPlayerName[p] );
|
SET_XY( m_textPlayerName[p] );
|
||||||
this->AddChild( &m_textPlayerName[p] );
|
this->AddChild( &m_textPlayerName[p] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( p=0; p<NUM_PLAYERS; p++ )
|
FOREACH_EnabledPlayer(p)
|
||||||
{
|
{
|
||||||
if( !GAMESTATE->IsPlayerEnabled(p) )
|
|
||||||
continue; // skip
|
|
||||||
|
|
||||||
m_textStepsDescription[p].LoadFromFont( THEME->GetPathToF("ScreenGameplay StepsDescription") );
|
m_textStepsDescription[p].LoadFromFont( THEME->GetPathToF("ScreenGameplay StepsDescription") );
|
||||||
m_textStepsDescription[p].SetName( ssprintf("StepsDescriptionP%i",p+1) );
|
m_textStepsDescription[p].SetName( ssprintf("StepsDescriptionP%i",p+1) );
|
||||||
SET_XY( m_textStepsDescription[p] );
|
SET_XY( m_textStepsDescription[p] );
|
||||||
|
|||||||
Reference in New Issue
Block a user