diff options
author | zlago | 2024-09-26 10:51:02 +0200 |
---|---|---|
committer | zlago | 2024-09-26 10:56:35 +0200 |
commit | ba5b241f672cce00d1fe9521da445aa8d7f918b0 (patch) | |
tree | 9a18c2f6b714d8b43c30c81b54bb800667706600 /utl/json2map | |
parent | 9942429dbb83fed5532c070f8afe41d6ddcd66d2 (diff) |
asset pipeline
Diffstat (limited to 'utl/json2map')
-rw-r--r-- | utl/json2map/main.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/utl/json2map/main.c b/utl/json2map/main.c index 3bc7ba4..f3e7716 100644 --- a/utl/json2map/main.c +++ b/utl/json2map/main.c @@ -49,7 +49,7 @@ struct tilemap_T make_tilemap(cJSON const *const layer, int const wangStart, int } struct tilemap_T out = {.tilemap = NULL, .width = width - 1, .height = height - 1}; out.tilemap = malloc(out.width * out.height * sizeof (int)); - printf("=== tilemap (%d tiles) ===\n", size); + //printf("=== tilemap (%d tiles) ===\n", size); for (int y = 0; y < out.height; y++) { for (int x = 0; x < out.width; x++) { int a = in.tilemap[x + y * in.width]; @@ -122,12 +122,12 @@ int main(int argc, char **argv) { struct sets counts = {0, 0}; cJSON_ArrayForEach(tileset, tilesets) { - printf("=== tileset (%% tiles) ===\n"); + //printf("=== tileset (%% tiles) ===\n"); cJSON const *wangs = cJSON_GetObjectItemCaseSensitive(tileset, "wangsets"); if (wangs != NULL) { cJSON const *wang = NULL; cJSON_ArrayForEach(wang, wangs) { - puts("=== wang ==="); + //puts("=== wang ==="); cJSON const *type = cJSON_GetObjectItemCaseSensitive(wang, "type"); if (strcmp("corner", type->valuestring) == 0) { if (wangStart != 0) { @@ -148,7 +148,7 @@ int main(int argc, char **argv) { default: goto end; } - printf("=== wang %u-%u ===\n", wangStart, wangStart + wangSize); + //printf("=== wang %u-%u ===\n", wangStart, wangStart + wangSize); counts.wang_count++; goto wang_continue; } @@ -176,11 +176,11 @@ int main(int argc, char **argv) { memcpy(tilesets_data + tilesets_size, &height, sizeof (uint32_t)); memcpy(tilesets_data + tilesets_size + sizeof (uint32_t), str + start, length); tilesets_data[tilesets_size + sizeof (uint32_t) + length] = 0; - puts(tilesets_data + tilesets_size + sizeof (uint32_t)); + //puts(tilesets_data + tilesets_size + sizeof (uint32_t)); tilesets_size += length + sizeof (uint32_t) + 1; counts.tilesets_count++; } - puts(image->valuestring); + //puts(image->valuestring); #if 0 char *str = cJSON_Print(tileset); puts(str); @@ -207,7 +207,7 @@ int main(int argc, char **argv) { wang_tileset = malloc(length + 1); memcpy(wang_tileset, str + start, length); wang_tileset[length] = 0; - puts(wang_tileset); + //puts(wang_tileset); } cJSON const *width_obj = cJSON_GetObjectItemCaseSensitive(json, "width"); @@ -233,7 +233,7 @@ int main(int argc, char **argv) { goto end; } char const *type = type_obj->valuestring; - puts(type); + //puts(type); if (strcmp(type, "group") == 0) { // group layer cJSON const *sublayers = cJSON_GetObjectItemCaseSensitive(layer, "layers"); @@ -261,9 +261,9 @@ int main(int argc, char **argv) { } for (int y = 0; y < layert.height; y++) { for (int x = 0; x < layert.width; x++) { - printf("%2x,", layert.tilemap[x + y * layert.width]); + //printf("%2x,", layert.tilemap[x + y * layert.width]); } - fputc('\n', stdout); + //fputc('\n', stdout); } size_t const layer_size = map.width * map.height; @@ -283,7 +283,7 @@ int main(int argc, char **argv) { if (cJSON_IsNumber(parallax)) { py = parallax->valuedouble; } - printf("parallax: %fx%f\n", px, py); + //printf("parallax: %f %f\n", px, py); parallaxes[map.layers * 2 + 0] = px; parallaxes[map.layers * 2 + 1] = py; @@ -298,9 +298,9 @@ int main(int argc, char **argv) { } for (int y = 0; y < tilemap.height; y++) { for (int x = 0; x < tilemap.width; x++) { - printf("%2x,", tilemap.tilemap[x + y * tilemap.width]); + //printf("%2x,", tilemap.tilemap[x + y * tilemap.width]); } - fputc('\n', stdout); + //fputc('\n', stdout); } size_t const layer_size = map.width * map.height; @@ -320,7 +320,7 @@ int main(int argc, char **argv) { if (cJSON_IsNumber(parallax)) { py = parallax->valuedouble; } - printf("parallax: %fx%f\n", px, py); + //printf("parallax: %fx%f\n", px, py); parallaxes[map.layers * 2 + 0] = px; parallaxes[map.layers * 2 + 1] = py; |