- move hud scale CVARs to the backend.

This commit is contained in:
Christoph Oelckers 2022-10-02 17:32:58 +02:00
parent 9076145319
commit a084667bed
4 changed files with 26 additions and 21 deletions

View file

@ -36,6 +36,7 @@ struct SystemCallbacks
void (*StartCutscene)(bool blockui);
void (*SetTransition)(int type);
bool (*CheckCheatmode)(bool printmsg, bool sponly);
void (*HudScaleChanged)();
};
extern SystemCallbacks sysCallbacks;

View file

@ -46,6 +46,7 @@
#include "utf8.h"
#include "v_text.h"
#include "vm.h"
#include "i_interface.h"
FGameTexture* CrosshairImage;
static int CrosshairNum;
@ -60,8 +61,18 @@ CVAR(Int, crosshairhealth, 2, CVAR_ARCHIVE);
CVARD(Float, crosshairscale, 0.5, CVAR_ARCHIVE, "changes the size of the crosshair");
CVAR(Bool, crosshairgrow, false, CVAR_ARCHIVE);
EXTERN_CVAR(Float, hud_scalefactor)
EXTERN_CVAR(Bool, hud_aspectscale)
CUSTOM_CVARD(Float, hud_scalefactor, 1, CVAR_ARCHIVE, "changes the hud scale")
{
if (self < 0.36f) self = 0.36f;
else if (self > 1) self = 1;
else if (sysCallbacks.HudScaleChanged) sysCallbacks.HudScaleChanged();
}
CUSTOM_CVARD(Bool, hud_aspectscale, true, CVAR_ARCHIVE, "enables aspect ratio correction for the status bar")
{
if (sysCallbacks.HudScaleChanged) sysCallbacks.HudScaleChanged();
}
void ST_LoadCrosshair(int num, bool alwaysload)
{

View file

@ -2961,6 +2961,14 @@ static void System_SetTransition(int type)
if (type != wipe_None) wipegamestate = type == wipe_Burn? GS_FORCEWIPEBURN : type == wipe_Fade? GS_FORCEWIPEFADE : GS_FORCEWIPEMELT;
}
static void System_HudScaleChanged()
{
if (StatusBar)
{
StatusBar->SetScale();
setsizeneeded = true;
}
}
bool CheckSkipGameOptionBlock(const char* str);
@ -3531,6 +3539,7 @@ static int D_DoomMain_Internal (void)
System_StartCutscene,
System_SetTransition,
CheckCheatmode,
System_HudScaleChanged,
};

View file

@ -103,17 +103,6 @@ CVAR (Flag, pf_poison, paletteflash, PF_POISON)
CVAR (Flag, pf_ice, paletteflash, PF_ICE)
CVAR (Flag, pf_hazard, paletteflash, PF_HAZARD)
CUSTOM_CVARD(Float, hud_scalefactor, 1, CVAR_ARCHIVE, "changes the hud scale")
{
if (self < 0.36f) self = 0.36f;
else if (self > 1) self = 1;
else if (StatusBar)
{
StatusBar->SetScale();
setsizeneeded = true;
}
}
// Stretch status bar to full screen width?
CUSTOM_CVAR (Int, st_scale, 0, CVAR_ARCHIVE)
@ -129,14 +118,9 @@ CUSTOM_CVAR (Int, st_scale, 0, CVAR_ARCHIVE)
setsizeneeded = true;
}
}
CUSTOM_CVAR(Bool, hud_aspectscale, false, CVAR_ARCHIVE)
{
if (StatusBar)
{
StatusBar->SetScale();
setsizeneeded = true;
}
}
EXTERN_CVAR(Float, hud_scalefactor)
EXTERN_CVAR(Bool, hud_aspectscale)
CVAR (Bool, crosshairon, true, CVAR_ARCHIVE);
CVAR (Int, crosshair, 0, CVAR_ARCHIVE)