write 'getJumpPatches' function in a slightly less redundant way

This commit is contained in:
2025-01-24 09:48:57 +00:00
parent d07b0a35ca
commit 5e6a831add

View File

@@ -205,7 +205,7 @@ struct
val standingOnPlat = standingOnArea (enemy, platformTree) val standingOnPlat = standingOnArea (enemy, platformTree)
in in
if ey > platY andalso ey >= platY andalso standingOnPlat then if ey >= platY andalso standingOnPlat then
if isBetween (platX, ecx, platFinishX) then if isBetween (platX, ecx, platFinishX) then
(* can jump from same position enemy is at *) (* can jump from same position enemy is at *)
case eyAxis of case eyAxis of
@@ -213,12 +213,10 @@ struct
| FALLING => EnemyPatch.W_Y_AXIS (JUMPING 0) :: acc | FALLING => EnemyPatch.W_Y_AXIS (JUMPING 0) :: acc
| _ => acc | _ => acc
else else
(* have to travel left/right before jumping *) (* have to travel either left or right before jumping *)
if eX < platX then if ecx < platX then
(* have to move right to jump to platform *)
EnemyPatch.W_X_AXIS MOVE_RIGHT :: acc EnemyPatch.W_X_AXIS MOVE_RIGHT :: acc
else else
(* have to move left to jump to platform *)
EnemyPatch.W_X_AXIS MOVE_LEFT :: acc EnemyPatch.W_X_AXIS MOVE_LEFT :: acc
else else
acc acc