Inspection for Animation component

This commit is contained in:
2024-01-10 16:59:17 +01:00
parent d730d7554b
commit 52cccf4665
5 changed files with 107 additions and 41 deletions

View File

@@ -286,11 +286,6 @@ static BzTileID getBuildingTile(BuildingType type) {
}
}
static BuildingType getBuildingFromStr(const char *str) {
if (strncmp("keep", str, 4) == 0) return BUILDING_KEEP;
return BUILDING_COUNT;
}
static const char *getBuildingStr(BuildingType type) {
switch (type) {
case BUILDING_KEEP: return "keep";
@@ -298,7 +293,7 @@ static const char *getBuildingStr(BuildingType type) {
}
}
static BuildingType getBuildingSize(BuildingType type, BzTileID *outWidth, BzTileID *outHeight) {
static BuildingType getBuildingSize(BuildingType type, i32 *outWidth, i32 *outHeight) {
switch (type) {
case BUILDING_KEEP:
if (outWidth) *outWidth = 3;
@@ -344,6 +339,30 @@ static BzTileID getEntityTile(EntityType type) {
}
}
static const char *getEntityStr(EntityType type) {
switch (type) {
case ENTITY_WORKER: return "worker";
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: