From: sparky4 Date: Tue, 10 Jan 2017 18:32:15 +0000 (-0600) Subject: made a new function modexMVSetup() and made scroller use dx and dy on page[0].dx... X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=commitdiff_plain;h=4562507de358ed56c9e593245d5279be867e4d8b made a new function modexMVSetup() and made scroller use dx and dy on page[0].dx wwww --- diff --git a/fontgfx.exe b/fontgfx.exe index 64936bb0..eb0e3f89 100755 Binary files a/fontgfx.exe and b/fontgfx.exe differ diff --git a/maptest.exe b/maptest.exe index 19c50991..83410a92 100755 Binary files a/maptest.exe and b/maptest.exe differ diff --git a/pcxtest.exe b/pcxtest.exe index f1a5d635..3627f916 100755 Binary files a/pcxtest.exe and b/pcxtest.exe differ diff --git a/src/lib/.16_vl.c.kate-swp b/src/lib/.16_vl.c.kate-swp new file mode 100755 index 00000000..b908d86d Binary files /dev/null and b/src/lib/.16_vl.c.kate-swp differ diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index 101ad475..fc9ccbea 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -90,7 +90,7 @@ typedef struct { } map_t; typedef struct { - /*nibble*/word id; /* the Identification number of the page~ For layering~ */ + nibble/*word*/ id; /* the Identification number of the page~ For layering~ */ byte far* data; /* the data for the page */ word dx; /* col we are viewing on virtual screen (on page[0]) */ /* off screen buffer on the left size */ word dy; /* row we are viewing on virtual screen (on page[0]) */ /* off screen buffer on the top size */ diff --git a/src/lib/16render.c b/src/lib/16render.c index 4118f17e..1a8f81f6 100755 --- a/src/lib/16render.c +++ b/src/lib/16render.c @@ -33,8 +33,8 @@ void modexDrawPBufRegion (page_t *page, int x, int y, int rx, int ry, int rw, in { word plane; int i; - const int px=x+page->dx; - const int py=y+page->dy; + const int px=x+page[0].dx; + const int py=y+page[0].dy; const int prw = rw/4; int prh; @@ -72,8 +72,8 @@ modexDrawPBuf(page_t *page, int x, int y, planar_buf_t *p, boolean sprite) sword plane; int i; // byte near *buff; - const int px=x+page->dx; - const int py=y+page->dy; + const int px=x+page[0].dx; + const int py=y+page[0].dy; x=px; y=py; // buff = _nmalloc(p->pwidth+1); @@ -100,7 +100,7 @@ modexDrawPBuf(page_t *page, int x, int y, planar_buf_t *p, boolean sprite) //printf("%02X ", (int) p->plane[plane][i++]); // _fmemcpy(buff, &(p->plane[plane][i+=p->pwidth]), p->pwidth); // printf("buff %u==%s\n", y, *buff); -// _fmemcpy(page->data + (((page->width/4) * (y+page->dy)) + ((x+page->dx) / 4)), buff, p->pwidth); +// _fmemcpy(page->data + (((page->width/4) * (y+page[0].dy)) + ((x+page[0].dx) / 4)), buff, p->pwidth); _fmemcpy(page->data + (((page->width/4) * y) + (x / 4)), &(p->plane[plane][i+=p->pwidth]), p->pwidth); //} } diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index 7f4ff16d..f338372b 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -224,7 +224,7 @@ void panPageManual(map_view_t *pip, player_t *player, word pn) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page[0].dx+=4; + pip[pip[0].pan->pn].page->dx+=4; modexShowPage(pip[pip[0].pan->pn].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx++; } @@ -237,7 +237,7 @@ void panPageManual(map_view_t *pip, player_t *player, word pn) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page[0].dx-=4; + pip[pip[0].pan->pn].page->dx-=4; modexShowPage(pip[pip[0].pan->pn].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx--; } @@ -250,7 +250,7 @@ void panPageManual(map_view_t *pip, player_t *player, word pn) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page[0].dy+=4; + pip[pip[0].pan->pn].page->dy+=4; modexShowPage(pip[pip[0].pan->pn].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty++; } @@ -263,7 +263,7 @@ void panPageManual(map_view_t *pip, player_t *player, word pn) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page[0].dy-=4; + pip[pip[0].pan->pn].page->dy-=4; modexShowPage(pip[pip[0].pan->pn].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty--; } @@ -284,7 +284,7 @@ void panVmemManual(map_view_t *pip, player_t *player, word pn) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page[0].dx+=4; + pip[pip[0].pan->pn].page->dx+=4; modexShowPageVsync(pip[pip[0].pan->pn].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx++; } @@ -297,7 +297,7 @@ void panVmemManual(map_view_t *pip, player_t *player, word pn) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page[0].dx-=4; + pip[pip[0].pan->pn].page->dx-=4; modexShowPageVsync(pip[pip[0].pan->pn].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx--; } @@ -310,7 +310,7 @@ void panVmemManual(map_view_t *pip, player_t *player, word pn) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page[0].dy+=4; + pip[pip[0].pan->pn].page->dy+=4; modexShowPageVsync(pip[pip[0].pan->pn].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty++; } @@ -323,7 +323,7 @@ void panVmemManual(map_view_t *pip, player_t *player, word pn) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page[0].dy-=4; + pip[pip[0].pan->pn].page->dy-=4; modexShowPageVsync(pip[pip[0].pan->pn].page); player[pn].q++; } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty--; } @@ -338,7 +338,7 @@ void panVmemManual(map_view_t *pip, player_t *player, word pn) */ void modexMVSetup(map_view_t *mv, map_t *map, pan_t *pan, global_game_variables_t *gv) { - byte i; + nibble i; // 1st page mv[0].page = &gv->video.page[0]; mv[0].map = map; @@ -446,24 +446,24 @@ void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid) word x;//, y; /* coordinate for drawing */ /* increment the pixel position and update the page */ - mv[id].page[0].dx += player[plid].speed; + mv[id].page->dx += player[plid].speed; /* check to see if this changes the tile */ - if(mv[id].page[0].dx >= mv[id].dxThresh ) + if(mv[id].page->dx >= mv[id].dxThresh ) { /* go forward one tile */ mv[id].tx++; /* Snap the origin forward */ mv[id].page->data += 4; - mv[id].page[0].dx = mv[id].map->tiles->tileWidth; + mv[id].page->dx = mv[id].map->tiles->tileWidth; } /* draw the next column */ x= mv[0].page->sw + mv[id].map->tiles->tileWidth; if(player[plid].q%4) if(id==0) - mapDrawCol(&mv[0], mv[0].tx + mv[0].page->tw, mv[0].ty-1, x, player, mv->page[0].dx); + mapDrawCol(&mv[0], mv[0].tx + mv[0].page->tw, mv[0].ty-1, x, player, mv->page->dx); else if(!pageflipflop && !pageploop) modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->th+2)); @@ -476,24 +476,24 @@ void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid) word x;//,y; /* coordinate for drawing */ /* decrement the pixel position and update the page */ - mv[id].page[0].dx -= player[plid].speed; + mv[id].page->dx -= player[plid].speed; /* check to see if this changes the tile */ - if(mv[id].page[0].dx == 0) + if(mv[id].page->dx == 0) { /* go backward one tile */ mv[id].tx--; /* Snap the origin backward */ mv[id].page->data -= 4; - mv[id].page[0].dx = mv[id].map->tiles->tileWidth; + mv[id].page->dx = mv[id].map->tiles->tileWidth; } /* draw the next column */ x= 0; if(player[plid].q%4) if(id==0) - mapDrawCol(&mv[0], mv[0].tx - 1, mv[0].ty-1, x, player, mv->page[0].dx); + mapDrawCol(&mv[0], mv[0].tx - 1, mv[0].ty-1, x, player, mv->page->dx); else if(!pageflipflop && !pageploop) modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->th+2)); @@ -506,24 +506,24 @@ void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid) word y;//x, /* coordinate for drawing */ /* decrement the pixel position and update the page */ - mv[id].page[0].dy -= player[plid].speed; + mv[id].page->dy -= player[plid].speed; /* check to see if this changes the tile */ - if(mv[id].page[0].dy == 0 ) + if(mv[id].page->dy == 0 ) { /* go down one tile */ mv[id].ty--; /* Snap the origin downward */ mv[id].page->data -= mv[id].page->pi; - mv[id].page[0].dy = mv[id].map->tiles->tileHeight; + mv[id].page->dy = mv[id].map->tiles->tileHeight; } /* draw the next row */ y= 0; if(player[plid].q%3) if(id==0) - mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty-1, y, player, mv->page[0].dy); + mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty-1, y, player, mv->page->dy); else if(!pageflipflop && !pageploop) modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tw+2), mv[id].map->tiles->tileHeight); @@ -535,24 +535,24 @@ void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid) word y;//x, /* coordinate for drawing */ /* increment the pixel position and update the page */ - mv[id].page[0].dy += player[plid].speed; + mv[id].page->dy += player[plid].speed; /* check to see if this changes the tile */ - if(mv[id].page[0].dy >= mv[id].dyThresh ) + if(mv[id].page->dy >= mv[id].dyThresh ) { /* go down one tile */ mv[id].ty++; /* Snap the origin downward */ mv[id].page->data += mv[id].page->pi; - mv[id].page[0].dy = mv[id].map->tiles->tileHeight; + mv[id].page->dy = mv[id].map->tiles->tileHeight; } /* draw the next row */ y= mv[0].page->sh + mv[id].map->tiles->tileHeight; if(player[plid].q%3) if(id==0) - mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty+mv[0].page->th, y, player, mv->page[0].dy); + mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty+mv[0].page->th, y, player, mv->page->dy); else if(!pageflipflop && !pageploop) modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tw+2), mv[id].map->tiles->tileHeight); @@ -564,68 +564,68 @@ void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid) void near ScrollRight(map_view_t *mv, player_t *player, word id, word plid) { /* increment the pixel position and update the page */ - mv[id].page[0].dx += player[plid].speed; + mv[id].page->dx += player[plid].speed; /* check to see if this changes the tile */ - if(mv[id].page[0].dx >= mv[0].dxThresh ) + if(mv[id].page->dx >= mv[0].dxThresh ) { // vga_setup_wm1_block_copy(); // _fmemmove(mv[id].page->data+4, mv[id].page->data, mv[id].page->pagesize); // vga_restore_rm0wm0(); /* Snap the origin forward */ mv[id].page->data += 4; - mv[id].page[0].dx = mv[0].map->tiles->tileWidth; + mv[id].page->dx = mv[0].map->tiles->tileWidth; } } void near ScrollLeft(map_view_t *mv, player_t *player, word id, word plid) { /* decrement the pixel position and update the page */ - mv[id].page[0].dx -= player[plid].speed; + mv[id].page->dx -= player[plid].speed; /* check to see if this changes the tile */ - if(mv[id].page[0].dx == 0) + if(mv[id].page->dx == 0) { // vga_setup_wm1_block_copy(); // _fmemmove(mv[id].page->data-4, mv[id].page->data, mv[id].page->pagesize); // vga_restore_rm0wm0(); /* Snap the origin backward */ mv[id].page->data -= 4; - mv[id].page[0].dx = mv[0].map->tiles->tileWidth; + mv[id].page->dx = mv[0].map->tiles->tileWidth; } } void near ScrollUp(map_view_t *mv, player_t *player, word id, word plid) { /* decrement the pixel position and update the page */ - mv[id].page[0].dy -= player[plid].speed; + mv[id].page->dy -= player[plid].speed; /* check to see if this changes the tile */ - if(mv[id].page[0].dy == 0) + if(mv[id].page->dy == 0) { // vga_setup_wm1_block_copy(); // _fmemmove(mv[id].page->data-mv[id].page->pi, mv[id].page->data, mv[id].page->pagesize); // vga_restore_rm0wm0(); /* Snap the origin backward */ mv[id].page->data -= mv[id].page->pi; - mv[id].page[0].dy = mv[0].map->tiles->tileWidth; + mv[id].page->dy = mv[0].map->tiles->tileWidth; } } void near ScrollDown(map_view_t *mv, player_t *player, word id, word plid) { /* increment the pixel position and update the page */ - mv[id].page[0].dy += player[plid].speed; + mv[id].page->dy += player[plid].speed; /* check to see if this changes the tile */ - if(mv[id].page[0].dy >= mv[0].dxThresh ) + if(mv[id].page->dy >= mv[0].dxThresh ) { // vga_setup_wm1_block_copy(); // _fmemmove(mv[id].page->data+mv[id].page->pi, mv[id].page->data, mv[id].page->pagesize); // vga_restore_rm0wm0(); /* Snap the origin forward */ mv[id].page->data += mv[id].page->pi; - mv[id].page[0].dy = mv[0].map->tiles->tileWidth; + mv[id].page->dy = mv[0].map->tiles->tileWidth; } } @@ -713,8 +713,8 @@ void mapinitmapview(map_view_t *mv, int tx, int ty) /* set up the coordinates */ mv[0].tx = mv[1].tx = tx; mv[0].ty = mv[1].ty = ty; - mv[0].page[0].dx = mv[1].page[0].dx = mv[2].page[0].dx = mv[3].page[0].dx = mv->map->tiles->tileWidth; - mv[0].page[0].dy = mv[1].page[0].dy = mv[2].page[0].dy = mv[3].page[0].dy = mv->map->tiles->tileHeight; + mv[0].page->dx = mv[1].page->dx = mv[2].page->dx = mv[3].page->dx = mv->map->tiles->tileWidth; + mv[0].page->dy = mv[1].page->dy = mv[2].page->dy = mv[3].page->dy = mv->map->tiles->tileHeight; /* set up the thresholds */ mv[0].dxThresh = mv[1].dxThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->tiles->tileWidth * 2; diff --git a/test.exe b/test.exe new file mode 100755 index 00000000..06592e5f Binary files /dev/null and b/test.exe differ