changeset 36:2128c7dc8a40

Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
author elwin
date Thu, 25 Nov 2010 12:21:41 +0000
parents 05018c63a721
children 34d7a614855e
files srogue/LICENSE.TXT srogue/Makefile srogue/armor.c srogue/bob.h srogue/bsdtty.c srogue/chase.c srogue/command.c srogue/cx.h srogue/daemon.c srogue/daemons.c srogue/disply.c srogue/encumb.c srogue/fight.c srogue/global.c srogue/init.c srogue/io.c srogue/list.c srogue/main.c srogue/makevers.c srogue/misc.c srogue/monsters.c srogue/move.c srogue/ncx.h srogue/new_leve.c srogue/newterm.c srogue/options.c srogue/pack.c srogue/passages.c srogue/potions.c srogue/pstats.c srogue/rdk.h srogue/rgdata.c srogue/rings.c srogue/rip.c srogue/rogue.ext srogue/rogue.h srogue/rogue.nr srogue/rooms.c srogue/save.c srogue/scrolls.c srogue/state.c srogue/sticks.c srogue/things.c srogue/trader.c srogue/vers.c srogue/weapons.c srogue/wizard.c srogue/xcrypt.c
diffstat 48 files changed, 17601 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/srogue/LICENSE.TXT	Thu Nov 25 12:21:41 2010 +0000
@@ -0,0 +1,139 @@
+Copyright (C) 1984 Robert D. Kindelberger
+Portions Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
+Portions Copyright (C) 2005 Nicholas J. Kisseberth
+Portions Copyright (C) 1994 David Burren
+All rights reserved.
+
+===========================================================================
+
+Super-Rogue
+Copyright (C) 1984 Robert D. Kindelberger
+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.
+4. The name "Super-Rogue" must not be used to endorse or promote products 
+   derived from this software without prior written permission.
+5. Products derived from this software may not be called "Super-Rogue",
+   nor may "Super-Rogue" appear in their name, without 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 are based on the work of Michael Toy, Ken Arnold
+and Glenn Wichman. Used under license:
+
+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 (save/restore game state) are based on the work 
+of Nicholas J. Kisseberth. Used under license:
+
+Copyright (C) 2005 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 (encryption) 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/srogue/Makefile	Thu Nov 25 12:21:41 2010 +0000
@@ -0,0 +1,130 @@
+# Makefile for rogue
+# %W% (Berkeley) %G%
+#
+# Super-Rogue
+# Copyright (C) 1984 Robert D. Kindelberger
+# All rights reserved.
+#
+# Based on "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=srogue9.0-1
+PROGRAM=srogue
+
+HDRS= bob.h cx.h ncx.h rdk.h rogue.h 
+OBJS= vers.o armor.o chase.o command.o daemon.o daemons.o disply.o encumb.o \
+      fight.o global.o init.o io.o list.o main.o misc.o monsters.o move.o \
+      new_leve.o options.o pack.o passages.o potions.o pstats.o rings.o rip.o \
+      rooms.o save.o scrolls.o state.o sticks.o things.o trader.o weapons.o \
+      wizard.o xcrypt.o
+CFILES= vers.c armor.c chase.c command.c daemon.c daemons.c disply.c encumb.c \
+      fight.c global.c init.c io.c list.c main.c misc.c monsters.c move.c \
+      new_leve.c options.c pack.c passages.c potions.c pstats.c rings.c rip.c \
+      rooms.c save.c scrolls.c state.c sticks.c things.c trader.c weapons.c \
+      wizard.c xcrypt.c
+
+MISC=	Makefile LICENSE.TXT rogue.nr
+
+CC    = gcc
+CFLAGS= -g
+CRLIB = -lcurses
+RM    = rm -f
+TAR   = tar
+
+$(PROGRAM): $(HDRS) $(OBJS)
+	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(CRLIB) -o $@
+
+tags: $(HDRS) $(CFILES)
+	ctags -u $?
+	ed - tags < :ctfix
+	sort tags -o tags
+
+lint:
+	lint -hxbc $(CFILES) $(CRLIB) > linterrs
+
+clean:
+	rm -f $(OBJS) core 
+	rm -f $(PROGRAM) $(PROGRAM).exe $(PROGRAM) $(PROGRAM).exe $(PROGRAM).tar $(PROGRAM).tar.gz $(PROGRAM).doc
+
+count:
+	wc -l $(HDRS) $(CFILES)
+
+realcount:
+	cc -E $(CFILES) | ssp - | wc -l
+
+update:
+	ar uv .SAVE $(CFILES) $(HDRS) $(MISC)
+
+dist:
+	@mkdir dist
+	cp $(CFILES) $(HDRS) $(MISC) dist
+
+dist.src:
+	make clean
+	tar cf $(DISTNAME)-src.tar $(CFILES) $(HDRS) $(MISC)
+	gzip -f $(DISTNAME)-src.tar
+
+dist.irix:
+	make clean
+	make CC=cc CFLAGS="-woff 1116 -O3" $(PROGRAM)
+	tbl rogue.nr | nroff -mm | colcrt - > $(PROGRAM).doc
+	tar cf $(DISTNAME)-irix.tar $(PROGRAM) LICENSE.TXT $(PROGRAM).doc
+	gzip -f $(DISTNAME)-irix.tar
+
+debug.aix:
+	make clean
+	make CC=xlc CFLAGS="-qmaxmem=16768 -g -DWIZARD  -qstrict" $(PROGRAM)
+
+dist.aix:
+	make clean
+	make CC=xlc CFLAGS="-qmaxmem=16768 -O3 -qstrict" $(PROGRAM)
+	tbl rogue.nr | nroff -mm | colcrt - > $(PROGRAM).doc
+	tar cf $(DISTNAME)-aix.tar $(PROGRAM) LICENSE.TXT $(PROGRAM).doc
+	gzip -f $(DISTNAME)-aix.tar
+
+debug.linux:
+	make clean
+	make CFLAGS="-g -DWIZARD" $(PROGRAM)
+
+dist.linux:
+	make clean
+	make $(PROGRAM)
+	groff -P-c -t -mm -Tascii rogue.nr | sed -e 's/.\x08//g' >$(PROGRAM).doc
+	tar cf $(DISTNAME)-linux.tar $(PROGRAM) LICENSE.TXT $(PROGRAM).doc
+	gzip -f $(DISTNAME)-linux.tar
+	
+debug.interix: 
+	make clean
+	make CFLAGS="-g3 -DWIZARD" $(PROGRAM)
+	
+dist.interix: 
+	make clean
+	make $(PROGRAM)
+	groff -P-b -P-u -t -mm -Tascii rogue.nr > $(PROGRAM).doc
+	tar cf $(DISTNAME)-interix.tar $(PROGRAM) LICENSE.TXT $(PROGRAM).doc
+	gzip -f $(DISTNAME)-interix.tar
+	
+debug.cygwin:
+	make clean
+	make CFLAGS="-g3 -DWIZARD" $(PROGRAM)
+
+dist.cygwin:
+	make clean
+	make $(PROGRAM)
+	groff -P-c -t -mm -Tascii rogue.nr | sed -e 's/.\x08//g' >$(PROGRAM).doc
+	tar cf $(DISTNAME)-cygwin.tar $(PROGRAM).exe LICENSE.TXT $(PROGRAM).doc
+	gzip -f $(DISTNAME)-cygwin.tar
+	
+debug.djgpp: 
+	make clean
+	make CFGLAGS="-g3 -DWIZARD" LDFLAGS="-L$(DJDIR)/LIB" CRLIB="-lpdcurses" $(PROGRAM)
+
+dist.djgpp: 
+	make clean
+	make LDFLAGS="-L$(DJDIR)/LIB" CRLIB="-lpdcurses" $(PROGRAM)
+	groff -t -mm -Tascii rogue.nr | sed -e 's/.\x08//g' > $(PROGRAM).doc
+	rm -f $(DISTNAME)-djgpp.zip
+	zip $(DISTNAME)-djgpp.zip $(PROGRAM).exe LICENSE.TXT $(PROGRAM).doc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/srogue/armor.c	Thu Nov 25 12:21:41 2010 +0000
@@ -0,0 +1,108 @@
+/*
+ * This file contains misc functions for dealing with armor
+ *
+ * @(#)armor.c	9.0	(rdk)	 7/17/84
+ *
+ * Super-Rogue
+ * Copyright (C) 1984 Robert D. Kindelberger
+ * All rights reserved.
+ *
+ * Based on "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 "rogue.h"
+#include "rogue.ext"
+
+/*
+ * wear:
+ *	The player wants to wear something, so let the hero try
+ */
+wear()
+{
+	reg struct linked_list *item;
+	reg struct object *obj;
+
+	if (cur_armor != NULL) {
+		msg("You are already wearing some.");
+		after = FALSE;
+		return;
+	}
+	if ((item = get_item("wear", ARMOR)) == NULL)
+		return;
+	obj = OBJPTR(item);
+	if (obj->o_type != ARMOR) {
+		msg("You can't wear that.");
+		return;
+	}
+	waste_time();
+	msg("Wearing %s.", a_magic[obj->o_which].mi_name);
+	cur_armor = obj;
+	setoflg(obj,ISKNOW);
+	nochange = FALSE;
+}
+
+
+/*
+ * take_off:
+ *	Get the armor off of the players back
+ */
+take_off()
+{
+	reg struct object *obj;
+
+	if ((obj = cur_armor) == NULL) {
+		msg("Not wearing any armor.");
+		return;
+	}
+	if (!dropcheck(cur_armor))
+		return;
+	cur_armor = NULL;
+	msg("Was wearing %c) %s",pack_char(obj),inv_name(obj,TRUE));
+	nochange = FALSE;
+}
+
+/*
+ * initarmor:
+ *		Initialize some armor.
+ */
+initarmor(obj, what)
+struct object *obj;
+int what;
+{
+	struct init_armor *iwa;
+	struct magic_item *mi;
+
+	obj->o_type = ARMOR;
+	obj->o_which = what;
+	iwa = &armors[what];
+	mi = &a_magic[what];
+	obj->o_vol = iwa->a_vol;
+	obj->o_ac = iwa->a_class;
+	obj->o_weight = iwa->a_wght;
+	obj->o_typname = things[TYP_ARMOR].mi_name;
+}
+
+/*
+ * hurt_armor:
+ *	Returns TRUE if armor is damaged
+ */
+hurt_armor(obj)
+struct object *obj;
+{
+	reg int type, ac;
+
+	if (obj != NULL) {
+		if (o_on(obj, ISPROT) || (o_on(obj, ISBLESS) && rnd(100) < 10))
+			return FALSE;
+		ac = obj->o_ac;
+		type = obj->o_which;
+		if (type != PADDED && type != LEATHER)
+			if ((type == STUDDED && ac < 8) || (type != STUDDED && ac < 9))
+				return TRUE;
+	}
+	return FALSE;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/srogue/bob.h	Thu Nov 25 12:21:41 2010 +0000
@@ -0,0 +1,12 @@
+/*
+ * Super-Rogue
+ * Copyright (C) 1984 Robert D. Kindelberger
+ * All rights reserved.
+ *
+ * See the file LICENSE.TXT for full copyright and licensing information.
+ */
+
+#include	<sgtty.h>
+typedef	struct sgttyb	SGTTY;
+static SGTTY _tty, _res_flg;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/srogue/bsdtty.c	Thu Nov 25 12:21:41 2010 +0000
@@ -0,0 +1,121 @@
+/*
+ * Super-Rogue
+ * Copyright (C) 1984 Robert D. Kindelberger
+ * All rights reserved.
+ *
+ * See the file LICENSE.TXT for full copyright and licensing information.
+ */
+
+#include "rogue.h"
+
+extern	bool NONL;
+
+raw()
+{
+/*
+	VERSION 5.0
+	_tty.c_lflag &= ~ICANON;
+	_tty.c_cc[VMIN] = 1;
+	_tty.c_cc[VTIME] = 255;
+	_tty.c_oflag &= ~OPOST;
+*/
+	_rawmode = TRUE;