]> 4ch.mooo.com Git - 16.git/commitdiff
made a new function modexMVSetup() and made scroller use dx and dy on page[0].dx
authorsparky4 <sparky4@cock.li>
Tue, 10 Jan 2017 18:12:11 +0000 (12:12 -0600)
committersparky4 <sparky4@cock.li>
Tue, 10 Jan 2017 18:12:11 +0000 (12:12 -0600)
src/lib/16_tdef.h
src/lib/16_vl.c
src/lib/scroll16.c

index 09e86c746bbf640d8e815b8dd77165dea3b7080c..101ad4754f50dbd0a2e2dc8b8eb92fabfbf23c61 100755 (executable)
@@ -92,8 +92,8 @@ typedef struct {
 typedef struct {\r
        /*nibble*/word id;      /* the Identification number of the page~ For layering~ */\r
        byte far* data; /* the data for the page */\r
-       word dx;                /* col we are viewing on the virtual screen */  /* off screen buffer on the left size */\r
-       word dy;                /* row we are viewing on the virtual screen */  /* off screen buffer on the top size */\r
+       word dx;                /* col we are viewing on virtual screen (on page[0]) */ /* off screen buffer on the left size */\r
+       word dy;                /* row we are viewing on virtual screen (on page[0]) */ /* off screen buffer on the top size */\r
        word sw;                /* screen width */      /* resolution */\r
        word sh;                /* screen heigth */     /* resolution */\r
        word tw;                /* screen width in tiles */\r
index 652ef89c2491b898bd25908b6d63c70f5bee7504..0e2bfcf064f83b93f52bd8832826c906da2d2cf9 100755 (executable)
@@ -213,8 +213,8 @@ modexNextPage(page_t *p) {
        page_t result;\r
 \r
        result.data = p->data + (p->pagesize);\r
-       result.dx = 0;\r
-       result.dy = 0;\r
+       result.dx = p->dx;      // not used anymore we use page[0].dx\r
+       result.dy = p->dy;      // not used anymore we use page[0].dy\r
        result.sw = p->sw;\r
        result.sh = p->sh;\r
        result.width = p->width;\r
@@ -238,8 +238,8 @@ modexNextPageFlexibleSize(page_t *p, word x, word y)
        page_t result;\r
 \r
        result.data = p->data + (p->pagesize);  /* compute the offset */\r
-       result.dx = 0;\r
-       result.dy = 0;\r
+       result.dx = 0;  // not used anymore we use page[0].dx\r
+       result.dy = 0;  // not used anymore we use page[0].dy\r
        result.sw = x;\r
        result.sh = y;\r
        result.width = x;\r
@@ -294,10 +294,10 @@ void modexHiganbanaPageSetup(video_t *video)
        video->r=1;\r
 \r
        //setup the buffersize\r
-       video->page[0].dy=video->page[0].dx=\r
-               video->page[1].dx=video->page[1].dy=TILEWH;     // 1 tile size buffer\r
+       video->page[0].dy=video->page[0].dx=TILEWH;\r
+       /*      video->page[1].dx=video->page[1].dy=TILEWH;     // 1 tile size buffer\r
        video->page[2].dx=video->page[2].dy=\r
-               video->page[3].dx=video->page[3].dy=0;          // cache pages are buffer wwww\r
+               video->page[3].dx=video->page[3].dy=0;          */// cache pages are buffer wwww\r
 }\r
 \r
 //\r
@@ -310,8 +310,8 @@ modexShowPage(page_t *page) {
 \r
        /* calculate offset */\r
        offset = (word) page->data;\r
-       offset += page->dy * (page->width >> 2 );\r
-       offset += page->dx >> 2;\r
+       offset += page[0].dy * (page->width >> 2 );\r
+       offset += page[0].dx >> 2;\r
 \r
        /* calculate crtcOffset according to virtual width */\r
        crtcOffset = page->width >> 3;\r
@@ -331,7 +331,7 @@ modexShowPage(page_t *page) {
 \r
        /* do PEL panning here */\r
        outp(AC_INDEX, 0x33);\r
-       outp(AC_INDEX, (page->dx & 0x03) << 1);\r
+       outp(AC_INDEX, (page[0].dx & 0x03) << 1);\r
 }\r
 \r
 //\r
@@ -345,8 +345,8 @@ modexShowPage_(page_t *page)
 \r
        /* calculate offset */\r
        offset = (word) page->data;\r
-       offset += page->dy * (page->width >> 2 );\r
-       offset += page->dx >> 2;\r
+       offset += page[0].dy * (page->width >> 2 );\r
+       offset += page[0].dx >> 2;\r
 \r
        /* calculate crtcOffset according to virtual width */\r
        crtcOffset = page->sw >> 3;\r
@@ -366,7 +366,7 @@ modexShowPage_(page_t *page)
 \r
        /* do PEL panning here */\r
        outp(AC_INDEX, 0x33);\r
-       outp(AC_INDEX, (page->dx & 0x03) << 1);\r
+       outp(AC_INDEX, (page[0].dx & 0x03) << 1);\r
 }\r
 \r
 void\r
@@ -376,8 +376,8 @@ modexShowPageVsync(page_t *page) {
 \r
        /* calculate offset */\r
        offset = (word) page->data;\r
-       offset += page->dy * (page->width >> 2 );\r
-       offset += page->dx >> 2;\r
+       offset += page[0].dy * (page->width >> 2 );\r
+       offset += page[0].dx >> 2;\r
 \r
        /* calculate crtcOffset according to virtual width */\r
        crtcOffset = page->width >> 3;\r
@@ -397,13 +397,13 @@ modexShowPageVsync(page_t *page) {
 \r
        /* do PEL panning here */\r
        outp(AC_INDEX, 0x33);\r
-       outp(AC_INDEX, (page->dx & 0x03) << 1);\r
+       outp(AC_INDEX, (page[0].dx & 0x03) << 1);\r
 }\r
 \r
 void\r
 modexPanPage(page_t *page, int dx, int dy) {\r
-       page->dx = dx;\r
-       page->dy = dy;\r
+       page[0].dx = dx;\r
+       page[0].dy = dy;\r
 }\r
 \r
 void\r
index 0901f382ebcaf9bbab4d9c3852571d5d840724d2..7f4ff16d57934b9325926c6f4d31bb4c244f8a41 100755 (executable)
@@ -224,7 +224,7 @@ void panPageManual(map_view_t *pip, player_t *player, word pn)
                        {\r
                                if(player[pn].q<=player[pn].spt)\r
                                {\r
-                                       pip[pip[0].pan->pn].page->dx+=4;\r
+                                       pip[pip[0].pan->pn].page[0].dx+=4;\r
                                        modexShowPage(pip[pip[0].pan->pn].page);\r
                                        player[pn].q++;\r
                                } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx++; }\r
@@ -237,7 +237,7 @@ void panPageManual(map_view_t *pip, player_t *player, word pn)
                        {\r
                                if(player[pn].q<=player[pn].spt)\r
                                {\r
-                                       pip[pip[0].pan->pn].page->dx-=4;\r
+                                       pip[pip[0].pan->pn].page[0].dx-=4;\r
                                        modexShowPage(pip[pip[0].pan->pn].page);\r
                                        player[pn].q++;\r
                                } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx--; }\r
@@ -250,7 +250,7 @@ void panPageManual(map_view_t *pip, player_t *player, word pn)
                        {\r
                                if(player[pn].q<=player[pn].spt)\r
                                {\r
-                                       pip[pip[0].pan->pn].page->dy+=4;\r
+                                       pip[pip[0].pan->pn].page[0].dy+=4;\r
                                        modexShowPage(pip[pip[0].pan->pn].page);\r
                                        player[pn].q++;\r
                                } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty++; }\r
@@ -263,7 +263,7 @@ void panPageManual(map_view_t *pip, player_t *player, word pn)
                        {\r
                                if(player[pn].q<=player[pn].spt)\r
                                {\r
-                                       pip[pip[0].pan->pn].page->dy-=4;\r
+                                       pip[pip[0].pan->pn].page[0].dy-=4;\r
                                        modexShowPage(pip[pip[0].pan->pn].page);\r
                                        player[pn].q++;\r
                                } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty--; }\r
@@ -284,7 +284,7 @@ void panVmemManual(map_view_t *pip, player_t *player, word pn)
                        {\r
                                if(player[pn].q<=player[pn].spt)\r
                                {\r
-                                       pip[pip[0].pan->pn].page->dx+=4;\r
+                                       pip[pip[0].pan->pn].page[0].dx+=4;\r
                                        modexShowPageVsync(pip[pip[0].pan->pn].page);\r
                                        player[pn].q++;\r
                                } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx++; }\r
@@ -297,7 +297,7 @@ void panVmemManual(map_view_t *pip, player_t *player, word pn)
                        {\r
                                if(player[pn].q<=player[pn].spt)\r
                                {\r
-                                       pip[pip[0].pan->pn].page->dx-=4;\r
+                                       pip[pip[0].pan->pn].page[0].dx-=4;\r
                                        modexShowPageVsync(pip[pip[0].pan->pn].page);\r
                                        player[pn].q++;\r
                                } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx--; }\r
@@ -310,7 +310,7 @@ void panVmemManual(map_view_t *pip, player_t *player, word pn)
                        {\r
                                if(player[pn].q<=player[pn].spt)\r
                                {\r
-                                       pip[pip[0].pan->pn].page->dy+=4;\r
+                                       pip[pip[0].pan->pn].page[0].dy+=4;\r
                                        modexShowPageVsync(pip[pip[0].pan->pn].page);\r
                                        player[pn].q++;\r
                                } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty++; }\r
@@ -323,7 +323,7 @@ void panVmemManual(map_view_t *pip, player_t *player, word pn)
                        {\r
                                if(player[pn].q<=player[pn].spt)\r
                                {\r
-                                       pip[pip[0].pan->pn].page->dy-=4;\r
+                                       pip[pip[0].pan->pn].page[0].dy-=4;\r
                                        modexShowPageVsync(pip[pip[0].pan->pn].page);\r
                                        player[pn].q++;\r
                                } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty--; }\r
@@ -338,7 +338,7 @@ void panVmemManual(map_view_t *pip, player_t *player, word pn)
 */\r
 void modexMVSetup(map_view_t *mv, map_t *map, pan_t *pan, global_game_variables_t *gv)\r
 {\r
-       word i;\r
+       byte i;\r
        // 1st page\r
        mv[0].page = &gv->video.page[0];\r
        mv[0].map = map;\r
@@ -446,24 +446,24 @@ void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid)
        word x;//, y;  /* coordinate for drawing */\r
 \r
        /* increment the pixel position and update the page */\r
-       mv[id].page->dx += player[plid].speed;\r
+       mv[id].page[0].dx += player[plid].speed;\r
 \r
        /* check to see if this changes the tile */\r
-       if(mv[id].page->dx >= mv[id].dxThresh )\r
+       if(mv[id].page[0].dx >= mv[id].dxThresh )\r
        {\r
        /* go forward one tile */\r
        mv[id].tx++;\r
        /* Snap the origin forward */\r
        mv[id].page->data += 4;\r
 \r
-       mv[id].page->dx = mv[id].map->tiles->tileWidth;\r
+       mv[id].page[0].dx = mv[id].map->tiles->tileWidth;\r
        }\r
 \r
        /* draw the next column */\r
        x= mv[0].page->sw + mv[id].map->tiles->tileWidth;\r
        if(player[plid].q%4)\r
                if(id==0)\r
-                       mapDrawCol(&mv[0], mv[0].tx + mv[0].page->tw, mv[0].ty-1, x, player, mv->page->dx);\r
+                       mapDrawCol(&mv[0], mv[0].tx + mv[0].page->tw, mv[0].ty-1, x, player, mv->page[0].dx);\r
                else\r
                        if(!pageflipflop && !pageploop)\r
                                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));\r
@@ -476,24 +476,24 @@ void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid)
        word x;//,y;  /* coordinate for drawing */\r
 \r
        /* decrement the pixel position and update the page */\r
