From 2b783a2b7321f4a8d0b576a5e9a530c6ef320540 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Wed, 9 Mar 2016 21:14:56 +0100 Subject: [PATCH] added new animation mode (modifier) 'once' for global animations --- src/cartoons.c | 4 ++++ src/libgame/misc.c | 3 +++ src/libgame/system.h | 3 +++ 3 files changed, 10 insertions(+) diff --git a/src/cartoons.c b/src/cartoons.c index 4797420c..4423d271 100644 --- a/src/cartoons.c +++ b/src/cartoons.c @@ -888,6 +888,10 @@ void HandleGlobalAnim_Main(struct GlobalAnimMainControlInfo *anim, int action) if (anim->state & ANIM_STATE_RESTART) anim->part_counter++; + + if (anim->part_counter == anim->num_parts && + c->anim_mode & ANIM_ONCE) + anim->state = ANIM_STATE_INACTIVE; } void HandleGlobalAnim_Mode(struct GlobalAnimControlInfo *ctrl, int action) diff --git a/src/libgame/misc.c b/src/libgame/misc.c index c34cddd3..ff86123d 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -2705,6 +2705,9 @@ int get_parameter_value(char *value_raw, char *suffix, int type) string_has_parameter(value, "all") ? ANIM_ALL : ANIM_DEFAULT); + if (string_has_parameter(value, "once")) + result |= ANIM_ONCE; + if (string_has_parameter(value, "reverse")) result |= ANIM_REVERSE; diff --git a/src/libgame/system.h b/src/libgame/system.h index 1ad2f709..97acf934 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -225,6 +225,7 @@ MV_NONE) /* values for animation mode (frame order and direction) */ +/* (stored in level files -- never change existing values) */ #define ANIM_NONE 0 #define ANIM_LOOP (1 << 0) #define ANIM_LINEAR (1 << 1) @@ -238,11 +239,13 @@ #define ANIM_OPAQUE_PLAYER (1 << 9) /* values for special (non game element) animation modes */ +/* (not stored in level files -- can be changed, if needed) */ #define ANIM_HORIZONTAL (1 << 10) #define ANIM_VERTICAL (1 << 11) #define ANIM_CENTERED (1 << 12) #define ANIM_STATIC_PANEL (1 << 13) #define ANIM_ALL (1 << 14) +#define ANIM_ONCE (1 << 15) #define ANIM_DEFAULT ANIM_LOOP -- 2.34.1