]> 4ch.mooo.com Git - 16.git/blobdiff - src/scroll.c
polished some variables xset and yset needs to be added wwww
[16.git] / src / scroll.c
index 21647006f348396254b94c9caa06922a4cf51935..9000d63e4b7c8a30e7ceac66a3977c95c55af85d 100644 (file)
@@ -55,7 +55,7 @@ void mapGoTo(map_view_t *mv, int tx, int ty);
 void mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y);\r
 void mapDrawRow(map_view_t *mv, int tx, int ty, word y);\r
 void mapDrawCol(map_view_t *mv, int tx, int ty, word x);\r
-void animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */short d1, short d2, 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
 \r
 #define TILEWH 16\r
 #define QUADWH (TILEWH/4)\r
@@ -143,7 +143,8 @@ void main() {
        //to stop scrolling and have the player position data move to the edge of the screen with respect to the direction\r
        //when player.tx or player.ty == 0 or player.tx == 20 or player.ty == 15 then stop because that is edge of map and you do not want to walk of the map\r
        #define INC_PER_FRAME if(player.q&1) persist_aniframe++; if(persist_aniframe>4) persist_aniframe = 1;
-\r
+
+       //right movement\r
        if((keyp(77) && !keyp(75) && player.d == 0) || player.d == 2)\r
        {
                if(player.d == 0){ player.d = 2; }\r
@@ -153,7 +154,7 @@ 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, 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);\r
                                mapScrollRight(bg, SPEED);\r
                                mapScrollRight(spri, SPEED);\r
                                //mapScrollRight(mask, SPEED);\r
@@ -168,7 +169,7 @@ void main() {
                                INC_PER_FRAME;\r
                                player.x+=SPEED;\r
                                //animatePlayer(bg, spri, mask, 1, 0, player.x, player.y, persist_aniframe, q, &ptmp);\r
-                               animatePlayer(bg, spri, 1, 0, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
+                               animatePlayer(bg, spri, player.d-1, 0, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
                                modexShowPage(spri->page);\r
                                player.q++;\r
                        } else { player.q = 1; player.d = 0; player.tx++; }\r
@@ -182,8 +183,9 @@ void main() {
                }\r
                player.triggerx = player.tx+1;\r
                player.triggery = player.ty;\r
-       }\r
+       }
 \r
+       //left movement\r
        if((keyp(75) && !keyp(77) && player.d == 0) || player.d == 4)\r
        {
                if(player.d == 0){ player.d = 4; }\r
@@ -193,7 +195,7 @@ void main() {
                        {\r
                                INC_PER_FRAME;\r
                                //animatePlayer(bg, spri, mask, 3, 1, player.x, player.y, persist_aniframe, q, &ptmp);\r
-                               animatePlayer(bg, spri, 3, 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);\r
                                mapScrollLeft(bg, SPEED);\r
                                mapScrollLeft(spri, SPEED);\r
                                //mapScrollLeft(mask, SPEED);\r
@@ -208,7 +210,7 @@ void main() {
                                INC_PER_FRAME;\r
                                player.x-=SPEED;\r
                                //animatePlayer(bg, spri, mask, 3, 0, player.x, player.y, persist_aniframe, q, &ptmp);\r
-                               animatePlayer(bg, spri, 3, 0, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
+                               animatePlayer(bg, spri, player.d-1, 0, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
                                modexShowPage(spri->page);\r
                                player.q++;\r
                        } else { player.q = 1; player.d = 0; player.tx--; }\r
@@ -222,8 +224,9 @@ void main() {
                }\r
                player.triggerx = player.tx-1;\r
                player.triggery = player.ty;\r
-       }\r
+       }
 \r
+       //down movement\r
        if((keyp(80) && !keyp(72) && player.d == 0) || player.d == 3)\r
        {
                if(player.d == 0){ player.d = 3; }\r
@@ -233,7 +236,7 @@ void main() {
                        {\r
                                INC_PER_FRAME;\r
                                //animatePlayer(bg, spri, mask, 2, 1, player.x, player.y, persist_aniframe, q, &ptmp);\r
-                               animatePlayer(bg, spri, 2, 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);\r
                                mapScrollDown(bg, SPEED);\r
                                mapScrollDown(spri, SPEED);\r
                                //mapScrollDown(mask, SPEED);\r
@@ -248,7 +251,7 @@ void main() {
                                INC_PER_FRAME;\r
                                player.y+=SPEED;\r
                                //animatePlayer(bg, spri, mask, 2, 0, player.x, player.y, persist_aniframe, q, &ptmp);\r
-                               animatePlayer(bg, spri, 2, 0, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
+                               animatePlayer(bg, spri, player.d-1, 0, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
                                modexShowPage(spri->page);\r
                                player.q++;\r
                        } else { player.q = 1; player.d = 0; player.ty++; }\r
@@ -263,7 +266,8 @@ void main() {
                player.triggerx = player.tx;\r
                player.triggery = player.ty+1;\r
        }\r
-\r
+
+       //up movement\r
        if((keyp(72) && !keyp(80) && player.d == 0) || player.d == 1)\r
        {
                if(player.d == 0){ player.d = 1; }\r
@@ -273,7 +277,7 @@ void main() {
                        {\r
                                INC_PER_FRAME;\r
                                //animatePlayer(bg, spri, mask, 0, 1, player.x, player.y, persist_aniframe, q, &ptmp);\r
-                               animatePlayer(bg, spri, 0, 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);\r
                                mapScrollUp(bg, SPEED);\r
                                mapScrollUp(spri, SPEED);\r
                                //mapScrollUp(mask, SPEED);\r
@@ -289,7 +293,7 @@ void main() {
                                player.y-=SPEED;\r
                                //animatePlayer(bg, spri, mask, 0, 0, player.x, player.y, persist_aniframe, q, &ptmp);\r
                                modexShowPage(spri->page);\r
-                               animatePlayer(bg, spri, 0, 0, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
+                               animatePlayer(bg, spri, player.d-1, 0, player.x, player.y, persist_aniframe, player.q, &ptmp);\r
                                player.q++;\r
                        } else { player.q = 1; player.d = 0; player.ty--; }\r
                }\r
@@ -565,14 +569,14 @@ mapDrawCol(map_view_t *mv, int tx, int ty, word x) {
 }\r
 \r
 void\r
-animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */short d1, short d2, int x, int y, int ls, int lp, bitmap_t *bmp)\r
+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
 {\r
-       short dire=32*d1; //direction\r
-       short qq; //scroll offset\r
+       sword dire=32*d; //direction\r
+       sword qq; //scroll offset\r
 \r
-       if(d2==0) qq = 0;\r
+       if(scrolloffsetswitch==0) qq = 0;\r
        else qq = ((lp)*SPEED);\r
-       switch (d1)\r
+       switch (d)\r
        {\r
                case 0:\r
                        //up\r