- made sysCallbacks a value variable instead of a pointer to simplify the checks for it.

This commit is contained in:
Christoph Oelckers 2020-10-03 16:47:47 +02:00
commit ff62d7a8a3
20 changed files with 34 additions and 35 deletions

View file

@ -73,7 +73,7 @@ size_t s_skipMouseMoves;
void CheckGUICapture()
{
bool wantCapt = sysCallbacks && sysCallbacks->WantGuiCapture && sysCallbacks->WantGuiCapture();
bool wantCapt = sysCallbacks.WantGuiCapture && sysCallbacks.WantGuiCapture();
if (wantCapt != GUICapture)
{
@ -149,7 +149,7 @@ void CheckNativeMouse()
}
else
{
bool captureModeInGame = sysCallbacks && sysCallbacks->CaptureModeInGame && sysCallbacks->CaptureModeInGame();
bool captureModeInGame = sysCallbacks.CaptureModeInGame && sysCallbacks.CaptureModeInGame();
wantNative = (!m_use_mouse || MENU_WaitKey != menuactive)
&& (!captureModeInGame || GUICapture);
}
@ -161,7 +161,7 @@ void CheckNativeMouse()
&& (MENU_On == menuactive || MENU_OnNoPause == menuactive);
}
if (!wantNative && sysCallbacks && sysCallbacks->WantNativeMouse && sysCallbacks->WantNativeMouse())
if (!wantNative && sysCallbacks.WantNativeMouse && sysCallbacks.WantNativeMouse())
wantNative = true;
I_SetNativeMouse(wantNative);

View file

@ -165,7 +165,7 @@ static const TMap<SDL_Scancode, uint8_t> KeyScanToDIK(InitKeyScanMap());
static void I_CheckGUICapture ()
{
bool wantCapt = sysCallbacks && sysCallbacks->WantGuiCapture && sysCallbacks->WantGuiCapture();
bool wantCapt = sysCallbacks.WantGuiCapture && sysCallbacks.WantGuiCapture();
if (wantCapt != GUICapture)
{
@ -206,10 +206,10 @@ static void I_CheckNativeMouse ()
{
bool focus = SDL_GetKeyboardFocus() != NULL;
bool captureModeInGame = sysCallbacks && sysCallbacks->CaptureModeInGame && sysCallbacks->CaptureModeInGame();
bool captureModeInGame = sysCallbacks.CaptureModeInGame && sysCallbacks.CaptureModeInGame();
bool wantNative = !focus || (!use_mouse || GUICapture || !captureModeInGame);
if (!wantNative && sysCallbacks && sysCallbacks->WantNativeMouse && sysCallbacks->WantNativeMouse())
if (!wantNative && sysCallbacks.WantNativeMouse && sysCallbacks.WantNativeMouse())
wantNative = true;
if (wantNative != NativeMouse)

View file

@ -87,7 +87,7 @@ FArgs *Args;
static int GetCrashInfo (char *buffer, char *end)
{
if (sysCallbacks && sysCallbacks->CrashInfo) sysCallbacks->CrashInfo(buffer, end - buffer, "\n");
if (sysCallbacks.CrashInfo) sysCallbacks.CrashInfo(buffer, end - buffer, "\n");
return strlen(buffer);
}

View file

@ -147,7 +147,7 @@ extern int chatmodeon;
static void I_CheckGUICapture ()
{
bool wantCapt = sysCallbacks && sysCallbacks->WantGuiCapture && sysCallbacks->WantGuiCapture();
bool wantCapt = sysCallbacks.WantGuiCapture && sysCallbacks.WantGuiCapture();
if (wantCapt != GUICapture)
{
@ -394,7 +394,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return result;
}
if (message == WM_LBUTTONDOWN && sysCallbacks && sysCallbacks->WantLeftButton() && sysCallbacks->WantLeftButton())
if (message == WM_LBUTTONDOWN && sysCallbacks.WantLeftButton() && sysCallbacks.WantLeftButton())
{
if (GUIWndProcHook(hWnd, message, wParam, lParam, &result))
{
@ -504,7 +504,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
SetPriorityClass (GetCurrentProcess (), INGAME_PRIORITY_CLASS);
}
else if (!noidle && !(sysCallbacks && sysCallbacks->NetGame && sysCallbacks->NetGame()))
else if (!noidle && !(sysCallbacks.NetGame && sysCallbacks.NetGame()))
{
SetPriorityClass (GetCurrentProcess (), IDLE_PRIORITY_CLASS);
}
@ -749,7 +749,7 @@ void I_StartTic ()
BlockMouseMove--;
buttonMap.ResetButtonTriggers ();
I_CheckGUICapture ();
EventHandlerResultForNativeMouse = sysCallbacks && sysCallbacks->WantNativeMouse && sysCallbacks->WantNativeMouse();
EventHandlerResultForNativeMouse = sysCallbacks.WantNativeMouse && sysCallbacks.WantNativeMouse();
I_CheckNativeMouse (false, EventHandlerResultForNativeMouse);
I_GetEvent ();
}

View file

@ -1108,7 +1108,7 @@ LONG WINAPI CatchAllExceptions (LPEXCEPTION_POINTERS info)
char *custominfo = (char *)HeapAlloc (GetProcessHeap(), 0, 16384);
CrashPointers = *info;
if (sysCallbacks && sysCallbacks->CrashInfo && custominfo) sysCallbacks->CrashInfo(custominfo, 16384, "\r\n");
if (sysCallbacks.CrashInfo && custominfo) sysCallbacks.CrashInfo(custominfo, 16384, "\r\n");
CreateCrashLog (custominfo, (DWORD)strlen(custominfo), ConWindow);
// If the main thread crashed, then make it clean up after itself.

View file

@ -269,7 +269,7 @@ void I_CheckNativeMouse(bool preferNative, bool eventhandlerresult)
else
{
bool pauseState = false;
bool captureModeInGame = sysCallbacks && sysCallbacks->CaptureModeInGame && sysCallbacks->CaptureModeInGame();
bool captureModeInGame = sysCallbacks.CaptureModeInGame && sysCallbacks.CaptureModeInGame();
want_native = ((!m_use_mouse || menuactive != MENU_WaitKey) &&
(!captureModeInGame || GUICapture));
}

View file

@ -396,8 +396,8 @@ static const int StrifeStartupPicSizes[4 + 2 + 1] =
static void ST_Sound(const char* sndname)
{
if (sysCallbacks && sysCallbacks->PlayStartupSound)
sysCallbacks->PlayStartupSound(sndname);
if (sysCallbacks.PlayStartupSound)
sysCallbacks.PlayStartupSound(sndname);
}
//==========================================================================