]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/scroll16.c
animation fixed and sprite rendering is more flexible with overdraww and overdrawh
[16.git] / src / lib / scroll16.c
index 2d9de4f97622c50ccfddbba95de926e877b199c0..8d02cacd465adef995e86326298ce58ce1a95097 100755 (executable)
 */\r
 #include "src/lib/scroll16.h"\r
 \r
-#define INC_PER_FRAME_PRINT    sprintf(global_temp_status_text, "%u", player[pn].enti.persist_aniframe);\\r
-modexprint(&(pip->video->page[0]), player[pn].enti.x-(8*player[pn].enti.persist_aniframe), player[pn].enti.y-TILEWH-(8*player[pn].enti.persist_aniframe), 1, 20, 1, global_temp_status_text);\r
-\r
-//#define WALKTYPE_FRAM_PRINT INC_PER_FRAME_PRINT\r
-//walktypeinfo(player, pn);\r
-//modexprint(&(pip->video->page[0]), player[pn].enti.x-(8*player[pn].enti.persist_aniframe)+8, player[pn].enti.y-TILEWH-(8*player[pn].enti.persist_aniframe), 1, 20, 1, global_temp_status_text);\r
-\r
-#define PERSIST_ANIFRAME_INIT 1\r
-#define Q_INIT PERSIST_ANIFRAME_INIT\r
-#define INC_PER_FRAME if(player[pn].enti.q&1) player[pn].enti.persist_aniframe++; if(player[pn].enti.persist_aniframe>4) player[pn].enti.persist_aniframe = PERSIST_ANIFRAME_INIT;\r
+#define INC_PER_FRAME if(player[pn].enti.q&1) player[pn].enti.persist_aniframe++; if(player[pn].enti.persist_aniframe>4) player[pn].enti.persist_aniframe = 1;\r
 \r
 void ZC_walk(map_view_t *pip, player_t *player, word pn)\r
 {\r
@@ -58,7 +49,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                                        mapScrollRight(pip, player, (pip[0].video->p), pn);\r
                                        player[pn].enti.q++;\r
                                        //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
                        }\r
                        else if(player[pn].enti.tx < pip[0].map->width && !(pip[0].map->data[(player[pn].enti.tx)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx+1 == TRIGGX && player[pn].enti.ty == TRIGGY))\r
                        {\r
@@ -69,7 +60,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                                        player[pn].enti.x+=(player[pn].enti.speed);\r
                                        ANIMATESPRIFUN(pip, player, pn, 1);\r
                                        player[pn].enti.q++;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
                        }\r
                        else\r
                        {\r
@@ -95,7 +86,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                                        mapScrollLeft(pip, player, (pip[0].video->p), pn);\r
                                        player[pn].enti.q++;\r
                                        //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
                        }\r
                        else if(player[pn].enti.tx > 1 && !(pip[0].map->data[(player[pn].enti.tx-2)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx-1 == TRIGGX && player[pn].enti.ty == TRIGGY))\r
                        {\r
@@ -106,7 +97,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                                        player[pn].enti.x-=(player[pn].enti.speed);\r
                                        ANIMATESPRIFUN(pip, player, pn, 1);\r
                                        player[pn].enti.q++;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
                        }\r
                        else\r
                        {\r
@@ -132,7 +123,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                                        mapScrollDown(pip, player, (pip[0].video->p), pn);\r
                                        player[pn].enti.q++;\r
                                        //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
                        }\r
                        else if(player[pn].enti.ty < pip[0].map->height && !(pip[0].map->data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty+1 == TRIGGY))\r
                        {\r
@@ -143,7 +134,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                                        player[pn].enti.y+=(player[pn].enti.speed);\r
                                        ANIMATESPRIFUN(pip, player, pn, 1);\r
                                        player[pn].enti.q++;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
                        }\r
                        else\r
                        {\r
@@ -169,7 +160,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                                        mapScrollUp(pip, player, (pip[0].video->p), pn);\r
                                        player[pn].enti.q++;\r
                                        //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
                        }\r
                        else if(player[pn].enti.ty > 1 && !(pip[0].map->data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty-2))] == 0))//!(player[pn].enti.tx == TRIGGX &&  player[pn].enti.ty-1 == TRIGGY))\r
                        {\r
@@ -180,7 +171,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                                        player[pn].enti.y-=(player[pn].enti.speed);\r
                                        ANIMATESPRIFUN(pip, player, pn, 1);\r
                                        player[pn].enti.q++;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
                        }\r
                        else\r
                        {\r
@@ -230,7 +221,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn)
                                        if(!pageflipflop) modexShowPage(pip[1].page);\r
                                        player[pn].enti.q++;\r
                                        //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
                        }\r
                        else if(player[pn].enti.tx < pip[0].map->width && !(pip[0].map->data[(player[pn].enti.tx)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx+1 == TRIGGX && player[pn].enti.ty == TRIGGY))\r
                        {\r
@@ -241,7 +232,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn)
                                        ANIMATESPRIFUN(pip, player, pn, 0);\r
                                        if(!pageflipflop) modexShowPage(pip[1].page);\r
                                        player[pn].enti.q++;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
                        }\r
                        else\r
                        {\r
@@ -274,7 +265,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn)
                                        if(!pageflipflop) modexShowPage(pip[1].page);\r
                                        player[pn].enti.q++;\r
                                        //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
                        }\r
                        else if(player[pn].enti.tx > 1 && !(pip[0].map->data[(player[pn].enti.tx-2)+(pip[0].map->width*(player[pn].enti.ty-1))] == 0))//!(player[pn].enti.tx-1 == TRIGGX && player[pn].enti.ty == TRIGGY))\r
                        {\r
@@ -285,7 +276,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn)
                                        ANIMATESPRIFUN(pip, player, pn, 0);\r
                                        if(!pageflipflop) modexShowPage(pip[1].page);\r
                                        player[pn].enti.q++;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
                        }\r
                        else\r
                        {\r
@@ -318,7 +309,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn)
                                        if(!pageflipflop) modexShowPage(pip[1].page);\r
                                        player[pn].enti.q++;\r
                                        //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
                        }\r
                        else if(player[pn].enti.ty < pip[0].map->height && !(pip[0].map->data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty))] == 0))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty+1 == TRIGGY))\r
                        {\r
@@ -329,7 +320,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn)
                                        ANIMATESPRIFUN(pip, player, pn, 0);\r
                                        if(!pageflipflop) modexShowPage(pip[1].page);\r
                                        player[pn].enti.q++;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
                        }\r
                        else\r
                        {\r
@@ -362,7 +353,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn)
                                        if(!pageflipflop) modexShowPage(pip[1].page);\r
                                        player[pn].enti.q++;\r
                                        //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
                        }\r
                        else if(player[pn].enti.ty > 1 && !(pip[0].map->data[(player[pn].enti.tx-1)+(pip[0].map->width*(player[pn].enti.ty-2))] == 0))//!(player[pn].enti.tx == TRIGGX &&  player[pn].enti.ty-1 == TRIGGY))\r
                        {\r
@@ -373,7 +364,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn)
                                        ANIMATESPRIFUN(pip, player, pn, 0);\r
                                        if(!pageflipflop) modexShowPage(pip[1].page);\r
                                        player[pn].enti.q++;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
                        }\r
                        else\r
                        {\r
@@ -407,7 +398,7 @@ void ZC_panPageManual(map_view_t *pip, player_t *player, word pn)
                                        pip[0].page->dx+=4;\r
                                        SHOWMVFUN_;\r
                                        player[pn].enti.q++;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; pip[0].tx++; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; pip[0].tx++; }\r
                        }\r
                break;\r
 \r
