From e5e17ef63b7a014ecffe10ea684a85b38650fb40 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Thu, 26 Jan 2017 10:02:53 -0600 Subject: [PATCH] PRE reattempt at optimizing scroll map draw stuff --- src/lib/16_tdef.h | 2 ++ src/lib/scroll16.c | 35 ++++++++++++++++++++++------------- src/zcroll.c | 2 +- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index 2021b877..278218f7 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -498,6 +498,8 @@ typedef struct } global_game_variables_t; extern char global_temp_status_text[512]; +extern char global_temp_status_textR[512]; +extern char global_temp_status_textC[512]; #ifdef __WATCOMC__ #define EINVFMT EMFILE #endif diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index b1d60d49..4e94e9ba 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -748,20 +748,26 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) } } +char global_temp_status_textR[512]; +char global_temp_status_textC[512]; + void near mapDrawRow(map_view_t *mv, int tx, int ty, word y, player_t *player, word poopoffset) { word x; int i; poopoffset%=player[0].enti.speed; -//printf("y: %d\n", poopoffset); +// printf("y: %d\n", poopoffset); +// sprintf(global_temp_status_textR, "y:%u", poopoffset); modexprint(mv[0].page, player[0].enti.x, player[0].enti.y-28, 1, 2, 1, global_temp_status_textR); /* the position within the map array */ i=ty * mv->map->width + tx; - for(x=poopoffset; x<(mv->page->sw+mv->dxThresh)/(poopoffset+1) && 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(x=poopoffset; + x<(mv->page->sw+mv->dxThresh)/(poopoffset+1) && 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! */ } } @@ -771,17 +777,20 @@ void near mapDrawCol(map_view_t *mv, int tx, int ty, word x, player_t *player, w int i; poopoffset%=player[0].enti.speed; //printf("x: %d\n", poopoffset); +// sprintf(global_temp_status_textR, "x:%u", poopoffset); modexprint(mv[0].page, player[0].enti.x, player[0].enti.y-28, 1, 2, 1, global_temp_status_textR); /* 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(y=poopoffset; y<(mv->page->sh+mv->dyThresh)/(poopoffset+1) && 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(y=poopoffset; + y<(mv->page->sh+mv->dyThresh)/(poopoffset+1) && 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; } } diff --git a/src/zcroll.c b/src/zcroll.c index 1667459f..68300231 100755 --- a/src/zcroll.c +++ b/src/zcroll.c @@ -32,7 +32,7 @@ float t; //debugswitches boolean panswitch=0,baka=0; //extern boolean pageflipflop=1; -boolean pagenorendermap = 1; //default: 0 +boolean pagenorendermap = 0; //default: 0 unsigned int i; #ifdef FADE -- 2.39.5