diff --git a/ChangeLog.md b/ChangeLog.md index 185d3a5..8a61134 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,6 @@ ## ChangeLog -## 0.7.10 nightly +## 0.7.10 - 2022/04/02 ### Added * *Walls*: Place paths / walls by dragging (swipe across cells for paths, along edges for walls) @@ -12,9 +12,11 @@ * *Walls*: Better error display (diagonal stripes) * Cleaner screen layout by removing unnecessary 'force screen redraw' button from chooser and param screens * Optimized screen update in game screen +* Games with pencil marks now arrange them in numerically fixed position. ### Fixed * *Mosaic*: Fix preservation of 'aggressiveness' parameter +* *Solo*: Disallow certain corner-case parameters to avoid hang on game generation ## 0.7.9 - 2021/10/26 diff --git a/README.md b/README.md index f613cfc..e399015 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Port of [Simon Tatham's Portable Puzzle Collection](http://www.chiark.greenend.o [More screenshots](https://github.com/SteffenBauer/PocketPuzzles/blob/master/screenshots/screenshots.md) -[Download the app here](https://github.com/SteffenBauer/PocketPuzzles/blob/master/release/README.md) +[**Download the app here**](https://github.com/SteffenBauer/PocketPuzzles/blob/master/release/README.md) Inspired by and building on the work of [Port to Android by Chris Boyle](https://github.com/chrisboyle/sgtpuzzles) and [Puzzles for pocketbook by mnk](https://github.com/svn2github/pocketbook-free/tree/master/puzzles) diff --git a/ToDo.md b/ToDo.md index f702181..75de7d7 100644 --- a/ToDo.md +++ b/ToDo.md @@ -159,15 +159,15 @@ #### Fixed grid arrangement of pencil marks -- [ ] ABCD -- [ ] CrossNum -- [ ] Keen -- [ ] Mathrax -- [ ] Salad -- [ ] Solo -- [ ] Towers -- [ ] Undead -- [ ] Unequal +- [X] ABCD +- [X] CrossNum +- [X] Keen +- [X] Mathrax +- [X] Salad +- [X] Solo +- [X] Towers +- [X] Undead +- [X] Unequal #### Game specific UI settings diff --git a/games/abcd.c b/games/abcd.c index 1201e62..db6fd5e 100644 --- a/games/abcd.c +++ b/games/abcd.c @@ -1594,10 +1594,10 @@ static void abcd_draw_pencil(drawing *dr, game_drawstate *ds, const game_state * /* Draw hints; steal ingenious algorithm (basically) * from solo.c:draw_number() */ - for (i = nhints = 0; i < n; i++) { + /* for (i = nhints = 0; i < n; i++) { if (state->clues[CUBOID(x, y, i)]) nhints++; - } - + } */ + nhints = n; for (hw = 1; hw * hw < nhints; hw++); if (hw < 3) hw = 3; @@ -1610,7 +1610,7 @@ static void abcd_draw_pencil(drawing *dr, game_drawstate *ds, const game_state * { if (state->clues[CUBOID(x, y, i)]) { - int hx = j % hw, hy = j / hw; + int hx = i % hw, hy = i / hw; str[0] = 'A'+i; str[1] = '\0'; diff --git a/games/crossnum.c b/games/crossnum.c index e1a5e0c..ee2ba66 100644 --- a/games/crossnum.c +++ b/games/crossnum.c @@ -2260,7 +2260,7 @@ static game_state *execute_move(const game_state *from0, const char *move) for (i = 0; i < a; i++) { if (!from->clues->playable[i]) continue; - if (move[i+1] < '0' || move[i+1] > '0'+MAXNUM) { + if (move[i+1] < '0' || move[i+1] > '0'+9) { free_game(ret); return from; } @@ -2276,7 +2276,7 @@ static game_state *execute_move(const game_state *from0, const char *move) return ret; } else if ((move[0] == 'P' || move[0] == 'R') && sscanf(move+1, "%d,%d,%d", &x, &y, &n) == 3 && - x >= 0 && x < sz && y >= 0 && y < sz && n >= -1 && n <= MAXNUM) { + x >= 0 && x < sz && y >= 0 && y < sz && n >= -1 && n <= 9) { if (!from->clues->playable[y*sz+x]) return from; @@ -2308,7 +2308,7 @@ static game_state *execute_move(const game_state *from0, const char *move) if (ret->grid[y*sz+x] == -1) ret->pencil[y*sz+x] = ( ((from->clues->oddeven == 2 ? 0 : 1) + x + y)%2 ? - oddmask : evenmask); + evenmask : oddmask); } } else { long mask = (2L<par->max) - 2; @@ -2352,11 +2352,11 @@ static float *game_colours(frontend *fe, int *ncolours) ret[COL_BACKGROUND * 3 + i] = 1.0F; ret[COL_GRID * 3 + i] = 0.0F; ret[COL_USER * 3 + i] = 0.0F; - ret[COL_HIGHLIGHT * 3 + i] = 0.75F; + ret[COL_HIGHLIGHT * 3 + i] = 0.5F; ret[COL_ERROR * 3 + i] = 0.25F; ret[COL_ERROR_USER * 3 + i] = 0.75F; - ret[COL_PENCIL * 3 + i] = 0.0F; - ret[COL_EVENBG * 3 + i] = 0.9F; + ret[COL_PENCIL * 3 + i] = 0.25F; + ret[COL_EVENBG * 3 + i] = 0.75F; ret[COL_ODDBG * 3 + i] = 1.0F; } @@ -2561,12 +2561,12 @@ static void draw_tile(drawing *dr, game_drawstate *ds, const game_params *par, (tile & DF_HIGHLIGHT ? COL_ERROR : COL_ERROR_USER) : COL_USER), str); - } else if ((tile & DF_DIGIT_MASK) && !(tile & DF_HIGHLIGHT_PENCIL)) { + } /* else if ((tile & DF_DIGIT_MASK) && !(tile & DF_HIGHLIGHT_PENCIL)) { sprintf(str, "%d_", (int)(tile & DF_DIGIT_MASK)); draw_text(dr, tx + cw/2, ty + ch/2, FONT_VARIABLE, TILESIZE/2, ALIGN_VCENTRE | ALIGN_HCENTRE, COL_USER, str); - } else { + } */ else { long rev; int i, j, npencil; int pl, pr, pt, pb; @@ -2578,11 +2578,12 @@ static void draw_tile(drawing *dr, game_drawstate *ds, const game_params *par, rev = 1L << ((tile & DF_DIGIT_MASK) + DF_PENCIL_SHIFT); } else rev = 0; - for (i = 1, npencil = 0; i <= MAXNUM; i++) + /* for (i = 1, npencil = 0; i <= MAXNUM; i++) if ((tile ^ rev) & (1L << (i + DF_PENCIL_SHIFT))) npencil++; if (tile & DF_DIGIT_MASK) - npencil++; + npencil++; */ + npencil = 9; if (npencil) { minph = 2; @@ -2623,9 +2624,9 @@ static void draw_tile(drawing *dr, game_drawstate *ds, const game_params *par, /* * Now actually draw the pencil marks. */ - for (i = 1, j = 0; i <= MAXNUM; i++) + for (i = 1, j = 0; i <= 9; i++) if ((tile ^ rev) & (1L << (i + DF_PENCIL_SHIFT))) { - int dx = j % pw, dy = j / pw; + int dx = (i-1) % pw, dy = (i-1) / pw; sprintf(str, "%d", i); draw_text(dr, pl + pgsizex * (2*dx+1) / 2, pt + pgsizey * (2*dy+1) / 2, @@ -2634,7 +2635,7 @@ static void draw_tile(drawing *dr, game_drawstate *ds, const game_params *par, str); j++; } - if (tile & DF_DIGIT_MASK) { + /* if (tile & DF_DIGIT_MASK) { int dx = j % pw, dy = j / pw; sprintf(str, "%d_", (int)(tile & DF_DIGIT_MASK)); draw_text(dr, pl + pgsizex * (2*dx+1) / 2, @@ -2642,7 +2643,7 @@ static void draw_tile(drawing *dr, game_drawstate *ds, const game_params *par, FONT_VARIABLE, fontsize, ALIGN_VCENTRE | ALIGN_HCENTRE, COL_PENCIL, str); - } + } */ } } } @@ -2732,11 +2733,11 @@ static bool game_timing_state(const game_state *state, game_ui *ui) #ifdef COMBINED #define thegame crossnum #endif -static const char rules[] = "Fill the grid with numbers like a crossword puzzle. The sum of each line must match the given horizontal / vertical clues. The same number cannot occur more than once in each sum.\n\n" -"These variations are available:\n" +static const char rules[] = "Fill the grid with numbers like a crossword puzzle. The sum of each line must match the given horizontal / vertical clues. The same number cannot occur more than once in each sum.\n\n\n" +"These variations are available:\n\n" "- Odd/Even: White cells can only have an odd number, grey cells only an even number.\n" "- Unique: No two sums can contain the same numbers.\n" -"\n\n\nThis puzzle was implemented by Anders Holst."; +"\n\nThis puzzle was implemented by Anders Holst."; const struct game thegame = { "CrossNum", "games.crossnum", "crossnum", rules, diff --git a/games/keen.c b/games/keen.c index 4a8043d..c06bf35 100644 --- a/games/keen.c +++ b/games/keen.c @@ -2019,10 +2019,12 @@ static void draw_tile(drawing *dr, game_drawstate *ds, struct clues *clues, int pw, ph, minph, pbest, fontsize; /* Count the pencil marks required. */ - for (i = 1, npencil = 0; i <= w; i++) + /* for (i = 1, npencil = 0; i <= w; i++) if (tile & (1L << (i + DF_PENCIL_SHIFT))) - npencil++; - if (npencil) { + npencil++; */ + npencil = w; + + if (npencil) { minph = 2; @@ -2098,7 +2100,7 @@ static void draw_tile(drawing *dr, game_drawstate *ds, struct clues *clues, */ for (i = 1, j = 0; i <= w; i++) if (tile & (1L << (i + DF_PENCIL_SHIFT))) { - int dx = j % pw, dy = j / pw; + int dx = (i-1) % pw, dy = (i-1) / pw; str[1] = '\0'; str[0] = i + '0'; diff --git a/games/mathrax.c b/games/mathrax.c index 12c81ff..7f3c3de 100644 --- a/games/mathrax.c +++ b/games/mathrax.c @@ -1567,13 +1567,13 @@ static void game_redraw(drawing *dr, game_drawstate *ds, else if(state->marks[y*o+x]) /* Draw pencil marks */ { int nhints, i, j, hw, hh, hmax, fontsz; - for (i = nhints = 0; i < 9; i++) { + /* for (i = nhints = 0; i < o; i++) { if (state->marks[y*o+x] & (1<marks[y*o+x] & (1<marks[y*o+x] & (1<marks[y*o+x] & (1<xtype && params->c * params->r < 4) return "X-type puzzle dimensions must be larger than 3"; + if (params->diff >= DIFF_SIMPLE && params->c == 3 && params->r == 1) + return "Too small for a Jigsaw puzzle of this difficulty"; + if (params->diff >= DIFF_INTERSECT && params->c == 4 && params->r == 1) + return "Too small for a Jigsaw puzzle of this difficulty"; return NULL; } @@ -4538,9 +4542,10 @@ static void draw_number(drawing *dr, game_drawstate *ds, int pw, ph, minph, pbest, fontsize; /* Count the pencil marks required. */ - for (i = npencil = 0; i < cr; i++) + /* for (i = npencil = 0; i < cr; i++) if (state->pencil[(y*cr+x)*cr+i]) - npencil++; + npencil++; */ + npencil = cr; if (npencil) { minph = 2; @@ -4625,7 +4630,7 @@ static void draw_number(drawing *dr, game_drawstate *ds, */ for (i = j = 0; i < cr; i++) if (state->pencil[(y*cr+x)*cr+i]) { - int dx = j % pw, dy = j / pw; + int dx = i % pw, dy = i / pw; str[1] = '\0'; str[0] = i + '1'; diff --git a/games/towers.c b/games/towers.c index fc74ae9..9ca7a5b 100644 --- a/games/towers.c +++ b/games/towers.c @@ -1663,10 +1663,11 @@ static void draw_tile(drawing *dr, game_drawstate *ds, struct clues *clues, int pw, ph, minph, pbest, fontsize; /* Count the pencil marks required. */ - for (i = 1, npencil = 0; i <= w; i++) + /* for (i = 1, npencil = 0; i <= w; i++) if (tile & (1L << (i + DF_PENCIL_SHIFT))) - npencil++; - if (npencil) { + npencil++; */ + npencil = w; + if (npencil) { minph = 2; @@ -1727,7 +1728,7 @@ static void draw_tile(drawing *dr, game_drawstate *ds, struct clues *clues, */ for (i = 1, j = 0; i <= w; i++) if (tile & (1L << (i + DF_PENCIL_SHIFT))) { - int dx = j % pw, dy = j / pw; + int dx = (i-1) % pw, dy = (i-1) / pw; str[1] = '\0'; str[0] = i + '0'; diff --git a/games/undead.c b/games/undead.c index ea5b473..5f807ce 100644 --- a/games/undead.c +++ b/games/undead.c @@ -2881,6 +2881,7 @@ static void draw_big_monster(drawing *dr, game_drawstate *ds, return; } +/* static void draw_pencils(drawing *dr, game_drawstate *ds, const game_state *state, int x, int y, int pencil) { @@ -2907,6 +2908,25 @@ static void draw_pencils(drawing *dr, game_drawstate *ds, return; } +*/ +static void draw_pencils(drawing *dr, game_drawstate *ds, + const game_state *state, int x, int y, int pencil) +{ + int dx, dy; + dx = BORDER+(x* ds->tilesize)+(TILESIZE/4); + dy = BORDER+(y* ds->tilesize)+(TILESIZE/4)+TILESIZE; + + if (pencil & 1) + draw_monster(dr, ds, dx, dy, TILESIZE/2, 1); + if (pencil & 2) + draw_monster(dr, ds, dx + TILESIZE/2, dy, TILESIZE/2, 2); + if (pencil & 4) + draw_monster(dr, ds, dx, dy + TILESIZE/2, TILESIZE/2, 4); + + draw_update(dr,dx-(TILESIZE/4)+2,dy-(TILESIZE/4)+2, + (TILESIZE/2)-3,(TILESIZE/2)-3); + return; +} static bool is_hint_stale(const game_drawstate *ds, const game_state *state, int index) { diff --git a/games/unequal.c b/games/unequal.c index b7b2d94..c85b0f1 100644 --- a/games/unequal.c +++ b/games/unequal.c @@ -1865,10 +1865,10 @@ static void draw_hints(drawing *dr, game_drawstate *ds, int x, int y) /* Draw hints; steal ingenious algorithm (basically) * from solo.c:draw_number() */ - for (i = nhints = 0; i < ds->order; i++) { + /* for (i = nhints = 0; i < ds->order; i++) { if (HINT(ds, x, y, i)) nhints++; - } - + } */ + nhints = ds->order; for (hw = 1; hw * hw < nhints; hw++); if (hw < 3) hw = 3; hh = (nhints + hw - 1) / hw; @@ -1878,7 +1878,7 @@ static void draw_hints(drawing *dr, game_drawstate *ds, int x, int y) for (i = j = 0; i < ds->order; i++) { if (HINT(ds,x,y,i)) { - int hx = j % hw, hy = j / hw; + int hx = i % hw, hy = i / hw; str[0] = n2c(i+1, ds->order); str[1] = '\0'; diff --git a/release/README.md b/release/README.md index 391fce8..65d9b16 100644 --- a/release/README.md +++ b/release/README.md @@ -4,8 +4,8 @@ You can find pre-compiled binaries ready for installation here. Choose between one of these build stages: -* [Stable release (0.7.9)](https://github.com/SteffenBauer/PocketPuzzles/blob/master/release/stable/SGTPuzzles.app) Compiled in sync with the latest tagged release. Recommended. -* [Previous release (0.7.8)](https://github.com/SteffenBauer/PocketPuzzles/blob/master/release/previous/SGTPuzzles.app) The app release tag just before the current stable one. Install this when you have problems with the stable release. +* [Stable release (0.7.10)](https://github.com/SteffenBauer/PocketPuzzles/blob/master/release/stable/SGTPuzzles.app) Compiled in sync with the latest tagged release. Recommended. +* [Previous release (0.7.9)](https://github.com/SteffenBauer/PocketPuzzles/blob/master/release/previous/SGTPuzzles.app) The app release tag just before the current stable one. Install this when you have problems with the stable release. * [Nightly build](https://github.com/SteffenBauer/PocketPuzzles/blob/master/release/nightly/SGTPuzzles.app) This binary is kept in sync with the current master branch. Can contain untested code, so install only when you want the newest features. ### Installation diff --git a/release/nightly/SGTPuzzles.app b/release/nightly/SGTPuzzles.app index 229b7a4..f4eee58 100755 Binary files a/release/nightly/SGTPuzzles.app and b/release/nightly/SGTPuzzles.app differ diff --git a/release/previous/SGTPuzzles.app b/release/previous/SGTPuzzles.app index 64429a4..7d0a137 100755 Binary files a/release/previous/SGTPuzzles.app and b/release/previous/SGTPuzzles.app differ diff --git a/release/stable/SGTPuzzles.app b/release/stable/SGTPuzzles.app index 7d0a137..f4eee58 100755 Binary files a/release/stable/SGTPuzzles.app and b/release/stable/SGTPuzzles.app differ