1 /* NetHack 3.6 mextra.h $NHDT-Date: 1451836000 2016/01/03 15:46:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.18 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Michael Allison, 2006. */
4 /* NetHack may be freely redistributed. See license for details. */
14 * Adding new mextra structures:
16 * 1. Add the structure definition and any required macros in this
17 * file above the mextra struct.
18 * 2. Add a pointer to your new struct to the mextra struct in this
20 * 3. Add a referencing macro at bottom of this file after the mextra
21 * struct (see MNAME, EGD, EPRI, ESHK, EMIN, or EDOG for examples).
22 * 4. Create a newXX(mtmp) function and possibly a free_XX(mtmp)
23 * function in an appropriate new or existing source file and add
24 * a prototype for it to include/extern.h.
26 * void FDECL(newXX, (struct monst *));
27 * void FDECL(free_XX, (struct monst *));
34 * mtmp->mextra = newmextra();
36 * XX(mtmp) = (struct XX *) alloc(sizeof (struct XX));
37 * (void) memset((genericptr_t) XX(mtmp),
38 * 0, sizeof (struct XX));
42 * 5. Consider adding a new makemon flag MM_XX flag to include/hack.h
43 * and a corresponding change to makemon() if you require your
44 * structure to be added at monster creation time. Initialize your
45 * struct after a successful return from makemon().
47 * src/makemon.c: if (mmflags & MM_XX) newXX(mtmp);
48 * your new code: mon = makemon(&mons[mnum], x, y, MM_XX);
50 * 6. Adjust size_monst() in src/cmd.c appropriately.
51 * 7. Adjust dealloc_mextra() in src/mon.c to clean up
52 * properly during monst deallocation.
53 * 8. Adjust copy_mextra() in src/mon.c to make duplicate
54 * copies of your struct or data on another monst struct.
55 * 9. Adjust restmon() in src/restore.c to deal with your
56 * struct or data during a restore.
57 * 10. Adjust savemon() in src/save.c to deal with your
58 * struct or data during a save.
62 ** formerly vault.h -- vault guard extension
64 #define FCSIZ (ROWNO + COLNO)
65 #define GD_EATGOLD 0x01
66 #define GD_DESTROYGOLD 0x02
73 int fcbeg, fcend; /* fcend: first unused pos */
74 int vroom; /* room number of the vault */
75 xchar gdx, gdy; /* goal of guard's walk */
76 xchar ogx, ogy; /* guard's last position */
77 d_level gdlevel; /* level (& dungeon) guard was created in */
78 xchar warncnt; /* number of warnings to follow */
79 Bitfield(gddone, 1); /* true iff guard has released player */
80 Bitfield(witness, 2); /* the guard saw you do something */
82 struct fakecorridor fakecorr[FCSIZ];
86 ** formerly epri.h -- temple priest extension
89 aligntyp shralign; /* alignment of priest's shrine */
90 schar shroom; /* index in rooms */
91 coord shrpos; /* position of shrine */
92 d_level shrlevel; /* level (& dungeon) of shrine */
93 long intone_time, /* used to limit verbosity +*/
94 enter_time, /*+ of temple entry messages */
95 hostile_time, /* forbidding feeling */
96 peaceful_time; /* sense of peace */
98 /* note: roaming priests (no shrine) switch from ispriest to isminion
99 (and emin extension) */
102 ** formerly eshk.h -- shopkeeper extension
104 #define REPAIR_DELAY 5 /* minimum delay between shop damage & repair */
110 long price; /* price per unit */
111 long bquan; /* amount used up */
115 long robbed; /* amount stolen by most recent customer */
116 long credit; /* amount credited to customer */
117 long debit; /* amount of debt for using unpaid items */
118 long loan; /* shop-gold picked (part of debit) */
119 int shoptype; /* the value of rooms[shoproom].rtype */
120 schar shoproom; /* index in rooms; set by inshop() */
121 schar unused; /* to force alignment for stupid compilers */
122 boolean following; /* following customer since he owes us sth */
123 boolean surcharge; /* angry shk inflates prices */
124 boolean dismiss_kops; /* pacified shk sends kops away */
125 coord shk; /* usual position shopkeeper */
126 coord shd; /* position shop door */
127 d_level shoplevel; /* level (& dungeon) of his shop */
128 int billct; /* no. of entries of bill[] in use */
129 struct bill_x bill[BILLSZ];
130 struct bill_x *bill_p;
131 int visitct; /* nr of visits by most recent customer */
132 char customer[PL_NSIZ]; /* most recent customer */
133 char shknam[PL_NSIZ];
137 ** formerly emin.h -- minion extension
140 aligntyp min_align; /* alignment of minion */
141 boolean renegade; /* hostile co-aligned priest or Angel */
145 ** formerly edog.h -- pet extension
147 /* various types of pet food, the lower, the better liked */
160 long droptime; /* moment dog dropped object */
161 unsigned dropdist; /* dist of dropped obj from @ */
162 int apport; /* amount of training */
163 long whistletime; /* last time he whistled */
164 long hungrytime; /* will get hungry at this time */
165 coord ogoal; /* previous goal location */
166 int abuse; /* track abuses to this pet */
167 int revivals; /* count pet deaths */
168 int mhpmax_penalty; /* while starving, points reduced */
169 Bitfield(killed_by_u, 1); /* you attempted to kill him */
173 ** mextra.h -- collection of all monster extensions
182 int mcorpsenm; /* obj->corpsenm for mimic posing as statue or corpse */
185 #define MNAME(mon) ((mon)->mextra->mname)
186 #define EGD(mon) ((mon)->mextra->egd)
187 #define EPRI(mon) ((mon)->mextra->epri)
188 #define ESHK(mon) ((mon)->mextra->eshk)
189 #define EMIN(mon) ((mon)->mextra->emin)
190 #define EDOG(mon) ((mon)->mextra->edog)
191 #define MCORPSENM(mon) ((mon)->mextra->mcorpsenm)
193 #define has_mname(mon) ((mon)->mextra && MNAME(mon))
194 #define has_egd(mon) ((mon)->mextra && EGD(mon))
195 #define has_epri(mon) ((mon)->mextra && EPRI(mon))
196 #define has_eshk(mon) ((mon)->mextra && ESHK(mon))
197 #define has_emin(mon) ((mon)->mextra && EMIN(mon))
198 #define has_edog(mon) ((mon)->mextra && EDOG(mon))
199 #define has_mcorpsenm(mon) ((mon)->mextra && MCORPSENM(mon) != NON_PM)
201 #endif /* MEXTRA_H */