diff options
| author | Simon Tatham <anakin@pobox.com> | 2005-07-16 19:51:53 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2005-07-16 19:51:53 +0000 |
| commit | a8a903db475885c719bb242b669a2675e702ea68 (patch) | |
| tree | 8bfb39578a2eb50a79f59b8b1a366f71d569adbd /midend.c | |
| parent | c5edffdd2c38080d86747e2dfc9c796665fa3c96 (diff) | |
| download | puzzles-a8a903db475885c719bb242b669a2675e702ea68.zip puzzles-a8a903db475885c719bb242b669a2675e702ea68.tar.gz puzzles-a8a903db475885c719bb242b669a2675e702ea68.tar.bz2 puzzles-a8a903db475885c719bb242b669a2675e702ea68.tar.xz | |
New puzzle: `Untangle', cloned (with the addition of random grid
generation) from a simple but rather fun Flash game I saw this
morning.
Small infrastructure change for this puzzle: while most game
backends find the midend's assumption that Solve moves are never
animated to be a convenience absolving them of having to handle the
special case themselves, this one actually needs Solve to be
animated. Rather than break that convenience for the other puzzles,
I've introduced a flag bit (which I've shoved in mouse_priorities
for the moment, shamefully without changing its name).
[originally from svn r6097]
Diffstat (limited to 'midend.c')
| -rw-r--r-- | midend.c | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -432,7 +432,7 @@ static int midend_really_process_key(midend_data *me, int x, int y, int button) { game_state *oldstate = me->ourgame->dup_game(me->states[me->statepos - 1].state); - int special = FALSE, gotspecial = FALSE, ret = 1; + int type = MOVE, gottype = FALSE, ret = 1; float anim_time; game_state *s; char *movestr; @@ -450,8 +450,8 @@ static int midend_really_process_key(midend_data *me, int x, int y, int button) } else if (button == 'u' || button == 'u' || button == '\x1A' || button == '\x1F') { midend_stop_anim(me); - special = special(me->states[me->statepos-1].movetype); - gotspecial = TRUE; + type = me->states[me->statepos-1].movetype; + gottype = TRUE; if (!midend_undo(me)) goto done; } else if (button == 'r' || button == 'R' || @@ -501,13 +501,14 @@ static int midend_really_process_key(midend_data *me, int x, int y, int button) } } - if (!gotspecial) - special = special(me->states[me->statepos-1].movetype); + if (!gottype) + type = me->states[me->statepos-1].movetype; /* * See if this move requires an animation. */ - if (special) { + if (special(type) && !(type == SOLVE && + (me->ourgame->mouse_priorities & SOLVE_ANIMATES))) { anim_time = 0; } else { anim_time = me->ourgame->anim_length(oldstate, @@ -1117,8 +1118,17 @@ char *midend_solve(midend_data *me) me->ourgame->changed_state(me->ui, me->states[me->statepos-2].state, me->states[me->statepos-1].state); - me->anim_time = 0.0; - midend_finish_move(me); + me->dir = +1; + if (me->ourgame->mouse_priorities & SOLVE_ANIMATES) { + me->oldstate = me->ourgame->dup_game(me->states[me->statepos-2].state); + me->anim_time = + me->ourgame->anim_length(me->states[me->statepos-2].state, + me->states[me->statepos-1].state, + +1, me->ui); + } else { + me->anim_time = 0.0; + midend_finish_move(me); + } midend_redraw(me); midend_set_timer(me); return NULL; |