Fix timebox being usable in SD w/ damage=0
authorWuzzy <Wuzzy2@mail.ru>
Thu, 08 Feb 2018 07:09:39 +0100
changeset 12920 21827fc9ca98
parent 12919 0f02dd1ff4c9
child 12921 684621f7eab3
Fix timebox being usable in SD w/ damage=0
ChangeLog.txt
hedgewars/uGears.pas
hedgewars/uGearsUtils.pas
hedgewars/uStore.pas
hedgewars/uVariables.pas
--- a/ChangeLog.txt	Wed Feb 07 12:30:11 2018 +0100
+++ b/ChangeLog.txt	Thu Feb 08 07:09:39 2018 +0100
@@ -4,6 +4,7 @@
 Game:
  + New weapon: Minigun
  + Change weapon icons: Mudball, air mine
+ * Fix time box being usable in Sudden Death with 0 health decrease
  * Fix chat input key being sometimes registered twice
 
 Content:
--- a/hedgewars/uGears.pas	Wed Feb 07 12:30:11 2018 +0100
+++ b/hedgewars/uGears.pas	Thu Feb 08 07:09:39 2018 +0100
@@ -1044,20 +1044,27 @@
         exit;
 
     SuddenDeath:= true;
+    SuddenDeathActive:= true;
+
+    // Special effects (only w/ health decrease)
     if cHealthDecrease <> 0 then
     begin
         SuddenDeathDmg:= true;
-        // flash
+        // White screen flash
         ScreenFade:= sfFromWhite;
         ScreenFadeValue:= sfMax;
         ScreenFadeSpeed:= 1;
 
+        // Clouds, flakes, sky tint
         ChangeToSDClouds;
         ChangeToSDFlakes;
         SetSkyColor(SDSkyColor.r * (SDTint.r/255) / 255, SDSkyColor.g * (SDTint.g/255) / 255, SDSkyColor.b * (SDTint.b/255) / 255);
-        Ammoz[amTardis].SkipTurns:= 9999;
-        Ammoz[amTardis].Probability:= 0;
     end;
+
+    // Disable tardis
+    Ammoz[amTardis].SkipTurns:= 9999;
+    Ammoz[amTardis].Probability:= 0;
+
     AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState);
     ScriptCall('onSuddenDeath');
     playSound(sndSuddenDeath);
--- a/hedgewars/uGearsUtils.pas	Wed Feb 07 12:30:11 2018 +0100
+++ b/hedgewars/uGearsUtils.pas	Thu Feb 08 07:09:39 2018 +0100
@@ -1192,7 +1192,7 @@
     usable:= true;
     HH:= HHGear^.Hedgehog;
     if HHGear <> nil then
-    if (HHGear = nil) or (HH^.King) or (SuddenDeathDmg) then
+    if (HHGear = nil) or (HH^.King) or (SuddenDeathActive) then
         usable:= false;
     cnt:= 0;
     for j:= 0 to Pred(HH^.Team^.Clan^.TeamsNumber) do
--- a/hedgewars/uStore.pas	Wed Feb 07 12:30:11 2018 +0100
+++ b/hedgewars/uStore.pas	Thu Feb 08 07:09:39 2018 +0100
@@ -1000,7 +1000,7 @@
 
 if (CurrentTeam <> nil) and (Ammoz[atype].SkipTurns >= CurrentTeam^.Clan^.TurnNumber) then // weapon or utility is not yet available
     begin
-    if (atype = amTardis) and (suddenDeathDmg) then
+    if (atype = amTardis) and (SuddenDeathActive) then
         extra:= trmsg[sidNotAvailableInSD]
     else
         extra:= trmsg[sidNotYetAvailable];
--- a/hedgewars/uVariables.pas	Wed Feb 07 12:30:11 2018 +0100
+++ b/hedgewars/uVariables.pas	Thu Feb 08 07:09:39 2018 +0100
@@ -2480,8 +2480,9 @@
     AllInactive: boolean;
     PrvInactive: boolean;
     KilledHHs: Longword;
-    SuddenDeath: Boolean;
-    SuddenDeathDmg: Boolean;
+    SuddenDeath: Boolean; // If the Sudden Death check has been made
+    SuddenDeathActive: Boolean; // Is in Sudden Death with any gameplay effect
+    SuddenDeathDmg: Boolean; // Is in Sudden Death with damage
     SpeechType: Longword;
     SpeechText: shortstring;
     PlacingHogs: boolean; // a convenience flag to indicate placement of hogs is still in progress