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

@@ -162,7 +162,7 @@ polyman(fmt, arg)
const char *fmt, *arg;
{
boolean sticky = (sticks(youmonst.data) && u.ustuck && !u.uswallow),
was_mimicking = (youmonst.m_ap_type == M_AP_OBJECT);
was_mimicking = (U_AP_TYPE == M_AP_OBJECT);
boolean was_blind = !!Blind;
if (Upolyd) {
@@ -625,7 +625,7 @@ int mntmp;
}
/* if stuck mimicking gold, stop immediately */
if (multi < 0 && youmonst.m_ap_type == M_AP_OBJECT
if (multi < 0 && U_AP_TYPE == M_AP_OBJECT
&& youmonst.data->mlet != S_MIMIC)
unmul("");
/* if becoming a non-mimic, stop mimicking anything */
@@ -1323,8 +1323,8 @@ dogaze()
pline("%s seems not to notice your gaze.", Monnam(mtmp));
} else if (mtmp->minvis && !See_invisible) {
You_cant("see where to gaze at %s.", Monnam(mtmp));
} else if (mtmp->m_ap_type == M_AP_FURNITURE
|| mtmp->m_ap_type == M_AP_OBJECT) {
} else if (M_AP_TYPE(mtmp) == M_AP_FURNITURE
|| M_AP_TYPE(mtmp) == M_AP_OBJECT) {
looked--;
continue;
} else if (flags.safe_dog && mtmp->mtame && !Confusion) {
@@ -1432,7 +1432,7 @@ dohide()
: (humanoid(u.ustuck->data) ? "holding someone"
: "holding that creature"));
if (u.uundetected
|| (ismimic && youmonst.m_ap_type != M_AP_NOTHING)) {
|| (ismimic && U_AP_TYPE != M_AP_NOTHING)) {
u.uundetected = 0;
youmonst.m_ap_type = M_AP_NOTHING;
newsym(u.ux, u.uy);
@@ -1470,7 +1470,7 @@ dohide()
* else make youhiding() give smarter messages at such spots.
*/
if (u.uundetected || (ismimic && youmonst.m_ap_type != M_AP_NOTHING)) {
if (u.uundetected || (ismimic && U_AP_TYPE != M_AP_NOTHING)) {
youhiding(FALSE, 1); /* "you are already hiding" */
return 0;
}