OSDN Git Service

The game can now load little tilesets... much improvement is needed in the map readin...
authorsparky4 <sparky4@cock.li>
Thu, 26 Mar 2015 15:10:34 +0000 (10:10 -0500)
committersparky4 <sparky4@cock.li>
Thu, 26 Mar 2015 15:10:34 +0000 (10:10 -0500)
modified:   makefile
modified:   scroll.exe
modified:   src/lib/mapread.c
modified:   src/scroll.c

makefile
scroll.exe
src/lib/mapread.c
src/scroll.c

index f65afd2..2a53a38 100644 (file)
--- a/makefile
+++ b/makefile
@@ -4,7 +4,7 @@ SRCLIB=$(SRC)lib\
 all: test.exe pcxtest.exe test2.exe scroll.exe\r
 \r
 scroll.exe: scroll.obj modex16.obj dos_kb.obj bitmap.obj mapread.obj jsmn.obj\r
-       wcl $(FLAGS) scroll.obj modex16.obj dos_kb.obj bitmap.obj mapread.obj jsmn.obj 16\lib\x\modex.lib\r
+       wcl $(FLAGS) scroll.obj modex16.obj dos_kb.obj bitmap.obj mapread.obj jsmn.obj# 16\lib\x\modex.lib\r
 scroll.obj: $(SRC)scroll.c\r
        wcl $(FLAGS) -c $(SRC)scroll.c\r
 test.exe: test.obj modex16.obj bitmap.obj\r
index e44f842..369e5af 100644 (file)
Binary files a/scroll.exe and b/scroll.exe differ
index 86dc10a..f0e8ac0 100644 (file)
@@ -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*/);\r
-                       map->tiles->data->height= 16;\r
+                       //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*/);\r
+                       //map->tiles->data->height= 16;\r
                        map->tiles->tileHeight = 16;\r
                        map->tiles->tileWidth = 16;\r
                        map->tiles->rows = 1;\r
index dd66f55..1b96a6d 100644 (file)
@@ -119,9 +119,9 @@ void main() {
 \r
        /* 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());\r
-//     initMap(&map);\r
+//---- initMap(&map);\r
        mv.map = &map;\r
        mv2.map = &map;\r
        mv3.map = &map;\r
@@ -521,6 +521,8 @@ void main() {
        }\r
        if(player.q == (TILEWH/SPEED)+1 && player.d > 0 && (player.triggerx == 5 && player.triggery == 5)){ player.hp--; }\r
        //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();\r