# HG changeset patch # User Wuzzy # Date 1547395335 -3600 # Node ID 833ab5b359e51d8cfb66b5c25741051d10f4182c # Parent 599f136d4f32a66fb855b1ca72496801115be20b Deny air attack in bounce world edge if target is in "impossible" position diff -r 599f136d4f32 -r 833ab5b359e5 hedgewars/uGearsHandlersMess.pas --- a/hedgewars/uGearsHandlersMess.pas Sun Jan 13 15:54:10 2019 +0100 +++ b/hedgewars/uGearsHandlersMess.pas Sun Jan 13 17:02:15 2019 +0100 @@ -3044,9 +3044,42 @@ end; procedure doStepAirAttack(Gear: PGear); +var valid: boolean; + HHGear: PGear; + planeY: LongInt; begin AllInactive := false; + planeY:= topY - 300; + valid:= true; + if (WorldEdge = weBounce) then + if (Gear^.X.QWordValue = 0) and (Gear^.Target.X > rightX) then + valid:= false + else if (Gear^.X.QWordValue <> 0) and (Gear^.Target.X < leftX) then + valid:= false + else if (Gear^.Target.Y < planeY) then + valid:= false; + + if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) then + HHGear:= Gear^.Hedgehog^.Gear; + + if (not valid) then + begin + if (HHGear <> nil) then + begin + HHGear^.Message := HHGear^.Message and (not gmAttack); + HHGear^.State := HHGear^.State and (not gstAttacking); + HHGear^.State := HHGear^.State or gstChooseTarget; + isCursorVisible := true; + end; + DeleteGear(Gear); + PlaySound(sndDenied); + exit; + end; + + if (HHGear <> nil) then + PlaySoundV(sndIncoming, Gear^.Hedgehog^.Team^.voicepack); + if Gear^.X.QWordValue = 0 then begin Gear^.Tag := 1; @@ -3058,7 +3091,7 @@ Gear^.X := int2hwFloat(max(LAND_WIDTH,4096) + 2048); end; - Gear^.Y := int2hwFloat(topY-300); + Gear^.Y := int2hwFloat(planeY); Gear^.dX := int2hwFloat(Gear^.Target.X) - int2hwFloat(Gear^.Tag * (Gear^.Health-1) * Gear^.Damage) / 2; // calcs for Napalm Strike, so that it will hit the target (without wind at least :P) diff -r 599f136d4f32 -r 833ab5b359e5 hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Sun Jan 13 15:54:10 2019 +0100 +++ b/hedgewars/uVariables.pas Sun Jan 13 17:02:15 2019 +0100 @@ -1290,7 +1290,7 @@ Timer: 0; Pos: 0; AmmoType: amAirAttack; - AttackVoice: sndIncoming; + AttackVoice: sndNone; // handled in doStepAirAttack Bounciness: defaultBounciness); Slot: 5; TimeAfterTurn: 0; @@ -1318,7 +1318,7 @@ Timer: 0; Pos: 0; AmmoType: amMineStrike; - AttackVoice: sndIncoming; + AttackVoice: sndNone; // handled in doStepAirAttack Bounciness: defaultBounciness); Slot: 5; TimeAfterTurn: 0; @@ -1615,7 +1615,7 @@ Timer: 0; Pos: 0; AmmoType: amNapalm; - AttackVoice: sndIncoming; + AttackVoice: sndNone; // handled in doStepAirAttack Bounciness: defaultBounciness); Slot: 5; TimeAfterTurn: 0; @@ -2222,7 +2222,7 @@ Timer: 5000; Pos: 0; AmmoType: amDrillStrike; - AttackVoice: sndIncoming; + AttackVoice: sndNone; // handled in doStepAirAttack Bounciness: defaultBounciness); Slot: 5; TimeAfterTurn: 0;