From: sparky4 Date: Tue, 24 Jan 2017 18:50:17 +0000 (-0600) Subject: something is bothering me very much on the animation part of frame. particularly... X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=cfba60702c8aa81180bb10781950ad7eab914bcc;p=16.git something is bothering me very much on the animation part of frame. particularly on when chikyuu is in the standing state ... it is only drawed 1 time --- diff --git a/DEBUG.16W b/DEBUG.16W new file mode 100755 index 00000000..5bef76d3 --- /dev/null +++ b/DEBUG.16W @@ -0,0 +1,210 @@ +Seg:0 Size:9859 Owner:0x0 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++000 +Seg:274a Size:44 Owner:0x0 +++ +Seg:2776 Size:256 Owner:0x1970 +++++ +Seg:2876 Size:256 Owner:0x1762 +++++ +Seg:2976 Size:256 Owner:0x1764 +++++ +Seg:2a76 Size:256 Owner:0x1766 ++++++ +Seg:2b76 Size:256 Owner:0x1768 +++++ +Seg:2c76 Size:256 Owner:0x176a +++++ +Seg:2d76 Size:256 Owner:0x176c +++++ +Seg:2e76 Size:256 Owner:0x176e +++++ +Seg:2f76 Size:256 Owner:0x1770 ++++++ +Seg:3076 Size:256 Owner:0x1772 +++++ +Seg:3176 Size:256 Owner:0x1774 +++++ +Seg:3276 Size:256 Owner:0x1776 +++++ +Seg:3376 Size:256 Owner:0x1778 +++++ +Seg:3476 Size:256 Owner:0x177a ++++++ +Seg:3576 Size:256 Owner:0x177c +++++ +Seg:3676 Size:256 Owner:0x177e +++++ +Seg:3776 Size:256 Owner:0x1780 +++++ +Seg:3876 Size:256 Owner:0x1782 +++++ +Seg:3976 Size:256 Owner:0x1784 ++++++ +Seg:3a76 Size:256 Owner:0x1786 +++++ +Seg:3b76 Size:256 Owner:0x1788 +++++ +Seg:3c76 Size:256 Owner:0x178a +++++ +Seg:3d76 Size:256 Owner:0x178c +++++ +Seg:3e76 Size:256 Owner:0x178e ++++++ +Seg:3f76 Size:256 Owner:0x1790 +++++ +Seg:4076 Size:256 Owner:0x1792 +++++ +Seg:4176 Size:256 Owner:0x1794 +++++ +Seg:4276 Size:256 Owner:0x1796 +++++ +Seg:4376 Size:256 Owner:0x1798 ++++++ +Seg:4476 Size:256 Owner:0x179a +++++ +Seg:4576 Size:256 Owner:0x179c +++++ +Seg:4676 Size:256 Owner:0x179e +++++ +Seg:4776 Size:256 Owner:0x17a0 +++++ +Seg:4876 Size:256 Owner:0x17a2 ++++++ +Seg:4976 Size:256 Owner:0x17a4 +++++ +Seg:4a76 Size:256 Owner:0x17a6 +++++ +Seg:4b76 Size:256 Owner:0x17a8 +++++ +Seg:4c76 Size:256 Owner:0x17aa +++++ +Seg:4d76 Size:256 Owner:0x17ac ++++++ +Seg:4e76 Size:256 Owner:0x17ae +++++ +Seg:4f76 Size:256 Owner:0x17b0 +++++ +Seg:5076 Size:256 Owner:0x17b2 +++++ +Seg:5176 Size:256 Owner:0x17b4 +++++ +Seg:5276 Size:256 Owner:0x17b6 ++++++ +Seg:5376 Size:256 Owner:0x17b8 +++++ +Seg:5476 Size:256 Owner:0x17ba +++++ +Seg:5576 Size:256 Owner:0x17bc +++++ +Seg:5676 Size:256 Owner:0x17be +++++ +Seg:5776 Size:256 Owner:0x17c0 ++++++ +Seg:5876 Size:256 Owner:0x17c2 +++++ +Seg:5976 Size:256 Owner:0x17c4 +++++ +Seg:5a76 Size:256 Owner:0x17c6 +++++ +Seg:5b76 Size:256 Owner:0x17c8 +++++ +Seg:5c76 Size:256 Owner:0x17ca ++++++ +Seg:5d76 Size:256 Owner:0x17cc +++++ +Seg:5e76 Size:256 Owner:0x17ce +++++ +Seg:5f76 Size:256 Owner:0x17d0 +++++ +Seg:6076 Size:256 Owner:0x17d2 +++++ +Seg:6176 Size:256 Owner:0x17d4 ++++++ +Seg:6276 Size:256 Owner:0x17d6 +++++ +Seg:6376 Size:256 Owner:0x17d8 +++++ +Seg:6476 Size:256 Owner:0x17da +++++ +Seg:6576 Size:256 Owner:0x17dc +++++ +Seg:6676 Size:256 Owner:0x17de ++++++ +Seg:6776 Size:256 Owner:0x17e0 +++++ +Seg:6876 Size:256 Owner:0x17e2 +++++ +Seg:6976 Size:256 Owner:0x17e4 +++++ +Seg:6a76 Size:256 Owner:0x17e6 +++++ +Seg:6b76 Size:256 Owner:0x17e8 ++++++ +Seg:6c76 Size:256 Owner:0x17ea +++++ +Seg:6d76 Size:256 Owner:0x17ec +++++ +Seg:6e76 Size:256 Owner:0x17ee +++++ +Seg:6f76 Size:256 Owner:0x17f0 +++++ +Seg:7076 Size:256 Owner:0x17f2 ++++++ +Seg:7176 Size:256 Owner:0x17f4 +++++ +Seg:7276 Size:256 Owner:0x17f6 +++++ +Seg:7376 Size:256 Owner:0x17f8 +++++ +Seg:7476 Size:256 Owner:0x17fa +++++ +Seg:7576 Size:256 Owner:0x17fc ++++++ +Seg:7676 Size:256 Owner:0x17fe +++++ +Seg:7776 Size:256 Owner:0x1800 +++++ +Seg:7876 Size:256 Owner:0x1802 +++++ +Seg:7976 Size:256 Owner:0x1804 +++++ +Seg:7a76 Size:256 Owner:0x1806 ++++++ +Seg:7b76 Size:256 Owner:0x1808 +++++ +Seg:7c76 Size:256 Owner:0x180a +++++ +Seg:7d76 Size:256 Owner:0x180c +++++ +Seg:7e76 Size:256 Owner:0x180e +++++ +Seg:7f76 Size:256 Owner:0x1810 ++++++ +Seg:8076 Size:256 Owner:0x1812 +++++ +Seg:8176 Size:256 Owner:0x1814 +++++ +Seg:8276 Size:256 Owner:0x1816 +++++ +Seg:8376 Size:256 Owner:0x1818 +++++ +Seg:8476 Size:256 Owner:0x181a ++++++ +Seg:8576 Size:256 Owner:0x181c +++++ +Seg:8676 Size:256 Owner:0x181e +++++ +Seg:8776 Size:256 Owner:0x1820 +++++ +Seg:8876 Size:256 Owner:0x1822 +++++ +Seg:8976 Size:256 Owner:0x1824 ++++++ +Seg:8a76 Size:256 Owner:0x1826 +++++ +Seg:8b76 Size:256 Owner:0x1828 +++++ +Seg:8c76 Size:401 Owner:0xef42 +++++++ +Seg:b776 Size:18569 Owner:0x0 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \ No newline at end of file diff --git a/HEAP.16W b/HEAP.16W new file mode 100755 index 00000000..7effaf86 --- /dev/null +++ b/HEAP.16W @@ -0,0 +1,69 @@ + + == default == + + USED block at 276c0016 of size 136 + FREE block at 276c009e of size 68 + USED block at 276c00e2 of size 50 + USED block at 276c0114 of size 50 + USED block at 276c0146 of size 50 + USED block at 276c0178 of size 50 + USED block at 276c01aa of size 50 + USED block at 276c01dc of size 50 + USED block at 276c020e of size 50 + USED block at 276c0240 of size 50 + USED block at 276c0272 of size 50 + USED block at 276c02a4 of size 50 + USED block at 276c02d6 of size 50 + USED block at 276c0308 of size 50 + FREE block at 276c033a of size 14 + USED block at 276c0348 of size 20 + FREE block at 276c035c of size 7328 +OK - end of heap + + == near == + + USED block at 176bef86 of size 12 + USED block at 176bef92 of size 330 + USED block at 176bf0dc of size 52 + USED block at 176bf110 of size 20 + USED block at 176bf124 of size 20 + USED block at 176bf138 of size 20 + USED block at 176bf14c of size 20 + USED block at 176bf160 of size 20 + USED block at 176bf174 of size 3720 +OK - end of heap + + == far == + + USED block at 276c0016 of size 136 + USED block at 276c009e of size 68 + USED block at 276c00e2 of size 50 + USED block at 276c0114 of size 50 + USED block at 276c0146 of size 50 + USED block at 276c0178 of size 50 + USED block at 276c01aa of size 50 + USED block at 276c01dc of size 50 + USED block at 276c020e of size 50 + USED block at 276c0240 of size 50 + USED block at 276c0272 of size 50 + USED block at 276c02a4 of size 50 + USED block at 276c02d6 of size 50 + USED block at 276c0308 of size 50 + USED block at 276c033a of size 14 + USED block at 276c0348 of size 20 + USED block at 276c035c of size 7328 +OK - end of heap + +Memory Type Total Used Free +---------------- -------- -------- -------- +Default 8166 756 7410 +Near 4214 494 3720 +Far 8166 756 7410 +---------------- -------- -------- -------- +coreleft = 3718 +farcoreleft = 35534 +GetFreeSize = 31836 +GetNearFreeSize = 3720 +GetFarFreeSize = 31836 +memavl = 3718 +stackavail = 31533 diff --git a/MMDUMP.16W b/MMDUMP.16W new file mode 100755 index 00000000..73ac1287 Binary files /dev/null and b/MMDUMP.16W differ diff --git a/ZCROLL.L16 b/ZCROLL.L16 new file mode 100755 index 00000000..fae19f18 --- /dev/null +++ b/ZCROLL.L16 @@ -0,0 +1,25 @@ +WARNING: Failed to initialize DEBUG output + +Project 16 zcroll.exe. This is just a test file! +version Jan 24 2017 12:37:40 +tx: 0 ty: 0 + +player vars: + x: 160 y: 128 + tx: 10 ty: 8 + triggx: 10 triggy: 9 + hp: 0 q: 1 player.info.dir: 2 player.d: 2 pdir=0 + aniframe=1 delay=1 + +Virtual Screen: 352x272 Screen: 320x240 +virtual tile resolution: 22x17 tile resolution: 20x15 +middle tile position: 10x8 +video memory remaining: 9215 +page [0]=(a000:0000) size=23936 w=352 h=272 sw=320 sh=240 pi=1408 + [1]=(a000:5d80) size=23936 w=352 h=272 sw=320 sh=240 pi=1408 + [2]=(a000:bb00) size=5120 w=64 h=64 sw=64 sh=64 pi=1408 + [3]=(a000:cf00) size=3328 w=320 h=208 sw=320 sh=208 pi=1408 +gvar.video.p=0 gvar.video.r=0 pageflipflop=1 + +detected CPU type: 80386 or newer +detected FPU type: 80387 diff --git a/data/spri/chikyuu.sht b/data/spri/chikyuu.sht index 8ae88cf0..701617a2 100755 --- a/data/spri/chikyuu.sht +++ b/data/spri/chikyuu.sht @@ -81,17 +81,17 @@ sprite=CHUBFCW1 +CHUBFCW_WALKING@11 sprite=CHUBFCW0 -delay=20 +delay=3 -newframe sprite=CHUBFCW1 -delay=20 +delay=3 event=@100 # in this example, signal the game engine the frame is one that can immediately transition to "standing" -newframe sprite=CHUBFCW2 -delay=20 +delay=3 -newframe sprite=CHUBFCW1 -delay=20 +delay=3 event=@100 # in this example, signal the game engine the frame is one that can immediately transition to "standing" # Chikyuu, left, standing and walking animation cycles @@ -100,17 +100,17 @@ sprite=CHUBLCW1 +CHUBLCW_WALKING@21 sprite=CHUBLCW0 -delay=20 +delay=3 -newframe sprite=CHUBLCW1 -delay=20 +delay=3 event=@100 # in this example, signal the game engine the frame is one that can immediately transition to "standing" -newframe sprite=CHUBLCW2 -delay=20 +delay=3 -newframe sprite=CHUBLCW1 -delay=20 +delay=3 event=@100 # in this example, signal the game engine the frame is one that can immediately transition to "standing" # Chikyuu, right, standing and walking animation cycles @@ -119,17 +119,17 @@ sprite=CHUBRCW1 +CHUBRCW_WALKING@31 sprite=CHUBRCW0 -delay=20 +delay=3 -newframe sprite=CHUBRCW1 -delay=20 +delay=3 event=@100 # in this example, signal the game engine the frame is one that can immediately transition to "standing" -newframe sprite=CHUBRCW2 -delay=20 +delay=3 -newframe sprite=CHUBRCW1 -delay=20 +delay=3 event=@100 # in this example, signal the game engine the frame is one that can immediately transition to "standing" # Chikyuu, away, standing and walking animation cycles @@ -138,16 +138,16 @@ sprite=CHUBACW1 +CHUBACW_WALKING@41 sprite=CHUBACW0 -delay=20 +delay=3 -newframe sprite=CHUBACW1 -delay=20 +delay=3 event=@100 # in this example, signal the game engine the frame is one that can immediately transition to "standing" -newframe sprite=CHUBACW2 -delay=20 +delay=3 -newframe sprite=CHUBACW1 -delay=20 +delay=3 event=@100 # in this example, signal the game engine the frame is one that can immediately transition to "standing" diff --git a/data/spri/chikyuu.vrs b/data/spri/chikyuu.vrs index ac1f7c2b..abcaf75b 100755 Binary files a/data/spri/chikyuu.vrs and b/data/spri/chikyuu.vrs differ diff --git a/makefile b/makefile index e6f0d7d6..5695c680 100755 --- a/makefile +++ b/makefile @@ -125,7 +125,7 @@ LIBFLAGS=$(WLIBQ) -b -n VGMSNDOBJ = vgmSnd.$(OBJ) 16_snd.$(OBJ) OLDLIBOBJS=bitmap.$(OBJ) 16render.$(OBJ) GFXLIBOBJS = 16_vl.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16_vrs.$(OBJ) 16_sprit.$(OBJ) $(OLDLIBOBJS) -16LIBOBJS = 16_mm.$(OBJ) 16_pm.$(OBJ) 16_ca.$(OBJ) 16_tail.$(OBJ) 16_in.$(OBJ) 16_head.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_wcpu.$(OBJ) 16_timer.$(OBJ) jsmn.$(OBJ) 16_map.$(OBJ) 16text.$(OBJ) +16LIBOBJS = 16_mm.$(OBJ) 16_pm.$(OBJ) 16_ca.$(OBJ) 16_tail.$(OBJ) 16_in.$(OBJ) 16_head.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_wcpu.$(OBJ) 16_timer.$(OBJ) jsmn.$(OBJ) 16_map.$(OBJ) 16text.$(OBJ) 16_enti.$(OBJ) DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ) !ifeq DEBUGSERIAL 1 DOSLIBOBJ += 8250.$(OBJ) @@ -330,6 +330,7 @@ bitmap.$(OBJ): $(SRCLIB)/bitmap.c $(SRCLIB)/bitmap.h planar.$(OBJ): $(SRCLIB)/planar.c $(SRCLIB)/planar.h scroll16.$(OBJ):$(SRCLIB)/scroll16.c $(SRCLIB)/scroll16.h 16text.$(OBJ): $(SRCLIB)/16text.c $(SRCLIB)/16text.h +16_enti.$(OBJ): $(SRCLIB)/16_enti.c $(SRCLIB)/16_enti.h mapread.$(OBJ):$(SRCLIB)/mapread.c $(SRCLIB)/mapread.h 16_map.$(OBJ):$(SRCLIB)/16_map.c $(SRCLIB)/16_map.h 16_timer.$(OBJ):$(SRCLIB)/16_timer.c $(SRCLIB)/16_timer.h diff --git a/spri.sh b/spri.sh index bdff2260..172cc06e 100755 --- a/spri.sh +++ b/spri.sh @@ -1,12 +1,16 @@ #! /bin/bash cd data/spri +if [ ! -f "$1".vrs ]; then + ../../vrl2vrs -s "$1".sht -o "$1".vrs -hc "$1".h -hp _"$1"_ + echo "$1".vrs created +# echo "1st condition ok!" +fi if [ -f "$1".sht ]; then ../../pcxsscut -s "$1".sht -hc "$1".h -hp _"$1"_ -i ../"$1".pcx -p "$1".pal -tc 0x"$2" -y - #echo "1st condition ok!" +# echo "2nd condition ok!" else ../../pcx2vrl -i ../"$1".pcx -o "$1".vrl -p "$1".pal -tc 0x"$2" - #echo "2nd condition ok!" echo check if "$1".sht exist! +# echo "3rd condition ok!" fi cd ../../ - diff --git a/src/0.c b/src/0.c index c4d0ece3..b909273f 100755 --- a/src/0.c +++ b/src/0.c @@ -87,7 +87,7 @@ int main(int argc,char **argv) IN_Startup(); IN_Default(0,&player,ctrl_Keyboard1); - IN_initplayer(&player, 0); + EN_initplayer(&player, 0); /* setup camera and screen~ */ modexHiganbanaPageSetup(&gvar.video); diff --git a/src/lib/16_enti.c b/src/lib/16_enti.c index 1d8a1b93..088701d7 100755 --- a/src/lib/16_enti.c +++ b/src/lib/16_enti.c @@ -20,3 +20,32 @@ * */ +#include "src/lib/16_enti.h" + +void EN_initentity(entity_t *enti) +{ + //tx and ty inited by map + enti->x = enti->tx*TILEWH; + enti->y = enti->ty*TILEWH; + enti->triggerx = enti->tx; + enti->triggery = enti->ty+1; + enti->q = 1; + enti->d =2; + enti->hp=4; + enti->speed=4; + enti->persist_aniframe= enti->q; + enti->spt=(TILEWH/(enti->speed)); //speed per tile wwww + enti->spri->delay=1; + enti->invq=1; + enti->pred = enti->d; +} + +//init player! +void EN_initplayer(player_t *player, word pn) +{ + EN_initentity(&player[pn].enti); +/* player[0].info.x = player[0].tx; + player[0].info.xaxis = player[0].tx*TILEWH; + player[0].info.y = player[0].ty; + player[0].info.yaxis = player[0].ty*TILEWH;*/ +} diff --git a/src/lib/16_enti.h b/src/lib/16_enti.h index bfda2c15..dc76c8a4 100755 --- a/src/lib/16_enti.h +++ b/src/lib/16_enti.h @@ -44,4 +44,7 @@ // word spt; // speed per tile // } entity_t; +void EN_initentity(entity_t *enti); +void EN_initplayer(player_t *player, word pn); + #endif diff --git a/src/lib/16_in.c b/src/lib/16_in.c index 71307a6e..8d17c37f 100755 --- a/src/lib/16_in.c +++ b/src/lib/16_in.c @@ -1275,22 +1275,3 @@ boolean IN_qb(byte kee) if(inpu.Keyboard[kee]==true) return 1; else return 0; } - -//init player! -void IN_initplayer(player_t *player, word pn) -{ - player[pn].enti.x = player[pn].enti.tx*TILEWH; - player[pn].enti.y = player[pn].enti.ty*TILEWH; - player[pn].enti.triggerx = player[pn].enti.tx; - player[pn].enti.triggery = player[pn].enti.ty+1; -/* player[0].info.x = player[0].tx; - player[0].info.xaxis = player[0].tx*TILEWH; - player[0].info.y = player[0].ty; - player[0].info.yaxis = player[0].ty*TILEWH;*/ - player[pn].enti.q = 1; - player[pn].enti.d =2; - player[pn].enti.hp=4; - player[pn].enti.speed=4; - player[pn].enti.persist_aniframe= 1; - player[pn].enti.spt=(TILEWH/(player[pn].enti.speed)); //speed per tile wwww -} diff --git a/src/lib/16_in.h b/src/lib/16_in.h index f03b337d..b84db1b1 100755 --- a/src/lib/16_in.h +++ b/src/lib/16_in.h @@ -302,6 +302,5 @@ extern boolean IN_UserInput(dword delay,boolean clear); extern boolean IN_KeyDown(byte code); extern void IN_ClearKey(byte code); extern boolean IN_qb(byte kee); -void IN_initplayer(player_t *player, word pn); #endif diff --git a/src/lib/16_sprit.c b/src/lib/16_sprit.c index d3705138..311a3dd7 100755 --- a/src/lib/16_sprit.c +++ b/src/lib/16_sprit.c @@ -96,69 +96,7 @@ void print_anim_ids(struct sprite *spri) } } -void oldanimate_spri(struct sprite *spri, video_t *video) -{ - int i; - // Events go here - - - vga_state.vga_graphics_ram = (VGA_RAM_PTR)video->page[0].data;//vga_state.vga_graphics_ram; // save original mem ptr - - - // Draw sprite - i = get_vrl_by_id(spri->spritesheet, spri->curr_spri_id, spri->sprite_vrl_cont); - if(i < 0) - { - //Quit (gv, "Error retriving required sprite"); - return; - } - - // 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 = (video->page[0].width + 3 - spri->x) >> 2; - -#ifndef SPRITE - modexClearRegion(&video->page[0], spri->x, spri->y, 16, 32, 1); -#else - draw_vrl1_vgax_modex( - spri->x,//-video->page[0].dx, - spri->y,//-video->page[0].dy, - spri->sprite_vrl_cont->vrl_header, - spri->sprite_vrl_cont->line_offsets, - spri->sprite_vrl_cont->buffer + sizeof(struct vrl1_vgax_header), - spri->sprite_vrl_cont->data_size - ); -#endif - - // restore stride - vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = video->page[0].stridew; - - // Depending on delay, update indices - switch(spri->delay){ - // Delay = 0 means that sprite should loop. Nothing to change here - case 0: - break; - - // Delay = 1 means that on next time unit sprite should be changed - case 1: - spri->curr_anim_spri++; - - // If we hit the end of an animation sequence, restart it - if(!(spri->curr_spri_id = spri->curr_anim_list[spri->curr_anim_spri].sprite_id)){ - spri->curr_anim_spri = 0; - spri->curr_spri_id = spri->curr_anim_list[spri->curr_anim_spri].sprite_id; - } - spri->delay = spri->curr_anim_list[spri->curr_anim_spri].delay; - - // Delay > 1 means that we should not change sprite yet. Decrease delay - default: - spri->delay--; - break; - } - vga_state.vga_graphics_ram = video->omemptr; -} - - -void animate_spri(struct sprite *spri, video_t *video) +void animate_spri(entity_t *enti, video_t *video) { #define GVARVIDEO video #define VMEMPAGESIZE2 GVARVIDEO->page[0].pagesize+GVARVIDEO->page[1].pagesize @@ -172,12 +110,12 @@ void animate_spri(struct sprite *spri, video_t *video) // Events go here - omemptr = (VGA_RAM_PTR)video->page[0].data;//vga_state.vga_graphics_ram; // save original mem ptr - x=spri->x; - y=spri->y; + omemptr = (VGA_RAM_PTR)video->page[0].data;// save original mem ptr + x=enti->spri->x; + y=enti->spri->y; // Draw sprite - j = get_vrl_by_id(spri->spritesheet, spri->curr_spri_id, spri->sprite_vrl_cont); + j = get_vrl_by_id(enti->spri->spritesheet, enti->spri->curr_spri_id, enti->spri->sprite_vrl_cont); if(j < 0) { //Quit (gv, "Error retriving required sprite"); @@ -185,12 +123,13 @@ void animate_spri(struct sprite *spri, video_t *video) } // render box bounds. y does not need modification, but x and width must be multiple of 4 + if(!GVARVIDEO->rss){ if (x >= overdraw) rx = (x - overdraw) & (~3); else rx = -(GVARVIDEO->page[0].dx); if (y >= overdraw) ry = (y - overdraw); 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 + h = enti->spri->sprite_vrl_cont->vrl_header->height + overdraw + y - ry; + w = (x + enti->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; @@ -204,9 +143,10 @@ void animate_spri(struct sprite *spri, video_t *video) 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 = w >> 2; vga_state.vga_graphics_ram = omemptr + VMEMPAGESIZE2; + }else{ rx=ry=w=h=0; vga_state.vga_graphics_ram = (VGA_RAM_PTR)video->page[0].data; } + vga_state.vga_draw_stride_limit = (GVARVIDEO->page[0].width + 3 - x) >> 2;//round up // then the sprite. note modding ram ptr means we just draw to (x&3,0) #ifndef SPRITE @@ -215,12 +155,13 @@ void animate_spri(struct sprite *spri, video_t *video) draw_vrl1_vgax_modex( x-rx, y-ry, - spri->sprite_vrl_cont->vrl_header, - spri->sprite_vrl_cont->line_offsets, - spri->sprite_vrl_cont->buffer + sizeof(struct vrl1_vgax_header), - spri->sprite_vrl_cont->data_size + enti->spri->sprite_vrl_cont->vrl_header, + enti->spri->sprite_vrl_cont->line_offsets, + enti->spri->sprite_vrl_cont->buffer + sizeof(struct vrl1_vgax_header), + enti->spri->sprite_vrl_cont->data_size ); #endif + if(!GVARVIDEO->rss){ // restore ptr vga_state.vga_graphics_ram = omemptr; @@ -231,31 +172,38 @@ void animate_spri(struct sprite *spri, video_t *video) 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; // Depending on delay, update indices - switch(spri->delay){ +//#define FRAME1 modexDrawSpriteRegion(pip[(pip->video->p)].page, x, y, 48, player[pn].enti.dire, 24, 32, PLAYERBMPDATAPTR); +//#define FRAME2 modexDrawSpriteRegion(pip[(pip->video->p)].page, x, y, 24, player[pn].enti.dire, 24, 32, PLAYERBMPDATAPTR); stand +//#define FRAME3 modexDrawSpriteRegion(pip[(pip->video->p)].page, x, y, 0, player[pn].enti.dire, 24, 32, PLAYERBMPDATAPTR); +//#define FRAME4 modexDrawSpriteRegion(pip[(pip->video->p)].page, x, y, 24, player[pn].enti.dire, 24, 32, PLAYERBMPDATAPTR); stand + switch(enti->spri->delay) +{ // Delay = 0 means that sprite should loop. Nothing to change here case 0: - break; + break; // Delay = 1 means that on next time unit sprite should be changed case 1: - spri->curr_anim_spri++; + if(enti->invq) enti->spri->curr_anim_spri++; + else enti->spri->curr_anim_spri--; // If we hit the end of an animation sequence, restart it - if(!(spri->curr_spri_id = spri->curr_anim_list[spri->curr_anim_spri].sprite_id)){ - spri->curr_anim_spri = 0; - spri->curr_spri_id = spri->curr_anim_list[spri->curr_anim_spri].sprite_id; + if(!( enti->spri->curr_spri_id = enti->spri->curr_anim_list[enti->spri->curr_anim_spri].sprite_id)){ + enti->spri->curr_anim_spri = 1; + enti->spri->curr_spri_id = enti->spri->curr_anim_list[enti->spri->curr_anim_spri].sprite_id; + enti->invq=!enti->invq; } - spri->delay = spri->curr_anim_list[spri->curr_anim_spri].delay; + enti->spri->delay = enti->spri->curr_anim_list[enti->spri->curr_anim_spri].delay; // Delay > 1 means that we should not change sprite yet. Decrease delay default: - spri->delay--; - break; + enti->spri->delay--; + break; } vga_state.vga_graphics_ram = video->omemptr; } diff --git a/src/lib/16_sprit.h b/src/lib/16_sprit.h index 7fc360c6..bb146248 100755 --- a/src/lib/16_sprit.h +++ b/src/lib/16_sprit.h @@ -67,8 +67,7 @@ int set_anim_by_id(struct sprite *spri, int anim_id); * In: * + struct sprite *spri - sprite to animate */ -void oldanimate_spri(struct sprite *spri, video_t *video); -void animate_spri(struct sprite *spri, video_t *video); +void animate_spri(entity_t *enti, video_t *video); void print_anim_ids(struct sprite *spri); diff --git a/src/lib/16_tail.h b/src/lib/16_tail.h index 1b4b9914..97a5f827 100755 --- a/src/lib/16_tail.h +++ b/src/lib/16_tail.h @@ -33,16 +33,7 @@ #define FUNCTIONKEYFUNCTIONS \ if(IN_KeyDown(sc_F6)){ VL_ShowPage(&gvar.video.page[0], 0, 0); IN_UserInput(1,1); } \ if(IN_KeyDown(sc_F7)){ VL_ShowPage(&gvar.video.page[0], 0, 1); IN_UserInput(1,1); } \ - if(IN_KeyDown(sc_T)){ \ - switch(gvar.video.rs){\ - case 0:\ - case 1:\ - gvar.video.rs++;\ - break;\ - case 2:\ - gvar.video.rs=0;\ - break;}\ - IN_UserInput(1,1); } + if(IN_KeyDown(sc_T)){ gvar.video.rss=!gvar.video.rss; IN_UserInput(1,1); } #define FUNCTIONKEYFUNCTIONS0EXE \ if(IN_KeyDown(sc_F6)){ VL_ShowPage(&gvar.video.page[gvar.video.panp], 0, 0); IN_UserInput(1,1); } \ if(IN_KeyDown(sc_F7)){ VL_ShowPage(&gvar.video.page[gvar.video.panp], 0, 1); IN_UserInput(1,1); } diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index 125e0a23..77ef4549 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -138,8 +138,10 @@ typedef struct int sheetsetx; //NOT USED YET! entity sprite sheet set on the image x int sheetsety; //NOT USED YET! entity sprite sheet set on the image y nibble d; //direction to render sprite!! wwww + nibble pred; //prev. direction for animation changing word dire; //sprite in use - nibble q,preq; //loop variable for anumation and locking the playing to compleate the animation cycle to prevent issues with misalignment www + nibble q; //loop variable for anumation and locking the playing to compleate the animation cycle to prevent issues with misalignment www + boolean invq; //animation inversing word speed; //entity speed! word spt; //speed per tile struct sprite *spri; // sprite used by entity @@ -218,7 +220,6 @@ typedef struct { typedef struct { entity_t near enti; - entity_t *ent; #ifdef __WATCOMC__ //struct sprite *spri; //supposively the sprite sheet data memptr gr; @@ -267,7 +268,7 @@ typedef struct byte vga_draw_stride; byte vga_draw_stride_limit; // further X clipping // - word __near rs; //render switch + boolean __near rss; //render sprite switch sword __near sprifilei; //player file's i boolean __near p; //render page number //BLEH boolean __near r; //page flip if true diff --git a/src/lib/16_vl.c b/src/lib/16_vl.c index 8199666f..c3ecaa12 100755 --- a/src/lib/16_vl.c +++ b/src/lib/16_vl.c @@ -297,7 +297,7 @@ void modexHiganbanaPageSetup(video_t *video) video->vga_draw_stride= vga_state.vga_draw_stride; video->vga_draw_stride_limit= vga_state.vga_draw_stride_limit; //sprite render switch - video->rs=0; + video->rss=0; //setup the buffersize video->page[0].dx=video->page[0].dy= diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index df5af21d..6d0dd003 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -1101,19 +1101,19 @@ void shinku(global_game_variables_t *gv) } } -void near ZC_drawframe(map_view_t *pip, player_t *player, word pn, sword x, sword y, word sw) +void near ZC_drawframe(map_view_t *pip, entity_t *enti, sword x, sword y) { - switch(pip[0].video->rs) + switch(pip[0].video->rss) { case 0: - animate_spri(player[pn].ent->spri, pip->video); + animate_spri(enti, pip->video); break; case 1: - oldanimate_spri(player[pn].ent->spri, pip->video); - break; - case 2: - modexClearRegion(&(pip[0].page[0]), x, y, 16, 32, player[pn].enti.dire); + animate_spri(enti, pip->video); break; +// case 2: +// modexClearRegion(&(pip[0].page[0]), x, y, 16, 32, player[pn].enti.dire); +// break; } } @@ -1222,7 +1222,6 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scr sword x = player[pn].enti.x; sword y = player[pn].enti.y; sword qq,dd; //scroll offset - word ls = player[pn].enti.persist_aniframe; player[pn].enti.dire=10; //direction switch(scrollswitch) @@ -1240,8 +1239,7 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scr qq = ((player[pn].enti.q)*(player[pn].enti.speed)); break; } - if(pip[0].video->rs<2) - x-=4; + x-=4; y-=pip[0].map->tiles->tileHeight; switch (player[pn].enti.d) { @@ -1269,40 +1267,22 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scr break; } player[pn].enti.dire+=dd; - player[pn].ent->spri->delay=1; - if(player[pn].enti.q==1) - set_anim_by_id(player[pn].ent->spri, player[pn].enti.dire); - //pip->video->sprifilei = set_anim_by_id(player[pn].ent->spri, player[pn].enti.dire); if(pip->video->sprifilei == -1){ printf("ERROR! %u\n", player[pn].enti.dire); return; } - - //setting xy position - player[pn].ent->spri->x = x; - player[pn].ent->spri->y = y; - switch(ls) + if((player[pn].enti.q==1 && player[pn].enti.pred != player[pn].enti.d) || !dd) { - case 1: - ZC_drawframe(pip, player, pn, x, y, ls); - break; - case 2: - ZC_drawframe(pip, player, pn, x, y, ls); - break; - case 3: - ZC_drawframe(pip, player, pn, x, y, ls); - break; - case 4: - ZC_drawframe(pip, player, pn, x, y, ls); - break; + set_anim_by_id(player[pn].enti.spri, player[pn].enti.dire); //pip->video->sprifilei = set_anim_by_id(player[pn].enti.spri, player[pn].enti.dire); if(pip->video->sprifilei == -1){ printf("ERROR! %u\n", player[pn].enti.dire); return; } + player[pn].enti.pred = player[pn].enti.d; } + + //setting xy position + player[pn].enti.spri->x = x; + player[pn].enti.spri->y = y; + + //draw sprite + ZC_drawframe(pip, &player[pn].enti, x, y); + pip->video->r=1; - if(player[pn].enti.persist_aniframe!=player[pn].enti.q) - { - sprintf(global_temp_status_text, "[%u]%u", player[pn].enti.persist_aniframe, player[pn].enti.q); - 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); - delay(500); - } //WALKTYPE_FRAM_PRINT; - //sprintf(global_temp_status_text, " %u", player[pn].enti.dire); - //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); } /* @@ -1320,12 +1300,12 @@ boolean coll_check(int x, int y, int dx, int dy, map_view_t *map_v) return dx && 1;//crossable_tile(x + dx, map_v) || dy && crossable_tile(y + dy, map_v); } -boolean ZC_walk2(entity_t *ent, map_view_t *map_v) +boolean ZC_walk2(entity_t *enti, map_view_t *map_v) { //return 1; int dx = 1; int dy = 1; - switch(ent->d) + switch(enti->d) { case 2: return 0; @@ -1340,7 +1320,7 @@ boolean ZC_walk2(entity_t *ent, map_view_t *map_v) dx = 0; break; } - if(coll_check(ent->x, ent->y, dx, dy, map_v)) + if(coll_check(enti->x, enti->y, dx, dy, map_v)) { // Allow movement // Set speed diff --git a/src/lib/scroll16.h b/src/lib/scroll16.h index 396798e0..84a6737d 100755 --- a/src/lib/scroll16.h +++ b/src/lib/scroll16.h @@ -95,6 +95,7 @@ typedef struct { //printf("map.width=%d map.height=%d map.data[0]=%d\n", mv[0].map->width, mv[0].map->height, mv[0].map->data[0]); //printf("&global_temp_status_text = %Fp\n", &global_temp_status_text); //print_anim_ids(player[0].ent->spri); +//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))]); #define SCROLLEXITMESG printf("tx: %d ", mv[0].tx);\ printf("ty: %d\n", mv[0].ty);\ printf("\n");\ @@ -104,9 +105,8 @@ typedef struct { printf(" tx: %d", player[0].enti.tx); printf(" ty: %d\n", player[0].enti.ty);\ printf(" triggx: %d", player[0].enti.triggerx); printf(" triggy: %d\n", player[0].enti.triggery);\ 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);\ - printf(" pdir=%d\n", player[0].pdir); printf(" aniframe=%u", player[0].enti.persist_aniframe);\ - 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))]);\ -\ + printf(" pdir=%d\n", player[0].pdir); printf(" aniframe=%u", player[0].enti.persist_aniframe); printf(" delay=%u", player[0].enti.spri->delay);\ +printf("\n\n");\ printf("Virtual Screen: %dx", gvar.video.page[0].width); printf("%d ", gvar.video.page[0].height);\ printf("Screen: %dx", gvar.video.page[0].sw); printf("%d\n", gvar.video.page[0].sh);\ printf("virtual tile resolution: %dx", gvar.video.page[0].tilesw); printf("%d ", gvar.video.page[0].tilesh);\ @@ -158,7 +158,7 @@ void mapDrawWRow(map_view_t *mv, int tx, int ty, word y); void mapDrawWCol(map_view_t *mv, int tx, int ty, word x); //void qclean(); void shinku(global_game_variables_t *gv); -void near ZC_drawframe(map_view_t *pip, player_t *player, word pn, sword x, sword y, word sw); +void near ZC_drawframe(map_view_t *pip, entity_t *enti, sword x, sword y); void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scrollswitch); void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scrollswitch); diff --git a/src/scroll.c b/src/scroll.c index 1d92d1fb..9c532d51 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -113,17 +113,16 @@ void main(int argc, char *argv[]) ZC_MVSetup(&mv, &map, &gvar); //renderswitch - gvar.video.rs=2; + gvar.video.rss=1; /* set up paging */ //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen mapGoTo(&mv, 0, 0); playerXYpos(0, 0, &player, &mv, 0); - IN_initplayer(&player, 0); - player[0].ent->spri->x = player[0].enti.x-4; - player[0].ent->spri->y = player[0].enti.y-16; - player[0].ent->spri->delay = 1; + EN_initplayer(&player, 0); + player[0].enti.spri->x = player[0].enti.x-4; + player[0].enti.spri->y = player[0].enti.y-16; #ifndef SPRITE modexClearRegion(mv[0].page, player[0].enti.x, player[0].enti.y-TILEWH, 16, 32, 15); diff --git a/src/test.c b/src/test.c index c933f953..55db2017 100755 --- a/src/test.c +++ b/src/test.c @@ -84,7 +84,7 @@ void main(int argc, char *argv[]) //IN_Startup(); IN_Default(0,&player,ctrl_Keyboard1); - IN_initplayer(&player, 0); + EN_initplayer(&player, 0); VGAmodeX(1, 1, &gvar); //====modexPalBlack(); diff --git a/src/vrstest.c b/src/vrstest.c index b814fe81..14baca18 100755 --- a/src/vrstest.c +++ b/src/vrstest.c @@ -42,7 +42,7 @@ void main() word start; float t1, t2; //boolean baka; - struct sprite spri; + entity_t enti; //vrl1_vgax_offset_t * off, *off1; struct vrs_container vrs; vrl1_vgax_offset_t **vrl_line_offsets; @@ -90,15 +90,15 @@ void main() //read_vrs(&gvar, "data/spri/chikyuu.vrs", &vrs); - spri.spritesheet = &vrs; - spri.sprite_vrl_cont = malloc(sizeof(struct vrl_container)); - i = set_anim_by_id(&spri, 31); + enti.spri->spritesheet = &vrs; + enti.spri->sprite_vrl_cont = malloc(sizeof(struct vrl_container)); + i = set_anim_by_id((enti.spri), 31); if (i == -1) { return; } - spri.x = TILEWH-4; - spri.y = TILEWH; + enti.spri->x = TILEWH-4; + enti.spri->y = TILEWH; // Uncomment to see broken sprites /* sega = mm.bufferseg; @@ -121,13 +121,11 @@ void main() modexPalUpdate1(pal);*/ VL_LoadPalFile("data/spri/chikyuu.pal", &palette); for (i = 0; i < 10; i++){ - spri.delay = 1; + enti.spri->delay = 1; - if(i==5) set_anim_by_id(&spri, 21); - //else if(i>=10) set_anim_by_id(&spri, 31); - //else if(i<=15) set_anim_by_id(&spri, 41); + if(i==5) set_anim_by_id(enti.spri, 21); - animate_spri(&spri, &gvar.video);// spri.x += 16; + animate_spri(&enti, &gvar.video);// enti.spri->x += 16; delay(500); } @@ -150,10 +148,10 @@ FUNCTIONKEYFUNCTIONS; MM_DumpData(&gvar); MM_Report_(&gvar); Shutdown16(&gvar); - free(spri.sprite_vrl_cont); + free(enti.spri->sprite_vrl_cont); free(vrl_line_offsets); MM_FreePtr(&bigbuffer, &gvar); - //MM_FreePtr(&((void __based(sega)*)spri.spritesheet->buffer), &mm); + //MM_FreePtr(&((void __based(sega)*)enti.spri->spritesheet->buffer), &mm); //printf("CPU to VGA: %f\n", t1); //printf("VGA to VGA: %f\n", t2); heapdump(&gvar); diff --git a/src/zcroll.c b/src/zcroll.c index 71579363..a02ae0da 100755 --- a/src/zcroll.c +++ b/src/zcroll.c @@ -56,9 +56,9 @@ void main(int argc, char *argv[]) // OK, this one takes hellova time and needs to be done in farmalloc or MM_... //IN CA i think you use CAL_SetupGrFile but i do think we should work together on this part --sparky4 - player[0].ent = malloc(sizeof(entity_t)); - player[0].ent->spri = malloc(sizeof(struct sprite)); - player[0].ent->spri->spritesheet = malloc(sizeof(struct vrs_container)); + //player[0].ent = malloc(sizeof(entity_t)); + player[0].enti.spri = malloc(sizeof(struct sprite)); + player[0].enti.spri->spritesheet = malloc(sizeof(struct vrs_container)); // create the map // fprintf(stderr, "testing map load~ "); @@ -68,7 +68,7 @@ void main(int argc, char *argv[]) // fprintf(stderr, "yay map loaded~~\n"); // data - read_vrs(&gvar, "data/spri/chikyuu.vrs", player[0].ent->spri->spritesheet); + read_vrs(&gvar, "data/spri/chikyuu.vrs", player[0].enti.spri->spritesheet); PCXBMP = bitmapLoadPcx("data/chikyuu.pcx", &gvar); // load sprite // input! @@ -102,22 +102,20 @@ void main(int argc, char *argv[]) ZC_MVSetup(&mv, &map, &gvar); //renderswitch - gvar.video.rs=0; - //player[0].ent->spri->x = player[0].ent->spri->y = TILEWH; + gvar.video.rss=0; // set up paging //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen mapGoTo(&mv, 0, 0); playerXYpos(0, 0, &player, &mv, 0); - IN_initplayer(&player, 0); - player[0].ent->spri->x = player[0].enti.x-4; - player[0].ent->spri->y = player[0].enti.y-16; - player[0].ent->spri->delay = 0; + EN_initplayer(&player, 0); + player[0].enti.spri->x = player[0].enti.x-4; + player[0].enti.spri->y = player[0].enti.y-16; player[0].enti.dire=31; - gvar.video.sprifilei = set_anim_by_id(player[0].ent->spri, player[0].enti.dire); - //print_anim_ids(player[0].ent->spri); + gvar.video.sprifilei = set_anim_by_id(player[0].enti.spri, player[0].enti.dire); + //print_anim_ids(player[0].enti.spri); if (gvar.video.sprifilei == -1) { #ifdef FADE @@ -128,7 +126,7 @@ void main(int argc, char *argv[]) modexFadeOn(4, dpal); #endif } - animate_spri((player[0].ent->spri), &gvar.video); + animate_spri(&(player[0].enti), &gvar.video); VL_ShowPage(mv[0].page, 0, 0);//modexShowPage(mv[0].page);//!(gvar.video.p) #ifdef FADE @@ -195,10 +193,10 @@ void main(int argc, char *argv[]) { case 11: i=0; - player[0].ent->spri->x = TILEWH; + player[0].enti.spri->x = TILEWH; default: i++; - player[0].ent->spri->delay = 0; animate_spri((player[0].ent->spri), &gvar.video);// player[0].ent->spri->x += 16; + animate_spri(&(player[0].enti), &gvar.video);// player[0].enti.spri->x += 16; break; } }