[comp.sources.games] v12i042: mdg - multiuser dungeon game, Part06/06

billr@saab.CNA.TEK.COM (Bill Randle) (02/20/91)

Submitted-by: jcg@tree.uucp (Chris Gonnerman)
Posting-number: Volume 12, Issue 42
Archive-name: mdg/Part06
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 6 (of 6)."
# Contents:  combat.h config.h dayclock.c dident.c dmsg.c effect.h
#   files.h genstruct.h help.h mapstruct.h monstruct.h msgstruct.h
#   random.c show.h spells.h spells.c stopdaemon.c strstr.c traps.c
#   Mk_sun.diff
# Wrapped by billr@saab on Tue Feb 19 14:49:47 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'combat.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'combat.h'\"
else
echo shar: Extracting \"'combat.h'\" \(453 characters\)
sed "s/^X//" >'combat.h' <<'END_OF_FILE'
X/*
X	MDG Multiuser Dungeon Game -- combat.h constants
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	@(#) combat.h (1.2) created 1/13/91
X*/
X
X
X#define ATT_HITS	0
X#define ATT_STEALS	1
X#define ATT_DRAINS	2
X#define ATT_DRAINMP	3
X#define ATT_DRAINHP	4
X#define ATT_BREATH	5
X#define ATT_DRAINLIFE	6
X
X#define MIN_CHANCE	25
X#define MAX_CHANCE	85
X
X
X/* end of file. */
END_OF_FILE
if test 453 -ne `wc -c <'combat.h'`; then
    echo shar: \"'combat.h'\" unpacked with wrong size!
fi
# end of 'combat.h'
fi
if test -f 'config.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'config.h'\"
else
echo shar: Extracting \"'config.h'\" \(453 characters\)
sed "s/^X//" >'config.h' <<'END_OF_FILE'
X/*
X	MDG Multiuser Dungeon Game -- ipc config include file
X	
X	MDG is Copyright 1990, John C. Gonnerman
X
X	This file is subject to the general MDG copyright 
X	statement (see enclosed file, Copyright).
X
X	SCCSID @(#) config.h (1.2) created 1/2/91
X*/
X
X
X/* these are defaults. */
X
X#define MAPKEY		598L
X#define PLAYERKEY	599L
X#define DMSGKEY		597L
X
X/* this is the BASE KEY */
X/* max key is GSEMKEY + MAX_PLAYERS - 1 */
X#define GSEMKEY		600L
X
X
X/* end of file */
END_OF_FILE
if test 453 -ne `wc -c <'config.h'`; then
    echo shar: \"'config.h'\" unpacked with wrong size!
fi
# end of 'config.h'
fi
if test -f 'dayclock.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'dayclock.c'\"
else
echo shar: Extracting \"'dayclock.c'\" \(540 characters\)
sed "s/^X//" >'dayclock.c' <<'END_OF_FILE'
X/*
X	MDG Multiuser Dungeon Game -- dayclock.c
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 = "@(#) dayclock.c\t(1.1)\tcreated 12/25/90";
X
X#include <stdio.h>
X
X#include "setup.h"
X#include "struct.h"
X
Xextern struct map_seg *mseg;
X
X
Xint timeofday()
X{
X	if(mseg->dayclock < G_MORNING)
X		return 1;
X
X	if(mseg->dayclock < G_AFTERNOON)
X		return 2;
X
X	if(mseg->dayclock < G_EVENING)
X		return 3;
X
X	return 0;
X}
X
X
X/* end of file. */
END_OF_FILE
if test 540 -ne `wc -c <'dayclock.c'`; then
    echo shar: \"'dayclock.c'\" unpacked with wrong size!
fi
# end of 'dayclock.c'
fi
if test -f 'dident.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'dident.c'\"
else
echo shar: Extracting \"'dident.c'\" \(766 characters\)
sed "s/^X//" >'dident.c' <<'END_OF_FILE'
X/*
X	MDG Multiuser Dungeon Game -- dident.c daemon 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 = "@(#) dident.c\t(1.2)\tcreated 12/31/90";
X
X#include <stdio.h>
X#include <string.h>
X
X#include "files.h"
X#include "setup.h"
X#include "messages.h"
X
Xextern char *progname;
X
X
Xget_handle(handle, playernum)
Xchar *handle;
Xint playernum;
X{
X	FILE *fp;
X	char cmdbuf[128], inbuf[80], *p;
X
X	
X	sprintf(cmdbuf, "%s/%s %d", GAME_HOME, IDENTPROG, playernum);
X
X	if((fp = popen(cmdbuf, "r")) == NULL)
X		return;
X
X	fgets(inbuf, 80, fp);
X	fgets(handle, 19, fp);
X
X	pclose(fp);
X
X	for(p = handle; *p; p++)
X		if(*p == '\n') 
X			*p = '\0';
X}
X
X
X/* end of file. */
END_OF_FILE
if test 766 -ne `wc -c <'dident.c'`; then
    echo shar: \"'dident.c'\" unpacked with wrong size!
