From a5c63ad3562a5a54324f60c79a8409fa18348179 Mon Sep 17 00:00:00 2001 From: "Aaron M. Ucko" Date: Fri, 18 Feb 2005 22:09:47 -0500 Subject: Import bsdgames-nonfree_2.17.orig.tar.gz [dgit import orig bsdgames-nonfree_2.17.orig.tar.gz] --- AUTHORS | 79 + BUGS | 48 + COPYING | 467 +++ ChangeLog | 5957 ++++++++++++++++++++++++++++++++++++ ChangeLog.0 | 67 + INSTALL | 188 ++ Makeconfig.in | 136 + NEWS | 461 +++ PACKAGING | 149 + README | 139 + README.non-free | 27 + SECURITY | 90 + THANKS | 80 + TODO | 90 + YEAR2000 | 36 + bsd-games-non-free.lsm | 14 + configure | 821 +++++ exec.libs | 57 + exec.objs | 129 + hide-game.in | 33 + include/signal.h | 47 + include/stdio.h | 39 + include/stdlib.h | 43 + include/string.h | 39 + include/sys/cdefs.h | 42 + include/sys/endian.h | 120 + include/sys/poll.h | 38 + include/sys/ttydefaults.h | 46 + include/termios.h | 36 + install-man.in | 92 + install-score.in | 45 + lib/Makefrag | 33 + lib/fgetln.c | 66 + lib/getloadavg.c | 55 + lib/getprogname.c | 40 + lib/strlcpy.c | 70 + mkdep | 47 + rogue/CHANGES | 55 + rogue/Makefile.bsd | 21 + rogue/Makefrag | 39 + rogue/USD.doc/Makefile.bsd | 11 + rogue/USD.doc/rogue.me | 834 +++++ rogue/hit.c | 471 +++ rogue/init.c | 365 +++ rogue/inventory.c | 786 +++++ rogue/level.c | 906 ++++++ rogue/machdep.c | 493 +++ rogue/main.c | 88 + rogue/message.c | 391 +++ rogue/monster.c | 900 ++++++ rogue/move.c | 655 ++++ rogue/object.c | 809 +++++ rogue/pack.c | 591 ++++ rogue/pathnames.h.in | 34 + rogue/play.c | 298 ++ rogue/random.c | 147 + rogue/ring.c | 344 +++ rogue/rogue.6.in | 107 + rogue/rogue.h | 800 +++++ rogue/room.c | 675 ++++ rogue/save.c | 430 +++ rogue/score.c | 603 ++++ rogue/spec_hit.c | 551 ++++ rogue/throw.c | 326 ++ rogue/trap.c | 285 ++ rogue/use.c | 631 ++++ rogue/zap.c | 412 +++ substfiles | 52 + substfiles2 | 51 + substscr | 99 + tests/battlestar.err6 | 1 + tests/battlestar.in1 | 2 + tests/battlestar.in10 | 16 + tests/battlestar.in11 | 16 + tests/battlestar.in12 | 16 + tests/battlestar.in13 | 16 + tests/battlestar.in14 | 2 + tests/battlestar.in16 | 2 + tests/battlestar.in17 | 2 + tests/battlestar.in18 | 2 + tests/battlestar.in19 | 2 + tests/battlestar.in2 | 2 + tests/battlestar.in20 | 2 + tests/battlestar.in21 | 2 + tests/battlestar.in22 | 4 + tests/battlestar.in23 | 3 + tests/battlestar.in24 | 4 + tests/battlestar.in25 | 5 + tests/battlestar.in26 | 2 + tests/battlestar.in27 | 2 + tests/battlestar.in28 | 2 + tests/battlestar.in29 | 2 + tests/battlestar.in3 | 2 + tests/battlestar.in30 | 2 + tests/battlestar.in31 | 2 + tests/battlestar.in32 | 2 + tests/battlestar.in33 | 2 + tests/battlestar.in34 | 2 + tests/battlestar.in35 | 2 + tests/battlestar.in36 | 2 + tests/battlestar.in37 | 2 + tests/battlestar.in38 | 2 + tests/battlestar.in39 | 5 + tests/battlestar.in4 | 7 + tests/battlestar.in40 | 4 + tests/battlestar.in41 | 2 + tests/battlestar.in42 | 2 + tests/battlestar.in43 | 2 + tests/battlestar.in5 | 4 + tests/battlestar.in6 | 3 + tests/battlestar.in8 | 5 + tests/battlestar.in9 | 16 + tests/battlestar.out1 | 16 + tests/battlestar.out10 | 98 + tests/battlestar.out11 | 98 + tests/battlestar.out12 | 99 + tests/battlestar.out13 | 99 + tests/battlestar.out14 | 16 + tests/battlestar.out15 | 15 + tests/battlestar.out16 | 16 + tests/battlestar.out17 | 16 + tests/battlestar.out18 | 16 + tests/battlestar.out19 | 16 + tests/battlestar.out2 | 16 + tests/battlestar.out20 | 16 + tests/battlestar.out21 | 85 + tests/battlestar.out22 | 28 + tests/battlestar.out23 | 24 + tests/battlestar.out24 | 30 + tests/battlestar.out25 | 34 + tests/battlestar.out26 | 17 + tests/battlestar.out27 | 16 + tests/battlestar.out28 | 17 + tests/battlestar.out29 | 17 + tests/battlestar.out3 | 17 + tests/battlestar.out30 | 17 + tests/battlestar.out31 | 16 + tests/battlestar.out32 | 16 + tests/battlestar.out33 | 16 + tests/battlestar.out34 | 16 + tests/battlestar.out35 | 17 + tests/battlestar.out36 | 16 + tests/battlestar.out37 | 16 + tests/battlestar.out38 | 17 + tests/battlestar.out39 | 33 + tests/battlestar.out4 | 52 + tests/battlestar.out40 | 31 + tests/battlestar.out41 | 16 + tests/battlestar.out42 | 16 + tests/battlestar.out43 | 16 + tests/battlestar.out5 | 37 + tests/battlestar.out6 | 17 + tests/battlestar.out8 | 34 + tests/battlestar.out9 | 97 + tests/battlestar.test | 258 ++ tests/bcd.foo | 15 + tests/bcd.foobar | 15 + tests/bcd.fooxbar | 30 + tests/bcd.test | 64 + tests/caesar.197816in | 1 + tests/caesar.197816out | 1 + tests/caesar.constin | 100 + tests/caesar.constout | 100 + tests/caesar.test | 49 + tests/common | 55 + tests/factor.123456 | 2 + tests/factor.123456789 | 1 + tests/factor.2147483647111311 | 1 + tests/factor.6172538568 | 1 + tests/factor.8675309 | 1 + tests/factor.987654321 | 1 + tests/factor.987654321987654 | 1 + tests/factor.987654321987654321987 | 1 + tests/factor.99999999999991 | 1 + tests/factor.test | 89 + tests/morse.SOS | 5 + tests/morse.foo | 5 + tests/morse.sos | 1 + tests/morse.test | 69 + tests/morse.testsent | 17 + tests/morse.testsentd | 1 + tests/number.-0.1 | 3 + tests/number.123456 | 2 + tests/number.987654321 | 3 + tests/number.test | 49 + tests/pig.test | 49 + tests/pig.test1 | 1 + tests/pig.test2 | 1 + tests/pig.test3 | 1 + tests/pom.1998fm1 | 1 + tests/pom.1998fm2 | 1 + tests/pom.1998fq1 | 1 + tests/pom.1998fq2 | 1 + tests/pom.1998lq1 | 1 + tests/pom.1998lq2 | 1 + tests/pom.1998nm1 | 1 + tests/pom.1998nm2 | 1 + tests/pom.2003fm1 | 1 + tests/pom.2003fm2 | 1 + tests/pom.2003fq1 | 1 + tests/pom.2003fq2 | 1 + tests/pom.2003lq1 | 1 + tests/pom.2003lq2 | 1 + tests/pom.2003nm1 | 1 + tests/pom.2003nm2 | 1 + tests/pom.2003ph1 | 1 + tests/pom.2003ph2 | 1 + tests/pom.2003ph3 | 1 + tests/pom.2003ph4 | 1 + tests/pom.2003ph5 | 1 + tests/pom.2003ph6 | 1 + tests/pom.2003ph7 | 1 + tests/pom.2003ph8 | 1 + tests/pom.test | 170 + tests/ppt.Foobarnl | 10 + tests/ppt.foobar | 9 + tests/ppt.test | 49 + tests/primes.100 | 25 + tests/primes.1e6 | 24 + tests/primes.1e9 | 16 + tests/primes.test | 49 + 221 files changed, 26091 insertions(+) create mode 100644 AUTHORS create mode 100644 BUGS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 ChangeLog.0 create mode 100644 INSTALL create mode 100644 Makeconfig.in create mode 100644 NEWS create mode 100644 PACKAGING create mode 100644 README create mode 100644 README.non-free create mode 100644 SECURITY create mode 100644 THANKS create mode 100644 TODO create mode 100644 YEAR2000 create mode 100644 bsd-games-non-free.lsm create mode 100755 configure create mode 100644 exec.libs create mode 100644 exec.objs create mode 100755 hide-game.in create mode 100644 include/signal.h create mode 100644 include/stdio.h create mode 100644 include/stdlib.h create mode 100644 include/string.h create mode 100644 include/sys/cdefs.h create mode 100644 include/sys/endian.h create mode 100644 include/sys/poll.h create mode 100644 include/sys/ttydefaults.h create mode 100644 include/termios.h create mode 100755 install-man.in create mode 100755 install-score.in create mode 100644 lib/Makefrag create mode 100644 lib/fgetln.c create mode 100644 lib/getloadavg.c create mode 100644 lib/getprogname.c create mode 100644 lib/strlcpy.c create mode 100755 mkdep create mode 100644 rogue/CHANGES create mode 100644 rogue/Makefile.bsd create mode 100644 rogue/Makefrag create mode 100644 rogue/USD.doc/Makefile.bsd create mode 100644 rogue/USD.doc/rogue.me create mode 100644 rogue/hit.c create mode 100644 rogue/init.c create mode 100644 rogue/inventory.c create mode 100644 rogue/level.c create mode 100644 rogue/machdep.c create mode 100644 rogue/main.c create mode 100644 rogue/message.c create mode 100644 rogue/monster.c create mode 100644 rogue/move.c create mode 100644 rogue/object.c create mode 100644 rogue/pack.c create mode 100644 rogue/pathnames.h.in create mode 100644 rogue/play.c create mode 100644 rogue/random.c create mode 100644 rogue/ring.c create mode 100644 rogue/rogue.6.in create mode 100644 rogue/rogue.h create mode 100644 rogue/room.c create mode 100644 rogue/save.c create mode 100644 rogue/score.c create mode 100644 rogue/spec_hit.c create mode 100644 rogue/throw.c create mode 100644 rogue/trap.c create mode 100644 rogue/use.c create mode 100644 rogue/zap.c create mode 100644 substfiles create mode 100644 substfiles2 create mode 100755 substscr create mode 100644 tests/battlestar.err6 create mode 100644 tests/battlestar.in1 create mode 100644 tests/battlestar.in10 create mode 100644 tests/battlestar.in11 create mode 100644 tests/battlestar.in12 create mode 100644 tests/battlestar.in13 create mode 100644 tests/battlestar.in14 create mode 100644 tests/battlestar.in16 create mode 100644 tests/battlestar.in17 create mode 100644 tests/battlestar.in18 create mode 100644 tests/battlestar.in19 create mode 100644 tests/battlestar.in2 create mode 100644 tests/battlestar.in20 create mode 100644 tests/battlestar.in21 create mode 100644 tests/battlestar.in22 create mode 100644 tests/battlestar.in23 create mode 100644 tests/battlestar.in24 create mode 100644 tests/battlestar.in25 create mode 100644 tests/battlestar.in26 create mode 100644 tests/battlestar.in27 create mode 100644 tests/battlestar.in28 create mode 100644 tests/battlestar.in29 create mode 100644 tests/battlestar.in3 create mode 100644 tests/battlestar.in30 create mode 100644 tests/battlestar.in31 create mode 100644 tests/battlestar.in32 create mode 100644 tests/battlestar.in33 create mode 100644 tests/battlestar.in34 create mode 100644 tests/battlestar.in35 create mode 100644 tests/battlestar.in36 create mode 100644 tests/battlestar.in37 create mode 100644 tests/battlestar.in38 create mode 100644 tests/battlestar.in39 create mode 100644 tests/battlestar.in4 create mode 100644 tests/battlestar.in40 create mode 100644 tests/battlestar.in41 create mode 100644 tests/battlestar.in42 create mode 100644 tests/battlestar.in43 create mode 100644 tests/battlestar.in5 create mode 100644 tests/battlestar.in6 create mode 100644 tests/battlestar.in8 create mode 100644 tests/battlestar.in9 create mode 100644 tests/battlestar.out1 create mode 100644 tests/battlestar.out10 create mode 100644 tests/battlestar.out11 create mode 100644 tests/battlestar.out12 create mode 100644 tests/battlestar.out13 create mode 100644 tests/battlestar.out14 create mode 100644 tests/battlestar.out15 create mode 100644 tests/battlestar.out16 create mode 100644 tests/battlestar.out17 create mode 100644 tests/battlestar.out18 create mode 100644 tests/battlestar.out19 create mode 100644 tests/battlestar.out2 create mode 100644 tests/battlestar.out20 create mode 100644 tests/battlestar.out21 create mode 100644 tests/battlestar.out22 create mode 100644 tests/battlestar.out23 create mode 100644 tests/battlestar.out24 create mode 100644 tests/battlestar.out25 create mode 100644 tests/battlestar.out26 create mode 100644 tests/battlestar.out27 create mode 100644 tests/battlestar.out28 create mode 100644 tests/battlestar.out29 create mode 100644 tests/battlestar.out3 create mode 100644 tests/battlestar.out30 create mode 100644 tests/battlestar.out31 create mode 100644 tests/battlestar.out32 create mode 100644 tests/battlestar.out33 create mode 100644 tests/battlestar.out34 create mode 100644 tests/battlestar.out35 create mode 100644 tests/battlestar.out36 create mode 100644 tests/battlestar.out37 create mode 100644 tests/battlestar.out38 create mode 100644 tests/battlestar.out39 create mode 100644 tests/battlestar.out4 create mode 100644 tests/battlestar.out40 create mode 100644 tests/battlestar.out41 create mode 100644 tests/battlestar.out42 create mode 100644 tests/battlestar.out43 create mode 100644 tests/battlestar.out5 create mode 100644 tests/battlestar.out6 create mode 100644 tests/battlestar.out8 create mode 100644 tests/battlestar.out9 create mode 100755 tests/battlestar.test create mode 100644 tests/bcd.foo create mode 100644 tests/bcd.foobar create mode 100644 tests/bcd.fooxbar create mode 100755 tests/bcd.test create mode 100644 tests/caesar.197816in create mode 100644 tests/caesar.197816out create mode 100644 tests/caesar.constin create mode 100644 tests/caesar.constout create mode 100755 tests/caesar.test create mode 100644 tests/common create mode 100644 tests/factor.123456 create mode 100644 tests/factor.123456789 create mode 100644 tests/factor.2147483647111311 create mode 100644 tests/factor.6172538568 create mode 100644 tests/factor.8675309 create mode 100644 tests/factor.987654321 create mode 100644 tests/factor.987654321987654 create mode 100644 tests/factor.987654321987654321987 create mode 100644 tests/factor.99999999999991 create mode 100755 tests/factor.test create mode 100644 tests/morse.SOS create mode 100644 tests/morse.foo create mode 100644 tests/morse.sos create mode 100755 tests/morse.test create mode 100644 tests/morse.testsent create mode 100644 tests/morse.testsentd create mode 100644 tests/number.-0.1 create mode 100644 tests/number.123456 create mode 100644 tests/number.987654321 create mode 100755 tests/number.test create mode 100755 tests/pig.test create mode 100644 tests/pig.test1 create mode 100644 tests/pig.test2 create mode 100644 tests/pig.test3 create mode 100644 tests/pom.1998fm1 create mode 100644 tests/pom.1998fm2 create mode 100644 tests/pom.1998fq1 create mode 100644 tests/pom.1998fq2 create mode 100644 tests/pom.1998lq1 create mode 100644 tests/pom.1998lq2 create mode 100644 tests/pom.1998nm1 create mode 100644 tests/pom.1998nm2 create mode 100644 tests/pom.2003fm1 create mode 100644 tests/pom.2003fm2 create mode 100644 tests/pom.2003fq1 create mode 100644 tests/pom.2003fq2 create mode 100644 tests/pom.2003lq1 create mode 100644 tests/pom.2003lq2 create mode 100644 tests/pom.2003nm1 create mode 100644 tests/pom.2003nm2 create mode 100644 tests/pom.2003ph1 create mode 100644 tests/pom.2003ph2 create mode 100644 tests/pom.2003ph3 create mode 100644 tests/pom.2003ph4 create mode 100644 tests/pom.2003ph5 create mode 100644 tests/pom.2003ph6 create mode 100644 tests/pom.2003ph7 create mode 100644 tests/pom.2003ph8 create mode 100755 tests/pom.test create mode 100644 tests/ppt.Foobarnl create mode 100644 tests/ppt.foobar create mode 100755 tests/ppt.test create mode 100644 tests/primes.100 create mode 100644 tests/primes.1e6 create mode 100644 tests/primes.1e9 create mode 100755 tests/primes.test diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..4dc12b4 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,79 @@ +Authors of bsd-games and bsd-games-non-free +=========================================== + +The bsd-games package was originally created by Curt Olson + and Andy Tefft . The games +themselves were written by many contributers to *BSD over the past +twenty years or so. Maintenance of the package was passed to me in +1997; I divided it into bsd-games and bsd-games-non-free according to +the established (DFSG/OSD) definition, following the division used for +the Debian package of 1.3. Much of the packaging has been written or +extensively modified by myself. Joey Hess +wrote the manpages for wargames and paranoia. + +Based on the source and manpages, here are the details of the people +who originally wrote the games over more than 20 years. Many of the +email addresses below are probably no longer valid. Please send any +further information you have to help improve this list. + +adventure: Will Crowther, Don Woods; C port by Jim Gilloghy +arithmetic: Eamonn McManus +atc: Ed James +backgammon: Alan Char +banner: Mark Horton +battlestar: David Riggle , with acknowledgements to + Chris Guthrie , Peter Da Silva, + Kevin Brown, Edward Wang , + Ken Arnold & Company +bcd: Steve Hayman +boggle: Barry Brachman +caesar: Rick Adams, Stan King, John Eldridge, based on algorithm + suggested by Bob Morris +canfield: Steve Levine; further random hacking by Steve Feldman, + Kirk McKusick, Mikey Olson, Eric Allman +countmail: Charles M. Hannum +cribbage: Earl T. Cohen, Ken Arnold +dm: (unknown) +factor: Landon Curt Noll +fish: Muffy Barkocy +fortune: Ken Arnold (fortunes from many sources) +gomoku: Ralph Campbell (with acknowledgement to Peter Langston) +hack: Originally Jay Fenlason, with help from Kenny + Woodland, Mike Thome and Jon Payne; this version + almost entirely rewritten by Andries Brouwer . +hangman: Ken Arnold +hunt: Conrad Huang , + Greg Couch +mille: Ken Arnold +monop: Ken Arnold +morse: (unknown) +number: (unknown) +phantasia: Edward Estes , with thanks to + Chris Robertson +pig: (unknown) +pom: Keith E. Brandt +ppt: (unknown) +primes: Landon Curt Noll +quiz: Jim R. Oldroyd +rain: Eric P. Scott +random: Guy Harris +robots: Ken Arnold, Christos Zoulas +rogue: Timothy Stoehr, Michael C. Toy, Kenneth C. R. C. Arnold, + Glenn Wichman +sail: Dave Riggle , + Ed Wang ; Craig Leres, + Chris Guthrie +snake: (unknown) +tetris: Nancy L. Tinkham, Darren F. Provine, Chris Torek +trek: Eric Allman +wargames: (unknown) +worm: Michael Toy +worms: Eric P. Scott +wtf: Allen Briggs +wump: Dave Taylor + + + +Local Variables: +mode: text +End: diff --git a/BUGS b/BUGS new file mode 100644 index 0000000..0c2e6c7 --- /dev/null +++ b/BUGS @@ -0,0 +1,48 @@ +Known bugs in bsd-games and bsd-games-non-free +============================================== + +I know of the following bugs in bsd-games and bsd-games-non-free; +there is no need to report them if you come across them, but fixes are +welcome. + +General +======= + +Some games may not handle signals (especially resizing) properly. +Handling signals properly means in a way conforming to ISO C and +POSIX.1: no async-unsafe functions may be used in a signal handler if +the signal could have interrupted an async-unsafe function, and any +variable of static storage duration assigned to must be of type +volatile sig_atomic_t. (See adventure for an example of proper +handling.) + +Some games may not check for errors when they should, or may return +inappropriate exit statuses. + +Some games may have arbitrary limits that they should not have. + +Specific games +============== + +Under some circumstances, hunt fails to start the hunt daemon if one +is not already running. In general, hunt needs thorough testing by +someone willing to investigate and fix bugs; at present hunt should be +considered unsupported and probably broken. OpenBSD has a +substantially improved version that should be imported/merged. + +Saving in monop is completely broken. Since it assumes it can save by +writing out the whole data space from 0 to sbrk(0) and read it in to +restore, it may not be easy to fix. See NetBSD PR bin/8247. + +Gomoku can use 16 megabytes or more of memory. (This is reported (not +by me) as NetBSD PR 3126.) + + +Joseph S. Myers +jsm@polyomino.org.uk + + + +Local Variables: +mode: text +End: diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..8e108fa --- /dev/null +++ b/COPYING @@ -0,0 +1,467 @@ +I believe that the following copyrights and licence terms apply to the +games distributed in bsd-games and bsd-games-non-free. (The copyright +years given below are those that appear on any of the files so +licensed.) + +Most games are under the standard BSD terms: + + Copyright (c) 1980, 1982, 1983, 1985-1994 + The Regents of the University of California. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +The files "caesar/rot13.in" and "wargames/wargames" have a similar +licence but with an additional advertising clause: + + Copyright (c) 1985, 1992, 1993 + The Regents of the University of California. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + This product includes software developed by the University of + California, Berkeley and its contributors. + 4. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +The game "hunt" has a similar licence, mentioning the University of +California, San Francisco: + + Copyright (c) 1983-2003, Regents of the University of California. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + Neither the name of the University of California, San Francisco nor + the names of its contributors may be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +These terms also apply to "hunt/Makeconfig", which is derived from the +hunt "Makefile.inc" distributed by NetBSD. + +The files "backgammon/backgammon/backlocal.h", "countmail/countmail", +"dm/utmpentry.c", "dm/utmpentry.h", "hack/extern.h", "robots/auto.c", +"sail/display.h", "sail/restart.h" and the game "dab" have a similar +licence, but copyright is held by the NetBSD Foundation: + + Copyright (c) 1997, 1998, 1999, 2001, 2002, 2003 The NetBSD Foundation, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + This product includes software developed by the NetBSD + Foundation, Inc. and its contributors. + 4. Neither the name of The NetBSD Foundation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +In the case of "dab/dab.6", the copyright is held by Thomas Klausner: + + Copyright (c) 2003 Thomas Klausner. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +In the case of "adventure/extern.h" the copyright is held by Christos +Zoulas: + + Copyright (c) 1997 Christos Zoulas. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + This product includes software developed by Christos Zoulas. + 4. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +In the case of "countmail/countmail.6" the copyright is held by +Matthew R. Green: + + Copyright (c) 1997 Matthew R. Green + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +In the case of "wargames/wargames.6", the copyright is held by Joey +Hess: + + Copyright (c) 1998 Joey Hess + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +In the case of "lib/strlcpy.c", the copyright is held by Todd +C. Miller: + + Copyright (c) 1998 Todd C. Miller + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The game "atc" bears additional notices in the name of Ed James: + + Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved. + + Copy permission is hereby granted provided that this notice is + retained on all partial or complete copies. + + For more info on this and all of my stuff, mail edjames@berkeley.edu. + +The game "boggle" used to bear a copyright notice in the name of Barry +Brachman, but he confirmed that he had assigned his copyright to the +University of California and the continued inclusion of the old +copyright notice was an omission on their part. + +The game "phantasia" is not copyright (except for +"phantasia/pathnames.h.in" to which the BSD copyright and licence +apply); the notice in "phantasia/COPYRIGHT" applies to it. + +The game "wtf" is also not copyright, and bears the notice + + Public domain + +The game "rogue" (in bsd-games-non-free) bears the standard BSD +notices, and then the following: + + This source herein may be modified and/or distributed by anybody who + so desires, with the following restrictions: + 1.) No portion of this notice shall be removed. + 2.) Credit shall not be taken for the creation of this source. + 3.) This code is not to be traded, sold, or used for personal + gain or profit. + +The game "hack" has the following notices: + + Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, + Amsterdam + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + - Neither the name of the Stichting Centrum voor Wiskunde en + Informatica, nor the names of its contributors may be used to endorse or + promote products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + Copyright (c) 1982 Jay Fenlason + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"hack/pathnames.h" bears a BSD copyright notice and licence; +"hack/hack.tty.c" bears one in addition to that in those listed above; +"hack/extern.h" bears the notice in the name of The NetBSD Foundation +listed above. + +Auxiliary and data files, distributed with the games in NetBSD, but +not bearing copyright notices, probably fall under the terms of the +UCB or NetBSD copyrights and licences. The file "fortune/Notes" +contains a warning in regard to the fortune databases. + +Some files, beyond those present in NetBSD, have been added to the +Linux bsd-games collection. The following terms apply to the files in +the "include" and "lib" directories (relevant to binary distributions +insofar as they get compiled into the games; note that the include +files are probably irrelevant for this purpose as it is unlikely they +are significant enough to make any binary a derived work). + + Copyright (c) 1997-2005 Joseph Samuel Myers. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +The above terms also apply to the scripts, makefile fragments and +documentation added to the Linux bsd-games collection which are not +significantly derived from bsd-games 1.3 by Curt Olson and Andy Tefft; +this is all of them except for the files mentioned below to which the +similar terms given below are expected to apply. This includes the +testsuite scripts; the testsuite input and output for caesar +("tests/caesar.constin" and "tests/caesar.constout") are from the US +Constitution, so not copyright; I believe the other testsuite expected +outputs are too trivial, or translations of inputs too trivial, to +qualify for copyright; but if not, then the terms given above apply +(and, of course, running the test command gives an identical output +file to which you could apply your own copyright). + +The files "bsd-games.lsm", "ChangeLog.0", "THANKS", "INSTALL" and +"README" are still significantly derived from files in the original +bsd-games package for Linux by Curt Olson and Andy Tefft. It is +expected that the following terms will apply to these files, and to +the compilation copyright on the package as a whole; ***this has yet +to be confirmed with Andy Tefft***: + + Copyright (c) 1993 Curt Olson, Andy Tefft. + Copyright (c) 1997-2005 Joseph Samuel Myers. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the authors may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + + +Local Variables: +mode: text +End: diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..47084ee --- /dev/null +++ b/ChangeLog @@ -0,0 +1,5957 @@ +2005-02-18 Joseph S. Myers + + * Version 2.17. + + * NEWS, bsd-games.lsm, bsd-games-non-free.lsm: Update. + + * wtf/acronyms, wtf/acronyms.comp: Update from NetBSD CVS. + +2005-02-16 Joseph S. Myers + + * atc/input.c, backgammon/backgammon/main.c, + backgammon/teachgammon/teach.c, cribbage/instr.c, fish/fish.c, + phantasia/gamesupport.c, phantasia/interplayer.c, phantasia/io.c, + phantasia/misc.c, phantasia/phantstruct.h, rogue/machdep.c, + rogue/rogue.h, trek/getpar.h, trek/trek.h, wump/wump.c: Update + from NetBSD CVS. + +2005-02-14 Joseph S. Myers + + * hack/hack.termcap.c: Remove "static" from some variables. Fix + from Andreas Jochens in Debian bug 284750. + * exec.objs: Include lib/strlcpy.o for atc and sail. + * atc/input.c, backgammon/backgammon/main.c, + backgammon/teachgammon/teach.c, cribbage/instr.c, fish/fish.c, + phantasia/misc.c, rogue/machdep.c, wump/wump.c: Cast last argument + of execl to char *. + * rogue/rogue.h: Avoid arrays of incomplete types. + * trek/trek.h: Likewise. Don't declare Skitab and Lentab here. + * trek/getpar.h: Declare Skitab and Lentab here. + * phantasia/phantstruct.h: Define phbool. + * phantasia/gamesupport.c, phantasia/interplayer.c, + phantasia/io.c, phantasia/misc.c: Use phbool where necessary. + + * .cvsignore, adventure/.cvsignore, arithmetic/.cvsignore, + atc/.cvsignore, backgammon/backgammon/.cvsignore, + backgammon/common_source/.cvsignore, + backgammon/teachgammon/.cvsignore, banner/.cvsignore, + battlestar/.cvsignore, bcd/.cvsignore, boggle/boggle/.cvsignore, + boggle/mkdict/.cvsignore, boggle/mkindex/.cvsignore, + caesar/.cvsignore, canfield/canfield/.cvsignore, + canfield/cfscores/.cvsignore, cribbage/.cvsignore, dab/.cvsignore, + dm/.cvsignore, factor/.cvsignore, fish/.cvsignore, + fortune/datfiles/.cvsignore, fortune/fortune/.cvsignore, + fortune/strfile/.cvsignore, fortune/unstr/.cvsignore, + gomoku/.cvsignore, hack/.cvsignore, hangman/.cvsignore, + hunt/hunt/.cvsignore, hunt/huntd/.cvsignore, include/.cvsignore, + lib/.cvsignore, mille/.cvsignore, monop/.cvsignore, + morse/.cvsignore, number/.cvsignore, phantasia/.cvsignore, + pig/.cvsignore, pom/.cvsignore, ppt/.cvsignore, primes/.cvsignore, + quiz/.cvsignore, quiz/datfiles/.cvsignore, rain/.cvsignore, + random/.cvsignore, robots/.cvsignore, rogue/.cvsignore, + sail/.cvsignore, snake/snake/.cvsignore, snake/snscore/.cvsignore, + tetris/.cvsignore, trek/.cvsignore, worm/.cvsignore, + worms/.cvsignore, wtf/.cvsignore, wump/.cvsignore: Remove as no + longer needed after move to Subversion. + +2005-01-30 Joseph S. Myers + + * fortune/datfiles/fortunes2: Update from NetBSD CVS. + +2005-01-30 Joseph S. Myers + + * wtf/acronyms, wtf/acronyms.comp: Update from NetBSD CVS. + * COPYING: Update copyright dates. + +2004-12-23 Joseph S. Myers + + * monop/malloc.c, phantasia/main.c, phantasia/setup.c: Update from + NetBSD CVS. + +2004-12-07 Joseph S. Myers + + * arithmetic/arithmetic.c, battlestar/getcom.c, + boggle/boggle/bog.c, boggle/boggle/mach.c, + canfield/canfield/canfield.c, cribbage/io.c, dm/dm.c, + fortune/fortune/fortune.c, gomoku/stoc.c, hack/hack.u_init.c, + hangman/getword.c, hunt/hunt/hunt.c, hunt/hunt/otto.c, + hunt/huntd/answer.c, mille/move.c, monop/getinp.c, monop/misc.c, + number/number.c, pig/pig.c, robots/main.c, sail/dr_1.c, + sail/misc.c, sail/pl_4.c, sail/pl_5.c, worms/Makefile.bsd, + wtf/acronyms, wtf/acronyms.comp: Update from NetBSD CVS. + +2004-10-31 Joseph S. Myers + + * lib/fgetln.c: Handle case of line just fitting in buffer + correctly. + +2004-10-23 Joseph S. Myers + + * dm/utmpentry.c: Update from NetBSD CVS. + +2004-09-15 Joseph S. Myers + + * fortune/fortune/fortune.6.in, fortune/strfile/strfile.8, + worms/worms.c: Update from NetBSD CVS. + +2004-09-08 Joseph S. Myers + + * atc/log.c, sail/dr_1.c, sail/sync.c: Update from NetBSD CVS. + +2004-09-04 Joseph S. Myers + + * wtf/acronyms: Update from NetBSD CVS. + +2004-09-02 Joseph S. Myers + + * robots/auto.c, robots/move.c: Update from NetBSD CVS. + +2004-08-23 Joseph S. Myers + + * fortune/datfiles/fortunes: Update from NetBSD CVS. + +2004-07-16 Joseph S. Myers + + * wtf/acronyms.comp: Update from NetBSD CVS. + +2004-07-05 Joseph S. Myers + + * wtf/acronyms: Update from NetBSD CVS. + +2004-06-07 Joseph S. Myers + + * wtf/acronyms.comp: Update from NetBSD CVS. + +2004-06-02 Joseph S. Myers + + * hack/hack.6.in: Update from NetBSD CVS. + +2004-05-24 Joseph S. Myers + + * fortune/datfiles/fortunes: Update from NetBSD CVS. + +2004-05-20 Joseph S. Myers + + * wtf/acronyms.comp: Update from NetBSD CVS. + +2004-05-02 Joseph S. Myers + + * rain/rain.c: Update from NetBSD CVS. + * exec.objs: Update. + +2004-04-30 Joseph S. Myers + + * wtf/acronyms.comp: Update from NetBSD CVS. + +2004-04-24 Joseph S. Myers + + * backgammon/common_source/fancy.c, fortune/datfiles/farber: + Update from NetBSD CVS. + +2004-04-12 Joseph S. Myers + + * phantasia/fight.c, phantasia/gamesupport.c, + phantasia/interplayer.c, phantasia/io.c, phantasia/main.c, + phantasia/misc.c: Update from NetBSD CVS. + +2004-04-08 Joseph S. Myers + + * mille/move.c, phantasia/fight.c, phantasia/gamesupport.c, + phantasia/include.h, phantasia/interplayer.c, phantasia/io.c, + phantasia/main.c, phantasia/misc.c, phantasia/phantstruct.h, + phantasia/setup.c, worms/worms.c, wtf/acronyms, wtf/acronyms.comp: + Update from NetBSD CVS. + +2004-03-29 Joseph S. Myers + + * fortune/datfiles/fortunes2, fortune/datfiles/fortunes2-o.real, + hack/data, hack/rumors: Update from NetBSD CVS. + +2004-03-27 Joseph S. Myers + + * wtf/acronyms, wtf/acronyms.comp: Update from NetBSD CVS. + +2004-03-12 Joseph S. Myers + + * wtf/acronyms, wtf/acronyms.comp: Update from NetBSD CVS. + +2004-03-05 Joseph S. Myers + + * wtf/acronyms: Update from NetBSD CVS. + +2004-03-04 Joseph S. Myers + + * wtf/acronyms.comp: Update from NetBSD CVS. + +2004-02-28 Joseph S. Myers + + * fortune/datfiles/fortunes2: Update from NetBSD CVS. + +2004-02-18 Joseph S. Myers + + * wtf/acronyms: Update from NetBSD CVS. + +2004-02-14 Joseph S. Myers + + * fortune/datfiles/fortunes, fortune/datfiles/fortunes.sp.ok, + rogue/USD.doc/rogue.me: Update from NetBSD CVS. + * NEWS: Fix typo. + * ChangeLog: Mark properly for 2.16 release. + +2004-02-13 Joseph S. Myers + + * Version 2.16. + + * NEWS, bsd-games.lsm, bsd-games-non-free.lsm: Update. + + * morse/morse.c: Update from NetBSD CVS. + + * morse/morse.c: Encode and decode more characters. Don't put + commas after every character. Don't encode whitespace as "...". + Don't fail decoding across a 1024-byte boundary. Mark end of + message appropriately. From OpenBSD but with punctuation taken + from ITU-T Recommendation F.1 (03/98). + * tests/morse.testsent, tests/morse.testsentd: New tests. + * tests/morse.SOS, tests/morse.foo, tests/morse.sos: Update. + * tests/morse.test: Update. + +2004-02-11 Joseph S. Myers + + * tests/pom.2003fm1, tests/pom.2003fm2, tests/pom.2003fq1, + tests/pom.2003fq2, tests/pom.2003lq1, tests/pom.2003lq2, + tests/pom.2003nm1, tests/pom.2003nm2, tests/pom.2003ph1, + tests/pom.2003ph2, tests/pom.2003ph3, tests/pom.2003ph4, + tests/pom.2003ph5, tests/pom.2003ph6, tests/pom.2003ph7, + tests/pom.2003ph8: New tests. + * tests/pom.test: Update. + +2004-02-10 Joseph S. Myers + + * primes/primes.6: Update from NetBSD CVS. + +2004-02-09 Joseph S. Myers + + * configure: Ask for a documentation directory if building trek or + rogue. + * Makeconfig.in (DOCDIR): Define. + * substfiles2: Add trek/trek.6. + * trek/trek.6: Rename to trek/trek.6.in. + * trek/trek.6.in: Mark documentation directory for substitution. + * rogue/Makefrag, trek/Makefrag: Install USD documents. + * INSTALL, PACKAGING, README: Update. + +2004-02-08 Joseph S. Myers + + * backgammon/backgammon/main.c, backgammon/teachgammon/teach.c, + cribbage/cribbage.h, dm/dm.c, fortune/unstr/unstr.c, + hunt/hunt/hunt.c, hunt/hunt/otto.c, hunt/huntd/faketalk.c, + hunt/huntd/hunt.h, phantasia/Makefile.bsd, rain/rain.c, + worms/worms.c: Update from NetBSD CVS. + + * rain/rain.c, worms/worms.c: Hide the cursor with curs_set(0). + From OpenBSD. + + * tests/factor.8675309, tests/factor.6172538568: New tests (from + NetBSD src/regress). + * tests/factor.test: Update. + + * boggle/README.linux, dm/README.linux, fortune/README.linux, + hunt/README.linux, trek/README.linux: Remove. + * README: Move information from those files to here. + * INSTALL: Update. + * COPYING: Update. + + * factor/Makefile.bsd, factor/factor.6, factor/factor.c, + primes/Makefile.bsd, primes/primes.6: Update from NetBSD CVS. + + * TODO: Update. + + * substscr: Explicitly set execute permissions from those of + source file. + + * primes/primes.6: Separate manpage from that of factor. + * primes/Makefrag: Update. + * factor/factor.6: Change to be a manpage for factor only. + + * factor/factor.c: Only use Pollard p-1 if remaining factor isn't + prime. Correct comment. Increase base if p-1 algorithm reaches + 1. + * tests/factor.2147483647111311, tests/factor.99999999999991: New + tests. + * tests/factor.test: Update. + Bugs reported by David A Bagley . + + * countmail/countmail.6, phantasia/fight.c, phantasia/io.c, + sail/extern.h, sail/misc.c, snake/snake/snake.c: Update from + NetBSD CVS. + +2004-01-27 Joseph S. Myers + + * dab/.cvsignore: New file. + + * Makeconfig.in: Add STRLCPY_DEFS and GETPROGNAME_DEFS. + * arithmetic/Makefrag, fortune/fortune/Makefrag, rogue/Makefrag: + Use them. + + * dm/utmpentry.c, dm/utmpentry.h: New from NetBSD CVS of + usr.bin/who. + * COPYING: Update. + * dm/dm.c: Follow NetBSD in use of this utmp handling. + * dm/Makefrag: Update. + * exec.objs: Update. + + * lib/getprogname.c: New file. + * include/stdlib.h: Update. + * configure: Check for getprogname. + * arithmetic/arithmetic.c, fortune/fortune/fortune.c: Follow + NetBSD in use of getprogname(). + * exec.objs: Update. + + * adventure/extern.h, adventure/main.c, arithmetic/arithmetic.c, + atc/extern.h, atc/input.c, backgammon/backgammon/backlocal.h, + backgammon/backgammon/move.c, backgammon/common_source/back.h, + backgammon/teachgammon/tutor.h, banner/banner.c, + battlestar/battlestar.c, battlestar/extern.h, battlestar/fly.c, + battlestar/init.c, battlestar/parse.c, bcd/bcd.c, + boggle/boggle/bog.c, boggle/boggle/extern.h, boggle/boggle/mach.c, + boggle/boggle/prtable.c, boggle/boggle/timer.c, caesar/caesar.c, + canfield/canfield/canfield.c, canfield/cfscores/cfscores.c, + cribbage/crib.c, cribbage/cribbage.h, dm/dm.c, fish/fish.c, + fortune/fortune/fortune.c, fortune/unstr/unstr.c, gomoku/gomoku.h, + gomoku/main.c, gomoku/pickmove.c, hack/def.func_tab.h, + hack/extern.h, hack/hack.apply.c, hack/hack.do.c, hack/hack.h, + hack/hack.invent.c, hack/hack.main.c, hack/hack.shk.c, + hack/hack.vault.c, hack/hack.zap.c, hangman/hangman.h, + hunt/hunt/hunt.c, hunt/hunt/otto.c, hunt/hunt/playit.c, + hunt/huntd/driver.c, hunt/huntd/execute.c, hunt/huntd/expl.c, + hunt/huntd/faketalk.c, hunt/huntd/hunt.h, hunt/huntd/makemaze.c, + hunt/huntd/shots.c, hunt/huntd/talk_ctl.h, mille/mille.h, + mille/table.c, mille/varpush.c, monop/cards.c, monop/execute.c, + monop/getinp.c, monop/houses.c, monop/malloc.c, monop/monop.c, + monop/monop.def, monop/monop.ext, monop/monop.h, monop/morg.c, + monop/print.c, monop/prop.c, monop/trade.c, morse/morse.c, + number/number.c, pig/pig.c, pom/pom.c, ppt/ppt.c, primes/primes.c, + quiz/quiz.c, quiz/quiz.h, quiz/rxp.c, rain/rain.c, + random/random.c, robots/auto.c, robots/main.c, robots/robots.h, + robots/score.c, rogue/main.c, rogue/rogue.h, sail/extern.h, + sail/pl_1.c, sail/sync.c, snake/snake/snake.c, + snake/snscore/snscore.c, tetris/input.h, tetris/scores.c, + tetris/scores.h, tetris/screen.c, tetris/screen.h, + tetris/tetris.c, tetris/tetris.h, trek/compkl.c, trek/computer.c, + trek/dumpgame.c, trek/getpar.c, trek/getpar.h, trek/main.c, + trek/torped.c, trek/trek.h, worm/worm.c, worms/worms.c, + wump/wump.c: Update from NetBSD CVS. + + * adventure/extern.h, adventure/main.c, arithmetic/arithmetic.c, + atc/extern.h, atc/input.c, backgammon/backgammon/backlocal.h, + backgammon/backgammon/move.c, backgammon/common_source/back.h, + backgammon/teachgammon/tutor.h, banner/banner.c, + battlestar/battlestar.c, battlestar/extern.h, battlestar/fly.c, + battlestar/init.c, battlestar/parse.c, bcd/bcd.c, + boggle/boggle/bog.c, boggle/boggle/extern.h, boggle/boggle/mach.c, + boggle/boggle/prtable.c, boggle/boggle/timer.c, caesar/caesar.c, + canfield/canfield/canfield.c, canfield/cfscores/cfscores.c, + cribbage/crib.c, cribbage/cribbage.h, dm/dm.c, fish/fish.c, + fortune/fortune/fortune.c, fortune/unstr/unstr.c, gomoku/gomoku.h, + gomoku/main.c, hack/def.func_tab.h, hack/extern.h, + hack/hack.apply.c, hack/hack.do.c, hack/hack.h, + hack/hack.invent.c, hack/hack.main.c, hack/hack.shk.c, + hack/hack.vault.c, hack/hack.zap.c, hangman/hangman.h, + hunt/hunt/hunt.c, hunt/hunt/otto.c, hunt/hunt/playit.c, + hunt/huntd/driver.c, hunt/huntd/execute.c, hunt/huntd/expl.c, + hunt/huntd/faketalk.c, hunt/huntd/hunt.h, hunt/huntd/makemaze.c, + hunt/huntd/shots.c, hunt/huntd/talk_ctl.h, mille/mille.h, + mille/table.c, mille/varpush.c, monop/cards.c, monop/execute.c, + monop/getinp.c, monop/houses.c, monop/monop.c, monop/monop.def, + monop/monop.ext, monop/monop.h, monop/morg.c, monop/print.c, + monop/prop.c, monop/trade.c, monop/malloc.c, morse/morse.c, + number/number.c, pig/pig.c, pom/pom.c, ppt/ppt.c, primes/primes.c, + quiz/quiz.c, quiz/quiz.h, quiz/rxp.c, rain/rain.c, + random/random.c, robots/auto.c, robots/main.c, robots/robots.h, + robots/score.c, rogue/main.c, rogue/rogue.h, snake/snake/snake.c, + snake/snscore/snscore.c, tetris/input.h, tetris/scores.c, + tetris/scores.h, tetris/screen.c, tetris/screen.h, + tetris/tetris.c, tetris/tetris.h, trek/compkl.c, trek/computer.c, + trek/dumpgame.c, trek/getpar.c, trek/getpar.h, trek/main.c, + trek/torped.c, trek/trek.h, worm/worm.c, worms/worms.c, + wump/wump.c: Remove uses of __P. + + * THANKS: Mention David A Bagley. + + * sail/pl_1.c (child): Use int for wait status. + + * gomoku/gomoku.h, robots/robots.h, sail/extern.h, sail/misc.c, + sail/sync.c: Adjust system header includes. + + * fortune/fortune/fortune.6.in: Update substitution for path to + fortunes directory. + + * cribbage/crib.c, cribbage/cribbage.h, cribbage/io.c, + dab/Makefile.bsd, monop/misc.c, monop/monop.def, monop/monop.ext: + Update from NetBSD CVS. + +2004-01-26 Joseph S. Myers + + * sail/main.c: Reorder includes to match NetBSD. + + * cribbage/cribbage.h, cribbage/crib.c, cribbage/io.c: Rename + receive_int to receive_intr. + + * hack/hack.pri.c: Fix typo in merge from NetBSD. + + * configure: Consistently use balanced parentheses in case + statements. + +2004-01-25 Joseph S. Myers + + * monop/misc.c, monop/monop.def, monop/monop.ext: Rename yn to + yncoms. + + * cribbage/cribbage.h, cribbage/crib.c, cribbage/io.c: Rename rint + to receive_int. + + * fortune/fortune/fortune.c: Add test for __CYGWIN__. + * configure: Test for sig_t. + * include/signal.h: Use it. + Cygwin issues reported by David A Bagley . + +2004-01-16 Joseph S. Myers + + * wtf/acronyms, wtf/acronyms.comp: Update from NetBSD CVS. + +2004-01-14 Joseph S. Myers + + * wtf/acronyms, wtf/acronyms.comp: Update from NetBSD CVS. + +2004-01-04 Joseph S. Myers + + * COPYING: Note that TODO no longer contains anything from the + original bsd-games 1.3. + + * phantasia/phantasia.6, wtf/acronyms, wtf/acronyms.comp: Update + from NetBSD CVS. + +2004-01-02 Joseph S. Myers + + * atc/atc.6.in, backgammon/backgammon/main.c, + backgammon/teachgammon/data.c, caesar/caesar.c, + fortune/datfiles/fortunes, fortune/datfiles/fortunes2, + fortune/fortune/fortune.c, hack/hack.options.c, phantasia/main.c, + phantasia/misc.c, rogue/Makefile.bsd, rogue/rogue.h, + wargames/wargames.6, worm/worm.6, wtf/acronyms: Update from NetBSD + CVS. + * dab: New directory from NetBSD CVS. + * COPYING, INSTALL, README, bsd-games.lsm, Makeconfig.in, + configure, exec.libs, exec.objs: Update. + * dab/Makefrag: New file. + +2003-12-18 Joseph S. Myers + + * Version 2.15. + + * NEWS, bsd-games.lsm, bsd-games-non-free.lsm: Update. + + * README: Update. + +2003-12-17 Joseph S. Myers + + * backgammon/backgammon/main.c (main): Only score as a Gammon or a + Backgammon if the opponent hasn't removed any pieces, not if the + opponent has removed pieces but has had a piece knocked back to + the bar afterwards. Fixes Debian bug 185101 from Konstantin + Seiler . + + * fortune/fortune/fortune.c (fortlen): Return proper fortune + length for fortune files without STR_RANDOM or STR_ORDERED rather + than comparing it to SLEN. Bug reported by Simon Williams + . + + * fortune/fortune/fortune.c (init_prob): Show residual probability + rather than non-residual in "No place to put residual probability" + error message. Distribute residual probability correctly rather + than all to one file. Patch from Mike Castle + . + + * configure, Makeconfig.in, fortune/fortune/pathnames.h.in, + fortune/datfiles/Makefrag: Make fortune directory configurable; + default to NetBSD default. + + * rogue/Makefrag: Don't use -fwritable-strings. + * rogue/rogue.h (struct id): Add const. + * TODO: Update. + + * backgammon/teachgammon/data.c: Make tutorial text match actual + moves. From FreeBSD via OpenBSD. Fixes Debian bug 212478 from + Jim W. Jaszewski . + + * adventure/glorkz: Fix capitalisation of compass directions. + + * phantasia/main.c (cleanup): Only close files that have been + opened successfully. + * phantasic/misc.c (error): Give error text rather than errno + number. + Patch from Joey Hess for Debian bug 187251 from + Mikael Hedin . + + * wtf/acronyms: Add two acronyms suggested by Pavel Machek + . + + * wargames/wargames.6: Fix typo. Patch from Joey Hess + . + + * hack/hack.options.c (parseoptions): Refer to 'O' rather than 'o' + as command to set options. Bug reported by Christian Garbs + in Debian bug 191452. + + * caesar/caesar.c (main): Make dot and winnerdot of type double. + Patch from Jan Vornberger in Debian bug 197816. + * tests/caesar.197816in, tests/caesar.197816out: New tests. + * tests/caesar.test: Update. + + * worm/worm.6: Score is in upper right corner, not upper left + corner. Patch from Robert Hunter in + Debian bug 209034. + + * atc/atc.6.in: Document that pressing return allows you to "fast + forward" the game clock. Patch from Peter Maydell + in Debian bug 216980. + + * PACKAGING: Remove some old version references. + + * INSTALL: Simplify and remove some obsolete information. + + * adventure/Makefile.bsd, adventure/adventure.6, adventure/crc.c, + adventure/done.c, adventure/hdr.h, adventure/init.c, + adventure/io.c, adventure/main.c, adventure/save.c, + adventure/setup.c, adventure/subr.c, adventure/vocab.c, + adventure/wizard.c, arithmetic/arithmetic.6, + arithmetic/arithmetic.c, atc/Makefile.bsd, atc/atc.6.in, + atc/def.h, atc/extern.c, atc/extern.h, atc/grammar.y, + atc/graphics.c, atc/include.h, atc/input.c, atc/lex.l, atc/list.c, + atc/log.c, atc/main.c, atc/pathnames.h.in, atc/struct.h, + atc/tunable.c, atc/tunable.h, atc/update.c, + backgammon/backgammon/backgammon.6.in, + backgammon/backgammon/extra.c, backgammon/backgammon/main.c, + backgammon/backgammon/move.c, backgammon/backgammon/text.c, + backgammon/backgammon/version.c, backgammon/common_source/allow.c, + backgammon/common_source/back.h, backgammon/common_source/board.c, + backgammon/common_source/check.c, + backgammon/common_source/fancy.c, backgammon/common_source/init.c, + backgammon/common_source/odds.c, backgammon/common_source/one.c, + backgammon/common_source/save.c, backgammon/common_source/subs.c, + backgammon/common_source/table.c, backgammon/teachgammon/data.c, + backgammon/teachgammon/teach.c, backgammon/teachgammon/ttext1.c, + backgammon/teachgammon/ttext2.c, backgammon/teachgammon/tutor.c, + backgammon/teachgammon/tutor.h, banner/banner.6, banner/banner.c, + battlestar/battlestar.6, battlestar/battlestar.c, + battlestar/command1.c, battlestar/command2.c, + battlestar/command3.c, battlestar/command4.c, + battlestar/command5.c, battlestar/command6.c, + battlestar/command7.c, battlestar/cypher.c, battlestar/dayfile.c, + battlestar/dayobjs.c, battlestar/extern.h, battlestar/fly.c, + battlestar/getcom.c, battlestar/globals.c, battlestar/init.c, + battlestar/misc.c, battlestar/nightfile.c, battlestar/nightobjs.c, + battlestar/parse.c, battlestar/pathnames.h.in, battlestar/room.c, + battlestar/save.c, battlestar/words.c, bcd/bcd.6, bcd/bcd.c, + boggle/Makefile.bsd, boggle/boggle/bog.c, boggle/boggle/bog.h.in, + boggle/boggle/boggle.6, boggle/boggle/extern.h, + boggle/boggle/help.c, boggle/boggle/mach.c, + boggle/boggle/prtable.c, boggle/boggle/timer.c, + boggle/boggle/word.c, boggle/mkdict/mkdict.c, + boggle/mkindex/mkindex.c, caesar/caesar.6, caesar/caesar.c, + canfield/canfield/canfield.6.in, canfield/canfield/canfield.c, + canfield/canfield/pathnames.h.in, canfield/cfscores/cfscores.c, + countmail/countmail.6, cribbage/cards.c, cribbage/crib.c, + cribbage/cribbage.6.in, cribbage/cribbage.h, cribbage/cribcur.h, + cribbage/deck.h, cribbage/extern.c, cribbage/instr.c, + cribbage/io.c, cribbage/pathnames.h.in, cribbage/score.c, + cribbage/support.c, dm/dm.8.in, dm/dm.c, dm/dm.conf.5.in, + dm/pathnames.h.in, factor/factor.6, factor/factor.c, fish/fish.6, + fish/fish.c, fish/pathnames.h.in, fortune/datfiles/Makefile.bsd, + fortune/datfiles/farber, fortune/datfiles/fortunes, + fortune/datfiles/fortunes-o.real, fortune/datfiles/fortunes2, + fortune/datfiles/fortunes2-o.real, fortune/datfiles/limerick, + fortune/datfiles/limerick-o.real, fortune/datfiles/netbsd, + fortune/datfiles/netbsd-o.real, fortune/datfiles/startrek, + fortune/datfiles/startrek.sp.ok, fortune/datfiles/zippy, + fortune/datfiles/zippy.sp.ok, fortune/fortune/fortune.6.in, + fortune/fortune/fortune.c, fortune/fortune/pathnames.h.in, + fortune/strfile/strfile.8, fortune/strfile/strfile.c, + fortune/strfile/strfile.h, fortune/unstr/unstr.c, gomoku/bdinit.c, + gomoku/bdisp.c, gomoku/gomoku.6, gomoku/gomoku.h, gomoku/main.c, + gomoku/makemove.c, gomoku/pickmove.c, gomoku/stoc.c, + hack/COPYRIGHT, hack/COPYRIGHT-JF, hack/Makefile.bsd, + hack/alloc.c, hack/config.h, hack/date.h, hack/def.edog.h, + hack/def.eshk.h, hack/def.flag.h, hack/def.func_tab.h, + hack/def.gen.h, hack/def.gold.h, hack/def.mkroom.h, + hack/def.monst.h, hack/def.obj.h, hack/def.objclass.h, + hack/def.objects.h, hack/def.permonst.h, hack/def.rm.h, + hack/def.trap.h, hack/def.wseg.h, hack/hack.6.in, + hack/hack.Decl.c, hack/hack.apply.c, hack/hack.bones.c, + hack/hack.c, hack/hack.cmd.c, hack/hack.do.c, hack/hack.do_name.c, + hack/hack.do_wear.c, hack/hack.dog.c, hack/hack.eat.c, + hack/hack.end.c, hack/hack.engrave.c, hack/hack.fight.c, + hack/hack.h, hack/hack.invent.c, hack/hack.ioctl.c, + hack/hack.lev.c, hack/hack.main.c, hack/hack.makemon.c, + hack/hack.mfndpos.h, hack/hack.mhitu.c, hack/hack.mklev.c, + hack/hack.mkmaze.c, hack/hack.mkobj.c, hack/hack.mkshop.c, + hack/hack.mon.c, hack/hack.monst.c, hack/hack.o_init.c, + hack/hack.objnam.c, hack/hack.options.c, hack/hack.pager.c, + hack/hack.potion.c, hack/hack.pri.c, hack/hack.read.c, + hack/hack.rip.c, hack/hack.rumors.c, hack/hack.save.c, + hack/hack.search.c, hack/hack.sh, hack/hack.shk.c, + hack/hack.shknam.c, hack/hack.steal.c, hack/hack.termcap.c, + hack/hack.timeout.c, hack/hack.topl.c, hack/hack.track.c, + hack/hack.trap.c, hack/hack.tty.c, hack/hack.u_init.c, + hack/hack.unix.c, hack/hack.vault.c, hack/hack.version.c, + hack/hack.wield.c, hack/hack.wizard.c, hack/hack.worm.c, + hack/hack.worn.c, hack/hack.zap.c, hack/makedefs.c, + hack/pathnames.h.in, hack/rnd.c, hangman/endgame.c, + hangman/extern.c, hangman/getguess.c, hangman/getword.c, + hangman/hangman.6.in, hangman/hangman.h, hangman/main.c, + hangman/pathnames.h.in, hangman/playgame.c, hangman/prdata.c, + hangman/prman.c, hangman/prword.c, hangman/setup.c, + hunt/Makefile.inc.bsd, hunt/hunt/connect.c, hunt/hunt/hunt.6.in, + hunt/hunt/hunt.c, hunt/hunt/otto.c, hunt/hunt/playit.c, + hunt/huntd/answer.c, hunt/huntd/bsd.h, hunt/huntd/ctl.c, + hunt/huntd/ctl_transact.c, hunt/huntd/draw.c, hunt/huntd/driver.c, + hunt/huntd/execute.c, hunt/huntd/expl.c, hunt/huntd/extern.c, + hunt/huntd/faketalk.c, hunt/huntd/get_names.c, hunt/huntd/hunt.h, + hunt/huntd/huntd.6.in, hunt/huntd/makemaze.c, + hunt/huntd/pathname.c, hunt/huntd/shots.c, hunt/huntd/talk_ctl.h, + hunt/huntd/terminal.c, mille/comp.c, mille/end.c, mille/extern.c, + mille/init.c, mille/mille.6, mille/mille.c, mille/mille.h, + mille/misc.c, mille/move.c, mille/print.c, mille/roll.c, + mille/save.c, mille/table.c, mille/types.c, mille/varpush.c, + monop/Makefile.bsd, monop/brd.dat, monop/cards.c, monop/deck.h, + monop/execute.c, monop/getinp.c, monop/houses.c, monop/initdeck.c, + monop/jail.c, monop/malloc.c, monop/misc.c, monop/mon.dat, + monop/monop.6.in, monop/monop.c, monop/monop.def, monop/monop.ext, + monop/monop.h, monop/morg.c, monop/pathnames.h.in, monop/print.c, + monop/prop.c, monop/prop.dat, monop/rent.c, monop/roll.c, + monop/spec.c, monop/trade.c, morse/morse.c, number/number.6, + number/number.c, phantasia/Makefile.bsd, phantasia/main.c, + phantasia/misc.c, phantasia/pathnames.h.in, phantasia/phantasia.6, + phantasia/phantglobs.h, phantasia/setup.c, pig/pig.6, pig/pig.c, + pom/pom.6, pom/pom.c, ppt/ppt.c, primes/pattern.c, + primes/pr_tbl.c, primes/primes.c, primes/primes.h, + quiz/pathnames.h.in, quiz/quiz.6.in, quiz/quiz.c, quiz/quiz.h, + quiz/rxp.c, rain/rain.6, rain/rain.c, random/random.6, + random/random.c, robots/extern.c, robots/flush_in.c, + robots/init_field.c, robots/main.c, robots/make_level.c, + robots/move.c, robots/move_robs.c, robots/pathnames.h.in, + robots/play_level.c, robots/query.c, robots/rnd_pos.c, + robots/robots.6.in, robots/robots.h, robots/score.c, + rogue/USD.doc/Makefile.bsd, rogue/USD.doc/rogue.me, rogue/hit.c, + rogue/init.c, rogue/inventory.c, rogue/level.c, rogue/machdep.c, + rogue/main.c, rogue/message.c, rogue/monster.c, rogue/move.c, + rogue/object.c, rogue/pack.c, rogue/pathnames.h.in, rogue/play.c, + rogue/random.c, rogue/ring.c, rogue/rogue.6.in, rogue/rogue.h, + rogue/room.c, rogue/save.c, rogue/score.c, rogue/spec_hit.c, + rogue/throw.c, rogue/trap.c, rogue/use.c, rogue/zap.c, + sail/assorted.c, sail/dr_1.c, sail/dr_2.c, sail/dr_3.c, + sail/dr_4.c, sail/dr_5.c, sail/dr_main.c, sail/driver.h, + sail/extern.h, sail/game.c, sail/globals.c, sail/lo_main.c, + sail/machdep.h, sail/main.c, sail/misc.c, sail/parties.c, + sail/pathnames.h.in, sail/pl_1.c, sail/pl_2.c, sail/pl_3.c, + sail/pl_4.c, sail/pl_5.c, sail/pl_6.c, sail/pl_7.c, + sail/pl_main.c, sail/player.h, sail/sail.6, sail/sync.c, + sail/version.c, snake/snake/pathnames.h.in, + snake/snake/snake.6.in, snake/snake/snake.c, + snake/snscore/snscore.c, tetris/input.c, tetris/input.h, + tetris/pathnames.h.in, tetris/scores.c, tetris/scores.h, + tetris/screen.c, tetris/screen.h, tetris/shapes.c, + tetris/tetris.6.in, tetris/tetris.c, tetris/tetris.h, + trek/USD.doc/Makefile.bsd, trek/USD.doc/trek.me, trek/abandon.c, + trek/attack.c, trek/autover.c, trek/capture.c, trek/cgetc.c, + trek/check_out.c, trek/checkcond.c, trek/compkl.c, + trek/computer.c, trek/damage.c, trek/damaged.c, trek/dcrept.c, + trek/destruct.c, trek/dock.c, trek/dumpgame.c, trek/dumpme.c, + trek/dumpssradio.c, trek/events.c, trek/externs.c, trek/getcodi.c, + trek/getpar.c, trek/getpar.h, trek/help.c, trek/impulse.c, + trek/initquad.c, trek/kill.c, trek/klmove.c, trek/lose.c, + trek/lrscan.c, trek/main.c, trek/move.c, trek/nova.c, trek/out.c, + trek/phaser.c, trek/play.c, trek/ram.c, trek/ranf.c, trek/rest.c, + trek/schedule.c, trek/score.c, trek/setup.c, trek/setwarp.c, + trek/shield.c, trek/snova.c, trek/srscan.c, trek/systemname.c, + trek/torped.c, trek/trek.6, trek/trek.h, trek/visual.c, + trek/warp.c, trek/win.c, worm/worm.6, worm/worm.c, worms/worms.6, + worms/worms.c, wtf/wtf.in, wtf/wtf.6.in, wump/pathnames.h.in, + wump/wump.6, wump/wump.c: Update from NetBSD CVS. + * wtf/acronyms: Update from NetBSD CVS. + * wtf/acronyms.comp: New file from NetBSD CVS. + * wtf/Makefrag: Update. + * COPYING: Update. + * INSTALL: Note that glibc 2.3 now required at least for hunt (for + ). + +2003-11-08 Joseph S. Myers + + * THANKS: Update Malcolm Parsons's email address. + +2003-04-01 Joseph S. Myers + + * Version 2.14. + + * configure: Fix bug in OpenSSL support. + + * NEWS, bsd-games.lsm, bsd-games-non-free.lsm: Update. + + * configure, Makeconfig.in, exec.libs: Support OpenSSL for factor. + * INSTALL: Update. + * tests/factor.987654321987654, + tests/factor.987654321987654321987: New files. + * tests/factor.test: Update. + +2003-03-29 Joseph S. Myers + + * hack/COPYRIGHT, hack/COPYRIGHT-JF, hack/alloc.c, hack/config.h, + hack/date.h, hack/def.edog.h, hack/def.eshk.h, hack/def.flag.h, + hack/def.func_tab.h, hack/def.gen.h, hack/def.gold.h, + hack/def.mkroom.h, hack/def.monst.h, hack/def.obj.h, + hack/def.objclass.h, hack/def.objects.h, hack/def.permonst.h, + hack/def.rm.h, hack/def.trap.h, hack/def.wseg.h, hack/hack.6.in, + hack/hack.Decl.c, hack/hack.apply.c, hack/hack.bones.c, + hack/hack.c, hack/hack.cmd.c, hack/hack.do.c, hack/hack.do_name.c, + hack/hack.do_wear.c, hack/hack.dog.c, hack/hack.eat.c, + hack/hack.end.c, hack/hack.engrave.c, hack/hack.fight.c, + hack/hack.h, hack/hack.invent.c, hack/hack.ioctl.c, + hack/hack.lev.c, hack/hack.main.c, hack/hack.makemon.c, + hack/hack.mfndpos.h, hack/hack.mhitu.c, hack/hack.mklev.c, + hack/hack.mkmaze.c, hack/hack.mkobj.c, hack/hack.mkshop.c, + hack/hack.mon.c, hack/hack.monst.c, hack/hack.o_init.c, + hack/hack.objnam.c, hack/hack.options.c, hack/hack.pager.c, + hack/hack.potion.c, hack/hack.pri.c, hack/hack.read.c, + hack/hack.rip.c, hack/hack.rumors.c, hack/hack.save.c, + hack/hack.search.c, hack/hack.sh, hack/hack.shk.c, + hack/hack.shknam.c, hack/hack.steal.c, hack/hack.termcap.c, + hack/hack.timeout.c, hack/hack.topl.c, hack/hack.track.c, + hack/hack.trap.c, hack/hack.tty.c, hack/hack.u_init.c, + hack/hack.unix.c, hack/hack.vault.c, hack/hack.version.c, + hack/hack.wield.c, hack/hack.wizard.c, hack/hack.worm.c, + hack/hack.worn.c, hack/hack.zap.c, hack/makedefs.c, hack/rnd.c: + Hack is now BSD-licensed. Thanks to Andries Brouwer, Jay Fenlason + and CWI . Via + OpenBSD. + * COPYING, README, README.non-free, bsd-games.lsm, + bsd-games-non-free.lsm: Update. + + * quiz/datfiles/europe: Yugoslavia has changed its name to Serbia + and Montenegro. + + * quiz/datfiles/europe: The Hague is not the capital of the + Netherlands. Reported by Hugo van Galen (in the + Netherlands) and Florian Boehl . + +2003-03-28 Joseph S. Myers + + * Makefile.bsd, Makefile.inc.bsd, adventure/Makefile.bsd, + arithmetic/arithmetic.6, arithmetic/arithmetic.c, atc/atc.6.in, + backgammon/backgammon/backgammon.6.in, + backgammon/common_source/Makefile.bsd, + backgammon/teachgammon/Makefile.bsd, banner/banner.6, + battlestar/battlestar.6, bcd/bcd.6, boggle/Makefile.bsd, + boggle/boggle/boggle.6, boggle/boggle/timer.c, + boggle/mkdict/Makefile.bsd, boggle/mkindex/Makefile.bsd, + caesar/caesar.6, canfield/canfield/canfield.6.in, + canfield/cfscores/Makefile.bsd, countmail/countmail, + countmail/countmail.6, cribbage/cribbage.6.in, + cribbage/cribbage.h, cribbage/extern.c, cribbage/io.c, + cribbage/score.c, cribbage/support.c, dm/Makefile.bsd, dm/dm.8.in, + dm/dm.c, dm/dm.conf.5.in, factor/Makefile.bsd, factor/factor.6, + factor/factor.c, fortune/datfiles/Makefile.bsd, + fortune/datfiles/fortunes, fortune/datfiles/fortunes2, + fortune/datfiles/fortunes2-o.real, fortune/datfiles/limerick, + fortune/datfiles/netbsd, fortune/fortune/fortune.6.in, + fortune/fortune/fortune.c, fortune/strfile/strfile.8, + fortune/unstr/Makefile.bsd, gomoku/gomoku.6, hack/Makefile.bsd, + hack/extern.h, hack/hack.6.in, hack/hack.main.c, + hack/hack.mkshop.c, hack/hack.pri.c, hack/hack.topl.c, + hack/hack.tty.c, hack/help, hangman/hangman.6.in, + hunt/Makefile.inc.bsd, hunt/hunt/hunt.6.in, hunt/hunt/hunt.c, + hunt/hunt/playit.c, hunt/huntd/answer.c, hunt/huntd/bsd.h, + hunt/huntd/ctl_transact.c, hunt/huntd/driver.c, + hunt/huntd/extern.c, hunt/huntd/faketalk.c, hunt/huntd/hunt.h, + hunt/huntd/huntd.6.in, hunt/huntd/terminal.c, mille/mille.6, + mille/misc.c, monop/Makefile.bsd, monop/cards.c, monop/getinp.c, + monop/monop.6.in, monop/roll.c, morse/Makefile.bsd, + phantasia/Makefile.bsd, phantasia/misc.c, phantasia/phantasia.6, + pom/pom.6, ppt/Makefile.bsd, ppt/ppt.c, primes/Makefile.bsd, + quiz/datfiles/posneg, quiz/quiz.6.in, quiz/rxp.c, rain/rain.6, + random/random.6, robots/auto.c, robots/init_field.c, + robots/move.c, robots/robots.6.in, robots/robots.h, + rogue/Makefile.bsd, rogue/USD.doc/Makefile.bsd, rogue/hit.c, + rogue/inventory.c, rogue/level.c, rogue/message.c, + rogue/rogue.6.in, rogue/rogue.h, rogue/save.c, rogue/score.c, + sail/sail.6, snake/snake/snake.6.in, snake/snscore/Makefile.bsd, + tetris/input.c, tetris/scores.c, tetris/screen.c, tetris/shapes.c, + tetris/tetris.6.in, tetris/tetris.c, trek/USD.doc/Makefile.bsd, + trek/damage.c, trek/getpar.c, trek/trek.6.in, wargames/wargames.6, + worm/worm.6, worms/worms.6, wtf/acronyms, wtf/wtf.in, + wtf/wtf.6.in: Update from NetBSD CVS. + * include/sys/poll.h: New file. + * lib/strlcpy.c: New file. + * configure: Test for strlcpy. + * include/string.h: New file. + * exec.objs: Use it for rogue. + * trek/trek.6.in: Rename to trek.6. + * substfiles2: Update. + * COPYING: Update. + * INSTALL: No longer suggest not using groff's macros. + * PACKAGING: Update. + * SECURITY: Update. + +2002-06-18 Joseph S. Myers + + * BUGS, ChangeLog, INSTALL, README, README.non-free, SECURITY, + TODO, bsd-games-non-free.lsm, bsd-games.lsm, dm/README.linux, + hunt/README.linux, trek/README.linux: Consistently use + jsm@polyomino.org.uk as email address. + +2002-01-26 Joseph S. Myers + + * hangman/extern.c, hangman/getword.c, hangman/hangman.6.in, + hangman/hangman.h, hangman/main.c: Update from NetBSD CVS. + +2002-01-20 Joseph S. Myers + + * README: Note this collection supports GNU Hurd as well as Linux. + * COPYING: Update. + +2002-01-19 Joseph S. Myers + + * phantasia/fight.c (encounter): Make firsthit and flockcnt + volatile. + + * backgammon/common_source/Makefile.bsd, + backgammon/teachgammon/Makefile.bsd, boggle/mkdict/Makefile.bsd, + boggle/mkindex/Makefile.bsd, canfield/cfscores/Makefile.bsd, + fortune/datfiles/netbsd, fortune/fortune/fortune.c, + fortune/unstr/Makefile.bsd, morse/Makefile.bsd, number/number.6, + phantasia/Makefile.bsd, ppt/Makefile.bsd, primes/Makefile.bsd, + snake/snscore/Makefile.bsd, wtf/acronyms: Update from NetBSD CVS. + + * hangman/main.c: Include . + + * hangman/extern.c, hangman/getword.c, hangman/hangman.6.in, + hangman/hangman.h, hangman/main.c: Allow minimum word length to be + set on the command line. Patch from Joey Hess . + * COPYING: Update. + +2001-12-29 Joseph S. Myers + + * phantasia/Makefrag (phantasia_install): Use $(INSTALL_PREFIX) + when copying score files. Patch from Joey Hess + . + * AUTHORS, THANKS: Update email address for Joey Hess. Patch from + Joey Hess . + +2001-12-08 Joseph S. Myers + + * battlestar/fly.c, cribbage/crib.c, fortune/datfiles/fortunes2, + fortune/datfiles/fortunes2-o.real, hangman/setup.c, mille/mille.c, + phantasia/Makefile.bsd, phantasia/main.c, robots/main.c, + rogue/init.c, sail/pl_7.c, worm/worm.c, wtf/acronyms: Update from + NetBSD CVS. + +2001-11-18 Joseph S. Myers + + * wtf/acronyms: Update from NetBSD CVS. + + * battlestar/com1.c: Rename to battlestar/command1.c. + * battlestar/com2.c: Rename to battlestar/command2.c. + * battlestar/com3.c: Rename to battlestar/command3.c. + * battlestar/com4.c: Rename to battlestar/command4.c. + * battlestar/com5.c: Rename to battlestar/command5.c. + * battlestar/com6.c: Rename to battlestar/command6.c. + * battlestar/com7.c: Rename to battlestar/command7.c. + From NetBSD CVS. + * exec.objs: Update. + * battlestar/Makefile.bsd, battlestar/command1.c, + battlestar/command2.c, battlestar/command3.c, + battlestar/command4.c, battlestar/command5.c, + battlestar/command6.c, battlestar/command7.c, + fortune/datfiles/Makefile.bsd, fortune/datfiles/limerick, + fortune/fortune/fortune.c, hack/hack.termcap.c, tetris/screen.c: + Update from NetBSD CVS. + * fortune/datfiles/farber: New file. From NetBSD CVS. + * fortune/datfiles/Makefrag: Update. + + * tetris/screen.c (scr_set): Set VMIN and VTIME. + +2001-10-06 Joseph S. Myers + + * backgammon/backgammon/main.c, hack/hack.fix, monop/monop.c, + phantasia/phantdefs.h, sail/pl_7.c, wargames/wargames: Update from + NetBSD CVS. + + * hunt/hunt/hunt.6.in: Correct slime costs. Bug reported by + Britton Leo Kerin . + +2001-09-02 Joseph S. Myers + + * adventure/setup.c, atc/include.h, boggle/mkdict/mkdict.c, + fortune/datfiles/fortunes, fortune/datfiles/fortunes-o.real, + monop/execute.c, sail/main.c, snake/snake/snake.c, worm/worm.6, + worm/worm.c, wump/wump.c, wtf/acronyms: Update from NetBSD CVS. + +2001-08-30 Joseph S. Myers + + * Version 2.13. + + * COPYING, NEWS, TODO, bsd-games-non-free.lsm, bsd-games.lsm: + Update. + * phantasia/Makefrag: Update copyright dates. + + * hunt/hunt/hunt.c, hunt/huntd/get_names.c: Define MAXHOSTNAMELEN + if not already defined. May fix Hurd compilation (original patch + from Igor Khavkine ). + + * snake/snake/snake.c (main): Control -d by #ifdef DEBUG; adjust + usage message accordingly. Bug reported by Malcolm Parsons + . + + * mille/save.c (save): Handle '\r' the same as '\n'. Bug reported + by Nicolas Lichtmaier . + + * snake/snake/snake.c (post): Always lseek back to the beginning + of the file. Patch from Malcolm Parsons + . + + * wump/wump.c (gcd): New function. + (cave_init): Ensure that gcd of (delta + 1) and room_num is 1. + Based on bug report and patch by . + + * worm/worm.c: Keep track of visible worm length. + (newpos): If nowhere is available for the new prize, have the + player win rather than hanging. Bug reported by Malcolm Parsons + . + + * phantasia/Makefrag: Use a stamp file for generating score files. + * phantasia/.cvsignore: Update. + +2001-08-29 Joseph S. Myers + + * worm/worm.c (main): Check for too small a screen size. + (newpos): Fix off-by-one error preventing the prize from being + placed on the top line. + (process): Position score appropriately for different width + screens. + + * worm/worm.c: Whitespace tweak. + + * worm/worm.c, worm/worm.6: Remove documented bug with long worm + lengths, and improve handling of non-standard screen sizes. From + OpenBSD. + + * wargames/wargames: Allow - in game names. Bug reported by Guus + Sliepen . + + * wtf/acronyms: Add AIUI. Suggestion from Adam Olsen + . + + * phantasia/Makefrag: Fix typo. + + * arithmetic/arithmetic.6, atc/atc.6.in, atc/list.c, + backgammon/backgammon/backgammon.6, + backgammon/teachgammon/teach.c, battlestar/battlestar.6, + battlestar/com2.c, battlestar/parse.c, bcd/bcd.6, + boggle/boggle/boggle.6, canfield/canfield/canfield.6.in, + cribbage/cribbage.6.in, factor/factor.6, fish/fish.6, + fortune/datfiles/fortunes, fortune/datfiles/fortunes2, + fortune/datfiles/fortunes2-o.real, fortune/datfiles/netbsd, + fortune/datfiles/startrek, fortune/fortune/fortune.6.in, + fortune/fortune/fortune.c, fortune/strfile/strfile.c, hack/date.h, + hack/def.func_tab.h, hack/def.monst.h, hack/def.objclass.h, + hack/def.objects.h, hack/def.permonst.h, hack/extern.h, + hack/hack.6.in, hack/hack.Decl.c, hack/hack.apply.c, + hack/hack.bones.c, hack/hack.c, hack/hack.cmd.c, hack/hack.do.c, + hack/hack.do_name.c, hack/hack.dog.c, hack/hack.eat.c, + hack/hack.end.c, hack/hack.engrave.c, hack/hack.fight.c, + hack/hack.h, hack/hack.invent.c, hack/hack.lev.c, + hack/hack.main.c, hack/hack.makemon.c, hack/hack.mhitu.c, + hack/hack.mklev.c, hack/hack.mkmaze.c, hack/hack.mkobj.c, + hack/hack.mkshop.c, hack/hack.mon.c, hack/hack.monst.c, + hack/hack.o_init.c, hack/hack.objnam.c, hack/hack.pager.c, + hack/hack.potion.c, hack/hack.pri.c, hack/hack.read.c, + hack/hack.rip.c, hack/hack.save.c, hack/hack.shk.c, + hack/hack.shknam.c, hack/hack.timeout.c, hack/hack.topl.c, + hack/hack.trap.c, hack/hack.tty.c, hack/hack.u_init.c, + hack/hack.unix.c, hack/hack.vault.c, hack/hack.wield.c , + hack/hack.wizard.c, hack/hack.zap.c, hack/makedefs.c, + hunt/hunt/hunt.6.in, hunt/huntd/ctl_transact.c, + hunt/huntd/huntd.6.in, mille/mille.c, monop/Makefile.bsd, + monop/initdeck.c, monop/monop.6.in, phantasia/Makefile.bsd, + phantasia/phantasia.6, phantasia/setup.c, pom/pom.6, + quiz/datfiles/collectives, quiz/datfiles/flowers, quiz/quiz.6.in, + rain/rain.6, robots/robots.6.in, rogue/USD.doc/rogue.me, + rogue/score.c, sail/sail.6, snake/snake/snake.6.in, + tetris/tetris.6.in, trek/DOC/read_me.nr, trek/DOC/trekmanual.nr, + trek/events.c, trek/main.c, trek/trek.6.in, trek/warp.c, + worms/worms.6, wtf/wtf.6.in: Update from NetBSD CVS. + * wtf/acronyms: Update from NetBSD CVS. + * phantasia/Makefrag: Update to build generated files in source + directory rather than on install. + * phantasia/.cvsignore: Update. + * atc/include.h, hunt/huntd/driver.c, monop/execute.c: Include + . + * sail/misc.c: Include . + +2001-08-02 Joseph S. Myers + + * README, PACKAGING: Warn about inclusion of cryptographic + software. + +2001-03-24 Joseph S. Myers + + * hack/hack.cmd.c: Whitespace adjustments for NetBSD alignment. + + * arithmetic/arithmetic.c, banner/banner.6, + fortune/datfiles/fortunes, fortune/datfiles/fortunes2-o.real, + fortune/fortune/fortune.c, wtf/acronyms: Update from NetBSD CVS + (but don't apply __progname changes). + +2001-03-19 Joseph S. Myers + + * bsd-games.lsm (Primary-site), bsd-games-non-free.lsm + (Primary-site): Change metalab.unc.edu to ibiblio.org. + +2001-03-03 Joseph S. Myers + + * install-man.in, install-score.in: Use POSIX "chown user:group" + instead of GNU "chown user.group". + +2001-02-08 Joseph S. Myers + + * rogue/USD.doc/rogue.me: Fix typo (s/scroll/potion/). Reported + by Lidovski Vladimir . + +2001-02-07 Joseph S. Myers + + * adventure/hdr.h, adventure/init.c, arithmetic/arithmetic.c, + atc/atc.6.in, atc/extern.h, atc/input.c, atc/log.c, atc/main.c, + atc/update.c, backgammon/Makefile.bsd, + backgammon/Makefile.inc.bsd, backgammon/teachgammon/teach.c, + boggle/Makefile.bsd, boggle/boggle/help.c, boggle/boggle/mach.c, + boggle/boggle/timer.c, boggle/boggle/word.c, cribbage/crib.c, + dm/dm.c, fortune/Makefile.bsd, fortune/datfiles/Makefile.bsd, + fortune/datfiles/fortunes, fortune/datfiles/fortunes-o.real, + fortune/datfiles/fortunes-o.sp.ok, fortune/datfiles/fortunes2, + fortune/datfiles/netbsd, fortune/fortune/fortune.c, patching file + fortune/strfile/strfile.8, gomoku/bdisp.c, hack/config.h, + hack/def.monst.h, hack/def.rm.h, hack/extern.h, hack/hack.6.in, + hack/hack.cmd.c, hack/hack.h, hack/hack.options.c, + hack/hack.read.c, hack/hack.tty.c, hack/hack.unix.c, + hunt/hunt/hunt.c, hunt/hunt/otto.c, hunt/huntd/driver.c, + hunt/huntd/faketalk.c, hunt/huntd/get_names.c, monop/misc.c, + monop/monop.6.in, monop/prop.c, phantasia/phantglobs.h, + primes/pr_tbl.c, primes/primes.c, quiz/datfiles/midearth, + quiz/datfiles/pres, robots/main.c, robots/move_robs.c, + robots/play_level.c, rogue/rogue.h, sail/assorted.c, + sail/display.h, sail/dr_1.c, sail/dr_2.c, sail/dr_3.c, + sail/dr_4.c, sail/dr_5.c, sail/dr_main.c, sail/driver.h, + sail/extern.h, sail/game.c, sail/globals.c, sail/lo_main.c, + sail/main.c, sail/misc.c, sail/parties.c, sail/pl_1.c, + sail/pl_2.c, sail/pl_3.c, sail/pl_4.c, sail/pl_5.c, sail/pl_6.c, + sail/pl_7.c, sail/pl_main.c, sail/player.h, sail/restart.h, + sail/sync.c, trek/externs.c, trek/lose.c, trek/play.c, trek/win.c, + wtf/wtf.in: Update from NetBSD CVS. + * sail/main.c: Include . + * COPYING: Update. + + * wtf/acronyms: Update from NetBSD CVS. + +2001-01-11 Joseph S. Myers + + * mkdep: Update to work with current CVS GCC. + * COPYING: Update copyright dates. + +2000-12-20 Joseph S. Myers + + * rain/rain.c (main): If delay is zero, do tcdrain(STDOUT_FILENO) + at the end of each iteration to avoid buffered output preventing + Ctrl-C from working within a reasonable time. + +2000-10-17 Joseph S. Myers + + * cribbage/cribbage.h: Mark msg() and addmsg() with printf format + attributes. + * hack/extern.h: Make vpline() with printf format attribute. + + * monop/misc.c (next_play): Fix undefined order of side effects. + * monop/prop.c (bid): Likewise. + +2000-09-25 Joseph S. Myers + + * Version 2.12. + + * NEWS, bsd-games.lsm, bsd-games-non-free.lsm: Update. + + * battlestar/com2.c, battlestar/com4.c, battlestar/com5.c, + battlestar/cypher.c, battlestar/extern.h, battlestar/globals.c, + battlestar/words.c: Update from NetBSD CVS after merge. + + * battlestar/extern.h: Add AUXVERB. + * battlestar/words.c (wlist): Use AUXVERB for "climb", "move" and + "make". + * battlestar/cypher.c (cypher): Object to words in the place for a + verb that aren't a VERB or KNIFE. Allow for AUXVERBs. + * battlestar/com2.c (put), battlestar/com4.c (take): When creating + new verbs from "put on", "put down" and "take off", make their + type be VERB. + Partly from Paul Janzen . + * tests/battlestar.out3: Update. + * tests/battlestar.in42, tests/battlestar.out42, + tests/battlestar.in43, tests/battlestar.out43: New tests. + * tests/battlestar.test: Update. + + * battlestar/extern.h: Add flags OBJ_PERSON and OBJ_NONOBJ. + * battlestar/globals.c (objflags): Use them. + + * battlestar/extern.h: Define new macros for handling "a" versus + "an" and "is" versus "are" wording issues. + * battlestar/globals.c (objflags): Add OBJ_AN flags; reformat. + From OpenBSD. + * battlestar/com2.c (wearit, murder), battlestar/com4.c (take, + eat): Use these macros. + * tests/battlestar.in41, tests/battlestar.out41: New test. + * tests/battlestar.test: Update. + + * battlestar/cypher.c (cypher): Remove excess blank lines. From + OpenBSD. + + * battlestar/com5.c (love): Fix loving already loved goddess; + avoid fallthrough after loving goddess; give error on "love + amulet". From OpenBSD. + * tests/battlestar.in40, tests/battlestar.out40: New test. + * tests/battlestar.test: Update. + + * atc/atc.6.in, hack/Makefile.bsd: Update from NetBSD CVS. + * battlestar/battlestar.c, battlestar/com1.c, battlestar/com2.c, + battlestar/com3.c, battlestar/com4.c, battlestar/com5.c, + battlestar/com6.c, battlestar/com7.c, battlestar/cypher.c, + battlestar/dayfile.c, battlestar/extern.h, battlestar/fly.c, + battlestar/getcom.c, battlestar/globals.c, battlestar/nightfile.c, + battlestar/parse.c, battlestar/room.c, battlestar/words.c: Update + from NetBSD CVS after merge. + + * battlestar/com3.c (jump): Use defined constant FINAL instead of + hardcoded number 275. From OpenBSD. + + * battlestar/com2.c (murder): Fix logic of use of n and wordnumber + when using laser. From OpenBSD. + * tests/battlestar.in39, tests/battlestar.out39: New test. + * tests/battlestar.test: Update. + +2000-09-24 Joseph S. Myers + + * NEWS, TODO: Update. + + * COPYING, INSTALL, NEWS, PACKAGING, README, SECURITY: Don't use + ASCII backquotes and neutral apostrophes as matched quotes. + + * battlestar/getcom.c (getcom): If a line of standard input goes + beyond our buffer, discard extra characters rather than reading + them as our next command. From OpenBSD. + + * battlestar/cypher.c (cypher): Improve messages when WEIGHT or + CUMBER are zero. + + * battlestar/com2.c (ravage), battlestar/com3.c (bury), + battlestar/com5.c (kiss, love, give), battlestar/com6.c (ride): + Add explicit no-ops to empty loops following the NetBSD style + guide. + + * battlestar/extern.h, battlestar/parse.c, battlestar/globals.c: + Make hash table static in parse.c. + + * battlestar/cypher.c (cypher): For INVEN, give more sensible + messages when WEIGHT or CUMBER are zero. + +2000-09-23 Joseph S. Myers + + * battlestar/globals.c (objdes, objsht): Use NULL instead of 0; + from OpenBSD. Also add or adjust comments. + + * battlestar/com2.c (murder), battlestar/com3.c (shoot), + battlestar/com4.c (take): Correct "dont" to "don't". From + OpenBSD. + * tests/battlestar.out28: Update. + + * battlestar/parse.c: Make local functions static. + * battlestar/extern.h: Remove declarations of functions now static + in parse.c. + + * battlestar/com4.c (eat): Check first for having the object to be + eaten, then for needing a knife, then for being stuffed. Also + give a better message for things it doesn't make sense to eat. + From OpenBSD. + * tests/battlestar.in38, tests/battlestar.out38: New test. + * tests/battlestar.test: Update. + + * battlestar/fly.c: Remove abs() macro; make local variables and + functions static. + * battlestar/extern.h: Remove declarations of functions now static + in fly.c + + * battlestar/com1.c (news): Don't let CUMBER go negative. + * battlestar/cypher.c (cypher): For INVEN, show -1% if CUMBER is + zero. + + * battlestar/com4.c (drop): Disambiguate BODY; handle "kick + door". From OpenBSD. + * tests/battlestar.in32, tests/battlestar.out32, + tests/battlestar.in33, tests/battlestar.out33, + tests/battlestar.in34, tests/battlestar.out34, + tests/battlestar.in35, tests/battlestar.out35, + tests/battlestar.in36, tests/battlestar.out36, + tests/battlestar.in37, tests/battlestar.out37: New tests. + * tests/battlestar.test: Update. + +2000-09-22 Joseph S. Myers + + * battlestar/com5.c (love): Allow for bathing goddess; better + message when the lover is not present or for certain choices of + lover. From OpenBSD. + + * battlestar/com2.c (ravage): Allow for the bathing goddess. From + OpenBSD. + + * battlestar/extern.h: Add OBJ_PLURAL, objflags and + is_plural_object. + * battlestar/globals.c: Add objflags. + * battlestar/com2.c (wearit), battlestar/com3.c (shoot), + battlestar/com4.c (take, eat): Use is_plural_object rather than + looking for a final 's'. + * tests/battlestar.in31, tests/battlestar.out31: New test. + * tests/battlestar.test: Update. + + * battlestar/com4.c (drop): When kicking, check for objects being + worn or not present. From OpenBSD. + * tests/battlestar.in29, tests/battlestar.out29, + tests/battlestar.in30, tests/battlestar.out30: New tests. + * tests/battlestar.test: Update. + + * battlestar/com4.c (take): Check for the object not being present + before checking for it being too heavy or bulky. + * tests/battlestar.in28, tests/battlestar.out28: New test. + * tests/battlestar.test: Update. + +2000-09-21 Joseph S. Myers + + * battlestar/cypher.c (cypher): Give appropriate messages for + verbs applied to "all" where nothing relevant is present. From + OpenBSD. + * tests/battlestar.in27, tests/battlestar.out27: New test. + * tests/battlestar.test: Update. + + * battlestar/com2.c (wearit, use, murder), battlestar/com3.c + (shoot), battlestar/com4.c (take, throw, drop, eat), + battlestar/com6.c (dooropen), battlestar/cypher.c (cypher), + battlestar/parse.c (parse): Move all discarding of adjectives to + parse(). From Paul Janzen . Fixes + crash on "carry old all", shown up by fuzz testing. + * tests/battlestar.in26, tests/battlestar.out26: New test. + * tests/battlestar.test: Update. + + * battlestar/com2.c (murder): Give error rather than crashing on + "kill all". From OpenBSD. + * tests/battlestar.in25, tests/battlestar.out25: New test. + * tests/battlestar.test: Update. + + * battlestar/extern.h: Define and use WORDLEN. From OpenBSD. + * battlestar/globals.c: Also use WORDLEN. From OpenBSD. + * battlestar/battlestar.c (main): Use NWORD rather than 20 (from + OpenBSD). Avoid off-by-one error by using NWORD - 1. + * battlestar/cypher.c (cypher): Increment wordnumber after INVEN. + * battlestar/getcom.c (getword): Avoid overflowing elements of the + words array. From OpenBSD. + * battlestar/words.c (wlist): Parse "," as AND. From OpenBSD. + * battlestar/parse.c (parse): Trim AND AND. When an OBJECT AND + EVERYTHING or NOUNS AND EVERYTHING sequence occurs, move the + EVERYTHING to the beginning. Trim EVERYTHING AND EVERYTHING. + From OpenBSD. Also disable parsing of "," as AND if followed by a + verb. + * tests/battlestar.in21, tests/battlestar.out21, + tests/battlestar.in22, tests/battlestar.out22, + tests/battlestar.in23, tests/battlestar.out23, + tests/battlestar.in24, tests/battlestar.out24: New tests. + * tests/battlestar.test: Update. + + * battlestar/com2.c (wearit): Don't attempt to wear anything with + no short description. + * tests/battlestar.in20, tests/battlestar.out20: New tests. + * tests/battlestar.test: Update. + + * battlestar/com2.c (wearit): Partly from OpenBSD: don't try to + wear anything that isn't OBJECT or NOUNS, and don't try to wear + DOOR. Fixes with a different patch a bug report from Peter + Maydell . + * tests/battlestar.in16, tests/battlestar.out16, + tests/battlestar.in17, tests/battlestar.out17, + tests/battlestar.in18, tests/battlestar.out18, + tests/battlestar.in19, tests/battlestar.out19: New tests. + * tests/battlestar.test: Update. + + * battlestar/com2.c (murder): From OpenBSD: shoot with laser if no + hand-to-hand weapon available. + +2000-09-20 Joseph S. Myers + + * battlestar/getcom.c (getcom): die() on EOF; based on OpenBSD. + * tests/battlestar.out15: New test. + * tests/battlestar.test: Update. + + * battlestar/com6.c (open_score_file): If BATTLESTAR_QUIET is set + in the environment, don't give a warning. + * tests/battlestar.test: Set BATTLESTAR_QUIET so tests can be done + as a user without write access to the log file. + + * battlestar/com5.c (kiss): From OpenBSD, "take" the bathing + goddess if required; give a better message when trying to kiss a + person who is not present. + * tests/battlestar.in14, tests/battlestar.out14: New tests. + * tests/battlestar.test: Update. + +2000-09-17 Joseph S. Myers + + * battlestar/dayfile.c (dayfile), battlestar/nightfile.c + (nightfile): Add missing initialisers and comments giving room + numbers. + + * wtf/acronyms: Update from NetBSD CVS. + + * battlestar/com1.c, battlestar/com2.c, battlestar/com4.c, + battlestar/com5.c, battlestar/com6.c, battlestar/com7.c, + battlestar/getcom.c: Clean up formatting; partly from OpenBSD. + + * tests/battlestar.in9, tests/battlestar.out9, + tests/battlestar.in10, tests/battlestar.out10, + tests/battlestar.in11, tests/battlestar.out11, + tests/battlestar.in12, tests/battlestar.out12, + tests/battlestar.in13, tests/battlestar.out13: New tests. + * tests/battlestar.test: Update. + + * battlestar/com6.c (dooropen): New function, from OpenBSD. + * battlestar/cypher.c (cypher): Support new verbs OPEN, VERBOSE + and BRIEF, from OpenBSD. + * battlestar/extern.h: Add new verbs OPEN, VERBOSE and BRIEF, new + variable verbose, and new function dooropen(), from OpenBSD. + * battlestar/globals.c (verbose): New variable, from OpenBSD. + * battlestar/room.c (writedes): If verbose, always give long + description; from OpenBSD. + * battlestar/words.c (wlist): Add synonyms "papaya" and "coconut" + and verbs "open", "unlock", "verbose" and "brief", from OpenBSD. + +2000-09-10 Joseph S. Myers + + * battlestar/com2.c, battlestar/com3.c, battlestar/com4.c, + battlestar/com5.c, battlestar/com6.c, battlestar/com7.c, + battlestar/cypher.c, battlestar/dayfile.c, battlestar/nightfile.c, + battlestar/room.c, battlestar/words.c: Update from NetBSD CVS + after merge. + +2000-09-09 Joseph S. Myers + + * battlestar/room.c (writedes): Process '=' in descriptions as + meaning a literal '-'; from OpenBSD. + * battlestar/dayfile.c (dayfile), battlestar/nightfile.c + (nightfile): Spelling, punctuation and line length adjustments + from OpenBSD. + * tests/battlestar.out4, tests/battlestar.out5, + tests/battlestar.out8: Update for changes in line length. + + * battlestar/com2.c (murder): Give an appropriate message for + trying to kill non-OBJECT things (from OpenBSD); fixes "kill door" + segfault. + * battlestar/com3.c (shoot), battlestar/com4.c (take), + battlestar/com5.c (kiss), battlestar/com6.c (ride), + battlestar/com7.c (fight), battlestar/cypher.c (save): Wording, + spelling, punctuation and line length adjustments from OpenBSD. + * tests/battlestar.out5, tests/battlestar.out6: Update for changed + wording. + * tests/battlestar.in8, tests/battlestar.out8: New tests. + * tests/battlestar.test: Update. + + * battlestar/words.c: Make spacing nicer and add missing + initialisers. + + * NEWS, TODO: Update. + + * battlestar/battlestar.6, battlestar/battlestar.c, + battlestar/com1.c, battlestar/com5.c, battlestar/cypher.c, + battlestar/dayfile.c, battlestar/extern.h, battlestar/globals.c, + battlestar/init.c, battlestar/nightfile.c, battlestar/room.c: + Update from NetBSD CVS after merge. + +2000-09-08 Joseph S. Myers + + * battlestar/battlestar.6: Don't refer to ~. Suggested by Hubert + Feyrer. + + * battlestar/extern.h, battlestar/globals.c, battlestar/init.c: + Don't restrict length of username, use a string from strdup + instead. Make functions and arrays only used in init.c static. + +2000-09-07 Joseph S. Myers + + * battlestar/extern.h: Put prototypes in alphabetical order. + + * fortune/datfiles/Makefile.bsd: Really update from NetBSD CVS. + + * battlestar/battlestar.6: Improvements from OpenBSD. + * battlestar/extern.h: Define ROOMDESC. + * battlestar/room.c (writedes): Use it. + * battlestar/battlestar.c: From OpenBSD, make clearer and don't + increase beenthere[position] beyond ROOMDESC. + * battlestar/com1.c (news), battlestar/com5.c (kiss), + battlestar/cypher.c (cypher), battlestar/dayfile.c (dayfile), + battlestar/globals.c (objdes, objsht), nightfile.c (nightfile): + Spelling and punctuation corrections or adjustments from OpenBSD. + + * tests/battlestar.test: Test for wizard or anti-wizard users. + +2000-09-06 Joseph S. Myers + + * tests/battlestar.in5, tests/battlestar.out5, + tests/battlestar.in6, tests/battlestar.out6, + tests/battlestar.err6: New files. + * tests/battlestar.test: Update. + + * tests/battlestar.test, tests/battlestar.in1, + tests/battlestar.out1, tests/battlestar.in2, + tests/battlestar.out2, tests/battlestar.in3, + tests/battlestar.out3, tests/battlestar.in4, + tests/battlestar.out4: New files. + + * lib/.cvsignore: New file. + * morse/.cvsignore: Add morse. + +2000-08-22 Joseph S. Myers + + * hunt/hunt/.cvsignore, hunt/huntd/.cvsignore, mille/.cvsignore, + monop/.cvsignore, morse/.cvsignore, number/.cvsignore, + phantasia/.cvsignore, pig/.cvsignore, pom/.cvsignore, + ppt/.cvsignore, primes/.cvsignore, quiz/.cvsignore, + quiz/datfiles/.cvsignore, rain/.cvsignore, random/.cvsignore, + robots/.cvsignore, rogue/.cvsignore, sail/.cvsignore, + snake/snake/.cvsignore, snake/snscore/.cvsignore, + tetris/.cvsignore, trek/.cvsignore, worm/.cvsignore, + worms/.cvsignore, wtf/.cvsignore, wump/.cvsignore: New files. + +2000-08-19 Joseph S. Myers + + * fortune/datfiles/.cvsignore, fortune/fortune/.cvsignore, + fortune/strfile/.cvsignore, fortune/unstr/.cvsignore, + gomoku/.cvsignore, hack/.cvsignore, hangman/.cvsignore: New files. + +2000-08-18 Joseph S. Myers + + * caesar/.cvsignore, canfield/canfield/.cvsignore, + canfield/cfscores/.cvsignore, cribbage/.cvsignore, dm/.cvsignore, + factor/.cvsignore, fish/.cvsignore: New files. + + * fortune/datfiles/Makefile.bsd, fortune/datfiles/fortunes, + fortune/datfiles/netbsd, fortune/datfiles/netbsd-o.fake, + fortune/datfiles/netbsd-o.real, wtf/acronyms: Update from NetBSD + CVS. + +2000-08-05 Joseph S. Myers + + * .cvsignore, include/.cvsignore, adventure/.cvsignore, + arithmetic/.cvsignore, atc/.cvsignore, + backgammon/backgammon/.cvsignore, + backgammon/common_source/.cvsignore, + backgammon/teachgammon/.cvsignore, banner/.cvsignore, + battlestar/.cvsignore, bcd/.cvsignore, boggle/boggle/.cvsignore, + boggle/mkdict/.cvsignore, boggle/mkindex/.cvsignore: New files. + + * wtf/acronyms: Update from NetBSD CVS. + +2000-08-04 Joseph S. Myers + + * include/signal.h, include/stdio.h, include/stdlib.h, + include/termios.h, include/sys/cdefs.h, include/sys/ttydefaults.h: + Use #pragma GCC system_header to allow #include_next with + -pedantic. + +2000-08-03 Joseph S. Myers + + * atc/input.c, atc/log.c, atc/update.c, hack/config.h, + hack/def.monst.h, hack/def.rm.h, hack/hack.cmd.c, hack/hack.h, + robots/move_robs.c, robots/play_level.c: Comment out text after + #endif. + * bcd/bcd.c: Use unsigned char and casts to avoid -pedantic + warnings. + * pom/pom.c: Likewise. + * fortune/unstr/unstr.c, hack/makedefs.c: Include . + * lib/fgetln.c: Include . + + * adventure/setup.c, battlestar/com1.c, battlestar/com7.c, + battlestar/cypher.c, battlestar/extern.h, boggle/mkdict/mkdict.c, + boggle/mkindex/mkindex.c, fortune/datfiles/netbsd, + fortune/strfile/strfile.c, hack/makedefs.c, monop/initdeck.c: + Update from NetBSD CVS. + +2000-08-02 Joseph S. Myers + + * sail/extern.h (abs): Don't define; breaks with glibc 2.2. + +2000-07-22 Joseph S. Myers + + * hack/hack.tty.c, monop/getinp.c, rogue/message.c, trek/phaser.c: + Update from NetBSD CVS. + +2000-07-06 Joseph S. Myers + + * adventure/done.c, adventure/main.c, adventure/subr.c, bcd/bcd.c, + canfield/cfscores/cfscores.c, countmail/countmail.6, + fortune/datfiles/fortunes, fortune/datfiles/fortunes2, + fortune/datfiles/netbsd, gomoku/stoc.c, hack/hack.h, + hunt/huntd/get_names.c, morse/morse.c, phantasia/Makefile.bsd, + ppt/ppt.c, rogue/init.c, sail/Makefile.bsd, sail/lo_main.c, + sail/pl_1.c, sail/pl_7.c, trek/computer.c, trek/destruct.c, + trek/getpar.c, trek/setup.c, trek/torped.c: Update from NetBSD + CVS. + +2000-05-28 Joseph S. Myers + + * adventure/Makefile.bsd, adventure/main.c, + arithmetic/arithmetic.c, atc/main.c, backgammon/backgammon/main.c, + backgammon/teachgammon/teach.c, battlestar/battlestar.c, + bcd/bcd.c, boggle/boggle/bog.c, caesar/caesar.c, caesar/rot13.in, + canfield/canfield/canfield.c, canfield/cfscores/cfscores.c, + cribbage/crib.c, fish/fish.c, fortune/datfiles/netbsd, + gomoku/main.c, hack/hack.termcap.c, hangman/main.c, mille/mille.c, + mille/misc.c, mille/print.c, monop/cards.inp, monop/monop.c, + morse/morse.c, phantasia/Makefile.bsd, phantasia/fight.c, + phantasia/misc.c, ppt/ppt.c, quiz/quiz.c, robots/main.c, + robots/score.c, snake/snake/snake.c, snake/snscore/snscore.c, + tetris/screen.c, tetris/screen.h, trek/main.c, worm/worm.c, + wump/wump.c: Update from NetBSD CVS. + +2000-05-27 Joseph S. Myers + + * wtf/acronyms: Update from NetBSD CVS. + +2000-05-06 Joseph S. Myers + + * bsd-games now under CVS version control. At present there is no + anoncvs access, so this isn't particularly relevant to anyone else + yet. The CVS tree up to now has been generated with scripts based + on RCS to include all past releases and betas from 1.3 onwards, + and those snapshots of the bsd-games source tree from in between + releases that I have, with checkin dates set to the dates of the + ChangeLogs in the respective releases and snapshots. Tags used + are BSD_GAMES_DATE_yyyy_mm_dd for dated snapshots; BSD_GAMES_v_v + for versioned bsd-games releases; BSD_GAMES_NON_FREE_v_v for + bsd-games-non-free releases; and BSD_GAMES_VERSION_v_v for the + union of corresponding bsd-games and bsd-games-non-free releases, + and for bsd-games releases before the split, but this tag was not + applied where no bsd-games-non-free release corresponded to a + particular bsd-games release. + +2000-04-26 Joseph S. Myers + + * bsd-games.lsm, bsd-games-non-free.lsm: Update to LSM format + version 4. + +2000-04-19 Joseph S. Myers + + * Version 2.11. + + * NEWS: Update. + * bsd-games.lsm: Update. + * bsd-games-non-free.lsm: Update. + + * hack/date.h, hack/def.monst.h, hack/def.objclass.h, + hack/def.objects.h, hack/def.permonst.h, hack/extern.h, + hack/hack.Decl.c, hack/hack.cmd.c, hack/hack.dog.c, + hack/hack.eat.c, hack/hack.end.c, hack/hack.engrave.c, + hack/hack.fight.c, hack/hack.h, hack/hack.invent.c, + hack/hack.lev.c, hack/hack.main.c, hack/hack.makemon.c, + hack/hack.mhitu.c, hack/hack.mklev.c, hack/hack.mkmaze.c, + hack/hack.mkobj.c, hack/hack.mkshop.c, hack/hack.mon.c, + hack/hack.monst.c, hack/hack.o_init.c, hack/hack.objnam.c, + hack/hack.pager.c, hack/hack.pri.c, hack/hack.read.c, + hack/hack.rip.c, hack/hack.save.c, hack/hack.shk.c, + hack/hack.termcap.c, hack/hack.timeout.c, hack/hack.topl.c, + hack/hack.tty.c, hack/hack.u_init.c, hack/hack.unix.c, + hack/hack.vault.c, hack/hack.wield.c, hack/hack.wizard.c, + hack/hack.zap.c: Use const and fix compiler warnings. + +2000-04-18 Joseph S. Myers + + * hack/*: New, from NetBSD CVS. + * hack/Makefile: Rename to Makefile.bsd. + * AUTHORS, COPYING, INSTALL, README, README.non-free, SECURITY, + TODO: Update. + * NEWS: Update. + * bsd-games-non-free.lsm: Update. + * hack/pathnames.h: Rename to pathnames.h.in for substitutions. + * hack/hack.6: Rename to hack.6.in for substitutions. + * configure, substfiles, substfiles2, Makeconfig.in: Update. + * exec.libs, exec.objs: Update. + * hack/Makefrag: New file. + * hack/hack.main.c: Check for fds 0, 1, 2 being closed; use + setregid() for gid revokes. + * hack/hack.bones.c, hack/hack.do.c, hacl/hack.main.c, + hack/hack.pager.c, hack/hack.save.c, hack/hack.unix.c, + hack/makedefs.c: Use symbolic constants. + * hack/makedefs.c: Check for write errors on output; use const and + fix compiler warnings. + * hack/def.func_tab.h, hack/def.objclass.h, hack/def.permonst.h, + hack/extern.h, hack/hack.Decl.c, hack/hack.apply.c, hack/hack.c, + hack/hack.cmd.c, hack/hack.do_name.c, hack/hack.end.c, + hack/hack.invent.c, hack/hack.h, hack/hack.main.c, + hack/hack.mon.c, hack/hack.objnam.c, hack.pager.c, hack.potion.c, + hack/hack.shknam.c, hack.trap.c, hack.zap.c: Use const and fix + compiler warnings. + +2000-04-15 Joseph S. Myers + + * arithmetic/arithmetic.c, boggle/mkdict/Makefile.bsd, + boggle/mkindex/Makefile.bsd, fortune/datfiles/fortunes, + fortune/datfiles/fortunes2, fortune/fortune/fortune.c, + fortune/strfile/Makefile.bsd, hunt/Makefile.inc.bsd, + hunt/hunt/hunt.c, hunt/huntd/driver.c, phantasia/fight.c, + robots/score.c: Update from NetBSD CVS. + +2000-04-14 Joseph S. Myers + + * COPYING: Fix spelling error. + +2000-04-09 Joseph S. Myers + + * quiz/datfiles/asia: Corrections from Robert Vollmert + . + +2000-04-05 Joseph S. Myers + + * countmail/countmail.6: Fix grammar (bug reported by Thomas + Bushnell BSG ). + +2000-03-29 Joseph S. Myers + + * boggle/boggle/prtable.c, fish/fish.c, fortune/datfiles/fortunes, + fortune/datfiles/fortunes2, fortune/datfiles/fortunes2-o.real, + fortune/datfiles/netbsd, gomoku/makemove.c, hunt/hunt/hunt.c, + rogue/CHANGES, trek/trek.6.in: Update from NetBSD CVS. + +2000-02-28 Joseph S. Myers + + * wtf/acronyms: Update from NetBSD CVS. + +2000-02-12 Joseph S. Myers + + * Version 2.10. + + * fortune/fortune/fortune.c: Include . + * fortune/unstr/unstr.c: Likewise. + * fortune/strfile/strfile.c: Include . + * monop/initdeck.c: Likewise. Remove unnecessary casts. + + * NEWS: Update. + * bsd-games.lsm: Update. + + * fortune/datfiles/netbsd, sail/Makefile.bsd: Update from NetBSD + CVS. + + * COPYING: Add 2000 to copyright years. + + * wtf/acronyms: Update from NetBSD CVS. + +2000-02-09 Joseph S. Myers + + * wtf/acronyms: Update from NetBSD CVS. + + * THANKS: Update. + * INSTALL: Update. + + * Essentially all relevant changes now merged back into NetBSD + (except for hunt). + * TODO: Update. + * NEWS: Update. + + * sail/Makefile.bsd, sail/dr_main.c, sail/extern.h, + sail/globals.c, sail/main.c, sail/misc.c, sail/pathnames.h.in, + sail/pl_7.c, sail/pl_main.c, sail/sync.c: Update from NetBSD CVS + after further merge. + + * fortune/datfiles/Makefile.bsd, wargames/Makefile.bsd: Update + from NetBSD CVS. + * fortune/datfiles/netbsd: New, from NetBSD. + +2000-02-01 Joseph S. Myers + + * wtf/acronyms: Update from NetBSD CVS. + +2000-01-24 Joseph S. Myers + + * snake/snscore/snscore.c, tetris/scores.c, tetris/tetris.c, + wargames/Makefile.bsd, wargames/wargames.6: Update from NetBSD CVS + after further merge. + + * boggle/Makefile.bsd, fortune/Makefile.bsd, + fortune/datfiles/Makefile.bsd, hunt/hunt/hunt.c, + hunt/huntd/hunt.h, phantasia/Makefile.bsd: Update from NetBSD CVS. + +2000-01-20 Joseph S. Myers + + * robots/main.c, robots/score.c: Update from NetBSD CVS after + further merge. + +2000-01-19 Joseph S. Myers + + * fortune/strfile/strfile.c, random/random.c: Update from NetBSD + CVS after further merge. + +2000-01-17 Joseph S. Myers + + * random/random.c: Define MAXRANDOM rather than using RAND_MAX. + +2000-01-13 Joseph S. Myers + + * adventure/io.c, adventure/vocab.c, battlestar/save.c, + caesar/caesar.c, monop/monop.c, worm/worm.c: Update from NetBSD + CVS after further merge. + +2000-01-08 Joseph S. Myers + + * wtf/acronyms: Update from NetBSD CVS. + +2000-01-02 Joseph S. Myers + + * tetris/screen.h, tetris/tetris.c, tetris/tetris.h: Update from + NetBSD CVS after further merge. + +1999-12-31 Joseph S. Myers + + * fortune/strfile/strfile.c, fortune/strfile/strfile.h, + monop/cards.c, monop/initdeck.c: Update from NetBSD CVS. + +1999-12-28 Joseph S. Myers + + * sail/extern.h, sail/globals.c, sail/pl_7.c, sail/player.h: + Update from NetBSD CVS after further merge. + +1999-12-16 Joseph S. Myers + + * ppt/ppt.c, quiz/quiz.c: Update from NetBSD CVS (more changes + merged into NetBSD). + + * quiz/quiz.c (show_index): Refer error message to the pager + actually used. + + * fortune/strfile/strfile.c: Use err(1, NULL) for out-of-memory + error. + + * boggle/mkindex/mkindex.c, fortune/datfiles/fortunes, + fortune/strfile/strfile.c, wargames/wargames, wtf/wtf.in: Update + from NetBSD CVS. + +1999-12-07 Joseph S. Myers + + * adventure/io.c, adventure/vocab.c, battlestar/save.c, + caesar/caesar.c, monop/cards.c, monop/initdeck.c, monop/monop.c, + monop/prop.c, snake/snscore/snscore.c, worm/worm.c: Use err(1, + NULL) or warn(NULL) for `out of memory' messages. + + * fortune/strfile/strfile.c: Remove obsolete NO_VOID conditional, + and casts in ALLOC macro. + +1999-12-06 Joseph S. Myers + + * wtf/acronyms: Update from NetBSD CVS. + +1999-11-29 Joseph S. Myers + + * ChangeLog: Use consistent form of my name and email address. + +1999-11-15 Joseph S. Myers + + * countmail/countmail: Don't describe messages as new when they + may not be (bug report and suggested fix from Malcolm Parsons + ). + + * configure: Ask for permissions on variable data that should not + be world readable (bug report from ). + * install-score.in: Use this. + * phantasia/Makefrag: Use this. + * SECURITY: Update. + + * tetris/tetris.c: Include ; use errx() for error messages; + change usage message to refer to tetris-bsd (bug report from + Malcolm Parson ). + + * tetris/scores.c (printem): Fix formatting of high score tables + with multiple columns (bug report and suggested fix from Malcolm + Parsons ). + + * robots/main.c (main): Fix spelling error in unknown option + message (bug report and suggested fix by Malcolm Parsons + ). + +1999-11-12 Joseph S. Myers + + * Version 2.9. + + * bsd-games.lsm: Update. + + * NEWS: Update. + +1999-11-11 Joseph S. Myers + + * boggle/mkindex/mkindex.c (main): Add index entries for letters + not found in the dictionary (problem reported by Mike Castle + ). + + * robots/main.c (main): Reinitialise Num_games to 1 after looping + through Num_games games, so if you ask for another game then you + still get this prompt next time. Bug report and suggested fix + from Malcolm Parsons . + + * robots/score.c (score): Fix reporting of auto-bot scores, bug + report and suggested fix from Malcolm Parsons + . + + * cribbage/instr.c, fortune/fortune/fortune.c, + snake/snake/snake.6.in, snake/snake/snake.c, worm/worm.6, + worm/worm.c: Update from NetBSD CVS. + +1999-11-05 Joseph S. Myers + + * wtf/acronyms: Update from NetBSD CVS. + +1999-10-28 Joseph S. Myers + + * wtf/acronyms: Update from NetBSD CVS. + + * random/random.c: Use RAND_MAX rather than LONG_MAX (patch from + William Brioschi). + + * tests/rot13.*: Removed; test not meaningful since it uses the + installed caesar (which may not be present) rather than the + just-built one. Bug reported by Roman Hodek + . + +1999-10-21 Joseph S. Myers + + * backgammon/common_source/back.h, + backgammon/common_source/subs.c, robots/main.c, tetris/screen.c, + tetris/screen.h: Update from NetBSD CVS. + +1999-10-11 Joseph S. Myers + + * wtf/acronyms: Update from NetBSD CVS. + +1999-10-01 Joseph S. Myers + + * cribbage/cribbage.6.in, mille/move.c: Update from NetBSD CVS + after further merge. + +1999-09-30 Joseph S. Myers + + * atc/def.h, cribbage/cards.c, cribbage/cribbage.h, cribbage/io.c, + mille/comp.c, mille/init.c, mille/mille.h, mille/move.c, + mille/types.h, monop/misc.c, monop/monop.h, monop/trade.c, + phantasia/phantdefs.h, robots/robots.h, sail/dr_1.c, sail/dr_2.c, + sail/dr_3.c, sail/extern.h: Update from NetBSD CVS after further + merge. + + * cribbage/cribbage.6.in (FILES): Tweak. + +1999-09-27 Joseph S. Myers + + * quiz/datfiles/europe (Monaco): Change capital to Monaco, bug + reported by . + +1999-09-26 Joseph S. Myers + + * Version 2.8. + + * include/tzfile.h: Remove (no longer used). + + * fortune/datfiles/Makefrag: Use $(SHAREDIR) not $(LIBDIR). + + * NEWS: Update. + + * bsd-games.lsm, bsd-games-non-free.lsm: Update. + + * */Makefrag, */*/Makefrag: Add copyright notices and licence + terms. + * hangman/Makefrag: Remove reference to $(hangman_WORDS). + * COPYING: Tweak. + * NEWS: Add release dates. + +1999-09-23 Joseph S. Myers + + * dm/dm.c, fish/fish.c, fortune/fortune/fortune.c: Update from + NetBSD CVS after further merge. + + * fortune/datfiles/Makefile.bsd: Update from NetBSD CVS. + +1999-09-19 Joseph S. Myers + + * boggle/boggle/bog.c, boggle/mkdict/mkdict.c, cribbage/extern.c, + dm/dm.c, phantasia/setup.c: Update from NetBSD CVS after further + merge. + +1999-09-18 Joseph S. Myers + + * boggle/mkdict/mkdict.c, boggle/mkindex/mkindex.c: Update from + NetBSD CVS after further merge. + + * battlestar/com1.c, battlestar/com4.c: Tweak for NetBSD + alignment. + + * battlestar/com1.c, battlestar/com4.c, boggle/boggle/bog.c, + cribbage/io.c, fortune/fortune/fortune.c, + fortune/strfile/strfile.c, fortune/unstr/unstr.c, + gomoku/pickmove.c, mille/comp.c, phantasia/interplayer.c, + pig/pig.c, robots/extern.c, robots/robots.h, robots/score.c, + rogue/save.c, tetris/scores.c, trek/main.c: Update from NetBSD CVS + after further merge. + + * battlestar/battlestar.c, battlestar/cypher.c, + battlestar/dayobjs.c, battlestar/init.c, battlestar/nightobjs.c: + Update from NetBSD CVS after further merge. + + * backgammon/backgammon/main.c, boggle/boggle/bog.c, + hangman/extern.c, hangman/hangman.6.in, hangman/hangman.h, + hangman/main.c, hangman/setup.c, quiz/quiz.c, sail/game.c, + tetris/scores.c, trek/externs.c, trek/trek.h: Update from NetBSD + CVS after further merge. + +1999-09-17 Joseph S. Myers + + * wtf/acronyms: Update from NetBSD CVS. + + * NEWS: Update. + + * hangman/extern.c, hangman/hangman.h, hangman/main.c, + hangman/setup.c: Make dictionary path selectable at run time. + * hangman/hangman.6.in: Document this. + * NEWS, TODO, INSTALL, PACKAGING: Update. + +1999-09-16 Joseph S. Myers + + * hangman/words: Remove. The copyright status was not clear; + assertions in the LSM entry that it is free from copyright seem to + be contradicted by inspection of the READMEs. (See + ftp://ftp.cs.unc.edu/pub/users/faith/linux/utils/ .) + * hangman/Makefrag: No longer install words file. + * configure: Update accordingly. + * boggle/mkdict/Makefrag: Update accordingly. + * Makeconfig.in: Update accordingly. + * NEWS: Update. + * INSTALL: Update. + * PACKAGING: Update. + + * configure: Fix bugs in earlier changes. + + * sail/game.c (maxturns): Tweak following comments from Hubert + Feyrer. + + * boggle/boggle/bog.c (checkdict): Tweak following comments from + Hubert Feyrer. + + * trek/trek.h: Modify form of structure/variable declarations + (following comments from Hubert Feyrer). + + * battlestar/battlestar.c (main): Give a sensible error message in + the default (should't happen) case. + +1999-09-15 Joseph S. Myers + + * COPYING: Update. + + * substfiles: Move manpages and some other non-headers into + substfiles2 (new file). + * quiz/datfiles/Makefrag (quiz_datfiles_all): Depend on + quiz/datfiles/index. + * configure: Only generate rules for files in substfiles2, don't + actually build them at configure time. + * TODO: Update. + + * configure: Allow for comments in exec.objs, exec.libs and + substfiles. + * exec.objs, exec.libs, substfiles: Add explanatory comments, + copyright notices and licence terms. + + * substscr: New file to handle substitution logic. Also generate + subst.rules makefile for redoing the substitutions if required. + * configure: Use it to do substitutions. Handle subst.rules. + + * fortune/unstr/unstr.c: Don't include at all. + * gomoku/pickmove.c: Likewise, unconditionally include + rather than . + + * fortune/fortune/fortune.c: Use macro NAMLEN rather than + strlen(dirent->d_name). + +1999-09-14 Joseph S. Myers + + * gomoku/main.c: Tweak for NetBSD alignment. + + * battlestar/com6.c, battlestar/extern.h, battlestar/globals.c, + pom/pom.6, pom/pom.c, snake/snake/Makefile.bsd, + snake/snake/snake.6.in, snake/snake/snake.c: Update from NetBSD + CVS after further merge. + + * fortune/fortune/fortune.c: Adjust (unsigned long) casts to use + (u_int32_t) and (u_int64_t) as appropriate. + + * TODO: Update. + + * phantasia/setup.c: Add checks for write errors. + + * fortune/fortune/fortune.6.in, fortune/fortune/pathnames.h.in: + Fix references to @usrlibdir@. + + * quiz/datfiles/pres: Update to OpenBSD version (minor + corrections, and includes vice-presidents). + * quiz/datfiles/index.in: Update. + +1999-09-13 Joseph S. Myers + + * battlestar/com6.c, battlestar/extern.h, battlestar/init.c, + cribbage/instr.c, gomoku/gomoku.h, gomoku/main.c, + phantasia/main.c, rogue/Makefile.bsd, rogue/machdep.c, + rogue/rogue.h, rogue/save.c: Update from NetBSD CVS after further + merge. + + * fortune/datfiles/Makefile.bsd, fortune/datfiles/limerick, + fortune/datfiles/limerick-o.fake, + fortune/datfiles/limerick-o.real, fortune/datfiles/limerick.fake, + fortune/datfiles/limerick.real, + fortune/datfiles/unamerican-o.fake, + fortune/datfiles/unamerican-o.real, + fortune/datfiles/unamerican.fake, + fortune/datfiles/unamerican.real: Update from NetBSD CVS + (offensive fortunes renamed to ...-o). + * fortune/datfiles/Makefrag: Update. + + * tests/*: Add testsuite. + * configure: Update. + * bcd/Makefrag, caesar/Makefrag, factor/Makefrag, morse/Makefrag, + number/Makefrag, pig/Makefrag, pom/Makefrag, ppt/Makefrag, + primes/Makefrag, wargames/Makefrag: Remove old test fragments. + * COPYING: Update. + * INSTALL: Update. + * NEWS: Update. + + * lib/fgetln.c, lib/getloadavg.c: Add copyright notice and licence + terms. + * include/signal.h, include/stdio.h, include/stdlib.h, + include/termios.h, include/tzfile.h, include/sys/cdefs.h, + include/sys/endian.h, include/sys/ttydefaults.h: Likewise. + * hide-game.in, install-man.in, install-score.in, mkdep: Likewise. + * configure, Makeconfig.in: Likewise. + * COPYING: Update. + +1999-09-12 Joseph S. Myers + + * wargames/wargames.6: Add copyright notice and licence terms; + convert to use tmac.doc. + * COPYING: Update. + + * snake/snake/snake.6.in: Fix substitution. + + * snake/snake/snake.c: #ifdef keypad functionality so snake can be + built/tested on systems without it. + + * AUTHORS: Fix entries for rogue and worm. + + * canfield/canfield/canfield.c, canfield/cfscores/cfscores.c, + cribbage/crib.c, fish/fish.c, gomoku/main.c, hangman/main.c, + mille/mille.c, monop/monop.c, morse/morse.c, ppt/ppt.c, + quiz/quiz.c, robots/main.c, robots/robots.h, robots/score.c, + rogue/init.c, rogue/machdep.c, rogue/rogue.h, rogue/score.c, + snake/snake/snake.c, snake/snscore/snscore.c, tetris/scores.c, + tetris/tetris.c, tetris/tetris.h, trek/main.c, worm/worm.c, + wump/wump.c: Update from NetBSD CVS after merge of most security + changes. + +1999-09-11 Joseph S. Myers + + * wtf/acronyms: Updatef from NetBSD-current. + + * COPYING: New file. + * NEWS: Update. + * README: Update. + +1999-09-10 Joseph S. Myers + + * wump/wump.c: Update from NetBSD CVS. + + * rogue/curses.c: Remove. + * rogue/machdep.c, rogue/rogue.h: Remove traces of CURSES. + + * THANKS: Update. + * NEWS: Update. + + * gomoku/main.c (main): Comment tweak. + + * rogue/init.c: Add blank line. + + * robots/main.c (main): Restore errno before printing error + message. + + * robots/query.c: NetBSD alignment tweak. + + * atc/graphics.c, boggle/mkdict/mkdict.c, + boggle/mkindex/mkindex.c, cribbage/cribbage.h, + fortune/strfile/strfile.c, monop/initdeck.c: Update from NetBSD + CVS after further merge. + +1999-09-09 Joseph S. Myers + + * monop/initdeck.c (main): Whitespace tweaks. + + * backgammon/backgammon/main.c, boggle/boggle/extern.h, + canfield/canfield/canfield.c, fortune/fortune/fortune.c, + fortune/strfile/strfile.c, gomoku/pickmove.c, hangman/setup.c, + mille/save.c, monop/cards.c, monop/initdeck.c, monop/monop.c, + monop/monop.h, monop/prop.c, rogue/init.c, sail/sync.c, + snake/snscore/snscore.c, worm/worm.c, wump/wump.c: Update from + NetBSD CVS after merge of malloc checks and includes. + + * fortune/strfile/strfile.8: Update from NetBSD CVS. + + * mille/save.c: Move include up. + + * backgammon/backgammon/main.c: Move include up. Use + NULL as argument of time() instead of 0. + + * backgammon/common_source/subs.c, battlestar/com6.c, + battlestar/fly.c, boggle/boggle/bog.c, boggle/boggle/extern.h, + boggle/boggle/mach.c, boggle/boggle/prtable.c, + boggle/boggle/word.c, caesar/caesar.c, + canfield/canfield/canfield.c, canfield/cfscores/cfscores.c, + cribbage/cards.c, cribbage/crib.c, cribbage/cribbage.h, + cribbage/io.c, cribbage/score.c, cribbage/support.c, + factor/factor.c, fish/fish.c, fortune/fortune/fortune.c, + fortune/strfile/strfile.c, fortune/unstr/unstr.c, gomoku/bdisp.c, + gomoku/gomoku.h, gomoku/main.c, gomoku/makemove.c, + gomoku/pickmove.c, gomoku/stoc.c, hangman/extern.c, + hangman/getword.c, hangman/hangman.h, hangman/main.c, + hangman/setup.c, mille/comp.c, mille/extern.c, mille/mille.c, + mille/mille.h, mille/move.c, mille/print.c, mille/save.c, + monop/cards.c, monop/execute.c, monop/getinp.c, monop/houses.c, + monop/initdeck.c, monop/misc.c, monop/monop.c, monop/monop.def, + monop/monop.ext, monop/monop.h, monop/morg.c, monop/print.c, + monop/spec.c, monop/trade.c, morse/morse.c, number/number.c, + phantasia/fight.c, phantasia/gamesupport.c, + phantasia/interplayer.c, phantasia/io.c, phantasia/main.c, + phantasia/misc.c, phantasia/phantglobs.c, phantasia/phantglobs.h, + phantasia/phantstruct.h, phantasia/setup.c, primes/pattern.c, + primes/pr_tbl.c, primes/primes.c, quiz/quiz.c, quiz/quiz.h, + quiz/rxp.c, random/random.c, robots/auto.c, robots/extern.c, + robots/init_field.c, robots/main.c, robots/move.c, robots/query.c, + robots/robots.h, robots/score.c, rogue/init.c, rogue/rogue.h, + sail/assorted.c, sail/dr_1.c, sail/dr_2.c, sail/driver.h, + sail/extern.h, sail/globals.c, sail/lo_main.c, sail/pl_1.c, + sail/pl_3.c, sail/pl_4.c, sail/pl_7.c, sail/sync.c, + snake/snake/snake.c, snake/snscore/snscore.c, tetris/scores.c, + tetris/screen.c, tetris/shapes.c, tetris/tetris.c, + tetris/tetris.h, trek/abandon.c, trek/capture.c, trek/cgetc.c, + trek/computer.c, trek/dcrept.c, trek/destruct.c, trek/dock.c, + trek/dumpgame.c, trek/getpar.h, trek/help.c, trek/impulse.c, + trek/lrscan.c, trek/phaser.c, trek/play.c, trek/rest.c, + trek/setwarp.c, trek/torped.c, trek/trek.h, trek/visual.c, + worm/worm.c: Update from NetBSD CVS after initial merge of const, + attribute and symbolic constant changes. + +1999-09-08 Joseph S. Myers + + * README: Update. + + * NEWS: Update. + +1999-08-29 Joseph S. Myers + + * INSTALL: Update. + +1999-08-22 Joseph S. Myers + + * README: Update. + * NEWS: Update. + * TODO: Update. + + * include/sys/endian.h: Add the 16-bit functions in case they get + used in the games later. Still does not include the little-endian + functions until some game starts using data in little-endian + format. + + * AUTHORS: Update. + * BUGS: Update. + +1999-08-21 Joseph S. Myers + + * include/sys/endian.h: New file (compatibility with changes in + NetBSD). + * fortune/fortune/fortune.c, fortune/strfile/strfile.8, + fortune/strfile/strfile.c, fortune/strfile/strfile.h, + fortune/fortune/unstr.c: Update from NetBSD anoncvs. + * fortune/datfiles/Makefrag: fortune data is now arch-independent. + * phantasia/Makefile.bsd, phantasia/main.c: Update from NetBSD + anoncvs. + * monop/cards.c, monop/deck.h, monop/execute.c, monop/getinp.c, + monop/houses.c, monop/initdeck.c, monop/jail.c, monop/misc.c, + monop/monop.c, monop/monop.def, monop/monop.h, monop/morg.c, + monop/print.c, monop/prop.c, monop/rent.c, monop/roll.c, + monop/spec.c, monop/trade.c: Update from NetBSD anoncvs. + * configure, Makeconfig.in: monop data is now arch-independent. + * NEWS: Update. + + * NEWS: Update. + +1999-08-18 Joseph S. Myers + + * fish/fish.6: Update from NetBSD anoncvs. + +1999-08-17 Joseph S. Myers + + * NEWS: Update. + + * snake/snake/snake.c: Move to use curses. Other minor fixes. + * snake/snake/move.c, snake/snake/snake.h: Remove (incorporated in + snake.c). + * snake/snake/snake.6.in: Update. + * exec.objs: Update. + * TODO: Update. + + * snake/snake/snake.c, snake/snake/move.c: Minor fixes from + OpenBSD. + +1999-08-16 Joseph S. Myers + + * backgammon/backgammon/main.c, backgammon/teachgammon/teach.c, + fortune/datfiles/fortunes2, snake/snake/move.c, + snake/snake/snake.h, tetris/screen.c: Update from NetBSD anoncvs. + +1999-08-14 Joseph S. Myers + + * AUTHORS: Update. + * NEWS: Update. + + * wtf/wtf.in: Update from NetBSD anoncvs. + + * wtf/acronyms: Update from NetBSD-current. + +1999-08-11 Joseph S. Myers + + * worm/worm.c: Update from NetBSD anoncvs. + +1999-08-09 Joseph S. Myers + + * sail/sync.c: Tweak for NetBSD alignment. + + * monop/monop.def: Tweak for NetBSD alignment. + + * rain/rain.c, worm/worm.c: Update from NetBSD anoncvs. + +1999-08-06 Joseph S. Myers + + * fortunes/datfiles/Makefile.bsd, + fortune/datfiles/unamerican.fake, + fortune/datfiles/unamerican.real, rain/Makefile.bsd, rain/rain.6, + rain/rain.c, worms/worms.6, worms/worms.c: Update from NetBSD + anoncvs. + * fortune/datfiles/Makefrag: Update. + +1999-07-29 Joseph S. Myers + + * adventure/hdr.h, adventure/init.c, atc/graphics.c, + backgammon/backgammon/main.c, backgammon/common_source/save.c, + battlestar/battlestar.6, battlestar/battlestar.c, + battlestar/cypher.c, battlestar/extern.h, battlestar/init.c, + battlestar/save.c, bcd/bcd.6, bcd/bcd.c, worm/worm.c, wtf/wtf.in: + Update from NetBSD anoncvs. + +1999-07-28 Joseph S. Myers + + * atc/grammar.y, backgammon/common_source/back.h, + backgammon/common_source/fancy.c, backgammon/common_source/subs.c: + Update from NetBSD anoncvs of yesterday. + +1999-07-27 Joseph S. Myers + + * TODO, SECURITY, PACKAGING: Add note on security hardening. + + * phantasia/phantglobs.h: Mark `catchalarm' as noreturn. + * sail/extern.h: Mark `play' as noreturn. + * snake/snake/snake.h: Mark `mainloop' as noreturn. + * tetris/screen.c: Mark `stopset' as noreturn. + * trek/trek.h: Mark `lose', `myreset', `play' and `win' as + noreturn. + + * bcd/bcd.6: Fix mdoc usage in references. + + * adventure/hdr.h, adventure/init.c: Fix use of linker commons. + * battlestar/extern.h, battlestar/globals.c: Likewise. + * backgammon/common_source/fancy.c: Likewise. + * sail/extern.h, sail/globals.c, sail/player.h, sail/pl_7.c: + Likewise. + * snake/snake/snake.h, snake/snake/snake.c: Likewise. + * tetris/screen.h, tetris/screen.c, tetris/tetris.h, + tetris/tetris.c: Likewise. + * trek/trek.h, trek/externs.c: Likewise. + * TODO: Update. + + * backgammon/common_source/save.c (save): Fix other case of + executable save files. + + * atc/graphics.c (getAChar): Be yet more paranoid about EINTR. + + * atc/input.c (delayb, benum): Revert old unsigned char change + (NetBSD now casts the subscripts to int). + + * configure: Check for fgetln and getloadavg in case they are + added to glibc in future. + * include/stdio.h: Update. + * include/stdlib.h: Update. + * lib/fgetln.c: Update. + * lib/getloadavg.c: Update. + * Makeconfig.in: Add GETLOADAVG_DEFS and FGETLN_DEFS. + * battlestar/Makefrag, dm/Makefrag, quiz/Makefrag: Use them. + +1999-07-26 Joseph S. Myers + + * battlestar/battlestar.6: Fix mdoc usage (use .Op Ar saved-file + instead of .Op saved-file). + + * wtf/wtf.in, wtf/wtf.6.in: Update from NetBSD anoncvs. + +1999-07-25 Joseph S. Myers + + * atc/grammer.y, atc/graphics.c, atc/input.c, atc/log.c, + atc/main.c, atc/update.c, backgammon/teachgammon/ttext1.c: Update + from NetBSD anoncvs. + +1999-07-24 Joseph S. Myers + + * atc/main.c: Change to use getopt. + + * substfiles: Fix error. + * backgammon/common_source/init.c: Whitespace alignment with + NetBSD. + +1999-07-23 Joseph S. Myers + + * Makefile.bsd, atc/grammar.y, backgammon/backgammon/main.c, + backgammon/teachgammon/teach.c, banner/banner.c, + battlestar/battlestar.c, battlestar/com6.c, battlestar/extern.h, + bcd/bcd.c, boggle/boggle/bog.c, caesar/caesar.c, trek/computer.c, + trek/externs.c, trek/getpar.c, trek/getpar.h, trek/help.c, + trek/kill.c, trek/lose.c, trek/out.c, trek/phaser.c, trek/play.c, + trek/setup.c, trek/shield.c, trek/srscan.c, trek/systemname.c, + trek/trek.h, trek/win.c: Update from NetBSD-current of 1999-07-23. + * wtf/wtf.6.in, wtf/wtf.in: New game. + * wtf/Makefrag: New file. + * configure, substfiles, Makeconfig.in: Update. + * wtf/acronyms: Acronym collection from NetBSD. + * README, bsd-games.lsm, NEWS: Update. + +1999-07-18 Joseph S. Myers + + * atc/grammar.y (wdef): Check sp->width instead of sp->height. + + * INSTALL, TODO: Update for egcs/gcc terminology change. + + * adventure/save.c, arithmetic/arithmetic.c, atc/Makefile.bsd, + atc/atc.6.in, atc/extern.h, atc/input.c, atc/log.c, atc/main.c, + atc/struct.h: Update from NetBSD-current of 1999-07-18. + + * battlestar/save.c, battlestar/extern.h, battlestar/init.c, + battlestar/cypher.c: Change saving interface again; new function + save_file_name() determines the name under which to save. + + * battlestar/com6.c, battlestar/extern.h: Don't include + in com6.c, include it instead of in extern.h. + +1999-07-16 Joseph S. Myers + + * adventure/hdr.h, adventure/main.c, adventure/save.c, + adventure/setup.c, adventure/wizard.c, + backgammon/backgammon/main.c, battlestar/com1.c, + battlestar/com2.c, battlestar/com5.c, battlestar/dayfile.c, + battlestar/globals.c, battlestar/nightfile.c, boggle/boggle/bog.c, + dm/dm.c, fish/fish.c, wump/wump.c: Update from NetBSD-current of + 1999-07-16 (more of my changes merged back in). + +1999-07-15 Joseph S. Myers + + * adventure/save.c (restore): Check for errors writing the save + file. + +1999-07-14 Joseph S. Myers + + * boggle/boggle/bog.c (checkdict): Use SEEK_SET with dictseek(). + + * atc/atc.6.in: New atc.6 from NetBSD-current of 1999-06-28, + parametrised. + * substfiles: Include atc/atc.6. + +1999-06-30 Joseph S. Myers + + * battlestar/fly.c, fish/fish.c, hunt/hunt/otto.c, + robots/Makefile.bsd, robots/auto.c, robots/extern.c, + robots/main.c, robots/make_level.c, robots/move.c, + robots/move_robs.c, robots/robots.6, robots/robots.h, + robots/score.c, rogue/Makefile.bsd, sail/player.h, trek/trek.6.in: + Update from NetBSD-current of 1999-05-18. + * exec.objs: Update. + * INSTALL, NEWS: Note score file format change. + * robots/auto.c, robots/robots.h, robots/extern.c, robots/score.c: + Fix new warnings. + * backgammon/common_source/back.h: Mark `norec' and `errexit' as + `noreturn'. + * hangman/hangman.h: Mark `die' as `noreturn'. + * hunt/huntd/hunt.h: Mark `bad_con', `bad_ver', `sigterm' and + `sigemt' as `noreturn'. + * phantasia/setup.c: Mark `Error' as `noreturn'. + * pom/pom.c: Mark `badformat' as `noreturn'. + * random/random.c: Mark `usage' as `noreturn'. + * rogue/rogue.h: Mark `killed_by' and `win' as `noreturn'. + +1999-04-10 Joseph S. Myers + + * BUGS: Update. + +1999-04-04 Joseph S. Myers + + * Version 2.7. + + * bsd-games.lsm, bsd-games-non-free.lsm: Update. + + * mille/mille.c, mille/misc.c, mille/move.c, mille/save.c: Update + from NetBSD-current of 1999-04-02. + +1999-03-28 Joseph S. Myers + + * INSTALL: Update. + + * NEWS: Update. + + * mille/print.c (prscore): Mark parameter `for_real' possibly + unused. + + * atc/input.c: Mark unused parameters (detected by current egcs + snapshots but not by egcs 1.1) as such. + + * tetris/scores.c: Use error reporting functions. + + * hunt/huntd/driver.c (init): Fork and exit to ensure that + setsid() will work. + +1999-03-27 Joseph S. Myers + + * backgammon/backgammon/main.c (main): Fix scoring if you bear off + all your men and your opponent has borne off at least one man but + has a man in your inner board or on the bar (thanks to Stuart + Lamble ). + * THANKS: Update. + + * arithmetic/arithmetic.6, backgammon/common_source/Makefile.bsd, + battlestar/cypher.c, canfield/canfield/canfield.6.in, + countmail/countmail.6, dm/dm.conf.5.in, fortune/strfile/strfile.8, + gomoku/gomoku.6, random/random.6, tetris/tetris.c, worms/worms.6: + Update from NetBSD-current of 1999-03-26. + +1999-02-20 Joseph S. Myers + + * adventure/crc.c, adventure/hdr.h, adventure/init.c, + adventure/io.c, adventure/main.c, adventure/setup.c, + adventure/wizard.c, atc/Makefile.bsd, + backgammon/backgammon/main.c, backgammon/backgammon/text.c, + backgammon/backgammon/version.c, + backgammon/common_source/Makefile.bsd, + backgammon/common_source/back.h, backgammon/common_source/board.c, + backgammon/common_source/fancy.c, backgammon/common_source/init.c, + backgammon/common_source/save.c, backgammon/common_source/subs.c, + backgammon/common_source/table.c, + backgammon/teachgammon/Makefile.bsd, + backgammon/teachgammon/data.c, backgammon/teachgammon/teach.c, + backgammon/teachgammon/ttext1.c, backgammon/teachgammon/ttext2.c, + backgammon/teachgammon/tutor.c, backgammon/teachgammon/tutor.h, + battlestar/com1.c, battlestar/com4.c, battlestar/com6.c, + battlestar/dayobjs.c, battlestar/extern.h, battlestar/getcom.c, + battlestar/globals.c, battlestar/init.c, battlestar/misc.c, + battlestar/nightobjs.c, battlestar/parse.c, battlestar/room.c, + boggle/Makefile.bsd, boggle/boggle/Makefile.bsd, + boggle/mkdict/Makefile.bsd, boggle/mkindex/Makefile.bsd, + canfield/cfscores/Makefile.bsd, countmail/Makefile.bsd, + cribbage/Makefile.bsd, fish/Makefile.bsd, + fortune/datfiles/Makefile.bsd, fortune/unstr/Makefile.bsd, + monop/Makefile.bsd, morse/Makefile.bsd, ppt/Makefile.bsd, + primes/Makefile.bsd, quiz/Makefile.bsd, sail/assorted.c, + sail/dr_1.c, sail/dr_2.c, sail/dr_3.c, sail/dr_4.c, sail/dr_5.c, + sail/extern.h, sail/parties.c, sail/pl_1.c, sail/pl_3.c, + sail/pl_4.c, sail/pl_5.c, sail/pl_6.c, sail/pl_7.c, + sail/pl_main.c, sail/sync.c, snake/snscore/Makefile.bsd, + tetris/tetris.c, wargames/Makefile.bsd, wump/Makefile.bsd, + wump/wump.c: Update from NetBSD-current of 1999-02-19. + * backgammon/teachgammon/ttext1.c: Add more use of const. + +1999-01-21 Joseph S. Myers + + * fortune/fortune/fortune.c: Use strlen(d_name) rather than + incorrect #define d_namlen d_reclen. Should be conditionalised in + some way. + +1999-01-12 Joseph S. Myers + + * bcd/bcd.6: Include references to the relevant standards. + +1999-01-10 Joseph S. Myers + + * worms/worms.c (main): Use leaveok(). + + * rain/rain.c (main): Use leaveok(). + +1999-01-09 Joseph S. Myers + + * adventure/hdr.h: Add comment saying where to find original + source. + + * adventure/hdr.h, adventure/main.c, adventure/save.c, + adventure/wizard.c: Change saved to saveday where appropriate. + This shouldn't actually change the behaviour of the program, + except perhaps when saving a game fails, but makes things a lot + clearer. + + * pom/pom.c: Update from the 3rd edition of the reference book. + Make date calculation work before the epoch. Fix bug in + waxing/waning display near full moon. Use a sensible input date + format. (Based on Paul Janzen's work in OpenBSD.) + * pom/pom.6: Update. + +1999-01-08 Joseph S. Myers + + * battlestar/cypher.c (cypher): Add FALLTHROUGH comment as per + NetBSD policy. + + * backgammon/backgammon/main.c: Remove unused junk to limit number + of users (performed by dm); use \a instead of \007. + + * adventure/init.c, arithmetic/arithmetic.c, atc/grammar.y, + atc/graphics.c, atc/log.c, atc/main.c, atc/update.c, + backgammon/backgammon/main.c, backgammon/common_source/subs.c, + teachgammon/teach.c, battlestar/com6.c, battlestar/fly.c, + boggle/boggle/mach.c, canfield/canfield/canfield.c, cribbage/io.c, + cribbage/score.c, dm/dm.c, fortune/fortune/fortune.c, + fortune/unstr/unstr.c, gomoku/main.c, gomoku/pickmove.c, + hangman/main.c, hunt/hunt/hunt.c, hunt/hunt/otto.c, + hunt/huntd/faketalk.c, mille/mille.c, monop/monop.c, + phantasia/io.c, robots/main.c, rogue/init.c, sail/main.c, + sail/pl_1.c, sail/pl_7.c, snake/snake/snake.c, tetris/tetris.c, + trek/abandon.c, trek/capture.c, trek/cgetc.c, trek/computer.c, + trek/dcrept.c, trek/destruct.c, trek/dock.c, trek/dumpgame.c, + trek/help.c, trek/impulse.c, trek/lrscan.c, trek/phaser.c, + trek/play.c, trek/rest.c, trek/setwarp.c, trek/torped.c, + trek/visual.c, worm/worm.c: Change `unused' parameters to + `__unused__'. + + * bcd/bcd.6: Update from NetBSD-current of 1999-01-07. + * phantasia/oldplayer.h: Remove (removed in NetBSD-current on + response to my PR bin/6700, and unused since phantasia/convert.c + was removed some time ago). + * tetris/input.c, tetris/input.h, tetris/screen.c, + tetris/tetris.6.in, tetris/tetris.c, tetris/tetris.h: Update from + NetBSD-current of 1999-01-07 (adds piece preview option). + +1999-01-07 Joseph S. Myers + + * fortune/strfile/strfile.c (main): Flush output file and check + for write errors before closing it and exiting the program. + + * include/sys/cdefs.h: Use __unused__ in attribute, for cleanness + and NetBSD alignment. + +1999-01-01 Joseph S. Myers + + * fortune/strfile/strfile.c: Remove unused ALWAYS macro. + + * adventure/setup.c, boggle/mkdict/mkdict.c, + boggle/mkindex/mkindex.c, monop/initdeck.c: Flush stdout or output + file and check for errors on writing before terminating. + +1998-12-28 Joseph S. Myers + + * pig/pig.6: Include utility name with .Nm where needed. + + * TODO: Update. + + * atc/extern.h: Whitespace adjustment for NetBSD alignment. + + * battlestar/com1.c, battlestar/com2.c, battlestar/com5.c, + battlestar/dayfile.c, battlestar/globals.c, + battlestar/nightfile.c: Spelling and punctuation corrections from + OpenBSD. + +1998-12-23 Joseph S. Myers + + * worms/worms.c, worms/worms.6: Convert to use curses; add delay + option from OpenBSD; change to use functions; fix signal + handling. + * TODO: Update. + + * rain/rain.c, rain/rain.6: Convert to use curses; add delay + option from OpenBSD; fix signal handling. + * TODO: Update. + +1998-12-20 Joseph S. Myers + + * install-man.in: Use `ln -sf' rather than `ln -s'. How come this + never got noticed before? + + * Version 2.6. + + * configure: Really fix quiz/datfiles/index generation. + + * NEWS: Update. + * bsd-games.lsm: Update. + * bsd-games-non-free.lsm: Update. + +1998-12-18 Joseph S. Myers + + * ppt/ppt.c: Print a space between command line arguments (bugfix + from OpenBSD). + +1998-12-14 Joseph S. Myers + + * configure (warning_flags): Add -Wwrite-strings to defaults. + * TODO: Update. + * NEWS: Update. + + * sail/assorted.c, sail/dr_1.c, sail/dr_2.c, sail/driver.h, + sail/extern.h, sail/globals.c, sail/lo_main.c, sail/pl_3.c, + sail/pl_4.c, sail/pl_7.c: Use const where appropriate. + + * tetris/scores.c, tetris/screen.c, tetris/shapes.c, + tetris/tetris.c, tetris/tetris.h: Use const where appropriate. + + * snake/snake/move.c, snake/snake/snake.c, snake/snake/snake.h, + snake/snscore/snscore.c: Use const where appropriate. + +1998-12-12 Joseph S. Myers + + * sail/assorted.c, sail/dr_1.c, sail/dr_2.c, sail/dr_3.c, + sail/dr_4.c, sail/dr_5.c, sail/extern.h, sail/parties.c, + sail/pl_1.c, sail/pl_3.c, sail/pl_4.c, sail/pl_5.c, sail/pl_6.c, + sail/pl_7.c, sail/pl_main.c, sail/sync.c: Split Write() into two + separate functions for string and numeric arguments. + + * robots/extern.c, robots/init_field.c, robots/main.c, + robots/move.c, robots/query.c, robots/robots.h, robots/score.c: + Use const where appropriate. + + * quiz/quiz.c, quiz/quiz.h, quiz/rxp.c: Use const where + appropriate. + + * phantasia/gamesupport.c, phantasia/interplayer.c, + phantasia/io.c, phantasia/main.c, phantasia/misc.c, + phantasia/phantglobs.c, phantasia/phantglobs.h, + phantasia/phantstruct.h, phantasia/setup.c: Use const where + appropriate. + +1998-12-11 Joseph S. Myers + + * NEWS: Update. + + * monop/cards.c, monop/execute.c, monop/getinp.c, + monop/initdeck.c, monop/misc.c, monop/monop.def, monop/monop.ext, + monop/monop.h, monop/morg.c, monop/print.c, monop/spec.c, + monop/trade.c: Use const where appropriate. + + * trek/computer.c, trek/externs.c, trek/getpar.h, trek/getpar.c, + trek/help.c, trek/kill.c, trek/lose.c, trek/out.c, trek/phaser.c, + trek/play.c, trek/setup.c, trek/shield.c, trek/srscan.c, + trek/systemname.c, trek/trek.h, trek/win.c: Use const where + appropriate. + + * TODO: Update. + + * fortune/fortune/fortune.c: Use const where appropriate. + + * rain/rain.c: Use const where appropriate. + + * number/number.c: Use const where appropriate. + +1998-12-10 Joseph S. Myers + + * morse/morse.c: Use const where appropriate. + + * worm/worm.c: Use const where appropriate. + + * worms/worms.c: Include instead of providiing + prototypes for termcap functions; use const where appropriate; + tputs fixes. + + * wump/wump.c (instructions): Use const where appropriate. + + * phantasia/fight.c, phantasia/gamesupport.c, + phantasia/interplayer.c, phantasia/main.c, phantasia/misc.c: Use + symbolic argument with fseek. + + * sail/sync.c: Use symbolic argument with fseek. + + * monop/initdeck.c: Use symbolic argument with fseek. + + * monop/cards.c (get_card): Use symbolic argument with fseek. + + * hangman/getword.c (getword): Use symbolic argument with fseek. + + * fortune/fortune/fortune.c, fortune/strfile/strfile.c, + fortune/unstr/unstr.c: Use symbolic argument with fseek. + + * boggle/boggle/bog.c: Use symbolic argument with dictseek (which + gets passed to fseek). + + * BUGS: Update. + + * rogue/save.c (save_into_file): Check for allocation failure. + + * rogue/init.c: Check for allocation failure. + + * snake/snscore/snscore.c (main): Check for allocation failure. + + * worm/worm.c: Check for allocation failure. + + * monop/prop.c (add_list): Check for allocation failure. + + * monop/monop.c (getplayers): Check for allocation failure. + + * monop/initdeck.c (main): Check for allocation failure; use + symbolic argument for fseek; exit with error status if opening + output file fails. + + * monop/cards.c (set_up): Check for allocation failure. + * monop/monop.h: Include . + +1998-12-08 Joseph S. Myers + + * adventure/wizard.c (ciao): Avoid buffer overrun when reading + save file name. + + * morse/morse.c, phantasia/Makefile.bsd, quiz/Makefile.bsd, + rogue/hit.c, rogue/init.c, rogue/inventory.c, rogue/level.c, + rogue/machdep.c, rogue/message.c, rogue/monster.c, rogue/move.c, + rogue/object.c, rogue/pack.c, rogue/play.c, rogue/ring.c, + rogue/rogue.h, rogue/room.c, rogue/save.c, rogue/score.c, + rogue/throw.c, rogue/trap.c, rogue/use.c, rogue/zap.c, + wump/Makefile.bsd: Update from NetBSD-current of 1998-12-07. + +1998-12-07 Joseph S. Myers + + * atc/Makefile.bsd, atc/extern.c, atc/extern.h, atc/graphics.c, + atc/input.c, atc/log.c, atc/main.c, atc/update.c, + backgammon/backgammon/main.c, backgammon/common_source/subs.c, + backgammon/teachgammon/teach.c, bcd/bcd.6, boggle/Makefile.bsd, + boggle/boggle/Makefile.bsd, cribbage/Makefile.bsd, + fish/Makefile.bsd, fortune/datfiles/Makefile.bsd, + fortune/datfiles/fortunes, fortune/datfiles/fortunes.sp.ok, + monop/Makefile.bsd: Update from NetBSD-current of 1998-12-07. + + * exec.objs: Remove references to lib/select.o. + * lib/select.c: Remove. + + * hunt/huntd/driver.c (main): Initialise linger when required to + avoid need for select() wrapper. + + * hunt/huntd/ctl_transact.c (ctl_transact): Reinitialise wait to + avoid need for select() wrapper. + + * hunt/hunt/hunt.c (list_drivers): Reinitialise wait in each + cycle, so as not to need select() wrapper. + + * README: Update. + + * TODO: Update. + + * tetris/tetris.c (main): Die if fds 0, 1, 2 aren't already open. + + * snake/snake/snake.c (main): Die if score file gets fd < 3. + + * sail/main.c (main): Die if fds 0, 1, 2 aren't already open. + + * sail/sync.c: Size sync_lock and sync_file according to the + length required for the name formatted. + + * rogue/init.c (init): Die if fds 0, 1, 2 aren't already open. + + * robots/main.c (main): Die if the score file gets fd < 3. + + * phantasia/main.c (initialstate): Die if the first file opened + gets fd < 3. + + * cribbage/crib.c (main): Die if the score file gets fd < 3. + + * canfield/canfield/canfield.c (initall): Die if the score file + gets fd < 3. + + * battlestar/com6.c (open_score_file): Die if the score file gets + fd < 3. + + * atc/log.c (open_score_file): Die if the score file gets fd < 3. + +1998-12-06 Joseph S. Myers + + * TODO: Update. + + * sail/pl_main.c (initialize): Use snprintf, not sprintf. This + fixes a possible buffer overrun; it comes from RedHat and the + LSAP, though neither ever bothered to send it to me. + + * configure: Don't put `#!/bin/sh' and an `autogenerated' comment + in quiz/datfiles/index. + +1998-09-24 Joseph S. Myers + + * Version 2.5. + + * bsd-games.lsm, bsd-games-non-free.lsm: Update. + + * Paul Janzen has checked with the original author, and it turns + out the the BSD licence applies to boggle and obsoletes the old + one, so boggle can go in the main bsd-games package. + * boggle/README: Update accordingly. + * boggle/README.linux, boggle/Makefrag: Update accordingly. No + longer need to include uuencoded patch. + * boggle/boggle/helpfile: Update accordingly. + * INSTALL: Update accordingly. + * NEWS: Update accordingly. + * PACKAGING: Update accordingly. + * README, README.non-free: Update accordingly. + * bsd-games.lsm, bsd-games-non-free.lsm: Update accordingly. + + * TODO: Update accordingly. + * THANKS: Update accordingly. + +1998-09-23 Joseph S. Myers + + * NEWS: Update. + + * trek/main.c: Make Mother uid_t. + + * hunt/hunt/hunt.c: Don't declare errno. + + * hunt/huntd/hunt.h: Don't declare errno - include + instead. + + * factor/Makefrag: Define _GNU_SOURCE, for isblank(). + * number/Makefrag, primes/Makefrag: Likewise. + + * With glibc 2.1, various headers can be included with an + __need_foo preprocessor define to make them only define some + particular symbols; this interacts badly with multiple inclusion + protection on the header wrappers in bsd-games. Therefore, we + must not protect wrapper headers against multiple inclusion, but + instead make sure they are safe to be included multiple times and + only protect local bits that need it. + * include/signal.h: Don't protect against multiple inclusion - + only protect the sig_t definition that needs it. + * include/stdlib.h: Don't protect against multiple inclusion. + * include/stdio.h: Don't protect against multiple inclusion. + * include/termios.h: Don't protect against multiple inclusion. + * include/sys/cdefs.h: Don't protect against multiple inclusion. + * include/sys/ttydefaults.h: Don't protect against multiple + inclusion. + + * dm/dm.c: Don't include - it isn't needed, and doesn't + exist with some glibc versions. + + * INSTALL: Minor changes. + +1998-09-15 Joseph S. Myers + + * atc/Makefile.bsd, atc/extern.h, atc/input.c, atc/main.c, + backgammon/backgammon/backgammon.6.in, + backgammon/common_source/back.h, backgammon/common_source/fancy.c, + backgammon/common_source/save.c, backgammon/common_source/subs.c, + backgammon/teachgammon/tutor.h, banner/banner.c, + battlestar/extern.h, battlestar/save.c, boggle/boggle/extern.h, + caesar/caesar.c, canfield/canfield/canfield.c, + cribbage/cribbage.h, dm/dm.c, factor/factor.c, fish/fish.c, + fortune/datfiles/fortunes, fortune/fortune/fortune.c, + fortune/strfile/strfile.c, gomoku/gomoku.h, hunt/hunt/hunt.c, + hunt/huntd/hunt.h, mille/mille.h, number/number.c, pig/pig.c, + primes/primes.c, quiz/quiz.c, robots/robots.h, rogue/rogue.h, + sail/extern.h, snake/snake/snake.h, tetris/tetris.c, + tetris/tetris.h, worm/worm.c, worms/worms.c, wump/wump.c: Update + from NetBSD-current of 1998-09-14. + + * atc/games/ATC_Scores, sail/:file, sail/:scene, sail/:ship, + sail/:specs, trek/board.x: Removed (unused, and removed in + NetBSD-current of 1998-09-14 in response to PR bin/6083). + +1998-09-14 Joseph S. Myers + + * adventure/done.c, adventure/extern.h, adventure/io.c, + adventure/main.c, adventure/setup.c, adventure/subr.c, + adventure/vocab.c, arithmetic/arithmetic.c: Update from + NetBSD-current of 1998-09-14. + + * mille/move.c: Remove unused Movenames[] array. + + * mille/comp.c, mille/mille.h, mille/extern.c, mille/move.c, + mille/save.c, mille/print.c: Use const where appropriate. + + * robots/robots.h: #undef S_BONUS before defining. + + * mille/mille.h: #undef S_* constants before defining. + + * atc/def.h: #undef S_* constants before defining. + + * hunt/hunt/connect.c, hunt/huntd/hunt.h, hunt/hunt/main.c, + hunt/hunt/playit.c, hunt/huntd/answer.c, hunt/huntd/draw.c, + hunt/huntd/faketalk.c, hunt/huntd/get_names.c, + hunt/huntd/pathname.c, hunt/huntd/terminal.c, hunt/huntd/driver.c: + Use const where appropriate. + + * hangman/extern.c, hangman/hangman.h, hangman/setup.c: Use const + where appropriate. + +1998-09-13 Joseph S. Myers + + * gomoku/bdisp.c, gomoku/gomoku.h, gomoku/main.c, + gomoku/makemove.c, gomoku/pickmove.c, gomoku/stoc.c: Use const + where appropriate. + + * configure: Generate GNUmakefile, not Makefile - the makefile and + makefile fragments are thoroughly dependent on GNU Make. + + * backgammon/common_source/back.h: No longer any need to define + OXTABS. + * snake/snake/move.c: No longer any need to define CTRL or OXTABS. + * tetris/screen.c: No longer any need to define OXTABS. + * mille/misc.c: No longer any need to define CTRL. + * snake/snake/snake.c: No longer any need to define CTRL. + + * include/sys/ttydefaults.h: Define OXTABS if not already defined. + * include/termios.h: New file, also include . + + * THANKS: Update. + + * adventure/crc.c: Mark crctab[] const. + + * adventure/vocab.c (vocab): Use errx() for error messages. + + * adventure/main.c (main): Use bug(22) rather than printing "Error + 22". + + * adventure/io.c (rdesc): Use errx() for error messages. + + * monop/Makefile.bsd: Update from NetBSD-current of 1998-09-13. + + * adventure/crc.c, adventure/extern.h, adventure/io.c, + adventure/save.c, adventure/vocab.c: Update from NetBSD-current of + 1998-09-13 (const changes merged into NetBSD). + +1998-09-12 Joseph S. Myers + + * All games now updated from NetBSD-current of 1998-09-12. + + * adventure/extern.h, adventure/main.c, atc/def.h, atc/update.c, + backgammon/common_source/subs.c, battlestar/battlestar.6, + bcd/bcd.6, boggle/mkindex/mkindex.c, canfield/canfield/canfield.c, + hangman/hangman.h, hangman/main.c, hunt/huntd/hunt.h, + monop/execute.c, monop/monop.c, pom/pom.c, rogue/monster.c, + rogue/object.c, rogue/pack.c, rogue/room.c, sail/dr_2.c, + sail/sync.c, snake/snscore/snscore.c, trek/dumpgame.c, + trek/warp.c: Update from NetBSD-current of 1998-09-12. + +1998-09-11 Joseph S. Myers + + * BUGS: Update. + + * SECURITY: Update. + + * INSTALL: Update. + + * NEWS: Update. + + * TODO: Update. + +1998-09-10 Joseph S. Myers + + * adventure/io.c (pspeak): Give "Out of memory!" error on + allocation failure rather than bug(108). + +1998-09-07 Joseph S. Myers + + * boggle/README.linux, boggle/Makefrag: Update. + +1998-09-06 Joseph S. Myers + + * */Makefrag: Further changes for the new build system. + +1998-09-05 Joseph S. Myers + + * New configuration/build system, based on a single makefile that + includes makefile fragments that together describe all the + dependencies (using GNU make's automatic dependency generation). + See `Recursive Make Considered Harmful' by Peter Miller + + for a discussion of the advantages of this over recursive make. + * configure, install-score.in, Makeconfig.in: Changes for the new + system. + * Makefile: Removed. + * mkdep, exec.libs, exec.objs: New files. + * */Makefile, */*/Makefile: Renamed to Makefrag and changed for + the new system. + * hunt/Makeconfig: Adapted to the new system. + * backgammon/README.linux: Removed. + * TODO: Update. + * PACKAGING: Update. + * INSTALL: Update. + * fortune/fortune/pathnames.in: Remove TEST support. + * fortune/README.linux: Update. + + * Version 2.4. + + * bsd-games-non-free.lsm: Update. + + * bsd-games.lsm: Update. + + * TODO: Update. + + * INSTALL: Update. + + * BUGS: Update. + +1998-09-04 Joseph S. Myers + + * backgammon/teachgammon/Makefile (COBJS): No need to include + odds.o. + + * TODO: Update. + + * NEWS: Update. + + * THANKS: Update. + + * dm/dm.c: Allow time-based games play to be turned off from 11pm + to midnight; remove spurious terminal full stop from err() string + (patch from Paul Janzen ). + +1998-09-02 Joseph S. Myers + + * NEWS: Update. + + * lib/fgetln.c (fgetln): Check for allocation failure. + + * hunt/huntd/shots.c (chkslime): Check for allocation failure. + + * hunt/huntd/expl.c (showexpl): Check for allocation failure. + + * hunt/hunt/hunt.c: Check for allocation failure. + + * gomoku/pickmove.c: Check for allocation failure. + * BUGS: Update about gomoku defect. + + * INSTALL: Update egcs 1.1 references. + + * battlestar/dayobjs.c (dayobjs): Add missing initialiser at end. + * battlestar/nightbojs.c (nightobjs): Likewise. + +1998-09-01 Joseph S. Myers + + * backgammon/common_source/fancy.c (getcaps): Check for allocation + failure. + + * atc/graphics.c (loser): Check for p being NULL, which it could + be if we tun out of memory. + + * atc/update.c: Allow for newplane() to return NULL if out of + memory. + + * adventure/vocab.c (vocab): Check for memory allocation failure. + + * adventure/io.c (rtrav): Check for memory allocation failure. + + * NEWS: Update. + + * rogue/save.c (save_into_file): Avoid buffer overrun. + + * rogue/Makefile (object.o): Build object.o with + -fwritable-strings - the other files don't need it. Also don't + build curses.c. + + * TODO: Update. + + * rogue/rogue.h: Undefine CURSES after including . + + * rogue/rogue.h, rogue/hit.c, rogue/message.c, rogue/init.c, + rogue/machdep.c, rogue/save.c, rogue/inventory.c, rogue/object.c, + rogue/level.c, rogue/monster.c, rogue/pack.c, rogue/play.c, + rogue/ring.c, rogue/room.c, rogue/score.c, rogue/throw.c, + rogue/trap.c, rogue/use.c, rogue/zap.c, rogue/move.c: Use const + where appropriate. + + * fish/fish.c: Use const where appropriate. + + * phantasia/io.c (getanswer): Mark loop, oldx, oldy volatile. + +1998-08-31 Joseph S. Myers + + * adventure/setup.c (main): String passed to err() shouldn't have + full stop at its end. + + * factor/factor.c, primes/pr_tbl.c, primes/primes.c, + primes/pattern.c: Use const where appropriate. + + * dm/dm.c: Use const where appropriate. + + * cribbage/cribbage.h, cribbage/cards.c, cribbage/instr.c, + cribbage/io.c, cribbage/score.c, cribbage/support.c: Use const + where appropriate. + +1998-08-30 Joseph S. Myers + + * NEWS: Update. + + * All games now updated from NetBSD-current of 1998-08-30. + + * adventure/extern.h, adventure/hdr.h, adventure/init.c, + adventure/io.c, backgammon/backgammon/main.c, + backgammon/common_source/save.c, backgammon/teachgammon/teach.c, + battlestar/com5.c, boggle/boggle/bog.c, + canfield/canfield/canfield.c, canfield/cfscores/cfscores.c, + cribbage/crib.c, cribbage/score.c, fortune/fortune/fortune.c, + hunt/hunt/hunt.c, monop/cards.c, monop/morg.c, phantasia/fight.c, + phantasia/main.c, phantasia/misc.c, sail/dr_1.c, sail/pl_3.c, + sail/pl_7.c, sail/sync.c, trek/kill.c, trek/move.c, trek/nova.c, + trek/shield.c, wump/wump.c: Update from NetBSD-current of + 1998-08-30. + + * dm/dm.c (main): Do unsetenv("TZ") to prevent people cheating on + the times they can play. + + * atc/main.c (main): Remove comment on ICRNL change. + * atc/input.c: Remove CRTOKEN stuff (conditional on SYSV) - no + need for it with ICRNL. + +1998-08-29 Joseph S. Myers + + * battlestar/com5.c (give): Add explanatory comment. + +1998-08-28 Joseph S. Myers + + * battlestar/com5.c (give): Proper fix this time: reset wordnumber + before doing an error return. + + * atc/graphics.c (getAChar): Check against EOF, not -1; + clearerr(stdin) while the error occurs since the error indicator + may have been set; initialise errno to avoid problems with a real + EOF and errno left as EINTR. + + * boggle/boggle/bog.c (compar): Use const more. + + * INSTALL: Update. + + * boggle/boggle/bog.c (main): Change linux/PURE variants to + NEW_STYLE define. + * boggle/boggle/Makefile: NEW_STYLE is default. + * boggle/Makefile (linux-patch): Change construction of Linux + patch. + * boggle/README.linux: Adjust accordingly. + * INSTALL: Likewise. + + * sail/extern.h, sail/dr_1.c, sail/dr_2.c, sail/dr_3.c: Rename + strend() to str_end(), isolated() to is_isolated(), toughmelee() + to is_toughmelee(). + + * phantasia/phantdefs.h: #undef S_* constants before definition. + + * monop/monop.h, monop/misc.c, monop/trade.c: Rename isnot_monop() + to is_not_monop(). + + * mille/mille.h, mille/comp.c, mille/init.c, mille/move.c, + mille/types.c: Rename issafety to is_safety, isrepair to + is_repair. + +1998-08-27 Joseph S. Myers + + * hunt/huntd/hunt.h, hunt/huntd/draw.c, hunt/huntd/shots.c: Rename + isplayer to is_player. + + * gomoku/gomoku.h, gomoku/main.c: Rename log() to glog(). + + * cribbage/cards.c, cribbage/cribbage.h, cribbage/io.c: Rename + isone() to is_one(). + + * backgammon/common_source/fancy.c, + backgammon/common_source/back.h: Remove tos(). + + * boggle/boggle/help.c (help): Make change to use redrawwin() + conditional on NCURSES_VERSION. + + * configure: Suggest mode 2770 for sail directory, better than + 0770. + + * NEWS: Update. + + * PACKAGING: Add new Warnings section. + + * battlestar/extern.h, battlestar/com6.c, battlestar/init.c: + Change uname[] to username[]. + + * backgammon/teachgammon/tutor.h: Mark leave() and tutor() + noreturn. + + * TODO: Update. + + * BUGS: Update. + +1998-08-26 Joseph S. Myers + + * adventure/vocab.c (vocab): Exit with status 1 on error. + + * adventure/main.c (main): Exit with status 1 on error. + + * adventure/io.c (rdesc): Exit with status 1 on error. + + * adventure/hdr.h (FLUSHLINE): Handle EOF. + + * adventure/io.c: Handle EOF. + + * adventure/wizard.c (ciao): Handle EOF. + + * adventure/setup.c: Don't put \n in error strings (err and errx + add it). + + * backgammon/backgammon/main.c: Change condition on ospeed being + declared to #ifndef NCURSES_VERSION. + * backgammon/teachgammon/teach.c: Likewise. + * snake/snake/move.c: Likewise. + * snake/snake/snake.h: Likewise. + * tetris/screen.c: Likewise. + + * backgammon/backgammon/text.c (text): Switch order of char and + const. + + * battlestar/cypher.c (cypher): In take all, handle BATHGOD and + NORMGOD properly. + + * rogue/machdep.c (md_slurp): Use POSIX version unconditionally. + + * hunt/huntd/driver.c (init): Use setsid() to become session + leader. + + * canfield/canfield/canfield.c: Use const where appropriate. + + * canfield/cfscores/cfscores.c: Use const where appropriate. + + * caesar/caesar.c: Use const where appropriate. + + * rogue/rogue.h: Condition some prototypes on #ifdef CURSES. + +1998-08-25 Joseph S. Myers + + * atc/graphics.c (getAChar): Just use SYSV version always rather + than conditioning on SYSV || __linux__; the efficiency loss on + systems where getchar() retries is insignificant. + + * adventure/extern.h, adventure/init.c, adventure/main.c, + adventure/subr.c, adventure/vocab.c, adventure/wizard.c: Update + from NetBSD-current of 1998-08-25. + + * boggle/README.linux: Rebuild. + + * configure: Suggest sail directory should not be world + accessible. + + * sail/sync.c: Use egid when checking for file existence, so that + the sail directory can be mode 770. + + * boggle/boggle/extern.h, boggle/boggle/word.c, + boggle/boggle/prtable.c, boggle/boggle/mach.c, + boggle/boggle/bog.c: Use const where appropriate. + +1998-08-24 Joseph S. Myers + + * arithmetic/arithmetic.c: Use const where appropriate. + + * include/sys/cdefs.h: Use const in __RCSID and __COPYRIGHT. + + * bcd/bcd.c: Use const where appropriate. + + * mille/save.c (rest_f): Use O_RDONLY in open(). + + * adventure/subr.c, adventure/extern.h: Make checkhints(), + closing() and caveclose() return void. + + * adventure/subr.c, adventure/extern.h: Make bug() return void. + + * adventure/subr.c, adventure/extern.h: badmove()'s return value + is never used, so make it void. + + * adventure/extern.h: twrite() returns void, and is conditioned on + #ifdef DEBUG. + + * adventure/io.c, adventure/extern.h: Remove unused function + confirm(). + + * adventure/done.c, adventure/extern.h, adventure/main.c: die() + can only return 2000, so make it void. + + * battlestar/com2.c, battlestar/com3.c, battlestar/cypher.c: + Update from NetBSD-current of 1998-08-24. + + * battlestar/init.c (getutmp): Use strncpy(). + + * battlestar/extern.h, battlestar/globals.c, battlestar/words.c, + battlestar/dayobjs.c, battlestar/nightobjs.c, battlestar/misc.c, + battlestar/init.c, battlestar/com4.c, battlestar/parse.c, + battlestar/save.c, battlestar/getcom.c, battlestar/com1.c, + battlestar/com6.c, battlestar/room.c: Use const where appropriate. + + * banner/banner.c: Use const where appropriate. + + * adventure/io.c: Make tape, iotape const. + + * backgammon/teachgammon/Makefile: Add dependency on tutor.h. + + * backgammon/backgammon/main.c, backgammon/backgammon/text.c, + backgammon/backgammon/version.c: Use const where appropriate. + + * backgammon/common_source/save.c: Use , not extern int + errno. + + * backgammon/teachgammon/tutor.c, backgammon/teachgammon/tutor.h, + backgammon/teachgammon/data.c, backgammon/teachgammon/teach.c, + backgammon/teachgammon/ttext1.c, backgammon/teachgammon/ttext2.c: + Use const where appropriate. + + * backgammon/backgammon/backgammon.6.in, + backgammon/common_source/save.c: Remove nonsense about executing + save files; open them without execute permission. + + * backgammon/common_source/save.c: Use symbolic constants in + open() and for errno. + + * backgammon/common_source/fancy.c, + backgammon/common_source/back.h, backgammon/common_source/save.c, + backgammon/common_source/subs.c, backgammon/common_source/init.c, + backgammon/common_source/table.c, + backgammon/common_source/board.c: Use const where appropriate. + + * backgammon/common_source/subs.c, + backgammon/common_source/back.h: Remove strset() (not used). + +1998-08-23 Joseph S. Myers + + * TODO: Update. + + * atc/input.c, atc/extern.h, atc/graphics.c, atc/update.c, + atc/main.c, atc/extern.c, atc/log.c: Use const where appropriate. + + * adventure/hdr.h, adventure/init.c: Make delhit volatile + sig_atomic_t; only assign to it. + + * adventure/crc.c, adventure/extern.h, adventure/io.c, + adventure/save.c, adventure/vocab.c: Use const where appropriate. + + * adventure/vocab.c, adventure/extern.h: Make copystr(), weq() and + length() into macros that use standard C library functions. + + * adventure/wizard.c, adventure/extern.h, adventure/main.c: Remove + unused arg of ciao(). + + * adventure/wizard.c, adventure/extern.h, adventure/init.c, + adventure/main.c: Remove unused arg of Start(). + + * adventure/subr.c, adventure/extern.h, adventure/main.c: Remove + unused arg of dark(). + + * adventure/subr.c, adventure/extern.h, adventure/main.c: Remove + unused arg of liq(). + + * adventure/init.c, adventure/extern.h, adventure/main.c: Remove + unused arg of init(). + +1998-08-21 Joseph S. Myers + + * sail/extern.h, sail/main.c, sail/dr_main.c: Remove handling of + being setuid - nowadays games only run setgid. + + * rogue/machdep.c (md_shell): Remove unnecessary setuid(). + + * fish/fish.c (instructions): Remove setuid() and setgid() in + child, no longer necessary. + + * INSTALL: Add note about the desirability of using tmac.doc from + NetBSD. + + * worm/worm.6: Revert unnecessary changes. + + * hangman/hangman.6.in: Revert unnecessary changes. + + * dm/dm.8.in: Revert unnecessary changes. + + * bcd/bcd.6: Revert unnecessary changes. + + * backgammon/backgammon/backgammon.6.in: Revert some unnecessary + changes. + +1998-08-20 Joseph S. Myers + + * hunt/hunt/hunt.c: Include for MAXHOSTNAMELEN. + + * snake/snake/move.c, snake/snake/snake.h, snake/snake/snake.c: + Rename raw() to my_raw() (from Joey Hess ). + + * robots/robots.h: Include (from Joey Hess + ). + +1998-08-19 Joseph S. Myers + + * number/number.c (convert): Decrement len when there's a minus + sign. + + * Version 2.3. + + * sail/Makefile (install): Use install prefix. + + * NEWS: Update. + + * All games now updated from NetBSD-current of 1998-08-19. + + * tetris/tetris.c: Update from NetBSD-current of 1998-08-19. + + * tetris/screen.c: Update from NetBSD-current of 1998-08-19. + + * TODO: Update. + + * NEWS: Update. + + * bsd-games.lsm: Update. + + * AUTHORS (countmail): Restore. + + * README: Update. + + * countmail/*: Restore, updated from NetBSD-current of 1998-08-19 + (which has a licence for it). + + * atc/input.c: Update from NetBSD-current of 1998-08-19. + + * adventure/Makefile.bsd: Update from NetBSD-current of + 1998-08-19. + + * SECURITY: Update. + + * bsd-games-non-free.lsm: Update. + + * bsd-games.lsm: Update. + + * boggle/README.linux: Regenerate. + + * NEWS: Update. + + * sail/sync.c: Restore privileges when appropriate. + + * sail/misc.c (logger): Restore privileges for file open. + + * sail/main.c (main): Initialise gid and egid; drop egid leaving + saved gid. + + * sail/extern.h: Add gid and egid. + + * sail/Makefile (install): Install sail directory. + + * sail/sync.c: Use defines from pathnames.h. + + * sail/pathnames.h.in: Put definitions here. + + * Makeconfig.in: Add appropriate macros. + + * configure: Configure a directory for sail temporary files. + + * sail/*: Revert previous changes. Sail needs to keep privileges + for sync file handling. + + * atc/log.c (log_score): Fix truncate logic. + + * configure: Remove some of the less useful warning flags just + added. + + * wump/wump.c (int_compare): Use const. + + * robots/score.c (cmp_sc): Use const. + + * fortune/strfile/strfile.c (cmp_str): Use const. + + * boggle/boggle/bog.c (compar): Use const. + + * atc/log.c (compar): Use const. + + * configure: Add more warning flags to the default. + +1998-08-18 Joseph S. Myers + + * INSTALL: Minor changes. + + * wump/wump.c: Mark usage() noreturn. + + * worms/worms.c: Mark nomem() and onsig() noreturn. + + * worm/worm.c: Mark leave() and crash() noreturn. + + * tetris/tetris.c: Mark usage() and onintr() noreturn. + + * tetris/tetris.h: Mark stop() noreturn. + + * snake/snake/snake.h: Mark done() and stop() noreturn. + + * sail/extern.h: Mark leave() and choke() noreturn. + + * TODO: Update. + + * rogue/rogue.h: Mark clean_up(), error_save(), md_exit(), + put_scores() and sf_error() noreturn. + + * robots/robots.h: Mark quit() noreturn. + + * gomoku/gomoku.h: Mark quit(), quitsig() and panic() noreturn. + + * quiz/quiz.c: Mark usage() noreturn. + + * primes/primes.c: Mark usage() noreturn. + + * pig/pig.c: Mark usage() noreturn. + + * number/number.c: Mark usage() noreturn; remove spurious toobig() + prototype (no such function defined or used). + + * mille/mille.h: Mark die() noreturn. + +1998-08-17 Joseph S. Myers + + * hunt/huntd/hunt.h: Mark cleanup() noreturn. + + * hunt/hunt/hunt.c: Mark leave() noreturn. + + * fortune/strfile/strfile.c: Mark usage() noreturn. + + * fortune/fortune/fortune.c: Mark usage() noreturn. + + * fish/fish.c: Mark usage() noreturn; actually use it. + + * cribbage/cribbage.h: Mark rint() noreturn. + + * factor/factor.c: Mark usage() noreturn. + + * dm/dm.c: Mark play() noreturn. + + * canfield/canfield/canfield.c: Mark cleanup() noreturn. + + * caesar/caesar.c: Mark printit() noreturn. + + * boggle/boggle/extern.h: Mark usage() noreturn. + * boggle/README.linux: Rebuild. + + * battlestar/extern.h: Mark die(), diesig() and live() noreturn. + + * backgammon/common_source/back.h: Mark getout() noreturn. + + * atc/extern.h: Make loser() and log_score_quit() noreturn. + + * arithmetic/arithmetic.c: Mark intr() and usage() noreturn. + + * adventure/extern.h: Mark done() noreturn. + + * adventure/subr.c (bug): Use exit status 1 for a fatal error. + + * snake/snake/snake.c (post): Use SEEK_SET rather than 0 in + lseek(). + + * robots/score.c (score): Use SEEK_SET rather than 0 in lseek(). + + * fortune/fortune/fortune.c (get_fort): Use SEEK_SET rather than 0 + in lseek(). + + * canfield/cfscores/cfscores.c (printuser): Use SEEK_SET rather + than 0 in lseek(). + + * canfield/canfield/canfield.c (suspend): Use SEEK_SET rather than + 0 in lseek(). + (cleanup): Same. + + * SECURITY: Clarify. + +1998-08-15 Joseph S. Myers + + * Version 2.2. + + * robots/score.c (score): Check for score file not having been + successfully opened. + + * README: Update. + + * INSTALL: Update. + + * configure: Fix typo. + + * atc/log.c (log_score): Use it, avoiding possible buffer overrun. + + * atc/struct.h (SCORE_SCANF_FMT): Define to be format for scnaf + from score file, with appropriate max field widths. + + * configure: Update. + + * bsd-games.lsm: Update. + + * TODO: Update. + + * AUTHORS (countmail): Remove. + + * NEWS: Update. + + * README: Update. + + * countmail/*: Remove. + + * bsd-games-non-free.lsm: Update. + + * bsd-games.lsm: Update. + + * PACKAGING: Update. + + * BUGS: Update. + + * NEWS: Update. + + * TODO: Update. + + * SECURITY: New file, describing security issues, taken from + INSTALL. + * INSTALL: Update. + + * wump/wump.c (main): Revoke setgid privileges. + + * worms/worms.c (main): Revoke setgid privileges. + + * worm/worm.c (main): Revoke setgid privileges. + + * trek/main.c (main): Revoke setgid privileges. + + * tetris/tetris.c, tetris/score.c: Only have privileged egid when + needed. + + * tetris/tetris.h: New variables gid, egid. + + * snake/snscore/snscore.c (main): Revoke setgid privileges. + + * snake/snake/snake.c: Open score files as early as possible, then + drop setgid privileges. + + * sail/misc.c (open_log): New function: opens log file. + * sail/extern.h: Declare this. + * sail/misc.c (logger): Use already open log file. + * sail/main.c: Open log file, then drop privileges. + + * rogue/init.c, rogue/machdep.c, rogue/score.c: Only have + privileged egid when needed. + + * rogue/init.c: New variables gid, egid; initialise them. + * rogue/rogue.h: Declare them; include and + . + + * robots/main.c (main), robots/extern.h, robots/score.c (score): + Open score file at start, then drop privileges (from OpenBSD). + + * cribbage/crib.c (main): Set close-on-exec flag on log file. + + * random/random.c (main): Revoke setgid privileges. + + * rain/rain.c (main): Revoke setgid privileges. + + * quiz/quiz.c (main): Revoke setgid privileges. + + * primes/primes.c (main): Revoke setgid privileges. + + * ppt/ppt.c (main): Revoke setgid privileges. + + * pom/pom.c (main): Revoke setgid privileges. + + * pig/pig.c (main): Revoke setgid privileges. + + * number/number.c (main): Revoke setgid privileges. + + * morse/morse.c (main): Revoke setgid privileges. + + * monop/monop.c (main): Revoke setgid privileges. + + * mille/mille.c (main): Revoke setgid privileges. + + * hunt/hunt/hunt.c (main): Revoke setgid privileges. + + * hangman/main.c (main): Revoke setgid privileges. + + * gomoku/main.c (main): Revoke setgid privileges. + + * fortune/fortune/fortune.c (main): Revoke setgid privileges. + + * fish/fish.c (main): Revoke setgid privileges. + + * factor/factor.c (main): Revoke setgid privileges. + + * cribbage/crib.c (main): Open log file then drop privileges as + soon as possible. + + * canfield/canfield/canfield.c (initall): Use SEEK_SET instead of + 0 as argument of lseek(). + + * canfield/cfscores/cfscores.c (main): Revoke setgid privileges. + + * canfield/canfield/canfield.c (initall): Revoke setgid privileges + after opening the score file. + +1998-08-13 Joseph S. Myers + + * boggle/README.linux: Rebuild. + + * caesar/caesar.c (main): Revoke setgid privileges. + + * boggle/boggle/bog.c (main): Revoke setgid privileges. + + * bcd/bcd.c (main): Revoke setgid privileges. + + * battlestar/com6.c (open_score_file), battlestar/extern.h: New + function. + * battlestar/com6.c (post): Use already opened score file. + * battlestar/battlestar.c (main): Open score file then revoke + setgid privileges. + + * atc/input.c (gettoken): Remove unnecessary setuid() call. + +1998-08-11 Joseph S. Myers + + * AUTHORS (paranoia): Removed entry. + + * bsd-games-non-free.lsm: Update. + + * INSTALL: Update. + + * atc/log.c (open_score_file): Set close-on-exec flag. + + * TODO: Update. + + * PACKAGING: Update. + + * Credits: Split into AUTHORS and THANKS; update. + + * BUGS: Update. + +1998-08-09 Joseph S. Myers + + * battlestar/extern.h, battlestar/save.c, battlestar/init.c, + battlestar/cypher.c, battlestar/battlestar.c: New interface for + saving, passes length and does dynamic allocation rather than + using fixed length buffers. + * battlerstar/Makefile: Include fgetln. + + * banner/banner.c (main): Revoke setgid privileges. + + * backgammon/backgammon/main.c (main): Revoke setgid privileges. + + * atc/log.c: Cast getuid() return value to int for %d format. + + * atc/log.c (open_score_file), atc/extern.h: New function. + * atc/log.c (log_score): Use already opened score file. Truncate + the score file to the length written. + * atc/main.c (main): Open the score file and then revoke setgid + privileges. + + * arithmetic/arithmetic.c (main): Revoke setgid privileges. + + * adventure/main.c (main): Revoke setgid privileges. + + * snake/snscore/snscore.c (main): Take no arguments. + + * hangman/extern.h, hangman/main.c (main): Take no arguments. + + * canfield/canfield/canfield.c (main): Take no arguments. + +1998-08-07 Joseph S. Myers + + * README.non-free: Update. + + * README: Update. + + * paranoia/*: Remove. + + * NEWS: Update. + + * INSTALL: Update. + +1998-08-06 Joseph S. Myers + + * configure: Add facility to specify a list of games not to build. + + * TODO: Update. + + * README: Update. + + * PACKAGING: Update. + + * Credits: Update. + +1998-07-29 Joseph S. Myers + + * NEWS: Update. + + * INSTALL: Update. + + * PACKAGING: New file - information for those packaging bsd-games + for a Linux distribution. + +1998-07-28 Joseph S. Myers + + * TODO: Update. + + * substfiles: Include hide-game (no need to special case it). + * configure, Makefile: Don't special case hide-game. + + * hide-game.in: No longer needs #!/bin/sh, since added by + configure. + * install-score.in: Likewise. + * install-man.in: Likewise. + * caesar/rot13.in: Likewise. + + * configure (substitute): Put comments at the top of generated + files saying they are automatically generated. + +1998-07-27 Joseph S. Myers + + * All games (expect paranoia) now updated from NetBSD-current of + 1998-07-27 (some of the Linux changes merged back to NetBSD). + + * snake/snscore/snscore.c: Update from NetBSD-current of + 1998-07-27. + + * sail/dr_2.c, sail/extern.h: Update from NetBSD-current of + 1998-07-27. + + * rogue/init.c, rogue/machdep.c, rogue/monster.c, rogue/rogue.h: + Update from NetBSD-current of 1998-07-27. + + * robots/move.c: Update from NetBSD-current of 1998-07-27. + + * pom/pom.c: Update from NetBSD-current of 1998-07-27. + + * phantasia/phantglobs.c, phantasia/phantglobs.h: Update from + NetBSD-current of 1998-07-27. + + * mille/mille.h, mille/misc.c: Update from NetBSD-current of + 1998-07-27. + + * battlestar/dayfile.c, battlestar/nightfile.c: Update from + NetBSD-current of 1998-07-27 (changes merged - this changes rcsids + only). + + * atc/atc.6, atc/log.c: Update from NetBSD-current of 1998-07-27. + + * adventure/wizard.c: Update from NetBSD-current of 1998-07-27. + + * configure: Allow defaults to be taken from a config.params file, + which can specify non-interactive operation. + +1998-07-25 Joseph S. Myers + + * configure: Make a /bin/sh script; use printf instead of echo -n + so that a POSIX.2 shell suffices. + + * INSTALL: Update. + + * TODO: Update. + +1998-07-22 Joseph S. Myers + + * NEWS: Update. + + * rogue/machdep.c (md_gseed): Use time, not pid, as seed, so you + don't get the same game each time if you boot the system up to + play rogue (patch from Bill Lash ). + * rogue/monster.c (mv_mons): If a dragon kills a monster on + level_monsters, mv_mons can move things in the free_list, so don't + move monsters not on level_monsters (patch from Bill Lash + ). + + * All games (except paranoia) now updated from NetBSD-current of + 1998-07-11. + + * worms/worms.6: Update from NetBSD-current of 1998-07-11. + + * sail/*: Update from NetBSD-current of 1998-07-11. + + * pom/*: Update from NetBSD-current of 1998-07-11. + + * hunt/*/*: Update from NetBSD-current of 1998-07-11. + + * dm/*: Update from NetBSD-current of 1998-07-11. + +1998-07-21 Joseph S. Myers + + * countmail/countmail.6: Update from NetBSD-current of 1998-07-11. + + * boggle/*/Makefile.bsd: Update from NetBSD-current of 1998-07-11. + + * battlestar/extern.h: Update from NetBSD-current of 1998-07-11. + + * backgammon/backgammon/main.c: Update from NetBSD-current of + 1998-07-11. + + * atc/*: Update from NetBSD-current of 1998-07-11. + * atc/Makefile: Use grammar.h instead of y.tab.h. + + * arithmetic/arithmetic.6: Update from NetBSD-current of + 1998-07-11. + + * quiz/datfiles/europe: Fix typo (patch from G. Branden Robinson + ). + + * TODO: Update. + + * BUGS: Update. + + * README.non-free: Update. + + * YEAR2000: Minor changes. + + * README: Update. + + * INSTALL: Update. + + * Credits: Minor changes. + +1998-07-20 Joseph S. Myers + + * YEAR2000: New file, year 2000 statement for bsd-games. + + * adventure/wizard.c (datime): Handle leap years correctly + according to the Gregorian calendar (could be perceived as fixing + a year 2000 problem, but it was broken wrt leap years anyway). + + * pom/pom.c (main): Add 1900 to year as argument of isleap() + (fixes year 2000 problem). + +1998-07-03 Joseph S. Myers + + * Credits: Add introductory paragraph. + +1998-04-11 Joseph S. Myers + + * Makefile: Add some standard GNU makefile targets. + +1998-04-07 Joseph S. Myers + + * configure: Update message before selecting pager. + + * wump/wump.c (instructions): Use POSIX.2 pager behaviour. + + * quiz/quiz.c (show_index): Use POSIX.2 pager behaviour. + + * fish/fish.c (instructions): Use POSIX.2 pager behaviour. + +1998-04-06 Joseph S. Myers + + * cribbage/instr.c (instructions): Use POSIX.2 pager behaviour. + +1998-04-04 Joseph S. Myers + + * BUGS: Update. + + * INSTALL: Update for changed paths. + + * configure: Change default paths to FHS ones; change some + comments and messages. + + * bsd-games.lsm (Primary-site): Make sunsite, since tsx-11 is + somewhat unreliable and laggardly about installing new releases. + +1998-03-29 Joseph S. Myers + + * Version 2.1. + + * TODO: Update. + + * README: Update. + + * INSTALL: Update. + + * Credits: Update. + +1998-03-28 Joseph S. Myers + + * boggle/README.linux: Rebuild. + + * bsd-games.lsm, bsd-games-non-free.lsm, NEWS: Update. + + * configure: Don't ask about libc version or BSD signal defines. + + * Makeconfig.in (BSD_SIGNAL_DEFS): Removed. + + * */Makefile, */*/Makefile, hunt/Makeconfig: Don't use + $(BSD_SIGNAL_DEFS). + + * include/signal.h: Define __USE_BSD_SIGNAL if libc5, so that the + Makefiles don't need to. + + * lib/fgetln.c: New file, implementation of fgetln() (from + quiz/quiz.c). + * include/stdio.h: New file, wrap and declare fgetln(). + * quiz/quiz.c: Don't include implementation of fgetln(). + +1998-03-27 Joseph S. Myers + + * dm/dm.c (load): Use getloadavg(). + * dm/Makefile: Use getloadavg() from lib/getloadavg.c. + + * lib/getloadavg.c: New file, implementation of getloadavg(). + * include/stdlib.h: New file, wrap and declare + getloadavg(). + + * wump/wump.c (move_to, shoot): Add explicit braces to avoid + ambiguous else. + + * trek/shield.c (shield): Add explicit braces to avoid ambiguous + else. + + * trek/nova.c (nova): Add explicit braces to avoid ambiguous else. + + * trek/move.c (move): Add explicit braces to avoid ambiguous else. + + * trek/kill.c (killb): Add explicit braces to avoid ambiguous + else. + + * sail/sync.c (sync_update): Add explicit braces to avoid + ambiguous else. + + * sail/sync.c (Sync): Don't declare errno. + + * sail/dr_1.c (compcombat, next): Add explicit braces to avoid + ambiguous else. + + * sail/pl_7.c (newturn): Add explicit braces to avoid ambiguous + else. + + * sail/pl_3.c (acceptcombat): Add explicit braces to avoid + ambiguous else. + + * phantasia/misc.c (tradingpost): Add explicit braces to avoid + ambiguous else. + + * phantasia/fight.c (playerhits, awardtreasure): Add explicit + braces to avoid ambiguous else. + + * phantasia/main.c (main): Add explicit braces to avoid ambiguous + else. + + * fortune/fortune/fortune.6: Rename to fortune.6.in. + * fortune/fortune/fortune.6.in: Parametrise. + * substfiles: Include fortune/fortune/fortune.6. + + * monop/morg.c (set_mlist): Add explicit braces to avoid ambiguous + else. + + * monop/cards.c (get_card): Add explicit braces to avoid ambiguous + else. + + * hunt/hunt/hunt.c (list_drivers): Add explicit int in declaration + of `initial'. + (env_init): Add explicit braces to avoid ambiguous else. + + * fortune/fortune/fortune.c (display, form_file_list): Add + explicit braces to avoid ambiguous else. + (init_prob): Add braces to make if/else binding agree with the + indentation. + + * cribbage/score.c (scorehand): Add explicit braces to avoid + ambiguous else. + + * cribbage/crib.c (peg): Add explicit braces to avoid ambiguous + else. + + * boggle/boggle/bog.c (main): Add explicit braces to avoid + ambiguous else. + + * battlestar/com5.c (love): Add explicit braces to avoid ambiguous + else. + + * atc/input.c (delayb, benum): Change char to unsigned char for + subscript. + + * Credits: Update. + + * paranoia/paranoia.6: New manpage, from Joey Hess. + * paranoia/Makefile: Install it. + + * wargames/wargames.6: New manpage, from Joey Hess + . + * wargames/Makefile: Install it. + + * hunt/Makefile.inc.bsd, hunt/hunt/Makefile.bsd, hunt/huntd/bsd.h, + hunt/huntd/hunt.h, hunt/huntd/huntd.6.in, hunt/huntd/talk_ctl.h: + Update from NetBSD-current of 1998-03-21. + + * fortune/*: Update from NetBSD-current of 1998-03-21. + * fortune/fortune/Makefile: Use -DHAVE_REGCOMP. + + * Makefile.inc.bsd, adventure/init.c, atc/Makefile.bsd, + backgammon/Makefile.inc.bsd, battlestar/Makefile.bsd, + battlestar/extern.h, boggle/*/Makefile.bsd, caesar/caesar.6, + canfield/*/Makefile.bsd, cribbage/Makefile.bsd, dm/Makefile.bsd, + dm/dm.c, factor/Makefile.bsd, fish/fish.c, rain/Makefile.bsd, + robots/Makefile.bsd, rogue/Makefile.bsd, sail/Makefile.bsd, + snake/*/Makefile.bsd, tetris/Makefile.bsd, worm/Makefile.bsd, + worms/Makefile.bsd, gomoku/Makefile.bsd, gomoku/main.c, + hangman/Makefile.bsd, mille/Makefile.bsd, phantasia/Makefile.bsd, + phantasia/setup.c, quiz/datfiles/pres: Update from NetBSD-current + of 1998-03-21. + +1998-03-26 Joseph S. Myers + + * monop/monop.c (main): Use SIGINT instead of 2 in signal. + + * backgammon/teachgammon/teach.c (main): Use SIGINT instead of 2 + in signal. + + * backgammon/backgammon/main.c (main): Use SIGINT instead of 2 in + signal, and 14 instead of SIGALRM. + + * BUGS: New file, lists known bugs. + * INSTALL, README, TODO: Update. + + * trek/dumpgame.c (restartgame): Use O_RDONLY instead of 0 in + open. + + * monop/execute.c (rest_f): Use O_RDONLY instead of 0 in open. + + * fortune/fortune/fortune.c (add_file, all_forts, open_dat, + get_pos, get_tbl): Use O_RDONLY instead of 0 in open. + + * canfield/cfscores/cfscores.c (main): Use O_RDONLY instead of 0 + in open. + + * canfield/canfield/canfield.c (initall): Use O_RDWR instead of 2 + in open. + + * quiz/datfiles/europe: Added more new countries. + +1998-03-25 Joseph S. Myers + + * quiz/datfiles/europe: Update for political changes of the 1990s + (needs more work). + + * Credits: Update. + * INSTALL, README: Update (need libc 5.4.5 or later if using + libc5). + +1998-01-02 Joseph S. Myers + + * battlestar/battlestar.c, battlestar/init.c, battlestar/save.c, + battlestar/extern.h, battlestar/cypher.c, + battlestar/battlerstar.6: Let save file name vary. + +1997-12-30 Joseph S. Myers + + * battlestar/com5.c (give): The value 0 used in NetBSD is as good + as any for initialising last1 and last2, so use it; check for it + in last1 at the appropriate place and give an error if so. + + * battlestar/com3.c (shoot): Correct initialiser for firstnumber + is always wordnumber. + +1997-12-29 Joseph S. Myers + + * mille/mille.h, mille/varpush.c: Make previous change conditional + on defined(__linux__) && !defined(__GLIBC__), since the X/Open + spec says you should use int but libc5 (only) uses size_t. + + * boggle/boggle/help.c (help): Use redrawwin(stdscr) at the end, + to get proper redrawing with ncurses. + * boggle/README.linux: Rebuild. + + * Makeconfig.in (DEFS_TO_PASS, DEFS_TO_PASS_STRIP): New variables, + definitions of installation variables to pass to sub-makes. + * Makefile (install, install-strip): Use these. + * configure (strip_install): Remove configuration option. + * INSTALL: Update. + * backgammon/Makefile, boggle/Makefile, canfield/Makefile, + fortune/Makefile, hunt/Makefile, snake/Makefile: Pass DEFS_TO_PASS + in install. + +1997-12-26 Joseph S. Myers + + * mille/mille.h: prscore's argument is bool, not int (from Joey + Hess). + +1997-12-25 Joseph S. Myers + + * Version 2.0. + + * INSTALL: Add name and email address to bottom. + + * Credits: Update. + +Sun Dec 21 11:59:34 1997 Joseph S. Myers + + * configure: Don't ask for file for backgammon rules. + + * TODO: Update. + + * Makefile (install): Don't create $(SOCKETDIR), which is no + longer defined. + + * bsd-games-non-free.lsm: Update. + + * bsd-games.lsm: Update. + + * README: Update. + + * configure: Don't configure bsd_lib or bsd_includes. + * Makeconfig.in: Delete BSD_LIB, BSD_INCS, BSD_DEFS. + + * configure (warning_flags): Default to -Wall -W + -Wstrict-prototypes -Wmissing-prototypes. + +Sat Dec 20 11:25:48 1997 Joseph S. Myers + + * All games (except paranoia) now updated to NetBSD-current of + 1997-12-12. + + * wump/wump.c: Include . + + * wump/*: Update from NetBSD-current of 1997-12-12. + * wump/Makefile: Use -I../include; don't define path; don't use + libbsd or ncurses. + * substfiles: Include wump/pathnames.h. + + * worms/worms.c (onsig): Mark unused parameter. + + * worms/*: Update from NetBSD-current of 1997-12-12. + * worms/Makefile: Use -I../include; use BSD signal defines only. + + * worm/worm.c: Mark unused parameters. + + * worm/worm.6: Fix. + + * worm/*: Update from NetBSD-current of 1997-12-12. + * worm/Makefile: Use -I../include; use BSD signal defines only. + + * trek/warp.c (dowarp): Mark parameter as int. + + * trek/abandon.c, trek/capture.c, trek/computer.c, trek/dcrept.c, + trek/destruct.c, trek/dock.c, trek/dumpgame.c, trek/help.c, + trek/impulse.c, trek/lrscan.c, trek/phaser.c, trek/play.c, + trek/rest.c, trek/setwarp.c, trek/torped.c, trek/visual.c, + trek/cgetc.c: Mark unused parameters. + + * trek/*: Update from NetBSD-current of 1997-12-12. + * trek/Makefile: Use -I../include; don't use libbsd. + + * tetris/tetris.c: Mark unused parameter. + + * tetris/scores.c: Fix warnings. + + * tetris/screen.c, tetris/screen.h: Make put return int. + + * tetris/screen.c: Don't declare ospeed. + + * tetris/*: Update from NetBSD-current of 1997-12-12. + * tetris/Makefile: Use -I../include; don't define paths; use BSD + signal defines only. + * substfiles: Include tetris/pathnames.h. + + * snake/snake/snake.c, snake/snscore/snscore.c: Mark unused + parameters. + + * snake/snake/snake.h, snake/snake/move.c: Make outch return int. + + * snake/snake/snake.h, snake/snake/move.c: Don't declare ospeed. + + * snake/*: Update from NetBSD-current of 1997-12-12. + * snake/snake/Makefile, snake/snscore/Makefile: Use + -I../../include; don't define paths; use BSD signal defines only. + * substfiles: Include snake/snake/pathnames.h. + + * sail/pl_main.c, sail/pl_7.c, sail/player.h: Move screen + initialisation into initscreen(); no longer do echo() in + SCREENTEST(). + + * sail/sync.c: Include and ; mark int + parameter. + + * sail/misc.c: Include , for flock(). + + * sail/game.c: Fix pointer/integer comparison warning. + + * sail/dr_2.c: Mark int parameters as such. + + * sail/player.h (SCREENTEST): Compare initscr() against NULL, not + ERR. + + * sail/main.c, sail/pl_1.c, sail/pl_7.c: Mark unused parameters. + + * sail/dr_2.c, sail/extern.h: Rename move to sail_move. + + * sail/*: Update from NetBSD-current of 1997-12-12. + * sail/Makefile: Use -I../include; don't define paths; use BSD + signal defines only. + * substfiles: Include sail/pathnames.h + + * rogue/save.c: Fix signed/unsigned warnings. + + * rogue/monster.c, rogue/object.c, rogue/pack.c, rogue/room.c: + Mark int parameters as such. + + * rogue/init.c: Mark unused parameters. + + * rogue/*: Update from NetBSD-current of 1997-12-12. + * rogue/Makefile: Use -I../include; don't define path; use BSD + signal defines only. + * substfiles: Include rogue/pathnames.h. + + * robots/move.c (get_move): Always initialise lastmove, to shut up + gcc. + + * robots/main.c: Remove unused function __cputchar; mark unused + parameter. + + * robots/move.c (get_move): Restore declaration of lastmove. + + * robots/*: Update from NetBSD-current of 1997-12-12. + * robots/Makefile: Use -I../include; don't define path; use BSD + signal defines only. + * substfiles: Include robots/pathnames.h. + + * Credits: List original authors. + + * bsd-games.lsm: Update. + + * NEWS: Update. + + * INSTALL: Update. + + * README.non-free: Update. + + * README: Update. + + * countmail/*: New game, from NetBSD-current of 1997-12-12. + + * configure (install_script): New variable, avoid warnings about + stripping scripts. + * Makeconfig.in (INSTALL_SCRIPT): Define. + * caesar/Makefile, wargames/Makefile: Use $(INSTALL_SCRIPT). + +Fri Dec 19 14:37:56 1997 Joseph S. Myers + + * TODO: Update. + + * hunt/*: New port, replacing the old one, based on NetBSD-current + of 1997-12-12. + * substfiles: Update accordingly. + * configure, Makeconfig.in: No longer need to configure directory + for sockets. + + * random/*: Update from NetBSD-current of 1997-12-12. + * random/Makefile: Use -I../include. + + * rain/rain.c: Make fputchar return int, since this is what tputs + expects. Also mark unused parameters. + + * rain/*: Update from NetBSD-current of 1997-12-12. + * rain/Makefile: Use -I../include; don't use libbsd. + * substfiles: Don't include rain/rain.6. + + * quiz/quiz.c (appdstr): Change NULL to '\0' to fix warning. + + * quiz/*: Update from NetBSD-current of 1997-12-12. + * quiz/Makefile: Use -I../include; don't define paths. + * substfiles: Include quiz/pathnames.h.in. + + * primes/*: Update from NetBSD-current of 1997-12-12. + * primes/Makefile: Use -I../include. + + * include/sys/ttydefaults.h: New file, wrap so + that individual games need not know that it is in glibc but not + libc5. + * hangman/getguess.c: Restore to NetBSD version since these + conditionals are no longer needed. + + * lib/select.c: New file, emulate BSD select for games that need + it (I think only hunt), so that libbsd will not be needed at all + and games will work fine with libc6. + +Thu Dec 18 13:24:54 1997 Joseph S. Myers + + * ppt/*: Update from NetBSD-current of 1997-12-12. + * ppt/Makefile: Use -I../include. + + * pom/pom.c: Mark unused parameters. + + * pom/*: Update from NetBSD-current of 1997-12-12. + * pom/Makefile: Use -I../include; don't use libbsd. + * include/tzfile.h: New file. + + * pig/pig.c (main): Fix signed/unsigned warning. + + * pig/*: Update from NetBSD-current of 1997-12-12. + * pig/Makefile: Use -I../include. + + * phantasia/setup.c: Include ; fix warnings; add + prototypes and function return types. + + * phantasia/interplayer.c (dotampered): Avoid signed/unsigned + warning. + + * phantasia/io.c (catchalarm): Mark unused parameter. + + * phantasia/*: Update from NetBSD-current of 1997-12-12. + * phantasia/Makefile: Don't define paths; use BSD signal defines + only. + * substfiles: Include phantasia/pathnames.h. + + * paranoia/paranoia.c: Include headers, add prototypes and + function return types; changes to avoid warnings. + + * number/*: Update from NetBSD-current of 1997-12-12. + * number/Makefile: Use -I../include. + + * morse/*: Update from NetBSD-current of 1997-12-12. + * morse/Makefile: Use -I../include. + + * monop/cards.c: Avoid signed/unsigned warning. + + * monop/monop.c (do_quit): Mark unused parameter. + + * monop/*: Update from NetBSD-current of 1997-12-12. + * monop/Makefile: Use -I../include; don't define path; use BSD + signal defines only. + * substfiles: Include monop/pathnames.h. + + * NEWS: Update; fix typo. + + * mille/save.c: Include . + + * mille/mille.h, varpush.c: Use size_t for last argument of last + argument of varpush. + + * mille/comp.c (calcmove): Avoid signed/unsigned warning. + + * mille/mille.c (rub): Mark unused parameter. + + * mille/*: Update from NetBSD-current of 1997-12-12. + * mille/Makefile: Use -I../include; don't use libbsd. + * substfiles: Don't include mille/mille.6, it's no longer needed. + + * hangman/setup.c: Include . + + * hangman/main.c: Mark unused parameters. + + * hangman/*: Update from NetBSD-current of 1997-12-12. + * hangman/Makefile: Use -I../include; don't define path; don't use + libbsd. + * substfiles: Include hangman/pathnames.h. + +Wed Dec 17 16:14:21 1997 Joseph S. Myers + + * gomoku/pickmove.c: Fix signed/unsigned warnings; mark unused + parameter. + + * gomoku/main.c: Include ; mark unused parameter. + + * gomoku/*: Update from NetBSD-current of 1997-12-12. + * gomoku/Makefile: Use -I../include; use BSD signal defines only. + + * fortune/strfile/strfile.c, fortune/fortune/fortune.c, + fortune/unstr/unstr.c: Changes to avoid warnings. + + * fortune/*: Update from NetBSD-current of 1997-12-12. + * fortune/fortune/Makefile, fortune/strfile/Makefile, + fortune/unstr/Makefile: Use -I../../include; don't use libbsd; + don't define paths. + * substfiles: Include fortune/fortune/pathnames.h. + + * fish/*: Update from NetBSD-current of 1997-12-12. + * fish/Makefile: Use -I../include. + * substfiles: Include fish/pathnames.h. + + * primes/pr_tbl.c: Use __RCSID. + + * factor/*: Update from NetBSD_current of 1997-12-12. + * factor/Makefile: Use -I../include. + + * Makeconfig.in: Remove dm variables. + + * dm/dm.c: Mark unused parameter. + + * dm/pathnames.h.in: Undefine _PATH_LOG before defining it. + + * dm/dm.8.in: Fix. + + * dm/*: Update from NetBSD-current of 1997-12-12. + * dm/Makefile: Use -I../include; don't define paths. + * substfiles: Include dm/pathnames.h. + +Tue Dec 16 10:35:32 1997 Joseph S. Myers + + * cribbage/io.c, cribbage/score.c: Avoid signed/unsigned warning; + mark unused parameters. + + * cribbage/*: Update from NetBSD-current of 1997-12-12. + * cribbage/Makefile: Use -I../include; don't use libbsd or define + paths. + * substfiles: Include cribbage/pathnames.h. + + * canfield/canfield/canfield.c: Include ; mark unused + parameters. + + * canfield/*: Update from NetBSD-current of 1997-12-12. + * canfield/canfield/Makefile, canfield/cfscores/Makefile: Use + -I../../include. + * substfiles: Include canfield/canfield/pathnames.h. + * canfield/canfield/Makefile, canfield/cfscores/Makefile: Don't + define _PATH_SCORE; don't use libbsd. + + * caesar/*: Update from NetBSD-current of 1997-12-12. + * caesar/Makefile: Use -I../include. + * caesar/rot13.in: Use "$@" instead of $*. + + * boggle/boggle/mach.c: Mark unused parameters. + + * boggle/boggle/bog.c: Changes to avoid warnings. + + * boggle/mkindex/mkindex.c (main): Make it take no arguments, + since they are unused. + + * boggle/mkdict/mkdict.c: Include ; other changes to avoid + warnings. + + * boggle/*: Update from NetBSD-current of 1997-12-12. + * boggle/boggle/Makefile, boggle/mkdict/Makefile, + boggle/mkindex/Makefile: Use -I../../include. + * substfiles: Include boggle/boggle/bog.h. + * boggle/boggle/Makefile: Don't define paths. + * boggle/Makefile, boggle/README.linux: Update for change to bog.h.in. + + * bcd/bcd.6: Fix. + + * bcd/*: Update from NetBSD-current of 1997-12-12. + * bcd/Makefile: Use -I../include. + + * battlestar/battlestar.6: Fix typo. + + * battlestar/com6.c, battlestar/fly.c: Mark unused parameters. + + * battlestar/*: Update from NetBSD-current of 1997-12-12. + * battlestar/Makefile: Use -I../include, and BSD signal defines + only. + * substfiles: Include battlestar/pathnames.h. + * battlestar/Makefile: Don't define _PATH_SCORE. + +Mon Dec 15 10:07:10 1997 Joseph S. Myers + + * banner/Makefile: Use -I../include. + + * banner/*: Update from NetBSD-current of 1997-12-12. + + * TODO: Update. + + * backgammon/common_source/subs.c (getarg): Check that an argument + is given to -s. + + * backgammon/common_source/subs.c, backgammon/backgammon/main.c, + backgammon/teachgammon/teach.c: Mark unused parameters. + + * backgammon/common_source/subs.c (addbuf): Make addbuf return an + int, since this is what tputs expects. + * backgammon/common_source/back.h: Likewise. + + * backgammon/teachgammon/teach.c: Don't declare ospeed. + + * backgammon/backgammon/main.c: Don't declare ospeed; include + . + + * backgammon/backgammon/Makefile, + backgammon/common_source/Makefile, + backgammon/teachgammon/Makefile: Use -I../../include. + + * Makeconfig.in (BACKGAMMON_RULES): Remove. + + * backgammon/*: Update from NetBSD-current of 1997-12-12; make + changes for no longer having simple game. + + * atc/pathnames.h: Remove. + * atc/pathnames.h.in: New file, from NetBSD-current and + parametrised. + * substfiles: Substitute in this file. + * atc/Makefile: Don't define _PATH_GAMES and _PATH_SCORE any more. + + * substfiles: New file - list of files created by substitution. + * configure, Makefile: Use this list. + + * atc/log.c (log_score): Use nodename, not sysname. + + * atc/grammar.y, atc/graphics.c, atc/log.c, atc/main.c, + atc/update.c: Mark unused parameters and add parameter types. + + * atc/Makefile: Use -I../include and -DYY_NO_UNPUT. + + * atc/*: Update from NetBSD-current of 1997-12-12. + + * adventure/setup.c: Use __RCSID and __COPYRIGHT. + + * include/sys/cdefs.h: Mark rcsid and copyright unused, so -Dlint + is not needed when using warnings. + + * arithmetic/arithmetic.c (intr): Mark `dummy' unused. + + * arithmetic/Makefile: Use -I../include. + + * arithmetic/*: Update from NetBSD-current of 1997-12-12. + + * adventure/init.c, adventure/subr.c, adventure/wizard.c: Add + argument types and mark unused arguments as + __attribute__((unused)). + + * adventure/crc.c: Make step unsigned int. + + * adventure/setup.c: Add prototype; include . + * adventure/extern.h: Remove prototypes for setup.c. + + * adventure/Makefile: Use -I../include. + + * adventure/*: Update from NetBSD-current of 1997-12-12. + + * include/signal.h: New file, wrapper to typedef sig_t without + needing for libc5. + + * include/sys/cdefs.h: New file, wrapper to define __RCSID and + __COPYRIGHT. + + * Makefile.bsd, Makefile.inc.bsd: Update from NetBSD-current of + 1997-12-12. + +Wed Sep 24 13:44:06 1997 Joseph S. Myers + + * caesar/caesar.c: Include and ; add + prototypes and function return types; remove old declarations. + + * boggle/boggle/mach.c (winch_catcher): Don't ioctl(TIOCGWINSZ). + + * boggle/boggle/bog.c: Add prototypes. + + * boggle/mkdict/mkdict.c: Add prototypes. + * boggle/mkindex/mkindex.c: Add prototypes; include . + + * boggle/README.linux: Update. + + * INSTALL: Update. + * README: Update. + * README.non-free: Update. + * TODO: Update. + * bsd-games-non-free.lsm: Update. + * Makeconfig.in: Update. + + * configure: Use boggle instead of bog; don't substitute in + bog.6.in. + * Makefile: Don't remove bog/bog.6. + + * boggle/boggle/extern.h: Include (for time_t). + + * boggle/boggle/Makefile: Use BSD signal defines only. + + * boggle/*: From NetBSD-current; merge in Linux changes from bog. + + * atc/log.c, atc/update.c: Consistently use strchr and strrchr. + * atc/include.h [SYSV]: Remove #defines of index and rindex. + + * bcd/bcd.c (printcard): Remove declaration of index(); use + strchr(); make p unsigned char. + + * bcd/bcd.c: Include . + + * bcd/bcd.c: Add prototypes and function return types. + +Sat Sep 13 21:08:53 1997 Joseph S. Myers + + * configure: Fix spelling errors; some cleanup. + +Tue Sep 2 17:28:22 1997 Joseph S. Myers + + * configure: Use empty man8dir if not building in dm or fortune. + +Sun Aug 24 10:33:08 1997 Joseph S. Myers + + * adventure/*: Update from NetBSD-current of 1997-08-24. + * adventure/Makefile: Add dependency on extern.h. + * adventure/Makefile: Add definitions of __RCSID and __COPYRIGHT. + + * fortune/*: Update from NetBSD-current of 1997-08-24. + + * battlestar/fly.c: Include . + + * battlestar/fly.c (visual): Remove declaration of moveenemy(). + + * battlestar/save.c (restore): Remove declaration of getenv(). + (save): Likewise. + + * battlestar/getcom.c: Include "extern.h" for prototypes. + + * battlestar/init.c: Include . + + * battlestar/init.c (initialize): Remove declaration of die(). + + * battlestar/com6.c (post): Remove declaration of ctime(). + + * battlestar/com1.c: Include (for sleep). + * battlestar/com1.c (convert): Make i and j unsigned to avoid + warnings for comparison with unsigned. + * battlestar/com4.c (throw): Make n unsigned for the save reason. + + * battlestar/extern.h, battlestar/parse.c, battlestar/room.c, + battlestar/save.c: Add prototypes and function return types. + +Sat Aug 23 21:17:20 1997 Joseph S. Myers + + * battlestar/battlestar.c, battlestar/com1.c, battlestar/com2.c, + battlestar/com3.c, battlestar/com4.c, battlestar/com5.c, + battlestar/com6.c, battlestar/com7.c, battlestar/cypher.c, + battlestar/extern.h, battlestar/fly.c, battlestar/getcom.c, + battlestar/init.c, battlestar/misc.c: Add prototypes and function + return types. + + * battlestar/extern.h: Don't conditionalise inclusion of + . + +Mon Aug 18 09:14:17 1997 Joseph S. Myers + + * banner/banner.c: Add prototype for main(). + + * backgammon/common_source/Makefile, + backgammon/backgammon/Makefile, backgammon/teachgammon/Makefile: + Use BSD signal defines only. + + * atc/include.h: Include (for umask). + + * atc/Makefile: Use BSD signal defines only. + + * adventure/Makefile: Don't use BSD includes, defines or library + (works with SYSV signal semantics as well). + + * configure: Ask for libc version; configure defines for BSD + signal semantics (-D__USE_BSD_SIGNAL, etc.). + * Makeconfig.in (BSD_SIGNAL_DEFS): New variable. + + * backgammon/common_source/Makefile (clean): Remove sbackgammon. + + * backgammon/common_source/fancy.c: Include . + + * backgammon/common_source/subs.c: Include . + + * backgammon/common_source/save.c: Include . + + * backgammon/common_source/fancy.c: Include . + + * backgammon/common_source/allow.c, + backgammon/common_source/back.h, backgammon/common_source/board.c, + backgammon/common_source/check.c, + backgammon/common_source/fancy.c, backgammon/common_source/odds.c, + backgammon/common_source/one.c, backgammon/common_source/save.c, + backgammon/common_source/subs.c, backgammon/common_source/table.c: + Add prototypes and function return types. + +Sun Aug 10 10:06:10 1997 Joseph S. Myers + + * atc/main.c (main): Include program name in `Unknown option' + error message. + + * atc/include.h: Include . + + * atc/extern.h, atc/graphics.c, atc/input.c, atc/list.c, + atc/log.c, atc/main.c, atc/update.c: Add prototypes and function + return types. + +Sat Aug 9 16:36:17 1997 Joseph S. Myers + + * atc/extern.h, atc/grammar.y, atc/graphics.c, atc/input/c, + atc/update.c: Add prototypes and function return types. + +Thu Aug 7 12:01:56 1997 Joseph S. Myers + + * atc/include.h: Make inclusion of unconditional; + remove unused defines of bcopy and bzero under SYSV. + + * configure: Escape ` and ' when asking for .so or symlinks. + + * configure, Makeconfig.in, atc/Makefile: Configure yacc and lex + programs using configure script. + + * configure: Add note about placing of sockets. + + * dm/README.linux: New file, mentions -DLOG. + + * configure, Makeconfig.in, dm/Makefile: Configure log file for dm. + +Sun Jul 27 12:45:18 1997 Joseph S. Myers + + * arithmetic/arithmetic.c: Include and ; add + function return types and prototypes; remove previous function + declarations. + +Sat Jul 26 20:17:49 1997 Joseph S. Myers + + * adventure/crc.c: Add prototypes. + + * adventure/setup.c (main): Add casts so as not to print a long + with an int format. + + * adventure/io.c, adventure/setup.c: Add prototypes and function + return types. + +Fri Jul 25 12:48:04 1997 Joseph S. Myers + + * adventure/wizard.c: Include ; remove declaration of + localtime(). + + * adventure/setup.c: Include . + + * adventure/subr.c, adventure/wizard.c: Add some prototypes. + + * adventure/save.c: Include . + + * adventure/crc.c, adventure/io.c, adventure/save.c, + adventure/vocab.c, adventure/wizard.c: Add function return types. + + * adventure/hdr.h: More prototypes. + + * adventure/wizard.c (ran): Remove declaration of rand(). + + * adventure/hdr.h, adventure/init.c, adventure/wizard.c: Change + macro DECR and all uses so as not to need -traditional-cpp + * adventure/Makefile: Don't use -traditional-cpp. + +Thu Jul 24 19:30:35 1997 Joseph S. Myers + + * adventure/init.c: Include and ; remove + declaration of time(). + + * adventure/init.c: Add argument to trapdel(); add prototype for + linkdata(). + + * adventure/main.c (main): Remove declaration of trapdel(). + + * adventure/main.c: Add prototype for main(). + + * adventure/hdr.h, adventure/main.c, adventure/save.c, + adventure/vocab.c: Change link to adv_link. + + * adventure/main.c: Include . + + * adventure/io.c: Include . + + * adventure/wizard.c: Include and . + + * adventure/vocab.c: Include and . + + * adventure/subr.c: Include and . + + * adventure/done.c: Include and . + + * adventure/done.c, adventure/init.c, adventure/io.c, + adventure/save.c, adventure/subr.c, adventure/vocab.c, + adventure/wizard.c: Add function return types. + + * adventure/hdr.h: Add prototypes; remove declaration of malloc(). + +Sat Jul 19 20:51:49 1997 Joseph S. Myers + + * configure: Set empty man5dir if not building in dm. + +Thu Jul 17 16:41:29 1997 Joseph S. Myers + + * Version 1.5. + + * bsd-games-non-free.lsm: Update. + + * bsd-games.lsm: Update. + +Wed Jul 16 12:50:00 1997 Joseph S. Myers + + * bsd-games.lsm: Update. + + * NEWS: Update. + + * Makefile (install): Create MAN5DIR. + + * NEWS: Update. + + * bsd-games-non-free.lsm: Update. + + * bsd-games.lsm: Update. + +Tue Jul 15 15:57:06 1997 Joseph S. Myers + + * bsd-games-non-free.lsm: Update. + + * bsd-games.lsm: Update. + + * TODO: Update. + + * README.non-free: Update. + + * README: Update. + + * INSTALL: Update. + + * rogue/machdep.c (md_slurp): Use tcflush() under Linux. + + * rogue/Makefile (DEFS): Add UNIX_SYSV to get included in + machdep.c. + + * rogue/*: Added from NetBSD-current. + * rogue/Makefile: Renamed to Makefile.bsd. + * rogue/USD.doc/Makefile: Renamed to Makefile.bsd. + * rogue/Makefile: New file. + * rogue/rogue.6: Rename to rogue.6.in. + * rogue/rogue.6.in: Parametrise. + * configure: Ask for rogue scorefile; substitute in this file. + * Makefile: Remove rogue.6 in distclean. + * Makeconfig.in: Include ROGUE_SCOREFILE. + * rogue/pathnames.h: The path for the score file is in the + Makefile. + +Mon Jul 14 11:46:56 1997 Joseph S. Myers + + * quiz/Makefile (clean): Add target. + + * random/*: Added from NetBSD-current. + * random/Makefile: Renamed to Makefile.bsd. + * random/Makefile: New file. + + * quiz/quiz.c (fgetln): Add implementation since Linux libc lacks + fgetln. + + * quiz/*: Added from NetBSD-current. + * quiz/Makefile: Renamed to Makefile.bsd. + * quiz/Makefile: New file. + * quiz/datfiles/index: Rename to index.in. + * quiz/datfiles/index.in: Parametrise. + * quiz/quiz.6: Rename to quiz.6.in. + * quiz/quiz.6.in: Parametrise. + * configure: Ask for quiz directory; substitute in these files. + * Makeconfig.in (QUIZ_DIR): Add for quiz directory. + * Makefile: Remove index and quiz.6 in distclean. + * quiz/pathnames.h: Paths are defined in the Makefile. + + * pig/*: Added from NetBSD-current. + * pig/Makefile: Renamed to Makefile.bsd. + * pig/Makefile: New file. + + * phantasia/main.c (playinit): Add ICRNL to terminal modes if + using ncurses. + + * phantasia/Makefile (install): Bug-fix. + + * configure: Configure directory for phantasia. + * Makeconfig.in: Include PHANTASIA_DIR. + * phantasia/pathnames.h: Paths are defined in Makefile. + * phantasia/Makefile: Supply motd to setup. + +Sun Jul 13 18:28:52 1997 Joseph S. Myers + + * phantasia/*: Added from NetBSD-current. + * phantasia/Makefile: Renamed to Makefile.bsd. + * phantasia/Makefile: New file. + + * dm/dm.c (load): Add Linux-specific way of getting load average. + + * dm/dm.8: Rename to dm.8.in. + * dm/dm.conf.5: Rename to dm.conf.5.in. + * dm/dm.8.in, dm/dm.conf.5.in: Parametrise. + * configure: Substitute in these files. + * Makefile: Remove dm.8 and dm.conf.5 in distclean. + + * configure: Do additional configuration for dm. + * Makeconfig.in: Include these variables. + * install-man.in: Allow manual section 5. + + * dm/*: Added from NetBSD-current. + * dm/Makefile: Renamed to Makefile.bsd. + * dm/Makefile: New file. + + * TODO: Update. + + * All games, except bog, hunt, and paranoia, now updated from + NetBSD-current of 1997-07-12. + + * cribbage/*: Update from NetBSD-current of 1997-07-12. + +Fri Jul 11 19:09:24 1997 Joseph S. Myers + + * bog/README.linux: Comply with licence conditions by including + patch from original bog. + * bog/Makefile (linux-patch): Create or update this patch. + + * banner/*: Added from NetBSD-current. + * banner/Makefile: Renamed to Makefile.bsd. + * banner/Makefile: New file. + + * atc/graphics.c (getAChar): Use SYSV method instead of BSD one + under Linux; change conditional on inclusion of to allow + for this. + +Thu Jun 12 20:32:57 1997 Joseph S. Myers + + * adventure/*: Added from NetBSD-current. + * adventure/Makefile: Renamed to Makefile.bsd. + * adventure/Makefile: New file. + +Wed Jun 11 12:09:38 1997 Joseph S. Myers + + * Now builds with glibc without needing stray headers. + + * snake/snake/snake.c: Define MIN instead of including + . + + * pom/pom.c: With glibc, define isleap instead of including + . + + * mille/Makefile: Remove dependency on unctrl.h. + + * configure: Choose default for BSD-compat includes based on + whether /usr/include/bsd exists. + +Tue Jun 10 17:40:44 1997 Joseph S. Myers + + * All games, with same exceptions as below, now updated from + NetBSD-current of 1997-06-07. + + * cribbage/*, hangman/*, mille/*, robots/*, tetris/*: Update from + NetBSD-current of 1997-06-07. + +Fri Jun 6 22:19:38 1997 Joseph S. Myers + + * README: Update. + + * *.orig, */*.orig, */*/*.orig: Rename to *.bsd instead to avoid + conflicts with patch backups. + +Thu May 22 00:03:59 1997 Joseph S. Myers + + * TODO: Update. + + * README.non-free: Update. + + * README: Update. + +Wed May 21 00:08:36 1997 Joseph S. Myers + + * TODO: Update. + + * README: Update. + + * INSTALL: Update. + + * Now builds with glibc. + + * bog/mach.c (flushin): Use the flushinp() version. + + * cribbage/extern.c: Change `bool' to `BOOLEAN'. + + * atc/Makefile: Use -lfl instead of -ll. + +Tue May 20 00:26:52 1997 Joseph S. Myers + + * All games, with same exceptions as below, now updated from + NetBSD-current of 1997-05-17. + + * backgammon/backgammon/Makefile.orig, + backgammon/teachgammon/Makefile.orig, factor/Makefile.orig, + fortune/Makefile.orig, fortune/datfiles/Makefile.orig, + fortune/strfile/Makefile.orig, wargames/Makefile.orig: Update from + NetBSD-current of 1997-05-17. + +Mon May 19 00:50:37 1997 Joseph S. Myers + + * All games, except bog, hunt and paranoia, now updated from + NetBSD-current of 1997-04-26. + + * wump/*: Update from NetBSD-current of 1997-04-26. + + * worms/Makefile (DEFS): Remove -DUSG which is no longer needed. + + * worms/*: Update from NetBSD-current of 1997-04-26. + + * worm/worm.c (process): Move the move to highlight head of worm + here from main(). + + * worm/*: Update from NetBSD-current of 1997-04-26. + + * wargames/*: Update from NetBSD-current of 1997-04-26. + +Sun May 18 01:29:05 1997 Joseph S. Myers + + * trek/README.linux: New file, mentions trek manual. + + * trek/*: Update from NetBSD-current of 1997-04-26. + + * tetris/screen.c (OXTABS): Define to XTABS. + + * tetris/*: Update from NetBSD-current of 1997-04-26. + +Sat May 17 12:24:07 1997 Joseph S. Myers + + * snake/snake/snake.c: Define CTRL. + + * snake/snake/move.c: Include ; condition use of VDSUSP + on its being defined; define CTRL; define OXTABS. + + * snake/*: Update from NetBSD-current of 1997-04-26. + + * sail/pl_7.c: Don't include . + + * sail/Makefile: Change dependency on externs.h to extern.h. + + * sail/*: Update from NetBSD-current of 1997-04-26. + +Thu May 15 15:09:59 1997 Joseph S. Myers + + * robots/move.c: Don't include ; define CTRL. + + * robots/*: Update from NetBSD-current of 1997-04-26. + + * hangman/getguess.c: Fix sense of glibc test for + . + + * rain/rain.6: Rename to rain.6.in. + * rain/rain.6.in: Parametrise. + * configure: Substitute in this file. + * Makefile: Remove rain/rain.6 in distclean. + + * rain/Makefile (DEFS): Remove -DUSG, as it's no longer needed. + + * rain/*: Update from NetBSD-current of 1997-04-26. + +Wed May 14 23:27:32 1997 Joseph S. Myers + + * primes/*: Update from NetBSD-current of 1997-04-26. + + * ppt/*: Update from NetBSD-current of 1997-04-26. + + * pom/*: Update from NetBSD-current of 1997-04-26. + + * number/*: Update from NetBSD-current of 1997-04-26. + + * morse/*: Update from NetBSD-current of 1997-04-26. + + * monop/*: Update from NetBSD-current of 1997-04-26. + +Mon May 12 02:08:53 1997 Joseph S. Myers + + * mille/misc.c (CTRL): Define. + + * mille/*: Update from NetBSD-current of 1997-04-26. + +Wed May 7 00:15:09 1997 Joseph S. Myers + + * Version 1.4. + + * Makefile, caesar/Makefile: Disable test in caesar (as it depends + on rot13ed fortunes). + + * NEWS: Update. + + * bsd-games-non-free.lsm: Update. + + * bsd-games.lsm: Update. + + * hangman/getguess.c (readch): Change curx to _curx, cury to _cury + if using ncurses. + + * hangman/getguess.c: Don't include ; define + CTRL. + + * hangman/*: Update from NetBSD-current of 1997-04-26. + + * fortune/README.linux: Update. + + * fortune/datfiles/Makefile: Update for more fortune collections. + + * configure: Ask whether to install offensive fortunes. + * Makeconfig.in: Provide FORTUNE_TYPE. + + * fortune/*: Update from NetBSD-current of 1997-04-26. + +Tue May 6 00:53:04 1997 Joseph S. Myers + + * fish/*: Update from NetBSD-current of 1997-04-26. + + * Version 1.3.4beta. + + * NEWS: Update. + + * bsd-games-non-free.lsm: Update. + + * bsd-games.lsm: Update. + + * README: Update. + + * configure, tetris/Makefile: Consistently use tetris-bsd for + files associated with tetris. + + * INSTALL: Update. + + * factor/*: Update from NetBSD-current of 1997-04-26. + + * cribbage/*: Update from NetBSD-current of 1997-04-26. + +Mon May 5 02:23:05 1997 Joseph S. Myers + + * canfield/*: Update from NetBSD-current of 1997-04-26. + + * caesar/caesar.6: Mention rot13. + + * caesar/Makefile: Install rot13 and manpage link. + + * caesar/rot13.sh: Rename to rot13.in. + * caesar/rot13.in: Parametrise to use full path of caesar. + * configure: Substitute in this file. + * Makefile: Remove rot13 in distclean. + + * caesar/*: Update from NetBSD-current of 1997-04-26. + + * bcd/*: Update from NetBSD-current of 1997-04-26. + + * battlestar/com6.c (post): Change to use time() in line with + comments. + + * battlestar/Makefile: Change dependency on externs.h to extern.h. + + * battlestar/*: Update from NetBSD-current of 1997-04-26. + + * backgammon/common_source/Makefile: Quote value of RULES; only + define when building sbackgammon. + + * backgammon/backgammon/Makefile, backgammon/teachgammon/Makefile: + Don't include RULES in DEFS. + + * backgammon/Makefile: Don't include ../Makeconfig. + + * backgammon/common_source/back.h (OXTABS): Define to XTABS if not + defined (from glibc headers). + + * backgammon/*: Update from NetBSD-current of 1997-04-26. + +Sun May 4 01:55:22 1997 Joseph S. Myers + + * backgammon/common_source/subs.c: Initialise `buffnum' to -1, to + prevent a spurious NUL. + * backgammon/common_source/fancy.c: Mark `buffnum' as `extern'. + +Sat May 3 00:27:49 1997 Joseph S. Myers + + * Version 1.3.3beta. + + * NEWS: Update. + * bsd-games.lsm: Update. + * bsd-games-non-free.lsm: Update. + + * sail/player.h (SCREENTEST): Do echo(), since ncurses turns off + echo in initscr but we want it on for initial questions. + + * backgammon/teachgammon/ttext1.c: Remove \032 from `hello'. + + * backgammon/teachgammon/ttext2.c: Make list `char *list[]'. + + * configure: Default list of directories should only include those + with a Makefile. + + * README.non-free: Update. + + * README: Update. + + * INSTALL: Update. + + * Version 1.3.2beta. + + * NEWS: Update. + + * TODO: Update. + + * Makefile.orig, Makefile.inc.orig: Update from NetBSD-current of + 1997-04-26. + + * Makefile (distclean): Remove install-score. + +Fri May 2 13:23:28 1997 Joseph S. Myers + + * atc/*: Update from NetBSD-current of 1997-04-26. + + * arithmetic/*: Update from NetBSD-current of 1997-04-26. + + * worm/worm.c (main): Place cursor on head of worm. + + * snake/snake/snake.c (mainloop): Place cursor on you, not one + cell to the left and above. + + * backgammon/common_source/init.c, + backgammon/common_source/back.h: Initialise args to start with + '-'. + + * bsd-games-non-free.lsm: New file - LSM entry for + bsd-games-non-free. + + * bsd-games.lsm: Update. + + * INSTALL: Update. + + * README.linux: Rename to README. + * README: Update. + + * README.non-free: New file - README for non-free distribution. + + * fortune/README.linux: Update. + + * bog/README.linux: Update. + +Thu May 1 00:45:58 1997 Joseph S. Myers + + * atc/Makefile, battlestar/Makefile, canfield/canfield/Makefile, + cribbage/Makefile, robots/Makefile, sail/Makefile, + snake/snake/Makefile, tetris/Makefile: Use INSTALL_SCORE_FILE. + + * tetris/Makefile (install): Use INSTALL_SCORE_GAME. + + * configure, Makeconfig.in: Update for this. + + * install-score.in: New file - install a score file. + + * TODO: Update. + + * INSTALL: Update. + + * README.linux: Update. + + * arithmetic/README.linux, atc/README.linux, + battlestar/README.linux, bcd/README.linux, caesar/README.linux, + canfield/README.linux, cribbage/README.linux, factor/README.linux, + fish/README.linux, hangman/README.linux, mille/README.linux, + monop/README.linux, morse/README.linux, number/README.linux, + paranoia/README.linux, pom/README.linux, ppt/README.linux, + primes/README.linux, rain/README.linux, robots/README.linux, + sail/README.linux, snake/README.linux, trek/README.linux, + wargames/README.linux, worm/README.linux, worms/README.linux, + wump/README.linux: Remove. + + * fortune/fortune/Makefile: Remove unused definition. + + * configure, Makeconfig.in, atc/Makefile, backgammon/Makefile, + backgammon/backgammon/Makefile, backgammon/common_source/Makefile, + backgammon/teachgammon/Makefile, battlestar/Makefile, + bog/Makefile, bog/bog.6.in, canfield/Makefile, + canfield/canfield/Makefile, canfield/cfscores/Makefile, + canfield/canfield/canfield.6.in, cribbage/Makefile, + cribbage/cribbage.6.in, fish/Makefile, hangman/Makefile, + hangman/hangman.6.in, monop/Makefile, monop/monop.6.in, + robots/Makefile, robots/robots.6.in, sail/Makefile, + snake/Makefile, snake/snake/Makefile, snake/snake/snake.6.in, + snake/snscore/Makefile, tetris/Makefile, tetris/tetris.6.in, + wump/Makefile: Configure paths for data files for individual games + with configure script. + + * configure: Find default list of games to build from what + directories are present. + + * Version 1.3.1beta privately distributed for comments. + + * NEWS: New file - summary of changes. + + * TODO: Update. + + * README.linux: Update. + + * INSTALL: Update. + + * tetris/Makefile: Install manual page as tetris-bsd.6. + + * bsd-games.lsm: Update. + +Wed Apr 30 00:45:55 1997 Joseph S. Myers + + * INSTALL: Update. + + * TODO: Update. + + * bsd-games.lsm: Update. + + * wump/Makefile (install): Use INSTALL_PREFIX. + + * canfield/canfield/Makefile (install): Use INSTALL_PREFIX. + + * Makefile (install): Fix typo. + + * rain/Makefile: Add target `all'; fix dependencies. + + * ppt/Makefile: Add target `all'. + + * pom/Makefile: Add target `all'. + + * paranoia/Makefile: Add target `all'. + + * number/Makefile: Add target `all'. + + * morse/Makefile: Add target `all'. + + * fish/Makefile: Add target `all'. + + * factor/Makefile: Add target `all'. + + * caesar/Makefile: Add target `all'. + + * bcd/Makefile: Add target `all'. + + * arithmetic/Makefile: Add target `all'. + + * snake/snake/snake.h: Use instead of . + +Tue Apr 29 10:37:00 1997 Joseph S. Myers + + * Makefile (distclean): Delete all substituted-in manpages. + + * fortune/fortune/Makefile, fortune/datfiles/Makefile: Fortunes go + under $(LIBDIR), not $(SHAREDIR). + + * TODO: Update. + + * Credits: Update. + + * Debian patch (1.3-7), and David Frey's ports, now integrated + into the source, at least where I thought the fixes were correct + and needed. + + * gomoku/pickmove.c: Include instead of + (from David Frey's port). + + * gomoku/gomoku.h: Include (from David Frey's port). + + * gomoku/Makefile: Rename to Makefile.orig + * gomoku/Makefile: New from port by David Frey; rewrite to use + config information; fix dependencies. + + * configure: Add gomoku to list of directories to build in. + + * gomoku/*: Added from NetBSD-current, for adding port from David + Frey. + + * tetris/tetris.6: Rename to tetris.6.in. + * tetris/tetris.6.in: Parametrise. + * configure: Substitute in this file. + + * tetris/pathnames.h: Path to score file is defined in the + Makefile. + + * tetris/Makefile: Rename to Makefile.orig. + * tetris/Makefile: New from port by David Frey; rewrite to use + config information; fix dependencies. + + * configure: Add tetris to list of directories to build in. + + * tetris/*: Added from FreeBSD-current (as a basis to include port + from David Frey ). + +Mon Apr 28 12:22:57 1997 Joseph S. Myers + + * wump/README.linux: Update. + + * wump/Makefile: Rewrite to use config information; fix + dependencies. + + * worms/worms.c (main): Include (from Debian). + + * worms/worms.6: Change -length to -l, -number to -n (from + Debian). + + * worms/README.linux: Update. + + * worms/Makefile: Rewrite to use config information; fix + dependencies. + + * worm/worm.c: Include (from Debian); don't define + baudrate(). + + * worm/README.linux: Update. + + * worm/Makefile: Rewrite to use config information; fix + dependencies. + + * wargames/README.linux: Update. + + * wargames/Makefile: Rewrite to use config information. + + * wargames/wargames.sh: Remove. + * wargames/wargames: Change `tput cl' to `tput clear'. + + * trek/trek.6: Rename to trek.6.in. + * trek/trek.6.in: Parametrise. + * configure: Substitute in this file. + + * trek/README.linux: Update. + + * trek/Makefile: Rewrite to use config information; fix + dependencies. + + * snake/snscore/snscore.c (main): Initialise noplayers; check for + empty scorefile (from Debian). + + * snake/snscore/snscore.c (MAXPLAYERS): Increase to 65534 (from + Debian). + + * snake/snake/snake.6: Rename to snake.6.in. + * snake/snake/snake.6.in: Parametrise. + * configure: Substitute in this file. + + * snake/snscore/Makefile: Rewrite to use config information; fix + dependencies. + + * snake/snake/Makefile: Rewrite to use config information; fix + dependencies. + + * snake/README.linux: Update. + + * snake/Makefile: Rewrite to use config information; use `set -e' + in compound commands. + +Sun Apr 27 00:02:40 1997 Joseph S. Myers + + * sail/pl_7.c (susp): Don't call tstp (from Debian). + + * sail/player.h: Mark `version' as `extern'. + + * sail/externs.h: Mark variables as `extern'. + + * sail/driver.h: Mark `dtab' as `extern'. + + * sail/player.h: Change to . + + * sail/externs.h: Don't include . + + * sail/Makefile: Rewrite to use config information; fix + dependencies. + + * robots/init_field.c (init_field), robots/move.c (get_move): + Don't call flushok. + + * robots/main.c (quit): Condition out bit using CE (from Debian). + + * robots/robots.h, robots/move.c: Use character constants as + argument to CTRL macro. + + * robots/robots.6: Rename to robots.6.in. + * robots/robots.6.in: Parametrise. + * configure: Substitute in this file. + + * robots/Makefile: Rewrite to use config information; fix + dependencies. + + * rain/Makefile: Rewrite to use config information; fix + dependencies. + + * rain/rain.c: Include (from Debian). + + * factor/Makefile: Build pr_tbl.o in current directory, not in + primes directort. + + * primes/README.linux: Update. + + * primes/Makefile: Rewrite to use config information; fix + dependencies. + + * ppt/README.linux: Update. + + * ppt/Makefile: Rewrite to use config information; fix + dependencies. + + * battlestar/Makefile (install): Add use of $(HIDE_GAME). + + * pom/pom.c (main): Return 0. + + * pom/README.linux: Update. + + * pom/pom.c: Define isleap only if not defined; condition + definition of PI on PI rather than linux not being defined; + improve value of PI. + + * pom/Makefile: Rewrite to use config information; fix + dependencies. + + * paranoia/paranoia.c (page40): Remove backslash from invalid "\`" + escape sequence. + + * paranoia/README.linux: Update. + + * paranoia/Makefile: Rewrite to use config information; fix + dependencies. + + * hide-game.in: Use installation prefix. + + * number/README.linux: Update. + + * number/Makefile: Rewrite to use config information; fix + dependencies. + + * morse/README.linux: Update. + + * morse/Makefile: Rewrite to use config information; fix + dependencies. + + * monop/README.linux: Update. + + * monop/Makefile: Rewrite to use config information; fix + dependencies. + + * hangman/Makefile, hunt/Makefile, mille/Makefile: Add use of + $(HIDE_GAME). + + * monop/monop.6: Rename to monop.6.in. + * monop/monop.6.in: Parametrise. + * configure: Substitute in this file. + +Sat Apr 26 19:10:52 1997 Joseph S. Myers + + * mille/README.linux: Update. + + * mille/init.c (newscore): Add force_counter hack from Debian to + fix problem with ncurses's addch not returning ERR at EOL. + + * mille/unctrl.h: Do nothing if NCURSES_VERSION is defined. + + * mille/Makefile: Rewrite to use config information; fix + dependencies. + + * mille/mille.6: Rename to mille.6.in. + * mille/mille.6.in: Parametrise + * configure: Substitute in this file. + + * hunt/README.linux: Update. + + * hunt/Makefile: Rewrite to use config information. + + * hunt/otto.c (SCREEN): Define appropriately for ncurses, + conditional on NCURSES_VERSION (from Debian). + + * hunt/pathname.c: Change socket directory to _PATH_SOCKETS (to be + defined in the Makefile). + + * hunt/driver.c (init): Conditionally use /var/tmp instead of + /usr/tmp. + + * hunt/faketalk.c (faketalk): Fix typo (`stmp' for `smtp'). + + * hunt/hunt.6: Rename to hunt.6.in. + * hunt/huntd.6: Rename to huntd.6.in. + * hunt/hunt.6.in: Parametrise. + * hunt/huntd.6.in: Parametrise. + * configure: Substitute in these files. + + * hangman/README.linux: Update. + + * hangman/hangman.6: Rename to hangman.6.in. + * hangman/hangman.6.in: Parametrise. + * configure: Substitute in this file. + + * hangman/clean.pl, hangman/util, hangman/util.cc: Remove. + + * hangman/Makefile: Rewrite to use config information; fix + dependencies. + +Thu Apr 24 00:02:10 1997 Joseph S. Myers + + * fortune/fortune/Makefile: Don't keep rebuilding fortune.test. + + * fortune/Makefile: Remove fortunes symlink in clean. + + * fortune/unstr/unstr.c: Don't typedef off_t. + + * fortune/fortune/fortune.c: Conditionally define d_namlen to + d_reclen. + + * fortune/strfile/strfile.c: Don't typedef off_t, or undefine + MAXPATHLEN. + + * fortune/unstr/Makefile: Rewrite to use config information. + + * fortune/strfile/Makefile: Rewrite to use config information. + + * fortune/fortune/Makefile: Rewrite to use config information; fix + dependencies. + + * fortune/datfiles/Makefile: Rewrite to use config information. + + * fortune/Makefile: Rewrite. + + * fish/README.linux: Update. + + * fish/fish.c (nrandom): Condition out declaration of random() + (from Debian). + + * fish/Makefile: Rewrite to use config information; fix + dependencies. + + * factor/README.linux: Update. + + * factor/Makefile: Rewrite to use config information; fix + dependencies. + +Wed Apr 23 00:03:24 1997 Joseph S. Myers + + * cribbage/cribbage.6: Rename to cribbage.6.in. + * cribbage/cribbage.6.in: Parametrise; add mention of score file + and instructions file. + * configure: Substitute in this file. + + * cribbage/README.linux: Update. + + * cribbage/crib.c, cribbage/extern.c, cribbage/io.c, + cribbage/support.c: Change conditional inclusion of ncurses.h or + curses.h to unconditional inclusion of curses.h (ncurses provides + curses.h in the appropriate directory, used with -I if needed, but + ncurses.h is non-standard). + + * cribbage/instr.c (instructions): Change `pstat' to an int; use + WEXITSTATUS macro (from Debian). + + * cribbage/extern.c: Change `bool' to `BOOLEAN' (from Debian). + + * cribbage/Makefile: Rewrite to use config information; fix + dependencies. + + * canfield/cfscores/Makefile: Don't use unnecessary libraries. + + * canfield/Makefile, canfield/canfield/Makefile, + canfield/cfscores/Makefile: Fix quoting of SCOREFILE. + + * canfield/README.linux: Update. + + * canfield/canfield/canfield.6: Rename to canfield.6.in. + * canfield/canfield/canfield.6.in: Parametrise. + * configure: Substitute in canfield/canfield/canfield.6.in. + + * canfield/cfscores/Makefile: Rewrite to use config information. + + * canfield/canfield/Makefile: Rewrite to use config information. + + * canfield/Makefile: Rewrite to use config information; use `set + -e' in compound commands. + +Tue Apr 22 00:08:42 1997 Joseph S. Myers + + * caesar/README.linux: Update. + + * caesar/Makefile: Rewrite to use config information; fix + dependencies. + + * bog/README.linux: Update. + + * bog/Makefile: Rewrite to use config information; fix + dependencies. + + * bog/bog.man: Rename to bog.6.in. + * bog/bog.6.in: Include parametrised file locations. + * configure: Substitute in this file. + + * arithmetic/Makefile, atc/Makefile, + backgammon/backgammon/Makefile, backgammon/teachgammon/Makefile, + bcd/Makefile: Use $(HIDE_GAME). + + * hide-game.in: Use `set -e'. + + * configure: Ask for permissions on dm (not included yet, but + supported for when it is ported). + * Makeconfig.in (INSTALL_DM): Provide macro for this. + + * arithmetic/Makefile, atc/Makefile, + backgammon/backgammon/Makefile, backgammon/common_source/Makefile, + backgammon/teachgammon/Makefile, battlestar/Makefile, + bcd/Makefile: Use LDFLAGS in link. + + * bcd/README.linux: Update. + + * bcd/Makefile: Rewrite to use config information; fix + dependencies. + + * install-man.in: Set owner/group/permissions on .so pages. + + * battlestar/fly.c (visual): Check return of initscr() against + NULL rather than ERR to eliminate warning (although initscr() + should exit in event of error). Also comment out call to + savetty(). + * battlestar/fly.c (endfly): Add call to setvbuf() to restore line + buffering on stdout, since ncurses changes buffering but doesn't + restore it. + + * battlestar/save.c: Do exit(1) on failed restore; close file at + the end of restore() and save(). + + * battlestar/externs.h: Conditionally include and + . + + * battlestar/dayfile.c (dayfile): Spelling corrections. + * battlestar/nightfile.c (nightfile): Spelling corrections. + + * battlestar/cypher.c (cypher): Fix many tests on *objsht[n] that + should be on objsht[n]; initialise `wordtype' correctly in TAKE + when doing a `take all'. + + * battlestar/com5.c (give): Initialise `last1' and `last2' to + avoid a segfault if you start the game with `give'. + + * battlestar/com3.c (shoot): Initialise `firstnumber' to avoid + segfault from `shoot all' without a laser. + + * battlestar/com2.c (use): Set notes[CANTSEE] to 0 when moving + into the light. + + * battlestar/battlestar.c: Change exit() to exit(1) in default + case that shouldn't occur. + + * battlestar/externs.h: Mark as `extern' variables initialised + somewhere. + + * battlestar/fly.c: Change to . + + * battlestar/README.linux: Update. + + * battlestar/Makefile: Rewrite to use config information; fix + dependencies. + +Mon Apr 21 22:19:28 1997 Joseph S. Myers + + * configure: New variable `chown_vardata' to set owner/group on + variable data only if appropriate. + * Makeconfig.in: Use this variable. + +Sat Apr 19 20:06:08 1997 Joseph S. Myers + + * backgammon/Makefile: Add missing semi-colon, and `cd ..'s. + + * backgammon/common_source/subs.c (getarg): Check s[0] for being + NULL (from Debian). + + * backgammon/backgammon/main.c, backgammon/backgammon/move.c, + backgammon/backgammon/text.c, backgammon/commmon_source/back.h, + backgammon/common_source/board.c, backgammon/teachgammon/teach.c, + backgammon/teachgammon/ttext1.c, backgammon/teachgammon/ttext2.c: + Change `raw' to `bg_raw', and `remove' to `removetxt' (from + Debian). + + * backgammon/teachgammon/teach.c: Mark variables as `extern'. + + * backgammon/teachgammon/teach.c: Change `ospeed' to `short'. + + * backgammon/backgammon/main.c: Mark `instr' and `message' as + `extern'. Also change `ospeed' from `char' to `short' (from + Debian). + + * backgammon/common_source/back.h: Mark as `extern' variables + initialised in init.c. + + * backgammon/common_source/back.h, + backgammon/common_source/init.c: Don't condition on linux for + including or , since redundant with + -I/usr/include/bsd. + + * backgammon/README.linux: Update. + + * atc/Makefile, backgammon/backgammon/Makefile, + backgammon/teachgammon/Makefile: Consistently use $(INCS) in + compilation rules. + + * backgammon/common_source/Makefile: Rewrite to use config + information; fix dependencies. + + * backgammon/backgammon/backgammon.6.in: Include teachgammon in + manpage (from Debian). + * backgammon/teachgammon/Makefile: Install .so link or symlink to + backgammon manpage. + +Fri Apr 18 11:02:30 1997 Joseph S. Myers + + * install-man.in: New file to handle all the manpage installation + complexities. + * configure, Makeconfig.in, arithmetic/Makefile, atc/Makefile, + backgammon/backgammon/Makefile: Use this new script. + + * backgammon/backgammon/Makefile, backgammon/teachgammon/Makefile: + Rewrite to use config information; fix dependencies. + + * backgammon/backgammon/backgammon.6: Rename to backgammon.6.in. + * backgammon/backgammon/backgammon.6.in: Parametrise reference to + teachgammon. + * configure: Substitute in backgammon/backgammon/backgammon.6.in. + + * backgammon/Makefile: Rewrite to use config information. + + * atc/README.linux: Update. + + * atc/main.c (main): Add CRMOD to terminal flags, since ncurses + 1.9.9g (3.4) and 4.0 disable CR-NL translation. + +Thu Apr 17 12:31:00 1997 Joseph S. Myers + + * atc/Makefile: Rewrite to use config information; fix + dependencies; fix libraries and installation of games (from + Debian). + + * atc/include.h: Remove conditional inclusion of , + as it's redundant with -I/usr/include/bsd. + + * atc/def.h: Change #ifndef linux to #ifndef PI for definition of + PI (from Debian). Also improve accuracy of value. + + * arithmetic/arithmetic.c: include ; remove declaration of + time(). + + * Makeconfig.in (CC): Add new macro. + + * arithmetic/Makefile: Rewrite to use config information; fix + dependencies. + * arithmetic/README.linux: Update. + + * Makeconfig.in (BUILDDIRS): Add new macro. + * configure: Always substitute for sbindir, socketdir and + usrbindir, even if not building relevant programs (so that we can + always create them). + * Makefile: Essentially complete rewrite to use configuration + information; allow installation prefix and use install -d instead + of mkdir -p as per Debian patch. Also use set -e in all compound + commands. + + * Makeconfig.in (INSTALL_SCORE_FILE2, INSTALL_SCORE_FILE3): Fix + commands for installing score files. + + * configure, Makeconfig.in: Add configuration of socketdir, for + hunt to place its Unix domain sockets in. + +Wed Apr 16 21:31:18 1997 Joseph S. Myers + + * BSD-games.src.lsm: Remove. + * bsd-games.lsm: New file - new-style LSM entry. + + * configure, Makeconfig.in, hide-game.in: New files - beginnings + of a configuration system. + + * CHANGELOG: Rename to ChangeLog.0. + * ChangeLog: New file. + + * BSD-games.bin.lsm: Remove. + + * New maintainer. + +See ChangeLog.0 for earlier changes. diff --git a/ChangeLog.0 b/ChangeLog.0 new file mode 100644 index 0000000..b5b2f4b --- /dev/null +++ b/ChangeLog.0 @@ -0,0 +1,67 @@ +10/24/93 -replace previous words file with the words file provided by + Rik Faith, faith@cs.unc.edu. This package can be found at + ftp.cs.unc.edu in /pub/faith/linux/utils/linux.words.2.tar.gz + +9/30/93 - changed 'mkdir' to 'mkdir -p' in the top level Makefile so + intermediate directories will be created if they don't exist. + +9/25/93 - Top level Makefile now creates the directories DESTDIR, MANDIR, + and LIBDIR if they do not exist before trying to install the + individual programs. + +9/25/93 - Fixed makefiles to inherit defines from upper level makefiles. + Also fixed hard coded pathnames in .h files to be taken from the + makefiles. + +9/23/93 - [bog] Modified the end of game behavior to be more intuitive. + Original behavior can be set by defining PURE in CFLAGS. + +9/23/93 - [bog] Fixed a bug in bog which caused a crash at the end of + displaying the help. + "extern char *version" -> "extern char version[]" + Aren't these two equivalent??? I guess not :) Thanks Andrew + Kuchling for spotting this one. + +8/25/93 - Version 1.2 Released + +============================================================================== + +8/25/93 - Added paranoia + +8/25/93 - Added hunt + +8/23/93 - Added sail + +8/23/93 - Added pom + +8/23/93 - Added bog + +8/22/93 - Added factor + +8/22/93 - Added primes + +8/21/93 - Added trek + +8/21/93 - Added monop + +8/19/93 - Version 1.1 Semi-released + +============================================================================== + +8/19/93 - Added wargames + +8/19/93 - [robots] Fixed robots screen restore bug. + +8/19/93 - Added snake + +8/19/93 - Added caesar + +8/19/93 - Added cribbage + +8/18/93 - Found a man page for number + +8/17/93 - Version 1.0 Released. + +============================================================================== + + diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..e09961b --- /dev/null +++ b/INSTALL @@ -0,0 +1,188 @@ +Installation instructions +========================= + +Packaging +========= + +If packaging bsd-games or bsd-games-non-free for a Linux distribution, +please read the PACKAGING file for further information after this one. +Others who wish to install it under a packaging system, or rebuild it +automatically and without interactive configuration, may also find +this file useful. + +Non-free games +============== + +These installation instructions apply to both bsd-games and +bsd-games-non-free. bsd-games-non-free contains rogue, which it seems +cannot be sold for profit, and hack, for which porting but not +gameplay changes may be made: the rest of the games are under the +standard BSD distribution conditions, or very similar ones (phantasia +is public domain, i.e. not copyrighted). As of version 2.2 and later, +the bsd-games-non-free package unpacks conventionally into a directory +of its own. It can be built separately from bsd-games, or in the same +source directory: to do the latter, move those files and directories +that are in bsd-games-non-free but not bsd-games into the +bsd-games-VERSION directory before building. + +Prerequisites +============= + +You need the following to build this distribution: + +* GCC (the C and C++ compilers only - other languages not needed; C++ + only needed for dab). + +* glibc 2.3 or later. Older versions will not work (at least for + hunt) since they lack the header. + +* ncurses; other curses / termcap implementations might work, but are + unsupported. + +* lex and yacc; by default this package will use flex and bison, but + byacc will probably work as well. + +* GNU make. + +* A POSIX shell, such as bash, in /bin/sh. + +libcrypto from OpenSSL can optionally be used by factor. + +You now need a word list for boggle and hangman; bsd-games no longer +provides one itself. The GNU miscfiles package contains one, for +example. The path can be specified at configure time (default: +/usr/share/dict/words). The file used by hangman can also be +specified at run time with the "-d" option. + +Security +======== + +See the SECURITY file for a discussion of security issues about the +BSD games. + +Alternative implementations +=========================== + +Some of the programs in this package have alternative implementations +for Linux available, which you may wish to use some of instead of the +BSD versions: + +* banner is in util-linux. +* factor is in GNU sh-utils as of version 1.12q. +* An extensively modified version of fortune is available as +"fortune-mod". There are also many additional fortune data files +(including translations of the ones included here) available. +* Perl implementations of some of the games are included in the "Perl +Power Tools" project (http://language.perl.com/ppt/). +* My enhanced version of ppt with support for PostScript output is +available as "nppt" from metalab and its mirrors. + +Building and installation +========================= + +1. cd to the top level directory in the source distribution, i.e. the + directory that contains this file. There is not yet any support + for building in a directory other than the source directory. + +2. Run "./configure" and configure the installation to your liking. + There may be some games you don't want to build because you have + them from elsewhere (see above). You can specify particular games + you do not want built before specifying the list of games to build + (which will default to all those available, except those you have + excluded). + + The filesystem structure used defaults to that the the Filesystem + Hierarchy Standard (FHS), version 2.0. If you are using the older + FSSTND 1.2, or a newer FHS, or wish to install into /usr/local, + check the paths given and make changes as appropriate. + +3. Type "make". You can probably ignore compiler warnings, although + most should be fixed in this release. If you are building on a 64 + bit architecture, you might want to look over the warnings and let + me know about any that are normally significant in such cases. + Recent versions of gcc give many "missing initializer" warnings; + these are harmless, as are the warnings in system headers + mentioned above. Likewise, "null format string" warnings are + harmless; future versions of GCC will probably eliminate them, by + allowing headers to specify whether it is OK for a format argument + to a particular function to be null. + + At the start of the build, there will be many "No such file or + directory" warnings from make. Ignore these as long as make does + not stop because of them: these refer to dependency files that + make can regenerate for itself. See "Automatic Dependencies" in + the GNU Make manual for details. + + In the unlikely event of an internal compiler error, the build + system supports generating the files of preprocessor output + required for a bug report: if the error occurs while compiling + "foo/bar.c", then "make foo/bar.i" will put the preprocessor + output in "foo/bar.i", suitable for sending in a bug report along + with details of compiler version and options used. You may, + however, wish to minimise the testcase before sending a bug + report, if you have the time to do so. + +4. Run the testsuite (non-interactive) with "make check". All tests + should pass. + +5. Save copies of any old versions of games you like and their + datafiles, until you know that the new versions work. + +6. Become root. (If, as an ordinary user, you are installing under + your home directory, and have chosen not to set owners and groups + on the installed files, there is of course no need to do this.) + +7. Type "make install". If you want the installed binaries to be + stripped, use "make install-strip" instead. This saves disk + space, but means that you cannot debug the installed binaries. + +8. If you had an old installation of bsd-games, check for file + locations that have changed. You will probably want to remove old + executables and static data (formerly defaulting to installation + in /usr/games/lib), and replace any empty score files that have + been installed with your old ones (checking the permissions). + + The default locations changed again in 2.2, to those mandated by + the new FHS 2.0 - manpages in /usr/share/man, variable data in + /var/games. In addition, huntd's default location has changed + from /usr/sbin back to /usr/games and the location for dm to keep + hidden games has changed from /usr/libexec/dm to + /usr/lib/games/dm. + + In version 2.4, the recommended permissions on the directory for + sail, if you installed it setgid, changed from 0775 to 2770; you + may need to adjust the permissions manually if you had a previous + installation of version 2.3. + +9. The robots scorefile format changed in version 2.8, so any old + score file should be removed or renamed when first upgrading to + this or a later version, and a new one created with the correct + permissions. + +10. "make distclean" will restore the source directory to the original + unpacked state. The automatically generated dependency files + include paths to system headers, including those in gcc's internal + header directory: if you have changed your compiler or library + headers between building bsd-games and cleaning up, you can use + "make distclean nodep=true" to avoid this causing problems. + + "make clean" will restore the sources to the state just after + configuration. + +Further information +=================== + +See TODO for information on what needs to be improved in this package; +you may want to volunteer for some of the things in there. + +The file BUGS lists known bugs. The README file discusses how to +produce useful bug reports. + +Joseph S. Myers +jsm@polyomino.org.uk + + + +Local Variables: +mode: text +End: diff --git a/Makeconfig.in b/Makeconfig.in new file mode 100644 index 0000000..68b25fc --- /dev/null +++ b/Makeconfig.in @@ -0,0 +1,136 @@ +# Makeconfig.in - configuration included in Makefiles after substitution. +# +# Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +# If some variables are unexpanded in Makeconfig, this shouldn't be a +# problem, it will be because they weren't configured since the relevant +# games weren't being built. + +# Source directory +SRCDIR := @srcdir@ +# Build directories +BUILDDIRS := @build_dirs@ +# Installation prefix +INSTALL_PREFIX := @install_prefix@ +# Games directory +GAMESDIR := @gamesdir@ +# Daemon directory +SBINDIR := @sbindir@ +# Other binaries directory +USRBINDIR := @usrbindir@ +# Manual pages, section 6 +MAN6DIR := @man6dir@ +# Manual pages, section 8 +MAN8DIR := @man8dir@ +# Manual pages, section 5 +MAN5DIR := @man5dir@ +# Constant data (arch-independent) +SHAREDIR := @sharedir@ +# Miscellaneous documentation +DOCDIR := @docdir@ +# Variable data +VARLIBDIR := @varlibdir@ +# Directory for hidden games (dm) +LIBEXECDIR := @libexecdir@ +# Installation commands, with install -c -o whatever -s etc. +INSTALL_BINARY := @install_binary@ +INSTALL_SCRIPT := @install_script@ +INSTALL_SCORE_GAME := @install_score_game@ +INSTALL_DAEMON := @install_daemon@ +INSTALL_MANUAL := @srcdir@/install-man +INSTALL_DATA := @install_constdata@ +INSTALL_VARDATA := @install_vardata@ +INSTALL_DM := @install_dm@ +INSTALL_SAIL_DIR := @install_sail_dir@ +INSTALL_HACK_DIR := @install_hack_dir@ +# Is INSTALL_VARDATA actually needed (for games that start with non-empty +# scorefile?) +# For games which can start with empty scorefile we do: +INSTALL_SCORE_FILE := @srcdir@/install-score +# Definitions of INSTALL_* that may have -s added +# This first one should no longer be needed +DEFS_TO_PASS := INSTALL_BINARY="$(INSTALL_BINARY)" \ + INSTALL_SCORE_GAME="$(INSTALL_SCORE_GAME)" \ + INSTALL_DAEMON="$(INSTALL_DAEMON)" INSTALL_DM="$(INSTALL_DM)" +# For the top level install-strip target +DEFS_TO_PASS_STRIP := INSTALL_BINARY="$(INSTALL_BINARY) -s" \ + INSTALL_SCORE_GAME="$(INSTALL_SCORE_GAME) -s" \ + INSTALL_DAEMON="$(INSTALL_DAEMON) -s" INSTALL_DM="$(INSTALL_DM) -s" +# srcdir/hide-game or : +HIDE_GAME := @hidegame@ + +# Compilation details +CC := @cc@ +CXX := @cxx@ +OPTIMIZE := @optimize_flags@ +WARNING := @warning_flags@ +CXX_WARNING := @cxx_warning_flags@ +CFLAGS := $(OPTIMIZE) $(WARNING) @other_cflags@ +CXXFLAGS := $(OPTIMIZE) $(CXX_WARNING) @other_cflags@ +LDFLAGS := @other_ldflags@ +FGETLN_DEFS := @fgetln_defs@ +GETLOADAVG_DEFS := @getloadavg_defs@ +STRLCPY_DEFS := @strlcpy_defs@ +GETPROGNAME_DEFS := @getprogname_defs@ +NCURSES_LIB := @ncurses_lib@ +NCURSES_INCS := @ncurses_includes@ +OPENSSL_LIB := @openssl_lib@ +OPENSSL_INCS := @openssl_includes@ +BASE_INCS := -Iinclude $(NCURSES_INCS) $(OPENSSL_INCS) +BASE_LIBS := @base_libs@ +YACC := @yacc@ +LEX := @lex@ +LEX_LIB := @lex_lib@ + +# More paths +PAGER := @pager@ + +# Individual games +ATC_DIR := @atc_dir@ +ATC_SCOREFILE := @atc_scorefile@ +BATTLESTAR_SCOREFILE := @battlestar_scorefile@ +BOGGLE_DIR := @boggle_dir@ +DICTIONARY_SRC := @dictionary_src@ +CANFIELD_SCOREFILE := @canfield_scorefile@ +CRIBBAGE_INSTRFILE := @cribbage_instrfile@ +CRIBBAGE_SCOREFILE := @cribbage_scorefile@ +FISH_INSTRFILE := @fish_instrfile@ +FORTUNE_DIR := @fortune_dir@ +FORTUNE_TYPE := @fortune_type@ +HACK_DIR := @hack_dir@ +MONOP_CARDSFILE := @monop_cardsfile@ +PHANTASIA_DIR := @phantasia_dir@ +QUIZ_DIR := @quiz_dir@ +ROBOTS_SCOREFILE := @robots_scorefile@ +ROGUE_SCOREFILE := @rogue_scorefile@ +SAIL_SCOREFILE := @sail_scorefile@ +SAIL_DIR := @sail_dir@ +SNAKE_SCOREFILE := @snake_scorefile@ +SNAKE_RAWSCOREFILE := @snake_rawscorefile@ +TETRIS_SCOREFILE := @tetris_scorefile@ +WTF_ACRONYMFILE := @wtf_acronymfile@ +WUMP_INFOFILE := @wump_infofile@ diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..141948b --- /dev/null +++ b/NEWS @@ -0,0 +1,461 @@ +NEWS for bsd-games and bsd-games-non-free +========================================= + +This file contains a summary of changes in each version of bsd-games +and bsd-games-non-free after 1.3. For fuller details, see ChangeLog +and ChangeLog.0. + +As well as reading this summary, it is a good idea to reread the +INSTALL file whenever installing a new version, to check for any +changes in installation instructions. Packagers should also reread +the PACKAGING file each version (or do a diff between the old and new +versions of the package and read that). + +Version 2.17 (2005-02-18) +============ + +* Updated from NetBSD CVS of 2005-02-18. + +* Some bugs fixed (in particular, should now build with current GCC 4 +CVS), some backlogged. + +Version 2.16 (2004-02-13) +============ + +* Updated from NetBSD CVS of 2004-02-13. Includes a new game, dab +(Dots and Boxes), written in C++. + +* Supplementary documentation for trek and rogue now installed +automatically (in a configurable directory). + +* Some changes for portability to Cygwin, thanks to David A Bagley +; more portability issues remain. + +* Various improvements to morse from OpenBSD. + +* Some bugs fixed, some backlogged. + +Version 2.15 (2003-12-18) +============ + +* Updated from NetBSD CVS of 2003-12-17. This includes: + + + Advertising clause removed from licence of almost all + UCB-copyright code. + + + Hunt licence clarified. + +* Various bugs fixed, though some bug reports are still backlogged. + +* Glibc 2.3 or later now required, at least for hunt. + +* Directory for fortune files individually configurable, and default +has changed to match that used in NetBSD. + +Version 2.14 (2003-04-01) +============ + +* Hack is now BSD-licensed +, so moves from +bsd-games-non-free to bsd-games. + +* Updated from NetBSD CVS of 2003-03-29. This includes: + + + Security fix for rogue (in bsd-games-non-free); see NetBSD + Security Advisory 2002-021. + + + Optional support for large numbers in factor using libcrypto from + OpenSSL. This can handle larger numbers than GNU factor (which is + limited to 64-bit numbers) but not that much larger efficiently, as + the algorithm used (Pollard rho) is O(n^{1/4}) in the number + factored. + +* Some bugs fixed, though a backlog of bug reports remains. + +Version 2.13 (2001-08-30) +============ + +* Warning now present in README about the inclusion of cryptographic +software (caesar and rot13). + +* Various minor improvements and bugfixes, some from NetBSD, some from +OpenBSD, some from other contributors. Current with NetBSD CVS of +2001-08-29. + +* Some fixes to avoid some warnings when compiling with current glibc +and GCC 3. + +* May support GNU Hurd (untested). + +Version 2.12 (2000-09-25) +============ + +* Improvements and bugfixes to battlestar, mainly from OpenBSD. +Though there are still plenty of known bugs, it should be much harder +to crash. + +* Should compile with glibc 2.2 (tested with 2.1.94). + +* Other minor changes and bugfixes; current with NetBSD CVS of +2000-09-25. + +Version 2.11 (2000-04-19) +============ + +* bsd-games-non-free now includes hack 1.0.3 by Andries Brouwer; this +may be of interest to nethack players wishing to play an ancestral +game. + +* Various minor changes and bugfixes; current with NetBSD CVS of +2000-04-19. + +Version 2.10 (2000-02-12) +============ + +* Avoid world-readable characs file in phantasia. Note the new +configuration question which will need an appropriate answer, +especially if packaging for a distribution. + +* Various minor bugfixes. + +* Essentially all relevant changes, except to hunt (which will +eventually be replaced by the OpenBSD version), now merged back into +NetBSD. + +* Some minor changes from NetBSD CVS of 2000-02-12. + +* No new bsd-games-non-free version; bsd-games-non-free 2.8 is still +current. + +Version 2.9 (1999-11-12) +=========== + +* Fixes various minor bugs reported recently. + +* Some minor changes from NetBSD CVS of 1999-11-12. + +* No new bsd-games-non-free version; bsd-games-non-free 2.8 is still +current. + +Version 2.8 (1999-09-26) +=========== + +* Robots scorefile format has changed - remove or rename your old +score file when upgrading to this version. + +* Various minor changes and bug-fixes (some from OpenBSD). + +* Snake substantially cleaned up, and now uses the native curses +interface (rather than termcap emulation in ncurses); backgammon and +tetris still to be converted. + +* New "game": wtf. + +* Updated from NetBSD CVS of 1999-09-25; many more changes merged back +into NetBSD. + +* All constant data files are now architecture independent (installed +under /usr/share by default). + +* bsd-games is no longer tested by me with libc older than glibc +2.1.2; fixes for compilation with older libc will still be accepted. + +* Details of the copyrights and licence terms applicable to these +games, as best as I can determine them, now appear in COPYING. + +* bsd-games no longer comes with its own word list for boggle and +hangman; you need to provide one at compile time (for boggle) and at +run time (for hangman). The copyright status of the one formerly +included was not entirely clear. The word list used by hangman can +also now be specified at run time with the new "-d" option. + +* bsd-games now has a testsuite (for programs that can be tested +non-interactively only). + +Version 2.7 (1999-04-04) +=========== + +* Bug fixes. + +* Updated from NetBSD-current of 1999-03-26; more changes merged back +into NetBSD. + +* Other minor changes. + +Version 2.6 (1998-12-20) +=========== + +* Buffer overrun fixes in sail (not thought exploitable). + +* Fixes possible score file corruption if fds 0, 1, 2 aren't open at +game startup. + +* Updated from NetBSD-current of 1998-12-07 (morse now has a decoding +option). + +* Now builds cleanly with -Wwrite-strings. + +* Other minor changes. + +* Some users of this package may be interested in my "nppt" package, +which provides an alternative implementation of ppt(6) with additional +features such as Encapsulated PostScript output. (This package +installs the binary as "nppt", so can be installed simultaneously with +this one. Look for nppt-0.1.tar.gz (or a later version) on +metalab.unc.edu (formerly sunsite) in /pub/Linux/Incoming/ or under +/pub/Linux/games/.) + +Version 2.5 (1998-09-24) +=========== + +* New build system, using a single project Makefile (autogenerated) +that includes makefile fragments from subdirectories, and uses GNU +Make's automatic dependency generation to generate dependencies +automatically, rather than recursive make. See Peter Miller's paper +"Recursive Make Considered Harmful" + +for reasons why this is better than recursive make. This should make +no difference to normal users, but if you modify the sources note that +you will need to rebuild from the top directory, and you may find that +the dependencies are now accurate whereas formerly they were +incomplete. The automatic dependency generation causes the build to +start with about 300 "no such file or directory" warnings, which +should be ignored: these refer to the dependency files which GNU Make +will then automatically generate. + +* Should work with glibc 2.1 (at least, version 2.0.96 on x86, which +is what I've tested). See the ChangeLog for an explanation of the +problem previous releases had with glibc 2.1. + +* Boggle is now in the main bsd-games package - Paul Janzen checked +with the original author, who confirmed that the BSD licence +superseded the old non-free one. bsd-games-non-free now only contains +rogue. + +* Other minor changes. + +Version 2.4 (1998-09-05) +=========== + +* Various minor bug fixes and improvements (some from OpenBSD, thanks +to Paul Janzen ). + +* Sail directory can now be non-world-accessible (mode 2770 root.games +or similar). This may improve security, since it means users cannot +tamper with sync files their sail process creates. + +* Rogue buffer overrun fix. An audit is still needed. + +* dm now ignores the environment variable TZ when deciding at what +times games can be played. (This only affects you if you are using dm +to control at what times games can be played, and not then if you are +using libc 5.4.45 or 5.4.46 (which completely ignore TZ in setgid +programs rather than checking the validity of any filename given as +glibc does).) + +* All games updated from NetBSD-current of 1998-08-30 (minor changes; +some more of my changes have been merged back into NetBSD). + +Version 2.3 (1998-08-19) +=========== + +* A possible temporary file security bug in sail fixed. + +* Countmail is back, with a licence (apparently the standard NetBSD +one), since it has one in NetBSD-current of 1998-08-19. + +* All the other games updated from NetBSD-current of 1998-08-19 (minor +changes). + +* Other minor changes. + +* Version 2.2 was never properly released, since the upload to sunsite +was truncated and the sail hole was found before the truncated file +had been removed or the release put in place on tsx-11. + +Version 2.2 (1998-08-15) +=========== + +* Another bug-fix release. + +* This version includes security fixes from OpenBSD. + +* This release is believed year 2000 compliant. Please see the year +2000 statement in the file YEAR2000 for details and disclaimer. + +* Paranoia has been removed from bsd-games-non-free, since it has no +clear licence at all, and being derived from a magazine article it is +not clear it was ever legally distributable. Anyone wanting to +resurrect it in a separate package would need to investigate the +copyright on the magazine article as well as getting a proper licence +from the author. + +* Countmail has been removed from bsd-games because of the lack of a +licence. + +* All other games updated from NetBSD-current of 1998-07-27 (very +minor changes). + +* Default paths now follow FHS 2.0 - enter the paths you want when +running configure if you are using the FSSTND 1.2. + +* You can now easily specify games you don't want built when running +configure. + +* All games that can invoke pagers handle PAGER in the way specified +by POSIX.2 for standard programs that invoke pagers. + +* Rogue bug fix from Bill Lash . + +* Other bug fixes. + +* Information for those packaging bsd-games or bsd-games-non-free for +a Linux distribution is in the file PACKAGING. + +Version 2.1 (1998-03-29) +=========== + +* This is mainly a bug-fix release. + +* All games updated to NetBSD-current as of 1998-03-21 (except for +paranoia). The changes are mostly minor, replacing warning fixes +local to bsd-games with ones now in NetBSD. + +* Some bugs fixed, and most of the additional warnings given by the +current egcs snapshot fixed as well. + +* Configuration / installation change - to strip the installed +binaries, use "make install-strip" instead of "make install"; this +replaces the configuration option for "make install" to strip the +installed binaries. + +* Manpages for wargames and paranoia, thanks to Joey Hess +. + +* Battlestar save file name can be chosen at runtime, and defaults to +".Bstar" instead of "Bstar" for cleaner directory listings. + +Version 2.0 (1997-12-25) +=========== + +* All games updated to NetBSD-current as of 1997-12-12 (except for +paranoia). Hunt and boggle are now based on the NetBSD versions. + +* Many bugs fixed. + +* Added countmail. + +* Better libc6 support - adventure should now work. + +* No longer uses libbsd with libc5. + +* Nearly warning-free compile with -Wall -W -Wstrict-prototypes +-Wmissing-prototypes. + +* Hunt now uses internet domain sockets (untested). + +Version 1.5 (1997-07-17) +=========== + +* All games updated to NetBSD-current as of 1997-07-12 (except for +bog, hunt and paranoia). + +* Added adventure, banner, dm, phantasia, pig, quiz, random and rogue. +(Rogue is in bsd-games-non-free only). + +* BETA level libc6 support. (It may not yet compile, but should be +nearer to compiling with libc6 than version 1.4.) + +Version 1.4 (1997-05-07) +=========== + +* Fish, fortune and hangman updated to the versions in NetBSD-current. + +* Public release. + +Version 1.3.4beta (1997-05-06) +================= + +* Bug fix in backgammon. + +* Backgammon, battlestar, bcd, caesar, canfield, cribbage and factor +updated to the versions in NetBSD-current. As a side-effect, caesar +now installs a "rot13" script. + +* Tetris score file now defaults to tetris-bsd.scores for consistency +with using tetris-bsd in the names of files installed from tetris. +(The rationale of this is that there is more than one Tetris game and +this one should not presume to be the one that takes the +/usr/games/tetris name; that should be a decision for the +administrator, who can reasonably install more than one Tetris game.) +Nor should other files such as the man page or score file potentially +conflict with other Tetris games. Of course, you can configure the +package to use the old score file name (or any other) if you want. + +Version 1.3.3beta (1997-05-03) +================= + +* Non-free package now contains all the files required to build on its +own. It can now be built on its own, or in the same source tree as +bsd-games; the files that appear in both are exact duplicates. + +* Bug-fixes in backgammon and sail. + +Version 1.3.2beta (1997-05-03) +================= + +* Non-free games (bog and paranoia) now distributed separately - +unpack both source packages together before configuring if you want to +build them. + +* Configuration script improved: now the default list of games to +build is the list of subdirectories, and you can configure the exact +paths to score files and data files for individual games using it - so +they are always correctly substituted in the manpages. + +* Bug-fixes in backgammon, snake and worm. + +* Arithmetic and atc updated to the versions in NetBSD-current. + +Version 1.3.1beta (1997-05-01) +================= + +* Now works with libc 5 ;-). + +* Debian patches from Joey Hess mostly +integrated up to Debian version 1.3-7. + +* New ports of tetris and gomoku, thanks to David Frey +. + +* Distributed as source only. + +* Many bug-fixes to battlestar. + +* Configuration script, now substitutes correct paths in manpages. + +* Defaults hopefully closer to FSSTND/FHS. + +* Builds with ncurses by default. Curses/termcap are obsolete and no +longer supported (not that this package is supported anyway ;-)). + +Version 1.3 (1993-10-25) +=========== + +See ChangeLog.0. + +Version 1.2 (1993-08-25) +=========== + +See ChangeLog.0. + +Version 1.1 (1993-08-19) +=========== + +See ChangeLog.0. + + + +Local Variables: +mode: text +End: diff --git a/PACKAGING b/PACKAGING new file mode 100644 index 0000000..67ce5c6 --- /dev/null +++ b/PACKAGING @@ -0,0 +1,149 @@ +Packaging bsd-games and bsd-games-non-free +========================================== + +This file contains some information intended for those packaging +bsd-games or bsd-games-non-free for a Linux distribution. It is +presumed that you have read INSTALL first, and that you have the +competence in the POSIX shell required to read and understand the +configure script. This information may also be useful to people +building their own systems, who wish to rebuild the whole system +automatically or who use a packaging system for locally built +software. + +The configuration and build of bsd-games has two features designed to +facilitate packaging: + +1) Installation prefix. + +The configure script allows you to choose an installation prefix (by +default empty) that is prepended to all paths used for installation, +but not those built into the executables (this is similar to the +install_root of glibc, and DESTDIR in some packages, but is chosen at +configure time). The package would then be built in some way from +this directory, and the contents would end up in the root of the +target system. If used, this prefix must be an absolute path. + +2) config.params to change configuration defaults. + +Although the configuration script is by default interactive (although +it does not need a terminal), it can also be used non-interactively. +If a file "config.params" exists in the source directory, it will be +sourced by the configure script. If this file (which can be an +arbitrary shell script) sets "bsd_games_cfg_non_interactive" to "y", +then the default answers to all questions will be taken without +interaction. If this sets "bsd_games_cfg_FOO" to "BAR" then the +default value for configuration parameter "FOO" will become "BAR" +instead of whatever default the script would otherwise give. You can +find the names and meanings of the configuration parameters by reading +the configure script; they are not otherwise documented. + +Issues for packagers +==================== + +Please read the security warnings in SECURITY. There is a potential +trade-off between security and functionality present, and you may wish +to choose a potentially more secure default and allow the sysadmin to +change permissions if they are in an environment (for example, a home +system with only trusted users) where the functionality is preferred, +while ensuring such changes persist across upgrades. Some packagers +may wish to provide a security-hardened system by giving each setgid +game its own group so bugs in one do not affect others. + +You may wish to include auxiliary documentation for users, such as the +AUTHORS and THANKS files and the year 2000 statement YEAR2000. + +Assuming you distribute source for your package (I do not believe any +of the games have licences requiring this), and separate your patches +from the original source .tar.gz files (whether in separate files or +in a single file source package including them as separable +components), arranging the building of the source so that your patches +add a "config.params" as described above, and do any other necessary +changes to "configure" or other source files, and so that the build +process runs configure non-interactively and then builds the package, +makes it easier for readers to see how you have packaged it than +running configure interactively and including the generated files in +your patch. + +Since bsd-games no longer comes with its own words file, you may wish +to ensure that the same dictionaries are used in the build of boggle +regardless of the local configuration of the dictionaries installed on +the computer used for the build. (The list used by hangman can also +be specified by the user at run time; future versions may provide for +this to be done with boggle as well; see TODO.) + +Andries Brouwer has noted more than once on linux-kernel (and +elsewhere) that some packagers (for various software and documentation +used under Linux): + +(a) Do not send their patches to upstream maintainers, so that +improvements and bug fixes stay in some distributions, which may need +to discover them independently, and do not come to benefit other +users. + +(b) Keep applying their same patches to new versions of the source as +long as they apply without error, even though they may no longer be +needed or even be harmful. + +If you have patches that are needed for the package to build or to fix +bugs (in a supported environment, not with old versions of libraries +and tools) or that provide enhancements other than conforming to +distribution-specific policy, please send them to me (unidiffs +preferred; see notes on bug reporting and sending patches at the end +of README). Do not assume that old patches should be applied to new +versions; check that the problem they are supposed to fix is still +present first. + +Warnings +======== + +If distributing bsd-games, it is your responsibility to check that the +licences on the games you distribute permit what you wish to do with +them, and that you are providing accurate information on the licences +to your users. Likewise it is your responsibility to carry out +whatever audits you deem necessary on the code, and to include such +warnings or information (about security and otherwise) for the end +user as you see fit. Please read the disclaimers in the individual +source files. + +Some of the games may contain material, actions or language that in +some jurisdictions may be prohibited or considered unsuitable for +minors; this includes but is not limited to the offensive fortunes. +It is your responsibility to determine and apply any restriction on +your distribution of the games that may be necessary in consequence. + +This package contains cryptographic software (caesar and rot13). See +the warnings in README about this. + +Notification of new versions +============================ + +If you want to receive notification of new versions by email, but do +not currently receive this notification, please let me know. + +A note on terminology and credit +================================ + +I am not the "upstream author" of the games packaged here; for an +incomplete list of the authors see AUTHORS, but do not give me this +credit I do not deserve at the expense of the true authors. Rather I +am the "upstream maintainer" of the bsd-games and bsd-games-non-free +packages (upstream relative to distributions), and upstream of me is +NetBSD, who also are maintainers of the games, but not for the most +part authors. Nor am I the creator of the bsd-games package, although +much the current form of the packaging and many of the porting changes +are mine: the package was created by Curt Olson and Andy Tefft, and +passed to me after it had been idle and unmaintained for some years. +Any system that provides fields for recording this sort of information +should distinguish these concepts, and the different fields should be +filled in correctly. Please consider where credit is due and credit +the authors of the games accordingly: if you find the names of authors +where not known and listed in AUTHORS, or up-to-date contact details +for authors listed there, please send me the details so they can +receive their due credit in future versions, and thanks from any +appreciative users. + + + +Local Variables: +mode: text +End: diff --git a/README b/README new file mode 100644 index 0000000..17165f4 --- /dev/null +++ b/README @@ -0,0 +1,139 @@ +README for bsd-games +==================== + +This is the bsd-games package for Linux (and GNU Hurd), containing +ports of all the games from NetBSD-current that are free in the usual +(DFSG/OSD) sense (i.e. modified and unmodified versions can be freely +distributed, including for profit). NetBSD-current contains two other +games, rogue and larn. Rogue has a standard BSD licence, but with an +additional contradictory licence that does not allow for-profit +distribution; larn has no licence at all, only a notice that "Copying +for Profit is Prohibited". If you want rogue, get the +bsd-games-non-free package (which should be on sunsite, but not +tsx-11), and read the README.non-free that it contains: rogue is being +distributed separately, and larn not distributed at all in this Linux +port, in the absence of definite confirmation of what licences really +apply to rogue and larn. A game not from NetBSD, paranoia, was in +earlier versions of bsd-games-non-free (and bsd-games 1.2 and 1.3) but +has been removed because of the lack of a clear licence. + +The games are mostly not enhanced from the NetBSD versions, but many +bugs are fixed. + +For installation instructions and details of prerequisites, see the +file "INSTALL". + +The statement of year 2000 issues associated with bsd-games and +bsd-games-non-free is in the file "YEAR2000". + +The copyrights and licence terms for the games, as best as I can +determine them, are in "COPYING". + +This package contains cryptographic software (caesar and rot13). In +some jurisdictions, use or distribution of these utilities may be +restricted, whether under export control regulations or because these +cryptosystems have been used as technical protection measures to +restrict access to and copying of copyright works. + +This package contains the following games: + +adventure: the original adventure by Crowther and Woods +arithmetic: arithmetic quiz/speed test +atc: air traffic control +backgammon: backgammon +banner: display a message in big letters +battlestar: adventure game on a battlestar +bcd: outputs text in an antique form +boggle: boggle +caesar: reads fortunes from the game fortune, also some internet posts +canfield: curses-based solitaire +countmail: tell you how much new mail you have +cribbage: cribbage +dab: dots and boxes +dm: dungeon master, regulates games playing +factor: factor a number +fish: go fish +fortune: displays a random silly message +gomoku: gomoku +hack: exploring the Dungeons of Doom +hangman: guess the word before it is too late +hunt: hunt each other in a maze (multiplayer -- great) +mille: mille borne against the computer +monop: monopoly +morse: output morse code +number: output the English text for a number +phantasia: interterminal fantasy game +pig: output text in Pig Latin +pom: display the phase of the moon +ppt: outputs text in another antique form +primes: generate primes +quiz: random knowledge tests +rain: attempts to create a rain drop effect (best at 9600 baud) +random: random lines from a file or random numbers +robots: well... avoid the robots +sail: sail your ship into battle +snake: grab the cash and avoid the snake and exit +tetris: tetris +trek: We come in peace, shoot to kill. It's worse than that, he's + dead Jim. Ye cannot change the laws of physics. It's life + Jim, but not as we know it. There's Klingons on the starboard + bow ... +wargames: would you like to play a game? +worm: eat the numbers without running into anything +worms: random worms scurrying across your screen +wtf: translate acronyms, e.g. "wtf is WTF" +wump: hunt the wumpus + +If you have questions about bsd-games or bsd-games-non-free you can +contact me at . Bug reports should state the +versions of ncurses and libc used, unless clearly not relevant (e.g., +bugs in data files, or where you have an analysis and patch). If you +want to be informed by email of new releases when they come out, +please let me know. + +Known bugs are listed in the file BUGS; please do not send bug reports +for bugs listed there, but patches that fix them are welcome. + +For patches, I prefer unidiffs (use "diff -u OLD NEW", or "diff -ruN +OLD-DIRECTORY NEW-DIRECTORY"), but if your diff cannot produce them +then context diffs are OK. Please remember to include details of the +bug and your analysis of the problem if you are sending a patch; I +have ported the code from NetBSD to Linux, but may not be familiar +with the workings of any particular program, whereas you will be if +you have been tracing and fixing a bug. The GCC info manual contains +a discussion of how to produce good bug reports. + +Notes on specific games: + +boggle: by default this game compiles with certain Linux improvements; +if you want the original BSD behaviour, remove -DNEW_STYLE from the +boggle_boggle_DEFS in boggle/boggle/Makefrag. Defining NEW_STYLE will +provide a more intuitive way of quitting or playing a new game after +time has run out. + +dm: the "dungeon master", a program that allows you to control when +users can play games. (Note that this does not control any private +copies of games they may have.) I do not claim that this program is +actually useful, but it is included in bsd-games since it is in +NetBSD. Add -DLOG to the DEFS in dm/Makefrag if you want logging of +games playing (not regularly tested). + +fortune: Another enhanced version is available from +. +unstr is not installed by default. If you want to install it, +uncomment the relevant lines (installation command and definition of +fortune_unstr_DIRS) in fortune/unstr/Makefrag before doing the top +level "make install". + +hunt: may well be unreliable or broken in various ways. There is some +local configuration possible in hunt/Makeconfig but changing this may +well break things. + +Joseph S. Myers +jsm@polyomino.org.uk + + + +Local Variables: +mode: text +End: diff --git a/README.non-free b/README.non-free new file mode 100644 index 0000000..61e2169 --- /dev/null +++ b/README.non-free @@ -0,0 +1,27 @@ +README for bsd-games-non-free +============================= + +The bsd-games-non-free package contains one game from NetBSD with a +restrictive licence (non-free by the DFSG/OSD definition), rogue. +Possibly this rogue cannot be sold for profit; it is not clear whether +the restrictive licence overrides the BSD licence also included, or is +superseded by it. + +Here's what this package has: + +rogue: exploring the Dungeons of Doom + +Rogue is from NetBSD-current. + +If you have questions about bsd-games-non-free you can contact me at +. Bug reports should state the versions of +ncurses and libc used. + +Joseph S. Myers +jsm@polyomino.org.uk + + + +Local Variables: +mode: text +End: diff --git a/SECURITY b/SECURITY new file mode 100644 index 0000000..1a25114 --- /dev/null +++ b/SECURITY @@ -0,0 +1,90 @@ +Security of bsd-games and bsd-games-non-free +============================================ + +Some games maintain system-wide score files or logs, and need +appropriate privileges to write to these files. They can get these +privileges by being installed setgid games, or through the files being +world writable. If they do not have these privileges, they will run, +but fail to update the score files. Most of the games were written at +a time when security was not considered important; therefore, making +games setgid has in the past meant that users can get a shell with gid +games, and possibly also get access to the accounts of other games +players by corrupting the score files. (This will also apply to many +more modern games that are badly written.) + +In version 2.2, security fixes from OpenBSD have been applied: most of +the games that have score files will open them on startup, and then +drop any setgid privileges completely (including the saved gid). This +limits the effect of a cracked game to corruption of its score file. +It should be somewhat safer now to make games setgid games than in +versions 2.1 and earlier, but probably not completely safe; phantasia, +sail, rogue, hack and tetris do not currently handle their score files +in the above way, and so should be considered the most dangerous to +install setgid. If you are auditing these games, phantasia, sail, +rogue, hack and tetris should be considered the most important to +audit. In versions before 2.14, rogue had an exploitable buffer +overrun (see NetBSD Security Advisory 2002-021). + +An effect of this security policy is that in some cases the score +files need to be world-readable so that they can be opened for reading +after the game has dropped privileges, or by a score file reading +program that was never privileged. In versions before 2.10, the +phantasia "characs" file (containing passwords for phantasia +characters) was mistakenly made world readable. + +You should, of course, only install the games setgid if this is in +line with system security policy. Games should not be installed +setuid, since if a setuid game is cracked this allows games to be +replaced with trojans. Games should not be installed setgid to a +system group such as "root" or "daemon". In some environments, an +acceptable alternative may be not to give the games any special +privileges, but to put trusted users in the games group. + +An option is to use the "dungeon master" dm to regulate games playing. +I believe this is safe; games that do not need to run setgid drop the +setgid privileges they get from dm on startup. If dm is setgid, but +the games that access score files are not, then they will keep their +setgid privileges from dm; note that in this case it does not make +sense for dm to be setgid to some gid other than the one (normally +"games") with write access to the score files. + +This package does not yet support security hardening by giving each +setgid game its own gid, but in some environments you may wish to do +this. + +*********************************************************************** +* * +* DO NOT INSTALL ANY GAMES SETUID, ONLY SETGID. * +* * +* INSTALLING GAMES SETGID GAMES MIGHT ENABLE TO GET SHELLS WITH GID * +* GAMES. * +* * +* WHERE GAMES READ A SCORE FILE, IF A USER CAN CORRUPT THIS FILE IT * +* MIGHT IN SOME CASES MEAN THEY CAN GET ACCESS TO THE ACCOUNTS OF * +* OTHER USERS PLAYING THAT GAME. * +* * +* IF IN DOUBT, CHOOSE THE DEFAULT OPTIONS FOR PERMISSIONS AND DO * +* WITHOUT SCOREFILES. * +* * +* THESE GAMES COME WITH NO WARRANTY. * +* * +*********************************************************************** + +If you are compiling these games on an operating system other than +Linux, be warned that they rely for their security on +"setregid(getgid(), getgid())" dropping all setgid privileges +permanently, _including the saved gid_. On some operating systems +this may fail to drop the saved gid (and indeed such operating systems +may provide no way for a process not running as root to revoke +privileges permanently); in such a case, bugs in a game may provide +access to the games group rather than merely to to that game's score +file. + +Joseph S. Myers +jsm@polyomino.org.uk + + + +Local Variables: +mode: text +End: diff --git a/THANKS b/THANKS new file mode 100644 index 0000000..5ca755b --- /dev/null +++ b/THANKS @@ -0,0 +1,80 @@ +Credits and acknowledgements for bsd-games and bsd-games-non-free +================================================================= + +For details of authors of the games and maintenance of the bsd-games +and bsd-games-non-free packages, see AUTHORS. The following are +further credits for people who have helped improve the package; thanks +also to those who have reported bugs and so helped us improve the +package, and to those who have similarly contributed to the games in +*BSD over the years. Please help me to repair any errors or omissions +in this list. + + +For recent work (since 1.3), thanks to: + +David A Bagley + + For work towards portability to Cygwin. + +Joey Hess + + For the Debian patches, which covered what was needed to make the games + compile with current libraries, provided many bug fixes and showed + where I needed to do things like parametrise manpages. Also many other + bug reports and fixes, and manpages for wargames and paranoia. + +David Frey + + For the ports of tetris and gomoku. + +Bill Lash + + For tracking down and fixing a bug in rogue. + +Paul Janzen + + For work on the OpenBSD games, including supplying improvements that + could be applied to the Linux port, and merging NetBSD changes into + OpenBSD so making it easier to extract his and other OpenBSD changes + to include in the Linux port. Also for checking the licence of + boggle, so it could be included in the main bsd-games package. + +Hubert Feyrer + + For timely responses to my NetBSD PRs, merging the Linux changes + back into NetBSD. Also for sponsoring me to be a NetBSD developer, + and for general assistance in the merge. + +Stuart Lamble + + For a bug report and analysis (with patch) about scoring in + backgammon. + +Malcolm Parsons + + For several bug reports and fixes. + +For the original bsd-games package (versions up to 1.3): + +Special Thanks to: + +Andy Tefft (teffta@engr.dnet.ge.com) + + For porting backgammon, canfield, fortune, and number. Andy also was a + big help in organizing this project, and in getting the ball rolling in + the early stages. + +Thanks also to: + Ross Becker (beckerr@pyrite.som.cwru.edu) - working on hunt. + jyanowit@orixa.mtholyoke.edu - backgammon bug fix. + Andrew Kuchling (fnord@binkley.cs.mcgill.ca) - bog bug fix. + Rik Faith (faith@cs.unc.edu) - words file for hangman and bog. + +For authors and acknowledgements for the original BSD games, see +AUTHORS. + + + +Local Variables: +mode: text +End: diff --git a/TODO b/TODO new file mode 100644 index 0000000..7013fda --- /dev/null +++ b/TODO @@ -0,0 +1,90 @@ +TODO list for bsd-games and bsd-games-non-free +============================================== + +Please let me (jsm@polyomino.org.uk) know if you're interested in +doing any of these, or have done work on them, so we can avoid +duplication of effort. The order of entries is just the order they +were added in, not any priority order. + +The file BUGS lists known bugs; you may wish to work on some of +those. The issues listed there are not included in this list. + +1997-04-29 - Improve security of games when running setgid. Most of + this has been done, through adopting changes from + OpenBSD, but a thorough audit is needed - see SECURITY. + The Linux Security Audit Project looked at the games but + never bothered to send me their fixes; I think they are + now included. Rogue and tetris could probably be adapted + to keep their score files open and so need no more + privileges than an open file descriptor. Sail could + better use a daemon than a file for interfacing between + multiple players; Paul Janzen might do this at some point. + +1997-04-29 - Fix compilation warnings with increasingly strict warning + options. The main reasonable ones have now been done, + but maybe some bits are left, and new warnings get added + to new versions of GCC. Fixes for -pedantic warnings are + in progress. + +1997-05-01 - Games with scorefiles should lock them when updating them. + +1997-07-15 - Get distribution permission for larn. Get licence of + rogue clarified. (See NetBSD PR 5850. Note that the + original author of larn, Noah Morgan, is dead.) + +1998-07-28 - Support building in a directory other than the source directory. + +1998-08-27 - Convert the games that use termcap to use curses. + Currently these are backgammon, hack and tetris; rain, + snake and worms have been done. If it becomes possible + to distribute larn, this will apply to it as well. + +1998-08-27 - If we build a game that links to another game's manpage, + but don't install the other game, then we get a dangling + symlink or .so for the manpage. + +1998-08-27 - Merge in improvements from OpenBSD. Perhaps FreeBSD also + has some; Paul Janzen is adding FreeBSD changes to + OpenBSD, so they may reach me that way. + +1998-09-11 - Move building of more files in which configuration + variables are substituted from the configure script into + the Makefiles. + +1998-12-06 - Allow alternative dictionaries to be specified at runtime + for boggle. + +1998-12-11 - Support LFS (large files) - this requires using + fseeko/ftello instead of fseek/ftell, where supported, + and using -D_FILE_OFFSET_BITS=64 (actually getconf + LFS_CFLAGS, getconf LFS_LDFLAGS and getconf LFS_LIBS), + and could be useful with the kernel support for 32 bit + uids in Linux 2.4, when there could be sparse score files + (indexed by uid) over 2Gb. + +1998-12-14 - Check for any more constant data that could be marked + const. + +1998-12-28 - Fix any places that use the pid as random seed to use + something else, such as the time, because the pid is bad + when people boot up their system just to play a game and + so it is constant. + +1999-07-29 - Provide support for giving each setgid game its own gid. + +2000-09-09 - Fuzz testing (i.e., pass random input to games in an + attempt to crash them). Some bugs have been found and + fixed in battlestar through this already. It probably + works best with GCC bounded pointers. + +2000-09-09 - Support for HURD-based GNU systems. This may now (2.13) + work. + +2000-09-24 - Fix any and all date-related bugs (Y2038, Y10K, etc.) so + that the games will work on any date provided only that + time_t is big enough. + + +Local Variables: +mode: text +End: diff --git a/YEAR2000 b/YEAR2000 new file mode 100644 index 0000000..15aedae --- /dev/null +++ b/YEAR2000 @@ -0,0 +1,36 @@ +YEAR 2000 STATEMENT FOR BSD-GAMES AND BSD-GAMES-NON-FREE +======================================================== + +The BSD games, and the Linux port thereof, come with NO WARRANTY, to +the extent permitted by applicable law; see the disclaimers in the +source files for details. These games are not suitable for use in +mission-critical situations. The information given below is for +information only, and the maintainer can accept no liability for any +damage that may be caused by any defect in this software or inaccuracy +in the statement below. (If you bought this software from a +distributor, they may offer a warranty; contact them for any details +of this, or if you want copies of any year 2000 statements on headed +notepaper.) + +The BSD games are only one piece of software on a Linux system, and +their year 2000 behaviour must be considered in conjunction with that +of other software on the system; in particular, the C runtime library +(including the math library), the ncurses library, the lex library, +and the kernel, functions of which may be used at runtime, and the +complier, binary utilities, make, yacc, lex and header files used to +compile the BSD games. I can provide no information concerning the +compliance of these components, or how any non-compliance might affect +the compliance of the BSD games. + +To the best of my knowledge, there are no date-related operations in +any of the BSD games, in bsd-games and bsd-games-non-free versions 2.2 +or later, which will handle the year 2000 incorrectly; please see the +disclaimer above. Earlier versions are known to have problems; in +particular, the game with the greatest date dependence, pom (which +determines the phase of the Moon), may handle the year 2000 +incorrectly in earlier versions. However I cannot vouch for the +accuracy of the algorithm used by pom over any particular timescale, +and for accurate information on the phases of the Moon you are advised +to consult the Astronomical Almanac or some other reputable source. +Any further date-related bugs that are found and reported _may_ be +fixed in the ordinary course of subsequent releases. diff --git a/bsd-games-non-free.lsm b/bsd-games-non-free.lsm new file mode 100644 index 0000000..d28aafc --- /dev/null +++ b/bsd-games-non-free.lsm @@ -0,0 +1,14 @@ +Begin4 +Title: bsd-games-non-free +Version: 2.17 +Entered-date: 2005-02-18 +Description: Games from NetBSD with restrictive licences + (not DFSG/OSD-free). Includes: rogue. +Keywords: games, NetBSD +Maintained-by: jsm@polyomino.org.uk (Joseph S. Myers) +Primary-site: ibiblio.org /pub/Linux/games + bsd-games-non-free-2.17.tar.gz +Platforms: Requires ncurses (curses/termcap may also work but are no + longer tested/supported) +Copying-policy: restricted +End diff --git a/configure b/configure new file mode 100755 index 0000000..017c6a4 --- /dev/null +++ b/configure @@ -0,0 +1,821 @@ +#!/bin/sh +# configure - home-grown configuration script for bsd-games. +# +# Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +# Default paths follow Filesystem Hierarchy Standard version 2.0. + +# This will only ask some questions if the previous answers are appropriate. +# It will substitute values in the directories built in, and the main +# GNUmakefile. + +# Allow defaults to be given by a script +if [ -e ./config.params ]; then + . ./config.params +fi + +subst_vars=srcdir + +srcdir="`pwd`" + +ask () { + long_query="$1" + query_var="$2" + dflt_var="bsd_games_cfg_$query_var" + eval default=\"\$\{${dflt_var}-\$3\}\" + printf "%s [%s] " "$long_query" "$default" + if [ "x$bsd_games_cfg_non_interactive" = xy ]; then + # Follow default + input='' + echo "[ Using default ]" + else + read input + fi + case "$input" in + ('') + input="$default" + ;; + (*) + ;; + esac + eval $query_var=\"\$input\" + subst_vars="$subst_vars $query_var" +} + +ask_yn () { + eval $2= + eval answer=\$$2 + while test "x$answer" = x; do + ask "$1" $2 $3 + eval answer=\$$2 + case "$answer" in + ([yY]*) + answer=y + ;; + ([nN]*) + answer=n + ;; + (*) + answer= + echo "Please answer y or n" + ;; + esac + done + eval $2=\$answer +} + +askperms () { + filetype=$1 + var_prefix=$2 + def_owner=$3 + def_group=$4 + def_perms=$5 + if [ $do_chown = y ]; then + ask "$filetype owner" ${var_prefix}_owner $def_owner + ask "$filetype group" ${var_prefix}_group $def_group + fi + ask "$filetype permissions" ${var_prefix}_perms $def_perms + if [ $do_chown = y ]; then + eval install_$var_prefix=\"install -c -m \$${var_prefix}_perms -o \$${var_prefix}_owner -g \$${var_prefix}_group\" + else + eval install_$var_prefix=\"install -c -m \$${var_prefix}_perms\" + fi + subst_vars="$subst_vars install_$var_prefix" +} + +building_in () { + echo " $build_dirs " |grep -q " $1 " +} + +not_building_in () { + echo " $no_build_dirs " |grep -q " $1 " +} + +game_ask () { + game="$1" + if building_in "$game"; then + ask "$2" "$3" "$4" + fi +} + +check_func () { + funcname=$1 + subst_vars="$subst_vars ${funcname}_defs" + cat >conftest.c + printf "Checking for %s..." "$funcname" + compiler="$cc $optimize_flags $other_cflags $other_ldflags" + if $compiler conftest.c >/dev/null 2>&1; then + echo "found." + echo "#define HAVE_$funcname 1" >>include/bsd-games.h + # Check whether we need _GNU_SOURCE for a prototype. + if $compiler -Wall -Werror conftest.c >/dev/null 2>&1; then + eval ${funcname}_defs= + else + # Prototype not in headers by default (try _GNU_SOURCE). + eval ${funcname}_defs=-D_GNU_SOURCE + fi + rm -f a.out conftest.c + true + else + echo "not found." + rm -f a.out conftest.c + eval ${funcname}_defs= + false + fi +} + +echo "For normal usage the installation prefix will be empty. If you wish" +echo "to install everything in another directory to that in which it will" +echo "finally be located (so that your packaging system can then move it" +echo "there) you should name that directory here. This is most likely to" +echo "be the case if you are packaging bsd-games for a Linux distribution." +ask "Installation prefix" install_prefix '' + +echo "There may be some programs here you have from another package and so" +echo "do not want to build and install. The most likely ones are banner," +echo "factor and fortune." + +ask "Games not to build" no_build_dirs '' + +# Normalise white space in no_build_dirs +no_build_dirs="`echo $no_build_dirs`" + +def_build_dirs= +for file in *; do + if [ -e "$file/Makefrag" ] && ! not_building_in "$file" && [ "$file" != lib ]; then + def_build_dirs="$def_build_dirs $file" + fi +done +def_build_dirs=${def_build_dirs## } + +ask "Games to build" build_dirs "$def_build_dirs" + +# Normalise white space in build_dirs +build_dirs="`echo $build_dirs`" + +echo +echo "*** NOTE - The default directories for installation follow the" +echo "*** Filesystem Hierarchy Standard version 2.0 (FHS). If your" +echo "*** system still uses the older FSSTND 1.2, or if you wish to install" +echo "*** under /usr/local, you will need to check the paths and make" +echo "*** changes as appropriate. If this is your first installation with" +echo "*** the new FHS paths, you may need to remove some old files after" +echo "*** installation." +echo + +ask "Games directory" gamesdir /usr/games + +# We put huntd in /usr/games by default (instead of /usr/sbin as earlier, +# or /usr/lib) since it can reasonably be called by users and counts +# properly more as a game than an ordinary user binary. +if building_in hunt; then + echo + echo "Hunt includes a daemon for coordinating games with multiple players" + ask "Daemon directory" sbindir /usr/games +else + sbindir= + subst_vars="$subst_vars sbindir" +fi +if building_in fortune; then + echo + echo "Fortune includes a non-game utility strfile" + ask "Non-game binary directory" usrbindir /usr/bin +else + usrbindir= + subst_vars="$subst_vars usrbindir" +fi + +hidegame=: +subst_vars="$subst_vars hidegame" +if building_in dm; then + echo + echo "You may wish to restrict the use of games by user, terminal, load," + echo "etc.. This can be done by the use of dm. If you use this" + echo "configuration, then games will be kept in a non-world-searchable" + echo "directory such as /usr/lib/games/dm and replaced by symlinks to dm." + echo "Even if you don't choose this option, you will still be asked" + echo "for the directory name, since you are building dm, and can change" + echo "manually later. It is strongly recommended that you keep the" + echo "default answer of 'n'." + ask_yn "Use dm and hide games" use_dm n + # The default location is now /usr/lib/games/dm to conform to FHS 2.0. + ask "Directory for hidden games" libexecdir /usr/lib/games/dm + if [ "$use_dm" = y ]; then + hidegame=$srcdir/hide-game + fi +fi +ask "Section 6 manpage directory" man6dir /usr/share/man/man6 +if building_in dm || building_in fortune; then + ask "Section 8 manpage directory" man8dir /usr/share/man/man8 +else + man8dir= + subst_vars="$subst_vars man8dir" +fi +if building_in dm; then + ask "Section 5 manpage directory" man5dir /usr/share/man/man5 +else + man5dir= + subst_vars="$subst_vars man5dir" +fi + +if building_in trek || building_in rogue; then + ask "Directory for miscellaneous documentation" docdir /usr/share/doc/bsd-games +else + docdir= + subst_vars="$subst_vars docdir" +fi + +# The paths for data are as per the FHS. If a future version removes the +# games ghettoes of /usr/games, /var/games, etc., then a subdirectory for +# this package (/usr/share/bsdgames, /var/state/bsdgames, etc.) would be +# desirable, but I don't feel it necessary at present. + +ask "Library directory for constant data + (architecture independent)" sharedir /usr/share/games +ask "Library directory for variable data" varlibdir /var/games + +ask_yn "Set owners/groups on installed files" do_chown y + +echo +echo "See SECURITY for a discussion of security issues related to score files." +echo "There are at least two possible security policies if you want them to" +echo "work. You can make the files world-writable, and then anyone who wants" +echo "can put anything in them, which may not be desirable if you think people" +echo "might cheat this way. Or you can make the games that use them setgid" +echo "games, and give the files permissions 0664. Note, however, that some" +echo "of the games may well be insecure when this is done and" +echo "malicious users may still be able to overwrite anything writable by" +echo "group games, since the games were probably not designed with security in" +echo "mind, although version 2.2 is more secure than earlier versions." +echo "The default is neither of these: it creates scorefiles with" +echo "permissions 0644 and gives the games no special privileges, which is" +echo "more secure but means that the games will fail when trying to write" +echo "to their scorefiles." + +askperms "Binary" binary root root 0755 +askperms "Game with scorefile" score_game root root 0755 # or root games 2755? +if building_in hunt; then + askperms "Daemon" daemon root root 0755 +fi +if building_in dm; then + askperms "Directory for hidden games" dmdir root games 0750 + install_dmdir=`echo "$install_dmdir"| sed 's/install -c/install -d/'` + askperms "dm" dm root games 2755 +fi +askperms "Manpage" manpage root root 0644 +askperms "Constant data" constdata root root 0644 +askperms "Variable data" vardata root root 0644 # or 0666? + +ask "Permissions on variable data that should not be world readable" vardata_perms_priv 0640 + +use_dot_so= +while test x$use_dot_so = x; do + ask "Use .so or symlinks for manpages" use_dot_so .so + case "$use_dot_so" in + (.so) + ;; + (syml*) + use_dot_so=symlinks + ;; + (*) + use_dot_so= + echo "Please answer \`.so\' or \`symlinks\'" + ;; + esac +done +subst_vars="$subst_vars use_dot_so" + +ask_yn "Gzip manpages" gzip_manpages y + +# What we do with manpages is a bit complicated. If either ppt or morse is +# being built, we must also install the bcd manpage, even if bcd isn't being +# built. We then need to do either .so or symlink. This should all be handled +# by the install-man.in script, but the installation of linked-to manpages +# isn't implemented yet. + +# Copy install_binary to install_script +install_script="$install_binary" +subst_vars="$subst_vars install_script" + +echo +echo "It is presumed in some places by the Makefiles that the compiler" +echo "will be some form of gcc." +ask "C compiler" cc gcc +if building_in dab; then + ask "C++ compiler" cxx g++ +fi +ask "Optimize flags" optimize_flags "-g -O2" +echo +echo "The default warning flags should give a compile with few warnings." +# -Wbad-function-cast and -Wshadow give lots of warnings that are basically +# harmless. +ask "C compiler warning flags" warning_flags "-Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings" +if building_in dab; then + ask "C++ compiler warning flags" cxx_warning_flags "-Wall -W -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings" +fi +echo +echo "You probably want the default here, or could use -lncurses_g for" +echo "debugging ncurses. Use -lcurses -ltermcap if you want to try that," +echo "but note that this is no longer supported and may not work." +ask "Ncurses library" ncurses_lib -lncurses +echo +echo "If you have a directory /usr/include/ncurses with the ncurses include" +echo "files in it, and the , , etc. in /usr/include" +echo "are for BSD curses/termcap, you will need to put -I/usr/include/ncurses" +echo "here. Otherwise (if the ncurses includes are in /usr/include), leave" +echo "this blank. Leave it blank if /usr/include/ncurses is a symbolic link" +echo "to /usr/include." +ask "Ncurses includes" ncurses_includes '' + +openssl_lib= +openssl_includes= +if building_in factor; then + echo + echo "factor can use libcrypto from OpenSSL to handle large numbers." + ask_yn "Use libcrypto" use_libcrypto y + if [ $use_libcrypto = y ]; then + echo "If the OpenSSL includes (with files such as bn.h) are not in" + echo "/usr/include/openssl, then you will need to specify a -I option" + echo "here, naming a directory containing an \"openssl\" subdirectory" + echo "with the OpenSSL headers." + ask "OpenSSL includes" openssl_includes '' + echo "If the OpenSSL libcrypto library is not in a location searched" + echo "by the compiler by default, or has a strange name, you will" + echo "need to specify the appropriate options to find it here" + echo "(for example, -L/usr/ssl/lib -lcrypto); otherwise, leave the" + echo "default, which is probably correct." + ask "OpenSSL libcrypto library" openssl_lib -lcrypto + fi +fi +subst_vars="$subst_vars openssl_lib openssl_includes" + +ask "Other CFLAGS" other_cflags '' +ask "Other LDFLAGS" other_ldflags '' + +# Check for functions - not in glibc 2.1.1, but could be added later. +echo "#ifndef LINUX_BSD_GAMES_H" >include/bsd-games.h +echo "#define LINUX_BSD_GAMES_H 1" >>include/bsd-games.h + +if [ "$use_libcrypto" = "y" ]; then + echo "#define HAVE_OPENSSL 1" >>include/bsd-games.h +fi + +check_func getloadavg < + +int +main(void) +{ + double la[3]; + getloadavg(la, 3); + return 0; +} +EOF + +check_func fgetln < + +int +main(void) +{ + char *f; + size_t l; + f = fgetln(stdin, &l); + return 0; +} +EOF + +check_func strlcpy < + +int +main(void) +{ + char s[1] = ""; + char d[1]; + strlcpy(d, s, 1); + return 0; +} +EOF + +check_func sig_t < + +sig_t s; + +int +main(void) +{ + return 0; +} +EOF + +check_func getprogname < + +int +main(void) +{ + const char *n = getprogname(); + return 0; +} +EOF + +echo "#endif /* !defined(LINUX_BSD_GAMES_H) */" >>include/bsd-games.h + + +echo +echo "For some special purposes you may want to link all games with a" +echo "particular library, in addition to those they would normally be linked" +echo "with. Unless you know you want this, you can leave it empty." +ask "Base libraries" base_libs '' + +if building_in atc; then + ask "Yacc program" yacc "bison -y" +fi +if building_in atc; then + ask "Lex program" lex flex + ask "Lex library" lex_lib -lfl +fi + +echo +echo "You can choose the default pager for those games that use one (for" +echo "example, for viewing instructions). This can be an absolute path," +echo "or the name of the pager to be searched for via the PATH at runtime." +echo "All these games will also honour the PAGER environment variable if set," +echo "in the correct (POSIX.2) way." +ask "Pager" pager /usr/bin/less + +if building_in fortune; then + echo + echo "Fortune comes with some potentially offensive fortunes. You should" + echo "only install these if you are sure that your users want them." + ask_yn "Install offensive fortunes" offensive_fortunes n + if [ $offensive_fortunes = y ]; then + fortune_type=real + else + fortune_type=fake + fi + subst_vars="$subst_vars fortune_type" +fi + +if building_in sail; then + echo + echo "Sail needs its own directory it can write to for temporary files" + echo "to synchronise among multiple players. Note that with the" + echo "default permissions given here this will not work: you may want" + echo "to choose permissions appropriate to the security policy you are" + echo "using. It may be more secure if this directory is not world" + echo "accessible (e.g. mode 2770)." + ask "Directory for sail temporary files" sail_dir "$varlibdir/sail" + askperms "Sail directory" sail_dir root root 0750 + install_sail_dir=`echo "$install_sail_dir" |sed 's/install -c/install -d/'` +fi + +echo +echo "You can configure the exact names used for data files by various" +echo "of the games. Most probably the defaults are OK." +echo +echo "Note that bsd-games no longer comes with its own word list." +echo "For hangman you should specify the path to a word list to be read" +echo "at runtime (probably /usr/share/dict/words or /usr/dict/words)." +echo "For boggle you should specify one to be used at compile time to" +echo "generate boggle's own data. In both cases they should probably be" +echo "English dictionaries; all words which do not consist entirely of" +echo "lower-case ASCII letters will be silently ignored." +echo +game_ask atc "Directory for atc static data" atc_dir "$sharedir/atc" +game_ask atc "Score file for atc" atc_scorefile "$varlibdir/atc_score" +game_ask battlestar "Score file for battlestar" battlestar_scorefile "$varlibdir/battlestar.log" +# Bog has some other configuration +game_ask boggle "Dictionary for boggle (CHECK ANSWER)" dictionary_src /usr/share/dict/words +game_ask boggle "Directory for boggle static data" boggle_dir "$sharedir/boggle" +game_ask canfield "Score file for canfield" canfield_scorefile "$varlibdir/cfscores" +game_ask cribbage "File for cribbage instructions" cribbage_instrfile "$sharedir/cribbage.instr" +game_ask cribbage "Score file for cribbage" cribbage_scorefile "$varlibdir/criblog" +game_ask dm "Configuration file for dm" dm_configfile /etc/dm.conf +game_ask dm "File to disable games playing" dm_nogamesfile /etc/nogames +game_ask dm "Log file for dm" dm_logfile "$varlibdir/games.log" +game_ask fish "File for fish instructions" fish_instrfile "$sharedir/fish.instr" +game_ask fortune "Directory for fortune files" fortune_dir "$sharedir/fortune" +game_ask hack "Directory for hack variable data" hack_dir "$varlibdir/hack" + +if building_in hack; then + echo + echo "This directory will need to be writable by hack at runtime." + echo "Note that with the default permissions given here this will" + echo "not work: you may want to choose permissions appropriate to the" + echo "security policy you are using (e.g. 2775 root.games for setgid" + echo "games)." + askperms "Hack directory" hack_dir root root 0755 + install_hack_dir=`echo "$install_hack_dir" |sed 's/install -c/install -d/'` +fi + +game_ask hangman "Words file for hangman (CHECK ANSWER)" hangman_wordsfile /usr/share/dict/words +# Hunt has some other configuration +game_ask monop "File for monop cards" monop_cardsfile "$sharedir/monop-cards.pck" +game_ask phantasia "Directory for phantasia variable data" phantasia_dir "$varlibdir/phantasia" +game_ask quiz "Directory for quiz static data" quiz_dir "$sharedir/quiz" +game_ask robots "Score file for robots" robots_scorefile "$varlibdir/robots_roll" +game_ask rogue "Score file for rogue" rogue_scorefile "$varlibdir/rogue.scores" +game_ask sail "Score file for sail" sail_scorefile "$varlibdir/saillog" +game_ask snake "Score file for snake" snake_scorefile "$varlibdir/snake.log" +game_ask snake "Raw score file for snake" snake_rawscorefile "$varlibdir/snakerawscores" +game_ask tetris "Score file for tetris" tetris_scorefile "$varlibdir/tetris-bsd.scores" +game_ask wtf "Acronym database for wtf" wtf_acronymfile "/usr/share/misc/acronyms" +game_ask wump "File for wump info" wump_infofile "$sharedir/wump.info" + +# Generate simplistic substitution script. +# This does not allow escaped @s in the substituted file, will fail on +# newline or % in filenames, etc.. The justification is that proper insertion +# of arbitrary 8-bit data in different files requires too much knowledge +# of escapes specific to the particular file type, so these things would +# probably fail anyway. +: >subst.sed +for var in $subst_vars; do + eval echo \""s%@$var@%\$$var%g"\" >> subst.sed +done + +substitute () { + for file in "$@"; do + dir="${file%%/*}" + if building_in $dir || [ "$file" = "$dir" ]; then + source_file="${file}.in" + case "$file" in + (quiz/datfiles/index) + # Can't put a comment in this file + subst_type=n + ;; + (Makeconfig) + subst_type=h + ;; + (*.[1-9]) + subst_type=m + ;; + (*.[ch]) + subst_type=c + ;; + (*) + subst_type=s + ;; + esac + if [ "$rules_only" = y ]; then + ./substscr r "$subst_type" "$source_file" "$file" + else + ./substscr gr "$subst_type" "$source_file" "$file" + fi + fi + done +} + +: >subst.rules + +rules_only=n +subst_files="`sed '/^#/d' GNUmakefile <>GNUmakefile <>GNUmakefile <exec.libs.tmp +while read prog libs; do + if ! building_in ${prog%%/*}; then + continue + fi + exec=$(prog_to_exec $prog) + evar=$(slashdot_to_under $exec)_libs + eval $evar=\"\$libs\" +done exec.objs.tmp +while read prog objs; do + if ! building_in ${prog%%/*}; then + continue + fi + exec=$(prog_to_exec $prog) + evar=$(slashdot_to_under $exec)_libs + eval libs=\"\$$evar\" + dir=$(dirname $exec) + udir=$(slashdot_to_under $dir) + nobjs= + deps_to_inc= + eval clean_$udir=\"\$clean_$udir $(basename $exec)\" + for obj in $objs; do + if [ "x$(dirname $obj)" = x. ]; then + obj=$dir/$obj + fi + nobjs="$nobjs $obj" + obj_dep_var=$(slashdot_to_under $obj) + obj_dep_var=${obj_dep_var}_deps_included + eval obj_dep_val=\$$obj_dep_var + if [ "x$obj_dep_val" = "x" ]; then + deps_to_inc="$deps_to_inc ${obj%%.o}.d" + eval $obj_dep_var=y + fi + done + if [ $dir = dab ]; then + ccvar=CXX + else + ccvar=CC + fi + cat >>GNUmakefile <>GNUmakefile <>GNUmakefile <&2; exit 1 + +# GNU targets that can do nothing +.PHONY: info dvi +info dvi: + @echo "This package comes with no Texinfo documentation." + +EOF diff --git a/exec.libs b/exec.libs new file mode 100644 index 0000000..a091425 --- /dev/null +++ b/exec.libs @@ -0,0 +1,57 @@ +# exec.libs - details of libraries needed to link bsd-games programs. +# This file is used for automatic makefile generation. +# +# Copyright (c) 1998, 1999, 2000, 2003, 2004 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +atc -lm $(NCURSES_LIB) $(LEX_LIB) +backgammon/backgammon/backgammon $(NCURSES_LIB) +backgammon/teachgammon/teachgammon $(NCURSES_LIB) +battlestar $(NCURSES_LIB) +boggle/boggle/boggle $(NCURSES_LIB) +caesar -lm +canfield/canfield/canfield $(NCURSES_LIB) +cribbage $(NCURSES_LIB) +dab $(NCURSES_LIB) +factor $(OPENSSL_LIB) +gomoku $(NCURSES_LIB) +hack $(NCURSES_LIB) +hangman $(NCURSES_LIB) +hunt/hunt/hunt $(NCURSES_LIB) +mille $(NCURSES_LIB) +phantasia -lm $(NCURSES_LIB) +phantasia/setup -lm +pom -lm +primes -lm +rain $(NCURSES_LIB) +robots $(NCURSES_LIB) +rogue $(NCURSES_LIB) +sail $(NCURSES_LIB) +snake/snake/snake $(NCURSES_LIB) -lm +tetris $(NCURSES_LIB) +trek -lm +worm $(NCURSES_LIB) +worms $(NCURSES_LIB) diff --git a/exec.objs b/exec.objs new file mode 100644 index 0000000..f081d60 --- /dev/null +++ b/exec.objs @@ -0,0 +1,129 @@ +# exec.objs - details of objects that go into bsd-games programs. +# This file is used for automatic makefile generation. +# +# Copyright (c) 1998, 1999, 2000, 2001, 2003, 2004, 2005 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +adventure crc.o data.o done.o init.o io.o main.o save.o subr.o \ + vocab.o wizard.o +adventure/setup setup.o +arithmetic arithmetic.o lib/getprogname.o +atc extern.o grammar.o graphics.o input.o lex.o list.o \ + log.o main.o tunable.o update.o lib/strlcpy.o +backgammon/backgammon/backgammon extra.o main.o move.o text.o \ + version.o backgammon/common_source/allow.o \ + backgammon/common_source/board.o backgammon/common_source/check.o \ + backgammon/common_source/fancy.o backgammon/common_source/init.o \ + backgammon/common_source/odds.o backgammon/common_source/one.o \ + backgammon/common_source/save.o backgammon/common_source/subs.o \ + backgammon/common_source/table.o +backgammon/teachgammon/teachgammon data.o teach.o ttext1.o ttext2.o \ + tutor.o backgammon/common_source/allow.o \ + backgammon/common_source/board.o backgammon/common_source/check.o \ + backgammon/common_source/fancy.o backgammon/common_source/init.o \ + backgammon/common_source/one.o backgammon/common_source/save.o \ + backgammon/common_source/subs.o backgammon/common_source/table.o +banner banner.o +battlestar battlestar.o command1.o command2.o command3.o \ + command4.o command5.o command6.o command7.o cypher.o dayfile.o \ + dayobjs.o fly.o getcom.o globals.o init.o misc.o nightfile.o \ + nightobjs.o parse.o room.o save.o words.o lib/fgetln.o +bcd bcd.o +boggle/boggle/boggle bog.o help.o mach.o prtable.o timer.o word.o +boggle/mkdict/mkdict mkdict.o +boggle/mkindex/mkindex mkindex.o +caesar caesar.o +canfield/canfield/canfield canfield.o +canfield/cfscores/cfscores cfscores.o +cribbage cards.o crib.o extern.o instr.o io.o score.o support.o +dab algor.o board.o box.o gamescreen.o human.o main.o \ + player.o random.o ttyscrn.o +dm dm.o utmpentry.o lib/getloadavg.o +factor factor.o primes/pr_tbl.o +fish fish.o +fortune/fortune/fortune fortune.o lib/getprogname.o +fortune/strfile/strfile strfile.o +fortune/unstr/unstr unstr.o +gomoku bdinit.o bdisp.o main.o makemove.o pickmove.o stoc.o +hack alloc.o hack.Decl.o hack.apply.o hack.bones.o hack.o \ + hack.cmd.o hack.do.o hack.do_name.o hack.do_wear.o hack.dog.o \ + hack.eat.o hack.end.o hack.engrave.o hack.fight.o hack.invent.o \ + hack.ioctl.o hack.lev.o hack.main.o hack.makemon.o hack.mhitu.o \ + hack.mklev.o hack.mkmaze.o hack.mkobj.o hack.mkshop.o hack.mon.o \ + hack.monst.o hack.o_init.o hack.objnam.o hack.options.o hack.pager.o \ + hack.potion.o hack.pri.o hack.read.o hack.rip.o hack.rumors.o \ + hack.save.o hack.search.o hack.shk.o hack.shknam.o hack.steal.o \ + hack.termcap.o hack.timeout.o hack.topl.o hack.track.o hack.trap.o \ + hack.tty.o hack.u_init.o hack.unix.o hack.vault.o hack.version.o \ + hack.wield.o hack.wizard.o hack.worm.o hack.worn.o hack.zap.o rnd.o +hack/makedefs makedefs.o +hangman endgame.o extern.o getguess.o getword.o main.o \ + playgame.o prdata.o prman.o prword.o setup.o +hunt/hunt/hunt connect.o hunt.o otto.o playit.o \ + hunt/huntd/pathname.o +hunt/huntd/huntd answer.o ctl.o ctl_transact.o draw.o driver.o \ + execute.o expl.o extern.o faketalk.o get_names.o makemaze.o \ + pathname.o shots.o terminal.o +mille comp.o end.o extern.o init.o mille.o misc.o move.o \ + print.o roll.o save.o types.o varpush.o +monop cards.o execute.o getinp.o houses.o jail.o misc.o \ + monop.o morg.o print.o prop.o rent.o roll.o spec.o trade.o +monop/initdeck initdeck.o +morse morse.o +number number.o +phantasia fight.o gamesupport.o interplayer.o io.o main.o \ + misc.o phantglobs.o +phantasia/setup phantglobs.o setup.o +pig pig.o +pom pom.o +ppt ppt.o +primes pattern.o pr_tbl.o primes.o +quiz quiz.o rxp.o lib/fgetln.o +rain rain.o lib/getprogname.o +random random.o +robots auto.o extern.o flush_in.o init_field.o main.o \ + make_level.o move.o move_robs.o play_level.o query.o rnd_pos.o score.o +rogue hit.o init.o inventory.o level.o machdep.o main.o \ + message.o monster.o move.o object.o pack.o play.o random.o ring.o \ + room.o save.o score.o spec_hit.o throw.o trap.o use.o zap.o \ + lib/strlcpy.o +sail assorted.o game.o globals.o dr_1.o dr_2.o dr_3.o \ + dr_4.o dr_5.o dr_main.o lo_main.o main.o misc.o parties.o pl_1.o \ + pl_2.o pl_3.o pl_4.o pl_5.o pl_6.o pl_7.o pl_main.o sync.o version.o \ + lib/strlcpy.o +snake/snake/snake snake.o +snake/snscore/snscore snscore.o +tetris input.o scores.o screen.o shapes.o tetris.o +trek abandon.o attack.o autover.o capture.o cgetc.o \ + check_out.o checkcond.o compkl.o computer.o damage.o damaged.o \ + dcrept.o destruct.o dock.o dumpgame.o dumpme.o dumpssradio.o events.o \ + externs.o getcodi.o getpar.o help.o impulse.o initquad.o kill.o \ + klmove.o lose.o lrscan.o main.o move.o nova.o out.o phaser.o play.o \ + ram.o ranf.o rest.o schedule.o score.o setup.o setwarp.o shield.o \ + snova.o srscan.o systemname.o torped.o visual.o warp.o win.o +worm worm.o +worms worms.o +wump wump.o diff --git a/hide-game.in b/hide-game.in new file mode 100755 index 0000000..b65193c --- /dev/null +++ b/hide-game.in @@ -0,0 +1,33 @@ +# hide-game.in - hide a game (only used if appropriate). +# +# Copyright (c) 1997, 1998 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +set -e + +test -d @install_prefix@@libexecdir@ || @install_dmdir@ @install_prefix@@libexecdir@ +mv -f @install_prefix@@gamesdir@/$1 @install_prefix@@libexecdir@ +ln -s dm @install_prefix@@gamesdir@/$1 diff --git a/include/signal.h b/include/signal.h new file mode 100644 index 0000000..ea2e940 --- /dev/null +++ b/include/signal.h @@ -0,0 +1,47 @@ +/* signal.h - bsd-games wrapper for . + * + * Copyright (c) 1997, 1998, 2000, 2004 Joseph Samuel Myers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +#pragma GCC system_header +#endif + +#include + +#ifndef __GLIBC__ +#define __USE_BSD_SIGNAL 1 /* Get BSD signal semantics with libc5 */ +#endif + +#include_next + +#ifndef HAVE_sig_t +#ifndef LINUX_BSD_GAMES_DEFINED_SIG_T +typedef void (*sig_t)(int); +#define LINUX_BSD_GAMES_DEFINED_SIG_T 1 +#endif +#endif diff --git a/include/stdio.h b/include/stdio.h new file mode 100644 index 0000000..32a4b71 --- /dev/null +++ b/include/stdio.h @@ -0,0 +1,39 @@ +/* stdio.h - bsd-games wrapper for . + * + * Copyright (c) 1998, 1999, 2000 Joseph Samuel Myers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +#pragma GCC system_header +#endif + +#include +#include_next + +#ifndef HAVE_fgetln +extern char *fgetln(FILE *stream, size_t *len); +#endif diff --git a/include/stdlib.h b/include/stdlib.h new file mode 100644 index 0000000..4836e53 --- /dev/null +++ b/include/stdlib.h @@ -0,0 +1,43 @@ +/* stdlib.h - bsd-games wrapper for . + * + * Copyright (c) 1998, 1999, 2000, 2004 Joseph Samuel Myers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +#pragma GCC system_header +#endif + +#include +#include_next + +#ifndef HAVE_getloadavg +extern int getloadavg(double loadavg[], int nelem); +#endif + +#ifndef HAVE_getprogname +extern const char *getprogname(void); +#endif diff --git a/include/string.h b/include/string.h new file mode 100644 index 0000000..6842080 --- /dev/null +++ b/include/string.h @@ -0,0 +1,39 @@ +/* string.h - bsd-games wrapper for . + * + * Copyright (c) 2003 Joseph Samuel Myers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +#pragma GCC system_header +#endif + +#include +#include_next + +#ifndef HAVE_strlcpy +extern size_t strlcpy(char *dst, const char *src, size_t siz); +#endif diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h new file mode 100644 index 0000000..138eaa8 --- /dev/null +++ b/include/sys/cdefs.h @@ -0,0 +1,42 @@ +/* cdefs.h - bsd-games wrapper for . + * + * Copyright (c) 1997, 1998, 1999, 2000 Joseph Samuel Myers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +#pragma GCC system_header +#endif + +#include_next + +#ifndef __RCSID +#define __RCSID(arg) static const char rcsid[] __attribute__((__unused__)) = arg +#endif + +#ifndef __COPYRIGHT +#define __COPYRIGHT(arg) static const char copyright[] __attribute__((__unused__)) = arg +#endif diff --git a/include/sys/endian.h b/include/sys/endian.h new file mode 100644 index 0000000..1898a52 --- /dev/null +++ b/include/sys/endian.h @@ -0,0 +1,120 @@ +/* sys/endian.h - bsd-games compatibility with NetBSD (not + * a complete emulation). + * + * Copyright (c) 1999 Joseph Samuel Myers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include + +#if __BYTE_ORDER == __BIG_ENDIAN +#ifndef be16toh +#define be16toh(x) ((u_int16_t)(x)) +#endif +#ifndef htobe16 +#define htobe16(x) ((u_int16_t)(x)) +#endif +#ifndef be32toh +#define be32toh(x) ((u_int32_t)(x)) +#endif +#ifndef htobe32 +#define htobe32(x) ((u_int32_t)(x)) +#endif +#ifndef be64toh +#define be64toh(x) ((u_int64_t)(x)) +#endif +#ifndef htobe64 +#define htobe64(x) ((u_int64_t)(x)) +#endif +#ifndef BE16TOH +#define BE16TOH(x) ((void)0) +#endif +#ifndef HTOBE16 +#define HTOBE16(x) ((void)0) +#endif +#ifndef BE32TOH +#define BE32TOH(x) ((void)0) +#endif +#ifndef HTOBE32 +#define HTOBE32(x) ((void)0) +#endif +#ifndef BE64TOH +#define BE64TOH(x) ((void)0) +#endif +#ifndef HTOBE64 +#define HTOBE64(x) ((void)0) +#endif +#else /* little-endian */ +#ifndef be16toh +#define be16toh(x) ((u_int16_t)ntohs((u_int16_t)(x))) +#endif +#ifndef htobe16 +#define htobe16(x) ((u_int16_t)htons((u_int16_t)(x))) +#endif +#ifndef be32toh +#define be32toh(x) ((u_int32_t)ntohl((u_int32_t)(x))) +#endif +#ifndef htobe32 +#define htobe32(x) ((u_int32_t)htonl((u_int32_t)(x))) +#endif +#ifndef be64toh +#ifdef __bswap_64 /* glibc */ +#define be64toh(x) ((u_int64_t)__bswap_64((u_int64_t)(x))) +#else /* no __bswap_64 */ +#ifdef __swab64 /* Linux kernel headers (libc5, at least with kernel 2.2) */ +#define be64toh(x) ((u_int64_t)__swab64((u_int64_t)(x))) +#else /* no __bswap_64 or __swab64 */ +static __inline__ u_int64_t be64toh(u_int64_t __x); +static __inline__ u_int64_t be64toh(u_int64_t __x) { return (((u_int64_t)be32toh(__x & (u_int64_t)0xFFFFFFFFULL)) << 32) | ((u_int64_t)be32toh((__x & (u_int64_t)0xFFFFFFFF00000000ULL) >> 32)); } +#define be64toh(x) be64toh((x)) +#endif /* no __bswap_64 or __swab64 */ +#endif /* no __bswap_64 */ +#endif /* no be64toh */ +#ifndef htobe64 +#define htobe64(x) be64toh(x) +#endif +#ifndef BE16TOH +#define BE16TOH(x) ((x) = be16toh((x))) +#endif +#ifndef HTOBE16 +#define HTOBE16(x) ((x) = htobe16((x))) +#endif +#ifndef BE32TOH +#define BE32TOH(x) ((x) = be32toh((x))) +#endif +#ifndef HTOBE32 +#define HTOBE32(x) ((x) = htobe32((x))) +#endif +#ifndef BE64TOH +#define BE64TOH(x) ((x) = be64toh((x))) +#endif +#ifndef HTOBE64 +#define HTOBE64(x) ((x) = htobe64((x))) +#endif +#endif /* little-endian */ diff --git a/include/sys/poll.h b/include/sys/poll.h new file mode 100644 index 0000000..567dfe2 --- /dev/null +++ b/include/sys/poll.h @@ -0,0 +1,38 @@ +/* poll.h - bsd-games wrapper for . + * + * Copyright (c) 2003 Joseph Samuel Myers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +#pragma GCC system_header +#endif + +#include_next + +#ifndef INFTIM +#define INFTIM -1 +#endif diff --git a/include/sys/ttydefaults.h b/include/sys/ttydefaults.h new file mode 100644 index 0000000..1966aa7 --- /dev/null +++ b/include/sys/ttydefaults.h @@ -0,0 +1,46 @@ +/* ttydefaults.h - bsd-games wrapper for . + * + * Copyright (c) 1997, 1998, 2000 Joseph Samuel Myers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +#pragma GCC system_header +#endif + +#include + +#ifdef __GLIBC__ +#include_next +#endif + +#ifndef CTRL +#define CTRL(x) ((x) & 037) +#endif + +#ifndef OXTABS +#define OXTABS XTABS +#endif diff --git a/include/termios.h b/include/termios.h new file mode 100644 index 0000000..80d5514 --- /dev/null +++ b/include/termios.h @@ -0,0 +1,36 @@ +/* termios.h - bsd-games wrapper for . + * + * Copyright (c) 1998, 2000 Joseph Samuel Myers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +#pragma GCC system_header +#endif + +#include_next + +#include diff --git a/install-man.in b/install-man.in new file mode 100755 index 0000000..4f34228 --- /dev/null +++ b/install-man.in @@ -0,0 +1,92 @@ +# install-man.in - install a manpage. +# +# Copyright (c) 1997, 1998 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +set -e + +if [ $# = 1 ]; then + page=$1 + basepage=$(basename "$page") + section=${basepage##*.} + if [ "$section" = 6 ]; then + mandir=@install_prefix@@man6dir@ + elif [ "$section" = 8 ]; then + mandir=@install_prefix@@man8dir@ + elif [ "$section" = 5 ]; then + mandir=@install_prefix@@man5dir@ + else + echo "Unknown manpage section $section" >&2 + exit 1 + fi + @install_manpage@ "$page" "$mandir/$basepage" + if [ @gzip_manpages@ = y ]; then + rm -f "$mandir/$basepage.gz" + gzip -9 "$mandir/$basepage" + fi +elif [ $# = 2 ]; then + # Manpage 2 should link to manpage 1. No complications of removing + # directories from their names. + page1=$1 + section1=${page1##*.} + page2=$2 + section2=${page2##*.} + if [ "$section2" = 6 ]; then + mandir=@install_prefix@@man6dir@ + elif [ "$section2" = 8 ]; then + mandir=@install_prefix@@man8dir@ + elif [ "$section2" = 5 ]; then + mandir=@install_prefix@@man5dir@ + else + echo "Unknown manpage section $section2" >&2 + exit 1 + fi + if [ @use_dot_so@ = .so ]; then + echo ".so man$section1/$page1" >"$mandir/$page2" + chmod @manpage_perms@ "$mandir/$page2" + if [ @do_chown@ = y ]; then + chown @manpage_owner@:@manpage_group@ "$mandir/$page2" + fi + if [ @gzip_manpages@ = y ]; then + rm -f "$mandir/$page2.gz" + gzip -9 "$mandir/$page2" + fi + else + if [ "$section1" = "$section2" ]; then + linkto="$page1" + else + linkto="../man$section1/$page1" + fi + if [ @gzip_manpages@ = y ]; then + ln -sf "$linkto.gz" "$mandir/$page2.gz" + else + ln -sf "$linkto" "$mandir/$page2" + fi + fi +else + echo "usage: $0 manpage [ manpage ]" >&2 + exit 1 +fi diff --git a/install-score.in b/install-score.in new file mode 100755 index 0000000..e3fd67e --- /dev/null +++ b/install-score.in @@ -0,0 +1,45 @@ +# install-score.in - install a score file +# +# Copyright (c) 1997, 1998, 1999 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +set -e + +if [ "$1" = "-p" ]; then + scorefile="@install_prefix@$2" + perms=@vardata_perms_priv@ +else + scorefile="@install_prefix@$1" + perms=@vardata_perms@ +fi + +mkdir -p "$(dirname "$scorefile")" + +test -e "$scorefile" || touch "$scorefile" +if [ @do_chown@ = y ]; then + chown @vardata_owner@:@vardata_group@ "$scorefile" +fi +chmod "$perms" "$scorefile" diff --git a/lib/Makefrag b/lib/Makefrag new file mode 100644 index 0000000..94731b8 --- /dev/null +++ b/lib/Makefrag @@ -0,0 +1,33 @@ +# Makefrag - makefile fragment for lib +# +# Copyright (c) 1998 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +# No special rules needed, but we need these dummy targets + +lib_all: + +lib_install: diff --git a/lib/fgetln.c b/lib/fgetln.c new file mode 100644 index 0000000..d05c416 --- /dev/null +++ b/lib/fgetln.c @@ -0,0 +1,66 @@ +/* lib/fgetln.c - bsd-games implementation of fgetln. + * + * Copyright (c) 1997, 1998, 1999, 2000, 2004 Joseph Samuel Myers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +#ifndef HAVE_fgetln +char * +fgetln(FILE *stream, size_t *len) +{ + static char *buf = NULL; + static size_t buflen = 0; + char *res; + char *nbuf; + if (buf == NULL) { + buf = (char *)malloc(buflen = 1024); + if (buf == NULL) { + return NULL; + } + } + buf[buflen - 1] = 1; + res = fgets(buf, buflen, stream); + if (res == NULL) + return NULL; + while (buf[buflen - 1] == 0 && buf[buflen - 2] != '\n') { /* long line */ + nbuf = realloc(buf, buflen * 2); + if (nbuf == NULL) + return NULL; + buf = nbuf; + buflen *= 2; + buf[buflen - 1] = 1; + res = fgets(buf + buflen/2 - 1, buflen/2 + 1, stream); + if (res == NULL) + return NULL; + } + *len = strlen(buf); + return buf; +} +#endif /* !defined(HAVE_fgetln) */ diff --git a/lib/getloadavg.c b/lib/getloadavg.c new file mode 100644 index 0000000..fa76b1a --- /dev/null +++ b/lib/getloadavg.c @@ -0,0 +1,55 @@ +/* lib/getloadavg.c - bsd-games implementation of getloadavg. + * + * Copyright (c) 1998, 1999 Joseph Samuel Myers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +#ifndef HAVE_getloadavg +int +getloadavg(double loadavg[], int nelem) +{ + double load_averages[3]; + FILE *fp; + int count; + int i; + int nc; + fp = fopen("/proc/loadavg", "r"); + if (fp == NULL) + return -1; + count = fscanf(fp, "%lf%lf%lf", &(load_averages[0]), &(load_averages[1]), + &(load_averages[2])); + fclose(fp); + if ((count == EOF) || (count == 0)) + return -1; + nc = ((nelem < count) ? nelem : count); + for (i = 0; i < nc; i++) + loadavg[i] = load_averages[i]; + return nc; +} +#endif diff --git a/lib/getprogname.c b/lib/getprogname.c new file mode 100644 index 0000000..61e3dc6 --- /dev/null +++ b/lib/getprogname.c @@ -0,0 +1,40 @@ +/* lib/getprogname.c - bsd-games implementation of getprogname. + * + * Copyright (c) 2004 Joseph Samuel Myers. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#ifndef HAVE_getprogname +extern char *__progname; + +const char * +getprogname(void) +{ + return __progname; +} +#endif /* !defined(HAVE_getprogname) */ diff --git a/lib/strlcpy.c b/lib/strlcpy.c new file mode 100644 index 0000000..0d293cc --- /dev/null +++ b/lib/strlcpy.c @@ -0,0 +1,70 @@ +/* $OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $ */ + +/* + * Copyright (c) 1998 Todd C. Miller + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char *rcsid = "$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include + +#ifndef HAVE_strlcpy +/* + * Copy src to string dst of size siz. At most siz-1 characters + * will be copied. Always NUL terminates (unless siz == 0). + * Returns strlen(src); if retval >= siz, truncation occurred. + */ +size_t strlcpy(dst, src, siz) + char *dst; + const char *src; + size_t siz; +{ + register char *d = dst; + register const char *s = src; + register size_t n = siz; + + /* Copy as many bytes as will fit */ + if (n != 0 && --n != 0) { + do { + if ((*d++ = *s++) == 0) + break; + } while (--n != 0); + } + + /* Not enough room in dst, add NUL and traverse rest of src */ + if (n == 0) { + if (siz != 0) + *d = '\0'; /* NUL-terminate dst */ + while (*s++) + ; + } + + return(s - src - 1); /* count does not include NUL */ +} +#endif diff --git a/mkdep b/mkdep new file mode 100755 index 0000000..88b2e81 --- /dev/null +++ b/mkdep @@ -0,0 +1,47 @@ +#!/bin/sh +# mkdep - create dependencies. +# +# Copyright (c) 1998, 2001 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +# usage: mkdep source output compiler flags +# e.g. mkdep foo/bar.c foo/bar.d gcc -g -O2 -DFOOBAR + +set -e + +source_file=$1 +base_name=${source_file%%.c} +base_base_name=`basename $base_name` +output_file=$2 +compiler=$3 +shift 3 + +"$compiler" -M "$@" "$source_file" >"$output_file".tmp + +sed "s!^$base_base_name.o *:!$base_name.o :!g +s!$base_name.o *:!$base_name.o $base_name.d:!g" <"$output_file".tmp >"$output_file" + +rm -f "$output_file".tmp diff --git a/rogue/CHANGES b/rogue/CHANGES new file mode 100644 index 0000000..066ac12 --- /dev/null +++ b/rogue/CHANGES @@ -0,0 +1,55 @@ +$NetBSD: CHANGES,v 1.3 2000/03/13 22:53:22 soren Exp $ + +From: tektronix!zeus.TEK.COM!tims@ucbvax.Berkeley.EDU +Date: 30 Nov 87 15:08:15 PST (Mon) +To: okeeffe.Berkeley.EDU!mckusick@ucbvax.Berkeley.EDU (Kirk McKusick) +Subject: Re: Public domain rogue +Return-Path: tektronix!zeus.TEK.COM!tims@ucbvax.Berkeley.EDU + +Here is a list of discrepencies from the documentation you sent me: + +The -d option not implemented. +The -r option not implemented, use "rogue save_file" instead. +Strength is between 1 and 99, not 3 and 32. +The D command is not implemented. +Only scrolls,potions,wands,and rings may be "call"ed something. +The ^P command may be used to go 4 messages back, instead of just 1. +The @ comand is not implemented. +There are no dark rooms. +ROGUEOPTS of flush,terse,seefloor,askme,inventory are ignored. + 'askquit' is added to prevent ^\ from terminating the game accidentally. + If 'noaskquit' is + found in the ROGUEOPTS string, the ^\ kills the game, otherwise, + the player is asked if he really wants to quit. In either case, no + score file processing is attempted. +The score is keyed to winning scores, and no player may appear twice. + + + + + + +Other differences from "standard" rogue 5.3. This list covers externally +visible differences only. + +There should be NO bugs with any severe consequences. Absolutely NO + game-stopping, or game-winning bugs should be present. +Traps fail occasionally, that is, they sometimes are sprung but miss. +The ^A command prints out some stuff you're probably not interested in. +The '&' command silently saves your screen into the file 'rogue.screen' +Any inventory selection command that takes '*' as a request to list all + appropriate items, can take one of "=?:)]!/" to list only rings, + scrolls, or whatever. +Scrolls and potions, once used, become identified. All other objects become + identified only by scroll of identification. +There is only one scroll of identification, and it works on any item. +ROGUEOPTS + Only the following are implemented: + file,jump,name,askquit,tombstone,passgo + "askquit" is used to prevent accidental termination of the game via ^\ +You may drop objects in doorways. +Prints a picture of a skull, not a tombstone, upon death. +The save/restore game function is faster and machine-independent, but sometimes + requires modification when new variables are added to the source. +The potion of detect monster lasts for the whole level. +Their is no wand of light. diff --git a/rogue/Makefile.bsd b/rogue/Makefile.bsd new file mode 100644 index 0000000..e24c1d5 --- /dev/null +++ b/rogue/Makefile.bsd @@ -0,0 +1,21 @@ +# $NetBSD: Makefile,v 1.16 2004/01/01 16:05:12 jsm Exp $ +# @(#)Makefile 8.1 (Berkeley) 5/31/93 + +PROG= rogue +CPPFLAGS+=-DUNIX +SRCS= hit.c init.c inventory.c level.c machdep.c main.c \ + message.c monster.c move.c object.c pack.c play.c random.c ring.c \ + room.c save.c score.c spec_hit.c throw.c trap.c use.c zap.c +DPADD= ${LIBCURSES} +LDADD= -lcurses +HIDEGAME=hidegame +SETGIDGAME=yes +MAN= rogue.6 +WARNS= 2 + +.if make(install) +SUBDIR+=USD.doc +.endif + +.include +.include diff --git a/rogue/Makefrag b/rogue/Makefrag new file mode 100644 index 0000000..56e22ad --- /dev/null +++ b/rogue/Makefrag @@ -0,0 +1,39 @@ +# Makefrag - makefile fragment for rogue +# +# Copyright (c) 1997, 1998, 2003, 2004 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +rogue_DEFS := $(STRLCPY_DEFS) -DUNIX -DUNIX_SYSV +rogue_DIRS := $(GAMESDIR) $(MAN6DIR) $(DOCDIR) + +rogue_all: rogue/rogue rogue/rogue.6 rogue/USD.doc/rogue.me + +rogue_install: rogue_all + $(INSTALL_SCORE_GAME) rogue/rogue $(INSTALL_PREFIX)$(GAMESDIR)/rogue + $(HIDE_GAME) rogue + $(INSTALL_SCORE_FILE) $(ROGUE_SCOREFILE) + $(INSTALL_MANUAL) rogue/rogue.6 + $(INSTALL_DATA) rogue/USD.doc/rogue.me $(INSTALL_PREFIX)$(DOCDIR)/rogue.me diff --git a/rogue/USD.doc/Makefile.bsd b/rogue/USD.doc/Makefile.bsd new file mode 100644 index 0000000..9a8ef89 --- /dev/null +++ b/rogue/USD.doc/Makefile.bsd @@ -0,0 +1,11 @@ +# $NetBSD: Makefile,v 1.4 2003/07/10 10:34:19 lukem Exp $ +# @(#)Makefile 8.1 (Berkeley) 6/8/93 + +DIR= usd/30.rogue +SRCS= rogue.me +MACROS= -me + +paper.${PRINTER}: ${SRCS} + ${TOOL_TBL} ${SRCS} | ${TOOL_ROFF_PS} ${MACROS} > ${.TARGET} + +.include diff --git a/rogue/USD.doc/rogue.me b/rogue/USD.doc/rogue.me new file mode 100644 index 0000000..b1592dd --- /dev/null +++ b/rogue/USD.doc/rogue.me @@ -0,0 +1,834 @@ +.\" $NetBSD: rogue.me,v 1.6 2004/02/13 11:36:08 wiz Exp $ +.\" +.\" Copyright (c) 1986, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)rogue.me 8.2 (Berkeley) 6/1/94 +.\" +.ds E \s-2\s0 +.ds R \s-2\s0 +.ds U \s-2UNIX\s0 +.ie t .ds _ \d\(mi\u +.el .ds _ _ +.de Cs +\&\\$3\*(lq\\$1\*(rq\\$2 +.. +.sp 5 +.ce 1000 +.ps +4 +.vs +4p +.b +A Guide to the Dungeons of Doom +.r +.vs +.ps +.sp 2 +.i +Michael C. Toy +Kenneth C. R. C. Arnold +.r +.sp 2 +Computer Systems Research Group +Department of Electrical Engineering and Computer Science +University of California +Berkeley, California 94720 +.sp 4 +.i ABSTRACT +.ce 0 +.(b I F +.bi Rogue +is a visual CRT based fantasy game +which runs under the \*U\(dg timesharing system. +.(f +\fR\(dg\*U is a trademark of Bell Laboratories\fP +.)f +This paper describes how to play rogue, +and gives a few hints +for those who might otherwise get lost in the Dungeons of Doom. +.)b +\".he '''\fBA Guide to the Dungeons of Doom\fP' +\" .fo ''- % -'' +.eh 'USD:30-%''A Guide to the Dungeons of Doom' +.oh 'A Guide to the Dungeons of Doom''USD:30-%' +.sh 1 Introduction +.pp +You have just finished your years as a student at the local fighter's guild. +After much practice and sweat you have finally completed your training +and are ready to embark upon a perilous adventure. +As a test of your skills, +the local guildmasters have sent you into the Dungeons of Doom. +Your task is to return with the Amulet of Yendor. +Your reward for the completion of this task +will be a full membership in the local guild. +In addition, +you are allowed to keep all the loot you bring back from the dungeons. +.pp +In preparation for your journey, +you are given an enchanted mace, +a bow, and a quiver of arrows +taken from a dragon's hoard in the far off Dark Mountains. +You are also outfitted with elf-crafted armor +and given enough food to reach the dungeons. +You say goodbye to family and friends for what may be the last time +and head up the road. +.pp +You set out on your way to the dungeons +and after several days of uneventful travel, +you see the ancient ruins +that mark the entrance to the Dungeons of Doom. +It is late at night, +so you make camp at the entrance +and spend the night sleeping under the open skies. +In the morning you gather your weapons, +put on your armor, +eat what is almost your last food, +and enter the dungeons. +.sh 1 "What is going on here?" +.pp +You have just begun a game of rogue. +Your goal is to grab as much treasure as you can, +find the Amulet of Yendor, +and get out of the Dungeons of Doom alive. +On the screen, +a map of where you have been +and what you have seen on the current dungeon level is kept. +As you explore more of the level, +it appears on the screen in front of you. +.pp +Rogue differs from most computer fantasy games in that it is screen oriented. +Commands are all one or two keystrokes\** +.(f +\** As opposed to pseudo English sentences. +.)f +and the results of your commands +are displayed graphically on the screen rather +than being explained in words.\** +.(f +\** A minimum screen size of 24 lines by 80 columns is required. +If the screen is larger, only the 24x80 section will be used +for the map. +.)f +.pp +Another major difference between rogue and other computer fantasy games +is that once you have solved all the puzzles in a standard fantasy game, +it has lost most of its excitement and it ceases to be fun. +Rogue, +on the other hand, +generates a new dungeon every time you play it +and even the author finds it an entertaining and exciting game. +.sh 1 "What do all those things on the screen mean?" +.pp +In order to understand what is going on in rogue +you have to first get some grasp of what rogue is doing with the screen. +The rogue screen is intended +to replace the \*(lqYou can see ...\*(rq descriptions +of standard fantasy games. +Figure 1 is a sample of what a rogue screen might look like. +.(z +.hl +.nf +.TS +center; +ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce0 ce. +- - - - - - - - - - - - +| . . . . . . . . . . + +| . . @ . . . . ] . . | +| . . . . B . . . . . | +| . . . . . . . . . . | +- - - - - + - - - - - - +.TE + + +.ce 1000 +Level: 1 Gold: 0 Hp: 12(12) Str: 16(16) Arm: 4 Exp: 1/0 + +Figure 1 +.ce +.hl +.)z +.sh 2 "The bottom line" +.pp +At the bottom line of the screen +are a few pieces of cryptic information +describing your current status. +Here is an explanation of what these things mean: +.ip Level \w'Level\ \ 'u +This number indicates how deep you have gone in the dungeon. +It starts at one and goes up as you go deeper into the dungeon. +.ip Gold \w'Level\ \ 'u +The number of gold pieces you have managed to find +and keep with you so far. +.ip Hp \w'Level\ \ 'u +Your current and maximum health points. +Health points indicate how much damage you can take before you die. +The more you get hit in a fight, +the lower they get. +You can regain health points by resting. +The number in parentheses +is the maximum number your health points can reach. +.ip Str \w'Level\ \ 'u +Your current strength and maximum ever strength. +This can be any integer less than or equal to 99, +or greater than or equal to 1. +The higher the number, +the stronger you are. +The number in the parentheses +is the maximum strength you have attained so far this game. +.ip Arm \w'Level\ \ 'u +Your current armor protection. +This number indicates how effective your armor is +in stopping blows from unfriendly creatures. +The higher this number is, +the more effective the armor. +.ip Exp \w'Level\ \ 'u +These two numbers give your current experience level +and experience points. +As you do things, +you gain experience points. +At certain experience point totals, +you gain an experience level. +The more experienced you are, +the better you are able to fight and to withstand magical attacks. +.sh 2 "The top line" +.pp +The top line of the screen is reserved +for printing messages that describe things +that are impossible to represent visually. +If you see a \*(lq--More--\*(rq on the top line, +this means that rogue wants to print another message on the screen, +but it wants to make certain +that you have read the one that is there first. +To read the next message, +just type a space. +.sh 2 "The rest of the screen" +.pp +The rest of the screen is the map of the level +as you have explored it so far. +Each symbol on the screen represents something. +Here is a list of what the various symbols mean: +.ip @ +This symbol represents you, the adventurer. +.ip "-\^|" +These symbols represent the walls of rooms. +.ip + +A door to/from a room. +.ip . +The floor of a room. +.ip # +The floor of a passage between rooms. +.ip * +A pile or pot of gold. +.ip ) +A weapon of some sort. +.ip ] +A piece of armor. +.ip ! +A flask containing a magic potion. +.ip ? +A piece of paper, usually a magic scroll. +.ip = +A ring with magic properties +.ip / +A magical staff or wand +.ip ^ +A trap, watch out for these. +.ip % +A staircase to other levels +.ip : +A piece of food. +.ip A-Z +The uppercase letters +represent the various inhabitants of the Dungeons of Doom. +Watch out, they can be nasty and vicious. +.sh 1 Commands +.pp +Commands are given to rogue by typing one or two characters. +Most commands can be preceded by a count to repeat them +(e.g. typing +.Cs 10s +will do ten searches). +Commands for which counts make no sense +have the count ignored. +To cancel a count or a prefix, +type \*E. +The list of commands is rather long, +but it can be read at any time during the game with the +.Cs ? +command. +Here it is for reference, +with a short explanation of each command. +.ip ? +The help command. +Asks for a character to give help on. +If you type a +.Cs * , +it will list all the commands, +otherwise it will explain what the character you typed does. +.ip / +This is the \*(lqWhat is that on the screen?\*(rq command. +A +.Cs / +followed by any character that you see on the level, +will tell you what that character is. +For instance, +typing +.Cs /@ +will tell you that the +.Cs @ +symbol represents you, the player. +.ip "h, H, ^H" +Move left. +You move one space to the left. +If you use upper case +.Cs h , +you will continue to move left until you run into something. +This works for all movement commands +(e.g. +.Cs L +means run in direction +.Cs l ) +If you use the \*(lqcontrol\*(rq +.Cs h , +you will continue moving in the specified direction +until you pass something interesting or run into a wall. +You should experiment with this, +since it is a very useful command, +but very difficult to describe. +This also works for all movement commands. +.ip j +Move down. +.ip k +Move up. +.ip l +Move right. +.ip y +Move diagonally up and left. +.ip u +Move diagonally up and right. +.ip b +Move diagonally down and left. +.ip n +Move diagonally down and right. +.ip t +Throw an object. +This is a prefix command. +When followed with a direction +it throws an object in the specified direction. +(e.g. type +.Cs th +to throw +something to the left.) +.ip f +Fight until someone dies. +When followed with a direction +this will force you to fight the creature in that direction +until either you or it bites the big one. +.ip m +Move onto something without picking it up. +This will move you one space in the direction you specify and, +if there is an object there you can pick up, +it won't do it. +.ip z +Zap prefix. +Point a staff or wand in a given direction +and fire it. +Even non-directional staves must be pointed in some direction +to be used. +.ip ^ +Identify trap command. +If a trap is on your map +and you can't remember what type it is, +you can get rogue to remind you +by getting next to it and typing +.Cs ^ +followed by the direction that would move you on top of it. +.ip s +Search for traps and secret doors. +Examine each space immediately adjacent to you +for the existence of a trap or secret door. +There is a large chance that even if there is something there, +you won't find it, +so you might have to search a while before you find something. +.ip > +Climb down a staircase to the next level. +Not surprisingly, this can only be done if you are standing on staircase. +.ip < +Climb up a staircase to the level above. +This can't be done without the Amulet of Yendor in your possession. +.ip "." +Rest. +This is the \*(lqdo nothing\*(rq command. +This is good for waiting and healing. +.ip , +Pick up something. +This picks up whatever you are currently standing on, +if you are standing on anything at all. +.ip i +Inventory. +List what you are carrying in your pack. +.ip I +Selective inventory. +Tells you what a single item in your pack is. +.ip q +Quaff one of the potions you are carrying. +.ip r +Read one of the scrolls in your pack. +.ip e +Eat food from your pack. +.ip w +Wield a weapon. +Take a weapon out of your pack and carry it for use in combat, +replacing the one you are currently using (if any). +.ip W +Wear armor. +You can only wear one suit of armor at a time. +This takes extra time. +.ip T +Take armor off. +You can't remove armor that is cursed. +This takes extra time. +.ip P +Put on a ring. +You can wear only two rings at a time +(one on each hand). +If you aren't wearing any rings, +this command will ask you which hand you want to wear it on, +otherwise, it will place it on the unused hand. +The program assumes that you wield your sword in your right hand. +.ip R +Remove a ring. +If you are only wearing one ring, +this command takes it off. +If you are wearing two, +it will ask you which one you wish to remove, +.ip d +Drop an object. +Take something out of your pack and leave it lying on the floor. +Only one object can occupy each space. +You cannot drop a cursed object at all +if you are wielding or wearing it. +.ip c +Call an object something. +If you have a type of object in your pack +which you wish to remember something about, +you can use the call command to give a name to that type of object. +This is usually used when you figure out what a +potion, scroll, ring, or staff is +after you pick it up but before it is truly identified. Each type of +scroll and potion will become identified after its first use. +.ip o +Examine and set options. +This command is further explained in the section on options. +.ip ^R +Redraws the screen. +Useful if spurious messages or transmission errors +have messed up the display. +.ip ^P +Print last message. +Useful when a message disappears before you can read it. +Consecutive repetitions of this command will reveal the last +five messages. +.ip \*E +Cancel a command, prefix, or count. +.ip ! +Escape to a shell for some commands. +.ip Q +Quit. +Leave the game. +.ip S +Save the current game in a file. +It will ask you whether you wish to use the default save file. +.i Caveat : +Rogue won't let you start up a copy of a saved game, +and it removes the save file as soon as you start up a restored game. +This is to prevent people from saving a game just before a dangerous position +and then restarting it if they die. +To restore a saved game, +give the file name as an argument to rogue. +As in +.ti +1i +.nf +% rogue \fIsave\*_file\fP +.ip v +Prints the program version number. +.ip ) +Print the weapon you are currently wielding +.ip ] +Print the armor you are currently wearing +.ip = +Print the rings you are currently wearing +.sh 1 Rooms +.pp +Rooms in the dungeons are lit as you enter them. +Upon leaving a room, +all monsters inside the room are erased from the screen. +In the darkness of a corridor, you can only see one space +in all directions around you. +.sh 1 Fighting +.pp +If you see a monster and you wish to fight it, +just attempt to run into it. +Many times a monster you find will mind its own business +unless you attack it. +It is often the case that discretion is the better part of valor. +.sh 1 "Objects you can find" +.pp +When you find something in the dungeon, +it is common to want to pick the object up. +This is accomplished in rogue by walking over the object +(unless you use the +.Cs m +prefix, see above). +If you are carrying too many things, +the program will tell you and it won't pick up the object, +otherwise it will add it to your pack +and tell you what you just picked up. +.pp +Many of the commands that operate on objects must prompt you +to find out which object you want to use. +If you change your mind and don't want to do that command after all, +just type an \*E and the command will be aborted. +.pp +Some objects, like armor and weapons, +are easily differentiated. +Others, like scrolls and potions, +are given labels which vary according to type. +During a game, +any two of the same kind of object +with the same label +are the same type. +However, +the labels will vary from game to game. +.pp +When you use one of these labeled objects, +if its effect may be obvious. Potions or scrolls will +become identified at this point, but not other items. +You may want to call these other items something +so you will recognize it later, +you can use the +.Cs call +command +(see above). +.sh 2 Weapons +.pp +Some weapons, +like arrows, +come in bunches, +but most come one at a time. +In order to use a weapon, +you must wield it. +To fire an arrow out of a bow, +you must first wield the bow, +then throw the arrow. +You can only wield one weapon at a time, +but you can't change weapons if the one +you are currently wielding is cursed. +The commands to use weapons are +.Cs w +(wield) +and +.Cs t +(throw). +.sh 2 Armor +.pp +There are various sorts of armor lying around in the dungeon. +Some of it is enchanted, +some is cursed, +and some is just normal. +Different armor types have different armor protection. +The higher the armor protection, +the more protection the armor affords against the blows of monsters. +Here is a list of the various armor types and their normal armor protection: +.(b +.TS +box center; +l r. +\ \ \fIType Protection\fP +None 0 +Leather armor 2 +Studded leather / Ring mail 3 +Scale mail 4 +Chain mail 5 +Banded mail / Splint mail 6 +Plate mail 7 +.TE +.)b +.lp +If a piece of armor is enchanted, +its armor protection will be higher than normal. +If a suit of armor is cursed, +its armor protection will be lower, +and you will not be able to remove it. +However, not all armor with a protection that is lower than normal is cursed. +.pp +The commands to use weapons are +.Cs W +(wear) +and +.Cs T +(take off). +.sh 2 Scrolls +.pp +Scrolls come with titles in an unknown tongue\**. +.(f +\** Actually, it's a dialect spoken only by the twenty-seven members +of a tribe in Outer Mongolia, +but you're not supposed to +.i know +that. +.)f +After you read a scroll, +it disappears from your pack. +The command to use a scroll is +.Cs r +(read). +.sh 2 Potions +.pp +Potions are labeled by the color of the liquid inside the flask. +They disappear after being quaffed. +The command to quaff a potion is +.Cs q +(quaff). +.sh 2 "Staves and Wands" +.pp +Staves and wands do the same kinds of things. +Staves are identified by a type of wood; +wands by a type of metal or bone. +They are generally things you want to do to something +over a long distance, +so you must point them at what you wish to affect +to use them. +Some staves are not affected by the direction they are pointed, though. +Staves come with multiple magic charges, +the number being random, +and when they are used up, +the staff is just a piece of wood or metal. +.pp +The command to use a wand or staff is +.Cs z +(zap) +.sh 2 Rings +.pp +Rings are very useful items, +since they are relatively permanent magic, +unlike the usually fleeting effects of potions, scrolls, and staves. +Of course, +the bad rings are also more powerful. +Most rings also cause you to use up food more rapidly, +the rate varying with the type of ring. +Rings are differentiated by their stone settings. +The commands to use rings are +.Cs P +(put on) +and +.Cs R +(remove). +.sh 2 Food +.pp +Food is necessary to keep you going. +If you go too long without eating you will faint, +and eventually die of starvation. +The command to use food is +.Cs e +(eat). +.sh 1 Options +.pp +Due to variations in personal tastes +and conceptions of the way rogue should do things, +there are a set of options you can set +that cause rogue to behave in various different ways. +.ne 1i +.sh 2 "Setting the options" +.pp +There are two ways to set the options. +The first is with the +.Cs o +command of rogue; +the second is with the +.Cs ROGUEOPTS +environment variable\**. +.(f +\** On Version 6 systems, +there is no equivalent of the ROGUEOPTS feature. +.br +.)f +.br +.sh 3 "Using the `o' command" +.pp +When you type +.Cs o +in rogue, +it clears the screen +and displays the current settings for all the options. +It then places the cursor by the value of the first option +and waits for you to type. +You can type a \*R +which means to go to the next option, +a +.Cs \- +which means to go to the previous option, +an \*E +which means to return to the game, +or you can give the option a value. +For boolean options this merely involves typing +.Cs t +for true or +.Cs f +for false. +For string options, +type the new value followed by a \*R. +.sh 3 "Using the ROGUEOPTS variable" +.pp +The ROGUEOPTS variable is a string +containing a comma separated list of initial values +for the various options. +Boolean variables can be turned on by listing their name +or turned off by putting a +.Cs no +in front of the name. +Thus to set up an environment variable so that +.b jump +is on, +.b passgo +is off, +and the +.b name +is set to \*(lqBlue Meanie\*(rq, +use the command +.nf +.ti +3n +% setenv ROGUEOPTS "jump,nopassgo,name=Blue Meanie"\** +.fi +.(f +\** +For those of you who use the Bourne shell sh (1), the commands would be +.in +3 +.nf +$ ROGUEOPTS="jump,nopassgo,name=Blue Meanie" +$ export ROGUEOPTS +.fi +.in +0 +.)f +.sh 2 "Option list" +.pp +Here is a list of the options +and an explanation of what each one is for. +The default value for each is enclosed in square brackets. +For character string options, +input over forty characters will be ignored. +.ip "\fBjump\fP [\fI\^nojump\^\fP]" +If this option is set, +running moves will not be displayed +until you reach the end of the move. +This saves considerable CPU and display time. +This option defaults to +.i jump +if you are using a slow terminal. +.ip "\fBpassgo\fP [\fI\^nopassgo\^\fP]" +Follow turnings in passageways. +If you run in a passage +and you run into stone or a wall, +rogue will see if it can turn to the right or left. +If it can only turn one way, +it will turn that way. +If it can turn either or neither, +it will stop. +This algorithm can sometimes lead to slightly confusing occurrences +which is why it defaults to \fInopassgo\fP. +.ip "\fBskull\fP [\fI\^skull\^\fP]" +Print out the skull at the end if you get killed. +This is nice but slow, so you can turn it off if you like. +.ip "\fBname\fP [account name]" +This is the name of your character. +It is used if you get on the top ten scorer's list. +.ip "\fBfruit\fP [\fI\^slime-mold\^\fP]" +This should hold the name of a fruit that you enjoy eating. +It is basically a whimsey that rogue uses in a couple of places. +.ip "\fBfile\fP [\fI\^~/rogue.save\^\fP]" +The default file name for saving the game. +If your phone is hung up by accident, +rogue will automatically save the game in this file. +The file name may start with the special character +.Cs ~ +which expands to be your home directory. +.sh 1 Scoring +.pp +Rogue maintains a list +of the top scoring people or scores on your machine. +If you score higher than someone else on this list, +or better your previous score on the list, +you will be inserted in the proper place +under your current name. +.pp +If you quit the game, you get out with all of your gold intact. +If, however, you get killed in the Dungeons of Doom, +your body is forwarded to your next-of-kin, +along with 90% of your gold; +ten percent of your gold is kept by the Dungeons' wizard as a fee\**. +.(f +\** The Dungeon's wizard is named Wally the Wonder Badger. +Invocations should be accompanied by a sizable donation. +.)f +This should make you consider whether you want to take one last hit +at that monster and possibly live, +or quit and thus stop with whatever you have. +If you quit, you do get all your gold, +but if you swing and live, you might find more. +.pp +If you just want to see what the current top players/games list is, +you can type +.ti +1i +.nf +% rogue \-s +.br +.sh 1 Acknowledgements +.pp +Rogue was originally conceived of by Glenn Wichman and Michael Toy. +Ken Arnold and Michael Toy then smoothed out the user interface, +and added jillions of new features. +We would like to thank +Bob Arnold, +Michelle Busch, +Andy Hatcher, +Kipp Hickman, +Mark Horton, +Daniel Jensen, +Bill Joy, +Joe Kalash, +Steve Maurer, +Marty McNary, +Jan Miller, +and +Scott Nelson +for their ideas and assistance; +and also the teeming multitudes +who graciously ignored work, school, and social life to play rogue +and send us bugs, complaints, suggestions, and just plain flames. +And also Mom. +.pp +The public domain version of rogue now distributed with Berkeley UNIX +was written by Timothy Stoehr. diff --git a/rogue/hit.c b/rogue/hit.c new file mode 100644 index 0000000..33db644 --- /dev/null +++ b/rogue/hit.c @@ -0,0 +1,471 @@ +/* $NetBSD: hit.c,v 1.7 2003/08/07 09:37:37 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)hit.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: hit.c,v 1.7 2003/08/07 09:37:37 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * hit.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include "rogue.h" + +object *fight_monster = 0; +char hit_message[80] = ""; + +void +mon_hit(monster) + object *monster; +{ + short damage, hit_chance; + const char *mn; + float minus; + + if (fight_monster && (monster != fight_monster)) { + fight_monster = 0; + } + monster->trow = NO_ROOM; + if (cur_level >= (AMULET_LEVEL * 2)) { + hit_chance = 100; + } else { + hit_chance = monster->m_hit_chance; + hit_chance -= (((2 * rogue.exp) + (2 * ring_exp)) - r_rings); + } + if (wizard) { + hit_chance /= 2; + } + if (!fight_monster) { + interrupted = 1; + } + mn = mon_name(monster); + + if (!rand_percent(hit_chance)) { + if (!fight_monster) { + sprintf(hit_message + strlen(hit_message), + "the %s misses", mn); + message(hit_message, 1); + hit_message[0] = 0; + } + return; + } + if (!fight_monster) { + sprintf(hit_message + strlen(hit_message), "the %s hit", mn); + message(hit_message, 1); + hit_message[0] = 0; + } + if (!(monster->m_flags & STATIONARY)) { + damage = get_damage(monster->m_damage, 1); + if (cur_level >= (AMULET_LEVEL * 2)) { + minus = (float) ((AMULET_LEVEL * 2) - cur_level); + } else { + minus = (float) get_armor_class(rogue.armor) * 3.00; + minus = minus/100.00 * (float) damage; + } + damage -= (short) minus; + } else { + damage = monster->stationary_damage++; + } + if (wizard) { + damage /= 3; + } + if (damage > 0) { + rogue_damage(damage, monster, 0); + } + if (monster->m_flags & SPECIAL_HIT) { + special_hit(monster); + } +} + +void +rogue_hit(monster, force_hit) + object *monster; + boolean force_hit; +{ + short damage, hit_chance; + + if (monster) { + if (check_imitator(monster)) { + return; + } + hit_chance = force_hit ? 100 : get_hit_chance(rogue.weapon); + + if (wizard) { + hit_chance *= 2; + } + if (!rand_percent(hit_chance)) { + if (!fight_monster) { + (void) strcpy(hit_message, "you miss "); + } + goto RET; + } + damage = get_weapon_damage(rogue.weapon); + if (wizard) { + damage *= 3; + } + if (con_mon) { + s_con_mon(monster); + } + if (mon_damage(monster, damage)) { /* still alive? */ + if (!fight_monster) { + (void) strcpy(hit_message, "you hit "); + } + } +RET: check_gold_seeker(monster); + wake_up(monster); + } +} + +void +rogue_damage(d, monster, other) + short d; + object *monster; + short other; +{ + if (d >= rogue.hp_current) { + rogue.hp_current = 0; + print_stats(STAT_HP); + killed_by(monster, other); + } + if (d > 0) { + rogue.hp_current -= d; + print_stats(STAT_HP); + } +} + +int +get_damage(ds, r) + const char *ds; + boolean r; +{ + int i = 0, j, n, d, total = 0; + + while (ds[i]) { + n = get_number(ds+i); + while (ds[i++] != 'd') ; + d = get_number(ds+i); + while ((ds[i] != '/') && ds[i]) i++; + + for (j = 0; j < n; j++) { + if (r) { + total += get_rand(1, d); + } else { + total += d; + } + } + if (ds[i] == '/') { + i++; + } + } + return(total); +} + +int +get_w_damage(obj) + const object *obj; +{ + char new_damage[12]; + int tmp_to_hit, tmp_damage; + int i = 0; + + if ((!obj) || (obj->what_is != WEAPON)) { + return(-1); + } + tmp_to_hit = get_number(obj->damage) + obj->hit_enchant; + while (obj->damage[i++] != 'd') ; + tmp_damage = get_number(obj->damage + i) + obj->d_enchant; + + sprintf(new_damage, "%dd%d", tmp_to_hit, tmp_damage); + + return(get_damage(new_damage, 1)); +} + +int +get_number(s) + const char *s; +{ + int i = 0; + int total = 0; + + while ((s[i] >= '0') && (s[i] <= '9')) { + total = (10 * total) + (s[i] - '0'); + i++; + } + return(total); +} + +long +lget_number(s) + const char *s; +{ + short i = 0; + long total = 0; + + while ((s[i] >= '0') && (s[i] <= '9')) { + total = (10 * total) + (s[i] - '0'); + i++; + } + return(total); +} + +int +to_hit(obj) + const object *obj; +{ + if (!obj) { + return(1); + } + return(get_number(obj->damage) + obj->hit_enchant); +} + +int +damage_for_strength() +{ + short strength; + + strength = rogue.str_current + add_strength; + + if (strength <= 6) { + return(strength-5); + } + if (strength <= 14) { + return(1); + } + if (strength <= 17) { + return(3); + } + if (strength <= 18) { + return(4); + } + if (strength <= 20) { + return(5); + } + if (strength <= 21) { + return(6); + } + if (strength <= 30) { + return(7); + } + return(8); +} + +int +mon_damage(monster, damage) + object *monster; + short damage; +{ + const char *mn; + short row, col; + + monster->hp_to_kill -= damage; + + if (monster->hp_to_kill <= 0) { + row = monster->row; + col = monster->col; + dungeon[row][col] &= ~MONSTER; + mvaddch(row, col, (int) get_dungeon_char(row, col)); + + fight_monster = 0; + cough_up(monster); + mn = mon_name(monster); + sprintf(hit_message+strlen(hit_message), "defeated the %s", mn); + message(hit_message, 1); + hit_message[0] = 0; + add_exp(monster->kill_exp, 1); + take_from_pack(monster, &level_monsters); + + if (monster->m_flags & HOLDS) { + being_held = 0; + } + free_object(monster); + return(0); + } + return(1); +} + +void +fight(to_the_death) + boolean to_the_death; +{ + short ch, c, d; + short row, col; + boolean first_miss = 1; + short possible_damage; + object *monster; + + ch = 0; + while (!is_direction(ch = rgetchar(), &d)) { + sound_bell(); + if (first_miss) { + message("direction?", 0); + first_miss = 0; + } + } + check_message(); + if (ch == CANCEL) { + return; + } + row = rogue.row; col = rogue.col; + get_dir_rc(d, &row, &col, 0); + + c = mvinch(row, col); + if (((c < 'A') || (c > 'Z')) || + (!can_move(rogue.row, rogue.col, row, col))) { + message("I see no monster there", 0); + return; + } + if (!(fight_monster = object_at(&level_monsters, row, col))) { + return; + } + if (!(fight_monster->m_flags & STATIONARY)) { + possible_damage = ((get_damage(fight_monster->m_damage, 0) * 2) / 3); + } else { + possible_damage = fight_monster->stationary_damage - 1; + } + while (fight_monster) { + (void) one_move_rogue(ch, 0); + if (((!to_the_death) && (rogue.hp_current <= possible_damage)) || + interrupted || (!(dungeon[row][col] & MONSTER))) { + fight_monster = 0; + } else { + monster = object_at(&level_monsters, row, col); + if (monster != fight_monster) { + fight_monster = 0; + } + } + } +} + +void +get_dir_rc(dir, row, col, allow_off_screen) + short dir; + short *row, *col; + short allow_off_screen; +{ + switch(dir) { + case LEFT: + if (allow_off_screen || (*col > 0)) { + (*col)--; + } + break; + case DOWN: + if (allow_off_screen || (*row < (DROWS-2))) { + (*row)++; + } + break; + case UPWARD: + if (allow_off_screen || (*row > MIN_ROW)) { + (*row)--; + } + break; + case RIGHT: + if (allow_off_screen || (*col < (DCOLS-1))) { + (*col)++; + } + break; + case UPLEFT: + if (allow_off_screen || ((*row > MIN_ROW) && (*col > 0))) { + (*row)--; + (*col)--; + } + break; + case UPRIGHT: + if (allow_off_screen || ((*row > MIN_ROW) && (*col < (DCOLS-1)))) { + (*row)--; + (*col)++; + } + break; + case DOWNRIGHT: + if (allow_off_screen || ((*row < (DROWS-2)) && (*col < (DCOLS-1)))) { + (*row)++; + (*col)++; + } + break; + case DOWNLEFT: + if (allow_off_screen || ((*row < (DROWS-2)) && (*col > 0))) { + (*row)++; + (*col)--; + } + break; + } +} + +int +get_hit_chance(weapon) + const object *weapon; +{ + short hit_chance; + + hit_chance = 40; + hit_chance += 3 * to_hit(weapon); + hit_chance += (((2 * rogue.exp) + (2 * ring_exp)) - r_rings); + return(hit_chance); +} + +int +get_weapon_damage(weapon) + const object *weapon; +{ + short damage; + + damage = get_w_damage(weapon); + damage += damage_for_strength(); + damage += ((((rogue.exp + ring_exp) - r_rings) + 1) / 2); + return(damage); +} + +void +s_con_mon(monster) + object *monster; +{ + if (con_mon) { + monster->m_flags |= CONFUSED; + monster->moves_confused += get_rand(12, 22); + message("the monster appears confused", 0); + con_mon = 0; + } +} diff --git a/rogue/init.c b/rogue/init.c new file mode 100644 index 0000000..d077bf2 --- /dev/null +++ b/rogue/init.c @@ -0,0 +1,365 @@ +/* $NetBSD: init.c,v 1.13 2003/08/07 09:37:38 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: init.c,v 1.13 2003/08/07 09:37:38 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * init.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include +#include + +#include "rogue.h" + +char login_name[MAX_OPT_LEN]; +char *nick_name = (char *) 0; +char *rest_file = 0; +boolean cant_int = 0; +boolean did_int = 0; +boolean score_only; +boolean init_curses = 0; +boolean save_is_interactive = 1; +boolean ask_quit = 1; +boolean no_skull = 0; +boolean passgo = 0; +const char *error_file = "rogue.esave"; +const char *byebye_string = "Okay, bye bye!"; +gid_t gid, egid; + +int +init(argc, argv) + int argc; + char *argv[]; +{ + const char *pn; + int seed; + int fd; + + gid = getgid(); + egid = getegid(); + setegid(gid); + /* Check for dirty tricks with closed fds 0, 1, 2 */ + fd = open("/dev/null", O_RDONLY); + if (fd < 3) + exit(1); + close(fd); + + seed = 0; + pn = md_gln(); + if ((!pn) || (strlen(pn) >= MAX_OPT_LEN)) { + clean_up("Hey! Who are you?"); + } + (void) strcpy(login_name, pn); + + do_args(argc, argv); + do_opts(); + + if (!score_only && !rest_file) { + printf("Hello %s, just a moment while I dig the dungeon...", + nick_name); + fflush(stdout); + } + + initscr(); + if ((LINES < DROWS) || (COLS < DCOLS)) { + clean_up("must be played on 24 x 80 screen"); + } + start_window(); + init_curses = 1; + + md_heed_signals(); + + if (score_only) { + put_scores((object *) 0, 0); + } + seed = md_gseed(); + (void) srrandom(seed); + if (rest_file) { + restore(rest_file); + return(1); + } + mix_colors(); + get_wand_and_ring_materials(); + make_scroll_titles(); + + level_objects.next_object = (object *) 0; + level_monsters.next_monster = (object *) 0; + player_init(); + ring_stats(0); + return(0); +} + +void +player_init() +{ + object *obj; + + rogue.pack.next_object = (object *) 0; + + obj = alloc_object(); + get_food(obj, 1); + (void) add_to_pack(obj, &rogue.pack, 1); + + obj = alloc_object(); /* initial armor */ + obj->what_is = ARMOR; + obj->which_kind = RINGMAIL; + obj->class = RINGMAIL+2; + obj->is_protected = 0; + obj->d_enchant = 1; + (void) add_to_pack(obj, &rogue.pack, 1); + do_wear(obj); + + obj = alloc_object(); /* initial weapons */ + obj->what_is = WEAPON; + obj->which_kind = MACE; + obj->damage = "2d3"; + obj->hit_enchant = obj->d_enchant = 1; + obj->identified = 1; + (void) add_to_pack(obj, &rogue.pack, 1); + do_wield(obj); + + obj = alloc_object(); + obj->what_is = WEAPON; + obj->which_kind = BOW; + obj->damage = "1d2"; + obj->hit_enchant = 1; + obj->d_enchant = 0; + obj->identified = 1; + (void) add_to_pack(obj, &rogue.pack, 1); + + obj = alloc_object(); + obj->what_is = WEAPON; + obj->which_kind = ARROW; + obj->quantity = get_rand(25, 35); + obj->damage = "1d2"; + obj->hit_enchant = 0; + obj->d_enchant = 0; + obj->identified = 1; + (void) add_to_pack(obj, &rogue.pack, 1); +} + +void +clean_up(estr) + const char *estr; +{ + if (save_is_interactive) { + if (init_curses) { + move(DROWS-1, 0); + refresh(); + stop_window(); + } + printf("\n%s\n", estr); + } + md_exit(0); +} + +void +start_window() +{ + cbreak(); + noecho(); +#ifndef BAD_NONL + nonl(); +#endif +} + +void +stop_window() +{ + endwin(); +} + +void +byebye(dummy) + int dummy __attribute__((__unused__)); +{ + md_ignore_signals(); + if (ask_quit) { + quit(1); + } else { + clean_up(byebye_string); + } + md_heed_signals(); +} + +void +onintr(dummy) + int dummy __attribute__((__unused__)); +{ + md_ignore_signals(); + if (cant_int) { + did_int = 1; + } else { + check_message(); + message("interrupt", 1); + } + md_heed_signals(); +} + +void +error_save(dummy) + int dummy __attribute__((__unused__)); +{ + save_is_interactive = 0; + save_into_file(error_file); + clean_up(""); +} + +void +do_args(argc, argv) + int argc; + char *argv[]; +{ + short i, j; + + for (i = 1; i < argc; i++) { + if (argv[i][0] == '-') { + for (j = 1; argv[i][j]; j++) { + switch(argv[i][j]) { + case 's': + score_only = 1; + break; + } + } + } else { + rest_file = argv[i]; + } + } +} + +void +do_opts() +{ + char *eptr; + + if ((eptr = md_getenv("ROGUEOPTS")) != NULL) { + for (;;) { + while ((*eptr) == ' ') { + eptr++; + } + if (!(*eptr)) { + break; + } + if (!strncmp(eptr, "fruit=", 6)) { + eptr += 6; + env_get_value(&fruit, eptr, 1); + } else if (!strncmp(eptr, "file=", 5)) { + eptr += 5; + env_get_value(&save_file, eptr, 0); + } else if (!strncmp(eptr, "jump", 4)) { + jump = 1; + } else if (!strncmp(eptr, "name=", 5)) { + eptr += 5; + env_get_value(&nick_name, eptr, 0); + } else if (!strncmp(eptr, "noaskquit", 9)) { + ask_quit = 0; + } else if (!strncmp(eptr, "noskull", 5) || + !strncmp(eptr,"notomb", 6)) { + no_skull = 1; + } else if (!strncmp(eptr, "passgo", 5)) { + passgo = 1; + } + while ((*eptr) && (*eptr != ',')) { + eptr++; + } + if (!(*(eptr++))) { + break; + } + } + } + /* If some strings have not been set through ROGUEOPTS, assign defaults + * to them so that the options editor has data to work with. + */ + init_str(&nick_name, login_name); + init_str(&save_file, "rogue.save"); + init_str(&fruit, "slime-mold"); +} + +void +env_get_value(s, e, add_blank) + char **s, *e; + boolean add_blank; +{ + short i = 0; + const char *t; + + t = e; + + while ((*e) && (*e != ',')) { + if (*e == ':') { + *e = ';'; /* ':' reserved for score file purposes */ + } + e++; + if (++i >= MAX_OPT_LEN) { + break; + } + } + *s = md_malloc(MAX_OPT_LEN + 2); + if (*s == NULL) + clean_up("out of memory"); + (void) strncpy(*s, t, i); + if (add_blank) { + (*s)[i++] = ' '; + } + (*s)[i] = '\0'; +} + +void +init_str(str, dflt) + char **str; + const char *dflt; +{ + if (!(*str)) { + *str = md_malloc(MAX_OPT_LEN + 2); + if (*str == NULL) + clean_up("out of memory"); + (void) strcpy(*str, dflt); + } +} diff --git a/rogue/inventory.c b/rogue/inventory.c new file mode 100644 index 0000000..db28c2c --- /dev/null +++ b/rogue/inventory.c @@ -0,0 +1,786 @@ +/* $NetBSD: inventory.c,v 1.9 2003/08/07 09:37:38 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)inventory.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: inventory.c,v 1.9 2003/08/07 09:37:38 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * inventory.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include "rogue.h" + +boolean is_wood[WANDS]; +const char *press_space = " --press space to continue--"; + +const char *const wand_materials[WAND_MATERIALS] = { + "steel ", + "bronze ", + "gold ", + "silver ", + "copper ", + "nickel ", + "cobalt ", + "tin ", + "iron ", + "magnesium ", + "chrome ", + "carbon ", + "platinum ", + "silicon ", + "titanium ", + + "teak ", + "oak ", + "cherry ", + "birch ", + "pine ", + "cedar ", + "redwood ", + "balsa ", + "ivory ", + "walnut ", + "maple ", + "mahogany ", + "elm ", + "palm ", + "wooden " +}; + +const char *const gems[GEMS] = { + "diamond ", + "stibotantalite ", + "lapi-lazuli ", + "ruby ", + "emerald ", + "sapphire ", + "amethyst ", + "quartz ", + "tiger-eye ", + "opal ", + "agate ", + "turquoise ", + "pearl ", + "garnet " +}; + +const char *const syllables[MAXSYLLABLES] = { + "blech ", + "foo ", + "barf ", + "rech ", + "bar ", + "blech ", + "quo ", + "bloto ", + "oh ", + "caca ", + "blorp ", + "erp ", + "festr ", + "rot ", + "slie ", + "snorf ", + "iky ", + "yuky ", + "ooze ", + "ah ", + "bahl ", + "zep ", + "druhl ", + "flem ", + "behil ", + "arek ", + "mep ", + "zihr ", + "grit ", + "kona ", + "kini ", + "ichi ", + "tims ", + "ogr ", + "oo ", + "ighr ", + "coph ", + "swerr ", + "mihln ", + "poxi " +}; + +#define COMS 48 + +struct id_com_s { + short com_char; + const char *com_desc; +}; + +const struct id_com_s com_id_tab[COMS] = { + {'?', "? prints help"}, + {'r', "r read scroll"}, + {'/', "/ identify object"}, + {'e', "e eat food"}, + {'h', "h left "}, + {'w', "w wield a weapon"}, + {'j', "j down"}, + {'W', "W wear armor"}, + {'k', "k up"}, + {'T', "T take armor off"}, + {'l', "l right"}, + {'P', "P put on ring"}, + {'y', "y up & left"}, + {'R', "R remove ring"}, + {'u', "u up & right"}, + {'d', "d drop object"}, + {'b', "b down & left"}, + {'c', "c call object"}, + {'n', "n down & right"}, + {'\0', ": run that way"}, + {')', ") print current weapon"}, + {'\0', ": run till adjacent"}, + {']', "] print current armor"}, + {'f', "f fight till death or near death"}, + {'=', "= print current rings"}, + {'t', "t throw something"}, + {'\001', "^A print Hp-raise average"}, + {'m', "m move onto without picking up"}, + {'z', "z zap a wand in a direction"}, + {'o', "o examine/set options"}, + {'^', "^ identify trap type"}, + {'\022', "^R redraw screen"}, + {'&', "& save screen into 'rogue.screen'"}, + {'s', "s search for trap/secret door"}, + {'\020', "^P repeat last message"}, + {'>', "> go down a staircase"}, + {'\033', "^[ cancel command"}, + {'<', "< go up a staircase"}, + {'S', "S save game"}, + {'.', ". rest for a turn"}, + {'Q', "Q quit"}, + {',', ", pick something up"}, + {'!', "! shell escape"}, + {'i', "i inventory"}, + {'F', "F fight till either of you dies"}, + {'I', "I inventory single item"}, + {'v', "v print version number"}, + {'q', "q quaff potion" } +}; + +void +inventory(pack, mask) + const object *pack; + unsigned short mask; +{ + object *obj; + short i = 0, j, maxlen = 0, n; + char descs[MAX_PACK_COUNT+1][DCOLS]; + short row, col; + + obj = pack->next_object; + + if (!obj) { + message("your pack is empty", 0); + return; + } + while (obj) { + if (obj->what_is & mask) { + descs[i][0] = ' '; + descs[i][1] = obj->ichar; + descs[i][2] = ((obj->what_is & ARMOR) && obj->is_protected) + ? '}' : ')'; + descs[i][3] = ' '; + get_desc(obj, descs[i]+4); + if ((n = strlen(descs[i])) > maxlen) { + maxlen = n; + } + i++; + } + obj = obj->next_object; + } + (void) strcpy(descs[i++], press_space); + if (maxlen < 27) maxlen = 27; + col = DCOLS - (maxlen + 2); + + for (row = 0; ((row < i) && (row < DROWS)); row++) { + if (row > 0) { + for (j = col; j < DCOLS; j++) { + descs[row-1][j-col] = mvinch(row, j); + } + descs[row-1][j-col] = 0; + } + mvaddstr(row, col, descs[row]); + clrtoeol(); + } + refresh(); + wait_for_ack(); + + move(0, 0); + clrtoeol(); + + for (j = 1; ((j < i) && (j < DROWS)); j++) { + mvaddstr(j, col, descs[j-1]); + } +} + +void +id_com() +{ + int ch = 0; + short i, j, k; + + while (ch != CANCEL) { + check_message(); + message("Character you want help for (* for all):", 0); + + refresh(); + ch = getchar(); + + switch(ch) { + case LIST: + { + char save[(((COMS / 2) + (COMS % 2)) + 1)][DCOLS]; + short rows = (((COMS / 2) + (COMS % 2)) + 1); + boolean need_two_screens = FALSE; + + if (rows > LINES) { + need_two_screens = 1; + rows = LINES; + } + k = 0; + + for (i = 0; i < rows; i++) { + for (j = 0; j < DCOLS; j++) { + save[i][j] = mvinch(i, j); + } + } +MORE: + for (i = 0; i < rows; i++) { + move(i, 0); + clrtoeol(); + } + for (i = 0; i < (rows-1); i++) { + if (i < (LINES-1)) { + if (((i + i) < COMS) && ((i+i+k) < COMS)) { + mvaddstr(i, 0, com_id_tab[i+i+k].com_desc); + } + if (((i + i + 1) < COMS) && ((i+i+k+1) < COMS)) { + mvaddstr(i, (DCOLS/2), + com_id_tab[i+i+k+1].com_desc); + } + } + } + mvaddstr(rows - 1, 0, need_two_screens ? more : press_space); + refresh(); + wait_for_ack(); + + if (need_two_screens) { + k += ((rows-1) * 2); + need_two_screens = 0; + goto MORE; + } + for (i = 0; i < rows; i++) { + move(i, 0); + for (j = 0; j < DCOLS; j++) { + addch(save[i][j]); + } + } + } + break; + default: + if (!pr_com_id(ch)) { + if (!pr_motion_char(ch)) { + check_message(); + message("unknown character", 0); + } + } + ch = CANCEL; + break; + } + } +} + +int +pr_com_id(ch) + int ch; +{ + int i; + + if (!get_com_id(&i, ch)) { + return(0); + } + check_message(); + message(com_id_tab[i].com_desc, 0); + return(1); +} + +int +get_com_id(indexp, ch) + int *indexp; + short ch; +{ + short i; + + for (i = 0; i < COMS; i++) { + if (com_id_tab[i].com_char == ch) { + *indexp = i; + return(1); + } + } + return(0); +} + +int +pr_motion_char(ch) + int ch; +{ + if ( (ch == 'J') || + (ch == 'K') || + (ch == 'L') || + (ch == 'H') || + (ch == 'Y') || + (ch == 'U') || + (ch == 'N') || + (ch == 'B') || + (ch == '\012') || + (ch == '\013') || + (ch == '\010') || + (ch == '\014') || + (ch == '\025') || + (ch == '\031') || + (ch == '\016') || + (ch == '\002')) { + char until[18], buf[DCOLS]; + int n; + + if (ch <= '\031') { + ch += 96; + (void) strcpy(until, "until adjascent"); + } else { + ch += 32; + until[0] = '\0'; + } + (void) get_com_id(&n, ch); + sprintf(buf, "run %s %s", com_id_tab[n].com_desc + 8, until); + check_message(); + message(buf, 0); + return(1); + } else { + return(0); + } +} + +void +mix_colors() +{ + short i, j, k; + char t[MAX_ID_TITLE_LEN]; + + for (i = 0; i <= 32; i++) { + j = get_rand(0, (POTIONS - 1)); + k = get_rand(0, (POTIONS - 1)); + memcpy(t, id_potions[j].title, MAX_ID_TITLE_LEN); + memcpy(id_potions[j].title, id_potions[k].title, MAX_ID_TITLE_LEN); + memcpy(id_potions[k].title, t, MAX_ID_TITLE_LEN); + } +} + +void +make_scroll_titles() +{ + short i, j, n; + short sylls, s; + + for (i = 0; i < SCROLS; i++) { + sylls = get_rand(2, 5); + (void) strcpy(id_scrolls[i].title, "'"); + + for (j = 0; j < sylls; j++) { + s = get_rand(1, (MAXSYLLABLES-1)); + (void) strcat(id_scrolls[i].title, syllables[s]); + } + n = strlen(id_scrolls[i].title); + (void) strcpy(id_scrolls[i].title+(n-1), "' "); + } +} + +void +get_desc(obj, desc) + const object *obj; + char *desc; +{ + const char *item_name; + struct id *id_table; + char more_info[32]; + short i; + + if (obj->what_is == AMULET) { + (void) strcpy(desc, "the amulet of Yendor "); + return; + } + item_name = name_of(obj); + + if (obj->what_is == GOLD) { + sprintf(desc, "%d pieces of gold", obj->quantity); + return; + } + + if (obj->what_is != ARMOR) { + if (obj->quantity == 1) { + (void) strcpy(desc, "a "); + } else { + sprintf(desc, "%d ", obj->quantity); + } + } + if (obj->what_is == FOOD) { + if (obj->which_kind == RATION) { + if (obj->quantity > 1) { + sprintf(desc, "%d rations of ", obj->quantity); + } else { + (void) strcpy(desc, "some "); + } + } else { + (void) strcpy(desc, "a "); + } + (void) strcat(desc, item_name); + goto ANA; + } + id_table = get_id_table(obj); + + if (wizard) { + goto ID; + } + if (obj->what_is & (WEAPON | ARMOR | WAND | RING)) { + goto CHECK; + } + + switch(id_table[obj->which_kind].id_status) { + case UNIDENTIFIED: +CHECK: + switch(obj->what_is) { + case SCROL: + (void) strcat(desc, item_name); + (void) strcat(desc, "entitled: "); + (void) strcat(desc, id_table[obj->which_kind].title); + break; + case POTION: + (void) strcat(desc, id_table[obj->which_kind].title); + (void) strcat(desc, item_name); + break; + case WAND: + case RING: + if (obj->identified || + (id_table[obj->which_kind].id_status == IDENTIFIED)) { + goto ID; + } + if (id_table[obj->which_kind].id_status == CALLED) { + goto CALL; + } + (void) strcat(desc, id_table[obj->which_kind].title); + (void) strcat(desc, item_name); + break; + case ARMOR: + if (obj->identified) { + goto ID; + } + (void) strcpy(desc, id_table[obj->which_kind].title); + break; + case WEAPON: + if (obj->identified) { + goto ID; + } + (void) strcat(desc, name_of(obj)); + break; + } + break; + case CALLED: +CALL: switch(obj->what_is) { + case SCROL: + case POTION: + case WAND: + case RING: + (void) strcat(desc, item_name); + (void) strcat(desc, "called "); + (void) strcat(desc, id_table[obj->which_kind].title); + break; + } + break; + case IDENTIFIED: +ID: switch(obj->what_is) { + case SCROL: + case POTION: + (void) strcat(desc, item_name); + (void) strcat(desc, id_table[obj->which_kind].real); + break; + case RING: + if (wizard || obj->identified) { + if ((obj->which_kind == DEXTERITY) || + (obj->which_kind == ADD_STRENGTH)) { + sprintf(more_info, "%s%d ", ((obj->class > 0) ? "+" : ""), + obj->class); + (void) strcat(desc, more_info); + } + } + (void) strcat(desc, item_name); + (void) strcat(desc, id_table[obj->which_kind].real); + break; + case WAND: + (void) strcat(desc, item_name); + (void) strcat(desc, id_table[obj->which_kind].real); + if (wizard || obj->identified) { + sprintf(more_info, "[%d]", obj->class); + (void) strcat(desc, more_info); + } + break; + case ARMOR: + sprintf(desc, "%s%d ", ((obj->d_enchant >= 0) ? "+" : ""), + obj->d_enchant); + (void) strcat(desc, id_table[obj->which_kind].title); + sprintf(more_info, "[%d] ", get_armor_class(obj)); + (void) strcat(desc, more_info); + break; + case WEAPON: + sprintf(desc+strlen(desc), "%s%d,%s%d ", + ((obj->hit_enchant >= 0) ? "+" : ""), obj->hit_enchant, + ((obj->d_enchant >= 0) ? "+" : ""), obj->d_enchant); + (void) strcat(desc, name_of(obj)); + break; + } + break; + } +ANA: + if (!strncmp(desc, "a ", 2)) { + if (is_vowel(desc[2])) { + for (i = strlen(desc) + 1; i > 1; i--) { + desc[i] = desc[i-1]; + } + desc[1] = 'n'; + } + } + if (obj->in_use_flags & BEING_WIELDED) { + (void) strcat(desc, "in hand"); + } else if (obj->in_use_flags & BEING_WORN) { + (void) strcat(desc, "being worn"); + } else if (obj->in_use_flags & ON_LEFT_HAND) { + (void) strcat(desc, "on left hand"); + } else if (obj->in_use_flags & ON_RIGHT_HAND) { + (void) strcat(desc, "on right hand"); + } +} + +void +get_wand_and_ring_materials() +{ + short i, j; + boolean used[WAND_MATERIALS]; + + for (i = 0; i < WAND_MATERIALS; i++) { + used[i] = 0; + } + for (i = 0; i < WANDS; i++) { + do { + j = get_rand(0, WAND_MATERIALS-1); + } while (used[j]); + used[j] = 1; + (void) strcpy(id_wands[i].title, wand_materials[j]); + is_wood[i] = (j > MAX_METAL); + } + for (i = 0; i < GEMS; i++) { + used[i] = 0; + } + for (i = 0; i < RINGS; i++) { + do { + j = get_rand(0, GEMS-1); + } while (used[j]); + used[j] = 1; + (void) strcpy(id_rings[i].title, gems[j]); + } +} + +void +single_inv(ichar) + short ichar; +{ + short ch; + char desc[DCOLS]; + object *obj; + + ch = ichar ? ichar : pack_letter("inventory what?", ALL_OBJECTS); + + if (ch == CANCEL) { + return; + } + if (!(obj = get_letter_object(ch))) { + message("no such item.", 0); + return; + } + desc[0] = ch; + desc[1] = ((obj->what_is & ARMOR) && obj->is_protected) ? '}' : ')'; + desc[2] = ' '; + desc[3] = 0; + get_desc(obj, desc+3); + message(desc, 0); +} + +struct id * +get_id_table(obj) + const object *obj; +{ + switch(obj->what_is) { + case SCROL: + return(id_scrolls); + case POTION: + return(id_potions); + case WAND: + return(id_wands); + case RING: + return(id_rings); + case WEAPON: + return(id_weapons); + case ARMOR: + return(id_armors); + } + return((struct id *) 0); +} + +void +inv_armor_weapon(is_weapon) + boolean is_weapon; +{ + if (is_weapon) { + if (rogue.weapon) { + single_inv(rogue.weapon->ichar); + } else { + message("not wielding anything", 0); + } + } else { + if (rogue.armor) { + single_inv(rogue.armor->ichar); + } else { + message("not wearing anything", 0); + } + } +} + +void +id_type() +{ + const char *id; + int ch; + char buf[DCOLS]; + + message("what do you want identified?", 0); + + ch = rgetchar(); + + if ((ch >= 'A') && (ch <= 'Z')) { + id = m_names[ch-'A']; + } else if (ch < 32) { + check_message(); + return; + } else { + switch(ch) { + case '@': + id = "you"; + break; + case '%': + id = "staircase"; + break; + case '^': + id = "trap"; + break; + case '+': + id = "door"; + break; + case '-': + case '|': + id = "wall of a room"; + break; + case '.': + id = "floor"; + break; + case '#': + id = "passage"; + break; + case ' ': + id = "solid rock"; + break; + case '=': + id = "ring"; + break; + case '?': + id = "scroll"; + break; + case '!': + id = "potion"; + break; + case '/': + id = "wand or staff"; + break; + case ')': + id = "weapon"; + break; + case ']': + id = "armor"; + break; + case '*': + id = "gold"; + break; + case ':': + id = "food"; + break; + case ',': + id = "the Amulet of Yendor"; + break; + default: + id = "unknown character"; + break; + } + } + check_message(); + sprintf(buf, "'%c': %s", ch, id); + message(buf, 0); +} diff --git a/rogue/level.c b/rogue/level.c new file mode 100644 index 0000000..ecf1046 --- /dev/null +++ b/rogue/level.c @@ -0,0 +1,906 @@ +/* $NetBSD: level.c,v 1.7 2003/08/07 09:37:38 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)level.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: level.c,v 1.7 2003/08/07 09:37:38 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * level.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include "rogue.h" + +#define swap(x,y) {t = x; x = y; y = t;} + +short cur_level = 0; +short max_level = 1; +short cur_room; +const char *new_level_message = 0; +short party_room = NO_ROOM; +short r_de; + +const long level_points[MAX_EXP_LEVEL] = { + 10L, + 20L, + 40L, + 80L, + 160L, + 320L, + 640L, + 1300L, + 2600L, + 5200L, + 10000L, + 20000L, + 40000L, + 80000L, + 160000L, + 320000L, + 1000000L, + 3333333L, + 6666666L, + MAX_EXP, + 99900000L +}; + +short random_rooms[MAXROOMS] = {3, 7, 5, 2, 0, 6, 1, 4, 8}; + +void +make_level() +{ + short i, j; + short must_1, must_2, must_3; + boolean big_room; + + must_2 = must_3 = 0; + if (cur_level < LAST_DUNGEON) { + cur_level++; + } + if (cur_level > max_level) { + max_level = cur_level; + } + must_1 = get_rand(0, 5); + + switch(must_1) { + case 0: + must_1 = 0; + must_2 = 1; + must_3 = 2; + break; + case 1: + must_1 = 3; + must_2 = 4; + must_3 = 5; + break; + case 2: + must_1 = 6; + must_2 = 7; + must_3 = 8; + break; + case 3: + must_1 = 0; + must_2 = 3; + must_3 = 6; + break; + case 4: + must_1 = 1; + must_2 = 4; + must_3 = 7; + break; + case 5: + must_1 = 2; + must_2 = 5; + must_3 = 8; + break; + } + if (rand_percent(8)) { + party_room = 0; + } + big_room = ((party_room != NO_ROOM) && rand_percent(1)); + if (big_room) { + make_room(BIG_ROOM, 0, 0, 0); + } else { + for (i = 0; i < MAXROOMS; i++) { + make_room(i, must_1, must_2, must_3); + } + } + if (!big_room) { + add_mazes(); + + mix_random_rooms(); + + for (j = 0; j < MAXROOMS; j++) { + + i = random_rooms[j]; + + if (i < (MAXROOMS-1)) { + (void) connect_rooms(i, i+1); + } + if (i < (MAXROOMS-3)) { + (void) connect_rooms(i, i+3); + } + if (i < (MAXROOMS-2)) { + if (rooms[i+1].is_room & R_NOTHING) { + if (connect_rooms(i, i+2)) { + rooms[i+1].is_room = R_CROSS; + } + } + } + if (i < (MAXROOMS-6)) { + if (rooms[i+3].is_room & R_NOTHING) { + if (connect_rooms(i, i+6)) { + rooms[i+3].is_room = R_CROSS; + } + } + } + if (is_all_connected()) { + break; + } + } + fill_out_level(); + } + if (!has_amulet() && (cur_level >= AMULET_LEVEL)) { + put_amulet(); + } +} + +void +make_room(rn, r1, r2, r3) + short rn, r1, r2, r3; +{ + short left_col, right_col, top_row, bottom_row; + short width, height; + short row_offset, col_offset; + short i, j, ch; + + left_col = right_col = top_row = bottom_row = 0; + switch(rn) { + case 0: + left_col = 0; + right_col = COL1-1; + top_row = MIN_ROW; + bottom_row = ROW1-1; + break; + case 1: + left_col = COL1+1; + right_col = COL2-1; + top_row = MIN_ROW; + bottom_row = ROW1-1; + break; + case 2: + left_col = COL2+1; + right_col = DCOLS-1; + top_row = MIN_ROW; + bottom_row = ROW1-1; + break; + case 3: + left_col = 0; + right_col = COL1-1; + top_row = ROW1+1; + bottom_row = ROW2-1; + break; + case 4: + left_col = COL1+1; + right_col = COL2-1; + top_row = ROW1+1; + bottom_row = ROW2-1; + break; + case 5: + left_col = COL2+1; + right_col = DCOLS-1; + top_row = ROW1+1; + bottom_row = ROW2-1; + break; + case 6: + left_col = 0; + right_col = COL1-1; + top_row = ROW2+1; + bottom_row = DROWS - 2; + break; + case 7: + left_col = COL1+1; + right_col = COL2-1; + top_row = ROW2+1; + bottom_row = DROWS - 2; + break; + case 8: + left_col = COL2+1; + right_col = DCOLS-1; + top_row = ROW2+1; + bottom_row = DROWS - 2; + break; + case BIG_ROOM: + top_row = get_rand(MIN_ROW, MIN_ROW+5); + bottom_row = get_rand(DROWS-7, DROWS-2); + left_col = get_rand(0, 10); + right_col = get_rand(DCOLS-11, DCOLS-1); + rn = 0; + goto B; + } + height = get_rand(4, (bottom_row - top_row + 1)); + width = get_rand(7, (right_col - left_col - 2)); + + row_offset = get_rand(0, ((bottom_row - top_row) - height + 1)); + col_offset = get_rand(0, ((right_col - left_col) - width + 1)); + + top_row += row_offset; + bottom_row = top_row + height - 1; + + left_col += col_offset; + right_col = left_col + width - 1; + + if ((rn != r1) && (rn != r2) && (rn != r3) && rand_percent(40)) { + goto END; + } +B: + rooms[rn].is_room = R_ROOM; + + for (i = top_row; i <= bottom_row; i++) { + for (j = left_col; j <= right_col; j++) { + if ((i == top_row) || (i == bottom_row)) { + ch = HORWALL; + } else if ( ((i != top_row) && (i != bottom_row)) && + ((j == left_col) || (j == right_col))) { + ch = VERTWALL; + } else { + ch = FLOOR; + } + dungeon[i][j] = ch; + } + } +END: + rooms[rn].top_row = top_row; + rooms[rn].bottom_row = bottom_row; + rooms[rn].left_col = left_col; + rooms[rn].right_col = right_col; +} + +int +connect_rooms(room1, room2) + short room1, room2; +{ + short row1, col1, row2, col2, dir; + + if ((!(rooms[room1].is_room & (R_ROOM | R_MAZE))) || + (!(rooms[room2].is_room & (R_ROOM | R_MAZE)))) { + return(0); + } + if (same_row(room1, room2) && + (rooms[room1].left_col > rooms[room2].right_col)) { + put_door(&rooms[room1], LEFT, &row1, &col1); + put_door(&rooms[room2], RIGHT, &row2, &col2); + dir = LEFT; + } else if (same_row(room1, room2) && + (rooms[room2].left_col > rooms[room1].right_col)) { + put_door(&rooms[room1], RIGHT, &row1, &col1); + put_door(&rooms[room2], LEFT, &row2, &col2); + dir = RIGHT; + } else if (same_col(room1, room2) && + (rooms[room1].top_row > rooms[room2].bottom_row)) { + put_door(&rooms[room1], UPWARD, &row1, &col1); + put_door(&rooms[room2], DOWN, &row2, &col2); + dir = UPWARD; + } else if (same_col(room1, room2) && + (rooms[room2].top_row > rooms[room1].bottom_row)) { + put_door(&rooms[room1], DOWN, &row1, &col1); + put_door(&rooms[room2], UPWARD, &row2, &col2); + dir = DOWN; + } else { + return(0); + } + + do { + draw_simple_passage(row1, col1, row2, col2, dir); + } while (rand_percent(4)); + + rooms[room1].doors[dir/2].oth_room = room2; + rooms[room1].doors[dir/2].oth_row = row2; + rooms[room1].doors[dir/2].oth_col = col2; + + rooms[room2].doors[(((dir+4)%DIRS)/2)].oth_room = room1; + rooms[room2].doors[(((dir+4)%DIRS)/2)].oth_row = row1; + rooms[room2].doors[(((dir+4)%DIRS)/2)].oth_col = col1; + return(1); +} + +void +clear_level() +{ + short i, j; + + for (i = 0; i < MAXROOMS; i++) { + rooms[i].is_room = R_NOTHING; + for (j = 0; j < 4; j++) { + rooms[i].doors[j].oth_room = NO_ROOM; + } + } + + for (i = 0; i < MAX_TRAPS; i++) { + traps[i].trap_type = NO_TRAP; + } + for (i = 0; i < DROWS; i++) { + for (j = 0; j < DCOLS; j++) { + dungeon[i][j] = NOTHING; + } + } + detect_monster = see_invisible = 0; + being_held = bear_trap = 0; + party_room = NO_ROOM; + rogue.row = rogue.col = -1; + clear(); +} + +void +put_door(rm, dir, row, col) + room *rm; + short dir; + short *row, *col; +{ + short wall_width; + + wall_width = (rm->is_room & R_MAZE) ? 0 : 1; + + switch(dir) { + case UPWARD: + case DOWN: + *row = ((dir == UPWARD) ? rm->top_row : rm->bottom_row); + do { + *col = get_rand(rm->left_col+wall_width, + rm->right_col-wall_width); + } while (!(dungeon[*row][*col] & (HORWALL | TUNNEL))); + break; + case RIGHT: + case LEFT: + *col = (dir == LEFT) ? rm->left_col : rm->right_col; + do { + *row = get_rand(rm->top_row+wall_width, + rm->bottom_row-wall_width); + } while (!(dungeon[*row][*col] & (VERTWALL | TUNNEL))); + break; + } + if (rm->is_room & R_ROOM) { + dungeon[*row][*col] = DOOR; + } + if ((cur_level > 2) && rand_percent(HIDE_PERCENT)) { + dungeon[*row][*col] |= HIDDEN; + } + rm->doors[dir/2].door_row = *row; + rm->doors[dir/2].door_col = *col; +} + +void +draw_simple_passage(row1, col1, row2, col2, dir) + short row1, col1, row2, col2, dir; +{ + short i, middle, t; + + if ((dir == LEFT) || (dir == RIGHT)) { + if (col1 > col2) { + swap(row1, row2); + swap(col1, col2); + } + middle = get_rand(col1+1, col2-1); + for (i = col1+1; i != middle; i++) { + dungeon[row1][i] = TUNNEL; + } + for (i = row1; i != row2; i += (row1 > row2) ? -1 : 1) { + dungeon[i][middle] = TUNNEL; + } + for (i = middle; i != col2; i++) { + dungeon[row2][i] = TUNNEL; + } + } else { + if (row1 > row2) { + swap(row1, row2); + swap(col1, col2); + } + middle = get_rand(row1+1, row2-1); + for (i = row1+1; i != middle; i++) { + dungeon[i][col1] = TUNNEL; + } + for (i = col1; i != col2; i += (col1 > col2) ? -1 : 1) { + dungeon[middle][i] = TUNNEL; + } + for (i = middle; i != row2; i++) { + dungeon[i][col2] = TUNNEL; + } + } + if (rand_percent(HIDE_PERCENT)) { + hide_boxed_passage(row1, col1, row2, col2, 1); + } +} + +int +same_row(room1, room2) + int room1, room2; +{ + return((room1 / 3) == (room2 / 3)); +} + +int +same_col(room1, room2) + int room1, room2; +{ + return((room1 % 3) == (room2 % 3)); +} + +void +add_mazes() +{ + short i, j; + short start; + short maze_percent; + + if (cur_level > 1) { + start = get_rand(0, (MAXROOMS-1)); + maze_percent = (cur_level * 5) / 4; + + if (cur_level > 15) { + maze_percent += cur_level; + } + for (i = 0; i < MAXROOMS; i++) { + j = ((start + i) % MAXROOMS); + if (rooms[j].is_room & R_NOTHING) { + if (rand_percent(maze_percent)) { + rooms[j].is_room = R_MAZE; + make_maze(get_rand(rooms[j].top_row+1, rooms[j].bottom_row-1), + get_rand(rooms[j].left_col+1, rooms[j].right_col-1), + rooms[j].top_row, rooms[j].bottom_row, + rooms[j].left_col, rooms[j].right_col); + hide_boxed_passage(rooms[j].top_row, rooms[j].left_col, + rooms[j].bottom_row, rooms[j].right_col, + get_rand(0, 2)); + } + } + } + } +} + +void +fill_out_level() +{ + short i, rn; + + mix_random_rooms(); + + r_de = NO_ROOM; + + for (i = 0; i < MAXROOMS; i++) { + rn = random_rooms[i]; + if ((rooms[rn].is_room & R_NOTHING) || + ((rooms[rn].is_room & R_CROSS) && coin_toss())) { + fill_it(rn, 1); + } + } + if (r_de != NO_ROOM) { + fill_it(r_de, 0); + } +} + +void +fill_it(rn, do_rec_de) + int rn; + boolean do_rec_de; +{ + short i, tunnel_dir, door_dir, drow, dcol; + short target_room, rooms_found = 0; + short srow, scol, t; + static short offsets[4] = {-1, 1, 3, -3}; + boolean did_this = 0; + + for (i = 0; i < 10; i++) { + srow = get_rand(0, 3); + scol = get_rand(0, 3); + t = offsets[srow]; + offsets[srow] = offsets[scol]; + offsets[scol] = t; + } + for (i = 0; i < 4; i++) { + + target_room = rn + offsets[i]; + + if (((target_room < 0) || (target_room >= MAXROOMS)) || + (!(same_row(rn,target_room) || same_col(rn,target_room))) || + (!(rooms[target_room].is_room & (R_ROOM | R_MAZE)))) { + continue; + } + if (same_row(rn, target_room)) { + tunnel_dir = (rooms[rn].left_col < rooms[target_room].left_col) ? + RIGHT : LEFT; + } else { + tunnel_dir = (rooms[rn].top_row < rooms[target_room].top_row) ? + DOWN : UPWARD; + } + door_dir = ((tunnel_dir + 4) % DIRS); + if (rooms[target_room].doors[door_dir/2].oth_room != NO_ROOM) { + continue; + } + if (((!do_rec_de) || did_this) || + (!mask_room(rn, &srow, &scol, TUNNEL))) { + srow = (rooms[rn].top_row + rooms[rn].bottom_row) / 2; + scol = (rooms[rn].left_col + rooms[rn].right_col) / 2; + } + put_door(&rooms[target_room], door_dir, &drow, &dcol); + rooms_found++; + draw_simple_passage(srow, scol, drow, dcol, tunnel_dir); + rooms[rn].is_room = R_DEADEND; + dungeon[srow][scol] = TUNNEL; + + if ((i < 3) && (!did_this)) { + did_this = 1; + if (coin_toss()) { + continue; + } + } + if ((rooms_found < 2) && do_rec_de) { + recursive_deadend(rn, offsets, srow, scol); + } + break; + } +} + +void +recursive_deadend(rn, offsets, srow, scol) + short rn; + const short *offsets; + short srow, scol; +{ + short i, de; + short drow, dcol, tunnel_dir; + + rooms[rn].is_room = R_DEADEND; + dungeon[srow][scol] = TUNNEL; + + for (i = 0; i < 4; i++) { + de = rn + offsets[i]; + if (((de < 0) || (de >= MAXROOMS)) || + (!(same_row(rn, de) || same_col(rn, de)))) { + continue; + } + if (!(rooms[de].is_room & R_NOTHING)) { + continue; + } + drow = (rooms[de].top_row + rooms[de].bottom_row) / 2; + dcol = (rooms[de].left_col + rooms[de].right_col) / 2; + if (same_row(rn, de)) { + tunnel_dir = (rooms[rn].left_col < rooms[de].left_col) ? + RIGHT : LEFT; + } else { + tunnel_dir = (rooms[rn].top_row < rooms[de].top_row) ? + DOWN : UPWARD; + } + draw_simple_passage(srow, scol, drow, dcol, tunnel_dir); + r_de = de; + recursive_deadend(de, offsets, drow, dcol); + } +} + +boolean +mask_room(rn, row, col, mask) + short rn; + short *row, *col; + unsigned short mask; +{ + short i, j; + + for (i = rooms[rn].top_row; i <= rooms[rn].bottom_row; i++) { + for (j = rooms[rn].left_col; j <= rooms[rn].right_col; j++) { + if (dungeon[i][j] & mask) { + *row = i; + *col = j; + return(1); + } + } + } + return(0); +} + +void +make_maze(r, c, tr, br, lc, rc) + short r, c, tr, br, lc, rc; +{ + char dirs[4]; + short i, t; + + dirs[0] = UPWARD; + dirs[1] = DOWN; + dirs[2] = LEFT; + dirs[3] = RIGHT; + + dungeon[r][c] = TUNNEL; + + if (rand_percent(20)) { + for (i = 0; i < 10; i++) { + short t1, t2; + + t1 = get_rand(0, 3); + t2 = get_rand(0, 3); + + swap(dirs[t1], dirs[t2]); + } + } + for (i = 0; i < 4; i++) { + switch(dirs[i]) { + case UPWARD: + if (((r-1) >= tr) && + (dungeon[r-1][c] != TUNNEL) && + (dungeon[r-1][c-1] != TUNNEL) && + (dungeon[r-1][c+1] != TUNNEL) && + (dungeon[r-2][c] != TUNNEL)) { + make_maze((r-1), c, tr, br, lc, rc); + } + break; + case DOWN: + if (((r+1) <= br) && + (dungeon[r+1][c] != TUNNEL) && + (dungeon[r+1][c-1] != TUNNEL) && + (dungeon[r+1][c+1] != TUNNEL) && + (dungeon[r+2][c] != TUNNEL)) { + make_maze((r+1), c, tr, br, lc, rc); + } + break; + case LEFT: + if (((c-1) >= lc) && + (dungeon[r][c-1] != TUNNEL) && + (dungeon[r-1][c-1] != TUNNEL) && + (dungeon[r+1][c-1] != TUNNEL) && + (dungeon[r][c-2] != TUNNEL)) { + make_maze(r, (c-1), tr, br, lc, rc); + } + break; + case RIGHT: + if (((c+1) <= rc) && + (dungeon[r][c+1] != TUNNEL) && + (dungeon[r-1][c+1] != TUNNEL) && + (dungeon[r+1][c+1] != TUNNEL) && + (dungeon[r][c+2] != TUNNEL)) { + make_maze(r, (c+1), tr, br, lc, rc); + } + break; + } + } +} + +void +hide_boxed_passage(row1, col1, row2, col2, n) + short row1, col1, row2, col2, n; +{ + short i, j, t; + short row, col, row_cut, col_cut; + short h, w; + + if (cur_level > 2) { + if (row1 > row2) { + swap(row1, row2); + } + if (col1 > col2) { + swap(col1, col2); + } + h = row2 - row1; + w = col2 - col1; + + if ((w >= 5) || (h >= 5)) { + row_cut = ((h >= 2) ? 1 : 0); + col_cut = ((w >= 2) ? 1 : 0); + + for (i = 0; i < n; i++) { + for (j = 0; j < 10; j++) { + row = get_rand(row1 + row_cut, row2 - row_cut); + col = get_rand(col1 + col_cut, col2 - col_cut); + if (dungeon[row][col] == TUNNEL) { + dungeon[row][col] |= HIDDEN; + break; + } + } + } + } + } +} + +void +put_player(nr) + short nr; /* try not to put in this room */ +{ + short rn = nr, misses; + short row, col; + + for (misses = 0; ((misses < 2) && (rn == nr)); misses++) { + gr_row_col(&row, &col, (FLOOR | TUNNEL | OBJECT | STAIRS)); + rn = get_room_number(row, col); + } + rogue.row = row; + rogue.col = col; + + if (dungeon[rogue.row][rogue.col] & TUNNEL) { + cur_room = PASSAGE; + } else { + cur_room = rn; + } + if (cur_room != PASSAGE) { + light_up_room(cur_room); + } else { + light_passage(rogue.row, rogue.col); + } + rn = get_room_number(rogue.row, rogue.col); + wake_room(rn, 1, rogue.row, rogue.col); + if (new_level_message) { + message(new_level_message, 0); + new_level_message = 0; + } + mvaddch(rogue.row, rogue.col, rogue.fchar); +} + +int +drop_check() +{ + if (wizard) { + return(1); + } + if (dungeon[rogue.row][rogue.col] & STAIRS) { + if (levitate) { + message("you're floating in the air!", 0); + return(0); + } + return(1); + } + message("I see no way down", 0); + return(0); +} + +int +check_up() +{ + if (!wizard) { + if (!(dungeon[rogue.row][rogue.col] & STAIRS)) { + message("I see no way up", 0); + return(0); + } + if (!has_amulet()) { + message("your way is magically blocked", 0); + return(0); + } + } + new_level_message = "you feel a wrenching sensation in your gut"; + if (cur_level == 1) { + win(); + } else { + cur_level -= 2; + return(1); + } + return(0); +} + +void +add_exp(e, promotion) + int e; + boolean promotion; +{ + char mbuf[40]; + short new_exp; + short i, hp; + + rogue.exp_points += e; + + if (rogue.exp_points >= level_points[rogue.exp-1]) { + new_exp = get_exp_level(rogue.exp_points); + if (rogue.exp_points > MAX_EXP) { + rogue.exp_points = MAX_EXP + 1; + } + for (i = rogue.exp+1; i <= new_exp; i++) { + sprintf(mbuf, "welcome to level %d", i); + message(mbuf, 0); + if (promotion) { + hp = hp_raise(); + rogue.hp_current += hp; + rogue.hp_max += hp; + } + rogue.exp = i; + print_stats(STAT_HP | STAT_EXP); + } + } else { + print_stats(STAT_EXP); + } +} + +int +get_exp_level(e) + long e; +{ + short i; + + for (i = 0; i < (MAX_EXP_LEVEL - 1); i++) { + if (level_points[i] > e) { + break; + } + } + return(i+1); +} + +int +hp_raise() +{ + int hp; + + hp = (wizard ? 10 : get_rand(3, 10)); + return(hp); +} + +void +show_average_hp() +{ + char mbuf[80]; + float real_average; + float effective_average; + + if (rogue.exp == 1) { + real_average = effective_average = 0.00; + } else { + real_average = (float) + ((rogue.hp_max - extra_hp - INIT_HP) + less_hp) / (rogue.exp - 1); + effective_average = (float) (rogue.hp_max - INIT_HP) / (rogue.exp - 1); + + } + sprintf(mbuf, "R-Hp: %.2f, E-Hp: %.2f (!: %d, V: %d)", real_average, + effective_average, extra_hp, less_hp); + message(mbuf, 0); +} + +void +mix_random_rooms() +{ + short i, t; + short x, y; + + for (i = 0; i < (3 * MAXROOMS); i++) { + do { + x = get_rand(0, (MAXROOMS-1)); + y = get_rand(0, (MAXROOMS-1)); + } while (x == y); + swap(random_rooms[x], random_rooms[y]); + } +} diff --git a/rogue/machdep.c b/rogue/machdep.c new file mode 100644 index 0000000..afd69dd --- /dev/null +++ b/rogue/machdep.c @@ -0,0 +1,493 @@ +/* $NetBSD: machdep.c,v 1.13 2005/02/15 12:56:20 jsm Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)machdep.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: machdep.c,v 1.13 2005/02/15 12:56:20 jsm Exp $"); +#endif +#endif /* not lint */ + +/* + * machdep.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +/* Included in this file are all system dependent routines. Extensive use + * of #ifdef's will be used to compile the appropriate code on each system: + * + * UNIX: all UNIX systems. + * UNIX_BSD4_2: UNIX BSD 4.2 and later, UTEK, (4.1 BSD too?) + * UNIX_SYSV: UNIX system V + * UNIX_V7: UNIX version 7 + * + * All UNIX code should be included between the single "#ifdef UNIX" at the + * top of this file, and the "#endif" at the bottom. + * + * To change a routine to include a new UNIX system, simply #ifdef the + * existing routine, as in the following example: + * + * To make a routine compatible with UNIX system 5, change the first + * function to the second: + * + * md_function() + * { + * code; + * } + * + * md_function() + * { + * #ifdef UNIX_SYSV + * sys5code; + * #else + * code; + * #endif + * } + * + * Appropriate variations of this are of course acceptible. + * The use of "#elseif" is discouraged because of non-portability. + * If the correct #define doesn't exist, "UNIX_SYSV" in this case, make it up + * and insert it in the list at the top of the file. Alter the CFLAGS + * in you Makefile appropriately. + * + */ + +#ifdef UNIX + +#include +#include +#include +#include +#include + +#ifdef UNIX_BSD4_2 +#include +#endif + +#ifdef UNIX_SYSV +#include +#endif + +#include +#include +#include +#include +#include "rogue.h" +#include "pathnames.h" + +/* md_slurp: + * + * This routine throws away all keyboard input that has not + * yet been read. It is used to get rid of input that the user may have + * typed-ahead. + * + * This function is not necessary, so it may be stubbed. The might cause + * message-line output to flash by because the game has continued to read + * input without waiting for the user to read the message. Not such a + * big deal. + */ + +void +md_slurp() +{ + tcflush(0, TCIFLUSH); +} + +/* md_heed_signals(): + * + * This routine tells the program to call particular routines when + * certain interrupts/events occur: + * + * SIGINT: call onintr() to interrupt fight with monster or long rest. + * SIGQUIT: call byebye() to check for game termination. + * SIGHUP: call error_save() to save game when terminal hangs up. + * + * On VMS, SIGINT and SIGQUIT correspond to ^C and ^Y. + * + * This routine is not strictly necessary and can be stubbed. This will + * mean that the game cannot be interrupted properly with keyboard + * input, this is not usually critical. + */ + +void +md_heed_signals() +{ + signal(SIGINT, onintr); + signal(SIGQUIT, byebye); + signal(SIGHUP, error_save); +} + +/* md_ignore_signals(): + * + * This routine tells the program to completely ignore the events mentioned + * in md_heed_signals() above. The event handlers will later be turned on + * by a future call to md_heed_signals(), so md_heed_signals() and + * md_ignore_signals() need to work together. + * + * This function should be implemented or the user risks interrupting + * critical sections of code, which could cause score file, or saved-game + * file, corruption. + */ + +void +md_ignore_signals() +{ + signal(SIGQUIT, SIG_IGN); + signal(SIGINT, SIG_IGN); + signal(SIGHUP, SIG_IGN); +} + +/* md_get_file_id(): + * + * This function returns an integer that uniquely identifies the specified + * file. It need not check for the file's existence. In UNIX, the inode + * number is used. + * + * This function is used to identify saved-game files. + */ + +int +md_get_file_id(fname) + const char *fname; +{ + struct stat sbuf; + + if (stat(fname, &sbuf)) { + return(-1); + } + return((int) sbuf.st_ino); +} + +/* md_link_count(): + * + * This routine returns the number of hard links to the specified file. + * + * This function is not strictly necessary. On systems without hard links + * this routine can be stubbed by just returning 1. + */ + +int +md_link_count(fname) + const char *fname; +{ + struct stat sbuf; + + stat(fname, &sbuf); + return((int) sbuf.st_nlink); +} + +/* md_gct(): (Get Current Time) + * + * This function returns the current year, month(1-12), day(1-31), hour(0-23), + * minute(0-59), and second(0-59). This is used for identifying the time + * at which a game is saved. + * + * This function is not strictly necessary. It can be stubbed by returning + * zeros instead of the correct year, month, etc. If your operating + * system doesn't provide all of the time units requested here, then you + * can provide only those that it does, and return zeros for the others. + * If you cannot provide good time values, then users may be able to copy + * saved-game files and play them. + */ + +void +md_gct(rt_buf) + struct rogue_time *rt_buf; +{ + struct tm *t; + time_t seconds; + + time(&seconds); + t = localtime(&seconds); + + rt_buf->year = t->tm_year; + rt_buf->month = t->tm_mon + 1; + rt_buf->day = t->tm_mday; + rt_buf->hour = t->tm_hour; + rt_buf->minute = t->tm_min; + rt_buf->second = t->tm_sec; +} + +/* md_gfmt: (Get File Modification Time) + * + * This routine returns a file's date of last modification in the same format + * as md_gct() above. + * + * This function is not strictly necessary. It is used to see if saved-game + * files have been modified since they were saved. If you have stubbed the + * routine md_gct() above by returning constant values, then you may do + * exactly the same here. + * Or if md_gct() is implemented correctly, but your system does not provide + * file modification dates, you may return some date far in the past so + * that the program will never know that a saved-game file being modified. + * You may also do this if you wish to be able to restore games from + * saved-games that have been modified. + */ + +void +md_gfmt(fname, rt_buf) + const char *fname; + struct rogue_time *rt_buf; +{ + struct stat sbuf; + time_t seconds; + struct tm *t; + + stat(fname, &sbuf); + seconds = (long) sbuf.st_mtime; + t = localtime(&seconds); + + rt_buf->year = t->tm_year; + rt_buf->month = t->tm_mon + 1; + rt_buf->day = t->tm_mday; + rt_buf->hour = t->tm_hour; + rt_buf->minute = t->tm_min; + rt_buf->second = t->tm_sec; +} + +/* md_df: (Delete File) + * + * This function deletes the specified file, and returns true (1) if the + * operation was successful. This is used to delete saved-game files + * after restoring games from them. + * + * Again, this function is not strictly necessary, and can be stubbed + * by simply returning 1. In this case, saved-game files will not be + * deleted and can be replayed. + */ + +boolean +md_df(fname) + const char *fname; +{ + if (unlink(fname)) { + return(0); + } + return(1); +} + +/* md_gln: (Get login name) + * + * This routine returns the login name of the user. This string is + * used mainly for identifying users in score files. + * + * A dummy string may be returned if you are unable to implement this + * function, but then the score file would only have one name in it. + */ + +const char * +md_gln() +{ + struct passwd *p; + + if (!(p = getpwuid(getuid()))) + return((char *)NULL); + return(p->pw_name); +} + +/* md_sleep: + * + * This routine causes the game to pause for the specified number of + * seconds. + * + * This routine is not particularly necessary at all. It is used for + * delaying execution, which is useful to this program at some times. + */ + +void +md_sleep(nsecs) + int nsecs; +{ + (void) sleep(nsecs); +} + +/* md_getenv() + * + * This routine gets certain values from the user's environment. These + * values are strings, and each string is identified by a name. The names + * of the values needed, and their use, is as follows: + * + * ROGUEOPTS + * A string containing the various game options. This need not be + * defined. + * HOME + * The user's home directory. This is only used when the user specifies + * '~' as the first character of a saved-game file. This string need + * not be defined. + * SHELL + * The user's favorite shell. If not found, "/bin/sh" is assumed. + * + * If your system does not provide a means of searching for these values, + * you will have to do it yourself. None of the values above really need + * to be defined; you can get by with simply always returning zero. + * Returning zero indicates that their is no defined value for the + * given string. + */ + +char * +md_getenv(name) + const char *name; +{ + char *value; + + value = getenv(name); + + return(value); +} + +/* md_malloc() + * + * This routine allocates, and returns a pointer to, the specified number + * of bytes. This routines absolutely MUST be implemented for your + * particular system or the program will not run at all. Return zero + * when no more memory can be allocated. + */ + +char * +md_malloc(n) + int n; +{ + char *t; + + t = malloc(n); + return(t); +} + +/* md_gseed() (Get Seed) + * + * This function returns a seed for the random number generator (RNG). This + * seed causes the RNG to begin generating numbers at some point in it's + * sequence. Without a random seed, the RNG will generate the same set + * of numbers, and every game will start out exactly the same way. A good + * number to use is the process id, given by getpid() on most UNIX systems. + * + * You need to find some single random integer, such as: + * process id. + * current time (minutes + seconds) returned from md_gct(), if implemented. + * + * It will not help to return "get_rand()" or "rand()" or the return value of + * any pseudo-RNG. If you don't have a random number, you can just return 1, + * but this means your games will ALWAYS start the same way, and will play + * exactly the same way given the same input. + */ + +int +md_gseed() +{ + time_t seconds; + + time(&seconds); + return((int) seconds); +} + +/* md_exit(): + * + * This function causes the program to discontinue execution and exit. + * This function must be implemented or the program will continue to + * hang when it should quit. + */ + +void +md_exit(status) + int status; +{ + exit(status); +} + +/* md_lock(): + * + * This function is intended to give the user exclusive access to the score + * file. It does so by flock'ing the score file. The full path name of the + * score file should be defined for any particular site in rogue.h. The + * constants _PATH_SCOREFILE defines this file name. + * + * When the parameter 'l' is non-zero (true), a lock is requested. Otherwise + * the lock is released. + */ + +void +md_lock(l) + boolean l; +{ + static int fd; + short tries; + + if (l) { + setegid(egid); + if ((fd = open(_PATH_SCOREFILE, O_RDONLY)) < 1) { + setegid(gid); + message("cannot lock score file", 0); + return; + } + setegid(gid); + for (tries = 0; tries < 5; tries++) + if (!flock(fd, LOCK_EX|LOCK_NB)) + return; + } else { + (void)flock(fd, LOCK_NB); + (void)close(fd); + } +} + +/* md_shell(): + * + * This function spawns a shell for the user to use. When this shell is + * terminated, the game continues. Since this program may often be run + * setuid to gain access to privileged files, care is taken that the shell + * is run with the user's REAL user id, and not the effective user id. + * The effective user id is restored after the shell completes. + */ + +void +md_shell(shell) + const char *shell; +{ + int w; + + if (!fork()) { + execl(shell, shell, (char *) 0); + } + wait(&w); +} + +#endif diff --git a/rogue/main.c b/rogue/main.c new file mode 100644 index 0000000..3bd75fe --- /dev/null +++ b/rogue/main.c @@ -0,0 +1,88 @@ +/* $NetBSD: main.c,v 1.6 2004/01/27 20:30:30 jsm Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +__COPYRIGHT("@(#) Copyright (c) 1988, 1993\n\ + The Regents of the University of California. All rights reserved.\n"); +#endif /* not lint */ + +#ifndef lint +#if 0 +static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: main.c,v 1.6 2004/01/27 20:30:30 jsm Exp $"); +#endif +#endif /* not lint */ + +/* + * main.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include "rogue.h" + +int main(int, char **); + +int +main(argc, argv) + int argc; + char *argv[]; +{ + if (init(argc, argv)) { /* restored game */ + goto PL; + } + + for (;;) { + clear_level(); + make_level(); + put_objects(); + put_stairs(); + add_traps(); + put_mons(); + put_player(party_room); + print_stats(STAT_ALL); +PL: + play_level(); + free_stuff(&level_objects); + free_stuff(&level_monsters); + } +} diff --git a/rogue/message.c b/rogue/message.c new file mode 100644 index 0000000..3e30e04 --- /dev/null +++ b/rogue/message.c @@ -0,0 +1,391 @@ +/* $NetBSD: message.c,v 1.10 2003/08/07 09:37:38 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)message.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: message.c,v 1.10 2003/08/07 09:37:38 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * message.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include +#include +#include "rogue.h" + +char msgs[NMESSAGES][DCOLS] = {"", "", "", "", ""}; +short msg_col = 0, imsg = -1; +boolean msg_cleared = 1, rmsg = 0; +char hunger_str[HUNGER_STR_LEN] = ""; +const char *more = "-more-"; + +void +message(msg, intrpt) + const char *msg; + boolean intrpt; +{ + cant_int = 1; + + if (!save_is_interactive) { + return; + } + if (intrpt) { + interrupted = 1; + md_slurp(); + } + + if (!msg_cleared) { + mvaddstr(MIN_ROW-1, msg_col, more); + refresh(); + wait_for_ack(); + check_message(); + } + if (!rmsg) { + imsg = (imsg + 1) % NMESSAGES; + (void) strcpy(msgs[imsg], msg); + } + mvaddstr(MIN_ROW-1, 0, msg); + addch(' '); + refresh(); + msg_cleared = 0; + msg_col = strlen(msg); + + cant_int = 0; + + if (did_int) { + did_int = 0; + onintr(0); + } +} + +void +remessage(c) + short c; +{ + if (imsg != -1) { + check_message(); + rmsg = 1; + while (c > imsg) { + c -= NMESSAGES; + } + message(msgs[((imsg - c) % NMESSAGES)], 0); + rmsg = 0; + move(rogue.row, rogue.col); + refresh(); + } +} + +void +check_message() +{ + if (msg_cleared) { + return; + } + move(MIN_ROW-1, 0); + clrtoeol(); + refresh(); + msg_cleared = 1; +} + +int +get_input_line(prompt, insert, buf, if_cancelled, add_blank, do_echo) + const char *prompt, *insert; + char *buf; + const char *if_cancelled; + boolean add_blank; + boolean do_echo; +{ + short ch; + short i = 0, n; + + message(prompt, 0); + n = strlen(prompt); + + if (insert[0]) { + mvaddstr(0, n + 1, insert); + (void) strcpy(buf, insert); + i = strlen(insert); + move(0, (n + i + 1)); + refresh(); + } + + while (((ch = rgetchar()) != '\r') && (ch != '\n') && (ch != CANCEL)) { + if ((ch >= ' ') && (ch <= '~') && (i < MAX_TITLE_LENGTH-2)) { + if ((ch != ' ') || (i > 0)) { + buf[i++] = ch; + if (do_echo) { + addch(ch); + } + } + } + if ((ch == '\b') && (i > 0)) { + if (do_echo) { + mvaddch(0, i + n, ' '); + move(MIN_ROW-1, i+n); + } + i--; + } + refresh(); + } + check_message(); + if (add_blank) { + buf[i++] = ' '; + } else { + while ((i > 0) && (buf[i-1] == ' ')) { + i--; + } + } + + buf[i] = 0; + + if ((ch == CANCEL) || (i == 0) || ((i == 1) && add_blank)) { + if (if_cancelled) { + message(if_cancelled, 0); + } + return(0); + } + return(i); +} + +int +rgetchar() +{ + int ch; + + for(;;) { + ch = getchar(); + + switch(ch) { + case '\022': + wrefresh(curscr); + break; +#ifdef UNIX_BSD4_2 + case '\032': + printf("%s", CL); + fflush(stdout); + tstp(); + break; +#endif + case '&': + save_screen(); + break; + default: + return(ch); + } + } +} + +/* +Level: 99 Gold: 999999 Hp: 999(999) Str: 99(99) Arm: 99 Exp: 21/10000000 Hungry +0 5 1 5 2 5 3 5 4 5 5 5 6 5 7 5 +*/ + +void +print_stats(stat_mask) + int stat_mask; +{ + char buf[16]; + boolean label; + int row = DROWS - 1; + + label = (stat_mask & STAT_LABEL) ? 1 : 0; + + if (stat_mask & STAT_LEVEL) { + if (label) { + mvaddstr(row, 0, "Level: "); + } + /* max level taken care of in make_level() */ + sprintf(buf, "%d", cur_level); + mvaddstr(row, 7, buf); + pad(buf, 2); + } + if (stat_mask & STAT_GOLD) { + if (label) { + mvaddstr(row, 10, "Gold: "); + } + if (rogue.gold > MAX_GOLD) { + rogue.gold = MAX_GOLD; + } + sprintf(buf, "%ld", rogue.gold); + mvaddstr(row, 16, buf); + pad(buf, 6); + } + if (stat_mask & STAT_HP) { + if (label) { + mvaddstr(row, 23, "Hp: "); + } + if (rogue.hp_max > MAX_HP) { + rogue.hp_current -= (rogue.hp_max - MAX_HP); + rogue.hp_max = MAX_HP; + } + sprintf(buf, "%d(%d)", rogue.hp_current, rogue.hp_max); + mvaddstr(row, 27, buf); + pad(buf, 8); + } + if (stat_mask & STAT_STRENGTH) { + if (label) { + mvaddstr(row, 36, "Str: "); + } + if (rogue.str_max > MAX_STRENGTH) { + rogue.str_current -= (rogue.str_max - MAX_STRENGTH); + rogue.str_max = MAX_STRENGTH; + } + sprintf(buf, "%d(%d)", (rogue.str_current + add_strength), + rogue.str_max); + mvaddstr(row, 41, buf); + pad(buf, 6); + } + if (stat_mask & STAT_ARMOR) { + if (label) { + mvaddstr(row, 48, "Arm: "); + } + if (rogue.armor && (rogue.armor->d_enchant > MAX_ARMOR)) { + rogue.armor->d_enchant = MAX_ARMOR; + } + sprintf(buf, "%d", get_armor_class(rogue.armor)); + mvaddstr(row, 53, buf); + pad(buf, 2); + } + if (stat_mask & STAT_EXP) { + if (label) { + mvaddstr(row, 56, "Exp: "); + } + if (rogue.exp_points > MAX_EXP) { + rogue.exp_points = MAX_EXP; + } + if (rogue.exp > MAX_EXP_LEVEL) { + rogue.exp = MAX_EXP_LEVEL; + } + sprintf(buf, "%d/%ld", rogue.exp, rogue.exp_points); + mvaddstr(row, 61, buf); + pad(buf, 11); + } + if (stat_mask & STAT_HUNGER) { + mvaddstr(row, 73, hunger_str); + clrtoeol(); + } + refresh(); +} + +void +pad(s, n) + const char *s; + short n; +{ + short i; + + for (i = strlen(s); i < n; i++) { + addch(' '); + } +} + +void +save_screen() +{ + FILE *fp; + short i, j; + char buf[DCOLS+2]; + boolean found_non_blank; + + if ((fp = fopen("rogue.screen", "w")) != NULL) { + for (i = 0; i < DROWS; i++) { + found_non_blank = 0; + for (j = (DCOLS - 1); j >= 0; j--) { + buf[j] = mvinch(i, j); + if (!found_non_blank) { + if ((buf[j] != ' ') || (j == 0)) { + buf[j + ((j == 0) ? 0 : 1)] = 0; + found_non_blank = 1; + } + } + } + fputs(buf, fp); + putc('\n', fp); + } + fclose(fp); + } else { + sound_bell(); + } +} + +void +sound_bell() +{ + putchar(7); + fflush(stdout); +} + +boolean +is_digit(ch) + short ch; +{ + return((ch >= '0') && (ch <= '9')); +} + +int +r_index(str, ch, last) + const char *str; + int ch; + boolean last; +{ + int i = 0; + + if (last) { + for (i = strlen(str) - 1; i >= 0; i--) { + if (str[i] == ch) { + return(i); + } + } + } else { + for (i = 0; str[i]; i++) { + if (str[i] == ch) { + return(i); + } + } + } + return(-1); +} diff --git a/rogue/monster.c b/rogue/monster.c new file mode 100644 index 0000000..2bcc25d --- /dev/null +++ b/rogue/monster.c @@ -0,0 +1,900 @@ +/* $NetBSD: monster.c,v 1.8 2003/08/07 09:37:38 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)monster.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: monster.c,v 1.8 2003/08/07 09:37:38 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * monster.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include "rogue.h" + +object level_monsters; +boolean mon_disappeared; + +const char *const m_names[] = { + "aquator", + "bat", + "centaur", + "dragon", + "emu", + "venus fly-trap", + "griffin", + "hobgoblin", + "ice monster", + "jabberwock", + "kestrel", + "leprechaun", + "medusa", + "nymph", + "orc", + "phantom", + "quagga", + "rattlesnake", + "snake", + "troll", + "black unicorn", + "vampire", + "wraith", + "xeroc", + "yeti", + "zombie" +}; + +object mon_tab[MONSTERS] = { + {(ASLEEP|WAKENS|WANDERS|RUSTS),"0d0",25,'A',20,9,18,100,0,0,0,0,0}, + {(ASLEEP|WANDERS|FLITS|FLIES),"1d3",10,'B',2,1,8,60,0,0,0,0,0}, + {(ASLEEP|WANDERS),"3d3/2d5",32,'C',15,7,16,85,0,10,0,0,0}, + {(ASLEEP|WAKENS|FLAMES),"4d6/4d9",145,'D',5000,21,126,100,0,90,0,0,0}, + {(ASLEEP|WAKENS),"1d3",11,'E',2,1,7,65,0,0,0,0,0}, + {(HOLDS|STATIONARY),"5d5",73,'F',91,12,126,80,0,0,0,0,0}, + {(ASLEEP|WAKENS|WANDERS|FLIES),"5d5/5d5",115,'G', + 2000,20,126,85,0,10,0,0,0}, + {(ASLEEP|WAKENS|WANDERS),"1d3/1d2",15,'H',3,1,10,67,0,0,0,0,0}, + {(ASLEEP|FREEZES),"0d0",15,'I',5,2,11,68,0,0,0,0,0}, + {(ASLEEP|WANDERS),"3d10/4d5",132,'J',3000,21,126,100,0,0,0,0,0}, + {(ASLEEP|WAKENS|WANDERS|FLIES),"1d4",10,'K',2,1,6,60,0,0,0,0,0}, + {(ASLEEP|STEALS_GOLD),"0d0",25,'L',21,6,16,75,0,0,0,0,0}, + {(ASLEEP|WAKENS|WANDERS|CONFUSES),"4d4/3d7",97,'M', + 250,18,126,85,0,25,0,0,0}, + {(ASLEEP|STEALS_ITEM),"0d0",25,'N',39,10,19,75,0,100,0,0,0}, + {(ASLEEP|WANDERS|WAKENS|SEEKS_GOLD),"1d6",25,'O',5,4,13,70,0,10,0,0,0}, + {(ASLEEP|INVISIBLE|WANDERS|FLITS),"5d4",76,'P',120,15,24,80,0,50,0,0,0}, + {(ASLEEP|WAKENS|WANDERS),"3d5",30,'Q',20,8,17,78,0,20,0,0,0}, + {(ASLEEP|WAKENS|WANDERS|STINGS),"2d5",19,'R',10,3,12,70,0,0,0,0,0}, + {(ASLEEP|WAKENS|WANDERS),"1d3",8,'S',2,1,9,50,0,0,0,0,0}, + {(ASLEEP|WAKENS|WANDERS),"4d6/1d4",75,'T',125,13,22,75,0,33,0,0,0}, + {(ASLEEP|WAKENS|WANDERS),"4d10",90,'U', + 200,17,26,85,0,33,0,0,0}, + {(ASLEEP|WAKENS|WANDERS|DRAINS_LIFE),"1d14/1d4",55,'V', + 350,19,126,85,0,18,0,0,0}, + {(ASLEEP|WANDERS|DROPS_LEVEL),"2d8",45,'W',55,14,23,75,0,0,0,0,0}, + {(ASLEEP|IMITATES),"4d6",42,'X',110,16,25,75,0,0,0,0,0}, + {(ASLEEP|WANDERS),"3d6",35,'Y',50,11,20,80,0,20,0,0,0}, + {(ASLEEP|WAKENS|WANDERS),"1d7",21,'Z',8,5,14,69,0,0,0,0,0} +}; + +void +put_mons() +{ + short i; + short n; + object *monster; + short row, col; + + n = get_rand(4, 6); + + for (i = 0; i < n; i++) { + monster = gr_monster((object *) 0, 0); + if ((monster->m_flags & WANDERS) && coin_toss()) { + wake_up(monster); + } + gr_row_col(&row, &col, (FLOOR | TUNNEL | STAIRS | OBJECT)); + put_m_at(row, col, monster); + } +} + +object * +gr_monster(monster, mn) + object *monster; + int mn; +{ + if (!monster) { + monster = alloc_object(); + + for (;;) { + mn = get_rand(0, MONSTERS-1); + if ((cur_level >= mon_tab[mn].first_level) && + (cur_level <= mon_tab[mn].last_level)) { + break; + } + } + } + *monster = mon_tab[mn]; + if (monster->m_flags & IMITATES) { + monster->disguise = gr_obj_char(); + } + if (cur_level > (AMULET_LEVEL + 2)) { + monster->m_flags |= HASTED; + } + monster->trow = NO_ROOM; + return(monster); +} + +void +mv_mons() +{ + object *monster, *next_monster, *test_mons; + boolean flew; + + if (haste_self % 2) { + return; + } + + monster = level_monsters.next_monster; + + while (monster) { + next_monster = monster->next_monster; + mon_disappeared = 0; + if (monster->m_flags & HASTED) { + mv_1_monster(monster, rogue.row, rogue.col); + if (mon_disappeared) { + goto NM; + } + } else if (monster->m_flags & SLOWED) { + monster->slowed_toggle = !monster->slowed_toggle; + if (monster->slowed_toggle) { + goto NM; + } + } + if ((monster->m_flags & CONFUSED) && move_confused(monster)) { + goto NM; + } + flew = 0; + if ( (monster->m_flags & FLIES) && + !(monster->m_flags & NAPPING) && + !mon_can_go(monster, rogue.row, rogue.col)) { + flew = 1; + mv_1_monster(monster, rogue.row, rogue.col); + if (mon_disappeared) { + goto NM; + } + } + if (!(flew && mon_can_go(monster, rogue.row, rogue.col))) { + mv_1_monster(monster, rogue.row, rogue.col); + } +NM: test_mons = level_monsters.next_monster; + monster = NULL; + while (test_mons) + { + if (next_monster == test_mons) + { + monster = next_monster; + break; + } + test_mons = test_mons -> next_monster; + } + } +} + +void +party_monsters(rn, n) + int rn, n; +{ + short i, j; + short row, col; + object *monster; + boolean found; + + row = col = 0; + n += n; + + for (i = 0; i < MONSTERS; i++) { + mon_tab[i].first_level -= (cur_level % 3); + } + for (i = 0; i < n; i++) { + if (no_room_for_monster(rn)) { + break; + } + for (j = found = 0; ((!found) && (j < 250)); j++) { + row = get_rand(rooms[rn].top_row+1, + rooms[rn].bottom_row-1); + col = get_rand(rooms[rn].left_col+1, + rooms[rn].right_col-1); + if ((!(dungeon[row][col] & MONSTER)) && + (dungeon[row][col] & (FLOOR | TUNNEL))) { + found = 1; + } + } + if (found) { + monster = gr_monster((object *) 0, 0); + if (!(monster->m_flags & IMITATES)) { + monster->m_flags |= WAKENS; + } + put_m_at(row, col, monster); + } + } + for (i = 0; i < MONSTERS; i++) { + mon_tab[i].first_level += (cur_level % 3); + } +} + +char +gmc_row_col(row, col) + int row, col; +{ + object *monster; + + if ((monster = object_at(&level_monsters, row, col)) != NULL) { + if ((!(detect_monster || see_invisible || r_see_invisible) && + (monster->m_flags & INVISIBLE)) || blind) { + return(monster->trail_char); + } + if (monster->m_flags & IMITATES) { + return(monster->disguise); + } + return(monster->m_char); + } else { + return('&'); /* BUG if this ever happens */ + } +} + +char +gmc(monster) + object *monster; +{ + if ((!(detect_monster || see_invisible || r_see_invisible) && + (monster->m_flags & INVISIBLE)) + || blind) { + return(monster->trail_char); + } + if (monster->m_flags & IMITATES) { + return(monster->disguise); + } + return(monster->m_char); +} + +void +mv_1_monster(monster, row, col) + object *monster; + short row, col; +{ + short i, n; + boolean tried[6]; + + if (monster->m_flags & ASLEEP) { + if (monster->m_flags & NAPPING) { + if (--monster->nap_length <= 0) { + monster->m_flags &= (~(NAPPING | ASLEEP)); + } + return; + } + if ((monster->m_flags & WAKENS) && + rogue_is_around(monster->row, monster->col) && + rand_percent(((stealthy > 0) ? + (WAKE_PERCENT / (STEALTH_FACTOR + stealthy)) : + WAKE_PERCENT))) { + wake_up(monster); + } + return; + } else if (monster->m_flags & ALREADY_MOVED) { + monster->m_flags &= (~ALREADY_MOVED); + return; + } + if ((monster->m_flags & FLITS) && flit(monster)) { + return; + } + if ((monster->m_flags & STATIONARY) && + (!mon_can_go(monster, rogue.row, rogue.col))) { + return; + } + if (monster->m_flags & FREEZING_ROGUE) { + return; + } + if ((monster->m_flags & CONFUSES) && m_confuse(monster)) { + return; + } + if (mon_can_go(monster, rogue.row, rogue.col)) { + mon_hit(monster); + return; + } + if ((monster->m_flags & FLAMES) && flame_broil(monster)) { + return; + } + if ((monster->m_flags & SEEKS_GOLD) && seek_gold(monster)) { + return; + } + if ((monster->trow == monster->row) && + (monster->tcol == monster->col)) { + monster->trow = NO_ROOM; + } else if (monster->trow != NO_ROOM) { + row = monster->trow; + col = monster->tcol; + } + if (monster->row > row) { + row = monster->row - 1; + } else if (monster->row < row) { + row = monster->row + 1; + } + if ((dungeon[row][monster->col] & DOOR) && + mtry(monster, row, monster->col)) { + return; + } + if (monster->col > col) { + col = monster->col - 1; + } else if (monster->col < col) { + col = monster->col + 1; + } + if ((dungeon[monster->row][col] & DOOR) && + mtry(monster, monster->row, col)) { + return; + } + if (mtry(monster, row, col)) { + return; + } + + for (i = 0; i <= 5; i++) tried[i] = 0; + + for (i = 0; i < 6; i++) { +NEXT_TRY: n = get_rand(0, 5); + switch(n) { + case 0: + if (!tried[n] && mtry(monster, row, monster->col-1)) { + goto O; + } + break; + case 1: + if (!tried[n] && mtry(monster, row, monster->col)) { + goto O; + } + break; + case 2: + if (!tried[n] && mtry(monster, row, monster->col+1)) { + goto O; + } + break; + case 3: + if (!tried[n] && mtry(monster, monster->row-1, col)) { + goto O; + } + break; + case 4: + if (!tried[n] && mtry(monster, monster->row, col)) { + goto O; + } + break; + case 5: + if (!tried[n] && mtry(monster, monster->row+1, col)) { + goto O; + } + break; + } + if (!tried[n]) { + tried[n] = 1; + } else { + goto NEXT_TRY; + } + } +O: + if ((monster->row == monster->o_row) && (monster->col == monster->o_col)) { + if (++(monster->o) > 4) { + if ((monster->trow == NO_ROOM) && + (!mon_sees(monster, rogue.row, rogue.col))) { + monster->trow = get_rand(1, (DROWS - 2)); + monster->tcol = get_rand(0, (DCOLS - 1)); + } else { + monster->trow = NO_ROOM; + monster->o = 0; + } + } + } else { + monster->o_row = monster->row; + monster->o_col = monster->col; + monster->o = 0; + } +} + +int +mtry(monster, row, col) + object *monster; + short row, col; +{ + if (mon_can_go(monster, row, col)) { + move_mon_to(monster, row, col); + return(1); + } + return(0); +} + +void +move_mon_to(monster, row, col) + object *monster; + short row, col; +{ + short c; + int mrow, mcol; + + mrow = monster->row; + mcol = monster->col; + + dungeon[mrow][mcol] &= ~MONSTER; + dungeon[row][col] |= MONSTER; + + c = mvinch(mrow, mcol); + + if ((c >= 'A') && (c <= 'Z')) { + if (!detect_monster) { + mvaddch(mrow, mcol, monster->trail_char); + } else { + if (rogue_can_see(mrow, mcol)) { + mvaddch(mrow, mcol, monster->trail_char); + } else { + if (monster->trail_char == '.') { + monster->trail_char = ' '; + } + mvaddch(mrow, mcol, monster->trail_char); + } + } + } + monster->trail_char = mvinch(row, col); + if (!blind && (detect_monster || rogue_can_see(row, col))) { + if ((!(monster->m_flags & INVISIBLE) || + (detect_monster || see_invisible || r_see_invisible))) { + mvaddch(row, col, gmc(monster)); + } + } + if ((dungeon[row][col] & DOOR) && + (get_room_number(row, col) != cur_room) && + (dungeon[mrow][mcol] == FLOOR) && !blind) { + mvaddch(mrow, mcol, ' '); + } + if (dungeon[row][col] & DOOR) { + dr_course(monster, ((dungeon[mrow][mcol] & TUNNEL) ? 1 : 0), + row, col); + } else { + monster->row = row; + monster->col = col; + } +} + +int +mon_can_go(monster, row, col) + const object *monster; + short row, col; +{ + object *obj; + short dr, dc; + + dr = monster->row - row; /* check if move distance > 1 */ + if ((dr >= 2) || (dr <= -2)) { + return(0); + } + dc = monster->col - col; + if ((dc >= 2) || (dc <= -2)) { + return(0); + } + if ((!dungeon[monster->row][col]) || (!dungeon[row][monster->col])) { + return(0); + } + if ((!is_passable(row, col)) || (dungeon[row][col] & MONSTER)) { + return(0); + } + if ((monster->row!=row)&&(monster->col!=col)&&((dungeon[row][col]&DOOR) || + (dungeon[monster->row][monster->col]&DOOR))) { + return(0); + } + if (!(monster->m_flags & (FLITS | CONFUSED | CAN_FLIT)) && + (monster->trow == NO_ROOM)) { + if ((monster->row < rogue.row) && (row < monster->row)) return(0); + if ((monster->row > rogue.row) && (row > monster->row)) return(0); + if ((monster->col < rogue.col) && (col < monster->col)) return(0); + if ((monster->col > rogue.col) && (col > monster->col)) return(0); + } + if (dungeon[row][col] & OBJECT) { + obj = object_at(&level_objects, row, col); + if ((obj->what_is == SCROL) && (obj->which_kind == SCARE_MONSTER)) { + return(0); + } + } + return(1); +} + +void +wake_up(monster) + object *monster; +{ + if (!(monster->m_flags & NAPPING)) { + monster->m_flags &= (~(ASLEEP | IMITATES | WAKENS)); + } +} + +void +wake_room(rn, entering, row, col) + short rn; + boolean entering; + short row, col; +{ + object *monster; + short wake_percent; + boolean in_room; + + wake_percent = (rn == party_room) ? PARTY_WAKE_PERCENT : WAKE_PERCENT; + if (stealthy > 0) { + wake_percent /= (STEALTH_FACTOR + stealthy); + } + + monster = level_monsters.next_monster; + + while (monster) { + in_room = (rn == get_room_number(monster->row, monster->col)); + if (in_room) { + if (entering) { + monster->trow = NO_ROOM; + } else { + monster->trow = row; + monster->tcol = col; + } + } + if ((monster->m_flags & WAKENS) && + (rn == get_room_number(monster->row, monster->col))) { + if (rand_percent(wake_percent)) { + wake_up(monster); + } + } + monster = monster->next_monster; + } +} + +const char * +mon_name(monster) + const object *monster; +{ + short ch; + + if (blind || ((monster->m_flags & INVISIBLE) && + !(detect_monster || see_invisible || r_see_invisible))) { + return("something"); + } + if (halluc) { + ch = get_rand('A', 'Z') - 'A'; + return(m_names[ch]); + } + ch = monster->m_char - 'A'; + return(m_names[ch]); +} + +int +rogue_is_around(row, col) + int row, col; +{ + short rdif, cdif, retval; + + rdif = row - rogue.row; + cdif = col - rogue.col; + + retval = (rdif >= -1) && (rdif <= 1) && (cdif >= -1) && (cdif <= 1); + return(retval); +} + +void +wanderer() +{ + object *monster; + short row, col, i; + boolean found = 0; + + for (i = 0; ((i < 15) && (!found)); i++) { + monster = gr_monster((object *) 0, 0); + if (!(monster->m_flags & (WAKENS | WANDERS))) { + free_object(monster); + } else { + found = 1; + } + } + if (found) { + found = 0; + wake_up(monster); + for (i = 0; ((i < 25) && (!found)); i++) { + gr_row_col(&row, &col, (FLOOR | TUNNEL | STAIRS | OBJECT)); + if (!rogue_can_see(row, col)) { + put_m_at(row, col, monster); + found = 1; + } + } + if (!found) { + free_object(monster); + } + } +} + +void +show_monsters() +{ + object *monster; + + detect_monster = 1; + + if (blind) { + return; + } + monster = level_monsters.next_monster; + + while (monster) { + mvaddch(monster->row, monster->col, monster->m_char); + if (monster->m_flags & IMITATES) { + monster->m_flags &= (~IMITATES); + monster->m_flags |= WAKENS; + } + monster = monster->next_monster; + } +} + +void +create_monster() +{ + short row, col; + short i; + boolean found = 0; + object *monster; + + row = rogue.row; + col = rogue.col; + + for (i = 0; i < 9; i++) { + rand_around(i, &row, &col); + if (((row == rogue.row) && (col = rogue.col)) || + (row < MIN_ROW) || (row > (DROWS-2)) || + (col < 0) || (col > (DCOLS-1))) { + continue; + } + if ((!(dungeon[row][col] & MONSTER)) && + (dungeon[row][col] & (FLOOR|TUNNEL|STAIRS|DOOR))) { + found = 1; + break; + } + } + if (found) { + monster = gr_monster((object *) 0, 0); + put_m_at(row, col, monster); + mvaddch(row, col, gmc(monster)); + if (monster->m_flags & (WANDERS | WAKENS)) { + wake_up(monster); + } + } else { + message("you hear a faint cry of anguish in the distance", 0); + } +} + +void +put_m_at(row, col, monster) + short row, col; + object *monster; +{ + monster->row = row; + monster->col = col; + dungeon[row][col] |= MONSTER; + monster->trail_char = mvinch(row, col); + (void) add_to_pack(monster, &level_monsters, 0); + aim_monster(monster); +} + +void +aim_monster(monster) + object *monster; +{ + short i, rn, d, r; + + rn = get_room_number(monster->row, monster->col); + r = get_rand(0, 12); + + for (i = 0; i < 4; i++) { + d = (r + i) % 4; + if (rooms[rn].doors[d].oth_room != NO_ROOM) { + monster->trow = rooms[rn].doors[d].door_row; + monster->tcol = rooms[rn].doors[d].door_col; + break; + } + } +} + +int +rogue_can_see(row, col) + int row, col; +{ + int retval; + + retval = !blind && + (((get_room_number(row, col) == cur_room) && + !(rooms[cur_room].is_room & R_MAZE)) || + rogue_is_around(row, col)); + + return(retval); +} + +int +move_confused(monster) + object *monster; +{ + short i, row, col; + + if (!(monster->m_flags & ASLEEP)) { + if (--monster->moves_confused <= 0) { + monster->m_flags &= (~CONFUSED); + } + if (monster->m_flags & STATIONARY) { + return(coin_toss() ? 1 : 0); + } else if (rand_percent(15)) { + return(1); + } + row = monster->row; + col = monster->col; + + for (i = 0; i < 9; i++) { + rand_around(i, &row, &col); + if ((row == rogue.row) && (col == rogue.col)) { + return(0); + } + if (mtry(monster, row, col)) { + return(1); + } + } + } + return(0); +} + +int +flit(monster) + object *monster; +{ + short i, row, col; + + if (!rand_percent(FLIT_PERCENT + ((monster->m_flags & FLIES) ? 20 : 0))) { + return(0); + } + if (rand_percent(10)) { + return(1); + } + row = monster->row; + col = monster->col; + + for (i = 0; i < 9; i++) { + rand_around(i, &row, &col); + if ((row == rogue.row) && (col == rogue.col)) { + continue; + } + if (mtry(monster, row, col)) { + return(1); + } + } + return(1); +} + +char +gr_obj_char() +{ + short r; + const char *rs = "%!?]=/):*"; + + r = get_rand(0, 8); + + return(rs[r]); +} + +int +no_room_for_monster(rn) + int rn; +{ + short i, j; + + for (i = rooms[rn].top_row+1; i < rooms[rn].bottom_row; i++) { + for (j = rooms[rn].left_col+1; j < rooms[rn].right_col; j++) { + if (!(dungeon[i][j] & MONSTER)) { + return(0); + } + } + } + return(1); +} + +void +aggravate() +{ + object *monster; + + message("you hear a high pitched humming noise", 0); + + monster = level_monsters.next_monster; + + while (monster) { + wake_up(monster); + monster->m_flags &= (~IMITATES); + if (rogue_can_see(monster->row, monster->col)) { + mvaddch(monster->row, monster->col, monster->m_char); + } + monster = monster->next_monster; + } +} + +boolean +mon_sees(monster, row, col) + const object *monster; + int row, col; +{ + short rn, rdif, cdif, retval; + + rn = get_room_number(row, col); + + if ( (rn != NO_ROOM) && + (rn == get_room_number(monster->row, monster->col)) && + !(rooms[rn].is_room & R_MAZE)) { + return(1); + } + rdif = row - monster->row; + cdif = col - monster->col; + + retval = (rdif >= -1) && (rdif <= 1) && (cdif >= -1) && (cdif <= 1); + return(retval); +} + +void +mv_aquatars() +{ + object *monster; + + monster = level_monsters.next_monster; + + while (monster) { + if ((monster->m_char == 'A') && + mon_can_go(monster, rogue.row, rogue.col)) { + mv_1_monster(monster, rogue.row, rogue.col); + monster->m_flags |= ALREADY_MOVED; + } + monster = monster->next_monster; + } +} diff --git a/rogue/move.c b/rogue/move.c new file mode 100644 index 0000000..c846b74 --- /dev/null +++ b/rogue/move.c @@ -0,0 +1,655 @@ +/* $NetBSD: move.c,v 1.6 2003/08/07 09:37:38 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: move.c,v 1.6 2003/08/07 09:37:38 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * move.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include "rogue.h" + +short m_moves = 0; +boolean jump = 0; +const char *you_can_move_again = "you can move again"; + +int +one_move_rogue(dirch, pickup) + short dirch, pickup; +{ + short row, col; + object *obj; + char desc[DCOLS]; + short n, status, d; + + row = rogue.row; + col = rogue.col; + + if (confused) { + dirch = gr_dir(); + } + (void) is_direction(dirch, &d); + get_dir_rc(d, &row, &col, 1); + + if (!can_move(rogue.row, rogue.col, row, col)) { + return(MOVE_FAILED); + } + if (being_held || bear_trap) { + if (!(dungeon[row][col] & MONSTER)) { + if (being_held) { + message("you are being held", 1); + } else { + message("you are still stuck in the bear trap", 0); + (void) reg_move(); + } + return(MOVE_FAILED); + } + } + if (r_teleport) { + if (rand_percent(R_TELE_PERCENT)) { + tele(); + return(STOPPED_ON_SOMETHING); + } + } + if (dungeon[row][col] & MONSTER) { + rogue_hit(object_at(&level_monsters, row, col), 0); + (void) reg_move(); + return(MOVE_FAILED); + } + if (dungeon[row][col] & DOOR) { + if (cur_room == PASSAGE) { + cur_room = get_room_number(row, col); + light_up_room(cur_room); + wake_room(cur_room, 1, row, col); + } else { + light_passage(row, col); + } + } else if ((dungeon[rogue.row][rogue.col] & DOOR) && + (dungeon[row][col] & TUNNEL)) { + light_passage(row, col); + wake_room(cur_room, 0, rogue.row, rogue.col); + darken_room(cur_room); + cur_room = PASSAGE; + } else if (dungeon[row][col] & TUNNEL) { + light_passage(row, col); + } + mvaddch(rogue.row, rogue.col, get_dungeon_char(rogue.row, rogue.col)); + mvaddch(row, col, rogue.fchar); + + if (!jump) { + refresh(); + } + rogue.row = row; + rogue.col = col; + if (dungeon[row][col] & OBJECT) { + if (levitate && pickup) { + return(STOPPED_ON_SOMETHING); + } + if (pickup && !levitate) { + if ((obj = pick_up(row, col, &status)) != NULL) { + get_desc(obj, desc); + if (obj->what_is == GOLD) { + free_object(obj); + goto NOT_IN_PACK; + } + } else if (!status) { + goto MVED; + } else { + goto MOVE_ON; + } + } else { +MOVE_ON: + obj = object_at(&level_objects, row, col); + (void) strcpy(desc, "moved onto "); + get_desc(obj, desc+11); + goto NOT_IN_PACK; + } + n = strlen(desc); + desc[n] = '('; + desc[n+1] = obj->ichar; + desc[n+2] = ')'; + desc[n+3] = 0; +NOT_IN_PACK: + message(desc, 1); + (void) reg_move(); + return(STOPPED_ON_SOMETHING); + } + if (dungeon[row][col] & (DOOR | STAIRS | TRAP)) { + if ((!levitate) && (dungeon[row][col] & TRAP)) { + trap_player(row, col); + } + (void) reg_move(); + return(STOPPED_ON_SOMETHING); + } +MVED: if (reg_move()) { /* fainted from hunger */ + return(STOPPED_ON_SOMETHING); + } + return((confused ? STOPPED_ON_SOMETHING : MOVED)); +} + +void +multiple_move_rogue(dirch) + short dirch; +{ + short row, col; + short m; + + switch(dirch) { + case '\010': + case '\012': + case '\013': + case '\014': + case '\031': + case '\025': + case '\016': + case '\002': + do { + row = rogue.row; + col = rogue.col; + if (((m = one_move_rogue((dirch + 96), 1)) == MOVE_FAILED) || + (m == STOPPED_ON_SOMETHING) || + interrupted) { + break; + } + } while (!next_to_something(row, col)); + if ( (!interrupted) && passgo && (m == MOVE_FAILED) && + (dungeon[rogue.row][rogue.col] & TUNNEL)) { + turn_passage(dirch + 96, 0); + } + break; + case 'H': + case 'J': + case 'K': + case 'L': + case 'B': + case 'Y': + case 'U': + case 'N': + while ((!interrupted) && (one_move_rogue((dirch + 32), 1) == MOVED)) ; + + if ( (!interrupted) && passgo && + (dungeon[rogue.row][rogue.col] & TUNNEL)) { + turn_passage(dirch + 32, 1); + } + break; + } +} + +boolean +is_passable(row, col) + int row, col; +{ + if ((row < MIN_ROW) || (row > (DROWS - 2)) || (col < 0) || + (col > (DCOLS-1))) { + return(0); + } + if (dungeon[row][col] & HIDDEN) { + return((dungeon[row][col] & TRAP) ? 1 : 0); + } + return(dungeon[row][col] & (FLOOR | TUNNEL | DOOR | STAIRS | TRAP)); +} + +boolean +next_to_something(drow, dcol) + int drow, dcol; +{ + short i, j, i_end, j_end, row, col; + short pass_count = 0; + unsigned short s; + + if (confused) { + return(1); + } + if (blind) { + return(0); + } + i_end = (rogue.row < (DROWS-2)) ? 1 : 0; + j_end = (rogue.col < (DCOLS-1)) ? 1 : 0; + + for (i = ((rogue.row > MIN_ROW) ? -1 : 0); i <= i_end; i++) { + for (j = ((rogue.col > 0) ? -1 : 0); j <= j_end; j++) { + if ((i == 0) && (j == 0)) { + continue; + } + if (((rogue.row+i) == drow) && ((rogue.col+j) == dcol)) { + continue; + } + row = rogue.row + i; + col = rogue.col + j; + s = dungeon[row][col]; + if (s & HIDDEN) { + continue; + } + /* If the rogue used to be right, up, left, down, or right of + * row,col, and now isn't, then don't stop */ + if (s & (MONSTER | OBJECT | STAIRS)) { + if (((row == drow) || (col == dcol)) && + (!((row == rogue.row) || (col == rogue.col)))) { + continue; + } + return(1); + } + if (s & TRAP) { + if (!(s & HIDDEN)) { + if (((row == drow) || (col == dcol)) && + (!((row == rogue.row) || (col == rogue.col)))) { + continue; + } + return(1); + } + } + if ((((i - j) == 1) || ((i - j) == -1)) && (s & TUNNEL)) { + if (++pass_count > 1) { + return(1); + } + } + if ((s & DOOR) && ((i == 0) || (j == 0))) { + return(1); + } + } + } + return(0); +} + +boolean +can_move(row1, col1, row2, col2) + int row1, col1, row2, col2; +{ + if (!is_passable(row2, col2)) { + return(0); + } + if ((row1 != row2) && (col1 != col2)) { + if ((dungeon[row1][col1] & DOOR) || (dungeon[row2][col2] & DOOR)) { + return(0); + } + if ((!dungeon[row1][col2]) || (!dungeon[row2][col1])) { + return(0); + } + } + return(1); +} + +void +move_onto() +{ + short ch, d; + boolean first_miss = 1; + + while (!is_direction(ch = rgetchar(), &d)) { + sound_bell(); + if (first_miss) { + message("direction? ", 0); + first_miss = 0; + } + } + check_message(); + if (ch != CANCEL) { + (void) one_move_rogue(ch, 0); + } +} + +boolean +is_direction(c, d) + short c; + short *d; +{ + switch(c) { + case 'h': + *d = LEFT; + break; + case 'j': + *d = DOWN; + break; + case 'k': + *d = UPWARD; + break; + case 'l': + *d = RIGHT; + break; + case 'b': + *d = DOWNLEFT; + break; + case 'y': + *d = UPLEFT; + break; + case 'u': + *d = UPRIGHT; + break; + case 'n': + *d = DOWNRIGHT; + break; + case CANCEL: + break; + default: + return(0); + } + return(1); +} + +boolean +check_hunger(msg_only) + boolean msg_only; +{ + short i, n; + boolean fainted = 0; + + if (rogue.moves_left == HUNGRY) { + (void) strcpy(hunger_str, "hungry"); + message(hunger_str, 0); + print_stats(STAT_HUNGER); + } + if (rogue.moves_left == WEAK) { + (void) strcpy(hunger_str, "weak"); + message(hunger_str, 1); + print_stats(STAT_HUNGER); + } + if (rogue.moves_left <= FAINT) { + if (rogue.moves_left == FAINT) { + (void) strcpy(hunger_str, "faint"); + message(hunger_str, 1); + print_stats(STAT_HUNGER); + } + n = get_rand(0, (FAINT - rogue.moves_left)); + if (n > 0) { + fainted = 1; + if (rand_percent(40)) { + rogue.moves_left++; + } + message("you faint", 1); + for (i = 0; i < n; i++) { + if (coin_toss()) { + mv_mons(); + } + } + message(you_can_move_again, 1); + } + } + if (msg_only) { + return(fainted); + } + if (rogue.moves_left <= STARVE) { + killed_by((object *) 0, STARVATION); + } + + switch(e_rings) { + /*case -2: + Subtract 0, i.e. do nothing. + break;*/ + case -1: + rogue.moves_left -= (rogue.moves_left % 2); + break; + case 0: + rogue.moves_left--; + break; + case 1: + rogue.moves_left--; + (void) check_hunger(1); + rogue.moves_left -= (rogue.moves_left % 2); + break; + case 2: + rogue.moves_left--; + (void) check_hunger(1); + rogue.moves_left--; + break; + } + return(fainted); +} + +boolean +reg_move() +{ + boolean fainted; + + if ((rogue.moves_left <= HUNGRY) || (cur_level >= max_level)) { + fainted = check_hunger(0); + } else { + fainted = 0; + } + + mv_mons(); + + if (++m_moves >= 120) { + m_moves = 0; + wanderer(); + } + if (halluc) { + if (!(--halluc)) { + unhallucinate(); + } else { + hallucinate(); + } + } + if (blind) { + if (!(--blind)) { + unblind(); + } + } + if (confused) { + if (!(--confused)) { + unconfuse(); + } + } + if (bear_trap) { + bear_trap--; + } + if (levitate) { + if (!(--levitate)) { + message("you float gently to the ground", 1); + if (dungeon[rogue.row][rogue.col] & TRAP) { + trap_player(rogue.row, rogue.col); + } + } + } + if (haste_self) { + if (!(--haste_self)) { + message("you feel yourself slowing down", 0); + } + } + heal(); + if (auto_search > 0) { + search(auto_search, auto_search); + } + return(fainted); +} + +void +rest(count) + int count; +{ + int i; + + interrupted = 0; + + for (i = 0; i < count; i++) { + if (interrupted) { + break; + } + (void) reg_move(); + } +} + +char +gr_dir() +{ + short d; + + d = get_rand(1, 8); + + switch(d) { + case 1: + d = 'j'; + break; + case 2: + d = 'k'; + break; + case 3: + d = 'l'; + break; + case 4: + d = 'h'; + break; + case 5: + d = 'y'; + break; + case 6: + d = 'u'; + break; + case 7: + d = 'b'; + break; + case 8: + d = 'n'; + break; + } + return(d); +} + +void +heal() +{ + static short heal_exp = -1, n, c = 0; + static boolean alt; + + if (rogue.hp_current == rogue.hp_max) { + c = 0; + return; + } + if (rogue.exp != heal_exp) { + heal_exp = rogue.exp; + + switch(heal_exp) { + case 1: + n = 20; + break; + case 2: + n = 18; + break; + case 3: + n = 17; + break; + case 4: + n = 14; + break; + case 5: + n = 13; + break; + case 6: + n = 10; + break; + case 7: + n = 9; + break; + case 8: + n = 8; + break; + case 9: + n = 7; + break; + case 10: + n = 4; + break; + case 11: + n = 3; + break; + case 12: + default: + n = 2; + } + } + if (++c >= n) { + c = 0; + rogue.hp_current++; + if ((alt = !alt) != 0) { + rogue.hp_current++; + } + if ((rogue.hp_current += regeneration) > rogue.hp_max) { + rogue.hp_current = rogue.hp_max; + } + print_stats(STAT_HP); + } +} + +boolean +can_turn(nrow, ncol) + short nrow, ncol; +{ + if ((dungeon[nrow][ncol] & TUNNEL) && is_passable(nrow, ncol)) { + return(1); + } + return(0); +} + +void +turn_passage(dir, fast) + short dir; + boolean fast; +{ + short crow = rogue.row, ccol = rogue.col, turns = 0; + short ndir = 0; + + if ((dir != 'h') && can_turn(crow, ccol + 1)) { + turns++; + ndir = 'l'; + } + if ((dir != 'l') && can_turn(crow, ccol - 1)) { + turns++; + ndir = 'h'; + } + if ((dir != 'k') && can_turn(crow + 1, ccol)) { + turns++; + ndir = 'j'; + } + if ((dir != 'j') && can_turn(crow - 1, ccol)) { + turns++; + ndir = 'k'; + } + if (turns == 1) { + multiple_move_rogue(ndir - (fast ? 32 : 96)); + } +} diff --git a/rogue/object.c b/rogue/object.c new file mode 100644 index 0000000..8364e51 --- /dev/null +++ b/rogue/object.c @@ -0,0 +1,809 @@ +/* $NetBSD: object.c,v 1.9 2003/08/07 09:37:39 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)object.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: object.c,v 1.9 2003/08/07 09:37:39 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * object.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include "rogue.h" + +object level_objects; +unsigned short dungeon[DROWS][DCOLS]; +short foods = 0; +object *free_list = (object *) 0; +char *fruit = (char *) 0; + +fighter rogue = { + INIT_AW, /* armor */ + INIT_AW, /* weapon */ + INIT_RINGS, /* left ring */ + INIT_RINGS, /* right ring */ + INIT_HP, /* Hp current */ + INIT_HP, /* Hp max */ + INIT_STR, /* Str current */ + INIT_STR, /* Str max */ + INIT_PACK, /* pack */ + INIT_GOLD, /* gold */ + INIT_EXPLEVEL, /* exp level */ + INIT_EXP, /* exp points */ + 0, 0, /* row, col */ + INIT_CHAR, /* char */ + INIT_MOVES /* moves */ +}; + +struct id id_potions[POTIONS] = { +{100, "blue \0 ", "of increase strength ", 0}, +{250, "red \0 ", "of restore strength ", 0}, +{100, "green \0 ", "of healing ", 0}, +{200, "grey \0 ", "of extra healing ", 0}, + {10, "brown \0 ", "of poison ", 0}, +{300, "clear \0 ", "of raise level ", 0}, + {10, "pink \0 ", "of blindness ", 0}, + {25, "white \0 ", "of hallucination ", 0}, +{100, "purple \0 ", "of detect monster ", 0}, +{100, "black \0 ", "of detect things ", 0}, + {10, "yellow \0 ", "of confusion ", 0}, + {80, "plaid \0 ", "of levitation ", 0}, +{150, "burgundy \0 ", "of haste self ", 0}, +{145, "beige \0 ", "of see invisible ", 0} +}; + +struct id id_scrolls[SCROLS] = { +{505, " ", "of protect armor ", 0}, +{200, " ", "of hold monster ", 0}, +{235, " ", "of enchant weapon ", 0}, +{235, " ", "of enchant armor ", 0}, +{175, " ", "of identify ", 0}, +{190, " ", "of teleportation ", 0}, + {25, " ", "of sleep ", 0}, +{610, " ", "of scare monster ", 0}, +{210, " ", "of remove curse ", 0}, + {80, " ", "of create monster ",0}, + {25, " ", "of aggravate monster ",0}, +{180, " ", "of magic mapping ", 0}, + {90, " ", "of confuse monster ", 0} +}; + +struct id id_weapons[WEAPONS] = { + {150, "short bow ", "", 0}, + {8, "darts ", "", 0}, + {15, "arrows ", "", 0}, + {27, "daggers ", "", 0}, + {35, "shurikens ", "", 0}, + {360, "mace ", "", 0}, + {470, "long sword ", "", 0}, + {580, "two-handed sword ", "", 0} +}; + +struct id id_armors[ARMORS] = { + {300, "leather armor ", "", (UNIDENTIFIED)}, + {300, "ring mail ", "", (UNIDENTIFIED)}, + {400, "scale mail ", "", (UNIDENTIFIED)}, + {500, "chain mail ", "", (UNIDENTIFIED)}, + {600, "banded mail ", "", (UNIDENTIFIED)}, + {600, "splint mail ", "", (UNIDENTIFIED)}, + {700, "plate mail ", "", (UNIDENTIFIED)} +}; + +struct id id_wands[WANDS] = { + {25, " ", "of teleport away ",0}, + {50, " ", "of slow monster ", 0}, + {8, " ", "of invisibility ",0}, + {55, " ", "of polymorph ",0}, + {2, " ", "of haste monster ",0}, + {20, " ", "of magic missile ",0}, + {20, " ", "of cancellation ",0}, + {0, " ", "of do nothing ",0}, + {35, " ", "of drain life ",0}, + {20, " ", "of cold ",0}, + {20, " ", "of fire ",0} +}; + +struct id id_rings[RINGS] = { + {250, " ", "of stealth ",0}, + {100, " ", "of teleportation ", 0}, + {255, " ", "of regeneration ",0}, + {295, " ", "of slow digestion ",0}, + {200, " ", "of add strength ",0}, + {250, " ", "of sustain strength ",0}, + {250, " ", "of dexterity ",0}, + {25, " ", "of adornment ",0}, + {300, " ", "of see invisible ",0}, + {290, " ", "of maintain armor ",0}, + {270, " ", "of searching ",0}, +}; + +void +put_objects() +{ + short i, n; + object *obj; + + if (cur_level < max_level) { + return; + } + n = coin_toss() ? get_rand(2, 4) : get_rand(3, 5); + while (rand_percent(33)) { + n++; + } + if (party_room != NO_ROOM) { + make_party(); + } + for (i = 0; i < n; i++) { + obj = gr_object(); + rand_place(obj); + } + put_gold(); +} + +void +put_gold() +{ + short i, j; + short row,col; + boolean is_maze, is_room; + + for (i = 0; i < MAXROOMS; i++) { + is_maze = (rooms[i].is_room & R_MAZE) ? 1 : 0; + is_room = (rooms[i].is_room & R_ROOM) ? 1 : 0; + + if (!(is_room || is_maze)) { + continue; + } + if (is_maze || rand_percent(GOLD_PERCENT)) { + for (j = 0; j < 50; j++) { + row = get_rand(rooms[i].top_row+1, + rooms[i].bottom_row-1); + col = get_rand(rooms[i].left_col+1, + rooms[i].right_col-1); + if ((dungeon[row][col] == FLOOR) || + (dungeon[row][col] == TUNNEL)) { + plant_gold(row, col, is_maze); + break; + } + } + } + } +} + +void +plant_gold(row, col, is_maze) + short row, col; + boolean is_maze; +{ + object *obj; + + obj = alloc_object(); + obj->row = row; obj->col = col; + obj->what_is = GOLD; + obj->quantity = get_rand((2 * cur_level), (16 * cur_level)); + if (is_maze) { + obj->quantity += obj->quantity / 2; + } + dungeon[row][col] |= OBJECT; + (void) add_to_pack(obj, &level_objects, 0); +} + +void +place_at(obj, row, col) + object *obj; + int row, col; +{ + obj->row = row; + obj->col = col; + dungeon[row][col] |= OBJECT; + (void) add_to_pack(obj, &level_objects, 0); +} + +object * +object_at(pack, row, col) + object *pack; + short row, col; +{ + object *obj = (object *) 0; + + if (dungeon[row][col] & (MONSTER | OBJECT)) { + obj = pack->next_object; + + while (obj && ((obj->row != row) || (obj->col != col))) { + obj = obj->next_object; + } + if (!obj) { + message("object_at(): inconsistent", 1); + } + } + return(obj); +} + +object * +get_letter_object(ch) + int ch; +{ + object *obj; + + obj = rogue.pack.next_object; + + while (obj && (obj->ichar != ch)) { + obj = obj->next_object; + } + return(obj); +} + +void +free_stuff(objlist) + object *objlist; +{ + object *obj; + + while (objlist->next_object) { + obj = objlist->next_object; + objlist->next_object = + objlist->next_object->next_object; + free_object(obj); + } +} + +const char * +name_of(obj) + const object *obj; +{ + const char *retstring; + + switch(obj->what_is) { + case SCROL: + retstring = obj->quantity > 1 ? "scrolls " : "scroll "; + break; + case POTION: + retstring = obj->quantity > 1 ? "potions " : "potion "; + break; + case FOOD: + if (obj->which_kind == RATION) { + retstring = "food "; + } else { + retstring = fruit; + } + break; + case WAND: + retstring = is_wood[obj->which_kind] ? "staff " : "wand "; + break; + case WEAPON: + switch(obj->which_kind) { + case DART: + retstring=obj->quantity > 1 ? "darts " : "dart "; + break; + case ARROW: + retstring=obj->quantity > 1 ? "arrows " : "arrow "; + break; + case DAGGER: + retstring=obj->quantity > 1 ? "daggers " : "dagger "; + break; + case SHURIKEN: + retstring=obj->quantity > 1?"shurikens ":"shuriken "; + break; + default: + retstring = id_weapons[obj->which_kind].title; + } + break; + case ARMOR: + retstring = "armor "; + break; + case RING: + retstring = "ring "; + break; + case AMULET: + retstring = "amulet "; + break; + default: + retstring = "unknown "; + break; + } + return(retstring); +} + +object * +gr_object() +{ + object *obj; + + obj = alloc_object(); + + if (foods < (cur_level / 3)) { + obj->what_is = FOOD; + foods++; + } else { + obj->what_is = gr_what_is(); + } + switch(obj->what_is) { + case SCROL: + gr_scroll(obj); + break; + case POTION: + gr_potion(obj); + break; + case WEAPON: + gr_weapon(obj, 1); + break; + case ARMOR: + gr_armor(obj); + break; + case WAND: + gr_wand(obj); + break; + case FOOD: + get_food(obj, 0); + break; + case RING: + gr_ring(obj, 1); + break; + } + return(obj); +} + +unsigned short +gr_what_is() +{ + short percent; + unsigned short what_is; + + percent = get_rand(1, 91); + + if (percent <= 30) { + what_is = SCROL; + } else if (percent <= 60) { + what_is = POTION; + } else if (percent <= 64) { + what_is = WAND; + } else if (percent <= 74) { + what_is = WEAPON; + } else if (percent <= 83) { + what_is = ARMOR; + } else if (percent <= 88) { + what_is = FOOD; + } else { + what_is = RING; + } + return(what_is); +} + +void +gr_scroll(obj) + object *obj; +{ + short percent; + + percent = get_rand(0, 91); + + obj->what_is = SCROL; + + if (percent <= 5) { + obj->which_kind = PROTECT_ARMOR; + } else if (percent <= 10) { + obj->which_kind = HOLD_MONSTER; + } else if (percent <= 20) { + obj->which_kind = CREATE_MONSTER; + } else if (percent <= 35) { + obj->which_kind = IDENTIFY; + } else if (percent <= 43) { + obj->which_kind = TELEPORT; + } else if (percent <= 50) { + obj->which_kind = SLEEP; + } else if (percent <= 55) { + obj->which_kind = SCARE_MONSTER; + } else if (percent <= 64) { + obj->which_kind = REMOVE_CURSE; + } else if (percent <= 69) { + obj->which_kind = ENCH_ARMOR; + } else if (percent <= 74) { + obj->which_kind = ENCH_WEAPON; + } else if (percent <= 80) { + obj->which_kind = AGGRAVATE_MONSTER; + } else if (percent <= 86) { + obj->which_kind = CON_MON; + } else { + obj->which_kind = MAGIC_MAPPING; + } +} + +void +gr_potion(obj) + object *obj; +{ + short percent; + + percent = get_rand(1, 118); + + obj->what_is = POTION; + + if (percent <= 5) { + obj->which_kind = RAISE_LEVEL; + } else if (percent <= 15) { + obj->which_kind = DETECT_OBJECTS; + } else if (percent <= 25) { + obj->which_kind = DETECT_MONSTER; + } else if (percent <= 35) { + obj->which_kind = INCREASE_STRENGTH; + } else if (percent <= 45) { + obj->which_kind = RESTORE_STRENGTH; + } else if (percent <= 55) { + obj->which_kind = HEALING; + } else if (percent <= 65) { + obj->which_kind = EXTRA_HEALING; + } else if (percent <= 75) { + obj->which_kind = BLINDNESS; + } else if (percent <= 85) { + obj->which_kind = HALLUCINATION; + } else if (percent <= 95) { + obj->which_kind = CONFUSION; + } else if (percent <= 105) { + obj->which_kind = POISON; + } else if (percent <= 110) { + obj->which_kind = LEVITATION; + } else if (percent <= 114) { + obj->which_kind = HASTE_SELF; + } else { + obj->which_kind = SEE_INVISIBLE; + } +} + +void +gr_weapon(obj, assign_wk) + object *obj; + int assign_wk; +{ + short percent; + short i; + short blessing, increment; + + obj->what_is = WEAPON; + if (assign_wk) { + obj->which_kind = get_rand(0, (WEAPONS - 1)); + } + if ((obj->which_kind == ARROW) || (obj->which_kind == DAGGER) || + (obj->which_kind == SHURIKEN) | (obj->which_kind == DART)) { + obj->quantity = get_rand(3, 15); + obj->quiver = get_rand(0, 126); + } else { + obj->quantity = 1; + } + obj->hit_enchant = obj->d_enchant = 0; + + percent = get_rand(1, 96); + blessing = get_rand(1, 3); + + if (percent <= 32) { + if (percent <= 16) { + increment = 1; + } else { + increment = -1; + obj->is_cursed = 1; + } + for (i = 0; i < blessing; i++) { + if (coin_toss()) { + obj->hit_enchant += increment; + } else { + obj->d_enchant += increment; + } + } + } + switch(obj->which_kind) { + case BOW: + case DART: + obj->damage = "1d1"; + break; + case ARROW: + obj->damage = "1d2"; + break; + case DAGGER: + obj->damage = "1d3"; + break; + case SHURIKEN: + obj->damage = "1d4"; + break; + case MACE: + obj->damage = "2d3"; + break; + case LONG_SWORD: + obj->damage = "3d4"; + break; + case TWO_HANDED_SWORD: + obj->damage = "4d5"; + break; + } +} + +void +gr_armor(obj) + object *obj; +{ + short percent; + short blessing; + + obj->what_is = ARMOR; + obj->which_kind = get_rand(0, (ARMORS - 1)); + obj->class = obj->which_kind + 2; + if ((obj->which_kind == PLATE) || (obj->which_kind == SPLINT)) { + obj->class--; + } + obj->is_protected = 0; + obj->d_enchant = 0; + + percent = get_rand(1, 100); + blessing = get_rand(1, 3); + + if (percent <= 16) { + obj->is_cursed = 1; + obj->d_enchant -= blessing; + } else if (percent <= 33) { + obj->d_enchant += blessing; + } +} + +void +gr_wand(obj) + object *obj; +{ + obj->what_is = WAND; + obj->which_kind = get_rand(0, (WANDS - 1)); + obj->class = get_rand(3, 7); +} + +void +get_food(obj, force_ration) + object *obj; + boolean force_ration; +{ + obj->what_is = FOOD; + + if (force_ration || rand_percent(80)) { + obj->which_kind = RATION; + } else { + obj->which_kind = FRUIT; + } +} + +void +put_stairs() +{ + short row, col; + + gr_row_col(&row, &col, (FLOOR | TUNNEL)); + dungeon[row][col] |= STAIRS; +} + +int +get_armor_class(obj) + const object *obj; +{ + if (obj) { + return(obj->class + obj->d_enchant); + } + return(0); +} + +object * +alloc_object() +{ + object *obj; + + if (free_list) { + obj = free_list; + free_list = free_list->next_object; + } else if (!(obj = (object *) md_malloc(sizeof(object)))) { + message("cannot allocate object, saving game", 0); + save_into_file(error_file); + } + obj->quantity = 1; + obj->ichar = 'L'; + obj->picked_up = obj->is_cursed = 0; + obj->in_use_flags = NOT_USED; + obj->identified = UNIDENTIFIED; + obj->damage = "1d1"; + return(obj); +} + +void +free_object(obj) + object *obj; +{ + obj->next_object = free_list; + free_list = obj; +} + +void +make_party() +{ + short n; + + party_room = gr_room(); + + n = rand_percent(99) ? party_objects(party_room) : 11; + if (rand_percent(99)) { + party_monsters(party_room, n); + } +} + +void +show_objects() +{ + object *obj; + short mc, rc, row, col; + object *monster; + + obj = level_objects.next_object; + + while (obj) { + row = obj->row; + col = obj->col; + + rc = get_mask_char(obj->what_is); + + if (dungeon[row][col] & MONSTER) { + if ((monster = + object_at(&level_monsters, row, col)) != NULL) { + monster->trail_char = rc; + } + } + mc = mvinch(row, col); + if (((mc < 'A') || (mc > 'Z')) && + ((row != rogue.row) || (col != rogue.col))) { + mvaddch(row, col, rc); + } + obj = obj->next_object; + } + + monster = level_monsters.next_object; + + while (monster) { + if (monster->m_flags & IMITATES) { + mvaddch(monster->row, monster->col, (int) monster->disguise); + } + monster = monster->next_monster; + } +} + +void +put_amulet() +{ + object *obj; + + obj = alloc_object(); + obj->what_is = AMULET; + rand_place(obj); +} + +void +rand_place(obj) + object *obj; +{ + short row, col; + + gr_row_col(&row, &col, (FLOOR | TUNNEL)); + place_at(obj, row, col); +} + +void +c_object_for_wizard() +{ + short ch, max, wk; + object *obj; + char buf[80]; + + max = 0; + if (pack_count((object *) 0) >= MAX_PACK_COUNT) { + message("pack full", 0); + return; + } + message("type of object?", 0); + + while (r_index("!?:)]=/,\033", (ch = rgetchar()), 0) == -1) { + sound_bell(); + } + check_message(); + + if (ch == '\033') { + return; + } + obj = alloc_object(); + + switch(ch) { + case '!': + obj->what_is = POTION; + max = POTIONS - 1; + break; + case '?': + obj->what_is = SCROL; + max = SCROLS - 1; + break; + case ',': + obj->what_is = AMULET; + break; + case ':': + get_food(obj, 0); + break; + case ')': + gr_weapon(obj, 0); + max = WEAPONS - 1; + break; + case ']': + gr_armor(obj); + max = ARMORS - 1; + break; + case '/': + gr_wand(obj); + max = WANDS - 1; + break; + case '=': + max = RINGS - 1; + obj->what_is = RING; + break; + } + if ((ch != ',') && (ch != ':')) { +GIL: + if (get_input_line("which kind?", "", buf, "", 0, 1)) { + wk = get_number(buf); + if ((wk >= 0) && (wk <= max)) { + obj->which_kind = (unsigned short) wk; + if (obj->what_is == RING) { + gr_ring(obj, 0); + } + } else { + sound_bell(); + goto GIL; + } + } else { + free_object(obj); + return; + } + } + get_desc(obj, buf); + message(buf, 0); + (void) add_to_pack(obj, &rogue.pack, 1); +} diff --git a/rogue/pack.c b/rogue/pack.c new file mode 100644 index 0000000..5619d24 --- /dev/null +++ b/rogue/pack.c @@ -0,0 +1,591 @@ +/* $NetBSD: pack.c,v 1.7 2003/08/07 09:37:39 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)pack.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: pack.c,v 1.7 2003/08/07 09:37:39 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * pack.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include "rogue.h" + +const char *curse_message = "you can't, it appears to be cursed"; + +object * +add_to_pack(obj, pack, condense) + object *obj, *pack; + int condense; +{ + object *op; + + if (condense) { + if ((op = check_duplicate(obj, pack)) != NULL) { + free_object(obj); + return(op); + } else { + obj->ichar = next_avail_ichar(); + } + } + if (pack->next_object == 0) { + pack->next_object = obj; + } else { + op = pack->next_object; + + while (op->next_object) { + op = op->next_object; + } + op->next_object = obj; + } + obj->next_object = 0; + return(obj); +} + +void +take_from_pack(obj, pack) + object *obj, *pack; +{ + while (pack->next_object != obj) { + pack = pack->next_object; + } + pack->next_object = pack->next_object->next_object; +} + +/* Note: *status is set to 0 if the rogue attempts to pick up a scroll + * of scare-monster and it turns to dust. *status is otherwise set to 1. + */ + +object * +pick_up(row, col, status) + short *status; + int row, col; +{ + object *obj; + + *status = 1; + + if (levitate) { + message("you're floating in the air!", 0); + return((object *) 0); + } + obj = object_at(&level_objects, row, col); + if (!obj) { + message("pick_up(): inconsistent", 1); + return(obj); + } + if ( (obj->what_is == SCROL) && + (obj->which_kind == SCARE_MONSTER) && + obj->picked_up) { + message("the scroll turns to dust as you pick it up", 0); + dungeon[row][col] &= (~OBJECT); + vanish(obj, 0, &level_objects); + *status = 0; + if (id_scrolls[SCARE_MONSTER].id_status == UNIDENTIFIED) { + id_scrolls[SCARE_MONSTER].id_status = IDENTIFIED; + } + return((object *) 0); + } + if (obj->what_is == GOLD) { + rogue.gold += obj->quantity; + dungeon[row][col] &= ~(OBJECT); + take_from_pack(obj, &level_objects); + print_stats(STAT_GOLD); + return(obj); /* obj will be free_object()ed in caller */ + } + if (pack_count(obj) >= MAX_PACK_COUNT) { + message("pack too full", 1); + return((object *) 0); + } + dungeon[row][col] &= ~(OBJECT); + take_from_pack(obj, &level_objects); + obj = add_to_pack(obj, &rogue.pack, 1); + obj->picked_up = 1; + return(obj); +} + +void +drop() +{ + object *obj, *new; + short ch; + char desc[DCOLS]; + + if (dungeon[rogue.row][rogue.col] & (OBJECT | STAIRS | TRAP)) { + message("there's already something there", 0); + return; + } + if (!rogue.pack.next_object) { + message("you have nothing to drop", 0); + return; + } + if ((ch = pack_letter("drop what?", ALL_OBJECTS)) == CANCEL) { + return; + } + if (!(obj = get_letter_object(ch))) { + message("no such item.", 0); + return; + } + if (obj->in_use_flags & BEING_WIELDED) { + if (obj->is_cursed) { + message(curse_message, 0); + return; + } + unwield(rogue.weapon); + } else if (obj->in_use_flags & BEING_WORN) { + if (obj->is_cursed) { + message(curse_message, 0); + return; + } + mv_aquatars(); + unwear(rogue.armor); + print_stats(STAT_ARMOR); + } else if (obj->in_use_flags & ON_EITHER_HAND) { + if (obj->is_cursed) { + message(curse_message, 0); + return; + } + un_put_on(obj); + } + obj->row = rogue.row; + obj->col = rogue.col; + + if ((obj->quantity > 1) && (obj->what_is != WEAPON)) { + obj->quantity--; + new = alloc_object(); + *new = *obj; + new->quantity = 1; + obj = new; + } else { + obj->ichar = 'L'; + take_from_pack(obj, &rogue.pack); + } + place_at(obj, rogue.row, rogue.col); + (void) strcpy(desc, "dropped "); + get_desc(obj, desc+8); + message(desc, 0); + (void) reg_move(); +} + +object * +check_duplicate(obj, pack) + object *obj, *pack; +{ + object *op; + + if (!(obj->what_is & (WEAPON | FOOD | SCROL | POTION))) { + return(0); + } + if ((obj->what_is == FOOD) && (obj->which_kind == FRUIT)) { + return(0); + } + op = pack->next_object; + + while (op) { + if ((op->what_is == obj->what_is) && + (op->which_kind == obj->which_kind)) { + + if ((obj->what_is != WEAPON) || + ((obj->what_is == WEAPON) && + ((obj->which_kind == ARROW) || + (obj->which_kind == DAGGER) || + (obj->which_kind == DART) || + (obj->which_kind == SHURIKEN)) && + (obj->quiver == op->quiver))) { + op->quantity += obj->quantity; + return(op); + } + } + op = op->next_object; + } + return(0); +} + +short +next_avail_ichar() +{ + object *obj; + int i; + boolean ichars[26]; + + for (i = 0; i < 26; i++) { + ichars[i] = 0; + } + obj = rogue.pack.next_object; + while (obj) { + ichars[(obj->ichar - 'a')] = 1; + obj = obj->next_object; + } + for (i = 0; i < 26; i++) { + if (!ichars[i]) { + return(i + 'a'); + } + } + return('?'); +} + +void +wait_for_ack() +{ + while (rgetchar() != ' ') ; +} + +short +pack_letter(prompt, mask) + const char *prompt; + unsigned short mask; +{ + short ch; + unsigned short tmask = mask; + + if (!mask_pack(&rogue.pack, mask)) { + message("nothing appropriate", 0); + return(CANCEL); + } + for (;;) { + + message(prompt, 0); + + for (;;) { + ch = rgetchar(); + if (!is_pack_letter(&ch, &mask)) { + sound_bell(); + } else { + break; + } + } + + if (ch == LIST) { + check_message(); + mask = tmask; + inventory(&rogue.pack, mask); + } else { + break; + } + mask = tmask; + } + check_message(); + return(ch); +} + +void +take_off() +{ + char desc[DCOLS]; + object *obj; + + if (rogue.armor) { + if (rogue.armor->is_cursed) { + message(curse_message, 0); + } else { + mv_aquatars(); + obj = rogue.armor; + unwear(rogue.armor); + (void) strcpy(desc, "was wearing "); + get_desc(obj, desc+12); + message(desc, 0); + print_stats(STAT_ARMOR); + (void) reg_move(); + } + } else { + message("not wearing any", 0); + } +} + +void +wear() +{ + short ch; + object *obj; + char desc[DCOLS]; + + if (rogue.armor) { + message("your already wearing some", 0); + return; + } + ch = pack_letter("wear what?", ARMOR); + + if (ch == CANCEL) { + return; + } + if (!(obj = get_letter_object(ch))) { + message("no such item.", 0); + return; + } + if (obj->what_is != ARMOR) { + message("you can't wear that", 0); + return; + } + obj->identified = 1; + (void) strcpy(desc, "wearing "); + get_desc(obj, desc + 8); + message(desc, 0); + do_wear(obj); + print_stats(STAT_ARMOR); + (void) reg_move(); +} + +void +unwear(obj) + object *obj; +{ + if (obj) { + obj->in_use_flags &= (~BEING_WORN); + } + rogue.armor = (object *) 0; +} + +void +do_wear(obj) + object *obj; +{ + rogue.armor = obj; + obj->in_use_flags |= BEING_WORN; + obj->identified = 1; +} + +void +wield() +{ + short ch; + object *obj; + char desc[DCOLS]; + + if (rogue.weapon && rogue.weapon->is_cursed) { + message(curse_message, 0); + return; + } + ch = pack_letter("wield what?", WEAPON); + + if (ch == CANCEL) { + return; + } + if (!(obj = get_letter_object(ch))) { + message("No such item.", 0); + return; + } + if (obj->what_is & (ARMOR | RING)) { + sprintf(desc, "you can't wield %s", + ((obj->what_is == ARMOR) ? "armor" : "rings")); + message(desc, 0); + return; + } + if (obj->in_use_flags & BEING_WIELDED) { + message("in use", 0); + } else { + unwield(rogue.weapon); + (void) strcpy(desc, "wielding "); + get_desc(obj, desc + 9); + message(desc, 0); + do_wield(obj); + (void) reg_move(); + } +} + +void +do_wield(obj) + object *obj; +{ + rogue.weapon = obj; + obj->in_use_flags |= BEING_WIELDED; +} + +void +unwield(obj) + object *obj; +{ + if (obj) { + obj->in_use_flags &= (~BEING_WIELDED); + } + rogue.weapon = (object *) 0; +} + +void +call_it() +{ + short ch; + object *obj; + struct id *id_table; + char buf[MAX_TITLE_LENGTH+2]; + + ch = pack_letter("call what?", (SCROL | POTION | WAND | RING)); + + if (ch == CANCEL) { + return; + } + if (!(obj = get_letter_object(ch))) { + message("no such item.", 0); + return; + } + if (!(obj->what_is & (SCROL | POTION | WAND | RING))) { + message("surely you already know what that's called", 0); + return; + } + id_table = get_id_table(obj); + + if (get_input_line("call it:","",buf,id_table[obj->which_kind].title,1,1)) { + id_table[obj->which_kind].id_status = CALLED; + (void) strcpy(id_table[obj->which_kind].title, buf); + } +} + +short +pack_count(new_obj) + const object *new_obj; +{ + object *obj; + short count = 0; + + obj = rogue.pack.next_object; + + while (obj) { + if (obj->what_is != WEAPON) { + count += obj->quantity; + } else if (!new_obj) { + count++; + } else if ((new_obj->what_is != WEAPON) || + ((obj->which_kind != ARROW) && + (obj->which_kind != DAGGER) && + (obj->which_kind != DART) && + (obj->which_kind != SHURIKEN)) || + (new_obj->which_kind != obj->which_kind) || + (obj->quiver != new_obj->quiver)) { + count++; + } + obj = obj->next_object; + } + return(count); +} + +boolean +mask_pack(pack, mask) + const object *pack; + unsigned short mask; +{ + while (pack->next_object) { + pack = pack->next_object; + if (pack->what_is & mask) { + return(1); + } + } + return(0); +} + +boolean +is_pack_letter(c, mask) + short *c; + unsigned short *mask; +{ + if (((*c == '?') || (*c == '!') || (*c == ':') || (*c == '=') || + (*c == ')') || (*c == ']') || (*c == '/') || (*c == ','))) { + switch(*c) { + case '?': + *mask = SCROL; + break; + case '!': + *mask = POTION; + break; + case ':': + *mask = FOOD; + break; + case ')': + *mask = WEAPON; + break; + case ']': + *mask = ARMOR; + break; + case '/': + *mask = WAND; + break; + case '=': + *mask = RING; + break; + case ',': + *mask = AMULET; + break; + } + *c = LIST; + return(1); + } + return(((*c >= 'a') && (*c <= 'z')) || (*c == CANCEL) || (*c == LIST)); +} + +boolean +has_amulet() +{ + return(mask_pack(&rogue.pack, AMULET)); +} + +void +kick_into_pack() +{ + object *obj; + char desc[DCOLS]; + short n, stat; + + if (!(dungeon[rogue.row][rogue.col] & OBJECT)) { + message("nothing here", 0); + } else { + if ((obj = pick_up(rogue.row, rogue.col, &stat)) != NULL) { + get_desc(obj, desc); + if (obj->what_is == GOLD) { + message(desc, 0); + free_object(obj); + } else { + n = strlen(desc); + desc[n] = '('; + desc[n+1] = obj->ichar; + desc[n+2] = ')'; + desc[n+3] = 0; + message(desc, 0); + } + } + if (obj || (!stat)) { + (void) reg_move(); + } + } +} diff --git a/rogue/pathnames.h.in b/rogue/pathnames.h.in new file mode 100644 index 0000000..cda2c79 --- /dev/null +++ b/rogue/pathnames.h.in @@ -0,0 +1,34 @@ +/* $NetBSD: pathnames.h,v 1.4 2003/08/07 09:37:39 agc Exp $ */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)pathnames.h 8.1 (Berkeley) 5/31/93 + */ + +#define _PATH_SCOREFILE "@rogue_scorefile@" diff --git a/rogue/play.c b/rogue/play.c new file mode 100644 index 0000000..c94f6e8 --- /dev/null +++ b/rogue/play.c @@ -0,0 +1,298 @@ +/* $NetBSD: play.c,v 1.6 2003/08/07 09:37:39 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)play.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: play.c,v 1.6 2003/08/07 09:37:39 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * play.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include "rogue.h" + +boolean interrupted = 0; +const char *unknown_command = "unknown command"; + +void +play_level() +{ + short ch; + int count; + + for (;;) { + interrupted = 0; + if (hit_message[0]) { + message(hit_message, 1); + hit_message[0] = 0; + } + if (trap_door) { + trap_door = 0; + return; + } + move(rogue.row, rogue.col); + refresh(); + + ch = rgetchar(); +CMCH: + check_message(); + count = 0; +CH: + switch(ch) { + case '.': + rest((count > 0) ? count : 1); + break; + case 's': + search(((count > 0) ? count : 1), 0); + break; + case 'i': + inventory(&rogue.pack, ALL_OBJECTS); + break; + case 'f': + fight(0); + break; + case 'F': + fight(1); + break; + case 'h': + case 'j': + case 'k': + case 'l': + case 'y': + case 'u': + case 'n': + case 'b': + (void) one_move_rogue(ch, 1); + break; + case 'H': + case 'J': + case 'K': + case 'L': + case 'B': + case 'Y': + case 'U': + case 'N': + case '\010': + case '\012': + case '\013': + case '\014': + case '\031': + case '\025': + case '\016': + case '\002': + multiple_move_rogue(ch); + break; + case 'e': + eat(); + break; + case 'q': + quaff(); + break; + case 'r': + read_scroll(); + break; + case 'm': + move_onto(); + break; + case ',': + kick_into_pack(); + break; + case 'd': + drop(); + break; + case 'P': + put_on_ring(); + break; + case 'R': + remove_ring(); + break; + case '\020': + do { + remessage(count++); + ch = rgetchar(); + } while (ch == '\020'); + goto CMCH; + break; + case '\027': + wizardize(); + break; + case '>': + if (drop_check()) { + return; + } + break; + case '<': + if (check_up()) { + return; + } + break; + case ')': + case ']': + inv_armor_weapon(ch == ')'); + break; + case '=': + inv_rings(); + break; + case '^': + id_trap(); + break; + case '/': + id_type(); + break; + case '?': + id_com(); + break; + case '!': + do_shell(); + break; + case 'o': + edit_opts(); + break; + case 'I': + single_inv(0); + break; + case 'T': + take_off(); + break; + case 'W': + wear(); + break; + case 'w': + wield(); + break; + case 'c': + call_it(); + break; + case 'z': + zapp(); + break; + case 't': + throw(); + break; + case 'v': + message("rogue-clone: Version III. (Tim Stoehr was here), tektronix!zeus!tims", 0); + break; + case 'Q': + quit(0); + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + move(rogue.row, rogue.col); + refresh(); + do { + if (count < 100) { + count = (10 * count) + (ch - '0'); + } + ch = rgetchar(); + } while (is_digit(ch)); + if (ch != CANCEL) { + goto CH; + } + break; + case ' ': + break; + case '\011': + if (wizard) { + inventory(&level_objects, ALL_OBJECTS); + } else { + message(unknown_command, 0); + } + break; + case '\023': + if (wizard) { + draw_magic_map(); + } else { + message(unknown_command, 0); + } + break; + case '\024': + if (wizard) { + show_traps(); + } else { + message(unknown_command, 0); + } + break; + case '\017': + if (wizard) { + show_objects(); + } else { + message(unknown_command, 0); + } + break; + case '\001': + show_average_hp(); + break; + case '\003': + if (wizard) { + c_object_for_wizard(); + } else { + message(unknown_command, 0); + } + break; + case '\015': + if (wizard) { + show_monsters(); + } else { + message(unknown_command, 0); + } + break; + case 'S': + save_game(); + break; + default: + message(unknown_command, 0); + break; + } + } +} diff --git a/rogue/random.c b/rogue/random.c new file mode 100644 index 0000000..eee5c11 --- /dev/null +++ b/rogue/random.c @@ -0,0 +1,147 @@ +/* $NetBSD: random.c,v 1.5 2003/08/07 09:37:39 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)random.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: random.c,v 1.5 2003/08/07 09:37:39 agc Exp $"); +#endif +#endif /* not lint */ + +#include "rogue.h" + +/* + * random.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +static long rntb[32] = { + 3, 0x9a319039, 0x32d9c024, 0x9b663182, 0x5da1f342, + 0xde3b81e0, 0xdf0a6fb5, 0xf103bc02, 0x48f340fb, 0x7449e56b, + 0xbeb1dbb0, 0xab5c5918, 0x946554fd, 0x8c2e680f, 0xeb3d799f, + 0xb11ee0b7, 0x2d436b86, 0xda672e2a, 0x1588ca88, 0xe369735d, + 0x904f35f7, 0xd7158fd6, 0x6fa6f051, 0x616e6b96, 0xac94efdc, + 0x36413f93, 0xc622c298, 0xf5a42ab8, 0x8a88d77b, 0xf5ad9d0e, + 0x8999220b, 0x27fb47b9 +}; + +static long *fptr = &rntb[4]; +static long *rptr = &rntb[1]; +static long *state = &rntb[1]; +static int rand_type = 3; +static int rand_deg = 31; +static int rand_sep = 3; +static long *end_ptr = &rntb[32]; + +void +srrandom(x) + int x; +{ + int i; + + state[0] = (long) x; + if (rand_type != 0) { + for (i = 1; i < rand_deg; i++) { + state[i] = 1103515245 * state[i - 1] + 12345; + } + fptr = &state[rand_sep]; + rptr = &state[0]; + for (i = 0; i < 10 * rand_deg; i++) { + (void) rrandom(); + } + } +} + +long +rrandom() +{ + long i; + + if (rand_type == 0) { + i = state[0] = (state[0]*1103515245 + 12345) & 0x7fffffff; + } else { + *fptr += *rptr; + i = (*fptr >> 1) & 0x7fffffff; + if (++fptr >= end_ptr) { + fptr = state; + ++rptr; + } else { + if (++rptr >= end_ptr) { + rptr = state; + } + } + } + return(i); +} + +int +get_rand(x, y) + int x, y; +{ + int r, t; + long lr; + + if (x > y) { + t = y; + y = x; + x = t; + } + lr = rrandom(); + lr &= (long) 0x00003fff; + r = (int) lr; + r = (r % ((y - x) + 1)) + x; + return(r); +} + +int +rand_percent(percentage) + int percentage; +{ + return(get_rand(1, 100) <= percentage); +} + +int +coin_toss() +{ + return(((rrandom() & 01) ? 1 : 0)); +} diff --git a/rogue/ring.c b/rogue/ring.c new file mode 100644 index 0000000..8971f14 --- /dev/null +++ b/rogue/ring.c @@ -0,0 +1,344 @@ +/* $NetBSD: ring.c,v 1.6 2003/08/07 09:37:39 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)ring.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: ring.c,v 1.6 2003/08/07 09:37:39 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * ring.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include "rogue.h" + +const char *left_or_right = "left or right hand?"; +const char *no_ring = "there's no ring on that hand"; +short stealthy; +short r_rings; +short add_strength; +short e_rings; +short regeneration; +short ring_exp; +short auto_search; +boolean r_teleport; +boolean r_see_invisible; +boolean sustain_strength; +boolean maintain_armor; + +void +put_on_ring() +{ + short ch; + char desc[DCOLS]; + object *ring; + + if (r_rings == 2) { + message("wearing two rings already", 0); + return; + } + if ((ch = pack_letter("put on what?", RING)) == CANCEL) { + return; + } + if (!(ring = get_letter_object(ch))) { + message("no such item.", 0); + return; + } + if (!(ring->what_is & RING)) { + message("that's not a ring", 0); + return; + } + if (ring->in_use_flags & (ON_LEFT_HAND | ON_RIGHT_HAND)) { + message("that ring is already being worn", 0); + return; + } + if (r_rings == 1) { + ch = (rogue.left_ring ? 'r' : 'l'); + } else { + message(left_or_right, 0); + do { + ch = rgetchar(); + } while ((ch != CANCEL) && (ch != 'l') && (ch != 'r') && (ch != '\n') && + (ch != '\r')); + } + if ((ch != 'l') && (ch != 'r')) { + check_message(); + return; + } + if (((ch == 'l') && rogue.left_ring)||((ch == 'r') && rogue.right_ring)) { + check_message(); + message("there's already a ring on that hand", 0); + return; + } + if (ch == 'l') { + do_put_on(ring, 1); + } else { + do_put_on(ring, 0); + } + ring_stats(1); + check_message(); + get_desc(ring, desc); + message(desc, 0); + (void) reg_move(); +} + +/* + * Do not call ring_stats() from within do_put_on(). It will cause + * serious problems when do_put_on() is called from read_pack() in restore(). + */ + +void +do_put_on(ring, on_left) + object *ring; + boolean on_left; +{ + if (on_left) { + ring->in_use_flags |= ON_LEFT_HAND; + rogue.left_ring = ring; + } else { + ring->in_use_flags |= ON_RIGHT_HAND; + rogue.right_ring = ring; + } +} + +void +remove_ring() +{ + boolean left = 0, right = 0; + short ch; + char buf[DCOLS]; + object *ring; + + ring = NULL; + if (r_rings == 0) { + inv_rings(); + } else if (rogue.left_ring && !rogue.right_ring) { + left = 1; + } else if (!rogue.left_ring && rogue.right_ring) { + right = 1; + } else { + message(left_or_right, 0); + do { + ch = rgetchar(); + } while ((ch != CANCEL) && (ch != 'l') && (ch != 'r') && + (ch != '\n') && (ch != '\r')); + left = (ch == 'l'); + right = (ch == 'r'); + check_message(); + } + if (left || right) { + if (left) { + if (rogue.left_ring) { + ring = rogue.left_ring; + } else { + message(no_ring, 0); + } + } else { + if (rogue.right_ring) { + ring = rogue.right_ring; + } else { + message(no_ring, 0); + } + } + if (ring->is_cursed) { + message(curse_message, 0); + } else { + un_put_on(ring); + (void) strcpy(buf, "removed "); + get_desc(ring, buf + 8); + message(buf, 0); + (void) reg_move(); + } + } +} + +void +un_put_on(ring) + object *ring; +{ + if (ring && (ring->in_use_flags & ON_LEFT_HAND)) { + ring->in_use_flags &= (~ON_LEFT_HAND); + rogue.left_ring = 0; + } else if (ring && (ring->in_use_flags & ON_RIGHT_HAND)) { + ring->in_use_flags &= (~ON_RIGHT_HAND); + rogue.right_ring = 0; + } + ring_stats(1); +} + +void +gr_ring(ring, assign_wk) + object *ring; + boolean assign_wk; +{ + ring->what_is = RING; + if (assign_wk) { + ring->which_kind = get_rand(0, (RINGS - 1)); + } + ring->class = 0; + + switch(ring->which_kind) { + /* + case STEALTH: + break; + case SLOW_DIGEST: + break; + case REGENERATION: + break; + case R_SEE_INVISIBLE: + break; + case SUSTAIN_STRENGTH: + break; + case R_MAINTAIN_ARMOR: + break; + case SEARCHING: + break; + */ + case R_TELEPORT: + ring->is_cursed = 1; + break; + case ADD_STRENGTH: + case DEXTERITY: + while ((ring->class = (get_rand(0, 4) - 2)) == 0) ; + ring->is_cursed = (ring->class < 0); + break; + case ADORNMENT: + ring->is_cursed = coin_toss(); + break; + } +} + +void +inv_rings() +{ + char buf[DCOLS]; + + if (r_rings == 0) { + message("not wearing any rings", 0); + } else { + if (rogue.left_ring) { + get_desc(rogue.left_ring, buf); + message(buf, 0); + } + if (rogue.right_ring) { + get_desc(rogue.right_ring, buf); + message(buf, 0); + } + } + if (wizard) { + sprintf(buf, "ste %d, r_r %d, e_r %d, r_t %d, s_s %d, a_s %d, reg %d, r_e %d, s_i %d, m_a %d, aus %d", + stealthy, r_rings, e_rings, r_teleport, sustain_strength, + add_strength, regeneration, ring_exp, r_see_invisible, + maintain_armor, auto_search); + message(buf, 0); + } +} + +void +ring_stats(pr) + boolean pr; +{ + short i; + object *ring; + + stealthy = 0; + r_rings = 0; + e_rings = 0; + r_teleport = 0; + sustain_strength = 0; + add_strength = 0; + regeneration = 0; + ring_exp = 0; + r_see_invisible = 0; + maintain_armor = 0; + auto_search = 0; + + for (i = 0; i < 2; i++) { + if (!(ring = ((i == 0) ? rogue.left_ring : rogue.right_ring))) { + continue; + } + r_rings++; + e_rings++; + switch(ring->which_kind) { + case STEALTH: + stealthy++; + break; + case R_TELEPORT: + r_teleport = 1; + break; + case REGENERATION: + regeneration++; + break; + case SLOW_DIGEST: + e_rings -= 2; + break; + case ADD_STRENGTH: + add_strength += ring->class; + break; + case SUSTAIN_STRENGTH: + sustain_strength = 1; + break; + case DEXTERITY: + ring_exp += ring->class; + break; + case ADORNMENT: + break; + case R_SEE_INVISIBLE: + r_see_invisible = 1; + break; + case MAINTAIN_ARMOR: + maintain_armor = 1; + break; + case SEARCHING: + auto_search += 2; + break; + } + } + if (pr) { + print_stats(STAT_STRENGTH); + relight(); + } +} diff --git a/rogue/rogue.6.in b/rogue/rogue.6.in new file mode 100644 index 0000000..f4333a5 --- /dev/null +++ b/rogue/rogue.6.in @@ -0,0 +1,107 @@ +.\" $NetBSD: rogue.6,v 1.10 2003/08/07 09:37:39 agc Exp $ +.\" +.\" Copyright (c) 1988, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)rogue.6 8.1 (Berkeley) 5/31/93 +.\" +.Dd May 31, 1993 +.Dt ROGUE 6 +.Os +.Sh NAME +.Nm rogue +.Nd exploring The Dungeons of Doom +.Sh SYNOPSIS +.Nm +.Op Fl s +.Op Ar save_file +.\" .Op Fl r +.\" .Op Fl d +.Sh DESCRIPTION +.Nm +is a computer fantasy game with a new twist. +It is CRT oriented and the object of the game is to survive the attacks of +various monsters and get a lot of gold, rather than the puzzle solving +orientation of most computer fantasy games. +.Pp +To get started you really only need to know two commands. +The command +.Ic \&? +will give you a list of the available commands and the command +.Ic \&/ +will identify the things you see on the screen. +.Pp +To win the game (as opposed to merely playing to beat other people's high +scores) you must locate the Amulet of Yendor which is somewhere below +the 20th level of the dungeon and get it out. +Nobody has achieved this yet and if somebody does, they will probably go +down in history as a hero among heroes. +.Pp +When the game ends, either by your death, when you quit, or if you (by +some miracle) manage to win, +.Nm +will give you a list of the top-ten scorers. +The scoring is based entirely upon how much gold you get. +There is a 10% penalty for getting yourself killed. +.Pp +If +.Ar save_file +is specified, +rogue will be restored from the specified saved game file. +.Pp +The +.Fl s +option will print out the list of scores. +.Pp +For more detailed directions, read the document +.Rs +.%T A Guide to the Dungeons of Doom +.Re +.Sh AUTHORS +Timothy Stoehr, +Michael C. Toy, +Kenneth C. R. C. Arnold, +Glenn Wichman +.Sh FILES +.Bl -tag -width @rogue_scorefile@ -compact +.It Pa @rogue_scorefile@ +Score file +.It Pa ~/rogue.save +Default save file +.El +.Sh SEE ALSO +.Rs +.%A Michael C. Toy +.%A Kenneth C. R. C. Arnold +.%T A guide to the Dungeons of Doom +.Re +.Sh BUGS +Probably infinite, although none are known. +However, that Ice Monsters sometimes transfix you permanently is +.Em not +a bug. +It's a feature. diff --git a/rogue/rogue.h b/rogue/rogue.h new file mode 100644 index 0000000..d8a6096 --- /dev/null +++ b/rogue/rogue.h @@ -0,0 +1,800 @@ +/* $NetBSD: rogue.h,v 1.17 2005/02/15 12:54:50 jsm Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)rogue.h 8.1 (Berkeley) 5/31/93 + */ + +/* + * rogue.h + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) This notice shall not be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + */ + +#define boolean char + +#define NOTHING ((unsigned short) 0) +#define OBJECT ((unsigned short) 01) +#define MONSTER ((unsigned short) 02) +#define STAIRS ((unsigned short) 04) +#define HORWALL ((unsigned short) 010) +#define VERTWALL ((unsigned short) 020) +#define DOOR ((unsigned short) 040) +#define FLOOR ((unsigned short) 0100) +#define TUNNEL ((unsigned short) 0200) +#define TRAP ((unsigned short) 0400) +#define HIDDEN ((unsigned short) 01000) + +#define ARMOR ((unsigned short) 01) +#define WEAPON ((unsigned short) 02) +#define SCROL ((unsigned short) 04) +#define POTION ((unsigned short) 010) +#define GOLD ((unsigned short) 020) +#define FOOD ((unsigned short) 040) +#define WAND ((unsigned short) 0100) +#define RING ((unsigned short) 0200) +#define AMULET ((unsigned short) 0400) +#define ALL_OBJECTS ((unsigned short) 0777) + +#define LEATHER 0 +#define RINGMAIL 1 +#define SCALE 2 +#define CHAIN 3 +#define BANDED 4 +#define SPLINT 5 +#define PLATE 6 +#define ARMORS 7 + +#define BOW 0 +#define DART 1 +#define ARROW 2 +#define DAGGER 3 +#define SHURIKEN 4 +#define MACE 5 +#define LONG_SWORD 6 +#define TWO_HANDED_SWORD 7 +#define WEAPONS 8 + +#define MAX_PACK_COUNT 24 + +#define PROTECT_ARMOR 0 +#define HOLD_MONSTER 1 +#define ENCH_WEAPON 2 +#define ENCH_ARMOR 3 +#define IDENTIFY 4 +#define TELEPORT 5 +#define SLEEP 6 +#define SCARE_MONSTER 7 +#define REMOVE_CURSE 8 +#define CREATE_MONSTER 9 +#define AGGRAVATE_MONSTER 10 +#define MAGIC_MAPPING 11 +#define CON_MON 12 +#define SCROLS 13 + +#define INCREASE_STRENGTH 0 +#define RESTORE_STRENGTH 1 +#define HEALING 2 +#define EXTRA_HEALING 3 +#define POISON 4 +#define RAISE_LEVEL 5 +#define BLINDNESS 6 +#define HALLUCINATION 7 +#define DETECT_MONSTER 8 +#define DETECT_OBJECTS 9 +#define CONFUSION 10 +#define LEVITATION 11 +#define HASTE_SELF 12 +#define SEE_INVISIBLE 13 +#define POTIONS 14 + +#define TELE_AWAY 0 +#define SLOW_MONSTER 1 +#define INVISIBILITY 2 +#define POLYMORPH 3 +#define HASTE_MONSTER 4 +#define MAGIC_MISSILE 5 +#define CANCELLATION 6 +#define DO_NOTHING 7 +#define DRAIN_LIFE 8 +#define COLD 9 +#define FIRE 10 +#define WANDS 11 + +#define STEALTH 0 +#define R_TELEPORT 1 +#define REGENERATION 2 +#define SLOW_DIGEST 3 +#define ADD_STRENGTH 4 +#define SUSTAIN_STRENGTH 5 +#define DEXTERITY 6 +#define ADORNMENT 7 +#define R_SEE_INVISIBLE 8 +#define MAINTAIN_ARMOR 9 +#define SEARCHING 10 +#define RINGS 11 + +#define RATION 0 +#define FRUIT 1 + +#define NOT_USED ((unsigned short) 0) +#define BEING_WIELDED ((unsigned short) 01) +#define BEING_WORN ((unsigned short) 02) +#define ON_LEFT_HAND ((unsigned short) 04) +#define ON_RIGHT_HAND ((unsigned short) 010) +#define ON_EITHER_HAND ((unsigned short) 014) +#define BEING_USED ((unsigned short) 017) + +#define NO_TRAP -1 +#define TRAP_DOOR 0 +#define BEAR_TRAP 1 +#define TELE_TRAP 2 +#define DART_TRAP 3 +#define SLEEPING_GAS_TRAP 4 +#define RUST_TRAP 5 +#define TRAPS 6 + +#define STEALTH_FACTOR 3 +#define R_TELE_PERCENT 8 + +#define UNIDENTIFIED ((unsigned short) 00) /* MUST BE ZERO! */ +#define IDENTIFIED ((unsigned short) 01) +#define CALLED ((unsigned short) 02) + +#define DROWS 24 +#define DCOLS 80 +#define NMESSAGES 5 +#define MAX_TITLE_LENGTH 30 +#define MAXSYLLABLES 40 +#define MAX_METAL 14 +#define WAND_MATERIALS 30 +#define GEMS 14 + +#define GOLD_PERCENT 46 + +#define MAX_OPT_LEN 40 + +#define MAX_ID_TITLE_LEN 64 +struct id { + short value; + char title[MAX_ID_TITLE_LEN]; + const char *real; + unsigned short id_status; +}; + +/* The following #defines provide more meaningful names for some of the + * struct object fields that are used for monsters. This, since each monster + * and object (scrolls, potions, etc) are represented by a struct object. + * Ideally, this should be handled by some kind of union structure. + */ + +#define m_damage damage +#define hp_to_kill quantity +#define m_char ichar +#define first_level is_protected +#define last_level is_cursed +#define m_hit_chance class +#define stationary_damage identified +#define drop_percent which_kind +#define trail_char d_enchant +#define slowed_toggle quiver +#define moves_confused hit_enchant +#define nap_length picked_up +#define disguise what_is +#define next_monster next_object + +struct obj { /* comment is monster meaning */ + unsigned long m_flags; /* monster flags */ + const char *damage; /* damage it does */ + short quantity; /* hit points to kill */ + short ichar; /* 'A' is for aquatar */ + short kill_exp; /* exp for killing it */ + short is_protected; /* level starts */ + short is_cursed; /* level ends */ + short class; /* chance of hitting you */ + short identified; /* 'F' damage, 1,2,3... */ + unsigned short which_kind; /* item carry/drop % */ + short o_row, o_col, o; /* o is how many times stuck at o_row, o_col */ + short row, col; /* current row, col */ + short d_enchant; /* room char when detect_monster */ + short quiver; /* monster slowed toggle */ + short trow, tcol; /* target row, col */ + short hit_enchant; /* how many moves is confused */ + unsigned short what_is; /* imitator's charactor (?!%: */ + short picked_up; /* sleep from wand of sleep */ + unsigned short in_use_flags; + struct obj *next_object; /* next monster */ +}; + +typedef struct obj object; + +#define INIT_AW (object*)0 +#define INIT_RINGS (object*)0 +#define INIT_HP 12 +#define INIT_STR 16 +#define INIT_EXPLEVEL 1 +#define INIT_EXP 0 +#define INIT_PACK {0} +#define INIT_GOLD 0 +#define INIT_CHAR '@' +#define INIT_MOVES 1250 + +struct fightr { + object *armor; + object *weapon; + object *left_ring, *right_ring; + short hp_current; + short hp_max; + short str_current; + short str_max; + object pack; + long gold; + short exp; + long exp_points; + short row, col; + short fchar; + short moves_left; +}; + +typedef struct fightr fighter; + +struct dr { + short oth_room; + short oth_row, + oth_col; + short door_row, + door_col; +}; + +typedef struct dr door; + +struct rm { + short bottom_row, right_col, left_col, top_row; + door doors[4]; + unsigned short is_room; +}; + +typedef struct rm room; + +#define MAXROOMS 9 +#define BIG_ROOM 10 + +#define NO_ROOM -1 + +#define PASSAGE -3 /* cur_room value */ + +#define AMULET_LEVEL 26 + +#define R_NOTHING ((unsigned short) 01) +#define R_ROOM ((unsigned short) 02) +#define R_MAZE ((unsigned short) 04) +#define R_DEADEND ((unsigned short) 010) +#define R_CROSS ((unsigned short) 020) + +#define MAX_EXP_LEVEL 21 +#define MAX_EXP 10000001L +#define MAX_GOLD 999999 +#define MAX_ARMOR 99 +#define MAX_HP 999 +#define MAX_STRENGTH 99 +#define LAST_DUNGEON 99 + +#define STAT_LEVEL 01 +#define STAT_GOLD 02 +#define STAT_HP 04 +#define STAT_STRENGTH 010 +#define STAT_ARMOR 020 +#define STAT_EXP 040 +#define STAT_HUNGER 0100 +#define STAT_LABEL 0200 +#define STAT_ALL 0377 + +#define PARTY_TIME 10 /* one party somewhere in each 10 level span */ + +#define MAX_TRAPS 10 /* maximum traps per level */ + +#define HIDE_PERCENT 12 + +struct tr { + short trap_type; + short trap_row, trap_col; +}; + +typedef struct tr trap; + +extern fighter rogue; +extern room rooms[]; +extern trap traps[]; +extern unsigned short dungeon[DROWS][DCOLS]; +extern object level_objects; + +extern struct id id_scrolls[]; +extern struct id id_potions[]; +extern struct id id_wands[]; +extern struct id id_rings[]; +extern struct id id_weapons[]; +extern struct id id_armors[]; + +extern object mon_tab[]; +extern object level_monsters; + +#define MONSTERS 26 + +#define HASTED 01L +#define SLOWED 02L +#define INVISIBLE 04L +#define ASLEEP 010L +#define WAKENS 020L +#define WANDERS 040L +#define FLIES 0100L +#define FLITS 0200L +#define CAN_FLIT 0400L /* can, but usually doesn't, flit */ +#define CONFUSED 01000L +#define RUSTS 02000L +#define HOLDS 04000L +#define FREEZES 010000L +#define STEALS_GOLD 020000L +#define STEALS_ITEM 040000L +#define STINGS 0100000L +#define DRAINS_LIFE 0200000L +#define DROPS_LEVEL 0400000L +#define SEEKS_GOLD 01000000L +#define FREEZING_ROGUE 02000000L +#define RUST_VANISHED 04000000L +#define CONFUSES 010000000L +#define IMITATES 020000000L +#define FLAMES 040000000L +#define STATIONARY 0100000000L /* damage will be 1,2,3,... */ +#define NAPPING 0200000000L /* can't wake up for a while */ +#define ALREADY_MOVED 0400000000L + +#define SPECIAL_HIT (RUSTS|HOLDS|FREEZES|STEALS_GOLD|STEALS_ITEM|STINGS|DRAINS_LIFE|DROPS_LEVEL) + +#define WAKE_PERCENT 45 +#define FLIT_PERCENT 40 +#define PARTY_WAKE_PERCENT 75 + +#define HYPOTHERMIA 1 +#define STARVATION 2 +#define POISON_DART 3 +#define QUIT 4 +#define WIN 5 +#define KFIRE 6 + +#define UPWARD 0 +#define UPRIGHT 1 +#define RIGHT 2 +#define DOWNRIGHT 3 +#define DOWN 4 +#define DOWNLEFT 5 +#define LEFT 6 +#define UPLEFT 7 +#define DIRS 8 + +#define ROW1 7 +#define ROW2 15 + +#define COL1 26 +#define COL2 52 + +#define MOVED 0 +#define MOVE_FAILED -1 +#define STOPPED_ON_SOMETHING -2 +#define CANCEL '\033' +#define LIST '*' + +#define HUNGRY 300 +#define WEAK 150 +#define FAINT 20 +#define STARVE 0 + +#define MIN_ROW 1 + +struct rogue_time { + short year; /* >= 1987 */ + short month; /* 1 - 12 */ + short day; /* 1 - 31 */ + short hour; /* 0 - 23 */ + short minute; /* 0 - 59 */ + short second; /* 0 - 59 */ +}; + +#include + +/* + * external routine declarations. + */ +#include +#include +#include +#include + +object *alloc_object(void); +object *check_duplicate(object *, object *); +const char *get_ench_color(void); +object *get_letter_object(int); +object *get_thrown_at_monster(object *, short, short *, short *); +object *get_zapped_monster(short, short *, short *); +object *gr_monster(object *, int); +object *gr_object(void); +char *md_getenv(const char *); +const char * + md_gln(void); +char *md_malloc(int); +const char *mon_name(const object *); +const char *name_of(const object *); +object *object_at(object *, short, short); +object *pick_up(int, int, short *); +void add_exp(int, boolean); +void add_mazes(void); +void add_traps(void); +void aggravate(void); +void aim_monster(object *); +void bounce(short, short, short, short, short); +void byebye(int); +void c_object_for_wizard(void); +void call_it(void); +boolean can_move(int, int, int, int); +boolean can_turn(int, int); +void center(short, const char *); +void check_gold_seeker(object *); +boolean check_hunger(boolean); +boolean check_imitator(object *); +void check_message(void); +int check_up(void); +void clean_up(const char *) __attribute__((__noreturn__)); +void clear_level(void); +void cnfs(void); +int coin_toss(void); +int connect_rooms(short, short); +void cough_up(object *); +void create_monster(void); +int damage_for_strength(void); +void darken_room(short); +void disappear(object *); +void do_args(int, char **); +void do_opts(void); +void do_put_on(object *, boolean); +void do_shell(void); +void do_wear(object *); +void do_wield(object *); +void dr_course(object *, boolean, short, short); +void drain_life(void); +void draw_magic_map(void); +void draw_simple_passage(short, short, short, short, short); +void drop(void); +int drop_check(void); +void drop_level(void); +void eat(void); +void edit_opts(void); +void env_get_value(char **, char *, boolean); +void error_save(int) __attribute__((__noreturn__)); +void fight(int); +void fill_it(int, boolean); +void fill_out_level(void); +boolean flame_broil(object *); +int flit(object *); +void flop_weapon(object *, short, short); +void free_object(object *); +void free_stuff(object *); +void freeze(object *); +int get_armor_class(const object *); +int get_com_id(int *, short); +int get_damage(const char *, boolean); +void get_desc(const object *, char *); +int get_dir(short, short, short, short); +void get_dir_rc(short, short *, short *, short); +char get_dungeon_char(short, short); +int get_exp_level(long); +void get_food(object *, boolean); +int get_hit_chance(const object *); +int get_input_line(const char *, const char *, char *, const char *, boolean, boolean); +char get_mask_char(unsigned short); +int get_number(const char *); +boolean get_oth_room(short, short *, short *); +int get_rand(int, int); +short get_room_number(int, int); +int get_value(const object *); +int get_w_damage(const object *); +void get_wand_and_ring_materials(void); +int get_weapon_damage(const object *); +char gmc(object *); +char gmc_row_col(int, int); +void go_blind(void); +boolean gold_at(int, int); +void gr_armor(object *); +char gr_dir(void); +char gr_obj_char(void); +void gr_potion(object *); +void gr_ring(object *, boolean); +short gr_room(void); +void gr_row_col(short *, short *, unsigned short); +void gr_scroll(object *); +void gr_wand(object *); +void gr_weapon(object *, int); +void hallucinate(void); +boolean has_amulet(void); +boolean has_been_touched(const struct rogue_time *, const struct rogue_time *); +void heal(void); +void hide_boxed_passage(int, int, int, int, int); +void hold_monster(void); +int hp_raise(void); +void id_all(void); +void id_com(void); +void id_trap(void); +void id_type(void); +void idntfy(void); +boolean imitating(int, int); +int init(int, char **); +void init_str(char **, const char *); +void insert_score(char [][82], char [][30], const char *, short, short, const object *, int); +void inv_armor_weapon(boolean); +void inv_rings(void); +void inventory(const object *, unsigned short); +boolean is_all_connected(void); +boolean is_digit(int); +boolean is_direction(short, short *); +boolean is_pack_letter(short *, unsigned short *); +boolean is_passable(int, int); +boolean is_vowel(short); +void kick_into_pack(void); +void killed_by(const object *, short) __attribute__((__noreturn__)); +long lget_number(const char *); +void light_passage(int, int); +void light_up_room(int); +boolean m_confuse(object *); +void make_level(void); +void make_maze(short, short, short, short, short, short); +void make_party(void); +void make_room(short, short, short, short); +void make_scroll_titles(void); +boolean mask_pack(const object *, unsigned short); +boolean mask_room(short, short *, short *, unsigned short); +boolean md_df(const char *); +void md_exit(int) __attribute__((__noreturn__)); +void md_gct(struct rogue_time *); +int md_get_file_id(const char *); +void md_gfmt(const char *, struct rogue_time *); +int md_gseed(void); +void md_heed_signals(void); +void md_ignore_signals(void); +int md_link_count(const char *); +void md_lock(boolean); +void md_shell(const char *); +void md_sleep(int); +void md_slurp(void); +void message(const char *, boolean); +void mix_colors(void); +void mix_random_rooms(void); +int mon_can_go(const object *, int, int); +int mon_damage(object *, short); +void mon_hit(object *); +boolean mon_sees(const object *, int, int); +int move_confused(object *); +void move_mon_to(object *, int, int); +void move_onto(void); +int mtry(object *, int, int); +void multiple_move_rogue(short); +void mv_1_monster(object *, int, int); +void mv_aquatars(void); +void mv_mons(void); +int name_cmp(char *, const char *); +short next_avail_ichar(void); +boolean next_to_something(int, int); +void nickize(char *, const char *, const char *); +int no_room_for_monster(int); +int one_move_rogue(short, short); +void onintr(int); +void opt_erase(int); +void opt_go(int); +void opt_show(int); +short pack_count(const object *); +short pack_letter(const char *, unsigned short); +void pad(const char *, short); +void party_monsters(int, int); +short party_objects(int); +void place_at(object *, int, int); +void plant_gold(int, int, boolean); +void play_level(void); +void player_init(void); +void potion_heal(int); +int pr_com_id(int); +int pr_motion_char(int); +void print_stats(int); +void put_amulet(void); +void put_door(room *, short, short *, short *); +void put_gold(void); +void put_m_at(int, int, object *); +void put_mons(void); +void put_objects(void); +void put_on_ring(void); +void put_player(short); +void put_scores(const object *, short) __attribute__((__noreturn__)); +void put_stairs(void); +void quaff(void); +void quit(boolean); +int r_index(const char *, int, boolean); +void r_read(FILE *, char *, int); +void r_write(FILE *, const char *, int); +void rand_around(short, short *, short *); +int rand_percent(int); +void rand_place(object *); +void read_pack(object *, FILE *, boolean); +void read_scroll(void); +void read_string(char *, FILE *, size_t); +void recursive_deadend(short, const short *, short, short); +boolean reg_move(void); +void relight(void); +void remessage(short); +void remove_ring(void); +void rest(int); +void restore(const char *); +int rgetchar(void); +void ring_stats(boolean); +int rogue_can_see(int, int); +void rogue_damage(short, object *, short); +void rogue_hit(object *, boolean); +int rogue_is_around(int, int); +long rrandom(void); +void rust(object *); +void rw_dungeon(FILE *, boolean); +void rw_id(struct id *, FILE *, int, boolean); +void rw_rooms(FILE *, boolean); +void s_con_mon(object *); +int same_col(int, int); +int same_row(int, int); +void save_game(void); +void save_into_file(const char *); +void save_screen(void); +void search(short, boolean); +boolean seek_gold(object *); +void sell_pack(void); +void sf_error(void) __attribute__((__noreturn__)); +void show_average_hp(void); +void show_monsters(void); +void show_objects(void); +void show_traps(void); +void single_inv(short); +void sound_bell(void); +void special_hit(object *); +void srrandom(int); +void start_window(void); +void steal_gold(object *); +void steal_item(object *); +void sting(object *); +void stop_window(void); +void take_a_nap(void); +void take_from_pack(object *, object *); +void take_off(void); +void tele(void); +void tele_away(object *); +void throw(void); +boolean throw_at_monster(object *, object *); +int to_hit(const object *); +short trap_at(int, int); +void trap_player(int, int); +boolean try_to_cough(short, short, object *); +void turn_passage(short, boolean); +void un_put_on(object *); +void unblind(void); +void unconfuse(void); +void uncurse_all(void); +void unhallucinate(void); +void unwear(object *); +void unwield(object *); +void vanish(object *, short, object *); +void visit_rooms(int); +void wait_for_ack(void); +void wake_room(short, boolean, short, short); +void wake_up(object *); +void wanderer(void); +void wdrain_life(object *); +void wear(void); +void wield(void); +void win(void) __attribute__((__noreturn__)); +void wizardize(void); +void write_pack(const object *, FILE *); +void write_string(char *, FILE *); +long xxx(boolean); +void xxxx(char *, short); +void zap_monster(object *, unsigned short); +void zapp(void); +object *add_to_pack(object *, object *, int); +struct id *get_id_table(const object *); +unsigned short gr_what_is(void); + +extern boolean ask_quit; +extern boolean being_held; +extern boolean cant_int; +extern boolean con_mon; +extern boolean detect_monster; +extern boolean did_int; +extern boolean interrupted; +extern boolean is_wood[]; +extern boolean jump; +extern boolean maintain_armor; +extern boolean mon_disappeared; +extern boolean msg_cleared; +extern boolean no_skull; +extern boolean passgo; +extern boolean r_see_invisible; +extern boolean r_teleport; +extern boolean save_is_interactive; +extern boolean score_only; +extern boolean see_invisible; +extern boolean sustain_strength; +extern boolean trap_door; +extern boolean wizard; +extern char hit_message[]; +#define HUNGER_STR_LEN 8 +extern char hunger_str[HUNGER_STR_LEN]; +extern char login_name[MAX_OPT_LEN]; +extern const char *byebye_string; +extern const char *curse_message; +extern const char *error_file; +extern char *fruit; +extern const char *const m_names[]; +extern const char *more; +extern const char *new_level_message; +extern char *nick_name; +extern const char *press_space; +extern char *save_file; +extern const char *you_can_move_again; +extern const long level_points[]; +extern short add_strength; +extern short auto_search; +extern short bear_trap; +extern short blind; +extern short confused; +extern short cur_level; +extern short cur_room; +extern short e_rings; +extern short extra_hp; +extern short foods; +extern short halluc; +extern short haste_self; +extern short less_hp; +extern short levitate; +extern short m_moves; +extern short max_level; +extern short party_room; +extern short r_rings; +extern short regeneration; +extern short ring_exp; +extern short stealthy; +extern gid_t gid; +extern gid_t egid; diff --git a/rogue/room.c b/rogue/room.c new file mode 100644 index 0000000..e07fb94 --- /dev/null +++ b/rogue/room.c @@ -0,0 +1,675 @@ +/* $NetBSD: room.c,v 1.7 2003/08/07 09:37:40 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)room.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: room.c,v 1.7 2003/08/07 09:37:40 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * room.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include "rogue.h" + +room rooms[MAXROOMS]; +boolean rooms_visited[MAXROOMS]; + +#define NOPTS 7 + +struct option { + const char *prompt; + boolean is_bool; + char **strval; + boolean *bval; +} options[NOPTS] = { + { + "Show position only at end of run (\"jump\"): ", + 1, (char **) 0, &jump + }, + { + "Follow turnings in passageways (\"passgo\"): ", + 1, (char **) 0, &passgo + }, + { + "Don't print skull when killed (\"noskull\" or \"notombstone\"): ", + 1, (char **) 0, &no_skull + }, + { + "Ask player before saying 'Okay, bye-bye!' (\"askquit\"): ", + 1, (char **) 0, &ask_quit + }, + { + "Name (\"name\"): ", + 0, &nick_name + }, + { + "Fruit (\"fruit\"): ", + 0, &fruit + }, + { + "Save file (\"file\"): ", + 0, &save_file + } +}; + +void +light_up_room(rn) + int rn; +{ + short i, j; + + if (!blind) { + for (i = rooms[rn].top_row; + i <= rooms[rn].bottom_row; i++) { + for (j = rooms[rn].left_col; + j <= rooms[rn].right_col; j++) { + if (dungeon[i][j] & MONSTER) { + object *monster; + + if ((monster = object_at( + &level_monsters, i, j)) != NULL) { + dungeon[monster->row][monster->col] &= (~MONSTER); + monster->trail_char = + get_dungeon_char(monster->row, monster->col); + dungeon[monster->row][monster->col] |= MONSTER; + } + } + mvaddch(i, j, get_dungeon_char(i, j)); + } + } + mvaddch(rogue.row, rogue.col, rogue.fchar); + } +} + +void +light_passage(row, col) + int row, col; +{ + short i, j, i_end, j_end; + + if (blind) { + return; + } + i_end = (row < (DROWS-2)) ? 1 : 0; + j_end = (col < (DCOLS-1)) ? 1 : 0; + + for (i = ((row > MIN_ROW) ? -1 : 0); i <= i_end; i++) { + for (j = ((col > 0) ? -1 : 0); j <= j_end; j++) { + if (can_move(row, col, row+i, col+j)) { + mvaddch(row+i, col+j, get_dungeon_char(row+i, col+j)); + } + } + } +} + +void +darken_room(rn) + short rn; +{ + short i, j; + + for (i = rooms[rn].top_row + 1; i < rooms[rn].bottom_row; i++) { + for (j = rooms[rn].left_col + 1; j < rooms[rn].right_col; j++) { + if (blind) { + mvaddch(i, j, ' '); + } else { + if (!(dungeon[i][j] & (OBJECT | STAIRS)) && + !(detect_monster && (dungeon[i][j] & MONSTER))) { + if (!imitating(i, j)) { + mvaddch(i, j, ' '); + } + if ((dungeon[i][j] & TRAP) && (!(dungeon[i][j] & HIDDEN))) { + mvaddch(i, j, '^'); + } + } + } + } + } +} + +char +get_dungeon_char(row, col) + short row, col; +{ + unsigned short mask = dungeon[row][col]; + + if (mask & MONSTER) { + return(gmc_row_col(row, col)); + } + if (mask & OBJECT) { + object *obj; + + obj = object_at(&level_objects, row, col); + return(get_mask_char(obj->what_is)); + } + if (mask & (TUNNEL | STAIRS | HORWALL | VERTWALL | FLOOR | DOOR)) { + if ((mask & (TUNNEL| STAIRS)) && (!(mask & HIDDEN))) { + return(((mask & STAIRS) ? '%' : '#')); + } + if (mask & HORWALL) { + return('-'); + } + if (mask & VERTWALL) { + return('|'); + } + if (mask & FLOOR) { + if (mask & TRAP) { + if (!(dungeon[row][col] & HIDDEN)) { + return('^'); + } + } + return('.'); + } + if (mask & DOOR) { + if (mask & HIDDEN) { + if (((col > 0) && (dungeon[row][col-1] & HORWALL)) || + ((col < (DCOLS-1)) && (dungeon[row][col+1] & HORWALL))) { + return('-'); + } else { + return('|'); + } + } else { + return('+'); + } + } + } + return(' '); +} + +char +get_mask_char(mask) + unsigned short mask; +{ + switch(mask) { + case SCROL: + return('?'); + case POTION: + return('!'); + case GOLD: + return('*'); + case FOOD: + return(':'); + case WAND: + return('/'); + case ARMOR: + return(']'); + case WEAPON: + return(')'); + case RING: + return('='); + case AMULET: + return(','); + default: + return('~'); /* unknown, something is wrong */ + } +} + +void +gr_row_col(row, col, mask) + short *row, *col; + unsigned short mask; +{ + short rn; + short r, c; + + do { + r = get_rand(MIN_ROW, DROWS-2); + c = get_rand(0, DCOLS-1); + rn = get_room_number(r, c); + } while ((rn == NO_ROOM) || + (!(dungeon[r][c] & mask)) || + (dungeon[r][c] & (~mask)) || + (!(rooms[rn].is_room & (R_ROOM | R_MAZE))) || + ((r == rogue.row) && (c == rogue.col))); + + *row = r; + *col = c; +} + +short +gr_room() +{ + short i; + + do { + i = get_rand(0, MAXROOMS-1); + } while (!(rooms[i].is_room & (R_ROOM | R_MAZE))); + + return(i); +} + +short +party_objects(rn) + int rn; +{ + short i, j, nf = 0; + object *obj; + short n, N, row, col; + boolean found; + + row = col = 0; + N = ((rooms[rn].bottom_row - rooms[rn].top_row) - 1) * + ((rooms[rn].right_col - rooms[rn].left_col) - 1); + n = get_rand(5, 10); + if (n > N) { + n = N - 2; + } + for (i = 0; i < n; i++) { + for (j = found = 0; ((!found) && (j < 250)); j++) { + row = get_rand(rooms[rn].top_row+1, + rooms[rn].bottom_row-1); + col = get_rand(rooms[rn].left_col+1, + rooms[rn].right_col-1); + if ((dungeon[row][col] == FLOOR) || (dungeon[row][col] == TUNNEL)) { + found = 1; + } + } + if (found) { + obj = gr_object(); + place_at(obj, row, col); + nf++; + } + } + return(nf); +} + +short +get_room_number(row, col) + int row, col; +{ + short i; + + for (i = 0; i < MAXROOMS; i++) { + if ((row >= rooms[i].top_row) && (row <= rooms[i].bottom_row) && + (col >= rooms[i].left_col) && (col <= rooms[i].right_col)) { + return(i); + } + } + return(NO_ROOM); +} + +boolean +is_all_connected() +{ + short i, starting_room; + + starting_room = 0; + for (i = 0; i < MAXROOMS; i++) { + rooms_visited[i] = 0; + if (rooms[i].is_room & (R_ROOM | R_MAZE)) { + starting_room = i; + } + } + + visit_rooms(starting_room); + + for (i = 0; i < MAXROOMS; i++) { + if ((rooms[i].is_room & (R_ROOM | R_MAZE)) && (!rooms_visited[i])) { + return(0); + } + } + return(1); +} + +void +visit_rooms(rn) + int rn; +{ + short i; + short oth_rn; + + rooms_visited[rn] = 1; + + for (i = 0; i < 4; i++) { + oth_rn = rooms[rn].doors[i].oth_room; + if ((oth_rn >= 0) && (!rooms_visited[oth_rn])) { + visit_rooms(oth_rn); + } + } +} + +void +draw_magic_map() +{ + short i, j, ch, och; + unsigned short mask = (HORWALL | VERTWALL | DOOR | TUNNEL | TRAP | STAIRS | + MONSTER); + unsigned short s; + + for (i = 0; i < DROWS; i++) { + for (j = 0; j < DCOLS; j++) { + s = dungeon[i][j]; + if (s & mask) { + if (((ch = mvinch(i, j)) == ' ') || + ((ch >= 'A') && (ch <= 'Z')) || (s & (TRAP | HIDDEN))) { + och = ch; + dungeon[i][j] &= (~HIDDEN); + if (s & HORWALL) { + ch = '-'; + } else if (s & VERTWALL) { + ch = '|'; + } else if (s & DOOR) { + ch = '+'; + } else if (s & TRAP) { + ch = '^'; + } else if (s & STAIRS) { + ch = '%'; + } else if (s & TUNNEL) { + ch = '#'; + } else { + continue; + } + if ((!(s & MONSTER)) || (och == ' ')) { + addch(ch); + } + if (s & MONSTER) { + object *monster; + + if ((monster = object_at( + &level_monsters, i, j)) + != NULL) { + monster->trail_char = + ch; + } + } + } + } + } + } +} + +void +dr_course(monster, entering, row, col) + object *monster; + boolean entering; + short row, col; +{ + short i, j, k, rn; + short r, rr; + + monster->row = row; + monster->col = col; + + if (mon_sees(monster, rogue.row, rogue.col)) { + monster->trow = NO_ROOM; + return; + } + rn = get_room_number(row, col); + + if (entering) { /* entering room */ + /* look for door to some other room */ + r = get_rand(0, MAXROOMS-1); + for (i = 0; i < MAXROOMS; i++) { + rr = (r + i) % MAXROOMS; + if ((!(rooms[rr].is_room & (R_ROOM | R_MAZE))) || (rr == rn)) { + continue; + } + for (k = 0; k < 4; k++) { + if (rooms[rr].doors[k].oth_room == rn) { + monster->trow = rooms[rr].doors[k].oth_row; + monster->tcol = rooms[rr].doors[k].oth_col; + if ((monster->trow == row) && + (monster->tcol == col)) { + continue; + } + return; + } + } + } + /* look for door to dead end */ + for (i = rooms[rn].top_row; i <= rooms[rn].bottom_row; i++) { + for (j = rooms[rn].left_col; j <= rooms[rn].right_col; j++) { + if ((i != monster->row) && (j != monster->col) && + (dungeon[i][j] & DOOR)) { + monster->trow = i; + monster->tcol = j; + return; + } + } + } + /* return monster to room that he came from */ + for (i = 0; i < MAXROOMS; i++) { + for (j = 0; j < 4; j++) { + if (rooms[i].doors[j].oth_room == rn) { + for (k = 0; k < 4; k++) { + if (rooms[rn].doors[k].oth_room == i) { + monster->trow = rooms[rn].doors[k].oth_row; + monster->tcol = rooms[rn].doors[k].oth_col; + return; + } + } + } + } + } + /* no place to send monster */ + monster->trow = NO_ROOM; + } else { /* exiting room */ + if (!get_oth_room(rn, &row, &col)) { + monster->trow = NO_ROOM; + } else { + monster->trow = row; + monster->tcol = col; + } + } +} + +boolean +get_oth_room(rn, row, col) + short rn, *row, *col; +{ + short d = -1; + + if (*row == rooms[rn].top_row) { + d = UPWARD/2; + } else if (*row == rooms[rn].bottom_row) { + d = DOWN/2; + } else if (*col == rooms[rn].left_col) { + d = LEFT/2; + } else if (*col == rooms[rn].right_col) { + d = RIGHT/2; + } + if ((d != -1) && (rooms[rn].doors[d].oth_room >= 0)) { + *row = rooms[rn].doors[d].oth_row; + *col = rooms[rn].doors[d].oth_col; + return(1); + } + return(0); +} + +void +edit_opts() +{ + char save[NOPTS+1][DCOLS]; + short i, j; + short ch; + boolean done = 0; + char buf[MAX_OPT_LEN + 2]; + + for (i = 0; i < NOPTS+1; i++) { + for (j = 0; j < DCOLS; j++) { + save[i][j] = mvinch(i, j); + } + if (i < NOPTS) { + opt_show(i); + } + } + opt_go(0); + i = 0; + + while (!done) { + refresh(); + ch = rgetchar(); +CH: + switch(ch) { + case '\033': + done = 1; + break; + case '\012': + case '\015': + if (i == (NOPTS - 1)) { + mvaddstr(NOPTS, 0, press_space); + refresh(); + wait_for_ack(); + done = 1; + } else { + i++; + opt_go(i); + } + break; + case '-': + if (i > 0) { + opt_go(--i); + } else { + sound_bell(); + } + break; + case 't': + case 'T': + case 'f': + case 'F': + if (options[i].is_bool) { + *(options[i].bval) = (((ch == 't') || (ch == 'T')) ? 1 : 0); + opt_show(i); + opt_go(++i); + break; + } + default: + if (options[i].is_bool) { + sound_bell(); + break; + } + j = 0; + if ((ch == '\010') || ((ch >= ' ') && (ch <= '~'))) { + opt_erase(i); + do { + if ((ch >= ' ') && (ch <= '~') && (j < MAX_OPT_LEN)) { + buf[j++] = ch; + buf[j] = '\0'; + addch(ch); + } else if ((ch == '\010') && (j > 0)) { + buf[--j] = '\0'; + move(i, j + strlen(options[i].prompt)); + addch(' '); + move(i, j + strlen(options[i].prompt)); + } + refresh(); + ch = rgetchar(); + } while ((ch != '\012') && (ch != '\015') && (ch != '\033')); + if (j != 0) { + (void) strcpy(*(options[i].strval), buf); + } + opt_show(i); + goto CH; + } else { + sound_bell(); + } + break; + } + } + + for (i = 0; i < NOPTS+1; i++) { + move(i, 0); + for (j = 0; j < DCOLS; j++) { + addch(save[i][j]); + } + } +} + +void +opt_show(i) + int i; +{ + const char *s; + struct option *opt = &options[i]; + + opt_erase(i); + + if (opt->is_bool) { + s = *(opt->bval) ? "True" : "False"; + } else { + s = *(opt->strval); + } + addstr(s); +} + +void +opt_erase(i) + int i; +{ + struct option *opt = &options[i]; + + mvaddstr(i, 0, opt->prompt); + clrtoeol(); +} + +void +opt_go(i) + int i; +{ + move(i, strlen(options[i].prompt)); +} + +void +do_shell() +{ +#ifdef UNIX + const char *sh; + + md_ignore_signals(); + if (!(sh = md_getenv("SHELL"))) { + sh = "/bin/sh"; + } + move(LINES-1, 0); + refresh(); + stop_window(); + printf("\nCreating new shell...\n"); + md_shell(sh); + start_window(); + wrefresh(curscr); + md_heed_signals(); +#endif +} diff --git a/rogue/save.c b/rogue/save.c new file mode 100644 index 0000000..c7655ee --- /dev/null +++ b/rogue/save.c @@ -0,0 +1,430 @@ +/* $NetBSD: save.c,v 1.9 2003/08/07 09:37:40 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: save.c,v 1.9 2003/08/07 09:37:40 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * save.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include +#include "rogue.h" + +short write_failed = 0; +char *save_file = (char *) 0; + +void +save_game() +{ + char fname[64]; + + if (!get_input_line("file name?", save_file, fname, "game not saved", + 0, 1)) { + return; + } + check_message(); + message(fname, 0); + save_into_file(fname); +} + +void +save_into_file(sfile) + const char *sfile; +{ + FILE *fp; + int file_id; + char *name_buffer; + size_t len; + char *hptr; + struct rogue_time rt_buf; + + if (sfile[0] == '~') { + if ((hptr = md_getenv("HOME")) != NULL) { + len = strlen(hptr) + strlen(sfile); + name_buffer = md_malloc(len); + if (name_buffer == NULL) { + message("out of memory for save file name", 0); + sfile = error_file; + } else { + (void) strcpy(name_buffer, hptr); + (void) strcat(name_buffer, sfile+1); + sfile = name_buffer; + } + } + } + if (((fp = fopen(sfile, "w")) == NULL) || + ((file_id = md_get_file_id(sfile)) == -1)) { + message("problem accessing the save file", 0); + return; + } + md_ignore_signals(); + write_failed = 0; + (void) xxx(1); + r_write(fp, (char *) &detect_monster, sizeof(detect_monster)); + r_write(fp, (char *) &cur_level, sizeof(cur_level)); + r_write(fp, (char *) &max_level, sizeof(max_level)); + write_string(hunger_str, fp); + write_string(login_name, fp); + r_write(fp, (char *) &party_room, sizeof(party_room)); + write_pack(&level_monsters, fp); + write_pack(&level_objects, fp); + r_write(fp, (char *) &file_id, sizeof(file_id)); + rw_dungeon(fp, 1); + r_write(fp, (char *) &foods, sizeof(foods)); + r_write(fp, (char *) &rogue, sizeof(fighter)); + write_pack(&rogue.pack, fp); + rw_id(id_potions, fp, POTIONS, 1); + rw_id(id_scrolls, fp, SCROLS, 1); + rw_id(id_wands, fp, WANDS, 1); + rw_id(id_rings, fp, RINGS, 1); + r_write(fp, (char *) traps, (MAX_TRAPS * sizeof(trap))); + r_write(fp, (char *) is_wood, (WANDS * sizeof(boolean))); + r_write(fp, (char *) &cur_room, sizeof(cur_room)); + rw_rooms(fp, 1); + r_write(fp, (char *) &being_held, sizeof(being_held)); + r_write(fp, (char *) &bear_trap, sizeof(bear_trap)); + r_write(fp, (char *) &halluc, sizeof(halluc)); + r_write(fp, (char *) &blind, sizeof(blind)); + r_write(fp, (char *) &confused, sizeof(confused)); + r_write(fp, (char *) &levitate, sizeof(levitate)); + r_write(fp, (char *) &haste_self, sizeof(haste_self)); + r_write(fp, (char *) &see_invisible, sizeof(see_invisible)); + r_write(fp, (char *) &detect_monster, sizeof(detect_monster)); + r_write(fp, (char *) &wizard, sizeof(wizard)); + r_write(fp, (char *) &score_only, sizeof(score_only)); + r_write(fp, (char *) &m_moves, sizeof(m_moves)); + md_gct(&rt_buf); + rt_buf.second += 10; /* allow for some processing time */ + r_write(fp, (char *) &rt_buf, sizeof(rt_buf)); + fclose(fp); + + if (write_failed) { + (void) md_df(sfile); /* delete file */ + } else { + clean_up(""); + } +} + +void +restore(fname) + const char *fname; +{ + FILE *fp; + struct rogue_time saved_time, mod_time; + char buf[4]; + char tbuf[40]; + int new_file_id, saved_file_id; + + fp = NULL; + if (((new_file_id = md_get_file_id(fname)) == -1) || + ((fp = fopen(fname, "r")) == NULL)) { + clean_up("cannot open file"); + } + if (md_link_count(fname) > 1) { + clean_up("file has link"); + } + (void) xxx(1); + r_read(fp, (char *) &detect_monster, sizeof(detect_monster)); + r_read(fp, (char *) &cur_level, sizeof(cur_level)); + r_read(fp, (char *) &max_level, sizeof(max_level)); + read_string(hunger_str, fp, sizeof hunger_str); + + (void) strlcpy(tbuf, login_name, sizeof tbuf); + read_string(login_name, fp, sizeof login_name); + if (strcmp(tbuf, login_name)) { + clean_up("you're not the original player"); + } + + r_read(fp, (char *) &party_room, sizeof(party_room)); + read_pack(&level_monsters, fp, 0); + read_pack(&level_objects, fp, 0); + r_read(fp, (char *) &saved_file_id, sizeof(saved_file_id)); + if (new_file_id != saved_file_id) { + clean_up("sorry, saved game is not in the same file"); + } + rw_dungeon(fp, 0); + r_read(fp, (char *) &foods, sizeof(foods)); + r_read(fp, (char *) &rogue, sizeof(fighter)); + read_pack(&rogue.pack, fp, 1); + rw_id(id_potions, fp, POTIONS, 0); + rw_id(id_scrolls, fp, SCROLS, 0); + rw_id(id_wands, fp, WANDS, 0); + rw_id(id_rings, fp, RINGS, 0); + r_read(fp, (char *) traps, (MAX_TRAPS * sizeof(trap))); + r_read(fp, (char *) is_wood, (WANDS * sizeof(boolean))); + r_read(fp, (char *) &cur_room, sizeof(cur_room)); + rw_rooms(fp, 0); + r_read(fp, (char *) &being_held, sizeof(being_held)); + r_read(fp, (char *) &bear_trap, sizeof(bear_trap)); + r_read(fp, (char *) &halluc, sizeof(halluc)); + r_read(fp, (char *) &blind, sizeof(blind)); + r_read(fp, (char *) &confused, sizeof(confused)); + r_read(fp, (char *) &levitate, sizeof(levitate)); + r_read(fp, (char *) &haste_self, sizeof(haste_self)); + r_read(fp, (char *) &see_invisible, sizeof(see_invisible)); + r_read(fp, (char *) &detect_monster, sizeof(detect_monster)); + r_read(fp, (char *) &wizard, sizeof(wizard)); + r_read(fp, (char *) &score_only, sizeof(score_only)); + r_read(fp, (char *) &m_moves, sizeof(m_moves)); + r_read(fp, (char *) &saved_time, sizeof(saved_time)); + + if (fread(buf, sizeof(char), 1, fp) > 0) { + clear(); + clean_up("extra characters in file"); + } + + md_gfmt(fname, &mod_time); /* get file modification time */ + + if (has_been_touched(&saved_time, &mod_time)) { + clear(); + clean_up("sorry, file has been touched"); + } + if ((!wizard) && !md_df(fname)) { + clean_up("cannot delete file"); + } + msg_cleared = 0; + ring_stats(0); + fclose(fp); +} + +void +write_pack(pack, fp) + const object *pack; + FILE *fp; +{ + object t; + + while ((pack = pack->next_object) != NULL) { + r_write(fp, (const char *) pack, sizeof(object)); + } + t.ichar = t.what_is = 0; + r_write(fp, (const char *) &t, sizeof(object)); +} + +void +read_pack(pack, fp, is_rogue) + object *pack; + FILE *fp; + boolean is_rogue; +{ + object read_obj, *new_obj; + + for (;;) { + r_read(fp, (char *) &read_obj, sizeof(object)); + if (read_obj.ichar == 0) { + pack->next_object = (object *) 0; + break; + } + new_obj = alloc_object(); + *new_obj = read_obj; + if (is_rogue) { + if (new_obj->in_use_flags & BEING_WORN) { + do_wear(new_obj); + } else if (new_obj->in_use_flags & BEING_WIELDED) { + do_wield(new_obj); + } else if (new_obj->in_use_flags & (ON_EITHER_HAND)) { + do_put_on(new_obj, + ((new_obj->in_use_flags & ON_LEFT_HAND) ? 1 : 0)); + } + } + pack->next_object = new_obj; + pack = new_obj; + } +} + +void +rw_dungeon(fp, rw) + FILE *fp; + boolean rw; +{ + short i, j; + char buf[DCOLS]; + + for (i = 0; i < DROWS; i++) { + if (rw) { + r_write(fp, (char *) dungeon[i], (DCOLS * sizeof(dungeon[0][0]))); + for (j = 0; j < DCOLS; j++) { + buf[j] = mvinch(i, j); + } + r_write(fp, buf, DCOLS); + } else { + r_read(fp, (char *) dungeon[i], (DCOLS * sizeof(dungeon[0][0]))); + r_read(fp, buf, DCOLS); + for (j = 0; j < DCOLS; j++) { + mvaddch(i, j, buf[j]); + } + } + } +} + +void +rw_id(id_table, fp, n, wr) + struct id id_table[]; + FILE *fp; + int n; + boolean wr; +{ + short i; + + for (i = 0; i < n; i++) { + if (wr) { + r_write(fp, (const char *) &(id_table[i].value), sizeof(short)); + r_write(fp, (const char *) &(id_table[i].id_status), + sizeof(unsigned short)); + write_string(id_table[i].title, fp); + } else { + r_read(fp, (char *) &(id_table[i].value), sizeof(short)); + r_read(fp, (char *) &(id_table[i].id_status), + sizeof(unsigned short)); + read_string(id_table[i].title, fp, MAX_ID_TITLE_LEN); + } + } +} + +void +write_string(s, fp) + char *s; + FILE *fp; +{ + short n; + + n = strlen(s) + 1; + xxxx(s, n); + r_write(fp, (char *) &n, sizeof(short)); + r_write(fp, s, n); +} + +void +read_string(s, fp, len) + char *s; + FILE *fp; + size_t len; +{ + short n; + + r_read(fp, (char *) &n, sizeof(short)); + if ((size_t)n > len) + clean_up("read_string: corrupt game file"); + r_read(fp, s, n); + xxxx(s, n); +} + +void +rw_rooms(fp, rw) + FILE *fp; + boolean rw; +{ + short i; + + for (i = 0; i < MAXROOMS; i++) { + rw ? r_write(fp, (char *) (rooms + i), sizeof(room)) : + r_read(fp, (char *) (rooms + i), sizeof(room)); + } +} + +void +r_read(fp, buf, n) + FILE *fp; + char *buf; + int n; +{ + if (fread(buf, sizeof(char), n, fp) != (size_t)n) { + clean_up("read() failed, don't know why"); + } +} + +void +r_write(fp, buf, n) + FILE *fp; + const char *buf; + int n; +{ + if (!write_failed) { + if (fwrite(buf, sizeof(char), n, fp) != (size_t)n) { + message("write() failed, don't know why", 0); + sound_bell(); + write_failed = 1; + } + } +} + +boolean +has_been_touched(saved_time, mod_time) + const struct rogue_time *saved_time, *mod_time; +{ + if (saved_time->year < mod_time->year) { + return(1); + } else if (saved_time->year > mod_time->year) { + return(0); + } + if (saved_time->month < mod_time->month) { + return(1); + } else if (saved_time->month > mod_time->month) { + return(0); + } + if (saved_time->day < mod_time->day) { + return(1); + } else if (saved_time->day > mod_time->day) { + return(0); + } + if (saved_time->hour < mod_time->hour) { + return(1); + } else if (saved_time->hour > mod_time->hour) { + return(0); + } + if (saved_time->minute < mod_time->minute) { + return(1); + } else if (saved_time->minute > mod_time->minute) { + return(0); + } + if (saved_time->second < mod_time->second) { + return(1); + } + return(0); +} diff --git a/rogue/score.c b/rogue/score.c new file mode 100644 index 0000000..070329a --- /dev/null +++ b/rogue/score.c @@ -0,0 +1,603 @@ +/* $NetBSD: score.c,v 1.11 2003/08/07 09:37:40 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: score.c,v 1.11 2003/08/07 09:37:40 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * score.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include +#include "rogue.h" +#include "pathnames.h" + +void +killed_by(monster, other) + const object *monster; + short other; +{ + char buf[128]; + + md_ignore_signals(); + + if (other != QUIT) { + rogue.gold = ((rogue.gold * 9) / 10); + } + + if (other) { + switch(other) { + case HYPOTHERMIA: + (void) strcpy(buf, "died of hypothermia"); + break; + case STARVATION: + (void) strcpy(buf, "died of starvation"); + break; + case POISON_DART: + (void) strcpy(buf, "killed by a dart"); + break; + case QUIT: + (void) strcpy(buf, "quit"); + break; + case KFIRE: + (void) strcpy(buf, "killed by fire"); + break; + } + } else { + (void) strcpy(buf, "Killed by "); + if (is_vowel(m_names[monster->m_char - 'A'][0])) { + (void) strcat(buf, "an "); + } else { + (void) strcat(buf, "a "); + } + (void) strcat(buf, m_names[monster->m_char - 'A']); + } + (void) strcat(buf, " with "); + sprintf(buf+strlen(buf), "%ld gold", rogue.gold); + if ((!other) && (!no_skull)) { + clear(); + mvaddstr(4, 32, "__---------__"); + mvaddstr(5, 30, "_~ ~_"); + mvaddstr(6, 29, "/ \\"); + mvaddstr(7, 28, "~ ~"); + mvaddstr(8, 27, "/ \\"); + mvaddstr(9, 27, "| XXXX XXXX |"); + mvaddstr(10, 27, "| XXXX XXXX |"); + mvaddstr(11, 27, "| XXX XXX |"); + mvaddstr(12, 28, "\\ @ /"); + mvaddstr(13, 29, "--\\ @@@ /--"); + mvaddstr(14, 30, "| | @@@ | |"); + mvaddstr(15, 30, "| | | |"); + mvaddstr(16, 30, "| vvVvvvvvvvVvv |"); + mvaddstr(17, 30, "| ^^^^^^^^^^^ |"); + mvaddstr(18, 31, "\\_ _/"); + mvaddstr(19, 33, "~---------~"); + center(21, nick_name); + center(22, buf); + } else { + message(buf, 0); + } + message("", 0); + put_scores(monster, other); +} + +void +win() +{ + unwield(rogue.weapon); /* disarm and relax */ + unwear(rogue.armor); + un_put_on(rogue.left_ring); + un_put_on(rogue.right_ring); + + clear(); + mvaddstr(10, 11, "@ @ @@@ @ @ @ @ @ @@@ @ @ @"); + mvaddstr(11, 11, " @ @ @ @ @ @ @ @ @ @ @ @@ @ @"); + mvaddstr(12, 11, " @ @ @ @ @ @ @ @ @ @ @ @ @ @"); + mvaddstr(13, 11, " @ @ @ @ @ @ @ @ @ @ @ @@"); + mvaddstr(14, 11, " @ @@@ @@@ @@ @@ @@@ @ @ @"); + mvaddstr(17, 11, "Congratulations, you have been admitted to the"); + mvaddstr(18, 11, "Fighters' Guild. You return home, sell all your"); + mvaddstr(19, 11, "treasures at great profit and retire into comfort."); + message("", 0); + message("", 0); + id_all(); + sell_pack(); + put_scores((object *) 0, WIN); +} + +void +quit(from_intrpt) + boolean from_intrpt; +{ + char buf[128]; + short i, orow, ocol; + boolean mc; + + orow = ocol = 0; + mc = FALSE; + md_ignore_signals(); + + if (from_intrpt) { + orow = rogue.row; + ocol = rogue.col; + + mc = msg_cleared; + + for (i = 0; i < DCOLS; i++) { + buf[i] = mvinch(0, i); + } + } + check_message(); + message("really quit?", 1); + if (rgetchar() != 'y') { + md_heed_signals(); + check_message(); + if (from_intrpt) { + for (i = 0; i < DCOLS; i++) { + mvaddch(0, i, buf[i]); + } + msg_cleared = mc; + move(orow, ocol); + refresh(); + } + return; + } + if (from_intrpt) { + clean_up(byebye_string); + } + check_message(); + killed_by((object *) 0, QUIT); +} + +void +put_scores(monster, other) + const object *monster; + short other; +{ + short i, n, rank = 10, x, ne = 0, found_player = -1; + char scores[10][82]; + char n_names[10][30]; + char buf[128]; + FILE *fp; + long s; + boolean dopause = score_only; + + md_lock(1); + + setegid(egid); + if ((fp = fopen(_PATH_SCOREFILE, "r+")) == NULL && + (fp = fopen(_PATH_SCOREFILE, "w+")) == NULL) { + setegid(gid); + message("cannot read/write/create score file", 0); + sf_error(); + } + setegid(gid); + rewind(fp); + (void) xxx(1); + + for (i = 0; i < 10; i++) { + if (((n = fread(scores[i], sizeof(char), 80, fp)) < 80) && (n != 0)) { + sf_error(); + } else if (n != 0) { + xxxx(scores[i], 80); + if ((n = fread(n_names[i], sizeof(char), 30, fp)) < 30) { + sf_error(); + } + xxxx(n_names[i], 30); + } else { + break; + } + ne++; + if ((!score_only) && (found_player == -1)) { + if (!name_cmp(scores[i]+15, login_name)) { + x = 5; + while (scores[i][x] == ' ') { + x++; + } + s = lget_number(scores[i] + x); + if (rogue.gold < s) { + score_only = 1; + } else { + found_player = i; + } + } + } + } + if (found_player != -1) { + ne--; + for (i = found_player; i < ne; i++) { + (void) strcpy(scores[i], scores[i+1]); + (void) strcpy(n_names[i], n_names[i+1]); + } + } + if (!score_only) { + for (i = 0; i < ne; i++) { + x = 5; + while (scores[i][x] == ' ') { + x++; + } + s = lget_number(scores[i] + x); + + if (rogue.gold >= s) { + rank = i; + break; + } + } + if (ne == 0) { + rank = 0; + } else if ((ne < 10) && (rank == 10)) { + rank = ne; + } + if (rank < 10) { + insert_score(scores, n_names, nick_name, rank, ne, + monster, other); + if (ne < 10) { + ne++; + } + } + rewind(fp); + } + + clear(); + mvaddstr(3, 30, "Top Ten Rogueists"); + mvaddstr(8, 0, "Rank Score Name"); + + md_ignore_signals(); + + (void) xxx(1); + + for (i = 0; i < ne; i++) { + if (i == rank) { + standout(); + } + if (i == 9) { + scores[i][0] = '1'; + scores[i][1] = '0'; + } else { + scores[i][0] = ' '; + scores[i][1] = i + '1'; + } + nickize(buf, scores[i], n_names[i]); + mvaddstr(i+10, 0, buf); + if (rank < 10) { + xxxx(scores[i], 80); + fwrite(scores[i], sizeof(char), 80, fp); + xxxx(n_names[i], 30); + fwrite(n_names[i], sizeof(char), 30, fp); + } + if (i == rank) { + standend(); + } + } + md_lock(0); + refresh(); + fclose(fp); + message("", 0); + if (dopause) { + message("", 0); + } + clean_up(""); +} + +void +insert_score(scores, n_names, n_name, rank, n, monster, other) + char scores[][82]; + char n_names[][30]; + const char *n_name; + short rank, n; + const object *monster; + int other; +{ + short i; + char buf[128]; + + if (n > 0) { + for (i = n; i > rank; i--) { + if ((i < 10) && (i > 0)) { + (void) strcpy(scores[i], scores[i-1]); + (void) strcpy(n_names[i], n_names[i-1]); + } + } + } + sprintf(buf, "%2d %6ld %s: ", rank+1, (long)rogue.gold, + login_name); + + if (other) { + switch(other) { + case HYPOTHERMIA: + (void) strcat(buf, "died of hypothermia"); + break; + case STARVATION: + (void) strcat(buf, "died of starvation"); + break; + case POISON_DART: + (void) strcat(buf, "killed by a dart"); + break; + case QUIT: + (void) strcat(buf, "quit"); + break; + case WIN: + (void) strcat(buf, "a total winner"); + break; + case KFIRE: + (void) strcat(buf, "killed by fire"); + break; + } + } else { + (void) strcat(buf, "killed by "); + if (is_vowel(m_names[monster->m_char - 'A'][0])) { + (void) strcat(buf, "an "); + } else { + (void) strcat(buf, "a "); + } + (void) strcat(buf, m_names[monster->m_char - 'A']); + } + sprintf(buf+strlen(buf), " on level %d ", max_level); + if ((other != WIN) && has_amulet()) { + (void) strcat(buf, "with amulet"); + } + for (i = strlen(buf); i < 79; i++) { + buf[i] = ' '; + } + buf[79] = 0; + (void) strcpy(scores[rank], buf); + (void) strcpy(n_names[rank], n_name); +} + +boolean +is_vowel(ch) + short ch; +{ + return( (ch == 'a') || + (ch == 'e') || + (ch == 'i') || + (ch == 'o') || + (ch == 'u') ); +} + +void +sell_pack() +{ + object *obj; + short row = 2, val; + char buf[DCOLS]; + + obj = rogue.pack.next_object; + + clear(); + mvaddstr(1, 0, "Value Item"); + + while (obj) { + if (obj->what_is != FOOD) { + obj->identified = 1; + val = get_value(obj); + rogue.gold += val; + + if (row < DROWS) { + sprintf(buf, "%5d ", val); + get_desc(obj, buf+11); + mvaddstr(row++, 0, buf); + } + } + obj = obj->next_object; + } + refresh(); + if (rogue.gold > MAX_GOLD) { + rogue.gold = MAX_GOLD; + } + message("", 0); +} + +int +get_value(obj) + const object *obj; +{ + short wc; + int val; + + val = 0; + wc = obj->which_kind; + + switch(obj->what_is) { + case WEAPON: + val = id_weapons[wc].value; + if ((wc == ARROW) || (wc == DAGGER) || (wc == SHURIKEN) || + (wc == DART)) { + val *= obj->quantity; + } + val += (obj->d_enchant * 85); + val += (obj->hit_enchant * 85); + break; + case ARMOR: + val = id_armors[wc].value; + val += (obj->d_enchant * 75); + if (obj->is_protected) { + val += 200; + } + break; + case WAND: + val = id_wands[wc].value * (obj->class + 1); + break; + case SCROL: + val = id_scrolls[wc].value * obj->quantity; + break; + case POTION: + val = id_potions[wc].value * obj->quantity; + break; + case AMULET: + val = 5000; + break; + case RING: + val = id_rings[wc].value * (obj->class + 1); + break; + } + if (val <= 0) { + val = 10; + } + return(val); +} + +void +id_all() +{ + short i; + + for (i = 0; i < SCROLS; i++) { + id_scrolls[i].id_status = IDENTIFIED; + } + for (i = 0; i < WEAPONS; i++) { + id_weapons[i].id_status = IDENTIFIED; + } + for (i = 0; i < ARMORS; i++) { + id_armors[i].id_status = IDENTIFIED; + } + for (i = 0; i < WANDS; i++) { + id_wands[i].id_status = IDENTIFIED; + } + for (i = 0; i < POTIONS; i++) { + id_potions[i].id_status = IDENTIFIED; + } +} + +int +name_cmp(s1, s2) + char *s1; + const char *s2; +{ + short i = 0; + int r; + + while(s1[i] != ':') { + i++; + } + s1[i] = 0; + r = strcmp(s1, s2); + s1[i] = ':'; + return(r); +} + +void +xxxx(buf, n) + char *buf; + short n; +{ + short i; + unsigned char c; + + for (i = 0; i < n; i++) { + + /* It does not matter if accuracy is lost during this assignment */ + c = (unsigned char) xxx(0); + + buf[i] ^= c; + } +} + +long +xxx(st) + boolean st; +{ + static long f, s; + long r; + + if (st) { + f = 37; + s = 7; + return(0L); + } + r = ((f * s) + 9337) % 8887; + f = s; + s = r; + return(r); +} + +void +nickize(buf, score, n_name) + char *buf; + const char *score, *n_name; +{ + short i = 15, j; + + if (!n_name[0]) { + (void) strcpy(buf, score); + } else { + (void) strncpy(buf, score, 16); + + while (score[i] != ':') { + i++; + } + + (void) strcpy(buf+15, n_name); + j = strlen(buf); + + while (score[i]) { + buf[j++] = score[i++]; + } + buf[j] = 0; + buf[79] = 0; + } +} + +void +center(row, buf) + short row; + const char *buf; +{ + short margin; + + margin = ((DCOLS - strlen(buf)) / 2); + mvaddstr(row, margin, buf); +} + +void +sf_error() +{ + md_lock(0); + message("", 1); + clean_up("sorry, score file is out of order"); +} diff --git a/rogue/spec_hit.c b/rogue/spec_hit.c new file mode 100644 index 0000000..423f741 --- /dev/null +++ b/rogue/spec_hit.c @@ -0,0 +1,551 @@ +/* $NetBSD: spec_hit.c,v 1.5 2003/08/07 09:37:40 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)spec_hit.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: spec_hit.c,v 1.5 2003/08/07 09:37:40 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * special_hit.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include "rogue.h" + +short less_hp = 0; +boolean being_held; + +void +special_hit(monster) + object *monster; +{ + if ((monster->m_flags & CONFUSED) && rand_percent(66)) { + return; + } + if (monster->m_flags & RUSTS) { + rust(monster); + } + if ((monster->m_flags & HOLDS) && !levitate) { + being_held = 1; + } + if (monster->m_flags & FREEZES) { + freeze(monster); + } + if (monster->m_flags & STINGS) { + sting(monster); + } + if (monster->m_flags & DRAINS_LIFE) { + drain_life(); + } + if (monster->m_flags & DROPS_LEVEL) { + drop_level(); + } + if (monster->m_flags & STEALS_GOLD) { + steal_gold(monster); + } else if (monster->m_flags & STEALS_ITEM) { + steal_item(monster); + } +} + +void +rust(monster) + object *monster; +{ + if ((!rogue.armor) || (get_armor_class(rogue.armor) <= 1) || + (rogue.armor->which_kind == LEATHER)) { + return; + } + if ((rogue.armor->is_protected) || maintain_armor) { + if (monster && (!(monster->m_flags & RUST_VANISHED))) { + message("the rust vanishes instantly", 0); + monster->m_flags |= RUST_VANISHED; + } + } else { + rogue.armor->d_enchant--; + message("your armor weakens", 0); + print_stats(STAT_ARMOR); + } +} + +void +freeze(monster) + object *monster; +{ + short freeze_percent = 99; + short i, n; + + if (rand_percent(12)) { + return; + } + freeze_percent -= (rogue.str_current+(rogue.str_current / 2)); + freeze_percent -= ((rogue.exp + ring_exp) * 4); + freeze_percent -= (get_armor_class(rogue.armor) * 5); + freeze_percent -= (rogue.hp_max / 3); + + if (freeze_percent > 10) { + monster->m_flags |= FREEZING_ROGUE; + message("you are frozen", 1); + + n = get_rand(4, 8); + for (i = 0; i < n; i++) { + mv_mons(); + } + if (rand_percent(freeze_percent)) { + for (i = 0; i < 50; i++) { + mv_mons(); + } + killed_by((object *)0, HYPOTHERMIA); + } + message(you_can_move_again, 1); + monster->m_flags &= (~FREEZING_ROGUE); + } +} + +void +steal_gold(monster) + object *monster; +{ + int amount; + + if ((rogue.gold <= 0) || rand_percent(10)) { + return; + } + + amount = get_rand((cur_level * 10), (cur_level * 30)); + + if (amount > rogue.gold) { + amount = rogue.gold; + } + rogue.gold -= amount; + message("your purse feels lighter", 0); + print_stats(STAT_GOLD); + disappear(monster); +} + +void +steal_item(monster) + object *monster; +{ + object *obj; + short i, n, t = 0; + char desc[80]; + boolean has_something = 0; + + if (rand_percent(15)) { + return; + } + obj = rogue.pack.next_object; + + if (!obj) { + goto DSPR; + } + while (obj) { + if (!(obj->in_use_flags & BEING_USED)) { + has_something = 1; + break; + } + obj = obj->next_object; + } + if (!has_something) { + goto DSPR; + } + n = get_rand(0, MAX_PACK_COUNT); + obj = rogue.pack.next_object; + + for (i = 0; i <= n; i++) { + obj = obj->next_object; + while ((!obj) || (obj->in_use_flags & BEING_USED)) { + if (!obj) { + obj = rogue.pack.next_object; + } else { + obj = obj->next_object; + } + } + } + (void) strcpy(desc, "she stole "); + if (obj->what_is != WEAPON) { + t = obj->quantity; + obj->quantity = 1; + } + get_desc(obj, desc+10); + message(desc, 0); + + obj->quantity = ((obj->what_is != WEAPON) ? t : 1); + + vanish(obj, 0, &rogue.pack); +DSPR: + disappear(monster); +} + +void +disappear(monster) + object *monster; +{ + short row, col; + + row = monster->row; + col = monster->col; + + dungeon[row][col] &= ~MONSTER; + if (rogue_can_see(row, col)) { + mvaddch(row, col, get_dungeon_char(row, col)); + } + take_from_pack(monster, &level_monsters); + free_object(monster); + mon_disappeared = 1; +} + +void +cough_up(monster) + object *monster; +{ + object *obj; + short row, col, i, n; + + if (cur_level < max_level) { + return; + } + + if (monster->m_flags & STEALS_GOLD) { + obj = alloc_object(); + obj->what_is = GOLD; + obj->quantity = get_rand((cur_level * 15), (cur_level * 30)); + } else { + if (!rand_percent((int) monster->drop_percent)) { + return; + } + obj = gr_object(); + } + row = monster->row; + col = monster->col; + + for (n = 0; n <= 5; n++) { + for (i = -n; i <= n; i++) { + if (try_to_cough(row+n, col+i, obj)) { + return; + } + if (try_to_cough(row-n, col+i, obj)) { + return; + } + } + for (i = -n; i <= n; i++) { + if (try_to_cough(row+i, col-n, obj)) { + return; + } + if (try_to_cough(row+i, col+n, obj)) { + return; + } + } + } + free_object(obj); +} + +boolean +try_to_cough(row, col, obj) + short row, col; + object *obj; +{ + if ((row < MIN_ROW) || + (row > (DROWS-2)) || (col < 0) || (col>(DCOLS-1))) { + return(0); + } + if ((!(dungeon[row][col] & (OBJECT | STAIRS | TRAP))) && + (dungeon[row][col] & (TUNNEL | FLOOR | DOOR))) { + place_at(obj, row, col); + if (((row != rogue.row) || (col != rogue.col)) && + (!(dungeon[row][col] & MONSTER))) { + mvaddch(row, col, get_dungeon_char(row, col)); + } + return(1); + } + return(0); +} + +boolean +seek_gold(monster) + object *monster; +{ + short i, j, rn, s; + + if ((rn = get_room_number(monster->row, monster->col)) < 0) { + return(0); + } + for (i = rooms[rn].top_row+1; i < rooms[rn].bottom_row; i++) { + for (j = rooms[rn].left_col+1; j < rooms[rn].right_col; j++) { + if ((gold_at(i, j)) && !(dungeon[i][j] & MONSTER)) { + monster->m_flags |= CAN_FLIT; + s = mon_can_go(monster, i, j); + monster->m_flags &= (~CAN_FLIT); + if (s) { + move_mon_to(monster, i, j); + monster->m_flags |= ASLEEP; + monster->m_flags &= (~(WAKENS | SEEKS_GOLD)); + return(1); + } + monster->m_flags &= (~SEEKS_GOLD); + monster->m_flags |= CAN_FLIT; + mv_1_monster(monster, i, j); + monster->m_flags &= (~CAN_FLIT); + monster->m_flags |= SEEKS_GOLD; + return(1); + } + } + } + return(0); +} + +boolean +gold_at(row, col) + short row, col; +{ + if (dungeon[row][col] & OBJECT) { + object *obj; + + if ((obj = object_at(&level_objects, row, col)) && + (obj->what_is == GOLD)) { + return(1); + } + } + return(0); +} + +void +check_gold_seeker(monster) + object *monster; +{ + monster->m_flags &= (~SEEKS_GOLD); +} + +boolean +check_imitator(monster) + object *monster; +{ + char msg[80]; + + if (monster->m_flags & IMITATES) { + wake_up(monster); + if (!blind) { + mvaddch(monster->row, monster->col, + get_dungeon_char(monster->row, monster->col)); + check_message(); + sprintf(msg, "wait, that's a %s!", mon_name(monster)); + message(msg, 1); + } + return(1); + } + return(0); +} + +boolean +imitating(row, col) + short row, col; +{ + if (dungeon[row][col] & MONSTER) { + object *monster; + + if ((monster = object_at(&level_monsters, row, col)) != NULL) { + if (monster->m_flags & IMITATES) { + return(1); + } + } + } + return(0); +} + +void +sting(monster) + object *monster; +{ + short sting_chance = 35; + char msg[80]; + + if ((rogue.str_current <= 3) || sustain_strength) { + return; + } + sting_chance += (6 * (6 - get_armor_class(rogue.armor))); + + if ((rogue.exp + ring_exp) > 8) { + sting_chance -= (6 * ((rogue.exp + ring_exp) - 8)); + } + if (rand_percent(sting_chance)) { + sprintf(msg, "the %s's bite has weakened you", + mon_name(monster)); + message(msg, 0); + rogue.str_current--; + print_stats(STAT_STRENGTH); + } +} + +void +drop_level() +{ + int hp; + + if (rand_percent(80) || (rogue.exp <= 5)) { + return; + } + rogue.exp_points = level_points[rogue.exp-2] - get_rand(9, 29); + rogue.exp -= 2; + hp = hp_raise(); + if ((rogue.hp_current -= hp) <= 0) { + rogue.hp_current = 1; + } + if ((rogue.hp_max -= hp) <= 0) { + rogue.hp_max = 1; + } + add_exp(1, 0); +} + +void +drain_life() +{ + short n; + + if (rand_percent(60) || (rogue.hp_max <= 30) || (rogue.hp_current < 10)) { + return; + } + n = get_rand(1, 3); /* 1 Hp, 2 Str, 3 both */ + + if ((n != 2) || (!sustain_strength)) { + message("you feel weaker", 0); + } + if (n != 2) { + rogue.hp_max--; + rogue.hp_current--; + less_hp++; + } + if (n != 1) { + if ((rogue.str_current > 3) && (!sustain_strength)) { + rogue.str_current--; + if (coin_toss()) { + rogue.str_max--; + } + } + } + print_stats((STAT_STRENGTH | STAT_HP)); +} + +boolean +m_confuse(monster) + object *monster; +{ + char msg[80]; + + if (!rogue_can_see(monster->row, monster->col)) { + return(0); + } + if (rand_percent(45)) { + monster->m_flags &= (~CONFUSES); /* will not confuse the rogue */ + return(0); + } + if (rand_percent(55)) { + monster->m_flags &= (~CONFUSES); + sprintf(msg, "the gaze of the %s has confused you", mon_name(monster)); + message(msg, 1); + cnfs(); + return(1); + } + return(0); +} + +boolean +flame_broil(monster) + object *monster; +{ + short row, col, dir; + + if ((!mon_sees(monster, rogue.row, rogue.col)) || coin_toss()) { + return(0); + } + row = rogue.row - monster->row; + col = rogue.col - monster->col; + if (row < 0) { + row = -row; + } + if (col < 0) { + col = -col; + } + if (((row != 0) && (col != 0) && (row != col)) || + ((row > 7) || (col > 7))) { + return(0); + } + dir = get_dir(monster->row, monster->col, row, col); + bounce(FIRE, dir, monster->row, monster->col, 0); + + return(1); +} + +int +get_dir(srow, scol, drow, dcol) + short srow, scol, drow, dcol; +{ + if (srow == drow) { + if (scol < dcol) { + return(RIGHT); + } else { + return(LEFT); + } + } + if (scol == dcol) { + if (srow < drow) { + return(DOWN); + } else { + return(UPWARD); + } + } + if ((srow > drow) && (scol > dcol)) { + return(UPLEFT); + } + if ((srow < drow) && (scol < dcol)) { + return(DOWNRIGHT); + } + if ((srow < drow) && (scol > dcol)) { + return(DOWNLEFT); + } + /*if ((srow > drow) && (scol < dcol)) {*/ + return(UPRIGHT); + /*}*/ +} diff --git a/rogue/throw.c b/rogue/throw.c new file mode 100644 index 0000000..af91b6d --- /dev/null +++ b/rogue/throw.c @@ -0,0 +1,326 @@ +/* $NetBSD: throw.c,v 1.6 2003/08/07 09:37:40 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)throw.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: throw.c,v 1.6 2003/08/07 09:37:40 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * throw.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include "rogue.h" + +void +throw() +{ + short wch, d; + boolean first_miss = 1; + object *weapon; + short dir, row, col; + object *monster; + + while (!is_direction(dir = rgetchar(), &d)) { + sound_bell(); + if (first_miss) { + message("direction? ", 0); + first_miss = 0; + } + } + check_message(); + if (dir == CANCEL) { + return; + } + if ((wch = pack_letter("throw what?", WEAPON)) == CANCEL) { + return; + } + check_message(); + + if (!(weapon = get_letter_object(wch))) { + message("no such item.", 0); + return; + } + if ((weapon->in_use_flags & BEING_USED) && weapon->is_cursed) { + message(curse_message, 0); + return; + } + row = rogue.row; col = rogue.col; + + if ((weapon->in_use_flags & BEING_WIELDED) && (weapon->quantity <= 1)) { + unwield(rogue.weapon); + } else if (weapon->in_use_flags & BEING_WORN) { + mv_aquatars(); + unwear(rogue.armor); + print_stats(STAT_ARMOR); + } else if (weapon->in_use_flags & ON_EITHER_HAND) { + un_put_on(weapon); + } + monster = get_thrown_at_monster(weapon, d, &row, &col); + mvaddch(rogue.row, rogue.col, rogue.fchar); + refresh(); + + if (rogue_can_see(row, col) && ((row != rogue.row) || (col != rogue.col))){ + mvaddch(row, col, get_dungeon_char(row, col)); + } + if (monster) { + wake_up(monster); + check_gold_seeker(monster); + + if (!throw_at_monster(monster, weapon)) { + flop_weapon(weapon, row, col); + } + } else { + flop_weapon(weapon, row, col); + } + vanish(weapon, 1, &rogue.pack); +} + +boolean +throw_at_monster(monster, weapon) + object *monster, *weapon; +{ + short damage, hit_chance; + short t; + + hit_chance = get_hit_chance(weapon); + damage = get_weapon_damage(weapon); + if ((weapon->which_kind == ARROW) && + (rogue.weapon && (rogue.weapon->which_kind == BOW))) { + damage += get_weapon_damage(rogue.weapon); + damage = ((damage * 2) / 3); + hit_chance += (hit_chance / 3); + } else if ((weapon->in_use_flags & BEING_WIELDED) && + ((weapon->which_kind == DAGGER) || + (weapon->which_kind == SHURIKEN) || + (weapon->which_kind == DART))) { + damage = ((damage * 3) / 2); + hit_chance += (hit_chance / 3); + } + t = weapon->quantity; + weapon->quantity = 1; + sprintf(hit_message, "the %s", name_of(weapon)); + weapon->quantity = t; + + if (!rand_percent(hit_chance)) { + (void) strcat(hit_message, "misses "); + return(0); + } + s_con_mon(monster); + (void) strcat(hit_message, "hit "); + (void) mon_damage(monster, damage); + return(1); +} + +object * +get_thrown_at_monster(obj, dir, row, col) + object *obj; + short dir; + short *row, *col; +{ + short orow, ocol; + short i, ch; + + orow = *row; ocol = *col; + + ch = get_mask_char(obj->what_is); + + for (i = 0; i < 24; i++) { + get_dir_rc(dir, row, col, 0); + if ( (((*col <= 0) || (*col >= DCOLS-1)) || + (dungeon[*row][*col] == NOTHING)) || + ((dungeon[*row][*col] & (HORWALL | VERTWALL | HIDDEN)) && + (!(dungeon[*row][*col] & TRAP)))) { + *row = orow; + *col = ocol; + return(0); + } + if ((i != 0) && rogue_can_see(orow, ocol)) { + mvaddch(orow, ocol, get_dungeon_char(orow, ocol)); + } + if (rogue_can_see(*row, *col)) { + if (!(dungeon[*row][*col] & MONSTER)) { + mvaddch(*row, *col, ch); + } + refresh(); + } + orow = *row; ocol = *col; + if (dungeon[*row][*col] & MONSTER) { + if (!imitating(*row, *col)) { + return(object_at(&level_monsters, *row, *col)); + } + } + if (dungeon[*row][*col] & TUNNEL) { + i += 2; + } + } + return(0); +} + +void +flop_weapon(weapon, row, col) + object *weapon; + short row, col; +{ + object *new_weapon, *monster; + short i = 0; + char msg[80]; + boolean found = 0; + short mch, dch; + unsigned short mon; + + while ((i < 9) && dungeon[row][col] & ~(FLOOR | TUNNEL | DOOR | MONSTER)) { + rand_around(i++, &row, &col); + if ((row > (DROWS-2)) || (row < MIN_ROW) || + (col > (DCOLS-1)) || (col < 0) || (!dungeon[row][col]) || + (dungeon[row][col] & ~(FLOOR | TUNNEL | DOOR | MONSTER))) { + continue; + } + found = 1; + break; + } + + if (found || (i == 0)) { + new_weapon = alloc_object(); + *new_weapon = *weapon; + new_weapon->in_use_flags = NOT_USED; + new_weapon->quantity = 1; + new_weapon->ichar = 'L'; + place_at(new_weapon, row, col); + if (rogue_can_see(row, col) && + ((row != rogue.row) || (col != rogue.col))) { + mon = dungeon[row][col] & MONSTER; + dungeon[row][col] &= (~MONSTER); + dch = get_dungeon_char(row, col); + if (mon) { + mch = mvinch(row, col); + if ((monster = object_at(&level_monsters, + row, col)) != NULL) { + monster->trail_char = dch; + } + if ((mch < 'A') || (mch > 'Z')) { + mvaddch(row, col, dch); + } + } else { + mvaddch(row, col, dch); + } + dungeon[row][col] |= mon; + } + } else { + short t; + + t = weapon->quantity; + weapon->quantity = 1; + sprintf(msg, "the %svanishes as it hits the ground", + name_of(weapon)); + weapon->quantity = t; + message(msg, 0); + } +} + +void +rand_around(i, r, c) + short i, *r, *c; +{ + static char pos[] = "\010\007\001\003\004\005\002\006\0"; + static short row, col; + short j; + + if (i == 0) { + short x, y, o, t; + + row = *r; + col = *c; + + o = get_rand(1, 8); + + for (j = 0; j < 5; j++) { + x = get_rand(0, 8); + y = (x + o) % 9; + t = pos[x]; + pos[x] = pos[y]; + pos[y] = t; + } + } + switch((short)pos[i]) { + case 0: + *r = row + 1; + *c = col + 1; + break; + case 1: + *r = row + 1; + *c = col - 1; + break; + case 2: + *r = row - 1; + *c = col + 1; + break; + case 3: + *r = row - 1; + *c = col - 1; + break; + case 4: + *r = row; + *c = col + 1; + break; + case 5: + *r = row + 1; + *c = col; + break; + case 6: + *r = row; + *c = col; + break; + case 7: + *r = row - 1; + *c = col; + break; + case 8: + *r = row; + *c = col - 1; + break; + } +} diff --git a/rogue/trap.c b/rogue/trap.c new file mode 100644 index 0000000..9ef133b --- /dev/null +++ b/rogue/trap.c @@ -0,0 +1,285 @@ +/* $NetBSD: trap.c,v 1.6 2003/08/07 09:37:40 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)trap.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: trap.c,v 1.6 2003/08/07 09:37:40 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * trap.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include "rogue.h" + +trap traps[MAX_TRAPS]; +boolean trap_door = 0; +short bear_trap = 0; + +const char *const trap_strings[TRAPS * 2] = { + "trap door", + "you fell down a trap", + "bear trap", + "you are caught in a bear trap", + "teleport trap", + "teleport", + "poison dart trap", + "a small dart just hit you in the shoulder", + "sleeping gas trap", + "a strange white mist envelops you and you fall asleep", + "rust trap", + "a gush of water hits you on the head" +}; + +short +trap_at(row, col) + int row, col; +{ + short i; + + for (i = 0; ((i < MAX_TRAPS) && (traps[i].trap_type != NO_TRAP)); i++) { + if ((traps[i].trap_row == row) && (traps[i].trap_col == col)) { + return(traps[i].trap_type); + } + } + return(NO_TRAP); +} + +void +trap_player(row, col) + short row, col; +{ + short t; + + if ((t = trap_at(row, col)) == NO_TRAP) { + return; + } + dungeon[row][col] &= (~HIDDEN); + if (rand_percent(rogue.exp + ring_exp)) { + message("the trap failed", 1); + return; + } + switch(t) { + case TRAP_DOOR: + trap_door = 1; + new_level_message = trap_strings[(t*2)+1]; + break; + case BEAR_TRAP: + message(trap_strings[(t*2)+1], 1); + bear_trap = get_rand(4, 7); + break; + case TELE_TRAP: + mvaddch(rogue.row, rogue.col, '^'); + tele(); + break; + case DART_TRAP: + message(trap_strings[(t*2)+1], 1); + rogue.hp_current -= get_damage("1d6", 1); + if (rogue.hp_current <= 0) { + rogue.hp_current = 0; + } + if ((!sustain_strength) && rand_percent(40) && + (rogue.str_current >= 3)) { + rogue.str_current--; + } + print_stats(STAT_HP | STAT_STRENGTH); + if (rogue.hp_current <= 0) { + killed_by((object *) 0, POISON_DART); + } + break; + case SLEEPING_GAS_TRAP: + message(trap_strings[(t*2)+1], 1); + take_a_nap(); + break; + case RUST_TRAP: + message(trap_strings[(t*2)+1], 1); + rust((object *) 0); + break; + } +} + +void +add_traps() +{ + short i, n, tries = 0; + short row, col; + + if (cur_level <= 2) { + n = 0; + } else if (cur_level <= 7) { + n = get_rand(0, 2); + } else if (cur_level <= 11) { + n = get_rand(1, 2); + } else if (cur_level <= 16) { + n = get_rand(2, 3); + } else if (cur_level <= 21) { + n = get_rand(2, 4); + } else if (cur_level <= (AMULET_LEVEL + 2)) { + n = get_rand(3, 5); + } else { + n = get_rand(5, MAX_TRAPS); + } + for (i = 0; i < n; i++) { + traps[i].trap_type = get_rand(0, (TRAPS - 1)); + + if ((i == 0) && (party_room != NO_ROOM)) { + do { + row = get_rand((rooms[party_room].top_row+1), + (rooms[party_room].bottom_row-1)); + col = get_rand((rooms[party_room].left_col+1), + (rooms[party_room].right_col-1)); + tries++; + } while (((dungeon[row][col] & (OBJECT|STAIRS|TRAP|TUNNEL)) || + (dungeon[row][col] == NOTHING)) && (tries < 15)); + if (tries >= 15) { + gr_row_col(&row, &col, (FLOOR | MONSTER)); + } + } else { + gr_row_col(&row, &col, (FLOOR | MONSTER)); + } + traps[i].trap_row = row; + traps[i].trap_col = col; + dungeon[row][col] |= (TRAP | HIDDEN); + } +} + +void +id_trap() +{ + short dir, row, col, d, t; + + message("direction? ", 0); + + while (!is_direction(dir = rgetchar(), &d)) { + sound_bell(); + } + check_message(); + + if (dir == CANCEL) { + return; + } + row = rogue.row; + col = rogue.col; + + get_dir_rc(d, &row, &col, 0); + + if ((dungeon[row][col] & TRAP) && (!(dungeon[row][col] & HIDDEN))) { + t = trap_at(row, col); + message(trap_strings[t*2], 0); + } else { + message("no trap there", 0); + } +} + +void +show_traps() +{ + short i, j; + + for (i = 0; i < DROWS; i++) { + for (j = 0; j < DCOLS; j++) { + if (dungeon[i][j] & TRAP) { + mvaddch(i, j, '^'); + } + } + } +} + +void +search(n, is_auto) + short n; + boolean is_auto; +{ + short s, i, j, row, col, t; + short shown = 0, found = 0; + static boolean reg_search; + + for (i = -1; i <= 1; i++) { + for (j = -1; j <= 1; j++) { + row = rogue.row + i; + col = rogue.col + j; + if ((row < MIN_ROW) || (row >= (DROWS-1)) || + (col < 0) || (col >= DCOLS)) { + continue; + } + if (dungeon[row][col] & HIDDEN) { + found++; + } + } + } + for (s = 0; s < n; s++) { + for (i = -1; i <= 1; i++) { + for (j = -1; j <= 1; j++) { + row = rogue.row + i; + col = rogue.col + j ; + if ((row < MIN_ROW) || (row >= (DROWS-1)) || + (col < 0) || (col >= DCOLS)) { + continue; + } + if (dungeon[row][col] & HIDDEN) { + if (rand_percent(17 + (rogue.exp + ring_exp))) { + dungeon[row][col] &= (~HIDDEN); + if ((!blind) && ((row != rogue.row) || + (col != rogue.col))) { + mvaddch(row, col, get_dungeon_char(row, col)); + } + shown++; + if (dungeon[row][col] & TRAP) { + t = trap_at(row, col); + message(trap_strings[t*2], 1); + } + } + } + if (((shown == found) && (found > 0)) || interrupted) { + return; + } + } + } + if ((!is_auto) && (reg_search = !reg_search)) { + (void) reg_move(); + } + } +} diff --git a/rogue/use.c b/rogue/use.c new file mode 100644 index 0000000..2e74fce --- /dev/null +++ b/rogue/use.c @@ -0,0 +1,631 @@ +/* $NetBSD: use.c,v 1.6 2003/08/07 09:37:40 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)use.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: use.c,v 1.6 2003/08/07 09:37:40 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * use.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include "rogue.h" + +short halluc = 0; +short blind = 0; +short confused = 0; +short levitate = 0; +short haste_self = 0; +boolean see_invisible = 0; +short extra_hp = 0; +boolean detect_monster = 0; +boolean con_mon = 0; +const char *strange_feeling = "you have a strange feeling for a moment, then it passes"; + +void +quaff() +{ + short ch; + char buf[80]; + object *obj; + + ch = pack_letter("quaff what?", POTION); + + if (ch == CANCEL) { + return; + } + if (!(obj = get_letter_object(ch))) { + message("no such item.", 0); + return; + } + if (obj->what_is != POTION) { + message("you can't drink that", 0); + return; + } + switch(obj->which_kind) { + case INCREASE_STRENGTH: + message("you feel stronger now, what bulging muscles!", + 0); + rogue.str_current++; + if (rogue.str_current > rogue.str_max) { + rogue.str_max = rogue.str_current; + } + break; + case RESTORE_STRENGTH: + rogue.str_current = rogue.str_max; + message("this tastes great, you feel warm all over", 0); + break; + case HEALING: + message("you begin to feel better", 0); + potion_heal(0); + break; + case EXTRA_HEALING: + message("you begin to feel much better", 0); + potion_heal(1); + break; + case POISON: + if (!sustain_strength) { + rogue.str_current -= get_rand(1, 3); + if (rogue.str_current < 1) { + rogue.str_current = 1; + } + } + message("you feel very sick now", 0); + if (halluc) { + unhallucinate(); + } + break; + case RAISE_LEVEL: + rogue.exp_points = level_points[rogue.exp - 1]; + message("you suddenly feel much more skillful", 0); + add_exp(1, 1); + break; + case BLINDNESS: + go_blind(); + break; + case HALLUCINATION: + message("oh wow, everything seems so cosmic", 0); + halluc += get_rand(500, 800); + break; + case DETECT_MONSTER: + show_monsters(); + if (!(level_monsters.next_monster)) { + message(strange_feeling, 0); + } + break; + case DETECT_OBJECTS: + if (level_objects.next_object) { + if (!blind) { + show_objects(); + } + } else { + message(strange_feeling, 0); + } + break; + case CONFUSION: + message((halluc ? "what a trippy feeling" : + "you feel confused"), 0); + cnfs(); + break; + case LEVITATION: + message("you start to float in the air", 0); + levitate += get_rand(15, 30); + being_held = bear_trap = 0; + break; + case HASTE_SELF: + message("you feel yourself moving much faster", 0); + haste_self += get_rand(11, 21); + if (!(haste_self % 2)) { + haste_self++; + } + break; + case SEE_INVISIBLE: + sprintf(buf, "hmm, this potion tastes like %sjuice", fruit); + message(buf, 0); + if (blind) { + unblind(); + } + see_invisible = 1; + relight(); + break; + } + print_stats((STAT_STRENGTH | STAT_HP)); + if (id_potions[obj->which_kind].id_status != CALLED) { + id_potions[obj->which_kind].id_status = IDENTIFIED; + } + vanish(obj, 1, &rogue.pack); +} + +void +read_scroll() +{ + short ch; + object *obj; + char msg[DCOLS]; + + ch = pack_letter("read what?", SCROL); + + if (ch == CANCEL) { + return; + } + if (!(obj = get_letter_object(ch))) { + message("no such item.", 0); + return; + } + if (obj->what_is != SCROL) { + message("you can't read that", 0); + return; + } + switch(obj->which_kind) { + case SCARE_MONSTER: + message("you hear a maniacal laughter in the distance", + 0); + break; + case HOLD_MONSTER: + hold_monster(); + break; + case ENCH_WEAPON: + if (rogue.weapon) { + if (rogue.weapon->what_is == WEAPON) { + sprintf(msg, "your %sglow%s %sfor a moment", + name_of(rogue.weapon), + ((rogue.weapon->quantity <= 1) ? "s" : ""), + get_ench_color()); + message(msg, 0); + if (coin_toss()) { + rogue.weapon->hit_enchant++; + } else { + rogue.weapon->d_enchant++; + } + } + rogue.weapon->is_cursed = 0; + } else { + message("your hands tingle", 0); + } + break; + case ENCH_ARMOR: + if (rogue.armor) { + sprintf(msg, "your armor glows %sfor a moment", + get_ench_color()); + message(msg, 0); + rogue.armor->d_enchant++; + rogue.armor->is_cursed = 0; + print_stats(STAT_ARMOR); + } else { + message("your skin crawls", 0); + } + break; + case IDENTIFY: + message("this is a scroll of identify", 0); + obj->identified = 1; + id_scrolls[obj->which_kind].id_status = IDENTIFIED; + idntfy(); + break; + case TELEPORT: + tele(); + break; + case SLEEP: + message("you fall asleep", 0); + take_a_nap(); + break; + case PROTECT_ARMOR: + if (rogue.armor) { + message( "your armor is covered by a shimmering gold shield",0); + rogue.armor->is_protected = 1; + rogue.armor->is_cursed = 0; + } else { + message("your acne seems to have disappeared", 0); + } + break; + case REMOVE_CURSE: + message((!halluc) ? + "you feel as though someone is watching over you" : + "you feel in touch with the universal oneness", 0); + uncurse_all(); + break; + case CREATE_MONSTER: + create_monster(); + break; + case AGGRAVATE_MONSTER: + aggravate(); + break; + case MAGIC_MAPPING: + message("this scroll seems to have a map on it", 0); + draw_magic_map(); + break; + case CON_MON: + con_mon = 1; + sprintf(msg, "your hands glow %sfor a moment", get_ench_color()); + message(msg, 0); + break; + } + if (id_scrolls[obj->which_kind].id_status != CALLED) { + id_scrolls[obj->which_kind].id_status = IDENTIFIED; + } + vanish(obj, (obj->which_kind != SLEEP), &rogue.pack); +} + +/* vanish() does NOT handle a quiver of weapons with more than one + * arrow (or whatever) in the quiver. It will only decrement the count. + */ + +void +vanish(obj, rm, pack) + object *obj; + short rm; + object *pack; +{ + if (obj->quantity > 1) { + obj->quantity--; + } else { + if (obj->in_use_flags & BEING_WIELDED) { + unwield(obj); + } else if (obj->in_use_flags & BEING_WORN) { + unwear(obj); + } else if (obj->in_use_flags & ON_EITHER_HAND) { + un_put_on(obj); + } + take_from_pack(obj, pack); + free_object(obj); + } + if (rm) { + (void) reg_move(); + } +} + +void +potion_heal(extra) + int extra; +{ + float ratio; + short add; + + rogue.hp_current += rogue.exp; + + ratio = ((float)rogue.hp_current) / rogue.hp_max; + + if (ratio >= 1.00) { + rogue.hp_max += (extra ? 2 : 1); + extra_hp += (extra ? 2 : 1); + rogue.hp_current = rogue.hp_max; + } else if (ratio >= 0.90) { + rogue.hp_max += (extra ? 1 : 0); + extra_hp += (extra ? 1 : 0); + rogue.hp_current = rogue.hp_max; + } else { + if (ratio < 0.33) { + ratio = 0.33; + } + if (extra) { + ratio += ratio; + } + add = (short)(ratio * ((float)rogue.hp_max - rogue.hp_current)); + rogue.hp_current += add; + if (rogue.hp_current > rogue.hp_max) { + rogue.hp_current = rogue.hp_max; + } + } + if (blind) { + unblind(); + } + if (confused && extra) { + unconfuse(); + } else if (confused) { + confused = (confused / 2) + 1; + } + if (halluc && extra) { + unhallucinate(); + } else if (halluc) { + halluc = (halluc / 2) + 1; + } +} + +void +idntfy() +{ + short ch; + object *obj; + struct id *id_table; + char desc[DCOLS]; +AGAIN: + ch = pack_letter("what would you like to identify?", ALL_OBJECTS); + + if (ch == CANCEL) { + return; + } + if (!(obj = get_letter_object(ch))) { + message("no such item, try again", 0); + message("", 0); + check_message(); + goto AGAIN; + } + obj->identified = 1; + if (obj->what_is & (SCROL | POTION | WEAPON | ARMOR | WAND | RING)) { + id_table = get_id_table(obj); + id_table[obj->which_kind].id_status = IDENTIFIED; + } + get_desc(obj, desc); + message(desc, 0); +} + +void +eat() +{ + short ch; + short moves; + object *obj; + char buf[70]; + + ch = pack_letter("eat what?", FOOD); + + if (ch == CANCEL) { + return; + } + if (!(obj = get_letter_object(ch))) { + message("no such item.", 0); + return; + } + if (obj->what_is != FOOD) { + message("you can't eat that", 0); + return; + } + if ((obj->which_kind == FRUIT) || rand_percent(60)) { + moves = get_rand(950, 1150); + if (obj->which_kind == RATION) { + message("yum, that tasted good", 0); + } else { + sprintf(buf, "my, that was a yummy %s", fruit); + message(buf, 0); + } + } else { + moves = get_rand(750, 950); + message("yuk, that food tasted awful", 0); + add_exp(2, 1); + } + rogue.moves_left /= 3; + rogue.moves_left += moves; + hunger_str[0] = 0; + print_stats(STAT_HUNGER); + + vanish(obj, 1, &rogue.pack); +} + +void +hold_monster() +{ + short i, j; + short mcount = 0; + object *monster; + short row, col; + + for (i = -2; i <= 2; i++) { + for (j = -2; j <= 2; j++) { + row = rogue.row + i; + col = rogue.col + j; + if ((row < MIN_ROW) || (row > (DROWS-2)) || (col < 0) || + (col > (DCOLS-1))) { + continue; + } + if (dungeon[row][col] & MONSTER) { + monster = object_at(&level_monsters, row, col); + monster->m_flags |= ASLEEP; + monster->m_flags &= (~WAKENS); + mcount++; + } + } + } + if (mcount == 0) { + message("you feel a strange sense of loss", 0); + } else if (mcount == 1) { + message("the monster freezes", 0); + } else { + message("the monsters around you freeze", 0); + } +} + +void +tele() +{ + mvaddch(rogue.row, rogue.col, get_dungeon_char(rogue.row, rogue.col)); + + if (cur_room >= 0) { + darken_room(cur_room); + } + put_player(get_room_number(rogue.row, rogue.col)); + being_held = 0; + bear_trap = 0; +} + +void +hallucinate() +{ + object *obj, *monster; + short ch; + + if (blind) return; + + obj = level_objects.next_object; + + while (obj) { + ch = mvinch(obj->row, obj->col); + if (((ch < 'A') || (ch > 'Z')) && + ((obj->row != rogue.row) || (obj->col != rogue.col))) + if ((ch != ' ') && (ch != '.') && (ch != '#') && (ch != '+')) { + addch(gr_obj_char()); + } + obj = obj->next_object; + } + monster = level_monsters.next_monster; + + while (monster) { + ch = mvinch(monster->row, monster->col); + if ((ch >= 'A') && (ch <= 'Z')) { + addch(get_rand('A', 'Z')); + } + monster = monster->next_monster; + } +} + +void +unhallucinate() +{ + halluc = 0; + relight(); + message("everything looks SO boring now", 1); +} + +void +unblind() +{ + blind = 0; + message("the veil of darkness lifts", 1); + relight(); + if (halluc) { + hallucinate(); + } + if (detect_monster) { + show_monsters(); + } +} + +void +relight() +{ + if (cur_room == PASSAGE) { + light_passage(rogue.row, rogue.col); + } else { + light_up_room(cur_room); + } + mvaddch(rogue.row, rogue.col, rogue.fchar); +} + +void +take_a_nap() +{ + short i; + + i = get_rand(2, 5); + md_sleep(1); + + while (i--) { + mv_mons(); + } + md_sleep(1); + message(you_can_move_again, 0); +} + +void +go_blind() +{ + short i, j; + + if (!blind) { + message("a cloak of darkness falls around you", 0); + } + blind += get_rand(500, 800); + + if (detect_monster) { + object *monster; + + monster = level_monsters.next_monster; + + while (monster) { + mvaddch(monster->row, monster->col, monster->trail_char); + monster = monster->next_monster; + } + } + if (cur_room >= 0) { + for (i = rooms[cur_room].top_row + 1; + i < rooms[cur_room].bottom_row; i++) { + for (j = rooms[cur_room].left_col + 1; + j < rooms[cur_room].right_col; j++) { + mvaddch(i, j, ' '); + } + } + } + mvaddch(rogue.row, rogue.col, rogue.fchar); +} + +const char * +get_ench_color() +{ + if (halluc) { + return(id_potions[get_rand(0, POTIONS-1)].title); + } else if (con_mon) { + return("red "); + } + return("blue "); +} + +void +cnfs() +{ + confused += get_rand(12, 22); +} + +void +unconfuse() +{ + char msg[80]; + + confused = 0; + sprintf(msg, "you feel less %s now", (halluc ? "trippy" : "confused")); + message(msg, 1); +} + +void +uncurse_all() +{ + object *obj; + + obj = rogue.pack.next_object; + + while (obj) { + obj->is_cursed = 0; + obj = obj->next_object; + } +} diff --git a/rogue/zap.c b/rogue/zap.c new file mode 100644 index 0000000..73279c0 --- /dev/null +++ b/rogue/zap.c @@ -0,0 +1,412 @@ +/* $NetBSD: zap.c,v 1.6 2003/08/07 09:37:40 agc Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Timothy C. Stoehr. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef lint +#if 0 +static char sccsid[] = "@(#)zap.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: zap.c,v 1.6 2003/08/07 09:37:40 agc Exp $"); +#endif +#endif /* not lint */ + +/* + * zap.c + * + * This source herein may be modified and/or distributed by anybody who + * so desires, with the following restrictions: + * 1.) No portion of this notice shall be removed. + * 2.) Credit shall not be taken for the creation of this source. + * 3.) This code is not to be traded, sold, or used for personal + * gain or profit. + * + */ + +#include "rogue.h" + +boolean wizard = 0; + +void +zapp() +{ + short wch; + boolean first_miss = 1; + object *wand; + short dir, d, row, col; + object *monster; + + while (!is_direction(dir = rgetchar(), &d)) { + sound_bell(); + if (first_miss) { + message("direction? ", 0); + first_miss = 0; + } + } + check_message(); + if (dir == CANCEL) { + return; + } + if ((wch = pack_letter("zap with what?", WAND)) == CANCEL) { + return; + } + check_message(); + + if (!(wand = get_letter_object(wch))) { + message("no such item.", 0); + return; + } + if (wand->what_is != WAND) { + message("you can't zap with that", 0); + return; + } + if (wand->class <= 0) { + message("nothing happens", 0); + } else { + wand->class--; + row = rogue.row; col = rogue.col; + if ((wand->which_kind == COLD) || (wand->which_kind == FIRE)) { + bounce((short) wand->which_kind, d, row, col, 0); + } else { + monster = get_zapped_monster(d, &row, &col); + if (wand->which_kind == DRAIN_LIFE) { + wdrain_life(monster); + } else if (monster) { + wake_up(monster); + s_con_mon(monster); + zap_monster(monster, wand->which_kind); + relight(); + } + } + } + (void) reg_move(); +} + +object * +get_zapped_monster(dir, row, col) + short dir; + short *row, *col; +{ + short orow, ocol; + + for (;;) { + orow = *row; ocol = *col; + get_dir_rc(dir, row, col, 0); + if (((*row == orow) && (*col == ocol)) || + (dungeon[*row][*col] & (HORWALL | VERTWALL)) || + (dungeon[*row][*col] == NOTHING)) { + return(0); + } + if (dungeon[*row][*col] & MONSTER) { + if (!imitating(*row, *col)) { + return(object_at(&level_monsters, *row, *col)); + } + } + } +} + +void +zap_monster(monster, kind) + object *monster; + unsigned short kind; +{ + short row, col; + object *nm; + short tc; + + row = monster->row; + col = monster->col; + + switch(kind) { + case SLOW_MONSTER: + if (monster->m_flags & HASTED) { + monster->m_flags &= (~HASTED); + } else { + monster->slowed_toggle = 0; + monster->m_flags |= SLOWED; + } + break; + case HASTE_MONSTER: + if (monster->m_flags & SLOWED) { + monster->m_flags &= (~SLOWED); + } else { + monster->m_flags |= HASTED; + } + break; + case TELE_AWAY: + tele_away(monster); + break; + case INVISIBILITY: + monster->m_flags |= INVISIBLE; + break; + case POLYMORPH: + if (monster->m_flags & HOLDS) { + being_held = 0; + } + nm = monster->next_monster; + tc = monster->trail_char; + (void) gr_monster(monster, get_rand(0, MONSTERS-1)); + monster->row = row; + monster->col = col; + monster->next_monster = nm; + monster->trail_char = tc; + if (!(monster->m_flags & IMITATES)) { + wake_up(monster); + } + break; + case MAGIC_MISSILE: + rogue_hit(monster, 1); + break; + case CANCELLATION: + if (monster->m_flags & HOLDS) { + being_held = 0; + } + if (monster->m_flags & STEALS_ITEM) { + monster->drop_percent = 0; + } + monster->m_flags &= (~(FLIES | FLITS | SPECIAL_HIT | INVISIBLE | + FLAMES | IMITATES | CONFUSES | SEEKS_GOLD | HOLDS)); + break; + case DO_NOTHING: + message("nothing happens", 0); + break; + } +} + +void +tele_away(monster) + object *monster; +{ + short row, col; + + if (monster->m_flags & HOLDS) { + being_held = 0; + } + gr_row_col(&row, &col, (FLOOR | TUNNEL | STAIRS | OBJECT)); + mvaddch(monster->row, monster->col, monster->trail_char); + dungeon[monster->row][monster->col] &= ~MONSTER; + monster->row = row; monster->col = col; + dungeon[row][col] |= MONSTER; + monster->trail_char = mvinch(row, col); + if (detect_monster || rogue_can_see(row, col)) { + mvaddch(row, col, gmc(monster)); + } +} + +void +wizardize() +{ + char buf[100]; + + if (wizard) { + wizard = 0; + message("not wizard anymore", 0); + } else { + if (get_input_line("wizard's password:", "", buf, "", 0, 0)) { + (void) xxx(1); + xxxx(buf, strlen(buf)); + if (!strncmp(buf, "\247\104\126\272\115\243\027", 7)) { + wizard = 1; + score_only = 1; + message("Welcome, mighty wizard!", 0); + } else { + message("sorry", 0); + } + } + } +} + +void +wdrain_life(monster) + object *monster; +{ + short hp; + object *lmon, *nm; + + hp = rogue.hp_current / 3; + rogue.hp_current = (rogue.hp_current + 1) / 2; + + if (cur_room >= 0) { + lmon = level_monsters.next_monster; + while (lmon) { + nm = lmon->next_monster; + if (get_room_number(lmon->row, lmon->col) == cur_room) { + wake_up(lmon); + (void) mon_damage(lmon, hp); + } + lmon = nm; + } + } else { + if (monster) { + wake_up(monster); + (void) mon_damage(monster, hp); + } + } + print_stats(STAT_HP); + relight(); +} + +void +bounce(ball, dir, row, col, r) + short ball, dir, row, col, r; +{ + short orow, ocol; + char buf[DCOLS]; + const char *s; + short i, ch, new_dir = -1, damage; + static short btime; + + if (++r == 1) { + btime = get_rand(3, 6); + } else if (r > btime) { + return; + } + + if (ball == FIRE) { + s = "fire"; + } else { + s = "ice"; + } + if (r > 1) { + sprintf(buf, "the %s bounces", s); + message(buf, 0); + } + orow = row; + ocol = col; + do { + ch = mvinch(orow, ocol); + standout(); + mvaddch(orow, ocol, ch); + get_dir_rc(dir, &orow, &ocol, 1); + } while (!( (ocol <= 0) || + (ocol >= DCOLS-1) || + (dungeon[orow][ocol] == NOTHING) || + (dungeon[orow][ocol] & MONSTER) || + (dungeon[orow][ocol] & (HORWALL | VERTWALL)) || + ((orow == rogue.row) && (ocol == rogue.col)))); + standend(); + refresh(); + do { + orow = row; + ocol = col; + ch = mvinch(row, col); + mvaddch(row, col, ch); + get_dir_rc(dir, &row, &col, 1); + } while (!( (col <= 0) || + (col >= DCOLS-1) || + (dungeon[row][col] == NOTHING) || + (dungeon[row][col] & MONSTER) || + (dungeon[row][col] & (HORWALL | VERTWALL)) || + ((row == rogue.row) && (col == rogue.col)))); + + if (dungeon[row][col] & MONSTER) { + object *monster; + + monster = object_at(&level_monsters, row, col); + + wake_up(monster); + if (rand_percent(33)) { + sprintf(buf, "the %s misses the %s", s, mon_name(monster)); + message(buf, 0); + goto ND; + } + if (ball == FIRE) { + if (!(monster->m_flags & RUSTS)) { + if (monster->m_flags & FREEZES) { + damage = monster->hp_to_kill; + } else if (monster->m_flags & FLAMES) { + damage = (monster->hp_to_kill / 10) + 1; + } else { + damage = get_rand((rogue.hp_current / 3), rogue.hp_max); + } + } else { + damage = (monster->hp_to_kill / 2) + 1; + } + sprintf(buf, "the %s hits the %s", s, mon_name(monster)); + message(buf, 0); + (void) mon_damage(monster, damage); + } else { + damage = -1; + if (!(monster->m_flags & FREEZES)) { + if (rand_percent(33)) { + message("the monster is frozen", 0); + monster->m_flags |= (ASLEEP | NAPPING); + monster->nap_length = get_rand(3, 6); + } else { + damage = rogue.hp_current / 4; + } + } else { + damage = -2; + } + if (damage != -1) { + sprintf(buf, "the %s hits the %s", s, mon_name(monster)); + message(buf, 0); + (void) mon_damage(monster, damage); + } + } + } else if ((row == rogue.row) && (col == rogue.col)) { + if (rand_percent(10 + (3 * get_armor_class(rogue.armor)))) { + sprintf(buf, "the %s misses", s); + message(buf, 0); + goto ND; + } else { + damage = get_rand(3, (3 * rogue.exp)); + if (ball == FIRE) { + damage = (damage * 3) / 2; + damage -= get_armor_class(rogue.armor); + } + sprintf(buf, "the %s hits", s); + rogue_damage(damage, (object *) 0, + ((ball == FIRE) ? KFIRE : HYPOTHERMIA)); + message(buf, 0); + } + } else { + short nrow, ncol; + +ND: for (i = 0; i < 10; i++) { + dir = get_rand(0, DIRS-1); + nrow = orow; + ncol = ocol; + get_dir_rc(dir, &nrow, &ncol, 1); + if (((ncol >= 0) && (ncol <= DCOLS-1)) && + (dungeon[nrow][ncol] != NOTHING) && + (!(dungeon[nrow][ncol] & (VERTWALL | HORWALL)))) { + new_dir = dir; + break; + } + } + if (new_dir != -1) { + bounce(ball, new_dir, orow, ocol, r); + } + } +} diff --git a/substfiles b/substfiles new file mode 100644 index 0000000..f9aec78 --- /dev/null +++ b/substfiles @@ -0,0 +1,52 @@ +# substfiles - list of files in which parameters are to be substituted. +# These ones get substituted in at configure time. +# +# Copyright (c) 1997, 1998, 1999, 2000 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +Makeconfig +hide-game +install-man +install-score +atc/pathnames.h +battlestar/pathnames.h +boggle/boggle/bog.h +canfield/canfield/pathnames.h +cribbage/pathnames.h +dm/pathnames.h +fish/pathnames.h +fortune/fortune/pathnames.h +hack/pathnames.h +hangman/pathnames.h +monop/pathnames.h +phantasia/pathnames.h +quiz/pathnames.h +robots/pathnames.h +rogue/pathnames.h +sail/pathnames.h +snake/snake/pathnames.h +tetris/pathnames.h +wump/pathnames.h diff --git a/substfiles2 b/substfiles2 new file mode 100644 index 0000000..5f7aae3 --- /dev/null +++ b/substfiles2 @@ -0,0 +1,51 @@ +# substfiles2 - list of files in which parameters are to be substituted. +# These ones get substituted during the make process. +# +# Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +atc/atc.6 +backgammon/backgammon/backgammon.6 +caesar/rot13 +canfield/canfield/canfield.6 +cribbage/cribbage.6 +dm/dm.8 +dm/dm.conf.5 +fortune/fortune/fortune.6 +hack/hack.6 +hangman/hangman.6 +hunt/hunt/hunt.6 +hunt/huntd/huntd.6 +monop/monop.6 +quiz/datfiles/index +quiz/quiz.6 +robots/robots.6 +rogue/rogue.6 +snake/snake/snake.6 +tetris/tetris.6 +trek/trek.6 +wtf/wtf.6 +wtf/wtf diff --git a/substscr b/substscr new file mode 100755 index 0000000..877f0df --- /dev/null +++ b/substscr @@ -0,0 +1,99 @@ +#!/bin/sh +# substscr - substitute parameters to create a file from a .in. +# +# Copyright (c) 1999, 2004 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +# First argument is some combination of: +# r to generate makefile rules +# g to generate the file in question + +# Second argument gives the style of comment: +# c for C comment +# h for generic # comment +# m for manpage comment +# n for none +# s for shell comment + +# Third argument is the source file. + +# Fourth argument is the target file. + +# The target gets its execute permissions from the source. + +set -e + +if [ $# != 4 ]; then + echo "usage: $0 action comment-style source target" >&2 + exit 1 +fi + +action="$1" +style="$2" +source="$3" +target="$4" + +if echo $action |grep -q g; then + echo "Generating $target from $source" + rm -f $target + + case "$style" in + (c) + echo "/* Automatically generated from $source. Do not edit. */" >"$target" + ;; + (h) + echo "# Automatically generated from $source. Do not edit." >"$target" + ;; + (m) + echo ".\\\" Automatically generated from $source. Do not edit." >"$target" + ;; + (n) + : >"$target" + ;; + (s) + echo "#!/bin/sh" >"$target" + echo "# Automatically generated from $source. Do not edit." >>"$target" + ;; + (*) + echo "$0: unknown comment style $style" >&2 + exit 1 + esac + + sed -f subst.sed <"$source" >>"$target" + + if [ -x "$source" ]; then + chmod a+x "$target" + fi +fi + +if echo $action |grep -q r; then + # Append to subst.rules. + cat >>subst.rules <-: I don't think that is possible. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out10 b/tests/battlestar.out10 new file mode 100644 index 0000000..3fb5bef --- /dev/null +++ b/tests/battlestar.out10 @@ -0,0 +1,98 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: + These are the executive suites of the battlestar. +Luxurious staterooms carpeted with crushed velvet and adorned with beaten +gold open onto this parlor. A wide staircase with ivory banisters leads +up or down. This parlor leads into a hallway left. The bridal suite is +right. Other rooms lie ahead and behind you. + +>-: + You are in what was once an elegant stateroom. +Whoever lived in this stateroom, he and his female companion +were mercilessly slain in their sleep. Clothes, trinkets and personal +belongings are scattered all across the floor. Through a hole in the +collapsed floor I can see a hallway below. A door is behind you. + +There is a strange golden amulet on the floor here. +>-: + The hallway is very congested with rubble here. +It is too choked with broken steel girders and other debris to continue +on much farther. Above, the ceiling has caved in and it is possible to +climb up. There is not much chance to go back, ahead, or left. +But the hallway seems clearer right. + +There are a few coins here. +>-: + You are in a wide hallway leading to the main hangar. +The walls and ceiling here have been blasted through in several places. +It looks as if quite a battle has been fought for possession of the landing bay +Gaping corpses litter the floor. The hallway continues behind you. +The main hangar is ahead. + +>-: + You are in the main hangar. +This is a huge bay where many fighters and cargo craft lie. Alarms are +sounding and fighter pilots are running to their ships. Above is a gallery +overlooking the bay. The scream of turbo engines is coming from right. The rest +of the hangar is left. There is an exit behind you. + +>-: + This is the launch room. +From the launch tubes here fighters blast off into space. Only one is left, +and it is guarded by two fierce men. A staircase leads up from here. +There is a cluttered workbench ahead. From the main hangar come sounds of great +explosions. The main hangar is behind you. The viper launch tubes are right. + +>-: + You are in the viper launch tube. +The two guards are eyeing you warily! + +There is a Viper ready for launch here. +>-: You climb into the viper and prepare for launch. +With a touch of your thumb the turbo engines ignite, thrusting you back into +your seat. + + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +You are flying through an asteroid field! +>-: pajamas: +Taken. +pajamas: +Dropped. +>-: pajamas: +Taken. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out11 b/tests/battlestar.out11 new file mode 100644 index 0000000..b3abaea --- /dev/null +++ b/tests/battlestar.out11 @@ -0,0 +1,98 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: + These are the executive suites of the battlestar. +Luxurious staterooms carpeted with crushed velvet and adorned with beaten +gold open onto this parlor. A wide staircase with ivory banisters leads +up or down. This parlor leads into a hallway left. The bridal suite is +right. Other rooms lie ahead and behind you. + +>-: + You are in what was once an elegant stateroom. +Whoever lived in this stateroom, he and his female companion +were mercilessly slain in their sleep. Clothes, trinkets and personal +belongings are scattered all across the floor. Through a hole in the +collapsed floor I can see a hallway below. A door is behind you. + +There is a strange golden amulet on the floor here. +>-: + The hallway is very congested with rubble here. +It is too choked with broken steel girders and other debris to continue +on much farther. Above, the ceiling has caved in and it is possible to +climb up. There is not much chance to go back, ahead, or left. +But the hallway seems clearer right. + +There are a few coins here. +>-: + You are in a wide hallway leading to the main hangar. +The walls and ceiling here have been blasted through in several places. +It looks as if quite a battle has been fought for possession of the landing bay +Gaping corpses litter the floor. The hallway continues behind you. +The main hangar is ahead. + +>-: + You are in the main hangar. +This is a huge bay where many fighters and cargo craft lie. Alarms are +sounding and fighter pilots are running to their ships. Above is a gallery +overlooking the bay. The scream of turbo engines is coming from right. The rest +of the hangar is left. There is an exit behind you. + +>-: + This is the launch room. +From the launch tubes here fighters blast off into space. Only one is left, +and it is guarded by two fierce men. A staircase leads up from here. +There is a cluttered workbench ahead. From the main hangar come sounds of great +explosions. The main hangar is behind you. The viper launch tubes are right. + +>-: + You are in the viper launch tube. +The two guards are eyeing you warily! + +There is a Viper ready for launch here. +>-: You climb into the viper and prepare for launch. +With a touch of your thumb the turbo engines ignite, thrusting you back into +your seat. + + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +You are flying through an asteroid field! +>-: pajamas: +Taken. +pajamas: +Dropped. +>-: pajamas: +Kicked. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out12 b/tests/battlestar.out12 new file mode 100644 index 0000000..107e3d9 --- /dev/null +++ b/tests/battlestar.out12 @@ -0,0 +1,99 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: + These are the executive suites of the battlestar. +Luxurious staterooms carpeted with crushed velvet and adorned with beaten +gold open onto this parlor. A wide staircase with ivory banisters leads +up or down. This parlor leads into a hallway left. The bridal suite is +right. Other rooms lie ahead and behind you. + +>-: + You are in what was once an elegant stateroom. +Whoever lived in this stateroom, he and his female companion +were mercilessly slain in their sleep. Clothes, trinkets and personal +belongings are scattered all across the floor. Through a hole in the +collapsed floor I can see a hallway below. A door is behind you. + +There is a strange golden amulet on the floor here. +>-: + The hallway is very congested with rubble here. +It is too choked with broken steel girders and other debris to continue +on much farther. Above, the ceiling has caved in and it is possible to +climb up. There is not much chance to go back, ahead, or left. +But the hallway seems clearer right. + +There are a few coins here. +>-: + You are in a wide hallway leading to the main hangar. +The walls and ceiling here have been blasted through in several places. +It looks as if quite a battle has been fought for possession of the landing bay +Gaping corpses litter the floor. The hallway continues behind you. +The main hangar is ahead. + +>-: + You are in the main hangar. +This is a huge bay where many fighters and cargo craft lie. Alarms are +sounding and fighter pilots are running to their ships. Above is a gallery +overlooking the bay. The scream of turbo engines is coming from right. The rest +of the hangar is left. There is an exit behind you. + +>-: + This is the launch room. +From the launch tubes here fighters blast off into space. Only one is left, +and it is guarded by two fierce men. A staircase leads up from here. +There is a cluttered workbench ahead. From the main hangar come sounds of great +explosions. The main hangar is behind you. The viper launch tubes are right. + +>-: + You are in the viper launch tube. +The two guards are eyeing you warily! + +There is a Viper ready for launch here. +>-: You climb into the viper and prepare for launch. +With a touch of your thumb the turbo engines ignite, thrusting you back into +your seat. + + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +You are flying through an asteroid field! +>-: pajamas: +Taken. +pajamas: +Dropped. +>-: pajamas: +You aren't holding the pajamas. +Kicked instead. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out13 b/tests/battlestar.out13 new file mode 100644 index 0000000..67aadf7 --- /dev/null +++ b/tests/battlestar.out13 @@ -0,0 +1,99 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: + These are the executive suites of the battlestar. +Luxurious staterooms carpeted with crushed velvet and adorned with beaten +gold open onto this parlor. A wide staircase with ivory banisters leads +up or down. This parlor leads into a hallway left. The bridal suite is +right. Other rooms lie ahead and behind you. + +>-: + You are in what was once an elegant stateroom. +Whoever lived in this stateroom, he and his female companion +were mercilessly slain in their sleep. Clothes, trinkets and personal +belongings are scattered all across the floor. Through a hole in the +collapsed floor I can see a hallway below. A door is behind you. + +There is a strange golden amulet on the floor here. +>-: + The hallway is very congested with rubble here. +It is too choked with broken steel girders and other debris to continue +on much farther. Above, the ceiling has caved in and it is possible to +climb up. There is not much chance to go back, ahead, or left. +But the hallway seems clearer right. + +There are a few coins here. +>-: + You are in a wide hallway leading to the main hangar. +The walls and ceiling here have been blasted through in several places. +It looks as if quite a battle has been fought for possession of the landing bay +Gaping corpses litter the floor. The hallway continues behind you. +The main hangar is ahead. + +>-: + You are in the main hangar. +This is a huge bay where many fighters and cargo craft lie. Alarms are +sounding and fighter pilots are running to their ships. Above is a gallery +overlooking the bay. The scream of turbo engines is coming from right. The rest +of the hangar is left. There is an exit behind you. + +>-: + This is the launch room. +From the launch tubes here fighters blast off into space. Only one is left, +and it is guarded by two fierce men. A staircase leads up from here. +There is a cluttered workbench ahead. From the main hangar come sounds of great +explosions. The main hangar is behind you. The viper launch tubes are right. + +>-: + You are in the viper launch tube. +The two guards are eyeing you warily! + +There is a Viper ready for launch here. +>-: You climb into the viper and prepare for launch. +With a touch of your thumb the turbo engines ignite, thrusting you back into +your seat. + + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +You are flying through an asteroid field! +>-: pajamas: +Taken. +pajamas: +Dropped. +>-: pajamas: +Taken. +You are now wearing the pajamas. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out14 b/tests/battlestar.out14 new file mode 100644 index 0000000..cf5e622 --- /dev/null +++ b/tests/battlestar.out14 @@ -0,0 +1,16 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: I see nothing like that here. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out15 b/tests/battlestar.out15 new file mode 100644 index 0000000..1946204 --- /dev/null +++ b/tests/battlestar.out15 @@ -0,0 +1,15 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out16 b/tests/battlestar.out16 new file mode 100644 index 0000000..43c65ef --- /dev/null +++ b/tests/battlestar.out16 @@ -0,0 +1,16 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: Don't be ridiculous. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out17 b/tests/battlestar.out17 new file mode 100644 index 0000000..43c65ef --- /dev/null +++ b/tests/battlestar.out17 @@ -0,0 +1,16 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: Don't be ridiculous. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out18 b/tests/battlestar.out18 new file mode 100644 index 0000000..43c65ef --- /dev/null +++ b/tests/battlestar.out18 @@ -0,0 +1,16 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: Don't be ridiculous. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out19 b/tests/battlestar.out19 new file mode 100644 index 0000000..43c65ef --- /dev/null +++ b/tests/battlestar.out19 @@ -0,0 +1,16 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: Don't be ridiculous. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out2 b/tests/battlestar.out2 new file mode 100644 index 0000000..653c2af --- /dev/null +++ b/tests/battlestar.out2 @@ -0,0 +1,16 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: I don't think that is possible. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out20 b/tests/battlestar.out20 new file mode 100644 index 0000000..43c65ef --- /dev/null +++ b/tests/battlestar.out20 @@ -0,0 +1,16 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: Don't be ridiculous. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out21 b/tests/battlestar.out21 new file mode 100644 index 0000000..32f9a4e --- /dev/null +++ b/tests/battlestar.out21 @@ -0,0 +1,85 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: You aren't carrying anything. + +You are wearing: + + pajamas + +You are in perfect health. +You aren't carrying anything. + +You are wearing: + + pajamas + +You are in perfect health. +You aren't carrying anything. + +You are wearing: + + pajamas + +You are in perfect health. +You aren't carrying anything. + +You are wearing: + + pajamas + +You are in perfect health. +You aren't carrying anything. + +You are wearing: + + pajamas + +You are in perfect health. +You aren't carrying anything. + +You are wearing: + + pajamas + +You are in perfect health. +You aren't carrying anything. + +You are wearing: + + pajamas + +You are in perfect health. +You aren't carrying anything. + +You are wearing: + + pajamas + +You are in perfect health. +You aren't carrying anything. + +You are wearing: + + pajamas + +You are in perfect health. +You aren't carrying anything. + +You are wearing: + + pajamas + +You are in perfect health. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out22 b/tests/battlestar.out22 new file mode 100644 index 0000000..f8f78a3 --- /dev/null +++ b/tests/battlestar.out22 @@ -0,0 +1,28 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: + This is a walk in closet. +A wardrobe of immense magnitude greets the eye. Furs and robes of kings +hang on rack after rack. Silken gowns, capes woven with spun gold, and +delicate synthetic fabrics are stowed here. The bedroom is behind you. + +A kingly robe of royal purple and spun gold is draped here. +>-: robe: +Taken. +>-: robe: +Dropped. +pajamas: +You aren't holding the pajamas. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out23 b/tests/battlestar.out23 new file mode 100644 index 0000000..43f7d20 --- /dev/null +++ b/tests/battlestar.out23 @@ -0,0 +1,24 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: + This is a walk in closet. +A wardrobe of immense magnitude greets the eye. Furs and robes of kings +hang on rack after rack. Silken gowns, capes woven with spun gold, and +delicate synthetic fabrics are stowed here. The bedroom is behind you. + +A kingly robe of royal purple and spun gold is draped here. +>-: robe: +Taken. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out24 b/tests/battlestar.out24 new file mode 100644 index 0000000..38e9a2f --- /dev/null +++ b/tests/battlestar.out24 @@ -0,0 +1,30 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: + This is a walk in closet. +A wardrobe of immense magnitude greets the eye. Furs and robes of kings +hang on rack after rack. Silken gowns, capes woven with spun gold, and +delicate synthetic fabrics are stowed here. The bedroom is behind you. + +A kingly robe of royal purple and spun gold is draped here. +>-: pajamas: +Taken. +pajamas: +Dropped. +>-: pajamas: +Taken. +robe: +Taken. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out25 b/tests/battlestar.out25 new file mode 100644 index 0000000..e853a7b --- /dev/null +++ b/tests/battlestar.out25 @@ -0,0 +1,34 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: + These are the executive suites of the battlestar. +Luxurious staterooms carpeted with crushed velvet and adorned with beaten +gold open onto this parlor. A wide staircase with ivory banisters leads +up or down. This parlor leads into a hallway left. The bridal suite is +right. Other rooms lie ahead and behind you. + +>-: + This is the maid's utility room. +What a gruesome sight! The maid has been brutally drowned in a bucket of +Pine Sol and repeatedly stabbed in the back with a knife. +The hallway is behind you. + +There is a knife here. +The maid's body is lying here. She was murdered! +>-: knife: +Taken. +>-: Your knife should do the trick. +You can't kill that! +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out26 b/tests/battlestar.out26 new file mode 100644 index 0000000..916f34c --- /dev/null +++ b/tests/battlestar.out26 @@ -0,0 +1,17 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: pajamas: +Taken. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out27 b/tests/battlestar.out27 new file mode 100644 index 0000000..a2c28de --- /dev/null +++ b/tests/battlestar.out27 @@ -0,0 +1,16 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: Nothing to take! +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out28 b/tests/battlestar.out28 new file mode 100644 index 0000000..7067161 --- /dev/null +++ b/tests/battlestar.out28 @@ -0,0 +1,17 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: viper: +I don't see any viper around here. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out29 b/tests/battlestar.out29 new file mode 100644 index 0000000..3aaf77b --- /dev/null +++ b/tests/battlestar.out29 @@ -0,0 +1,17 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: viper: +Not found. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out3 b/tests/battlestar.out3 new file mode 100644 index 0000000..87db000 --- /dev/null +++ b/tests/battlestar.out3 @@ -0,0 +1,17 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: I don't think that is possible. +foo: How's that? +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out30 b/tests/battlestar.out30 new file mode 100644 index 0000000..aeb340f --- /dev/null +++ b/tests/battlestar.out30 @@ -0,0 +1,17 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: pajamas: +Not while it's being worn. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out31 b/tests/battlestar.out31 new file mode 100644 index 0000000..81131e0 --- /dev/null +++ b/tests/battlestar.out31 @@ -0,0 +1,16 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: You can't wear a pot of jewels! +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out32 b/tests/battlestar.out32 new file mode 100644 index 0000000..05dd0e5 --- /dev/null +++ b/tests/battlestar.out32 @@ -0,0 +1,16 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: You hurt your foot. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out33 b/tests/battlestar.out33 new file mode 100644 index 0000000..2096887 --- /dev/null +++ b/tests/battlestar.out33 @@ -0,0 +1,16 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: You're not holding a door. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out34 b/tests/battlestar.out34 new file mode 100644 index 0000000..2096887 --- /dev/null +++ b/tests/battlestar.out34 @@ -0,0 +1,16 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: You're not holding a door. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out35 b/tests/battlestar.out35 new file mode 100644 index 0000000..0d6bf11 --- /dev/null +++ b/tests/battlestar.out35 @@ -0,0 +1,17 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: It doesn't seem to work. +You're not holding a door. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out36 b/tests/battlestar.out36 new file mode 100644 index 0000000..76a91fa --- /dev/null +++ b/tests/battlestar.out36 @@ -0,0 +1,16 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: You don't have that. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out37 b/tests/battlestar.out37 new file mode 100644 index 0000000..d73b8ec --- /dev/null +++ b/tests/battlestar.out37 @@ -0,0 +1,16 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: That's not for kicking! +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out38 b/tests/battlestar.out38 new file mode 100644 index 0000000..3c560ed --- /dev/null +++ b/tests/battlestar.out38 @@ -0,0 +1,17 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: coconuts: +You aren't holding the coconuts. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out39 b/tests/battlestar.out39 new file mode 100644 index 0000000..98df4c5 --- /dev/null +++ b/tests/battlestar.out39 @@ -0,0 +1,33 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: + These are the executive suites of the battlestar. +Luxurious staterooms carpeted with crushed velvet and adorned with beaten +gold open onto this parlor. A wide staircase with ivory banisters leads +up or down. This parlor leads into a hallway left. The bridal suite is +right. Other rooms lie ahead and behind you. + +>-: + The hallway ends here at the presidential suite. +The door to this suite is made from solid magnesium, and the entryway is +inlaid with diamonds and fire opals. The door is ajar ahead. The hallway +goes back. + +There is a laser pistol here. +>-: laser: +Taken. +>-: Your laser should do the trick. +You can't kill that! +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out4 b/tests/battlestar.out4 new file mode 100644 index 0000000..0c5ee63 --- /dev/null +++ b/tests/battlestar.out4 @@ -0,0 +1,52 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: + This is a walk in closet. +A wardrobe of immense magnitude greets the eye. Furs and robes of kings +hang on rack after rack. Silken gowns, capes woven with spun gold, and +delicate synthetic fabrics are stowed here. The bedroom is behind you. + +A kingly robe of royal purple and spun gold is draped here. +>-: robe: +Taken. +>-: + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: + These are the executive suites of the battlestar. +Luxurious staterooms carpeted with crushed velvet and adorned with beaten +gold open onto this parlor. A wide staircase with ivory banisters leads +up or down. This parlor leads into a hallway left. The bridal suite is +right. Other rooms lie ahead and behind you. + +>-: + This was once the first class lounge. +There is much rubble and destruction here that was not apparent elsewhere. +The walls and ceilings have broken in in some places. A staircase with +red coral banisters leads up. It is impossible to go left or right. +It seems a little clearer ahead. + +There are some matches here. +>-: robe: +Dropped. +You aren't holding a blaster. +You aren't holding a blaster. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out40 b/tests/battlestar.out40 new file mode 100644 index 0000000..5ad645e --- /dev/null +++ b/tests/battlestar.out40 @@ -0,0 +1,31 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: + These are the executive suites of the battlestar. +Luxurious staterooms carpeted with crushed velvet and adorned with beaten +gold open onto this parlor. A wide staircase with ivory banisters leads +up or down. This parlor leads into a hallway left. The bridal suite is +right. Other rooms lie ahead and behind you. + +>-: + You are in what was once an elegant stateroom. +Whoever lived in this stateroom, he and his female companion +were mercilessly slain in their sleep. Clothes, trinkets and personal +belongings are scattered all across the floor. Through a hole in the +collapsed floor I can see a hallway below. A door is behind you. + +There is a strange golden amulet on the floor here. +>-: It doesn't seem to work. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out41 b/tests/battlestar.out41 new file mode 100644 index 0000000..ae9f03c --- /dev/null +++ b/tests/battlestar.out41 @@ -0,0 +1,16 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: You can't wear an Elf! +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out42 b/tests/battlestar.out42 new file mode 100644 index 0000000..f69f28e --- /dev/null +++ b/tests/battlestar.out42 @@ -0,0 +1,16 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: There is no way up. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out43 b/tests/battlestar.out43 new file mode 100644 index 0000000..848e38c --- /dev/null +++ b/tests/battlestar.out43 @@ -0,0 +1,16 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: Where's your lover? +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out5 b/tests/battlestar.out5 new file mode 100644 index 0000000..12da8d3 --- /dev/null +++ b/tests/battlestar.out5 @@ -0,0 +1,37 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: + These are the executive suites of the battlestar. +Luxurious staterooms carpeted with crushed velvet and adorned with beaten +gold open onto this parlor. A wide staircase with ivory banisters leads +up or down. This parlor leads into a hallway left. The bridal suite is +right. Other rooms lie ahead and behind you. + +>-: + You are in what was once an elegant stateroom. +Whoever lived in this stateroom, he and his female companion +were mercilessly slain in their sleep. Clothes, trinkets and personal +belongings are scattered all across the floor. Through a hole in the +collapsed floor I can see a hallway below. A door is behind you. + +There is a strange golden amulet on the floor here. +>-: The amulet is warm to the touch, and its beauty catches your breath. +A mist falls over your eyes, but then it is gone. Sounds seem clearer +and sharper but far away as if in a dream. The sound of purling water +reaches you from afar. The mist falls again, and your heart leaps in horror. +The gold freezes your hands and fathomless darkness engulfs your soul. +amulet: +Taken. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out6 b/tests/battlestar.out6 new file mode 100644 index 0000000..7ca0ee7 --- /dev/null +++ b/tests/battlestar.out6 @@ -0,0 +1,17 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: +Save file name (default .Bstar): Saved in /dev/full. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out8 b/tests/battlestar.out8 new file mode 100644 index 0000000..e853a7b --- /dev/null +++ b/tests/battlestar.out8 @@ -0,0 +1,34 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: + These are the executive suites of the battlestar. +Luxurious staterooms carpeted with crushed velvet and adorned with beaten +gold open onto this parlor. A wide staircase with ivory banisters leads +up or down. This parlor leads into a hallway left. The bridal suite is +right. Other rooms lie ahead and behind you. + +>-: + This is the maid's utility room. +What a gruesome sight! The maid has been brutally drowned in a bucket of +Pine Sol and repeatedly stabbed in the back with a knife. +The hallway is behind you. + +There is a knife here. +The maid's body is lying here. She was murdered! +>-: knife: +Taken. +>-: Your knife should do the trick. +You can't kill that! +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.out9 b/tests/battlestar.out9 new file mode 100644 index 0000000..f7f69b6 --- /dev/null +++ b/tests/battlestar.out9 @@ -0,0 +1,97 @@ +Version 4.2, fall 1984. +First Adventure game written by His Lordship, the honorable +Admiral D.W. Riggle + + + This is a luxurious stateroom. +The floor is carpeted with a soft animal fur and the great wooden furniture +is inlaid with strips of platinum and gold. Electronic equipment built +into the walls and ceiling is flashing wildly. The floor shudders and +the sounds of dull explosions rumble though the room. From a window in +the wall ahead comes a view of darkest space. There is a small adjoining +room behind you, and a doorway right. + +>-: + These are the executive suites of the battlestar. +Luxurious staterooms carpeted with crushed velvet and adorned with beaten +gold open onto this parlor. A wide staircase with ivory banisters leads +up or down. This parlor leads into a hallway left. The bridal suite is +right. Other rooms lie ahead and behind you. + +>-: + You are in what was once an elegant stateroom. +Whoever lived in this stateroom, he and his female companion +were mercilessly slain in their sleep. Clothes, trinkets and personal +belongings are scattered all across the floor. Through a hole in the +collapsed floor I can see a hallway below. A door is behind you. + +There is a strange golden amulet on the floor here. +>-: + The hallway is very congested with rubble here. +It is too choked with broken steel girders and other debris to continue +on much farther. Above, the ceiling has caved in and it is possible to +climb up. There is not much chance to go back, ahead, or left. +But the hallway seems clearer right. + +There are a few coins here. +>-: + You are in a wide hallway leading to the main hangar. +The walls and ceiling here have been blasted through in several places. +It looks as if quite a battle has been fought for possession of the landing bay +Gaping corpses litter the floor. The hallway continues behind you. +The main hangar is ahead. + +>-: + You are in the main hangar. +This is a huge bay where many fighters and cargo craft lie. Alarms are +sounding and fighter pilots are running to their ships. Above is a gallery +overlooking the bay. The scream of turbo engines is coming from right. The rest +of the hangar is left. There is an exit behind you. + +>-: + This is the launch room. +From the launch tubes here fighters blast off into space. Only one is left, +and it is guarded by two fierce men. A staircase leads up from here. +There is a cluttered workbench ahead. From the main hangar come sounds of great +explosions. The main hangar is behind you. The viper launch tubes are right. + +>-: + You are in the viper launch tube. +The two guards are eyeing you warily! + +There is a Viper ready for launch here. +>-: You climb into the viper and prepare for launch. +With a touch of your thumb the turbo engines ignite, thrusting you back into +your seat. + + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +>-: + You are in space. + + +You are flying through an asteroid field! +>-: pajamas: +Taken. +pajamas: +Dropped. +>-: You aren't holding a blaster. +>-: bye. +Your rating was novice. diff --git a/tests/battlestar.test b/tests/battlestar.test new file mode 100755 index 0000000..dc58f3a --- /dev/null +++ b/tests/battlestar.test @@ -0,0 +1,258 @@ +#!/bin/sh +# tests/battlestar.test - test functionality of battlestar. +# +# Copyright (c) 2000 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +set -e + +. tests/common + +testexec battlestar battlestar/battlestar + +export BATTLESTAR_QUIET=1 + +if echo quit | battlestar/battlestar |grep wizard >/dev/null; then + echo "Can't test battlestar as this user." + exit 0 +fi + +# These tests cover various past bugs found in battlestar. + +testno 1 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out1 +rm -f test.out + +testno 2 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out2 +rm -f test.out + +testno 3 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out3 +rm -f test.out + +testno 4 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out4 +rm -f test.out + +testno 5 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out5 +rm -f test.out + +testno 6 +battlestar/battlestar test.out 2>/dev/null || failtest +compare test.out tests/battlestar.out6 +rm -f test.out + +testno 7 +battlestar/battlestar /dev/null 2>test.out || failtest +compare test.out tests/battlestar.err6 +rm -f test.out + +testno 8 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out8 +rm -f test.out + +testno 9 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out9 +rm -f test.out + +testno 10 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out10 +rm -f test.out + +testno 11 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out11 +rm -f test.out + +testno 12 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out12 +rm -f test.out + +testno 13 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out13 +rm -f test.out + +testno 14 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out14 +rm -f test.out + +testno 15 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out15 +rm -f test.out + +testno 16 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out16 +rm -f test.out + +testno 17 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out17 +rm -f test.out + +testno 18 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out18 +rm -f test.out + +testno 19 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out19 +rm -f test.out + +testno 20 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out20 +rm -f test.out + +testno 21 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out21 +rm -f test.out + +testno 22 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out22 +rm -f test.out + +testno 23 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out23 +rm -f test.out + +testno 24 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out24 +rm -f test.out + +testno 25 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out25 +rm -f test.out + +testno 26 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out26 +rm -f test.out + +testno 27 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out27 +rm -f test.out + +testno 28 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out28 +rm -f test.out + +testno 29 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out29 +rm -f test.out + +testno 30 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out30 +rm -f test.out + +testno 31 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out31 +rm -f test.out + +testno 32 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out32 +rm -f test.out + +testno 33 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out33 +rm -f test.out + +testno 34 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out34 +rm -f test.out + +testno 35 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out35 +rm -f test.out + +testno 36 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out36 +rm -f test.out + +testno 37 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out37 +rm -f test.out + +testno 38 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out38 +rm -f test.out + +testno 39 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out39 +rm -f test.out + +testno 40 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out40 +rm -f test.out + +testno 41 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out41 +rm -f test.out + +testno 42 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out42 +rm -f test.out + +testno 43 +battlestar/battlestar test.out 2>&1 || failtest +compare test.out tests/battlestar.out43 +rm -f test.out diff --git a/tests/bcd.foo b/tests/bcd.foo new file mode 100644 index 0000000..3d6c3d6 --- /dev/null +++ b/tests/bcd.foo @@ -0,0 +1,15 @@ + ________________________________________________ +/FOO | +|] | +| ]] | +| | +|111111111111111111111111111111111111111111111111| +|222222222222222222222222222222222222222222222222| +|333333333333333333333333333333333333333333333333| +|444444444444444444444444444444444444444444444444| +|555555555555555555555555555555555555555555555555| +|]]]666666666666666666666666666666666666666666666| +|777777777777777777777777777777777777777777777777| +|888888888888888888888888888888888888888888888888| +|999999999999999999999999999999999999999999999999| +|________________________________________________| diff --git a/tests/bcd.foobar b/tests/bcd.foobar new file mode 100644 index 0000000..0a70209 --- /dev/null +++ b/tests/bcd.foobar @@ -0,0 +1,15 @@ + ________________________________________________ +/FOO BAR | +|] ]] | +| ]] ] | +| | +|11111]111111111111111111111111111111111111111111| +|2222]2222222222222222222222222222222222222222222| +|333333333333333333333333333333333333333333333333| +|444444444444444444444444444444444444444444444444| +|555555555555555555555555555555555555555555555555| +|]]]666666666666666666666666666666666666666666666| +|777777777777777777777777777777777777777777777777| +|888888888888888888888888888888888888888888888888| +|999999]99999999999999999999999999999999999999999| +|________________________________________________| diff --git a/tests/bcd.fooxbar b/tests/bcd.fooxbar new file mode 100644 index 0000000..7595e1d --- /dev/null +++ b/tests/bcd.fooxbar @@ -0,0 +1,30 @@ + ________________________________________________ +/FOO | +|] | +| ]] | +| | +|111111111111111111111111111111111111111111111111| +|222222222222222222222222222222222222222222222222| +|333333333333333333333333333333333333333333333333| +|444444444444444444444444444444444444444444444444| +|555555555555555555555555555555555555555555555555| +|]]]666666666666666666666666666666666666666666666| +|777777777777777777777777777777777777777777777777| +|888888888888888888888888888888888888888888888888| +|999999999999999999999999999999999999999999999999| +|________________________________________________| + ________________________________________________ +/BAR | +|]] | +| ] | +| | +|1]1111111111111111111111111111111111111111111111| +|]22222222222222222222222222222222222222222222222| +|333333333333333333333333333333333333333333333333| +|444444444444444444444444444444444444444444444444| +|555555555555555555555555555555555555555555555555| +|666666666666666666666666666666666666666666666666| +|777777777777777777777777777777777777777777777777| +|888888888888888888888888888888888888888888888888| +|99]999999999999999999999999999999999999999999999| +|________________________________________________| diff --git a/tests/bcd.test b/tests/bcd.test new file mode 100755 index 0000000..0e43768 --- /dev/null +++ b/tests/bcd.test @@ -0,0 +1,64 @@ +#!/bin/sh +# tests/bcd.test - test functionality of bcd. +# +# Copyright (c) 1999 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +set -e + +. tests/common + +testexec bcd bcd/bcd + +testno 1 +bcd/bcd foo >test.out 2>&1 || failtest +compare test.out tests/bcd.foo +rm -f test.out + +testno 2 +bcd/bcd "foo bar" >test.out 2>&1 || failtest +compare test.out tests/bcd.foobar +rm -f test.out + +testno 3 +bcd/bcd >test.out 2>&1 <test.out 2>&1 || failtest +compare test.out tests/bcd.fooxbar +rm -f test.out + +testno 5 +bcd/bcd >test.out 2>&1 <test.out 2>&1 || failtest +compare test.out tests/caesar.constout +rm -f test.out + +testno 2 +caesar/caesar 21 test.out 2>&1 || failtest +compare test.out tests/caesar.constout +rm -f test.out + +testno 3 +caesar/caesar test.out 2>&1 || failtest +compare test.out tests/caesar.197816out +rm -f test.out diff --git a/tests/common b/tests/common new file mode 100644 index 0000000..4ec2287 --- /dev/null +++ b/tests/common @@ -0,0 +1,55 @@ +#!/bin/sh +# tests/common - common functions for bsd-games testsuite. +# +# Copyright (c) 1999 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +# testexec game executable +testexec () { + testgame="$1" + if [ -x "$2" ]; then + true + else + exit 0 + fi +} + +testno () { + printf "%s" "$testgame test $1... " +} + +failtest () { + echo "FAIL" + exit 1 +} + +compare () { + if cmp -s "$1" "$2"; then + echo "PASS" + else + failtest + fi +} diff --git a/tests/factor.123456 b/tests/factor.123456 new file mode 100644 index 0000000..c4a84d2 --- /dev/null +++ b/tests/factor.123456 @@ -0,0 +1,2 @@ +123: 3 41 +456: 2 2 2 3 19 diff --git a/tests/factor.123456789 b/tests/factor.123456789 new file mode 100644 index 0000000..0dba255 --- /dev/null +++ b/tests/factor.123456789 @@ -0,0 +1 @@ +123456789: 3 3 3607 3803 diff --git a/tests/factor.2147483647111311 b/tests/factor.2147483647111311 new file mode 100644 index 0000000..ddcec23 --- /dev/null +++ b/tests/factor.2147483647111311 @@ -0,0 +1 @@ +2147483647111311: 3 3 3 131 607148331103 diff --git a/tests/factor.6172538568 b/tests/factor.6172538568 new file mode 100644 index 0000000..11133b9 --- /dev/null +++ b/tests/factor.6172538568 @@ -0,0 +1 @@ +6172538568: 2 2 2 3 7 17 2161253 diff --git a/tests/factor.8675309 b/tests/factor.8675309 new file mode 100644 index 0000000..d6a5670 --- /dev/null +++ b/tests/factor.8675309 @@ -0,0 +1 @@ +8675309: 8675309 diff --git a/tests/factor.987654321 b/tests/factor.987654321 new file mode 100644 index 0000000..c105d01 --- /dev/null +++ b/tests/factor.987654321 @@ -0,0 +1 @@ +987654321: 3 3 17 17 379721 diff --git a/tests/factor.987654321987654 b/tests/factor.987654321987654 new file mode 100644 index 0000000..bba7e25 --- /dev/null +++ b/tests/factor.987654321987654 @@ -0,0 +1 @@ +987654321987654: 2 3 61 257 11071 948427 diff --git a/tests/factor.987654321987654321987 b/tests/factor.987654321987654321987 new file mode 100644 index 0000000..bc074e7 --- /dev/null +++ b/tests/factor.987654321987654321987 @@ -0,0 +1 @@ +987654321987654321987: 3 7 185470889 253577035423 diff --git a/tests/factor.99999999999991 b/tests/factor.99999999999991 new file mode 100644 index 0000000..ec937bd --- /dev/null +++ b/tests/factor.99999999999991 @@ -0,0 +1 @@ +99999999999991: 7 13 769231 1428571 diff --git a/tests/factor.test b/tests/factor.test new file mode 100755 index 0000000..2e75422 --- /dev/null +++ b/tests/factor.test @@ -0,0 +1,89 @@ +#!/bin/sh +# tests/factor.test - test functionality of factor. +# +# Copyright (c) 1999, 2003, 2004 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +set -e + +. tests/common + +testexec factor factor/factor + +testno 1 +factor/factor 123456789 >test.out 2>&1 || failtest +compare test.out tests/factor.123456789 +rm -f test.out + +testno 2 +factor/factor 987654321 >test.out 2>&1 || failtest +compare test.out tests/factor.987654321 +rm -f test.out + +testno 3 +factor/factor 123 456 >test.out 2>&1 || failtest +compare test.out tests/factor.123456 +rm -f test.out + +testno 4 +factor/factor <test.out 2>&1 || failtest +123 +456 +EOF +compare test.out tests/factor.123456 +rm -f test.out + +testno 5 +factor/factor 8675309 >test.out 2>&1 || failtest +compare test.out tests/factor.8675309 +rm -f test.out + +if grep -q HAVE_OPENSSL include/bsd-games.h; then + testno 6 + factor/factor 6172538568 >test.out 2>&1 || failtest + compare test.out tests/factor.6172538568 + rm -f test.out + + testno 7 + factor/factor 987654321987654 >test.out 2>&1 || failtest + compare test.out tests/factor.987654321987654 + rm -f test.out + + testno 8 + factor/factor 987654321987654321987 >test.out 2>&1 || failtest + compare test.out tests/factor.987654321987654321987 + rm -f test.out + + testno 9 + factor/factor 99999999999991 >test.out 2>&1 || failtest + compare test.out tests/factor.99999999999991 + rm -f test.out + + testno 10 + factor/factor 2147483647111311 >test.out 2>&1 || failtest + compare test.out tests/factor.2147483647111311 + rm -f test.out +fi diff --git a/tests/morse.SOS b/tests/morse.SOS new file mode 100644 index 0000000..a9547b2 --- /dev/null +++ b/tests/morse.SOS @@ -0,0 +1,5 @@ + ... + --- + ... + + ...-.- diff --git a/tests/morse.foo b/tests/morse.foo new file mode 100644 index 0000000..0e086cb --- /dev/null +++ b/tests/morse.foo @@ -0,0 +1,5 @@ + dit dit daw dit + daw daw daw + daw daw daw + + dit dit dit daw dit daw diff --git a/tests/morse.sos b/tests/morse.sos new file mode 100644 index 0000000..a206396 --- /dev/null +++ b/tests/morse.sos @@ -0,0 +1 @@ +SOS diff --git a/tests/morse.test b/tests/morse.test new file mode 100755 index 0000000..016de25 --- /dev/null +++ b/tests/morse.test @@ -0,0 +1,69 @@ +#!/bin/sh +# morse.test - test functionality of morse. +# +# Copyright (c) 1999, 2004 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +set -e + +. tests/common + +testexec morse morse/morse + +testno 1 +morse/morse foo >test.out 2>&1 || failtest +compare test.out tests/morse.foo +rm -f test.out + +testno 2 +echo foo |morse/morse >test.out 2>&1 || failtest +compare test.out tests/morse.foo +rm -f test.out + +testno 3 +morse/morse -s SOS >test.out 2>&1 || failtest +compare test.out tests/morse.SOS +rm -f test.out + +testno 4 +echo SOS |morse/morse -s >test.out 2>&1 || failtest +compare test.out tests/morse.SOS +rm -f test.out + +testno 5 +morse/morse -d test.out 2>&1 || failtest +compare test.out tests/morse.sos +rm -f test.out + +testno 6 +echo "This is a test." |morse/morse -s >test.out 2>&1 || failtest +compare test.out tests/morse.testsent +rm -f test.out + +testno 7 +morse/morse -d test.out 2>&1 || failtest +compare test.out tests/morse.testsentd +rm -f test.out diff --git a/tests/morse.testsent b/tests/morse.testsent new file mode 100644 index 0000000..d2bcdd3 --- /dev/null +++ b/tests/morse.testsent @@ -0,0 +1,17 @@ + - + .... + .. + ... + + .. + ... + + .- + + - + . + ... + - + .-.-.- + + ...-.- diff --git a/tests/morse.testsentd b/tests/morse.testsentd new file mode 100644 index 0000000..d3adb5d --- /dev/null +++ b/tests/morse.testsentd @@ -0,0 +1 @@ +THIS IS A TEST. diff --git a/tests/number.-0.1 b/tests/number.-0.1 new file mode 100644 index 0000000..fea1e89 --- /dev/null +++ b/tests/number.-0.1 @@ -0,0 +1,3 @@ +minus +one. +tenths. diff --git a/tests/number.123456 b/tests/number.123456 new file mode 100644 index 0000000..4a3681b --- /dev/null +++ b/tests/number.123456 @@ -0,0 +1,2 @@ +one hundred twenty-three thousand. +four hundred fifty-six. diff --git a/tests/number.987654321 b/tests/number.987654321 new file mode 100644 index 0000000..8de4c90 --- /dev/null +++ b/tests/number.987654321 @@ -0,0 +1,3 @@ +nine hundred eighty-seven million. +six hundred fifty-four thousand. +three hundred twenty-one. diff --git a/tests/number.test b/tests/number.test new file mode 100755 index 0000000..74d78d2 --- /dev/null +++ b/tests/number.test @@ -0,0 +1,49 @@ +#!/bin/sh +# number.test - test functionality of number. +# +# Copyright (c) 1999 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +set -e + +. tests/common + +testexec number number/number + +testno 1 +number/number -- -0.1 >test.out 2>&1 || failtest +compare test.out tests/number.-0.1 +rm -f test.out + +testno 2 +number/number 123456 >test.out 2>&1 || failtest +compare test.out tests/number.123456 +rm -f test.out + +testno 3 +number/number -- 987654321 >test.out 2>&1 || failtest +compare test.out tests/number.987654321 +rm -f test.out diff --git a/tests/pig.test b/tests/pig.test new file mode 100755 index 0000000..ab589cd --- /dev/null +++ b/tests/pig.test @@ -0,0 +1,49 @@ +#!/bin/sh +# pig.test - test functionality of pig. +# +# Copyright (c) 1999 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +set -e + +. tests/common + +testexec pig pig/pig + +testno 1 +echo "This is a test." |pig/pig >test.out 2>&1 || failtest +compare test.out tests/pig.test1 +rm -f test.out + +testno 2 +echo "Is this a test?" |pig/pig >test.out 2>&1 || failtest +compare test.out tests/pig.test2 +rm -f test.out + +testno 3 +echo "IS THIS A TEST?" |pig/pig >test.out 2>&1 || failtest +compare test.out tests/pig.test3 +rm -f test.out diff --git a/tests/pig.test1 b/tests/pig.test1 new file mode 100644 index 0000000..ff15882 --- /dev/null +++ b/tests/pig.test1 @@ -0,0 +1 @@ +Isthay isway away esttay. diff --git a/tests/pig.test2 b/tests/pig.test2 new file mode 100644 index 0000000..06169ed --- /dev/null +++ b/tests/pig.test2 @@ -0,0 +1 @@ +Isway isthay away esttay? diff --git a/tests/pig.test3 b/tests/pig.test3 new file mode 100644 index 0000000..21eb173 --- /dev/null +++ b/tests/pig.test3 @@ -0,0 +1 @@ +ISWAY ISTHAY AWAY ESTTAY? diff --git a/tests/pom.1998fm1 b/tests/pom.1998fm1 new file mode 100644 index 0000000..8b680dc --- /dev/null +++ b/tests/pom.1998fm1 @@ -0,0 +1 @@ +Mon 1998 Jan 12 17:00:00 (UTC): The Moon was Full diff --git a/tests/pom.1998fm2 b/tests/pom.1998fm2 new file mode 100644 index 0000000..6dd2d5e --- /dev/null +++ b/tests/pom.1998fm2 @@ -0,0 +1 @@ +Wed 1998 Nov 4 05:00:00 (UTC): The Moon was Full diff --git a/tests/pom.1998fq1 b/tests/pom.1998fq1 new file mode 100644 index 0000000..4d4b18c --- /dev/null +++ b/tests/pom.1998fq1 @@ -0,0 +1 @@ +Mon 1998 Jan 5 14:00:00 (UTC): The Moon was at the First Quarter diff --git a/tests/pom.1998fq2 b/tests/pom.1998fq2 new file mode 100644 index 0000000..bdc166a --- /dev/null +++ b/tests/pom.1998fq2 @@ -0,0 +1 @@ +Wed 1998 Oct 28 12:00:00 (UTC): The Moon was at the First Quarter diff --git a/tests/pom.1998lq1 b/tests/pom.1998lq1 new file mode 100644 index 0000000..5676f31 --- /dev/null +++ b/tests/pom.1998lq1 @@ -0,0 +1 @@ +Tue 1998 Jan 20 20:00:00 (UTC): The Moon was at the Last Quarter diff --git a/tests/pom.1998lq2 b/tests/pom.1998lq2 new file mode 100644 index 0000000..644f03e --- /dev/null +++ b/tests/pom.1998lq2 @@ -0,0 +1 @@ +Wed 1998 Nov 11 00:00:00 (UTC): The Moon was at the Last Quarter diff --git a/tests/pom.1998nm1 b/tests/pom.1998nm1 new file mode 100644 index 0000000..a32d014 --- /dev/null +++ b/tests/pom.1998nm1 @@ -0,0 +1 @@ +Wed 1998 Jan 28 06:00:00 (UTC): The Moon was New diff --git a/tests/pom.1998nm2 b/tests/pom.1998nm2 new file mode 100644 index 0000000..6742990 --- /dev/null +++ b/tests/pom.1998nm2 @@ -0,0 +1 @@ +Tue 1998 Oct 20 10:00:00 (UTC): The Moon was New diff --git a/tests/pom.2003fm1 b/tests/pom.2003fm1 new file mode 100644 index 0000000..6b7376c --- /dev/null +++ b/tests/pom.2003fm1 @@ -0,0 +1 @@ +Sat 2003 Jan 18 11:00:00 (UTC): The Moon was Full diff --git a/tests/pom.2003fm2 b/tests/pom.2003fm2 new file mode 100644 index 0000000..5acd382 --- /dev/null +++ b/tests/pom.2003fm2 @@ -0,0 +1 @@ +Mon 2003 Dec 8 21:00:00 (UTC): The Moon was Full diff --git a/tests/pom.2003fq1 b/tests/pom.2003fq1 new file mode 100644 index 0000000..7c5dfa9 --- /dev/null +++ b/tests/pom.2003fq1 @@ -0,0 +1 @@ +Fri 2003 Jan 10 13:00:00 (UTC): The Moon was at the First Quarter diff --git a/tests/pom.2003fq2 b/tests/pom.2003fq2 new file mode 100644 index 0000000..a0a5625 --- /dev/null +++ b/tests/pom.2003fq2 @@ -0,0 +1 @@ +Sun 2003 Nov 30 17:00:00 (UTC): The Moon was at the First Quarter diff --git a/tests/pom.2003lq1 b/tests/pom.2003lq1 new file mode 100644 index 0000000..c239766 --- /dev/null +++ b/tests/pom.2003lq1 @@ -0,0 +1 @@ +Sat 2003 Jan 25 09:00:00 (UTC): The Moon was at the Last Quarter diff --git a/tests/pom.2003lq2 b/tests/pom.2003lq2 new file mode 100644 index 0000000..8720649 --- /dev/null +++ b/tests/pom.2003lq2 @@ -0,0 +1 @@ +Tue 2003 Dec 16 18:00:00 (UTC): The Moon was at the Last Quarter diff --git a/tests/pom.2003nm1 b/tests/pom.2003nm1 new file mode 100644 index 0000000..28f9418 --- /dev/null +++ b/tests/pom.2003nm1 @@ -0,0 +1 @@ +Thu 2003 Jan 2 20:00:00 (UTC): The Moon was New diff --git a/tests/pom.2003nm2 b/tests/pom.2003nm2 new file mode 100644 index 0000000..2c82cf2 --- /dev/null +++ b/tests/pom.2003nm2 @@ -0,0 +1 @@ +Sun 2003 Nov 23 23:00:00 (UTC): The Moon was New diff --git a/tests/pom.2003ph1 b/tests/pom.2003ph1 new file mode 100644 index 0000000..5eecf6b --- /dev/null +++ b/tests/pom.2003ph1 @@ -0,0 +1 @@ +Thu 2003 Jan 2 00:00:00 (UTC): The Moon was Waning Crescent (1% of Full) diff --git a/tests/pom.2003ph2 b/tests/pom.2003ph2 new file mode 100644 index 0000000..10ee220 --- /dev/null +++ b/tests/pom.2003ph2 @@ -0,0 +1 @@ +Mon 2003 Jan 6 00:00:00 (UTC): The Moon was Waxing Crescent (11% of Full) diff --git a/tests/pom.2003ph3 b/tests/pom.2003ph3 new file mode 100644 index 0000000..1f2f0b2 --- /dev/null +++ b/tests/pom.2003ph3 @@ -0,0 +1 @@ +Sat 2003 Jan 11 00:00:00 (UTC): The Moon was Waxing Gibbous (54% of Full) diff --git a/tests/pom.2003ph4 b/tests/pom.2003ph4 new file mode 100644 index 0000000..6e7aa77 --- /dev/null +++ b/tests/pom.2003ph4 @@ -0,0 +1 @@ +Wed 2003 Jan 22 00:00:00 (UTC): The Moon was Waning Gibbous (85% of Full) diff --git a/tests/pom.2003ph5 b/tests/pom.2003ph5 new file mode 100644 index 0000000..780239e --- /dev/null +++ b/tests/pom.2003ph5 @@ -0,0 +1 @@ +Mon 2003 Sep 1 00:00:00 (UTC): The Moon was Waxing Crescent (23% of Full) diff --git a/tests/pom.2003ph6 b/tests/pom.2003ph6 new file mode 100644 index 0000000..d6c3952 --- /dev/null +++ b/tests/pom.2003ph6 @@ -0,0 +1 @@ +Sun 2003 Sep 7 00:00:00 (UTC): The Moon was Waxing Gibbous (85% of Full) diff --git a/tests/pom.2003ph7 b/tests/pom.2003ph7 new file mode 100644 index 0000000..f1f4728 --- /dev/null +++ b/tests/pom.2003ph7 @@ -0,0 +1 @@ +Mon 2003 Sep 15 00:00:00 (UTC): The Moon was Waning Gibbous (83% of Full) diff --git a/tests/pom.2003ph8 b/tests/pom.2003ph8 new file mode 100644 index 0000000..1b6c498 --- /dev/null +++ b/tests/pom.2003ph8 @@ -0,0 +1 @@ +Mon 2003 Sep 22 00:00:00 (UTC): The Moon was Waning Crescent (20% of Full) diff --git a/tests/pom.test b/tests/pom.test new file mode 100755 index 0000000..ad8065b --- /dev/null +++ b/tests/pom.test @@ -0,0 +1,170 @@ +#!/bin/sh +# pom.test - test functionality of pom. +# +# Copyright (c) 1999, 2004 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +set -e + +. tests/common + +testexec pom pom/pom + +export TZ=UTC0 + +# Should add dates from years before 1998. + +# Test dates from Astronomical Almanac 1998, rounded to nearest hour. +# We should also test the fraction illuminated given by the program, +# but the Astronomical Almanac 1998 only gives these figures to 2 +# decimal places (like pom) so I don't know which are border cases and +# which are good tests. + +testno 1 +pom/pom 1998010514 >test.out 2>&1 || failtest +compare test.out tests/pom.1998fq1 +rm -f test.out + +testno 2 +pom/pom 1998011217 >test.out 2>&1 || failtest +compare test.out tests/pom.1998fm1 +rm -f test.out + +testno 3 +pom/pom 1998012020 >test.out 2>&1 || failtest +compare test.out tests/pom.1998lq1 +rm -f test.out + +testno 4 +pom/pom 1998012806 >test.out 2>&1 || failtest +compare test.out tests/pom.1998nm1 +rm -f test.out + +testno 5 +pom/pom 1998102010 >test.out 2>&1 || failtest +compare test.out tests/pom.1998nm2 +rm -f test.out + +testno 6 +pom/pom 1998102812 >test.out 2>&1 || failtest +compare test.out tests/pom.1998fq2 +rm -f test.out + +testno 7 +pom/pom 1998110405 >test.out 2>&1 || failtest +compare test.out tests/pom.1998fm2 +rm -f test.out + +testno 8 +pom/pom 1998111100 >test.out 2>&1 || failtest +compare test.out tests/pom.1998lq2 +rm -f test.out + +# Test dates from Astronomical Almanac 2003, rounded to nearest hour, +# and fractions of illumination at the start of the day. + +testno 9 +pom/pom 2003010220 >test.out 2>&1 || failtest +compare test.out tests/pom.2003nm1 +rm -f test.out + +testno 10 +pom/pom 2003011013 >test.out 2>&1 || failtest +compare test.out tests/pom.2003fq1 +rm -f test.out + +testno 11 +pom/pom 2003011811 >test.out 2>&1 || failtest +compare test.out tests/pom.2003fm1 +rm -f test.out + +testno 12 +pom/pom 2003012509 >test.out 2>&1 || failtest +compare test.out tests/pom.2003lq1 +rm -f test.out + +testno 13 +pom/pom 2003112323 >test.out 2>&1 || failtest +compare test.out tests/pom.2003nm2 +rm -f test.out + +testno 14 +pom/pom 2003113017 >test.out 2>&1 || failtest +compare test.out tests/pom.2003fq2 +rm -f test.out + +testno 15 +pom/pom 2003120821 >test.out 2>&1 || failtest +compare test.out tests/pom.2003fm2 +rm -f test.out + +testno 16 +pom/pom 2003121618 >test.out 2>&1 || failtest +compare test.out tests/pom.2003lq2 +rm -f test.out + +testno 17 +pom/pom 2003010200 >test.out 2>&1 || failtest +compare test.out tests/pom.2003ph1 +rm -f test.out + +testno 18 +pom/pom 2003010600 >test.out 2>&1 || failtest +compare test.out tests/pom.2003ph2 +rm -f test.out + +testno 19 +pom/pom 2003011100 >test.out 2>&1 || failtest +compare test.out tests/pom.2003ph3 +rm -f test.out + +testno 20 +pom/pom 2003012200 >test.out 2>&1 || failtest +compare test.out tests/pom.2003ph4 +rm -f test.out + +testno 21 +pom/pom 2003090100 >test.out 2>&1 || failtest +compare test.out tests/pom.2003ph5 +rm -f test.out + +testno 22 +pom/pom 2003090700 >test.out 2>&1 || failtest +compare test.out tests/pom.2003ph6 +rm -f test.out + +testno 23 +pom/pom 2003091500 >test.out 2>&1 || failtest +compare test.out tests/pom.2003ph7 +rm -f test.out + +testno 24 +pom/pom 2003092200 >test.out 2>&1 || failtest +compare test.out tests/pom.2003ph8 +rm -f test.out + +# Note that the output of pom differs for dates in the past and the +# future, so future dates are not good tests. diff --git a/tests/ppt.Foobarnl b/tests/ppt.Foobarnl new file mode 100644 index 0000000..00b098c --- /dev/null +++ b/tests/ppt.Foobarnl @@ -0,0 +1,10 @@ +___________ +| o .oo | +| oo o.ooo| +| oo o.ooo| +| o . | +| oo . o | +| oo . o| +| ooo . o | +| o. o | +___________ diff --git a/tests/ppt.foobar b/tests/ppt.foobar new file mode 100644 index 0000000..be77efa --- /dev/null +++ b/tests/ppt.foobar @@ -0,0 +1,9 @@ +___________ +| oo .oo | +| oo o.ooo| +| oo o.ooo| +| o . | +| oo . o | +| oo . o| +| ooo . o | +___________ diff --git a/tests/ppt.test b/tests/ppt.test new file mode 100755 index 0000000..45249a9 --- /dev/null +++ b/tests/ppt.test @@ -0,0 +1,49 @@ +#!/bin/sh +# ppt.test - test functionality of ppt. +# +# Copyright (c) 1999 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +set -e + +. tests/common + +testexec ppt ppt/ppt + +testno 1 +ppt/ppt "foo bar" >test.out 2>&1 || failtest +compare test.out tests/ppt.foobar +rm -f test.out + +testno 2 +ppt/ppt foo bar >test.out 2>&1 || failtest +compare test.out tests/ppt.foobar +rm -f test.out + +testno 3 +echo "Foo bar" |ppt/ppt >test.out 2>&1 || failtest +compare test.out tests/ppt.Foobarnl +rm -f test.out diff --git a/tests/primes.100 b/tests/primes.100 new file mode 100644 index 0000000..afc67fd --- /dev/null +++ b/tests/primes.100 @@ -0,0 +1,25 @@ +2 +3 +5 +7 +11 +13 +17 +19 +23 +29 +31 +37 +41 +43 +47 +53 +59 +61 +67 +71 +73 +79 +83 +89 +97 diff --git a/tests/primes.1e6 b/tests/primes.1e6 new file mode 100644 index 0000000..7ee7564 --- /dev/null +++ b/tests/primes.1e6 @@ -0,0 +1,24 @@ +1000003 +1000033 +1000037 +1000039 +1000081 +1000099 +1000117 +1000121 +1000133 +1000151 +1000159 +1000171 +1000183 +1000187 +1000193 +1000199 +1000211 +1000213 +1000231 +1000249 +1000253 +1000273 +1000289 +1000291 diff --git a/tests/primes.1e9 b/tests/primes.1e9 new file mode 100644 index 0000000..d6f119d --- /dev/null +++ b/tests/primes.1e9 @@ -0,0 +1,16 @@ +1000000007 +1000000009 +1000000021 +1000000033 +1000000087 +1000000093 +1000000097 +1000000103 +1000000123 +1000000181 +1000000207 +1000000223 +1000000241 +1000000271 +1000000289 +1000000297 diff --git a/tests/primes.test b/tests/primes.test new file mode 100755 index 0000000..c77e5c6 --- /dev/null +++ b/tests/primes.test @@ -0,0 +1,49 @@ +#!/bin/sh +# primes.test - test functionality of primes. +# +# Copyright (c) 1999 Joseph Samuel Myers. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +set -e + +. tests/common + +testexec primes primes/primes + +testno 1 +primes/primes 1 100 >test.out 2>&1 || failtest +compare test.out tests/primes.100 +rm -f test.out + +testno 2 +primes/primes 1000000 1000300 >test.out 2>&1 || failtest +compare test.out tests/primes.1e6 +rm -f test.out + +testno 3 +primes/primes 1000000000 1000000300 >test.out 2>&1 || failtest +compare test.out tests/primes.1e9 +rm -f test.out -- cgit v1.2.3 From 9e6b008cb4d572dced0019cdf169d185d0180cbf Mon Sep 17 00:00:00 2001 From: "Aaron M. Ucko" Date: Wed, 25 Jan 2017 00:09:05 -0500 Subject: bsdgames-nonfree (2.17-7) unstable; urgency=medium * debian/control: Canonicalize with the help of cme fix. In particular, declare Standards-Version: 3.9.8 (already compliant, not that cme checked). * debian/copyright: Canonicalize with the help of cme fix. * debian/.gitignore: +debhelper-build-stamp. [dgit import package bsdgames-nonfree 2.17-7] --- config.params | 43 +++++++ configure | 1 + debian/changelog | 378 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ debian/compat | 1 + debian/control | 22 ++++ debian/copyright | 57 +++++++++ debian/docs | 9 ++ debian/menu | 2 + debian/postinst | 20 +++ debian/postrm | 12 ++ debian/rules | 34 +++++ debian/watch | 3 + rogue/init.c | 2 +- rogue/move.c | 4 +- rogue/object.c | 10 ++ rogue/rogue.h | 1 + rogue/save.c | 4 + 17 files changed, 600 insertions(+), 3 deletions(-) create mode 100644 config.params create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/docs create mode 100644 debian/menu create mode 100644 debian/postinst create mode 100644 debian/postrm create mode 100755 debian/rules create mode 100644 debian/watch diff --git a/config.params b/config.params new file mode 100644 index 0000000..8e79043 --- /dev/null +++ b/config.params @@ -0,0 +1,43 @@ +# -*- shell-script-mode -*- +pkg=bsdgames-nonfree + +# Don't run configure interactively. +bsd_games_cfg_non_interactive=y + +# Install into here for building the package. +bsd_games_cfg_install_prefix=`pwd`/debian/$pkg + +# Do not build or install these games: +bsd_games_cfg_no_build_dirs="dm banner fortune factor" + +# Keep huntd in /usr/sbin as it was in the past. I may +# change this later. +bsd_games_cfg_sbindir=/usr/sbin + +bsd_games_cfg_docdir=/usr/share/doc/$pkg + +# Debian doesn't like cluttering up the /usr/*/games/ dirs too much, +# use a subdir. /var too. +bsd_games_cfg_usrlibdir=/usr/lib/games/$pkg +bsd_games_cfg_sharedir=/usr/share/games/$pkg +bsd_games_cfg_varlibdir=/var/games/$pkg + +## Do not do chown now, we aren't running as root. +#bsd_games_cfg_do_chown=n + +# Debian prefers symlinks for manpages. +bsd_games_cfg_use_dot_so=symlinks + +# I'll handle manpage compressing. +bsd_games_cfg_gzip_manpages=n + +# Policy says to use /usr/bin/pager by default. +bsd_games_cfg_pager=/usr/bin/pager + +# Leave off; debian/rules supplies all appropriate flags via +# bsd_games_cfg_other_{c,ld}flags +bsd_games_cfg_optimize_flags= + +# Make setgid games. +bsd_games_cfg_score_game_group=games +bsd_games_cfg_score_game_perms=2755 diff --git a/configure b/configure index 017c6a4..0391948 100755 --- a/configure +++ b/configure @@ -64,6 +64,7 @@ ask () { esac eval $query_var=\"\$input\" subst_vars="$subst_vars $query_var" + echo $input } ask_yn () { diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..1013f05 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,378 @@ +bsdgames-nonfree (2.17-7) unstable; urgency=medium + + * debian/control: Canonicalize with the help of cme fix. In particular, + declare Standards-Version: 3.9.8 (already compliant, not that cme checked). + * debian/copyright: Canonicalize with the help of cme fix. + * debian/.gitignore: +debhelper-build-stamp. + + -- Aaron M. Ucko Wed, 25 Jan 2017 00:09:05 -0500 + +bsdgames-nonfree (2.17-6) unstable; urgency=low + + * rogue/move.c (check_hunger): Achieve every-other-move effects correctly, + by consulting m_moves rather than rogue.moves_left. (Closes: #726195.) + * Standards-Version: 3.9.4 (already compliant). + + -- Aaron M. Ucko Tue, 15 Oct 2013 11:12:31 -0400 + +bsdgames-nonfree (2.17-5) unstable; urgency=high + + * rogue/init.c: Give the initial bow a damage value of 1d1 for + consistency with object.c; 1d2 was presumably a typo. + * rogue/{object.c,rogue.h,save.c}: factor an assign_damage function out + of gr_weapon, and call it from read_pack because saved values (raw + pointers to string constants) may be invalid. (The setup was always + fragile, and broke altogether when 2.17-4 made the executable + position-independent and subject to loading at randomized addresses.) + (Closes: #695262.) + + -- Aaron M. Ucko Thu, 06 Dec 2012 21:53:01 -0500 + +bsdgames-nonfree (2.17-4) unstable; urgency=low + + * config.params: defer to debian/rules for build flags (which weren't + set quite as intended in noopt mode anyway, per a longstanding typo). + * debian/compat: Advance to Debhelper 9. + * debian/control: + - Build-Depends: debhelper (>= 9), implying a new enough dpkg-dev. + - Depends: ${misc:Depends}, which debhelper could theoretically populate. + - Vcs-*: point to (new) personal repository on anonscm.debian.org. + - Retire conflict against ancient (pre-split) bsdgames. + - Standards-Version: 3.9.3 (now compliant). + * debian/copyright: clean up and convert to DEP5 format 1.0. + * debian/rules: + - Minimize further by switching to override_dh_* style. + - Pass in dpkg's recommended flags, including full hardening flags. + * (debian/).gitignore: ignore generated files. + + -- Aaron M. Ucko Wed, 27 Jun 2012 21:43:37 -0400 + +bsdgames-nonfree (2.17-3) unstable; urgency=low + + * Migrate from CDBS to Debhelper 7. + * Explicitly note distinction between main and non-free in debian/copyright. + * Declare compliance with Policy 3.8.0. + + -- Aaron M. Ucko Sat, 14 Jun 2008 18:10:04 -0400 + +bsdgames-nonfree (2.17-2) unstable; urgency=low + + * Convert to cdbs and debhelper 6. + * Note compliance with current policy (3.7.3). + * Set XS-Autobuild: yes, as the license isn't too severely non-free. + + -- Aaron M. Ucko Sat, 29 Mar 2008 19:51:53 -0400 + +bsdgames-nonfree (2.17-1) unstable; urgency=low + + * New upstream release. + * debian/menu: Properly double-quote command. + * debian/watch: Added, to help track future upstream versions. + + -- Aaron M. Ucko Fri, 18 Feb 2005 22:09:47 -0500 + +bsdgames-nonfree (2.16-1) unstable; urgency=low + + * New upstream release. + * debian/copyright: Update infrastructure copyright to cover 2004. + * debian/docs: drop rogue.me (now covered by upstream build system). + + -- Aaron M. Ucko Fri, 20 Feb 2004 23:24:21 -0500 + +bsdgames-nonfree (2.15-2) unstable; urgency=low + + * debian/postinst: Use POSIX-blessed chown syntax. (Closes: #229199) + * debian/rules: Tell vrms (and other interested parties) that the + license forbids commercial use. + + -- Aaron M. Ucko Fri, 23 Jan 2004 19:16:31 -0500 + +bsdgames-nonfree (2.15-1) unstable; urgency=low + + * New upstream release. + * debian/control: standards-version 3.6.1 (no changes needed). + * debian/copyright: rework once more; should now contain all needed info. + + -- Aaron M. Ucko Mon, 22 Dec 2003 22:20:30 -0500 + +bsdgames-nonfree (2.14-2) unstable; urgency=low + + * config.params: + - Make setgid games again (supposedly safe now...) + - Support "noopt" in DEB_BUILD_OPTIONS. + - debian/tmp -> debian/bsdgames-nonfree. + - Miscellaneous typo fixes. + * configure: Revert changes to defaults (config.params should suffice). + * debian/changelog: Removed obsolete emacs settings. + * debian/compat: Created (specifying version 4). + * debian/control: + - New maintainer, with Javier's blessing; my thanks to Joey H. and him + for maintaining the package thus far. + - Bumped standards version and build dependency on debhelper. + - Rewrote description to reflect single-game situation. + * debian/copyright: + - Updated version number in file name. + - Cited recent maintainers. + - Generally cleaned up a bit. + * debian/docs: New (split out from debian/rules). + * debian/postinst: Ensure $VARDIR is actually executable. + * debian/rules: + - Modernized (various cleanups). + - Exclude /usr/games/rogue from call to dh_fixperms. + + -- Aaron M. Ucko Wed, 9 Apr 2003 22:20:11 -0400 + +bsdgames-nonfree (2.14-1) unstable; urgency=high + + * New upstream version: + - fixes buffer overflow in rogue (priviledge escalation to + 'games' since it's setgid) + - removes hack (Closes: #188279) + * Note: I'm hurrying this upload due to the security fix for rogue + (see SECURITY). However, with the security fix changes 'rogue' will + no longer save on empty files. Also, there is no transition done from + previous hack save files (which should now be handled by 'bsdgames' + which now provides 'hack') + + -- Javier Fernandez-Sanguino Pen~a Wed, 9 Apr 2003 10:10:27 +0200 + +bsdgames-nonfree (2.12-5) unstable; urgency=low + + * Added save/ dir for hack with appropiate permissions (Closes: #174758) + * Fixed call to GNUmakefile (it did not clean properly the sources due to + GNUMakefile being called instead) + * Fixed the debian/rules since it was cleaning files in + /var/games/bsdgames-nonfree/hack that were not zero-byte (and might be + used by the game) + + -- Javier Fernandez-Sanguino Pen~a Wed, 1 Jan 2003 15:06:13 +0100 + +bsdgames-nonfree (2.12-4) unstable; urgency=low + + * Added Build-Depends (Closes: #174031) + * Removed binary files from package when cleaning + + -- Javier Fernandez-Sanguino Pen~a Mon, 30 Dec 2002 18:28:48 +0100 + +bsdgames-nonfree (2.12-3) unstable; urgency=low + + * New maintainer (so it does not disappear from Debian) (Closes: #68086) + + -- Javier Fernandez-Sanguino Pen~a Mon, 15 Jan 2001 19:33:45 +0100 + +bsdgames-nonfree (2.12-2) unstable; urgency=low + + * Much gnashing of teeth. + + -- Joey Hess Sun, 5 Nov 2000 16:33:10 -0800 + +bsdgames-nonfree (2.12-1) unstable; urgency=low + + * New upstream release. No, I'm not maintianing the package anymore, + Debian-QA is - I just happen to be in Debian-QA. (Yeah, Joey.. keep + repeating that and maybe someone will believe you.) + + -- Joey Hess Tue, 26 Sep 2000 09:38:44 -0700 + +bsdgames-nonfree (2.11-1) unstable; urgency=low + + * New upstream release. No, I'm not maintianing the package anymore, + Debian-QA is - I just happen to be in Debian-QA. (Yeah, Joey.. keep + repeating that and maybe someone will believe you.) + * Now includes hack, a precursor to nethack. + + -- Joey Hess Wed, 19 Apr 2000 14:36:52 -0700 + +bsdgames-nonfree (2.8-1) unstable; urgency=low + + * New upstream release. No, I'm not maintianing the package anymore, + Debian-QA is - I just happen to be in Debian-QA. + * Updated download location. + * FHS. + + -- Joey Hess Thu, 4 Nov 1999 14:31:06 -0800 + +bsdgames-nonfree (2.7-1) unstable; urgency=low + + * New upstream release. No, I'm not maintianing the package anymore, + Debian-QA is - I just happen to be in Debian-QA. + + -- Joey Hess Wed, 7 Apr 1999 00:00:28 -0700 + +bsdgames-nonfree (2.6-2) unstable; urgency=low + + * Orphaned the package, I'm not maining non-free things anymore. + + -- Joey Hess Thu, 18 Mar 1999 14:49:50 -0800 + +bsdgames-nonfree (2.6-1) unstable; urgency=low + + * New upstream release. + + -- Joey Hess Sun, 20 Dec 1998 01:26:45 -0500 + +bsdgames-nonfree (2.5-2) unstable; urgency=low + + * Rebuilt with newest debhelper to change how suid binaries are registered. + + -- Joey Hess Tue, 27 Oct 1998 20:04:34 -0800 + +bsdgames-nonfree (2.5-1) unstable; urgency=low + + * New upstream release. Boggle was moved to bsdgames, only rogue remains. + + -- Joey Hess Thu, 24 Sep 1998 17:17:43 -0700 + +bsdgames-nonfree (2.4-1) unstable; urgency=low + + * New upstream release. + + -- Joey Hess Sat, 5 Sep 1998 15:44:05 -0700 + +bsdgames-nonfree (2.3-3) unstable; urgency=low + + * Make NEWS be a symlink to the upstream changelog, so the file name is + preserved. + + -- Joey Hess Thu, 20 Aug 1998 15:57:29 -0700 + +bsdgames-nonfree (2.3-2) unstable; urgency=low + + * Fixed == bashism. + + -- Joey Hess Thu, 20 Aug 1998 00:44:44 -0700 + +bsdgames-nonfree (2.3-1) unstable; urgency=low + + * New upstream release, removing Paranoia because of copyright problems + (ie, no copyright), and with security fixes. + * Re-enabled sgid bit of rogue becuase of above security fixes. + * Reworked how configure script is run, following the author's new docs in + PACKAGING. + * No longer have to include NEWS in my diff, it's available from upstream, + along with some more docs. + + -- Joey Hess Wed, 19 Aug 1998 23:07:54 -0700 + +bsdgames-nonfree (2.1-5) unstable; urgency=low + + * Fixed rogue segfault on startup. Fixed by a simple recompile, + but I have no idea how. + + -- Joey Hess Wed, 22 Jul 1998 20:31:37 -0700 + +bsdgames-nonfree (2.1-4) unstable; urgency=low + + * Copied NEWS over from bsdgames. It's really the same upstream changelog + for both packages. This lets me install a proper changelog.gz, to shut + lintian up. I've asked the author to include NEWS in the package in the + future. + + -- Joey Hess Fri, 10 Jul 1998 15:30:15 -0700 + +bsdgames-nonfree (2.1-3) frozen unstable; urgency=medium + + * Reluctantly removed all sgid bits from rogue, becuase there are probably + security problems in it. See the TODO, which has a security audit as it's + first priority, but explains the difficulties of one. + * Added a README.Debian exaplaining this in greater detail. + + -- Joey Hess Thu, 18 Jun 1998 10:54:33 -0700 + +bsdgames-nonfree (2.1-2) frozen unstable; urgency=low + + * Fixed rogue segfault on startup (#22619). Fixed by a simple recompile, + but I have no idea how. + + -- Joey Hess Sat, 23 May 1998 07:02:53 -0400 + +bsdgames-nonfree (2.1-1) frozen unstable; urgency=low + + * New upstream bugfix release: + - man page for paranoia. + - changes to build process that don't affect us. + - bugfixes. + + -- Joey Hess Mon, 30 Mar 1998 12:32:23 -0800 + +bsdgames-nonfree (2.0-5) unstable; urgency=low + + * Made score files not be conffiles. + + -- Joey Hess Tue, 10 Mar 1998 21:11:23 -0800 + +bsdgames-nonfree (2.0-4) unstable; urgency=low + + * Added a man page for paranoia. + * Don't include paranoia's README anymore, as all info in it is in the new + man page as well. + * Section non-free/games. + + -- Joey Hess Wed, 18 Feb 1998 17:51:50 -0800 + +bsdgames-nonfree (2.0-3) unstable; urgency=low + + * update standards-version. + + -- Joey Hess Mon, 9 Feb 1998 15:52:24 -0800 + +bsdgames-nonfree (2.0-2) unstable; urgency=low + + * Applied patch from author to fix screen refresh bug after displaying + help. + * Fixed menu entry for bog. + + -- Joey Hess Mon, 29 Dec 1997 16:57:34 -0500 + +bsdgames-nonfree (2.0-1) unstable; urgency=low + + * New upstream release. + + -- Joey Hess Fri, 26 Dec 1997 13:15:45 -0500 + +bsdgames-nonfree (1.5-4) unstable; urgency=low + + * Modified mkdict to exit with return code of zero. This was keeping it + from builing properly on the sparc. + * Use debhelper. + + -- Joey Hess Thu, 11 Dec 1997 00:47:57 -0500 + +bsdgames-nonfree (1.5-3) unstable; urgency=low + + * Fixed postinst to make sure rogue score file is rw by user games. + * Routine update of debian/rules: + Fixed binary-indep target. + + -- Joey Hess Fri, 12 Sep 1997 21:17:54 -0400 + +bsdgames-nonfree (1.5-2) unstable; urgency=low + + * Added rogue info to copyright file. + + -- Joey Hess Tue, 2 Sep 1997 13:29:50 -0400 + +bsdgames-nonfree (1.5-1) unstable; urgency=low + + * New upstream release - now with rogue. + * Libc6 at last. + * Fakeroot fixes. + * Pristine upstream source. + * Changed how the configure script is run during building, new method + is more robust. + + -- Joey Hess Mon, 1 Sep 1997 22:41:33 -0400 + +bsdgames-nonfree (1.4-1) unstable; urgency=low + + * New upstream release -- upstream source now separates these nonfree + games out of the main bsdgames source tree. + * Converted menufile to menu-1 format. + + -- Joey Hess Sat, 22 Mar 1997 01:08:25 -0500 + +bsdgames-nonfree (1.3-1) unstable; urgency=low + + * First release. + + -- Joey Hess Sat, 22 Mar 1997 01:08:25 -0500 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..ae6cabf --- /dev/null +++ b/debian/control @@ -0,0 +1,22 @@ +Source: bsdgames-nonfree +Maintainer: Aaron M. Ucko +Section: non-free/games +XS-Autobuild: yes +Priority: optional +Build-Depends: debhelper (>= 9), + libncurses5-dev +Standards-Version: 3.9.8 +Vcs-Browser: https://anonscm.debian.org/cgit/users/ucko/bsdgames-nonfree.git +Vcs-Git: https://anonscm.debian.org/git/users/ucko/bsdgames-nonfree.git + +Package: bsdgames-nonfree +Architecture: any +Depends: ${misc:Depends}, + ${shlibs:Depends} +Suggests: bsdgames +Description: rogue, the classic dungeon exploration game + This is a text-based game common on (traditional) BSD systems. It may + not be distributed freely, so it had to be broken off from the main + bsdgames package and placed in non-free. + . + This package now contains only rogue, the classic dungeon exploration game. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..658fc6d --- /dev/null +++ b/debian/copyright @@ -0,0 +1,57 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: bsd-games-non-free +Upstream-Contact: jsm@polyomino.org.uk +Source: ftp://ibiblio.org:/pub/Linux/games/ +Disclaimer: This package isn't part of Debian proper because rogue's + license forbids commercial use. + +Files: * +Copyright: Copyright 1997-2005 Joseph Samuel Myers +License: BSD-3 + +Files: .gitignore config.params debian/* +Copyright: Copyright 1997-2000 Joey Hess , + 2001-2003 Javier Fernandez-Sanguino Peña , + 2003-2013, 2017 Aaron M. Ucko +License: BSD-3 + +Files: rogue/* +Copyright: Copyright 1986, 1988, 1990, 1993 The Regents of the + University of California +License: other + BSD-3 with the following additional (non-free) restrictions: + . + 1.) No portion of this notice shall be removed. + 2.) Credit shall not be taken for the creation of this source. + 3.) This code is not to be traded, sold, or used for personal + gain or profit. +Comment: Primary upstream authors: Timothy Stoehr, Michael C. Toy, + Ken Arnold, and Glenn Wichman. + +License: BSD-3 + Copyright (c) 1980, 1982, 1983, 1985-1994 + The Regents of the University of California. All rights reserved. + . + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..9c446e3 --- /dev/null +++ b/debian/docs @@ -0,0 +1,9 @@ +AUTHORS +BUGS +ChangeLog +ChangeLog.0 +README.non-free +SECURITY +THANKS +TODO +YEAR2000 diff --git a/debian/menu b/debian/menu new file mode 100644 index 0000000..8d7c01c --- /dev/null +++ b/debian/menu @@ -0,0 +1,2 @@ +?package(bsdgames-nonfree):needs="text" section="Games/Adventure" \ + title="Rogue" command="/usr/games/rogue" diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..7abc2df --- /dev/null +++ b/debian/postinst @@ -0,0 +1,20 @@ +#!/bin/sh -e + +VARDIR=/var/games/bsdgames-nonfree +SCOREFILES="$VARDIR/rogue.scores" +OLDDIR=/var/lib/games/bsdgames-nonfree + +# See if the files exist in an old pre-FHS directory and move them if so. +if [ -d $OLDDIR ]; then + if [ -e $OLDDIR/rogue.scores ]; then + mv -f $OLDDIR/rogue.scores $VARDIR/rogue.scores + fi +fi + +# Older versions may have set bad permissions +chmod a+x $VARDIR +touch $SCOREFILES +chown root:games $SCOREFILES +chmod 664 $SCOREFILES + +#DEBHELPER# diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 0000000..72fb1fd --- /dev/null +++ b/debian/postrm @@ -0,0 +1,12 @@ +#!/bin/sh -e + +VARDIR=/var/games/bsdgames-nonfree +SCOREFILES="$VARDIR/rogue.scores" + +# Remove high score files on purge. +if [ "$1" = "purge" ]; then + rm -f $SCOREFILES +fi + + +#DEBHELPER# diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..58265b5 --- /dev/null +++ b/debian/rules @@ -0,0 +1,34 @@ +#!/usr/bin/make -f +pkg = bsdgames-nonfree +DEB_DESTDIR = $(CURDIR)/debian/$(pkg) + +export DEB_BUILD_MAINT_OPTIONS=hardening=+all + +CFLAGS := $(shell dpkg-buildflags --get CFLAGS) \ + $(shell dpkg-buildflags --get CPPFLAGS) +LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) + +%: + dh $@ + +override_dh_auto_clean: + dh_auto_clean -- -f GNUmakefile distclean + +override_dh_auto_configure: + bsd_games_cfg_other_cflags="$(CFLAGS)" \ + bsd_games_cfg_other_ldflags="$(LDFLAGS)" \ + ./configure + +override_dh_auto_install: + dh_auto_install -- INSTALL_PREFIX=$(DEB_DESTDIR) + -rm -f $(DEB_DESTDIR)/var/games/$(pkg)/rogue.scores + mkdir -p $(DEB_DESTDIR)/usr/share/vrms/reasons + echo "$(pkg): No commercial use" \ + > $(DEB_DESTDIR)/usr/share/vrms/reasons/$(pkg) + cp rogue/CHANGES $(DEB_DESTDIR)/usr/share/doc/$(pkg)/CHANGES.rogue + +override_dh_installchangelogs: + dh_installchangelogs -k NEWS + +override_dh_fixperms: + dh_fixperms -X/usr/games/rogue diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..66520a5 --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=2 +ftp://ibiblio.org/pub/Linux/games/bsd-games-non-free-([0-9]+.*).tar.gz +# ftp://ibiblio.org/pub/Linux/Incoming/bsd-games-non-free-([0-9]+.*).tar.gz diff --git a/rogue/init.c b/rogue/init.c index d077bf2..702334d 100644 --- a/rogue/init.c +++ b/rogue/init.c @@ -168,7 +168,7 @@ player_init() obj = alloc_object(); obj->what_is = WEAPON; obj->which_kind = BOW; - obj->damage = "1d2"; + obj->damage = "1d1"; /* per object.c; was 1d2 */ obj->hit_enchant = 1; obj->d_enchant = 0; obj->identified = 1; diff --git a/rogue/move.c b/rogue/move.c index c846b74..43dbd80 100644 --- a/rogue/move.c +++ b/rogue/move.c @@ -422,7 +422,7 @@ check_hunger(msg_only) Subtract 0, i.e. do nothing. break;*/ case -1: - rogue.moves_left -= (rogue.moves_left % 2); + rogue.moves_left -= m_moves % 2; break; case 0: rogue.moves_left--; @@ -430,7 +430,7 @@ check_hunger(msg_only) case 1: rogue.moves_left--; (void) check_hunger(1); - rogue.moves_left -= (rogue.moves_left % 2); + rogue.moves_left -= m_moves % 2; break; case 2: rogue.moves_left--; diff --git a/rogue/object.c b/rogue/object.c index 8364e51..262e18c 100644 --- a/rogue/object.c +++ b/rogue/object.c @@ -533,6 +533,13 @@ gr_weapon(obj, assign_wk) } } } + assign_damage(obj); +} + +void +assign_damage(obj) + object *obj; +{ switch(obj->which_kind) { case BOW: case DART: @@ -556,6 +563,9 @@ gr_weapon(obj, assign_wk) case TWO_HANDED_SWORD: obj->damage = "4d5"; break; + default: + obj->damage = "1d1"; + break; } } diff --git a/rogue/rogue.h b/rogue/rogue.h index d8a6096..f9eaae9 100644 --- a/rogue/rogue.h +++ b/rogue/rogue.h @@ -464,6 +464,7 @@ void add_mazes(void); void add_traps(void); void aggravate(void); void aim_monster(object *); +void assign_damage(object *); void bounce(short, short, short, short, short); void byebye(int); void c_object_for_wizard(void); diff --git a/rogue/save.c b/rogue/save.c index c7655ee..8fa106f 100644 --- a/rogue/save.c +++ b/rogue/save.c @@ -263,6 +263,10 @@ read_pack(pack, fp, is_rogue) } new_obj = alloc_object(); *new_obj = read_obj; + /* new_obj->damage is a pointer, and not guaranteed to be valid + * across runs with slightly different binaries, or even the + * same binary if built as a position-independent executable. */ + assign_damage(new_obj); if (is_rogue) { if (new_obj->in_use_flags & BEING_WORN) { do_wear(new_obj); -- cgit v1.2.3