From 6fa47cac99ec13e87da1c7e380447db122aa938d Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 16 Nov 2015 18:45:40 +0000 Subject: [PATCH] Flash health and shield bars when under 25%. --- src/battle/hud.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/battle/hud.c b/src/battle/hud.c index 5a86214..aa73e83 100644 --- a/src/battle/hud.c +++ b/src/battle/hud.c @@ -40,13 +40,10 @@ static SDL_Texture *smallFighter; static SDL_Texture *arrowLeft; static SDL_Texture *arrowRight; static int numMessages; -static int healthWarning; static char *gunName[] = {"", "Particle Cannon", "Plasma Cannon", "Laser Cannon", "Mag Cannon"}; void initHud(void) { - healthWarning = 0; - memset(&hudMessageHead, 0, sizeof(HudMessage)); hudMessageTail = &hudMessageHead; @@ -61,9 +58,6 @@ void doHud(void) { HudMessage *hudMessage, *prev; - healthWarning++; - healthWarning %= FPS; - numMessages = 0; prev = &hudMessageHead; @@ -187,6 +181,11 @@ static void drawHealthShieldBar(int current, int max, int x, int y, int r, int g { percent = current; percent /= max; + + if (percent <= 0.25 && battle.stats[STAT_TIME] % FPS < 30) + { + percent = 0; + } } rect.x = x;