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