ref: cdfc740fe45e17d61075d653d45efedcd9743805
parent: eb8a374d0dd263953647067ec26b1fc33661d3f5
author: Simon Tatham <anakin@pobox.com>
date: Tue May 11 14:37:20 EDT 2004
Don't rush move animation to a conclusion on a subsequent keypress unless there's actual activity happening as a result of the move. Net animations were tending to get rushed to conclusion by the mouse button release now that it's being reported to the mid-end. [originally from svn r4211]
--- a/midend.c
+++ b/midend.c
@@ -158,29 +158,36 @@
activate_timer(me->frontend);
}
-int midend_process_key(midend_data *me, int x, int y, int button)
+static void midend_stop_anim(midend_data *me)
{
- game_state *oldstate = dup_game(me->states[me->statepos - 1]);
- float anim_time;
-
if (me->oldstate || me->anim_time) {
midend_finish_move(me);
midend_redraw(me);
}
+}
+int midend_process_key(midend_data *me, int x, int y, int button)
+{
+ game_state *oldstate = dup_game(me->states[me->statepos - 1]);
+ float anim_time;
+
if (button == 'n' || button == 'N' || button == '\x0E') {
+ midend_stop_anim(me);
midend_new_game(me);
midend_redraw(me);
return 1; /* never animate */
} else if (button == 'r' || button == 'R') {
+ midend_stop_anim(me);
midend_restart_game(me);
midend_redraw(me);
return 1; /* never animate */
} else if (button == 'u' || button == 'u' ||
button == '\x1A' || button == '\x1F') {
+ midend_stop_anim(me);
if (!midend_undo(me))
return 1;
} else if (button == '\x12') {
+ midend_stop_anim(me);
if (!midend_redo(me))
return 1;
} else if (button == 'q' || button == 'Q' || button == '\x11') {
@@ -199,6 +206,7 @@
midend_redraw(me);
return 1;
} else if (s) {
+ midend_stop_anim(me);
while (me->nstates > me->statepos)
free_game(me->states[--me->nstates]);
ensure(me);