OSDN Git Service

fix #36952
[jnethack/source.git] / include / trap.h
1 /* NetHack 3.6  trap.h  $NHDT-Date: 1432512776 2015/05/25 00:12:56 $  $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ */
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 union vlaunchinfo {
11     short v_launch_otyp; /* type of object to be triggered */
12     coord v_launch2;     /* secondary launch point (for boulders) */
13     uchar v_conjoined;   /* conjoined pit locations */
14     short v_tnote;       /* boards: 12 notes        */
15 };
16
17 struct trap {
18     struct trap *ntrap;
19     xchar tx, ty;
20     d_level dst; /* destination for portals */
21     coord launch;
22     Bitfield(ttyp, 5);
23     Bitfield(tseen, 1);
24     Bitfield(once, 1);
25     Bitfield(madeby_u, 1); /* So monsters may take offence when you trap
26                               them.     Recognizing who made the trap isn't
27                               completely unreasonable, everybody has
28                               their own style.  This flag is also needed
29                               when you untrap a monster.  It would be too
30                               easy to make a monster peaceful if you could
31                               set a trap for it and then untrap it. */
32     union vlaunchinfo vl;
33 #define launch_otyp vl.v_launch_otyp
34 #define launch2 vl.v_launch2
35 #define conjoined vl.v_conjoined
36 #define tnote vl.v_tnote
37 };
38
39 extern struct trap *ftrap;
40 #define newtrap() (struct trap *) alloc(sizeof(struct trap))
41 #define dealloc_trap(trap) free((genericptr_t)(trap))
42
43 /* reasons for statue animation */
44 #define ANIMATE_NORMAL 0
45 #define ANIMATE_SHATTER 1
46 #define ANIMATE_SPELL 2
47
48 /* reasons for animate_statue's failure */
49 #define AS_OK 0            /* didn't fail */
50 #define AS_NO_MON 1        /* makemon failed */
51 #define AS_MON_IS_UNIQUE 2 /* statue monster is unique */
52
53 /* Note: if adding/removing a trap, adjust trap_engravings[] in mklev.c */
54
55 /* unconditional traps */
56 #define NO_TRAP 0
57 #define ARROW_TRAP 1
58 #define DART_TRAP 2
59 #define ROCKTRAP 3
60 #define SQKY_BOARD 4
61 #define BEAR_TRAP 5
62 #define LANDMINE 6
63 #define ROLLING_BOULDER_TRAP 7
64 #define SLP_GAS_TRAP 8
65 #define RUST_TRAP 9
66 #define FIRE_TRAP 10
67 #define PIT 11
68 #define SPIKED_PIT 12
69 #define HOLE 13
70 #define TRAPDOOR 14
71 #define TELEP_TRAP 15
72 #define LEVEL_TELEP 16
73 #define MAGIC_PORTAL 17
74 #define WEB 18
75 #define STATUE_TRAP 19
76 #define MAGIC_TRAP 20
77 #define ANTI_MAGIC 21
78 #define POLY_TRAP 22
79 #define VIBRATING_SQUARE 23
80 #define TRAPNUM 24
81
82 #endif /* TRAP_H */