- Cake sits down before exploding
authorunc0rr
Sun, 27 Jul 2008 13:44:04 +0000
changeset 1109 87c44c14fdd4
parent 1108 c77267d982ee
child 1110 3660bbfc1cba
- Cake sits down before exploding - Cake is drawn in front of hedgehogs
hedgewars/GSHandlers.inc
hedgewars/uConsts.pas
hedgewars/uGears.pas
--- a/hedgewars/GSHandlers.inc	Sun Jul 27 13:32:44 2008 +0000
+++ b/hedgewars/GSHandlers.inc	Sun Jul 27 13:44:04 2008 +0000
@@ -1486,6 +1486,24 @@
 var CakePoints: array[0..Pred(cakeh)] of record x, y: hwFloat; end;
 	CakeI: Longword;
 
+procedure doStepCakeDown(Gear: PGear);
+var i: Longword;
+begin
+AllInactive:= false;
+
+inc(Gear^.Tag);
+if Gear^.Tag < 100 then exit;
+Gear^.Tag:= 0;
+
+if Gear^.Pos = 0 then
+	begin
+	doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 75, EXPLAutoSound);
+	AfterAttack;
+	DeleteGear(Gear)
+	end else dec(Gear^.Pos)
+end;
+
+
 procedure doStepCakeWork(Gear: PGear);
 const dirs: array[0..3] of TPoint = ((x: 0; y: -1), (x: 1; y: 0),(x: 0; y: 1),(x: -1; y: 0));
 var xx, yy, xxn, yyn: LongInt;
@@ -1544,9 +1562,8 @@
 dec(Gear^.Health);
 if (Gear^.Health = 0) or ((Gear^.Message and gm_Attack) <> 0) then
 	begin
-	doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 75, EXPLAutoSound);
-	AfterAttack;
-	DeleteGear(Gear)
+	FollowGear:= Gear;
+	Gear^.doStep:= @doStepCakeDown
 	end
 end;
 
@@ -1556,10 +1573,10 @@
 AllInactive:= false;
 
 inc(Gear^.Tag);
-if Gear^.Tag < 85 then exit;
+if Gear^.Tag < 100 then exit;
 Gear^.Tag:= 0;
 
-if Gear^.Pos = 0 then
+if Gear^.Pos = 6 then
 	begin
 	for i:= 0 to Pred(cakeh) do
 		begin
@@ -1567,9 +1584,8 @@
 		CakePoints[i].y:= Gear^.Y
 		end;
 	CakeI:= 0;
-	Gear^.Pos:= 6;
 	Gear^.doStep:= @doStepCakeWork
-	end else dec(Gear^.Pos)
+	end else inc(Gear^.Pos)
 end;
 
 procedure doStepCakeFall(Gear: PGear);
--- a/hedgewars/uConsts.pas	Sun Jul 27 13:32:44 2008 +0000
+++ b/hedgewars/uConsts.pas	Sun Jul 27 13:44:04 2008 +0000
@@ -150,6 +150,7 @@
 
 	cHHZ = 1000;
 	cCurrHHZ = Succ(cHHZ);
+	cOnHHZ = 2000;
 
 	cShotgunRadius = 22;
 	cBlowTorchC    = 6;
--- a/hedgewars/uGears.pas	Sun Jul 27 13:32:44 2008 +0000
+++ b/hedgewars/uGears.pas	Sun Jul 27 13:44:04 2008 +0000
@@ -316,7 +316,7 @@
         gtCake: begin
                 Result^.Health:= 4096;
                 Result^.Radius:= 7;
-                Result^.Pos:= 5;
+                Result^.Z:= cOnHHZ;
                 if hwSign(dX) > 0 then Result^.Angle:= 1 else Result^.Angle:= 3
                 end;
      end;
@@ -1038,7 +1038,7 @@
           gtCake: if Gear^.Pos = 6 then
                      DrawRotatedf(sprCakeWalk, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle + hwSign(Gear^.dX) * 90)
                   else
-                     DrawRotatedf(sprCakeDown, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Pos, hwSign(Gear^.dX), 0)
+                     DrawRotatedf(sprCakeDown, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 5 - Gear^.Pos, hwSign(Gear^.dX), 0)
               end;
       Gear:= Gear^.NextGear
       end;