From: sparky4 Date: Tue, 17 Jan 2017 20:08:46 +0000 (-0600) Subject: palllist not being worked on right now... i will work on sprite animation VERY soon X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=commitdiff_plain;h=06a59aa7546448c4e6f6e816f2e01219d4f3c041 palllist not being worked on right now... i will work on sprite animation VERY soon --- diff --git a/DEBUG.16W b/DEBUG.16W index 8eb06ade..fa556aa7 100755 --- a/DEBUG.16W +++ b/DEBUG.16W @@ -1,210 +1,210 @@ -Seg:0 Size:9822 Owner:0x0 +Seg:0 Size:9819 Owner:0x0 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++0000 -Seg:2726 Size:44 Owner:0x0 +Seg:2723 Size:44 Owner:0x0 + -Seg:2752 Size:256 Owner:0x1964 -+++++ -Seg:2852 Size:256 Owner:0x1756 +Seg:274f Size:256 Owner:0x1964 +++++ +Seg:284f Size:256 Owner:0x1756 ++++++ +Seg:294f Size:256 Owner:0x1758 ++++ -Seg:2952 Size:256 Owner:0x1758 +Seg:2a4f Size:256 Owner:0x175a ++++ -Seg:2a52 Size:256 Owner:0x175a +Seg:2b4f Size:256 Owner:0x175c ++++ -Seg:2b52 Size:256 Owner:0x175c +Seg:2c4f Size:256 Owner:0x175e ++++ -Seg:2c52 Size:256 Owner:0x175e +Seg:2d4f Size:256 Owner:0x1760 +++++ -Seg:2d52 Size:256 Owner:0x1760 +Seg:2e4f Size:256 Owner:0x1762 ++++ -Seg:2e52 Size:256 Owner:0x1762 +Seg:2f4f Size:256 Owner:0x1764 ++++ -Seg:2f52 Size:256 Owner:0x1764 +Seg:304f Size:256 Owner:0x1766 ++++ -Seg:3052 Size:256 Owner:0x1766 +Seg:314f Size:256 Owner:0x1768 ++++ -Seg:3152 Size:256 Owner:0x1768 +Seg:324f Size:256 Owner:0x176a +++++ -Seg:3252 Size:256 Owner:0x176a +Seg:334f Size:256 Owner:0x176c ++++ -Seg:3352 Size:256 Owner:0x176c +Seg:344f Size:256 Owner:0x176e ++++ -Seg:3452 Size:256 Owner:0x176e +Seg:354f Size:256 Owner:0x1770 ++++ -Seg:3552 Size:256 Owner:0x1770 +Seg:364f Size:256 Owner:0x1772 ++++ -Seg:3652 Size:256 Owner:0x1772 +Seg:374f Size:256 Owner:0x1774 +++++ -Seg:3752 Size:256 Owner:0x1774 +Seg:384f Size:256 Owner:0x1776 ++++ -Seg:3852 Size:256 Owner:0x1776 +Seg:394f Size:256 Owner:0x1778 ++++ -Seg:3952 Size:256 Owner:0x1778 +Seg:3a4f Size:256 Owner:0x177a ++++ -Seg:3a52 Size:256 Owner:0x177a +Seg:3b4f Size:256 Owner:0x177c ++++ -Seg:3b52 Size:256 Owner:0x177c +Seg:3c4f Size:256 Owner:0x177e +++++ -Seg:3c52 Size:256 Owner:0x177e +Seg:3d4f Size:256 Owner:0x1780 ++++ -Seg:3d52 Size:256 Owner:0x1780 +Seg:3e4f Size:256 Owner:0x1782 ++++ -Seg:3e52 Size:256 Owner:0x1782 +Seg:3f4f Size:256 Owner:0x1784 ++++ -Seg:3f52 Size:256 Owner:0x1784 +Seg:404f Size:256 Owner:0x1786 ++++ -Seg:4052 Size:256 Owner:0x1786 +Seg:414f Size:256 Owner:0x1788 +++++ -Seg:4152 Size:256 Owner:0x1788 +Seg:424f Size:256 Owner:0x178a ++++ -Seg:4252 Size:256 Owner:0x178a +Seg:434f Size:256 Owner:0x178c ++++ -Seg:4352 Size:256 Owner:0x178c +Seg:444f Size:256 Owner:0x178e ++++ -Seg:4452 Size:256 Owner:0x178e +Seg:454f Size:256 Owner:0x1790 ++++ -Seg:4552 Size:256 Owner:0x1790 +Seg:464f Size:256 Owner:0x1792 +++++ -Seg:4652 Size:256 Owner:0x1792 +Seg:474f Size:256 Owner:0x1794 ++++ -Seg:4752 Size:256 Owner:0x1794 +Seg:484f Size:256 Owner:0x1796 ++++ -Seg:4852 Size:256 Owner:0x1796 +Seg:494f Size:256 Owner:0x1798 ++++ -Seg:4952 Size:256 Owner:0x1798 +Seg:4a4f Size:256 Owner:0x179a ++++ -Seg:4a52 Size:256 Owner:0x179a +Seg:4b4f Size:256 Owner:0x179c +++++ -Seg:4b52 Size:256 Owner:0x179c +Seg:4c4f Size:256 Owner:0x179e ++++ -Seg:4c52 Size:256 Owner:0x179e +Seg:4d4f Size:256 Owner:0x17a0 ++++ -Seg:4d52 Size:256 Owner:0x17a0 +Seg:4e4f Size:256 Owner:0x17a2 ++++ -Seg:4e52 Size:256 Owner:0x17a2 +Seg:4f4f Size:256 Owner:0x17a4 ++++ -Seg:4f52 Size:256 Owner:0x17a4 +Seg:504f Size:256 Owner:0x17a6 +++++ -Seg:5052 Size:256 Owner:0x17a6 +Seg:514f Size:256 Owner:0x17a8 ++++ -Seg:5152 Size:256 Owner:0x17a8 +Seg:524f Size:256 Owner:0x17aa ++++ -Seg:5252 Size:256 Owner:0x17aa +Seg:534f Size:256 Owner:0x17ac ++++ -Seg:5352 Size:256 Owner:0x17ac +Seg:544f Size:256 Owner:0x17ae ++++ -Seg:5452 Size:256 Owner:0x17ae +Seg:554f Size:256 Owner:0x17b0 +++++ -Seg:5552 Size:256 Owner:0x17b0 +Seg:564f Size:256 Owner:0x17b2 ++++ -Seg:5652 Size:256 Owner:0x17b2 +Seg:574f Size:256 Owner:0x17b4 ++++ -Seg:5752 Size:256 Owner:0x17b4 +Seg:584f Size:256 Owner:0x17b6 ++++ -Seg:5852 Size:256 Owner:0x17b6 +Seg:594f Size:256 Owner:0x17b8 ++++ -Seg:5952 Size:256 Owner:0x17b8 +Seg:5a4f Size:256 Owner:0x17ba +++++ -Seg:5a52 Size:256 Owner:0x17ba +Seg:5b4f Size:256 Owner:0x17bc ++++ -Seg:5b52 Size:256 Owner:0x17bc +Seg:5c4f Size:256 Owner:0x17be ++++ -Seg:5c52 Size:256 Owner:0x17be +Seg:5d4f Size:256 Owner:0x17c0 ++++ -Seg:5d52 Size:256 Owner:0x17c0 +Seg:5e4f Size:256 Owner:0x17c2 ++++ -Seg:5e52 Size:256 Owner:0x17c2 +Seg:5f4f Size:256 Owner:0x17c4 +++++ -Seg:5f52 Size:256 Owner:0x17c4 +Seg:604f Size:256 Owner:0x17c6 ++++ -Seg:6052 Size:256 Owner:0x17c6 +Seg:614f Size:256 Owner:0x17c8 ++++ -Seg:6152 Size:256 Owner:0x17c8 +Seg:624f Size:256 Owner:0x17ca ++++ -Seg:6252 Size:256 Owner:0x17ca +Seg:634f Size:256 Owner:0x17cc ++++ -Seg:6352 Size:256 Owner:0x17cc +Seg:644f Size:256 Owner:0x17ce +++++ -Seg:6452 Size:256 Owner:0x17ce +Seg:654f Size:256 Owner:0x17d0 ++++ -Seg:6552 Size:256 Owner:0x17d0 +Seg:664f Size:256 Owner:0x17d2 ++++ -Seg:6652 Size:256 Owner:0x17d2 +Seg:674f Size:256 Owner:0x17d4 ++++ -Seg:6752 Size:256 Owner:0x17d4 +Seg:684f Size:256 Owner:0x17d6 ++++ -Seg:6852 Size:256 Owner:0x17d6 +Seg:694f Size:256 Owner:0x17d8 +++++ -Seg:6952 Size:256 Owner:0x17d8 +Seg:6a4f Size:256 Owner:0x17da ++++ -Seg:6a52 Size:256 Owner:0x17da +Seg:6b4f Size:256 Owner:0x17dc ++++ -Seg:6b52 Size:256 Owner:0x17dc +Seg:6c4f Size:256 Owner:0x17de ++++ -Seg:6c52 Size:256 Owner:0x17de +Seg:6d4f Size:256 Owner:0x17e0 ++++ -Seg:6d52 Size:256 Owner:0x17e0 +Seg:6e4f Size:256 Owner:0x17e2 +++++ -Seg:6e52 Size:256 Owner:0x17e2 +Seg:6f4f Size:256 Owner:0x17e4 ++++ -Seg:6f52 Size:256 Owner:0x17e4 +Seg:704f Size:256 Owner:0x17e6 ++++ -Seg:7052 Size:256 Owner:0x17e6 +Seg:714f Size:256 Owner:0x17e8 ++++ -Seg:7152 Size:256 Owner:0x17e8 +Seg:724f Size:256 Owner:0x17ea ++++ -Seg:7252 Size:256 Owner:0x17ea +Seg:734f Size:256 Owner:0x17ec +++++ -Seg:7352 Size:256 Owner:0x17ec +Seg:744f Size:256 Owner:0x17ee ++++ -Seg:7452 Size:256 Owner:0x17ee +Seg:754f Size:256 Owner:0x17f0 ++++ -Seg:7552 Size:256 Owner:0x17f0 +Seg:764f Size:256 Owner:0x17f2 ++++ -Seg:7652 Size:256 Owner:0x17f2 +Seg:774f Size:256 Owner:0x17f4 ++++ -Seg:7752 Size:256 Owner:0x17f4 +Seg:784f Size:256 Owner:0x17f6 +++++ -Seg:7852 Size:256 Owner:0x17f6 +Seg:794f Size:256 Owner:0x17f8 ++++ -Seg:7952 Size:256 Owner:0x17f8 +Seg:7a4f Size:256 Owner:0x17fa ++++ -Seg:7a52 Size:256 Owner:0x17fa +Seg:7b4f Size:256 Owner:0x17fc ++++ -Seg:7b52 Size:256 Owner:0x17fc +Seg:7c4f Size:256 Owner:0x17fe ++++ -Seg:7c52 Size:256 Owner:0x17fe +Seg:7d4f Size:256 Owner:0x1800 +++++ -Seg:7d52 Size:256 Owner:0x1800 +Seg:7e4f Size:256 Owner:0x1802 ++++ -Seg:7e52 Size:256 Owner:0x1802 +Seg:7f4f Size:256 Owner:0x1804 ++++ -Seg:7f52 Size:256 Owner:0x1804 +Seg:804f Size:256 Owner:0x1806 ++++ -Seg:8052 Size:256 Owner:0x1806 +Seg:814f Size:256 Owner:0x1808 ++++ -Seg:8152 Size:256 Owner:0x1808 +Seg:824f Size:256 Owner:0x180a +++++ -Seg:8252 Size:256 Owner:0x180a +Seg:834f Size:256 Owner:0x180c ++++ -Seg:8352 Size:256 Owner:0x180c +Seg:844f Size:256 Owner:0x180e ++++ -Seg:8452 Size:256 Owner:0x180e +Seg:854f Size:256 Owner:0x1810 ++++ -Seg:8552 Size:256 Owner:0x1810 +Seg:864f Size:256 Owner:0x1812 ++++ -Seg:8652 Size:256 Owner:0x1812 +Seg:874f Size:256 Owner:0x1814 +++++ -Seg:8752 Size:256 Owner:0x1814 +Seg:884f Size:256 Owner:0x1816 ++++ -Seg:8852 Size:256 Owner:0x1816 +Seg:894f Size:256 Owner:0x1818 ++++ -Seg:8952 Size:256 Owner:0x1818 +Seg:8a4f Size:256 Owner:0x181a ++++ -Seg:8a52 Size:256 Owner:0x181a +Seg:8b4f Size:256 Owner:0x181c ++++ -Seg:8b52 Size:256 Owner:0x181c -+++++ -Seg:8c52 Size:401 Owner:0xef32 +Seg:8c4f Size:401 Owner:0xef32 ++++++ -Seg:b752 Size:18605 Owner:0x0 +Seg:b74f Size:18608 Owner:0x0 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \ No newline at end of file diff --git a/HEAP.16W b/HEAP.16W index 456f1a62..f92ff98f 100755 --- a/HEAP.16W +++ b/HEAP.16W @@ -1,57 +1,57 @@ == default == - USED block at 27480016 of size 136 - FREE block at 2748009e of size 68 - USED block at 274800e2 of size 50 - USED block at 27480114 of size 50 - USED block at 27480146 of size 50 - USED block at 27480178 of size 50 - USED block at 274801aa of size 50 - USED block at 274801dc of size 50 - USED block at 2748020e of size 50 - USED block at 27480240 of size 50 - USED block at 27480272 of size 50 - USED block at 274802a4 of size 50 - USED block at 274802d6 of size 50 - USED block at 27480308 of size 50 - FREE block at 2748033a of size 14 - USED block at 27480348 of size 20 - FREE block at 2748035c of size 7328 + USED block at 27450016 of size 136 + FREE block at 2745009e of size 68 + USED block at 274500e2 of size 50 + USED block at 27450114 of size 50 + USED block at 27450146 of size 50 + USED block at 27450178 of size 50 + USED block at 274501aa of size 50 + USED block at 274501dc of size 50 + USED block at 2745020e of size 50 + USED block at 27450240 of size 50 + USED block at 27450272 of size 50 + USED block at 274502a4 of size 50 + USED block at 274502d6 of size 50 + USED block at 27450308 of size 50 + FREE block at 2745033a of size 14 + USED block at 27450348 of size 20 + FREE block at 2745035c of size 7328 OK - end of heap == near == - USED block at 1747ef76 of size 12 - USED block at 1747ef82 of size 330 - USED block at 1747f0cc of size 52 - USED block at 1747f100 of size 20 - USED block at 1747f114 of size 20 - USED block at 1747f128 of size 20 - USED block at 1747f13c of size 20 - USED block at 1747f150 of size 20 - USED block at 1747f164 of size 3736 + USED block at 1744ef76 of size 12 + USED block at 1744ef82 of size 330 + USED block at 1744f0cc of size 52 + USED block at 1744f100 of size 20 + USED block at 1744f114 of size 20 + USED block at 1744f128 of size 20 + USED block at 1744f13c of size 20 + USED block at 1744f150 of size 20 + USED block at 1744f164 of size 3736 OK - end of heap == far == - USED block at 27480016 of size 136 - USED block at 2748009e of size 68 - USED block at 274800e2 of size 50 - USED block at 27480114 of size 50 - USED block at 27480146 of size 50 - USED block at 27480178 of size 50 - USED block at 274801aa of size 50 - USED block at 274801dc of size 50 - USED block at 2748020e of size 50 - USED block at 27480240 of size 50 - USED block at 27480272 of size 50 - USED block at 274802a4 of size 50 - USED block at 274802d6 of size 50 - USED block at 27480308 of size 50 - USED block at 2748033a of size 14 - USED block at 27480348 of size 20 - USED block at 2748035c of size 7328 + USED block at 27450016 of size 136 + USED block at 2745009e of size 68 + USED block at 274500e2 of size 50 + USED block at 27450114 of size 50 + USED block at 27450146 of size 50 + USED block at 27450178 of size 50 + USED block at 274501aa of size 50 + USED block at 274501dc of size 50 + USED block at 2745020e of size 50 + USED block at 27450240 of size 50 + USED block at 27450272 of size 50 + USED block at 274502a4 of size 50 + USED block at 274502d6 of size 50 + USED block at 27450308 of size 50 + USED block at 2745033a of size 14 + USED block at 27450348 of size 20 + USED block at 2745035c of size 7328 OK - end of heap Memory Type Total Used Free diff --git a/MMDUMP.16W b/MMDUMP.16W index 8d3b00cf..b22737eb 100755 Binary files a/MMDUMP.16W and b/MMDUMP.16W differ diff --git a/src/lib/16_sprit.c b/src/lib/16_sprit.c index e74b3907..28808614 100755 --- a/src/lib/16_sprit.c +++ b/src/lib/16_sprit.c @@ -150,11 +150,11 @@ void animate_spri(struct sprite *spri, global_game_variables_t *gv) } } */ -void animate_spri(struct sprite *spri, global_game_variables_t *gv) +void animate_spri(struct sprite *spri, video_t *video) { -#define GVARVIDEO gv->video -#define VMEMPAGESIZE2 GVARVIDEO.page[0].pagesize+GVARVIDEO.page[1].pagesize -#define VMEMPAGEDATA2 GVARVIDEO.page[2].data +#define GVARVIDEO video +#define VMEMPAGESIZE2 GVARVIDEO->page[0].pagesize+GVARVIDEO->page[1].pagesize +#define VMEMPAGEDATA2 GVARVIDEO->page[2].data unsigned int i,o,o2; int j; int x,y,rx,ry,w,h; int overdraw = 1; // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks. @@ -165,37 +165,38 @@ void animate_spri(struct sprite *spri, global_game_variables_t *gv) omemptr = vga_state.vga_graphics_ram; // save original mem ptr - x=spri->x-4; + x=spri->x;//-4; y=spri->y; // Draw sprite j = get_vrl_by_id(spri->spritesheet, spri->curr_spri_id, spri->sprite_vrl_cont); if(j < 0) { - Quit (gv, "Error retriving required sprite"); + //Quit (gv, "Error retriving required sprite"); + return; } // render box bounds. y does not need modification, but x and width must be multiple of 4 if (x >= overdraw) rx = (x - overdraw) & (~3); - else rx = -(GVARVIDEO.page[0].dx); + else rx = -(GVARVIDEO->page[0].dx); if (y >= overdraw) ry = (y - overdraw); - else ry = -(GVARVIDEO.page[0].dy); + else ry = -(GVARVIDEO->page[0].dy); h = spri->sprite_vrl_cont->vrl_header->height + overdraw + y - ry; w = (x + spri->sprite_vrl_cont->vrl_header->width + (overdraw*2) + 3 - rx) & (~3);//round up - if ((rx+w) > GVARVIDEO.page[0].width) w = GVARVIDEO.page[0].width-rx; - if ((ry+h) > GVARVIDEO.page[0].height) h = GVARVIDEO.page[0].height-ry; + if ((rx+w) > GVARVIDEO->page[0].width) w = GVARVIDEO->page[0].width-rx; + if ((ry+h) > GVARVIDEO->page[0].height) h = GVARVIDEO->page[0].height-ry; // block copy pattern to where we will draw the sprite vga_setup_wm1_block_copy(); o2 = VMEMPAGESIZE2; - o = (0x10000UL - (uint16_t)VMEMPAGEDATA2) + (ry * GVARVIDEO.page[0].stridew) + (rx >> 2); // source offscreen - for (i=0;i < h;i++,o += GVARVIDEO.page[0].stridew,o2 += (w >> 2)) vga_wm1_mem_block_copy(o2,o,w >> 2); + o = (0x10000UL - (uint16_t)VMEMPAGEDATA2) + (ry * GVARVIDEO->page[0].stridew) + (rx >> 2); // source offscreen + for (i=0;i < h;i++,o += GVARVIDEO->page[0].stridew,o2 += (w >> 2)) vga_wm1_mem_block_copy(o2,o,w >> 2); // must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally vga_restore_rm0wm0(); // replace VGA stride with our own and mem ptr. then sprite rendering at this stage is just (0,0) - vga_state.vga_draw_stride_limit = (GVARVIDEO.page[0].width + 3 - x) >> 2;//round up + vga_state.vga_draw_stride_limit = (GVARVIDEO->page[0].width + 3 - x) >> 2;//round up vga_state.vga_draw_stride = w >> 2; vga_state.vga_graphics_ram = omemptr + VMEMPAGESIZE2; @@ -215,13 +216,13 @@ void animate_spri(struct sprite *spri, global_game_variables_t *gv) // block copy to visible RAM from offscreen vga_setup_wm1_block_copy(); o = VMEMPAGESIZE2; // source offscreen - o2 = (ry * GVARVIDEO.page[0].stridew) + (rx >> 2); // dest visible (original stride) - 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); + o2 = (ry * GVARVIDEO->page[0].stridew) + (rx >> 2); // dest visible (original stride) + 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); // must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally vga_restore_rm0wm0(); // restore stride - vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = GVARVIDEO.page[0].stridew; + vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = GVARVIDEO->page[0].stridew; // Depending on delay, update indices switch(spri->delay){ diff --git a/src/lib/16_sprit.h b/src/lib/16_sprit.h index 9ef500e5..386b42f1 100755 --- a/src/lib/16_sprit.h +++ b/src/lib/16_sprit.h @@ -66,7 +66,7 @@ int set_anim_by_id(struct sprite *spri, int id); * In: * + struct sprite *spri - sprite to animate */ -void animate_spri(struct sprite *spri, global_game_variables_t *gvar); +void animate_spri(struct sprite *spri, video_t *video); void print_anim_ids(struct sprite *spri); diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index 8a29dc79..d4a34e5c 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -24,6 +24,8 @@ */ #include "src/lib/scroll16.h" +#define ANIMATESPRIFUN ZC_animatePlayer + void oldwalk(map_view_t *pip, player_t *player, word pn) { #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; @@ -43,7 +45,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn) if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; - animatePlayer(pip, player, pn, 1); + ANIMATESPRIFUN(pip, player, pn, 1); ScrollRight(pip, player, 3, pn); ScrollRight(pip, player, 2, pn); //mapScrollRight(pip, player, !(pip[0].video->p), pn); @@ -59,7 +61,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn) { INC_PER_FRAME; player[pn].enti.x+=(player[pn].enti.speed); - animatePlayer(pip, player, pn, 0); + ANIMATESPRIFUN(pip, player, pn, 0); if(!pageflipflop) modexShowPage(pip[1].page); player[pn].enti.q++; } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; } @@ -87,7 +89,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn) if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; - animatePlayer(pip, player, pn, 1); + ANIMATESPRIFUN(pip, player, pn, 1); ScrollLeft(pip, player, 3, pn); ScrollLeft(pip, player, 2, pn); //mapScrollLeft(pip, player, !(pip[0].video->p), pn); @@ -103,7 +105,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn) { INC_PER_FRAME; player[pn].enti.x-=(player[pn].enti.speed); - animatePlayer(pip, player, pn, 0); + ANIMATESPRIFUN(pip, player, pn, 0); if(!pageflipflop) modexShowPage(pip[1].page); player[pn].enti.q++; } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; } @@ -131,7 +133,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn) if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; - animatePlayer(pip, player, pn, 1); + ANIMATESPRIFUN(pip, player, pn, 1); ScrollDown(pip, player, 3, pn); ScrollDown(pip, player, 2, pn); //mapScrollDown(pip, player, !(pip[0].video->p), pn); @@ -147,7 +149,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn) { INC_PER_FRAME; player[pn].enti.y+=(player[pn].enti.speed); - animatePlayer(pip, player, pn, 0); + ANIMATESPRIFUN(pip, player, pn, 0); if(!pageflipflop) modexShowPage(pip[1].page); player[pn].enti.q++; } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; } @@ -175,7 +177,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn) if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; - animatePlayer(pip, player, pn, 1); + ANIMATESPRIFUN(pip, player, pn, 1); ScrollUp(pip, player, 3, pn); ScrollUp(pip, player, 2, pn); //mapScrollUp(pip, player, !(pip[0].video->p), pn); @@ -191,7 +193,7 @@ void oldwalk(map_view_t *pip, player_t *player, word pn) { INC_PER_FRAME; player[pn].enti.y-=(player[pn].enti.speed); - animatePlayer(pip, player, 0, pn); + ANIMATESPRIFUN(pip, player, 0, pn); if(!pageflipflop) modexShowPage(pip[1].page); player[pn].enti.q++; } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; } @@ -240,7 +242,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn) if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; - animatePlayer(pip, player, pn, 1); + ANIMATESPRIFUN(pip, player, pn, 1); ScrollRight(pip, player, 3, pn); ScrollRight(pip, player, 2, pn); mapScrollRight(pip, player, (pip[0].video->p), pn); @@ -254,7 +256,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn) { INC_PER_FRAME; player[pn].enti.x+=(player[pn].enti.speed); - animatePlayer(pip, player, pn, 0); + ANIMATESPRIFUN(pip, player, pn, 0); player[pn].enti.q++; } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx++; } } @@ -278,7 +280,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn) if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; - animatePlayer(pip, player, pn, 1); + ANIMATESPRIFUN(pip, player, pn, 1); ScrollLeft(pip, player, 3, pn); ScrollLeft(pip, player, 2, pn); mapScrollLeft(pip, player, (pip[0].video->p), pn); @@ -292,7 +294,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn) { INC_PER_FRAME; player[pn].enti.x-=(player[pn].enti.speed); - animatePlayer(pip, player, pn, 0); + ANIMATESPRIFUN(pip, player, pn, 0); player[pn].enti.q++; } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.tx--; } } @@ -316,7 +318,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn) if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; - animatePlayer(pip, player, pn, 1); + ANIMATESPRIFUN(pip, player, pn, 1); ScrollDown(pip, player, 3, pn); ScrollDown(pip, player, 2, pn); mapScrollDown(pip, player, (pip[0].video->p), pn); @@ -330,7 +332,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn) { INC_PER_FRAME; player[pn].enti.y+=(player[pn].enti.speed); - animatePlayer(pip, player, pn, 0); + ANIMATESPRIFUN(pip, player, pn, 0); player[pn].enti.q++; } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty++; } } @@ -354,7 +356,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn) if(player[pn].enti.q<=player[pn].enti.spt) { INC_PER_FRAME; - animatePlayer(pip, player, pn, 1); + ANIMATESPRIFUN(pip, player, pn, 1); ScrollUp(pip, player, 3, pn); ScrollUp(pip, player, 2, pn); mapScrollUp(pip, player, (pip[0].video->p), pn); @@ -368,7 +370,7 @@ void ZC_walk(map_view_t *pip, player_t *player, word pn) { INC_PER_FRAME; player[pn].enti.y-=(player[pn].enti.speed); - animatePlayer(pip, player, 0, pn); + ANIMATESPRIFUN(pip, player, 0, pn); player[pn].enti.q++; } else { player[pn].enti.q = 1; player[pn].enti.d = 2; player[pn].enti.ty--; } } @@ -1296,16 +1298,13 @@ void animate_spri(struct sprite *spri, global_game_variables_t *gv) //void animate_spri(struct sprite *spri, global_game_variables_t *gv) void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scrollswitch) { - struct sprite *spri = player[pn].ent->spri; sword x = player[pn].enti.x; sword y = player[pn].enti.y; - word dire=32; //direction + word dire=10; //direction + sword i; sword qq; //scroll offset word ls = player[pn].enti.persist_aniframe; - spri->x=x; - spri->y=y; - switch(scrollswitch) { case 0: @@ -1321,36 +1320,41 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scr { case 0: //up - dire*=player[pn].enti.d; + dire*=(player[pn].enti.d+1);// dire++; y-=qq; break; case 3: // right - dire*=(player[pn].enti.d-2); + dire*=(player[pn].enti.d-1);// dire++; x+=qq; break; case 2: break; case 4: //down - dire*=(player[pn].enti.d-2); + dire*=(player[pn].enti.d-1);// dire++; y+=qq; break; case 1: //left - dire*=(player[pn].enti.d+2); + dire*=(player[pn].enti.d+3);// dire++; x-=qq; break; } + //setting xy position + player[pn].ent->spri->x = x; + player[pn].ent->spri->y = y; + //#define FRAME1 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 2+dire); //#define FRAME2 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 1+dire); //#define FRAME3 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, dire); //#define FRAME4 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 1+dire); -#define NFRAME1 -#define NFRAME2 -#define NFRAME3 -#define NFRAME4 +#define DRAWFRAME if (i == -1) return; animate_spri(player[pn].ent->spri, pip->video) +#define NFRAME1 i = set_anim_by_id(player[pn].ent->spri, 2+dire); DRAWFRAME; +#define NFRAME2 i = set_anim_by_id(player[pn].ent->spri, 1+dire); DRAWFRAME; +#define NFRAME3 i = set_anim_by_id(player[pn].ent->spri, dire); DRAWFRAME; +#define NFRAME4 i = set_anim_by_id(player[pn].ent->spri, 2+dire); DRAWFRAME; switch(ls) { @@ -1358,7 +1362,7 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scr NFRAME1 break; case 2: - NFRAME2 + NFRAME2; break; case 3: NFRAME3 diff --git a/src/vrstest.c b/src/vrstest.c index a7e48d1b..f94f4c0f 100755 --- a/src/vrstest.c +++ b/src/vrstest.c @@ -121,7 +121,7 @@ void main() modexPalUpdate1(pal);*/ VL_LoadPalFile("data/spri/chikyuu.pal", &palette); for (i = 0; i < 5; i++){ - spri.delay = 1; animate_spri(&spri, &gvar);// spri.x += 16; + spri.delay = 1; animate_spri(&spri, &gvar.video);// spri.x += 16; sleep(1); } diff --git a/src/zcroll.c b/src/zcroll.c index 92f54d09..4dd13598 100755 --- a/src/zcroll.c +++ b/src/zcroll.c @@ -100,7 +100,7 @@ void main(int argc, char *argv[]) // setup camera and screen~ modexHiganbanaPageSetup(&gvar.video); ZC_MVSetup(&mv, &map, &gvar); - player[0].ent->spri->x = player[0].ent->spri->y = TILEWH; + //player[0].ent->spri->x = player[0].ent->spri->y = TILEWH; // set up paging //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen @@ -108,8 +108,10 @@ void main(int argc, char *argv[]) playerXYpos(0, 0, &player, &mv, 0); IN_initplayer(&player, 0); + player[0].ent->spri->x = player[0].enti.x; + player[0].ent->spri->y = player[0].enti.y; - i = set_anim_by_id(player[0].ent->spri, 11); + i = set_anim_by_id(player[0].ent->spri, 31); print_anim_ids(player[0].ent->spri); if (i == -1) { @@ -121,7 +123,7 @@ void main(int argc, char *argv[]) modexFadeOn(4, dpal); #endif } - animate_spri((player[0].ent->spri), &gvar); + animate_spri((player[0].ent->spri), &gvar.video); VL_ShowPage(mv[0].page, 0, 0);//modexShowPage(mv[0].page);//!(gvar.video.p) #ifdef FADE @@ -191,7 +193,7 @@ void main(int argc, char *argv[]) player[0].ent->spri->x = TILEWH; default: i++; - player[0].ent->spri->delay = 1; animate_spri((player[0].ent->spri), &gvar);// player[0].ent->spri->x += 16; + player[0].ent->spri->delay = 1; animate_spri((player[0].ent->spri), &gvar.video);// player[0].ent->spri->x += 16; break; } }