cham changes (trunk only)

This is a foundation patch for patches to follow.
- use a full short index for mon->cham field.
- The current system of providing CHAM_XXX values
  was limited to the 3 bits allocated in the bitfield and invalidated
  save/bones if the field was expanded.
- The current system didn't provide an easy backwards  change
  if multiple monster types wanted to use the bit, there was a one
  to one mapping:  For instance, if you wanted a CHAM_VAMPIRE,
  and you wanted vampires, vampire lords, and Vlad to use it, you
  would have to have CHAM_VAMPIRE, CHAM_VAMPIRE_LORD,
  and CHAM_VLAD defined to achieve that with the one-to-one backward
  mapping.
- This new way just uses the mon[] index in the mon->cham field and
  eliminates the need for CHAM_XXX  (CHAM_ORDINARY is still used).
- no longer requires the cham_to_pm mappings
This commit is contained in:
nethack.allison
2004-06-15 11:38:32 +00:00
parent 87507aed42
commit c8ef9338f0
22 changed files with 98 additions and 83 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)extern.h 3.4 2003/03/14 */
/* SCCS Id: @(#)extern.h 3.4 2004/06/12 */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1187,6 +1187,7 @@ E void NDECL(restartcham);
E void FDECL(restore_cham, (struct monst *));
E boolean FDECL(hideunder, (struct monst*));
E void FDECL(mon_animal_list, (BOOLEAN_P));
E int FDECL(select_newcham_form, (struct monst *));
E int FDECL(newcham, (struct monst *,struct permonst *,BOOLEAN_P,BOOLEAN_P));
E int FDECL(can_be_hatched, (int));
E int FDECL(egg_type_from_parent, (int,BOOLEAN_P));
@@ -1580,7 +1581,7 @@ E void NDECL(self_invis_message);
E void NDECL(set_uasmon);
E void NDECL(change_sex);
E void FDECL(polyself, (BOOLEAN_P));
E void FDECL(polyself, (int));
E int FDECL(polymon, (int));
E void NDECL(rehumanize);
E int NDECL(dobreathe);

View File

@@ -75,6 +75,7 @@
#define herbivorous(ptr) (((ptr)->mflags1 & M1_HERBIVORE) != 0L)
#define metallivorous(ptr) (((ptr)->mflags1 & M1_METALLIVORE) != 0L)
#define polyok(ptr) (((ptr)->mflags2 & M2_NOPOLY) == 0L)
#define is_shapeshifter(ptr) (((ptr)->mflags2 & M2_SHAPESHIFTER) != 0L)
#define is_undead(ptr) (((ptr)->mflags2 & M2_UNDEAD) != 0L)
#define is_were(ptr) (((ptr)->mflags2 & M2_WERE) != 0L)
#define is_elf(ptr) (((ptr)->mflags2 & M2_ELF) != 0L)

View File

@@ -123,6 +123,7 @@
#define M2_PRINCE 0x00000800L /* is an overlord to its kind */
#define M2_MINION 0x00001000L /* is a minion of a deity */
#define M2_GIANT 0x00002000L /* is a giant */
#define M2_SHAPESHIFTER 0x00004000L /* is a shapeshifting species */
#define M2_MALE 0x00010000L /* always male */
#define M2_FEMALE 0x00020000L /* always female */
#define M2_NEUTER 0x00040000L /* neither male nor female */

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)monst.h 3.4 1999/01/04 */
/* SCCS Id: @(#)monst.h 3.4 2004/06/12 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -42,6 +42,8 @@ struct monst {
struct permonst *data;
unsigned m_id;
short mnum; /* permanent monster index number */
short cham; /* if shapeshifter, orig mons[] idx goes here */
#define CHAM_ORDINARY 0 /* not a shapechanger */
short movement; /* movement points (derived from permonst definition and added effects */
uchar m_lev; /* adjusted difficulty level of monster */
aligntyp malign; /* alignment of this monster, relative to the
@@ -67,48 +69,43 @@ struct monst {
Bitfield(minvis,1); /* currently invisible */
Bitfield(invis_blkd,1); /* invisibility blocked */
Bitfield(perminvis,1); /* intrinsic minvis value */
Bitfield(cham,3); /* shape-changer */
/* note: lychanthropes are handled elsewhere */
#define CHAM_ORDINARY 0 /* not a shapechanger */
#define CHAM_CHAMELEON 1 /* animal */
#define CHAM_DOPPELGANGER 2 /* demi-human */
#define CHAM_SANDESTIN 3 /* demon */
#define CHAM_MAX_INDX CHAM_SANDESTIN
Bitfield(mcan,1); /* has been cancelled */
Bitfield(mburied,1); /* has been buried */
Bitfield(mundetected,1); /* not seen in present hiding place */
/* implies one of M1_CONCEAL or M1_HIDE,
* but not mimic (that is, snake, spider,
* trapper, piercer, eel)
*/
Bitfield(mcan,1); /* has been cancelled */
Bitfield(mburied,1); /* has been buried */
Bitfield(mspeed,2); /* current speed */
Bitfield(permspeed,2); /* intrinsic mspeed value */
Bitfield(mrevived,1); /* has been revived from the dead */
Bitfield(mavenge,1); /* did something to deserve retaliation */
Bitfield(mflee,1); /* fleeing */
Bitfield(mfleetim,7); /* timeout for mflee */
Bitfield(mcansee,1); /* cansee 1, temp.blinded 0, blind 0 */
Bitfield(mblinded,7); /* cansee 0, temp.blinded n, blind 0 */
Bitfield(mcanmove,1); /* paralysis, similar to mblinded */
Bitfield(mfrozen,7);
Bitfield(mfleetim,7); /* timeout for mflee */
Bitfield(msleeping,1); /* asleep until woken */
Bitfield(mblinded,7); /* cansee 0, temp.blinded n, blind 0 */
Bitfield(mstun,1); /* stunned (off balance) */
Bitfield(mfrozen,7);
Bitfield(mcanmove,1); /* paralysis, similar to mblinded */
Bitfield(mconf,1); /* confused */
Bitfield(mpeaceful,1); /* does not attack unprovoked */
Bitfield(mtrapped,1); /* trapped in a pit, web or bear trap */
Bitfield(mleashed,1); /* monster is on a leash */
Bitfield(isshk,1); /* is shopkeeper */
Bitfield(isminion,1); /* is a minion */
Bitfield(isgd,1); /* is guard */
Bitfield(ispriest,1); /* is a priest */
Bitfield(iswiz,1); /* is the Wizard of Yendor */
Bitfield(wormno,5); /* at most 31 worms on any level */
/* 2 free bits */
#define MAX_NUM_WORMS 32 /* should be 2^(wormno bitfield size) */
long mstrategy; /* for monsters with mflag3: current strategy */

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)patchlevel.h 3.4 2004/05/24 */
/* SCCS Id: @(#)patchlevel.h 3.4 2004/06/12 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -13,7 +13,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
#define EDITLEVEL 12
#define EDITLEVEL 14
#define COPYRIGHT_BANNER_A \
"NetHack, Copyright 1985-2004"