summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2025-07-17 16:27:28 -0700
committer3gg <3gg@shellblade.net>2025-07-17 16:27:28 -0700
commit18e0598ad1e664f7dfd0bb077a50ee45101a9ce8 (patch)
treec0262add91f0f3a2dcbe0362996c4e1d27064163
parent129fbdadc3a8e7ec2971fab893259802498f228a (diff)
Add some TODOs
-rw-r--r--demos/isomap/isomap.c6
-rw-r--r--src/isogfx.c2
-rw-r--r--tools/mkasset.py18
3 files changed, 17 insertions, 9 deletions
diff --git a/demos/isomap/isomap.c b/demos/isomap/isomap.c
index 5adf6f1..b328bfa 100644
--- a/demos/isomap/isomap.c
+++ b/demos/isomap/isomap.c
@@ -36,12 +36,14 @@ static bool init(GfxAppState* state, int argc, const char** argv) {
36 36
37 isogfx_resize(iso, SCREEN_WIDTH, SCREEN_HEIGHT); 37 isogfx_resize(iso, SCREEN_WIDTH, SCREEN_HEIGHT);
38 38
39 if (!isogfx_load_world(iso, "/home/jeanne/assets/tilemaps/demo1.tm")) { 39 if (!isogfx_load_world(iso, "/home/jeanne/Nextcloud/assets/maps/demo-1.tm")) {
40 return false; 40 return false;
41 } 41 }
42 42
43 if (!isogfx_load_sprite_sheet( 43 if (!isogfx_load_sprite_sheet(
44 iso, "/home/jeanne/assets/tilesets/scrabling/critters/stag/stag.ss", 44 iso,
45 "/home/jeanne/Nextcloud/assets/tilesets/scrabling/critters/stag/"
46 "stag.ss",
45 &state->stag_sheet)) { 47 &state->stag_sheet)) {
46 return false; 48 return false;
47 } 49 }
diff --git a/src/isogfx.c b/src/isogfx.c
index 53a6650..4dff67b 100644
--- a/src/isogfx.c
+++ b/src/isogfx.c
@@ -338,12 +338,14 @@ bool isogfx_load_world(IsoGfx* iso, const char* filepath) {
338 338
339 Ts_TileSet* tileset = read_file(ts_path_cwd); 339 Ts_TileSet* tileset = read_file(ts_path_cwd);
340 if (!tileset) { 340 if (!tileset) {
341 // TODO: Log errors using the log library.
341 goto cleanup; 342 goto cleanup;
342 }; 343 };
343 344
344 // Load tile data. 345 // Load tile data.
345 const Ts_Tile* tile = &tileset->tiles[0]; 346 const Ts_Tile* tile = &tileset->tiles[0];
346 for (uint16_t j = 0; j < tileset->num_tiles; ++j) { 347 for (uint16_t j = 0; j < tileset->num_tiles; ++j) {
348 // TODO: These checks should be library runtime errors.
347 // Tile dimensions should be a multiple of the base tile size. 349 // Tile dimensions should be a multiple of the base tile size.
348 assert((tile->width % map->base_tile_width) == 0); 350 assert((tile->width % map->base_tile_width) == 0);
349 assert((tile->height % map->base_tile_height) == 0); 351 assert((tile->height % map->base_tile_height) == 0);
diff --git a/tools/mkasset.py b/tools/mkasset.py
index 3ca8a1d..fd2ead7 100644
--- a/tools/mkasset.py
+++ b/tools/mkasset.py
@@ -12,11 +12,11 @@
12# 12#
13import argparse 13import argparse
14import ctypes 14import ctypes
15import os
16from PIL import Image
17import sys 15import sys
18from xml.etree import ElementTree 16from xml.etree import ElementTree
19 17
18from PIL import Image
19
20# Maximum length of path strings in .TS and .TM files. 20# Maximum length of path strings in .TS and .TM files.
21# Must match the engine's value. 21# Must match the engine's value.
22MAX_PATH_LENGTH = 128 22MAX_PATH_LENGTH = 128
@@ -291,20 +291,24 @@ def convert_sprite_sheet(input_file_paths, sprite_width, sprite_height,
291 291
292 292
293def main(): 293def main():
294 # TODO: Use subparser for each type of input file.
294 parser = argparse.ArgumentParser() 295 parser = argparse.ArgumentParser()
295 parser.add_argument("input", 296 parser.add_argument("input",
296 nargs="+", 297 nargs="+",
297 help="Input file (.tsx, .tmx) or path regex (sprite sheets)") 298 help="Input file (.tsx, .tmx) or path regex (sprite sheets)")
298 parser.add_argument("--width", type=int, help="Sprite width in pixels") 299 parser.add_argument("-W", "--width", type=int, help="Sprite width in pixels")
299 parser.add_argument("--height", type=int, help="Sprite height in pixels") 300 parser.add_argument("-H", "--height", type=int, help="Sprite height in pixels")
300 parser.add_argument("--out", help="Output file (sprite sheets)") 301 parser.add_argument("-o", "--out", help="Output file (sprite sheets)")
301 args = parser.parse_args() 302 args = parser.parse_args()
302 303
303 if ".tsx" in args.input: 304 # TODO: Add support for TSX files made from a single image. Currently, only collections are supported.
305 if ".tsx" in args.input[0]:
306 args.input = args.input[0] # TODO: Remove this.
304 output_filepath_no_ext = drop_extension(args.input) 307 output_filepath_no_ext = drop_extension(args.input)
305 output_filepath = output_filepath_no_ext + ".ts" 308 output_filepath = output_filepath_no_ext + ".ts"
306 convert_tsx(args.input, output_filepath) 309 convert_tsx(args.input, output_filepath)
307 elif ".tmx" in args.input: 310 elif ".tmx" in args.input[0]:
311 args.input = args.input[0] # TODO: Remove this.
308 output_filepath_no_ext = drop_extension(args.input) 312 output_filepath_no_ext = drop_extension(args.input)
309 output_filepath = output_filepath_no_ext + ".tm" 313 output_filepath = output_filepath_no_ext + ".tm"
310 convert_tmx(args.input, output_filepath) 314 convert_tmx(args.input, output_filepath)