diff options
-rw-r--r-- | configure.ac | 11 | ||||
-rw-r--r-- | src/area.c | 4 | ||||
-rw-r--r-- | src/base64.c | 35 | ||||
-rw-r--r-- | src/compression.c | 168 | ||||
-rw-r--r-- | src/main.c | 14 |
5 files changed, 15 insertions, 217 deletions
diff --git a/configure.ac b/configure.ac index 6b735f5..16e4ced 100644 --- a/configure.ac +++ b/configure.ac @@ -62,6 +62,17 @@ if test "x$enable_debug_compression" = "xyes"; then [Define to 1 to enable debug output from tile data inflation]) fi +AC_ARG_ENABLE([debug-render], + [AC_HELP_STRING([--enable-debug-render], + [enable debug output from map layer blits and area rendering])], + [enable_debug_render=yes], + []) +if test "x$enable_debug_render" = "xyes"; then + AC_DEFINE([DEBUG_RENDER], [1], + [Define to 1 to enable debug output from map layer blits and + area rendering]) +fi + AC_CONFIG_FILES([Makefile]) AC_CONFIG_HEADERS([config.h]) AC_OUTPUT() @@ -99,7 +99,7 @@ blit_map_layer(struct area *area, enum map_layer map_layer, layerrect.h = mts->tileset->tileheight; layerrect.x *= layerrect.w; layerrect.y *= layerrect.h; -#if 0 +#ifdef DEBUG_RENDER debug("Blitting %dx%d tile at (%d,%d) " "onto layer at (%d,%d)...", tilerect.w, tilerect.h, @@ -171,7 +171,7 @@ render_area_to_surface(struct area *area, SDL_Rect *arearect, dstrect.y = surfacerect->y - arearect->y; } -#if 0 +#ifdef DEBUG_RENDER debug("Rendering %dx%d area rect at (%d,%d) " "onto %dx%d surface rect at (%d,%d)...", srcrect.w, srcrect.h, srcrect.x, srcrect.y, diff --git a/src/base64.c b/src/base64.c index d8f5669..64537ef 100644 --- a/src/base64.c +++ b/src/base64.c @@ -59,38 +59,3 @@ base64_decode(const char *src, char *dest, size_t dest_len) /* Ensure NUL termination. */ dest[dest_len - 1] = '\0'; } - -#if 0 -int -main() -{ - char dest[1024]; - base64_decode( - "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5v" - "dCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1" - "dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Np" - "b24gZnJvbSBvdGhlciBhbmltYWxzLCB3" - "aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1p" - "bmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFu" - "Y2Ugb2YgZGVsaWdodCBpbiB0aGUgY29u" - "dGludWVkIGFuZCBpbmRlZmF0aWdhYmxl" - "IGdlbmVyYXRpb24gb2Yga25vd2xlZGdl" - "LCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhl" - "bWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVh" - "c3VyZS4=", dest, 1024); - printf("Decoded string: \"%s\"\n", dest); - base64_decode("YW55IGNhcm5hbCBwbGVhc3VyZS4=", dest, 1024); - printf("Decoded string: \"%s\"\n", dest); - base64_decode("YW55IGNhcm5hbCBwbGVhc3VyZQ==", dest, 1024); - printf("Decoded string: \"%s\"\n", dest); - base64_decode("YW55IGNhcm5hbCBwbGVhc3Vy", dest, 1024); - printf("Decoded string: \"%s\"\n", dest); - base64_decode("YW55IGNhcm5hbCBwbGVhc3U=", dest, 1024); - printf("Decoded string: \"%s\"\n", dest); - base64_decode("YW55IGNhcm5hbCBwbGVhcw==", dest, 1024); - printf("Decoded string: \"%s\"\n", dest); - base64_decode("YW55IGNhcm5hbCBwbGVhcw==", dest, 4); - printf("Decoded string: \"%s\"\n", dest); - return 0; -} -#endif diff --git a/src/compression.c b/src/compression.c index b7c8307..fcec2b4 100644 --- a/src/compression.c +++ b/src/compression.c @@ -64,171 +64,3 @@ decompress(char *src, size_t src_len, char *dest, size_t dest_len) #endif zlib_err(inflateEnd(&d_stream)); } - -#if 0 -#include <stdio.h> -#include "base64.h" - -int -main() -{ - char decoded_data[4801], compressed_data[4801], decompressed_data[4801]; - - base64_decode( - "TwAAAFAAAABPAAAAUAAAAE8AAABQAAAATwAAAFAAAABPAAAA" - "UAAAAE8AAABQAAAATwAAAFAAAAAcAAAAHQAAAB0AAAAeAAAA" - "TwAAAFAA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gAAAATwAAAFAAAAAcAAAA" - "HQAAAB0AAAAdAAAAHQAAAB0AAAAdAAAAHQAAAB0AAAAdAAAA" - "HQAAAB0AAAAdAAAAHQAAAB0AAAAeAAAATwAAAFAAAABPAAAA" - "UAAAABwAAAAdAAAAHQAAAB4AAABPAAAAUAAAAE8AAABQAAAA" - "XwAAAGAAAAAsAAAALQAAAC0AAAAtAAAALQAAAC0AAAAtAAAA" - "LQAAAC0AAAAtAAAALQAAAC0AAAAtAAAALQAAAC0AAAAuAAAA" - "XwAAAGAAAABfAAAAYAAAABwAAAAdAAAAHQAAAB4AAABfAAAA" - "YAAAAF8AAABgAAAATwAAAFAAAABPAAAAUAAAAE8AAABQAAAA" - "TwAAAFAAAABPAAAAUAAAAE8AAABQAAAATwAAAFAAAABPAAAA" - "UAAAAE8AAABQAAAATwAAAFAAAABPAAAAUAAAABwAAAAdAAAA" - "HQAAAB4AAABPAAAAUAAAAE8AAABQAAAAXwAAAGAAAABfAAAA" - "YAAAAF8AAABgAAAAXwAAAGAAAABfAAAAYAAAAF8AAABgAAAA" - "XwAAAGAAAABfAAAAYAAAAF8AAABgAAAAXwAAAGAAAABfAAAA" - "YAAAABwAAAAdAAAAHQAAAB4AAABfAAAAYAAAAF8AAABgAAAA" - "TwAAAFAAAABPAAAAUAAAAE8AAABQAAAATwAAAFAAAABPAAAA" - "UAAAAE8AAABQAAAATwAAAFAAAABPAAAAUAAAAE8AAABQAAAA" - "TwAAAFAAAABPAAAAUAAAABwAAAAdAAAAHQAAAB4AAABPAAAA" - "UAAAAE8AAABQAAAAXwAAAGAAAABfAAAAYAAAAF8AAABgAAAA" - "XwAAAGAAAABfAAAAYAAAAF8AAABgAAAAXwAAAGAAAABfAAAA" - "YAAAAF8AAABgAAAAXwAAAGAAAABfAAAAYAAAABwAAAAdAAAA" - "HQAAAB4AAABfAAAAYAAAAF8AAABgAAAATwAAAFAAAABPAAAA" - "UAAAAE8AAABQAAAATwAAAFAAAABPAAAAUAAAAE8AAABQAAAA" - "TwAAAFAAAABPAAAAUAAAAE8AAABQAAAADAAAAA0AAAANAAAA" - "DQAAAG8AAAAdAAAAHQAAAB4AAABPAAAAUAAAAE8AAABQAAAA" - "XwAAAGAAAABfAAAAYAAAAF8AAABgAAAAXwAAAGAAAABfAAAA" - "YAAAAF8AAABgAAAAXwAAAGAAAABfAAAAYAAAAF8AAABgAAAA" - "HAAAAB0AAAAdAAAAHQAAAB0AAAAdAAAAHQAAAB4AAABfAAAA" - "YAAAAF8AAABgAAAATwAAAFAAAABPAAAAUAAAAE8AAABQAAAA" - "TwAAAFAAAABPAAAAUAAAAE8AAABQAAAATwAAAFAAAABPAAAA" - "UAAAAE8AAABQAAAAHAAAAB0AAAAdAAAAHQAAAB0AAAAdAAAA" - "HQAAAB4AAABPAAAAUAAAAE8AAABQAAAAXwAAAGAAAABfAAAA" - "YAAAAF8AAABgAAAAXwAAAGAAAABfAAAAYAAAAF8AAABgAAAA" - "XwAAAGAAAABfAAAAYAAAAF8AAABgAAAAHAAAAB0AAAAdAAAA" - "gAAAAC0AAAAtAAAALQAAAC4AAABfAAAAYAAAAF8AAABgAAAA" - "TwAAAFAAAABPAAAAUAAAAE8AAABQAAAATwAAAFAAAABPAAAA" - "UAAAAE8AAABQAAAATwAAAFAAAABPAAAAUAAAAE8AAABQAAAA" - "HAAAAB0AAAAdAAAAHgAAAE8AAABQAAAATwAAAFAAAABPAAAA" - "UAAAAE8AAABQAAAAXwAAAGAAAABfAAAAYAAAAF8AAABgAAAA" - "XwAAAGAAAABfAAAAYAAAAF8AAABgAAAAXwAAAGAAAABfAAAA" - "YAAAAF8AAABgAAAAHAAAAB0AAAAdAAAAHgAAAF8AAABgAAAA" - "XwAAAGAAAABfAAAAYAAAAF8AAABgAAAATwAAAFAAAABPAAAA" - "UAAAAE8AAABQAAAATwAAAFAAAABPAAAAUAAAAE8AAABQAAAA" - "TwAAAFAAAABPAAAAUAAAAE8AAABQAAAAHAAAAB0AAAAdAAAA" - "HgAAAE8AAABQAAAATwAAAFAAAABPAAAAUAAAAE8AAABQAAAA" - "XwAAAGAAAABfAAAAYAAAAF8AAABgAAAAXwAAAGAAAABfAAAA" - "YAAAAF8AAABgAAAAXwAAAGAAAABfAAAAYAAAAF8AAABgAAAA" - "HAAAAB0AAAAdAAAAHgAAAF8AAABgAAAAXwAAAGAAAABfAAAA" - "YAAAAF8AAABgAAAA", - decoded_data, 4801); - base64_decode( - "eJztlsERAjEIRSlArUCtwLWVtQPtQDtwS18OHpwdIvwv7EFz" - "+MMhkyEvgR9GEbmoRjDuVYeXjsT+q+pGxGVedD96zl/n3ai2" - "hu7FvO9cLVXwRvNW8k6qwdC5mJfhyuBl3rHzdl6Et+VjlnaJ" - "vBE/+XRPrA+jeVu8qA97PvYM8qI+7NW5t876sFfn3jrbpxW8" - "kT7tvN/zPsT3IG++YnhRZfEyeVnek9g9G5E1X0V5s2OUNzt2" - "3hre5f/t9XcFHzJvZL4nMm9k8k7i9/da9bsGb+Q/+zfeGUt8" - "RgE=", - compressed_data, 4801); - decompress(compressed_data, decompressed_data, 4801); - decoded_data[4800] = '\0'; - compressed_data[4800] = '\0'; - decompressed_data[4800] = '\0'; - if (strncmp(decoded_data, decompressed_data, 4800) == 0) { - puts("Matched!"); - } else { - puts("No match. :("); - } - - return 0; -} -#endif @@ -21,12 +21,9 @@ main(void) { struct viewport *vp; struct map *map; -#if 0 - struct map_tileset *ts; - struct map_exit *e; -#endif struct area *a; SDL_Color colors[256]; + struct map_exit *e; int i; Uint32 start, end; int x, y; @@ -54,14 +51,8 @@ main(void) warn("Failed to set palette"); }*/ -#if 0 - debug("Map dimensions: %dx%d", map->width, map->height); - for (ts = map->tilesets_head; ts != NULL; ts = ts->next) { - debug("Tileset name: %s", ts->tileset->name); - debug("Tileset firstgid: %d", ts->firstgid); - } for (e = map->map_exits_head; e != NULL; e = e->next) { - debug("Exit target (size %dx%d) at (%d,%d) " + debug("Map exit (size %dx%d) at (%d,%d) " "to map %s (size %dx%d) at (%d,%d)", e->width, e->height, e->x, e->y, @@ -69,7 +60,6 @@ main(void) e->target_map->width, e->target_map->height, e->target_x_coord, e->target_y_coord); } -#endif /* Demo */ i = 0; |