From 62b0456a4b1415d3e4138e8dbca4b22f88d374d6 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Tue, 23 Jul 2024 06:05:45 -0400 Subject: puzzles: resync with upstream (adds new Palisade cursor interface). Resyncs properly with this slightly modified upstream: https://www.franklinwei.com/git/puzzles/commit/?h=rockbox-devel&id=1c62dac3f4f1a819a394ff33cc82912cf9079b50 Change-Id: I2018e81647c22010f9d74d8d14d13982f2969a8f --- apps/plugins/puzzles/help/blackbox.c | 2 +- apps/plugins/puzzles/help/bridges.c | 2 +- apps/plugins/puzzles/help/cube.c | 2 +- apps/plugins/puzzles/help/dominosa.c | 2 +- apps/plugins/puzzles/help/fifteen.c | 2 +- apps/plugins/puzzles/help/filling.c | 2 +- apps/plugins/puzzles/help/flip.c | 2 +- apps/plugins/puzzles/help/flood.c | 2 +- apps/plugins/puzzles/help/galaxies.c | 2 +- apps/plugins/puzzles/help/guess.c | 2 +- apps/plugins/puzzles/help/inertia.c | 2 +- apps/plugins/puzzles/help/keen.c | 2 +- apps/plugins/puzzles/help/lightup.c | 2 +- apps/plugins/puzzles/help/loopy.c | 2 +- apps/plugins/puzzles/help/magnets.c | 2 +- apps/plugins/puzzles/help/map.c | 2 +- apps/plugins/puzzles/help/mines.c | 2 +- apps/plugins/puzzles/help/mosaic.c | 2 +- apps/plugins/puzzles/help/net.c | 2 +- apps/plugins/puzzles/help/netslide.c | 2 +- apps/plugins/puzzles/help/palisade.c | 115 ++++++++++++++--------- apps/plugins/puzzles/help/pattern.c | 2 +- apps/plugins/puzzles/help/pearl.c | 2 +- apps/plugins/puzzles/help/pegs.c | 2 +- apps/plugins/puzzles/help/range.c | 2 +- apps/plugins/puzzles/help/rect.c | 2 +- apps/plugins/puzzles/help/samegame.c | 2 +- apps/plugins/puzzles/help/signpost.c | 2 +- apps/plugins/puzzles/help/singles.c | 2 +- apps/plugins/puzzles/help/sixteen.c | 2 +- apps/plugins/puzzles/help/slant.c | 2 +- apps/plugins/puzzles/help/solo.c | 2 +- apps/plugins/puzzles/help/tents.c | 2 +- apps/plugins/puzzles/help/towers.c | 2 +- apps/plugins/puzzles/help/tracks.c | 2 +- apps/plugins/puzzles/help/twiddle.c | 2 +- apps/plugins/puzzles/help/undead.c | 2 +- apps/plugins/puzzles/help/unequal.c | 2 +- apps/plugins/puzzles/help/unruly.c | 2 +- apps/plugins/puzzles/help/untangle.c | 2 +- apps/plugins/puzzles/src/inertia.c | 9 +- apps/plugins/puzzles/src/mines.c | 12 +-- apps/plugins/puzzles/src/palisade.c | 174 +++++++++++++++++++++++++++++++---- apps/plugins/puzzles/src/puzzles.but | 20 +++- apps/plugins/puzzles/src/signpost.c | 5 +- apps/plugins/puzzles/src/unequal.c | 24 ++--- 46 files changed, 309 insertions(+), 128 deletions(-) (limited to 'apps/plugins/puzzles') diff --git a/apps/plugins/puzzles/help/blackbox.c b/apps/plugins/puzzles/help/blackbox.c index f01852becf..c9afd8e9f0 100644 --- a/apps/plugins/puzzles/help/blackbox.c +++ b/apps/plugins/puzzles/help/blackbox.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/bridges.c b/apps/plugins/puzzles/help/bridges.c index bd01c53426..5d4c878d7c 100644 --- a/apps/plugins/puzzles/help/bridges.c +++ b/apps/plugins/puzzles/help/bridges.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/cube.c b/apps/plugins/puzzles/help/cube.c index 21c3eb7cc3..f43131008e 100644 --- a/apps/plugins/puzzles/help/cube.c +++ b/apps/plugins/puzzles/help/cube.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/dominosa.c b/apps/plugins/puzzles/help/dominosa.c index 34958feb22..d8613270df 100644 --- a/apps/plugins/puzzles/help/dominosa.c +++ b/apps/plugins/puzzles/help/dominosa.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/fifteen.c b/apps/plugins/puzzles/help/fifteen.c index 7c0b4c8063..da982ea70a 100644 --- a/apps/plugins/puzzles/help/fifteen.c +++ b/apps/plugins/puzzles/help/fifteen.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/filling.c b/apps/plugins/puzzles/help/filling.c index a5ccd6d1fb..abf379318d 100644 --- a/apps/plugins/puzzles/help/filling.c +++ b/apps/plugins/puzzles/help/filling.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/flip.c b/apps/plugins/puzzles/help/flip.c index 91a0886b66..dbf0d1bcf4 100644 --- a/apps/plugins/puzzles/help/flip.c +++ b/apps/plugins/puzzles/help/flip.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/flood.c b/apps/plugins/puzzles/help/flood.c index 48905fd784..38a43e6522 100644 --- a/apps/plugins/puzzles/help/flood.c +++ b/apps/plugins/puzzles/help/flood.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/galaxies.c b/apps/plugins/puzzles/help/galaxies.c index 17b0d4a945..90d9332639 100644 --- a/apps/plugins/puzzles/help/galaxies.c +++ b/apps/plugins/puzzles/help/galaxies.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/guess.c b/apps/plugins/puzzles/help/guess.c index 9749854e1e..87469c072a 100644 --- a/apps/plugins/puzzles/help/guess.c +++ b/apps/plugins/puzzles/help/guess.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/inertia.c b/apps/plugins/puzzles/help/inertia.c index ba8d71d0a5..8817abd295 100644 --- a/apps/plugins/puzzles/help/inertia.c +++ b/apps/plugins/puzzles/help/inertia.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/keen.c b/apps/plugins/puzzles/help/keen.c index 9152fed158..93fd91266a 100644 --- a/apps/plugins/puzzles/help/keen.c +++ b/apps/plugins/puzzles/help/keen.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/lightup.c b/apps/plugins/puzzles/help/lightup.c index 874a05c596..5f2e3f5e06 100644 --- a/apps/plugins/puzzles/help/lightup.c +++ b/apps/plugins/puzzles/help/lightup.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/loopy.c b/apps/plugins/puzzles/help/loopy.c index 62ec8cfa0e..98b8b552c3 100644 --- a/apps/plugins/puzzles/help/loopy.c +++ b/apps/plugins/puzzles/help/loopy.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/magnets.c b/apps/plugins/puzzles/help/magnets.c index b89b23b097..e5c3a20d8e 100644 --- a/apps/plugins/puzzles/help/magnets.c +++ b/apps/plugins/puzzles/help/magnets.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/map.c b/apps/plugins/puzzles/help/map.c index 18b3fb5ace..4f3dd8346e 100644 --- a/apps/plugins/puzzles/help/map.c +++ b/apps/plugins/puzzles/help/map.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/mines.c b/apps/plugins/puzzles/help/mines.c index 8a4f4038c0..9f8cd2133b 100644 --- a/apps/plugins/puzzles/help/mines.c +++ b/apps/plugins/puzzles/help/mines.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/mosaic.c b/apps/plugins/puzzles/help/mosaic.c index 835de1898d..6fb160f28c 100644 --- a/apps/plugins/puzzles/help/mosaic.c +++ b/apps/plugins/puzzles/help/mosaic.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/net.c b/apps/plugins/puzzles/help/net.c index 9b42b5eca3..de900c1505 100644 --- a/apps/plugins/puzzles/help/net.c +++ b/apps/plugins/puzzles/help/net.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/netslide.c b/apps/plugins/puzzles/help/netslide.c index e8d066e1fc..9c27f17e0d 100644 --- a/apps/plugins/puzzles/help/netslide.c +++ b/apps/plugins/puzzles/help/netslide.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/palisade.c b/apps/plugins/puzzles/help/palisade.c index 9b95b07eae..7626a87c56 100644 --- a/apps/plugins/puzzles/help/palisade.c +++ b/apps/plugins/puzzles/help/palisade.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ @@ -7,14 +7,15 @@ struct style_text help_text_style[] = { { 0, TEXT_CENTER | C_RED }, { 88, TEXT_CENTER | C_RED }, - { 150, TEXT_CENTER | C_RED }, - { 167, TEXT_UNDERLINE }, - { 168, TEXT_UNDERLINE }, - { 178, TEXT_UNDERLINE }, + { 199, TEXT_CENTER | C_RED }, + { 216, TEXT_UNDERLINE }, + { 217, TEXT_UNDERLINE }, + { 227, TEXT_UNDERLINE }, + { 244, TEXT_CENTER | C_RED }, LAST_STYLE_ITEM }; -/* orig 1135 comp 902 ratio 0.794714 level 3 saved 233 */ +/* orig 1672 comp 1186 ratio 0.70933 level 4 saved 486 */ const char help_text[] = { 0xff, 0x08, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x20, 0x34, 0x31, 0x3a, 0x20, 0x50, 0x61, 0x6c, 0x69, 0x73, 0x61, @@ -69,46 +70,74 @@ const char help_text[] = { 0x40, 0x70, 0x6c, 0x61, 0x63, 0x0e, 0x01, 0x01, 0x3b, 0x01, 0x67, 0x2e, 0x00, 0x52, 0x69, 0x67, 0x68, 0x1e, 0x00, 0xc1, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x60, -0x6e, 0x6f, 0x22, 0x00, 0xf1, 0x02, 0x27, 0x2e, 0x00, 0x41, +0x6e, 0x6f, 0x22, 0x00, 0x10, 0x27, 0x93, 0x00, 0xe1, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, -0x6c, 0x79, 0x2c, 0x36, 0x01, 0xf0, 0x07, 0x61, 0x72, 0x72, +0x6c, 0x79, 0x2c, 0x38, 0x01, 0xf0, 0x07, 0x61, 0x72, 0x72, 0x6f, 0x77, 0x00, 0x6b, 0x65, 0x79, 0x73, 0x00, 0x77, 0x69, 0x6c, 0x6c, 0x00, 0x6d, 0x6f, 0x76, 0x65, 0x00, 0x61, 0x11, -0x00, 0xf1, 0x02, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x00, 0x63, -0x75, 0x72, 0x73, 0x6f, 0x72, 0x2e, 0x00, 0x48, 0x6f, 0x6c, -0x96, 0x01, 0x12, 0x43, 0x8f, 0x00, 0x00, 0x6b, 0x02, 0x81, -0x6c, 0x65, 0x00, 0x70, 0x72, 0x65, 0x73, 0x73, 0xe8, 0x01, -0x16, 0x6e, 0x4a, 0x00, 0x02, 0x49, 0x00, 0x0b, 0x9e, 0x00, -0x10, 0x50, 0x2a, 0x00, 0x72, 0x00, 0x53, 0x68, 0x69, 0x66, -0x74, 0x2d, 0x2b, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x8d, 0x02, -0x97, 0x77, 0x69, 0x74, 0x63, 0x68, 0x00, 0x6f, 0x66, 0x66, -0xcb, 0x00, 0x51, 0x65, 0x70, 0x65, 0x61, 0x74, 0x55, 0x00, -0x02, 0x5e, 0x01, 0x00, 0xee, 0x00, 0xf0, 0x03, 0x65, 0x72, -0x66, 0x6f, 0x72, 0x6d, 0x00, 0x69, 0x74, 0x73, 0x00, 0x69, -0x6e, 0x76, 0x65, 0x72, 0x73, 0x65, 0x64, 0x01, 0x42, 0x28, -0x41, 0x6c, 0x6c, 0xc9, 0x00, 0x01, 0x2a, 0x00, 0xa0, 0x73, -0x00, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0xd4, -0x02, 0x23, 0x00, 0x73, 0x9e, 0x01, 0x40, 0x32, 0x2e, 0x31, -0x00, 0x9a, 0x02, 0xf2, 0x01, 0x61, 0x6c, 0x73, 0x6f, 0x00, -0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x2e, -0x29, 0x6e, 0x01, 0x16, 0x32, 0x6e, 0x01, 0x91, 0x70, 0x61, -0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x70, 0x01, 0x66, -0x54, 0x68, 0x65, 0x73, 0x65, 0x00, 0x14, 0x00, 0x02, 0x44, -0x00, 0x04, 0x3f, 0x00, 0x51, 0x00, 0x66, 0x72, 0x6f, 0x6d, -0x7c, 0x00, 0xe1, 0x60, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, -0x2e, 0x2e, 0x2e, 0x27, 0x00, 0x6f, 0x70, 0x72, 0x00, 0x22, -0x6f, 0x6e, 0x1a, 0x00, 0xa0, 0x54, 0x79, 0x70, 0x65, 0x27, -0x00, 0x6d, 0x65, 0x6e, 0x75, 0xae, 0x00, 0x90, 0x57, 0x69, -0x64, 0x74, 0x68, 0x2c, 0x00, 0x48, 0x65, 0xac, 0x01, 0x61, -0x00, 0x00, 0x00, 0x53, 0x69, 0x7a, 0xc0, 0x02, 0x03, 0x84, -0x03, 0x04, 0xd2, 0x03, 0x00, 0x2b, 0x00, 0x11, 0x52, 0x82, -0x03, 0x10, 0x20, 0x68, 0x03, 0x02, 0x8a, 0x00, 0x01, 0x73, -0x03, 0x04, 0xed, 0x02, 0x03, 0xa0, 0x03, 0x02, 0xb8, 0x03, -0x02, 0xf7, 0x03, 0x05, 0xcc, 0x03, 0x74, 0x6d, 0x75, 0x73, -0x74, 0x00, 0x62, 0x65, 0xe7, 0x03, 0x50, 0x64, 0x65, 0x64, -0x2e, 0x00, +0x00, 0xf1, 0x04, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x00, 0x63, +0x75, 0x72, 0x73, 0x6f, 0x72, 0x2e, 0x00, 0x44, 0x65, 0x70, +0x65, 0x6e, 0x9a, 0x01, 0x12, 0x6f, 0x8f, 0x01, 0x21, 0x60, +0x43, 0x1a, 0x00, 0xf3, 0x09, 0x00, 0x6d, 0x6f, 0x64, 0x65, +0x27, 0x00, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, +0x63, 0x65, 0x00, 0x28, 0x73, 0x65, 0x65, 0x00, 0x73, 0x19, +0x01, 0x52, 0x34, 0x31, 0x2e, 0x33, 0x29, 0x6a, 0x00, 0x02, +0x4a, 0x00, 0x02, 0x66, 0x00, 0xc0, 0x65, 0x69, 0x74, 0x68, +0x65, 0x72, 0x00, 0x6e, 0x61, 0x76, 0x69, 0x67, 0xa6, 0x00, +0x56, 0x61, 0x6d, 0x6f, 0x6e, 0x67, 0x90, 0x02, 0x05, 0xdb, +0x02, 0x53, 0x6f, 0x72, 0x00, 0x61, 0x6c, 0x1b, 0x00, 0x71, +0x69, 0x72, 0x00, 0x62, 0x6f, 0x72, 0x64, 0xd4, 0x02, 0x90, +0x49, 0x6e, 0x00, 0x60, 0x46, 0x75, 0x6c, 0x6c, 0x2d, 0x2f, +0x00, 0x11, 0x27, 0x84, 0x00, 0x82, 0x2c, 0x00, 0x68, 0x6f, +0x6c, 0x64, 0x00, 0x43, 0x31, 0x01, 0x00, 0x0d, 0x03, 0x20, +0x6c, 0x65, 0x97, 0x00, 0x21, 0x73, 0x73, 0x8a, 0x02, 0x16, +0x6e, 0xea, 0x00, 0x0d, 0x3e, 0x01, 0x11, 0x2c, 0x55, 0x02, +0x01, 0x2c, 0x00, 0x71, 0x00, 0x53, 0x68, 0x69, 0x66, 0x74, +0x2d, 0x2c, 0x00, 0x03, 0x2b, 0x00, 0xa6, 0x73, 0x77, 0x69, +0x74, 0x63, 0x68, 0x00, 0x6f, 0x66, 0x66, 0x6e, 0x01, 0x00, +0x80, 0x00, 0x68, 0x48, 0x61, 0x6c, 0x66, 0x2d, 0x00, 0x81, +0x00, 0x02, 0x42, 0x00, 0x5f, 0x45, 0x6e, 0x74, 0x65, 0x72, +0x64, 0x00, 0x04, 0x20, 0x53, 0x70, 0x13, 0x00, 0x0f, 0x55, +0x00, 0x07, 0x03, 0x18, 0x01, 0x02, 0x4f, 0x00, 0xe1, 0x79, +0x6f, 0x75, 0x00, 0x63, 0x61, 0x6e, 0x00, 0x72, 0x65, 0x70, +0x65, 0x61, 0x74, 0xc3, 0x00, 0x02, 0x55, 0x01, 0x00, 0x5c, +0x00, 0xf0, 0x03, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x00, +0x69, 0x74, 0x73, 0x00, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x73, +0x65, 0xe1, 0x01, 0x42, 0x28, 0x41, 0x6c, 0x6c, 0xd7, 0x01, +0x01, 0x2a, 0x00, 0xa0, 0x73, 0x00, 0x64, 0x65, 0x73, 0x63, +0x72, 0x69, 0x62, 0x65, 0xe4, 0x03, 0x05, 0x95, 0x01, 0x40, +0x32, 0x2e, 0x31, 0x00, 0xaa, 0x03, 0xf2, 0x01, 0x61, 0x6c, +0x73, 0x6f, 0x00, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, +0x6c, 0x65, 0x2e, 0x29, 0x7e, 0x02, 0x16, 0x32, 0x7e, 0x02, +0x91, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, +0x80, 0x02, 0x66, 0x54, 0x68, 0x65, 0x73, 0x65, 0x00, 0x14, +0x00, 0x02, 0x44, 0x00, 0x04, 0x3f, 0x00, 0x54, 0x00, 0x66, +0x72, 0x6f, 0x6d, 0x1a, 0x02, 0xb1, 0x73, 0x74, 0x6f, 0x6d, +0x2e, 0x2e, 0x2e, 0x27, 0x00, 0x6f, 0x70, 0x72, 0x00, 0x04, +0x34, 0x02, 0xa0, 0x54, 0x79, 0x70, 0x65, 0x27, 0x00, 0x6d, +0x65, 0x6e, 0x75, 0xae, 0x00, 0x90, 0x57, 0x69, 0x64, 0x74, +0x68, 0x2c, 0x00, 0x48, 0x65, 0xbc, 0x02, 0x61, 0x00, 0x00, +0x00, 0x53, 0x69, 0x7a, 0xd0, 0x03, 0x03, 0x94, 0x04, 0x04, +0x07, 0x02, 0x00, 0x2b, 0x00, 0x11, 0x52, 0x92, 0x04, 0x10, +0x20, 0x78, 0x04, 0x02, 0x8a, 0x00, 0x01, 0x83, 0x04, 0x04, +0xfd, 0x03, 0x03, 0xb0, 0x04, 0x02, 0xc8, 0x04, 0x02, 0x07, +0x05, 0x05, 0x4c, 0x02, 0x76, 0x6d, 0x75, 0x73, 0x74, 0x00, +0x62, 0x65, 0xf7, 0x04, 0x22, 0x64, 0x2e, 0xe8, 0x00, 0x16, +0x33, 0xe8, 0x00, 0x56, 0x75, 0x73, 0x65, 0x72, 0x20, 0xc3, +0x02, 0x01, 0xee, 0x00, 0x20, 0x4f, 0x6e, 0xc1, 0x01, 0x10, +0x74, 0x66, 0x01, 0x12, 0x73, 0xa9, 0x04, 0x80, 0x73, 0x75, +0x70, 0x70, 0x6f, 0x72, 0x74, 0x00, 0x2e, 0x00, 0x07, 0xf1, +0x02, 0x12, 0x73, 0xdf, 0x02, 0x26, 0x60, 0x50, 0x12, 0x00, +0x0d, 0xf8, 0x00, 0x33, 0x47, 0x61, 0x6d, 0xf8, 0x00, 0x02, +0x00, 0x03, 0x32, 0x6c, 0x65, 0x74, 0xdf, 0x01, 0x72, 0x6f, +0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x8c, 0x05, 0x84, 0x62, +0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0xd7, 0x00, 0x03, +0x32, 0x03, 0x01, 0x9d, 0x03, 0x2f, 0x74, 0x6f, 0x35, 0x03, +0x04, 0x4f, 0x66, 0x75, 0x6c, 0x6c, 0x36, 0x03, 0x08, 0x04, +0x34, 0x03, 0x08, 0x28, 0x05, 0xa0, 0x00, 0x73, 0x71, 0x75, +0x61, 0x72, 0x65, 0x73, 0x2e, 0x00, }; -const unsigned short help_text_len = 1135; -const unsigned short help_text_words = 193; +const unsigned short help_text_len = 1672; +const unsigned short help_text_words = 285; const char quick_help_text[] = "Divide the grid into equal-sized areas in accordance with the clues."; diff --git a/apps/plugins/puzzles/help/pattern.c b/apps/plugins/puzzles/help/pattern.c index b5775f32ed..3b83378bb5 100644 --- a/apps/plugins/puzzles/help/pattern.c +++ b/apps/plugins/puzzles/help/pattern.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/pearl.c b/apps/plugins/puzzles/help/pearl.c index b8f32ce3b8..2fa7ed9f14 100644 --- a/apps/plugins/puzzles/help/pearl.c +++ b/apps/plugins/puzzles/help/pearl.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/pegs.c b/apps/plugins/puzzles/help/pegs.c index b7159ffc5c..beb9dccca7 100644 --- a/apps/plugins/puzzles/help/pegs.c +++ b/apps/plugins/puzzles/help/pegs.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/range.c b/apps/plugins/puzzles/help/range.c index 5a9e3ab71d..379ad7a4f9 100644 --- a/apps/plugins/puzzles/help/range.c +++ b/apps/plugins/puzzles/help/range.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/rect.c b/apps/plugins/puzzles/help/rect.c index c608c4fc98..32205f0a9e 100644 --- a/apps/plugins/puzzles/help/rect.c +++ b/apps/plugins/puzzles/help/rect.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/samegame.c b/apps/plugins/puzzles/help/samegame.c index 87f7b2b3b9..8194a09227 100644 --- a/apps/plugins/puzzles/help/samegame.c +++ b/apps/plugins/puzzles/help/samegame.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/signpost.c b/apps/plugins/puzzles/help/signpost.c index e38e42870c..b7accfbada 100644 --- a/apps/plugins/puzzles/help/signpost.c +++ b/apps/plugins/puzzles/help/signpost.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/singles.c b/apps/plugins/puzzles/help/singles.c index f2bd1ae4d9..6d9559c095 100644 --- a/apps/plugins/puzzles/help/singles.c +++ b/apps/plugins/puzzles/help/singles.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/sixteen.c b/apps/plugins/puzzles/help/sixteen.c index 164be4ee4e..3c636677fb 100644 --- a/apps/plugins/puzzles/help/sixteen.c +++ b/apps/plugins/puzzles/help/sixteen.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/slant.c b/apps/plugins/puzzles/help/slant.c index 1a8168fb3b..a4e2fcb630 100644 --- a/apps/plugins/puzzles/help/slant.c +++ b/apps/plugins/puzzles/help/slant.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/solo.c b/apps/plugins/puzzles/help/solo.c index ceb05fa70e..ef09bf0afd 100644 --- a/apps/plugins/puzzles/help/solo.c +++ b/apps/plugins/puzzles/help/solo.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/tents.c b/apps/plugins/puzzles/help/tents.c index 11eeaef435..9b23b73fd2 100644 --- a/apps/plugins/puzzles/help/tents.c +++ b/apps/plugins/puzzles/help/tents.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/towers.c b/apps/plugins/puzzles/help/towers.c index b41fb7a432..c6a3aad003 100644 --- a/apps/plugins/puzzles/help/towers.c +++ b/apps/plugins/puzzles/help/towers.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/tracks.c b/apps/plugins/puzzles/help/tracks.c index fae974619a..fdc3f40e22 100644 --- a/apps/plugins/puzzles/help/tracks.c +++ b/apps/plugins/puzzles/help/tracks.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/twiddle.c b/apps/plugins/puzzles/help/twiddle.c index 1a989237b0..b34ff3b832 100644 --- a/apps/plugins/puzzles/help/twiddle.c +++ b/apps/plugins/puzzles/help/twiddle.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/undead.c b/apps/plugins/puzzles/help/undead.c index 2ad886cd0d..3c33147a66 100644 --- a/apps/plugins/puzzles/help/undead.c +++ b/apps/plugins/puzzles/help/undead.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/unequal.c b/apps/plugins/puzzles/help/unequal.c index 445fd7d544..342b0dc0aa 100644 --- a/apps/plugins/puzzles/help/unequal.c +++ b/apps/plugins/puzzles/help/unequal.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/unruly.c b/apps/plugins/puzzles/help/unruly.c index 39249c5949..627ffcc329 100644 --- a/apps/plugins/puzzles/help/unruly.c +++ b/apps/plugins/puzzles/help/unruly.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/help/untangle.c b/apps/plugins/puzzles/help/untangle.c index 64ebdfb364..9beb2a545f 100644 --- a/apps/plugins/puzzles/help/untangle.c +++ b/apps/plugins/puzzles/help/untangle.c @@ -1,4 +1,4 @@ -/* auto-generated on Jul 22 2024 by genhelp.sh */ +/* auto-generated on Jul 23 2024 by genhelp.sh */ /* help text is compressed using LZ4; see compress.c for details */ /* DO NOT EDIT! */ diff --git a/apps/plugins/puzzles/src/inertia.c b/apps/plugins/puzzles/src/inertia.c index d120411f55..1d5a028add 100644 --- a/apps/plugins/puzzles/src/inertia.c +++ b/apps/plugins/puzzles/src/inertia.c @@ -1886,6 +1886,11 @@ static void draw_player(drawing *dr, game_drawstate *ds, int x, int y, coords[d*4+2] = x + TILESIZE/2 + (int)((TILESIZE*3/7) * x2); coords[d*4+3] = y + TILESIZE/2 + (int)((TILESIZE*3/7) * y2); } + /* rockbox hack */ + int tmp[2] = { coords[0], coords[1] }; + memmove(coords, coords + 2, sizeof(int) * DIRECTIONS * 4 - 2); + memcpy(coords + DIRECTIONS * 4 - 2, tmp, 2 * sizeof(int)); + draw_polygon(dr, coords, DIRECTIONS*2, COL_DEAD_PLAYER, COL_OUTLINE); } else { draw_circle(dr, x + TILESIZE/2, y + TILESIZE/2, @@ -1901,8 +1906,6 @@ static void draw_player(drawing *dr, game_drawstate *ds, int x, int y, int coords[14], *c; c = coords; - *c++ = ox + px/9; - *c++ = oy + py/9; *c++ = ox + px/9 + ax*2/3; *c++ = oy + py/9 + ay*2/3; *c++ = ox + px/3 + ax*2/3; @@ -1915,6 +1918,8 @@ static void draw_player(drawing *dr, game_drawstate *ds, int x, int y, *c++ = oy - py/9 + ay*2/3; *c++ = ox - px/9; *c++ = oy - py/9; + *c++ = ox + px/9; + *c++ = oy + py/9; draw_polygon(dr, coords, 7, COL_HINT, COL_OUTLINE); } diff --git a/apps/plugins/puzzles/src/mines.c b/apps/plugins/puzzles/src/mines.c index e1441fae13..eec898ac6f 100644 --- a/apps/plugins/puzzles/src/mines.c +++ b/apps/plugins/puzzles/src/mines.c @@ -2867,12 +2867,12 @@ static void draw_tile(drawing *dr, game_drawstate *ds, coords[(n)*2+0] = x + (int)(TILE_SIZE * (dx)); \ coords[(n)*2+1] = y + (int)(TILE_SIZE * (dy)); \ } while (0) - SETCOORD(0, 0.6F, 0.35F); - SETCOORD(1, 0.6F, 0.7F); - SETCOORD(2, 0.8F, 0.8F); - SETCOORD(3, 0.25F, 0.8F); - SETCOORD(4, 0.55F, 0.7F); - SETCOORD(5, 0.55F, 0.35F); + SETCOORD(0, 0.6F, 0.7F); + SETCOORD(1, 0.8F, 0.8F); + SETCOORD(2, 0.25F, 0.8F); + SETCOORD(3, 0.55F, 0.7F); + SETCOORD(4, 0.55F, 0.35F); + SETCOORD(5, 0.6F, 0.35F); draw_polygon(dr, coords, 6, COL_FLAGBASE, COL_FLAGBASE); SETCOORD(0, 0.6F, 0.2F); diff --git a/apps/plugins/puzzles/src/palisade.c b/apps/plugins/puzzles/src/palisade.c index 811204b1fe..ecbbbb4d6f 100644 --- a/apps/plugins/puzzles/src/palisade.c +++ b/apps/plugins/puzzles/src/palisade.c @@ -868,18 +868,48 @@ static char *game_text_format(const game_state *state) } struct game_ui { + /* These are half-grid coordinates - (0,0) is the top left corner + * of the top left square; (1,1) is the center of the top left + * grid square. */ int x, y; bool show; + + bool legacy_cursor; }; static game_ui *new_ui(const game_state *state) { game_ui *ui = snew(game_ui); - ui->x = ui->y = 0; + ui->x = ui->y = 1; ui->show = getenv_bool("PUZZLES_SHOW_CURSOR", false); + ui->legacy_cursor = false; return ui; } +static config_item *get_prefs(game_ui *ui) +{ + config_item *cfg; + + cfg = snewn(2, config_item); + + cfg[0].name = "Cursor mode"; + cfg[0].kw = "cursor-mode"; + cfg[0].type = C_CHOICES; + cfg[0].u.choices.choicenames = ":Half-grid:Full-grid"; + cfg[0].u.choices.choicekws = ":half:full"; + cfg[0].u.choices.selected = ui->legacy_cursor; + + cfg[1].name = NULL; + cfg[1].type = C_END; + + return cfg; +} + +static void set_prefs(game_ui *ui, const config_item *cfg) +{ + ui->legacy_cursor = cfg[0].u.choices.selected; +} + static void free_ui(game_ui *ui) { sfree(ui); @@ -890,7 +920,7 @@ static void game_changed_state(game_ui *ui, const game_state *oldstate, { } -typedef unsigned short dsflags; +typedef int dsflags; struct game_drawstate { int tilesize; @@ -921,9 +951,6 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (OUT_OF_BOUNDS(gx, gy, w, h)) return NULL; - ui->x = gx; - ui->y = gy; - /* find edge closest to click point */ possible &=~ (2*px < TILESIZE ? BORDER_R : BORDER_L); possible &=~ (2*py < TILESIZE ? BORDER_D : BORDER_U); @@ -934,6 +961,9 @@ static char *interpret_move(const game_state *state, game_ui *ui, for (dir = 0; dir < 4 && BORDER(dir) != possible; ++dir); if (dir == 4) return NULL; /* there's not exactly one such edge */ + ui->x = min(max(2*gx + 1 + dx[dir], 1), 2*w-1); + ui->y = min(max(2*gy + 1 + dy[dir], 1), 2*h-1); + hx = gx + dx[dir]; hy = gy + dy[dir]; @@ -963,17 +993,17 @@ static char *interpret_move(const game_state *state, game_ui *ui, } if (IS_CURSOR_MOVE(button)) { - if (control || shift) { + if(ui->legacy_cursor && (control || shift)) { borderflag flag = 0, newflag; - int dir, i = ui->y * w + ui->x; + int dir, i = (ui->y/2) * w + (ui->x/2); ui->show = true; - x = ui->x; - y = ui->y; + x = ui->x/2; + y = ui->y/2; move_cursor(button, &x, &y, w, h, false, NULL); if (OUT_OF_BOUNDS(x, y, w, h)) return NULL; for (dir = 0; dir < 4; ++dir) - if (dx[dir] == x - ui->x && dy[dir] == y - ui->y) break; + if (dx[dir] == x - ui->x/2 && dy[dir] == y - ui->y/2) break; if (dir == 4) return NULL; /* how the ... ?! */ if (control) flag |= BORDER(dir); @@ -987,9 +1017,67 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (control) newflag |= BORDER(FLIP(dir)); if (shift) newflag |= DISABLED(BORDER(FLIP(dir))); return string(80, "F%d,%d,%dF%d,%d,%d", - ui->x, ui->y, flag, x, y, newflag); - } else - return move_cursor(button, &ui->x, &ui->y, w, h, false, &ui->show); + ui->x/2, ui->y/2, flag, x, y, newflag); + } else { + /* TODO: Refactor this and other half-grid cursor games + * (Tracks, etc.) */ + int dx = (button == CURSOR_LEFT) ? -1 : ((button == CURSOR_RIGHT) ? +1 : 0); + int dy = (button == CURSOR_DOWN) ? +1 : ((button == CURSOR_UP) ? -1 : 0); + + if(ui->legacy_cursor) { + dx *= 2; dy *= 2; + + ui->x |= 1; + ui->y |= 1; + } + + if (!ui->show) { + ui->show = true; + } + + ui->x = min(max(ui->x + dx, 1), 2*w-1); + ui->y = min(max(ui->y + dy, 1), 2*h-1); + + return MOVE_UI_UPDATE; + } + } else if (IS_CURSOR_SELECT(button)) { + int px = ui->x % 2, py = ui->y % 2; + int gx = ui->x / 2, gy = ui->y / 2; + int dir = (px == 0) ? 3 : 0; /* left = 3; up = 0 */ + int hx = gx + dx[dir]; + int hy = gy + dy[dir]; + + int i = gy * w + gx; + + if(!ui->show) { + ui->show = true; + return MOVE_UI_UPDATE; + } + + /* clicks on square corners and centers do nothing */ + if (px == py) + return MOVE_NO_EFFECT; + + /* TODO: Refactor this and the mouse click handling code + * above. */ + switch ((button == CURSOR_SELECT2) | + ((state->borders[i] & BORDER(dir)) >> dir << 1) | + ((state->borders[i] & DISABLED(BORDER(dir))) >> dir >> 2)) { + + case MAYBE_LEFT: + case ON_LEFT: + case ON_RIGHT: + return string(80, "F%d,%d,%dF%d,%d,%d", + gx, gy, BORDER(dir), + hx, hy, BORDER(FLIP(dir))); + + case MAYBE_RIGHT: + case OFF_LEFT: + case OFF_RIGHT: + return string(80, "F%d,%d,%dF%d,%d,%d", + gx, gy, DISABLED(BORDER(dir)), + hx, hy, DISABLED(BORDER(FLIP(dir)))); + } } return NULL; @@ -1098,7 +1186,7 @@ static float *game_colours(frontend *fe, int *ncolours) #define F_ERROR_L BORDER_ERROR(BORDER_L) /* BIT(11) */ #define F_ERROR_CLUE BIT(12) #define F_FLASH BIT(13) -#define F_CURSOR BIT(14) +#define CONTAINS_CURSOR(x) ((x) << 14) static game_drawstate *game_new_drawstate(drawing *dr, const game_state *state) { @@ -1132,9 +1220,6 @@ static void draw_tile(drawing *dr, game_drawstate *ds, int r, int c, draw_rect(dr, x + WIDTH, y + WIDTH, TILESIZE - WIDTH, TILESIZE - WIDTH, (flags & F_FLASH ? COL_FLASH : COL_BACKGROUND)); - if (flags & F_CURSOR) - draw_rect_corners(dr, x + CENTER, y + CENTER, TILESIZE / 3, COL_GRID); - if (clue != EMPTY) { char buf[2]; buf[0] = '0' + clue; @@ -1158,6 +1243,47 @@ static void draw_tile(drawing *dr, game_drawstate *ds, int r, int c, draw_update(dr, x, y, TILESIZE + WIDTH, TILESIZE + WIDTH); } +static void draw_cursor(drawing *dr, game_drawstate *ds, + int cur_x, int cur_y, bool legacy_cursor) +{ + int off_x = cur_x % 2, off_y = cur_y % 2; + + /* Figure out the tile coordinates corresponding to these cursor + * coordinates. */ + int x = MARGIN + TILESIZE * (cur_x / 2), y = MARGIN + TILESIZE * (cur_y / 2); + + /* off_x and off_y are either 0 or 1. The possible cases are + * therefore: + * + * (0, 0): the cursor is in the top left corner of the tile. + * (0, 1): the cursor is on the left border of the tile. + * (1, 0): the cursor is on the top border of the tile. + * (1, 1): the cursor is in the center of the tile. + */ + enum { TOP_LEFT_CORNER, LEFT_BORDER, TOP_BORDER, TILE_CENTER } cur_type = (off_x << 1) + off_y; + + int center_x = x + ((off_x == 0) ? WIDTH/2 : CENTER), + center_y = y + ((off_y == 0) ? WIDTH/2 : CENTER); + + struct { int w, h; } cursor_dimensions[] = { + { TILESIZE / 3, TILESIZE / 3 }, /* top left corner */ + { TILESIZE / 3, 2 * TILESIZE / 3}, /* left border */ + { 2 * TILESIZE / 3, TILESIZE / 3}, /* top border */ + { 2 * TILESIZE / 3, 2 * TILESIZE / 3 } /* center */ + }, *dims = cursor_dimensions + cur_type; + + if(legacy_cursor && cur_type == TILE_CENTER) + draw_rect_corners(dr, center_x, center_y, TILESIZE / 3, COL_GRID); + else + draw_rect_outline(dr, + center_x - dims->w / 2, center_y - dims->h / 2, + dims->w, dims->h, COL_GRID); + + draw_update(dr, + center_x - dims->w / 2, center_y - dims->h / 2, + dims->w, dims->h); +} + #define FLASH_TIME 0.7F static void game_redraw(drawing *dr, game_drawstate *ds, @@ -1203,8 +1329,13 @@ static void game_redraw(drawing *dr, game_drawstate *ds, if (clue != EMPTY && (on > clue || clue > 4 - off)) flags |= F_ERROR_CLUE; - if (ui->show && ui->x == c && ui->y == r) - flags |= F_CURSOR; + if (ui->show) { + int u, v; + for(u = 0; u < 3; u++) + for(v = 0; v < 3; v++) + if(ui->x == 2*c+u && ui->y == 2*r+v) + flags |= CONTAINS_CURSOR(BIT(3*u+v)); + } /* border errors */ for (dir = 0; dir < 4; ++dir) { @@ -1248,6 +1379,9 @@ static void game_redraw(drawing *dr, game_drawstate *ds, draw_tile(dr, ds, r, c, ds->grid[i], clue); } + if (ui->show) + draw_cursor(dr, ds, ui->x, ui->y, ui->legacy_cursor); + dsf_free(black_border_dsf); dsf_free(yellow_border_dsf); } @@ -1375,7 +1509,7 @@ const struct game thegame = { free_game, true, solve_game, true, game_can_format_as_text_now, game_text_format, - NULL, NULL, /* get_prefs, set_prefs */ + get_prefs, set_prefs, /* get_prefs, set_prefs */ new_ui, free_ui, NULL, /* encode_ui */ diff --git a/apps/plugins/puzzles/src/puzzles.but b/apps/plugins/puzzles/src/puzzles.but index fb94155eed..fa9384252e 100644 --- a/apps/plugins/puzzles/src/puzzles.but +++ b/apps/plugins/puzzles/src/puzzles.but @@ -3519,10 +3519,15 @@ Palisade was contributed to this collection by Jonas K\u00F6{oe}lker. \H{palisade-controls} \I{controls, for Palisade}Palisade controls Left-click to place an edge. Right-click to indicate \q{no edge}. -Alternatively, the arrow keys will move a keyboard cursor. Holding -Control while pressing an arrow key will place an edge. Press -Shift-arrowkey to switch off an edge. Repeat an action to perform -its inverse. + +Alternatively, the arrow keys will move a keyboard cursor. Depending +on the \q{Cursor mode} preference (see \k{palisade-prefs}), the cursor +will either navigate among the grid squares, or along their +borders. In \q{Full-grid} mode, hold Control while pressing an arrow +key to place an edge, and press Shift-arrowkey to switch off an +edge. In \q{Half-grid} mode, press Enter to place an edge, and Space +to switch off an edge. In either mode, you can repeat an action to +perform its inverse. (All the actions described in \k{common-actions} are also available.) @@ -3539,6 +3544,13 @@ These parameters are available from the \q{Custom...} option on the \dd The size of the regions into which the grid must be subdivided. +\H{palisade-prefs} \I{preferences, for Palisade}Palisade user preferences + +On platforms that support user preferences, the \q{Preferences} option +on the \q{Game} menu will let you configure the behavior of the cursor +keys to either navigate among full grid squares, or along the borders +of the grid squares. + \C{mosaic} \i{Mosaic} \cfg{winhelp-topic}{games.mosaic} diff --git a/apps/plugins/puzzles/src/signpost.c b/apps/plugins/puzzles/src/signpost.c index 9aed67bb4a..4d2f5849fd 100644 --- a/apps/plugins/puzzles/src/signpost.c +++ b/apps/plugins/puzzles/src/signpost.c @@ -1895,8 +1895,9 @@ static void draw_star(drawing *dr, int cx, int cy, int rad, int npoints, coords = snewn(npoints * 2 * 2, int); for (n = 0; n < npoints * 2; n++) { - a = 2.0 * PI * ((double)n / ((double)npoints * 2.0)) + angle_offset; - r = (n % 2) ? (double)rad/2.0 : (double)rad; + /* hack to accomodate rockbox's concave polygon drawing */ + a = 2.0 * PI * ((double)n / ((double)npoints * 2.0)) + angle_offset - PI / npoints; + r = (n % 2 == 0) ? (double)rad/2.0 : (double)rad; /* We're rotating the point at (0, -r) by a degrees */ coords[2*n+0] = cx + (int)( r * sin(a)); diff --git a/apps/plugins/puzzles/src/unequal.c b/apps/plugins/puzzles/src/unequal.c index ab32e4ab79..008dab3a0b 100644 --- a/apps/plugins/puzzles/src/unequal.c +++ b/apps/plugins/puzzles/src/unequal.c @@ -1844,18 +1844,18 @@ static void draw_gt(drawing *dr, int ox, int oy, { int coords[12]; int xdx = (dx1+dx2 ? 0 : 1), xdy = (dx1+dx2 ? 1 : 0); - coords[0] = ox + xdx; - coords[1] = oy + xdy; - coords[2] = ox + xdx + dx1; - coords[3] = oy + xdy + dy1; - coords[4] = ox + xdx + dx1 + dx2; - coords[5] = oy + xdy + dy1 + dy2; - coords[6] = ox - xdx + dx1 + dx2; - coords[7] = oy - xdy + dy1 + dy2; - coords[8] = ox - xdx + dx1; - coords[9] = oy - xdy + dy1; - coords[10] = ox - xdx; - coords[11] = oy - xdy; + coords[0] = ox + xdx + dx1; + coords[1] = oy + xdy + dy1; + coords[2] = ox + xdx + dx1 + dx2; + coords[3] = oy + xdy + dy1 + dy2; + coords[4] = ox - xdx + dx1 + dx2; + coords[5] = oy - xdy + dy1 + dy2; + coords[6] = ox - xdx + dx1; + coords[7] = oy - xdy + dy1; + coords[8] = ox - xdx; + coords[9] = oy - xdy; + coords[10] = ox + xdx; + coords[11] = oy + xdy; draw_polygon(dr, coords, 6, col, col); } -- cgit v1.2.3