Convert all menu code to new menu, convert Holiday structure to ShipInit and MenuInit, and disable custom rainbows.

This commit is contained in:
Malkierian
2025-11-22 19:21:40 -07:00
parent 08fd5ff5cd
commit aa119ce8f9
23 changed files with 469 additions and 529 deletions

View File

@@ -61,21 +61,13 @@ static void OnConfigurationChanged() {
}); });
} }
static void DrawMenu() { static void RegisterMenu() {
//ImGui::SeparatorText(AUTHOR); WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 };
//if (UIWidgets::EnhancementCheckbox("Evil Gossip Stone", CVAR("EvilGossipStone"))) { SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2);
// OnConfigurationChanged(); SohGui::mSohMenu->AddWidget(path, "Evil Gossip Stone", WIDGET_CVAR_CHECKBOX)
//} .CVar(CVAR("EvilGossipStone"))
//UIWidgets::Tooltip("Don't you dare talk to them."); .Options(UIWidgets::CheckboxOptions().Tooltip("Don't you dare talk to them."));
} }
static void RegisterMod() { static RegisterShipInitFunc initFunc(OnConfigurationChanged);
// #region Leave this alone unless you know what you are doing static RegisterMenuInitFunc menuInitFunc(RegisterMenu);
OnConfigurationChanged();
// #endregion
// TODO: Anything you want to run once on startup
}
// TODO: Uncomment this line to enable the mod
static Holiday holiday(DrawMenu, RegisterMod);

View File

