Split space craft into separate lists.

This commit is contained in:
Steve 2015-12-26 21:08:53 +00:00
parent e2b7576f89
commit 7f055102bf
12 changed files with 25 additions and 14 deletions

7
data/craft/list.json Normal file
View File

@ -0,0 +1,7 @@
[
"data/craft/civilian.json",
"data/craft/tug.json",
"data/craft/shuttle.json",
"data/craft/supplyShip.json",
"data/craft/munitionsTransport.json"
]

View File

@ -1,12 +1,11 @@
{ {
"name" : "Munitions Ship", "name" : "Munitions Transport",
"health" : 125, "health" : 125,
"shield" : 0, "shield" : 0,
"speed" : 1.5, "speed" : 1.5,
"reloadTime" : 10, "reloadTime" : 10,
"shieldRechargeRate" : 0, "shieldRechargeRate" : 0,
"textureName" : "gfx/craft/munitionsShip.png", "textureName" : "gfx/craft/munitionsTransport.png",
"deathType" : "DT_NO_SPIN",
"flags" : "EF_TAKES_DAMAGE", "flags" : "EF_TAKES_DAMAGE",
"aiFlags" : "AIF_AVOIDS_COMBAT" "aiFlags" : "AIF_AVOIDS_COMBAT"
} }

View File

@ -13,9 +13,6 @@
"data/fighters/hyenaA.json", "data/fighters/hyenaA.json",
"data/fighters/hyenaB.json", "data/fighters/hyenaB.json",
"data/fighters/leopard.json", "data/fighters/leopard.json",
"data/fighters/civilian.json",
"data/fighters/tug.json",
"data/fighters/shuttle.json",
"data/fighters/kingfisher.json", "data/fighters/kingfisher.json",
"data/fighters/mantis.json", "data/fighters/mantis.json",
"data/fighters/rook.json", "data/fighters/rook.json",
@ -24,8 +21,5 @@
"data/fighters/hammerhead.json", "data/fighters/hammerhead.json",
"data/fighters/khepri.json", "data/fighters/khepri.json",
"data/fighters/cannonDart.json", "data/fighters/cannonDart.json",
"data/fighters/missileDart.json", "data/fighters/missileDart.json"
"data/fighters/rocketTurret.json",
"data/fighters/supplyShip.json",
"data/fighters/munitionsShip.json"
] ]

3
data/turrets/list.json Normal file
View File

@ -0,0 +1,3 @@
[
"data/turrets/rocketTurret.json"
]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -28,6 +28,7 @@ static void straightDie(void);
static void randomizeDart(Entity *dart); static void randomizeDart(Entity *dart);
static void randomizeDartGuns(Entity *dart); static void randomizeDartGuns(Entity *dart);
static void loadFighterDef(char *filename); static void loadFighterDef(char *filename);
static void loadFighterDefList(char *filename);
static Entity *getFighterDef(char *name); static Entity *getFighterDef(char *name);
static Entity defHead, *defTail; static Entity defHead, *defTail;
@ -596,16 +597,23 @@ static Entity *getFighterDef(char *name)
} }
void loadFighterDefs(void) 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; cJSON *root, *node;
char *text; char *text;
text = readFile(getFileLocation("data/fighters/list.json")); text = readFile(getFileLocation(filename));
root = cJSON_Parse(text); root = cJSON_Parse(text);
memset(&defHead, 0, sizeof(Entity));
defTail = &defHead;
for (node = root->child ; node != NULL ; node = node->next) for (node = root->child ; node != NULL ; node = node->next)
{ {
loadFighterDef(node->valuestring); loadFighterDef(node->valuestring);