1 void GameCommand_Init()
\r
3 // make gg call menu QC theCommands
\r
4 localcmd("alias qc_cmd \"menu_cmd $*\"\n");
\r
7 string _dumptree_space;
\r
8 void _dumptree_open(entity pass, entity me)
\r
11 s = me.toString(me);
\r
15 s = strcat(me.classname, ": ", s);
\r
16 print(_dumptree_space, etos(me), " (", s, ")");
\r
20 _dumptree_space = strcat(_dumptree_space, " ");
\r
25 void _dumptree_close(entity pass, entity me)
\r
29 _dumptree_space = substring(_dumptree_space, 0, strlen(_dumptree_space) - 2);
\r
30 print(_dumptree_space, "}\n");
\r
34 void GameCommand(string theCommand)
\r
37 argc = tokenize_console(theCommand);
\r
39 if(argv(0) == "help" || argc == 0)
\r
41 print("Usage: menu_cmd theCommand..., where possible theCommands are:\n");
\r
42 print(" sync - reloads all cvars on the current menu page\n");
\r
43 print(" directmenu ITEM - select a menu item as main item\n");
\r
44 GameCommand_Generic("help");
\r
48 if(GameCommand_Generic(theCommand))
\r
51 if(argv(0) == "sync")
\r
57 if(argv(0) == "directmenu") if(argc == 2)
\r
59 // switch to a menu item
\r
60 if(!isdemo()) // don't allow this command in demos
\r
65 if(argv(0) == "skinselect")
\r
67 m_goto_skin_selector();
\r
71 if(argv(0) == "videosettings")
\r
73 m_goto_video_settings();
\r
77 if(argv(0) == "dumptree")
\r
79 _dumptree_space = "";
\r
80 depthfirst(main, parent, firstChild, nextSibling, _dumptree_open, _dumptree_close, NULL);
\r
84 if(argv(0) == "setresolution")
\r
91 if(argv(0) == "tokentest")
\r
96 print("SANE tokenizer:\n");
\r
97 s = cvar_string("tokentest");
\r
98 n = tokenize_console_force_builtin(s);
\r
99 for(i = -n; i < n; ++i)
\r
101 print("token ", ftos(i), ": '", argv(i), "' = ");
\r
102 print(ftos(argv_start_index(i)), " to ", ftos(argv_end_index(i)), "\n");
\r
106 print("INSANE tokenizer:\n");
\r
107 s = cvar_string("tokentest");
\r
109 for(i = -n; i < n; ++i)
\r
111 print("token ", ftos(i), ": '", argv(i), "' = ");
\r
112 print(ftos(argv_start_index(i)), " to ", ftos(argv_end_index(i)), "\n");
\r
116 print("EMULATED tokenizer:\n");
\r
117 s = cvar_string("tokentest");
\r
118 n = tokenize_console_force_emulation(s);
\r
119 for(i = -n; i < n; ++i)
\r
121 print("token ", ftos(i), ": '", argv(i), "' = ");
\r
122 print(ftos(argv_start_index(i)), " to ", ftos(argv_end_index(i)), "\n");
\r
129 print("Invalid theCommand. For a list of supported theCommands, try menu_cmd help.\n");
\r