From db5fcde0db788ab6fe882a97131c7c59613656e5 Mon Sep 17 00:00:00 2001
From: Mitchell Richters <mjr4077au@gmail.com>
Date: Sat, 22 Oct 2022 14:42:04 +1100
Subject: [PATCH] - Fix issues with startup on fresh config following CVAR
 overhaul.

---
 source/core/gamecvars.cpp                      | 2 +-
 source/core/gamecvars.h                        | 2 +-
 wadsrc/static/zscript/games/duke/ui/sbar_d.zs  | 6 +++---
 wadsrc/static/zscript/games/duke/ui/sbar_r.zs  | 6 +++---
 wadsrc/static/zscript/games/exhumed/ui/sbar.zs | 6 +++---
 wadsrc/static/zscript/games/sw/ui/sbar.zs      | 6 +++---
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/source/core/gamecvars.cpp b/source/core/gamecvars.cpp
index 6d75af339..4ea844db0 100644
--- a/source/core/gamecvars.cpp
+++ b/source/core/gamecvars.cpp
@@ -203,7 +203,7 @@ CCMD (togglemessages)
 	}
 }
 
-CVARD_NAMED(Int, hud_flashing, althud_flashing, true, CVAR_ARCHIVE, "enable/disable althud flashing")
+CVARD(Bool, althud_flashing, true, CVAR_ARCHIVE, "enable/disable althud flashing")
 CUSTOM_CVARD(Int, r_fov, 90, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "change the field of view")
 {
 	if (self < 60) self = 60;
diff --git a/source/core/gamecvars.h b/source/core/gamecvars.h
index e2b705bd2..b55f36023 100644
--- a/source/core/gamecvars.h
+++ b/source/core/gamecvars.h
@@ -68,7 +68,7 @@ EXTERN_CVAR(Bool, hud_messages)
 EXTERN_CVAR(Int, althud_numbertile)
 EXTERN_CVAR(Int, althud_numberpal)
 EXTERN_CVAR(Int, althud_shadows)
-EXTERN_CVAR(Int, althud_flashing)
+EXTERN_CVAR(Bool, althud_flashing)
 
 EXTERN_CVAR(Bool, am_textfont)
 EXTERN_CVAR(Bool, am_showlabel)
diff --git a/wadsrc/static/zscript/games/duke/ui/sbar_d.zs b/wadsrc/static/zscript/games/duke/ui/sbar_d.zs
index 7e3b43a0c..3c6c67365 100644
--- a/wadsrc/static/zscript/games/duke/ui/sbar_d.zs
+++ b/wadsrc/static/zscript/games/duke/ui/sbar_d.zs
@@ -143,10 +143,10 @@ class DukeStatusBar : DukeCommonStatusBar
 		imgScale = baseScale / siz.Y;
 		DrawTexture(img, (2, -1.5), DI_ITEM_LEFT_BOTTOM, scale:(imgScale, imgScale));
 
-		if (!hud_flashing || p.last_extra > (Duke.MaxPlayerHealth() >> 2) || (PlayClock & 32) || (p.IsFrozen() && p.last_extra < 2))
+		if (!althud_flashing || p.last_extra > (Duke.MaxPlayerHealth() >> 2) || (PlayClock & 32) || (p.IsFrozen() && p.last_extra < 2))
 		{
 			int s = -8;
-			if (hud_flashing && p.last_extra > Duke.MaxPlayerHealth())
+			if (althud_flashing && p.last_extra > Duke.MaxPlayerHealth())
 				s += Raze.bsin(Raze.GetBuildTime() << 5) >> 10;
 			int intens = clamp(255 - 6 * s, 0, 255);
 			format = String.Format("%d", p.last_extra);
@@ -194,7 +194,7 @@ class DukeStatusBar : DukeCommonStatusBar
 				imgX += (imgX * 0.6) * (strlen - 1);
 			}
 
-			if (weapon != DukeWpn.KNEE_WEAPON && (!hud_flashing || PlayClock & 32 || ammo > (Duke.MaxAmmoAmount(weapon) / 10)))
+			if (weapon != DukeWpn.KNEE_WEAPON && (!althud_flashing || PlayClock & 32 || ammo > (Duke.MaxAmmoAmount(weapon) / 10)))
 			{
 				DrawString(numberFont, format, (-3, texty), DI_TEXT_ALIGN_RIGHT, Font.CR_UNTRANSLATED);
 			}
diff --git a/wadsrc/static/zscript/games/duke/ui/sbar_r.zs b/wadsrc/static/zscript/games/duke/ui/sbar_r.zs
index 35cbd0c6a..8932eb3e6 100644
--- a/wadsrc/static/zscript/games/duke/ui/sbar_r.zs
+++ b/wadsrc/static/zscript/games/duke/ui/sbar_r.zs
@@ -90,10 +90,10 @@ class RedneckStatusBar : DukeCommonStatusBar
 		imgScale = baseScale / siz.Y;
 		DrawTexture(img, (2, -2), DI_ITEM_LEFT_BOTTOM, scale:(imgScale, imgScale));
 
-		if (!hud_flashing || p.last_extra > (Duke.MaxPlayerHealth() >> 2) || (PlayClock & 32) || (p.IsFrozen() && p.last_extra < 2))
+		if (!althud_flashing || p.last_extra > (Duke.MaxPlayerHealth() >> 2) || (PlayClock & 32) || (p.IsFrozen() && p.last_extra < 2))
 		{
 			int s = -8;
-			if (hud_flashing && p.last_extra > Duke.MaxPlayerHealth())
+			if (althud_flashing && p.last_extra > Duke.MaxPlayerHealth())
 				s += Raze.bsin(Raze.GetBuildTime() << 5) >> 10;
 			int intens = clamp(255 - 6 * s, 0, 255);
 			format = String.Format("%d", p.last_extra);
@@ -160,7 +160,7 @@ class RedneckStatusBar : DukeCommonStatusBar
 				imgX += (imgX * 0.755) * (strlen - 1);
 			}
 
-			if (weapon != RRWpn.KNEE_WEAPON && weapon != RRWpn.SLINGBLADE_WEAPON && (!hud_flashing || PlayClock & 32 || ammo > (Duke.MaxAmmoAmount(weapon) / 10)))
+			if (weapon != RRWpn.KNEE_WEAPON && weapon != RRWpn.SLINGBLADE_WEAPON && (!althud_flashing || PlayClock & 32 || ammo > (Duke.MaxAmmoAmount(weapon) / 10)))
 			{
 				DrawString(numberFont, format, (-1, -numberFont.mFont.GetHeight() * scale + 4), DI_TEXT_ALIGN_RIGHT, scale:(scale, scale));
 			}
diff --git a/wadsrc/static/zscript/games/exhumed/ui/sbar.zs b/wadsrc/static/zscript/games/exhumed/ui/sbar.zs
index 8545c8729..10e1ed90a 100644
--- a/wadsrc/static/zscript/games/exhumed/ui/sbar.zs
+++ b/wadsrc/static/zscript/games/exhumed/ui/sbar.zs
@@ -255,10 +255,10 @@ class ExhumedStatusBar : RazeStatusBar
 		imgScale = baseScale / size.Y;
 		DrawTexture(img, (1.5, -1), DI_ITEM_LEFT_BOTTOM, scale:(imgScale, imgScale));
 
-		if (!hud_flashing || pp.nHealth > 150 || (PlayClock & 32))
+		if (!althud_flashing || pp.nHealth > 150 || (PlayClock & 32))
 		{
 			int s = -8;
-			if (hud_flashing && pp.nHealth > 800)
+			if (althud_flashing && pp.nHealth > 800)
 				s += Raze.bsin(PlayClock << 5) >> 10;
 			int intens = clamp(255 - 4 * s, 0, 255);
 			format = String.Format("%d", pp.nHealth >> 3);
@@ -334,7 +334,7 @@ class ExhumedStatusBar : RazeStatusBar
 			}
 			*/
 
-			if ((!hud_flashing || PlayClock & 32 || ammo > 10))// (DamageData[weapon].max_ammo / 10)))
+			if ((!althud_flashing || PlayClock & 32 || ammo > 10))// (DamageData[weapon].max_ammo / 10)))
 			{
 				DrawString(numberFont, format, (-3, -numberFont.mFont.GetHeight() + 3), DI_TEXT_ALIGN_RIGHT);
 			}
diff --git a/wadsrc/static/zscript/games/sw/ui/sbar.zs b/wadsrc/static/zscript/games/sw/ui/sbar.zs
index ef61e1d2d..7be03d5e1 100644
--- a/wadsrc/static/zscript/games/sw/ui/sbar.zs
+++ b/wadsrc/static/zscript/games/sw/ui/sbar.zs
@@ -747,10 +747,10 @@ class SWStatusBar : RazeStatusBar
 
 		let Health = pp.Health();
 		let MaxHealth = pp.MaxUserHealth();
-		if (!hud_flashing || Health > (MaxHealth >> 2) || (PlayClock & 32))
+		if (!althud_flashing || Health > (MaxHealth >> 2) || (PlayClock & 32))
 		{
 			int s = -8;
-			if (hud_flashing && Health > MaxHealth)
+			if (althud_flashing && Health > MaxHealth)
 				s += Raze.bsin(PlayClock << 5) >> 10;
 			int intens = clamp(255 - 4 * s, 0, 255);
 			let pe = Color(255, intens, intens, intens);
@@ -813,7 +813,7 @@ class SWStatusBar : RazeStatusBar
 				imgX += (imgX * 0.855) * (strlen - 1);
 			}
 
-			if ((!hud_flashing || PlayClock & 32 || ammo > (SW.WeaponMaxAmmo(weapon) / 10)))
+			if ((!althud_flashing || PlayClock & 32 || ammo > (SW.WeaponMaxAmmo(weapon) / 10)))
 			{
 				DrawString(numberFont, format, (-1.5, -numberFont.mFont.GetHeight() - 0.5), DI_TEXT_ALIGN_RIGHT);
 			}