-       mv[id].page->dx -= player[plid].speed;\r
+       mv[id].page[0].dx -= player[plid].speed;\r
 \r
        /* check to see if this changes the tile */\r
-       if(mv[id].page->dx == 0)\r
+       if(mv[id].page[0].dx == 0)\r
        {\r
        /* go backward one tile */\r
        mv[id].tx--;\r
        /* Snap the origin backward */\r
        mv[id].page->data -= 4;\r
 \r
-       mv[id].page->dx = mv[id].map->tiles->tileWidth;\r
+       mv[id].page[0].dx = mv[id].map->tiles->tileWidth;\r
        }\r
 \r
        /* draw the next column */\r
        x= 0;\r
        if(player[plid].q%4)\r
                if(id==0)\r
-                       mapDrawCol(&mv[0], mv[0].tx - 1, mv[0].ty-1, x, player, mv->page->dx);\r
+                       mapDrawCol(&mv[0], mv[0].tx - 1, mv[0].ty-1, x, player, mv->page[0].dx);\r
                else\r
                        if(!pageflipflop && !pageploop)\r
                                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));\r
@@ -506,24 +506,24 @@ void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid)
        word y;//x,  /* coordinate for drawing */\r
 \r
        /* decrement the pixel position and update the page */\r
-       mv[id].page->dy -= player[plid].speed;\r
+       mv[id].page[0].dy -= player[plid].speed;\r
 \r
        /* check to see if this changes the tile */\r
