projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added 'position: last' for global animations to continue from last position
[rocksndiamonds.git]
/
src
/
anim.c
diff --git
a/src/anim.c
b/src/anim.c
index 4a6d2db01199b4a21d20590740185ed84b69ffb7..ff9a8d1f7b443d213cf63e69fe9786a835d4c752 100644
(file)
--- a/
src/anim.c
+++ b/
src/anim.c
@@
-126,6
+126,8
@@
struct GlobalAnimMainControlInfo
boolean has_base; // animation has base/main/default animation part
boolean has_base; // animation has base/main/default animation part
+ int last_x, last_y;
+
int init_delay_counter;
int state;
int init_delay_counter;
int state;
@@
-340,6
+342,9
@@
static void InitToonControls()
anim->has_base = FALSE;
anim->has_base = FALSE;
+ anim->last_x = POS_OFFSCREEN;
+ anim->last_y = POS_OFFSCREEN;
+
anim->init_delay_counter = 0;
anim->state = ANIM_STATE_INACTIVE;
anim->init_delay_counter = 0;
anim->state = ANIM_STATE_INACTIVE;
@@
-433,6
+438,9
@@
void InitGlobalAnimControls()
anim->has_base = FALSE;
anim->has_base = FALSE;
+ anim->last_x = POS_OFFSCREEN;
+ anim->last_y = POS_OFFSCREEN;
+
anim->init_delay_counter = 0;
anim->state = ANIM_STATE_INACTIVE;
anim->init_delay_counter = 0;
anim->state = ANIM_STATE_INACTIVE;
@@
-986,6
+994,8
@@
static boolean isClickedPart(struct GlobalAnimPartControlInfo *part,
int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, int state)
{
int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, int state)
{
+ struct GlobalAnimControlInfo *ctrl = &global_anim_ctrl[part->mode_nr];
+ struct GlobalAnimMainControlInfo *anim = &ctrl->anim[part->anim_nr];
struct GraphicInfo *g = &part->graphic_info;
struct GraphicInfo *c = &part->control_info;
boolean viewport_changed = SetGlobalAnimPart_Viewport(part);
struct GraphicInfo *g = &part->graphic_info;
struct GraphicInfo *c = &part->control_info;
boolean viewport_changed = SetGlobalAnimPart_Viewport(part);
@@
-1082,6
+1092,14
@@
int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, int state)
if (c->y != ARG_UNDEFINED_VALUE)
part->y = c->y;
if (c->y != ARG_UNDEFINED_VALUE)
part->y = c->y;
+ if (c->position == POS_LAST &&
+ anim->last_x > -g->width && anim->last_x < part->viewport_width &&
+ anim->last_y > -g->height && anim->last_y < part->viewport_height)
+ {
+ part->x = anim->last_x;
+ part->y = anim->last_y;
+ }
+
if (c->step_xoffset != ARG_UNDEFINED_VALUE)
part->step_xoffset = c->step_xoffset;
if (c->step_yoffset != ARG_UNDEFINED_VALUE)
if (c->step_xoffset != ARG_UNDEFINED_VALUE)
part->step_xoffset = c->step_xoffset;
if (c->step_yoffset != ARG_UNDEFINED_VALUE)
@@
-1209,6
+1227,9
@@
int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, int state)
part->x += part->step_xoffset;
part->y += part->step_yoffset;
part->x += part->step_xoffset;
part->y += part->step_yoffset;
+ anim->last_x = part->x;
+ anim->last_y = part->y;
+
return ANIM_STATE_RUNNING;
}
return ANIM_STATE_RUNNING;
}