Command arguments.
Inheritance: System.EventArgs
示例#1
0
		private void Cmd_ListRendererCommands(object sender, CommandEventArgs e)
		{
			ListByFlags(e.Args, CommandFlags.Renderer);
		}
示例#2
0
		private void Cmd_ListSoundCommands(object sender, CommandEventArgs e)
		{
			ListByFlags(e.Args, CommandFlags.Sound);
		}
示例#3
0
		private void Cmd_Dump(object sender, CommandEventArgs e)
		{
			if(e.Args.Length != 2)
			{
				idConsole.WriteLine("usage: conDump <filename>");
			}
			else
			{
				string fileName = e.Args.Get(1);

				if(Path.HasExtension(fileName) == false)
				{
					fileName += ".txt";
				}

				Dump(fileName);

				idConsole.WriteLine("Dumped console text to {0}.", fileName);
			}
		}
示例#4
0
		private void Cmd_ListSystemCommands(object sender, CommandEventArgs e)
		{
			ListByFlags(e.Args, CommandFlags.System);
		}
示例#5
0
		/// <summary>
		/// Just prints the rest of the line to the console.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void Cmd_Echo(object sender, CommandEventArgs e)
		{
			int count = e.Args.Length;
			
			for(int i = 1; i < count; i++)
			{
				idConsole.Write("{0} ", e.Args.Get(i));
			}

			idConsole.WriteLine("");
		}
示例#6
0
		/// <summary>
		/// This just prints out how the rest of the line was parsed, as a debugging tool.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void Cmd_Parse(object sender, CommandEventArgs e)
		{
			int count = e.Args.Length;

			for(int i = 0; i < count; i++)
			{
				idConsole.WriteLine("{0}: {1}", i, e.Args.Get(i));
			}
		}
示例#7
0
		private void Cmd_Restart(object sender, CommandEventArgs e)
		{
			List<string> toRemove = new List<string>();

			foreach(KeyValuePair<string, idInternalCvar> kvp in _cvarList)
			{
				idInternalCvar cvar = kvp.Value;

				// don't mess with rom values
				if((cvar.Flags & (CvarFlags.ReadOnly | CvarFlags.Init)) != 0)
				{
					continue;
				}

				// throw out any variables the user created
				if((cvar.Flags & CvarFlags.Static) == 0)
				{
					toRemove.Add(cvar.Name);
				}
				else
				{
					cvar.Reset();
				}
			}

			foreach(string name in toRemove)
			{
				_cvarList.Remove(name);
			}
		}
示例#8
0
		private void Cmd_Exec(object sender, CommandEventArgs e)
		{
			if(e.Args.Length != 2)
			{
				idConsole.WriteLine("exec <filename> : execute a script file");
			}
			else
			{
				string fileName = e.Args.Get(1);

				if(Path.HasExtension(fileName) == false)
				{
					fileName += ".cfg";
				}

				byte[] data = idE.FileSystem.ReadFile(fileName);
				
				if(data == null)
				{
					idConsole.WriteLine("couldn't exec {0}", e.Args.Get(1));
				}
				else
				{
					string content = UTF8Encoding.UTF8.GetString(data);

					idConsole.WriteLine("execing {0}", e.Args.Get(1));
					idE.CmdSystem.BufferCommandText(Execute.Insert, content);
				}
			}
		}
示例#9
0
		private void Cmd_Reset(object sender, CommandEventArgs e)
		{
			if(e.Args.Length != 2)
			{
				idConsole.WriteLine("usage: reset <variable>");
			}
			else
			{
				idInternalCvar cvar = FindInternal(e.Args.Get(1));

				if(cvar != null)
				{
					cvar.Reset();
				}
			}
		}
示例#10
0
		private void Cmd_List(object sender, CommandEventArgs e)
		{
			ListByFlags(e.Args, CvarFlags.All);
		}
示例#11
0
		private void Cmd_SetA(object sender, CommandEventArgs e)
		{
			Cmd_Set(sender, e);

			idInternalCvar cvar = FindInternal(e.Args.Get(1));

			if(cvar != null)
			{
				cvar.Flags |= CvarFlags.Archive;
			}
		}
示例#12
0
		private void Cmd_Set(object sender, CommandEventArgs e)
		{
			idE.CvarSystem.SetString(e.Args.Get(1), e.Args.Get(2, e.Args.Length - 1));
		}
