changeset 0:527e2150eaf0

Import Rogue 3.6 from the Roguelike Restoration Project (r1490)
author edwarj4
date Tue, 13 Oct 2009 13:33:34 +0000
parents
children b4856d4d4c4e
files rogue3/LICENSE.TXT rogue3/Makefile rogue3/armor.c rogue3/chase.c rogue3/command.c rogue3/daemon.c rogue3/daemons.c rogue3/fight.c rogue3/init.c rogue3/io.c rogue3/list.c rogue3/machdep.h rogue3/main.c rogue3/mdport.c rogue3/mdport.h rogue3/misc.c rogue3/monsters.c rogue3/move.c rogue3/newlevel.c rogue3/options.c rogue3/pack.c rogue3/passages.c rogue3/potions.c rogue3/readme36.html rogue3/rings.c rogue3/rip.c rogue3/rogue.6 rogue3/rogue.h rogue3/rogue.r rogue3/rogue36.cat rogue3/rogue36.doc rogue3/rogue36.html rogue3/rogue36.sln rogue3/rogue36.vcproj rogue3/rooms.c rogue3/save.c rogue3/scrolls.c rogue3/state.c rogue3/sticks.c rogue3/things.c rogue3/vers.c rogue3/weapons.c rogue3/wizard.c rogue3/xcrypt.c
diffstat 44 files changed, 15930 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rogue3/LICENSE.TXT	Tue Oct 13 13:33:34 2009 +0000
@@ -0,0 +1,92 @@
+Rogue: Exploring the Dungeons of Doom
+Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
+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(s) of the author(s) nor the names of other contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) 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 AUTHOR(S) 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.
+
+===========================================================================
+
+Portions of this software (state.c/mdport.c/mdport.h) are based on the work 
+of Nicholas J. Kisseberth. Used under license:
+
+Copyright (C) 1999, 2000, 2006, 2007, 2008 Nicholas J. Kisseberth
+
+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(s) of the author(s) nor the names of other contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) 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 AUTHOR(S) 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.
+
+===========================================================================
+
+Portions of this software (xcrypt.c) are based on the work 
+of David Burren. Used under license:
+
+FreeSec: libcrypt
+
+Copyright (C) 1994 David Burren
+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(s) of the author(s) nor the names of other contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) 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 AUTHOR(S) OR CONTRIBUTORS BE LIABLE
+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.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rogue3/Makefile	Tue Oct 13 13:33:34 2009 +0000
@@ -0,0 +1,151 @@
+#
+# Makefile for rogue
+# %W% (Berkeley) %G%
+#
+# Rogue: Exploring the Dungeons of Doom
+# Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
+# All rights reserved.
+#
+# See the file LICENSE.TXT for full copyright and licensing information.
+#
+
+DISTNAME=rogue3.6.4
+PROGRAM=rogue
+
+O=o
+
+HDRS= 	rogue.h machdep.h
+
+OBJS1 = vers.$(O) armor.$(O) chase.$(O) command.$(O) daemon.$(O) daemons.$(O) \
+        fight.$(O) init.$(O) io.$(O) list.$(O) main.$(O) mdport.$(O) \
+	misc.$(O) monsters.$(O) move.$(O) newlevel.$(O) options.$(O) 
+OBJS2 =	pack.$(O) passages.$(O) potions.$(O) rings.$(O) rip.$(O) rooms.$(O) \
+	save.$(O) scrolls.$(O) state.$(O) sticks.$(O) things.$(O) \
+	weapons.$(O) wizard.$(O) xcrypt.$(O)
+OBJS  = $(OBJS1) $(OBJS2)
+
+CFILES= vers.c armor.c chase.c command.c daemon.c daemons.c fight.c \
+	init.c io.c list.c main.c mdport.c misc.c monsters.c move.c newlevel.c \
+	options.c pack.c passages.c potions.c rings.c rip.c rooms.c \
+	save.c scrolls.c state.c sticks.c things.c weapons.c wizard.c xcrypt.c
+
+
+MISC_C=
+DOCSRC= rogue.6 rogue.r
+DOCS  = $(PROGRAM).doc $(PROGRAM).cat $(PROGRAM).html readme36.html
+MISC  =	Makefile $(MISC_C) LICENSE.TXT $(PROGRAM).sln $(PROGRAM).vcproj $(DOCS)\
+	$(DOCSRC)
+
+CC    = gcc
+ROPTS =
+COPTS = -O3
+CFLAGS= $(COPTS) $(ROPTS) -DSCOREFILE=\"rogue36.scr\"
+LIBS  = -lcurses
+RM    = rm -f
+LD    = $(CC)
+LDOUT = -o 
+
+.SUFFIXES: .obj
+
+.c.obj:
+	$(CC) $(CFLAGS) /c $*.c
+
+$(PROGRAM)$(EXE): $(HDRS) $(OBJS)
+	$(LD) $(LDFLAGS) $(OBJS) $(LIBS) $(LDOUT)$@
+
+clean:
+	$(RM) $(OBJS1)
+	$(RM) $(OBJS2)
+	$(RM) core $(PROGRAM) $(PROGRAM).exe $(DISTNAME).tar $(DISTNAME).tar.gz 
+	$(RM) $(DISTNAME).zip
+
+dist.src:
+	make clean
+	tar cf $(DISTNAME)-src.tar $(CFILES) $(HDRS) $(MISC) $(DOCS)
+	gzip -f $(DISTNAME)-src.tar
+
+dist.irix:
+	@$(MAKE) clean
+	@$(MAKE) CC=cc CFLAGS="-woff 1116 -O3" $(PROGRAM)
+#	tbl rogue.r | nroff -ms | colcrt - > $(PROGRAM).doc
+#	nroff -man rogue.6 | colcrt - > $(PROGRAM).cat
+	tar cf $(DISTNAME)-irix.tar $(PROGRAM) LICENSE.TXT $(DOCS)
+	gzip -f $(DISTNAME)-irix.tar
+
+dist.aix:
+	@$(MAKE) clean
+	@$(MAKE) CC=xlc CFLAGS="-qmaxmem=16768 -O3 -qstrict" $(PROGRAM)
+#	tbl rogue.r | nroff -ms | colcrt - > $(ROGUE).doc
+#	nroff -man rogue.6 | colcrt - > $(ROGUE).cat
+	tar cf $(DISTNAME)-aix.tar $(PROGRAM) LICENSE.TXT $(DOCS)
+	gzip -f $(DISTNAME)-aix.tar
+
+dist.linux:
+	@$(MAKE) clean
+	@$(MAKE) $(PROGRAM)
+#	groff -P-c -t -ms -Tascii rogue.r | sed -e 's/.\x08//g' > $(PROGRAM).doc
+#	groff -man rogue.6 | sed -e 's/.\x08//g' > $(PROGRAM).cat
+	tar cf $(DISTNAME)-linux.tar $(PROGRAM) LICENSE.TXT $(DOCS)
+	gzip -f $(DISTNAME)-linux.tar
+	
+debug.linux:
+	@$(MAKE) clean
+	@$(MAKE) COPTS="-g" $(PROGRAM)
+#	groff -P-c -t -ms -Tascii rogue.r | sed -e 's/.\x08//g' > $(PROGRAM).doc
+#	groff -man rogue.6 | sed -e 's/.\x08//g' > $(PROGRAM).cat
+	
+dist.interix: 
+	@$(MAKE) clean
+	@$(MAKE) COPTS="-ansi" $(PROGRAM)
+#	groff -P-b -P-u -t -ms -Tascii rogue.r > $(PROGRAM).doc
+#	groff -P-b -P-u -man -Tascii rogue.6 > $(PROGRAM).cat
+	tar cf $(DISTNAME)-interix.tar $(PROGRAM) LICENSE.TXT $(DOCS)
+	gzip -f $(DISTNAME)-interix.tar	
+
+dist.cygwin:
+	@$(MAKE) --no-print-directory clean
+	@$(MAKE) COPTS="-I/usr/include/ncurses" --no-print-directory $(PROGRAM)
+#	groff -P-c -t -ms -Tascii rogue.r | sed -e 's/.\x08//g' > $(PROGRAM).doc
+#	groff -P-c -man -Tascii rogue.6 | sed -e 's/.\x08//g' > $(PROGRAM).cat
+	tar cf $(DISTNAME)-cygwin.tar $(PROGRAM).exe LICENSE.TXT $(DOCS)
+	gzip -f $(DISTNAME)-cygwin.tar
+
+#
+# Use MINGW32-MAKE to build this target
+#
+dist.mingw32:
+	@$(MAKE) --no-print-directory RM="cmd /c del" clean
+	@$(MAKE) --no-print-directory COPTS="-I../pdcurses" LIBS="../pdcurses/pdcurses.a" $(PROGRAM)
+	cmd /c del $(DISTNAME)-mingw32.zip
+	zip $(DISTNAME)-mingw32.zip $(PROGRAM).exe LICENSE.TXT $(DOCS)
+	
+#
+# Seperate doc targets for DJGPP prevent strange SIGSEGV in groff
+# in that environment.
+#
+doc.djgpp:
+	groff -t -ms -Tascii rogue.r | sed -e 's/.\x08//g' > $(PROGRAM).doc
+
+cat.djgpp:
+	groff -man -Tascii rogue.6 | sed -e 's/.\x08//g' > $(PROGRAM).cat
+
+dist.djgpp: 
+	@$(MAKE) --no-print-directory clean
+	@$(MAKE) --no-print-directory LDFLAGS="-L$(DJDIR)/LIB" \
+		LIBS="-lpdcur" $(PROGRAM)
+#	@$(MAKE) --no-print-directory doc.djgpp
+#	@$(MAKE) --no-print-directory cat.djgpp
+	rm -f $(DISTNAME)-djgpp.zip
+	zip $(DISTNAME)-djgpp.zip $(PROGRAM) LICENSE.TXT $(DOCS)
+
+#
+# Use NMAKE to build this target
+#
+dist.win32:
+	@$(MAKE) /NOLOGO O="obj" RM="-del" clean
+	@$(MAKE) /NOLOGO O="obj" CC="@CL" LD="link" LDOUT="/OUT:" EXE=".exe"\
+	    LIBS="/NODEFAULTLIB:LIBC ..\pdcurses\pdcurses.lib shell32.lib user32.lib Advapi32.lib" \
+	    COPTS="-nologo -D_CRT_SECURE_NO_DEPRECATE -I..\pdcurses \
+	    -Ox -wd4033 -wd4716" $(PROGRAM).exe
+	-del $(DISTNAME)-win32.zip
+	zip $(DISTNAME)-win32.zip $(PROGRAM).exe LICENSE.TXT $(DOCS)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rogue3/armor.c	Tue Oct 13 13:33:34 2009 +0000
@@ -0,0 +1,93 @@
+/*
+ * This file contains misc functions for dealing with armor
+ * @(#)armor.c	3.9 (Berkeley) 6/15/81
+ * 
+ * Rogue: Exploring the Dungeons of Doom
+ * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
+ * All rights reserved.
+ *
+ * See the file LICENSE.TXT for full copyright and licensing information.
+ */
+
+#include "curses.h"
+#include "rogue.h"
+
+/*
+ * wear:
+ *	The player wants to wear something, so let him/her put it on.
+ */
+
+void
+wear()
+{
+    register struct linked_list *item;
+    register struct object *obj;
+
+    if (cur_armor != NULL)
+    {
+	addmsg("You are already wearing some");
+	if (!terse)
+	    addmsg(".  You'll have to take it off first");
+	endmsg();
+	after = FALSE;
+	return;
+    }
+    if ((item = get_item("wear", ARMOR)) == NULL)
+	return;
+    obj = (struct object *) ldata(item);
+    if (obj->o_type != ARMOR)
+    {
+	msg("You can't wear that.");
+	return;
+    }
+    waste_time();
+    if (!terse)
+	addmsg("You are now w");
+    else
+	addmsg("W");
+    msg("earing %s.", a_names[obj->o_which]);
+    cur_armor = obj;
+    obj->o_flags |= ISKNOW;
+}
+
+/*
+ * take_off:
+ *	Get the armor off of the players back
+ */
+
+void
+take_off()
+{
+    register struct object *obj;
+
+    if ((obj = cur_armor) == NULL)
+    {
+	if (terse)
+		msg("Not wearing armor");
+	else
+		msg("You aren't wearing any armor");
+	return;
+    }
+    if (!dropcheck(cur_armor))
+	return;
+    cur_armor = NULL;
+    if (terse)
+	addmsg("Was");
+    else
+	addmsg("You used to be ");
+    msg(" wearing %c) %s", pack_char(obj), inv_name(obj, TRUE));
+}
+
+/*
+ * waste_time:
+ *	Do nothing but let other things happen
+ */
+
+void
+waste_time()
+{
+    do_daemons(BEFORE);
+    do_fuses(BEFORE);
+    do_daemons(AFTER);
+    do_fuses(AFTER);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rogue3/chase.c	Tue Oct 13 13:33:34 2009 +0000
@@ -0,0 +1,319 @@
+/*
+ * Code for one object to chase another
+ *
+ * @(#)chase.c	3.17 (Berkeley) 6/15/81
+ *
+ * Rogue: Exploring the Dungeons of Doom
+ * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
+ * All rights reserved.
+ *
+ * See the file LICENSE.TXT for full copyright and licensing information.
+ */
+
+#include "curses.h"
+#include "rogue.h"
+
+coord ch_ret;				/* Where chasing takes you */
+
+/*
+ * runners:
+ *	Make all the running monsters move.
+ */
+
+void
+runners()
+{
+    struct linked_list *item;
+    struct thing *tp;
+
+    for (item = mlist; item != NULL;)
+    {
+	tp = (struct thing *) ldata(item);
+        item = next(item);
+	if (off(*tp, ISHELD) && on(*tp, ISRUN))
+	{
+	    if (off(*tp, ISSLOW) || tp->t_turn)
+		if (do_chase(tp) == -1)
+                    continue;
+	    if (on(*tp, ISHASTE))
+		if (do_chase(tp) == -1)
+                    continue;
+	    tp->t_turn ^= TRUE;
+	}
+    }
+}
+
+/*
+ * do_chase:
+ *	Make one thing chase another.
+ */
+
+int
+do_chase(struct thing *th)
+{
+    struct room *rer, *ree;	/* room of chaser, room of chasee */
+    int mindist = 32767, i, dist;
+    int stoprun = FALSE;	/* TRUE means we are there */
+    int sch;
+    coord this;				/* Temporary destination for chaser */
+
+    rer = roomin(&th->t_pos);	/* Find room of chaser */
+    ree = roomin(th->t_dest);	/* Find room of chasee */
+    /*
+     * We don't count doors as inside rooms for this routine
+     */
+    if (mvwinch(stdscr, th->t_pos.y, th->t_pos.x) == DOOR)
+	rer = NULL;
+    this = *th->t_dest;
+    /*
+     * If the object of our desire is in a different room, 
+     * than we are and we ar not in a corridor, run to the
+     * door nearest to our goal.
+     */
+    if (rer != NULL && rer != ree)
+	for (i = 0; i < rer->r_nexits; i++)	/* loop through doors */
+	{
+	    dist = DISTANCE(th->t_dest->y, th->t_dest->x,
+			    rer->r_exit[i].y, rer->r_exit[i].x);
+	    if (dist < mindist)			/* minimize distance */
+	    {
+		this = rer->r_exit[i];
+		mindist = dist;
+	    }
+	}
+    /*
+     * this now contains what we want to run to this time
+     * so we run to it.  If we hit it we either want to fight it
+     * or stop running
+     */
+    if (!chase(th, &this))
+    {
+	if (ce(this, hero))
+	{
+	    return( attack(th) );
+	}
+	else if (th->t_type != 'F')
+	    stoprun = TRUE;
+    }
+    else if (th->t_type == 'F')
+	return(0);
+    mvwaddch(cw, th->t_pos.y, th->t_pos.x, th->t_oldch);
+    sch = mvwinch(cw, ch_ret.y, ch_ret.x);