From 92aba4591419b5f79667078a5823963daf1fed23 Mon Sep 17 00:00:00 2001 From: Maikel de Vries Date: Fri, 19 Jan 2018 12:34:12 +0100 Subject: [PATCH] fix diving animation prediction for clonk And no! randomly multiplying by 2 is not a solution... --- planet/Objects.ocd/Clonk.ocd/Animations.ocd/Script.c | 4 ++-- planet/Objects.ocd/Libraries.ocd/ClonkControl.ocd/Script.c | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/planet/Objects.ocd/Clonk.ocd/Animations.ocd/Script.c b/planet/Objects.ocd/Clonk.ocd/Animations.ocd/Script.c index 21960c45f..b1bc90440 100644 --- a/planet/Objects.ocd/Clonk.ocd/Animations.ocd/Script.c +++ b/planet/Objects.ocd/Clonk.ocd/Animations.ocd/Script.c @@ -817,8 +817,8 @@ func StartJump() //Dive jump (only if not aiming) if(!this->~IsAiming()) { - var flight = SimFlight(AbsX(GetX()), AbsY(GetY()), GetXDir()*2, GetYDir()*2, 25); //I have no clue why the dirs must be doubled... but it seems to fix it - if(GBackLiquid(flight[0] - GetX(), flight[1] - GetY()) && GBackLiquid(flight[0] - GetX(), flight[1] + GetDefHeight() / 2 - GetY())) + var flight = SimFlight(0, GetBottom(), nil, nil, C4M_Liquid); + if (GBackLiquid(flight[0] - GetX(), flight[1] - GetY()) && GBackLiquid(flight[0] - GetX(), flight[1] + GetBottom() - GetY())) { PlayAnimation("JumpDive", CLONK_ANIM_SLOT_Movement, Anim_Linear(0, 0, GetAnimationLength("JumpDive"), 60, ANIM_Hold), Anim_Linear(0, 0, 1000, 5, ANIM_Remove)); if(!GetEffect("IntDiveJump", this)) diff --git a/planet/Objects.ocd/Libraries.ocd/ClonkControl.ocd/Script.c b/planet/Objects.ocd/Libraries.ocd/ClonkControl.ocd/Script.c index 443154267..64e8c1e27 100644 --- a/planet/Objects.ocd/Libraries.ocd/ClonkControl.ocd/Script.c +++ b/planet/Objects.ocd/Libraries.ocd/ClonkControl.ocd/Script.c @@ -636,8 +636,6 @@ public func ControlJumpExecute(int ydir) if (GetProcedure() == "SCALE" || GetAction() == "Climb") { AddEffect("WallKick", this, 1); - SetAction("Jump"); - var xdir; if(GetDir() == DIR_Right) { @@ -652,13 +650,16 @@ public func ControlJumpExecute(int ydir) SetYDir(-ydir * GetCon(), 100 * 100); SetXDir(xdir * 17); + // Set speed first to have proper animations when jump starts. + SetAction("Jump"); return true; } //Normal jump else { - SetAction("Jump"); SetYDir(-ydir * GetCon(), 100 * 100); + // Set speed first to have proper animations when jump starts. + SetAction("Jump"); return true; } }