From 8b0117bc58ec64367852bcb48a14c608a525cfc2 Mon Sep 17 00:00:00 2001 From: David Chavez Date: Fri, 12 Aug 2022 02:49:07 +0200 Subject: [PATCH] noUI placeholder --- soh/soh/Enhancements/debugconsole.cpp | 22 +++++++++++++++++++++- soh/soh/Enhancements/debugconsole.h | 1 - soh/src/code/z_play.c | 4 ++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/debugconsole.cpp b/soh/soh/Enhancements/debugconsole.cpp index bea848d7f..daf4d0b6e 100644 --- a/soh/soh/Enhancements/debugconsole.cpp +++ b/soh/soh/Enhancements/debugconsole.cpp @@ -39,7 +39,7 @@ uint32_t giantLink; uint32_t minishLink; uint32_t gravityLevel; uint32_t resetLinkScale; -uint32_t noUi; +uint32_t noUI; uint32_t invisibleLink; static bool ActorSpawnHandler(std::shared_ptr Console, const std::vector& args) { @@ -468,6 +468,22 @@ static bool GravityHandler(std::shared_ptr Console, const std::ve } } +// TODO: Does not yet function +static bool NoUIHandler(std::shared_ptr Console, const std::vector& args) { + if (args.size() != 2) { + SohImGui::console->SendErrorMessage("[SOH] Unexpected arguments passed"); + return CMD_FAILED; + } + + try { + bool noUI = std::stoi(args[1], nullptr, 10) == 0 ? 0 : 1; + return CMD_SUCCESS; + } catch (std::invalid_argument const& ex) { + SohImGui::console->SendErrorMessage("[SOH] NoUI value must be a number."); + return CMD_FAILED; + } +} + #define VARTYPE_INTEGER 0 #define VARTYPE_FLOAT 1 #define VARTYPE_STRING 2 @@ -634,5 +650,9 @@ void DebugConsole_Init(void) { { "value", Ship::ArgumentType::NUMBER } }}); + CMD_REGISTER("no_ui", { NoUIHandler, "Disable the UI.", { + { "value", Ship::ArgumentType::NUMBER } + }}); + CVar_Load(); } diff --git a/soh/soh/Enhancements/debugconsole.h b/soh/soh/Enhancements/debugconsole.h index d9f63f1a3..dabe171ab 100644 --- a/soh/soh/Enhancements/debugconsole.h +++ b/soh/soh/Enhancements/debugconsole.h @@ -10,7 +10,6 @@ extern uint32_t giantLink; extern uint32_t minishLink; extern uint32_t gravityLevel; extern uint32_t resetLinkScale; -extern uint32_t noUi; extern uint32_t invisibleLink; #ifdef __cplusplus } diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c index b67713087..ac5978570 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -1562,7 +1562,7 @@ void RemoveEffect(const char* effectId) { gravityLevel = 1; return; } else if (strcmp(effectId, "no_ui") == 0) { - noUi = 0; + noUI = 0; return; } else if (strcmp(effectId, "invisible") == 0) { invisibleLink = 0; @@ -1670,7 +1670,7 @@ u8 ExecuteEffect(const char* effectId, uint32_t value) { Actor_Spawn(&gGlobalCtx->actorCtx, gGlobalCtx, ACTOR_EN_WALLMAS, player->actor.world.pos.x, player->actor.world.pos.y, player->actor.world.pos.z, 0, 0, 0, 0); return 1; } else if (strcmp(effectId, "no_ui") == 0) { - noUi = 1; + noUI = 1; return 1; } else if (strcmp(effectId, "invisible") == 0) { invisibleLink = 1;