/* ### polyself.c ### */
E void NDECL(set_uasmon);
+E void NDECL(float_vs_flight);
E void NDECL(change_sex);
E void FDECL(polyself, (int));
E int FDECL(polymon, (int));
long save_BFly = BFlying;
BFlying = 0L;
- if (Flying) {
- Sprintf(buf, "%s%s%s",
- (save_BFly & I_SPECIAL) ?
- " if you weren't levitating" : "",
- ((save_BFly & (FROMOUTSIDE|I_SPECIAL)) ==
- (FROMOUTSIDE|I_SPECIAL)) ? " and" : "",
- (save_BFly & FROMOUTSIDE) ?
- if_surroundings_permitted : (const char *)"");
- enl_msg(You_, "would fly", "would have flown", buf, "");
- }
+ if (Flying)
+ enl_msg(You_, "would fly", "would have flown",
+ Levitation ? "if you weren't levitating" :
+ (save_BFly == FROMOUTSIDE) ?
+ if_surroundings_permitted :
+ /* both surroundings and [latent] levitation */
+ " if circumstances permitted", "");
BFlying = save_BFly;
}
/* actively walking on water handled earlier as a status condition */
makeknown(uarmf->otyp);
float_up();
spoteffects(FALSE);
+ } else {
+ float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
}
break;
default: impossible(unknown_type, c_boots, uarmf->otyp);
!context.takeoff.cancelled_don) {
(void) float_down(0L, 0L);
makeknown(otyp);
+ } else {
+ float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
}
break;
case LOW_BOOTS:
float_up();
learnring(obj, TRUE);
spoteffects(FALSE); /* for sinks */
+ } else {
+ float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
}
break;
case RIN_GAIN_STRENGTH:
if (!BLevitation) {
(void) float_down(0L, 0L);
if (!Levitation) learnring(obj, TRUE);
+ } else {
+ float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
}
break;
case RIN_GAIN_STRENGTH:
off_msg(obj);
}
HLevitation--;
+ /* probably moot; we're either still levitating or went
+ through float_down(), but make sure BFlying is up to date */
+ float_vs_flight();
}
#endif
BFlying |= FROMOUTSIDE;
} else if (BFlying) {
BFlying &= ~FROMOUTSIDE;
- /* in case BFlying got set due to levitation which then went away
- while blocked; there'd be no float_down() with reset of BFlying */
- if (!HLevitation && !ELevitation) BFlying &= ~I_SPECIAL;
+ float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
/* [minor bug: we don't know whether this is beginning flight or
resuming it; that could be tracked so that this message could
be adjusted to "resume flying", but isn't worth the effort...] */
PROPSET(PASSES_WALLS, passes_walls(mdat));
PROPSET(REGENERATION, regenerates(mdat));
PROPSET(REFLECTING, (mdat == &mons[PM_SILVER_DRAGON]));
- /* levitation overrides flight */
- if (HLevitation || ELevitation)
- BFlying |= I_SPECIAL;
- else
- BFlying &= ~I_SPECIAL;
+
+ float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
#undef PROPSET
#endif
}
+/* Levitation overrides Flying; set or clear BFlying|I_SPECIAL */
+void
+float_vs_flight()
+{
+ /* floating overrides flight; normally float_up() and float_down()
+ handle this, but sometimes they're skipped */
+ if (HLevitation || ELevitation)
+ BFlying |= I_SPECIAL;
+ else
+ BFlying &= ~I_SPECIAL;
+}
+
/* for changing into form that's immune to strangulation */
STATIC_OVL void
check_strangling(on)
} else
incr_itimeout(&HLevitation, rn1(140,10));
if (Levitation) spoteffects(FALSE); /* for sinks */
+ float_vs_flight();
break;
case POT_GAIN_ENERGY: /* M. Stephenson */
{ register int num;