- fixed hud_scale.

This commit is contained in:
Christoph Oelckers 2020-02-05 19:06:36 +01:00
parent d7e54f83de
commit f6d9b5602b
5 changed files with 9 additions and 23 deletions

View File

@ -181,7 +181,7 @@ CUSTOM_CVARD(Int, hud_scale, 100, CVAR_ARCHIVE | CVAR_NOINITCALL, "changes the h
{ {
if (self < 36) self = 36; if (self < 36) self = 36;
else if (self > 100) self = 100; else if (self > 100) self = 100;
else gi->set_hud_scale(hud_size); else gi->set_hud_scale(hud_scale);
} }
// This is to allow flattening the overly complicated HUD configuration to one single value and keep the complexity safely inside the HUD code. // This is to allow flattening the overly complicated HUD configuration to one single value and keep the complexity safely inside the HUD code.

View File

@ -4348,7 +4348,8 @@ void GameInterface::set_hud_layout(int layout)
void GameInterface::set_hud_scale(int scale) void GameInterface::set_hud_scale(int scale)
{ {
G_SetStatusBarScale(scale); ud.statusbarscale = clamp(scale, 36, 100);
G_UpdateScreenArea();
} }
void G_HandleLocalKeys(void) void G_HandleLocalKeys(void)
@ -4388,7 +4389,7 @@ void G_HandleLocalKeys(void)
} }
else else
{ {
G_SetStatusBarScale(ud.statusbarscale+5); hud_scale = hud_scale + 5;
} }
G_UpdateScreenArea(); G_UpdateScreenArea();
@ -4407,7 +4408,7 @@ void G_HandleLocalKeys(void)
} }
else else
{ {
G_SetStatusBarScale(ud.statusbarscale-5); hud_scale = hud_scale - 5;
} }
G_UpdateScreenArea(); G_UpdateScreenArea();

View File

@ -446,8 +446,6 @@ static inline int G_GetMusicIdx(const char *str)
} }
EXTERN_INLINE_HEADER void G_SetStatusBarScale(int32_t sc);
EXTERN_INLINE_HEADER void SetIfGreater(int32_t *variable, int32_t potentialValue); EXTERN_INLINE_HEADER void SetIfGreater(int32_t *variable, int32_t potentialValue);
#endif #endif
@ -475,12 +473,6 @@ static inline int G_GetViewscreenSizeShift(T const * spr)
#if defined game_c_ || !defined DISABLE_INLINING #if defined game_c_ || !defined DISABLE_INLINING
EXTERN_INLINE void G_SetStatusBarScale(int32_t sc)
{
ud.statusbarscale = clamp(sc, 36, 100);
G_UpdateScreenArea();
}
// the point of this is to prevent re-running a function or calculation passed to potentialValue // the point of this is to prevent re-running a function or calculation passed to potentialValue
// without making a new variable under each individual circumstance // without making a new variable under each individual circumstance
EXTERN_INLINE void SetIfGreater(int32_t *variable, int32_t potentialValue) EXTERN_INLINE void SetIfGreater(int32_t *variable, int32_t potentialValue)

View File

@ -5927,7 +5927,8 @@ void GameInterface::set_hud_layout(int layout)
void GameInterface::set_hud_scale(int scale) void GameInterface::set_hud_scale(int scale)
{ {
G_SetStatusBarScale(scale); ud.statusbarscale = clamp(scale, 36, 100);
G_UpdateScreenArea();
} }
void G_HandleLocalKeys(void) void G_HandleLocalKeys(void)
@ -5966,7 +5967,7 @@ void G_HandleLocalKeys(void)
} }
else else
{ {
G_SetStatusBarScale(ud.statusbarscale+4); hud_scale = hud_scale + 4;
} }
G_UpdateScreenArea(); G_UpdateScreenArea();
@ -5985,7 +5986,7 @@ void G_HandleLocalKeys(void)
} }
else else
{ {
G_SetStatusBarScale(ud.statusbarscale-4); hud_scale = hud_scale - 4;
} }
G_UpdateScreenArea(); G_UpdateScreenArea();

View File

@ -440,8 +440,6 @@ static inline int G_GetMusicIdx(const char *str)
extern void G_PrintCurrentMusic(void); extern void G_PrintCurrentMusic(void);
EXTERN_INLINE_HEADER void G_SetStatusBarScale(int32_t sc);
EXTERN_INLINE_HEADER void SetIfGreater(int32_t *variable, int32_t potentialValue); EXTERN_INLINE_HEADER void SetIfGreater(int32_t *variable, int32_t potentialValue);
template <typename T> template <typename T>
@ -464,12 +462,6 @@ static inline int G_GetViewscreenSizeShift(T const *tspr)
#if defined game_c_ || !defined DISABLE_INLINING #if defined game_c_ || !defined DISABLE_INLINING
EXTERN_INLINE void G_SetStatusBarScale(int32_t sc)
{
ud.statusbarscale = clamp(sc, 36, 100);
G_UpdateScreenArea();
}
// the point of this is to prevent re-running a function or calculation passed to potentialValue // the point of this is to prevent re-running a function or calculation passed to potentialValue
// without making a new variable under each individual circumstance // without making a new variable under each individual circumstance
EXTERN_INLINE void SetIfGreater(int32_t *variable, int32_t potentialValue) EXTERN_INLINE void SetIfGreater(int32_t *variable, int32_t potentialValue)