]> 4ch.mooo.com Git - 16.git/commitdiff
attempted to make static page buffer system ww
authorsparky4 <sparky4@cock.li>
Wed, 15 Jun 2016 17:58:05 +0000 (12:58 -0500)
committersparky4 <sparky4@cock.li>
Wed, 15 Jun 2016 17:58:05 +0000 (12:58 -0500)
src/lib/modex16.c
src/lib/scroll16.c
src/scroll.c

index f3a7c7769e76b5a2755d9de2115f34751668e58f..2ed2e9839b9c3cffe6647063eafe83e3ab9ea012 100755 (executable)
@@ -251,7 +251,8 @@ modexNextPageFlexibleSize(page_t *p, word x, word y)
        result.id = p->id+1;\r
        result.stridew=result.width/4;\r
        result.pagesize = (word)(result.width/4)*result.height;\r
-       if(result.id==2)                result.pi=p->width;//*p->pi;\r
+       if(result.id==2)\r
+               result.pi=p->width*p->pi;\r
        else if(result.id==3)   result.pi=p->pi;\r
 \r
        return result;\r
index 248a1a09e0f0a3b27d1ca0388f7add7207eaf518..fc9737695db6dd1cb5687b5c28db6ce566a70043 100755 (executable)
@@ -46,8 +46,8 @@ void walk(map_view_t *pip, player_t *player, word pn)
                                        animatePlayer(pip, player, pn, 1);
                                        ScrollRight(pip, player, 3, pn);
                                        ScrollRight(pip, player, 2, pn);
-                                       mapScrollRight(pip, player, (pip[0].video->p), pn);
                                        mapScrollRight(pip, player, !(pip[0].video->p), pn);
+                                       mapScrollRight(pip, player, (pip[0].video->p), pn);
                                        if(!pageflipflop) modexShowPage(pip[1].page);
                                        player[pn].q++;
                                        pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;
@@ -90,8 +90,8 @@ void walk(map_view_t *pip, player_t *player, word pn)
                                        animatePlayer(pip, player, pn, 1);
                                        ScrollLeft(pip, player, 3, pn);
                                        ScrollLeft(pip, player, 2, pn);
-                                       mapScrollLeft(pip, player, (pip[0].video->p), pn);
                                        mapScrollLeft(pip, player, !(pip[0].video->p), pn);
+                                       mapScrollLeft(pip, player, (pip[0].video->p), pn);
                                        if(!pageflipflop) modexShowPage(pip[1].page);
                                        player[pn].q++;
                                        pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;
@@ -134,8 +134,8 @@ void walk(map_view_t *pip, player_t *player, word pn)
                                        animatePlayer(pip, player, pn, 1);
                                        ScrollDown(pip, player, 3, pn);
                                        ScrollDown(pip, player, 2, pn);
-                                       mapScrollDown(pip, player, (pip[0].video->p), pn);
                                        mapScrollDown(pip, player, !(pip[0].video->p), pn);
+                                       mapScrollDown(pip, player, (pip[0].video->p), pn);
                                        if(!pageflipflop) modexShowPage(pip[1].page);
                                        player[pn].q++;
                                        pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;
@@ -178,8 +178,8 @@ void walk(map_view_t *pip, player_t *player, word pn)
                                        animatePlayer(pip, player, pn, 1);
                                        ScrollUp(pip, player, 3, pn);
                                        ScrollUp(pip, player, 2, pn);
-                                       mapScrollUp(pip, player, (pip[0].video->p), pn);
                                        mapScrollUp(pip, player, !(pip[0].video->p), pn);
+                                       mapScrollUp(pip, player, (pip[0].video->p), pn);
                                        if(!pageflipflop) modexShowPage(pip[1].page);
                                        player[pn].q++;
                                        pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;
@@ -485,8 +485,13 @@ void near ScrollRight(map_view_t *mv, player_t *player, word id, word plid)
        /* check to see if this changes the tile */
        if(mv[0].video->page[id].dx >= mv[0].dxThresh )
        {
+               /* block copy pattern to where we will draw the sprite */
+               vga_setup_wm1_block_copy();
+               _fmemmove(mv[0].video->page[id].data-4, mv[0].video->page[id].data, mv[0].video->page[id].pagesize);
+               /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */
+               vga_restore_rm0wm0();
                /* Snap the origin forward */
-               mv[0].video->page[id].data += mv[0].video->page[id].pi;
+               mv[0].video->page[id].data += 4;
                mv[0].video->page[id].dx = mv[0].map->tiles->tileWidth;
        }
 }
