diff --git a/common.mk b/common.mk index 4354450..52e63c6 100644 --- a/common.mk +++ b/common.mk @@ -1,16 +1,23 @@ VERSION = 1.4 -REVISION = 2 +REVISION = 3 LOCALE_MO = $(patsubst %.po,%.mo,$(wildcard locale/*.po)) OUT = bin -SEARCHPATH += src/ src/battle src/challenges src/draw src/game src/galaxy src/json src/system src/test +SEARCHPATH += src/ src/battle +SEARCHPATH += src/challenges +SEARCHPATH += src/game +SEARCHPATH += src/galaxy +SEARCHPATH += src/json +SEARCHPATH += src/system +SEARCHPATH += src/test + vpath %.c $(SEARCHPATH) vpath %.h $(SEARCHPATH) DEPS += defs.h structs.h -_OBJS += ai.o +_OBJS += ai.o atlas.o _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 diff --git a/data/atlas/atlas.json b/data/atlas/atlas.json new file mode 100644 index 0000000..8099844 --- /dev/null +++ b/data/atlas/atlas.json @@ -0,0 +1,2354 @@ +[ + { + "filename": "gfx/capitalShips/hmsCorvette01/body.png", + "x": 0, + "y": 0, + "w": 318, + "h": 565, + "rotated": false, + "x1": 0.0, + "y1": 0.0, + "x2": 0.155, + "y2": 0.276 + }, + { + "filename": "gfx/capitalShips/csnCorvette01/body.png", + "x": 319, + "y": 0, + "w": 377, + "h": 554, + "rotated": false, + "x1": 0.156, + "y1": 0.0, + "x2": 0.34, + "y2": 0.27 + }, + { + "filename": "gfx/capitalShips/csnCorvette02/body.png", + "x": 697, + "y": 0, + "w": 379, + "h": 545, + "rotated": false, + "x1": 0.341, + "y1": 0.0, + "x2": 0.525, + "y2": 0.266 + }, + { + "filename": "gfx/capitalShips/infCorvette01/body.png", + "x": 1077, + "y": 0, + "w": 166, + "h": 536, + "rotated": false, + "x1": 0.526, + "y1": 0.0, + "x2": 0.607, + "y2": 0.261 + }, + { + "filename": "gfx/capitalShips/unfCorvette01/body.png", + "x": 1244, + "y": 0, + "w": 321, + "h": 536, + "rotated": false, + "x1": 0.608, + "y1": 0.0, + "x2": 0.764, + "y2": 0.261 + }, + { + "filename": "gfx/capitalShips/unfCorvette02/body.png", + "x": 1566, + "y": 0, + "w": 318, + "h": 531, + "rotated": false, + "x1": 0.765, + "y1": 0.0, + "x2": 0.92, + "y2": 0.259 + }, + { + "filename": "gfx/effects/halo.png", + "x": 0, + "y": 566, + "w": 512, + "h": 512, + "rotated": false, + "x1": 0.0, + "y1": 0.277, + "x2": 0.25, + "y2": 0.526 + }, + { + "filename": "gfx/capitalShips/infCorvette02/body.png", + "x": 513, + "y": 566, + "w": 293, + "h": 481, + "rotated": false, + "x1": 0.251, + "y1": 0.277, + "x2": 0.393, + "y2": 0.511 + }, + { + "filename": "gfx/entities/portal.png", + "x": 807, + "y": 566, + "w": 480, + "h": 480, + "rotated": false, + "x1": 0.394, + "y1": 0.277, + "x2": 0.628, + "y2": 0.51 + }, + { + "filename": "gfx/entities/jumpgate.png", + "x": 1288, + "y": 566, + "w": 480, + "h": 480, + "rotated": false, + "x1": 0.629, + "y1": 0.277, + "x2": 0.863, + "y2": 0.51 + }, + { + "filename": "gfx/capitalShips/hmsCorvette02/body.png", + "x": 0, + "y": 1079, + "w": 558, + "h": 387, + "rotated": false, + "x1": 0.0, + "y1": 0.527, + "x2": 0.272, + "y2": 0.716 + }, + { + "filename": "gfx/entities/waypoint.png", + "x": 559, + "y": 1079, + "w": 286, + "h": 286, + "rotated": false, + "x1": 0.273, + "y1": 0.527, + "x2": 0.412, + "y2": 0.666 + }, + { + "filename": "gfx/planets/star.png", + "x": 1769, + "y": 566, + "w": 256, + "h": 256, + "rotated": false, + "x1": 0.864, + "y1": 0.277, + "x2": 0.989, + "y2": 0.401 + }, + { + "filename": "gfx/misc/torelliFireStorm.png", + "x": 846, + "y": 1079, + "w": 240, + "h": 240, + "rotated": false, + "x1": 0.413, + "y1": 0.527, + "x2": 0.53, + "y2": 0.644 + }, + { + "filename": "gfx/planets/hyanik.png", + "x": 1087, + "y": 1079, + "w": 240, + "h": 240, + "rotated": false, + "x1": 0.531, + "y1": 0.527, + "x2": 0.648, + "y2": 0.644 + }, + { + "filename": "gfx/planets/alexandria.png", + "x": 1328, + "y": 1079, + "w": 240, + "h": 240, + "rotated": false, + "x1": 0.649, + "y1": 0.527, + "x2": 0.765, + "y2": 0.644 + }, + { + "filename": "gfx/planets/spirit.png", + "x": 1569, + "y": 1079, + "w": 240, + "h": 240, + "rotated": false, + "x1": 0.766, + "y1": 0.527, + "x2": 0.883, + "y2": 0.644 + }, + { + "filename": "gfx/planets/torelli.png", + "x": 0, + "y": 1467, + "w": 240, + "h": 240, + "rotated": false, + "x1": 0.0, + "y1": 0.717, + "x2": 0.117, + "y2": 0.833 + }, + { + "filename": "gfx/planets/diso.png", + "x": 241, + "y": 1467, + "w": 240, + "h": 240, + "rotated": false, + "x1": 0.118, + "y1": 0.717, + "x2": 0.235, + "y2": 0.833 + }, + { + "filename": "gfx/planets/rockford.png", + "x": 482, + "y": 1467, + "w": 240, + "h": 240, + "rotated": false, + "x1": 0.236, + "y1": 0.717, + "x2": 0.352, + "y2": 0.833 + }, + { + "filename": "gfx/planets/earth.png", + "x": 723, + "y": 1467, + "w": 240, + "h": 240, + "rotated": false, + "x1": 0.353, + "y1": 0.717, + "x2": 0.47, + "y2": 0.833 + }, + { + "filename": "gfx/planets/lewis.png", + "x": 964, + "y": 1467, + "w": 240, + "h": 240, + "rotated": false, + "x1": 0.471, + "y1": 0.717, + "x2": 0.588, + "y2": 0.833 + }, + { + "filename": "gfx/planets/flint.png", + "x": 1205, + "y": 1467, + "w": 240, + "h": 240, + "rotated": false, + "x1": 0.589, + "y1": 0.717, + "x2": 0.705, + "y2": 0.833 + }, + { + "filename": "gfx/planets/tzac.png", + "x": 1446, + "y": 1467, + "w": 240, + "h": 240, + "rotated": false, + "x1": 0.706, + "y1": 0.717, + "x2": 0.823, + "y2": 0.833 + }, + { + "filename": "gfx/planets/oracleIX.png", + "x": 1687, + "y": 1467, + "w": 240, + "h": 240, + "rotated": false, + "x1": 0.824, + "y1": 0.717, + "x2": 0.941, + "y2": 0.833 + }, + { + "filename": "gfx/planets/arlos.png", + "x": 0, + "y": 1708, + "w": 240, + "h": 240, + "rotated": false, + "x1": 0.0, + "y1": 0.834, + "x2": 0.117, + "y2": 0.951 + }, + { + "filename": "gfx/planets/mythos.png", + "x": 241, + "y": 1708, + "w": 240, + "h": 233, + "rotated": false, + "x1": 0.118, + "y1": 0.834, + "x2": 0.235, + "y2": 0.948 + }, + { + "filename": "gfx/effects/explosion.png", + "x": 1769, + "y": 823, + "w": 205, + "h": 204, + "rotated": false, + "x1": 0.864, + "y1": 0.402, + "x2": 0.964, + "y2": 0.501 + }, + { + "filename": "gfx/trophies/sparkle.png", + "x": 1810, + "y": 1079, + "w": 173, + "h": 173, + "rotated": false, + "x1": 0.884, + "y1": 0.527, + "x2": 0.968, + "y2": 0.611 + }, + { + "filename": "gfx/hud/radarWarning.png", + "x": 1885, + "y": 0, + "w": 153, + "h": 153, + "rotated": false, + "x1": 0.921, + "y1": 0.0, + "x2": 0.995, + "y2": 0.074 + }, + { + "filename": "gfx/hud/radar.png", + "x": 1885, + "y": 154, + "w": 153, + "h": 153, + "rotated": false, + "x1": 0.921, + "y1": 0.075, + "x2": 0.995, + "y2": 0.15 + }, + { + "filename": "gfx/trophies/silver.png", + "x": 1885, + "y": 308, + "w": 128, + "h": 128, + "rotated": false, + "x1": 0.921, + "y1": 0.151, + "x2": 0.983, + "y2": 0.213 + }, + { + "filename": "gfx/trophies/unearned.png", + "x": 482, + "y": 1708, + "w": 128, + "h": 128, + "rotated": false, + "x1": 0.236, + "y1": 0.834, + "x2": 0.298, + "y2": 0.896 + }, + { + "filename": "gfx/trophies/platinum.png", + "x": 611, + "y": 1708, + "w": 128, + "h": 128, + "rotated": false, + "x1": 0.299, + "y1": 0.834, + "x2": 0.361, + "y2": 0.896 + }, + { + "filename": "gfx/trophies/bronze.png", + "x": 740, + "y": 1708, + "w": 128, + "h": 128, + "rotated": false, + "x1": 0.362, + "y1": 0.834, + "x2": 0.424, + "y2": 0.896 + }, + { + "filename": "gfx/trophies/gold.png", + "x": 869, + "y": 1708, + "w": 128, + "h": 128, + "rotated": false, + "x1": 0.425, + "y1": 0.834, + "x2": 0.487, + "y2": 0.896 + }, + { + "filename": "gfx/planets/bluePlanet.png", + "x": 998, + "y": 1708, + "w": 128, + "h": 128, + "rotated": false, + "x1": 0.488, + "y1": 0.834, + "x2": 0.55, + "y2": 0.896 + }, + { + "filename": "gfx/challenges/challengeIcon.png", + "x": 559, + "y": 1366, + "w": 98, + "h": 98, + "rotated": false, + "x1": 0.273, + "y1": 0.667, + "x2": 0.321, + "y2": 0.715 + }, + { + "filename": "gfx/challenges/challengeIconHighlight.png", + "x": 658, + "y": 1366, + "w": 98, + "h": 98, + "rotated": false, + "x1": 0.322, + "y1": 0.667, + "x2": 0.369, + "y2": 0.715 + }, + { + "filename": "gfx/craft/supplyShip.png", + "x": 1885, + "y": 437, + "w": 42, + "h": 89, + "rotated": false, + "x1": 0.921, + "y1": 0.214, + "x2": 0.941, + "y2": 0.257 + }, + { + "filename": "gfx/trophies/alertSphere.png", + "x": 1928, + "y": 437, + "w": 80, + "h": 80, + "rotated": false, + "x1": 0.942, + "y1": 0.214, + "x2": 0.98, + "y2": 0.252 + }, + { + "filename": "gfx/capitalShips/hmsCorvette01/core.png", + "x": 2014, + "y": 308, + "w": 27, + "h": 80, + "rotated": false, + "x1": 0.984, + "y1": 0.151, + "x2": 0.996, + "y2": 0.189 + }, + { + "filename": "gfx/capitalShips/unfCorvette01/core.png", + "x": 2009, + "y": 437, + "w": 27, + "h": 80, + "rotated": false, + "x1": 0.981, + "y1": 0.214, + "x2": 0.994, + "y2": 0.252 + }, + { + "filename": "gfx/capitalShips/hmsCorvette02/core.png", + "x": 1975, + "y": 823, + "w": 27, + "h": 80, + "rotated": false, + "x1": 0.965, + "y1": 0.402, + "x2": 0.977, + "y2": 0.441 + }, + { + "filename": "gfx/hud/targetCircle.png", + "x": 1975, + "y": 904, + "w": 68, + "h": 68, + "rotated": false, + "x1": 0.965, + "y1": 0.442, + "x2": 0.997, + "y2": 0.474 + }, + { + "filename": "gfx/capitalShips/infCorvette02/engine4.png", + "x": 1984, + "y": 1079, + "w": 53, + "h": 67, + "rotated": false, + "x1": 0.969, + "y1": 0.527, + "x2": 0.994, + "y2": 0.559 + }, + { + "filename": "gfx/capitalShips/infCorvette02/engine1.png", + "x": 1984, + "y": 1147, + "w": 53, + "h": 67, + "rotated": false, + "x1": 0.969, + "y1": 0.56, + "x2": 0.994, + "y2": 0.593 + }, + { + "filename": "gfx/capitalShips/infCorvette02/engine3.png", + "x": 2003, + "y": 823, + "w": 42, + "h": 67, + "rotated": false, + "x1": 0.978, + "y1": 0.402, + "x2": 0.998, + "y2": 0.434 + }, + { + "filename": "gfx/capitalShips/infCorvette02/engine2.png", + "x": 757, + "y": 1366, + "w": 42, + "h": 67, + "rotated": false, + "x1": 0.37, + "y1": 0.667, + "x2": 0.39, + "y2": 0.699 + }, + { + "filename": "gfx/capitalShips/csnCorvette02/engine1.png", + "x": 800, + "y": 1366, + "w": 39, + "h": 67, + "rotated": false, + "x1": 0.391, + "y1": 0.667, + "x2": 0.409, + "y2": 0.699 + }, + { + "filename": "gfx/capitalShips/infCorvette01/component4.png", + "x": 2026, + "y": 566, + "w": 16, + "h": 66, + "rotated": false, + "x1": 0.99, + "y1": 0.277, + "x2": 0.997, + "y2": 0.308 + }, + { + "filename": "gfx/capitalShips/infCorvette01/component5.png", + "x": 2026, + "y": 633, + "w": 16, + "h": 66, + "rotated": false, + "x1": 0.99, + "y1": 0.309, + "x2": 0.997, + "y2": 0.341 + }, + { + "filename": "gfx/capitalShips/infCorvette02/core.png", + "x": 2026, + "y": 700, + "w": 18, + "h": 65, + "rotated": false, + "x1": 0.99, + "y1": 0.342, + "x2": 0.998, + "y2": 0.373 + }, + { + "filename": "gfx/effects/shieldHit.png", + "x": 1810, + "y": 1253, + "w": 64, + "h": 64, + "rotated": false, + "x1": 0.884, + "y1": 0.612, + "x2": 0.915, + "y2": 0.643 + }, + { + "filename": "gfx/capitalShips/csnCorvette02/core.png", + "x": 1875, + "y": 1253, + "w": 20, + "h": 59, + "rotated": false, + "x1": 0.916, + "y1": 0.612, + "x2": 0.925, + "y2": 0.64 + }, + { + "filename": "gfx/capitalShips/csnCorvette01/core.png", + "x": 1896, + "y": 1253, + "w": 20, + "h": 59, + "rotated": false, + "x1": 0.926, + "y1": 0.612, + "x2": 0.935, + "y2": 0.64 + }, + { + "filename": "gfx/craft/munitionsTransport.png", + "x": 1917, + "y": 1253, + "w": 46, + "h": 56, + "rotated": false, + "x1": 0.936, + "y1": 0.612, + "x2": 0.958, + "y2": 0.639 + }, + { + "filename": "gfx/title/logo02.png", + "x": 840, + "y": 1366, + "w": 467, + "h": 55, + "rotated": false, + "x1": 0.41, + "y1": 0.667, + "x2": 0.638, + "y2": 0.694 + }, + { + "filename": "gfx/title/pandoran.png", + "x": 1308, + "y": 1366, + "w": 517, + "h": 55, + "rotated": false, + "x1": 0.639, + "y1": 0.667, + "x2": 0.891, + "y2": 0.694 + }, + { + "filename": "gfx/title/logo01.png", + "x": 1127, + "y": 1708, + "w": 383, + "h": 55, + "rotated": false, + "x1": 0.551, + "y1": 0.834, + "x2": 0.737, + "y2": 0.861 + }, + { + "filename": "gfx/capitalShips/csnCorvette02/engine2.png", + "x": 1975, + "y": 973, + "w": 34, + "h": 53, + "rotated": false, + "x1": 0.965, + "y1": 0.475, + "x2": 0.981, + "y2": 0.501 + }, + { + "filename": "gfx/capitalShips/unfCorvette02/component1.png", + "x": 2026, + "y": 766, + "w": 18, + "h": 53, + "rotated": false, + "x1": 0.99, + "y1": 0.374, + "x2": 0.998, + "y2": 0.4 + }, + { + "filename": "gfx/battle/challengeFailed.png", + "x": 1511, + "y": 1708, + "w": 531, + "h": 51, + "rotated": false, + "x1": 0.738, + "y1": 0.834, + "x2": 0.997, + "y2": 0.859 + }, + { + "filename": "gfx/battle/challengeInProgress.png", + "x": 1127, + "y": 1764, + "w": 721, + "h": 51, + "rotated": false, + "x1": 0.551, + "y1": 0.862, + "x2": 0.902, + "y2": 0.886 + }, + { + "filename": "gfx/battle/missionStart.png", + "x": 482, + "y": 1837, + "w": 407, + "h": 51, + "rotated": false, + "x1": 0.236, + "y1": 0.897, + "x2": 0.434, + "y2": 0.922 + }, + { + "filename": "gfx/battle/missionInProgress.png", + "x": 890, + "y": 1837, + "w": 617, + "h": 51, + "rotated": false, + "x1": 0.435, + "y1": 0.897, + "x2": 0.736, + "y2": 0.922 + }, + { + "filename": "gfx/battle/missionComplete.png", + "x": 482, + "y": 1889, + "w": 541, + "h": 51, + "rotated": false, + "x1": 0.236, + "y1": 0.923, + "x2": 0.499, + "y2": 0.947 + }, + { + "filename": "gfx/battle/timeUp.png", + "x": 1826, + "y": 1366, + "w": 212, + "h": 51, + "rotated": false, + "x1": 0.892, + "y1": 0.667, + "x2": 0.995, + "y2": 0.692 + }, + { + "filename": "gfx/battle/challengeStart.png", + "x": 1508, + "y": 1837, + "w": 511, + "h": 51, + "rotated": false, + "x1": 0.737, + "y1": 0.897, + "x2": 0.986, + "y2": 0.922 + }, + { + "filename": "gfx/battle/challengeComplete.png", + "x": 1024, + "y": 1889, + "w": 645, + "h": 51, + "rotated": false, + "x1": 0.5, + "y1": 0.923, + "x2": 0.815, + "y2": 0.947 + }, + { + "filename": "gfx/battle/missionFailed.png", + "x": 0, + "y": 1949, + "w": 427, + "h": 51, + "rotated": false, + "x1": 0.0, + "y1": 0.952, + "x2": 0.208, + "y2": 0.976 + }, + { + "filename": "gfx/capitalShips/hmsCorvette02/component1.png", + "x": 2010, + "y": 973, + "w": 25, + "h": 50, + "rotated": false, + "x1": 0.982, + "y1": 0.475, + "x2": 0.993, + "y2": 0.499 + }, + { + "filename": "gfx/capitalShips/csnCorvette02/component1.png", + "x": 1964, + "y": 1253, + "w": 44, + "h": 49, + "rotated": false, + "x1": 0.959, + "y1": 0.612, + "x2": 0.98, + "y2": 0.635 + }, + { + "filename": "gfx/cannons/rocketTurret.png", + "x": 1928, + "y": 1467, + "w": 48, + "h": 48, + "rotated": false, + "x1": 0.942, + "y1": 0.717, + "x2": 0.965, + "y2": 0.74 + }, + { + "filename": "gfx/cannons/singlePlasmaTurret.png", + "x": 1977, + "y": 1467, + "w": 48, + "h": 48, + "rotated": false, + "x1": 0.966, + "y1": 0.717, + "x2": 0.989, + "y2": 0.74 + }, + { + "filename": "gfx/cannons/plasmaTurret.png", + "x": 1928, + "y": 1516, + "w": 48, + "h": 48, + "rotated": false, + "x1": 0.942, + "y1": 0.74, + "x2": 0.965, + "y2": 0.763 + }, + { + "filename": "gfx/capitalShips/csnCorvette02/component4.png", + "x": 2009, + "y": 1253, + "w": 31, + "h": 48, + "rotated": false, + "x1": 0.981, + "y1": 0.612, + "x2": 0.996, + "y2": 0.635 + }, + { + "filename": "gfx/capitalShips/csnCorvette02/component5.png", + "x": 1977, + "y": 1516, + "w": 31, + "h": 48, + "rotated": false, + "x1": 0.966, + "y1": 0.74, + "x2": 0.98, + "y2": 0.763 + }, + { + "filename": "gfx/capitalShips/common/cannon01.png", + "x": 2009, + "y": 1516, + "w": 32, + "h": 48, + "rotated": false, + "x1": 0.981, + "y1": 0.74, + "x2": 0.996, + "y2": 0.763 + }, + { + "filename": "gfx/capitalShips/unfCorvette02/engine2.png", + "x": 846, + "y": 1320, + "w": 52, + "h": 44, + "rotated": false, + "x1": 0.413, + "y1": 0.645, + "x2": 0.438, + "y2": 0.666 + }, + { + "filename": "gfx/capitalShips/unfCorvette02/engine1.png", + "x": 899, + "y": 1320, + "w": 42, + "h": 39, + "rotated": false, + "x1": 0.439, + "y1": 0.645, + "x2": 0.459, + "y2": 0.663 + }, + { + "filename": "gfx/capitalShips/hmsCorvette01/component1.png", + "x": 2014, + "y": 389, + "w": 16, + "h": 38, + "rotated": false, + "x1": 0.984, + "y1": 0.19, + "x2": 0.991, + "y2": 0.208 + }, + { + "filename": "gfx/capitalShips/unfCorvette01/engine2.png", + "x": 942, + "y": 1320, + "w": 38, + "h": 38, + "rotated": false, + "x1": 0.46, + "y1": 0.645, + "x2": 0.478, + "y2": 0.663 + }, + { + "filename": "gfx/capitalShips/csnCorvette01/engine1.png", + "x": 1984, + "y": 1215, + "w": 47, + "h": 37, + "rotated": false, + "x1": 0.969, + "y1": 0.594, + "x2": 0.991, + "y2": 0.611 + }, + { + "filename": "gfx/capitalShips/infCorvette01/engine1.png", + "x": 981, + "y": 1320, + "w": 32, + "h": 35, + "rotated": false, + "x1": 0.479, + "y1": 0.645, + "x2": 0.494, + "y2": 0.661 + }, + { + "filename": "gfx/debris/debris5.png", + "x": 2039, + "y": 0, + "w": 9, + "h": 34, + "rotated": false, + "x1": 0.996, + "y1": 0.0, + "x2": 1.0, + "y2": 0.016 + }, + { + "filename": "gfx/capitalShips/hmsCorvette02/component3.png", + "x": 1014, + "y": 1320, + "w": 18, + "h": 34, + "rotated": false, + "x1": 0.495, + "y1": 0.645, + "x2": 0.504, + "y2": 0.661 + }, + { + "filename": "gfx/fighters/firefly.png", + "x": 1033, + "y": 1320, + "w": 33, + "h": 33, + "rotated": false, + "x1": 0.505, + "y1": 0.645, + "x2": 0.52, + "y2": 0.66 + }, + { + "filename": "gfx/capitalShips/unfCorvette02/component3.png", + "x": 2031, + "y": 389, + "w": 13, + "h": 33, + "rotated": false, + "x1": 0.992, + "y1": 0.19, + "x2": 0.998, + "y2": 0.206 + }, + { + "filename": "gfx/galaxy/arrow.png", + "x": 1067, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.521, + "y1": 0.645, + "x2": 0.536, + "y2": 0.66 + }, + { + "filename": "gfx/craft/infTug.png", + "x": 1100, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.537, + "y1": 0.645, + "x2": 0.552, + "y2": 0.66 + }, + { + "filename": "gfx/craft/shuttle.png", + "x": 1133, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.553, + "y1": 0.645, + "x2": 0.569, + "y2": 0.66 + }, + { + "filename": "gfx/craft/civilian02.png", + "x": 1166, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.57, + "y1": 0.645, + "x2": 0.585, + "y2": 0.66 + }, + { + "filename": "gfx/craft/tug.png", + "x": 1199, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.586, + "y1": 0.645, + "x2": 0.601, + "y2": 0.66 + }, + { + "filename": "gfx/craft/civilian01.png", + "x": 1232, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.602, + "y1": 0.645, + "x2": 0.617, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/lynx.png", + "x": 1265, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.618, + "y1": 0.645, + "x2": 0.633, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/dart04.png", + "x": 1298, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.634, + "y1": 0.645, + "x2": 0.649, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/dart02.png", + "x": 1331, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.65, + "y1": 0.645, + "x2": 0.665, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/leopard.png", + "x": 1364, + "y": 1320, + "w": 30, + "h": 32, + "rotated": false, + "x1": 0.666, + "y1": 0.645, + "x2": 0.68, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/dart05.png", + "x": 1395, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.681, + "y1": 0.645, + "x2": 0.697, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/thunderhead.png", + "x": 1428, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.698, + "y1": 0.645, + "x2": 0.713, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/razor.png", + "x": 1461, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.714, + "y1": 0.645, + "x2": 0.729, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/sk34.png", + "x": 1494, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.73, + "y1": 0.645, + "x2": 0.745, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/dart01.png", + "x": 1527, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.746, + "y1": 0.645, + "x2": 0.761, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/khepri.png", + "x": 1560, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.762, + "y1": 0.645, + "x2": 0.777, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/hyena.png", + "x": 1593, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.778, + "y1": 0.645, + "x2": 0.793, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/ray.png", + "x": 1626, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.794, + "y1": 0.645, + "x2": 0.809, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/mantis.png", + "x": 1659, + "y": 1320, + "w": 30, + "h": 32, + "rotated": false, + "x1": 0.81, + "y1": 0.645, + "x2": 0.824, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/dart07.png", + "x": 1690, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.825, + "y1": 0.645, + "x2": 0.841, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/dart06.png", + "x": 1723, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.842, + "y1": 0.645, + "x2": 0.857, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/rook.png", + "x": 1756, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.858, + "y1": 0.645, + "x2": 0.873, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/kingfisher.png", + "x": 1789, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.874, + "y1": 0.645, + "x2": 0.889, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/scarab.png", + "x": 1822, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.89, + "y1": 0.645, + "x2": 0.905, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/dart03.png", + "x": 1855, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.906, + "y1": 0.645, + "x2": 0.921, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/blizzard.png", + "x": 1888, + "y": 1320, + "w": 27, + "h": 32, + "rotated": false, + "x1": 0.922, + "y1": 0.645, + "x2": 0.935, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/taf.png", + "x": 1916, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.936, + "y1": 0.645, + "x2": 0.951, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/sphinx.png", + "x": 1949, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.952, + "y1": 0.645, + "x2": 0.967, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/ataf.png", + "x": 1982, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.968, + "y1": 0.645, + "x2": 0.983, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/zakSphinx.png", + "x": 2015, + "y": 1320, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.984, + "y1": 0.645, + "x2": 0.999, + "y2": 0.66 + }, + { + "filename": "gfx/fighters/jackal.png", + "x": 1928, + "y": 1565, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.942, + "y1": 0.764, + "x2": 0.957, + "y2": 0.78 + }, + { + "filename": "gfx/fighters/nymph.png", + "x": 1961, + "y": 1565, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.958, + "y1": 0.764, + "x2": 0.973, + "y2": 0.78 + }, + { + "filename": "gfx/fighters/hammerhead.png", + "x": 1994, + "y": 1565, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.974, + "y1": 0.764, + "x2": 0.989, + "y2": 0.78 + }, + { + "filename": "gfx/fighters/shale.png", + "x": 1928, + "y": 1598, + "w": 32, + "h": 32, + "rotated": false, + "x1": 0.942, + "y1": 0.781, + "x2": 0.957, + "y2": 0.796 + }, + { + "filename": "gfx/fighters/sk31.png", + "x": 513, + "y": 1048, + "w": 31, + "h": 30, + "rotated": false, + "x1": 0.251, + "y1": 0.512, + "x2": 0.265, + "y2": 0.526 + }, + { + "filename": "gfx/fighters/angel.png", + "x": 545, + "y": 1048, + "w": 30, + "h": 30, + "rotated": false, + "x1": 0.266, + "y1": 0.512, + "x2": 0.281, + "y2": 0.526 + }, + { + "filename": "gfx/capitalShips/infCorvette01/component2.png", + "x": 576, + "y": 1048, + "w": 26, + "h": 29, + "rotated": false, + "x1": 0.281, + "y1": 0.512, + "x2": 0.294, + "y2": 0.526 + }, + { + "filename": "gfx/capitalShips/infCorvette01/component1.png", + "x": 603, + "y": 1048, + "w": 26, + "h": 29, + "rotated": false, + "x1": 0.295, + "y1": 0.512, + "x2": 0.307, + "y2": 0.526 + }, + { + "filename": "gfx/capitalShips/csnCorvette01/component2.png", + "x": 2039, + "y": 35, + "w": 5, + "h": 29, + "rotated": false, + "x1": 0.996, + "y1": 0.017, + "x2": 0.998, + "y2": 0.031 + }, + { + "filename": "gfx/bullets/laser.png", + "x": 2039, + "y": 65, + "w": 6, + "h": 28, + "rotated": false, + "x1": 0.996, + "y1": 0.032, + "x2": 0.998, + "y2": 0.045 + }, + { + "filename": "gfx/capitalShips/hmsCorvette01/engine3.png", + "x": 630, + "y": 1048, + "w": 41, + "h": 28, + "rotated": false, + "x1": 0.308, + "y1": 0.512, + "x2": 0.327, + "y2": 0.525 + }, + { + "filename": "gfx/capitalShips/hmsCorvette01/engine2.png", + "x": 672, + "y": 1048, + "w": 41, + "h": 28, + "rotated": false, + "x1": 0.328, + "y1": 0.512, + "x2": 0.348, + "y2": 0.525 + }, + { + "filename": "gfx/capitalShips/csnCorvette01/component3.png", + "x": 714, + "y": 1048, + "w": 31, + "h": 28, + "rotated": false, + "x1": 0.349, + "y1": 0.512, + "x2": 0.364, + "y2": 0.525 + }, + { + "filename": "gfx/capitalShips/infCorvette02/component3.png", + "x": 746, + "y": 1048, + "w": 30, + "h": 27, + "rotated": false, + "x1": 0.365, + "y1": 0.512, + "x2": 0.379, + "y2": 0.525 + }, + { + "filename": "gfx/capitalShips/unfCorvette01/engine1.png", + "x": 777, + "y": 1048, + "w": 62, + "h": 27, + "rotated": false, + "x1": 0.38, + "y1": 0.512, + "x2": 0.409, + "y2": 0.525 + }, + { + "filename": "gfx/capitalShips/hmsCorvette02/engine01.png", + "x": 840, + "y": 1048, + "w": 62, + "h": 27, + "rotated": false, + "x1": 0.41, + "y1": 0.512, + "x2": 0.44, + "y2": 0.525 + }, + { + "filename": "gfx/items/crate.png", + "x": 903, + "y": 1048, + "w": 26, + "h": 26, + "rotated": false, + "x1": 0.441, + "y1": 0.512, + "x2": 0.453, + "y2": 0.524 + }, + { + "filename": "gfx/capitalShips/unfCorvette01/component2.png", + "x": 2039, + "y": 94, + "w": 9, + "h": 26, + "rotated": false, + "x1": 0.996, + "y1": 0.046, + "x2": 1.0, + "y2": 0.058 + }, + { + "filename": "gfx/fighters/swarmer.png", + "x": 930, + "y": 1048, + "w": 24, + "h": 25, + "rotated": false, + "x1": 0.454, + "y1": 0.512, + "x2": 0.466, + "y2": 0.524 + }, + { + "filename": "gfx/debris/debris4.png", + "x": 955, + "y": 1048, + "w": 16, + "h": 24, + "rotated": false, + "x1": 0.467, + "y1": 0.512, + "x2": 0.474, + "y2": 0.523 + }, + { + "filename": "gfx/bullets/plasmaBolt.png", + "x": 2039, + "y": 121, + "w": 6, + "h": 24, + "rotated": false, + "x1": 0.996, + "y1": 0.059, + "x2": 0.998, + "y2": 0.071 + }, + { + "filename": "gfx/bullets/particleBolt.png", + "x": 2039, + "y": 154, + "w": 6, + "h": 24, + "rotated": false, + "x1": 0.996, + "y1": 0.075, + "x2": 0.998, + "y2": 0.087 + }, + { + "filename": "gfx/widgets/optionsRight.png", + "x": 972, + "y": 1048, + "w": 24, + "h": 24, + "rotated": false, + "x1": 0.475, + "y1": 0.512, + "x2": 0.486, + "y2": 0.523 + }, + { + "filename": "gfx/widgets/optionsLeft.png", + "x": 997, + "y": 1048, + "w": 24, + "h": 24, + "rotated": false, + "x1": 0.487, + "y1": 0.512, + "x2": 0.498, + "y2": 0.523 + }, + { + "filename": "gfx/entities/jumpgateNode.png", + "x": 1022, + "y": 1048, + "w": 24, + "h": 24, + "rotated": false, + "x1": 0.499, + "y1": 0.512, + "x2": 0.51, + "y2": 0.523 + }, + { + "filename": "gfx/capitalShips/infCorvette02/component4.png", + "x": 1047, + "y": 1048, + "w": 20, + "h": 24, + "rotated": false, + "x1": 0.511, + "y1": 0.512, + "x2": 0.521, + "y2": 0.523 + }, + { + "filename": "gfx/capitalShips/csnCorvette02/component2.png", + "x": 1068, + "y": 1048, + "w": 27, + "h": 24, + "rotated": false, + "x1": 0.522, + "y1": 0.512, + "x2": 0.534, + "y2": 0.523 + }, + { + "filename": "gfx/capitalShips/csnCorvette02/component3.png", + "x": 1096, + "y": 1048, + "w": 27, + "h": 24, + "rotated": false, + "x1": 0.535, + "y1": 0.512, + "x2": 0.548, + "y2": 0.523 + }, + { + "filename": "gfx/debris/debris2.png", + "x": 1124, + "y": 1048, + "w": 18, + "h": 23, + "rotated": false, + "x1": 0.549, + "y1": 0.512, + "x2": 0.557, + "y2": 0.523 + }, + { + "filename": "gfx/debris/debris3.png", + "x": 1143, + "y": 1048, + "w": 21, + "h": 23, + "rotated": false, + "x1": 0.558, + "y1": 0.512, + "x2": 0.568, + "y2": 0.523 + }, + { + "filename": "gfx/entities/mineWarning.png", + "x": 1165, + "y": 1048, + "w": 23, + "h": 23, + "rotated": false, + "x1": 0.569, + "y1": 0.512, + "x2": 0.58, + "y2": 0.523 + }, + { + "filename": "gfx/entities/mine.png", + "x": 1189, + "y": 1048, + "w": 23, + "h": 23, + "rotated": false, + "x1": 0.581, + "y1": 0.512, + "x2": 0.592, + "y2": 0.523 + }, + { + "filename": "gfx/entities/shadowMine.png", + "x": 1213, + "y": 1048, + "w": 23, + "h": 23, + "rotated": false, + "x1": 0.593, + "y1": 0.512, + "x2": 0.603, + "y2": 0.523 + }, + { + "filename": "gfx/capitalShips/infCorvette01/engine2.png", + "x": 1237, + "y": 1048, + "w": 50, + "h": 22, + "rotated": false, + "x1": 0.604, + "y1": 0.512, + "x2": 0.628, + "y2": 0.522 + }, + { + "filename": "gfx/capitalShips/hmsCorvette01/engine1.png", + "x": 1288, + "y": 1048, + "w": 59, + "h": 22, + "rotated": false, + "x1": 0.629, + "y1": 0.512, + "x2": 0.657, + "y2": 0.522 + }, + { + "filename": "gfx/capitalShips/unfCorvette02/component2.png", + "x": 1348, + "y": 1048, + "w": 20, + "h": 22, + "rotated": false, + "x1": 0.658, + "y1": 0.512, + "x2": 0.668, + "y2": 0.522 + }, + { + "filename": "gfx/items/coin02.png", + "x": 1369, + "y": 1048, + "w": 20, + "h": 20, + "rotated": false, + "x1": 0.669, + "y1": 0.512, + "x2": 0.678, + "y2": 0.521 + }, + { + "filename": "gfx/items/powerCore02.png", + "x": 1390, + "y": 1048, + "w": 20, + "h": 20, + "rotated": false, + "x1": 0.679, + "y1": 0.512, + "x2": 0.688, + "y2": 0.521 + }, + { + "filename": "gfx/items/powerCore01.png", + "x": 1411, + "y": 1048, + "w": 20, + "h": 20, + "rotated": false, + "x1": 0.689, + "y1": 0.512, + "x2": 0.698, + "y2": 0.521 + }, + { + "filename": "gfx/items/coin01.png", + "x": 1432, + "y": 1048, + "w": 20, + "h": 20, + "rotated": false, + "x1": 0.699, + "y1": 0.512, + "x2": 0.709, + "y2": 0.521 + }, + { + "filename": "gfx/items/powerCore03.png", + "x": 1453, + "y": 1048, + "w": 20, + "h": 20, + "rotated": false, + "x1": 0.71, + "y1": 0.512, + "x2": 0.719, + "y2": 0.521 + }, + { + "filename": "gfx/debris/debris6.png", + "x": 1474, + "y": 1048, + "w": 16, + "h": 19, + "rotated": false, + "x1": 0.72, + "y1": 0.512, + "x2": 0.727, + "y2": 0.521 + }, + { + "filename": "gfx/bullets/missile.png", + "x": 2037, + "y": 437, + "w": 11, + "h": 19, + "rotated": false, + "x1": 0.995, + "y1": 0.214, + "x2": 1.0, + "y2": 0.222 + }, + { + "filename": "gfx/items/smallCrate.png", + "x": 1491, + "y": 1048, + "w": 19, + "h": 19, + "rotated": false, + "x1": 0.728, + "y1": 0.512, + "x2": 0.737, + "y2": 0.521 + }, + { + "filename": "gfx/items/gem03.png", + "x": 1511, + "y": 1048, + "w": 19, + "h": 19, + "rotated": false, + "x1": 0.738, + "y1": 0.512, + "x2": 0.747, + "y2": 0.521 + }, + { + "filename": "gfx/items/gem01.png", + "x": 1531, + "y": 1048, + "w": 19, + "h": 19, + "rotated": false, + "x1": 0.748, + "y1": 0.512, + "x2": 0.757, + "y2": 0.521 + }, + { + "filename": "gfx/items/gem02.png", + "x": 1551, + "y": 1048, + "w": 19, + "h": 19, + "rotated": false, + "x1": 0.758, + "y1": 0.512, + "x2": 0.766, + "y2": 0.521 + }, + { + "filename": "gfx/capitalShips/infCorvette02/component1.png", + "x": 2037, + "y": 457, + "w": 10, + "h": 19, + "rotated": false, + "x1": 0.995, + "y1": 0.223, + "x2": 0.999, + "y2": 0.232 + }, + { + "filename": "gfx/capitalShips/csnCorvette01/component1.png", + "x": 1769, + "y": 1028, + "w": 19, + "h": 18, + "rotated": false, + "x1": 0.864, + "y1": 0.502, + "x2": 0.873, + "y2": 0.51 + }, + { + "filename": "gfx/galaxy/starSystem.png", + "x": 1789, + "y": 1028, + "w": 16, + "h": 16, + "rotated": false, + "x1": 0.874, + "y1": 0.502, + "x2": 0.881, + "y2": 0.51 + }, + { + "filename": "gfx/hud/targetPointer.png", + "x": 1806, + "y": 1028, + "w": 16, + "h": 16, + "rotated": false, + "x1": 0.882, + "y1": 0.502, + "x2": 0.889, + "y2": 0.51 + }, + { + "filename": "gfx/items/diamond03.png", + "x": 1823, + "y": 1028, + "w": 19, + "h": 16, + "rotated": false, + "x1": 0.89, + "y1": 0.502, + "x2": 0.899, + "y2": 0.51 + }, + { + "filename": "gfx/items/diamond01.png", + "x": 1843, + "y": 1028, + "w": 19, + "h": 16, + "rotated": false, + "x1": 0.9, + "y1": 0.502, + "x2": 0.909, + "y2": 0.51 + }, + { + "filename": "gfx/items/diamond02.png", + "x": 1863, + "y": 1028, + "w": 19, + "h": 16, + "rotated": false, + "x1": 0.91, + "y1": 0.502, + "x2": 0.919, + "y2": 0.51 + }, + { + "filename": "gfx/input/mousePointerMove.png", + "x": 1883, + "y": 1028, + "w": 16, + "h": 16, + "rotated": false, + "x1": 0.92, + "y1": 0.502, + "x2": 0.927, + "y2": 0.51 + }, + { + "filename": "gfx/input/mousePointer.png", + "x": 1900, + "y": 1028, + "w": 16, + "h": 16, + "rotated": false, + "x1": 0.928, + "y1": 0.502, + "x2": 0.935, + "y2": 0.51 + }, + { + "filename": "gfx/capitalShips/infCorvette02/component2.png", + "x": 1917, + "y": 1028, + "w": 15, + "h": 15, + "rotated": false, + "x1": 0.936, + "y1": 0.502, + "x2": 0.943, + "y2": 0.509 + }, + { + "filename": "gfx/capitalShips/unfCorvette01/component1.png", + "x": 1933, + "y": 1028, + "w": 36, + "h": 15, + "rotated": false, + "x1": 0.944, + "y1": 0.502, + "x2": 0.961, + "y2": 0.509 + }, + { + "filename": "gfx/hud/ecm.png", + "x": 1970, + "y": 1028, + "w": 14, + "h": 14, + "rotated": false, + "x1": 0.962, + "y1": 0.502, + "x2": 0.969, + "y2": 0.509 + }, + { + "filename": "gfx/hud/boost.png", + "x": 1985, + "y": 1028, + "w": 14, + "h": 14, + "rotated": false, + "x1": 0.969, + "y1": 0.502, + "x2": 0.976, + "y2": 0.509 + }, + { + "filename": "gfx/hud/shield.png", + "x": 2000, + "y": 1028, + "w": 14, + "h": 14, + "rotated": false, + "x1": 0.977, + "y1": 0.502, + "x2": 0.983, + "y2": 0.509 + }, + { + "filename": "gfx/hud/objectives.png", + "x": 2015, + "y": 1028, + "w": 14, + "h": 14, + "rotated": false, + "x1": 0.984, + "y1": 0.502, + "x2": 0.99, + "y2": 0.509 + }, + { + "filename": "gfx/hud/armour.png", + "x": 2030, + "y": 1028, + "w": 14, + "h": 14, + "rotated": false, + "x1": 0.991, + "y1": 0.502, + "x2": 0.998, + "y2": 0.509 + }, + { + "filename": "gfx/hud/clock.png", + "x": 1571, + "y": 1048, + "w": 14, + "h": 14, + "rotated": false, + "x1": 0.767, + "y1": 0.512, + "x2": 0.774, + "y2": 0.518 + }, + { + "filename": "gfx/capitalShips/hmsCorvette02/component2.png", + "x": 1586, + "y": 1048, + "w": 108, + "h": 14, + "rotated": false, + "x1": 0.775, + "y1": 0.512, + "x2": 0.827, + "y2": 0.518 + }, + { + "filename": "gfx/hud/smallFighter.png", + "x": 1695, + "y": 1048, + "w": 14, + "h": 13, + "rotated": false, + "x1": 0.828, + "y1": 0.512, + "x2": 0.834, + "y2": 0.518 + }, + { + "filename": "gfx/capitalShips/unfCorvette01/component5.png", + "x": 1710, + "y": 1048, + "w": 48, + "h": 13, + "rotated": false, + "x1": 0.835, + "y1": 0.512, + "x2": 0.858, + "y2": 0.518 + }, + { + "filename": "gfx/capitalShips/unfCorvette01/component6.png", + "x": 1759, + "y": 1048, + "w": 48, + "h": 13, + "rotated": false, + "x1": 0.859, + "y1": 0.512, + "x2": 0.882, + "y2": 0.518 + }, + { + "filename": "gfx/capitalShips/unfCorvette01/component4.png", + "x": 1808, + "y": 1048, + "w": 49, + "h": 12, + "rotated": false, + "x1": 0.883, + "y1": 0.512, + "x2": 0.906, + "y2": 0.517 + }, + { + "filename": "gfx/capitalShips/unfCorvette01/component3.png", + "x": 1858, + "y": 1048, + "w": 49, + "h": 12, + "rotated": false, + "x1": 0.907, + "y1": 0.512, + "x2": 0.931, + "y2": 0.517 + }, + { + "filename": "gfx/bullets/magBolt.png", + "x": 2037, + "y": 477, + "w": 10, + "h": 11, + "rotated": false, + "x1": 0.995, + "y1": 0.233, + "x2": 0.999, + "y2": 0.238 + }, + { + "filename": "gfx/capitalShips/hmsCorvette01/component2.png", + "x": 2003, + "y": 891, + "w": 19, + "h": 11, + "rotated": false, + "x1": 0.978, + "y1": 0.435, + "x2": 0.987, + "y2": 0.44 + }, + { + "filename": "gfx/hud/nextGun.png", + "x": 2037, + "y": 489, + "w": 10, + "h": 10, + "rotated": false, + "x1": 0.995, + "y1": 0.239, + "x2": 0.999, + "y2": 0.243 + }, + { + "filename": "gfx/capitalShips/infCorvette01/component3.png", + "x": 319, + "y": 555, + "w": 21, + "h": 9, + "rotated": false, + "x1": 0.156, + "y1": 0.271, + "x2": 0.166, + "y2": 0.275 + }, + { + "filename": "gfx/capitalShips/infCorvette01/component6.png", + "x": 341, + "y": 555, + "w": 24, + "h": 9, + "rotated": false, + "x1": 0.167, + "y1": 0.271, + "x2": 0.178, + "y2": 0.275 + }, + { + "filename": "gfx/debris/debris1.png", + "x": 1928, + "y": 518, + "w": 36, + "h": 8, + "rotated": false, + "x1": 0.942, + "y1": 0.253, + "x2": 0.959, + "y2": 0.257 + }, + { + "filename": "gfx/misc/whiteSquare.png", + "x": 2039, + "y": 179, + "w": 8, + "h": 8, + "rotated": false, + "x1": 0.996, + "y1": 0.088, + "x2": 0.999, + "y2": 0.091 + } +] \ No newline at end of file diff --git a/gfx/atlas/atlas.png b/gfx/atlas/atlas.png new file mode 100644 index 0000000..44d80f9 Binary files /dev/null and b/gfx/atlas/atlas.png differ diff --git a/gfx/battle/challengeComplete.png b/gfx/battle/challengeComplete.png deleted file mode 100644 index f66e3b1..0000000 Binary files a/gfx/battle/challengeComplete.png and /dev/null differ diff --git a/gfx/battle/challengeFailed.png b/gfx/battle/challengeFailed.png deleted file mode 100644 index 7abc61e..0000000 Binary files a/gfx/battle/challengeFailed.png and /dev/null differ diff --git a/gfx/battle/challengeInProgress.png b/gfx/battle/challengeInProgress.png deleted file mode 100644 index 489e8fa..0000000 Binary files a/gfx/battle/challengeInProgress.png and /dev/null differ diff --git a/gfx/battle/challengeStart.png b/gfx/battle/challengeStart.png deleted file mode 100644 index 2227bcc..0000000 Binary files a/gfx/battle/challengeStart.png and /dev/null differ diff --git a/gfx/battle/missionComplete.png b/gfx/battle/missionComplete.png deleted file mode 100644 index 62aa00a..0000000 Binary files a/gfx/battle/missionComplete.png and /dev/null differ diff --git a/gfx/battle/missionFailed.png b/gfx/battle/missionFailed.png deleted file mode 100644 index 9ce8efc..0000000 Binary files a/gfx/battle/missionFailed.png and /dev/null differ diff --git a/gfx/battle/missionInProgress.png b/gfx/battle/missionInProgress.png deleted file mode 100644 index 4f273fd..0000000 Binary files a/gfx/battle/missionInProgress.png and /dev/null differ diff --git a/gfx/battle/missionStart.png b/gfx/battle/missionStart.png deleted file mode 100644 index c79f9f3..0000000 Binary files a/gfx/battle/missionStart.png and /dev/null differ diff --git a/gfx/battle/timeUp.png b/gfx/battle/timeUp.png deleted file mode 100644 index 9b31d0c..0000000 Binary files a/gfx/battle/timeUp.png and /dev/null differ diff --git a/gfx/bullets/laser.png b/gfx/bullets/laser.png deleted file mode 100644 index b50c5e6..0000000 Binary files a/gfx/bullets/laser.png and /dev/null differ diff --git a/gfx/bullets/magBolt.png b/gfx/bullets/magBolt.png deleted file mode 100644 index eacdb22..0000000 Binary files a/gfx/bullets/magBolt.png and /dev/null differ diff --git a/gfx/bullets/missile.png b/gfx/bullets/missile.png deleted file mode 100644 index f87ed13..0000000 Binary files a/gfx/bullets/missile.png and /dev/null differ diff --git a/gfx/bullets/particleBolt.png b/gfx/bullets/particleBolt.png deleted file mode 100644 index 4c0adb5..0000000 Binary files a/gfx/bullets/particleBolt.png and /dev/null differ diff --git a/gfx/bullets/plasmaBolt.png b/gfx/bullets/plasmaBolt.png deleted file mode 100644 index 6c2b83e..0000000 Binary files a/gfx/bullets/plasmaBolt.png and /dev/null differ diff --git a/gfx/cannons/plasmaTurret.png b/gfx/cannons/plasmaTurret.png deleted file mode 100644 index bc90492..0000000 Binary files a/gfx/cannons/plasmaTurret.png and /dev/null differ diff --git a/gfx/cannons/rocketTurret.png b/gfx/cannons/rocketTurret.png deleted file mode 100644 index dd3fdc5..0000000 Binary files a/gfx/cannons/rocketTurret.png and /dev/null differ diff --git a/gfx/cannons/singlePlasmaTurret.png b/gfx/cannons/singlePlasmaTurret.png deleted file mode 100644 index 2bda235..0000000 Binary files a/gfx/cannons/singlePlasmaTurret.png and /dev/null differ diff --git a/gfx/capitalShips/common/cannon01.png b/gfx/capitalShips/common/cannon01.png deleted file mode 100644 index 0720229..0000000 Binary files a/gfx/capitalShips/common/cannon01.png and /dev/null differ diff --git a/gfx/capitalShips/csnCorvette01/body.png b/gfx/capitalShips/csnCorvette01/body.png deleted file mode 100644 index 2be2fd1..0000000 Binary files a/gfx/capitalShips/csnCorvette01/body.png and /dev/null differ diff --git a/gfx/capitalShips/csnCorvette01/component1.png b/gfx/capitalShips/csnCorvette01/component1.png deleted file mode 100644 index 4588608..0000000 Binary files a/gfx/capitalShips/csnCorvette01/component1.png and /dev/null differ diff --git a/gfx/capitalShips/csnCorvette01/component2.png b/gfx/capitalShips/csnCorvette01/component2.png deleted file mode 100644 index daf7e6f..0000000 Binary files a/gfx/capitalShips/csnCorvette01/component2.png and /dev/null differ diff --git a/gfx/capitalShips/csnCorvette01/component3.png b/gfx/capitalShips/csnCorvette01/component3.png deleted file mode 100644 index 0b8d087..0000000 Binary files a/gfx/capitalShips/csnCorvette01/component3.png and /dev/null differ diff --git a/gfx/capitalShips/csnCorvette01/core.png b/gfx/capitalShips/csnCorvette01/core.png deleted file mode 100644 index c0349c5..0000000 Binary files a/gfx/capitalShips/csnCorvette01/core.png and /dev/null differ diff --git a/gfx/capitalShips/csnCorvette01/engine1.png b/gfx/capitalShips/csnCorvette01/engine1.png deleted file mode 100644 index 77d0425..0000000 Binary files a/gfx/capitalShips/csnCorvette01/engine1.png and /dev/null differ diff --git a/gfx/capitalShips/csnCorvette02/body.png b/gfx/capitalShips/csnCorvette02/body.png deleted file mode 100644 index 0e4d2ce..0000000 Binary files a/gfx/capitalShips/csnCorvette02/body.png and /dev/null differ diff --git a/gfx/capitalShips/csnCorvette02/component1.png b/gfx/capitalShips/csnCorvette02/component1.png deleted file mode 100644 index 99b32f5..0000000 Binary files a/gfx/capitalShips/csnCorvette02/component1.png and /dev/null differ diff --git a/gfx/capitalShips/csnCorvette02/component2.png b/gfx/capitalShips/csnCorvette02/component2.png deleted file mode 100644 index 7bc4bc7..0000000 Binary files a/gfx/capitalShips/csnCorvette02/component2.png and /dev/null differ diff --git a/gfx/capitalShips/csnCorvette02/component3.png b/gfx/capitalShips/csnCorvette02/component3.png deleted file mode 100644 index 670c94d..0000000 Binary files a/gfx/capitalShips/csnCorvette02/component3.png and /dev/null differ diff --git a/gfx/capitalShips/csnCorvette02/component4.png b/gfx/capitalShips/csnCorvette02/component4.png deleted file mode 100644 index 8603084..0000000 Binary files a/gfx/capitalShips/csnCorvette02/component4.png and /dev/null differ diff --git a/gfx/capitalShips/csnCorvette02/component5.png b/gfx/capitalShips/csnCorvette02/component5.png deleted file mode 100644 index 9d773b1..0000000 Binary files a/gfx/capitalShips/csnCorvette02/component5.png and /dev/null differ diff --git a/gfx/capitalShips/csnCorvette02/core.png b/gfx/capitalShips/csnCorvette02/core.png deleted file mode 100644 index c0349c5..0000000 Binary files a/gfx/capitalShips/csnCorvette02/core.png and /dev/null differ diff --git a/gfx/capitalShips/csnCorvette02/engine1.png b/gfx/capitalShips/csnCorvette02/engine1.png deleted file mode 100644 index 1dc03c6..0000000 Binary files a/gfx/capitalShips/csnCorvette02/engine1.png and /dev/null differ diff --git a/gfx/capitalShips/csnCorvette02/engine2.png b/gfx/capitalShips/csnCorvette02/engine2.png deleted file mode 100644 index 36c08c0..0000000 Binary files a/gfx/capitalShips/csnCorvette02/engine2.png and /dev/null differ diff --git a/gfx/capitalShips/hmsCorvette01/body.png b/gfx/capitalShips/hmsCorvette01/body.png deleted file mode 100644 index 2ce07b3..0000000 Binary files a/gfx/capitalShips/hmsCorvette01/body.png and /dev/null differ diff --git a/gfx/capitalShips/hmsCorvette01/component1.png b/gfx/capitalShips/hmsCorvette01/component1.png deleted file mode 100644 index 1e745f5..0000000 Binary files a/gfx/capitalShips/hmsCorvette01/component1.png and /dev/null differ diff --git a/gfx/capitalShips/hmsCorvette01/component2.png b/gfx/capitalShips/hmsCorvette01/component2.png deleted file mode 100644 index cdd84b0..0000000 Binary files a/gfx/capitalShips/hmsCorvette01/component2.png and /dev/null differ diff --git a/gfx/capitalShips/hmsCorvette01/core.png b/gfx/capitalShips/hmsCorvette01/core.png deleted file mode 100644 index 30d2dd7..0000000 Binary files a/gfx/capitalShips/hmsCorvette01/core.png and /dev/null differ diff --git a/gfx/capitalShips/hmsCorvette01/engine1.png b/gfx/capitalShips/hmsCorvette01/engine1.png deleted file mode 100644 index c5a94ff..0000000 Binary files a/gfx/capitalShips/hmsCorvette01/engine1.png and /dev/null differ diff --git a/gfx/capitalShips/hmsCorvette01/engine2.png b/gfx/capitalShips/hmsCorvette01/engine2.png deleted file mode 100644 index ea0a8bf..0000000 Binary files a/gfx/capitalShips/hmsCorvette01/engine2.png and /dev/null differ diff --git a/gfx/capitalShips/hmsCorvette01/engine3.png b/gfx/capitalShips/hmsCorvette01/engine3.png deleted file mode 100644 index 47e54ff..0000000 Binary files a/gfx/capitalShips/hmsCorvette01/engine3.png and /dev/null differ diff --git a/gfx/capitalShips/hmsCorvette02/body.png b/gfx/capitalShips/hmsCorvette02/body.png deleted file mode 100644 index c39346d..0000000 Binary files a/gfx/capitalShips/hmsCorvette02/body.png and /dev/null differ diff --git a/gfx/capitalShips/hmsCorvette02/component1.png b/gfx/capitalShips/hmsCorvette02/component1.png deleted file mode 100644 index 5e66e32..0000000 Binary files a/gfx/capitalShips/hmsCorvette02/component1.png and /dev/null differ diff --git a/gfx/capitalShips/hmsCorvette02/component2.png b/gfx/capitalShips/hmsCorvette02/component2.png deleted file mode 100644 index f239c00..0000000 Binary files a/gfx/capitalShips/hmsCorvette02/component2.png and /dev/null differ diff --git a/gfx/capitalShips/hmsCorvette02/component3.png b/gfx/capitalShips/hmsCorvette02/component3.png deleted file mode 100644 index e6d8252..0000000 Binary files a/gfx/capitalShips/hmsCorvette02/component3.png and /dev/null differ diff --git a/gfx/capitalShips/hmsCorvette02/core.png b/gfx/capitalShips/hmsCorvette02/core.png deleted file mode 100644 index 30d2dd7..0000000 Binary files a/gfx/capitalShips/hmsCorvette02/core.png and /dev/null differ diff --git a/gfx/capitalShips/hmsCorvette02/engine01.png b/gfx/capitalShips/hmsCorvette02/engine01.png deleted file mode 100644 index 0f13d52..0000000 Binary files a/gfx/capitalShips/hmsCorvette02/engine01.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette01/body.png b/gfx/capitalShips/infCorvette01/body.png deleted file mode 100644 index b557875..0000000 Binary files a/gfx/capitalShips/infCorvette01/body.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette01/component1.png b/gfx/capitalShips/infCorvette01/component1.png deleted file mode 100644 index 2ae10b3..0000000 Binary files a/gfx/capitalShips/infCorvette01/component1.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette01/component2.png b/gfx/capitalShips/infCorvette01/component2.png deleted file mode 100644 index f3e93ba..0000000 Binary files a/gfx/capitalShips/infCorvette01/component2.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette01/component3.png b/gfx/capitalShips/infCorvette01/component3.png deleted file mode 100644 index cf053ca..0000000 Binary files a/gfx/capitalShips/infCorvette01/component3.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette01/component4.png b/gfx/capitalShips/infCorvette01/component4.png deleted file mode 100644 index bc71c1d..0000000 Binary files a/gfx/capitalShips/infCorvette01/component4.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette01/component5.png b/gfx/capitalShips/infCorvette01/component5.png deleted file mode 100644 index 07c1015..0000000 Binary files a/gfx/capitalShips/infCorvette01/component5.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette01/component6.png b/gfx/capitalShips/infCorvette01/component6.png deleted file mode 100644 index 0937d06..0000000 Binary files a/gfx/capitalShips/infCorvette01/component6.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette01/engine1.png b/gfx/capitalShips/infCorvette01/engine1.png deleted file mode 100644 index f8102e2..0000000 Binary files a/gfx/capitalShips/infCorvette01/engine1.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette01/engine2.png b/gfx/capitalShips/infCorvette01/engine2.png deleted file mode 100644 index ad9c0fc..0000000 Binary files a/gfx/capitalShips/infCorvette01/engine2.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette02/body.png b/gfx/capitalShips/infCorvette02/body.png deleted file mode 100644 index 48aee1d..0000000 Binary files a/gfx/capitalShips/infCorvette02/body.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette02/component1.png b/gfx/capitalShips/infCorvette02/component1.png deleted file mode 100644 index be32ef1..0000000 Binary files a/gfx/capitalShips/infCorvette02/component1.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette02/component2.png b/gfx/capitalShips/infCorvette02/component2.png deleted file mode 100644 index 0f326f5..0000000 Binary files a/gfx/capitalShips/infCorvette02/component2.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette02/component3.png b/gfx/capitalShips/infCorvette02/component3.png deleted file mode 100644 index 0d79597..0000000 Binary files a/gfx/capitalShips/infCorvette02/component3.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette02/component4.png b/gfx/capitalShips/infCorvette02/component4.png deleted file mode 100644 index 809ba05..0000000 Binary files a/gfx/capitalShips/infCorvette02/component4.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette02/core.png b/gfx/capitalShips/infCorvette02/core.png deleted file mode 100644 index 608be33..0000000 Binary files a/gfx/capitalShips/infCorvette02/core.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette02/engine1.png b/gfx/capitalShips/infCorvette02/engine1.png deleted file mode 100644 index e77e36d..0000000 Binary files a/gfx/capitalShips/infCorvette02/engine1.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette02/engine2.png b/gfx/capitalShips/infCorvette02/engine2.png deleted file mode 100644 index 8505140..0000000 Binary files a/gfx/capitalShips/infCorvette02/engine2.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette02/engine3.png b/gfx/capitalShips/infCorvette02/engine3.png deleted file mode 100644 index 781c64d..0000000 Binary files a/gfx/capitalShips/infCorvette02/engine3.png and /dev/null differ diff --git a/gfx/capitalShips/infCorvette02/engine4.png b/gfx/capitalShips/infCorvette02/engine4.png deleted file mode 100644 index 173278e..0000000 Binary files a/gfx/capitalShips/infCorvette02/engine4.png and /dev/null differ diff --git a/gfx/capitalShips/unfCorvette01/body.png b/gfx/capitalShips/unfCorvette01/body.png deleted file mode 100644 index 545efff..0000000 Binary files a/gfx/capitalShips/unfCorvette01/body.png and /dev/null differ diff --git a/gfx/capitalShips/unfCorvette01/component1.png b/gfx/capitalShips/unfCorvette01/component1.png deleted file mode 100644 index 8605cee..0000000 Binary files a/gfx/capitalShips/unfCorvette01/component1.png and /dev/null differ diff --git a/gfx/capitalShips/unfCorvette01/component2.png b/gfx/capitalShips/unfCorvette01/component2.png deleted file mode 100644 index 3365a3e..0000000 Binary files a/gfx/capitalShips/unfCorvette01/component2.png and /dev/null differ diff --git a/gfx/capitalShips/unfCorvette01/component3.png b/gfx/capitalShips/unfCorvette01/component3.png deleted file mode 100644 index 42d24d9..0000000 Binary files a/gfx/capitalShips/unfCorvette01/component3.png and /dev/null differ diff --git a/gfx/capitalShips/unfCorvette01/component4.png b/gfx/capitalShips/unfCorvette01/component4.png deleted file mode 100644 index 9e6fe97..0000000 Binary files a/gfx/capitalShips/unfCorvette01/component4.png and /dev/null differ diff --git a/gfx/capitalShips/unfCorvette01/component5.png b/gfx/capitalShips/unfCorvette01/component5.png deleted file mode 100644 index 335c622..0000000 Binary files a/gfx/capitalShips/unfCorvette01/component5.png and /dev/null differ diff --git a/gfx/capitalShips/unfCorvette01/component6.png b/gfx/capitalShips/unfCorvette01/component6.png deleted file mode 100644 index a689d2b..0000000 Binary files a/gfx/capitalShips/unfCorvette01/component6.png and /dev/null differ diff --git a/gfx/capitalShips/unfCorvette01/core.png b/gfx/capitalShips/unfCorvette01/core.png deleted file mode 100644 index 30d2dd7..0000000 Binary files a/gfx/capitalShips/unfCorvette01/core.png and /dev/null differ diff --git a/gfx/capitalShips/unfCorvette01/engine1.png b/gfx/capitalShips/unfCorvette01/engine1.png deleted file mode 100644 index a001ce2..0000000 Binary files a/gfx/capitalShips/unfCorvette01/engine1.png and /dev/null differ diff --git a/gfx/capitalShips/unfCorvette01/engine2.png b/gfx/capitalShips/unfCorvette01/engine2.png deleted file mode 100644 index ea18fe3..0000000 Binary files a/gfx/capitalShips/unfCorvette01/engine2.png and /dev/null differ diff --git a/gfx/capitalShips/unfCorvette02/body.png b/gfx/capitalShips/unfCorvette02/body.png deleted file mode 100644 index fff60a0..0000000 Binary files a/gfx/capitalShips/unfCorvette02/body.png and /dev/null differ diff --git a/gfx/capitalShips/unfCorvette02/component1.png b/gfx/capitalShips/unfCorvette02/component1.png deleted file mode 100644 index e866dc0..0000000 Binary files a/gfx/capitalShips/unfCorvette02/component1.png and /dev/null differ diff --git a/gfx/capitalShips/unfCorvette02/component2.png b/gfx/capitalShips/unfCorvette02/component2.png deleted file mode 100644 index a068e20..0000000 Binary files a/gfx/capitalShips/unfCorvette02/component2.png and /dev/null differ diff --git a/gfx/capitalShips/unfCorvette02/component3.png b/gfx/capitalShips/unfCorvette02/component3.png deleted file mode 100644 index 48bb02c..0000000 Binary files a/gfx/capitalShips/unfCorvette02/component3.png and /dev/null differ diff --git a/gfx/capitalShips/unfCorvette02/engine1.png b/gfx/capitalShips/unfCorvette02/engine1.png deleted file mode 100644 index 3e42008..0000000 Binary files a/gfx/capitalShips/unfCorvette02/engine1.png and /dev/null differ diff --git a/gfx/capitalShips/unfCorvette02/engine2.png b/gfx/capitalShips/unfCorvette02/engine2.png deleted file mode 100644 index ee53692..0000000 Binary files a/gfx/capitalShips/unfCorvette02/engine2.png and /dev/null differ diff --git a/gfx/challenges/challengeIcon.png b/gfx/challenges/challengeIcon.png deleted file mode 100644 index fb2265e..0000000 Binary files a/gfx/challenges/challengeIcon.png and /dev/null differ diff --git a/gfx/challenges/challengeIconHighlight.png b/gfx/challenges/challengeIconHighlight.png deleted file mode 100644 index f9ad910..0000000 Binary files a/gfx/challenges/challengeIconHighlight.png and /dev/null differ diff --git a/gfx/craft/civilian01.png b/gfx/craft/civilian01.png deleted file mode 100644 index b99cb4e..0000000 Binary files a/gfx/craft/civilian01.png and /dev/null differ diff --git a/gfx/craft/civilian02.png b/gfx/craft/civilian02.png deleted file mode 100644 index 5b208be..0000000 Binary files a/gfx/craft/civilian02.png and /dev/null differ diff --git a/gfx/craft/infTug.png b/gfx/craft/infTug.png deleted file mode 100644 index c1c27c8..0000000 Binary files a/gfx/craft/infTug.png and /dev/null differ diff --git a/gfx/craft/munitionsTransport.png b/gfx/craft/munitionsTransport.png deleted file mode 100644 index 258c3fc..0000000 Binary files a/gfx/craft/munitionsTransport.png and /dev/null differ diff --git a/gfx/craft/shuttle.png b/gfx/craft/shuttle.png deleted file mode 100644 index 9ffb0bf..0000000 Binary files a/gfx/craft/shuttle.png and /dev/null differ diff --git a/gfx/craft/supplyShip.png b/gfx/craft/supplyShip.png deleted file mode 100644 index c3928b6..0000000 Binary files a/gfx/craft/supplyShip.png and /dev/null differ diff --git a/gfx/craft/tug.png b/gfx/craft/tug.png deleted file mode 100644 index 7516dbc..0000000 Binary files a/gfx/craft/tug.png and /dev/null differ diff --git a/gfx/debris/debris1.png b/gfx/debris/debris1.png deleted file mode 100644 index 3f24190..0000000 Binary files a/gfx/debris/debris1.png and /dev/null differ diff --git a/gfx/debris/debris2.png b/gfx/debris/debris2.png deleted file mode 100644 index 2a66d7e..0000000 Binary files a/gfx/debris/debris2.png and /dev/null differ diff --git a/gfx/debris/debris3.png b/gfx/debris/debris3.png deleted file mode 100644 index 8d429c8..0000000 Binary files a/gfx/debris/debris3.png and /dev/null differ diff --git a/gfx/debris/debris4.png b/gfx/debris/debris4.png deleted file mode 100644 index 217fed6..0000000 Binary files a/gfx/debris/debris4.png and /dev/null differ diff --git a/gfx/debris/debris5.png b/gfx/debris/debris5.png deleted file mode 100644 index 39ba84f..0000000 Binary files a/gfx/debris/debris5.png and /dev/null differ diff --git a/gfx/debris/debris6.png b/gfx/debris/debris6.png deleted file mode 100644 index 4de2362..0000000 Binary files a/gfx/debris/debris6.png and /dev/null differ diff --git a/gfx/effects/explosion.png b/gfx/effects/explosion.png deleted file mode 100644 index f3bb539..0000000 Binary files a/gfx/effects/explosion.png and /dev/null differ diff --git a/gfx/effects/halo.png b/gfx/effects/halo.png deleted file mode 100644 index b40fcfa..0000000 Binary files a/gfx/effects/halo.png and /dev/null differ diff --git a/gfx/effects/shieldHit.png b/gfx/effects/shieldHit.png deleted file mode 100644 index 9d457aa..0000000 Binary files a/gfx/effects/shieldHit.png and /dev/null differ diff --git a/gfx/entities/jumpgate.png b/gfx/entities/jumpgate.png deleted file mode 100644 index 4548afc..0000000 Binary files a/gfx/entities/jumpgate.png and /dev/null differ diff --git a/gfx/entities/jumpgateNode.png b/gfx/entities/jumpgateNode.png deleted file mode 100644 index 1362b27..0000000 Binary files a/gfx/entities/jumpgateNode.png and /dev/null differ diff --git a/gfx/entities/mine.png b/gfx/entities/mine.png deleted file mode 100644 index c0135fc..0000000 Binary files a/gfx/entities/mine.png and /dev/null differ diff --git a/gfx/entities/mineWarning.png b/gfx/entities/mineWarning.png deleted file mode 100644 index 8b78308..0000000 Binary files a/gfx/entities/mineWarning.png and /dev/null differ diff --git a/gfx/entities/portal.png b/gfx/entities/portal.png deleted file mode 100644 index 82c87e0..0000000 Binary files a/gfx/entities/portal.png and /dev/null differ diff --git a/gfx/entities/shadowMine.png b/gfx/entities/shadowMine.png deleted file mode 100644 index d018b85..0000000 Binary files a/gfx/entities/shadowMine.png and /dev/null differ diff --git a/gfx/entities/waypoint.png b/gfx/entities/waypoint.png deleted file mode 100644 index 7a8fee7..0000000 Binary files a/gfx/entities/waypoint.png and /dev/null differ diff --git a/gfx/fighters/angel.png b/gfx/fighters/angel.png deleted file mode 100644 index 2aea0ba..0000000 Binary files a/gfx/fighters/angel.png and /dev/null differ diff --git a/gfx/fighters/ataf.png b/gfx/fighters/ataf.png deleted file mode 100644 index 26c8c21..0000000 Binary files a/gfx/fighters/ataf.png and /dev/null differ diff --git a/gfx/fighters/blizzard.png b/gfx/fighters/blizzard.png deleted file mode 100644 index 16dfe28..0000000 Binary files a/gfx/fighters/blizzard.png and /dev/null differ diff --git a/gfx/fighters/dart01.png b/gfx/fighters/dart01.png deleted file mode 100644 index 7e50369..0000000 Binary files a/gfx/fighters/dart01.png and /dev/null differ diff --git a/gfx/fighters/dart02.png b/gfx/fighters/dart02.png deleted file mode 100644 index bacd590..0000000 Binary files a/gfx/fighters/dart02.png and /dev/null differ diff --git a/gfx/fighters/dart03.png b/gfx/fighters/dart03.png deleted file mode 100644 index 3b61fe5..0000000 Binary files a/gfx/fighters/dart03.png and /dev/null differ diff --git a/gfx/fighters/dart04.png b/gfx/fighters/dart04.png deleted file mode 100644 index fc5e24a..0000000 Binary files a/gfx/fighters/dart04.png and /dev/null differ diff --git a/gfx/fighters/dart05.png b/gfx/fighters/dart05.png deleted file mode 100644 index e3ed507..0000000 Binary files a/gfx/fighters/dart05.png and /dev/null differ diff --git a/gfx/fighters/dart06.png b/gfx/fighters/dart06.png deleted file mode 100644 index 9e54209..0000000 Binary files a/gfx/fighters/dart06.png and /dev/null differ diff --git a/gfx/fighters/dart07.png b/gfx/fighters/dart07.png deleted file mode 100644 index 6981bb3..0000000 Binary files a/gfx/fighters/dart07.png and /dev/null differ diff --git a/gfx/fighters/firefly.png b/gfx/fighters/firefly.png deleted file mode 100644 index edff0ed..0000000 Binary files a/gfx/fighters/firefly.png and /dev/null differ diff --git a/gfx/fighters/hammerhead.png b/gfx/fighters/hammerhead.png deleted file mode 100644 index 9d82b63..0000000 Binary files a/gfx/fighters/hammerhead.png and /dev/null differ diff --git a/gfx/fighters/hyena.png b/gfx/fighters/hyena.png deleted file mode 100644 index 486c1ab..0000000 Binary files a/gfx/fighters/hyena.png and /dev/null differ diff --git a/gfx/fighters/jackal.png b/gfx/fighters/jackal.png deleted file mode 100644 index 4d865f3..0000000 Binary files a/gfx/fighters/jackal.png and /dev/null differ diff --git a/gfx/fighters/khepri.png b/gfx/fighters/khepri.png deleted file mode 100644 index e583c9e..0000000 Binary files a/gfx/fighters/khepri.png and /dev/null differ diff --git a/gfx/fighters/kingfisher.png b/gfx/fighters/kingfisher.png deleted file mode 100644 index 5ff0eac..0000000 Binary files a/gfx/fighters/kingfisher.png and /dev/null differ diff --git a/gfx/fighters/leopard.png b/gfx/fighters/leopard.png deleted file mode 100644 index f9ba7b4..0000000 Binary files a/gfx/fighters/leopard.png and /dev/null differ diff --git a/gfx/fighters/lynx.png b/gfx/fighters/lynx.png deleted file mode 100644 index 463949a..0000000 Binary files a/gfx/fighters/lynx.png and /dev/null differ diff --git a/gfx/fighters/mantis.png b/gfx/fighters/mantis.png deleted file mode 100644 index a6ce6d6..0000000 Binary files a/gfx/fighters/mantis.png and /dev/null differ diff --git a/gfx/fighters/nymph.png b/gfx/fighters/nymph.png deleted file mode 100644 index ba87df4..0000000 Binary files a/gfx/fighters/nymph.png and /dev/null differ diff --git a/gfx/fighters/ray.png b/gfx/fighters/ray.png deleted file mode 100644 index eedf5a8..0000000 Binary files a/gfx/fighters/ray.png and /dev/null differ diff --git a/gfx/fighters/razor.png b/gfx/fighters/razor.png deleted file mode 100644 index ca0ee3d..0000000 Binary files a/gfx/fighters/razor.png and /dev/null differ diff --git a/gfx/fighters/rook.png b/gfx/fighters/rook.png deleted file mode 100644 index aa7489a..0000000 Binary files a/gfx/fighters/rook.png and /dev/null differ diff --git a/gfx/fighters/scarab.png b/gfx/fighters/scarab.png deleted file mode 100644 index f46ba11..0000000 Binary files a/gfx/fighters/scarab.png and /dev/null differ diff --git a/gfx/fighters/shale.png b/gfx/fighters/shale.png deleted file mode 100644 index 8e877fd..0000000 Binary files a/gfx/fighters/shale.png and /dev/null differ diff --git a/gfx/fighters/sk31.png b/gfx/fighters/sk31.png deleted file mode 100644 index 2dc3b5c..0000000 Binary files a/gfx/fighters/sk31.png and /dev/null differ diff --git a/gfx/fighters/sk34.png b/gfx/fighters/sk34.png deleted file mode 100644 index d4d5f06..0000000 Binary files a/gfx/fighters/sk34.png and /dev/null differ diff --git a/gfx/fighters/sphinx.png b/gfx/fighters/sphinx.png deleted file mode 100644 index 0c4110e..0000000 Binary files a/gfx/fighters/sphinx.png and /dev/null differ diff --git a/gfx/fighters/swarmer.png b/gfx/fighters/swarmer.png deleted file mode 100644 index 34a9285..0000000 Binary files a/gfx/fighters/swarmer.png and /dev/null differ diff --git a/gfx/fighters/taf.png b/gfx/fighters/taf.png deleted file mode 100644 index 55b689a..0000000 Binary files a/gfx/fighters/taf.png and /dev/null differ diff --git a/gfx/fighters/thunderhead.png b/gfx/fighters/thunderhead.png deleted file mode 100644 index 402eab1..0000000 Binary files a/gfx/fighters/thunderhead.png and /dev/null differ diff --git a/gfx/fighters/zakSphinx.png b/gfx/fighters/zakSphinx.png deleted file mode 100644 index cd557fb..0000000 Binary files a/gfx/fighters/zakSphinx.png and /dev/null differ diff --git a/gfx/galaxy/arrow.png b/gfx/galaxy/arrow.png deleted file mode 100644 index 44df511..0000000 Binary files a/gfx/galaxy/arrow.png and /dev/null differ diff --git a/gfx/galaxy/starSystem.png b/gfx/galaxy/starSystem.png deleted file mode 100644 index 44b22bc..0000000 Binary files a/gfx/galaxy/starSystem.png and /dev/null differ diff --git a/gfx/hud/armour.png b/gfx/hud/armour.png deleted file mode 100644 index 72c7494..0000000 Binary files a/gfx/hud/armour.png and /dev/null differ diff --git a/gfx/hud/boost.png b/gfx/hud/boost.png deleted file mode 100644 index bc3bb32..0000000 Binary files a/gfx/hud/boost.png and /dev/null differ diff --git a/gfx/hud/clock.png b/gfx/hud/clock.png deleted file mode 100644 index 978612d..0000000 Binary files a/gfx/hud/clock.png and /dev/null differ diff --git a/gfx/hud/ecm.png b/gfx/hud/ecm.png deleted file mode 100644 index 0b9ed15..0000000 Binary files a/gfx/hud/ecm.png and /dev/null differ diff --git a/gfx/hud/nextGun.png b/gfx/hud/nextGun.png deleted file mode 100644 index 86bce12..0000000 Binary files a/gfx/hud/nextGun.png and /dev/null differ diff --git a/gfx/hud/objectives.png b/gfx/hud/objectives.png deleted file mode 100644 index d106699..0000000 Binary files a/gfx/hud/objectives.png and /dev/null differ diff --git a/gfx/hud/radar.png b/gfx/hud/radar.png deleted file mode 100644 index 9b0cb2a..0000000 Binary files a/gfx/hud/radar.png and /dev/null differ diff --git a/gfx/hud/radarWarning.png b/gfx/hud/radarWarning.png deleted file mode 100644 index 47ee353..0000000 Binary files a/gfx/hud/radarWarning.png and /dev/null differ diff --git a/gfx/hud/shield.png b/gfx/hud/shield.png deleted file mode 100644 index ec412fc..0000000 Binary files a/gfx/hud/shield.png and /dev/null differ diff --git a/gfx/hud/smallFighter.png b/gfx/hud/smallFighter.png deleted file mode 100644 index 4479e43..0000000 Binary files a/gfx/hud/smallFighter.png and /dev/null differ diff --git a/gfx/hud/targetCircle.png b/gfx/hud/targetCircle.png deleted file mode 100644 index e1d7b40..0000000 Binary files a/gfx/hud/targetCircle.png and /dev/null differ diff --git a/gfx/hud/targetPointer.png b/gfx/hud/targetPointer.png deleted file mode 100644 index 1e35565..0000000 Binary files a/gfx/hud/targetPointer.png and /dev/null differ diff --git a/gfx/input/mousePointer.png b/gfx/input/mousePointer.png deleted file mode 100644 index c35dd95..0000000 Binary files a/gfx/input/mousePointer.png and /dev/null differ diff --git a/gfx/input/mousePointerMove.png b/gfx/input/mousePointerMove.png deleted file mode 100644 index 9894621..0000000 Binary files a/gfx/input/mousePointerMove.png and /dev/null differ diff --git a/gfx/items/coin01.png b/gfx/items/coin01.png deleted file mode 100644 index d815e83..0000000 Binary files a/gfx/items/coin01.png and /dev/null differ diff --git a/gfx/items/coin02.png b/gfx/items/coin02.png deleted file mode 100644 index 8297648..0000000 Binary files a/gfx/items/coin02.png and /dev/null differ diff --git a/gfx/items/crate.png b/gfx/items/crate.png deleted file mode 100644 index 3487523..0000000 Binary files a/gfx/items/crate.png and /dev/null differ diff --git a/gfx/items/diamond01.png b/gfx/items/diamond01.png deleted file mode 100644 index 239a025..0000000 Binary files a/gfx/items/diamond01.png and /dev/null differ diff --git a/gfx/items/diamond02.png b/gfx/items/diamond02.png deleted file mode 100644 index 4de9505..0000000 Binary files a/gfx/items/diamond02.png and /dev/null differ diff --git a/gfx/items/diamond03.png b/gfx/items/diamond03.png deleted file mode 100644 index 68adda5..0000000 Binary files a/gfx/items/diamond03.png and /dev/null differ diff --git a/gfx/items/gem01.png b/gfx/items/gem01.png deleted file mode 100644 index 96819f1..0000000 Binary files a/gfx/items/gem01.png and /dev/null differ diff --git a/gfx/items/gem02.png b/gfx/items/gem02.png deleted file mode 100644 index 5420d57..0000000 Binary files a/gfx/items/gem02.png and /dev/null differ diff --git a/gfx/items/gem03.png b/gfx/items/gem03.png deleted file mode 100644 index 07a574e..0000000 Binary files a/gfx/items/gem03.png and /dev/null differ diff --git a/gfx/items/powerCore01.png b/gfx/items/powerCore01.png deleted file mode 100644 index a3dc23e..0000000 Binary files a/gfx/items/powerCore01.png and /dev/null differ diff --git a/gfx/items/powerCore02.png b/gfx/items/powerCore02.png deleted file mode 100644 index 3482fa4..0000000 Binary files a/gfx/items/powerCore02.png and /dev/null differ diff --git a/gfx/items/powerCore03.png b/gfx/items/powerCore03.png deleted file mode 100644 index 6dae933..0000000 Binary files a/gfx/items/powerCore03.png and /dev/null differ diff --git a/gfx/items/smallCrate.png b/gfx/items/smallCrate.png deleted file mode 100644 index 12bd479..0000000 Binary files a/gfx/items/smallCrate.png and /dev/null differ diff --git a/gfx/misc/torelliFireStorm.png b/gfx/misc/torelliFireStorm.png deleted file mode 100644 index 29fa4ca..0000000 Binary files a/gfx/misc/torelliFireStorm.png and /dev/null differ diff --git a/gfx/planets/alexandria.png b/gfx/planets/alexandria.png deleted file mode 100644 index 185acf5..0000000 Binary files a/gfx/planets/alexandria.png and /dev/null differ diff --git a/gfx/planets/arlos.png b/gfx/planets/arlos.png deleted file mode 100755 index 32b3ebe..0000000 Binary files a/gfx/planets/arlos.png and /dev/null differ diff --git a/gfx/planets/bluePlanet.png b/gfx/planets/bluePlanet.png deleted file mode 100755 index b7dfe0e..0000000 Binary files a/gfx/planets/bluePlanet.png and /dev/null differ diff --git a/gfx/planets/diso.png b/gfx/planets/diso.png deleted file mode 100755 index ae1b988..0000000 Binary files a/gfx/planets/diso.png and /dev/null differ diff --git a/gfx/planets/earth.png b/gfx/planets/earth.png deleted file mode 100755 index c8e8c7a..0000000 Binary files a/gfx/planets/earth.png and /dev/null differ diff --git a/gfx/planets/flint.png b/gfx/planets/flint.png deleted file mode 100644 index 3c7bacd..0000000 Binary files a/gfx/planets/flint.png and /dev/null differ diff --git a/gfx/planets/hyanik.png b/gfx/planets/hyanik.png deleted file mode 100755 index 10cd014..0000000 Binary files a/gfx/planets/hyanik.png and /dev/null differ diff --git a/gfx/planets/lewis.png b/gfx/planets/lewis.png deleted file mode 100644 index 56460f5..0000000 Binary files a/gfx/planets/lewis.png and /dev/null differ diff --git a/gfx/planets/mythos.png b/gfx/planets/mythos.png deleted file mode 100755 index dbcc133..0000000 Binary files a/gfx/planets/mythos.png and /dev/null differ diff --git a/gfx/planets/oracleIX.png b/gfx/planets/oracleIX.png deleted file mode 100755 index d850c2d..0000000 Binary files a/gfx/planets/oracleIX.png and /dev/null differ diff --git a/gfx/planets/rockford.png b/gfx/planets/rockford.png deleted file mode 100644 index fec6693..0000000 Binary files a/gfx/planets/rockford.png and /dev/null differ diff --git a/gfx/planets/spirit.png b/gfx/planets/spirit.png deleted file mode 100755 index 61beb96..0000000 Binary files a/gfx/planets/spirit.png and /dev/null differ diff --git a/gfx/planets/star.png b/gfx/planets/star.png deleted file mode 100644 index 84f8f9b..0000000 Binary files a/gfx/planets/star.png and /dev/null differ diff --git a/gfx/planets/torelli.png b/gfx/planets/torelli.png deleted file mode 100755 index 0795b77..0000000 Binary files a/gfx/planets/torelli.png and /dev/null differ diff --git a/gfx/planets/tzac.png b/gfx/planets/tzac.png deleted file mode 100644 index a690b26..0000000 Binary files a/gfx/planets/tzac.png and /dev/null differ diff --git a/gfx/title/logo.png b/gfx/title/logo.png deleted file mode 100644 index 2cb8112..0000000 Binary files a/gfx/title/logo.png and /dev/null differ diff --git a/gfx/title/pandoran.png b/gfx/title/pandoran.png deleted file mode 100644 index 3f816e3..0000000 Binary files a/gfx/title/pandoran.png and /dev/null differ diff --git a/gfx/trophies/alertSphere.png b/gfx/trophies/alertSphere.png deleted file mode 100644 index ebcdbd7..0000000 Binary files a/gfx/trophies/alertSphere.png and /dev/null differ diff --git a/gfx/trophies/bronze.png b/gfx/trophies/bronze.png deleted file mode 100644 index f477d39..0000000 Binary files a/gfx/trophies/bronze.png and /dev/null differ diff --git a/gfx/trophies/gold.png b/gfx/trophies/gold.png deleted file mode 100644 index 76c4430..0000000 Binary files a/gfx/trophies/gold.png and /dev/null differ diff --git a/gfx/trophies/platinum.png b/gfx/trophies/platinum.png deleted file mode 100644 index b90f557..0000000 Binary files a/gfx/trophies/platinum.png and /dev/null differ diff --git a/gfx/trophies/silver.png b/gfx/trophies/silver.png deleted file mode 100644 index 6d4ae0e..0000000 Binary files a/gfx/trophies/silver.png and /dev/null differ diff --git a/gfx/trophies/sparkle.png b/gfx/trophies/sparkle.png deleted file mode 100644 index 0f46185..0000000 Binary files a/gfx/trophies/sparkle.png and /dev/null differ diff --git a/gfx/trophies/unearned.png b/gfx/trophies/unearned.png deleted file mode 100644 index 5e19e54..0000000 Binary files a/gfx/trophies/unearned.png and /dev/null differ diff --git a/gfx/widgets/optionsLeft.png b/gfx/widgets/optionsLeft.png deleted file mode 100644 index 29da76b..0000000 Binary files a/gfx/widgets/optionsLeft.png and /dev/null differ diff --git a/gfx/widgets/optionsRight.png b/gfx/widgets/optionsRight.png deleted file mode 100644 index 4a0d7fe..0000000 Binary files a/gfx/widgets/optionsRight.png and /dev/null differ diff --git a/src/battle/battle.c b/src/battle/battle.c index 78e027a..23d34c7 100644 --- a/src/battle/battle.c +++ b/src/battle/battle.c @@ -229,7 +229,7 @@ static void draw(void) if (battle.destroyTorelli) { SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND); - SDL_SetTextureAlphaMod(battle.fireStormTexture, battle.torelliFireStormAlpha); + SDL_SetTextureAlphaMod(battle.fireStormTexture->texture, battle.torelliFireStormAlpha); blitScaled(battle.fireStormTexture, battle.planet.x, battle.planet.y, battle.planetWidth, battle.planetHeight, 0); SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE); } diff --git a/src/battle/battle.h b/src/battle/battle.h index 7ced8e5..072acb9 100644 --- a/src/battle/battle.h +++ b/src/battle/battle.h @@ -40,7 +40,7 @@ extern void drawEffects(void); extern void doEffects(void); extern void doObjectives(void); extern void doChallenges(void); -extern void blitScaled(SDL_Texture *texture, int x, int y, int w, int h, int center); +extern void blitScaled(AtlasImage *atlasImage, int x, int y, int w, int h, int center); extern void initHud(void); extern void initRadar(void); extern void initGalacticMap(void); diff --git a/src/battle/bullets.c b/src/battle/bullets.c index d9b08a1..a70b04f 100644 --- a/src/battle/bullets.c +++ b/src/battle/bullets.c @@ -58,11 +58,12 @@ void initBulletDefs(void) def = &bulletDef[type]; def->type = type; def->damage = cJSON_GetObjectItem(node, "damage")->valueint; - def->texture = getTexture(cJSON_GetObjectItem(node, "texture")->valuestring); + def->texture = getAtlasImage(cJSON_GetObjectItem(node, "texture")->valuestring); def->sound = lookup(cJSON_GetObjectItem(node, "sound")->valuestring); def->flags = flagsToLong(cJSON_GetObjectItem(node, "flags")->valuestring, NULL); - SDL_QueryTexture(def->texture, NULL, NULL, &def->w, &def->h); + def->w = def->texture->rect.w; + def->h = def->texture->rect.h; } cJSON_Delete(root); diff --git a/src/battle/bullets.h b/src/battle/bullets.h index 61da8a0..82ffd1e 100644 --- a/src/battle/bullets.h +++ b/src/battle/bullets.h @@ -28,8 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define MISSILE_LIFE (FPS * 30) -extern SDL_Texture *getTexture(char *filename); -extern void blitRotated(SDL_Texture *texture, int x, int y, float angle); +extern AtlasImage *getAtlasImage(char *filename); +extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle); extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2); extern void damageFighter(Entity *e, int damage, long flags); extern void playBattleSound(int id, int x, int y); diff --git a/src/battle/capitalShips.c b/src/battle/capitalShips.c index 8cf5d7a..af6bc6b 100644 --- a/src/battle/capitalShips.c +++ b/src/battle/capitalShips.c @@ -449,7 +449,7 @@ static void loadCapitalShipDef(char *filename) STRNCPY(e->defName, e->name, MAX_NAME_LENGTH); e->shield = e->maxShield = cJSON_GetObjectItem(root, "shield")->valueint; e->shieldRechargeRate = cJSON_GetObjectItem(root, "shieldRechargeRate")->valueint; - e->texture = getTexture(cJSON_GetObjectItem(root, "texture")->valuestring); + e->texture = getAtlasImage(cJSON_GetObjectItem(root, "texture")->valuestring); e->speed = 1; e->systemPower = 3; e->flags = EF_NO_HEALTH_BAR; @@ -457,7 +457,8 @@ static void loadCapitalShipDef(char *filename) e->action = think; e->die = die; - SDL_QueryTexture(e->texture, NULL, NULL, &e->w, &e->h); + e->w = e->texture->rect.w; + e->h = e->texture->rect.h; e->separationRadius = MAX(e->w, e->h); @@ -501,9 +502,10 @@ static void loadComponents(Entity *parent, cJSON *components) e->health = e->maxHealth = cJSON_GetObjectItem(component, "health")->valueint; e->offsetX = cJSON_GetObjectItem(component, "x")->valueint; e->offsetY = cJSON_GetObjectItem(component, "y")->valueint; - e->texture = getTexture(cJSON_GetObjectItem(component, "texture")->valuestring); + e->texture = getAtlasImage(cJSON_GetObjectItem(component, "texture")->valuestring); - SDL_QueryTexture(e->texture, NULL, NULL, &e->w, &e->h); + e->w = e->texture->rect.w; + e->h = e->texture->rect.h; if (cJSON_GetObjectItem(component, "flags")) { @@ -553,7 +555,7 @@ static void loadGuns(Entity *parent, cJSON *guns) e->reloadTime = cJSON_GetObjectItem(gun, "reloadTime")->valueint; e->offsetX = cJSON_GetObjectItem(gun, "x")->valueint; e->offsetY = cJSON_GetObjectItem(gun, "y")->valueint; - e->texture = getTexture(cJSON_GetObjectItem(gun, "texture")->valuestring); + e->texture = getAtlasImage(cJSON_GetObjectItem(gun, "texture")->valuestring); e->guns[0].type = lookup(cJSON_GetObjectItem(gun, "type")->valuestring); e->missiles = getJSONValue(gun, "missiles", 0); @@ -567,7 +569,8 @@ static void loadGuns(Entity *parent, cJSON *guns) e->aiFlags = flagsToLong(cJSON_GetObjectItem(gun, "aiFlags")->valuestring, NULL); } - SDL_QueryTexture(e->texture, NULL, NULL, &e->w, &e->h); + e->w = e->texture->rect.w; + e->h = e->texture->rect.h; e->systemPower = MAX_SYSTEM_POWER; @@ -603,14 +606,15 @@ static void loadEngines(Entity *parent, cJSON *engines) e->health = e->maxHealth = cJSON_GetObjectItem(engine, "health")->valueint; e->offsetX = cJSON_GetObjectItem(engine, "x")->valueint; e->offsetY = cJSON_GetObjectItem(engine, "y")->valueint; - e->texture = getTexture(cJSON_GetObjectItem(engine, "texture")->valuestring); + e->texture = getAtlasImage(cJSON_GetObjectItem(engine, "texture")->valuestring); if (cJSON_GetObjectItem(engine, "flags")) { e->flags = flagsToLong(cJSON_GetObjectItem(engine, "flags")->valuestring, NULL); } - SDL_QueryTexture(e->texture, NULL, NULL, &e->w, &e->h); + e->w = e->texture->rect.w; + e->h = e->texture->rect.h; e->systemPower = MAX_SYSTEM_POWER; diff --git a/src/battle/capitalShips.h b/src/battle/capitalShips.h index 47468ce..009162a 100644 --- a/src/battle/capitalShips.h +++ b/src/battle/capitalShips.h @@ -29,7 +29,7 @@ extern Entity *spawnEntity(void); extern void addSmallExplosion(void); extern void playBattleSound(int id, int x, int y); extern float getAngle(int x1, int y1, int x2, int y2); -extern SDL_Texture *getTexture(char *filename); +extern AtlasImage *getAtlasImage(char *filename); extern char *readFile(char *filename); extern long flagsToLong(char *flags, int *add); extern long lookup(char *name); diff --git a/src/battle/debris.c b/src/battle/debris.c index 35f3c1e..76bad28 100644 --- a/src/battle/debris.c +++ b/src/battle/debris.c @@ -24,17 +24,17 @@ static void changeCourse(Debris *d); static void resizeDrawList(void); static Debris **debrisToDraw; -static SDL_Texture *debrisTexture[MAX_DEBRIS_TEXTURES]; +static AtlasImage *debrisTexture[MAX_DEBRIS_TEXTURES]; static int drawCapacity; void initDebris(void) { - debrisTexture[0] = getTexture("gfx/debris/debris1.png"); - debrisTexture[1] = getTexture("gfx/debris/debris2.png"); - debrisTexture[2] = getTexture("gfx/debris/debris3.png"); - debrisTexture[3] = getTexture("gfx/debris/debris4.png"); - debrisTexture[4] = getTexture("gfx/debris/debris5.png"); - debrisTexture[5] = getTexture("gfx/debris/debris6.png"); + debrisTexture[0] = getAtlasImage("gfx/debris/debris1.png"); + debrisTexture[1] = getAtlasImage("gfx/debris/debris2.png"); + debrisTexture[2] = getAtlasImage("gfx/debris/debris3.png"); + debrisTexture[3] = getAtlasImage("gfx/debris/debris4.png"); + debrisTexture[4] = getAtlasImage("gfx/debris/debris5.png"); + debrisTexture[5] = getAtlasImage("gfx/debris/debris6.png"); drawCapacity = INITIAL_DEBRIS_DRAW_CAPACITY; diff --git a/src/battle/debris.h b/src/battle/debris.h index 2cbe746..a3f9c0b 100644 --- a/src/battle/debris.h +++ b/src/battle/debris.h @@ -26,8 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define MAX_DEBRIS_TEXTURES 6 extern float mod(float n, float x); -extern void blitRotated(SDL_Texture *texture, int x, int y, float angle); -extern SDL_Texture *getTexture(char *filename); +extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle); +extern AtlasImage *getAtlasImage(char *filename); extern void addDebrisFire(int x, int y); extern void *resize(void *array, int oldSize, int newSize); extern int isOnBattleScreen(int x, int y, int w, int h); diff --git a/src/battle/effects.c b/src/battle/effects.c index b3aaae5..ba6e423 100644 --- a/src/battle/effects.c +++ b/src/battle/effects.c @@ -25,17 +25,17 @@ static void setRandomShieldHue(Effect *e); static void resizeDrawList(void); static int pointOnScreen(float x, float y); -static SDL_Texture *explosionTexture; -static SDL_Texture *shieldHitTexture; -static SDL_Texture *haloTexture; +static AtlasImage *explosionTexture; +static AtlasImage *shieldHitTexture; +static AtlasImage *haloTexture; static Effect **effectsToDraw; static int drawCapacity; void initEffects(void) { - explosionTexture = getTexture("gfx/effects/explosion.png"); - shieldHitTexture = getTexture("gfx/effects/shieldHit.png"); - haloTexture = getTexture("gfx/effects/halo.png"); + explosionTexture = getAtlasImage("gfx/effects/explosion.png"); + shieldHitTexture = getAtlasImage("gfx/effects/shieldHit.png"); + haloTexture = getAtlasImage("gfx/effects/halo.png"); drawCapacity = INITIAL_EFFECT_DRAW_CAPACITY; @@ -139,8 +139,8 @@ void drawEffects(void) { SDL_SetRenderDrawColor(app.renderer, e->r, e->g, e->b, e->a); - SDL_SetTextureBlendMode(e->texture, SDL_BLENDMODE_ADD); - SDL_SetTextureAlphaMod(e->texture, e->a); + SDL_SetTextureBlendMode(e->texture->texture, SDL_BLENDMODE_ADD); + SDL_SetTextureAlphaMod(e->texture->texture, e->a); switch (e->type) { @@ -153,22 +153,25 @@ void drawEffects(void) break; case EFFECT_TEXTURE: - SDL_SetTextureColorMod(e->texture, e->r, e->g, e->b); + SDL_SetTextureColorMod(e->texture->texture, e->r, e->g, e->b); blitScaled(e->texture, e->x - battle.camera.x, e->y - battle.camera.y, e->size, e->size, 0); break; case EFFECT_HALO: - SDL_SetTextureColorMod(e->texture, e->r, e->g, e->b); + SDL_SetTextureColorMod(e->texture->texture, e->r, e->g, e->b); blitScaled(e->texture, e->x - battle.camera.x - (e->size / 2), e->y - battle.camera.y - (e->size / 2), e->size, e->size, 0); break; case EFFECT_ECM: - SDL_SetTextureColorMod(e->texture, e->r, e->g, e->b); + SDL_SetTextureColorMod(e->texture->texture, e->r, e->g, e->b); blitScaled(e->texture, SCREEN_WIDTH / 2 - (e->size / 2), SCREEN_HEIGHT / 2 - (e->size / 2), e->size, e->size, 0); break; } + + SDL_SetTextureAlphaMod(e->texture->texture, 255); + SDL_SetTextureBlendMode(e->texture->texture, SDL_BLENDMODE_BLEND); } - + SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE); } @@ -176,8 +179,8 @@ void drawShieldHitEffect(Entity *e) { int size = MAX(e->w, e->h) + 32; - SDL_SetTextureBlendMode(shieldHitTexture, SDL_BLENDMODE_BLEND); - SDL_SetTextureAlphaMod(shieldHitTexture, e->shieldHit); + SDL_SetTextureBlendMode(shieldHitTexture->texture, SDL_BLENDMODE_BLEND); + SDL_SetTextureAlphaMod(shieldHitTexture->texture, e->shieldHit); blitScaled(shieldHitTexture, e->x - battle.camera.x, e->y - battle.camera.y, size, size, 1); } diff --git a/src/battle/effects.h b/src/battle/effects.h index 67e85a6..10454df 100644 --- a/src/battle/effects.h +++ b/src/battle/effects.h @@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define INITIAL_EFFECT_DRAW_CAPACITY 128 -extern void blitScaled(SDL_Texture *texture, int x, int y, int w, int h, int center); -extern SDL_Texture *getTexture(char *name); +extern void blitScaled(AtlasImage *atlasImage, int x, int y, int w, int h, int center); +extern AtlasImage *getAtlasImage(char *name); extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2); extern void *resize(void *array, int oldSize, int newSize); extern int isOnBattleScreen(int x, int y, int w, int h); diff --git a/src/battle/entities.c b/src/battle/entities.c index b12574c..38c2756 100644 --- a/src/battle/entities.c +++ b/src/battle/entities.c @@ -420,21 +420,21 @@ void drawEntities(void) static void drawEntity(Entity *e) { - SDL_SetTextureColorMod(e->texture, 255, 255, 255); + SDL_SetTextureColorMod(e->texture->texture, 255, 255, 255); if (e->armourHit > 0) { - SDL_SetTextureColorMod(e->texture, 255, 255 - e->armourHit, 255 - e->armourHit); + SDL_SetTextureColorMod(e->texture->texture, 255, 255 - e->armourHit, 255 - e->armourHit); } if (e->systemHit > 0) { - SDL_SetTextureColorMod(e->texture, 255 - e->systemHit, 255, 255); + SDL_SetTextureColorMod(e->texture->texture, 255 - e->systemHit, 255, 255); } if (e->flags & EF_DISABLED) { - SDL_SetTextureColorMod(e->texture, disabledGlow, disabledGlow, 255); + SDL_SetTextureColorMod(e->texture->texture, disabledGlow, disabledGlow, 255); } blitRotated(e->texture, e->x - battle.camera.x, e->y - battle.camera.y, e->angle); @@ -444,7 +444,7 @@ static void drawEntity(Entity *e) drawShieldHitEffect(e); } - SDL_SetTextureColorMod(e->texture, 255, 255, 255); + SDL_SetTextureColorMod(e->texture->texture, 255, 255, 255); } static void drawHealthBar(Entity *e) diff --git a/src/battle/entities.h b/src/battle/entities.h index 091b39e..45c4de1 100644 --- a/src/battle/entities.h +++ b/src/battle/entities.h @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define DISABLED_GLOW_MIN 128 #define DISABLED_GLOW_MAX 255 -extern void blitRotated(SDL_Texture *texture, int x, int y, float angle); +extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle); extern void doFighter(void); extern void doCapitalShip(void); extern void doRope(Entity *e); diff --git a/src/battle/fighters.c b/src/battle/fighters.c index e04333d..f6038cc 100644 --- a/src/battle/fighters.c +++ b/src/battle/fighters.c @@ -87,7 +87,7 @@ Entity *spawnFighter(char *name, int x, int y, int side) if (strcmp(name, "Civilian") == 0 && rand() % 2 == 0) { - e->texture = getTexture("gfx/craft/civilian02.png"); + e->texture = getAtlasImage("gfx/craft/civilian02.png"); } if (e->aiFlags & AIF_AGGRESSIVE) @@ -137,7 +137,7 @@ static void randomizeDart(Entity *dart) sprintf(texture, "gfx/fighters/dart0%d.png", 1 + rand() % 7); - dart->texture = getTexture(texture); + dart->texture = getAtlasImage(texture); } static void randomizeDartGuns(Entity *dart) @@ -756,7 +756,7 @@ Entity **getDBFighters(int *num) for (e = defHead.next ; e != NULL ; e = e->next) { - if (strlen(e->description) > 0) + if (e->description != NULL) { *num = *num + 1; } @@ -766,7 +766,7 @@ Entity **getDBFighters(int *num) for (e = defHead.next ; e != NULL ; e = e->next) { - if (strlen(e->description) > 0) + if (e->description != NULL) { dbFighters[i] = e; @@ -812,7 +812,7 @@ static void loadFighterDef(char *filename) cJSON *root, *node; char *text; Entity *e; - int i; + int i, len; SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Loading %s", filename); @@ -832,21 +832,23 @@ 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_DESCRIPTION_LENGTH); STRNCPY(e->affiliation, cJSON_GetObjectItem(root, "affiliation")->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; e->reloadTime = getJSONValue(root, "reloadTime", 0); e->shieldRechargeRate = getJSONValue(root, "shieldRechargeRate", 0); - e->texture = getTexture(cJSON_GetObjectItem(root, "texture")->valuestring); + e->texture = getAtlasImage(cJSON_GetObjectItem(root, "texture")->valuestring); - if (strlen(e->description) > 0) + if (strlen(cJSON_GetObjectItem(root, "description")->valuestring) > 0) { - STRNCPY(e->description, _(cJSON_GetObjectItem(root, "description")->valuestring), MAX_DESCRIPTION_LENGTH); + len = strlen(_(cJSON_GetObjectItem(root, "description")->valuestring)) + 1; + e->description = malloc(len); + strcpy(e->description, _(cJSON_GetObjectItem(root, "description")->valuestring)); } - SDL_QueryTexture(e->texture, NULL, NULL, &e->w, &e->h); + e->w = e->texture->rect.w; + e->h = e->texture->rect.h; if (cJSON_GetObjectItem(root, "guns")) { diff --git a/src/battle/fighters.h b/src/battle/fighters.h index f6ec4d3..2e429c0 100644 --- a/src/battle/fighters.h +++ b/src/battle/fighters.h @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../json/cJSON.h" -extern SDL_Texture *getTexture(char *filename); +extern AtlasImage *getAtlasImage(char *filename); extern void doAI(void); extern float getAngle(int x1, int y1, int x2, int y2); extern int getDistance(int x1, int y1, int x2, int y2); diff --git a/src/battle/hud.c b/src/battle/hud.c index e441f46..2c88c90 100644 --- a/src/battle/hud.c +++ b/src/battle/hud.c @@ -36,18 +36,18 @@ static void drawMissileWarning(void); static HudMessage hudMessageHead; static HudMessage *hudMessageTail; -static SDL_Texture *targetPointer; -static SDL_Texture *targetCircle; -static SDL_Texture *smallFighter; -static SDL_Texture *arrowLeft; -static SDL_Texture *arrowRight; -static SDL_Texture *armour; -static SDL_Texture *shield; -static SDL_Texture *ecm; -static SDL_Texture *boost; -static SDL_Texture *nextGun; -static SDL_Texture *clockIcon; -static SDL_Texture *objectives; +static AtlasImage *targetPointer; +static AtlasImage *targetCircle; +static AtlasImage *smallFighter; +static AtlasImage *arrowLeft; +static AtlasImage *arrowRight; +static AtlasImage *armour; +static AtlasImage *shield; +static AtlasImage *ecm; +static AtlasImage *boost; +static AtlasImage *nextGun; +static AtlasImage *clockIcon; +static AtlasImage *objectives; static int numMessages; static const char *gunName[BT_MAX]; static char *MISSILES_TEXT; @@ -91,18 +91,18 @@ void initHud(void) REMAINING_PILOTS_TEXT = _("Remaining Pilots: %d"); WARNING_TEXT = _("WARNING: INCOMING MISSILE!"); - targetPointer = getTexture("gfx/hud/targetPointer.png"); - targetCircle = getTexture("gfx/hud/targetCircle.png"); - smallFighter = getTexture("gfx/hud/smallFighter.png"); - arrowLeft = getTexture("gfx/widgets/optionsLeft.png"); - arrowRight = getTexture("gfx/widgets/optionsRight.png"); - armour = getTexture("gfx/hud/armour.png"); - shield = getTexture("gfx/hud/shield.png"); - ecm = getTexture("gfx/hud/ecm.png"); - boost = getTexture("gfx/hud/boost.png"); - nextGun = getTexture("gfx/hud/nextGun.png"); - clockIcon = getTexture("gfx/hud/clock.png"); - objectives = getTexture("gfx/hud/objectives.png"); + targetPointer = getAtlasImage("gfx/hud/targetPointer.png"); + targetCircle = getAtlasImage("gfx/hud/targetCircle.png"); + smallFighter = getAtlasImage("gfx/hud/smallFighter.png"); + arrowLeft = getAtlasImage("gfx/widgets/optionsLeft.png"); + arrowRight = getAtlasImage("gfx/widgets/optionsRight.png"); + armour = getAtlasImage("gfx/hud/armour.png"); + shield = getAtlasImage("gfx/hud/shield.png"); + ecm = getAtlasImage("gfx/hud/ecm.png"); + boost = getAtlasImage("gfx/hud/boost.png"); + nextGun = getAtlasImage("gfx/hud/nextGun.png"); + clockIcon = getAtlasImage("gfx/hud/clock.png"); + objectives = getAtlasImage("gfx/hud/objectives.png"); } void doHud(void) @@ -367,19 +367,19 @@ static void drawPlayerTargeter(void) { if (player->target) { - SDL_SetTextureColorMod(targetCircle, 255, 0, 0); + SDL_SetTextureColorMod(targetCircle->texture, 255, 0, 0); } else if (battle.missionTarget) { - SDL_SetTextureColorMod(targetCircle, 0, 255, 0); + SDL_SetTextureColorMod(targetCircle->texture, 0, 255, 0); } else if (battle.messageSpeaker) { - SDL_SetTextureColorMod(targetCircle, 255, 255, 255); + SDL_SetTextureColorMod(targetCircle->texture, 255, 255, 255); } else { - SDL_SetTextureColorMod(targetCircle, 255, 255, 0); + SDL_SetTextureColorMod(targetCircle->texture, 255, 255, 0); } blit(targetCircle, player->x - battle.camera.x, player->y - battle.camera.y, 1); @@ -394,7 +394,7 @@ static void drawPlayerTargeter(void) x += sin(TO_RAIDANS(angle)) * 45; y += -cos(TO_RAIDANS(angle)) * 45; - SDL_SetTextureColorMod(targetPointer, 255, 0, 0); + SDL_SetTextureColorMod(targetPointer->texture, 255, 0, 0); blitRotated(targetPointer, x - battle.camera.x, y - battle.camera.y, angle); } @@ -408,7 +408,7 @@ static void drawPlayerTargeter(void) x += sin(TO_RAIDANS(angle)) * 45; y += -cos(TO_RAIDANS(angle)) * 45; - SDL_SetTextureColorMod(targetPointer, 0, 255, 0); + SDL_SetTextureColorMod(targetPointer->texture, 0, 255, 0); blitRotated(targetPointer, x - battle.camera.x, y - battle.camera.y, angle); } @@ -422,7 +422,7 @@ static void drawPlayerTargeter(void) x += sin(TO_RAIDANS(angle)) * 45; y += -cos(TO_RAIDANS(angle)) * 45; - SDL_SetTextureColorMod(targetPointer, 255, 255, 0); + SDL_SetTextureColorMod(targetPointer->texture, 255, 255, 0); blitRotated(targetPointer, x - battle.camera.x, y - battle.camera.y, angle); } @@ -436,7 +436,7 @@ static void drawPlayerTargeter(void) x += sin(TO_RAIDANS(angle)) * 45; y += -cos(TO_RAIDANS(angle)) * 45; - SDL_SetTextureColorMod(targetPointer, 255, 255, 255); + SDL_SetTextureColorMod(targetPointer->texture, 255, 255, 255); blitRotated(targetPointer, x - battle.camera.x, y - battle.camera.y, angle); } @@ -445,12 +445,12 @@ static void drawPlayerTargeter(void) static void drawNumFighters(void) { /* Allies */ - SDL_SetTextureColorMod(smallFighter, 150, 200, 255); + SDL_SetTextureColorMod(smallFighter->texture, 150, 200, 255); blit(smallFighter, 400, 15, 0); drawText(425, 11, 14, TA_LEFT, colors.white, battle.numAllies < 1000 ? "(%d)" : "(999+)", battle.numAllies); /* Enemies */ - SDL_SetTextureColorMod(smallFighter, 255, 100, 100); + SDL_SetTextureColorMod(smallFighter->texture, 255, 100, 100); blit(smallFighter, SCREEN_WIDTH - 410, 15, 0); drawText(SCREEN_WIDTH - 420, 11, 14, TA_RIGHT, colors.white, !battle.unlimitedEnemies ? "(%d)" : "(999+)", battle.numEnemies); } @@ -608,7 +608,7 @@ static void drawPlayerSelect(void) SDL_RenderFillRect(app.renderer, NULL); SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_NONE); - SDL_SetTextureColorMod(targetCircle, 0, 200, 255); + SDL_SetTextureColorMod(targetCircle->texture, 0, 200, 255); blit(targetCircle, player->x - battle.camera.x, player->y - battle.camera.y, 1); diff --git a/src/battle/hud.h b/src/battle/hud.h index 4961ea8..9fd8969 100644 --- a/src/battle/hud.h +++ b/src/battle/hud.h @@ -22,9 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define MAX_HUD_MESSAGES 6 -extern SDL_Texture *getTexture(char *filename); -extern void blitRotated(SDL_Texture *texture, int x, int y, float angle); -extern void blit(SDL_Texture *texture, int x, int y, int center); +extern AtlasImage *getAtlasImage(char *filename); +extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle); +extern void blit(AtlasImage *atlasImage, int x, int y, int center); extern float getAngle(int x1, int y1, int x2, int y2); extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...); extern int getDistance(int x1, int y1, int x2, int y2); diff --git a/src/battle/items.c b/src/battle/items.c index 261d000..c705589 100644 --- a/src/battle/items.c +++ b/src/battle/items.c @@ -47,11 +47,12 @@ void loadItemDefs(void) e->active = 1; STRNCPY(e->name, cJSON_GetObjectItem(node, "name")->valuestring, MAX_NAME_LENGTH); STRNCPY(e->defName, cJSON_GetObjectItem(node, "defName")->valuestring, MAX_NAME_LENGTH); - e->texture = getTexture(cJSON_GetObjectItem(node, "texture")->valuestring); + e->texture = getAtlasImage(cJSON_GetObjectItem(node, "texture")->valuestring); e->health = e->maxHealth = FPS; e->flags = EF_NO_HEALTH_BAR; - SDL_QueryTexture(e->texture, NULL, NULL, &e->w, &e->h); + e->w = e->texture->rect.w; + e->h = e->texture->rect.h; defTail->next = e; defTail = e; @@ -227,7 +228,8 @@ void loadItems(cJSON *node) e->y += (rand() % scatter) - (rand() % scatter); } - SDL_QueryTexture(e->texture, NULL, NULL, &e->w, &e->h); + e->w = e->texture->rect.w; + e->h = e->texture->rect.h; } node = node->next; diff --git a/src/battle/items.h b/src/battle/items.h index 4a538c2..21caac7 100644 --- a/src/battle/items.h +++ b/src/battle/items.h @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../json/cJSON.h" extern char *readFile(char *filename); -extern SDL_Texture *getTexture(char *filename); +extern AtlasImage *getAtlasImage(char *filename); extern Entity *spawnEntity(void); extern Entity **getAllEntsInRadius(int x, int y, int radius, Entity *ignore); extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2); diff --git a/src/battle/jumpgate.c b/src/battle/jumpgate.c index 87cd314..55f08f7 100644 --- a/src/battle/jumpgate.c +++ b/src/battle/jumpgate.c @@ -27,7 +27,7 @@ static void addEscapeEffect(Entity *ent); static void addNodes(Entity *jumpgate, long flags); static void nodeDie(void); -static SDL_Texture *portal; +static AtlasImage *portal; static float portalAngle; Entity *spawnJumpgate(int side, long flags) @@ -43,7 +43,7 @@ Entity *spawnJumpgate(int side, long flags) jumpgate = spawnEntity(); jumpgate->type = ET_JUMPGATE; jumpgate->health = jumpgate->maxHealth = 1; - jumpgate->texture = getTexture("gfx/entities/jumpgate.png"); + jumpgate->texture = getAtlasImage("gfx/entities/jumpgate.png"); jumpgate->action = think; jumpgate->draw = draw; jumpgate->side = side; @@ -56,10 +56,11 @@ Entity *spawnJumpgate(int side, long flags) addNodes(jumpgate, flags); - portal = getTexture("gfx/entities/portal.png"); + portal = getAtlasImage("gfx/entities/portal.png"); portalAngle = 0; - SDL_QueryTexture(jumpgate->texture, NULL, NULL, &jumpgate->w, &jumpgate->h); + jumpgate->w = jumpgate->texture->rect.w; + jumpgate->h = jumpgate->texture->rect.h; battle.jumpgate = jumpgate; @@ -69,10 +70,10 @@ Entity *spawnJumpgate(int side, long flags) static void addNodes(Entity *jumpgate, long flags) { Entity *node; - SDL_Texture *nodeTexture; + AtlasImage *nodeTexture; int i; - nodeTexture = getTexture("gfx/entities/jumpgateNode.png"); + nodeTexture = getAtlasImage("gfx/entities/jumpgateNode.png"); for (i = 0 ; i < 360 ; i += 36) { @@ -87,7 +88,8 @@ static void addNodes(Entity *jumpgate, long flags) node->texture = nodeTexture; node->flags = EF_TAKES_DAMAGE+EF_AI_IGNORE; node->die = nodeDie; - SDL_QueryTexture(node->texture, NULL, NULL, &node->w, &node->h); + node->w = node->texture->rect.w; + node->h = node->texture->rect.h; if (jumpgate->side == SIDE_NONE) { diff --git a/src/battle/jumpgate.h b/src/battle/jumpgate.h index 227834f..085fd5f 100644 --- a/src/battle/jumpgate.h +++ b/src/battle/jumpgate.h @@ -22,12 +22,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define ESCAPE_DISTANCE 256 -extern SDL_Texture *getTexture(char *filename); +extern AtlasImage *getAtlasImage(char *filename); extern Entity *spawnEntity(void); extern Entity **getAllEntsInRadius(int x, int y, int radius, Entity *ignore); extern int getDistance(int x1, int y1, int x2, int y2); extern void playBattleSound(int id, int x, int y); -extern void blitRotated(SDL_Texture *texture, int x, int y, float angle); +extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle); extern char *getTranslatedString(char *string); extern void addSmallExplosion(void); extern void addDebris(int x, int y, int amount); diff --git a/src/battle/messageBox.c b/src/battle/messageBox.c index c92d288..b8b47ec 100644 --- a/src/battle/messageBox.c +++ b/src/battle/messageBox.c @@ -93,11 +93,11 @@ void doMessageBox(void) static void calculateMessageBoxHeight(MessageBox *msg) { - limitTextWidth(MSG_BOX_TEXT_WIDTH); + app.textWidth = MSG_BOX_TEXT_WIDTH; msg->height = getWrappedTextHeight(msg->body, (msg->type == MB_PANDORAN) ? 0 : 18); - limitTextWidth(0); + app.textWidth = 0; } int showingMessageBoxes(void) @@ -140,11 +140,11 @@ void drawMessageBox(void) drawText(r.x + 10, r.y + 5, 18, TA_LEFT, colors.cyan, msg->title); - limitTextWidth(MSG_BOX_TEXT_WIDTH); + app.textWidth = MSG_BOX_TEXT_WIDTH; drawText(r.x + 10, r.y + 30, (msg->type == MB_PANDORAN) ? 0 : 18, TA_LEFT, (msg->type != MB_IMPORTANT) ? colors.white : colors.red, msg->body); - limitTextWidth(0); + app.textWidth = 0; } } diff --git a/src/battle/mine.c b/src/battle/mine.c index a973670..bce7306 100644 --- a/src/battle/mine.c +++ b/src/battle/mine.c @@ -26,9 +26,9 @@ static void lookForFighters(void); static void lookForPlayer(void); static void doSplashDamage(void); -static SDL_Texture *mineWarning = NULL; -static SDL_Texture *mineNormal = NULL; -static SDL_Texture *shadowMine = NULL; +static AtlasImage *mineWarning = NULL; +static AtlasImage *mineNormal = NULL; +static AtlasImage *shadowMine = NULL; Entity *spawnMine(int type) { @@ -36,9 +36,9 @@ Entity *spawnMine(int type) if (!mineWarning) { - shadowMine = getTexture("gfx/entities/shadowMine.png"); - mineNormal = getTexture("gfx/entities/mine.png"); - mineWarning = getTexture("gfx/entities/mineWarning.png"); + shadowMine = getAtlasImage("gfx/entities/shadowMine.png"); + mineNormal = getAtlasImage("gfx/entities/mine.png"); + mineWarning = getAtlasImage("gfx/entities/mineWarning.png"); } STRNCPY(mine->name, "Mine", MAX_NAME_LENGTH); @@ -58,7 +58,8 @@ Entity *spawnMine(int type) mine->speed *= 0.01; } - SDL_QueryTexture(mine->texture, NULL, NULL, &mine->w, &mine->h); + mine->w = mine->texture->rect.w; + mine->h = mine->texture->rect.h; return mine; } diff --git a/src/battle/mine.h b/src/battle/mine.h index 3d1a4aa..9d767bf 100644 --- a/src/battle/mine.h +++ b/src/battle/mine.h @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SYSTEM_POWER 50 extern Entity *spawnEntity(void); -extern SDL_Texture *getTexture(char *filename); +extern AtlasImage *getAtlasImage(char *filename); extern Entity **getAllEntsInRadius(int x, int y, int radius, Entity *ignore); extern int getDistance(int x1, int y1, int x2, int y2); extern void addMineExplosion(void); diff --git a/src/battle/missionInfo.c b/src/battle/missionInfo.c index 9ee64b2..224676c 100644 --- a/src/battle/missionInfo.c +++ b/src/battle/missionInfo.c @@ -20,15 +20,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "missionInfo.h" -static void drawMissionSummary(SDL_Texture *title); +static void drawMissionSummary(AtlasImage *title); static void drawObjectives(void); static void drawChallenges(void); -static SDL_Texture *missionStartTexture; -static SDL_Texture *missionInProgressTexture; -static SDL_Texture *missionCompleteTexture; -static SDL_Texture *missionFailedTexture; -static SDL_Texture *timeUpTexture; +static AtlasImage *missionStartTexture; +static AtlasImage *missionInProgressTexture; +static AtlasImage *missionCompleteTexture; +static AtlasImage *missionFailedTexture; +static AtlasImage *timeUpTexture; static const char *objectiveStatus[OS_MAX]; static char *OBJECTIVES_TEXT; static char *NONE_TEXT; @@ -47,11 +47,11 @@ void initMissionInfo(void) NONE_TEXT = _("(none)"); TIME_LIMIT_TEXT = _("Time Limit: %s"); - missionStartTexture = !isChallenge ? getTexture("gfx/battle/missionStart.png") : getTexture("gfx/battle/challengeStart.png"); - missionInProgressTexture = !isChallenge ? getTexture("gfx/battle/missionInProgress.png") : getTexture("gfx/battle/challengeInProgress.png"); - missionCompleteTexture = !isChallenge ? getTexture("gfx/battle/missionComplete.png") : getTexture("gfx/battle/challengeComplete.png"); - missionFailedTexture = !isChallenge ? getTexture("gfx/battle/missionFailed.png") : getTexture("gfx/battle/challengeFailed.png"); - timeUpTexture = getTexture("gfx/battle/timeUp.png"); + missionStartTexture = !isChallenge ? getAtlasImage("gfx/battle/missionStart.png") : getAtlasImage("gfx/battle/challengeStart.png"); + missionInProgressTexture = !isChallenge ? getAtlasImage("gfx/battle/missionInProgress.png") : getAtlasImage("gfx/battle/challengeInProgress.png"); + missionCompleteTexture = !isChallenge ? getAtlasImage("gfx/battle/missionComplete.png") : getAtlasImage("gfx/battle/challengeComplete.png"); + missionFailedTexture = !isChallenge ? getAtlasImage("gfx/battle/missionFailed.png") : getAtlasImage("gfx/battle/challengeFailed.png"); + timeUpTexture = getAtlasImage("gfx/battle/timeUp.png"); } void drawMissionInfo(void) @@ -98,7 +98,7 @@ void drawMissionInfo(void) } } -static void drawMissionSummary(SDL_Texture *header) +static void drawMissionSummary(AtlasImage *header) { SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 128); diff --git a/src/battle/missionInfo.h b/src/battle/missionInfo.h index 74f6fe1..575421a 100644 --- a/src/battle/missionInfo.h +++ b/src/battle/missionInfo.h @@ -20,9 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../common.h" -extern void blit(SDL_Texture *texture, int x, int y, int center); +extern void blit(AtlasImage *atlasImage, int x, int y, int center); extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...); -extern SDL_Texture *getTexture(char *filename); +extern AtlasImage *getAtlasImage(char *filename); extern char *getChallengeDescription(Challenge *c); extern void drawWidgets(char *groupName); extern char *getTranslatedString(char *string); diff --git a/src/battle/radar.c b/src/battle/radar.c index 997909d..996b24c 100644 --- a/src/battle/radar.c +++ b/src/battle/radar.c @@ -20,15 +20,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "radar.h" -static SDL_Texture *radarTexture; -static SDL_Texture *radarWarningTexture; +static AtlasImage *radarTexture; +static AtlasImage *radarWarningTexture; static int radarRanges[] = {20, 40, 60}; static char *CAUTION_TEXT; void initRadar(void) { - radarTexture = getTexture("gfx/hud/radar.png"); - radarWarningTexture = getTexture("gfx/hud/radarWarning.png"); + radarTexture = getAtlasImage("gfx/hud/radar.png"); + radarWarningTexture = getAtlasImage("gfx/hud/radarWarning.png"); /* medium range by default */ battle.radarRange = 1; diff --git a/src/battle/radar.h b/src/battle/radar.h index bac787c..e50e9c8 100644 --- a/src/battle/radar.h +++ b/src/battle/radar.h @@ -21,9 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../common.h" extern int getDistance(int x1, int y1, int x2, int y2); -extern void blit(SDL_Texture *texture, int x, int y, int center); -extern SDL_Texture *getTexture(char *filename); -extern void blitRotated(SDL_Texture *texture, int x, int y, float angle); +extern void blit(AtlasImage *atlasImage, int x, int y, int center); +extern AtlasImage *getAtlasImage(char *filename); +extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle); extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...); extern char *getTranslatedString(char *string); diff --git a/src/battle/waypoints.c b/src/battle/waypoints.c index 0fd3b7b..49ca896 100644 --- a/src/battle/waypoints.c +++ b/src/battle/waypoints.c @@ -43,11 +43,12 @@ Entity *spawnWaypoint(void) waypoint->type = ET_WAYPOINT; waypoint->active = 0; waypoint->health = waypoint->maxHealth = FPS; - waypoint->texture = getTexture("gfx/entities/waypoint.png"); + waypoint->texture = getAtlasImage("gfx/entities/waypoint.png"); waypoint->flags = EF_NO_MT_BOX+EF_MISSION_TARGET+EF_NO_HEALTH_BAR; waypoint->action = think; - SDL_QueryTexture(waypoint->texture, NULL, NULL, &waypoint->w, &waypoint->h); + waypoint->w = waypoint->texture->rect.w; + waypoint->h = waypoint->texture->rect.h; waypointId++; diff --git a/src/battle/waypoints.h b/src/battle/waypoints.h index b3870ec..9f7865f 100644 --- a/src/battle/waypoints.h +++ b/src/battle/waypoints.h @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../common.h" -extern SDL_Texture *getTexture(char *filename); +extern AtlasImage *getAtlasImage(char *filename); extern int getDistance(int x1, int y1, int x2, int y2); extern void addHudMessage(SDL_Color c, char *format, ...); extern Entity *spawnEntity(void); diff --git a/src/challenges/challengeHome.c b/src/challenges/challengeHome.c index dff8755..33ad6a4 100644 --- a/src/challenges/challengeHome.c +++ b/src/challenges/challengeHome.c @@ -42,9 +42,9 @@ static void nextPage(void); static void fighterDatabase(void); static SDL_Texture *background; -static SDL_Texture *planetTexture; -static SDL_Texture *challengeIcon; -static SDL_Texture *challengeIconHighlight; +static AtlasImage *planetTexture; +static AtlasImage *challengeIcon; +static AtlasImage *challengeIconHighlight; static Widget *start; static PointF planet; static int show; @@ -94,9 +94,9 @@ void initChallengeHome(void) memset(&app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS); background = getTexture(getBackgroundTextureName(rand())); - planetTexture = getTexture(getPlanetTextureName(rand())); - challengeIcon = getTexture("gfx/challenges/challengeIcon.png"); - challengeIconHighlight = getTexture("gfx/challenges/challengeIconHighlight.png"); + planetTexture = getAtlasImage(getPlanetTextureName(rand())); + challengeIcon = getAtlasImage("gfx/challenges/challengeIcon.png"); + challengeIconHighlight = getAtlasImage("gfx/challenges/challengeIconHighlight.png"); battle.camera.x = battle.camera.y = 0; diff --git a/src/challenges/challengeHome.h b/src/challenges/challengeHome.h index b44fcab..7687489 100644 --- a/src/challenges/challengeHome.h +++ b/src/challenges/challengeHome.h @@ -37,7 +37,8 @@ extern void loadMission(char *filename); extern void doStars(float dx, float dy); extern void drawStars(void); extern void doWidgets(void); -extern SDL_Texture *getTexture(const char *filename); +extern SDL_Texture *getTexture(char *filename); +extern AtlasImage *getAtlasImage(const char *filename); extern void drawBackground(SDL_Texture *texture); extern void initBackground(void); extern void scrollBackground(float x, float y); @@ -54,7 +55,7 @@ extern void playSound(int sound); extern void selectWidget(const char *name, const char *group); extern void updateAllMissions(void); extern char *getTranslatedString(char *string); -extern void blit(SDL_Texture *t, int x, int y, int centered); +extern void blit(AtlasImage *atlasImage, int x, int y, int centered); extern char *getBackgroundTextureName(int n); extern char *getPlanetTextureName(int n); extern void playMusic(char *filename, int loop); diff --git a/src/defs.h b/src/defs.h index 7f2b3d2..c3577ce 100644 --- a/src/defs.h +++ b/src/defs.h @@ -76,6 +76,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define MAX_PATH_LENGTH 4096 #define NUM_TEXTURE_BUCKETS 32 +#define NUM_ATLAS_BUCKETS 64 #define MAX_STARS 500 diff --git a/src/draw/text.c b/src/draw/text.c deleted file mode 100644 index 21d233f..0000000 --- a/src/draw/text.c +++ /dev/null @@ -1,320 +0,0 @@ -/* -Copyright (C) 2015-2018 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 "text.h" - -static void loadFont(int size); -static SDL_Texture *getCachedText(unsigned long hash); -static void cacheText(unsigned long hash, SDL_Texture *t); -static unsigned long hashcode(const char *str, int size); -static void drawTextNormal(int x, int y, int size, int align, SDL_Color c, char *text); -static void drawTextSplit(int x, int y, int size, int align, SDL_Color c, char *text); -void textSize(char *text, int size, int *w, int *h); - -static char drawTextBuffer[MAX_LINE_LENGTH]; -static TTF_Font *font[MAX_FONTS]; -static Texture textures[NUM_TEXT_BUCKETS]; -static int maxWidth = 0; -static int cacheSize = 0; - -void initFonts(void) -{ - memset(&font, 0, sizeof(TTF_Font*) * MAX_FONTS); - memset(&textures, 0, sizeof(Texture) * NUM_TEXT_BUCKETS); -} - -void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...) -{ - va_list args; - - memset(&drawTextBuffer, '\0', sizeof(drawTextBuffer)); - - va_start(args, format); - vsprintf(drawTextBuffer, format, args); - va_end(args); - - if (maxWidth == 0) - { - drawTextNormal(x, y, size, align, c, drawTextBuffer); - } - else - { - drawTextSplit(x, y, size, align, c, drawTextBuffer); - } -} - -static void drawTextNormal(int x, int y, int size, int align, SDL_Color c, char *text) -{ - SDL_Surface *surface; - SDL_Texture *t; - int w, h; - long hash; - - if (size >= MAX_FONTS) - { - printf("ERROR: %d exceeds max font size index of %d\n", size, MAX_FONTS); - exit(1); - } - - if (!font[size]) - { - loadFont(size); - } - - hash = hashcode(text, size); - - t = getCachedText(hash); - - if (!t) - { - surface = TTF_RenderUTF8_Blended(font[size], text, colors.white); - t = SDL_CreateTextureFromSurface(app.renderer, surface); - SDL_FreeSurface(surface); - - cacheText(hash, t); - } - - SDL_QueryTexture(t, NULL, NULL, &w, &h); - - if (align == TA_CENTER) - { - x -= (w / 2); - } - else if (align == TA_RIGHT) - { - x -= w; - } - - SDL_SetTextureColorMod(t, c.r, c.g, c.b); - - blit(t, x, y, 0); -} - -static void drawTextSplit(int x, int y, int size, int align, SDL_Color c, char *text) -{ - char drawTextBuffer[MAX_DESCRIPTION_LENGTH]; - char *token; - int w, h, currentWidth; - - memset(&drawTextBuffer, '\0', sizeof(drawTextBuffer)); - - token = strtok(text, " "); - - currentWidth = 0; - - while (token) - { - textSize(token, size, &w, &h); - - if (currentWidth + w > maxWidth) - { - drawTextNormal(x, y, size, align, c, drawTextBuffer); - - currentWidth = 0; - y += h; - memset(&drawTextBuffer, '\0', sizeof(drawTextBuffer)); - } - - strcat(drawTextBuffer, token); - strcat(drawTextBuffer, " "); - - currentWidth += w; - - token = strtok(NULL, " "); - } - - drawTextNormal(x, y, size, align, c, drawTextBuffer); -} - -int getWrappedTextHeight(char *text, int size) -{ - char textBuffer[MAX_DESCRIPTION_LENGTH]; - char *token; - int w, h, currentWidth; - int y; - - STRNCPY(textBuffer, text, MAX_DESCRIPTION_LENGTH); - - token = strtok(textBuffer, " "); - - y = 0; - currentWidth = 0; - - while (token) - { - textSize(token, size, &w, &h); - - if (currentWidth + w > maxWidth) - { - currentWidth = 0; - y += h; - } - - currentWidth += w; - - token = strtok(NULL, " "); - } - - return y + h; -} - -void textSize(char *text, int size, int *w, int *h) -{ - if (!font[size]) - { - loadFont(size); - } - - TTF_SizeText(font[size], text, w, h); -} - -void limitTextWidth(int width) -{ - maxWidth = width; -} - -static SDL_Texture *getCachedText(unsigned long hash) -{ - Texture *t; - int i; - - i = hash % NUM_TEXT_BUCKETS; - - t = textures[i].next; - - for (t = textures[i].next ; t != NULL ; t = t->next) - { - if (t->hash == hash) - { - t->ttl = SDL_GetTicks() + TEXT_TTL; - return t->texture; - } - } - - return NULL; -} - -static void cacheText(unsigned long hash, SDL_Texture *texture) -{ - Texture *t, *new; - int i; - - i = hash % NUM_TEXT_BUCKETS; - - t = &textures[i]; - - /* horrible bit to find the tail */ - while (t->next) - { - t = t->next; - } - - new = malloc(sizeof(Texture)); - memset(new, 0, sizeof(Texture)); - - new->hash = hash; - new->texture = texture; - new->ttl = SDL_GetTicks() + TEXT_TTL; - - t->next = new; - - cacheSize++; -} - -void expireTexts(int all) -{ - Texture *t, *prev; - int i, n; - long now; - - n = 0; - now = SDL_GetTicks(); - - for (i = 0 ; i < NUM_TEXT_BUCKETS ; i++) - { - prev = &textures[i]; - - for (t = textures[i].next ; t != NULL ; t = t->next) - { - if (t->ttl <= now || all) - { - prev->next = t->next; - SDL_DestroyTexture(t->texture); - free(t); - - cacheSize--; - - n++; - - t = prev; - } - - prev = t; - } - } - - SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "Expired %d texts", n); -} - -static void loadFont(int size) -{ - SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "loadFonts(%d)", size); - - if (size != 0) - { - font[size] = TTF_OpenFont(getFileLocation("data/fonts/Roboto-Medium.ttf"), size); - } - else - { - font[size] = TTF_OpenFont(getFileLocation("data/fonts/Khosrau.ttf"), 18); - } -} - -static unsigned long hashcode(const char *str, int size) -{ - unsigned long hash = 5381; - int c; - - c = *str; - - while (c) - { - hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ - - c = *str++; - } - - hash = ((hash << 5) + hash) + size; - - return hash; -} - -void destroyFonts(void) -{ - int i; - - for (i = 0 ; i < MAX_FONTS ; i++) - { - if (font[i]) - { - TTF_CloseFont(font[i]); - } - } -} diff --git a/src/galaxy/galacticMap.c b/src/galaxy/galacticMap.c index 0bc6309..29a717d 100644 --- a/src/galaxy/galacticMap.c +++ b/src/galaxy/galacticMap.c @@ -54,8 +54,8 @@ static void fighterDatabase(void); static StarSystem *selectedStarSystem; static SDL_Texture *background; -static SDL_Texture *starSystemTexture; -static SDL_Texture *arrowTexture; +static AtlasImage *starSystemTexture; +static AtlasImage *arrowTexture; static SDL_Point camera; static Pulse pulseHead = {0}; static Pulse *pulseTail; @@ -98,9 +98,9 @@ void initGalacticMap(void) background = getTexture("gfx/backgrounds/background02.jpg"); - starSystemTexture = getTexture("gfx/galaxy/starSystem.png"); + starSystemTexture = getAtlasImage("gfx/galaxy/starSystem.png"); - arrowTexture = getTexture("gfx/galaxy/arrow.png"); + arrowTexture = getAtlasImage("gfx/galaxy/arrow.png"); selectedStarSystem = getStarSystem(game.selectedStarSystem); @@ -552,15 +552,15 @@ static void drawGalaxy(void) switch (starSystem->type) { case SS_NORMAL: - SDL_SetTextureColorMod(arrowTexture, 255, 0, 0); + SDL_SetTextureColorMod(arrowTexture->texture, 255, 0, 0); break; case SS_SOL: - SDL_SetTextureColorMod(arrowTexture, 0, 255, 0); + SDL_SetTextureColorMod(arrowTexture->texture, 0, 255, 0); break; case SS_PANDORAN: - SDL_SetTextureColorMod(arrowTexture, 64, 128, 255); + SDL_SetTextureColorMod(arrowTexture->texture, 64, 128, 255); break; } @@ -696,9 +696,11 @@ static void drawStarSystemDetail(void) drawText(525, 160, 18, TA_LEFT, colors.lightGrey, CRAFT_TEXT, game.currentMission->craft); drawText(525, 185, 18, TA_LEFT, colors.lightGrey, SQUADRON_TEXT, game.currentMission->squadron); - limitTextWidth(500); + app.textWidth = 500; + drawText(525, 230, 22, TA_LEFT, colors.white, game.currentMission->description); - limitTextWidth(0); + + app.textWidth = 0; } if (game.currentMission->completed) diff --git a/src/galaxy/galacticMap.h b/src/galaxy/galacticMap.h index ca607e1..2a36636 100644 --- a/src/galaxy/galacticMap.h +++ b/src/galaxy/galacticMap.h @@ -34,9 +34,10 @@ extern void drawText(int x, int y, int size, int align, SDL_Color c, const char extern void initBattle(void); extern void loadMission(char *filename); extern SDL_Texture *getTexture(char *filename); +extern AtlasImage *getAtlasImage(char *filename); extern void startSectionTransition(void); extern void endSectionTransition(void); -extern void blit(SDL_Texture *t, int x, int y, int centered); +extern void blit(AtlasImage *atlasImage, int x, int y, int centered); extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2); extern void drawCircle(int cx, int cy, int radius, int r, int g, int b, int a); extern void playMusic(char *filename, int loop); @@ -56,7 +57,7 @@ extern void drawOptions(void); extern void initOptions(void (*returnFromOptions)(void)); extern void drawStats(void); extern void playSound(int id); -extern void blitRotated(SDL_Texture *texture, int x, int y, float angle); +extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle); extern void initStatsDisplay(void); extern void updateAllMissions(void); extern StarSystem *getStarSystem(char *name); diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index d4d2596..66449f3 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -155,14 +155,15 @@ void loadMission(char *filename) planet = getAutoPlanet(filename); } - battle.planetTexture = getTexture(planet); - battle.fireStormTexture = getTexture("gfx/misc/torelliFireStorm.png"); + battle.planetTexture = getAtlasImage(planet); + battle.fireStormTexture = getAtlasImage("gfx/misc/torelliFireStorm.png"); battle.planet.x = (SCREEN_WIDTH / 2) - (rand() % SCREEN_WIDTH) + (rand() % SCREEN_WIDTH); battle.planet.y = (SCREEN_HEIGHT / 2) - (rand() % SCREEN_HEIGHT) + (rand() % SCREEN_HEIGHT); if (strcmp(planet, "gfx/planets/star.png") != 0) { - SDL_QueryTexture(battle.planetTexture, NULL, NULL, &battle.planetWidth, &battle.planetHeight); + battle.planetWidth = battle.planetTexture->rect.w; + battle.planetHeight = battle.planetTexture->rect.h; planetScale = 75 + (rand() % 125); planetScale *= 0.01; diff --git a/src/galaxy/mission.h b/src/galaxy/mission.h index 3400adf..6911000 100644 --- a/src/galaxy/mission.h +++ b/src/galaxy/mission.h @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern long lookup(char *name); extern char *readFile(char *filename); extern SDL_Texture *getTexture(char *filename); +extern AtlasImage *getAtlasImage(char *filename); extern void startSectionTransition(void); extern void endSectionTransition(void); extern void playMusic(char *filename, int loop); diff --git a/src/game/credits.c b/src/game/credits.c index 5d2e02d..fe19c57 100644 --- a/src/game/credits.c +++ b/src/game/credits.c @@ -26,7 +26,7 @@ static void draw(void); static void handleKeyboard(void); static SDL_Texture *background; -static SDL_Texture *earthTexture; +static AtlasImage *earthTexture; static Credit head; static Credit *tail; static float creditSpeed; @@ -47,7 +47,7 @@ void initCredits(void) background = getTexture("gfx/backgrounds/background02.jpg"); - earthTexture = getTexture("gfx/planets/earth.png"); + earthTexture = getAtlasImage("gfx/planets/earth.png"); loadCredits(); @@ -90,7 +90,7 @@ static void draw(void) blit(earthTexture, SCREEN_WIDTH - 200, (SCREEN_HEIGHT / 2) + 100, 1); - limitTextWidth(CREDIT_LINE_LIMIT); + app.textWidth = CREDIT_LINE_LIMIT; for (c = head.next ; c != NULL ; c = c->next) { @@ -100,7 +100,7 @@ static void draw(void) } } - limitTextWidth(0); + app.textWidth = 0; } static void loadCredits(void) @@ -115,7 +115,7 @@ static void loadCredits(void) text = readFile("data/credits/credits.json"); root = cJSON_Parse(text); - limitTextWidth(CREDIT_LINE_LIMIT); + app.textWidth = CREDIT_LINE_LIMIT; for (node = root->child ; node != NULL ; node = node->next) { @@ -137,7 +137,7 @@ static void loadCredits(void) y += c->h + dist; } - limitTextWidth(0); + app.textWidth = 0; /* the music that plays over the credits is 2m 44s, so scroll credits roughly inline with that (plus 2 seconds) */ timeout = ((2 * 60) + 46) * FPS; diff --git a/src/game/credits.h b/src/game/credits.h index 18231f8..24a64ca 100644 --- a/src/game/credits.h +++ b/src/game/credits.h @@ -24,12 +24,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define CREDIT_LINE_LIMIT (SCREEN_WIDTH - 300) extern SDL_Texture *getTexture(const char *filename); +extern AtlasImage *getAtlasImage(const char *filename); extern void playMusic(char *filename, int loop); extern void drawBackground(SDL_Texture *texture); extern void startSectionTransition(void); extern void endSectionTransition(void); extern void stopMusic(void); -extern void blit(SDL_Texture *t, int x, int y, int centered); +extern void blit(AtlasImage *atlasImage, int x, int y, int centered); extern char *readFile(char *filename); extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...); extern void limitTextWidth(int width); diff --git a/src/game/fighterDatabase.c b/src/game/fighterDatabase.c index 5b60880..c0d819f 100644 --- a/src/game/fighterDatabase.c +++ b/src/game/fighterDatabase.c @@ -157,9 +157,11 @@ void drawFighterDatabase(void) y = MAX(y, 320) + 75; - limitTextWidth(r.w - 100); + app.textWidth = r.w - 50; + drawText(r.x + 25, y, 18, TA_LEFT, colors.white, fighter->description); - limitTextWidth(0); + + app.textWidth = 0; drawWidgets("fighterDB"); } diff --git a/src/game/fighterDatabase.h b/src/game/fighterDatabase.h index f14c94d..019113a 100644 --- a/src/game/fighterDatabase.h +++ b/src/game/fighterDatabase.h @@ -25,7 +25,7 @@ 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 void blitRotated(AtlasImage *atlasImage, int x, int y, float angle); extern float mod(float n, float x); extern void limitTextWidth(int width); extern char *getTranslatedString(char *string); diff --git a/src/game/title.c b/src/game/title.c index 4ea29f9..83d6a1d 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -38,9 +38,9 @@ static void quit(void); static void returnFromOptions(void); static SDL_Texture *background; -static SDL_Texture *logo; -static SDL_Texture *pandoranWar; -static SDL_Texture *earthTexture; +static AtlasImage *logo[2]; +static AtlasImage *pandoranWar; +static AtlasImage *earthTexture; static PointF earth; static Entity fighters[NUM_FIGHTERS]; static const char *fighterTextures[] = {"gfx/fighters/firefly.png", "gfx/fighters/hammerhead.png", "gfx/fighters/hyena.png", "gfx/fighters/lynx.png", "gfx/fighters/kingfisher.png", "gfx/fighters/leopard.png", "gfx/fighters/nymph.png", "gfx/fighters/ray.png", "gfx/fighters/rook.png", "gfx/fighters/taf.png"}; @@ -60,13 +60,14 @@ void initTitle(void) destroyBattle(); - logo = getTexture("gfx/title/logo.png"); + logo[0] = getAtlasImage("gfx/title/logo01.png"); + logo[1] = getAtlasImage("gfx/title/logo02.png"); - pandoranWar = getTexture("gfx/title/pandoran.png"); + pandoranWar = getAtlasImage("gfx/title/pandoran.png"); background = getTexture("gfx/backgrounds/background02.jpg"); - earthTexture = getTexture("gfx/planets/earth.png"); + earthTexture = getAtlasImage("gfx/planets/earth.png"); earth.x = rand() % SCREEN_WIDTH; earth.y = -(128 + (rand() % 128)); @@ -113,7 +114,7 @@ static void initFighters(void) { fighters[i].x = rand() % (SCREEN_WIDTH - 32); fighters[i].y = SCREEN_HEIGHT + (rand() % SCREEN_HEIGHT); - fighters[i].texture = getTexture(fighterTextures[rand() % numTextures]); + fighters[i].texture = getAtlasImage(fighterTextures[rand() % numTextures]); fighters[i].dy = -(1 + rand() % 3); } } @@ -169,7 +170,7 @@ static void doFighters(void) { self->x = rand() % (SCREEN_WIDTH - 32); self->y = SCREEN_HEIGHT + (rand() % SCREEN_HEIGHT); - self->texture = getTexture(fighterTextures[rand() % numTextures]); + self->texture = getAtlasImage(fighterTextures[rand() % numTextures]); self->dy = -(1 + rand() % 3); } } @@ -181,13 +182,18 @@ static void draw(void) drawStars(); + SDL_SetTextureColorMod(earthTexture->texture, 255, 255, 255); + blit(earthTexture, earth.x, earth.y, 1); drawFighters(); drawEffects(); - blit(logo, SCREEN_WIDTH / 2, 50, 1); + SDL_SetTextureColorMod(logo[0]->texture, 255, 255, 255); + + blit(logo[0], (SCREEN_WIDTH / 2) - logo[0]->rect.w, 30, 0); + blit(logo[1], (SCREEN_WIDTH / 2), 30, 0); blit(pandoranWar, SCREEN_WIDTH / 2, 110, 1); @@ -224,6 +230,8 @@ static void drawFighters(void) for (i = 0 ; i < NUM_FIGHTERS ; i++) { + SDL_SetTextureColorMod(fighters[i].texture->texture, 255, 255, 255); + blit(fighters[i].texture, fighters[i].x, fighters[i].y, 1); } } diff --git a/src/game/title.h b/src/game/title.h index 8bd4c90..850711f 100644 --- a/src/game/title.h +++ b/src/game/title.h @@ -29,10 +29,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define NUM_FIGHTERS 12 extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...); +extern AtlasImage *getAtlasImage(const char *filename); extern SDL_Texture *getTexture(const char *filename); extern void startSectionTransition(void); extern void endSectionTransition(void); -extern void blit(SDL_Texture *t, int x, int y, int centered); +extern void blit(AtlasImage *atlasImage, int x, int y, int centered); extern void stopMusic(void); extern void doStars(float dx, float dy); extern void drawStars(void); diff --git a/src/game/trophies.c b/src/game/trophies.c index 02affb0..29b8885 100644 --- a/src/game/trophies.c +++ b/src/game/trophies.c @@ -28,9 +28,9 @@ static void setSparkleColor(Trophy *t); static void nextAlert(void); static Trophy *alertTrophy; -static SDL_Texture *trophyIcons[TROPHY_MAX]; -static SDL_Texture *sparkle; -static SDL_Texture *alertSphere; +static AtlasImage *trophyIcons[TROPHY_MAX]; +static AtlasImage *sparkle; +static AtlasImage *alertSphere; static SDL_Rect alertRect; static int alertTimer; static int page; @@ -50,13 +50,13 @@ void initTrophies(void) { loadTrophyData("data/trophies/trophies.json"); - trophyIcons[TROPHY_BRONZE] = getTexture("gfx/trophies/bronze.png"); - trophyIcons[TROPHY_SILVER] = getTexture("gfx/trophies/silver.png"); - trophyIcons[TROPHY_GOLD] = getTexture("gfx/trophies/gold.png"); - trophyIcons[TROPHY_PLATINUM] = getTexture("gfx/trophies/platinum.png"); - trophyIcons[TROPHY_UNEARNED] = getTexture("gfx/trophies/unearned.png"); - sparkle = getTexture("gfx/trophies/sparkle.png"); - alertSphere = getTexture("gfx/trophies/alertSphere.png"); + trophyIcons[TROPHY_BRONZE] = getAtlasImage("gfx/trophies/bronze.png"); + trophyIcons[TROPHY_SILVER] = getAtlasImage("gfx/trophies/silver.png"); + trophyIcons[TROPHY_GOLD] = getAtlasImage("gfx/trophies/gold.png"); + trophyIcons[TROPHY_PLATINUM] = getAtlasImage("gfx/trophies/platinum.png"); + trophyIcons[TROPHY_UNEARNED] = getAtlasImage("gfx/trophies/unearned.png"); + sparkle = getAtlasImage("gfx/trophies/sparkle.png"); + alertSphere = getAtlasImage("gfx/trophies/alertSphere.png"); alertRect.h = 90; alertRect.y = 10; @@ -89,7 +89,7 @@ void initTrophiesDisplay(void) STRNCPY(t->awardDateStr, timeToDate(t->awardDate), MAX_NAME_LENGTH); } - textSize(t->description, 18, &w, &h); + calcTextDimensions(t->description, 18, &w, &h); boxWidth = MAX(boxWidth, w); } @@ -171,6 +171,7 @@ void drawTrophies(void) blitRotated(sparkle, x + 32, y + 32, sparkleAngle); blitRotated(sparkle, x + 32, y + 32, -sparkleAngle); + SDL_SetTextureColorMod(trophyIcons[t->value]->texture, 255, 255, 255); blitScaled(trophyIcons[t->value], x, y, 64, 64, 0); drawText(x + 85, y - 10, 20, TA_LEFT, colors.yellow, t->title); drawText(x + 85, y + 20, 18, TA_LEFT, colors.white, t->description); @@ -282,8 +283,9 @@ static void nextAlert(void) { playSound(SND_TROPHY); - textSize(alertTrophy->title, 30, &alertRect.w, &h); - textSize(alertTrophy->description, 20, &w, &h); + calcTextDimensions(alertTrophy->title, 30, &alertRect.w, &h); + + calcTextDimensions(alertTrophy->description, 20, &w, &h); alertRect.w = MAX(alertRect.w, w); alertRect.w = MAX(400, alertRect.w); @@ -510,19 +512,19 @@ static void setSparkleColor(Trophy *t) switch (t->value) { case TROPHY_BRONZE: - SDL_SetTextureColorMod(sparkle, 255, 128, 0); + SDL_SetTextureColorMod(sparkle->texture, 255, 128, 0); break; case TROPHY_SILVER: - SDL_SetTextureColorMod(sparkle, 192, 192, 192); + SDL_SetTextureColorMod(sparkle->texture, 192, 192, 192); break; case TROPHY_GOLD: - SDL_SetTextureColorMod(sparkle, 255, 255, 0); + SDL_SetTextureColorMod(sparkle->texture, 255, 255, 0); break; case TROPHY_PLATINUM: - SDL_SetTextureColorMod(sparkle, 0, 128, 255); + SDL_SetTextureColorMod(sparkle->texture, 0, 128, 255); break; } } diff --git a/src/game/trophies.h b/src/game/trophies.h index dbf96f5..e0bf096 100644 --- a/src/game/trophies.h +++ b/src/game/trophies.h @@ -30,16 +30,16 @@ extern char *readFile(char *filename); extern int getJSONValue(cJSON *node, char *name, int defValue); extern int getPercent(float current, float total); extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...); -extern void blit(SDL_Texture *texture, int x, int y, int centered); -extern void blitRotated(SDL_Texture *texture, int x, int y, float angle); -extern void blitScaled(SDL_Texture *t, int x, int y, int w, int h, int center); +extern void blit(AtlasImage *atlasImage, int x, int y, int centered); +extern void blitRotated(AtlasImage *atlasImage, int x, int y, float angle); +extern void blitScaled(AtlasImage *atlasImage, int x, int y, int w, int h, int center); extern char *getTranslatedString(char *string); -extern SDL_Texture *getTexture(char *filename); +extern AtlasImage *getAtlasImage(char *filename); extern void playSound(int id); extern Widget *getWidget(const char *name, const char *group); extern void drawWidgets(char *groupName); extern char *timeToDate(long millis); -extern void textSize(char *text, int size, int *w, int *h); +extern void calcTextDimensions(char *text, int size, int *w, int *h); extern void awardPandoranCraftTrophy(void); extern float mod(float n, float x); diff --git a/src/main.c b/src/main.c index 80794b5..476f922 100644 --- a/src/main.c +++ b/src/main.c @@ -27,7 +27,6 @@ static void capFrameRate(long *then, float *remainder); int main(int argc, char *argv[]) { long then, lastFrameTime, frames; - long expireTextTimer; float remainder; SDL_Event event; @@ -57,10 +56,10 @@ int main(int argc, char *argv[]) handleMissionArgs(argc, argv); + remainder = 0; dev.fps = frames = 0; then = SDL_GetTicks(); lastFrameTime = SDL_GetTicks() + 1000; - expireTextTimer = SDL_GetTicks() + (1000 * 10); while (1) { @@ -171,13 +170,6 @@ int main(int argc, char *argv[]) clearControl(CONTROL_SCREENSHOT); } - if (SDL_GetTicks() > expireTextTimer) - { - expireTexts(0); - - expireTextTimer = SDL_GetTicks() + (1000 * 10); - } - /* don't save more than once per request, and not in the middle of battle */ if (app.saveGame && battle.status != MS_IN_PROGRESS) { diff --git a/src/structs.h b/src/structs.h index a5517e6..83104c1 100644 --- a/src/structs.h +++ b/src/structs.h @@ -41,6 +41,8 @@ typedef struct Bucket Bucket; typedef struct Trophy Trophy; typedef struct Tuple Tuple; typedef struct Credit Credit; +typedef struct AtlasImage AtlasImage; +typedef struct Font Font; typedef struct { int debug; @@ -68,6 +70,13 @@ struct Texture { Texture *next; }; +struct AtlasImage { + char filename[MAX_FILENAME_LENGTH]; + SDL_Rect rect; + SDL_Texture *texture; + AtlasImage *next; +}; + typedef struct { void (*logic)(void); void (*draw)(void); @@ -100,7 +109,7 @@ struct Entity { char name[MAX_NAME_LENGTH]; char defName[MAX_NAME_LENGTH]; char groupName[MAX_NAME_LENGTH]; - char description[MAX_DESCRIPTION_LENGTH]; + char *description; char affiliation[MAX_NAME_LENGTH]; int active; int spawned; @@ -153,7 +162,7 @@ struct Entity { void (*action)(void); void (*draw)(void); void (*die)(void); - SDL_Texture *texture; + AtlasImage *texture; Entity *next; }; @@ -170,7 +179,7 @@ struct Bullet { int damage; int angle; long flags; - SDL_Texture *texture; + AtlasImage *texture; Entity *owner; Entity *target; Bullet *next; @@ -184,7 +193,7 @@ struct Debris { int health; int thinkTime; float angle; - SDL_Texture *texture; + AtlasImage *texture; Debris *next; }; @@ -216,7 +225,7 @@ struct Effect { int g; int b; int a; - SDL_Texture *texture; + AtlasImage *texture; Effect *next; }; @@ -372,7 +381,8 @@ typedef struct { Entity *jumpgate; Entity *messageSpeaker; Entity *lastKilledPlayer; - SDL_Texture *background, *planetTexture, *fireStormTexture; + SDL_Texture *background; + AtlasImage *planetTexture, *fireStormTexture; PointF planet; int planetWidth, planetHeight; Entity entityHead, *entityTail; @@ -450,7 +460,7 @@ struct Widget { int enabled; int isModal; SDL_Rect rect; - SDL_Texture *texture; + AtlasImage *texture; void (*action)(void); void (*onChange)(char *value); Widget *parent; @@ -509,6 +519,7 @@ typedef struct { int lastButtonPressed; int keyControls[CONTROL_MAX]; int mouseControls[CONTROL_MAX]; + int textWidth; } App; typedef struct { @@ -533,6 +544,13 @@ struct Credit { Credit *next; }; +struct Font { + char name[MAX_NAME_LENGTH]; + SDL_Texture *texture; + AtlasImage glyphs[128]; + Font *next; +}; + struct Bucket { char *key, *value; Bucket *next; diff --git a/src/system/atlas.c b/src/system/atlas.c new file mode 100644 index 0000000..1080bbd --- /dev/null +++ b/src/system/atlas.c @@ -0,0 +1,104 @@ +/* +Copyright (C) 2018 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 "atlas.h" + +static void loadAtlasData(void); + +static AtlasImage atlases[NUM_ATLAS_BUCKETS]; +static SDL_Texture *atlasTexture; + +void initAtlas(void) +{ + memset(&atlases, 0, sizeof(AtlasImage) * NUM_ATLAS_BUCKETS); + + atlasTexture = getTexture("gfx/atlas/atlas.png"); + + loadAtlasData(); +} + +AtlasImage *getAtlasImage(char *filename) +{ + AtlasImage *a; + unsigned long i; + + i = hashcode(filename) % NUM_ATLAS_BUCKETS; + + for (a = atlases[i].next ; a != NULL ; a = a->next) + { + if (strcmp(a->filename, filename) == 0) + { + return a; + } + } + + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_CRITICAL, "No such atlas image '%s'", filename); + exit(1); + + return NULL; +} + +static void loadAtlasData(void) +{ + AtlasImage *atlasImage, *a; + int x, y, w, h; + cJSON *root, *node; + char *text, *filename; + unsigned long i; + + text = readFile("data/atlas/atlas.json"); + + root = cJSON_Parse(text); + + for (node = root->child ; node != NULL ; node = node->next) + { + filename = cJSON_GetObjectItem(node, "filename")->valuestring; + x = cJSON_GetObjectItem(node, "x")->valueint; + y = cJSON_GetObjectItem(node, "y")->valueint; + w = cJSON_GetObjectItem(node, "w")->valueint; + h = cJSON_GetObjectItem(node, "h")->valueint; + + i = hashcode(filename) % NUM_ATLAS_BUCKETS; + + a = &atlases[i]; + + /* horrible bit to look for the tail */ + while (a->next) + { + a = a->next; + } + + atlasImage = malloc(sizeof(AtlasImage)); + memset(atlasImage, 0, sizeof(AtlasImage)); + a->next = atlasImage; + + STRNCPY(atlasImage->filename, filename, MAX_FILENAME_LENGTH); + atlasImage->rect.x = x; + atlasImage->rect.y = y; + atlasImage->rect.w = w; + atlasImage->rect.h = h; + + atlasImage->texture = atlasTexture; + } + + cJSON_Delete(root); + + free(text); +} diff --git a/src/system/atlas.h b/src/system/atlas.h new file mode 100644 index 0000000..42d63b7 --- /dev/null +++ b/src/system/atlas.h @@ -0,0 +1,26 @@ +/* +Copyright (C) 2018 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" +#include "../json/cJSON.h" + +extern SDL_Texture *getTexture(const char *filename); +extern unsigned long hashcode(const char *str); +extern char *readFile(const char *filename); diff --git a/src/system/controls.c b/src/system/controls.c index bc94b64..67c952c 100644 --- a/src/system/controls.c +++ b/src/system/controls.c @@ -194,9 +194,11 @@ void drawControls(void) drawText((SCREEN_WIDTH / 2) - 50, 525, 16, TA_RIGHT, colors.white, BACKSPACE_TEXT); drawText((SCREEN_WIDTH / 2) + 50, 525, 16, TA_LEFT, colors.white, ESCAPE_TEXT); - limitTextWidth(r.w - 100); + app.textWidth = r.w - 100; + drawText(SCREEN_WIDTH / 2, 560, 16, TA_CENTER, colors.white, HELP_TEXT); - limitTextWidth(0); + + app.textWidth = 0; drawWidgets("controls"); } diff --git a/src/draw/draw.c b/src/system/draw.c similarity index 86% rename from src/draw/draw.c rename to src/system/draw.c index bdc7886..7d51732 100644 --- a/src/draw/draw.c +++ b/src/system/draw.c @@ -65,24 +65,25 @@ void presentScene(void) SDL_RenderPresent(app.renderer); } -void blit(SDL_Texture *texture, int x, int y, int center) +void blit(AtlasImage *atlasImage, int x, int y, int center) { SDL_Rect dstRect; dstRect.x = x; dstRect.y = y; - SDL_QueryTexture(texture, NULL, NULL, &dstRect.w, &dstRect.h); + dstRect.w = atlasImage->rect.w; + dstRect.h = atlasImage->rect.h; if (center) { dstRect.x -= (dstRect.w / 2); dstRect.y -= (dstRect.h / 2); } - - SDL_RenderCopy(app.renderer, texture, NULL, &dstRect); + + SDL_RenderCopy(app.renderer, atlasImage->texture, &atlasImage->rect, &dstRect); } -void blitScaled(SDL_Texture *texture, int x, int y, int w, int h, int center) +void blitScaled(AtlasImage *atlasImage, int x, int y, int w, int h, int center) { SDL_Rect dstRect; @@ -97,20 +98,22 @@ void blitScaled(SDL_Texture *texture, int x, int y, int w, int h, int center) dstRect.y -= (dstRect.h / 2); } - SDL_RenderCopy(app.renderer, texture, NULL, &dstRect); + SDL_RenderCopy(app.renderer, atlasImage->texture, &atlasImage->rect, &dstRect); } -void blitRotated(SDL_Texture *texture, int x, int y, float angle) +void blitRotated(AtlasImage *atlasImage, int x, int y, float angle) { SDL_Rect dstRect; dstRect.x = x; dstRect.y = y; - SDL_QueryTexture(texture, NULL, NULL, &dstRect.w, &dstRect.h); + dstRect.w = atlasImage->rect.w; + dstRect.h = atlasImage->rect.h; + dstRect.x -= (dstRect.w / 2); dstRect.y -= (dstRect.h / 2); - SDL_RenderCopyEx(app.renderer, texture, NULL, &dstRect, angle, NULL, SDL_FLIP_NONE); + SDL_RenderCopyEx(app.renderer, atlasImage->texture, &atlasImage->rect, &dstRect, angle, NULL, SDL_FLIP_NONE); } void drawCircle(int cx, int cy, int radius, int r, int g, int b, int a) @@ -188,7 +191,7 @@ void drawBackground(SDL_Texture *texture) for (i = 0 ; i < 4 ; i++) { - blitScaled(texture, backgroundPoint[i].x, backgroundPoint[i].y, SCREEN_WIDTH, SCREEN_HEIGHT, 0); + /*blitScaled(texture, backgroundPoint[i].x, backgroundPoint[i].y, SCREEN_WIDTH, SCREEN_HEIGHT, 0);*/ } } diff --git a/src/draw/draw.h b/src/system/draw.h similarity index 100% rename from src/draw/draw.h rename to src/system/draw.h diff --git a/src/system/init.c b/src/system/init.c index ce1e2c5..ec23df5 100644 --- a/src/system/init.c +++ b/src/system/init.c @@ -125,7 +125,6 @@ void initGameSystem(void) int i, numInitFuns; void (*initFuncs[]) (void) = { initFonts, - initInput, initResources, initSounds, initWidgets, @@ -158,6 +157,10 @@ void initGameSystem(void) initColor(&colors.black, 0, 0, 0); initColor(&colors.lightGrey, 192, 192, 192); initColor(&colors.darkGrey, 128, 128, 128); + + initAtlas(); + + initInput(); for (i = 0 ; i < numInitFuns ; i++) { @@ -342,10 +345,6 @@ void cleanup(void) destroyTextures(); - expireTexts(1); - - destroyFonts(); - destroySounds(); destroyGame(); diff --git a/src/system/init.h b/src/system/init.h index f5a7529..bc13965 100644 --- a/src/system/init.h +++ b/src/system/init.h @@ -48,6 +48,7 @@ extern void initWidgets(void); extern void initBackground(void); extern void initResources(void); extern void initControls(void); +extern void initAtlas(void); extern void initFighterDatabase(void); extern void destroyLookups(void); extern void destroyFonts(void); diff --git a/src/system/input.c b/src/system/input.c index 3b5ab7e..bac90bc 100644 --- a/src/system/input.c +++ b/src/system/input.c @@ -20,19 +20,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "input.h" -static SDL_Texture *mousePointer; -static SDL_Texture *mousePointerNormal; -static SDL_Texture *mousePointerMove; +static AtlasImage *mousePointer; +static AtlasImage *mousePointerNormal; +static AtlasImage *mousePointerMove; void initInput(void) { memset(&app.mouse, 0, sizeof(Mouse)); - mousePointerNormal = getTexture("gfx/input/mousePointer.png"); - mousePointerMove = getTexture("gfx/input/mousePointerMove.png"); + mousePointerNormal = getAtlasImage("gfx/input/mousePointer.png"); + mousePointerMove = getAtlasImage("gfx/input/mousePointerMove.png"); mousePointer = mousePointerNormal; - SDL_QueryTexture(mousePointer, NULL, NULL, &app.mouse.w, &app.mouse.h); + app.mouse.w = mousePointer->rect.w; + app.mouse.h = mousePointer->rect.h; } void doKeyDown(SDL_KeyboardEvent *event) diff --git a/src/system/input.h b/src/system/input.h index e412e8d..0994b40 100644 --- a/src/system/input.h +++ b/src/system/input.h @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../common.h" -extern SDL_Texture *getTexture(char *filename); -extern void blit(SDL_Texture *texture, int x, int y, int centered); +extern AtlasImage *getAtlasImage(char *filename); +extern void blit(AtlasImage *atlasImage, int x, int y, int centered); extern App app; diff --git a/src/system/modalDialog.c b/src/system/modalDialog.c index 6d9a6ce..eb1a232 100644 --- a/src/system/modalDialog.c +++ b/src/system/modalDialog.c @@ -101,7 +101,7 @@ void drawModalDialog(void) { SDL_Rect r; - limitTextWidth(700); + app.textWidth = 700; SDL_SetRenderDrawBlendMode(app.renderer, SDL_BLENDMODE_BLEND); SDL_SetRenderDrawColor(app.renderer, 0, 0, 0, 96); @@ -135,5 +135,5 @@ void drawModalDialog(void) break; } - limitTextWidth(0); + app.textWidth = 0; } diff --git a/src/system/options.c b/src/system/options.c index c5abebe..4e02f17 100644 --- a/src/system/options.c +++ b/src/system/options.c @@ -113,9 +113,11 @@ static void drawMain(void) drawWidgets("options"); - limitTextWidth(r.w - 100); + app.textWidth = r.w - 100; + drawText(SCREEN_WIDTH / 2, r.y + r.h - 135, 16, TA_CENTER, colors.yellow, RESOLUTION_TEXT); - limitTextWidth(0); + + app.textWidth = 0; } static void controls(void) diff --git a/src/system/text.c b/src/system/text.c new file mode 100644 index 0000000..481095d --- /dev/null +++ b/src/system/text.c @@ -0,0 +1,272 @@ +/* +Copyright (C) 2018 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 "text.h" + +static void initFont(char *name, char *filename); +static void drawWord(char *word, int *x, int *y, int startX); +static void applyWordWrap(char *word, int *x, int *y, int startX); +void calcTextDimensions(char *text, int size, int *w, int *h); +void useFont(char *name); + +static SDL_Color white = {255, 255, 255, 255}; +static char drawTextBuffer[1024]; +static Font fontHead; +static Font *fontTail; +static Font *activeFont = NULL; +static float scale; + +void initFonts(void) +{ + memset(&fontHead, 0, sizeof(Font)); + fontTail = &fontHead; + + initFont("roboto", getFileLocation("data/fonts/Roboto-Medium.ttf")); + initFont("khosrau", getFileLocation("data/fonts/Khosrau.ttf")); + + useFont("roboto"); +} + +static void initFont(char *name, char *filename) +{ + SDL_Texture *texture; + TTF_Font *font; + Font *f; + SDL_Surface *surface, *text; + SDL_Rect dest; + int i; + char c[2]; + + surface = SDL_CreateRGBSurface(0, FONT_TEXTURE_SIZE, FONT_TEXTURE_SIZE, 32, 0, 0, 0, 0xff); + + SDL_SetColorKey(surface, SDL_TRUE, SDL_MapRGBA(surface->format, 0, 0, 0, 0)); + + font = TTF_OpenFont(filename, FONT_SIZE); + + f = malloc(sizeof(Font)); + memset(f, 0, sizeof(Font)); + + dest.x = dest.y = 0; + + for (i = ' ' ; i <= 'z' ; i++) + { + memset(c, 0, 2); + + sprintf(c, "%c", i); + + text = TTF_RenderUTF8_Blended(font, c, white); + + TTF_SizeText(font, c, &dest.w, &dest.h); + + if (dest.x + dest.w >= FONT_TEXTURE_SIZE) + { + dest.x = 0; + + dest.y += dest.h + 1; + } + + SDL_BlitSurface(text, NULL, surface, &dest); + + f->glyphs[i].rect = dest; + + SDL_FreeSurface(text); + + dest.x += dest.w; + } + + TTF_CloseFont(font); + + texture = toTexture(surface, 1); + + f->texture = texture; + + for (i = 0 ; i < 128 ; i++) + { + f->glyphs[i].texture = texture; + } + + strcpy(f->name, name); + + fontTail->next = f; + fontTail = f; +} + +void drawText(int x, int y, int size, int align, SDL_Color color, const char *format, ...) +{ + int i, startX, n, w, h; + char word[128]; + va_list args; + + if (activeFont) + { + SDL_SetTextureColorMod(activeFont->texture, color.r, color.g, color.b); + SDL_SetTextureAlphaMod(activeFont->texture, color.a); + + memset(&drawTextBuffer, '\0', sizeof(drawTextBuffer)); + + va_start(args, format); + vsprintf(drawTextBuffer, format, args); + va_end(args); + + scale = size / (FONT_SIZE * 1.0f); + + startX = x; + + memset(word, 0, 128); + + n = 0; + + calcTextDimensions(drawTextBuffer, size, &w, &h); + + if (align == TA_RIGHT) + { + x -= w; + } + else if (align == TA_CENTER) + { + x -= (w / 2); + } + + for (i = 0 ; i < strlen(drawTextBuffer) ; i++) + { + word[n++] = drawTextBuffer[i]; + + if (drawTextBuffer[i] == ' ') + { + drawWord(word, &x, &y, startX); + + memset(word, 0, 128); + + n = 0; + } + } + + drawWord(word, &x, &y, startX); + } +} + +static void drawWord(char *word, int *x, int *y, int startX) +{ + int i, c; + SDL_Rect dest; + + if (app.textWidth > 0) + { + applyWordWrap(word, x, y, startX); + } + + for (i = 0 ; i < strlen(word) ; i++) + { + c = word[i]; + + dest.x = *x; + dest.y = *y; + dest.w = activeFont->glyphs[c].rect.w * scale; + dest.h = activeFont->glyphs[c].rect.h * scale; + + SDL_RenderCopy(app.renderer, activeFont->texture, &activeFont->glyphs[c].rect, &dest); + + *x += activeFont->glyphs[c].rect.w * scale; + } +} + +static void applyWordWrap(char *word, int *x, int *y, int startX) +{ + int i, w, c; + + w = 0; + + for (i = 0 ; i < strlen(word) ; i++) + { + c = word[i]; + + w += activeFont->glyphs[c].rect.w * scale; + + if (w + *x - startX > app.textWidth) + { + *x = startX; + + *y += activeFont->glyphs[c].rect.h * scale; + + return; + } + } +} + +void useFont(char *name) +{ + Font *f; + + for (f = fontHead.next ; f != NULL ; f = f->next) + { + if (strcmp(f->name, name) == 0) + { + activeFont = f; + return; + } + } +} + +void calcTextDimensions(char *text, int size, int *w, int *h) +{ + int i, c; + float scale; + + scale = size / (FONT_SIZE * 1.0f); + + *w = 0; + *h = 0; + + for (i = 0 ; i < strlen(text) ; i++) + { + c = text[i]; + + *w += activeFont->glyphs[c].rect.w * scale; + *h = MAX(activeFont->glyphs[c].rect.h * scale, *h); + } +} + +int getWrappedTextHeight(char *text, int size) +{ + int x, y, w, h, i, c; + float scale; + + scale = size / (FONT_SIZE * 1.0f); + + x = y = 0; + + for (i = 0 ; i < strlen(text) ; i++) + { + c = text[i]; + + w = activeFont->glyphs[c].rect.w * scale; + h = activeFont->glyphs[c].rect.h * scale; + + if (x + w > app.textWidth) + { + x = 0; + y += h; + } + + x += w; + } + + return y; +} diff --git a/src/draw/text.h b/src/system/text.h similarity index 77% rename from src/draw/text.h rename to src/system/text.h index 491e103..c11120f 100644 --- a/src/draw/text.h +++ b/src/system/text.h @@ -1,5 +1,5 @@ /* -Copyright (C) 2015-2018 Parallel Realities +Copyright (C) 2018 Parallel Realities This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -18,12 +18,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "../common.h" +#include "stdlib.h" +#include "string.h" +#include "SDL2/SDL_image.h" #include "SDL2/SDL_ttf.h" -extern void blit(SDL_Texture *texture, int x, int y, int centered); +#include "../common.h" + +#define FONT_SIZE 32 +#define FONT_TEXTURE_SIZE 1024 + extern char *getFileLocation(char *filename); +extern SDL_Texture *toTexture(SDL_Surface *surface, int destroySurface); extern App app; -extern Colors colors; diff --git a/src/system/textures.c b/src/system/textures.c index a306cff..1222be2 100644 --- a/src/system/textures.c +++ b/src/system/textures.c @@ -53,16 +53,21 @@ static SDL_Texture *loadTexture(char *filename) { SDL_Texture *texture; - SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Loading %s", filename); + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Loading %s ...", filename); texture = IMG_LoadTexture(app.renderer, getFileLocation(filename)); - + + if (!texture) + { + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_CRITICAL, "Failed to load texture '%s'", filename); + exit(1); + } + addTextureToCache(filename, texture); return texture; } - SDL_Texture *getTexture(char *filename) { Texture *t; @@ -84,6 +89,20 @@ SDL_Texture *getTexture(char *filename) return loadTexture(filename); } +SDL_Texture *toTexture(SDL_Surface *surface, int destroySurface) +{ + SDL_Texture *texture; + + texture = SDL_CreateTextureFromSurface(app.renderer, surface); + + if (destroySurface) + { + SDL_FreeSurface(surface); + } + + return texture; +} + void destroyTextures(void) { Texture *t, *next; diff --git a/src/system/transition.c b/src/system/transition.c index 00cbbf8..06b8d4f 100644 --- a/src/system/transition.c +++ b/src/system/transition.c @@ -31,8 +31,6 @@ void startSectionTransition(void) clearInput(); presentScene(); - - expireTexts(1); } void endSectionTransition(void) diff --git a/src/system/util.c b/src/system/util.c index fb0ee74..d07b9d6 100644 --- a/src/system/util.c +++ b/src/system/util.c @@ -167,3 +167,22 @@ void *resize(void *array, int oldSize, int newSize) return newArray; } + +unsigned long hashcode(const char *str) +{ + unsigned long hash = 5381; + int c; + + c = *str; + + while (c) + { + hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ + + c = *str++; + } + + hash = ((hash << 5) + hash); + + return hash; +} diff --git a/src/system/widgets.c b/src/system/widgets.c index a38c73e..625460c 100644 --- a/src/system/widgets.c +++ b/src/system/widgets.c @@ -32,8 +32,8 @@ static void handleControlWidgets(void); static Widget head; static Widget *tail; static Widget *selectedWidget; -static SDL_Texture *optionsLeft; -static SDL_Texture *optionsRight; +static AtlasImage *optionsLeft; +static AtlasImage *optionsRight; static int drawingWidgets; void initWidgets(void) @@ -44,8 +44,8 @@ void initWidgets(void) selectedWidget = NULL; - optionsLeft = getTexture("gfx/widgets/optionsLeft.png"); - optionsRight = getTexture("gfx/widgets/optionsRight.png"); + optionsLeft = getAtlasImage("gfx/widgets/optionsLeft.png"); + optionsRight = getAtlasImage("gfx/widgets/optionsRight.png"); loadWidgets(); @@ -396,8 +396,9 @@ static void loadWidgetSet(char *filename) break; case WT_IMG_BUTTON: - w->texture = getTexture(cJSON_GetObjectItem(node, "texture")->valuestring); - SDL_QueryTexture(w->texture, NULL, NULL, &w->rect.w, &w->rect.h); + w->texture = getAtlasImage(cJSON_GetObjectItem(node, "texture")->valuestring); + w->rect.w = w->texture->rect.w; + w->rect.h = w->texture->rect.h; break; case WT_SELECT: @@ -512,7 +513,7 @@ void autoSizeWidgetButtons(char *group, int recenter) { if (strcmp(w->group, group) == 0 && w->type == WT_BUTTON) { - textSize(w->text, 20, &width, &height); + calcTextDimensions(w->text, 20, &width, &height); maxWidth = MAX(MAX(w->rect.w, width), maxWidth); } diff --git a/src/system/widgets.h b/src/system/widgets.h index b6509c2..cb5f5e8 100644 --- a/src/system/widgets.h +++ b/src/system/widgets.h @@ -25,8 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...); extern char *readFile(char *filename); extern long lookup(char *name); -extern void blit(SDL_Texture *texture, int x, int y, int centered); -extern SDL_Texture *getTexture(char *filename); +extern void blit(AtlasImage *atlasImage, int x, int y, int centered); +extern AtlasImage *getAtlasImage(char *filename); extern int collision(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2); extern void playSound(int id); extern char **getFileList(char *dir, int *count); @@ -35,7 +35,7 @@ extern void updateControlKey(char *name); extern void updateControlButton(char *name); extern void clearControlConfig(char *name); extern void clearInput(void); -extern void textSize(char *text, int size, int *w, int *h); +extern void calcTextDimensions(char *text, int size, int *w, int *h); extern App app; extern Colors colors;