hedgewars/GSHandlers.inc
changeset 2331 e4941a7986d6
parent 2329 1cfb7d184ee1
child 2339 f1bbcca1ae07
--- a/hedgewars/GSHandlers.inc	Mon Aug 24 22:57:59 2009 +0000
+++ b/hedgewars/GSHandlers.inc	Tue Aug 25 20:54:11 2009 +0000
@@ -573,7 +573,8 @@
 		DrawExplosion(i, hwRound(Gear^.Y) + 3, 3);
 		inc(i, 1)
 		end;
-    if Land[hwRound(Gear^.Y + _1_9) , hwRound(Gear^.X + Gear^.dX + SignAs(_16,Gear^.dX))] <> COLOR_INDESTRUCTIBLE then
+
+    if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9), COLOR_INDESTRUCTIBLE) then
         begin
         Gear^.X:= Gear^.X + Gear^.dX;
         Gear^.Y:= Gear^.Y + _1_9;
@@ -674,9 +675,11 @@
 		prevX:= hwRound(HHGear^.X);
 	
 // why the call to HedgehogStep then a further increment of X?	
-		if (prevX = hwRound(HHGear^.X)) and (Land[hwRound(HHGear^.Y) , hwRound(HHGear^.X + SignAs(_16, HHGear^.dX))] <> COLOR_INDESTRUCTIBLE) then HedgehogStep(HHGear);
+        if (prevX = hwRound(HHGear^.X)) and 
+           CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y), COLOR_INDESTRUCTIBLE) then HedgehogStep(HHGear);
 		
-		if (prevX = hwRound(HHGear^.X)) and (Land[hwRound(HHGear^.Y) , hwRound(HHGear^.X + SignAs(_16, HHGear^.dX))] <> COLOR_INDESTRUCTIBLE) then HHGear^.X:= HHGear^.X + SignAs(_1, HHGear^.dX);
+        if (prevX = hwRound(HHGear^.X)) and 
+           CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y), COLOR_INDESTRUCTIBLE) then HHGear^.X:= HHGear^.X + SignAs(_1, HHGear^.dX);
 		HHGear^.State:= HHGear^.State or gstAttacking
 		end;
 
@@ -684,11 +687,10 @@
 	if BTSteps = 7 then
 		begin
 		BTSteps:= 0;
-        if Land[hwRound(HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC)) , hwRound(HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC) + SignAs(_16,Gear^.dX)
-)] <> COLOR_INDESTRUCTIBLE then
+        if CheckLandValue(hwRound(HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC) + SignAs(_6,Gear^.dX)), hwRound(HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC)), COLOR_INDESTRUCTIBLE) then
             begin
-		Gear^.X:= HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC);
-		Gear^.Y:= HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC);
+		    Gear^.X:= HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC);
+		    Gear^.Y:= HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC);
             end;
 		HHGear^.State:= HHGear^.State or gstNoDamage;
 		AmmoShove(Gear, 2, 15);
@@ -1293,8 +1295,8 @@
 	exit
 	end;
 
-if Land[hwRound(HHGear^.Y + HHGear^.dY + SignAs(_16,Gear^.dX)
-), hwRound(HHGear^.X)] <> COLOR_INDESTRUCTIBLE then HHGear^.Y:= HHGear^.Y + HHGear^.dY
+if CheckLandValue(hwRound(HHGear^.X), hwRound(HHGear^.Y + HHGear^.dY + SignAs(_6,Gear^.dY)), COLOR_INDESTRUCTIBLE) then 
+   HHGear^.Y:= HHGear^.Y + HHGear^.dY
 end;
 
 procedure doStepFirePunch(Gear: PGear);