Skip to content

Commit 81ff580

Browse files
committed
Fix a softlock when inhaled by Gyorg and dying simultaneously
Fixes a possible softlock when dying while being inhaled by Gyorg. Prior to this fix, the game would softlock because that sequence of actions causes Link to exit the "held (by Gyorg or Majora's whips)" state and eventually enter (and stay in) the frozen state after the fairy revival cutscene.
1 parent 83a5f8f commit 81ff580

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Diff for: source/rst/fixes/boss.cpp

+14-1
Original file line numberDiff line numberDiff line change
@@ -318,15 +318,28 @@ extern "C" RST_HOOK int rst_GetGyorgCollisionResponse(game::act::BossGyorg* gyor
318318
}
319319

320320
void FixGyorg() {
321-
const auto* gctx = GetContext().gctx;
321+
auto* gctx = GetContext().gctx;
322322
auto* gyorg =
323323
gctx->FindActorWithId<game::act::BossGyorg>(game::act::Id::BossGyorg, game::act::Type::Boss);
324324
if (!gyorg)
325325
return;
326+
326327
// Disable the first stun cutscene, which is known to be buggy.
327328
gyorg->field_F24 |= 1;
328329
gyorg->eyeball_flags = 0;
329330
gyorg->eyeball_scale = {0.0, 0.0, 0.0};
331+
332+
// Dying while being inhaled by Gyorg causes Link to exit the "held (by Gyorg or Majora's whips)"
333+
// state. After the fairy revival cutscene, Link enters the Zora swim state (0x21d5b8) and then
334+
// switches to the frozen state (0x20d96c), even though he's supposed to be in the "held" state.
335+
// If this situation is detected, clear the FreezeLink flag.
336+
const auto player = gctx->GetPlayerActor();
337+
const auto gyorg_eating_link = (decltype(gyorg->gyorg_calc))util::GetAddr(0x557900);
338+
const auto link_handle_frozen = (decltype(player->state_handler_fn))util::GetAddr(0x20D96C);
339+
if (gyorg->gyorg_calc == gyorg_eating_link && player->state_handler_fn == link_handle_frozen &&
340+
player->flags1.TestAndClear(game::act::Player::Flag1::FreezeLink)) {
341+
util::Print("%s: clearing FreezeLink flag", __func__);
342+
}
330343
}
331344

332345
struct TwinmoldFixState {

0 commit comments

Comments
 (0)