]> 4ch.mooo.com Git - 16.git/commitdiff
fine tuning animation still
authorsparky4 <sparky4@cock.li>
Wed, 18 Jan 2017 18:00:03 +0000 (12:00 -0600)
committersparky4 <sparky4@cock.li>
Wed, 18 Jan 2017 18:00:03 +0000 (12:00 -0600)
src/lib/16_sprit.c
src/lib/16_sprit.h
src/lib/16_vl.c
src/lib/scroll16.c
src/lib/scroll16.h
src/zcroll.c

index 3895cc720a4084d7dd37469b9a77b39ae53a8285..e32e9f96764c9f524d52740e66da1ca708631ea5 100755 (executable)
@@ -97,26 +97,29 @@ void print_anim_ids(struct sprite *spri)
        }\r
 }\r
 \r
-/*\r
-void animate_spri(struct sprite *spri, global_game_variables_t *gv)\r
+void oldanimate_spri(struct sprite *spri, video_t *video)\r
 {\r
        int i;\r
        // Events go here\r
 \r
 \r
+       vga_state.vga_graphics_ram = (VGA_RAM_PTR)video->page[0].data;//vga_state.vga_graphics_ram; // save original mem ptr\r
+\r
+\r
        // Draw sprite\r
        i = get_vrl_by_id(spri->spritesheet, spri->curr_spri_id, spri->sprite_vrl_cont);\r
        if(i < 0)\r
        {\r
-               Quit (gv, "Error retriving required sprite");\r
+               //Quit (gv, "Error retriving required sprite");\r
+               return;\r
        }\r
 \r
        // replace VGA stride with our own and mem ptr. then sprite rendering at this stage is just (0,0)\r
-       vga_state.vga_draw_stride_limit = (gv->video.page[0].width + 3 - spri->x) >> 2;\r
+       vga_state.vga_draw_stride_limit = (video->page[0].width + 3 - spri->x) >> 2;\r
 \r
        draw_vrl1_vgax_modex(\r
-               spri->x-gv->video.page[0].dx,\r
-               spri->y-gv->video.page[0].dy,\r
+               spri->x,//-video->page[0].dx,\r
+               spri->y,//-video->page[0].dy,\r
                spri->sprite_vrl_cont->vrl_header,\r
                spri->sprite_vrl_cont->line_offsets,\r
                spri->sprite_vrl_cont->buffer + sizeof(struct vrl1_vgax_header),\r
@@ -124,7 +127,7 @@ void animate_spri(struct sprite *spri, global_game_variables_t *gv)
        );\r
 \r
        // restore stride\r
-       vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = gv->video.page[0].stridew;\r
+       vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = video->page[0].stridew;\r
 \r
        // Depending on delay, update indices\r
        switch(spri->delay){\r
@@ -149,7 +152,8 @@ void animate_spri(struct sprite *spri, global_game_variables_t *gv)
                        break;\r
        }\r
 }\r
-*/\r
+\r
+\r
 void animate_spri(struct sprite *spri, video_t *video)\r
 {\r
 #define GVARVIDEO video\r
@@ -157,7 +161,7 @@ void animate_spri(struct sprite *spri, video_t *video)
 #define VMEMPAGEDATA2  GVARVIDEO->page[2].data\r
        unsigned int i,o,o2; int j;\r
        int x,y,rx,ry,w,h;\r
-       int overdraw = 1;       // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks.\r
+       int overdraw = 0;//16;  // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks.\r
                                                // if the sprite's edge pixels are clear anyway, you can set this to 0.\r
        VGA_RAM_PTR omemptr;\r
 \r
@@ -165,7 +169,7 @@ void animate_spri(struct sprite *spri, video_t *video)
 \r
 \r
        omemptr = (VGA_RAM_PTR)video->page[0].data;//vga_state.vga_graphics_ram; // save original mem ptr\r
-       x=spri->x;//-4;\r
+       x=spri->x;\r
        y=spri->y;\r
 \r
        // Draw sprite\r
@@ -201,6 +205,9 @@ void animate_spri(struct sprite *spri, video_t *video)
        vga_state.vga_graphics_ram = omemptr + VMEMPAGESIZE2;\r
 \r
        // then the sprite. note modding ram ptr means we just draw to (x&3,0)\r
+#ifndef SPRITE\r
+       modexClearRegion(&GVARVIDEO->page[0], x, y, 16, 32, 1);\r
+#else\r
        draw_vrl1_vgax_modex(\r
                x-rx,\r
                y-ry,\r
@@ -209,7 +216,7 @@ void animate_spri(struct sprite *spri, video_t *video)
                spri->sprite_vrl_cont->buffer + sizeof(struct vrl1_vgax_header),\r
                spri->sprite_vrl_cont->data_size\r
        );\r
-\r
+#endif\r
        // restore ptr\r
        vga_state.vga_graphics_ram = omemptr;\r
 \r
index 386b42f1619abd2eb6cc84750cf425d671468b8a..a72e9671de90e52662c290204ddea9c33db21809 100755 (executable)
@@ -23,6 +23,7 @@
 #define __16_SPRI__\r
 \r
 #include "src/lib/16_vrs.h"\r
+#include "src/lib/scroll16.h"\r
 \r
 struct sprite\r
 {\r
@@ -66,6 +67,7 @@ int set_anim_by_id(struct sprite *spri, int id);
  * In:\r
  * + struct sprite *spri - sprite to animate\r
  */\r
+void oldanimate_spri(struct sprite *spri, video_t *video);\r
 void animate_spri(struct sprite *spri, video_t *video);\r
 \r
 void print_anim_ids(struct sprite *spri);\r
index 4f758b056889bbf53a84d81b47445b33249c2bf0..07eb939ffa5ebc7d2aa2523c00605c842104ff3b 100755 (executable)
@@ -374,6 +374,7 @@ VL_ShowPage(page_t *page, boolean vsync, boolean sr) {
        /* do PEL panning here */\r
        outp(AC_INDEX, 0x33);\r
        outp(AC_INDEX, (page[0].dx & 0x03) << 1);\r
+       vga_state.vga_graphics_ram = (VGA_RAM_PTR)page[0].data;\r
 }\r
 \r
 //=============================================================================\r
index d4a34e5ccc4879134b3a9242d10d54700c96efff..d7b79bf55d2c86fd7f34f7cf04fbc250ede9675f 100755 (executable)
 \r
 #define ANIMATESPRIFUN ZC_animatePlayer\r
 \r
-void oldwalk(map_view_t *pip, player_t *player, word pn)\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
-       #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
-       //printf("player[%d].d=%d\n", pn, player[pn].enti.d);\r
        switch(player[pn].enti.d)\r
        {\r
                //no direction\r
@@ -38,7 +38,6 @@ void oldwalk(map_view_t *pip, player_t *player, word pn)
                break;\r
                //right movement\r
                case 3:\r
-                       //printf("pip[0].page->tilesw=%d        ", pip[0].page->tilesw); printf("pip[0].page->tw=%d\n", pip[0].page->tw);\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)+(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
@@ -48,9 +47,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn)
                                        ANIMATESPRIFUN(pip, player, pn, 1);\r
                                        ScrollRight(pip, player, 3, pn);\r
                                        ScrollRight(pip, player, 2, pn);\r
-                                       //mapScrollRight(pip, player, !(pip[0].video->p), pn);\r
                                        mapScrollRight(pip, player, (pip[0].video->p), pn);\r
-                                       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
@@ -62,25 +59,22 @@ void oldwalk(map_view_t *pip, player_t *player, word pn)
                                        INC_PER_FRAME;\r
                                        player[pn].enti.x+=(player[pn].enti.speed);\r
                                        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
                        }\r
                        else\r
                        {\r
-                               if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32);\r
-#ifdef SPRITE\r
-                               modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 24, 32, PLAYERBMPDATAPTR);\r
-#else\r
-                               modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 14);\r
-#endif\r
-                               if(!pageflipflop) modexShowPage(pip[1].page);\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
+//#else\r
+//                             modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 14);\r
+//#endif\r
                                player[pn].enti.d = 2;\r
                        }\r
                        player[pn].enti.triggerx = player[pn].enti.tx+1;\r
                        player[pn].enti.triggery = player[pn].enti.ty;\r
                break;\r