@@ -34,7 +34,7 @@ extern "C" void ClearOverrideSkips() {
sSkipNextSkeleton = false; sSkipNextSkeleton = false;
} }
static void ConfigurationChanged() { static void OnConfigurationChanged() {
COND_VB_SHOULD(VB_DRAW_SKEL_LIMB, CVarGetInteger(CVAR("SnowGolems"), 0), { COND_VB_SHOULD(VB_DRAW_SKEL_LIMB, CVarGetInteger(CVAR("SnowGolems"), 0), {
if (!*should) { if (!*should) {
return; return;
@@ -107,17 +107,15 @@ static void ConfigurationChanged() {
}); });
} }
static void DrawMenu() { static void RegisterMenu() {
ImGui::SeparatorText(AUTHOR); WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 };
SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2);
//if (UIWidgets::EnhancementCheckbox("Snow Golems", CVAR("SnowGolems"))) { SohGui::mSohMenu->AddWidget(path, "Snow Golems", WIDGET_CVAR_CHECKBOX)
// ConfigurationChanged(); .CVar(CVAR("SnowGolems"))
//} .Callback([](WidgetInfo& info) { OnConfigurationChanged(); })
UIWidgets::Tooltip("Overrides most charactor skeletons with snow balls to make them look like Snow Golems"); .Options(UIWidgets::CheckboxOptions().Tooltip(
"Overrides most charactor skeletons with snow balls to make them look like Snow Golems"));
} }
static void RegisterMod() { static RegisterShipInitFunc initFunc(OnConfigurationChanged);
ConfigurationChanged(); static RegisterMenuInitFunc menuInitFunc(RegisterMenu);
}
static Holiday holiday(DrawMenu, RegisterMod);

View File

@@ -84,8 +84,7 @@ void RandomizeBoulder(Actor* refActor) {
bool spawningPresents = false; bool spawningPresents = false;
struct Present { struct Present {};
};
std::unordered_map<Actor*, Present> presents; std::unordered_map<Actor*, Present> presents;
@@ -126,7 +125,8 @@ void Present_Draw(Actor* actor, PlayState* play) {
Matrix_Scale(30.0f, 30.0f, 30.0f, MTXMODE_APPLY); Matrix_Scale(30.0f, 30.0f, 30.0f, MTXMODE_APPLY);
Matrix_Translate(49.20f, 0.0f, -106.60f, 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); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255);
gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gXmasDecor100DL); gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gXmasDecor100DL);
@@ -139,39 +139,37 @@ void Present_Destroy(Actor* actor, PlayState* play) {
static void OnPresentChange() { static void OnPresentChange() {
isExchangeDisabled = !CVarGetInteger(CVAR("OrnExch.Enabled"), 0); isExchangeDisabled = !CVarGetInteger(CVAR("OrnExch.Enabled"), 0);
COND_ID_HOOK(OnOpenText, 0x204A, CVarGetInteger(CVAR("OrnExch.Enabled"), 0), [](u16 * textId, bool* loadFromMessageTable) { COND_ID_HOOK(
auto messageEntry = CustomMessage(""); OnOpenText, 0x204A, CVarGetInteger(CVAR("OrnExch.Enabled"), 0), [](u16* textId, bool* loadFromMessageTable) {
bool reduceGifts = false; auto messageEntry = CustomMessage("");
uint32_t giftsCollected = CVarGetInteger(CVAR("GiftsCollected"), 0); bool reduceGifts = false;
uint32_t giftsRequired = CVarGetInteger(CVAR("OrnExch.Amount"), 15); uint32_t giftsCollected = CVarGetInteger(CVAR("GiftsCollected"), 0);
if (giftsCollected < giftsRequired) { uint32_t giftsRequired = CVarGetInteger(CVAR("OrnExch.Amount"), 15);
std::string msg = "You only have %r " + std::to_string(giftsCollected) + "%w If you bring me %g" if (giftsCollected < giftsRequired) {
+ std::to_string(giftsRequired) + "%w I'll give you a reward!"; std::string msg = "You only have %r " + std::to_string(giftsCollected) + "%w If you bring me %g" +
messageEntry = CustomMessage(msg); std::to_string(giftsRequired) + "%w I'll give you a reward!";
} else { messageEntry = CustomMessage(msg);
std::string msg = "A present? And %g" + std::to_string(giftsRequired) + } else {
"%w to boot? Here's your reward, bring me more if you find any!"; std::string msg = "A present? And %g" + std::to_string(giftsRequired) +
messageEntry = CustomMessage(msg); "%w to boot? Here's your reward, bring me more if you find any!";
reduceGifts = true; messageEntry = CustomMessage(msg);
} reduceGifts = true;
messageEntry.AutoFormat(); }
messageEntry.LoadIntoFont(); messageEntry.AutoFormat();
*loadFromMessageTable = false; messageEntry.LoadIntoFont();
*loadFromMessageTable = false;
if (reduceGifts) { if (reduceGifts) {
vanillaQueuedItemEntry = Rando::StaticData::RetrieveItem(RG_TRIFORCE_PIECE).GetGIEntry_Copy(); vanillaQueuedItemEntry = Rando::StaticData::RetrieveItem(RG_TRIFORCE_PIECE).GetGIEntry_Copy();
giftsCollected -= giftsRequired; giftsCollected -= giftsRequired;
CVarSetInteger(CVAR("GiftsCollected"), giftsCollected); CVarSetInteger(CVAR("GiftsCollected"), giftsCollected);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
std::string msg = std::to_string(giftsCollected).c_str(); std::string msg = std::to_string(giftsCollected).c_str();
msg += " Gifts in Inventory."; msg += " Gifts in Inventory.";
Notification::Emit({ Notification::Emit({ .itemIcon = "RG_TRIFORCE_PIECE", .message = msg });
.itemIcon = "RG_TRIFORCE_PIECE", }
.message = msg });
});
}
});
COND_HOOK(OnSceneSpawnActors, CVarGetInteger(CVAR("OrnExch.Enabled"), 0), []() { COND_HOOK(OnSceneSpawnActors, CVarGetInteger(CVAR("OrnExch.Enabled"), 0), []() {
presents.clear(); presents.clear();
@@ -188,7 +186,7 @@ static void OnPresentChange() {
pos.x = 0; pos.x = 0;
pos.z = 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.x += (float)(Random(0, 20000)) - 10000.0f;
pos.z += (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) { if (raycastResult > BGCHECK_Y_MIN) {
spawningPresents = true; 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; spawningPresents = false;
// break; // break;
} }
@@ -205,15 +204,16 @@ static void OnPresentChange() {
} }
}); });
COND_ID_HOOK(ShouldActorInit, ACTOR_EN_OE2, CVarGetInteger(CVAR("OrnExch.Enabled"), 0), [](void* actorRef, bool* should) { COND_ID_HOOK(ShouldActorInit, ACTOR_EN_OE2, CVarGetInteger(CVAR("OrnExch.Enabled"), 0),
Actor* actor = (Actor*)actorRef; [](void* actorRef, bool* should) {
if (spawningPresents) { Actor* actor = (Actor*)actorRef;
actor->init = Present_Init; if (spawningPresents) {
actor->update = Present_Update; actor->init = Present_Init;
actor->draw = Present_Draw; actor->update = Present_Update;
actor->destroy = Present_Destroy; actor->draw = Present_Draw;
} actor->destroy = Present_Destroy;
}); }
});
} }
static void OnBlitzChange() { static void OnBlitzChange() {
@@ -270,39 +270,48 @@ void CaladiusWindow::Draw() {
ImGui::PopStyleVar(1); ImGui::PopStyleVar(1);
} }
static void DrawMenu() { static void RegisterMenu() {
//ImGui::SeparatorText(AUTHOR); WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 };
//if (UIWidgets::EnhancementCheckbox("Holiday Fever", CVAR("Fever.Enabled"))) { SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2);
// OnFeverConfigurationChanged(); SohGui::mSohMenu->AddWidget(path, "Holiday Fever", WIDGET_CVAR_CHECKBOX)
//} .CVar(CVAR("Fever.Enabled"))
//UIWidgets::Tooltip("Can you beat your objective before the Fever sets in?/n" .Callback([](WidgetInfo& info) { OnFeverConfigurationChanged(); })
// "- Obtaining Ice Traps extends your timer."); .Options(UIWidgets::CheckboxOptions().Tooltip("Can you beat your objective before the Fever sets in?\n"
//if (CVarGetInteger(CVAR("Fever.Enabled"), 0)) { "- Obtaining Ice Traps extends your timer."));
// if (UIWidgets::EnhancementSliderFloat("", "##FontScale", CVAR("FontScale"), SohGui::mSohMenu->AddWidget(path, "Font: %.1fx", WIDGET_CVAR_SLIDER_FLOAT)
// 1.0f, 5.0f, "Font: %.1fx", 1.0f, false, false, isFeverDisabled)) { .CVar(CVAR("FontScale"))
// OnFeverConfigurationChanged(); .Callback([](WidgetInfo& info) { OnFeverConfigurationChanged(); })
// } .PreFunc([](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("Fever.Enabled"), 0); })
// UIWidgets::PaddedEnhancementSliderInt("Starting Timer: %d minutes", "##StartTime", CVAR("StartTimer"), .Options(UIWidgets::FloatSliderOptions().DefaultValue(1.0f).Min(1.0f).Max(5.0f));
// 5, 30, "", 15, true, true, false, isFeverDisabled); SohGui::mSohMenu->AddWidget(path, "Starting Timer: %d minutes", WIDGET_CVAR_SLIDER_INT)
// UIWidgets::PaddedEnhancementSliderInt("Time Extensions: %d minutes", "##ExtendTime", CVAR("ExtendTimer"), .CVar(CVAR("StartTimer"))
// 1, 10, "", 5, true, true, false, isFeverDisabled); .Callback([](WidgetInfo& info) { OnFeverConfigurationChanged(); })
//} .PreFunc([](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("Fever.Enabled"), 0); })
//UIWidgets::PaddedSeparator(); .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"))) { SohGui::mSohMenu->AddWidget(path, "BoulderBlitzSect", WIDGET_SEPARATOR);
// OnBlitzChange(); SohGui::mSohMenu->AddWidget(path, "Boulder Blitz", WIDGET_CVAR_CHECKBOX)
//} .CVar(CVAR("Blitz.Enabled"))
//UIWidgets::Tooltip("Boulders will randomly be replaced with other boulder types."); .Callback([](WidgetInfo& info) { OnBlitzChange(); })
//UIWidgets::PaddedSeparator(); .Options(UIWidgets::CheckboxOptions().Tooltip("Boulders will randomly be replaced with other boulder types."));
//if (UIWidgets::EnhancementCheckbox("Ornament Exchange", CVAR("OrnExch.Enabled"))) { SohGui::mSohMenu->AddWidget(path, "OrnamentExchSect", WIDGET_SEPARATOR);
// OnPresentChange(); SohGui::mSohMenu->AddWidget(path, "Ornament Exchange", WIDGET_CVAR_CHECKBOX)
//} .CVar(CVAR("OrnExch.Enabled"))
//UIWidgets::Tooltip("See Malon as Young Link in Lon Lon Ranch to exchange Gifts for Ornaments!"); .Callback([](WidgetInfo& info) { OnPresentChange(); })
//if (CVarGetInteger(CVAR("OrnExch.Enabled"), 0)) { .Options(UIWidgets::CheckboxOptions().Tooltip(
// UIWidgets::PaddedEnhancementSliderInt("Gifts Required: %d Gifts", "##GiftsReq", CVAR("OrnExch.Amount"), "See Malon as Young Link in Lon Lon Ranch to exchange Gifts for Ornaments!"));
// 5, 30, "", 15, true, true, false, isExchangeDisabled);
//} 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() { static void RegisterMod() {
@@ -311,4 +320,5 @@ static void RegisterMod() {
OnPresentChange(); OnPresentChange();
} }
static Holiday holiday(DrawMenu, RegisterMod); static RegisterShipInitFunc initFunc(RegisterMod);
static RegisterMenuInitFunc menuInitFunc(RegisterMenu);

View File

@@ -27,10 +27,10 @@ static void OnConfigurationChanged() {
} }
static void DrawMenu() { static void DrawMenu() {
//ImGui::SeparatorText(AUTHOR); // ImGui::SeparatorText(AUTHOR);
//if (UIWidgets::EnhancementCheckbox("DoSomethingWithPots", CVAR("DoSomethingWithPots"))) { // if (UIWidgets::EnhancementCheckbox("DoSomethingWithPots", CVAR("DoSomethingWithPots"))) {
// OnConfigurationChanged(); // OnConfigurationChanged();
//} // }
} }
static void RegisterMod() { static void RegisterMod() {

View File

@@ -35,23 +35,25 @@ static CollisionPoly snowballPoly;
static f32 raycastResult; static f32 raycastResult;
const s16 entrances[] = { const s16 entrances[] = {
0x0000, 0x0209, 0x0004, 0x0242, 0x0028, 0x0221, 0x0169, 0x0215, 0x0165, 0x024A, 0x0010, 0x021D, 0x0082, 0x01E1, 0x0037, 0x0205, 0x0000, 0x0209, 0x0004, 0x0242, 0x0028, 0x0221, 0x0169, 0x0215, 0x0165, 0x024A, 0x0010, 0x021D, 0x0082, 0x01E1,
0x0098, 0x02A6, 0x0088, 0x03D4, 0x0008, 0x03A8, 0x0467, 0x023D, 0x0433, 0x0443, 0x0437, 0x0447, 0x009C, 0x033C, 0x00C9, 0x026A, 0x0037, 0x0205, 0x0098, 0x02A6, 0x0088, 0x03D4, 0x0008, 0x03A8, 0x0467, 0x023D, 0x0433, 0x0443, 0x0437, 0x0447,
0x00C1, 0x0266, 0x0043, 0x03CC, 0x045F, 0x0309, 0x03A0, 0x03D0, 0x007E, 0x026E, 0x0530, 0x01D1, 0x0507, 0x03BC, 0x0388, 0x02A2, 0x009C, 0x033C, 0x00C9, 0x026A, 0x00C1, 0x0266, 0x0043, 0x03CC, 0x045F, 0x0309, 0x03A0, 0x03D0, 0x007E, 0x026E,
0x0063, 0x01D5, 0x0528, 0x03C0, 0x043B, 0x0067, 0x02FD, 0x0349, 0x0550, 0x04EE, 0x039C, 0x0345, 0x05C8, 0x05DC, 0x0072, 0x034D, 0x0530, 0x01D1, 0x0507, 0x03BC, 0x0388, 0x02A2, 0x0063, 0x01D5, 0x0528, 0x03C0, 0x043B, 0x0067, 0x02FD, 0x0349,
0x030D, 0x0355, 0x037C, 0x03FC, 0x0380, 0x03C4, 0x004F, 0x0378, 0x02F9, 0x042F, 0x05D0, 0x05D4, 0x052C, 0x03B8, 0x016D, 0x01CD, 0x0550, 0x04EE, 0x039C, 0x0345, 0x05C8, 0x05DC, 0x0072, 0x034D, 0x030D, 0x0355, 0x037C, 0x03FC, 0x0380, 0x03C4,
0x00B7, 0x0201, 0x003B, 0x0463, 0x0588, 0x057C, 0x0578, 0x0340, 0x04C2, 0x03E8, 0x04BE, 0x0482, 0x0315, 0x045B, 0x0371, 0x0394, 0x004F, 0x0378, 0x02F9, 0x042F, 0x05D0, 0x05D4, 0x052C, 0x03B8, 0x016D, 0x01CD, 0x00B7, 0x0201, 0x003B, 0x0463,
0x0272, 0x0211, 0x0053, 0x0472, 0x0453, 0x0351, 0x0384, 0x044B, 0x03EC, 0x04FF, 0x0700, 0x0800, 0x0701, 0x0801, 0x0702, 0x0802, 0x0588, 0x057C, 0x0578, 0x0340, 0x04C2, 0x03E8, 0x04BE, 0x0482, 0x0315, 0x045B, 0x0371, 0x0394, 0x0272, 0x0211,
0x0703, 0x0803, 0x0704, 0x0804, 0x0705, 0x0805, 0x0706, 0x0806, 0x0707, 0x0807, 0x0708, 0x0808, 0x0709, 0x0809, 0x070A, 0x080A, 0x0053, 0x0472, 0x0453, 0x0351, 0x0384, 0x044B, 0x03EC, 0x04FF, 0x0700, 0x0800, 0x0701, 0x0801, 0x0702, 0x0802,
0x070B, 0x080B, 0x070C, 0x080C, 0x070D, 0x080D, 0x070E, 0x080E, 0x070F, 0x080F, 0x0710, 0x0711, 0x0811, 0x0712, 0x0812, 0x0703, 0x0803, 0x0704, 0x0804, 0x0705, 0x0805, 0x0706, 0x0806, 0x0707, 0x0807, 0x0708, 0x0808, 0x0709, 0x0809,
0x0713, 0x0813, 0x0714, 0x0814, 0x0715, 0x0815, 0x0716, 0x0816, 0x0717, 0x0817, 0x0718, 0x0818, 0x0719, 0x0819, 0x081A, 0x070A, 0x080A, 0x070B, 0x080B, 0x070C, 0x080C, 0x070D, 0x080D, 0x070E, 0x080E, 0x070F, 0x080F, 0x0710, 0x0711,
0x071B, 0x081B, 0x071C, 0x081C, 0x071D, 0x081D, 0x071E, 0x081E, 0x071F, 0x081F, 0x0720, 0x0820, 0x004B, 0x035D, 0x031C, 0x0361, 0x0811, 0x0712, 0x0812, 0x0713, 0x0813, 0x0714, 0x0814, 0x0715, 0x0815, 0x0716, 0x0816, 0x0717, 0x0817, 0x0718,
0x002D, 0x050B, 0x044F, 0x0359, 0x05E0, 0x020D, 0x011E, 0x0286, 0x04E2, 0x04D6, 0x01DD, 0x04DA, 0x00FC, 0x01A9, 0x0185, 0x04DE, 0x0818, 0x0719, 0x0819, 0x081A, 0x071B, 0x081B, 0x071C, 0x081C, 0x071D, 0x081D, 0x071E, 0x081E, 0x071F, 0x081F,
0x0102, 0x0189, 0x0117, 0x018D, 0x0276, 0x01FD, 0x00DB, 0x017D, 0x00EA, 0x0181, 0x0157, 0x01F9, 0x0328, 0x0560, 0x0129, 0x022D, 0x0720, 0x0820, 0x004B, 0x035D, 0x031C, 0x0361, 0x002D, 0x050B, 0x044F, 0x0359, 0x05E0, 0x020D, 0x011E, 0x0286,
0x0130, 0x03AC, 0x0123, 0x0365, 0x00B1, 0x0033, 0x0138, 0x025A, 0x0171, 0x025E, 0x00E4, 0x0195, 0x013D, 0x0191, 0x014D, 0x01B9, 0x04E2, 0x04D6, 0x01DD, 0x04DA, 0x00FC, 0x01A9, 0x0185, 0x04DE, 0x0102, 0x0189, 0x0117, 0x018D, 0x0276, 0x01FD,
0x0246, 0x01C1, 0x0147, 0x01BD, 0x0108, 0x019D, 0x0225, 0x01A1, 0x0219, 0x027E, 0x0554, 0x00BB, 0x0282, 0x0600, 0x04F6, 0x0604, 0x00DB, 0x017D, 0x00EA, 0x0181, 0x0157, 0x01F9, 0x0328, 0x0560, 0x0129, 0x022D, 0x0130, 0x03AC, 0x0123, 0x0365,
0x01F1, 0x0568, 0x05F4, 0x040F, 0x0252, 0x040B, 0x00C5, 0x0301, 0x0407, 0x000C, 0x024E, 0x0305, 0x0175, 0x0417, 0x0423, 0x008D, 0x00B1, 0x0033, 0x0138, 0x025A, 0x0171, 0x025E, 0x00E4, 0x0195, 0x013D, 0x0191, 0x014D, 0x01B9, 0x0246, 0x01C1,
0x02F5, 0x0413, 0x02B2, 0x0457, 0x047A, 0x010E, 0x0608, 0x0564, 0x060C, 0x0610, 0x0580 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; static bool midoGrottoInit = false;
@@ -67,7 +69,6 @@ static Vec3s collectionPointJointTable[17];
static Vec3s collectionPointMorphTable[17]; static Vec3s collectionPointMorphTable[17];
static std::string collectionPointNametag; static std::string collectionPointNametag;
static void RandomGrotto_WaitOpen(DoorAna* doorAna, PlayState* play) { static void RandomGrotto_WaitOpen(DoorAna* doorAna, PlayState* play) {
if (!midoGrottoInit) { if (!midoGrottoInit) {
midoGrottoInit = true; 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 // TODO: If in hyrule field and treeChopper is on, teleport somewhere else in hyrule field
static void SpawnRandomGrotto() { static void SpawnRandomGrotto() {
if ( if (gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_DAY ||
gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_DAY || gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_NIGHT ||
gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_NIGHT || gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_RUINS) {
gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_RUINS
) {
return; return;
} }
Vec3f pos = FindValidPos(2000.0f); 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; midoGrottoInit = false;
DoorAna_SetupAction((DoorAna*)grotto, RandomGrotto_WaitOpen); DoorAna_SetupAction((DoorAna*)grotto, RandomGrotto_WaitOpen);
grotto->draw = RandomGrotto_Draw; grotto->draw = RandomGrotto_Draw;
} }
void SpawnStick(Vec3f pos) { 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) { CustomCollectible::Spawn(
FredsQuestWoodOnHand++; pos.x, pos.y + 150.0f, pos.z, 0, CustomCollectible::KILL_ON_TOUCH | CustomCollectible::TOSS_ON_SPAWN, 0,
Audio_PlaySoundGeneral(NA_SE_SY_METRONOME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); [](Actor* actor, PlayState* play) {
}, [](Actor* actor, PlayState* play) { FredsQuestWoodOnHand++;
Matrix_Scale(40.0f, 40.0f, 40.0f, MTXMODE_APPLY); Audio_PlaySoundGeneral(NA_SE_SY_METRONOME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
for (int i = 4; i < 7; i++) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
Matrix_RotateZYX(800 * i, 0, 800 * i, MTXMODE_APPLY); },
GetItem_Draw(play, GID_STICK); [](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; Actor* specialTree = nullptr;
@@ -201,7 +205,7 @@ void ChooseSpecialTree() {
extern "C" bool HandleTreeBonk(Actor* actor) { extern "C" bool HandleTreeBonk(Actor* actor) {
if (!CVarGetInteger(CVAR("FredsQuest.Enabled"), 0)) { if (!CVarGetInteger(CVAR("FredsQuest.Enabled"), 0)) {
return false; return false;
} }
int damage = 2; int damage = 2;
@@ -255,7 +259,8 @@ void DrawCrazyTaxiArrow(Actor* actor, PlayState* play) {
Matrix_Translate(0.0f, 70.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(0.0f, 70.0f, 0.0f, MTXMODE_APPLY);
Matrix_RotateY(5.86f, 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); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 255, 0, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 0, 255);
gSPDisplayList(POLY_XLU_DISP++, (Gfx*)gDebugArrowDL); gSPDisplayList(POLY_XLU_DISP++, (Gfx*)gDebugArrowDL);
@@ -281,7 +286,8 @@ void CollectionPoint_Update(Actor* actor, PlayState* play) {
lastDisplayedCount = FredsQuestWoodCollected; lastDisplayedCount = FredsQuestWoodCollected;
collectionPointNametag = "Bring me wood!"; collectionPointNametag = "Bring me wood!";
if (FredsQuestWoodCollected > 0) { 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_RemoveAllForActor(actor);
NameTag_RegisterForActorWithOptions(actor, collectionPointNametag.c_str(), { .yOffset = 100 }); NameTag_RegisterForActorWithOptions(actor, collectionPointNametag.c_str(), { .yOffset = 100 });
@@ -291,7 +297,8 @@ void CollectionPoint_Update(Actor* actor, PlayState* play) {
if (FredsQuestWoodOnHand) { if (FredsQuestWoodOnHand) {
FredsQuestWoodCollected++; FredsQuestWoodCollected++;
FredsQuestWoodOnHand--; 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)) { if (FredsQuestWoodCollected >= CVarGetInteger(CVAR("FredsQuest.WoodNeeded"), 300)) {
FredsQuestComplete = true; FredsQuestComplete = true;
@@ -304,7 +311,6 @@ void CollectionPoint_Update(Actor* actor, PlayState* play) {
} else { } else {
vanillaQueuedItemEntry = Rando::StaticData::RetrieveItem(RG_HEART_CONTAINER).GetGIEntry_Copy(); 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++) { for (int i = 0; i < FredsQuestWoodCollected / (CVarGetInteger(CVAR("FredsQuest.WoodNeeded"), 300) / 50); i++) {
float angle = 10 * i; float angle = 10 * i;
float radius = (50 - i) * 0.5f; // Radius decreases as it goes up 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_Translate(radius * cosf(angle), height, radius * sinf(angle), MTXMODE_APPLY);
Matrix_RotateY(angle, MTXMODE_APPLY); Matrix_RotateY(angle, MTXMODE_APPLY);
@@ -337,8 +343,9 @@ void SpawnCollectionPoint() {
collectionPoint->actor.update = CollectionPoint_Update; collectionPoint->actor.update = CollectionPoint_Update;
collectionPoint->actor.draw = CollectionPoint_Draw; collectionPoint->actor.draw = CollectionPoint_Draw;
collectionPoint->actor.flags |= ACTOR_FLAG_DRAW_CULLING_DISABLED; collectionPoint->actor.flags |= ACTOR_FLAG_DRAW_CULLING_DISABLED;
SkelAnime_InitFlex(gPlayState, &collectionPointSkelAnime, (FlexSkeletonHeader*)&object_toryo_Skel_007150, SkelAnime_InitFlex(gPlayState, &collectionPointSkelAnime, (FlexSkeletonHeader*)&object_toryo_Skel_007150,
(AnimationHeader*)&object_toryo_Anim_000E50, collectionPointJointTable, collectionPointMorphTable, 17); (AnimationHeader*)&object_toryo_Anim_000E50, collectionPointJointTable,
collectionPointMorphTable, 17);
} }
void RandomTrap_Update(Actor* actor, PlayState* play) { void RandomTrap_Update(Actor* actor, PlayState* play) {
@@ -391,7 +398,8 @@ void RandomTrap_Draw(Actor* actor, PlayState* play) {
void SpawnRandomTrap() { void SpawnRandomTrap() {
Vec3f pos = FindValidPos(2000.0f); 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); SoundSource_PlaySfxAtFixedWorldPos(gPlayState, &randomTrap->actor.world.pos, 20, NA_SE_EV_LIGHTNING);
randomTrap->actor.update = RandomTrap_Update; randomTrap->actor.update = RandomTrap_Update;
randomTrap->actor.draw = RandomTrap_Draw; randomTrap->actor.draw = RandomTrap_Draw;
@@ -414,17 +422,18 @@ void OnSceneInit() {
SpawnCollectionPoint(); SpawnCollectionPoint();
} }
static void ConfigurationChanged() { static void OnConfigurationChanged() {
COND_HOOK(OnSceneSpawnActors, CVarGetInteger(CVAR("FredsQuest.Enabled"), 0), OnSceneInit); COND_HOOK(OnSceneSpawnActors, CVarGetInteger(CVAR("FredsQuest.Enabled"), 0), OnSceneInit);
COND_HOOK(OnPlayerUpdate, CVarGetInteger(CVAR("RandomTraps.Enabled"), 0), []() { 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(); SpawnRandomTrap();
} }
}); });
COND_HOOK(OnPlayerUpdate, CVarGetInteger(CVAR("FredsQuest.Enabled"), 0), []() { 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; GameInteractor::State::MovementSpeedMultiplier = 0;
} else { } else {
GameInteractor::State::MovementSpeedMultiplier = -2; GameInteractor::State::MovementSpeedMultiplier = -2;
@@ -438,8 +447,7 @@ static void ConfigurationChanged() {
}); });
} }
static void DrawMenu() { static void RegisterMenu() {
ImGui::SeparatorText(AUTHOR);
// UIWidgets::EnhancementSliderFloat("Xfloat", "Xfloat", CVAR("tmpxf"), 0.0f, 10.0f, "%.2f", 1.0f, false); // 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); // 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("Xs", "Xs", CVAR("tmpxs"), 0, UINT16_MAX, "%d", 1, false);
// UIWidgets::EnhancementSliderInt("Ys", "Ys", CVAR("tmpys"), 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); // UIWidgets::EnhancementSliderInt("Zs", "Zs", CVAR("tmpzs"), 0, UINT16_MAX, "%d", 1, false);
/*if (UIWidgets::EnhancementCheckbox("Fred's Quest", CVAR("FredsQuest.Enabled"))) { WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 };
ConfigurationChanged(); SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2);
}
UIWidgets::Tooltip("Collect wood and bring it to the collection point in Hyrule Field for a small reward."); SohGui::mSohMenu->AddWidget(path, "Fred's Quest", WIDGET_CVAR_CHECKBOX)
if (CVarGetInteger(CVAR("FredsQuest.Enabled"), 0)) { .CVar(CVAR("FredsQuest.Enabled"))
if (UIWidgets::EnhancementCheckbox("Crazy Taxi Arrow", CVAR("FredsQuest.CrazyTaxiArrow"))) { .Options(UIWidgets::CheckboxOptions().Tooltip(
ConfigurationChanged(); "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)
if (UIWidgets::EnhancementSliderInt("Wood Needed", "##FredsQuest.WoodNeeded", CVAR("FredsQuest.WoodNeeded"), 0, 1000, "%d", 300, false)) { .CVar(CVAR("FredsQuest.CrazyTaxiArrow"))
ConfigurationChanged(); .PreFunc(
} [](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("FredsQuest.Enabled"), 0); })
if (UIWidgets::EnhancementSliderInt("Tree Bonk Drop Rate", "##FredsQuest.TreeBonkDropRate", CVAR("FredsQuest.TreeBonkDropRate"), 0, 10, "%d", 1, false)) { .Options(UIWidgets::CheckboxOptions().Tooltip(
ConfigurationChanged(); "Collect wood and bring it to the collection point in Hyrule Field for a small reward."));
}
if (UIWidgets::EnhancementSliderInt("Tree Break Drop Rate", "##FredsQuest.TreeBreakDropRate", CVAR("FredsQuest.TreeBreakDropRate"), 0, 50, "%d", 3, false)) { SohGui::mSohMenu->AddWidget(path, "Wood Needed", WIDGET_CVAR_SLIDER_INT)
ConfigurationChanged(); .CVar(CVAR("FredsQuest.WoodNeeded"))
} .Callback([](WidgetInfo& info) { OnConfigurationChanged(); })
if (UIWidgets::EnhancementSliderInt("Special Break Drop Rate", "##FredsQuest.SpecialBreakDropRate", CVAR("FredsQuest.SpecialBreakDropRate"), 0, 50, "%d", 10, false)) { .PreFunc(
ConfigurationChanged(); [](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("FredsQuest.Enabled"), 0); })
} .Options(UIWidgets::IntSliderOptions().DefaultValue(300).Min(0).Max(1000));
if (UIWidgets::EnhancementSliderInt("Encumbered Threshold", "##FredsQuest.EncumberedThreshold", CVAR("FredsQuest.EncumberedThreshold"), 0, 200, "%d", 60, false)) {
ConfigurationChanged(); SohGui::mSohMenu->AddWidget(path, "Tree Bonk Drop Rate", WIDGET_CVAR_SLIDER_INT)
} .CVar(CVAR("FredsQuest.TreeBonkDropRate"))
UIWidgets::Tooltip("If you have more than this many sticks, you will be encumbered and run slower. 0 for disabled"); .Callback([](WidgetInfo& info) { OnConfigurationChanged(); })
} .PreFunc(
if (UIWidgets::EnhancementCheckbox("Random Traps", CVAR("RandomTraps.Enabled"))) { [](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("FredsQuest.Enabled"), 0); })
ConfigurationChanged(); .Options(UIWidgets::IntSliderOptions().DefaultValue(1).Min(0).Max(10));
}
UIWidgets::Tooltip("Random traps will spawn around you at a configurable rate. (Currently only knockback)"); SohGui::mSohMenu->AddWidget(path, "Tree Break Drop Rate", WIDGET_CVAR_SLIDER_INT)
if (CVarGetInteger(CVAR("RandomTraps.Enabled"), 0)) { .CVar(CVAR("FredsQuest.TreeBreakDropRate"))
if (UIWidgets::EnhancementSliderInt("Trap Lifetime (Seconds)", "##RandomTraps.Lifetime", CVAR("RandomTraps.Lifetime"), 0, 60, "%d", 30, false)) { .Callback([](WidgetInfo& info) { OnConfigurationChanged(); })
ConfigurationChanged(); .PreFunc(
} [](WidgetInfo& info) { info.options.get()->disabled = !CVarGetInteger(CVAR("FredsQuest.Enabled"), 0); })
if (UIWidgets::EnhancementSliderInt("Spawn Chance", "##RandomTraps.SpawnChance", CVAR("RandomTraps.SpawnChance"), 40, 2000, "%d", 1000, false)) { .Options(UIWidgets::IntSliderOptions().DefaultValue(3).Min(0).Max(50));
ConfigurationChanged();
} 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() { static RegisterShipInitFunc initFunc(OnConfigurationChanged);
// #region Leave this alone unless you know what you are doing static RegisterMenuInitFunc menuInitFunc(RegisterMenu);
ConfigurationChanged();
// #endregion
}
static Holiday holiday(DrawMenu, RegisterMod);

View File

@@ -104,7 +104,7 @@ void Penguin_Destroy(Actor* actor, PlayState* play) {
static void OnConfigurationChanged() { static void OnConfigurationChanged() {
COND_HOOK(OnPlayerUpdate, CVarGetInteger(CVAR("Hailstorm"), 0), []() { COND_HOOK(OnPlayerUpdate, CVarGetInteger(CVAR("Hailstorm"), 0), []() {
// Every frame has a 1/500 chance of spawning close hail // Every frame has a 1/500 chance of spawning close hail
if (rand() % 500 == 0) { if (rand() % 500 == 0) {
int spawned = 0; int spawned = 0;
while (spawned < 1) { while (spawned < 1) {
Vec3f pos = GET_PLAYER(gPlayState)->actor.world.pos; Vec3f pos = GET_PLAYER(gPlayState)->actor.world.pos;
@@ -112,7 +112,8 @@ static void OnConfigurationChanged() {
pos.z += (float)Random(0, 50) - 25.0f; pos.z += (float)Random(0, 50) - 25.0f;
pos.y += 200.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; EnNutsball* nut = (EnNutsball*)actor;
nut->actor.draw = EnNutsball_Draw; nut->actor.draw = EnNutsball_Draw;
nut->actor.shape.rot.y = 0; nut->actor.shape.rot.y = 0;
@@ -124,7 +125,7 @@ static void OnConfigurationChanged() {
} }
} }
// Every frame has a 1/50 chance of spawning far hail // Every frame has a 1/50 chance of spawning far hail
if (rand() % 50 == 0) { if (rand() % 50 == 0) {
int spawned = 0; int spawned = 0;
while (spawned < 1) { while (spawned < 1) {
Vec3f pos = GET_PLAYER(gPlayState)->actor.world.pos; Vec3f pos = GET_PLAYER(gPlayState)->actor.world.pos;
@@ -207,25 +208,18 @@ static void OnConfigurationChanged() {
}); });
} }
static void DrawMenu() { static void RegisterMenu() {
//ImGui::SeparatorText(AUTHOR); WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 };
//if (UIWidgets::EnhancementCheckbox("Penguins", CVAR("Penguins"))) { SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2);
// OnConfigurationChanged();
//} SohGui::mSohMenu->AddWidget(path, "Penguins", WIDGET_CVAR_CHECKBOX)
//UIWidgets::Tooltip("Penguins will spawn in huddles throughout hyrule"); .CVar(CVAR("Penguins"))
//if (UIWidgets::EnhancementCheckbox("Hailstorm", CVAR("Hailstorm"))) { .Options(UIWidgets::CheckboxOptions().Tooltip("Penguins will spawn in huddles throughout hyrule"));
// OnConfigurationChanged();
//} SohGui::mSohMenu->AddWidget(path, "Hailstorm", WIDGET_CVAR_CHECKBOX)
//UIWidgets::Tooltip("Ever persistent hailstorm throughout hyrule"); .CVar(CVAR("Hailstorm"))
.Options(UIWidgets::CheckboxOptions().Tooltip("Ever persistent hailstorm throughout hyrule"));
} }
static void RegisterMod() { static RegisterShipInitFunc initFunc(OnConfigurationChanged);
// #region Leave this alone unless you know what you are doing static RegisterMenuInitFunc menuInitFunc(RegisterMenu);
OnConfigurationChanged();
// #endregion
// TODO: Anything you want to run once on startup
}
// TODO: Uncomment this line to enable the mod
static Holiday holiday(DrawMenu, RegisterMod);

View File

@@ -4,35 +4,17 @@
#include <vector> #include <vector>
#include <functional> #include <functional>
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
#include "soh/SohGui/UIWidgets.hpp"
#include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/Enhancements/cosmetics/CosmeticsEditor.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<std::function<void()>> holidayDrawFuncs = {}; inline std::vector<std::function<void()>> holidayDrawFuncs = {};
inline std::vector<std::function<void()>> holidayRegisterFuncs = {}; inline std::vector<std::function<void()>> holidayRegisterFuncs = {};
inline void DrawHolidayMenu() { namespace SohGui {
if (ImGui::BeginMenu("Holiday")) { extern std::shared_ptr<SohMenu> mSohMenu;
for (auto& drawFunc : holidayDrawFuncs) {
ImGui::PushID(&drawFunc);
drawFunc();
ImGui::PopID();
}
ImGui::EndMenu();
}
} }
inline void RegisterHoliday() {
for (auto& regFunc : holidayRegisterFuncs) {
regFunc();
}
}
struct Holiday {
Holiday(std::function<void()> drawFunc, std::function<void()> registerFunc) {
holidayDrawFuncs.push_back(drawFunc);
holidayRegisterFuncs.push_back(registerFunc);
}
};
#endif // HOLIDAY_HPP #endif // HOLIDAY_HPP

View File

@@ -42,88 +42,60 @@ Color_RGBA8 Color_ImGuiToLUS(ImVec4 color) {
} }
static void OnConfigurationChanged() { static void OnConfigurationChanged() {
Color_RGBA8 c1 = CVarGetColor(CVAR("lCustomRainbow1"), Color_ImGuiToLUS(RAINBOW_PRESETS[0][0])); Color_RGBA8 c1 = CVarGetColor(CVAR("CustomRainbow1"), Color_ImGuiToLUS(RAINBOW_PRESETS[0][0]));
Color_RGBA8 c2 = CVarGetColor(CVAR("lCustomRainbow2"), Color_ImGuiToLUS(RAINBOW_PRESETS[0][1])); Color_RGBA8 c2 = CVarGetColor(CVAR("CustomRainbow2"), Color_ImGuiToLUS(RAINBOW_PRESETS[0][1]));
Color_RGBA8 c3 = CVarGetColor(CVAR("lCustomRainbow3"), Color_ImGuiToLUS(RAINBOW_PRESETS[0][2])); Color_RGBA8 c3 = CVarGetColor(CVAR("CustomRainbow3"), Color_ImGuiToLUS(RAINBOW_PRESETS[0][2]));
Color_RGBA8 c4 = CVarGetColor(CVAR("lCustomRainbow4"), Color_ImGuiToLUS(RAINBOW_PRESETS[0][3])); Color_RGBA8 c4 = CVarGetColor(CVAR("CustomRainbow4"), Color_ImGuiToLUS(RAINBOW_PRESETS[0][3]));
customColorZero = Color_LUSToImGui((Color_RGBA8)c1); customColorZero = Color_LUSToImGui((Color_RGBA8)c1);
customColorOne = Color_LUSToImGui((Color_RGBA8)c2); customColorOne = Color_LUSToImGui((Color_RGBA8)c2);
customColorMinusZero = Color_LUSToImGui((Color_RGBA8)c3); customColorMinusZero = Color_LUSToImGui((Color_RGBA8)c3);
customColorMinusOne = Color_LUSToImGui((Color_RGBA8)c4); 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() { static void RegisterMenu() {
ImGui::SeparatorText(AUTHOR); WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 };
//if (ImGui::BeginMenu("Customize Rainbows")) { SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2);
// 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);
// UIWidgets::PaddedText("Presets", true, false); SohGui::mSohMenu->AddWidget(path, "Custom Rainbows", WIDGET_CVAR_CHECKBOX).CVar(CVAR("EnableCustomRainbows"));
// 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];
// }
// Color_RGBA8 color1, color2, color3, color4; SohGui::mSohMenu->AddWidget(path, "Color 1", WIDGET_CVAR_COLOR_PICKER)
// color1.r = static_cast<uint8_t>(customColorZero.x * 255.0f); .CVar(CVAR("CustomRainbow1"))
// color1.g = static_cast<uint8_t>(customColorZero.y * 255.0f); .Options(UIWidgets::ColorPickerOptions().ShowRandom().ShowReset().UseAlpha(false).DefaultValue(
// color1.b = static_cast<uint8_t>(customColorZero.z * 255.0f); 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<uint8_t>(customColorOne.x * 255.0f); SohGui::mSohMenu->AddWidget(path, "Presets", WIDGET_SEPARATOR_TEXT);
// color2.g = static_cast<uint8_t>(customColorOne.y * 255.0f); SohGui::mSohMenu->AddWidget(path, "Custom Rainbow Presets", WIDGET_CVAR_COMBOBOX)
// color2.b = static_cast<uint8_t>(customColorOne.z * 255.0f); .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<uint8_t>(customColorMinusZero.x * 255.0f); CVarSetColor(CVAR("CustomRainbow1.Value"), Color_ImGuiToLUS(customColorZero));
// color3.g = static_cast<uint8_t>(customColorMinusZero.y * 255.0f); CVarSetColor(CVAR("CustomRainbow2.Value"), Color_ImGuiToLUS(customColorOne));
// color3.b = static_cast<uint8_t>(customColorMinusZero.z * 255.0f); CVarSetColor(CVAR("CustomRainbow3.Value"), Color_ImGuiToLUS(customColorMinusZero));
CVarSetColor(CVAR("CustomRainbow4.Value"), Color_ImGuiToLUS(customColorMinusOne));
CVarSave();
});
// color4.r = static_cast<uint8_t>(customColorMinusOne.x * 255.0f); SohGui::mSohMenu->AddWidget(path, "Do Something With Pots", WIDGET_CVAR_CHECKBOX).CVar(CVAR("DoSomethingWithPots"));
// color4.g = static_cast<uint8_t>(customColorMinusOne.y * 255.0f);
// color4.b = static_cast<uint8_t>(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();
//}
} }
static void RegisterMod() { // static RegisterShipInitFunc initFunc(OnConfigurationChanged);
// #region Leave this alone unless you know what you are doing // static RegisterMenuInitFunc menuInitFunc(RegisterMenu);
OnConfigurationChanged();
// #endregion
// TODO: Anything you want to run once on startup
}
// TODO: Uncomment this line to enable the mod
static Holiday holiday(DrawMenu, RegisterMod);

View File

@@ -1,85 +1,70 @@
#ifndef LL_H #ifndef LL_H
#define LL_H #define LL_H
#include <map>
#include "soh/Enhancements/cosmetics/CosmeticsEditor.h" #include "soh/Enhancements/cosmetics/CosmeticsEditor.h"
#include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/game-interactor/GameInteractor.h"
const size_t RAINBOW_PRESET_LEN = 9; const size_t RAINBOW_PRESET_LEN = 9;
static const char* RAINBOW_PRESET_NAMES[RAINBOW_PRESET_LEN] = { std::unordered_map<int32_t, const char*> RAINBOW_PRESET_NAMES = {
"Christmas", { 0, "Christmas" }, { 1, "Transgender" }, { 2, "Nonbinary" }, { 3, "Bisexual" }, { 4, "Lesbian" },
"Transgender", { 5, "Gay (MLM)" }, { 6, "Asexual" }, { 7, "Brazil" }, { 8, "Italy" }
"Nonbinary",
"Bisexual",
"Lesbian",
"Gay (MLM)",
"Asexual",
"Brazil",
"Italy"
}; };
static const ImVec4 RAINBOW_PRESETS[RAINBOW_PRESET_LEN][4] = { static const ImVec4 RAINBOW_PRESETS[RAINBOW_PRESET_LEN][4] = {
{ //christmas { // christmas
{0.0/255.0, 140.0/255.0, 69.0/255.0, 0}, { 0.0f / 255.0f, 140.0f / 255.0f, 69.0f / 255.0f, 1 },
{205.0/255.0, 33.0/255.0, 42.0/255.0, 0}, { 205.0f / 255.0f, 33.0f / 255.0f, 42.0f / 255.0f, 1 },
{0.0/255.0, 140.0/255.0, 69.0/255.0, 0}, { 0.0f / 255.0f, 140.0f / 255.0f, 69.0f / 255.0f, 1 },
{205.0/255.0, 33.0/255.0, 42.0/255.0, 0} { 205.0f / 255.0f, 33.0f / 255.0f, 42.0f / 255.0f, 1 } },
}, { // trans
{ //trans { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 },
{255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, { 255.0f / 255.0f, 159.0f / 255.0f, 186.0f / 255.0f, 1 },
{255.0/255.0, 159.0/255.0, 186.0/255.0, 0}, { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 },
{255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, { 71.0f / 255.0f, 186.0f / 255.0f, 230.0f / 255.0f, 1 } },
{71.0/255.0, 186.0/255.0, 230.0/255.0, 0}
},
{ //enby { // enby
{252.0/255.0, 244.0/255.0, 52.0/255.0, 0}, { 252.0f / 255.0f, 244.0f / 255.0f, 52.0f / 255.0f, 1 },
{255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 },
{156.0/255.0, 89.0/255.0, 209.0/255.0, 0}, { 156.0f / 255.0f, 89.0f / 255.0f, 209.0f / 255.0f, 1 },
{0.0/255.0, 0.0/255.0, 0.0/255.0, 0} { 0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 1 } },
},
{ //bi { // bi
{155.0/255.0, 79.0/255.0, 150.0/255.0, 0}, { 155.0f / 255.0f, 79.0f / 255.0f, 150.0f / 255.0f, 1 },
{0.0/255.0, 56.0/255.0, 168.0/255.0, 0}, { 0.0f / 255.0f, 56.0f / 255.0f, 168.0f / 255.0f, 1 },
{155.0/255.0, 79.0/255.0, 150.0/255.0, 0}, { 155.0f / 255.0f, 79.0f / 255.0f, 150.0f / 255.0f, 1 },
{214.0/255.0, 2.0/255.0, 112.0/255.0, 0} { 214.0f / 255.0f, 2.0f / 255.0f, 112.0f / 255.0f, 1 } },
},
{ //lesbian { // lesbian
{255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 },
{213.0/255.0, 45.0/255.0, 0.0/255.0, 0}, { 213.0f / 255.0f, 45.0f / 255.0f, 0.0f / 255.0f, 1 },
{255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 },
{163.0/255.0, 2.0/255.0, 98.0/255.0, 0} { 163.0f / 255.0f, 2.0f / 255.0f, 98.0f / 255.0f, 1 } },
},
{ //gay { // gay
{7.0/255.0, 141.0/255.0, 112.0/255.0, 0}, { 7.0f / 255.0f, 141.0f / 255.0f, 112.0f / 255.0f, 1 },
{255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 },
{123.0/255.0, 173.0/255.0, 226.0/255.0, 0}, { 123.0f / 255.0f, 173.0f / 255.0f, 226.0f / 255.0f, 1 },
{61.0/255.0, 26.0/255.0, 120.0/255.0, 0} { 61.0f / 255.0f, 26.0f / 255.0f, 120.0f / 255.0f, 1 } },
},
{ //ace { // ace
{0.0/255.0, 0.0/255.0, 0.0/255.0, 0}, { 0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 1 },
{163.0/255.0, 163.0/255.0, 163.0/255.0, 0}, { 163.0f / 255.0f, 163.0f / 255.0f, 163.0f / 255.0f, 1 },
{255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 },
{128.0/255.0, 0.0/255.0, 128.0/255.0, 0} { 128.0f / 255.0f, 0.0f / 255.0f, 128.0f / 255.0f, 1 } },
},
{ //br { // br
{0.0/255.0, 151.0/255.0, 57.0/255.0, 0}, { 0.0f / 255.0f, 151.0f / 255.0f, 57.0f / 255.0f, 1 },
{254.0/255.0, 221.0/255.0, 0.0/255.0, 0}, { 254.0f / 255.0f, 221.0f / 255.0f, 0.0f / 255.0f, 1 },
{255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 },
{1.0/255.0, 33.0/255.0, 105.0/255.0, 0} { 1.0f / 255.0f, 33.0f / 255.0f, 105.0f / 255.0f, 1 } },
},
{ //it { // it
{255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 },
{0.0/255.0, 140.0/255.0, 69.0/255.0, 0}, { 0.0f / 255.0f, 140.0f / 255.0f, 69.0f / 255.0f, 1 },
{255.0/255.0, 255.0/255.0, 255.0/255.0, 0}, { 255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f, 1 },
{205.0/255.0, 33.0/255.0, 42.0/255.0, 0} { 205.0f / 255.0f, 33.0f / 255.0f, 42.0f / 255.0f, 1 } }
}
}; };

View File

@@ -71,7 +71,7 @@ const std::vector<Dialog> dialogs = { { // 0
{ "Our way. Our history.", -3, -1 }, { "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) { COND_ID_HOOK(OnActorInit, ACTOR_BOSS_GANON, CVarGetInteger(CVAR("GanonDatingSim"), 0), [](void* actorRef) {
dialogIndex = 0; dialogIndex = 0;
affection = 0; affection = 0;
@@ -121,18 +121,15 @@ static void ConfigurationChanged() {
}); });
} }
static void DrawMenu() { static void RegisterMenu() {
//ImGui::SeparatorText(AUTHOR); WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 };
//if (UIWidgets::EnhancementCheckbox("Ganon Dating Sim", CVAR("GanonDatingSim"))) { SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2);
// ConfigurationChanged();
//} SohGui::mSohMenu->AddWidget(path, "Ganon Dating Sim", WIDGET_CVAR_CHECKBOX)
//UIWidgets::Tooltip("Prior to fighting him at the top of his Castle, you make an attempt to convince Ganon to join you instead."); .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() { static RegisterShipInitFunc initFunc(OnConfigurationChanged);
// #region Leave this alone unless you know what you are doing static RegisterMenuInitFunc menuInitFunc(RegisterMenu);
ConfigurationChanged();
// #endregion
}
static Holiday holiday(DrawMenu, RegisterMod);

View File

@@ -113,49 +113,45 @@ void SpawnShinyReward(Actor* actor) {
} }
void RegisterShiny() { void RegisterShiny() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorInit>([](void* refActor) { COND_HOOK(OnActorInit, CVarGetInteger(CVAR("Shiny.Enabled"), 0), [](void* refActor) {
Actor* actor = static_cast<Actor*>(refActor); Actor* actor = static_cast<Actor*>(refActor);
if (CVarGetInteger(CVAR("Shiny.Enabled"), 0) && CanBeShiny(actor) && if (CanBeShiny(actor) && Rand_ZeroOne() < (1.0f / (s32)CVarGetInteger(CVAR("Shiny.Chance"), 8192))) {
Rand_ZeroOne() < (1.0f / (s32)CVarGetInteger(CVAR("Shiny.Chance"), 8192))) {
ApplyShinyness(actor); ApplyShinyness(actor);
} }
}); });
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnEnemyDefeat>([](void* refActor) { COND_HOOK(OnEnemyDefeat, CVarGetInteger(CVAR("Shiny.Enabled"), 0), [](void* refActor) {
Actor* actor = static_cast<Actor*>(refActor); Actor* actor = static_cast<Actor*>(refActor);
if (CVarGetInteger(CVAR("Shiny.Enabled"), 0) && actor->isShiny) { if (actor->isShiny) {
SpawnShinyReward(actor); SpawnShinyReward(actor);
} }
}); });
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorDraw>([](void* refActor) { COND_HOOK(OnActorDraw, CVarGetInteger(CVAR("Shiny.Enabled"), 0), [](void* refActor) {
Actor* actor = static_cast<Actor*>(refActor); Actor* actor = static_cast<Actor*>(refActor);
if (CVarGetInteger(CVAR("Shiny.Enabled"), 0) && actor->isShiny) { if (actor->isShiny) {
RenderShines(actor); 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 #pragma endregion
static void DrawMenu() { static void RegisterMenu() {
ImGui::SeparatorText(AUTHOR); WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 };
ShinyDrawImGui(); 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() { static RegisterShipInitFunc initFunc(RegisterShiny);
RegisterShiny(); static RegisterMenuInitFunc menuInitFunc(RegisterMenu);
}
static Holiday holiday(DrawMenu, RegisterMod);

View File

@@ -105,23 +105,25 @@ static void SpawnIcebergs() {
} }
const s16 entrances[] = { const s16 entrances[] = {
0x0000, 0x0209, 0x0004, 0x0242, 0x0028, 0x0221, 0x0169, 0x0215, 0x0165, 0x024A, 0x0010, 0x021D, 0x0082, 0x01E1, 0x0037, 0x0205, 0x0000, 0x0209, 0x0004, 0x0242, 0x0028, 0x0221, 0x0169, 0x0215, 0x0165, 0x024A, 0x0010, 0x021D, 0x0082, 0x01E1,
0x0098, 0x02A6, 0x0088, 0x03D4, 0x0008, 0x03A8, 0x0467, 0x023D, 0x0433, 0x0443, 0x0437, 0x0447, 0x009C, 0x033C, 0x00C9, 0x026A, 0x0037, 0x0205, 0x0098, 0x02A6, 0x0088, 0x03D4, 0x0008, 0x03A8, 0x0467, 0x023D, 0x0433, 0x0443, 0x0437, 0x0447,
0x00C1, 0x0266, 0x0043, 0x03CC, 0x045F, 0x0309, 0x03A0, 0x03D0, 0x007E, 0x026E, 0x0530, 0x01D1, 0x0507, 0x03BC, 0x0388, 0x02A2, 0x009C, 0x033C, 0x00C9, 0x026A, 0x00C1, 0x0266, 0x0043, 0x03CC, 0x045F, 0x0309, 0x03A0, 0x03D0, 0x007E, 0x026E,
0x0063, 0x01D5, 0x0528, 0x03C0, 0x043B, 0x0067, 0x02FD, 0x0349, 0x0550, 0x04EE, 0x039C, 0x0345, 0x05C8, 0x05DC, 0x0072, 0x034D, 0x0530, 0x01D1, 0x0507, 0x03BC, 0x0388, 0x02A2, 0x0063, 0x01D5, 0x0528, 0x03C0, 0x043B, 0x0067, 0x02FD, 0x0349,
0x030D, 0x0355, 0x037C, 0x03FC, 0x0380, 0x03C4, 0x004F, 0x0378, 0x02F9, 0x042F, 0x05D0, 0x05D4, 0x052C, 0x03B8, 0x016D, 0x01CD, 0x0550, 0x04EE, 0x039C, 0x0345, 0x05C8, 0x05DC, 0x0072, 0x034D, 0x030D, 0x0355, 0x037C, 0x03FC, 0x0380, 0x03C4,
0x00B7, 0x0201, 0x003B, 0x0463, 0x0588, 0x057C, 0x0578, 0x0340, 0x04C2, 0x03E8, 0x04BE, 0x0482, 0x0315, 0x045B, 0x0371, 0x0394, 0x004F, 0x0378, 0x02F9, 0x042F, 0x05D0, 0x05D4, 0x052C, 0x03B8, 0x016D, 0x01CD, 0x00B7, 0x0201, 0x003B, 0x0463,
0x0272, 0x0211, 0x0053, 0x0472, 0x0453, 0x0351, 0x0384, 0x044B, 0x03EC, 0x04FF, 0x0700, 0x0800, 0x0701, 0x0801, 0x0702, 0x0802, 0x0588, 0x057C, 0x0578, 0x0340, 0x04C2, 0x03E8, 0x04BE, 0x0482, 0x0315, 0x045B, 0x0371, 0x0394, 0x0272, 0x0211,
0x0703, 0x0803, 0x0704, 0x0804, 0x0705, 0x0805, 0x0706, 0x0806, 0x0707, 0x0807, 0x0708, 0x0808, 0x0709, 0x0809, 0x070A, 0x080A, 0x0053, 0x0472, 0x0453, 0x0351, 0x0384, 0x044B, 0x03EC, 0x04FF, 0x0700, 0x0800, 0x0701, 0x0801, 0x0702, 0x0802,
0x070B, 0x080B, 0x070C, 0x080C, 0x070D, 0x080D, 0x070E, 0x080E, 0x070F, 0x080F, 0x0710, 0x0711, 0x0811, 0x0712, 0x0812, 0x0703, 0x0803, 0x0704, 0x0804, 0x0705, 0x0805, 0x0706, 0x0806, 0x0707, 0x0807, 0x0708, 0x0808, 0x0709, 0x0809,
0x0713, 0x0813, 0x0714, 0x0814, 0x0715, 0x0815, 0x0716, 0x0816, 0x0717, 0x0817, 0x0718, 0x0818, 0x0719, 0x0819, 0x081A, 0x070A, 0x080A, 0x070B, 0x080B, 0x070C, 0x080C, 0x070D, 0x080D, 0x070E, 0x080E, 0x070F, 0x080F, 0x0710, 0x0711,
0x071B, 0x081B, 0x071C, 0x081C, 0x071D, 0x081D, 0x071E, 0x081E, 0x071F, 0x081F, 0x0720, 0x0820, 0x004B, 0x035D, 0x031C, 0x0361, 0x0811, 0x0712, 0x0812, 0x0713, 0x0813, 0x0714, 0x0814, 0x0715, 0x0815, 0x0716, 0x0816, 0x0717, 0x0817, 0x0718,
0x002D, 0x050B, 0x044F, 0x0359, 0x05E0, 0x020D, 0x011E, 0x0286, 0x04E2, 0x04D6, 0x01DD, 0x04DA, 0x00FC, 0x01A9, 0x0185, 0x04DE, 0x0818, 0x0719, 0x0819, 0x081A, 0x071B, 0x081B, 0x071C, 0x081C, 0x071D, 0x081D, 0x071E, 0x081E, 0x071F, 0x081F,
0x0102, 0x0189, 0x0117, 0x018D, 0x0276, 0x01FD, 0x00DB, 0x017D, 0x00EA, 0x0181, 0x0157, 0x01F9, 0x0328, 0x0560, 0x0129, 0x022D, 0x0720, 0x0820, 0x004B, 0x035D, 0x031C, 0x0361, 0x002D, 0x050B, 0x044F, 0x0359, 0x05E0, 0x020D, 0x011E, 0x0286,
0x0130, 0x03AC, 0x0123, 0x0365, 0x00B1, 0x0033, 0x0138, 0x025A, 0x0171, 0x025E, 0x00E4, 0x0195, 0x013D, 0x0191, 0x014D, 0x01B9, 0x04E2, 0x04D6, 0x01DD, 0x04DA, 0x00FC, 0x01A9, 0x0185, 0x04DE, 0x0102, 0x0189, 0x0117, 0x018D, 0x0276, 0x01FD,
0x0246, 0x01C1, 0x0147, 0x01BD, 0x0108, 0x019D, 0x0225, 0x01A1, 0x0219, 0x027E, 0x0554, 0x00BB, 0x0282, 0x0600, 0x04F6, 0x0604, 0x00DB, 0x017D, 0x00EA, 0x0181, 0x0157, 0x01F9, 0x0328, 0x0560, 0x0129, 0x022D, 0x0130, 0x03AC, 0x0123, 0x0365,
0x01F1, 0x0568, 0x05F4, 0x040F, 0x0252, 0x040B, 0x00C5, 0x0301, 0x0407, 0x000C, 0x024E, 0x0305, 0x0175, 0x0417, 0x0423, 0x008D, 0x00B1, 0x0033, 0x0138, 0x025A, 0x0171, 0x025E, 0x00E4, 0x0195, 0x013D, 0x0191, 0x014D, 0x01B9, 0x0246, 0x01C1,
0x02F5, 0x0413, 0x02B2, 0x0457, 0x047A, 0x010E, 0x0608, 0x0564, 0x060C, 0x0610, 0x0580 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) { static void RandomGrotto_WaitOpen(DoorAna* doorAna, PlayState* play) {
@@ -146,11 +148,9 @@ static void RandomGrotto_WaitOpen(DoorAna* doorAna, PlayState* play) {
} }
static void SpawnRandomGrotto() { static void SpawnRandomGrotto() {
if ( if (gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_DAY ||
gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_DAY || gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_NIGHT ||
gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_NIGHT || gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_RUINS) {
gPlayState->sceneNum == SCENE_TEMPLE_OF_TIME_EXTERIOR_RUINS
) {
return; return;
} }
@@ -182,7 +182,7 @@ static void SpawnRandomGrotto() {
} }
} }
static void ConfigurationChanged() { static void OnConfigurationChanged() {
COND_HOOK(OnSceneSpawnActors, CVarGetInteger(CVAR("Snowballs"), 0), SpawnSnowballs); COND_HOOK(OnSceneSpawnActors, CVarGetInteger(CVAR("Snowballs"), 0), SpawnSnowballs);
COND_HOOK(OnPlayerUpdate, CVarGetInteger(CVAR("SuperBonk"), 0), []() { COND_HOOK(OnPlayerUpdate, CVarGetInteger(CVAR("SuperBonk"), 0), []() {
Player* player = GET_PLAYER(gPlayState); Player* player = GET_PLAYER(gPlayState);
@@ -201,30 +201,26 @@ static void ConfigurationChanged() {
COND_HOOK(OnSceneSpawnActors, CVarGetInteger(CVAR("DownTheRabbitHole"), 0), SpawnRandomGrotto); COND_HOOK(OnSceneSpawnActors, CVarGetInteger(CVAR("DownTheRabbitHole"), 0), SpawnRandomGrotto);
} }
static void DrawMenu() { static void RegisterMenu() {
//ImGui::SeparatorText(AUTHOR); WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 };
SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2);
//if (UIWidgets::EnhancementCheckbox("Snowballs", CVAR("Snowballs"))) { SohGui::mSohMenu->AddWidget(path, "Snowballs", WIDGET_CVAR_CHECKBOX)
// ConfigurationChanged(); .CVar(CVAR("Snowballs"))
//} .Options(
//UIWidgets::Tooltip("Rogue snowballs will spawn in Hyrule Field and Kakariko Village."); UIWidgets::CheckboxOptions().Tooltip("Rogue snowballs will spawn in Hyrule Field and Kakariko Village."));
//if (UIWidgets::EnhancementCheckbox("Lake Hylia Icebergs", CVAR("Icebergs"))) {
// ConfigurationChanged(); SohGui::mSohMenu->AddWidget(path, "Lake Hylia Icebergs", WIDGET_CVAR_CHECKBOX)
//} .CVar(CVAR("Icebergs"))
//UIWidgets::Tooltip("Icebergs will spawn in Lake Hylia."); .Options(UIWidgets::CheckboxOptions().Tooltip("Icebergs will spawn in Lake Hylia."));
//if (UIWidgets::EnhancementCheckbox("Down the Rabbit Hole", CVAR("DownTheRabbitHole"))) {
// ConfigurationChanged(); SohGui::mSohMenu->AddWidget(path, "Down the Rabbit Hole", WIDGET_CVAR_CHECKBOX)
//} .CVar(CVAR("DownTheRabbitHole"))
//UIWidgets::Tooltip("Random grottos will spawn throughout Hyrule. Who knows where they will take you?"); .Options(UIWidgets::CheckboxOptions().Tooltip(
//if (UIWidgets::EnhancementCheckbox("Super Bonk", CVAR("SuperBonk"))) { "Random grottos will spawn throughout Hyrule. Who knows where they will take you?"));
// ConfigurationChanged();
//} SohGui::mSohMenu->AddWidget(path, "Super Bonk", WIDGET_CVAR_CHECKBOX).CVar(CVAR("SuperBonk"));
} }
static void RegisterMod() { static RegisterShipInitFunc initFunc(OnConfigurationChanged);
// #region Leave this alone unless you know what you are doing static RegisterMenuInitFunc menuInitFunc(RegisterMenu);
ConfigurationChanged();
// #endregion
}
static Holiday holiday(DrawMenu, RegisterMod);

View File

@@ -13,7 +13,7 @@ extern "C" {
extern PlayState* gPlayState; extern PlayState* gPlayState;
} }
static void ConfigurationChanged() { static void OnConfigurationChanged() {
COND_ID_HOOK(OnOpenText, 0x406B, IS_RANDO, [](u16* textId, bool* loadFromMessageTable) { COND_ID_HOOK(OnOpenText, 0x406B, IS_RANDO, [](u16* textId, bool* loadFromMessageTable) {
if (gPlayState->sceneNum != SCENE_KAKARIKO_VILLAGE) { if (gPlayState->sceneNum != SCENE_KAKARIKO_VILLAGE) {
return; return;
@@ -35,15 +35,7 @@ static void ConfigurationChanged() {
messageEntry.LoadIntoFont(); messageEntry.LoadIntoFont();
*loadFromMessageTable = false; *loadFromMessageTable = false;
}); });
COND_HOOK(OnLoadGame, true, [](int16_t fileNum) { OnConfigurationChanged(); });
} }
static void RegisterMod() { static RegisterShipInitFunc initFunc(OnConfigurationChanged);
// #region Leave this alone unless you know what you are doing
ConfigurationChanged();
// #endregion
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnLoadGame>(
[](int16_t fileNum) { ConfigurationChanged(); });
}
static Holiday holiday([]() {}, RegisterMod);

View File

@@ -14,7 +14,7 @@ extern PlayState* gPlayState;
uint8_t rocsUseCount = 0; uint8_t rocsUseCount = 0;
static void ConfigurationChanged() { static void OnConfigurationChanged() {
COND_HOOK(OnPlayerUpdate, CVarGetInteger(CVAR("RocsFeather"), 0), []() { COND_HOOK(OnPlayerUpdate, CVarGetInteger(CVAR("RocsFeather"), 0), []() {
Player* player = GET_PLAYER(gPlayState); Player* player = GET_PLAYER(gPlayState);
@@ -58,19 +58,15 @@ static void ConfigurationChanged() {
}); });
} }
static void DrawMenu() { static void RegisterMenu() {
//ImGui::SeparatorText(AUTHOR); WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 };
SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2);
//if (UIWidgets::EnhancementCheckbox("Roc's Feather", CVAR("RocsFeather"))) { SohGui::mSohMenu->AddWidget(path, "Roc's Feather", WIDGET_CVAR_CHECKBOX)
// ConfigurationChanged(); .CVar(CVAR("RocsFeather"))
//} .Options(UIWidgets::CheckboxOptions().Tooltip(
//UIWidgets::Tooltip("Using Nayru's Love will now act as Roc's Feather instead! No magic required."); "Using Nayru's Love will now act as Roc's Feather instead! No magic required."));
} }
static void RegisterMod() { static RegisterShipInitFunc initFunc(OnConfigurationChanged);
// #region Leave this alone unless you know what you are doing static RegisterMenuInitFunc menuInitFunc(RegisterMenu);
ConfigurationChanged();
// #endregion
}
static Holiday holiday(DrawMenu, RegisterMod);

View File

@@ -115,20 +115,13 @@ static void OnConfigurationChanged() {
}); });
} }
static void DrawMenu() { static void RegisterMenu() {
//ImGui::SeparatorText(AUTHOR); WidgetPath path = { "Holiday", AUTHOR, SECTION_COLUMN_1 };
//if (UIWidgets::EnhancementCheckbox("Bomb Arrows", CVAR("BombArrows.Enabled"))) { SohGui::mSohMenu->AddSidebarEntry("Holiday", AUTHOR, SECTION_COLUMN_2);
// OnConfigurationChanged(); SohGui::mSohMenu->AddWidget(path, "Bomb Arrows", WIDGET_CVAR_CHECKBOX)
//} .CVar(CVAR("BombArrows.Enabled"))
//UIWidgets::Tooltip("Equip bombs over an already equipped Bow to shoot bomb arrows"); .Options(UIWidgets::CheckboxOptions().Tooltip("Equip bombs over an already equipped Bow to shoot bomb arrows"));
} }
static void RegisterMod() { static RegisterShipInitFunc initFunc(OnConfigurationChanged);
// #region Leave this alone unless you know what you are doing static RegisterMenuInitFunc menuInitFunc(RegisterMenu);
OnConfigurationChanged();
// #endregion
CVarSetInteger(CVAR("BombArrows.Active"), 0);
}
static Holiday holiday(DrawMenu, RegisterMod);

View File

@@ -137,8 +137,8 @@ static void TimeDisplayGetTimer(uint32_t timeID) {
textureDisplay = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("NAVI_TIMER"); textureDisplay = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("NAVI_TIMER");
break; break;
case DISPLAY_FRED_QUEST: case DISPLAY_FRED_QUEST:
timeDisplayTime = std::to_string(FredsQuestWoodOnHand) + "/" + std::to_string(FredsQuestWoodCollected) + "/" + timeDisplayTime = std::to_string(FredsQuestWoodOnHand) + "/" + std::to_string(FredsQuestWoodCollected) +
std::to_string(CVarGetInteger("gHoliday.Fredomato.FredsQuest.WoodNeeded", 300)); "/" + std::to_string(CVarGetInteger("gHoliday.Fredomato.FredsQuest.WoodNeeded", 300));
textureDisplay = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("ITEM_STICK"); textureDisplay = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("ITEM_STICK");
default: default:
break; break;

View File

@@ -521,7 +521,10 @@ void ResetPositionAll() {
int hue = 0; 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 // 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. // and increase the speed of the rainbow hue rotation.
@@ -534,13 +537,12 @@ void CosmeticsUpdateTick() {
Color_RGBA8 newColor; Color_RGBA8 newColor;
newColor.a = 255; newColor.a = 255;
if (!CVarGetInteger(CVAR_LL("lEnableCustomRainbows"), 0)) { if (!CVarGetInteger(CVAR_LL("lEnableCustomRainbows"), 0)) {
newColor.r = static_cast<uint8_t>(sin(frequency * (hue + index) + 0) * 127) + 128; newColor.r = static_cast<uint8_t>(sin(frequency * (hue + index) + 0) * 127) + 128;
newColor.g = static_cast<uint8_t>(sin(frequency * (hue + index) + (2 * M_PI / 3)) * 127) + 128; newColor.g = static_cast<uint8_t>(sin(frequency * (hue + index) + (2 * M_PI / 3)) * 127) + 128;
newColor.b = static_cast<uint8_t>(sin(frequency * (hue + index) + (4 * M_PI / 3)) * 127) + 128; newColor.b = static_cast<uint8_t>(sin(frequency * (hue + index) + (4 * M_PI / 3)) * 127) + 128;
} } else {
else {
Color_RGBA8 customColorZero = CVarGetColor(CVAR_LL("lCustomRainbow1"), {}); Color_RGBA8 customColorZero = CVarGetColor(CVAR_LL("lCustomRainbow1"), {});
Color_RGBA8 customColorOne = CVarGetColor(CVAR_LL("lCustomRainbow2"), {}); Color_RGBA8 customColorOne = CVarGetColor(CVAR_LL("lCustomRainbow2"), {});
Color_RGBA8 customColorMinusZero = CVarGetColor(CVAR_LL("lCustomRainbow3"), {}); 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 quadrant3 = hue >= (360 * rainbowSpeed) / 2 && hue <= (360 * rainbowSpeed) * 3 / 4;
bool quadrant4 = 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.r = sinangle * (customColorOne.r - customColorZero.r) + customColorZero.r;
newColor.g = sinangle * (customColorOne.g - customColorZero.g) + customColorZero.g; newColor.g = sinangle * (customColorOne.g - customColorZero.g) + customColorZero.g;
newColor.b = sinangle * (customColorOne.b - customColorZero.b) + customColorZero.b; 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.r = sinangle * (customColorOne.r - customColorMinusZero.r) + customColorMinusZero.r;
newColor.g = sinangle * (customColorOne.g - customColorMinusZero.g) + customColorMinusZero.g; newColor.g = sinangle * (customColorOne.g - customColorMinusZero.g) + customColorMinusZero.g;
newColor.b = sinangle * (customColorOne.b - customColorMinusZero.b) + customColorMinusZero.b; 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.r = -sinangle * (customColorMinusOne.r - customColorMinusZero.r) + customColorMinusZero.r;
newColor.g = -sinangle * (customColorMinusOne.g - customColorMinusZero.g) + customColorMinusZero.g; newColor.g = -sinangle * (customColorMinusOne.g - customColorMinusZero.g) + customColorMinusZero.g;
newColor.b = -sinangle * (customColorMinusOne.b - customColorMinusZero.b) + customColorMinusZero.b; 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.r = -sinangle * (customColorMinusOne.r - customColorZero.r) + customColorZero.r;
newColor.g = -sinangle * (customColorMinusOne.g - customColorZero.g) + customColorZero.g; newColor.g = -sinangle * (customColorMinusOne.g - customColorZero.g) + customColorZero.g;
newColor.b = -sinangle * (customColorMinusOne.b - customColorZero.b) + customColorZero.b; newColor.b = -sinangle * (customColorMinusOne.b - customColorZero.b) + customColorZero.b;
} }
} }
// For alpha supported options, retain the last set alpha instead of overwriting // For alpha supported options, retain the last set alpha instead of overwriting
if (cosmeticOption.supportsAlpha) { if (cosmeticOption.supportsAlpha) {
newColor.a = static_cast<uint8_t>(cosmeticOption.currentColor.w * 255.0f); newColor.a = static_cast<uint8_t>(cosmeticOption.currentColor.w * 255.0f);

View File

@@ -658,5 +658,4 @@ void InitMods() {
RegisterPatchHandHandler(); RegisterPatchHandHandler();
RegisterHurtContainerModeHandler(); RegisterHurtContainerModeHandler();
RandoKaleido_RegisterHooks(); RandoKaleido_RegisterHooks();
RegisterHoliday();
} }

View File

@@ -41,7 +41,7 @@ void Anchor::HandlePacket_SetCheckStatus(nlohmann::json payload) {
RandomizerCheck rc = payload["rc"].get<RandomizerCheck>(); RandomizerCheck rc = payload["rc"].get<RandomizerCheck>();
RandomizerCheckStatus status = payload["status"].get<RandomizerCheckStatus>(); RandomizerCheckStatus status = payload["status"].get<RandomizerCheckStatus>();
bool skipped = payload["skipped"].get<bool>(); bool skipped = payload["skipped"].get<bool>();
isResultOfHandling = true; isResultOfHandling = true;
if (randoContext->GetItemLocation(rc)->GetCheckStatus() != status) { if (randoContext->GetItemLocation(rc)->GetCheckStatus() != status) {

View File

@@ -86,6 +86,7 @@ void SohMenu::InitElement() {
AddMenuSettings(); AddMenuSettings();
AddMenuEnhancements(); AddMenuEnhancements();
AddMenuRandomizer(); AddMenuRandomizer();
AddMenuEntry("Holiday", CVAR_SETTING("Menu.HolidaySidebarSection"));
AddMenuNetwork(); AddMenuNetwork();
AddMenuDevTools(); AddMenuDevTools();

View File

@@ -16,8 +16,9 @@
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/Enhancements/Holiday/Archez.h" #include "soh/Enhancements/Holiday/Archez.h"
#define FLAGS \ #define FLAGS \
(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \
ACTOR_FLAG_DRAW_CULLING_DISABLED)
typedef enum { typedef enum {
/* 0 */ THROW_NORMAL, /* 0 */ THROW_NORMAL,

View File

@@ -77,7 +77,8 @@ void EnChristmasTree_Talk(EnChristmasTree* this, PlayState* play) {
if (dialogState != TEXT_STATE_CHOICE) { if (dialogState != TEXT_STATE_CHOICE) {
if ((dialogState == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { // advanced final textbox if ((dialogState == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { // advanced final textbox
// Teleport to credits when goal is reached. // 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.itemTimestamp[TIMESTAMP_TRIFORCE_COMPLETED] = GAMEPLAYSTAT_TOTAL_TIME;
gSaveContext.ship.stats.gameComplete = 1; gSaveContext.ship.stats.gameComplete = 1;
Play_PerformSave(play); Play_PerformSave(play);

View File

@@ -371,8 +371,7 @@ void EnWood02_Update(Actor* thisx, PlayState* play2) {
dropsSpawnPt.y += 200.0f; dropsSpawnPt.y += 200.0f;
if (HandleTreeBonk(&this->actor)) { if (HandleTreeBonk(&this->actor)) {
// no-op // no-op
} else } else if (GameInteractor_Should(VB_TREE_DROP_ITEM, true, this)) {
if (GameInteractor_Should(VB_TREE_DROP_ITEM, true, this)) {
if ((this->unk_14C >= 0) && (this->unk_14C < 0x64)) { if ((this->unk_14C >= 0) && (this->unk_14C < 0x64)) {
if (GameInteractor_Should(VB_TREE_DROP_COLLECTIBLE, true, this)) { if (GameInteractor_Should(VB_TREE_DROP_COLLECTIBLE, true, this)) {
Item_DropCollectibleRandom(play, &this->actor, &dropsSpawnPt, this->unk_14C << 4); 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 &= 0x1FFF;
this->actor.home.rot.z |= 0xE000; this->actor.home.rot.z |= 0xE000;
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, dropsSpawnPt.x, dropsSpawnPt.y, dropsSpawnPt.z, 0, 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; this->actor.home.rot.z = 0;
} }
} }