From 6561073c7b98289e59397e7c3dd4819b621bd2cb Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Wed, 24 Aug 2022 00:07:16 -0400 Subject: [PATCH] Implements ImGui Checkbox to enable or disable color-coded-keys. --- libultraship/libultraship/ImGuiImpl.cpp | 3 +++ soh/src/code/z_draw.c | 2 +- soh/src/code/z_player_lib.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index cac675a93..8ba847ea3 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -1903,6 +1903,9 @@ namespace SohImGui { "(medallions/stones/songs). Note that these fanfares\n" "are longer than usual." ); + PaddedEnhancementCheckbox("Key Colors Match Dungeon", "gRandoMatchKeyColors", true, false); + Tooltip( + "Matches the color of small keys and boss keys to the dungeon they belong to. This helps identify keys from afar and adds a little bit of flair."); ImGui::EndMenu(); } diff --git a/soh/src/code/z_draw.c b/soh/src/code/z_draw.c index d85521efa..2751f4716 100644 --- a/soh/src/code/z_draw.c +++ b/soh/src/code/z_draw.c @@ -400,7 +400,7 @@ void GetItem_Draw(GlobalContext* globalCtx, s16 drawId) { * Uses the Custom Draw Function if it exists, or just calls `GetItem_Draw` */ void GetItemEntry_Draw(GlobalContext* globalCtx, GetItemEntry getItemEntry) { - if (getItemEntry.drawFunc != NULL) { + if (getItemEntry.drawFunc != NULL && CVar_GetS32("gRandoMatchKeyColors", 0)) { getItemEntry.drawFunc(globalCtx, &getItemEntry); } else { GetItem_Draw(globalCtx, getItemEntry.gid); diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index f30c493da..203585331 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -1170,7 +1170,7 @@ void Player_DrawGetItemImpl(GlobalContext* globalCtx, Player* this, Vec3f* refPo Matrix_RotateZYX(0, globalCtx->gameplayFrames * 1000, 0, MTXMODE_APPLY); Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); - if(this->getItemEntry.drawFunc != NULL) { + if (this->getItemEntry.drawFunc != NULL && CVar_GetS32("gRandoMatchKeyColors", 0)) { this->getItemEntry.drawFunc(globalCtx, &this->getItemEntry); } else { GetItem_Draw(globalCtx, drawIdPlusOne - 1);