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:
nhmall
2019-04-22 14:17:18 -04:00
parent cd6b5ef933
commit dcf4da2150
30 changed files with 127 additions and 115 deletions

View File

@@ -146,7 +146,7 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */
/* if it was an invisible mimic, treat it as if we stumbled
* onto a visible mimic
*/
if (mtmp->m_ap_type && !Protection_from_shape_changers
if (M_AP_TYPE(mtmp) && !Protection_from_shape_changers
/* applied pole-arm attack is too far to get stuck */
&& distu(mtmp->mx, mtmp->my) <= 2) {
if (!u.ustuck && !mtmp->mflee && dmgtype(mtmp->data, AD_STCK))
@@ -162,7 +162,7 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */
return TRUE;
}
if (mtmp->m_ap_type && !Protection_from_shape_changers && !sensemon(mtmp)
if (M_AP_TYPE(mtmp) && !Protection_from_shape_changers && !sensemon(mtmp)
&& !glyph_is_warning(glyph)) {
/* If a hidden mimic was in a square where a player remembers
* some (probably different) unseen monster, the player is in
@@ -204,7 +204,7 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */
* make sure to wake up a monster from the above cases if the
* hero can sense that the monster is there.
*/
if ((mtmp->mundetected || mtmp->m_ap_type) && sensemon(mtmp)) {
if ((mtmp->mundetected || M_AP_TYPE(mtmp)) && sensemon(mtmp)) {
mtmp->mundetected = 0;
wakeup(mtmp, TRUE);
}
@@ -2993,7 +2993,7 @@ struct monst *mtmp;
if (Blind) {
if (!Blind_telepat)
what = generic; /* with default fmt */
else if (mtmp->m_ap_type == M_AP_MONSTER)
else if (M_AP_TYPE(mtmp) == M_AP_MONSTER)
what = a_monnam(mtmp); /* differs from what was sensed */
} else {
int glyph = levl[u.ux + u.dx][u.uy + u.dy].glyph;