示例#13
0
		private void Cmd_Toggle(object sender, CommandEventArgs e)
		{
			int argCount = e.Args.Length;

			if(argCount < 2)
			{
				idConsole.WriteLine("usage:");
				idConsole.WriteLine("    toggle <variable> - toggles between 0 and 1");
				idConsole.WriteLine("    toggle <variable> <value> - toggles between 0 and <value>");
				idConsole.WriteLine("    toggle <variable [string 1] [string 2]...[string n] - cycles through all strings");
			}
			else
			{
				idInternalCvar cvar = idE.CvarSystem.FindInternal(e.Args.Get(1));

				if(cvar == null)
				{
					idConsole.WriteLine("toggle: cvar \"{0}\" not found", e.Args.Get(1));
				}
				else if(argCount > 3)
				{
					// cycle through multiple values
					string text = cvar.ToString();
					int i = 0;


					for(i = 2; i < argCount; i++)
					{
						if(StringComparer.CurrentCultureIgnoreCase.Compare(text, e.Args.Get(i)) == 0)
						{
							i++;
							break;
						}
					}

					if(i >= argCount)
					{
						i = 2;
					}

					idConsole.WriteLine("set {0} = {1}", e.Args.Get(1), e.Args.Get(i));
					cvar.Set(e.Args.Get(i), false, false);
				}
				else
				{
					// toggle between 0 and 1
					float current = cvar.ToFloat();
					float set = 0;

					if(e.Args.Length == 3)
					{
						float.TryParse(e.Args.Get(2), out set);
					}
					else
					{
						set = 1.0f;
					}

					if(current == 0.0f)
					{
						current = set;
					}
					else
					{
						current = 0.0f;
					}

					idConsole.WriteLine("set {0} = {1}", e.Args.Get(1), current);
					cvar.Set(current.ToString(), false, false);
				}
			}
		}
示例#14
0
		private void Cmd_ListGameCommands(object sender, CommandEventArgs e)
		{
			ListByFlags(e.Args, CommandFlags.Game);
		}
示例#15
0
		private void Cmd_Quit(object sender, CommandEventArgs e)
		{
			this.Exit();
		}
示例#16
0
		private void Cmd_ListToolCommands(object sender, CommandEventArgs e)
		{
			ListByFlags(e.Args, CommandFlags.Tool);
		}
示例#17
0
		private void Cmd_ReloadLanguage(object sender, CommandEventArgs e)
		{
			InitLanguageDict();
		}
示例#18
0
		/// <summary>
		/// Inserts the current value of a cvar as command text.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void Cmd_VStr(object sender, CommandEventArgs e)
		{
			if(e.Args.Length != 2)
			{
				idConsole.WriteLine("vstr <variablename> : execute a variable command");
			}
			else
			{
				idE.CmdSystem.BufferCommandText(Execute.Append, idE.CvarSystem.GetString(e.Args.Get(1)));
			}
		}
