1 /* NetHack 3.6 mextra.h $ANH-Date: 1451836000 2016/01/03 15:46:40 $ $ANH-Branch: master $:$ANH-Revision: 1.18 $ */
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
16 * file 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 bottom of this file after the mextra
20 * struct (see MNAME, EGD, EPRI, ESHK, EMIN, or EDOG for examples).
21 * 4. Create a newXX(mtmp) function and possibly a free_XX(mtmp)
22 * function in an appropriate new or existing source file and add
23 * a prototype for it to include/extern.h.
25 * void FDECL(newXX, (struct monst *));
26 * void FDECL(free_XX, (struct monst *));
33 * mtmp->mextra = newmextra();
35 * XX(mtmp) = (struct XX *) alloc(sizeof (struct XX));
36 * (void) memset((genericptr_t) XX(mtmp),
37 * 0, sizeof (struct XX));
41 * 5. Consider adding a new makemon flag MM_XX flag to include/hack.h
42 * and a corresponding change to makemon() if you require your
43 * structure to be added at monster creation time. Initialize your
44 * struct after a successful return from makemon().
46 * src/makemon.c: if (mmflags & MM_XX) newXX(mtmp);
47 * your new code: mon = makemon(&mons[mnum], x, y, MM_XX);
49 * 6. Adjust size_monst() in src/cmd.c appropriately.
50 * 7. Adjust dealloc_mextra() in src/mon.c to clean up
51 * properly during monst deallocation.
52 * 8. Adjust copy_mextra() in src/mon.c to make duplicate
53 * copies of your struct or data on another monst struct.
54 * 9. Adjust restmon() in src/restore.c to deal with your
55 * struct or data during a restore.
56 * 10. Adjust savemon() in src/save.c to deal with your
57 * struct or data during a save.
61 ** formerly vault.h -- vault guard extension
63 #define FCSIZ (ROWNO + COLNO)
64 #define GD_EATGOLD 0x01
65 #define GD_DESTROYGOLD 0x02
72 int fcbeg
, fcend
; /* fcend: first unused pos */
73 int vroom
; /* room number of the vault */
74 xchar gdx
, gdy
; /* goal of guard's walk */
75 xchar ogx
, ogy
; /* guard's last position */
76 d_level gdlevel
; /* level (& dungeon) guard was created in */
77 xchar warncnt
; /* number of warnings to follow */
78 Bitfield(gddone
, 1); /* true iff guard has released player */
79 Bitfield(witness
, 2); /* the guard saw you do something */
81 struct fakecorridor fakecorr
[FCSIZ
];
85 ** formerly epri.h -- temple priest extension
88 aligntyp shralign
; /* alignment of priest's shrine */
89 schar shroom
; /* index in rooms */
90 coord shrpos
; /* position of shrine */
91 d_level shrlevel
; /* level (& dungeon) of shrine */
92 long intone_time
, /* used to limit verbosity +*/
93 enter_time
, /*+ of temple entry messages */
94 hostile_time
, /* forbidding feeling */
95 peaceful_time
; /* sense of peace */
97 /* note: roaming priests (no shrine) switch from ispriest to isminion
98 (and emin extension) */
101 ** formerly eshk.h -- shopkeeper extension
103 #define REPAIR_DELAY 5 /* minimum delay between shop damage & repair */
109 long price
; /* price per unit */
110 long bquan
; /* amount used up */
114 long robbed
; /* amount stolen by most recent customer */
115 long credit
; /* amount credited to customer */
116 long debit
; /* amount of debt for using unpaid items */
117 long loan
; /* shop-gold picked (part of debit) */
118 int shoptype
; /* the value of rooms[shoproom].rtype */
119 schar shoproom
; /* index in rooms; set by inshop() */
120 schar unused
; /* to force alignment for stupid compilers */
121 boolean following
; /* following customer since he owes us sth */
122 boolean surcharge
; /* angry shk inflates prices */
123 boolean dismiss_kops
; /* pacified shk sends kops away */
124 coord shk
; /* usual position shopkeeper */
125 coord shd
; /* position shop door */
126 d_level shoplevel
; /* level (& dungeon) of his shop */
127 int billct
; /* no. of entries of bill[] in use */
128 struct bill_x bill
[BILLSZ
];
129 struct bill_x
*bill_p
;
130 int visitct
; /* nr of visits by most recent customer */
131 char customer
[PL_NSIZ
]; /* most recent customer */
132 char shknam
[PL_NSIZ
];
136 ** formerly emin.h -- minion extension
139 aligntyp min_align
; /* alignment of minion */
140 boolean renegade
; /* hostile co-aligned priest or Angel */
144 ** formerly edog.h -- pet extension
146 /* 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_egd(mon) ((mon)->mextra && EGD(mon))
194 #define has_epri(mon) ((mon)->mextra && EPRI(mon))
195 #define has_eshk(mon) ((mon)->mextra && ESHK(mon))
196 #define has_emin(mon) ((mon)->mextra && EMIN(mon))
197 #define has_edog(mon) ((mon)->mextra && EDOG(mon))
198 #define has_mcorpsenm(mon) ((mon)->mextra && MCORPSENM(mon) != NON_PM)
200 #endif /* MEXTRA_H */