OSDN Git Service

i did some minor things including commenting out some joy stick timing stuff and...
[proj16/16.git] / src / lib / scroll16.c
index 4e9577b..f3f054d 100755 (executable)
@@ -125,190 +125,191 @@ boolean ZCL_ScreenMidPosChk(map_view_t *map_v, nibble dir, int tx, int ty)
        return false;\r
 }\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;\r
+//#define INC_PER_FRAME if(gvar->player[pn].enti.q&1) gvar->player[pn].enti.persist_aniframe++; if(gvar->player[pn].enti.persist_aniframe>4) gvar->player[pn].enti.persist_aniframe = 1;\r
 #ifdef OLDWALKSHOWPAGESTUFF\r
-#define SHOWMVFUN__ ZC_ShowMV(pip, 1, 0);\r
+#define SHOWMVFUN__ VL_ShowPage(&gvar->video.page[0], 1, 0);//modexShowPage(&gvar->video.page);\r
+//ZC_ShowMV(gvar->mv, 1, 0);\r
 #endif\r
 \r
-void ZC_walk(map_view_t *pip, player_t *player, word pn)\r
+void ZC_walk(global_game_variables_t *gvar, word pn)\r
 {\r
-       switch(player[pn].enti.d)\r
+       switch(gvar->player[pn].enti.d)\r
        {\r
                //no direction\r
                case 2:\r
-                       //0000pip[0].video->startclk = (*clockw);\r
+                       //0000gvar->mv[0].video->startclk = (*clockw);\r
                break;\r
                //right movement\r
                case 3:\r
-                       if(ZCL_ScreenMidPosChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty) &&\r
-                       ZCL_CollCheck(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty))//!(player[pn].enti.tx+1 == TRIGGX && player[pn].enti.ty == TRIGGY))      //collision detection!\r
+                       if(ZCL_ScreenMidPosChk(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty) &&\r
+                       ZCL_CollCheck(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty))//!(gvar->player[pn].enti.tx+1 == TRIGGX && gvar->player[pn].enti.ty == TRIGGY))   //collision detection!\r
                        {\r
-                               player[pn].walktype=2;\r
-                               if(player[pn].enti.q<=player[pn].enti.spt)\r
+                               gvar->player[pn].walktype=2;\r
+                               if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
                                {\r
-                                       ZC_animatePlayer(pip, player, pn);\r
-                                       ZC_mapScroll(pip, player, pn);\r
-                                       player[pn].enti.q++;\r
-                                       //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
+                                       ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
+                                       ZC_mapScroll(gvar->mv, gvar->player, pn);\r
+                                       gvar->player[pn].enti.q++;\r
+                                       //0000gvar->mv[0].video->clk = ((*clockw)-gvar->mv[0].video->startclk)/18.2;\r
 #ifdef OLDWALKSHOWPAGESTUFF\r
                                        SHOWMVFUN__\r
 #endif\r
-                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
+                               } else { gvar->player[pn].enti.q = 1; gvar->player[pn].enti.d = 2; gvar->player[pn].enti.tx++; }\r
                        }\r
-                       else if(ZCL_mapEdgeChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty, 0, 1) &&\r
-                       ZCL_CollCheck(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty))//!(player[pn].enti.tx+1 == TRIGGX && player[pn].enti.ty == TRIGGY))\r
+                       else if(ZCL_mapEdgeChk(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty, 0, 1) &&\r
+                       ZCL_CollCheck(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty))//!(gvar->player[pn].enti.tx+1 == TRIGGX && gvar->player[pn].enti.ty == TRIGGY))\r
                        {\r
-                               player[pn].walktype=1;\r
-                               if(player[pn].enti.q<=player[pn].enti.spt)\r
+                               gvar->player[pn].walktype=1;\r
+                               if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
                                {\r
-                                       player[pn].enti.x+=(player[pn].enti.speed);\r
-                                       ZC_animatePlayer(pip, player, pn);\r
-                                       player[pn].enti.q++;\r
+                                       gvar->player[pn].enti.x+=(gvar->player[pn].enti.spt);\r
+                                       ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
+                                       gvar->player[pn].enti.q++;\r
 #ifdef OLDWALKSHOWPAGESTUFF\r
                                        SHOWMVFUN__\r
 #endif\r
-                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; }\r
+                               } else { gvar->player[pn].enti.q = 1; gvar->player[pn].enti.d = 2; gvar->player[pn].enti.tx++; }\r
                        }\r
                        else\r
                        {\r
-                               player[pn].walktype=0;\r
-                               ZC_animatePlayer(pip, player, pn);\r
-                               player[pn].enti.d = 2;\r
+                               gvar->player[pn].walktype=0;\r
+                               ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
+                               gvar->player[pn].enti.d = 2;\r
 #ifdef OLDWALKSHOWPAGESTUFF\r
                                SHOWMVFUN__\r
 #endif\r
                        }\r
