aboutsummaryrefslogtreecommitdiff
path: root/tools/compile_assets/main.odin
diff options
context:
space:
mode:
Diffstat (limited to 'tools/compile_assets/main.odin')
-rw-r--r--tools/compile_assets/main.odin31
1 files changed, 26 insertions, 5 deletions
diff --git a/tools/compile_assets/main.odin b/tools/compile_assets/main.odin
index e33dc37..ea1ff90 100644
--- a/tools/compile_assets/main.odin
+++ b/tools/compile_assets/main.odin
@@ -33,6 +33,9 @@ Room_Id :: enum {
Tileset_Id :: enum {
<tileset-enum>}
+Object_Type :: enum {
+<object-types>}
+
Resource_Id :: union {
Image_Id,
Animation_Id,
@@ -46,8 +49,6 @@ images: [Image_Id]Image_Resource = {
animations: [Animation_Id]Animation_Resource = {
<anim-load>}
-//odinfmt: disable
-
rooms: [Room_Id]Room_Resource = {
<room-load>}
@@ -57,8 +58,6 @@ tilesets: [Tileset_Id]Tileset_Resource = {
tiles: []Tile_Resource = {
<tiles-load>}
-//odinfmt: enable
-
world: []Room_Position_Resource = {
<room-positions>}
@@ -79,6 +78,9 @@ tilesets: map[string]string
world: [dynamic]string
+// Don't want to add types multiple times, so it's a set
+object_type_names: map[string]struct{}
+
output_dir: string
paths_to_res_type: map[string]string
@@ -355,6 +357,26 @@ main :: proc() {
}
content = set_placeholder(content, "<resource-paths>", res_paths)
+ object_type_enum := ""
+
+ for object_type in object_type_names {
+ object_type_enum = strings.concatenate({
+ object_type_enum,
+ " ",
+ object_type,
+ ",\n"
+ }, allocator = context.temp_allocator)
+
+ delete(object_type)
+ }
+
+ content, _ = strings.replace_all(
+ content,
+ "<object-types>",
+ object_type_enum,
+ allocator = context.temp_allocator,
+ )
+
os.write_string(output_file, content)
for image in images {
@@ -369,4 +391,3 @@ main :: proc() {
free_all(context.temp_allocator)
}
-