Skip to content

Commit

Permalink
global replace enumchecks with hardcoded player 1
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Dec 6, 2018
1 parent 884b457 commit 5d68f5a
Show file tree
Hide file tree
Showing 22 changed files with 53 additions and 60 deletions.
2 changes: 1 addition & 1 deletion Themes/Til Death/BGAnimations/ScreenTitleMenu underlay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ for i = 1, choiceCount do
SCREENMAN:GetTopScreen():playcommand("MadeChoicePlayer_1")
SCREENMAN:GetTopScreen():playcommand("Choose")
if choices[i] == "Multi" or choices[i] == "GameStart" then
GAMESTATE:JoinPlayer(1)
GAMESTATE:JoinPlayer(PLAYER_1)
end
GAMESTATE:ApplyGameCommand(THEME:GetMetric("ScreenTitleMenu", "Choice" .. choices[i]))
end
Expand Down
2 changes: 1 addition & 1 deletion src/GameSoundManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ class LunaGameSoundManager : public Luna<GameSoundManager>
}
static int GetPlayerBalance(T* p, lua_State* L)
{
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
PlayerNumber pn = PLAYER_1;
lua_pushnumber(L, p->GetPlayerBalance(pn));
return 1;
}
Expand Down
36 changes: 18 additions & 18 deletions src/GameState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1505,10 +1505,10 @@ class LunaGameState : public Luna<GameState>
{
public:
DEFINE_METHOD(IsPlayerEnabled,
IsPlayerEnabled(Enum::Check<PlayerNumber>(L, 1)))
DEFINE_METHOD(IsHumanPlayer, IsHumanPlayer(Enum::Check<PlayerNumber>(L, 1)))
IsPlayerEnabled(PLAYER_1))
DEFINE_METHOD(IsHumanPlayer, IsHumanPlayer(PLAYER_1))
DEFINE_METHOD(GetPlayerDisplayName,
GetPlayerDisplayName(Enum::Check<PlayerNumber>(L, 1)))
GetPlayerDisplayName(PLAYER_1))
DEFINE_METHOD(GetMasterPlayerNumber, GetMasterPlayerNumber())
DEFINE_METHOD(GetMultiplayer, m_bMultiplayer)
static int SetMultiplayer(T* p, lua_State* L)
Expand All @@ -1526,7 +1526,7 @@ class LunaGameState : public Luna<GameState>
}
static int GetPlayerState(T* p, lua_State* L)
{
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
PlayerNumber pn = PLAYER_1;
p->m_pPlayerState[pn]->PushSelf(L);
return 1;
}
Expand Down Expand Up @@ -1595,7 +1595,7 @@ class LunaGameState : public Luna<GameState>
}
static int GetCurrentSteps(T* p, lua_State* L)
{
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
PlayerNumber pn = PLAYER_1;
Steps* pSteps = p->m_pCurSteps[pn];
if (pSteps) {
pSteps->PushSelf(L);
Expand All @@ -1606,7 +1606,7 @@ class LunaGameState : public Luna<GameState>
}
static int SetCurrentSteps(T* p, lua_State* L)
{
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
PlayerNumber pn = PLAYER_1;
if (lua_isnil(L, 2)) {
p->m_pCurSteps[pn].Set(NULL);
} else {
Expand Down Expand Up @@ -1647,18 +1647,18 @@ class LunaGameState : public Luna<GameState>
}
static int SetPreferredDifficulty(T* p, lua_State* L)
{
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
PlayerNumber pn = PLAYER_1;
Difficulty dc = Enum::Check<Difficulty>(L, 2);
p->m_PreferredDifficulty[pn].Set(dc);
COMMON_RETURN_SELF;
}
DEFINE_METHOD(GetPreferredDifficulty,
m_PreferredDifficulty[Enum::Check<PlayerNumber>(L, 1)])
m_PreferredDifficulty[PLAYER_1])
DEFINE_METHOD(GetPlayMode, m_PlayMode)
DEFINE_METHOD(GetSortOrder, m_SortOrder)
DEFINE_METHOD(GetCurrentStageIndex, m_iCurrentStageIndex)
DEFINE_METHOD(PlayerIsUsingModifier,
PlayerIsUsingModifier(Enum::Check<PlayerNumber>(L, 1),
PlayerIsUsingModifier(PLAYER_1,
SArg(2)))
DEFINE_METHOD(GetLoadingCourseSongIndex, GetLoadingCourseSongIndex())
DEFINE_METHOD(GetEasiestStepsDifficulty, GetEasiestStepsDifficulty())
Expand All @@ -1673,7 +1673,7 @@ class LunaGameState : public Luna<GameState>
DEFINE_METHOD(GetLastGameplayDuration, m_DanceDuration)
DEFINE_METHOD(GetGameplayLeadIn, m_bGameplayLeadIn)
DEFINE_METHOD(IsSideJoined,
m_bSideIsJoined[Enum::Check<PlayerNumber>(L, 1)])
m_bSideIsJoined[PLAYER_1])
DEFINE_METHOD(PlayersCanJoin, PlayersCanJoin())
DEFINE_METHOD(GetNumSidesJoined, GetNumSidesJoined())
DEFINE_METHOD(GetSongOptionsString, m_SongOptions.GetCurrent().GetString())
Expand Down Expand Up @@ -1711,12 +1711,12 @@ class LunaGameState : public Luna<GameState>
}
static int ApplyStageModifiers(T* p, lua_State* L)
{
p->ApplyStageModifiers(Enum::Check<PlayerNumber>(L, 1), SArg(2));
p->ApplyStageModifiers(PLAYER_1, SArg(2));
COMMON_RETURN_SELF;
}
static int ApplyPreferredModifiers(T* p, lua_State* L)
{
p->ApplyPreferredModifiers(Enum::Check<PlayerNumber>(L, 1), SArg(2));
p->ApplyPreferredModifiers(PLAYER_1, SArg(2));
COMMON_RETURN_SELF;
}
static int SetSongOptions(T* p, lua_State* L)
Expand Down Expand Up @@ -1840,12 +1840,12 @@ class LunaGameState : public Luna<GameState>
}
static int JoinPlayer(T* p, lua_State* L)
{
p->JoinPlayer(Enum::Check<PlayerNumber>(L, 1));
p->JoinPlayer(PLAYER_1);
COMMON_RETURN_SELF;
}
static int UnjoinPlayer(T* p, lua_State* L)
{
p->UnjoinPlayer(Enum::Check<PlayerNumber>(L, 1));
p->UnjoinPlayer(PLAYER_1);
COMMON_RETURN_SELF;
}

