Skip to content

Commit

Permalink
Add CuccoShackCuccoCount (#817)
Browse files Browse the repository at this point in the history
* Add CuccoShackCuccoCount

* Update mm/2s2h/Enhancements/Minigames/CuccoShackCuccoCount.cpp
  • Loading branch information
garrettjoecox authored Nov 26, 2024
1 parent af0ea33 commit 329fb15
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mm/2s2h/BenGui/SearchableMenuItems.h
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,11 @@ void AddEnhancements() {
"-Rupee: Get the rupee reward",
WIDGET_CVAR_COMBOBOX,
{ .comboBoxOptions = cremiaRewardOptions } },
{ "Cucco Shack Cucco Count",
"gEnhancements.Minigames.CuccoShackCuccoCount",
"Choose how many cuccos you need to raise to make Grog happy.",
WIDGET_CVAR_SLIDER_INT,
{ 1, 10, 10 } },
{ "Swordsman School Winning Score",
"gEnhancements.Minigames.SwordsmanSchoolScore",
"Sets the score required to win the Swordsman School.",
Expand Down
1 change: 1 addition & 0 deletions mm/2s2h/Enhancements/Enhancements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ void InitEnhancements() {
// Minigames
RegisterAlwaysWinDoggyRace();
RegisterCremiaHugs();
RegisterCuccoShackCuccoCount();
RegisterSwordsmanSchool();

// Player
Expand Down
33 changes: 33 additions & 0 deletions mm/2s2h/Enhancements/Minigames/CuccoShackCuccoCount.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <libultraship/bridge.h>
#include "2s2h/GameInteractor/GameInteractor.h"

extern "C" {
#include "overlays/actors/ovl_En_Hs/z_en_hs.h"
#include "overlays/actors/ovl_En_Nwc/z_en_nwc.h"

void func_8095345C(EnHs* enHs, PlayState* play);
}

void RegisterCuccoShackCuccoCount() {
GameInteractor::Instance->RegisterGameHookForID<GameInteractor::ShouldActorUpdate>(
ACTOR_EN_HS, [](Actor* actor, bool* should) {
EnHs* enHs = (EnHs*)actor;

if (enHs->actionFunc != func_8095345C ||
CVarGetInteger("gEnhancements.Minigames.CuccoShackCuccoCount", 10) == 10) {
return;
}

// As soon as enough have grown up, set the count to the max
if (enHs->actor.home.rot.x >= (CVarGetInteger("gEnhancements.Minigames.CuccoShackCuccoCount", 10) * 2) &&
enHs->actor.home.rot.x != 20) {
enHs->actor.home.rot.x = 20;
}

// As soon as enough are following the player, set the count to the max
if (enHs->actor.home.rot.z >= (CVarGetInteger("gEnhancements.Minigames.CuccoShackCuccoCount", 10) * 2) &&
enHs->actor.home.rot.z != 20) {
enHs->actor.home.rot.z = 20;
}
});
}
1 change: 1 addition & 0 deletions mm/2s2h/Enhancements/Minigames/Minigames.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

void RegisterAlwaysWinDoggyRace();
void RegisterCremiaHugs();
void RegisterCuccoShackCuccoCount();
void RegisterSwordsmanSchool();

#endif // MINIGAMES_H

0 comments on commit 329fb15

Please sign in to comment.