Fix: Kak GS placement on construction site (#2695)

This commit is contained in:
Adam Bird 2023-04-11 18:54:37 -04:00 committed by briaguya
parent ac506c8b3e
commit 40b6dae261

View File

@ -213,6 +213,16 @@ s32 func_80B0C0CC(EnSw* this, PlayState* play, s32 arg2) {
return sp64;
}
// Presumably, due to the removal of object dependency, there is a race condition where
// the GS on the Kak construction site spawns to early and fails to detect the
// construction site dyna poly. This custom action func rechecks moving the GS
// to the nearest poly one frame after init. Further explanation available:
// https://github.com/HarbourMasters/Shipwright/issues/2310#issuecomment-1492829517
void EnSw_MoveGoldLater(EnSw* this, PlayState* play) {
func_80B0C0CC(this, play, 1);
this->actionFunc = func_80B0D590;
}
void EnSw_Init(Actor* thisx, PlayState* play) {
EnSw* this = (EnSw*)thisx;
s32 phi_v0;
@ -304,6 +314,14 @@ void EnSw_Init(Actor* thisx, PlayState* play) {
} else {
this->actionFunc = func_80B0D590;
}
// If a normal GS failed to get attached to a poly during init
// try once more on the next frame via a custom action func
if ((((thisx->params & 0xE000) >> 0xD) == 1 ||
((thisx->params & 0xE000) >> 0xD) == 2) &&
this->actor.floorPoly == NULL) {
this->actionFunc = EnSw_MoveGoldLater;
}
}
void EnSw_Destroy(Actor* thisx, PlayState* play) {