diff --git a/assets-cg/enemies/fxconv-metadata.txt b/assets-cg/enemies/fxconv-metadata.txt index 53dd6da..37eb224 100644 --- a/assets-cg/enemies/fxconv-metadata.txt +++ b/assets-cg/enemies/fxconv-metadata.txt @@ -16,10 +16,10 @@ bat_right.aseprite: gunslinger_left.aseprite: center: 15, 22 - next: Idle=Idle, Walking=Walking, Hit=Idle, Fire=Reloading + next: Idle=Idle, Walking=Walking, Hit=Idle gunslinger_right.aseprite: center: 8, 22 - next: Idle=Idle, Walking=Walking, Hit=Idle, Fire=Reloading + next: Idle=Idle, Walking=Walking, Hit=Idle *.txt: custom-type: aseprite-anim-variation diff --git a/assets-cg/enemies/gunslinger_left.aseprite b/assets-cg/enemies/gunslinger_left.aseprite index 981933e..98daedd 100644 Binary files a/assets-cg/enemies/gunslinger_left.aseprite and b/assets-cg/enemies/gunslinger_left.aseprite differ diff --git a/assets-cg/enemies/gunslinger_right.aseprite b/assets-cg/enemies/gunslinger_right.aseprite index 18f14fa..715cfb7 100644 Binary files a/assets-cg/enemies/gunslinger_right.aseprite and b/assets-cg/enemies/gunslinger_right.aseprite differ diff --git a/assets-cg/levels/lvsandbox.tmx b/assets-cg/levels/lvsandbox.tmx index 06efdc8..bdfeb50 100644 --- a/assets-cg/levels/lvsandbox.tmx +++ b/assets-cg/levels/lvsandbox.tmx @@ -1,15 +1,15 @@ - + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,7,15,8,7,8,7,16,8,7,15,7,7,16,8,2,2,2,2,2, 2,2,2,2,2,4,4,14,14,6,3,3,3,3,6,4,4,14,4,2,2,2,2,2, -2,2,2,2,2,14,14,5,3,3,3,5,5,3,3,3,5,4,4,2,2,2,2,2, -2,2,2,2,2,3,5,3,3,3,4,5,5,4,3,3,3,5,3,2,2,2,2,2, -2,2,2,2,2,5,3,3,6,5,5,6,6,5,5,6,3,3,5,2,2,2,2,2, -2,2,2,2,2,3,5,3,3,3,4,5,5,4,3,3,3,5,3,2,2,2,2,2, +2,2,2,2,2,14,14,5,3,3,3,2,2,3,3,3,5,4,4,2,2,2,2,2, +2,2,2,2,2,3,5,3,3,3,2,2,2,2,3,3,3,5,3,2,2,2,2,2, +2,2,2,2,2,5,3,3,6,5,7,2,2,7,5,6,3,3,5,2,2,2,2,2, +2,2,2,2,2,3,5,3,3,3,4,7,23,4,3,3,3,5,3,2,2,2,2,2, 2,2,2,2,2,14,4,5,3,3,3,5,5,3,3,3,5,4,14,2,2,2,2,2, 2,2,2,2,2,4,14,4,4,6,3,3,3,3,6,14,14,4,4,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, diff --git a/src/anim.c b/src/anim.c index 4f7e888..37da9b8 100644 --- a/src/anim.c +++ b/src/anim.c @@ -138,14 +138,19 @@ void anim_frame_subrender(int x, int y, anim_frame_t const *frame, int left, frame->x + left, frame->y + top, width, height, DIMAGE_NONE); } -void anim_state_update(anim_state_t *state, fixed_t dt) +bool anim_state_update(anim_state_t *state, fixed_t dt) { - if(!state->frame) return; + if(!state->frame) return false; state->elapsed += fround(dt * 1000); - if(state->elapsed < state->frame->duration) return; + if(state->elapsed < state->frame->duration) return false; + + // TODO: FIXME: This is incorrect if the next animation is just behind + bool transitioning = (state->frame->next != state->frame + 1); /* Switch to next frame */ state->elapsed -= state->frame->duration; state->frame = state->frame->next; + + return transitioning; } diff --git a/src/anim.h b/src/anim.h index 23e47d0..7cdf750 100644 --- a/src/anim.h +++ b/src/anim.h @@ -61,8 +61,9 @@ void anim_frame_render(int x, int y, anim_frame_t const *frame); void anim_frame_subrender(int x, int y, anim_frame_t const *frame, int left, int top, int width, int height); -/* Update an animation to next frame. */ -void anim_state_update(anim_state_t *state, fixed_t dt); +/* Update an animation to next frame. Returns true if the update transitioned + to another animation. */ +bool anim_state_update(anim_state_t *state, fixed_t dt); /* List of animations. */ @@ -87,9 +88,9 @@ extern anim_t anims_skill_bullet; ANIM_E1(MACRO, bat, Idle, Hit, Death) \ ANIM_E1(MACRO, albinos_bat, Idle, Hit, Death) \ ANIM_E1(MACRO, crimson_bat, Idle, Hit, Death) \ - ANIM_E1(MACRO, gunslinger, Idle, Walking, Reloading, Fire, Hit, Death) \ - ANIM_E1(MACRO, gb_gunslinger, Idle, Walking, Reloading, Fire, Hit, Death) \ - ANIM_E1(MACRO, master_gunslinger, Idle, Walking,Reloading,Fire,Hit,Death) \ + ANIM_E1(MACRO, gunslinger, Idle, Walking, Fire, Hit, Death) \ + ANIM_E1(MACRO, gb_gunslinger, Idle, Walking, Fire, Hit, Death) \ + ANIM_E1(MACRO, master_gunslinger, Idle, Walking, Fire,Hit,Death) \ ANIM_E1(MACRO, tifucile, Idle, Walking, Hit, Death) \ ANIM_E1(MACRO, washing_machine, Idle, Walking, Attack, Hit, Death) diff --git a/src/comp/visible.c b/src/comp/visible.c index 1c63308..206b43f 100644 --- a/src/comp/visible.c +++ b/src/comp/visible.c @@ -38,7 +38,8 @@ void visible_update(entity_t *e, fixed_t dt) if(v->anim.frame == NULL) return; - anim_state_update(&v->anim, dt); + if(anim_state_update(&v->anim, dt)) + v->anim_priority = 0; if(v->anim.frame == NULL) v->anim_priority = 0; diff --git a/src/render.c b/src/render.c index 5af5e9f..2863505 100644 --- a/src/render.c +++ b/src/render.c @@ -504,7 +504,7 @@ void render_arcade(int x, int y, int halign, int value, int color_style) /* Auto style based on the number of digits */ if(color_style < 0) - color_style = (value >= 10) + (value >= 100); + color_style = (value >= 10) + (value >= 30); char str[16]; sprintf(str, "%d", value);