mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-07-31 12:00:25 -07:00
Fix freezard graphics crash with enemy health scaling (#5232)
This commit is contained in:
parent
32923d83f2
commit
b66623c152
1 changed files with 9 additions and 0 deletions
|
@ -720,6 +720,15 @@ void EnFz_Draw(Actor* thisx, PlayState* play) {
|
||||||
|
|
||||||
index = (6 - this->actor.colChkInfo.health) >> 1;
|
index = (6 - this->actor.colChkInfo.health) >> 1;
|
||||||
|
|
||||||
|
// SOH [Enhancement] - With enemy health scaling, the Freezards health could cause an index out of bounds for the
|
||||||
|
// displayLists, so we need to recompute the index based on the scaled health (using the maximum health value) and
|
||||||
|
// clamp the final result for safety.
|
||||||
|
if (CVarGetInteger(CVAR_ENHANCEMENT("EnemySizeScalesHealth"), 0)) {
|
||||||
|
u8 scaledHealth = (u8)(((f32)this->actor.colChkInfo.health / this->actor.maximumHealth) * 6);
|
||||||
|
index = (6 - scaledHealth) >> 1;
|
||||||
|
index = CLAMP(index, 0, 2);
|
||||||
|
}
|
||||||
|
|
||||||
OPEN_DISPS(play->state.gfxCtx);
|
OPEN_DISPS(play->state.gfxCtx);
|
||||||
|
|
||||||
if (this->actor.colChkInfo.health == 0) {
|
if (this->actor.colChkInfo.health == 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue