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)
18 s = strcat(me.classname, ": ", s);
19 print(_dumptree_space, etos(me), " (", s, ")");
23 _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 print(_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 print(_("Usage: menu_cmd command..., where possible commands are:\n"));
47 print(_(" sync - reloads all cvars on the current menu page\n"));
48 print(_(" directmenu ITEM - select a menu item as main item\n"));
50 print("\nGeneric commands shared by all programs:\n");
51 GenericCommand_macro_help();
56 if(GenericCommand(theCommand))
65 if(argv(0) == "update_conwidths_before_vid_restart")
67 updateConwidths(cvar("vid_width"), cvar("vid_height"), cvar("vid_pixelheight"));
71 if(argv(0) == "directmenu" || argv(0) == "directpanelhudmenu")
73 string filter = string_null;
74 if(argv(0) == "directpanelhudmenu")
75 filter = strzone("HUD");
79 print(_("Available options:\n"));
84 for(i = 0, e = world; (e = nextent(e)); )
85 if(e.classname != "vtbl" && e.name != "")
90 if(substring(s, 0, strlen(filter)) != filter)
92 s = substring(s, strlen(filter), strlen(s) - strlen(filter));
94 print(strcat(" ", s ,"\n"));
98 else if(argc == 2 && !isdemo()) // don't allow this command in demos
100 m_play_click_sound(MENU_SOUND_OPEN);
101 m_goto(strcat(filter, argv(1))); // switch to a menu item
108 if(argv(0) == "skinselect")
110 m_goto("skinselector");
114 if(argv(0) == "languageselect")
116 m_goto("languageselector");
120 if(argv(0) == "videosettings")
122 m_goto("videosettings");
126 if(argv(0) == "dumptree")
128 _dumptree_space = "";
129 depthfirst(main, parent, firstChild, nextSibling, _dumptree_open, _dumptree_close, NULL);
133 print(_("Invalid command. For a list of supported commands, try menu_cmd help.\n"));