Update of /cvsroot/stepmania/stepmania/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12315 Modified Files: CatalogXml.cpp ConditionalBGA.cpp EditMenu.cpp Font.cpp FontManager.cpp FontManager.h GameDef.cpp GameDef.h GameManager.cpp GameManager.h GameState.cpp GameState.h InputMapper.cpp JukeboxMenu.cpp ModeChoice.cpp ModeChoice.h ModeSwitcher.cpp MusicWheel.cpp NoteFieldPositioning.cpp NoteSkinManager.cpp NoteSkinManager.h Player.cpp ScreenDemonstration.cpp ScreenEnding.cpp ScreenEvaluation.cpp ScreenHowToPlay.cpp ScreenLogo.cpp ScreenMapControllers.cpp ScreenNameEntry.cpp ScreenNameEntryTraditional.cpp ScreenOptionsMasterPrefs.cpp ScreenRanking.cpp ScreenStyleSplash.cpp ScreenTestInput.cpp ScreenTestLights.cpp ScreenTitleMenu.cpp ScreenWithMenuElements.cpp SnapDisplay.cpp StepMania.cpp StepMania.h Style.h StyleUtil.cpp Removed Files: Game.h Log Message: remove enum Game. Instead, pass around the GameDef pointer Index: NoteFieldPositioning.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/NoteFieldPositioning.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -p -r1.24 -r1.25 --- NoteFieldPositioning.cpp 28 Jun 2004 07:25:52 -0000 1.24 +++ NoteFieldPositioning.cpp 25 Jul 2004 04:27:18 -0000 1.25 @@ -9,7 +9,6 @@ #include "GameState.h" #include "GameManager.h" #include "IniFile.h" -#include "Game.h" #include "GameDef.h" /* Copies of the current mode. Update this by calling Load. */ @@ -94,10 +93,10 @@ void NoteFieldMode::Load(IniFile &ini, C split(games[n], "-", bits); ASSERT(bits.size() == 2); - const Game game = GAMEMAN->StringToGameType( bits[0] ); - ASSERT(game != GAME_INVALID); + const GameDef* pGame = GAMEMAN->StringToGameType( bits[0] ); + ASSERT(pGame != NULL); - const Style *style = GAMEMAN->GameAndStringToStyle( game, bits[1] ); + const Style *style = GAMEMAN->GameAndStringToStyle( pGame, bits[1] ); ASSERT(style != NULL); Styles.insert(style); } Index: ScreenTestInput.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ScreenTestInput.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -p -r1.8 -r1.9 --- ScreenTestInput.cpp 8 Jul 2004 00:10:34 -0000 1.8 +++ ScreenTestInput.cpp 25 Jul 2004 04:27:19 -0000 1.9 @@ -11,7 +11,7 @@ #include "GameSoundManager.h" #include "ThemeManager.h" #include "RageDisplay.h" - +#include "GameDef.h" ScreenTestInput::ScreenTestInput( CString sClassName ) : ScreenWithMenuElements( sClassName ) Index: FontManager.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/FontManager.cpp,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -p -r1.46 -r1.47 --- FontManager.cpp 8 Jun 2004 01:20:03 -0000 1.46 +++ FontManager.cpp 25 Jul 2004 04:27:16 -0000 1.47 @@ -5,6 +5,7 @@ #include "RageLog.h" #include "RageException.h" #include <map> +#include "GameManager.h" FontManager* FONT = NULL; // global and accessable from anywhere in our program @@ -30,19 +31,21 @@ FontManager::~FontManager() /* A longchar is at least 32 bits. If c & 0xFF000000, it's a game-custom * character; game 0 is 0x0100nnnn, game 1 is 0x0200nnnn, and so on. */ -longchar FontManager::MakeGameGlyph(wchar_t c, Game g) +longchar FontManager::MakeGameGlyph(wchar_t c, const GameDef* g) { ASSERT(c >= 0 && c <= 0xFFFF); - ASSERT(g >= 0 && g <= 0xFF); - return longchar (((g+1) << 24) + c); + int index = GAMEMAN->GetIndexFromGame(g); + ASSERT(index >= 0 && index <= 0xFF); + return longchar (((index+1) << 24) + c); } -bool FontManager::ExtractGameGlyph(longchar ch, wchar_t &c, Game &g) +bool FontManager::ExtractGameGlyph(longchar ch, wchar_t &cOut, const GameDef *&gOut) { if((ch & 0xFF000000) == 0) return false; /* not a game glyph */ - g = Game((ch >> 24) - 1); - c = wchar_t(ch & 0xFFFF); + int index = (ch >> 24) - 1; + gOut = GAMEMAN->GetGameFromIndex( index ); + cOut = wchar_t(ch & 0xFFFF); return true; } Index: GameDef.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/GameDef.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -p -r1.33 -r1.34 --- GameDef.cpp 28 Jun 2004 07:25:51 -0000 1.33 +++ GameDef.cpp 25 Jul 2004 04:27:16 -0000 1.34 @@ -9,7 +9,7 @@ #include "InputMapper.h" #include "PrefsManager.h" -int GameDef::GetNumGameplayButtons() +int GameDef::GetNumGameplayButtons() const { int iIndexOfStart = ButtonNameToIndex( "Start" ); ASSERT( iIndexOfStart != GAME_BUTTON_INVALID ); Index: EditMenu.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/EditMenu.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -p -r1.27 -r1.28 --- EditMenu.cpp 12 Jul 2004 02:19:24 -0000 1.27 +++ EditMenu.cpp 25 Jul 2004 04:27:16 -0000 1.28 @@ -98,7 +98,7 @@ EditMenu::EditMenu() // fill in data structures SONGMAN->GetGroupNames( m_sGroups ); - GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_CurGame, m_StepsTypes ); + GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_pCurGame, m_StepsTypes ); ChangeToRow( (Row)0 ); OnRowValueChanged( (Row)0 ); Index: MusicWheel.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/MusicWheel.cpp,v retrieving revision 1.306 retrieving revision 1.307 diff -u -d -p -r1.306 -r1.307 --- MusicWheel.cpp 22 Jul 2004 02:47:21 -0000 1.306 +++ MusicWheel.cpp 25 Jul 2004 04:27:17 -0000 1.307 @@ -22,6 +22,7 @@ #include "SongUtil.h" #include "CourseUtil.h" #include "Foreach.h" +#include "Style.h" #define FADE_SECONDS THEME->GetMetricF("MusicWheel","FadeSeconds") Index: ScreenTestLights.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ScreenTestLights.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -p -r1.7 -r1.8 --- ScreenTestLights.cpp 8 Jul 2004 00:10:34 -0000 1.7 +++ ScreenTestLights.cpp 25 Jul 2004 04:27:19 -0000 1.8 @@ -12,6 +12,7 @@ #include "ThemeManager.h" #include "RageDisplay.h" #include "LightsManager.h" +#include "GameDef.h" ScreenTestLights::ScreenTestLights( CString sClassName ) : ScreenWithMenuElements( sClassName ) Index: Player.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/Player.cpp,v retrieving revision 1.365 retrieving revision 1.366 diff -u -d -p -r1.365 -r1.366 --- Player.cpp 24 Jul 2004 18:11:04 -0000 1.365 +++ Player.cpp 25 Jul 2004 04:27:18 -0000 1.366 @@ -24,6 +24,7 @@ #include "ScreenManager.h" #include "StageStats.h" #include "ArrowEffects.h" +#include "GameDef.h" CachedThemeMetricF GRAY_ARROWS_Y_STANDARD ("Player","ReceptorArrowsYStandard"); CachedThemeMetricF GRAY_ARROWS_Y_REVERSE ("Player","ReceptorArrowsYReverse"); Index: InputMapper.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/InputMapper.cpp,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -p -r1.61 -r1.62 --- InputMapper.cpp 7 Jul 2004 00:30:18 -0000 1.61 +++ InputMapper.cpp 25 Jul 2004 04:27:17 -0000 1.62 @@ -9,6 +9,8 @@ #include "PrefsManager.h" #include "RageInput.h" #include "arch/arch.h" +#include "GameDef.h" +#include "Style.h" InputMapper* INPUTMAPPER = NULL; // global and accessable from anywhere in our program @@ -41,7 +43,7 @@ void InputMapper::AddDefaultMappingsForC for( int j=0; j<MAX_GAME_BUTTONS; j++ ) ClearFromInputMap( GameInput((GameController)i,(GameButton)j), 2 ); - GameDef* pGameDef = GAMESTATE->GetCurrentGameDef(); + const GameDef* pGameDef = GAMESTATE->GetCurrentGameDef(); for( int c=0; c<MAX_GAME_CONTROLLERS; c++ ) { for( int b=0; b<pGameDef->m_iButtonsPerController; b++ ) @@ -59,7 +61,7 @@ void InputMapper::AddDefaultMappingsForC struct AutoJoyMapping { - Game game; + const char *szGame; const char *szDriverRegex; // reported by InputHandler const char *szControllerName; // the product name of the controller struct Mapping { @@ -83,7 +85,7 @@ struct AutoJoyMapping const AutoJoyMapping g_AutoJoyMappings[] = { { - GAME_DANCE, + "dance", "GIC USB Joystick", "Boom USB convertor (black/gray)", { @@ -95,7 +97,7 @@ const AutoJoyMapping g_AutoJoyMappings[] } }, { - GAME_DANCE, + "dance", "4 axis 16 button joystick", "PC Magic Box", { @@ -107,7 +109,7 @@ const AutoJoyMapping g_AutoJoyMappings[] } }, { - GAME_DANCE, + "dance", "GamePad Pro USB ", // yes, there is a space at the end "GamePad Pro USB", { @@ -127,7 +129,7 @@ const AutoJoyMapping g_AutoJoyMappings[] } }, { - GAME_DANCE, + "dance", "SideWinder Game Pad USB version 1.0", "SideWinder Game Pad USB", { @@ -147,7 +149,7 @@ const AutoJoyMapping g_AutoJoyMappings[] } }, { - GAME_DANCE, + "dance", "4 axis 12 button joystick with hat switch", "Super Joy Box 5", { @@ -169,7 +171,7 @@ const AutoJoyMapping g_AutoJoyMappings[] } }, { - GAME_DANCE, + "dance", "MP-8866 Dual USB Joypad", "Super Dual Box", { @@ -191,7 +193,7 @@ const AutoJoyMapping g_AutoJoyMappings[] } }, { - GAME_DANCE, + "dance", "NTPAD", "NTPAD", { @@ -213,7 +215,7 @@ const AutoJoyMapping g_AutoJoyMappings[] } }, { - GAME_DANCE, + "dance", "Psx Gamepad", "PSXPAD", { @@ -235,7 +237,7 @@ const AutoJoyMapping g_AutoJoyMappings[] } }, { - GAME_DANCE, + "dance", "XBOX Gamepad Plugin V0.01", "X-Box gamepad", { @@ -255,7 +257,7 @@ const AutoJoyMapping g_AutoJoyMappings[] } }, { - GAME_DANCE, + "dance", "0b43:0003", // The EMS USB2 doesn't provide a model string, so Linux // just gives us the VendorID and ModelID in hex. "EMS USB2", @@ -280,7 +282,7 @@ const AutoJoyMapping g_AutoJoyMappings[] } }, { - GAME_PUMP, + "pump", "Pump USB", "Pump USB pad", { @@ -308,6 +310,8 @@ void InputMapper::AutoMapJoysticksForCur int iNumJoysticksMapped = 0; + const GameDef* pGameDef = GAMESTATE->m_pCurGame; + for( unsigned i=0; i<vDevices.size(); i++ ) { InputDevice device = vDevices[i]; @@ -316,42 +320,45 @@ void InputMapper::AutoMapJoysticksForCur { const AutoJoyMapping& mapping = g_AutoJoyMappings[j]; + if( pGameDef != GAMESTATE->GetGameDefFromString(mapping.szGame) ) + continue; // games don't match + CString sDriverRegex = mapping.szDriverRegex; Regex regex( sDriverRegex ); - if( regex.Compare(sDescription) ) - { - // - // We have a mapping for this joystick - // - GameController gc = (GameController)iNumJoysticksMapped; - if( gc >= GAME_CONTROLLER_INVALID ) - break; // stop mapping. We already mapped one device for each game controller. + if( !regex.Compare(sDescription) ) + continue; // driver names don't match - LOG->Info( "Applying default joystick mapping #%d for device '%s' (%s)", - iNumJoysticksMapped+1, mapping.szDriverRegex, mapping.szControllerName ); + // + // We have a mapping for this joystick + // + GameController gc = (GameController)iNumJoysticksMapped; + if( gc >= GAME_CONTROLLER_INVALID ) + break; // stop mapping. We already mapped one device for each game controller. - for( int k=0; !mapping.maps[k].IsEndMarker(); k++ ) - { - GameController map_gc = gc; - if( mapping.maps[k].SecondController ) - { - map_gc = (GameController)(map_gc+1); + LOG->Info( "Applying default joystick mapping #%d for device '%s' (%s)", + iNumJoysticksMapped+1, mapping.szDriverRegex, mapping.szControllerName ); - /* If that pushed it over, then it's a second controller for - * a joystick that's already a second controller, so we'll - * just ignore it. (This can happen if eg. two primary - * Pump pads are connected.) */ - if( map_gc >= GAME_CONTROLLER_INVALID ) - continue; - } + for( int k=0; !mapping.maps[k].IsEndMarker(); k++ ) + { + GameController map_gc = gc; + if( mapping.maps[k].SecondController ) + { + map_gc = (GameController)(map_gc+1); - DeviceInput di( device, mapping.maps[k].deviceButton ); - GameInput gi( map_gc, mapping.maps[k].gb ); - SetInputMap( di, gi, mapping.maps[k].iSlotIndex ); + /* If that pushed it over, then it's a second controller for + * a joystick that's already a second controller, so we'll + * just ignore it. (This can happen if eg. two primary + * Pump pads are connected.) */ + if( map_gc >= GAME_CONTROLLER_INVALID ) + continue; } - iNumJoysticksMapped++; + DeviceInput di( device, mapping.maps[k].deviceButton ); + GameInput gi( map_gc, mapping.maps[k].gb ); + SetInputMap( di, gi, mapping.maps[k].iSlotIndex ); } + + iNumJoysticksMapped++; } } } Index: StyleUtil.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/StyleUtil.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- StyleUtil.cpp 17 Jul 2004 21:49:32 -0000 1.1 +++ StyleUtil.cpp 25 Jul 2004 04:27:20 -0000 1.2 @@ -2,13 +2,14 @@ #include "StyleUtil.h" #include "GameManager.h" #include "XmlFile.h" +#include "GameDef.h" void StyleID::FromStyle( const Style *p ) { if( p ) { - sGame = GAMEMAN->GetGameDefForGame(p->m_Game)->m_szName; + sGame = p->m_pGameDef->m_szName; sStyle = p->m_szName; } else @@ -20,11 +21,11 @@ void StyleID::FromStyle( const Style *p const Style *StyleID::ToStyle() const { - Game game = GameManager::StringToGameType( sGame ); - if( game == GAME_INVALID ) + const GameDef* pGame = GameManager::StringToGameType( sGame ); + if( pGame == NULL ) return NULL; - return GAMEMAN->GameAndStringToStyle( game, sStyle ); + return GAMEMAN->GameAndStringToStyle( pGame, sStyle ); } XNode* StyleID::CreateNode() const Index: ScreenDemonstration.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ScreenDemonstration.cpp,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -p -r1.64 -r1.65 --- ScreenDemonstration.cpp 8 Jul 2004 00:10:31 -0000 1.64 +++ ScreenDemonstration.cpp 25 Jul 2004 04:27:18 -0000 1.65 @@ -20,7 +20,7 @@ const ScreenMessage SM_NotesEnded = S bool PrepareForDemonstration() // always return true. { - GAMESTATE->m_pCurStyle = GAMEMAN->GetDemonstrationStyleForGame(GAMESTATE->m_CurGame); + GAMESTATE->m_pCurStyle = GAMEMAN->GetDemonstrationStyleForGame(GAMESTATE->m_pCurGame); GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR; Index: GameManager.h =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/GameManager.h,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -p -r1.37 -r1.38 --- GameManager.h 12 Jul 2004 02:19:24 -0000 1.37 +++ GameManager.h 25 Jul 2004 04:27:16 -0000 1.38 @@ -3,11 +3,11 @@ #ifndef GAMEMANAGER_H #define GAMEMANAGER_H -#include "GameDef.h" -#include "Style.h" -#include "Game.h" class IniFile; +class Style; +class GameDef; +#include "GameConstantsAndTypes.h" class GameManager { @@ -15,24 +15,25 @@ public: GameManager(); ~GameManager(); - GameDef* GetGameDefForGame( Game g ); - - void GetStylesForGame( Game game, vector<const Style*>& aStylesAddTo, bool editor=false ); + void GetStylesForGame( const GameDef* pGame, vector<const Style*>& aStylesAddTo, bool editor=false ); void GetAllStyles( vector<const Style*>& aStylesAddTo, bool editor=false ); - void GetStepsTypesForGame( Game game, vector<StepsType>& aStepsTypeAddTo ); + void GetStepsTypesForGame( const GameDef* pGame, vector<StepsType>& aStepsTypeAddTo ); const Style* GetEditorStyleForStepsType( StepsType st ); - const Style* GetDemonstrationStyleForGame( Game game ); - const Style* GetHowToPlayStyleForGame( Game game ); + const Style* GetDemonstrationStyleForGame( const GameDef* pGame ); + const Style* GetHowToPlayStyleForGame( const GameDef* pGame ); - void GetEnabledGames( vector<Game>& aGamesOut ); - bool IsGameEnabled( Game game ); + void GetEnabledGames( vector<const GameDef*>& aGamesOut ); + const GameDef* GetDefaultGame(); + bool IsGameEnabled( const GameDef* pGame ); + int GetIndexFromGame( const GameDef* pGame ); + const GameDef* GetGameFromIndex( int index ); static int StepsTypeToNumTracks( StepsType st ); static StepsType StringToStepsType( CString sStepsType ); static CString StepsTypeToString( StepsType st ); static CString StepsTypeToThemedString( StepsType st ); - static Game StringToGameType( CString sGameType ); - const Style* GameAndStringToStyle( Game game, CString sStyle ); + static const GameDef* StringToGameType( CString sGameType ); + const Style* GameAndStringToStyle( const GameDef* pGame, CString sStyle ); static CString StyleToThemedString( const Style* s ); }; Index: ConditionalBGA.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ConditionalBGA.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -p -r1.11 -r1.12 --- ConditionalBGA.cpp 28 Jun 2004 07:25:51 -0000 1.11 +++ ConditionalBGA.cpp 25 Jul 2004 04:27:15 -0000 1.12 @@ -250,7 +250,7 @@ void ConditionalBGA::Load(CString szScre { LOG->Info( "Style:%s", asStyles[d].c_str() ); - m_bgainfo[bgano].styles.push_back(GAMEMAN->GameAndStringToStyle(GAMESTATE->m_CurGame,asStyles[d])); + m_bgainfo[bgano].styles.push_back(GAMEMAN->GameAndStringToStyle(GAMESTATE->m_pCurGame,asStyles[d])); } } Index: ScreenRanking.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ScreenRanking.cpp,v retrieving revision 1.89 retrieving revision 1.90 diff -u -d -p -r1.89 -r1.90 --- ScreenRanking.cpp 12 Jul 2004 02:19:24 -0000 1.89 +++ ScreenRanking.cpp 25 Jul 2004 04:27:19 -0000 1.90 @@ -265,7 +265,7 @@ ScreenRanking::ScreenRanking( CString sC // calculate which StepsTypes to show vector<StepsType> aStepsTypesToShow; { - GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_CurGame, aStepsTypesToShow ); + GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_pCurGame, aStepsTypesToShow ); // subtract hidden StepsTypes { Index: FontManager.h =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/FontManager.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -p -r1.23 -r1.24 --- FontManager.h 8 Jun 2004 01:20:03 -0000 1.23 +++ FontManager.h 25 Jul 2004 04:27:16 -0000 1.24 @@ -4,9 +4,9 @@ #define FONTMANAGER_H #include "RageUtil.h" -#include "Game.h" class Font; +class GameDef; class FontManager { @@ -24,8 +24,8 @@ public: * adjustment of fonts in ScreenTestFonts at the moment. */ void ReloadFonts(); - static longchar MakeGameGlyph(wchar_t c, Game g); - static bool ExtractGameGlyph(longchar ch, wchar_t &c, Game &g); + static longchar MakeGameGlyph(wchar_t c, const GameDef* g); + static bool ExtractGameGlyph(longchar ch, wchar_t &c, const GameDef*& g); }; extern FontManager* FONT; // global and accessable from anywhere in our program Index: GameState.h =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/GameState.h,v retrieving revision 1.150 retrieving revision 1.151 diff -u -d -p -r1.150 -r1.151 --- GameState.h 11 Jul 2004 01:58:55 -0000 1.150 +++ GameState.h 25 Jul 2004 04:27:17 -0000 1.151 @@ -6,7 +6,6 @@ #include "GameConstantsAndTypes.h" #include "PlayerOptions.h" #include "SongOptions.h" -#include "Game.h" #include "Grade.h" #include "Attack.h" #include "RageTimer.h" @@ -25,6 +24,7 @@ class NoteFieldPositioning; class Character; class TimingData; struct StageStats; +class GameDef; class Style; class GameState @@ -46,7 +46,7 @@ public: // // Main state info // - Game m_CurGame; + const GameDef* m_pCurGame; const Style* m_pCurStyle; bool m_bSideIsJoined[NUM_PLAYERS]; // left side, right side bool m_bPlayersFinalized; @@ -72,7 +72,7 @@ public: bool EnoughCreditsToJoin() const; // true if an unjoined player can join by pressint start int GetNumSidesJoined() const; - GameDef* GetCurrentGameDef(); + const GameDef* GetCurrentGameDef(); const Style* GetCurrentStyle() const; void GetPlayerInfo( PlayerNumber pn, bool& bIsEnabledOut, bool& bIsHumanOut ); Index: ScreenStyleSplash.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ScreenStyleSplash.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -p -r1.19 -r1.20 --- ScreenStyleSplash.cpp 8 Jul 2004 00:10:34 -0000 1.19 +++ ScreenStyleSplash.cpp 25 Jul 2004 04:27:19 -0000 1.20 @@ -8,6 +8,8 @@ #include "GameState.h" #include "GameManager.h" #include "RageLog.h" +#include "GameDef.h" +#include "Style.h" #define NEXT_SCREEN THEME->GetMetric("ScreenStyleSplash","NextScreen") #define NONSTOP_SCREEN THEME->GetMetric("ScreenStyleSplash","NonstopScreen") Index: ScreenMapControllers.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ScreenMapControllers.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -p -r1.41 -r1.42 --- ScreenMapControllers.cpp 8 Jul 2004 00:10:32 -0000 1.41 +++ ScreenMapControllers.cpp 25 Jul 2004 04:27:19 -0000 1.42 @@ -11,6 +11,7 @@ #include "GameSoundManager.h" #include "ThemeManager.h" #include "RageDisplay.h" +#include "GameDef.h" #define EVEN_LINE_IN THEME->GetMetric("ScreenMapControllers","EvenLineIn") Index: ModeSwitcher.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ModeSwitcher.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -p -r1.7 -r1.8 --- ModeSwitcher.cpp 28 Jun 2004 07:25:52 -0000 1.7 +++ ModeSwitcher.cpp 25 Jul 2004 04:27:17 -0000 1.8 @@ -9,6 +9,7 @@ #include "song.h" #include "ActorUtil.h" #include "GameManager.h" +#include "GameDef.h" #define PREVMODE_X THEME->GetMetricF("ModeSwitcher","PrevModeX") #define PREVMODE_Y THEME->GetMetricF("ModeSwitcher","PrevModeY") @@ -75,7 +76,7 @@ CString ModeSwitcher::GetStyleName() case DIFFICULTY_BEGINNER: sDiff[i] = "Beginner\n"; break; case DIFFICULTY_EASY: { - if(GAMESTATE->m_CurGame == GAME_PUMP) + if(GAMESTATE->m_pCurGame->m_szName == CString("pump")) { sDiff[i] = "Normal\n"; break; } @@ -86,7 +87,7 @@ CString ModeSwitcher::GetStyleName() } case DIFFICULTY_MEDIUM: { - if(GAMESTATE->m_CurGame == GAME_PUMP) + if(GAMESTATE->m_pCurGame->m_szName == CString("pump")) { sDiff[i] = "Hard\n"; break; } @@ -97,7 +98,7 @@ CString ModeSwitcher::GetStyleName() } case DIFFICULTY_HARD: { - if(GAMESTATE->m_CurGame == GAME_PUMP) + if(GAMESTATE->m_pCurGame->m_szName == CString("pump")) { sDiff[i] = "Crazy\n"; break; } @@ -138,7 +139,7 @@ CString ModeSwitcher::GetNextStyleName() { case DIFFICULTY_BEGINNER: { - if(GAMESTATE->m_CurGame == GAME_PUMP) + if(GAMESTATE->m_pCurGame->m_szName == CString("pump")) { sDiff[i] = "Normal\n"; break; } @@ -149,7 +150,7 @@ CString ModeSwitcher::GetNextStyleName() } case DIFFICULTY_EASY: { - if(GAMESTATE->m_CurGame == GAME_PUMP) + if(GAMESTATE->m_pCurGame->m_szName == CString("pump")) { sDiff[i] = "Hard\n"; break; } @@ -160,7 +161,7 @@ CString ModeSwitcher::GetNextStyleName() } case DIFFICULTY_MEDIUM: { - if(GAMESTATE->m_CurGame == GAME_PUMP) + if(GAMESTATE->m_pCurGame->m_szName == CString("pump")) { sDiff[i] = "Crazy\n"; break; } @@ -211,7 +212,7 @@ CString ModeSwitcher::GetPrevStyleName() { case DIFFICULTY_CHALLENGE: { - if(GAMESTATE->m_CurGame == GAME_PUMP) + if(GAMESTATE->m_pCurGame->m_szName == CString("pump")) { sDiff[i] = "Crazy\n"; break; } @@ -223,7 +224,7 @@ CString ModeSwitcher::GetPrevStyleName() case DIFFICULTY_EASY: sDiff[i] = "Beginner\n"; break; case DIFFICULTY_MEDIUM: { - if(GAMESTATE->m_CurGame == GAME_PUMP) + if(GAMESTATE->m_pCurGame->m_szName == CString("pump")) { sDiff[i] = "Normal\n"; break; } @@ -234,7 +235,7 @@ CString ModeSwitcher::GetPrevStyleName() } case DIFFICULTY_HARD: { - if(GAMESTATE->m_CurGame == GAME_PUMP) + if(GAMESTATE->m_pCurGame->m_szName == CString("pump")) { sDiff[i] = "Hard\n"; break; } @@ -268,7 +269,7 @@ CString ModeSwitcher::GetPrevStyleName() void ModeSwitcher::ChangeMode(PlayerNumber pn, int dir) { - if(GAMESTATE->m_CurGame == GAME_PUMP) + if(GAMESTATE->m_pCurGame->m_szName == CString("pump")) { if(GAMESTATE->IsPlayerEnabled(pn)) { @@ -297,7 +298,7 @@ void ModeSwitcher::ChangeMode(PlayerNumb // Make a list of all styles for the current Game. vector<const Style*> vPossibleStyles; - GAMEMAN->GetStylesForGame( GAMESTATE->m_CurGame, vPossibleStyles ); + GAMEMAN->GetStylesForGame( GAMESTATE->m_pCurGame, vPossibleStyles ); ASSERT( !vPossibleStyles.empty() ); int index = 0; Index: GameDef.h =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/GameDef.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -p -r1.26 -r1.27 --- GameDef.h 28 Jun 2004 07:25:51 -0000 1.26 +++ GameDef.h 25 Jul 2004 04:27:16 -0000 1.27 @@ -38,11 +38,12 @@ class Style; class GameDef { public: - char m_szName[60]; - char m_szDescription[60]; + const char *m_szName; + const char *m_szDescription; + int m_iNumControllers; int m_iButtonsPerController; - int GetNumGameplayButtons(); + int GetNumGameplayButtons() const; char m_szButtonNames[MAX_GAME_BUTTONS][60]; // The name used by the button graphics system. e.g. "left", "right", "middle C", "snare" char m_szSecondaryFunction[MAX_GAME_BUTTONS][60]; // displayed on the mapping screen GameButton m_DedicatedMenuButton[NUM_MENU_BUTTONS]; Index: ScreenNameEntryTraditional.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ScreenNameEntryTraditional.cpp,v retrieving revision 1.73 retrieving revision 1.74 diff -u -d -p -r1.73 -r1.74 --- ScreenNameEntryTraditional.cpp 8 Jul 2004 00:10:32 -0000 1.73 +++ ScreenNameEntryTraditional.cpp 25 Jul 2004 04:27:19 -0000 1.74 @@ -131,7 +131,7 @@ ScreenNameEntryTraditional::ScreenNameEn GAMESTATE->m_bSideIsJoined[PLAYER_2] = true; GAMESTATE->m_MasterPlayerNumber = PLAYER_1; GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR; - GAMESTATE->m_pCurStyle = GAMEMAN->GameAndStringToStyle( GAME_DANCE, "versus" ); + GAMESTATE->m_pCurStyle = GAMEMAN->GameAndStringToStyle( GAMEMAN->GetDefaultGame(), "versus" ); StageStats ss; for( int z = 0; z < 3; ++z ) { Index: ScreenHowToPlay.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ScreenHowToPlay.cpp,v retrieving revision 1.97 retrieving revision 1.98 diff -u -d -p -r1.97 -r1.98 --- ScreenHowToPlay.cpp 12 Jul 2004 22:57:37 -0000 1.97 +++ ScreenHowToPlay.cpp 25 Jul 2004 04:27:18 -0000 1.98 @@ -130,7 +130,7 @@ ScreenHowToPlay::ScreenHowToPlay( CStrin m_pLifeMeterBar->FillForHowToPlay( NUM_PERFECTS, NUM_MISSES ); } - GAMESTATE->m_pCurStyle = GAMEMAN->GetHowToPlayStyleForGame(GAMESTATE->m_CurGame); + GAMESTATE->m_pCurStyle = GAMEMAN->GetHowToPlayStyleForGame(GAMESTATE->m_pCurGame); if( USEPLAYER ) { Index: Font.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/Font.cpp,v retrieving revision 1.98 retrieving revision 1.99 diff -u -d -p -r1.98 -r1.99 --- Font.cpp 24 Jul 2004 23:00:27 -0000 1.98 +++ Font.cpp 25 Jul 2004 04:27:16 -0000 1.99 @@ -276,7 +276,7 @@ const glyph &Font::GetGlyph( wchar_t c ) ASSERT(c >= 0 && c <= 0xFFFFFF); /* See if there's a game-specific version of this character. */ - int gc = FontManager::MakeGameGlyph(c, GAMESTATE->m_CurGame); + int gc = FontManager::MakeGameGlyph(c, GAMESTATE->m_pCurGame); map<longchar,glyph*>::const_iterator it = m_iCharToGlyph.find(gc); /* If there isn't, try the regular character. */ @@ -509,7 +509,7 @@ void Font::LoadFontPageSettings(FontPage */ CString codepoint = val.substr(4); /* "CODEPOINT" */ - Game game = GAME_INVALID; + const GameDef* pGame = NULL; if(codepoint.find_first_of(' ') != codepoint.npos) { @@ -518,9 +518,9 @@ void Font::LoadFontPageSettings(FontPage CString gamename = codepoint.substr(0, pos); codepoint = codepoint.substr(pos+1); - game = GameManager::StringToGameType(gamename); + pGame = GameManager::StringToGameType(gamename); - if(game == GAME_INVALID) + if(pGame == NULL) { LOG->Warn( "Font definition '%s' uses unknown game type '%s'", ini.GetPath().c_str(), gamename.c_str() ); @@ -546,9 +546,9 @@ void Font::LoadFontPageSettings(FontPage continue; } - if(game != GAME_INVALID) + if(pGame != NULL) { - longchar lc = FontManager::MakeGameGlyph(c, game); + longchar lc = FontManager::MakeGameGlyph(c, pGame); cfg.CharToGlyphNo[lc] = atoi(data); } else { cfg.CharToGlyphNo[c] = atoi(data); Index: CatalogXml.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/CatalogXml.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -p -r1.19 -r1.20 --- CatalogXml.cpp 19 Jul 2004 08:04:28 -0000 1.19 +++ CatalogXml.cpp 25 Jul 2004 04:27:15 -0000 1.20 @@ -136,7 +136,7 @@ void SaveCatalogXml() { vector<StepsType> vStepsTypes; - GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_CurGame, vStepsTypes ); + GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_pCurGame, vStepsTypes ); for( vector<StepsType>::const_iterator iter = vStepsTypes.begin(); iter != vStepsTypes.end(); iter++ ) { XNode* pNode2 = pNode->AppendChild( "StepsType", GAMEMAN->StepsTypeToString(*iter) ); @@ -156,7 +156,7 @@ void SaveCatalogXml() { vector<const Style*> vpStyle; - GAMEMAN->GetStylesForGame( GAMESTATE->m_CurGame, vpStyle ); + GAMEMAN->GetStylesForGame( GAMESTATE->m_pCurGame, vpStyle ); FOREACH( const Style*, vpStyle, pStyle ) { if( !SHOW_STYLE(*pStyle) ) Index: ScreenNameEntry.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ScreenNameEntry.cpp,v retrieving revision 1.70 retrieving revision 1.71 diff -u -d -p -r1.70 -r1.71 --- ScreenNameEntry.cpp 8 Jul 2004 00:10:32 -0000 1.70 +++ ScreenNameEntry.cpp 25 Jul 2004 04:27:19 -0000 1.71 @@ -16,6 +16,7 @@ #include "ProfileManager.h" #include "NoteFieldPositioning.h" #include "StageStats.h" +#include "GameDef.h" // Index: NoteSkinManager.h =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/NoteSkinManager.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -p -r1.17 -r1.18 --- NoteSkinManager.h 8 Jun 2004 01:20:03 -0000 1.17 +++ NoteSkinManager.h 25 Jul 2004 04:27:18 -0000 1.18 @@ -2,11 +2,11 @@ #define NoteSkinMANAGER_H #include "RageTypes.h" -#include "Game.h" #include "PlayerNumber.h" #include "IniFile.h" #include <map> +class GameDef; class NoteSkinManager { @@ -14,10 +14,10 @@ public: NoteSkinManager(); ~NoteSkinManager(); - void RefreshNoteSkinData( Game game ); - void GetNoteSkinNames( Game game, CStringArray &AddTo ); - void GetNoteSkinNames( CStringArray &AddTo ); // looks up current Game in GAMESTATE - bool DoesNoteSkinExist( CString sSkinName ); // looks up current Game in GAMESTATE + void RefreshNoteSkinData( const GameDef* game ); + void GetNoteSkinNames( const GameDef* game, CStringArray &AddTo ); + void GetNoteSkinNames( CStringArray &AddTo ); // looks up current const GameDef* in GAMESTATE + bool DoesNoteSkinExist( CString sSkinName ); // looks up current const GameDef* in GAMESTATE CString GetPathToFromPlayerAndCol( PlayerNumber pn, int col, CString sElement, bool bOptional=false ); CString GetPathToFromNoteSkinAndButton( CString NoteSkin, CString sButtonName, CString sElement, bool bOptional=false ); @@ -43,7 +43,7 @@ protected: }; void LoadNoteSkinData( CString sNoteSkinName, NoteSkinData& data_out ); map<CString,NoteSkinData> m_mapNameToData; - Game m_CurGame; + const GameDef* m_pCurGame; }; Index: ScreenEnding.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ScreenEnding.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -p -r1.25 -r1.26 --- ScreenEnding.cpp 24 Jul 2004 18:11:04 -0000 1.25 +++ ScreenEnding.cpp 25 Jul 2004 04:27:18 -0000 1.26 @@ -102,7 +102,7 @@ ScreenEnding::ScreenEnding( CString sCla PROFILEMAN->LoadFirstAvailableProfile(PLAYER_2, false); GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR; - GAMESTATE->m_pCurStyle = GAMEMAN->GameAndStringToStyle( GAME_DANCE, "versus" ); + GAMESTATE->m_pCurStyle = GAMEMAN->GameAndStringToStyle( GAMEMAN->GetDefaultGame(), "versus" ); GAMESTATE->m_bSideIsJoined[PLAYER_1] = true; GAMESTATE->m_bSideIsJoined[PLAYER_2] = true; GAMESTATE->m_MasterPlayerNumber = PLAYER_1; --- Game.h DELETED --- Index: ModeChoice.h =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ModeChoice.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -p -r1.23 -r1.24 --- ModeChoice.h 28 Jun 2004 07:25:52 -0000 1.23 +++ ModeChoice.h 25 Jul 2004 04:27:17 -0000 1.24 @@ -3,7 +3,6 @@ #ifndef MODECHOICE_H #define MODECHOICE_H -#include "Game.h" #include "GameConstantsAndTypes.h" #include "PlayerNumber.h" #include <map> @@ -14,6 +13,7 @@ class Course; class Trail; class Character; class Style; +class GameDef; struct ModeChoice // used in SelectMode { @@ -32,7 +32,7 @@ struct ModeChoice // used in SelectMode bool m_bInvalid; CString m_sInvalidReason; int m_iIndex; - Game m_game; + const GameDef* m_pGameDef; const Style* m_pStyle; PlayMode m_pm; Difficulty m_dc; Index: ScreenLogo.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ScreenLogo.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -p -r1.17 -r1.18 --- ScreenLogo.cpp 19 Jun 2004 02:21:37 -0000 1.17 +++ ScreenLogo.cpp 25 Jul 2004 04:27:19 -0000 1.18 @@ -8,7 +8,7 @@ ScreenLogo::ScreenLogo( CString sName ) : ScreenAttract( sName ) { m_sprLogo.SetName( "Logo" ); - m_sprLogo.Load( THEME->GetPathToG(ssprintf("ScreenLogo %s",GAMESTATE->GetCurrentGameDef()->m_szName)) ); + m_sprLogo.Load( THEME->GetPathG("ScreenLogo",GAMESTATE->GetCurrentGameDef()->m_szName) ); ON_COMMAND( m_sprLogo ); this->AddChild( &m_sprLogo ); Index: NoteSkinManager.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/NoteSkinManager.cpp,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -p -r1.50 -r1.51 --- NoteSkinManager.cpp 28 Jun 2004 07:25:52 -0000 1.50 +++ NoteSkinManager.cpp 25 Jul 2004 04:27:18 -0000 1.51 @@ -24,20 +24,20 @@ static map<CString,CString> g_PathCache; NoteSkinManager::NoteSkinManager() { - m_CurGame = GAME_INVALID; + m_pCurGame = NULL; } NoteSkinManager::~NoteSkinManager() { } -void NoteSkinManager::RefreshNoteSkinData( Game game ) +void NoteSkinManager::RefreshNoteSkinData( const GameDef* game ) { /* Reload even if we don't need to, so exiting out of the menus refreshes the note * skin list (so you don't have to restart to see new noteskins). */ - m_CurGame = GAMESTATE->m_CurGame; + m_pCurGame = GAMESTATE->m_pCurGame; - GameDef* pGameDef = GAMEMAN->GetGameDefForGame( game ); + const GameDef* pGameDef = game; // clear path cache g_PathCache.clear(); @@ -80,8 +80,8 @@ void NoteSkinManager::LoadNoteSkinData( void NoteSkinManager::GetNoteSkinNames( CStringArray &AddTo ) { /* If the skin data for the current game isn't already load it, load it now. */ - if( m_CurGame != GAMESTATE->m_CurGame ) - RefreshNoteSkinData( GAMESTATE->m_CurGame ); + if( m_pCurGame != GAMESTATE->m_pCurGame ) + RefreshNoteSkinData( GAMESTATE->m_pCurGame ); /* Don't call GetNoteSkinNames below, since we don't want to call RefreshNoteSkinData; it's * slow. */ @@ -103,7 +103,7 @@ void NoteSkinManager::GetNoteSkinNames( } } -void NoteSkinManager::GetNoteSkinNames( Game game, CStringArray &AddTo ) +void NoteSkinManager::GetNoteSkinNames( const GameDef* game, CStringArray &AddTo ) { RefreshNoteSkinData( game ); @@ -114,7 +114,7 @@ void NoteSkinManager::GetNoteSkinNames( } /* Put the note skins back. */ - RefreshNoteSkinData( GAMESTATE->m_CurGame ); + RefreshNoteSkinData( GAMESTATE->m_pCurGame ); } Index: SnapDisplay.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/SnapDisplay.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -p -r1.21 -r1.22 --- SnapDisplay.cpp 28 Jun 2004 07:25:58 -0000 1.21 +++ SnapDisplay.cpp 25 Jul 2004 04:27:20 -0000 1.22 @@ -3,6 +3,7 @@ #include "GameManager.h" #include "GameState.h" #include "ThemeManager.h" +#include "Style.h" SnapDisplay::SnapDisplay() Index: Style.h =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/Style.h,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -p -r1.34 -r1.35 --- Style.h 12 Jul 2004 02:19:24 -0000 1.34 +++ Style.h 25 Jul 2004 04:27:20 -0000 1.35 @@ -5,7 +5,6 @@ #include "StyleInput.h" #include "GameInput.h" -#include "Game.h" #include "NoteTypes.h" #include "PlayerNumber.h" #include "GameConstantsAndTypes.h" @@ -14,18 +13,19 @@ const int MAX_COLS_PER_PLAYER = MAX_NOTE_TRACKS; class NoteData; +class GameDef; class Style { public: - Game m_Game; // Which Game is this Style used with? - bool m_bUsedForGameplay; // Can be used only for gameplay? - bool m_bUsedForEdit; // Can be used for editing? - bool m_bUsedForDemonstration; // Can be used for editing? - bool m_bUsedForHowToPlay; // Can be used for editing? + const GameDef* m_pGameDef; // Which Game is this Style used with? + bool m_bUsedForGameplay; // Can be used only for gameplay? + bool m_bUsedForEdit; // Can be used for editing? + bool m_bUsedForDemonstration; // Can be used for demonstration? + bool m_bUsedForHowToPlay; // Can be used for HowToPlay? /* The name of the style. (This is currently unused.) */ - char m_szName[60]; + const char *m_szName; /* Steps format used for each player. For example, "dance versus" reads * the Steps with the tag "dance-single". */ Index: StepMania.h =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/StepMania.h,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -p -r1.38 -r1.39 --- StepMania.h 20 Jul 2004 15:50:01 -0000 1.38 +++ StepMania.h 25 Jul 2004 04:27:20 -0000 1.39 @@ -1,7 +1,7 @@ #ifndef STEPMANIA_H #define STEPMANIA_H -#include "Game.h" +class GameDef; #ifdef _XBOX #include "Xbox Compilance\stdafx.h" @@ -15,7 +15,7 @@ void ExitGame(); void ResetGame( bool ReturnToFirstScreen=true ); void ReadGamePrefsFromDisk( bool bSwitchToLastPlayedGame=true ); void SaveGamePrefsToDisk(); -void ChangeCurrentGame( Game g ); +void ChangeCurrentGame( const GameDef* g ); void FocusChanged( bool bHasFocus ); // If successful, return filename of screenshot in sDir, else return "" Index: StepMania.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/StepMania.cpp,v retrieving revision 1.487 retrieving revision 1.488 diff -u -d -p -r1.487 -r1.488 --- StepMania.cpp 21 Jul 2004 23:09:23 -0000 1.487 +++ StepMania.cpp 25 Jul 2004 04:27:20 -0000 1.488 @@ -29,6 +29,7 @@ #include "Screen.h" #include "CodeDetector.h" #include "CommonMetrics.h" +#include "GameDef.h" // // StepMania global classes @@ -187,7 +188,7 @@ void ResetGame( bool ReturnToFirstScreen ReadGamePrefsFromDisk(); INPUTMAPPER->ReadMappingsFromDisk(); - NOTESKIN->RefreshNoteSkinData( GAMESTATE->m_CurGame ); + NOTESKIN->RefreshNoteSkinData( GAMESTATE->m_pCurGame ); /* GameState::Reset() will switch the NoteSkin @@ -689,14 +690,14 @@ static void RestoreAppPri() #define GAMEPREFS_INI_PATH "Data/GamePrefs.ini" #define STATIC_INI_PATH "Data/Static.ini" -void ChangeCurrentGame( Game g ) +void ChangeCurrentGame( const GameDef* g ) { - ASSERT( g >= 0 && g < NUM_GAMES ); + ASSERT( g ); SaveGamePrefsToDisk(); INPUTMAPPER->SaveMappingsToDisk(); // save mappings before switching the game - GAMESTATE->m_CurGame = g; + GAMESTATE->m_pCurGame = g; ReadGamePrefsFromDisk( false ); INPUTMAPPER->ReadMappingsFromDisk(); @@ -710,8 +711,12 @@ void ReadGamePrefsFromDisk( bool bSwitch ASSERT( GAMESTATE ); ASSERT( ANNOUNCER ); ASSERT( THEME ); + ASSERT( GAMESTATE ); + if( GAMESTATE->m_pCurGame == NULL ) + GAMESTATE->m_pCurGame = GAMEMAN->GetDefaultGame(); CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; + IniFile ini; ini.ReadFile( GAMEPREFS_INI_PATH ); // it's OK if this fails ini.ReadFile( STATIC_INI_PATH ); // it's OK if this fails, too @@ -734,9 +739,9 @@ void ReadGamePrefsFromDisk( bool bSwitch CString sGame; if( ini.GetValue("Options", "Game", sGame) ) { - GAMESTATE->m_CurGame = GAMEMAN->StringToGameType( sGame ); - if( GAMESTATE->m_CurGame == GAME_INVALID ) - GAMESTATE->m_CurGame = (Game)0; + GAMESTATE->m_pCurGame = GAMEMAN->StringToGameType( sGame ); + if( GAMESTATE->m_pCurGame == NULL ) + GAMESTATE->m_pCurGame = GAMEMAN->GetDefaultGame(); } } } @@ -1302,7 +1307,7 @@ bool HandleGlobalInputs( DeviceInput Dev THEME->ReloadMetrics(); TEXTUREMAN->ReloadAll(); SCREENMAN->ReloadCreditsText(); - NOTESKIN->RefreshNoteSkinData( GAMESTATE->m_CurGame ); + NOTESKIN->RefreshNoteSkinData( GAMESTATE->m_pCurGame ); CodeDetector::RefreshCacheItems(); Index: ScreenTitleMenu.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ScreenTitleMenu.cpp,v retrieving revision 1.168 retrieving revision 1.169 diff -u -d -p -r1.168 -r1.169 --- ScreenTitleMenu.cpp 17 Jul 2004 22:15:39 -0000 1.168 +++ ScreenTitleMenu.cpp 25 Jul 2004 04:27:19 -0000 1.169 @@ -21,6 +21,7 @@ #include "LightsManager.h" #include "CodeDetector.h" #include "CommonMetrics.h" +#include "GameDef.h" #define LOGO_ON_COMMAND THEME->GetMetric("ScreenTitleMenu","LogoOnCommand") @@ -73,7 +74,7 @@ ScreenTitleMenu::ScreenTitleMenu( CStrin LIGHTSMAN->SetLightsMode( LIGHTSMODE_JOINING ); // do this after Reset! - m_sprLogo.Load( THEME->GetPathToG(ssprintf("ScreenLogo %s",GAMESTATE->GetCurrentGameDef()->m_szName)) ); + m_sprLogo.Load( THEME->GetPathG("ScreenLogo",GAMESTATE->GetCurrentGameDef()->m_szName) ); m_sprLogo.Command( PREFSMAN->GetCoinMode()==COIN_HOME ? LOGO_HOME_ON_COMMAND : LOGO_ON_COMMAND ); this->AddChild( &m_sprLogo ); @@ -287,19 +288,24 @@ void ScreenTitleMenu::Input( const Devic if( CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_GAME) || CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_GAME2) ) { - for( int i=0; i<NUM_GAMES; i++ ) - { - GAMESTATE->m_CurGame = (Game)(GAMESTATE->m_CurGame+1); - wrap( (int&)GAMESTATE->m_CurGame, NUM_GAMES ); - - if( GAMEMAN->IsGameEnabled(GAMESTATE->m_CurGame) ) - break; // found the first enabled game. Stop searching. - } + vector<const GameDef*> vGames; + GAMEMAN->GetEnabledGames( vGames ); + ASSERT( !vGames.empty() ); + vector<const GameDef*>::iterator iter = find(vGames.begin(),vGames.end(),GAMESTATE->m_pCurGame); + ASSERT( iter != vGames.end() ); + + iter++; // move to the next game + + // wrap + if( iter == vGames.end() ) + iter = vGames.begin(); + + GAMESTATE->m_pCurGame = *iter; /* Reload the theme if it's changed, but don't back to the initial screen. */ ResetGame( false ); - SCREENMAN->SystemMessage( ssprintf("Game: %s",GAMESTATE->GetCurrentGameDef()->m_szName) ); + SCREENMAN->SystemMessage( CString("Game: ") + GAMESTATE->GetCurrentGameDef()->m_szName ); SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); } Index: GameState.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/GameState.cpp,v retrieving revision 1.369 retrieving revision 1.370 diff -u -d -p -r1.369 -r1.370 --- GameState.cpp 24 Jul 2004 06:40:51 -0000 1.369 +++ GameState.cpp 25 Jul 2004 04:27:16 -0000 1.370 @@ -41,7 +41,7 @@ GameState::GameState() { m_pPosition = NULL; - m_CurGame = GAME_DANCE; + m_pCurGame = NULL; m_iCoins = 0; m_timeGameStarted.SetZero(); m_bIsOnSystemMenu = false; @@ -122,7 +122,7 @@ void GameState::Reset() m_BeatToNoteSkinRev = 0; m_iNumStagesOfThisSong = 0; - NOTESKIN->RefreshNoteSkinData( this->m_CurGame ); + NOTESKIN->RefreshNoteSkinData( this->m_pCurGame ); m_iGameSeed = rand(); m_iRoundSeed = rand(); @@ -784,10 +784,10 @@ int GameState::GetNumSidesJoined() const return iNumSidesJoined; } -GameDef* GameState::GetCurrentGameDef() +const GameDef* GameState::GetCurrentGameDef() { - ASSERT( m_CurGame != GAME_INVALID ); // the game must be set before calling this - return GAMEMAN->GetGameDefForGame( m_CurGame ); + ASSERT( m_pCurGame != NULL ); // the game must be set before calling this + return m_pCurGame; } const Style* GameState::GetCurrentStyle() const Index: JukeboxMenu.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/JukeboxMenu.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -p -r1.10 -r1.11 --- JukeboxMenu.cpp 27 Jun 2004 06:52:49 -0000 1.10 +++ JukeboxMenu.cpp 25 Jul 2004 04:27:17 -0000 1.11 @@ -5,6 +5,7 @@ #include "GameState.h" #include "ThemeManager.h" #include "GameManager.h" +#include "Style.h" // // Defines specific to JukeboxMenu @@ -53,7 +54,7 @@ JukeboxMenu::JukeboxMenu() // fill in data structures - GAMEMAN->GetStylesForGame( GAMESTATE->m_CurGame, m_Styles ); + GAMEMAN->GetStylesForGame( GAMESTATE->m_pCurGame, m_Styles ); SONGMAN->GetGroupNames( m_sGroups ); m_sGroups.insert( m_sGroups.begin(), "ALL MUSIC" ); m_sDifficulties.push_back( "all difficulties" ); Index: ScreenOptionsMasterPrefs.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ScreenOptionsMasterPrefs.cpp,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -p -r1.52 -r1.53 --- ScreenOptionsMasterPrefs.cpp 11 Jul 2004 02:24:12 -0000 1.52 +++ ScreenOptionsMasterPrefs.cpp 25 Jul 2004 04:27:19 -0000 1.53 @@ -12,6 +12,8 @@ #include "GameState.h" #include "InputMapper.h" #include "StepMania.h" +#include "GameDef.h" +#include "Foreach.h" static void GetDefaultModifiers( PlayerOptions &po, SongOptions &so ) { @@ -82,12 +84,11 @@ static void MoveData( int &sel, bool &op static void GameChoices( CStringArray &out ) { - vector<Game> aGames; + vector<const GameDef*> aGames; GAMEMAN->GetEnabledGames( aGames ); - for( unsigned i=0; i<aGames.size(); i++ ) + FOREACH( const GameDef*, aGames, g ) { - Game game = aGames[i]; - CString sGameName = GAMEMAN->GetGameDefForGame(game)->m_szName; + CString sGameName = (*g)->m_szName; sGameName.MakeUpper(); out.push_back( sGameName ); } @@ -97,14 +98,14 @@ static void GameSel( int &sel, bool ToSe { if( ToSel ) { - const CString sCurGameName = GAMEMAN->GetGameDefForGame(GAMESTATE->m_CurGame)->m_szName; + const CString sCurGameName = GAMESTATE->m_pCurGame->m_szName; sel = 0; for(unsigned i = 0; i < choices.size(); ++i) if( !stricmp(choices[i], sCurGameName) ) sel = i; } else { - vector<Game> aGames; + vector<const GameDef*> aGames; GAMEMAN->GetEnabledGames( aGames ); ChangeCurrentGame( aGames[sel] ); } Index: ScreenWithMenuElements.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ScreenWithMenuElements.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -p -r1.7 -r1.8 --- ScreenWithMenuElements.cpp 28 Jun 2004 07:25:58 -0000 1.7 +++ ScreenWithMenuElements.cpp 25 Jul 2004 04:27:20 -0000 1.8 @@ -38,7 +38,7 @@ ScreenWithMenuElements::ScreenWithMenuEl if( STYLE_ICON && GAMESTATE->m_pCurStyle ) { - CString sIconFileName = ssprintf("MenuElements icon %s", GAMESTATE->GetCurrentStyle()->m_szName ); + CString sIconFileName = CString("MenuElements icon ") + GAMESTATE->GetCurrentStyle()->m_szName; m_sprStyleIcon.SetName( "StyleIcon" ); m_sprStyleIcon.Load( THEME->GetPathToG(sIconFileName) ); m_sprStyleIcon.StopAnimating(); Index: GameManager.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/GameManager.cpp,v retrieving revision 1.132 retrieving revision 1.133 diff -u -d -p -r1.132 -r1.133 --- GameManager.cpp 12 Jul 2004 02:19:24 -0000 1.132 +++ GameManager.cpp 25 Jul 2004 04:27:16 -0000 1.133 @@ -12,9 +12,28 @@ #include "RageInputDevice.h" #include "ThemeManager.h" #include "LightsManager.h" // for NUM_CABINET_LIGHTS +#include "GameDef.h" +#include "Style.h" GameManager* GAMEMAN = NULL; // global and accessable from anywhere in our program +enum Game +{ + GAME_DANCE, // Dance Dance Revolution + GAME_PUMP, // Pump It Up + GAME_EZ2, // Ez2dancer + GAME_PARA, // ParaPAraParadise + GAME_DS3DDX, // Dance Station 3DDX. + GAME_BM, // Beatmania + GAME_IIDX, // Beatmania IIDX + GAME_MANIAX, // DanceManiax + GAME_TECHNO, // TechnoMotion + GAME_PNM, // pop n music + GAME_LIGHTS, // cabinet lights (not really a game) + NUM_GAMES, // leave this at the end + GAME_INVALID, +}; + const int DANCE_COL_SPACING = 64; const int PUMP_COL_SPACING = 50; @@ -1188,7 +1207,7 @@ GameDef g_GameDefs[NUM_GAMES] = Style g_Styles[] = { { // STYLE_DANCE_SINGLE - GAME_DANCE, // m_Game + &g_GameDefs[GAME_DANCE], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -1219,7 +1238,7 @@ Style g_Styles[] = true, // m_bCanUseBeginnerHelper }, { // STYLE_DANCE_VERSUS - GAME_DANCE, // m_Game + &g_GameDefs[GAME_DANCE], // m_Game true, // m_bUsedForGameplay false, // m_bUsedForEdit true, // m_bUsedForDemonstration @@ -1250,7 +1269,7 @@ Style g_Styles[] = true, // m_bCanUseBeginnerHelper }, { // STYLE_DANCE_DOUBLE - GAME_DANCE, // m_Game + &g_GameDefs[GAME_DANCE], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -1289,7 +1308,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_DANCE_COUPLE - GAME_DANCE, // m_Game + &g_GameDefs[GAME_DANCE], // m_Game true, // m_bUsedForGameplay false, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -1320,7 +1339,7 @@ Style g_Styles[] = true, // m_bCanUseBeginnerHelper }, { // STYLE_DANCE_SOLO - GAME_DANCE, // m_Game + &g_GameDefs[GAME_DANCE], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -1355,7 +1374,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_DANCE_EDIT_COUPLE - GAME_DANCE, // m_Game + &g_GameDefs[GAME_DANCE], // m_Game false, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -1424,7 +1443,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, */ { // STYLE_PUMP_SINGLE - GAME_PUMP, // m_Game + &g_GameDefs[GAME_PUMP], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -1457,7 +1476,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_PUMP_VERSUS - GAME_PUMP, // m_Game + &g_GameDefs[GAME_PUMP], // m_Game true, // m_bUsedForGameplay false, // m_bUsedForEdit true, // m_bUsedForDemonstration @@ -1490,7 +1509,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_PUMP_HALFDOUBLE - GAME_PUMP, // m_Game + &g_GameDefs[GAME_PUMP], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -1525,7 +1544,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_PUMP_DOUBLE - GAME_PUMP, // m_Game + &g_GameDefs[GAME_PUMP], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -1568,7 +1587,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_PUMP_COUPLE - GAME_PUMP, // m_Game + &g_GameDefs[GAME_PUMP], // m_Game true, // m_bUsedForGameplay false, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -1601,7 +1620,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_PUMP_EDIT_COUPLE - GAME_PUMP, // m_Game + &g_GameDefs[GAME_PUMP], // m_Game false, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -1639,7 +1658,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_EZ2_SINGLE - GAME_EZ2, // m_Game + &g_GameDefs[GAME_EZ2], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -1672,7 +1691,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_EZ2_REAL - GAME_EZ2, // m_Game + &g_GameDefs[GAME_EZ2], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -1709,7 +1728,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_EZ2_SINGLE_VERSUS - GAME_EZ2, // m_Game + &g_GameDefs[GAME_EZ2], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit true, // m_bUsedForDemonstration @@ -1742,7 +1761,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_EZ2_REAL_VERSUS - GAME_EZ2, // m_Game + &g_GameDefs[GAME_EZ2], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -1779,7 +1798,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_EZ2_DOUBLE - GAME_EZ2, // m_Game + &g_GameDefs[GAME_EZ2], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -1822,7 +1841,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_PARA_SINGLE - GAME_PARA, // m_Game + &g_GameDefs[GAME_PARA], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit true, // m_bUsedForDemonstration @@ -1855,7 +1874,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_PARA_VERSUS - GAME_PARA, // m_Game + &g_GameDefs[GAME_PARA], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit true, // m_bUsedForDemonstration @@ -1888,7 +1907,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_DS3DDX_SINGLE - GAME_DS3DDX, // m_Game + &g_GameDefs[GAME_DS3DDX], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit true, // m_bUsedForDemonstration @@ -1927,7 +1946,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_BM_SINGLE - GAME_BM, // m_Game + &g_GameDefs[GAME_BM], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit true, // m_bUsedForDemonstration @@ -1962,7 +1981,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_BM_DOUBLE - GAME_BM, // m_Game + &g_GameDefs[GAME_BM], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -2009,7 +2028,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_IIDX_SINGLE7 - GAME_IIDX, // m_Game + &g_GameDefs[GAME_IIDX], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -2048,7 +2067,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_IIDX_DOUBLE7 - GAME_IIDX, // m_Game + &g_GameDefs[GAME_IIDX], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -2103,7 +2122,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_IIDX_SINGLE5 - GAME_IIDX, // m_Game + &g_GameDefs[GAME_IIDX], // m_Game true, // m_bUsedForGameplay false, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -2142,7 +2161,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_IIDX_DOUBLE5 - GAME_IIDX, // m_Game + &g_GameDefs[GAME_IIDX], // m_Game true, // m_bUsedForGameplay false, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -2197,7 +2216,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_IIDX_EDIT_SINGLE5 - GAME_IIDX, // m_Game + &g_GameDefs[GAME_IIDX], // m_Game false, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -2236,7 +2255,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_IIDX_EDIT_DOUBLE5 - GAME_IIDX, // m_Game + &g_GameDefs[GAME_IIDX], // m_Game false, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -2291,7 +2310,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_MANIAX_SINGLE - GAME_MANIAX, // m_Game + &g_GameDefs[GAME_MANIAX], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit true, // m_bUsedForDemonstration @@ -2322,7 +2341,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_MANIAX_VERSUS - GAME_MANIAX, // m_Game + &g_GameDefs[GAME_MANIAX], // m_Game true, // m_bUsedForGameplay false, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -2353,7 +2372,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_MANIAX_DOUBLE - GAME_MANIAX, // m_Game + &g_GameDefs[GAME_MANIAX], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -2392,7 +2411,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_TECHNO_SINGLE4 - GAME_TECHNO, // m_Game + &g_GameDefs[GAME_TECHNO], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -2423,7 +2442,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_TECHNO_SINGLE5 - GAME_TECHNO, // m_Game + &g_GameDefs[GAME_TECHNO], // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit false, // m_bUsedForDemonstration @@ -2456,7 +2475,7 @@ Style g_Styles[] = false, // m_bCanUseBeginnerHelper }, { // STYLE_TECHNO_SINGLE8 - GAME_TECHNO, // m_Game + &g_GameDefs[GAME_TECHNO], // m_Game true, // m_bUsedForGameplay ... [truncated message content] |