remove enum Game. Instead, pass around the GameDef pointer

This commit is contained in:
Chris Danford
2004-07-25 04:27:20 +00:00
parent 1efc1f732c
commit 64628fac21
43 changed files with 312 additions and 288 deletions
+2 -2
View File
@@ -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) )
+1 -1
View File
@@ -250,7 +250,7 @@ void ConditionalBGA::Load(CString szScreenName)
{
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]));
}
}
+1 -1
View File
@@ -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 );
+6 -6
View File
@@ -276,7 +276,7 @@ const glyph &Font::GetGlyph( wchar_t c ) const
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(FontPageSettings &cfg, IniFile &ini, const CStri
*/
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(FontPageSettings &cfg, IniFile &ini, const CStri
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(FontPageSettings &cfg, IniFile &ini, const CStri
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);
+9 -6
View File
@@ -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;
}
+3 -3
View File
@@ -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
-46
View File
@@ -1,46 +0,0 @@
#ifndef GAME_H
#define GAME_H
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,
};
#endif
/*
* (c) 2001-2002 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+1 -1
View File
@@ -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 );
+4 -3
View File
@@ -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];
+104 -69
View File
@@ -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
true, // m_bUsedForEdit
false, // m_bUsedForDemonstration
@@ -2495,7 +2514,7 @@ Style g_Styles[] =
false, // m_bCanUseBeginnerHelper
},
{ // STYLE_TECHNO_VERSUS4
GAME_TECHNO, // m_Game
&g_GameDefs[GAME_TECHNO], // m_Game
true, // m_bUsedForGameplay
false, // m_bUsedForEdit
false, // m_bUsedForDemonstration
@@ -2526,7 +2545,7 @@ Style g_Styles[] =
false, // m_bCanUseBeginnerHelper
},
{ // STYLE_TECHNO_VERSUS5
GAME_TECHNO, // m_Game
&g_GameDefs[GAME_TECHNO], // m_Game
true, // m_bUsedForGameplay
false, // m_bUsedForEdit
false, // m_bUsedForDemonstration
@@ -2559,7 +2578,7 @@ Style g_Styles[] =
false, // m_bCanUseBeginnerHelper
},
{ // STYLE_TECHNO_VERSUS8
GAME_TECHNO, // m_Game
&g_GameDefs[GAME_TECHNO], // m_Game
true, // m_bUsedForGameplay
false, // m_bUsedForEdit
true, // m_bUsedForDemonstration
@@ -2598,7 +2617,7 @@ Style g_Styles[] =
false, // m_bCanUseBeginnerHelper
},
{ // STYLE_TECHNO_DOUBLE4
GAME_TECHNO, // m_Game
&g_GameDefs[GAME_TECHNO], // m_Game
true, // m_bUsedForGameplay
true, // m_bUsedForEdit
false, // m_bUsedForDemonstration
@@ -2637,7 +2656,7 @@ Style g_Styles[] =
false, // m_bCanUseBeginnerHelper
},
{ // STYLE_TECHNO_DOUBLE5
GAME_TECHNO, // m_Game
&g_GameDefs[GAME_TECHNO], // m_Game
true, // m_bUsedForGameplay
true, // m_bUsedForEdit
false, // m_bUsedForDemonstration
@@ -2680,7 +2699,7 @@ Style g_Styles[] =
false, // m_bCanUseBeginnerHelper
},
{ // STYLE_PNM_FIVE
GAME_PNM, // m_Game
&g_GameDefs[GAME_PNM], // m_Game
true, // m_bUsedForGameplay
true, // m_bUsedForEdit
false, // m_bUsedForDemonstration
@@ -2713,7 +2732,7 @@ Style g_Styles[] =
false, // m_bCanUseBeginnerHelper
},
{ // STYLE_PNM_NINE
GAME_PNM, // m_Game
&g_GameDefs[GAME_PNM], // m_Game
true, // m_bUsedForGameplay
true, // m_bUsedForEdit
true, // m_bUsedForDemonstration
@@ -2754,7 +2773,7 @@ Style g_Styles[] =
false, // m_bCanUseBeginnerHelper
},
{ // STYLE_LIGHTS_CABINET
GAME_LIGHTS, // m_Game
&g_GameDefs[GAME_LIGHTS], // m_Game
true, // m_bUsedForGameplay
true, // m_bUsedForEdit
false, // m_bUsedForDemonstration
@@ -2805,18 +2824,12 @@ GameManager::~GameManager()
{
}
GameDef* GameManager::GetGameDefForGame( Game g )
{
ASSERT( g != GAME_INVALID ); // the game must be set before calling this
return &g_GameDefs[ g ];
}
void GameManager::GetStylesForGame( Game game, vector<const Style*>& aStylesAddTo, bool editor )
void GameManager::GetStylesForGame( const GameDef *pGame, vector<const Style*>& aStylesAddTo, bool editor )
{
for( unsigned s=0; s<NUM_STYLES; s++ )
{
const Style* style = &g_Styles[s];
if( style->m_Game != game)
if( style->m_pGameDef != pGame)
continue;
if( !editor && !style->m_bUsedForGameplay )
continue;
@@ -2841,7 +2854,7 @@ const Style* GameManager::GetEditorStyleForStepsType( StepsType st )
}
void GameManager::GetStepsTypesForGame( Game game, vector<StepsType>& aStepsTypeAddTo )
void GameManager::GetStepsTypesForGame( const GameDef *pGame, vector<StepsType>& aStepsTypeAddTo )
{
FOREACH_StepsType( st )
{
@@ -2849,7 +2862,7 @@ void GameManager::GetStepsTypesForGame( Game game, vector<StepsType>& aStepsType
for( unsigned s=0; !found && s<NUM_STYLES; s++ )
{
const Style* style = &g_Styles[s];
if( style->m_Game != game || style->m_StepsType != st )
if( style->m_pGameDef != pGame || style->m_StepsType != st )
continue;
found = true;
@@ -2859,12 +2872,12 @@ void GameManager::GetStepsTypesForGame( Game game, vector<StepsType>& aStepsType
}
}
const Style* GameManager::GetDemonstrationStyleForGame( Game game )
const Style* GameManager::GetDemonstrationStyleForGame( const GameDef *pGame )
{
for( unsigned s=0; s<NUM_STYLES; s++ )
{
const Style* style = &g_Styles[s];
if( style->m_Game == game && style->m_bUsedForDemonstration )
if( style->m_pGameDef == pGame && style->m_bUsedForDemonstration )
return style;
}
@@ -2872,12 +2885,12 @@ const Style* GameManager::GetDemonstrationStyleForGame( Game game )
return NULL;
}
const Style* GameManager::GetHowToPlayStyleForGame( Game game )
const Style* GameManager::GetHowToPlayStyleForGame( const GameDef *pGame )
{
for( unsigned s=0; s<NUM_STYLES; s++ )
{
const Style* style = &g_Styles[s];
if( style->m_Game == game && style->m_bUsedForHowToPlay )
if( style->m_pGameDef == pGame && style->m_bUsedForHowToPlay )
return style;
}
@@ -2885,24 +2898,46 @@ const Style* GameManager::GetHowToPlayStyleForGame( Game game )
return NULL;
}
void GameManager::GetEnabledGames( vector<Game>& aGamesOut )
void GameManager::GetEnabledGames( vector<const GameDef*>& aGamesOut )
{
for( int g=0; g<NUM_GAMES; g++ )
{
Game game = (Game)g;
const GameDef *pGame = &g_GameDefs[g];
CStringArray asNoteSkins;
NOTESKIN->GetNoteSkinNames( game, asNoteSkins );
NOTESKIN->GetNoteSkinNames( pGame, asNoteSkins );
if( !asNoteSkins.empty() )
aGamesOut.push_back( game );
aGamesOut.push_back( pGame );
}
}
bool GameManager::IsGameEnabled( Game game )
const GameDef* GameManager::GetDefaultGame()
{
vector<Game> aGames;
return &g_GameDefs[0];
}
int GameManager::GetIndexFromGame( const GameDef* pGame )
{
for( int g=0; g<NUM_GAMES; g++ )
{
if( &g_GameDefs[g] == pGame )
return g;
}
ASSERT(0);
return 0;
}
const GameDef* GameManager::GetGameFromIndex( int index )
{
ASSERT( index >= 0 );
ASSERT( index < NUM_GAMES );
return &g_GameDefs[index];
}
bool GameManager::IsGameEnabled( const GameDef *pGame )
{
vector<const GameDef*> aGames;
GetEnabledGames( aGames );
return find( aGames.begin(), aGames.end(), game ) != aGames.end();
return find( aGames.begin(), aGames.end(), pGame ) != aGames.end();
}
int GameManager::StepsTypeToNumTracks( StepsType st )
@@ -2957,22 +2992,22 @@ CString GameManager::StyleToThemedString( const Style* style )
return s;
}
Game GameManager::StringToGameType( CString sGameType )
const GameDef* GameManager::StringToGameType( CString sGameType )
{
for( int i=0; i<NUM_GAMES; i++ )
if( !sGameType.CompareNoCase(g_GameDefs[i].m_szName) )
return Game(i);
return &g_GameDefs[i];
return GAME_INVALID;
return NULL;
}
const Style* GameManager::GameAndStringToStyle( Game game, CString sStyle )
const Style* GameManager::GameAndStringToStyle( const GameDef *game, CString sStyle )
{
for( unsigned s=0; s<NUM_STYLES; s++ )
{
const Style* style = &g_Styles[s];
if( style->m_Game != game )
if( style->m_pGameDef != game )
continue;
if( sStyle.CompareNoCase(style->m_szName) == 0 )
return style;
+14 -13
View File
@@ -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 );
};
+5 -5
View File
@@ -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
+3 -3
View File
@@ -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 );
+48 -41
View File
@@ -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::AddDefaultMappingsForCurrentGameIfUnmapped()
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::AddDefaultMappingsForCurrentGameIfUnmapped()
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::AutoMapJoysticksForCurrentGame()
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::AutoMapJoysticksForCurrentGame()
{
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) )
if( !regex.Compare(sDescription) )
continue; // driver names don't match
//
// 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.
LOG->Info( "Applying default joystick mapping #%d for device '%s' (%s)",
iNumJoysticksMapped+1, mapping.szDriverRegex, mapping.szControllerName );
for( int k=0; !mapping.maps[k].IsEndMarker(); k++ )
{
//
// 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.
LOG->Info( "Applying default joystick mapping #%d for device '%s' (%s)",
iNumJoysticksMapped+1, mapping.szDriverRegex, mapping.szControllerName );
for( int k=0; !mapping.maps[k].IsEndMarker(); k++ )
GameController map_gc = gc;
if( mapping.maps[k].SecondController )
{
GameController map_gc = gc;
if( mapping.maps[k].SecondController )
{
map_gc = (GameController)(map_gc+1);
map_gc = (GameController)(map_gc+1);
/* 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;
}
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++;
}
}
}
+2 -1
View File
@@ -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" );
+11 -10
View File
@@ -14,13 +14,14 @@
#include "arch/ArchHooks/ArchHooks.h"
#include "MemoryCardManager.h"
#include "song.h"
#include "GameDef.h"
void ModeChoice::Init()
{
m_sName = "";
m_bInvalid = true;
m_iIndex = -1;
m_game = GAME_INVALID;
m_pGameDef = NULL;
m_pStyle = NULL;
m_pm = PLAY_MODE_INVALID;
m_dc = DIFFICULTY_INVALID;
@@ -48,7 +49,7 @@ bool ModeChoice::DescribesCurrentModeForAllPlayers() const
bool ModeChoice::DescribesCurrentMode( PlayerNumber pn ) const
{
if( m_game != GAME_INVALID && m_game != GAMESTATE->m_CurGame )
if( m_pGameDef != NULL && m_pGameDef != GAMESTATE->m_pCurGame )
return false;
if( m_pm != PLAY_MODE_INVALID && GAMESTATE->m_PlayMode != m_pm )
return false;
@@ -120,9 +121,9 @@ void ModeChoice::Load( int iIndex, CString sChoice )
if( sName == "game" )
{
Game game = GAMEMAN->StringToGameType( sValue );
if( game != GAME_INVALID )
m_game = game;
const GameDef* pGame = GAMEMAN->StringToGameType( sValue );
if( pGame != NULL )
m_pGameDef = pGame;
else
m_bInvalid |= true;
}
@@ -130,7 +131,7 @@ void ModeChoice::Load( int iIndex, CString sChoice )
if( sName == "style" )
{
const Style* style = GAMEMAN->GameAndStringToStyle( GAMESTATE->m_CurGame, sValue );
const Style* style = GAMEMAN->GameAndStringToStyle( GAMESTATE->m_pCurGame, sValue );
if( style )
m_pStyle = style;
else
@@ -269,7 +270,7 @@ static bool AreStyleAndPlayModeCompatible( const Style *style, PlayMode pm )
// This is correct for dance (ie, no rave for solo and doubles),
// and should be okay for pump .. not sure about other game types.
// Techno Motion scales down versus arrows, though, so allow this.
if( style->m_iColsPerPlayer >= 6 && GAMESTATE->m_CurGame != GAME_TECHNO )
if( style->m_iColsPerPlayer >= 6 && CString(GAMESTATE->m_pCurGame->m_szName) == "techno" )
return false;
/* Don't allow battle modes if the style takes both sides. */
@@ -403,8 +404,8 @@ void ModeChoice::Apply( PlayerNumber pn ) const
const PlayMode OldPlayMode = GAMESTATE->m_PlayMode;
if( m_game != GAME_INVALID )
GAMESTATE->m_CurGame = m_game;
if( m_pGameDef != NULL )
GAMESTATE->m_pCurGame = m_pGameDef;
if( m_pm != PLAY_MODE_INVALID )
GAMESTATE->m_PlayMode = m_pm;
@@ -484,7 +485,7 @@ void ModeChoice::Apply( PlayerNumber pn ) const
bool ModeChoice::IsZero() const
{
if( m_game != GAME_INVALID ||
if( m_pGameDef != NULL ||
m_pm != PLAY_MODE_INVALID ||
m_pStyle != NULL ||
m_dc != DIFFICULTY_INVALID ||
+2 -2
View File
@@ -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;
+12 -11
View File
@@ -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(PlayerNumber pn, int dir)
// 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;
+1
View File
@@ -22,6 +22,7 @@
#include "SongUtil.h"
#include "CourseUtil.h"
#include "Foreach.h"
#include "Style.h"
#define FADE_SECONDS THEME->GetMetricF("MusicWheel","FadeSeconds")
+3 -4
View File
@@ -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, CString id, int pn)
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);
}
+8 -8
View File
@@ -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( CString sNoteSkinName, NoteSkinData& dat
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( CStringArray &AddTo )
}
}
void NoteSkinManager::GetNoteSkinNames( Game game, CStringArray &AddTo )
void NoteSkinManager::GetNoteSkinNames( const GameDef* game, CStringArray &AddTo )
{
RefreshNoteSkinData( game );
@@ -114,7 +114,7 @@ void NoteSkinManager::GetNoteSkinNames( Game game, CStringArray &AddTo )
}
/* Put the note skins back. */
RefreshNoteSkinData( GAMESTATE->m_CurGame );
RefreshNoteSkinData( GAMESTATE->m_pCurGame );
}
+6 -6
View File
@@ -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;
};
+1
View File
@@ -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");
+1 -1
View File
@@ -20,7 +20,7 @@ const ScreenMessage SM_NotesEnded = ScreenMessage(SM_User+10); // MUST be sam
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;
+1 -1
View File
@@ -102,7 +102,7 @@ ScreenEnding::ScreenEnding( CString sClassName ) : ScreenAttract( sClassName, fa
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;
+1 -1
View File
@@ -101,7 +101,7 @@ void ScreenEvaluation::Init()
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;
+1 -1
View File
@@ -130,7 +130,7 @@ ScreenHowToPlay::ScreenHowToPlay( CString sName ) : ScreenAttract( sName )
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 )
{
+1 -1
View File
@@ -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 );
+1
View File
@@ -11,6 +11,7 @@
#include "GameSoundManager.h"
#include "ThemeManager.h"
#include "RageDisplay.h"
#include "GameDef.h"
#define EVEN_LINE_IN THEME->GetMetric("ScreenMapControllers","EvenLineIn")
+1
View File
@@ -16,6 +16,7 @@
#include "ProfileManager.h"
#include "NoteFieldPositioning.h"
#include "StageStats.h"
#include "GameDef.h"
//
+1 -1
View File
@@ -131,7 +131,7 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
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 )
{
+7 -6
View File
@@ -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 &opt, bool ToSel )
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 ToSel, const CStringArray &choices )
{
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] );
}
+1 -1
View File
@@ -265,7 +265,7 @@ ScreenRanking::ScreenRanking( CString sClassName ) : ScreenAttract( sClassName )
// calculate which StepsTypes to show
vector<StepsType> aStepsTypesToShow;
{
GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_CurGame, aStepsTypesToShow );
GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_pCurGame, aStepsTypesToShow );
// subtract hidden StepsTypes
{
+2
View File
@@ -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")
+1 -1
View File
@@ -11,7 +11,7 @@
#include "GameSoundManager.h"
#include "ThemeManager.h"
#include "RageDisplay.h"
#include "GameDef.h"
ScreenTestInput::ScreenTestInput( CString sClassName ) : ScreenWithMenuElements( sClassName )
+1
View File
@@ -12,6 +12,7 @@
#include "ThemeManager.h"
#include "RageDisplay.h"
#include "LightsManager.h"
#include "GameDef.h"
ScreenTestLights::ScreenTestLights( CString sClassName ) : ScreenWithMenuElements( sClassName )
+16 -10
View File
@@ -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( CString sClassName ) : ScreenSelect( sClassNam
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 DeviceInput& DeviceI, const InputEventType ty
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" );
}
+1 -1
View File
@@ -38,7 +38,7 @@ ScreenWithMenuElements::ScreenWithMenuElements( CString sClassName ) : Screen( s
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();
+1
View File
@@ -3,6 +3,7 @@
#include "GameManager.h"
#include "GameState.h"
#include "ThemeManager.h"
#include "Style.h"
SnapDisplay::SnapDisplay()
+13 -8
View File
@@ -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 bSwitchToLastPlayedGame )
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 bSwitchToLastPlayedGame )
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 DeviceI, InputEventType type, GameInput Gam
THEME->ReloadMetrics();
TEXTUREMAN->ReloadAll();
SCREENMAN->ReloadCreditsText();
NOTESKIN->RefreshNoteSkinData( GAMESTATE->m_CurGame );
NOTESKIN->RefreshNoteSkinData( GAMESTATE->m_pCurGame );
CodeDetector::RefreshCacheItems();
+2 -2
View File
@@ -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 ""
+7 -7
View File
@@ -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". */
+5 -4
View File
@@ -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