Home | History | Annotate | Line # | Download | only in hack
hack.h revision 1.10.42.1
      1  1.10.42.1       snj /*	$NetBSD: hack.h,v 1.10.42.1 2009/06/29 23:25:09 snj Exp $	*/
      2        1.4  christos 
      3        1.2   mycroft /*
      4        1.9       jsm  * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
      5        1.9       jsm  * Amsterdam
      6        1.9       jsm  * All rights reserved.
      7        1.9       jsm  *
      8        1.9       jsm  * Redistribution and use in source and binary forms, with or without
      9        1.9       jsm  * modification, are permitted provided that the following conditions are
     10        1.9       jsm  * met:
     11        1.9       jsm  *
     12        1.9       jsm  * - Redistributions of source code must retain the above copyright notice,
     13        1.9       jsm  * this list of conditions and the following disclaimer.
     14        1.9       jsm  *
     15        1.9       jsm  * - Redistributions in binary form must reproduce the above copyright
     16        1.9       jsm  * notice, this list of conditions and the following disclaimer in the
     17        1.9       jsm  * documentation and/or other materials provided with the distribution.
     18        1.9       jsm  *
     19        1.9       jsm  * - Neither the name of the Stichting Centrum voor Wiskunde en
     20        1.9       jsm  * Informatica, nor the names of its contributors may be used to endorse or
     21        1.9       jsm  * promote products derived from this software without specific prior
     22        1.9       jsm  * written permission.
     23        1.9       jsm  *
     24        1.9       jsm  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
     25        1.9       jsm  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     26        1.9       jsm  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
     27        1.9       jsm  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
     28        1.9       jsm  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     29        1.9       jsm  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     30        1.9       jsm  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     31        1.9       jsm  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     32        1.9       jsm  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     33        1.9       jsm  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     34        1.9       jsm  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     35        1.2   mycroft  */
     36        1.9       jsm 
     37        1.9       jsm /*
     38        1.9       jsm  * Copyright (c) 1982 Jay Fenlason <hack (at) gnu.org>
     39        1.9       jsm  * All rights reserved.
     40        1.9       jsm  *
     41        1.9       jsm  * Redistribution and use in source and binary forms, with or without
     42        1.9       jsm  * modification, are permitted provided that the following conditions
     43        1.9       jsm  * are met:
     44        1.9       jsm  * 1. Redistributions of source code must retain the above copyright
     45        1.9       jsm  *    notice, this list of conditions and the following disclaimer.
     46        1.9       jsm  * 2. Redistributions in binary form must reproduce the above copyright
     47        1.9       jsm  *    notice, this list of conditions and the following disclaimer in the
     48        1.9       jsm  *    documentation and/or other materials provided with the distribution.
     49        1.9       jsm  * 3. The name of the author may not be used to endorse or promote products
     50        1.9       jsm  *    derived from this software without specific prior written permission.
     51        1.9       jsm  *
     52        1.9       jsm  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
     53        1.9       jsm  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
     54        1.9       jsm  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
     55        1.9       jsm  * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     56        1.9       jsm  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     57        1.9       jsm  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     58        1.9       jsm  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     59        1.9       jsm  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     60        1.9       jsm  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     61        1.9       jsm  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     62        1.9       jsm  */
     63        1.9       jsm 
     64        1.4  christos #ifndef _HACK_H_
     65        1.4  christos #define _HACK_H_
     66        1.1       cgd 
     67        1.1       cgd #include "config.h"
     68        1.5      matt #include <stdlib.h>
     69        1.1       cgd #include <string.h>
     70        1.1       cgd 
     71        1.1       cgd #ifndef BSD
     72        1.1       cgd #define	index	strchr
     73        1.1       cgd #define	rindex	strrchr
     74        1.4  christos #endif /* BSD */
     75        1.1       cgd 
     76        1.1       cgd #define	Null(type)	((struct type *) 0)
     77        1.1       cgd 
     78        1.1       cgd #include	"def.objclass.h"
     79        1.1       cgd 
     80        1.1       cgd typedef struct {
     81        1.1       cgd 	xchar x,y;
     82        1.1       cgd } coord;
     83        1.1       cgd 
     84        1.1       cgd #include	"def.monst.h"	/* uses coord */
     85        1.1       cgd #include	"def.gold.h"
     86        1.1       cgd #include	"def.trap.h"
     87        1.1       cgd #include	"def.obj.h"
     88        1.1       cgd #include	"def.flag.h"
     89        1.1       cgd 
     90        1.1       cgd #define	plur(x)	(((x) == 1) ? "" : "s")
     91        1.1       cgd 
     92        1.1       cgd #define	BUFSZ	256	/* for getlin buffers */
     93        1.1       cgd #define	PL_NSIZ	32	/* name of player, ghost, shopkeeper */
     94        1.1       cgd 
     95        1.1       cgd #include	"def.rm.h"
     96        1.1       cgd #include	"def.permonst.h"
     97        1.1       cgd 
     98        1.1       cgd #define	newstring(x)	(char *) alloc((unsigned)(x))
     99        1.1       cgd #include "hack.onames.h"
    100        1.1       cgd 
    101        1.1       cgd #define ON 1
    102        1.1       cgd #define OFF 0
    103        1.1       cgd 
    104        1.1       cgd struct prop {
    105        1.1       cgd #define	TIMEOUT		007777	/* mask */
    106        1.1       cgd #define	LEFT_RING	W_RINGL	/* 010000L */
    107        1.1       cgd #define	RIGHT_RING	W_RINGR	/* 020000L */
    108        1.1       cgd #define	INTRINSIC	040000L
    109        1.1       cgd #define	LEFT_SIDE	LEFT_RING
    110        1.1       cgd #define	RIGHT_SIDE	RIGHT_RING
    111        1.1       cgd #define	BOTH_SIDES	(LEFT_SIDE | RIGHT_SIDE)
    112        1.1       cgd 	long p_flgs;
    113       1.10       jsm 	void (*p_tofn)(void);	/* called after timeout */
    114        1.1       cgd };
    115        1.1       cgd 
    116        1.1       cgd struct you {
    117        1.1       cgd 	xchar ux, uy;
    118        1.1       cgd 	schar dx, dy, dz;	/* direction of move (or zap or ... ) */
    119        1.1       cgd #ifdef QUEST
    120        1.1       cgd 	schar di;		/* direction of FF */
    121        1.1       cgd 	xchar ux0, uy0;		/* initial position FF */
    122        1.6       cgd #endif /* QUEST */
    123        1.1       cgd 	xchar udisx, udisy;	/* last display pos */
    124        1.1       cgd 	char usym;		/* usually '@' */
    125        1.1       cgd 	schar uluck;
    126        1.1       cgd #define	LUCKMAX		10	/* on moonlit nights 11 */
    127        1.1       cgd #define	LUCKMIN		(-10)
    128        1.1       cgd 	int last_str_turn:3;	/* 0: none, 1: half turn, 2: full turn */
    129        1.1       cgd 				/* +: turn right, -: turn left */
    130        1.1       cgd 	unsigned udispl:1;	/* @ on display */
    131        1.1       cgd 	unsigned ulevel:4;	/* 1 - 14 */
    132        1.1       cgd #ifdef QUEST
    133        1.1       cgd 	unsigned uhorizon:7;
    134        1.6       cgd #endif /* QUEST */
    135        1.1       cgd 	unsigned utrap:3;	/* trap timeout */
    136        1.1       cgd 	unsigned utraptype:1;	/* defined if utrap nonzero */
    137        1.1       cgd #define	TT_BEARTRAP	0
    138        1.1       cgd #define	TT_PIT		1
    139        1.1       cgd 	unsigned uinshop:6;	/* used only in shk.c - (roomno+1) of shop */
    140        1.1       cgd 
    141        1.1       cgd 
    142        1.1       cgd /* perhaps these #define's should also be generated by makedefs */
    143        1.1       cgd #define	TELEPAT		LAST_RING		/* not a ring */
    144        1.1       cgd #define	Telepat		u.uprops[TELEPAT].p_flgs
    145        1.1       cgd #define	FAST		(LAST_RING+1)		/* not a ring */
    146        1.1       cgd #define	Fast		u.uprops[FAST].p_flgs
    147        1.1       cgd #define	CONFUSION	(LAST_RING+2)		/* not a ring */
    148        1.1       cgd #define	Confusion	u.uprops[CONFUSION].p_flgs
    149        1.1       cgd #define	INVIS		(LAST_RING+3)		/* not a ring */
    150        1.1       cgd #define	Invis		u.uprops[INVIS].p_flgs
    151        1.1       cgd #define Invisible	(Invis && !See_invisible)
    152        1.1       cgd #define	GLIB		(LAST_RING+4)		/* not a ring */
    153        1.1       cgd #define	Glib		u.uprops[GLIB].p_flgs
    154        1.1       cgd #define	PUNISHED	(LAST_RING+5)		/* not a ring */
    155        1.1       cgd #define	Punished	u.uprops[PUNISHED].p_flgs
    156        1.1       cgd #define	SICK		(LAST_RING+6)		/* not a ring */
    157        1.1       cgd #define	Sick		u.uprops[SICK].p_flgs
    158        1.1       cgd #define	BLIND		(LAST_RING+7)		/* not a ring */
    159        1.1       cgd #define	Blind		u.uprops[BLIND].p_flgs
    160        1.1       cgd #define	WOUNDED_LEGS	(LAST_RING+8)		/* not a ring */
    161        1.1       cgd #define Wounded_legs	u.uprops[WOUNDED_LEGS].p_flgs
    162        1.1       cgd #define STONED		(LAST_RING+9)		/* not a ring */
    163        1.1       cgd #define Stoned		u.uprops[STONED].p_flgs
    164        1.1       cgd #define PROP(x) (x-RIN_ADORNMENT)       /* convert ring to index in uprops */
    165        1.1       cgd 	unsigned umconf:1;
    166        1.8       jsm 	const char *usick_cause;
    167        1.1       cgd 	struct prop uprops[LAST_RING+10];
    168        1.1       cgd 
    169        1.1       cgd 	unsigned uswallow:1;		/* set if swallowed by a monster */
    170        1.1       cgd 	unsigned uswldtim:4;		/* time you have been swallowed */
    171        1.1       cgd 	unsigned uhs:3;			/* hunger state - see hack.eat.c */
    172        1.1       cgd 	schar ustr,ustrmax;
    173        1.1       cgd 	schar udaminc;
    174        1.1       cgd 	schar uac;
    175        1.1       cgd 	int uhp,uhpmax;
    176        1.1       cgd 	long int ugold,ugold0,uexp,urexp;
    177        1.1       cgd 	int uhunger;			/* refd only in eat.c and shk.c */
    178        1.1       cgd 	int uinvault;
    179        1.1       cgd 	struct monst *ustuck;
    180        1.1       cgd 	int nr_killed[CMNUM+2];		/* used for experience bookkeeping */
    181        1.1       cgd };
    182        1.1       cgd 
    183        1.1       cgd #define DIST(x1,y1,x2,y2)       (((x1)-(x2))*((x1)-(x2)) + ((y1)-(y2))*((y1)-(y2)))
    184        1.1       cgd 
    185        1.1       cgd #define	PL_CSIZ		20	/* sizeof pl_character */
    186        1.1       cgd #define	MAX_CARR_CAP	120	/* so that boulders can be heavier */
    187        1.1       cgd #define	MAXLEVEL	40
    188        1.1       cgd #define	FAR	(COLNO+2)	/* position outside screen */
    189        1.4  christos 
    190        1.4  christos extern boolean in_mklev;
    191        1.4  christos extern boolean level_exists[];
    192        1.4  christos extern boolean restoring;
    193        1.4  christos extern char *CD;
    194        1.8       jsm extern const char *catmore;
    195        1.4  christos extern char *hname;
    196        1.8       jsm extern const char *const hu_stat[]; /* in eat.c */
    197        1.8       jsm extern const char *nomovemsg;
    198        1.8       jsm extern const char *occtxt;
    199        1.8       jsm extern char *save_cm;
    200        1.8       jsm extern const char *killer;
    201        1.8       jsm extern const char *const traps[];
    202        1.4  christos extern char SAVEF[];
    203        1.4  christos extern char fut_geno[60]; /* idem */
    204        1.4  christos extern char genocided[60]; /* defined in Decl.c */
    205  1.10.42.1       snj extern char lock[PL_NSIZ + 4];
    206        1.4  christos extern char mlarge[];
    207        1.4  christos extern char morc;
    208        1.4  christos extern char nul[];
    209        1.4  christos extern char plname[PL_NSIZ], pl_character[PL_CSIZ];
    210        1.8       jsm extern const char quitchars[];
    211        1.4  christos extern char sdir[]; /* defined in hack.c */
    212        1.8       jsm extern const char shtypes[]; /* = "=/)%?!["; 8 types: 7 specialized, 1 mixed */
    213        1.8       jsm extern const char vowels[];
    214        1.4  christos extern coord bhitpos;	/* place where thrown weapon falls to the ground */
    215       1.10       jsm extern int (*afternmv)(void);
    216       1.10       jsm extern int (*occupation)(void);
    217        1.4  christos extern int CO, LI; /* usually COLNO and ROWNO+2 */
    218        1.4  christos extern int bases[];
    219        1.4  christos extern int doorindex;
    220        1.4  christos extern int hackpid;
    221        1.4  christos extern int multi;
    222        1.4  christos extern int nroom;
    223        1.4  christos extern long moves;
    224        1.4  christos extern long wailmsg;
    225        1.4  christos extern schar xdir[], ydir[]; /* idem */
    226        1.4  christos extern struct monst *mydogs;
    227        1.4  christos extern struct monst youmonst;
    228        1.4  christos extern struct obj *billobjs;
    229        1.4  christos extern struct obj *invent, *uwep, *uarm, *uarm2, *uarmh, *uarms, *uarmg;
    230        1.4  christos extern struct obj *uleft, *uright, *fcobj;
    231        1.4  christos extern struct obj *uball;	/* defined if PUNISHED */
    232        1.4  christos extern struct obj *uchain;	/* defined iff PUNISHED */
    233        1.4  christos extern struct obj zeroobj;
    234        1.8       jsm extern const struct permonst li_dog, dog, la_dog;
    235        1.8       jsm extern const struct permonst pm_eel;
    236        1.8       jsm extern const struct permonst pm_ghost;
    237        1.8       jsm extern const struct permonst pm_mail_daemon;
    238        1.8       jsm extern const struct permonst pm_wizard;
    239        1.4  christos #ifndef NOWORM
    240        1.4  christos extern long wgrowtime[32];
    241        1.4  christos extern struct wseg *m_atseg;
    242        1.4  christos extern struct wseg *wsegs[32], *wheads[32];
    243        1.4  christos #endif
    244        1.4  christos extern struct you u;
    245        1.4  christos extern xchar curx, cury;	/* cursor location on screen */
    246        1.4  christos extern xchar dlevel, maxdlevel; /* dungeon level */
    247        1.4  christos extern xchar seehx,seelx,seehy,seely; /* where to see*/
    248        1.4  christos extern xchar xdnstair, ydnstair, xupstair, yupstair; /* stairs up and down. */
    249        1.4  christos #endif /* _HACK_H_ */
    250