hedgewars/GSHandlers.inc
changeset 4365 4f2b1a152979
parent 4337 85e02b1a8e8f
child 4372 3836973380b9
--- a/hedgewars/GSHandlers.inc	Wed Nov 17 20:36:35 2010 +0300
+++ b/hedgewars/GSHandlers.inc	Wed Nov 17 20:58:23 2010 +0300
@@ -131,13 +131,13 @@
                 if (Gear^.Kind <> gtSniperRifleShot) and (Gear^.Kind <> gtShotgunShot) and (Gear^.Kind <> gtDEagleShot) and (Gear^.Kind <> gtSineGunShot) then
                     if Gear^.Kind = gtHedgehog then 
                         begin
-                        if PHedgehog(Gear^.Hedgehog)^.Effects[heResurrectable] then
+                        if Gear^.Hedgehog^.Effects[heResurrectable] then
                             ResurrectHedgehog(Gear)
                         else
                             begin
                             Gear^.doStep := @doStepDrowningGear;
                             Gear^.State := Gear^.State and (not gstHHDriven);
-                            AddCaption(Format(GetEventString(eidDrowned), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage);
+                            AddCaption(Format(GetEventString(eidDrowned), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
                             end
                         end
                     else
@@ -203,9 +203,9 @@
         if (Gear^.Invulnerable) then exit;
 
         //if _0_6 < Gear^.dY then
-        //    PlaySound(sndOw4, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack)
+        //    PlaySound(sndOw4, Gear^.Hedgehog^.Team^.voicepack)
         //else
-        //    PlaySound(sndOw1, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
+        //    PlaySound(sndOw1, Gear^.Hedgehog^.Team^.voicepack);
 
         ApplyDamage(Gear, dmg, dsFall);
     end
@@ -626,8 +626,8 @@
     dec(Gear^.Timer);
     if Gear^.Timer = 0 then
     begin
-        PHedgehog(Gear^.Hedgehog)^.Gear^.Message:= PHedgehog(Gear^.Hedgehog)^.Gear^.Message and not gmAttack;
-        PHedgehog(Gear^.Hedgehog)^.Gear^.State:= PHedgehog(Gear^.Hedgehog)^.Gear^.State and not gstAttacking;
+        Gear^.Hedgehog^.Gear^.Message:= Gear^.Hedgehog^.Gear^.Message and not gmAttack;
+        Gear^.Hedgehog^.Gear^.State:= Gear^.Hedgehog^.Gear^.State and not gstAttacking;
         AttackBar:= 0;
         
         Gear^.SoundChannel := LoopSound(sndBee);
@@ -806,7 +806,7 @@
     shell: PVisualGear;
 begin
     cArtillery := true;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.State := HHGear^.State or gstNotKickable;
     HedgehogChAngle(HHGear);
     if not cLaserSighting then
@@ -899,7 +899,7 @@
     HHGear: PGear;
 begin
     AllInactive := false;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     dec(Gear^.Timer);
     if (Gear^.Timer = 0)or((Gear^.Message and gmDestroy) <> 0)or((HHGear^.State and gstHHDriven) =
        0) then
@@ -973,7 +973,7 @@
     HHGear: PGear;
 begin
     i := 0;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
 
     y := hwRound(Gear^.Y) - cHHRadius * 2;
     while y < hwRound(Gear^.Y) do
@@ -1005,7 +1005,7 @@
 begin
     AllInactive := false;
     dec(Gear^.Timer);
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
 
     HedgehogChAngle(HHGear);
 
@@ -1087,7 +1087,7 @@
 begin
     BTPrevAngle := High(LongInt);
     BTSteps := 0;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.Message := 0;
     HHGear^.State := HHGear^.State or gstNotKickable;
     Gear^.doStep := @doStepBlowTorchWork
@@ -1102,7 +1102,7 @@
 var 
     HHGear: PGear;
 begin
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     if ((HHGear^.State and gstHHDriven) = 0)
        or (CheckGearDrowning(HHGear))
        or TestCollisionYwithGear(HHGear, 1) then
@@ -1128,7 +1128,7 @@
         Gear^.X := HHGear^.X;
         Gear^.Y := HHGear^.Y;
 
-        ApplyAngleBounds(PHedgehog(Gear^.Hedgehog)^, amRope);
+        ApplyAngleBounds(Gear^.Hedgehog^, amRope);
 
         Gear^.dX := SignAs(AngleSin(HHGear^.Angle), HHGear^.dX);
         Gear^.dY := -AngleCos(HHGear^.Angle);
@@ -1170,7 +1170,7 @@
 end;
 
 begin
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
 
     if ((HHGear^.State and gstHHDriven) = 0)
        or (CheckGearDrowning(HHGear)) then
@@ -1333,7 +1333,7 @@
 
     if (Gear^.Message and gmAttack) <> 0 then
         if (Gear^.State and gsttmpFlag) <> 0 then
-            with PHedgehog(Gear^.Hedgehog)^ do
+            with Gear^.Hedgehog^ do
                 begin
                 PlaySound(sndRopeRelease);
                 if CurAmmoType <> amParachute then
@@ -1367,7 +1367,7 @@
     Gear^.Y := Gear^.Y - Gear^.dY;
     Gear^.Elasticity := Gear^.Elasticity + _1;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     DeleteCI(HHGear);
 
     if (HHGear^.State and gstMoving) <> 0 then
@@ -1447,7 +1447,7 @@
        or ((HHGear^.State and gstHHDriven) = 0)
        or (HHGear^.Damage > 0) then
         begin
-        with PHedgehog(Gear^.Hedgehog)^.Gear^ do
+        with Gear^.Hedgehog^.Gear^ do
             begin
             State := State and not gstAttacking;
             Message := Message and not gmAttack
@@ -1808,7 +1808,7 @@
 var 
     HHGear: PGear;
 begin
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.State := HHGear^.State or gstNoDamage;
     DeleteCI(HHGear);
 
@@ -1825,7 +1825,7 @@
     HHGear: PGear;
     i: LongInt;
 begin
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.State := HHGear^.State or gstNoDamage;
     DeleteCI(HHGear);
 
@@ -1978,7 +1978,7 @@
         exit
     end;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     if hwRound(HHGear^.Y) <= Gear^.Tag - 2 then
     begin
         Gear^.Tag := hwRound(HHGear^.Y);
@@ -2008,7 +2008,7 @@
     HHGear: PGear;
 begin
     AllInactive := false;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     DeleteCI(HHGear);
     HHGear^.X := int2hwFloat(hwRound(HHGear^.X)) - _0_5;
     HHGear^.dX := SignAs(cLittle, Gear^.dX);
@@ -2031,7 +2031,7 @@
 var 
     HHGear: PGear;
 begin
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
 
     inc(Gear^.Timer);
 
@@ -2070,7 +2070,7 @@
 var 
     HHGear: PGear;
 begin
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
 
     DeleteCI(HHGear);
 
@@ -2167,7 +2167,7 @@
 begin
     AllInactive := false;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     tx := int2hwFloat(TargetPoint.X);
     ty := int2hwFloat(TargetPoint.Y);
     x := HHGear^.X;
@@ -2202,8 +2202,8 @@
 var 
     HHGear: PGear;
 begin
-    PHedgehog(Gear^.Hedgehog)^.Unplaced := false;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    Gear^.Hedgehog^.Unplaced := false;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.Y := HHGear^.Y + HHGear^.dY;
     // hedgehog falling to collect cases
     HHGear^.dY := HHGear^.dY + cGravity;
@@ -2233,7 +2233,7 @@
 begin
     AllInactive := false;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprHHTelepMask].Width div 2,
        TargetPoint.Y - SpritesData[sprHHTelepMask].Height div 2,
        sprHHTelepMask, 0, false) then
@@ -2275,7 +2275,7 @@
 
     if ((Gear^.Message and not gmSwitch) <> 0) or (TurnTimeLeft = 0) then
     begin
-        HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+        HHGear := Gear^.Hedgehog^.Gear;
         Msg := Gear^.Message and not gmSwitch;
         DeleteGear(Gear);
         OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^);
