From: sparky4 Date: Tue, 28 Jun 2016 14:34:02 +0000 (-0500) Subject: gvar.video.page[1].pattern_ofs added wwwwwwwww X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=51b40bfb7f114e300c6739f98292bc7c5fe6c2d9;p=16.git gvar.video.page[1].pattern_ofs added wwwwwwwww --- diff --git a/0.l16 b/0.l16 new file mode 100755 index 00000000..cd0a3e5b --- /dev/null +++ b/0.l16 @@ -0,0 +1 @@ +23936 40960 diff --git a/exmm0.exe b/exmm0.exe index 407f6a0e..175efde2 100755 Binary files a/exmm0.exe and b/exmm0.exe differ diff --git a/src/0.c b/src/0.c index 02b1b520..5e50c2fc 100755 --- a/src/0.c +++ b/src/0.c @@ -104,7 +104,7 @@ int main(int argc,char **argv) { * this time, we render the distinctive pattern to another offscreen location and just copy. * note this version is much faster too! */ { - const unsigned int pattern_ofs = 0x10000UL - gvar.video.page[0].pagesize;//(gvar.video.page[0].stridew * gvar.video.page[0].height); + //const unsigned int pattern_ofs = 0x10000UL - gvar.video.page[0].pagesize;//(gvar.video.page[0].stridew * gvar.video.page[0].height); unsigned int i,j,o,o2; int x,y,rx,ry,w,h; unsigned int overdraw = 1; // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks. @@ -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) + pattern_ofs; + o = (i >> 2) + gvar.video.page[1].pattern_ofs; 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 = pattern_ofs + (ry * gvar.video.page[0].stridew) + (rx >> 2); // source offscreen + o = gvar.video.page[1].pattern_ofs + (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(); @@ -278,7 +278,8 @@ int main(int argc,char **argv) { if (dh < 40) dh_step = 1; } } - +//uint16_t + printf("%u %u\n", (gvar.video.page[1].data), 0x10000UL - gvar.video.page[0].pagesize); VGAmodeX(0, 1, &gvar); free(vrl_lineoffs); buffer = NULL; diff --git a/src/lib/modex16.c b/src/lib/modex16.c index 900914e1..9ae5246e 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -197,6 +197,7 @@ 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; @@ -224,6 +225,7 @@ 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; @@ -248,6 +250,7 @@ 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 07da327c..dcb8911c 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -374,6 +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; } @@ -403,6 +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; } @@ -432,6 +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; } @@ -460,6 +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; } @@ -489,6 +493,7 @@ 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; } } @@ -506,6 +511,7 @@ 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; } } @@ -523,6 +529,7 @@ 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; } } @@ -540,6 +547,7 @@ 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 da79ebc8..cbbe4712 100755 --- a/src/lib/typdefst.h +++ b/src/lib/typdefst.h @@ -82,6 +82,7 @@ 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 */