Skip to content

Commit 1e56571

Browse files
FileEXtederis
andauthored
Cleaning up client Common.h and moving enums to separate files (#4215)
* Cleanup client Common.h * Review --------- Co-authored-by: TEDERIs <[email protected]>
1 parent 850db6a commit 1e56571

File tree

113 files changed

+3444
-3430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+3444
-3430
lines changed

Client/core/CCore.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ void CCore::EnableChatInput(char* szCommand, DWORD dwColor)
513513
{
514514
if (m_pLocalGUI)
515515
{
516-
if (m_pGame->GetSystemState() == 9 /* GS_PLAYING_GAME */ && m_pModManager->IsLoaded() && !IsOfflineMod() && !m_pGame->IsAtMenu() &&
516+
if (m_pGame->GetSystemState() == SystemState::GS_PLAYING_GAME && m_pModManager->IsLoaded() && !IsOfflineMod() && !m_pGame->IsAtMenu() &&
517517
!m_pLocalGUI->GetMainMenu()->IsVisible() && !m_pLocalGUI->GetConsole()->IsVisible() && !m_pLocalGUI->IsChatBoxInputEnabled())
518518
{
519519
CChat* pChat = m_pLocalGUI->GetChat();
@@ -1232,7 +1232,7 @@ void CCore::DoPostFramePulse()
12321232
}
12331233

12341234
// This is the first frame in the menu?
1235-
if (m_pGame->GetSystemState() == 7) // GS_FRONTEND
1235+
if (m_pGame->GetSystemState() == SystemState::GS_FRONTEND)
12361236
{
12371237
if (m_menuFrame < 255)
12381238
++m_menuFrame;

Client/core/CGUI.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,17 +281,17 @@ void CLocalGUI::Draw()
281281
{
282282
// Get the game interface
283283
CGame* pGame = CCore::GetSingleton().GetGame();
284-
eSystemState SystemState = pGame->GetSystemState();
284+
SystemState systemState = pGame->GetSystemState();
285285
CGUI* pGUI = CCore::GetSingleton().GetGUI();
286286

287287
// Update mainmenu stuff
288288
m_pMainMenu->Update();
289289

290290
// If we're ingame, make sure the chatbox is drawn
291-
bool bChatVisible = (SystemState == 9 /* GS_INGAME */ && m_pMainMenu->GetIsIngame() && m_bChatboxVisible && !CCore::GetSingleton().IsOfflineMod());
291+
bool bChatVisible = (systemState == SystemState::GS_PLAYING_GAME && m_pMainMenu->GetIsIngame() && m_bChatboxVisible && !CCore::GetSingleton().IsOfflineMod());
292292
if (m_pChat->IsVisible() != bChatVisible)
293293
m_pChat->SetVisible(bChatVisible, !bChatVisible);
294-
bool bDebugVisible = (SystemState == 9 /* GS_INGAME */ && m_pMainMenu->GetIsIngame() && m_pDebugViewVisible && !CCore::GetSingleton().IsOfflineMod());
294+
bool bDebugVisible = (systemState == SystemState::GS_PLAYING_GAME && m_pMainMenu->GetIsIngame() && m_pDebugViewVisible && !CCore::GetSingleton().IsOfflineMod());
295295
if (m_pDebugView->IsVisible() != bDebugVisible)
296296
m_pDebugView->SetVisible(bDebugVisible, true);
297297

@@ -305,7 +305,7 @@ void CLocalGUI::Draw()
305305

306306
// If we're not at the loadingscreen
307307
static bool bDelayedFrame = false;
308-
if (SystemState != 8 || !bDelayedFrame /* GS_INIT_PLAYING_GAME */)
308+
if (systemState != SystemState::GS_INIT_PLAYING_GAME || !bDelayedFrame)
309309
{
310310
// If we have a GUI manager, draw the GUI
311311
if (pGUI)
@@ -314,7 +314,7 @@ void CLocalGUI::Draw()
314314
}
315315

316316
// If the system state was 8, make sure we don't do another delayed frame
317-
if (SystemState == 8)
317+
if (systemState == SystemState::GS_INIT_PLAYING_GAME)
318318
{
319319
bDelayedFrame = true;
320320
}

Client/core/CKeyBinds.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,15 +1872,15 @@ bool CKeyBinds::ControlLeftAndRight(CControllerState& cs)
18721872

18731873
void CKeyBinds::DoPostFramePulse()
18741874
{
1875-
eSystemState SystemState = CCore::GetSingleton().GetGame()->GetSystemState();
1875+
SystemState systemState = CCore::GetSingleton().GetGame()->GetSystemState();
18761876

1877-
if (m_bWaitingToLoadDefaults && (SystemState == 7 || SystemState == 9)) // Are GTA controls actually initialized?
1877+
if (m_bWaitingToLoadDefaults && (systemState == SystemState::GS_FRONTEND || systemState == SystemState::GS_PLAYING_GAME)) // Are GTA controls actually initialized?
18781878
{
18791879
LoadDefaultBinds();
18801880
m_bWaitingToLoadDefaults = false;
18811881
}
18821882

1883-
if (SystemState != 9 /* GS_PLAYING_GAME */)
1883+
if (systemState != SystemState::GS_PLAYING_GAME)
18841884
return;
18851885

18861886
bool bInVehicle = false, bHasDetonator = false, bIsDead = false, bAimingWeapon = false, bEnteringVehicle = false;
@@ -2151,10 +2151,10 @@ bool CKeyBinds::LoadFromXML(CXMLNode* pMainNode)
21512151
else
21522152
bLoadDefaults = true;
21532153

2154-
eSystemState SystemState = CCore::GetSingleton().GetGame()->GetSystemState();
2154+
SystemState systemState = CCore::GetSingleton().GetGame()->GetSystemState();
21552155
if (bLoadDefaults)
21562156
{
2157-
if (SystemState == 7 || SystemState == 9) // Are GTA controls actually initialized?
2157+
if (systemState == SystemState::GS_FRONTEND || systemState == SystemState::GS_PLAYING_GAME) // Are GTA controls actually initialized?
21582158
LoadDefaultBinds();
21592159
else
21602160
m_bWaitingToLoadDefaults = true;

Client/core/CMainMenu.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ void CMainMenu::Update()
447447

448448
// Get the game interface and the system state
449449
CGame* pGame = CCore::GetSingleton().GetGame();
450-
eSystemState SystemState = pGame->GetSystemState();
450+
SystemState systemState = pGame->GetSystemState();
451451

452452
m_Credits.Update();
453453
m_Settings.Update();
@@ -650,7 +650,7 @@ void CMainMenu::Update()
650650
}
651651

652652
// Force the mainmenu on if we're at GTA's mainmenu or not ingame
653-
if ((SystemState == 7 || SystemState == 9) && !m_bIsIngame)
653+
if ((systemState == SystemState::GS_FRONTEND || systemState == SystemState::GS_PLAYING_GAME) && !m_bIsIngame)
654654
{
655655
if (!m_bStarted)
656656
{
@@ -671,11 +671,11 @@ void CMainMenu::Update()
671671
}
672672

673673
// If we're visible
674-
if (m_bIsVisible && SystemState != 8)
674+
if (m_bIsVisible && systemState != SystemState::GS_INIT_PLAYING_GAME)
675675
{
676676
// If we're at the game's mainmenu, or ingame when m_bIsIngame is true show the background
677-
if (SystemState == 7 || // GS_FRONTEND
678-
SystemState == 9 && !m_bIsIngame) // GS_PLAYING_GAME
677+
if (systemState == SystemState::GS_FRONTEND ||
678+
systemState == SystemState::GS_PLAYING_GAME && !m_bIsIngame)
679679
{
680680
if (m_ucFade == FADE_INVISIBLE)
681681
Show(false);

Client/core/CMessageLoopHook.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ LRESULT CALLBACK CMessageLoopHook::ProcessMessage(HWND hwnd, UINT uMsg, WPARAM w
321321
// If CTRL and Tab are pressed, Trigger a skip
322322
if ((uMsg == WM_KEYDOWN && wParam == VK_TAB))
323323
{
324-
eSystemState systemState = g_pCore->GetGame()->GetSystemState();
325-
if (systemState == 7 || systemState == 8 || systemState == 9)
324+
SystemState systemState = g_pCore->GetGame()->GetSystemState();
325+
if (systemState == SystemState::GS_FRONTEND || systemState == SystemState::GS_INIT_PLAYING_GAME || systemState == SystemState::GS_PLAYING_GAME)
326326
{
327327
short sCtrlState = GetKeyState(VK_CONTROL);
328328
short sShiftState = GetKeyState(VK_SHIFT);
@@ -344,8 +344,8 @@ LRESULT CALLBACK CMessageLoopHook::ProcessMessage(HWND hwnd, UINT uMsg, WPARAM w
344344
}
345345
if ((uMsg == WM_KEYDOWN && (wParam >= VK_1 && wParam <= VK_9)))
346346
{
347-
eSystemState systemState = g_pCore->GetGame()->GetSystemState();
348-
if (systemState == 7 || systemState == 8 || systemState == 9)
347+
SystemState systemState = g_pCore->GetGame()->GetSystemState();
348+
if (systemState == SystemState::GS_FRONTEND || systemState == SystemState::GS_INIT_PLAYING_GAME || systemState == SystemState::GS_PLAYING_GAME)
349349
{
350350
short sCtrlState = GetKeyState(VK_CONTROL);
351351
if (sCtrlState & 0x8000)
@@ -368,9 +368,9 @@ LRESULT CALLBACK CMessageLoopHook::ProcessMessage(HWND hwnd, UINT uMsg, WPARAM w
368368
// If F8 is pressed, we show/hide the console
369369
if ((uMsg == WM_KEYDOWN && wParam == VK_F8) || (uMsg == WM_CHAR && wParam == '`'))
370370
{
371-
eSystemState systemState = g_pCore->GetGame()->GetSystemState();
372-
if (CLocalGUI::GetSingleton().IsConsoleVisible() || systemState == 7 || systemState == 8 ||
373-
systemState == 9) /* GS_FRONTEND, GS_INIT_PLAYING_GAME, GS_PLAYING_GAME */
371+
SystemState systemState = g_pCore->GetGame()->GetSystemState();
372+
if (CLocalGUI::GetSingleton().IsConsoleVisible() || systemState == SystemState::GS_FRONTEND || systemState == SystemState::GS_INIT_PLAYING_GAME ||
373+
systemState == SystemState::GS_PLAYING_GAME)
374374
{
375375
CLocalGUI::GetSingleton().SetConsoleVisible(!CLocalGUI::GetSingleton().IsConsoleVisible());
376376
}

Client/core/CMouseControl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ bool CMouseControl::ProcessMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam)
5959
if (uMsg != WM_MOUSEMOVE)
6060
return false;
6161

62-
if (g_pCore->GetGame()->GetSystemState() != 9)
62+
if (g_pCore->GetGame()->GetSystemState() != SystemState::GS_PLAYING_GAME)
6363
return false;
6464

6565
// HACK: Grab our local player, and check his vehicle

Client/game_sa/C3DMarkersSA.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ C3DMarkersSA::~C3DMarkersSA()
2828
}
2929
}
3030

31-
C3DMarker* C3DMarkersSA::CreateMarker(DWORD Identifier, e3DMarkerType dwType, CVector* vecPosition, float fSize, float fPulseFraction, BYTE r, BYTE g, BYTE b,
31+
C3DMarker* C3DMarkersSA::CreateMarker(DWORD Identifier, T3DMarkerType dwType, CVector* vecPosition, float fSize, float fPulseFraction, BYTE r, BYTE g, BYTE b,
3232
BYTE a)
3333
{
3434
/*
@@ -37,8 +37,8 @@ C3DMarker* C3DMarkersSA::CreateMarker(DWORD Identifier, e3DMarkerType dwType, CV
3737
unsigned short nPeriod, float fPulseFrac, short nRotRate, float normalX = 0.0f,
3838
float normalY = 0.0f, float normalZ = 0.0f, bool zCheck = FALSE);
3939
*/
40-
WORD wType = dwType;
41-
dwType = (e3DMarkerType)wType;
40+
WORD wType = (WORD)dwType;
41+
dwType = (T3DMarkerType)wType;
4242
bool bZCheck = true;
4343

4444
DWORD dwFunc = FUNC_PlaceMarker;

Client/game_sa/C3DMarkersSA.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class C3DMarkersSA : public C3DMarkers
2828
C3DMarkersSA();
2929
~C3DMarkersSA();
3030

31-
C3DMarker* CreateMarker(DWORD Identifier, e3DMarkerType dwType, CVector* vecPosition, float fSize, float fPulseFraction, BYTE r, BYTE g, BYTE b, BYTE a);
31+
C3DMarker* CreateMarker(DWORD Identifier, T3DMarkerType dwType, CVector* vecPosition, float fSize, float fPulseFraction, BYTE r, BYTE g, BYTE b, BYTE a);
3232
C3DMarker* FindFreeMarker();
3333
C3DMarker* FindMarker(DWORD Identifier);
3434
void ReinitMarkers();

Client/game_sa/CCoronasSA.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ CRegisteredCorona* CCoronasSA::CreateCorona(DWORD Identifier, CVector* position)
4444

4545
if (corona)
4646
{
47-
RwTexture* texture = GetTexture((eCoronaType)CORONATYPE_SHINYSTAR);
47+
RwTexture* texture = GetTexture(CoronaType::CORONATYPE_SHINYSTAR);
4848
if (texture)
4949
{
5050
corona->Init(Identifier);
@@ -81,10 +81,10 @@ CRegisteredCorona* CCoronasSA::FindCorona(DWORD Identifier)
8181
return (CRegisteredCorona*)NULL;
8282
}
8383

84-
RwTexture* CCoronasSA::GetTexture(eCoronaType type)
84+
RwTexture* CCoronasSA::GetTexture(CoronaType type)
8585
{
86-
if (type < MAX_CORONA_TEXTURES)
87-
return (RwTexture*)(*(DWORD*)(ARRAY_CORONA_TEXTURES + type * sizeof(DWORD)));
86+
if ((DWORD)type < MAX_CORONA_TEXTURES)
87+
return (RwTexture*)(*(DWORD*)(ARRAY_CORONA_TEXTURES + static_cast<DWORD>(type) * sizeof(DWORD)));
8888
else
8989
return NULL;
9090
}

Client/game_sa/CCoronasSA.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class CCoronasSA : public CCoronas
3939
CRegisteredCorona* CreateCorona(DWORD Identifier, CVector* position);
4040
CRegisteredCorona* FindFreeCorona();
4141
CRegisteredCorona* FindCorona(DWORD Identifier);
42-
RwTexture* GetTexture(eCoronaType type);
42+
RwTexture* GetTexture(CoronaType type);
4343

4444
void DisableSunAndMoon(bool bDisabled);
4545

0 commit comments

Comments
 (0)