diff options
| author | Eblo <7004497+Eblo@users.noreply.github.com> | 2025-10-15 12:38:56 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-15 12:38:56 -0400 |
| commit | f2ae53313b2ca4046743d0d6befa09a325129888 (patch) | |
| tree | 277a0c46cabfca9a8d37e9c38adfa51984267fc5 | |
| parent | 894670b9008381ca4ea366736e6243bcdb3dad94 (diff) | |
Use Item_Give in Rosa Sisters skip (#1265)
Change Rosa Sisters skip to Misc. Interaction
| -rw-r--r-- | mm/2s2h/Enhancements/Cutscenes/MiscInteractions/SkipRosaSistersDance.cpp | 64 | ||||
| -rw-r--r-- | mm/2s2h/Enhancements/Cutscenes/StoryCutscenes/SkipRosaSistersDance.cpp | 66 |
2 files changed, 64 insertions, 66 deletions
diff --git a/mm/2s2h/Enhancements/Cutscenes/MiscInteractions/SkipRosaSistersDance.cpp b/mm/2s2h/Enhancements/Cutscenes/MiscInteractions/SkipRosaSistersDance.cpp new file mode 100644 index 000000000..898e68c9a --- /dev/null +++ b/mm/2s2h/Enhancements/Cutscenes/MiscInteractions/SkipRosaSistersDance.cpp @@ -0,0 +1,64 @@ +#include "public/bridge/consolevariablebridge.h" +#include "2s2h/GameInteractor/GameInteractor.h" +#include "2s2h/CustomMessage/CustomMessage.h" +#include "2s2h/CustomItem/CustomItem.h" +#include "2s2h/Rando/Rando.h" +#include "2s2h/ShipInit.hpp" + +extern "C" { +#include "overlays/actors/ovl_En_Rz/z_en_rz.h" +void func_80BFC270(EnRz* enRz, PlayState* play); +void Player_StartTalking(PlayState* play, Actor* actor); +} + +#define CVAR_NAME "gEnhancements.Cutscenes.SkipMiscInteractions" +#define CVAR CVarGetInteger(CVAR_NAME, 0) + +void RegisterSkipRosaSistersDance() { + COND_VB_SHOULD(VB_START_CUTSCENE, CVAR, { + s16* csId = va_arg(args, s16*); + if (gPlayState->sceneId == SCENE_ICHIBA) { // West Clock Town + if (*csId == 11) { // Link teaches the dance + Actor* actor = va_arg(args, Actor*); + EnRz* enRz = (EnRz*)actor; + // The function for yielding the Heart Piece and changing other state information + enRz->actionFunc = func_80BFC270; + // Queue the item check, as Actor_OfferGetItem won't work normally + // WEEKEVENTREG_RECEIVED_ROSA_SISTERS_HEART_PIECE is set once the player obtains this Heart Piece. + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_ROSA_SISTERS_HEART_PIECE) && !IS_RANDO) { + GameInteractor::Instance->events.emplace_back(GIEventGiveItem{ + .showGetItemCutscene = true, + .param = GID_HEART_PIECE, + .giveItem = [](Actor* actor, PlayState* play) { + if (CUSTOM_ITEM_FLAGS & CustomItem::GIVE_ITEM_CUTSCENE) { + CustomMessage::SetActiveCustomMessage("You received a Piece of Heart!", + { .textboxType = 2 }); + } else { + CustomMessage::StartTextbox("You received a Piece of Heart!\x1C\x02\x10", + { .textboxType = 2 }); + } + Item_Give(gPlayState, ITEM_HEART_PIECE); + } }); + } + Player* player = GET_PLAYER(gPlayState); + actor->parent = &player->actor; + player->talkActor = actor; + player->talkActorDistance = actor->xzDistToPlayer; + player->exchangeItemAction = PLAYER_IA_MINUS1; + Player_StartTalking(gPlayState, actor); + *should = false; + } else if (*csId == 12) { // The sisters applaud Link + Actor* actor = va_arg(args, Actor*); + /* + * The randomizer actor behavior unsets this flag to prevent an extra textbox from appearing when + * this cutscene plays. If we're skipping the cutscene, we have to set it again to prevent the + * dialog from hanging. This does not affect vanilla. + */ + actor->flags |= ACTOR_FLAG_TALK; + *should = false; + } + } + }); +} + +static RegisterShipInitFunc initFunc(RegisterSkipRosaSistersDance, { CVAR_NAME }); diff --git a/mm/2s2h/Enhancements/Cutscenes/StoryCutscenes/SkipRosaSistersDance.cpp b/mm/2s2h/Enhancements/Cutscenes/StoryCutscenes/SkipRosaSistersDance.cpp deleted file mode 100644 index 56c1d73d6..000000000 --- a/mm/2s2h/Enhancements/Cutscenes/StoryCutscenes/SkipRosaSistersDance.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "public/bridge/consolevariablebridge.h" -#include "2s2h/GameInteractor/GameInteractor.h" -#include "2s2h/CustomMessage/CustomMessage.h" -#include "2s2h/CustomItem/CustomItem.h" -#include "2s2h/Rando/Rando.h" -#include "2s2h/ShipInit.hpp" - -extern "C" { -#include "overlays/actors/ovl_En_Rz/z_en_rz.h" -void func_80BFC270(EnRz* enRz, PlayState* play); -void Player_StartTalking(PlayState* play, Actor* actor); -} - -#define CVAR_NAME "gEnhancements.Cutscenes.SkipStoryCutscenes" -#define CVAR CVarGetInteger(CVAR_NAME, 0) - -void RegisterSkipRosaSistersDance() { - COND_VB_SHOULD(VB_START_CUTSCENE, CVAR, { - s16* csId = va_arg(args, s16*); - if (CVarGetInteger("gEnhancements.Cutscenes.SkipStoryCutscenes", 0)) { - // West Clock Town - if (gPlayState->sceneId == SCENE_ICHIBA) { - if (*csId == 11) { // Link teaches the dance - Actor* actor = va_arg(args, Actor*); - EnRz* enRz = (EnRz*)actor; - // The function for yielding the Heart Piece and changing other state information - enRz->actionFunc = func_80BFC270; - // Queue the item check, as Actor_OfferGetItem won't work normally - // WEEKEVENTREG_RECEIVED_ROSA_SISTERS_HEART_PIECE is set once player completes this notebook entry. - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_ROSA_SISTERS_HEART_PIECE) && !IS_RANDO) { - GameInteractor::Instance->events.emplace_back(GIEventGiveItem{ - .showGetItemCutscene = true, - .param = GID_HEART_PIECE, - .giveItem = [](Actor* actor, PlayState* play) { - if (CUSTOM_ITEM_FLAGS & CustomItem::GIVE_ITEM_CUTSCENE) { - CustomMessage::SetActiveCustomMessage("You received a Piece of Heart!", - { .textboxType = 2 }); - } else { - CustomMessage::StartTextbox("You received a Piece of Heart!\x1C\x02\x10", - { .textboxType = 2 }); - } - } }); - } - Player* player = GET_PLAYER(gPlayState); - actor->parent = &player->actor; - player->talkActor = actor; - player->talkActorDistance = actor->xzDistToPlayer; - player->exchangeItemAction = PLAYER_IA_MINUS1; - Player_StartTalking(gPlayState, actor); - *should = false; - } else if (*csId == 12) { // The sisters applaud Link - Actor* actor = va_arg(args, Actor*); - /* - * The randomizer actor behavior unsets this flag to prevent an extra textbox from appearing when - * this cutscene plays. If we're skipping the cutscene, we have to set it again to prevent the - * dialog from hanging. This does not affect vanilla. - */ - actor->flags |= ACTOR_FLAG_TALK; - *should = false; - } - } - } - }); -} - -static RegisterShipInitFunc initFunc(RegisterSkipRosaSistersDance, { CVAR_NAME }); |