fi
# end of 'dident.c'
fi
if test -f 'dmsg.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'dmsg.c'\"
else
echo shar: Extracting \"'dmsg.c'\" \(601 characters\)
sed "s/^X//" >'dmsg.c' <<'END_OF_FILE'
X/*
X	MDG Multiuser Dungeon Game -- dmsg.c message 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 = "@(#) dmsg.c\t\t(1.1)\tcreated 12/25/90";
X
X#include "setup.h"
X#include "struct.h"
X
Xextern struct player_seg *pseg;
X
X
Xdmsg_add(p_indx, msg)
Xint p_indx;
Xchar *msg;
X{
X	int loc;
X
X	loc = pseg->p[p_indx].dmsg_loc;
X
X	if(++loc > 1)
X		loc = 0;
X
X	strcpy(pseg->p[p_indx].dmsg[loc], msg);
X
X	pseg->p[p_indx].dmsg_loc = loc;
X
X	pseg->player_sem++;
X	tell_player(p_indx);
X}
X
X
X/* end of file. */
END_OF_FILE
if test 601 -ne `wc -c <'dmsg.c'`; then
    echo shar: \"'dmsg.c'\" unpacked with wrong size!
fi
# end of 'dmsg.c'
fi
if test -f 'effect.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'effect.h'\"
else
echo shar: Extracting \"'effect.h'\" \(573 characters\)
sed "s/^X//" >'effect.h' <<'END_OF_FILE'
X/*
X	MDG Multiuser Dungeon Game -- effect.h effect list
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	SCCSID @(#) effect.h (1.1) created 12/25/90
X*/
X
X
X#define TELEPORT	1
X#define FIREBALLS 	2
X#define LIGHTNING	3
X#define HEALING		4
X#define GLOW		5
X#define DETECT		6
X#define COLD 		7
X#define ZAP	 	8
X#define INVISIBLE 	9
X
X#define LOWER_MHITS	31
X#define LOWER_M_MPS	32
X
X#define MAGICPTS	40
X#define RAISE_MHITS	41
X#define RAISE_M_MPS	42
X
X#define LEARN_SPELL	50
X
X
X/* end of file. */
END_OF_FILE
if test 573 -ne `wc -c <'effect.h'`; then
    echo shar: \"'effect.h'\" unpacked with wrong size!
fi
# end of 'effect.h'
fi
if test -f 'files.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'files.h'\"
else
echo shar: Extracting \"'files.h'\" \(682 characters\)
sed "s/^X//" >'files.h' <<'END_OF_FILE'
X/*
X	MDG Multiuser Dungeon Game -- files 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 @(#) files.h (1.1) created 12/25/90
X*/
X
X#define GAME_HOME	"/usr/games/mdg_dir"
X
X#define LOCKFILE	"LOCK.daemon"
X
X#define CONFIGFILE	"mdg.config"
X#define STATFILE	"statlog"
X
X#define MONSTERS	"monster"
X#define ITEMS		"item"
X#define NOTES		"note"
X#define MAP		"map"
X
X#define STARTEXT	".start"
X#define SAVEEXT		".save"
X#define OLDEXT		".old"
X
X#define ERRLOGFILE	"errorlog"
X
X#define PLAYERDIR	"players"
X
X#define CLOCKTASK	"bin/mdg_clock"
X#define IDENTPROG	"bin/ident"
X
X
X/* end of file */
END_OF_FILE
if test 682 -ne `wc -c <'files.h'`; then
    echo shar: \"'files.h'\" unpacked with wrong size!