-                       player[pn].enti.triggerx = player[pn].enti.tx+1;\r
-                       player[pn].enti.triggery = player[pn].enti.ty;\r
+                       gvar->player[pn].enti.triggerx = gvar->player[pn].enti.tx+1;\r
+                       gvar->player[pn].enti.triggery = gvar->player[pn].enti.ty;\r
                break;\r
                //left movement\r
                case 1:\r
-                       if(ZCL_ScreenMidPosChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty) &&\r
-                       ZCL_CollCheck(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty))//!(player[pn].enti.tx-1 == TRIGGX && player[pn].enti.ty == TRIGGY))      //collision detection!\r
+                       if(ZCL_ScreenMidPosChk(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty) &&\r
+                       ZCL_CollCheck(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty))//!(gvar->player[pn].enti.tx-1 == TRIGGX && gvar->player[pn].enti.ty == TRIGGY))   //collision detection!\r
                        {\r
-                               player[pn].walktype=2;\r
-                               if(player[pn].enti.q<=player[pn].enti.spt)\r
+                               gvar->player[pn].walktype=2;\r
+                               if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
                                {\r
-                                       ZC_animatePlayer(pip, player, pn);\r
-                                       ZC_mapScroll(pip, player, pn);\r
-                                       player[pn].enti.q++;\r
-                                       //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
+                                       ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
+                                       ZC_mapScroll(gvar->mv, gvar->player, pn);\r
+                                       gvar->player[pn].enti.q++;\r
+                                       //0000gvar->mv[0].video->clk = ((*clockw)-gvar->mv[0].video->startclk)/18.2;\r
 #ifdef OLDWALKSHOWPAGESTUFF\r
                                        SHOWMVFUN__\r
 #endif\r
-                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
+                               } else { gvar->player[pn].enti.q = 1; gvar->player[pn].enti.d = 2; gvar->player[pn].enti.tx--; }\r
                        }\r
-                       else if(ZCL_mapEdgeChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty, 0, 1) &&\r
-                       ZCL_CollCheck(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty))//!(player[pn].enti.tx-1 == TRIGGX && player[pn].enti.ty == TRIGGY))\r
+                       else if(ZCL_mapEdgeChk(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty, 0, 1) &&\r
+                       ZCL_CollCheck(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty))//!(gvar->player[pn].enti.tx-1 == TRIGGX && gvar->player[pn].enti.ty == TRIGGY))\r
                        {\r
-                               player[pn].walktype=1;\r
-                               if(player[pn].enti.q<=player[pn].enti.spt)\r
+                               gvar->player[pn].walktype=1;\r
+                               if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
                                {\r
-                                       player[pn].enti.x-=(player[pn].enti.speed);\r
-                                       ZC_animatePlayer(pip, player, pn);\r
-                                       player[pn].enti.q++;\r
+                                       gvar->player[pn].enti.x-=(gvar->player[pn].enti.spt);\r
+                                       ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
+                                       gvar->player[pn].enti.q++;\r
 #ifdef OLDWALKSHOWPAGESTUFF\r
                                        SHOWMVFUN__\r
 #endif\r
-                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; }\r
+                               } else { gvar->player[pn].enti.q = 1; gvar->player[pn].enti.d = 2; gvar->player[pn].enti.tx--; }\r
                        }\r
                        else\r
                        {\r
-                               player[pn].walktype=0;\r
-                               ZC_animatePlayer(pip, player, pn);\r
-                               player[pn].enti.d = 2;\r
+                               gvar->player[pn].walktype=0;\r
+                               ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
+                               gvar->player[pn].enti.d = 2;\r
 #ifdef OLDWALKSHOWPAGESTUFF\r
                                SHOWMVFUN__\r
 #endif\r
                        }\r
