projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed global animations from moving again immediately after being started
[rocksndiamonds.git]
/
src
/
anim.c
diff --git
a/src/anim.c
b/src/anim.c
index 9097d88cb9f3600a1988365386315449c9917e48..3b69da7cd88ff69e3ee3dcf3d7c2f091b38caa93 100644
(file)
--- a/
src/anim.c
+++ b/
src/anim.c
@@
-56,9
+56,10
@@
#define ANIM_STATE_RUNNING (1 << 2)
/* values for global animation control */
#define ANIM_STATE_RUNNING (1 << 2)
/* values for global animation control */
-#define ANIM_START 0
-#define ANIM_CONTINUE 1
-#define ANIM_STOP 2
+#define ANIM_NO_ACTION 0
+#define ANIM_START 1
+#define ANIM_CONTINUE 2
+#define ANIM_STOP 3
struct GlobalAnimPartControlInfo
struct GlobalAnimPartControlInfo
@@
-516,10
+517,21
@@
void InitGlobalAnimations()
InitGlobalAnimControls();
}
InitGlobalAnimControls();
}
-void DrawGlobalAnimationsExt(int drawing_stage)
+void DrawGlobalAnimationsExt(int drawing_
target, int drawing_
stage)
{
{
+ int game_mode_anim_action[NUM_GAME_MODES];
int mode_nr;
int mode_nr;
+ if (!setup.toons)
+ return;
+
+ if (drawing_stage == DRAW_GLOBAL_ANIM_STAGE_1)
+ DoAnimationExt();
+
+ // always start with reliable default values (no animation actions)
+ for (mode_nr = 0; mode_nr < NUM_GAME_MODES; mode_nr++)
+ game_mode_anim_action[mode_nr] = ANIM_NO_ACTION;
+
if (global.anim_status != anim_status_last)
{
boolean before_fading = (global.anim_status == GAME_MODE_PSEUDO_FADING);
if (global.anim_status != anim_status_last)
{
boolean before_fading = (global.anim_status == GAME_MODE_PSEUDO_FADING);
@@
-532,14
+544,14
@@
void DrawGlobalAnimationsExt(int drawing_stage)
// (special handling of animations for "current screen" and "all screens")
// stop animations for last screen
// (special handling of animations for "current screen" and "all screens")
// stop animations for last screen
-
HandleGlobalAnim(ANIM_STOP, anim_status_last)
;
+
game_mode_anim_action[anim_status_last] = ANIM_STOP
;
// start animations for current screen
// start animations for current screen
-
HandleGlobalAnim(ANIM_START, global.anim_status)
;
+
game_mode_anim_action[global.anim_status] = ANIM_START
;
// start animations for all screens after loading new artwork set
if (anim_status_last == GAME_MODE_LOADING)
// start animations for all screens after loading new artwork set
if (anim_status_last == GAME_MODE_LOADING)
-
HandleGlobalAnim(ANIM_START, GAME_MODE_DEFAULT)
;
+
game_mode_anim_action[GAME_MODE_DEFAULT] = ANIM_START
;
// ---------- part 2 ------------------------------------------------------
// start or stop global animations by change of animation class
// ---------- part 2 ------------------------------------------------------
// start or stop global animations by change of animation class
@@
-554,25
+566,27
@@
void DrawGlobalAnimationsExt(int drawing_stage)
// stop animations for changed screen class before fading to new screen
if (before_fading && anim_class_last && !anim_class_next)
// stop animations for changed screen class before fading to new screen
if (before_fading && anim_class_last && !anim_class_next)
-
HandleGlobalAnim(ANIM_STOP, anim_class_game_mode)
;
+
game_mode_anim_action[anim_class_game_mode] = ANIM_STOP
;
// start animations for changed screen class after fading to new screen
if (after_fading && !anim_class_last && anim_class_next)
// start animations for changed screen class after fading to new screen
if (after_fading && !anim_class_last && anim_class_next)
-
HandleGlobalAnim(ANIM_START, anim_class_game_mode)
;
+
game_mode_anim_action[anim_class_game_mode] = ANIM_START
;
}
if (after_fading)
anim_classes_last = anim_classes_next;
anim_status_last = global.anim_status;
}
if (after_fading)
anim_classes_last = anim_classes_next;
anim_status_last = global.anim_status;
+
+ // start or stop animations determined to be started or stopped above
+ for (mode_nr = 0; mode_nr < NUM_GAME_MODES; mode_nr++)
+ if (game_mode_anim_action[mode_nr] != ANIM_NO_ACTION)
+ HandleGlobalAnim(game_mode_anim_action[mode_nr], mode_nr);
}
}
- if (
!setup.toons ||
global.anim_status == GAME_MODE_LOADING)
+ if (global.anim_status == GAME_MODE_LOADING)
return;
return;
- if (drawing_stage == DRAW_GLOBAL_ANIM_STAGE_1)
- DoAnimationExt();
-
for (mode_nr = 0; mode_nr < NUM_GAME_MODES; mode_nr++)
{
struct GlobalAnimControlInfo *ctrl = &global_anim_ctrl[mode_nr];
for (mode_nr = 0; mode_nr < NUM_GAME_MODES; mode_nr++)
{
struct GlobalAnimControlInfo *ctrl = &global_anim_ctrl[mode_nr];
@@
-667,9
+681,9
@@
void DrawGlobalAnimationsExt(int drawing_stage)
}
}
}
}
-void DrawGlobalAnimations(int drawing_stage)
+void DrawGlobalAnimations(int drawing_
target, int drawing_
stage)
{
{
- DrawGlobalAnimationsExt(drawing_stage);
+ DrawGlobalAnimationsExt(drawing_
target, drawing_
stage);
}
boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part)
}
boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part)