Added suspicion level, for optional missions.
This commit is contained in:
parent
ffdf7f5aed
commit
ee4e88668e
Binary file not shown.
After Width: | Height: | Size: 545 KiB |
|
@ -961,6 +961,36 @@ static void wander(void)
|
|||
{
|
||||
self->aiActionTime = 0;
|
||||
}
|
||||
|
||||
nextAction();
|
||||
}
|
||||
|
||||
/*
|
||||
* Used only for the optional missions, in Pandoran-controlled space. We can therefore hardcode the response.
|
||||
*/
|
||||
void checkSuspicionLevel(void)
|
||||
{
|
||||
battle.hasSuspicionLevel = 0;
|
||||
|
||||
if (self->side == player->side)
|
||||
{
|
||||
battle.hasSuspicionLevel = 1;
|
||||
|
||||
/* raise if player is too far away */
|
||||
if (getDistance(self->x, self->y, player->x, player->y) > SCREEN_WIDTH / 2)
|
||||
{
|
||||
battle.suspicionLevel++;
|
||||
}
|
||||
|
||||
/* raise if there are active enemies */
|
||||
if (battle.numEnemies)
|
||||
{
|
||||
battle.suspicionLevel++;
|
||||
}
|
||||
|
||||
if (battle.suspicionLevel >= MAX_SUSPICION_LEVEL)
|
||||
{
|
||||
player->side = SIDE_ALLIES;
|
||||
|
||||
addMessageBox(self->name, "Intruder alert! We have an intruder! All units, target and destroy that fighter!", MB_PANDORAN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ extern void addHudMessage(SDL_Color c, char *format, ...);
|
|||
extern Entity **getAllEntsInRadius(int x, int y, int radius, Entity *ignore);
|
||||
extern char *getTranslatedString(char *string);
|
||||
extern Entity *spawnMine(int type);
|
||||
extern void addMessageBox(char *title, char *body, int type);
|
||||
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
|
|
|
@ -180,6 +180,11 @@ static void checkCollisions(Bullet *b)
|
|||
{
|
||||
battle.stats[STAT_ROCKETS_HIT]++;
|
||||
}
|
||||
|
||||
if (battle.hasSuspicionLevel)
|
||||
{
|
||||
battle.suspicionLevel = MAX(0, battle.suspicionLevel - (MAX_SUSPICION_LEVEL * 0.01));
|
||||
}
|
||||
}
|
||||
|
||||
if (e->flags & EF_IMMORTAL)
|
||||
|
|
|
@ -254,6 +254,11 @@ void doFighter(void)
|
|||
self->action = doAI;
|
||||
}
|
||||
}
|
||||
|
||||
if (self->aiFlags & AIF_SUSPICIOUS)
|
||||
{
|
||||
checkSuspicionLevel();
|
||||
}
|
||||
}
|
||||
|
||||
if (self->alive == ALIVE_ESCAPED)
|
||||
|
@ -555,6 +560,11 @@ static void die(void)
|
|||
{
|
||||
battle.stats[STAT_ENEMIES_KILLED_PLAYER]++;
|
||||
|
||||
if (battle.hasSuspicionLevel)
|
||||
{
|
||||
battle.suspicionLevel = MAX(0, battle.suspicionLevel - (MAX_SUSPICION_LEVEL * 0.1));
|
||||
}
|
||||
|
||||
if (battle.isEpic)
|
||||
{
|
||||
battle.stats[STAT_EPIC_KILL_STREAK]++;
|
||||
|
|
|
@ -51,6 +51,7 @@ extern char **toTypeArray(char *types, int *numTypes);
|
|||
extern char *getJSONValueStr(cJSON *node, char *name, char *defValue);
|
||||
extern void awardTrophy(char *id);
|
||||
extern void addRandomItem(int x, int y);
|
||||
extern void checkSuspicionLevel(void);
|
||||
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
|
|
|
@ -31,6 +31,7 @@ static void drawPlayerSelect(void);
|
|||
static void drawAbilityBars(void);
|
||||
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 drawSuspicionLevel(void);
|
||||
|
||||
static HudMessage hudMessageHead;
|
||||
static HudMessage *hudMessageTail;
|
||||
|
@ -157,6 +158,11 @@ void drawHud(void)
|
|||
drawRadar();
|
||||
|
||||
drawRadarRangeWarning();
|
||||
|
||||
if (battle.hasSuspicionLevel)
|
||||
{
|
||||
drawSuspicionLevel();
|
||||
}
|
||||
}
|
||||
|
||||
drawHudMessages();
|
||||
|
@ -577,6 +583,43 @@ static void drawPlayerSelect(void)
|
|||
blit(arrowRight, (SCREEN_WIDTH / 2) + 200, 520, 1);
|
||||
}
|
||||
|
||||
static void drawSuspicionLevel(void)
|
||||
{
|
||||
SDL_Rect r;
|
||||
|
||||
drawText((SCREEN_WIDTH / 2) - 150, SCREEN_HEIGHT - 60, 18, TA_RIGHT, colors.white, _("Suspicion"));
|
||||
|
||||
r.x = (SCREEN_WIDTH / 2) - 140;
|
||||
r.y = SCREEN_HEIGHT - 58;
|
||||
r.w = 400;
|
||||
r.h = 20;
|
||||
|
||||
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 = (r.w / MAX_SUSPICION_LEVEL) * battle.suspicionLevel;
|
||||
|
||||
if (battle.suspicionLevel < (MAX_SUSPICION_LEVEL * 0.5))
|
||||
{
|
||||
SDL_SetRenderDrawColor(app.renderer, 255, 128, 0, 255);
|
||||
}
|
||||
else if (battle.suspicionLevel < (MAX_SUSPICION_LEVEL * 0.75))
|
||||
{
|
||||
SDL_SetRenderDrawColor(app.renderer, 255, 255, 255, 255);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_SetRenderDrawColor(app.renderer, 255, 0, 0, 255);
|
||||
}
|
||||
|
||||
SDL_RenderFillRect(app.renderer, &r);
|
||||
}
|
||||
|
||||
void resetHud(void)
|
||||
{
|
||||
HudMessage *hudMessage;
|
||||
|
|
|
@ -129,6 +129,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define AIF_TARGET_FOCUS (2 << 16)
|
||||
#define AIF_DROPS_MINES (2 << 17)
|
||||
#define AIF_ASSASSIN (2 << 18)
|
||||
#define AIF_SUSPICIOUS (2 << 19)
|
||||
|
||||
/* player abilities */
|
||||
#define BOOST_RECHARGE_TIME (FPS * 7)
|
||||
|
@ -143,6 +144,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define SS_SOL 1
|
||||
#define SS_PANDORAN 2
|
||||
|
||||
#define MAX_SUSPICION_LEVEL 5000.0
|
||||
|
||||
enum
|
||||
{
|
||||
CONTROL_FIRE,
|
||||
|
|
|
@ -350,6 +350,8 @@ typedef struct {
|
|||
int numObjectivesComplete, numObjectivesTotal, numConditions;
|
||||
int scriptedEnd;
|
||||
int hasThreats;
|
||||
int hasSuspicionLevel;
|
||||
int suspicionLevel;
|
||||
Entity *missionTarget;
|
||||
Entity *jumpgate;
|
||||
Entity *messageSpeaker;
|
||||
|
|
|
@ -90,6 +90,7 @@ void initLookups(void)
|
|||
addLookup("AIF_TARGET_FOCUS", AIF_TARGET_FOCUS);
|
||||
addLookup("AIF_DROPS_MINES", AIF_DROPS_MINES);
|
||||
addLookup("AIF_ASSASSIN", AIF_ASSASSIN);
|
||||
addLookup("AIF_SUSPICIOUS", AIF_SUSPICIOUS);
|
||||
|
||||
addLookup("DT_ANY", DT_ANY);
|
||||
addLookup("DT_NO_SPIN", DT_NO_SPIN);
|
||||
|
|
Loading…
Reference in New Issue