From: sparky4 Date: Tue, 14 Feb 2017 22:33:03 +0000 (-0600) Subject: hmmm layers in map_t .... X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=8ad7a17f27decec6ec66acecc80629c974544a0e;p=16.git hmmm layers in map_t .... --- diff --git a/src/lib/16_map.c b/src/lib/16_map.c index 37179ab7..a304ca2d 100755 --- a/src/lib/16_map.c +++ b/src/lib/16_map.c @@ -257,7 +257,7 @@ void extract_map(const char *js, jsmntok_t *t, size_t count, map_t *map) { while(ilayerdata = malloc(sizeof(byte*) * t[i].size); +// map->layerdata = malloc(sizeof(byte*) * t[i].size); inner_end = t[i].end; k = 0; while(t[i].start < inner_end) { @@ -268,11 +268,11 @@ void extract_map(const char *js, jsmntok_t *t, size_t count, map_t *map) { #ifdef DEBUG_MAPDATA printf("Layer %d data: [\n", k); #endif - map->MAPDATAPTK = malloc(sizeof(byte) * t[i+1].size); + map->layerdata[k] = malloc(sizeof(byte) * t[i+1].size); //for backwards compatibility for rest of code -// map->data = map->MAPDATAPTK; + map->data = map->layerdata[k]; for(j = 0; j < t[i+1].size; j++) { - map->MAPDATAPTK[j] = (byte)atoi(js + t[i+2+j].start); + map->layerdata[k][j] = (byte)atoi(js + t[i+2+j].start); #ifdef DEBUG_MAPDATA //printf("[%d,%d]%d", k, j, map->MAPDATAPTK[j]); fprintf(stdout, "%c", map->data[j]+44); diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index d1220d54..4c338111 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -93,11 +93,11 @@ typedef struct { typedef struct { //long planestart[3]; //unsigned planelength[3]; -#ifndef __NEWMAPTILEDATAVARS__ byte *data; //TODO: 16_mm and 16_ca must handle this + byte far *layerdata[MAPLAYERS]; // mapdata for multilayer (map index values for rendering which image on the tile) +#ifndef __NEWMAPTILEDATAVARS__ tiles_t *tiles; //TODO: 16_mm and 16_ca must handle this #else - byte far *layerdata[MAPLAYERS]; // mapdata for multilayer (map index values for rendering which image on the tile) tiles_t far *layertile[MAPLAYERS]; // tilesets for layers (currently ony 4 can be loaded wwww) #endif int width, height; //this has to be signed! diff --git a/src/lib/16_vl.c b/src/lib/16_vl.c index 2141dbc3..0ad3d270 100755 --- a/src/lib/16_vl.c +++ b/src/lib/16_vl.c @@ -862,7 +862,7 @@ void modexDrawChar(page_t *page, int x/*for planar selection only*/, word t, wor void modexprint(page_t *page, sword x, sword y, word t, word col, word bgcol, const byte *str) { word s, o, w; - sword x_draw; + word x_draw; //word addr = (word) romFontsData.l; word addrq; word addrr; @@ -870,7 +870,7 @@ void modexprint(page_t *page, sword x, sword y, word t, word col, word bgcol, co x-=page->tlx; y-=page->tly; x_draw = x/4; - addrq = (page->stridew) * y + (x_draw) + + addrq = (page->stridew) * y + (word)(x_draw) + ((word)page->data); addrr = addrq; s=romFonts[t].seg; diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index e421fd91..4f310f3a 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -563,8 +563,7 @@ void ZC_mapredraw(map_view_t *mv, int tx, int ty) void near mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) { - word rx; - word ry; + word rx, ry; //word textx=0, texty=0; //if(i==0) i=2; switch(i) @@ -576,9 +575,10 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) default: rx = (((i-1) % ((t->pcximg->width)/t->tileWidth)) * t->tileWidth); ry = (((i-1) / ((t->pcximg->height)/t->tileHeight)) * t->tileHeight); -////0000printf("i=%d\n", i); +////0000 printf("i=%d\n", i); #ifndef TILERENDER if(!pagenorendermap) modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, i+1); + //sprintf(global_temp_status_text2, "%c", i); modexprint(page, x+3, y-1, 1, 1, 2, global_temp_status_text2); #else modexDrawBmpRegion (page, x, y, rx, ry, t->tileWidth, t->tileHeight, i); //draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));