Skip to content

Commit

Permalink
[Minigame] Bombers Required for Hide-and-Seek (#980)
Browse files Browse the repository at this point in the history
* Bombers Required

* Changed to Minigames
  • Loading branch information
Patrick12115 authored Feb 14, 2025
1 parent 4304508 commit eec2be4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mm/2s2h/BenGui/BenMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,13 @@ void BenMenu::AddEnhancements() {
.Min(1)
.Max(30)
.DefaultValue(30));
AddWidget(path, "Bombers Hide-and-Seek Count", WIDGET_CVAR_SLIDER_INT)
.CVar("gEnhancements.Minigames.BombersHideAndSeek")
.Options(IntSliderOptions()
.Tooltip("Sets the number of Bomber Kids you have to find to complete the hide-and-seek game.")
.Min(1)
.Max(5)
.DefaultValue(5));
AddWidget(path, "Beaver Race Rings Collected", WIDGET_CVAR_SLIDER_INT)
.CVar("gEnhancements.Minigames.BeaverRaceRingsCollected")
.Options(IntSliderOptions()
Expand Down
33 changes: 33 additions & 0 deletions mm/2s2h/Enhancements/Timesavers/BombersHideAndSeek.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <libultraship/bridge.h>
#include "2s2h/GameInteractor/GameInteractor.h"
#include "2s2h/ShipInit.hpp"

extern "C" {
#include "overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.h"
void func_80C02CA4(EnBomjimb* thisx, PlayState* play);
void func_80C02A14(EnBomjimb* thisx, PlayState* play);
}

#define CVAR_NAME "gEnhancements.Minigames.BombersHideAndSeek"
#define CVAR CVarGetInteger(CVAR_NAME, 5)

void RegisterBombersHideAndSeek() {
COND_ID_HOOK(ShouldActorUpdate, ACTOR_EN_BOMJIMB, CVAR < 5, [](Actor* actor, bool* should) {
EnBomjimb* bomberKids = (EnBomjimb*)actor;

if (bomberKids->actionFunc != func_80C02A14) {
return;
}

if (gSaveContext.save.saveInfo.bombersCaughtNum >= CVAR) {
SET_WEEKEVENTREG(WEEKEVENTREG_76_01);
SET_WEEKEVENTREG(WEEKEVENTREG_76_02);
SET_WEEKEVENTREG(WEEKEVENTREG_76_04);
SET_WEEKEVENTREG(WEEKEVENTREG_76_08);
SET_WEEKEVENTREG(WEEKEVENTREG_76_10);
func_80C02CA4(bomberKids, gPlayState);
}
});
}

static RegisterShipInitFunc initFunc(RegisterBombersHideAndSeek, { CVAR_NAME });

0 comments on commit eec2be4

Please sign in to comment.