hedgewars/GSHandlers.inc
changeset 7010 10a0a31804f3
parent 7007 0ccdff4ae8e9
child 7036 d99934a827f0
--- a/hedgewars/GSHandlers.inc	Wed May 02 19:16:12 2012 -0400
+++ b/hedgewars/GSHandlers.inc	Thu May 03 00:20:58 2012 -0400
@@ -5089,7 +5089,7 @@
                 DeleteGear(graves[i]);
                 RenderHealth(resgear^.Hedgehog^);
                 RecountTeamHealth(resgear^.Hedgehog^.Team);
-                resgear^.Hedgehog^.Effects[heResurrected]:= true;
+                resgear^.Hedgehog^.Effects[heResurrected]:= 1;
                 // only make hat-less hedgehogs look like zombies, preserve existing hats
                 
                 if resgear^.Hedgehog^.Hat = 'NoHat' then
@@ -5420,15 +5420,64 @@
 
 (*
 WIP. The ice gun will have the following effects.  It has been proposed by sheepluva that it take the appearance of a large freezer
-spewing ice cubes.  The cubes will probably be visual gears only, although if they were gear particles, it could allow for impacting targets in a spray.
+spewing ice cubes.  The cubes will be visual gears only.  The scatter from them and the impact snow dust should help hide imprecisions in things like the GearsNear effect.
 For now we assume a "ray" like a deagle projected out from the gun.
 All these effects assume the ray's angle is not changed and that the target type was unchanged over a number of ticks.  This is a simplifying assumption for "gun was applying freezing effect to the same target".  
   * When fired at water a layer of ice textured land is added above the water.
-  * When fired at non-ice land (land and $FF00 and not lfIce) the land is overlaid with a thin layer of ice textured land near that point. For attractiveness, a slope would probably be needed.
+  * When fired at non-ice land (land and $FF00 and not lfIce) the land is overlaid with a thin layer of ice textured land around that point (say, 1 or 2px into land, 1px above). For attractiveness, a slope would probably be needed.
   * When fired at a hog (land and $00FF <> 0), while the hog is targetted, the hog's state is set to frozen.  As long as the gun is on the hog, a frozen hog sprite creeps up from the feet to the head.  If the effect is interrupted before reaching the top, the freezing state is cleared.
 A frozen hog will animate differently.  To be decided, but possibly in a similar fashion to a grave when it comes to explosions.  The hog might (possibly) not be damaged by explosions.  This might make freezing potentially useful for friendlies in a bad position.  It might be better to allow damage though.
 A frozen hog stays frozen for a certain number of turns. Each turn the frozen overlay becomes fainter, until it fades and the hog animates normally again.
 *)
 procedure doStepIceGun(Gear: PGear);
+var 
+    HHGear, iter: PGear;
+    ndX, ndY: hwFloat;
+    gX, gY: LongInt;
 begin
+    with Gear^ do
+        begin
+        HHGear := Hedgehog^.Gear;
+        HedgehogChAngle(HHGear);
+        ndX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX);
+        ndY:= -AngleCos(HHGear^.Angle);
+        if (ndX <> dX) or (ndY <> dY) then
+            begin
+            Pos:= 0;
+            Target.X:= NoPointX;
+            LastDamage:= nil;
+            X:= HHGear^.X;
+            Y:= HHGear^.Y;
+// unfreeze all semifrozen hogs
+            iter := GearsList;
+            while iter <> nil do
+                begin
+                if (iter^.Kind = gtHedgehog) and 
+                   (iter^.Hedgehog^.Effects[heFrozen] < 0) then 
+                    iter^.Hedgehog^.Effects[heFrozen]:= 0;
+                iter:= iter^.NextGear;
+                end;
+            end
+        else
+            begin
+            gX:= hwRound(X);
+            gY:= hwRound(Y);
+            X:= X + dX;
+            Y:= Y + dY;
+            if Target.X <> NoPointX then
+                inc(Pos)
+            else if (gY > cWaterLine) or 
+                    (((gX and LAND_WIDTH_MASK = 0) and (gY and LAND_HEIGHT_MASK = 0))
+                        and ((Land[gY, gX] and $FF00 and not lfIce <> 0) or
+                             (Land[gY, gX] and $00FF <> 0))) then
+                begin
+                Target.X:= gX;
+                Target.Y:= gY;
+                if Land[gY, gX] and $00FF <> 0 then // locate and tag hogs
+                    begin
+                //GearsNear(X, Y, gtHedgehog, Radius);
+                    end;
+                end
+        end
+    end;
 end;