3 #include "../../dpdefs/menudefs.qh"
4 #include "../../common/util.qh"
5 #include "../oo/base.qh"
11 string _dumptree_space;
12 void _dumptree_open(entity pass, entity me)
19 s = strcat(me.classname, ": ", s);
20 print(_dumptree_space, etos(me), " (", s, ")");
24 _dumptree_space = strcat(_dumptree_space, " ");
29 void _dumptree_close(entity pass, entity me)
33 _dumptree_space = substring(_dumptree_space, 0, strlen(_dumptree_space) - 2);
34 print(_dumptree_space, "}\n");
38 void GameCommand(string theCommand)
41 argc = tokenize_console(theCommand);
43 if(argv(0) == "help" || argc == 0)
45 print(_("Usage: menu_cmd command..., where possible commands are:\n"));
46 print(_(" sync - reloads all cvars on the current menu page\n"));
47 print(_(" directmenu ITEM - select a menu item as main item\n"));
49 print("\nGeneric commands shared by all programs:\n");
50 GenericCommand_macro_help();
55 if(GenericCommand(theCommand))
64 if(argv(0) == "update_conwidths_before_vid_restart")
66 updateConwidths(cvar("vid_width"), cvar("vid_height"), cvar("vid_pixelheight"));
70 if(argv(0) == "directmenu" || argv(0) == "directpanelhudmenu")
72 string filter = string_null;
73 if(argv(0) == "directpanelhudmenu")
74 filter = strzone("HUD");
78 print(_("Available options:\n"));
83 for(i = 0, e = world; (e = nextent(e)); )
84 if(e.classname != "vtbl" && e.name != "")
89 if(substring(s, 0, strlen(filter)) != filter)
91 s = substring(s, strlen(filter), strlen(s) - strlen(filter));
93 print(strcat(" ", s ,"\n"));
97 else if(argc == 2 && !isdemo()) // don't allow this command in demos
98 m_goto(strcat(filter, argv(1))); // switch to a menu item
104 if(argv(0) == "skinselect")
106 m_goto("skinselector");
110 if(argv(0) == "languageselect")
112 m_goto("languageselector");
116 if(argv(0) == "videosettings")
118 m_goto("videosettings");
122 if(argv(0) == "dumptree")
124 _dumptree_space = "";
125 depthfirst(main, parent, firstChild, nextSibling, _dumptree_open, _dumptree_close, NULL);
129 print(_("Invalid command. For a list of supported commands, try menu_cmd help.\n"));