simon-git: puzzles (main): Ben Harris

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Wed Dec 14 00:49:27 GMT 2022


TL;DR:
  43bea5f mkhighlight: Don't darken the base colour if we don't need a highlight
  712abb7 Add an assertion that all colours are within range
  562b29e Don't request a highlight colour in games that don't need one
  8acb84e Rewrite mkhighlight to handle a wider range of colours

Repository:     https://git.tartarus.org/simon/puzzles.git
On the web:     https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer:      Ben Harris <bjh21 at bjh21.me.uk>
Date:           2022-12-14 00:49:27

commit 43bea5f6f20b4a58b083ccb0b380e78180017128
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=43bea5f6f20b4a58b083ccb0b380e78180017128;hp=676ec87b6d9ef1cf0adfe30af2df1e8a43c6523c
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Mon Dec 12 20:17:30 2022 +0000

    mkhighlight: Don't darken the base colour if we don't need a highlight
    
    The "mkhighlight" functions can now take -1 as the requested highlight
    or lowlight colour as an indication that no such colour should be
    returned.  If the caller doesn't want a highlight colour, there's not
    much point in darkening the base colour to make it distinct from the
    highlight, so don't do that.
    
    This means that the background colours in Palisade and Untangle are no
    longer unnecessarily darkened.

 misc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

commit 712abb7719440e132750fedf1bab60db9c1023fd
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=712abb7719440e132750fedf1bab60db9c1023fd;hp=43bea5f6f20b4a58b083ccb0b380e78180017128
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Mon Dec 12 21:09:32 2022 +0000

    Add an assertion that all colours are within range
    
    Because I know I'm going to mess this up at some point.

 midend.c | 3 +++
 1 file changed, 3 insertions(+)

commit 562b29e102cdfa019b0f9d79e105f3f7d7e7bb0e
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=562b29e102cdfa019b0f9d79e105f3f7d7e7bb0e;hp=712abb7719440e132750fedf1bab60db9c1023fd
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Mon Dec 12 21:15:37 2022 +0000

    Don't request a highlight colour in games that don't need one
    
    This means that Range, Singles, and Tracks can now use the default
    background colour even if it's close to white.  In the case of Singles
    I've left a dummy entry in the colour list so as not to renumber the
    rest and break everyone's environment variables.  If Singles ever needs
    a new colour it can re-use that slot.

 range.c   | 3 +--
 singles.c | 5 +++--
 tracks.c  | 5 ++---
 3 files changed, 6 insertions(+), 7 deletions(-)

commit 8acb84ea7f21a581349458a39ec3f889fd525cc5
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=8acb84ea7f21a581349458a39ec3f889fd525cc5;hp=562b29e102cdfa019b0f9d79e105f3f7d7e7bb0e
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Tue Dec 13 23:28:35 2022 +0000

    Rewrite mkhighlight to handle a wider range of colours
    
    Before, it worked by scaling all the colour components, which worked
    reasonably for colours in the vicinity of white, but failed badly on a
    black background.  Now it generates the highlight and lowlight colours
    by mixing the background colour with white and black respectively.
    Where there isn't enough headroom, it adjusts the background by mixing
    in a negative amount of white or black, which makes sense geometrically
    if not in paint.
    
    There is still a problem that green and yellow colours don't end up with
    bright enough highlights.  I think this is because the code doesn't
    understand that green is brighter than red or blue.

 misc.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 66 insertions(+), 17 deletions(-)



More information about the tartarus-commits mailing list