Flash health and shield bars when under 25%.
This commit is contained in:
parent
c224aff926
commit
6fa47cac99
|
@ -40,13 +40,10 @@ static SDL_Texture *smallFighter;
|
||||||
static SDL_Texture *arrowLeft;
|
static SDL_Texture *arrowLeft;
|
||||||
static SDL_Texture *arrowRight;
|
static SDL_Texture *arrowRight;
|
||||||
static int numMessages;
|
static int numMessages;
|
||||||
static int healthWarning;
|
|
||||||
static char *gunName[] = {"", "Particle Cannon", "Plasma Cannon", "Laser Cannon", "Mag Cannon"};
|
static char *gunName[] = {"", "Particle Cannon", "Plasma Cannon", "Laser Cannon", "Mag Cannon"};
|
||||||
|
|
||||||
void initHud(void)
|
void initHud(void)
|
||||||
{
|
{
|
||||||
healthWarning = 0;
|
|
||||||
|
|
||||||
memset(&hudMessageHead, 0, sizeof(HudMessage));
|
memset(&hudMessageHead, 0, sizeof(HudMessage));
|
||||||
hudMessageTail = &hudMessageHead;
|
hudMessageTail = &hudMessageHead;
|
||||||
|
|
||||||
|
@ -61,9 +58,6 @@ void doHud(void)
|
||||||
{
|
{
|
||||||
HudMessage *hudMessage, *prev;
|
HudMessage *hudMessage, *prev;
|
||||||
|
|
||||||
healthWarning++;
|
|
||||||
healthWarning %= FPS;
|
|
||||||
|
|
||||||
numMessages = 0;
|
numMessages = 0;
|
||||||
|
|
||||||
prev = &hudMessageHead;
|
prev = &hudMessageHead;
|
||||||
|
@ -187,6 +181,11 @@ static void drawHealthShieldBar(int current, int max, int x, int y, int r, int g
|
||||||
{
|
{
|
||||||
percent = current;
|
percent = current;
|
||||||
percent /= max;
|
percent /= max;
|
||||||
|
|
||||||
|
if (percent <= 0.25 && battle.stats[STAT_TIME] % FPS < 30)
|
||||||
|
{
|
||||||
|
percent = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rect.x = x;
|
rect.x = x;
|
||||||
|
|
Loading…
Reference in New Issue