cleanup: Remove Style and use StyleDef everywhere. This gets rid of a lot of Style->StyleDef lookups and discourages code that's specific to a Style. All game logic should be data-driven.

This commit is contained in:
Chris Danford
2004-06-27 06:52:49 +00:00
parent 94f61972c8
commit 3809715db0
44 changed files with 308 additions and 383 deletions
+3 -5
View File
@@ -419,11 +419,9 @@ bool ArrowsNeedZBuffer( PlayerNumber pn )
float ArrowGetZoom( PlayerNumber pn ) float ArrowGetZoom( PlayerNumber pn )
{ {
/* Hack: make STYLE_TECHNO_VERSUS8 fit. */ // FIXME: Move the zoom values into StyleDef
if( GAMESTATE->m_CurGame == GAME_TECHNO && if( GAMESTATE->m_pCurStyleDef->m_bNeedsZoomOutWith2Players &&
( GAMESTATE->m_CurStyle == STYLE_TECHNO_VERSUS8 (GAMESTATE->GetNumSidesJoined()==2 || GAMESTATE->AnyPlayersAreCpu()) )
|| GAMESTATE->m_PlayMode == PLAY_MODE_BATTLE
|| GAMESTATE->m_PlayMode == PLAY_MODE_RAVE ) )
return 0.6f; return 0.6f;
return 1.0f; return 1.0f;
} }
+2 -11
View File
@@ -8,6 +8,7 @@
#include "RageDisplay.h" #include "RageDisplay.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "Steps.h" #include "Steps.h"
#include "StyleDef.h"
// "PLAYER_X" offsets are relative to the pad.. ex: Setting this to 10, and the HELPER to 300, will put the dancer at 310 // "PLAYER_X" offsets are relative to the pad.. ex: Setting this to 10, and the HELPER to 300, will put the dancer at 310
#define PLAYER_X( px ) THEME->GetMetricF("BeginnerHelper",ssprintf("Player%d_X",px+1)) #define PLAYER_X( px ) THEME->GetMetricF("BeginnerHelper",ssprintf("Player%d_X",px+1))
@@ -109,17 +110,7 @@ bool BeginnerHelper::CanUse()
if(!DoesFileExist(GetAnimPath((Animation)i))) if(!DoesFileExist(GetAnimPath((Animation)i)))
return false; return false;
if(GAMESTATE->m_CurGame != GAME_DANCE) return GAMESTATE->m_pCurStyleDef->m_bCanUseBeginnerHelper;
return false;
switch( GAMESTATE->m_CurStyle )
{
case STYLE_DANCE_SOLO:
case STYLE_DANCE_DOUBLE:
return false;
}
return true;
} }
bool BeginnerHelper::Initialize( int iDancePadType ) bool BeginnerHelper::Initialize( int iDancePadType )
-1
View File
@@ -3,7 +3,6 @@
#ifndef Bookkeeper_H #ifndef Bookkeeper_H
#define Bookkeeper_H #define Bookkeeper_H
#include "Style.h"
#include "TimeConstants.h" #include "TimeConstants.h"
+3 -3
View File
@@ -248,7 +248,7 @@ void ConditionalBGA::Load(CString szScreenName)
split( asSplitLine[1], ",", asStyles ); split( asSplitLine[1], ",", asStyles );
for( unsigned d=0; d<asStyles.size(); d++ ) for( unsigned d=0; d<asStyles.size(); d++ )
{ {
LOG->Info("Style:%s (%d) (current: %d)",asStyles[d].c_str(),GAMEMAN->GameAndStringToStyle(GAMESTATE->m_CurGame,asStyles[d]),GAMESTATE->m_CurStyle); LOG->Info( "Style:%s", asStyles[d].c_str() );
m_bgainfo[bgano].styles.push_back(GAMEMAN->GameAndStringToStyle(GAMESTATE->m_CurGame,asStyles[d])); m_bgainfo[bgano].styles.push_back(GAMEMAN->GameAndStringToStyle(GAMESTATE->m_CurGame,asStyles[d]));
} }
@@ -489,8 +489,8 @@ void ConditionalBGA::CheckBgaRequirements(BgaCondInfo info)
bool foundmatchingstyle=false; bool foundmatchingstyle=false;
for(unsigned d=0;d<info.styles.size();d++) for(unsigned d=0;d<info.styles.size();d++)
{ {
LOG->Info("info.styles = %d m_CurStyle = %d",info.styles[d],GAMESTATE->m_CurStyle); //LOG->Info("info.styles = %d m_CurStyle = %d",info.styles[d],GAMESTATE->m_pCurStyleDef);
if(info.styles[d] == GAMESTATE->m_CurStyle) if(info.styles[d] == GAMESTATE->m_pCurStyleDef)
{ {
foundmatchingstyle = true; foundmatchingstyle = true;
LOG->Info("Found Valid Style"); LOG->Info("Found Valid Style");
+1 -2
View File
@@ -1,7 +1,6 @@
#ifndef CONDITIONALBGA_H #ifndef CONDITIONALBGA_H
#define CONDITIONALBGA_H #define CONDITIONALBGA_H
#include "Style.h"
#include "PlayerOptions.h" #include "PlayerOptions.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "BGAnimation.h" #include "BGAnimation.h"
@@ -31,7 +30,7 @@ struct BgaCondInfo
vector<int> songdows; vector<int> songdows;
vector<int> songmonths; vector<int> songmonths;
vector<int> grades; vector<int> grades;
vector<Style> styles; vector<const StyleDef*> styles;
PlayerOptions disallowedpo; PlayerOptions disallowedpo;
bool dpoused; // indicate if disallowed po has been set bool dpoused; // indicate if disallowed po has been set
}; };
+2 -2
View File
@@ -30,7 +30,7 @@ MenuInput GameDef::GameInputToMenuInput( GameInput GameI ) const
PlayerNumber pn; PlayerNumber pn;
StyleDef::StyleType type = StyleDef::TWO_PLAYERS_TWO_CREDITS; StyleDef::StyleType type = StyleDef::TWO_PLAYERS_TWO_CREDITS;
if( GAMESTATE->m_CurStyle != STYLE_INVALID ) if( GAMESTATE->GetCurrentStyleDef() )
type = GAMESTATE->GetCurrentStyleDef()->m_StyleType; type = GAMESTATE->GetCurrentStyleDef()->m_StyleType;
switch( type ) switch( type )
{ {
@@ -71,7 +71,7 @@ void GameDef::MenuInputToGameInput( MenuInput MenuI, GameInput GameIout[4] ) con
GameController controller[2]; GameController controller[2];
StyleDef::StyleType type = StyleDef::TWO_PLAYERS_TWO_CREDITS; StyleDef::StyleType type = StyleDef::TWO_PLAYERS_TWO_CREDITS;
if( GAMESTATE->m_CurStyle != STYLE_INVALID ) if( GAMESTATE->GetCurrentStyleDef() )
type = GAMESTATE->GetCurrentStyleDef()->m_StyleType; type = GAMESTATE->GetCurrentStyleDef()->m_StyleType;
int iNumSidesUsing = 1; int iNumSidesUsing = 1;
+128 -38
View File
@@ -1184,7 +1184,7 @@ GameDef g_GameDefs[NUM_GAMES] =
}, },
}; };
StyleDef g_StyleDefs[NUM_STYLES] = StyleDef g_StyleDefs[] =
{ {
{ // STYLE_DANCE_SINGLE { // STYLE_DANCE_SINGLE
GAME_DANCE, // m_Game GAME_DANCE, // m_Game
@@ -1214,6 +1214,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0, 1, 2, 3 0, 1, 2, 3
}, },
false, // m_bNeedsZoomOutWith2Players
true, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_DANCE_VERSUS { // STYLE_DANCE_VERSUS
GAME_DANCE, // m_Game GAME_DANCE, // m_Game
@@ -1243,6 +1245,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0, 1, 2, 3 0, 1, 2, 3
}, },
false, // m_bNeedsZoomOutWith2Players
true, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_DANCE_DOUBLE { // STYLE_DANCE_DOUBLE
GAME_DANCE, // m_Game GAME_DANCE, // m_Game
@@ -1280,6 +1284,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5,6,7 0,1,2,3,4,5,6,7
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_DANCE_COUPLE { // STYLE_DANCE_COUPLE
GAME_DANCE, // m_Game GAME_DANCE, // m_Game
@@ -1309,6 +1315,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3 0,1,2,3
}, },
false, // m_bNeedsZoomOutWith2Players
true, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_DANCE_SOLO { // STYLE_DANCE_SOLO
GAME_DANCE, // m_Game GAME_DANCE, // m_Game
@@ -1342,6 +1350,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5 0,1,2,3,4,5
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_DANCE_EDIT_COUPLE { // STYLE_DANCE_EDIT_COUPLE
GAME_DANCE, // m_Game GAME_DANCE, // m_Game
@@ -1379,6 +1389,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5,6,7 0,1,2,3,4,5,6,7
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
/* { // STYLE_DANCE_SOLO_VERSUS /* { // STYLE_DANCE_SOLO_VERSUS
"dance-solo-versus", // m_szName "dance-solo-versus", // m_szName
@@ -1407,6 +1419,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,5,1,4,2,3 // outside in 0,5,1,4,2,3 // outside in
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, */ }, */
{ // STYLE_PUMP_SINGLE { // STYLE_PUMP_SINGLE
GAME_PUMP, // m_Game GAME_PUMP, // m_Game
@@ -1438,6 +1452,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,2,4,1,3 0,2,4,1,3
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_PUMP_VERSUS { // STYLE_PUMP_VERSUS
GAME_PUMP, // m_Game GAME_PUMP, // m_Game
@@ -1469,6 +1485,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,2,4,1,3 0,2,4,1,3
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_PUMP_HALFDOUBLE { // STYLE_PUMP_HALFDOUBLE
GAME_PUMP, // m_Game GAME_PUMP, // m_Game
@@ -1502,6 +1520,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,5,2,4,3,1 0,5,2,4,3,1
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_PUMP_DOUBLE { // STYLE_PUMP_DOUBLE
GAME_PUMP, // m_Game GAME_PUMP, // m_Game
@@ -1543,6 +1563,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,2,4,1,3,5,7,9,6,8 0,2,4,1,3,5,7,9,6,8
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_PUMP_COUPLE { // STYLE_PUMP_COUPLE
GAME_PUMP, // m_Game GAME_PUMP, // m_Game
@@ -1574,6 +1596,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,2,4,1,3 0,2,4,1,3
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_PUMP_EDIT_COUPLE { // STYLE_PUMP_EDIT_COUPLE
GAME_PUMP, // m_Game GAME_PUMP, // m_Game
@@ -1610,6 +1634,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,2,4,1,3 0,2,4,1,3
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_EZ2_SINGLE { // STYLE_EZ2_SINGLE
GAME_EZ2, // m_Game GAME_EZ2, // m_Game
@@ -1641,6 +1667,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
2,0,4,1,3 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand 2,0,4,1,3 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_EZ2_REAL { // STYLE_EZ2_REAL
GAME_EZ2, // m_Game GAME_EZ2, // m_Game
@@ -1676,6 +1704,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
3,0,6,2,4,1,5 // This should be from back to front: Down, UpLeft, UpRight, Lower Left Hand, Lower Right Hand, Upper Left Hand, Upper Right Hand 3,0,6,2,4,1,5 // This should be from back to front: Down, UpLeft, UpRight, Lower Left Hand, Lower Right Hand, Upper Left Hand, Upper Right Hand
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_EZ2_SINGLE_VERSUS { // STYLE_EZ2_SINGLE_VERSUS
GAME_EZ2, // m_Game GAME_EZ2, // m_Game
@@ -1707,6 +1737,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
2,0,4,1,3 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand 2,0,4,1,3 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_EZ2_REAL_VERSUS { // STYLE_EZ2_REAL_VERSUS
GAME_EZ2, // m_Game GAME_EZ2, // m_Game
@@ -1742,6 +1774,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
3,0,6,2,4,1,5 // This should be from back to front: Down, UpLeft, UpRight, Lower Left Hand, Lower Right Hand, Upper Left Hand, Upper Right Hand 3,0,6,2,4,1,5 // This should be from back to front: Down, UpLeft, UpRight, Lower Left Hand, Lower Right Hand, Upper Left Hand, Upper Right Hand
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_EZ2_DOUBLE { // STYLE_EZ2_DOUBLE
GAME_EZ2, // m_Game GAME_EZ2, // m_Game
@@ -1783,6 +1817,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
2,0,4,1,3,7,5,9,6,8 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand 2,0,4,1,3,7,5,9,6,8 // This should be from back to front: Down, UpLeft, UpRight, Upper Left Hand, Upper Right Hand
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_PARA_SINGLE { // STYLE_PARA_SINGLE
GAME_PARA, // m_Game GAME_PARA, // m_Game
@@ -1814,6 +1850,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
2,0,4,1,3 2,0,4,1,3
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_DS3DDX_SINGLE { // STYLE_DS3DDX_SINGLE
GAME_DS3DDX, // m_Game GAME_DS3DDX, // m_Game
@@ -1851,6 +1889,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5,6,7 0,1,2,3,4,5,6,7
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_BM_SINGLE { // STYLE_BM_SINGLE
GAME_BM, // m_Game GAME_BM, // m_Game
@@ -1884,6 +1924,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5 0,1,2,3,4,5
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_BM_DOUBLE { // STYLE_BM_DOUBLE
GAME_BM, // m_Game GAME_BM, // m_Game
@@ -1929,6 +1971,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5,6,7,8,9,10,11 0,1,2,3,4,5,6,7,8,9,10,11
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_IIDX_SINGLE7 { // STYLE_IIDX_SINGLE7
GAME_IIDX, // m_Game GAME_IIDX, // m_Game
@@ -1966,6 +2010,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5,6,7 0,1,2,3,4,5,6,7
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_IIDX_DOUBLE7 { // STYLE_IIDX_DOUBLE7
GAME_IIDX, // m_Game GAME_IIDX, // m_Game
@@ -2019,6 +2065,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_IIDX_SINGLE5 { // STYLE_IIDX_SINGLE5
GAME_IIDX, // m_Game GAME_IIDX, // m_Game
@@ -2056,6 +2104,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5,6,7 0,1,2,3,4,5,6,7
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_IIDX_DOUBLE5 { // STYLE_IIDX_DOUBLE5
GAME_IIDX, // m_Game GAME_IIDX, // m_Game
@@ -2109,6 +2159,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_IIDX_EDIT_SINGLE5 { // STYLE_IIDX_EDIT_SINGLE5
GAME_IIDX, // m_Game GAME_IIDX, // m_Game
@@ -2146,6 +2198,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5,6,7 0,1,2,3,4,5,6,7
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_IIDX_EDIT_DOUBLE5 { // STYLE_IIDX_EDIT_DOUBLE5
GAME_IIDX, // m_Game GAME_IIDX, // m_Game
@@ -2199,6 +2253,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_MANIAX_SINGLE { // STYLE_MANIAX_SINGLE
GAME_MANIAX, // m_Game GAME_MANIAX, // m_Game
@@ -2228,6 +2284,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0, 1, 2, 3 0, 1, 2, 3
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_MANIAX_VERSUS { // STYLE_MANIAX_VERSUS
GAME_MANIAX, // m_Game GAME_MANIAX, // m_Game
@@ -2257,6 +2315,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0, 1, 2, 3 0, 1, 2, 3
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_MANIAX_DOUBLE { // STYLE_MANIAX_DOUBLE
GAME_MANIAX, // m_Game GAME_MANIAX, // m_Game
@@ -2294,6 +2354,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5,6,7 0,1,2,3,4,5,6,7
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_TECHNO_SINGLE4 { // STYLE_TECHNO_SINGLE4
GAME_TECHNO, // m_Game GAME_TECHNO, // m_Game
@@ -2323,6 +2385,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3 0,1,2,3
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_TECHNO_SINGLE5 { // STYLE_TECHNO_SINGLE5
GAME_TECHNO, // m_Game GAME_TECHNO, // m_Game
@@ -2354,6 +2418,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4 0,1,2,3,4
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_TECHNO_SINGLE8 { // STYLE_TECHNO_SINGLE8
GAME_TECHNO, // m_Game GAME_TECHNO, // m_Game
@@ -2391,6 +2457,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5,6,7 0,1,2,3,4,5,6,7
}, },
true, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_TECHNO_VERSUS4 { // STYLE_TECHNO_VERSUS4
GAME_TECHNO, // m_Game GAME_TECHNO, // m_Game
@@ -2420,6 +2488,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3 0,1,2,3
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_TECHNO_VERSUS5 { // STYLE_TECHNO_VERSUS5
GAME_TECHNO, // m_Game GAME_TECHNO, // m_Game
@@ -2451,6 +2521,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4 0,1,2,3,4
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_TECHNO_VERSUS8 { // STYLE_TECHNO_VERSUS8
GAME_TECHNO, // m_Game GAME_TECHNO, // m_Game
@@ -2488,6 +2560,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5,6,7 0,1,2,3,4,5,6,7
}, },
true, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_TECHNO_DOUBLE4 { // STYLE_TECHNO_DOUBLE4
GAME_TECHNO, // m_Game GAME_TECHNO, // m_Game
@@ -2525,6 +2599,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5,6,7 0,1,2,3,4,5,6,7
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_TECHNO_DOUBLE5 { // STYLE_TECHNO_DOUBLE5
GAME_TECHNO, // m_Game GAME_TECHNO, // m_Game
@@ -2566,6 +2642,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5,6,7,8,9 0,1,2,3,4,5,6,7,8,9
}, },
true, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_PNM_FIVE { // STYLE_PNM_FIVE
GAME_PNM, // m_Game GAME_PNM, // m_Game
@@ -2597,6 +2675,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4 0,1,2,3,4
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_PNM_NINE { // STYLE_PNM_NINE
GAME_PNM, // m_Game GAME_PNM, // m_Game
@@ -2636,6 +2716,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5,6,7,8 0,1,2,3,4,5,6,7,8
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
{ // STYLE_LIGHTS_CABINET { // STYLE_LIGHTS_CABINET
GAME_LIGHTS, // m_Game GAME_LIGHTS, // m_Game
@@ -2673,9 +2755,12 @@ StyleDef g_StyleDefs[NUM_STYLES] =
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; { // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
0,1,2,3,4,5,6,7 0,1,2,3,4,5,6,7
}, },
false, // m_bNeedsZoomOutWith2Players
false, // m_bCanUseBeginnerHelper
}, },
}; };
#define NUM_STYLES ARRAYSIZE(g_StyleDefs)
GameManager::GameManager() GameManager::GameManager()
@@ -2692,77 +2777,83 @@ GameDef* GameManager::GetGameDefForGame( Game g )
return &g_GameDefs[ g ]; return &g_GameDefs[ g ];
} }
const StyleDef* GameManager::GetStyleDefForStyle( Style s ) void GameManager::GetStylesForGame( Game game, vector<const StyleDef*>& aStylesAddTo, bool editor )
{ {
ASSERT( s != STYLE_INVALID ); // the style must be set before calling this for( int s=0; s<NUM_STYLES; s++ )
return &g_StyleDefs[ s ]; {
} const StyleDef* style = &g_StyleDefs[s];
if( style->m_Game != game)
void GameManager::GetStylesForGame( Game game, vector<Style>& aStylesAddTo, bool editor )
{
for( int s=0; s<NUM_STYLES; s++ ) {
if( g_StyleDefs[s].m_Game != game)
continue; continue;
if( !editor && !g_StyleDefs[s].m_bUsedForGameplay ) if( !editor && !style->m_bUsedForGameplay )
continue; continue;
if( editor && !g_StyleDefs[s].m_bUsedForEdit ) if( editor && !style->m_bUsedForEdit )
continue; continue;
aStylesAddTo.push_back( (Style)s ); aStylesAddTo.push_back( style );
} }
} }
Style GameManager::GetEditorStyleForNotesType( StepsType st ) const StyleDef* GameManager::GetEditorStyleForNotesType( StepsType st )
{ {
for( int s=0; s<NUM_STYLES; s++ ) for( int s=0; s<NUM_STYLES; s++ )
if( g_StyleDefs[s].m_StepsType == st && g_StyleDefs[s].m_bUsedForEdit ) {
return (Style)s; const StyleDef* style = &g_StyleDefs[s];
if( style->m_StepsType == st && style->m_bUsedForEdit )
return style;
}
ASSERT(0); // this Game is missing a StyleDef that can be used with the editor ASSERT(0); // this Game is missing a StyleDef that can be used with the editor
return STYLE_INVALID; return NULL;
} }
void GameManager::GetNotesTypesForGame( Game game, vector<StepsType>& aNotesTypeAddTo ) void GameManager::GetNotesTypesForGame( Game game, vector<StepsType>& aNotesTypeAddTo )
{ {
for( int nt=0; nt<NUM_STEPS_TYPES; nt++ ) FOREACH_StepsType( st )
{ {
bool found = false; bool found = false;
for( int s=0; !found && s<NUM_STYLES; s++ ) for( int s=0; !found && s<NUM_STYLES; s++ )
{ {
if( g_StyleDefs[s].m_Game != game ) const StyleDef* style = &g_StyleDefs[s];
if( style->m_Game != game )
continue; continue;
for( int pl = 0; !found && pl < NUM_PLAYERS; ++pl) for( int pl = 0; !found && pl < NUM_PLAYERS; ++pl)
{ {
if( g_StyleDefs[s].m_StepsType != nt ) if( style->m_StepsType != st )
continue; continue;
found=true; found=true;
} }
} }
if(found) if(found)
aNotesTypeAddTo.push_back( (StepsType)nt ); aNotesTypeAddTo.push_back( st );
} }
} }
Style GameManager::GetDemonstrationStyleForGame( Game game ) const StyleDef* GameManager::GetDemonstrationStyleForGame( Game game )
{ {
for( int s=0; s<NUM_STYLES; s++ ) for( int s=0; s<NUM_STYLES; s++ )
if( g_StyleDefs[s].m_Game == game && g_StyleDefs[s].m_bUsedForDemonstration ) {
return (Style)s; const StyleDef* style = &g_StyleDefs[s];
if( style->m_Game == game && style->m_bUsedForDemonstration )
return style;
}
ASSERT(0); // this Game is missing a StyleDef that can be used with the demonstration ASSERT(0); // this Game is missing a StyleDef that can be used with the demonstration
return STYLE_INVALID; return NULL;
} }
Style GameManager::GetHowToPlayStyleForGame( Game game ) const StyleDef* GameManager::GetHowToPlayStyleForGame( Game game )
{ {
for( int s=0; s<NUM_STYLES; s++ ) for( int s=0; s<NUM_STYLES; s++ )
if( g_StyleDefs[s].m_Game == game && g_StyleDefs[s].m_bUsedForHowToPlay ) {
return (Style)s; const StyleDef* style = &g_StyleDefs[s];
if( style->m_Game == game && style->m_bUsedForHowToPlay )
return style;
}
ASSERT(0); // this Game is missing a StyleDef that can be used with HowToPlay ASSERT(0); // this Game is missing a StyleDef that can be used with HowToPlay
return STYLE_INVALID; return NULL;
} }
void GameManager::GetEnabledGames( vector<Game>& aGamesOut ) void GameManager::GetEnabledGames( vector<Game>& aGamesOut )
@@ -2839,9 +2930,9 @@ CString GameManager::NotesTypeToThemedString( StepsType st )
return s; return s;
} }
CString GameManager::StyleToThemedString( Style style ) CString GameManager::StyleToThemedString( const StyleDef* style )
{ {
CString s = GetStyleDefForStyle(style)->m_szName; CString s = style->m_szName;
s = Capitalize( s ); s = Capitalize( s );
if( THEME->HasMetric( "Style", s ) ) if( THEME->HasMetric( "Style", s ) )
return THEME->GetMetric( "Style", s ); return THEME->GetMetric( "Style", s );
@@ -2859,19 +2950,18 @@ Game GameManager::StringToGameType( CString sGameType )
} }
Style GameManager::GameAndStringToStyle( Game game, CString sStyle ) const StyleDef* GameManager::GameAndStringToStyle( Game game, CString sStyle )
{ {
for( unsigned s=0; s<NUM_STYLES; s++ ) for( int s=0; s<NUM_STYLES; s++ )
{ {
Style style = (Style)s; const StyleDef* style = &g_StyleDefs[s];
const StyleDef* pStyleDef = GetStyleDefForStyle( style ); if( style->m_Game != game )
if( pStyleDef->m_Game != game )
continue; continue;
if( sStyle.CompareNoCase(pStyleDef->m_szName) == 0 ) if( sStyle.CompareNoCase(style->m_szName) == 0 )
return style; return style;
} }
return STYLE_INVALID; return NULL;
} }
/* /*
+7 -8
View File
@@ -5,7 +5,6 @@
#include "GameDef.h" #include "GameDef.h"
#include "StyleDef.h" #include "StyleDef.h"
#include "Style.h"
#include "Game.h" #include "Game.h"
class IniFile; class IniFile;
@@ -17,13 +16,13 @@ public:
~GameManager(); ~GameManager();
GameDef* GetGameDefForGame( Game g ); GameDef* GetGameDefForGame( Game g );
static const StyleDef* GetStyleDefForStyle( Style s );
void GetStylesForGame( Game game, vector<Style>& aStylesAddTo, bool editor=false ); void GetStylesForGame( Game game, vector<const StyleDef*>& aStylesAddTo, bool editor=false );
void GetAllStyles( vector<const StyleDef*>& aStylesAddTo, bool editor=false );
void GetNotesTypesForGame( Game game, vector<StepsType>& aNotesTypeAddTo ); void GetNotesTypesForGame( Game game, vector<StepsType>& aNotesTypeAddTo );
Style GetEditorStyleForNotesType( StepsType st ); const StyleDef* GetEditorStyleForNotesType( StepsType st );
Style GetDemonstrationStyleForGame( Game game ); const StyleDef* GetDemonstrationStyleForGame( Game game );
Style GetHowToPlayStyleForGame( Game game ); const StyleDef* GetHowToPlayStyleForGame( Game game );
void GetEnabledGames( vector<Game>& aGamesOut ); void GetEnabledGames( vector<Game>& aGamesOut );
bool IsGameEnabled( Game game ); bool IsGameEnabled( Game game );
@@ -33,8 +32,8 @@ public:
static CString NotesTypeToString( StepsType st ); static CString NotesTypeToString( StepsType st );
static CString NotesTypeToThemedString( StepsType st ); static CString NotesTypeToThemedString( StepsType st );
static Game StringToGameType( CString sGameType ); static Game StringToGameType( CString sGameType );
Style GameAndStringToStyle( Game game, CString sStyle ); const StyleDef* GameAndStringToStyle( Game game, CString sStyle );
static CString StyleToThemedString( Style s ); static CString StyleToThemedString( const StyleDef* s );
}; };
extern GameManager* GAMEMAN; // global and accessable from anywhere in our program extern GameManager* GAMEMAN; // global and accessable from anywhere in our program
+13 -11
View File
@@ -101,7 +101,7 @@ void GameState::Reset()
ASSERT( THEME ); ASSERT( THEME );
m_timeGameStarted.SetZero(); m_timeGameStarted.SetZero();
m_CurStyle = STYLE_INVALID; m_pCurStyleDef = NULL;
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
m_bSideIsJoined[p] = false; m_bSideIsJoined[p] = false;
m_bPlayersFinalized = false; m_bPlayersFinalized = false;
@@ -228,7 +228,7 @@ void CheckStageStats( const StageStats &ss, int p )
CHECKPOINT_M( ss.pSong->GetFullTranslitTitle() ); CHECKPOINT_M( ss.pSong->GetFullTranslitTitle() );
ASSERT( ss.pSteps[p] ); ASSERT( ss.pSteps[p] );
ASSERT_M( ss.playMode < NUM_PLAY_MODES, ssprintf("playmode %i", ss.playMode) ); ASSERT_M( ss.playMode < NUM_PLAY_MODES, ssprintf("playmode %i", ss.playMode) );
ASSERT_M( ss.style < NUM_STYLES, ssprintf("style %i", ss.style) ); ASSERT_M( ss.pStyleDef != NULL, ssprintf("style (game %d, %s)", ss.pStyleDef->m_Game, ss.pStyleDef->m_szName) );
ASSERT_M( ss.pSteps[p]->GetDifficulty() < NUM_DIFFICULTIES, ssprintf("difficulty %i", ss.pSteps[p]->GetDifficulty()) ); ASSERT_M( ss.pSteps[p]->GetDifficulty() < NUM_DIFFICULTIES, ssprintf("difficulty %i", ss.pSteps[p]->GetDifficulty()) );
/* Meter values can exceed MAX_METER; MAX_METER is just the highest meter value we /* Meter values can exceed MAX_METER; MAX_METER is just the highest meter value we
* display/track. */ * display/track. */
@@ -287,7 +287,7 @@ void AddPlayerStatsToProfile( Profile *pProfile, const StageStats &ss, PlayerNum
const int iMeter = clamp( ss.iMeter[p], 0, MAX_METER ); const int iMeter = clamp( ss.iMeter[p], 0, MAX_METER );
pProfile->m_iNumSongsPlayedByPlayMode[ss.playMode]++; pProfile->m_iNumSongsPlayedByPlayMode[ss.playMode]++;
pProfile->m_iNumSongsPlayedByStyle[ss.style]++; pProfile->m_iNumSongsPlayedByStyle[ss.pStyleDef]++;
pProfile->m_iNumSongsPlayedByDifficulty[ss.pSteps[p]->GetDifficulty()]++; pProfile->m_iNumSongsPlayedByDifficulty[ss.pSteps[p]->GetDifficulty()]++;
pProfile->m_iNumSongsPlayedByMeter[iMeter]++; pProfile->m_iNumSongsPlayedByMeter[iMeter]++;
pProfile->m_iTotalDancePoints += ss.iActualDancePoints[p]; pProfile->m_iTotalDancePoints += ss.iActualDancePoints[p];
@@ -744,7 +744,7 @@ CString GameState::GetPlayerDisplayName( PlayerNumber pn ) const
bool GameState::PlayersCanJoin() const bool GameState::PlayersCanJoin() const
{ {
return GetNumSidesJoined() == 0 || this->m_CurStyle == STYLE_INVALID; // selecting a style finalizes the players return GetNumSidesJoined() == 0 || this->m_pCurStyleDef == NULL; // selecting a style finalizes the players
} }
bool GameState::EnoughCreditsToJoin() const bool GameState::EnoughCreditsToJoin() const
@@ -779,15 +779,16 @@ GameDef* GameState::GetCurrentGameDef()
const StyleDef* GameState::GetCurrentStyleDef() const const StyleDef* GameState::GetCurrentStyleDef() const
{ {
ASSERT( m_CurStyle != STYLE_INVALID ); // the style must be set before calling this /*
// HACK: if we're in TM doing PLAY_MODE_BATTLE or PLAY_MODE_RAVE, // HACK: if we're in TM doing PLAY_MODE_BATTLE or PLAY_MODE_RAVE,
// pretend that we're doing STYLE_TECHNO_VERSUS8 instead. // pretend that we're doing STYLE_TECHNO_VERSUS8 instead.
// What is the problem that this is fixing? -Chris
if( m_CurGame == GAME_TECHNO && if( m_CurGame == GAME_TECHNO &&
( m_PlayMode == PLAY_MODE_BATTLE || m_PlayMode == PLAY_MODE_RAVE ) ) ( m_PlayMode == PLAY_MODE_BATTLE || m_PlayMode == PLAY_MODE_RAVE ) )
return GAMEMAN->GetStyleDefForStyle( STYLE_TECHNO_VERSUS8 ); return GAMEMAN->GetStyleDefForStyle( STYLE_TECHNO_VERSUS8 );
*/
return GAMEMAN->GetStyleDefForStyle( m_CurStyle ); return m_pCurStyleDef;
} }
@@ -820,11 +821,13 @@ bool GameState::PlayerUsingBothSides() const
bool GameState::IsHumanPlayer( PlayerNumber pn ) const bool GameState::IsHumanPlayer( PlayerNumber pn ) const
{ {
if( m_CurStyle == STYLE_INVALID ) // no style chosen if( m_pCurStyleDef == NULL ) // no style chosen
{
if( this->PlayersCanJoin() ) if( this->PlayersCanJoin() )
return m_bSideIsJoined[pn]; // only allow input from sides that have already joined return m_bSideIsJoined[pn]; // only allow input from sides that have already joined
else else
return true; // if we can't join, then we're on a screen like MusicScroll or GameOver return true; // if we can't join, then we're on a screen like MusicScroll or GameOver
}
switch( GetCurrentStyleDef()->m_StyleType ) switch( GetCurrentStyleDef()->m_StyleType )
{ {
@@ -852,7 +855,7 @@ PlayerNumber GameState::GetFirstHumanPlayer() const
{ {
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
if( IsHumanPlayer(p) ) if( IsHumanPlayer(p) )
return (PlayerNumber)p; return p;
ASSERT(0); // there must be at least 1 human player ASSERT(0); // there must be at least 1 human player
return PLAYER_INVALID; return PLAYER_INVALID;
} }
@@ -1800,9 +1803,8 @@ LuaFunction_NoArgs( IsFinalStage, GAMESTATE->IsFinalStage() )
LuaFunction_NoArgs( IsExtraStage, GAMESTATE->IsExtraStage() ) LuaFunction_NoArgs( IsExtraStage, GAMESTATE->IsExtraStage() )
LuaFunction_NoArgs( IsExtraStage2, GAMESTATE->IsExtraStage2() ) LuaFunction_NoArgs( IsExtraStage2, GAMESTATE->IsExtraStage2() )
LuaFunction_NoArgs( CourseSongIndex, GAMESTATE->GetCourseSongIndex() ) LuaFunction_NoArgs( CourseSongIndex, GAMESTATE->GetCourseSongIndex() )
LuaFunction_NoArgs( CurStyle, GAMESTATE->m_CurStyle )
LuaFunction_NoArgs( PlayModeName, PlayModeToString(GAMESTATE->m_PlayMode) ) LuaFunction_NoArgs( PlayModeName, PlayModeToString(GAMESTATE->m_PlayMode) )
LuaFunction_NoArgs( CurStyleName, CString( GAMESTATE->m_CurStyle == STYLE_INVALID? "none": GAMESTATE->GetCurrentStyleDef()->m_szName ) ) LuaFunction_NoArgs( CurStyleName, CString( GAMESTATE->m_pCurStyleDef == NULL ? "none": GAMESTATE->GetCurrentStyleDef()->m_szName ) )
LuaFunction_NoArgs( GetNumPlayersEnabled, GAMESTATE->GetNumPlayersEnabled() ) LuaFunction_NoArgs( GetNumPlayersEnabled, GAMESTATE->GetNumPlayersEnabled() )
LuaFunction_NoArgs( PlayerUsingBothSides, GAMESTATE->PlayerUsingBothSides() ) LuaFunction_NoArgs( PlayerUsingBothSides, GAMESTATE->PlayerUsingBothSides() )
LuaFunction_NoArgs( GetEasiestNotesDifficulty, GAMESTATE->GetEasiestNotesDifficulty() ) LuaFunction_NoArgs( GetEasiestNotesDifficulty, GAMESTATE->GetEasiestNotesDifficulty() )
+2 -2
View File
@@ -7,7 +7,6 @@
#include "PlayerOptions.h" #include "PlayerOptions.h"
#include "SongOptions.h" #include "SongOptions.h"
#include "Game.h" #include "Game.h"
#include "Style.h"
#include "Grade.h" #include "Grade.h"
#include "Attack.h" #include "Attack.h"
#include "RageTimer.h" #include "RageTimer.h"
@@ -25,6 +24,7 @@ class NoteFieldPositioning;
class Character; class Character;
class TimingData; class TimingData;
struct StageStats; struct StageStats;
class StyleDef;
class GameState class GameState
{ {
@@ -46,7 +46,7 @@ public:
// Main state info // Main state info
// //
Game m_CurGame; Game m_CurGame;
Style m_CurStyle; const StyleDef* m_pCurStyleDef;
bool m_bSideIsJoined[NUM_PLAYERS]; // left side, right side bool m_bSideIsJoined[NUM_PLAYERS]; // left side, right side
bool m_bPlayersFinalized; bool m_bPlayersFinalized;
PlayMode m_PlayMode; // many screens display different info depending on this value PlayMode m_PlayMode; // many screens display different info depending on this value
+2 -3
View File
@@ -522,14 +522,13 @@ bool InputMapper::GameToDevice( GameInput GameI, int iSoltNum, DeviceInput& Devi
void InputMapper::GameToStyle( GameInput GameI, StyleInput &StyleI ) void InputMapper::GameToStyle( GameInput GameI, StyleInput &StyleI )
{ {
if( GAMESTATE->m_CurStyle == STYLE_INVALID ) if( GAMESTATE->m_pCurStyleDef == NULL )
{ {
StyleI.MakeInvalid(); StyleI.MakeInvalid();
return; return;
} }
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef(); StyleI = GAMESTATE->m_pCurStyleDef->GameInputToStyleInput( GameI );
StyleI = pStyleDef->GameInputToStyleInput( GameI );
} }
void InputMapper::GameToMenu( GameInput GameI, MenuInput &MenuI ) void InputMapper::GameToMenu( GameInput GameI, MenuInput &MenuI )
+1 -1
View File
@@ -165,7 +165,7 @@ void JukeboxMenu::OnRowValueChanged( Row row )
switch( row ) switch( row )
{ {
case ROW_STYLE: case ROW_STYLE:
m_textValue[ROW_STYLE].SetText( GAMEMAN->GetStyleDefForStyle(GetSelectedStyle())->m_szName ); m_textValue[ROW_STYLE].SetText( GetSelectedStyle()->m_szName );
// fall through // fall through
case ROW_GROUP: case ROW_GROUP:
m_textValue[ROW_GROUP].SetText( SONGMAN->ShortenGroupName(GetSelectedGroup()) ); m_textValue[ROW_GROUP].SetText( SONGMAN->ShortenGroupName(GetSelectedGroup()) );
+10 -10
View File
@@ -7,9 +7,9 @@
#include "Banner.h" #include "Banner.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "RandomSample.h" #include "RandomSample.h"
#include "Style.h"
#include "BitmapText.h" #include "BitmapText.h"
class StyleDef;
class JukeboxMenu: public ActorFrame class JukeboxMenu: public ActorFrame
{ {
@@ -49,11 +49,11 @@ public:
} }
Style GetSelectedStyle() { return m_Styles[m_iSelection[ROW_STYLE]]; } const StyleDef* GetSelectedStyle() { return m_Styles[m_iSelection[ROW_STYLE]]; }
CString GetSelectedGroup() { return m_sGroups[m_iSelection[ROW_GROUP]]; } CString GetSelectedGroup() { return m_sGroups[m_iSelection[ROW_GROUP]]; }
CString GetSelectedDifficultyString() { return m_sDifficulties[m_iSelection[ROW_DIFFICULTY]]; } CString GetSelectedDifficultyString() { return m_sDifficulties[m_iSelection[ROW_DIFFICULTY]]; }
Difficulty GetSelectedDifficulty() { return StringToDifficulty( GetSelectedDifficultyString() ); } Difficulty GetSelectedDifficulty() { return StringToDifficulty( GetSelectedDifficultyString() ); }
bool GetSelectedModifiers() { return m_iSelection[ROW_MODIFIERS] != 0; } bool GetSelectedModifiers() { return m_iSelection[ROW_MODIFIERS] != 0; }
private: private:
Sprite m_sprArrows[2]; Sprite m_sprArrows[2];
@@ -62,10 +62,10 @@ private:
BitmapText m_textLabel[NUM_ROWS]; BitmapText m_textLabel[NUM_ROWS];
BitmapText m_textValue[NUM_ROWS]; BitmapText m_textValue[NUM_ROWS];
vector<Style> m_Styles; vector<const StyleDef*> m_Styles;
CStringArray m_sGroups; CStringArray m_sGroups;
vector<string> m_sDifficulties; vector<string> m_sDifficulties;
CStringArray m_sModifiers; CStringArray m_sModifiers;
void OnRowValueChanged( Row row ); void OnRowValueChanged( Row row );
void ChangeToRow( Row newRow ); void ChangeToRow( Row newRow );
+27 -28
View File
@@ -21,7 +21,7 @@ void ModeChoice::Init()
m_bInvalid = true; m_bInvalid = true;
m_iIndex = -1; m_iIndex = -1;
m_game = GAME_INVALID; m_game = GAME_INVALID;
m_style = STYLE_INVALID; m_pStyleDef = NULL;
m_pm = PLAY_MODE_INVALID; m_pm = PLAY_MODE_INVALID;
m_dc = DIFFICULTY_INVALID; m_dc = DIFFICULTY_INVALID;
m_CourseDifficulty = DIFFICULTY_INVALID; m_CourseDifficulty = DIFFICULTY_INVALID;
@@ -52,7 +52,7 @@ bool ModeChoice::DescribesCurrentMode( PlayerNumber pn ) const
return false; return false;
if( m_pm != PLAY_MODE_INVALID && GAMESTATE->m_PlayMode != m_pm ) if( m_pm != PLAY_MODE_INVALID && GAMESTATE->m_PlayMode != m_pm )
return false; return false;
if( m_style != STYLE_INVALID && GAMESTATE->m_CurStyle != m_style ) if( m_pStyleDef && GAMESTATE->m_pCurStyleDef != m_pStyleDef )
return false; return false;
// HACK: don't compare m_dc if m_pSteps is set. This causes problems // HACK: don't compare m_dc if m_pSteps is set. This causes problems
// in ScreenSelectOptionsMaster::ImportOptions if m_PreferredDifficulty // in ScreenSelectOptionsMaster::ImportOptions if m_PreferredDifficulty
@@ -130,9 +130,9 @@ void ModeChoice::Load( int iIndex, CString sChoice )
if( sName == "style" ) if( sName == "style" )
{ {
Style style = GAMEMAN->GameAndStringToStyle( GAMESTATE->m_CurGame, sValue ); const StyleDef* style = GAMEMAN->GameAndStringToStyle( GAMESTATE->m_CurGame, sValue );
if( style != STYLE_INVALID ) if( style )
m_style = style; m_pStyleDef = style;
else else
m_bInvalid |= true; m_bInvalid |= true;
} }
@@ -208,15 +208,15 @@ void ModeChoice::Load( int iIndex, CString sChoice )
if( !m_bInvalid && sSteps != "" ) if( !m_bInvalid && sSteps != "" )
{ {
Song *pSong = (m_pSong != NULL)? m_pSong:GAMESTATE->m_pCurSong; Song *pSong = (m_pSong != NULL)? m_pSong:GAMESTATE->m_pCurSong;
Style style = (m_style != STYLE_INVALID)? m_style:GAMESTATE->m_CurStyle; const StyleDef *style = m_pStyleDef ? m_pStyleDef : GAMESTATE->m_pCurStyleDef;
if( pSong == NULL || style == STYLE_INVALID ) if( pSong == NULL || style == NULL )
RageException::Throw( "Must set Song and Style to set Steps" ); RageException::Throw( "Must set Song and Style to set Steps" );
Difficulty dc = StringToDifficulty( sSteps ); Difficulty dc = StringToDifficulty( sSteps );
if( dc != DIFFICULTY_EDIT ) if( dc != DIFFICULTY_EDIT )
m_pSteps = pSong->GetStepsByDifficulty( GAMEMAN->GetStyleDefForStyle(style)->m_StepsType, dc ); m_pSteps = pSong->GetStepsByDifficulty( m_pStyleDef->m_StepsType, dc );
else else
m_pSteps = pSong->GetStepsByDescription( GAMEMAN->GetStyleDefForStyle(style)->m_StepsType, sSteps ); m_pSteps = pSong->GetStepsByDescription( m_pStyleDef->m_StepsType, sSteps );
if( m_pSteps == NULL ) if( m_pSteps == NULL )
{ {
m_sInvalidReason = "steps not found"; m_sInvalidReason = "steps not found";
@@ -237,12 +237,12 @@ int GetNumCreditsPaid()
} }
int GetCreditsRequiredToPlayStyle( Style style ) int GetCreditsRequiredToPlayStyle( const StyleDef *style )
{ {
if( PREFSMAN->GetPremium() == PrefsManager::JOINT_PREMIUM ) if( PREFSMAN->GetPremium() == PrefsManager::JOINT_PREMIUM )
return 1; return 1;
switch( GAMEMAN->GetStyleDefForStyle(style)->m_StyleType ) switch( style->m_StyleType )
{ {
case StyleDef::ONE_PLAYER_ONE_CREDIT: case StyleDef::ONE_PLAYER_ONE_CREDIT:
return 1; return 1;
@@ -256,9 +256,9 @@ int GetCreditsRequiredToPlayStyle( Style style )
} }
} }
static bool AreStyleAndPlayModeCompatible( Style style, PlayMode pm ) static bool AreStyleAndPlayModeCompatible( const StyleDef *style, PlayMode pm )
{ {
if( style == STYLE_INVALID || pm == PLAY_MODE_INVALID ) if( style == NULL || pm == PLAY_MODE_INVALID )
return true; return true;
switch( pm ) switch( pm )
@@ -269,12 +269,11 @@ static bool AreStyleAndPlayModeCompatible( Style style, PlayMode pm )
// This is correct for dance (ie, no rave for solo and doubles), // This is correct for dance (ie, no rave for solo and doubles),
// and should be okay for pump .. not sure about other game types. // and should be okay for pump .. not sure about other game types.
// Techno Motion scales down versus arrows, though, so allow this. // Techno Motion scales down versus arrows, though, so allow this.
if( GAMEMAN->GetStyleDefForStyle(style)->m_iColsPerPlayer >= 6 && GAMESTATE->m_CurGame != GAME_TECHNO ) if( style->m_iColsPerPlayer >= 6 && GAMESTATE->m_CurGame != GAME_TECHNO )
return false; return false;
/* Don't allow battle modes if the style takes both sides. */ /* Don't allow battle modes if the style takes both sides. */
const StyleDef *sd = GAMEMAN->GetStyleDefForStyle( style ); if( style->m_StyleType==StyleDef::ONE_PLAYER_TWO_CREDITS )
if( sd->m_StyleType==StyleDef::ONE_PLAYER_TWO_CREDITS )
return false; return false;
} }
@@ -290,11 +289,11 @@ bool ModeChoice::IsPlayable( CString *why ) const
return false; return false;
} }
if ( m_style != STYLE_INVALID ) if ( m_pStyleDef )
{ {
int iCredits = GAMESTATE->m_iCoins / PREFSMAN->m_iCoinsPerCredit; int iCredits = GAMESTATE->m_iCoins / PREFSMAN->m_iCoinsPerCredit;
const int iNumCreditsPaid = GetNumCreditsPaid(); const int iNumCreditsPaid = GetNumCreditsPaid();
const int iNumCreditsRequired = GetCreditsRequiredToPlayStyle(m_style); const int iNumCreditsRequired = GetCreditsRequiredToPlayStyle(m_pStyleDef);
switch( PREFSMAN->GetCoinMode() ) switch( PREFSMAN->GetCoinMode() )
{ {
@@ -335,7 +334,7 @@ bool ModeChoice::IsPlayable( CString *why ) const
/* If both sides are joined, disallow singles modes, since easy to select them /* If both sides are joined, disallow singles modes, since easy to select them
* accidentally, instead of versus mode. */ * accidentally, instead of versus mode. */
if( GAMEMAN->GetStyleDefForStyle(m_style)->m_StyleType == StyleDef::ONE_PLAYER_ONE_CREDIT && if( m_pStyleDef->m_StyleType == StyleDef::ONE_PLAYER_ONE_CREDIT &&
GAMESTATE->GetNumSidesJoined() > 1 ) GAMESTATE->GetNumSidesJoined() > 1 )
{ {
if( why ) if( why )
@@ -346,15 +345,15 @@ bool ModeChoice::IsPlayable( CString *why ) const
/* Don't allow a PlayMode that's incompatible with our current Style (if set), /* Don't allow a PlayMode that's incompatible with our current Style (if set),
* and vice versa. */ * and vice versa. */
if( m_pm != PLAY_MODE_INVALID || m_style != STYLE_INVALID ) if( m_pm != PLAY_MODE_INVALID || m_pStyleDef != NULL )
{ {
const PlayMode pm = (m_pm != PLAY_MODE_INVALID) ? m_pm : GAMESTATE->m_PlayMode; const PlayMode pm = (m_pm != PLAY_MODE_INVALID) ? m_pm : GAMESTATE->m_PlayMode;
const Style style = (m_style != STYLE_INVALID)? m_style: GAMESTATE->m_CurStyle; const StyleDef *style = (m_pStyleDef != NULL)? m_pStyleDef: GAMESTATE->m_pCurStyleDef;
if( !AreStyleAndPlayModeCompatible( style, pm ) ) if( !AreStyleAndPlayModeCompatible( style, pm ) )
{ {
if( why ) if( why )
*why = ssprintf("mode %s is incompatible with style %s", *why = ssprintf("mode %s is incompatible with style %s",
PlayModeToString(pm).c_str(), GAMEMAN->GetStyleDefForStyle(style)->m_szName ); PlayModeToString(pm).c_str(), style->m_szName );
return false; return false;
} }
@@ -409,15 +408,15 @@ void ModeChoice::Apply( PlayerNumber pn ) const
if( m_pm != PLAY_MODE_INVALID ) if( m_pm != PLAY_MODE_INVALID )
GAMESTATE->m_PlayMode = m_pm; GAMESTATE->m_PlayMode = m_pm;
if( m_style != STYLE_INVALID ) if( m_pStyleDef != NULL )
{ {
GAMESTATE->m_CurStyle = m_style; GAMESTATE->m_pCurStyleDef = m_pStyleDef;
// It's possible to choose a style that didn't have enough // It's possible to choose a style that didn't have enough
// players joined. If enough players aren't joined, then // players joined. If enough players aren't joined, then
// we need to subtract credits for the sides that will be // we need to subtract credits for the sides that will be
// joined as a result of applying this option. // joined as a result of applying this option.
int iNumCreditsRequired = GetCreditsRequiredToPlayStyle(m_style); int iNumCreditsRequired = GetCreditsRequiredToPlayStyle(m_pStyleDef);
int iNumCreditsPaid = GetNumCreditsPaid(); int iNumCreditsPaid = GetNumCreditsPaid();
int iNumCreditsOwed = iNumCreditsRequired - iNumCreditsPaid; int iNumCreditsOwed = iNumCreditsRequired - iNumCreditsPaid;
@@ -426,7 +425,7 @@ void ModeChoice::Apply( PlayerNumber pn ) const
// If only one side is joined and we picked a style // If only one side is joined and we picked a style
// that requires both sides, join the other side. // that requires both sides, join the other side.
switch( GAMEMAN->GetStyleDefForStyle(m_style)->m_StyleType ) switch( m_pStyleDef->m_StyleType )
{ {
case StyleDef::ONE_PLAYER_ONE_CREDIT: case StyleDef::ONE_PLAYER_ONE_CREDIT:
break; break;
@@ -477,7 +476,7 @@ void ModeChoice::Apply( PlayerNumber pn ) const
// //
// We know what players are joined at the time we set the Style // We know what players are joined at the time we set the Style
// //
if( m_style != STYLE_INVALID ) if( m_pStyleDef != NULL )
{ {
GAMESTATE->PlayersFinalized(); GAMESTATE->PlayersFinalized();
} }
@@ -487,7 +486,7 @@ bool ModeChoice::IsZero() const
{ {
if( m_game != GAME_INVALID || if( m_game != GAME_INVALID ||
m_pm != PLAY_MODE_INVALID || m_pm != PLAY_MODE_INVALID ||
m_style != STYLE_INVALID || m_pStyleDef != NULL ||
m_dc != DIFFICULTY_INVALID || m_dc != DIFFICULTY_INVALID ||
m_sAnnouncer != "" || m_sAnnouncer != "" ||
m_sModifiers != "" || m_sModifiers != "" ||
+2 -2
View File
@@ -4,7 +4,6 @@
#define MODECHOICE_H #define MODECHOICE_H
#include "Game.h" #include "Game.h"
#include "Style.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "PlayerNumber.h" #include "PlayerNumber.h"
#include <map> #include <map>
@@ -14,6 +13,7 @@ class Steps;
class Course; class Course;
class Trail; class Trail;
class Character; class Character;
class StyleDef;
struct ModeChoice // used in SelectMode struct ModeChoice // used in SelectMode
{ {
@@ -33,7 +33,7 @@ struct ModeChoice // used in SelectMode
CString m_sInvalidReason; CString m_sInvalidReason;
int m_iIndex; int m_iIndex;
Game m_game; Game m_game;
Style m_style; const StyleDef* m_pStyleDef;
PlayMode m_pm; PlayMode m_pm;
Difficulty m_dc; Difficulty m_dc;
CourseDifficulty m_CourseDifficulty; CourseDifficulty m_CourseDifficulty;
+38 -115
View File
@@ -8,6 +8,7 @@
#include "StyleDef.h" #include "StyleDef.h"
#include "song.h" #include "song.h"
#include "ActorUtil.h" #include "ActorUtil.h"
#include "GameManager.h"
#define PREVMODE_X THEME->GetMetricF("ModeSwitcher","PrevModeX") #define PREVMODE_X THEME->GetMetricF("ModeSwitcher","PrevModeX")
#define PREVMODE_Y THEME->GetMetricF("ModeSwitcher","PrevModeY") #define PREVMODE_Y THEME->GetMetricF("ModeSwitcher","PrevModeY")
@@ -60,20 +61,14 @@ ModeSwitcher::~ModeSwitcher()
CString ModeSwitcher::GetStyleName() CString ModeSwitcher::GetStyleName()
{ {
CString sStyleName; CString sStyleName;
CString sDiff[2]; CString sDiff[NUM_PLAYERS];
sStyleName = GAMESTATE->m_pCurStyleDef->m_szName;
sStyleName.MakeUpper();
switch(GAMESTATE->m_CurStyle) FOREACH_PlayerNumber(i)
{ {
case STYLE_PUMP_SINGLE: sStyleName = "SINGLE\n"; break; if( GAMESTATE->IsPlayerEnabled(i) )
case STYLE_PUMP_DOUBLE: sStyleName = "FULL-DOUBLE\n"; break;
case STYLE_PUMP_HALFDOUBLE: sStyleName = "HALFDOUBLE\n"; break;
default: sStyleName = ""; break;
}
for(int i=0; i<2; i++)
{
if(GAMESTATE->IsPlayerEnabled(i))
{ {
switch(GAMESTATE->m_PreferredDifficulty[i]) switch(GAMESTATE->m_PreferredDifficulty[i])
{ {
@@ -127,22 +122,17 @@ CString ModeSwitcher::GetStyleName()
CString ModeSwitcher::GetNextStyleName() CString ModeSwitcher::GetNextStyleName()
{ {
CString sStyleName[2]; CString sStyleName[NUM_PLAYERS];
CString sDiff[2]; CString sDiff[NUM_PLAYERS];
for(int i=0; i<2; i++) FOREACH_PlayerNumber(i)
{ {
if(GAMESTATE->IsPlayerEnabled(i)) if(GAMESTATE->IsPlayerEnabled(i))
{ {
if(GAMESTATE->m_PreferredDifficulty[i] != DIFFICULTY_CHALLENGE) if(GAMESTATE->m_PreferredDifficulty[i] != DIFFICULTY_CHALLENGE)
{ {
switch(GAMESTATE->m_CurStyle) sStyleName[i] = GAMESTATE->m_pCurStyleDef->m_szName;
{ sStyleName[i].MakeUpper();
case STYLE_PUMP_SINGLE: sStyleName[i] = "SINGLE\n"; break;
case STYLE_PUMP_DOUBLE: sStyleName[i] = "FULL-DOUBLE\n"; break;
case STYLE_PUMP_HALFDOUBLE: sStyleName[i] = "HALFDOUBLE\n"; break;
default: sStyleName[i] = ""; break;
}
switch(GAMESTATE->m_PreferredDifficulty[i]) switch(GAMESTATE->m_PreferredDifficulty[i])
{ {
@@ -186,13 +176,9 @@ CString ModeSwitcher::GetNextStyleName()
} }
else else
{ {
switch(GAMESTATE->m_CurStyle) sStyleName[i] = GAMESTATE->m_pCurStyleDef->m_szName;
{ sStyleName[i].MakeUpper();
case STYLE_PUMP_SINGLE: sStyleName[i] = "HALFDOUBLE\n"; break;
case STYLE_PUMP_DOUBLE: sStyleName[i] = "SINGLE\n"; break;
case STYLE_PUMP_HALFDOUBLE: sStyleName[i] = "FULL-DOUBLE\n"; break;
default: sStyleName[i] = ""; break;
}
sDiff[i] = "Beginner\n"; sDiff[i] = "Beginner\n";
} }
} }
@@ -209,22 +195,17 @@ CString ModeSwitcher::GetNextStyleName()
CString ModeSwitcher::GetPrevStyleName() CString ModeSwitcher::GetPrevStyleName()
{ {
CString sStyleName[2]; CString sStyleName[NUM_PLAYERS];
CString sDiff[2]; CString sDiff[NUM_PLAYERS];
for(int i=0; i<2; i++) FOREACH_PlayerNumber(i)
{ {
if(GAMESTATE->IsPlayerEnabled(i)) if(GAMESTATE->IsPlayerEnabled(i))
{ {
if(GAMESTATE->m_PreferredDifficulty[i] != DIFFICULTY_BEGINNER) if(GAMESTATE->m_PreferredDifficulty[i] != DIFFICULTY_BEGINNER)
{ {
switch(GAMESTATE->m_CurStyle) sStyleName[i] = GAMESTATE->m_pCurStyleDef->m_szName;
{ sStyleName[i].MakeUpper();
case STYLE_PUMP_SINGLE: sStyleName[i] = "SINGLE\n"; break;
case STYLE_PUMP_DOUBLE: sStyleName[i] = "FULL-DOUBLE\n"; break;
case STYLE_PUMP_HALFDOUBLE: sStyleName[i] = "HALFDOUBLE\n"; break;
default: sStyleName[i] = ""; break;
}
switch(GAMESTATE->m_PreferredDifficulty[i]) switch(GAMESTATE->m_PreferredDifficulty[i])
{ {
@@ -268,13 +249,9 @@ CString ModeSwitcher::GetPrevStyleName()
} }
else else
{ {
switch(GAMESTATE->m_CurStyle) sStyleName[i] = GAMESTATE->m_pCurStyleDef->m_szName;
{ sStyleName[i].MakeUpper();
case STYLE_PUMP_SINGLE: sStyleName[i] = "FULL-DOUBLE\n"; break;
case STYLE_PUMP_DOUBLE: sStyleName[i] = "HALFDOUBLE\n"; break;
case STYLE_PUMP_HALFDOUBLE: sStyleName[i] = "SINGLE\n"; break;
default: sStyleName[i] = ""; break;
}
sDiff[i] = "Challenge\n"; sDiff[i] = "Challenge\n";
} }
} }
@@ -289,7 +266,7 @@ CString ModeSwitcher::GetPrevStyleName()
return returnval; return returnval;
} }
void ModeSwitcher::NextMode(int pn) void ModeSwitcher::ChangeMode(PlayerNumber pn, int dir)
{ {
if(GAMESTATE->m_CurGame == GAME_PUMP) if(GAMESTATE->m_CurGame == GAME_PUMP)
{ {
@@ -312,87 +289,33 @@ void ModeSwitcher::NextMode(int pn)
else else
{ {
if(GAMESTATE->IsPlayerEnabled(PLAYER_1)) if(GAMESTATE->IsPlayerEnabled(PLAYER_1))
GAMESTATE->m_PreferredDifficulty[PLAYER_1] = DIFFICULTY_BEGINNER; GAMESTATE->m_PreferredDifficulty[PLAYER_1] = DIFFICULTY_CHALLENGE;
if(GAMESTATE->IsPlayerEnabled(PLAYER_2)) if(GAMESTATE->IsPlayerEnabled(PLAYER_2))
GAMESTATE->m_PreferredDifficulty[PLAYER_2] = DIFFICULTY_BEGINNER; GAMESTATE->m_PreferredDifficulty[PLAYER_2] = DIFFICULTY_CHALLENGE;
} }
} }
int iStyle = GAMESTATE->m_CurStyle; // Make a list of all styles for the current Game.
switch(iStyle) vector<const StyleDef*> vPossibleStyles;
GAMEMAN->GetStylesForGame( GAMESTATE->m_CurGame, vPossibleStyles );
ASSERT( !vPossibleStyles.empty() );
int index = 0;
vector<const StyleDef*>::const_iterator iter = find(vPossibleStyles.begin(), vPossibleStyles.end(), GAMESTATE->m_pCurStyleDef );
if( iter != vPossibleStyles.end() )
{ {
case STYLE_PUMP_SINGLE: index = iter - vPossibleStyles.begin();
{ index += dir;
GAMESTATE->m_CurStyle = STYLE_PUMP_HALFDOUBLE; wrap( index, vPossibleStyles.size() );
}
break;
case STYLE_PUMP_HALFDOUBLE:
{
GAMESTATE->m_CurStyle = STYLE_PUMP_DOUBLE;
}
break;
case STYLE_PUMP_DOUBLE:
{
GAMESTATE->m_CurStyle = STYLE_PUMP_SINGLE;
}
break;
} }
GAMESTATE->m_pCurStyleDef = vPossibleStyles[index];
} }
m_Stylename.SetText(GetStyleName()); m_Stylename.SetText(GetStyleName());
m_Nextmode.SetText(GetNextStyleName()); m_Nextmode.SetText(GetNextStyleName());
m_Prevmode.SetText(GetPrevStyleName()); m_Prevmode.SetText(GetPrevStyleName());
} }
void ModeSwitcher::PrevMode(int pn)
{
if(GAMESTATE->IsPlayerEnabled(pn))
{
if(GAMESTATE->m_PreferredDifficulty[pn] != DIFFICULTY_BEGINNER)
{
switch(GAMESTATE->m_PreferredDifficulty[pn])
{
case DIFFICULTY_CHALLENGE: GAMESTATE->m_PreferredDifficulty[pn] = DIFFICULTY_HARD; break;
case DIFFICULTY_EASY: GAMESTATE->m_PreferredDifficulty[pn] = DIFFICULTY_BEGINNER; break;
case DIFFICULTY_MEDIUM: GAMESTATE->m_PreferredDifficulty[pn] = DIFFICULTY_EASY; break;
case DIFFICULTY_HARD: GAMESTATE->m_PreferredDifficulty[pn] = DIFFICULTY_MEDIUM; break;
}
m_Stylename.SetText(GetStyleName());
m_Nextmode.SetText(GetNextStyleName());
m_Prevmode.SetText(GetPrevStyleName());
return;
}
else
{
if(GAMESTATE->IsPlayerEnabled(PLAYER_1))
GAMESTATE->m_PreferredDifficulty[PLAYER_1] = DIFFICULTY_CHALLENGE;
if(GAMESTATE->IsPlayerEnabled(PLAYER_2))
GAMESTATE->m_PreferredDifficulty[PLAYER_2] = DIFFICULTY_CHALLENGE;
}
}
int iStyle = GAMESTATE->m_CurStyle;
switch(iStyle)
{
case STYLE_PUMP_SINGLE:
{
GAMESTATE->m_CurStyle = STYLE_PUMP_DOUBLE;
}
break;
case STYLE_PUMP_HALFDOUBLE:
{
GAMESTATE->m_CurStyle = STYLE_PUMP_SINGLE;
}
break;
case STYLE_PUMP_DOUBLE:
{
GAMESTATE->m_CurStyle = STYLE_PUMP_HALFDOUBLE;
}
break;
}
m_Stylename.SetText(GetStyleName());
m_Nextmode.SetText(GetNextStyleName());
m_Prevmode.SetText(GetPrevStyleName());
}
/* /*
* (c) 2003 "Frieza" * (c) 2003 "Frieza"
+1 -2
View File
@@ -19,8 +19,7 @@ class ModeSwitcher : public ActorFrame
public: public:
ModeSwitcher(); ModeSwitcher();
~ModeSwitcher(); ~ModeSwitcher();
void NextMode(int pn); void ChangeMode(PlayerNumber pn, int dir);
void PrevMode(int pn);
private: private:
BitmapText m_Stylename; BitmapText m_Stylename;
+6 -3
View File
@@ -98,9 +98,12 @@ void MusicWheel::Load()
CIRCLE_PERCENT.Refresh(); CIRCLE_PERCENT.Refresh();
} }
// for debugging /*
if( GAMESTATE->m_CurStyle == STYLE_INVALID ) // for debugging.
GAMESTATE->m_CurStyle = STYLE_DANCE_SINGLE; // Whatever Screen uses MusicWheel should set the Style if it needs to be set.
if( GAMESTATE->m_CurStyle == NULL )
GAMESTATE->m_CurStyle = GAMEMAN->STYLE_DANCE_SINGLE;
*/
m_sprSelectionOverlay.SetName( "Highlight" ); m_sprSelectionOverlay.SetName( "Highlight" );
m_sprSelectionOverlay.Load( THEME->GetPathToG("MusicWheel highlight") ); m_sprSelectionOverlay.Load( THEME->GetPathToG("MusicWheel highlight") );
+3 -4
View File
@@ -10,7 +10,6 @@
#include "GameManager.h" #include "GameManager.h"
#include "IniFile.h" #include "IniFile.h"
#include "Game.h" #include "Game.h"
#include "Style.h"
#include "GameDef.h" #include "GameDef.h"
/* Copies of the current mode. Update this by calling Load. */ /* Copies of the current mode. Update this by calling Load. */
@@ -98,8 +97,8 @@ void NoteFieldMode::Load(IniFile &ini, CString id, int pn)
const Game game = GAMEMAN->StringToGameType( bits[0] ); const Game game = GAMEMAN->StringToGameType( bits[0] );
ASSERT(game != GAME_INVALID); ASSERT(game != GAME_INVALID);
const Style style = GAMEMAN->GameAndStringToStyle( game, bits[1] ); const StyleDef *style = GAMEMAN->GameAndStringToStyle( game, bits[1] );
ASSERT(style != STYLE_INVALID); ASSERT(style != NULL);
Styles.insert(style); Styles.insert(style);
} }
} }
@@ -162,7 +161,7 @@ bool NoteFieldMode::MatchesCurrentGame() const
if(Styles.empty()) if(Styles.empty())
return true; return true;
if(Styles.find(GAMESTATE->m_CurStyle) == Styles.end()) if(Styles.find(GAMESTATE->m_pCurStyleDef) == Styles.end())
return false; return false;
return true; return true;
+1 -2
View File
@@ -4,7 +4,6 @@
#include "PlayerNumber.h" #include "PlayerNumber.h"
#include "StyleDef.h" #include "StyleDef.h"
#include "PlayerNumber.h" #include "PlayerNumber.h"
#include "Style.h"
#include "Actor.h" #include "Actor.h"
#include <set> #include <set>
@@ -27,7 +26,7 @@ struct NoteFieldMode
CString m_Id; CString m_Id;
/* Styles that this is valid for; empty means all. */ /* Styles that this is valid for; empty means all. */
set<Style> Styles; set<const StyleDef*> Styles;
Actor m_Center; Actor m_Center;
Actor m_CenterTrack[MAX_NOTE_TRACKS]; Actor m_CenterTrack[MAX_NOTE_TRACKS];
+16 -14
View File
@@ -98,8 +98,7 @@ void Profile::InitGeneralData()
int i; int i;
for( i=0; i<NUM_PLAY_MODES; i++ ) for( i=0; i<NUM_PLAY_MODES; i++ )
m_iNumSongsPlayedByPlayMode[i] = 0; m_iNumSongsPlayedByPlayMode[i] = 0;
for( i=0; i<NUM_STYLES; i++ ) m_iNumSongsPlayedByStyle.clear();
m_iNumSongsPlayedByStyle[i] = 0;
for( i=0; i<NUM_DIFFICULTIES; i++ ) for( i=0; i<NUM_DIFFICULTIES; i++ )
m_iNumSongsPlayedByDifficulty[i] = 0; m_iNumSongsPlayedByDifficulty[i] = 0;
for( i=0; i<MAX_METER+1; i++ ) for( i=0; i<MAX_METER+1; i++ )
@@ -763,6 +762,10 @@ XNode* Profile::SaveGeneralDataCreateNode() const
pGeneralDataNode->AppendChild( "TotalMines", m_iTotalMines ); pGeneralDataNode->AppendChild( "TotalMines", m_iTotalMines );
pGeneralDataNode->AppendChild( "TotalHands", m_iTotalHands ); pGeneralDataNode->AppendChild( "TotalHands", m_iTotalHands );
// Keep declared variables in a very local scope so they aren't
// accidentally used where they're not intended. There's a lot of
// copying and pasting in this code.
{ {
XNode* pUnlockedSongs = pGeneralDataNode->AppendChild("UnlockedSongs"); XNode* pUnlockedSongs = pGeneralDataNode->AppendChild("UnlockedSongs");
for( set<int>::const_iterator it = m_UnlockedSongs.begin(); it != m_UnlockedSongs.end(); ++it ) for( set<int>::const_iterator it = m_UnlockedSongs.begin(); it != m_UnlockedSongs.end(); ++it )
@@ -782,19 +785,18 @@ XNode* Profile::SaveGeneralDataCreateNode() const
{ {
XNode* pNumSongsPlayedByStyle = pGeneralDataNode->AppendChild("NumSongsPlayedByStyle"); XNode* pNumSongsPlayedByStyle = pGeneralDataNode->AppendChild("NumSongsPlayedByStyle");
for( int i=0; i<NUM_STYLES; i++ ) for( map<const StyleDef*,int>::const_iterator iter = m_iNumSongsPlayedByStyle.begin();
iter != m_iNumSongsPlayedByStyle.end();
iter++ )
{ {
/* Don't save unplayed styles. */ const StyleDef *s = iter->first;
if( !m_iNumSongsPlayedByStyle[i] ) const GameDef *g = GAMEMAN->GetGameDefForGame( s->m_Game );
continue;
XNode *pStyleNode = pNumSongsPlayedByStyle->AppendChild( "Style", m_iNumSongsPlayedByStyle[i] );
const StyleDef *pStyle = GAMEMAN->GetStyleDefForStyle((Style)i);
const GameDef *g = GAMEMAN->GetGameDefForGame( pStyle->m_Game );
ASSERT( g ); ASSERT( g );
int iNumPlays = iter->second;
XNode *pStyleNode = pNumSongsPlayedByStyle->AppendChild( "Style", iNumPlays );
pStyleNode->AppendAttr( "Game", g->m_szName ); pStyleNode->AppendAttr( "Game", g->m_szName );
pStyleNode->AppendAttr( "Style", pStyle->m_szName ); pStyleNode->AppendAttr( "Style", s->m_szName );
} }
} }
@@ -943,8 +945,8 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
CString sStyle; CString sStyle;
if( !style->GetAttrValue( "Style", sStyle ) ) if( !style->GetAttrValue( "Style", sStyle ) )
WARN_AND_CONTINUE; WARN_AND_CONTINUE;
Style s = GAMEMAN->GameAndStringToStyle( g, sStyle ); const StyleDef* s = GAMEMAN->GameAndStringToStyle( g, sStyle );
if( s == STYLE_INVALID ) if( s == NULL )
WARN_AND_CONTINUE; WARN_AND_CONTINUE;
style->GetValue( m_iNumSongsPlayedByStyle[s] ); style->GetValue( m_iNumSongsPlayedByStyle[s] );
+2 -2
View File
@@ -4,7 +4,6 @@
#define Profile_H #define Profile_H
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "Style.h"
#include "Grade.h" #include "Grade.h"
#include <map> #include <map>
#include <set> #include <set>
@@ -41,6 +40,7 @@ const CString PUBLIC_KEY_FILE = "public.key";
const CString SCREENSHOTS_SUBDIR = "Screenshots/"; const CString SCREENSHOTS_SUBDIR = "Screenshots/";
const CString EDITS_SUBDIR = "Edits/"; const CString EDITS_SUBDIR = "Edits/";
class StyleDef;
class Song; class Song;
class Steps; class Steps;
@@ -111,7 +111,7 @@ public:
set<int> m_UnlockedSongs; set<int> m_UnlockedSongs;
mutable CString m_sLastPlayedMachineGuid; // mutable because we overwrite this on save, and I don't want to remove const from the whole save chain. -Chris mutable CString m_sLastPlayedMachineGuid; // mutable because we overwrite this on save, and I don't want to remove const from the whole save chain. -Chris
int m_iNumSongsPlayedByPlayMode[NUM_PLAY_MODES]; int m_iNumSongsPlayedByPlayMode[NUM_PLAY_MODES];
int m_iNumSongsPlayedByStyle[NUM_STYLES]; map<const StyleDef*,int> m_iNumSongsPlayedByStyle;
int m_iNumSongsPlayedByDifficulty[NUM_DIFFICULTIES]; int m_iNumSongsPlayedByDifficulty[NUM_DIFFICULTIES];
int m_iNumSongsPlayedByMeter[MAX_METER+1]; int m_iNumSongsPlayedByMeter[MAX_METER+1];
int m_iNumSongsPassedByPlayMode[NUM_PLAY_MODES]; int m_iNumSongsPassedByPlayMode[NUM_PLAY_MODES];
+7 -6
View File
@@ -359,19 +359,20 @@ void PrintStatistics( RageFile &f, const Profile *pProfile, CString sTitle, vect
PRINT_OPEN(f,"Num Songs Played by Style"); PRINT_OPEN(f,"Num Songs Played by Style");
{ {
BEGIN_TABLE(4); BEGIN_TABLE(4);
for( Style style = (Style)0; style<NUM_STYLES; ((int&)style)++ )
for( map<const StyleDef*,int>::const_iterator iter = pProfile->m_iNumSongsPlayedByStyle.begin();
iter != pProfile->m_iNumSongsPlayedByStyle.end();
iter++ )
{ {
const StyleDef* pStyleDef = GAMEMAN->GetStyleDefForStyle(style); const StyleDef* pStyleDef = iter->first;
int iNumTimesPlayed = iter->second;
StepsType st = pStyleDef->m_StepsType; StepsType st = pStyleDef->m_StepsType;
if( !pStyleDef->m_bUsedForGameplay )
continue; // skip
// only show if this style plays a StepsType that we're showing // only show if this style plays a StepsType that we're showing
if( find(vStepsTypesToShow.begin(),vStepsTypesToShow.end(),st) == vStepsTypesToShow.end() ) if( find(vStepsTypesToShow.begin(),vStepsTypesToShow.end(),st) == vStepsTypesToShow.end() )
continue; // skip continue; // skip
if( StylesToShow.find(pStyleDef->m_szName) == StylesToShow.end() ) if( StylesToShow.find(pStyleDef->m_szName) == StylesToShow.end() )
continue; continue;
CString s = GAMEMAN->StyleToThemedString(style); TABLE_LINE2( GAMEMAN->StyleToThemedString(pStyleDef), iNumTimesPlayed );
TABLE_LINE2( s, pProfile->m_iNumSongsPlayedByStyle[style] );
} }
END_TABLE; END_TABLE;
} }
-1
View File
@@ -5,7 +5,6 @@
#include "PlayerNumber.h" #include "PlayerNumber.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "Style.h"
#include "Profile.h" #include "Profile.h"
class Song; class Song;
+1 -1
View File
@@ -20,7 +20,7 @@ const ScreenMessage SM_NotesEnded = ScreenMessage(SM_User+10); // MUST be sam
bool PrepareForDemonstration() // always return true. bool PrepareForDemonstration() // always return true.
{ {
GAMESTATE->m_CurStyle = GAMEMAN->GetDemonstrationStyleForGame(GAMESTATE->m_CurGame); GAMESTATE->m_pCurStyleDef = GAMEMAN->GetDemonstrationStyleForGame(GAMESTATE->m_CurGame);
GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR; GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR;
+1 -1
View File
@@ -105,7 +105,7 @@ void ScreenEditMenu::MenuStart( PlayerNumber pn )
EditMenu::Action action = m_Selector.GetSelectedAction(); EditMenu::Action action = m_Selector.GetSelectedAction();
GAMESTATE->m_pCurSong = pSong; GAMESTATE->m_pCurSong = pSong;
GAMESTATE->m_CurStyle = GAMEMAN->GetEditorStyleForNotesType( st ); GAMESTATE->m_pCurStyleDef = GAMEMAN->GetEditorStyleForNotesType( st );
GAMESTATE->m_pCurSteps[PLAYER_1] = pSteps; GAMESTATE->m_pCurSteps[PLAYER_1] = pSteps;
// //
+1 -1
View File
@@ -102,7 +102,7 @@ ScreenEnding::ScreenEnding( CString sClassName ) : ScreenAttract( sClassName, fa
PROFILEMAN->LoadFirstAvailableProfile(PLAYER_2, false); PROFILEMAN->LoadFirstAvailableProfile(PLAYER_2, false);
GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR; GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR;
GAMESTATE->m_CurStyle = STYLE_DANCE_VERSUS; GAMESTATE->m_pCurStyleDef = GAMEMAN->GameAndStringToStyle( GAME_DANCE, "versus" );
GAMESTATE->m_bSideIsJoined[PLAYER_1] = true; GAMESTATE->m_bSideIsJoined[PLAYER_1] = true;
GAMESTATE->m_bSideIsJoined[PLAYER_2] = true; GAMESTATE->m_bSideIsJoined[PLAYER_2] = true;
GAMESTATE->m_MasterPlayerNumber = PLAYER_1; GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
+1 -1
View File
@@ -101,7 +101,7 @@ void ScreenEvaluation::Init()
PROFILEMAN->LoadFirstAvailableProfile(PLAYER_2, false); PROFILEMAN->LoadFirstAvailableProfile(PLAYER_2, false);
GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR; GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR;
GAMESTATE->m_CurStyle = STYLE_DANCE_VERSUS; GAMESTATE->m_pCurStyleDef = GAMEMAN->GameAndStringToStyle( GAME_DANCE, "versus" );
GAMESTATE->m_bSideIsJoined[PLAYER_1] = true; GAMESTATE->m_bSideIsJoined[PLAYER_1] = true;
GAMESTATE->m_bSideIsJoined[PLAYER_2] = true; GAMESTATE->m_bSideIsJoined[PLAYER_2] = true;
GAMESTATE->m_MasterPlayerNumber = PLAYER_1; GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
+2 -2
View File
@@ -511,7 +511,7 @@ void ScreenEz2SelectMusic::EasierDifficulty( PlayerNumber pn )
{ {
if(USE_MODE_SWITCHER == 1) if(USE_MODE_SWITCHER == 1)
{ {
m_ModeSwitcher.PrevMode(pn); m_ModeSwitcher.ChangeMode(pn,-1);
MusicChanged(); MusicChanged();
m_MusicBannerWheel.StopBouncing(); m_MusicBannerWheel.StopBouncing();
SOUND->StopMusic(); SOUND->StopMusic();
@@ -548,7 +548,7 @@ void ScreenEz2SelectMusic::HarderDifficulty( PlayerNumber pn )
{ {
if(USE_MODE_SWITCHER == 1) if(USE_MODE_SWITCHER == 1)
{ {
m_ModeSwitcher.NextMode(pn); m_ModeSwitcher.ChangeMode(pn,+1);
MusicChanged(); MusicChanged();
m_MusicBannerWheel.StopBouncing(); m_MusicBannerWheel.StopBouncing();
SOUND->StopMusic(); SOUND->StopMusic();
+1 -1
View File
@@ -222,7 +222,7 @@ void ScreenGameplay::Init()
g_CurStageStats.pSong = NULL; // set in LoadNextSong g_CurStageStats.pSong = NULL; // set in LoadNextSong
g_CurStageStats.playMode = GAMESTATE->m_PlayMode; g_CurStageStats.playMode = GAMESTATE->m_PlayMode;
g_CurStageStats.style = GAMESTATE->m_CurStyle; g_CurStageStats.pStyleDef = GAMESTATE->m_pCurStyleDef;
FOREACH_EnabledPlayer(p) FOREACH_EnabledPlayer(p)
{ {
+1 -1
View File
@@ -130,7 +130,7 @@ ScreenHowToPlay::ScreenHowToPlay( CString sName ) : ScreenAttract( sName )
m_pLifeMeterBar->FillForHowToPlay( NUM_PERFECTS, NUM_MISSES ); m_pLifeMeterBar->FillForHowToPlay( NUM_PERFECTS, NUM_MISSES );
} }
GAMESTATE->m_CurStyle = GAMEMAN->GetHowToPlayStyleForGame(GAMESTATE->m_CurGame); GAMESTATE->m_pCurStyleDef = GAMEMAN->GetHowToPlayStyleForGame(GAMESTATE->m_CurGame);
if( USEPLAYER ) if( USEPLAYER )
{ {
+1 -1
View File
@@ -96,7 +96,7 @@ bool ScreenJukebox::SetSong( bool bDemonstration )
bool ScreenJukebox::PrepareForJukebox( bool bDemonstration ) // always return true. bool ScreenJukebox::PrepareForJukebox( bool bDemonstration ) // always return true.
{ {
// ScreeJukeboxMenu must set this // ScreeJukeboxMenu must set this
ASSERT( GAMESTATE->m_CurStyle != STYLE_INVALID ); ASSERT( GAMESTATE->m_pCurStyleDef );
GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR; GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR;
SetSong( bDemonstration ); SetSong( bDemonstration );
+6 -6
View File
@@ -22,7 +22,7 @@ ScreenJukeboxMenu::ScreenJukeboxMenu( CString sClassName ) : ScreenWithMenuEleme
{ {
LOG->Trace( "ScreenJukeboxMenu::ScreenJukeboxMenu()" ); LOG->Trace( "ScreenJukeboxMenu::ScreenJukeboxMenu()" );
GAMESTATE->m_CurStyle = STYLE_INVALID; GAMESTATE->m_pCurStyleDef = NULL;
FOREACH_PlayerNumber( pn ) FOREACH_PlayerNumber( pn )
GAMESTATE->m_bSideIsJoined[pn] = true; GAMESTATE->m_bSideIsJoined[pn] = true;
@@ -84,12 +84,12 @@ void ScreenJukeboxMenu::MenuStart( PlayerNumber pn )
if( IsTransitioning() ) if( IsTransitioning() )
return; return;
Style style = m_Selector.GetSelectedStyle(); const StyleDef *style = m_Selector.GetSelectedStyle();
CString sGroup = m_Selector.GetSelectedGroup(); CString sGroup = m_Selector.GetSelectedGroup();
Difficulty dc = m_Selector.GetSelectedDifficulty(); Difficulty dc = m_Selector.GetSelectedDifficulty();
bool bModifiers = m_Selector.GetSelectedModifiers(); bool bModifiers = m_Selector.GetSelectedModifiers();
GAMESTATE->m_CurStyle = style; GAMESTATE->m_pCurStyleDef = style;
GAMESTATE->m_sPreferredGroup = (sGroup=="ALL MUSIC") ? GROUP_ALL_MUSIC : sGroup; GAMESTATE->m_sPreferredGroup = (sGroup=="ALL MUSIC") ? GROUP_ALL_MUSIC : sGroup;
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
GAMESTATE->m_PreferredDifficulty[p] = dc; GAMESTATE->m_PreferredDifficulty[p] = dc;
+1 -1
View File
@@ -131,7 +131,7 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
GAMESTATE->m_bSideIsJoined[PLAYER_2] = true; GAMESTATE->m_bSideIsJoined[PLAYER_2] = true;
GAMESTATE->m_MasterPlayerNumber = PLAYER_1; GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR; GAMESTATE->m_PlayMode = PLAY_MODE_REGULAR;
GAMESTATE->m_CurStyle = STYLE_DANCE_VERSUS; GAMESTATE->m_pCurStyleDef = GAMEMAN->GameAndStringToStyle( GAME_DANCE, "versus" );
StageStats ss; StageStats ss;
for( int z = 0; z < 3; ++z ) for( int z = 0; z < 3; ++z )
{ {
+1 -1
View File
@@ -379,7 +379,7 @@ void ScreenOptions::Init( InputMode im, OptionRowData OptionRows[], int iNumOpti
/* Hack: if m_CurStyle is set, we're probably in the player or song options menu, so /* Hack: if m_CurStyle is set, we're probably in the player or song options menu, so
* the player name is meaningful. Otherwise, we're probably in the system menu. */ * the player name is meaningful. Otherwise, we're probably in the system menu. */
if( GAMESTATE->m_CurStyle != STYLE_INVALID ) if( GAMESTATE->m_pCurStyleDef != NULL )
{ {
FOREACH_HumanPlayer( p ) FOREACH_HumanPlayer( p )
{ {
-1
View File
@@ -3,7 +3,6 @@
#include "ScreenAttract.h" #include "ScreenAttract.h"
#include "GameConstantsAndTypes.h" // for NUM_RANKING_LINES #include "GameConstantsAndTypes.h" // for NUM_RANKING_LINES
#include "Style.h"
#include "Sprite.h" #include "Sprite.h"
#include "BitmapText.h" #include "BitmapText.h"
#include "Banner.h" #include "Banner.h"
+2 -2
View File
@@ -178,8 +178,8 @@ void ScreenSelect::FinalizeChoices()
{ {
const int sel = GetSelectionIndex( (PlayerNumber)p ); const int sel = GetSelectionIndex( (PlayerNumber)p );
if( m_aModeChoices[sel].m_style != STYLE_INVALID ) if( m_aModeChoices[sel].m_pStyleDef )
GAMESTATE->m_CurStyle = m_aModeChoices[sel].m_style; GAMESTATE->m_pCurStyleDef = m_aModeChoices[sel].m_pStyleDef;
} }
SCREENMAN->RefreshCreditsMessages(); SCREENMAN->RefreshCreditsMessages();
} }
+1 -1
View File
@@ -194,7 +194,7 @@ void ScreenSelectMode::UpdateSelectableChoices()
// FIXME for new premium prefs // FIXME for new premium prefs
const int SidesJoinedToPlay = const int SidesJoinedToPlay =
(mc.m_style == STYLE_INVALID) ? (mc.m_pStyleDef == NULL) ?
1 : 1 :
1; 1;
if( PREFSMAN->GetPremium()!=PrefsManager::JOINT_PREMIUM || if( PREFSMAN->GetPremium()!=PrefsManager::JOINT_PREMIUM ||
+1 -1
View File
@@ -65,7 +65,7 @@ ScreenSelectMusic::ScreenSelectMusic( CString sClassName ) : ScreenWithMenuEleme
/* Cache: */ /* Cache: */
g_sFallbackCDTitlePath = THEME->GetPathG(m_sName,"fallback cdtitle"); g_sFallbackCDTitlePath = THEME->GetPathG(m_sName,"fallback cdtitle");
if( GAMESTATE->m_CurStyle == STYLE_INVALID ) if( GAMESTATE->m_pCurStyleDef == NULL )
RageException::Throw( "The Style has not been set. A theme must set the Style before loading ScreenSelectMusic." ); RageException::Throw( "The Style has not been set. A theme must set the Style before loading ScreenSelectMusic." );
if( GAMESTATE->m_PlayMode == PLAY_MODE_INVALID ) if( GAMESTATE->m_PlayMode == PLAY_MODE_INVALID )
+1 -1
View File
@@ -36,7 +36,7 @@ ScreenWithMenuElements::ScreenWithMenuElements( CString sClassName ) : Screen( s
UtilOnCommand( m_autoHeader, m_sName ); UtilOnCommand( m_autoHeader, m_sName );
this->AddChild( m_autoHeader ); this->AddChild( m_autoHeader );
if( STYLE_ICON && GAMESTATE->m_CurStyle != STYLE_INVALID ) if( STYLE_ICON && GAMESTATE->m_pCurStyleDef )
{ {
CString sIconFileName = ssprintf("MenuElements icon %s", GAMESTATE->GetCurrentStyleDef()->m_szName ); CString sIconFileName = ssprintf("MenuElements icon %s", GAMESTATE->GetCurrentStyleDef()->m_szName );
m_sprStyleIcon.SetName( "StyleIcon" ); m_sprStyleIcon.SetName( "StyleIcon" );
+1 -1
View File
@@ -12,7 +12,7 @@ vector<StageStats> g_vPlayedStageStats;
void StageStats::Init() void StageStats::Init()
{ {
playMode = PLAY_MODE_INVALID; playMode = PLAY_MODE_INVALID;
style = STYLE_INVALID; pStyleDef = NULL;
pSong = NULL; pSong = NULL;
StageType = STAGE_INVALID; StageType = STAGE_INVALID;
fGameplaySeconds = 0; fGameplaySeconds = 0;
+2 -3
View File
@@ -6,11 +6,10 @@
#include "PlayerNumber.h" #include "PlayerNumber.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "Grade.h" #include "Grade.h"
#include "Style.h"
#include <map> #include <map>
class Song; class Song;
class Steps; class Steps;
class StyleDef;
struct StageStats struct StageStats
{ {
@@ -24,7 +23,7 @@ struct StageStats
float GetPercentDancePoints( PlayerNumber pn ) const; float GetPercentDancePoints( PlayerNumber pn ) const;
PlayMode playMode; PlayMode playMode;
Style style; const StyleDef* pStyleDef;
Song* pSong; Song* pSong;
enum { STAGE_INVALID, STAGE_NORMAL, STAGE_EXTRA, STAGE_EXTRA2 } StageType; enum { STAGE_INVALID, STAGE_NORMAL, STAGE_EXTRA, STAGE_EXTRA2 } StageType;
Steps* pSteps[NUM_PLAYERS]; Steps* pSteps[NUM_PLAYERS];
-76
View File
@@ -1,76 +0,0 @@
#ifndef STYLE_H
#define STYLE_H
enum Style
{
STYLE_DANCE_SINGLE,
STYLE_DANCE_VERSUS,
STYLE_DANCE_DOUBLE,
STYLE_DANCE_COUPLE,
STYLE_DANCE_SOLO,
STYLE_DANCE_EDIT_COUPLE,
STYLE_PUMP_SINGLE,
STYLE_PUMP_VERSUS,
STYLE_PUMP_HALFDOUBLE,
STYLE_PUMP_DOUBLE,
STYLE_PUMP_COUPLE,
STYLE_PUMP_EDIT_COUPLE,
STYLE_EZ2_SINGLE,
STYLE_EZ2_REAL,
STYLE_EZ2_SINGLE_VERSUS,
STYLE_EZ2_REAL_VERSUS,
STYLE_EZ2_DOUBLE,
STYLE_PARA_SINGLE,
STYLE_DS3DDX_SINGLE,
STYLE_BM_SINGLE,
STYLE_BM_DOUBLE,
STYLE_IIDX_SINGLE7,
STYLE_IIDX_DOUBLE7,
STYLE_IIDX_SINGLE5,
STYLE_IIDX_DOUBLE5,
STYLE_IIDX_EDIT_SINGLE5,
STYLE_IIDX_EDIT_DOUBLE5,
STYLE_MANIAX_SINGLE,
STYLE_MANIAX_VERSUS,
STYLE_MANIAX_DOUBLE,
STYLE_TECHNO_SINGLE4,
STYLE_TECHNO_SINGLE5,
STYLE_TECHNO_SINGLE8,
STYLE_TECHNO_VERSUS4,
STYLE_TECHNO_VERSUS5,
STYLE_TECHNO_VERSUS8,
STYLE_TECHNO_DOUBLE4,
STYLE_TECHNO_DOUBLE5,
STYLE_PNM_FIVE,
STYLE_PNM_NINE,
STYLE_LIGHTS_CABINET,
NUM_STYLES, // leave this at the end
STYLE_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.
*/
+2
View File
@@ -51,6 +51,8 @@ public:
}; };
ColumnInfo m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; // maps each players' column to a track in the NoteData ColumnInfo m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; // maps each players' column to a track in the NoteData
int m_iColumnDrawOrder[MAX_COLS_PER_PLAYER]; int m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
bool m_bNeedsZoomOutWith2Players;
bool m_bCanUseBeginnerHelper;
GameInput StyleInputToGameInput( const StyleInput& StyleI ) const; GameInput StyleInputToGameInput( const StyleInput& StyleI ) const;
StyleInput GameInputToStyleInput( const GameInput &GameI ) const; StyleInput GameInputToStyleInput( const GameInput &GameI ) const;