From aa119ce8f9132a13df32f8fdfdbab0a3fff2068d Mon Sep 17 00:00:00 2001 From: Malkierian Date: Sat, 22 Nov 2025 19:21:40 -0700 Subject: [PATCH] Convert all menu code to new menu, convert Holiday structure to ShipInit and MenuInit, and disable custom rainbows. --- soh/soh/Enhancements/Holiday/AGreenSpoon.cpp | 24 +- soh/soh/Enhancements/Holiday/Archez.cpp | 24 +- soh/soh/Enhancements/Holiday/Caladius.cpp | 164 ++++++------- soh/soh/Enhancements/Holiday/Example.cpp | 8 +- soh/soh/Enhancements/Holiday/Fredomato.cpp | 218 ++++++++++-------- soh/soh/Enhancements/Holiday/Grimey.cpp | 40 ++-- soh/soh/Enhancements/Holiday/Holiday.hpp | 28 +-- soh/soh/Enhancements/Holiday/LL.cpp | 114 ++++----- soh/soh/Enhancements/Holiday/LL.h | 113 ++++----- soh/soh/Enhancements/Holiday/NotProxySaw.cpp | 25 +- soh/soh/Enhancements/Holiday/Pablo.cpp | 48 ++-- soh/soh/Enhancements/Holiday/ProxySaw.cpp | 90 ++++---- soh/soh/Enhancements/Holiday/Rando.cpp | 14 +- soh/soh/Enhancements/Holiday/aMannus.cpp | 24 +- soh/soh/Enhancements/Holiday/lilDavid.cpp | 23 +- .../Enhancements/TimeDisplay/TimeDisplay.cpp | 4 +- .../cosmetics/CosmeticsEditor.cpp | 20 +- soh/soh/Enhancements/mods.cpp | 1 - .../Network/Anchor/Packets/SetCheckStatus.cpp | 2 +- soh/soh/SohGui/SohMenu.cpp | 1 + .../ovl_Boss_Ganondrof/z_boss_ganondrof.c | 5 +- .../ovl_En_ChristmasTree/z_en_christmastree.c | 3 +- .../actors/ovl_En_Wood02/z_en_wood02.c | 5 +- 23 files changed, 469 insertions(+), 529 deletions(-) diff --git a/soh/soh/Enhancements/Holiday/AGreenSpoon.cpp b/soh/soh/Enhancements/Holiday/AGreenSpoon.cpp index 0de6bc369..f9ed8b54e 100644 --- a/soh/soh/Enhancements/Holiday/AGreenSpoon.cpp +++ b/soh/soh/Enhancements/Holiday/AGreenSpoon.cpp @@ -61,21 +61,13 @@ static void OnConfigurationChanged() { }); } -static void DrawMenu() { - //ImGui::SeparatorText(AUTHOR); - //if (UIWidgets::EnhancementCheckbox("Evil Gossip Stone", CVAR("EvilGossipStone"))) { - // OnConfigurationChanged(); - //} - //UIWidgets::Tooltip("Don't you dare talk to them."); +static void RegisterMenu() { + WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 }; + SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2); + SohGui::mSohMenu->AddWidget(path, "Evil Gossip Stone", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR("EvilGossipStone")) + .Options(UIWidgets::CheckboxOptions().Tooltip("Don't you dare talk to them.")); } -static void RegisterMod() { - // #region Leave this alone unless you know what you are doing - OnConfigurationChanged(); - // #endregion - - // TODO: Anything you want to run once on startup -} - -// TODO: Uncomment this line to enable the mod -static Holiday holiday(DrawMenu, RegisterMod); +static RegisterShipInitFunc initFunc(OnConfigurationChanged); +static RegisterMenuInitFunc menuInitFunc(RegisterMenu); diff --git a/soh/soh/Enhancements/Holiday/Archez.cpp b/soh/soh/Enhancements/Holiday/Archez.cpp index efca4c22b..642c66ea5 100644 --- a/soh/soh/Enhancements/Holiday/Archez.cpp +++ b/soh/soh/Enhancements/Holiday/Archez.cpp @@ -34,7 +34,7 @@ extern "C" void ClearOverrideSkips() { sSkipNextSkeleton = false; } -static void ConfigurationChanged() { +static void OnConfigurationChanged() { COND_VB_SHOULD(VB_DRAW_SKEL_LIMB, CVarGetInteger(CVAR("SnowGolems"), 0), { if (!*should) { return; @@ -107,17 +107,15 @@ static void ConfigurationChanged() { }); } -static void DrawMenu() { - ImGui::SeparatorText(AUTHOR); - - //if (UIWidgets::EnhancementCheckbox("Snow Golems", CVAR("SnowGolems"))) { - // ConfigurationChanged(); - //} - UIWidgets::Tooltip("Overrides most charactor skeletons with snow balls to make them look like Snow Golems"); +static void RegisterMenu() { + WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 }; + SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2); + SohGui::mSohMenu->AddWidget(path, "Snow Golems", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR("SnowGolems")) + .Callback([](WidgetInfo& info) { OnConfigurationChanged(); }) + .Options(UIWidgets::CheckboxOptions().Tooltip( + "Overrides most charactor skeletons with snow balls to make them look like Snow Golems")); } -static void RegisterMod() { - ConfigurationChanged(); -} - -static Holiday holiday(DrawMenu, RegisterMod); +static RegisterShipInitFunc initFunc(OnConfigurationChanged); +static RegisterMenuInitFunc menuInitFunc(RegisterMenu); diff --git a/soh/soh/Enhancements/Holiday/Caladius.cpp b/soh/soh/Enhancements/Holiday/Caladius.cpp index c927c397d..8a0b37df0 100644 --- a/soh/soh/Enhancements/Holiday/Caladius.cpp +++ b/soh/soh/Enhancements/Holiday/Caladius.cpp @@ -84,8 +84,7 @@ void RandomizeBoulder(Actor* refActor) { bool spawningPresents = false; -struct Present { -}; +struct Present {}; std::unordered_map presents; @@ -126,7 +125,8 @@ void Present_Draw(Actor* actor, PlayState* play) { Matrix_Scale(30.0f, 30.0f, 30.0f, MTXMODE_APPLY); Matrix_Translate(49.20f, 0.0f, -106.60f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), + G_MTX_MODELVIEW | G_MTX_LOAD); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gXmasDecor100DL); @@ -139,39 +139,37 @@ void Present_Destroy(Actor* actor, PlayState* play) { static void OnPresentChange() { isExchangeDisabled = !CVarGetInteger(CVAR("OrnExch.Enabled"), 0); - COND_ID_HOOK(OnOpenText, 0x204A, CVarGetInteger(CVAR("OrnExch.Enabled"), 0), [](u16 * textId, bool* loadFromMessageTable) { - auto messageEntry = CustomMessage(""); - bool reduceGifts = false; - uint32_t giftsCollected = CVarGetInteger(CVAR("GiftsCollected"), 0); - uint32_t giftsRequired = CVarGetInteger(CVAR("OrnExch.Amount"), 15); - if (giftsCollected < giftsRequired) { - std::string msg = "You only have %r " + std::to_string(giftsCollected) + "%w If you bring me %g" - + std::to_string(giftsRequired) + "%w I'll give you a reward!"; - messageEntry = CustomMessage(msg); - } else { - std::string msg = "A present? And %g" + std::to_string(giftsRequired) + - "%w to boot? Here's your reward, bring me more if you find any!"; - messageEntry = CustomMessage(msg); - reduceGifts = true; - } - messageEntry.AutoFormat(); - messageEntry.LoadIntoFont(); - *loadFromMessageTable = false; + COND_ID_HOOK( + OnOpenText, 0x204A, CVarGetInteger(CVAR("OrnExch.Enabled"), 0), [](u16* textId, bool* loadFromMessageTable) { + auto messageEntry = CustomMessage(""); + bool reduceGifts = false; + uint32_t giftsCollected = CVarGetInteger(CVAR("GiftsCollected"), 0); + uint32_t giftsRequired = CVarGetInteger(CVAR("OrnExch.Amount"), 15); + if (giftsCollected < giftsRequired) { + std::string msg = "You only have %r " + std::to_string(giftsCollected) + "%w If you bring me %g" + + std::to_string(giftsRequired) + "%w I'll give you a reward!"; + messageEntry = CustomMessage(msg); + } else { + std::string msg = "A present? And %g" + std::to_string(giftsRequired) + + "%w to boot? Here's your reward, bring me more if you find any!"; + messageEntry = CustomMessage(msg); + reduceGifts = true; + } + messageEntry.AutoFormat(); + messageEntry.LoadIntoFont(); + *loadFromMessageTable = false; - if (reduceGifts) { - vanillaQueuedItemEntry = Rando::StaticData::RetrieveItem(RG_TRIFORCE_PIECE).GetGIEntry_Copy(); - giftsCollected -= giftsRequired; - CVarSetInteger(CVAR("GiftsCollected"), giftsCollected); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); + if (reduceGifts) { + vanillaQueuedItemEntry = Rando::StaticData::RetrieveItem(RG_TRIFORCE_PIECE).GetGIEntry_Copy(); + giftsCollected -= giftsRequired; + CVarSetInteger(CVAR("GiftsCollected"), giftsCollected); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); - std::string msg = std::to_string(giftsCollected).c_str(); - msg += " Gifts in Inventory."; - Notification::Emit({ - .itemIcon = "RG_TRIFORCE_PIECE", - .message = msg - }); - } - }); + std::string msg = std::to_string(giftsCollected).c_str(); + msg += " Gifts in Inventory."; + Notification::Emit({ .itemIcon = "RG_TRIFORCE_PIECE", .message = msg }); + } + }); COND_HOOK(OnSceneSpawnActors, CVarGetInteger(CVAR("OrnExch.Enabled"), 0), []() { presents.clear(); @@ -188,7 +186,7 @@ static void OnPresentChange() { pos.x = 0; pos.z = 0; } - // X/Z anywhere from -1000.0 to +1000.0 from player + // X/Z anywhere from -1000.0 to +1000.0 from player pos.x += (float)(Random(0, 20000)) - 10000.0f; pos.z += (float)(Random(0, 20000)) - 10000.0f; @@ -196,7 +194,8 @@ static void OnPresentChange() { if (raycastResult > BGCHECK_Y_MIN) { spawningPresents = true; - Actor* actor = Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_OE2, pos.x, raycastResult, pos.z, 0, 0, 0, 0, false); + Actor* actor = Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_OE2, pos.x, raycastResult, pos.z, + 0, 0, 0, 0, false); spawningPresents = false; // break; } @@ -205,15 +204,16 @@ static void OnPresentChange() { } }); - COND_ID_HOOK(ShouldActorInit, ACTOR_EN_OE2, CVarGetInteger(CVAR("OrnExch.Enabled"), 0), [](void* actorRef, bool* should) { - Actor* actor = (Actor*)actorRef; - if (spawningPresents) { - actor->init = Present_Init; - actor->update = Present_Update; - actor->draw = Present_Draw; - actor->destroy = Present_Destroy; - } - }); + COND_ID_HOOK(ShouldActorInit, ACTOR_EN_OE2, CVarGetInteger(CVAR("OrnExch.Enabled"), 0), + [](void* actorRef, bool* should) { + Actor* actor = (Actor*)actorRef; + if (spawningPresents) { + actor->init = Present_Init; + actor->update = Present_Update; + actor->draw = Present_Draw; + actor->destroy = Present_Destroy; + } + }); } static void OnBlitzChange() { @@ -270,39 +270,48 @@ void CaladiusWindow::Draw() { ImGui::PopStyleVar(1); } -static void DrawMenu() { - //ImGui::SeparatorText(AUTHOR); - //if (UIWidgets::EnhancementCheckbox("Holiday Fever", CVAR("Fever.Enabled"))) { - // OnFeverConfigurationChanged(); - //} - //UIWidgets::Tooltip("Can you beat your objective before the Fever sets in?/n" - // "- Obtaining Ice Traps extends your timer."); - //if (CVarGetInteger(CVAR("Fever.Enabled"), 0)) { - // if (UIWidgets::EnhancementSliderFloat("", "##FontScale", CVAR("FontScale"), - // 1.0f, 5.0f, "Font: %.1fx", 1.0f, false, false, isFeverDisabled)) { - // OnFeverConfigurationChanged(); - // } - // UIWidgets::PaddedEnhancementSliderInt("Starting Timer: %d minutes", "##StartTime", CVAR("StartTimer"), - // 5, 30, "", 15, true, true, false, isFeverDisabled); - // UIWidgets::PaddedEnhancementSliderInt("Time Extensions: %d minutes", "##ExtendTime", CVAR("ExtendTimer"), - // 1, 10, "", 5, true, true, false, isFeverDisabled); - //} - //UIWidgets::PaddedSeparator(); +static void RegisterMenu() { + WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 }; + SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2); + SohGui::mSohMenu->AddWidget(path, "Holiday Fever", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR("Fever.Enabled")) + .Callback([](WidgetInfo& info) { OnFeverConfigurationChanged(); }) + .Options(UIWidgets::CheckboxOptions().Tooltip("Can you beat your objective before the Fever sets in?\n" + "- Obtaining Ice Traps extends your timer.")); + SohGui::mSohMenu->AddWidget(path, "Font: %.1fx", WIDGET_CVAR_SLIDER_FLOAT) + .CVar(CVAR("FontScale")) + .Callback([](WidgetInfo& info) { OnFeverConfigurationChanged(); }) + .PreFunc([](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("Fever.Enabled"), 0); }) + .Options(UIWidgets::FloatSliderOptions().DefaultValue(1.0f).Min(1.0f).Max(5.0f)); + SohGui::mSohMenu->AddWidget(path, "Starting Timer: %d minutes", WIDGET_CVAR_SLIDER_INT) + .CVar(CVAR("StartTimer")) + .Callback([](WidgetInfo& info) { OnFeverConfigurationChanged(); }) + .PreFunc([](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("Fever.Enabled"), 0); }) + .Options(UIWidgets::IntSliderOptions().DefaultValue(15).Min(5).Max(30)); + SohGui::mSohMenu->AddWidget(path, "Time Extensions: %d minutes", WIDGET_CVAR_SLIDER_INT) + .CVar(CVAR("ExtendTimer")) + .Callback([](WidgetInfo& info) { OnFeverConfigurationChanged(); }) + .PreFunc([](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("Fever.Enabled"), 0); }) + .Options(UIWidgets::IntSliderOptions().DefaultValue(5).Min(1).Max(10)); - //if (UIWidgets::EnhancementCheckbox("Boulder Blitz", CVAR("Blitz.Enabled"))) { - // OnBlitzChange(); - //} - //UIWidgets::Tooltip("Boulders will randomly be replaced with other boulder types."); - //UIWidgets::PaddedSeparator(); + SohGui::mSohMenu->AddWidget(path, "BoulderBlitzSect", WIDGET_SEPARATOR); + SohGui::mSohMenu->AddWidget(path, "Boulder Blitz", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR("Blitz.Enabled")) + .Callback([](WidgetInfo& info) { OnBlitzChange(); }) + .Options(UIWidgets::CheckboxOptions().Tooltip("Boulders will randomly be replaced with other boulder types.")); - //if (UIWidgets::EnhancementCheckbox("Ornament Exchange", CVAR("OrnExch.Enabled"))) { - // OnPresentChange(); - //} - //UIWidgets::Tooltip("See Malon as Young Link in Lon Lon Ranch to exchange Gifts for Ornaments!"); - //if (CVarGetInteger(CVAR("OrnExch.Enabled"), 0)) { - // UIWidgets::PaddedEnhancementSliderInt("Gifts Required: %d Gifts", "##GiftsReq", CVAR("OrnExch.Amount"), - // 5, 30, "", 15, true, true, false, isExchangeDisabled); - //} + SohGui::mSohMenu->AddWidget(path, "OrnamentExchSect", WIDGET_SEPARATOR); + SohGui::mSohMenu->AddWidget(path, "Ornament Exchange", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR("OrnExch.Enabled")) + .Callback([](WidgetInfo& info) { OnPresentChange(); }) + .Options(UIWidgets::CheckboxOptions().Tooltip( + "See Malon as Young Link in Lon Lon Ranch to exchange Gifts for Ornaments!")); + + SohGui::mSohMenu->AddWidget(path, "Gifts Required: %d Gifts", WIDGET_CVAR_SLIDER_INT) + .CVar(CVAR("OrnExch.Amount")) + .Callback([](WidgetInfo& info) { OnFeverConfigurationChanged(); }) + .PreFunc([](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("OrnExch.Enabled"), 0); }) + .Options(UIWidgets::IntSliderOptions().DefaultValue(15).Min(5).Max(30)); } static void RegisterMod() { @@ -311,4 +320,5 @@ static void RegisterMod() { OnPresentChange(); } -static Holiday holiday(DrawMenu, RegisterMod); +static RegisterShipInitFunc initFunc(RegisterMod); +static RegisterMenuInitFunc menuInitFunc(RegisterMenu); diff --git a/soh/soh/Enhancements/Holiday/Example.cpp b/soh/soh/Enhancements/Holiday/Example.cpp index 17ab542ce..5cb757559 100644 --- a/soh/soh/Enhancements/Holiday/Example.cpp +++ b/soh/soh/Enhancements/Holiday/Example.cpp @@ -27,10 +27,10 @@ static void OnConfigurationChanged() { } static void DrawMenu() { - //ImGui::SeparatorText(AUTHOR); - //if (UIWidgets::EnhancementCheckbox("DoSomethingWithPots", CVAR("DoSomethingWithPots"))) { - // OnConfigurationChanged(); - //} + // ImGui::SeparatorText(AUTHOR); + // if (UIWidgets::EnhancementCheckbox("DoSomethingWithPots", CVAR("DoSomethingWithPots"))) { + // OnConfigurationChanged(); + // } } static void RegisterMod() { diff --git a/soh/soh/Enhancements/Holiday/Fredomato.cpp b/soh/soh/Enhancements/Holiday/Fredomato.cpp index 0f7280ed1..702e52988 100644 --- a/soh/soh/Enhancements/Holiday/Fredomato.cpp +++ b/soh/soh/Enhancements/Holiday/Fredomato.cpp @@ -35,23 +35,25 @@ static CollisionPoly snowballPoly; static f32 raycastResult; const s16 entrances[] = { - 0x0000, 0x0209, 0x0004, 0x0242, 0x0028, 0x0221, 0x0169, 0x0215, 0x0165, 0x024A, 0x0010, 0x021D, 0x0082, 0x01E1, 0x0037, 0x0205, - 0x0098, 0x02A6, 0x0088, 0x03D4, 0x0008, 0x03A8, 0x0467, 0x023D, 0x0433, 0x0443, 0x0437, 0x0447, 0x009C, 0x033C, 0x00C9, 0x026A, - 0x00C1, 0x0266, 0x0043, 0x03CC, 0x045F, 0x0309, 0x03A0, 0x03D0, 0x007E, 0x026E, 0x0530, 0x01D1, 0x0507, 0x03BC, 0x0388, 0x02A2, - 0x0063, 0x01D5, 0x0528, 0x03C0, 0x043B, 0x0067, 0x02FD, 0x0349, 0x0550, 0x04EE, 0x039C, 0x0345, 0x05C8, 0x05DC, 0x0072, 0x034D, - 0x030D, 0x0355, 0x037C, 0x03FC, 0x0380, 0x03C4, 0x004F, 0x0378, 0x02F9, 0x042F, 0x05D0, 0x05D4, 0x052C, 0x03B8, 0x016D, 0x01CD, - 0x00B7, 0x0201, 0x003B, 0x0463, 0x0588, 0x057C, 0x0578, 0x0340, 0x04C2, 0x03E8, 0x04BE, 0x0482, 0x0315, 0x045B, 0x0371, 0x0394, - 0x0272, 0x0211, 0x0053, 0x0472, 0x0453, 0x0351, 0x0384, 0x044B, 0x03EC, 0x04FF, 0x0700, 0x0800, 0x0701, 0x0801, 0x0702, 0x0802, - 0x0703, 0x0803, 0x0704, 0x0804, 0x0705, 0x0805, 0x0706, 0x0806, 0x0707, 0x0807, 0x0708, 0x0808, 0x0709, 0x0809, 0x070A, 0x080A, - 0x070B, 0x080B, 0x070C, 0x080C, 0x070D, 0x080D, 0x070E, 0x080E, 0x070F, 0x080F, 0x0710, 0x0711, 0x0811, 0x0712, 0x0812, - 0x0713, 0x0813, 0x0714, 0x0814, 0x0715, 0x0815, 0x0716, 0x0816, 0x0717, 0x0817, 0x0718, 0x0818, 0x0719, 0x0819, 0x081A, - 0x071B, 0x081B, 0x071C, 0x081C, 0x071D, 0x081D, 0x071E, 0x081E, 0x071F, 0x081F, 0x0720, 0x0820, 0x004B, 0x035D, 0x031C, 0x0361, - 0x002D, 0x050B, 0x044F, 0x0359, 0x05E0, 0x020D, 0x011E, 0x0286, 0x04E2, 0x04D6, 0x01DD, 0x04DA, 0x00FC, 0x01A9, 0x0185, 0x04DE, - 0x0102, 0x0189, 0x0117, 0x018D, 0x0276, 0x01FD, 0x00DB, 0x017D, 0x00EA, 0x0181, 0x0157, 0x01F9, 0x0328, 0x0560, 0x0129, 0x022D, - 0x0130, 0x03AC, 0x0123, 0x0365, 0x00B1, 0x0033, 0x0138, 0x025A, 0x0171, 0x025E, 0x00E4, 0x0195, 0x013D, 0x0191, 0x014D, 0x01B9, - 0x0246, 0x01C1, 0x0147, 0x01BD, 0x0108, 0x019D, 0x0225, 0x01A1, 0x0219, 0x027E, 0x0554, 0x00BB, 0x0282, 0x0600, 0x04F6, 0x0604, - 0x01F1, 0x0568, 0x05F4, 0x040F, 0x0252, 0x040B, 0x00C5, 0x0301, 0x0407, 0x000C, 0x024E, 0x0305, 0x0175, 0x0417, 0x0423, 0x008D, - 0x02F5, 0x0413, 0x02B2, 0x0457, 0x047A, 0x010E, 0x0608, 0x0564, 0x060C, 0x0610, 0x0580 + 0x0000, 0x0209, 0x0004, 0x0242, 0x0028, 0x0221, 0x0169, 0x0215, 0x0165, 0x024A, 0x0010, 0x021D, 0x0082, 0x01E1, + 0x0037, 0x0205, 0x0098, 0x02A6, 0x0088, 0x03D4, 0x0008, 0x03A8, 0x0467, 0x023D, 0x0433, 0x0443, 0x0437, 0x0447, + 0x009C, 0x033C, 0x00C9, 0x026A, 0x00C1, 0x0266, 0x0043, 0x03CC, 0x045F, 0x0309, 0x03A0, 0x03D0, 0x007E, 0x026E, + 0x0530, 0x01D1, 0x0507, 0x03BC, 0x0388, 0x02A2, 0x0063, 0x01D5, 0x0528, 0x03C0, 0x043B, 0x0067, 0x02FD, 0x0349, + 0x0550, 0x04EE, 0x039C, 0x0345, 0x05C8, 0x05DC, 0x0072, 0x034D, 0x030D, 0x0355, 0x037C, 0x03FC, 0x0380, 0x03C4, + 0x004F, 0x0378, 0x02F9, 0x042F, 0x05D0, 0x05D4, 0x052C, 0x03B8, 0x016D, 0x01CD, 0x00B7, 0x0201, 0x003B, 0x0463, + 0x0588, 0x057C, 0x0578, 0x0340, 0x04C2, 0x03E8, 0x04BE, 0x0482, 0x0315, 0x045B, 0x0371, 0x0394, 0x0272, 0x0211, + 0x0053, 0x0472, 0x0453, 0x0351, 0x0384, 0x044B, 0x03EC, 0x04FF, 0x0700, 0x0800, 0x0701, 0x0801, 0x0702, 0x0802, + 0x0703, 0x0803, 0x0704, 0x0804, 0x0705, 0x0805, 0x0706, 0x0806, 0x0707, 0x0807, 0x0708, 0x0808, 0x0709, 0x0809, + 0x070A, 0x080A, 0x070B, 0x080B, 0x070C, 0x080C, 0x070D, 0x080D, 0x070E, 0x080E, 0x070F, 0x080F, 0x0710, 0x0711, + 0x0811, 0x0712, 0x0812, 0x0713, 0x0813, 0x0714, 0x0814, 0x0715, 0x0815, 0x0716, 0x0816, 0x0717, 0x0817, 0x0718, + 0x0818, 0x0719, 0x0819, 0x081A, 0x071B, 0x081B, 0x071C, 0x081C, 0x071D, 0x081D, 0x071E, 0x081E, 0x071F, 0x081F, + 0x0720, 0x0820, 0x004B, 0x035D, 0x031C, 0x0361, 0x002D, 0x050B, 0x044F, 0x0359, 0x05E0, 0x020D, 0x011E, 0x0286, + 0x04E2, 0x04D6, 0x01DD, 0x04DA, 0x00FC, 0x01A9, 0x0185, 0x04DE, 0x0102, 0x0189, 0x0117, 0x018D, 0x0276, 0x01FD, + 0x00DB, 0x017D, 0x00EA, 0x0181, 0x0157, 0x01F9, 0x0328, 0x0560, 0x0129, 0x022D, 0x0130, 0x03AC, 0x0123, 0x0365, + 0x00B1, 0x0033, 0x0138, 0x025A, 0x0171, 0x025E, 0x00E4, 0x0195, 0x013D, 0x0191, 0x014D, 0x01B9, 0x0246, 0x01C1, + 0x0147, 0x01BD, 0x0108, 0x019D, 0x0225, 0x01A1, 0x0219, 0x027E, 0x0554, 0x00BB, 0x0282, 0x0600, 0x04F6, 0x0604, + 0x01F1, 0x0568, 0x05F4, 0x040F, 0x0252, 0x040B, 0x00C5, 0x0301, 0x0407, 0x000C, 0x024E, 0x0305, 0x0175, 0x0417, + 0x0423, 0x008D, 0x02F5, 0x0413, 0x02B2, 0x0457, 0x047A, 0x010E, 0x0608, 0x0564, 0x060C, 0x0610, 0x0580 }; static bool midoGrottoInit = false; @@ -67,7 +69,6 @@ static Vec3s collectionPointJointTable[17]; static Vec3s collectionPointMorphTable[17]; static std::string collectionPointNametag; - static void RandomGrotto_WaitOpen(DoorAna* doorAna, PlayState* play) { if (!midoGrottoInit) { midoGrottoInit = true; @@ -149,32 +150,35 @@ static Vec3f FindValidPos(f32 distance) { // TODO: If in hyrule field and treeChopper is on, teleport somewhere else in hyrule field static void SpawnRandomGrotto() { - if ( - gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_DAY || - gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_NIGHT || - gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_RUINS - ) { + if (gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_DAY || + gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_NIGHT || + gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_RUINS) { return; } Vec3f pos = FindValidPos(2000.0f); - Actor* grotto = Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_DOOR_ANA, pos.x, pos.y, pos.z, 0, 0, 0, 0, false); + Actor* grotto = + Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_DOOR_ANA, pos.x, pos.y, pos.z, 0, 0, 0, 0, false); midoGrottoInit = false; DoorAna_SetupAction((DoorAna*)grotto, RandomGrotto_WaitOpen); grotto->draw = RandomGrotto_Draw; } void SpawnStick(Vec3f pos) { - CustomCollectible::Spawn(pos.x, pos.y + 150.0f, pos.z, 0, CustomCollectible::KILL_ON_TOUCH | CustomCollectible::TOSS_ON_SPAWN, 0, [](Actor* actor, PlayState* play) { - FredsQuestWoodOnHand++; - Audio_PlaySoundGeneral(NA_SE_SY_METRONOME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - }, [](Actor* actor, PlayState* play) { - Matrix_Scale(40.0f, 40.0f, 40.0f, MTXMODE_APPLY); - for (int i = 4; i < 7; i++) { - Matrix_RotateZYX(800 * i, 0, 800 * i, MTXMODE_APPLY); - GetItem_Draw(play, GID_STICK); - } - }); + CustomCollectible::Spawn( + pos.x, pos.y + 150.0f, pos.z, 0, CustomCollectible::KILL_ON_TOUCH | CustomCollectible::TOSS_ON_SPAWN, 0, + [](Actor* actor, PlayState* play) { + FredsQuestWoodOnHand++; + Audio_PlaySoundGeneral(NA_SE_SY_METRONOME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + }, + [](Actor* actor, PlayState* play) { + Matrix_Scale(40.0f, 40.0f, 40.0f, MTXMODE_APPLY); + for (int i = 4; i < 7; i++) { + Matrix_RotateZYX(800 * i, 0, 800 * i, MTXMODE_APPLY); + GetItem_Draw(play, GID_STICK); + } + }); } Actor* specialTree = nullptr; @@ -201,7 +205,7 @@ void ChooseSpecialTree() { extern "C" bool HandleTreeBonk(Actor* actor) { if (!CVarGetInteger(CVAR("FredsQuest.Enabled"), 0)) { - return false; + return false; } int damage = 2; @@ -255,7 +259,8 @@ void DrawCrazyTaxiArrow(Actor* actor, PlayState* play) { Matrix_Translate(0.0f, 70.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateY(5.86f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), + G_MTX_MODELVIEW | G_MTX_LOAD); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 255, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 0, 255); gSPDisplayList(POLY_XLU_DISP++, (Gfx*)gDebugArrowDL); @@ -281,7 +286,8 @@ void CollectionPoint_Update(Actor* actor, PlayState* play) { lastDisplayedCount = FredsQuestWoodCollected; collectionPointNametag = "Bring me wood!"; if (FredsQuestWoodCollected > 0) { - collectionPointNametag += std::string(" (") + std::to_string(FredsQuestWoodCollected) + "/" + std::to_string(CVarGetInteger(CVAR("FredsQuest.WoodNeeded"), 300)) + ")"; + collectionPointNametag += std::string(" (") + std::to_string(FredsQuestWoodCollected) + "/" + + std::to_string(CVarGetInteger(CVAR("FredsQuest.WoodNeeded"), 300)) + ")"; } NameTag_RemoveAllForActor(actor); NameTag_RegisterForActorWithOptions(actor, collectionPointNametag.c_str(), { .yOffset = 100 }); @@ -291,7 +297,8 @@ void CollectionPoint_Update(Actor* actor, PlayState* play) { if (FredsQuestWoodOnHand) { FredsQuestWoodCollected++; FredsQuestWoodOnHand--; - Audio_PlaySoundGeneral(NA_SE_SY_METRONOME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + Audio_PlaySoundGeneral(NA_SE_SY_METRONOME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (FredsQuestWoodCollected >= CVarGetInteger(CVAR("FredsQuest.WoodNeeded"), 300)) { FredsQuestComplete = true; @@ -304,7 +311,6 @@ void CollectionPoint_Update(Actor* actor, PlayState* play) { } else { vanillaQueuedItemEntry = Rando::StaticData::RetrieveItem(RG_HEART_CONTAINER).GetGIEntry_Copy(); } - } } } @@ -322,7 +328,7 @@ void CollectionPoint_Draw(Actor* actor, PlayState* play) { for (int i = 0; i < FredsQuestWoodCollected / (CVarGetInteger(CVAR("FredsQuest.WoodNeeded"), 300) / 50); i++) { float angle = 10 * i; float radius = (50 - i) * 0.5f; // Radius decreases as it goes up - float height = 10.0f; // Incremental height + float height = 10.0f; // Incremental height Matrix_Translate(radius * cosf(angle), height, radius * sinf(angle), MTXMODE_APPLY); Matrix_RotateY(angle, MTXMODE_APPLY); @@ -337,8 +343,9 @@ void SpawnCollectionPoint() { collectionPoint->actor.update = CollectionPoint_Update; collectionPoint->actor.draw = CollectionPoint_Draw; collectionPoint->actor.flags |= ACTOR_FLAG_DRAW_CULLING_DISABLED; - SkelAnime_InitFlex(gPlayState, &collectionPointSkelAnime, (FlexSkeletonHeader*)&object_toryo_Skel_007150, - (AnimationHeader*)&object_toryo_Anim_000E50, collectionPointJointTable, collectionPointMorphTable, 17); + SkelAnime_InitFlex(gPlayState, &collectionPointSkelAnime, (FlexSkeletonHeader*)&object_toryo_Skel_007150, + (AnimationHeader*)&object_toryo_Anim_000E50, collectionPointJointTable, + collectionPointMorphTable, 17); } void RandomTrap_Update(Actor* actor, PlayState* play) { @@ -391,7 +398,8 @@ void RandomTrap_Draw(Actor* actor, PlayState* play) { void SpawnRandomTrap() { Vec3f pos = FindValidPos(2000.0f); - EnItem00* randomTrap = CustomCollectible::Spawn(pos.x, pos.y, pos.z, 0, CustomCollectible::TOSS_ON_SPAWN, 0, NULL, NULL); + EnItem00* randomTrap = + CustomCollectible::Spawn(pos.x, pos.y, pos.z, 0, CustomCollectible::TOSS_ON_SPAWN, 0, NULL, NULL); SoundSource_PlaySfxAtFixedWorldPos(gPlayState, &randomTrap->actor.world.pos, 20, NA_SE_EV_LIGHTNING); randomTrap->actor.update = RandomTrap_Update; randomTrap->actor.draw = RandomTrap_Draw; @@ -414,17 +422,18 @@ void OnSceneInit() { SpawnCollectionPoint(); } -static void ConfigurationChanged() { +static void OnConfigurationChanged() { COND_HOOK(OnSceneSpawnActors, CVarGetInteger(CVAR("FredsQuest.Enabled"), 0), OnSceneInit); COND_HOOK(OnPlayerUpdate, CVarGetInteger(CVAR("RandomTraps.Enabled"), 0), []() { - if (rand() % CVarGetInteger(CVAR("RandomTraps.SpawnChance"), 400) == 0) { + if (rand() % CVarGetInteger(CVAR("RandomTraps.SpawnChance"), 400) == 0) { SpawnRandomTrap(); } }); COND_HOOK(OnPlayerUpdate, CVarGetInteger(CVAR("FredsQuest.Enabled"), 0), []() { - if (CVarGetInteger(CVAR("FredsQuest.EncumberedThreshold"), 60) == 0 || FredsQuestWoodOnHand <= CVarGetInteger(CVAR("FredsQuest.EncumberedThreshold"), 60)) { + if (CVarGetInteger(CVAR("FredsQuest.EncumberedThreshold"), 60) == 0 || + FredsQuestWoodOnHand <= CVarGetInteger(CVAR("FredsQuest.EncumberedThreshold"), 60)) { GameInteractor::State::MovementSpeedMultiplier = 0; } else { GameInteractor::State::MovementSpeedMultiplier = -2; @@ -438,8 +447,7 @@ static void ConfigurationChanged() { }); } -static void DrawMenu() { - ImGui::SeparatorText(AUTHOR); +static void RegisterMenu() { // UIWidgets::EnhancementSliderFloat("Xfloat", "Xfloat", CVAR("tmpxf"), 0.0f, 10.0f, "%.2f", 1.0f, false); // UIWidgets::EnhancementSliderFloat("Yfloat", "Yfloat", CVAR("tmpyf"), 0.0f, 10.0f, "%.2f", 1.0f, false); @@ -447,49 +455,75 @@ static void DrawMenu() { // UIWidgets::EnhancementSliderInt("Xs", "Xs", CVAR("tmpxs"), 0, UINT16_MAX, "%d", 1, false); // UIWidgets::EnhancementSliderInt("Ys", "Ys", CVAR("tmpys"), 0, UINT16_MAX, "%d", 1, false); // UIWidgets::EnhancementSliderInt("Zs", "Zs", CVAR("tmpzs"), 0, UINT16_MAX, "%d", 1, false); - /*if (UIWidgets::EnhancementCheckbox("Fred's Quest", CVAR("FredsQuest.Enabled"))) { - ConfigurationChanged(); - } - UIWidgets::Tooltip("Collect wood and bring it to the collection point in Hyrule Field for a small reward."); - if (CVarGetInteger(CVAR("FredsQuest.Enabled"), 0)) { - if (UIWidgets::EnhancementCheckbox("Crazy Taxi Arrow", CVAR("FredsQuest.CrazyTaxiArrow"))) { - ConfigurationChanged(); - } - if (UIWidgets::EnhancementSliderInt("Wood Needed", "##FredsQuest.WoodNeeded", CVAR("FredsQuest.WoodNeeded"), 0, 1000, "%d", 300, false)) { - ConfigurationChanged(); - } - if (UIWidgets::EnhancementSliderInt("Tree Bonk Drop Rate", "##FredsQuest.TreeBonkDropRate", CVAR("FredsQuest.TreeBonkDropRate"), 0, 10, "%d", 1, false)) { - ConfigurationChanged(); - } - if (UIWidgets::EnhancementSliderInt("Tree Break Drop Rate", "##FredsQuest.TreeBreakDropRate", CVAR("FredsQuest.TreeBreakDropRate"), 0, 50, "%d", 3, false)) { - ConfigurationChanged(); - } - if (UIWidgets::EnhancementSliderInt("Special Break Drop Rate", "##FredsQuest.SpecialBreakDropRate", CVAR("FredsQuest.SpecialBreakDropRate"), 0, 50, "%d", 10, false)) { - ConfigurationChanged(); - } - if (UIWidgets::EnhancementSliderInt("Encumbered Threshold", "##FredsQuest.EncumberedThreshold", CVAR("FredsQuest.EncumberedThreshold"), 0, 200, "%d", 60, false)) { - ConfigurationChanged(); - } - UIWidgets::Tooltip("If you have more than this many sticks, you will be encumbered and run slower. 0 for disabled"); - } - if (UIWidgets::EnhancementCheckbox("Random Traps", CVAR("RandomTraps.Enabled"))) { - ConfigurationChanged(); - } - UIWidgets::Tooltip("Random traps will spawn around you at a configurable rate. (Currently only knockback)"); - if (CVarGetInteger(CVAR("RandomTraps.Enabled"), 0)) { - if (UIWidgets::EnhancementSliderInt("Trap Lifetime (Seconds)", "##RandomTraps.Lifetime", CVAR("RandomTraps.Lifetime"), 0, 60, "%d", 30, false)) { - ConfigurationChanged(); - } - if (UIWidgets::EnhancementSliderInt("Spawn Chance", "##RandomTraps.SpawnChance", CVAR("RandomTraps.SpawnChance"), 40, 2000, "%d", 1000, false)) { - ConfigurationChanged(); - } - }*/ + WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 }; + SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2); + + SohGui::mSohMenu->AddWidget(path, "Fred's Quest", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR("FredsQuest.Enabled")) + .Options(UIWidgets::CheckboxOptions().Tooltip( + "Collect wood and bring it to the collection point in Hyrule Field for a small reward.")); + SohGui::mSohMenu->AddWidget(path, "Crazy Taxi Arrow", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR("FredsQuest.CrazyTaxiArrow")) + .PreFunc( + [](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("FredsQuest.Enabled"), 0); }) + .Options(UIWidgets::CheckboxOptions().Tooltip( + "Collect wood and bring it to the collection point in Hyrule Field for a small reward.")); + + SohGui::mSohMenu->AddWidget(path, "Wood Needed", WIDGET_CVAR_SLIDER_INT) + .CVar(CVAR("FredsQuest.WoodNeeded")) + .Callback([](WidgetInfo& info) { OnConfigurationChanged(); }) + .PreFunc( + [](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("FredsQuest.Enabled"), 0); }) + .Options(UIWidgets::IntSliderOptions().DefaultValue(300).Min(0).Max(1000)); + + SohGui::mSohMenu->AddWidget(path, "Tree Bonk Drop Rate", WIDGET_CVAR_SLIDER_INT) + .CVar(CVAR("FredsQuest.TreeBonkDropRate")) + .Callback([](WidgetInfo& info) { OnConfigurationChanged(); }) + .PreFunc( + [](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("FredsQuest.Enabled"), 0); }) + .Options(UIWidgets::IntSliderOptions().DefaultValue(1).Min(0).Max(10)); + + SohGui::mSohMenu->AddWidget(path, "Tree Break Drop Rate", WIDGET_CVAR_SLIDER_INT) + .CVar(CVAR("FredsQuest.TreeBreakDropRate")) + .Callback([](WidgetInfo& info) { OnConfigurationChanged(); }) + .PreFunc( + [](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("FredsQuest.Enabled"), 0); }) + .Options(UIWidgets::IntSliderOptions().DefaultValue(3).Min(0).Max(50)); + + SohGui::mSohMenu->AddWidget(path, "Special Break Drop Rate", WIDGET_CVAR_SLIDER_INT) + .CVar(CVAR("FredsQuest.SpecialBreakDropRate")) + .Callback([](WidgetInfo& info) { OnConfigurationChanged(); }) + .PreFunc( + [](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("FredsQuest.Enabled"), 0); }) + .Options(UIWidgets::IntSliderOptions().DefaultValue(10).Min(0).Max(50)); + + SohGui::mSohMenu->AddWidget(path, "Encumbered Threshold", WIDGET_CVAR_SLIDER_INT) + .CVar(CVAR("FredsQuest.EncumberedThreshold")) + .Callback([](WidgetInfo& info) { OnConfigurationChanged(); }) + .PreFunc( + [](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("FredsQuest.Enabled"), 0); }) + .Options(UIWidgets::IntSliderOptions().DefaultValue(60).Min(0).Max(200).Tooltip( + "If you have more than this many sticks, you will be encumbered and run slower. 0 for disabled")); + + SohGui::mSohMenu->AddWidget(path, "Random Traps", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR("RandomTraps.Enabled")) + .Options(UIWidgets::CheckboxOptions().Tooltip( + "Random traps will spawn around you at a configurable rate. (Currently only knockback)")); + + SohGui::mSohMenu->AddWidget(path, "Trap Lifetime (Seconds)", WIDGET_CVAR_SLIDER_INT) + .CVar(CVAR("RandomTraps.Lifetime")) + .Callback([](WidgetInfo& info) { OnConfigurationChanged(); }) + .PreFunc( + [](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("RandomTraps.Enabled"), 0); }) + .Options(UIWidgets::IntSliderOptions().DefaultValue(30).Min(0).Max(60)); + + SohGui::mSohMenu->AddWidget(path, "Spawn Chance", WIDGET_CVAR_SLIDER_INT) + .CVar(CVAR("RandomTraps.SpawnChance")) + .Callback([](WidgetInfo& info) { OnConfigurationChanged(); }) + .PreFunc( + [](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("RandomTraps.Enabled"), 0); }) + .Options(UIWidgets::IntSliderOptions().DefaultValue(1000).Min(40).Max(2000)); } -static void RegisterMod() { - // #region Leave this alone unless you know what you are doing - ConfigurationChanged(); - // #endregion -} - -static Holiday holiday(DrawMenu, RegisterMod); +static RegisterShipInitFunc initFunc(OnConfigurationChanged); +static RegisterMenuInitFunc menuInitFunc(RegisterMenu); diff --git a/soh/soh/Enhancements/Holiday/Grimey.cpp b/soh/soh/Enhancements/Holiday/Grimey.cpp index 16dcd845d..6940577b7 100644 --- a/soh/soh/Enhancements/Holiday/Grimey.cpp +++ b/soh/soh/Enhancements/Holiday/Grimey.cpp @@ -104,7 +104,7 @@ void Penguin_Destroy(Actor* actor, PlayState* play) { static void OnConfigurationChanged() { COND_HOOK(OnPlayerUpdate, CVarGetInteger(CVAR("Hailstorm"), 0), []() { // Every frame has a 1/500 chance of spawning close hail - if (rand() % 500 == 0) { + if (rand() % 500 == 0) { int spawned = 0; while (spawned < 1) { Vec3f pos = GET_PLAYER(gPlayState)->actor.world.pos; @@ -112,7 +112,8 @@ static void OnConfigurationChanged() { pos.z += (float)Random(0, 50) - 25.0f; pos.y += 200.0f; - Actor* actor = Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_NUTSBALL, pos.x, pos.y, pos.z, 0, 0, 0, 0, false); + Actor* actor = Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_NUTSBALL, pos.x, pos.y, pos.z, 0, + 0, 0, 0, false); EnNutsball* nut = (EnNutsball*)actor; nut->actor.draw = EnNutsball_Draw; nut->actor.shape.rot.y = 0; @@ -124,7 +125,7 @@ static void OnConfigurationChanged() { } } // Every frame has a 1/50 chance of spawning far hail - if (rand() % 50 == 0) { + if (rand() % 50 == 0) { int spawned = 0; while (spawned < 1) { Vec3f pos = GET_PLAYER(gPlayState)->actor.world.pos; @@ -207,25 +208,18 @@ static void OnConfigurationChanged() { }); } -static void DrawMenu() { - //ImGui::SeparatorText(AUTHOR); - //if (UIWidgets::EnhancementCheckbox("Penguins", CVAR("Penguins"))) { - // OnConfigurationChanged(); - //} - //UIWidgets::Tooltip("Penguins will spawn in huddles throughout hyrule"); - //if (UIWidgets::EnhancementCheckbox("Hailstorm", CVAR("Hailstorm"))) { - // OnConfigurationChanged(); - //} - //UIWidgets::Tooltip("Ever persistent hailstorm throughout hyrule"); +static void RegisterMenu() { + WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 }; + SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2); + + SohGui::mSohMenu->AddWidget(path, "Penguins", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR("Penguins")) + .Options(UIWidgets::CheckboxOptions().Tooltip("Penguins will spawn in huddles throughout hyrule")); + + SohGui::mSohMenu->AddWidget(path, "Hailstorm", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR("Hailstorm")) + .Options(UIWidgets::CheckboxOptions().Tooltip("Ever persistent hailstorm throughout hyrule")); } -static void RegisterMod() { - // #region Leave this alone unless you know what you are doing - OnConfigurationChanged(); - // #endregion - - // TODO: Anything you want to run once on startup -} - -// TODO: Uncomment this line to enable the mod -static Holiday holiday(DrawMenu, RegisterMod); +static RegisterShipInitFunc initFunc(OnConfigurationChanged); +static RegisterMenuInitFunc menuInitFunc(RegisterMenu); diff --git a/soh/soh/Enhancements/Holiday/Holiday.hpp b/soh/soh/Enhancements/Holiday/Holiday.hpp index 441e6fef7..19b02c191 100644 --- a/soh/soh/Enhancements/Holiday/Holiday.hpp +++ b/soh/soh/Enhancements/Holiday/Holiday.hpp @@ -4,35 +4,17 @@ #include #include #include -#include "soh/SohGui/UIWidgets.hpp" #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/cosmetics/CosmeticsEditor.h" +#include "soh/SohGui/SohMenu.h" +#include "soh/SohGui/SohGui.hpp" +#include "soh/SohGui/UIWidgets.hpp" inline std::vector> holidayDrawFuncs = {}; inline std::vector> holidayRegisterFuncs = {}; -inline void DrawHolidayMenu() { - if (ImGui::BeginMenu("Holiday")) { - for (auto& drawFunc : holidayDrawFuncs) { - ImGui::PushID(&drawFunc); - drawFunc(); - ImGui::PopID(); - } - ImGui::EndMenu(); - } +namespace SohGui { +extern std::shared_ptr mSohMenu; } -inline void RegisterHoliday() { - for (auto& regFunc : holidayRegisterFuncs) { - regFunc(); - } -} - -struct Holiday { - Holiday(std::function drawFunc, std::function registerFunc) { - holidayDrawFuncs.push_back(drawFunc); - holidayRegisterFuncs.push_back(registerFunc); - } -}; - #endif // HOLIDAY_HPP diff --git a/soh/soh/Enhancements/Holiday/LL.cpp b/soh/soh/Enhancements/Holiday/LL.cpp index 7ddc20f0d..5b3cd2ec6 100644 --- a/soh/soh/Enhancements/Holiday/LL.cpp +++ b/soh/soh/Enhancements/Holiday/LL.cpp @@ -42,88 +42,60 @@ Color_RGBA8 Color_ImGuiToLUS(ImVec4 color) { } static void OnConfigurationChanged() { - Color_RGBA8 c1 = CVarGetColor(CVAR("lCustomRainbow1"), Color_ImGuiToLUS(RAINBOW_PRESETS[0][0])); - Color_RGBA8 c2 = CVarGetColor(CVAR("lCustomRainbow2"), Color_ImGuiToLUS(RAINBOW_PRESETS[0][1])); - Color_RGBA8 c3 = CVarGetColor(CVAR("lCustomRainbow3"), Color_ImGuiToLUS(RAINBOW_PRESETS[0][2])); - Color_RGBA8 c4 = CVarGetColor(CVAR("lCustomRainbow4"), Color_ImGuiToLUS(RAINBOW_PRESETS[0][3])); + Color_RGBA8 c1 = CVarGetColor(CVAR("CustomRainbow1"), Color_ImGuiToLUS(RAINBOW_PRESETS[0][0])); + Color_RGBA8 c2 = CVarGetColor(CVAR("CustomRainbow2"), Color_ImGuiToLUS(RAINBOW_PRESETS[0][1])); + Color_RGBA8 c3 = CVarGetColor(CVAR("CustomRainbow3"), Color_ImGuiToLUS(RAINBOW_PRESETS[0][2])); + Color_RGBA8 c4 = CVarGetColor(CVAR("CustomRainbow4"), Color_ImGuiToLUS(RAINBOW_PRESETS[0][3])); customColorZero = Color_LUSToImGui((Color_RGBA8)c1); customColorOne = Color_LUSToImGui((Color_RGBA8)c2); customColorMinusZero = Color_LUSToImGui((Color_RGBA8)c3); customColorMinusOne = Color_LUSToImGui((Color_RGBA8)c4); - - // TODO: Register any hooks or things that need to run on startup and when the main CVar is toggled - // Note: Hooks should be registered/unregistered depending on the CVar state (Use COND_HOOK or COND_ID_HOOK) - - // COND_HOOK(OnSceneSpawnActors, CVarGetInteger(CVAR("Enabled"), 0), []() { - // // Spawn your own actors? - // }); - - // COND_ID_HOOK(OnActorInit, ACTOR_OBJ_TSUBO, CVarGetInteger(CVAR("DoSomethingWithPots"), 0), [](void* actorRef) { - // // Do something with pots? - // }); } -static void DrawMenu() { - ImGui::SeparatorText(AUTHOR); - //if (ImGui::BeginMenu("Customize Rainbows")) { - // UIWidgets::EnhancementCheckbox("Enable", CVAR("lEnableCustomRainbows")); - // if (CVarGetInteger(CVAR("lEnableCustomRainbows"), 0)) { - // ImGui::ColorEdit3("Color 1", (float*)&customColorZero, ImGuiColorEditFlags_NoInputs); - // ImGui::ColorEdit3("Color 2", (float*)&customColorOne, ImGuiColorEditFlags_NoInputs); - // ImGui::ColorEdit3("Color 3", (float*)&customColorMinusZero, ImGuiColorEditFlags_NoInputs); - // ImGui::ColorEdit3("Color 4", (float*)&customColorMinusOne, ImGuiColorEditFlags_NoInputs); +static void RegisterMenu() { + WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 }; + SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2); - // UIWidgets::PaddedText("Presets", true, false); - // size_t rainbowPresetIdx = 0; - // if (UIWidgets::EnhancementCombobox(CVAR("lCustomRainbowPreset"), RAINBOW_PRESET_NAMES, 0) && - // (rainbowPresetIdx = CVarGetInteger(CVAR("lCustomRainbowPreset"), 0)) <= RAINBOW_PRESET_LEN) { //paranoia - // customColorZero = RAINBOW_PRESETS[rainbowPresetIdx][0]; - // customColorOne = RAINBOW_PRESETS[rainbowPresetIdx][1]; - // customColorMinusZero = RAINBOW_PRESETS[rainbowPresetIdx][2]; - // customColorMinusOne = RAINBOW_PRESETS[rainbowPresetIdx][3]; - // } + SohGui::mSohMenu->AddWidget(path, "Custom Rainbows", WIDGET_CVAR_CHECKBOX).CVar(CVAR("EnableCustomRainbows")); - // Color_RGBA8 color1, color2, color3, color4; - // color1.r = static_cast(customColorZero.x * 255.0f); - // color1.g = static_cast(customColorZero.y * 255.0f); - // color1.b = static_cast(customColorZero.z * 255.0f); + SohGui::mSohMenu->AddWidget(path, "Color 1", WIDGET_CVAR_COLOR_PICKER) + .CVar(CVAR("CustomRainbow1")) + .Options(UIWidgets::ColorPickerOptions().ShowRandom().ShowReset().UseAlpha(false).DefaultValue( + Color_ImGuiToLUS(RAINBOW_PRESETS[0][0]))); + SohGui::mSohMenu->AddWidget(path, "Color 2", WIDGET_CVAR_COLOR_PICKER) + .CVar(CVAR("CustomRainbow2")) + .Options(UIWidgets::ColorPickerOptions().ShowRandom().ShowReset().UseAlpha(false).DefaultValue( + Color_ImGuiToLUS(RAINBOW_PRESETS[0][1]))); + SohGui::mSohMenu->AddWidget(path, "Color 3", WIDGET_CVAR_COLOR_PICKER) + .CVar(CVAR("CustomRainbow3")) + .Options(UIWidgets::ColorPickerOptions().ShowRandom().ShowReset().UseAlpha(false).DefaultValue( + Color_ImGuiToLUS(RAINBOW_PRESETS[0][2]))); + SohGui::mSohMenu->AddWidget(path, "Color 4", WIDGET_CVAR_COLOR_PICKER) + .CVar(CVAR("CustomRainbow4")) + .Options(UIWidgets::ColorPickerOptions().ShowRandom().ShowReset().UseAlpha(false).DefaultValue( + Color_ImGuiToLUS(RAINBOW_PRESETS[0][3]))); - // color2.r = static_cast(customColorOne.x * 255.0f); - // color2.g = static_cast(customColorOne.y * 255.0f); - // color2.b = static_cast(customColorOne.z * 255.0f); + SohGui::mSohMenu->AddWidget(path, "Presets", WIDGET_SEPARATOR_TEXT); + SohGui::mSohMenu->AddWidget(path, "Custom Rainbow Presets", WIDGET_CVAR_COMBOBOX) + .CVar(CVAR("CustomRainbowPreset")) + .Options(UIWidgets::ComboboxOptions().ComboMap(RAINBOW_PRESET_NAMES)) + .Callback([&](WidgetInfo& info) { + size_t rainbowPresetIdx = CVarGetInteger(CVAR("CustomRainbowPreset"), 0); + customColorZero = RAINBOW_PRESETS[rainbowPresetIdx][0]; + customColorOne = RAINBOW_PRESETS[rainbowPresetIdx][1]; + customColorMinusZero = RAINBOW_PRESETS[rainbowPresetIdx][2]; + customColorMinusOne = RAINBOW_PRESETS[rainbowPresetIdx][3]; - // color3.r = static_cast(customColorMinusZero.x * 255.0f); - // color3.g = static_cast(customColorMinusZero.y * 255.0f); - // color3.b = static_cast(customColorMinusZero.z * 255.0f); + CVarSetColor(CVAR("CustomRainbow1.Value"), Color_ImGuiToLUS(customColorZero)); + CVarSetColor(CVAR("CustomRainbow2.Value"), Color_ImGuiToLUS(customColorOne)); + CVarSetColor(CVAR("CustomRainbow3.Value"), Color_ImGuiToLUS(customColorMinusZero)); + CVarSetColor(CVAR("CustomRainbow4.Value"), Color_ImGuiToLUS(customColorMinusOne)); + CVarSave(); + }); - // color4.r = static_cast(customColorMinusOne.x * 255.0f); - // color4.g = static_cast(customColorMinusOne.y * 255.0f); - // color4.b = static_cast(customColorMinusOne.z * 255.0f); - - // CVarSetColor(CVAR("lCustomRainbow1"), color1); - // CVarSetColor(CVAR("lCustomRainbow2"), color2); - // CVarSetColor(CVAR("lCustomRainbow3"), color3); - // CVarSetColor(CVAR("lCustomRainbow4"), color4); - - // OnConfigurationChanged(); - // } - - // ImGui::EndMenu(); - - //} - //if (UIWidgets::EnhancementCheckbox("DoSomethingWithPots", CVAR("DoSomethingWithPots"))) { - // OnConfigurationChanged(); - //} + SohGui::mSohMenu->AddWidget(path, "Do Something With Pots", WIDGET_CVAR_CHECKBOX).CVar(CVAR("DoSomethingWithPots")); } -static void RegisterMod() { - // #region Leave this alone unless you know what you are doing - OnConfigurationChanged(); - // #endregion - - // TODO: Anything you want to run once on startup -} - -// TODO: Uncomment this line to enable the mod -static Holiday holiday(DrawMenu, RegisterMod); +// static RegisterShipInitFunc initFunc(OnConfigurationChanged); +// static RegisterMenuInitFunc menuInitFunc(RegisterMenu); diff --git a/soh/soh/Enhancements/Holiday/LL.h b/soh/soh/Enhancements/Holiday/LL.h index ba936b6c3..8a705c188 100644 --- a/soh/soh/Enhancements/Holiday/LL.h +++ b/soh/soh/Enhancements/Holiday/LL.h @@ -1,85 +1,70 @@ #ifndef LL_H #define LL_H +#include #include "soh/Enhancements/cosmetics/CosmeticsEditor.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" const size_t RAINBOW_PRESET_LEN = 9; -static const char* RAINBOW_PRESET_NAMES[RAINBOW_PRESET_LEN] = { - "Christmas", - "Transgender", - "Nonbinary", - "Bisexual", - "Lesbian", - "Gay (MLM)", - "Asexual", - "Brazil", - "Italy" +std::unordered_map RAINBOW_PRESET_NAMES = { + { 0, "Christmas" }, { 1, "Transgender" }, { 2, "Nonbinary" }, { 3, "Bisexual" }, { 4, "Lesbian" }, + { 5, "Gay (MLM)" }, { 6, "Asexual" }, { 7, "Brazil" }, { 8, "Italy" } }; static const ImVec4 RAINBOW_PRESETS[RAINBOW_PRESET_LEN][4] = { - { //christmas - {0.0/255.0, 140.0/255.0, 69.0/255.0, 0}, - {205.0/255.0, 33.0/255.0, 42.0/255.0, 0}, - {0.0/255.0, 140.0/255.0, 69.0/255.0, 0}, - {205.0/255.0, 33.0/255.0, 42.0/255.0, 0} - }, - { //trans - {255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, - {255.0/255.0, 159.0/255.0, 186.0/255.0, 0}, - {255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, - {71.0/255.0, 186.0/255.0, 230.0/255.0, 0} - }, + { // christmas + { 0.0f / 255.0f, 140.0f / 255.0f, 69.0f / 255.0f, 1 }, + { 205.0f / 255.0f, 33.0f / 255.0f, 42.0f / 255.0f, 1 }, + { 0.0f / 255.0f, 140.0f / 255.0f, 69.0f / 255.0f, 1 }, + { 205.0f / 255.0f, 33.0f / 255.0f, 42.0f / 255.0f, 1 } }, + { // trans + { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 }, + { 255.0f / 255.0f, 159.0f / 255.0f, 186.0f / 255.0f, 1 }, + { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 }, + { 71.0f / 255.0f, 186.0f / 255.0f, 230.0f / 255.0f, 1 } }, - { //enby - {252.0/255.0, 244.0/255.0, 52.0/255.0, 0}, - {255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, - {156.0/255.0, 89.0/255.0, 209.0/255.0, 0}, - {0.0/255.0, 0.0/255.0, 0.0/255.0, 0} - }, + { // enby + { 252.0f / 255.0f, 244.0f / 255.0f, 52.0f / 255.0f, 1 }, + { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 }, + { 156.0f / 255.0f, 89.0f / 255.0f, 209.0f / 255.0f, 1 }, + { 0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 1 } }, - { //bi - {155.0/255.0, 79.0/255.0, 150.0/255.0, 0}, - {0.0/255.0, 56.0/255.0, 168.0/255.0, 0}, - {155.0/255.0, 79.0/255.0, 150.0/255.0, 0}, - {214.0/255.0, 2.0/255.0, 112.0/255.0, 0} - }, + { // bi + { 155.0f / 255.0f, 79.0f / 255.0f, 150.0f / 255.0f, 1 }, + { 0.0f / 255.0f, 56.0f / 255.0f, 168.0f / 255.0f, 1 }, + { 155.0f / 255.0f, 79.0f / 255.0f, 150.0f / 255.0f, 1 }, + { 214.0f / 255.0f, 2.0f / 255.0f, 112.0f / 255.0f, 1 } }, - { //lesbian - {255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, - {213.0/255.0, 45.0/255.0, 0.0/255.0, 0}, - {255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, - {163.0/255.0, 2.0/255.0, 98.0/255.0, 0} - }, + { // lesbian + { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 }, + { 213.0f / 255.0f, 45.0f / 255.0f, 0.0f / 255.0f, 1 }, + { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 }, + { 163.0f / 255.0f, 2.0f / 255.0f, 98.0f / 255.0f, 1 } }, - { //gay - {7.0/255.0, 141.0/255.0, 112.0/255.0, 0}, - {255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, - {123.0/255.0, 173.0/255.0, 226.0/255.0, 0}, - {61.0/255.0, 26.0/255.0, 120.0/255.0, 0} - }, + { // gay + { 7.0f / 255.0f, 141.0f / 255.0f, 112.0f / 255.0f, 1 }, + { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 }, + { 123.0f / 255.0f, 173.0f / 255.0f, 226.0f / 255.0f, 1 }, + { 61.0f / 255.0f, 26.0f / 255.0f, 120.0f / 255.0f, 1 } }, - { //ace - {0.0/255.0, 0.0/255.0, 0.0/255.0, 0}, - {163.0/255.0, 163.0/255.0, 163.0/255.0, 0}, - {255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, - {128.0/255.0, 0.0/255.0, 128.0/255.0, 0} - }, + { // ace + { 0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 1 }, + { 163.0f / 255.0f, 163.0f / 255.0f, 163.0f / 255.0f, 1 }, + { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 }, + { 128.0f / 255.0f, 0.0f / 255.0f, 128.0f / 255.0f, 1 } }, - { //br - {0.0/255.0, 151.0/255.0, 57.0/255.0, 0}, - {254.0/255.0, 221.0/255.0, 0.0/255.0, 0}, - {255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, - {1.0/255.0, 33.0/255.0, 105.0/255.0, 0} - }, + { // br + { 0.0f / 255.0f, 151.0f / 255.0f, 57.0f / 255.0f, 1 }, + { 254.0f / 255.0f, 221.0f / 255.0f, 0.0f / 255.0f, 1 }, + { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 }, + { 1.0f / 255.0f, 33.0f / 255.0f, 105.0f / 255.0f, 1 } }, - { //it - {255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, - {0.0/255.0, 140.0/255.0, 69.0/255.0, 0}, - {255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, - {205.0/255.0, 33.0/255.0, 42.0/255.0, 0} - } + { // it + { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 }, + { 0.0f / 255.0f, 140.0f / 255.0f, 69.0f / 255.0f, 1 }, + { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 }, + { 205.0f / 255.0f, 33.0f / 255.0f, 42.0f / 255.0f, 1 } } }; diff --git a/soh/soh/Enhancements/Holiday/NotProxySaw.cpp b/soh/soh/Enhancements/Holiday/NotProxySaw.cpp index be44768c4..4645f0ea2 100644 --- a/soh/soh/Enhancements/Holiday/NotProxySaw.cpp +++ b/soh/soh/Enhancements/Holiday/NotProxySaw.cpp @@ -71,7 +71,7 @@ const std::vector dialogs = { { // 0 { "Our way. Our history.", -3, -1 }, } } }; -static void ConfigurationChanged() { +static void OnConfigurationChanged() { COND_ID_HOOK(OnActorInit, ACTOR_BOSS_GANON, CVarGetInteger(CVAR("GanonDatingSim"), 0), [](void* actorRef) { dialogIndex = 0; affection = 0; @@ -121,18 +121,15 @@ static void ConfigurationChanged() { }); } -static void DrawMenu() { - //ImGui::SeparatorText(AUTHOR); - //if (UIWidgets::EnhancementCheckbox("Ganon Dating Sim", CVAR("GanonDatingSim"))) { - // ConfigurationChanged(); - //} - //UIWidgets::Tooltip("Prior to fighting him at the top of his Castle, you make an attempt to convince Ganon to join you instead."); +static void RegisterMenu() { + WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 }; + SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2); + + SohGui::mSohMenu->AddWidget(path, "Ganon Dating Sim", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR("GanonDatingSim")) + .Options(UIWidgets::CheckboxOptions().Tooltip("Prior to fighting him at the top of his Castle, you make an " + "attempt to convince Ganon to join you instead.")); } -static void RegisterMod() { - // #region Leave this alone unless you know what you are doing - ConfigurationChanged(); - // #endregion -} - -static Holiday holiday(DrawMenu, RegisterMod); +static RegisterShipInitFunc initFunc(OnConfigurationChanged); +static RegisterMenuInitFunc menuInitFunc(RegisterMenu); diff --git a/soh/soh/Enhancements/Holiday/Pablo.cpp b/soh/soh/Enhancements/Holiday/Pablo.cpp index 8827b2bc1..65ad0c185 100644 --- a/soh/soh/Enhancements/Holiday/Pablo.cpp +++ b/soh/soh/Enhancements/Holiday/Pablo.cpp @@ -113,49 +113,45 @@ void SpawnShinyReward(Actor* actor) { } void RegisterShiny() { - GameInteractor::Instance->RegisterGameHook([](void* refActor) { + COND_HOOK(OnActorInit, CVarGetInteger(CVAR("Shiny.Enabled"), 0), [](void* refActor) { Actor* actor = static_cast(refActor); - if (CVarGetInteger(CVAR("Shiny.Enabled"), 0) && CanBeShiny(actor) && - Rand_ZeroOne() < (1.0f / (s32)CVarGetInteger(CVAR("Shiny.Chance"), 8192))) { + if (CanBeShiny(actor) && Rand_ZeroOne() < (1.0f / (s32)CVarGetInteger(CVAR("Shiny.Chance"), 8192))) { ApplyShinyness(actor); } }); - GameInteractor::Instance->RegisterGameHook([](void* refActor) { + COND_HOOK(OnEnemyDefeat, CVarGetInteger(CVAR("Shiny.Enabled"), 0), [](void* refActor) { Actor* actor = static_cast(refActor); - if (CVarGetInteger(CVAR("Shiny.Enabled"), 0) && actor->isShiny) { + if (actor->isShiny) { SpawnShinyReward(actor); } }); - GameInteractor::Instance->RegisterGameHook([](void* refActor) { + COND_HOOK(OnActorDraw, CVarGetInteger(CVAR("Shiny.Enabled"), 0), [](void* refActor) { Actor* actor = static_cast(refActor); - if (CVarGetInteger(CVAR("Shiny.Enabled"), 0) && actor->isShiny) { + if (actor->isShiny) { RenderShines(actor); } }); } -void ShinyDrawImGui() { - //UIWidgets::PaddedEnhancementCheckbox("Enable Shiny Enemies", CVAR("Shiny.Enabled"), true, false); - //UIWidgets::Tooltip("Allows enemies to be shiny.\nShiny enemies are 25% bigger and have 4 times the health but drop " - // "the equivalent of a gold rupee upon death"); - - //if (CVarGetInteger(CVAR("Shiny.Enabled"), 0)) { - // UIWidgets::PaddedEnhancementSliderInt("Shiny Chance: %d", "##ShinyChance", CVAR("Shiny.Chance"), 1, 8192, "", 8192, true, true, false, false, ""); - // UIWidgets::Tooltip("The chance for an enemy to be shiny is 1 / Shiny Chance"); - //} -} - #pragma endregion -static void DrawMenu() { - ImGui::SeparatorText(AUTHOR); - ShinyDrawImGui(); +static void RegisterMenu() { + WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 }; + SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2); + SohGui::mSohMenu->AddWidget(path, "Enable Shiny Enemies", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR("Shiny.Enabled")) + .Options(UIWidgets::CheckboxOptions().Tooltip( + "Allows enemies to be shiny.\nShiny enemies are 25% bigger and have 4 times the health but drop " + "the equivalent of a gold rupee upon death")); + + SohGui::mSohMenu->AddWidget(path, "Shiny Chance: %d", WIDGET_CVAR_SLIDER_INT) + .CVar(CVAR("OrnExch.Amount")) + .PreFunc([](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("Shiny.Enabled"), 0); }) + .Options(UIWidgets::IntSliderOptions().DefaultValue(8192).Min(1).Max(8192).Tooltip( + "The chance for an enemy to be shiny is 1 / {Shiny Chance}")); } -static void RegisterMod() { - RegisterShiny(); -} - -static Holiday holiday(DrawMenu, RegisterMod); \ No newline at end of file +static RegisterShipInitFunc initFunc(RegisterShiny); +static RegisterMenuInitFunc menuInitFunc(RegisterMenu); \ No newline at end of file diff --git a/soh/soh/Enhancements/Holiday/ProxySaw.cpp b/soh/soh/Enhancements/Holiday/ProxySaw.cpp index aac32457e..175898b8e 100644 --- a/soh/soh/Enhancements/Holiday/ProxySaw.cpp +++ b/soh/soh/Enhancements/Holiday/ProxySaw.cpp @@ -105,23 +105,25 @@ static void SpawnIcebergs() { } const s16 entrances[] = { - 0x0000, 0x0209, 0x0004, 0x0242, 0x0028, 0x0221, 0x0169, 0x0215, 0x0165, 0x024A, 0x0010, 0x021D, 0x0082, 0x01E1, 0x0037, 0x0205, - 0x0098, 0x02A6, 0x0088, 0x03D4, 0x0008, 0x03A8, 0x0467, 0x023D, 0x0433, 0x0443, 0x0437, 0x0447, 0x009C, 0x033C, 0x00C9, 0x026A, - 0x00C1, 0x0266, 0x0043, 0x03CC, 0x045F, 0x0309, 0x03A0, 0x03D0, 0x007E, 0x026E, 0x0530, 0x01D1, 0x0507, 0x03BC, 0x0388, 0x02A2, - 0x0063, 0x01D5, 0x0528, 0x03C0, 0x043B, 0x0067, 0x02FD, 0x0349, 0x0550, 0x04EE, 0x039C, 0x0345, 0x05C8, 0x05DC, 0x0072, 0x034D, - 0x030D, 0x0355, 0x037C, 0x03FC, 0x0380, 0x03C4, 0x004F, 0x0378, 0x02F9, 0x042F, 0x05D0, 0x05D4, 0x052C, 0x03B8, 0x016D, 0x01CD, - 0x00B7, 0x0201, 0x003B, 0x0463, 0x0588, 0x057C, 0x0578, 0x0340, 0x04C2, 0x03E8, 0x04BE, 0x0482, 0x0315, 0x045B, 0x0371, 0x0394, - 0x0272, 0x0211, 0x0053, 0x0472, 0x0453, 0x0351, 0x0384, 0x044B, 0x03EC, 0x04FF, 0x0700, 0x0800, 0x0701, 0x0801, 0x0702, 0x0802, - 0x0703, 0x0803, 0x0704, 0x0804, 0x0705, 0x0805, 0x0706, 0x0806, 0x0707, 0x0807, 0x0708, 0x0808, 0x0709, 0x0809, 0x070A, 0x080A, - 0x070B, 0x080B, 0x070C, 0x080C, 0x070D, 0x080D, 0x070E, 0x080E, 0x070F, 0x080F, 0x0710, 0x0711, 0x0811, 0x0712, 0x0812, - 0x0713, 0x0813, 0x0714, 0x0814, 0x0715, 0x0815, 0x0716, 0x0816, 0x0717, 0x0817, 0x0718, 0x0818, 0x0719, 0x0819, 0x081A, - 0x071B, 0x081B, 0x071C, 0x081C, 0x071D, 0x081D, 0x071E, 0x081E, 0x071F, 0x081F, 0x0720, 0x0820, 0x004B, 0x035D, 0x031C, 0x0361, - 0x002D, 0x050B, 0x044F, 0x0359, 0x05E0, 0x020D, 0x011E, 0x0286, 0x04E2, 0x04D6, 0x01DD, 0x04DA, 0x00FC, 0x01A9, 0x0185, 0x04DE, - 0x0102, 0x0189, 0x0117, 0x018D, 0x0276, 0x01FD, 0x00DB, 0x017D, 0x00EA, 0x0181, 0x0157, 0x01F9, 0x0328, 0x0560, 0x0129, 0x022D, - 0x0130, 0x03AC, 0x0123, 0x0365, 0x00B1, 0x0033, 0x0138, 0x025A, 0x0171, 0x025E, 0x00E4, 0x0195, 0x013D, 0x0191, 0x014D, 0x01B9, - 0x0246, 0x01C1, 0x0147, 0x01BD, 0x0108, 0x019D, 0x0225, 0x01A1, 0x0219, 0x027E, 0x0554, 0x00BB, 0x0282, 0x0600, 0x04F6, 0x0604, - 0x01F1, 0x0568, 0x05F4, 0x040F, 0x0252, 0x040B, 0x00C5, 0x0301, 0x0407, 0x000C, 0x024E, 0x0305, 0x0175, 0x0417, 0x0423, 0x008D, - 0x02F5, 0x0413, 0x02B2, 0x0457, 0x047A, 0x010E, 0x0608, 0x0564, 0x060C, 0x0610, 0x0580 + 0x0000, 0x0209, 0x0004, 0x0242, 0x0028, 0x0221, 0x0169, 0x0215, 0x0165, 0x024A, 0x0010, 0x021D, 0x0082, 0x01E1, + 0x0037, 0x0205, 0x0098, 0x02A6, 0x0088, 0x03D4, 0x0008, 0x03A8, 0x0467, 0x023D, 0x0433, 0x0443, 0x0437, 0x0447, + 0x009C, 0x033C, 0x00C9, 0x026A, 0x00C1, 0x0266, 0x0043, 0x03CC, 0x045F, 0x0309, 0x03A0, 0x03D0, 0x007E, 0x026E, + 0x0530, 0x01D1, 0x0507, 0x03BC, 0x0388, 0x02A2, 0x0063, 0x01D5, 0x0528, 0x03C0, 0x043B, 0x0067, 0x02FD, 0x0349, + 0x0550, 0x04EE, 0x039C, 0x0345, 0x05C8, 0x05DC, 0x0072, 0x034D, 0x030D, 0x0355, 0x037C, 0x03FC, 0x0380, 0x03C4, + 0x004F, 0x0378, 0x02F9, 0x042F, 0x05D0, 0x05D4, 0x052C, 0x03B8, 0x016D, 0x01CD, 0x00B7, 0x0201, 0x003B, 0x0463, + 0x0588, 0x057C, 0x0578, 0x0340, 0x04C2, 0x03E8, 0x04BE, 0x0482, 0x0315, 0x045B, 0x0371, 0x0394, 0x0272, 0x0211, + 0x0053, 0x0472, 0x0453, 0x0351, 0x0384, 0x044B, 0x03EC, 0x04FF, 0x0700, 0x0800, 0x0701, 0x0801, 0x0702, 0x0802, + 0x0703, 0x0803, 0x0704, 0x0804, 0x0705, 0x0805, 0x0706, 0x0806, 0x0707, 0x0807, 0x0708, 0x0808, 0x0709, 0x0809, + 0x070A, 0x080A, 0x070B, 0x080B, 0x070C, 0x080C, 0x070D, 0x080D, 0x070E, 0x080E, 0x070F, 0x080F, 0x0710, 0x0711, + 0x0811, 0x0712, 0x0812, 0x0713, 0x0813, 0x0714, 0x0814, 0x0715, 0x0815, 0x0716, 0x0816, 0x0717, 0x0817, 0x0718, + 0x0818, 0x0719, 0x0819, 0x081A, 0x071B, 0x081B, 0x071C, 0x081C, 0x071D, 0x081D, 0x071E, 0x081E, 0x071F, 0x081F, + 0x0720, 0x0820, 0x004B, 0x035D, 0x031C, 0x0361, 0x002D, 0x050B, 0x044F, 0x0359, 0x05E0, 0x020D, 0x011E, 0x0286, + 0x04E2, 0x04D6, 0x01DD, 0x04DA, 0x00FC, 0x01A9, 0x0185, 0x04DE, 0x0102, 0x0189, 0x0117, 0x018D, 0x0276, 0x01FD, + 0x00DB, 0x017D, 0x00EA, 0x0181, 0x0157, 0x01F9, 0x0328, 0x0560, 0x0129, 0x022D, 0x0130, 0x03AC, 0x0123, 0x0365, + 0x00B1, 0x0033, 0x0138, 0x025A, 0x0171, 0x025E, 0x00E4, 0x0195, 0x013D, 0x0191, 0x014D, 0x01B9, 0x0246, 0x01C1, + 0x0147, 0x01BD, 0x0108, 0x019D, 0x0225, 0x01A1, 0x0219, 0x027E, 0x0554, 0x00BB, 0x0282, 0x0600, 0x04F6, 0x0604, + 0x01F1, 0x0568, 0x05F4, 0x040F, 0x0252, 0x040B, 0x00C5, 0x0301, 0x0407, 0x000C, 0x024E, 0x0305, 0x0175, 0x0417, + 0x0423, 0x008D, 0x02F5, 0x0413, 0x02B2, 0x0457, 0x047A, 0x010E, 0x0608, 0x0564, 0x060C, 0x0610, 0x0580 }; static void RandomGrotto_WaitOpen(DoorAna* doorAna, PlayState* play) { @@ -146,11 +148,9 @@ static void RandomGrotto_WaitOpen(DoorAna* doorAna, PlayState* play) { } static void SpawnRandomGrotto() { - if ( - gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_DAY || - gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_NIGHT || - gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_RUINS - ) { + if (gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_DAY || + gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_NIGHT || + gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_RUINS) { return; } @@ -182,7 +182,7 @@ static void SpawnRandomGrotto() { } } -static void ConfigurationChanged() { +static void OnConfigurationChanged() { COND_HOOK(OnSceneSpawnActors, CVarGetInteger(CVAR("Snowballs"), 0), SpawnSnowballs); COND_HOOK(OnPlayerUpdate, CVarGetInteger(CVAR("SuperBonk"), 0), []() { Player* player = GET_PLAYER(gPlayState); @@ -201,30 +201,26 @@ static void ConfigurationChanged() { COND_HOOK(OnSceneSpawnActors, CVarGetInteger(CVAR("DownTheRabbitHole"), 0), SpawnRandomGrotto); } -static void DrawMenu() { - //ImGui::SeparatorText(AUTHOR); +static void RegisterMenu() { + WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 }; + SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2); - //if (UIWidgets::EnhancementCheckbox("Snowballs", CVAR("Snowballs"))) { - // ConfigurationChanged(); - //} - //UIWidgets::Tooltip("Rogue snowballs will spawn in Hyrule Field and Kakariko Village."); - //if (UIWidgets::EnhancementCheckbox("Lake Hylia Icebergs", CVAR("Icebergs"))) { - // ConfigurationChanged(); - //} - //UIWidgets::Tooltip("Icebergs will spawn in Lake Hylia."); - //if (UIWidgets::EnhancementCheckbox("Down the Rabbit Hole", CVAR("DownTheRabbitHole"))) { - // ConfigurationChanged(); - //} - //UIWidgets::Tooltip("Random grottos will spawn throughout Hyrule. Who knows where they will take you?"); - //if (UIWidgets::EnhancementCheckbox("Super Bonk", CVAR("SuperBonk"))) { - // ConfigurationChanged(); - //} + SohGui::mSohMenu->AddWidget(path, "Snowballs", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR("Snowballs")) + .Options( + UIWidgets::CheckboxOptions().Tooltip("Rogue snowballs will spawn in Hyrule Field and Kakariko Village.")); + + SohGui::mSohMenu->AddWidget(path, "Lake Hylia Icebergs", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR("Icebergs")) + .Options(UIWidgets::CheckboxOptions().Tooltip("Icebergs will spawn in Lake Hylia.")); + + SohGui::mSohMenu->AddWidget(path, "Down the Rabbit Hole", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR("DownTheRabbitHole")) + .Options(UIWidgets::CheckboxOptions().Tooltip( + "Random grottos will spawn throughout Hyrule. Who knows where they will take you?")); + + SohGui::mSohMenu->AddWidget(path, "Super Bonk", WIDGET_CVAR_CHECKBOX).CVar(CVAR("SuperBonk")); } -static void RegisterMod() { - // #region Leave this alone unless you know what you are doing - ConfigurationChanged(); - // #endregion -} - -static Holiday holiday(DrawMenu, RegisterMod); +static RegisterShipInitFunc initFunc(OnConfigurationChanged); +static RegisterMenuInitFunc menuInitFunc(RegisterMenu); diff --git a/soh/soh/Enhancements/Holiday/Rando.cpp b/soh/soh/Enhancements/Holiday/Rando.cpp index 226b9caa1..3c9bc330c 100644 --- a/soh/soh/Enhancements/Holiday/Rando.cpp +++ b/soh/soh/Enhancements/Holiday/Rando.cpp @@ -13,7 +13,7 @@ extern "C" { extern PlayState* gPlayState; } -static void ConfigurationChanged() { +static void OnConfigurationChanged() { COND_ID_HOOK(OnOpenText, 0x406B, IS_RANDO, [](u16* textId, bool* loadFromMessageTable) { if (gPlayState->sceneNum != SCENE_KAKARIKO_VILLAGE) { return; @@ -35,15 +35,7 @@ static void ConfigurationChanged() { messageEntry.LoadIntoFont(); *loadFromMessageTable = false; }); + COND_HOOK(OnLoadGame, true, [](int16_t fileNum) { OnConfigurationChanged(); }); } -static void RegisterMod() { - // #region Leave this alone unless you know what you are doing - ConfigurationChanged(); - // #endregion - - GameInteractor::Instance->RegisterGameHook( - [](int16_t fileNum) { ConfigurationChanged(); }); -} - -static Holiday holiday([]() {}, RegisterMod); +static RegisterShipInitFunc initFunc(OnConfigurationChanged); diff --git a/soh/soh/Enhancements/Holiday/aMannus.cpp b/soh/soh/Enhancements/Holiday/aMannus.cpp index 51e62452b..1b91bc916 100644 --- a/soh/soh/Enhancements/Holiday/aMannus.cpp +++ b/soh/soh/Enhancements/Holiday/aMannus.cpp @@ -14,7 +14,7 @@ extern PlayState* gPlayState; uint8_t rocsUseCount = 0; -static void ConfigurationChanged() { +static void OnConfigurationChanged() { COND_HOOK(OnPlayerUpdate, CVarGetInteger(CVAR("RocsFeather"), 0), []() { Player* player = GET_PLAYER(gPlayState); @@ -58,19 +58,15 @@ static void ConfigurationChanged() { }); } -static void DrawMenu() { - //ImGui::SeparatorText(AUTHOR); +static void RegisterMenu() { + WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 }; + SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2); - //if (UIWidgets::EnhancementCheckbox("Roc's Feather", CVAR("RocsFeather"))) { - // ConfigurationChanged(); - //} - //UIWidgets::Tooltip("Using Nayru's Love will now act as Roc's Feather instead! No magic required."); + SohGui::mSohMenu->AddWidget(path, "Roc's Feather", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR("RocsFeather")) + .Options(UIWidgets::CheckboxOptions().Tooltip( + "Using Nayru's Love will now act as Roc's Feather instead! No magic required.")); } -static void RegisterMod() { - // #region Leave this alone unless you know what you are doing - ConfigurationChanged(); - // #endregion -} - -static Holiday holiday(DrawMenu, RegisterMod); +static RegisterShipInitFunc initFunc(OnConfigurationChanged); +static RegisterMenuInitFunc menuInitFunc(RegisterMenu); diff --git a/soh/soh/Enhancements/Holiday/lilDavid.cpp b/soh/soh/Enhancements/Holiday/lilDavid.cpp index 79b2606fc..ea32c72fc 100644 --- a/soh/soh/Enhancements/Holiday/lilDavid.cpp +++ b/soh/soh/Enhancements/Holiday/lilDavid.cpp @@ -115,20 +115,13 @@ static void OnConfigurationChanged() { }); } -static void DrawMenu() { - //ImGui::SeparatorText(AUTHOR); - //if (UIWidgets::EnhancementCheckbox("Bomb Arrows", CVAR("BombArrows.Enabled"))) { - // OnConfigurationChanged(); - //} - //UIWidgets::Tooltip("Equip bombs over an already equipped Bow to shoot bomb arrows"); +static void RegisterMenu() { + WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 }; + SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2); + SohGui::mSohMenu->AddWidget(path, "Bomb Arrows", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR("BombArrows.Enabled")) + .Options(UIWidgets::CheckboxOptions().Tooltip("Equip bombs over an already equipped Bow to shoot bomb arrows")); } -static void RegisterMod() { - // #region Leave this alone unless you know what you are doing - OnConfigurationChanged(); - // #endregion - - CVarSetInteger(CVAR("BombArrows.Active"), 0); -} - -static Holiday holiday(DrawMenu, RegisterMod); +static RegisterShipInitFunc initFunc(OnConfigurationChanged); +static RegisterMenuInitFunc menuInitFunc(RegisterMenu); diff --git a/soh/soh/Enhancements/TimeDisplay/TimeDisplay.cpp b/soh/soh/Enhancements/TimeDisplay/TimeDisplay.cpp index ccac9b088..77ca58238 100644 --- a/soh/soh/Enhancements/TimeDisplay/TimeDisplay.cpp +++ b/soh/soh/Enhancements/TimeDisplay/TimeDisplay.cpp @@ -137,8 +137,8 @@ static void TimeDisplayGetTimer(uint32_t timeID) { textureDisplay = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("NAVI_TIMER"); break; case DISPLAY_FRED_QUEST: - timeDisplayTime = std::to_string(FredsQuestWoodOnHand) + "/" + std::to_string(FredsQuestWoodCollected) + "/" + - std::to_string(CVarGetInteger("gHoliday.Fredomato.FredsQuest.WoodNeeded", 300)); + timeDisplayTime = std::to_string(FredsQuestWoodOnHand) + "/" + std::to_string(FredsQuestWoodCollected) + + "/" + std::to_string(CVarGetInteger("gHoliday.Fredomato.FredsQuest.WoodNeeded", 300)); textureDisplay = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("ITEM_STICK"); default: break; diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index 67ba51ab0..b01ffc5f0 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -521,7 +521,10 @@ void ResetPositionAll() { int hue = 0; -#define CVAR_LL(v) "gHoliday." "LL" "." v +#define CVAR_LL(v) \ + "gHoliday." \ + "LL" \ + "." v // Runs every frame to update rainbow hue, a potential future optimization is to only run this a once or twice a second // and increase the speed of the rainbow hue rotation. @@ -534,13 +537,12 @@ void CosmeticsUpdateTick() { Color_RGBA8 newColor; newColor.a = 255; - + if (!CVarGetInteger(CVAR_LL("lEnableCustomRainbows"), 0)) { newColor.r = static_cast(sin(frequency * (hue + index) + 0) * 127) + 128; newColor.g = static_cast(sin(frequency * (hue + index) + (2 * M_PI / 3)) * 127) + 128; newColor.b = static_cast(sin(frequency * (hue + index) + (4 * M_PI / 3)) * 127) + 128; - } - else { + } else { Color_RGBA8 customColorZero = CVarGetColor(CVAR_LL("lCustomRainbow1"), {}); Color_RGBA8 customColorOne = CVarGetColor(CVAR_LL("lCustomRainbow2"), {}); Color_RGBA8 customColorMinusZero = CVarGetColor(CVAR_LL("lCustomRainbow3"), {}); @@ -551,25 +553,25 @@ void CosmeticsUpdateTick() { bool quadrant3 = hue >= (360 * rainbowSpeed) / 2 && hue <= (360 * rainbowSpeed) * 3 / 4; bool quadrant4 = hue >= (360 * rainbowSpeed) * 3 / 4; - if (quadrant1) { //zero to one + if (quadrant1) { // zero to one newColor.r = sinangle * (customColorOne.r - customColorZero.r) + customColorZero.r; newColor.g = sinangle * (customColorOne.g - customColorZero.g) + customColorZero.g; newColor.b = sinangle * (customColorOne.b - customColorZero.b) + customColorZero.b; - } else if (quadrant2) { //one to zero + } else if (quadrant2) { // one to zero newColor.r = sinangle * (customColorOne.r - customColorMinusZero.r) + customColorMinusZero.r; newColor.g = sinangle * (customColorOne.g - customColorMinusZero.g) + customColorMinusZero.g; newColor.b = sinangle * (customColorOne.b - customColorMinusZero.b) + customColorMinusZero.b; - } else if (quadrant3) { //zero to minus one + } else if (quadrant3) { // zero to minus one newColor.r = -sinangle * (customColorMinusOne.r - customColorMinusZero.r) + customColorMinusZero.r; newColor.g = -sinangle * (customColorMinusOne.g - customColorMinusZero.g) + customColorMinusZero.g; newColor.b = -sinangle * (customColorMinusOne.b - customColorMinusZero.b) + customColorMinusZero.b; - } else if (quadrant4) { //minus one to zero + } else if (quadrant4) { // minus one to zero newColor.r = -sinangle * (customColorMinusOne.r - customColorZero.r) + customColorZero.r; newColor.g = -sinangle * (customColorMinusOne.g - customColorZero.g) + customColorZero.g; newColor.b = -sinangle * (customColorMinusOne.b - customColorZero.b) + customColorZero.b; } } - + // For alpha supported options, retain the last set alpha instead of overwriting if (cosmeticOption.supportsAlpha) { newColor.a = static_cast(cosmeticOption.currentColor.w * 255.0f); diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index 4a4ae18f0..c30017183 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -658,5 +658,4 @@ void InitMods() { RegisterPatchHandHandler(); RegisterHurtContainerModeHandler(); RandoKaleido_RegisterHooks(); - RegisterHoliday(); } diff --git a/soh/soh/Network/Anchor/Packets/SetCheckStatus.cpp b/soh/soh/Network/Anchor/Packets/SetCheckStatus.cpp index 663c56350..fb1c70dc9 100644 --- a/soh/soh/Network/Anchor/Packets/SetCheckStatus.cpp +++ b/soh/soh/Network/Anchor/Packets/SetCheckStatus.cpp @@ -41,7 +41,7 @@ void Anchor::HandlePacket_SetCheckStatus(nlohmann::json payload) { RandomizerCheck rc = payload["rc"].get(); RandomizerCheckStatus status = payload["status"].get(); bool skipped = payload["skipped"].get(); - + isResultOfHandling = true; if (randoContext->GetItemLocation(rc)->GetCheckStatus() != status) { diff --git a/soh/soh/SohGui/SohMenu.cpp b/soh/soh/SohGui/SohMenu.cpp index c5153074e..9300f44bb 100644 --- a/soh/soh/SohGui/SohMenu.cpp +++ b/soh/soh/SohGui/SohMenu.cpp @@ -86,6 +86,7 @@ void SohMenu::InitElement() { AddMenuSettings(); AddMenuEnhancements(); AddMenuRandomizer(); + AddMenuEntry("Holiday", CVAR_SETTING("Menu.HolidaySidebarSection")); AddMenuNetwork(); AddMenuDevTools(); diff --git a/soh/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c b/soh/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c index fe6aa2523..15874fe87 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c +++ b/soh/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c @@ -16,8 +16,9 @@ #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/Enhancements/Holiday/Archez.h" -#define FLAGS \ - (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ + ACTOR_FLAG_DRAW_CULLING_DISABLED) typedef enum { /* 0 */ THROW_NORMAL, diff --git a/soh/src/overlays/actors/ovl_En_ChristmasTree/z_en_christmastree.c b/soh/src/overlays/actors/ovl_En_ChristmasTree/z_en_christmastree.c index a44dbc6ac..70eebf7e1 100644 --- a/soh/src/overlays/actors/ovl_En_ChristmasTree/z_en_christmastree.c +++ b/soh/src/overlays/actors/ovl_En_ChristmasTree/z_en_christmastree.c @@ -77,7 +77,8 @@ void EnChristmasTree_Talk(EnChristmasTree* this, PlayState* play) { if (dialogState != TEXT_STATE_CHOICE) { if ((dialogState == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { // advanced final textbox // Teleport to credits when goal is reached. - if (gSaveContext.ship.quest.data.randomizer.triforcePiecesCollected >= Randomizer_GetSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED)) { + if (gSaveContext.ship.quest.data.randomizer.triforcePiecesCollected >= + Randomizer_GetSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED)) { gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_TRIFORCE_COMPLETED] = GAMEPLAYSTAT_TOTAL_TIME; gSaveContext.ship.stats.gameComplete = 1; Play_PerformSave(play); diff --git a/soh/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c b/soh/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c index 43512f02a..e02a147ba 100644 --- a/soh/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/soh/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -371,8 +371,7 @@ void EnWood02_Update(Actor* thisx, PlayState* play2) { dropsSpawnPt.y += 200.0f; if (HandleTreeBonk(&this->actor)) { // no-op - } else - if (GameInteractor_Should(VB_TREE_DROP_ITEM, true, this)) { + } else if (GameInteractor_Should(VB_TREE_DROP_ITEM, true, this)) { if ((this->unk_14C >= 0) && (this->unk_14C < 0x64)) { if (GameInteractor_Should(VB_TREE_DROP_COLLECTIBLE, true, this)) { Item_DropCollectibleRandom(play, &this->actor, &dropsSpawnPt, this->unk_14C << 4); @@ -381,7 +380,7 @@ void EnWood02_Update(Actor* thisx, PlayState* play2) { this->actor.home.rot.z &= 0x1FFF; this->actor.home.rot.z |= 0xE000; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, dropsSpawnPt.x, dropsSpawnPt.y, dropsSpawnPt.z, 0, - this->actor.world.rot.y, 0, this->actor.home.rot.z, true); + this->actor.world.rot.y, 0, this->actor.home.rot.z, true); this->actor.home.rot.z = 0; } }