#define TILE_JOINDOWN 0x0400 /* used in drawstate */
#define TILE_JOINDIAG 0x0800 /* used in drawstate */
#define TILE_HASSEL 0x1000 /* used in drawstate */
+#define TILE_IMPOSSIBLE 0x2000 /* used in drawstate */
#define TILE(gs,x,y) ((gs)->tiles[(gs)->params.w*(y)+(x)])
#define COL(gs,x,y) (TILE(gs,x,y) & TILE_COLMASK)
char *ret;
int n, i, j, c, retlen, *tiles;
- debug(("new_game_desc: %dx%d, %d colours",
- params->w, params->h, params->ncols));
n = params->w * params->h;
tiles = snewn(n, int);
memset(tiles, 0, n*sizeof(int));
sfree(state);
}
-static game_state *solve_game(game_state *state, game_aux_info *aux,
- char **error)
+static game_state *solve_game(game_state *state, game_state *currstate,
+ game_aux_info *aux, char **error)
{
return NULL;
}
for (i = 0; i < state->n; i++)
ui->tiles[i] &= ~TILE_SELECTED;
ui->nselected = 0;
- debug(("sel_clear"));
}
}
}
ui->nselected = 0;
- debug(("sel_remove: removed %d selected tiles", nremoved));
}
static void sel_expand(game_ui *ui, game_state *state, int tx, int ty)
int ns = 1, nadded, x, y, c;
TILE(ui,tx,ty) |= TILE_SELECTED;
- debug(("sel_expand, selected initial tile"));
do {
nadded = 0;
}
}
ns += nadded;
- debug(("sel_expand, new pass, selected %d more tiles", nadded));
} while (nadded > 0);
if (ns > 1) {
ndone = 0;
for (x = 0; x < ret->params.w-1; x++) {
if (sg_emptycol(ret,x) && !sg_emptycol(ret,x+1)) {
- debug(("column %d is empty, shuffling from %d", x, x+1));
ndone++;
for (y = 0; y < ret->params.h; y++) {
SWAPTILE(ret,x,y,x+1,y);
dy = (button == CURSOR_DOWN) ? +1 : ((button == CURSOR_UP) ? -1 : 0);
ui->xsel = (ui->xsel + from->params.w + dx) % from->params.w;
ui->ysel = (ui->ysel + from->params.h + dy) % from->params.h;
- debug(("cursor pressed, d=(%d,%d), sel=(%d,%d)",dx,dy,ui->xsel,ui->ysel));
return ret;
} else if (button == CURSOR_SELECT || button == ' ' || button == '\r' ||
button == '\n') {
ui->displaysel = 1;
tx = ui->xsel;
ty = ui->ysel;
- debug(("cursor select, t=(%d,%d)", tx, ty));
} else
return NULL;
ret[COL_3 * 3 + 1] = 0.0F;
ret[COL_3 * 3 + 2] = 0.0F;
- ret[COL_4 * 3 + 0] = 0.5F;
- ret[COL_4 * 3 + 1] = 0.5F;
- ret[COL_4 * 3 + 2] = 1.0F;
+ ret[COL_4 * 3 + 0] = 1.0F;
+ ret[COL_4 * 3 + 1] = 1.0F;
+ ret[COL_4 * 3 + 2] = 0.0F;
- ret[COL_5 * 3 + 0] = 0.5F;
- ret[COL_5 * 3 + 1] = 1.0F;
- ret[COL_5 * 3 + 2] = 0.5F;
+ ret[COL_5 * 3 + 0] = 1.0F;
+ ret[COL_5 * 3 + 1] = 0.0F;
+ ret[COL_5 * 3 + 2] = 1.0F;
- ret[COL_6 * 3 + 0] = 1.0F;
- ret[COL_6 * 3 + 1] = 0.5F;
- ret[COL_6 * 3 + 2] = 0.5F;
+ ret[COL_6 * 3 + 0] = 0.0F;
+ ret[COL_6 * 3 + 1] = 1.0F;
+ ret[COL_6 * 3 + 2] = 1.0F;
- ret[COL_7 * 3 + 0] = 1.0F;
- ret[COL_7 * 3 + 1] = 1.0F;
- ret[COL_7 * 3 + 2] = 0.0F;
+ ret[COL_7 * 3 + 0] = 0.5F;
+ ret[COL_7 * 3 + 1] = 0.5F;
+ ret[COL_7 * 3 + 2] = 1.0F;
- ret[COL_8 * 3 + 0] = 1.0F;
- ret[COL_8 * 3 + 1] = 0.0F;
- ret[COL_8 * 3 + 2] = 1.0F;
+ ret[COL_8 * 3 + 0] = 0.5F;
+ ret[COL_8 * 3 + 1] = 1.0F;
+ ret[COL_8 * 3 + 2] = 0.5F;
- ret[COL_9 * 3 + 0] = 0.0F;
- ret[COL_9 * 3 + 1] = 1.0F;
- ret[COL_9 * 3 + 2] = 1.0F;
+ ret[COL_9 * 3 + 0] = 1.0F;
+ ret[COL_9 * 3 + 1] = 0.5F;
+ ret[COL_9 * 3 + 2] = 0.5F;
ret[COL_IMPOSSIBLE * 3 + 0] = 0.0F;
ret[COL_IMPOSSIBLE * 3 + 1] = 0.0F;
static void tile_redraw(frontend *fe, game_drawstate *ds,
int x, int y, int dright, int dbelow,
- int tile, game_state *state, int bgcolour)
+ int tile, int bgcolour)
{
int outer = bgcolour, inner = outer, col = tile & TILE_COLMASK;
if (col) {
- if (state->impossible) {
+ if (tile & TILE_IMPOSSIBLE) {
outer = col;
inner = COL_IMPOSSIBLE;
} else if (tile & TILE_SELECTED) {
{
int bgcolour, x, y;
- debug(("samegame redraw: dir %d, oldstate 0x%lx, animtime %f, flashtime %f",
- dir, oldstate, animtime, flashtime));
-
/* This was entirely cloned from fifteen.c; it should probably be
* moved into some generic 'draw-recessed-rectangle' utility fn. */
if (!ds->started) {
int dbelow = (y+1 < state->params.h);
tile |= ISSEL(ui,x,y);
+ if (state->impossible)
+ tile |= TILE_IMPOSSIBLE;
if (dright && COL(state,x+1,y) == col)
tile |= TILE_JOINRIGHT;
if (dbelow && COL(state,x,y+1) == col)
(flashtime > 0.0) ||
(ds->bgcolour != bgcolour) ||
(tile != ds->tiles[i])) {
- tile_redraw(fe, ds, x, y, dright, dbelow,
- tile, state, bgcolour);
+ tile_redraw(fe, ds, x, y, dright, dbelow, tile, bgcolour);
ds->tiles[i] = tile;
}
}