From 31ee15dcc8b50a9a2d32d39262a294754039a54f Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Sun, 20 Oct 2024 01:31:29 -0500 Subject: WIP --- soh/src/code/z_actor.c | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'soh/src/code/z_actor.c') diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index 70c7a3233..9c241898f 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -1231,14 +1231,20 @@ void Actor_Init(Actor* actor, PlayState* play) { ActorShape_Init(&actor->shape, 0.0f, NULL, 0.0f); if (Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { Actor_SetObjectDependency(play, actor); - actor->init(actor, play); - actor->init = NULL; - GameInteractor_ExecuteOnActorInit(actor); + if (GameInteractor_ShouldActorInit(actor)) { + actor->init(actor, play); + actor->init = NULL; - // For enemy health bar we need to know the max health during init - if (actor->category == ACTORCAT_ENEMY) { - actor->maximumHealth = actor->colChkInfo.health; + GameInteractor_ExecuteOnActorInit(actor); + + // For enemy health bar we need to know the max health during init + if (actor->category == ACTORCAT_ENEMY) { + actor->maximumHealth = actor->colChkInfo.health; + } + } else { + actor->init = NULL; + Actor_Kill(actor); } } } @@ -2210,6 +2216,10 @@ void Player_PlaySfx(Actor* actor, u16 sfxId) { // Audio_PlaySoundGeneral(sfxId, &actor->projectedPos, 4, &D_801333E0 , &D_801333E0, &D_801333E8); Audio_PlaySoundGeneral(sfxId, &actor->projectedPos, 4, &freqMultiplier, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } + + if (actor->id == ACTOR_PLAYER) { + GameInteractor_ExecuteOnPlayerSfx(sfxId); + } } void Audio_PlayActorSound2(Actor* actor, u16 sfxId) { @@ -2589,14 +2599,20 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { if (Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { Actor_SetObjectDependency(play, actor); - actor->init(actor, play); - actor->init = NULL; - GameInteractor_ExecuteOnActorInit(actor); + if (GameInteractor_ShouldActorInit(actor)) { + actor->init(actor, play); + actor->init = NULL; + + GameInteractor_ExecuteOnActorInit(actor); - // For enemy health bar we need to know the max health during init - if (actor->category == ACTORCAT_ENEMY) { - actor->maximumHealth = actor->colChkInfo.health; + // For enemy health bar we need to know the max health during init + if (actor->category == ACTORCAT_ENEMY) { + actor->maximumHealth = actor->colChkInfo.health; + } + } else { + actor->init = NULL; + Actor_Kill(actor); } } actor = actor->next; -- cgit v1.2.3