}
void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate,
- game_state *state, float t)
+ game_state *state, float t, float ft)
{
int x, y, tx, ty, frame;
unsigned char *active;
}
tx = ty = -1;
- frame = -1;
if (oldstate && (t < ROTATE_TIME)) {
/*
* We're animating a tile rotation. Find the turning tile,
angle = state->last_rotate_dir * -90.0F * (t / ROTATE_TIME);
state = oldstate;
}
- } else if (t > ROTATE_TIME) {
+ }
+
+ frame = -1;
+ if (ft > 0) {
/*
* We're animating a completion flash. Find which frame
* we're at.
*/
- frame = (int)((t - ROTATE_TIME) / FLASH_FRAME);
+ frame = (int)(ft / FLASH_FRAME);
}
/*
float game_anim_length(game_state *oldstate, game_state *newstate)
{
- float ret = 0.0F;
int x, y;
/*
for (x = 0; x < oldstate->width; x++)
for (y = 0; y < oldstate->height; y++)
if ((tile(oldstate, x, y) ^ tile(newstate, x, y)) & 0xF) {
- ret = ROTATE_TIME;
- goto break_label; /* leave both loops at once */
+ return ROTATE_TIME;
}
- break_label:
+ return 0.0F;
+}
+
+float game_flash_length(game_state *oldstate, game_state *newstate)
+{
/*
- * Also, if the game has just been completed, allow time for a
- * completion flash.
+ * If the game has just been completed, we display a completion
+ * flash.
*/
if (!oldstate->completed && newstate->completed) {
int size;
size = newstate->width - newstate->cx;
if (size < newstate->height - newstate->cy)
size = newstate->height - newstate->cy;
- ret += FLASH_FRAME * (size+4);
+ return FLASH_FRAME * (size+4);
}
- return ret;
+ return 0.0F;
}