refine blocked levitation/flight (trunk only)
Levitation side-effects get skipped if Levitation toggles while it is blocked, so BFlying (the reason Flying is blocked) could become stale in some situations. Enlightment feedback about latent flight capability was the only thing affected.
This commit is contained in:
@@ -1750,6 +1750,7 @@ E void NDECL(self_invis_message);
|
|||||||
/* ### polyself.c ### */
|
/* ### polyself.c ### */
|
||||||
|
|
||||||
E void NDECL(set_uasmon);
|
E void NDECL(set_uasmon);
|
||||||
|
E void NDECL(float_vs_flight);
|
||||||
E void NDECL(change_sex);
|
E void NDECL(change_sex);
|
||||||
E void FDECL(polyself, (int));
|
E void FDECL(polyself, (int));
|
||||||
E int FDECL(polymon, (int));
|
E int FDECL(polymon, (int));
|
||||||
|
|||||||
17
src/cmd.c
17
src/cmd.c
@@ -1775,16 +1775,13 @@ int final;
|
|||||||
long save_BFly = BFlying;
|
long save_BFly = BFlying;
|
||||||
|
|
||||||
BFlying = 0L;
|
BFlying = 0L;
|
||||||
if (Flying) {
|
if (Flying)
|
||||||
Sprintf(buf, "%s%s%s",
|
enl_msg(You_, "would fly", "would have flown",
|
||||||
(save_BFly & I_SPECIAL) ?
|
Levitation ? "if you weren't levitating" :
|
||||||
" if you weren't levitating" : "",
|
(save_BFly == FROMOUTSIDE) ?
|
||||||
((save_BFly & (FROMOUTSIDE|I_SPECIAL)) ==
|
if_surroundings_permitted :
|
||||||
(FROMOUTSIDE|I_SPECIAL)) ? " and" : "",
|
/* both surroundings and [latent] levitation */
|
||||||
(save_BFly & FROMOUTSIDE) ?
|
" if circumstances permitted", "");
|
||||||
if_surroundings_permitted : (const char *)"");
|
|
||||||
enl_msg(You_, "would fly", "would have flown", buf, "");
|
|
||||||
}
|
|
||||||
BFlying = save_BFly;
|
BFlying = save_BFly;
|
||||||
}
|
}
|
||||||
/* actively walking on water handled earlier as a status condition */
|
/* actively walking on water handled earlier as a status condition */
|
||||||
|
|||||||
@@ -194,6 +194,8 @@ Boots_on(VOID_ARGS)
|
|||||||
makeknown(uarmf->otyp);
|
makeknown(uarmf->otyp);
|
||||||
float_up();
|
float_up();
|
||||||
spoteffects(FALSE);
|
spoteffects(FALSE);
|
||||||
|
} else {
|
||||||
|
float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: impossible(unknown_type, c_boots, uarmf->otyp);
|
default: impossible(unknown_type, c_boots, uarmf->otyp);
|
||||||
@@ -245,6 +247,8 @@ Boots_off(VOID_ARGS)
|
|||||||
!context.takeoff.cancelled_don) {
|
!context.takeoff.cancelled_don) {
|
||||||
(void) float_down(0L, 0L);
|
(void) float_down(0L, 0L);
|
||||||
makeknown(otyp);
|
makeknown(otyp);
|
||||||
|
} else {
|
||||||
|
float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LOW_BOOTS:
|
case LOW_BOOTS:
|
||||||
@@ -880,6 +884,8 @@ register struct obj *obj;
|
|||||||
float_up();
|
float_up();
|
||||||
learnring(obj, TRUE);
|
learnring(obj, TRUE);
|
||||||
spoteffects(FALSE); /* for sinks */
|
spoteffects(FALSE); /* for sinks */
|
||||||
|
} else {
|
||||||
|
float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RIN_GAIN_STRENGTH:
|
case RIN_GAIN_STRENGTH:
|
||||||
@@ -991,6 +997,8 @@ boolean gone;
|
|||||||
if (!BLevitation) {
|
if (!BLevitation) {
|
||||||
(void) float_down(0L, 0L);
|
(void) float_down(0L, 0L);
|
||||||
if (!Levitation) learnring(obj, TRUE);
|
if (!Levitation) learnring(obj, TRUE);
|
||||||
|
} else {
|
||||||
|
float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RIN_GAIN_STRENGTH:
|
case RIN_GAIN_STRENGTH:
|
||||||
|
|||||||
@@ -543,6 +543,9 @@ dosinkfall()
|
|||||||
off_msg(obj);
|
off_msg(obj);
|
||||||
}
|
}
|
||||||
HLevitation--;
|
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
|
#endif
|
||||||
|
|
||||||
@@ -1665,9 +1668,7 @@ switch_terrain()
|
|||||||
BFlying |= FROMOUTSIDE;
|
BFlying |= FROMOUTSIDE;
|
||||||
} else if (BFlying) {
|
} else if (BFlying) {
|
||||||
BFlying &= ~FROMOUTSIDE;
|
BFlying &= ~FROMOUTSIDE;
|
||||||
/* in case BFlying got set due to levitation which then went away
|
float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
|
||||||
while blocked; there'd be no float_down() with reset of BFlying */
|
|
||||||
if (!HLevitation && !ELevitation) BFlying &= ~I_SPECIAL;
|
|
||||||
/* [minor bug: we don't know whether this is beginning flight or
|
/* [minor bug: we don't know whether this is beginning flight or
|
||||||
resuming it; that could be tracked so that this message could
|
resuming it; that could be tracked so that this message could
|
||||||
be adjusted to "resume flying", but isn't worth the effort...] */
|
be adjusted to "resume flying", but isn't worth the effort...] */
|
||||||
|
|||||||
@@ -88,11 +88,8 @@ set_uasmon()
|
|||||||
PROPSET(PASSES_WALLS, passes_walls(mdat));
|
PROPSET(PASSES_WALLS, passes_walls(mdat));
|
||||||
PROPSET(REGENERATION, regenerates(mdat));
|
PROPSET(REGENERATION, regenerates(mdat));
|
||||||
PROPSET(REFLECTING, (mdat == &mons[PM_SILVER_DRAGON]));
|
PROPSET(REFLECTING, (mdat == &mons[PM_SILVER_DRAGON]));
|
||||||
/* levitation overrides flight */
|
|
||||||
if (HLevitation || ELevitation)
|
float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
|
||||||
BFlying |= I_SPECIAL;
|
|
||||||
else
|
|
||||||
BFlying &= ~I_SPECIAL;
|
|
||||||
|
|
||||||
#undef PROPSET
|
#undef PROPSET
|
||||||
|
|
||||||
@@ -101,6 +98,18 @@ set_uasmon()
|
|||||||
#endif
|
#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 */
|
/* for changing into form that's immune to strangulation */
|
||||||
STATIC_OVL void
|
STATIC_OVL void
|
||||||
check_strangling(on)
|
check_strangling(on)
|
||||||
|
|||||||
@@ -934,6 +934,7 @@ peffects(otmp)
|
|||||||
} else
|
} else
|
||||||
incr_itimeout(&HLevitation, rn1(140,10));
|
incr_itimeout(&HLevitation, rn1(140,10));
|
||||||
if (Levitation) spoteffects(FALSE); /* for sinks */
|
if (Levitation) spoteffects(FALSE); /* for sinks */
|
||||||
|
float_vs_flight();
|
||||||
break;
|
break;
|
||||||
case POT_GAIN_ENERGY: /* M. Stephenson */
|
case POT_GAIN_ENERGY: /* M. Stephenson */
|
||||||
{ register int num;
|
{ register int num;
|
||||||
|
|||||||
Reference in New Issue
Block a user