Update to use game_tileset.h
This commit is contained in:
@@ -9,15 +9,13 @@ add_subdirectory(engine/)
|
||||
|
||||
|
||||
add_executable(PixelDefense
|
||||
game/utils/building_types.h
|
||||
game/utils/entity_types.h
|
||||
|
||||
game/buildings.c
|
||||
game/buildings.h
|
||||
game/components.c
|
||||
game/components.h
|
||||
game/entrypoint.c
|
||||
game/game_state.h
|
||||
game/game_tileset.h
|
||||
game/input.h
|
||||
game/main.c
|
||||
game/map_init.c
|
||||
|
||||
@@ -31,8 +31,8 @@ bool canPlaceBuilding(BzTileMap *map, BuildingType type, BzTile tileX, BzTile ti
|
||||
BzTile tile = bzTileLayerGetTile(buildLayer, x, y);
|
||||
tile = bzTilesetGetTile(tileset, tile);
|
||||
tile = getTileBuilding(tile);
|
||||
if (tile == BUILDINGS_ROAD)
|
||||
return false;
|
||||
//if (tile == BUILDINGS_ROAD)
|
||||
// return false;
|
||||
if (bzTileMapHasCollision(map, x, y)) {
|
||||
return false;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ ecs_entity_t placeBuilding(BzTileMap *map, BuildingType type, BzTile tileX, BzTi
|
||||
|
||||
ecs_set(ECS, e, TilePosition, { .x = tileX, .y = tileY });
|
||||
ecs_set(ECS, e, TileSize, { .sizeX = sizeX, .sizeY = sizeY });
|
||||
ecs_set(ECS, e, Owner, { .playerID = BUILDINGS_PLAYER_RED });
|
||||
//ecs_set(ECS, e, Owner, { .playerID = BUILDINGS_PLAYER_RED });
|
||||
|
||||
for (i32 y = tileY; y < tileY + sizeY; y++) {
|
||||
for (i32 x = tileX; x < tileX + sizeX; x++) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <breeze.h>
|
||||
#include <flecs.h>
|
||||
|
||||
#include "utils/building_types.h"
|
||||
#include "game_tileset.h"
|
||||
|
||||
bool canPlaceBuilding(BzTileMap *map, BuildingType type, i32 tileX, i32 tileY);
|
||||
ecs_entity_t placeBuilding(BzTileMap *map, BuildingType type, i32 tileX, i32 tileY);
|
||||
|
||||
@@ -21,8 +21,8 @@ ECS_COMPONENT_DECLARE(Path);
|
||||
|
||||
ECS_COMPONENT_DECLARE(TextureRegion);
|
||||
|
||||
ECS_COMPONENT_DECLARE(Animation);
|
||||
ECS_COMPONENT_DECLARE(AnimationType);
|
||||
//ECS_COMPONENT_DECLARE(Animation);
|
||||
//ECS_COMPONENT_DECLARE(AnimationType);
|
||||
|
||||
ECS_TAG_DECLARE(Selectable);
|
||||
ECS_TAG_DECLARE(Selected);
|
||||
@@ -60,8 +60,8 @@ void initComponentIDs(ecs_world_t *ecs) {
|
||||
|
||||
ECS_COMPONENT_DEFINE(ecs, TextureRegion);
|
||||
|
||||
ECS_COMPONENT_DEFINE(ecs, Animation);
|
||||
ECS_COMPONENT_DEFINE(ecs, AnimationType);
|
||||
//ECS_COMPONENT_DEFINE(ecs, Animation);
|
||||
//ECS_COMPONENT_DEFINE(ecs, AnimationType);
|
||||
|
||||
ECS_TAG_DEFINE(ecs, Selectable);
|
||||
ECS_TAG_DEFINE(ecs, Selected);
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
#include <breeze.h>
|
||||
#include <flecs.h>
|
||||
|
||||
#include "utils/building_types.h"
|
||||
#include "utils/entity_types.h"
|
||||
#include "game_tileset.h"
|
||||
|
||||
extern ECS_TAG_DECLARE(TextureTerrain);
|
||||
extern ECS_TAG_DECLARE(TextureBuildings);
|
||||
@@ -102,6 +101,7 @@ extern ECS_COMPONENT_DECLARE(TextureRegion);
|
||||
* Animation components
|
||||
*********************************************************/
|
||||
|
||||
/*
|
||||
typedef struct Animation {
|
||||
EntityType entityType;
|
||||
AnimationType animType;
|
||||
@@ -114,6 +114,7 @@ typedef struct Animation {
|
||||
extern ECS_COMPONENT_DECLARE(Animation);
|
||||
|
||||
extern ECS_COMPONENT_DECLARE(AnimationType);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
315
game/game_tileset.h
Normal file
315
game/game_tileset.h
Normal file
@@ -0,0 +1,315 @@
|
||||
#ifndef GAME_TILESET_H
|
||||
#define GAME_TILESET_H
|
||||
|
||||
// This file was generated by: extract_tileset.py
|
||||
|
||||
#include <breeze.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct AnimationSequence {
|
||||
BzTile startFrame;
|
||||
i32 frameCount;
|
||||
} AnimationSequence;
|
||||
|
||||
typedef struct AnimationFrame {
|
||||
BzTile frame;
|
||||
f32 duration;
|
||||
} AnimationFrame;
|
||||
|
||||
typedef enum TerrainType {
|
||||
TERRAIN_COUNT,
|
||||
TERRAIN_NONE,
|
||||
} TerrainType;
|
||||
|
||||
static bool terrainHasAnimation(BzTile 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(BzTile 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(BzTile tile, i32 frameIdx) {
|
||||
switch (tile) {
|
||||
case 1792: return ((AnimationFrame []) {{1792, 100}, {2816, 100}, {3840, 100}, {4864, 100}}) [frameIdx];
|
||||
case 1793: return ((AnimationFrame []) {{1793, 100}, {2817, 100}, {3841, 100}, {4865, 100}}) [frameIdx];
|
||||
case 1794: return ((AnimationFrame []) {{1794, 100}, {2818, 100}, {3842, 100}, {4866, 100}}) [frameIdx];
|
||||
case 1795: return ((AnimationFrame []) {{1795, 100}, {2819, 100}, {3843, 100}, {4867, 100}}) [frameIdx];
|
||||
case 1797: return ((AnimationFrame []) {{1797, 100}, {2565, 100}, {3333, 100}, {4101, 100}}) [frameIdx];
|
||||
case 1799: return ((AnimationFrame []) {{1799, 100}, {2567, 100}, {3335, 100}, {4103, 100}}) [frameIdx];
|
||||
case 1800: return ((AnimationFrame []) {{1800, 100}, {2568, 100}, {3336, 100}, {4104, 100}}) [frameIdx];
|
||||
case 1801: return ((AnimationFrame []) {{1801, 100}, {2569, 100}, {3337, 100}, {4105, 100}}) [frameIdx];
|
||||
case 1802: return ((AnimationFrame []) {{1802, 100}, {2314, 100}, {2826, 100}, {3338, 100}}) [frameIdx];
|
||||
case 1803: return ((AnimationFrame []) {{1803, 100}, {2315, 100}, {2827, 100}, {3339, 100}}) [frameIdx];
|
||||
case 1804: return ((AnimationFrame []) {{1804, 400}, {2572, 400}, {3340, 400}, {4108, 400}}) [frameIdx];
|
||||
case 1805: return ((AnimationFrame []) {{1805, 400}, {2573, 400}, {3341, 400}, {4109, 400}}) [frameIdx];
|
||||
case 1806: return ((AnimationFrame []) {{1806, 400}, {2574, 400}, {3342, 400}, {4110, 400}}) [frameIdx];
|
||||
case 1807: return ((AnimationFrame []) {{1807, 400}, {2319, 400}, {2831, 400}, {3343, 400}}) [frameIdx];
|
||||
case 1808: return ((AnimationFrame []) {{1808, 400}, {2320, 400}, {2832, 400}, {3344, 400}}) [frameIdx];
|
||||
case 1809: return ((AnimationFrame []) {{1809, 200}, {2577, 200}, {3345, 200}, {4113, 200}}) [frameIdx];
|
||||
case 1810: return ((AnimationFrame []) {{1810, 200}, {2578, 200}, {3346, 200}, {4114, 200}}) [frameIdx];
|
||||
case 1811: return ((AnimationFrame []) {{1811, 200}, {2579, 200}, {3347, 200}, {4115, 200}}) [frameIdx];
|
||||
case 1812: return ((AnimationFrame []) {{1812, 200}, {2580, 200}, {3348, 200}, {4116, 200}}) [frameIdx];
|
||||
case 1813: return ((AnimationFrame []) {{1813, 200}, {2581, 200}, {3349, 200}, {4117, 200}}) [frameIdx];
|
||||
case 1814: return ((AnimationFrame []) {{1814, 200}, {2582, 200}, {3350, 200}, {4118, 200}}) [frameIdx];
|
||||
case 1815: return ((AnimationFrame []) {{1815, 200}, {2583, 200}, {3351, 200}, {4119, 200}}) [frameIdx];
|
||||
case 1816: return ((AnimationFrame []) {{1816, 200}, {2584, 200}, {3352, 200}, {4120, 200}}) [frameIdx];
|
||||
case 1817: return ((AnimationFrame []) {{1817, 200}, {2585, 200}, {3353, 200}, {4121, 200}}) [frameIdx];
|
||||
case 1818: return ((AnimationFrame []) {{1818, 200}, {2586, 200}, {3354, 200}, {4122, 200}}) [frameIdx];
|
||||
case 2048: return ((AnimationFrame []) {{2048, 100}, {3072, 100}, {4096, 100}, {5120, 100}}) [frameIdx];
|
||||
case 2049: return ((AnimationFrame []) {{2049, 100}, {3073, 100}, {4097, 100}, {5121, 100}}) [frameIdx];
|
||||
case 2050: return ((AnimationFrame []) {{2050, 100}, {3074, 100}, {4098, 100}, {5122, 100}}) [frameIdx];
|
||||
case 2051: return ((AnimationFrame []) {{2051, 100}, {3075, 100}, {4099, 100}, {5123, 100}}) [frameIdx];
|
||||
case 2052: return ((AnimationFrame []) {{2052, 100}, {2820, 100}, {3588, 100}, {4356, 100}}) [frameIdx];
|
||||
case 2053: return ((AnimationFrame []) {{2053, 100}, {2821, 100}, {3589, 100}, {4357, 100}}) [frameIdx];
|
||||
case 2054: return ((AnimationFrame []) {{2054, 100}, {2822, 100}, {3590, 100}, {4358, 100}}) [frameIdx];
|
||||
case 2055: return ((AnimationFrame []) {{2055, 100}, {2823, 100}, {3591, 100}, {4359, 100}}) [frameIdx];
|
||||
case 2057: return ((AnimationFrame []) {{2057, 100}, {2825, 100}, {3593, 100}, {4361, 100}}) [frameIdx];
|
||||
case 2058: return ((AnimationFrame []) {{2058, 100}, {2570, 100}, {3082, 100}, {3594, 100}}) [frameIdx];
|
||||
case 2059: return ((AnimationFrame []) {{2059, 100}, {2571, 100}, {3083, 100}, {3595, 100}}) [frameIdx];
|
||||
case 2060: return ((AnimationFrame []) {{2060, 400}, {2828, 400}, {3596, 400}, {4364, 400}}) [frameIdx];
|
||||
case 2062: return ((AnimationFrame []) {{2062, 400}, {2830, 400}, {3598, 400}, {4366, 400}}) [frameIdx];
|
||||
case 2063: return ((AnimationFrame []) {{2063, 400}, {2575, 400}, {3087, 400}, {3599, 400}}) [frameIdx];
|
||||
case 2064: return ((AnimationFrame []) {{2064, 400}, {2576, 400}, {3088, 400}, {3600, 400}}) [frameIdx];
|
||||
case 2065: return ((AnimationFrame []) {{2065, 200}, {2833, 200}, {3601, 200}, {4369, 200}}) [frameIdx];
|
||||
case 2067: return ((AnimationFrame []) {{2067, 200}, {2835, 200}, {3603, 200}, {4371, 200}}) [frameIdx];
|
||||
case 2068: return ((AnimationFrame []) {{2068, 200}, {2836, 200}, {3604, 200}, {4372, 200}}) [frameIdx];
|
||||
case 2069: return ((AnimationFrame []) {{2069, 200}, {2837, 200}, {3605, 200}, {4373, 200}}) [frameIdx];
|
||||
case 2070: return ((AnimationFrame []) {{2070, 200}, {2838, 200}, {3606, 200}, {4374, 200}}) [frameIdx];
|
||||
case 2072: return ((AnimationFrame []) {{2072, 200}, {2840, 200}, {3608, 200}, {4376, 200}}) [frameIdx];
|
||||
case 2073: return ((AnimationFrame []) {{2073, 200}, {2841, 200}, {3609, 200}, {4377, 200}}) [frameIdx];
|
||||
case 2074: return ((AnimationFrame []) {{2074, 200}, {2842, 200}, {3610, 200}, {4378, 200}}) [frameIdx];
|
||||
case 2304: return ((AnimationFrame []) {{2304, 100}, {3328, 100}, {4352, 100}, {5376, 100}}) [frameIdx];
|
||||
case 2305: return ((AnimationFrame []) {{2305, 100}, {3329, 100}, {4353, 100}, {5377, 100}}) [frameIdx];
|
||||
case 2306: return ((AnimationFrame []) {{2306, 100}, {3330, 100}, {4354, 100}, {5378, 100}}) [frameIdx];
|
||||
case 2307: return ((AnimationFrame []) {{2307, 100}, {3331, 100}, {4355, 100}, {5379, 100}}) [frameIdx];
|
||||
case 2309: return ((AnimationFrame []) {{2309, 100}, {3077, 100}, {3845, 100}, {4613, 100}}) [frameIdx];
|
||||
case 2311: return ((AnimationFrame []) {{2311, 100}, {3079, 100}, {3847, 100}, {4615, 100}}) [frameIdx];
|
||||
case 2312: return ((AnimationFrame []) {{2312, 100}, {3080, 100}, {3848, 100}, {4616, 100}}) [frameIdx];
|
||||
case 2313: return ((AnimationFrame []) {{2313, 100}, {3081, 100}, {3849, 100}, {4617, 100}}) [frameIdx];
|
||||
case 2316: return ((AnimationFrame []) {{2316, 400}, {3084, 400}, {3852, 400}, {4620, 400}}) [frameIdx];
|
||||
case 2317: return ((AnimationFrame []) {{2317, 400}, {3085, 400}, {3853, 400}, {4621, 400}}) [frameIdx];
|
||||
case 2318: return ((AnimationFrame []) {{2318, 400}, {3086, 400}, {3854, 400}, {4622, 400}}) [frameIdx];
|
||||
case 2321: return ((AnimationFrame []) {{2321, 200}, {3089, 200}, {3857, 200}, {4625, 200}}) [frameIdx];
|
||||
case 2322: return ((AnimationFrame []) {{2322, 200}, {3090, 200}, {3858, 200}, {4626, 200}}) [frameIdx];
|
||||
case 2323: return ((AnimationFrame []) {{2323, 200}, {3091, 200}, {3859, 200}, {4627, 200}}) [frameIdx];
|
||||
case 2326: return ((AnimationFrame []) {{2326, 200}, {3094, 200}, {3862, 200}, {4630, 200}}) [frameIdx];
|
||||
case 2327: return ((AnimationFrame []) {{2327, 200}, {3095, 200}, {3863, 200}, {4631, 200}}) [frameIdx];
|
||||
case 2328: return ((AnimationFrame []) {{2328, 200}, {3096, 200}, {3864, 200}, {4632, 200}}) [frameIdx];
|
||||
case 2560: return ((AnimationFrame []) {{2560, 100}, {3584, 100}, {4608, 100}, {5632, 100}}) [frameIdx];
|
||||
case 2561: return ((AnimationFrame []) {{2561, 100}, {3585, 100}, {4609, 100}, {5633, 100}}) [frameIdx];
|
||||
case 2562: return ((AnimationFrame []) {{2562, 100}, {3586, 100}, {4610, 100}, {5634, 100}}) [frameIdx];
|
||||
case 2563: return ((AnimationFrame []) {{2563, 100}, {3587, 100}, {4611, 100}, {5635, 100}}) [frameIdx];
|
||||
case 4868: return ((AnimationFrame []) {{4868, 100}, {4869, 100}, {4870, 100}, {4871, 100}}) [frameIdx];
|
||||
default:
|
||||
BZ_ASSERT(0);
|
||||
return (AnimationFrame) {0, 0};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
typedef enum BuildingType {
|
||||
BUILDING_KEEP,
|
||||
BUILDING_COUNT,
|
||||
BUILDING_NONE,
|
||||
} BuildingType;
|
||||
|
||||
static BuildingType getTileBuilding(BzTile 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, BzTile *outWidth, BzTile *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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // GAME_TILESET_H
|
||||
10
game/main.c
10
game/main.c
@@ -1,9 +1,9 @@
|
||||
#include <rlImGui.h>
|
||||
|
||||
#include "systems.h"
|
||||
#include "utils/building_types.h"
|
||||
#include "components.h"
|
||||
#include "game_state.h"
|
||||
#include "game_tileset.h"
|
||||
#include "input.h"
|
||||
#include "map_init.h"
|
||||
#include "map_layers.h"
|
||||
@@ -125,7 +125,7 @@ bool init(void *userData) {
|
||||
ECS_OBSERVER(ECS, entitySpatialRemove, EcsOnRemove, SpatialGridID);
|
||||
ECS_OBSERVER(ECS, entityPathRemove, EcsOnRemove, Path);
|
||||
|
||||
ECS_OBSERVER(ECS, entitySetAnimationState, EcsOnSet, Animation, AnimationType);
|
||||
//ECS_OBSERVER(ECS, entitySetAnimationState, EcsOnSet, Animation, AnimationType);
|
||||
|
||||
bzTileMapOverrideLayer(&game->map, LAYER_TREES, initTreesLayer);
|
||||
bzTileMapOverrideLayer(&game->map, LAYER_TREES2, initTreesLayer);
|
||||
@@ -143,8 +143,8 @@ bool init(void *userData) {
|
||||
|
||||
ECS_SYSTEM(ECS, entityHarvestTaskSystem, EcsOnUpdate, Position, Rotation, HarvestTask);
|
||||
|
||||
ECS_SYSTEM(ECS, entityUpdateAnimationState, EcsOnUpdate, Velocity, AnimationType);
|
||||
ECS_SYSTEM(ECS, entityUpdateAnimation, EcsOnUpdate, Animation, TextureRegion);
|
||||
//ECS_SYSTEM(ECS, entityUpdateAnimationState, EcsOnUpdate, Velocity, AnimationType);
|
||||
//ECS_SYSTEM(ECS, entityUpdateAnimation, EcsOnUpdate, Animation, TextureRegion);
|
||||
|
||||
ECS_SYSTEM(ECS, renderDebugPath, EcsOnUpdate, Path);
|
||||
|
||||
@@ -305,7 +305,7 @@ void imguiRender(float dt, void *userData) {
|
||||
igText("Population: %lld", game->resources.pop);
|
||||
}
|
||||
if (igCollapsingHeader_TreeNodeFlags("BuildMenu", 0)) {
|
||||
for (int i = 0; i < BUILDINGS_COUNT; i++) {
|
||||
for (int i = 0; i < BUILDING_COUNT; i++) {
|
||||
if (igSelectable_Bool(getBuildingStr(i), input->building == i, 0, (ImVec2){0, 0}))
|
||||
input->building = i;
|
||||
}
|
||||
|
||||
@@ -31,13 +31,14 @@ bool initEntityObjectsLayer(BzTileMap *map, BzTileObjectGroup *objectGroup) {
|
||||
ecs_entity_t e = createWorker((Position) {object.shape.x, object.shape.y},
|
||||
(Size) {object.shape.sizeX, object.shape.sizeY},
|
||||
game->entityGrid, objectTileset, object.gid);
|
||||
ecs_set(ECS, e, Animation, {
|
||||
/*ecs_set(ECS, e, Animation, {
|
||||
.entityType=ENTITY_WORKER,
|
||||
.tileset = objectTileset,
|
||||
.curFrame=0,
|
||||
.frameDuration=0.6f + (i % 10) * 0.05f,
|
||||
.elapsed=i * 0.1f,
|
||||
});
|
||||
*/
|
||||
bzLogInfo("%d %.2f %.2f", object.gid, object.shape.sizeX, object.shape.sizeY);
|
||||
//EntityArms arms = {
|
||||
// .left=ecs_new_id(ECS),
|
||||
@@ -64,7 +65,7 @@ bool initBuildingsLayer(BzTileMap *map, BzTileLayer *layer) {
|
||||
BzTile buildingRawTile = buildingData[y * layer->width + x];
|
||||
BzTile buildingTile = bzTilesetGetTile(buildingTileset, buildingRawTile);
|
||||
buildingTile = getTileBuilding(buildingTile);
|
||||
if (buildingTile == BUILDINGS_NONE || ownerTile == 0) continue;
|
||||
if (buildingTile == BUILDING_NONE || ownerTile == 0) continue;
|
||||
// We have a building
|
||||
TileSize size = {};
|
||||
getBuildingSize(buildingTile, &size.sizeX, &size.sizeY);
|
||||
@@ -79,9 +80,9 @@ bool initBuildingsLayer(BzTileMap *map, BzTileLayer *layer) {
|
||||
ownerTile = getTileBuilding(ownerTile);
|
||||
ecs_set(ECS, e, Owner, {.playerID=ownerTile});
|
||||
ecs_add_id(ECS, e, Selectable);
|
||||
if (buildingTile == BUILDINGS_WAREHOUSE) {
|
||||
ecs_set(ECS, e, Storage, {});
|
||||
}
|
||||
//if (buildingTile == BUILDINGS_WAREHOUSE) {
|
||||
// ecs_set(ECS, e, Storage, {});
|
||||
//}
|
||||
|
||||
//bzTileMapUpdateCollider(&GAME.map, x, y);
|
||||
}
|
||||
@@ -137,12 +138,14 @@ ecs_entity_t createWorker(Position position, Size size, BzSpatialGrid *grid, BzT
|
||||
ecs_set(ECS, e, Velocity, {});
|
||||
ecs_set(ECS, e, Steering, {});
|
||||
ecs_set(ECS, e, TextureRegion, {tileset->tiles, bzTilesetGetTileRegion(tileset, gid)});
|
||||
/*
|
||||
ecs_set(ECS, e, Animation, {
|
||||
.entityType=ENTITY_WORKER,
|
||||
.tileset = tileset,
|
||||
.curFrame=0,
|
||||
});
|
||||
ecs_set(ECS, e, AnimationType, {ANIM_IDLE});
|
||||
*/
|
||||
ecs_add_id(ECS, e, Selectable);
|
||||
ecs_add_id(ECS, e, Unit);
|
||||
ecs_add_id(ECS, e, Worker);
|
||||
|
||||
@@ -67,6 +67,7 @@ void entityPathRemove(ecs_iter_t *it) {
|
||||
}
|
||||
|
||||
void entitySetAnimationState(ecs_iter_t *it) {
|
||||
/*
|
||||
Animation *anim = ecs_field(it, Animation, 1);
|
||||
AnimationType *animType = ecs_field(it, AnimationType , 2);
|
||||
for (i32 i = 0; i < it->count; i++) {
|
||||
@@ -76,6 +77,7 @@ void entitySetAnimationState(ecs_iter_t *it) {
|
||||
anim[i].animType = type;
|
||||
anim[i].sequence = getEntityAnimation(entityType, type);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void entityUpdateSpatialID(ecs_iter_t *it) {
|
||||
@@ -275,15 +277,18 @@ void entityUpdateAnimationState(ecs_iter_t *it) {
|
||||
for (i32 i = 0; i < it->count; i++) {
|
||||
f32 len = Vector2Length(velocity[i]);
|
||||
|
||||
/*
|
||||
ecs_entity_t entity = it->entities[i];
|
||||
AnimationType type = ANIM_IDLE;
|
||||
if (len > 1.0f)
|
||||
type = ANIM_WALK;
|
||||
|
||||
ecs_set(it->world, entity, AnimationType, {type});
|
||||
*/
|
||||
}
|
||||
}
|
||||
void entityUpdateAnimation(ecs_iter_t *it) {
|
||||
/*
|
||||
Game *game = ecs_singleton_get_mut(ECS, Game);
|
||||
Animation *anim = ecs_field(it, Animation, 1);
|
||||
TextureRegion *t = ecs_field(it, TextureRegion, 2);
|
||||
@@ -301,6 +306,7 @@ void entityUpdateAnimation(ecs_iter_t *it) {
|
||||
t[i].rec = bzTilesetGetTileRegion(anim[i].tileset, tile);
|
||||
anim[i].elapsed = 0.0f;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
static void render(ecs_iter_t *it) {
|
||||
|
||||
@@ -1,263 +0,0 @@
|
||||
#ifndef Buildingtype_H
|
||||
#define Buildingtype_H
|
||||
// This file was generated by: extract_tileset_classes.py
|
||||
|
||||
#include <breeze.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
typedef enum BuildingType {
|
||||
BUILDINGS_NONE,
|
||||
BUILDINGS_KEEP,
|
||||
BUILDINGS_GRANARY,
|
||||
BUILDINGS_ARMORY,
|
||||
BUILDINGS_WAREHOUSE,
|
||||
BUILDINGS_MINE,
|
||||
BUILDINGS_BARACKS,
|
||||
BUILDINGS_ORCHARD,
|
||||
BUILDINGS_ANIMAL_FARM,
|
||||
BUILDINGS_PLAYER_RED,
|
||||
BUILDINGS_FLETCHER,
|
||||
BUILDINGS_PLAYER_BLUE,
|
||||
BUILDINGS_SMITHY,
|
||||
BUILDINGS_WORKSHOP,
|
||||
BUILDINGS_FARM,
|
||||
BUILDINGS_ROAD,
|
||||
BUILDINGS_WALL,
|
||||
BUILDINGS_GATEHOUSE,
|
||||
BUILDINGS_TOWER,
|
||||
BUILDINGS_SMALL_TOWER,
|
||||
BUILDINGS_COUNT
|
||||
} BuildingType;
|
||||
|
||||
|
||||
static BuildingType getTileBuilding(BzTile tile) {
|
||||
switch (tile) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 32:
|
||||
case 33:
|
||||
case 34:
|
||||
case 64:
|
||||
case 65:
|
||||
case 66:
|
||||
return BUILDINGS_KEEP;
|
||||
case 3:
|
||||
return BUILDINGS_GRANARY;
|
||||
case 4:
|
||||
return BUILDINGS_ARMORY;
|
||||
case 5:
|
||||
return BUILDINGS_WAREHOUSE;
|
||||
case 6:
|
||||
case 7:
|
||||
case 38:
|
||||
case 39:
|
||||
return BUILDINGS_MINE;
|
||||
case 8:
|
||||
case 9:
|
||||
case 40:
|
||||
case 41:
|
||||
return BUILDINGS_BARACKS;
|
||||
case 10:
|
||||
case 11:
|
||||
case 42:
|
||||
case 43:
|
||||
return BUILDINGS_ORCHARD;
|
||||
case 12:
|
||||
case 13:
|
||||
case 44:
|
||||
case 45:
|
||||
return BUILDINGS_ANIMAL_FARM;
|
||||
case 31:
|
||||
return BUILDINGS_PLAYER_RED;
|
||||
case 35:
|
||||
case 36:
|
||||
return BUILDINGS_FLETCHER;
|
||||
case 63:
|
||||
return BUILDINGS_PLAYER_BLUE;
|
||||
case 67:
|
||||
case 68:
|
||||
return BUILDINGS_SMITHY;
|
||||
case 72:
|
||||
case 73:
|
||||
return BUILDINGS_WORKSHOP;
|
||||
case 74:
|
||||
return BUILDINGS_FARM;
|
||||
case 96:
|
||||
return BUILDINGS_ROAD;
|
||||
case 97:
|
||||
return BUILDINGS_WALL;
|
||||
case 98:
|
||||
return BUILDINGS_GATEHOUSE;
|
||||
case 128:
|
||||
case 129:
|
||||
case 160:
|
||||
case 161:
|
||||
return BUILDINGS_TOWER;
|
||||
case 130:
|
||||
return BUILDINGS_SMALL_TOWER;
|
||||
default:
|
||||
return BUILDINGS_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
static BzTile getBuildingTile(BuildingType type) {
|
||||
switch (type) {
|
||||
case BUILDINGS_KEEP: return 0;
|
||||
case BUILDINGS_GRANARY: return 3;
|
||||
case BUILDINGS_ARMORY: return 4;
|
||||
case BUILDINGS_WAREHOUSE: return 5;
|
||||
case BUILDINGS_MINE: return 6;
|
||||
case BUILDINGS_BARACKS: return 8;
|
||||
case BUILDINGS_ORCHARD: return 10;
|
||||
case BUILDINGS_ANIMAL_FARM: return 12;
|
||||
case BUILDINGS_PLAYER_RED: return 31;
|
||||
case BUILDINGS_FLETCHER: return 35;
|
||||
case BUILDINGS_PLAYER_BLUE: return 63;
|
||||
case BUILDINGS_SMITHY: return 67;
|
||||
case BUILDINGS_WORKSHOP: return 72;
|
||||
case BUILDINGS_FARM: return 74;
|
||||
case BUILDINGS_ROAD: return 96;
|
||||
case BUILDINGS_WALL: return 97;
|
||||
case BUILDINGS_GATEHOUSE: return 98;
|
||||
case BUILDINGS_TOWER: return 128;
|
||||
case BUILDINGS_SMALL_TOWER: return 130;
|
||||
default: return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static BuildingType getBuildingFromStr(const char *str) {
|
||||
if (strncmp("keep", str, 4) == 0) return BUILDINGS_KEEP;
|
||||
if (strncmp("granary", str, 7) == 0) return BUILDINGS_GRANARY;
|
||||
if (strncmp("armory", str, 6) == 0) return BUILDINGS_ARMORY;
|
||||
if (strncmp("warehouse", str, 9) == 0) return BUILDINGS_WAREHOUSE;
|
||||
if (strncmp("mine", str, 4) == 0) return BUILDINGS_MINE;
|
||||
if (strncmp("baracks", str, 7) == 0) return BUILDINGS_BARACKS;
|
||||
if (strncmp("orchard", str, 7) == 0) return BUILDINGS_ORCHARD;
|
||||
if (strncmp("animal_farm", str, 11) == 0) return BUILDINGS_ANIMAL_FARM;
|
||||
if (strncmp("player_red", str, 10) == 0) return BUILDINGS_PLAYER_RED;
|
||||
if (strncmp("fletcher", str, 8) == 0) return BUILDINGS_FLETCHER;
|
||||
if (strncmp("player_blue", str, 11) == 0) return BUILDINGS_PLAYER_BLUE;
|
||||
if (strncmp("smithy", str, 6) == 0) return BUILDINGS_SMITHY;
|
||||
if (strncmp("workshop", str, 8) == 0) return BUILDINGS_WORKSHOP;
|
||||
if (strncmp("farm", str, 4) == 0) return BUILDINGS_FARM;
|
||||
if (strncmp("road", str, 4) == 0) return BUILDINGS_ROAD;
|
||||
if (strncmp("wall", str, 4) == 0) return BUILDINGS_WALL;
|
||||
if (strncmp("gatehouse", str, 9) == 0) return BUILDINGS_GATEHOUSE;
|
||||
if (strncmp("tower", str, 5) == 0) return BUILDINGS_TOWER;
|
||||
if (strncmp("small_tower", str, 11) == 0) return BUILDINGS_SMALL_TOWER;
|
||||
else return BUILDINGS_NONE;
|
||||
}
|
||||
static const char *getBuildingStr(BuildingType type) {
|
||||
switch (type) {
|
||||
case BUILDINGS_NONE: return "none";
|
||||
case BUILDINGS_KEEP: return "keep";
|
||||
case BUILDINGS_GRANARY: return "granary";
|
||||
case BUILDINGS_ARMORY: return "armory";
|
||||
case BUILDINGS_WAREHOUSE: return "warehouse";
|
||||
case BUILDINGS_MINE: return "mine";
|
||||
case BUILDINGS_BARACKS: return "baracks";
|
||||
case BUILDINGS_ORCHARD: return "orchard";
|
||||
case BUILDINGS_ANIMAL_FARM: return "animal_farm";
|
||||
case BUILDINGS_PLAYER_RED: return "player_red";
|
||||
case BUILDINGS_FLETCHER: return "fletcher";
|
||||
case BUILDINGS_PLAYER_BLUE: return "player_blue";
|
||||
case BUILDINGS_SMITHY: return "smithy";
|
||||
case BUILDINGS_WORKSHOP: return "workshop";
|
||||
case BUILDINGS_FARM: return "farm";
|
||||
case BUILDINGS_ROAD: return "road";
|
||||
case BUILDINGS_WALL: return "wall";
|
||||
case BUILDINGS_GATEHOUSE: return "gatehouse";
|
||||
case BUILDINGS_TOWER: return "tower";
|
||||
case BUILDINGS_SMALL_TOWER: return "small_tower";
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void getBuildingSize(BuildingType type, BzTile *outWidth, BzTile *outHeight) {
|
||||
switch (type) {
|
||||
case BUILDINGS_KEEP:
|
||||
if (outWidth) *outWidth = 3;
|
||||
if (outHeight) *outHeight = 3;
|
||||
break;
|
||||
case BUILDINGS_GRANARY:
|
||||
if (outWidth) *outWidth = 1;
|
||||
if (outHeight) *outHeight = 1;
|
||||
break;
|
||||
case BUILDINGS_ARMORY:
|
||||
if (outWidth) *outWidth = 1;
|
||||
if (outHeight) *outHeight = 1;
|
||||
break;
|
||||
case BUILDINGS_WAREHOUSE:
|
||||
if (outWidth) *outWidth = 1;
|
||||
if (outHeight) *outHeight = 1;
|
||||
break;
|
||||
case BUILDINGS_MINE:
|
||||
if (outWidth) *outWidth = 2;
|
||||
if (outHeight) *outHeight = 2;
|
||||
break;
|
||||
case BUILDINGS_BARACKS:
|
||||
if (outWidth) *outWidth = 2;
|
||||
if (outHeight) *outHeight = 2;
|
||||
break;
|
||||
case BUILDINGS_ORCHARD:
|
||||
if (outWidth) *outWidth = 2;
|
||||
if (outHeight) *outHeight = 2;
|
||||
break;
|
||||
case BUILDINGS_ANIMAL_FARM:
|
||||
if (outWidth) *outWidth = 2;
|
||||
if (outHeight) *outHeight = 2;
|
||||
break;
|
||||
case BUILDINGS_PLAYER_RED:
|
||||
if (outWidth) *outWidth = 1;
|
||||
if (outHeight) *outHeight = 1;
|
||||
break;
|
||||
case BUILDINGS_FLETCHER:
|
||||
if (outWidth) *outWidth = 2;
|
||||
if (outHeight) *outHeight = 1;
|
||||
break;
|
||||
case BUILDINGS_PLAYER_BLUE:
|
||||
if (outWidth) *outWidth = 1;
|
||||
if (outHeight) *outHeight = 1;
|
||||
break;
|
||||
case BUILDINGS_SMITHY:
|
||||
if (outWidth) *outWidth = 2;
|
||||
if (outHeight) *outHeight = 1;
|
||||
break;
|
||||
case BUILDINGS_WORKSHOP:
|
||||
if (outWidth) *outWidth = 2;
|
||||
if (outHeight) *outHeight = 1;
|
||||
break;
|
||||
case BUILDINGS_FARM:
|
||||
if (outWidth) *outWidth = 1;
|
||||
if (outHeight) *outHeight = 1;
|
||||
break;
|
||||
case BUILDINGS_ROAD:
|
||||
if (outWidth) *outWidth = 1;
|
||||
if (outHeight) *outHeight = 1;
|
||||
break;
|
||||
case BUILDINGS_WALL:
|
||||
if (outWidth) *outWidth = 1;
|
||||
if (outHeight) *outHeight = 1;
|
||||
break;
|
||||
case BUILDINGS_GATEHOUSE:
|
||||
if (outWidth) *outWidth = 1;
|
||||
if (outHeight) *outHeight = 1;
|
||||
break;
|
||||
case BUILDINGS_TOWER:
|
||||
if (outWidth) *outWidth = 2;
|
||||
if (outHeight) *outHeight = 2;
|
||||
break;
|
||||
case BUILDINGS_SMALL_TOWER:
|
||||
if (outWidth) *outWidth = 1;
|
||||
if (outHeight) *outHeight = 1;
|
||||
break;
|
||||
default:
|
||||
if (outWidth) *outWidth = 0;
|
||||
if (outHeight) *outHeight = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif //Buildingtype_H
|
||||
@@ -1,47 +0,0 @@
|
||||
#ifndef ENTITY_TYPES
|
||||
#define ENTITY_TYPES
|
||||
|
||||
#include <breeze.h>
|
||||
|
||||
typedef enum EntityType {
|
||||
ENTITY_WORKER = 0,
|
||||
ENTITY_AXE = 64,
|
||||
} EntityType;
|
||||
|
||||
typedef enum AnimationType {
|
||||
ANIM_WALK,
|
||||
ANIM_IDLE,
|
||||
} AnimationType;
|
||||
|
||||
typedef struct AnimationSequence {
|
||||
i32 startFrame;
|
||||
i32 frameCount;
|
||||
} AnimationSequence;
|
||||
|
||||
static bool entityHasAnimation(EntityType entity, AnimationType anim) {
|
||||
switch (entity) {
|
||||
case ENTITY_WORKER: {
|
||||
switch (anim) {
|
||||
case ANIM_IDLE:
|
||||
case ANIM_WALK:
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static AnimationSequence getEntityAnimation(EntityType entity, AnimationType anim) {
|
||||
switch (entity) {
|
||||
case ENTITY_WORKER: {
|
||||
switch (anim) {
|
||||
case ANIM_IDLE: return (AnimationSequence) {0, 2};
|
||||
case ANIM_WALK: return (AnimationSequence) {2, 4};
|
||||
}
|
||||
}
|
||||
}
|
||||
BZ_ASSERT(0);
|
||||
}
|
||||
|
||||
#endif // ENTITY_TYPES
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 366 KiB After Width: | Height: | Size: 366 KiB |
@@ -228,6 +228,11 @@
|
||||
}],
|
||||
"id":27,
|
||||
"properties":[
|
||||
{
|
||||
"name":"animation",
|
||||
"type":"string",
|
||||
"value":"idle"
|
||||
},
|
||||
{
|
||||
"name":"entity",
|
||||
"type":"string",
|
||||
@@ -235,23 +240,6 @@
|
||||
}]
|
||||
},
|
||||
{
|
||||
"animation":[
|
||||
{
|
||||
"duration":160,
|
||||
"tileid":28
|
||||
},
|
||||
{
|
||||
"duration":160,
|
||||
"tileid":29
|
||||
},
|
||||
{
|
||||
"duration":160,
|
||||
"tileid":28
|
||||
},
|
||||
{
|
||||
"duration":100,
|
||||
"tileid":30
|
||||
}],
|
||||
"id":28,
|
||||
"properties":[
|
||||
{
|
||||
@@ -261,8 +249,30 @@
|
||||
}]
|
||||
},
|
||||
{
|
||||
"animation":[
|
||||
{
|
||||
"duration":180,
|
||||
"tileid":29
|
||||
},
|
||||
{
|
||||
"duration":180,
|
||||
"tileid":30
|
||||
},
|
||||
{
|
||||
"duration":180,
|
||||
"tileid":31
|
||||
},
|
||||
{
|
||||
"duration":180,
|
||||
"tileid":30
|
||||
}],
|
||||
"id":29,
|
||||
"properties":[
|
||||
{
|
||||
"name":"animation",
|
||||
"type":"string",
|
||||
"value":"walk"
|
||||
},
|
||||
{
|
||||
"name":"entity",
|
||||
"type":"string",
|
||||
@@ -3176,7 +3186,8 @@
|
||||
"name":"building",
|
||||
"type":"string",
|
||||
"value":""
|
||||
}]
|
||||
}],
|
||||
"type":"keep"
|
||||
},
|
||||
{
|
||||
"id":5893,
|
||||
@@ -3185,7 +3196,8 @@
|
||||
"name":"building",
|
||||
"type":"string",
|
||||
"value":""
|
||||
}]
|
||||
}],
|
||||
"type":"keep"
|
||||
},
|
||||
{
|
||||
"id":5894,
|
||||
@@ -3194,7 +3206,8 @@
|
||||
"name":"building",
|
||||
"type":"string",
|
||||
"value":""
|
||||
}]
|
||||
}],
|
||||
"type":"keep"
|
||||
},
|
||||
{
|
||||
"id":6144,
|
||||
@@ -3239,7 +3252,8 @@
|
||||
"name":"building",
|
||||
"type":"string",
|
||||
"value":""
|
||||
}]
|
||||
}],
|
||||
"type":"keep"
|
||||
},
|
||||
{
|
||||
"id":6149,
|
||||
@@ -3248,7 +3262,8 @@
|
||||
"name":"building",
|
||||
"type":"string",
|
||||
"value":""
|
||||
}]
|
||||
}],
|
||||
"type":"keep"
|
||||
},
|
||||
{
|
||||
"id":6150,
|
||||
@@ -3257,7 +3272,8 @@
|
||||
"name":"building",
|
||||
"type":"string",
|
||||
"value":""
|
||||
}]
|
||||
}],
|
||||
"type":"keep"
|
||||
},
|
||||
{
|
||||
"id":6400,
|
||||
@@ -3302,7 +3318,8 @@
|
||||
"name":"building",
|
||||
"type":"string",
|
||||
"value":""
|
||||
}]
|
||||
}],
|
||||
"type":"keep"
|
||||
},
|
||||
{
|
||||
"id":6405,
|
||||
@@ -3311,7 +3328,8 @@
|
||||
"name":"building",
|
||||
"type":"string",
|
||||
"value":""
|
||||
}]
|
||||
}],
|
||||
"type":"keep"
|
||||
},
|
||||
{
|
||||
"id":6406,
|
||||
@@ -3320,7 +3338,8 @@
|
||||
"name":"building",
|
||||
"type":"string",
|
||||
"value":""
|
||||
}]
|
||||
}],
|
||||
"type":"keep"
|
||||
},
|
||||
{
|
||||
"id":6656,
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tileset version="1.10" tiledversion="1.10.2" name="game" tilewidth="16" tileheight="16" tilecount="65536" columns="256">
|
||||
<editorsettings>
|
||||
<export target="game.tsj" format="json"/>
|
||||
</editorsettings>
|
||||
<image source="game.png" width="4096" height="4096"/>
|
||||
<tile id="0">
|
||||
<properties>
|
||||
@@ -118,6 +121,7 @@
|
||||
</tile>
|
||||
<tile id="27">
|
||||
<properties>
|
||||
<property name="animation" value="idle"/>
|
||||
<property name="entity" value=""/>
|
||||
</properties>
|
||||
<animation>
|
||||
@@ -129,17 +133,18 @@
|
||||
<properties>
|
||||
<property name="entity" value=""/>
|
||||
</properties>
|
||||
<animation>
|
||||
<frame tileid="28" duration="160"/>
|
||||
<frame tileid="29" duration="160"/>
|
||||
<frame tileid="28" duration="160"/>
|
||||
<frame tileid="30" duration="100"/>
|
||||
</animation>
|
||||
</tile>
|
||||
<tile id="29">
|
||||
<properties>
|
||||
<property name="animation" value="walk"/>
|
||||
<property name="entity" value=""/>
|
||||
</properties>
|
||||
<animation>
|
||||
<frame tileid="29" duration="180"/>
|
||||
<frame tileid="30" duration="180"/>
|
||||
<frame tileid="31" duration="180"/>
|
||||
<frame tileid="30" duration="180"/>
|
||||
</animation>
|
||||
</tile>
|
||||
<tile id="30">
|
||||
<properties>
|
||||
@@ -1511,17 +1516,17 @@
|
||||
<property name="terrain" value=""/>
|
||||
</properties>
|
||||
</tile>
|
||||
<tile id="5892">
|
||||
<tile id="5892" type="keep">
|
||||
<properties>
|
||||
<property name="building" value=""/>
|
||||
</properties>
|
||||
</tile>
|
||||
<tile id="5893">
|
||||
<tile id="5893" type="keep">
|
||||
<properties>
|
||||
<property name="building" value=""/>
|
||||
</properties>
|
||||
</tile>
|
||||
<tile id="5894">
|
||||
<tile id="5894" type="keep">
|
||||
<properties>
|
||||
<property name="building" value=""/>
|
||||
</properties>
|
||||
@@ -1546,17 +1551,17 @@
|
||||
<property name="terrain" value=""/>
|
||||
</properties>
|
||||
</tile>
|
||||
<tile id="6148">
|
||||
<tile id="6148" type="keep">
|
||||
<properties>
|
||||
<property name="building" value=""/>
|
||||
</properties>
|
||||
</tile>
|
||||
<tile id="6149">
|
||||
<tile id="6149" type="keep">
|
||||
<properties>
|
||||
<property name="building" value=""/>
|
||||
</properties>
|
||||
</tile>
|
||||
<tile id="6150">
|
||||
<tile id="6150" type="keep">
|
||||
<properties>
|
||||
<property name="building" value=""/>
|
||||
</properties>
|
||||
@@ -1581,17 +1586,17 @@
|
||||
<property name="terrain" value=""/>
|
||||
</properties>
|
||||
</tile>
|
||||
<tile id="6404">
|
||||
<tile id="6404" type="keep">
|
||||
<properties>
|
||||
<property name="building" value=""/>
|
||||
</properties>
|
||||
</tile>
|
||||
<tile id="6405">
|
||||
<tile id="6405" type="keep">
|
||||
<properties>
|
||||
<property name="building" value=""/>
|
||||
</properties>
|
||||
</tile>
|
||||
<tile id="6406">
|
||||
<tile id="6406" type="keep">
|
||||
<properties>
|
||||
<property name="building" value=""/>
|
||||
</properties>
|
||||
|
||||
Reference in New Issue
Block a user