Source:NetHack 3.6.1/include/trap.h

From NetHackWiki
(Redirected from Trap.h)
Jump to: navigation, search

Below is the full text to trap.h from the source code of NetHack 3.6.1. To link to a particular line, write [[Source:NetHack 3.6.1/include/trap.h#line123]], for example.

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