--- a/hedgewars/uGearsHandlers.pas Fri Jan 10 11:35:02 2014 -0500
+++ b/hedgewars/uGearsHandlers.pas Fri Jan 10 22:56:10 2014 +0400
@@ -23,7 +23,7 @@
uses uTypes;
-procedure cakeStep(Gear: PGear);
+function cakeStep(Gear: PGear): boolean;
implementation
@@ -35,15 +35,17 @@
procedure PrevAngle(Gear: PGear; dA: LongInt); inline;
begin
+ inc(Gear^.WDTimer);
Gear^.Angle := (LongInt(Gear^.Angle) - dA) and 3
end;
procedure NextAngle(Gear: PGear; dA: LongInt); inline;
begin
+ inc(Gear^.WDTimer);
Gear^.Angle := (LongInt(Gear^.Angle) + dA) and 3
end;
-procedure cakeStep(Gear: PGear);
+function cakeStep(Gear: PGear): boolean;
var
xx, yy, xxn, yyn: LongInt;
dA: LongInt;
@@ -57,30 +59,40 @@
if (xx = 0) then
if TestCollisionYwithGear(Gear, yy) <> 0 then
PrevAngle(Gear, dA)
- else
- begin
- Gear^.Tag := 0;
- Gear^.Y := Gear^.Y + int2hwFloat(yy);
- if TestCollisionXwithGear(Gear, xxn) = 0 then
+ else
begin
- Gear^.X := Gear^.X + int2hwFloat(xxn);
- NextAngle(Gear, dA)
+ Gear^.Tag := 0;
+
+ if TestCollisionXwithGear(Gear, xxn) <> 0 then
+ Gear^.WDTimer:= 0;
+
+ Gear^.Y := Gear^.Y + int2hwFloat(yy);
+ if TestCollisionXwithGear(Gear, xxn) = 0 then
+ begin
+ Gear^.X := Gear^.X + int2hwFloat(xxn);
+ NextAngle(Gear, dA)
+ end
end;
- end;
if (yy = 0) then
if TestCollisionXwithGear(Gear, xx) <> 0 then
PrevAngle(Gear, dA)
- else
- begin
- Gear^.Tag := 0;
- Gear^.X := Gear^.X + int2hwFloat(xx);
- if TestCollisionYwithGear(Gear, yyn) = 0 then
+ else
begin
- Gear^.Y := Gear^.Y + int2hwFloat(yyn);
- NextAngle(Gear, dA)
+ Gear^.Tag := 0;
+
+ if TestCollisionYwithGear(Gear, yyn) <> 0 then
+ Gear^.WDTimer:= 0;
+
+ Gear^.X := Gear^.X + int2hwFloat(xx);
+ if TestCollisionYwithGear(Gear, yyn) = 0 then
+ begin
+ Gear^.Y := Gear^.Y + int2hwFloat(yyn);
+ NextAngle(Gear, dA)
+ end
end;
- end;
+
+ cakeStep:= Gear^.WDTimer < 4
end;
end.
--- a/hedgewars/uGearsHandlersMess.pas Fri Jan 10 11:35:02 2014 -0500
+++ b/hedgewars/uGearsHandlersMess.pas Fri Jan 10 22:56:10 2014 +0400
@@ -2943,7 +2943,7 @@
exit
end;
- cakeStep(Gear);
+ if not cakeStep(Gear) then Gear^.doStep:= @doStepCakeFall;
if Gear^.Tag = 0 then
begin
--- a/hedgewars/uTypes.pas Fri Jan 10 11:35:02 2014 -0500
+++ b/hedgewars/uTypes.pas Fri Jan 10 22:56:10 2014 +0400
@@ -264,7 +264,7 @@
// These are frequently overridden to serve some other purpose
Pos: Longword; // Commonly overridden. Example use is posCase values in uConsts.
Angle, Power : Longword; // Used for hog aiming/firing. Angle is rarely used as an Angle otherwise.
- Timer : LongWord; // Typically used for some sort of gear timer. Time to explosion, remaining fuel...
+ Timer, WDTimer : LongWord; // Typically used for some sort of gear timer. Time to explosion, remaining fuel...
Tag: LongInt; // Quite generic. Variety of uses.
FlightTime: Longword; // Initially added for batting of hogs to determine homerun. Used for some firing delays
MsgParam: LongWord; // Initially stored a set of messages. So usually gm values like Message. Frequently overriden