Update rainbow hue with deltatime in SohImGuiImpl.cpp instead

This commit is contained in:
Viktor Holta 2022-05-20 11:21:05 +02:00
commit 9dbd89c557
2 changed files with 10 additions and 4 deletions

View file

@ -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) {

View file

@ -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;