#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 TerrainType { TERRAIN_COUNT, TERRAIN_NONE, } 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_KEEP, BUILDING_COUNT, BUILDING_NONE, } BuildingType; static BuildingType getTileBuilding(BzTileID tile) { switch (tile) { case 5892: case 5893: case 5894: case 6148: case 6149: case 6150: case 6404: case 6405: case 6406: return BUILDING_KEEP; default: return BUILDING_NONE; } } static BuildingType getBuildingTile(BuildingType type) { switch (type) { case BUILDING_KEEP: return 5892; default: return -1; } } static BuildingType getBuildingFromStr(const char *str) { if (strncmp("keep", str, 4) == 0) return BUILDING_KEEP; return BUILDING_NONE; } static const char *getBuildingStr(BuildingType type) { switch (type) { case BUILDING_KEEP: return "keep"; default: return NULL; } } static BuildingType getBuildingSize(BuildingType type, BzTileID *outWidth, BzTileID *outHeight) { switch (type) { case BUILDING_KEEP: if (outWidth) *outWidth = 3; if (outHeight) *outHeight = 3; break; default: if (outWidth) *outWidth = 0; if (outHeight) *outHeight = 0; break; } } typedef enum EntityType { ENTITY_WORKER, ENTITY_WOOD, ENTITY_STONE, ENTITY_APPLE, ENTITY_GOLD, ENTITY_POP, ENTITY_COUNT, ENTITY_NONE, } EntityType; typedef enum AnimType { ANIM_IDLE, ANIM_WALK, ANIM_HURT, ANIM_DIE, ANIM_COUNT, ANIM_NONE, } AnimType; static EntityType getEntityTile(EntityType type) { switch (type) { case ENTITY_WORKER: return 27; 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 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; } default: return false; } } 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 = 6}; 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}, {36, 0.1500f}, {35, 0.1300f}, {36, 1.4000f}}) [frameIdx]; default: break; } default: break; } BZ_ASSERT(0); return (AnimationFrame) {-1, -1.0f}; } #endif // GAME_TILESET_H