-#define LASER_FLAGMASK 0xf800
-#define LASER_OMITTED 0x0800
-#define LASER_REFLECT 0x1000
-#define LASER_HIT 0x2000
-#define LASER_WRONG 0x4000
-#define LASER_FLASHED 0x8000
-#define LASER_EMPTY (~0)
+#define LASER_FLAGMASK 0x1f800
+#define LASER_OMITTED 0x0800
+#define LASER_REFLECT 0x1000
+#define LASER_HIT 0x2000
+#define LASER_WRONG 0x4000
+#define LASER_FLASHED 0x8000
+#define LASER_EMPTY (~0)
+
+#define FLAG_CURSOR 0x10000 /* needs to be disjoint from both sets */
enum { NONE, TOGGLE_BALL, TOGGLE_LOCK, FIRE, REVEAL,
TOGGLE_COLUMN_LOCK, TOGGLE_ROW_LOCK} action = NONE;
char buf[80], *nullret = NULL;
enum { NONE, TOGGLE_BALL, TOGGLE_LOCK, FIRE, REVEAL,
TOGGLE_COLUMN_LOCK, TOGGLE_ROW_LOCK} action = NONE;
char buf[80], *nullret = NULL;
-static void draw_arena_tile(frontend *fe, game_state *gs, game_drawstate *ds,
- int ax, int ay, int force, int isflash)
+static void draw_square_cursor(drawing *dr, game_drawstate *ds, int dx, int dy)
+{
+ int coff = TILE_SIZE/8;
+ draw_rect_outline(dr, dx + coff, dy + coff,
+ TILE_SIZE - coff*2,
+ TILE_SIZE - coff*2,
+ COL_CURSOR);
+}
+
+
+static void draw_arena_tile(drawing *dr, game_state *gs, game_drawstate *ds,
+ game_ui *ui, int ax, int ay, int force, int isflash)
{
int gx = ax+1, gy = ay+1;
int gs_tile = GRID(gs, gx, gy), ds_tile = GRID(ds, gx, gy);
int dx = TODRAW(gx), dy = TODRAW(gy);
{
int gx = ax+1, gy = ay+1;
int gs_tile = GRID(gs, gx, gy), ds_tile = GRID(ds, gx, gy);
int dx = TODRAW(gx), dy = TODRAW(gy);
- draw_rect(fe, dx, dy, TILE_SIZE, TILE_SIZE, bg);
- draw_rect_outline(fe, dx, dy, TILE_SIZE, TILE_SIZE, COL_GRID);
+ draw_rect(dr, dx, dy, TILE_SIZE, TILE_SIZE, bg);
+ draw_rect_outline(dr, dx, dy, TILE_SIZE, TILE_SIZE, COL_GRID);
- draw_rect(fe, dx, dy, TILE_SIZE, TILE_SIZE, COL_BACKGROUND);
- draw_rect_outline(fe, dx, dy, TILE_SIZE, TILE_SIZE, COL_GRID);
+ draw_rect(dr, dx, dy, TILE_SIZE, TILE_SIZE, COL_BACKGROUND);
+ draw_rect_outline(dr, dx, dy, TILE_SIZE, TILE_SIZE, COL_GRID);
- draw_line(fe, x0+ts, y0+ts, x0+ts, y0, COL_HIGHLIGHT);
- draw_line(fe, x0+ts, y0, x1-ts, y0, COL_HIGHLIGHT);
- draw_line(fe, x1-ts, y0, x1-ts, y0+ts, COL_LOWLIGHT);
- draw_line(fe, x1-ts, y0+ts, x1, y0+ts, COL_HIGHLIGHT);
- draw_line(fe, x1, y0+ts, x1, y1-ts, COL_LOWLIGHT);
- draw_line(fe, x1, y1-ts, x1-ts, y1-ts, COL_LOWLIGHT);
- draw_line(fe, x1-ts, y1-ts, x1-ts, y1, COL_LOWLIGHT);
- draw_line(fe, x1-ts, y1, x0+ts, y1, COL_LOWLIGHT);
- draw_line(fe, x0+ts, y1, x0+ts, y1-ts, COL_HIGHLIGHT);
- draw_line(fe, x0+ts, y1-ts, x0, y1-ts, COL_LOWLIGHT);
- draw_line(fe, x0, y1-ts, x0, y0+ts, COL_HIGHLIGHT);
- draw_line(fe, x0, y0+ts, x0+ts, y0+ts, COL_HIGHLIGHT);
+ draw_line(dr, x0+ts, y0+ts, x0+ts, y0, COL_HIGHLIGHT);
+ draw_line(dr, x0+ts, y0, x1-ts, y0, COL_HIGHLIGHT);
+ draw_line(dr, x1-ts, y0, x1-ts, y0+ts, COL_LOWLIGHT);
+ draw_line(dr, x1-ts, y0+ts, x1, y0+ts, COL_HIGHLIGHT);
+ draw_line(dr, x1, y0+ts, x1, y1-ts, COL_LOWLIGHT);
+ draw_line(dr, x1, y1-ts, x1-ts, y1-ts, COL_LOWLIGHT);
+ draw_line(dr, x1-ts, y1-ts, x1-ts, y1, COL_LOWLIGHT);
+ draw_line(dr, x1-ts, y1, x0+ts, y1, COL_LOWLIGHT);
+ draw_line(dr, x0+ts, y1, x0+ts, y1-ts, COL_HIGHLIGHT);
+ draw_line(dr, x0+ts, y1-ts, x0, y1-ts, COL_LOWLIGHT);
+ draw_line(dr, x0, y1-ts, x0, y0+ts, COL_HIGHLIGHT);
+ draw_line(dr, x0, y0+ts, x0+ts, y0+ts, COL_HIGHLIGHT);
- clip(fe, TODRAW(0), TODRAW(0), TILE_SIZE-1, TILE_SIZE-1);
- draw_circle(fe, TODRAW(0) + ds->crad, TODRAW(0) + ds->crad, ds->crad,
- COL_BUTTON, COL_BALL);
- unclip(fe);
+ int outline = (ui->cur_visible && ui->cur_x == 0 && ui->cur_y == 0)
+ ? COL_CURSOR : COL_BALL;
+ clip(dr, TODRAW(0), TODRAW(0), TILE_SIZE-1, TILE_SIZE-1);
+ draw_circle(dr, TODRAW(0) + ds->crad, TODRAW(0) + ds->crad, ds->crad,
+ outline, outline);
+ draw_circle(dr, TODRAW(0) + ds->crad, TODRAW(0) + ds->crad, ds->crad-2,
+ COL_BUTTON, COL_BUTTON);
+ unclip(dr);