@@ -2326,7 +2326,7 @@
 begin
     Gear^.doStep := @doStepSwitcherWork;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     with HHGear^ do
     begin
         State := State and not gstAttacking;
@@ -2377,7 +2377,7 @@
 begin
     AllInactive := false;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.State := HHGear^.State or gstNoDamage;
     DeleteCI(HHGear);
 
@@ -2437,7 +2437,7 @@
     if Gear^.Timer = 0 then
     begin
         Gear^.Pos := 1;
-        PlaySound(sndKamikaze, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
+        PlaySound(sndKamikaze, Gear^.Hedgehog^.Team^.voicepack);
         Gear^.doStep := @doStepKamikazeWork
     end
 end;
@@ -2448,7 +2448,7 @@
 begin
     AllInactive := false;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
 
     HHGear^.dX := Gear^.dX;
     HHGear^.dY := Gear^.dY;
@@ -2637,7 +2637,7 @@
 begin
     AllInactive := false;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.Message := HHGear^.Message and (not gmAttack);
     DeleteCI(HHGear);
     Gear^.IntersectGear:= nil;
@@ -2687,7 +2687,7 @@
         Gear^.Timer := 0;
         inc(Gear^.Pos);
         if Gear^.Pos = 5 then
-            PlaySound(sndYoohoo, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack)
+            PlaySound(sndYoohoo, Gear^.Hedgehog^.Team^.voicepack)
     end;
 
     if Gear^.Pos = 14 then
@@ -2697,7 +2697,7 @@
 procedure doStepSeduction(Gear: PGear);
 begin
     AllInactive := false;
-    DeleteCI(PHedgehog(Gear^.Hedgehog)^.Gear);
+    DeleteCI(Gear^.Hedgehog^.Gear);
     Gear^.doStep := @doStepSeductionWear
 end;
 
@@ -2836,7 +2836,7 @@
 begin
     AllInactive := false;
     dec(Gear^.Timer);
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HedgehogChAngle(HHGear);
     gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle);
     gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle);
