commit 2e032d404070bcc82a37fed6665426f1846bce43 from: Benjamin Stürz date: Fri Mar 01 21:13:41 2024 UTC add -f option commit - 051431c4e9b8488f906aa8b8cb3678e2b77b5816 commit + 2e032d404070bcc82a37fed6665426f1846bce43 blob - 32915f8c0967c763bc933458a6506bb68b5114fe blob + 71906cc9bb1ebd91dab69e980ce8e4e78bf08bf7 --- tetris.6 +++ tetris.6 @@ -80,6 +80,9 @@ By default, shapes are displayed colorfully if the use The .Fl b option can be used to restore the traditional black-and-white behavior. +.It Fl f +By default, the fallrate is staying constant. +With this option, the fallrate increases over time. .It Fl k The default control keys can be changed using the .Fl k blob - fee0535bfb821ec42575c8fd6fe686d93f9c2f06 blob + 2a002e3a1dd99814ffc2607abb11c2d3918b2c9d --- tetris.c +++ tetris.c @@ -75,6 +75,7 @@ gid_t gid, egid; char key_msg[100]; int showpreview; int nocolor; +int dofaster; static void elide(void); static void setup_board(void); @@ -150,11 +151,14 @@ main(int argc, char *argv[]) keys = "jkl pqn"; - while ((ch = getopt(argc, argv, "bk:l:ps")) != -1) + while ((ch = getopt(argc, argv, "bfk:l:ps")) != -1) switch(ch) { case 'b': nocolor = 1; break; + case 'f': + dofaster = 1; + break; case 'k': if (strlen(keys = optarg) != NUMKEYS) usage(); blob - 8e1479f198ca603125efb9302fa1a323c2fec7af blob + d00f79db4bbe1a8f0f3d8c15a8574716e38048a4 --- tetris.h +++ tetris.h @@ -145,7 +145,8 @@ extern const struct shape *nextshape; * but by then the game is utterly impossible. */ extern long fallrate; /* less than 1 million; smaller => faster */ -#define faster() (fallrate -= fallrate / 3000) +extern int dofaster; /* if 1, accelerate shapes */ +#define faster() (dofaster ? (fallrate -= fallrate / 3000) : fallrate) /* * Game level must be between 1 and 9. This controls the initial fall rate