# HG changeset patch # User Wuzzy # Date 1508793994 -7200 # Node ID c162995831d869afc25028b4162c53fecff9b30a # Parent 058a5d373e4ac9047150556611bb991e46856507 Fix cake party face not working across wrap world border diff -r 058a5d373e4a -r c162995831d8 hedgewars/uGearsHandlersMess.pas --- a/hedgewars/uGearsHandlersMess.pas Mon Oct 23 22:45:35 2017 +0200 +++ b/hedgewars/uGearsHandlersMess.pas Mon Oct 23 23:26:34 2017 +0200 @@ -3198,6 +3198,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepCakeExpl(Gear: PGear); +var gi: PGear; begin AllInactive := false; @@ -3206,6 +3207,14 @@ exit; InCinematicMode:= false; + gi := GearsList; + while gi <> nil do + begin + if gi^.Kind = gtHedgehog then + gi^.State := gi^.State and (not gstLoser); + gi:= gi^.NextGear; + end; + doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); AfterAttack; DeleteGear(Gear) @@ -3215,7 +3224,7 @@ var gi: PGear; dmg, dmgBase, partyEpicness, i: LongInt; - fX, fY, tdX, tdY: hwFloat; + fX, fY: hwFloat; sparkles: PVisualGear; begin AllInactive := false; @@ -3242,10 +3251,8 @@ if gi^.Kind = gtHedgehog then begin dmg:= 0; - tdX:= gi^.X-fX; - tdY:= gi^.Y-fY; - if hwRound(hwAbs(tdX)+hwAbs(tdY)) < dmgBase then - dmg:= dmgBase - max(hwRound(Distance(tdX, tdY)),gi^.Radius); + if hwRound(PointDistance(gi^.X, fX, gi^.Y, fY, true)) < dmgBase then + dmg:= dmgBase - max(hwRound(PointDistance(gi^.X, fX, gi^.Y, fY, true)), gi^.Radius); if (dmg > 1) then dmg:= ModifyDamage(min(dmg div 2, cakeDmg), gi); if (dmg > 1) then if (CurrentHedgehog^.Gear = gi) and (gi^.Hedgehog^.Effects[heInvulnerable] = 0) then