# HG changeset patch # User Wuzzy # Date 1560596281 -7200 # Node ID 6b7d92fa491295c61a8a7b4e2466edf08e550d13 # Parent d47122a0e4b4e3b789b9df6f17e616bb28ddc044 Keep hog facing direction while on parachute diff -r d47122a0e4b4 -r 6b7d92fa4912 hedgewars/uGearsHedgehog.pas --- a/hedgewars/uGearsHedgehog.pas Sat Jun 15 12:10:42 2019 +0200 +++ b/hedgewars/uGearsHedgehog.pas Sat Jun 15 12:58:01 2019 +0200 @@ -270,7 +270,7 @@ newGear: PGear; CurWeapon: PAmmo; usedAmmoType: TAmmoType; - altUse: boolean; + altUse, faceLeft: boolean; elastic: hwFloat; begin newGear:= nil; @@ -414,7 +414,10 @@ PlaySound(sndBaseballBat) // TODO: Only play if something is hit? end; amParachute: begin + faceLeft:= IsHogFacingLeft(Gear); newGear:= AddGear(hwRound(lx), hwRound(ly), gtParachute, 0, _0, _0, 0); + if faceLeft then + newGear^.Tag:= -1; PlaySound(sndParachute) end; // we save CurWeapon^.Pos (in this case: cursor direction) by using it as (otherwise irrelevant) X value of the new gear. diff -r d47122a0e4b4 -r 6b7d92fa4912 hedgewars/uGearsList.pas --- a/hedgewars/uGearsList.pas Sat Jun 15 12:10:42 2019 +0200 +++ b/hedgewars/uGearsList.pas Sat Jun 15 12:58:01 2019 +0200 @@ -330,7 +330,10 @@ ((GetRandom(90)+128) shl 16) or (($d5+c) shl 8) or $ff} end; - gtParachute: gear^.Z:= cCurrHHZ; + gtParachute: begin + gear^.Tag:= 1; // hog face dir. 1 = right, -1 = left + gear^.Z:= cCurrHHZ; + end; gtShell: begin gear^.Elasticity:= _0_8; gear^.Friction:= _0_8; diff -r d47122a0e4b4 -r 6b7d92fa4912 hedgewars/uGearsRender.pas --- a/hedgewars/uGearsRender.pas Sat Jun 15 12:10:42 2019 +0200 +++ b/hedgewars/uGearsRender.pas Sat Jun 15 12:58:01 2019 +0200 @@ -662,6 +662,17 @@ dec(sy,20); end; gtTeleport: defaultPos:= false; + gtParachute: + begin + DrawSpriteRotatedF(sprHHIdle, + sx, + sy, + 0, + CurAmmoGear^.Tag, + 0); + HatVisible:= true; + defaultPos:= false; + end; gtWhip: begin DrawSpriteRotatedF(sprWhip, diff -r d47122a0e4b4 -r 6b7d92fa4912 hedgewars/uGearsUtils.pas --- a/hedgewars/uGearsUtils.pas Sat Jun 15 12:10:42 2019 +0200 +++ b/hedgewars/uGearsUtils.pas Sat Jun 15 12:58:01 2019 +0200 @@ -1861,7 +1861,9 @@ var sign: LongInt; begin sign:= hwSign(Gear^.dX); - if ((Gear^.State and gstHHHJump) <> 0) and (Gear^.Hedgehog^.Effects[heArtillery] = 0) then + if (CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtParachute) then + IsHogFacingLeft:= CurAmmoGear^.Tag = -1 + else if ((Gear^.State and gstHHHJump) <> 0) and (Gear^.Hedgehog^.Effects[heArtillery] = 0) then IsHogFacingLeft:= sign > 0 else IsHogFacingLeft:= sign < 0;