- fixed the HUD size slider for Blood.

This commit is contained in:
Christoph Oelckers 2020-01-22 13:53:26 +01:00
parent 6a06f6aef4
commit 09106b3159
6 changed files with 20 additions and 23 deletions

View File

@ -87,7 +87,6 @@ struct GameInterface : ::GameInterface
void UpdateScreenSize() override;
bool GenerateSavePic() override;
void FreeGameData() override;
bool validate_hud(int) override;
void set_hud_layout(int size) override;
void set_hud_scale(int size) override;
FString statFPS() override;

View File

@ -55,22 +55,10 @@ int32_t mouseyaxismode = -1;
// This is mainly here to account for the different implementation between Blood and the other games
// and to allow unified handling and the same value range in the CVAR code.
// Unlike EDuke's version, NBlood's was actually fine, it just had a too small value range to be chosen as the unified version.
bool GameInterface::validate_hud(int layout)
{
return layout > 3 && layout != 8; // 8 is the status bar overlay which NBlood did not implement.
}
void GameInterface::set_hud_layout(int layout)
{
static const uint8_t screen_size_vals[] = { 7, 7, 7, 7, 6, 5, 4, 3, 3, 2, 1, 0 };
if (validate_hud(layout))
{
viewResizeView(screen_size_vals[layout]);
}
layout = clamp(7 - layout, 0, 7); // need to reverse the order because menu sliders always have low values to the left.
viewResizeView(layout);
}
void GameInterface::set_hud_scale(int scale)

View File

@ -104,9 +104,9 @@ struct GameInterface
virtual int app_main() = 0;
virtual void UpdateScreenSize() {}
virtual void FreeGameData() {}
virtual bool validate_hud(int) = 0;
virtual bool validate_hud(int) { return true; }
virtual void set_hud_layout(int size) = 0;
virtual void set_hud_scale(int size) = 0;
virtual void set_hud_scale(int size) {}
virtual FString statFPS() { return "FPS display not available"; }
virtual GameStats getStats() { return {}; }
virtual void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags) {}

View File

@ -92,6 +92,8 @@ CVAR(Bool, disableautoload, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALC
//CVAR(Bool, autoloadbrightmaps, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG) // hopefully this is an option for later
//CVAR(Bool, autoloadlights, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
extern int hud_size_max;
//==========================================================================
//
@ -611,9 +613,9 @@ int RunGame()
if (g_gameType & GAMEFLAG_BLOOD)
{
UCVarValue v;
v.Bool = false;
mus_redbook.SetGenericRepDefault(v, CVAR_Bool); // Blood should default to CD Audio off - all other games must default to on.
mus_redbook.SetGenericRepDefault(false, CVAR_Bool); // Blood should default to CD Audio off - all other games must default to on.
hud_size.SetGenericRepDefault(6, CVAR_Int); // HUD is different for everything.
hud_size_max = 7;
}
G_ReadConfig(currentGame);

View File

@ -160,10 +160,13 @@ CUSTOM_CVARD(Int, snd_speech, 5, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enables/disabl
// This was particularly messy. EDuke and Rednukem had no consistent setting for this but a complex combination of 4 CVARs and lots of mod flags controlling the HUD layout
// NBlood had this differently with an inverted scale of 0-7 with 0 having no HUD.
// For consistency all frontends now use the same scale, with 0 being the smallest and 11 being the largest, which get converted to the internal settings by the set_hud_layout callback.
int hud_size_max = 11; // 11 is for Duke Nukem and its offspring games.
CUSTOM_CVARD(Int, hud_size, 9, CVAR_ARCHIVE | CVAR_NOINITCALL, "Defines the HUD size and style")
{
if (self < 0) self = 0;
else if (self > 11) self = 11;
else if (self > hud_size_max) self = hud_size_max;
else
{
if (gi->validate_hud(self))

View File

@ -1197,11 +1197,16 @@ OptionMenu "HUDOptions" //protected
{
Title "$OPTMNU_HUD"
Slider "$DSPLYMNU_SCREENSIZE", "hud_size", 0.0, 11.0, 1.0, -1
ifgame(duke, nam, ww2gi, redneck, redneckrides, fury) // Fixme: The scaling really needs to be taken out of the game code.
ifgame(duke, nam, ww2gi, redneck, redneckrides, fury)
{
Slider "$DSPLYMNU_SCREENSIZE", "hud_size", 0.0, 11.0, 1.0, -1
Slider "$DSPLYMNU_SBSCALE", "hud_scale", 0.3, 1.0, 0.1, 2
}
ifgame(blood)
{
Slider "$DSPLYMNU_SCREENSIZE", "hud_size", 0.0, 7.0, 1.0, -1
}
Option "$DSPLYMNU_LEVELSTATS", "hud_stats", "OnOff"
ifgame(duke, nam, ww2gi, redneck, redneckrides, fury)
{