Expand All @@ -1858,7 +1858,7 @@ class LunaGameState : public Luna<GameState>

static int GetCharacter(T* p, lua_State* L)
{
p->m_pCurCharacters[Enum::Check<PlayerNumber>(L, 1)]->PushSelf(L);
p->m_pCurCharacters[PLAYER_1]->PushSelf(L);
return 1;
}
static int SetCharacter(T* p, lua_State* L) { COMMON_RETURN_SELF; }
Expand All @@ -1869,7 +1869,7 @@ class LunaGameState : public Luna<GameState>
}
static int AddStageToPlayer(T* p, lua_State* L)
{
p->AddStageToPlayer(Enum::Check<PlayerNumber>(L, 1));
p->AddStageToPlayer(PLAYER_1);
COMMON_RETURN_SELF;
}
static int InsertCoin(T* p, lua_State* L) { COMMON_RETURN_SELF; }
Expand All @@ -1878,13 +1878,13 @@ class LunaGameState : public Luna<GameState>
{
lua_pushboolean(
L,
p->CurrentOptionsDisqualifyPlayer(Enum::Check<PlayerNumber>(L, 1)));
p->CurrentOptionsDisqualifyPlayer(PLAYER_1));
return 1;
}

static int ResetPlayerOptions(T* p, lua_State* L)
{
p->ResetPlayerOptions(Enum::Check<PlayerNumber>(L, 1));
p->ResetPlayerOptions(PLAYER_1);
COMMON_RETURN_SELF;
}

Expand Down
4 changes: 2 additions & 2 deletions src/OptionRow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ class LunaOptionRow : public Luna<OptionRow>
static int GetChoiceInRowWithFocus(T* p, lua_State* L)
{
lua_pushnumber(
L, p->GetChoiceInRowWithFocus(Enum::Check<PlayerNumber>(L, 1)));
L, p->GetChoiceInRowWithFocus(PLAYER_1));
return 1;
}
DEFINE_METHOD(GetLayoutType, GetHandler()->m_Def.m_layoutType)
Expand All @@ -1011,7 +1011,7 @@ class LunaOptionRow : public Luna<OptionRow>
DEFINE_METHOD(GetRowTitle, GetRowTitle())
static int HasFocus(T* p, lua_State* L)
{
lua_pushboolean(L, p->GetRowHasFocus(Enum::Check<PlayerNumber>(L, 1)));
lua_pushboolean(L, p->GetRowHasFocus(PLAYER_1));
return 1;
}
static int OneChoiceForAllPlayers(T* p, lua_State* L)
Expand Down
6 changes: 3 additions & 3 deletions src/PlayerNumber.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "global.h"
#include "global.h"
#include "LocalizedString.h"
#include "LuaManager.h"
#include "PlayerNumber.h"
Expand All @@ -9,10 +9,10 @@ static const char* PlayerNumberNames[] = {
XToString(PlayerNumber);
XToLocalizedString(PlayerNumber);
LuaFunction(PlayerNumberToString,
PlayerNumberToString(Enum::Check<PlayerNumber>(L, 1)));
PlayerNumberToString(PLAYER_1));
LuaXType(PlayerNumber);
LuaFunction(PlayerNumberToLocalizedString,
PlayerNumberToLocalizedString(Enum::Check<PlayerNumber>(L, 1)));
PlayerNumberToLocalizedString(PLAYER_1));

