#ifndef GAME_TILESET_H #define GAME_TILESET_H // This file was generated by: extract_tileset.py #include #include typedef struct AnimationSequence { BzTileID startFrame; i32 frameCount; } AnimationSequence; typedef struct AnimationFrame { BzTileID frame; f32 duration; } AnimationFrame; typedef enum OwnerType { OWNER_NONE = -1, OWNER_BLUE, OWNER_RED, OWNER_COUNT, } OwnerType; static OwnerType getOwnerType(BzTileID tile) { switch (tile) { case 1046: return OWNER_RED; case 1301: return OWNER_BLUE; default: return OWNER_COUNT; } } typedef enum ParticleType { PARTICLE_NONE = -1, PARTICLE_CIRCLE, PARTICLE_SMALL_SQUARE, PARTICLE_SQUARE, PARTICLE_COUNT, } ParticleType; static BzTileID getParticleTypeTile(ParticleType type) { switch (type) { case PARTICLE_SQUARE: return 1559; case PARTICLE_CIRCLE: return 1560; case PARTICLE_SMALL_SQUARE: return 1561; default: return -1; } } static ParticleType getParticleType(BzTileID tile) { switch (tile) { case 1559: return PARTICLE_SQUARE; case 1560: return PARTICLE_CIRCLE; case 1561: return PARTICLE_SMALL_SQUARE; default: return PARTICLE_COUNT; } } static const char *getParticleTypeStr(ParticleType type) { switch (type) { case PARTICLE_SQUARE: return "square"; case PARTICLE_CIRCLE: return "circle"; case PARTICLE_SMALL_SQUARE: return "small_square"; default: return NULL; } } typedef enum TerrainType { TERRAIN_NONE = -1, TERRAIN_GOLD_ORE, TERRAIN_COUNT, } TerrainType; static bool terrainHasAnimation(BzTileID tile) { switch (tile) { case 1792: case 1793: case 1794: case 1795: case 1797: case 1799: case 1800: case 1801: case 1802: case 1803: case 1804: case 1805: case 1806: case 1807: case 1808: case 1809: case 1810: case 1811: case 1812: case 1813: case 1814: case 1815: case 1816: case 1817: case 1818: case 2048: case 2049: case 2050: case 2051: case 2052: case 2053: case 2054: case 2055: case 2057: case 2058: case 2059: case 2060: case 2062: case 2063: case 2064: case 2065: case 2067: case 2068: case 2069: case 2070: case 2072: case 2073: case 2074: case 2304: case 2305: case 2306: case 2307: case 2309: case 2311: case 2312: case 2313: case 2316: case 2317: case 2318: case 2321: case 2322: case 2323: case 2326: case 2327: case 2328: case 2560: case 2561: case 2562: case 2563: case 4868: return true; default: return false; } } static AnimationSequence terrainGetAnimationSequence(BzTileID tile) { switch (tile) { case 1792: return (AnimationSequence) {.startFrame = 1792, .frameCount = 4}; case 1793: return (AnimationSequence) {.startFrame = 1793, .frameCount = 4}; case 1794: return (AnimationSequence) {.startFrame = 1794, .frameCount = 4}; case 1795: return (AnimationSequence) {.startFrame = 1795, .frameCount = 4}; case 1797: return (AnimationSequence) {.startFrame = 1797, .frameCount = 4}; case 1799: return (AnimationSequence) {.startFrame = 1799, .frameCount = 4}; case 1800: return (AnimationSequence) {.startFrame = 1800, .frameCount = 4}; case 1801: return (AnimationSequence) {.startFrame = 1801, .frameCount = 4}; case 1802: return (AnimationSequence) {.startFrame = 1802, .frameCount = 4}; case 1803: return (AnimationSequence) {.startFrame = 1803, .frameCount = 4}; case 1804: return (AnimationSequence) {.startFrame = 1804, .frameCount = 4}; case 1805: return (AnimationSequence) {.startFrame = 1805, .frameCount = 4}; case 1806: return (AnimationSequence) {.startFrame = 1806, .frameCount = 4}; case 1807: return (AnimationSequence) {.startFrame = 1807, .frameCount = 4}; case 1808: return (AnimationSequence) {.startFrame = 1808, .frameCount = 4}; case 1809: return (AnimationSequence) {.startFrame = 1809, .frameCount = 4}; case 1810: return (AnimationSequence) {.startFrame = 1810, .frameCount = 4}; case 1811: return (AnimationSequence) {.startFrame = 1811, .frameCount = 4}; case 1812: return (AnimationSequence) {.startFrame = 1812, .frameCount = 4}; case 1813: return (AnimationSequence) {.startFrame = 1813, .frameCount = 4}; case 1814: return (AnimationSequence) {.startFrame = 1814, .frameCount = 4}; case 1815: return (AnimationSequence) {.startFrame = 1815, .frameCount = 4}; case 1816: return (AnimationSequence) {.startFrame = 1816, .frameCount = 4}; case 1817: return (AnimationSequence) {.startFrame = 1817, .frameCount = 4}; case 1818: return (AnimationSequence) {.startFrame = 1818, .frameCount = 4}; case 2048: return (AnimationSequence) {.startFrame = 2048, .frameCount = 4}; case 2049: return (AnimationSequence) {.startFrame = 2049, .frameCount = 4}; case 2050: return (AnimationSequence) {.startFrame = 2050, .frameCount = 4}; case 2051: return (AnimationSequence) {.startFrame = 2051, .frameCount = 4}; case 2052: return (AnimationSequence) {.startFrame = 2052, .frameCount = 4}; case 2053: return (AnimationSequence) {.startFrame = 2053, .frameCount = 4}; case 2054: return (AnimationSequence) {.startFrame = 2054, .frameCount = 4}; case 2055: return (AnimationSequence) {.startFrame = 2055, .frameCount = 4}; case 2057: return (AnimationSequence) {.startFrame = 2057, .frameCount = 4}; case 2058: return (AnimationSequence) {.startFrame = 2058, .frameCount = 4}; case 2059: return (AnimationSequence) {.startFrame = 2059, .frameCount = 4}; case 2060: return (AnimationSequence) {.startFrame = 2060, .frameCount = 4}; case 2062: return (AnimationSequence) {.startFrame = 2062, .frameCount = 4}; case 2063: return (AnimationSequence) {.startFrame = 2063, .frameCount = 4}; case 2064: return (AnimationSequence) {.startFrame = 2064, .frameCount = 4}; case 2065: return (AnimationSequence) {.startFrame = 2065, .frameCount = 4}; case 2067: return (AnimationSequence) {.startFrame = 2067, .frameCount = 4}; case 2068: return (AnimationSequence) {.startFrame = 2068, .frameCount = 4}; case 2069: return (AnimationSequence) {.startFrame = 2069, .frameCount = 4}; case 2070: return (AnimationSequence) {.startFrame = 2070, .frameCount = 4}; case 2072: return (AnimationSequence) {.startFrame = 2072, .frameCount = 4}; case 2073: return (AnimationSequence) {.startFrame = 2073, .frameCount = 4}; case 2074: return (AnimationSequence) {.startFrame = 2074, .frameCount = 4}; case 2304: return (AnimationSequence) {.startFrame = 2304, .frameCount = 4}; case 2305: return (AnimationSequence) {.startFrame = 2305, .frameCount = 4}; case 2306: return (AnimationSequence) {.startFrame = 2306, .frameCount = 4}; case 2307: return (AnimationSequence) {.startFrame = 2307, .frameCount = 4}; case 2309: return (AnimationSequence) {.startFrame = 2309, .frameCount = 4}; case 2311: return (AnimationSequence) {.startFrame = 2311, .frameCount = 4}; case 2312: return (AnimationSequence) {.startFrame = 2312, .frameCount = 4}; case 2313: return (AnimationSequence) {.startFrame = 2313, .frameCount = 4}; case 2316: return (AnimationSequence) {.startFrame = 2316, .frameCount = 4}; case 2317: return (AnimationSequence) {.startFrame = 2317, .frameCount = 4}; case 2318: return (AnimationSequence) {.startFrame = 2318, .frameCount = 4}; case 2321: return (AnimationSequence) {.startFrame = 2321, .frameCount = 4}; case 2322: return (AnimationSequence) {.startFrame = 2322, .frameCount = 4}; case 2323: return (AnimationSequence) {.startFrame = 2323, .frameCount = 4}; case 2326: return (AnimationSequence) {.startFrame = 2326, .frameCount = 4}; case 2327: return (AnimationSequence) {.startFrame = 2327, .frameCount = 4}; case 2328: return (AnimationSequence) {.startFrame = 2328, .frameCount = 4}; case 2560: return (AnimationSequence) {.startFrame = 2560, .frameCount = 4}; case 2561: return (AnimationSequence) {.startFrame = 2561, .frameCount = 4}; case 2562: return (AnimationSequence) {.startFrame = 2562, .frameCount = 4}; case 2563: return (AnimationSequence) {.startFrame = 2563, .frameCount = 4}; case 4868: return (AnimationSequence) {.startFrame = 4868, .frameCount = 4}; default: BZ_ASSERT(0); return (AnimationSequence) {0, 0}; } } static AnimationFrame terrainGetAnimationFrame(BzTileID tile, i32 frameIdx) { switch (tile) { case 1792: return ((AnimationFrame []) {{1792, 0.1000f}, {2816, 0.1000f}, {3840, 0.1000f}, {4864, 0.1000f}}) [frameIdx]; case 1793: return ((AnimationFrame []) {{1793, 0.1000f}, {2817, 0.1000f}, {3841, 0.1000f}, {4865, 0.1000f}}) [frameIdx]; case 1794: return ((AnimationFrame []) {{1794, 0.1000f}, {2818, 0.1000f}, {3842, 0.1000f}, {4866, 0.1000f}}) [frameIdx]; case 1795: return ((AnimationFrame []) {{1795, 0.1000f}, {2819, 0.1000f}, {3843, 0.1000f}, {4867, 0.1000f}}) [frameIdx]; case 1797: return ((AnimationFrame []) {{1797, 0.1000f}, {2565, 0.1000f}, {3333, 0.1000f}, {4101, 0.1000f}}) [frameIdx]; case 1799: return ((AnimationFrame []) {{1799, 0.1000f}, {2567, 0.1000f}, {3335, 0.1000f}, {4103, 0.1000f}}) [frameIdx]; case 1800: return ((AnimationFrame []) {{1800, 0.1000f}, {2568, 0.1000f}, {3336, 0.1000f}, {4104, 0.1000f}}) [frameIdx]; case 1801: return ((AnimationFrame []) {{1801, 0.1000f}, {2569, 0.1000f}, {3337, 0.1000f}, {4105, 0.1000f}}) [frameIdx]; case 1802: return ((AnimationFrame []) {{1802, 0.1000f}, {2314, 0.1000f}, {2826, 0.1000f}, {3338, 0.1000f}}) [frameIdx]; case 1803: return ((AnimationFrame []) {{1803, 0.1000f}, {2315, 0.1000f}, {2827, 0.1000f}, {3339, 0.1000f}}) [frameIdx]; case 1804: return ((AnimationFrame []) {{1804, 0.4000f}, {2572, 0.4000f}, {3340, 0.4000f}, {4108, 0.4000f}}) [frameIdx]; case 1805: return ((AnimationFrame []) {{1805, 0.4000f}, {2573, 0.4000f}, {3341, 0.4000f}, {4109, 0.4000f}}) [frameIdx]; case 1806: return ((AnimationFrame []) {{1806, 0.4000f}, {2574, 0.4000f}, {3342, 0.4000f}, {4110, 0.4000f}}) [frameIdx]; case 1807: return ((AnimationFrame []) {{1807, 0.4000f}, {2319, 0.4000f}, {2831, 0.4000f}, {3343, 0.4000f}}) [frameIdx]; case 1808: return ((AnimationFrame []) {{1808, 0.4000f}, {2320, 0.4000f}, {2832, 0.4000f}, {3344, 0.4000f}}) [frameIdx]; case 1809: return ((AnimationFrame []) {{1809, 0.2000f}, {2577, 0.2000f}, {3345, 0.2000f}, {4113, 0.2000f}}) [frameIdx]; case 1810: return ((AnimationFrame []) {{1810, 0.2000f}, {2578, 0.2000f}, {3346, 0.2000f}, {4114, 0.2000f}}) [frameIdx]; case 1811: return ((AnimationFrame []) {{1811, 0.2000f}, {2579, 0.2000f}, {3347, 0.2000f}, {4115, 0.2000f}}) [frameIdx]; case 1812: return ((AnimationFrame []) {{1812, 0.2000f}, {2580, 0.2000f}, {3348, 0.2000f}, {4116, 0.2000f}}) [frameIdx]; case 1813: return ((AnimationFrame []) {{1813, 0.2000f}, {2581, 0.2000f}, {3349, 0.2000f}, {4117, 0.2000f}}) [frameIdx]; case 1814: return ((AnimationFrame []) {{1814, 0.2000f}, {2582, 0.2000f}, {3350, 0.2000f}, {4118, 0.2000f}}) [frameIdx]; case 1815: return ((AnimationFrame []) {{1815, 0.2000f}, {2583, 0.2000f}, {3351, 0.2000f}, {4119, 0.2000f}}) [frameIdx]; case 1816: return ((AnimationFrame []) {{1816, 0.2000f}, {2584, 0.2000f}, {3352, 0.2000f}, {4120, 0.2000f}}) [frameIdx]; case 1817: return ((AnimationFrame []) {{1817, 0.2000f}, {2585, 0.2000f}, {3353, 0.2000f}, {4121, 0.2000f}}) [frameIdx]; case 1818: return ((AnimationFrame []) {{1818, 0.2000f}, {2586, 0.2000f}, {3354, 0.2000f}, {4122, 0.2000f}}) [frameIdx]; case 2048: return ((AnimationFrame []) {{2048, 0.1000f}, {3072, 0.1000f}, {4096, 0.1000f}, {5120, 0.1000f}}) [frameIdx]; case 2049: return ((AnimationFrame []) {{2049, 0.1000f}, {3073, 0.1000f}, {4097, 0.1000f}, {5121, 0.1000f}}) [frameIdx]; case 2050: return ((AnimationFrame []) {{2050, 0.1000f}, {3074, 0.1000f}, {4098, 0.1000f}, {5122, 0.1000f}}) [frameIdx]; case 2051: return ((AnimationFrame []) {{2051, 0.1000f}, {3075, 0.1000f}, {4099, 0.1000f}, {5123, 0.1000f}}) [frameIdx]; case 2052: return ((AnimationFrame []) {{2052, 0.1000f}, {2820, 0.1000f}, {3588, 0.1000f}, {4356, 0.1000f}}) [frameIdx]; case 2053: return ((AnimationFrame []) {{2053, 0.1000f}, {2821, 0.1000f}, {3589, 0.1000f}, {4357, 0.1000f}}) [frameIdx]; case 2054: return ((AnimationFrame []) {{2054, 0.1000f}, {2822, 0.1000f}, {3590, 0.1000f}, {4358, 0.1000f}}) [frameIdx]; case 2055: return ((AnimationFrame []) {{2055, 0.1000f}, {2823, 0.1000f}, {3591, 0.1000f}, {4359, 0.1000f}}) [frameIdx]; case 2057: return ((AnimationFrame []) {{2057, 0.1000f}, {2825, 0.1000f}, {3593, 0.1000f}, {4361, 0.1000f}}) [frameIdx]; case 2058: return ((AnimationFrame []) {{2058, 0.1000f}, {2570, 0.1000f}, {3082, 0.1000f}, {3594, 0.1000f}}) [frameIdx]; case 2059: return ((AnimationFrame []) {{2059, 0.1000f}, {2571, 0.1000f}, {3083, 0.1000f}, {3595, 0.1000f}}) [frameIdx]; case 2060: return ((AnimationFrame []) {{2060, 0.4000f}, {2828, 0.4000f}, {3596, 0.4000f}, {4364, 0.4000f}}) [frameIdx]; case 2062: return ((AnimationFrame []) {{2062, 0.4000f}, {2830, 0.4000f}, {3598, 0.4000f}, {4366, 0.4000f}}) [frameIdx]; case 2063: return ((AnimationFrame []) {{2063, 0.4000f}, {2575, 0.4000f}, {3087, 0.4000f}, {3599, 0.4000f}}) [frameIdx]; case 2064: return ((AnimationFrame []) {{2064, 0.4000f}, {2576, 0.4000f}, {3088, 0.4000f}, {3600, 0.4000f}}) [frameIdx]; case 2065: return ((AnimationFrame []) {{2065, 0.2000f}, {2833, 0.2000f}, {3601, 0.2000f}, {4369, 0.2000f}}) [frameIdx]; case 2067: return ((AnimationFrame []) {{2067, 0.2000f}, {2835, 0.2000f}, {3603, 0.2000f}, {4371, 0.2000f}}) [frameIdx]; case 2068: return ((AnimationFrame []) {{2068, 0.2000f}, {2836, 0.2000f}, {3604, 0.2000f}, {4372, 0.2000f}}) [frameIdx]; case 2069: return ((AnimationFrame []) {{2069, 0.2000f}, {2837, 0.2000f}, {3605, 0.2000f}, {4373, 0.2000f}}) [frameIdx]; case 2070: return ((AnimationFrame []) {{2070, 0.2000f}, {2838, 0.2000f}, {3606, 0.2000f}, {4374, 0.2000f}}) [frameIdx]; case 2072: return ((AnimationFrame []) {{2072, 0.2000f}, {2840, 0.2000f}, {3608, 0.2000f}, {4376, 0.2000f}}) [frameIdx]; case 2073: return ((AnimationFrame []) {{2073, 0.2000f}, {2841, 0.2000f}, {3609, 0.2000f}, {4377, 0.2000f}}) [frameIdx]; case 2074: return ((AnimationFrame []) {{2074, 0.2000f}, {2842, 0.2000f}, {3610, 0.2000f}, {4378, 0.2000f}}) [frameIdx]; case 2304: return ((AnimationFrame []) {{2304, 0.1000f}, {3328, 0.1000f}, {4352, 0.1000f}, {5376, 0.1000f}}) [frameIdx]; case 2305: return ((AnimationFrame []) {{2305, 0.1000f}, {3329, 0.1000f}, {4353, 0.1000f}, {5377, 0.1000f}}) [frameIdx]; case 2306: return ((AnimationFrame []) {{2306, 0.1000f}, {3330, 0.1000f}, {4354, 0.1000f}, {5378, 0.1000f}}) [frameIdx]; case 2307: return ((AnimationFrame []) {{2307, 0.1000f}, {3331, 0.1000f}, {4355, 0.1000f}, {5379, 0.1000f}}) [frameIdx]; case 2309: return ((AnimationFrame []) {{2309, 0.1000f}, {3077, 0.1000f}, {3845, 0.1000f}, {4613, 0.1000f}}) [frameIdx]; case 2311: return ((AnimationFrame []) {{2311, 0.1000f}, {3079, 0.1000f}, {3847, 0.1000f}, {4615, 0.1000f}}) [frameIdx]; case 2312: return ((AnimationFrame []) {{2312, 0.1000f}, {3080, 0.1000f}, {3848, 0.1000f}, {4616, 0.1000f}}) [frameIdx]; case 2313: return ((AnimationFrame []) {{2313, 0.1000f}, {3081, 0.1000f}, {3849, 0.1000f}, {4617, 0.1000f}}) [frameIdx]; case 2316: return ((AnimationFrame []) {{2316, 0.4000f}, {3084, 0.4000f}, {3852, 0.4000f}, {4620, 0.4000f}}) [frameIdx]; case 2317: return ((AnimationFrame []) {{2317, 0.4000f}, {3085, 0.4000f}, {3853, 0.4000f}, {4621, 0.4000f}}) [frameIdx]; case 2318: return ((AnimationFrame []) {{2318, 0.4000f}, {3086, 0.4000f}, {3854, 0.4000f}, {4622, 0.4000f}}) [frameIdx]; case 2321: return ((AnimationFrame []) {{2321, 0.2000f}, {3089, 0.2000f}, {3857, 0.2000f}, {4625, 0.2000f}}) [frameIdx]; case 2322: return ((AnimationFrame []) {{2322, 0.2000f}, {3090, 0.2000f}, {3858, 0.2000f}, {4626, 0.2000f}}) [frameIdx]; case 2323: return ((AnimationFrame []) {{2323, 0.2000f}, {3091, 0.2000f}, {3859, 0.2000f}, {4627, 0.2000f}}) [frameIdx]; case 2326: return ((AnimationFrame []) {{2326, 0.2000f}, {3094, 0.2000f}, {3862, 0.2000f}, {4630, 0.2000f}}) [frameIdx]; case 2327: return ((AnimationFrame []) {{2327, 0.2000f}, {3095, 0.2000f}, {3863, 0.2000f}, {4631, 0.2000f}}) [frameIdx]; case 2328: return ((AnimationFrame []) {{2328, 0.2000f}, {3096, 0.2000f}, {3864, 0.2000f}, {4632, 0.2000f}}) [frameIdx]; case 2560: return ((AnimationFrame []) {{2560, 0.1000f}, {3584, 0.1000f}, {4608, 0.1000f}, {5632, 0.1000f}}) [frameIdx]; case 2561: return ((AnimationFrame []) {{2561, 0.1000f}, {3585, 0.1000f}, {4609, 0.1000f}, {5633, 0.1000f}}) [frameIdx]; case 2562: return ((AnimationFrame []) {{2562, 0.1000f}, {3586, 0.1000f}, {4610, 0.1000f}, {5634, 0.1000f}}) [frameIdx]; case 2563: return ((AnimationFrame []) {{2563, 0.1000f}, {3587, 0.1000f}, {4611, 0.1000f}, {5635, 0.1000f}}) [frameIdx]; case 4868: return ((AnimationFrame []) {{4868, 0.1000f}, {4869, 0.1000f}, {4870, 0.1000f}, {4871, 0.1000f}}) [frameIdx]; default: BZ_ASSERT(0); return (AnimationFrame) {-1, -1.0f}; } } typedef enum BuildingType { BUILDING_NONE = -1, BUILDING_ARCHERY_RANGE, BUILDING_BARRACKS, BUILDING_GRANARY, BUILDING_HOUSE_01, BUILDING_HOUSE_02, BUILDING_HOUSE_03, BUILDING_HOUSE_04, BUILDING_HOUSE_05, BUILDING_HOUSE_06, BUILDING_HOUSE_07, BUILDING_HOUSE_08, BUILDING_HOUSE_09, BUILDING_KEEP, BUILDING_MARKET, BUILDING_MILL, BUILDING_TOWER, BUILDING_WAREHOUSE, BUILDING_WHEAT_0, BUILDING_WHEAT_1, BUILDING_COUNT, } BuildingType; static BuildingType getTileBuilding(BzTileID tile) { switch (tile) { case 5638: return BUILDING_BARRACKS; case 5650: return BUILDING_TOWER; case 5654: case 5655: case 5910: case 5911: return BUILDING_KEEP; case 6400: return BUILDING_WHEAT_1; case 6401: return BUILDING_WHEAT_0; case 6405: case 6406: return BUILDING_ARCHERY_RANGE; case 6433: return BUILDING_WAREHOUSE; case 6666: return BUILDING_HOUSE_01; case 6667: return BUILDING_HOUSE_02; case 6668: return BUILDING_HOUSE_03; case 6689: return BUILDING_MILL; case 6922: return BUILDING_HOUSE_04; case 6923: return BUILDING_HOUSE_05; case 6924: return BUILDING_HOUSE_06; case 6945: return BUILDING_GRANARY; case 7178: return BUILDING_HOUSE_07; case 7179: return BUILDING_HOUSE_08; case 7180: return BUILDING_HOUSE_09; case 7191: return BUILDING_MARKET; default: return BUILDING_COUNT; } } static BzTileID getBuildingTile(BuildingType type) { switch (type) { case BUILDING_BARRACKS: return 5638; case BUILDING_TOWER: return 5650; case BUILDING_KEEP: return 5654; case BUILDING_WHEAT_1: return 6400; case BUILDING_WHEAT_0: return 6401; case BUILDING_ARCHERY_RANGE: return 6405; case BUILDING_WAREHOUSE: return 6433; case BUILDING_HOUSE_01: return 6666; case BUILDING_HOUSE_02: return 6667; case BUILDING_HOUSE_03: return 6668; case BUILDING_MILL: return 6689; case BUILDING_HOUSE_04: return 6922; case BUILDING_HOUSE_05: return 6923; case BUILDING_HOUSE_06: return 6924; case BUILDING_GRANARY: return 6945; case BUILDING_HOUSE_07: return 7178; case BUILDING_HOUSE_08: return 7179; case BUILDING_HOUSE_09: return 7180; case BUILDING_MARKET: return 7191; default: return -1; } } static const char *getBuildingStr(BuildingType type) { switch (type) { case BUILDING_BARRACKS: return "barracks"; case BUILDING_TOWER: return "tower"; case BUILDING_KEEP: return "keep"; case BUILDING_WHEAT_1: return "wheat_1"; case BUILDING_WHEAT_0: return "wheat_0"; case BUILDING_ARCHERY_RANGE: return "archery_range"; case BUILDING_WAREHOUSE: return "warehouse"; case BUILDING_HOUSE_01: return "house_01"; case BUILDING_HOUSE_02: return "house_02"; case BUILDING_HOUSE_03: return "house_03"; case BUILDING_MILL: return "mill"; case BUILDING_HOUSE_04: return "house_04"; case BUILDING_HOUSE_05: return "house_05"; case BUILDING_HOUSE_06: return "house_06"; case BUILDING_GRANARY: return "granary"; case BUILDING_HOUSE_07: return "house_07"; case BUILDING_HOUSE_08: return "house_08"; case BUILDING_HOUSE_09: return "house_09"; case BUILDING_MARKET: return "market"; default: return NULL; } } static BuildingType getBuildingSize(BuildingType type, i32 *outWidth, i32 *outHeight) { switch (type) { case BUILDING_BARRACKS: if (outWidth) *outWidth = 1; if (outHeight) *outHeight = 1; break; case BUILDING_TOWER: if (outWidth) *outWidth = 1; if (outHeight) *outHeight = 1; break; case BUILDING_KEEP: if (outWidth) *outWidth = 2; if (outHeight) *outHeight = 2; break; case BUILDING_WHEAT_1: if (outWidth) *outWidth = 1; if (outHeight) *outHeight = 1; break; case BUILDING_WHEAT_0: if (outWidth) *outWidth = 1; if (outHeight) *outHeight = 1; break; case BUILDING_ARCHERY_RANGE: if (outWidth) *outWidth = 2; if (outHeight) *outHeight = 1; break; case BUILDING_WAREHOUSE: if (outWidth) *outWidth = 1; if (outHeight) *outHeight = 1; break; case BUILDING_HOUSE_01: if (outWidth) *outWidth = 1; if (outHeight) *outHeight = 1; break; case BUILDING_HOUSE_02: if (outWidth) *outWidth = 1; if (outHeight) *outHeight = 1; break; case BUILDING_HOUSE_03: if (outWidth) *outWidth = 1; if (outHeight) *outHeight = 1; break; case BUILDING_MILL: if (outWidth) *outWidth = 1; if (outHeight) *outHeight = 1; break; case BUILDING_HOUSE_04: if (outWidth) *outWidth = 1; if (outHeight) *outHeight = 1; break; case BUILDING_HOUSE_05: if (outWidth) *outWidth = 1; if (outHeight) *outHeight = 1; break; case BUILDING_HOUSE_06: if (outWidth) *outWidth = 1; if (outHeight) *outHeight = 1; break; case BUILDING_GRANARY: if (outWidth) *outWidth = 1; if (outHeight) *outHeight = 1; break; case BUILDING_HOUSE_07: if (outWidth) *outWidth = 1; if (outHeight) *outHeight = 1; break; case BUILDING_HOUSE_08: if (outWidth) *outWidth = 1; if (outHeight) *outHeight = 1; break; case BUILDING_HOUSE_09: if (outWidth) *outWidth = 1; if (outHeight) *outHeight = 1; break; case BUILDING_MARKET: if (outWidth) *outWidth = 1; if (outHeight) *outHeight = 1; break; default: if (outWidth) *outWidth = 0; if (outHeight) *outHeight = 0; break; } } typedef enum EntityType { ENTITY_NONE = -1, ENTITY_APPLE, ENTITY_GOBLIN, ENTITY_GOLD, ENTITY_MAGE, ENTITY_ORC, ENTITY_POP, ENTITY_SOLDIER, ENTITY_STONE, ENTITY_WARRIOR, ENTITY_WOOD, ENTITY_WORKER, ENTITY_COUNT, } EntityType; typedef enum AnimType { ANIM_IDLE, ANIM_WALK, ANIM_HURT, ANIM_DIE, ANIM_COUNT, ANIM_NONE = -1, } AnimType; static EntityType getTileEntity(BzTileID tile) { switch (tile) { case 27: case 28: case 29: case 30: case 31: case 32: case 33: case 34: case 35: case 36: return ENTITY_WORKER; case 539: case 540: case 541: case 542: case 543: case 544: case 545: case 546: case 547: case 548: return ENTITY_SOLDIER; case 1051: case 1052: case 1053: case 1054: case 1055: case 1056: case 1057: case 1058: case 1059: case 1060: return ENTITY_WARRIOR; case 1563: case 1564: case 1565: case 1566: case 1567: case 1568: case 1569: case 1570: case 1571: case 1572: return ENTITY_MAGE; case 2075: case 2076: case 2077: case 2078: case 2079: case 2080: case 2081: case 2082: case 2083: case 2084: return ENTITY_ORC; case 2587: case 2588: case 2589: case 2590: case 2591: case 2592: case 2593: case 2594: case 2595: case 2596: return ENTITY_GOBLIN; case 7424: return ENTITY_WOOD; case 7425: return ENTITY_STONE; case 7426: return ENTITY_APPLE; case 7427: return ENTITY_GOLD; case 7428: return ENTITY_POP; default: return ENTITY_COUNT; } } static BzTileID getEntityTile(EntityType type) { switch (type) { case ENTITY_WORKER: return 27; case ENTITY_SOLDIER: return 539; case ENTITY_WARRIOR: return 1051; case ENTITY_MAGE: return 1563; case ENTITY_ORC: return 2075; case ENTITY_GOBLIN: return 2587; case ENTITY_WOOD: return 7424; case ENTITY_STONE: return 7425; case ENTITY_APPLE: return 7426; case ENTITY_GOLD: return 7427; case ENTITY_POP: return 7428; default: return -1; } } static const char *getEntityStr(EntityType type) { switch (type) { case ENTITY_WORKER: return "worker"; case ENTITY_SOLDIER: return "soldier"; case ENTITY_WARRIOR: return "warrior"; case ENTITY_MAGE: return "mage"; case ENTITY_ORC: return "orc"; case ENTITY_GOBLIN: return "goblin"; case ENTITY_WOOD: return "wood"; case ENTITY_STONE: return "stone"; case ENTITY_APPLE: return "apple"; case ENTITY_GOLD: return "gold"; case ENTITY_POP: return "pop"; default: return NULL; } } static const char *getEntityAnimationStr(AnimType type) { switch (type) { case ANIM_IDLE: return "ANIM_IDLE"; case ANIM_WALK: return "ANIM_WALK"; case ANIM_HURT: return "ANIM_HURT"; case ANIM_DIE: return "ANIM_DIE"; case ANIM_COUNT: return "ANIM_COUNT"; case ANIM_NONE: return "ANIM_NONE"; default: return NULL; } } static bool entityHasAnimation(EntityType entity, AnimType type) { switch (entity) { case ENTITY_WORKER: switch (type) { case ANIM_IDLE: case ANIM_WALK: case ANIM_HURT: case ANIM_DIE: return true; default: return false; } case ENTITY_SOLDIER: switch (type) { case ANIM_IDLE: case ANIM_WALK: case ANIM_HURT: case ANIM_DIE: return true; default: return false; } case ENTITY_WARRIOR: switch (type) { case ANIM_IDLE: case ANIM_WALK: case ANIM_HURT: case ANIM_DIE: return true; default: return false; } case ENTITY_MAGE: switch (type) { case ANIM_IDLE: case ANIM_WALK: case ANIM_HURT: case ANIM_DIE: return true; default: return false; } case ENTITY_ORC: switch (type) { case ANIM_IDLE: case ANIM_WALK: case ANIM_HURT: case ANIM_DIE: return true; default: return false; } case ENTITY_GOBLIN: switch (type) { case ANIM_IDLE: case ANIM_WALK: case ANIM_HURT: case ANIM_DIE: return true; default: return false; } default: return false; } } static f32 entityGetAnimationLength(EntityType entity, AnimType type) { switch (entity) { case ENTITY_WORKER: switch (type) { case ANIM_IDLE: return 0.4f; case ANIM_WALK: return 0.72f; case ANIM_HURT: return 0.42000000000000004f; case ANIM_DIE: return 1.2400000000000002f; default: break; } case ENTITY_SOLDIER: switch (type) { case ANIM_IDLE: return 0.4f; case ANIM_WALK: return 0.72f; case ANIM_HURT: return 0.42000000000000004f; case ANIM_DIE: return 0.7000000000000001f; default: break; } case ENTITY_WARRIOR: switch (type) { case ANIM_IDLE: return 0.4f; case ANIM_WALK: return 0.72f; case ANIM_HURT: return 0.42000000000000004f; case ANIM_DIE: return 0.7000000000000001f; default: break; } case ENTITY_MAGE: switch (type) { case ANIM_IDLE: return 0.4f; case ANIM_WALK: return 0.72f; case ANIM_HURT: return 0.42000000000000004f; case ANIM_DIE: return 0.7000000000000001f; default: break; } case ENTITY_ORC: switch (type) { case ANIM_IDLE: return 0.4f; case ANIM_WALK: return 0.72f; case ANIM_HURT: return 0.42000000000000004f; case ANIM_DIE: return 0.7000000000000001f; default: break; } case ENTITY_GOBLIN: switch (type) { case ANIM_IDLE: return 0.4f; case ANIM_WALK: return 0.72f; case ANIM_HURT: return 0.42000000000000004f; case ANIM_DIE: return 0.7000000000000001f; default: break; } default: break; } BZ_ASSERT(0); return 0.0f; } static AnimationSequence entityGetAnimationSequence(EntityType entity, AnimType type) { switch (entity) { case ENTITY_WORKER: switch (type) { case ANIM_IDLE: return (AnimationSequence) {.startFrame = 27, .frameCount = 2}; case ANIM_WALK: return (AnimationSequence) {.startFrame = 29, .frameCount = 4}; case ANIM_HURT: return (AnimationSequence) {.startFrame = 32, .frameCount = 3}; case ANIM_DIE: return (AnimationSequence) {.startFrame = 32, .frameCount = 5}; default: break; } case ENTITY_SOLDIER: switch (type) { case ANIM_IDLE: return (AnimationSequence) {.startFrame = 539, .frameCount = 2}; case ANIM_WALK: return (AnimationSequence) {.startFrame = 541, .frameCount = 4}; case ANIM_HURT: return (AnimationSequence) {.startFrame = 544, .frameCount = 3}; case ANIM_DIE: return (AnimationSequence) {.startFrame = 544, .frameCount = 5}; default: break; } case ENTITY_WARRIOR: switch (type) { case ANIM_IDLE: return (AnimationSequence) {.startFrame = 1051, .frameCount = 2}; case ANIM_WALK: return (AnimationSequence) {.startFrame = 1053, .frameCount = 4}; case ANIM_HURT: return (AnimationSequence) {.startFrame = 1056, .frameCount = 3}; case ANIM_DIE: return (AnimationSequence) {.startFrame = 1056, .frameCount = 5}; default: break; } case ENTITY_MAGE: switch (type) { case ANIM_IDLE: return (AnimationSequence) {.startFrame = 1563, .frameCount = 2}; case ANIM_WALK: return (AnimationSequence) {.startFrame = 1565, .frameCount = 4}; case ANIM_HURT: return (AnimationSequence) {.startFrame = 1568, .frameCount = 3}; case ANIM_DIE: return (AnimationSequence) {.startFrame = 1568, .frameCount = 5}; default: break; } case ENTITY_ORC: switch (type) { case ANIM_IDLE: return (AnimationSequence) {.startFrame = 2075, .frameCount = 2}; case ANIM_WALK: return (AnimationSequence) {.startFrame = 2077, .frameCount = 4}; case ANIM_HURT: return (AnimationSequence) {.startFrame = 2080, .frameCount = 3}; case ANIM_DIE: return (AnimationSequence) {.startFrame = 2080, .frameCount = 5}; default: break; } case ENTITY_GOBLIN: switch (type) { case ANIM_IDLE: return (AnimationSequence) {.startFrame = 2587, .frameCount = 2}; case ANIM_WALK: return (AnimationSequence) {.startFrame = 2589, .frameCount = 4}; case ANIM_HURT: return (AnimationSequence) {.startFrame = 2592, .frameCount = 3}; case ANIM_DIE: return (AnimationSequence) {.startFrame = 2592, .frameCount = 5}; default: break; } default: break; } BZ_ASSERT(0); return (AnimationSequence) {0, 0}; } static AnimationFrame entityGetAnimationFrame(EntityType entity, AnimType type, i32 frameIdx) { switch (entity) { case ENTITY_WORKER: switch (type) { case ANIM_IDLE: return ((AnimationFrame []) {{27, 0.2000f}, {28, 0.2000f}}) [frameIdx]; case ANIM_WALK: return ((AnimationFrame []) {{29, 0.1800f}, {30, 0.1800f}, {31, 0.1800f}, {30, 0.1800f}}) [frameIdx]; case ANIM_HURT: return ((AnimationFrame []) {{32, 0.1400f}, {33, 0.1400f}, {34, 0.1400f}}) [frameIdx]; case ANIM_DIE: return ((AnimationFrame []) {{32, 0.1400f}, {33, 0.1400f}, {34, 0.1400f}, {35, 0.1400f}, {36, 0.6800f}}) [frameIdx]; default: break; } case ENTITY_SOLDIER: switch (type) { case ANIM_IDLE: return ((AnimationFrame []) {{539, 0.2000f}, {540, 0.2000f}}) [frameIdx]; case ANIM_WALK: return ((AnimationFrame []) {{541, 0.1800f}, {542, 0.1800f}, {543, 0.1800f}, {542, 0.1800f}}) [frameIdx]; case ANIM_HURT: return ((AnimationFrame []) {{544, 0.1400f}, {545, 0.1400f}, {546, 0.1400f}}) [frameIdx]; case ANIM_DIE: return ((AnimationFrame []) {{544, 0.1400f}, {545, 0.1400f}, {546, 0.1400f}, {547, 0.1400f}, {548, 0.1400f}}) [frameIdx]; default: break; } case ENTITY_WARRIOR: switch (type) { case ANIM_IDLE: return ((AnimationFrame []) {{1051, 0.2000f}, {1052, 0.2000f}}) [frameIdx]; case ANIM_WALK: return ((AnimationFrame []) {{1053, 0.1800f}, {1054, 0.1800f}, {1055, 0.1800f}, {1054, 0.1800f}}) [frameIdx]; case ANIM_HURT: return ((AnimationFrame []) {{1056, 0.1400f}, {1057, 0.1400f}, {1058, 0.1400f}}) [frameIdx]; case ANIM_DIE: return ((AnimationFrame []) {{1056, 0.1400f}, {1057, 0.1400f}, {1058, 0.1400f}, {1059, 0.1400f}, {1060, 0.1400f}}) [frameIdx]; default: break; } case ENTITY_MAGE: switch (type) { case ANIM_IDLE: return ((AnimationFrame []) {{1563, 0.2000f}, {1564, 0.2000f}}) [frameIdx]; case ANIM_WALK: return ((AnimationFrame []) {{1565, 0.1800f}, {1566, 0.1800f}, {1567, 0.1800f}, {1566, 0.1800f}}) [frameIdx]; case ANIM_HURT: return ((AnimationFrame []) {{1568, 0.1400f}, {1569, 0.1400f}, {1570, 0.1400f}}) [frameIdx]; case ANIM_DIE: return ((AnimationFrame []) {{1568, 0.1400f}, {1569, 0.1400f}, {1570, 0.1400f}, {1571, 0.1400f}, {1572, 0.1400f}}) [frameIdx]; default: break; } case ENTITY_ORC: switch (type) { case ANIM_IDLE: return ((AnimationFrame []) {{2075, 0.2000f}, {2076, 0.2000f}}) [frameIdx]; case ANIM_WALK: return ((AnimationFrame []) {{2077, 0.1800f}, {2078, 0.1800f}, {2079, 0.1800f}, {2078, 0.1800f}}) [frameIdx]; case ANIM_HURT: return ((AnimationFrame []) {{2080, 0.1400f}, {2081, 0.1400f}, {2082, 0.1400f}}) [frameIdx]; case ANIM_DIE: return ((AnimationFrame []) {{2080, 0.1400f}, {2081, 0.1400f}, {2082, 0.1400f}, {2083, 0.1400f}, {2084, 0.1400f}}) [frameIdx]; default: break; } case ENTITY_GOBLIN: switch (type) { case ANIM_IDLE: return ((AnimationFrame []) {{2587, 0.2000f}, {2588, 0.2000f}}) [frameIdx]; case ANIM_WALK: return ((AnimationFrame []) {{2589, 0.1800f}, {2590, 0.1800f}, {2591, 0.1800f}, {2590, 0.1800f}}) [frameIdx]; case ANIM_HURT: return ((AnimationFrame []) {{2592, 0.1400f}, {2593, 0.1400f}, {2594, 0.1400f}}) [frameIdx]; case ANIM_DIE: return ((AnimationFrame []) {{2592, 0.1400f}, {2593, 0.1400f}, {2594, 0.1400f}, {2595, 0.1400f}, {2596, 0.1400f}}) [frameIdx]; default: break; } default: break; } BZ_ASSERT(0); return (AnimationFrame) {-1, -1.0f}; } typedef enum ItemType { ITEM_NONE = -1, ITEM_AXE, ITEM_BATTLEAXE, ITEM_BOW, ITEM_CUTLASS, ITEM_DAGGER, ITEM_FORK, ITEM_GREATEAXE, ITEM_GREATSWORD, ITEM_HAMMER, ITEM_IRON_SHIELD, ITEM_PICKAXE, ITEM_SHIELD, ITEM_SPEAR, ITEM_STAFF, ITEM_SWORD, ITEM_SYTHE, ITEM_WOOD_SHIELD, ITEM_COUNT, } ItemType; static BzTileID getItemTile(ItemType type) { switch (type) { case ITEM_STAFF: return 7680; case ITEM_PICKAXE: return 7681; case ITEM_AXE: return 7682; case ITEM_DAGGER: return 7683; case ITEM_WOOD_SHIELD: return 7936; case ITEM_SHIELD: return 7937; case ITEM_IRON_SHIELD: return 7938; case ITEM_BOW: return 7939; case ITEM_SWORD: return 8192; case ITEM_GREATSWORD: return 8193; case ITEM_CUTLASS: return 8194; case ITEM_BATTLEAXE: return 8195; case ITEM_GREATEAXE: return 8196; case ITEM_SYTHE: return 8448; case ITEM_HAMMER: return 8450; case ITEM_SPEAR: return 8451; case ITEM_FORK: return 8452; default: return -1; } } static Rectangle getTextureRect(BzTileID tile) { Rectangle base = { (tile % 256) * 16, (tile / 256) * 16, 16, 16 }; switch (tile) { case 539: case 540: case 541: case 542: case 543: case 544: case 545: case 546: case 547: case 548: case 1051: case 1052: case 1053: case 1054: case 1055: case 1056: case 1057: case 1058: case 1059: case 1060: case 1563: case 1564: case 1565: case 1566: case 1567: case 1568: case 1569: case 1570: case 1571: case 1572: case 2075: case 2076: case 2077: case 2078: case 2079: case 2080: case 2081: case 2082: case 2083: case 2084: case 2587: case 2588: case 2589: case 2590: case 2591: case 2592: case 2593: case 2594: case 2595: case 2596: base.width *= 1; base.height *= 2; base.y -= 16; break; default: break; } return base; } static BzTileID getTileBase(BzTileID tile) { switch (tile) { case 27: case 37: return 27; case 28: case 38: return 28; case 29: case 39: return 29; case 30: case 40: return 30; case 31: case 41: return 31; case 32: case 42: return 32; case 33: case 43: return 33; case 34: case 44: return 34; case 35: case 45: return 35; case 36: case 46: return 36; case 539: case 549: return 539; case 540: case 550: return 540; case 541: case 551: return 541; case 542: case 552: return 542; case 543: case 553: return 543; case 544: case 554: return 544; case 545: case 555: return 545; case 546: case 556: return 546; case 547: case 557: return 547; case 548: case 558: return 548; case 1051: case 1061: return 1051; case 1052: case 1062: return 1052; case 1053: case 1063: return 1053; case 1054: case 1064: return 1054; case 1055: case 1065: return 1055; case 1056: case 1066: return 1056; case 1057: case 1067: return 1057; case 1058: case 1068: return 1058; case 1059: case 1069: return 1059; case 1060: case 1070: return 1060; case 1563: case 1573: return 1563; case 1564: case 1574: return 1564; case 1565: case 1575: return 1565; case 1566: case 1576: return 1566; case 1567: case 1577: return 1567; case 1568: case 1578: return 1568; case 1569: case 1579: return 1569; case 1570: case 1580: return 1570; case 1571: case 1581: return 1571; case 1572: case 1582: return 1572; case 5637: case 7685: return 5637; case 5638: case 7686: return 5638; case 5639: case 7687: return 5639; case 5640: case 7688: return 5640; case 5642: case 7690: return 5642; case 5643: case 7691: return 5643; case 5644: case 7692: return 5644; case 5646: case 7694: return 5646; case 5647: case 7695: return 5647; case 5648: case 7696: return 5648; case 5650: case 7698: return 5650; case 5651: case 7699: return 5651; case 5654: case 7702: return 5654; case 5655: case 7703: return 5655; case 5656: case 7704: return 5656; case 5657: case 7705: return 5657; case 5658: case 7706: return 5658; case 5659: case 7707: return 5659; case 5661: case 7709: return 5661; case 5662: case 7710: return 5662; case 5663: case 7711: return 5663; case 5665: case 7713: return 5665; case 5666: case 7714: return 5666; case 5667: case 7715: return 5667; case 5668: case 7716: return 5668; case 5893: case 7941: return 5893; case 5894: case 7942: return 5894; case 5895: case 7943: return 5895; case 5896: case 7944: return 5896; case 5898: case 7946: return 5898; case 5899: case 7947: return 5899; case 5900: case 7948: return 5900; case 5902: case 7950: return 5902; case 5903: case 7951: return 5903; case 5904: case 7952: return 5904; case 5906: case 7954: return 5906; case 5907: case 7955: return 5907; case 5908: case 7956: return 5908; case 5910: case 7958: return 5910; case 5911: case 7959: return 5911; case 5912: case 7960: return 5912; case 5913: case 7961: return 5913; case 5914: case 7962: return 5914; case 5915: case 7963: return 5915; case 5917: case 7965: return 5917; case 5918: case 7966: return 5918; case 5919: case 7967: return 5919; case 5921: case 7969: return 5921; case 5922: case 7970: return 5922; case 5923: case 7971: return 5923; case 5924: case 7972: return 5924; case 6149: case 8197: return 6149; case 6150: case 8198: return 6150; case 6151: case 8199: return 6151; case 6152: case 8200: return 6152; case 6158: case 8206: return 6158; case 6159: case 8207: return 6159; case 6160: case 8208: return 6160; case 6162: case 8210: return 6162; case 6163: case 8211: return 6163; case 6164: case 8212: return 6164; case 6166: case 8214: return 6166; case 6167: case 8215: return 6167; case 6168: case 8216: return 6168; case 6169: case 8217: return 6169; case 6170: case 8218: return 6170; case 6171: case 8219: return 6171; case 6405: case 8453: return 6405; case 6406: case 8454: return 6406; case 6407: case 8455: return 6407; case 6408: case 8456: return 6408; case 6410: case 8458: return 6410; case 6411: case 8459: return 6411; case 6412: case 8460: return 6412; case 6414: case 8462: return 6414; case 6415: case 8463: return 6415; case 6416: case 8464: return 6416; case 6418: case 8466: return 6418; case 6419: case 8467: return 6419; case 6420: case 8468: return 6420; case 6422: case 8470: return 6422; case 6423: case 8471: return 6423; case 6424: case 8472: return 6424; case 6425: case 8473: return 6425; case 6426: case 8474: return 6426; case 6427: case 8475: return 6427; case 6429: case 8477: return 6429; case 6430: case 8478: return 6430; case 6431: case 8479: return 6431; case 6433: case 8481: return 6433; case 6434: case 8482: return 6434; case 6435: case 8483: return 6435; case 6661: case 8709: return 6661; case 6662: case 8710: return 6662; case 6663: case 8711: return 6663; case 6664: case 8712: return 6664; case 6666: case 8714: return 6666; case 6667: case 8715: return 6667; case 6668: case 8716: return 6668; case 6674: case 8722: return 6674; case 6675: case 8723: return 6675; case 6676: case 8724: return 6676; case 6685: case 8733: return 6685; case 6686: case 8734: return 6686; case 6687: case 8735: return 6687; case 6689: case 8737: return 6689; case 6690: case 8738: return 6690; case 6691: case 8739: return 6691; case 6922: case 8970: return 6922; case 6923: case 8971: return 6923; case 6924: case 8972: return 6924; case 6926: case 8974: return 6926; case 6927: case 8975: return 6927; case 6928: case 8976: return 6928; case 6934: case 8982: return 6934; case 6935: case 8983: return 6935; case 6936: case 8984: return 6936; case 6937: case 8985: return 6937; case 6938: case 8986: return 6938; case 6939: case 8987: return 6939; case 6941: case 8989: return 6941; case 6942: case 8990: return 6942; case 6943: case 8991: return 6943; case 6945: case 8993: return 6945; case 6946: case 8994: return 6946; case 6947: case 8995: return 6947; case 7173: case 9221: return 7173; case 7174: case 9222: return 7174; case 7175: case 9223: return 7175; case 7178: case 9226: return 7178; case 7179: case 9227: return 7179; case 7180: case 9228: return 7180; case 7182: case 9230: return 7182; case 7183: case 9231: return 7183; case 7184: case 9232: return 7184; case 7190: case 9238: return 7190; case 7191: case 9239: return 7191; case 7192: case 9240: return 7192; case 7193: case 9241: return 7193; case 7194: case 9242: return 7194; case 7195: case 9243: return 7195; default: return tile; } } static Vector2 getTileOffset(BzTileID tile, i32 idx) { if (idx < 0 || idx >= 181) return (Vector2) {0, 0}; switch (tile) { case 27: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 28: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 29: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 30: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 31: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 32: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 33: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 34: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 35: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 36: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 539: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 540: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 541: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 542: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 543: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 544: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 545: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 546: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 547: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 548: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1051: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1052: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1053: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1054: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1055: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1056: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1057: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1058: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1059: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1060: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1563: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1564: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1565: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1566: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1567: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1568: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1569: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1570: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1571: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 1572: return ((Vector2 []) {{0, 0}, {160, 0}})[idx]; case 5637: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5638: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5639: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5640: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5642: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5643: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5644: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5646: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5647: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5648: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5650: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5651: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5654: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5655: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5656: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5657: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5658: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5659: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5661: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5662: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5663: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5665: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5666: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5667: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5668: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5893: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5894: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5895: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5896: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5898: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5899: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5900: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5902: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5903: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5904: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5906: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5907: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5908: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5910: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5911: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5912: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5913: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5914: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5915: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5917: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5918: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5919: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5921: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5922: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5923: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 5924: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6149: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6150: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6151: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6152: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6158: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6159: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6160: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6162: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6163: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6164: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6166: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6167: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6168: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6169: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6170: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6171: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6405: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6406: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6407: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6408: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6410: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6411: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6412: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6414: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6415: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6416: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6418: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6419: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6420: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6422: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6423: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6424: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6425: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6426: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6427: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6429: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6430: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6431: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6433: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6434: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6435: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6661: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6662: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6663: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6664: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6666: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6667: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6668: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6674: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6675: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6676: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6685: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6686: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6687: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6689: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6690: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6691: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6922: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6923: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6924: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6926: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6927: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6928: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6934: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6935: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6936: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6937: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6938: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6939: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6941: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6942: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6943: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6945: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6946: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 6947: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 7173: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 7174: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 7175: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 7178: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 7179: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 7180: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 7182: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 7183: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 7184: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 7190: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 7191: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 7192: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 7193: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 7194: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; case 7195: return ((Vector2 []) {{0, 0}, {0, 128}})[idx]; default: return (Vector2) {0, 0}; } } static bool hasItemHandlePoint(BzTile tile) { switch (tile) { case 7680: case 7681: case 7682: case 7936: case 7937: case 7938: case 7939: case 7942: case 7943: case 8192: case 8193: case 8194: case 8195: case 8196: case 8197: case 8198: case 8199: case 8200: case 8201: case 8448: case 8450: case 8451: case 8452: return true; default: return false; } } static Vector2 getItemHandlePoint(BzTile tile) { switch (tile) { case 7680: return (Vector2) {5, 11}; case 7681: return (Vector2) {4, 11}; case 7682: return (Vector2) {4, 12}; case 7936: return (Vector2) {8, 8}; case 7937: return (Vector2) {8, 8}; case 7938: return (Vector2) {8, 8}; case 7939: return (Vector2) {10, 6}; case 7942: return (Vector2) {7, 7.5}; case 7943: return (Vector2) {7, 9}; case 8192: return (Vector2) {4, 12}; case 8193: return (Vector2) {6, 10}; case 8194: return (Vector2) {3, 13}; case 8195: return (Vector2) {5, 11}; case 8196: return (Vector2) {6, 10}; case 8197: return (Vector2) {6, 10}; case 8198: return (Vector2) {5, 11}; case 8199: return (Vector2) {5, 11}; case 8200: return (Vector2) {4, 12}; case 8201: return (Vector2) {4, 12}; case 8448: return (Vector2) {6, 9}; case 8450: return (Vector2) {5, 11}; case 8451: return (Vector2) {4, 12}; case 8452: return (Vector2) {4, 12}; default: return (Vector2) {0.0f, 0.0f}; } } static bool hasEntityHitBoxRec(BzTile tile) { switch (tile) { case 27: case 539: case 1051: case 1563: case 2075: case 2587: case 5888: case 5889: case 5890: case 5891: case 6146: case 6147: case 6402: case 6403: case 6656: case 6912: case 7170: case 7171: case 7172: return true; default: return false; } } static Rectangle getEntityHitBoxRec(BzTile tile) { switch (tile) { case 27: return (Rectangle) {4, 2, 8, 12}; case 539: return (Rectangle) {4, 2, 8, 14}; case 1051: return (Rectangle) {4, 2, 8, 14}; case 1563: return (Rectangle) {4, 2, 8, 14}; case 2075: return (Rectangle) {4, 2, 8, 13}; case 2587: return (Rectangle) {4, 2, 8, 11}; case 5888: return (Rectangle) {4, 3, 8, 9}; case 5889: return (Rectangle) {3, 2, 10, 7}; case 5890: return (Rectangle) {6, 2, 4, 10}; case 5891: return (Rectangle) {6, 2, 4, 10}; case 6146: return (Rectangle) {6, 2, 4, 10}; case 6147: return (Rectangle) {6, 2, 4, 10}; case 6402: return (Rectangle) {6, 2, 4, 10}; case 6403: return (Rectangle) {6, 2, 4, 10}; case 6656: return (Rectangle) {6, 2, 4, 10}; case 6912: return (Rectangle) {6, 2, 4, 10}; case 7170: return (Rectangle) {3, 3, 10, 10}; case 7171: return (Rectangle) {3, 3, 10, 9}; case 7172: return (Rectangle) {1, 3, 14, 10}; default: return (Rectangle) { 0.0f, 0.0f, 0.0f, 0.0f}; } } #endif // GAME_TILESET_H