diff --git a/soh/src/code/z_scene.c b/soh/src/code/z_scene.c index 207a7b7d0..2ce88cc04 100644 --- a/soh/src/code/z_scene.c +++ b/soh/src/code/z_scene.c @@ -33,6 +33,10 @@ s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId) { return objectCtx->num - 1; } + +// SOH [Port] Track when objects are first loaded for a scene +static u8 sObjectFirstUpdateSkippedForScene = false; + void Object_InitBank(PlayState* play, ObjectContext* objectCtx) { PlayState* play2 = play; // Needs to be a new variable to match (possibly a sub struct?) size_t spaceSize; @@ -75,6 +79,8 @@ void Object_InitBank(PlayState* play, ObjectContext* objectCtx) { objectCtx->mainKeepIndex = Object_Spawn(objectCtx, OBJECT_GAMEPLAY_KEEP); gSegments[4] = VIRTUAL_TO_PHYSICAL(objectCtx->status[objectCtx->mainKeepIndex].segment); + + sObjectFirstUpdateSkippedForScene = false; } void Object_UpdateBank(ObjectContext* objectCtx) { @@ -83,6 +89,12 @@ void Object_UpdateBank(ObjectContext* objectCtx) { RomFile* objectFile; size_t size; + // SOH [Port] Skip the first object load after scene init so that actors have their init delayed by one frame + // This seems to mostly if not nearly resolve actors that depend on console DMA requests ending later + if (!sObjectFirstUpdateSkippedForScene) { + sObjectFirstUpdateSkippedForScene = true; + return; + } for (i = 0; i < objectCtx->num; i++) { if (status->id < 0) { diff --git a/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c b/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c index a0cc83cb6..85ebef2d0 100644 --- a/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c +++ b/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c @@ -102,9 +102,6 @@ void EnDntJiji_Destroy(Actor* thisx, PlayState* play) { } void EnDntJiji_SetFlower(EnDntJiji* this, PlayState* play) { - // SOH: Due to removed object dependencies, parent was still NULL when Init was called. In order to properly set - // stage, redo it here now that we are a frame later. - this->stage = (EnDntDemo*)this->actor.parent; if (this->actor.bgCheckFlags & 1) { this->flowerPos = this->actor.world.pos; this->actionFunc = EnDntJiji_SetupWait; diff --git a/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c index 93dd9c9d3..c0bc087bd 100644 --- a/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -215,16 +215,6 @@ 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; @@ -316,14 +306,6 @@ 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) {