Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
--- a/hedgewars/GSHandlers.inc Tue May 21 23:49:24 2013 +0200
+++ b/hedgewars/GSHandlers.inc Tue May 21 22:56:31 2013 -0400
@@ -5161,7 +5161,7 @@
if Target.X <> NoPointX then
begin
- CheckCollisionWithLand(Gear);
+ CheckCollision(Gear);
if (State and gstCollision) <> 0 then
begin
if Timer = iceWaitCollision then
@@ -5198,19 +5198,37 @@
iter := GearsList;
while iter <> nil do
begin
- if ((iter^.Kind = gtExplosives) or (iter^.Kind = gtCase) or (iter^.Kind = gtMine)) and
- (abs(Gear^.X.Round-target.x)+abs(Gear^.Y.Round-target.y)+2<Gear^.Radius*2) and (Distance(Gear^.X-int2hwFloat(target.x),Gear^.Y-int2hwFloat(target.y))<int2hwFloat(Gear^.Radius*2)) then
+ if (iter^.State and gstFrozen = 0) and
+ ((iter^.Kind = gtExplosives) or (iter^.Kind = gtCase) or (iter^.Kind = gtMine)) and
+ (abs(iter^.X.Round-target.x)+abs(iter^.Y.Round-target.y)+2<2*iceRadius) and (Distance(iter^.X-int2hwFloat(target.x),iter^.Y-int2hwFloat(target.y))<int2hwFloat(iceRadius*2)) then
begin
+ for t:= 0 to 5 do
+ begin
+ vg:= AddVisualGear(hwRound(iter^.X)+random(4)-8, hwRound(iter^.Y)+random(8), vgtDust, 1);
+ if vg <> nil then
+ begin
+ i:= random(100) + 155;
+ vg^.Tint:= i shl 24 or i shl 16 or $FF shl 8 or Longword(random(200) + 55);
+ vg^.Angle:= random(360);
+ vg^.dx:= 0.001 * random(80);
+ vg^.dy:= 0.001 * random(80)
+ end
+ end;
iter^.State:= iter^.State or gstFrozen;
if iter^.Kind = gtMine then // dud mine block
begin
- vg:= AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke);
+ vg:= AddVisualGear(hwRound(iter^.X) - 4 + Random(8), hwRound(iter^.Y) - 4 - Random(4), vgtSmoke);
if vg <> nil then
vg^.Scale:= 0.5;
PlaySound(sndVaporize);
- Gear^.Health := 0;
- Gear^.Damage := 0;
- Gear^.State := Gear^.State and (not gstAttacking)
+ iter^.Health := 0;
+ iter^.Damage := 0;
+ iter^.State := iter^.State and (not gstAttacking)
+ end
+ else if iter^.Kind = gtCase then
+ begin
+ DeleteCI(iter);
+ AddGearCI(iter)
end
end;
iter:= iter^.NextGear
--- a/hedgewars/uCollisions.pas Tue May 21 23:49:24 2013 +0200
+++ b/hedgewars/uCollisions.pas Tue May 21 22:56:31 2013 -0400
@@ -83,7 +83,7 @@
X:= hwRound(Gear^.X);
Y:= hwRound(Gear^.Y);
Radius:= Gear^.Radius;
- ChangeRoundInLand(X, Y, Radius - 1, true, (Gear = CurrentHedgehog^.Gear) or (Gear^.Kind = gtCase));
+ ChangeRoundInLand(X, Y, Radius - 1, true, (Gear = CurrentHedgehog^.Gear) or ((Gear^.Kind = gtCase) and (Gear^.State and gstFrozen <> 0)));
cGear:= Gear
end;
Gear^.CollisionIndex:= Count;
@@ -104,7 +104,7 @@
if Gear^.CollisionIndex >= 0 then
begin
with cinfos[Gear^.CollisionIndex] do
- ChangeRoundInLand(X, Y, Radius - 1, false, (Gear = CurrentHedgehog^.Gear) or (Gear^.Kind = gtCase));
+ ChangeRoundInLand(X, Y, Radius - 1, false, (Gear = CurrentHedgehog^.Gear) or ((Gear^.Kind = gtCase) and (Gear^.State and gstFrozen <> 0)));
cinfos[Gear^.CollisionIndex]:= cinfos[Pred(Count)];
cinfos[Gear^.CollisionIndex].cGear^.CollisionIndex:= Gear^.CollisionIndex;
Gear^.CollisionIndex:= -1;
--- a/hedgewars/uGearsHedgehog.pas Tue May 21 23:49:24 2013 +0200
+++ b/hedgewars/uGearsHedgehog.pas Tue May 21 22:56:31 2013 -0400
@@ -1079,7 +1079,7 @@
HHGear^.Message:= HHGear^.Message or gmAttack;
// check for case with ammo
t:= CheckGearNear(HHGear, gtCase, 36, 36);
- if t <> nil then
+ if (t <> nil) and (t^.State and gstFrozen = 0) then
PickUp(HHGear, t)
end;
--- a/hedgewars/uGearsRender.pas Tue May 21 23:49:24 2013 +0200
+++ b/hedgewars/uGearsRender.pas Tue May 21 22:56:31 2013 -0400
@@ -979,6 +979,8 @@
aAngle: real;
startX, endX, startY, endY: LongInt;
begin
+ if Gear^.State and gstFrozen <> 0 then Tint($A0, $A0, $FF, $FF);
+ //if Gear^.State and gstFrozen <> 0 then Tint(IceColor or $FF);
if Gear^.Target.X <> NoPointX then
if Gear^.AmmoType = amBee then
DrawSpriteRotatedF(sprTargetBee, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
@@ -1038,11 +1040,13 @@
gtPickHammer: DrawSprite(sprPHammer, x - 16, y - 50 + LongInt(((GameTicks shr 5) and 1) * 2), 0);
gtRope: DrawRope(Gear);
- gtMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
+ gtMine: begin
+ if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
DrawSpriteRotated(sprMineOff, x, y, 0, Gear^.DirAngle)
- else if Gear^.Health <> 0 then
- DrawSpriteRotated(sprMineOn, x, y, 0, Gear^.DirAngle)
- else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
+ else if Gear^.Health <> 0 then
+ DrawSpriteRotated(sprMineOn, x, y, 0, Gear^.DirAngle)
+ else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
+ end;
gtSMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
DrawSpriteRotated(sprSMineOff, x, y, 0, Gear^.DirAngle)
@@ -1056,26 +1060,38 @@
begin
if ((Gear^.Pos and posCaseAmmo) <> 0) then
begin
+ if Gear^.State and gstFrozen <> 0 then
+ begin
+ DrawSprite(sprCase, x - 24, y - 28, 0);
+ exit
+ end;
i:= (GameTicks shr 6) mod 64;
- if i > 18 then
- i:= 0;
- DrawSprite(sprCase, x - 24, y - 24, i);
+ if i > 18 then i:= 0;
+ DrawSprite(sprCase, x - 24, y - 24, i)
end
else if ((Gear^.Pos and posCaseHealth) <> 0) then
begin
+ if Gear^.State and gstFrozen <> 0 then
+ begin
+ DrawSprite(sprFAid, x - 24, y - 28, 0);
+ exit
+ end;
i:= ((GameTicks shr 6) + 38) mod 64;
- if i > 13 then
- i:= 0;
+ if i > 13 then i:= 0;
DrawSprite(sprFAid, x - 24, y - 24, i);
end
else if ((Gear^.Pos and posCaseUtility) <> 0) then
begin
+ if Gear^.State and gstFrozen <> 0 then
+ begin
+ DrawSprite(sprUtility, x - 24, y - 28, 0);
+ exit
+ end;
i:= (GameTicks shr 6) mod 70;
- if i > 23 then
- i:= 0;
+ if i > 23 then i:= 0;
i:= i mod 12;
DrawSprite(sprUtility, x - 24, y - 24, i);
- end;
+ end
end;
if Gear^.Timer < 1833 then
begin
@@ -1096,7 +1112,7 @@
else if Gear^.State and gsttmpFlag = 0 then
DrawSpriteRotatedF(sprExplosivesRoll, x, y + 4, 0, 0, Gear^.DirAngle)
else
- DrawSpriteRotatedF(sprExplosivesRoll, x, y + 4, 1, 0, Gear^.DirAngle);
+ DrawSpriteRotatedF(sprExplosivesRoll, x, y + 4, 1, 0, Gear^.DirAngle)
end;
gtDynamite: DrawSprite(sprDynamite, x - 16, y - 25, Gear^.Tag and 1, Gear^.Tag shr 1);
gtClusterBomb: DrawSpriteRotated(sprClusterBomb, x, y, 0, Gear^.DirAngle);
@@ -1285,6 +1301,7 @@
end;
if Gear^.RenderTimer and (Gear^.Tex <> nil) then
DrawTextureCentered(x + 8, y + 8, Gear^.Tex);
+ if Gear^.State and gstFrozen <> 0 then Tint($FF, $FF, $FF, $FF)
end;
end.