-\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
@@ -92,9 +86,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn)
                                        ANIMATESPRIFUN(pip, player, pn, 1);\r
                                        ScrollLeft(pip, player, 3, pn);\r
                                        ScrollLeft(pip, player, 2, pn);\r
-                                       //mapScrollLeft(pip, player, !(pip[0].video->p), pn);\r
                                        mapScrollLeft(pip, player, (pip[0].video->p), pn);\r
-                                       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
@@ -106,25 +98,22 @@ void oldwalk(map_view_t *pip, player_t *player, word pn)
                                        INC_PER_FRAME;\r
                                        player[pn].enti.x-=(player[pn].enti.speed);\r
                                        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
                        }\r
                        else\r
                        {\r
-                               if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32);\r
-#ifdef SPRITE\r
-                               modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 96, 24, 32, PLAYERBMPDATAPTR);\r
-#else\r
-                               modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 10);\r
-#endif\r
-                               if(!pageflipflop) modexShowPage(pip[1].page);\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
+//#else\r
+//                             modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 10);\r
+//#endif\r
                                player[pn].enti.d = 2;\r
                        }\r
                        player[pn].enti.triggerx = player[pn].enti.tx-1;\r
                        player[pn].enti.triggery = player[pn].enti.ty;\r
                break;\r
