ref: 3e6431b3a15aa0c8a51f308eb96e920030e19a35
parent: 3376563bf1bead13cf8703bfe354661d6b1940ca
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sat Jul 11 11:58:18 EDT 2020
add -b to run in black and white mode
--- a/cflood.c
+++ b/cflood.c
@@ -32,13 +32,13 @@
25, 35, 50, 1
};
-static const ulong srccolors[NumColors] = {
- 0x6060a8ff,
- 0xf6f61dff,
- 0x46b0e0ff,
- 0x7ea020ff,
- 0xf070a0ff,
- 0xdc4a20ff
+static const ulong srccolors[NumColors][2] = {
+ {0x6060a8ff, 0x000000ff},
+ {0xf6f61dff, 0x303030ff},
+ {0x46b0e0ff, 0x606060ff},
+ {0x7ea020ff, 0x909090ff},
+ {0xf070a0ff, 0xc0c0c0ff},
+ {0xdc4a20ff, 0xf0f0f0ff},
};
static char *mstr[] = {
@@ -239,7 +239,7 @@
static void
usage(void)
{
- fprint(2, "usage: cflood [-s size] [-t turns]\n");
+ fprint(2, "usage: cflood [-b] [-s size] [-t turns]\n");
exits("usage");
}
@@ -246,7 +246,7 @@
void
main(int argc, char** argv)
{
- int key, p, i, oldbuttons, sidmax;
+ int key, p, i, oldbuttons, sidmax, bw;
Event e;
Mouse m;
Menu menu;
@@ -253,6 +253,7 @@
Rectangle r;
sid = Ssmall;
+ bw = 0;
ARGBEGIN{
case 's':
sid = Scustom;
@@ -266,6 +267,9 @@
if(turns[sid] < 1)
usage();
break;
+ case 'b':
+ bw = 1;
+ break;
default:
usage();
}ARGEND
@@ -275,7 +279,7 @@
r = Rect(0, 0, 1, 1);
for(i = 0; i < NumColors; i++)
- colors[i] = allocimage(display, r, CMAP8, 1, srccolors[i]);
+ colors[i] = allocimage(display, r, RGB24, 1, srccolors[i][bw]);
colora = display->white;
colorb = display->black;
--- a/cflood.man
+++ b/cflood.man
@@ -4,6 +4,9 @@
.SH SYNOPSIS
.B cflood
[
+.I -b
+]
+[
.I -s size
]
[
@@ -24,6 +27,10 @@
.B -t
option sets the number of
.IR turns .
+.PP
+With
+.B -b
+the game runs in black and white mode.
.EE
.PP
There are three predefined area sizes in the game menu (invoked by button 3).