Guess: move hold marker upward by two pixels

This means that it now potentially overlaps the peg above it (part of
the current guess), rather than potentially overlapping the empty hole
below.  More importantly, it means that the hold marker is erased by
the erasure of the rest of the peg area, so there's no need to
explicitly draw absent hold markers in the background colour.  That in
turn means that absent hold markers don't nibble the tops off all the
pegs at some tile sizes.

Instead of this fix, I could have properly made the hold markers part
of the first row of empty holes, but that would have been rather
fiddly and I've long thought that the hold markers were too far from
the peg that they're holding.

I've also removed part of a comment about the drawing order of hold
markers that seems to have been obsolete even before this commit.
This commit is contained in:
Ben Harris
2023-08-08 09:35:06 +01:00
parent 6d4b20c413
commit 78af0c821a

17
guess.c
View File

@ -1291,15 +1291,17 @@ static void guess_redraw(drawing *dr, game_drawstate *ds, int guess,
if ((dest->pegs[i] != scol) || force) {
draw_peg(dr, ds, rowx + PEGOFF * i, rowy, false, labelled,
scol &~ 0x7000);
if (scol & 0x1000)
draw_cursor(dr, ds, rowx + PEGOFF * i, rowy);
/*
* Hold marker.
*/
draw_rect(dr, rowx + PEGOFF * i, rowy + PEGSZ + ds->gapsz/2,
PEGSZ, 2, (scol & 0x2000 ? COL_HOLD : COL_BACKGROUND));
draw_update(dr, rowx + PEGOFF * i, rowy + PEGSZ + ds->gapsz/2,
PEGSZ, 2);
if (scol & 0x1000)
draw_cursor(dr, ds, rowx + PEGOFF * i, rowy);
if (scol & 0x2000) {
draw_rect(dr, rowx + PEGOFF * i,
rowy + PEGSZ + ds->gapsz/2 - 2, PEGSZ, 2, COL_HOLD);
}
draw_update(dr, rowx + PEGOFF * i,
rowy + PEGSZ + ds->gapsz/2 - 2, PEGSZ, 2);
}
dest->pegs[i] = scol;
}
@ -1424,8 +1426,7 @@ static void game_redraw(drawing *dr, game_drawstate *ds,
}
}
/* draw the guesses (so far) and the hints
* (in reverse order to avoid trampling holds, and postponing the
/* draw the guesses (so far) and the hints (postponing the
* next_go'th to not overrender the top of the circular cursor) */
for (i = state->params.nguesses - 1; i >= 0; i--) {
if (i < state->next_go || state->solved) {