示例#19
0
		private void Cmd_ExecMachineSpec(object sender, CommandEventArgs e)
		{
			switch(idE.CvarSystem.GetInteger("com_machineSpec"))
			{
				case 3:
					SetUltraHighQuality();
					break;

				case 2:
					SetHighQuality();
					break;

				case 1:
					SetMediumQuality();
					break;

				default:
					SetLowQuality();
					break;
			}

			if(idE.Platform.TotalVideoMemory < 128)
			{
				idE.CvarSystem.SetBool("image_ignoreHighQuality", true, CvarFlags.Archive);
				idE.CvarSystem.SetInteger("image_downSize", 1, CvarFlags.Archive);
				idE.CvarSystem.SetInteger("image_downSizeLimit", 256, CvarFlags.Archive);
				idE.CvarSystem.SetInteger("image_downSizeSpecular", 1, CvarFlags.Archive);
				idE.CvarSystem.SetInteger("image_downSizeSpecularLimit", 64, CvarFlags.Archive);
				idE.CvarSystem.SetInteger("image_downSizeBump", 1, CvarFlags.Archive);
				idE.CvarSystem.SetInteger("image_downSizeBumpLimit", 256, CvarFlags.Archive);
			}

			if(idE.Platform.TotalVideoMemory < 512)
			{
				idE.CvarSystem.SetBool("image_ignoreHighQuality", true, CvarFlags.Archive);
				idE.CvarSystem.SetInteger("s_maxSoundsPerShader", 1, CvarFlags.Archive);
				idE.CvarSystem.SetInteger("image_downSize", 1, CvarFlags.Archive);
				idE.CvarSystem.SetInteger("image_downSizeLimit", 256, CvarFlags.Archive);
				idE.CvarSystem.SetInteger("image_downSizeSpecular", 1, CvarFlags.Archive);
				idE.CvarSystem.SetInteger("image_downSizeSpecularLimit", 64, CvarFlags.Archive);
				idE.CvarSystem.SetBool("com_purgeAll", true, CvarFlags.Archive);
				idE.CvarSystem.SetBool("r_forceLoadImages", true, CvarFlags.Archive);
			}
			else
			{
				idE.CvarSystem.SetBool("com_purgeAll", false, CvarFlags.Archive);
				idE.CvarSystem.SetBool("r_forceLoadImages", false, CvarFlags.Archive);
			}

			// TODO
			/*bool oldCard = false;
			bool nv10or20 = false;
			renderSystem->GetCardCaps( oldCard, nv10or20 );
			if ( oldCard ) {
				cvarSystem->SetCVarBool( "g_decals", false, CVAR_ARCHIVE );
				cvarSystem->SetCVarBool( "g_projectileLights", false, CVAR_ARCHIVE );
				cvarSystem->SetCVarBool( "g_doubleVision", false, CVAR_ARCHIVE );
				cvarSystem->SetCVarBool( "g_muzzleFlash", false, CVAR_ARCHIVE );
			} else {*/
			idE.CvarSystem.SetBool("g_decals", true, CvarFlags.Archive);
			idE.CvarSystem.SetBool("g_projectileLights", true, CvarFlags.Archive);
			idE.CvarSystem.SetBool("g_doubleVision", true, CvarFlags.Archive);
			idE.CvarSystem.SetBool("g_muzzleFlash", true, CvarFlags.Archive);
			/*}
			if ( nv10or20 ) {*/
			idE.CvarSystem.SetInteger("image_useNormalCompression", 1, CvarFlags.Archive);
			/*}*/

#if MACOS_X
			// TODO MACOS
			// On low settings, G4 systems & 64MB FX5200/NV34 Systems should default shadows off
			bool oldArch;
			int vendorId, deviceId, cpuId;
			OSX_GetVideoCard( vendorId, deviceId );
			OSX_GetCPUIdentification( cpuId, oldArch );
			bool isFX5200 = vendorId == 0x10DE && ( deviceId & 0x0FF0 ) == 0x0320;
			if ( ( oldArch || ( isFX5200 && Sys_GetVideoRam() < 128 ) ) && com_machineSpec.GetInteger() == 0 ) {
				cvarSystem->SetCVarBool( "r_shadows", false, CVAR_ARCHIVE );
			} else {
				cvarSystem->SetCVarBool( "r_shadows", true, CVAR_ARCHIVE );
			}
#endif
		}
示例#20
0
		/// <summary>
		/// Causes execution of the remainder of the command buffer to be delayed until next frame.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void Cmd_Wait(object sender, CommandEventArgs e)
		{
			if(e.Args.Length == 2)
			{
				int.TryParse(e.Args.Get(1), out _wait);
			}
			else
			{
				_wait = 1;
			}
		}
示例#21
0
		/// <summary>
		/// Just throw a fatal error to test error shutdown procedures.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void Cmd_Error(object sender, CommandEventArgs e)
		{
			if(idE.CvarSystem.GetBool("developer") == false)
			{
				idConsole.WriteLine("error may only be used in developer mode");
			}
			else if(e.Args.Length > 1)
			{
				idConsole.FatalError("Testing fatal error");
			}
			else
			{
				idConsole.Error("Testing drop error");
			}
		}
示例#22
0
		private void Cmd_Map(object sender, CommandEventArgs e)
		{
			string map = e.Args.Get(1);

			if(map == string.Empty)
			{
				return;
			}

			map = Path.Combine(Path.GetDirectoryName(map), Path.GetFileNameWithoutExtension(map));

			// make sure the level exists before trying to change, so that
			// a typo at the server console won't end the game
			// handle addon packs through reloadEngine
			string mapPath = string.Format("maps/{0}.map", map);

			if(idE.FileSystem.FileExists(mapPath) == false)
			{
				idConsole.WriteLine("Can't find map {0}", mapPath);
			}
			else
			{

				// TODO: FIND_ADDON
				/*case FIND_ADDON:
					common->Printf( "map %s is in an addon pak - reloading\n", string.c_str() );
					rl_args.AppendArg( "map" );
					rl_args.AppendArg( map );
					cmdSystem->SetupReloadEngine( rl_args );
					return;*/
			}

			idE.CvarSystem.SetBool("developer", false);
			idE.Session.StartNewGame(map, true);
		}
示例#23
0
		private void Cmd_Clear(object sender, CommandEventArgs e)
		{
			_consoleField.Clear();
			_buffer.Clear();
		}