fix #H6203 - jumping over water doesn't

Accidentally caused by my grappling hook fix 2 months ago, attempting
to jump over water made hero enter that water and drown (or crawl out).
hurtle_step() was originally intended to be used for recoil while
levitating, but it is used in other situations where not levitating
and behavior for the two circumstances should be different.

This doesn't fix things properly, just gets jumping working again.
This commit is contained in:
PatR
2017-10-09 15:27:24 -07:00
parent c64ae2d28d
commit 9b3d358989
5 changed files with 29 additions and 7 deletions

View File

@@ -509,6 +509,8 @@ hero poly'd into vampire could drain monster down to 0 HP without killing it,
"you observe a fog cloud where a vampire/bat was" if an unseen vampire on the
far side of a closed door shifted shape to pass under that door
fix mention_walls reporting secret doors as solid stone
jumping over water unintentionally moved hero through that water, causing
drowning if not able to water walk or fly
Platform- and/or Interface-Specific Fixes

View File

@@ -536,11 +536,11 @@ E int FDECL(thitmonst, (struct monst *, struct obj *));
E int FDECL(hero_breaks, (struct obj *, XCHAR_P, XCHAR_P, BOOLEAN_P));
E int FDECL(breaks, (struct obj *, XCHAR_P, XCHAR_P));
E void FDECL(release_camera_demon, (struct obj *, XCHAR_P, XCHAR_P));
E void FDECL(breakobj,
(struct obj *, XCHAR_P, XCHAR_P, BOOLEAN_P, BOOLEAN_P));
E void FDECL(breakobj, (struct obj *, XCHAR_P, XCHAR_P, BOOLEAN_P, BOOLEAN_P));
E boolean FDECL(breaktest, (struct obj *));
E boolean FDECL(walk_path, (coord *, coord *,
boolean (*)(genericptr, int, int), genericptr_t));
E boolean FDECL(hurtle_jump, (genericptr_t, int, int));
E boolean FDECL(hurtle_step, (genericptr_t, int, int));
/* ### drawing.c ### */

View File

@@ -227,7 +227,8 @@
&& !BFlying)
/* May touch surface; does not override any others */
#define Wwalking (u.uprops[WWALKING].extrinsic && !Is_waterlevel(&u.uz))
#define EWwalking u.uprops[WWALKING].extrinsic
#define Wwalking (EWwalking && !Is_waterlevel(&u.uz))
/* Don't get wet, can't go under water; overrides others except levitation */
/* Wwalking is meaningless on water level */

View File

@@ -1769,10 +1769,10 @@ int magic; /* 0=Physical, otherwise skill level */
temp = -temp;
if (range < temp)
range = temp;
(void) walk_path(&uc, &cc, hurtle_step, (genericptr_t) &range);
/* hurtle_step results in (u.ux, u.uy) == (cc.x, cc.y) and usually
* moves the ball if punished, but does not handle all the effects
* of landing on the final position.
(void) walk_path(&uc, &cc, hurtle_jump, (genericptr_t) &range);
/* hurtle_jump -> hurtle_step results in <u.ux,u.uy> == <cc.x,cc.y>
* and usually moves the ball if punished, but does not handle all
* the effects of landing on the final position.
*/
teleds(cc.x, cc.y, FALSE);
sokoban_guilt();

View File

@@ -519,6 +519,25 @@ genericptr_t arg;
return FALSE;
}
/* hack for hurtle_step() -- it ought to be changed to take an argument
indicating lev/fly-to-dest vs lev/fly-to-dest-minus-one-land-on-dest
vs drag-to-dest; original callers use first mode, jumping wants second,
grappling hook backfire and thrown chained ball need third */
boolean
hurtle_jump(arg, x, y)
genericptr_t arg;
int x, y;
{
boolean res;
long save_EWwalking = EWwalking;
/* prevent jumping over water from being placed in that water */
EWwalking |= I_SPECIAL;
res = hurtle_step(arg, x, y);
EWwalking = save_EWwalking;
return res;
}
/*
* Single step for the hero flying through the air from jumping, flying,
* etc. Called from hurtle() and jump() via walk_path(). We expect the