From ec797c133bd83404f6167fb46c098c236333d168 Mon Sep 17 00:00:00 2001 From: Mark Weaver Date: Sat, 10 Feb 1996 10:41:39 +0000 Subject: [PATCH] netris version 0.4 --- Configure | 8 ++-- FAQ | 43 ++++++++++++------ README | 83 +++++++++++++++++++++++++--------- VERSION | 2 +- board.c | 10 +++-- curses.c | 101 ++++++++++++++++++++++++++++++++++++++--- game.c | 72 +++++++++++++++++++++++------- inet.c | 10 +++-- netris.h | 12 +++-- robot.c | 10 +++-- robot_desc | 5 ++- shapes.c | 10 +++-- sr.c | 8 +++- util.c | 129 ++++++++++++++++++++++++++++------------------------- 14 files changed, 362 insertions(+), 141 deletions(-) diff --git a/Configure b/Configure index 2543665..7fe293e 100755 --- a/Configure +++ b/Configure @@ -1,7 +1,7 @@ : # -# Netris -- A free networked version of Tetris -# Copyright (C) 1994,1995 Mark Weaver +# Netris -- A free networked version of T*tris +# Copyright (C) 1994,1995,1996 Mark H. Weaver # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -17,7 +17,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -# $Id: Configure,v 1.16 1995/07/11 08:55:42 mhw Exp $ +# $Id: Configure,v 1.17 1996/02/09 08:22:03 mhw Exp $ # CC="gcc" @@ -255,3 +255,5 @@ cat << END Now do a 'make' END + +# vi: ts=4 ai diff --git a/FAQ b/FAQ index 9dd0519..18a203c 100644 --- a/FAQ +++ b/FAQ @@ -2,11 +2,11 @@ # Netris # Frequently asked questions # -# $Id: FAQ,v 1.1 1995/07/11 07:50:43 mhw Exp $ +# $Id: FAQ,v 1.3 1996/02/09 08:47:23 mhw Exp $ # -Contents -======== +Questions +========= [1] Where can I find the latest version? [2] The pieces look bizarre in my xterm window, and don't erase properly. What's up? @@ -17,22 +17,21 @@ Contents -c player? [6] I'm using a slow terminal, and the game response is sluggish. What can I do? +[7] Why can't my terminal hide the cursor? Answers ======= [1] Where can I find the latest version? - My machine doesn't currently have a constant hostname, but you can - usually find the hostname from `finger mhw@cs.brown.edu`, at least - until the Fall of 1995. + ftp://ftp.netris.org/pub/netris/ - If you find my machine, you can get the latest version via - anonymous ftp from the /pub directory. If anonymous ftp isn't - working, it's probably not my machine, so please don't badger it - with lots of retry attempts. - - Unfortunately that is not a permanent site. If that machine - doesn't exist, try mailing me. + The latest version is available via anonymous ftp from + ftp.netris.org in /pub/netris. + + Unfortunately this machine is currently on the far end of a + 14.4kbps modem connection, and may go away at any time without + notice, but I'll do my best to keep it up. If you have trouble + contacting the ftp server, try mailing me at . [2] The pieces look bizarre in my xterm window, and don't erase properly. What's up? @@ -91,7 +90,23 @@ Answers Try the -S option. This disables use of standout mode (bold/inverse), which require control sequences to be sent twice (or more) per line. - This looks nice, but can make the game unplayable on a slow terminal. + Standout mode makes the pieces look much more like blocks, but can + make the game unplayable on a slow terminal. Also, you can type 's' to toggle spying (updating your view of the opponent's board). + +[7] Why can't my terminal hide the cursor? + + Netris uses the termcap library to look up the "vi" and "ve" + capabilities, which make the cursor invisible/visible + respectively. These capabilities aren't very consistently + reported among un*xes, so I use compiled-in vt220 codes for + several vt100-like terminals. Most emulators probably won't + support the codes, but they'll probably ignore them quietly. + + Try setting the TERM environment variable to "vt100" or "vt220" + before running Netris. If that doesn't work, your terminal + probably doesn't support cursor invisibility. + +# vi: tw=70 ai diff --git a/README b/README index ce66131..fc7d155 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ # -# Netris -- A free networked version of Tetris -# Copyright (C) 1994,1995 Mark Weaver +# Netris -- A free networked version of T*tris +# Copyright (C) 1994,1995,1996 Mark H. Weaver # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -16,11 +16,11 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -# $Id: README,v 1.19 1995/07/11 07:50:45 mhw Exp $ +# $Id: README,v 1.20 1996/02/09 08:22:06 mhw Exp $ # This is an unfinished developmental version of Netris, a free -networked version of Tetris. It is distributed under the terms +networked version of T*tris. It is distributed under the terms of the GNU General Public License, which is described in the file "COPYING" included with this distribution. @@ -30,18 +30,32 @@ you are on your own. It's been built and tested on at least the following systems: - NetBSD-1.0 - NetBSD-current July 9, 1995 + NetBSD 1.0, 1.1 Linux - SunOS 4.1.1, 4.1.3, 5.3 + SunOS 4.1.1, 4.1.3 + Solaris 2.3, 2.4 HP-UX If Netris doesn't build on your favorite system "out-of-the-box", I encourage you to mail me context diffs to fix the problem so I can fold it into the next version. +Netris should build cleanly on 64-bit systems such as the Alpha, +although you might need to edit the definitions for netint{2,4}, +hton{2,4}, and ntoh{2,4} in netris.h. Alpha users, please let me know +how it goes, and send me diffs if needed! + See the FAQ in this directory if you have any problems. + +NEW IN VERSION 0.4 +================== +- Netris now attempts to make the cursor invisible for terminals that + support it. Xterm no, vt220 yes, vt100 maybe? +- Ctrl-L (by default) will now redraw the screen. +- Various cleanup and documentation changes. + + INSTALLATION ============ 1. Run "./Configure" to create a Makefile and config.h appropriate @@ -53,26 +67,27 @@ INSTALLATION Try "./Configure -h" for more options + RUNNING ======= To start a two-player game, do the following: 1. Player 1 types "netris -w". This means "wait for challenge". 2. Player 2 types "netris -c " where is the hostname - of Player 1. This means "challenge". Player 1 must be waiting - when this command is typed. + of Player 1. This means "challenge". To start a one-player game, run netris with no parameters. One-player mode is a tad boring at the moment, because it never gets any faster, and there's no scoring. This will be rectified -at some point. - -To get usage, type "netris -h". -To use a port number other than the default, use the -p option. -To provide compatibility with the older protocol version, use - the -o option. +at some point. For now, use the "f" key (by default) to make the +game go faster. Speedups cannot be reversed for the remainder of +the game. -I plan on implementing a server that Netris players can connect to -to find other players with similar skill across the globe. +Unlike standard T*tris, Netris gives you a little extra time after +dropping a piece before it solidifies. This allows you to slide the +piece into a notch without waiting for it to fall the whole way down. +In fact, if you can even slide it off a cliff and it'll start falling +again. If you think it should automatically drop again in this case, +use the -D option. The keys are: 'j' left @@ -82,10 +97,36 @@ The keys are: 'm' down faster 's' toggle spying on the other player 'p' pause - 'f' make game faster + 'f' make game faster (irreversable) + Ctrl-L redraw the screen -You can remap the keys using the -k option. The default is: - netris -k "jkl mspf" +To see usage information, type "netris -h". +To see distribution/warranty information, type "netris -H". +To see the rules, type "netris -R". +To use a port number other than the default, use the -p option. -This version now at least partially supports robots. A rough description +You can remap the keys with "-k ", where is a string +containing the keys in the order listed above. The default is: + netris -k "jkl mspf^l" + +You needn't specify all of the keys, for example -k "asd" will only +change the main three keys. "^x" notation can be used for control +characters. + +The "m" key moves the falling piece down one block, in addition to the +usual step-down timer. Use this in repetition when "drop" would go +too far but you don't want to wait for the piece of fall. + + +RUMORS +====== +At some point I may implement a server that Netris players can connect +to to find other players with similar skill across the globe. + +This version at least partially supports robots. A rough description of the protocol is in "robot_desc", and a sample robot is in sr.c. + +The source code should be viewed with tab stops set every 4 columns, +eg, "less -x4 game.c". + +# vi: tw=70 ai diff --git a/VERSION b/VERSION index be58634..bd73f47 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3 +0.4 diff --git a/board.c b/board.c index 97f1124..125cdd0 100644 --- a/board.c +++ b/board.c @@ -1,6 +1,6 @@ /* - * Netris -- A free networked version of Tetris - * Copyright (C) 1994,1995 Mark Weaver + * Netris -- A free networked version of T*tris + * Copyright (C) 1994,1995,1996 Mark H. Weaver * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: board.c,v 1.13 1995/07/11 08:53:20 mhw Exp $ + * $Id: board.c,v 1.14 1996/02/09 08:22:08 mhw Exp $ */ #include "netris.h" @@ -241,3 +241,7 @@ ExtFunc void InsertJunk(int scr, int count, int column) curY[scr] += count; } +/* + * vi: ts=4 ai + * vim: noai si + */ diff --git a/curses.c b/curses.c index 2d93900..047efa4 100644 --- a/curses.c +++ b/curses.c @@ -1,6 +1,6 @@ /* - * Netris -- A free networked version of Tetris - * Copyright (C) 1994,1995 Mark Weaver + * Netris -- A free networked version of T*tris + * Copyright (C) 1994,1995,1996 Mark H. Weaver * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: curses.c,v 1.29 1995/07/11 08:53:21 mhw Exp $ + * $Id: curses.c,v 1.32 1996/02/09 08:47:25 mhw Exp $ */ #include "netris.h" @@ -35,22 +35,34 @@ static EventGenRec keyGen = static int boardYPos[MAX_SCREENS], boardXPos[MAX_SCREENS]; static int statusYPos, statusXPos; +static char *term_vi; /* String to make cursor invisible */ +static char *term_ve; /* String to make cursor visible */ + ExtFunc void InitScreens(void) { MySigSet oldMask; + GetTermcapInfo(); + + /* + * Do this atomically. Otherwise a badly timed Ctrl-C during + * initialization will leave your terminal in a bad state. + */ BlockSignals(&oldMask, SIGINT, 0); initscr(); AtExit(CleanupScreens); RestoreSignals(NULL, &oldMask); + cbreak(); noecho(); + OutputTermStr(term_vi, 0); AddEventGen(&keyGen); + move(0, 0); addstr("Netris "); addstr(version_string); - addstr(" (C) 1994,1995 Mark Weaver " - "\"netris -h\" for more info"); + addstr(" (C) 1994,1995,1996 Mark H. Weaver " + "\"netris -h\" for more info"); statusYPos = 22; statusXPos = 0; } @@ -59,6 +71,72 @@ ExtFunc void CleanupScreens(void) { RemoveEventGen(&keyGen); endwin(); + OutputTermStr(term_ve, 1); +} + +ExtFunc void GetTermcapInfo(void) +{ + char *term, *buf, *data; + int bufSize = 10240; + + if (!(term = getenv("TERM"))) + return; + if (tgetent(scratch, term) == 1) { + /* + * Make the buffer HUGE, since tgetstr is unsafe. + * Allocate it on the heap too. + */ + data = buf = malloc(bufSize); + + /* + * There is no standard include file for tgetstr, no prototype + * definitions. I like casting better than using my own prototypes + * because if I guess the prototype, I might be wrong, especially + * with regards to "const". + */ + term_vi = (char *)tgetstr("vi", &data); + term_ve = (char *)tgetstr("ve", &data); + + /* Okay, so I'm paranoid; I just don't like unsafe routines */ + if (data > buf + bufSize) + fatal("tgetstr overflow, you must have a very sick termcap"); + + /* Trim off the unused portion of buffer */ + buf = realloc(buf, data - buf); + } + + /* + * If that fails, use hardcoded vt220 codes. + * They don't seem to do anything bad on vt100's, so + * we'll try them just in case they work. + */ + if (!term_vi || !term_ve) { + static char *vts[] = { + "vt100", "vt101", "vt102", + "vt200", "vt220", "vt300", + "vt320", "vt400", "vt420", + "screen", "xterm", NULL }; + int i; + + for (i = 0; vts[i]; i++) + if (!strcmp(term, vts[i])) + { + term_vi = "\033[?25l"; + term_ve = "\033[?25h"; + break; + } + } + if (!term_vi || !term_ve) + term_vi = term_ve = NULL; +} + +ExtFunc void OutputTermStr(char *str, int flush) +{ + if (str) { + fputs(str, stdout); + if (flush) + fflush(stdout); + } } ExtFunc void InitScreen(int scr) @@ -133,10 +211,10 @@ ExtFunc void PlotUnderline(int scr, int x, int flag) ExtFunc void ShowDisplayInfo(void) { move(statusYPos - 9, statusXPos); - printw("Seed = %d", initSeed); + printw("Seed: %d", initSeed); clrtoeol(); move(statusYPos - 8, statusXPos); - printw("Speed = %dms", speed / 1000); + printw("Speed: %dms", speed / 1000); clrtoeol(); if (robotEnable) { move(statusYPos - 6, statusXPos); @@ -207,6 +285,11 @@ ExtFunc void RefreshScreen(void) refresh(); } +ExtFunc void ScheduleFullRedraw(void) +{ + touchwin(stdscr); +} + static MyEventType KeyGenFunc(EventGenRec *gen, MyEvent *event) { if (MyRead(gen->fd, &event->u.key, 1)) @@ -215,3 +298,7 @@ static MyEventType KeyGenFunc(EventGenRec *gen, MyEvent *event) return E_none; } +/* + * vi: ts=4 ai + * vim: noai si + */ diff --git a/game.c b/game.c index 82c03bf..26ab6a8 100644 --- a/game.c +++ b/game.c @@ -1,6 +1,6 @@ /* - * Netris -- A free networked version of Tetris - * Copyright (C) 1994,1995 Mark Weaver + * Netris -- A free networked version of T*tris + * Copyright (C) 1994,1995,1996 Mark H. Weaver * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: game.c,v 1.37 1995/07/11 08:53:23 mhw Exp $ + * $Id: game.c,v 1.38 1996/02/09 08:22:11 mhw Exp $ */ #define NOEXT @@ -27,19 +27,54 @@ #include #include -enum { KT_left, KT_rotate, KT_right, KT_drop, - KT_down, KT_toggleSpy, KT_pause, KT_faster, KT_numKeys }; +enum { KT_left, KT_rotate, KT_right, KT_drop, KT_down, + KT_toggleSpy, KT_pause, KT_faster, KT_redraw, KT_numKeys }; static char *keyNames[KT_numKeys+1] = { "Left", "Rotate", "Right", "Drop", "Down", "ToggleSpy", "Pause", - "Faster", NULL }; + "Faster", "Redraw", NULL }; static char *gameNames[GT_len] = { "OnePlayer", "ClassicTwo" }; -static char keyTable[KT_numKeys+1] = "jkl mspf"; +static char keyTable[KT_numKeys+1]; static int dropModeEnable = 0; static char *robotProg; +ExtFunc void MapKeys(char *newKeys) +{ + int i, k, ch; + char used[256]; + int errs = 0; + + /* XXX assumptions about ASCII encoding here */ + for (i = k = 0; newKeys[i] && k < KT_numKeys; i++,k++) { + if (newKeys[i] == '^' && newKeys[i+1]) + keyTable[k] = toupper(newKeys[++i]) - ('A' - 1); + else + keyTable[k] = newKeys[i]; + } + memset(used, 0, sizeof(used)); + for (k = 0; k < KT_numKeys; k++) { + ch = (unsigned char) keyTable[k]; + if (used[ch]) { + if (iscntrl(ch) && ch < ' ') + sprintf(scratch, "Ctrl-%c", ch + ('A' - 1)); + else if (isprint(ch)) + sprintf(scratch, "\"%c\"", ch); + else + sprintf(scratch, "0x%X", ch); + if (!errs) + fprintf(stderr, "Duplicate key mappings:\n"); + errs++; + fprintf(stderr, " %s mapped to both %s and %s\n", + scratch, keyNames[used[ch]-1], keyNames[k]); + } + used[ch] = k + 1; + } + if (errs) + exit(1); +} + ExtFunc int StartNewPiece(int scr, Shape *shape) { curShape[scr] = shape; @@ -131,7 +166,7 @@ ExtFunc void OneGame(int scr, int scr2) if (!p) break; keyEvent: - if (paused && (key != KT_pause)) + if (paused && (key != KT_pause) && (key != KT_redraw)) break; switch(key) { case KT_left: @@ -184,6 +219,11 @@ ExtFunc void OneGame(int scr, int scr2) ShowDisplayInfo(); changed = 1; break; + case KT_redraw: + ScheduleFullRedraw(); + if (paused) + RefreshScreen(); + break; } if (dropMode && DropPiece(scr) > 0) { if (spied) @@ -321,6 +361,7 @@ ExtFunc int main(int argc, char **argv) standoutEnable = 1; stepDownInterval = DEFAULT_INTERVAL; + MapKeys(DEFAULT_KEYS); while ((ch = getopt(argc, argv, "hHRs:r:Fk:c:woDSp:i:")) != -1) switch (ch) { case 'c': @@ -355,20 +396,15 @@ ExtFunc int main(int argc, char **argv) case 'S': standoutEnable = 0; break; + case 'k': + MapKeys(optarg); + break; case 'H': DistInfo(); exit(0); case 'R': Rules(); exit(0); - case 'k': - { - int i; - - for (i=0;optarg[i] && i < KT_numKeys;i++) - keyTable[i] = optarg[i]; - break; - } case 'h': Usage(); exit(0); @@ -492,3 +528,7 @@ ExtFunc int main(int argc, char **argv) return 0; } +/* + * vi: ts=4 ai + * vim: noai si + */ diff --git a/inet.c b/inet.c index 392231e..dbfe748 100644 --- a/inet.c +++ b/inet.c @@ -1,6 +1,6 @@ /* - * Netris -- A free networked version of Tetris - * Copyright (C) 1994,1995 Mark Weaver + * Netris -- A free networked version of T*tris + * Copyright (C) 1994,1995,1996 Mark H. Weaver * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: inet.c,v 1.17 1995/07/11 08:53:25 mhw Exp $ + * $Id: inet.c,v 1.18 1996/02/09 08:22:13 mhw Exp $ */ #include "netris.h" @@ -210,3 +210,7 @@ ExtFunc void CloseNet(void) RemoveEventGen(&netGen); } +/* + * vi: ts=4 ai + * vim: noai si + */ diff --git a/netris.h b/netris.h index e5c69ec..5864cf7 100644 --- a/netris.h +++ b/netris.h @@ -1,6 +1,6 @@ /* - * Netris -- A free networked version of Tetris - * Copyright (C) 1994,1995 Mark Weaver + * Netris -- A free networked version of T*tris + * Copyright (C) 1994,1995,1996 Mark H. Weaver * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: netris.h,v 1.26 1995/07/11 08:53:26 mhw Exp $ + * $Id: netris.h,v 1.27 1996/02/09 08:22:14 mhw Exp $ */ #ifndef NETRIS_H @@ -65,6 +65,8 @@ typedef long netint4; #define DEFAULT_PORT 9284 /* Very arbitrary */ +#define DEFAULT_KEYS "jkl mspf^l" + /* Protocol versions */ #define MAJOR_VERSION 1 #define PROTOCOL_VERSION 3 @@ -172,3 +174,7 @@ extern char *version_string; #endif /* NETRIS_H */ +/* + * vi: ts=4 ai + * vim: noai si + */ diff --git a/robot.c b/robot.c index 7af5ab9..23875a3 100644 --- a/robot.c +++ b/robot.c @@ -1,6 +1,6 @@ /* - * Netris -- A free networked version of Tetris - * Copyright (C) 1994,1995 Mark Weaver + * Netris -- A free networked version of T*tris + * Copyright (C) 1994,1995,1996 Mark H. Weaver * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: robot.c,v 1.7 1995/07/11 08:53:28 mhw Exp $ + * $Id: robot.c,v 1.8 1996/02/09 08:22:15 mhw Exp $ */ #include "netris.h" @@ -168,3 +168,7 @@ static MyEventType RobotGenFunc(EventGenRec *gen, MyEvent *event) return E_robot; } +/* + * vi: ts=4 ai + * vim: noai si + */ diff --git a/robot_desc b/robot_desc index bcb52df..01c6970 100644 --- a/robot_desc +++ b/robot_desc @@ -1,4 +1,4 @@ -$Id: robot_desc,v 1.2 1994/12/12 22:42:42 mhw Exp $ +$Id: robot_desc,v 1.3 1996/02/09 08:22:16 mhw Exp $ GENERAL PROTOCOL @@ -220,3 +220,6 @@ lines sent to Netris are preceeded by "> ". TimeStamp 1.326 [...] Exit + + +# vi: tw=70 ai diff --git a/shapes.c b/shapes.c index 45b2b5e..c62f69b 100644 --- a/shapes.c +++ b/shapes.c @@ -1,6 +1,6 @@ /* - * Netris -- A free networked version of Tetris - * Copyright (C) 1994,1995 Mark Weaver + * Netris -- A free networked version of T*tris + * Copyright (C) 1994,1995,1996 Mark H. Weaver * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: shapes.c,v 1.14 1995/07/11 08:53:29 mhw Exp $ + * $Id: shapes.c,v 1.15 1996/02/09 08:22:17 mhw Exp $ */ #include "netris.h" @@ -185,3 +185,7 @@ ExtFunc Shape *NetNumToShape(short num) return netMapping[num]; } +/* + * vi: ts=4 ai + * vim: noai si + */ diff --git a/sr.c b/sr.c index d9b1172..a5974fd 100644 --- a/sr.c +++ b/sr.c @@ -1,6 +1,6 @@ /* * sr -- A sample robot for Netris - * Copyright (C) 1994,1995 Mark Weaver + * Copyright (C) 1994,1995,1996 Mark H. Weaver * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: sr.c,v 1.9 1995/07/11 08:53:30 mhw Exp $ + * $Id: sr.c,v 1.10 1996/02/09 08:22:20 mhw Exp $ */ #include @@ -468,3 +468,7 @@ int main(int argc, char **argv) return 0; } +/* + * vi: ts=4 ai + * vim: noai si + */ diff --git a/util.c b/util.c index b52d761..98248ed 100644 --- a/util.c +++ b/util.c @@ -1,6 +1,6 @@ /* - * Netris -- A free networked version of Tetris - * Copyright (C) 1994,1995 Mark Weaver + * Netris -- A free networked version of T*tris + * Copyright (C) 1994,1995,1996 Mark H. Weaver * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: util.c,v 1.26 1995/07/11 08:53:32 mhw Exp $ + * $Id: util.c,v 1.27 1996/02/09 08:22:23 mhw Exp $ */ #include "netris.h" @@ -66,74 +66,77 @@ ExtFunc void AtExit(void (*handler)(void)) ExtFunc void Usage(void) { fprintf(stderr, - "Netris version %s (C) 1994,1995 Mark Weaver \n" - "Usage: netris \n" - " -h Print usage information\n" - " -w Wait for connection\n" - " -c Initiate connection\n" - " -p Set port number (default is %d)\n" - " -k Remap keys. The argument is a string containing\n" - " the keys in order: left, rotate, right, drop,\n" - " down-faster, toggle-spying, pause\n" - " -i Set the step-down interval, in seconds\n" - " -r Execute (a command) as a robot controlling\n" - " the game instead of the keyboard\n" - " -F Use fair robot interface\n" - " -s Start with given random seed\n" - " -D Drops go into drop mode\n" - " This means that sliding off a cliff after a drop causes\n" - " another drop automatically\n" - " -S Disable standout mode (inverse/bold) for slow terminals\n" - " -H Show distribution and warranty information\n" - " -R Show rules\n", - version_string, DEFAULT_PORT); + "Netris version %s (C) 1994,1995,1996 Mark H. Weaver \n" + "Usage: netris \n" + " -h Print usage information\n" + " -w Wait for connection\n" + " -c Initiate connection\n" + " -p Set port number (default is %d)\n" + " -k Remap keys. The argument is a prefix of the string\n" + " containing the keys in order: left, rotate, right, drop,\n" + " down-faster, toggle-spying, pause, faster, redraw.\n" + " \"^\" prefixes controls. (default is \"%s\")\n" + " -i Set the step-down interval, in seconds\n" + " -r Execute (a command) as a robot controlling\n" + " the game instead of the keyboard\n" + " -F Use fair robot interface\n" + " -s Start with given random seed\n" + " -D Drops go into drop mode\n" + " This means that sliding off a cliff after a drop causes\n" + " another drop automatically\n" + " -S Disable standout mode (inverse/bold) for slow terminals\n" + " -H Show distribution and warranty information\n" + " -R Show rules\n", + version_string, DEFAULT_PORT, DEFAULT_KEYS); } ExtFunc void DistInfo(void) { fprintf(stderr, - "Netris version %s (C) 1994,1995 Mark Weaver \n" - "\n" - "This program is free software; you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation; either version 2 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "This program is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with this program; if not, write to the Free Software\n" - "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n", - version_string); + "Netris version %s (C) 1994,1995,1996 Mark H. Weaver \n" + "\n" + "This program is free software; you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation; either version 2 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "This program is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with this program; if not, write to the Free Software\n" + "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n", + version_string); } ExtFunc void Rules(void) { fprintf(stderr, - "Netris version %s rules\n" - "\n" - "Two player mode\n" - "---------------\n" - "It's just like normal Tetris except that when you clear more than\n" - "one row with a single piece, the other player's board is moved up\n" - "and junk rows are added to the bottom. If you clear 2, 3 or 4\n" - "rows, 1, 2 or 4 junk rows are added to your opponent's board,\n" - "respectively. The junk rows have exactly one empty column.\n" - "For each group of junk rows given, the empty columns will line\n" - "up. This is intentional.\n" - "\n" - "The longest surviving player wins the game.\n" - "\n" - "One player mode\n" - "---------------\n" - "This mode is currently very boring, because there's no scoring\n" - "and it never gets any faster. This will be rectified at some point.\n" - "I'm not very motivated to do it right now because I'm sick of one\n" - "player Tetris.\n", - version_string); + "Netris version %s rules\n" + "\n" + "Two player mode\n" + "---------------\n" + "It's just like normal T*tris except that when you clear more than\n" + "one row with a single piece, the other player's board is moved up\n" + "and junk rows are added to the bottom. If you clear 2, 3 or 4\n" + "rows, 1, 2 or 4 junk rows are added to your opponent's board,\n" + "respectively. The junk rows have exactly one empty column.\n" + "For each group of junk rows given, the empty columns will line\n" + "up. This is intentional.\n" + "\n" + "The longest surviving player wins the game.\n" + "\n" + "One player mode\n" + "---------------\n" + "This mode is currently very boring, because there's no scoring\n" + "and it never gets any faster. This will be rectified at some point.\n" + "I'm not very motivated to do it right now because I'm sick of one\n" + "player T*tris. For now, use the \"f\" key (by default) to make the\n" + "game go faster. Speedups cannot be reversed for the remainder of\n" + "the game.\n", + version_string); } /* @@ -376,3 +379,7 @@ ExtFunc MyEventType WaitMyEvent(MyEvent *event, int mask) } } +/* + * vi: ts=4 ai + * vim: noai si + */ -- 2.30.0