Package: sgt-puzzles
Version: 8605-2
Severity: wishlist
Tags: patch

Recently a change was made to slant that provides shading of filled squares.
However I find that the resulting checkerboard pattern of filled and
non-filled squares is distracting, preventing me from easily seeing the
bigger structures and making it harder to determine a next move.

Therefore I would like to suggest to apply one of the two attached patches.
The first and simplest one adds an environment variable to override the game
default and disable shading of filled squares. The second is a bit more
advanced and also allows runtime toggling of the shading by clicking the
middle mouse button or pressing the S or F key.


Arjan

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.27.21 (PREEMPT)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages sgt-puzzles depends on:
ii  libatk1.0-0                   1.28.0-1   The ATK accessibility toolkit
ii  libc6                         2.9-27     GNU C Library: Shared libraries
ii  libcairo2                     1.8.8-2    The Cairo 2D vector graphics libra
ii  libfontconfig1                2.6.0-4    generic font configuration library
ii  libfreetype6                  2.3.9-5    FreeType 2 font engine, shared lib
ii  libglib2.0-0                  2.22.1-1   The GLib library of C routines
ii  libgtk2.0-0                   2.18.2-1   The GTK+ graphical user interface 
ii  libpango1.0-0                 1.26.0-1   Layout and rendering of internatio

Versions of packages sgt-puzzles recommends:
ii  epiphany-browser [www-br 2.28.0-4        Intuitive GNOME web browser
ii  iceweasel [www-browser]  3.5.2-1         lightweight web browser based on M
ii  links2 [www-browser]     2.2-1+b1        Web browser running in both graphi
ii  lynx-cur [www-browser]   2.8.8dev.1-1    Text-mode WWW Browser with NLS sup
ii  w3m [www-browser]        0.5.2-2.1       WWW browsable pager with excellent
ii  yelp                     2.28.0+webkit-1 Help browser for GNOME

sgt-puzzles suggests no packages.

-- no debconf information
--- sgt-puzzles-8605.ORIG/slant.c	2009-10-09 04:45:36.000000000 +0200
+++ sgt-puzzles-8605.ENV/slant.c	2009-10-09 05:01:19.000000000 +0200
@@ -1884,13 +1884,19 @@ static void draw_tile(drawing *dr, game_
     int chesscolour = (x ^ y) & 1;
     int fscol = chesscolour ? COL_SLANT2 : COL_SLANT1;
     int bscol = chesscolour ? COL_SLANT1 : COL_SLANT2;
+    static int shade_filled = -1;
+
+    if (shade_filled < 0) {
+        char *env = getenv("SLANT_SHADE_FILLED");
+        shade_filled = (!env || (env[0] == 'y' || env[0] == 'Y'));
+    }
 
     clip(dr, COORD(x), COORD(y), TILESIZE, TILESIZE);
 
     draw_rect(dr, COORD(x), COORD(y), TILESIZE, TILESIZE,
 	      (v & FLASH) ? COL_GRID :
               (v & CURSOR) ? COL_CURSOR :
-	      (v & (BACKSLASH | FORWSLASH)) ? COL_LOWLIGHT :
+	      (shade_filled && (v & (BACKSLASH | FORWSLASH))) ? COL_LOWLIGHT :
 	      COL_BACKGROUND);
 
     /*
--- sgt-puzzles-8605.ORIG/slant.c	2009-10-09 04:45:36.000000000 +0200
+++ sgt-puzzles-8605.TOGGLE/slant.c	2009-10-09 05:05:28.000000000 +0200
@@ -1597,12 +1597,15 @@ static char *game_text_format(game_state
 
 struct game_ui {
     int cur_x, cur_y, cur_visible;
+    int shade_filled;
 };
 
 static game_ui *new_ui(game_state *state)
 {
     game_ui *ui = snew(game_ui);
+    char *env = getenv("SLANT_SHADE_FILLED");
     ui->cur_x = ui->cur_y = ui->cur_visible = 0;
+    ui->shade_filled = (!env || (env[0] == 'y' || env[0] == 'Y'));
     return ui;
 }
 
@@ -1657,6 +1660,7 @@ static void game_changed_state(game_ui *
 #define ERR_BL    0x00010000L
 #define ERR_BR    0x00020000L
 #define CURSOR    0x00040000L
+#define SHADEFILL 0x00080000L
 
 struct game_drawstate {
     int tilesize;
@@ -1702,6 +1706,10 @@ static char *interpret_move(game_state *
         y = FROMCOORD(y);
         if (x < 0 || y < 0 || x >= w || y >= h)
             return NULL;
+    } else if (button == MIDDLE_BUTTON || button == 'f' || button == 'F' ||
+               button == 's' || button == 'S') {
+        ui->shade_filled = !ui->shade_filled;
+        return "";
     } else if (IS_CURSOR_SELECT(button)) {
         if (!ui->cur_visible) {
             ui->cur_visible = 1;
@@ -1890,7 +1898,7 @@ static void draw_tile(drawing *dr, game_
     draw_rect(dr, COORD(x), COORD(y), TILESIZE, TILESIZE,
 	      (v & FLASH) ? COL_GRID :
               (v & CURSOR) ? COL_CURSOR :
-	      (v & (BACKSLASH | FORWSLASH)) ? COL_LOWLIGHT :
+	      (v & SHADEFILL) ? COL_LOWLIGHT :
 	      COL_BACKGROUND);
 
     /*
@@ -2012,6 +2020,8 @@ static void game_redraw(drawing *dr, gam
                 ds->todraw[(y+2)*(w+2)+(x+1)] |= T_R;
                 ds->todraw[(y+1)*(w+2)+(x+2)] |= L_B;
                 ds->todraw[(y+2)*(w+2)+(x+2)] |= C_TL;
+                if (ui->shade_filled)
+                    ds->todraw[(y+1)*(w+2)+(x+1)] |= SHADEFILL;
                 if (err) {
                     ds->todraw[(y+1)*(w+2)+(x+1)] |= ERRSLASH | 
 			ERR_T_L | ERR_L_T | ERR_C_TL;
@@ -2023,6 +2033,8 @@ static void game_redraw(drawing *dr, gam
 		ds->todraw[(y+1)*(w+2)+(x+1)] |= FORWSLASH;
                 ds->todraw[(y+1)*(w+2)+(x+2)] |= L_T | C_TL;
                 ds->todraw[(y+2)*(w+2)+(x+1)] |= T_L | C_TL;
+                if (ui->shade_filled)
+                    ds->todraw[(y+1)*(w+2)+(x+1)] |= SHADEFILL;
                 if (err) {
                     ds->todraw[(y+1)*(w+2)+(x+1)] |= ERRSLASH |
 			ERR_L_B | ERR_T_R;

Reply via email to