-\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
@@ -136,9 +125,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn)
                                        ANIMATESPRIFUN(pip, player, pn, 1);\r
                                        ScrollDown(pip, player, 3, pn);\r
                                        ScrollDown(pip, player, 2, pn);\r
-                                       //mapScrollDown(pip, player, !(pip[0].video->p), pn);\r
                                        mapScrollDown(pip, player, (pip[0].video->p), pn);\r
-                                       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
@@ -150,25 +137,22 @@ void oldwalk(map_view_t *pip, player_t *player, word pn)
                                        INC_PER_FRAME;\r
                                        player[pn].enti.y+=(player[pn].enti.speed);\r
                                        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
                        }\r
                        else\r
                        {\r
-                               if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32);\r
-#ifdef SPRITE\r
-                               modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 64, 24, 32, PLAYERBMPDATAPTR);\r
-#else\r
-                               modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 9);\r
-#endif\r
-                               if(!pageflipflop) modexShowPage(pip[1].page);\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
+//#else\r
+//                             modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 9);\r
+//#endif\r
                                player[pn].enti.d = 2;\r
                        }\r
                        player[pn].enti.triggerx = player[pn].enti.tx;\r
                        player[pn].enti.triggery = player[pn].enti.ty+1;\r
                break;\r
-\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
@@ -180,9 +164,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn)
                                        ANIMATESPRIFUN(pip, player, pn, 1);\r
                                        ScrollUp(pip, player, 3, pn);\r
                                        ScrollUp(pip, player, 2, pn);\r
-                                       //mapScrollUp(pip, player, !(pip[0].video->p), pn);\r
                                        mapScrollUp(pip, player, (pip[0].video->p), pn);\r
-                                       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
@@ -194,19 +176,17 @@ void oldwalk(map_view_t *pip, player_t *player, word pn)
                                        INC_PER_FRAME;\r
                                        player[pn].enti.y-=(player[pn].enti.speed);\r
                                        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
                        }\r
                        else\r
                        {\r
-                               if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32);\r
-#ifdef SPRITE\r
-                               modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 0, 24, 32, PLAYERBMPDATAPTR);\r
-#else\r
-                               modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 12);\r
-#endif\r
-                               if(!pageflipflop) modexShowPage(pip[1].page);\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
+//#else\r
+//                             modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 12);\r
+//#endif\r
                                player[pn].enti.d = 2;\r
                        }\r
                        player[pn].enti.triggerx = player[pn].enti.tx;\r
