Stop the analysis pass in Loopy's redraw routine from being
[sgt/puzzles] / inertia.c
index aebd314..eb850ac 100644 (file)
--- a/inertia.c
+++ b/inertia.c
@@ -1534,7 +1534,7 @@ struct game_drawstate {
 #define COORD(x)  ( (x) * TILESIZE + BORDER )
 #define FROMCOORD(x)  ( ((x) - BORDER + TILESIZE) / TILESIZE - 1 )
 
-static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
+static char *interpret_move(game_state *state, game_ui *ui, const game_drawstate *ds,
                            int x, int y, int button)
 {
     int w = state->p.w, h = state->p.h /*, wh = w*h */;
@@ -1896,32 +1896,10 @@ static void draw_tile(drawing *dr, game_drawstate *ds, int x, int y, int v)
        int cx = tx + TILESIZE / 2;
        int cy = ty + TILESIZE / 2;
        int r = TILESIZE / 2 - 3;
-       int coords[4*5*2];
-       int xdx = 1, xdy = 0, ydx = 0, ydy = 1;
-       int tdx, tdy, i;
-
-       for (i = 0; i < 4*5*2; i += 5*2) {
-           coords[i+2*0+0] = cx - r/6*xdx + r*4/5*ydx;
-           coords[i+2*0+1] = cy - r/6*xdy + r*4/5*ydy;
-           coords[i+2*1+0] = cx - r/6*xdx + r*ydx;
-           coords[i+2*1+1] = cy - r/6*xdy + r*ydy;
-           coords[i+2*2+0] = cx + r/6*xdx + r*ydx;
-           coords[i+2*2+1] = cy + r/6*xdy + r*ydy;
-           coords[i+2*3+0] = cx + r/6*xdx + r*4/5*ydx;
-           coords[i+2*3+1] = cy + r/6*xdy + r*4/5*ydy;
-           coords[i+2*4+0] = cx + r*3/5*xdx + r*3/5*ydx;
-           coords[i+2*4+1] = cy + r*3/5*xdy + r*3/5*ydy;
-
-           tdx = ydx;
-           tdy = ydy;
-           ydx = xdx;
-           ydy = xdy;
-           xdx = -tdx;
-           xdy = -tdy;
-       }
-
-       draw_polygon(dr, coords, 5*4, COL_MINE, COL_MINE);
 
+       draw_circle(dr, cx, cy, 5*r/6, COL_MINE, COL_MINE);
+       draw_rect(dr, cx - r/6, cy - r, 2*(r/6)+1, 2*r+1, COL_MINE);
+       draw_rect(dr, cx - r, cy - r/6, 2*r+1, 2*(r/6)+1, COL_MINE);
        draw_rect(dr, cx-r/3, cy-r/3, r/3, r/4, COL_HIGHLIGHT);
     } else if (v == STOP) {
        draw_circle(dr, tx + TILESIZE/2, ty + TILESIZE/2,
@@ -2157,6 +2135,16 @@ static float game_flash_length(game_state *oldstate, game_state *newstate,
     return 0.0F;
 }
 
+static int game_status(game_state *state)
+{
+    /*
+     * We never report the game as lost, on the grounds that if the
+     * player has died they're quite likely to want to undo and carry
+     * on.
+     */
+    return state->gems == 0 ? +1 : 0;
+}
+
 static int game_timing_state(game_state *state, game_ui *ui)
 {
     return TRUE;
@@ -2205,6 +2193,7 @@ const struct game thegame = {
     game_redraw,
     game_anim_length,
     game_flash_length,
+    game_status,
     FALSE, FALSE, game_print_size, game_print,
     TRUE,                             /* wants_statusbar */
     FALSE, game_timing_state,