hedgewars/uCommandHandlers.pas
changeset 5247 bf6d4bc531d2
parent 5238 46ddaf14509d
child 5352 7f57d0c7816a
child 5356 bf058f0a77d6
--- a/hedgewars/uCommandHandlers.pas	Tue Jun 21 16:42:04 2011 +0400
+++ b/hedgewars/uCommandHandlers.pas	Tue Jun 21 16:43:05 2011 +0400
@@ -26,7 +26,7 @@
 procedure freeModule;
 
 implementation
-uses uCommands, uTypes, uVariables, uIO, uDebug, uConsts, uScript, uUtils, SDLh, uRandom;
+uses uCommands, uTypes, uVariables, uIO, uDebug, uConsts, uScript, uUtils, SDLh, uRandom, uCaptions;
 
 procedure chGenCmd(var s: shortstring);
 begin
@@ -331,7 +331,7 @@
         FollowGear:= CurrentHedgehog^.Gear;
         if not CurrentTeam^.ExtDriven then SendIPC('A');
         Message:= Message or (gmAttack and InputMask);
-	ScriptCall('onAttack');
+        ScriptCall('onAttack');
         end
     end
 end;
@@ -411,7 +411,7 @@
     begin
         Message:= Message or (gmWeapon and InputMask);
         MsgParam:= byte(s[1]);
-	ScriptCall('onSetWeapon');
+    ScriptCall('onSetWeapon');
     end;
 end;
 
@@ -510,8 +510,18 @@
 begin
 s:= s; // avoid compiler hint
 if CheckNoTeamOrHH or isPaused then exit;
-bShowFinger:= true;
-FollowGear:= CurrentHedgehog^.Gear
+
+if FollowGear <> nil then
+    begin
+    AddCaption('Auto Camera Off', $CCCCCC, capgrpVolume);
+    autoCameraOn:= false
+    end
+    else begin
+    AddCaption('Auto Camera On', $CCCCCC, capgrpVolume);
+    bShowFinger:= true;
+    FollowGear:= CurrentHedgehog^.Gear;
+    autoCameraOn:= true
+    end
 end;
 
 procedure chPause(var s: shortstring);