-                       player[pn].enti.triggerx = player[pn].enti.tx-1;\r
-                       player[pn].enti.triggery = player[pn].enti.ty;\r
+                       gvar->player[pn].enti.triggerx = gvar->player[pn].enti.tx-1;\r
+                       gvar->player[pn].enti.triggery = gvar->player[pn].enti.ty;\r
                break;\r
                //down movement\r
                case 4:\r
-                       if(ZCL_ScreenMidPosChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty) &&\r
-                       ZCL_CollCheck(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty+1 == TRIGGY))      //collision detection!\r
+                       if(ZCL_ScreenMidPosChk(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty) &&\r
+                       ZCL_CollCheck(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty))//!(gvar->player[pn].enti.tx == TRIGGX && gvar->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
+                               gvar->player[pn].walktype=2;\r
+                               if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
                                {\r
-                                       ZC_animatePlayer(pip, player, pn);\r
-                                       ZC_mapScroll(pip, player, pn);\r
-                                       player[pn].enti.q++;\r
-                                       //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
+                                       ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
+                                       ZC_mapScroll(gvar->mv, gvar->player, pn);\r
+                                       gvar->player[pn].enti.q++;\r
+                                       //0000gvar->mv[0].video->clk = ((*clockw)-gvar->mv[0].video->startclk)/18.2;\r
 #ifdef OLDWALKSHOWPAGESTUFF\r
                                        SHOWMVFUN__\r
 #endif\r
-                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
+                               } else { gvar->player[pn].enti.q = 1; gvar->player[pn].enti.d = 2; gvar->player[pn].enti.ty++; }\r
                        }\r
-                       else if(ZCL_mapEdgeChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty, 0, 1) &&\r
-                       ZCL_CollCheck(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty+1 == TRIGGY))\r
+                       else if(ZCL_mapEdgeChk(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty, 0, 1) &&\r
+                       ZCL_CollCheck(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty))//!(gvar->player[pn].enti.tx == TRIGGX && gvar->player[pn].enti.ty+1 == TRIGGY))\r
                        {\r
-                               player[pn].walktype=1;\r
-                               if(player[pn].enti.q<=player[pn].enti.spt)\r
+                               gvar->player[pn].walktype=1;\r
+                               if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
                                {\r
-                                       player[pn].enti.y+=(player[pn].enti.speed);\r
-                                       ZC_animatePlayer(pip, player, pn);\r
-                                       player[pn].enti.q++;\r
+                                       gvar->player[pn].enti.y+=(gvar->player[pn].enti.spt);\r
+                                       ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
+                                       gvar->player[pn].enti.q++;\r
 #ifdef OLDWALKSHOWPAGESTUFF\r
                                        SHOWMVFUN__\r
 #endif\r
-                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; }\r
+                               } else { gvar->player[pn].enti.q = 1; gvar->player[pn].enti.d = 2; gvar->player[pn].enti.ty++; }\r
                        }\r
                        else\r
                        {\r
-                               player[pn].walktype=0;\r
-                               ZC_animatePlayer(pip, player, pn);\r
-                               player[pn].enti.d = 2;\r
+                               gvar->player[pn].walktype=0;\r
+                               ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
+                               gvar->player[pn].enti.d = 2;\r
 #ifdef OLDWALKSHOWPAGESTUFF\r
                                SHOWMVFUN__\r
 #endif\r
                        }\r
-                       player[pn].enti.triggerx = player[pn].enti.tx;\r
-                       player[pn].enti.triggery = player[pn].enti.ty+1;\r
+                       gvar->player[pn].enti.triggerx = gvar->player[pn].enti.tx;\r
+                       gvar->player[pn].enti.triggery = gvar->player[pn].enti.ty+1;\r
                break;\r
                //up movement\r
                case 0:\r
-                       if(ZCL_ScreenMidPosChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty) &&\r
-                       ZCL_CollCheck(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty))//!(player[pn].enti.tx == TRIGGX && player[pn].enti.ty-1 == TRIGGY))      //collision detection!\r
+                       if(ZCL_ScreenMidPosChk(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty) &&\r
+                       ZCL_CollCheck(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty))//!(gvar->player[pn].enti.tx == TRIGGX && gvar->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
+                               gvar->player[pn].walktype=2;\r
+                               if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
                                {\r
-                                       ZC_animatePlayer(pip, player, pn);\r
-                                       ZC_mapScroll(pip, player, pn);\r
-                                       player[pn].enti.q++;\r
-                                       //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;\r
+                                       ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
+                                       ZC_mapScroll(gvar->mv, gvar->player, pn);\r
+                                       gvar->player[pn].enti.q++;\r
+                                       //0000gvar->mv[0].video->clk = ((*clockw)-gvar->mv[0].video->startclk)/18.2;\r
 #ifdef OLDWALKSHOWPAGESTUFF\r
                                        SHOWMVFUN__\r
 #endif\r
-                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
+                               } else { gvar->player[pn].enti.q = 1; gvar->player[pn].enti.d = 2; gvar->player[pn].enti.ty--; }\r
                        }\r
-                       else if(ZCL_mapEdgeChk(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty, 0, 1) &&\r
-                       ZCL_CollCheck(pip, player[pn].enti.d, player[pn].enti.tx, player[pn].enti.ty))//!(player[pn].enti.tx == TRIGGX &&  player[pn].enti.ty-1 == TRIGGY))\r
+                       else if(ZCL_mapEdgeChk(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty, 0, 1) &&\r
+                       ZCL_CollCheck(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty))//!(gvar->player[pn].enti.tx == TRIGGX &&  gvar->player[pn].enti.ty-1 == TRIGGY))\r
                        {\r
-                               player[pn].walktype=1;\r
-                               if(player[pn].enti.q<=player[pn].enti.spt)\r
+                               gvar->player[pn].walktype=1;\r
+                               if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
                                {\r
-                                       player[pn].enti.y-=(player[pn].enti.speed);\r
-                                       ZC_animatePlayer(pip, player, pn);\r
-                                       player[pn].enti.q++;\r
+                                       gvar->player[pn].enti.y-=(gvar->player[pn].enti.spt);\r
+                                       ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
+                                       gvar->player[pn].enti.q++;\r
 #ifdef OLDWALKSHOWPAGESTUFF\r
                                        SHOWMVFUN__\r
 #endif\r
-                               } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; }\r
+                               } else { gvar->player[pn].enti.q = 1; gvar->player[pn].enti.d = 2; gvar->player[pn].enti.ty--; }\r
                        }\r
                        else\r
                        {\r
-                               player[pn].walktype=0;\r
-                               ZC_animatePlayer(pip, player, pn);\r
-                               player[pn].enti.d = 2;\r
+                               gvar->player[pn].walktype=0;\r
+                               ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
+                               gvar->player[pn].enti.d = 2;\r
 #ifdef OLDWALKSHOWPAGESTUFF\r
                                SHOWMVFUN__\r
 #endif\r
                        }\r
-                       player[pn].enti.triggerx = player[pn].enti.tx;\r
-                       player[pn].enti.triggery = player[pn].enti.ty-1;\r
+                       gvar->player[pn].enti.triggerx = gvar->player[pn].enti.tx;\r
+                       gvar->player[pn].enti.triggery = gvar->player[pn].enti.ty-1;\r
                break;\r
        }\r
 }\r
@@ -317,7 +318,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
 //panning page\r
 void ZC_panPageManual(map_view_t *pip, player_t *player, word pn)\r
 {\r
-#define SHOWMVFUN_ ZC_ShowMV(pip, 0, 0);\r
+#define SHOWMVFUN_ VL_ShowPage(pip[0].page, 0, 0);//ZC_ShowMV(pip, 0, 0);\r
        switch(player[pn].enti.d)\r
        {\r
                //right movement\r
@@ -412,6 +413,8 @@ void ZC_MVInit(map_view_t *pip, int tx, int ty)
        //pip[0].ty = pip[1].ty = ty;\r
 }\r
 \r
+//#if 0\r
+//for backwards compatibility with code i am lazy ww\r
 void ZC_ShowMV(map_view_t *moo, boolean vsync, boolean sr)\r
 {\r
        VL_ShowPage(moo[0].page, vsync, sr);\r
@@ -614,16 +617,16 @@ void ZC_mapScroll(map_view_t *mv, player_t *player, word pn)
 //===========================================================================\r
 //TODO: put player in starting position of assigned spot on map\r
 //default player position on the viewable map\r
-void ZC_PlayerXYpos(int x, int y, player_t *player, map_view_t *pip, nibble pn, boolean defaultsw)\r
+void ZC_PlayerXYpos(int x, int y, player_t *player, map_view_t *pip, boolean defaultsw)\r
 {\r
-       player[pn].enti.tx = x + pip[0].tx;\r
-       player[pn].enti.ty = y + pip[0].ty;\r
+       player->enti.tx = x + pip[0].tx;\r
+       player->enti.ty = y + pip[0].ty;\r
 \r
        switch(defaultsw)\r
        {\r
                case 1:\r
-                       player[pn].enti.tx += pip[0].page->ti.tilemidposscreenx;\r
-                       player[pn].enti.ty += pip[0].page->ti.tilemidposscreeny;\r
+                       player->enti.tx += pip[0].page->ti.tilemidposscreenx;\r
+                       player->enti.ty += pip[0].page->ti.tilemidposscreeny;\r
                break;\r
                case 0:\r
                break;\r
@@ -659,7 +662,7 @@ sword chkmap(map_t *map, word q)
 //1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1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, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1 };\r
 //1,   2,      3,      4,      0,      3,      3,      3,      3,      3,      3,      3,      3,      4,      1,      1,      1,      1,      1,      1,      5,      6,      7,      8,      0,      1,      0,      1,      0,      0,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      9,      10,     11,     12,     4,      1,      0,      1,      0,      0,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      13,     14,     15,     16,     0,      1,      1,      1,      5,      8,      1,      11,     11,     1,      1,      1,      1,      1,      1,      1,      0,      0,      4,      0,      0,      0,      0,      0,      8,      8,      1,      11,     11,     3,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      0,      0,      0,      0,      8,      8,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      0,      0,      0,      0,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      0,      0,      0,      0,      1,      1,      1,      1,      1,      1,      1,      1,      3,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      3,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      3,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      3,      3,      3,      3,      1,      2,      3,      4 };\r
        //check for failed to load map\r
-       if((map->width == map->height == 0) && (q>0))\r
+       if((!map->width || !map->height) && (q>0))\r
        {\r
                //initiate a null map!\r
                map->width=MAPW;\r
@@ -753,10 +756,10 @@ void near mapDrawRow(map_view_t *mv, int tx, int ty, word y, player_t *player, w
 #ifdef __DEBUG_RF__\r
 if(dbg_pagedelayrendermap)             if(!y)  y+=TILEWH;      else    y-=TILEWH;\r
 #endif\r
-       poopoffset%=player[0].enti.speed;\r
+       poopoffset%=player[0].enti.spt;\r
 //printf("y: %d\n", poopoffset);\r
 #ifdef __DEBUG_RF__\r
-if(dbg_pagedelayrendermap){ sprintf(global_temp_status_text, "%-3u", mv->dx); modexprint(mv[0].page, player[0].enti.x, player[0].enti.y-28-(poopoffset*8) , 1, 0, PALMAPDRAWW, 1, 1, global_temp_status_text); }\r
+if(dbg_pagedelayrendermap){ sprintf(global_temp_status_text, "%-3u", poopoffset); modexprint(mv->page, player[0].enti.x, player[0].enti.y-28-(poopoffset*8) , 1, 0, PALMAPDRAWW, 1, 1, global_temp_status_text); }\r
 #endif\r
        /* the position within the map array */\r
        i=ty * mv->map->width + tx;\r
@@ -772,7 +775,7 @@ if(dbg_pagedelayrendermap){ sprintf(global_temp_status_text, "%-3u", mv->dx); mo
                i++; /* next! */\r
        }\r
 #ifdef __DEBUG_RF__\r
-if(dbg_pagedelayrendermap) delay(200);\r
+if(dbg_pagedelayrendermap) DBG_RFDELAYMETHOD;\r
 #endif\r
 }\r
 \r
@@ -782,10 +785,10 @@ void near mapDrawCol(map_view_t *mv, int tx, int ty, word x, player_t *player, w
 #ifdef __DEBUG_RF__\r
 if(dbg_pagedelayrendermap)             if(!x)  x+=TILEWH;              else    x-=TILEWH;\r
 #endif\r
-       poopoffset%=player[0].enti.speed;\r
+       poopoffset%=player[0].enti.spt;\r
 //printf("x: %d\n", poopoffset);\r
 #ifdef __DEBUG_RF__\r
-if(dbg_pagedelayrendermap){ sprintf(global_temp_status_text, "%-3u", mv->dy); modexprint(mv[0].page, player[0].enti.x, player[0].enti.y-28-(poopoffset*8) , 1, 0, PALMAPDRAWW, 1, global_temp_status_text); }\r
+if(dbg_pagedelayrendermap){ sprintf(global_temp_status_text, "%-3u", poopoffset); modexprint(mv->page, player[0].enti.x, player[0].enti.y-28-(poopoffset*8) , 1, 0, PALMAPDRAWW, 1, 1, global_temp_status_text); }\r
 #endif\r
        /* location in the map array */\r
        i=ty * mv->map->width + tx;\r
@@ -803,7 +806,7 @@ if(dbg_pagedelayrendermap){ sprintf(global_temp_status_text, "%-3u", mv->dy); mo
                i += mv->map->width;\r
        }\r
 #ifdef __DEBUG_RF__\r
-if(dbg_pagedelayrendermap) delay(200);\r
+if(dbg_pagedelayrendermap) DBG_RFDELAYMETHOD;\r
 #endif\r
 }\r
 \r
@@ -908,14 +911,13 @@ void shinku(global_game_variables_t *gv)
                        gv->kurokku.frames_per_second=1;\r
                break;\r
                case 1:\r
-#ifdef OLDWALKSHOWPAGESTUFF\r
+//#ifndef OLDWALKSHOWPAGESTUFF\r
+                       //vga_wait_for_vsync();\r
+                       vga_wait_for_vsync_end();\r
+//#else\r
                        //modexWaitBorder();\r
-                       //modexWaitBorder_start();\r
-#else\r
-                       vga_wait_for_vsync();\r
-                       //vga_wait_for_vsync_end();\r
-#endif\r
-                       gv->kurokku.frames_per_second=60;\r
+//#endif\r
+                       gv->kurokku.frames_per_second=FPSVALUE;\r
                break;\r
        }\r
        PM_NextFrame(gv);\r
@@ -940,7 +942,7 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn)
                break;\r
                case 2:\r
                        dd = 1;\r
-                       qq = player[pn].enti.q*player[pn].enti.speed;\r
+                       qq = player[pn].enti.q*player[pn].enti.spt;\r
                break;\r
        }\r
        x-=4;\r
@@ -995,6 +997,9 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn)
                animate_spri(&player[pn].enti, pip[0].video);\r
        }\r
 //0000if(player[pn].enti.q<4) delay(200);\r
+#ifdef OLDWALKSHOWPAGESTUFF\r
+       modexWaitBorder();\r
+#endif\r
 }\r
 \r
 /*\r
@@ -1058,7 +1063,6 @@ void player_walk(player_t *player, map_view_t *map_v){
  */\r
 \r
 \r
-\r
 void mapScroll(map_view_t *mv, player_t *player)\r
 {\r
        //word x, y;  /* coordinate for drawing */\r
@@ -1092,3 +1096,11 @@ void mapScroll(map_view_t *mv, player_t *player)
                        break;\r
        }\r
 }\r
+\r
+void ZC_GirdChk (global_game_variables_t *gvar, player_t *player)\r
+{\r
+       if((player->enti.q==1) &&\r
+               !(player->enti.x%gvar->mv[0].map->tiles->tileWidth==0 && player->enti.y%gvar->mv[0].map->tiles->tileHeight==0))\r
+               ZC_PlayerXYpos(0, 0, player, gvar->mv, 1);\r
+               //TODO: MAKE SURE TO RESYNC PLAYER IN WALKABLE SPOT\r
+}\r