From: sparky4 Date: Thu, 26 Mar 2015 15:10:34 +0000 (-0500) Subject: The game can now load little tilesets... much improvement is needed in the map readin... X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=54750ec63f67da02ad05e13c7bf203e178f3bd7e;p=16.git The game can now load little tilesets... much improvement is needed in the map reading area and tileset reading and image loading and memory management areas and such~ wwww modified: makefile modified: scroll.exe modified: src/lib/mapread.c modified: src/scroll.c --- diff --git a/makefile b/makefile index f65afd21..2a53a385 100644 --- a/makefile +++ b/makefile @@ -4,7 +4,7 @@ SRCLIB=$(SRC)lib\ all: test.exe pcxtest.exe test2.exe scroll.exe scroll.exe: scroll.obj modex16.obj dos_kb.obj bitmap.obj mapread.obj jsmn.obj - wcl $(FLAGS) scroll.obj modex16.obj dos_kb.obj bitmap.obj mapread.obj jsmn.obj 16\lib\x\modex.lib + wcl $(FLAGS) scroll.obj modex16.obj dos_kb.obj bitmap.obj mapread.obj jsmn.obj# 16\lib\x\modex.lib scroll.obj: $(SRC)scroll.c wcl $(FLAGS) -c $(SRC)scroll.c test.exe: test.obj modex16.obj bitmap.obj diff --git a/scroll.exe b/scroll.exe index e44f8420..369e5afe 100644 Binary files a/scroll.exe and b/scroll.exe differ diff --git a/src/lib/mapread.c b/src/lib/mapread.c index 86dc10af..f0e8ac0e 100644 --- a/src/lib/mapread.c +++ b/src/lib/mapread.c @@ -11,6 +11,7 @@ static int jsoneq(const char *json, jsmntok_t *tok, const char *s) { //this function is quite messy ^^; sorry! it is a quick and dirty fix~ static int dump(const char *js, jsmntok_t *t, size_t count, int indent, /*char *js_sv,*/ map_t *map, int q/*, int *w*/) { int i, j, k; + bitmap_t bp; if (count == 0) { return 0; } @@ -25,7 +26,7 @@ static int dump(const char *js, jsmntok_t *t, size_t count, int indent, /*char * FUCK well i am stuck.... wwww */ - map->data[q] = (byte)strtol(js+t->start, &(char *)t->end, 10); + map->data[q] = (byte)strtol(js+t->start, &(char *)t->end, 10)%4; // printf("%d[%d]", q, map->data[q]); } else @@ -48,11 +49,14 @@ static int dump(const char *js, jsmntok_t *t, size_t count, int indent, /*char * // printf("\n%.*s[xx[%d|%d]xx]\n", (t+1)->end - (t+1)->start, js+(t+1)->start, &(t+1)->size, (t+1)->size); map->data = malloc(sizeof(byte) * (t+1)->size); map->tiles = malloc(sizeof(tiles_t)); - map->tiles->data = malloc(sizeof(bitmap_t)); - //map->tiles->data = bitmapLoadPcx("data/chikyuu.pcx"); - map->tiles->data->data = malloc((16/**2*/)*16); - map->tiles->data->width = (16/**2*/); - map->tiles->data->height= 16; + //map->tiles->data = malloc(sizeof(bitmap_t)); + printf("ed.pcx\n"); + bp = bitmapLoadPcx("data/ed.pcx"); + printf("ed.pcx\n"); + map->tiles->data = &bp; + //map->tiles->data->data = malloc((16/**2*/)*16); + //map->tiles->data->width = (16/**2*/); + //map->tiles->data->height= 16; map->tiles->tileHeight = 16; map->tiles->tileWidth = 16; map->tiles->rows = 1; diff --git a/src/scroll.c b/src/scroll.c index dd66f556..1b96a6d2 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -119,9 +119,9 @@ void main() { /* create the map */ loadmap("data/test.map", &map/*, 0*/); -// map = allocMap(map.width,map.height); //20x15 is the resolution of the screen you can make maps smaller than 20x15 but the null space needs to be drawn properly +//---- map = allocMap(map.width,map.height); //20x15 is the resolution of the screen you can make maps smaller than 20x15 but the null space needs to be drawn properly //if(isEMS()) printf("%d tesuto\n", coretotalEMS()); -// initMap(&map); +//---- initMap(&map); mv.map = ↦ mv2.map = ↦ mv3.map = ↦ @@ -521,6 +521,8 @@ void main() { } if(player.q == (TILEWH/SPEED)+1 && player.d > 0 && (player.triggerx == 5 && player.triggery == 5)){ player.hp--; } //if(keyp(0x0E)) while(1){ if(xmsmalloc(24)) break; } + modexDrawBmp(bg->page, 0, 0, map.tiles->data); + modexDrawBmp(spri->page, 0, 0, map.tiles->data); if(keyp(87)) { modexLeave();