Source:NetHack 3.0.0/monst.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to monst.h from the source code of NetHack 3.0.0. To link to a particular line, write [[NetHack 3.0.0/monst.h#line123]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1.    /*	SCCS Id: @(#)monst.h	3.0	88/04/15
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #ifndef MONST_H
6.    #define MONST_H
7.    
8.    struct monst {
9.    	struct monst *nmon;
10.   	struct permonst *data;
11.   	unsigned m_id;
12.   	uchar m_lev;		/* adjusted difficulty level of monster */
13.   	schar malign;		/* alignment of this monster, relative to the
14.   				   player (positive = good to kill) */
15.   	xchar mx, my;
16.   	xchar mux, muy;		/* where the monster thinks you are */
17.   	xchar mdx, mdy;		/* if mdispl then pos where last displayed */
18.   #define	MTSZ	4
19.   	coord mtrack[MTSZ];	/* monster track */
20.   	int mhp, mhpmax;
21.   	char mappearance;	/* nonzero for undetected 'M's and the Wizard */
22.   	int mspec_used; 	/* monster's special ability attack timeout */
23.   	schar mtame;		/* level of tameness, implies peaceful */
24.   
25.   	Bitfield(mimic,1);	/* undetected mimic */
26.   	Bitfield(mdispl,1);	/* mdx,mdy valid */
27.   	Bitfield(minvis,1);	/* invisible */
28.   	Bitfield(cham,1);	/* shape-changer */
29.   	Bitfield(mhide,1);	/* hides beneath objects */
30.   	Bitfield(mundetected,1);	/* not seen in present hiding place */
31.   	Bitfield(mspeed,2);
32.   
33.   	Bitfield(mflee,1);	/* fleeing */
34.   	Bitfield(mfleetim,7);	/* timeout for mflee */
35.   
36.   	Bitfield(msleep,1);	/* sleeping */
37.   	Bitfield(mfroz,1);	/* frozen */
38.   	Bitfield(mstun,1);	/* stunned (off balance) */
39.   	Bitfield(mconf,1);	/* confused */
40.   	Bitfield(mcan,1);	/* has been cancelled */
41.   	Bitfield(mpeaceful,1);	/* does not attack unprovoked */
42.   	Bitfield(mcansee,1);	/* cansee 1, temp.blinded 0, blind 0 */
43.   
44.   	Bitfield(mblinded,7);	/* cansee 0, temp.blinded n, blind 0 */
45.   	Bitfield(mtrapped,1);	/* trapped in a pit or bear trap */
46.   
47.   	Bitfield(isshk,1);	/* is shopkeeper */
48.   	Bitfield(isgd,1);	/* is guard */
49.   #if defined(ALTARS) && defined(THEOLOGY)
50.   	Bitfield(ispriest,1);	/* is a priest */
51.   #endif
52.   	Bitfield(iswiz,1);	/* is the Wizard of Yendor */
53.   	Bitfield(mleashed,1);	/* monster is on a leash */
54.   #ifdef WORM
55.   	Bitfield(wormno,5);	/* at most 31 worms on any level */
56.   #endif
57.   	long mtrapseen;		/* bitmap of traps we've been trapped in */
58.   	long mlstmv;		/* prevent two moves at once */
59.   	struct obj *minvent;
60.   	long mgold;
61.   	uchar mnamelth;		/* length of name (following mxlth) */
62.   	short mxlth;		/* length of following data */
63.   	/* in order to prevent alignment problems mextra should
64.   	   be (or follow) a long int */
65.   	int meating;		/* monster is eating timeout */
66.   	long mextra[1]; 	/* monster dependent info */
67.   };
68.   
69.   #define newmonst(xl)	(struct monst *) alloc((unsigned)(xl) + sizeof(struct monst))
70.   
71.   extern struct monst *fmon;
72.   extern struct monst *mydogs, *fallen_down;
73.   
74.   /* these are in mspeed */
75.   #define MSLOW 1 /* slow monster */
76.   #define MFAST 2 /* speeded monster */
77.   
78.   #define	NAME(mtmp)	(((char *) mtmp->mextra) + mtmp->mxlth)
79.   
80.   #endif /* MONST_H /**/