preserve dknown field between fakeobj instances
Preserve temporary fake object's previous dknown value by storing it as a flag value within the m_ap_type field of the posing monster, and recalling it when it is needed. This is intended to help eliminate observable differences in price display between real objects and mimics posing as objects. 98% of this is just switching the code to utilize macro M_AP_TYPE(mon) everywhere to ensure that the flag bits are stripped off when needed.
This commit is contained in:
@@ -215,13 +215,13 @@
|
||||
|
||||
#define display_self() \
|
||||
show_glyph(u.ux, u.uy, \
|
||||
maybe_display_usteed((youmonst.m_ap_type == M_AP_NOTHING) \
|
||||
maybe_display_usteed((U_AP_TYPE == M_AP_NOTHING) \
|
||||
? hero_glyph \
|
||||
: (youmonst.m_ap_type == M_AP_FURNITURE) \
|
||||
: (U_AP_TYPE == M_AP_FURNITURE) \
|
||||
? cmap_to_glyph(youmonst.mappearance) \
|
||||
: (youmonst.m_ap_type == M_AP_OBJECT) \
|
||||
: (U_AP_TYPE == M_AP_OBJECT) \
|
||||
? objnum_to_glyph(youmonst.mappearance) \
|
||||
/* else M_AP_MONSTER */ \
|
||||
/* else U_AP_TYPE == M_AP_MONSTER */ \
|
||||
: monnum_to_glyph(youmonst.mappearance)))
|
||||
|
||||
/*
|
||||
|
||||
@@ -47,9 +47,16 @@ enum m_ap_types {
|
||||
M_AP_NOTHING = 0, /* mappearance unused--monster appears as itself */
|
||||
M_AP_FURNITURE = 1, /* stairs, a door, an altar, etc. */
|
||||
M_AP_OBJECT = 2, /* an object */
|
||||
M_AP_MONSTER = 3 /* a monster; mostly used for cloned Wizard */
|
||||
M_AP_MONSTER = 3, /* a monster; mostly used for cloned Wizard */
|
||||
};
|
||||
|
||||
#define M_AP_TYPMASK 0x7
|
||||
#define M_AP_F_DKNOWN 0x8
|
||||
#define U_AP_TYPE (youmonst.m_ap_type & M_AP_TYPMASK)
|
||||
#define U_AP_FLAG (youmonst.m_ap_type & ~M_AP_TYPMASK)
|
||||
#define M_AP_TYPE(m) ((m)->m_ap_type & M_AP_TYPMASK)
|
||||
#define M_AP_FLAG(m) ((m)->m_ap_type & ~M_AP_TYPMASK)
|
||||
|
||||
struct monst {
|
||||
struct monst *nmon;
|
||||
struct permonst *data;
|
||||
@@ -170,15 +177,15 @@ struct monst {
|
||||
/* mimic appearances that block vision/light */
|
||||
#define is_lightblocker_mappear(mon) \
|
||||
(is_obj_mappear(mon, BOULDER) \
|
||||
|| ((mon)->m_ap_type == M_AP_FURNITURE \
|
||||
|| (M_AP_TYPE(mon) == 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 \
|
||||
#define is_door_mappear(mon) (M_AP_TYPE(mon) == M_AP_FURNITURE \
|
||||
&& ((mon)->mappearance == S_hcdoor \
|
||||
|| (mon)->mappearance == S_vcdoor))
|
||||
#define is_obj_mappear(mon,otyp) ((mon)->m_ap_type == M_AP_OBJECT \
|
||||
#define is_obj_mappear(mon,otyp) (M_AP_TYPE(mon) == M_AP_OBJECT \
|
||||
&& (mon)->mappearance == (otyp))
|
||||
|
||||
#endif /* MONST_H */
|
||||
|
||||
Reference in New Issue
Block a user