Files
nethack/include/mextra.h
nethack.rankin 0a52d1879f reduce temple verbosity (trunk only)
Cut down on the excessive verbosity generated when entering a temple.
The first time you enter a particular temple (or more accurately, the
temple attended by a particular priest), you still get the three message
sequence
  The <priest of foo> intones:
  Pilgrim, you enter a sacred place!
  You have a strange forbidding feeling...
or
  You experience a strange sense of peace.
except that the last one doesn't say "strange" any more.  On subsequent
visits to the same temple, you usually won't get the first introductory
message any more, often won't get the second entry one, and sometimes
won't even get the final one, depending upon how much time has elapsed
since the previous entry.  The old verbosity could really be infuriating
when attempting to lug corpses to the altar before they spoil.  Even
though the messages don't affect the passage of time, it always felt as
if they were slowing you down.  And even when you weren't in any hurry,
it required at least one and often 2 or even 3 responses to --More--
depending upon the length of the deity's name and whether some other
message was also delivered on the same turn (fairly common in minetown).

     Saving and restoring, or leaving the level and returning, resets
the priest's memory of when the messages were last given, so the next
entry after that behaves similar to the very first.  This was initially
intended for cleanup prior to saving bones data, but it seemed reasonable
to have it apply to the current game too.  Unattended temples now also
have a 25% chance of not giving any message when entering.  That one is
random rather than based on the passage of time since last entry; there's
no priest available to track the latter data.
2006-01-28 06:46:19 +00:00

186 lines
5.8 KiB
C

/* SCCS Id: @(#)mextra.h 3.5 2006/01/07 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* 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 the bottom of this file after the mextra
* struct (see MNAME, EGD, EPRI, ESHK, EMIN, or EDOG for examples).
* 4. 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));
* }
* }
*
* 5. 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);
*
* 6. Adjust size_monst() in src/cmd.c appropriately.
* 7. Adjust dealloc_mextra() in src/mon.c to clean up
* properly during monst deallocation.
* 8. Adjust restmonchn() in src/restore.c to deal with your
* struct during a restore.
* 9. Adjust buffer_to_mon() in src/restore.c to properly
* 10. Adjust savemonchn() in src/save.c to deal with your
* struct during a save.
* 11. Adjust mon_to_buffer() in src/save.c to properly package
* up your struct when the rest of the monst struct is
* packaged up.
*/
/***
** formerly vault.h -- vault guard extension
*/
#define FCSIZ (ROWNO+COLNO)
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(unused,7);
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 rooms[shoproom].rtype */
schar shoproom; /* index in 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 */
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 better liked */
#define DOGFOOD 0
#define CADAVER 1
#define ACCFOOD 2
#define MANFOOD 3
#define APPORT 4
#define POISON 5
#define UNDEF 6
#define TABU 7
struct edog {
long droptime; /* moment dog dropped object */
unsigned dropdist; /* dist of drpped 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 *mname;
struct egd *egd;
struct epri *epri;
struct eshk *eshk;
struct emin *emin;
struct edog *edog;
};
#define MNAME(mon) ((mon)->mextra->mname)
#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 has_name(mon) ((mon)->mextra && MNAME(mon))
#endif /* MEXTRA_H */