fi
# end of 'files.h'
fi
if test -f 'genstruct.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'genstruct.h'\"
else
echo shar: Extracting \"'genstruct.h'\" \(369 characters\)
sed "s/^X//" >'genstruct.h' <<'END_OF_FILE'
X/*
X	MDG Multiuser Dungeon Game -- generic 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 @(#) genstruct.h (1.1) created 12/25/90
X*/
X
X
Xstruct location {
X	int sector, x, y;
X	char under;
X};
X
Xstruct note_tbl {
X	char text[35];
X};
X
X
X/* end of file. */
END_OF_FILE
if test 369 -ne `wc -c <'genstruct.h'`; then
    echo shar: \"'genstruct.h'\" unpacked with wrong size!
fi
# end of 'genstruct.h'
fi
if test -f 'help.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'help.h'\"
else
echo shar: Extracting \"'help.h'\" \(564 characters\)
sed "s/^X//" >'help.h' <<'END_OF_FILE'
X/*
X	MDG Multiuser Dungeon Game -- help 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 @(#) help.h (1.1) created 12/25/90
X*/
X
X
X#define ITEMMSG \
X"Use the T)ake command to pick up the %s"
X
X#define HELPMSG \
X"Move: HJKL or num pad  A)ctivate  D)rop  C)ast spell (a-z)"
X
X#define STAIRMSG \
X"E)nter to go up or down stairs;   stairs down: <   stairs up: >"
X
X#define DARKMSG \
X"It's DARK here... A)ctivate a Torch or C)ast a Glow spell"
X
X
X/* end of file */
END_OF_FILE
if test 564 -ne `wc -c <'help.h'`; then
    echo shar: \"'help.h'\" unpacked with wrong size!
fi
# end of 'help.h'
fi
if test -f 'mapstruct.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mapstruct.h'\"
else
echo shar: Extracting \"'mapstruct.h'\" \(494 characters\)
sed "s/^X//" >'mapstruct.h' <<'END_OF_FILE'
X/*
X	MDG Multiuser Dungeon Game -- map 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 @(#) mapstruct.h (1.1) created 12/25/90
X*/
X
X
Xstruct area {
X	char map[13][39], title[39], border_ch;
X	short links[13], level, light, jump_inhibit, god_limit;
X};
X
X
Xstruct map_seg {
X	short map_sem;
X	short save_map;
X	int dayclock;
X	int max_areas;
X	struct area m[1];
X};
X
X
X/* end of file. */
END_OF_FILE
if test 494 -ne `wc -c <'mapstruct.h'`; then
    echo shar: \"'mapstruct.h'\" unpacked with wrong size!
fi
# end of 'mapstruct.h'
fi
if test -f 'monstruct.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'monstruct.h'\"
else
echo shar: Extracting \"'monstruct.h'\" \(515 characters\)
sed "s/^X//" >'monstruct.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 @(#) monstruct.h (1.2) created 1/12/91
X*/
X
X
X/* structures for internal use only... not shm */
X
X#define MNAMELEN	20
X
Xstruct monster_tbl {
X	char name[MNAMELEN], m_sym;
X	short max_hp, hp, mv, mv_used, att_used;
X	short attack, fight, max_dam, level, danger, iq;
X	struct location loc;
X};
X
X
X/* end of file. */
END_OF_FILE
if test 515 -ne `wc -c <'monstruct.h'`; then
    echo shar: \"'monstruct.h'\" unpacked with wrong size!
fi
# end of 'monstruct.h'
fi
if test -f 'msgstruct.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'msgstruct.h'\"
else
echo shar: Extracting \"'msgstruct.h'\" \(528 characters\)
sed "s/^X//" >'msgstruct.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 @(#) msgstruct.h (1.4) created 1/2/91
X*/
X
X
X/* format of a message to the daemon. */
X
Xstruct dmessage {
X	long msg_type;
X	int playernum, cmd, subcmd, arg, ext_arg;
X	char text[35];
X};
X
X#define DMSGSIZ		(sizeof(struct dmessage) - sizeof(long))
X#define NUM_DMSG	40
X#define DQSIZ		(DMSGSIZ * NUM_DMSG)
X
X
X/* end of file. */
END_OF_FILE
if test 528 -ne `wc -c <'msgstruct.h'`; then
    echo shar: \"'msgstruct.h'\" unpacked with wrong size!
