Start of fighter descriptions.

This commit is contained in:
Steve 2017-08-10 08:44:19 +01:00
parent e28fa118fb
commit 3a1179032f
18 changed files with 48 additions and 23 deletions

View File

@ -1,6 +1,6 @@
{
"name" : "INF Tug",
"description" : "TODO",
"description" : "",
"health" : 50,
"speed" : 1.85,
"reloadTime" : 10,

View File

@ -1,6 +1,6 @@
{
"name" : "Munitions Transport",
"description" : "TODO",
"description" : "",
"health" : 150,
"shield" : 50,
"speed" : 1.5,

View File

@ -1,6 +1,6 @@
{
"name" : "Shuttle",
"description" : "TODO",
"description" : "",
"health" : 15,
"shield" : 15,
"speed" : 2,

View File

@ -1,6 +1,6 @@
{
"name" : "Supply Ship",
"description" : "TODO",
"description" : "",
"health" : 150,
"shield" : 50,
"speed" : 1.5,

View File

@ -1,6 +1,6 @@
{
"name" : "Tug",
"description" : "TODO",
"description" : "",
"health" : 50,
"speed" : 1.85,
"reloadTime" : 10,

View File

@ -1,6 +1,6 @@
{
"name" : "Angel",
"description" : "TODO",
"description" : "One of the oldest starfighters created by the Mitikas Empire, the Angel is rarely seen, due to it being retired in 2599. A handful of Independent Worlds continue to operate the fighter, having purchased them from the empire prior to Mitikas pulling them from service. Even so, they are quite often held back from deployment, acting as reserves to bulk up numbers. Angels are notable for being the first INF fighter to be equipped with mag cannons, and for being somewhat smaller than most of the nation's other fighters. Also of note is the appearance, the fighter sporting a purple colour scheme, as opposed to the reds of more recent INF craft.",
"health" : 40,
"shield" : 40,
"speed" : 1.8,

View File

@ -1,6 +1,6 @@
{
"name" : "ATAF",
"description" : "TODO",
"description" : "The Advanced Tactical Assault Fighter (ATAF) is the single most powerful single-seat starfighter in existence. Only five have so far been manufactured owing to their tremendous development costs (each one said to be on par with a carrier). Their existence and even those selected to participate in the training program have been a closely guarded secret within the CSN. It is the spiritual successor to the TAF upon which a great deal of its design was based.",
"health" : 150,
"shield" : 2500,
"speed" : 2.25,

View File

@ -1,6 +1,6 @@
{
"name" : "Blizzard",
"description" : "TODO",
"description" : "Like many other heavy-class starfighters, the Blizzard relies on firepower to make up for its somewhat sluggish performance in battle. In this respect, it is equipped with five cannons and five missiles, making it a formidable opponent in battle. The fighter is rarely seen outside of Mace, however, its primary function being the protection of Tzac's home system.",
"health" : 120,
"shield" : 70,
"speed" : 1.85,

View File

@ -1,6 +1,6 @@
{
"name" : "Swarmer",
"description" : "TODO",
"description" : "",
"health" : 5,
"speed" : 2,
"reloadTime" : 8,

View File

@ -1,6 +1,6 @@
{
"name" : "Plasma Turret",
"description" : "TODO",
"description" : "",
"health" : 150,
"shield" : 25,
"speed" : 0,

View File

@ -1,6 +1,6 @@
{
"name" : "Rocket Turret",
"description" : "TODO",
"description" : "",
"health" : 125,
"shield" : 25,
"speed" : 0,

View File

@ -3,8 +3,8 @@
"name" : "prev",
"group" : "fighterDB",
"type" : "WT_IMG_BUTTON",
"x" : 540,
"y" : 110,
"x" : 500,
"y" : 138,
"w" : 150,
"h": 34,
"texture" : "gfx/widgets/optionsLeft.png"
@ -13,8 +13,8 @@
"name" : "next",
"group" : "fighterDB",
"type" : "WT_IMG_BUTTON",
"x" : 720,
"y" : 110,
"x" : 760,
"y" : 138,
"w" : 150,
"h": 34,
"texture" : "gfx/widgets/optionsRight.png"
@ -25,7 +25,7 @@
"type" : "WT_BUTTON",
"text" : "OK",
"x" : 640,
"y" : 635,
"y" : 660,
"w" : 150,
"h": 34
}

View File

@ -832,7 +832,7 @@ static void loadFighterDef(char *filename)
STRNCPY(e->name, cJSON_GetObjectItem(root, "name")->valuestring, MAX_NAME_LENGTH);
STRNCPY(e->defName, e->name, MAX_NAME_LENGTH);
STRNCPY(e->description, cJSON_GetObjectItem(root, "description")->valuestring, MAX_NAME_LENGTH);
STRNCPY(e->description, cJSON_GetObjectItem(root, "description")->valuestring, MAX_DESCRIPTION_LENGTH);
e->health = e->maxHealth = cJSON_GetObjectItem(root, "health")->valueint;
e->shield = e->maxShield = getJSONValue(root, "shield", 0);
e->speed = cJSON_GetObjectItem(root, "speed")->valuedouble;

View File

@ -32,6 +32,7 @@ static char *DB_TEXT;
static char *PAGE_TEXT;
static const char *gunName[BT_MAX];
static Entity **dbFighters;
static float rotation;
void initFighterDatabase(void)
{
@ -47,6 +48,8 @@ void initFighterDatabase(void)
gunName[BT_MAG] = _("Mag Cannon");
gunName[BT_ROCKET] = _("Rockets");
gunName[BT_MISSILE] = _("Missiles");
rotation = 0;
}
void destroyFighterDatabase(void)
@ -65,6 +68,11 @@ void initFighterDatabaseDisplay(void)
next->action = nextFighter;
}
void doFighterDatabase(void)
{
rotation++;
}
void drawFighterDatabase(void)
{
SDL_Rect r;
@ -76,7 +84,7 @@ void drawFighterDatabase(void)
SDL_RenderFillRect(app.renderer, NULL);
SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE);
r.w = 800;
r.w = 700;
r.h = 650;
r.x = (SCREEN_WIDTH / 2) - r.w / 2;
r.y = (SCREEN_HEIGHT / 2) - r.h / 2;
@ -94,9 +102,12 @@ void drawFighterDatabase(void)
drawText(SCREEN_WIDTH / 2, 130, 28, TA_CENTER, colors.white, fighter->name);
drawText(r.x + 25, 200, 22, TA_LEFT, colors.white, "Armour: %d", fighter->health);
drawText(r.x + 25, 250, 22, TA_LEFT, colors.white, "Shield: %d", fighter->shield);
drawText(r.x + 25, 300, 22, TA_LEFT, colors.white, "Speed: %f", fighter->speed);
blitRotated(fighter->texture, r.x + (r.w / 2), 250, rotation);
drawText(r.x + 25, 200, 22, TA_LEFT, colors.white, "Affiliation: %s", fighter->affiliation);
drawText(r.x + 25, 240, 22, TA_LEFT, colors.white, "Armour: %d", fighter->health);
drawText(r.x + 25, 280, 22, TA_LEFT, colors.white, "Shield: %d", fighter->shield);
drawText(r.x + 25, 320, 22, TA_LEFT, colors.white, "Speed: %f", fighter->speed);
y = 200;
@ -107,7 +118,7 @@ void drawFighterDatabase(void)
{
drawText(r.x + r.w - 25, y, 22, TA_RIGHT, colors.white, "%s x %d", gunName[i], numCannons);
y += 50;
y += 40;
}
}
@ -116,7 +127,11 @@ void drawFighterDatabase(void)
drawText(r.x + r.w - 25, y, 22, TA_RIGHT, colors.white, "Missiles x %d", fighter->missiles);
}
drawText(300, 500, 18, TA_LEFT, colors.white, fighter->description);
y = MAX(y, 320) + 75;
limitTextWidth(r.w - 100);
drawText(r.x + 25, y, 18, TA_LEFT, colors.white, fighter->description);
limitTextWidth(0);
drawWidgets("fighterDB");
}

View File

@ -25,7 +25,9 @@ extern Widget *getWidget(const char *name, const char *group);
extern char *getTranslatedString(char *string);
extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...);
extern Entity **getDBFighters(int *num);
extern void blitRotated(SDL_Texture *texture, int x, int y, float angle);
extern float mod(float n, float x);
extern void limitTextWidth(int width);
extern App app;
extern Colors colors;

View File

@ -90,6 +90,7 @@ void initTitle(void)
getWidget("ok", "stats")->action = ok;
getWidget("ok", "trophies")->action = ok;
getWidget("ok", "fighterDB")->action = ok;
show = SHOW_TITLE;
@ -137,6 +138,11 @@ static void logic(void)
app.doTrophyAlerts = 1;
if (show == SHOW_FIGHTER_DB)
{
doFighterDatabase();
}
doWidgets();
}

View File

@ -63,6 +63,7 @@ extern void drawTrophies(void);
extern void initCredits(void);
extern void drawFighterDatabase(void);
extern void initFighterDatabaseDisplay(void);
extern void doFighterDatabase(void);
extern App app;
extern Battle battle;

View File

@ -101,6 +101,7 @@ struct Entity {
char defName[MAX_NAME_LENGTH];
char groupName[MAX_NAME_LENGTH];
char description[MAX_DESCRIPTION_LENGTH];
char affiliation[MAX_NAME_LENGTH];
int active;
int spawned;
int id;