4 #include "../oo/classes.qc"
6 #include "../../common/command/generic.qh"
8 .entity firstChild, nextSibling;
10 string _dumptree_space;
11 void _dumptree_open(entity pass, entity me)
15 if (s == "") s = me.classname;
16 else s = strcat(me.classname, ": ", s);
17 LOG_INFO(_dumptree_space, etos(me), " (", s, ")");
21 _dumptree_space = strcat(_dumptree_space, " ");
28 void _dumptree_close(entity pass, entity me)
32 _dumptree_space = substring(_dumptree_space, 0, strlen(_dumptree_space) - 2);
33 LOG_INFO(_dumptree_space, "}\n");
37 float updateConwidths(float width, float height, float pixelheight);
39 void GameCommand(string theCommand)
42 argc = tokenize_console(theCommand);
44 if (argv(0) == "help" || argc == 0)
46 LOG_INFO(_("Usage: menu_cmd command..., where possible commands are:\n"));
47 LOG_INFO(_(" sync - reloads all cvars on the current menu page\n"));
48 LOG_INFO(_(" directmenu ITEM - select a menu item as main item\n"));
50 LOG_INFO("\nGeneric commands shared by all programs:\n");
51 GenericCommand_macro_help();
56 if (GenericCommand(theCommand)) return;
58 if (argv(0) == "sync")
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") filter = strzone("HUD");
77 LOG_INFO(_("Available options:\n"));
82 for (i = 0, e = NULL; (e = nextent(e)); )
83 if (e.classname != "vtbl" && e.name != "")
88 if (substring(s, 0, strlen(filter)) != filter) continue;
89 s = substring(s, strlen(filter), strlen(s) - strlen(filter));
91 LOG_INFO(strcat(" ", s, "\n"));
95 else if (argc == 2 && !isdemo()) // don't allow this command in demos
97 m_play_click_sound(MENU_SOUND_OPEN);
98 m_goto(strcat(filter, argv(1))); // switch to a menu item
100 if (filter) strunzone(filter);
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 LOG_INFO(_("Invalid command. For a list of supported commands, try menu_cmd help.\n"));