Skip to content

Commit

Permalink
fix actor init flow with object loading (#3987)
Browse files Browse the repository at this point in the history
  • Loading branch information
Archez authored Apr 19, 2024
1 parent ced34ab commit 0b8cc71
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion soh/src/code/z_actor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ void Actor_Init(Actor* actor, PlayState* play) {
actor->floorBgId = BGCHECK_SCENE;
ActorShape_Init(&actor->shape, 0.0f, NULL, 0.0f);
if (Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) {
//Actor_SetObjectDependency(play, actor);
Actor_SetObjectDependency(play, actor);
actor->init(actor, play);
actor->init = NULL;

Expand Down Expand Up @@ -2548,6 +2548,13 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
Actor_SetObjectDependency(play, 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;
}
}
actor = actor->next;
} else if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) {
Expand Down

0 comments on commit 0b8cc71

Please sign in to comment.