Source:NetHack 2.2a/monst.h

From NetHackWiki
Revision as of 02:25, 4 March 2008 by Kernigh bot (talk | contribs) (NetHack 2.2a/monst.h moved to Source:NetHack 2.2a/monst.h: Robot: moved page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

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

Screenshots and source code from Hack are used under the CWI license.

1.    /*	SCCS Id: @(#)monst.h	2.1	87/09/28
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    
4.    struct monst {
5.    	struct monst *nmon;
6.    	struct permonst *data;
7.    	unsigned m_id;
8.    	xchar mx,my;
9.    	xchar mdx,mdy;		/* if mdispl then pos where last displayed */
10.   #define	MTSZ	4
11.   	coord mtrack[MTSZ];	/* monster track */
12.   	schar mhp,mhpmax;
13.   	char mappearance;	/* nonzero for undetected 'M's and for '1's */
14.   	Bitfield(mimic,1);	/* undetected mimic */
15.   	Bitfield(mdispl,1);	/* mdx,mdy valid */
16.   	Bitfield(minvis,1);	/* invisible */
17.   	Bitfield(cham,1);	/* shape-changer */
18.   	Bitfield(mhide,1);	/* hides beneath objects */
19.   	Bitfield(mundetected,1);	/* not seen in present hiding place */
20.   	Bitfield(mspeed,2);
21.   	Bitfield(mflee,1);	/* fleeing */
22.   	Bitfield(mfleetim,7);	/* timeout for mflee */
23.   	Bitfield(msleep,1);
24.   	Bitfield(mfroz,1);
25.   	Bitfield(mconf,1);
26.   	Bitfield(mcan,1);	/* has been cancelled */
27.   	Bitfield(mtame,1);	/* implies peaceful */
28.   	Bitfield(mpeaceful,1);	/* does not attack unprovoked */
29.   	Bitfield(isshk,1);	/* is shopkeeper */
30.   	Bitfield(isgd,1);	/* is guard */
31.   	Bitfield(mcansee,1);	/* cansee 1, temp.blinded 0, blind 0 */
32.   	Bitfield(mblinded,7);	/* cansee 0, temp.blinded n, blind 0 */
33.   	Bitfield(mtrapped,1);	/* trapped in a pit or bear trap */
34.   	Bitfield(mnamelth,6);	/* length of name (following mxlth) */
35.   #ifndef NOWORM
36.   	Bitfield(wormno,5);	/* at most 31 worms on any level */
37.   #endif
38.   #ifdef WALKIES
39.   	Bitfield(mleashed,1);	/* monster is on a leash */
40.   #endif
41.   	long mtrapseen;		/* bitmap of traps we've been trapped in */
42.   	long mlstmv;		/* prevent two moves at once */
43.   	struct obj *minvent;
44.   	long mgold;
45.   	unsigned mxlth;		/* length of following data */
46.   	/* in order to prevent alignment problems mextra should
47.   	   be (or follow) a long int */
48.   	long mextra[1];		/* monster dependent info */
49.   };
50.   
51.   #define newmonst(xl)	(struct monst *) alloc((unsigned)(xl) + sizeof(struct monst))
52.   
53.   extern struct monst *fmon;
54.   extern struct monst *fallen_down;
55.   struct monst *m_at();
56.   
57.   /* these are in mspeed */
58.   #define MSLOW 1 /* slow monster */
59.   #define MFAST 2 /* speeded monster */
60.   
61.   #define	NAME(mtmp)	(((char *) mtmp->mextra) + mtmp->mxlth)
62.   #define	MREGEN		"TVi1"
63.   #define	UNDEAD		"ZVW "