1 void GameCommand_Init()
3 // make gg call menu QC theCommands
4 localcmd("alias qc_cmd \"menu_cmd $*\"\n");
7 string _dumptree_space;
8 void _dumptree_open(entity pass, entity me)
15 s = strcat(me.classname, ": ", s);
16 print(_dumptree_space, etos(me), " (", s, ")");
20 _dumptree_space = strcat(_dumptree_space, " ");
25 void _dumptree_close(entity pass, entity me)
29 _dumptree_space = substring(_dumptree_space, 0, strlen(_dumptree_space) - 2);
30 print(_dumptree_space, "}\n");
34 void GameCommand(string theCommand)
37 argc = tokenize_console(theCommand);
39 if(argv(0) == "help" || argc == 0)
41 print("Usage: menu_cmd theCommand..., where possible theCommands are:\n");
42 print(" sync - reloads all cvars on the current menu page\n");
43 print(" directmenu ITEM - select a menu item as main item\n");
44 GameCommand_Generic("help");
48 if(GameCommand_Generic(theCommand))
57 if(argv(0) == "directmenu") if(argc == 2)
59 // switch to a menu item
60 if(!isdemo()) // don't allow this command in demos
65 if(argv(0) == "directpanelhudmenu")
67 // switch to a menu item
68 m_goto(strcat("HUD", argv(1)));
72 if(argv(0) == "skinselect")
74 m_goto_skin_selector();
78 if(argv(0) == "videosettings")
80 m_goto_video_settings();
84 if(argv(0) == "dumptree")
87 depthfirst(main, parent, firstChild, nextSibling, _dumptree_open, _dumptree_close, NULL);
91 if(argv(0) == "setresolution")
97 if(argv(0) == "setcompression")
104 if(argv(0) == "tokentest")
109 print("SANE tokenizer:\n");
110 s = cvar_string("tokentest");
111 n = tokenize_console_force_builtin(s);
112 for(i = -n; i < n; ++i)
114 print("token ", ftos(i), ": '", argv(i), "' = ");
115 print(ftos(argv_start_index(i)), " to ", ftos(argv_end_index(i)), "\n");
119 print("INSANE tokenizer:\n");
120 s = cvar_string("tokentest");
122 for(i = -n; i < n; ++i)
124 print("token ", ftos(i), ": '", argv(i), "' = ");
125 print(ftos(argv_start_index(i)), " to ", ftos(argv_end_index(i)), "\n");
129 print("EMULATED tokenizer:\n");
130 s = cvar_string("tokentest");
131 n = tokenize_console_force_emulation(s);
132 for(i = -n; i < n; ++i)
134 print("token ", ftos(i), ": '", argv(i), "' = ");
135 print(ftos(argv_start_index(i)), " to ", ftos(argv_end_index(i)), "\n");
142 print("Invalid theCommand. For a list of supported theCommands, try menu_cmd help.\n");