diff --git a/src/common/engine/i_interface.h b/src/common/engine/i_interface.h index d302ef0d72..a8970d0c1c 100644 --- a/src/common/engine/i_interface.h +++ b/src/common/engine/i_interface.h @@ -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; diff --git a/src/common/statusbar/base_sbar.cpp b/src/common/statusbar/base_sbar.cpp index bac2bbd3a2..9e0431610b 100644 --- a/src/common/statusbar/base_sbar.cpp +++ b/src/common/statusbar/base_sbar.cpp @@ -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) { diff --git a/src/d_main.cpp b/src/d_main.cpp index 96e542df06..9d63402b04 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -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, }; diff --git a/src/g_statusbar/shared_sbar.cpp b/src/g_statusbar/shared_sbar.cpp index 297af8bea3..af722e20cd 100644 --- a/src/g_statusbar/shared_sbar.cpp +++ b/src/g_statusbar/shared_sbar.cpp @@ -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)