-       if(mv[id].page->dy == 0 )\r
+       if(mv[id].page[0].dy == 0 )\r
        {\r
        /* go down one tile */\r
        mv[id].ty--;\r
        /* Snap the origin downward */\r
        mv[id].page->data -= mv[id].page->pi;\r
 \r
-       mv[id].page->dy = mv[id].map->tiles->tileHeight;\r
+       mv[id].page[0].dy = mv[id].map->tiles->tileHeight;\r
        }\r
 \r
        /* draw the next row */\r
        y= 0;\r
        if(player[plid].q%3)\r
                if(id==0)\r
-                       mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty-1, y, player, mv->page->dy);\r
+                       mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty-1, y, player, mv->page[0].dy);\r
                else\r
                        if(!pageflipflop && !pageploop)\r
                                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);\r
@@ -535,24 +535,24 @@ void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid)
        word y;//x,  /* coordinate for drawing */\r
 \r
        /* increment the pixel position and update the page */\r
-       mv[id].page->dy += player[plid].speed;\r
+       mv[id].page[0].dy += player[plid].speed;\r
 \r
        /* check to see if this changes the tile */\r
-       if(mv[id].page->dy >= mv[id].dyThresh )\r
+       if(mv[id].page[0].dy >= mv[id].dyThresh )\r
        {\r
        /* go down one tile */\r
        mv[id].ty++;\r
        /* Snap the origin downward */\r
        mv[id].page->data += mv[id].page->pi;\r
 \r
-       mv[id].page->dy = mv[id].map->tiles->tileHeight;\r
+       mv[id].page[0].dy = mv[id].map->tiles->tileHeight;\r
        }\r
 \r
        /* draw the next row */\r
        y= mv[0].page->sh + mv[id].map->tiles->tileHeight;\r
        if(player[plid].q%3)\r
                if(id==0)\r
