diff --git a/data/missions/alba/01 - patrol #1.json b/data/missions/alba/01 - patrol #1.json index 94869e4..eb96ccf 100644 --- a/data/missions/alba/01 - patrol #1.json +++ b/data/missions/alba/01 - patrol #1.json @@ -25,8 +25,8 @@ "types" : "Firefly;Nymph", "number" : 3, "side" : "SIDE_ALLIES", - "x" : 640, - "y" : 1000, + "x" : 25, + "y" : 26, "scatter" : 64 } ], @@ -34,8 +34,8 @@ { "type" : "ET_WAYPOINT", "number" : 5, - "x" : 640, - "y" : 480, + "x" : 25, + "y" : 25, "scatter" : 7500 } ] diff --git a/data/missions/alba/02 - patrol #2.json b/data/missions/alba/02 - patrol #2.json index acb1cee..352b6f2 100644 --- a/data/missions/alba/02 - patrol #2.json +++ b/data/missions/alba/02 - patrol #2.json @@ -48,8 +48,8 @@ "types" : "Firefly;Nymph", "number" : 4, "side" : "SIDE_ALLIES", - "x" : 640, - "y" : 1000, + "x" : 25, + "y" : 26, "scatter" : 64 }, { @@ -57,8 +57,8 @@ "types" : "Jackal", "number" : 3, "side" : "SIDE_PANDORAN", - "x" : 640, - "y" : 1000, + "x" : 25, + "y" : 26, "scatter" : 64, "active" : 0 } @@ -67,8 +67,8 @@ { "type" : "ET_WAYPOINT", "number" : 5, - "x" : 640, - "y" : 480, + "x" : 25, + "y" : 25, "scatter" : 7500 } ] diff --git a/data/missions/clarke/01 - clarke defence #1.json b/data/missions/clarke/01 - clarke defence #1.json index 98ba179..c5b4c57 100644 --- a/data/missions/clarke/01 - clarke defence #1.json +++ b/data/missions/clarke/01 - clarke defence #1.json @@ -27,8 +27,8 @@ "name" : "ALLIES", "types" : "Firefly;Nymph;Leopard;Hyena", "side" : "SIDE_ALLIES", - "x" : 640, - "y" : 0, + "x" : 25, + "y" : 24, "number" : 100, "scatter" : 5000 }, @@ -36,8 +36,8 @@ "name" : "Pandoran", "types" : "Jackal;Sphinx", "side" : "SIDE_PANDORAN", - "x" : 7000, - "y" : 0, + "x" : 35, + "y" : 24, "number" : 80, "scatter" : 5000 } diff --git a/data/missions/coyote/01 - coyote assault #1.json b/data/missions/coyote/01 - coyote assault #1.json index afad183..c51c68b 100644 --- a/data/missions/coyote/01 - coyote assault #1.json +++ b/data/missions/coyote/01 - coyote assault #1.json @@ -32,16 +32,16 @@ "types" : "ATAF", "number" : 4, "side" : "SIDE_ALLIES", - "x" : 0, - "y" : 0 + "x" : 26, + "y" : 25 }, { "name" : "Pandoran", "types" : "Jackal;Sphinx;Nymph", "number" : 20, "side" : "SIDE_PANDORAN", - "x" : -5000, - "y" : 0, + "x" : 20, + "y" : 25, "scatter" : 2000 }, { @@ -49,8 +49,8 @@ "types" : "Jackal;Sphinx;Nymph", "number" : 20, "side" : "SIDE_PANDORAN", - "x" : -5000, - "y" : 5000, + "x" : 20, + "y" : 20, "scatter" : 2000 }, { @@ -58,8 +58,8 @@ "types" : "Jackal;Sphinx;Nymph", "number" : 20, "side" : "SIDE_PANDORAN", - "x" : -5000, - "y" : -5000, + "x" : 20, + "y" : 30, "scatter" : 2000 }, { @@ -67,8 +67,8 @@ "types" : "Nymph", "number" : 20, "side" : "SIDE_PANDORAN", - "x" : 5000, - "y" : 8000, + "x" : 30, + "y" : 40, "scatter" : 2000 }, { @@ -76,8 +76,8 @@ "types" : "Jackal;Sphinx", "number" : 20, "side" : "SIDE_PANDORAN", - "x" : 7000, - "y" : -4000, + "x" : 30, + "y" : 20, "scatter" : 2000 } ] diff --git a/data/missions/iliad/01 - iliad defence #1.json b/data/missions/iliad/01 - iliad defence #1.json index 6e9697c..ee2a8ac 100644 --- a/data/missions/iliad/01 - iliad defence #1.json +++ b/data/missions/iliad/01 - iliad defence #1.json @@ -27,8 +27,8 @@ "name" : "ALLIES", "types" : "Firefly;Nymph", "side" : "SIDE_ALLIES", - "x" : 640, - "y" : 0, + "x" : 25, + "y" : 24, "number" : 75, "scatter" : 5000 }, @@ -36,8 +36,8 @@ "name" : "Pandoran", "types" : "Jackal", "side" : "SIDE_PANDORAN", - "x" : 7000, - "y" : 0, + "x" : 35, + "y" : 30, "number" : 50, "scatter" : 5000 } diff --git a/data/missions/sol/02 - weapons.json b/data/missions/sol/02 - weapons.json index acc604c..1bb3c8c 100644 --- a/data/missions/sol/02 - weapons.json +++ b/data/missions/sol/02 - weapons.json @@ -23,8 +23,8 @@ "name" : "Dart", "type" : "StaticDart", "side" : "SIDE_PIRATE", - "x" : 800, - "y" : 200 + "x" : 25.5, + "y" : 24.5 } ] } diff --git a/data/missions/sol/03 - moving target.json b/data/missions/sol/03 - moving target.json index 6f67f76..8a759c9 100644 --- a/data/missions/sol/03 - moving target.json +++ b/data/missions/sol/03 - moving target.json @@ -23,8 +23,8 @@ "name" : "Dart", "type" : "UnarmedDart", "side" : "SIDE_PIRATE", - "x" : 640, - "y" : 0 + "x" : 25, + "y" : 24 } ] } diff --git a/data/missions/sol/04 - real target.json b/data/missions/sol/04 - real target.json index 54856c8..9a3edba 100644 --- a/data/missions/sol/04 - real target.json +++ b/data/missions/sol/04 - real target.json @@ -23,8 +23,8 @@ "name" : "Dart", "type" : "SimpleDart", "side" : "SIDE_PIRATE", - "x" : 640, - "y" : -1000 + "x" : 25, + "y" : 24 } ] } diff --git a/data/missions/sol/05 - wingmates.json b/data/missions/sol/05 - wingmates.json index 08a6bec..d42a4e4 100644 --- a/data/missions/sol/05 - wingmates.json +++ b/data/missions/sol/05 - wingmates.json @@ -23,36 +23,25 @@ "name" : "TAF", "type" : "TAF", "side" : "SIDE_ALLIES", - "x" : 440, - "y" : 480 + "x" : 24.9, + "y" : 25.5 }, { "name" : "TAF", "type" : "TAF", "side" : "SIDE_ALLIES", - "x" : 840, - "y" : 480 - }, + "x" : 25.1, + "y" : 25.5 + } + ], + "fighterGroups" : [ { "name" : "Dart", - "type" : "SimpleDart", + "types" : "SimpleDart", "side" : "SIDE_PIRATE", - "x" : 2640, - "y" : -1500 - }, - { - "name" : "Dart", - "type" : "SimpleDart", - "side" : "SIDE_PIRATE", - "x" : 2640, - "y" : -1500 - }, - { - "name" : "Dart", - "type" : "SimpleDart", - "side" : "SIDE_PIRATE", - "x" : 2640, - "y" : -1500 + "number" : 3, + "x" : 26, + "y" : 20 } ] } diff --git a/data/missions/sol/06 - final.json b/data/missions/sol/06 - final.json index a86d272..a551d25 100644 --- a/data/missions/sol/06 - final.json +++ b/data/missions/sol/06 - final.json @@ -32,27 +32,14 @@ "pilot" : "Jim Goddard", "squadron" : "Midnight Runners" }, - "fighters" : [ + "fighterGroups" : [ { "name" : "Dart", - "type" : "SimpleDart", + "types" : "SimpleDart", "side" : "SIDE_PIRATE", - "x" : 640, - "y" : -1500 - }, - { - "name" : "Dart", - "type" : "SimpleDart", - "side" : "SIDE_PIRATE", - "x" : 640, - "y" : -1500 - }, - { - "name" : "Dart", - "type" : "SimpleDart", - "side" : "SIDE_PIRATE", - "x" : 640, - "y" : -1500 + "number" : 3, + "x" : 26, + "y" : 20 } ] } diff --git a/data/missions/temper/01 - pirate uprising #1.json b/data/missions/temper/01 - pirate uprising #1.json index e90bcab..fa71c07 100644 --- a/data/missions/temper/01 - pirate uprising #1.json +++ b/data/missions/temper/01 - pirate uprising #1.json @@ -38,16 +38,16 @@ "types" : "TAF", "number" : 4, "side" : "SIDE_ALLIES", - "x" : 0, - "y" : 0 + "x" : 23, + "y" : 25 }, { "name" : "Dart", "types" : "SimpleDart", "number" : 10, "side" : "SIDE_PIRATE", - "x" : 1000, - "y" : 5000, + "x" : 27, + "y" : 35, "scatter" : 2000 }, { @@ -55,8 +55,8 @@ "name" : "Dart", "number" : 10, "side" : "SIDE_PIRATE", - "x" : -3000, - "y" : -3000, + "x" : 20, + "y" : 15, "scatter" : 2000 }, { @@ -64,8 +64,8 @@ "types" : "SimpleDart", "number" : 10, "side" : "SIDE_PIRATE", - "x" : 0, - "y" : -6000, + "x" : 15, + "y" : 35, "scatter" : 2000 } ] diff --git a/data/missions/temper/02 - pirate uprising #2.json b/data/missions/temper/02 - pirate uprising #2.json index 3be9301..bde76a5 100644 --- a/data/missions/temper/02 - pirate uprising #2.json +++ b/data/missions/temper/02 - pirate uprising #2.json @@ -39,16 +39,16 @@ "types" : "TAF", "number" : 4, "side" : "SIDE_ALLIES", - "x" : 0, - "y" : 0 + "x" : 25, + "y" : 23 }, { "name" : "Dart", "types" : "Dart", "number" : 12, "side" : "SIDE_PIRATE", - "x" : -3000, - "y" : 0, + "x" : 20, + "y" : 25, "scatter" : 2000 }, { @@ -56,8 +56,8 @@ "types" : "Dart", "number" : 12, "side" : "SIDE_PIRATE", - "x" : 4000, - "y" : 0, + "x" : 40, + "y" : 25, "scatter" : 2000 }, { @@ -65,8 +65,8 @@ "types" : "Dart", "number" : 12, "side" : "SIDE_PIRATE", - "x" : 0, - "y" : 6000, + "x" : 25, + "y" : 35, "scatter" : 2000 } ] diff --git a/data/missions/temper/03 - pirate uprising #3.json b/data/missions/temper/03 - pirate uprising #3.json index c4ab28c..4b318fa 100644 --- a/data/missions/temper/03 - pirate uprising #3.json +++ b/data/missions/temper/03 - pirate uprising #3.json @@ -47,8 +47,8 @@ "name" : "Pirate Leader", "type" : "Dart", "side" : "SIDE_PIRATE", - "x" : -5000, - "y" : 0, + "x" : 12, + "y" : 25, "flags" : "FF_NO_KILL+FF_DISABLE+FF_MISSION_TARGET" } ], @@ -58,16 +58,16 @@ "types" : "TAF", "number" : 2, "side" : "SIDE_ALLIES", - "x" : 1600, - "y" : 400 + "x" : 27, + "y" : 25 }, { "name" : "Dart", "types" : "Dart", "number" : 12, "side" : "SIDE_PIRATE", - "x" : -5000, - "y" : 0, + "x" : 15, + "y" : 25, "scatter" : 2000 } ] diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index b4d7aa0..11929ad 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -189,14 +189,17 @@ static void loadPlayer(cJSON *node) type = cJSON_GetObjectItem(node, "type")->valuestring; side = lookup(cJSON_GetObjectItem(node, "side")->valuestring); - player = spawnFighter(type, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, side); + player = spawnFighter(type, 0, 0, side); + player->x = (GRID_SIZE * GRID_CELL_WIDTH) / 2; + player->y = (GRID_SIZE * GRID_CELL_HEIGHT) / 2; } static void loadFighters(cJSON *node) { Entity *f; char *type; - int side, x, y; + int side; + float x, y; if (node) { @@ -206,8 +209,8 @@ static void loadFighters(cJSON *node) { type = cJSON_GetObjectItem(node, "type")->valuestring; side = lookup(cJSON_GetObjectItem(node, "side")->valuestring); - x = cJSON_GetObjectItem(node, "x")->valueint; - y = cJSON_GetObjectItem(node, "y")->valueint; + x = cJSON_GetObjectItem(node, "x")->valuedouble * GRID_CELL_WIDTH; + y = cJSON_GetObjectItem(node, "y")->valuedouble * GRID_CELL_HEIGHT; f = spawnFighter(type, x, y, side); @@ -232,8 +235,9 @@ static void loadFighterGroups(cJSON *node) { Entity *f; char **types, *name, *type; - int side, x, y, scatter, number, active; + int side, scatter, number, active; int i, numTypes; + float x, y; scatter = 1; active = 1; @@ -247,9 +251,9 @@ static void loadFighterGroups(cJSON *node) types = toFighterTypeArray(cJSON_GetObjectItem(node, "types")->valuestring, &numTypes); side = lookup(cJSON_GetObjectItem(node, "side")->valuestring); number = cJSON_GetObjectItem(node, "number")->valueint; - x = cJSON_GetObjectItem(node, "x")->valueint; - y = cJSON_GetObjectItem(node, "y")->valueint; name = cJSON_GetObjectItem(node, "name")->valuestring; + x = cJSON_GetObjectItem(node, "x")->valuedouble * GRID_CELL_WIDTH; + y = cJSON_GetObjectItem(node, "y")->valuedouble * GRID_CELL_HEIGHT; if (cJSON_GetObjectItem(node, "scatter")) { @@ -307,8 +311,8 @@ static void loadEntities(cJSON *node) STRNCPY(e->name, cJSON_GetObjectItem(node, "name")->valuestring, MAX_NAME_LENGTH); } - e->x = cJSON_GetObjectItem(node, "x")->valueint; - e->y = cJSON_GetObjectItem(node, "y")->valueint; + e->x = cJSON_GetObjectItem(node, "x")->valuedouble * GRID_CELL_WIDTH; + e->y = cJSON_GetObjectItem(node, "y")->valuedouble * GRID_CELL_HEIGHT; if (cJSON_GetObjectItem(node, "flags")) { @@ -324,7 +328,8 @@ static void loadEntityGroups(cJSON *node) { Entity *e; char *name; - int i, type, x, y, scatter, number; + int i, type, scatter, number; + float x, y; scatter = 1; @@ -336,8 +341,8 @@ static void loadEntityGroups(cJSON *node) { type = lookup(cJSON_GetObjectItem(node, "type")->valuestring); number = cJSON_GetObjectItem(node, "number")->valueint; - x = cJSON_GetObjectItem(node, "x")->valueint; - y = cJSON_GetObjectItem(node, "y")->valueint; + x = cJSON_GetObjectItem(node, "x")->valuedouble * GRID_CELL_WIDTH; + y = cJSON_GetObjectItem(node, "y")->valuedouble * GRID_CELL_HEIGHT; name = NULL; if (cJSON_GetObjectItem(node, "name"))