Reset max team health after script may have screwed with it on start. Maybe a script max health reset function could be useful too. Set climbhome hogs to invulnerable while not their turn if needed to avoid accidental mine/dead hog damage. Tweak cake fire boom a bit.
authornemo
Sat, 29 Nov 2014 15:30:33 -0500
changeset 10580 17560eb73b4c
parent 10579 2effda40c3b2
child 10581 f0b4c14a3c62
child 10582 672e7028b1b6
Reset max team health after script may have screwed with it on start. Maybe a script max health reset function could be useful too. Set climbhome hogs to invulnerable while not their turn if needed to avoid accidental mine/dead hog damage. Tweak cake fire boom a bit.
hedgewars/hwengine.pas
hedgewars/uGearsHandlersMess.pas
share/hedgewars/Data/Maps/ClimbHome/map.lua
--- a/hedgewars/hwengine.pas	Sat Nov 29 14:57:07 2014 -0500
+++ b/hedgewars/hwengine.pas	Sat Nov 29 15:30:33 2014 -0500
@@ -55,6 +55,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 function DoTimer(Lag: LongInt): boolean;
 var s: shortstring;
+    t: LongWord;
 begin
     DoTimer:= false;
     inc(RealTicks, Lag);
@@ -90,6 +91,9 @@
             PlayMusic;
             InitZoom(zoom);
             ScriptCall('onGameStart');
+            for t:= 0 to Pred(TeamsCount) do
+                with TeamsArray[t]^ do
+                    MaxTeamHealth:= TeamHealth;
             GameState:= gsGame;
             end;
         gsConfirm, gsGame, gsChat:
--- a/hedgewars/uGearsHandlersMess.pas	Sat Nov 29 14:57:07 2014 -0500
+++ b/hedgewars/uGearsHandlersMess.pas	Sat Nov 29 15:30:33 2014 -0500
@@ -3083,12 +3083,9 @@
 end;
 
 procedure doStepCake(Gear: PGear);
-var
-    HHGear: PGear;
 begin
     AllInactive := false;
 
-    HHGear := Gear^.Hedgehog^.Gear;
     Gear^.CollisionMask:= lfNotCurrentMask;
 
     Gear^.dY:= cMaxWindSpeed * 100;
--- a/share/hedgewars/Data/Maps/ClimbHome/map.lua	Sat Nov 29 14:57:07 2014 -0500
+++ b/share/hedgewars/Data/Maps/ClimbHome/map.lua	Sat Nov 29 15:30:33 2014 -0500
@@ -13,9 +13,9 @@
 local HH = {}
 local MrMine -- in honour of sparkle's first arrival in the cabin
 local YouWon = false
+local HogsAreInvulnerable = false
 local WaterRise = nil
 local Cake = nil
-local CakeWasJustAdded = false
 local CakeTries = 0
 local Stars = {}
 
@@ -58,6 +58,11 @@
         SetGearPosition(h,x,108)
         SetHealth(h,1)
         if x < 1978 then x = x+32 else x = 1818 end
+	if GetEffect(h,heInvulnerable) == 0 then
+	    SetEffect(h,heInvulnerable,1)
+	else
+	    HogsAreInvulnerable = true
+	end
         SetState(h,bor(GetState(h),gstInvisible))
     end
 -- 1925,263 - Mr. Mine position
@@ -76,6 +81,9 @@
     SetWaterLine(32768)
     if CurrentHedgehog ~= nil then
         SetGearPosition(CurrentHedgehog, 1951,32640)
+	if not HogsAreInvulnerable then
+	    SetEffect(CurrentHedgehog,heInvulnerable,0)
+	end
         AddVisualGear(19531,32640,vgtExplosion,0,false)
         SetState(CurrentHedgehog,band(GetState(CurrentHedgehog),bnot(gstInvisible)))
     end
@@ -104,10 +112,22 @@
 
 function FireBoom(x,y,d) -- going to add for rockets too
     AddVisualGear(x,y,vgtExplosion,0,false)
-    -- going to approximate circle by removing corners
+    -- should approximate circle by removing corners
     if BoomFire == nil then BoomFire = {} end
     for i = 0,50 do
-        flame = AddGear(x+GetRandom(d),y+GetRandom(d), gtFlame, gsttmpFlag,  0, 0, 0)
+	fx = GetRandom(d)-div(d,2)
+	fy = GetRandom(d)-div(d,2)
+	if fx<0 then
+	   fdx = -5000-GetRandom(3000)
+	else
+	   fdx = 5000+GetRandom(3000)
+	end
+	if fy<0 then
+	   fdy = -5000-GetRandom(3000)
+	else
+	   fdy = 5000+GetRandom(3000)
+	end
+        flame = AddGear(x+fx, y+fy, gtFlame, gsttmpFlag,  fdx, fdy, 0)
         SetTag(flame, 999999+i)
         Fire[flame]=1
 --        BoomFire[flame]=1
@@ -119,10 +139,6 @@
     if math.random(20) == 1 then
         AddVisualGear(2012,56,vgtSmoke,0,false)
     end
-    if CakeWasJustAdded then
-        FollowGear(CurrentHedgehog)
-        CakeWasJustAdded = false
-    end
     --if BoomFire ~= nil then
     --    for f,i in pairs(BoomFire) do
     --        if band(GetState(f),gstCollision~=0) then DeleteGear(f) end
@@ -151,7 +167,7 @@
             Cake = nil
         end
         if gearIsInCircle(CurrentHedgehog,cx,cy,450) then
-            FireBoom(cx,cy,350) -- todo animate
+            FireBoom(cx,cy,200) -- todo animate
             DeleteGear(Cake)
             Cake = nil
         end
@@ -216,8 +232,7 @@
                cy = 400 end
             Cake = AddGear(GetRandom(2048), cy, gtCake, 0, 0, 0, 0)
             SetHealth(Cake,999999)
-            CakeWasJustAdded = true
-            CakeTries = CakeTries + 1  -- just try twice right now
+            CakeTries = CakeTries + 1 
         end
         if (y > 286) or (y < 286 and MaxHeight > 286) then
             if y < MaxHeight and y > 286 then MaxHeight = y end