Source:Hack 1.0/def.monst.h

From NetHackWiki
Revision as of 22:07, 3 March 2008 by Kernigh bot (talk | contribs) (Hack 1.0/def.monst.h moved to Source:Hack 1.0/def.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 def.monst.h from the source code of Hack 1.0. To link to a particular line, write [[Hack 1.0/def.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.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984. */
2.    
3.    struct monst {
4.    	struct monst *nmon;
5.    	struct permonst *data;
6.    	unsigned m_id;
7.    	xchar mx,my;
8.    	xchar mdx,mdy;		/* if mdispl then pos where last displayed */
9.    #define	MTSZ	4
10.   	coord mtrack[MTSZ];	/* monster track */
11.   	schar mhp,orig_hp;
12.   	char mimic;		/* undetected mimic - this is its symbol */
13.   	Bitfield(mdispl,1);	/* mdx,mdy valid */
14.   	Bitfield(minvis,1);	/* invisible */
15.   	Bitfield(cham,1);	/* shape-changer */
16.   	Bitfield(mhide,1);	/* hides beneath objects */
17.   	Bitfield(mundetected,1);	/* not seen in present hiding place */
18.   	Bitfield(mspeed,2);
19.   	Bitfield(msleep,1);
20.   	Bitfield(mfroz,1);
21.   	Bitfield(mconf,1);
22.   	Bitfield(mflee,1);
23.   	Bitfield(mcan,1);	/* has been cancelled */
24.   	Bitfield(mtame,1);		/* implies peaceful */
25.   	Bitfield(mpeaceful,1);	/* does not attack unprovoked */
26.   	Bitfield(isshk,1);	/* is shopkeeper */
27.   	Bitfield(isgd,1);	/* is guard */
28.   	Bitfield(mcansee,1);	/* cansee 1, temp.blinded 0, blind 0 */
29.   	Bitfield(mblinded,7);	/* cansee 0, temp.blinded n, blind 0 */
30.   	Bitfield(mtrapped,1);	/* trapped in a pit or bear trap */
31.   	Bitfield(mnamelth,6);	/* length of name (following mxlth) */
32.   #ifndef NOWORM
33.   	Bitfield(wormno,5);	/* at most 31 worms on any level */
34.   #endif NOWORM
35.   	unsigned mtrapseen;	/* bitmap of traps we've been trapped in */
36.   	long mlstmv;	/* prevent two moves at once */
37.   	struct obj *minvent;
38.   	long mgold;
39.   	unsigned mxlth;		/* length of following data */
40.   	/* in order to prevent alignment problems mextra should
41.   	   be (or follow) a long int */
42.   	long mextra[1];		/* monster dependent info */
43.   };
44.   
45.   #define newmonst(xl)	(struct monst *) alloc((unsigned)(xl) + sizeof(struct monst))
46.   
47.   extern struct monst *fmon;
48.   #ifndef MKLEV
49.   extern struct monst *fallen_down;
50.   #endif MKLEV
51.   struct monst *m_at();
52.   
53.   /* these are in mspeed */
54.   #define MSLOW 1 /* slow monster */
55.   #define MFAST 2 /* speeded monster */
56.   
57.   #define	NAME(mtmp)	(((char *) mtmp->mextra) + mtmp->mxlth)