From 41ce0e22818167c5ed73a67bd47efda5c01b96bc Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 7 Aug 2017 19:14:43 +0100 Subject: [PATCH] Start of fighter database. --- common.mk | 2 +- data/craft/civilian.json | 1 + data/craft/infTug.json | 1 + data/craft/munitionsTransport.json | 1 + data/craft/shuttle.json | 1 + data/craft/supplyShip.json | 1 + data/craft/tug.json | 1 + data/fighters/angel.json | 1 + data/fighters/ataf.json | 1 + data/fighters/blizzard.json | 1 + data/fighters/cannonDart.json | 1 + data/fighters/dart.json | 1 + data/fighters/firefly.json | 1 + data/fighters/hammerhead.json | 1 + data/fighters/hyenaA.json | 1 + data/fighters/hyenaB.json | 1 + data/fighters/jackal.json | 1 + data/fighters/khepri.json | 1 + data/fighters/kingfisher.json | 1 + data/fighters/leopard.json | 1 + data/fighters/lynx.json | 1 + data/fighters/mantis.json | 1 + data/fighters/missileDart.json | 1 + data/fighters/nymph.json | 1 + data/fighters/ray.json | 1 + data/fighters/razor.json | 1 + data/fighters/rocketDart.json | 1 + data/fighters/rook.json | 1 + data/fighters/scarab.json | 1 + data/fighters/shale.json | 1 + data/fighters/simpleDart.json | 1 + data/fighters/sk31.json | 1 + data/fighters/sk34.json | 1 + data/fighters/sphinx.json | 1 + data/fighters/staticDart.json | 1 + data/fighters/swarmer.json | 1 + data/fighters/taf.json | 1 + data/fighters/thunderhead.json | 1 + data/fighters/unarmedDart.json | 1 + data/fighters/zakSphinx.json | 1 + data/turrets/plasmaTurret.json | 1 + data/turrets/rapidPlasmaTurret.json | 1 + data/turrets/rocketTurret.json | 1 + data/widgets/fighterDB.json | 32 +++++++++++ data/widgets/title.json | 20 +++++-- src/battle/fighters.c | 33 +++++++++++- src/game/fighterDatabase.c | 84 +++++++++++++++++++++++++++++ src/game/fighterDatabase.h | 29 ++++++++++ src/game/title.c | 17 +++++- src/game/title.h | 5 +- src/structs.h | 3 +- src/system/init.c | 5 +- src/system/init.h | 3 +- 53 files changed, 261 insertions(+), 14 deletions(-) create mode 100644 data/widgets/fighterDB.json create mode 100644 src/game/fighterDatabase.c create mode 100644 src/game/fighterDatabase.h diff --git a/common.mk b/common.mk index aa7c863..da8736a 100644 --- a/common.mk +++ b/common.mk @@ -13,7 +13,7 @@ OBJS += battle.o bullets.o OBJS += capitalShips.o challengeHome.o challenges.o cJSON.o controls.o credits.o OBJS += debris.o dev.o draw.o OBJS += effects.o entities.o -OBJS += fighters.o +OBJS += fighters.o fighterDatabase.o OBJS += galacticMap.o game.o OBJS += hud.o OBJS += i18n.o init.o input.o io.o items.o diff --git a/data/craft/civilian.json b/data/craft/civilian.json index 6a55f95..24e52c5 100644 --- a/data/craft/civilian.json +++ b/data/craft/civilian.json @@ -1,5 +1,6 @@ { "name" : "Civilian", + "description" : "", "health" : 15, "speed" : 1.85, "texture" : "gfx/craft/civilian01.png", diff --git a/data/craft/infTug.json b/data/craft/infTug.json index 2e406b5..cf94d4a 100644 --- a/data/craft/infTug.json +++ b/data/craft/infTug.json @@ -1,5 +1,6 @@ { "name" : "INF Tug", + "description" : "TODO", "health" : 50, "speed" : 1.85, "reloadTime" : 10, diff --git a/data/craft/munitionsTransport.json b/data/craft/munitionsTransport.json index d5fcbcc..7ab1ddd 100644 --- a/data/craft/munitionsTransport.json +++ b/data/craft/munitionsTransport.json @@ -1,5 +1,6 @@ { "name" : "Munitions Transport", + "description" : "TODO", "health" : 150, "shield" : 50, "speed" : 1.5, diff --git a/data/craft/shuttle.json b/data/craft/shuttle.json index 931bb22..dd83afd 100644 --- a/data/craft/shuttle.json +++ b/data/craft/shuttle.json @@ -1,5 +1,6 @@ { "name" : "Shuttle", + "description" : "TODO", "health" : 15, "shield" : 15, "speed" : 2, diff --git a/data/craft/supplyShip.json b/data/craft/supplyShip.json index b2eb959..2c379b3 100644 --- a/data/craft/supplyShip.json +++ b/data/craft/supplyShip.json @@ -1,5 +1,6 @@ { "name" : "Supply Ship", + "description" : "TODO", "health" : 150, "shield" : 50, "speed" : 1.5, diff --git a/data/craft/tug.json b/data/craft/tug.json index 88302c9..26b22f3 100644 --- a/data/craft/tug.json +++ b/data/craft/tug.json @@ -1,5 +1,6 @@ { "name" : "Tug", + "description" : "TODO", "health" : 50, "speed" : 1.85, "reloadTime" : 10, diff --git a/data/fighters/angel.json b/data/fighters/angel.json index 58915d2..132058f 100644 --- a/data/fighters/angel.json +++ b/data/fighters/angel.json @@ -1,5 +1,6 @@ { "name" : "Angel", + "description" : "TODO", "health" : 40, "shield" : 40, "speed" : 1.8, diff --git a/data/fighters/ataf.json b/data/fighters/ataf.json index 05961f1..cce320f 100644 --- a/data/fighters/ataf.json +++ b/data/fighters/ataf.json @@ -1,5 +1,6 @@ { "name" : "ATAF", + "description" : "TODO", "health" : 150, "shield" : 2500, "speed" : 2.25, diff --git a/data/fighters/blizzard.json b/data/fighters/blizzard.json index 89e83b1..d44ec7a 100644 --- a/data/fighters/blizzard.json +++ b/data/fighters/blizzard.json @@ -1,5 +1,6 @@ { "name" : "Blizzard", + "description" : "TODO", "health" : 120, "shield" : 70, "speed" : 1.85, diff --git a/data/fighters/cannonDart.json b/data/fighters/cannonDart.json index 3533422..fcf4789 100644 --- a/data/fighters/cannonDart.json +++ b/data/fighters/cannonDart.json @@ -1,5 +1,6 @@ { "name" : "Cannon Dart", + "description" : "", "health" : 15, "speed" : 2.1, "reloadTime" : 24, diff --git a/data/fighters/dart.json b/data/fighters/dart.json index 564f2e4..61e8d31 100644 --- a/data/fighters/dart.json +++ b/data/fighters/dart.json @@ -1,5 +1,6 @@ { "name" : "Dart", + "description" : "TODO", "health" : 15, "speed" : 2.1, "reloadTime" : 24, diff --git a/data/fighters/firefly.json b/data/fighters/firefly.json index 459c105..56dec37 100644 --- a/data/fighters/firefly.json +++ b/data/fighters/firefly.json @@ -1,5 +1,6 @@ { "name" : "Firefly", + "description" : "TODO", "health" : 50, "shield" : 50, "speed" : 1.85, diff --git a/data/fighters/hammerhead.json b/data/fighters/hammerhead.json index 4cf4963..ad1281e 100644 --- a/data/fighters/hammerhead.json +++ b/data/fighters/hammerhead.json @@ -1,5 +1,6 @@ { "name" : "Hammerhead", + "description" : "TODO", "health" : 60, "shield" : 50, "speed" : 1.7, diff --git a/data/fighters/hyenaA.json b/data/fighters/hyenaA.json index aa89e3d..cb62bc3 100644 --- a/data/fighters/hyenaA.json +++ b/data/fighters/hyenaA.json @@ -1,5 +1,6 @@ { "name" : "Hyena-A", + "description" : "TODO", "health" : 90, "shield" : 45, "speed" : 1.85, diff --git a/data/fighters/hyenaB.json b/data/fighters/hyenaB.json index bb79f80..5eb7005 100644 --- a/data/fighters/hyenaB.json +++ b/data/fighters/hyenaB.json @@ -1,5 +1,6 @@ { "name" : "Hyena-B", + "description" : "TODO", "health" : 90, "shield" : 45, "speed" : 1.85, diff --git a/data/fighters/jackal.json b/data/fighters/jackal.json index 42e9de6..addaa53 100644 --- a/data/fighters/jackal.json +++ b/data/fighters/jackal.json @@ -1,5 +1,6 @@ { "name" : "Jackal", + "description" : "TODO", "health" : 75, "shield" : 75, "speed" : 2, diff --git a/data/fighters/khepri.json b/data/fighters/khepri.json index a9392d1..fc7c866 100644 --- a/data/fighters/khepri.json +++ b/data/fighters/khepri.json @@ -1,5 +1,6 @@ { "name" : "Khepri", + "description" : "TODO", "health" : 60, "shield" : 50, "speed" : 1.7, diff --git a/data/fighters/kingfisher.json b/data/fighters/kingfisher.json index c76bcd1..b29b666 100644 --- a/data/fighters/kingfisher.json +++ b/data/fighters/kingfisher.json @@ -1,5 +1,6 @@ { "name" : "Kingfisher", + "description" : "TODO", "health" : 65, "shield" : 65, "speed" : 1.85, diff --git a/data/fighters/leopard.json b/data/fighters/leopard.json index 5cbf824..7851c6e 100644 --- a/data/fighters/leopard.json +++ b/data/fighters/leopard.json @@ -1,5 +1,6 @@ { "name" : "Leopard", + "description" : "TODO", "health" : 125, "shield" : 75, "speed" : 1.7, diff --git a/data/fighters/lynx.json b/data/fighters/lynx.json index 4fb7ed0..6314491 100644 --- a/data/fighters/lynx.json +++ b/data/fighters/lynx.json @@ -1,5 +1,6 @@ { "name" : "Lynx", + "description" : "TODO", "health" : 75, "shield" : 50, "speed" : 1.7, diff --git a/data/fighters/mantis.json b/data/fighters/mantis.json index 2f4d09b..03dcd52 100644 --- a/data/fighters/mantis.json +++ b/data/fighters/mantis.json @@ -1,5 +1,6 @@ { "name" : "Mantis", + "description" : "TODO", "health" : 50, "shield" : 75, "speed" : 1.85, diff --git a/data/fighters/missileDart.json b/data/fighters/missileDart.json index 896f79a..6aa3f66 100644 --- a/data/fighters/missileDart.json +++ b/data/fighters/missileDart.json @@ -1,5 +1,6 @@ { "name" : "Missile Dart", + "description" : "", "health" : 15, "speed" : 2.1, "reloadTime" : 24, diff --git a/data/fighters/nymph.json b/data/fighters/nymph.json index da2857a..51aefd1 100644 --- a/data/fighters/nymph.json +++ b/data/fighters/nymph.json @@ -1,5 +1,6 @@ { "name" : "Nymph", + "description" : "TODO", "health" : 45, "shield" : 40, "speed" : 2, diff --git a/data/fighters/ray.json b/data/fighters/ray.json index 379df8b..162d0cf 100644 --- a/data/fighters/ray.json +++ b/data/fighters/ray.json @@ -1,5 +1,6 @@ { "name" : "Ray", + "description" : "TODO", "health" : 70, "shield" : 70, "speed" : 1.85, diff --git a/data/fighters/razor.json b/data/fighters/razor.json index fea0345..72f7bdd 100644 --- a/data/fighters/razor.json +++ b/data/fighters/razor.json @@ -1,5 +1,6 @@ { "name" : "Razor", + "description" : "TODO", "health" : 45, "shield" : 55, "speed" : 1.75, diff --git a/data/fighters/rocketDart.json b/data/fighters/rocketDart.json index 59205ea..0ed8f78 100644 --- a/data/fighters/rocketDart.json +++ b/data/fighters/rocketDart.json @@ -1,5 +1,6 @@ { "name" : "Rocket Dart", + "description" : "", "health" : 15, "speed" : 2.1, "reloadTime" : 35, diff --git a/data/fighters/rook.json b/data/fighters/rook.json index 86d9673..da33e3a 100644 --- a/data/fighters/rook.json +++ b/data/fighters/rook.json @@ -1,5 +1,6 @@ { "name" : "Rook", + "description" : "TODO", "health" : 110, "shield" : 80, "speed" : 1.7, diff --git a/data/fighters/scarab.json b/data/fighters/scarab.json index 3998db3..253adca 100644 --- a/data/fighters/scarab.json +++ b/data/fighters/scarab.json @@ -1,5 +1,6 @@ { "name" : "Scarab", + "description" : "TODO", "health" : 80, "shield" : 65, "speed" : 1.7, diff --git a/data/fighters/shale.json b/data/fighters/shale.json index 77fe10a..5adf1a0 100644 --- a/data/fighters/shale.json +++ b/data/fighters/shale.json @@ -1,5 +1,6 @@ { "name" : "Shale", + "description" : "TODO", "health" : 50, "shield" : 50, "speed" : 2, diff --git a/data/fighters/simpleDart.json b/data/fighters/simpleDart.json index 7be9f2d..57c2453 100644 --- a/data/fighters/simpleDart.json +++ b/data/fighters/simpleDart.json @@ -1,5 +1,6 @@ { "name" : "Simple Dart", + "description" : "", "health" : 15, "speed" : 2.1, "reloadTime" : 24, diff --git a/data/fighters/sk31.json b/data/fighters/sk31.json index 1272483..e51bc8b 100644 --- a/data/fighters/sk31.json +++ b/data/fighters/sk31.json @@ -1,5 +1,6 @@ { "name" : "SK-31", + "description" : "TODO", "health" : 85, "shield" : 50, "speed" : 1.8, diff --git a/data/fighters/sk34.json b/data/fighters/sk34.json index 063db0a..c82d167 100644 --- a/data/fighters/sk34.json +++ b/data/fighters/sk34.json @@ -1,5 +1,6 @@ { "name" : "SK-34", + "description" : "TODO", "health" : 100, "shield" : 45, "speed" : 1.7, diff --git a/data/fighters/sphinx.json b/data/fighters/sphinx.json index 1deddfc..93af649 100644 --- a/data/fighters/sphinx.json +++ b/data/fighters/sphinx.json @@ -1,5 +1,6 @@ { "name" : "Sphinx", + "description" : "TODO", "health" : 110, "shield" : 75, "speed" : 1.85, diff --git a/data/fighters/staticDart.json b/data/fighters/staticDart.json index 882ae85..fb4eb2f 100644 --- a/data/fighters/staticDart.json +++ b/data/fighters/staticDart.json @@ -1,5 +1,6 @@ { "name" : "Static Dart", + "description" : "", "health" : 15, "speed" : 0, "reloadTime" : 24, diff --git a/data/fighters/swarmer.json b/data/fighters/swarmer.json index 28ba13e..dfd5448 100644 --- a/data/fighters/swarmer.json +++ b/data/fighters/swarmer.json @@ -1,5 +1,6 @@ { "name" : "Swarmer", + "description" : "TODO", "health" : 5, "speed" : 2, "reloadTime" : 8, diff --git a/data/fighters/taf.json b/data/fighters/taf.json index c2bf7d8..f985d68 100644 --- a/data/fighters/taf.json +++ b/data/fighters/taf.json @@ -1,5 +1,6 @@ { "name" : "TAF", + "description" : "TODO", "health" : 35, "shield" : 35, "speed" : 2, diff --git a/data/fighters/thunderhead.json b/data/fighters/thunderhead.json index cc5357a..bdbfbf4 100644 --- a/data/fighters/thunderhead.json +++ b/data/fighters/thunderhead.json @@ -1,5 +1,6 @@ { "name" : "Thunderhead", + "description" : "TODO", "health" : 90, "shield" : 65, "speed" : 1.7, diff --git a/data/fighters/unarmedDart.json b/data/fighters/unarmedDart.json index f4e03d7..9b29aff 100644 --- a/data/fighters/unarmedDart.json +++ b/data/fighters/unarmedDart.json @@ -1,5 +1,6 @@ { "name" : "Unarmed Dart", + "description" : "", "health" : 15, "speed" : 2.1, "reloadTime" : 24, diff --git a/data/fighters/zakSphinx.json b/data/fighters/zakSphinx.json index d7bbc16..fa9fdc9 100644 --- a/data/fighters/zakSphinx.json +++ b/data/fighters/zakSphinx.json @@ -1,5 +1,6 @@ { "name" : "Unique Sphinx", + "description" : "", "health" : 999, "shield" : 999, "speed" : 1.6, diff --git a/data/turrets/plasmaTurret.json b/data/turrets/plasmaTurret.json index 9579a3c..a0f1a96 100644 --- a/data/turrets/plasmaTurret.json +++ b/data/turrets/plasmaTurret.json @@ -1,5 +1,6 @@ { "name" : "Plasma Turret", + "description" : "TODO", "health" : 150, "shield" : 25, "speed" : 0, diff --git a/data/turrets/rapidPlasmaTurret.json b/data/turrets/rapidPlasmaTurret.json index a79a88c..240a2e0 100644 --- a/data/turrets/rapidPlasmaTurret.json +++ b/data/turrets/rapidPlasmaTurret.json @@ -1,5 +1,6 @@ { "name" : "Rapid Plasma Turret", + "description" : "", "health" : 150, "shield" : 25, "speed" : 0, diff --git a/data/turrets/rocketTurret.json b/data/turrets/rocketTurret.json index 5040be9..9b4c0b3 100644 --- a/data/turrets/rocketTurret.json +++ b/data/turrets/rocketTurret.json @@ -1,5 +1,6 @@ { "name" : "Rocket Turret", + "description" : "TODO", "health" : 125, "shield" : 25, "speed" : 0, diff --git a/data/widgets/fighterDB.json b/data/widgets/fighterDB.json new file mode 100644 index 0000000..3c7c33c --- /dev/null +++ b/data/widgets/fighterDB.json @@ -0,0 +1,32 @@ +[ + { + "name" : "prev", + "group" : "fighterDB", + "type" : "WT_IMG_BUTTON", + "x" : 540, + "y" : 110, + "w" : 150, + "h": 34, + "texture" : "gfx/widgets/optionsLeft.png" + }, + { + "name" : "next", + "group" : "fighterDB", + "type" : "WT_IMG_BUTTON", + "x" : 720, + "y" : 110, + "w" : 150, + "h": 34, + "texture" : "gfx/widgets/optionsRight.png" + }, + { + "name" : "ok", + "group" : "fighterDB", + "type" : "WT_BUTTON", + "text" : "OK", + "x" : 640, + "y" : 635, + "w" : 150, + "h": 34 + } +] diff --git a/data/widgets/title.json b/data/widgets/title.json index 48d9b75..a978414 100644 --- a/data/widgets/title.json +++ b/data/widgets/title.json @@ -15,7 +15,7 @@ "type" : "WT_BUTTON", "text" : "Challenges", "x" : -1, - "y" : 280, + "y" : 260, "w" : 200, "h": 34 }, @@ -25,7 +25,7 @@ "type" : "WT_BUTTON", "text" : "Trophies", "x" : -1, - "y" : 360, + "y" : 320, "w" : 200, "h": 34 }, @@ -35,6 +35,16 @@ "type" : "WT_BUTTON", "text" : "Stats", "x" : -1, + "y" : 380, + "w" : 200, + "h": 34 + }, + { + "name" : "fighterDB", + "group" : "title", + "type" : "WT_BUTTON", + "text" : "Fighter Database", + "x" : -1, "y" : 440, "w" : 200, "h": 34 @@ -45,7 +55,7 @@ "type" : "WT_BUTTON", "text" : "Options", "x" : -1, - "y" : 520, + "y" : 500, "w" : 200, "h": 34 }, @@ -55,7 +65,7 @@ "type" : "WT_BUTTON", "text" : "Credits", "x" : -1, - "y" : 600, + "y" : 560, "w" : 200, "h": 34 }, @@ -65,7 +75,7 @@ "type" : "WT_BUTTON", "text" : "Quit", "x" : -1, - "y" : 680, + "y" : 620, "w" : 200, "h": 34 } diff --git a/src/battle/fighters.c b/src/battle/fighters.c index e4c2687..ff7b661 100644 --- a/src/battle/fighters.c +++ b/src/battle/fighters.c @@ -1,5 +1,5 @@ /* -Copyright (C) 2015-2016 Parallel Realities +Copyright (C) 2015-2017 Parallel Realities This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -747,6 +747,36 @@ static Entity *getFighterDef(char *name) exit(1); } +Entity **getDBFighters(int *num) +{ + Entity *e, **dbFighters; + int i; + + i = *num = 0; + + for (e = defHead.next ; e != NULL ; e = e->next) + { + if (strlen(e->description) > 0) + { + *num = *num + 1; + } + } + + dbFighters = malloc(sizeof(Entity*) * *num); + + for (e = defHead.next ; e != NULL ; e = e->next) + { + if (strlen(e->description) > 0) + { + dbFighters[i] = e; + } + + i++; + } + + return dbFighters; +} + void loadFighterDefs(void) { memset(&defHead, 0, sizeof(Entity)); @@ -802,6 +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); 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 new file mode 100644 index 0000000..aa9269c --- /dev/null +++ b/src/game/fighterDatabase.c @@ -0,0 +1,84 @@ +/* +Copyright (C) 2015-2017 Parallel Realities + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#include "fighterDatabase.h" + +static int page; +static int maxPages; +static Widget *prev; +static Widget *next; +static char *DB_TEXT; +static char *PAGE_TEXT; +static void prevFighter(void); +static void nextFighter(void); + +void initFighterDatabase(void) +{ + DB_TEXT = _("Fighter Database"); + PAGE_TEXT = _("Page %d / %d"); +} + +void initFighterDatabaseDisplay(void) +{ + page = 0; + maxPages = 1; + + prev = getWidget("prev", "fighterDB"); + prev->action = prevFighter; + prev->visible = 0; + + next = getWidget("next", "fighterDB"); + next->action = nextFighter; + next->visible = 1; +} + +void drawFighterDatabase(void) +{ + SDL_Rect r; + + SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND); + SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128); + SDL_RenderFillRect(app.renderer, NULL); + SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE); + + r.w = 800; + r.h = 650; + r.x = (SCREEN_WIDTH / 2) - r.w / 2; + r.y = (SCREEN_HEIGHT / 2) - r.h / 2; + + SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 0); + SDL_RenderFillRect(app.renderer, &r); + SDL_SetRenderDrawColor(app.renderer, 200, 200, 200, 255); + SDL_RenderDrawRect(app.renderer, &r); + + drawText(SCREEN_WIDTH / 2, 50, 28, TA_CENTER, colors.white, DB_TEXT); + + drawText(SCREEN_WIDTH / 2, 90, 16, TA_CENTER, colors.lightGrey, PAGE_TEXT, page + 1, (int)maxPages); + + drawWidgets("fighterDB"); +} + +static void prevFighter(void) +{ +} + +static void nextFighter(void) +{ +} diff --git a/src/game/fighterDatabase.h b/src/game/fighterDatabase.h new file mode 100644 index 0000000..1640617 --- /dev/null +++ b/src/game/fighterDatabase.h @@ -0,0 +1,29 @@ +/* +Copyright (C) 2015-2017 Parallel Realities + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#include "../common.h" + +extern void drawWidgets(char *groupName); +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 App app; +extern Colors colors; diff --git a/src/game/title.c b/src/game/title.c index 396ece5..fb32baf 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -1,5 +1,5 @@ /* -Copyright (C) 2015-2016 Parallel Realities +Copyright (C) 2015-2017 Parallel Realities This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -30,6 +30,7 @@ static void campaign(void); static void challenges(void); static void trophies(void); static void stats(void); +static void fighterDatabase(void); static void ok(void); static void options(void); static void credits(void); @@ -82,6 +83,7 @@ void initTitle(void) getWidget("challenges", "title")->action = challenges; getWidget("trophies", "title")->action = trophies; getWidget("stats", "title")->action = stats; + getWidget("fighterDB", "title")->action = fighterDatabase; getWidget("options", "title")->action = options; getWidget("credits", "title")->action = credits; getWidget("quit", "title")->action = quit; @@ -181,7 +183,7 @@ static void draw(void) blit(pandoranWar, SCREEN_WIDTH / 2, 110, 1); - drawText(10, SCREEN_HEIGHT - 25, 14, TA_LEFT, colors.white, "Copyright Parallel Realities, 2015-2016"); + drawText(10, SCREEN_HEIGHT - 25, 14, TA_LEFT, colors.white, "Copyright Parallel Realities, 2015-2017"); drawText(SCREEN_WIDTH - 10, SCREEN_HEIGHT - 25, 14, TA_RIGHT, colors.white, "Version %.2f-%d", VERSION, REVISION); switch (show) @@ -201,6 +203,10 @@ static void draw(void) case SHOW_TROPHIES: drawTrophies(); break; + + case SHOW_FIGHTER_DB: + drawFighterDatabase(); + break; } } @@ -250,6 +256,13 @@ static void trophies(void) initTrophiesDisplay(); } +static void fighterDatabase(void) +{ + show = SHOW_FIGHTER_DB; + + initFighterDatabaseDisplay(); +} + static void options(void) { selectWidget("ok", "options"); diff --git a/src/game/title.h b/src/game/title.h index 8d21d4e..7f43d71 100644 --- a/src/game/title.h +++ b/src/game/title.h @@ -1,5 +1,5 @@ /* -Copyright (C) 2015-2016 Parallel Realities +Copyright (C) 2015-2017 Parallel Realities This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SHOW_STATS 1 #define SHOW_OPTIONS 2 #define SHOW_TROPHIES 3 +#define SHOW_FIGHTER_DB 4 #define NUM_FIGHTERS 12 @@ -60,6 +61,8 @@ extern void clearInput(void); extern void initTrophiesDisplay(void); extern void drawTrophies(void); extern void initCredits(void); +extern void drawFighterDatabase(void); +extern void initFighterDatabaseDisplay(void); extern App app; extern Battle battle; diff --git a/src/structs.h b/src/structs.h index 88368e3..9e2373f 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,5 +1,5 @@ /* -Copyright (C) 2015-2016 Parallel Realities +Copyright (C) 2015-2017 Parallel Realities This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -100,6 +100,7 @@ struct Entity { char name[MAX_NAME_LENGTH]; char defName[MAX_NAME_LENGTH]; char groupName[MAX_NAME_LENGTH]; + char description[MAX_DESCRIPTION_LENGTH]; int active; int spawned; int id; diff --git a/src/system/init.c b/src/system/init.c index bff80ec..bab65b7 100644 --- a/src/system/init.c +++ b/src/system/init.c @@ -1,5 +1,5 @@ /* -Copyright (C) 2015-2016 Parallel Realities +Copyright (C) 2015-2017 Parallel Realities This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -141,7 +141,8 @@ void initGameSystem(void) initBackground, initStars, initControls, - initTrophies + initTrophies, + initFighterDatabase }; numInitFuns = sizeof(initFuncs) / sizeof(void*); diff --git a/src/system/init.h b/src/system/init.h index 505fd03..08801e4 100644 --- a/src/system/init.h +++ b/src/system/init.h @@ -1,5 +1,5 @@ /* -Copyright (C) 2015-2016 Parallel Realities +Copyright (C) 2015-2017 Parallel Realities This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -48,6 +48,7 @@ extern void initWidgets(void); extern void initBackground(void); extern void initResources(void); extern void initControls(void); +extern void initFighterDatabase(void); extern void destroyLookups(void); extern void destroyFonts(void); extern void destroySounds(void);