From b2fde6790ba29c4b7ff7119d53a20a02647b73c8 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Tue, 24 Jan 2017 14:06:22 -0600 Subject: [PATCH] I THINK I GOT THE ANIMATION FIXED AGAINrm data/spri/chikyuu.vrs --- data/spri/chikyuu.sht | 32 ++++++++++----------- data/spri/chikyuu.vrs | Bin 6408 -> 6408 bytes src/lib/16_enti.c | 2 +- src/lib/16_sprit.c | 64 +++++++++++++++++++++++------------------- src/lib/scroll16.c | 3 +- 5 files changed, 53 insertions(+), 48 deletions(-) diff --git a/data/spri/chikyuu.sht b/data/spri/chikyuu.sht index 67687225..701617a2 100755 --- a/data/spri/chikyuu.sht +++ b/data/spri/chikyuu.sht @@ -81,17 +81,17 @@ sprite=CHUBFCW1 +CHUBFCW_WALKING@11 sprite=CHUBFCW0 -delay=2 +delay=3 -newframe sprite=CHUBFCW1 -delay=2 +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=2 +delay=3 -newframe sprite=CHUBFCW1 -delay=2 +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=2 +delay=3 -newframe sprite=CHUBLCW1 -delay=2 +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=2 +delay=3 -newframe sprite=CHUBLCW1 -delay=2 +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=2 +delay=3 -newframe sprite=CHUBRCW1 -delay=2 +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=2 +delay=3 -newframe sprite=CHUBRCW1 -delay=2 +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=2 +delay=3 -newframe sprite=CHUBACW1 -delay=2 +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=2 +delay=3 -newframe sprite=CHUBACW1 -delay=2 +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 bff3a82409a327c2753fc91bbf6bd2d01d7a9dea..abcaf75b4785eb26163ce3eb5b68b5b1e1ecad1f 100755 GIT binary patch delta 139 zcmeA$>M+`{S=^SHfq{XWftewNfd@#!*gyslh(ahZDFT)i1*;T;u_u2JhnOG_7FPg^ YL)Z|lnn)&SfMqqoDz#wj$u1H{07SwI3jhEB delta 139 zcmeA$>M+`{S=^S1fq{XWfr%l7fd@#!*gyslh(ahZDFT)i1*;T;u_u2JhnOG_7FPg^ YL)Z|lnn)&SfMqqoDz#wj$u1H{06>BY`v3p{ diff --git a/src/lib/16_enti.c b/src/lib/16_enti.c index 088701d7..96be5fde 100755 --- a/src/lib/16_enti.c +++ b/src/lib/16_enti.c @@ -35,7 +35,7 @@ void EN_initentity(entity_t *enti) enti->speed=4; enti->persist_aniframe= enti->q; enti->spt=(TILEWH/(enti->speed)); //speed per tile wwww - enti->spri->delay=1; + //enti->spri->delay=1; enti->invq=1; enti->pred = enti->d; } diff --git a/src/lib/16_sprit.c b/src/lib/16_sprit.c index 311a3dd7..0be43073 100755 --- a/src/lib/16_sprit.c +++ b/src/lib/16_sprit.c @@ -107,6 +107,41 @@ void animate_spri(entity_t *enti, video_t *video) // if the sprite's edge pixels are clear anyway, you can set this to 0. VGA_RAM_PTR omemptr; + // Depending on delay, update indices +//#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; + + // Delay = 1 means that on next time unit sprite should be changed + case 1: + if(enti->invq) enti->spri->curr_anim_spri++; + else enti->spri->curr_anim_spri--; +//printf("1[%u] %u", enti->invq, enti->spri->curr_anim_spri); + // If we hit the end of an animation sequence, restart it + 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->invq=!enti->invq; + if(enti->invq) enti->spri->curr_anim_spri+=2; + else if(enti->spri->curr_anim_spri) enti->spri->curr_anim_spri-=2; + enti->spri->curr_spri_id = enti->spri->curr_anim_list[enti->spri->curr_anim_spri].sprite_id; +//printf(" enti->spri->curr_anim_spri=%u ", enti->spri->curr_anim_spri); + } + enti->spri->delay = enti->spri->curr_anim_list[enti->spri->curr_anim_spri].delay; +//printf("\n"); +//break; + // Delay > 1 means that we should not change sprite yet. Decrease delay + default: +//printf("2[%u] %u\n", enti->invq, enti->spri->curr_anim_spri); + enti->spri->delay--; + break; + } + // Events go here @@ -176,34 +211,5 @@ void animate_spri(entity_t *enti, video_t *video) // restore stride vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = GVARVIDEO->page[0].stridew; - // Depending on delay, update indices -//#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; - - // Delay = 1 means that on next time unit sprite should be changed - case 1: - 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(!( 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; - } - 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: - enti->spri->delay--; - break; - } vga_state.vga_graphics_ram = video->omemptr; } diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index 6d0dd003..2d9de4f9 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -1267,7 +1267,6 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scr break; } player[pn].enti.dire+=dd; - if((player[pn].enti.q==1 && player[pn].enti.pred != player[pn].enti.d) || !dd) { 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; } @@ -1280,7 +1279,7 @@ void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn, sword scr //draw sprite ZC_drawframe(pip, &player[pn].enti, x, y); - +//if(player[pn].enti.q<4) delay(500); pip->video->r=1; //WALKTYPE_FRAM_PRINT; } -- 2.39.5