Skip to content

Commit

Permalink
Fix controls not properlly disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Dakota628 committed Jul 25, 2015
1 parent e06b7c4 commit e1c3fe9
Showing 1 changed file with 32 additions and 20 deletions.
52 changes: 32 additions & 20 deletions gtav_console/Console/DeveloperConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class DeveloperConsole : Script, IDeveloperConsole {
/// <summary>
/// Whether or not console debug is enabled
/// </summary>
public bool Debug = ConsoleSettings.Version.Equals("DEV");
public bool Debug = ConsoleSettings.IsDevBuild;

/// <summary>
/// The consoles input text
Expand All @@ -72,6 +72,8 @@ public DeveloperConsole() {
CommandDispatcher = new CommandDispatcher();
ObjectSelector = new ObjectSelector();

ShowConsole(false);

PrintLine(
"This is the developer console. To close, press the ' or F4 key on your keyboard. Run 'help' for a list of commands.");

Expand Down Expand Up @@ -251,6 +253,8 @@ private void OnTick(object sender, EventArgs e) {
_hasWarned = true;
}

if (!_isHidden) SetConsoleControls();

ObjectSelector.Tick();

DrawConsole();
Expand Down Expand Up @@ -584,26 +588,9 @@ public void ShowConsole(bool show) {
_isHidden = !show;
_lineOffset = 0;
_historyCursor = -1;
if (!_isHidden) {
if (show) {
_disabledControls = GTAFuncs.DisableAllControls();
GTAFuncs.EnableControlAction(Control.MoveLeftRight, true);
GTAFuncs.EnableControlAction(Control.MoveUpDown, true);
GTAFuncs.EnableControlAction(Control.VehicleAccelerate, true);
GTAFuncs.EnableControlAction(Control.VehicleBrake, true);
GTAFuncs.EnableControlAction(Control.VehicleDriveLook, true);
GTAFuncs.EnableControlAction(Control.VehicleDriveLook2, true);
GTAFuncs.EnableControlAction(Control.VehicleMoveLeftRight, true);
GTAFuncs.EnableControlAction(Control.VehicleMoveUpDown, true);
GTAFuncs.EnableControlAction(Control.LookLeftRight, true);
GTAFuncs.EnableControlAction(Control.LookUpDown, true);
GTAFuncs.EnableControlAction(Control.FlyUpDown, true);
GTAFuncs.EnableControlAction(Control.FlyLeftRight, true);
GTAFuncs.EnableControlAction(Control.VehicleFlyRollLeftRight, true);
GTAFuncs.EnableControlAction(Control.VehicleFlyPitchUpDown, true);
GTAFuncs.EnableControlAction(Control.VehicleFlyYawLeft, true);
GTAFuncs.EnableControlAction(Control.VehicleFlyYawRight, true);
GTAFuncs.EnableControlAction(Control.VehicleFlyThrottleDown, true);
GTAFuncs.EnableControlAction(Control.VehicleFlyThrottleUp, true);
SetConsoleControls();
}
else {
GTAFuncs.SetControlActions(false);
Expand All @@ -612,6 +599,31 @@ public void ShowConsole(bool show) {
}
}

/// <summary>
/// Disables all controls not enabled while using the console
/// </summary>
private void SetConsoleControls() {
GTAFuncs.SetControlActions(false);
GTAFuncs.EnableControlAction(Control.MoveLeftRight, true);
GTAFuncs.EnableControlAction(Control.MoveUpDown, true);
GTAFuncs.EnableControlAction(Control.VehicleAccelerate, true);
GTAFuncs.EnableControlAction(Control.VehicleBrake, true);
GTAFuncs.EnableControlAction(Control.VehicleDriveLook, true);
GTAFuncs.EnableControlAction(Control.VehicleDriveLook2, true);
GTAFuncs.EnableControlAction(Control.VehicleMoveLeftRight, true);
GTAFuncs.EnableControlAction(Control.VehicleMoveUpDown, true);
GTAFuncs.EnableControlAction(Control.LookLeftRight, true);
GTAFuncs.EnableControlAction(Control.LookUpDown, true);
GTAFuncs.EnableControlAction(Control.FlyUpDown, true);
GTAFuncs.EnableControlAction(Control.FlyLeftRight, true);
GTAFuncs.EnableControlAction(Control.VehicleFlyRollLeftRight, true);
GTAFuncs.EnableControlAction(Control.VehicleFlyPitchUpDown, true);
GTAFuncs.EnableControlAction(Control.VehicleFlyYawLeft, true);
GTAFuncs.EnableControlAction(Control.VehicleFlyYawRight, true);
GTAFuncs.EnableControlAction(Control.VehicleFlyThrottleDown, true);
GTAFuncs.EnableControlAction(Control.VehicleFlyThrottleUp, true);
}

#endregion

#region Utils
Expand Down

0 comments on commit e1c3fe9

Please sign in to comment.