3 #include "../../common/command/generic.qh"
5 string _dumptree_space;
6 void _dumptree_open(entity pass, entity me)
13 s = strcat(me.classname, ": ", s);
14 print(_dumptree_space, etos(me), " (", s, ")");
18 _dumptree_space = strcat(_dumptree_space, " ");
23 void _dumptree_close(entity pass, entity me)
27 _dumptree_space = substring(_dumptree_space, 0, strlen(_dumptree_space) - 2);
28 print(_dumptree_space, "}\n");
32 void GameCommand(string theCommand)
35 argc = tokenize_console(theCommand);
37 if(argv(0) == "help" || argc == 0)
39 print(_("Usage: menu_cmd command..., where possible commands are:\n"));
40 print(_(" sync - reloads all cvars on the current menu page\n"));
41 print(_(" directmenu ITEM - select a menu item as main item\n"));
43 print("\nGeneric commands shared by all programs:\n");
44 GenericCommand_macro_help();
49 if(GenericCommand(theCommand))
58 if(argv(0) == "update_conwidths_before_vid_restart")
60 updateConwidths(cvar("vid_width"), cvar("vid_height"), cvar("vid_pixelheight"));
64 if(argv(0) == "directmenu" || argv(0) == "directpanelhudmenu")
66 string filter = string_null;
67 if(argv(0) == "directpanelhudmenu")
68 filter = strzone("HUD");
72 print(_("Available options:\n"));
77 for(i = 0, e = world; (e = nextent(e)); )
78 if(e.classname != "vtbl" && e.name != "")
83 if(substring(s, 0, strlen(filter)) != filter)
85 s = substring(s, strlen(filter), strlen(s) - strlen(filter));
87 print(strcat(" ", s ,"\n"));
91 else if(argc == 2 && !isdemo()) // don't allow this command in demos
93 m_play_click_sound(MENU_SOUND_OPEN);
94 m_goto(strcat(filter, argv(1))); // switch to a menu item
101 if(argv(0) == "skinselect")
103 m_goto("skinselector");
107 if(argv(0) == "languageselect")
109 m_goto("languageselector");
113 if(argv(0) == "videosettings")
115 m_goto("videosettings");
119 if(argv(0) == "dumptree")
121 _dumptree_space = "";
122 depthfirst(main, parent, firstChild, nextSibling, _dumptree_open, _dumptree_close, NULL);
126 print(_("Invalid command. For a list of supported commands, try menu_cmd help.\n"));