diff --git a/stepmania/Themes/default/BGAnimations/ScreenEvaluationRave in.redir b/stepmania/Themes/default/BGAnimations/ScreenEvaluationRave in.redir new file mode 100644 index 0000000000..4ac71acd6e --- /dev/null +++ b/stepmania/Themes/default/BGAnimations/ScreenEvaluationRave in.redir @@ -0,0 +1 @@ +ScreenEvaluationStage in \ No newline at end of file diff --git a/stepmania/Themes/default/BGAnimations/ScreenEvaluationRave out.redir b/stepmania/Themes/default/BGAnimations/ScreenEvaluationRave out.redir new file mode 100644 index 0000000000..7e68622ab8 --- /dev/null +++ b/stepmania/Themes/default/BGAnimations/ScreenEvaluationRave out.redir @@ -0,0 +1 @@ +ScreenEvaluationStage out \ No newline at end of file diff --git a/stepmania/Themes/default/BGAnimations/ScreenRaveOptions in.redir b/stepmania/Themes/default/BGAnimations/ScreenRaveOptions in.redir new file mode 100644 index 0000000000..0f6547301b --- /dev/null +++ b/stepmania/Themes/default/BGAnimations/ScreenRaveOptions in.redir @@ -0,0 +1 @@ +_options to options \ No newline at end of file diff --git a/stepmania/Themes/default/BGAnimations/ScreenRaveOptions out.redir b/stepmania/Themes/default/BGAnimations/ScreenRaveOptions out.redir new file mode 100644 index 0000000000..0f6547301b --- /dev/null +++ b/stepmania/Themes/default/BGAnimations/ScreenRaveOptions out.redir @@ -0,0 +1 @@ +_options to options \ No newline at end of file diff --git a/stepmania/Themes/default/Graphics/ScreenEvaluationRave header.redir b/stepmania/Themes/default/Graphics/ScreenEvaluationRave header.redir new file mode 100644 index 0000000000..cc40be9fcd --- /dev/null +++ b/stepmania/Themes/default/Graphics/ScreenEvaluationRave header.redir @@ -0,0 +1 @@ +ScreenEvaluationStage header.png \ No newline at end of file diff --git a/stepmania/Themes/default/Graphics/ScreenRaveOptions header.redir b/stepmania/Themes/default/Graphics/ScreenRaveOptions header.redir new file mode 100644 index 0000000000..0b81245246 --- /dev/null +++ b/stepmania/Themes/default/Graphics/ScreenRaveOptions header.redir @@ -0,0 +1 @@ +_shared options header.png \ No newline at end of file diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 9bf9ffb822..198ca65435 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -1132,7 +1132,7 @@ ShowMaxCombo=1 ShowScoreArea=1 ShowTimeArea=0 HelpText=Press START to continue -TimerSeconds=10 +TimerSeconds=15 [ScreenEvaluationSummary] NextScreen=ScreenNameEntry @@ -1242,7 +1242,7 @@ ShowMaxCombo=0 ShowScoreArea=1 ShowTimeArea=0 HelpText=Press START to continue -TimerSeconds=10 +TimerSeconds=15 [ScreenEvaluationRave] NextScreen=ScreenSelectMusic @@ -1260,11 +1260,11 @@ ShowGood=1 ShowBoo=1 ShowMiss=1 ShowOK=1 -ShowMaxCombo=1 +ShowMaxCombo=0c ShowScoreArea=1 ShowTimeArea=0 HelpText=Press START to continue -TimerSeconds=10 +TimerSeconds=15 [ScreenMusicScroll] ScrollDelay=0.2 @@ -1789,10 +1789,44 @@ PrevScreenOni=ScreenSelectCourse PrevScreenEndless=ScreenSelectCourse PrevScreenBattle=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 TimerSeconds=30 [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 Game=Change the current game type with this option. 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 TitleP2OnCommand=x,500;y,80;addx,400;bounceend,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 -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 CharacterArrowsP1OnCommand=x,140;y,180 CharacterArrowsP1OffCommand= @@ -1836,14 +1870,14 @@ CharacterArrowsP2OnCommand=x,500;y,180 CharacterArrowsP2OffCommand= ExplanationOnCommand=x,320;y,140;diffusealpha,0;linear,0.3;diffusealpha,1 ExplanationOffCommand=linear,0.3;diffusealpha,0 -AttackFrameP1OnCommand=x,140;y,360 +AttackFrameP1OnCommand=x,140;y,380 AttackFrameP1OffCommand= -AttackFrameP2OnCommand=x,500;y,360 +AttackFrameP2OnCommand=x,500;y,380 AttackFrameP2OffCommand= IconsP1StartX=128 -IconsP1StartY=336 +IconsP1StartY=356 IconsP2StartX=488 -IconsP2StartY=336 +IconsP2StartY=356 IconsSpacingX=42 IconsSpacingY=32 HelpText=Use &LEFT; &RIGHT; to select, then press START diff --git a/stepmania/src/DifficultyMeter.h b/stepmania/src/DifficultyMeter.h index 68b0bbdc22..6e2a0e1acf 100644 --- a/stepmania/src/DifficultyMeter.h +++ b/stepmania/src/DifficultyMeter.h @@ -21,9 +21,9 @@ public: DifficultyMeter(); void SetFromNotes( Notes* pNotes ); + void SetMeter( int iMeter ); private: - void SetMeter( int iMeter ); }; #endif diff --git a/stepmania/src/GameConstantsAndTypes.h b/stepmania/src/GameConstantsAndTypes.h index 6ee3dd0dfe..44df3062ca 100644 --- a/stepmania/src/GameConstantsAndTypes.h +++ b/stepmania/src/GameConstantsAndTypes.h @@ -186,14 +186,15 @@ const CString GROUP_ALL_MUSIC = ""; // enum PlayerController { - HUMAN, - CPU_EASY, - CPU_MEDIUM, - CPU_HARD, - CPU_AUTOPLAY, + PC_HUMAN, + PC_CPU, + PC_AUTOPLAY, NUM_PLAYER_CONTROLLERS }; +const int MIN_SKILL = 0; +const int MAX_SKILL = 10; + // // Battle stuff @@ -209,6 +210,15 @@ enum AttackLevel const int NUM_ATTACKS_PER_LEVEL = 3; const int ITEM_NONE = -1; +enum BattleResult +{ + RESULT_WIN, + RESULT_LOSE, + RESULT_DRAW +}; + + + const CString BG_ANIMS_DIR = "BGAnimations/"; const CString VISUALIZATIONS_DIR = "Visualizations/"; diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 2fc09dfa6e..166d79f495 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -88,6 +88,12 @@ void GameState::Reset() NOTESKIN->SwitchNoteSkin( PlayerNumber(p), PREFSMAN->m_sDefaultNoteSkin ); m_Position = new NoteFieldPositioning("Positioning.ini"); + + for( p=0; pm_CurStageStats.iActualDancePoints[p] > GAMESTATE->m_CurStageStats.iActualDancePoints[winner] ) + for( int p=PLAYER_1+1; pm_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; + } 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& vSongsOut ) { statsOut = StageStats(); diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index b2437e2dcb..d330afd5bc 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -82,7 +82,8 @@ public: } 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; @@ -155,7 +156,6 @@ public: // used in PLAY_MODE_RAVE CString m_sCharacterName[NUM_PLAYERS]; - AttackLevel m_MaxAttackLevel[NUM_PLAYERS]; CString m_sAttacks[NUM_PLAYERS][NUM_ATTACK_LEVELS][NUM_ATTACKS_PER_LEVEL]; @@ -183,6 +183,7 @@ public: bool HasEarnedExtraStage(); PlayerNumber GetWinner(); + BattleResult GetBattleResult( PlayerNumber pn ); bool m_bAllow2ndExtraStage; //only used when "Allow Selection of Extra Stage is on" diff --git a/stepmania/src/Inventory.cpp b/stepmania/src/Inventory.cpp index e8321f247a..f1781e8740 100644 --- a/stepmania/src/Inventory.cpp +++ b/stepmania/src/Inventory.cpp @@ -111,7 +111,7 @@ void Inventory::Update( float fDelta ) // 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 ) { // every one second, consider using an item diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index 6086382e91..6f7c47d91c 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -70,6 +70,8 @@ Player::Player() this->AddChild( &m_Combo ); for( int c=0; cAddChild( &m_HoldJudgment[c] ); + + PlayerAI::InitFromDisk(); } Player::~Player() @@ -221,7 +223,7 @@ void Player::Update( float fDeltaTime ) bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI ); // TODO: Make the CPU miss sometimes. - if( GAMESTATE->m_PlayerController[m_PlayerNumber] != HUMAN ) + if( GAMESTATE->m_PlayerController[m_PlayerNumber] != PC_HUMAN ) bIsHoldingButton = true; m_NoteField.m_bIsHoldingHoldNote[i] = bIsHoldingButton && bSteppedOnTapNote; // set host flag so NoteField can do intelligent drawing @@ -386,25 +388,31 @@ void Player::Step( int col ) // calculate TapNoteScore 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; else if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowPerfectSeconds ) score = TNS_PERFECT; else if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowGreatSeconds ) score = TNS_GREAT; else if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowGoodSeconds ) score = TNS_GOOD; else if( fSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowBooSeconds ) score = TNS_BOO; else score = TNS_NONE; - } - else - { - score = PlayerAI::GetTapNoteScore( GAMESTATE->m_PlayerController[m_PlayerNumber], GAMESTATE->GetSumOfActiveAttackLevels(m_PlayerNumber) ); - + break; + case PC_CPU: + score = PlayerAI::GetTapNoteScore( GAMESTATE->m_iCpuSkill[m_PlayerNumber], GAMESTATE->GetSumOfActiveAttackLevels(m_PlayerNumber) ); + /* 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 * AI generated a miss, and let UpdateMissedTapNotesOlderThan() detect and handle the * misses. */ if( score == TNS_MISS ) return; + break; + case PC_AUTOPLAY: + score = TNS_MARVELOUS; + break; + default: + ASSERT(0); } if( score==TNS_MARVELOUS && !PREFSMAN->m_bMarvelousTiming ) @@ -419,7 +427,7 @@ void Player::Step( int col ) if( score != TNS_NONE ) SetTapNoteOffset(col, iIndexOverlappingNote, -fNoteOffset); - if( GAMESTATE->m_PlayerController[m_PlayerNumber] == HUMAN && + if( GAMESTATE->m_PlayerController[m_PlayerNumber] == PC_HUMAN && score >= TNS_GREAT ) HandleAutosync(fNoteOffset); @@ -549,7 +557,7 @@ void Player::CrossedRow( int iNoteRow ) // check to see if there's at the crossed row for( int t=0; tm_PlayerController[m_PlayerNumber] != HUMAN ) + if( GAMESTATE->m_PlayerController[m_PlayerNumber] != PC_HUMAN ) Step( t ); } diff --git a/stepmania/src/PlayerAI.cpp b/stepmania/src/PlayerAI.cpp index ef036ee724..1c4435c7e0 100644 --- a/stepmania/src/PlayerAI.cpp +++ b/stepmania/src/PlayerAI.cpp @@ -12,83 +12,64 @@ #include "PlayerAI.h" #include "RageUtil.h" +#include "IniFile.h" +#include "RageException.h" +#include "GameState.h" #include struct TapScoreDistribution { float fCumulativeProbability[NUM_TAP_NOTE_SCORES]; - TapNoteScore GetTapNoteScore( int iDifficultyExponent ) + + TapNoteScore GetTapNoteScore() { float fRand = randomf(0,1); - ASSERT( iDifficultyExponent >= 1 ); - fRand = powf( fRand, (float)iDifficultyExponent ); for( int i=TNS_MISS; i<=TNS_MARVELOUS; i++ ) if( fRand <= fCumulativeProbability[i] ) return (TapNoteScore)i; ASSERT(0); // the last probability must be 1.0, so we should never get here! return TNS_MARVELOUS; } + }; -TapScoreDistribution TAP_SCORE_DISTRIBUTIONS[NUM_PLAYER_CONTROLLERS] = -{ - // 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 - }, -}; +TapScoreDistribution g_Distributions[NUM_SKILL_LEVELS]; -TapNoteScore PlayerAI::GetTapNoteScore( PlayerController pc, int iSumOfAttackLevels ) +void PlayerAI::InitFromDisk() { - TapNoteScore tns = TAP_SCORE_DISTRIBUTIONS[pc].GetTapNoteScore( iSumOfAttackLevels+1 ); - ASSERT( tns != TNS_NONE ); // sanity check on PlayerAI's result - return tns; -} \ No newline at end of file + IniFile ini; + ini.SetPath( "AI.ini" ); + ini.ReadFile(); + + for( int i=0; i=0 && iCpuSkillSwitchNoteSkin( PLAYER_1, "default" ); // change noteskin back to default before loading player m_Player.Load( PLAYER_1, ¬eData, 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_In.Load( THEME->GetPathToB("ScreenEdit in") ); @@ -1425,7 +1425,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers ) m_EditMode = MODE_PLAYING; 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.BeginTweening( 0.5f ); diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index c1f37196f3..bc0d789963 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -492,10 +492,10 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName, Type type ) : Screen(sCl UtilSetXYAndOnCommand( m_sprWinFrame[p], "ScreenEvaluation" ); 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(); - bool bIsWinner = GAMESTATE->GetWinner() == p; - m_sprWin[p].SetState( (bIsWinner?0:2) + p ); + int iFrame = GAMESTATE->GetBattleResult( (PlayerNumber)p )*2 + p; + m_sprWin[p].SetState( iFrame ); m_sprWin[p].SetName( ssprintf("WinP%d",p+1) ); UtilSetXYAndOnCommand( m_sprWin[p], "ScreenEvaluation" ); this->AddChild( &m_sprWin[p] ); diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 70e07795bb..b4e8925d98 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -432,11 +432,14 @@ ScreenGameplay::ScreenGameplay( bool bDemonstration ) : Screen("ScreenGameplay") switch( GAMESTATE->m_PlayMode ) { case PLAY_MODE_BATTLE: + case PLAY_MODE_RAVE: for( p=0; pGetPathToB(ssprintf("ScreenGameplay win p%d",p+1)) ); this->AddChild( &m_Win[p] ); } + m_Draw.Load( THEME->GetPathToB("ScreenGameplay draw") ); + this->AddChild( &m_Draw ); 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] ); 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) ) { - switch( GAMESTATE->m_pCurNotes[p]->GetDifficulty() ) + GAMESTATE->m_PlayerController[p] = PC_CPU; + if( GAMESTATE->m_iCpuSkill[p] == -1 ) { - case DIFFICULTY_BEGINNER: - case DIFFICULTY_EASY: - GAMESTATE->m_PlayerController[p] = CPU_EASY; - break; - case DIFFICULTY_MEDIUM: - GAMESTATE->m_PlayerController[p] = CPU_MEDIUM; - break; - case DIFFICULTY_HARD: - case DIFFICULTY_CHALLENGE: - GAMESTATE->m_PlayerController[p] = CPU_HARD; - break; + switch( GAMESTATE->m_pCurNotes[p]->GetDifficulty() ) + { + case DIFFICULTY_BEGINNER: GAMESTATE->m_iCpuSkill[p] = 1; break; + case DIFFICULTY_EASY: GAMESTATE->m_iCpuSkill[p] = 3; break; + case DIFFICULTY_MEDIUM: GAMESTATE->m_iCpuSkill[p] = 5; break; + case DIFFICULTY_HARD: GAMESTATE->m_iCpuSkill[p] = 7; break; + case DIFFICULTY_CHALLENGE: GAMESTATE->m_iCpuSkill[p] = 9; break; + default: ASSERT(0); + } } } else if( PREFSMAN->m_bAutoPlay ) - GAMESTATE->m_PlayerController[p] = CPU_AUTOPLAY; + GAMESTATE->m_PlayerController[p] = PC_AUTOPLAY; else - GAMESTATE->m_PlayerController[p] = HUMAN; + GAMESTATE->m_PlayerController[p] = PC_HUMAN; m_TimingAssist.Reset(); } @@ -1047,7 +1052,7 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ UpdateAutoPlayText(); for( int p=0; pIsHumanPlayer(p) ) - GAMESTATE->m_PlayerController[p] = PREFSMAN->m_bAutoPlay?CPU_AUTOPLAY:HUMAN; + GAMESTATE->m_PlayerController[p] = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN; } break; case SDLK_F9: @@ -1330,9 +1335,18 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) switch( GAMESTATE->m_PlayMode ) { case PLAY_MODE_BATTLE: + case PLAY_MODE_RAVE: { 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; default: diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index bb5386c8d9..04791b8094 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -127,6 +127,7 @@ protected: Transition m_Extra; Transition m_Toasty; // easter egg Transition m_Win[NUM_PLAYERS]; + Transition m_Draw; Transition m_In; Transition m_Back; diff --git a/stepmania/src/ScreenHowToPlay.cpp b/stepmania/src/ScreenHowToPlay.cpp index 1f60cc4682..61ba02937e 100644 --- a/stepmania/src/ScreenHowToPlay.cpp +++ b/stepmania/src/ScreenHowToPlay.cpp @@ -57,7 +57,7 @@ ScreenHowToPlay::ScreenHowToPlay() : ScreenAttract("ScreenHowToPlay") GAMESTATE->m_bPastHereWeGo = true; 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 ); this->AddChild( &m_Player ); diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index 6b948b26bd..b1914fb263 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -317,6 +317,9 @@ void ScreenOptions::RefreshIcons() { for( int p=0; pIsHumanPlayer(p) ) + continue; + for( int i=0; im_bEditing ) SCREENMAN->PopTopScreen(); - else if( PREFSMAN->m_bShowSongOptions ) - SCREENMAN->SetNewScreen( "ScreenSongOptions" ); else - SCREENMAN->SetNewScreen( "ScreenStage" ); + SCREENMAN->SetNewScreen( NEXT_SCREEN(GAMESTATE->m_PlayMode) ); } diff --git a/stepmania/src/ScreenRaveOptions.cpp b/stepmania/src/ScreenRaveOptions.cpp new file mode 100644 index 0000000000..99c5da5098 --- /dev/null +++ b/stepmania/src/ScreenRaveOptions.cpp @@ -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; pIsHumanPlayer(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; pIsHumanPlayer(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) ); +} + diff --git a/stepmania/src/ScreenRaveOptions.h b/stepmania/src/ScreenRaveOptions.h new file mode 100644 index 0000000000..17c877c2ad --- /dev/null +++ b/stepmania/src/ScreenRaveOptions.h @@ -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(); +}; + diff --git a/stepmania/src/ScreenSelectCharacter.cpp b/stepmania/src/ScreenSelectCharacter.cpp index 5b9d43cca9..0fedc8dfd3 100644 --- a/stepmania/src/ScreenSelectCharacter.cpp +++ b/stepmania/src/ScreenSelectCharacter.cpp @@ -58,7 +58,6 @@ ScreenSelectCharacter::ScreenSelectCharacter() : Screen("ScreenSelectCharacter") for( p=0; pIsHumanPlayer(p) ) m_SelectionRow[p] = CHOOSING_HUMAN_CHARACTER; } @@ -103,12 +102,6 @@ ScreenSelectCharacter::ScreenSelectCharacter() : Screen("ScreenSelectCharacter") m_AttackIcons[p][i][j].SetXY( fX, fY ); 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") ); @@ -183,11 +176,9 @@ PlayerNumber ScreenSelectCharacter::GetAffectedPlayerNumber( PlayerNumber pn ) switch( m_SelectionRow[pn] ) { case CHOOSING_HUMAN_CHARACTER: - case CHOOSING_HUMAN_LEVEL: return pn; break; case CHOOSING_CPU_CHARACTER: - case CHOOSING_CPU_LEVEL: return CPU_PLAYER[pn]; break; default: @@ -206,10 +197,6 @@ void ScreenSelectCharacter::BeforeRowChange( PlayerNumber pn ) case CHOOSING_HUMAN_CHARACTER: m_sprCharacterArrows[pnAffected].SetEffectNone(); 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: m_sprCharacterArrows[pnAffected].SetEffectGlowShift(); 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] ); } 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: ; // do nothing break; @@ -303,13 +279,6 @@ void ScreenSelectCharacter::Move( PlayerNumber pn, int deltaValue ) AfterValueChange(pn); m_soundChange.PlayRandom(); 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] ) { 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; break; case CHOOSING_CPU_CHARACTER: - m_SelectionRow[pn] = CHOOSING_CPU_LEVEL; - break; - case CHOOSING_CPU_LEVEL: m_SelectionRow[pn] = FINISHED_CHOOSING; break; } @@ -354,7 +317,6 @@ void ScreenSelectCharacter::MenuStart( PlayerNumber pn ) for( int i=0; im_sAttacks[p][i][j] = character.m_sAttacks[i][j]; - GAMESTATE->m_MaxAttackLevel[p] = (AttackLevel)m_iSelectedLevelIndex[p]; } m_Menu.m_MenuTimer.Stop(); @@ -371,7 +333,9 @@ void ScreenSelectCharacter::MenuBack( PlayerNumber pn ) void ScreenSelectCharacter::TweenOffScreen() { for( int p=0; p m_vCharacters; int m_iSelectedCharacter[NUM_PLAYERS]; - int m_iSelectedLevelIndex[NUM_PLAYERS]; enum { CHOOSING_HUMAN_CHARACTER, - CHOOSING_HUMAN_LEVEL, CHOOSING_CPU_CHARACTER, - CHOOSING_CPU_LEVEL, FINISHED_CHOOSING } m_SelectionRow[NUM_PLAYERS]; 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]; OptionIcon m_AttackIcons[NUM_PLAYERS][NUM_ATTACK_LEVELS][NUM_ATTACKS_PER_LEVEL]; - Sprite m_sprLevelCursor[NUM_PLAYERS]; Sprite m_sprExplanation; diff --git a/stepmania/src/ScreenSongOptions.cpp b/stepmania/src/ScreenSongOptions.cpp index fcba818aee..c32a983fd5 100644 --- a/stepmania/src/ScreenSongOptions.cpp +++ b/stepmania/src/ScreenSongOptions.cpp @@ -18,7 +18,10 @@ #include "RageLog.h" #include "GameState.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 { SO_LIFE = 0, @@ -47,6 +50,9 @@ ScreenSongOptions::ScreenSongOptions() : { LOG->Trace( "ScreenSongOptions::ScreenSongOptions()" ); + if( !PREFSMAN->m_bShowSongOptions ) + SCREENMAN->SetNewScreen( NEXT_SCREEN(GAMESTATE->m_PlayMode) ); + Init( INPUTMODE_BOTH, g_SongOptionsLines, NUM_SONG_OPTIONS_LINES, @@ -106,7 +112,7 @@ void ScreenSongOptions::GoToPrevState() if( GAMESTATE->m_bEditing ) SCREENMAN->PopTopScreen( SM_None ); else - SCREENMAN->SetNewScreen( "ScreenPlayerOptions" ); + SCREENMAN->SetNewScreen( PREV_SCREEN(GAMESTATE->m_PlayMode) ); } void ScreenSongOptions::GoToNextState() @@ -114,7 +120,7 @@ void ScreenSongOptions::GoToNextState() if( GAMESTATE->m_bEditing ) SCREENMAN->PopTopScreen(); else - SCREENMAN->SetNewScreen( "ScreenStage" ); + SCREENMAN->SetNewScreen( NEXT_SCREEN(GAMESTATE->m_PlayMode) ); } diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 5fc304f4c4..37d936268c 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -60,7 +60,7 @@ IntDir=.\../Release6 TargetDir=\stepmania\stepmania TargetName=StepMania 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 # End Special Build Tool @@ -95,7 +95,7 @@ IntDir=.\../Debug6 TargetDir=\stepmania\stepmania TargetName=StepMania-debug 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 # End Special Build Tool @@ -1801,6 +1801,14 @@ SOURCE=.\ScreenRanking.h # End 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 # End Source File # Begin Source File