# HG changeset patch # User unc0rr # Date 1308660185 -14400 # Node ID bf6d4bc531d2782580957d93d3132d4a9e4f80e6 # Parent 1b408b965c01eac67c6f954b73a8f822340f89cc Ability to turn camera following gears off diff -r 1b408b965c01 -r bf6d4bc531d2 hedgewars/uCommandHandlers.pas --- 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); diff -r 1b408b965c01 -r bf6d4bc531d2 hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Tue Jun 21 16:42:04 2011 +0400 +++ b/hedgewars/uVariables.pas Tue Jun 21 16:43:05 2011 +0400 @@ -62,6 +62,7 @@ isFirstFrame : boolean; fastUntilLag : boolean; + autoCameraOn : boolean; GameState : TGameState; GameType : TGameType; @@ -2356,6 +2357,7 @@ fastUntilLag := false; isFirstFrame := true; isSEBackup := true; + autoCameraOn := true; cSeed := ''; cVolumeDelta := 0; cHasFocus := true; diff -r 1b408b965c01 -r bf6d4bc531d2 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Tue Jun 21 16:42:04 2011 +0400 +++ b/hedgewars/uWorld.pas Tue Jun 21 16:43:05 2011 +0400 @@ -1165,7 +1165,7 @@ {$ENDIF} if (not PlacingHogs) and (FollowGear <> nil) and (not isCursorVisible) and (not fastUntilLag) then - if abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y) > 4 then + if (not autoCameraOn) or (abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y) > 4) then begin FollowGear:= nil; prevPoint:= CursorPoint;