boolean no_delay = (tape.warp_forward);
unsigned int anim_delay = 0;
int frame_delay_value = (ffwd_delay ? FfwdFrameDelay : GameFrameDelay);
- int anim_delay_value = (no_delay ? 0 : frame_delay_value);
+ int anim_delay_value = (no_delay ? 0 : frame_delay_value) / 2;
int font_nr = FONT_ENVELOPE_1 + envelope_nr;
int font_width = getFontWidth(font_nr);
int font_height = getFontHeight(font_nr);
int yend = (anim_mode != ANIM_DEFAULT ? max_ysize : 0);
int xstep = (xstart < xend ? 1 : 0);
int ystep = (ystart < yend || xstep == 0 ? 1 : 0);
- int x, y;
+ int start = 0;
+ int end = MAX(xend - xstart, yend - ystart);
+ int i;
- for (x = xstart, y = ystart; x <= xend && y <= yend; x += xstep, y += ystep)
+ for (i = start; i <= end; i++)
{
+ int last_frame = end; // last frame of this "for" loop
+ int x = xstart + i * xstep;
+ int y = ystart + i * ystep;
int xsize = (action == ACTION_CLOSING ? xend - (x - xstart) : x) + 2;
int ysize = (action == ACTION_CLOSING ? yend - (y - ystart) : y) + 2;
int sx = SX + (SXSIZE - xsize * font_width) / 2;
redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER;
BackToFront();
- WaitUntilDelayReached(&anim_delay, anim_delay_value / 2);
+ SkipUntilDelayReached(&anim_delay, anim_delay_value, &i, last_frame);
}
}
boolean ffwd_delay = (tape.playing && tape.fast_forward);
boolean no_delay = (tape.warp_forward);
int delay_value = (ffwd_delay ? delay_value_fast : delay_value_normal);
- int anim_delay_value = (no_delay ? 0 : delay_value + 500 * 0);
+ int anim_delay_value = (no_delay ? 0 : delay_value + 500 * 0) / 2;
unsigned int anim_delay = 0;
int width = request.width;
int yend = (anim_mode != ANIM_DEFAULT ? max_ysize_inner : 0);
int xstep = (xstart < xend ? 1 : 0);
int ystep = (ystart < yend || xstep == 0 ? 1 : 0);
- int x, y;
+ int start = 0;
+ int end = MAX(xend - xstart, yend - ystart);
+ int i;
if (setup.quick_doors)
{
xstart = xend;
ystart = yend;
+ end = 0;
}
else
{
PlayMenuSoundStereo(SND_DOOR_CLOSING, SOUND_MIDDLE);
}
- for (x = xstart, y = ystart; x <= xend && y <= yend; x += xstep, y += ystep)
+ for (i = start; i <= end; i++)
{
+ int last_frame = end; // last frame of this "for" loop
+ int x = xstart + i * xstep;
+ int y = ystart + i * ystep;
int xsize = (action == ACTION_CLOSING ? xend - (x - xstart) : x) + 2;
int ysize = (action == ACTION_CLOSING ? yend - (y - ystart) : y) + 2;
int sx_center = (request.x != -1 ? request.x : SX + SXSIZE / 2);
DoAnimation();
BackToFront();
- WaitUntilDelayReached(&anim_delay, anim_delay_value / 2);
+ SkipUntilDelayReached(&anim_delay, anim_delay_value, &i, last_frame);
}
}
for (k = start; k < num_move_steps; k++)
{
+ int last_frame = num_move_steps - 1; // last frame of this "for" loop
+
door_part_done_all = TRUE;
for (i = 0; i < NUM_DOORS; i++)
if (game_status == GAME_MODE_MAIN)
DoAnimation();
- WaitUntilDelayReached(&door_delay, door_delay_value);
+ SkipUntilDelayReached(&door_delay, door_delay_value, &k, last_frame);
current_move_delay += max_step_delay;
}
#endif
}
+void CheckSaveEngineSnapshot_EM(byte action[MAX_PLAYERS], int frame,
+ boolean any_player_moving,
+ boolean any_player_snapping,
+ boolean any_player_dropping)
+{
+ static boolean player_was_waiting = TRUE;
+
+ if (frame == 0 && !any_player_dropping)
+ {
+ if (!player_was_waiting)
+ {
+ if (!SaveEngineSnapshotToList())
+ return;
+
+ player_was_waiting = TRUE;
+ }
+ }
+ else if (any_player_moving || any_player_snapping || any_player_dropping)
+ {
+ player_was_waiting = FALSE;
+ }
+}
+
+void CheckSaveEngineSnapshot_SP(boolean murphy_is_waiting,
+ boolean murphy_is_dropping)
+{
+ static boolean player_was_waiting = TRUE;
+
+ if (murphy_is_waiting)
+ {
+ if (!player_was_waiting)
+ {
+ if (!SaveEngineSnapshotToList())
+ return;
+
+ player_was_waiting = TRUE;
+ }
+ }
+ else
+ {
+ player_was_waiting = FALSE;
+ }
+}
+
void CheckSingleStepMode_EM(byte action[MAX_PLAYERS], int frame,
boolean any_player_moving,
- boolean player_is_dropping)
+ boolean any_player_snapping,
+ boolean any_player_dropping)
{
if (tape.single_step && tape.recording && !tape.pausing)
- if (frame == 0 && !player_is_dropping)
+ if (frame == 0 && !any_player_dropping)
TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
+
+ CheckSaveEngineSnapshot_EM(action, frame, any_player_moving,
+ any_player_snapping, any_player_dropping);
}
void CheckSingleStepMode_SP(boolean murphy_is_waiting,
if (tape.single_step && tape.recording && !tape.pausing)
if (murphy_is_waiting)
TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
+
+ CheckSaveEngineSnapshot_SP(murphy_is_waiting, murphy_is_dropping);
}
void getGraphicSource_SP(struct GraphicInfo_SP *g_sp,
// printf("::: new_tilesize_var != TILESIZE_VAR\n");
// changing tile size invalidates scroll values of engine snapshots
- FreeEngineSnapshot();
+ FreeEngineSnapshotSingle();
// changing tile size requires update of graphic mapping for EM engine
init_em_graphics = TRUE;