Whitespace.
This commit is contained in:
parent
db04762fba
commit
b2f99339f0
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: answer.c,v 1.13 2009/07/04 02:37:20 dholland Exp $ */
|
||||
/* $NetBSD: answer.c,v 1.14 2009/07/04 04:29:54 dholland Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1983-2003, Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -32,63 +32,63 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: answer.c,v 1.13 2009/07/04 02:37:20 dholland Exp $");
|
||||
__RCSID("$NetBSD: answer.c,v 1.14 2009/07/04 04:29:54 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
# include <ctype.h>
|
||||
# include <errno.h>
|
||||
# include <fcntl.h>
|
||||
# include <stdlib.h>
|
||||
# include <unistd.h>
|
||||
# include "hunt.h"
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "hunt.h"
|
||||
|
||||
# define SCOREDECAY 15
|
||||
#define SCOREDECAY 15
|
||||
|
||||
static char Ttyname[NAMELEN];
|
||||
static char Ttyname[NAMELEN];
|
||||
|
||||
int
|
||||
answer(void)
|
||||
{
|
||||
PLAYER *pp;
|
||||
int newsock;
|
||||
static u_long mode;
|
||||
static char name[NAMELEN];
|
||||
static char team;
|
||||
static int enter_status;
|
||||
static socklen_t socklen;
|
||||
static uint32_t machine;
|
||||
static uint32_t uid;
|
||||
static SOCKET sockstruct;
|
||||
char *cp1, *cp2;
|
||||
int flags;
|
||||
u_int32_t version;
|
||||
int i;
|
||||
PLAYER *pp;
|
||||
int newsock;
|
||||
static u_long mode;
|
||||
static char name[NAMELEN];
|
||||
static char team;
|
||||
static int enter_status;
|
||||
static socklen_t socklen;
|
||||
static uint32_t machine;
|
||||
static uint32_t uid;
|
||||
static SOCKET sockstruct;
|
||||
char *cp1, *cp2;
|
||||
int flags;
|
||||
u_int32_t version;
|
||||
int i;
|
||||
|
||||
# ifdef INTERNET
|
||||
#ifdef INTERNET
|
||||
socklen = sizeof sockstruct;
|
||||
# else
|
||||
#else
|
||||
socklen = sizeof sockstruct - 1;
|
||||
# endif
|
||||
#endif
|
||||
errno = 0;
|
||||
newsock = accept(Socket, (struct sockaddr *) &sockstruct, &socklen);
|
||||
if (newsock < 0)
|
||||
{
|
||||
if (errno == EINTR)
|
||||
return FALSE;
|
||||
# ifdef LOG
|
||||
#ifdef LOG
|
||||
syslog(LOG_ERR, "accept: %m");
|
||||
# else
|
||||
#else
|
||||
perror("accept");
|
||||
# endif
|
||||
#endif
|
||||
cleanup(1);
|
||||
}
|
||||
|
||||
# ifdef INTERNET
|
||||
#ifdef INTERNET
|
||||
machine = ntohl(((struct sockaddr_in *) &sockstruct)->sin_addr.s_addr);
|
||||
# else
|
||||
#else
|
||||
if (machine == 0)
|
||||
machine = gethostid();
|
||||
# endif
|
||||
#endif
|
||||
version = htonl((u_int32_t) HUNT_VERSION);
|
||||
(void) write(newsock, &version, LONGLEN);
|
||||
(void) read(newsock, &uid, LONGLEN);
|
||||
|
@ -125,7 +125,7 @@ answer(void)
|
|||
*cp2++ = *cp1;
|
||||
*cp2 = '\0';
|
||||
|
||||
# ifdef INTERNET
|
||||
#ifdef INTERNET
|
||||
if (mode == C_MESSAGE) {
|
||||
char buf[BUFSIZ + 1];
|
||||
int n;
|
||||
|
@ -153,8 +153,8 @@ answer(void)
|
|||
return FALSE;
|
||||
}
|
||||
else
|
||||
# endif
|
||||
# ifdef MONITOR
|
||||
#endif
|
||||
#ifdef MONITOR
|
||||
if (mode == C_MONITOR)
|
||||
if (End_monitor < &Monitor[MAXMON]) {
|
||||
pp = End_monitor++;
|
||||
|
@ -167,7 +167,7 @@ answer(void)
|
|||
return FALSE;
|
||||
}
|
||||
else
|
||||
# endif
|
||||
#endif
|
||||
if (End_player < &Player[MAXPL]) {
|
||||
pp = End_player++;
|
||||
i = pp - Player + 3;
|
||||
|
@ -193,21 +193,21 @@ answer(void)
|
|||
pp->p_y = 0;
|
||||
pp->p_x = 0;
|
||||
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
if (mode == C_MONITOR)
|
||||
stmonitor(pp);
|
||||
else
|
||||
# endif
|
||||
#endif
|
||||
stplayer(pp, enter_status);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
void
|
||||
stmonitor(PLAYER *pp)
|
||||
{
|
||||
int line;
|
||||
PLAYER *npp;
|
||||
int line;
|
||||
PLAYER *npp;
|
||||
|
||||
memcpy(pp->p_maze, Maze, sizeof Maze);
|
||||
|
||||
|
@ -230,13 +230,13 @@ stmonitor(PLAYER *pp)
|
|||
sendcom(pp, READY, 0);
|
||||
(void) fflush(pp->p_output);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
void
|
||||
stplayer(PLAYER *newpp, int enter_status)
|
||||
{
|
||||
int x, y;
|
||||
PLAYER *pp;
|
||||
int x, y;
|
||||
PLAYER *pp;
|
||||
|
||||
Nplayer++;
|
||||
|
||||
|
@ -264,7 +264,7 @@ stplayer(PLAYER *newpp, int enter_status)
|
|||
newpp->p_y = y;
|
||||
newpp->p_undershot = FALSE;
|
||||
|
||||
# ifdef FLY
|
||||
#ifdef FLY
|
||||
if (enter_status == Q_FLY) {
|
||||
newpp->p_flying = rand_num(20);
|
||||
newpp->p_flyx = 2 * rand_num(6) - 5;
|
||||
|
@ -272,7 +272,7 @@ stplayer(PLAYER *newpp, int enter_status)
|
|||
newpp->p_face = FLYER;
|
||||
}
|
||||
else
|
||||
# endif
|
||||
#endif
|
||||
{
|
||||
newpp->p_flying = -1;
|
||||
newpp->p_face = rand_dir();
|
||||
|
@ -283,9 +283,9 @@ stplayer(PLAYER *newpp, int enter_status)
|
|||
newpp->p_ncount = 0;
|
||||
newpp->p_nexec = 0;
|
||||
newpp->p_ammo = ISHOTS;
|
||||
# ifdef BOOTS
|
||||
#ifdef BOOTS
|
||||
newpp->p_nboots = 0;
|
||||
# endif
|
||||
#endif
|
||||
if (enter_status == Q_SCAN) {
|
||||
newpp->p_scan = SCANLEN;
|
||||
newpp->p_cloak = 0;
|
||||
|
@ -301,20 +301,20 @@ stplayer(PLAYER *newpp, int enter_status)
|
|||
y = rand_num(HEIGHT - 1) + 1;
|
||||
} while (Maze[y][x] != SPACE);
|
||||
Maze[y][x] = GMINE;
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; pp++)
|
||||
check(pp, y, x);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
do {
|
||||
x = rand_num(WIDTH - 1) + 1;
|
||||
y = rand_num(HEIGHT - 1) + 1;
|
||||
} while (Maze[y][x] != SPACE);
|
||||
Maze[y][x] = MINE;
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; pp++)
|
||||
check(pp, y, x);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
(void) snprintf(Buf, sizeof(Buf), "%5.2f%c%-10.10s %c",
|
||||
newpp->p_ident->i_score,
|
||||
|
@ -335,21 +335,21 @@ stplayer(PLAYER *newpp, int enter_status)
|
|||
outstr(pp, smallbuf, 3);
|
||||
}
|
||||
}
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; pp++) {
|
||||
cgoto(pp, y, STAT_NAME_COL);
|
||||
outstr(pp, Buf, STAT_NAME_LEN);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
drawmaze(newpp);
|
||||
drawplayer(newpp, TRUE);
|
||||
look(newpp);
|
||||
# ifdef FLY
|
||||
#ifdef FLY
|
||||
if (enter_status == Q_FLY)
|
||||
/* Make sure that the position you enter in will be erased */
|
||||
showexpl(newpp->p_y, newpp->p_x, FLYER);
|
||||
# endif
|
||||
#endif
|
||||
sendcom(newpp, REFRESH);
|
||||
sendcom(newpp, READY, 0);
|
||||
(void) fflush(newpp->p_output);
|
||||
|
@ -383,8 +383,8 @@ rand_dir(void)
|
|||
IDENT *
|
||||
get_ident(uint32_t machine, uint32_t uid, char *name, char team)
|
||||
{
|
||||
IDENT *ip;
|
||||
static IDENT punt;
|
||||
IDENT *ip;
|
||||
static IDENT punt;
|
||||
|
||||
for (ip = Scores; ip != NULL; ip = ip->i_next)
|
||||
if (ip->i_machine == machine
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bsd.h,v 1.4 2003/06/11 12:00:22 wiz Exp $ */
|
||||
/* $NetBSD: bsd.h,v 1.5 2009/07/04 04:29:54 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983-2003, Regents of the University of California.
|
||||
|
@ -31,10 +31,11 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
# if defined(BSD_RELEASE) && BSD_RELEASE >= 43
|
||||
# define BROADCAST
|
||||
# define SYSLOG_43
|
||||
# endif
|
||||
# if defined(BSD_RELEASE) && BSD_RELEASE == 42
|
||||
# define SYSLOG_42
|
||||
# endif
|
||||
#if defined(BSD_RELEASE) && BSD_RELEASE >= 43
|
||||
#define BROADCAST
|
||||
#define SYSLOG_43
|
||||
#endif
|
||||
|
||||
#if defined(BSD_RELEASE) && BSD_RELEASE == 42
|
||||
#define SYSLOG_42
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ctl.c,v 1.4 2009/07/04 02:37:20 dholland Exp $ */
|
||||
/* $NetBSD: ctl.c,v 1.5 2009/07/04 04:29:54 dholland Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1983-2003, Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -32,14 +32,14 @@
|
|||
|
||||
#include "bsd.h"
|
||||
|
||||
#if defined(TALK_43) || defined(TALK_42)
|
||||
#if defined(TALK_43) || defined(TALK_42)
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ctl.c 5.2 (Berkeley) 3/13/86";
|
||||
#else
|
||||
__RCSID("$NetBSD: ctl.c,v 1.4 2009/07/04 02:37:20 dholland Exp $");
|
||||
__RCSID("$NetBSD: ctl.c,v 1.5 2009/07/04 04:29:54 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -52,16 +52,16 @@ __RCSID("$NetBSD: ctl.c,v 1.4 2009/07/04 02:37:20 dholland Exp $");
|
|||
#include "hunt.h"
|
||||
#include "talk_ctl.h"
|
||||
|
||||
struct sockaddr_in daemon_addr = { AF_INET };
|
||||
struct sockaddr_in ctl_addr = { AF_INET };
|
||||
struct sockaddr_in daemon_addr = { AF_INET };
|
||||
struct sockaddr_in ctl_addr = { AF_INET };
|
||||
|
||||
/* inet addresses of the two machines */
|
||||
struct in_addr my_machine_addr;
|
||||
struct in_addr his_machine_addr;
|
||||
/* inet addresses of the two machines */
|
||||
struct in_addr my_machine_addr;
|
||||
struct in_addr his_machine_addr;
|
||||
|
||||
u_short daemon_port; /* port number of the talk daemon */
|
||||
|
||||
int ctl_sockt;
|
||||
int ctl_sockt;
|
||||
|
||||
CTL_MSG msg;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ctl_transact.c,v 1.8 2009/07/04 02:37:20 dholland Exp $ */
|
||||
/* $NetBSD: ctl_transact.c,v 1.9 2009/07/04 04:29:54 dholland Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1983-2003, Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -32,14 +32,14 @@
|
|||
|
||||
#include "bsd.h"
|
||||
|
||||
#if defined(TALK_43) || defined(TALK_42)
|
||||
#if defined(TALK_43) || defined(TALK_42)
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ctl_transact.c 5.2 (Berkeley) 3/13/86";
|
||||
#else
|
||||
__RCSID("$NetBSD: ctl_transact.c,v 1.8 2009/07/04 02:37:20 dholland Exp $");
|
||||
__RCSID("$NetBSD: ctl_transact.c,v 1.9 2009/07/04 04:29:54 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -109,20 +109,20 @@ ctl_transact(struct in_addr target, CTL_MSG msg, int type, CTL_RESPONSE *rp)
|
|||
/* an immediate poll */
|
||||
nready = poll(set, 1, 0);
|
||||
} while (nready > 0 && (
|
||||
#ifdef TALK_43
|
||||
#ifdef TALK_43
|
||||
rp->vers != TALK_VERSION ||
|
||||
#endif
|
||||
rp->type != type));
|
||||
} while (
|
||||
#ifdef TALK_43
|
||||
#ifdef TALK_43
|
||||
rp->vers != TALK_VERSION ||
|
||||
#endif
|
||||
rp->type != type);
|
||||
rp->id_num = ntohl(rp->id_num);
|
||||
#ifdef TALK_43
|
||||
#ifdef TALK_43
|
||||
rp->addr.sa_family = ntohs(rp->addr.sa_family);
|
||||
# else
|
||||
#else
|
||||
rp->addr.sin_family = ntohs(rp->addr.sin_family);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: draw.c,v 1.6 2009/07/04 02:37:20 dholland Exp $ */
|
||||
/* $NetBSD: draw.c,v 1.7 2009/07/04 04:29:54 dholland Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1983-2003, Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -32,18 +32,18 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: draw.c,v 1.6 2009/07/04 02:37:20 dholland Exp $");
|
||||
__RCSID("$NetBSD: draw.c,v 1.7 2009/07/04 04:29:54 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
# include "hunt.h"
|
||||
#include "hunt.h"
|
||||
|
||||
void
|
||||
drawmaze(PLAYER *pp)
|
||||
{
|
||||
int x;
|
||||
char *sp;
|
||||
int y;
|
||||
char *endp;
|
||||
int x;
|
||||
char *sp;
|
||||
int y;
|
||||
char *endp;
|
||||
|
||||
clrscr(pp);
|
||||
outstr(pp, pp->p_maze[0], WIDTH);
|
||||
|
@ -72,8 +72,8 @@ drawmaze(PLAYER *pp)
|
|||
void
|
||||
drawstatus(PLAYER *pp)
|
||||
{
|
||||
int i;
|
||||
PLAYER *np;
|
||||
int i;
|
||||
PLAYER *np;
|
||||
|
||||
cgoto(pp, STAT_AMMO_ROW, STAT_LABEL_COL);
|
||||
outstr(pp, "Ammo:", 5);
|
||||
|
@ -110,7 +110,7 @@ drawstatus(PLAYER *pp)
|
|||
outstr(pp, Buf, STAT_NAME_LEN);
|
||||
}
|
||||
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
cgoto(pp, STAT_MON_ROW, STAT_LABEL_COL);
|
||||
outstr(pp, "Monitor:", 8);
|
||||
for (i = STAT_MON_ROW + 1, np = Monitor; np < End_monitor; np++) {
|
||||
|
@ -119,13 +119,13 @@ drawstatus(PLAYER *pp)
|
|||
cgoto(pp, i++, STAT_NAME_COL);
|
||||
outstr(pp, Buf, STAT_NAME_LEN);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
look(PLAYER *pp)
|
||||
{
|
||||
int x, y;
|
||||
int x, y;
|
||||
|
||||
x = pp->p_x;
|
||||
y = pp->p_y;
|
||||
|
@ -161,10 +161,10 @@ look(PLAYER *pp)
|
|||
see(pp, LEFTS);
|
||||
see(pp, RIGHT);
|
||||
break;
|
||||
# ifdef FLY
|
||||
#ifdef FLY
|
||||
case FLYER:
|
||||
break;
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
cgoto(pp, y, x);
|
||||
}
|
||||
|
@ -172,8 +172,8 @@ look(PLAYER *pp)
|
|||
void
|
||||
see(PLAYER *pp, int face)
|
||||
{
|
||||
char *sp;
|
||||
int y, x, i, cnt;
|
||||
char *sp;
|
||||
int y, x, i, cnt;
|
||||
|
||||
x = pp->p_x;
|
||||
y = pp->p_y;
|
||||
|
@ -257,9 +257,9 @@ see(PLAYER *pp, int face)
|
|||
void
|
||||
check(PLAYER *pp, int y, int x)
|
||||
{
|
||||
int indx;
|
||||
int ch;
|
||||
PLAYER *rpp;
|
||||
int indx;
|
||||
int ch;
|
||||
PLAYER *rpp;
|
||||
|
||||
indx = y * sizeof Maze[0] + x;
|
||||
ch = ((char *) Maze)[indx];
|
||||
|
@ -283,18 +283,18 @@ check(PLAYER *pp, int y, int x)
|
|||
void
|
||||
showstat(PLAYER *pp)
|
||||
{
|
||||
PLAYER *np;
|
||||
int y;
|
||||
char c;
|
||||
PLAYER *np;
|
||||
int y;
|
||||
char c;
|
||||
|
||||
y = STAT_PLAY_ROW + 1 + (pp - Player);
|
||||
c = stat_char(pp);
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (np = Monitor; np < End_monitor; np++) {
|
||||
cgoto(np, y, STAT_SCAN_COL);
|
||||
outch(np, c);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
for (np = Player; np < End_player; np++) {
|
||||
cgoto(np, y, STAT_SCAN_COL);
|
||||
outch(np, c);
|
||||
|
@ -309,17 +309,17 @@ showstat(PLAYER *pp)
|
|||
void
|
||||
drawplayer(PLAYER *pp, FLAG draw)
|
||||
{
|
||||
PLAYER *newp;
|
||||
int x, y;
|
||||
PLAYER *newp;
|
||||
int x, y;
|
||||
|
||||
x = pp->p_x;
|
||||
y = pp->p_y;
|
||||
Maze[y][x] = draw ? pp->p_face : pp->p_over;
|
||||
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (newp = Monitor; newp < End_monitor; newp++)
|
||||
check(newp, y, x);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
for (newp = Player; newp < End_player; newp++) {
|
||||
if (!draw || newp == pp) {
|
||||
|
@ -378,7 +378,7 @@ translate(char ch)
|
|||
int
|
||||
player_sym(PLAYER *pp, int y, int x)
|
||||
{
|
||||
PLAYER *npp;
|
||||
PLAYER *npp;
|
||||
|
||||
npp = play_at(y, x);
|
||||
if (npp->p_ident->i_team == ' ')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: driver.c,v 1.16 2009/07/04 02:37:20 dholland Exp $ */
|
||||
/* $NetBSD: driver.c,v 1.17 2009/07/04 04:29:54 dholland Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1983-2003, Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -32,49 +32,50 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: driver.c,v 1.16 2009/07/04 02:37:20 dholland Exp $");
|
||||
__RCSID("$NetBSD: driver.c,v 1.17 2009/07/04 04:29:54 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
# include <sys/ioctl.h>
|
||||
# include <sys/stat.h>
|
||||
# include <sys/time.h>
|
||||
# include <err.h>
|
||||
# include <errno.h>
|
||||
# include <signal.h>
|
||||
# include <stdlib.h>
|
||||
# include <unistd.h>
|
||||
# include "hunt.h"
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include"hunt.h"
|
||||
|
||||
# ifndef pdp11
|
||||
# define RN (((Seed = Seed * 11109 + 13849) >> 16) & 0xffff)
|
||||
# else
|
||||
# define RN ((Seed = Seed * 11109 + 13849) & 0x7fff)
|
||||
# endif
|
||||
#ifndef pdp11
|
||||
#define RN (((Seed = Seed * 11109 + 13849) >> 16) & 0xffff)
|
||||
#else
|
||||
#define RN ((Seed = Seed * 11109 + 13849) & 0x7fff)
|
||||
#endif
|
||||
|
||||
int Seed = 0;
|
||||
int Seed = 0;
|
||||
|
||||
|
||||
SOCKET Daemon;
|
||||
char *First_arg; /* pointer to argv[0] */
|
||||
char *Last_arg; /* pointer to end of argv/environ */
|
||||
# ifdef INTERNET
|
||||
int Test_socket; /* test socket to answer datagrams */
|
||||
FLAG inetd_spawned; /* invoked via inetd */
|
||||
FLAG standard_port = TRUE; /* true if listening on standard port */
|
||||
SOCKET Daemon;
|
||||
char *First_arg; /* pointer to argv[0] */
|
||||
char *Last_arg; /* pointer to end of argv/environ */
|
||||
|
||||
#ifdef INTERNET
|
||||
int Test_socket; /* test socket to answer datagrams */
|
||||
FLAG inetd_spawned; /* invoked via inetd */
|
||||
FLAG standard_port = TRUE; /* true if listening on standard port */
|
||||
u_short sock_port; /* port # of tcp listen socket */
|
||||
u_short stat_port; /* port # of statistics tcp socket */
|
||||
# define DAEMON_SIZE (sizeof Daemon)
|
||||
# else
|
||||
# define DAEMON_SIZE (sizeof Daemon - 1)
|
||||
# endif
|
||||
#define DAEMON_SIZE (sizeof Daemon)
|
||||
#else
|
||||
#define DAEMON_SIZE (sizeof Daemon - 1)
|
||||
#endif
|
||||
|
||||
static void clear_scores(void);
|
||||
static int havechar(PLAYER *, int);
|
||||
static void init(void);
|
||||
int main(int, char *[], char *[]);
|
||||
static void makeboots(void);
|
||||
static void send_stats(void);
|
||||
static void zap(PLAYER *, FLAG, int);
|
||||
static void clear_scores(void);
|
||||
static int havechar(PLAYER *, int);
|
||||
static void init(void);
|
||||
int main(int, char *[], char *[]);
|
||||
static void makeboots(void);
|
||||
static void send_stats(void);
|
||||
static void zap(PLAYER *, FLAG, int);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -84,17 +85,17 @@ static void zap(PLAYER *, FLAG, int);
|
|||
int
|
||||
main(int ac, char **av, char **ep)
|
||||
{
|
||||
PLAYER *pp;
|
||||
# ifdef INTERNET
|
||||
u_short msg;
|
||||
short port_num, reply;
|
||||
socklen_t namelen;
|
||||
SOCKET test;
|
||||
# endif
|
||||
static FLAG first = TRUE;
|
||||
static FLAG server = FALSE;
|
||||
int c, i;
|
||||
const int linger = 90 * 1000;
|
||||
PLAYER *pp;
|
||||
#ifdef INTERNET
|
||||
u_short msg;
|
||||
short port_num, reply;
|
||||
socklen_t namelen;
|
||||
SOCKET test;
|
||||
#endif
|
||||
static FLAG first = TRUE;
|
||||
static FLAG server = FALSE;
|
||||
int c, i;
|
||||
const int linger = 90 * 1000;
|
||||
|
||||
First_arg = av[0];
|
||||
if (ep == NULL || *ep == NULL)
|
||||
|
@ -108,12 +109,12 @@ main(int ac, char **av, char **ep)
|
|||
case 's':
|
||||
server = TRUE;
|
||||
break;
|
||||
# ifdef INTERNET
|
||||
#ifdef INTERNET
|
||||
case 'p':
|
||||
standard_port = FALSE;
|
||||
Test_port = atoi(optarg);
|
||||
break;
|
||||
# endif
|
||||
#endif
|
||||
default:
|
||||
erred:
|
||||
fprintf(stderr, "Usage: %s [-s] [-p port]\n", av[0]);
|
||||
|
@ -132,14 +133,14 @@ again:
|
|||
while (poll(fdset, 3+MAXPL+MAXMON, INFTIM) < 0)
|
||||
{
|
||||
if (errno != EINTR)
|
||||
# ifdef LOG
|
||||
#ifdef LOG
|
||||
syslog(LOG_WARNING, "poll: %m");
|
||||
# else
|
||||
#else
|
||||
warn("poll");
|
||||
# endif
|
||||
#endif
|
||||
errno = 0;
|
||||
}
|
||||
# ifdef INTERNET
|
||||
#ifdef INTERNET
|
||||
if (fdset[2].revents & POLLIN) {
|
||||
namelen = DAEMON_SIZE;
|
||||
port_num = htons(sock_port);
|
||||
|
@ -171,40 +172,40 @@ again:
|
|||
break;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
{
|
||||
for (pp = Player, i = 0; pp < End_player; pp++, i++)
|
||||
if (havechar(pp, i + 3)) {
|
||||
execute(pp);
|
||||
pp->p_nexec++;
|
||||
}
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor, i = 0; pp < End_monitor; pp++, i++)
|
||||
if (havechar(pp, i + MAXPL + 3)) {
|
||||
mon_execute(pp);
|
||||
pp->p_nexec++;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
moveshots();
|
||||
for (pp = Player, i = 0; pp < End_player; )
|
||||
if (pp->p_death[0] != '\0')
|
||||
zap(pp, TRUE, i + 3);
|
||||
else
|
||||
pp++, i++;
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor, i = 0; pp < End_monitor; )
|
||||
if (pp->p_death[0] != '\0')
|
||||
zap(pp, FALSE, i + MAXPL + 3);
|
||||
else
|
||||
pp++, i++;
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
if (fdset[0].revents & POLLIN)
|
||||
if (answer()) {
|
||||
# ifdef INTERNET
|
||||
#ifdef INTERNET
|
||||
if (first && standard_port)
|
||||
faketalk();
|
||||
# endif
|
||||
#endif
|
||||
first = FALSE;
|
||||
}
|
||||
if (fdset[1].revents & POLLIN)
|
||||
|
@ -215,14 +216,14 @@ again:
|
|||
pp->p_nexec = 0;
|
||||
(void) fflush(pp->p_output);
|
||||
}
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor, i = 0; pp < End_monitor; pp++, i++) {
|
||||
if (fdset[i + MAXPL + 3].revents & POLLIN)
|
||||
sendcom(pp, READY, pp->p_nexec);
|
||||
pp->p_nexec = 0;
|
||||
(void) fflush(pp->p_output);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
} while (Nplayer > 0);
|
||||
|
||||
if (poll(fdset, 3+MAXPL+MAXMON, linger) > 0) {
|
||||
|
@ -232,17 +233,17 @@ again:
|
|||
clear_scores();
|
||||
makemaze();
|
||||
clearwalls();
|
||||
# ifdef BOOTS
|
||||
#ifdef BOOTS
|
||||
makeboots();
|
||||
# endif
|
||||
#endif
|
||||
first = TRUE;
|
||||
goto again;
|
||||
}
|
||||
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor, i = 0; pp < End_monitor; i++)
|
||||
zap(pp, FALSE, i + MAXPL + 3);
|
||||
# endif
|
||||
#endif
|
||||
cleanup(0);
|
||||
/* NOTREACHED */
|
||||
return(0);
|
||||
|
@ -255,125 +256,125 @@ again:
|
|||
static void
|
||||
init(void)
|
||||
{
|
||||
int i;
|
||||
# ifdef INTERNET
|
||||
SOCKET test_port;
|
||||
int msg;
|
||||
socklen_t len;
|
||||
# endif
|
||||
int i;
|
||||
#ifdef INTERNET
|
||||
SOCKET test_port;
|
||||
int msg;
|
||||
socklen_t len;
|
||||
#endif
|
||||
|
||||
# ifndef DEBUG
|
||||
# ifdef TIOCNOTTY
|
||||
#ifndef DEBUG
|
||||
#ifdef TIOCNOTTY
|
||||
(void) ioctl(fileno(stdout), TIOCNOTTY, NULL);
|
||||
# endif
|
||||
#endif
|
||||
(void) setpgrp(getpid(), getpid());
|
||||
(void) signal(SIGHUP, SIG_IGN);
|
||||
(void) signal(SIGINT, SIG_IGN);
|
||||
(void) signal(SIGQUIT, SIG_IGN);
|
||||
(void) signal(SIGTERM, cleanup);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
(void) chdir("/var/tmp"); /* just in case it core dumps */
|
||||
(void) umask(0); /* No privacy at all! */
|
||||
(void) signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
# ifdef LOG
|
||||
# ifdef SYSLOG_43
|
||||
#ifdef LOG
|
||||
#ifdef SYSLOG_43
|
||||
openlog("huntd", LOG_PID, LOG_DAEMON);
|
||||
# endif
|
||||
# ifdef SYSLOG_42
|
||||
#endif
|
||||
#ifdef SYSLOG_42
|
||||
openlog("huntd", LOG_PID);
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize statistics socket
|
||||
*/
|
||||
# ifdef INTERNET
|
||||
#ifdef INTERNET
|
||||
Daemon.sin_family = SOCK_FAMILY;
|
||||
Daemon.sin_addr.s_addr = INADDR_ANY;
|
||||
Daemon.sin_port = 0;
|
||||
# else
|
||||
#else
|
||||
Daemon.sun_family = SOCK_FAMILY;
|
||||
(void) strcpy(Daemon.sun_path, Stat_name);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
Status = socket(SOCK_FAMILY, SOCK_STREAM, 0);
|
||||
if (bind(Status, (struct sockaddr *) &Daemon, DAEMON_SIZE) < 0) {
|
||||
if (errno == EADDRINUSE)
|
||||
exit(0);
|
||||
else {
|
||||
# ifdef LOG
|
||||
#ifdef LOG
|
||||
syslog(LOG_ERR, "bind: %m");
|
||||
# else
|
||||
#else
|
||||
warn("bind");
|
||||
# endif
|
||||
#endif
|
||||
cleanup(1);
|
||||
}
|
||||
}
|
||||
(void) listen(Status, 5);
|
||||
|
||||
# ifdef INTERNET
|
||||
#ifdef INTERNET
|
||||
len = sizeof (SOCKET);
|
||||
if (getsockname(Status, (struct sockaddr *) &Daemon, &len) < 0) {
|
||||
# ifdef LOG
|
||||
#ifdef LOG
|
||||
syslog(LOG_ERR, "getsockname: %m");
|
||||
# else
|
||||
#else
|
||||
warn("getsockname");
|
||||
# endif
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
stat_port = ntohs(Daemon.sin_port);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize main socket
|
||||
*/
|
||||
# ifdef INTERNET
|
||||
#ifdef INTERNET
|
||||
Daemon.sin_family = SOCK_FAMILY;
|
||||
Daemon.sin_addr.s_addr = INADDR_ANY;
|
||||
Daemon.sin_port = 0;
|
||||
# else
|
||||
#else
|
||||
Daemon.sun_family = SOCK_FAMILY;
|
||||
(void) strcpy(Daemon.sun_path, Sock_name);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
Socket = socket(SOCK_FAMILY, SOCK_STREAM, 0);
|
||||
# if defined(INTERNET)
|
||||
#if defined(INTERNET)
|
||||
msg = 1;
|
||||
if (setsockopt(Socket, SOL_SOCKET, SO_USELOOPBACK, &msg, sizeof msg)<0)
|
||||
# ifdef LOG
|
||||
#ifdef LOG
|
||||
syslog(LOG_WARNING, "setsockopt loopback %m");
|
||||
# else
|
||||
#else
|
||||
warn("setsockopt loopback");
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
if (bind(Socket, (struct sockaddr *) &Daemon, DAEMON_SIZE) < 0) {
|
||||
if (errno == EADDRINUSE)
|
||||
exit(0);
|
||||
else {
|
||||
# ifdef LOG
|
||||
#ifdef LOG
|
||||
syslog(LOG_ERR, "bind: %m");
|
||||
# else
|
||||
#else
|
||||
warn("bind");
|
||||
# endif
|
||||
#endif
|
||||
cleanup(1);
|
||||
}
|
||||
}
|
||||
(void) listen(Socket, 5);
|
||||
|
||||
# ifdef INTERNET
|
||||
#ifdef INTERNET
|
||||
len = sizeof (SOCKET);
|
||||
if (getsockname(Socket, (struct sockaddr *) &Daemon, &len) < 0) {
|
||||
# ifdef LOG
|
||||
#ifdef LOG
|
||||
syslog(LOG_ERR, "getsockname: %m");
|
||||
# else
|
||||
#else
|
||||
warn("getsockname");
|
||||
# endif
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
sock_port = ntohs(Daemon.sin_port);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize minimal poll mask
|
||||
|
@ -383,7 +384,7 @@ init(void)
|
|||
fdset[1].fd = Status;
|
||||
fdset[1].events = POLLIN;
|
||||
|
||||
# ifdef INTERNET
|
||||
#ifdef INTERNET
|
||||
len = sizeof (SOCKET);
|
||||
if (getsockname(0, (struct sockaddr *) &test_port, &len) >= 0
|
||||
&& test_port.sin_family == AF_INET) {
|
||||
|
@ -400,11 +401,11 @@ init(void)
|
|||
Test_socket = socket(SOCK_FAMILY, SOCK_DGRAM, 0);
|
||||
if (bind(Test_socket, (struct sockaddr *) &test_port,
|
||||
DAEMON_SIZE) < 0) {
|
||||
# ifdef LOG
|
||||
#ifdef LOG
|
||||
syslog(LOG_ERR, "bind: %m");
|
||||
# else
|
||||
#else
|
||||
warn("bind");
|
||||
# endif
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
(void) listen(Test_socket, 5);
|
||||
|
@ -412,15 +413,15 @@ init(void)
|
|||
|
||||
fdset[2].fd = Test_socket;
|
||||
fdset[2].events = POLLIN;
|
||||
# else
|
||||
#else
|
||||
fdset[2].fd = -1;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
Seed = getpid() + time((time_t *) NULL);
|
||||
makemaze();
|
||||
# ifdef BOOTS
|
||||
#ifdef BOOTS
|
||||
makeboots();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
for (i = 0; i < NASCII; i++)
|
||||
See_over[i] = TRUE;
|
||||
|
@ -428,14 +429,14 @@ init(void)
|
|||
See_over[WALL1] = FALSE;
|
||||
See_over[WALL2] = FALSE;
|
||||
See_over[WALL3] = FALSE;
|
||||
# ifdef REFLECT
|
||||
#ifdef REFLECT
|
||||
See_over[WALL4] = FALSE;
|
||||
See_over[WALL5] = FALSE;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
# ifdef BOOTS
|
||||
#ifdef BOOTS
|
||||
/*
|
||||
* makeboots:
|
||||
* Put the boots in the maze
|
||||
|
@ -443,8 +444,8 @@ init(void)
|
|||
static void
|
||||
makeboots(void)
|
||||
{
|
||||
int x, y;
|
||||
PLAYER *pp;
|
||||
int x, y;
|
||||
PLAYER *pp;
|
||||
|
||||
do {
|
||||
x = rand_num(WIDTH - 1) + 1;
|
||||
|
@ -454,7 +455,7 @@ makeboots(void)
|
|||
for (pp = Boot; pp < &Boot[NBOOTS]; pp++)
|
||||
pp->p_flying = -1;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
@ -465,11 +466,11 @@ void
|
|||
checkdam(PLAYER *ouch, PLAYER *gotcha, IDENT *credit, int amt,
|
||||
char this_shot_type)
|
||||
{
|
||||
const char *cp;
|
||||
const char *cp;
|
||||
|
||||
if (ouch->p_death[0] != '\0')
|
||||
return;
|
||||
# ifdef BOOTS
|
||||
#ifdef BOOTS
|
||||
if (this_shot_type == SLIME)
|
||||
switch (ouch->p_nboots) {
|
||||
default:
|
||||
|
@ -482,7 +483,7 @@ checkdam(PLAYER *ouch, PLAYER *gotcha, IDENT *credit, int amt,
|
|||
message(gotcha, "He has boots on!");
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
ouch->p_damage += amt;
|
||||
if (ouch->p_damage <= ouch->p_damcap) {
|
||||
(void) snprintf(Buf, sizeof(Buf), "%2d", ouch->p_damage);
|
||||
|
@ -496,11 +497,11 @@ checkdam(PLAYER *ouch, PLAYER *gotcha, IDENT *credit, int amt,
|
|||
default:
|
||||
cp = "Killed";
|
||||
break;
|
||||
# ifdef FLY
|
||||
#ifdef FLY
|
||||
case FALL:
|
||||
cp = "Killed on impact";
|
||||
break;
|
||||
# endif
|
||||
#endif
|
||||
case KNIFE:
|
||||
cp = "Stabbed to death";
|
||||
ouch->p_ammo = 0; /* No exploding */
|
||||
|
@ -517,23 +518,23 @@ checkdam(PLAYER *ouch, PLAYER *gotcha, IDENT *credit, int amt,
|
|||
case GMINE:
|
||||
cp = "Blown apart";
|
||||
break;
|
||||
# ifdef OOZE
|
||||
#ifdef OOZE
|
||||
case SLIME:
|
||||
cp = "Slimed";
|
||||
if (credit != NULL)
|
||||
credit->i_slime++;
|
||||
break;
|
||||
# endif
|
||||
# ifdef VOLCANO
|
||||
#endif
|
||||
#ifdef VOLCANO
|
||||
case LAVA:
|
||||
cp = "Baked";
|
||||
break;
|
||||
# endif
|
||||
# ifdef DRONE
|
||||
#endif
|
||||
#ifdef DRONE
|
||||
case DSHOT:
|
||||
cp = "Eliminated";
|
||||
break;
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
if (credit == NULL) {
|
||||
(void) snprintf(ouch->p_death, sizeof(ouch->p_death),
|
||||
|
@ -583,13 +584,13 @@ checkdam(PLAYER *ouch, PLAYER *gotcha, IDENT *credit, int amt,
|
|||
STAT_NAME_COL);
|
||||
outstr(ouch, Buf, 5);
|
||||
}
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (ouch = Monitor; ouch < End_monitor; ouch++) {
|
||||
cgoto(ouch, STAT_PLAY_ROW + 1 + (gotcha - Player),
|
||||
STAT_NAME_COL);
|
||||
outstr(ouch, Buf, 5);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -599,11 +600,11 @@ checkdam(PLAYER *ouch, PLAYER *gotcha, IDENT *credit, int amt,
|
|||
static void
|
||||
zap(PLAYER *pp, FLAG was_player, int i)
|
||||
{
|
||||
int n, len;
|
||||
BULLET *bp;
|
||||
PLAYER *np;
|
||||
int x, y;
|
||||
int savefd;
|
||||
int n, len;
|
||||
BULLET *bp;
|
||||
PLAYER *np;
|
||||
int x, y;
|
||||
int savefd;
|
||||
|
||||
if (was_player) {
|
||||
if (pp->p_undershot)
|
||||
|
@ -628,9 +629,9 @@ zap(PLAYER *pp, FLAG was_player, int i)
|
|||
|
||||
savefd = pp->p_fd;
|
||||
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
if (was_player) {
|
||||
# endif
|
||||
#endif
|
||||
for (bp = Bullets; bp != NULL; bp = bp->b_next) {
|
||||
if (bp->b_owner == pp)
|
||||
bp->b_owner = NULL;
|
||||
|
@ -671,11 +672,11 @@ zap(PLAYER *pp, FLAG was_player, int i)
|
|||
pp->p_ident->i_name);
|
||||
for (np = Player; np < End_player; np++)
|
||||
message(np, Buf);
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (np = Monitor; np < End_monitor; np++)
|
||||
message(np, Buf);
|
||||
# endif
|
||||
# ifdef BOOTS
|
||||
#endif
|
||||
#ifdef BOOTS
|
||||
while (pp->p_nboots-- > 0) {
|
||||
for (np = Boot; np < &Boot[NBOOTS]; np++)
|
||||
if (np->p_flying < 0)
|
||||
|
@ -692,9 +693,9 @@ zap(PLAYER *pp, FLAG was_player, int i)
|
|||
np->p_face = BOOT;
|
||||
showexpl(np->p_y, np->p_x, BOOT);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
# ifdef BOOTS
|
||||
#ifdef BOOTS
|
||||
else if (pp->p_nboots > 0) {
|
||||
if (pp->p_nboots == 2)
|
||||
Maze[pp->p_y][pp->p_x] = BOOT_PAIR;
|
||||
|
@ -704,9 +705,9 @@ zap(PLAYER *pp, FLAG was_player, int i)
|
|||
fixshots(pp->p_y, pp->p_x,
|
||||
Maze[pp->p_y][pp->p_x]);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# ifdef VOLCANO
|
||||
#ifdef VOLCANO
|
||||
volcano += pp->p_ammo - x;
|
||||
if (rand_num(100) < volcano / 50) {
|
||||
do {
|
||||
|
@ -719,9 +720,9 @@ zap(PLAYER *pp, FLAG was_player, int i)
|
|||
message(np, "Volcano eruption.");
|
||||
volcano = 0;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# ifdef DRONE
|
||||
#ifdef DRONE
|
||||
if (rand_num(100) < 2) {
|
||||
do {
|
||||
x = rand_num(WIDTH / 2) + WIDTH / 4;
|
||||
|
@ -732,7 +733,7 @@ zap(PLAYER *pp, FLAG was_player, int i)
|
|||
rand_num(MAXBOMB - MINDSHOT)],
|
||||
(PLAYER *) NULL, FALSE, SPACE);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
sendcom(pp, ENDWIN);
|
||||
(void) putc(' ', pp->p_output);
|
||||
|
@ -751,12 +752,12 @@ zap(PLAYER *pp, FLAG was_player, int i)
|
|||
cgoto(np, n, STAT_NAME_COL);
|
||||
outstr(np, Buf, STAT_NAME_LEN);
|
||||
}
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (np = Monitor; np < End_monitor; np++) {
|
||||
cgoto(np, n, STAT_NAME_COL);
|
||||
outstr(np, Buf, STAT_NAME_LEN);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
} else
|
||||
fdset[i].fd = -1;
|
||||
|
||||
|
@ -766,7 +767,7 @@ zap(PLAYER *pp, FLAG was_player, int i)
|
|||
cgoto(np, n, STAT_NAME_COL);
|
||||
ce(np);
|
||||
}
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (np = Monitor; np < End_monitor; np++) {
|
||||
cgoto(np, n, STAT_NAME_COL);
|
||||
ce(np);
|
||||
|
@ -808,7 +809,7 @@ zap(PLAYER *pp, FLAG was_player, int i)
|
|||
ce(np);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -854,7 +855,7 @@ check_again:
|
|||
SIGNAL_TYPE
|
||||
cleanup(int eval)
|
||||
{
|
||||
PLAYER *pp;
|
||||
PLAYER *pp;
|
||||
|
||||
for (pp = Player; pp < End_player; pp++) {
|
||||
cgoto(pp, HEIGHT, 0);
|
||||
|
@ -862,18 +863,18 @@ cleanup(int eval)
|
|||
(void) putc(LAST_PLAYER, pp->p_output);
|
||||
(void) fclose(pp->p_output);
|
||||
}
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; pp++) {
|
||||
cgoto(pp, HEIGHT, 0);
|
||||
sendcom(pp, ENDWIN);
|
||||
(void) putc(LAST_PLAYER, pp->p_output);
|
||||
(void) fclose(pp->p_output);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
(void) close(Socket);
|
||||
# ifdef AF_UNIX_HACK
|
||||
#ifdef AF_UNIX_HACK
|
||||
(void) unlink(Sock_name);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
exit(eval);
|
||||
}
|
||||
|
@ -885,38 +886,38 @@ cleanup(int eval)
|
|||
static void
|
||||
send_stats(void)
|
||||
{
|
||||
IDENT *ip;
|
||||
FILE *fp;
|
||||
int s;
|
||||
SOCKET sockstruct;
|
||||
socklen_t socklen;
|
||||
IDENT *ip;
|
||||
FILE *fp;
|
||||
int s;
|
||||
SOCKET sockstruct;
|
||||
socklen_t socklen;
|
||||
|
||||
/*
|
||||
* Get the output stream ready
|
||||
*/
|
||||
# ifdef INTERNET
|
||||
#ifdef INTERNET
|
||||
socklen = sizeof sockstruct;
|
||||
# else
|
||||
#else
|
||||
socklen = sizeof sockstruct - 1;
|
||||
# endif
|
||||
#endif
|
||||
s = accept(Status, (struct sockaddr *) &sockstruct, &socklen);
|
||||
if (s < 0) {
|
||||
if (errno == EINTR)
|
||||
return;
|
||||
# ifdef LOG
|
||||
#ifdef LOG
|
||||
syslog(LOG_WARNING, "accept: %m");
|
||||
# else
|
||||
#else
|
||||
warn("accept");
|
||||
# endif
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
fp = fdopen(s, "w");
|
||||
if (fp == NULL) {
|
||||
# ifdef LOG
|
||||
#ifdef LOG
|
||||
syslog(LOG_WARNING, "fdopen: %m");
|
||||
# else
|
||||
#else
|
||||
warn("fdopen");
|
||||
# endif
|
||||
#endif
|
||||
(void) close(s);
|
||||
return;
|
||||
}
|
||||
|
@ -961,7 +962,7 @@ send_stats(void)
|
|||
static void
|
||||
clear_scores(void)
|
||||
{
|
||||
IDENT *ip, *nextip;
|
||||
IDENT *ip, *nextip;
|
||||
|
||||
for (ip = Scores; ip != NULL; ip = nextip) {
|
||||
nextip = ip->i_next;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: execute.c,v 1.8 2009/07/04 02:37:20 dholland Exp $ */
|
||||
/* $NetBSD: execute.c,v 1.9 2009/07/04 04:29:54 dholland Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1983-2003, Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -32,22 +32,22 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: execute.c,v 1.8 2009/07/04 02:37:20 dholland Exp $");
|
||||
__RCSID("$NetBSD: execute.c,v 1.9 2009/07/04 04:29:54 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
# include <stdlib.h>
|
||||
# include "hunt.h"
|
||||
#include <stdlib.h>
|
||||
#include "hunt.h"
|
||||
|
||||
static void cloak(PLAYER *);
|
||||
static void turn_player(PLAYER *, int);
|
||||
static void fire(PLAYER *, int);
|
||||
static void fire_slime(PLAYER *, int);
|
||||
static void move_player(PLAYER *, int);
|
||||
static void pickup(PLAYER *, int, int, int, int);
|
||||
static void scan(PLAYER *);
|
||||
static void cloak(PLAYER *);
|
||||
static void turn_player(PLAYER *, int);
|
||||
static void fire(PLAYER *, int);
|
||||
static void fire_slime(PLAYER *, int);
|
||||
static void move_player(PLAYER *, int);
|
||||
static void pickup(PLAYER *, int, int, int, int);
|
||||
static void scan(PLAYER *);
|
||||
|
||||
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
/*
|
||||
* mon_execute:
|
||||
* Execute a single monitor command
|
||||
|
@ -55,7 +55,7 @@ static void scan(PLAYER *);
|
|||
void
|
||||
mon_execute(PLAYER *pp)
|
||||
{
|
||||
char ch;
|
||||
char ch;
|
||||
|
||||
ch = pp->p_cbuf[pp->p_ncount++];
|
||||
switch (ch) {
|
||||
|
@ -67,7 +67,7 @@ mon_execute(PLAYER *pp)
|
|||
break;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* execute:
|
||||
|
@ -76,11 +76,11 @@ mon_execute(PLAYER *pp)
|
|||
void
|
||||
execute(PLAYER *pp)
|
||||
{
|
||||
char ch;
|
||||
char ch;
|
||||
|
||||
ch = pp->p_cbuf[pp->p_ncount++];
|
||||
|
||||
# ifdef FLY
|
||||
#ifdef FLY
|
||||
if (pp->p_flying >= 0) {
|
||||
switch (ch) {
|
||||
case CTRL('L'):
|
||||
|
@ -92,7 +92,7 @@ execute(PLAYER *pp)
|
|||
}
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
switch (ch) {
|
||||
case CTRL('L'):
|
||||
|
@ -159,7 +159,7 @@ execute(PLAYER *pp)
|
|||
case '@':
|
||||
fire(pp, 10); /* 21x21 BOMB */
|
||||
break;
|
||||
# ifdef OOZE
|
||||
#ifdef OOZE
|
||||
case 'o':
|
||||
fire_slime(pp, 0); /* SLIME */
|
||||
break;
|
||||
|
@ -172,7 +172,7 @@ execute(PLAYER *pp)
|
|||
case 'P':
|
||||
fire_slime(pp, 3);
|
||||
break;
|
||||
# endif
|
||||
#endif
|
||||
case 's':
|
||||
scan(pp);
|
||||
break;
|
||||
|
@ -192,10 +192,10 @@ execute(PLAYER *pp)
|
|||
static void
|
||||
move_player(PLAYER *pp, int dir)
|
||||
{
|
||||
PLAYER *newp;
|
||||
int x, y;
|
||||
FLAG moved;
|
||||
BULLET *bp;
|
||||
PLAYER *newp;
|
||||
int x, y;
|
||||
FLAG moved;
|
||||
BULLET *bp;
|
||||
|
||||
y = pp->p_y;
|
||||
x = pp->p_x;
|
||||
|
@ -218,18 +218,18 @@ move_player(PLAYER *pp, int dir)
|
|||
moved = FALSE;
|
||||
switch (Maze[y][x]) {
|
||||
case SPACE:
|
||||
# ifdef RANDOM
|
||||
#ifdef RANDOM
|
||||
case DOOR:
|
||||
# endif
|
||||
#endif
|
||||
moved = TRUE;
|
||||
break;
|
||||
case WALL1:
|
||||
case WALL2:
|
||||
case WALL3:
|
||||
# ifdef REFLECT
|
||||
#ifdef REFLECT
|
||||
case WALL4:
|
||||
case WALL5:
|
||||
# endif
|
||||
#endif
|
||||
break;
|
||||
case MINE:
|
||||
case GMINE:
|
||||
|
@ -246,12 +246,12 @@ move_player(PLAYER *pp, int dir)
|
|||
case GRENADE:
|
||||
case SATCHEL:
|
||||
case BOMB:
|
||||
# ifdef OOZE
|
||||
#ifdef OOZE
|
||||
case SLIME:
|
||||
# endif
|
||||
# ifdef DRONE
|
||||
#endif
|
||||
#ifdef DRONE
|
||||
case DSHOT:
|
||||
# endif
|
||||
#endif
|
||||
bp = is_bullet(y, x);
|
||||
if (bp != NULL)
|
||||
bp->b_expl = TRUE;
|
||||
|
@ -269,14 +269,14 @@ move_player(PLAYER *pp, int dir)
|
|||
checkdam(newp, pp, pp->p_ident, STABDAM, KNIFE);
|
||||
}
|
||||
break;
|
||||
# ifdef FLY
|
||||
#ifdef FLY
|
||||
case FLYER:
|
||||
newp = play_at(y, x);
|
||||
message(newp, "Oooh, there's a short guy waving at you!");
|
||||
message(pp, "You couldn't quite reach him!");
|
||||
break;
|
||||
# endif
|
||||
# ifdef BOOTS
|
||||
#endif
|
||||
#ifdef BOOTS
|
||||
case BOOT:
|
||||
case BOOT_PAIR:
|
||||
if (Maze[y][x] == BOOT)
|
||||
|
@ -299,7 +299,7 @@ move_player(PLAYER *pp, int dir)
|
|||
Maze[y][x] = SPACE;
|
||||
moved = TRUE;
|
||||
break;
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
if (moved) {
|
||||
if (pp->p_ncshot > 0)
|
||||
|
@ -341,10 +341,10 @@ fire(PLAYER *pp, int req_index)
|
|||
{
|
||||
if (pp == NULL)
|
||||
return;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if (req_index < 0 || req_index >= MAXBOMB)
|
||||
message(pp, "What you do?");
|
||||
# endif
|
||||
#endif
|
||||
while (req_index >= 0 && pp->p_ammo < shot_req[req_index])
|
||||
req_index--;
|
||||
if (req_index < 0) {
|
||||
|
@ -372,13 +372,13 @@ fire(PLAYER *pp, int req_index)
|
|||
showexpl(pp->p_y, pp->p_x, shot_type[req_index]);
|
||||
for (pp = Player; pp < End_player; pp++)
|
||||
sendcom(pp, REFRESH);
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; pp++)
|
||||
sendcom(pp, REFRESH);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
# ifdef OOZE
|
||||
#ifdef OOZE
|
||||
/*
|
||||
* fire_slime:
|
||||
* Fire a slime shot in the given direction
|
||||
|
@ -388,10 +388,10 @@ fire_slime(PLAYER *pp, int req_index)
|
|||
{
|
||||
if (pp == NULL)
|
||||
return;
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if (req_index < 0 || req_index >= MAXSLIME)
|
||||
message(pp, "What you do?");
|
||||
# endif
|
||||
#endif
|
||||
while (req_index >= 0 && pp->p_ammo < slime_req[req_index])
|
||||
req_index--;
|
||||
if (req_index < 0) {
|
||||
|
@ -419,12 +419,12 @@ fire_slime(PLAYER *pp, int req_index)
|
|||
showexpl(pp->p_y, pp->p_x, SLIME);
|
||||
for (pp = Player; pp < End_player; pp++)
|
||||
sendcom(pp, REFRESH);
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; pp++)
|
||||
sendcom(pp, REFRESH);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* add_shot:
|
||||
|
@ -434,8 +434,8 @@ void
|
|||
add_shot(int type, int y, int x, char face, int charge,
|
||||
PLAYER *owner, int expl, char over)
|
||||
{
|
||||
BULLET *bp;
|
||||
int size;
|
||||
BULLET *bp;
|
||||
int size;
|
||||
|
||||
switch (type) {
|
||||
case SHOT:
|
||||
|
@ -470,7 +470,7 @@ BULLET *
|
|||
create_shot(int type, int y, int x, char face, int charge,
|
||||
int size, PLAYER *owner, IDENT *score, int expl, char over)
|
||||
{
|
||||
BULLET *bp;
|
||||
BULLET *bp;
|
||||
|
||||
bp = malloc(sizeof(*bp));
|
||||
if (bp == NULL) {
|
||||
|
@ -505,12 +505,12 @@ cloak(PLAYER *pp)
|
|||
message(pp, "No more charges");
|
||||
return;
|
||||
}
|
||||
# ifdef BOOTS
|
||||
#ifdef BOOTS
|
||||
if (pp->p_nboots > 0) {
|
||||
message(pp, "Boots are too noisy to cloak!");
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
(void) snprintf(Buf, sizeof(Buf), "%3d", --pp->p_ammo);
|
||||
cgoto(pp, STAT_AMMO_ROW, STAT_VALUE_COL);
|
||||
outstr(pp, Buf, 3);
|
||||
|
@ -553,7 +553,7 @@ scan(PLAYER *pp)
|
|||
void
|
||||
pickup(PLAYER *pp, int y, int x, int prob, int obj)
|
||||
{
|
||||
int req;
|
||||
int req;
|
||||
|
||||
switch (obj) {
|
||||
case MINE:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: expl.c,v 1.6 2009/07/04 02:37:20 dholland Exp $ */
|
||||
/* $NetBSD: expl.c,v 1.7 2009/07/04 04:29:54 dholland Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1983-2003, Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -32,13 +32,13 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: expl.c,v 1.6 2009/07/04 02:37:20 dholland Exp $");
|
||||
__RCSID("$NetBSD: expl.c,v 1.7 2009/07/04 04:29:54 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
# include <stdlib.h>
|
||||
# include "hunt.h"
|
||||
#include <stdlib.h>
|
||||
#include "hunt.h"
|
||||
|
||||
static void remove_wall(int, int);
|
||||
static void remove_wall(int, int);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -48,8 +48,8 @@ static void remove_wall(int, int);
|
|||
void
|
||||
showexpl(int y, int x, char type)
|
||||
{
|
||||
PLAYER *pp;
|
||||
EXPL *ep;
|
||||
PLAYER *pp;
|
||||
EXPL *ep;
|
||||
|
||||
if (y < 0 || y >= HEIGHT)
|
||||
return;
|
||||
|
@ -72,7 +72,7 @@ showexpl(int y, int x, char type)
|
|||
cgoto(pp, y, x);
|
||||
outch(pp, type);
|
||||
}
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; pp++) {
|
||||
if (pp->p_maze[y][x] == type)
|
||||
continue;
|
||||
|
@ -80,18 +80,18 @@ showexpl(int y, int x, char type)
|
|||
cgoto(pp, y, x);
|
||||
outch(pp, type);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
switch (Maze[y][x]) {
|
||||
case WALL1:
|
||||
case WALL2:
|
||||
case WALL3:
|
||||
# ifdef RANDOM
|
||||
#ifdef RANDOM
|
||||
case DOOR:
|
||||
# endif
|
||||
# ifdef REFLECT
|
||||
#endif
|
||||
#ifdef REFLECT
|
||||
case WALL4:
|
||||
case WALL5:
|
||||
# endif
|
||||
#endif
|
||||
if (y >= UBOUND && y < DBOUND && x >= LBOUND && x < RBOUND)
|
||||
remove_wall(y, x);
|
||||
break;
|
||||
|
@ -106,11 +106,11 @@ showexpl(int y, int x, char type)
|
|||
void
|
||||
rollexpl(void)
|
||||
{
|
||||
EXPL *ep;
|
||||
PLAYER *pp;
|
||||
int y, x;
|
||||
char c;
|
||||
EXPL *nextep;
|
||||
EXPL *ep;
|
||||
PLAYER *pp;
|
||||
int y, x;
|
||||
char c;
|
||||
EXPL *nextep;
|
||||
|
||||
for (ep = Expl[EXPLEN - 1]; ep != NULL; ep = nextep) {
|
||||
nextep = ep->e_next;
|
||||
|
@ -126,10 +126,10 @@ rollexpl(void)
|
|||
cgoto(pp, y, x);
|
||||
outch(pp, c);
|
||||
}
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; pp++)
|
||||
check(pp, y, x);
|
||||
# endif
|
||||
#endif
|
||||
free(ep);
|
||||
}
|
||||
for (x = EXPLEN - 1; x > 0; x--)
|
||||
|
@ -139,10 +139,10 @@ rollexpl(void)
|
|||
|
||||
/* There's about 700 walls in the initial maze. So we pick a number
|
||||
* that keeps the maze relatively full. */
|
||||
# define MAXREMOVE 40
|
||||
#define MAXREMOVE 40
|
||||
|
||||
static REGEN removed[MAXREMOVE];
|
||||
static REGEN *rem_index = removed;
|
||||
static REGEN removed[MAXREMOVE];
|
||||
static REGEN *rem_index = removed;
|
||||
|
||||
/*
|
||||
* remove_wall - add a location where the wall was blown away.
|
||||
|
@ -152,17 +152,17 @@ static REGEN *rem_index = removed;
|
|||
static void
|
||||
remove_wall(int y, int x)
|
||||
{
|
||||
REGEN *r;
|
||||
# if defined(MONITOR) || defined(FLY)
|
||||
PLAYER *pp;
|
||||
# endif
|
||||
# ifdef FLY
|
||||
char save_char = 0;
|
||||
# endif
|
||||
REGEN *r;
|
||||
#if defined(MONITOR) || defined(FLY)
|
||||
PLAYER *pp;
|
||||
#endif
|
||||
#ifdef FLY
|
||||
char save_char = 0;
|
||||
#endif
|
||||
|
||||
r = rem_index;
|
||||
while (r->r_y != 0) {
|
||||
# ifdef FLY
|
||||
#ifdef FLY
|
||||
switch (Maze[r->r_y][r->r_x]) {
|
||||
case SPACE:
|
||||
case LEFTS:
|
||||
|
@ -173,10 +173,10 @@ remove_wall(int y, int x)
|
|||
save_char = Maze[r->r_y][r->r_x];
|
||||
goto found;
|
||||
}
|
||||
# else
|
||||
#else
|
||||
if (Maze[r->r_y][r->r_x] == SPACE)
|
||||
break;
|
||||
# endif
|
||||
#endif
|
||||
if (++r >= &removed[MAXREMOVE])
|
||||
r = removed;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ remove_wall(int y, int x)
|
|||
found:
|
||||
if (r->r_y != 0) {
|
||||
/* Slot being used, put back this wall */
|
||||
# ifdef FLY
|
||||
#ifdef FLY
|
||||
if (save_char == SPACE)
|
||||
Maze[r->r_y][r->r_x] = Orig_maze[r->r_y][r->r_x];
|
||||
else {
|
||||
|
@ -201,21 +201,21 @@ found:
|
|||
Maze[r->r_y][r->r_x] = FLYER;
|
||||
showexpl(r->r_y, r->r_x, FLYER);
|
||||
}
|
||||
# else
|
||||
#else
|
||||
Maze[r->r_y][r->r_x] = Orig_maze[r->r_y][r->r_x];
|
||||
# endif
|
||||
# ifdef RANDOM
|
||||
#endif
|
||||
#ifdef RANDOM
|
||||
if (rand_num(100) == 0)
|
||||
Maze[r->r_y][r->r_x] = DOOR;
|
||||
# endif
|
||||
# ifdef REFLECT
|
||||
#endif
|
||||
#ifdef REFLECT
|
||||
if (rand_num(100) == 0) /* one percent of the time */
|
||||
Maze[r->r_y][r->r_x] = WALL4;
|
||||
# endif
|
||||
# ifdef MONITOR
|
||||
#endif
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; pp++)
|
||||
check(pp, r->r_y, r->r_x);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
r->r_y = y;
|
||||
|
@ -226,10 +226,10 @@ found:
|
|||
rem_index = r;
|
||||
|
||||
Maze[y][x] = SPACE;
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; pp++)
|
||||
check(pp, y, x);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -239,7 +239,7 @@ found:
|
|||
void
|
||||
clearwalls(void)
|
||||
{
|
||||
REGEN *rp;
|
||||
REGEN *rp;
|
||||
|
||||
for (rp = removed; rp < &removed[MAXREMOVE]; rp++)
|
||||
rp->r_y = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: extern.c,v 1.4 2003/06/11 12:00:22 wiz Exp $ */
|
||||
/* $NetBSD: extern.c,v 1.5 2009/07/04 04:29:54 dholland Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1983-2003, Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -32,60 +32,61 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: extern.c,v 1.4 2003/06/11 12:00:22 wiz Exp $");
|
||||
__RCSID("$NetBSD: extern.c,v 1.5 2009/07/04 04:29:54 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
# include "hunt.h"
|
||||
#include "hunt.h"
|
||||
|
||||
# ifdef MONITOR
|
||||
FLAG Am_monitor = FALSE; /* current process is a monitor */
|
||||
# endif
|
||||
#ifdef MONITOR
|
||||
FLAG Am_monitor = FALSE; /* current process is a monitor */
|
||||
#endif
|
||||
|
||||
char Buf[BUFSIZ]; /* general scribbling buffer */
|
||||
char Maze[HEIGHT][WIDTH2]; /* the maze */
|
||||
char Orig_maze[HEIGHT][WIDTH2]; /* the original maze */
|
||||
char Buf[BUFSIZ]; /* general scribbling buffer */
|
||||
char Maze[HEIGHT][WIDTH2]; /* the maze */
|
||||
char Orig_maze[HEIGHT][WIDTH2]; /* the original maze */
|
||||
|
||||
struct pollfd fdset[3+MAXPL+MAXMON];
|
||||
int Nplayer = 0; /* number of players */
|
||||
int Socket; /* main socket */
|
||||
int Status; /* stat socket */
|
||||
int See_over[NASCII]; /* lookup table for determining whether
|
||||
struct pollfd fdset[3+MAXPL+MAXMON];
|
||||
int Nplayer = 0; /* number of players */
|
||||
int Socket; /* main socket */
|
||||
int Status; /* stat socket */
|
||||
int See_over[NASCII]; /* lookup table for determining whether
|
||||
* character represents "transparent"
|
||||
* item */
|
||||
|
||||
BULLET *Bullets = NULL; /* linked list of bullets */
|
||||
BULLET *Bullets = NULL; /* linked list of bullets */
|
||||
|
||||
EXPL *Expl[EXPLEN]; /* explosion lists */
|
||||
EXPL *Last_expl; /* last explosion on Expl[0] */
|
||||
EXPL *Expl[EXPLEN]; /* explosion lists */
|
||||
EXPL *Last_expl; /* last explosion on Expl[0] */
|
||||
|
||||
PLAYER Player[MAXPL]; /* all the players */
|
||||
PLAYER *End_player = Player; /* last active player slot */
|
||||
# ifdef BOOTS
|
||||
PLAYER Boot[NBOOTS]; /* all the boots */
|
||||
# endif
|
||||
IDENT *Scores; /* score cache */
|
||||
# ifdef MONITOR
|
||||
PLAYER Monitor[MAXMON]; /* all the monitors */
|
||||
PLAYER *End_monitor = Monitor; /* last active monitor slot */
|
||||
# endif
|
||||
PLAYER Player[MAXPL]; /* all the players */
|
||||
PLAYER *End_player = Player; /* last active player slot */
|
||||
#ifdef BOOTS
|
||||
PLAYER Boot[NBOOTS]; /* all the boots */
|
||||
#endif
|
||||
IDENT *Scores; /* score cache */
|
||||
#ifdef MONITOR
|
||||
PLAYER Monitor[MAXMON]; /* all the monitors */
|
||||
PLAYER *End_monitor = Monitor; /* last active monitor slot */
|
||||
#endif
|
||||
|
||||
# ifdef VOLCANO
|
||||
int volcano = 0; /* Explosion size */
|
||||
# endif
|
||||
#ifdef VOLCANO
|
||||
int volcano = 0; /* Explosion size */
|
||||
#endif
|
||||
|
||||
int shot_req[MAXBOMB] = {
|
||||
BULREQ, GRENREQ, SATREQ,
|
||||
BOMB7REQ, BOMB9REQ, BOMB11REQ,
|
||||
BOMB13REQ, BOMB15REQ, BOMB17REQ,
|
||||
BOMB19REQ, BOMB21REQ,
|
||||
};
|
||||
int shot_type[MAXBOMB] = {
|
||||
SHOT, GRENADE, SATCHEL,
|
||||
BOMB, BOMB, BOMB,
|
||||
BOMB, BOMB, BOMB,
|
||||
BOMB, BOMB,
|
||||
};
|
||||
int shot_req[MAXBOMB] = {
|
||||
BULREQ, GRENREQ, SATREQ,
|
||||
BOMB7REQ, BOMB9REQ, BOMB11REQ,
|
||||
BOMB13REQ, BOMB15REQ, BOMB17REQ,
|
||||
BOMB19REQ, BOMB21REQ,
|
||||
};
|
||||
|
||||
int slime_req[MAXSLIME] = {
|
||||
SLIMEREQ, SSLIMEREQ, SLIME2REQ, SLIME3REQ,
|
||||
};
|
||||
int shot_type[MAXBOMB] = {
|
||||
SHOT, GRENADE, SATCHEL,
|
||||
BOMB, BOMB, BOMB,
|
||||
BOMB, BOMB, BOMB,
|
||||
BOMB, BOMB,
|
||||
};
|
||||
|
||||
int slime_req[MAXSLIME] = {
|
||||
SLIMEREQ, SSLIMEREQ, SLIME2REQ, SLIME3REQ,
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: faketalk.c,v 1.14 2009/07/04 02:37:20 dholland Exp $ */
|
||||
/* $NetBSD: faketalk.c,v 1.15 2009/07/04 04:29:54 dholland Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1983-2003, Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -32,44 +32,45 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: faketalk.c,v 1.14 2009/07/04 02:37:20 dholland Exp $");
|
||||
__RCSID("$NetBSD: faketalk.c,v 1.15 2009/07/04 04:29:54 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include "bsd.h"
|
||||
#include "hunt.h"
|
||||
|
||||
#if defined(TALK_43) || defined(TALK_42)
|
||||
#if defined(TALK_43) || defined(TALK_42)
|
||||
|
||||
# include <sys/time.h>
|
||||
# include <sys/wait.h>
|
||||
# include <ctype.h>
|
||||
# include <netdb.h>
|
||||
# include <signal.h>
|
||||
# include <stdio.h>
|
||||
# include <string.h>
|
||||
# include <unistd.h>
|
||||
# include "talk_ctl.h"
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <ctype.h>
|
||||
#include <netdb.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "talk_ctl.h"
|
||||
|
||||
# define TRUE 1
|
||||
# define FALSE 0
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
/* defines for fake talk message to announce start of game */
|
||||
# ifdef TALK_43
|
||||
# define MASQUERADE "\"Hunt Game\""
|
||||
# else
|
||||
# define MASQUERADE "HuntGame"
|
||||
# endif
|
||||
# define RENDEZVOUS "hunt-players"
|
||||
# define ARGV0 "HUNT-ANNOUNCE"
|
||||
#ifdef TALK_43
|
||||
#define MASQUERADE "\"Hunt Game\""
|
||||
#else
|
||||
#define MASQUERADE "HuntGame"
|
||||
#endif
|
||||
#define RENDEZVOUS "hunt-players"
|
||||
#define ARGV0 "HUNT-ANNOUNCE"
|
||||
|
||||
extern char *my_machine_name;
|
||||
extern char *First_arg, *Last_arg;
|
||||
extern char **environ;
|
||||
extern char *my_machine_name;
|
||||
extern char *First_arg, *Last_arg;
|
||||
extern char **environ;
|
||||
|
||||
static void do_announce(char *);
|
||||
SIGNAL_TYPE exorcise(int);
|
||||
|
||||
static void do_announce(char *);
|
||||
SIGNAL_TYPE exorcise(int);
|
||||
/*
|
||||
* exorcise - disspell zombies
|
||||
* exorcise - disspell zombies
|
||||
*/
|
||||
|
||||
SIGNAL_TYPE
|
||||
|
@ -79,19 +80,19 @@ exorcise(int dummy __unused)
|
|||
}
|
||||
|
||||
/*
|
||||
* query the local SMTP daemon to expand the RENDEZVOUS mailing list
|
||||
* and fake a talk request to each address thus found.
|
||||
* query the local SMTP daemon to expand the RENDEZVOUS mailing list
|
||||
* and fake a talk request to each address thus found.
|
||||
*/
|
||||
|
||||
void
|
||||
faketalk(void)
|
||||
{
|
||||
struct servent *sp;
|
||||
char buf[BUFSIZ];
|
||||
FILE *f;
|
||||
int service; /* socket of service */
|
||||
struct sockaddr_in des; /* address of destination */
|
||||
char *a, *b;
|
||||
struct servent *sp;
|
||||
char buf[BUFSIZ];
|
||||
FILE *f;
|
||||
int service; /* socket of service */
|
||||
struct sockaddr_in des; /* address of destination */
|
||||
char *a, *b;
|
||||
|
||||
(void) signal(SIGCHLD, exorcise);
|
||||
|
||||
|
@ -102,7 +103,7 @@ faketalk(void)
|
|||
(void) signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
/*
|
||||
* change argv so that a ps shows ARGV0
|
||||
* change argv so that a ps shows ARGV0
|
||||
*/
|
||||
*environ = NULL;
|
||||
for (a = First_arg, b = ARGV0; a < Last_arg; a++) {
|
||||
|
@ -123,11 +124,11 @@ faketalk(void)
|
|||
*/
|
||||
|
||||
if ((sp = getservbyname("smtp", NULL)) == NULL) {
|
||||
# ifdef LOG
|
||||
#ifdef LOG
|
||||
syslog(LOG_ERR, "faketalk: smtp protocol not supported\n");
|
||||
# else
|
||||
#else
|
||||
warn("faketalk: stmp protocol not supported");
|
||||
# endif
|
||||
#endif
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
|
@ -137,28 +138,28 @@ faketalk(void)
|
|||
des.sin_port = sp->s_port;
|
||||
|
||||
if ((service = socket(des.sin_family, SOCK_STREAM, 0)) < 0) {
|
||||
# ifdef LOG
|
||||
#ifdef LOG
|
||||
syslog(LOG_ERR, "falktalk: socket");
|
||||
# else
|
||||
#else
|
||||
warn("falktalk: socket");
|
||||
# endif
|
||||
#endif
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
if (connect(service, (struct sockaddr *) &des, sizeof(des)) != 0) {
|
||||
# ifdef LOG
|
||||
#ifdef LOG
|
||||
syslog(LOG_ERR, "faketalk: connect");
|
||||
# else
|
||||
#else
|
||||
warn("faketalk: connect");
|
||||
# endif
|
||||
#endif
|
||||
_exit(1);
|
||||
}
|
||||
if ((f = fdopen(service, "r")) == NULL) {
|
||||
# ifdef LOG
|
||||
#ifdef LOG
|
||||
syslog(LOG_ERR, "fdopen failed\n");
|
||||
# else
|
||||
#else
|
||||
warn("faketalk: fdopen");
|
||||
# endif
|
||||
#endif
|
||||
_exit(2);
|
||||
}
|
||||
|
||||
|
@ -171,7 +172,7 @@ faketalk(void)
|
|||
"EXPN %s@%s\r\n", RENDEZVOUS, my_machine_name);
|
||||
(void) write(service, buf, strlen(buf));
|
||||
while (fgets(buf, BUFSIZ, f) != NULL) {
|
||||
char *s, *t;
|
||||
char *s, *t;
|
||||
|
||||
if (buf[0] != '2' || buf[1] != '5' || buf[2] != '0')
|
||||
break;
|
||||
|
@ -208,21 +209,21 @@ faketalk(void)
|
|||
static void
|
||||
do_announce(char *s)
|
||||
{
|
||||
CTL_RESPONSE response;
|
||||
CTL_RESPONSE response;
|
||||
|
||||
get_remote_name(s); /* setup his_machine_addr, msg.r_name */
|
||||
|
||||
# ifdef TALK_43
|
||||
# if BSD_RELEASE >= 44
|
||||
#ifdef TALK_43
|
||||
#if BSD_RELEASE >= 44
|
||||
msg.ctl_addr = *(struct osockaddr *) &ctl_addr;
|
||||
# else
|
||||
#else
|
||||
msg.ctl_addr = *(struct sockaddr *) &ctl_addr;
|
||||
# endif
|
||||
#endif
|
||||
msg.ctl_addr.sa_family = htons(msg.ctl_addr.sa_family);
|
||||
# else
|
||||
#else
|
||||
msg.ctl_addr = ctl_addr;
|
||||
msg.ctl_addr.sin_family = htons(msg.ctl_addr.sin_family);
|
||||
# endif
|
||||
#endif
|
||||
msg.id_num = (int) htonl((u_int32_t) -1); /* an impossible id_num */
|
||||
ctl_transact(his_machine_addr, msg, ANNOUNCE, &response);
|
||||
if (response.answer != SUCCESS)
|
||||
|
@ -242,10 +243,13 @@ do_announce(char *s)
|
|||
!= sizeof(msg))
|
||||
p_error("send delete remote");
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void
|
||||
faketalk(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: get_names.c,v 1.9 2009/07/04 02:37:20 dholland Exp $ */
|
||||
/* $NetBSD: get_names.c,v 1.10 2009/07/04 04:29:55 dholland Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1983-2003, Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -32,24 +32,24 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: get_names.c,v 1.9 2009/07/04 02:37:20 dholland Exp $");
|
||||
__RCSID("$NetBSD: get_names.c,v 1.10 2009/07/04 04:29:55 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include "bsd.h"
|
||||
|
||||
#if defined(TALK_43) || defined(TALK_42)
|
||||
#if defined(TALK_43) || defined(TALK_42)
|
||||
|
||||
# include <sys/param.h>
|
||||
# include <netdb.h>
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <unistd.h>
|
||||
# include "hunt.h"
|
||||
# include "talk_ctl.h"
|
||||
#include <sys/param.h>
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "hunt.h"
|
||||
#include "talk_ctl.h"
|
||||
|
||||
static char hostname[MAXHOSTNAMELEN + 1];
|
||||
char *my_machine_name;
|
||||
static char hostname[MAXHOSTNAMELEN + 1];
|
||||
char *my_machine_name;
|
||||
|
||||
/*
|
||||
* Determine the local user and machine
|
||||
|
@ -57,8 +57,8 @@ char *my_machine_name;
|
|||
void
|
||||
get_local_name(char *my_name)
|
||||
{
|
||||
struct hostent *hp;
|
||||
struct servent *sp;
|
||||
struct hostent *hp;
|
||||
struct servent *sp;
|
||||
|
||||
/* Load these useful values into the standard message header */
|
||||
msg.id_num = 0;
|
||||
|
@ -66,14 +66,14 @@ get_local_name(char *my_name)
|
|||
msg.l_name[NAME_SIZE - 1] = '\0';
|
||||
msg.r_tty[0] = '\0';
|
||||
msg.pid = getpid();
|
||||
# ifdef TALK_43
|
||||
#ifdef TALK_43
|
||||
msg.vers = TALK_VERSION;
|
||||
msg.addr.sa_family = htons(AF_INET);
|
||||
msg.ctl_addr.sa_family = htons(AF_INET);
|
||||
# else
|
||||
#else
|
||||
msg.addr.sin_family = htons(AF_INET);
|
||||
msg.ctl_addr.sin_family = htons(AF_INET);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
(void)gethostname(hostname, sizeof (hostname));
|
||||
hostname[sizeof(hostname) - 1] = '\0';
|
||||
|
@ -81,27 +81,27 @@ get_local_name(char *my_name)
|
|||
/* look up the address of the local host */
|
||||
hp = gethostbyname(my_machine_name);
|
||||
if (hp == (struct hostent *) 0) {
|
||||
# ifdef LOG
|
||||
#ifdef LOG
|
||||
syslog(LOG_ERR,
|
||||
"This machine doesn't exist. Boy, am I confused!");
|
||||
# else
|
||||
#else
|
||||
perror("This machine doesn't exist. Boy, am I confused!");
|
||||
# endif
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
memcpy(&my_machine_addr, hp->h_addr, hp->h_length);
|
||||
/* find the daemon portal */
|
||||
# ifdef TALK_43
|
||||
#ifdef TALK_43
|
||||
sp = getservbyname("ntalk", "udp");
|
||||
# else
|
||||
#else
|
||||
sp = getservbyname("talk", "udp");
|
||||
# endif
|
||||
#endif
|
||||
if (sp == 0) {
|
||||
# ifdef LOG
|
||||
#ifdef LOG
|
||||
syslog(LOG_ERR, "This machine doesn't support talk");
|
||||
# else
|
||||
#else
|
||||
perror("This machine doesn't support talk");
|
||||
# endif
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
daemon_port = sp->s_port;
|
||||
|
@ -113,11 +113,10 @@ get_local_name(char *my_name)
|
|||
int
|
||||
get_remote_name(char *his_address)
|
||||
{
|
||||
char *his_name;
|
||||
char *his_machine_name;
|
||||
char *ptr;
|
||||
struct hostent *hp;
|
||||
|
||||
char *his_name;
|
||||
char *his_machine_name;
|
||||
char *ptr;
|
||||
struct hostent *hp;
|
||||
|
||||
/* check for, and strip out, the machine name of the target */
|
||||
for (ptr = his_address; *ptr != '\0' && *ptr != '@' && *ptr != ':'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: hunt.h,v 1.14 2009/07/04 03:29:20 dholland Exp $ */
|
||||
/* $NetBSD: hunt.h,v 1.15 2009/07/04 04:29:54 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983-2003, Regents of the University of California.
|
||||
|
@ -31,249 +31,254 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
# include "bsd.h"
|
||||
#include "bsd.h"
|
||||
|
||||
# include <stdio.h>
|
||||
# include <string.h>
|
||||
# ifdef LOG
|
||||
# include <syslog.h>
|
||||
# endif
|
||||
# if !defined(TERMINFO) && BSD_RELEASE < 44
|
||||
# include <sgtty.h>
|
||||
# else
|
||||
# include <sys/ioctl.h>
|
||||
# endif
|
||||
# include <sys/types.h>
|
||||
# include <sys/uio.h>
|
||||
# include <sys/poll.h>
|
||||
# ifdef INTERNET
|
||||
# include <netinet/in.h>
|
||||
# include <netdb.h>
|
||||
# include <arpa/inet.h>
|
||||
# ifdef BROADCAST
|
||||
# include <net/if.h>
|
||||
# endif
|
||||
# else
|
||||
# include <sys/un.h>
|
||||
# endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
# ifdef INTERNET
|
||||
# define SOCK_FAMILY AF_INET
|
||||
# else
|
||||
# define SOCK_FAMILY AF_UNIX
|
||||
# define AF_UNIX_HACK /* 4.2 hack; leaves files around */
|
||||
# endif
|
||||
#ifdef LOG
|
||||
#include <syslog.h>
|
||||
#endif
|
||||
|
||||
#if !defined(TERMINFO) && BSD_RELEASE < 44
|
||||
#include <sgtty.h>
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/poll.h>
|
||||
|
||||
#ifdef INTERNET
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#ifdef BROADCAST
|
||||
#include <net/if.h>
|
||||
#endif
|
||||
#else
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
|
||||
#ifdef INTERNET
|
||||
#define SOCK_FAMILY AF_INET
|
||||
#else
|
||||
#define SOCK_FAMILY AF_UNIX
|
||||
#define AF_UNIX_HACK /* 4.2 hack; leaves files around */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Preprocessor define dependencies
|
||||
*/
|
||||
# if defined(VOLCANO) && !defined(OOZE)
|
||||
# define OOZE
|
||||
# endif
|
||||
# if defined(BOOTS) && !defined(FLY)
|
||||
# define FLY
|
||||
# endif
|
||||
# if !defined(REFLECT) && !defined(RANDOM)
|
||||
# define RANDOM
|
||||
# endif
|
||||
# ifdef TERMINFO
|
||||
#if defined(VOLCANO) && !defined(OOZE)
|
||||
#define OOZE
|
||||
#endif
|
||||
#if defined(BOOTS) && !defined(FLY)
|
||||
#define FLY
|
||||
#endif
|
||||
#if !defined(REFLECT) && !defined(RANDOM)
|
||||
#define RANDOM
|
||||
#endif
|
||||
#ifdef TERMINFO
|
||||
/* mvcur() in terminfo needs the curses library to be initialized to not
|
||||
* coredump, so give up and use it. */
|
||||
# define USE_CURSES
|
||||
# endif
|
||||
#define USE_CURSES
|
||||
#endif
|
||||
|
||||
/* decrement version number for each change in startup protocol */
|
||||
# define HUNT_VERSION -1
|
||||
#define HUNT_VERSION -1
|
||||
|
||||
# define ADDCH ('a' | 0200)
|
||||
# define MOVE ('m' | 0200)
|
||||
# define REFRESH ('r' | 0200)
|
||||
# define CLRTOEOL ('c' | 0200)
|
||||
# define ENDWIN ('e' | 0200)
|
||||
# define CLEAR ('C' | 0200)
|
||||
# define REDRAW ('R' | 0200)
|
||||
# define LAST_PLAYER ('l' | 0200)
|
||||
# define BELL ('b' | 0200)
|
||||
# define READY ('g' | 0200)
|
||||
#define ADDCH ('a' | 0200)
|
||||
#define MOVE ('m' | 0200)
|
||||
#define REFRESH ('r' | 0200)
|
||||
#define CLRTOEOL ('c' | 0200)
|
||||
#define ENDWIN ('e' | 0200)
|
||||
#define CLEAR ('C' | 0200)
|
||||
#define REDRAW ('R' | 0200)
|
||||
#define LAST_PLAYER ('l' | 0200)
|
||||
#define BELL ('b' | 0200)
|
||||
#define READY ('g' | 0200)
|
||||
|
||||
/*
|
||||
* Choose MAXPL and MAXMON carefully. The screen is assumed to be
|
||||
* 23 lines high and will only tolerate (MAXPL == 17 && MAXMON == 0)
|
||||
* or (MAXPL + MAXMON <= 16).
|
||||
*/
|
||||
# ifdef MONITOR
|
||||
# define MAXPL 15
|
||||
# define MAXMON 1
|
||||
# else
|
||||
# define MAXPL 17
|
||||
# define MAXMON 0
|
||||
# endif
|
||||
# define SHORTLEN 2 /* sizeof (network short) */
|
||||
# define LONGLEN 4 /* sizeof (network long) */
|
||||
# define NAMELEN 20
|
||||
# define MSGLEN SCREEN_WIDTH
|
||||
# define DECAY 50.0
|
||||
#ifdef MONITOR
|
||||
#define MAXPL 15
|
||||
#define MAXMON 1
|
||||
#else
|
||||
#define MAXPL 17
|
||||
#define MAXMON 0
|
||||
#endif
|
||||
#define SHORTLEN 2 /* sizeof (network short) */
|
||||
#define LONGLEN 4 /* sizeof (network long) */
|
||||
#define NAMELEN 20
|
||||
#define MSGLEN SCREEN_WIDTH
|
||||
#define DECAY 50.0
|
||||
|
||||
# define NASCII 128
|
||||
#define NASCII 128
|
||||
|
||||
# define WIDTH 51
|
||||
# define WIDTH2 64 /* Next power of 2 >= WIDTH (for fast access) */
|
||||
# define HEIGHT 23
|
||||
# define UBOUND 1
|
||||
# define DBOUND (HEIGHT - 1)
|
||||
# define LBOUND 1
|
||||
# define RBOUND (WIDTH - 1)
|
||||
#define WIDTH 51
|
||||
#define WIDTH2 64 /* Next power of 2 >= WIDTH (for fast access) */
|
||||
#define HEIGHT 23
|
||||
#define UBOUND 1
|
||||
#define DBOUND (HEIGHT - 1)
|
||||
#define LBOUND 1
|
||||
#define RBOUND (WIDTH - 1)
|
||||
|
||||
# define SCREEN_HEIGHT 24
|
||||
# define SCREEN_WIDTH 80
|
||||
# define SCREEN_WIDTH2 128 /* Next power of 2 >= SCREEN_WIDTH */
|
||||
#define SCREEN_HEIGHT 24
|
||||
#define SCREEN_WIDTH 80
|
||||
#define SCREEN_WIDTH2 128 /* Next power of 2 >= SCREEN_WIDTH */
|
||||
|
||||
# define STAT_LABEL_COL 60
|
||||
# define STAT_VALUE_COL 74
|
||||
# define STAT_NAME_COL 61
|
||||
# define STAT_SCAN_COL (STAT_NAME_COL + 5)
|
||||
# define STAT_AMMO_ROW 0
|
||||
# define STAT_GUN_ROW 1
|
||||
# define STAT_DAM_ROW 2
|
||||
# define STAT_KILL_ROW 3
|
||||
# define STAT_PLAY_ROW 5
|
||||
# ifdef MONITOR
|
||||
# define STAT_MON_ROW (STAT_PLAY_ROW + MAXPL + 1)
|
||||
# endif
|
||||
# define STAT_NAME_LEN 18
|
||||
#define STAT_LABEL_COL 60
|
||||
#define STAT_VALUE_COL 74
|
||||
#define STAT_NAME_COL 61
|
||||
#define STAT_SCAN_COL (STAT_NAME_COL + 5)
|
||||
#define STAT_AMMO_ROW 0
|
||||
#define STAT_GUN_ROW 1
|
||||
#define STAT_DAM_ROW 2
|
||||
#define STAT_KILL_ROW 3
|
||||
#define STAT_PLAY_ROW 5
|
||||
#ifdef MONITOR
|
||||
#define STAT_MON_ROW (STAT_PLAY_ROW + MAXPL + 1)
|
||||
#endif
|
||||
#define STAT_NAME_LEN 18
|
||||
|
||||
# define DOOR '#'
|
||||
# define WALL1 '-'
|
||||
# define WALL2 '|'
|
||||
# define WALL3 '+'
|
||||
# ifdef REFLECT
|
||||
# define WALL4 '/'
|
||||
# define WALL5 '\\'
|
||||
# endif
|
||||
# define KNIFE 'K'
|
||||
# define SHOT ':'
|
||||
# define GRENADE 'o'
|
||||
# define SATCHEL 'O'
|
||||
# define BOMB '@'
|
||||
# define MINE ';'
|
||||
# define GMINE 'g'
|
||||
# ifdef OOZE
|
||||
# define SLIME '$'
|
||||
# endif
|
||||
# ifdef VOLCANO
|
||||
# define LAVA '~'
|
||||
# endif
|
||||
# ifdef DRONE
|
||||
# define DSHOT '?'
|
||||
# endif
|
||||
# ifdef FLY
|
||||
# define FALL 'F'
|
||||
# endif
|
||||
# ifdef BOOTS
|
||||
# define NBOOTS 2
|
||||
# define BOOT 'b'
|
||||
# define BOOT_PAIR 'B'
|
||||
# endif
|
||||
# define SPACE ' '
|
||||
#define DOOR '#'
|
||||
#define WALL1 '-'
|
||||
#define WALL2 '|'
|
||||
#define WALL3 '+'
|
||||
#ifdef REFLECT
|
||||
#define WALL4 '/'
|
||||
#define WALL5 '\\'
|
||||
#endif
|
||||
#define KNIFE 'K'
|
||||
#define SHOT ':'
|
||||
#define GRENADE 'o'
|
||||
#define SATCHEL 'O'
|
||||
#define BOMB '@'
|
||||
#define MINE ';'
|
||||
#define GMINE 'g'
|
||||
#ifdef OOZE
|
||||
#define SLIME '$'
|
||||
#endif
|
||||
#ifdef VOLCANO
|
||||
#define LAVA '~'
|
||||
#endif
|
||||
#ifdef DRONE
|
||||
#define DSHOT '?'
|
||||
#endif
|
||||
#ifdef FLY
|
||||
#define FALL 'F'
|
||||
#endif
|
||||
#ifdef BOOTS
|
||||
#define NBOOTS 2
|
||||
#define BOOT 'b'
|
||||
#define BOOT_PAIR 'B'
|
||||
#endif
|
||||
#define SPACE ' '
|
||||
|
||||
# define ABOVE 'i'
|
||||
# define BELOW '!'
|
||||
# define RIGHT '}'
|
||||
# define LEFTS '{'
|
||||
# ifdef FLY
|
||||
# define FLYER '&'
|
||||
# define isplayer(c) (c == LEFTS || c == RIGHT ||\
|
||||
c == ABOVE || c == BELOW || c == FLYER)
|
||||
# else
|
||||
# define isplayer(c) (c == LEFTS || c == RIGHT ||\
|
||||
c == ABOVE || c == BELOW)
|
||||
# endif
|
||||
#define ABOVE 'i'
|
||||
#define BELOW '!'
|
||||
#define RIGHT '}'
|
||||
#define LEFTS '{'
|
||||
#ifdef FLY
|
||||
#define FLYER '&'
|
||||
#define isplayer(c) (c == LEFTS || c == RIGHT ||\
|
||||
c == ABOVE || c == BELOW || c == FLYER)
|
||||
#else
|
||||
#define isplayer(c) (c == LEFTS || c == RIGHT ||\
|
||||
c == ABOVE || c == BELOW)
|
||||
#endif
|
||||
|
||||
# define NORTH 01
|
||||
# define SOUTH 02
|
||||
# define EAST 010
|
||||
# define WEST 020
|
||||
#define NORTH 01
|
||||
#define SOUTH 02
|
||||
#define EAST 010
|
||||
#define WEST 020
|
||||
|
||||
# ifndef TRUE
|
||||
# define TRUE 1
|
||||
# define FALSE 0
|
||||
# endif
|
||||
# undef CTRL
|
||||
# define CTRL(x) ((x) & 037)
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
# define BULSPD 5 /* bullets movement speed */
|
||||
# define ISHOTS 15
|
||||
# define NSHOTS 5
|
||||
# define MAXNCSHOT 2
|
||||
# define MAXDAM 10
|
||||
# define MINDAM 5
|
||||
# define STABDAM 2
|
||||
#undef CTRL
|
||||
#define CTRL(x) ((x) & 037)
|
||||
|
||||
# define BULREQ 1
|
||||
# define GRENREQ 9
|
||||
# define SATREQ 25
|
||||
# define BOMB7REQ 49
|
||||
# define BOMB9REQ 81
|
||||
# define BOMB11REQ 121
|
||||
# define BOMB13REQ 169
|
||||
# define BOMB15REQ 225
|
||||
# define BOMB17REQ 289
|
||||
# define BOMB19REQ 361
|
||||
# define BOMB21REQ 441
|
||||
# define MAXBOMB 11
|
||||
# ifdef DRONE
|
||||
# define MINDSHOT 2 /* At least a satchel bomb */
|
||||
# endif
|
||||
extern int shot_req[];
|
||||
extern int shot_type[];
|
||||
# ifdef OOZE
|
||||
# define SLIME_FACTOR 3
|
||||
# define SLIMEREQ 5
|
||||
# define SSLIMEREQ 10
|
||||
# define SLIME2REQ 15
|
||||
# define SLIME3REQ 20
|
||||
# define MAXSLIME 4
|
||||
# define SLIMESPEED 5
|
||||
extern int slime_req[];
|
||||
# endif
|
||||
# ifdef VOLCANO
|
||||
# define LAVASPEED 1
|
||||
# endif
|
||||
#define BULSPD 5 /* bullets movement speed */
|
||||
#define ISHOTS 15
|
||||
#define NSHOTS 5
|
||||
#define MAXNCSHOT 2
|
||||
#define MAXDAM 10
|
||||
#define MINDAM 5
|
||||
#define STABDAM 2
|
||||
|
||||
# define CLOAKLEN 20
|
||||
# define SCANLEN (Nplayer * 20)
|
||||
# define EXPLEN 4
|
||||
#define BULREQ 1
|
||||
#define GRENREQ 9
|
||||
#define SATREQ 25
|
||||
#define BOMB7REQ 49
|
||||
#define BOMB9REQ 81
|
||||
#define BOMB11REQ 121
|
||||
#define BOMB13REQ 169
|
||||
#define BOMB15REQ 225
|
||||
#define BOMB17REQ 289
|
||||
#define BOMB19REQ 361
|
||||
#define BOMB21REQ 441
|
||||
#define MAXBOMB 11
|
||||
#ifdef DRONE
|
||||
#define MINDSHOT 2 /* At least a satchel bomb */
|
||||
#endif
|
||||
extern int shot_req[];
|
||||
extern int shot_type[];
|
||||
#ifdef OOZE
|
||||
#define SLIME_FACTOR 3
|
||||
#define SLIMEREQ 5
|
||||
#define SSLIMEREQ 10
|
||||
#define SLIME2REQ 15
|
||||
#define SLIME3REQ 20
|
||||
#define MAXSLIME 4
|
||||
#define SLIMESPEED 5
|
||||
extern int slime_req[];
|
||||
#endif
|
||||
#ifdef VOLCANO
|
||||
#define LAVASPEED 1
|
||||
#endif
|
||||
|
||||
# define Q_QUIT 0
|
||||
# define Q_CLOAK 1
|
||||
# define Q_FLY 2
|
||||
# define Q_SCAN 3
|
||||
# define Q_MESSAGE 4
|
||||
#define CLOAKLEN 20
|
||||
#define SCANLEN (Nplayer * 20)
|
||||
#define EXPLEN 4
|
||||
|
||||
# define C_PLAYER 0
|
||||
# define C_MONITOR 1
|
||||
# define C_MESSAGE 2
|
||||
# define C_SCORES 3
|
||||
#define Q_QUIT 0
|
||||
#define Q_CLOAK 1
|
||||
#define Q_FLY 2
|
||||
#define Q_SCAN 3
|
||||
#define Q_MESSAGE 4
|
||||
|
||||
# ifdef MONITOR
|
||||
# define C_TESTMSG() (Query_driver ? C_MESSAGE :\
|
||||
(Show_scores ? C_SCORES :\
|
||||
(Am_monitor ? C_MONITOR :\
|
||||
C_PLAYER)))
|
||||
# else
|
||||
# define C_TESTMSG() (Show_scores ? C_SCORES :\
|
||||
(Query_driver ? C_MESSAGE :\
|
||||
C_PLAYER))
|
||||
# endif
|
||||
#define C_PLAYER 0
|
||||
#define C_MONITOR 1
|
||||
#define C_MESSAGE 2
|
||||
#define C_SCORES 3
|
||||
|
||||
# ifdef FLY
|
||||
# define _scan_char(pp) (((pp)->p_scan < 0) ? ' ' : '*')
|
||||
# define _cloak_char(pp) (((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
|
||||
# define stat_char(pp) (((pp)->p_flying < 0) ? _cloak_char(pp) : FLYER)
|
||||
# else
|
||||
# define _scan_char(pp) (((pp)->p_scan < 0) ? ' ' : '*')
|
||||
# define stat_char(pp) (((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
|
||||
# endif
|
||||
#ifdef MONITOR
|
||||
#define C_TESTMSG() (Query_driver ? C_MESSAGE :\
|
||||
(Show_scores ? C_SCORES :\
|
||||
(Am_monitor ? C_MONITOR :\
|
||||
C_PLAYER)))
|
||||
#else
|
||||
#define C_TESTMSG() (Show_scores ? C_SCORES :\
|
||||
(Query_driver ? C_MESSAGE :\
|
||||
C_PLAYER))
|
||||
#endif
|
||||
|
||||
#ifdef FLY
|
||||
#define _scan_char(pp) (((pp)->p_scan < 0) ? ' ' : '*')
|
||||
#define _cloak_char(pp) (((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
|
||||
#define stat_char(pp) (((pp)->p_flying < 0) ? _cloak_char(pp) : FLYER)
|
||||
#else
|
||||
#define _scan_char(pp) (((pp)->p_scan < 0) ? ' ' : '*')
|
||||
#define stat_char(pp) (((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
|
||||
#endif
|
||||
|
||||
typedef int FLAG;
|
||||
typedef struct bullet_def BULLET;
|
||||
|
@ -281,201 +286,201 @@ typedef struct expl_def EXPL;
|
|||
typedef struct player_def PLAYER;
|
||||
typedef struct ident_def IDENT;
|
||||
typedef struct regen_def REGEN;
|
||||
# ifdef INTERNET
|
||||
#ifdef INTERNET
|
||||
typedef struct sockaddr_in SOCKET;
|
||||
# else
|
||||
#else
|
||||
typedef struct sockaddr_un SOCKET;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
struct ident_def {
|
||||
char i_name[NAMELEN];
|
||||
char i_team;
|
||||
char i_name[NAMELEN];
|
||||
char i_team;
|
||||
uint32_t i_machine;
|
||||
uint32_t i_uid;
|
||||
float i_kills;
|
||||
int i_entries;
|
||||
float i_score;
|
||||
int i_absorbed;
|
||||
int i_faced;
|
||||
int i_shot;
|
||||
int i_robbed;
|
||||
int i_slime;
|
||||
int i_missed;
|
||||
int i_ducked;
|
||||
int i_gkills, i_bkills, i_deaths, i_stillb, i_saved;
|
||||
IDENT *i_next;
|
||||
float i_kills;
|
||||
int i_entries;
|
||||
float i_score;
|
||||
int i_absorbed;
|
||||
int i_faced;
|
||||
int i_shot;
|
||||
int i_robbed;
|
||||
int i_slime;
|
||||
int i_missed;
|
||||
int i_ducked;
|
||||
int i_gkills, i_bkills, i_deaths, i_stillb, i_saved;
|
||||
IDENT *i_next;
|
||||
};
|
||||
|
||||
struct player_def {
|
||||
IDENT *p_ident;
|
||||
char p_over;
|
||||
int p_face;
|
||||
int p_undershot;
|
||||
# ifdef FLY
|
||||
int p_flying;
|
||||
int p_flyx, p_flyy;
|
||||
# endif
|
||||
# ifdef BOOTS
|
||||
int p_nboots;
|
||||
# endif
|
||||
FILE *p_output;
|
||||
int p_fd;
|
||||
int p_mask;
|
||||
int p_damage;
|
||||
int p_damcap;
|
||||
int p_ammo;
|
||||
int p_ncshot;
|
||||
int p_scan;
|
||||
int p_cloak;
|
||||
int p_x, p_y;
|
||||
int p_ncount;
|
||||
int p_nexec;
|
||||
long p_nchar;
|
||||
char p_death[MSGLEN];
|
||||
char p_maze[HEIGHT][WIDTH2];
|
||||
int p_curx, p_cury;
|
||||
int p_lastx, p_lasty;
|
||||
char p_cbuf[BUFSIZ];
|
||||
IDENT *p_ident;
|
||||
char p_over;
|
||||
int p_face;
|
||||
int p_undershot;
|
||||
#ifdef FLY
|
||||
int p_flying;
|
||||
int p_flyx, p_flyy;
|
||||
#endif
|
||||
#ifdef BOOTS
|
||||
int p_nboots;
|
||||
#endif
|
||||
FILE *p_output;
|
||||
int p_fd;
|
||||
int p_mask;
|
||||
int p_damage;
|
||||
int p_damcap;
|
||||
int p_ammo;
|
||||
int p_ncshot;
|
||||
int p_scan;
|
||||
int p_cloak;
|
||||
int p_x, p_y;
|
||||
int p_ncount;
|
||||
int p_nexec;
|
||||
long p_nchar;
|
||||
char p_death[MSGLEN];
|
||||
char p_maze[HEIGHT][WIDTH2];
|
||||
int p_curx, p_cury;
|
||||
int p_lastx, p_lasty;
|
||||
char p_cbuf[BUFSIZ];
|
||||
};
|
||||
|
||||
struct bullet_def {
|
||||
int b_x, b_y;
|
||||
int b_face;
|
||||
int b_charge;
|
||||
char b_type;
|
||||
char b_size;
|
||||
char b_over;
|
||||
PLAYER *b_owner;
|
||||
IDENT *b_score;
|
||||
FLAG b_expl;
|
||||
BULLET *b_next;
|
||||
int b_x, b_y;
|
||||
int b_face;
|
||||
int b_charge;
|
||||
char b_type;
|
||||
char b_size;
|
||||
char b_over;
|
||||
PLAYER *b_owner;
|
||||
IDENT *b_score;
|
||||
FLAG b_expl;
|
||||
BULLET *b_next;
|
||||
};
|
||||
|
||||
struct expl_def {
|
||||
int e_x, e_y;
|
||||
char e_char;
|
||||
EXPL *e_next;
|
||||
int e_x, e_y;
|
||||
char e_char;
|
||||
EXPL *e_next;
|
||||
};
|
||||
|
||||
struct regen_def {
|
||||
int r_x, r_y;
|
||||
REGEN *r_next;
|
||||
int r_x, r_y;
|
||||
REGEN *r_next;
|
||||
};
|
||||
|
||||
/*
|
||||
* external variables
|
||||
*/
|
||||
|
||||
extern FLAG Last_player;
|
||||
extern FLAG Last_player;
|
||||
|
||||
extern char Buf[BUFSIZ], Maze[HEIGHT][WIDTH2], Orig_maze[HEIGHT][WIDTH2];
|
||||
extern char Buf[BUFSIZ], Maze[HEIGHT][WIDTH2], Orig_maze[HEIGHT][WIDTH2];
|
||||
|
||||
extern const char *Driver;
|
||||
|
||||
extern int Nplayer, Socket, Status;
|
||||
extern struct pollfd fdset[];
|
||||
extern int Nplayer, Socket, Status;
|
||||
extern struct pollfd fdset[];
|
||||
|
||||
# ifdef INTERNET
|
||||
extern u_short Test_port;
|
||||
# else
|
||||
extern char *Sock_name, *Stat_name;
|
||||
# endif
|
||||
#ifdef INTERNET
|
||||
extern u_short Test_port;
|
||||
#else
|
||||
extern char *Sock_name, *Stat_name;
|
||||
#endif
|
||||
|
||||
# ifdef VOLCANO
|
||||
extern int volcano;
|
||||
# endif
|
||||
#ifdef VOLCANO
|
||||
extern int volcano;
|
||||
#endif
|
||||
|
||||
extern int See_over[NASCII];
|
||||
extern int See_over[NASCII];
|
||||
|
||||
extern BULLET *Bullets;
|
||||
extern BULLET *Bullets;
|
||||
|
||||
extern EXPL *Expl[EXPLEN];
|
||||
extern EXPL *Last_expl;
|
||||
extern EXPL *Expl[EXPLEN];
|
||||
extern EXPL *Last_expl;
|
||||
|
||||
extern IDENT *Scores;
|
||||
extern IDENT *Scores;
|
||||
|
||||
extern PLAYER Player[MAXPL], *End_player;
|
||||
# ifdef BOOTS
|
||||
extern PLAYER Boot[NBOOTS];
|
||||
# endif
|
||||
extern PLAYER Player[MAXPL], *End_player;
|
||||
#ifdef BOOTS
|
||||
extern PLAYER Boot[NBOOTS];
|
||||
#endif
|
||||
|
||||
# ifdef MONITOR
|
||||
extern FLAG Am_monitor;
|
||||
extern PLAYER Monitor[MAXMON], *End_monitor;
|
||||
# endif
|
||||
#ifdef MONITOR
|
||||
extern FLAG Am_monitor;
|
||||
extern PLAYER Monitor[MAXMON], *End_monitor;
|
||||
#endif
|
||||
|
||||
# ifdef INTERNET
|
||||
extern char *Send_message;
|
||||
# endif
|
||||
#ifdef INTERNET
|
||||
extern char *Send_message;
|
||||
#endif
|
||||
|
||||
extern char map_key[256];
|
||||
extern FLAG no_beep;
|
||||
extern char map_key[256];
|
||||
extern FLAG no_beep;
|
||||
|
||||
/*
|
||||
* function types
|
||||
*/
|
||||
|
||||
void add_shot(int, int, int, char, int, PLAYER *, int, char);
|
||||
int answer(void);
|
||||
void bad_con(void) __dead;
|
||||
void bad_ver(void) __dead;
|
||||
int broadcast_vec(int, struct sockaddr **);
|
||||
void ce(PLAYER *);
|
||||
void cgoto(PLAYER *, int, int);
|
||||
void check(PLAYER *, int, int);
|
||||
void checkdam(PLAYER *, PLAYER *, IDENT *, int, char);
|
||||
void clearwalls(void);
|
||||
void clear_eol(void);
|
||||
void clear_the_screen(void);
|
||||
void clrscr(PLAYER *);
|
||||
BULLET *create_shot(int, int, int, char, int, int, PLAYER *,
|
||||
void add_shot(int, int, int, char, int, PLAYER *, int, char);
|
||||
int answer(void);
|
||||
void bad_con(void) __dead;
|
||||
void bad_ver(void) __dead;
|
||||
int broadcast_vec(int, struct sockaddr **);
|
||||
void ce(PLAYER *);
|
||||
void cgoto(PLAYER *, int, int);
|
||||
void check(PLAYER *, int, int);
|
||||
void checkdam(PLAYER *, PLAYER *, IDENT *, int, char);
|
||||
void clearwalls(void);
|
||||
void clear_eol(void);
|
||||
void clear_the_screen(void);
|
||||
void clrscr(PLAYER *);
|
||||
BULLET *create_shot(int, int, int, char, int, int, PLAYER *,
|
||||
IDENT *, int, char);
|
||||
void do_connect(char *, char, long);
|
||||
void do_message(void);
|
||||
void drawmaze(PLAYER *);
|
||||
void drawplayer(PLAYER *, FLAG);
|
||||
void drawstatus(PLAYER *);
|
||||
void execute(PLAYER *);
|
||||
void faketalk(void);
|
||||
void find_driver(FLAG);
|
||||
void fixshots(int, int, char);
|
||||
IDENT *get_ident(uint32_t, uint32_t, char *, char);
|
||||
void get_local_name(char *);
|
||||
int get_remote_name(char *);
|
||||
BULLET *is_bullet(int, int);
|
||||
void look(PLAYER *);
|
||||
void makemaze(void);
|
||||
void message(PLAYER *, const char *);
|
||||
void mon_execute(PLAYER *);
|
||||
void moveshots(void);
|
||||
void open_ctl(void);
|
||||
int opposite(int, char);
|
||||
void otto(int, int, char);
|
||||
void outch(PLAYER *, int);
|
||||
void outstr(PLAYER *, const char *, int);
|
||||
int player_sym(PLAYER *, int, int);
|
||||
PLAYER *play_at(int, int);
|
||||
void playit(void);
|
||||
void put_ch(char);
|
||||
void put_str(char *);
|
||||
int quit(int);
|
||||
int rand_dir(void);
|
||||
int rand_num(int);
|
||||
void redraw_screen(void);
|
||||
void rmnl(char *);
|
||||
void rollexpl(void);
|
||||
void see(PLAYER *, int);
|
||||
void sendcom(PLAYER *, int, ...);
|
||||
void showexpl(int, int, char);
|
||||
void showstat(PLAYER *);
|
||||
void start_driver(void);
|
||||
void stmonitor(PLAYER *);
|
||||
void stplayer(PLAYER *, int);
|
||||
char translate(char);
|
||||
SIGNAL_TYPE cleanup(int) __dead;
|
||||
SIGNAL_TYPE intr(int);
|
||||
SIGNAL_TYPE sigalrm(int);
|
||||
SIGNAL_TYPE sigemt(int) __dead;
|
||||
SIGNAL_TYPE sigterm(int) __dead;
|
||||
SIGNAL_TYPE sigusr1(int) __dead;
|
||||
SIGNAL_TYPE tstp(int);
|
||||
void do_connect(char *, char, long);
|
||||
void do_message(void);
|
||||
void drawmaze(PLAYER *);
|
||||
void drawplayer(PLAYER *, FLAG);
|
||||
void drawstatus(PLAYER *);
|
||||
void execute(PLAYER *);
|
||||
void faketalk(void);
|
||||
void find_driver(FLAG);
|
||||
void fixshots(int, int, char);
|
||||
IDENT *get_ident(uint32_t, uint32_t, char *, char);
|
||||
void get_local_name(char *);
|
||||
int get_remote_name(char *);
|
||||
BULLET *is_bullet(int, int);
|
||||
void look(PLAYER *);
|
||||
void makemaze(void);
|
||||
void message(PLAYER *, const char *);
|
||||
void mon_execute(PLAYER *);
|
||||
void moveshots(void);
|
||||
void open_ctl(void);
|
||||
int opposite(int, char);
|
||||
void otto(int, int, char);
|
||||
void outch(PLAYER *, int);
|
||||
void outstr(PLAYER *, const char *, int);
|
||||
int player_sym(PLAYER *, int, int);
|
||||
PLAYER *play_at(int, int);
|
||||
void playit(void);
|
||||
void put_ch(char);
|
||||
void put_str(char *);
|
||||
int quit(int);
|
||||
int rand_dir(void);
|
||||
int rand_num(int);
|
||||
void redraw_screen(void);
|
||||
void rmnl(char *);
|
||||
void rollexpl(void);
|
||||
void see(PLAYER *, int);
|
||||
void sendcom(PLAYER *, int, ...);
|
||||
void showexpl(int, int, char);
|
||||
void showstat(PLAYER *);
|
||||
void start_driver(void);
|
||||
void stmonitor(PLAYER *);
|
||||
void stplayer(PLAYER *, int);
|
||||
char translate(char);
|
||||
SIGNAL_TYPE cleanup(int) __dead;
|
||||
SIGNAL_TYPE intr(int);
|
||||
SIGNAL_TYPE sigalrm(int);
|
||||
SIGNAL_TYPE sigemt(int) __dead;
|
||||
SIGNAL_TYPE sigterm(int) __dead;
|
||||
SIGNAL_TYPE sigusr1(int) __dead;
|
||||
SIGNAL_TYPE tstp(int);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: makemaze.c,v 1.5 2009/07/04 02:37:20 dholland Exp $ */
|
||||
/* $NetBSD: makemaze.c,v 1.6 2009/07/04 04:29:55 dholland Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1983-2003, Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -32,24 +32,24 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: makemaze.c,v 1.5 2009/07/04 02:37:20 dholland Exp $");
|
||||
__RCSID("$NetBSD: makemaze.c,v 1.6 2009/07/04 04:29:55 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
# include "hunt.h"
|
||||
#include "hunt.h"
|
||||
|
||||
# define ISCLEAR(y,x) (Maze[y][x] == SPACE)
|
||||
# define ODD(n) ((n) & 01)
|
||||
#define ISCLEAR(y,x) (Maze[y][x] == SPACE)
|
||||
#define ODD(n) ((n) & 01)
|
||||
|
||||
static int candig(int, int);
|
||||
static void dig(int, int);
|
||||
static void dig_maze(int, int);
|
||||
static void remap(void);
|
||||
static int candig(int, int);
|
||||
static void dig(int, int);
|
||||
static void dig_maze(int, int);
|
||||
static void remap(void);
|
||||
|
||||
void
|
||||
makemaze(void)
|
||||
{
|
||||
char *sp;
|
||||
int y, x;
|
||||
char *sp;
|
||||
int y, x;
|
||||
|
||||
/*
|
||||
* fill maze with walls
|
||||
|
@ -64,29 +64,29 @@ makemaze(void)
|
|||
remap();
|
||||
}
|
||||
|
||||
# define NPERM 24
|
||||
# define NDIR 4
|
||||
#define NPERM 24
|
||||
#define NDIR 4
|
||||
|
||||
int dirs[NPERM][NDIR] = {
|
||||
{0,1,2,3}, {3,0,1,2}, {0,2,3,1}, {0,3,2,1},
|
||||
{1,0,2,3}, {2,3,0,1}, {0,2,1,3}, {2,3,1,0},
|
||||
{1,0,3,2}, {1,2,0,3}, {3,1,2,0}, {2,0,3,1},
|
||||
{1,3,0,2}, {0,3,1,2}, {1,3,2,0}, {2,0,1,3},
|
||||
{0,1,3,2}, {3,1,0,2}, {2,1,0,3}, {1,2,3,0},
|
||||
{2,1,3,0}, {3,0,2,1}, {3,2,0,1}, {3,2,1,0}
|
||||
};
|
||||
int dirs[NPERM][NDIR] = {
|
||||
{0,1,2,3}, {3,0,1,2}, {0,2,3,1}, {0,3,2,1},
|
||||
{1,0,2,3}, {2,3,0,1}, {0,2,1,3}, {2,3,1,0},
|
||||
{1,0,3,2}, {1,2,0,3}, {3,1,2,0}, {2,0,3,1},
|
||||
{1,3,0,2}, {0,3,1,2}, {1,3,2,0}, {2,0,1,3},
|
||||
{0,1,3,2}, {3,1,0,2}, {2,1,0,3}, {1,2,3,0},
|
||||
{2,1,3,0}, {3,0,2,1}, {3,2,0,1}, {3,2,1,0}
|
||||
};
|
||||
|
||||
int incr[NDIR][2] = {
|
||||
{0, 1}, {1, 0}, {0, -1}, {-1, 0}
|
||||
};
|
||||
int incr[NDIR][2] = {
|
||||
{0, 1}, {1, 0}, {0, -1}, {-1, 0}
|
||||
};
|
||||
|
||||
static void
|
||||
dig(int y, int x)
|
||||
{
|
||||
int *dp;
|
||||
int *ip;
|
||||
int ny, nx;
|
||||
int *endp;
|
||||
int *dp;
|
||||
int *ip;
|
||||
int ny, nx;
|
||||
int *endp;
|
||||
|
||||
Maze[y][x] = SPACE; /* Clear this spot */
|
||||
dp = dirs[rand_num(NPERM)];
|
||||
|
@ -107,7 +107,7 @@ dig(int y, int x)
|
|||
static int
|
||||
candig(int y, int x)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if (ODD(x) && ODD(y))
|
||||
return FALSE; /* can't touch ODD spots */
|
||||
|
@ -137,13 +137,13 @@ candig(int y, int x)
|
|||
void
|
||||
dig_maze(int x, int y)
|
||||
{
|
||||
int tx, ty;
|
||||
int i, j;
|
||||
int order[4];
|
||||
#define MNORTH 0x1
|
||||
#define MSOUTH 0x2
|
||||
#define MEAST 0x4
|
||||
#define MWEST 0x8
|
||||
int tx, ty;
|
||||
int i, j;
|
||||
int order[4];
|
||||
#define MNORTH 0x1
|
||||
#define MSOUTH 0x2
|
||||
#define MEAST 0x4
|
||||
#define MWEST 0x8
|
||||
|
||||
tx = ty = 0;
|
||||
Maze[y][x] = SPACE;
|
||||
|
@ -184,9 +184,9 @@ dig_maze(int x, int y)
|
|||
void
|
||||
remap(void)
|
||||
{
|
||||
int y, x;
|
||||
char *sp;
|
||||
int stat;
|
||||
int y, x;
|
||||
char *sp;
|
||||
int stat;
|
||||
|
||||
for (y = 0; y < HEIGHT; y++)
|
||||
for (x = 0; x < WIDTH; x++) {
|
||||
|
@ -214,12 +214,12 @@ remap(void)
|
|||
*sp = WALL2;
|
||||
break;
|
||||
case 0:
|
||||
# ifdef RANDOM
|
||||
#ifdef RANDOM
|
||||
*sp = DOOR;
|
||||
# endif
|
||||
# ifdef REFLECT
|
||||
#endif
|
||||
#ifdef REFLECT
|
||||
*sp = rand_num(2) ? WALL4 : WALL5;
|
||||
# endif
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
*sp = WALL3;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pathname.c,v 1.4 2008/01/28 03:23:29 dholland Exp $ */
|
||||
/* $NetBSD: pathname.c,v 1.5 2009/07/04 04:29:55 dholland Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1983-2003, Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: pathname.c,v 1.4 2008/01/28 03:23:29 dholland Exp $");
|
||||
__RCSID("$NetBSD: pathname.c,v 1.5 2009/07/04 04:29:55 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
|
@ -41,26 +41,26 @@ __RCSID("$NetBSD: pathname.c,v 1.4 2008/01/28 03:23:29 dholland Exp $");
|
|||
* range reserved for privileged sockets.
|
||||
*/
|
||||
|
||||
# include <sys/types.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
# ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
|
||||
char *Driver = "/home/socr/a/conrad/games/src/hunt/huntd.dbg";
|
||||
# ifdef INTERNET
|
||||
u_short Test_port = ('h' << 8) | 't';
|
||||
# else
|
||||
char *Sock_name = "/tmp/hunt";
|
||||
char *Stat_name = "/tmp/hunt.stats";
|
||||
# endif
|
||||
char *Driver = "/home/socr/a/conrad/games/src/hunt/huntd.dbg";
|
||||
#ifdef INTERNET
|
||||
u_short Test_port = ('h' << 8) | 't';
|
||||
#else
|
||||
char *Sock_name = "/tmp/hunt";
|
||||
char *Stat_name = "/tmp/hunt.stats";
|
||||
#endif
|
||||
|
||||
# else
|
||||
#else
|
||||
|
||||
const char *Driver = HUNTD;
|
||||
# ifdef INTERNET
|
||||
u_short Test_port = ('h' << 8) | 't';
|
||||
# else
|
||||
char *Sock_name = "/tmp/hunt";
|
||||
char *Stat_name = "/tmp/hunt.stats";
|
||||
# endif
|
||||
const char *Driver = HUNTD;
|
||||
#ifdef INTERNET
|
||||
u_short Test_port = ('h' << 8) | 't';
|
||||
#else
|
||||
char *Sock_name = "/tmp/hunt";
|
||||
char *Stat_name = "/tmp/hunt.stats";
|
||||
#endif
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: shots.c,v 1.9 2009/07/04 02:37:20 dholland Exp $ */
|
||||
/* $NetBSD: shots.c,v 1.10 2009/07/04 04:29:55 dholland Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1983-2003, Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -32,32 +32,32 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: shots.c,v 1.9 2009/07/04 02:37:20 dholland Exp $");
|
||||
__RCSID("$NetBSD: shots.c,v 1.10 2009/07/04 04:29:55 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
# include <err.h>
|
||||
# include <signal.h>
|
||||
# include <stdlib.h>
|
||||
# include "hunt.h"
|
||||
#include <err.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include "hunt.h"
|
||||
|
||||
# define PLUS_DELTA(x, max) if (x < max) x++; else x--
|
||||
# define MINUS_DELTA(x, min) if (x > min) x--; else x++
|
||||
#define PLUS_DELTA(x, max) if (x < max) x++; else x--
|
||||
#define MINUS_DELTA(x, min) if (x > min) x--; else x++
|
||||
|
||||
static void chkshot(BULLET *, BULLET *);
|
||||
static void chkslime(BULLET *, BULLET *);
|
||||
static void explshot(BULLET *, int, int);
|
||||
static void find_under(BULLET *, BULLET *);
|
||||
static int iswall(int, int);
|
||||
static void mark_boot(BULLET *);
|
||||
static void mark_player(BULLET *);
|
||||
static void chkshot(BULLET *, BULLET *);
|
||||
static void chkslime(BULLET *, BULLET *);
|
||||
static void explshot(BULLET *, int, int);
|
||||
static void find_under(BULLET *, BULLET *);
|
||||
static int iswall(int, int);
|
||||
static void mark_boot(BULLET *);
|
||||
static void mark_player(BULLET *);
|
||||
#ifdef DRONE
|
||||
static void move_drone(BULLET *);
|
||||
static void move_drone(BULLET *);
|
||||
#endif
|
||||
static void move_flyer(PLAYER *);
|
||||
static int move_normal_shot(BULLET *);
|
||||
static void move_slime(BULLET *, int, BULLET *);
|
||||
static void save_bullet(BULLET *);
|
||||
static void zapshot(BULLET *, BULLET *);
|
||||
static void move_flyer(PLAYER *);
|
||||
static int move_normal_shot(BULLET *);
|
||||
static void move_slime(BULLET *, int, BULLET *);
|
||||
static void save_bullet(BULLET *);
|
||||
static void zapshot(BULLET *, BULLET *);
|
||||
|
||||
/*
|
||||
* moveshots:
|
||||
|
@ -66,10 +66,10 @@ static void zapshot(BULLET *, BULLET *);
|
|||
void
|
||||
moveshots(void)
|
||||
{
|
||||
BULLET *bp, *next;
|
||||
PLAYER *pp;
|
||||
int x, y;
|
||||
BULLET *blist;
|
||||
BULLET *bp, *next;
|
||||
PLAYER *pp;
|
||||
int x, y;
|
||||
BULLET *blist;
|
||||
|
||||
rollexpl();
|
||||
if (Bullets == NULL)
|
||||
|
@ -91,10 +91,10 @@ moveshots(void)
|
|||
Maze[y][x] = bp->b_over;
|
||||
for (pp = Player; pp < End_player; pp++)
|
||||
check(pp, y, x);
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; pp++)
|
||||
check(pp, y, x);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
switch (bp->b_type) {
|
||||
case SHOT:
|
||||
|
@ -106,22 +106,22 @@ moveshots(void)
|
|||
Bullets = bp;
|
||||
}
|
||||
break;
|
||||
# ifdef OOZE
|
||||
#ifdef OOZE
|
||||
case SLIME:
|
||||
if (bp->b_expl || move_normal_shot(bp)) {
|
||||
bp->b_next = Bullets;
|
||||
Bullets = bp;
|
||||
}
|
||||
break;
|
||||
# endif
|
||||
# ifdef DRONE
|
||||
#endif
|
||||
#ifdef DRONE
|
||||
case DSHOT:
|
||||
if (move_drone(bp)) {
|
||||
bp->b_next = Bullets;
|
||||
Bullets = bp;
|
||||
}
|
||||
break;
|
||||
# endif
|
||||
#endif
|
||||
default:
|
||||
bp->b_next = Bullets;
|
||||
Bullets = bp;
|
||||
|
@ -135,16 +135,16 @@ moveshots(void)
|
|||
next = bp->b_next;
|
||||
if (!bp->b_expl) {
|
||||
save_bullet(bp);
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; pp++)
|
||||
check(pp, bp->b_y, bp->b_x);
|
||||
# endif
|
||||
# ifdef DRONE
|
||||
#endif
|
||||
#ifdef DRONE
|
||||
if (bp->b_type == DSHOT)
|
||||
for (pp = Player; pp < End_player; pp++)
|
||||
if (pp->p_scan >= 0)
|
||||
check(pp, bp->b_y, bp->b_x);
|
||||
# endif
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -156,24 +156,24 @@ moveshots(void)
|
|||
Maze[pp->p_y][pp->p_x] = pp->p_face;
|
||||
|
||||
ret:
|
||||
# ifdef BOOTS
|
||||
#ifdef BOOTS
|
||||
for (pp = Boot; pp < &Boot[NBOOTS]; pp++)
|
||||
if (pp->p_flying >= 0)
|
||||
move_flyer(pp);
|
||||
# endif
|
||||
#endif
|
||||
for (pp = Player; pp < End_player; pp++) {
|
||||
# ifdef FLY
|
||||
#ifdef FLY
|
||||
if (pp->p_flying >= 0)
|
||||
move_flyer(pp);
|
||||
# endif
|
||||
#endif
|
||||
sendcom(pp, REFRESH); /* Flush out the explosions */
|
||||
look(pp);
|
||||
sendcom(pp, REFRESH);
|
||||
}
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; pp++)
|
||||
sendcom(pp, REFRESH);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -185,8 +185,8 @@ ret:
|
|||
static int
|
||||
move_normal_shot(BULLET *bp)
|
||||
{
|
||||
int i, x, y;
|
||||
PLAYER *pp;
|
||||
int i, x, y;
|
||||
PLAYER *pp;
|
||||
|
||||
for (i = 0; i < BULSPD; i++) {
|
||||
if (bp->b_expl)
|
||||
|
@ -223,7 +223,7 @@ move_normal_shot(BULLET *bp)
|
|||
zapshot(bp->b_next, bp);
|
||||
}
|
||||
break;
|
||||
# ifdef REFLECT
|
||||
#ifdef REFLECT
|
||||
case WALL4: /* reflecting walls */
|
||||
switch (bp->b_face) {
|
||||
case LEFTS:
|
||||
|
@ -240,10 +240,10 @@ move_normal_shot(BULLET *bp)
|
|||
break;
|
||||
}
|
||||
Maze[y][x] = WALL5;
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; pp++)
|
||||
check(pp, y, x);
|
||||
# endif
|
||||
#endif
|
||||
break;
|
||||
case WALL5:
|
||||
switch (bp->b_face) {
|
||||
|
@ -261,13 +261,13 @@ move_normal_shot(BULLET *bp)
|
|||
break;
|
||||
}
|
||||
Maze[y][x] = WALL4;
|
||||
# ifdef MONITOR
|
||||
#ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; pp++)
|
||||
check(pp, y, x);
|
||||
# endif
|
||||
#endif
|
||||
break;
|
||||
# endif
|
||||
# ifdef RANDOM
|
||||
#endif
|
||||
#ifdef RANDOM
|
||||
case DOOR:
|
||||
switch (rand_num(4)) {
|
||||
case 0:
|
||||
|
@ -284,13 +284,13 @@ move_normal_shot(BULLET *bp)
|
|||
break;
|
||||
}
|
||||
break;
|
||||
# endif
|
||||
# ifdef FLY
|
||||
#endif
|
||||
#ifdef FLY
|
||||
case FLYER:
|
||||
pp = play_at(y, x);
|
||||
message(pp, "Zing!");
|
||||
break;
|
||||
# endif
|
||||
#endif
|
||||
case LEFTS:
|
||||
case RIGHT:
|
||||
case BELOW:
|
||||
|
@ -348,9 +348,9 @@ move_normal_shot(BULLET *bp)
|
|||
* The shot hit that sucker! Blow it up.
|
||||
*/
|
||||
/* FALLTHROUGH */
|
||||
# ifndef RANDOM
|
||||
#ifndef RANDOM
|
||||
case DOOR:
|
||||
# endif
|
||||
#endif
|
||||
case WALL1:
|
||||
case WALL2:
|
||||
case WALL3:
|
||||
|
@ -364,7 +364,7 @@ move_normal_shot(BULLET *bp)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
# ifdef DRONE
|
||||
#ifdef DRONE
|
||||
/*
|
||||
* move_drone:
|
||||
* Move the drone to the next square
|
||||
|
@ -372,9 +372,9 @@ move_normal_shot(BULLET *bp)
|
|||
static void
|
||||
move_drone(BULLET *bp)
|
||||
{
|
||||
int mask, count;
|
||||
int n, dir;
|
||||
PLAYER *pp;
|
||||
int mask, count;
|
||||
int n, dir;
|
||||
PLAYER *pp;
|
||||
|
||||
/*
|
||||
* See if we can give someone a blast
|
||||
|
@ -506,7 +506,7 @@ drone_move:
|
|||
}
|
||||
return TRUE;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* save_bullet:
|
||||
|
@ -521,15 +521,15 @@ save_bullet(BULLET *bp)
|
|||
case GRENADE:
|
||||
case SATCHEL:
|
||||
case BOMB:
|
||||
# ifdef OOZE
|
||||
#ifdef OOZE
|
||||
case SLIME:
|
||||
# ifdef VOLCANO
|
||||
#ifdef VOLCANO
|
||||
case LAVA:
|
||||
# endif
|
||||
# endif
|
||||
# ifdef DRONE
|
||||
#endif
|
||||
#endif
|
||||
#ifdef DRONE
|
||||
case DSHOT:
|
||||
# endif
|
||||
#endif
|
||||
find_under(Bullets, bp);
|
||||
break;
|
||||
}
|
||||
|
@ -539,16 +539,16 @@ save_bullet(BULLET *bp)
|
|||
case RIGHT:
|
||||
case ABOVE:
|
||||
case BELOW:
|
||||
# ifdef FLY
|
||||
#ifdef FLY
|
||||
case FLYER:
|
||||
# endif
|
||||
#endif
|
||||
mark_player(bp);
|
||||
break;
|
||||
# ifdef BOOTS
|
||||
#ifdef BOOTS
|
||||
case BOOT:
|
||||
case BOOT_PAIR:
|
||||
mark_boot(bp);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
default:
|
||||
Maze[bp->b_y][bp->b_x] = bp->b_type;
|
||||
|
@ -566,7 +566,7 @@ save_bullet(BULLET *bp)
|
|||
static void
|
||||
move_flyer(PLAYER *pp)
|
||||
{
|
||||
int x, y;
|
||||
int x, y;
|
||||
|
||||
if (pp->p_undershot) {
|
||||
fixshots(pp->p_y, pp->p_x, pp->p_over);
|
||||
|
@ -612,13 +612,13 @@ again:
|
|||
case WALL1:
|
||||
case WALL2:
|
||||
case WALL3:
|
||||
# ifdef REFLECT
|
||||
#ifdef REFLECT
|
||||
case WALL4:
|
||||
case WALL5:
|
||||
# endif
|
||||
# ifdef RANDOM
|
||||
#endif
|
||||
#ifdef RANDOM
|
||||
case DOOR:
|
||||
# endif
|
||||
#endif
|
||||
if (pp->p_flying == 0)
|
||||
pp->p_flying++;
|
||||
break;
|
||||
|
@ -628,21 +628,21 @@ again:
|
|||
pp->p_y = y;
|
||||
pp->p_x = x;
|
||||
if (pp->p_flying-- == 0) {
|
||||
# ifdef BOOTS
|
||||
#ifdef BOOTS
|
||||
if (pp->p_face != BOOT && pp->p_face != BOOT_PAIR) {
|
||||
# endif
|
||||
#endif
|
||||
checkdam(pp, (PLAYER *) NULL, (IDENT *) NULL,
|
||||
rand_num(pp->p_damage / 5), FALL);
|
||||
pp->p_face = rand_dir();
|
||||
showstat(pp);
|
||||
# ifdef BOOTS
|
||||
#ifdef BOOTS
|
||||
}
|
||||
else {
|
||||
if (Maze[y][x] == BOOT)
|
||||
pp->p_face = BOOT_PAIR;
|
||||
Maze[y][x] = SPACE;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
pp->p_over = Maze[y][x];
|
||||
Maze[y][x] = pp->p_face;
|
||||
|
@ -656,11 +656,11 @@ again:
|
|||
static void
|
||||
chkshot(BULLET *bp, BULLET *next)
|
||||
{
|
||||
int y, x;
|
||||
int dy, dx, absdy;
|
||||
int delta, damage;
|
||||
char expl;
|
||||
PLAYER *pp;
|
||||
int y, x;
|
||||
int dy, dx, absdy;
|
||||
int delta, damage;
|
||||
char expl;
|
||||
PLAYER *pp;
|
||||
|
||||
delta = 0;
|
||||
switch (bp->b_type) {
|
||||
|
@ -672,20 +672,20 @@ chkshot(BULLET *bp, BULLET *next)
|
|||
case BOMB:
|
||||
delta = bp->b_size - 1;
|
||||
break;
|
||||
# ifdef OOZE
|
||||
#ifdef OOZE
|
||||
case SLIME:
|
||||
# ifdef VOLCANO
|
||||
#ifdef VOLCANO
|
||||
case LAVA:
|
||||
# endif
|
||||
#endif
|
||||
chkslime(bp, next);
|
||||
return;
|
||||
# endif
|
||||
# ifdef DRONE
|
||||
#endif
|
||||
#ifdef DRONE
|
||||
case DSHOT:
|
||||
bp->b_type = SLIME;
|
||||
chkslime(bp, next);
|
||||
return;
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
for (y = bp->b_y - delta; y <= bp->b_y + delta; y++) {
|
||||
if (y < 0 || y >= HEIGHT)
|
||||
|
@ -712,9 +712,9 @@ chkshot(BULLET *bp, BULLET *next)
|
|||
case RIGHT:
|
||||
case ABOVE:
|
||||
case BELOW:
|
||||
# ifdef FLY
|
||||
#ifdef FLY
|
||||
case FLYER:
|
||||
# endif
|
||||
#endif
|
||||
if (dx < 0)
|
||||
dx = -dx;
|
||||
if (absdy > dx)
|
||||
|
@ -740,7 +740,7 @@ chkshot(BULLET *bp, BULLET *next)
|
|||
}
|
||||
}
|
||||
|
||||
# ifdef OOZE
|
||||
#ifdef OOZE
|
||||
/*
|
||||
* chkslime:
|
||||
* handle slime shot exploding
|
||||
|
@ -754,13 +754,13 @@ chkslime(BULLET *bp, BULLET *next)
|
|||
case WALL1:
|
||||
case WALL2:
|
||||
case WALL3:
|
||||
# ifdef REFLECT
|
||||
#ifdef REFLECT
|
||||
case WALL4:
|
||||
case WALL5:
|
||||
# endif
|
||||
# ifdef RANDOM
|
||||
#endif
|
||||
#ifdef RANDOM
|
||||
case DOOR:
|
||||
# endif
|
||||
#endif
|
||||
switch (bp->b_face) {
|
||||
case LEFTS:
|
||||
bp->b_x++;
|
||||
|
@ -779,11 +779,11 @@ chkslime(BULLET *bp, BULLET *next)
|
|||
}
|
||||
nbp = malloc(sizeof(*nbp));
|
||||
*nbp = *bp;
|
||||
# ifdef VOLCANO
|
||||
#ifdef VOLCANO
|
||||
move_slime(nbp, nbp->b_type == SLIME ? SLIMESPEED : LAVASPEED, next);
|
||||
# else
|
||||
#else
|
||||
move_slime(nbp, SLIMESPEED, next);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -794,9 +794,9 @@ chkslime(BULLET *bp, BULLET *next)
|
|||
void
|
||||
move_slime(BULLET *bp, int speed, BULLET *next)
|
||||
{
|
||||
int i, j, dirmask, count;
|
||||
PLAYER *pp;
|
||||
BULLET *nbp;
|
||||
int i, j, dirmask, count;
|
||||
PLAYER *pp;
|
||||
BULLET *nbp;
|
||||
|
||||
if (speed == 0) {
|
||||
if (bp->b_charge <= 0)
|
||||
|
@ -806,19 +806,19 @@ move_slime(BULLET *bp, int speed, BULLET *next)
|
|||
return;
|
||||
}
|
||||
|
||||
# ifdef VOLCANO
|
||||
#ifdef VOLCANO
|
||||
showexpl(bp->b_y, bp->b_x, bp->b_type == LAVA ? LAVA : '*');
|
||||
# else
|
||||
#else
|
||||
showexpl(bp->b_y, bp->b_x, '*');
|
||||
# endif
|
||||
#endif
|
||||
switch (Maze[bp->b_y][bp->b_x]) {
|
||||
case LEFTS:
|
||||
case RIGHT:
|
||||
case ABOVE:
|
||||
case BELOW:
|
||||
# ifdef FLY
|
||||
#ifdef FLY
|
||||
case FLYER:
|
||||
# endif
|
||||
#endif
|
||||
pp = play_at(bp->b_y, bp->b_x);
|
||||
message(pp, "You've been slimed.");
|
||||
checkdam(pp, bp->b_owner, bp->b_score, MINDAM, bp->b_type);
|
||||
|
@ -827,9 +827,9 @@ move_slime(BULLET *bp, int speed, BULLET *next)
|
|||
case GRENADE:
|
||||
case SATCHEL:
|
||||
case BOMB:
|
||||
# ifdef DRONE
|
||||
#ifdef DRONE
|
||||
case DSHOT:
|
||||
# endif
|
||||
#endif
|
||||
explshot(next, bp->b_y, bp->b_x);
|
||||
explshot(Bullets, bp->b_y, bp->b_x);
|
||||
break;
|
||||
|
@ -957,24 +957,24 @@ iswall(int y, int x)
|
|||
case WALL1:
|
||||
case WALL2:
|
||||
case WALL3:
|
||||
# ifdef REFLECT
|
||||
#ifdef REFLECT
|
||||
case WALL4:
|
||||
case WALL5:
|
||||
# endif
|
||||
# ifdef RANDOM
|
||||
#endif
|
||||
#ifdef RANDOM
|
||||
case DOOR:
|
||||
# endif
|
||||
# ifdef OOZE
|
||||
#endif
|
||||
#ifdef OOZE
|
||||
case SLIME:
|
||||
# ifdef VOLCANO
|
||||
#ifdef VOLCANO
|
||||
case LAVA:
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* zapshot:
|
||||
|
@ -983,8 +983,8 @@ iswall(int y, int x)
|
|||
static void
|
||||
zapshot(BULLET *blist, BULLET *obp)
|
||||
{
|
||||
BULLET *bp;
|
||||
FLAG explode;
|
||||
BULLET *bp;
|
||||
FLAG explode;
|
||||
|
||||
explode = FALSE;
|
||||
for (bp = blist; bp != NULL; bp = bp->b_next) {
|
||||
|
@ -1007,7 +1007,7 @@ zapshot(BULLET *blist, BULLET *obp)
|
|||
void
|
||||
explshot(BULLET *blist, int y, int x)
|
||||
{
|
||||
BULLET *bp;
|
||||
BULLET *bp;
|
||||
|
||||
for (bp = blist; bp != NULL; bp = bp->b_next)
|
||||
if (bp->b_x == x && bp->b_y == y) {
|
||||
|
@ -1024,7 +1024,7 @@ explshot(BULLET *blist, int y, int x)
|
|||
PLAYER *
|
||||
play_at(int y, int x)
|
||||
{
|
||||
PLAYER *pp;
|
||||
PLAYER *pp;
|
||||
|
||||
for (pp = Player; pp < End_player; pp++)
|
||||
if (pp->p_x == x && pp->p_y == y)
|
||||
|
@ -1063,7 +1063,7 @@ opposite(int face, char dir)
|
|||
BULLET *
|
||||
is_bullet(int y, int x)
|
||||
{
|
||||
BULLET *bp;
|
||||
BULLET *bp;
|
||||
|
||||
for (bp = Bullets; bp != NULL; bp = bp->b_next)
|
||||
if (bp->b_y == y && bp->b_x == x)
|
||||
|
@ -1079,7 +1079,7 @@ is_bullet(int y, int x)
|
|||
void
|
||||
fixshots(int y, int x, char over)
|
||||
{
|
||||
BULLET *bp;
|
||||
BULLET *bp;
|
||||
|
||||
for (bp = Bullets; bp != NULL; bp = bp->b_next)
|
||||
if (bp->b_y == y && bp->b_x == x)
|
||||
|
@ -1094,7 +1094,7 @@ fixshots(int y, int x, char over)
|
|||
static void
|
||||
find_under(BULLET *blist, BULLET *bp)
|
||||
{
|
||||
BULLET *nbp;
|
||||
BULLET *nbp;
|
||||
|
||||
for (nbp = blist; nbp != NULL; nbp = nbp->b_next)
|
||||
if (bp->b_y == nbp->b_y && bp->b_x == nbp->b_x) {
|
||||
|
@ -1110,7 +1110,7 @@ find_under(BULLET *blist, BULLET *bp)
|
|||
static void
|
||||
mark_player(BULLET *bp)
|
||||
{
|
||||
PLAYER *pp;
|
||||
PLAYER *pp;
|
||||
|
||||
for (pp = Player; pp < End_player; pp++)
|
||||
if (pp->p_y == bp->b_y && pp->p_x == bp->b_x) {
|
||||
|
@ -1119,7 +1119,7 @@ mark_player(BULLET *bp)
|
|||
}
|
||||
}
|
||||
|
||||
# ifdef BOOTS
|
||||
#ifdef BOOTS
|
||||
/*
|
||||
* mark_boot:
|
||||
* mark a boot as under a shot
|
||||
|
@ -1127,7 +1127,7 @@ mark_player(BULLET *bp)
|
|||
static void
|
||||
mark_boot(BULLET *bp)
|
||||
{
|
||||
PLAYER *pp;
|
||||
PLAYER *pp;
|
||||
|
||||
for (pp = Boot; pp < &Boot[NBOOTS]; pp++)
|
||||
if (pp->p_y == bp->b_y && pp->p_x == bp->b_x) {
|
||||
|
@ -1135,4 +1135,4 @@ mark_boot(BULLET *bp)
|
|||
break;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: talk_ctl.h,v 1.6 2004/01/27 20:30:29 jsm Exp $ */
|
||||
/* $NetBSD: talk_ctl.h,v 1.7 2009/07/04 04:29:54 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983-2003, Regents of the University of California.
|
||||
|
@ -40,10 +40,10 @@
|
|||
|
||||
#include <sys/socket.h>
|
||||
|
||||
#define NAME_SIZE 9
|
||||
#define TTY_SIZE 16
|
||||
#define NAME_SIZE 9
|
||||
#define TTY_SIZE 16
|
||||
#ifndef MAXHOSTNAMELEN
|
||||
#define MAXHOSTNAMELEN 256
|
||||
#define MAXHOSTNAMELEN 256
|
||||
#endif
|
||||
|
||||
#define MAX_LIFE 60 /* max time daemon saves invitations */
|
||||
|
@ -88,19 +88,19 @@ typedef struct ctl_msg {
|
|||
#include <syslog.h>
|
||||
#endif
|
||||
|
||||
extern struct sockaddr_in daemon_addr;
|
||||
extern struct sockaddr_in ctl_addr;
|
||||
extern struct sockaddr_in my_addr;
|
||||
extern struct in_addr my_machine_addr;
|
||||
extern struct in_addr his_machine_addr;
|
||||
extern u_short daemon_port;
|
||||
extern int ctl_sockt;
|
||||
extern CTL_MSG msg;
|
||||
extern struct sockaddr_in daemon_addr;
|
||||
extern struct sockaddr_in ctl_addr;
|
||||
extern struct sockaddr_in my_addr;
|
||||
extern struct in_addr my_machine_addr;
|
||||
extern struct in_addr his_machine_addr;
|
||||
extern u_short daemon_port;
|
||||
extern int ctl_sockt;
|
||||
extern CTL_MSG msg;
|
||||
|
||||
#ifdef LOG
|
||||
#define p_error(str) syslog(LOG_WARNING, "faketalk %s: %m", str)
|
||||
#define p_error(str) syslog(LOG_WARNING, "faketalk %s: %m", str)
|
||||
#else
|
||||
#define p_error(str) warn(str)
|
||||
#define p_error(str) warn(str)
|
||||
#endif
|
||||
|
||||
void ctl_transact(struct in_addr, CTL_MSG, int, CTL_RESPONSE *);
|
||||
void ctl_transact(struct in_addr, CTL_MSG, int, CTL_RESPONSE *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: terminal.c,v 1.6 2009/07/04 02:37:20 dholland Exp $ */
|
||||
/* $NetBSD: terminal.c,v 1.7 2009/07/04 04:29:55 dholland Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1983-2003, Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -32,12 +32,12 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: terminal.c,v 1.6 2009/07/04 02:37:20 dholland Exp $");
|
||||
__RCSID("$NetBSD: terminal.c,v 1.7 2009/07/04 04:29:55 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "hunt.h"
|
||||
#define TERM_WIDTH 80 /* Assume terminals are 80-char wide */
|
||||
#define TERM_WIDTH 80 /* Assume terminals are 80-char wide */
|
||||
|
||||
/*
|
||||
* cgoto:
|
||||
|
@ -104,7 +104,7 @@ ce(PLAYER *pp)
|
|||
sendcom(pp, CLRTOEOL);
|
||||
}
|
||||
|
||||
#if 0 /* XXX lukem*/
|
||||
#if 0 /* XXX lukem */
|
||||
/*
|
||||
* ref;
|
||||
* Refresh the screen
|
||||
|
@ -124,7 +124,7 @@ void
|
|||
sendcom(PLAYER *pp, int command, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int arg1, arg2;
|
||||
int arg1, arg2;
|
||||
|
||||
va_start(ap, command);
|
||||
(void) putc(command, pp->p_output);
|
||||
|
|
Loading…
Reference in New Issue