Fix sniper rifle disabling laser sight utility after shooting
authorWuzzy <almikes@aol.com>
Sat, 22 Apr 2017 23:06:47 +0200
changeset 12311 cdd884397760
parent 12310 d3a52e51efd4
child 12312 cbc34bb96b1f
Fix sniper rifle disabling laser sight utility after shooting
ChangeLog.txt
hedgewars/uGears.pas
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsRender.pas
hedgewars/uVariables.pas
--- a/ChangeLog.txt	Sat Apr 22 22:23:49 2017 +0200
+++ b/ChangeLog.txt	Sat Apr 22 23:06:47 2017 +0200
@@ -30,6 +30,7 @@
  * Video recording functionality is restored
  * Fixed bee not being affected by wrap world edge while still being thrown
  * Fixed turn not ending when sticky mine was trapped on rubberband
+ * Fixed sniper rifle disabling laser sight utility after using
  * Fixed hedgehog-voices missing a response type (Justyouwait/"You're gonna pay for that") on some platforms (e.g. Linux)
  * Fixed SD-flakes of themes not working if regular flakes were disabled
  * Fixed RC planes being able to collect frozen crates
--- a/hedgewars/uGears.pas	Sat Apr 22 22:23:49 2017 +0200
+++ b/hedgewars/uGears.pas	Sat Apr 22 23:06:47 2017 +0200
@@ -522,7 +522,10 @@
     cDamageModifier:= _1;
 
     if (GameFlags and gfLaserSight) = 0 then
+        begin
         cLaserSighting:= false;
+        cLaserSightingSniper:= false
+        end;
 
     if (GameFlags and gfArtillery) = 0 then
         cArtillery:= false;
--- a/hedgewars/uGearsHandlersMess.pas	Sat Apr 22 22:23:49 2017 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Sat Apr 22 23:06:47 2017 +0200
@@ -1316,8 +1316,8 @@
         or (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0)
         or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then
             begin
-            if (Gear^.Kind = gtSniperRifleShot) and ((GameFlags and gfLaserSight) = 0) then
-                cLaserSighting := false;
+            if (Gear^.Kind = gtSniperRifleShot) then
+                cLaserSightingSniper := false;
             if (Ammoz[Gear^.AmmoType].Ammo.NumPerTurn <= CurrentHedgehog^.MultiShootAttacks) and ((GameFlags and gfArtillery) = 0) then
                 cArtillery := false;
 
@@ -1370,10 +1370,10 @@
 
     HHGear^.State := HHGear^.State or gstNotKickable;
     HedgehogChAngle(HHGear);
-    if not cLaserSighting then
-        // game does not have default laser sight. turn it on and give them a chance to aim
-        begin
-        cLaserSighting := true;
+    if cLaserSightingSniper = false then
+        // Turn sniper's laser sight on and give it a chance to aim
+        begin
+        cLaserSightingSniper := true;
         HHGear^.Message := 0;
         if (HHGear^.Angle >= 32) then
             dec(HHGear^.Angle,32)
--- a/hedgewars/uGearsRender.pas	Sat Apr 22 22:23:49 2017 +0200
+++ b/hedgewars/uGearsRender.pas	Sat Apr 22 23:06:47 2017 +0200
@@ -383,7 +383,7 @@
     *)
             dx:= sign * m * Sin(Gear^.Angle * pi / cMaxAngle);
             dy:= -Cos(Gear^.Angle * pi / cMaxAngle);
-            if cLaserSighting then
+            if cLaserSighting or cLaserSightingSniper then
                 begin
                 lx:= GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle);
                 ly:= GetLaunchY(HH^.CurAmmoType, Gear^.Angle);
--- a/hedgewars/uVariables.pas	Sat Apr 22 22:23:49 2017 +0200
+++ b/hedgewars/uVariables.pas	Sat Apr 22 23:06:47 2017 +0200
@@ -186,6 +186,7 @@
     cBuildMaxDist   : LongInt;
     cDamageModifier : hwFloat;
     cLaserSighting  : boolean;
+    cLaserSightingSniper : boolean;
     cVampiric       : boolean;
     cArtillery      : boolean;
     WeaponTooltipTex: PTexture;
@@ -2762,6 +2763,7 @@
     ZoomValue       := cDefaultZoomLevel;
     WeaponTooltipTex:= nil;
     cLaserSighting  := false;
+    cLaserSightingSniper := false;
     cVampiric       := false;
     cArtillery      := false;
     flagMakeCapture := false;