trap.h

Go to the documentation of this file.
00001 /*      SCCS Id: @(#)trap.h     3.4     2000/08/30      */
00002 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
00003 /* NetHack may be freely redistributed.  See license for details. */
00004 
00005 /* note for 3.1.0 and later: no longer manipulated by 'makedefs' */
00006 
00007 #ifndef TRAP_H
00008 #define TRAP_H
00009 
00010 union vlaunchinfo {
00011         short v_launch_otyp;    /* type of object to be triggered */
00012         coord v_launch2;        /* secondary launch point (for boulders) */
00013 };
00014 
00015 struct trap {
00016         struct trap *ntrap;
00017         xchar tx,ty;
00018         d_level dst;    /* destination for portals */
00019         coord launch;
00020         Bitfield(ttyp,5);
00021         Bitfield(tseen,1);
00022         Bitfield(once,1);
00023         Bitfield(madeby_u,1); /* So monsters may take offence when you trap
00024                                  them.  Recognizing who made the trap isn't
00025                                  completely unreasonable, everybody has
00026                                  their own style.  This flag is also needed
00027                                  when you untrap a monster.  It would be too
00028                                  easy to make a monster peaceful if you could
00029                                  set a trap for it and then untrap it. */
00030         union vlaunchinfo vl;
00031 #define launch_otyp     vl.v_launch_otyp
00032 #define launch2         vl.v_launch2
00033 };
00034 
00035 extern struct trap *ftrap;
00036 #define newtrap()       (struct trap *) alloc(sizeof(struct trap))
00037 #define dealloc_trap(trap) free((genericptr_t) (trap))
00038 
00039 /* reasons for statue animation */
00040 #define ANIMATE_NORMAL  0
00041 #define ANIMATE_SHATTER 1
00042 #define ANIMATE_SPELL   2
00043 
00044 /* reasons for animate_statue's failure */
00045 #define AS_OK            0      /* didn't fail */
00046 #define AS_NO_MON        1      /* makemon failed */
00047 #define AS_MON_IS_UNIQUE 2      /* statue monster is unique */
00048 
00049 /* Note: if adding/removing a trap, adjust trap_engravings[] in mklev.c */
00050 
00051 /* unconditional traps */
00052 #define NO_TRAP         0
00053 #define ARROW_TRAP      1
00054 #define DART_TRAP       2
00055 #define ROCKTRAP        3
00056 #define SQKY_BOARD      4
00057 #define BEAR_TRAP       5
00058 #define LANDMINE        6
00059 #define ROLLING_BOULDER_TRAP    7
00060 #define SLP_GAS_TRAP    8
00061 #define RUST_TRAP       9
00062 #define FIRE_TRAP       10
00063 #define PIT             11
00064 #define SPIKED_PIT      12
00065 #define HOLE            13
00066 #define TRAPDOOR        14
00067 #define TELEP_TRAP      15
00068 #define LEVEL_TELEP     16
00069 #define MAGIC_PORTAL    17
00070 #define WEB             18
00071 #define STATUE_TRAP     19
00072 #define MAGIC_TRAP      20
00073 #define ANTI_MAGIC      21
00074 #define POLY_TRAP       22
00075 #define TRAPNUM 23
00076 
00077 #endif /* TRAP_H */