From 4c2ffa90efdf42ebeae62e55ef924e2b20f6e6f9 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 26 Feb 2005 05:59:12 +0000 Subject: [PATCH] Player cleanup --- stepmania/src/Player.cpp | 51 +++++++++++---------- stepmania/src/Player.h | 21 +++++++++ stepmania/src/ScreenEdit.cpp | 2 +- stepmania/src/ScreenGameplay.cpp | 1 + stepmania/src/ScreenGameplayMultiplayer.cpp | 2 + stepmania/src/ScreenHowToPlay.cpp | 1 + 6 files changed, 52 insertions(+), 26 deletions(-) diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index a7da660ca4..dfc3ebda62 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -42,26 +42,6 @@ CString JUDGMENT_X_NAME( size_t p, size_t both_sides ) { return "JudgmentXOffse CString COMBO_X_NAME( size_t p, size_t both_sides ) { return "ComboXOffset" + (both_sides ? CString("BothSides") : ssprintf("OneSideP%d",p+1) ); } CString ATTACK_DISPLAY_X_NAME( size_t p, size_t both_sides ){ return "AttackDisplayXOffset" + (both_sides ? CString("BothSides") : ssprintf("OneSideP%d",p+1) ); } -ThemeMetric GRAY_ARROWS_Y_STANDARD ("Player","ReceptorArrowsYStandard"); -ThemeMetric GRAY_ARROWS_Y_REVERSE ("Player","ReceptorArrowsYReverse"); -ThemeMetric2D JUDGMENT_X ("Player",JUDGMENT_X_NAME,NUM_PLAYERS,2); -ThemeMetric JUDGMENT_Y ("Player","JudgmentY"); -ThemeMetric JUDGMENT_Y_REVERSE ("Player","JudgmentYReverse"); -ThemeMetric2D COMBO_X ("Player",COMBO_X_NAME,NUM_PLAYERS,2); -ThemeMetric COMBO_Y ("Player","ComboY"); -ThemeMetric COMBO_Y_REVERSE ("Player","ComboYReverse"); -ThemeMetric2D ATTACK_DISPLAY_X ("Player",ATTACK_DISPLAY_X_NAME,NUM_PLAYERS,2); -ThemeMetric ATTACK_DISPLAY_Y ("Player","AttackDisplayY"); -ThemeMetric ATTACK_DISPLAY_Y_REVERSE ("Player","AttackDisplayYReverse"); -ThemeMetric HOLD_JUDGMENT_Y_STANDARD ("Player","HoldJudgmentYStandard"); -ThemeMetric HOLD_JUDGMENT_Y_REVERSE ("Player","HoldJudgmentYReverse"); -ThemeMetric BRIGHT_GHOST_COMBO_THRESHOLD("Player","BrightGhostComboThreshold"); -ThemeMetric TAP_JUDGMENTS_UNDER_FIELD ("Player","TapJudgmentsUnderField"); -ThemeMetric HOLD_JUDGMENTS_UNDER_FIELD ("Player","HoldJudgmentsUnderField"); -ThemeMetric START_DRAWING_AT_PIXELS ("Player","StartDrawingAtPixels"); -ThemeMetric STOP_DRAWING_AT_PIXELS ("Player","StopDrawingAtPixels"); -ThemeMetric MAX_PRO_TIMING_ERROR ("Player","MaxProTimingError"); - /* Distance to search for a note in Step(), in seconds. */ static const float StepSearchDistance = 1.0f; @@ -102,6 +82,7 @@ Player::~Player() /* Init() does the expensive stuff: load sounds and note skins. Load() just loads a NoteData. */ void Player::Init( + const CString &sType, PlayerState* pPlayerState, PlayerStageStats* pPlayerStageStats, LifeMeter* pLM, @@ -112,6 +93,26 @@ void Player::Init( ScoreKeeper* pPrimaryScoreKeeper, ScoreKeeper* pSecondaryScoreKeeper ) { + GRAY_ARROWS_Y_STANDARD.Load(sType,"ReceptorArrowsYStandard"); + GRAY_ARROWS_Y_REVERSE.Load(sType,"ReceptorArrowsYReverse"); + JUDGMENT_X.Load(sType,JUDGMENT_X_NAME,NUM_PLAYERS,2); + JUDGMENT_Y.Load(sType,"JudgmentY"); + JUDGMENT_Y_REVERSE.Load(sType,"JudgmentYReverse"); + COMBO_X.Load(sType,COMBO_X_NAME,NUM_PLAYERS,2); + COMBO_Y.Load(sType,"ComboY"); + COMBO_Y_REVERSE.Load(sType,"ComboYReverse"); + ATTACK_DISPLAY_X.Load(sType,ATTACK_DISPLAY_X_NAME,NUM_PLAYERS,2); + ATTACK_DISPLAY_Y.Load(sType,"AttackDisplayY"); + ATTACK_DISPLAY_Y_REVERSE.Load(sType,"AttackDisplayYReverse"); + HOLD_JUDGMENT_Y_STANDARD.Load(sType,"HoldJudgmentYStandard"); + HOLD_JUDGMENT_Y_REVERSE.Load(sType,"HoldJudgmentYReverse"); + BRIGHT_GHOST_COMBO_THRESHOLD.Load(sType,"BrightGhostComboThreshold"); + TAP_JUDGMENTS_UNDER_FIELD.Load(sType,"TapJudgmentsUnderField"); + HOLD_JUDGMENTS_UNDER_FIELD.Load(sType,"HoldJudgmentsUnderField"); + START_DRAWING_AT_PIXELS.Load(sType,"StartDrawingAtPixels"); + STOP_DRAWING_AT_PIXELS.Load(sType,"StopDrawingAtPixels"); + MAX_PRO_TIMING_ERROR.Load(sType,"MaxProTimingError"); + m_pPlayerState = pPlayerState; m_pPlayerStageStats = pPlayerStageStats; m_pLifeMeter = pLM; @@ -128,7 +129,7 @@ void Player::Init( m_sMessageToSendOnStep = ssprintf("StepP%d",pn+1); - m_soundMine.Load( THEME->GetPathS("Player","mine"), true ); + m_soundMine.Load( THEME->GetPathS(sType,"mine"), true ); /* Attacks can be launched in course modes and in battle modes. They both come * here to play, but allow loading a different sound for different modes. */ @@ -136,12 +137,12 @@ void Player::Init( { case PLAY_MODE_RAVE: case PLAY_MODE_BATTLE: - m_soundAttackLaunch.Load( THEME->GetPathS("Player","battle attack launch"), true ); - m_soundAttackEnding.Load( THEME->GetPathS("Player","battle attack ending"), true ); + m_soundAttackLaunch.Load( THEME->GetPathS(sType,"battle attack launch"), true ); + m_soundAttackEnding.Load( THEME->GetPathS(sType,"battle attack ending"), true ); break; default: - m_soundAttackLaunch.Load( THEME->GetPathS("Player","course attack launch"), true ); - m_soundAttackEnding.Load( THEME->GetPathS("Player","course attack ending"), true ); + m_soundAttackLaunch.Load( THEME->GetPathS(sType,"course attack launch"), true ); + m_soundAttackEnding.Load( THEME->GetPathS(sType,"course attack ending"), true ); break; } diff --git a/stepmania/src/Player.h b/stepmania/src/Player.h index f0c4d81fb3..f3b6ecc6ff 100644 --- a/stepmania/src/Player.h +++ b/stepmania/src/Player.h @@ -33,6 +33,7 @@ public: virtual void DrawPrimitives(); void Init( + const CString &sType, PlayerState* pPlayerState, PlayerStageStats* pPlayerStageStats, LifeMeter* pLM, @@ -106,6 +107,26 @@ protected: vector m_vKeysounds; CString m_sMessageToSendOnStep; + + ThemeMetric GRAY_ARROWS_Y_STANDARD; + ThemeMetric GRAY_ARROWS_Y_REVERSE; + ThemeMetric2D JUDGMENT_X; + ThemeMetric JUDGMENT_Y; + ThemeMetric JUDGMENT_Y_REVERSE; + ThemeMetric2D COMBO_X; + ThemeMetric COMBO_Y; + ThemeMetric COMBO_Y_REVERSE; + ThemeMetric2D ATTACK_DISPLAY_X; + ThemeMetric ATTACK_DISPLAY_Y; + ThemeMetric ATTACK_DISPLAY_Y_REVERSE; + ThemeMetric HOLD_JUDGMENT_Y_STANDARD; + ThemeMetric HOLD_JUDGMENT_Y_REVERSE; + ThemeMetric BRIGHT_GHOST_COMBO_THRESHOLD; + ThemeMetric TAP_JUDGMENTS_UNDER_FIELD; + ThemeMetric HOLD_JUDGMENTS_UNDER_FIELD; + ThemeMetric START_DRAWING_AT_PIXELS; + ThemeMetric STOP_DRAWING_AT_PIXELS; + ThemeMetric MAX_PRO_TIMING_ERROR; }; #endif diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index f8f37888a9..e4d93a20b6 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -561,7 +561,7 @@ void ScreenEdit::Init() /* XXX: Do we actually have to send real note data here, and to m_NoteFieldRecord? * (We load again on play/record.) */ - m_Player.Init( GAMESTATE->m_pPlayerState[PLAYER_1], NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); + m_Player.Init( "Player", GAMESTATE->m_pPlayerState[PLAYER_1], NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); m_Player.Load( noteData ); GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_HUMAN; m_Player.SetXY( PLAYER_X, PLAYER_Y ); diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index c8fb732506..03c9a71414 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -825,6 +825,7 @@ void ScreenGameplay::SetupSong( PlayerNumber p, int iSongIndex ) NoteData nd = ndTransformed; NoteDataUtil::RemoveAllTapsOfType( nd, TapNote::autoKeysound ); m_Player[p].Init( + "Player", GAMESTATE->m_pPlayerState[p], &STATSMAN->m_CurStageStats.m_player[p], m_pLifeMeter[p], diff --git a/stepmania/src/ScreenGameplayMultiplayer.cpp b/stepmania/src/ScreenGameplayMultiplayer.cpp index c00411abf2..a2b3ff3c0c 100644 --- a/stepmania/src/ScreenGameplayMultiplayer.cpp +++ b/stepmania/src/ScreenGameplayMultiplayer.cpp @@ -310,6 +310,7 @@ void ScreenGameplayMultiplayer::SetupSong( MultiPlayer p, int iSongIndex ) NoteData nd = ndTransformed; NoteDataUtil::RemoveAllTapsOfType( nd, TapNote::autoKeysound ); m_AutoPlayer.Init( + "Player", GAMESTATE->m_pPlayerState[ GAMESTATE->m_MasterPlayerNumber ], NULL, NULL, @@ -322,6 +323,7 @@ void ScreenGameplayMultiplayer::SetupSong( MultiPlayer p, int iSongIndex ) m_AutoPlayer.Load( nd ); m_HumanPlayer[p].Init( + "Player", &m_PlayerState[p], &m_PlayerStageStats[p], NULL, diff --git a/stepmania/src/ScreenHowToPlay.cpp b/stepmania/src/ScreenHowToPlay.cpp index 69c1123eeb..bb9f127877 100644 --- a/stepmania/src/ScreenHowToPlay.cpp +++ b/stepmania/src/ScreenHowToPlay.cpp @@ -160,6 +160,7 @@ void ScreenHowToPlay::Init() m_pPlayer = new Player; m_pPlayer->Init( + "Player", GAMESTATE->m_pPlayerState[PLAYER_1], NULL, m_pLifeMeterBar,