@@ -2864,7 +2864,7 @@
 var 
     HHGear: PGear;
 begin
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.Message := HHGear^.Message and not (gmUp or gmDown);
     HHGear^.State := HHGear^.State or gstNotKickable;
     Gear^.doStep := @doStepBallgunWork
@@ -2889,7 +2889,7 @@
     if ((TrainingFlags and tfRCPlane) <> 0) and ((TrainingFlags and tfTimeTrial) <> 0 ) and (
        TimeTrialStartTime = 0) then TimeTrialStartTime := RealTicks;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     FollowGear := Gear;
 
     fChanged := false;
@@ -3025,7 +3025,7 @@
 var 
     HHGear: PGear;
 begin
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.Message := 0;
     HHGear^.State := HHGear^.State or gstNotKickable;
     Gear^.Angle := HHGear^.Angle;
@@ -3045,7 +3045,7 @@
     isUnderwater:= cWaterLine < hwRound(Gear^.Y) + Gear^.Radius;
     if Gear^.Pos > 0 then dec(Gear^.Pos);
     AllInactive := false;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     //dec(Gear^.Timer);
     move := _0_2;
     fuel := 50;
@@ -3169,7 +3169,7 @@
     Gear^.Pos:= 0;
     Gear^.doStep := @doStepJetpackWork;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     FollowGear := HHGear;
     AfterAttack;
     with HHGear^ do
@@ -3427,7 +3427,7 @@
     // destroy portal if ground it was attached too is gone
     if ((Land[hwRound(Gear^.Y), hwRound(Gear^.X)] and $FF00) = 0)
        or (Gear^.Timer < 1)
-       or (PHedgehog(Gear^.Hedgehog) <> CurrentHedgehog)
+       or (Gear^.Hedgehog <> CurrentHedgehog)
        or (hwRound(Gear^.Y) > cWaterLine) then
     begin
         deleteGear(Gear);
@@ -3754,7 +3754,7 @@
     doPortalColorSwitch();
     doStepPerPixel(Gear, @doStepMovingPortal_real, true);
     if (Gear^.Timer < 1)
-       or (PHedgehog(Gear^.Hedgehog) <> CurrentHedgehog) then
+       or (Gear^.Hedgehog <> CurrentHedgehog) then
             deleteGear(Gear);
 end;
 
@@ -4047,7 +4047,7 @@
     Fire: PGear;
 begin
     AllInactive := false;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HedgehogChAngle(HHGear);
     gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle);
     gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle);
@@ -4111,7 +4111,7 @@
 var 
     HHGear: PGear;
 begin
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.Message := HHGear^.Message and not (gmUp or gmDown or gmLeft or gmRight);
     HHGear^.State := HHGear^.State or gstNotKickable;
     Gear^.doStep := @doStepFlamethrowerWork
@@ -4140,7 +4140,7 @@
          t: PGearArray;
          i: LongInt;
 begin
-HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
+HHGear:= Gear^.Hedgehog^.Gear;
 HHGear^.State:= HHGear^.State or gstNoDamage;
 DeleteCI(HHGear);
 
@@ -4181,7 +4181,7 @@
     HHGear: PGear;
 begin
     AllInactive := false;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     dec(Gear^.Timer);
     if (HHGear = nil) or (Gear^.Timer = 0) or ((Gear^.Message and gmDestroy) <> 0) then
     begin
@@ -4234,7 +4234,7 @@
     HHGear: PGear;
 begin
     i := 0;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
 
     y := hwRound(Gear^.Y) - cHHRadius * 2;
     while y < hwRound(Gear^.Y) do
@@ -4265,7 +4265,7 @@
         dec(TurnTimeLeft);
 
     AllInactive := false;
-    hh := PHedgehog(Gear^.Hedgehog);
+    hh := Gear^.Hedgehog;
     DrawCentered(hwRound(hh^.Gear^.X) + WorldDx, hwRound(hh^.Gear^.Y) + WorldDy -
             cHHRadius - 14 - hh^.HealthTagTex^.h, hh^.HealthTagTex);
     (*DrawCircle(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Radius, 1.5, 0, 0, $FF,