fixed ladder climbing (#274), added animation for hanging on the grappler rope

Richard Gerum 2010-04-27 22:39:08 +02:00
parent aa5ff1c026
commit 87b2e85a2b
5 changed files with 55 additions and 5 deletions

View File

@ -1084,8 +1084,16 @@ func CheckScaleTop()
return true;
}
func FxIntScaleStart(target, number, tmp)
{
if(tmp) return;
EffectVar(1, target, number) = PlayAnimation("Scale", 5, Anim_Y(0, GetAnimationLength("Scale"), 0, 15), Anim_Linear(0, 0, 1000, 5, ANIM_Remove));
EffectVar(0, target, number) = 0;
}
func FxIntScaleTimer(target, number, time)
{
if(GetAction() != "Scale") return;
// When the clonk reaches the top play an extra animation
if(CheckScaleTop())
{
@ -1374,6 +1382,11 @@ func FxIntSwimTimer(pTarget, iNumber, iTime)
// Play stand animation when not moving
if(Abs(GetXDir()) < 1 && !GBackSemiSolid(0, -5))
{
if (GetContact(-1) & CNAT_Bottom)
{
SetAction("Walk");
return -1;
}
if(EffectVar(0, pTarget, iNumber) != "SwimStand")
{
EffectVar(0, pTarget, iNumber) = "SwimStand";
@ -1787,7 +1800,7 @@ Dig = {
StartCall = "StartDigging",
AbortCall = "StopDigging",
DigFree = 11,
InLiquidAction = "Swim",
// InLiquidAction = "Swim",
Attach = CNAT_Left | CNAT_Right | CNAT_Bottom,
},
Bridge = {

View File

@ -170,11 +170,11 @@ public func FxIntGrappleControlControl(object target, int fxnum, ctrl, x,y,stren
}
// Effect for smooth movement.
public func FxIntGrappleControlTimer(object target, int fxnum)
public func FxIntGrappleControlTimer(object target, int fxnum, int time)
{
if (!EffectVar(0, target, fxnum) && !EffectVar(1, target, fxnum)
/* if (!EffectVar(0, target, fxnum) && !EffectVar(1, target, fxnum)
&& !EffectVar(2, target, fxnum) && !EffectVar(3, target, fxnum))
return 0;
return 0;*/
// Movement.
if (EffectVar(0, target, fxnum))
@ -187,5 +187,33 @@ public func FxIntGrappleControlTimer(object target, int fxnum)
SetXDir(GetXDir(100) - 20, 100);
if (EffectVar(3, target, fxnum))
SetXDir(GetXDir(100) + 20, 100);
if(target->GetAction() == "Jump")
{
if(!EffectVar(4, target, fxnum))
{
target->SetTurnType(1);
target->SetObjDrawTransform(1000, 0, 3000*(1-2*target->GetDir()), 0, 1000);
}
var xoff = +rope->GetPartXOffset(-1)*10, yoff = rope->GetPartYOffset(-1)*10;
target->SetObjDrawTransform(1000, 0, 3000*(1-2*target->GetDir())+xoff, 0, 1000, yoff);
if(EffectVar(4, target, fxnum) != 2 && EffectVar(0, target, fxnum))
{
EffectVar(4, target, fxnum) = 2;
target->PlayAnimation("RopeClimb", 10, Anim_Linear(target->GetAnimationLength("RopeClimb")/2, 0, target->GetAnimationLength("RopeClimb"), 35, ANIM_Loop), Anim_Linear(0, 0, 1000, 5, ANIM_Remove));
}
if(EffectVar(4, target, fxnum) != 1 && !EffectVar(0, target, fxnum))
{
EffectVar(4, target, fxnum) = 1;
target->PlayAnimation("OnRope", 10, Anim_Const(0), Anim_Linear(0, 0, 1000, 5, ANIM_Remove));
}
}
else if(EffectVar(4, target, fxnum))
{
target->StopAnimation(target->GetRootAnimation(10));
EffectVar(4, target, fxnum) = 0;
}
return FX_OK;
}

View File

@ -325,6 +325,8 @@ func LogSpeed()
func GetPartX(index, old) { return (particles[index][old][0]+Rope_Precision/2)/Rope_Precision; }
func GetPartY(index, old) { return (particles[index][old][1]+Rope_Precision/2)/Rope_Precision; }
func GetPartXOffset(index) { return particles[index][0][0]-GetPartX(index)*Rope_Precision; }
func GetPartYOffset(index) { return particles[index][0][1]-GetPartY(index)*Rope_Precision; }
public func OnLadderGrab(clonk, index)
{

View File

@ -18,7 +18,7 @@ public func SetHelp(object tohelp)
return;
}
public func GetCarryMode() { return CARRY_HandBack; }
public func GetCarryMode() { if(hook->Contained() == 0) return CARRY_Back; return CARRY_HandBack; }
public func GetCarrySpecial(clonk) { if(fAiming) return "pos_hand2"; }
public func GetCarryBone2(clonk) { return "main2"; }
@ -60,6 +60,13 @@ public func OnRopeBreak()
PlayAnimation("Load", 5, Anim_Const(GetAnimationLength("Load")), Anim_Const(1000));
}
protected func Destruction()
{
var rope = hook->GetRope();
if (rope)
rope->BreakRope();
}
public func GetAnimationSet() { return animation_set; }
public func ControlUseStart(object clonk, int x, int y)