static const char* MultiPlayerNames[] = {
"P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P9", "P10", "P11",
Expand Down
12 changes: 6 additions & 6 deletions src/ProfileManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,12 +827,12 @@ class LunaProfileManager : public Luna<ProfileManager>
static int IsPersistentProfile(T* p, lua_State* L)
{
lua_pushboolean(
L, p->IsPersistentProfile(Enum::Check<PlayerNumber>(L, 1)));
L, p->IsPersistentProfile(PLAYER_1));
return 1;
}
static int GetProfile(T* p, lua_State* L)
{
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
PlayerNumber pn = PLAYER_1;
Profile* pP = p->GetProfile(pn);
pP->PushSelf(L);
return 1;
Expand Down Expand Up @@ -897,12 +897,12 @@ class LunaProfileManager : public Luna<ProfileManager>
static int LastLoadWasTamperedOrCorrupt(T* p, lua_State* L)
{
lua_pushboolean(
L, p->LastLoadWasTamperedOrCorrupt(Enum::Check<PlayerNumber>(L, 1)));
L, p->LastLoadWasTamperedOrCorrupt(PLAYER_1));
return 1;
}
static int GetPlayerName(T* p, lua_State* L)
{
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
PlayerNumber pn = PLAYER_1;
lua_pushstring(L, p->GetPlayerName(pn));
return 1;
}
Expand All @@ -915,12 +915,12 @@ class LunaProfileManager : public Luna<ProfileManager>
}
static int SaveProfile(T* p, lua_State* L)
{
lua_pushboolean(L, p->SaveProfile(Enum::Check<PlayerNumber>(L, 1)));
lua_pushboolean(L, p->SaveProfile(PLAYER_1));
return 1;
}
static int ConvertProfile(T* p, lua_State* L)
{
lua_pushboolean(L, p->ConvertProfile(Enum::Check<PlayerNumber>(L, 1)));
lua_pushboolean(L, p->ConvertProfile(PLAYER_1));
return 1;
}
static int SaveLocalProfile(T* p, lua_State* L)
Expand Down
6 changes: 1 addition & 5 deletions src/ScreenEvaluation.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
#define SCREEN_EVALUATION_H

#include "ActorUtil.h"
#include "Banner.h"
#include "BitmapText.h"
#include "PercentageDisplay.h"
#include "PlayerStageStats.h"
#include "RageSound.h"
#include "RollingNumbers.h"
#include "ScreenWithMenuElements.h"
Expand Down Expand Up @@ -37,13 +36,10 @@ class ScreenEvaluation : public ScreenWithMenuElements
protected:
void HandleMenuStart();


StageStats* m_pStageStats;
StageStats m_FinalEvalStageStats;

RageSound m_soundStart; // sound played if the player passes or fails


