From 1a886241ae4620426f44517b23bdea8afa925615 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 14 Mar 2016 15:39:18 -0700 Subject: [PATCH] monst.h formatting Clean up the formatting in monst.h. Provoked by the M_AP_NOTHING absurdity. --- include/monst.h | 141 ++++++++++++++++++++++++------------------------ 1 file changed, 70 insertions(+), 71 deletions(-) diff --git a/include/monst.h b/include/monst.h index 7196026f9..171b840a2 100644 --- a/include/monst.h +++ b/include/monst.h @@ -1,10 +1,14 @@ -/* NetHack 3.6 monst.h $NHDT-Date: 1432512777 2015/05/25 00:12:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.20 $ */ +/* NetHack 3.6 monst.h $NHDT-Date: 1457995142 2016/03/14 22:39:02 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.23 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ #ifndef MONST_H #define MONST_H +#ifndef MEXTRA_H +#include "mextra.h" +#endif + /* The weapon_check flag is used two ways: * 1) When calling mon_wield_item, is 2-6 depending on what is desired. * 2) Between calls to mon_wield_item, is 0 or 1 depending on whether or not @@ -15,13 +19,13 @@ * that there are enough situations which might make a monster change its * weapon that this is impractical. --KAA */ -#define NO_WEAPON_WANTED 0 -#define NEED_WEAPON 1 +#define NO_WEAPON_WANTED 0 +#define NEED_WEAPON 1 #define NEED_RANGED_WEAPON 2 -#define NEED_HTH_WEAPON 3 -#define NEED_PICK_AXE 4 -#define NEED_AXE 5 -#define NEED_PICK_OR_AXE 6 +#define NEED_HTH_WEAPON 3 +#define NEED_PICK_AXE 4 +#define NEED_AXE 5 +#define NEED_PICK_OR_AXE 6 /* The following flags are used for the second argument to display_minventory * in invent.c: @@ -31,36 +35,30 @@ * just display wielded weapons and worn items. */ #define MINV_NOLET 0x01 -#define MINV_ALL 0x02 - -#ifndef MEXTRA_H -#include "mextra.h" -#endif +#define MINV_ALL 0x02 struct monst { struct monst *nmon; struct permonst *data; unsigned m_id; - short mnum; /* permanent monster index number */ - short cham; /* if shapeshifter, orig mons[] idx goes here */ - 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 - player (positive = good to kill) */ + short mnum; /* permanent monster index number */ + short cham; /* if shapeshifter, orig mons[] idx goes here */ + 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 + player (positive = good to kill) */ xchar mx, my; - xchar mux, muy; /* where the monster thinks you are */ + xchar mux, muy; /* where the monster thinks you are */ #define MTSZ 4 - coord mtrack[MTSZ]; /* monster track */ + coord mtrack[MTSZ]; /* monster track */ int mhp, mhpmax; unsigned mappearance; /* for undetected mimics and the wiz */ uchar m_ap_type; /* what mappearance is describing: */ -#define M_AP_NOTHING \ - 0 /* mappearance is unused -- monster appears \ - as itself */ -#define M_AP_FURNITURE 1 /* stairs, a door, an altar, etc. */ -#define M_AP_OBJECT 2 /* an object */ -#define M_AP_MONSTER 3 /* a monster */ +#define M_AP_NOTHING 0 /* mappearance unused--monster appears as itself */ +#define M_AP_FURNITURE 1 /* stairs, a door, an altar, etc. */ +#define M_AP_OBJECT 2 /* an object */ +#define M_AP_MONSTER 3 /* a monster */ schar mtame; /* level of tameness, implies peaceful */ unsigned short mintrinsics; /* low 8 correspond to mresists */ @@ -72,12 +70,12 @@ struct monst { Bitfield(perminvis, 1); /* intrinsic minvis value */ 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, + 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(mcansee, 1); /* cansee 1, temp.blinded 0, blind 0 */ + Bitfield(mcansee, 1); /* cansee 1, temp.blinded 0, blind 0 */ Bitfield(mspeed, 2); /* current speed */ Bitfield(permspeed, 2); /* intrinsic mspeed value */ @@ -89,11 +87,11 @@ struct monst { 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(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(mcanmove, 1); /* paralysis, similar to mblinded */ Bitfield(mconf, 1); /* confused */ Bitfield(mpeaceful, 1); /* does not attack unprovoked */ @@ -102,13 +100,13 @@ struct monst { Bitfield(isshk, 1); /* is shopkeeper */ Bitfield(isminion, 1); /* is a minion */ Bitfield(isgd, 1); /* is guard */ - Bitfield(ispriest, 1); /* is a priest */ + Bitfield(ispriest, 1); /* is an aligned priest or high priest */ - Bitfield(iswiz, 1); /* is the Wizard of Yendor */ - Bitfield(wormno, 5); /* at most 31 worms on any level */ -/* 2 free bits */ + 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) */ +#define MAX_NUM_WORMS 32 /* should be 2^(wormno bitfield size) */ unsigned long mstrategy; /* for monsters with mflag3: current strategy */ #ifdef NHSTDC @@ -116,39 +114,39 @@ struct monst { #else #define STRAT_APPEARMSG 0x80000000L #endif -#define STRAT_ARRIVE 0x40000000L /* just arrived on current level */ -#define STRAT_WAITFORU 0x20000000L -#define STRAT_CLOSE 0x10000000L -#define STRAT_WAITMASK (STRAT_CLOSE | STRAT_WAITFORU) -#define STRAT_HEAL 0x08000000L -#define STRAT_GROUND 0x04000000L -#define STRAT_MONSTR 0x02000000L -#define STRAT_PLAYER 0x01000000L -#define STRAT_NONE 0x00000000L +#define STRAT_ARRIVE 0x40000000L /* just arrived on current level */ +#define STRAT_WAITFORU 0x20000000L +#define STRAT_CLOSE 0x10000000L +#define STRAT_WAITMASK (STRAT_CLOSE | STRAT_WAITFORU) +#define STRAT_HEAL 0x08000000L +#define STRAT_GROUND 0x04000000L +#define STRAT_MONSTR 0x02000000L +#define STRAT_PLAYER 0x01000000L +#define STRAT_NONE 0x00000000L #define STRAT_STRATMASK 0x0f000000L -#define STRAT_XMASK 0x00ff0000L -#define STRAT_YMASK 0x0000ff00L -#define STRAT_GOAL 0x000000ffL -#define STRAT_GOALX(s) ((xchar)((s & STRAT_XMASK) >> 16)) -#define STRAT_GOALY(s) ((xchar)((s & STRAT_YMASK) >> 8)) - - long mtrapseen; /* bitmap of traps we've been trapped in */ - long mlstmv; /* for catching up with lost time */ +#define STRAT_XMASK 0x00ff0000L +#define STRAT_YMASK 0x0000ff00L +#define STRAT_GOAL 0x000000ffL +#define STRAT_GOALX(s) ((xchar) ((s & STRAT_XMASK) >> 16)) +#define STRAT_GOALY(s) ((xchar) ((s & STRAT_YMASK) >> 8)) + + long mtrapseen; /* bitmap of traps we've been trapped in */ + long mlstmv; /* for catching up with lost time */ long mspare1; - struct obj *minvent; + struct obj *minvent; /* mon's inventory */ - struct obj *mw; - long misc_worn_check; - xchar weapon_check; + struct obj *mw; /* mon's weapon */ + long misc_worn_check; /* mon's wornmask */ + xchar weapon_check; /* flag for whether to try switching weapons */ int meating; /* monster is eating timeout */ struct mextra *mextra; /* point to mextra struct */ }; -#define newmonst() (struct monst *) alloc(sizeof(struct monst)) +#define newmonst() (struct monst *) alloc(sizeof (struct monst)) /* these are in mspeed */ -#define MSLOW 1 /* slow monster */ +#define MSLOW 1 /* slowed monster */ #define MFAST 2 /* speeded monster */ #define MON_WEP(mon) ((mon)->mw) @@ -161,16 +159,17 @@ struct monst { || (mon)->cham == PM_VLAD_THE_IMPALER) /* mimic appearances that block vision/light */ -#define is_lightblocker_mappear(mon) \ - (is_obj_mappear(mon, BOULDER) || \ - ((mon)->m_ap_type == M_AP_FURNITURE \ - && ((mon)->mappearance == S_hcdoor \ - || (mon)->mappearance == S_vcdoor \ - || (mon)->mappearance < S_ndoor /* = walls */ \ - || (mon)->mappearance == S_tree))) - +#define is_lightblocker_mappear(mon) \ + (is_obj_mappear(mon, BOULDER) \ + || ((mon)->m_ap_type == M_AP_FURNITURE \ + && ((mon)->mappearance == S_hcdoor \ + || (mon)->mappearance == S_vcdoor \ + || (mon)->mappearance < S_ndoor /* = walls */ \ + || (mon)->mappearance == S_tree))) #define is_door_mappear(mon) ((mon)->m_ap_type == M_AP_FURNITURE \ - && ((mon)->mappearance == S_hcdoor || (mon)->mappearance == S_vcdoor)) + && ((mon)->mappearance == S_hcdoor \ + || (mon)->mappearance == S_vcdoor)) #define is_obj_mappear(mon,otyp) ((mon)->m_ap_type == M_AP_OBJECT \ - && (mon)->mappearance == (otyp)) + && (mon)->mappearance == (otyp)) + #endif /* MONST_H */ -- 2.40.0