Bugfix, prevent looping fanfares from softlocking HBA (#6874)

This commit is contained in:
djevangelia
2026-07-12 19:51:26 +02:00
committed by GitHub
parent f6d723b447
commit a44197712c
3 changed files with 41 additions and 2 deletions
+16
View File
@@ -7,6 +7,7 @@ extern "C" {
#include "src/overlays/actors/ovl_En_Go2/z_en_go2.h"
#include "include/z64camera.h"
#include "src/overlays/actors/ovl_En_Test/z_en_test.h"
#include "src/overlays/actors/ovl_En_Horse/z_en_horse.h"
extern void Player_UseItem(PlayState*, Player*, s32);
extern PlayState* gPlayState;
}
@@ -72,6 +73,21 @@ void RegisterAlwaysOnFixes() {
}
});
COND_VB_SHOULD(VB_PREVENT_HBA_FANFARE_SOFTLOCK_TIMER, true, {
EnHorse* enHorse = va_arg(args, EnHorse*);
if (enHorse->hbaFlags & 1) {
*should = true; // hbaFlags 1 = end of tour
}
});
COND_VB_SHOULD(VB_PREVENT_HBA_FANFARE_SOFTLOCK_BUTTONS, true, {
EnHorse* enHorse = va_arg(args, EnHorse*);
if (enHorse->hbaTimer >= 80 &&
CHECK_BTN_ANY(gPlayState->state.input[0].press.button, BTN_A | BTN_B | BTN_START)) {
*should = true;
}
});
COND_ID_HOOK(OnActorDestroy, ACTOR_EN_TEST, true, [](void* refActor) {
Actor* actor = reinterpret_cast<Actor*>(refActor);
if (actor->params != STALFOS_TYPE_2 && !EnTest_HasLivingNearby(actor)) {
@@ -3293,6 +3293,26 @@ typedef enum {
// - `*EnGo2` (Goron Link)
VB_PREVENT_GORON_LINK_SOFTLOCK,
// #### `result`
// ```c
// play->interfaceCtx.hbaAmmo == 0
// ```
// Prevent custom fanfares set to loop from softlocking Horseback Archery by
// letting players escape the cutscene with A/B/start after a normal number of playframes.
// #### `args`
// - none
VB_PREVENT_HBA_FANFARE_SOFTLOCK_TIMER,
// #### `result`
// ```c
// (isFanfarePlaying != 1 && gSaveContext.minigameState != 3)
// ```
// Prevent custom fanfares set to loop from softlocking Horseback Archery by
// letting players escape the cutscene with A/B/start after a normal number of playframes.
// #### `args`
// - `EnHorse*`
VB_PREVENT_HBA_FANFARE_SOFTLOCK_BUTTONS,
// #### `result`
// ```c
// sets `camMode` to new mode if applicable
@@ -2519,14 +2519,17 @@ void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play) {
if (this->animationIdx == ENHORSE_ANIM_WALK) {
EnHorse_PlayWalkingSfx(this);
}
if (play->interfaceCtx.hbaAmmo == 0) {
if (GameInteractor_Should(VB_PREVENT_HBA_FANFARE_SOFTLOCK_TIMER, play->interfaceCtx.hbaAmmo == 0, this)) {
this->hbaTimer++;
}
isFanfarePlaying = Audio_IsSequencePlaying(NA_BGM_HORSE_GOAL);
EnHorse_UpdateHbaRaceInfo(this, play, &sHbaInfo);
if (this->hbaFlags & 1 || this->hbaTimer >= 46) {
if (isFanfarePlaying != 1 && gSaveContext.minigameState != 3) {
if (GameInteractor_Should(VB_PREVENT_HBA_FANFARE_SOFTLOCK_BUTTONS,
(isFanfarePlaying != 1 && gSaveContext.minigameState != 3), this)) {
gSaveContext.cutsceneIndex = 0;
play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_16;
play->transitionTrigger = TRANS_TRIGGER_START;