summaryrefslogtreecommitdiff
path: root/soh/src/code
diff options
context:
space:
mode:
authorRozelette <Rozelette@users.noreply.github.com>2025-06-11 16:37:34 -0500
committerGitHub <noreply@github.com>2025-06-11 14:37:34 -0700
commitdbc2ff09b5bfe845055161e28ca6510649aad3ef (patch)
tree8dcb63a073dc56aef41fd98a5609faec05edf806 /soh/src/code
parentabb0a93945b1888f3c2d322d5c9890fb6d19d33d (diff)
Convert actor health bars to use ObjectExtension (#5565)
Diffstat (limited to 'soh/src/code')
-rw-r--r--soh/src/code/z_actor.c10
-rw-r--r--soh/src/code/z_parameter.c3
2 files changed, 2 insertions, 11 deletions
diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c
index 0b9d20bc5..3933f263d 100644
--- a/soh/src/code/z_actor.c
+++ b/soh/src/code/z_actor.c
@@ -1260,11 +1260,6 @@ void Actor_Init(Actor* actor, PlayState* 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;
- }
}
}
@@ -2625,11 +2620,6 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
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)) {
diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c
index cc6245241..0fc923070 100644
--- a/soh/src/code/z_parameter.c
+++ b/soh/src/code/z_parameter.c
@@ -24,6 +24,7 @@
#include "soh/OTRGlobals.h"
#include "soh/ResourceManagerHelpers.h"
#include "soh/Enhancements/gameplaystats.h"
+#include "soh/ObjectExtension/ActorMaximumHealth.h"
#include "message_data_static.h"
extern MessageTableEntry* sNesMessageEntryTablePtr;
@@ -3643,7 +3644,7 @@ void Interface_DrawEnemyHealthBar(TargetContext* targetCtx, PlayState* play) {
f32 scaleY = -0.75f;
f32 scaledHeight = -texHeight * scaleY;
f32 halfBarWidth = endTexWidth + ((f32)healthbar_fillWidth / 2);
- s16 healthBarFill = ((f32)actor->colChkInfo.health / actor->maximumHealth) * healthbar_fillWidth;
+ s16 healthBarFill = ((f32)actor->colChkInfo.health / GetActorMaximumHealth(actor)) * healthbar_fillWidth;
if (anchorType == ENEMYHEALTH_ANCHOR_ACTOR) {
// Get actor projected position