Added mission target flag, Pirate Uprising 03, and scatter radius for fighter groups, to prevent battles initially being too chaotic.
This commit is contained in:
parent
67d92cedb9
commit
5b7410dc1f
|
@ -84,7 +84,8 @@
|
||||||
"y": 260,
|
"y": 260,
|
||||||
"missions" : [
|
"missions" : [
|
||||||
"data/missions/temper/01 - pirate uprising #1.json",
|
"data/missions/temper/01 - pirate uprising #1.json",
|
||||||
"data/missions/temper/02 - pirate uprising #2.json"
|
"data/missions/temper/02 - pirate uprising #2.json",
|
||||||
|
"data/missions/temper/03 - pirate uprising #3.json"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,8 @@
|
||||||
"number" : 10,
|
"number" : 10,
|
||||||
"side" : "SIDE_PIRATE",
|
"side" : "SIDE_PIRATE",
|
||||||
"x" : 1000,
|
"x" : 1000,
|
||||||
"y" : 5000
|
"y" : 5000,
|
||||||
|
"scatter" : 2000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type" : "SimpleDart",
|
"type" : "SimpleDart",
|
||||||
|
@ -55,7 +56,8 @@
|
||||||
"number" : 10,
|
"number" : 10,
|
||||||
"side" : "SIDE_PIRATE",
|
"side" : "SIDE_PIRATE",
|
||||||
"x" : -3000,
|
"x" : -3000,
|
||||||
"y" : -3000
|
"y" : -3000,
|
||||||
|
"scatter" : 2000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type" : "Dart",
|
"type" : "Dart",
|
||||||
|
@ -63,7 +65,8 @@
|
||||||
"number" : 10,
|
"number" : 10,
|
||||||
"side" : "SIDE_PIRATE",
|
"side" : "SIDE_PIRATE",
|
||||||
"x" : 0,
|
"x" : 0,
|
||||||
"y" : -6000
|
"y" : -6000,
|
||||||
|
"scatter" : 2000
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,8 @@
|
||||||
"number" : 12,
|
"number" : 12,
|
||||||
"side" : "SIDE_PIRATE",
|
"side" : "SIDE_PIRATE",
|
||||||
"x" : -3000,
|
"x" : -3000,
|
||||||
"y" : 0
|
"y" : 0,
|
||||||
|
"scatter" : 2000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type" : "Dart",
|
"type" : "Dart",
|
||||||
|
@ -55,7 +56,8 @@
|
||||||
"number" : 12,
|
"number" : 12,
|
||||||
"side" : "SIDE_PIRATE",
|
"side" : "SIDE_PIRATE",
|
||||||
"x" : 4000,
|
"x" : 4000,
|
||||||
"y" : 0
|
"y" : 0,
|
||||||
|
"scatter" : 2000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type" : "Dart",
|
"type" : "Dart",
|
||||||
|
@ -63,7 +65,8 @@
|
||||||
"number" : 12,
|
"number" : 12,
|
||||||
"side" : "SIDE_PIRATE",
|
"side" : "SIDE_PIRATE",
|
||||||
"x" : 0,
|
"x" : 0,
|
||||||
"y" : 6000
|
"y" : 6000,
|
||||||
|
"scatter" : 2000
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name" : "Pirate Uprising #3",
|
"name" : "Pirate Uprising #3",
|
||||||
"description" : "Allied intelligence have managed to locate one of the pirate ring leaders. We need to bring this man in alive, as he could provide us with further useful information that will allow us to eliminate other high ranking individuals.",
|
"description" : "Allied intelligence have managed to locate one of the pirate ring leaders. We need to bring this man in alive, as he could provide us with further useful information that will allow us to eliminate other high ranking individuals. You will be piloting a Ray, and will need to use your Mag cannons to disable the target. Do not destroy the leader's Dart.",
|
||||||
"background" : "gfx/backgrounds/background03.jpg",
|
"background" : "gfx/backgrounds/background03.jpg",
|
||||||
"planet" : "gfx/planets/spirit.png",
|
"planet" : "gfx/planets/spirit.png",
|
||||||
"music" : "music/battleThemeA.mp3",
|
"music" : "music/battleThemeA.mp3",
|
||||||
|
@ -12,7 +12,13 @@
|
||||||
"targetType" : "TT_DISABLE"
|
"targetType" : "TT_DISABLE"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description" : "Do not kill pirate leader",
|
"description" : "Destroy all remaining opposition",
|
||||||
|
"targetName" : "Dart",
|
||||||
|
"targetValue" : 12,
|
||||||
|
"targetType" : "TT_DESTROY"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description" : "Do not kill Pirate Leader",
|
||||||
"targetName" : "Pirate Leader",
|
"targetName" : "Pirate Leader",
|
||||||
"targetValue" : 1,
|
"targetValue" : 1,
|
||||||
"targetType" : "TT_DESTROY",
|
"targetType" : "TT_DESTROY",
|
||||||
|
@ -28,18 +34,30 @@
|
||||||
"fighters" : [
|
"fighters" : [
|
||||||
{
|
{
|
||||||
"name" : "Pirate Leader",
|
"name" : "Pirate Leader",
|
||||||
"type" : "StaticDart",
|
"type" : "Dart",
|
||||||
"side" : "SIDE_PIRATE",
|
"side" : "SIDE_PIRATE",
|
||||||
"x" : 800,
|
"x" : -5000,
|
||||||
"y" : 200,
|
"y" : 0,
|
||||||
"flags" : "FF_NO_KILL+FF_DISABLE"
|
"flags" : "FF_NO_KILL+FF_DISABLE+FF_MISSION_TARGET"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fighterGroups" : [
|
||||||
|
{
|
||||||
|
"name" : "Ally",
|
||||||
|
"type" : "TAF",
|
||||||
|
"number" : 2,
|
||||||
|
"side" : "SIDE_ALLIES",
|
||||||
|
"x" : 1600,
|
||||||
|
"y" : 400
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name" : "TAF",
|
"type" : "Dart",
|
||||||
"type" : "Ray",
|
"name" : "Dart",
|
||||||
"side" : "SIDE_ALLIES",
|
"number" : 12,
|
||||||
"x" : 100,
|
"side" : "SIDE_PIRATE",
|
||||||
"y" : 200
|
"x" : -5000,
|
||||||
|
"y" : 0,
|
||||||
|
"scatter" : 2000
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 814 B After Width: | Height: | Size: 798 B |
Binary file not shown.
Before Width: | Height: | Size: 230 B After Width: | Height: | Size: 276 B |
|
@ -188,6 +188,11 @@ void doFighters(void)
|
||||||
self->target = NULL;
|
self->target = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!battle.missionTarget && f->flags & FF_MISSION_TARGET && f->health > 0)
|
||||||
|
{
|
||||||
|
battle.missionTarget = f;
|
||||||
|
}
|
||||||
|
|
||||||
f->x += f->dx;
|
f->x += f->dx;
|
||||||
f->y += f->dy;
|
f->y += f->dy;
|
||||||
|
|
||||||
|
@ -236,6 +241,11 @@ void doFighters(void)
|
||||||
f->health = 0;
|
f->health = 0;
|
||||||
f->alive = ALIVE_DYING;
|
f->alive = ALIVE_DYING;
|
||||||
f->die();
|
f->die();
|
||||||
|
|
||||||
|
if (f == battle.missionTarget)
|
||||||
|
{
|
||||||
|
battle.missionTarget = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f->systemPower <= 0)
|
if (f->systemPower <= 0)
|
||||||
|
@ -372,15 +382,29 @@ void drawFighters(void)
|
||||||
blit(shieldHitTexture, f->x, f->y, 1);
|
blit(shieldHitTexture, f->x, f->y, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player != NULL && f == player->target)
|
if (player != NULL)
|
||||||
{
|
{
|
||||||
r.x = f->x - 32;
|
if (f == player->target)
|
||||||
r.y = f->y - 32;
|
{
|
||||||
r.w = 64;
|
r.x = f->x - 32;
|
||||||
r.h = 64;
|
r.y = f->y - 32;
|
||||||
|
r.w = 64;
|
||||||
|
r.h = 64;
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(app.renderer, 255, 64, 0, 255);
|
SDL_SetRenderDrawColor(app.renderer, 255, 64, 0, 255);
|
||||||
SDL_RenderDrawRect(app.renderer, &r);
|
SDL_RenderDrawRect(app.renderer, &r);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f == battle.missionTarget)
|
||||||
|
{
|
||||||
|
r.x = f->x - 28;
|
||||||
|
r.y = f->y - 28;
|
||||||
|
r.w = 56;
|
||||||
|
r.h = 56;
|
||||||
|
|
||||||
|
SDL_SetRenderDrawColor(app.renderer, 64, 255, 0, 255);
|
||||||
|
SDL_RenderDrawRect(app.renderer, &r);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,9 @@ static void drawHudMessages(void);
|
||||||
|
|
||||||
static HudMessage hudMessageHead;
|
static HudMessage hudMessageHead;
|
||||||
static HudMessage *hudMessageTail;
|
static HudMessage *hudMessageTail;
|
||||||
|
static SDL_Texture *targetPointer;
|
||||||
|
static SDL_Texture *targetCircle;
|
||||||
|
static SDL_Texture *smallFighter;
|
||||||
|
|
||||||
static int healthWarning;
|
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"};
|
||||||
|
@ -42,6 +45,10 @@ void initHud(void)
|
||||||
|
|
||||||
memset(&hudMessageHead, 0, sizeof(HudMessage));
|
memset(&hudMessageHead, 0, sizeof(HudMessage));
|
||||||
hudMessageTail = &hudMessageHead;
|
hudMessageTail = &hudMessageHead;
|
||||||
|
|
||||||
|
targetPointer = getTexture("gfx/hud/targetPointer.png");
|
||||||
|
targetCircle = getTexture("gfx/hud/targetCircle.png");
|
||||||
|
smallFighter = getTexture("gfx/hud/smallFighter.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
void doHud(void)
|
void doHud(void)
|
||||||
|
@ -199,33 +206,45 @@ static void drawPlayerTargeter(void)
|
||||||
x = player->x;
|
x = player->x;
|
||||||
y = player->y;
|
y = player->y;
|
||||||
|
|
||||||
x += sin(TO_RAIDANS(angle)) * 44;
|
x += sin(TO_RAIDANS(angle)) * 45;
|
||||||
y += -cos(TO_RAIDANS(angle)) * 44;
|
y += -cos(TO_RAIDANS(angle)) * 45;
|
||||||
|
|
||||||
blitRotated(getTexture("gfx/hud/targetPointer.png"), x, y, angle);
|
SDL_SetTextureColorMod(targetPointer, 255, 0, 0);
|
||||||
|
SDL_SetTextureColorMod(targetCircle, 255, 0, 0);
|
||||||
|
|
||||||
blitRotated(getTexture("gfx/hud/targetCircle.png"), player->x, player->y, angle);
|
blitRotated(targetPointer, x, y, angle);
|
||||||
|
blitRotated(targetCircle, player->x, player->y, angle);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (battle.missionTarget)
|
||||||
|
{
|
||||||
|
angle = getAngle(player->x, player->y, battle.missionTarget->x, battle.missionTarget->y);
|
||||||
|
x = player->x;
|
||||||
|
y = player->y;
|
||||||
|
|
||||||
|
x += sin(TO_RAIDANS(angle)) * 45;
|
||||||
|
y += -cos(TO_RAIDANS(angle)) * 45;
|
||||||
|
|
||||||
|
SDL_SetTextureColorMod(targetPointer, 0, 255, 0);
|
||||||
|
|
||||||
|
blitRotated(targetPointer, x, y, angle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawNumAllies(void)
|
static void drawNumAllies(void)
|
||||||
{
|
{
|
||||||
SDL_Texture *t = getTexture("gfx/hud/smallFighter.png");
|
SDL_SetTextureColorMod(smallFighter, 150, 200, 255);
|
||||||
|
|
||||||
SDL_SetTextureColorMod(t, 150, 200, 255);
|
blit(smallFighter, 400, 15, 0);
|
||||||
|
|
||||||
blit(t, 400, 15, 0);
|
|
||||||
|
|
||||||
drawText(435, 11, 14, TA_CENTER, colors.white, "(%d)", battle.numAllies);
|
drawText(435, 11, 14, TA_CENTER, colors.white, "(%d)", battle.numAllies);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawNumEnemies(void)
|
static void drawNumEnemies(void)
|
||||||
{
|
{
|
||||||
SDL_Texture *t = getTexture("gfx/hud/smallFighter.png");
|
SDL_SetTextureColorMod(smallFighter, 255, 100, 100);
|
||||||
|
|
||||||
SDL_SetTextureColorMod(t, 255, 100, 100);
|
blit(smallFighter, SCREEN_WIDTH - 410, 15, 0);
|
||||||
|
|
||||||
blit(t, SCREEN_WIDTH - 410, 15, 0);
|
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH - 430, 11, 14, TA_CENTER, colors.white, "(%d)", battle.numEnemies);
|
drawText(SCREEN_WIDTH - 430, 11, 14, TA_CENTER, colors.white, "(%d)", battle.numEnemies);
|
||||||
}
|
}
|
||||||
|
@ -249,6 +268,17 @@ static void drawTargetDistance(void)
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH - 15, 50, 14, TA_RIGHT, colors.red, "Target: %.2fkm", distance);
|
drawText(SCREEN_WIDTH - 15, 50, 14, TA_RIGHT, colors.red, "Target: %.2fkm", distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (battle.missionTarget != NULL)
|
||||||
|
{
|
||||||
|
distance = getDistance(player->x, player->y, battle.missionTarget->x, battle.missionTarget->y);
|
||||||
|
distance /= 50;
|
||||||
|
|
||||||
|
distance = (int)distance;
|
||||||
|
distance /= 10;
|
||||||
|
|
||||||
|
drawText(SCREEN_WIDTH - 15, 75, 14, TA_RIGHT, colors.green, "Objective: %.2fkm", distance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawHudMessages(void)
|
static void drawHudMessages(void)
|
||||||
|
|
|
@ -96,7 +96,7 @@ void doPlayer(void)
|
||||||
app.keyboard[SDL_SCANCODE_RETURN] = 0;
|
app.keyboard[SDL_SCANCODE_RETURN] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player->target || player->target->health <= 0 || getDistance(player->x, player->y, player->target->x, player->target->y) > 1000)
|
if (!player->target || player->target->health <= 0 || player->target->systemPower <= 0 || getDistance(player->x, player->y, player->target->x, player->target->y) > 1000)
|
||||||
{
|
{
|
||||||
selectTarget();
|
selectTarget();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "radar.h"
|
#include "radar.h"
|
||||||
|
|
||||||
|
#define RADAR_RANGE 20
|
||||||
|
|
||||||
void drawRadar(void)
|
void drawRadar(void)
|
||||||
{
|
{
|
||||||
SDL_Rect r;
|
SDL_Rect r;
|
||||||
|
@ -34,13 +36,13 @@ void drawRadar(void)
|
||||||
|
|
||||||
for (f = battle.fighterHead.next ; f != NULL ; f = f->next)
|
for (f = battle.fighterHead.next ; f != NULL ; f = f->next)
|
||||||
{
|
{
|
||||||
if (getDistance(f->x, f->y, player->x, player->y) / 15 < 70)
|
if (getDistance(f->x, f->y, player->x, player->y) / RADAR_RANGE < 70)
|
||||||
{
|
{
|
||||||
r.x = SCREEN_WIDTH - 85;
|
r.x = SCREEN_WIDTH - 85;
|
||||||
r.y = SCREEN_HEIGHT - 85;
|
r.y = SCREEN_HEIGHT - 85;
|
||||||
|
|
||||||
r.x -= (player->x - f->x) / 15;
|
r.x -= (player->x - f->x) / RADAR_RANGE;
|
||||||
r.y -= (player->y - f->y) / 15;
|
r.y -= (player->y - f->y) / RADAR_RANGE;
|
||||||
|
|
||||||
r.x--;
|
r.x--;
|
||||||
r.y--;
|
r.y--;
|
||||||
|
@ -61,11 +63,16 @@ void drawRadar(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->target == f)
|
if (f == player->target)
|
||||||
{
|
{
|
||||||
SDL_SetRenderDrawColor(app.renderer, 255, 255, 0, 255);
|
SDL_SetRenderDrawColor(app.renderer, 255, 255, 0, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (f == battle.missionTarget)
|
||||||
|
{
|
||||||
|
SDL_SetRenderDrawColor(app.renderer, 255, 255, 255, 255);
|
||||||
|
}
|
||||||
|
|
||||||
SDL_RenderFillRect(app.renderer, &r);
|
SDL_RenderFillRect(app.renderer, &r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define FF_NO_KILL (2 << 0)
|
#define FF_NO_KILL (2 << 0)
|
||||||
#define FF_DISABLE (2 << 1)
|
#define FF_DISABLE (2 << 1)
|
||||||
#define FF_IMMORTAL (2 << 2)
|
#define FF_IMMORTAL (2 << 2)
|
||||||
|
#define FF_MISSION_TARGET (2 << 3)
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|
|
@ -157,9 +157,11 @@ static void loadFighterGroups(cJSON *node)
|
||||||
{
|
{
|
||||||
Fighter *f;
|
Fighter *f;
|
||||||
char *type, *name;
|
char *type, *name;
|
||||||
int side, x, y;
|
int side, x, y, scatter;
|
||||||
int number, i;
|
int number, i;
|
||||||
|
|
||||||
|
scatter = 1;
|
||||||
|
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
node = node->child;
|
node = node->child;
|
||||||
|
@ -173,10 +175,18 @@ static void loadFighterGroups(cJSON *node)
|
||||||
y = cJSON_GetObjectItem(node, "y")->valueint;
|
y = cJSON_GetObjectItem(node, "y")->valueint;
|
||||||
name = cJSON_GetObjectItem(node, "name")->valuestring;
|
name = cJSON_GetObjectItem(node, "name")->valuestring;
|
||||||
|
|
||||||
|
if (cJSON_GetObjectItem(node, "scatter"))
|
||||||
|
{
|
||||||
|
scatter = cJSON_GetObjectItem(node, "scatter")->valueint;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0 ; i < number ; i++)
|
for (i = 0 ; i < number ; i++)
|
||||||
{
|
{
|
||||||
f = spawnFighter(type, x, y, side);
|
f = spawnFighter(type, x, y, side);
|
||||||
|
|
||||||
|
f->x += (rand() % scatter) - (rand() % scatter);
|
||||||
|
f->y += (rand() % scatter) - (rand() % scatter);
|
||||||
|
|
||||||
STRNCPY(f->name, name, MAX_NAME_LENGTH);
|
STRNCPY(f->name, name, MAX_NAME_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -223,6 +223,7 @@ typedef struct {
|
||||||
int status;
|
int status;
|
||||||
int missionFinishedTimer;
|
int missionFinishedTimer;
|
||||||
int numObjectivesComplete, numObjectivesTotal;
|
int numObjectivesComplete, numObjectivesTotal;
|
||||||
|
Fighter *missionTarget;
|
||||||
SDL_Texture *background, *planetTexture;
|
SDL_Texture *background, *planetTexture;
|
||||||
PointF planet;
|
PointF planet;
|
||||||
Fighter fighterHead, *fighterTail;
|
Fighter fighterHead, *fighterTail;
|
||||||
|
|
|
@ -33,6 +33,7 @@ void initLookups(void)
|
||||||
addLookup("FF_NO_KILL", FF_NO_KILL);
|
addLookup("FF_NO_KILL", FF_NO_KILL);
|
||||||
addLookup("FF_DISABLE", FF_DISABLE);
|
addLookup("FF_DISABLE", FF_DISABLE);
|
||||||
addLookup("FF_IMMORTAL", FF_IMMORTAL);
|
addLookup("FF_IMMORTAL", FF_IMMORTAL);
|
||||||
|
addLookup("FF_MISSION_TARGET", FF_MISSION_TARGET);
|
||||||
|
|
||||||
addLookup("TT_DESTROY", TT_DESTROY);
|
addLookup("TT_DESTROY", TT_DESTROY);
|
||||||
addLookup("TT_DISABLE", TT_DISABLE);
|
addLookup("TT_DISABLE", TT_DISABLE);
|
||||||
|
|
|
@ -26,6 +26,8 @@ void loadTestMission(char *filename)
|
||||||
{
|
{
|
||||||
memset(&mission, 0, sizeof(Mission));
|
memset(&mission, 0, sizeof(Mission));
|
||||||
|
|
||||||
|
STRNCPY(mission.filename, filename, MAX_DESCRIPTION_LENGTH);
|
||||||
|
|
||||||
game.currentMission = &mission;
|
game.currentMission = &mission;
|
||||||
|
|
||||||
initBattle();
|
initBattle();
|
||||||
|
|
Loading…
Reference in New Issue