show projectile trajectory preview for the grenade launcher

epoxy
Maikel de Vries 2016-02-03 19:49:23 +01:00
parent 17fae9c77b
commit 879048c366
1 changed files with 9 additions and 0 deletions

View File

@ -120,6 +120,13 @@ func ControlUseHolding(object clonk, ix, iy)
clonk->SetAimPosition(angle);
// Show and update trajectory preview only when loaded.
if (loaded)
{
var shot_x = Sin(180 - angle, MuzzleFront);
var shot_y = Cos(180 - angle, MuzzleUp) + MuzzleOffset;
Trajectory->Create(clonk, GetX() + shot_x, GetY() + shot_y, Cos(angle - 90, shooting_strength), Sin(angle - 90, shooting_strength));
}
return true;
}
@ -138,6 +145,7 @@ public func FinishedAiming(object clonk, int angle)
// Fire
if(Contents(0) && Contents(0)->~IsGrenadeLauncherAmmo())
FireWeapon(clonk, angle);
Trajectory->Remove(clonk);
clonk->StartShoot(this);
return true;
}
@ -145,6 +153,7 @@ public func FinishedAiming(object clonk, int angle)
protected func ControlUseCancel(object clonk, int x, int y)
{
clonk->CancelAiming(this);
Trajectory->Remove(clonk);
return true;
}