]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/scroll16.c
====animation mostly converted==== old bug resurfaced as animation is 12341234 instea...
[16.git] / src / lib / scroll16.c
index dacc9cbd8075cc03ec0940281388b057d1ee7496..819e5290c3d2a41bdc4a197a3b2d0f27bfffcd3d 100755 (executable)
 */\r
 #include "src/lib/scroll16.h"\r
 \r
-#define ANIMATESPRIFUN ZC_animatePlayer\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 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; INC_PER_FRAME_PRINT\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
 \r
 void ZC_walk(map_view_t *pip, player_t *player, word pn)\r
 {\r
@@ -43,6 +48,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                        if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tw < pip[0].map->width && player[pn].enti.tx == pip[0].tx+pip[0].page->tilemidposscreenx &&\r
                        !(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))  //collision detection!\r
                        {\r
+                               player[pn].walktype=2;\r
                                if(player[pn].enti.q<=player[pn].enti.spt)\r
                                {\r
                                        INC_PER_FRAME;\r
@@ -52,20 +58,22 @@ 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 = 1; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
+                               } else { player[pn].enti.q = Q_INIT; 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
+                               player[pn].walktype=1;\r
                                if(player[pn].enti.q<=player[pn].enti.spt)\r
                                {\r
                                        INC_PER_FRAME;\r
                                        player[pn].enti.x+=(player[pn].enti.speed);\r
                                        ANIMATESPRIFUN(pip, player, pn, 0);\r
                                        player[pn].enti.q++;\r
-                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
+                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
                        }\r
                        else\r
                        {\r
+                               player[pn].walktype=0;\r
 //#ifdef SPRITE\r
 //modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 24, 32, PLAYERBMPDATAPTR);\r
                                ANIMATESPRIFUN(pip, player, pn, 0);\r
@@ -76,12 +84,14 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                        }\r
                        player[pn].enti.triggerx = player[pn].enti.tx+1;\r
                        player[pn].enti.triggery = player[pn].enti.ty;\r
+                       //WALKTYPE_FRAM_PRINT\r
                break;\r
                //left movement\r
                case 1:\r
                        if(pip[0].tx > 0 && pip[0].tx+pip[0].page->tw <= pip[0].map->width && player[pn].enti.tx == pip[0].tx+pip[0].page->tilemidposscreenx &&\r
                        !(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))        //collision detection!\r
                        {\r
+                               player[pn].walktype=2;\r
                                if(player[pn].enti.q<=player[pn].enti.spt)\r
                                {\r
                                        INC_PER_FRAME;\r
@@ -91,20 +101,22 @@ 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 = 1; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
+                               } else { player[pn].enti.q = Q_INIT; 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
+                               player[pn].walktype=1;\r
                                if(player[pn].enti.q<=player[pn].enti.spt)\r
                                {\r
                                        INC_PER_FRAME;\r
                                        player[pn].enti.x-=(player[pn].enti.speed);\r
                                        ANIMATESPRIFUN(pip, player, pn, 0);\r
                                        player[pn].enti.q++;\r
-                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
+                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
                        }\r
                        else\r
                        {\r
+                               player[pn].walktype=0;\r
 //#ifdef SPRITE\r
 //modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 96, 24, 32, PLAYERBMPDATAPTR);\r
                                ANIMATESPRIFUN(pip, player, pn, 0);\r
@@ -115,12 +127,14 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                        }\r
                        player[pn].enti.triggerx = player[pn].enti.tx-1;\r
                        player[pn].enti.triggery = player[pn].enti.ty;\r
+                       //WALKTYPE_FRAM_PRINT\r
                break;\r
                //down movement\r
                case 4:\r
                        if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->th < pip[0].map->height && player[pn].enti.ty == pip[0].ty+pip[0].page->tilemidposscreeny &&\r
                        !(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))  //collision detection!\r
                        {\r
+                               player[pn].walktype=2;\r
                                if(player[pn].enti.q<=player[pn].enti.spt)\r
                                {\r
                                        INC_PER_FRAME;\r
@@ -130,20 +144,22 @@ 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 = 1; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
+                               } else { player[pn].enti.q = Q_INIT; 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
+                               player[pn].walktype=1;\r
                                if(player[pn].enti.q<=player[pn].enti.spt)\r
                                {\r
                                        INC_PER_FRAME;\r
                                        player[pn].enti.y+=(player[pn].enti.speed);\r
                                        ANIMATESPRIFUN(pip, player, pn, 0);\r
                                        player[pn].enti.q++;\r
-                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
+                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
                        }\r
                        else\r
                        {\r
+                               player[pn].walktype=0;\r
 //#ifdef SPRITE\r
 //modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 64, 24, 32, PLAYERBMPDATAPTR);\r
                                ANIMATESPRIFUN(pip, player, pn, 0);\r
@@ -154,12 +170,14 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                        }\r
                        player[pn].enti.triggerx = player[pn].enti.tx;\r
                        player[pn].enti.triggery = player[pn].enti.ty+1;\r
+                       //WALKTYPE_FRAM_PRINT\r
                break;\r
                //up movement\r
                case 0:\r
                        if(pip[0].ty > 0 && pip[0].ty+pip[0].page->th <= pip[0].map->height && player[pn].enti.ty == pip[0].ty+pip[0].page->tilemidposscreeny &&\r
                        !(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))        //collision detection!\r
                        {\r
+                               player[pn].walktype=2;\r
                                if(player[pn].enti.q<=player[pn].enti.spt)\r
                                {\r
                                        INC_PER_FRAME;\r
@@ -169,20 +187,22 @@ 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 = 1; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
+                               } else { player[pn].enti.q = Q_INIT; 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
+                               player[pn].walktype=1;\r
                                if(player[pn].enti.q<=player[pn].enti.spt)\r
                                {\r
                                        INC_PER_FRAME;\r
                                        player[pn].enti.y-=(player[pn].enti.speed);\r
                                        ANIMATESPRIFUN(pip, player, 0, pn);\r
                                        player[pn].enti.q++;\r
-                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
+                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
                        }\r
                        else\r
                        {\r
+                               player[pn].walktype=0;\r
 //#ifdef SPRITE\r
 //modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 0, 24, 32, PLAYERBMPDATAPTR);\r
                                ANIMATESPRIFUN(pip, player, pn, 0);\r
@@ -193,8 +213,11 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                        }\r
                        player[pn].enti.triggerx = player[pn].enti.tx;\r
                        player[pn].enti.triggery = player[pn].enti.ty-1;\r
+                       //WALKTYPE_FRAM_PRINT\r
                break;\r
        }\r
+       //if(player[pn].enti.d!=2 && pip[0].video->rs) IN_UserInput(1,1);\r
+       //else if(!pip[0].video->rs) delay(500);\r
 }\r
 \r
 \r
@@ -233,7 +256,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 = 1; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
+                               } else { player[pn].enti.q = Q_INIT; 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
@@ -244,7 +267,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 = 1; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
+                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
                        }\r
                        else\r
                        {\r
@@ -277,7 +300,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 = 1; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
+                               } else { player[pn].enti.q = Q_INIT; 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
@@ -288,7 +311,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 = 1; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
+                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
                        }\r
                        else\r
                        {\r
@@ -321,7 +344,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 = 1; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
+                               } else { player[pn].enti.q = Q_INIT; 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
@@ -332,7 +355,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 = 1; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
+                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
                        }\r
                        else\r
                        {\r
@@ -365,7 +388,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 = 1; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
+                               } else { player[pn].enti.q = Q_INIT; 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
@@ -376,7 +399,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn)
                                        ANIMATESPRIFUN(pip, player, 0, pn);\r
                                        if(!pageflipflop) modexShowPage(pip[1].page);\r
                                        player[pn].enti.q++;\r
-                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
+                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
                        }\r
                        else\r
                        {\r
@@ -410,7 +433,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 = 1; player[pn].enti.d = 2; pip[0].tx++; }\r
+                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; pip[0].tx++; }\r
                        }\r
                break;\r
 \r
@@ -423,7 +446,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 = 1; player[pn].enti.d = 2; pip[0].tx--; }\r
+                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; pip[0].tx--; }\r
                        }\r
                break;\r
 \r
