ref: 0f423f0b3a0bfaaac37fa2dba23794629088836f
parent: 8fa365a7b4c3f044ab6daa96a707051f091d6296
author: Simon Tatham <anakin@pobox.com>
date: Mon May 30 03:55:27 EDT 2005
Infrastructure change: game_anim_length and game_flash_length now both get passed a pointer to the game_ui. This means that if they need to note down information for the redraw function about what _type_ of flash or animation is required, they now have somewhere to do so. [originally from svn r5858]
--- a/cube.c
+++ b/cube.c
@@ -1526,13 +1526,13 @@
}
static float game_anim_length(game_state *oldstate,
- game_state *newstate, int dir)
+ game_state *newstate, int dir, game_ui *ui)
{
return ROLLTIME;
}
static float game_flash_length(game_state *oldstate,
- game_state *newstate, int dir)
+ game_state *newstate, int dir, game_ui *ui)
{
return 0.0F;
}
--- a/fifteen.c
+++ b/fifteen.c
@@ -778,7 +778,7 @@
}
static float game_anim_length(game_state *oldstate,
- game_state *newstate, int dir)
+ game_state *newstate, int dir, game_ui *ui)
{
if ((dir > 0 && newstate->just_used_solve) ||
(dir < 0 && oldstate->just_used_solve))
@@ -788,7 +788,7 @@
}
static float game_flash_length(game_state *oldstate,
- game_state *newstate, int dir)
+ game_state *newstate, int dir, game_ui *ui)
{
if (!oldstate->completed && newstate->completed &&
!oldstate->used_solve && !newstate->used_solve)
--- a/midend.c
+++ b/midend.c
@@ -212,7 +212,8 @@
flashtime = me->ourgame->flash_length(me->oldstate ? me->oldstate :
me->states[me->statepos-2].state,
me->states[me->statepos-1].state,
- me->oldstate ? me->dir : +1);
+ me->oldstate ? me->dir : +1,
+ me->ui);
if (flashtime > 0) {
me->flash_pos = 0.0F;
me->flash_time = flashtime;
@@ -333,7 +334,7 @@
} else {
anim_time = me->ourgame->anim_length(oldstate,
me->states[me->statepos-1].state,
- me->dir);
+ me->dir, me->ui);
}
me->oldstate = oldstate;
--- a/net.c
+++ b/net.c
@@ -2521,7 +2521,7 @@
}
static float game_anim_length(game_state *oldstate,
- game_state *newstate, int dir)
+ game_state *newstate, int dir, game_ui *ui)
{
int last_rotate_dir;
@@ -2544,7 +2544,7 @@
}
static float game_flash_length(game_state *oldstate,
- game_state *newstate, int dir)
+ game_state *newstate, int dir, game_ui *ui)
{
/*
* If the game has just been completed, we display a completion
--- a/netslide.c
+++ b/netslide.c
@@ -1683,7 +1683,7 @@
}
static float game_anim_length(game_state *oldstate,
- game_state *newstate, int dir)
+ game_state *newstate, int dir, game_ui *ui)
{
/*
* Don't animate an auto-solve move.
@@ -1696,7 +1696,7 @@
}
static float game_flash_length(game_state *oldstate,
- game_state *newstate, int dir)
+ game_state *newstate, int dir, game_ui *ui)
{
/*
* If the game has just been completed, we display a completion
--- a/nullgame.c
+++ b/nullgame.c
@@ -199,13 +199,13 @@
}
static float game_anim_length(game_state *oldstate, game_state *newstate,
- int dir)
+ int dir, game_ui *ui)
{
return 0.0F;
}
static float game_flash_length(game_state *oldstate, game_state *newstate,
- int dir)
+ int dir, game_ui *ui)
{
return 0.0F;
}
--- a/pattern.c
+++ b/pattern.c
@@ -1086,13 +1086,13 @@
}
static float game_anim_length(game_state *oldstate,
- game_state *newstate, int dir)
+ game_state *newstate, int dir, game_ui *ui)
{
return 0.0F;
}
static float game_flash_length(game_state *oldstate,
- game_state *newstate, int dir)
+ game_state *newstate, int dir, game_ui *ui)
{
if (!oldstate->completed && newstate->completed &&
!oldstate->cheated && !newstate->cheated)
--- a/puzzles.h
+++ b/puzzles.h
@@ -219,8 +219,10 @@
void (*redraw)(frontend *fe, game_drawstate *ds, game_state *oldstate,
game_state *newstate, int dir, game_ui *ui, float anim_time,
float flash_time);
- float (*anim_length)(game_state *oldstate, game_state *newstate, int dir);
- float (*flash_length)(game_state *oldstate, game_state *newstate, int dir);
+ float (*anim_length)(game_state *oldstate, game_state *newstate, int dir,
+ game_ui *ui);
+ float (*flash_length)(game_state *oldstate, game_state *newstate, int dir,
+ game_ui *ui);
int (*wants_statusbar)(void);
};
--- a/rect.c
+++ b/rect.c
@@ -2496,13 +2496,13 @@
}
static float game_anim_length(game_state *oldstate,
- game_state *newstate, int dir)
+ game_state *newstate, int dir, game_ui *ui)
{
return 0.0F;
}
static float game_flash_length(game_state *oldstate,
- game_state *newstate, int dir)
+ game_state *newstate, int dir, game_ui *ui)
{
if (!oldstate->completed && newstate->completed &&
!oldstate->cheated && !newstate->cheated)
--- a/sixteen.c
+++ b/sixteen.c
@@ -937,7 +937,7 @@
}
static float game_anim_length(game_state *oldstate,
- game_state *newstate, int dir)
+ game_state *newstate, int dir, game_ui *ui)
{
if ((dir > 0 && newstate->just_used_solve) ||
(dir < 0 && oldstate->just_used_solve))
@@ -947,7 +947,7 @@
}
static float game_flash_length(game_state *oldstate,
- game_state *newstate, int dir)
+ game_state *newstate, int dir, game_ui *ui)
{
if (!oldstate->completed && newstate->completed &&
!oldstate->used_solve && !newstate->used_solve)
--- a/solo.c
+++ b/solo.c
@@ -2121,13 +2121,13 @@
}
static float game_anim_length(game_state *oldstate, game_state *newstate,
- int dir)
+ int dir, game_ui *ui)
{
return 0.0F;
}
static float game_flash_length(game_state *oldstate, game_state *newstate,
- int dir)
+ int dir, game_ui *ui)
{
if (!oldstate->completed && newstate->completed &&
!oldstate->cheated && !newstate->cheated)
--- a/twiddle.c
+++ b/twiddle.c
@@ -942,7 +942,7 @@
}
static float game_anim_length(game_state *oldstate, game_state *newstate,
- int dir)
+ int dir, game_ui *ui)
{
if ((dir > 0 && newstate->just_used_solve) ||
(dir < 0 && oldstate->just_used_solve))
@@ -952,7 +952,7 @@
}
static float game_flash_length(game_state *oldstate, game_state *newstate,
- int dir)
+ int dir, game_ui *ui)
{
if (!oldstate->completed && newstate->completed &&
!oldstate->used_solve && !newstate->used_solve)
@@ -1012,7 +1012,7 @@
*/
if (oldstate) {
float angle;
- float anim_max = game_anim_length(oldstate, state, dir);
+ float anim_max = game_anim_length(oldstate, state, dir, ui);
if (dir > 0) {
lastx = state->lastx;