aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
...
* Introduce a new game backend function (there seem to have been a lotSimon Tatham2005-06-06
| | | | | | | | | | | | | | | | | | | of these recently) whose job is to update a game_ui to be consistent with a new game_state. This is called by midend.c in every situation where the current game_state changes _other_ than as a result of make_move (Undo, Redo, Restart, Solve). The introduction of this function allows a game_ui to contain information about selections or highlights within a game_state which simply wouldn't make sense when transferred to another game_state. In particular, I've used it to fix a subtle bug in Solo whereby, although you couldn't right-click to pencil-mode highlight a filled square, you could _get_ a pencil-mode highlight in a filled square if you used Undo and Redo. (Undo to before the square was filled, right-click to highlight it, then Redo. Alternatively, left-click and clear the square, right-click to highlight it, then Undo.) [originally from svn r5912]
* Small UI bug: LEFT_RELEASEs were being thrown away completely ifSimon Tatham2005-06-04
| | | | | | | | their coordinates were outside the playing area. Clearly no actual move should be made in that situation, but we do at least need to sort out any highlighted squares from the prior dragging operations. [originally from svn r5911]
* Revamp pencil mark placement and sizing. Pencil marks are now sizedSimon Tatham2005-06-04
| | | | | | | | | | | | and positioned according to how many there are in the cell, rather than how many distinct digits there are in the entire puzzle. This means that 4x4 Solo can now be played with pencil marks without _too_ much difficulty; the marks will still get a bit crowded if you have more than 12 in the same square, but with luck that shouldn't happen often, and as long as you're down in the 2-9 range things should be entirely legible. [originally from svn r5909]
* James Harvey requested that puzzles not use DEBUG as a preprocessorSimon Tatham2005-06-04
| | | | | | | | | symbol for enabling diagnostics, presumably because in his Palm port it means something else as well. He sent this patch to switch Net and Netslide over to using GENERATION_DIAGNOSTICS, in the fashion of the newer games. [originally from svn r5908]
* Colin Watson suggests that Alt-click (or Option-click) couldSimon Tatham2005-06-03
| | | | | | | | | | | | usefully be equivalent to right-clicking on platforms other than OS X; in particular, it's useful if you're running Linux on Apple hardware such as PowerBook which inherently has only one button. So here's the fix for GTK, and Windows as well (the latter for completeness and consistency, not because I can actually think of any reason somebody might be running Windows on one-button hardware). [originally from svn r5907]
* Unique solubility in Mines means that you can massively increase theSimon Tatham2005-06-03
| | | | | | | | | | | mine density without (as you would with a conventional random grid generator) rendering the game completely unplayable. High mine densities are really good fun, and the point of the presets menu is to provide people with pre-tested good settings and things they might not have thought to try for themselves; so here are three additional presets with high densities. [originally from svn r5906]
* Standalone compilation mode which turns mines.c into a littleSimon Tatham2005-06-02
| | | | | | | | | | utility to convert descriptive game IDs containing mine bitmaps between obfuscated and cleartext. Might be handy for anyone planning to design custom levels to send to friends (mines spelling out `Happy Birthday', that sort of thing), as someone suggested to me today :-) [originally from svn r5903]
* Fix various departures from C found by `gcc -ansi -pedantic'. ISimon Tatham2005-06-02
| | | | | | | haven't checked in Makefile changes to enable this, but I'll at least fix the specific problems it found when enabled as a one-off. [originally from svn r5902]
* min()/max() macros conflict with ones defined by Windows (or at least MinGW)Jacob Nevins2005-06-01
| | | | | | | headers; but MIN()/MAX() conflict with glib. Let's keep the lower-case ones, and assume that any provided by the system have the obvious semantics. [originally from svn r5900]
* Fix Richard's patch so that it's actually C :-/Simon Tatham2005-06-01
| | | | [originally from svn r5899]
* Another highlighting patch from Richard Boulton: immediately flagSimon Tatham2005-06-01
| | | | | | | | | | any actual clashes (duplicate numbers in a row, column or block) in red. This is a non-privileged deduction: it doesn't compare against a known solution or consult a solver. It simply indicates reasons why (no superset of) the current grid would cause the completion flash to go off. [originally from svn r5898]
* Miscellaneous fixes from James Harvey's PalmOS porting work:Simon Tatham2005-06-01
| | | | | | | | | | | | | | | | | | | | - fixed numerous memory leaks (not Palm-specific) - corrected a couple of 32-bit-int assumptions (vital for Palm but generally a good thing anyway) - lifted a few function pointer types into explicit typedefs (neutral for me but convenient for the source-munging Perl scripts he uses to deal with Palm code segment rules) - lifted a few function-level static arrays into global static arrays (neutral for me but apparently works round a Palm tools bug) - a couple more presets in Rectangles (so that Palm, or any other slow platform which can't handle the larger sizes easily, can still have some variety available) - in Solo, arranged a means of sharing scratch space between calls to nsolve to prevent a lot of redundant malloc/frees (gives a 10% speed increase even on existing platforms) [originally from svn r5897]
* Arrange that random seeds are as harmonised as they can reasonablySimon Tatham2005-06-01
| | | | | | be between interactive and batch use. [originally from svn r5896]
* I've proved that a grid dimension of 2 is capable of irretrievablySimon Tatham2005-06-01
| | | | | | | | | hanging the grid generator and that there's no way to fix it. Therefore, lower limit of 3 squares in each direction, which will upset envelope-pushers everywhere but doesn't destroy any actually interesting puzzles. [originally from svn r5895]
* Gareth points out that the recess highlights around the outside ofSimon Tatham2005-06-01
| | | | | | | the grid, in all games that have them, are drawn incorrectly when the grid is not square. Fixed. [originally from svn r5893]
* Patches from Richard B for Solo:Simon Tatham2005-06-01
| | | | | | | | | | | | | - prevent highlighting a clue square at all - enable easier switching between highlight types by not requiring a left-click highlight to be left-click-cancelled before right-clicking, and vice versa - fix bit-rot in -DSTANDALONE_SOLVER Also one of mine: - replicate Richard's -DSTANDALONE_SOLVER fix in Pattern, where it was also broken. [originally from svn r5892]
* Chris Emerson observed the same status-bar flicker under GTK as ISimon Tatham2005-06-01
| | | | | | | did under Windows, so here's his patch (blatantly copied from my own fix in windows.c :-). [originally from svn r5891]
* Typo in click bounds checking.Simon Tatham2005-06-01
| | | | [originally from svn r5890]
* Better mouse button handling in Mines:Simon Tatham2005-05-31
| | | | | | | | | | | | | - middle button now also triggers the clear-around-square action - a special-case handler in midend_process_key() arranges that the left button always trumps the right button if both are pressed together, meaning that Windows Minesweeper players used to pressing L+R to clear around a square should still be able to do so without any strange behaviour. (The latter touches all game backends, yet again, to add a field to the game structure which is zero in everything except Mines.) [originally from svn r5888]
* Bah, and remove the TODO item. As usual.Simon Tatham2005-05-31
| | | | [originally from svn r5887]
* Now _this_ is what Undo ought to be doing in a Minesweeper clone.Simon Tatham2005-05-31
| | | | | | | | | | | | | | | | | Rather than revealing the entire mine layout when you die, we now only reveal the one mine that killed you. You can then Undo and continue playing, without having spoiled the rest of the grid for yourself. The number of times you've died is counted in the status line (and is not reduced by Undo :-). Amusingly, I think this in itself is quite a good way of dealing with ambiguous sections in a Minesweeper grid: they no longer _completely_ spoil your enjoyment of the game, because you can still play the remainder of the grid even if you haven't got a completely clean sweep. Just my luck that I should invent the idea when I've already arranged for ambiguous sections to be absent :-) [originally from svn r5886]
* Aha! It turns out, after a bit of failure-mode profiling, that whenSimon Tatham2005-05-31
| | | | | | | | | | | | the Mines unique grid generator fails at high mine densities it is _almost always_ for the same reason, and it also turns out that this reason is one which can be addressed. So here's an enhancement to mineperturb() which enables Mines to generate a grid at (as far as I can tell) any mine density you like, up to and including w*h-9 mines. At densities of 1 in 2 or thereabouts the grids start to look rather strange, but it can at least generate them without hanging. [originally from svn r5885]
* valgrind spotted this array underrun. I wonder if this might haveSimon Tatham2005-05-31
| | | | | | been causing some of Verity's nonreproducible weirdnesses. [originally from svn r5884]
* Oops! A trivial typo in obfuscate_bitmap() made the obfuscationSimon Tatham2005-05-31
| | | | | | | | | | | | | | function rather less uniform-looking than I'd intended. I _thought_ it looked a bit fishy, but had assumed it was just the human tendency to see patterns where none exist. Now fixed, and some real test vectors confirm that this time the obfuscation function is actually what I intended it to be. This means that all masked game IDs generated before this revision are now invalid. That's a shame, but the game is only a day old and I think I can reasonably justify it as teething trouble. [originally from svn r5883]
* `Solve' operation is relatively simple in Mines.Simon Tatham2005-05-31
| | | | [originally from svn r5882]
* Apparently a number of Windows programs like to use ^Y as a keyboardSimon Tatham2005-05-31
| | | | | | shortcut for Redo. I wasn't doing anything else with it, so why not? [originally from svn r5880]
* Document the mouse control method for Cube.Jacob Nevins2005-05-31
| | | | [originally from svn r5879]
* Move definition of PI into puzzles.h. If nothing else, the definition in cube.cJacob Nevins2005-05-31
| | | | | | had a typo :) [originally from svn r5878]
* Mouse-based interface for Cube: you left-click anywhere on the gridSimon Tatham2005-05-31
| | | | | | | | | | | | | | | and it moves the polyhedron in the general direction of the mouse pointer. (I had this in my initial throwaway Python implementation of this game, but never reimplemented it in this version. It's harder with triangles, but not too much harder.) Since the logical-to-physical coordinate mapping in Cube is dynamically computed, this has involved an interface change which touches all puzzles: make_move() is now passed a pointer to the game_drawstate, which it may of course completely ignore if it wishes. [originally from svn r5877]
* Emma Garside suggested that it would be nice to have a differentSimon Tatham2005-05-31
| | | | | | | | | | background colour for covered and uncovered squares in Mines, since otherwise you have to distinguish them by the edge highlights alone. So here one is; it's not _very_ different (it just looked odd if it was any darker than this), but anyone who wants a bigger difference can reconfigure it using the MINES_COLOUR_1 environment variable. [originally from svn r5876]
* Improved the limited shuffle mechanism in Sixteen and Twiddle. TheySimon Tatham2005-05-31
| | | | | | | | | | | | | | | | | | | | | | | were already making sure that no shuffle move was the precise inverse of the previous one, or contributed to repeating the previous one so many times as to turn it into effectively fewer moves (doing the same rotation three times in Twiddle, or shifting a row by more than half its length in Sixteen). However, they were only checking against the _last_ move, which meant that in any situation where there were completely disjoint move spaces (4x4n2 Twiddle, or any Sixteen at all) it was still possible to have A then B then inv(A) occurring in the shuffle, leading to an unnecessarily easy game. Now both shuffle routines keep separate track of all _non-overlapping_ recent moves, and will avoid inverting any move which hasn't had another move overlap it since it was made. This should reduce the incidence of too-easy limited shuffle games, although it can't be prevented _entirely_ (since, if nothing else, it's always possible to increase the shuffle limit past the maximum group radius). [originally from svn r5875]
* Fix a couple of robustness issues.Simon Tatham2005-05-31
| | | | [originally from svn r5873]
* GTK misfires timers at inconvenient moments, sometimes causing a newSimon Tatham2005-05-31
| | | | | | | | | puzzle of a different size to be redrawn before the pixmap is resized, and since backends never redraw already-drawn stuff this is a problem. Was biting me when I entered a Mines game ID of a different size than the current settings into the Specific box. [originally from svn r5872]
* Chris's patch to stop Mines depending on char being signed.Simon Tatham2005-05-30
| | | | [originally from svn r5871]
* Added an `interactive' flag to new_game_desc(), which toggles MinesSimon Tatham2005-05-30
| | | | | | | | | between on the one hand generating indeterminate game descriptions awaiting the initial click, and on the other hand generating concrete ones which have had their initial click. This makes `mines --generate' do something useful. [originally from svn r5869]
* `Copy' operation for Mines.Simon Tatham2005-05-30
| | | | [originally from svn r5868]
* Constrain mine count to be at most the largest number of mines weSimon Tatham2005-05-30
| | | | | | can guarantee to fit into the grid! [originally from svn r5867]
* First cut at a game timer. Yet another backend function whichSimon Tatham2005-05-30
| | | | | | | | | | | | | | | indicates whether a particular game state should have the timer going (for Mines the initial indeterminate state does not have this property, and neither does a dead or won state); a midend function that optionally (on request from the game) prepends a timer to the front of the status bar text; some complicated midend timing code. It's not great. It's ugly; it's probably slightly inaccurate; it's got no provision for anyone but the game author decreeing whether a game is timed or not. But Mines can't be taken seriously without a timer, so it's a start. [originally from svn r5866]
* D'oh, there's always one. Remove first-click stuff from the todo list.Simon Tatham2005-05-30
| | | | [originally from svn r5863]
* Mines now follows the conventional approach of offering a completelySimon Tatham2005-05-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | blank grid until you make the first click; to ensure solubility, it does not generate the mine layout until that click, and then ensures it is solvable starting from that position. This has involved three infrastructure changes: - random.c now offers functions to encode and decode an entire random_state as a string - each puzzle's new_game() is now passed a pointer to the midend itself, which most of them ignore - there's a function in the midend which a game can call back to _rewrite_ its current game description. So Mines now has two entirely separate forms of game ID. One contains the generation-time parameters (n and unique) plus an encoding of a random_state; the other actually encodes the grid once it's been generated, and also contains the initial click position. When called with the latter, new_game() does plausibly normal stuff. When called with the former, it notes down all the details and waits until the first square is opened, and _then_ does the grid generation and updates the game description in the midend. So if, _after_ your first click, you decide you want to share this particular puzzle with someone else, you can do that fine. Also in this checkin, the mine layout is no longer _copied_ between all the game_states on the undo chain. Instead, it's in a separate structure and all game_states share a pointer to it - and the structure is reference-counted to ensure deallocation. [originally from svn r5862]
* Neat idea from Gareth: if you put a % on the end of the mine countSimon Tatham2005-05-30
| | | | | | in the Custom dialog box, it'll treat it as a mine density. [originally from svn r5861]
* Nit: "warning: extra tokens at end of #endif directive"Jacob Nevins2005-05-30
| | | | [originally from svn r5860]
* Initial checkin of my Minesweeper clone, which uses a solver duringSimon Tatham2005-05-30
| | | | | | grid generation to arrange a mine layout that never requires guessing. [originally from svn r5859]
* Infrastructure change: game_anim_length and game_flash_length nowSimon Tatham2005-05-30
| | | | | | | | | both get passed a pointer to the game_ui. This means that if they need to note down information for the redraw function about what _type_ of flash or animation is required, they now have somewhere to do so. [originally from svn r5858]
* Add a limited-shuffle mode like that added to Sixteen and Twiddle in r5769,Jacob Nevins2005-05-28
| | | | | | | for completeness. [originally from svn r5854] [r5769 == 8f1c713735316422cfe041400ccc49999d563d8b]
* Add the ability to use the Rectangles solver for actually solvingSimon Tatham2005-05-28
| | | | | | | | | puzzles, rather than just doing its nondeterministic number placement thing. This enables the use of the `Solve' menu option on externally entered game IDs, provided of course that they aren't _too_ difficult. [originally from svn r5852]
* Add support for Jacob's new cursor-key modifier flags in the OS X frontend.Simon Tatham2005-05-26
| | | | [originally from svn r5847]
* Sorted out the barriers/corners trouble left by r5844. No wonderSimon Tatham2005-05-26
| | | | | | | | | | | | | | | | | | | | Jacob wasn't able to find a satisfactory fix: the whole area was a horrid mess. Fortunately, the reason it was a horrid mess was because the Net drawing routines predated the introduction of clip() in the frontend interface, and it turns out that clip() makes it possible to do all this more easily and better. So, a complete rearchitecting of barrier corners: the corner flags in the `barriers' array are now gone (and good riddance), and corner information is computed on the fly so as to take into account the moving grid edges. In the process I've also updated the corner mechanism so that a barrier `corner' (really endpoint) is drawn at the end of _every_ barrier, not just where two meet. This has changed the appearance of a single isolated barrier, to what I would have wanted it to look like in the first place but achieving it without clip() was just too fiddly. [originally from svn r5846] [r5844 == 865e8ad6ca3d83ad2a585ceeb1809e9f68c18a20]
* Since the split into random and descriptive IDs, the section on game seeds hasJacob Nevins2005-05-26
| | | | | | been mostly covered by the main documentation or otherwise moot. [originally from svn r5845]
* Add origin-shifting (Shift+cursors) and source-shifting (Ctrl+cursors) to Net.Jacob Nevins2005-05-26
| | | | | | | | | | | | (Adding modifier+cursors handling has had minor knock-on effects on the other puzzles, so that they can continue to ignore modifiers.) (An unfortunate side effect of this is some artifacts in exterior barrier drawing; notably, a disconnected corner can now appear at the corner of the grid under some circumstances. I haven't found a satisfactory way round this yet.) [originally from svn r5844]