mextra changes
Note: The CVS repository was tagged with NETHACK_PRE_MEXTRA prior to application of this patch to allow easy withdrawal if necessary. Adds a new mextra structure type that has a set of pointers to various types of monster structures including: mname, egd, epri, eshk, emin, edog Replaces the mextra bits in the monst structure with a single pointer called mtmp->mextra of type (struct mextra *). The pointer can be null if there are no additional structures attached. The mextra structure is not adjacent to the monst structure. Reduces the in-memory footprint of the monst that has no other structures attached, at the cost of adding 6 extra long ints per monster to the save file The new mextra structure has the mextra fields independent of each other, not overlapping as was the case with previous NetHack versions. This patch doesn't do anything to capitalize on that difference however. Consolidates vault.h, epri.h, eshk.h, emin.h and edog.h into mextra.h Adds a macro for checking for whether a monster has a name: has_name(monst) This fixes the magic trap panic expels() -> spoteffects() -> dotrap() -> domagictrap() -> tamedog() because the monst no longer varies in size so no replacement is required.
This commit is contained in:
@@ -34,18 +34,17 @@ include:
|
|||||||
align.h amiconf.h artifact.h artilist.h attrib.h
|
align.h amiconf.h artifact.h artilist.h attrib.h
|
||||||
beconf.h botl.h color.h config.h config1.h
|
beconf.h botl.h color.h config.h config1.h
|
||||||
context.h coord.h decl.h def_os2.h dgn_file.h
|
context.h coord.h decl.h def_os2.h dgn_file.h
|
||||||
display.h dlb.h dungeon.h edog.h emin.h
|
display.h dlb.h dungeon.h engrave.h extern.h
|
||||||
engrave.h epri.h eshk.h extern.h flag.h
|
flag.h func_tab.h global.h hack.h lev.h
|
||||||
func_tab.h global.h hack.h lev.h mail.h
|
mail.h mextra.h mfndpos.h micro.h mkroom.h
|
||||||
mfndpos.h micro.h mkroom.h monattk.h mondata.h
|
monattk.h mondata.h monflag.h monst.h monsym.h
|
||||||
monflag.h monst.h monsym.h nhlan.h ntconf.h
|
nhlan.h ntconf.h obj.h objclass.h os2conf.h
|
||||||
obj.h objclass.h os2conf.h patchlevel.h pcconf.h
|
patchlevel.h pcconf.h permonst.h prop.h qtext.h
|
||||||
permonst.h prop.h qtext.h quest.h rect.h
|
quest.h rect.h region.h rm.h skills.h
|
||||||
region.h rm.h skills.h sp_lev.h spell.h
|
sp_lev.h spell.h system.h tcap.h timeout.h
|
||||||
system.h tcap.h timeout.h tosconf.h tradstdc.h
|
tosconf.h tradstdc.h trampoli.h trap.h unixconf.h
|
||||||
trampoli.h trap.h unixconf.h vault.h vision.h
|
vision.h vmsconf.h wceconf.h winami.h winprocs.h
|
||||||
vmsconf.h wceconf.h winami.h winprocs.h wintype.h
|
wintype.h you.h youprop.h
|
||||||
you.h youprop.h
|
|
||||||
(file for tty versions)
|
(file for tty versions)
|
||||||
wintty.h
|
wintty.h
|
||||||
(files for X versions)
|
(files for X versions)
|
||||||
|
|||||||
+14
-1
@@ -426,6 +426,8 @@ E void FDECL(adj_abon, (struct obj *,SCHAR_P));
|
|||||||
|
|
||||||
/* ### dog.c ### */
|
/* ### dog.c ### */
|
||||||
|
|
||||||
|
E void FDECL(newedog, (struct monst *));
|
||||||
|
E void FDECL(free_edog, (struct monst *));
|
||||||
E void FDECL(initedog, (struct monst *));
|
E void FDECL(initedog, (struct monst *));
|
||||||
E struct monst *FDECL(make_familiar, (struct obj *,XCHAR_P,XCHAR_P,BOOLEAN_P));
|
E struct monst *FDECL(make_familiar, (struct obj *,XCHAR_P,XCHAR_P,BOOLEAN_P));
|
||||||
E struct monst *NDECL(makedog);
|
E struct monst *NDECL(makedog);
|
||||||
@@ -436,7 +438,7 @@ E void FDECL(mon_catchup_elapsed_time, (struct monst *,long));
|
|||||||
E void FDECL(keepdogs, (BOOLEAN_P));
|
E void FDECL(keepdogs, (BOOLEAN_P));
|
||||||
E void FDECL(migrate_to_level, (struct monst *,XCHAR_P,XCHAR_P,coord *));
|
E void FDECL(migrate_to_level, (struct monst *,XCHAR_P,XCHAR_P,coord *));
|
||||||
E int FDECL(dogfood, (struct monst *,struct obj *));
|
E int FDECL(dogfood, (struct monst *,struct obj *));
|
||||||
E struct monst *FDECL(tamedog, (struct monst *,struct obj *));
|
E boolean FDECL(tamedog, (struct monst *,struct obj *));
|
||||||
E void FDECL(abuse_dog, (struct monst *));
|
E void FDECL(abuse_dog, (struct monst *));
|
||||||
E void FDECL(wary_dog, (struct monst *, BOOLEAN_P));
|
E void FDECL(wary_dog, (struct monst *, BOOLEAN_P));
|
||||||
|
|
||||||
@@ -962,6 +964,7 @@ E void FDECL(readmail, (struct obj *));
|
|||||||
|
|
||||||
/* ### makemon.c ### */
|
/* ### makemon.c ### */
|
||||||
|
|
||||||
|
E void FDECL(dealloc_monst, (struct monst *));
|
||||||
E boolean FDECL(is_home_elemental, (struct permonst *));
|
E boolean FDECL(is_home_elemental, (struct permonst *));
|
||||||
E struct monst *FDECL(clone_mon, (struct monst *,XCHAR_P,XCHAR_P));
|
E struct monst *FDECL(clone_mon, (struct monst *,XCHAR_P,XCHAR_P));
|
||||||
E int FDECL(monhp_per_lvl, (struct monst *));
|
E int FDECL(monhp_per_lvl, (struct monst *));
|
||||||
@@ -1027,6 +1030,8 @@ E int FDECL(doseduce, (struct monst *));
|
|||||||
|
|
||||||
/* ### minion.c ### */
|
/* ### minion.c ### */
|
||||||
|
|
||||||
|
E void FDECL(newemin, (struct monst *));
|
||||||
|
E void FDECL(free_emin, (struct monst *));
|
||||||
E int FDECL(msummon, (struct monst *));
|
E int FDECL(msummon, (struct monst *));
|
||||||
E void FDECL(summon_minion, (ALIGNTYP_P,BOOLEAN_P));
|
E void FDECL(summon_minion, (ALIGNTYP_P,BOOLEAN_P));
|
||||||
E int FDECL(demon_talk, (struct monst *));
|
E int FDECL(demon_talk, (struct monst *));
|
||||||
@@ -1686,6 +1691,8 @@ E void FDECL(ghod_hitsu, (struct monst *));
|
|||||||
E void NDECL(angry_priest);
|
E void NDECL(angry_priest);
|
||||||
E void NDECL(clearpriests);
|
E void NDECL(clearpriests);
|
||||||
E void FDECL(restpriest, (struct monst *,BOOLEAN_P));
|
E void FDECL(restpriest, (struct monst *,BOOLEAN_P));
|
||||||
|
E void FDECL(newepri, (struct monst *));
|
||||||
|
E void FDECL(free_epri, (struct monst *));
|
||||||
|
|
||||||
/* ### quest.c ### */
|
/* ### quest.c ### */
|
||||||
|
|
||||||
@@ -1774,6 +1781,7 @@ E void FDECL(getlev, (int,int,XCHAR_P,BOOLEAN_P));
|
|||||||
E void FDECL(get_plname_from_file, (int, char *));
|
E void FDECL(get_plname_from_file, (int, char *));
|
||||||
E void NDECL(minit);
|
E void NDECL(minit);
|
||||||
E boolean FDECL(lookup_id_mapping, (unsigned, unsigned *));
|
E boolean FDECL(lookup_id_mapping, (unsigned, unsigned *));
|
||||||
|
E struct monst *FDECL(buffer_to_mon, (genericptr_t));
|
||||||
E void FDECL(mread, (int,genericptr_t,unsigned int));
|
E void FDECL(mread, (int,genericptr_t,unsigned int));
|
||||||
#ifndef GOLDOBJ
|
#ifndef GOLDOBJ
|
||||||
E void FDECL(put_gold_back, (struct obj **,long *));
|
E void FDECL(put_gold_back, (struct obj **,long *));
|
||||||
@@ -1853,6 +1861,7 @@ E void NDECL(co_false);
|
|||||||
#else
|
#else
|
||||||
E void FDECL(savelev, (int,XCHAR_P,int));
|
E void FDECL(savelev, (int,XCHAR_P,int));
|
||||||
#endif
|
#endif
|
||||||
|
E genericptr_t FDECL(mon_to_buffer, (struct monst *, int *));
|
||||||
E void FDECL(bufon, (int));
|
E void FDECL(bufon, (int));
|
||||||
E void FDECL(bufoff, (int));
|
E void FDECL(bufoff, (int));
|
||||||
E void FDECL(bflush, (int));
|
E void FDECL(bflush, (int));
|
||||||
@@ -1932,6 +1941,8 @@ E char *FDECL(Shk_Your, (char *,struct obj *));
|
|||||||
|
|
||||||
/* ### shknam.c ### */
|
/* ### shknam.c ### */
|
||||||
|
|
||||||
|
E void FDECL(neweshk, (struct monst *));
|
||||||
|
E void FDECL(free_eshk, (struct monst *));
|
||||||
E void FDECL(stock_room, (int,struct mkroom *));
|
E void FDECL(stock_room, (int,struct mkroom *));
|
||||||
E boolean FDECL(saleable, (struct monst *,struct obj *));
|
E boolean FDECL(saleable, (struct monst *,struct obj *));
|
||||||
E int FDECL(get_shop_item, (int));
|
E int FDECL(get_shop_item, (int));
|
||||||
@@ -2207,6 +2218,8 @@ E int FDECL(hide_privileges, (BOOLEAN_P));
|
|||||||
|
|
||||||
/* ### vault.c ### */
|
/* ### vault.c ### */
|
||||||
|
|
||||||
|
E void FDECL(newegd, (struct monst *));
|
||||||
|
E void FDECL(free_egd, (struct monst *));
|
||||||
E boolean FDECL(grddead, (struct monst *));
|
E boolean FDECL(grddead, (struct monst *));
|
||||||
E char FDECL(vault_occupied, (char *));
|
E char FDECL(vault_occupied, (char *));
|
||||||
E void NDECL(invault);
|
E void NDECL(invault);
|
||||||
|
|||||||
+13
-10
@@ -163,16 +163,19 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */
|
|||||||
#define NO_SPELL 0
|
#define NO_SPELL 0
|
||||||
|
|
||||||
/* flags to control makemon() */
|
/* flags to control makemon() */
|
||||||
#define NO_MM_FLAGS 0x00 /* use this rather than plain 0 */
|
#define NO_MM_FLAGS 0x00000 /* use this rather than plain 0 */
|
||||||
#define NO_MINVENT 0x01 /* suppress minvent when creating mon */
|
#define NO_MINVENT 0x00001 /* suppress minvent when creating mon */
|
||||||
#define MM_NOWAIT 0x02 /* don't set STRAT_WAITMASK flags */
|
#define MM_NOWAIT 0x00002 /* don't set STRAT_WAITMASK flags */
|
||||||
#define MM_EDOG 0x04 /* add edog structure */
|
#define MM_NOCOUNTBIRTH 0x00004 /* don't increment born counter (for revival) */
|
||||||
#define MM_EMIN 0x08 /* add emin structure */
|
#define MM_IGNOREWATER 0x00008 /* ignore water when positioning */
|
||||||
#define MM_ANGRY 0x10 /* monster is created angry */
|
#define MM_ADJACENTOK 0x00010 /* it is acceptable to use adjacent coordinates */
|
||||||
#define MM_NONAME 0x20 /* monster is not christened */
|
#define MM_ANGRY 0x00020 /* monster is created angry */
|
||||||
#define MM_NOCOUNTBIRTH 0x40 /* don't increment born counter (for revival) */
|
#define MM_NONAME 0x00040 /* monster is not christened */
|
||||||
#define MM_IGNOREWATER 0x80 /* ignore water when positioning */
|
#define MM_EGD 0x00100 /* add egd structure */
|
||||||
#define MM_ADJACENTOK 0x100 /* it is acceptable to use adjacent coordinates */
|
#define MM_EPRI 0x00200 /* add epri structure */
|
||||||
|
#define MM_ESHK 0x00400 /* add eshk structure */
|
||||||
|
#define MM_EMIN 0x00800 /* add emin structure */
|
||||||
|
#define MM_EDOG 0x01000 /* add edog structure */
|
||||||
|
|
||||||
/* flags for make_corpse() and mkcorpstat() */
|
/* flags for make_corpse() and mkcorpstat() */
|
||||||
#define CORPSTAT_NONE 0x00
|
#define CORPSTAT_NONE 0x00
|
||||||
|
|||||||
+5
-29
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)monst.h 3.5 2005/07/13 */
|
/* SCCS Id: @(#)monst.h 3.5 2006/01/02 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -33,8 +33,8 @@
|
|||||||
#define MINV_NOLET 0x01
|
#define MINV_NOLET 0x01
|
||||||
#define MINV_ALL 0x02
|
#define MINV_ALL 0x02
|
||||||
|
|
||||||
#ifndef ALIGN_H
|
#ifndef MEXTRA_H
|
||||||
#include "align.h"
|
#include "mextra.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct monst {
|
struct monst {
|
||||||
@@ -138,40 +138,16 @@ struct monst {
|
|||||||
long misc_worn_check;
|
long misc_worn_check;
|
||||||
xchar weapon_check;
|
xchar weapon_check;
|
||||||
|
|
||||||
uchar mnamelth; /* length of name (following mxlth) */
|
|
||||||
short mxlth; /* length of following data */
|
|
||||||
/* in order to prevent alignment problems mextra should
|
|
||||||
be (or follow) a long int */
|
|
||||||
int meating; /* monster is eating timeout */
|
int meating; /* monster is eating timeout */
|
||||||
long mextra[1]; /* monster dependent info */
|
struct mextra *mextra; /* point to mextra struct */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
#define newmonst() (struct monst *)alloc(sizeof(struct monst))
|
||||||
* Note that mextra[] may correspond to any of a number of structures, which
|
|
||||||
* are indicated by some of the other fields.
|
|
||||||
* isgd -> struct egd
|
|
||||||
* ispriest -> struct epri
|
|
||||||
* isshk -> struct eshk
|
|
||||||
* isminion -> struct emin
|
|
||||||
* (struct epri for roaming priests and angels, which is
|
|
||||||
* compatible with emin for polymorph purposes)
|
|
||||||
* mtame -> struct edog
|
|
||||||
* (struct epri for guardian angels, which do not eat
|
|
||||||
* or do other doggy things)
|
|
||||||
* Since at most one structure can be indicated in this manner, it is not
|
|
||||||
* possible to tame any creatures using the other structures (the only
|
|
||||||
* exception being the guardian angels which are tame on creation).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define newmonst(xl) (struct monst *)alloc((unsigned)(xl) + sizeof(struct monst))
|
|
||||||
#define dealloc_monst(mon) free((genericptr_t)(mon))
|
|
||||||
|
|
||||||
/* these are in mspeed */
|
/* these are in mspeed */
|
||||||
#define MSLOW 1 /* slow monster */
|
#define MSLOW 1 /* slow monster */
|
||||||
#define MFAST 2 /* speeded monster */
|
#define MFAST 2 /* speeded monster */
|
||||||
|
|
||||||
#define NAME(mtmp) (((char *)(mtmp)->mextra) + (mtmp)->mxlth)
|
|
||||||
|
|
||||||
#define MON_WEP(mon) ((mon)->mw)
|
#define MON_WEP(mon) ((mon)->mw)
|
||||||
#define MON_NOWEP(mon) ((mon)->mw = (struct obj *)0)
|
#define MON_NOWEP(mon) ((mon)->mw = (struct obj *)0)
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
* Incrementing EDITLEVEL can be used to force invalidation of old bones
|
* Incrementing EDITLEVEL can be used to force invalidation of old bones
|
||||||
* and save files.
|
* and save files.
|
||||||
*/
|
*/
|
||||||
#define EDITLEVEL 24
|
#define EDITLEVEL 25
|
||||||
|
|
||||||
#define COPYRIGHT_BANNER_A \
|
#define COPYRIGHT_BANNER_A \
|
||||||
"NetHack, Copyright 1985-2005"
|
"NetHack, Copyright 1985-2005"
|
||||||
|
|||||||
+1
-2
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)permonst.h 3.5 1999/07/02 */
|
/* SCCS Id: @(#)permonst.h 3.5 2006/01/04 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -50,7 +50,6 @@ struct permonst {
|
|||||||
struct attack mattk[NATTK]; /* attacks matrix */
|
struct attack mattk[NATTK]; /* attacks matrix */
|
||||||
unsigned short cwt, /* weight of corpse */
|
unsigned short cwt, /* weight of corpse */
|
||||||
cnutrit; /* its nutritional value */
|
cnutrit; /* its nutritional value */
|
||||||
short pxlth; /* length of extension */
|
|
||||||
uchar msound; /* noise it makes (6 bits) */
|
uchar msound; /* noise it makes (6 bits) */
|
||||||
uchar msize; /* physical size (3 bits) */
|
uchar msize; /* physical size (3 bits) */
|
||||||
uchar mresists; /* resistances */
|
uchar mresists; /* resistances */
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "edog.h"
|
|
||||||
|
|
||||||
static const char tools[] = { TOOL_CLASS, WEAPON_CLASS, WAND_CLASS, 0 };
|
static const char tools[] = { TOOL_CLASS, WEAPON_CLASS, WAND_CLASS, 0 };
|
||||||
static const char tools_too[] = { ALL_CLASSES, TOOL_CLASS, POTION_CLASS,
|
static const char tools_too[] = { ALL_CLASSES, TOOL_CLASS, POTION_CLASS,
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ extern void FDECL(show_borlandc_stats, (winid));
|
|||||||
#ifdef DEBUG_MIGRATING_MONS
|
#ifdef DEBUG_MIGRATING_MONS
|
||||||
STATIC_PTR int NDECL(wiz_migrate_mons);
|
STATIC_PTR int NDECL(wiz_migrate_mons);
|
||||||
#endif
|
#endif
|
||||||
|
STATIC_DCL int FDECL(size_monst, (struct monst *));
|
||||||
STATIC_DCL void FDECL(count_obj, (struct obj *, long *, long *, BOOLEAN_P, BOOLEAN_P));
|
STATIC_DCL void FDECL(count_obj, (struct obj *, long *, long *, BOOLEAN_P, BOOLEAN_P));
|
||||||
STATIC_DCL void FDECL(obj_chain, (winid, const char *, struct obj *, long *, long *));
|
STATIC_DCL void FDECL(obj_chain, (winid, const char *, struct obj *, long *, long *));
|
||||||
STATIC_DCL void FDECL(mon_invent_chain, (winid, const char *, struct monst *, long *, long *));
|
STATIC_DCL void FDECL(mon_invent_chain, (winid, const char *, struct monst *, long *, long *));
|
||||||
@@ -1848,6 +1849,22 @@ contained(win, src, total_count, total_size)
|
|||||||
putstr(win, 0, buf);
|
putstr(win, 0, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STATIC_OVL int
|
||||||
|
size_monst(mtmp)
|
||||||
|
struct monst *mtmp;
|
||||||
|
{
|
||||||
|
int sz = sizeof(struct monst);
|
||||||
|
if (mtmp->mextra) {
|
||||||
|
if (MNAME(mtmp)) sz += strlen(MNAME(mtmp))+1;
|
||||||
|
if (EGD(mtmp)) sz += sizeof(struct egd);
|
||||||
|
if (EPRI(mtmp)) sz += sizeof(struct epri);
|
||||||
|
if (ESHK(mtmp)) sz += sizeof(struct eshk);
|
||||||
|
if (EMIN(mtmp)) sz += sizeof(struct emin);
|
||||||
|
if (EDOG(mtmp)) sz += sizeof(struct edog);
|
||||||
|
}
|
||||||
|
return sz;
|
||||||
|
}
|
||||||
|
|
||||||
STATIC_OVL void
|
STATIC_OVL void
|
||||||
mon_chain(win, src, chain, total_count, total_size)
|
mon_chain(win, src, chain, total_count, total_size)
|
||||||
winid win;
|
winid win;
|
||||||
@@ -1862,7 +1879,7 @@ mon_chain(win, src, chain, total_count, total_size)
|
|||||||
|
|
||||||
for (count = size = 0, mon = chain; mon; mon = mon->nmon) {
|
for (count = size = 0, mon = chain; mon; mon = mon->nmon) {
|
||||||
count++;
|
count++;
|
||||||
size += sizeof(struct monst) + mon->mxlth + mon->mnamelth;
|
size += size_monst(mon);
|
||||||
}
|
}
|
||||||
*total_count += count;
|
*total_count += count;
|
||||||
*total_size += size;
|
*total_size += size;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "edog.h"
|
|
||||||
/* #define DEBUG */ /* turn on for diagnostics */
|
/* #define DEBUG */ /* turn on for diagnostics */
|
||||||
|
|
||||||
static NEARDATA boolean did_dig_msg;
|
static NEARDATA boolean did_dig_msg;
|
||||||
|
|||||||
+16
-20
@@ -218,7 +218,6 @@ struct monst *mtmp;
|
|||||||
const char *name;
|
const char *name;
|
||||||
{
|
{
|
||||||
int lth;
|
int lth;
|
||||||
struct monst *mtmp2;
|
|
||||||
char buf[PL_PSIZ];
|
char buf[PL_PSIZ];
|
||||||
|
|
||||||
/* dogname & catname are PL_PSIZ arrays; object names have same limit */
|
/* dogname & catname are PL_PSIZ arrays; object names have same limit */
|
||||||
@@ -228,19 +227,16 @@ const char *name;
|
|||||||
name = strncpy(buf, name, PL_PSIZ - 1);
|
name = strncpy(buf, name, PL_PSIZ - 1);
|
||||||
buf[PL_PSIZ - 1] = '\0';
|
buf[PL_PSIZ - 1] = '\0';
|
||||||
}
|
}
|
||||||
if (lth == mtmp->mnamelth) {
|
if (has_name(mtmp) && lth == (int)(strlen(MNAME(mtmp)) + 1)) {
|
||||||
/* don't need to allocate a new monst struct */
|
/* don't need to allocate a new mname */
|
||||||
if (lth) Strcpy(NAME(mtmp), name);
|
if (lth) Strcpy(MNAME(mtmp), name);
|
||||||
return mtmp;
|
return mtmp;
|
||||||
}
|
}
|
||||||
mtmp2 = newmonst(mtmp->mxlth + lth);
|
if (has_name(mtmp)) free((genericptr_t)MNAME(mtmp));
|
||||||
*mtmp2 = *mtmp;
|
|
||||||
(void) memcpy((genericptr_t)mtmp2->mextra,
|
MNAME(mtmp) = (char *)alloc(lth);
|
||||||
(genericptr_t)mtmp->mextra, mtmp->mxlth);
|
if (lth) Strcpy(MNAME(mtmp), name);
|
||||||
mtmp2->mnamelth = lth;
|
return(mtmp);
|
||||||
if (lth) Strcpy(NAME(mtmp2), name);
|
|
||||||
replmon(mtmp,mtmp2);
|
|
||||||
return(mtmp2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -701,8 +697,8 @@ boolean called;
|
|||||||
if (do_hallu) {
|
if (do_hallu) {
|
||||||
Strcat(buf, rndmonnam());
|
Strcat(buf, rndmonnam());
|
||||||
name_at_start = FALSE;
|
name_at_start = FALSE;
|
||||||
} else if (mtmp->mnamelth) {
|
} else if (has_name(mtmp)) {
|
||||||
char *name = NAME(mtmp);
|
char *name = MNAME(mtmp);
|
||||||
|
|
||||||
if (mdat == &mons[PM_GHOST]) {
|
if (mdat == &mons[PM_GHOST]) {
|
||||||
Sprintf(eos(buf), "%s ghost", s_suffix(name));
|
Sprintf(eos(buf), "%s ghost", s_suffix(name));
|
||||||
@@ -775,7 +771,7 @@ l_monnam(mtmp)
|
|||||||
register struct monst *mtmp;
|
register struct monst *mtmp;
|
||||||
{
|
{
|
||||||
return(x_monnam(mtmp, ARTICLE_NONE, (char *)0,
|
return(x_monnam(mtmp, ARTICLE_NONE, (char *)0,
|
||||||
mtmp->mnamelth ? SUPPRESS_SADDLE : 0, TRUE));
|
(has_name(mtmp)) ? SUPPRESS_SADDLE : 0, TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
@@ -783,7 +779,7 @@ mon_nam(mtmp)
|
|||||||
register struct monst *mtmp;
|
register struct monst *mtmp;
|
||||||
{
|
{
|
||||||
return(x_monnam(mtmp, ARTICLE_THE, (char *)0,
|
return(x_monnam(mtmp, ARTICLE_THE, (char *)0,
|
||||||
mtmp->mnamelth ? SUPPRESS_SADDLE : 0, FALSE));
|
(has_name(mtmp)) ? SUPPRESS_SADDLE : 0, FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print the name as if mon_nam() was called, but assume that the player
|
/* print the name as if mon_nam() was called, but assume that the player
|
||||||
@@ -795,7 +791,7 @@ noit_mon_nam(mtmp)
|
|||||||
register struct monst *mtmp;
|
register struct monst *mtmp;
|
||||||
{
|
{
|
||||||
return(x_monnam(mtmp, ARTICLE_THE, (char *)0,
|
return(x_monnam(mtmp, ARTICLE_THE, (char *)0,
|
||||||
mtmp->mnamelth ? (SUPPRESS_SADDLE|SUPPRESS_IT) :
|
(has_name(mtmp)) ? (SUPPRESS_SADDLE|SUPPRESS_IT) :
|
||||||
SUPPRESS_IT, FALSE));
|
SUPPRESS_IT, FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -835,7 +831,7 @@ struct monst *mtmp;
|
|||||||
int prefix, suppression_flag;
|
int prefix, suppression_flag;
|
||||||
|
|
||||||
prefix = mtmp->mtame ? ARTICLE_YOUR : ARTICLE_THE;
|
prefix = mtmp->mtame ? ARTICLE_YOUR : ARTICLE_THE;
|
||||||
suppression_flag = (mtmp->mnamelth
|
suppression_flag = (has_name(mtmp)
|
||||||
#ifdef STEED
|
#ifdef STEED
|
||||||
/* "saddled" is redundant when mounted */
|
/* "saddled" is redundant when mounted */
|
||||||
|| mtmp == u.usteed
|
|| mtmp == u.usteed
|
||||||
@@ -851,7 +847,7 @@ register struct monst *mtmp;
|
|||||||
register const char *adj;
|
register const char *adj;
|
||||||
{
|
{
|
||||||
register char *bp = x_monnam(mtmp, ARTICLE_THE, adj,
|
register char *bp = x_monnam(mtmp, ARTICLE_THE, adj,
|
||||||
mtmp->mnamelth ? SUPPRESS_SADDLE : 0, FALSE);
|
(has_name(mtmp)) ? SUPPRESS_SADDLE : 0, FALSE);
|
||||||
|
|
||||||
*bp = highc(*bp);
|
*bp = highc(*bp);
|
||||||
return(bp);
|
return(bp);
|
||||||
@@ -862,7 +858,7 @@ a_monnam(mtmp)
|
|||||||
register struct monst *mtmp;
|
register struct monst *mtmp;
|
||||||
{
|
{
|
||||||
return x_monnam(mtmp, ARTICLE_A, (char *)0,
|
return x_monnam(mtmp, ARTICLE_A, (char *)0,
|
||||||
mtmp->mnamelth ? SUPPRESS_SADDLE : 0, FALSE);
|
(has_name(mtmp)) ? SUPPRESS_SADDLE : 0, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|||||||
@@ -1,12 +1,33 @@
|
|||||||
/* SCCS Id: @(#)dog.c 3.5 2005/03/17 */
|
/* SCCS Id: @(#)dog.c 3.5 2006/01/03 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "edog.h"
|
|
||||||
|
|
||||||
STATIC_DCL int NDECL(pet_type);
|
STATIC_DCL int NDECL(pet_type);
|
||||||
|
|
||||||
|
void
|
||||||
|
newedog(mtmp)
|
||||||
|
struct monst *mtmp;
|
||||||
|
{
|
||||||
|
if (!mtmp->mextra) mtmp->mextra = newmextra();
|
||||||
|
if (!EDOG(mtmp)) {
|
||||||
|
EDOG(mtmp) = (struct edog *)alloc(sizeof(struct edog));
|
||||||
|
(void) memset((genericptr_t) EDOG(mtmp), 0, sizeof(struct edog));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
free_edog(mtmp)
|
||||||
|
struct monst *mtmp;
|
||||||
|
{
|
||||||
|
if (mtmp->mextra && EDOG(mtmp)) {
|
||||||
|
free((genericptr_t) EDOG(mtmp));
|
||||||
|
EDOG(mtmp) = (struct edog *)0;
|
||||||
|
}
|
||||||
|
mtmp->mtame = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
initedog(mtmp)
|
initedog(mtmp)
|
||||||
register struct monst *mtmp;
|
register struct monst *mtmp;
|
||||||
@@ -764,24 +785,27 @@ register struct obj *obj;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct monst *
|
/*
|
||||||
|
* With the separate mextra structure added in 3.5.x this always
|
||||||
|
* operates on the original mtmp. It now returns TRUE if the taming
|
||||||
|
* succeeded.
|
||||||
|
*/
|
||||||
|
boolean
|
||||||
tamedog(mtmp, obj)
|
tamedog(mtmp, obj)
|
||||||
register struct monst *mtmp;
|
register struct monst *mtmp;
|
||||||
register struct obj *obj;
|
register struct obj *obj;
|
||||||
{
|
{
|
||||||
register struct monst *mtmp2;
|
|
||||||
|
|
||||||
/* The Wiz, Medusa and the quest nemeses aren't even made peaceful. */
|
/* The Wiz, Medusa and the quest nemeses aren't even made peaceful. */
|
||||||
if (mtmp->iswiz || mtmp->data == &mons[PM_MEDUSA]
|
if (mtmp->iswiz || mtmp->data == &mons[PM_MEDUSA]
|
||||||
|| (mtmp->data->mflags3 & M3_WANTSARTI))
|
|| (mtmp->data->mflags3 & M3_WANTSARTI))
|
||||||
return((struct monst *)0);
|
return FALSE;
|
||||||
|
|
||||||
/* worst case, at least it'll be peaceful. */
|
/* worst case, at least it'll be peaceful. */
|
||||||
mtmp->mpeaceful = 1;
|
mtmp->mpeaceful = 1;
|
||||||
set_malign(mtmp);
|
set_malign(mtmp);
|
||||||
if(flags.moonphase == FULL_MOON && night() && rn2(6) && obj
|
if(flags.moonphase == FULL_MOON && night() && rn2(6) && obj
|
||||||
&& mtmp->data->mlet == S_DOG)
|
&& mtmp->data->mlet == S_DOG)
|
||||||
return((struct monst *)0);
|
return FALSE;
|
||||||
|
|
||||||
/* If we cannot tame it, at least it's no longer afraid. */
|
/* If we cannot tame it, at least it's no longer afraid. */
|
||||||
mtmp->mflee = 0;
|
mtmp->mflee = 0;
|
||||||
@@ -818,9 +842,9 @@ register struct obj *obj;
|
|||||||
/* eating might have killed it, but that doesn't matter here;
|
/* eating might have killed it, but that doesn't matter here;
|
||||||
a non-null result suppresses "miss" message for thrown
|
a non-null result suppresses "miss" message for thrown
|
||||||
food and also implies that the object has been deleted */
|
food and also implies that the object has been deleted */
|
||||||
return mtmp;
|
return TRUE;
|
||||||
} else
|
} else
|
||||||
return (struct monst *)0;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mtmp->mtame || !mtmp->mcanmove ||
|
if (mtmp->mtame || !mtmp->mcanmove ||
|
||||||
@@ -828,35 +852,30 @@ register struct obj *obj;
|
|||||||
mtmp->isshk || mtmp->isgd || mtmp->ispriest || mtmp->isminion ||
|
mtmp->isshk || mtmp->isgd || mtmp->ispriest || mtmp->isminion ||
|
||||||
is_covetous(mtmp->data) || is_human(mtmp->data) ||
|
is_covetous(mtmp->data) || is_human(mtmp->data) ||
|
||||||
(is_demon(mtmp->data) && !is_demon(youmonst.data)) ||
|
(is_demon(mtmp->data) && !is_demon(youmonst.data)) ||
|
||||||
(obj && dogfood(mtmp, obj) >= MANFOOD)) return (struct monst *)0;
|
(obj && dogfood(mtmp, obj) >= MANFOOD)) return FALSE;
|
||||||
|
|
||||||
if (mtmp->m_id == quest_status.leader_m_id)
|
if (mtmp->m_id == quest_status.leader_m_id)
|
||||||
return((struct monst *)0);
|
return FALSE;
|
||||||
|
|
||||||
/* make a new monster which has the pet extension */
|
/* add the pet extension */
|
||||||
mtmp2 = newmonst(sizeof(struct edog) + mtmp->mnamelth);
|
newedog(mtmp);
|
||||||
*mtmp2 = *mtmp;
|
initedog(mtmp);
|
||||||
mtmp2->mxlth = sizeof(struct edog);
|
|
||||||
if (mtmp->mnamelth) Strcpy(NAME(mtmp2), NAME(mtmp));
|
|
||||||
initedog(mtmp2);
|
|
||||||
replmon(mtmp, mtmp2);
|
|
||||||
/* `mtmp' is now obsolete */
|
|
||||||
|
|
||||||
if (obj) { /* thrown food */
|
if (obj) { /* thrown food */
|
||||||
/* defer eating until the edog extension has been set up */
|
/* defer eating until the edog extension has been set up */
|
||||||
place_object(obj, mtmp2->mx, mtmp2->my); /* put on floor */
|
place_object(obj, mtmp->mx, mtmp->my); /* put on floor */
|
||||||
/* devour the food (might grow into larger, genocided monster) */
|
/* devour the food (might grow into larger, genocided monster) */
|
||||||
if (dog_eat(mtmp2, obj, mtmp2->mx, mtmp2->my, TRUE) == 2)
|
if (dog_eat(mtmp, obj, mtmp->mx, mtmp->my, TRUE) == 2)
|
||||||
return mtmp2; /* oops, it died... */
|
return TRUE; /* oops, it died... */
|
||||||
/* `obj' is now obsolete */
|
/* `obj' is now obsolete */
|
||||||
}
|
}
|
||||||
|
|
||||||
newsym(mtmp2->mx, mtmp2->my);
|
newsym(mtmp->mx, mtmp->my);
|
||||||
if (attacktype(mtmp2->data, AT_WEAP)) {
|
if (attacktype(mtmp->data, AT_WEAP)) {
|
||||||
mtmp2->weapon_check = NEED_HTH_WEAPON;
|
mtmp->weapon_check = NEED_HTH_WEAPON;
|
||||||
(void) mon_wield_item(mtmp2);
|
(void) mon_wield_item(mtmp);
|
||||||
}
|
}
|
||||||
return(mtmp2);
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
|
|
||||||
#include "mfndpos.h"
|
#include "mfndpos.h"
|
||||||
#include "edog.h"
|
|
||||||
|
|
||||||
extern boolean notonhead;
|
extern boolean notonhead;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "eshk.h"
|
|
||||||
|
|
||||||
#define is_bigfoot(x) ((x) == &mons[PM_SASQUATCH])
|
#define is_bigfoot(x) ((x) == &mons[PM_SASQUATCH])
|
||||||
#define martial() (martial_bonus() || is_bigfoot(youmonst.data) || \
|
#define martial() (martial_bonus() || is_bigfoot(youmonst.data) || \
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
/* Contains code for 't' (throw) */
|
/* Contains code for 't' (throw) */
|
||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "edog.h"
|
|
||||||
|
|
||||||
STATIC_DCL int FDECL(throw_obj, (struct obj *,int));
|
STATIC_DCL int FDECL(throw_obj, (struct obj *,int));
|
||||||
STATIC_DCL void NDECL(autoquiver);
|
STATIC_DCL void NDECL(autoquiver);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "edog.h"
|
|
||||||
/* #define DEBUG */ /* uncomment to enable new eat code debugging */
|
/* #define DEBUG */ /* uncomment to enable new eat code debugging */
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#define NEED_VARARGS /* comment line for pre-compiled headers */
|
#define NEED_VARARGS /* comment line for pre-compiled headers */
|
||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "eshk.h"
|
|
||||||
#include "lev.h"
|
#include "lev.h"
|
||||||
#ifndef NO_SIGNAL
|
#ifndef NO_SIGNAL
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -205,7 +204,7 @@ register struct monst *mtmp;
|
|||||||
killer.format = KILLED_BY;
|
killer.format = KILLED_BY;
|
||||||
}
|
}
|
||||||
/* _the_ <invisible> <distorted> ghost of Dudley */
|
/* _the_ <invisible> <distorted> ghost of Dudley */
|
||||||
if (mtmp->data == &mons[PM_GHOST] && mtmp->mnamelth) {
|
if (mtmp->data == &mons[PM_GHOST] && has_name(mtmp)) {
|
||||||
Strcat(buf, "the ");
|
Strcat(buf, "the ");
|
||||||
killer.format = KILLED_BY;
|
killer.format = KILLED_BY;
|
||||||
}
|
}
|
||||||
@@ -216,7 +215,7 @@ register struct monst *mtmp;
|
|||||||
|
|
||||||
if(mtmp->data == &mons[PM_GHOST]) {
|
if(mtmp->data == &mons[PM_GHOST]) {
|
||||||
Strcat(buf, "ghost");
|
Strcat(buf, "ghost");
|
||||||
if (mtmp->mnamelth) Sprintf(eos(buf), " of %s", NAME(mtmp));
|
if (has_name(mtmp)) Sprintf(eos(buf), " of %s", MNAME(mtmp));
|
||||||
} else if(mtmp->isshk) {
|
} else if(mtmp->isshk) {
|
||||||
const char *shknm = shkname(mtmp),
|
const char *shknm = shkname(mtmp),
|
||||||
*honorific = shkname_is_pname(mtmp) ? "" :
|
*honorific = shkname_is_pname(mtmp) ? "" :
|
||||||
@@ -230,8 +229,8 @@ register struct monst *mtmp;
|
|||||||
Strcat(buf, m_monnam(mtmp));
|
Strcat(buf, m_monnam(mtmp));
|
||||||
} else {
|
} else {
|
||||||
Strcat(buf, mtmp->data->mname);
|
Strcat(buf, mtmp->data->mname);
|
||||||
if (mtmp->mnamelth)
|
if (has_name(mtmp))
|
||||||
Sprintf(eos(buf), " called %s", NAME(mtmp));
|
Sprintf(eos(buf), " called %s", MNAME(mtmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (multi) Strcat(buf, ", while helpless");
|
if (multi) Strcat(buf, ", while helpless");
|
||||||
|
|||||||
+25
-30
@@ -3,14 +3,13 @@
|
|||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "epri.h"
|
|
||||||
#include "emin.h"
|
|
||||||
#include "edog.h"
|
|
||||||
#ifdef REINCARNATION
|
#ifdef REINCARNATION
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
STATIC_VAR NEARDATA struct monst zeromonst;
|
STATIC_VAR NEARDATA struct monst zeromonst;
|
||||||
|
STATIC_VAR NEARDATA struct mextra zeromextra;
|
||||||
|
|
||||||
/* this assumes that a human quest leader or nemesis is an archetype
|
/* this assumes that a human quest leader or nemesis is an archetype
|
||||||
of the corresponding role; that isn't so for some roles (tourist
|
of the corresponding role; that isn't so for some roles (tourist
|
||||||
@@ -683,8 +682,9 @@ xchar x, y; /* clone's preferred location or 0 (near mon) */
|
|||||||
return (struct monst *)0;
|
return (struct monst *)0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m2 = newmonst(0);
|
m2 = newmonst();
|
||||||
*m2 = *mon; /* copy condition of old monster */
|
*m2 = *mon; /* copy condition of old monster */
|
||||||
|
m2->mextra = (struct mextra *)0;
|
||||||
m2->nmon = fmon;
|
m2->nmon = fmon;
|
||||||
fmon = m2;
|
fmon = m2;
|
||||||
m2->m_id = context.ident++;
|
m2->m_id = context.ident++;
|
||||||
@@ -714,16 +714,14 @@ xchar x, y; /* clone's preferred location or 0 (near mon) */
|
|||||||
if (mon->isshk) m2->isshk = FALSE;
|
if (mon->isshk) m2->isshk = FALSE;
|
||||||
if (mon->isgd) m2->isgd = FALSE;
|
if (mon->isgd) m2->isgd = FALSE;
|
||||||
if (mon->ispriest) m2->ispriest = FALSE;
|
if (mon->ispriest) m2->ispriest = FALSE;
|
||||||
m2->mxlth = 0;
|
|
||||||
place_monster(m2, m2->mx, m2->my);
|
place_monster(m2, m2->mx, m2->my);
|
||||||
if (emits_light(m2->data))
|
if (emits_light(m2->data))
|
||||||
new_light_source(m2->mx, m2->my, emits_light(m2->data),
|
new_light_source(m2->mx, m2->my, emits_light(m2->data),
|
||||||
LS_MONSTER, (genericptr_t)m2);
|
LS_MONSTER, (genericptr_t)m2);
|
||||||
if (m2->mnamelth) {
|
if (has_name(mon)) {
|
||||||
m2->mnamelth = 0; /* or it won't get allocated */
|
m2 = christen_monst(m2, MNAME(mon));
|
||||||
m2 = christen_monst(m2, NAME(mon));
|
|
||||||
} else if (mon->isshk) {
|
} else if (mon->isshk) {
|
||||||
m2 = christen_monst(m2, shkname(mon));
|
m2 = christen_monst(m2, shkname(mon));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* not all clones caused by player are tame or peaceful */
|
/* not all clones caused by player are tame or peaceful */
|
||||||
@@ -736,24 +734,17 @@ xchar x, y; /* clone's preferred location or 0 (near mon) */
|
|||||||
|
|
||||||
newsym(m2->mx,m2->my); /* display the new monster */
|
newsym(m2->mx,m2->my); /* display the new monster */
|
||||||
if (m2->mtame) {
|
if (m2->mtame) {
|
||||||
struct monst *m3;
|
|
||||||
|
|
||||||
if (mon->isminion) {
|
if (mon->isminion) {
|
||||||
m3 = newmonst(sizeof(struct epri) + mon->mnamelth);
|
newemin(m2);
|
||||||
*m3 = *m2;
|
if (EMIN(mon)) *(EMIN(m2)) = *(EMIN(mon));
|
||||||
m3->mxlth = sizeof(struct epri);
|
if (EPRI(mon)) *(EPRI(m2)) = *(EPRI(mon));
|
||||||
if (m2->mnamelth) Strcpy(NAME(m3), NAME(m2));
|
|
||||||
*(EPRI(m3)) = *(EPRI(mon));
|
|
||||||
replmon(m2, m3);
|
|
||||||
m2 = m3;
|
|
||||||
} else {
|
} else {
|
||||||
/* because m2 is a copy of mon it is tame but not init'ed.
|
/* because m2 is a copy of mon it is tame but not init'ed.
|
||||||
* however, tamedog will not re-tame a tame dog, so m2
|
* however, tamedog will not re-tame a tame dog, so m2
|
||||||
* must be made non-tame to get initialized properly.
|
* must be made non-tame to get initialized properly.
|
||||||
*/
|
*/
|
||||||
m2->mtame = 0;
|
m2->mtame = 0;
|
||||||
if ((m3 = tamedog(m2, (struct obj *)0)) != 0) {
|
if (tamedog(m2, (struct obj *)0)) {
|
||||||
m2 = m3;
|
|
||||||
*(EDOG(m2)) = *(EDOG(mon));
|
*(EDOG(m2)) = *(EDOG(mon));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -877,7 +868,7 @@ register int x, y;
|
|||||||
register int mmflags;
|
register int mmflags;
|
||||||
{
|
{
|
||||||
register struct monst *mtmp;
|
register struct monst *mtmp;
|
||||||
int mndx, mcham, ct, mitem, xlth;
|
int mndx, mcham, ct, mitem;
|
||||||
boolean anymon = (!ptr);
|
boolean anymon = (!ptr);
|
||||||
boolean byyou = (x == u.ux && y == u.uy);
|
boolean byyou = (x == u.ux && y == u.uy);
|
||||||
boolean allow_minvent = ((mmflags & NO_MINVENT) == 0);
|
boolean allow_minvent = ((mmflags & NO_MINVENT) == 0);
|
||||||
@@ -948,12 +939,15 @@ register int mmflags;
|
|||||||
mndx = monsndx(ptr);
|
mndx = monsndx(ptr);
|
||||||
}
|
}
|
||||||
(void) propagate(mndx, countbirth, FALSE);
|
(void) propagate(mndx, countbirth, FALSE);
|
||||||
xlth = ptr->pxlth;
|
mtmp = newmonst();
|
||||||
if (mmflags & MM_EDOG) xlth += sizeof(struct edog);
|
|
||||||
else if (mmflags & MM_EMIN) xlth += sizeof(struct emin);
|
|
||||||
mtmp = newmonst(xlth);
|
|
||||||
*mtmp = zeromonst; /* clear all entries in structure */
|
*mtmp = zeromonst; /* clear all entries in structure */
|
||||||
(void)memset((genericptr_t)mtmp->mextra, 0, xlth);
|
|
||||||
|
if (mmflags & MM_EGD) newegd(mtmp);
|
||||||
|
if (mmflags & MM_EPRI) newepri(mtmp);
|
||||||
|
if (mmflags & MM_ESHK) neweshk(mtmp);
|
||||||
|
if (mmflags & MM_EMIN) newemin(mtmp);
|
||||||
|
if (mmflags & MM_EDOG) newedog(mtmp);
|
||||||
|
|
||||||
mtmp->nmon = fmon;
|
mtmp->nmon = fmon;
|
||||||
fmon = mtmp;
|
fmon = mtmp;
|
||||||
mtmp->m_id = context.ident++;
|
mtmp->m_id = context.ident++;
|
||||||
@@ -962,7 +956,6 @@ register int mmflags;
|
|||||||
if (mtmp->data->msound == MS_LEADER &&
|
if (mtmp->data->msound == MS_LEADER &&
|
||||||
quest_info(MS_LEADER) == mndx)
|
quest_info(MS_LEADER) == mndx)
|
||||||
quest_status.leader_m_id = mtmp->m_id;
|
quest_status.leader_m_id = mtmp->m_id;
|
||||||
mtmp->mxlth = xlth;
|
|
||||||
mtmp->mnum = mndx;
|
mtmp->mnum = mndx;
|
||||||
|
|
||||||
/* set up level and hit points */
|
/* set up level and hit points */
|
||||||
@@ -1102,7 +1095,9 @@ register int mmflags;
|
|||||||
types; make sure their extended data is initialized to
|
types; make sure their extended data is initialized to
|
||||||
something sensible (caller can override these settings) */
|
something sensible (caller can override these settings) */
|
||||||
if (mndx == PM_ALIGNED_PRIEST || (mndx == PM_ANGEL && !rn2(3))) {
|
if (mndx == PM_ALIGNED_PRIEST || (mndx == PM_ANGEL && !rn2(3))) {
|
||||||
struct emin *eminp = EMIN(mtmp);
|
struct emin *eminp;
|
||||||
|
newemin(mtmp);
|
||||||
|
eminp = EMIN(mtmp);
|
||||||
|
|
||||||
mtmp->isminion = 1; /* make priest be a roamer */
|
mtmp->isminion = 1; /* make priest be a roamer */
|
||||||
eminp->min_align = rn2(3) - 1; /* no A_NONE */
|
eminp->min_align = rn2(3) - 1; /* no A_NONE */
|
||||||
@@ -1640,9 +1635,9 @@ struct monst *mtmp;
|
|||||||
|
|
||||||
if (mtmp->ispriest || mtmp->isminion) {
|
if (mtmp->ispriest || mtmp->isminion) {
|
||||||
/* some monsters have individual alignments; check them */
|
/* some monsters have individual alignments; check them */
|
||||||
if (mtmp->ispriest)
|
if (mtmp->ispriest && EPRI(mtmp))
|
||||||
mal = EPRI(mtmp)->shralign;
|
mal = EPRI(mtmp)->shralign;
|
||||||
else if (mtmp->isminion)
|
else if (mtmp->isminion && EMIN(mtmp))
|
||||||
mal = EMIN(mtmp)->min_align;
|
mal = EMIN(mtmp)->min_align;
|
||||||
/* unless alignment is none, set mal to -5,0,5 */
|
/* unless alignment is none, set mal to -5,0,5 */
|
||||||
/* (see align.h for valid aligntyp values) */
|
/* (see align.h for valid aligntyp values) */
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "artifact.h"
|
#include "artifact.h"
|
||||||
#include "edog.h"
|
|
||||||
|
|
||||||
extern boolean notonhead;
|
extern boolean notonhead;
|
||||||
|
|
||||||
|
|||||||
@@ -2560,7 +2560,6 @@ register struct attack *mattk;
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "edog.h"
|
|
||||||
struct monst *
|
struct monst *
|
||||||
cloneu()
|
cloneu()
|
||||||
{
|
{
|
||||||
|
|||||||
+37
-7
@@ -1,10 +1,30 @@
|
|||||||
/* SCCS Id: @(#)minion.c 3.5 2005/11/01 */
|
/* SCCS Id: @(#)minion.c 3.5 2006/01/03 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "emin.h"
|
|
||||||
#include "epri.h"
|
void
|
||||||
|
newemin(mtmp)
|
||||||
|
struct monst *mtmp;
|
||||||
|
{
|
||||||
|
if (!mtmp->mextra) mtmp->mextra = newmextra();
|
||||||
|
if (!EMIN(mtmp)) {
|
||||||
|
EMIN(mtmp) = (struct emin *)alloc(sizeof(struct emin));
|
||||||
|
(void) memset((genericptr_t) EMIN(mtmp), 0, sizeof(struct emin));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
free_emin(mtmp)
|
||||||
|
struct monst *mtmp;
|
||||||
|
{
|
||||||
|
if (mtmp->mextra && EMIN(mtmp)) {
|
||||||
|
free((genericptr_t) EMIN(mtmp));
|
||||||
|
EMIN(mtmp) = (struct emin *)0;
|
||||||
|
}
|
||||||
|
mtmp->isminion = 0;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
msummon(mon) /* mon summons a monster */
|
msummon(mon) /* mon summons a monster */
|
||||||
@@ -73,7 +93,7 @@ struct monst *mon;
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (cnt > 0) {
|
while (cnt > 0) {
|
||||||
mtmp = makemon(&mons[dtype], u.ux, u.uy, NO_MM_FLAGS);
|
mtmp = makemon(&mons[dtype], u.ux, u.uy, MM_EMIN);
|
||||||
if (mtmp) {
|
if (mtmp) {
|
||||||
result++;
|
result++;
|
||||||
/* an angel's alignment should match the summoner */
|
/* an angel's alignment should match the summoner */
|
||||||
@@ -117,9 +137,19 @@ boolean talk;
|
|||||||
}
|
}
|
||||||
if (mnum == NON_PM) {
|
if (mnum == NON_PM) {
|
||||||
mon = 0;
|
mon = 0;
|
||||||
} else if (mons[mnum].pxlth == 0 || mnum == PM_ANGEL) {
|
} else if (mnum == PM_ANGEL) {
|
||||||
mon = makemon(&mons[mnum], u.ux, u.uy,
|
mon = makemon(&mons[mnum], u.ux, u.uy, MM_EPRI|MM_EMIN);
|
||||||
(mnum == PM_ANGEL) ? NO_MM_FLAGS : MM_EMIN);
|
if (mon) {
|
||||||
|
mon->isminion = 1;
|
||||||
|
EMIN(mon)->min_align = alignment;
|
||||||
|
EMIN(mon)->renegade = FALSE;
|
||||||
|
EPRI(mon)->shralign = alignment;
|
||||||
|
}
|
||||||
|
} else if (mnum != PM_SHOPKEEPER && mnum != PM_GUARD &&
|
||||||
|
mnum != PM_ALIGNED_PRIEST && mnum != PM_HIGH_PRIEST) {
|
||||||
|
/* This was mons[mnum].pxlth == 0 but is this restriction
|
||||||
|
appropriate or necessary now that the structures are separate? */
|
||||||
|
mon = makemon(&mons[mnum], u.ux, u.uy, MM_EMIN);
|
||||||
if (mon) {
|
if (mon) {
|
||||||
mon->isminion = 1;
|
mon->isminion = 1;
|
||||||
EMIN(mon)->min_align = alignment;
|
EMIN(mon)->min_align = alignment;
|
||||||
|
|||||||
+6
-7
@@ -1070,11 +1070,13 @@ struct obj *obj;
|
|||||||
struct monst *mtmp;
|
struct monst *mtmp;
|
||||||
{
|
{
|
||||||
struct obj *otmp;
|
struct obj *otmp;
|
||||||
|
genericptr_t buffer;
|
||||||
int lth, namelth;
|
int lth, namelth;
|
||||||
|
|
||||||
lth = sizeof(struct monst) + mtmp->mxlth + mtmp->mnamelth;
|
|
||||||
namelth = obj->onamelth ? strlen(ONAME(obj)) + 1 : 0;
|
namelth = obj->onamelth ? strlen(ONAME(obj)) + 1 : 0;
|
||||||
otmp = realloc_obj(obj, lth, (genericptr_t) mtmp, namelth, ONAME(obj));
|
buffer = mon_to_buffer(mtmp, <h);
|
||||||
|
otmp = realloc_obj(obj, lth, buffer, namelth, ONAME(obj));
|
||||||
|
free(buffer);
|
||||||
if (otmp && otmp->oxlth) {
|
if (otmp && otmp->oxlth) {
|
||||||
struct monst *mtmp2 = (struct monst *)otmp->oextra;
|
struct monst *mtmp2 = (struct monst *)otmp->oextra;
|
||||||
if (mtmp->data) mtmp2->mnum = monsndx(mtmp->data);
|
if (mtmp->data) mtmp2->mnum = monsndx(mtmp->data);
|
||||||
@@ -1084,6 +1086,7 @@ struct monst *mtmp;
|
|||||||
mtmp2->nmon = (struct monst *)0;
|
mtmp2->nmon = (struct monst *)0;
|
||||||
mtmp2->data = (struct permonst *)0;
|
mtmp2->data = (struct permonst *)0;
|
||||||
mtmp2->minvent = (struct obj *)0;
|
mtmp2->minvent = (struct obj *)0;
|
||||||
|
/* mon_to_buffer() took care of x and mname */
|
||||||
#ifndef GOLDOBJ
|
#ifndef GOLDOBJ
|
||||||
/* not a pointer but is discarded along with minvent */
|
/* not a pointer but is discarded along with minvent */
|
||||||
mtmp2->mgold = 0L;
|
mtmp2->mgold = 0L;
|
||||||
@@ -1108,11 +1111,7 @@ boolean copyof;
|
|||||||
mtmp = (struct monst *)obj->oextra;
|
mtmp = (struct monst *)obj->oextra;
|
||||||
if (mtmp) {
|
if (mtmp) {
|
||||||
if (copyof) {
|
if (copyof) {
|
||||||
int lth = mtmp->mxlth + mtmp->mnamelth;
|
mnew = buffer_to_mon((genericptr_t)mtmp);
|
||||||
mnew = newmonst(lth);
|
|
||||||
lth += sizeof(struct monst);
|
|
||||||
(void) memcpy((genericptr_t)mnew,
|
|
||||||
(genericptr_t)mtmp, lth);
|
|
||||||
} else {
|
} else {
|
||||||
/* Never insert this returned pointer into mon chains! */
|
/* Never insert this returned pointer into mon chains! */
|
||||||
mnew = mtmp;
|
mnew = mtmp;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "mfndpos.h"
|
#include "mfndpos.h"
|
||||||
#include "edog.h"
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
STATIC_DCL boolean FDECL(restrap,(struct monst *));
|
STATIC_DCL boolean FDECL(restrap,(struct monst *));
|
||||||
@@ -19,6 +18,7 @@ STATIC_DCL long FDECL(mm_displacement, (struct monst *,struct monst *));
|
|||||||
#endif
|
#endif
|
||||||
STATIC_DCL int NDECL(pick_animal);
|
STATIC_DCL int NDECL(pick_animal);
|
||||||
STATIC_DCL void FDECL(kill_eggs, (struct obj *));
|
STATIC_DCL void FDECL(kill_eggs, (struct obj *));
|
||||||
|
STATIC_DCL void FDECL(dealloc_mextra, (struct mextra *));
|
||||||
|
|
||||||
#ifdef REINCARNATION
|
#ifdef REINCARNATION
|
||||||
#define LEVEL_SPECIFIC_NOCORPSE(mdat) \
|
#define LEVEL_SPECIFIC_NOCORPSE(mdat) \
|
||||||
@@ -232,19 +232,28 @@ unsigned corpseflags;
|
|||||||
num = d(2,6);
|
num = d(2,6);
|
||||||
while (num--)
|
while (num--)
|
||||||
obj = mksobj_at(IRON_CHAIN, x, y, TRUE, FALSE);
|
obj = mksobj_at(IRON_CHAIN, x, y, TRUE, FALSE);
|
||||||
mtmp->mnamelth = 0;
|
if (has_name(mtmp)) {
|
||||||
|
free((genericptr_t)MNAME(mtmp));
|
||||||
|
MNAME(mtmp) = (char *)0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PM_GLASS_GOLEM:
|
case PM_GLASS_GOLEM:
|
||||||
num = d(2,4); /* very low chance of creating all glass gems */
|
num = d(2,4); /* very low chance of creating all glass gems */
|
||||||
while (num--)
|
while (num--)
|
||||||
obj = mksobj_at((LAST_GEM + rnd(9)), x, y, TRUE, FALSE);
|
obj = mksobj_at((LAST_GEM + rnd(9)), x, y, TRUE, FALSE);
|
||||||
mtmp->mnamelth = 0;
|
if (has_name(mtmp)) {
|
||||||
|
free((genericptr_t)MNAME(mtmp));
|
||||||
|
MNAME(mtmp) = (char *)0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PM_CLAY_GOLEM:
|
case PM_CLAY_GOLEM:
|
||||||
obj = mksobj_at(ROCK, x, y, FALSE, FALSE);
|
obj = mksobj_at(ROCK, x, y, FALSE, FALSE);
|
||||||
obj->quan = (long)(rn2(20) + 50);
|
obj->quan = (long)(rn2(20) + 50);
|
||||||
obj->owt = weight(obj);
|
obj->owt = weight(obj);
|
||||||
mtmp->mnamelth = 0;
|
if (has_name(mtmp)) {
|
||||||
|
free((genericptr_t)MNAME(mtmp));
|
||||||
|
MNAME(mtmp) = (char *)0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PM_STONE_GOLEM:
|
case PM_STONE_GOLEM:
|
||||||
corpstatflags &= ~CORPSTAT_INIT;
|
corpstatflags &= ~CORPSTAT_INIT;
|
||||||
@@ -256,24 +265,36 @@ unsigned corpseflags;
|
|||||||
while(num--) {
|
while(num--) {
|
||||||
obj = mksobj_at(QUARTERSTAFF, x, y, TRUE, FALSE);
|
obj = mksobj_at(QUARTERSTAFF, x, y, TRUE, FALSE);
|
||||||
}
|
}
|
||||||
mtmp->mnamelth = 0;
|
if (has_name(mtmp)) {
|
||||||
|
free((genericptr_t)MNAME(mtmp));
|
||||||
|
MNAME(mtmp) = (char *)0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PM_LEATHER_GOLEM:
|
case PM_LEATHER_GOLEM:
|
||||||
num = d(2,4);
|
num = d(2,4);
|
||||||
while(num--)
|
while(num--)
|
||||||
obj = mksobj_at(LEATHER_ARMOR, x, y, TRUE, FALSE);
|
obj = mksobj_at(LEATHER_ARMOR, x, y, TRUE, FALSE);
|
||||||
mtmp->mnamelth = 0;
|
if (has_name(mtmp)) {
|
||||||
|
free((genericptr_t)MNAME(mtmp));
|
||||||
|
MNAME(mtmp) = (char *)0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PM_GOLD_GOLEM:
|
case PM_GOLD_GOLEM:
|
||||||
/* Good luck gives more coins */
|
/* Good luck gives more coins */
|
||||||
obj = mkgold((long)(200 - rnl(101)), x, y);
|
obj = mkgold((long)(200 - rnl(101)), x, y);
|
||||||
mtmp->mnamelth = 0;
|
if (has_name(mtmp)) {
|
||||||
|
free((genericptr_t)MNAME(mtmp));
|
||||||
|
MNAME(mtmp) = (char *)0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PM_PAPER_GOLEM:
|
case PM_PAPER_GOLEM:
|
||||||
num = rnd(4);
|
num = rnd(4);
|
||||||
while (num--)
|
while (num--)
|
||||||
obj = mksobj_at(SCR_BLANK_PAPER, x, y, TRUE, FALSE);
|
obj = mksobj_at(SCR_BLANK_PAPER, x, y, TRUE, FALSE);
|
||||||
mtmp->mnamelth = 0;
|
if (has_name(mtmp)) {
|
||||||
|
free((genericptr_t)MNAME(mtmp));
|
||||||
|
MNAME(mtmp) = (char *)0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default_1:
|
default_1:
|
||||||
default:
|
default:
|
||||||
@@ -298,8 +319,8 @@ unsigned corpseflags;
|
|||||||
prevent the same attack beam from hitting its corpse */
|
prevent the same attack beam from hitting its corpse */
|
||||||
if (context.bypasses) bypass_obj(obj);
|
if (context.bypasses) bypass_obj(obj);
|
||||||
|
|
||||||
if (mtmp->mnamelth)
|
if (has_name(mtmp))
|
||||||
obj = oname(obj, NAME(mtmp));
|
obj = oname(obj, MNAME(mtmp));
|
||||||
|
|
||||||
/* Avoid "It was hidden under a green mold corpse!"
|
/* Avoid "It was hidden under a green mold corpse!"
|
||||||
* during Blind combat. An unseen monster referred to as "it"
|
* during Blind combat. An unseen monster referred to as "it"
|
||||||
@@ -1347,6 +1368,29 @@ register struct monst *mon;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
dealloc_mextra(x)
|
||||||
|
struct mextra *x;
|
||||||
|
{
|
||||||
|
if (x) {
|
||||||
|
if (x->mname) free((genericptr_t)x->mname);
|
||||||
|
if (x->egd) free((genericptr_t)x->egd);
|
||||||
|
if (x->epri) free((genericptr_t)x->epri);
|
||||||
|
if (x->eshk) free((genericptr_t)x->eshk);
|
||||||
|
if (x->emin) free((genericptr_t)x->emin);
|
||||||
|
if (x->edog) free((genericptr_t)x->edog);
|
||||||
|
}
|
||||||
|
free((genericptr_t)x);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
dealloc_monst(mon)
|
||||||
|
struct monst *mon;
|
||||||
|
{
|
||||||
|
if (mon->mextra) dealloc_mextra(mon->mextra);
|
||||||
|
free((genericptr_t)mon);
|
||||||
|
}
|
||||||
|
|
||||||
/* remove effects of mtmp from other data structures */
|
/* remove effects of mtmp from other data structures */
|
||||||
STATIC_OVL void
|
STATIC_OVL void
|
||||||
m_detach(mtmp, mptr)
|
m_detach(mtmp, mptr)
|
||||||
@@ -1704,7 +1748,7 @@ register struct monst *mdef;
|
|||||||
so that saved monster traits won't retain any stale
|
so that saved monster traits won't retain any stale
|
||||||
item-conferred attributes */
|
item-conferred attributes */
|
||||||
otmp = mkcorpstat(STATUE, mdef, mdef->data, x, y, CORPSTAT_NONE);
|
otmp = mkcorpstat(STATUE, mdef, mdef->data, x, y, CORPSTAT_NONE);
|
||||||
if (mdef->mnamelth) otmp = oname(otmp, NAME(mdef));
|
if (has_name(mdef)) otmp = oname(otmp, MNAME(mdef));
|
||||||
while ((obj = oldminvent) != 0) {
|
while ((obj = oldminvent) != 0) {
|
||||||
oldminvent = obj->nobj;
|
oldminvent = obj->nobj;
|
||||||
(void) add_to_container(otmp, obj);
|
(void) add_to_container(otmp, obj);
|
||||||
@@ -1825,9 +1869,9 @@ int dest;
|
|||||||
You("%s %s!", verb,
|
You("%s %s!", verb,
|
||||||
!mtmp->mtame ? mon_nam(mtmp) :
|
!mtmp->mtame ? mon_nam(mtmp) :
|
||||||
x_monnam(mtmp,
|
x_monnam(mtmp,
|
||||||
mtmp->mnamelth ? ARTICLE_NONE : ARTICLE_THE,
|
(has_name(mtmp)) ? ARTICLE_NONE : ARTICLE_THE,
|
||||||
"poor",
|
"poor",
|
||||||
mtmp->mnamelth ? SUPPRESS_SADDLE : 0,
|
(has_name(mtmp)) ? SUPPRESS_SADDLE : 0,
|
||||||
FALSE));
|
FALSE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2485,17 +2529,16 @@ boolean msg; /* "The oldmon turns into a newmon!" */
|
|||||||
if(!rn2(10)) mtmp->female = !mtmp->female;
|
if(!rn2(10)) mtmp->female = !mtmp->female;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (In_endgame(&u.uz) && is_mplayer(olddata)) {
|
if (In_endgame(&u.uz) && is_mplayer(olddata) && has_name(mtmp)) {
|
||||||
/* mplayers start out as "Foo the Bar", but some of the
|
/* mplayers start out as "Foo the Bar", but some of the
|
||||||
* titles are inappropriate when polymorphed, particularly
|
* titles are inappropriate when polymorphed, particularly
|
||||||
* into the opposite sex. players don't use ranks when
|
* into the opposite sex. players don't use ranks when
|
||||||
* polymorphed, so dropping the rank for mplayers seems
|
* polymorphed, so dropping the rank for mplayers seems
|
||||||
* reasonable.
|
* reasonable.
|
||||||
*/
|
*/
|
||||||
char *p = index(NAME(mtmp), ' ');
|
char *p = index(MNAME(mtmp), ' ');
|
||||||
if (p) {
|
if (p) {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
mtmp->mnamelth = p - NAME(mtmp) + 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2579,8 +2622,8 @@ boolean msg; /* "The oldmon turns into a newmon!" */
|
|||||||
newsym(mtmp->mx,mtmp->my);
|
newsym(mtmp->mx,mtmp->my);
|
||||||
|
|
||||||
if (msg) {
|
if (msg) {
|
||||||
uchar save_mnamelth = mtmp->mnamelth;
|
char *save_mname = (has_name(mtmp)) ? MNAME(mtmp) : (char *)0;
|
||||||
mtmp->mnamelth = 0;
|
if (mtmp->mextra) MNAME(mtmp) = (char *)0;
|
||||||
Strcpy(newname,
|
Strcpy(newname,
|
||||||
(mdat == &mons[PM_GREEN_SLIME]) ? "slime" :
|
(mdat == &mons[PM_GREEN_SLIME]) ? "slime" :
|
||||||
x_monnam(mtmp, ARTICLE_A, (char *)0,SUPPRESS_SADDLE, FALSE));
|
x_monnam(mtmp, ARTICLE_A, (char *)0,SUPPRESS_SADDLE, FALSE));
|
||||||
@@ -2588,7 +2631,7 @@ boolean msg; /* "The oldmon turns into a newmon!" */
|
|||||||
(void) usmellmon(mdat);
|
(void) usmellmon(mdat);
|
||||||
else
|
else
|
||||||
pline("%s turns into %s!", oldname, newname);
|
pline("%s turns into %s!", oldname, newname);
|
||||||
mtmp->mnamelth = save_mnamelth;
|
if(mtmp->mextra) MNAME(mtmp) = save_mname;
|
||||||
}
|
}
|
||||||
|
|
||||||
possibly_unwield(mtmp, polyspot); /* might lose use of weapon */
|
possibly_unwield(mtmp, polyspot); /* might lose use of weapon */
|
||||||
|
|||||||
+397
-400
File diff suppressed because it is too large
Load Diff
+3
-2
@@ -50,8 +50,9 @@ dev_name()
|
|||||||
i = rn2(n);
|
i = rn2(n);
|
||||||
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
|
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
|
||||||
if(!is_mplayer(mtmp->data)) continue;
|
if(!is_mplayer(mtmp->data)) continue;
|
||||||
if(!strncmp(developers[i], NAME(mtmp),
|
if(!strncmp(developers[i],
|
||||||
strlen(developers[i]))) {
|
(has_name(mtmp)) ? MNAME(mtmp) : "",
|
||||||
|
strlen(developers[i]))) {
|
||||||
match = TRUE;
|
match = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "edog.h"
|
|
||||||
|
|
||||||
extern const int monstr[];
|
extern const int monstr[];
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -321,7 +321,7 @@ do_pit: chasm = maketrap(x,y,PIT);
|
|||||||
else {
|
else {
|
||||||
You("destroy %s!", mtmp->mtame ?
|
You("destroy %s!", mtmp->mtame ?
|
||||||
x_monnam(mtmp, ARTICLE_THE, "poor",
|
x_monnam(mtmp, ARTICLE_THE, "poor",
|
||||||
mtmp->mnamelth ? SUPPRESS_SADDLE : 0, FALSE):
|
(has_name(mtmp)) ? SUPPRESS_SADDLE : 0, FALSE):
|
||||||
mon_nam(mtmp));
|
mon_nam(mtmp));
|
||||||
}
|
}
|
||||||
xkilled(mtmp,0);
|
xkilled(mtmp,0);
|
||||||
|
|||||||
@@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
#define NEED_VARARGS /* Uses ... */ /* comment line for pre-compiled headers */
|
#define NEED_VARARGS /* Uses ... */ /* comment line for pre-compiled headers */
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#ifdef WIZARD
|
|
||||||
#include "edog.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static boolean no_repeat = FALSE;
|
static boolean no_repeat = FALSE;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "epri.h"
|
|
||||||
|
|
||||||
STATIC_PTR int NDECL(prayer_done);
|
STATIC_PTR int NDECL(prayer_done);
|
||||||
STATIC_DCL struct obj *NDECL(worst_cursed_item);
|
STATIC_DCL struct obj *NDECL(worst_cursed_item);
|
||||||
|
|||||||
+34
-9
@@ -1,12 +1,9 @@
|
|||||||
/* SCCS Id: @(#)priest.c 3.5 2005/11/02 */
|
/* SCCS Id: @(#)priest.c 3.5 2006/01/03 */
|
||||||
/* Copyright (c) Izchak Miller, Steve Linhart, 1989. */
|
/* Copyright (c) Izchak Miller, Steve Linhart, 1989. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "mfndpos.h"
|
#include "mfndpos.h"
|
||||||
#include "eshk.h"
|
|
||||||
#include "epri.h"
|
|
||||||
#include "emin.h"
|
|
||||||
|
|
||||||
/* this matches the categorizations shown by enlightenment */
|
/* this matches the categorizations shown by enlightenment */
|
||||||
#define ALGN_SINNED (-4) /* worse than strayed */
|
#define ALGN_SINNED (-4) /* worse than strayed */
|
||||||
@@ -14,6 +11,28 @@
|
|||||||
STATIC_DCL boolean FDECL(histemple_at,(struct monst *,XCHAR_P,XCHAR_P));
|
STATIC_DCL boolean FDECL(histemple_at,(struct monst *,XCHAR_P,XCHAR_P));
|
||||||
STATIC_DCL boolean FDECL(has_shrine,(struct monst *));
|
STATIC_DCL boolean FDECL(has_shrine,(struct monst *));
|
||||||
|
|
||||||
|
void
|
||||||
|
newepri(mtmp)
|
||||||
|
struct monst *mtmp;
|
||||||
|
{
|
||||||
|
if (!mtmp->mextra) mtmp->mextra = newmextra();
|
||||||
|
if (!EPRI(mtmp)) {
|
||||||
|
EPRI(mtmp) = (struct epri *)alloc(sizeof(struct epri));
|
||||||
|
(void) memset((genericptr_t) EPRI(mtmp), 0, sizeof(struct epri));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
free_epri(mtmp)
|
||||||
|
struct monst *mtmp;
|
||||||
|
{
|
||||||
|
if (mtmp->mextra && EPRI(mtmp)) {
|
||||||
|
free((genericptr_t) EPRI(mtmp));
|
||||||
|
EPRI(mtmp) = (struct epri *)0;
|
||||||
|
}
|
||||||
|
mtmp->ispriest = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Move for priests and shopkeepers. Called from shk_move() and pri_move().
|
* Move for priests and shopkeepers. Called from shk_move() and pri_move().
|
||||||
* Valid returns are 1: moved 0: didn't -1: let m_move do it -2: died.
|
* Valid returns are 1: moved 0: didn't -1: let m_move do it -2: died.
|
||||||
@@ -189,7 +208,7 @@ boolean sanctum; /* is it the seat of the high priest? */
|
|||||||
(void) rloc(m_at(sx+1, sy), FALSE); /* insurance */
|
(void) rloc(m_at(sx+1, sy), FALSE); /* insurance */
|
||||||
|
|
||||||
priest = makemon(&mons[sanctum ? PM_HIGH_PRIEST : PM_ALIGNED_PRIEST],
|
priest = makemon(&mons[sanctum ? PM_HIGH_PRIEST : PM_ALIGNED_PRIEST],
|
||||||
sx + 1, sy, NO_MM_FLAGS);
|
sx + 1, sy, MM_EPRI);
|
||||||
if (priest) {
|
if (priest) {
|
||||||
EPRI(priest)->shroom = (sroom - rooms) + ROOMOFFSET;
|
EPRI(priest)->shroom = (sroom - rooms) + ROOMOFFSET;
|
||||||
EPRI(priest)->shralign = Amask2align(levl[sx][sy].altarmask);
|
EPRI(priest)->shralign = Amask2align(levl[sx][sy].altarmask);
|
||||||
@@ -549,7 +568,7 @@ boolean peaceful;
|
|||||||
|
|
||||||
if (MON_AT(x, y)) (void) rloc(m_at(x, y), FALSE); /* insurance */
|
if (MON_AT(x, y)) (void) rloc(m_at(x, y), FALSE); /* insurance */
|
||||||
|
|
||||||
if (!(roamer = makemon(ptr, x, y, MM_ADJACENTOK)))
|
if (!(roamer = makemon(ptr, x, y, MM_ADJACENTOK|MM_EMIN)))
|
||||||
return((struct monst *)0);
|
return((struct monst *)0);
|
||||||
|
|
||||||
EMIN(roamer)->min_align = alignment;
|
EMIN(roamer)->min_align = alignment;
|
||||||
@@ -683,9 +702,15 @@ angry_priest()
|
|||||||
if (!IS_ALTAR(lev->typ) ||
|
if (!IS_ALTAR(lev->typ) ||
|
||||||
((aligntyp)Amask2align(lev->altarmask & AM_MASK) !=
|
((aligntyp)Amask2align(lev->altarmask & AM_MASK) !=
|
||||||
EPRI(priest)->shralign)) {
|
EPRI(priest)->shralign)) {
|
||||||
priest->ispriest = 0; /* now a roamer */
|
if (EPRI(priest)) {
|
||||||
priest->isminion = 1; /* but still aligned */
|
if (!EMIN(priest)) newemin(priest);
|
||||||
/* this overloads EPRI's shroom field, which is now clobbered */
|
priest->ispriest = 0; /* roamer */
|
||||||
|
/* but still aligned */
|
||||||
|
priest->isminion = 1;
|
||||||
|
EMIN(priest)->min_align = EPRI(priest)->shralign;
|
||||||
|
}
|
||||||
|
/* this used to overload EPRI's shroom field, which was then clobbered
|
||||||
|
* but not since adding the separate mextra structure */
|
||||||
EMIN(priest)->renegade = FALSE;
|
EMIN(priest)->renegade = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+130
-5
@@ -277,6 +277,80 @@ boolean ghostly, frozen;
|
|||||||
return(first);
|
return(first);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* used by get_mtraits() in mkobj.c
|
||||||
|
* to retrieve the bundled up OATTACHED_MONST info.
|
||||||
|
*/
|
||||||
|
struct monst *
|
||||||
|
buffer_to_mon(buffer)
|
||||||
|
genericptr_t buffer;
|
||||||
|
{
|
||||||
|
int lth;
|
||||||
|
struct monst *mtmp;
|
||||||
|
char *spot = (char *)buffer;
|
||||||
|
|
||||||
|
mtmp = newmonst();
|
||||||
|
(void) memcpy((genericptr_t)mtmp, (genericptr_t)spot, sizeof(struct monst));
|
||||||
|
spot += sizeof(struct monst);
|
||||||
|
|
||||||
|
/* obtain the stored length of the monster name */
|
||||||
|
(void) memcpy((genericptr_t)<h, (genericptr_t)spot, sizeof(int));
|
||||||
|
spot += sizeof(int);
|
||||||
|
if (lth) {
|
||||||
|
if (!mtmp->mextra) mtmp->mextra = newmextra();
|
||||||
|
MNAME(mtmp) = (char *)alloc(lth);
|
||||||
|
(void) memcpy((genericptr_t)MNAME(mtmp),
|
||||||
|
(genericptr_t)spot, lth);
|
||||||
|
spot += lth;
|
||||||
|
}
|
||||||
|
/* obtain the length of the egd (guard) structure */
|
||||||
|
(void) memcpy((genericptr_t)<h, (genericptr_t)spot, sizeof(int));
|
||||||
|
spot += sizeof(int);
|
||||||
|
if (lth) {
|
||||||
|
newegd(mtmp);
|
||||||
|
(void) memcpy((genericptr_t)EGD(mtmp),
|
||||||
|
(genericptr_t)spot, lth);
|
||||||
|
spot += lth;
|
||||||
|
}
|
||||||
|
/* obtain the length of the epri (priest) structure */
|
||||||
|
(void) memcpy((genericptr_t)<h, (genericptr_t)spot, sizeof(int));
|
||||||
|
spot += sizeof(int);
|
||||||
|
if (lth) {
|
||||||
|
newepri(mtmp);
|
||||||
|
(void) memcpy((genericptr_t)EPRI(mtmp),
|
||||||
|
(genericptr_t)spot, lth);
|
||||||
|
spot += lth;
|
||||||
|
}
|
||||||
|
/* obtain the length of the eshk (shopkeeper) structure */
|
||||||
|
(void) memcpy((genericptr_t)<h, (genericptr_t)spot, sizeof(int));
|
||||||
|
spot += sizeof(int);
|
||||||
|
if (lth) {
|
||||||
|
neweshk(mtmp);
|
||||||
|
(void) memcpy((genericptr_t)ESHK(mtmp),
|
||||||
|
(genericptr_t)spot, lth);
|
||||||
|
spot += lth;
|
||||||
|
}
|
||||||
|
/* obtain the length of the emin (minion) structure */
|
||||||
|
(void) memcpy((genericptr_t)<h, (genericptr_t)spot, sizeof(int));
|
||||||
|
spot += sizeof(int);
|
||||||
|
if (lth) {
|
||||||
|
newemin(mtmp);
|
||||||
|
(void) memcpy((genericptr_t)EMIN(mtmp),
|
||||||
|
(genericptr_t)spot, lth);
|
||||||
|
spot += lth;
|
||||||
|
}
|
||||||
|
/* obtain the length of the edog (mtame) structure */
|
||||||
|
(void) memcpy((genericptr_t)<h, (genericptr_t)spot, sizeof(int));
|
||||||
|
spot += sizeof(int);
|
||||||
|
if (lth) {
|
||||||
|
newedog(mtmp);
|
||||||
|
(void) memcpy((genericptr_t)EDOG(mtmp),
|
||||||
|
(genericptr_t)spot, lth);
|
||||||
|
spot += lth; /* actually not necessary */
|
||||||
|
}
|
||||||
|
return mtmp;
|
||||||
|
}
|
||||||
|
|
||||||
STATIC_OVL struct monst *
|
STATIC_OVL struct monst *
|
||||||
restmonchn(fd, ghostly)
|
restmonchn(fd, ghostly)
|
||||||
register int fd;
|
register int fd;
|
||||||
@@ -284,15 +358,66 @@ boolean ghostly;
|
|||||||
{
|
{
|
||||||
register struct monst *mtmp, *mtmp2 = 0;
|
register struct monst *mtmp, *mtmp2 = 0;
|
||||||
register struct monst *first = (struct monst *)0;
|
register struct monst *first = (struct monst *)0;
|
||||||
int xl, offset;
|
int offset, buflen;
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
mread(fd, (genericptr_t) &xl, sizeof(xl));
|
mread(fd, (genericptr_t) &buflen, sizeof(buflen));
|
||||||
if(xl == -1) break;
|
if(buflen == -1) break;
|
||||||
mtmp = newmonst(xl);
|
mtmp = newmonst();
|
||||||
|
mread(fd, (genericptr_t) mtmp, sizeof(struct monst));
|
||||||
|
/* any saved mextra pointer is invalid */
|
||||||
|
mtmp->mextra = (struct mextra *)0;
|
||||||
|
|
||||||
|
/* read the length of the name and the name */
|
||||||
|
mread(fd, (genericptr_t) &buflen, sizeof(buflen));
|
||||||
|
if (buflen > 0) {
|
||||||
|
if (!mtmp->mextra) mtmp->mextra = newmextra();
|
||||||
|
MNAME(mtmp) = (char *)alloc(buflen);
|
||||||
|
mread(fd, (genericptr_t) MNAME(mtmp), buflen);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* egd */
|
||||||
|
mread(fd, (genericptr_t) &buflen, sizeof(buflen));
|
||||||
|
if (buflen > 0) {
|
||||||
|
newegd(mtmp);
|
||||||
|
mread(fd, (genericptr_t) EGD(mtmp),
|
||||||
|
sizeof(struct egd));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* epri */
|
||||||
|
mread(fd, (genericptr_t) &buflen, sizeof(buflen));
|
||||||
|
if (buflen > 0) {
|
||||||
|
newepri(mtmp);
|
||||||
|
mread(fd, (genericptr_t) EPRI(mtmp),
|
||||||
|
sizeof(struct epri));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* eshk */
|
||||||
|
mread(fd, (genericptr_t) &buflen, sizeof(buflen));
|
||||||
|
if (buflen > 0) {
|
||||||
|
neweshk(mtmp);
|
||||||
|
mread(fd, (genericptr_t) ESHK(mtmp),
|
||||||
|
sizeof(struct eshk));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* emin */
|
||||||
|
mread(fd, (genericptr_t) &buflen, sizeof(buflen));
|
||||||
|
if (buflen > 0) {
|
||||||
|
newemin(mtmp);
|
||||||
|
mread(fd, (genericptr_t) EMIN(mtmp),
|
||||||
|
sizeof(struct emin));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* edog */
|
||||||
|
mread(fd, (genericptr_t) &buflen, sizeof(buflen));
|
||||||
|
if (buflen > 0) {
|
||||||
|
newedog(mtmp);
|
||||||
|
mread(fd, (genericptr_t) EDOG(mtmp),
|
||||||
|
sizeof(struct edog));
|
||||||
|
}
|
||||||
|
|
||||||
if(!first) first = mtmp;
|
if(!first) first = mtmp;
|
||||||
else mtmp2->nmon = mtmp;
|
else mtmp2->nmon = mtmp;
|
||||||
mread(fd, (genericptr_t) mtmp, (unsigned) xl + sizeof(struct monst));
|
|
||||||
if (ghostly) {
|
if (ghostly) {
|
||||||
unsigned nid = context.ident++;
|
unsigned nid = context.ident++;
|
||||||
add_id_mapping(mtmp->m_id, nid);
|
add_id_mapping(mtmp->m_id, nid);
|
||||||
|
|||||||
+132
-5
@@ -1004,21 +1004,97 @@ register struct obj *otmp;
|
|||||||
bwrite(fd, (genericptr_t) &minusone, sizeof(int));
|
bwrite(fd, (genericptr_t) &minusone, sizeof(int));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Used by save_mtraits() in mkobj.c to ensure
|
||||||
|
* that all the monst related information is stored in
|
||||||
|
* an OATTACHED_MONST structure.
|
||||||
|
*/
|
||||||
|
genericptr_t
|
||||||
|
mon_to_buffer(mtmp,isize)
|
||||||
|
struct monst *mtmp;
|
||||||
|
int *isize;
|
||||||
|
{
|
||||||
|
char *spot;
|
||||||
|
int lth, k, xlth[6];
|
||||||
|
genericptr_t buffer, xptr[6];
|
||||||
|
struct monst *mbuf;
|
||||||
|
|
||||||
|
lth = sizeof(struct monst);
|
||||||
|
|
||||||
|
/* there is always one sizeof(int) for the name
|
||||||
|
and one for each of the 5 potential mextra fields */
|
||||||
|
for (k = 0; k < 6; ++k) {
|
||||||
|
xlth[k] = 0;
|
||||||
|
xptr[k] = (genericptr_t)0;
|
||||||
|
}
|
||||||
|
if (mtmp->mextra) {
|
||||||
|
if (MNAME(mtmp)) {
|
||||||
|
xlth[0] = strlen(MNAME(mtmp)) + 1;
|
||||||
|
xptr[0] = (genericptr_t)MNAME(mtmp);
|
||||||
|
}
|
||||||
|
if (EGD(mtmp)) {
|
||||||
|
xlth[1] = sizeof(struct egd);
|
||||||
|
xptr[1] = (genericptr_t)EGD(mtmp);
|
||||||
|
}
|
||||||
|
if (EPRI(mtmp)) {
|
||||||
|
xlth[2] = sizeof(struct epri);
|
||||||
|
xptr[2] = (genericptr_t)EPRI(mtmp);
|
||||||
|
}
|
||||||
|
if (ESHK(mtmp)) {
|
||||||
|
xlth[3] = sizeof(struct eshk);
|
||||||
|
xptr[3] = (genericptr_t)ESHK(mtmp);
|
||||||
|
}
|
||||||
|
if (EMIN(mtmp)) {
|
||||||
|
xlth[4] = sizeof(struct emin);
|
||||||
|
xptr[4] = (genericptr_t)EMIN(mtmp);
|
||||||
|
}
|
||||||
|
if (EDOG(mtmp)) {
|
||||||
|
xlth[5] = sizeof(struct edog);
|
||||||
|
xptr[5] = (genericptr_t)EDOG(mtmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (k = 0; k < 6; ++k) {
|
||||||
|
lth += sizeof(int);
|
||||||
|
lth += xlth[k];
|
||||||
|
}
|
||||||
|
if (isize) *isize = lth;
|
||||||
|
|
||||||
|
buffer = alloc(lth);
|
||||||
|
|
||||||
|
spot = (char *)buffer;
|
||||||
|
(void) memcpy((genericptr_t)spot, (genericptr_t)mtmp,
|
||||||
|
sizeof(struct monst));
|
||||||
|
spot += sizeof(struct monst);
|
||||||
|
|
||||||
|
mbuf = (struct monst *)buffer;
|
||||||
|
mbuf->mextra = (struct mextra *)0;
|
||||||
|
|
||||||
|
for (k = 0; k < 6; ++k) {
|
||||||
|
lth = xlth[k];
|
||||||
|
(void) memcpy((genericptr_t)spot,
|
||||||
|
(genericptr_t)<h, sizeof(lth));
|
||||||
|
spot += sizeof(lth);
|
||||||
|
if (lth > 0 && xptr[k] != 0) {
|
||||||
|
(void) memcpy((genericptr_t)spot, xptr[k], lth);
|
||||||
|
spot += lth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (genericptr_t)buffer;
|
||||||
|
}
|
||||||
|
|
||||||
STATIC_OVL void
|
STATIC_OVL void
|
||||||
savemonchn(fd, mtmp, mode)
|
savemonchn(fd, mtmp, mode)
|
||||||
register int fd, mode;
|
register int fd, mode;
|
||||||
register struct monst *mtmp;
|
register struct monst *mtmp;
|
||||||
{
|
{
|
||||||
register struct monst *mtmp2;
|
register struct monst *mtmp2;
|
||||||
unsigned int xl;
|
int buflen, minusone = -1, zerobuf = 0;
|
||||||
int minusone = -1;
|
genericptr_t buffer = (genericptr_t)0;
|
||||||
|
|
||||||
while (mtmp) {
|
while (mtmp) {
|
||||||
mtmp2 = mtmp->nmon;
|
mtmp2 = mtmp->nmon;
|
||||||
if (perform_bwrite(mode)) {
|
if (perform_bwrite(mode)) {
|
||||||
mtmp->mnum = monsndx(mtmp->data);
|
mtmp->mnum = monsndx(mtmp->data);
|
||||||
xl = mtmp->mxlth + mtmp->mnamelth;
|
|
||||||
bwrite(fd, (genericptr_t) &xl, sizeof(int));
|
|
||||||
#ifndef GOLDOBJ
|
#ifndef GOLDOBJ
|
||||||
if (mtmp->mgold) {
|
if (mtmp->mgold) {
|
||||||
struct obj *goldobj = mksobj(GOLD_PIECE, FALSE, FALSE);
|
struct obj *goldobj = mksobj(GOLD_PIECE, FALSE, FALSE);
|
||||||
@@ -1030,7 +1106,58 @@ register struct monst *mtmp;
|
|||||||
mtmp->minvent = goldobj;
|
mtmp->minvent = goldobj;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
bwrite(fd, (genericptr_t) mtmp, xl + sizeof(struct monst));
|
buflen = sizeof(struct monst);
|
||||||
|
bwrite(fd, (genericptr_t) &buflen, sizeof(int));
|
||||||
|
#if 0
|
||||||
|
buffer = mon_to_buffer(mtmp, &buflen);
|
||||||
|
bwrite(fd, buffer, buflen);
|
||||||
|
#else
|
||||||
|
bwrite(fd, (genericptr_t) mtmp, buflen);
|
||||||
|
if (!mtmp->mextra) {
|
||||||
|
bwrite(fd, (genericptr_t) &zerobuf, sizeof(int));
|
||||||
|
bwrite(fd, (genericptr_t) &zerobuf, sizeof(int));
|
||||||
|
bwrite(fd, (genericptr_t) &zerobuf, sizeof(int));
|
||||||
|
bwrite(fd, (genericptr_t) &zerobuf, sizeof(int));
|
||||||
|
bwrite(fd, (genericptr_t) &zerobuf, sizeof(int));
|
||||||
|
bwrite(fd, (genericptr_t) &zerobuf, sizeof(int));
|
||||||
|
} else {
|
||||||
|
if (MNAME(mtmp)) buflen = strlen(MNAME(mtmp)) + 1;
|
||||||
|
else buflen = 0;
|
||||||
|
bwrite(fd, (genericptr_t) &buflen, sizeof(int));
|
||||||
|
if (buflen > 0)
|
||||||
|
bwrite(fd, (genericptr_t) MNAME(mtmp), buflen);
|
||||||
|
|
||||||
|
if (EGD(mtmp)) buflen = sizeof(struct egd);
|
||||||
|
else buflen = 0;
|
||||||
|
bwrite(fd, (genericptr_t) &buflen, sizeof(int));
|
||||||
|
if (buflen > 0)
|
||||||
|
bwrite(fd, (genericptr_t) EGD(mtmp), buflen);
|
||||||
|
|
||||||
|
if (EPRI(mtmp)) buflen = sizeof(struct epri);
|
||||||
|
else buflen = 0;
|
||||||
|
bwrite(fd, (genericptr_t) &buflen, sizeof(int));
|
||||||
|
if (buflen > 0)
|
||||||
|
bwrite(fd, (genericptr_t) EPRI(mtmp), buflen);
|
||||||
|
|
||||||
|
if (ESHK(mtmp)) buflen = sizeof(struct eshk);
|
||||||
|
else buflen = 0;
|
||||||
|
bwrite(fd, (genericptr_t) &buflen, sizeof(int));
|
||||||
|
if (buflen > 0)
|
||||||
|
bwrite(fd, (genericptr_t) ESHK(mtmp), buflen);
|
||||||
|
|
||||||
|
if (EMIN(mtmp)) buflen = sizeof(struct emin);
|
||||||
|
else buflen = 0;
|
||||||
|
bwrite(fd, (genericptr_t) &buflen, sizeof(int));
|
||||||
|
if (buflen > 0)
|
||||||
|
bwrite(fd, (genericptr_t) EMIN(mtmp), buflen);
|
||||||
|
|
||||||
|
if (EDOG(mtmp)) buflen = sizeof(struct edog);
|
||||||
|
else buflen = 0;
|
||||||
|
bwrite(fd, (genericptr_t) &buflen, sizeof(int));
|
||||||
|
if (buflen > 0)
|
||||||
|
bwrite(fd, (genericptr_t) EDOG(mtmp), buflen);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (mtmp->minvent)
|
if (mtmp->minvent)
|
||||||
saveobjchn(fd,mtmp->minvent,mode);
|
saveobjchn(fd,mtmp->minvent,mode);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "eshk.h"
|
|
||||||
|
|
||||||
/*#define DEBUG*/
|
/*#define DEBUG*/
|
||||||
|
|
||||||
|
|||||||
+24
-3
@@ -1,11 +1,10 @@
|
|||||||
/* SCCS Id: @(#)shknam.c 3.5 2005/12/14 */
|
/* SCCS Id: @(#)shknam.c 3.5 2006/01/03 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
/* shknam.c -- initialize a shop */
|
/* shknam.c -- initialize a shop */
|
||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "eshk.h"
|
|
||||||
|
|
||||||
STATIC_DCL boolean FDECL(veggy_item, (struct obj *obj,int));
|
STATIC_DCL boolean FDECL(veggy_item, (struct obj *obj,int));
|
||||||
STATIC_DCL int NDECL(shkveg);
|
STATIC_DCL int NDECL(shkveg);
|
||||||
@@ -450,6 +449,28 @@ const char * const *nlp;
|
|||||||
ESHK(shk)->shknam[PL_NSIZ-1] = 0;
|
ESHK(shk)->shknam[PL_NSIZ-1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
neweshk(mtmp)
|
||||||
|
struct monst *mtmp;
|
||||||
|
{
|
||||||
|
if (!mtmp->mextra) mtmp->mextra = newmextra();
|
||||||
|
if (!ESHK(mtmp)) {
|
||||||
|
ESHK(mtmp) = (struct eshk *)alloc(sizeof(struct eshk));
|
||||||
|
(void) memset((genericptr_t) ESHK(mtmp), 0, sizeof(struct eshk));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
free_eshk(mtmp)
|
||||||
|
struct monst *mtmp;
|
||||||
|
{
|
||||||
|
if (mtmp->mextra && ESHK(mtmp)) {
|
||||||
|
free((genericptr_t) ESHK(mtmp));
|
||||||
|
ESHK(mtmp) = (struct eshk *)0;
|
||||||
|
}
|
||||||
|
mtmp->isshk = 0;
|
||||||
|
}
|
||||||
|
|
||||||
STATIC_OVL int
|
STATIC_OVL int
|
||||||
shkinit(shp, sroom) /* create a new shopkeeper in the given room */
|
shkinit(shp, sroom) /* create a new shopkeeper in the given room */
|
||||||
const struct shclass *shp;
|
const struct shclass *shp;
|
||||||
@@ -507,7 +528,7 @@ struct mkroom *sroom;
|
|||||||
if(MON_AT(sx, sy)) (void) rloc(m_at(sx, sy), FALSE); /* insurance */
|
if(MON_AT(sx, sy)) (void) rloc(m_at(sx, sy), FALSE); /* insurance */
|
||||||
|
|
||||||
/* now initialize the shopkeeper monster structure */
|
/* now initialize the shopkeeper monster structure */
|
||||||
if(!(shk = makemon(&mons[PM_SHOPKEEPER], sx, sy, NO_MM_FLAGS)))
|
if(!(shk = makemon(&mons[PM_SHOPKEEPER], sx, sy, MM_ESHK)))
|
||||||
return(-1);
|
return(-1);
|
||||||
shk->isshk = shk->mpeaceful = 1;
|
shk->isshk = shk->mpeaceful = 1;
|
||||||
set_malign(shk);
|
set_malign(shk);
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "edog.h"
|
|
||||||
#ifdef USER_SOUNDS
|
#ifdef USER_SOUNDS
|
||||||
# ifdef USER_SOUNDS_REGEX
|
# ifdef USER_SOUNDS_REGEX
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|||||||
+1
-1
@@ -512,7 +512,7 @@ dismount_steed(reason)
|
|||||||
You("can't. There isn't anywhere for you to stand.");
|
You("can't. There isn't anywhere for you to stand.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!mtmp->mnamelth) {
|
if (!has_name(mtmp)) {
|
||||||
pline("You've been through the dungeon on %s with no name.",
|
pline("You've been through the dungeon on %s with no name.",
|
||||||
an(mtmp->data->mname));
|
an(mtmp->data->mname));
|
||||||
if (Hallucination)
|
if (Hallucination)
|
||||||
|
|||||||
+3
-4
@@ -470,10 +470,9 @@ long timeout;
|
|||||||
while it's in your inventory */
|
while it's in your inventory */
|
||||||
if ((yours && !silent) ||
|
if ((yours && !silent) ||
|
||||||
(carried(egg) && mon->data->mlet == S_DRAGON)) {
|
(carried(egg) && mon->data->mlet == S_DRAGON)) {
|
||||||
if ((mon2 = tamedog(mon, (struct obj *)0)) != 0) {
|
if (tamedog(mon, (struct obj *)0)) {
|
||||||
mon = mon2;
|
|
||||||
if (carried(egg) && mon->data->mlet != S_DRAGON)
|
if (carried(egg) && mon->data->mlet != S_DRAGON)
|
||||||
mon->mtame = 20;
|
mon->mtame = 20;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mvitals[mnum].mvflags & G_EXTINCT)
|
if (mvitals[mnum].mvflags & G_EXTINCT)
|
||||||
@@ -680,7 +679,7 @@ slip_or_trip()
|
|||||||
pline("%s %s%s on the ice.",
|
pline("%s %s%s on the ice.",
|
||||||
#ifdef STEED
|
#ifdef STEED
|
||||||
u.usteed ? upstart(x_monnam(u.usteed,
|
u.usteed ? upstart(x_monnam(u.usteed,
|
||||||
u.usteed->mnamelth ? ARTICLE_NONE : ARTICLE_THE,
|
(has_name(u.usteed)) ? ARTICLE_NONE : ARTICLE_THE,
|
||||||
(char *)0, SUPPRESS_SADDLE, FALSE)) :
|
(char *)0, SUPPRESS_SADDLE, FALSE)) :
|
||||||
#endif
|
#endif
|
||||||
"You", rn2(2) ? "slip" : "slide", on_foot ? "" : "s");
|
"You", rn2(2) ? "slip" : "slide", on_foot ? "" : "s");
|
||||||
|
|||||||
+1
-1
@@ -675,7 +675,7 @@ unsigned trflags;
|
|||||||
u.usteed->mtrapseen |= (1 << (ttype - 1));
|
u.usteed->mtrapseen |= (1 << (ttype - 1));
|
||||||
/* suppress article in various steed messages when using its
|
/* suppress article in various steed messages when using its
|
||||||
name (which won't occur when hallucinating) */
|
name (which won't occur when hallucinating) */
|
||||||
if (u.usteed->mnamelth && !Hallucination)
|
if (has_name(u.usteed) && !Hallucination)
|
||||||
steed_article = ARTICLE_NONE;
|
steed_article = ARTICLE_NONE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+24
-3
@@ -1,9 +1,8 @@
|
|||||||
/* SCCS Id: @(#)vault.c 3.5 2005/10/28 */
|
/* SCCS Id: @(#)vault.c 3.5 2006/01/03 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "vault.h"
|
|
||||||
|
|
||||||
STATIC_DCL struct monst *NDECL(findgd);
|
STATIC_DCL struct monst *NDECL(findgd);
|
||||||
|
|
||||||
@@ -16,6 +15,28 @@ STATIC_DCL boolean FDECL(in_fcorridor, (struct monst *,int,int));
|
|||||||
STATIC_DCL void FDECL(move_gold,(struct obj *,int));
|
STATIC_DCL void FDECL(move_gold,(struct obj *,int));
|
||||||
STATIC_DCL void FDECL(wallify_vault,(struct monst *));
|
STATIC_DCL void FDECL(wallify_vault,(struct monst *));
|
||||||
|
|
||||||
|
void
|
||||||
|
newegd(mtmp)
|
||||||
|
struct monst *mtmp;
|
||||||
|
{
|
||||||
|
if (!mtmp->mextra) mtmp->mextra = newmextra();
|
||||||
|
if (!EGD(mtmp)) {
|
||||||
|
EGD(mtmp) = (struct egd *)alloc(sizeof(struct egd));
|
||||||
|
(void) memset((genericptr_t) EGD(mtmp), 0, sizeof(struct egd));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
free_egd(mtmp)
|
||||||
|
struct monst *mtmp;
|
||||||
|
{
|
||||||
|
if (mtmp->mextra && EGD(mtmp)) {
|
||||||
|
free((genericptr_t) EGD(mtmp));
|
||||||
|
EGD(mtmp) = (struct egd *)0;
|
||||||
|
}
|
||||||
|
mtmp->isgd = 0;
|
||||||
|
}
|
||||||
|
|
||||||
STATIC_OVL boolean
|
STATIC_OVL boolean
|
||||||
clear_fcorr(grd, forceshow)
|
clear_fcorr(grd, forceshow)
|
||||||
struct monst *grd;
|
struct monst *grd;
|
||||||
@@ -222,7 +243,7 @@ fnd:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* make something interesting happen */
|
/* make something interesting happen */
|
||||||
if(!(guard = makemon(&mons[PM_GUARD], x, y, NO_MM_FLAGS))) return;
|
if(!(guard = makemon(&mons[PM_GUARD], x, y, MM_EGD))) return;
|
||||||
guard->isgd = 1;
|
guard->isgd = 1;
|
||||||
guard->mpeaceful = 1;
|
guard->mpeaceful = 1;
|
||||||
set_malign(guard);
|
set_malign(guard);
|
||||||
|
|||||||
@@ -685,7 +685,7 @@ boolean by_hero;
|
|||||||
/* handle recorporealization of an active ghost */
|
/* handle recorporealization of an active ghost */
|
||||||
if (corpse->oxlth && corpse->oattached == OATTACHED_M_ID) {
|
if (corpse->oxlth && corpse->oattached == OATTACHED_M_ID) {
|
||||||
unsigned m_id;
|
unsigned m_id;
|
||||||
struct monst *ghost, *mtmp2;
|
struct monst *ghost;
|
||||||
struct obj *otmp;
|
struct obj *otmp;
|
||||||
|
|
||||||
(void) memcpy((genericptr_t)&m_id,
|
(void) memcpy((genericptr_t)&m_id,
|
||||||
@@ -702,11 +702,9 @@ boolean by_hero;
|
|||||||
}
|
}
|
||||||
/* tame the revived monster if its ghost was tame */
|
/* tame the revived monster if its ghost was tame */
|
||||||
if (ghost->mtame && !mtmp->mtame) {
|
if (ghost->mtame && !mtmp->mtame) {
|
||||||
mtmp2 = tamedog(mtmp, (struct obj *)0);
|
if (tamedog(mtmp, (struct obj *)0)) {
|
||||||
if (mtmp2) {
|
|
||||||
/* ghost's edog data is ignored */
|
/* ghost's edog data is ignored */
|
||||||
mtmp2->mtame = ghost->mtame;
|
mtmp->mtame = ghost->mtame;
|
||||||
mtmp = mtmp2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* was ghost, now alive, it's all very confusing */
|
/* was ghost, now alive, it's all very confusing */
|
||||||
|
|||||||
Reference in New Issue
Block a user