From 0ee445ce0bc35ce7744d1e630d0d6d0d409f5f90 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 17 Dec 2019 15:48:37 -0800 Subject: [PATCH] ceiling_hider() Just groundwork so far; no change in game play. --- include/mondata.h | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/include/mondata.h b/include/mondata.h index 41b5f70f4..155ebfa5b 100644 --- a/include/mondata.h +++ b/include/mondata.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 mondata.h $NHDT-Date: 1550524558 2019/02/18 21:15:58 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.37 $ */ +/* NetHack 3.6 mondata.h $NHDT-Date: 1576626512 2019/12/17 23:48:32 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.39 $ */ /* Copyright (c) 1989 Mike Threepoint */ /* NetHack may be freely redistributed. See license for details. */ @@ -31,6 +31,7 @@ (is_minion((mon)->data) && mon_aligntyp(mon) == A_LAWFUL) #define is_flyer(ptr) (((ptr)->mflags1 & M1_FLY) != 0L) #define is_floater(ptr) ((ptr)->mlet == S_EYE || (ptr)->mlet == S_LIGHT) +/* clinger: piercers, mimics, wumpus -- generally don't fall down holes */ #define is_clinger(ptr) (((ptr)->mflags1 & M1_CLING) != 0L) #define is_swimmer(ptr) (((ptr)->mflags1 & M1_SWIM) != 0L) #define breathless(ptr) (((ptr)->mflags1 & M1_BREATHLESS) != 0L) @@ -41,14 +42,24 @@ #define noncorporeal(ptr) ((ptr)->mlet == S_GHOST) #define tunnels(ptr) (((ptr)->mflags1 & M1_TUNNEL) != 0L) #define needspick(ptr) (((ptr)->mflags1 & M1_NEEDPICK) != 0L) +/* hides_under() requires an object at the location in order to hide */ #define hides_under(ptr) (((ptr)->mflags1 & M1_CONCEAL) != 0L) +/* is_hider() is True for mimics but when hiding they appear as something + else rather than become mon->mundetected, so use is_hider() with care */ #define is_hider(ptr) (((ptr)->mflags1 & M1_HIDE) != 0L) +/* piercers cling to the ceiling; lurkers above are hiders but they fly + so aren't classified as clingers; unfortunately mimics are classified + as both hiders and clingers but have nothing to do with ceilings; + wumpuses (not wumpi :-) cling but aren't hiders */ +#define ceiling_hider(ptr) \ + (is_hider(ptr) && ((is_clinger(ptr) && (ptr)->mlet != S_MIMIC) \ + || is_flyer(ptr))) /* lurker above */ #define haseyes(ptr) (((ptr)->mflags1 & M1_NOEYES) == 0L) -#define eyecount(ptr) \ - (!haseyes(ptr) ? 0 : ((ptr) == &mons[PM_CYCLOPS] \ - || (ptr) == &mons[PM_FLOATING_EYE]) \ - ? 1 \ - : 2) +/* used to decide whether plural applies so no need for 'more than 2' */ +#define eyecount(ptr) \ + (!haseyes(ptr) ? 0 \ + : ((ptr) == &mons[PM_CYCLOPS] || (ptr) == &mons[PM_FLOATING_EYE]) ? 1 \ + : 2) #define nohands(ptr) (((ptr)->mflags1 & M1_NOHANDS) != 0L) #define nolimbs(ptr) (((ptr)->mflags1 & M1_NOLIMBS) == M1_NOLIMBS) #define notake(ptr) (((ptr)->mflags1 & M1_NOTAKE) != 0L)