Decouple <cstddef>

This commit is contained in:
Martin Natano
2023-04-19 23:04:25 +02:00
parent 093675cdc3
commit 78fb2e9fc3
171 changed files with 2012 additions and 1786 deletions
+61 -59
View File
@@ -14,9 +14,11 @@
#include "Game.h"
#include "Style.h"
#include <cstddef>
GameManager* GAMEMAN = nullptr; // global and accessable from anywhere in our program
enum
enum
{
TRACK_1 = 0,
TRACK_2,
@@ -405,7 +407,7 @@ static const Style g_Style_Dance_ThreePanel =
// todo: re-enable? (lol)
/*
static const Style g_Style_Dance_Solo_Versus =
{ // STYLE_DANCE_SOLO_VERSUS
{ // STYLE_DANCE_SOLO_VERSUS
"dance-solo-versus", // m_szName
StepsType_dance_solo, // m_StepsType
ONE_PLAYER_ONE_CREDIT, // m_StyleType
@@ -495,7 +497,7 @@ static const Style *g_apGame_Dance_Styles[] =
nullptr
};
static const Game g_Game_Dance =
static const Game g_Game_Dance =
{
"dance", // m_szName
g_apGame_Dance_Styles, // m_apStyles
@@ -860,7 +862,7 @@ static const Style *g_apGame_Pump_Styles[] =
nullptr
};
static const Game g_Game_Pump =
static const Game g_Game_Pump =
{
"pump", // m_szName
g_apGame_Pump_Styles, // m_apStyles
@@ -1041,7 +1043,7 @@ static const Style *g_apGame_KB7_Styles[] =
nullptr
};
static const Game g_Game_KB7 =
static const Game g_Game_KB7 =
{
"kb7", // m_szName
g_apGame_KB7_Styles, // m_apStyles
@@ -1114,7 +1116,7 @@ static const Style g_Style_Ez2_Single =
{ 0, 4, 2, 1, 3, Style::END_MAPPING },
},
{ // 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_bCanUseBeginnerHelper
false, // m_bLockDifficulties
@@ -1134,18 +1136,18 @@ static const Style g_Style_Ez2_Real =
{ // PLAYER_1
{ TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, nullptr },
{ TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, nullptr },
{ TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, nullptr },
{ TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, nullptr },
{ TRACK_4, +EZ2_REAL_COL_SPACING*0.0f, nullptr },
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, nullptr },
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, nullptr },
{ TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, nullptr },
{ TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, nullptr },
},
{ // PLAYER_2
{ TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, nullptr },
{ TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, nullptr },
{ TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, nullptr },
{ TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, nullptr },
{ TRACK_4, +EZ2_REAL_COL_SPACING*0.0f, nullptr },
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, nullptr },
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, nullptr },
{ TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, nullptr },
{ TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, nullptr },
},
@@ -1192,7 +1194,7 @@ static const Style g_Style_Ez2_Single_Versus =
{ 0, 4, 2, 1, 3, Style::END_MAPPING },
},
{ // 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_bCanUseBeginnerHelper
false, // m_bLockDifficulties
@@ -1212,18 +1214,18 @@ static const Style g_Style_Ez2_Real_Versus =
{ // PLAYER_1
{ TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, nullptr },
{ TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, nullptr },
{ TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, nullptr },
{ TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, nullptr },
{ TRACK_4, +EZ2_REAL_COL_SPACING*0.0f, nullptr },
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, nullptr },
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, nullptr },
{ TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, nullptr },
{ TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, nullptr },
},
{ // PLAYER_2
{ TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, nullptr },
{ TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, nullptr },
{ TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, nullptr },
{ TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, nullptr },
{ TRACK_4, +EZ2_REAL_COL_SPACING*0.0f, nullptr },
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, nullptr },
{ TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, nullptr },
{ TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, nullptr },
{ TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, nullptr },
},
@@ -1233,7 +1235,7 @@ static const Style g_Style_Ez2_Real_Versus =
{ 0, 6, 3, 2, 4, 1, 5, Style::END_MAPPING },
},
{ // 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_bCanUseBeginnerHelper
false, // m_bLockDifficulties
@@ -1280,7 +1282,7 @@ static const Style g_Style_Ez2_Double =
{ 5, 9, 7, 6, 8, Style::END_MAPPING },
},
{ // 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_bCanUseBeginnerHelper
false, // m_bLockDifficulties
@@ -1309,7 +1311,7 @@ static const AutoMappings g_AutoKeyMappings_Ez2 = AutoMappings (
AutoMappingEntry( 0, KEY_Cf, EZ2_BUTTON_HANDLRRIGHT, false )
);
static const Game g_Game_Ez2 =
static const Game g_Game_Ez2 =
{
"ez2", // m_szName
g_apGame_Ez2_Styles, // m_apStyles
@@ -1380,7 +1382,7 @@ static const Style g_Style_Para_Single =
{ 0, 1, 2, 3, 4, Style::END_MAPPING },
},
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
2,0,4,1,3
2,0,4,1,3
},
false, // m_bCanUseBeginnerHelper
false, // m_bLockDifficulties
@@ -1417,7 +1419,7 @@ static const Style g_Style_Para_Versus =
{ 0, 1, 2, 3, 4, Style::END_MAPPING },
},
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
2,0,4,1,3
2,0,4,1,3
},
false, // m_bCanUseBeginnerHelper
false, // m_bLockDifficulties
@@ -1441,7 +1443,7 @@ static const AutoMappings g_AutoKeyMappings_Para = AutoMappings (
AutoMappingEntry( 0, KEY_Cb, PARA_BUTTON_RIGHT, false )
);
static const Game g_Game_Para =
static const Game g_Game_Para =
{
"para", // m_szName
g_apGame_Para_Styles, // m_apStyles
@@ -1539,7 +1541,7 @@ static const AutoMappings g_AutoKeyMappings_DS3DDX = AutoMappings (
AutoMappingEntry( 0, KEY_Cd, DS3DDX_BUTTON_HANDRIGHT, false )
);
static const Game g_Game_DS3DDX =
static const Game g_Game_DS3DDX =
{
"ds3ddx", // m_szName
g_apGame_DS3DDX_Styles, // m_apStyles
@@ -1880,7 +1882,7 @@ static const AutoMappings g_AutoKeyMappings_Beat = AutoMappings (
AutoMappingEntry( 0, KEY_SPACE, BEAT_BUTTON_SCRATCHUP, false )
);
static const Game g_Game_Beat =
static const Game g_Game_Beat =
{
"beat", // m_szName
g_apGame_Beat_Styles, // m_apStyles
@@ -2058,7 +2060,7 @@ static const AutoMappings g_AutoKeyMappings_Maniax = AutoMappings (
AutoMappingEntry( 0, KEY_KP_C2, MANIAX_BUTTON_HANDLRRIGHT, true )
);
static const Game g_Game_Maniax =
static const Game g_Game_Maniax =
{
"maniax", // m_szName
g_apGame_Maniax_Styles, // m_apStyles
@@ -2529,7 +2531,7 @@ static const AutoMappings g_AutoKeyMappings_Techno = AutoMappings (
AutoMappingEntry( 0, KEY_KP_C3, TECHNO_BUTTON_DOWNRIGHT,true )
);
static const Game g_Game_Techno =
static const Game g_Game_Techno =
{
"techno", // m_szName
g_apGame_Techno_Styles, // m_apStyles
@@ -2572,9 +2574,9 @@ static const Game g_Game_Techno =
/** popn *********************************************************************/
//ThemeMetric<int> POPN5_COL_SPACING ("ColumnSpacing","Popn5");
static const int POPN5_COL_SPACING = 32;
static const int POPN5_COL_SPACING = 32;
//ThemeMetric<int> POPN9_COL_SPACING ("ColumnSpacing","Popn9");
static const int POPN9_COL_SPACING = 32;
static const int POPN9_COL_SPACING = 32;
static const Style g_Style_Popn_Five =
{ // STYLE_POPN_FIVE
true, // m_bUsedForGameplay
@@ -2679,7 +2681,7 @@ static const AutoMappings g_AutoKeyMappings_Popn = AutoMappings (
AutoMappingEntry( 0, KEY_Cb, POPN_BUTTON_RIGHT_WHITE,false )
);
static const Game g_Game_Popn =
static const Game g_Game_Popn =
{
"popn", // m_szName
g_apGame_Popn_Styles, // m_apStyles
@@ -2785,7 +2787,7 @@ static const Style *g_apGame_Lights_Styles[] =
nullptr
};
static const Game g_Game_Lights =
static const Game g_Game_Lights =
{
"lights", // m_szName
g_apGame_Lights_Styles, // m_apStyles
@@ -3211,7 +3213,7 @@ static const Game g_Game_Kickbox =
TNS_W5, // m_mapW5To
};
static const Game *g_Games[] =
static const Game *g_Games[] =
{
&g_Game_Dance,
&g_Game_Pump,
@@ -3252,12 +3254,12 @@ GameManager::~GameManager()
void GameManager::GetStylesForGame( const Game *pGame, std::vector<const Style*>& aStylesAddTo, bool editor )
{
for( int s=0; pGame->m_apStyles[s]; ++s )
for( int s=0; pGame->m_apStyles[s]; ++s )
{
const Style *style = pGame->m_apStyles[s];
if( !editor && !style->m_bUsedForGameplay )
if( !editor && !style->m_bUsedForGameplay )
continue;
if( editor && !style->m_bUsedForEdit )
if( editor && !style->m_bUsedForEdit )
continue;
aStylesAddTo.push_back( style );
@@ -3266,10 +3268,10 @@ void GameManager::GetStylesForGame( const Game *pGame, std::vector<const Style*>
const Game *GameManager::GetGameForStyle( const Style *pStyle )
{
for( size_t g=0; g<ARRAYLEN(g_Games); ++g )
for( std::size_t g=0; g<ARRAYLEN(g_Games); ++g )
{
const Game *pGame = g_Games[g];
for( int s=0; pGame->m_apStyles[s]; ++s )
for( int s=0; pGame->m_apStyles[s]; ++s )
{
if( pGame->m_apStyles[s] == pStyle )
return pGame;
@@ -3280,10 +3282,10 @@ const Game *GameManager::GetGameForStyle( const Style *pStyle )
const Style* GameManager::GetEditorStyleForStepsType( StepsType st )
{
for( size_t g=0; g<ARRAYLEN(g_Games); ++g )
for( std::size_t g=0; g<ARRAYLEN(g_Games); ++g )
{
const Game *pGame = g_Games[g];
for( int s=0; pGame->m_apStyles[s]; ++s )
for( int s=0; pGame->m_apStyles[s]; ++s )
{
const Style *style = pGame->m_apStyles[s];
if( style->m_StepsType == st && style->m_bUsedForEdit )
@@ -3302,14 +3304,14 @@ void GameManager::GetStepsTypesForGame( const Game *pGame, std::vector<StepsType
{
StepsType st = pGame->m_apStyles[i]->m_StepsType;
ASSERT(st < NUM_StepsType);
// Some Styles use the same StepsType (e.g. single and versus) so check
// that we aren't doubling up.
bool found = false;
for( unsigned j=0; j < aStepsTypeAddTo.size(); j++ )
if( st == aStepsTypeAddTo[j] ) { found = true; break; }
if(found) continue;
aStepsTypeAddTo.push_back( st );
}
}
@@ -3318,19 +3320,19 @@ void GameManager::GetDemonstrationStylesForGame( const Game *pGame, std::vector<
{
vpStylesOut.clear();
for( int s=0; pGame->m_apStyles[s]; ++s )
for( int s=0; pGame->m_apStyles[s]; ++s )
{
const Style *style = pGame->m_apStyles[s];
if( style->m_bUsedForDemonstration )
vpStylesOut.push_back( style );
}
ASSERT( vpStylesOut.size()>0 ); // this Game is missing a Style that can be used with the demonstration
}
const Style* GameManager::GetHowToPlayStyleForGame( const Game *pGame )
{
for( int s=0; pGame->m_apStyles[s]; ++s )
for( int s=0; pGame->m_apStyles[s]; ++s )
{
const Style *style = pGame->m_apStyles[s];
if( style->m_bUsedForHowToPlay )
@@ -3361,7 +3363,7 @@ void GameManager::GetCompatibleStyles( const Game *pGame, int iNumPlayers, std::
if( iNumPlayers != iNumPlayersRequired )
continue;
for( int s=0; pGame->m_apStyles[s]; ++s )
for( int s=0; pGame->m_apStyles[s]; ++s )
{
const Style *style = pGame->m_apStyles[s];
if( style->m_StyleType != styleType )
@@ -3391,7 +3393,7 @@ const Style *GameManager::GetFirstCompatibleStyle( const Game *pGame, int iNumPl
void GameManager::GetEnabledGames( std::vector<const Game*>& aGamesOut )
{
for( size_t g=0; g<ARRAYLEN(g_Games); ++g )
for( std::size_t g=0; g<ARRAYLEN(g_Games); ++g )
{
const Game *pGame = g_Games[g];
if( IsGameEnabled( pGame ) )
@@ -3404,7 +3406,7 @@ const Game* GameManager::GetDefaultGame()
const Game *pDefault = nullptr;
if( pDefault == nullptr )
{
for( size_t i=0; pDefault == nullptr && i < ARRAYLEN(g_Games); ++i )
for( std::size_t i=0; pDefault == nullptr && i < ARRAYLEN(g_Games); ++i )
{
if( IsGameEnabled(g_Games[i]) )
pDefault = g_Games[i];
@@ -3413,13 +3415,13 @@ const Game* GameManager::GetDefaultGame()
if( pDefault == nullptr )
RageException::Throw( "No NoteSkins found" );
}
return pDefault;
}
int GameManager::GetIndexFromGame( const Game* pGame )
{
for( size_t g=0; g<ARRAYLEN(g_Games); ++g )
for( std::size_t g=0; g<ARRAYLEN(g_Games); ++g )
{
if( g_Games[g] == pGame )
return g;
@@ -3468,7 +3470,7 @@ RString GameManager::StyleToLocalizedString( const Style* style )
const Game* GameManager::StringToGame( RString sGame )
{
for( size_t i=0; i<ARRAYLEN(g_Games); ++i )
for( std::size_t i=0; i<ARRAYLEN(g_Games); ++i )
if( !sGame.CompareNoCase(g_Games[i]->m_szName) )
return g_Games[i];
@@ -3478,7 +3480,7 @@ const Game* GameManager::StringToGame( RString sGame )
const Style* GameManager::GameAndStringToStyle( const Game *game, RString sStyle )
{
for( int s=0; game->m_apStyles[s]; ++s )
for( int s=0; game->m_apStyles[s]; ++s )
{
const Style* style = game->m_apStyles[s];
if( sStyle.CompareNoCase(style->m_szName) == 0 )
@@ -3491,7 +3493,7 @@ const Style* GameManager::GameAndStringToStyle( const Game *game, RString sStyle
// lua start
#include "LuaBinding.h"
/** @brief Allow Lua to have access to the GameManager. */
/** @brief Allow Lua to have access to the GameManager. */
class LunaGameManager: public Luna<GameManager>
{
public:
@@ -3504,7 +3506,7 @@ public:
p->GetStepsTypesForGame( pGame, vstAddTo );
ASSERT( !vstAddTo.empty() );
StepsType st = vstAddTo[0];
LuaHelpers::Push( L, st );
LuaHelpers::Push( L, st );
return 1;
}
static int IsGameEnabled( T* p, lua_State *L )
@@ -3527,12 +3529,12 @@ public:
}
std::vector<Style*> aStyles;
lua_createtable(L, 0, 0);
for( int s=0; pGame->m_apStyles[s]; ++s )
for( int s=0; pGame->m_apStyles[s]; ++s )
{
Style *pStyle = const_cast<Style *>( pGame->m_apStyles[s] );
pStyle->PushSelf(L);
lua_rawseti(L, -2, s+1);
}
}
return 1;
}
static int GetEnabledGames( T* p, lua_State *L )
@@ -3540,14 +3542,14 @@ public:
std::vector<const Game*> aGames;
p->GetEnabledGames( aGames );
lua_createtable(L, aGames.size(), 0);
for(size_t i= 0; i < aGames.size(); ++i)
for(std::size_t i= 0; i < aGames.size(); ++i)
{
lua_pushstring(L, aGames[i]->m_szName);
lua_rawseti(L, -2, i+1);
}
return 1;
return 1;
}
static int SetGame( T* p, lua_State *L )
{
RString game_name= SArg(1);
@@ -3568,7 +3570,7 @@ public:
GameLoop::ChangeGame(game_name, theme);
return 0;
}
LunaGameManager()
{
ADD_METHOD( StepsTypeToLocalizedString );
@@ -3587,7 +3589,7 @@ LUA_REGISTER_CLASS( GameManager )
/*
* (c) 2001-2006 Chris Danford, Glenn Maynard
* 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
@@ -3597,7 +3599,7 @@ LUA_REGISTER_CLASS( GameManager )
* 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