Load AI difficulty data at runtime from AI.ini

This commit is contained in:
Chris Danford
2003-04-21 02:41:10 +00:00
parent cc9bf8677a
commit e15dcc2ab5
29 changed files with 412 additions and 228 deletions
@@ -0,0 +1 @@
ScreenEvaluationStage in
@@ -0,0 +1 @@
ScreenEvaluationStage out
@@ -0,0 +1 @@
_options to options
@@ -0,0 +1 @@
_options to options
@@ -0,0 +1 @@
ScreenEvaluationStage header.png
@@ -0,0 +1 @@
_shared options header.png
+44 -10
View File
@@ -1132,7 +1132,7 @@ ShowMaxCombo=1
ShowScoreArea=1 ShowScoreArea=1
ShowTimeArea=0 ShowTimeArea=0
HelpText=Press START to continue HelpText=Press START to continue
TimerSeconds=10 TimerSeconds=15
[ScreenEvaluationSummary] [ScreenEvaluationSummary]
NextScreen=ScreenNameEntry NextScreen=ScreenNameEntry
@@ -1242,7 +1242,7 @@ ShowMaxCombo=0
ShowScoreArea=1 ShowScoreArea=1
ShowTimeArea=0 ShowTimeArea=0
HelpText=Press START to continue HelpText=Press START to continue
TimerSeconds=10 TimerSeconds=15
[ScreenEvaluationRave] [ScreenEvaluationRave]
NextScreen=ScreenSelectMusic NextScreen=ScreenSelectMusic
@@ -1260,11 +1260,11 @@ ShowGood=1
ShowBoo=1 ShowBoo=1
ShowMiss=1 ShowMiss=1
ShowOK=1 ShowOK=1
ShowMaxCombo=1 ShowMaxCombo=0c
ShowScoreArea=1 ShowScoreArea=1
ShowTimeArea=0 ShowTimeArea=0
HelpText=Press START to continue HelpText=Press START to continue
TimerSeconds=10 TimerSeconds=15
[ScreenMusicScroll] [ScreenMusicScroll]
ScrollDelay=0.2 ScrollDelay=0.2
@@ -1789,10 +1789,44 @@ PrevScreenOni=ScreenSelectCourse
PrevScreenEndless=ScreenSelectCourse PrevScreenEndless=ScreenSelectCourse
PrevScreenBattle=ScreenSelectMusic PrevScreenBattle=ScreenSelectMusic
PrevScreenRave=ScreenSelectMusic PrevScreenRave=ScreenSelectMusic
NextScreenArcade=ScreenSongOptions
NextScreenNonstop=ScreenSongOptions
NextScreenOni=ScreenSongOptions
NextScreenEndless=ScreenSongOptions
NextScreenBattle=ScreenSongOptions
NextScreenRave=ScreenRaveOptions
HelpText=&UP; &DOWN; to change line &LEFT; &RIGHT; to select between options START to accept changes
TimerSeconds=30
[ScreenRaveOptions]
PrevScreenArcade=ScreenPlayerOptions
PrevScreenNonstop=ScreenPlayerOptions
PrevScreenOni=ScreenPlayerOptions
PrevScreenEndless=ScreenPlayerOptions
PrevScreenBattle=ScreenPlayerOptions
PrevScreenRave=ScreenPlayerOptions
NextScreenArcade=ScreenSongOptions
NextScreenNonstop=ScreenSongOptions
NextScreenOni=ScreenSongOptions
NextScreenEndless=ScreenSongOptions
NextScreenBattle=ScreenSongOptions
NextScreenRave=ScreenSongOptions
HelpText=&UP; &DOWN; to change line &LEFT; &RIGHT; to select between options START to accept changes HelpText=&UP; &DOWN; to change line &LEFT; &RIGHT; to select between options START to accept changes
TimerSeconds=30 TimerSeconds=30
[ScreenSongOptions] [ScreenSongOptions]
PrevScreenArcade=ScreenPlayerOptions
PrevScreenNonstop=ScreenPlayerOptions
PrevScreenOni=ScreenPlayerOptions
PrevScreenEndless=ScreenPlayerOptions
PrevScreenBattle=ScreenPlayerOptions
PrevScreenRave=ScreenRaveOptions
NextScreenArcade=ScreenStage
NextScreenNonstop=ScreenStage
NextScreenOni=ScreenStage
NextScreenEndless=ScreenStage
NextScreenBattle=ScreenStage
NextScreenRave=ScreenStage
HelpText=&UP; &DOWN; to change line &LEFT; &RIGHT; to select between options START to accept changes HelpText=&UP; &DOWN; to change line &LEFT; &RIGHT; to select between options START to accept changes
Game=Change the current game type with this option. Game=Change the current game type with this option.
TimerSeconds=30 TimerSeconds=30
@@ -1826,9 +1860,9 @@ TitleP1OnCommand=x,140;y,80;addx,-400;bounceend,0.5;addx,400
TitleP1OffCommand=sleep,0.6;bouncebegin,0.5;addx,-400 TitleP1OffCommand=sleep,0.6;bouncebegin,0.5;addx,-400
TitleP2OnCommand=x,500;y,80;addx,400;bounceend,0.5;addx,-400 TitleP2OnCommand=x,500;y,80;addx,400;bounceend,0.5;addx,-400
TitleP2OffCommand=sleep,0.6;bouncebegin,0.5;addx,400 TitleP2OffCommand=sleep,0.6;bouncebegin,0.5;addx,400
CharacterP1OnCommand=x,140;y,200;addx,-400;bounceend,0.5;addx,400 CharacterP1OnCommand=x,140;y,180;addx,-400;bounceend,0.5;addx,400
CharacterP1OffCommand=sleep,0.6;bouncebegin,0.5;addx,-400 CharacterP1OffCommand=sleep,0.6;bouncebegin,0.5;addx,-400
CharacterP2OnCommand=x,500;y,200;addx,400;bounceend,0.5;addx,-400 CharacterP2OnCommand=x,500;y,180;addx,400;bounceend,0.5;addx,-400
CharacterP2OffCommand=sleep,0.6;bouncebegin,0.5;addx,400 CharacterP2OffCommand=sleep,0.6;bouncebegin,0.5;addx,400
CharacterArrowsP1OnCommand=x,140;y,180 CharacterArrowsP1OnCommand=x,140;y,180
CharacterArrowsP1OffCommand= CharacterArrowsP1OffCommand=
@@ -1836,14 +1870,14 @@ CharacterArrowsP2OnCommand=x,500;y,180
CharacterArrowsP2OffCommand= CharacterArrowsP2OffCommand=
ExplanationOnCommand=x,320;y,140;diffusealpha,0;linear,0.3;diffusealpha,1 ExplanationOnCommand=x,320;y,140;diffusealpha,0;linear,0.3;diffusealpha,1
ExplanationOffCommand=linear,0.3;diffusealpha,0 ExplanationOffCommand=linear,0.3;diffusealpha,0
AttackFrameP1OnCommand=x,140;y,360 AttackFrameP1OnCommand=x,140;y,380
AttackFrameP1OffCommand= AttackFrameP1OffCommand=
AttackFrameP2OnCommand=x,500;y,360 AttackFrameP2OnCommand=x,500;y,380
AttackFrameP2OffCommand= AttackFrameP2OffCommand=
IconsP1StartX=128 IconsP1StartX=128
IconsP1StartY=336 IconsP1StartY=356
IconsP2StartX=488 IconsP2StartX=488
IconsP2StartY=336 IconsP2StartY=356
IconsSpacingX=42 IconsSpacingX=42
IconsSpacingY=32 IconsSpacingY=32
HelpText=Use &LEFT; &RIGHT; to select, then press START HelpText=Use &LEFT; &RIGHT; to select, then press START
+1 -1
View File
@@ -21,9 +21,9 @@ public:
DifficultyMeter(); DifficultyMeter();
void SetFromNotes( Notes* pNotes ); void SetFromNotes( Notes* pNotes );
void SetMeter( int iMeter );
private: private:
void SetMeter( int iMeter );
}; };
#endif #endif
+15 -5
View File
@@ -186,14 +186,15 @@ const CString GROUP_ALL_MUSIC = "";
// //
enum PlayerController enum PlayerController
{ {
HUMAN, PC_HUMAN,
CPU_EASY, PC_CPU,
CPU_MEDIUM, PC_AUTOPLAY,
CPU_HARD,
CPU_AUTOPLAY,
NUM_PLAYER_CONTROLLERS NUM_PLAYER_CONTROLLERS
}; };
const int MIN_SKILL = 0;
const int MAX_SKILL = 10;
// //
// Battle stuff // Battle stuff
@@ -209,6 +210,15 @@ enum AttackLevel
const int NUM_ATTACKS_PER_LEVEL = 3; const int NUM_ATTACKS_PER_LEVEL = 3;
const int ITEM_NONE = -1; const int ITEM_NONE = -1;
enum BattleResult
{
RESULT_WIN,
RESULT_LOSE,
RESULT_DRAW
};
const CString BG_ANIMS_DIR = "BGAnimations/"; const CString BG_ANIMS_DIR = "BGAnimations/";
const CString VISUALIZATIONS_DIR = "Visualizations/"; const CString VISUALIZATIONS_DIR = "Visualizations/";
+20 -2
View File
@@ -88,6 +88,12 @@ void GameState::Reset()
NOTESKIN->SwitchNoteSkin( PlayerNumber(p), PREFSMAN->m_sDefaultNoteSkin ); NOTESKIN->SwitchNoteSkin( PlayerNumber(p), PREFSMAN->m_sDefaultNoteSkin );
m_Position = new NoteFieldPositioning("Positioning.ini"); m_Position = new NoteFieldPositioning("Positioning.ini");
for( p=0; p<NUM_PLAYERS; p++ )
{
m_fSuperMeterGrowth[p] = 1;
m_iCpuSkill[p] = 5;
}
} }
void GameState::Update( float fDelta ) void GameState::Update( float fDelta )
@@ -358,12 +364,24 @@ bool GameState::HasEarnedExtraStage()
PlayerNumber GameState::GetWinner() PlayerNumber GameState::GetWinner()
{ {
PlayerNumber winner = PLAYER_1; PlayerNumber winner = PLAYER_1;
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=PLAYER_1+1; p<NUM_PLAYERS; p++ )
if( GAMESTATE->m_CurStageStats.iActualDancePoints[p] > GAMESTATE->m_CurStageStats.iActualDancePoints[winner] ) {
if( GAMESTATE->m_CurStageStats.iActualDancePoints[p] == GAMESTATE->m_CurStageStats.iActualDancePoints[winner] )
return PLAYER_INVALID; // draw
else if( GAMESTATE->m_CurStageStats.iActualDancePoints[p] > GAMESTATE->m_CurStageStats.iActualDancePoints[winner] )
winner = (PlayerNumber)p; winner = (PlayerNumber)p;
}
return winner; return winner;
} }
BattleResult GameState::GetBattleResult( PlayerNumber pn )
{
PlayerNumber winner = GetWinner();
if( winner == PLAYER_INVALID )
return RESULT_DRAW;
return (winner==pn) ? RESULT_WIN : RESULT_LOSE;
}
void GameState::GetFinalEvalStatsAndSongs( StageStats& statsOut, vector<Song*>& vSongsOut ) void GameState::GetFinalEvalStatsAndSongs( StageStats& statsOut, vector<Song*>& vSongsOut )
{ {
statsOut = StageStats(); statsOut = StageStats();
+3 -2
View File
@@ -82,7 +82,8 @@ public:
} }
PlayerController m_PlayerController[NUM_PLAYERS]; PlayerController m_PlayerController[NUM_PLAYERS];
int m_iCpuSkill[NUM_PLAYERS]; // only used when m_PlayerController is PC_CPU
float m_fSuperMeterGrowth[NUM_PLAYERS]; // between 0.0 and 1.0
bool IsCourseMode() const; bool IsCourseMode() const;
@@ -155,7 +156,6 @@ public:
// used in PLAY_MODE_RAVE // used in PLAY_MODE_RAVE
CString m_sCharacterName[NUM_PLAYERS]; CString m_sCharacterName[NUM_PLAYERS];
AttackLevel m_MaxAttackLevel[NUM_PLAYERS];
CString m_sAttacks[NUM_PLAYERS][NUM_ATTACK_LEVELS][NUM_ATTACKS_PER_LEVEL]; CString m_sAttacks[NUM_PLAYERS][NUM_ATTACK_LEVELS][NUM_ATTACKS_PER_LEVEL];
@@ -183,6 +183,7 @@ public:
bool HasEarnedExtraStage(); bool HasEarnedExtraStage();
PlayerNumber GetWinner(); PlayerNumber GetWinner();
BattleResult GetBattleResult( PlayerNumber pn );
bool m_bAllow2ndExtraStage; //only used when "Allow Selection of Extra Stage is on" bool m_bAllow2ndExtraStage; //only used when "Allow Selection of Extra Stage is on"
+1 -1
View File
@@ -111,7 +111,7 @@ void Inventory::Update( float fDelta )
// use items if this player is CPU-controlled // use items if this player is CPU-controlled
if( GAMESTATE->m_PlayerController[m_PlayerNumber] != HUMAN && if( GAMESTATE->m_PlayerController[m_PlayerNumber] != PC_HUMAN &&
GAMESTATE->m_fSongBeat < GAMESTATE->m_pCurSong->m_fLastBeat ) GAMESTATE->m_fSongBeat < GAMESTATE->m_pCurSong->m_fLastBeat )
{ {
// every one second, consider using an item // every one second, consider using an item
+16 -8
View File
@@ -70,6 +70,8 @@ Player::Player()
this->AddChild( &m_Combo ); this->AddChild( &m_Combo );
for( int c=0; c<MAX_NOTE_TRACKS; c++ ) for( int c=0; c<MAX_NOTE_TRACKS; c++ )
this->AddChild( &m_HoldJudgment[c] ); this->AddChild( &m_HoldJudgment[c] );
PlayerAI::InitFromDisk();
} }
Player::~Player() Player::~Player()
@@ -221,7 +223,7 @@ void Player::Update( float fDeltaTime )
bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI ); bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI );
// TODO: Make the CPU miss sometimes. // TODO: Make the CPU miss sometimes.
if( GAMESTATE->m_PlayerController[m_PlayerNumber] != HUMAN ) if( GAMESTATE->m_PlayerController[m_PlayerNumber] != PC_HUMAN )
bIsHoldingButton = true; bIsHoldingButton = true;
m_NoteField.m_bIsHoldingHoldNote[i] = bIsHoldingButton && bSteppedOnTapNote; // set host flag so NoteField can do intelligent drawing m_NoteField.m_bIsHoldingHoldNote[i] = bIsHoldingButton && bSteppedOnTapNote; // set host flag so NoteField can do intelligent drawing
@@ -386,18 +388,18 @@ void Player::Step( int col )
// calculate TapNoteScore // calculate TapNoteScore
TapNoteScore score; TapNoteScore score;
if( GAMESTATE->m_PlayerController[m_PlayerNumber] == HUMAN ) switch( GAMESTATE->m_PlayerController[m_PlayerNumber] )
{ {
case PC_HUMAN:
if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowMarvelousSeconds ) score = TNS_MARVELOUS; if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowMarvelousSeconds ) score = TNS_MARVELOUS;
else if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowPerfectSeconds ) score = TNS_PERFECT; else if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowPerfectSeconds ) score = TNS_PERFECT;
else if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowGreatSeconds ) score = TNS_GREAT; else if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowGreatSeconds ) score = TNS_GREAT;
else if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowGoodSeconds ) score = TNS_GOOD; else if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowGoodSeconds ) score = TNS_GOOD;
else if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowBooSeconds ) score = TNS_BOO; else if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowBooSeconds ) score = TNS_BOO;
else score = TNS_NONE; else score = TNS_NONE;
} break;
else case PC_CPU:
{ score = PlayerAI::GetTapNoteScore( GAMESTATE->m_iCpuSkill[m_PlayerNumber], GAMESTATE->GetSumOfActiveAttackLevels(m_PlayerNumber) );
score = PlayerAI::GetTapNoteScore( GAMESTATE->m_PlayerController[m_PlayerNumber], GAMESTATE->GetSumOfActiveAttackLevels(m_PlayerNumber) );
/* AI will generate misses here. Don't handle a miss like a regular note because /* AI will generate misses here. Don't handle a miss like a regular note because
* we want the judgment animation to appear delayed. Instead, return early if * we want the judgment animation to appear delayed. Instead, return early if
@@ -405,6 +407,12 @@ void Player::Step( int col )
* misses. */ * misses. */
if( score == TNS_MISS ) if( score == TNS_MISS )
return; return;
break;
case PC_AUTOPLAY:
score = TNS_MARVELOUS;
break;
default:
ASSERT(0);
} }
if( score==TNS_MARVELOUS && !PREFSMAN->m_bMarvelousTiming ) if( score==TNS_MARVELOUS && !PREFSMAN->m_bMarvelousTiming )
@@ -419,7 +427,7 @@ void Player::Step( int col )
if( score != TNS_NONE ) if( score != TNS_NONE )
SetTapNoteOffset(col, iIndexOverlappingNote, -fNoteOffset); SetTapNoteOffset(col, iIndexOverlappingNote, -fNoteOffset);
if( GAMESTATE->m_PlayerController[m_PlayerNumber] == HUMAN && if( GAMESTATE->m_PlayerController[m_PlayerNumber] == PC_HUMAN &&
score >= TNS_GREAT ) score >= TNS_GREAT )
HandleAutosync(fNoteOffset); HandleAutosync(fNoteOffset);
@@ -549,7 +557,7 @@ void Player::CrossedRow( int iNoteRow )
// check to see if there's at the crossed row // check to see if there's at the crossed row
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
if( GetTapNote(t, iNoteRow) != TAP_EMPTY ) if( GetTapNote(t, iNoteRow) != TAP_EMPTY )
if( GAMESTATE->m_PlayerController[m_PlayerNumber] != HUMAN ) if( GAMESTATE->m_PlayerController[m_PlayerNumber] != PC_HUMAN )
Step( t ); Step( t );
} }
+41 -60
View File
@@ -12,83 +12,64 @@
#include "PlayerAI.h" #include "PlayerAI.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "IniFile.h"
#include "RageException.h"
#include "GameState.h"
#include <math.h> #include <math.h>
struct TapScoreDistribution struct TapScoreDistribution
{ {
float fCumulativeProbability[NUM_TAP_NOTE_SCORES]; float fCumulativeProbability[NUM_TAP_NOTE_SCORES];
TapNoteScore GetTapNoteScore( int iDifficultyExponent )
TapNoteScore GetTapNoteScore()
{ {
float fRand = randomf(0,1); float fRand = randomf(0,1);
ASSERT( iDifficultyExponent >= 1 );
fRand = powf( fRand, (float)iDifficultyExponent );
for( int i=TNS_MISS; i<=TNS_MARVELOUS; i++ ) for( int i=TNS_MISS; i<=TNS_MARVELOUS; i++ )
if( fRand <= fCumulativeProbability[i] ) if( fRand <= fCumulativeProbability[i] )
return (TapNoteScore)i; return (TapNoteScore)i;
ASSERT(0); // the last probability must be 1.0, so we should never get here! ASSERT(0); // the last probability must be 1.0, so we should never get here!
return TNS_MARVELOUS; return TNS_MARVELOUS;
} }
}; };
TapScoreDistribution TAP_SCORE_DISTRIBUTIONS[NUM_PLAYER_CONTROLLERS] = TapScoreDistribution g_Distributions[NUM_SKILL_LEVELS];
{
// HUMAN
{
0.00f, // TNS_NONE
1.00f, // TNS_MISS // don't ever hit automatically when human
0.00f, // TNS_BOO
0.00f, // TNS_GOOD
0.00f, // TNS_GREAT
0.00f, // TNS_PERFECT
0.00f, // TNS_MARVELOUS
},
// CPU_EASY
{
0.00f, // TNS_NONE
0.02f, // TNS_MISS
0.06f, // TNS_BOO
0.10f, // TNS_GOOD
0.55f, // TNS_GREAT
0.80f, // TNS_PERFECT
1.00f, // TNS_MARVELOUS
},
// CPU_MEDIUM
{
0.00f, // TNS_NONE
0.01f, // TNS_MISS
0.02f, // TNS_BOO
0.05f, // TNS_GOOD
0.45f, // TNS_GREAT
0.70f, // TNS_PERFECT
1.00f, // TNS_MARVELOUS
},
// CPU_HARD
{
0.00f, // TNS_NONE
0.005f, // TNS_MISS
0.007f, // TNS_BOO
0.01f, // TNS_GOOD
0.10f, // TNS_GREAT
0.60f, // TNS_PERFECT
1.00f, // TNS_MARVELOUS
},
// CPU_AUTOPLAY
{
0.00f, // TNS_NONE
0.00f, // TNS_MISS
0.00f, // TNS_BOO
0.00f, // TNS_GOOD
0.00f, // TNS_GREAT
0.00f, // TNS_PERFECT
1.00f, // TNS_MARVELOUS
},
};
TapNoteScore PlayerAI::GetTapNoteScore( PlayerController pc, int iSumOfAttackLevels ) void PlayerAI::InitFromDisk()
{ {
TapNoteScore tns = TAP_SCORE_DISTRIBUTIONS[pc].GetTapNoteScore( iSumOfAttackLevels+1 ); IniFile ini;
ASSERT( tns != TNS_NONE ); // sanity check on PlayerAI's result ini.SetPath( "AI.ini" );
return tns; ini.ReadFile();
for( int i=0; i<NUM_SKILL_LEVELS; i++ )
{
CString sKey = ssprintf("Skill%d", i);
if( ini.GetKey(sKey)==NULL )
RageException::Throw( "AI.ini: '%s' doesn't exist.", sKey.GetString() );
TapScoreDistribution& dist = g_Distributions[i];
dist.fCumulativeProbability[TNS_NONE] = 0;
ini.GetValueF( sKey, "MissCum", dist.fCumulativeProbability[TNS_MISS] );
ini.GetValueF( sKey, "BooCum", dist.fCumulativeProbability[TNS_BOO] );
ini.GetValueF( sKey, "GoodCum", dist.fCumulativeProbability[TNS_GOOD] );
ini.GetValueF( sKey, "GreatCum", dist.fCumulativeProbability[TNS_GREAT] );
ini.GetValueF( sKey, "PerfectCum", dist.fCumulativeProbability[TNS_PERFECT] );
dist.fCumulativeProbability[TNS_MARVELOUS] = 1;
}
}
TapNoteScore PlayerAI::GetTapNoteScore( int iCpuSkill, int iSumOfAttackLevels )
{
// shouldn't call this unless we're CPU controlled
ASSERT( iCpuSkill>=0 && iCpuSkill<NUM_SKILL_LEVELS );
iCpuSkill -= iSumOfAttackLevels;
CLAMP( iCpuSkill, 0, NUM_SKILL_LEVELS-1 );
TapScoreDistribution& distribution = g_Distributions[iCpuSkill];
return distribution.GetTapNoteScore();
} }
+3 -1
View File
@@ -13,12 +13,14 @@
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
const int NUM_SKILL_LEVELS = 11; // 0-10
class PlayerAI class PlayerAI
{ {
public: public:
static TapNoteScore PlayerAI::GetTapNoteScore( PlayerController pc, int iSumOfAttackLevels ); static void InitFromDisk();
static TapNoteScore PlayerAI::GetTapNoteScore( int iCpuSkill, int iSumOfAttackLevels );
}; };
+62 -64
View File
@@ -298,73 +298,71 @@ void Screen::ClearMessageQueue( const ScreenMessage SM )
#include "ScreenAutogenOptions.h" #include "ScreenAutogenOptions.h"
#include "ScreenCredits.h" #include "ScreenCredits.h"
#include "ScreenSelectCharacter.h" #include "ScreenSelectCharacter.h"
#include "ScreenRaveOptions.h"
Screen* Screen::Create( CString sClassName ) Screen* Screen::Create( CString sClassName )
{ {
Screen *ret = NULL; #define IF_RETURN(X) if(sClassName.CompareNoCase(#X)==0) return new X;
#define IS( name ) (sClassName.CompareNoCase(name)==0) IF_RETURN( ScreenAppearanceOptions );
IF_RETURN( ScreenCaution );
IF_RETURN( ScreenEdit );
IF_RETURN( ScreenEditMenu );
IF_RETURN( ScreenEvaluationStage );
IF_RETURN( ScreenEvaluationSummary );
IF_RETURN( ScreenEvaluationNonstop );
IF_RETURN( ScreenEvaluationOni );
IF_RETURN( ScreenEvaluationEndless );
IF_RETURN( ScreenEvaluationBattle );
IF_RETURN( ScreenEvaluationRave );
IF_RETURN( ScreenEz2SelectPlayer );
IF_RETURN( ScreenSelectMode );
IF_RETURN( ScreenGameOver );
IF_RETURN( ScreenGameplay );
IF_RETURN( ScreenGraphicOptions );
IF_RETURN( ScreenHowToPlay );
IF_RETURN( ScreenInputOptions );
IF_RETURN( ScreenMachineOptions );
IF_RETURN( ScreenMapControllers );
IF_RETURN( ScreenInputOptions );
IF_RETURN( ScreenMusicScroll );
IF_RETURN( ScreenPlayerOptions );
IF_RETURN( ScreenSandbox );
IF_RETURN( ScreenSelectCourse );
IF_RETURN( ScreenSelectDifficulty );
IF_RETURN( ScreenSelectDifficultyEX );
IF_RETURN( ScreenSelectGame );
IF_RETURN( ScreenSelectGroup );
IF_RETURN( ScreenSelectMusic );
IF_RETURN( ScreenSelectStyle5th );
IF_RETURN( ScreenSelectStyle );
IF_RETURN( ScreenSongOptions );
IF_RETURN( ScreenStage );
IF_RETURN( ScreenTest );
IF_RETURN( ScreenTestFonts );
IF_RETURN( ScreenTestSound );
IF_RETURN( ScreenTitleMenu );
IF_RETURN( ScreenEz2SelectMusic );
IF_RETURN( ScreenWarning );
IF_RETURN( ScreenRanking );
IF_RETURN( ScreenCompany );
IF_RETURN( ScreenIntroMovie );
IF_RETURN( ScreenAlbums );
IF_RETURN( ScreenLogo );
IF_RETURN( ScreenUnlock );
IF_RETURN( ScreenDemonstration );
IF_RETURN( ScreenInstructions );
IF_RETURN( ScreenNameEntry );
IF_RETURN( ScreenJukebox );
IF_RETURN( ScreenJukeboxMenu );
IF_RETURN( ScreenOptionsMenu );
IF_RETURN( ScreenSoundOptions );
IF_RETURN( ScreenGameplayOptions );
IF_RETURN( ScreenStyleSplash );
IF_RETURN( ScreenAutogenOptions );
IF_RETURN( ScreenCredits );
IF_RETURN( ScreenSelectCharacter );
IF_RETURN( ScreenRaveOptions );
if( IS("ScreenAppearanceOptions") ) ret = new ScreenAppearanceOptions; RageException::Throw( "Invalid Screen class name '%s'", sClassName.GetString() );
else if( IS("ScreenCaution") ) ret = new ScreenCaution;
else if( IS("ScreenEdit") ) ret = new ScreenEdit;
else if( IS("ScreenEditMenu") ) ret = new ScreenEditMenu;
else if( IS("ScreenEvaluationStage") ) ret = new ScreenEvaluationStage;
else if( IS("ScreenEvaluationSummary") ) ret = new ScreenEvaluationSummary;
else if( IS("ScreenEvaluationNonstop") ) ret = new ScreenEvaluationNonstop;
else if( IS("ScreenEvaluationOni") ) ret = new ScreenEvaluationOni;
else if( IS("ScreenEvaluationEndless") ) ret = new ScreenEvaluationEndless;
else if( IS("ScreenEvaluationBattle") ) ret = new ScreenEvaluationBattle;
else if( IS("ScreenEvaluationRave") ) ret = new ScreenEvaluationRave;
else if( IS("ScreenEz2SelectPlayer") ) ret = new ScreenEz2SelectPlayer;
else if( IS("ScreenSelectMode") ) ret = new ScreenSelectMode;
else if( IS("ScreenGameOver") ) ret = new ScreenGameOver;
else if( IS("ScreenGameplay") ) ret = new ScreenGameplay;
else if( IS("ScreenGraphicOptions") ) ret = new ScreenGraphicOptions;
else if( IS("ScreenHowToPlay") ) ret = new ScreenHowToPlay;
else if( IS("ScreenInputOptions") ) ret = new ScreenInputOptions;
else if( IS("ScreenMachineOptions") ) ret = new ScreenMachineOptions;
else if( IS("ScreenMapControllers") ) ret = new ScreenMapControllers;
else if( IS("ScreenInputOptions") ) ret = new ScreenInputOptions;
else if( IS("ScreenMusicScroll") ) ret = new ScreenMusicScroll;
else if( IS("ScreenPlayerOptions") ) ret = new ScreenPlayerOptions;
else if( IS("ScreenSandbox") ) ret = new ScreenSandbox;
else if( IS("ScreenSelectCourse") ) ret = new ScreenSelectCourse;
else if( IS("ScreenSelectDifficulty") ) ret = new ScreenSelectDifficulty;
else if( IS("ScreenSelectDifficultyEX") ) ret = new ScreenSelectDifficultyEX;
else if( IS("ScreenSelectGame") ) ret = new ScreenSelectGame;
else if( IS("ScreenSelectGroup") ) ret = new ScreenSelectGroup;
else if( IS("ScreenSelectMusic") ) ret = new ScreenSelectMusic;
else if( IS("ScreenSelectStyle5th") ) ret = new ScreenSelectStyle5th;
else if( IS("ScreenSelectStyle") ) ret = new ScreenSelectStyle;
else if( IS("ScreenSongOptions") ) ret = new ScreenSongOptions;
else if( IS("ScreenStage") ) ret = new ScreenStage;
else if( IS("ScreenTest") ) ret = new ScreenTest;
else if( IS("ScreenTestFonts") ) ret = new ScreenTestFonts;
else if( IS("ScreenTestSound") ) ret = new ScreenTestSound;
else if( IS("ScreenTitleMenu") ) ret = new ScreenTitleMenu;
else if( IS("ScreenEz2SelectMusic") ) ret = new ScreenEz2SelectMusic;
else if( IS("ScreenWarning") ) ret = new ScreenWarning;
else if( IS("ScreenRanking") ) ret = new ScreenRanking;
else if( IS("ScreenMemoryCard") ) ret = new ScreenMemoryCard;
else if( IS("ScreenCompany") ) ret = new ScreenCompany;
else if( IS("ScreenIntroMovie") ) ret = new ScreenIntroMovie;
else if( IS("ScreenAlbums") ) ret = new ScreenAlbums;
else if( IS("ScreenLogo") ) ret = new ScreenLogo;
else if( IS("ScreenUnlock") ) ret = new ScreenUnlock;
else if( IS("ScreenDemonstration") ) ret = (ScreenGameplay*)new ScreenDemonstration;
else if( IS("ScreenInstructions") ) ret = new ScreenInstructions;
else if( IS("ScreenNameEntry") ) ret = new ScreenNameEntry;
else if( IS("ScreenJukebox") ) ret = new ScreenJukebox;
else if( IS("ScreenJukeboxMenu") ) ret = new ScreenJukeboxMenu;
else if( IS("ScreenOptionsMenu") ) ret = new ScreenOptionsMenu;
else if( IS("ScreenSoundOptions") ) ret = new ScreenSoundOptions;
else if( IS("ScreenGameplayOptions") ) ret = new ScreenGameplayOptions;
else if( IS("ScreenStyleSplash") ) ret = new ScreenStyleSplash;
else if( IS("ScreenAutogenOptions") ) ret = new ScreenAutogenOptions;
else if( IS("ScreenCredits") ) ret = new ScreenCredits;
else if( IS("ScreenSelectCharacter") ) ret = new ScreenSelectCharacter;
else
RageException::Throw( "Invalid Screen class name '%s'", sClassName.GetString() );
return ret;
} }
+2 -2
View File
@@ -274,7 +274,7 @@ ScreenEdit::ScreenEdit() : Screen("ScreenEdit")
NOTESKIN->SwitchNoteSkin( PLAYER_1, "default" ); // change noteskin back to default before loading player NOTESKIN->SwitchNoteSkin( PLAYER_1, "default" ); // change noteskin back to default before loading player
m_Player.Load( PLAYER_1, &noteData, NULL, NULL, NULL, NULL ); m_Player.Load( PLAYER_1, &noteData, NULL, NULL, NULL, NULL );
GAMESTATE->m_PlayerController[PLAYER_1] = HUMAN; GAMESTATE->m_PlayerController[PLAYER_1] = PC_HUMAN;
m_Player.SetXY( PLAYER_X, PLAYER_Y ); m_Player.SetXY( PLAYER_X, PLAYER_Y );
m_In.Load( THEME->GetPathToB("ScreenEdit in") ); m_In.Load( THEME->GetPathToB("ScreenEdit in") );
@@ -1425,7 +1425,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
m_EditMode = MODE_PLAYING; m_EditMode = MODE_PLAYING;
m_Player.Load( PLAYER_1, (NoteData*)&m_NoteFieldEdit, NULL, NULL, NULL, NULL ); m_Player.Load( PLAYER_1, (NoteData*)&m_NoteFieldEdit, NULL, NULL, NULL, NULL );
GAMESTATE->m_PlayerController[PLAYER_1] = PREFSMAN->m_bAutoPlay?CPU_AUTOPLAY:HUMAN; GAMESTATE->m_PlayerController[PLAYER_1] = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN;
m_rectRecordBack.StopTweening(); m_rectRecordBack.StopTweening();
m_rectRecordBack.BeginTweening( 0.5f ); m_rectRecordBack.BeginTweening( 0.5f );
+3 -3
View File
@@ -492,10 +492,10 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName, Type type ) : Screen(sCl
UtilSetXYAndOnCommand( m_sprWinFrame[p], "ScreenEvaluation" ); UtilSetXYAndOnCommand( m_sprWinFrame[p], "ScreenEvaluation" );
this->AddChild( &m_sprWinFrame[p] ); this->AddChild( &m_sprWinFrame[p] );
m_sprWin[p].Load( THEME->GetPathToG("ScreenEvaluation win 2x2") ); m_sprWin[p].Load( THEME->GetPathToG("ScreenEvaluation win 2x3") );
m_sprWin[p].StopAnimating(); m_sprWin[p].StopAnimating();
bool bIsWinner = GAMESTATE->GetWinner() == p; int iFrame = GAMESTATE->GetBattleResult( (PlayerNumber)p )*2 + p;
m_sprWin[p].SetState( (bIsWinner?0:2) + p ); m_sprWin[p].SetState( iFrame );
m_sprWin[p].SetName( ssprintf("WinP%d",p+1) ); m_sprWin[p].SetName( ssprintf("WinP%d",p+1) );
UtilSetXYAndOnCommand( m_sprWin[p], "ScreenEvaluation" ); UtilSetXYAndOnCommand( m_sprWin[p], "ScreenEvaluation" );
this->AddChild( &m_sprWin[p] ); this->AddChild( &m_sprWin[p] );
+31 -17
View File
@@ -432,11 +432,14 @@ ScreenGameplay::ScreenGameplay( bool bDemonstration ) : Screen("ScreenGameplay")
switch( GAMESTATE->m_PlayMode ) switch( GAMESTATE->m_PlayMode )
{ {
case PLAY_MODE_BATTLE: case PLAY_MODE_BATTLE:
case PLAY_MODE_RAVE:
for( p=0; p<NUM_PLAYERS; p++ ) for( p=0; p<NUM_PLAYERS; p++ )
{ {
m_Win[p].Load( THEME->GetPathToB(ssprintf("ScreenGameplay win p%d",p+1)) ); m_Win[p].Load( THEME->GetPathToB(ssprintf("ScreenGameplay win p%d",p+1)) );
this->AddChild( &m_Win[p] ); this->AddChild( &m_Win[p] );
} }
m_Draw.Load( THEME->GetPathToB("ScreenGameplay draw") );
this->AddChild( &m_Draw );
break; break;
} }
@@ -585,28 +588,30 @@ void ScreenGameplay::LoadNextSong()
m_Player[p].Load( (PlayerNumber)p, &pNewNoteData, m_pLifeMeter[p], m_pScoreDisplay[p], &m_Inventory[p], m_pScoreKeeper[p] ); m_Player[p].Load( (PlayerNumber)p, &pNewNoteData, m_pLifeMeter[p], m_pScoreDisplay[p], &m_Inventory[p], m_pScoreKeeper[p] );
if( m_bDemonstration ) if( m_bDemonstration )
GAMESTATE->m_PlayerController[p] = CPU_MEDIUM; {
GAMESTATE->m_PlayerController[p] = PC_CPU;
GAMESTATE->m_iCpuSkill[p] = 5;
}
else if( GAMESTATE->IsCpuPlayer(p) ) else if( GAMESTATE->IsCpuPlayer(p) )
{ {
switch( GAMESTATE->m_pCurNotes[p]->GetDifficulty() ) GAMESTATE->m_PlayerController[p] = PC_CPU;
if( GAMESTATE->m_iCpuSkill[p] == -1 )
{ {
case DIFFICULTY_BEGINNER: switch( GAMESTATE->m_pCurNotes[p]->GetDifficulty() )
case DIFFICULTY_EASY: {
GAMESTATE->m_PlayerController[p] = CPU_EASY; case DIFFICULTY_BEGINNER: GAMESTATE->m_iCpuSkill[p] = 1; break;
break; case DIFFICULTY_EASY: GAMESTATE->m_iCpuSkill[p] = 3; break;
case DIFFICULTY_MEDIUM: case DIFFICULTY_MEDIUM: GAMESTATE->m_iCpuSkill[p] = 5; break;
GAMESTATE->m_PlayerController[p] = CPU_MEDIUM; case DIFFICULTY_HARD: GAMESTATE->m_iCpuSkill[p] = 7; break;
break; case DIFFICULTY_CHALLENGE: GAMESTATE->m_iCpuSkill[p] = 9; break;
case DIFFICULTY_HARD: default: ASSERT(0);
case DIFFICULTY_CHALLENGE: }
GAMESTATE->m_PlayerController[p] = CPU_HARD;
break;
} }
} }
else if( PREFSMAN->m_bAutoPlay ) else if( PREFSMAN->m_bAutoPlay )
GAMESTATE->m_PlayerController[p] = CPU_AUTOPLAY; GAMESTATE->m_PlayerController[p] = PC_AUTOPLAY;
else else
GAMESTATE->m_PlayerController[p] = HUMAN; GAMESTATE->m_PlayerController[p] = PC_HUMAN;
m_TimingAssist.Reset(); m_TimingAssist.Reset();
} }
@@ -1047,7 +1052,7 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
UpdateAutoPlayText(); UpdateAutoPlayText();
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsHumanPlayer(p) ) if( GAMESTATE->IsHumanPlayer(p) )
GAMESTATE->m_PlayerController[p] = PREFSMAN->m_bAutoPlay?CPU_AUTOPLAY:HUMAN; GAMESTATE->m_PlayerController[p] = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN;
} }
break; break;
case SDLK_F9: case SDLK_F9:
@@ -1330,9 +1335,18 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
switch( GAMESTATE->m_PlayMode ) switch( GAMESTATE->m_PlayMode )
{ {
case PLAY_MODE_BATTLE: case PLAY_MODE_BATTLE:
case PLAY_MODE_RAVE:
{ {
PlayerNumber winner = GAMESTATE->GetWinner(); PlayerNumber winner = GAMESTATE->GetWinner();
m_Win[winner].StartTransitioning( SM_GoToStateAfterCleared ); switch( winner )
{
case PLAYER_INVALID:
m_Draw.StartTransitioning( SM_GoToStateAfterCleared );
break;
default:
m_Win[winner].StartTransitioning( SM_GoToStateAfterCleared );
break;
}
} }
break; break;
default: default:
+1
View File
@@ -127,6 +127,7 @@ protected:
Transition m_Extra; Transition m_Extra;
Transition m_Toasty; // easter egg Transition m_Toasty; // easter egg
Transition m_Win[NUM_PLAYERS]; Transition m_Win[NUM_PLAYERS];
Transition m_Draw;
Transition m_In; Transition m_In;
Transition m_Back; Transition m_Back;
+1 -1
View File
@@ -57,7 +57,7 @@ ScreenHowToPlay::ScreenHowToPlay() : ScreenAttract("ScreenHowToPlay")
GAMESTATE->m_bPastHereWeGo = true; GAMESTATE->m_bPastHereWeGo = true;
m_Player.Load( PLAYER_1, pND, NULL, NULL, NULL, NULL ); m_Player.Load( PLAYER_1, pND, NULL, NULL, NULL, NULL );
GAMESTATE->m_PlayerController[PLAYER_1] = CPU_AUTOPLAY; GAMESTATE->m_PlayerController[PLAYER_1] = PC_AUTOPLAY;
m_Player.SetX( 480 ); m_Player.SetX( 480 );
this->AddChild( &m_Player ); this->AddChild( &m_Player );
+3
View File
@@ -317,6 +317,9 @@ void ScreenOptions::RefreshIcons()
{ {
for( int p=0; p<NUM_PLAYERS; p++ ) // foreach player for( int p=0; p<NUM_PLAYERS; p++ ) // foreach player
{ {
if( !GAMESTATE->IsHumanPlayer(p) )
continue;
for( int i=0; i<m_iNumOptionRows; i++ ) // foreach options line for( int i=0; i<m_iNumOptionRows; i++ ) // foreach options line
{ {
OptionIcon &icon = m_OptionIcons[p][i]; OptionIcon &icon = m_OptionIcons[p][i];
+1 -3
View File
@@ -240,10 +240,8 @@ void ScreenPlayerOptions::GoToNextState()
{ {
if( GAMESTATE->m_bEditing ) if( GAMESTATE->m_bEditing )
SCREENMAN->PopTopScreen(); SCREENMAN->PopTopScreen();
else if( PREFSMAN->m_bShowSongOptions )
SCREENMAN->SetNewScreen( "ScreenSongOptions" );
else else
SCREENMAN->SetNewScreen( "ScreenStage" ); SCREENMAN->SetNewScreen( NEXT_SCREEN(GAMESTATE->m_PlayMode) );
} }
+110
View File
@@ -0,0 +1,110 @@
#include "global.h"
/*
-----------------------------------------------------------------------------
Class: ScreenRaveOptions
Desc: See header.
Copyright (c) 2001-2003 by the person(s) listed below. All rights reserved.
Chris Danford
Chris Gomez
-----------------------------------------------------------------------------
*/
#include "ScreenRaveOptions.h"
#include "RageTextureManager.h"
#include "RageUtil.h"
#include "RageSoundManager.h"
#include "ScreenManager.h"
#include "PrefsManager.h"
#include "GameConstantsAndTypes.h"
#include "StepMania.h"
#include "PrefsManager.h"
#include "RageLog.h"
#include "ThemeManager.h"
#include "GameState.h"
#define PREV_SCREEN( play_mode ) THEME->GetMetric ("ScreenRaveOptions","PrevScreen"+Capitalize(PlayModeToString(play_mode)))
#define NEXT_SCREEN( play_mode ) THEME->GetMetric ("ScreenRaveOptions","NextScreen"+Capitalize(PlayModeToString(play_mode)))
enum {
RO_HUMAN_SUPER,
RO_CPU_SKILL,
RO_CPU_SUPER,
NUM_RAVE_OPTIONS_LINES
};
OptionRow g_RaveOptionsLines[NUM_RAVE_OPTIONS_LINES] = {
OptionRow( "Human Super\nGrowth", "25%","50%","75%","100%","125%","150%","175%","200%" ),
OptionRow( "CPU\nSkill", "-5","-4","-3","-2","-1","DEFAULT","+1","+2","+3","+4","+5" ),
OptionRow( "CPU Super\nGrowth", "25%","50%","75%","100%","125%","150%","175%","200%" )
};
PlayerNumber OPPOSITE_PLAYER[NUM_PLAYERS] = { PLAYER_2, PLAYER_1 };
ScreenRaveOptions::ScreenRaveOptions() :
ScreenOptions("ScreenRaveOptions",false)
{
LOG->Trace( "ScreenRaveOptions::ScreenRaveOptions()" );
bool bComputerPlayersPresent = GAMESTATE->GetNumSidesJoined()==1;
Init(
INPUTMODE_PLAYERS,
g_RaveOptionsLines,
bComputerPlayersPresent ? 3 : 1,
false, false );
SOUNDMAN->PlayMusic( THEME->GetPathToS("ScreenMachineOptions music") );
}
void ScreenRaveOptions::ImportOptions()
{
for( int p=0; p<NUM_PLAYERS; p++ )
{
if( GAMESTATE->IsHumanPlayer(p) )
{
int iHumanSuperIndex = (int)SCALE( GAMESTATE->m_fSuperMeterGrowth[p], 0.25f, 2.f, 0.f, 7.f );
CLAMP( iHumanSuperIndex, 0, 9 );
m_iSelectedOption[p][RO_HUMAN_SUPER] = iHumanSuperIndex;
}
else if( GAMESTATE->IsCpuPlayer(p) )
{
PlayerNumber pnHuman = OPPOSITE_PLAYER[pnHuman];
m_iSelectedOption[pnHuman][RO_CPU_SKILL] = GAMESTATE->m_iCpuSkill[p];
CLAMP( m_iSelectedOption[pnHuman][RO_CPU_SKILL], 0, 10 );
int iHumanSuperIndex = (int)SCALE( GAMESTATE->m_fSuperMeterGrowth[pnHuman], 0.25f, 2.f, 0.f, 7.f );
CLAMP( iHumanSuperIndex, 0, 9 );
m_iSelectedOption[pnHuman][RO_CPU_SUPER] = iHumanSuperIndex;
}
else
ASSERT(0);
}
}
void ScreenRaveOptions::ExportOptions()
{
for( int p=0; p<NUM_PLAYERS; p++ )
{
if( GAMESTATE->IsHumanPlayer(p) )
{
GAMESTATE->m_fSuperMeterGrowth[p] = SCALE( m_iSelectedOption[p][RO_HUMAN_SUPER], 0.f, 7.f, 0.25f, 2.f );
PlayerNumber pnCPU = OPPOSITE_PLAYER[p];
GAMESTATE->m_iCpuSkill[pnCPU] = m_iSelectedOption[p][RO_CPU_SKILL];
GAMESTATE->m_fSuperMeterGrowth[pnCPU] = SCALE( m_iSelectedOption[p][RO_CPU_SUPER], 0, 7, 0.25f, 2.f );
}
}
}
void ScreenRaveOptions::GoToPrevState()
{
SCREENMAN->SetNewScreen( PREV_SCREEN(GAMESTATE->m_PlayMode) );
}
void ScreenRaveOptions::GoToNextState()
{
SCREENMAN->SetNewScreen( NEXT_SCREEN(GAMESTATE->m_PlayMode) );
}
+26
View File
@@ -0,0 +1,26 @@
/*
-----------------------------------------------------------------------------
File: ScreenRaveOptions
Desc: Select a song.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "ScreenOptions.h"
class ScreenRaveOptions : public ScreenOptions
{
public:
ScreenRaveOptions();
private:
void ImportOptions();
void ExportOptions();
void GoToNextState();
void GoToPrevState();
};
+2 -38
View File
@@ -58,7 +58,6 @@ ScreenSelectCharacter::ScreenSelectCharacter() : Screen("ScreenSelectCharacter")
for( p=0; p<NUM_PLAYERS; p++ ) for( p=0; p<NUM_PLAYERS; p++ )
{ {
m_iSelectedCharacter[p] = 0; m_iSelectedCharacter[p] = 0;
m_iSelectedLevelIndex[p] = 0;
if( GAMESTATE->IsHumanPlayer(p) ) if( GAMESTATE->IsHumanPlayer(p) )
m_SelectionRow[p] = CHOOSING_HUMAN_CHARACTER; m_SelectionRow[p] = CHOOSING_HUMAN_CHARACTER;
} }
@@ -103,12 +102,6 @@ ScreenSelectCharacter::ScreenSelectCharacter() : Screen("ScreenSelectCharacter")
m_AttackIcons[p][i][j].SetXY( fX, fY ); m_AttackIcons[p][i][j].SetXY( fX, fY );
this->AddChild( &m_AttackIcons[p][i][j] ); this->AddChild( &m_AttackIcons[p][i][j] );
} }
m_sprLevelCursor[p].Load( THEME->GetPathToG("ScreenSelectCharacter level cursor") );
int iLevelIndex = m_iSelectedLevelIndex[p];
m_sprLevelCursor[p].SetXY( LEVEL_CURSOR_X(p,iLevelIndex), LEVEL_CURSOR_Y(p,iLevelIndex) );
m_sprLevelCursor[p].Load( THEME->GetPathToG("ScreenSelectCharacter level cursor") );
this->AddChild( &m_sprLevelCursor[p] );
} }
m_sprExplanation.Load( THEME->GetPathToG("ScreenSelectCharacter explanation") ); m_sprExplanation.Load( THEME->GetPathToG("ScreenSelectCharacter explanation") );
@@ -183,11 +176,9 @@ PlayerNumber ScreenSelectCharacter::GetAffectedPlayerNumber( PlayerNumber pn )
switch( m_SelectionRow[pn] ) switch( m_SelectionRow[pn] )
{ {
case CHOOSING_HUMAN_CHARACTER: case CHOOSING_HUMAN_CHARACTER:
case CHOOSING_HUMAN_LEVEL:
return pn; return pn;
break; break;
case CHOOSING_CPU_CHARACTER: case CHOOSING_CPU_CHARACTER:
case CHOOSING_CPU_LEVEL:
return CPU_PLAYER[pn]; return CPU_PLAYER[pn];
break; break;
default: default:
@@ -206,10 +197,6 @@ void ScreenSelectCharacter::BeforeRowChange( PlayerNumber pn )
case CHOOSING_HUMAN_CHARACTER: case CHOOSING_HUMAN_CHARACTER:
m_sprCharacterArrows[pnAffected].SetEffectNone(); m_sprCharacterArrows[pnAffected].SetEffectNone();
break; break;
case CHOOSING_CPU_LEVEL:
case CHOOSING_HUMAN_LEVEL:
m_sprLevelCursor[pnAffected].SetEffectNone();
break;
} }
} }
@@ -222,10 +209,6 @@ void ScreenSelectCharacter::AfterRowChange( PlayerNumber pn )
case CHOOSING_HUMAN_CHARACTER: case CHOOSING_HUMAN_CHARACTER:
m_sprCharacterArrows[pnAffected].SetEffectGlowShift(); m_sprCharacterArrows[pnAffected].SetEffectGlowShift();
break; break;
case CHOOSING_CPU_LEVEL:
case CHOOSING_HUMAN_LEVEL:
m_sprLevelCursor[pnAffected].SetEffectGlowShift();
break;
} }
} }
@@ -254,13 +237,6 @@ void ScreenSelectCharacter::AfterValueChange( PlayerNumber pn )
m_AttackIcons[pnAffected][i][j].Load( pnAffected, character.m_sAttacks[i][j] ); m_AttackIcons[pnAffected][i][j].Load( pnAffected, character.m_sAttacks[i][j] );
} }
break; break;
case CHOOSING_CPU_LEVEL:
case CHOOSING_HUMAN_LEVEL:
{
int iLevelIndex = m_iSelectedLevelIndex[pnAffected];
m_sprLevelCursor[pnAffected].SetXY( LEVEL_CURSOR_X(pnAffected,iLevelIndex), LEVEL_CURSOR_Y(pnAffected,iLevelIndex) );
}
break;
case FINISHED_CHOOSING: case FINISHED_CHOOSING:
; // do nothing ; // do nothing
break; break;
@@ -303,13 +279,6 @@ void ScreenSelectCharacter::Move( PlayerNumber pn, int deltaValue )
AfterValueChange(pn); AfterValueChange(pn);
m_soundChange.PlayRandom(); m_soundChange.PlayRandom();
break; break;
case CHOOSING_CPU_LEVEL:
case CHOOSING_HUMAN_LEVEL:
m_iSelectedLevelIndex[pnAffected] += deltaValue;
CLAMP( m_iSelectedLevelIndex[pnAffected], 0, NUM_ATTACK_LEVELS-1 );
AfterValueChange(pn);
m_soundChange.PlayRandom();
break;
} }
} }
@@ -324,15 +293,9 @@ void ScreenSelectCharacter::MenuStart( PlayerNumber pn )
switch( m_SelectionRow[pn] ) switch( m_SelectionRow[pn] )
{ {
case CHOOSING_HUMAN_CHARACTER: case CHOOSING_HUMAN_CHARACTER:
m_SelectionRow[pn] = CHOOSING_HUMAN_LEVEL;
break;
case CHOOSING_HUMAN_LEVEL:
m_SelectionRow[pn] = GAMESTATE->AnyPlayersAreCpu() ? CHOOSING_CPU_CHARACTER : FINISHED_CHOOSING; m_SelectionRow[pn] = GAMESTATE->AnyPlayersAreCpu() ? CHOOSING_CPU_CHARACTER : FINISHED_CHOOSING;
break; break;
case CHOOSING_CPU_CHARACTER: case CHOOSING_CPU_CHARACTER:
m_SelectionRow[pn] = CHOOSING_CPU_LEVEL;
break;
case CHOOSING_CPU_LEVEL:
m_SelectionRow[pn] = FINISHED_CHOOSING; m_SelectionRow[pn] = FINISHED_CHOOSING;
break; break;
} }
@@ -354,7 +317,6 @@ void ScreenSelectCharacter::MenuStart( PlayerNumber pn )
for( int i=0; i<NUM_ATTACK_LEVELS; i++ ) for( int i=0; i<NUM_ATTACK_LEVELS; i++ )
for( int j=0; j<NUM_ATTACKS_PER_LEVEL; j++ ) for( int j=0; j<NUM_ATTACKS_PER_LEVEL; j++ )
GAMESTATE->m_sAttacks[p][i][j] = character.m_sAttacks[i][j]; GAMESTATE->m_sAttacks[p][i][j] = character.m_sAttacks[i][j];
GAMESTATE->m_MaxAttackLevel[p] = (AttackLevel)m_iSelectedLevelIndex[p];
} }
m_Menu.m_MenuTimer.Stop(); m_Menu.m_MenuTimer.Stop();
@@ -371,7 +333,9 @@ void ScreenSelectCharacter::MenuBack( PlayerNumber pn )
void ScreenSelectCharacter::TweenOffScreen() void ScreenSelectCharacter::TweenOffScreen()
{ {
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{
m_sprCharacter[p].Command( CHARACTER_OFF_COMMAND(p) ); m_sprCharacter[p].Command( CHARACTER_OFF_COMMAND(p) );
}
m_sprExplanation.Command( EXPLANATION_OFF_COMMAND ); m_sprExplanation.Command( EXPLANATION_OFF_COMMAND );
} }
-4
View File
@@ -49,12 +49,9 @@ private:
vector<Character> m_vCharacters; vector<Character> m_vCharacters;
int m_iSelectedCharacter[NUM_PLAYERS]; int m_iSelectedCharacter[NUM_PLAYERS];
int m_iSelectedLevelIndex[NUM_PLAYERS];
enum { enum {
CHOOSING_HUMAN_CHARACTER, CHOOSING_HUMAN_CHARACTER,
CHOOSING_HUMAN_LEVEL,
CHOOSING_CPU_CHARACTER, CHOOSING_CPU_CHARACTER,
CHOOSING_CPU_LEVEL,
FINISHED_CHOOSING FINISHED_CHOOSING
} m_SelectionRow[NUM_PLAYERS]; } m_SelectionRow[NUM_PLAYERS];
PlayerNumber GetAffectedPlayerNumber( PlayerNumber pn ); // returns the number of the player that pn is selecting for PlayerNumber GetAffectedPlayerNumber( PlayerNumber pn ); // returns the number of the player that pn is selecting for
@@ -68,7 +65,6 @@ private:
Sprite m_sprAttackFrame[NUM_PLAYERS]; Sprite m_sprAttackFrame[NUM_PLAYERS];
OptionIcon m_AttackIcons[NUM_PLAYERS][NUM_ATTACK_LEVELS][NUM_ATTACKS_PER_LEVEL]; OptionIcon m_AttackIcons[NUM_PLAYERS][NUM_ATTACK_LEVELS][NUM_ATTACKS_PER_LEVEL];
Sprite m_sprLevelCursor[NUM_PLAYERS];
Sprite m_sprExplanation; Sprite m_sprExplanation;
+8 -2
View File
@@ -18,7 +18,10 @@
#include "RageLog.h" #include "RageLog.h"
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "PrefsManager.h"
#define PREV_SCREEN( play_mode ) THEME->GetMetric ("ScreenSongOptions","PrevScreen"+Capitalize(PlayModeToString(play_mode)))
#define NEXT_SCREEN( play_mode ) THEME->GetMetric ("ScreenSongOptions","NextScreen"+Capitalize(PlayModeToString(play_mode)))
enum { enum {
SO_LIFE = 0, SO_LIFE = 0,
@@ -47,6 +50,9 @@ ScreenSongOptions::ScreenSongOptions() :
{ {
LOG->Trace( "ScreenSongOptions::ScreenSongOptions()" ); LOG->Trace( "ScreenSongOptions::ScreenSongOptions()" );
if( !PREFSMAN->m_bShowSongOptions )
SCREENMAN->SetNewScreen( NEXT_SCREEN(GAMESTATE->m_PlayMode) );
Init( INPUTMODE_BOTH, Init( INPUTMODE_BOTH,
g_SongOptionsLines, g_SongOptionsLines,
NUM_SONG_OPTIONS_LINES, NUM_SONG_OPTIONS_LINES,
@@ -106,7 +112,7 @@ void ScreenSongOptions::GoToPrevState()
if( GAMESTATE->m_bEditing ) if( GAMESTATE->m_bEditing )
SCREENMAN->PopTopScreen( SM_None ); SCREENMAN->PopTopScreen( SM_None );
else else
SCREENMAN->SetNewScreen( "ScreenPlayerOptions" ); SCREENMAN->SetNewScreen( PREV_SCREEN(GAMESTATE->m_PlayMode) );
} }
void ScreenSongOptions::GoToNextState() void ScreenSongOptions::GoToNextState()
@@ -114,7 +120,7 @@ void ScreenSongOptions::GoToNextState()
if( GAMESTATE->m_bEditing ) if( GAMESTATE->m_bEditing )
SCREENMAN->PopTopScreen(); SCREENMAN->PopTopScreen();
else else
SCREENMAN->SetNewScreen( "ScreenStage" ); SCREENMAN->SetNewScreen( NEXT_SCREEN(GAMESTATE->m_PlayMode) );
} }
+10 -2
View File
@@ -60,7 +60,7 @@ IntDir=.\../Release6
TargetDir=\stepmania\stepmania TargetDir=\stepmania\stepmania
TargetName=StepMania TargetName=StepMania
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool # End Special Build Tool
@@ -95,7 +95,7 @@ IntDir=.\../Debug6
TargetDir=\stepmania\stepmania TargetDir=\stepmania\stepmania
TargetName=StepMania-debug TargetName=StepMania-debug
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool # End Special Build Tool
@@ -1801,6 +1801,14 @@ SOURCE=.\ScreenRanking.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\ScreenRaveOptions.cpp
# End Source File
# Begin Source File
SOURCE=.\ScreenRaveOptions.h
# End Source File
# Begin Source File
SOURCE=.\ScreenSandbox.cpp SOURCE=.\ScreenSandbox.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File