@@ -225,9 +205,9 @@ src/lib/scroll16.c: pip->video->r=1;
 src/lib/scroll16.c:    mv->video->r=1;\r
  */\r
 \r
-void ZC_walk(map_view_t *pip, player_t *player, word pn)\r
+void oldwalk(map_view_t *pip, player_t *player, word pn)\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
+       //printf("player[%d].d=%d\n", pn, player[pn].enti.d);\r
        switch(player[pn].enti.d)\r
        {\r
                //no direction\r
@@ -236,6 +216,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                break;\r
                //right movement\r
                case 3:\r
+                       //printf("pip[0].page->tilesw=%d        ", pip[0].page->tilesw); printf("pip[0].page->tw=%d\n", pip[0].page->tw);\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)+(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
@@ -245,7 +226,9 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                                        ANIMATESPRIFUN(pip, player, pn, 1);\r
                                        ScrollRight(pip, player, 3, pn);\r
                                        ScrollRight(pip, player, 2, pn);\r
+                                       //mapScrollRight(pip, player, !(pip[0].video->p), pn);\r
                                        mapScrollRight(pip, player, (pip[0].video->p), pn);\r
+                                       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
@@ -257,21 +240,25 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                                        INC_PER_FRAME;\r
                                        player[pn].enti.x+=(player[pn].enti.speed);\r
                                        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
                        }\r
                        else\r
                        {\r
+                               if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32);\r
 #ifdef SPRITE\r
                                modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 24, 32, PLAYERBMPDATAPTR);\r
 #else\r
                                modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 14);\r
 #endif\r
+                               if(!pageflipflop) modexShowPage(pip[1].page);\r
                                player[pn].enti.d = 2;\r
                        }\r
                        player[pn].enti.triggerx = player[pn].enti.tx+1;\r
                        player[pn].enti.triggery = player[pn].enti.ty;\r
                break;\r
+\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
@@ -283,7 +270,9 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                                        ANIMATESPRIFUN(pip, player, pn, 1);\r
                                        ScrollLeft(pip, player, 3, pn);\r
                                        ScrollLeft(pip, player, 2, pn);\r
+                                       //mapScrollLeft(pip, player, !(pip[0].video->p), pn);\r
                                        mapScrollLeft(pip, player, (pip[0].video->p), pn);\r
+                                       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
@@ -295,21 +284,25 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                                        INC_PER_FRAME;\r
                                        player[pn].enti.x-=(player[pn].enti.speed);\r
                                        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
                        }\r
                        else\r
                        {\r
+                               if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32);\r
 #ifdef SPRITE\r
                                modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 96, 24, 32, PLAYERBMPDATAPTR);\r
 #else\r
                                modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 10);\r
 #endif\r
+                               if(!pageflipflop) modexShowPage(pip[1].page);\r
                                player[pn].enti.d = 2;\r
                        }\r
                        player[pn].enti.triggerx = player[pn].enti.tx-1;\r
                        player[pn].enti.triggery = player[pn].enti.ty;\r
                break;\r
+\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
@@ -321,7 +314,9 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                                        ANIMATESPRIFUN(pip, player, pn, 1);\r
                                        ScrollDown(pip, player, 3, pn);\r
                                        ScrollDown(pip, player, 2, pn);\r
+                                       //mapScrollDown(pip, player, !(pip[0].video->p), pn);\r
                                        mapScrollDown(pip, player, (pip[0].video->p), pn);\r
+                                       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
@@ -333,21 +328,25 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                                        INC_PER_FRAME;\r
                                        player[pn].enti.y+=(player[pn].enti.speed);\r
                                        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
                        }\r
                        else\r
                        {\r
+                               if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32);\r
 #ifdef SPRITE\r
                                modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 64, 24, 32, PLAYERBMPDATAPTR);\r
 #else\r
                                modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 9);\r
 #endif\r
