Animate falling and waking up cake
authorunc0rr
Sun, 27 Jul 2008 13:32:44 +0000
changeset 1108 c77267d982ee
parent 1107 ee873ada9e86
child 1109 87c44c14fdd4
Animate falling and waking up cake
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/uConsts.pas
hedgewars/uGears.pas
share/hedgewars/Data/Graphics/Cake_down.png
--- a/hedgewars/GSHandlers.inc	Sun Jul 27 13:32:15 2008 +0000
+++ b/hedgewars/GSHandlers.inc	Sun Jul 27 13:32:44 2008 +0000
@@ -1504,7 +1504,7 @@
 	
 begin
 inc(Gear^.Tag);
-if Gear^.Tag < 5 then exit;
+if Gear^.Tag < 7 then exit;
 
 dA:= hwSign(Gear^.dX);
 xx:= dirs[Gear^.Angle].x;
@@ -1555,6 +1555,11 @@
 begin
 AllInactive:= false;
 
+inc(Gear^.Tag);
+if Gear^.Tag < 85 then exit;
+Gear^.Tag:= 0;
+
+if Gear^.Pos = 0 then
 	begin
 	for i:= 0 to Pred(cakeh) do
 		begin
@@ -1562,8 +1567,9 @@
 		CakePoints[i].y:= Gear^.Y
 		end;
 	CakeI:= 0;
+	Gear^.Pos:= 6;
 	Gear^.doStep:= @doStepCakeWork
-	end
+	end else dec(Gear^.Pos)
 end;
 
 procedure doStepCakeFall(Gear: PGear);
--- a/hedgewars/HHHandlers.inc	Sun Jul 27 13:32:15 2008 +0000
+++ b/hedgewars/HHHandlers.inc	Sun Jul 27 13:32:44 2008 +0000
@@ -159,7 +159,7 @@
                        amSwitch: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtSwitcher, 0, _0, _0, 0);
                        amMortar: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtMortar,  0, xx*cMaxPower/cPowerDivisor, yy*cMaxPower/cPowerDivisor, 0);
                        amKamikaze: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0);
-                         amCake: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtCake, 0, xx, _0, 0);
+                         amCake: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 3, hwRound(Y), gtCake, 0, xx, _0, 0);
                   end;
 
         uStats.AmmoUsed(Ammo^[CurSlot, CurAmmo].AmmoType);
--- a/hedgewars/uConsts.pas	Sun Jul 27 13:32:15 2008 +0000
+++ b/hedgewars/uConsts.pas	Sun Jul 27 13:32:44 2008 +0000
@@ -47,7 +47,7 @@
                    sprShotgun, sprDEagle, sprHHIdle, sprMortar, sprTurnsLeft,
                    sprHat, sprKamikaze, sprWhip, sprKowtow, sprSad, sprWave,
                    sprHurrah, sprLemonade, sprExplPart, sprExplPart2,
-                   sprCakeWalk);
+                   sprCakeWalk, sprCakeDown);
 
      TGearType  = (gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
                    gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope,
@@ -418,7 +418,9 @@
                      (FileName:  'ExplPart2'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
                       Width:  32; Height: 32; saveSurf: false),// sprExplPart2
                      (FileName:  'Cake_walk'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-                      Width:  64; Height: 64; saveSurf: false) // sprCakeWalk
+                      Width:  64; Height: 64; saveSurf: false),// sprCakeWalk
+                     (FileName:  'Cake_down'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+                      Width:  64; Height: 64; saveSurf: false) // sprCakeDown
                      );
 
 	Wavez: array [TWave] of record
--- a/hedgewars/uGears.pas	Sun Jul 27 13:32:15 2008 +0000
+++ b/hedgewars/uGears.pas	Sun Jul 27 13:32:44 2008 +0000
@@ -314,8 +314,9 @@
                 Result^.Radius:= 20
                 end;
         gtCake: begin
-                Result^.Health:= 3072;
+                Result^.Health:= 4096;
                 Result^.Radius:= 7;
+                Result^.Pos:= 5;
                 if hwSign(dX) > 0 then Result^.Angle:= 1 else Result^.Angle:= 3
                 end;
      end;
@@ -1034,7 +1035,10 @@
         gtSwitcher: DrawSprite(sprSwitch, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 56 + WorldDy, (GameTicks shr 6) mod 12);
           gtTarget: DrawSprite(sprTarget, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0);
           gtMortar: DrawRotated(sprMortar, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
-          gtCake: DrawRotatedf(sprCakeWalk, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, (GameTicks div 32) mod 6, hwSign(Gear^.dX), Gear^.DirAngle + hwSign(Gear^.dX) * 90);
+          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)
               end;
       Gear:= Gear^.NextGear
       end;
Binary file share/hedgewars/Data/Graphics/Cake_down.png has changed