add MALE, FEMALE, and gender-neutral names for individual monster species
to the mons array. The gender-neutral name (NEUTRAL) is mandatory, the
MALE and FEMALE versions are not.
replace code uses of the mname field of permonst with one of the three
potentially-available gender-specific names.
consolidate some separate mons entries that differed only by species into a
single mons entry (caveman, cavewoman and priest,priestess etc.)
consolidate several "* lord" and "* queen/* king" monst entries into
their single species, and allow both genders on some where it makes some
sense (there is probably more work and cleanup to come out of this at some
point, and the chosen gender-neutral name variations are not cast in stone
if someone has better suggestions).
related function or macro additions:
pmname(pm, gender) to get the gender variation of the permonst name. It
guards against monsters that haven't got anything except NEUTRAL naming
and falls back to the NEUTRAL version if FEMALE and MALE versions are
missing.
Ugender to obtain the current hero gender.
Mgender(mtmp) to obtain the gender of a monster
While the code can safely refer directly to pmnames[NEUTRAL] safely in the
code because it always exists, the other two (pmnames[MALE] and
pmnames[FEMALE] may not exist so use:
pmname(ptr, gidx)
where -ptr is a permonst *
-gidx is an index into the pmnames array field of the
permonst struct
pmname() checks for a valid index and checks for null-pointers for
pmnames[MALE] and pmnames[FEMALE], and will fall back to pmnames[NEUTRAL] if
the pointer requested if the requested variation is unavailable, or if the
gidx is out-of-range.
Allow code to specify makemon flags to request female or male (via MM_MALE
and MM_FEMALE flags respectively)to makedefs, since the species alone doesn't
distinguish male/female anymore. Specifying MM_MALE or MM_FEMALE won't
override the pm M2_MALE and M2_FEMALE flags on a mons[] entry.
male and female tiles have been added to win/share/monsters.txt.
The majority are duplicated placeholders except for those that were
separate mons entries before. Perhaps someone will contribute artwork in the
future to make the male and female variations visually distinguishable.
tilemapping via has the MALE tile indexes in the glyph2tile[]
array produced at build time. If a window port has information that the
FEMALE tile is required, it just has to increment the index returned
from the glyph2tile[] array by 1.
statues already preserved gender of the monster through STATUE_FEMALE
and STATUE_MALE, so ensure that pmnames takes that into consideration.
I expect some refinement will be required after broad play-testing puts it to
the test.
consolidate caveman,cavewoman and priest,priestess monst.c entries etc
This commit will require a bump of editlevel in patchlevel.h because it alters
the index numbers of the monsters due to the consolidation of some. Those
index numbers are saved in some other structures, even though the mons[] array
itself is not part of the savefile.
Window Port Interface Change
Also add a parameter to print_glyph to convey additional information beyond
the glyph to the window ports. Every single window port was calling back to
mapglyph for the information anyway, so just included it in the interface and
produce the information right in the display core.
The mapglyph() function uses will be eliminated, although there are still some
in the code yet to be dealt with.
win32, tty, x11, Qt, msdos window ports have all had adjustments done to
utilize the new parameter instead of calling mapglyph, but some of those
window ports have not been thoroughly tested since the changes.
Interface change additional info:
print_glyph(window, x, y, glyph, bkglyph, *glyphmod)
-- Print the glyph at (x,y) on the given window. Glyphs are
integers at the interface, mapped to whatever the window-
port wants (symbol, font, color, attributes, ...there's
a 1-1 map between glyphs and distinct things on the map).
-- bkglyph is a background glyph for potential use by some
graphical or tiled environments to allow the depiction
to fall against a background consistent with the grid
around x,y. If bkglyph is NO_GLYPH, then the parameter
should be ignored (do nothing with it).
-- glyphmod provides extended information about the glyph
that window ports can use to enhance the display in
various ways.
unsigned int glyphmod[NUM_GLYPHMOD]
where:
glyphmod[GM_TTYCHAR] is the text characters associated
with the original NetHack display.
glyphmod[GM_FLAGS] are the special flags that denote
additional information that window
ports can use.
glyphmod[GM_COLOR] is the text character
color associated with the original
NetHack display.
Support for including the glyphmod info in the display glyph buffer
alongside the glyph itself was added and is the default operation.
That can be turned off by defining UNBUFFERED_GLYPHMOD at compile time.
With UNBUFFERED_GLYPHMOD operation, a call will be placed to map_glyphmod()
immediately prior to every print_glyph() call.
206 lines
7.5 KiB
C
206 lines
7.5 KiB
C
/* NetHack 3.7 mextra.h $NHDT-Date: 1596498545 2020/08/03 23:49:05 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.30 $ */
|
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
|
/*-Copyright (c) Michael Allison, 2006. */
|
|
/* NetHack may be freely redistributed. See license for details. */
|
|
|
|
#ifndef MEXTRA_H
|
|
#define MEXTRA_H
|
|
|
|
#ifndef ALIGN_H
|
|
#include "align.h"
|
|
#endif
|
|
|
|
/*
|
|
* Adding new mextra structures:
|
|
*
|
|
* 1. Add the structure definition and any required macros in this
|
|
* file above the mextra struct.
|
|
* 2. Add a pointer to your new struct to the mextra struct in this
|
|
* file.
|
|
* 3. Add a referencing macro at bottom of this file after the mextra
|
|
* struct (see MNAME, EGD, EPRI, ESHK, EMIN, or EDOG for examples).
|
|
* 4. If your new field isn't a pointer and requires a non-zero value
|
|
* on initialization, add code to init_mextra() in src/makemon.c
|
|
* 5. Create a newXX(mtmp) function and possibly a free_XX(mtmp)
|
|
* function in an appropriate new or existing source file and add
|
|
* a prototype for it to include/extern.h.
|
|
*
|
|
* void FDECL(newXX, (struct monst *));
|
|
* void FDECL(free_XX, (struct monst *));
|
|
*
|
|
* void
|
|
* newXX(mtmp)
|
|
* struct monst *mtmp;
|
|
* {
|
|
* if (!mtmp->mextra)
|
|
* mtmp->mextra = newmextra();
|
|
* if (!XX(mtmp)) {
|
|
* XX(mtmp) = (struct XX *) alloc(sizeof (struct XX));
|
|
* (void) memset((genericptr_t) XX(mtmp),
|
|
* 0, sizeof (struct XX));
|
|
* }
|
|
* }
|
|
*
|
|
* 6. Consider adding a new makemon flag MM_XX flag to include/hack.h
|
|
* and a corresponding change to makemon() if you require your
|
|
* structure to be added at monster creation time. Initialize your
|
|
* struct after a successful return from makemon().
|
|
*
|
|
* src/makemon.c: if (mmflags & MM_XX) newXX(mtmp);
|
|
* your new code: mon = makemon(&mons[mnum], x, y, MM_XX);
|
|
*
|
|
* 7. Adjust size_monst() in src/cmd.c appropriately.
|
|
* 8. Adjust dealloc_mextra() in src/mon.c to clean up
|
|
* properly during monst deallocation.
|
|
* 9. Adjust copy_mextra() in src/mon.c to make duplicate
|
|
* copies of your struct or data on another monst struct.
|
|
* 10. Adjust restmon() in src/restore.c to deal with your
|
|
* struct or data during a restore.
|
|
* 11. Adjust savemon() in src/save.c to deal with your
|
|
* struct or data during a save.
|
|
*/
|
|
|
|
/***
|
|
** formerly vault.h -- vault guard extension
|
|
*/
|
|
#define FCSIZ (ROWNO + COLNO)
|
|
#define GD_EATGOLD 0x01
|
|
#define GD_DESTROYGOLD 0x02
|
|
|
|
struct fakecorridor {
|
|
xchar fx, fy, ftyp;
|
|
};
|
|
|
|
struct egd {
|
|
int fcbeg, fcend; /* fcend: first unused pos */
|
|
int vroom; /* room number of the vault */
|
|
xchar gdx, gdy; /* goal of guard's walk */
|
|
xchar ogx, ogy; /* guard's last position */
|
|
d_level gdlevel; /* level (& dungeon) guard was created in */
|
|
xchar warncnt; /* number of warnings to follow */
|
|
Bitfield(gddone, 1); /* true iff guard has released player */
|
|
Bitfield(witness, 2); /* the guard saw you do something */
|
|
Bitfield(unused, 5);
|
|
struct fakecorridor fakecorr[FCSIZ];
|
|
};
|
|
|
|
/***
|
|
** formerly epri.h -- temple priest extension
|
|
*/
|
|
struct epri {
|
|
aligntyp shralign; /* alignment of priest's shrine */
|
|
schar shroom; /* index in rooms */
|
|
coord shrpos; /* position of shrine */
|
|
d_level shrlevel; /* level (& dungeon) of shrine */
|
|
long intone_time, /* used to limit verbosity +*/
|
|
enter_time, /*+ of temple entry messages */
|
|
hostile_time, /* forbidding feeling */
|
|
peaceful_time; /* sense of peace */
|
|
};
|
|
/* note: roaming priests (no shrine) switch from ispriest to isminion
|
|
(and emin extension) */
|
|
|
|
/***
|
|
** formerly eshk.h -- shopkeeper extension
|
|
*/
|
|
#define REPAIR_DELAY 5 /* minimum delay between shop damage & repair */
|
|
#define BILLSZ 200
|
|
|
|
struct bill_x {
|
|
unsigned bo_id;
|
|
boolean useup;
|
|
long price; /* price per unit */
|
|
long bquan; /* amount used up */
|
|
};
|
|
|
|
struct eshk {
|
|
long robbed; /* amount stolen by most recent customer */
|
|
long credit; /* amount credited to customer */
|
|
long debit; /* amount of debt for using unpaid items */
|
|
long loan; /* shop-gold picked (part of debit) */
|
|
int shoptype; /* the value of g.rooms[shoproom].rtype */
|
|
schar shoproom; /* index in g.rooms; set by inshop() */
|
|
schar unused; /* to force alignment for stupid compilers */
|
|
boolean following; /* following customer since he owes us sth */
|
|
boolean surcharge; /* angry shk inflates prices */
|
|
boolean dismiss_kops; /* pacified shk sends kops away */
|
|
coord shk; /* usual position shopkeeper */
|
|
coord shd; /* position shop door */
|
|
d_level shoplevel; /* level (& dungeon) of his shop */
|
|
int billct; /* no. of entries of bill[] in use */
|
|
struct bill_x bill[BILLSZ];
|
|
struct bill_x *bill_p;
|
|
int visitct; /* nr of visits by most recent customer */
|
|
char customer[PL_NSIZ]; /* most recent customer */
|
|
char shknam[PL_NSIZ];
|
|
};
|
|
|
|
/***
|
|
** formerly emin.h -- minion extension
|
|
*/
|
|
struct emin {
|
|
aligntyp min_align; /* alignment of minion */
|
|
boolean renegade; /* hostile co-aligned priest or Angel */
|
|
};
|
|
|
|
/***
|
|
** formerly edog.h -- pet extension
|
|
*/
|
|
/* various types of pet food, the lower the value, the better liked */
|
|
enum dogfood_types {
|
|
DOGFOOD = 0,
|
|
CADAVER = 1,
|
|
ACCFOOD = 2,
|
|
MANFOOD = 3,
|
|
APPORT = 4,
|
|
POISON = 5,
|
|
UNDEF = 6,
|
|
TABU = 7
|
|
};
|
|
|
|
struct edog {
|
|
long droptime; /* moment dog dropped object */
|
|
unsigned dropdist; /* dist of dropped obj from @ */
|
|
int apport; /* amount of training */
|
|
long whistletime; /* last time he whistled */
|
|
long hungrytime; /* will get hungry at this time */
|
|
coord ogoal; /* previous goal location */
|
|
int abuse; /* track abuses to this pet */
|
|
int revivals; /* count pet deaths */
|
|
int mhpmax_penalty; /* while starving, points reduced */
|
|
Bitfield(killed_by_u, 1); /* you attempted to kill him */
|
|
};
|
|
|
|
/***
|
|
** mextra.h -- collection of all monster extensions
|
|
*/
|
|
struct mextra {
|
|
char *mgivenname;
|
|
struct egd *egd;
|
|
struct epri *epri;
|
|
struct eshk *eshk;
|
|
struct emin *emin;
|
|
struct edog *edog;
|
|
int mcorpsenm; /* obj->corpsenm for mimic posing as statue or corpse,
|
|
* obj->spe (fruit index) for one posing as a slime mold,
|
|
* or an alignment mask for one posing as an altar */
|
|
};
|
|
|
|
#define MGIVENNAME(mon) ((mon)->mextra->mgivenname)
|
|
#define EGD(mon) ((mon)->mextra->egd)
|
|
#define EPRI(mon) ((mon)->mextra->epri)
|
|
#define ESHK(mon) ((mon)->mextra->eshk)
|
|
#define EMIN(mon) ((mon)->mextra->emin)
|
|
#define EDOG(mon) ((mon)->mextra->edog)
|
|
#define MCORPSENM(mon) ((mon)->mextra->mcorpsenm)
|
|
|
|
#define has_mgivenname(mon) ((mon)->mextra && MGIVENNAME(mon))
|
|
#define has_egd(mon) ((mon)->mextra && EGD(mon))
|
|
#define has_epri(mon) ((mon)->mextra && EPRI(mon))
|
|
#define has_eshk(mon) ((mon)->mextra && ESHK(mon))
|
|
#define has_emin(mon) ((mon)->mextra && EMIN(mon))
|
|
#define has_edog(mon) ((mon)->mextra && EDOG(mon))
|
|
#define has_mcorpsenm(mon) ((mon)->mextra && MCORPSENM(mon) != NON_PM)
|
|
|
|
#endif /* MEXTRA_H */
|