-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minigame options for Archery & H&D (#923)
- Loading branch information
1 parent
411ed9a
commit 4eae55b
Showing
6 changed files
with
165 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#include <libultraship/bridge.h> | ||
#include "2s2h/GameInteractor/GameInteractor.h" | ||
#include "2s2h/ShipInit.hpp" | ||
|
||
extern "C" { | ||
#include "overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h" | ||
|
||
void EnSyatekiMan_Swamp_RunGame(EnSyatekiMan* enSyatekiMan, PlayState* play); | ||
void EnSyatekiMan_Town_RunGame(EnSyatekiMan* enSyatekiMan, PlayState* play); | ||
} | ||
|
||
#define SWAMP_CVAR_NAME "gEnhancements.Minigames.SwampArcheryScore" | ||
#define SWAMP_CVAR CVarGetInteger(SWAMP_CVAR_NAME, 2180) | ||
#define TOWN_CVAR_NAME "gEnhancements.Minigames.TownArcheryScore" | ||
#define TOWN_CVAR CVarGetInteger(TOWN_CVAR_NAME, 50) | ||
|
||
void RegisterArchery() { | ||
COND_ID_HOOK(ShouldActorUpdate, ACTOR_EN_SYATEKI_MAN, SWAMP_CVAR != 2180, [](Actor* actor, bool* should) { | ||
EnSyatekiMan* enSyatekiMan = (EnSyatekiMan*)actor; | ||
|
||
if (enSyatekiMan->actionFunc == EnSyatekiMan_Swamp_RunGame) { | ||
// This checks if their current score plus the amount of bonus points they would get from the timer is | ||
// greater than or equal to the score required to win | ||
if (enSyatekiMan->score != 0 && | ||
(enSyatekiMan->score + (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] / 10)) >= SWAMP_CVAR) { | ||
enSyatekiMan->score = 2120; | ||
enSyatekiMan->currentWave = 4; | ||
enSyatekiMan->wolfosFlags = 0; | ||
enSyatekiMan->bonusDekuScrubHitCounter = 2; | ||
} | ||
} | ||
}); | ||
|
||
COND_VB_SHOULD(VB_ARCHERY_ADD_BONUS_POINTS, SWAMP_CVAR != 2180, { | ||
Actor* actor = va_arg(args, Actor*); | ||
s32* sBonusTimer = va_arg(args, s32*); | ||
|
||
*sBonusTimer = 11; | ||
*should = true; | ||
}); | ||
|
||
COND_ID_HOOK(ShouldActorUpdate, ACTOR_EN_SYATEKI_MAN, TOWN_CVAR != 50, [](Actor* actor, bool* should) { | ||
EnSyatekiMan* enSyatekiMan = (EnSyatekiMan*)actor; | ||
|
||
if (enSyatekiMan->actionFunc == EnSyatekiMan_Town_RunGame) { | ||
if (enSyatekiMan->score >= TOWN_CVAR) { | ||
enSyatekiMan->score = 50; | ||
gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] = 0; | ||
} | ||
} | ||
}); | ||
} | ||
|
||
static RegisterShipInitFunc initFunc(RegisterArchery, { SWAMP_CVAR_NAME, TOWN_CVAR_NAME }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <libultraship/bridge.h> | ||
#include "2s2h/GameInteractor/GameInteractor.h" | ||
#include "2s2h/ShipInit.hpp" | ||
|
||
extern "C" { | ||
#include "overlays/actors/ovl_En_Fu/z_en_fu.h" | ||
} | ||
|
||
#define DAY1_CVAR_NAME "gEnhancements.Minigames.HoneyAndDarlingDay1" | ||
#define DAY1_CVAR CVarGetInteger(DAY1_CVAR_NAME, 8) | ||
#define DAY2_CVAR_NAME "gEnhancements.Minigames.HoneyAndDarlingDay2" | ||
#define DAY2_CVAR CVarGetInteger(DAY2_CVAR_NAME, 8) | ||
#define DAY3_CVAR_NAME "gEnhancements.Minigames.HoneyAndDarlingDay3" | ||
#define DAY3_CVAR CVarGetInteger(DAY3_CVAR_NAME, 16) | ||
|
||
void RegisterHoneyAndDarling() { | ||
COND_VB_SHOULD(VB_HONEY_AND_DARLING_MINIGAME_FINISH, (DAY1_CVAR != 8 || DAY2_CVAR != 8 || DAY3_CVAR != 16), { | ||
EnFu* enFu = va_arg(args, EnFu*); | ||
if ((CURRENT_DAY == 1 && enFu->unk_548 >= DAY1_CVAR) || (CURRENT_DAY == 2 && enFu->unk_548 >= DAY2_CVAR) || | ||
(CURRENT_DAY == 3 && enFu->unk_548 >= DAY3_CVAR)) { | ||
enFu->unk_548 = enFu->unk_54C; | ||
} | ||
}); | ||
} | ||
|
||
static RegisterShipInitFunc initFunc(RegisterHoneyAndDarling, { DAY1_CVAR_NAME, DAY2_CVAR_NAME, DAY3_CVAR_NAME }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters