]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/scroll16.c
dang it./wbuild.sh vga_state.vga_graphics_ram = video->omemptr; causes it to not...
[16.git] / src / lib / scroll16.c
index d7b79bf55d2c86fd7f34f7cf04fbc250ede9675f..8ad0156a0e1cf5baa622efb3fed43462c0c320e4 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 WALKTYPE_FRAM_PRINT    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
+INC_PER_FRAME_PRINT\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
 \r
@@ -41,6 +46,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
@@ -54,6 +60,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                        }\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
@@ -64,6 +71,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                        }\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
@@ -74,12 +82,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
@@ -93,6 +103,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                        }\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
@@ -103,6 +114,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                        }\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
@@ -113,12 +125,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
@@ -132,6 +146,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                        }\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
@@ -142,6 +157,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                        }\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
@@ -152,12 +168,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
@@ -171,6 +189,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                        }\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
@@ -181,6 +200,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                        }\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
@@ -191,8 +211,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
        }\r
+       if(player[pn].enti.d!=2 && pip[0].video->rs)\r
+       {\r
+               IN_UserInput(1,1);\r
+               delay(500);\r
+       }\r
 }\r
 \r
 \r
@@ -1101,6 +1127,47 @@ 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
+{\r
+       pip->video->sprifilei=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
+\r
+       switch(pip[0].video->rs)\r
+       {\r
+               case 0:\r
+                       pip->video->sprifilei = set_anim_by_id(player[pn].ent->spri, dire);     if(pip->video->sprifilei == -1) return;\r
+                       animate_spri(player[pn].ent->spri, pip->video);\r
+               break;\r
+               case 1:\r
+                       pip->video->sprifilei = set_anim_by_id(player[pn].ent->spri, dire);     if(pip->video->sprifilei == -1) return;\r
+                       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
+               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
@@ -1201,7 +1268,6 @@ void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scroll
        pip->video->r=1;\r
 }\r
 \r
-\r
 void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scrollswitch)\r
 {\r
        sword x = player[pn].enti.x;\r
@@ -1209,9 +1275,7 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scr
        word dire=10; //direction\r
        sword qq; //scroll offset\r
        word ls = player[pn].enti.persist_aniframe;\r
-#ifdef SPRITE\r
-       int i=0;\r
-#endif\r
+\r
        switch(scrollswitch)\r
        {\r
                case 0:\r
@@ -1221,9 +1285,8 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scr
                        qq = ((player[pn].enti.q)*(player[pn].enti.speed));\r
                break;\r
        }\r
-#ifdef SPRITE\r
-       x-=4;\r
-#endif\r
+       if(pip[0].video->rs<2)\r
+               x-=4;\r
        y-=pip[0].map->tiles->tileHeight;\r
        switch (player[pn].enti.d)\r
        {\r
@@ -1255,37 +1318,19 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scr
        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
-#ifdef SPRITE\r
-//#define DRAWFRAME if (i == -1) return; oldanimate_spri(player[pn].ent->spri, pip->video)\r
-#define DRAWFRAME if (i == -1) return; animate_spri(player[pn].ent->spri, pip->video)\r
-#define NFRAME1 i = set_anim_by_id(player[pn].ent->spri, 2+dire);      DRAWFRAME;\r
-#define NFRAME2 i = set_anim_by_id(player[pn].ent->spri, 1+dire);      DRAWFRAME;\r
-#define NFRAME3 i = set_anim_by_id(player[pn].ent->spri, dire);        DRAWFRAME;\r
-#define NFRAME4 i = set_anim_by_id(player[pn].ent->spri, 2+dire);      DRAWFRAME;\r
-#else\r
-#define NFRAME1 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, 2+dire);\r
-#define NFRAME2 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, 1+dire);\r
-#define NFRAME3 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, dire);\r
-#define NFRAME4 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, 1+dire);\r
-#endif\r
-\r
        switch(ls)\r
        {\r
                case 1:\r
-                       NFRAME1\r
+                       ZC_drawframe(pip, player, pn, x, y, dire, ls);\r
                break;\r
                case 2:\r
-                       NFRAME2\r
+                       ZC_drawframe(pip, player, pn, x, y, dire, ls);\r
                break;\r
                case 3:\r
-                       NFRAME3\r
+                       ZC_drawframe(pip, player, pn, x, y, dire, ls);\r
                break;\r
                case 4:\r
-                       NFRAME4\r
+                       ZC_drawframe(pip, player, pn, x, y, dire, ls);\r
                break;\r
        }\r
        pip->video->r=1;\r