-                       mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty+mv[0].page->th, y, player, mv->page->dy);\r
+                       mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty+mv[0].page->th, y, player, mv->page[0].dy);\r
                else\r
                        if(!pageflipflop && !pageploop)\r
                                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);\r
@@ -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)\r
 {\r
        /* increment the pixel position and update the page */\r
-       mv[id].page->dx += player[plid].speed;\r
+       mv[id].page[0].dx += player[plid].speed;\r
 \r
        /* check to see if this changes the tile */\r
-       if(mv[id].page->dx >= mv[0].dxThresh )\r
+       if(mv[id].page[0].dx >= mv[0].dxThresh )\r
        {\r
 //             vga_setup_wm1_block_copy();\r
 //             _fmemmove(mv[id].page->data+4, mv[id].page->data, mv[id].page->pagesize);\r
 //             vga_restore_rm0wm0();\r
                /* Snap the origin forward */\r
                mv[id].page->data += 4;\r
-               mv[id].page->dx = mv[0].map->tiles->tileWidth;\r
+               mv[id].page[0].dx = mv[0].map->tiles->tileWidth;\r
        }\r
 }\r
 \r
 void near ScrollLeft(map_view_t *mv, player_t *player, word id, word plid)\r
 {\r
        /* decrement the pixel position and update the page */\r
-       mv[id].page->dx -= player[plid].speed;\r
+       mv[id].page[0].dx -= player[plid].speed;\r
 \r
        /* check to see if this changes the tile */\r
-       if(mv[id].page->dx == 0)\r
+       if(mv[id].page[0].dx == 0)\r
        {\r
 //             vga_setup_wm1_block_copy();\r
 //             _fmemmove(mv[id].page->data-4, mv[id].page->data, mv[id].page->pagesize);\r
 //             vga_restore_rm0wm0();\r
                /* Snap the origin backward */\r
                mv[id].page->data -= 4;\r
-               mv[id].page->dx = mv[0].map->tiles->tileWidth;\r
+               mv[id].page[0].dx = mv[0].map->tiles->tileWidth;\r
        }\r
 }\r
 \r
 void near ScrollUp(map_view_t *mv, player_t *player, word id, word plid)\r
 {\r
        /* decrement the pixel position and update the page */\r
-       mv[id].page->dy -= player[plid].speed;\r
+       mv[id].page[0].dy -= player[plid].speed;\r
 \r
        /* check to see if this changes the tile */\r
-       if(mv[id].page->dy == 0)\r
+       if(mv[id].page[0].dy == 0)\r
        {\r
 //             vga_setup_wm1_block_copy();\r
 //             _fmemmove(mv[id].page->data-mv[id].page->pi, mv[id].page->data, mv[id].page->pagesize);\r
 //             vga_restore_rm0wm0();\r
                /* Snap the origin backward */\r
                mv[id].page->data -= mv[id].page->pi;\r
-               mv[id].page->dy = mv[0].map->tiles->tileWidth;\r
+               mv[id].page[0].dy = mv[0].map->tiles->tileWidth;\r
        }\r
 }\r
 \r
 void near ScrollDown(map_view_t *mv, player_t *player, word id, word plid)\r
 {\r
        /* increment the pixel position and update the page */\r
-       mv[id].page->dy += player[plid].speed;\r
+       mv[id].page[0].dy += player[plid].speed;\r
 \r
        /* check to see if this changes the tile */\r
-       if(mv[id].page->dy >= mv[0].dxThresh )\r
+       if(mv[id].page[0].dy >= mv[0].dxThresh )\r
        {\r
 //             vga_setup_wm1_block_copy();\r
 //             _fmemmove(mv[id].page->data+mv[id].page->pi, mv[id].page->data, mv[id].page->pagesize);\r
 //             vga_restore_rm0wm0();\r
                /* Snap the origin forward */\r
                mv[id].page->data += mv[id].page->pi;\r
-               mv[id].page->dy = mv[0].map->tiles->tileWidth;\r
+               mv[id].page[0].dy = mv[0].map->tiles->tileWidth;\r
        }\r
 }\r
 \r
@@ -713,8 +713,8 @@ void mapinitmapview(map_view_t *mv, int tx, int ty)
        /* set up the coordinates */\r
        mv[0].tx = mv[1].tx = tx;\r
        mv[0].ty = mv[1].ty = ty;\r
-       mv[0].page->dx = mv[1].page->dx = mv[2].page->dx = mv[3].page->dx = mv->map->tiles->tileWidth;\r
-       mv[0].page->dy = mv[1].page->dy = mv[2].page->dy = mv[3].page->dy = mv->map->tiles->tileHeight;\r
+       mv[0].page[0].dx = mv[1].page[0].dx = mv[2].page[0].dx = mv[3].page[0].dx = mv->map->tiles->tileWidth;\r
+       mv[0].page[0].dy = mv[1].page[0].dy = mv[2].page[0].dy = mv[3].page[0].dy = mv->map->tiles->tileHeight;\r
 \r
        /* set up the thresholds */\r
        mv[0].dxThresh = mv[1].dxThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->tiles->tileWidth * 2;\r