--- a/hedgewars/uGears.pas Mon Oct 11 21:41:24 2010 +0400
+++ b/hedgewars/uGears.pas Mon Oct 11 20:34:21 2010 +0200
@@ -62,6 +62,7 @@
SoundChannel: LongInt;
PortalCounter: LongWord // Hopefully temporary, but avoids infinite portal loops in a guaranteed fashion.
end;
+ TPGearArray = Array of PGear;
var AllInactive: boolean;
PrvInactive: boolean;
@@ -120,6 +121,7 @@
procedure doMakeExplosion(X, Y, Radius: LongInt; Mask, Tint: LongWord); forward;
procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward;
//procedure AmmoFlameWork(Ammo: PGear); forward;
+function GearsNear(Gear: PGear; Kind: TGearType; r: LongInt): TPGearArray; forward;
function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; forward;
procedure SpawnBoxOfSmth; forward;
procedure AfterAttack; forward;
@@ -206,7 +208,8 @@
@doStepSMine,
@doStepPoisonCloud,
@doStepHammer,
- @doStepHammerHit
+ @doStepHammerHit,
+ @doStepResurrector
);
procedure InsertGearToList(Gear: PGear);
@@ -533,7 +536,11 @@
gear^.Timer:= 5000;
gear^.dY:= int2hwfloat((-4 + getRandom(8))) / 1000;
end;
- end;
+ gtResurrector: begin
+ gear^.Radius := 100;
+ end;
+ end;
+
InsertGearToList(gear);
AddGear:= gear;
@@ -1512,6 +1519,25 @@
end
end;
+function GearsNear(Gear: PGear; Kind: TGearType; r: LongInt): TPGearArray;
+var
+ t: PGear;
+begin
+ GearsNear := nil;
+ t := GearsList;
+ while t <> nil do begin
+ if (t <> Gear) and (t^.Kind = Kind) then begin
+ if (Gear^.X - t^.X)*(Gear^.X - t^.X) + (Gear^.Y -
+ t^.Y)*(Gear^.Y-t^.Y) < int2hwFloat(r)*int2hwFloat(r) then
+ begin
+ SetLength(GearsNear, Length(GearsNear)+1);
+ GearsNear[High(GearsNear)] := t;
+ end;
+ end;
+ t := t^.NextGear;
+ end;
+end;
+
function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear;
var t: PGear;
begin