1 /* SCCS Id: @(#)region.h 3.4 2002/10/15 */
2 /* Copyright (c) 1996 by Jean-Christophe Collet */
3 /* NetHack may be freely redistributed. See license for details. */
8 /* generic callback function */
10 typedef boolean FDECL((*callback_proc), (genericptr_t, genericptr_t));
13 * Overload the old player_inside field with two values, coded in such
14 * a way as to retain compatibility with 3.4.0 save and bones files;
15 * this relies on the fact that nethack's `boolean' is really stored
16 * in a `char' (or bigger type) rather than in a single bit.
18 * 3.4.1 save and bones files will be correct.
19 * 3.4.0 save files restored under 3.4.1 will be correct.
20 * 3.4.0 bones files used with 3.4.1 will continue to have the minor
21 * 3.4.0 bug of falsely claiming that the current game's hero is
22 * responsible for the dead former hero's stinking clouds.
24 #define REG_HERO_INSIDE 1
25 #define REG_NOT_HEROS 2
26 #define hero_inside(r) ((unsigned)(r)->player_flags & REG_HERO_INSIDE)
27 #define heros_fault(r) (!((unsigned)(r)->player_flags & REG_NOT_HEROS))
28 #define set_hero_inside(r) ((r)->player_flags |= REG_HERO_INSIDE)
29 #define clear_hero_inside(r) ((r)->player_flags &= ~REG_HERO_INSIDE)
30 #define set_heros_fault(r) ((r)->player_flags &= ~REG_NOT_HEROS)
31 #define clear_heros_fault(r) ((r)->player_flags |= REG_NOT_HEROS)
34 NhRect bounding_box; /* Bounding box of the region */
35 NhRect *rects; /* Rectangles composing the region */
36 short nrects; /* Number of rectangles */
37 boolean attach_2_u; /* Region attached to player ? */
38 unsigned int attach_2_m; /* Region attached to monster ? */
39 /*struct obj *attach_2_o;*/ /* Region attached to object ? UNUSED YET */
40 const char* enter_msg; /* Message when entering */
41 const char* leave_msg; /* Message when leaving */
42 short ttl; /* Time to live. -1 is forever */
43 short expire_f; /* Function to call when region's ttl expire */
44 short can_enter_f; /* Function to call to check wether the player
45 can, or can not, enter the region */
46 short enter_f; /* Function to call when the player enters*/
47 short can_leave_f; /* Function to call to check wether the player
48 can, or can not, leave the region */
49 short leave_f; /* Function to call when the player leaves */
50 short inside_f; /* Function to call every turn if player's
52 boolean player_flags; /* (see above) */
53 unsigned int* monsters; /* Monsters currently inside this region */
54 short n_monst; /* Number of monsters inside this region */
55 short max_monst; /* Maximum number of monsters that can be
56 listed without having to grow the array */
59 /* Should probably do the same thing about objects */
61 boolean visible; /* Is the region visible ? */
62 int glyph; /* Which glyph to use if visible */
63 genericptr_t arg; /* Optional user argument (Ex: strength of
64 force field, damage of a fire zone, ...*/