mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-16 07:10:34 -05:00
Fix enemy healthbar crashing on Linux (#3092)
This commit is contained in:
parent
861003a093
commit
04bef2d600
@ -3643,7 +3643,8 @@ void Interface_DrawMagicBar(PlayState* play) {
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
static Vtx sEnemyHealthVtx[12];
|
||||
static Vtx sEnemyHealthVtx[16];
|
||||
static Mtx sEnemyHealthMtx[2];
|
||||
|
||||
// Build vertex coordinates for a quad command
|
||||
// In order of top left, top right, bottom left, then bottom right
|
||||
@ -3704,7 +3705,7 @@ void Interface_DrawEnemyHealthBar(TargetContext* targetCtx, PlayState* play) {
|
||||
s16 endTexWidth = 8;
|
||||
f32 scaleY = -0.75f;
|
||||
f32 scaledHeight = -texHeight * scaleY;
|
||||
f32 halfBarWidth = endTexWidth + (healthbar_fillWidth / 2);
|
||||
f32 halfBarWidth = endTexWidth + ((f32)healthbar_fillWidth / 2);
|
||||
s16 healthBarFill = ((f32)actor->colChkInfo.health / actor->maximumHealth) * healthbar_fillWidth;
|
||||
|
||||
if (anchorType == ENEMYHEALTH_ANCHOR_ACTOR) {
|
||||
@ -3729,15 +3730,15 @@ void Interface_DrawEnemyHealthBar(TargetContext* targetCtx, PlayState* play) {
|
||||
}
|
||||
|
||||
// Health bar border end left
|
||||
Interface_CreateQuadVertexGroup(&sEnemyHealthVtx[0], -halfBarWidth, -texHeight / 2, endTexWidth, texHeight, 0);
|
||||
Interface_CreateQuadVertexGroup(&sEnemyHealthVtx[0], -floorf(halfBarWidth), -texHeight / 2, endTexWidth, texHeight, 0);
|
||||
// Health bar border middle
|
||||
Interface_CreateQuadVertexGroup(&sEnemyHealthVtx[4], -halfBarWidth + endTexWidth, -texHeight / 2,
|
||||
Interface_CreateQuadVertexGroup(&sEnemyHealthVtx[4], -floorf(halfBarWidth) + endTexWidth, -texHeight / 2,
|
||||
healthbar_fillWidth, texHeight, 0);
|
||||
// Health bar border end right
|
||||
Interface_CreateQuadVertexGroup(&sEnemyHealthVtx[8], halfBarWidth - endTexWidth, -texHeight / 2, endTexWidth,
|
||||
Interface_CreateQuadVertexGroup(&sEnemyHealthVtx[8], ceilf(halfBarWidth) - endTexWidth, -texHeight / 2, endTexWidth,
|
||||
texHeight, 1);
|
||||
// Health bar fill
|
||||
Interface_CreateQuadVertexGroup(&sEnemyHealthVtx[12], -halfBarWidth + endTexWidth, (-texHeight / 2) + 3,
|
||||
Interface_CreateQuadVertexGroup(&sEnemyHealthVtx[12], -floorf(halfBarWidth) + endTexWidth, (-texHeight / 2) + 3,
|
||||
healthBarFill, 7, 0);
|
||||
|
||||
if (((!(player->stateFlags1 & 0x40)) || (actor != player->unk_664)) && targetCtx->unk_44 < 500.0f) {
|
||||
@ -3757,7 +3758,8 @@ void Interface_DrawEnemyHealthBar(TargetContext* targetCtx, PlayState* play) {
|
||||
|
||||
Matrix_Translate(projTargetCenter.x, projTargetCenter.y - slideInOffsetY, 0, MTXMODE_NEW);
|
||||
Matrix_Scale(1.0f, scaleY, 1.0f, MTXMODE_APPLY);
|
||||
gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
Matrix_ToMtx(&sEnemyHealthMtx[0], __FILE__, __LINE__);
|
||||
gSPMatrix(OVERLAY_DISP++, &sEnemyHealthMtx[0], G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
|
||||
// Health bar border
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
@ -3788,7 +3790,8 @@ void Interface_DrawEnemyHealthBar(TargetContext* targetCtx, PlayState* play) {
|
||||
// Health bar fill
|
||||
Matrix_Push();
|
||||
Matrix_Translate(-0.375f, -0.5f, 0, MTXMODE_APPLY);
|
||||
gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
Matrix_ToMtx(&sEnemyHealthMtx[1], __FILE__, __LINE__);
|
||||
gSPMatrix(OVERLAY_DISP++, &sEnemyHealthMtx[1], G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, PRIMITIVE,
|
||||
|
Loading…
Reference in New Issue
Block a user