@@ -436,7 +459,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 = 1; player[pn].enti.d = 2; pip[0].ty++; }\r
+                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; pip[0].ty++; }\r
                        }\r
                break;\r
 \r
@@ -449,7 +472,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 = 1; player[pn].enti.d = 2; pip[0].ty--; }\r
+                               } else { player[pn].enti.q = Q_INIT; player[pn].enti.d = 2; pip[0].ty--; }\r
                        }\r
                break;\r
        }\r
@@ -1103,31 +1126,8 @@ void shinku(global_game_variables_t *gv)
        }\r
 }\r
 \r
-void near ZC_drawframe(map_view_t *pip, player_t *player, word pn, sword x, sword y, word dire, word sw)\r
+void near ZC_drawframe(map_view_t *pip, player_t *player, word pn, sword x, sword y, word sw)\r
 {\r
-       int i=0;\r
-\r
-       switch(sw)\r
-       {\r
-               case 1:\r
-                       dire+=2;\r
-               break;\r
-               case 2:\r
-                       dire+=1;\r
-               break;\r
-//             case 3:\r
-//                     dire=dire;\r
-//             break;\r
-               case 4:\r
-                       dire+=2;\r
-               break;\r
-       }\r
-       if(pip[0].video->rs<2)\r
-       {\r
-               i = set_anim_by_id(player[pn].ent->spri, dire); if (i == -1) return;\r
-               //printf("RS<2\n");\r
-       }\r
-\r
        switch(pip[0].video->rs)\r
        {\r
                case 0:\r
@@ -1137,26 +1137,21 @@ void near ZC_drawframe(map_view_t *pip, player_t *player, word pn, sword x, swor
                        oldanimate_spri(player[pn].ent->spri, pip->video);\r
                break;\r
                case 2:\r
-                       modexClearRegion(&(pip[0].page[0]), x, y, 16, 32, dire);\r
+                       modexClearRegion(&(pip[0].page[0]), x, y, 16, 32, player[pn].enti.dire);\r
                break;\r
        }\r
 }\r
 \r
-/*void ZC_odrawframe()\r
-{\r
-\r
-}*/\r
-\r
 #ifdef SPRITE\r
-#define FRAME1 modexDrawSpriteRegion(pip[/*!*/(pip->video->p)].page, x, y, 48, dire, 24, 32,   PLAYERBMPDATAPTR);\r
-#define FRAME2 modexDrawSpriteRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, dire, 24, 32,   PLAYERBMPDATAPTR);\r
-#define FRAME3 modexDrawSpriteRegion(pip[/*!*/(pip->video->p)].page, x, y, 0, dire, 24, 32,    PLAYERBMPDATAPTR);\r
-#define FRAME4 modexDrawSpriteRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, dire, 24, 32,   PLAYERBMPDATAPTR);\r
+#define FRAME1 modexDrawSpriteRegion(pip[/*!*/(pip->video->p)].page, x, y, 48, player[pn].enti.dire, 24, 32,   PLAYERBMPDATAPTR);\r
+#define FRAME2 modexDrawSpriteRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, player[pn].enti.dire, 24, 32,   PLAYERBMPDATAPTR);\r
+#define FRAME3 modexDrawSpriteRegion(pip[/*!*/(pip->video->p)].page, x, y, 0, player[pn].enti.dire, 24, 32,    PLAYERBMPDATAPTR);\r
+#define FRAME4 modexDrawSpriteRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, player[pn].enti.dire, 24, 32,   PLAYERBMPDATAPTR);\r
 #else\r
-#define FRAME1 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, 2+dire);\r
-#define FRAME2 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, 1+dire);\r
-#define FRAME3 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, dire);\r
-#define FRAME4 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, 1+dire);\r
+#define FRAME1 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, 2+player[pn].enti.dire);\r
+#define FRAME2 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, 1+player[pn].enti.dire);\r
+#define FRAME3 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, player[pn].enti.dire);\r
+#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
@@ -1165,9 +1160,9 @@ void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scroll
        sword y = player[pn].enti.y;\r
        sword bx = x+16;        //buffer's x\r
        sword by = y+16;        //buffer's y\r
-       word dire=32; //direction\r
        sword qq; //scroll offset\r
        word ls = player[pn].enti.persist_aniframe;\r
+       player[pn].enti.dire=32; //direction\r
 \r
        switch(scrollswitch)\r
        {\r
@@ -1184,13 +1179,13 @@ void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scroll
        {\r
                case 0:\r
                        //up\r
-                       dire*=player[pn].enti.d;\r
+                       player[pn].enti.dire*=player[pn].enti.d;\r
                        y-=qq;\r
                        by-=4;\r
                break;\r
                case 3:\r
                        // right\r
-                       dire*=(player[pn].enti.d-2);\r
+                       player[pn].enti.dire*=(player[pn].enti.d-2);\r
                        x+=qq;\r
                        bx+=4;\r
                break;\r
@@ -1198,13 +1193,13 @@ void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scroll
                break;\r
                case 4:\r
                        //down\r
-                       dire*=(player[pn].enti.d-2);\r
+                       player[pn].enti.dire*=(player[pn].enti.d-2);\r
                        y+=qq;\r
                        by+=4;\r
                break;\r
                case 1:\r
                        //left\r
-                       dire*=(player[pn].enti.d+2);\r
+                       player[pn].enti.dire*=(player[pn].enti.d+2);\r
                        x-=qq;\r
                        bx-=4;\r
                break;\r
@@ -1251,9 +1246,9 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scr
 {\r
        sword x = player[pn].enti.x;\r
        sword y = player[pn].enti.y;\r
-       word dire=10; //direction\r
        sword qq; //scroll offset\r
        word ls = player[pn].enti.persist_aniframe;\r
+       player[pn].enti.dire=10; //direction\r
 \r
        switch(scrollswitch)\r
        {\r
@@ -1271,53 +1266,56 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scr
        {\r
                case 0:\r
                        //up\r
-                       dire*=player[pn].enti.d+1;\r
+                       player[pn].enti.dire*=player[pn].enti.d+1;\r
                        y-=qq;\r
                break;\r
                case 3:\r
                        // right\r
-                       dire*=(player[pn].enti.d-1);\r
+                       player[pn].enti.dire*=(player[pn].enti.d-1);\r
                        x+=qq;\r
                break;\r
                case 2:\r
                break;\r
                case 4:\r
                        //down\r
-                       dire*=(player[pn].enti.d-1);\r
+                       player[pn].enti.dire*=(player[pn].enti.d-1);\r
                        y+=qq;\r
                break;\r
                case 1:\r
                        //left\r
-                       dire*=(player[pn].enti.d+3);\r
+                       player[pn].enti.dire*=(player[pn].enti.d+3);\r
                        x-=qq;\r
                break;\r
        }\r
+       player[pn].enti.dire++;\r
+       player[pn].ent->spri->delay=1;\r
+       if(player[pn].enti.q==1)\r
+               set_anim_by_id(player[pn].ent->spri, player[pn].enti.dire);\r
+               //pip->video->sprifilei = set_anim_by_id(player[pn].ent->spri, player[pn].enti.dire);   if(pip->video->sprifilei == -1){ printf("ERROR! %u\n", player[pn].enti.dire); return; }\r
 \r
        //setting xy position\r
        player[pn].ent->spri->x = x;\r
        player[pn].ent->spri->y = y;\r
 \r
-//#define FRAME1 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 2+dire);\r
-//#define FRAME2 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 1+dire);\r
-//#define FRAME3 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, dire);\r
-//#define FRAME4 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 1+dire);\r
-\r
        switch(ls)\r
        {\r
                case 1:\r
-                       ZC_drawframe(pip, player, pn, x, y, dire, ls);\r
+                       ZC_drawframe(pip, player, pn, x, y, ls);\r
                break;\r
                case 2:\r
-                       ZC_drawframe(pip, player, pn, x, y, dire, ls);\r
+                       ZC_drawframe(pip, player, pn, x, y, ls);\r
                break;\r
                case 3:\r
-                       ZC_drawframe(pip, player, pn, x, y, dire, ls);\r
+                       ZC_drawframe(pip, player, pn, x, y, ls);\r
                break;\r
                case 4:\r
-                       ZC_drawframe(pip, player, pn, x, y, dire, ls);\r
+                       ZC_drawframe(pip, player, pn, x, y, ls);\r
                break;\r
        }\r
        pip->video->r=1;\r
+       //WALKTYPE_FRAM_PRINT;\r
+       //sprintf(global_temp_status_text, " %u", player[pn].enti.dire);\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
 \r
 /*\r