# HG changeset patch # User Wuzzy # Date 1562669758 -7200 # Node ID deaa316af414f922b0f341de5e783e909f79e5e9 # Parent bf11546c19209acd0d693a413a7171a2f36f6688 TimeBox: Fix buggy behaviour if hog took damage or died before time box arrived diff -r bf11546c1920 -r deaa316af414 ChangeLog.txt --- a/ChangeLog.txt Mon Jul 08 22:29:20 2019 +0200 +++ b/ChangeLog.txt Tue Jul 09 12:55:58 2019 +0200 @@ -27,6 +27,7 @@ * Fix hedgehogs being pushed around (and other collision bugs) when they overlap * Fix homing bee flying weird if passing wrap world edge or target was placed beyond it * Fix air mine not colliding with crates initially + * Fix buggy behaviour of time box if hog took damage or died before it arrived * Fix poison damage not working in first round * Use player-chosen team identity in campaigns and singleplayer missions * Fix player-chosen teams ignoring custom team controls in campaigns diff -r bf11546c1920 -r deaa316af414 hedgewars/uGearsHandlersMess.pas --- a/hedgewars/uGearsHandlersMess.pas Mon Jul 08 22:29:20 2019 +0200 +++ b/hedgewars/uGearsHandlersMess.pas Tue Jul 09 12:55:58 2019 +0200 @@ -6233,6 +6233,20 @@ s: ansistring; begin HH:= Gear^.Hedgehog; +if Gear^.Tag = 0 then + begin + if HH^.Gear <> nil then + begin + if (HH^.Gear^.Damage <> 0) or (HH^.Gear^.Health = 0) or + ((HH^.Gear^.State and (gstMoving or gstHHDeath or gstHHGone or gstDrowning)) <> 0) then + Gear^.Tag:= 1; + end + else if HH^.GearHidden = nil then + Gear^.Tag:= 1; + if (Gear^.Tag = 1) and (Gear = CurAmmoGear) then + CurAmmoGear:= nil; + end; + if Gear^.Pos = 2 then begin StopSoundChan(Gear^.SoundChannel); @@ -6241,11 +6255,12 @@ begin if (HH^.Gear <> nil) and (HH^.Gear^.State and gstInvisible = 0) then begin - AfterAttack; - if Gear = CurAmmoGear then CurAmmoGear := nil; - if (HH^.Gear^.Damage = 0) and (HH^.Gear^.Health > 0) and - ((Gear^.State and (gstMoving or gstHHDeath or gstHHGone)) = 0) then - HideHog(HH) + if Gear^.Tag = 0 then + AfterAttack; + if Gear = CurAmmoGear then + CurAmmoGear:= nil; + if Gear^.Tag = 0 then + HideHog(HH); end else if (HH^.GearHidden <> nil) then begin @@ -6267,8 +6282,7 @@ begin inc(Gear^.Power); if (Gear^.Power = 172) and (HH^.Gear <> nil) and - (HH^.Gear^.Damage = 0) and (HH^.Gear^.Health > 0) and - ((HH^.Gear^.State and (gstMoving or gstHHDeath or gstHHGone)) = 0) then + (Gear^.Tag = 0) then with HH^.Gear^ do begin State:= State or gstAnimation; diff -r bf11546c1920 -r deaa316af414 hedgewars/uGearsList.pas --- a/hedgewars/uGearsList.pas Mon Jul 08 22:29:20 2019 +0200 +++ b/hedgewars/uGearsList.pas Tue Jul 09 12:55:58 2019 +0200 @@ -582,7 +582,8 @@ gear^.Elasticity:= _0_3; end; gtTardis: begin - gear^.Pos:= 1; + gear^.Pos:= 1; // tardis phase + gear^.Tag:= 0; // 1 = hedgehog died, disappeared, took damage or moved gear^.Z:= cCurrHHZ+1; end; gtMortar: begin