fi
# end of 'msgstruct.h'
fi
if test -f 'random.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'random.c'\"
else
echo shar: Extracting \"'random.c'\" \(595 characters\)
sed "s/^X//" >'random.c' <<'END_OF_FILE'
X/*
X	MDG Multiuser Dungeon Game -- random.c random number generator
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 = "@(#) random.c\t(1.1)\tcreated 12/25/90";
X
X#include <stdio.h>
X
X
Xrandom()
X{
X	srand48(time(NULL));
X}
X
X
Xint rnd(top)
Xint top;
X{
X	double result, drand48();
X
X	if(top < 2)
X		return 1;
X
X	return (int)(drand48() * top) + 1;
X}
X
X
Xint go2r(top)
Xint top;
X{
X	int r1, r2;
X
X	r1 = rnd(top);
X	r2 = rnd(top);
X
X	if(r1 > r2)
X		return r1;
X	else
X		return r2;
X}
X
X
X/* end of file. */
END_OF_FILE
if test 595 -ne `wc -c <'random.c'`; then
    echo shar: \"'random.c'\" unpacked with wrong size!
fi
# end of 'random.c'
fi
if test -f 'show.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'show.h'\"
else
echo shar: Extracting \"'show.h'\" \(315 characters\)
sed "s/^X//" >'show.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 @(#) show.h (1.3) created 1/2/91
X*/
X
X
X#define PSTART		17
X
X#define PARK_X		1
X#define PARK_Y		21
X
X
X/* end of file */
END_OF_FILE
if test 315 -ne `wc -c <'show.h'`; then
    echo shar: \"'show.h'\" unpacked with wrong size!
fi
# end of 'show.h'
fi
if test -f 'spells.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'spells.h'\"
else
echo shar: Extracting \"'spells.h'\" \(482 characters\)
sed "s/^X//" >'spells.h' <<'END_OF_FILE'
X/*
X	MDG Multiuser Dungeon Game -- spells.h spells table defines
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	SCCSID @(#) spells.h (1.1) created 12/25/90
X*/
X
X
Xstruct ast {
X	int flag, advance[8], offset[8];
X};
X
X
X#define AS_COLD		0
X#define AS_FIREBALL	1
X#define AS_LIGHTNING	2
X#define AS_ZAP		3
X#define AS_DEATHRAY	4
X
X#define ASF_LIMITED	0
X#define ASF_TRANSPARENT	1
X
X
X/* end of file. */
END_OF_FILE
if test 482 -ne `wc -c <'spells.h'`; then
    echo shar: \"'spells.h'\" unpacked with wrong size!
fi
# end of 'spells.h'
fi
if test -f 'strstr.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'strstr.c'\"
else
echo shar: Extracting \"'strstr.c'\" \(547 characters\)
sed "s/^X//" >'strstr.c' <<'END_OF_FILE'
X/*
X	MDG Multiuser Dungeon Game -- strstr.c
X
X	for systems without strstr() 
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 = "@(#) strstr.c\t(1.1)\tcreated 12/25/90";
X
X#include <stdio.h>
X
X
Xchar *strstr(s1, s2)
Xchar *s1, *s2;
X{
X	int p, q, r;
X
X	for(p = 0; s1[p]; p++) {
X		q = p;
X		r = 0;
X
X		while(s1[q] == s2[r] && s1[q] != '\0')
X			q++, r++;
X
X		if(s2[r] == '\0')
X			return &s1[p];
X	}
X
X	return (char *)NULL;
X}
X
X/* end of file. */
END_OF_FILE
if test 547 -ne `wc -c <'strstr.c'`; then
    echo shar: \"'strstr.c'\" unpacked with wrong size!
fi
# end of 'strstr.c'
fi
if test -f 'spells.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'spells.c'\"
else
echo shar: Extracting \"'spells.c'\" \(1271 characters\)
sed "s/^X//" >'spells.c' <<'END_OF_FILE'
X/*
X	MDG Multiuser Dungeon Game -- spells.c spells table
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 = "@(#) spells.c\t(1.1)\tcreated 12/25/90";
X
X#include "spells.h"
X
X
Xchar *spell_names[] = {
X	"armor",	"block",	"cold",		"detect",
X	"escape",	"fireball",	"glow",		"heal",
X
X	"invisible",	"jump back",	"knight",	"lightning",
X	"missile",	"nightmare",	"obscure",	"partners",
X
X	"quit",		"ray of death",	"seek",		"teleport",
X	"users",	"verify",	"whisper",	"spell x",
X
X	"yank",		"zap",
X};
X
Xint spell_dd[] = {
X	1,		3,		3,		2,
X	5,		3,		1,		2,
X
X	3,		5,		3,		3,
X	2,		4,		3,		3,
X
X	6,		4,		5,		4,
X	4,		3,		2,		4,
X
X	6,		3,
X};
X
X
Xstruct ast a_spell_table[5] = {
X	/* cold */
X	ASF_LIMITED,
X	1,  2,  2,  2,  3,  3,  3,  4,
X	0,  0, -1,  1,  0, -1,  1,  0,
X	/* fireball */
X	ASF_LIMITED,
X	1,  2,  3,  4,  5,  5,  5,  6, 
X	0,  0,  0,  0,  0, -1,  1,  0,  
X	/* lightning */
X	ASF_LIMITED,
X	1,  2,  3,  4,  5,  6,  7,  8, 
X	0,  0,  0,  0,  0,  0,  0,  0,  
X	/* zap */
X	ASF_TRANSPARENT,
X	1,  1,  0, -1, -1, -1,  0,  1,
X	0,  1,  1,  1,  0, -1, -1, -1,
X	/* death ray */
X	ASF_TRANSPARENT,
X	1,  1,  1,  2,  2,  2,  2,  2, 
X	0,  -1, 1,  0, -1,  1, -2,  2,  
X};
X
X
X/* end of file. */
END_OF_FILE
if test 1271 -ne `wc -c <'spells.c'`; then
    echo shar: \"'spells.c'\" unpacked with wrong size!
