Missile warning takes priority over suspicion level.
This commit is contained in:
parent
6158e35fb2
commit
a138e71455
|
@ -28,20 +28,14 @@ static void doBulletHitEffect(Bullet *b);
|
||||||
|
|
||||||
static Bullet bulletDef[BT_MAX];
|
static Bullet bulletDef[BT_MAX];
|
||||||
static Bullet **bulletsToDraw;
|
static Bullet **bulletsToDraw;
|
||||||
static int incomingMissile;
|
|
||||||
static int drawCapacity;
|
static int drawCapacity;
|
||||||
static char *WARNING_TEXT;
|
|
||||||
|
|
||||||
void initBullets(void)
|
void initBullets(void)
|
||||||
{
|
{
|
||||||
incomingMissile = 0;
|
|
||||||
|
|
||||||
drawCapacity = INITIAL_BULLET_DRAW_CAPACITY;
|
drawCapacity = INITIAL_BULLET_DRAW_CAPACITY;
|
||||||
|
|
||||||
bulletsToDraw = malloc(sizeof(Bullet*) * drawCapacity);
|
bulletsToDraw = malloc(sizeof(Bullet*) * drawCapacity);
|
||||||
memset(bulletsToDraw, 0, sizeof(Bullet*) * drawCapacity);
|
memset(bulletsToDraw, 0, sizeof(Bullet*) * drawCapacity);
|
||||||
|
|
||||||
WARNING_TEXT = _("WARNING: INCOMING MISSILE!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void initBulletDefs(void)
|
void initBulletDefs(void)
|
||||||
|
@ -81,7 +75,7 @@ void doBullets(void)
|
||||||
Bullet *b;
|
Bullet *b;
|
||||||
Bullet *prev = &battle.bulletHead;
|
Bullet *prev = &battle.bulletHead;
|
||||||
|
|
||||||
incomingMissile = 0;
|
battle.incomingMissile = 0;
|
||||||
|
|
||||||
memset(bulletsToDraw, 0, sizeof(Bullet*) * drawCapacity);
|
memset(bulletsToDraw, 0, sizeof(Bullet*) * drawCapacity);
|
||||||
|
|
||||||
|
@ -105,7 +99,7 @@ void doBullets(void)
|
||||||
|
|
||||||
if (b->target == player && player->alive == ALIVE_ALIVE && player->health > 0)
|
if (b->target == player && player->alive == ALIVE_ALIVE && player->health > 0)
|
||||||
{
|
{
|
||||||
incomingMissile = 1;
|
battle.incomingMissile = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,11 +295,6 @@ void drawBullets(void)
|
||||||
{
|
{
|
||||||
blitRotated(b->texture, b->x - battle.camera.x, b->y - battle.camera.y, b->angle);
|
blitRotated(b->texture, b->x - battle.camera.x, b->y - battle.camera.y, b->angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (incomingMissile && battle.stats[STAT_TIME] % FPS < 40)
|
|
||||||
{
|
|
||||||
drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 60, 18, TA_CENTER, colors.red, WARNING_TEXT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void faceTarget(Bullet *b)
|
static void faceTarget(Bullet *b)
|
||||||
|
|
|
@ -32,6 +32,7 @@ static void drawAbilityBars(void);
|
||||||
static void drawBoostECMBar(int current, int max, int x, int y, int r, int g, int b);
|
static void drawBoostECMBar(int current, int max, int x, int y, int r, int g, int b);
|
||||||
static void drawHealthShieldBar(int current, int max, int x, int y, int r, int g, int b, int flashLow);
|
static void drawHealthShieldBar(int current, int max, int x, int y, int r, int g, int b, int flashLow);
|
||||||
static void drawSuspicionLevel(void);
|
static void drawSuspicionLevel(void);
|
||||||
|
static void drawMissileWarning(void);
|
||||||
|
|
||||||
static HudMessage hudMessageHead;
|
static HudMessage hudMessageHead;
|
||||||
static HudMessage *hudMessageTail;
|
static HudMessage *hudMessageTail;
|
||||||
|
@ -61,6 +62,7 @@ static char *JUMPGATE_DIST_TEXT;
|
||||||
static char *NEW_FIGHTER_TEXT;
|
static char *NEW_FIGHTER_TEXT;
|
||||||
static char *SUSPICION_TEXT;
|
static char *SUSPICION_TEXT;
|
||||||
static char *REMAINING_PILOTS_TEXT;
|
static char *REMAINING_PILOTS_TEXT;
|
||||||
|
static char *WARNING_TEXT;
|
||||||
|
|
||||||
void initHud(void)
|
void initHud(void)
|
||||||
{
|
{
|
||||||
|
@ -87,6 +89,7 @@ void initHud(void)
|
||||||
NEW_FIGHTER_TEXT = _("SELECT NEW FIGHTER");
|
NEW_FIGHTER_TEXT = _("SELECT NEW FIGHTER");
|
||||||
SUSPICION_TEXT = _("Suspicion");
|
SUSPICION_TEXT = _("Suspicion");
|
||||||
REMAINING_PILOTS_TEXT = _("Remaining Pilots: %d");
|
REMAINING_PILOTS_TEXT = _("Remaining Pilots: %d");
|
||||||
|
WARNING_TEXT = _("WARNING: INCOMING MISSILE!");
|
||||||
|
|
||||||
targetPointer = getTexture("gfx/hud/targetPointer.png");
|
targetPointer = getTexture("gfx/hud/targetPointer.png");
|
||||||
targetCircle = getTexture("gfx/hud/targetCircle.png");
|
targetCircle = getTexture("gfx/hud/targetCircle.png");
|
||||||
|
@ -184,10 +187,9 @@ void drawHud(void)
|
||||||
|
|
||||||
drawRadarRangeWarning();
|
drawRadarRangeWarning();
|
||||||
|
|
||||||
if (battle.hasSuspicionLevel)
|
drawMissileWarning();
|
||||||
{
|
|
||||||
drawSuspicionLevel();
|
drawSuspicionLevel();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
drawHudMessages();
|
drawHudMessages();
|
||||||
|
@ -625,46 +627,57 @@ static void drawSuspicionLevel(void)
|
||||||
{
|
{
|
||||||
SDL_Rect r;
|
SDL_Rect r;
|
||||||
|
|
||||||
battle.suspicionLevel = MIN(battle.suspicionLevel, MAX_SUSPICION_LEVEL);
|
if (battle.hasSuspicionLevel && !battle.incomingMissile)
|
||||||
|
|
||||||
drawText((SCREEN_WIDTH / 2) - 150, SCREEN_HEIGHT - 60, 18, TA_RIGHT, colors.white, SUSPICION_TEXT);
|
|
||||||
|
|
||||||
r.x = (SCREEN_WIDTH / 2) - 140;
|
|
||||||
r.y = SCREEN_HEIGHT - 58;
|
|
||||||
r.w = 400;
|
|
||||||
r.h = 20;
|
|
||||||
|
|
||||||
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
|
|
||||||
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
|
|
||||||
SDL_RenderFillRect(app.renderer, &r);
|
|
||||||
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE);
|
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(app.renderer, 192, 192, 192, 255);
|
|
||||||
SDL_RenderDrawRect(app.renderer, &r);
|
|
||||||
|
|
||||||
r.x += 2;
|
|
||||||
r.y += 2;
|
|
||||||
r.w -= 4;
|
|
||||||
r.h -= 4;
|
|
||||||
|
|
||||||
r.w = MAX((r.w / MAX_SUSPICION_LEVEL) * battle.suspicionLevel, 0);
|
|
||||||
|
|
||||||
if (battle.suspicionLevel < (MAX_SUSPICION_LEVEL * 0.5))
|
|
||||||
{
|
{
|
||||||
SDL_SetRenderDrawColor(app.renderer, 255, 255, 255, 255);
|
battle.suspicionLevel = MIN(battle.suspicionLevel, MAX_SUSPICION_LEVEL);
|
||||||
}
|
|
||||||
else if (battle.suspicionLevel < (MAX_SUSPICION_LEVEL * 0.75))
|
|
||||||
{
|
|
||||||
SDL_SetRenderDrawColor(app.renderer, 255, 128, 0, 255);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SDL_SetRenderDrawColor(app.renderer, 255, 0, 0, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_RenderFillRect(app.renderer, &r);
|
drawText((SCREEN_WIDTH / 2) - 150, SCREEN_HEIGHT - 60, 18, TA_RIGHT, colors.white, SUSPICION_TEXT);
|
||||||
|
|
||||||
drawText(r.x + r.w + 7, SCREEN_HEIGHT - 57, 12, TA_LEFT, colors.white, "%d%%", (battle.suspicionLevel > 0) ? getPercent(battle.suspicionLevel, MAX_SUSPICION_LEVEL) : 0);
|
r.x = (SCREEN_WIDTH / 2) - 140;
|
||||||
|
r.y = SCREEN_HEIGHT - 58;
|
||||||
|
r.w = 400;
|
||||||
|
r.h = 20;
|
||||||
|
|
||||||
|
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND);
|
||||||
|
SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128);
|
||||||
|
SDL_RenderFillRect(app.renderer, &r);
|
||||||
|
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE);
|
||||||
|
|
||||||
|
SDL_SetRenderDrawColor(app.renderer, 192, 192, 192, 255);
|
||||||
|
SDL_RenderDrawRect(app.renderer, &r);
|
||||||
|
|
||||||
|
r.x += 2;
|
||||||
|
r.y += 2;
|
||||||
|
r.w -= 4;
|
||||||
|
r.h -= 4;
|
||||||
|
|
||||||
|
r.w = MAX((r.w / MAX_SUSPICION_LEVEL) * battle.suspicionLevel, 0);
|
||||||
|
|
||||||
|
if (battle.suspicionLevel < (MAX_SUSPICION_LEVEL * 0.5))
|
||||||
|
{
|
||||||
|
SDL_SetRenderDrawColor(app.renderer, 255, 255, 255, 255);
|
||||||
|
}
|
||||||
|
else if (battle.suspicionLevel < (MAX_SUSPICION_LEVEL * 0.75))
|
||||||
|
{
|
||||||
|
SDL_SetRenderDrawColor(app.renderer, 255, 128, 0, 255);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SDL_SetRenderDrawColor(app.renderer, 255, 0, 0, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_RenderFillRect(app.renderer, &r);
|
||||||
|
|
||||||
|
drawText(r.x + r.w + 7, SCREEN_HEIGHT - 57, 12, TA_LEFT, colors.white, "%d%%", (battle.suspicionLevel > 0) ? getPercent(battle.suspicionLevel, MAX_SUSPICION_LEVEL) : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void drawMissileWarning(void)
|
||||||
|
{
|
||||||
|
if (battle.incomingMissile && battle.stats[STAT_TIME] % FPS < 40)
|
||||||
|
{
|
||||||
|
drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 60, 18, TA_CENTER, colors.red, WARNING_TEXT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetHud(void)
|
void resetHud(void)
|
||||||
|
|
|
@ -364,6 +364,7 @@ typedef struct {
|
||||||
int suspicionLevel;
|
int suspicionLevel;
|
||||||
int suspicionCoolOff;
|
int suspicionCoolOff;
|
||||||
int zackariaSuspicionLevel;
|
int zackariaSuspicionLevel;
|
||||||
|
int incomingMissile;
|
||||||
int destroyTorelli;
|
int destroyTorelli;
|
||||||
float torelliFireStormAlpha;
|
float torelliFireStormAlpha;
|
||||||
int campaignFinished;
|
int campaignFinished;
|
||||||
|
|
Loading…
Reference in New Issue