hedgewars/uGears.pas
changeset 2023 41d3afaa20c7
parent 2020 f8cd566204ef
child 2025 692308790912
--- a/hedgewars/uGears.pas	Fri May 01 11:58:22 2009 +0000
+++ b/hedgewars/uGears.pas	Sun May 03 17:35:10 2009 +0000
@@ -163,7 +163,8 @@
 			@doStepBallgun,
 			@doStepBomb,
 			@doStepRCPlane,
-			@doStepSpeechBubble
+			@doStepSpeechBubble,
+			@doStepSniperRifleShot
 			);
 
 procedure InsertGearToList(Gear: PGear);
@@ -307,6 +308,10 @@
                 Result^.Radius:= 1;
                 Result^.Health:= 50
                 end;
+  gtSniperRifleShot: begin
+                Result^.Radius:= 1;
+                Result^.Health:= 50
+                end;
     gtDynamite: begin
                 Result^.Radius:= 3;
                 Result^.Elasticity:= _0_55;
@@ -636,15 +641,21 @@
 
     if (GameFlags and gfLaserSight) = 0 then
         cLaserSighting:= false;
-    // have to sweep *all* current team hedgehogs since it is theoretically possible if you have enough invulnerabilities and switch turns to make your entire team invulnerable
+
+    if (GameFlags and gfArtillery) = 0 then
+        cArtillery:= false;
 
-   if (GameFlags and gfInvulnerable) = 0 then
-       if (CurrentTeam <> nil) then
-          with CurrentTeam^ do
-             for i:= 0 to cMaxHHIndex do
-                 with Hedgehogs[i] do
-                     if (Gear <> nil) then
-                         Gear^.Invulnerable:= false;
+    // have to sweep *all* current team hedgehogs since it is theoretically possible if you have enough invulnerabilities and switch turns to make your entire team invulnerable
+    if (CurrentTeam <> nil) then
+       with CurrentTeam^ do
+          for i:= 0 to cMaxHHIndex do
+              with Hedgehogs[i] do
+                  begin
+                  if (SpeechGear <> nil) then DeleteGear(SpeechGear);  // remove to restore persisting beyond end of turn. Tiy says was too much of a gameplay issue
+                  if (Gear <> nil) then
+                     if (GameFlags and gfInvulnerable) = 0 then
+                        Gear^.Invulnerable:= false;
+                  end;
 end;
 procedure ApplyDamage(Gear: PGear; Damage: Longword);
 var s: shortstring;
@@ -716,7 +727,7 @@
 end;
 
 procedure DrawHH(Gear: PGear);
-var t: LongInt;
+var i, t: LongInt;
 	amt: TAmmoType;
 	hx, hy, cx, cy, tx, ty, sx, sy, m: LongInt;  // hedgehog, crosshair, temp, sprite, direction
 	lx, ly, dx, dy, ax, ay, aAngle, dAngle: real;  // laser, change
@@ -782,6 +793,12 @@
 						DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle);
 				end;
 			gtDEagleShot: DrawRotated(sprDEagle, hx, hy, hwSign(Gear^.dX), aangle);
+			gtSniperRifleShot: begin
+					if (CurAmmoGear^.State and gstAnimation <> 0) then
+			            DrawRotatedF(sprSniperRifle, hx, hy, 1, hwSign(Gear^.dX), aangle)
+					else
+			            DrawRotatedF(sprSniperRifle, hx, hy, 0, hwSign(Gear^.dX), aangle)
+				end;
 			gtBallgun: DrawRotated(sprHandBallgun, hx, hy, hwSign(Gear^.dX), aangle);
 			gtRCPlane: begin
 				DrawRotated(sprHandPlane, hx, hy, hwSign(Gear^.dX), 0);
@@ -791,16 +808,16 @@
 				if Gear^.X < CurAmmoGear^.X then
 					begin
 					dAngle:= 0;
-					m:= 1
+					i:= 1
 					end else
 					begin
 					dAngle:= 180;
-					m:= -1
+					i:= -1
 					end;
                 sx:= hwRound(Gear^.X) + WorldDx;
                 sy:= hwRound(Gear^.Y) + WorldDy;
 				DrawHedgehog(sx, sy,
-						m,
+						i,
 						1,
 						0,
 						DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle);
@@ -878,6 +895,7 @@
 		case CurAmmoGear^.Kind of
 			gtShotgunShot,
 			gtDEagleShot,
+			gtSniperRifleShot,
 			gtShover: begin
 				DrawHedgehog(sx, sy,
 						hwSign(Gear^.dX),
@@ -936,6 +954,7 @@
 			amRope: DrawRotated(sprHandRope, hx, hy, hwSign(Gear^.dX), aangle);
 			amShotgun: DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle);
 			amDEagle: DrawRotated(sprHandDEagle, hx, hy, hwSign(Gear^.dX), aangle);
+			amSniperRifle: DrawRotatedF(sprSniperRifle, hx, hy, 0, hwSign(Gear^.dX), aangle);
 			amBlowTorch: DrawRotated(sprHandBlowTorch, hx, hy, hwSign(Gear^.dX), aangle);
 			amRCPlane: begin
 				DrawRotated(sprHandPlane, hx, hy, hwSign(Gear^.dX), 0);
@@ -1401,7 +1420,10 @@
        end;
 
 if (GameFlags and gfLaserSight) <> 0 then
-    cLaserSighting:= true
+    cLaserSighting:= true;
+
+if (GameFlags and gfArtillery) <> 0 then
+    cArtillery:= true
 end;
 
 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord);