Skip to content

Commit ecd0491

Browse files
committed
Fix health value of exactly -25 being able to crash the game.
1 parent 20f6d3b commit ecd0491

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Source/Entities/Actor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1394,7 +1394,7 @@ void Actor::DrawHUD(BITMAP* pTargetBitmap, const Vector& targetPos, int whichScr
13941394
// Now draw the Icon if we can
13951395
if (!apIconBitmaps.empty() && m_pTeamIcon && m_pTeamIcon->GetFrameCount() > 0) {
13961396
// Make team icon blink faster as the health goes down
1397-
int f = m_HeartBeat.AlternateReal(200 + 800 * (m_Health / 100)) ? 0 : 1;
1397+
int f = m_HeartBeat.AlternateReal(200 + 800 * (MAX(m_Health, 0) / 100)) ? 0 : 1;
13981398
f = MIN(f, m_pTeamIcon ? m_pTeamIcon->GetFrameCount() - 1 : 1);
13991399
masked_blit(apIconBitmaps.at(f), pTargetBitmap, 0, 0, drawPos.m_X - apIconBitmaps.at(f)->w - 2, drawPos.m_Y + m_HUDStack - (apIconBitmaps.at(f)->h / 2) + 8, apIconBitmaps.at(f)->w, apIconBitmaps.at(f)->h);
14001400
}

0 commit comments

Comments
 (0)