+                               if(!pageflipflop) modexShowPage(pip[1].page);\r
                                player[pn].enti.d = 2;\r
                        }\r
                        player[pn].enti.triggerx = player[pn].enti.tx;\r
                        player[pn].enti.triggery = player[pn].enti.ty+1;\r
                break;\r
+\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
@@ -359,7 +358,9 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                                        ANIMATESPRIFUN(pip, player, pn, 1);\r
                                        ScrollUp(pip, player, 3, pn);\r
                                        ScrollUp(pip, player, 2, pn);\r
+                                       //mapScrollUp(pip, player, !(pip[0].video->p), pn);\r
                                        mapScrollUp(pip, player, (pip[0].video->p), pn);\r
+                                       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
@@ -371,16 +372,19 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn)
                                        INC_PER_FRAME;\r
                                        player[pn].enti.y-=(player[pn].enti.speed);\r
                                        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
                        }\r
                        else\r
                        {\r
+                               if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32);\r
 #ifdef SPRITE\r
                                modexDrawSpriteRegion(pip[0].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 0, 24, 32, PLAYERBMPDATAPTR);\r
 #else\r
                                modexClearRegion(pip[1].page, player[pn].enti.x, player[pn].enti.y-TILEWH, 24, 32, 12);\r
 #endif\r
+                               if(!pageflipflop) modexShowPage(pip[1].page);\r
                                player[pn].enti.d = 2;\r
                        }\r
                        player[pn].enti.triggerx = player[pn].enti.tx;\r
@@ -1103,10 +1107,10 @@ void shinku(global_game_variables_t *gv)
 #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
 #else\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
+#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
 #endif\r
 \r
 void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scrollswitch)\r
@@ -1197,114 +1201,17 @@ void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scroll
        pip->video->r=1;\r
 }\r
 \r
