From 4a866133883d9d7edd43f7101062a5f775bda4da Mon Sep 17 00:00:00 2001 From: sparky4 Date: Thu, 26 Jan 2017 11:56:53 -0600 Subject: [PATCH] showing row and colum drawing i optimized it to only draw at the end of walk. this explains why it is much slower than it was before --- src/lib/scroll16.c | 38 ++++++++++++++------------------------ src/lib/scroll16.h | 4 ++-- 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index 7ed269ca..21c3d741 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -771,14 +771,12 @@ void near mapDrawRow(map_view_t *mv, int tx, int ty, word y, player_t *player, w if(pagedelayrendermap) if(!y) y+=TILEWH; else y-=TILEWH; poopoffset%=player[0].enti.speed; //printf("y: %d\n", poopoffset); -if(pagedelayrendermap){ sprintf(global_temp_status_text, "%-3u", mv->drawx); modexprint(mv[0].page, player[0].enti.x, player[0].enti.y-28-(poopoffset*8) , 1, 2, 1, global_temp_status_text); } +if(pagedelayrendermap){ sprintf(global_temp_status_text, "%-3u", mv->dx); modexprint(mv[0].page, player[0].enti.x, player[0].enti.y-28-(poopoffset*8) , 1, 2, 1, global_temp_status_text); } /* the position within the map array */ i=ty * mv->map->width + tx; - for( mv->drawx=poopoffset; - mv->drawx<(mv->page->sw+mv->dxThresh)/(poopoffset+1) && tx < mv->map->width; - mv->drawx+=mv->map->tiles->tileWidth, tx++) { + for( mv->dx=poopoffset; mv->dx<(mv->page->sw+mv->dxThresh)/(poopoffset+1) && tx < mv->map->width; mv->dx+=mv->map->tiles->tileWidth, tx++) { if(i>=0) /* we are in the map, so copy away! */ - mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, mv->drawx, y); + mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, mv->dx, y); i++; /* next! */ } //if(pagedelayrendermap) delay(200); @@ -790,16 +788,14 @@ void near mapDrawCol(map_view_t *mv, int tx, int ty, word x, player_t *player, w if(pagedelayrendermap) if(!x) x+=TILEWH; else x-=TILEWH; poopoffset%=player[0].enti.speed; //printf("x: %d\n", poopoffset); -if(pagedelayrendermap){ sprintf(global_temp_status_text, "%-3u", mv->drawy); modexprint(mv[0].page, player[0].enti.x, player[0].enti.y-28-(poopoffset*8) , 1, 2, 1, global_temp_status_text); } +if(pagedelayrendermap){ sprintf(global_temp_status_text, "%-3u", mv->dy); modexprint(mv[0].page, player[0].enti.x, player[0].enti.y-28-(poopoffset*8) , 1, 2, 1, global_temp_status_text); } /* location in the map array */ i=ty * mv->map->width + tx; /* We'll copy all of the columns in the screen, i + 1 row above and one below */ - for( mv->drawy=poopoffset; - mv->drawy<(mv->page->sh+mv->dyThresh)/(poopoffset+1) && ty < mv->map->height; - mv->drawy+=mv->map->tiles->tileHeight, ty++) { + for( mv->dy=poopoffset; mv->dy<(mv->page->sh+mv->dyThresh)/(poopoffset+1) && ty < mv->map->height; mv->dy+=mv->map->tiles->tileHeight, ty++) { if(i>=0) /* we are in the map, so copy away! */ - mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, mv->drawy); + mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, mv->dy); i += mv->map->width; } //if(pagedelayrendermap) delay(200); @@ -807,23 +803,19 @@ if(pagedelayrendermap){ sprintf(global_temp_status_text, "%-3u", mv->drawy); mod void mapDrawWRow(map_view_t *mv, int tx, int ty, word y) { - word x; int i; /* the position within the map array */ i=ty * mv->map->width + tx; - for(x=0; xpage->sw+mv->dxThresh && tx < mv->map->width; x+=mv->map->tiles->tileWidth, tx++) { - if(i>=0) { - /* we are in the map, so copy! */ - mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y); - } - i++; /* next! */ + for(mv->dx=0; mv->dxpage->sw+mv->dxThresh && tx < mv->map->width; mv->dx+=mv->map->tiles->tileWidth, tx++) { + if(i>=0) /* we are in the map, so copy! */ + mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, mv->dx, y); + i++; /* next! */ } } void mapDrawWCol(map_view_t *mv, int tx, int ty, word x) { - int y; int i; /* location in the map array */ @@ -831,12 +823,10 @@ void mapDrawWCol(map_view_t *mv, int tx, int ty, word x) /* We'll copy all of the columns in the screen, i + 1 row above and one below */ - for(y=0; ypage->sh+mv->dyThresh && ty < mv->map->height; y+=mv->map->tiles->tileHeight, ty++) { - if(i>=0) { - /* we are in the map, so copy away! */ - mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y); - } - i += mv->map->width; + for(mv->dy=0; mv->dypage->sh+mv->dyThresh && ty < mv->map->height; mv->dy+=mv->map->tiles->tileHeight, ty++) { + if(i>=0) /* we are in the map, so copy away! */ + mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, mv->dy); + i += mv->map->width; } } diff --git a/src/lib/scroll16.h b/src/lib/scroll16.h index 635f432c..af4858c9 100755 --- a/src/lib/scroll16.h +++ b/src/lib/scroll16.h @@ -70,9 +70,9 @@ typedef struct { word dyThresh; //Threshold for physical tile switch video_t *video; //pointer to game variables of the video nibble *panp; // pointer to video's pan page num - int drawx, drawy; // draw row and col var + int dx, dy; // draw row and col var //newer vars! - int dx, dy, delta, d; + int delta, d; } map_view_t; /* Map is presumed to: * 1. Have all the required layers and tilesets within itself -- 2.39.2