Merge b988d3be7100
authorWuzzy <Wuzzy2@mail.ru>
Sat, 06 Jun 2020 15:43:17 +0200
changeset 15598 d275bb6b85b4
parent 15597 6e72bd61002e (diff)
parent 15595 b988d3be7100 (current diff)
child 15599 dc62f1c13bb2
Merge b988d3be7100
hedgewars/uGearsHandlersMess.pas
--- a/ChangeLog.txt	Fri Jun 05 21:21:48 2020 +0300
+++ b/ChangeLog.txt	Sat Jun 06 15:43:17 2020 +0200
@@ -15,6 +15,7 @@
  * A Classic Fairytale: Mission 1: Fix possibility of getting stuck in “Leap of Faith” section
  * A Space Adventure: The First Stop: Fix broken victory condition when eliminating minions
  * A Space Adventure: Killing the Specialists: Don't award player health if enemy hurts itself
+ * Fix many projectiles not being affected by Heavy Wind after turn end
  * Fix hog getting stuck when opening parachute right after a shoryuken digging through land
  * Fix weapon schemes sometimes not being saved properly
 
--- a/hedgewars/uConsts.pas	Fri Jun 05 21:21:48 2020 +0300
+++ b/hedgewars/uConsts.pas	Sat Jun 06 15:43:17 2020 +0200
@@ -228,6 +228,7 @@
     cSeductionDist = 250; // effect distance of seduction
 
     ExtraTime = 30000; // amount of time (ms) given for using Extra Time
+    MaxMoreWindTime = 5000; // amount of time (ms) for land objects like gfMine to be affected after end of turn
 
     // do not change this value
     cDefaultZoomLevel = 2.0; // 100% zoom
--- a/hedgewars/uGears.pas	Fri Jun 05 21:21:48 2020 +0300
+++ b/hedgewars/uGears.pas	Sat Jun 06 15:43:17 2020 +0200
@@ -595,6 +595,11 @@
             dec(TurnTimeLeft)
         end;
 
+if (TurnTimeLeft = 0) and (ReadyTimeLeft = 0) then
+    inc(TimeNotInTurn)
+else
+    TimeNotInTurn:= 0;
+
 if skipFlag then
     begin
     if TagTurnTimeLeft = 0 then
--- a/hedgewars/uGearsHandlersMess.pas	Fri Jun 05 21:21:48 2020 +0300
+++ b/hedgewars/uGearsHandlersMess.pas	Sat Jun 06 15:43:17 2020 +0200
@@ -535,8 +535,15 @@
 
     if isFalling and (Gear^.State and gstNoGravity = 0) then
         begin
+        // Apply gravity and wind
         Gear^.dY := Gear^.dY + cGravity;
-        if (GameFlags and gfMoreWind <> 0) and (TurnTimeLeft > 0) and
+        if ((GameFlags and gfMoreWind) <> 0) and
+           // Disable gfMoreWind for land objects on turn end to prevent bouncing them forever
+           // This solution is rather ugly, in that it will occassionally suddenly wind physics
+           // while a gear is moving, this can be rather confusing.
+           // TODO: Find a way to make gfMoreWind-affected land objects settle more reliably
+           // and quickler without touching wind itselvs
+           ((not (Gear^.Kind in [gtMine, gtAirMine, gtSMine, gtKnife, gtExplosives])) or (TimeNotInTurn < MaxMoreWindTime)) and
            ((xland or land) = 0) and
            ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) > _0_02.QWordValue) then
             Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density
--- a/hedgewars/uVariables.pas	Fri Jun 05 21:21:48 2020 +0300
+++ b/hedgewars/uVariables.pas	Sat Jun 06 15:43:17 2020 +0200
@@ -105,6 +105,7 @@
     TurnClockActive : boolean;
     TagTurnTimeLeft : Longword;
     ReadyTimeLeft   : Longword;
+    TimeNotInTurn   : Longword; // Milliseconds that passed while no turn is active
     IsGetAwayTime   : boolean;
     GameOver        : boolean;
     cSuddenDTurns   : LongInt;
@@ -2898,6 +2899,7 @@
     GameOver            := false;
     TurnClockActive     := true;
     TagTurnTimeLeft     := 0;
+    TimeNotInTurn       := 0;
     cSuddenDTurns       := 15;
     LastSuddenDWarn     := -2;
     cInitHealth         := 100;