crude ice check that probably works well enough in most cases (so far there's just one ucollisions that returns a land pixel - might want to extend that)
--- a/hedgewars/uGearsHandlersMess.pas Thu Jul 18 17:55:52 2013 -0400
+++ b/hedgewars/uGearsHandlersMess.pas Fri Jul 19 22:55:07 2013 -0400
@@ -2004,11 +2004,13 @@
sticky: Boolean;
vgt: PVisualGear;
tdX,tdY: HWFloat;
+ landPixel: Word;
begin
sticky:= (Gear^.State and gsttmpFlag) <> 0;
if not sticky then AllInactive := false;
- if TestCollisionYwithGear(Gear, 1) = 0 then
+ landPixel:= TestCollisionYwithGear(Gear, 1);
+ if landPixel = 0 then
begin
AllInactive := false;
@@ -2047,8 +2049,23 @@
exit
end
end
- else
- begin
+ else
+ begin
+ if (Gear^.Timer = 1) and (GameTicks and $3 = 0) then
+ begin
+ Gear^.Y:= Gear^.Y+_6;
+ if (landPixel and lfIce <> 0) or (TestCollisionYwithGear(Gear, 1) and lfIce <> 0) then
+ begin
+ gX := hwRound(Gear^.X);
+ gY := hwRound(Gear^.Y)-6;
+ DrawExplosion(gX, gY, 4);
+ PlaySound(sndVaporize);
+ AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSteam);
+ DeleteGear(Gear);
+ exit
+ end;
+ Gear^.Y:= Gear^.Y-_6
+ end;
if sticky and (GameTicks and $F = 0) then
begin
Gear^.Radius := 7;
@@ -2099,7 +2116,7 @@
if Gear^.Health > 0 then
dec(Gear^.Health);
- Gear^.Timer := 450 - Gear^.Tag * 8
+ Gear^.Timer := 450 - Gear^.Tag * 8 + GetRandom(2)
end
else
begin
@@ -2113,7 +2130,7 @@
end;
// This one is interesting. I think I understand the purpose, but I wonder if a bit more fuzzy of kicking could be done with getrandom.
- Gear^.Timer := 100 - Gear^.Tag * 3;
+ Gear^.Timer := 100 - Gear^.Tag * 3 + GetRandom(2);
if (Gear^.Damage > 3000+Gear^.Tag*1500) then
Gear^.Health := 0
end