diff --git a/data/craft/infTug.json b/data/craft/infTug.json index cf94d4a..b4e6a4d 100644 --- a/data/craft/infTug.json +++ b/data/craft/infTug.json @@ -1,6 +1,6 @@ { "name" : "INF Tug", - "description" : "TODO", + "description" : "", "health" : 50, "speed" : 1.85, "reloadTime" : 10, diff --git a/data/craft/munitionsTransport.json b/data/craft/munitionsTransport.json index 7ab1ddd..7f6c735 100644 --- a/data/craft/munitionsTransport.json +++ b/data/craft/munitionsTransport.json @@ -1,6 +1,6 @@ { "name" : "Munitions Transport", - "description" : "TODO", + "description" : "", "health" : 150, "shield" : 50, "speed" : 1.5, diff --git a/data/craft/shuttle.json b/data/craft/shuttle.json index dd83afd..de7f66a 100644 --- a/data/craft/shuttle.json +++ b/data/craft/shuttle.json @@ -1,6 +1,6 @@ { "name" : "Shuttle", - "description" : "TODO", + "description" : "", "health" : 15, "shield" : 15, "speed" : 2, diff --git a/data/craft/supplyShip.json b/data/craft/supplyShip.json index 2c379b3..ccd7a29 100644 --- a/data/craft/supplyShip.json +++ b/data/craft/supplyShip.json @@ -1,6 +1,6 @@ { "name" : "Supply Ship", - "description" : "TODO", + "description" : "", "health" : 150, "shield" : 50, "speed" : 1.5, diff --git a/data/craft/tug.json b/data/craft/tug.json index 26b22f3..940bd79 100644 --- a/data/craft/tug.json +++ b/data/craft/tug.json @@ -1,6 +1,6 @@ { "name" : "Tug", - "description" : "TODO", + "description" : "", "health" : 50, "speed" : 1.85, "reloadTime" : 10, diff --git a/data/fighters/angel.json b/data/fighters/angel.json index 132058f..df4cf12 100644 --- a/data/fighters/angel.json +++ b/data/fighters/angel.json @@ -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, diff --git a/data/fighters/ataf.json b/data/fighters/ataf.json index cce320f..530fa5e 100644 --- a/data/fighters/ataf.json +++ b/data/fighters/ataf.json @@ -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, diff --git a/data/fighters/blizzard.json b/data/fighters/blizzard.json index d44ec7a..3273b54 100644 --- a/data/fighters/blizzard.json +++ b/data/fighters/blizzard.json @@ -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, diff --git a/data/fighters/swarmer.json b/data/fighters/swarmer.json index dfd5448..31161b7 100644 --- a/data/fighters/swarmer.json +++ b/data/fighters/swarmer.json @@ -1,6 +1,6 @@ { "name" : "Swarmer", - "description" : "TODO", + "description" : "", "health" : 5, "speed" : 2, "reloadTime" : 8, diff --git a/data/turrets/plasmaTurret.json b/data/turrets/plasmaTurret.json index a0f1a96..d958dfd 100644 --- a/data/turrets/plasmaTurret.json +++ b/data/turrets/plasmaTurret.json @@ -1,6 +1,6 @@ { "name" : "Plasma Turret", - "description" : "TODO", + "description" : "", "health" : 150, "shield" : 25, "speed" : 0, diff --git a/data/turrets/rocketTurret.json b/data/turrets/rocketTurret.json index 9b4c0b3..dedffc7 100644 --- a/data/turrets/rocketTurret.json +++ b/data/turrets/rocketTurret.json @@ -1,6 +1,6 @@ { "name" : "Rocket Turret", - "description" : "TODO", + "description" : "", "health" : 125, "shield" : 25, "speed" : 0, diff --git a/data/widgets/fighterDB.json b/data/widgets/fighterDB.json index 3c7c33c..9dfdc24 100644 --- a/data/widgets/fighterDB.json +++ b/data/widgets/fighterDB.json @@ -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 } diff --git a/src/battle/fighters.c b/src/battle/fighters.c index f1247eb..755336c 100644 --- a/src/battle/fighters.c +++ b/src/battle/fighters.c @@ -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; diff --git a/src/game/fighterDatabase.c b/src/game/fighterDatabase.c index 3bcec8f..a4482a8 100644 --- a/src/game/fighterDatabase.c +++ b/src/game/fighterDatabase.c @@ -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"); } diff --git a/src/game/fighterDatabase.h b/src/game/fighterDatabase.h index d1702d5..f481cf5 100644 --- a/src/game/fighterDatabase.h +++ b/src/game/fighterDatabase.h @@ -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; diff --git a/src/game/title.c b/src/game/title.c index fb32baf..0e0e469 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -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(); } diff --git a/src/game/title.h b/src/game/title.h index 7f43d71..1d9a59d 100644 --- a/src/game/title.h +++ b/src/game/title.h @@ -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; diff --git a/src/structs.h b/src/structs.h index 9e2373f..252f372 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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;