@@ -420,7 +411,7 @@ void ZC_panPageManual(map_view_t *pip, player_t *player, word pn)
                                        pip[0].page->dx-=4;\r
                                        SHOWMVFUN_;\r
                                        player[pn].enti.q++;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; pip[0].tx--; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; pip[0].tx--; }\r
                        }\r
                break;\r
 \r
@@ -433,7 +424,7 @@ void ZC_panPageManual(map_view_t *pip, player_t *player, word pn)
                                        pip[0].page->dy+=4;\r
                                        SHOWMVFUN_;\r
                                        player[pn].enti.q++;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; pip[0].ty++; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; pip[0].ty++; }\r
                        }\r
                break;\r
 \r
@@ -446,7 +437,7 @@ void ZC_panPageManual(map_view_t *pip, player_t *player, word pn)
                                        pip[0].page->dy-=4;\r
                                        SHOWMVFUN_;\r
                                        player[pn].enti.q++;\r
-                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; pip[0].ty--; }\r
+                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; pip[0].ty--; }\r
                        }\r
                break;\r
        }\r
@@ -1129,14 +1120,14 @@ void near ZC_drawframe(map_view_t *pip, entity_t *enti, sword x, sword y)
 #define FRAME4 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, 1+player[pn].enti.dire);\r
 #endif\r
 \r
-void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scrollswitch)\r
+void /*near*/ animatePlayer(map_view_t *pip, player_t *player, word pn, sword scrollswitch)\r
 {\r
        sword x = player[pn].enti.x;\r
        sword y = player[pn].enti.y;\r
        sword bx = x+16;        //buffer's x\r
        sword by = y+16;        //buffer's y\r
        sword qq; //scroll offset\r
-       word ls = player[pn].enti.persist_aniframe;\r
+       word ls = 0;//player[pn].enti.persist_aniframe;\r
        player[pn].enti.dire=32; //direction\r
 \r
        switch(scrollswitch)\r
@@ -1281,7 +1272,6 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scr
        ZC_drawframe(pip, &player[pn].enti, x, y);\r
 //if(player[pn].enti.q<4) delay(500);\r
        pip->video->r=1;\r
-       //WALKTYPE_FRAM_PRINT;\r
 }\r
 \r
 /*\r
@@ -1340,7 +1330,7 @@ void player_walk(player_t *player, map_view_t *map_v){
        }\r
 }\r
 \r
-void near mapScroll(map_view_t *mv, player_t *player)\r
+void /*near*/ mapScroll(map_view_t *mv, player_t *player)\r
 {\r
        //word x, y;  /* coordinate for drawing */\r
        int c = 1;\r