Source:NetHack 3.2.0/trap.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to trap.h from the source code of NetHack 3.2.0. To link to a particular line, write [[NetHack 3.2.0/trap.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: @(#)trap.h	3.2	92/09/28	*/
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    /* note for 3.1.0 and later: no longer manipulated by 'makedefs' */
6.    
7.    #ifndef TRAP_H
8.    #define TRAP_H
9.    
10.   struct trap {
11.   	struct trap *ntrap;
12.   	xchar tx,ty;
13.   	Bitfield(ttyp,5);
14.   	Bitfield(tseen,1);
15.   	Bitfield(once,1);
16.   	Bitfield(madeby_u,1); /* So monsters may take offence when you trap
17.   				 them.  Recognizing who made the trap isn't
18.   				 completely unreasonable, everybody has
19.   				 their own style.  This flag is also needed
20.   				 when you untrap a monster.  It would be too
21.   				 easy to make a monster peaceful if you could
22.   				 set a trap for it and then untrap it. */
23.   	d_level dst;	/* destination for portals */
24.   	coord launch;
25.   	union {
26.   	    short v_launch_otyp;	/* type of object to be triggered */
27.   	    coord v_launch2;	/* secondary launch point (for boulders) */
28.   	} v;
29.   #define launch_otyp	v.v_launch_otyp
30.   #define launch2		v.v_launch2
31.   };
32.   
33.   extern struct trap *ftrap;
34.   #define newtrap()	(struct trap *) alloc(sizeof(struct trap))
35.   #define dealloc_trap(trap) free((genericptr_t) (trap))
36.   
37.   /* Note: if adding/removing a trap, adjust trap_engravings[] in mklev.c */
38.   
39.   /* unconditional traps */
40.   #define NO_TRAP		0
41.   #define ARROW_TRAP	1
42.   #define DART_TRAP	2
43.   #define ROCKTRAP	3
44.   #define SQKY_BOARD	4
45.   #define BEAR_TRAP	5
46.   #define LANDMINE	6
47.   #define ROLLING_BOULDER_TRAP	7
48.   #define SLP_GAS_TRAP	8
49.   #define RUST_TRAP	9
50.   #define FIRE_TRAP	10
51.   #define PIT		11
52.   #define SPIKED_PIT	12
53.   #define HOLE            13
54.   #define TRAPDOOR	14
55.   #define TELEP_TRAP	15
56.   #define LEVEL_TELEP	16
57.   #define MAGIC_PORTAL    17
58.   #define WEB		18
59.   #define STATUE_TRAP	19
60.   #define MAGIC_TRAP	20
61.   #define ANTI_MAGIC	21
62.   #define POLY_TRAP	22
63.   #define TRAPNUM	23
64.   
65.   #endif /* TRAP_H */