--- a/hedgewars/GSHandlers.inc Fri Jul 25 21:13:35 2008 +0000
+++ b/hedgewars/GSHandlers.inc Fri Jul 25 22:28:22 2008 +0000
@@ -1481,10 +1481,16 @@
Gear^.doStep:= @doStepKamikazeIdle
end;
+////////////////////////////////////////////////////////////////////////////////
+const cakeh = 27;
+var CakePoints: array[0..Pred(cakeh)] of record x, y: hwFloat; end;
+ CakeI: Longword;
+
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;
da: LongInt;
+ tdx, tdy: hwFloat;
procedure PrevAngle;
begin
@@ -1500,7 +1506,6 @@
inc(Gear^.Tag);
if Gear^.Tag < 5 then exit;
-
dA:= hwSign(Gear^.dX);
xx:= dirs[Gear^.Angle].x;
yy:= dirs[Gear^.Angle].y;
@@ -1526,6 +1531,16 @@
if not TestCollisionYwithGear(Gear, yyn) then NextAngle
end;
+if Gear^.Tag = 0 then
+ begin
+ CakeI:= (CakeI + 1) mod cakeh;
+ tdx:= CakePoints[CakeI].x - Gear^.X;
+ tdy:= - CakePoints[CakeI].y + Gear^.Y;
+ CakePoints[CakeI].x:= Gear^.X;
+ CakePoints[CakeI].y:= Gear^.Y;
+ Gear^.DirAngle:= DxDy2Angle(tdx, tdy);
+ end;
+
dec(Gear^.Health);
if (Gear^.Health = 0) or ((Gear^.Message and gm_Attack) <> 0) then
begin
@@ -1535,13 +1550,29 @@
end
end;
+procedure doStepCakeUp(Gear: PGear);
+var i: Longword;
+begin
+AllInactive:= false;
+
+ begin
+ for i:= 0 to Pred(cakeh) do
+ begin
+ CakePoints[i].x:= Gear^.X;
+ CakePoints[i].y:= Gear^.Y
+ end;
+ CakeI:= 0;
+ Gear^.doStep:= @doStepCakeWork
+ end
+end;
+
procedure doStepCakeFall(Gear: PGear);
begin
AllInactive:= false;
Gear^.dY:= Gear^.dY + cGravity;
if TestCollisionYwithGear(Gear, 1) then
- Gear^.doStep:= @doStepCakeWork
+ Gear^.doStep:= @doStepCakeUp
else
begin
Gear^.Y:= Gear^.Y + Gear^.dY;
@@ -1555,6 +1586,7 @@
AllInactive:= false;
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
+HHGear^.Message:= HHGear^.Message and (not gm_Attack);
DeleteCI(HHGear);
Gear^.doStep:= @doStepCakeFall
--- a/hedgewars/uConsts.pas Fri Jul 25 21:13:35 2008 +0000
+++ b/hedgewars/uConsts.pas Fri Jul 25 22:28:22 2008 +0000
@@ -46,7 +46,8 @@
sprHandBlowTorch, sprBlowTorch, sprTeleport, sprHHDeath,
sprShotgun, sprDEagle, sprHHIdle, sprMortar, sprTurnsLeft,
sprHat, sprKamikaze, sprWhip, sprKowtow, sprSad, sprWave,
- sprHurrah, sprLemonade, sprExplPart, sprExplPart2);
+ sprHurrah, sprLemonade, sprExplPart, sprExplPart2,
+ sprCakeWalk);
TGearType = (gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope,
@@ -415,7 +416,9 @@
(FileName: 'ExplPart'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
Width: 32; Height: 32; saveSurf: false),// sprExplPart
(FileName: 'ExplPart2'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
- Width: 32; Height: 32; saveSurf: false) // sprExplPart2
+ 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
);
Wavez: array [TWave] of record
--- a/hedgewars/uGears.pas Fri Jul 25 21:13:35 2008 +0000
+++ b/hedgewars/uGears.pas Fri Jul 25 22:28:22 2008 +0000
@@ -315,7 +315,7 @@
end;
gtCake: begin
Result^.Health:= 3072;
- Result^.Radius:= 5;
+ Result^.Radius:= 7;
if hwSign(dX) > 0 then Result^.Angle:= 1 else Result^.Angle:= 3
end;
end;
@@ -1034,7 +1034,7 @@
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: DrawSprite(sprTarget, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0);
+ gtCake: DrawRotatedf(sprCakeWalk, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, hwSign(Gear^.dX), Gear^.DirAngle + hwSign(Gear^.dX) * 90);
end;
Gear:= Gear^.NextGear
end;
Binary file share/hedgewars/Data/Graphics/Cake_walk.png has changed