Resurrector: respect modified Gear position for resurrection range circle
authorTobias Neumann <mail@tobias-neumann.eu>
Sat, 30 Oct 2010 21:57:54 +0200
changeset 4024 1ffb84b3823d
parent 4023 8de77872ef21
child 4025 1e60c5b77077
child 4026 afae5a3b8424
Resurrector: respect modified Gear position for resurrection range circle
hedgewars/GSHandlers.inc
hedgewars/GearDrawing.inc
hedgewars/uGears.pas
--- a/hedgewars/GSHandlers.inc	Sat Oct 30 21:43:41 2010 +0200
+++ b/hedgewars/GSHandlers.inc	Sat Oct 30 21:57:54 2010 +0200
@@ -4113,15 +4113,15 @@
         Gear^.Y := Gear^.Y - _1;
     end;
 
-    graves := GearsNear(hh^.Gear, gtGrave, Gear^.Radius);
-
-    if Length(graves) = 0 then 
-        begin
+    graves := GearsNear(hh^.Gear^.X, hh^.Gear^.Y + int2hwFloat(Gear^.Power),
+                    gtGrave, Gear^.Radius);
+
+    if Length(graves) = 0 then begin
         StopSound(Gear^.SoundChannel);
         Gear^.Timer := 250;
         Gear^.doStep := @doStepIdle;
         exit;
-        end;
+    end;
 
     if ((Gear^.Message and gmAttack) <> 0) and (hh^.Gear^.Health > 0) then begin
         i := getRandom(Length(graves));
@@ -4170,7 +4170,7 @@
 begin
     AllInactive := false;
     hh := PHedgehog(Gear^.Hedgehog);
-    graves := GearsNear(hh^.Gear, gtGrave, Gear^.Radius);
+    graves := GearsNear(hh^.Gear^.X, hh^.Gear^.Y, gtGrave, Gear^.Radius);
 
     if Length(graves) > 0 then begin
         for i:= 0 to High(graves) do begin
--- a/hedgewars/GearDrawing.inc	Sat Oct 30 21:43:41 2010 +0200
+++ b/hedgewars/GearDrawing.inc	Sat Oct 30 21:57:54 2010 +0200
@@ -284,7 +284,8 @@
                         hwRound(CurAmmoGear^.Y) + WorldDy + (CurAmmoGear^.Power), 0, 0);
                 defaultPos := false;
                 Tint($33, $33, $FF, max($00, floor($C0 * abs(1 - (GameTicks mod 6000) / 3000))));
-                DrawTexture(sx - 108, sy - 108, SpritesData[sprVampiric].Texture, 4.5);
+                DrawTexture(sx - 108, sy - 108 + (CurAmmoGear^.Power),
+                        SpritesData[sprVampiric].Texture, 4.5);
                 Tint($FF, $FF, $FF, $FF);
                 end;
             gtKamikaze: begin
--- a/hedgewars/uGears.pas	Sat Oct 30 21:43:41 2010 +0200
+++ b/hedgewars/uGears.pas	Sat Oct 30 21:57:54 2010 +0200
@@ -121,7 +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 GearsNear(X, Y: hwFloat; Kind: TGearType; r: LongInt): TPGearArray; forward;
 function  CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; forward;
 procedure SpawnBoxOfSmth; forward;
 procedure AfterAttack; forward;
@@ -1517,16 +1517,16 @@
     end
 end;
 
-function GearsNear(Gear: PGear; Kind: TGearType; r: LongInt): TPGearArray;
+function GearsNear(X, Y: hwFloat; 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
+        if (t^.Kind = Kind) then begin
+            if (X - t^.X)*(X - t^.X) + (Y - t^.Y)*(Y-t^.Y) <
+                int2hwFloat(r)*int2hwFloat(r) then
             begin
                 SetLength(GearsNear, Length(GearsNear)+1);
                 GearsNear[High(GearsNear)] := t;