billr@saab.CNA.TEK.COM (Bill Randle) (02/20/91)
Submitted-by: jcg@tree.uucp (Chris Gonnerman) Posting-number: Volume 12, Issue 41 Archive-name: mdg/Part05 Environment: System V, SunOS 4.1, curses #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 5 (of 6)." # Contents: Makefile clock.c defstruct.h dmain.c findplayer.c gident.c # help.c ident.c improve.c loadconfig.c mdg_dir/NoCopyright # mdg_dir/item.start mdg_dir/monster.start messages.h monsters.c # plrstruct.h ranged.c setup.h speak.c # Wrapped by billr@saab on Tue Feb 19 14:49:46 1991 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'Makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Makefile'\" else echo shar: Extracting \"'Makefile'\" \(1223 characters\) sed "s/^X//" >'Makefile' <<'END_OF_FILE' X# MDG Multiuser Dungeon Game -- Makefile X X# @(#) MDG, Copyright 1990 John C. Gonnerman X# This program is subject to the general MDG X# copyright statement (see enclosed file, Copyright). X XSHELL = /bin/sh X XCFLAGS = -g X XDOBJSA = dmain.o seg.o monsters.o msghandler.o findplayer.o godpower.o XDOBJSB = players.o random.o combat.o effect.o ranged.o speak.o dmsg.o XDOBJSC = spells.o improve.o dident.o magic.o traps.o loadconfig.o X XGOBJSA = gmain.o gident.o show.o spells.o XGOBJSB = input.o help.o loadconfig.o dayclock.o X XSOBJS = stopdaemon.o loadconfig.o strstr.o X XCOBJS = clock.o loadconfig.o X XEOBJS = cmain.o dident.o gident.o spells.o random.o X XIOBJS = ident.o strstr.o X XPROGS = mdg_daemon mdg mdg_stop mdg_save ident mdg_char mdg_clock X Xall : $(PROGS) X Xmdg_daemon : $(DOBJSA) $(DOBJSB) $(DOBJSC) X cc $(CFLAGS) -o mdg_daemon $(DOBJSA) $(DOBJSB) $(DOBJSC) X Xmdg : $(GOBJSA) $(GOBJSB) X cc $(CFLAGS) -o mdg $(GOBJSA) $(GOBJSB) -ltinfo X Xmdg_clock : $(COBJS) X cc $(CFLAGS) -o mdg_clock $(COBJS) X Xmdg_save : mdg_stop X ln mdg_stop mdg_save X Xmdg_stop : $(SOBJS) X cc $(CFLAGS) -o mdg_stop $(SOBJS) X Xmdg_char : $(EOBJS) X cc $(CFLAGS) -o mdg_char $(EOBJS) -ltinfo X Xident : $(IOBJS) X cc $(CFLAGS) -o ident $(IOBJS) X X# end of Makefile. END_OF_FILE if test 1223 -ne `wc -c <'Makefile'`; then echo shar: \"'Makefile'\" unpacked with wrong size! fi # end of 'Makefile' fi if test -f 'clock.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'clock.c'\" else echo shar: Extracting \"'clock.c'\" \(1483 characters\) sed "s/^X//" >'clock.c' <<'END_OF_FILE' X/* X MDG Multiuser Dungeon Game -- clock task X X MDG is Copyright 1990 John C. Gonnerman X This program is subject to the general MDG X copyright statement (see enclosed file, Copyright). X*/ X Xstatic char *sccsx = "@(#) MDG_CLOCK Copyright 1990 John C. Gonnerman"; Xstatic char *sccsvers = "@(#) clock.c\t(1.2)\tcreated 1/2/91"; X X#include <stdio.h> X#include <string.h> X#include <signal.h> X#include <sys/types.h> X#include <sys/ipc.h> X#include <sys/msg.h> X X#include "setup.h" X#include "files.h" X#include "struct.h" X#include "messages.h" X Xextern long dmsgkey, gsemkey, mapkey, playerkey; X Xchar *progname; Xint dqid; X Xextern int errno; Xextern char *sys_errlist[]; X X Xmain(argc, argv) Xint argc; Xchar **argv; X{ X struct dmessage msg_buf; X char *strrchr(), *strstr(); X int mode; X X if((progname = strrchr(argv[0], '/')) == NULL) X progname = argv[0]; X else X progname++; X X fputs("clock started.\n", stderr); X X if(argc != 1) { X fprintf(stderr, ARGCOUNT, progname, argc); X exit(1); X } X X chdir(GAME_HOME); X X /* load keys from config file */ X X loadconfig(); X X /* set signal handlers */ X X signal(SIGHUP, exit); X signal(SIGTERM, exit); X X /* open message queue */ X X if((dqid = msgget(dmsgkey, 0)) == -1) { X fprintf(stderr, CANTERR, progname, "open queue", X sys_errlist[errno]); X exit(1); X } X X /* actual monster packet driver */ X X while(1) { X sleep(1); X X msg_buf.msg_type = 1L; X msg_buf.cmd = ' '; X msg_buf.playernum = -1; X msgsnd(dqid, &msg_buf, DMSGSIZ, IPC_NOWAIT); X } X} X X X/* end of file */ END_OF_FILE if test 1483 -ne `wc -c <'clock.c'`; then echo shar: \"'clock.c'\" unpacked with wrong size! fi # end of 'clock.c' fi if test -f 'defstruct.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'defstruct.h'\" else echo shar: Extracting \"'defstruct.h'\" \(1090 characters\) sed "s/^X//" >'defstruct.h' <<'END_OF_FILE' X/* X MDG Multiuser Dungeon Game -- master structure include file X X MDG is Copyright 1990 John C. Gonnerman X This file is subject to the general MDG X copyright statement (see enclosed file, Copyright). X X SCCSID @(#) defstruct.h (1.2) created 1/2/91 X*/ X X X/* item type/code values. */ X X#define POTION '!' X#define SCROLL '?' X#define ARMOR ']' X#define SHIELD '[' X#define WEAPON ')' X#define MISSILE '(' X#define OBJECT '/' X#define NOTE '"' X#define CASH '$' X#define CRYSTAL '*' X#define HIDDEN '_' X X#define INAMELEN 20 X X#define MAX_PLAYERS 9 X X#define PNAMELEN 20 X#define PMAX_ITEMS 7 X X#define AL_GOOD 1 X#define AL_EVIL 0 X X X#define L_NORTH 0 X#define L_SOUTH 1 X#define L_EAST 2 X#define L_WEST 3 X#define L_UP 4 X#define L_DOWN 5 X X#define L_GATE 6 X X#define L_NEAST 7 X#define L_NWEST 8 X#define L_SEAST 9 X#define L_SWEST 10 X X X/* flags for new vs. old items */ X#define ITEM_OLD 0 X#define ITEM_NEW 1 X X X/* define pseudo-locations. */ X#define LOC_HOME (-1) X#define LOC_PLAYER (-2) X#define LOC_NONESUCH (-3) X#define LOC_TRADER (-4) X#define LOC_PIT (-5) X X X#define MNAMELEN 20 X X X/* end of file. */ END_OF_FILE if test 1090 -ne `wc -c <'defstruct.h'`; then echo shar: \"'defstruct.h'\" unpacked with wrong size! fi # end of 'defstruct.h' fi if test -f 'dmain.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'dmain.c'\" else echo shar: Extracting \"'dmain.c'\" \(4978 characters\) sed "s/^X//" >'dmain.c' <<'END_OF_FILE' X/* X MDG Multiuser Dungeon Game -- mdg_daemon X X MDG is Copyright 1990 John C. Gonnerman X This program is subject to the general MDG X copyright statement (see enclosed file, Copyright). X*/ X Xstatic char *sccsx = "@(#) MDG_DAEMON Copyright 1990 John C. Gonnerman"; Xstatic char *sccsvers = "@(#) dmain.c\t(1.5)\tcreated 1/4/91"; X X#include <stdio.h> X#include <fcntl.h> X#include <signal.h> X#include <sys/types.h> X#include <sys/stat.h> X#include <sys/ipc.h> X#include <sys/msg.h> X#include <sys/sem.h> X#include "setup.h" X#include "files.h" X#include "struct.h" X#include "messages.h" X Xchar *progname; Xint dqid, pid; Xtime_t mark_time; Xlong max_mps, msg_count; X X/* flag for debugging */ Xint in_msgrcv; X XFILE *saveopen(); X Xextern long dmsgkey, gsemkey, mapkey, playerkey; X Xextern struct player_seg *pseg; Xextern struct map_seg *mseg; X Xextern int errno; Xextern char *sys_errlist[]; X X Xmain(argc, argv) Xint argc; Xchar **argv; X{ X int i, rc, xx, dfd, tmp; X FILE *gfp; X void shutdown(); X struct dmessage msg_buf; X struct msqid_ds qbuf; X X progname = argv[0]; X X /* arrange for file creation to be limited. */ X X umask(0007); X X if(argc != 1) { X fprintf(stderr, ARGCOUNT, progname, argc); X exit(1); X } X X fputs(DTITLE, stderr); X fputs(DCOPYRIGHT, stderr); X fputs(LOADMSG, stderr); X X if(chdir(GAME_HOME) == -1) { X fprintf(stderr, CANTERR, progname, "chdir()", X sys_errlist[errno]); X exit(1); X } X X if((tmp = creat(LOCKFILE, 0)) == -1) { X fprintf(stderr, "%s: daemon lock found, aborting...\n", X progname); X exit(99); X } X X close(tmp); X X if((dfd = open(ERRLOGFILE, O_WRONLY|O_CREAT|O_TRUNC, 0660)) == -1) { X fprintf(stderr, CANTERR, progname, "open error log", X sys_errlist[errno]); X exit(1); X } X X close(2); X dup(dfd); X close(dfd); X X setbuf(stderr, NULL); X X close(0); X close(1); X X fputs(LOADMSG, stderr); X X if((rc = fork()) == -1) { X fprintf(stderr, CANTERR, progname, "fork()", X sys_errlist[errno]); X exit(1); X } X X if(rc != 0) X exit(0); X X setpgrp(); X X /* load keys from config file */ X X loadconfig(); X X /* load the player segment */ X X if((gfp = saveopen(ITEMS, "r")) == NULL) { X fprintf(stderr, CANTERR, progname, "open item file", X sys_errlist[errno]); X exit(1); X } X X load_pseg(gfp); X fclose(gfp); X X /* load the monster table */ X X if((gfp = saveopen(MONSTERS, "r")) == NULL) { X fprintf(stderr, CANTERR, progname, "open monster file", X sys_errlist[errno]); X exit(1); X } X X load_monsters(gfp); X fclose(gfp); X X /* load the notes table */ X X if((gfp = saveopen(NOTES, "r")) == NULL) { X fprintf(stderr, CANTERR, progname, "open note file", X sys_errlist[errno]); X exit(1); X } X X load_notes(gfp); X fclose(gfp); X X /* load the map segment */ X X if((gfp = saveopen(MAP, "r")) == NULL) { X fprintf(stderr, CANTERR, progname, "open map file", X sys_errlist[errno]); X exit(1); X } X X load_mseg(gfp); X fclose(gfp); X X /* initialize ranged table */ X X init_ranged(); X X /* attach the segments. */ X X seg_attach(); X X /* create message queues (if needed) and open them */ X X if((dqid = msgget(dmsgkey, IPC_CREAT | 0777)) == -1) { X fprintf(stderr, CANTERR, progname, "open daemon queue", X sys_errlist[errno]); X exit(1); X } X X msgctl(dqid, IPC_STAT, &qbuf); X qbuf.msg_qbytes = DQSIZ; X msgctl(dqid, IPC_SET, &qbuf); X X if((pseg->sid = semget(gsemkey, MAX_PLAYERS, IPC_CREAT|0777)) == -1) { X fprintf(stderr, CANTERR, progname, "open game semset", X sys_errlist[errno]); X exit(1); X } X X /* ready to run, so set signal traps */ X X signal(SIGTERM, shutdown); X signal(SIGHUP, shutdown); X X /* lower our priority ... */ X X nice(NICEVAL); X X /* ... start the monster packet driver ... */ X X if((pid = fork()) == 0) { X if(execl(CLOCKTASK, CLOCKTASK, (char *)0) == -1) { X fprintf(stderr, CANTERR, progname, "execl()", X sys_errlist[errno]); X exit(1); X } X } else if(pid == -1) { X fprintf(stderr, CANTERR, progname, "fork()", X sys_errlist[errno]); X exit(1); X } X X /* ... seed the random number generator ... */ X X random(); X X /* ... and place the stuff. */ X X place_items(); X place_monsters(); X X /* we got it, let's do it! */ X X mark_time = time(NULL); X max_mps = 0; X msg_count = 0; X X while(1) { X in_msgrcv = 1; X X if((xx = msgrcv(dqid, &msg_buf, DMSGSIZ, 0L, 0)) == DMSGSIZ) { X msg_count++; X msg_handler(msg_buf); X } X X in_msgrcv = 0; X X if(mark_time != time(NULL)) { X if(msg_count > max_mps) X max_mps = msg_count; X msg_count = 0; X mark_time = time(NULL); X } X } X} X X Xint rename(oldname, newname) Xchar *oldname, *newname; X{ X unlink(newname); X X if(link(oldname, newname) != -1) X return unlink(oldname); X else X return -1; X} X X XFILE *saveopen(file, mode) Xchar *file, *mode; X{ X FILE *fp; X char savefile[128], altfile[128]; X X strcpy(savefile, file); X strcat(savefile, SAVEEXT); X X strcpy(altfile, file); X X if(mode[0] == 'r') { X strcat(altfile, STARTEXT); X X if((fp = fopen(savefile, "r")) == NULL) X return fopen(altfile, "r"); X else X return fp; X } else if(mode[0] == 'w') { X strcat(altfile, OLDEXT); X rename(savefile, altfile); X X return fopen(savefile, "w"); X } X} X X X/* end of file */ END_OF_FILE if test 4978 -ne `wc -c <'dmain.c'`; then echo shar: \"'dmain.c'\" unpacked with wrong size! fi # end of 'dmain.c' fi if test -f 'findplayer.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'findplayer.c'\" else echo shar: Extracting \"'findplayer.c'\" \(972 characters\) sed "s/^X//" >'findplayer.c' <<'END_OF_FILE' X/* X MDG Multiuser Dungeon Game -- findplayer.c player table code X X MDG is Copyright 1990 John C. Gonnerman X This program is subject to the general MDG X copyright statement (see enclosed file, Copyright). X*/ X Xstatic char *sccsvers = "@(#) findplayer.c\t(1.2)\tcreated 12/30/90"; X X#include "setup.h" X#include "struct.h" X Xextern struct player_seg *pseg; X Xint next_indx = 0; X X Xint find_player(pnum) Xint pnum; X{ X int p_indx; X X if(pnum < 0) X return -1; X X for(p_indx = 0; p_indx < MAX_PLAYERS; p_indx++) X if(pseg->p[p_indx].playernum == pnum) X break; X X if(p_indx >= MAX_PLAYERS) X return -1; X X return p_indx; X} X X Xint getfree() X{ X int p_indx, tmp; X X for(p_indx = 0; p_indx < MAX_PLAYERS; p_indx++) { X tmp = act_indx(p_indx + next_indx); X X if(pseg->p[tmp].playernum == -1) { X next_indx = act_indx(next_indx + 1); X return tmp; X } X } X X return -1; X} X X Xint act_indx(indx) Xint indx; X{ X if(indx >= MAX_PLAYERS) X indx -= MAX_PLAYERS; X X return indx; X} X X X/* end of file. */ END_OF_FILE if test 972 -ne `wc -c <'findplayer.c'`; then echo shar: \"'findplayer.c'\" unpacked with wrong size! fi # end of 'findplayer.c' fi if test -f 'gident.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'gident.c'\" else echo shar: Extracting \"'gident.c'\" \(877 characters\) sed "s/^X//" >'gident.c' <<'END_OF_FILE' X/* X MDG Multiuser Dungeon Game -- gident.c user ident X X MDG is Copyright 1990 John C. Gonnerman X This program is subject to the general MDG X copyright statement (see enclosed file, Copyright). X*/ X X Xstatic char *sccsvers = "@(#) gident.c\t(1.2)\tcreated 12/31/90"; X X#include <stdio.h> X#include <string.h> X X#include "setup.h" X#include "files.h" X#include "messages.h" X Xextern char *progname; X Xextern int errno; Xextern char *sys_errlist[]; X X Xint get_player(pname) Xchar *pname; X{ X char inbuf[80], prog[80], *p; X FILE *fp; X int num; X X pname[0] = '\0'; X X strcpy(prog, GAME_HOME); X strcat(prog, "/"); X strcat(prog, IDENTPROG); X X if((fp = popen(prog, "r")) == NULL) X return -1; X X fgets(inbuf, 80, fp); X fgets(pname, 19, fp); X X pclose(fp); X X for(p = pname; *p; p++) X if(*p == '\n') X *p = '\0'; X X if(sscanf(inbuf, "%d", &num) != 1) X return -1; X X return num; X} X X X/* end of file. */ END_OF_FILE if test 877 -ne `wc -c <'gident.c'`; then echo shar: \"'gident.c'\" unpacked with wrong size! fi # end of 'gident.c' fi if test -f 'help.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'help.c'\" else echo shar: Extracting \"'help.c'\" \(2307 characters\) sed "s/^X//" >'help.c' <<'END_OF_FILE' X/* X MDG Multiuser Dungeon Game -- help.c help driver X X MDG is Copyright 1990 John C. Gonnerman X This program is subject to the general MDG X copyright statement (see enclosed file, Copyright). X*/ X Xstatic char *sccsvers = "@(#) help.c\t\t(1.1)\tcreated 12/25/90"; X X#include <curses.h> X#include <fcntl.h> X#include <signal.h> X#include <string.h> X#include <ctype.h> X X#include <sys/types.h> X#include <sys/stat.h> X X#include "setup.h" X#include "struct.h" X#include "messages.h" X#include "effect.h" X#include "help.h" X Xstruct player_seg *pseg; Xstruct map_seg *mseg; X Xextern char *spell_names[]; X Xint dqid, playernum, player_indx; X Xstruct game_msg *gseg; X X Xhelp() X{ X int sector; X X X if((sector = pseg->p[player_indx].loc.sector) >= 0 X && pseg->p[player_indx].light == 0 X && mseg->m[sector].light == 0) { X strcpy(gseg->buf, DARKMSG); X tell_viewer(); X return; X } X X X switch(pseg->p[player_indx].loc.under) { X case '>' : X case '<' : X strcpy(gseg->buf, STAIRMSG); X tell_viewer(); X return; X X case POTION : X sprintf(gseg->buf, ITEMMSG, "potion"); X tell_viewer(); X return; X X case SCROLL : X sprintf(gseg->buf, ITEMMSG, "scroll"); X tell_viewer(); X return; X X case ARMOR : X sprintf(gseg->buf, ITEMMSG, "armor"); X tell_viewer(); X return; X X case SHIELD : X sprintf(gseg->buf, ITEMMSG, "shield"); X tell_viewer(); X return; X X case WEAPON : X sprintf(gseg->buf, ITEMMSG, "weapon"); X tell_viewer(); X return; X X case MISSILE : X sprintf(gseg->buf, ITEMMSG, "missile weapon"); X tell_viewer(); X return; X X case OBJECT : X sprintf(gseg->buf, ITEMMSG, "item"); X tell_viewer(); X return; X X case CRYSTAL : X sprintf(gseg->buf, ITEMMSG, "crystal"); X tell_viewer(); X return; X X case CASH : X sprintf(gseg->buf, ITEMMSG, "treasure"); X tell_viewer(); X return; X X case NOTE : X sprintf(gseg->buf, ITEMMSG, "note"); X tell_viewer(); X return; X X case HIDDEN : X sprintf(gseg->buf, ITEMMSG, "hidden item"); X tell_viewer(); X return; X } X X /* default */ X X strcpy(gseg->buf, HELPMSG); X tell_viewer(); X} X X Xtelltime() X{ X switch(timeofday()) { X case 0 : X strcpy(gseg->buf, "It is now NIGHT."); X break; X case 1 : X strcpy(gseg->buf, "It is now MORNING."); X break; X case 2 : X strcpy(gseg->buf, "It is now AFTERNOON."); X break; X case 3 : X strcpy(gseg->buf, "It is now EVENING."); X break; X } X X tell_viewer(); X} X X X/* end of file. */ END_OF_FILE if test 2307 -ne `wc -c <'help.c'`; then echo shar: \"'help.c'\" unpacked with wrong size! fi # end of 'help.c' fi if test -f 'ident.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ident.c'\" else echo shar: Extracting \"'ident.c'\" \(832 characters\) sed "s/^X//" >'ident.c' <<'END_OF_FILE' X/* X MDG Multiuser Dungeon Game -- ident X X MDG is Copyright 1990 John C. Gonnerman X This program is subject to the general MDG X copyright statement (see enclosed file, Copyright). X*/ X X Xstatic char *sccsvers = "@(#) ident.c\t(1.1)\tcreated 12/25/90"; X X#include <stdio.h> X#include <pwd.h> X#include <string.h> X X#include "messages.h" X X#define USAGE "Usage: ident [ uid-num ]\n" X Xchar *progname; X Xextern char *sys_errlist[]; Xextern int errno; X X Xmain(argc, argv) Xint argc; Xchar *argv[]; X{ X int num; X struct passwd *ps; X X X if((progname = strrchr(argv[0], '/')) != NULL) X progname++; X else X progname = argv[0]; X X num = getuid(); X X if(argc == 2) X num = atoi(argv[1]); X X if((ps = getpwuid(num)) == NULL) { X puts("-1"); X exit(1); X } X X endpwent(); X X printf("%d\n", num); X printf("%s\n", ps->pw_gecos); X X exit(0); X} X X X/* end of file. */ END_OF_FILE if test 832 -ne `wc -c <'ident.c'`; then echo shar: \"'ident.c'\" unpacked with wrong size! fi # end of 'ident.c' fi if test -f 'improve.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'improve.c'\" else echo shar: Extracting \"'improve.c'\" \(1387 characters\) sed "s/^X//" >'improve.c' <<'END_OF_FILE' X/* X MDG Multiuser Dungeon Game -- improve.c experience system X X MDG is Copyright 1990 John C. Gonnerman X This program is subject to the general MDG X copyright statement (see enclosed file, Copyright). X*/ X Xstatic char *sccsvers = "@(#) improve.c\t(1.1)\tcreated 12/25/90"; X X X#include <stdio.h> X X#include "setup.h" X#include "struct.h" X Xextern struct player_seg *pseg; X X Ximprove_f(p_indx, chance) Xint p_indx, chance; X{ X int rc, i_chance; X X rc = rnd(200); X X i_chance = 100 - chance; X X if(rc < i_chance) X pseg->p[p_indx].fighting++; X} X X Ximprove_s(p_indx, spell) Xint p_indx, spell; X{ X int rc, inc; X X rc = rnd(100); X X if(pseg->p[p_indx].spells[spell] > 25) X inc = 1; X else if(pseg->p[p_indx].spells[spell] > 15) X inc = go2r(5); X else if(pseg->p[p_indx].spells[spell] > 10) X inc = go2r(10); X else if(pseg->p[p_indx].spells[spell] > 5) X inc = go2r(15); X else X inc = go2r(20); X X if(rc > pseg->p[p_indx].spells[spell]) X pseg->p[p_indx].spells[spell] += inc; X X if(pseg->p[p_indx].max_mp >= MAX_MPS) X return; X X rc = rnd(100); X X if(rc <= (MAX_MPS - pseg->p[p_indx].max_mp)) X pseg->p[p_indx].max_mp++; X} X X Ximprove_h(p_indx, danger) Xint p_indx, danger; X{ X int rc, odds; X X if(pseg->p[p_indx].max_hp >= MAX_HPS) X return; X X rc = rnd(150); X X odds = (MAX_HPS - pseg->p[p_indx].max_hp) / 2 + danger; X X if(odds < 5) X odds = 5; X X if(rc <= odds) X pseg->p[p_indx].max_hp++; X} X X X/* end of file. */ END_OF_FILE if test 1387 -ne `wc -c <'improve.c'`; then echo shar: \"'improve.c'\" unpacked with wrong size! fi # end of 'improve.c' fi if test -f 'loadconfig.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'loadconfig.c'\" else echo shar: Extracting \"'loadconfig.c'\" \(979 characters\) sed "s/^X//" >'loadconfig.c' <<'END_OF_FILE' X/* X MDG Multiuser Dungeon Game -- loadconfig.c reads keys X X MDG is Copyright 1990 John C. Gonnerman X This program is subject to the general MDG X copyright statement (see enclosed file, Copyright). X*/ X Xstatic char *sccsvers = "@(#) loadconfig.c\t(1.2)\tcreated 1/2/91"; X X#include <stdio.h> X#include <sys/types.h> X#include <sys/ipc.h> X#include <sys/shm.h> X#include <sys/msg.h> X X#include "config.h" X#include "files.h" X Xextern char *progname; X Xextern int errno; Xextern char *sys_errlist[]; X Xlong dmsgkey, gsemkey, mapkey, playerkey; X X Xloadconfig() X{ X FILE *fp; X char inbuf[40]; X X dmsgkey = DMSGKEY; X gsemkey = GSEMKEY; X mapkey = MAPKEY; X playerkey = PLAYERKEY; X X if((fp = fopen(CONFIGFILE, "r")) == NULL) X return; X X fgets(inbuf, 40, fp); X sscanf(inbuf, "%ld", &dmsgkey); X X fgets(inbuf, 40, fp); X sscanf(inbuf, "%ld", &gsemkey); X X fgets(inbuf, 40, fp); X sscanf(inbuf, "%ld", &playerkey); X X fgets(inbuf, 40, fp); X sscanf(inbuf, "%ld", &mapkey); X X fclose(fp); X} X X X/* end of file. */ END_OF_FILE if test 979 -ne `wc -c <'loadconfig.c'`; then echo shar: \"'loadconfig.c'\" unpacked with wrong size! fi # end of 'loadconfig.c' fi if test -f 'mdg_dir/NoCopyright' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'mdg_dir/NoCopyright'\" else echo shar: Extracting \"'mdg_dir/NoCopyright'\" \(1337 characters\) sed "s/^X//" >'mdg_dir/NoCopyright' <<'END_OF_FILE' X XThe contents of this directory, mdg_dir, are distributed with the MDG Xpackage gratis. They are not considered copyrighted, protected, or in Xany other way sacred. The game save files here are suitable for getting Xyour own local game of MDG up and running, but you are encouraged to Xmodify to your heart's content, or create your own map, items, etc. X XThe map and items table contain a great many items created by the Xplaytesters. Five playtesters created large, noteworthy areas: X X The uppermost levels of the Overlord's Fortress, X by Turk (turk) X X Sexual Chocolate's Shrine, where the God Powers X were first (ab)used operationally, by Sexual X Chocolate (guest user, no outside access) X X Dammertemple, by Dammerschlaf (locke) X X The Basement Vault (and associated sectors) and X the Underwater Cave (and associated sectors), X by Warrior Jon (dawnt) X X The Chain, by Foxx (foxx) X XMost of the remainder of the map was created by the game designer, XSolomoriah (jcg). X XNames in parentheses are userid's here on Tree... E-mail to Tree from XInternet using this address: X X csusac.ecs.csus.edu!tree!"userid" X Xsuch as: X X csusac.ecs.csus.edu!tree!turk X Xfor instance. We are out in the wilds of UUCP, so mail via csusac is Xthe most "reliable" way to reach us. X XMail via UUCP thru ucbvax: X X ucbvax!ucdavis!csusac!tree!"userid" X XHave fun. X END_OF_FILE if test 1337 -ne `wc -c <'mdg_dir/NoCopyright'`; then echo shar: \"'mdg_dir/NoCopyright'\" unpacked with wrong size! fi # end of 'mdg_dir/NoCopyright' fi if test -f 'mdg_dir/item.start' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'mdg_dir/item.start'\" else echo shar: Extracting \"'mdg_dir/item.start'\" \(7812 characters\) sed "s/^X//" >'mdg_dir/item.start' <<'END_OF_FILE' X146 Xtreasure X[-3] 6, 5 <$$, 0, 0> 1:1 0 $600 (0) C0 Xtreasure X[-3] 24, 10 <$_, 0, 0> 1:1 582 $228 (0) C0 Xtreasure X[-3] 25, 5 <$$, 0, 0> 1:1 2080 $244 (0) C0 Xtreasure X[-3] 22, 9 <$$, 0, 0> 1:1 0 $478 (0) C0 Xtreasure X[-3] 0, 4 <$$, 0, 0> 1:1 0 $1887 (0) C0 Xtreasure X[-3] 0, 6 <$$, 0, 0> 1:1 0 $30 (0) C0 Xtreasure X[-3] 14, 5 <$$, 0, 0> 1:1 0 $658 (0) C0 Xtreasure X[-3] 28, 5 <$$, 0, 0> 1:1 0 $299 (0) C0 Xtreasure X[-3] 5, 5 <$$, 0, 0> 1:1 0 $1184 (0) C0 Xtreasure X[-3] 8, 6 <$$, 0, 0> 1:1 0 $520 (0) C0 Xtreasure X[-3] 12, 5 <$$, 0, 0> 1:1 0 $1 (0) C0 Xtreasure X[-3] 12, 6 <$$, 0, 0> 1:1 0 $1 (0) C0 Xtreasure X[-3] 12, 7 <$$, 0, 0> 1:1 0 $1 (0) C0 Xtreasure X[-3] 12, 8 <$$, 0, 0> 1:1 0 $1 (0) C0 Xtreasure X[-3] 12, 9 <$$, 0, 0> 1:1 0 $1 (0) C0 Xtreasure X[-3] 12, 10 <$$, 0, 0> 1:1 0 $1 (0) C0 Xtreasure X[-3] 22, 9 <$$, 0, 0> 1:1 0 $1 (0) C0 Xcrystal X[-3] 15, 1 <**, 1, 0> 1:1 0 $1 (0) C0 Xcrystal X[-3] 29, 1 <**, 1, 0> 1:1 0 $1 (0) C0 Xcrystal X[-3] 9, 11 <**, 1, 0> 1:1 0 $1 (0) C0 XMystic Slate X[-3] 873, 1 <"", 0, 0> 0:0 0 $1 (0) C0 XMystic Slate X[-3] 3, 1 <"", 0, 0> 0:0 0 $1 (0) C0 XScrap of Paper X[-3] 10, 5 <"", 1, 0> 0:0 0 $1 (0) C0 XScrap of Paper X[-3] 1, 10 <"", 2, 0> 0:0 0 $1 (0) C0 XScrap of Paper X[-3] 36, 8 <"", 3, 0> 0:0 0 $1 (0) C0 XScrap of Paper X[-3] 873, 1 <"", 4, 0> 0:0 0 $1 (0) C0 XSword of Fury X[-3] 4, 0 <)), 25, 0> 0:0 4507 $5000 (-1) C0 XSword of Doom X[-3] 2, 0 <)), 20, 0> 0:0 552 $3000 (-1) C0 XSword of Solomoriah X[-3] 75, 0 <)), 20, 0> 0:0 1453 $3000 (-1) C0 XDammeraxe X[-3] 8, 0 <)), 15, 0> 0:0 364 $1500 (0) C0 XSword of Fire X[-3] 753, 0 <)), 15, 0> 0:0 4209 $1500 (0) C0 XGrimclaw X[-3] 271, 0 <)), 15, 0> 0:0 180 $1500 (0) C0 XBattleaxe X[-3] 383, 0 <)), 12, 0> 0:0 1598 $300 (0) C0 XBattleaxe X[-3] 753, 0 <)), 12, 0> 0:0 4209 $300 (0) C0 XGod Sword X[-3] 2, 0 <)), 15, 0> 0:0 552 $1500 (0) C0 XSword X[-3] 4, 2 <)), 10, 0> 0:0 1178 $200 (0) C1 XSword X[-3] 383, 0 <)), 10, 0> 0:0 1598 $200 (0) C0 XSword X[-3] 23, 5 <)), 10, 0> 0:0 185 $200 (0) C0 XSword X[-3] 8, 1 <)), 10, 0> 0:0 4514 $200 (0) C0 XSword X[-3] 2, 0 <)), 10, 0> 0:0 552 $200 (0) C0 XSword X[-3] 956, 0 <)), 10, 0> 0:0 6131 $200 (0) C0 XSword X[-3] 873, 1 <)), 10, 0> 0:0 3375 $200 (0) C0 XSword X[-3] 1024, 1 <)), 10, 0> 0:0 4388 $200 (0) C0 XSword X[-3] 1024, 1 <)), 10, 0> 0:0 3061 $200 (0) C0 XSword X[-3] 1024, 1 <)), 10, 0> 0:0 4388 $200 (0) C0 XHand axe X[-3] 2, 0 <)), 8, 0> 0:0 0 $100 (0) C0 XHand axe X[-3] 1, 10 <)), 8, 0> 0:0 801 $100 (0) C0 XShortsword X[-3] 873, 1 <)), 8, 0> 0:0 3411 $50 (0) C0 XShortsword X[-3] 1024, 1 <)), 8, 0> 0:0 2930 $50 (0) C0 XShortsword X[-3] 873, 1 <)), 8, 0> 0:0 4491 $50 (0) C0 XClub X[-3] 1024, 0 <)), 7, 0> 0:0 0 $10 (0) C0 XDagger X[-3] 873, 1 <)), 5, 0> 0:0 5665 $15 (0) C0 XDagger X[-3] 8, 1 <)), 5, 0> 0:0 367 $15 (0) C0 XSilver Dagger X[-3] 956, 1 <)), 6, 0> 0:0 4650 $50 (0) C0 XThrowing Knife X[-3] 956, 1 <((, 6, 9> 1:1 4735 $10 (0) C0 XThrowing Knife X[-3] 8, 1 <((, 6, 9> 1:1 3460 $10 (0) C0 XThrowing Knife X[-3] 873, 1 <((, 6, 9> 1:1 3585 $10 (0) C0 XBoomerang X[-3] 5, 2 <((, 6, 9> 0:0 381 $40 (0) C0 XBoomerang X[-3] 8, 1 <((, 6, 9> 0:0 381 $40 (0) C0 XBlowgun X[-3] 7, 2 <((, 3, 6> 0:0 382 $10 (0) C0 XSling and Stones X[-3] 873, 1 <((, 6, 10> 20:20 4996 $10 (0) C0 XSling and Stones X[-3] 956, 1 <((, 6, 10> 20:20 3300 $10 (0) C0 XBow and Arrows X[-3] 36, 4 <((, 15, 12> 15:14 193 $100 (0) C0 XBow and Arrows X[-3] 22, 11 <((, 15, 12> 15:14 560 $100 (0) C0 XBow and Arrows X[-3] 36, 8 <((, 15, 12> 15:15 802 $100 (0) C0 XBow and Arrows X[-3] 8, 1 <((, 15, 12> 15:14 4859 $100 (0) C0 XBow and Arrows X[-3] 35, 5 <((, 15, 12> 15:15 193 $100 (0) C0 XBow and Arrows X[-3] 956, 1 <((, 15, 12> 15:15 3304 $100 (0) C0 XHide Shield X[-3] 2, 0 <[[, 1, 0> 0:0 552 $45 (0) C0 XHide Shield X[-3] 75, 0 <[[, 1, 0> 0:0 1453 $45 (0) C0 XHide Shield X[-3] 753, 0 <[[, 1, 0> 0:0 4209 $45 (0) C0 XFire Shield X[-3] 753, 0 <[[, 2, 0> 0:0 4209 $90 (0) C0 XDiamond Shield X[-3] 271, 0 <[[, 4, 0> 0:0 180 $300 (0) C0 XDarkshield X[-3] 8, 0 <[[, 3, 0> 0:0 364 $150 (0) C0 XThe Shiny Shield X[-3] 753, 0 <[[, 4, 0> 0:0 4209 $300 (0) C0 XShimmering Shield X[-3] 383, 0 <[[, 5, 0> 0:0 1598 $900 (0) C0 XLeather Armor X[-3] 0, 0 <]], 2, 0> 0:0 801 $30 (0) C0 XLeather Armor X[-3] 0, 0 <]], 2, 0> 0:0 3304 $30 (0) C0 XLeather Armor X[-3] 0, 0 <]], 2, 0> 0:0 121 $30 (0) C0 XRingmail X[-3] 0, 0 <]], 3, 0> 0:0 0 $80 (0) C0 XRingmail X[-3] 0, 0 <]], 3, 0> 0:0 4913 $80 (0) C0 XRingmail X[-3] 0, 0 <]], 3, 0> 0:0 4034 $80 (0) C0 XScalemail X[-3] 0, 0 <]], 4, 0> 0:0 6131 $100 (0) C0 XScalemail X[-3] 0, 0 <]], 4, 0> 0:0 4043 $100 (0) C0 XScalemail X[-3] 0, 0 <]], 4, 0> 0:0 180 $100 (0) C0 XScalemail X[-3] 0, 0 <]], 4, 0> 0:0 193 $100 (0) C0 XChainmail X[-3] 0, 0 <]], 5, 0> 0:0 4209 $250 (0) C0 XChainmail X[-3] 0, 0 <]], 5, 0> 0:0 1598 $250 (0) C0 XChainmail X[-3] 0, 0 <]], 5, 0> 0:0 581 $250 (0) C0 XChainmail X[-3] 0, 0 <]], 5, 0> 0:0 193 $250 (0) C0 XChainmail X[-3] 0, 0 <]], 5, 0> 0:0 4209 $250 (0) C0 XChainmail X[-3] 0, 0 <]], 5, 0> 0:0 552 $250 (0) C0 XPlatemail X[-3] 0, 0 <]], 7, 0> 0:0 0 $3000 (0) C0 XPlatemail X[-3] 0, 0 <]], 7, 0> 0:0 0 $3000 (0) C1 XPlatemail X[-3] 0, 0 <]], 7, 0> 0:0 0 $3000 (0) C0 XPlatemail X[-3] 0, 0 <]], 7, 0> 0:0 0 $3000 (0) C0 XPlatemail X[-3] 0, 0 <]], 7, 0> 0:0 0 $3000 (0) C0 XPlatemail X[-3] 0, 0 <]], 7, 0> 0:0 0 $3000 (0) C0 XScroll of Knowledge X[-3] 8, 1 <??, 50, 0> 1:1 3419 $1000 (0) C0 XScroll of Teleport X[-3] 8, 1 <??, 1, 0> 1:1 4074 $750 (0) C0 XScroll of Teleport X[-3] 8, 1 <??, 1, 0> 1:1 4529 $750 (0) C0 XScroll of Teleport X[-3] 8, 1 <??, 1, 0> 1:1 2845 $750 (0) C0 XScroll of Fireball X[-3] 8, 1 <??, 2, 0> 1:1 4859 $450 (0) C0 XScroll of Fireball X[-3] 37, 3 <??, 2, 0> 1:1 193 $450 (0) C0 XScroll of Fireball X[-3] 912, 1 <??, 2, 0> 1:1 585 $450 (0) C0 XScroll of Light X[-3] 8, 0 <??, 5, 0> 1:1 3833 $150 (0) C0 XScroll of Light X[-3] 873, 1 <??, 5, 0> 1:1 5460 $150 (0) C0 XScroll of Light X[-3] 2, 0 <??, 5, 0> 3:1 552 $450 (0) C0 XDisappear Scroll X[-3] 271, 0 <??, 9, 0> 1:1 180 $300 (0) C0 XDisappear Scroll X[-3] 4, 1 <??, 9, 0> 1:1 442 $300 (0) C0 XDisappear Scroll X[-3] 956, 1 <??, 9, 0> 1:1 3304 $300 (0) C0 XDisappear Scroll X[-3] 22, 11 <?_, 9, 0> 1:1 559 $300 (0) C0 XWand of Fire X[-3] 75, 0 </_, 2, 25> 6:2 1453 $1000 (0) C0 XWand of Fire X[-3] 4, 0 <//, 2, 25> 6:6 4507 $1000 (0) C0 XWand of Lightning X[-3] 4, 0 <//, 3, 25> 6:6 4507 $1000 (0) C0 XWand of Lightning X[-3] 4, 0 <//, 3, 25> 6:5 4507 $1000 (0) C0 XWand of Cold X[-3] 75, 0 </_, 7, 25> 6:4 1453 $1000 (0) C0 XStaff of Energy X[-3] 4, 0 <//, 8, 45> 6:6 4507 $2000 (0) C0 XPotion Vial X[-3] 956, 1 <!!, 9, 0> 1:1 3441 $150 (0) C0 XPotion Vial X[-3] 956, 1 <!!, 9, 0> 1:1 3441 $150 (0) C0 XPotion Vial X[-3] 956, 1 <!!, 50, 0> 1:1 3304 $150 (0) C0 XPotion Vial X[-3] 8, 0 <!!, 4, 0> 1:1 4675 $150 (0) C0 XDark Bottle X[-3] 1024, 1 <!!, 4, 0> 1:0 0 $150 (0) C0 XGreen Bottle X[-3] 912, 1 <!!, 4, 0> 1:1 587 $250 (0) C0 XGreen Bottle X[-3] 8, 0 <!!, 4, 0> 1:1 3833 $250 (0) C0 XGreen Bottle X[-3] 956, 1 <!!, 4, 0> 1:1 4650 $250 (0) C0 XDark Bottle X[-3] 956, 1 <!!, 4, 0> 1:1 4735 $250 (0) C0 XDark Bottle X[-3] 1024, 0 <!!, 4, 0> 1:1 2 $250 (0) C0 XPotion of Healing X[-3] 271, 0 <!!, 4, 0> 1:1 180 $25 (0) C1 XBlue Bottle X[-3] 4, 0 <!!, 40, 0> 1:1 4507 $350 (0) C0 XBlue Bottle X[-3] 75, 0 <!!, 40, 0> 1:1 1453 $350 (0) C0 XRed Bottle X[-3] 8, 0 <!!, 50, 0> 1:1 4675 $25 (0) C1 XTorch X[-3] 271, 0 <//, 5, 0> 1:1 180 $10 (0) C0 XTorch X[-3] 383, 0 <//, 5, 0> 1:1 1598 $10 (0) C0 XTorch X[-3] 1024, 1 <//, 5, 0> 1:1 121 $10 (0) C0 XTorch X[-3] 1, 10 <//, 5, 0> 1:1 1645 $10 (0) C0 XTorch X[-3] 6, 2 <//, 5, 0> 1:1 442 $10 (0) C0 XTorch X[-3] 25, 5 <//, 5, 0> 1:1 2080 $10 (0) C0 XTorch X[-3] 8, 2 <//, 5, 0> 1:1 447 $10 (0) C0 XTorch X[-3] 912, 0 <//, 5, 0> 1:1 581 $10 (0) C0 XTorch X[-3] 383, 0 <//, 5, 0> 1:1 1598 $10 (0) C0 XTorch X[-3] 8, 0 <//, 5, 0> 1:1 4675 $10 (0) C0 XDoomahicky X[-3] 36, 11 <//, 1, 0> 19:3 559 $1200 (0) C0 XWidget X[-3] 8, 0 <//, 1, 0> 1:1 2859 $400 (0) C0 XWidget X[-3] 75, 0 <//, 1, 0> 1:1 1453 $400 (0) C0 XWidget X[-3] 912, 1 <//, 1, 0> 1:1 585 $400 (0) C0 END_OF_FILE if test 7812 -ne `wc -c <'mdg_dir/item.start'`; then echo shar: \"'mdg_dir/item.start'\" unpacked with wrong size! fi # end of 'mdg_dir/item.start' fi if test -f 'mdg_dir/monster.start' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'mdg_dir/monster.start'\" else echo shar: Extracting \"'mdg_dir/monster.start'\" \(7423 characters\) sed "s/^X//" >'mdg_dir/monster.start' <<'END_OF_FILE' X150 Xanhkheg Xa [-3] 24, 11 15:15 2 0/60:10 L3 D2 IQ=50 Xanhkheg Xa [-3] 0, 8 15:15 2 0/60:10 L3 D2 IQ=50 Xanhkheg Xa [-3] 9, 11 15:15 2 0/60:10 L3 D2 IQ=50 Xanhkheg Xa [-3] 34, 12 15:15 2 0/60:10 L3 D2 IQ=50 Xanhkheg Xa [-3] 19, 6 15:15 2 0/60:10 L3 D2 IQ=50 Xanhkheg Xa [-3] 18, 2 15:15 2 0/60:10 L3 D2 IQ=50 Xanhkheg Xa [-3] 29, 1 15:15 2 0/60:10 L3 D2 IQ=50 Xanhkheg Xa [-3] 10, 1 15:15 2 0/60:10 L3 D2 IQ=50 Xanhkheg Xa [-3] 33, 10 15:15 2 0/60:10 L3 D2 IQ=50 Xanhkheg Xa [-3] 22, 4 15:15 2 0/60:10 L3 D2 IQ=50 Xanhkheg Xa [-3] 8, 0 15:15 2 0/60:10 L3 D2 IQ=50 Xanhkheg Xa [-3] 17, 4 15:15 2 0/60:10 L13 D2 IQ=50 Xanhkheg Xa [-3] 3, 2 15:15 2 0/60:10 L13 D2 IQ=50 Xanhkheg Xa [-3] 32, 8 15:15 2 0/60:10 L13 D2 IQ=50 Xanhkheg Xa [-3] 31, 7 15:15 2 0/60:10 L13 D2 IQ=50 Xanhkheg Xa [-3] 14, 2 15:15 2 0/60:10 L13 D2 IQ=50 Xanhkheg Xa [-3] 20, 1 15:15 2 0/60:10 L13 D2 IQ=50 Xbat Xb [-3] 35, 6 1:1 5 0/0:0 L0 D0 IQ=50 Xbat Xb [-3] 21, 9 1:1 5 0/0:0 L0 D0 IQ=50 Xbat Xb [-3] 22, 7 1:1 5 0/0:0 L0 D0 IQ=50 Xbat Xb [-3] 13, 9 1:1 5 0/0:0 L0 D0 IQ=50 XWhite Dragon XD [-3] 33, 9 75:75 4 5/100:25 L18 D9 IQ=50 XWhite Dragon XD [-3] 5, 3 75:75 4 5/100:25 L18 D9 IQ=50 XWhite Dragon XD [-3] 6, 1 75:75 4 5/100:25 L18 D9 IQ=50 XBlack Dragon XD [-3] 8, 6 85:85 4 5/100:25 L18 D9 IQ=50 XBlack Dragon XD [-3] 11, 6 85:85 4 5/100:25 L18 D9 IQ=50 XGreen Dragon XD [-3] 15, 4 95:95 3 5/100:25 L18 D9 IQ=50 XGreen Dragon XD [-3] 28, 1 95:95 3 5/100:25 L18 D9 IQ=50 XBlue Dragon XD [-3] 9, 11 105:105 3 5/110:30 L20 D10 IQ=50 XBlue Dragon XD [-3] 10, 6 105:105 3 5/110:30 L20 D10 IQ=50 XRed Dragon XD [-3] 25, 7 115:115 3 5/120:35 L20 D10 IQ=50 XEfreeti XE [-3] 20, 7 55:55 3 0/90:18 L15 D9 IQ=50 XEfreeti XE [-3] 10, 11 55:55 3 0/90:18 L15 D9 IQ=50 XFiend XF [-3] 12, 7 65:65 3 0/100:20 L15 D8 IQ=50 XGuard XG [-3] 28, 10 25:25 3 0/80:15 L15 D8 IQ=50 XGuard XG [-3] 20, 4 25:25 3 0/80:15 L15 D8 IQ=50 XGuard XG [-3] 14, 4 25:25 3 0/80:15 L15 D8 IQ=50 XGuard XG [-3] 27, 7 25:25 3 0/80:15 L15 D8 IQ=50 XScreaming Horror XH [-3] 23, 1 200:53 4 0/190:35 L24 D11 IQ=50 XChanting Horror XH [-3] 22, 1 200:114 4 0/190:35 L24 D11 IQ=50 XWailing Horror XH [-3] 17, 9 200:200 4 0/190:35 L24 D11 IQ=50 Xhellhound Xh [-3] 20, 9 30:30 2 0/90:15 L16 D8 IQ=50 Xhellhound Xh [-3] 31, 5 30:30 2 0/90:15 L16 D8 IQ=50 Xhellhound Xh [-3] 32, 4 30:30 2 0/90:15 L16 D8 IQ=50 Xhellhound Xh [-3] 25, 11 30:30 2 0/90:15 L16 D8 IQ=50 Xhellhound Xh [-3] 10, 5 30:30 2 0/90:15 L16 D8 IQ=50 XInvisible Stumbler X& [-3] 30, 7 30:30 2 0/20:10 L6 D6 IQ=50 XInvisible Stalker X& [-3] 32, 2 20:20 2 0/90:15 L11 D8 IQ=50 XInvisible Stalker X& [-3] 25, 6 30:30 2 0/90:15 L16 D8 IQ=50 Ximp Xi [-3] 21, 10 15:15 5 0/50:5 L16 D5 IQ=50 Ximp Xi [-3] 19, 6 15:15 5 0/50:5 L16 D5 IQ=50 Ximp Xi [-3] 17, 9 15:15 5 0/50:5 L16 D5 IQ=50 Ximp Xi [-3] 23, 8 15:15 5 0/50:5 L16 D5 IQ=50 Ximp Xi [-3] 24, 5 15:15 5 0/50:5 L16 D5 IQ=50 Ximp Xi [-3] 20, 8 15:15 5 0/50:5 L16 D5 IQ=50 Xjackal Xj [-3] 33, 6 10:10 4 0/50:5 L4 D1 IQ=50 Xjackal Xj [-3] 20, 5 10:10 4 0/50:5 L4 D1 IQ=50 Xjackal Xj [-3] 30, 8 10:10 4 0/50:5 L4 D1 IQ=50 Xjackal Xj [-3] 7, 8 10:10 4 0/50:5 L4 D1 IQ=50 Xjackal Xj [-3] 35, 8 10:10 4 0/50:5 L4 D1 IQ=50 Xjackal Xj [-3] 28, 5 10:10 4 0/50:5 L4 D1 IQ=50 XLord of Darkness XL [-3] 8, 3 85:85 3 0/250:45 L19 D11 IQ=80 Xlizardman Xl [-3] 21, 9 25:25 2 0/80:15 L7 D3 IQ=50 Xlizardman Xl [-3] 32, 4 25:25 2 0/80:15 L7 D3 IQ=50 Xlizardman Xl [-3] 28, 4 25:25 2 0/80:15 L7 D3 IQ=50 Xlizardman Xl [-3] 5, 6 25:25 2 0/80:15 L7 D3 IQ=50 Xorc Xo [-3] 8, 10 25:25 3 0/60:15 L4 D3 IQ=50 Xorc Xo [-3] 2, 9 25:25 3 0/60:15 L4 D3 IQ=50 Xorc Xo [-3] 12, 2 25:25 3 0/60:15 L4 D3 IQ=50 Xorc Xo [-3] 22, 6 25:25 3 0/60:15 L4 D3 IQ=50 Xorc Xo [-3] 36, 6 25:25 3 0/60:15 L4 D3 IQ=50 Xorc Xo [-3] 6, 6 25:25 3 0/60:15 L4 D3 IQ=50 Xorc Xo [-3] 26, 7 25:25 3 0/60:15 L4 D3 IQ=50 Xorc Xo [-3] 31, 3 35:35 3 0/60:15 L9 D3 IQ=50 Xorc Xo [-3] 16, 5 35:35 3 0/60:15 L9 D3 IQ=50 XOverlord XO [-3] 4, 7 80:80 4 0/170:25 L17 D10 IQ=80 XParasite XP [-3] 20, 6 500:500 6 2/5:5 L13 D10 IQ=50 Xpirate Xp [-3] 29, 2 20:20 3 0/70:15 L15 D7 IQ=50 Xpirate Xp [-3] 31, 10 20:20 3 0/70:15 L15 D7 IQ=50 Xpirate Xp [-3] 12, 3 20:20 3 0/70:15 L15 D7 IQ=50 Xpirate Xp [-3] 16, 7 20:20 3 0/70:15 L15 D7 IQ=50 Xpirate Xp [-3] 13, 9 20:20 3 0/70:15 L15 D7 IQ=50 Xpirate Xp [-3] 14, 9 20:20 3 0/70:15 L15 D7 IQ=50 Xpirate Xp [-3] 20, 11 20:20 3 0/70:15 L15 D7 IQ=50 Xpirate Xp [-3] 18, 3 20:20 3 0/70:15 L15 D7 IQ=50 Xquasit Xq [-3] 20, 0 15:15 4 0/80:10 L16 D5 IQ=50 Xquasit Xq [-3] 26, 9 15:15 4 0/80:10 L16 D5 IQ=50 Xquasit Xq [-3] 11, 3 15:15 4 0/80:10 L16 D5 IQ=50 Xquasit Xq [-3] 30, 2 15:15 4 0/80:10 L16 D5 IQ=50 Xquasit Xq [-3] 27, 9 15:15 4 0/80:10 L16 D5 IQ=50 Xquasit Xq [-3] 22, 5 15:15 4 0/80:10 L16 D5 IQ=50 Xquasit Xq [-3] 36, 10 15:15 4 0/80:10 L16 D5 IQ=50 Xquasit Xq [-3] 26, 4 15:15 4 0/80:10 L16 D5 IQ=50 Xgiant rat Xr [-3] 21, 4 5:5 2 0/55:5 L1 D2 IQ=50 Xgiant rat Xr [-3] 30, 6 5:5 2 0/55:5 L1 D2 IQ=50 Xgiant rat Xr [-3] 15, 6 5:5 2 0/55:5 L1 D2 IQ=50 Xgiant rat Xr [-3] 28, 3 5:5 2 0/55:5 L1 D2 IQ=50 Xgiant rat Xr [-3] 18, 4 5:5 2 0/55:5 L1 D2 IQ=50 Xgiant rat Xr [-3] 6, 2 5:5 2 0/55:5 L1 D2 IQ=50 Xgiant rat Xr [-3] 9, 3 5:5 2 0/55:5 L1 D2 IQ=50 Xgiant rat Xr [-3] 26, 7 5:5 2 0/55:5 L1 D2 IQ=50 Xgiant rat Xr [-3] 18, 10 5:5 2 0/55:5 L1 D2 IQ=50 Xgiant rat Xr [-3] 11, 6 5:5 2 0/55:5 L1 D2 IQ=50 Xgiant rat Xr [-3] 20, 6 5:5 2 0/55:5 L1 D2 IQ=50 Xgiant rat Xr [-3] 6, 0 5:5 2 0/55:5 L1 D2 IQ=50 Xgiant rat Xr [-3] 10, 2 5:5 2 0/55:5 L1 D2 IQ=50 Xgiant rat Xr [-3] 29, 0 5:5 2 0/55:5 L1 D2 IQ=50 XSneak Thief X& [-3] 14, 12 15:15 2 1/60:0 L15 D4 IQ=90 Xskeleton Xs [-3] 6, 11 15:15 2 0/60:10 L9 D4 IQ=10 Xskeleton Xs [-3] 20, 1 15:15 2 0/60:10 L9 D4 IQ=10 Xskeleton Xs [-3] 22, 9 15:15 2 0/60:10 L9 D4 IQ=10 Xskeleton Xs [-3] 18, 4 15:15 2 0/60:10 L9 D4 IQ=10 Xskeleton Xs [-3] 28, 8 15:15 2 0/60:10 L9 D4 IQ=10 Xskeleton Xs [-3] 12, 3 15:15 2 0/60:10 L9 D4 IQ=10 Xskeleton Xs [-3] 2, 7 15:15 2 0/60:10 L9 D4 IQ=10 Xskeleton Xs [-3] 37, 4 15:15 2 0/60:10 L9 D4 IQ=10 Xskeleton Xs [-3] 14, 11 15:15 2 0/60:10 L9 D4 IQ=10 Xskeleton Xs [-3] 23, 11 15:15 2 0/60:10 L9 D4 IQ=10 Xskeleton Xs [-3] 14, 9 15:15 2 0/60:10 L9 D4 IQ=10 XThief XT [-3] 13, 6 15:15 2 1/60:0 L7 D3 IQ=90 Xtroll Xt [-3] 2, 7 45:45 2 0/90:20 L3 D4 IQ=50 Xtroll Xt [-3] 14, 7 45:45 2 0/90:20 L3 D4 IQ=50 Xtroll Xt [-3] 25, 6 45:45 2 0/90:20 L3 D4 IQ=50 Xtroll Xt [-3] 30, 12 45:45 2 0/90:20 L13 D4 IQ=50 Xtroll Xt [-3] 30, 0 45:45 2 0/90:20 L13 D4 IQ=50 Xtroll Xt [-3] 16, 4 45:45 2 0/90:20 L3 D4 IQ=50 Xtroll Xt [-3] 31, 12 45:45 2 0/90:20 L3 D4 IQ=50 Xtroll Xt [-3] 5, 8 45:45 2 0/90:20 L3 D4 IQ=50 Xtroll Xt [-3] 25, 1 45:45 2 0/90:20 L13 D4 IQ=50 Xtroll Xt [-3] 17, 11 45:45 2 0/90:20 L13 D4 IQ=50 XUnderlord XU [-3] 18, 5 80:80 4 0/170:30 L18 D10 IQ=80 Xuruk-hai Xu [-3] 16, 5 50:50 2 0/95:20 L15 D7 IQ=50 Xuruk-hai Xu [-3] 21, 5 50:50 2 0/95:20 L15 D7 IQ=50 Xghost Xg [-3] 14, 10 45:45 3 6/40:4 L17 D9 IQ=50 Xghost Xg [-3] 33, 3 45:45 3 6/40:4 L17 D9 IQ=50 Xvampyre Xv [-3] 7, 8 45:45 3 4/80:2 L17 D9 IQ=50 Xvampyre Xv [-3] 32, 5 45:45 3 4/80:2 L17 D9 IQ=50 Xwraith Xw [-3] 10, 3 45:45 4 3/75:1 L17 D8 IQ=50 Xwraith Xw [-3] 6, 7 45:45 4 3/75:1 L17 D8 IQ=50 XWarlord XW [-3] 27, 6 55:55 3 0/75:25 L6 D10 IQ=80 XZombie Master XZ [-3] 15, 7 100:100 3 0/65:25 L8 D10 IQ=80 Xzombie Xz [-3] 4, 9 20:20 2 0/65:15 L8 D4 IQ=25 Xzombie Xz [-3] 21, 11 20:20 2 0/65:15 L8 D4 IQ=25 Xzombie Xz [-3] 6, 11 20:20 2 0/65:15 L8 D4 IQ=25 Xzombie Xz [-3] 15, 2 20:20 2 0/65:15 L8 D4 IQ=25 Xzombie Xz [-3] 2, 7 20:20 2 0/65:15 L8 D4 IQ=25 Xzombie Xz [-3] 4, 4 20:20 2 0/65:15 L8 D4 IQ=25 Xzombie Xz [-3] 3, 7 20:20 2 0/65:15 L8 D4 IQ=25 Xzombie Xz [-3] 7, 5 20:20 2 0/65:15 L8 D4 IQ=25 Xzombie Xz [-3] 27, 10 20:20 2 0/65:15 L8 D4 IQ=25 END_OF_FILE if test 7423 -ne `wc -c <'mdg_dir/monster.start'`; then echo shar: \"'mdg_dir/monster.start'\" unpacked with wrong size! fi # end of 'mdg_dir/monster.start' fi if test -f 'messages.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'messages.h'\" else echo shar: Extracting \"'messages.h'\" \(1381 characters\) sed "s/^X//" >'messages.h' <<'END_OF_FILE' X/* X MDG -- messages include file X X MDG is Copyright 1990 John C. Gonnerman X This file is subject to the general MDG X copyright statement (see enclosed file, Copyright). X X SCCSID @(#) messages.h (1.2) created 12/26/90 X*/ X X#define BAR \ X"\r\n ====================================================================\r\n" X#define TITLE \ X"\r\n Multiuser Dungeon Game (Release 1)" X#define COPYRIGHT \ X"\r\n Copyright 1990, John C. Gonnerman\r\n" X#define PRESSMSG \ X"\r\n =========================== Press any key ==========================\r\n" X X#define INDENT "\r\n " X X#define WAITMSG "Connecting, please wait... " X#define READYMSG "connected. " X X#define NORESPONSE "daemon did not respond.\r\n\n" X#define NOTONLINE "daemon not online.\r\n\n" X#define UNKPLAYER "you are unknown.\r\n\n" X X#define GAMEOVER "You have returned home. Game Over. (Press ENTER) " X#define DIED "You have died... Game Over. (Press ENTER) " X X#define DTITLE "\nMultiuser Dungeon Game (Release 1)\n" X#define DCOPYRIGHT "Copyright 1990, John C. Gonnerman\n" X#define LOADMSG "Loading daemon task...\n\n" X X#define WELCOME "Welcome to MDG... press ? for Help." X X#define ARGCOUNT "%s: invalid arg count %d\n" X#define CANTERR "%s: can't %s (%s)\n" X#define READERROR "%s: can't read %s (%s)\n" X#define FORMERROR "%s: format invalid in %s\n" X X/* end of file */ END_OF_FILE if test 1381 -ne `wc -c <'messages.h'`; then echo shar: \"'messages.h'\" unpacked with wrong size! fi # end of 'messages.h' fi if test -f 'monsters.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'monsters.c'\" else echo shar: Extracting \"'monsters.c'\" \(6752 characters\) sed "s/^X//" >'monsters.c' <<'END_OF_FILE' X/* X MDG Multiuser Dungeon Game -- monsters.c monster code X X MDG is Copyright 1990 John C. Gonnerman X This program is subject to the general MDG X copyright statement (see enclosed file, Copyright). X*/ X Xstatic char *sccsvers = "@(#) monsters.c\t(1.2)\tcreated 1/12/91"; X X#include <stdio.h> X#include "setup.h" X#include "struct.h" X Xextern char *progname; X Xextern int errno; Xextern char *sys_errlist[]; X Xextern struct map_seg *mseg; Xextern struct player_seg *pseg; X Xextern int map_size, player_size; X Xextern struct monster_tbl *m_table; X Xextern int n_monster; X X Xmove_monsters() X{ X int i, j; X X for(i = 0; i < n_monster; i++) { X if(m_table[i].loc.sector == LOC_NONESUCH) X resurrect(i); X else if(player_here(m_table[i].loc.sector)) X for(j = m_table[i].mv_used; j < m_table[i].mv; j++) X do_a_monster(i); X else X roll_over(i); X X m_table[i].mv_used = 0; X m_table[i].att_used = 0; X } X} X X Xpace_monsters() X{ X int i; X X for(i = 0; i < n_monster; i++) X if(m_table[i].mv_used < m_table[i].mv X && player_here(m_table[i].loc.sector)) { X m_table[i].mv_used++; X do_a_monster(i); X } X} X X Xroll_over(m_indx) Xint m_indx; X{ X int dir; X X if((dir = at_edge(m_indx)) < 0) X return; X X if(player_here(mseg->m[m_table[m_indx].loc.sector].links[dir])) X move_a_monster(m_indx, dir); X} X X Xint at_edge(m_indx) Xint m_indx; X{ X switch(m_table[m_indx].loc.x) { X case 0 : X return L_WEST; X case MAPCOLS - 1 : X return L_EAST; X } X X switch(m_table[m_indx].loc.y) { X case 0 : X return L_NORTH; X case MAPROWS - 1 : X return L_SOUTH; X } X X return -1; X} X X Xmove_a_monster(m_indx, dir) Xint m_indx; Xunsigned char dir; X{ X struct location loc; X int sector; X X if((sector = m_table[m_indx].loc.sector) < 0) X return; X X loc.sector = m_table[m_indx].loc.sector; X loc.x = m_table[m_indx].loc.x; X loc.y = m_table[m_indx].loc.y; X X mseg->m[loc.sector].map[loc.y][loc.x] = m_table[m_indx].loc.under; X X if(get_dest(&loc, dir) != -1) X mmove_subcmd(m_indx, loc.sector, loc.x, loc.y); X X move_sym(&(m_table[m_indx].loc), m_table[m_indx].m_sym); X X mseg->map_sem++; X} X X Xmmove_subcmd(m_indx, dest_a, dest_x, dest_y) Xint m_indx, dest_a, dest_x, dest_y; X{ X int rc; X X rc = move_to(&(m_table[m_indx].loc), dest_a, dest_x, dest_y, -1); X X if(is_player(rc)) X mattack(m_indx, dest_a, dest_x, dest_y); X X if(rc == 0) { X if(dest_a != m_table[m_indx].loc.sector) X notify(m_table[m_indx].loc.sector); X notify(dest_a); X } X} X X Xint player_here(sector) Xint sector; X{ X int i; X X if(sector < 0) X return 0; X X for(i = 0; i < MAX_PLAYERS; i++) X if(pseg->p[i].playernum >= 0 X && pseg->p[i].loc.sector == sector) X return 1; X X return 0; X} X X Xdo_a_monster(m_indx) Xint m_indx; X{ X int target_indx, rc; X int m_x, m_y, m_a, p_x, p_y, p_a; X X if(m_table[m_indx].loc.sector < 0) X return; X X m_x = m_table[m_indx].loc.x; X m_y = m_table[m_indx].loc.y; X m_a = m_table[m_indx].loc.sector; X X if((target_indx = nearest(m_a, m_x, m_y)) == -1) X return; X X p_x = pseg->p[target_indx].loc.x; X p_y = pseg->p[target_indx].loc.y; X p_a = pseg->p[target_indx].loc.sector; X X mseg->m[m_a].map[m_y][m_x] = m_table[m_indx].loc.under; X X if(m_x == p_x) X app_m_move(m_indx, (m_y < p_y ? L_SOUTH : L_NORTH )); X else if(m_y == p_y) X app_m_move(m_indx, (m_x < p_x ? L_EAST : L_WEST )); X else if(m_x < p_x) X app_m_move(m_indx, (m_y < p_y ? L_SEAST : L_NEAST )); X else if(m_x > p_x) X app_m_move(m_indx, (m_y < p_y ? L_SWEST : L_NWEST )); X X move_sym(&(m_table[m_indx].loc), m_table[m_indx].m_sym); X mseg->map_sem++; X X notify(m_a); X} X X Xapp_m_move(m_indx, dir) Xint m_indx, dir; X{ X if(rnd(100) <= m_table[m_indx].iq) X dir = smart_dir(m_indx, dir); X else X dir = stupid_dir(dir); X X move_a_monster(m_indx, dir); X} X X Xint smart_dir(m_indx, dir) Xint m_indx, dir; X{ X int ndir, mdir, nturn, mturn; X X mturn = rnd(2) - 1; X nturn = mturn == 1 ? 0 : 1; X X if(test_dir(m_indx, dir)) X return dir; X X if(test_dir(m_indx, (ndir = turn_it(dir, nturn)))) X return ndir; X X if(test_dir(m_indx, (mdir = turn_it(dir, mturn)))) X return mdir; X X if(test_dir(m_indx, (ndir = turn_it(ndir, nturn)))) X return ndir; X X return turn_it(mdir, mturn); X} X X Xint test_dir(m_indx, dir) Xint m_indx, dir; X{ X struct location loc; X int at_spot; X X loc = m_table[m_indx].loc; X X if(get_dest(&loc, dir) == -1 X || loc.sector < 0) X return 0; X X at_spot = mseg->m[loc.sector].map[loc.y][loc.x]; X X if(is_clear(at_spot) || is_player(at_spot)) X return 1; X X return 0; X} X X Xint stupid_dir(dir) Xint dir; X{ X switch(rnd(7)) { X case 1 : X case 2 : X return turn_it(dir, 0); X case 3 : X case 4 : X case 5 : X return dir; X case 6 : X case 7 : X return turn_it(dir, 1); X } X} X X Xint turn_it(dir, rot) Xint dir, rot; X{ X switch(dir) { X case L_NORTH : X return (rot ? L_NEAST : L_NWEST); X case L_NEAST : X return (rot ? L_EAST : L_NORTH); X case L_EAST : X return (rot ? L_SEAST : L_NEAST); X case L_SEAST : X return (rot ? L_SOUTH : L_EAST); X case L_SOUTH : X return (rot ? L_SWEST : L_SEAST); X case L_SWEST : X return (rot ? L_WEST : L_SOUTH); X case L_WEST : X return (rot ? L_NWEST : L_SWEST); X case L_NWEST : X return (rot ? L_NORTH : L_WEST); X } X} X X Xint nearest(dest_a, dest_x, dest_y) Xint dest_a, dest_x, dest_y; X{ X int result, dist, n_dist, i; X X result = -1; X dist = 100; X X for(i = 0; i < MAX_PLAYERS; i++) X if(pseg->p[i].playernum != -1 X && pseg->p[i].loc.sector == dest_a X && !pseg->p[i].invis X && (n_dist = distance(i, dest_x, dest_y)) < dist) { X dist = n_dist; X result = i; X } X X return result; X} X X Xint distance(indx, dest_x, dest_y) Xint indx, dest_x, dest_y; X{ X int x_off, y_off; X X x_off = pseg->p[indx].loc.x - dest_x; X y_off = pseg->p[indx].loc.y - dest_y; X X if(x_off < 0) X x_off *= -1; X X if(y_off < 0) X y_off *= -1; X X return x_off + y_off; X} X X Xint count_monsters(sector) X{ X int i, cnt; X X cnt = 0; X X for(i = 0; i < n_monster; i++) X if(m_table[i].loc.sector == sector) X cnt++; X X return cnt; X} X X Xresurrect(m_indx) Xint m_indx; X{ X int rc; X int dest_a, dest_x, dest_y, at_loc; X X if(rnd(100) > RESURRECTION) X return; X X dest_a = rnd(mseg->max_areas - 1); /* never at sector 0 */ X X if(player_here(dest_a) X || mseg->m[dest_a].level < m_table[m_indx].level X || count_monsters(dest_a) >= MAX_MONSTERS X || m_table[m_indx].level < (mseg->m[dest_a].level - 4)) X return; X X dest_x = rnd(MAPCOLS) - 1; X dest_y = rnd(MAPROWS) - 1; X X at_loc = mseg->m[dest_a].map[dest_y][dest_x]; X X if(at_loc == '%' || at_loc == '~' || at_loc == '^') X return; X X rc = move_to(&(m_table[m_indx].loc), dest_a, dest_x, dest_y, -1); X X if(rc == 0) { X move_sym(&(m_table[m_indx].loc), m_table[m_indx].m_sym); X m_table[m_indx].hp = m_table[m_indx].max_hp; X mseg->map_sem++; X notify(dest_a); X } X} X X Xlift_a_monster(m_indx) Xint m_indx; X{ X int sector, x, y; X X sector = m_table[m_indx].loc.sector; X x = m_table[m_indx].loc.x; X y = m_table[m_indx].loc.y; X X mseg->m[sector].map[y][x] = m_table[m_indx].loc.under; X} X X X/* end of file. */ END_OF_FILE if test 6752 -ne `wc -c <'monsters.c'`; then echo shar: \"'monsters.c'\" unpacked with wrong size! fi # end of 'monsters.c' fi if test -f 'plrstruct.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'plrstruct.h'\" else echo shar: Extracting \"'plrstruct.h'\" \(1364 characters\) sed "s/^X//" >'plrstruct.h' <<'END_OF_FILE' X/* X MDG Multiuser Dungeon Game -- master structure include file X X MDG is Copyright 1990 John C. Gonnerman X This file is subject to the general MDG X copyright statement (see enclosed file, Copyright). X X SCCSID @(#) plrstruct.h (1.3) created 1/3/91 X*/ X X X/* private segment structure for mdg_game */ X Xstruct game_msg { X int trader_offset; X short clear_ok; X char buf[70]; X}; X X Xstruct item { X char type, symbol; X int effect, range, max_uses, rem_uses, value; X short mod_count; X long decay_cnt; X char name[INAMELEN]; X unsigned char curse; X struct location loc; X}; X X Xstruct player { X int playernum; X char name[PNAMELEN]; X X short alignment; X X int lives; X long gold; X X short spells[26], fighting; X short max_hp, hitpoints, max_mp, magicpts; X short createpts; X X int items[PMAX_ITEMS]; X X struct location loc; X int home, prev_sect; X X char dmsg[2][35]; X short dmsg_loc; X unsigned short brief; X X int clock, detect, attacks, light; X short m_armor, ma_count, invis; X short blocked, gold_hidden, knight; X short user_spell; X X short partners[MAX_PLAYERS]; X}; X X X/* X definitions for the handling of the shared memory segments. X*/ X Xstruct player_seg { X int sid; X short in_trader; X short player_sem, item_sem; X struct player p[MAX_PLAYERS]; X X int weapon[MAX_PLAYERS]; X int armor[MAX_PLAYERS]; X int shield[MAX_PLAYERS]; X X int item_count; X struct item itm[1]; X}; X X X/* end of file. */ END_OF_FILE if test 1364 -ne `wc -c <'plrstruct.h'`; then echo shar: \"'plrstruct.h'\" unpacked with wrong size! fi # end of 'plrstruct.h' fi if test -f 'ranged.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ranged.c'\" else echo shar: Extracting \"'ranged.c'\" \(3978 characters\) sed "s/^X//" >'ranged.c' <<'END_OF_FILE' X/* X MDG Multiuser Dungeon Game -- ranged.c ranged weapons code X X MDG is Copyright 1990 John C. Gonnerman X This program is subject to the general MDG X copyright statement (see enclosed file, Copyright). X*/ X X Xstatic char *sccsvers = "@(#) ranged.c\t(1.1)\tcreated 12/25/90"; X X#include <stdio.h> X#include "setup.h" X#include "struct.h" X Xextern char *progname; X Xextern struct player_seg *pseg; Xextern struct map_seg *mseg; X Xstruct { X int symbol, range, damage, dir, mv_used; X struct location loc; X} r_tbl[MAX_RANGED]; X X Xint fire_missile(p_indx, i_indx, dir) Xint p_indx, i_indx, dir; X{ X int eff; X X eff = pseg->itm[i_indx].effect; X X if(pseg->itm[i_indx].curse) X eff = 0; X X return start_ranged(20, pseg->itm[i_indx].range, go2r(eff), X pseg->p[p_indx].loc.sector, pseg->p[p_indx].loc.x, X pseg->p[p_indx].loc.y, dir); X} X X Xint start_ranged(symbol, range, damage, sector, x, y, dir) Xint symbol, range, damage, sector, x, y, dir; X{ X int row; X struct location loc; X X if(sector < 0 X || (row = r_next_free()) == -1) X return -1; X X loc.sector = r_tbl[row].loc.sector = sector; X loc.x = r_tbl[row].loc.x = x; X loc.y = r_tbl[row].loc.y = y; X X if(get_dest(&(loc), dir) == -1) X return -1; X X if(loc.sector < 0) X return -1; X X r_tbl[row].dir = dir; X r_tbl[row].symbol = symbol; X r_tbl[row].mv_used = 0; X X r_tbl[row].range = range; X r_tbl[row].damage = damage; X X rmove_subcmd(row, loc.sector, loc.x, loc.y); X X if(loc.sector >= 0) X notify(loc.sector); X X return 0; X} X X Xinit_ranged() X{ X int row; X X for(row = 0; row < MAX_RANGED; row++) X r_tbl[row].symbol = -1; X} X X Xint r_next_free() X{ X int row; X X for(row = 0; row < MAX_RANGED; row++) X if(r_tbl[row].symbol <= 0) X return row; X X return -1; X} X X Xmove_ranged() X{ X int row, cnt; X X for(row = 0; row < MAX_RANGED; row++) { X if(r_tbl[row].symbol > 0) X for(cnt = r_tbl[row].mv_used; cnt < R_SPEED; cnt++) X move_a_ranged(row); X X r_tbl[row].mv_used = 0; X } X} X X Xpace_ranged() X{ X int row; X X for(row = 0; row < MAX_RANGED; row++) X if(r_tbl[row].mv_used < R_SPEED X && r_tbl[row].symbol > 0) X move_a_ranged(row); X} X X Xmove_a_ranged(row) Xint row; X{ X struct location loc; X X if(r_tbl[row].symbol < 0) X return; X X loc.sector = r_tbl[row].loc.sector; X X loc.x = r_tbl[row].loc.x; X loc.y = r_tbl[row].loc.y; X X mseg->m[loc.sector].map[loc.y][loc.x] = r_tbl[row].loc.under; X mseg->map_sem++; X X notify(loc.sector); X X if(--r_tbl[row].range < 1) { X r_tbl[row].symbol = -1; X return; X } X X if(get_dest(&(loc), r_tbl[row].dir) == -1) { X r_tbl[row].symbol = -1; X return; X } X X if(loc.sector < 0) { X r_tbl[row].symbol = -1; X return; X } X X rmove_subcmd(row, loc.sector, loc.x, loc.y); X X if(loc.sector >= 0) X notify(loc.sector); X} X X Xrmove_subcmd(row, dest_a, dest_x, dest_y) Xint row, dest_a, dest_x, dest_y; X{ X int rc; X X rc = r_move_to(&(r_tbl[row].loc), dest_a, dest_x, dest_y); X X if(is_critter(rc) || is_player(rc)) { X r_tbl[row].symbol = -1; X damage_it(r_tbl[row].damage, dest_a, dest_x, dest_y); X return; X } else if(rc == '%' && r_tbl[row].symbol == 21) { X r_tbl[row].symbol = -1; X mseg->m[dest_a].map[dest_y][dest_x] = ' '; X mseg->save_map = 1; X mseg->map_sem++; X return; X } else if(rc != 0) { X r_tbl[row].symbol = -1; X return; X } X X move_sym(&(r_tbl[row].loc), (char)r_tbl[row].symbol); X mseg->map_sem++; X} X X Xint r_move_to(locptr, dest_a, dest_x, dest_y) Xstruct location *locptr; Xint dest_a, dest_x, dest_y; X{ X char at_loc; X X if(dest_a < 0) X return -1; X X at_loc = mseg->m[dest_a].map[dest_y][dest_x]; X X switch(at_loc) { X case '^' : /* pit */ X case '0' : /* 0-9 are traps */ X case '1' : X case '2' : X case '3' : X case '4' : X case '5' : X case '6' : X case '7' : X case '8' : X case '9' : X case '.' : X case ' ' : X case '+' : X case '<' : /* down */ X case '>' : /* up */ X case '=' : /* gateway */ X case '~' : /* water */ X case '`' : /* shallow water */ X locptr->sector = dest_a; X locptr->x = dest_x; X locptr->y = dest_y; X locptr->under = at_loc; X mseg->map_sem++; X return 0; X X case '%' : X default : X return (int)at_loc; X } X} X X/* end of file. */ END_OF_FILE if test 3978 -ne `wc -c <'ranged.c'`; then echo shar: \"'ranged.c'\" unpacked with wrong size! fi # end of 'ranged.c' fi if test -f 'setup.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'setup.h'\" else echo shar: Extracting \"'setup.h'\" \(1236 characters\) sed "s/^X//" >'setup.h' <<'END_OF_FILE' X/* X MDG Multiuser Dungeon Game -- setup include file X X MDG is Copyright 1990 John C. Gonnerman X This file is subject to the general MDG X copyright statement (see enclosed file, Copyright). X X SCCSID @(#) setup.h (1.6) created 1/12/91 X*/ X X X#define DATE_OFFSET (20L * 365L * 24L * 3600L) X X#define NICEVAL 0 X X#define CHECKP_LEVEL 3000 X#define MAX_MARMOR 6 X X#define MAX_RANGED 9 X#define R_SPEED 2 X X/* minimum to be considered "functional" */ X X#define MIN_HPS 10 X X#define MAX_HPS 60 X#define MAX_MPS 25 X X#define HP_CUTOFF 56 X#define MP_CUTOFF 23 X X#define DANGER_CUT 10 X X#define CRYSTAL_ODDS 4 X X#define HEAL_DIV 15 X#define CHARGE_INC 1 X X#define TICKSPERPACE 8 X X#define P_ATTACKS 1 X#define M_ATTACKS 1 X X#define TIME_TO_HEAL 15 X X#define RESURRECTION 75 X#define MAX_MONSTERS 6 X X#define MINUTE 60 X X#define GAMEDAY 60 X#define G_MORNING 18 X#define G_AFTERNOON 36 X#define G_EVENING 43 X X#define DECAY_MAP (2 * 24 * 60) X#define DECAY_PLAYER (9 * 24 * 60) X#define DECAY_TRADER (4 * 24 * 60) X#define DECAY_OBSCURE (7 * 24 * 60) X#define DECAY_CRYSTAL (5) X X#define TELE_TRYS 3 X X#define KNIGHT_DUR 150 X X#define USER_DUR 30 X X#define DETECT_DUR 20 X#define DETECT_L2 40 X#define DETECT_L3 55 X X#define MAPROWS 13 X#define MAPCOLS 38 X X X/* end of file */ END_OF_FILE if test 1236 -ne `wc -c <'setup.h'`; then echo shar: \"'setup.h'\" unpacked with wrong size! fi # end of 'setup.h' fi if test -f 'speak.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'speak.c'\" else echo shar: Extracting \"'speak.c'\" \(1135 characters\) sed "s/^X//" >'speak.c' <<'END_OF_FILE' X/* X MDG Multiuser Dungeon Game -- speak.c message handler X X MDG is Copyright 1990 John C. Gonnerman X This program is subject to the general MDG X copyright statement (see enclosed file, Copyright). X*/ X X Xstatic char *sccsvers = "@(#) speak.c\t(1.1)\tcreated 12/25/90"; X X#include <string.h> X X#include "setup.h" X#include "struct.h" X#include "spells.h" X Xextern struct player_seg *pseg; Xextern struct map_seg *mseg; X X Xspeak(indx, text) Xint indx; Xchar *text; X{ X int i, all; X char buf[35]; X X all = 0; X X if(text[0] == '\0') X return; X X if(text[0] == '!') { X all = 1; X text++; X } X X for(i = 0; i < MAX_PLAYERS; i++) X if(all || pseg->p[i].loc.sector == pseg->p[indx].loc.sector) { X sprintf(buf, "%c> ", (char)(indx + '1')); X strcat(buf, text); X dmsg_add(i, buf); X } X} X X Xwhisper(indx, to_indx, text) Xint indx, to_indx; Xchar *text; X{ X int i; X char buf[35]; X X if(text[0] == '\0') X return; X X if(to_indx < 0 || to_indx >= MAX_PLAYERS) X return; X X if(pseg->p[to_indx].loc.sector >= 0 X && pseg->p[to_indx].playernum >= 0) { X sprintf(buf, "%c} ", (char)(indx + '1')); X strcat(buf, text); X dmsg_add(to_indx, buf); X } X} X X X/* end of file. */ END_OF_FILE if test 1135 -ne `wc -c <'speak.c'`; then echo shar: \"'speak.c'\" unpacked with wrong size! fi # end of 'speak.c' fi echo shar: End of archive 5 \(of 6\). cp /dev/null ark5isdone MISSING="" for I in 1 2 3 4 5 6 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 6 archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0