fi
# end of 'spells.c'
fi
if test -f 'stopdaemon.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'stopdaemon.c'\"
else
echo shar: Extracting \"'stopdaemon.c'\" \(1279 characters\)
sed "s/^X//" >'stopdaemon.c' <<'END_OF_FILE'
X/*
X	MDG Multiuser Dungeon Game -- stopdaemon
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_STOP Copyright 1990 John C. Gonnerman";
Xstatic char *sccsvers = "@(#) stopdaemon.c\t(1.2)\tcreated 1/2/91";
X
X#include <stdio.h>
X#include <string.h>
X#include <sys/types.h>
X#include <sys/ipc.h>
X#include <sys/msg.h>
X
X#include "files.h"
X#include "msgstruct.h"
X#include "messages.h"
X
Xextern long dmsgkey;
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 dmsg_buf;
X	char *strrchr(), *strstr();
X	int mode;
X
X	if((progname = strrchr(argv[0], '/')) == NULL)
X		progname = argv[0];
X
X	mode = '$';
X
X	if(strstr(progname, "stop") != NULL)
X		mode = '@';
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	/* 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	dmsg_buf.msg_type = 1L;
X	dmsg_buf.cmd = mode;
X
X	msgsnd(dqid, &dmsg_buf, DMSGSIZ, IPC_NOWAIT);
X
X	exit(0);
X}
X
X
X/* end of file */
END_OF_FILE
if test 1279 -ne `wc -c <'stopdaemon.c'`; then
    echo shar: \"'stopdaemon.c'\" unpacked with wrong size!
fi
# end of 'stopdaemon.c'
fi
if test -f 'traps.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'traps.c'\"
else
echo shar: Extracting \"'traps.c'\" \(1367 characters\)
sed "s/^X//" >'traps.c' <<'END_OF_FILE'
X/*
X	MDG Multiuser Dungeon Game -- traps.c trap 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 = "@(#) traps.c\t(1.1)\tcreated 12/25/90";
X
X#include "setup.h"
X#include "struct.h"
X
Xextern struct player_seg *pseg;
X
Xint trap_adder[10] = { 0, 1, 2, 3, 4, 1, 2, 1, 2, 3 };
X		    /* 0  1  2  3  4  5  6  7  8  9 */
X
X
Xdo_trap(p_indx, trap)
Xint p_indx, trap;
X{
X	/* note that trap 0 is the pit */
X
X	switch(trap) {
X	case '1' :
X		dmsg_add(p_indx, "Knives hit you!");
X		pgethit(p_indx, rnd(10));
X		break;
X	case '2' :
X		dmsg_add(p_indx, "Spears hit you!");
X		pgethit(p_indx, rnd(15));
X		break;
X	case '3' :
X		dmsg_add(p_indx, "Poison darts hit you!");
X		pgetzapped(p_indx, rnd(15));
X		break;
X	case '4' :
X		dmsg_add(p_indx, "You've been GASSED!");
X		pgetzapped(p_indx, rnd(20));
X		break;
X	case '5' :
X		dmsg_add(p_indx, "Caltrops!");
X		pgethit(p_indx, rnd(10));
X		break;
X	case '6' :
X		dmsg_add(p_indx, "Poison caltrops!");
X		pgetzapped(p_indx, rnd(10));
X		break;
X	case '7' :
X		dmsg_add(p_indx, "A hidden trap!");
X		pgethit(p_indx, rnd(10));
X		break;
X	case '8' :
X		dmsg_add(p_indx, "A hidden trap!");
X		pgethit(p_indx, rnd(15));
X		break;
X	case '9' :
X		dmsg_add(p_indx, "You step in acid!");
X		pgetzapped(p_indx, rnd(15));
X		break;
X	}
X}
X
X
X/* end of file. */
END_OF_FILE
if test 1367 -ne `wc -c <'traps.c'`; then
    echo shar: \"'traps.c'\" unpacked with wrong size!
