engine: apply weapon offset to charge animation
authorsheepluva
Mon, 28 Jun 2010 09:33:10 +0200
changeset 3580 85bd667955f2
parent 3578 00aac66147c8
child 3581 8cdf8f577800
engine: apply weapon offset to charge animation
hedgewars/uGears.pas
hedgewars/uWorld.pas
--- a/hedgewars/uGears.pas	Mon Jun 28 08:52:17 2010 +0200
+++ b/hedgewars/uGears.pas	Mon Jun 28 09:33:10 2010 +0200
@@ -95,6 +95,8 @@
 procedure RemoveGearFromList(Gear: PGear);
 function  ModifyDamage(dmg: Longword; Gear: PGear): Longword;
 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt);
+function GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt;
+function GetLaunchY(at: TAmmoType; angle: LongInt): LongInt;
 
 implementation
 uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, uLand, uIO, uLandGraphics,
--- a/hedgewars/uWorld.pas	Mon Jun 28 08:52:17 2010 +0200
+++ b/hedgewars/uWorld.pas	Mon Jun 28 09:33:10 2010 +0200
@@ -612,8 +612,8 @@
                 tdy:= - Cos(Gear^.Angle * Pi / cMaxAngle);
                 for i:= (Gear^.Power * 24) div cPowerDivisor downto 0 do
                     DrawSprite(sprPower,
-                            hwRound(Gear^.X) + round(WorldDx + tdx * (24 + i * 2)) - 16,
-                            hwRound(Gear^.Y) + round(WorldDy + tdy * (24 + i * 2)) - 12,
+                            hwRound(Gear^.X) + GetLaunchX(Ammo^[CurSlot, CurAmmo].AmmoType, hwSign(Gear^.dX), Gear^.Angle) + round(WorldDx + tdx * (24 + i * 2)) - 16,
+                            hwRound(Gear^.Y) + GetLaunchY(Ammo^[CurSlot, CurAmmo].AmmoType, Gear^.Angle) + round(WorldDy + tdy * (24 + i * 2)) - 16,
                             i)
                 end
         end;