diff --git a/data/fighters/civilian.json b/data/craft/civilian.json similarity index 100% rename from data/fighters/civilian.json rename to data/craft/civilian.json diff --git a/data/craft/list.json b/data/craft/list.json new file mode 100644 index 0000000..f2f3af9 --- /dev/null +++ b/data/craft/list.json @@ -0,0 +1,7 @@ +[ + "data/craft/civilian.json", + "data/craft/tug.json", + "data/craft/shuttle.json", + "data/craft/supplyShip.json", + "data/craft/munitionsTransport.json" +] diff --git a/data/fighters/munitionsShip.json b/data/craft/munitionsTransport.json similarity index 60% rename from data/fighters/munitionsShip.json rename to data/craft/munitionsTransport.json index e68dba6..9417b6a 100644 --- a/data/fighters/munitionsShip.json +++ b/data/craft/munitionsTransport.json @@ -1,12 +1,11 @@ { - "name" : "Munitions Ship", + "name" : "Munitions Transport", "health" : 125, "shield" : 0, "speed" : 1.5, "reloadTime" : 10, "shieldRechargeRate" : 0, - "textureName" : "gfx/craft/munitionsShip.png", - "deathType" : "DT_NO_SPIN", + "textureName" : "gfx/craft/munitionsTransport.png", "flags" : "EF_TAKES_DAMAGE", "aiFlags" : "AIF_AVOIDS_COMBAT" } diff --git a/data/fighters/shuttle.json b/data/craft/shuttle.json similarity index 100% rename from data/fighters/shuttle.json rename to data/craft/shuttle.json diff --git a/data/fighters/supplyShip.json b/data/craft/supplyShip.json similarity index 100% rename from data/fighters/supplyShip.json rename to data/craft/supplyShip.json diff --git a/data/fighters/tug.json b/data/craft/tug.json similarity index 100% rename from data/fighters/tug.json rename to data/craft/tug.json diff --git a/data/fighters/list.json b/data/fighters/list.json index 787be24..3920926 100644 --- a/data/fighters/list.json +++ b/data/fighters/list.json @@ -13,9 +13,6 @@ "data/fighters/hyenaA.json", "data/fighters/hyenaB.json", "data/fighters/leopard.json", - "data/fighters/civilian.json", - "data/fighters/tug.json", - "data/fighters/shuttle.json", "data/fighters/kingfisher.json", "data/fighters/mantis.json", "data/fighters/rook.json", @@ -24,8 +21,5 @@ "data/fighters/hammerhead.json", "data/fighters/khepri.json", "data/fighters/cannonDart.json", - "data/fighters/missileDart.json", - "data/fighters/rocketTurret.json", - "data/fighters/supplyShip.json", - "data/fighters/munitionsShip.json" + "data/fighters/missileDart.json" ] diff --git a/data/turrets/list.json b/data/turrets/list.json new file mode 100644 index 0000000..d03a964 --- /dev/null +++ b/data/turrets/list.json @@ -0,0 +1,3 @@ +[ + "data/turrets/rocketTurret.json" +] diff --git a/data/fighters/rocketTurret.json b/data/turrets/rocketTurret.json similarity index 100% rename from data/fighters/rocketTurret.json rename to data/turrets/rocketTurret.json diff --git a/gfx/craft/munitionsShip.png b/gfx/craft/munitionsShip.png index 92b331e..258c3fc 100644 Binary files a/gfx/craft/munitionsShip.png and b/gfx/craft/munitionsShip.png differ diff --git a/gfx/craft/supplyShip.png b/gfx/craft/supplyShip.png index fb1c72a..8fd2670 100644 Binary files a/gfx/craft/supplyShip.png and b/gfx/craft/supplyShip.png differ diff --git a/src/battle/fighters.c b/src/battle/fighters.c index f292634..a379222 100644 --- a/src/battle/fighters.c +++ b/src/battle/fighters.c @@ -28,6 +28,7 @@ static void straightDie(void); static void randomizeDart(Entity *dart); static void randomizeDartGuns(Entity *dart); static void loadFighterDef(char *filename); +static void loadFighterDefList(char *filename); static Entity *getFighterDef(char *name); static Entity defHead, *defTail; @@ -596,16 +597,23 @@ static Entity *getFighterDef(char *name) } void loadFighterDefs(void) +{ + memset(&defHead, 0, sizeof(Entity)); + defTail = &defHead; + + loadFighterDefList("data/fighters/list.json"); + loadFighterDefList("data/craft/list.json"); + loadFighterDefList("data/turrets/list.json"); +} + +static void loadFighterDefList(char *filename) { cJSON *root, *node; char *text; - text = readFile(getFileLocation("data/fighters/list.json")); + text = readFile(getFileLocation(filename)); root = cJSON_Parse(text); - memset(&defHead, 0, sizeof(Entity)); - defTail = &defHead; - for (node = root->child ; node != NULL ; node = node->next) { loadFighterDef(node->valuestring);