Use macros for monster appearances

This commit is contained in:
Pasi Kallinen
2015-10-18 13:55:11 +03:00
parent 822b372644
commit 95983f6ae6
11 changed files with 20 additions and 39 deletions

View File

@@ -1179,11 +1179,8 @@ set_mimic_blocking()
for (mon = fmon; mon; mon = mon->nmon) {
if (DEADMONSTER(mon))
continue;
if (mon->minvis && ((mon->m_ap_type == M_AP_FURNITURE
&& (mon->mappearance == S_vcdoor
|| mon->mappearance == S_hcdoor))
|| (mon->m_ap_type == M_AP_OBJECT
&& mon->mappearance == BOULDER))) {
if (mon->minvis && (is_door_mappear(mon)
|| is_obj_mappear(mon,BOULDER))) {
if (See_invisible)
block_point(mon->mx, mon->my);
else

View File

@@ -161,13 +161,11 @@ eatmupdate()
if (!eatmbuf || nomovemsg != eatmbuf)
return;
if (youmonst.m_ap_type == M_AP_OBJECT && youmonst.mappearance == ORANGE
&& !Hallucination) {
if (is_obj_mappear(&youmonst,ORANGE) && !Hallucination) {
/* revert from hallucinatory to "normal" mimicking */
altmsg = "You now prefer mimicking yourself.";
altapp = GOLD_PIECE;
} else if (youmonst.m_ap_type == M_AP_OBJECT
&& youmonst.mappearance == GOLD_PIECE && Hallucination) {
} else if (is_obj_mappear(&youmonst,GOLD_PIECE) && Hallucination) {
/* won't happen; anything which might make immobilized
hero begin hallucinating (black light attack, theft
of Grayswandir) will terminate the mimicry first */

View File

@@ -2416,9 +2416,7 @@ lookaround()
|| IS_AIR(levl[x][y].typ))
continue;
else if (closed_door(x, y)
|| (mtmp && mtmp->m_ap_type == M_AP_FURNITURE
&& (mtmp->mappearance == S_hcdoor
|| mtmp->mappearance == S_vcdoor))) {
|| (mtmp && is_door_mappear(mtmp))) {
if (x != u.ux && y != u.uy)
continue;
if (context.run != 1)

View File

@@ -389,11 +389,7 @@ register struct obj *pick;
pline("I don't think %s would appreciate that.",
mon_nam(mtmp));
return PICKLOCK_LEARNED_SOMETHING;
} else if (mtmp && mtmp->m_ap_type == M_AP_FURNITURE &&
/* not IS_DOOR() here; for M_AP_FURNITURE, mappearance
holds a map symbol rather than a topology type */
(mtmp->mappearance == S_vcdoor
|| mtmp->mappearance == S_hcdoor)) {
} else if (mtmp && is_door_mappear(mtmp)) {
/* "The door actually was a <mimic>!" */
stumble_onto_mimic(mtmp);
/* mimic might keep the key (50% chance, 10% for PYEC) */
@@ -539,8 +535,7 @@ stumble_on_door_mimic(x, y)
int x, y;
{
struct monst *mtmp;
if ((mtmp = m_at(x, y)) && mtmp->m_ap_type == M_AP_FURNITURE
&& (mtmp->mappearance == S_hcdoor || mtmp->mappearance == S_vcdoor)
if ((mtmp = m_at(x, y)) && is_door_mappear(mtmp)
&& !Protection_from_shape_changers) {
stumble_onto_mimic(mtmp);
return TRUE;

View File

@@ -55,8 +55,7 @@ boolean undirected;
point_msg = "all around, then curses";
else if ((Invis && !perceives(mtmp->data)
&& (mtmp->mux != u.ux || mtmp->muy != u.uy))
|| (youmonst.m_ap_type == M_AP_OBJECT
&& youmonst.mappearance == STRANGE_OBJECT)
|| is_obj_mappear(&youmonst, STRANGE_OBJECT)
|| u.uundetected)
point_msg = "and curses in your general direction";
else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy))

View File

@@ -2531,8 +2531,8 @@ void
seemimic(mtmp)
register struct monst *mtmp;
{
unsigned old_app = mtmp->mappearance;
uchar old_ap_type = mtmp->m_ap_type;
boolean is_blocker_appear = is_door_mappear(mtmp) ||
is_obj_mappear(mtmp, BOULDER);
if (has_mcorpsenm(mtmp))
freemcorpsenm(mtmp);
@@ -2543,9 +2543,7 @@ register struct monst *mtmp;
/*
* Discovered mimics don't block light.
*/
if (((old_ap_type == M_AP_FURNITURE
&& (old_app == S_hcdoor || old_app == S_vcdoor))
|| (old_ap_type == M_AP_OBJECT && old_app == BOULDER))
if (is_blocker_appear
&& !does_block(mtmp->mx, mtmp->my, &levl[mtmp->mx][mtmp->my]))
unblock_point(mtmp->mx, mtmp->my);

View File

@@ -845,10 +845,8 @@ not_special:
if (!mtmp->mcansee
|| (should_see && Invis && !perceives(ptr) && rn2(11))
|| (youmonst.m_ap_type == M_AP_OBJECT
&& youmonst.mappearance == STRANGE_OBJECT) || u.uundetected
|| (youmonst.m_ap_type == M_AP_OBJECT
&& youmonst.mappearance == GOLD_PIECE && !likes_gold(ptr))
|| is_obj_mappear(&youmonst,STRANGE_OBJECT) || u.uundetected
|| (is_obj_mappear(&youmonst,GOLD_PIECE) && !likes_gold(ptr))
|| (mtmp->mpeaceful && !mtmp->isshk) || /* allow shks to follow */
((monsndx(ptr) == PM_STALKER || ptr->mlet == S_BAT
|| ptr->mlet == S_LIGHT) && !rn2(3)))

View File

@@ -89,8 +89,7 @@ struct obj **obj_p;
*obj_p = (struct obj *) 0;
/* there might be a mimic here posing as an object */
mtmp = m_at(x, y);
if (mtmp && mtmp->m_ap_type == M_AP_OBJECT
&& mtmp->mappearance == (unsigned) glyphotyp)
if (mtmp && is_obj_mappear(mtmp, (unsigned) glyphotyp))
otmp = 0;
else
mtmp = 0;

View File

@@ -178,11 +178,7 @@ register struct rm *lev;
/* Mimics mimicing a door or boulder block light. */
if ((mon = m_at(x, y)) && (!mon->minvis || See_invisible)
&& ((mon->m_ap_type == M_AP_FURNITURE
&& (mon->mappearance == S_hcdoor
|| mon->mappearance == S_vcdoor))
|| (mon->m_ap_type == M_AP_OBJECT
&& mon->mappearance == BOULDER)))
&& (is_door_mappear(mon) || is_obj_mappear(mon,BOULDER)))
return 1;
return 0;

View File

@@ -320,8 +320,7 @@ struct obj *otmp;
}
if (canseemon(mtmp)) {
if (disguised_mimic) {
if (mtmp->m_ap_type == M_AP_OBJECT
&& mtmp->mappearance == STRANGE_OBJECT) {
if (is_obj_mappear(mtmp,STRANGE_OBJECT)) {
/* it can do better now */
set_mimic_sym(mtmp);
newsym(mtmp->mx, mtmp->my);