-/*\r
-void animate_spri(struct sprite *spri, global_game_variables_t *gv)\r
-{\r
-#define GVARVIDEO gv->video\r
-#define VMEMPAGESIZE2  GVARVIDEO.page[0].pagesize+GVARVIDEO.page[1].pagesize\r
-#define VMEMPAGEDATA2  GVARVIDEO.page[2].data\r
-       unsigned int i,o,o2; int j;\r
-       int x,y,rx,ry,w,h;\r
-       int overdraw = 1;       // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks.\r
-                                               // if the sprite's edge pixels are clear anyway, you can set this to 0.\r
-       VGA_RAM_PTR omemptr;\r
-\r
-       // Events go here\r
 \r
-\r
-       omemptr = vga_state.vga_graphics_ram; // save original mem ptr\r
-       x=spri->x-4;\r
-       y=spri->y;\r
-\r
-       // Draw sprite\r
-       j = get_vrl_by_id(spri->spritesheet, spri->curr_spri_id, spri->sprite_vrl_cont);\r
-       if(j < 0)\r
-       {\r
-               Quit (gv, "Error retriving required sprite");\r
-       }\r
-\r
-       // render box bounds. y does not need modification, but x and width must be multiple of 4\r
-       if (x >= overdraw) rx = (x - overdraw) & (~3);\r
-               else rx = -(GVARVIDEO.page[0].dx);\r
-       if (y >= overdraw) ry = (y - overdraw);\r
-               else ry = -(GVARVIDEO.page[0].dy);\r
-       h = spri->sprite_vrl_cont->vrl_header->height + overdraw + y - ry;\r
-       w = (x + spri->sprite_vrl_cont->vrl_header->width + (overdraw*2) + 3 - rx) & (~3);//round up\r
-       if ((rx+w) > GVARVIDEO.page[0].width) w = GVARVIDEO.page[0].width-rx;\r
-       if ((ry+h) > GVARVIDEO.page[0].height) h = GVARVIDEO.page[0].height-ry;\r
-\r
-       // block copy pattern to where we will draw the sprite\r
-       vga_setup_wm1_block_copy();\r
-       o2 = VMEMPAGESIZE2;\r
-       o = (0x10000UL - (uint16_t)VMEMPAGEDATA2) + (ry * GVARVIDEO.page[0].stridew) + (rx >> 2); // source offscreen\r
-       for (i=0;i < h;i++,o += GVARVIDEO.page[0].stridew,o2 += (w >> 2)) vga_wm1_mem_block_copy(o2,o,w >> 2);\r
-\r
-       // must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally\r
-       vga_restore_rm0wm0();\r
-\r
-       // replace VGA stride with our own and mem ptr. then sprite rendering at this stage is just (0,0)\r
-       vga_state.vga_draw_stride_limit = (GVARVIDEO.page[0].width + 3 - x) >> 2;//round up\r
-       vga_state.vga_draw_stride = w >> 2;\r
-       vga_state.vga_graphics_ram = omemptr + VMEMPAGESIZE2;\r
-\r
-       // then the sprite. note modding ram ptr means we just draw to (x&3,0)\r
-       draw_vrl1_vgax_modex(\r
-               x-rx,\r
-               y-ry,\r
-               spri->sprite_vrl_cont->vrl_header,\r
-               spri->sprite_vrl_cont->line_offsets,\r
-               spri->sprite_vrl_cont->buffer + sizeof(struct vrl1_vgax_header),\r
-               spri->sprite_vrl_cont->data_size\r
-       );\r
-\r
-       // restore ptr\r
-       vga_state.vga_graphics_ram = omemptr;\r
-\r
-       // block copy to visible RAM from offscreen\r
-       vga_setup_wm1_block_copy();\r
-       o = VMEMPAGESIZE2; // source offscreen\r
-       o2 = (ry * GVARVIDEO.page[0].stridew) + (rx >> 2); // dest visible (original stride)\r
-       for (i=0;i < h;i++,o += vga_state.vga_draw_stride,o2 += GVARVIDEO.page[0].stridew) vga_wm1_mem_block_copy(o2,o,w >> 2);\r
-       // must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally\r
-       vga_restore_rm0wm0();\r
-\r
-       // restore stride\r
-       vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = GVARVIDEO.page[0].stridew;\r
-\r
-       // Depending on delay, update indices\r
-       switch(spri->delay){\r
-               // Delay = 0 means that sprite should loop. Nothing to change here\r
-               case 0:\r
-                       break;\r
-\r
-               // Delay = 1 means that on next time unit sprite should be changed\r
-               case 1:\r
-                       spri->curr_anim_spri++;\r
-\r
-                       // If we hit the end of an animation sequence, restart it\r
-                       if(!(spri->curr_spri_id = spri->curr_anim_list[spri->curr_anim_spri].sprite_id)){\r
-                               spri->curr_anim_spri = 0;\r
-                               spri->curr_spri_id = spri->curr_anim_list[spri->curr_anim_spri].sprite_id;\r
-                       }\r
-                       spri->delay = spri->curr_anim_list[spri->curr_anim_spri].delay;\r
-\r
-               // Delay > 1 means that we should not change sprite yet. Decrease delay\r
-               default:\r
-                       spri->delay--;\r
-                       break;\r
-       }\r
-}\r
-*/\r
-//void animate_spri(struct sprite *spri, global_game_variables_t *gv)\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
        sword y = player[pn].enti.y;\r
        word dire=10; //direction\r
-       sword i;\r
        sword qq; //scroll offset\r
        word ls = player[pn].enti.persist_aniframe;\r
-\r
+#ifdef SPRITE\r
+       int i=0;\r
+#endif\r
        switch(scrollswitch)\r
        {\r
                case 0:\r
@@ -1314,30 +1221,32 @@ 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
-       //x-=4;\r
+#ifdef SPRITE\r
+       x-=4;\r
+#endif\r
        y-=pip[0].map->tiles->tileHeight;\r
        switch (player[pn].enti.d)\r
        {\r
                case 0:\r
                        //up\r
-                       dire*=(player[pn].enti.d+1);// dire++;\r
+                       dire*=player[pn].enti.d+1;\r
                        y-=qq;\r
                break;\r
                case 3:\r
                        // right\r
-                       dire*=(player[pn].enti.d-1);// dire++;\r
+                       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);// dire++;\r
+                       dire*=(player[pn].enti.d-1);\r
                        y+=qq;\r
                break;\r
                case 1:\r
                        //left\r
-                       dire*=(player[pn].enti.d+3);// dire++;\r
+                       dire*=(player[pn].enti.d+3);\r
                        x-=qq;\r
                break;\r
        }\r