fi
# end of 'traps.c'
fi
if test -f 'Mk_sun.diff' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Mk_sun.diff'\"
else
echo shar: Extracting \"'Mk_sun.diff'\" \(1707 characters\)
sed "s/^X//" >'Mk_sun.diff' <<'END_OF_FILE'
XThis file is a context diff between the distributed makefile and the
Xmakefile I created in order to compile mdg on a SparcStation 2, using
XSunOS 4.1.1.	billr@saab.cna.tek.com	2/19/91
X
X
X*** /usr/cna/billr/games/todo/mdg/Makefile	Mon Jan 14 11:15:38 1991
X--- Makefile	Tue Feb 19 15:14:46 1991
X***************
X*** 6,12 ****
X--- 6,15 ----
X  
X  SHELL = /bin/sh
X  
X+ CC = /usr/5bin/cc
X  CFLAGS = -g
X+ #LIBS = -ltinfo
X+ LIBS = -lcurses
X  
X  DOBJSA = dmain.o seg.o monsters.o msghandler.o findplayer.o godpower.o
X  DOBJSB = players.o random.o combat.o effect.o ranged.o speak.o dmsg.o
X***************
X*** 28,51 ****
X  all : $(PROGS)
X  
X  mdg_daemon : $(DOBJSA) $(DOBJSB) $(DOBJSC)
X! 	cc $(CFLAGS) -o mdg_daemon $(DOBJSA) $(DOBJSB) $(DOBJSC)
X  
X  mdg : $(GOBJSA) $(GOBJSB)
X! 	cc $(CFLAGS) -o mdg $(GOBJSA) $(GOBJSB) -ltinfo
X  
X  mdg_clock : $(COBJS)
X! 	cc $(CFLAGS) -o mdg_clock $(COBJS)
X  
X  mdg_save : mdg_stop
X  	ln mdg_stop mdg_save
X  
X  mdg_stop : $(SOBJS)
X! 	cc $(CFLAGS) -o mdg_stop $(SOBJS)
X  
X  mdg_char : $(EOBJS)
X! 	cc $(CFLAGS) -o mdg_char $(EOBJS) -ltinfo
X  	
X  ident : $(IOBJS)
X! 	cc $(CFLAGS) -o ident $(IOBJS)
X  
X  # end of Makefile.
X--- 31,54 ----
X  all : $(PROGS)
X  
X  mdg_daemon : $(DOBJSA) $(DOBJSB) $(DOBJSC)
X! 	$(CC) $(CFLAGS) -o mdg_daemon $(DOBJSA) $(DOBJSB) $(DOBJSC)
X  
X  mdg : $(GOBJSA) $(GOBJSB)
X! 	$(CC) $(CFLAGS) -o mdg $(GOBJSA) $(GOBJSB) $(LIBS)
X  
X  mdg_clock : $(COBJS)
X! 	$(CC) $(CFLAGS) -o mdg_clock $(COBJS)
X  
X  mdg_save : mdg_stop
X  	ln mdg_stop mdg_save
X  
X  mdg_stop : $(SOBJS)
X! 	$(CC) $(CFLAGS) -o mdg_stop $(SOBJS)
X  
X  mdg_char : $(EOBJS)
X! 	$(CC) $(CFLAGS) -o mdg_char $(EOBJS) $(LIBS)
X  	
X  ident : $(IOBJS)
X! 	$(CC) $(CFLAGS) -o ident $(IOBJS)
X  
X  # end of Makefile.
END_OF_FILE
if test 1707 -ne `wc -c <'Mk_sun.diff'`; then
    echo shar: \"'Mk_sun.diff'\" unpacked with wrong size!
fi
# end of 'Mk_sun.diff'
fi
echo shar: End of archive 6 \(of 6\).
cp /dev/null ark6isdone
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