gtGenericFaller: Use Tag=1 to allow gtGenericFaller to be displaced randomly. Otherwise it is left alone
--- a/hedgewars/uGears.pas Thu Mar 15 02:08:07 2018 +0100
+++ b/hedgewars/uGears.pas Thu Mar 15 02:59:37 2018 +0100
@@ -237,7 +237,7 @@
t := GearsList;
while t <> nil do
begin
- if t^.Kind = gtGenericFaller then
+ if (t^.Kind = gtGenericFaller) and (t^.Tag = 1) then
begin
t^.Active:= true;
t^.X:= int2hwFloat(GetRandom(rightX-leftX)+leftX);
@@ -739,7 +739,9 @@
ry:= GetRandom(LAND_HEIGHT-topY)+topY;
rdx:= _90-(GetRandomf*_360);
rdy:= _90-(GetRandomf*_360);
- AddGear(rx, ry, gtGenericFaller, gstInvisible, rdx, rdy, $FFFFFFFF);
+ Gear:= AddGear(rx, ry, gtGenericFaller, gstInvisible, rdx, rdy, $FFFFFFFF);
+ // Tag=1: This allows this generic faller to be displaced randomly by events
+ Gear^.Tag:= 1;
end;
snowRight:= max(LAND_WIDTH,4096)+512;
--- a/hedgewars/uGearsHandlersMess.pas Thu Mar 15 02:08:07 2018 +0100
+++ b/hedgewars/uGearsHandlersMess.pas Thu Mar 15 02:59:37 2018 +0100
@@ -6329,7 +6329,8 @@
begin
with gi^ do CheckSum:= CheckSum xor X.round xor X.frac xor dX.round xor dX.frac xor Y.round xor Y.frac xor dY.round xor dY.frac;
AddRandomness(CheckSum);
- if gi^.Kind = gtGenericFaller then gi^.State:= gi^.State and (not gstTmpFlag);
+ if (gi^.Kind = gtGenericFaller) and (gi^.Tag = 1) then
+ gi^.State:= gi^.State and (not gstTmpFlag);
gi := gi^.NextGear
end;
AddPickup(Gear^.Hedgehog^, a, Gear^.Power, hwRound(Gear^.X), hwRound(Gear^.Y));
@@ -6350,7 +6351,7 @@
if (Gear^.State and gstTmpFlag <> 0) or (GameTicks and $7 = 0) then
begin
doStepFallingGear(Gear);
- if (Gear^.State and gstInvisible <> 0) and (GameTicks and $FF = 0) and (hwRound(Gear^.X) < LongInt(leftX)) or (hwRound(Gear^.X) > LongInt(rightX)) or (hwRound(Gear^.Y) < LongInt(topY)) then
+ if (Gear^.Tag = 1) and (GameTicks and $FF = 0) and (hwRound(Gear^.X) < LongInt(leftX)) or (hwRound(Gear^.X) > LongInt(rightX)) or (hwRound(Gear^.Y) < LongInt(topY)) then
begin
Gear^.X:= int2hwFloat(GetRandom(rightX-leftX)+leftX);
Gear^.Y:= int2hwFloat(GetRandom(LAND_HEIGHT-topY)+topY);
--- a/hedgewars/uGearsHedgehog.pas Thu Mar 15 02:08:07 2018 +0100
+++ b/hedgewars/uGearsHedgehog.pas Thu Mar 15 02:59:37 2018 +0100
@@ -758,7 +758,7 @@
gi := GearsList;
while gi <> nil do
begin
- if (gi^.Kind = gtGenericFaller) and (gi^.State and gstInvisible <> 0) then
+ if (gi^.Kind = gtGenericFaller) and (gi^.Tag = 1) then
begin
gi^.Active:= true;
gi^.State:= gi^.State or gstTmpFlag;
--- a/hedgewars/uGearsRender.pas Thu Mar 15 02:08:07 2018 +0100
+++ b/hedgewars/uGearsRender.pas Thu Mar 15 02:59:37 2018 +0100
@@ -1554,7 +1554,13 @@
gtDuck: DrawSpriteRotatedF(sprDuck, x, y, 1, Gear^.Tag,
// replace with something based on dx/dy?
Gear^.DirAngle + 10-round(20 * abs(1 - (RealTicks mod round(0.1/max(0.00005,cWindSpeedf))) / round(0.05/max(0.00005,cWindSpeedf))) ));
- gtGenericFaller: DrawCircle(x, y, max(3, Gear^.Radius), 3, $FF, $00, $00, $FF); // debug
+ gtGenericFaller: begin
+ // DEBUG: draw gtGenericFaller
+ if Gear^.Tag <> 0 then
+ DrawCircle(x, y, max(3, Gear^.Radius), 3, $FF, $00, $00, $FF)
+ else
+ DrawCircle(x, y, max(3, Gear^.Radius), 3, $80, $FF, $80, $8F);
+ end;
end;
if Gear^.State and gstFrozen <> 0 then untint
end;