From 9dbd89c557cd4c8b3ca06223cdc4d2ba338875af Mon Sep 17 00:00:00 2001 From: Viktor Holta Date: Fri, 20 May 2022 11:21:05 +0200 Subject: [PATCH] Update rainbow hue with deltatime in SohImGuiImpl.cpp instead --- libultraship/libultraship/SohImGuiImpl.cpp | 9 +++++++++ soh/src/code/z_player_lib.c | 5 +---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index c35a99f5b..0b0dd8195 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -828,6 +828,15 @@ namespace SohImGui { ImGui::PopStyleColor(); } + if ((CVar_GetS32("gTunic_KokiriRainbow", 0) | CVar_GetS32("gTunic_GoronRainbow", 0) |CVar_GetS32("gTunic_ZoraRainbow", 0)) != 0) { + const f32 deltaTime = 1.0f / ImGui::GetIO().Framerate; + f32 hue = CVar_GetFloat("gTunic_RainbowHue", 0.0f); + f32 newHue = hue + CVar_GetS32("gTunic_RainbowSpeed", 1) * 36.0f * deltaTime; + if (newHue >= 360) + newHue = 0; + CVar_SetFloat("gTunic_RainbowHue", newHue); + } + console->Draw(); for (auto& windowIter : customWindows) { diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index 3da89a4b7..8274af5fe 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -749,10 +749,7 @@ void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, if (tunic == PLAYER_TUNIC_KOKIRI && CVar_GetS32("gTunic_KokiriRainbow", 0) != 0 || tunic == PLAYER_TUNIC_GORON && CVar_GetS32("gTunic_GoronRainbow", 0) != 0 || tunic == PLAYER_TUNIC_ZORA && CVar_GetS32("gTunic_ZoraRainbow", 0) != 0) { - u16 hue = CVar_GetS32("gTunic_RainbowHue", 0); - u16 hueDelta = CVar_GetS32("gTunic_RainbowSpeed", 1) * 36.0f / 20.0f; - CVar_SetS32("gTunic_RainbowHue", (hue + hueDelta) % 360); - + f32 hue = CVar_GetFloat("gTunic_RainbowHue", 0); u8 i = hue / 60 + 1; u8 a = (-hue / 60.0f + i) * 255; u8 b = (hue / 60.0f + (1 - i)) * 255;