@@ -500,8 +505,13 @@ void near ScrollLeft(map_view_t *mv, player_t *player, word id, word plid)
        /* check to see if this changes the tile */
        if(mv[0].video->page[id].dx == 0)
        {
+               /* block copy pattern to where we will draw the sprite */
+               vga_setup_wm1_block_copy();
+               _fmemmove(mv[0].video->page[id].data-4, mv[0].video->page[id].data, mv[0].video->page[id].pagesize);
+               /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */
+               vga_restore_rm0wm0();
                /* Snap the origin backward */
-               mv[0].video->page[id].data -= mv[0].video->page[id].pi;
+               mv[0].video->page[id].data -= 4;
                mv[0].video->page[id].dx = mv[0].map->tiles->tileWidth;
        }
 }
@@ -514,8 +524,13 @@ void near ScrollUp(map_view_t *mv, player_t *player, word id, word plid)
        /* check to see if this changes the tile */
        if(mv[0].video->page[id].dy == 0)
        {
+               /* block copy pattern to where we will draw the sprite */
+               vga_setup_wm1_block_copy();
+               _fmemmove(mv[0].video->page[id].data-mv[0].video->page[id].pi, mv[0].video->page[id].data, mv[0].video->page[id].pagesize);
+               /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */
+               vga_restore_rm0wm0();
                /* Snap the origin backward */
-               mv[0].video->page[id].data -= mv[0].video->page[id].pi;//4;
+               mv[0].video->page[id].data -= mv[0].video->page[id].pi;
                mv[0].video->page[id].dy = mv[0].map->tiles->tileWidth;
        }
 }
@@ -528,8 +543,13 @@ void near ScrollDown(map_view_t *mv, player_t *player, word id, word plid)
        /* check to see if this changes the tile */
        if(mv[0].video->page[id].dy >= mv[0].dxThresh )
        {
+               /* block copy pattern to where we will draw the sprite */
+               vga_setup_wm1_block_copy();
+               _fmemmove(mv[0].video->page[id].data+mv[0].video->page[id].pi, mv[0].video->page[id].data, mv[0].video->page[id].pagesize);
+               /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */
+               vga_restore_rm0wm0();
                /* Snap the origin forward */
-               mv[0].video->page[id].data += mv[0].video->page[id].pi;//4;
+               mv[0].video->page[id].data += mv[0].video->page[id].pi;
                mv[0].video->page[id].dy = mv[0].map->tiles->tileWidth;
        }
 }
@@ -600,12 +620,7 @@ void mapGoTo(map_view_t *mv, int tx, int ty)
                mapDrawWRow(&mv[0], tx-1, ty, py);
        i+=mv->map->width - tx;
        }
-       /* block copy pattern to where we will draw the sprite */
-       vga_setup_wm1_block_copy();
-       //_fmemcpy(mv[1].page->data, mv[0].page->data, mv[0].page->pagesize);
        modexCopyPageRegion(mv[1].page, mv[0].page, 0, 0, 0, 0, mv[0].page->width, mv[0].page->height);
-       /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */
-       vga_restore_rm0wm0();
        modexCopyPageRegion(mv[3].page, mv[!(mv->video->p)].page, 0/**/, 0/**/, 0, 128, 28, 36);
 }
 
index 3e7032e5e43504ec885423c3b60ff607430ffcd7..a3b44bb561606181ddb08d838f750b4a16d7d69e 100755 (executable)
@@ -177,6 +177,7 @@ void main(int argc, char *argv[])
                mv[i].video = &gvar.video;
                mv[i].pan       = &pan;
        }
+
        /* set up paging */
        //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen
        mapGoTo(mv, 0, 0);
@@ -200,7 +201,12 @@ void main(int argc, char *argv[])
        if(!pageflipflop)       modexShowPage(mv[1].page);
        else                    modexShowPage(mv[(gvar.video.p)].page);
                shinku_fps_indicator_page = 1; // we're on page 1 now, shinku(). follow along please or it will not be visible.
-       //modexClearRegion(mv[2].page, 0, 0, mv[2].page->width, mv[2].page->height, 1);
+
+       /* buffer pages */
+       modexClearRegion(mv[2].page, 0, 0, mv[2].page->width, mv[2].page->height, 47);
+       modexClearRegion(mv[3].page, 0, 0, mv[3].page->width, mv[3].page->height, 45);
+       modexClearRegion(mv[3].page, 0, 128, 28, 36, 15);
+
 #ifdef MODEX
 #ifdef FADE
        modexFadeOn(4, gpal);
@@ -276,7 +282,9 @@ void main(int argc, char *argv[])
        }
        if(IN_KeyDown(67))      //f9
        {
-               modexClearRegion(mv[3].page, 0, 0/*128*/, 28, 36, 15);
+               modexClearRegion(mv[2].page, 0, 0, mv[2].page->width, mv[2].page->height, 47);
+               modexClearRegion(mv[3].page, 0, 0, mv[3].page->width, mv[3].page->height, 45);
+               modexClearRegion(mv[3].page, 0, 128, 28, 36, 15);
                //IN_UserInput(1,1);
        }
        //TODO fmemtest into page