diff options
| -rw-r--r-- | demos/isomap/isomap.c | 6 | ||||
| -rw-r--r-- | src/isogfx.c | 2 | ||||
| -rw-r--r-- | tools/mkasset.py | 18 |
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 | # |
| 13 | import argparse | 13 | import argparse |
| 14 | import ctypes | 14 | import ctypes |
| 15 | import os | ||
| 16 | from PIL import Image | ||
| 17 | import sys | 15 | import sys |
| 18 | from xml.etree import ElementTree | 16 | from xml.etree import ElementTree |
| 19 | 17 | ||
| 18 | from 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. |
| 22 | MAX_PATH_LENGTH = 128 | 22 | MAX_PATH_LENGTH = 128 |
| @@ -291,20 +291,24 @@ def convert_sprite_sheet(input_file_paths, sprite_width, sprite_height, | |||
| 291 | 291 | ||
| 292 | 292 | ||
| 293 | def main(): | 293 | def 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) |
