Files
nethack/include/permonst.h
nhmall 9bb96322a8 compile NetHack-3.7 without makedefs-generated .h files
This evolves and hopefully eases the game-build requirements by
removing game-compile dependencies on any header files generated
by the makedefs utility, including:

date.h dependency and its inclusion is removed and comparable functionality
is produced at runtime via new file src/date.c.

pm.h dependency and its inclusion is removed and comparable functionality is
produced by moving the monster definitions from monst.c into new header
file called monsters.h and altering them slightly. The former pm.h header
file #define PM_ values are now replaced with appropriate emitted enum
entries during the compiler preprocessing.

onames.h dependency and	its inclusion is removed and comparable functionality
is produced by moving the object definitions from objects.c into new header
file called objects.h and altering them slightly. The former onames.h header
file #define values are now replaced with appropriate emitted enum entries
during the compiler preprocessing.

artilist.h has been slightly altered, and the former onames.h artifact-related
header file #define ART_ values are now replaced with appropriate emitted enum
entries during the compiler preprocessing.

makedefs can still produce date.h (makedefs -v), pm.h (makedefs -p), and
onames.h (makedefs -o) for reference purposes. They won't be used during
the compiler.

The other uses for makedefs remain. They are used to prepare external
file content that the game utilizes, not prerequisite code for the
compile:
    makedefs -d    (database)
    makedefs -r    (rumors)
    makedefs -h    (oracles)
    makedefs -s    (epitaphs, engravings, bogusmons)

date.c

Pull the code for date/time stamping from mdlib.c into date.c.
Set date.o to be dependent on source files, header files, and .o files
so that date.o is rebuilt from date.c when any of those changes, thus
ensuring an accurate date/time stamp. It also includes git sha
functionality formerly done by makedefs writing #define directives
into include/date.h. For unix it passes the git info on
the compile line for date.c (via sys/unix/hints/linux.2020, macOS.2020)

nethack --dumpenums (optional, but on by default)

Allow developer to obtain some internal enum values from NetHack
without having to resort to an external utility such as
makedefs.

Uncomment #define NODUMPENUMS in config.h to disable this.

The updates to sys/windows/Makefile.gcc have not been tested yet.
2021-08-21 07:59:18 -04:00

94 lines
3.1 KiB
C

/* NetHack 3.7 permonst.h $NHDT-Date: 1596498555 2020/08/03 23:49:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.14 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */
/* NetHack may be freely redistributed. See license for details. */
#ifndef PERMONST_H
#define PERMONST_H
/* This structure covers all attack forms.
* aatyp is the gross attack type (eg. claw, bite, breath, ...)
* adtyp is the damage type (eg. physical, fire, cold, spell, ...)
* damn is the number of hit dice of damage from the attack.
* damd is the number of sides on each die.
*
* Some attacks can do no points of damage. Additionally, some can
* have special effects *and* do damage as well. If damn and damd
* are set, they may have a special meaning. For example, if set
* for a blinding attack, they determine the amount of time blinded.
*/
struct attack {
uchar aatyp;
uchar adtyp, damn, damd;
};
/* Max # of attacks for any given monster.
*/
#define NATTK 6
/* Weight of a human body
*/
#define WT_HUMAN 1450
#ifndef ALIGN_H
#include "align.h"
#endif
#include "monattk.h"
#include "monflag.h"
struct permonst {
const char *pmnames[NUM_MGENDERS];
char mlet; /* symbol */
schar mlevel, /* base monster level */
mmove, /* move speed */
ac, /* (base) armor class */
mr; /* (base) magic resistance */
aligntyp maligntyp; /* basic monster alignment */
unsigned short geno; /* creation/geno mask value */
struct attack mattk[NATTK]; /* attacks matrix */
unsigned short cwt, /* weight of corpse */
cnutrit; /* its nutritional value */
uchar msound; /* noise it makes (6 bits) */
uchar msize; /* physical size (3 bits) */
uchar mresists; /* resistances */
uchar mconveys; /* conveyed by eating */
unsigned long mflags1, /* boolean bitflags */
mflags2; /* more boolean bitflags */
unsigned short mflags3; /* yet more boolean bitflags */
uchar difficulty; /* toughness (formerly from makedefs -m) */
#ifdef TEXTCOLOR
uchar mcolor; /* color to use */
#endif
};
extern NEARDATA struct permonst mons[]; /* the master list of monster types */
enum monnums {
#define MONS_ENUM
#include "monsters.h"
#undef MONS_ENUM
NUMMONS
};
#define VERY_SLOW 3
#define SLOW_SPEED 9
#define NORMAL_SPEED 12 /* movement rates */
#define FAST_SPEED 15
#define VERY_FAST 24
#define NON_PM (-1) /* "not a monster" */
#define LOW_PM (NON_PM + 1) /* first monster in mons[] */
#define SPECIAL_PM PM_LONG_WORM_TAIL /* [normal] < ~ < [special] */
/* mons[SPECIAL_PM] through mons[NUMMONS-1], inclusive, are
never generated randomly and cannot be polymorphed into */
#ifdef PMNAME_MACROS
#define pmname(pm,g) ((((g) == MALE || (g) == FEMALE) && (pm)->pmnames[g]) \
? (pm)->pmnames[g] : (pm)->pmnames[NEUTRAL])
#endif
#endif /* PERMONST_H */