]> 4ch.mooo.com Git - 16.git/blobdiff - src/scroll.c
optimization of scrolling routines of pages is finished~
[16.git] / src / scroll.c
index 39990d1f10f691dbdab06153d50f6c905f92acdc..d9ad13a98455aa888002dd47abd2a6718325ca02 100644 (file)
@@ -49,7 +49,7 @@ void mapDrawRow(map_view_t *mv, int tx, int ty, word y);
 void mapDrawCol(map_view_t *mv, int tx, int ty, word x);\r
 void qclean();\r
 void pdump(map_view_t *pee);\r
-void animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */sword d, short scrolloffsetswitch, int x, int y, int ls, int lp, bitmap_t *bmp);\r
+void animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */sword d, short scrolloffsetswitch, int x, int y, int ls, int lp, bitmap_t *bmp);
 \r
 #define TILEWH 16\r
 #define QUADWH                 TILEWH/2\r
@@ -208,9 +208,6 @@ void main() {
        bg = &mv[0];\r
        spri = &mv[1];\r
        mask = &mv[2];
-       //pgid[0].mv = &mv;
-       //pgid[1].mv = &mv2;
-       //pgid[2].mv = &mv3;\r
 \r
 //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen\r
        mapGoTo(bg, 0, 0);\r
@@ -264,9 +261,9 @@ void main() {
                        {\r
                                INC_PER_FRAME;\r
                                //animatePlayer(bg, spri, mask, 1, 1, player.x, player.y, persist_aniframe, q, &ptmp);\r
-                               animatePlayer(bg, spri, player.d-1, 1, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
+                               animatePlayer(bg, spri, player.d-1, 1, player.x, player.y, persist_aniframe, player.q, &ptmp);
                                mapScrollRight(mv, SPEED, 0);\r
-                               mapScrollRight(mv, SPEED, 1);\r
+                               mapScrollRight(mv, SPEED, 1);
                                //mapScrollRight(mask, SPEED);\r
                                modexShowPage(spri->page);\r
                                player.q++;\r
@@ -707,8 +704,8 @@ initMap(map_t *map) {
                }\r
                //tile = tile ? 0 : 1;\r
        }*/\r
-}\r
-\r
+}
+
 \r
 void\r
 mapScrollRight(map_view_t *mv, byte offset, word id)
@@ -729,7 +726,7 @@ mapScrollRight(map_view_t *mv, byte offset, word id)
        /* draw the next column */\r
        x= SCREEN_WIDTH + mv[id].map->tiles->tileWidth;\r
                if(id==0)
-                       mapDrawCol(&mv[id], mv[id].tx + 20 , mv[id].ty-1, x);
+                       mapDrawCol(&mv[0], mv[0].tx + 20 , mv[0].ty-1, x);
                else
                        modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*17);
        }\r
@@ -753,11 +750,12 @@ mapScrollLeft(map_view_t *mv, byte offset, word id)
        mv[id].page->data -= 4;\r
        mv[id].page->dx = mv[id].map->tiles->tileWidth;\r
 \r
-       /* draw the next column */\r
+       /* draw the next column */
+       x= 0;\r
                if(id==0)\r
-                       mapDrawCol(&mv[0], mv[id].tx-1, mv[id].ty-1, 0);
+                       mapDrawCol(&mv[0], mv[0].tx-1, mv[0].ty-1, 0);
                else
-                       modexCopyPageRegion(mv[id].page, mv[0].page, 0, 0, 0, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*17);\r
+                       modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*17);\r
        }\r
 }\r
 \r
@@ -779,11 +777,11 @@ mapScrollUp(map_view_t *mv, byte offset, word id)
        mv[id].page->dy = mv[id].map->tiles->tileHeight;\r
 \r
        /* draw the next row */\r
-       //y= 0;\r
+       y= 0;\r
                if(id==0)\r
-                       mapDrawRow(&mv[0], mv[id].tx-1 , mv[id].ty-1, 0);
+                       mapDrawRow(&mv[0], mv[0].tx-1 , mv[0].ty-1, 0);
                else\r
-                       modexCopyPageRegion(mv[id].page, mv[0].page, 0, 0, 0, 0, mv[id].map->tiles->tileWidth*22, mv[id].map->tiles->tileHeight);
+                       modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*22, mv[id].map->tiles->tileHeight);
        }\r
 }\r
 \r
@@ -807,7 +805,7 @@ mapScrollDown(map_view_t *mv, byte offset, word id)
        /* draw the next row */\r
        y= SCREEN_HEIGHT + mv[id].map->tiles->tileHeight;\r
                if(id==0)\r
-                       mapDrawRow(&mv[0], mv[id].tx-1 , mv[id].ty+15, y);
+                       mapDrawRow(&mv[0], mv[0].tx-1 , mv[0].ty+15, y);
                else
                        modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*22, mv[id].map->tiles->tileHeight);\r
        }\r