-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
245 additions
and
67 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
51 changes: 51 additions & 0 deletions
51
mm/2s2h/Enhancements/Cutscenes/MiscInteractions/SkipOwlInteractions.cpp
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,51 @@ | ||
#include <libultraship/libultraship.h> | ||
#include "2s2h/GameInteractor/GameInteractor.h" | ||
#include "2s2h/ShipInit.hpp" | ||
|
||
extern "C" { | ||
#include "overlays/actors/ovl_En_Owl/z_en_owl.h" | ||
void func_8095AAD0(EnOwl* enOwl, PlayState* play); | ||
void func_8095A920(EnOwl* enOwl, PlayState* play); | ||
void func_8095B9FC(EnOwl* enOwl, PlayState* play); | ||
void func_8095B574(EnOwl* enOwl, PlayState* play); | ||
void func_8095C484(EnOwl* enOwl); | ||
void EnOwl_ChangeMode(EnOwl* enOwl, EnOwlActionFunc actionFunc, EnOwlFunc unkFunc, SkelAnime* skelAnime, | ||
AnimationHeader* animation, f32 morphFrames); | ||
} | ||
|
||
#define CVAR_NAME "gEnhancements.Cutscenes.SkipMiscInteractions" | ||
#define CVAR CVarGetInteger(CVAR_NAME, 0) | ||
|
||
void flyOnApproach(EnOwl* enOwl, PlayState* play) { | ||
func_8095A920(enOwl, play); // Turn to face player | ||
if (enOwl->actor.xzDistToPlayer < 200.0f) { | ||
s32 owlType = ENOWL_GET_TYPE(&enOwl->actor); | ||
if (owlType == ENOWL_GET_TYPE_2) { // Winter Village owl | ||
// Start flying across the invisible platforms | ||
EnOwl_ChangeMode(enOwl, func_8095B9FC, func_8095C484, &enOwl->skelAnimeFlying, | ||
(AnimationHeader*)&gOwlUnfoldWingsAnim, 0.0f); | ||
} else if (owlType == ENOWL_GET_TYPE_3) { // Southern Swamp owl | ||
// Set flag to enable interaction with Song of Soaring engraving | ||
Flags_SetSwitch(gPlayState, ENOWL_GET_SWITCH_FLAG(&enOwl->actor)); | ||
enOwl->actionFunc = func_8095AAD0; // Fly away | ||
} | ||
} | ||
} | ||
|
||
void RegisterSkipOwlInteractions() { | ||
// Quietly change the owl's actionFunc to have it fly away on player proximity | ||
COND_ID_HOOK(OnActorInit, ACTOR_EN_OWL, CVAR, [](Actor* actor) { | ||
EnOwl* enOwl = (EnOwl*)actor; | ||
enOwl->actionFunc = flyOnApproach; | ||
}); | ||
|
||
// Ditto, after the owl has made it across the invisible platforms in the Winter Village | ||
COND_VB_SHOULD(VB_OWL_TELL_ABOUT_SHRINE, CVAR, { | ||
EnOwl* enOwl = va_arg(args, EnOwl*); | ||
EnOwl_ChangeMode(enOwl, flyOnApproach, func_8095C484, &enOwl->skelAnimePerching, | ||
(AnimationHeader*)&gOwlPerchAnim, 0.0f); | ||
*should = false; | ||
}); | ||
} | ||
|
||
static RegisterShipInitFunc initFunc(RegisterSkipOwlInteractions, { 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
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
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