Update tileset to use BzTileID
This commit is contained in:
@@ -7,12 +7,12 @@
|
||||
#include <string.h>
|
||||
|
||||
typedef struct AnimationSequence {
|
||||
BzTile startFrame;
|
||||
BzTileID startFrame;
|
||||
i32 frameCount;
|
||||
} AnimationSequence;
|
||||
|
||||
typedef struct AnimationFrame {
|
||||
BzTile frame;
|
||||
BzTileID frame;
|
||||
f32 duration;
|
||||
} AnimationFrame;
|
||||
|
||||
@@ -21,7 +21,7 @@ typedef enum TerrainType {
|
||||
TERRAIN_NONE,
|
||||
} TerrainType;
|
||||
|
||||
static bool terrainHasAnimation(BzTile tile) {
|
||||
static bool terrainHasAnimation(BzTileID tile) {
|
||||
switch (tile) {
|
||||
case 1792:
|
||||
case 1793:
|
||||
@@ -99,7 +99,7 @@ static bool terrainHasAnimation(BzTile tile) {
|
||||
}
|
||||
}
|
||||
|
||||
static AnimationSequence terrainGetAnimationSequence(BzTile tile) {
|
||||
static AnimationSequence terrainGetAnimationSequence(BzTileID tile) {
|
||||
switch (tile) {
|
||||
case 1792: return (AnimationSequence) {.startFrame = 1792, .frameCount = 4};
|
||||
case 1793: return (AnimationSequence) {.startFrame = 1793, .frameCount = 4};
|
||||
@@ -177,7 +177,7 @@ static AnimationSequence terrainGetAnimationSequence(BzTile tile) {
|
||||
}
|
||||
}
|
||||
|
||||
static AnimationFrame terrainGetAnimationFrame(BzTile tile, i32 frameIdx) {
|
||||
static AnimationFrame terrainGetAnimationFrame(BzTileID 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];
|
||||
@@ -262,7 +262,7 @@ typedef enum BuildingType {
|
||||
BUILDING_NONE,
|
||||
} BuildingType;
|
||||
|
||||
static BuildingType getTileBuilding(BzTile tile) {
|
||||
static BuildingType getTileBuilding(BzTileID tile) {
|
||||
switch (tile) {
|
||||
case 5892:
|
||||
case 5893:
|
||||
@@ -298,7 +298,7 @@ static const char *getBuildingStr(BuildingType type) {
|
||||
}
|
||||
}
|
||||
|
||||
static BuildingType getBuildingSize(BuildingType type, BzTile *outWidth, BzTile *outHeight) {
|
||||
static BuildingType getBuildingSize(BuildingType type, BzTileID *outWidth, BzTileID *outHeight) {
|
||||
switch (type) {
|
||||
case BUILDING_KEEP:
|
||||
if (outWidth) *outWidth = 3;
|
||||
|
||||
@@ -25,7 +25,7 @@ class ExtractFileWriter:
|
||||
def output_anim_sequence_struct(self):
|
||||
self.output("typedef struct AnimationSequence {\n")
|
||||
self.indent()
|
||||
self.output("BzTile startFrame;\n")
|
||||
self.output("BzTileID startFrame;\n")
|
||||
self.output("i32 frameCount;\n")
|
||||
self.unindent()
|
||||
self.output("} AnimationSequence;\n")
|
||||
@@ -34,7 +34,7 @@ class ExtractFileWriter:
|
||||
def output_anim_frame_struct(self):
|
||||
self.output("typedef struct AnimationFrame {\n")
|
||||
self.indent()
|
||||
self.output("BzTile frame;\n")
|
||||
self.output("BzTileID frame;\n")
|
||||
self.output("f32 duration;\n")
|
||||
self.unindent()
|
||||
self.output("} AnimationFrame;\n")
|
||||
@@ -123,7 +123,7 @@ class EnumWriter:
|
||||
|
||||
def output_tile_to_enum(self, func_name):
|
||||
writer = self.writer
|
||||
writer.output(f"static {self.enum_type} {func_name}(BzTile tile) ")
|
||||
writer.output(f"static {self.enum_type} {func_name}(BzTileID tile) ")
|
||||
writer.block_start()
|
||||
|
||||
writer.output("switch (tile) ")
|
||||
@@ -189,7 +189,7 @@ class EnumWriter:
|
||||
def output_enum_tile_size(self, func_name):
|
||||
writer = self.writer
|
||||
writer.output(
|
||||
f"static {self.enum_type} {func_name}({self.enum_type} type, BzTile *outWidth, BzTile *outHeight) ")
|
||||
f"static {self.enum_type} {func_name}({self.enum_type} type, BzTileID *outWidth, BzTileID *outHeight) ")
|
||||
writer.block_start()
|
||||
|
||||
writer.output("switch (type) ")
|
||||
@@ -223,7 +223,7 @@ class EnumWriter:
|
||||
|
||||
def output_tile_has_anim(self, func_name):
|
||||
writer = self.writer
|
||||
writer.output(f"static bool {func_name}(BzTile tile) ")
|
||||
writer.output(f"static bool {func_name}(BzTileID tile) ")
|
||||
writer.block_start()
|
||||
|
||||
writer.output("switch (tile) ")
|
||||
@@ -245,7 +245,7 @@ class EnumWriter:
|
||||
|
||||
def output_tile_anim_sequence(self, func_name):
|
||||
writer = self.writer
|
||||
writer.output(f"static AnimationSequence {func_name}(BzTile tile) ")
|
||||
writer.output(f"static AnimationSequence {func_name}(BzTileID tile) ")
|
||||
writer.block_start()
|
||||
|
||||
writer.output("switch (tile) ")
|
||||
@@ -269,7 +269,7 @@ class EnumWriter:
|
||||
|
||||
def output_tile_anim_frame(self, func_name):
|
||||
writer = self.writer
|
||||
writer.output(f"static AnimationFrame {func_name}(BzTile tile, i32 frameIdx) ")
|
||||
writer.output(f"static AnimationFrame {func_name}(BzTileID tile, i32 frameIdx) ")
|
||||
writer.block_start()
|
||||
|
||||
writer.output("switch (tile) ")
|
||||
|
||||
Reference in New Issue
Block a user