From 7a3b6f331f36735ef30027236eb447439583d43d Mon Sep 17 00:00:00 2001 From: sparky4 Date: Tue, 28 Jun 2016 09:46:42 -0500 Subject: [PATCH] gvar.video.page[1].pattern_ofs removed because it is just (0x10000UL - (uint16_t)gvar.video.page[1].data) --- 0.l16 | 2 +- src/0.c | 6 +++--- src/lib/modex16.c | 3 --- src/lib/scroll16.c | 12 ++++-------- src/lib/typdefst.h | 1 - 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/0.l16 b/0.l16 index cd0a3e5b..1057f7fa 100755 --- a/0.l16 +++ b/0.l16 @@ -1 +1 @@ -23936 40960 +41600 diff --git a/src/0.c b/src/0.c index 5e50c2fc..31da3feb 100755 --- a/src/0.c +++ b/src/0.c @@ -115,7 +115,7 @@ int main(int argc,char **argv) { //4 this dose the sprite? wwww /* fill pattern offset with a distinctive pattern */ for (i=0;i < gvar.video.page[0].width;i++) { - o = (i >> 2) + gvar.video.page[1].pattern_ofs; + o = (i >> 2) + (0x10000UL - (uint16_t)gvar.video.page[1].data); vga_write_sequencer(0x02/*map mask*/,1 << (i&3)); for (j=0;j < VMEMHEIGHT;j++,o += gvar.video.page[0].stridew) vga_state.vga_graphics_ram[o] = (i^j)&15; // VRL samples put all colors in first 15! @@ -146,7 +146,7 @@ int main(int argc,char **argv) { /* block copy pattern to where we will draw the sprite */ vga_setup_wm1_block_copy(); o2 = gvar.video.page[0].pagesize; - o = gvar.video.page[1].pattern_ofs + (ry * gvar.video.page[0].stridew) + (rx >> 2); // source offscreen + o = (0x10000UL - (uint16_t)gvar.video.page[1].data) + (ry * gvar.video.page[0].stridew) + (rx >> 2); // source offscreen for (i=0;i < h;i++,o += gvar.video.page[0].stridew,o2 += (w >> 2)) vga_wm1_mem_block_copy(o2,o,w >> 2); /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */ vga_restore_rm0wm0(); @@ -279,7 +279,7 @@ int main(int argc,char **argv) { } } //uint16_t - printf("%u %u\n", (gvar.video.page[1].data), 0x10000UL - gvar.video.page[0].pagesize); + printf("%u\n", (0x10000UL - (uint16_t)(gvar.video.page[1].data))); VGAmodeX(0, 1, &gvar); free(vrl_lineoffs); buffer = NULL; diff --git a/src/lib/modex16.c b/src/lib/modex16.c index 9ae5246e..900914e1 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -197,7 +197,6 @@ modexDefaultPage(page_t *p) page.tilesh=page.height/TILEWH; page.tilemidposscreenx = page.tw/2; page.tilemidposscreeny = (page.th/2)+1; - page.pattern_ofs=0; page.stridew=page.width/4; page.pagesize = (word)(page.stridew)*page.height; page.pi=page.width*4; @@ -225,7 +224,6 @@ modexNextPage(page_t *p) { result.tilesw = p->tilesw; result.tilesh = p->tilesh; result.stridew=p->stridew; - result.pattern_ofs = 0x10000UL - p->pagesize; result.pagesize = p->pagesize; result.pi=result.width*4; result.id = p->id+1; @@ -250,7 +248,6 @@ modexNextPageFlexibleSize(page_t *p, word x, word y) result.th = result.sh/TILEWH; result.tilesw=result.width/TILEWH; result.tilesh=result.height/TILEWH; - result.pattern_ofs=0x10000UL - (p->pattern_ofs+p->pagesize); result.id = p->id+1; result.stridew=p->sw/4;//result.width/4; result.pagesize = (word)(result.stridew)*result.height; diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index dcb8911c..eb83157e 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -374,7 +374,7 @@ void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid) mv[id].tx++; /* Snap the origin forward */ mv[id].page->data += 4; - mv[id].page->pattern_ofs += 4; + mv[id].page->dx = mv[id].map->tiles->tileWidth; } @@ -404,7 +404,7 @@ void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid) mv[id].tx--; /* Snap the origin backward */ mv[id].page->data -= 4; - mv[id].page->pattern_ofs -= 4; + mv[id].page->dx = mv[id].map->tiles->tileWidth; } @@ -434,7 +434,7 @@ void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid) mv[id].ty--; /* Snap the origin downward */ mv[id].page->data -= mv[id].page->pi; - mv[id].page->pattern_ofs -= mv[id].page->pi; + mv[id].page->dy = mv[id].map->tiles->tileHeight; } @@ -463,7 +463,7 @@ void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid) mv[id].ty++; /* Snap the origin downward */ mv[id].page->data += mv[id].page->pi; - mv[id].page->pattern_ofs += mv[id].page->pi; + mv[id].page->dy = mv[id].map->tiles->tileHeight; } @@ -493,7 +493,6 @@ void near ScrollRight(map_view_t *mv, player_t *player, word id, word plid) // vga_restore_rm0wm0(); /* Snap the origin forward */ mv[id].page->data += 4; - mv[id].page->pattern_ofs += 4; mv[id].page->dx = mv[0].map->tiles->tileWidth; } } @@ -511,7 +510,6 @@ void near ScrollLeft(map_view_t *mv, player_t *player, word id, word plid) // vga_restore_rm0wm0(); /* Snap the origin backward */ mv[id].page->data -= 4; - mv[id].page->pattern_ofs -=4; mv[id].page->dx = mv[0].map->tiles->tileWidth; } } @@ -529,7 +527,6 @@ void near ScrollUp(map_view_t *mv, player_t *player, word id, word plid) // vga_restore_rm0wm0(); /* Snap the origin backward */ mv[id].page->data -= mv[id].page->pi; - mv[id].page->pattern_ofs -= mv[id].page->pi; mv[id].page->dy = mv[0].map->tiles->tileWidth; } } @@ -547,7 +544,6 @@ void near ScrollDown(map_view_t *mv, player_t *player, word id, word plid) // vga_restore_rm0wm0(); /* Snap the origin forward */ mv[id].page->data += mv[id].page->pi; - mv[id].page->pattern_ofs += mv[id].page->pi; mv[id].page->dy = mv[0].map->tiles->tileWidth; } } diff --git a/src/lib/typdefst.h b/src/lib/typdefst.h index cbbe4712..da79ebc8 100755 --- a/src/lib/typdefst.h +++ b/src/lib/typdefst.h @@ -82,7 +82,6 @@ typedef struct { sword tilemidposscreeny; /* middle tile position */ sword tileplayerposscreenx; /* player position on screen */ sword tileplayerposscreeny; /* player position on screen */ - uint16_t pattern_ofs; /* doslib vga patter offset www */ word stridew; /*width/4*/ word pagesize; /* page size */ word pi; /* incremention page by this much to preserve location */ -- 2.39.5