From 1aa8ef7692c9411ea8bf402bdb484d8e524ad946 Mon Sep 17 00:00:00 2001 From: "U-ALTTP-PC\\ALTTP" Date: Tue, 19 May 2020 03:24:51 -0300 Subject: [PATCH] option to hide the hud --- include/text_strings.h.in | 1 + src/game/hud.c | 14 ++++++++------ src/game/options_menu.c | 2 ++ src/pc/configfile.c | 1 + src/pc/configfile.h | 1 + 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/include/text_strings.h.in b/include/text_strings.h.in index 9b70acf6..d4ec173a 100644 --- a/include/text_strings.h.in +++ b/include/text_strings.h.in @@ -30,6 +30,7 @@ #define TEXT_OPT_VSYNC _("Vertical Sync") #define TEXT_OPT_DOUBLE _("Double") #define TEXT_RESET_WINDOW _("Reset Window") +#define TEXT_OPT_HUD _("HUD") #define TEXT_OPT_UNBOUND _("NONE") #define TEXT_OPT_PRESSKEY _("...") diff --git a/src/game/hud.c b/src/game/hud.c index 277806b5..cf3dee0f 100644 --- a/src/game/hud.c +++ b/src/game/hud.c @@ -1,4 +1,5 @@ #include +#include #include "sm64.h" #include "gfx_dimensions.h" @@ -56,6 +57,7 @@ static struct UnusedHUDStruct sUnusedHUDValues = { 0x00, 0x0A, 0x00 }; static struct CameraHUD sCameraHUD = { CAM_STATUS_NONE }; +extern bool configHUD; /** * Renders a rgba16 16x16 glyph texture from a table list. */ @@ -450,28 +452,28 @@ void render_hud(void) { render_hud_cannon_reticle(); } - if (hudDisplayFlags & HUD_DISPLAY_FLAG_LIVES) { + if (hudDisplayFlags & HUD_DISPLAY_FLAG_LIVES && configHUD) { render_hud_mario_lives(); } - if (hudDisplayFlags & HUD_DISPLAY_FLAG_COIN_COUNT) { + if (hudDisplayFlags & HUD_DISPLAY_FLAG_COIN_COUNT && configHUD) { render_hud_coins(); } - if (hudDisplayFlags & HUD_DISPLAY_FLAG_STAR_COUNT) { + if (hudDisplayFlags & HUD_DISPLAY_FLAG_STAR_COUNT && configHUD) { render_hud_stars(); } - if (hudDisplayFlags & HUD_DISPLAY_FLAG_KEYS) { + if (hudDisplayFlags & HUD_DISPLAY_FLAG_KEYS && configHUD) { render_hud_keys(); } - if (hudDisplayFlags & HUD_DISPLAY_FLAG_CAMERA_AND_POWER) { + if (hudDisplayFlags & HUD_DISPLAY_FLAG_CAMERA_AND_POWER && configHUD) { render_hud_power_meter(); render_hud_camera_status(); } - if (hudDisplayFlags & HUD_DISPLAY_FLAG_TIMER) { + if (hudDisplayFlags & HUD_DISPLAY_FLAG_TIMER && configHUD) { render_hud_timer(); } } diff --git a/src/game/options_menu.c b/src/game/options_menu.c index ab7da294..37b1a5a5 100644 --- a/src/game/options_menu.c +++ b/src/game/options_menu.c @@ -75,6 +75,7 @@ static const u8 optsVideoStr[][32] = { { TEXT_RESET_WINDOW }, { TEXT_OPT_VSYNC }, { TEXT_OPT_DOUBLE }, + { TEXT_OPT_HUD }, }; static const u8 optsAudioStr[][32] = { @@ -235,6 +236,7 @@ static struct Option optsVideo[] = { DEF_OPT_CHOICE( optsVideoStr[5], &configWindow.vsync, vsyncChoices ), DEF_OPT_CHOICE( optsVideoStr[1], &configFiltering, filterChoices ), DEF_OPT_BUTTON( optsVideoStr[4], optvideo_reset_window ), + DEF_OPT_TOGGLE( optsVideoStr[7], &configHUD ), }; static struct Option optsAudio[] = { diff --git a/src/pc/configfile.c b/src/pc/configfile.c index ce9a08ad..26211305 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -78,6 +78,7 @@ bool configEnableCamera = false; bool configCameraMouse = false; #endif unsigned int configSkipIntro = 0; +bool configHUD = true; static const struct ConfigOption options[] = { {.name = "fullscreen", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.fullscreen}, diff --git a/src/pc/configfile.h b/src/pc/configfile.h index cafd272f..17a7e25d 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -46,6 +46,7 @@ extern bool configCameraInvertY; extern bool configEnableCamera; extern bool configCameraMouse; #endif +extern bool configHUD; void configfile_load(const char *filename); void configfile_save(const char *filename);