Fix pickhammer and kamikaze
authorunc0rr
Tue, 12 Aug 2008 19:41:16 +0000
changeset 1200 b92323ccce45
parent 1199 543d1268847b
child 1201 4390e7343542
Fix pickhammer and kamikaze
hedgewars/GSHandlers.inc
hedgewars/uGears.pas
--- a/hedgewars/GSHandlers.inc	Tue Aug 12 12:57:07 2008 +0000
+++ b/hedgewars/GSHandlers.inc	Tue Aug 12 19:41:16 2008 +0000
@@ -426,40 +426,44 @@
 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
 dec(Gear^.Timer);
 if (Gear^.Timer = 0)or((Gear^.Message and gm_Destroy) <> 0)or((HHGear^.State and gstHHDriven) = 0) then
-   begin
-   StopSound(sndPickhammer);
-   DeleteGear(Gear);
-   AfterAttack;
-   exit
-   end;
+	begin
+	StopSound(sndPickhammer);
+	DeleteGear(Gear);
+	AfterAttack;
+	exit
+	end;
 
 if (Gear^.Timer mod 33) = 0 then
-   doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y) + 6, 6, EXPLDontDraw);
+	begin
+	HHGear^.State:= HHGear^.State or gstNoDamage;
+	doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y) + 7, 6, EXPLDontDraw);
+	HHGear^.State:= HHGear^.State and not gstNoDamage
+	end;
 
 if (Gear^.Timer mod 47) = 0 then
-   begin
-   i:= hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2));
-   ei:= hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2));
-   while i <= ei do
-         begin
-         DrawExplosion(i, hwRound(Gear^.Y) + 3, 3);
-         inc(i, 1)
-         end;
-   Gear^.X:= Gear^.X + Gear^.dX;
-   Gear^.Y:= Gear^.Y + _1_9;
-   SetAllHHToActive;
-   end;
+	begin
+	i:= hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2));
+	ei:= hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2));
+	while i <= ei do
+		begin
+		DrawExplosion(i, hwRound(Gear^.Y) + 3, 3);
+		inc(i, 1)
+		end;
+	Gear^.X:= Gear^.X + Gear^.dX;
+	Gear^.Y:= Gear^.Y + _1_9;
+	SetAllHHToActive;
+	end;
 if TestCollisionYwithGear(Gear, 1) then
-   begin
-   Gear^.dY:= _0;
-   SetLittle(HHGear^.dX);
-   HHGear^.dY:= _0;
-   end else
-   begin
-   Gear^.dY:= Gear^.dY + cGravity;
-   Gear^.Y:= Gear^.Y + Gear^.dY;
-   if Gear^.Y > _1024 then Gear^.Timer:= 1
-   end;
+	begin
+	Gear^.dY:= _0;
+	SetLittle(HHGear^.dX);
+	HHGear^.dY:= _0;
+	end else
+	begin
+	Gear^.dY:= Gear^.dY + cGravity;
+	Gear^.Y:= Gear^.Y + Gear^.dY;
+	if Gear^.Y > _1024 then Gear^.Timer:= 1
+	end;
 
 Gear^.X:= Gear^.X + HHGear^.dX;
 HHGear^.X:= Gear^.X;
@@ -1435,8 +1439,8 @@
 
 	inc(Gear^.Damage, 2);
 
-	if TestCollisionXwithGear(HHGear, hwSign(Gear^.dX))
-		or TestCollisionYwithGear(HHGear, hwSign(Gear^.dY)) then inc(Gear^.Damage, 3);
+//	if TestCollisionXwithGear(HHGear, hwSign(Gear^.dX))
+//		or TestCollisionYwithGear(HHGear, hwSign(Gear^.dY)) then inc(Gear^.Damage, 3);
 
 	dec(i)
 until (i = 0) or (Gear^.Damage > Gear^.Health);
