Mercurial > hg > early-roguelike
changeset 12:9535a08ddc39
Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
author | edwarj4 |
---|---|
date | Sat, 24 Oct 2009 16:52:52 +0000 |
parents | 949d558c2162 |
children | 63b9fd7d70ce |
files | rogue4/LICENSE.TXT rogue4/Makefile rogue4/armor.c rogue4/chase.c rogue4/command.c rogue4/daemon.c rogue4/daemons.c rogue4/extern.c rogue4/extern.h rogue4/fight.c rogue4/findpw.c rogue4/init.c rogue4/io.c rogue4/list.c rogue4/mach_dep.c rogue4/main.c rogue4/mdport.c rogue4/misc.c rogue4/monsters.c rogue4/move.c rogue4/new_level.c rogue4/options.c rogue4/pack.c rogue4/passages.c rogue4/potions.c rogue4/prob.c rogue4/rings.c rogue4/rip.c rogue4/rogue.6 rogue4/rogue.h rogue4/rogue.me rogue4/rogue52.sln rogue4/rogue52.vcproj rogue4/rooms.c rogue4/save.c rogue4/scrolls.c rogue4/state.c rogue4/sticks.c rogue4/things.c rogue4/vers.c rogue4/weapons.c rogue4/wizard.c rogue4/xcrypt.c rogue4/xstr.c |
diffstat | 44 files changed, 16770 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rogue4/LICENSE.TXT Sat Oct 24 16:52:52 2009 +0000 @@ -0,0 +1,92 @@ +Rogue: Exploring the Dungeons of Doom +Copyright (C) 1980, 1981, 1982 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) 1999, 2000, 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/rogue4/Makefile Sat Oct 24 16:52:52 2009 +0000 @@ -0,0 +1,147 @@ +# +# Makefile for rogue +# @(#)Makefile 4.13 (Berkeley) 1/23/82 +# +# Rogue: Exploring the Dungeons of Doom +# Copyright (C) 1980, 1981, 1982 Michael Toy, Ken Arnold and Glenn Wichman +# All rights reserved. +# +# See the file LICENSE.TXT for full copyright and licensing information. +# + +DISTNAME=rogue5.2.2 + +HDRS= rogue.h extern.h +DOBJS= vers.o extern.o armor.o chase.o command.o daemon.o daemons.o \ + fight.o init.o io.o list.o main.o misc.o monsters.o move.o \ + new_level.o options.o 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 mdport.o +OBJS= $(DOBJS) mach_dep.o +CFILES= vers.c extern.c armor.c chase.c command.c daemon.c daemons.c \ + fight.c init.c io.c list.c main.c misc.c monsters.c move.c \ + new_level.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 \ + mach_dep.c xcrypt.c mdport.c +MISC= Makefile LICENSE.TXT rogue.6 rogue.me + +CC = gcc +CFLAGS= -O3 +CRLIB = -lcurses +RM = rm -f +TAR = tar + +SCOREFILE= +SF=-DSCOREFILE=\"rogue52.scr\" -DLOCKFILE=\"rogue52.lck\" +NAMELIST= +NL= +#MACHDEP= -DMAXLOAD=40 -DLOADAV -DCHECKTIME=4 +MACHDEP= + +.c.o: + @echo $(CC) -c $(CFLAGS) $*.c + @$(CC) -c $(CFLAGS) $*.c -o $*.o +# @cpp -P $(CFLAGS) $*.c | ./xstr -v -c - +# @cc -c $(CFLAGS) x.c +# @mv x.o $*.o + +rogue: $(HDRS) $(OBJS) # xs.o +# @rm -f x.c +# $(CC) $(LDFLAGS) xs.o $(OBJS) $(CRLIB) + $(CC) $(LDFLAGS) $(OBJS) $(CRLIB) -o $@ + +vers.o: + $(CC) -c $(CFLAGS) vers.c + +mach_dep.o: mach_dep.c + $(CC) -c $(CFLAGS) $(SF) $(NL) $(MACHDEP) mach_dep.c + +xs.o: strings + ./xstr + $(CC) -c $(CFLAGS) xs.c + +xstr: xstr.c + $(CC) -s -O -o xstr xstr.c + +findpw: findpw.c xcrypt.c + $(CC) -s -o findpw findpw.c xcrypt.c + +prob: prob.o extern.o xs.o + $(CC) -O -o prob prob.o extern.o xs.o + +prob.o: prob.c rogue.h + $(CC) -O -c prob.c + +clean: + rm -f $(POBJS) $(OBJS) core a.out p.out rogue strings make.out rogue.tar vgrind.* x.c x.o xs.c xs.o linterrs findpw distmod.o xs.po xstr rogue rogue.exe rogue.tar.gz rogue.cat rogue.doc xstr.exe + +dist.src: + make clean + tar cf $(DISTNAME)-src.tar $(CFILES) $(HDRS) $(MISC) + gzip -f $(DISTNAME)-src.tar + +debug.irix: + make clean + make CC=cc CFLAGS="-woff 1116 -g -DWIZARD" rogue +dist.irix: + make clean + make CC=cc CFLAGS="-woff 1116 -O3" rogue + tbl rogue.me | nroff -me | colcrt - > rogue.doc + nroff -man rogue.6 | colcrt - > rogue.cat + tar cf $(DISTNAME)-irix.tar rogue LICENSE.TXT rogue.cat rogue.doc + gzip -f $(DISTNAME)-irix.tar + +debug.aix: + make clean + make CC=xlc CFLAGS="-qmaxmem=16768 -g -qstrict -DWIZARD" rogue +dist.aix: + make clean + make CC=xlc CFLAGS="-qmaxmem=16768 -O3 -qstrict" rogue + tbl rogue.me | nroff -me | colcrt - > rogue.doc + nroff -man rogue.6 | colcrt - > rogue.cat + tar cf $(DISTNAME)-aix.tar rogue LICENSE.TXT rogue.cat rogue.doc + gzip -f $(DISTNAME)-aix.tar + +debug.linux: + make clean + make CFLAGS="-g3 -DWIZARD" rogue +dist.linux: + make clean + make rogue + groff -P-c -t -me -Tascii rogue.me | sed -e 's/.\x08//g' > rogue.doc + groff -man rogue.6 | sed -e 's/.\x08//g' > rogue.cat + tar cf $(DISTNAME)-linux.tar rogue LICENSE.TXT rogue.cat rogue.doc + gzip -f $(DISTNAME)-linux.tar + +debug.interix: + make clean + make CFLAGS="-g3 -DWIZARD" rogue +dist.interix: + make clean + make rogue + groff -P-b -P-u -t -me -Tascii rogue.me > rogue.doc + groff -P-b -P-u -man -Tascii rogue.6 > rogue.cat + tar cf $(DISTNAME)-interix.tar rogue LICENSE.TXT rogue.cat rogue.doc + gzip -f $(DISTNAME)-interix.tar + +debug.cygwin: + make clean + make CFLAGS="-g3 -DWIZARD" rogue +dist.cygwin: + make clean + make rogue + groff -P-c -t -me -Tascii rogue.me | sed -e 's/.\x08//g' > rogue.doc + groff -P-c -man -Tascii rogue.6 | sed -e 's/.\x08//g' > rogue.cat + tar cf $(DISTNAME)-cygwin.tar rogue.exe LICENSE.TXT rogue.cat rogue.doc + gzip -f $(DISTNAME)-cygwin.tar + +debug.djgpp: + make clean + make CFLAGS="-g3 -DWIZARD" LDFLAGS="-L$(DJDIR)/LIB" CRLIB="-lpdcurses" rogue +dist.djgpp: + make clean + make CFLAGS="-O3" LDFLAGS="-L$(DJDIR)/LIB" CRLIB="-lpdcurses" rogue + groff -t -me -Tascii rogue.me | sed -e 's/.\x08//g' > rogue.doc + groff -man -Tascii rogue.6 | sed -e 's/.\x08//g' > rogue.cat + rm -f $(DISTNAME)-djgpp.zip + zip $(DISTNAME)-djgpp.zip rogue.exe LICENSE.TXT rogue.cat rogue.doc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rogue4/armor.c Sat Oct 24 16:52:52 2009 +0000 @@ -0,0 +1,86 @@ +/* + * This file contains misc functions for dealing with armor + * @(#)armor.c 4.8 (Berkeley) 4/6/82 + * + * Rogue: Exploring the Dungeons of Doom + * Copyright (C) 1980, 1981, 1982 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. + */ +wear() +{ + register THING *obj; + register char *sp; + + 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 ((obj = get_item("wear", ARMOR)) == NULL) + return; + if (obj->o_type != ARMOR) + { + msg("you can't wear that"); + return; + } + waste_time(); + obj->o_flags |= ISKNOW; + sp = inv_name(obj, TRUE); + cur_armor = obj; + if (!terse) + addmsg("you are now "); + msg("wearing %s", sp); +} + +/* + * take_off: + * Get the armor off of the players back + */ +take_off() +{ + register THING *obj; + + if ((obj = cur_armor) == NULL) + { + after = FALSE; + 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 + */ +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/rogue4/chase.c Sat Oct 24 16:52:52 2009 +0000 @@ -0,0 +1,424 @@ +/* + * Code for one creature to chase another + * + * @(#)chase.c 4.25 (Berkeley) 5/5/82 + * + * Rogue: Exploring the Dungeons of Doom + * Copyright (C) 1980, 1981, 1982 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" + +#define DRAGONSHOT 5 /* one chance in DRAGONSHOT that a dragon will flame */ + +coord ch_ret; /* Where chasing takes you */ + +/* + * runners: + * Make all the running monsters move. + */ +runners() +{ + register THING *tp; + register THING *ntp; + + for (tp = mlist; tp != NULL; tp = ntp) + { + ntp = next(tp); + if (!on(*tp, ISHELD) && on(*tp, ISRUN)) + { + if (!on(*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. + */ +do_chase(th) +register THING *th; +{ + register struct room *rer, *ree; /* room of chaser, room of chasee */ + register int mindist = 32767, i, dist; + register bool stoprun = FALSE; /* TRUE means we are there */ + register char sch; + register bool door; + register THING *obj; + register struct room *oroom; + coord this; /* Temporary destination for chaser */ + + rer = th->t_room; /* Find room of chaser */ + if (on(*th, ISGREED) && rer->r_goldval == 0) + th->t_dest = &hero; /* If gold has been taken, run after hero */ + if (th->t_dest == &hero) /* Find room of chasee */ + ree = proom; + else + ree = roomin(th->t_dest); + /* + * We don't count doors as inside rooms for this routine + */ + door = (chat(th->t_pos.y, th->t_pos.x) == DOOR); + /* + * If the object of our desire is in a different room, + * and we are not in a corridor, run to the door nearest to + * our goal. + */ +over: + if (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) + { + this = rer->r_exit[i]; + mindist = dist; + } + } + if (door) + { + rer = &passages[flat(th->t_pos.y, th->t_pos.x) & F_PNUM]; + door = FALSE; + goto over; + } + } + else + { + this = *th->t_dest; + /* + * For dragons check and see if (a) the hero is on a straight + * line from it, and (b) that it is within shooting distance, + * but outside of striking range. + */ + if (th->t_type == 'D' && (th->t_pos.y == hero.y || th->t_pos.x == hero.x + || abs(th->t_pos.y - hero.y) == abs(th->t_pos.x - hero.x)) + && DISTANCE(th->t_pos.y, th->t_pos.x, hero.y, hero.x) <= BOLT_LENGTH * BOLT_LENGTH + && !on(*th, ISCANC) && rnd(DRAGONSHOT) == 0) + { + delta.y = sign(hero.y - th->t_pos.y); + delta.x = sign(hero.x - th->t_pos.x); + fire_bolt(&th->t_pos, &delta, "flame"); + running = FALSE;