# HG changeset patch # User unc0rr # Date 1237743667 0 # Node ID 30fa1608b54fccd80c9b029ce9f1c4e4fef44c59 # Parent 5be17e24751a64639b97c27e450d739f37013813 nemo's patch for girder + some fixes diff -r 5be17e24751a -r 30fa1608b54f hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Sun Mar 22 17:39:12 2009 +0000 +++ b/hedgewars/GSHandlers.inc Sun Mar 22 17:41:07 2009 +0000 @@ -1414,24 +1414,35 @@ procedure doStepGirder(Gear: PGear); var HHGear: PGear; + x, y, tx, ty: LongInt; begin AllInactive:= false; HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; -if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprAmGirder].Width div 2, - TargetPoint.Y - SpritesData[sprAmGirder].Height div 2, +tx:= TargetPoint.X; +ty:= TargetPoint.Y; +x:= hwRound(HHGear^.X); +y:= hwRound(HHGear^.Y); + +// use a circle instead? +if (abs(tx-x) > 256) or + (abs(ty-y) > 256) or + not TryPlaceOnLand(tx - SpritesData[sprAmGirder].Width div 2, + ty - SpritesData[sprAmGirder].Height div 2, sprAmGirder, Gear^.State, true) then begin - HHGear^.Message:= HHGear^.Message and not gm_Attack; - HHGear^.State:= HHGear^.State and not gstAttacking; HHGear^.State:= HHGear^.State or gstHHChooseTarget; DeleteGear(Gear); - isCursorVisible:= true + isCursorVisible:= true end else begin DeleteGear(Gear); - AfterAttack - end; + OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); + ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); + isCursorVisible:= false + end; +HHGear^.State:= HHGear^.State and not (gstAttacking or gstAttacked); +HHGear^.Message:= HHGear^.Message and not gm_Attack; TargetPoint.X:= NoPointX end; diff -r 5be17e24751a -r 30fa1608b54f hedgewars/uAmmos.pas --- a/hedgewars/uAmmos.pas Sun Mar 22 17:39:12 2009 +0000 +++ b/hedgewars/uAmmos.pas Sun Mar 22 17:41:07 2009 +0000 @@ -226,11 +226,15 @@ procedure SwitchNotHoldedAmmo(var Hedgehog: THedgehog); begin with Hedgehog do - if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_DontHold) <> 0 then + if ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_DontHold) <> 0) or + (Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber > 0) then begin CurAmmo:= 0; CurSlot:= 0; - while (CurSlot <= cMaxSlotIndex) and (Ammo^[CurSlot, CurAmmo].Count = 0) do inc(CurSlot) + while (CurSlot <= cMaxSlotIndex) and + (Ammo^[CurSlot, CurAmmo].Count = 0) and + (Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber > 0) + do inc(CurSlot) end end; diff -r 5be17e24751a -r 30fa1608b54f hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Sun Mar 22 17:39:12 2009 +0000 +++ b/hedgewars/uConsts.pas Sun Mar 22 17:41:07 2009 +0000 @@ -59,7 +59,7 @@ sprCakeWalk, sprCakeDown, sprAMAmmosBW, sprWatermelon, sprEvilTrace, sprHellishBomb, sprSeduction, sprDress, sprCensored, sprDrill, sprHandDrill, sprHandBallgun, sprBalls, - sprPlane, sprHandPlane, sprUtility, sprInvulnerable); + sprPlane, sprHandPlane, sprUtility, sprInvulnerable, sprGirder); TGearType = (gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag, // 3 gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope, // 8 @@ -939,8 +939,7 @@ NumberInCase: 3; Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_NeedTarget or - ammoprop_AttackingPut or - ammoprop_DontHold; + ammoprop_AttackingPut; Count: 1; NumPerTurn: 0; Timer: 0; diff -r 5be17e24751a -r 30fa1608b54f hedgewars/uGears.pas --- a/hedgewars/uGears.pas Sun Mar 22 17:39:12 2009 +0000 +++ b/hedgewars/uGears.pas Sun Mar 22 17:41:07 2009 +0000 @@ -715,7 +715,6 @@ DrawRotated(sprShotgun, hx, hy, hwSign(Gear^.dX), aangle) else DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle); - HatVisible:= true end; gtDEagleShot: DrawRotated(sprDEagle, hx, hy, hwSign(Gear^.dX), aangle); gtBallgun: DrawRotated(sprHandBallgun, hx, hy, hwSign(Gear^.dX), aangle); @@ -881,6 +880,7 @@ DrawRotated(sprHandPlane, hx, hy, hwSign(Gear^.dX), 0); defaultPos:= false end; + amGirder: DrawSprite(sprGirder, sx-256, sy-256, 0); end; case amt of @@ -1254,6 +1254,7 @@ posCaseUtility: begin i:= (GameTicks shr 6) mod 70; if i > 23 then i:= 0; + i:= i mod 12; DrawSprite(sprUtility, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 24 + WorldDy, i); end; end; diff -r 5be17e24751a -r 30fa1608b54f share/hedgewars/Data/Graphics/Hedgehog/amGirder.png Binary file share/hedgewars/Data/Graphics/Hedgehog/amGirder.png has changed