From c06ea52478167d36e5cdab5c7994ea1f5a1c9f2f Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Sun, 3 Jun 2012 16:58:30 -0500 Subject: [PATCH] Adding tcc command to AxiosCommandConsole to toggle the ability to control the camera using the arrow keys Adding the ability to disable commands in XNACC from AxiosCommandConsole --- axios/Axios_settings.cs | 1 + axios/Engine/AxiosCommandConsole.cs | 15 +++++++++++++++ axios/Engine/AxiosGameScreen.cs | 6 ++++++ axios/XNACC/CommandConsoleBase.cs | 3 +++ 4 files changed, 25 insertions(+) diff --git a/axios/Axios_settings.cs b/axios/Axios_settings.cs index 358fa28..8f7bc17 100644 --- a/axios/Axios_settings.cs +++ b/axios/Axios_settings.cs @@ -99,6 +99,7 @@ * - Changing variables in CommandConsoleBase to be non-static * - Adding rotation to DrawableAxiosGameObject * - Adding InputState extensions to test for input agaisnt Player One + * - Adding the ability to disable commands in XNACC from AxiosCommandConsole * * */ diff --git a/axios/Engine/AxiosCommandConsole.cs b/axios/Engine/AxiosCommandConsole.cs index 48658d2..03e3319 100644 --- a/axios/Engine/AxiosCommandConsole.cs +++ b/axios/Engine/AxiosCommandConsole.cs @@ -24,6 +24,7 @@ namespace Axios.Engine public class AxiosCommandConsole : CommandConsoleBase { protected AxiosGameScreen GameScreen; + protected List RestrictedCommands = new List(); public AxiosCommandConsole(AxiosGameScreen gameScreen) : base(gameScreen.ScreenManager.Game) { @@ -54,14 +55,27 @@ namespace Axios.Engine AddOutputToLog("============"); } + public void ToggleCamera() + { + GameScreen.EnableCameraControl = !GameScreen.EnableCameraControl; + } + public override void InitializeCustomCommands() { AddCommand(new CmdObject("axioslog", "Displays the current Axios Log", input => { ShowAxiosLog(); })); + AddCommand(new CmdObject("tcc", "Toggles user camera control", input => { ToggleCamera(); })); base.InitializeCustomCommands(); + } public override void LoadContent(ContentManager content) { base.LoadContent(content); + + foreach (string cmd in RestrictedCommands) + { + if (ms_commands.Keys.Contains(cmd)) + ms_commands.Remove(cmd); + } } protected override void LoadContent() @@ -77,6 +91,7 @@ namespace Axios.Engine base.UnloadContent(); //ms_commands.Remove("axioslog"); } + } } #else diff --git a/axios/Engine/AxiosGameScreen.cs b/axios/Engine/AxiosGameScreen.cs index 0a82093..2b1c393 100644 --- a/axios/Engine/AxiosGameScreen.cs +++ b/axios/Engine/AxiosGameScreen.cs @@ -207,6 +207,12 @@ namespace Axios.Engine } #endif camera = new Camera(ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height); + +#if DEBUG + EnableCameraControl = true; +#else + EnableCameraControl = false; +#endif } public override void Draw(GameTime gameTime) diff --git a/axios/XNACC/CommandConsoleBase.cs b/axios/XNACC/CommandConsoleBase.cs index 72e892d..46bf54a 100644 --- a/axios/XNACC/CommandConsoleBase.cs +++ b/axios/XNACC/CommandConsoleBase.cs @@ -2310,12 +2310,15 @@ namespace XNACC.Console { string cvarName = cmdLine[ 1 ].ToLowerInvariant(); + // Isn't this preventing us from modifying a cvar? + // -- Nathan Adams [adamsna@datanethost.net] - 6/3/2012 if( m_cVars.TryGetValue( cvarName, out cvar ) ) { AddErrorToLog( "CVar " + cmdLine[ 1 ] + " already exists with a value of: " + cvar.Value ?? "(null" ); return; } + if( cmdLine.Length == 4 ) { string typeName = cmdLine[ 2 ];