Water rises after 25 mins of round, health is decreased after 20 mins
authorunc0rr
Sun, 06 Jul 2008 19:31:12 +0000
changeset 1055 9af540b23409
parent 1054 80225c6af656
child 1056 bb33a634a4b0
Water rises after 25 mins of round, health is decreased after 20 mins
hedgewars/uGears.pas
hedgewars/uMisc.pas
--- a/hedgewars/uGears.pas	Sun Jul 06 17:45:16 2008 +0000
+++ b/hedgewars/uGears.pas	Sun Jul 06 19:31:12 2008 +0000
@@ -402,6 +402,30 @@
 	end;
 end;
 
+function WaterMachine: boolean;
+const
+	decStep: Longword = 0;
+	LastTurn: LongWord = 0;
+var i: LongWord;
+begin
+if (decStep = 0) and (LastTurn < FinishedTurnsTotal) then
+	begin
+	LastTurn:= FinishedTurnsTotal;
+	decStep:= 40
+	end;
+
+if decStep <> 0 then
+	begin
+	dec(decStep);
+	dec(cWaterLine);
+	for i:= 0 to 2047 do
+		Land[cWaterLine, i]:= 0;
+	SetAllToActive
+	end;
+
+WaterMachine:= decStep <> 0;
+end;
+
 procedure AddDamageTag(X, Y, Damage: LongWord; Gear: PGear);
 begin
 if cAltDamage then
@@ -411,7 +435,8 @@
 procedure ProcessGears;
 const delay: LongWord = 0;
       step: (stDelay, stChDmg, stTurnReact,
-             stAfterDelay, stChWin, stHealth, stSpawn, stNTurn) = stDelay;
+             stAfterDelay, stChWin, stWater, stHealth,
+             stSpawn, stNTurn) = stDelay;
 
 var Gear, t: PGear;
 begin
@@ -455,7 +480,22 @@
                     inc(step)
                  end;
         stChWin: if not CheckForWin then inc(step) else step:= stDelay;
-       stHealth: if (cHealthDecrease = 0)
+        stWater: begin
+                 if GameTicks > 25 * 60 * 1000 then bWaterRising:= true;
+
+                 if not bWaterRising then inc(step);
+                 if delay = 0 then
+                    delay:= 17
+                 else
+                    dec(delay);
+
+                 if delay = 0 then
+                    if not WaterMachine then inc(step)
+                 end;
+       stHealth: begin
+                 if GameTicks > 20 * 60 * 1000 then cHealthDecrease:= 5;
+
+                 if (cHealthDecrease = 0)
                    or bBetweenTurns
                    or isInMultiShoot
                    or (FinishedTurnsTotal = 0) then inc(step)
@@ -463,7 +503,8 @@
                     bBetweenTurns:= true;
                     HealthMachine;
                     step:= stChDmg
-                    end;
+                    end
+                 end;
         stSpawn: begin
                  if not isInMultiShoot then SpawnBoxOfSmth;
                  inc(step)
--- a/hedgewars/uMisc.pas	Sun Jul 06 17:45:16 2008 +0000
+++ b/hedgewars/uMisc.pas	Sun Jul 06 19:31:12 2008 +0000
@@ -71,7 +71,8 @@
 	cInactDelay   : Longword = 1500;
 
 	bBetweenTurns: boolean = false;
-	cHealthDecrease: LongWord = 1;
+	cHealthDecrease: LongWord = 0;
+	bWaterRising   : Boolean = false;
 
 {$WARNINGS OFF}
 	cAirPlaneSpeed: hwFloat = (isNegative: false; QWordValue:   6012954214); // 1.4