/** @brief Did a player save a screenshot of their score? */
bool m_bSavedScreenshot[NUM_PLAYERS];
};
Expand Down
6 changes: 3 additions & 3 deletions src/ScreenGameplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2752,7 +2752,7 @@ class LunaScreenGameplay : public Luna<ScreenGameplay>
}
static int GetLifeMeter(T* p, lua_State* L)
{
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
PlayerNumber pn = PLAYER_1;

PlayerInfo* pi = p->GetPlayerInfo(pn);
if (pi == NULL)
Expand All @@ -2766,7 +2766,7 @@ class LunaScreenGameplay : public Luna<ScreenGameplay>
}
static int GetPlayerInfo(T* p, lua_State* L)
{
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
PlayerNumber pn = PLAYER_1;

PlayerInfo* pi = p->GetPlayerInfo(pn);
if (pi == NULL)
Expand Down Expand Up @@ -2813,7 +2813,7 @@ class LunaScreenGameplay : public Luna<ScreenGameplay>
}
static int GetTrueBPS(T* p, lua_State* L)
{
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
PlayerNumber pn = PLAYER_1;
float rate = GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate;
float bps = GAMESTATE->m_pPlayerState[pn]->m_Position.m_fCurBPS;
float true_bps = rate * bps;
Expand Down
4 changes: 2 additions & 2 deletions src/ScreenManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1041,13 +1041,13 @@ class LunaScreenManager : public Luna<ScreenManager>

static int get_input_redirected(T* p, lua_State* L)
{
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
PlayerNumber pn = PLAYER_1;
lua_pushboolean(L, p->get_input_redirected(pn));
return 1;
}
static int set_input_redirected(T* p, lua_State* L)
{
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
PlayerNumber pn = PLAYER_1;
p->set_input_redirected(pn, BArg(2));
COMMON_RETURN_SELF;
}
Expand Down
1 change: 0 additions & 1 deletion src/ScreenNetEvaluation.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "BitmapText.h"
#include "DifficultyIcon.h"
#include "Quad.h"
#include "ScreenEvaluation.h"
#include "ScreenMessage.h"
Expand Down
1 change: 0 additions & 1 deletion src/ScreenNetSelectMusic.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "BPMDisplay.h"
#include "Difficulty.h"
#include "DifficultyIcon.h"
#include "ModIconRow.h"
#include "MusicWheel.h"
#include "ScreenSelectMusic.h"
Expand Down
4 changes: 2 additions & 2 deletions src/ScreenOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1389,12 +1389,12 @@ class LunaScreenOptions : public Luna<ScreenOptions>
static int FocusedItemEndsScreen(T* p, lua_State* L)
{
lua_pushboolean(
L, p->FocusedItemEndsScreen(Enum::Check<PlayerNumber>(L, 1)));
L, p->FocusedItemEndsScreen(PLAYER_1));
return 1;
}
static int GetCurrentRowIndex(T* p, lua_State* L)
{
lua_pushnumber(L, p->GetCurrentRow(Enum::Check<PlayerNumber>(L, 1)));
lua_pushnumber(L, p->GetCurrentRow(PLAYER_1));
return 1;
}
static int GetOptionRow(T* p, lua_State* L)
Expand Down
2 changes: 1 addition & 1 deletion src/ScreenSelectMaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ class LunaScreenSelectMaster : public Luna<ScreenSelectMaster>
static int GetSelectionIndex(T* p, lua_State* L)
{
lua_pushnumber(
L, p->GetPlayerSelectionIndex(Enum::Check<PlayerNumber>(L, 1)));
L, p->GetPlayerSelectionIndex(PLAYER_1));
return 1;
}
// should I even bother adding this? -aj
Expand Down
6 changes: 3 additions & 3 deletions src/ScreenSelectMusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1594,21 +1594,21 @@ class LunaScreenSelectMusic : public Luna<ScreenSelectMusic>
}
static int OpenOptionsList(T* p, lua_State* L)
{
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
PlayerNumber pn = PLAYER_1;
if (p->can_open_options_list(pn)) {
p->OpenOptionsList(pn);
}
COMMON_RETURN_SELF;
}
static int CanOpenOptionsList(T* p, lua_State* L)
{
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
PlayerNumber pn = PLAYER_1;
lua_pushboolean(L, p->can_open_options_list(pn));
return 1;
}
static int SelectCurrent(T* p, lua_State* L)
{
p->SelectCurrent(Enum::Check<PlayerNumber>(L, 1));
p->SelectCurrent(PLAYER_1);
return 1;
}

Expand Down
1 change: 0 additions & 1 deletion src/ScreenSelectMusic.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#define SCREEN_SELECT_MUSIC_H

#include "BitmapText.h"
#include "FadingBanner.h"
#include "GameConstantsAndTypes.h"
#include "GameInput.h"
#include "MusicWheel.h"
Expand Down
4 changes: 2 additions & 2 deletions src/ScreenSelectProfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class LunaScreenSelectProfile : public Luna<ScreenSelectProfile>
public:
static int SetProfileIndex(T* p, lua_State* L)
{
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
PlayerNumber pn = PLAYER_1;
int iProfileIndex = IArg(2);
bool bRet = p->SetProfileIndex(pn, iProfileIndex);
LuaHelpers::Push(L, bRet);
Expand All @@ -232,7 +232,7 @@ class LunaScreenSelectProfile : public Luna<ScreenSelectProfile>

static int GetProfileIndex(T* p, lua_State* L)
{
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
PlayerNumber pn = PLAYER_1;
LuaHelpers::Push(L, p->GetProfileIndex(pn));
return 1;
}
Expand Down
Loading

0 comments on commit 5d68f5a

Please sign in to comment.