@@ -1350,11 +1259,19 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scr
 //#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
@@ -1362,7 +1279,7 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scr
                        NFRAME1\r
                break;\r
                case 2:\r
-                       NFRAME2;\r
+                       NFRAME2\r
                break;\r
                case 3:\r
                        NFRAME3\r
index f514f416fdad892379a01109582ef9446e242051..b9bfed95962df95586a78f31a4e3120f7b05b033 100755 (executable)
@@ -108,7 +108,7 @@ typedef struct {
        printf("        tx: %d", player[0].enti.tx); printf("   ty: %d\n", player[0].enti.ty);\\r
        printf("        triggx: %d", player[0].enti.triggerx); printf(" triggy: %d\n", player[0].enti.triggery);\\r
        printf("        hp: %d", (player[0].enti.hp));  printf("        q: %d", player[0].enti.q);      printf("        player.info.dir: %d", player[0].info.dir);      printf("        player.d: %d ", player[0].enti.d);\\r
-               printf("        pdir=%d\n", player[0].pdir);\\r
+               printf("        pdir=%d\n", player[0].pdir); printf("   aniframe=%u", player[0].enti.persist_aniframe);\\r
        printf("        tile data value at player trigger position: %d\n\n", mv[0].map->data[(player[0].enti.triggerx-1)+(map.width*(player[0].enti.triggery-1))]);\\r
 \\r
        printf("Virtual Screen: %dx", gvar.video.page[0].width);        printf("%d      ", gvar.video.page[0].height);\\r
@@ -137,8 +137,8 @@ extern char global_temp_status_text[512];
 \r
 //map_t allocMap(int w, int h);\r
 //void initMap(map_t *map);\r
-void walk(map_view_t *pip, player_t *player, word pn);\r
 void ZC_walk(map_view_t *pip, player_t *player, word pn);\r
+void oldwalk(map_view_t *pip, player_t *player, word pn);\r
 void ZC_panPageManual(map_view_t *pip, player_t *player, word pn);\r
 void ZC_MVSetup(map_view_t *pip, map_t *map, global_game_variables_t *gv);\r
 void ZC_MVInit(map_view_t *pip, int tx, int ty);\r
index 4dd1359858ee7b5d7df135b22fd15d69f63cad6f..99ded28a405a4c89cb968397666a762bab699da2 100755 (executable)
@@ -108,11 +108,12 @@ void main(int argc, char *argv[])
 \r
        playerXYpos(0, 0, &player, &mv, 0);\r
        IN_initplayer(&player, 0);\r
-       player[0].ent->spri->x = player[0].enti.x;\r
-       player[0].ent->spri->y = player[0].enti.y;\r
+       player[0].ent->spri->x = player[0].enti.x-4;\r
+       player[0].ent->spri->y = player[0].enti.y-16;\r
+       player[0].ent->spri->delay = 0;\r
 \r
        i = set_anim_by_id(player[0].ent->spri, 31);\r
-       print_anim_ids(player[0].ent->spri);\r
+       //print_anim_ids(player[0].ent->spri);\r
        if (i == -1)\r
        {\r
 #ifdef FADE\r
@@ -193,7 +194,7 @@ void main(int argc, char *argv[])
                                        player[0].ent->spri->x = TILEWH;\r
                                default:\r
                                        i++;\r
-                                       player[0].ent->spri->delay = 1; animate_spri((player[0].ent->spri), &gvar.video);// player[0].ent->spri->x += 16;\r
+                                       player[0].ent->spri->delay = 0; animate_spri((player[0].ent->spri), &gvar.video);// player[0].ent->spri->x += 16;\r
                                break;\r
                        }\r
                }\r