mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- made sysCallbacks a value variable instead of a pointer to simplify the checks for it.
This commit is contained in:
parent
1b3ef19100
commit
ff62d7a8a3
20 changed files with 34 additions and 35 deletions
|
@ -137,7 +137,7 @@ void D_PostEvent(event_t* ev)
|
|||
{
|
||||
return;
|
||||
}
|
||||
if (sysCallbacks && sysCallbacks->DispatchEvent && sysCallbacks->DispatchEvent(ev))
|
||||
if (sysCallbacks.DispatchEvent && sysCallbacks.DispatchEvent(ev))
|
||||
return;
|
||||
|
||||
events[eventhead] = *ev;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "i_interface.h"
|
||||
|
||||
// Some global engine variables taken out of the backend code.
|
||||
SystemCallbacks *sysCallbacks;
|
||||
SystemCallbacks sysCallbacks;
|
||||
FString endoomName;
|
||||
bool batchrun;
|
||||
float menuBlurAmount;
|
||||
|
|
|
@ -24,7 +24,7 @@ struct SystemCallbacks
|
|||
bool (*DispatchEvent)(event_t* ev);
|
||||
};
|
||||
|
||||
extern SystemCallbacks *sysCallbacks;
|
||||
extern SystemCallbacks sysCallbacks;
|
||||
|
||||
struct WadStuff
|
||||
{
|
||||
|
|
|
@ -162,7 +162,7 @@ uint8_t TransmitBuffer[TRANSMIT_SIZE];
|
|||
|
||||
FString GetPlayerName(int num)
|
||||
{
|
||||
if (sysCallbacks && sysCallbacks->GetPlayerName) return sysCallbacks->GetPlayerName(sendplayer[num]);
|
||||
if (sysCallbacks.GetPlayerName) return sysCallbacks.GetPlayerName(sendplayer[num]);
|
||||
else return FStringf("Player %d", sendplayer[num] + 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 ();
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -119,7 +119,7 @@ void FSamplerManager::SetTextureFilterMode()
|
|||
glBindSampler(i, 0);
|
||||
}
|
||||
|
||||
int filter = sysCallbacks && sysCallbacks->DisableTextureFilter && sysCallbacks->DisableTextureFilter() ? 0 : gl_texture_filter;
|
||||
int filter = sysCallbacks.DisableTextureFilter && sysCallbacks.DisableTextureFilter() ? 0 : gl_texture_filter;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
|
|
|
@ -166,7 +166,7 @@ void CheckBench()
|
|||
|
||||
FString compose;
|
||||
|
||||
if (sysCallbacks && sysCallbacks->GetLocationDescription) compose = sysCallbacks->GetLocationDescription();
|
||||
if (sysCallbacks.GetLocationDescription) compose = sysCallbacks.GetLocationDescription();
|
||||
|
||||
AppendRenderStats(compose);
|
||||
AppendRenderTimes(compose);
|
||||
|
|
|
@ -61,7 +61,7 @@ static VRMode vrmi_checker = { 2, isqrt2, isqrt2, 1.f,{ { -.5f, 1.f },{ .5f, 1.f
|
|||
const VRMode *VRMode::GetVRMode(bool toscreen)
|
||||
{
|
||||
#ifdef VR3D_ENABLED
|
||||
int mode = !toscreen || (sysCallbacks && sysCallbacks->DisableTextureFilter && sysCallbacks->DisableTextureFilter()) ? 0 : vr_mode;
|
||||
int mode = !toscreen || (sysCallbacks.DisableTextureFilter && sysCallbacks.DisableTextureFilter()) ? 0 : vr_mode;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace
|
|||
static bool lastspecialUI = false;
|
||||
bool isInActualMenu = false;
|
||||
|
||||
bool specialUI = sysCallbacks && (!sysCallbacks->IsSpecialUI || sysCallbacks->IsSpecialUI());
|
||||
bool specialUI = (!sysCallbacks.IsSpecialUI || sysCallbacks.IsSpecialUI());
|
||||
|
||||
if (specialUI == lastspecialUI)
|
||||
return;
|
||||
|
|
|
@ -200,7 +200,7 @@ void DFrameBuffer::SetViewportRects(IntRect *bounds)
|
|||
mScreenViewport.height = screenHeight;
|
||||
|
||||
// Viewport for the 3D scene
|
||||
if (sysCallbacks && sysCallbacks->GetSceneRect) mSceneViewport = sysCallbacks->GetSceneRect();
|
||||
if (sysCallbacks.GetSceneRect) mSceneViewport = sysCallbacks.GetSceneRect();
|
||||
else mSceneViewport = mScreenViewport;
|
||||
|
||||
// Scale viewports to fit letterbox
|
||||
|
|
|
@ -116,8 +116,8 @@ CUSTOM_CVAR(Int, uiscale, 0, CVAR_ARCHIVE | CVAR_NOINITCALL)
|
|||
self = 0;
|
||||
return;
|
||||
}
|
||||
if (sysCallbacks && sysCallbacks->OnScreenSizeChanged)
|
||||
sysCallbacks->OnScreenSizeChanged();
|
||||
if (sysCallbacks.OnScreenSizeChanged)
|
||||
sysCallbacks.OnScreenSizeChanged();
|
||||
setsizeneeded = true;
|
||||
}
|
||||
|
||||
|
@ -294,8 +294,8 @@ void V_OutputResized (int width, int height)
|
|||
twod->End();
|
||||
setsizeneeded = true;
|
||||
C_NewModeAdjust();
|
||||
if (sysCallbacks && sysCallbacks->OnScreenSizeChanged)
|
||||
sysCallbacks->OnScreenSizeChanged();
|
||||
if (sysCallbacks.OnScreenSizeChanged)
|
||||
sysCallbacks.OnScreenSizeChanged();
|
||||
}
|
||||
|
||||
bool IVideo::SetResolution ()
|
||||
|
@ -392,8 +392,8 @@ void V_Init2()
|
|||
CUSTOM_CVAR (Int, vid_aspect, 0, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
|
||||
{
|
||||
setsizeneeded = true;
|
||||
if (sysCallbacks && sysCallbacks->OnScreenSizeChanged)
|
||||
sysCallbacks->OnScreenSizeChanged();
|
||||
if (sysCallbacks.OnScreenSizeChanged)
|
||||
sysCallbacks.OnScreenSizeChanged();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Screen, GetAspectRatio)
|
||||
|
|
|
@ -81,7 +81,7 @@ void VkSamplerManager::SetTextureFilterMode()
|
|||
|
||||
void VkSamplerManager::Create()
|
||||
{
|
||||
int filter = sysCallbacks && sysCallbacks->DisableTextureFilter && sysCallbacks->DisableTextureFilter()? 0 : gl_texture_filter;
|
||||
int filter = sysCallbacks.DisableTextureFilter && sysCallbacks.DisableTextureFilter()? 0 : gl_texture_filter;
|
||||
|
||||
for (int i = CLAMP_NONE; i <= CLAMP_XY; i++)
|
||||
{
|
||||
|
|
|
@ -3057,8 +3057,7 @@ static int D_DoomMain_Internal (void)
|
|||
};
|
||||
GStrings.SetCallbacks(&stblcb);
|
||||
|
||||
static SystemCallbacks syscb =
|
||||
{
|
||||
sysCallbacks = {
|
||||
System_WantGuiCapture,
|
||||
System_WantLeftButton,
|
||||
System_NetGame,
|
||||
|
@ -3075,7 +3074,7 @@ static int D_DoomMain_Internal (void)
|
|||
System_GetPlayerName,
|
||||
System_DispatchEvent,
|
||||
};
|
||||
sysCallbacks = &syscb;
|
||||
|
||||
|
||||
std::set_new_handler(NewFailure);
|
||||
const char *batchout = Args->CheckValue("-errorlog");
|
||||
|
|
|
@ -747,7 +747,7 @@ void M_Drawer (void)
|
|||
if (!CurrentMenu->DontBlur) screen->BlurScene(menuBlurAmount);
|
||||
if (!CurrentMenu->DontDim)
|
||||
{
|
||||
if (sysCallbacks && sysCallbacks->MenuDim) sysCallbacks->MenuDim();
|
||||
if (sysCallbacks.MenuDim) sysCallbacks.MenuDim();
|
||||
}
|
||||
CurrentMenu->CallDrawer();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue