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

@@ -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