@@ -1449,11 +1453,11 @@
 	AmmoShove(Gear, 30, 40);
 	
 	DrawTunnel(HHGear^.X - HHGear^.dX * 10,
-			HHGear^.Y - _3 - HHGear^.dY * 10 + hwAbs(HHGear^.dY) * 5,
+			HHGear^.Y - _2 - HHGear^.dY * 10 + hwAbs(HHGear^.dY) * 2,
 			HHGear^.dX,
 			HHGear^.dY,
 			20 + cHHRadius * 2,
-			cHHRadius * 2 + 4);
+			cHHRadius * 2 + 6);
 	
 	upd:= 0
 	end;
--- a/hedgewars/uGears.pas	Tue Aug 12 12:57:07 2008 +0000
+++ b/hedgewars/uGears.pas	Tue Aug 12 19:41:16 2008 +0000
@@ -1078,45 +1078,47 @@
                                       else dmgRadius:= Radius;
 Gear:= GearsList;
 while Gear <> nil do
-      begin
-      dmg:= dmgRadius  + cHHRadius div 2 - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y)));
-      if (dmg > 1) and
-         ((Gear^.State and gstNoDamage) = 0) then
-         begin
-         dmg:= min(dmg div 2, Radius);
-         case Gear^.Kind of
-              gtHedgehog,
-                  gtMine,
-                  gtCase,
-                gtTarget,
-                 gtFlame: begin
-                          {$IFDEF DEBUGFILE}AddFileLog('Damage: ' + inttostr(dmg));{$ENDIF}
-                          if (Mask and EXPLNoDamage) = 0 then
-                             begin
-                             inc(Gear^.Damage, dmg);
-                             if Gear^.Kind = gtHedgehog then
-                                AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, Gear)
-                             end;
-                          if ((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog) then
-                             begin
-                             DeleteCI(Gear);
-                             Gear^.dX:= Gear^.dX + SignAs(_0_005 * dmg + cHHKick, Gear^.X - int2hwFloat(X));
-                             Gear^.dY:= Gear^.dY + SignAs(_0_005 * dmg + cHHKick, Gear^.Y - int2hwFloat(Y));
-                             Gear^.State:= (Gear^.State or gstMoving) and (not gstWinner);
-                             Gear^.Active:= true;
-                             FollowGear:= Gear
-                             end;
-                          end;
-                 gtGrave: begin
-                          Gear^.dY:= - _0_004 * dmg;
-                          Gear^.Active:= true;
-                          end;
-              end;
-         end;
-      Gear:= Gear^.NextGear
-      end;
+	begin
+	dmg:= dmgRadius  + cHHRadius div 2 - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y)));
+	if (dmg > 1) and
+		((Gear^.State and gstNoDamage) = 0) then
+		begin
+		dmg:= min(dmg div 2, Radius);
+		case Gear^.Kind of
+			gtHedgehog,
+				gtMine,
+				gtCase,
+				gtTarget,
+				gtFlame: begin
+						{$IFDEF DEBUGFILE}AddFileLog('Damage: ' + inttostr(dmg));{$ENDIF}
+						if (Mask and EXPLNoDamage) = 0 then
+							begin
+							inc(Gear^.Damage, dmg);
+							if Gear^.Kind = gtHedgehog then
+								AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, Gear)
+							end;
+						if ((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog) then
+							begin
+							DeleteCI(Gear);
+							Gear^.dX:= Gear^.dX + SignAs(_0_005 * dmg + cHHKick, Gear^.X - int2hwFloat(X));
+							Gear^.dY:= Gear^.dY + SignAs(_0_005 * dmg + cHHKick, Gear^.Y - int2hwFloat(Y));
+							Gear^.State:= (Gear^.State or gstMoving) and (not gstWinner);
+							Gear^.Active:= true;
+							FollowGear:= Gear
+							end;
+						end;
+				gtGrave: begin
+						Gear^.dY:= - _0_004 * dmg;
+						Gear^.Active:= true;
+						end;
+			end;
+		end;
+	Gear:= Gear^.NextGear
+	end;
+
 if (Mask and EXPLDontDraw) = 0 then
-   if (GameFlags and gfSolidLand) = 0 then DrawExplosion(X, Y, Radius);
+	if (GameFlags and gfSolidLand) = 0 then DrawExplosion(X, Y, Radius);
+
 uAIMisc.AwareOfExplosion(0, 0, 0)
 end;