From 3809715db0824f9ef83b8bee8a2499a8b63ce66a Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 27 Jun 2004 06:52:49 +0000 Subject: [PATCH] cleanup: Remove Style and use StyleDef everywhere. This gets rid of a lot of Style->StyleDef lookups and discourages code that's specific to a Style. All game logic should be data-driven. --- stepmania/src/ArrowEffects.cpp | 8 +- stepmania/src/BeginnerHelper.cpp | 13 +- stepmania/src/Bookkeeper.h | 1 - stepmania/src/ConditionalBGA.cpp | 6 +- stepmania/src/ConditionalBGA.h | 3 +- stepmania/src/GameDef.cpp | 4 +- stepmania/src/GameManager.cpp | 172 ++++++++++++++----- stepmania/src/GameManager.h | 17 +- stepmania/src/GameState.cpp | 24 +-- stepmania/src/GameState.h | 4 +- stepmania/src/InputMapper.cpp | 5 +- stepmania/src/JukeboxMenu.cpp | 2 +- stepmania/src/JukeboxMenu.h | 20 +-- stepmania/src/ModeChoice.cpp | 55 +++--- stepmania/src/ModeChoice.h | 4 +- stepmania/src/ModeSwitcher.cpp | 153 ++++------------- stepmania/src/ModeSwitcher.h | 3 +- stepmania/src/MusicWheel.cpp | 9 +- stepmania/src/NoteFieldPositioning.cpp | 7 +- stepmania/src/NoteFieldPositioning.h | 3 +- stepmania/src/Profile.cpp | 30 ++-- stepmania/src/Profile.h | 4 +- stepmania/src/ProfileHtml.cpp | 13 +- stepmania/src/ProfileManager.h | 1 - stepmania/src/ScreenDemonstration.cpp | 2 +- stepmania/src/ScreenEditMenu.cpp | 2 +- stepmania/src/ScreenEnding.cpp | 2 +- stepmania/src/ScreenEvaluation.cpp | 2 +- stepmania/src/ScreenEz2SelectMusic.cpp | 4 +- stepmania/src/ScreenGameplay.cpp | 2 +- stepmania/src/ScreenHowToPlay.cpp | 2 +- stepmania/src/ScreenJukebox.cpp | 2 +- stepmania/src/ScreenJukeboxMenu.cpp | 12 +- stepmania/src/ScreenNameEntryTraditional.cpp | 2 +- stepmania/src/ScreenOptions.cpp | 2 +- stepmania/src/ScreenRanking.h | 1 - stepmania/src/ScreenSelect.cpp | 4 +- stepmania/src/ScreenSelectMode.cpp | 2 +- stepmania/src/ScreenSelectMusic.cpp | 2 +- stepmania/src/ScreenWithMenuElements.cpp | 2 +- stepmania/src/StageStats.cpp | 2 +- stepmania/src/StageStats.h | 5 +- stepmania/src/Style.h | 76 -------- stepmania/src/StyleDef.h | 2 + 44 files changed, 308 insertions(+), 383 deletions(-) delete mode 100644 stepmania/src/Style.h diff --git a/stepmania/src/ArrowEffects.cpp b/stepmania/src/ArrowEffects.cpp index 0648ef7bad..5039c6a9a4 100644 --- a/stepmania/src/ArrowEffects.cpp +++ b/stepmania/src/ArrowEffects.cpp @@ -419,11 +419,9 @@ bool ArrowsNeedZBuffer( PlayerNumber pn ) float ArrowGetZoom( PlayerNumber pn ) { - /* Hack: make STYLE_TECHNO_VERSUS8 fit. */ - if( GAMESTATE->m_CurGame == GAME_TECHNO && - ( GAMESTATE->m_CurStyle == STYLE_TECHNO_VERSUS8 - || GAMESTATE->m_PlayMode == PLAY_MODE_BATTLE - || GAMESTATE->m_PlayMode == PLAY_MODE_RAVE ) ) + // FIXME: Move the zoom values into StyleDef + if( GAMESTATE->m_pCurStyleDef->m_bNeedsZoomOutWith2Players && + (GAMESTATE->GetNumSidesJoined()==2 || GAMESTATE->AnyPlayersAreCpu()) ) return 0.6f; return 1.0f; } diff --git a/stepmania/src/BeginnerHelper.cpp b/stepmania/src/BeginnerHelper.cpp index 9a7f6ee437..46f820b2c0 100644 --- a/stepmania/src/BeginnerHelper.cpp +++ b/stepmania/src/BeginnerHelper.cpp @@ -8,6 +8,7 @@ #include "RageDisplay.h" #include "ThemeManager.h" #include "Steps.h" +#include "StyleDef.h" // "PLAYER_X" offsets are relative to the pad.. ex: Setting this to 10, and the HELPER to 300, will put the dancer at 310 #define PLAYER_X( px ) THEME->GetMetricF("BeginnerHelper",ssprintf("Player%d_X",px+1)) @@ -109,17 +110,7 @@ bool BeginnerHelper::CanUse() if(!DoesFileExist(GetAnimPath((Animation)i))) return false; - if(GAMESTATE->m_CurGame != GAME_DANCE) - return false; - - switch( GAMESTATE->m_CurStyle ) - { - case STYLE_DANCE_SOLO: - case STYLE_DANCE_DOUBLE: - return false; - } - - return true; + return GAMESTATE->m_pCurStyleDef->m_bCanUseBeginnerHelper; } bool BeginnerHelper::Initialize( int iDancePadType ) diff --git a/stepmania/src/Bookkeeper.h b/stepmania/src/Bookkeeper.h index 569ff40114..66774a170d 100644 --- a/stepmania/src/Bookkeeper.h +++ b/stepmania/src/Bookkeeper.h @@ -3,7 +3,6 @@ #ifndef Bookkeeper_H #define Bookkeeper_H -#include "Style.h" #include "TimeConstants.h" diff --git a/stepmania/src/ConditionalBGA.cpp b/stepmania/src/ConditionalBGA.cpp index 02ea826fd3..a64c087c95 100644 --- a/stepmania/src/ConditionalBGA.cpp +++ b/stepmania/src/ConditionalBGA.cpp @@ -248,7 +248,7 @@ void ConditionalBGA::Load(CString szScreenName) split( asSplitLine[1], ",", asStyles ); for( unsigned d=0; dInfo("Style:%s (%d) (current: %d)",asStyles[d].c_str(),GAMEMAN->GameAndStringToStyle(GAMESTATE->m_CurGame,asStyles[d]),GAMESTATE->m_CurStyle); + LOG->Info( "Style:%s", asStyles[d].c_str() ); m_bgainfo[bgano].styles.push_back(GAMEMAN->GameAndStringToStyle(GAMESTATE->m_CurGame,asStyles[d])); } @@ -489,8 +489,8 @@ void ConditionalBGA::CheckBgaRequirements(BgaCondInfo info) bool foundmatchingstyle=false; for(unsigned d=0;dInfo("info.styles = %d m_CurStyle = %d",info.styles[d],GAMESTATE->m_CurStyle); - if(info.styles[d] == GAMESTATE->m_CurStyle) + //LOG->Info("info.styles = %d m_CurStyle = %d",info.styles[d],GAMESTATE->m_pCurStyleDef); + if(info.styles[d] == GAMESTATE->m_pCurStyleDef) { foundmatchingstyle = true; LOG->Info("Found Valid Style"); diff --git a/stepmania/src/ConditionalBGA.h b/stepmania/src/ConditionalBGA.h index b15ccddb87..77a627b905 100644 --- a/stepmania/src/ConditionalBGA.h +++ b/stepmania/src/ConditionalBGA.h @@ -1,7 +1,6 @@ #ifndef CONDITIONALBGA_H #define CONDITIONALBGA_H -#include "Style.h" #include "PlayerOptions.h" #include "GameConstantsAndTypes.h" #include "BGAnimation.h" @@ -31,7 +30,7 @@ struct BgaCondInfo vector songdows; vector songmonths; vector grades; - vector