From: sparky4 Date: Tue, 2 Jun 2015 18:14:22 +0000 (-0500) Subject: reading huge map files.... X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=f3bbcfd3ec2b32ef11103e99445f7f0ed8ab45f1;p=16.git reading huge map files.... modified: makefile new file: maptest0.exe new file: maptest0.out modified: src/lib/mapread.h new file: src/maptest0.c --- diff --git a/makefile b/makefile index 2eae139f..1b142a0f 100644 --- a/makefile +++ b/makefile @@ -11,7 +11,7 @@ SRC=src$(DIRSEP) SRCLIB=$(SRC)lib$(DIRSEP) JSMNLIB=$(SRCLIB)jsmn$(DIRSEP) -all: test.exe pcxtest.exe test2.exe scroll.exe maptest.exe +all: test.exe pcxtest.exe test2.exe scroll.exe maptest.exe maptest0.exe scroll.exe: scroll.obj modex16.obj dos_kb.obj bitmap.obj mapread.obj jsmn.obj lib_head.obj wcl $(FLAGS) scroll.obj modex16.obj dos_kb.obj bitmap.obj mapread.obj jsmn.obj lib_head.obj# 16/lib/x/modex.lib @@ -28,7 +28,9 @@ pcxtest.exe: pcxtest.obj modex16.obj bitmap.obj lib_head.obj maptest.exe: maptest.obj mapread.obj jsmn.obj modex16.obj bitmap.obj lib_head.obj wcl $(FLAGS) maptest.obj mapread.obj jsmn.obj modex16.obj bitmap.obj lib_head.obj - + +maptest0.exe: maptest0.obj mapread.obj jsmn.obj modex16.obj bitmap.obj lib_head.obj + wcl $(FLAGS) maptest0.obj mapread.obj jsmn.obj modex16.obj bitmap.obj lib_head.obj test.obj: $(SRC)test.c $(SRCLIB)modex16.h wcl $(FLAGS) -c $(SRC)test.c @@ -40,7 +42,10 @@ pcxtest.obj: $(SRC)pcxtest.c $(SRCLIB)modex16.h wcl $(FLAGS) -c $(SRC)pcxtest.c maptest.obj: $(SRC)maptest.c $(SRCLIB)modex16.h - wcl $(FLAGS) -c $(SRC)maptest.c + wcl $(FLAGS) -c $(SRC)maptest.c + +maptest0.obj: $(SRC)maptest0.c $(SRCLIB)modex16.h + wcl $(FLAGS) -c $(SRC)maptest0.c modex16.obj: $(SRCLIB)modex16.h $(SRCLIB)modex16.c diff --git a/maptest0.exe b/maptest0.exe new file mode 100644 index 00000000..2fc0e966 Binary files /dev/null and b/maptest0.exe differ diff --git a/maptest0.out b/maptest0.out new file mode 100644 index 00000000..e69de29b diff --git a/src/lib/mapread.h b/src/lib/mapread.h index fbc8e213..58769d5d 100644 --- a/src/lib/mapread.h +++ b/src/lib/mapread.h @@ -10,10 +10,10 @@ #include "src/lib/modex16.h" #include "src/lib/lib_head.h" -//#define DEBUG_MAPDATA -//#define DEBUG_MAPVAR -//#define DEBUG_DUMPVARS -//#define DEBUG_JS +#define DEBUG_MAPDATA +#define DEBUG_MAPVAR +#define DEBUG_DUMPVARS +#define DEBUG_JS typedef struct { bitmap_t *data; diff --git a/src/maptest0.c b/src/maptest0.c new file mode 100644 index 00000000..244f16bc --- /dev/null +++ b/src/maptest0.c @@ -0,0 +1,38 @@ +#include +#include "src/lib/mapread.h" + +#define DUMP +#define DUMP_MAP + +void +main(int argc, char *argv[]) +{ + map_t map; + short i; + char *fmt = "Memory available = %u\n"; + char *fmt0 = "Largest Contiguous Block of Memory available = %u\n"; + fprintf(stderr, fmt, _memavl()); + fprintf(stderr, fmt0, _memmax()); + while(!kbhit()); + fprintf(stderr, "loading~\n"); + loadmap("data/tes0.map", &map); + fprintf(stderr, "okies~\n"); + #ifdef DUMP + fprintf(stdout, "map.width= %d\n", map.width); + fprintf(stdout, "map.height= %d\n", map.height); + #ifdef DUMP_MAP + for(i=0; i<(map.width*map.height); i++) + { + fprintf(stdout, "%04d[%02d]", i, map.data[i]); + if(i && !(i%map.width)) fprintf(stdout, "\n"); + } + fprintf(stdout, "\n"); + #endif + fprintf(stdout, "&map==%Fp\n", &map); + fprintf(stdout, "&map.tiles==%Fp\n", map.tiles); + fprintf(stdout, "&map.width==%Fp\n", map.width); + fprintf(stdout, "&map.height==%Fp\n", map.height); + fprintf(stdout, "&map.data==%Fp\n", map.data); + #endif + fprintf(stdout, "okies~\n"); +}