Debian Codegraph @

netgames/dmfc/dmfcmenu.cpp

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/Main/dmfc/dmfcmenu.cpp $
21 * $Revision: 1.1.1.1 $
22 * $Date: 2003/08/26 03:57:21 $
23 * $Author: kevinb $
24 *
25 * DMFC in-game Graphical menu functions
26 *
27 * $Log: dmfcmenu.cpp,v $
28 * Revision 1.1.1.1 2003/08/26 03:57:21 kevinb
29 * initial 1.5 import
30 *
31 *
32 * 42 3/20/00 12:25p Matt
33 * Merge of Duane's post-1.3 changes.
34 * Initialize m_cPtrs in altenate menuItem constructor.
35 *
36 * 41 10/26/99 10:32a Jeff
37 * fixed COM interface bug
38 *
39 * 40 7/07/99 5:00p Jeff
40 * removed vararg functions from interface functions, just made different
41 * versions of them
42 *
43 * 39 5/13/99 4:55p Ardussi
44 * changes for compiling on the Mac
45 *
46 * 38 5/09/99 6:20a Jeff
47 * improved Entropy (added sounds, max virii per room). Fixed rendering
48 * bugs for other multiplayer dlls.
49 *
50 * 37 4/03/99 4:06p Jeff
51 * added loss/ping gauge
52 *
53 * 36 3/22/99 6:21p Jeff
54 * added 2 more audio taunts. a mulitplayer event when someone plays an
55 * audio taunt. option to disable audio taunts.
56 *
57 * 35 3/17/99 12:24p Jeff
58 * converted DMFC to be COM interface
59 *
60 * 34 3/05/99 1:30p Jeff
61 * fixed 99% of the high res issues
62 *
63 * 33 2/11/99 12:51a Jeff
64 * changed names of exported variables
65 *
66 * 32 1/31/99 7:26p Matt
67 * Renamed a bunch of functions to have HUD capitalized
68 *
69 * 31 1/19/99 3:55a Jeff
70 * all strings localized out
71 *
72 * 30 1/04/99 12:21p Jeff
73 * added support for hosts.allow/deny and updates stats manager a little
74 *
75 * 29 12/13/98 5:32p Jeff
76 * fixed ugly crash due to freeing memory allocated in another heap
77 *
78 * 28 12/08/98 12:17p Jeff
79 * various changes that include an improved Team Control dialog (doesn't
80 * switch teams until exit..) and spew/respawn players that change teams
81 *
82 * 27 11/19/98 5:56p Jeff
83 * added slider exported and improved Hoard
84 *
85 * 26 11/17/98 6:29p Jeff
86 * mod can specify whether or not to display the team setup dialog on team
87 * game start. Added a menu item to display team setup dialog in mid-game
88 *
89 * 25 11/17/98 12:36p Jeff
90 * remove onscreen menu when endlevel selected
91 *
92 * 24 11/13/98 6:36p Jeff
93 * created dmfc_dll (a DLL version of DMFC) and converted current mods to
94 * use it
95 *
96 * 23 11/11/98 7:19p Jeff
97 * changes made so that a dedicated server's team is always -1 (team game
98 * or not)
99 *
100 * 22 10/20/98 5:39p Jeff
101 * fixed MIF_INCLUDEONE bug with team games
102 *
103 * 21 10/20/98 4:35p Jeff
104 * added a flag for menu to add a <None> to MIT_PLIST...
105 *
106 * 20 10/20/98 12:16p Jeff
107 * added death message filter, hud callsign filter
108 *
109 * 19 10/15/98 1:34p Jeff
110 * added scrollable onscreen menu. Remove ban in dmfc. prejoin event
111 *
112 * 18 10/14/98 11:26p Jeff
113 * added scrollable menus
114 *
115 * 17 10/05/98 2:50p Jeff
116 *
117 * 16 9/30/98 3:50p Jeff
118 * general improvements (many)
119 *
120 * 15 9/29/98 3:04p Jeff
121 * added time in game and start_time support
122 *
123 * 14 9/28/98 5:05p Jeff
124 * made the statisitical death messages an option in the menu
125 *
126 * 13 9/21/98 7:11p Jeff
127 * made InputCommand interface API and moved existing input commands to
128 * the interface. Changed mprintf/ASSERT so they are valid in DMFC
129 *
130 * $NoKeywords: $
131 */
132
133 #include "DMFC.h"cxx . . $ `<file>/netgames/includes/DMFC.h`/
134 #include "gamedll_header.h"cxx . . $ `<file>/netgames/includes/gamedll_header.h`/
135 #include "dmfcinternal.h"cxx . . $ `<file>/netgames/dmfc/dmfcinternal.h`/
136
137
138 #include <algorithm>
139
140 extern DMFCBasecxx . . $ DMFCBase# *basethiscxx . . $ basethis.;
141
142 MenuItemcxx . . $ MenuItem#::MenuItemcxx . . $ MenuItem#MenuItem(49f6e7a06ebc5aa8).() {
143 m_cPtrscxx . . $ MenuItem#m_cPtrs. = 0;
144 m_bMoreToScrollcxx . . $ MenuItem#m_bMoreToScroll. = false;
145 m_bAtBottomcxx . . $ MenuItem#m_bAtBottom. = false;
146 m_iTopIndexcxx . . $ MenuItem#m_iTopIndex. = 0;
147 SubMenuCountcxx . . $ MenuItem#SubMenuCount. = 0;
148 CurrSubMenucxx . . $ MenuItem#CurrSubMenu. = -1;
149 m_iStatecxx . . $ MenuItem#m_iState. = 0;
150 SubMenuscxx . . $ MenuItem#SubMenus. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
151 funccxx . . $ MenuItem#func. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
152 HasInputFocuscxx . . $ MenuItem#HasInputFocus. = false;
153 m_cTypecxx . . $ MenuItem#m_cType. = MIT_NORMALcxx . . $ `netgames/includes/DMFC.h:513:9`!;
154
155 m_Alphacxx . . $ MenuItem#m_Alpha. = 0;
156 m_AlphaDircxx . . $ MenuItem#m_AlphaDir. = true;
157
158 memset(&m_cmInfocxx . . $ MenuItem#m_cmInfo., 0, sizeof(tCustomMenucxx . . $ tCustomMenu#));
159
160 strcpy(m_sTitlecxx . . $ MenuItem#m_sTitle., " ");
161 }
162
163 MenuItemcxx . . $ MenuItem#::MenuItemcxx . . $ MenuItem#MenuItem(1d32b6541b96864e).(const char *title, char type, uint8_tcxx . . $ uint8_t# flags, void (*fp)(int), ...) {
164 m_bMoreToScrollcxx . . $ MenuItem#m_bMoreToScroll. = false;
165 m_bAtBottomcxx . . $ MenuItem#m_bAtBottom. = false;
166 m_iTopIndexcxx . . $ MenuItem#m_iTopIndex. = 0;
167 SubMenuCountcxx . . $ MenuItem#SubMenuCount. = 0;
168 CurrSubMenucxx . . $ MenuItem#CurrSubMenu. = -1;
169 m_iStatecxx . . $ MenuItem#m_iState. = 0;
170 SubMenuscxx . . $ MenuItem#SubMenus. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
171 funccxx . . $ MenuItem#func. = fp;
172 HasInputFocuscxx . . $ MenuItem#HasInputFocus. = false;
173 m_cTypecxx . . $ MenuItem#m_cType. = type;
174 m_Alphacxx . . $ MenuItem#m_Alpha. = 0;
175 m_AlphaDircxx . . $ MenuItem#m_AlphaDir. = true;
176 m_iFlagscxx . . $ MenuItem#m_iFlags. = flags;
177 m_cPtrscxx . . $ MenuItem#m_cPtrs. = 0; // DAJ Do this or fail the second netgame start
178
179 memset(&m_cmInfocxx . . $ MenuItem#m_cmInfo., 0, sizeof(tCustomMenucxx . . $ tCustomMenu#));
180
181 if (title) {
182 strncpy(m_sTitlecxx . . $ MenuItem#m_sTitle., title, MAX_STRING_LENcxx . . $ `netgames/includes/DMFC.h:521:9`! - 1);
183 m_sTitlecxx . . $ MenuItem#m_sTitle.[MAX_STRING_LENcxx . . $ `netgames/includes/DMFC.h:521:9`! - 1] = '\0';
184 } else {
185 strcpy(m_sTitlecxx . . $ MenuItem#m_sTitle., " ");
186 }
187
188 // if the type is MIT_PLIST than add a dummy submenu so it will register
189 if (type == MIT_PLISTcxx . . $ `netgames/includes/DMFC.h:514:9`!) {
190 SubMenuCountcxx . . $ MenuItem#SubMenuCount. = 1;
191 SubMenuscxx . . $ MenuItem#SubMenus. = (IMenuItemcxx . . $ IMenuItem# **)malloc(sizeof(IMenuItemcxx . . $ IMenuItem# *) * 1);
192 SubMenuscxx . . $ MenuItem#SubMenus.[0] = new MenuItemcxx . . $ MenuItem#("Pfuncer", MIT_STATEITEMcxx . . $ `netgames/includes/DMFC.h:516:9`!, 0, fp);
193 }
194
195 // if the type is MIT_CUSTOM than add a dummy submenu so it will register
196 // the only variable parameter should be a pointer to a tCustomMenu struct that
197 // contains the needed callbacks
198 if (type == MIT_CUSTOMcxx . . $ `netgames/includes/DMFC.h:517:9`!) {
199 SubMenuCountcxx . . $ MenuItem#SubMenuCount. = 1;
200 SubMenuscxx . . $ MenuItem#SubMenus. = (IMenuItemcxx . . $ IMenuItem# **)malloc(sizeof(IMenuItemcxx . . $ IMenuItem# *) * 1);
201 SubMenuscxx . . $ MenuItem#SubMenus.[0] = new MenuItemcxx . . $ MenuItem#("Pfuncer", MIT_STATEITEMcxx . . $ `netgames/includes/DMFC.h:516:9`!, 0, fp);
202
203 va_list marker;
204 va_startcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h:50:9`!(marker, fp);
205 memcpy(&m_cmInfocxx . . $ MenuItem#m_cmInfo., va_argcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h:53:9`!(marker, tCustomMenu *), sizeof(tCustomMenucxx . . $ tCustomMenu#));
206 va_endcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h:52:9`!(marker);
207 }
208
209 // if the type is MIT_STATE than we need to pull off the extra parameters for the states
210 if (type == MIT_STATEcxx . . $ `netgames/includes/DMFC.h:515:9`!) {
211 va_list marker;
212 va_startcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h:50:9`!(marker, fp);
213 SubMenuCountcxx . . $ MenuItem#SubMenuCount. = va_argcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h:53:9`!(marker, int);
214 m_iStatecxx . . $ MenuItem#m_iState. = va_argcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h:53:9`!(marker, int);
215 if ((SubMenuCountcxx . . $ MenuItem#SubMenuCount. > 0) && (SubMenuCountcxx . . $ MenuItem#SubMenuCount. < MAX_STATE_SUBMENUScxx . . $ `netgames/dmfc/dmfcinternal.h:2793:9`!)) {
216 SubMenuscxx . . $ MenuItem#SubMenus. = (IMenuItemcxx . . $ IMenuItem# **)malloc(sizeof(IMenuItemcxx . . $ IMenuItem# *) * SubMenuCountcxx . . $ MenuItem#SubMenuCount.);
217 if (!SubMenuscxx . . $ MenuItem#SubMenus.)
218 return;
219 char *string;
220 for (int i = 0; i < SubMenuCountcxx . . $ MenuItem#SubMenuCount.; i++) {
221 string = va_argcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h:53:9`!(marker, char *);
222 SubMenuscxx . . $ MenuItem#SubMenus.[i] = new MenuItemcxx . . $ MenuItem#(string, MIT_STATEITEMcxx . . $ `netgames/includes/DMFC.h:516:9`!, 0, fp);
223 }
224 } else
225 SubMenuCountcxx . . $ MenuItem#SubMenuCount. = 0;
226 va_endcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h:52:9`!(marker);
227 }
228 }
229
230 MenuItemcxx . . $ MenuItem#::~cxx . . $ MenuItem#`~MenuItem`(ced63f7c635d850d).MenuItemcxx . . $ MenuItem#() {
231 MenuItemcxx . . $ MenuItem# *p;
232
233 if (SubMenuscxx . . $ MenuItem#SubMenus.) {
234 if ((m_cTypecxx . . $ MenuItem#m_cType. == MIT_PLISTcxx . . $ `netgames/includes/DMFC.h:514:9`!) || (m_cTypecxx . . $ MenuItem#m_cType. == MIT_CUSTOMcxx . . $ `netgames/includes/DMFC.h:517:9`!)) {
235 p = (MenuItemcxx . . $ MenuItem# *)SubMenuscxx . . $ MenuItem#SubMenus.[0];
236 if (p) {
237 SubMenuscxx . . $ MenuItem#SubMenus.[0] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
238 delete p;
239 }
240 } else {
241 for (int i = 0; i < SubMenuCountcxx . . $ MenuItem#SubMenuCount.; i++) {
242 p = (MenuItemcxx . . $ MenuItem# *)SubMenuscxx . . $ MenuItem#SubMenus.[i];
243 if (p) {
244 SubMenuscxx . . $ MenuItem#SubMenus.[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
245 delete p;
246 }
247 }
248 }
249
250 free(SubMenuscxx . . $ MenuItem#SubMenus.);
251 SubMenuscxx . . $ MenuItem#SubMenus. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
252 }
253
254 SubMenuCountcxx . . $ MenuItem#SubMenuCount. = 0;
255 }
256
257 bool MenuItemcxx . . $ MenuItem#::AddSubMenucxx . . $ MenuItem#AddSubMenu(7cad07ba2f70ae18).(IMenuItemcxx . . $ IMenuItem# *p) {
258 // No submenus for a Player list submenu or custom or if we are working with a stateitem submenu item
259 if ((m_cTypecxx . . $ MenuItem#m_cType. == MIT_PLISTcxx . . $ `netgames/includes/DMFC.h:514:9`!) || (m_cTypecxx . . $ MenuItem#m_cType. == MIT_STATEITEMcxx . . $ `netgames/includes/DMFC.h:516:9`!) || (m_cTypecxx . . $ MenuItem#m_cType. == MIT_STATEcxx . . $ `netgames/includes/DMFC.h:515:9`!) || (m_cTypecxx . . $ MenuItem#m_cType. == MIT_CUSTOMcxx . . $ `netgames/includes/DMFC.h:517:9`!))
260 return false;
261
262 MenuItemcxx . . $ MenuItem# **temp;
263 temp = (MenuItemcxx . . $ MenuItem# **)SubMenuscxx . . $ MenuItem#SubMenus.;
264
265 // create a new array of submenus and copy the old to it
266 SubMenuscxx . . $ MenuItem#SubMenus. = (IMenuItemcxx . . $ IMenuItem# **)malloc(sizeof(IMenuItemcxx . . $ IMenuItem# *) * (SubMenuCountcxx . . $ MenuItem#SubMenuCount. + 1));
267 for (int i = 0; i < SubMenuCountcxx . . $ MenuItem#SubMenuCount.; i++) {
268 SubMenuscxx . . $ MenuItem#SubMenus.[i] = temp[i];
269 }
270
271 if (temp)
272 free(temp);
273
274 // Put the new submenu item at the end of this one
275 SubMenuscxx . . $ MenuItem#SubMenus.[SubMenuCountcxx . . $ MenuItem#SubMenuCount.] = p;
276 SubMenuCountcxx . . $ MenuItem#SubMenuCount.++;
277 return true;
278 }
279
280 bool MenuItemcxx . . $ MenuItem#::DetachSubMenucxx . . $ MenuItem#DetachSubMenu(7cad07ba2f70ae18).(IMenuItemcxx . . $ IMenuItem# *p) {
281 // No submenus for a Player list submenu or custom or if we are working with a stateitem submenu item
282 if ((m_cTypecxx . . $ MenuItem#m_cType. == MIT_PLISTcxx . . $ `netgames/includes/DMFC.h:514:9`!) || (m_cTypecxx . . $ MenuItem#m_cType. == MIT_STATEITEMcxx . . $ `netgames/includes/DMFC.h:516:9`!) || (m_cTypecxx . . $ MenuItem#m_cType. == MIT_STATEcxx . . $ `netgames/includes/DMFC.h:515:9`!) || (m_cTypecxx . . $ MenuItem#m_cType. == MIT_CUSTOMcxx . . $ `netgames/includes/DMFC.h:517:9`!))
283 return false;
284
285 if (SubMenuCountcxx . . $ MenuItem#SubMenuCount. < 1)
286 return false;
287
288 int i;
289 bool found = false;
290
291 // make sure there is this menu somewhere in our list
292 for (i = 0; i < SubMenuCountcxx . . $ MenuItem#SubMenuCount.; i++) {
293 if (SubMenuscxx . . $ MenuItem#SubMenus.[i] == p) {
294 found = true;
295 break;
296 }
297 }
298 if (!found) {
299 // doesn't exist
300 return false;
301 }
302
303 MenuItemcxx . . $ MenuItem# **temp;
304 temp = (MenuItemcxx . . $ MenuItem# **)SubMenuscxx . . $ MenuItem#SubMenus.;
305
306 if (SubMenuCountcxx . . $ MenuItem#SubMenuCount. > 1) {
307 // we need to resize our list
308 // create a new array of submenus and copy the old to it
309 int c;
310
311 SubMenuscxx . . $ MenuItem#SubMenus. = (IMenuItemcxx . . $ IMenuItem# **)malloc(sizeof(IMenuItemcxx . . $ IMenuItem# *) * (SubMenuCountcxx . . $ MenuItem#SubMenuCount. - 1));
312 for (i = 0, c = 0; i < SubMenuCountcxx . . $ MenuItem#SubMenuCount.; i++) {
313 // make sure it isn't the one we are trying to detach
314 if (temp[i] != p) {
315 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!((c < (SubMenuCount - 1)));
316 SubMenuscxx . . $ MenuItem#SubMenus.[c] = temp[i];
317 c++;
318 }
319 }
320
321 if (temp)
322 free(temp);
323
324 SubMenuCountcxx . . $ MenuItem#SubMenuCount.--;
325 } else {
326 // this is the only remaining submenu
327 SubMenuCountcxx . . $ MenuItem#SubMenuCount. = 0;
328
329 if (temp)
330 free(temp);
331 SubMenuscxx . . $ MenuItem#SubMenus. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
332 }
333
334 return true;
335 }
336
337 bool MenuItemcxx . . $ MenuItem#::Forwardcxx . . $ MenuItem#Forward(c9857a73d68e59ba).(void) {
338 if ((m_cTypecxx . . $ MenuItem#m_cType. == MIT_PLISTcxx . . $ `netgames/includes/DMFC.h:514:9`!) || (m_cTypecxx . . $ MenuItem#m_cType. == MIT_STATEcxx . . $ `netgames/includes/DMFC.h:515:9`!) || (m_cTypecxx . . $ MenuItem#m_cType. == MIT_CUSTOMcxx . . $ `netgames/includes/DMFC.h:517:9`!))
339 return false; // short circuit on a plist and state since it has no submenus in reality
340
341 char type = SubMenuscxx . . $ MenuItem#SubMenus.[CurrSubMenucxx . . $ MenuItem#CurrSubMenu.]->GetTypecxx . . $ IMenuItem#GetType(6e9c618e4dd2eafc).();
342
343 // We can only move forward if there is a submenu
344 if ((type == MIT_CUSTOMcxx . . $ `netgames/includes/DMFC.h:517:9`! && SubMenuscxx . . $ MenuItem#SubMenus.[CurrSubMenucxx . . $ MenuItem#CurrSubMenu.]->GetCustomSubMenuCountcxx . . $ IMenuItem#GetCustomSubMenuCount(b126dc7c1de90089).() > 0) ||
345 (type != MIT_CUSTOMcxx . . $ `netgames/includes/DMFC.h:517:9`! && (SubMenuCountcxx . . $ MenuItem#SubMenuCount. > 0))) {
346 // If this submenu has input focus, than we need to check the currently selected submenu
347 // and set that as the new item with focus, and remove focus from this one
348 if (HasInputFocuscxx . . $ MenuItem#HasInputFocus.) {
349 if ((CurrSubMenucxx . . $ MenuItem#CurrSubMenu. != -1) && (SubMenuscxx . . $ MenuItem#SubMenus.[CurrSubMenucxx . . $ MenuItem#CurrSubMenu.]->HasSubMenuscxx . . $ IMenuItem#HasSubMenus(c9857a73d68e59ba).())) {
350 SubMenuscxx . . $ MenuItem#SubMenus.[CurrSubMenucxx . . $ MenuItem#CurrSubMenu.]->SetInputFocuscxx . . $ IMenuItem#SetInputFocus(49f6e7a06ebc5aa8).();
351 HasInputFocuscxx . . $ MenuItem#HasInputFocus. = false;
352 }
353 return true;
354 }
355 // This submenu doesn't have input focus, so move to it's currently selected submenu and
356 // Tell it to go forward if it can
357 if (CurrSubMenucxx . . $ MenuItem#CurrSubMenu. != -1)
358 return SubMenuscxx . . $ MenuItem#SubMenus.[CurrSubMenucxx . . $ MenuItem#CurrSubMenu.]->Forwardcxx . . $ IMenuItem#Forward(c9857a73d68e59ba).();
359 }
360 return false;
361 }
362 bool MenuItemcxx . . $ MenuItem#::Backcxx . . $ MenuItem#Back(c9857a73d68e59ba).(void) {
363 // We need to look ahead and see if the next submenu has input focus
364 // if it does have focus, than we need to make it lose focus, and make this one have focus
365 if (SubMenuCountcxx . . $ MenuItem#SubMenuCount. > 0) {
366 if (CurrSubMenucxx . . $ MenuItem#CurrSubMenu. != -1) {
367 if (SubMenuscxx . . $ MenuItem#SubMenus.[CurrSubMenucxx . . $ MenuItem#CurrSubMenu.]->GetFocuscxx . . $ IMenuItem#GetFocus(c9857a73d68e59ba).()) {
368 // The next submenu has focus so we can remove it and set this guy to have focus
369 SubMenuscxx . . $ MenuItem#SubMenus.[CurrSubMenucxx . . $ MenuItem#CurrSubMenu.]->LoseInputFocuscxx . . $ IMenuItem#LoseInputFocus(49f6e7a06ebc5aa8).();
370 HasInputFocuscxx . . $ MenuItem#HasInputFocus. = true;
371 return true;
372 }
373 // The next submenu doesn't have focus, but one of it's submenus might (they better),
374 // so move on to the next submenu and call Back()
375 return SubMenuscxx . . $ MenuItem#SubMenus.[CurrSubMenucxx . . $ MenuItem#CurrSubMenu.]->Backcxx . . $ IMenuItem#Back(c9857a73d68e59ba).();
376 }
377 }
378 return false;
379 }
380 bool MenuItemcxx . . $ MenuItem#::Upcxx . . $ MenuItem#Up(c9857a73d68e59ba).(void) {
381 // See if this MenuItem has focus, if it does, and we can move up, then move up
382 if (HasInputFocuscxx . . $ MenuItem#HasInputFocus.) {
383 if (CurrSubMenucxx . . $ MenuItem#CurrSubMenu. > 0)
384 CurrSubMenucxx . . $ MenuItem#CurrSubMenu.--;
385 if (m_iTopIndexcxx . . $ MenuItem#m_iTopIndex. > 0 && m_iTopIndexcxx . . $ MenuItem#m_iTopIndex. >= CurrSubMenucxx . . $ MenuItem#CurrSubMenu.) {
386 // move the top and index's up
387 m_iTopIndexcxx . . $ MenuItem#m_iTopIndex.--;
388 }
389
390 return true;
391 }
392 // Ok, one of the submenus better have focus, so move on to the next submenu and call Up()
393 if (CurrSubMenucxx . . $ MenuItem#CurrSubMenu. != -1)
394 return SubMenuscxx . . $ MenuItem#SubMenus.[CurrSubMenucxx . . $ MenuItem#CurrSubMenu.]->Upcxx . . $ IMenuItem#Up(c9857a73d68e59ba).();
395 return false;
396 }
397 bool MenuItemcxx . . $ MenuItem#::Downcxx . . $ MenuItem#Down(c9857a73d68e59ba).(void) {
398 // See if this MenuItem has focus, if it does, and we can move down, then move down
399 if (HasInputFocuscxx . . $ MenuItem#HasInputFocus.) {
400 if (CurrSubMenucxx . . $ MenuItem#CurrSubMenu. < SubMenuCountcxx . . $ MenuItem#SubMenuCount. - 1)
401 CurrSubMenucxx . . $ MenuItem#CurrSubMenu.++;
402 if (m_bMoreToScrollcxx . . $ MenuItem#m_bMoreToScroll. && m_bAtBottomcxx . . $ MenuItem#m_bAtBottom.) {
403 m_iTopIndexcxx . . $ MenuItem#m_iTopIndex.++;
404 }
405 return true;
406 }
407 // Ok, one of the submenus better have focus, so move on to the next submenu and call Down()
408 if (CurrSubMenucxx . . $ MenuItem#CurrSubMenu. != -1)
409 return SubMenuscxx . . $ MenuItem#SubMenus.[CurrSubMenucxx . . $ MenuItem#CurrSubMenu.]->Downcxx . . $ IMenuItem#Down(c9857a73d68e59ba).();
410 return false;
411 }
412 void MenuItemcxx . . $ MenuItem#::Executecxx . . $ MenuItem#Execute(49f6e7a06ebc5aa8).(void) {
413 switch (m_cTypecxx . . $ MenuItem#m_cType.) {
414 case MIT_NORMALcxx . . $ `netgames/includes/DMFC.h:513:9`!: {
415 // We need to go through the Submenus and check to see if the submenu has focus
416 // if it does, than we need to execute it's function
417 if (SubMenuCountcxx . . $ MenuItem#SubMenuCount. > 0) {
418 if (CurrSubMenucxx . . $ MenuItem#CurrSubMenu. != -1) {
419 if (HasInputFocuscxx . . $ MenuItem#HasInputFocus.) {
420 // The submenu has focus, so call it's handler as long as it's not a plist type
421 char type = SubMenuscxx . . $ MenuItem#SubMenus.[CurrSubMenucxx . . $ MenuItem#CurrSubMenu.]->GetTypecxx . . $ IMenuItem#GetType(6e9c618e4dd2eafc).();
422 if ((type != MIT_PLISTcxx . . $ `netgames/includes/DMFC.h:514:9`!) && (type != MIT_STATEcxx . . $ `netgames/includes/DMFC.h:515:9`!) && (type != MIT_CUSTOMcxx . . $ `netgames/includes/DMFC.h:517:9`!))
423 SubMenuscxx . . $ MenuItem#SubMenus.[CurrSubMenucxx . . $ MenuItem#CurrSubMenu.]->CallFunccxx . . $ IMenuItem#CallFunc(d4f767463ce0a6b3).(CurrSubMenucxx . . $ MenuItem#CurrSubMenu.);
424 return;
425 }
426 // The next submenu doesn't have focus, so move on and check it's submenu to see if we
427 // can Execute() that
428 SubMenuscxx . . $ MenuItem#SubMenus.[CurrSubMenucxx . . $ MenuItem#CurrSubMenu.]->Executecxx . . $ IMenuItem#Execute(49f6e7a06ebc5aa8).();
429 }
430 } else {
431 // We don't have any SubMenus so try and call our handler
432 CallFunccxx . . $ MenuItem#CallFunc(d4f767463ce0a6b3).(0);
433 }
434 } break;
435 case MIT_PLISTcxx . . $ `netgames/includes/DMFC.h:514:9`!: {
436 // We need to go through the Submenus and check to see if the submenu has focus
437 // if it does, than we need to execute it's function
438 if ((SubMenuCountcxx . . $ MenuItem#SubMenuCount. > 0) && (CurrSubMenucxx . . $ MenuItem#CurrSubMenu. != -1) && (HasInputFocuscxx . . $ MenuItem#HasInputFocus.)) {
439 if (m_iFlagscxx . . $ MenuItem#m_iFlags. & MIF_INCLUDENONEcxx . . $ `netgames/includes/DMFC.h:571:9`!) {
440 // there is a <None> so take that into consideration
441 if (CurrSubMenucxx . . $ MenuItem#CurrSubMenu. == 0) {
442 //<None> is selected
443 CallFunccxx . . $ MenuItem#CallFunc(d4f767463ce0a6b3).(-1);
444 return;
445 }
446
447 if (basethiscxx . . $ basethis.->CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(Pnumscxx . . $ MenuItem#Pnums.[CurrSubMenucxx . . $ MenuItem#CurrSubMenu. - 1])) {
448 // The submenu has focus, so call it's handler
449 CallFunccxx . . $ MenuItem#CallFunc(d4f767463ce0a6b3).(Pnumscxx . . $ MenuItem#Pnums.[CurrSubMenucxx . . $ MenuItem#CurrSubMenu. - 1]);
450 return;
451 }
452 } else {
453 // a regular plist
454 if (basethiscxx . . $ basethis.->CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(Pnumscxx . . $ MenuItem#Pnums.[CurrSubMenucxx . . $ MenuItem#CurrSubMenu.])) {
455 // The submenu has focus, so call it's handler
456 CallFunccxx . . $ MenuItem#CallFunc(d4f767463ce0a6b3).(Pnumscxx . . $ MenuItem#Pnums.[CurrSubMenucxx . . $ MenuItem#CurrSubMenu.]);
457 return;
458 }
459 }
460 }
461 } break;
462 case MIT_CUSTOMcxx . . $ `netgames/includes/DMFC.h:517:9`!: {
463 // We need to go through the Submenus and check to see if the submenu has focus
464 // if it does, than we need to execute it's function
465 int count = (m_cmInfocxx . . $ MenuItem#m_cmInfo..GetListCountcxx . . $ tCustomMenu#GetListCount.) ? (*m_cmInfocxx . . $ MenuItem#m_cmInfo..GetListCountcxx . . $ tCustomMenu#GetListCount.)() : 0;
466 if (count > 0) {
467 if (CurrSubMenucxx . . $ MenuItem#CurrSubMenu. != -1) {
468 if (HasInputFocuscxx . . $ MenuItem#HasInputFocus.) {
469 // The submenu has focus, so call it's handler
470 CallFunccxx . . $ MenuItem#CallFunc(d4f767463ce0a6b3).(CurrSubMenucxx . . $ MenuItem#CurrSubMenu.);
471 return;
472 }
473 }
474 }
475 }
476 case MIT_STATEcxx . . $ `netgames/includes/DMFC.h:515:9`!: {
477 // We need to go through the Submenus and check to see if the submenu has focus
478 // if it does, than we need to execute it's function
479 if (SubMenuCountcxx . . $ MenuItem#SubMenuCount. > 0) {
480 if (CurrSubMenucxx . . $ MenuItem#CurrSubMenu. != -1) {
481 if (HasInputFocuscxx . . $ MenuItem#HasInputFocus.) {
482 // The submenu has focus, so call it's handler
483 CallFunccxx . . $ MenuItem#CallFunc(d4f767463ce0a6b3).(CurrSubMenucxx . . $ MenuItem#CurrSubMenu.);
484 m_iStatecxx . . $ MenuItem#m_iState. = CurrSubMenucxx . . $ MenuItem#CurrSubMenu.;
485 return;
486 }
487 }
488 }
489 } break;
490 }
491 }
492 void MenuItemcxx . . $ MenuItem#::Drawcxx . . $ MenuItem#Draw(d0909ec2d84ff198).(int x, int y, int height, int bmp, float *not_used) {
493 int old_font = DLLgrtext_GetFont();
494 DLLgrtext_SetFont(basethiscxx . . $ basethis.->Game_fontscxx . . $ DMFCBase#Game_fonts.[HUD_FONT_INDEXcxx . . $ `Descent3/gamefont.h:97:9`!]);
495
496 /*
497 static float aspratio;
498 if(!ratio){
499 //we need to calculate a ratio
500 aspratio = DEFAULT_HUD_WIDTH / ((float)*base->Game_window_w);
501 }
502
503 float useratio;
504 if(!ratio) useratio = aspratio; else useratio = *ratio;
505 */
506
507 uint8_tcxx . . $ uint8_t# alpha_to_use = 255;
508
509 #define FLASHRATEcxx . . $ `netgames/dmfc/dmfcmenu.cpp:509:9`! 700.0 // alphas per second
510
511 int16_t a = m_Alphacxx . . $ MenuItem#m_Alpha.;
512 int units = (int)FLASHRATEcxx . . $ `netgames/dmfc/dmfcmenu.cpp:509:9`! * (*basethiscxx . . $ basethis.->Frametimecxx . . $ DMFCBase#Frametime.);
513
514 // do alphaing effect
515 while (units > 0) {
516 if (m_AlphaDircxx . . $ MenuItem#m_AlphaDir.) {
517 // find the amount to adjust
518 uint8_tcxx . . $ uint8_t# amount = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).<int>(255 - a, units);
519 units -= amount;
520 a += amount;
521 if (a >= 255) {
522 a = 255;
523 m_AlphaDircxx . . $ MenuItem#m_AlphaDir. = false;
524 }
525 } else {
526 // find the amount to adjust
527 uint8_tcxx . . $ uint8_t# amount = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).<int>(a, units);
528 units -= amount;
529 a -= amount;
530 if (a <= 0) {
531 a = 0;
532 m_AlphaDircxx . . $ MenuItem#m_AlphaDir. = true;
533 }
534 }
535 }
536
537 m_Alphacxx . . $ MenuItem#m_Alpha. = alpha_to_use = (uint8_tcxx . . $ uint8_t#)a;
538
539 ddgr_colorcxx . . $ ddgr_color# color;
540 int temp, maxx;
541 temp = maxx = 0;
542 char buff[256];
543 char checked[3];
544 char buffer[100];
545
546 if (SubMenuCountcxx . . $ MenuItem#SubMenuCount. <= 0) {
547 DLLgrtext_SetFont(old_font);
548 return;
549 }
550
551 bool nodisp_custom = false;
552
553 // First find the max width of the submenu items
554 switch (m_cTypecxx . . $ MenuItem#m_cType.) {
555 case MIT_NORMALcxx . . $ `netgames/includes/DMFC.h:513:9`!:
556 case MIT_STATEcxx . . $ `netgames/includes/DMFC.h:515:9`!: {
557 for (int i = 0; i < SubMenuCountcxx . . $ MenuItem#SubMenuCount.; i++) {
558 // temp = DLLRenderHUDGetTextLineWidth(SubMenus[i]->GetTitle());
559 temp = DLLgrtext_GetTextLineWidth(SubMenuscxx . . $ MenuItem#SubMenus.[i]->GetTitlecxx . . $ IMenuItem#GetTitle(33a1f659e94feb42).());
560 if (temp > maxx)
561 maxx = temp;
562 }
563 if (m_cTypecxx . . $ MenuItem#m_cType. == MIT_NORMALcxx . . $ `netgames/includes/DMFC.h:513:9`!) {
564 maxx += (x + 10);
565 } else {
566 snprintf(checked, sizeof(checked), "%c ", CHAR_RIGHT_ARROWcxx . . $ `netgames/includes/DMFC.h:462:9`!);
567 // maxx += (x + 10 + (useratio * ((float)DLLRenderHUDGetTextLineWidth(checked))));
568 // maxx += (x + 10 + DLLRenderHUDGetTextLineWidth(checked));
569 maxx += (x + 10 + DLLgrtext_GetTextLineWidth(checked));
570 }
571 } break;
572 case MIT_PLISTcxx . . $ `netgames/includes/DMFC.h:514:9`!: {
573 // First create/update the playerlist
574 SubMenuCountcxx . . $ MenuItem#SubMenuCount. = 0;
575 int i;
576 for (i = 0; i < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; i++) {
577 if (basethiscxx . . $ basethis.->CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(i)) {
578 // we have a valid pnum, fill it in
579 Pnumscxx . . $ MenuItem#Pnums.[SubMenuCountcxx . . $ MenuItem#SubMenuCount.] = i;
580 SubMenuCountcxx . . $ MenuItem#SubMenuCount.++;
581 }
582 }
583
584 if (m_iFlagscxx . . $ MenuItem#m_iFlags. & MIF_INCLUDENONEcxx . . $ `netgames/includes/DMFC.h:571:9`!)
585 SubMenuCountcxx . . $ MenuItem#SubMenuCount.++; // account for <None>
586
587 // Do some error checking and make sure values for the currsub are ok
588 if (CurrSubMenucxx . . $ MenuItem#CurrSubMenu. >= SubMenuCountcxx . . $ MenuItem#SubMenuCount.)
589 CurrSubMenucxx . . $ MenuItem#CurrSubMenu. = SubMenuCountcxx . . $ MenuItem#SubMenuCount. - 1;
590
591 if (CurrSubMenucxx . . $ MenuItem#CurrSubMenu. < m_iTopIndexcxx . . $ MenuItem#m_iTopIndex.)
592 m_iTopIndexcxx . . $ MenuItem#m_iTopIndex. = (CurrSubMenucxx . . $ MenuItem#CurrSubMenu. >= 0) ? CurrSubMenucxx . . $ MenuItem#CurrSubMenu. : 0;
593
594 int end_i = SubMenuCountcxx . . $ MenuItem#SubMenuCount.;
595
596 // Now we have a list of pnums, so draw them
597 if (m_iFlagscxx . . $ MenuItem#m_iFlags. & MIF_INCLUDENONEcxx . . $ `netgames/includes/DMFC.h:571:9`!) {
598 // temp = useratio * ((float)DLLRenderHUDGetTextLineWidth(DTXT_NONE));
599 // temp = DLLRenderHUDGetTextLineWidth(DTXT_NONE);
600 temp = DLLgrtext_GetTextLineWidth(DTXT_NONEcxx . . $ `netgames/dmfc/dmfcinternal.h:2431:9`!);
601 end_i = SubMenuCountcxx . . $ MenuItem#SubMenuCount. - 1;
602 }
603
604 // go through all the names and get the longest name
605 for (i = 0; i < end_i; i++) {
606 // temp = useratio * ((float)DLLRenderHUDGetTextLineWidth(base->Players[Pnums[i]].callsign));
607 // temp = DLLRenderHUDGetTextLineWidth(base->Players[Pnums[i]].callsign);
608 temp = DLLgrtext_GetTextLineWidth(basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[Pnumscxx . . $ MenuItem#Pnums.[i]].callsigncxx . . $ player#callsign.);
609 if (temp > maxx)
610 maxx = temp;
611 }
612 // maxx += (x + 10 + (useratio * ((float)DLLRenderHUDGetTextLineWidth("[33]"))));
613 // maxx += (x + 10 + DLLRenderHUDGetTextLineWidth("[33]"));
614 maxx += (x + 10 + DLLgrtext_GetTextLineWidth("[33]"));
615 } break;
616 case MIT_CUSTOMcxx . . $ `netgames/includes/DMFC.h:517:9`!: {
617 // First find out how many submenus there are going to be
618 SubMenuCountcxx . . $ MenuItem#SubMenuCount. = (m_cmInfocxx . . $ MenuItem#m_cmInfo..GetListCountcxx . . $ tCustomMenu#GetListCount.) ? (*m_cmInfocxx . . $ MenuItem#m_cmInfo..GetListCountcxx . . $ tCustomMenu#GetListCount.)() : 0;
619
620 // Do some error checking and make sure values are ok
621 if (CurrSubMenucxx . . $ MenuItem#CurrSubMenu. >= SubMenuCountcxx . . $ MenuItem#SubMenuCount.)
622 CurrSubMenucxx . . $ MenuItem#CurrSubMenu. = SubMenuCountcxx . . $ MenuItem#SubMenuCount. - 1;
623 if (CurrSubMenucxx . . $ MenuItem#CurrSubMenu. < m_iTopIndexcxx . . $ MenuItem#m_iTopIndex.)
624 m_iTopIndexcxx . . $ MenuItem#m_iTopIndex. = (CurrSubMenucxx . . $ MenuItem#CurrSubMenu. >= 0) ? CurrSubMenucxx . . $ MenuItem#CurrSubMenu. : 0;
625
626 if (SubMenuCountcxx . . $ MenuItem#SubMenuCount. <= 0) {
627 nodisp_custom = true;
628 }
629
630 // now find out the biggest string
631 if (m_cmInfocxx . . $ MenuItem#m_cmInfo..GetItemcxx . . $ tCustomMenu#GetItem.) {
632 for (int i = 0; i < SubMenuCountcxx . . $ MenuItem#SubMenuCount.; i++) {
633 char *ptr = (*m_cmInfocxx . . $ MenuItem#m_cmInfo..GetItemcxx . . $ tCustomMenu#GetItem.)(i);
634 if (ptr) {
635 // temp = useratio * ((float)DLLRenderHUDGetTextLineWidth(ptr));
636 // temp = DLLRenderHUDGetTextLineWidth(ptr);
637 temp = DLLgrtext_GetTextLineWidth(ptr);
638 if (temp > maxx)
639 maxx = temp;
640 }
641 }
642 }
643 maxx += (x + 10);
644 } break;
645 }
646
647 int end_index = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(SubMenuCountcxx . . $ MenuItem#SubMenuCount., m_iTopIndexcxx . . $ MenuItem#m_iTopIndex. + ((400 - y) / height));
648 int num_teams = basethiscxx . . $ basethis.->GetNumTeamscxx . . $ DMFCBase#GetNumTeams(b126dc7c1de90089).();
649
650 if (SubMenuCountcxx . . $ MenuItem#SubMenuCount. && bmp > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) {
651 DLLrend_SetAlphaValue(210);
652 DLLrend_SetZBufferState(0);
653 DLLrend_SetTextureType(TT_LINEARcxx . . $ TT_LINEAR.);
654 DLLrend_SetLighting(LS_NONEcxx . . $ LS_NONE.);
655 DLLrend_SetAlphaType(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!);
656 DLLrend_DrawScaledBitmap(x, y, maxx, y + (height * (end_index - m_iTopIndexcxx . . $ MenuItem#m_iTopIndex. + 1)), bmp, 0, 0, 1, 1, 1.0, 1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
657 DLLrend_SetZBufferState(1);
658 }
659
660 x += 5;
661
662 uint8_tcxx . . $ uint8_t# al;
663
664 m_bMoreToScrollcxx . . $ MenuItem#m_bMoreToScroll. = (end_index < SubMenuCountcxx . . $ MenuItem#SubMenuCount.) ? true : false;
665 // m_bAtBottom = (m_bMoreToScroll)?((CurrSubMenu<end_index-1)?false:true):((CurrSubMenu<end_index)?false:true);
666 m_bAtBottomcxx . . $ MenuItem#m_bAtBottom. =
667 (m_bMoreToScrollcxx . . $ MenuItem#m_bMoreToScroll.) ? ((CurrSubMenucxx . . $ MenuItem#CurrSubMenu. < end_index - 2) ? false : true) : ((CurrSubMenucxx . . $ MenuItem#CurrSubMenu. < end_index) ? false : true);
668
669 // we have something to draw
670 for (int i = m_iTopIndexcxx . . $ MenuItem#m_iTopIndex.; i < end_index; i++) {
671 switch (m_cTypecxx . . $ MenuItem#m_cType.) {
672 case MIT_PLISTcxx . . $ `netgames/includes/DMFC.h:514:9`!: {
673 if (num_teams <= 1) {
674 if ((i == CurrSubMenucxx . . $ MenuItem#CurrSubMenu.) && (HasInputFocuscxx . . $ MenuItem#HasInputFocus.)) {
675 al = alpha_to_use;
676 color = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(180, 255, 180);
677 } else {
678 al = 255;
679 color = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 180, 0);
680 }
681 } else {
682 if ((i == CurrSubMenucxx . . $ MenuItem#CurrSubMenu.) && (HasInputFocuscxx . . $ MenuItem#HasInputFocus.)) {
683 al = alpha_to_use;
684 color = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(180, 255, 180);
685 } else {
686 al = 255;
687 if (m_iFlagscxx . . $ MenuItem#m_iFlags. & MIF_INCLUDENONEcxx . . $ `netgames/includes/DMFC.h:571:9`!) {
688 if (i == 0)
689 color = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 180, 0);
690 else
691 color = basethiscxx . . $ basethis.->GetTeamColorcxx . . $ DMFCBase#GetTeamColor(46cc46841198e427).(basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[Pnumscxx . . $ MenuItem#Pnums.[i - 1]].teamcxx . . $ player#team.);
692 } else {
693 color = basethiscxx . . $ basethis.->GetTeamColorcxx . . $ DMFCBase#GetTeamColor(46cc46841198e427).(basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[Pnumscxx . . $ MenuItem#Pnums.[i]].teamcxx . . $ player#team.);
694 }
695 }
696 }
697 } break;
698 case MIT_CUSTOMcxx . . $ `netgames/includes/DMFC.h:517:9`!:
699 case MIT_NORMALcxx . . $ `netgames/includes/DMFC.h:513:9`!:
700 case MIT_STATEcxx . . $ `netgames/includes/DMFC.h:515:9`!: {
701 if ((i == CurrSubMenucxx . . $ MenuItem#CurrSubMenu.) && (HasInputFocuscxx . . $ MenuItem#HasInputFocus.)) {
702 al = alpha_to_use;
703 color = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(180, 255, 180);
704 } else {
705 al = 255;
706 color = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 180, 0);
707 }
708 } break;
709 }
710
711 bool draw_text = true;
712 if (i == m_iTopIndexcxx . . $ MenuItem#m_iTopIndex. && m_iTopIndexcxx . . $ MenuItem#m_iTopIndex. > 0) {
713 // we need to draw the UP arrow
714 char b[2];
715 snprintf(b, sizeof(b), "%c", CHAR_UP_ARROWcxx . . $ `netgames/includes/DMFC.h:461:9`!);
716 // DLLRenderHUDText(color,al,0,(maxx-x)/2+x,y,b);
717 DLLgrtext_SetColor(color);
718 DLLgrtext_SetAlpha(al);
719 DLLgrtext_Printf((maxx - x) / 2 + x, y, b);
720 draw_text = false;
721 }
722
723 if (m_bMoreToScrollcxx . . $ MenuItem#m_bMoreToScroll. && i == (end_index - 1)) {
724 // we need to draw the DOWN arrow
725 char b[2];
726 snprintf(b, sizeof(b), "%c", CHAR_DOWN_ARROWcxx . . $ `netgames/includes/DMFC.h:463:9`!);
727 // DLLRenderHUDText(color,al,0,(maxx-x)/2+x,y,b);
728 DLLgrtext_SetColor(color);
729 DLLgrtext_SetAlpha(al);
730 DLLgrtext_Printf((maxx - x) / 2 + x, y, b);
731 draw_text = false;
732 }
733
734 if (draw_text) {
735 switch (m_cTypecxx . . $ MenuItem#m_cType.) {
736 case MIT_NORMALcxx . . $ `netgames/includes/DMFC.h:513:9`!: {
737 // DLLRenderHUDText(color,al,0,x,y,SubMenus[i]->GetTitle());
738 DLLgrtext_SetColor(color);
739 DLLgrtext_SetAlpha(al);
740 DLLgrtext_Printf(x, y, SubMenuscxx . . $ MenuItem#SubMenus.[i]->GetTitlecxx . . $ IMenuItem#GetTitle(33a1f659e94feb42).());
741
742 if (i == CurrSubMenucxx . . $ MenuItem#CurrSubMenu.) { // go through the submenus
743 // if(ratio){
744 SubMenuscxx . . $ MenuItem#SubMenus.[i]->Drawcxx . . $ IMenuItem#Draw(d0909ec2d84ff198).(maxx, y, height, bmp, not_used);
745 //}else{
746 // SubMenus[i]->Draw(maxx,y,height,base,bmp,&aspratio);
747 //}
748 }
749 } break;
750 case MIT_PLISTcxx . . $ `netgames/includes/DMFC.h:514:9`!: {
751 if (m_iFlagscxx . . $ MenuItem#m_iFlags. & MIF_INCLUDENONEcxx . . $ `netgames/includes/DMFC.h:571:9`!) {
752
753 if (i == 0) {
754 // include the <None> if index is 0
755 strcpy(buffer, DTXT_NONEcxx . . $ `netgames/dmfc/dmfcinternal.h:2431:9`!);
756 } else {
757 // do the regular
758 snprintf(buffer, sizeof(buffer), "%s[%d]", basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[Pnumscxx . . $ MenuItem#Pnums.[i - 1]].callsigncxx . . $ player#callsign., Pnumscxx . . $ MenuItem#Pnums.[i - 1]);
759 }
760 } else {
761 // do the regular
762 snprintf(buffer, sizeof(buffer), "%s[%d]", basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[Pnumscxx . . $ MenuItem#Pnums.[i]].callsigncxx . . $ player#callsign., Pnumscxx . . $ MenuItem#Pnums.[i]);
763 }
764
765 // DLLRenderHUDText(color,al,0,x,y,buffer);
766 DLLgrtext_SetColor(color);
767 DLLgrtext_SetAlpha(al);
768 DLLgrtext_Printf(x, y, buffer);
769
770 } break;
771 case MIT_CUSTOMcxx . . $ `netgames/includes/DMFC.h:517:9`!: {
772 if (m_cmInfocxx . . $ MenuItem#m_cmInfo..GetItemcxx . . $ tCustomMenu#GetItem.) {
773 char *ptr = (*m_cmInfocxx . . $ MenuItem#m_cmInfo..GetItemcxx . . $ tCustomMenu#GetItem.)(i);
774 if (ptr) {
775 snprintf(buffer, sizeof(buffer), "%s", ptr);
776 // DLLRenderHUDText(color,al,0,x,y,buffer);
777 DLLgrtext_SetColor(color);
778 DLLgrtext_SetAlpha(al);
779 DLLgrtext_Printf(x, y, buffer);
780 }
781 }
782 } break;
783 case MIT_STATEcxx . . $ `netgames/includes/DMFC.h:515:9`!: {
784 if (i == m_iStatecxx . . $ MenuItem#m_iState.)
785 strcpy(buff, checked);
786 else
787 strcpy(buff, " ");
788 strcat(buff, SubMenuscxx . . $ MenuItem#SubMenus.[i]->GetTitlecxx . . $ IMenuItem#GetTitle(33a1f659e94feb42).());
789 // DLLRenderHUDText(color,al,0,x,y,buff);
790 DLLgrtext_SetColor(color);
791 DLLgrtext_SetAlpha(al);
792 DLLgrtext_Printf(x, y, buff);
793
794 } break;
795 }
796 }
797
798 y += height;
799 }
800
801 if (nodisp_custom) {
802 // check to see if we have focus...if we do...we got to move back to the previous menu
803 if (HasInputFocuscxx . . $ MenuItem#HasInputFocus.) {
804 basethiscxx . . $ basethis.->Menucxx . . $ DMFCBase#Menu..Backcxx . . $ MenuItem#Back(c9857a73d68e59ba).();
805 }
806 SubMenuCountcxx . . $ MenuItem#SubMenuCount. = 1;
807 }
808
809 DLLgrtext_SetFont(old_font);
810 }
811 const char *MenuItemcxx . . $ MenuItem#::GetTitlecxx . . $ MenuItem#GetTitle(33a1f659e94feb42).(void) { return m_sTitlecxx . . $ MenuItem#m_sTitle.; }
812 void MenuItemcxx . . $ MenuItem#::SetInputFocuscxx . . $ MenuItem#SetInputFocus(49f6e7a06ebc5aa8).(void) {
813 // Sets this MenuItem with Input focus, reseting it's Current Sub Menu to 0 if it has a SubMenu
814 HasInputFocuscxx . . $ MenuItem#HasInputFocus. = true;
815 if (SubMenuCountcxx . . $ MenuItem#SubMenuCount. > 0)
816 CurrSubMenucxx . . $ MenuItem#CurrSubMenu. = (m_iTopIndexcxx . . $ MenuItem#m_iTopIndex. == 0) ? 0 : m_iTopIndexcxx . . $ MenuItem#m_iTopIndex. + 1;
817 else
818 CurrSubMenucxx . . $ MenuItem#CurrSubMenu. = -1;
819 }
820 void MenuItemcxx . . $ MenuItem#::LoseInputFocuscxx . . $ MenuItem#LoseInputFocus(49f6e7a06ebc5aa8).(void) {
821 // Make this guy lose focus, Set it's Current Submenu to -1
822 HasInputFocuscxx . . $ MenuItem#HasInputFocus. = false;
823 CurrSubMenucxx . . $ MenuItem#CurrSubMenu. = -1;
824 }
825 bool MenuItemcxx . . $ MenuItem#::GetFocuscxx . . $ MenuItem#GetFocus(c9857a73d68e59ba).(void) { return HasInputFocuscxx . . $ MenuItem#HasInputFocus.; }
826 void MenuItemcxx . . $ MenuItem#::CallFunccxx . . $ MenuItem#CallFunc(d4f767463ce0a6b3).(int value) {
827 if (funccxx . . $ MenuItem#func.)
828 (*funccxx . . $ MenuItem#func.)(value);
829 }
830 bool MenuItemcxx . . $ MenuItem#::HasSubMenuscxx . . $ MenuItem#HasSubMenus(c9857a73d68e59ba).(void) { return (SubMenuCountcxx . . $ MenuItem#SubMenuCount. > 0); }
831
832 int MenuItemcxx . . $ MenuItem#::GetCustomSubMenuCountcxx . . $ MenuItem#GetCustomSubMenuCount(b126dc7c1de90089).(void) {
833 if (m_cTypecxx . . $ MenuItem#m_cType. != MIT_CUSTOMcxx . . $ `netgames/includes/DMFC.h:517:9`!)
834 return -1;
835
836 if (!m_cmInfocxx . . $ MenuItem#m_cmInfo..GetListCountcxx . . $ tCustomMenu#GetListCount.)
837 return -1;
838
839 return (*m_cmInfocxx . . $ MenuItem#m_cmInfo..GetListCountcxx . . $ tCustomMenu#GetListCount.)();
840 }
841
842 char MenuItemcxx . . $ MenuItem#::GetTypecxx . . $ MenuItem#GetType(6e9c618e4dd2eafc).(void) { return m_cTypecxx . . $ MenuItem#m_cType.; }
843 void MenuItemcxx . . $ MenuItem#::SetStatecxx . . $ MenuItem#SetState(d4f767463ce0a6b3).(int state) {
844 if (m_cTypecxx . . $ MenuItem#m_cType. != MIT_STATEcxx . . $ `netgames/includes/DMFC.h:515:9`!)
845 return;
846
847 if ((state < 0) || (state >= SubMenuCountcxx . . $ MenuItem#SubMenuCount.))
848 return;
849
850 m_iStatecxx . . $ MenuItem#m_iState. = state;
851 }
852
853 bool MenuItemcxx . . $ MenuItem#::SetStateItemListcxx . . $ MenuItem#SetStateItemList(d49b86907ad5c83b).(int count, ...) {
854 if (m_cTypecxx . . $ MenuItem#m_cType. != MIT_STATEcxx . . $ `netgames/includes/DMFC.h:515:9`!)
855 return false;
856
857 // remove original states
858 for (int i = 0; i < SubMenuCountcxx . . $ MenuItem#SubMenuCount.; i++) {
859 if (SubMenuscxx . . $ MenuItem#SubMenus.[i]) {
860 delete SubMenuscxx . . $ MenuItem#SubMenus.[i];
861 SubMenuscxx . . $ MenuItem#SubMenus.[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
862 }
863 }
864 if (SubMenuscxx . . $ MenuItem#SubMenus.) {
865 free(SubMenuscxx . . $ MenuItem#SubMenus.);
866 SubMenuscxx . . $ MenuItem#SubMenus. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
867 }
868
869 va_list marker;
870 va_startcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h:50:9`!(marker, count);
871 SubMenuCountcxx . . $ MenuItem#SubMenuCount. = count;
872 m_iStatecxx . . $ MenuItem#m_iState. = 0;
873
874 if ((SubMenuCountcxx . . $ MenuItem#SubMenuCount. > 0) && (SubMenuCountcxx . . $ MenuItem#SubMenuCount. < MAX_STATE_SUBMENUScxx . . $ `netgames/dmfc/dmfcinternal.h:2793:9`!)) {
875 SubMenuscxx . . $ MenuItem#SubMenus. = (IMenuItemcxx . . $ IMenuItem# **)malloc(sizeof(IMenuItemcxx . . $ IMenuItem# *) * SubMenuCountcxx . . $ MenuItem#SubMenuCount.);
876 if (!SubMenuscxx . . $ MenuItem#SubMenus.)
877 return false;
878 char *string;
879 for (int i = 0; i < SubMenuCountcxx . . $ MenuItem#SubMenuCount.; i++) {
880 string = va_argcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h:53:9`!(marker, char *);
881 SubMenuscxx . . $ MenuItem#SubMenus.[i] = new MenuItemcxx . . $ MenuItem#(string, MIT_STATEITEMcxx . . $ `netgames/includes/DMFC.h:516:9`!, 0, funccxx . . $ MenuItem#func.);
882 }
883 } else
884 SubMenuCountcxx . . $ MenuItem#SubMenuCount. = 0;
885 va_endcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h:52:9`!(marker);
886 return true;
887 }
888
889 bool MenuItemcxx . . $ MenuItem#::SetStateItemListArraycxx . . $ MenuItem#SetStateItemListArray(999dbd1e14140801).(int count, char **array) {
890 if (m_cTypecxx . . $ MenuItem#m_cType. != MIT_STATEcxx . . $ `netgames/includes/DMFC.h:515:9`!)
891 return false;
892
893 // remove original states
894 for (int i = 0; i < SubMenuCountcxx . . $ MenuItem#SubMenuCount.; i++) {
895 if (SubMenuscxx . . $ MenuItem#SubMenus.[i]) {
896 delete SubMenuscxx . . $ MenuItem#SubMenus.[i];
897 SubMenuscxx . . $ MenuItem#SubMenus.[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
898 }
899 }
900 if (SubMenuscxx . . $ MenuItem#SubMenus.) {
901 free(SubMenuscxx . . $ MenuItem#SubMenus.);
902 SubMenuscxx . . $ MenuItem#SubMenus. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
903 }
904
905 SubMenuCountcxx . . $ MenuItem#SubMenuCount. = count;
906 m_iStatecxx . . $ MenuItem#m_iState. = 0;
907
908 if ((SubMenuCountcxx . . $ MenuItem#SubMenuCount. > 0) && (SubMenuCountcxx . . $ MenuItem#SubMenuCount. < MAX_STATE_SUBMENUScxx . . $ `netgames/dmfc/dmfcinternal.h:2793:9`!)) {
909 SubMenuscxx . . $ MenuItem#SubMenus. = (IMenuItemcxx . . $ IMenuItem# **)malloc(sizeof(IMenuItemcxx . . $ IMenuItem# *) * SubMenuCountcxx . . $ MenuItem#SubMenuCount.);
910 if (!SubMenuscxx . . $ MenuItem#SubMenus.)
911 return false;
912 char *string;
913 for (int i = 0; i < SubMenuCountcxx . . $ MenuItem#SubMenuCount.; i++) {
914 string = array[i];
915 SubMenuscxx . . $ MenuItem#SubMenus.[i] = new MenuItemcxx . . $ MenuItem#(string, MIT_STATEITEMcxx . . $ `netgames/includes/DMFC.h:516:9`!, 0, funccxx . . $ MenuItem#func.);
916 }
917 } else
918 SubMenuCountcxx . . $ MenuItem#SubMenuCount. = 0;
919 return true;
920 }
921
922 ///////////////////////////////////////////////////
923 // Menu Function handlers
924
925 int GetBanPlayerListcxx . . $ GetBanPlayerList(b126dc7c1de90089).(void) { return basethiscxx . . $ basethis.->GetNumBannedPlayerscxx . . $ DMFCBase#GetNumBannedPlayers(b126dc7c1de90089).(); }
926
927 char *GetBannedPlayerStringcxx . . $ GetBannedPlayerString(ff224f080444ee45).(int index) {
928 static char r[MAX_CALLSIGN_SIZEcxx . . $ `netgames/includes/DMFC.h:525:9`! + 8];
929 char *ptr = basethiscxx . . $ basethis.->GetBannedPlayerCallsigncxx . . $ DMFCBase#GetBannedPlayerCallsign(ff224f080444ee45).(index);
930 if (ptr) {
931 snprintf(r, sizeof(r), "[%d]%s", index, ptr);
932 return r;
933 } else
934 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
935 }
936
937 // Removes a ban for a player, give the ban index #
938 void RemoveBanByIndexcxx . . $ RemoveBanByIndex(d4f767463ce0a6b3).(int index) { basethiscxx . . $ basethis.->RemoveBancxx . . $ DMFCBase#RemoveBan(83c267b20bac841a).(index); }
939
940 // Server Only. Kicks a player from the game
941 void KickPlayercxx . . $ KickPlayer(d4f767463ce0a6b3).(int pnum) {
942 if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) {
943 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "KickPlayer Error: You're Not The Server\n");
944 return;
945 }
946 if (pnum == basethiscxx . . $ basethis.->GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).()) {
947 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "KickPlayer Error: Server can't kick themself\n");
948 DLLAddHUDMessage(DTXT_SERVERCANTKICKcxx . . $ `netgames/dmfc/dmfcinternal.h:2676:9`!);
949 return;
950 }
951 if (!basethiscxx . . $ basethis.->CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(pnum)) {
952 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "KickPlayer Error: Pnum %d not in game\n", pnum);
953 DLLAddHUDMessage(DTXT_INVALIDPNUMcxx . . $ `netgames/dmfc/dmfcinternal.h:2673:9`!, pnum);
954 return;
955 }
956 basethiscxx . . $ basethis.->SendControlMessageToPlayercxx . . $ DMFCBase#SendControlMessageToPlayer(9633529ce3c4ff50).(pnum, CM_KICKEDcxx . . $ `netgames/dmfc/dmfcinternal.h:281:9`!);
957 DLLMultiDisconnectPlayer(pnum);
958 }
959 // Server Only. Temp bans a player from the game
960 void BanPlayercxx . . $ BanPlayer(d4f767463ce0a6b3).(int pnum) {
961 if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) {
962 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "BanPlayer Error: You're Not The Server\n");
963 return;
964 }
965 if (pnum == basethiscxx . . $ basethis.->GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).()) {
966 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "BanPlayer Error: Server can't ban themself\n");
967 DLLAddHUDMessage(DTXT_SERVERCANTBANcxx . . $ `netgames/dmfc/dmfcinternal.h:2677:9`!);
968 return;
969 }
970 if (!basethiscxx . . $ basethis.->CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(pnum)) {
971 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "BanPlayer Error: Pnum %d not in game\n", pnum);
972 DLLAddHUDMessage(DTXT_INVALIDPNUMcxx . . $ `netgames/dmfc/dmfcinternal.h:2673:9`!, pnum);
973 return;
974 }
975 basethiscxx . . $ basethis.->SendControlMessageToPlayercxx . . $ DMFCBase#SendControlMessageToPlayer(9633529ce3c4ff50).(pnum, CM_BANNEDcxx . . $ `netgames/dmfc/dmfcinternal.h:282:9`!);
976 DLLMultiDisconnectPlayer(pnum);
977 basethiscxx . . $ basethis.->BanPlayerFromGamecxx . . $ DMFCBase#BanPlayerFromGame(d4f767463ce0a6b3).(pnum);
978 }
979 // Server Only. Ends the current level
980 void EndMultiLevelcxx . . $ EndMultiLevel(d4f767463ce0a6b3).(int i) {
981 if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) {
982 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "You're Not The Server\n");
983 return;
984 }
985 DLLMultiEndLevel();
986 basethiscxx . . $ basethis.->EnableOnScreenMenucxx . . $ DMFCBase#EnableOnScreenMenu(b45ddcbc8423892c).(false);
987 }
988 // Server Only. Automatically balances the teams
989 void BalanceTeamscxx . . $ BalanceTeams(d4f767463ce0a6b3).(int i) {
990 if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) {
991 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "You're Not The Server\n");
992 return;
993 }
994
995 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Balancing Teams\n");
996 DPrintf(DTXT_BALANCINGTEAMScxx . . $ `netgames/dmfc/dmfcinternal.h:2678:9`!);
997
998 // First we need to get a count of how many are on each team
999 int TeamCount[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!];
1000 for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++)
1001 TeamCount[i] = 0;
1002
1003 for (i = 0; i < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; i++) {
1004 if (basethiscxx . . $ basethis.->CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(i)) {
1005 if (basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[i].teamcxx . . $ player#team. != -1) { // don't count dedicated server
1006 TeamCount[basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[i].teamcxx . . $ player#team.]++;
1007 }
1008 }
1009 }
1010
1011 // Now determine how many should be on each team
1012 int optcount = 0;
1013 int ingame = 0;
1014 int numteams = basethiscxx . . $ basethis.->GetNumTeamscxx . . $ DMFCBase#GetNumTeams(b126dc7c1de90089).();
1015
1016 for (i = 0; i < MAX_TEAMScxx . . $ `Descent3/player_external_struct.h:87:9`!; i++)
1017 ingame += TeamCount[i];
1018
1019 optcount = ingame / numteams;
1020 int leftover = ingame - (optcount * numteams);
1021
1022 // fill in the number of players each team should have
1023 int ShouldHave[MAX_TEAMScxx . . $ `Descent3/player_external_struct.h:87:9`!];
1024 for (i = 0; i < MAX_TEAMScxx . . $ `Descent3/player_external_struct.h:87:9`!; i++) {
1025 if (i < numteams) {
1026 ShouldHave[i] = optcount;
1027 } else {
1028 ShouldHave[i] = 0;
1029 }
1030 }
1031
1032 // Make adjustments for the leftover players
1033 for (i = 0; i < leftover; i++)
1034 ShouldHave[i]++;
1035
1036 for (i = 0; i < MAX_TEAMScxx . . $ `Descent3/player_external_struct.h:87:9`!; i++) {
1037 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "%s team should have %d players and has %d now\n",
1038 basethis->GetTeamString(i),
1039 ShouldHave[i],
1040 TeamCount[i]);
1041 }
1042
1043 // Now move the players around until the teams are of the right size
1044 int j;
1045 for (i = 0; i < MAX_TEAMScxx . . $ `Descent3/player_external_struct.h:87:9`!; i++) {
1046 while (ShouldHave[i] > TeamCount[i]) {
1047 // We need to adjust this team by adding more players
1048 int pn;
1049 float lowseniority;
1050 int lowpn;
1051
1052 lowseniority = 0;
1053 lowpn = -1;
1054
1055 for (j = 0; j < MAX_TEAMScxx . . $ `Descent3/player_external_struct.h:87:9`!; j++) {
1056 if (ShouldHave[j] < TeamCount[j]) {
1057 // We can remove a player from this team
1058
1059 // Determine which player has least seniority
1060 for (pn = 0; pn < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; pn++) {
1061 if ((basethiscxx . . $ basethis.->CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(pn)) && (basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[pn].teamcxx . . $ player#team. == j) &&
1062 (basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[pn].teamcxx . . $ player#team. != -1)) {
1063 // get the pnum, and seniority info here
1064 if (lowseniority < basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[pn].time_in_gamecxx . . $ player#time_in_game.) {
1065 lowpn = pn;
1066 lowseniority = basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[pn].time_in_gamecxx . . $ player#time_in_game.;
1067 }
1068 } // end if
1069 } // end for
1070 if (lowpn != -1) {
1071 TeamCount[j]--;
1072 break;
1073 }
1074
1075 } // end if
1076 } // end for
1077 if (lowpn != -1) {
1078 // Change this player to the new team
1079 TeamCount[i]++;
1080 basethiscxx . . $ basethis.->RequestTeamChangecxx . . $ DMFCBase#RequestTeamChange(6908015b96d379c0).(i, lowpn, true);
1081 }
1082 } // end while
1083 } // end for
1084 }
1085 // Server Only. Switches AutoTeamSelect On/Off
1086 void SwitchAutoTeamSelectcxx . . $ SwitchAutoTeamSelect(d4f767463ce0a6b3).(int i) {
1087 if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) {
1088 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "You're Not The Server\n");
1089 return;
1090 }
1091 bool on = (i == 1) ? true : false;
1092 basethiscxx . . $ basethis.->AutoTeamSelectcxx . . $ DMFCBase#AutoTeamSelect(b45ddcbc8423892c).(on);
1093 }
1094
1095 // Server Only. Switches allowing Team Changing on/off
1096 void SwitchTeamChangecxx . . $ SwitchTeamChange(d4f767463ce0a6b3).(int i) {
1097 if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) {
1098 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "You're not the server\n");
1099 return;
1100 }
1101 bool on = (i == 1) ? true : false;
1102 basethiscxx . . $ basethis.->SwitchAllowTeamChangecxx . . $ DMFCBase#SwitchAllowTeamChange(b45ddcbc8423892c).(on);
1103 }
1104
1105 // Switch's on/off Displaying a player's info
1106 void SwitchPlayerInfocxx . . $ SwitchPlayerInfo(d4f767463ce0a6b3).(int pnum) {
1107 if (pnum == -1) {
1108 // the <None> was selected, so make sure that it's turned off
1109 int curr_disp = basethiscxx . . $ basethis.->DisplayingPlayerInfocxx . . $ DMFCBase#DisplayingPlayerInfo(b126dc7c1de90089).();
1110
1111 if (curr_disp == -1) // we're not displaying anyone now anyway
1112 return;
1113
1114 // turn off the pnum given to us
1115 basethiscxx . . $ basethis.->SwitchPlayerInfoDisplaycxx . . $ DMFCBase#SwitchPlayerInfoDisplay(d4f767463ce0a6b3).(curr_disp);
1116
1117 return;
1118 }
1119
1120 if (!basethiscxx . . $ basethis.->CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(pnum)) {
1121 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "%d is invalid for playerinfo\n", pnum);
1122 return;
1123 }
1124
1125 int curr_disp = basethiscxx . . $ basethis.->DisplayingPlayerInfocxx . . $ DMFCBase#DisplayingPlayerInfo(b126dc7c1de90089).();
1126
1127 if (curr_disp != -1 && curr_disp != pnum)
1128 basethiscxx . . $ basethis.->SwitchPlayerInfoDisplaycxx . . $ DMFCBase#SwitchPlayerInfoDisplay(d4f767463ce0a6b3).(pnum); // turn it off
1129
1130 basethiscxx . . $ basethis.->SwitchPlayerInfoDisplaycxx . . $ DMFCBase#SwitchPlayerInfoDisplay(d4f767463ce0a6b3).(pnum);
1131
1132 // Make the call to DisplayPlayerInfo now with passing true to dedicated_server so it will
1133 // print the info to the console once
1134 basethiscxx . . $ basethis.->DisplayPlayerInfocxx . . $ DMFCBase#DisplayPlayerInfo(918ebd27a9ddbad3).(true);
1135 }
1136
1137 // Switch's on/off Displaying a player's name on the HUD
1138 void SwitchHudPlayerNumcxx . . $ SwitchHudPlayerNum(d4f767463ce0a6b3).(int i) { basethiscxx . . $ basethis.->SwitchShowHudCallsignLevelcxx . . $ DMFCBase#SwitchShowHudCallsignLevel(f2ac3508b56cd10).(i); }
1139
1140 // Switch the server's Max HUD Callsign level
1141 void SwitchServerHudPlayerNamecxx . . $ SwitchServerHudPlayerName(d4f767463ce0a6b3).(int i) {
1142 if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!)
1143 return;
1144 basethiscxx . . $ basethis.->SwitchServerHudCallsignLevelcxx . . $ DMFCBase#SwitchServerHudCallsignLevel(ac50b47256ae7414).(i);
1145 }
1146
1147 // Change teams (or more specifically request to change teams)
1148 void ChangeTeamscxx . . $ ChangeTeams(d4f767463ce0a6b3).(int team) {
1149 if ((team < 0) || (team > 3)) {
1150 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Invalid team requested (%d)\n", team);
1151 return;
1152 }
1153 int curr_team = basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[basethiscxx . . $ basethis.->GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).()].teamcxx . . $ player#team.;
1154
1155 if (curr_team == -1) {
1156 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Dedicated Server Can't Change Teams\n");
1157 DPrintf(DTXT_NODEDICATEDTEAMcxx . . $ `netgames/dmfc/dmfcinternal.h:2679:9`!);
1158 return;
1159 }
1160
1161 if (team == curr_team) {
1162 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "You're already on the %s team\n", basethis->GetTeamString(team));
1163 DPrintf(DTXT_SAMETEAMCHANGEcxx . . $ `netgames/dmfc/dmfcinternal.h:2680:9`!, basethiscxx . . $ basethis.->GetTeamStringcxx . . $ DMFCBase#GetTeamString(f7ae7e56280f18ae).(team));
1164 return;
1165 }
1166 basethiscxx . . $ basethis.->RequestTeamChangecxx . . $ DMFCBase#RequestTeamChange(6908015b96d379c0).(team, basethiscxx . . $ basethis.->GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).(), true);
1167 }
1168
1169 // Send a request to DMFC to save the game stats to file
1170 void SaveStatsToFilecxx . . $ SaveStatsToFile(d4f767463ce0a6b3).(int i) { basethiscxx . . $ basethis.->CallOnSaveStatsToFilecxx . . $ DMFCBase#CallOnSaveStatsToFile(49f6e7a06ebc5aa8).(); }
1171
1172 // Turns on/off Observer Mode
1173 void SwitchObserverModecxx . . $ SwitchObserverMode(d4f767463ce0a6b3).(int i) {
1174 objectcxx . . $ object# *pobj;
1175 int pnum = basethiscxx . . $ basethis.->GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).();
1176
1177 if ((pnum < 0) || (pnum >= DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!))
1178 return;
1179
1180 pobj = &basethiscxx . . $ basethis.->Objectscxx . . $ DMFCBase#Objects.[basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[pnum].objnumcxx . . $ player#objnum.];
1181
1182 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "SwitchObserverMode %s [%d]\n", (i == 1) ? "On" : "Off", pnum);
1183
1184 if (pobj->typecxx . . $ object#type. == OBJ_OBSERVERcxx . . $ `Descent3/object_external.h:182:9`!) {
1185 if ((i == 0) && (basethiscxx . . $ basethis.->CallOnAllowObserverChangecxx . . $ DMFCBase#CallOnAllowObserverChange(efaadfb7dc14930a).(false)))
1186 DLLMultiSendRequestToObserve(OBSERVER_MODE_ROAMcxx . . $ `Descent3/player_external.h:75:9`!, 0, 0);
1187 } else {
1188 if ((i == 1) && (basethiscxx . . $ basethis.->CallOnAllowObserverChangecxx . . $ DMFCBase#CallOnAllowObserverChange(efaadfb7dc14930a).(true)))
1189 DLLMultiSendRequestToObserve(OBSERVER_MODE_ROAMcxx . . $ `Descent3/player_external.h:75:9`!, 1, 0);
1190 }
1191 }
1192
1193 // Turns on/off PiggyBack mode
1194 void SwitchPiggyBackcxx . . $ SwitchPiggyBack(d4f767463ce0a6b3).(int pnum) {
1195 if (!basethiscxx . . $ basethis.->CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(pnum)) {
1196 return;
1197 }
1198
1199 objectcxx . . $ object# *pobj;
1200 pobj = &basethiscxx . . $ basethis.->Objectscxx . . $ DMFCBase#Objects.[basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[basethiscxx . . $ basethis.->GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).()].objnumcxx . . $ player#objnum.];
1201
1202 if (pobj->typecxx . . $ object#type. == OBJ_OBSERVERcxx . . $ `Descent3/object_external.h:182:9`!) {
1203 if (basethiscxx . . $ basethis.->CallOnAllowObserverChangecxx . . $ DMFCBase#CallOnAllowObserverChange(efaadfb7dc14930a).(false))
1204 DLLMultiSendRequestToObserve(OBSERVER_MODE_ROAMcxx . . $ `Descent3/player_external.h:75:9`!, 0, 0);
1205 }
1206 if (pnum == basethiscxx . . $ basethis.->GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).()) {
1207 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Returning to self\n");
1208 return;
1209 }
1210
1211 if (basethiscxx . . $ basethis.->CallOnAllowObserverChangecxx . . $ DMFCBase#CallOnAllowObserverChange(efaadfb7dc14930a).(true)) {
1212 mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Switching to piggyback for player %d\n", pnum);
1213 DLLMultiSendRequestToObserve(OBSERVER_MODE_PIGGYBACKcxx . . $ `Descent3/player_external.h:76:9`!, 1, basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[pnum].objnumcxx . . $ player#objnum.);
1214 }
1215 }
1216
1217 // Turns on/off the statistical hud messages
1218 void SwitchStatHUDMessagescxx . . $ SwitchStatHUDMessages(d4f767463ce0a6b3).(int i) {
1219 bool on = (i) ? true : false;
1220 basethiscxx . . $ basethis.->EnableStatisticalMessagescxx . . $ DMFCBase#EnableStatisticalMessages(b45ddcbc8423892c).(on);
1221 }
1222
1223 // Exits the on-screen menu
1224 void MenuExitMenucxx . . $ MenuExitMenu(d4f767463ce0a6b3).(int i) { basethiscxx . . $ basethis.->EnableOnScreenMenucxx . . $ DMFCBase#EnableOnScreenMenu(b45ddcbc8423892c).(false); }
1225
1226 // Switches on/off auto saving of the stats to file on level end
1227 void SwitchSaveStatsLevelEndcxx . . $ SwitchSaveStatsLevelEnd(d4f767463ce0a6b3).(int i) { basethiscxx . . $ basethis.->EnableAutoSaveLevelEndcxx . . $ DMFCBase#EnableAutoSaveLevelEnd(b45ddcbc8423892c).((i) ? true : false); }
1228
1229 // Switches on/off auto saving of the stats to file on disconnect from the game
1230 void SwitchSaveStatsDisconnectcxx . . $ SwitchSaveStatsDisconnect(d4f767463ce0a6b3).(int i) { basethiscxx . . $ basethis.->EnableAutoSaveDisconnectcxx . . $ DMFCBase#EnableAutoSaveDisconnect(b45ddcbc8423892c).((i) ? true : false); }
1231
1232 // Switches on/off displaying the background
1233 void SwitchMenuBackgroundcxx . . $ SwitchMenuBackground(d4f767463ce0a6b3).(int i) {
1234 bool on = (i) ? true : false;
1235 basethiscxx . . $ basethis.->EnableOnScreenMenuBackgroundcxx . . $ DMFCBase#EnableOnScreenMenuBackground(b45ddcbc8423892c).(on);
1236 }
1237
1238 // Switches on/off displaying the netgame info
1239 void SwitchNetGameInfocxx . . $ SwitchNetGameInfo(d4f767463ce0a6b3).(int i) { basethiscxx . . $ basethis.->SwitchNetGameInfoDisplaycxx . . $ DMFCBase#SwitchNetGameInfoDisplay(d4f767463ce0a6b3).(i); }
1240
1241 // Switches the death message filter
1242 void SwitchDeathMessageFiltercxx . . $ SwitchDeathMessageFilter(d4f767463ce0a6b3).(int i) { basethiscxx . . $ basethis.->SetDeathMessageFiltercxx . . $ DMFCBase#SetDeathMessageFilter(d4f767463ce0a6b3).(i); }
1243
1244 // brings up the team config dialog for the server
1245 void OnScreenDisplayTeamConfigcxx . . $ OnScreenDisplayTeamConfig(d4f767463ce0a6b3).(int i) {
1246 if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!)
1247 return;
1248 if (basethiscxx . . $ basethis.->GetNumTeamscxx . . $ DMFCBase#GetNumTeams(b126dc7c1de90089).() < 2)
1249 return;
1250
1251 static char enable;
1252 enable = 2;
1253 basethiscxx . . $ basethis.->StartUIWindowcxx . . $ DMFCBase#StartUIWindow(6ca3d68f5c5f0975).(UIID_TEAMPLACEMENTcxx . . $ `netgames/dmfc/dmfcinternal.h:2784:9`!, &enable);
1254 basethiscxx . . $ basethis.->EnableOnScreenMenucxx . . $ DMFCBase#EnableOnScreenMenu(b45ddcbc8423892c).(false);
1255 }
1256
1257 // Switches turning on/off displaying ship logos
1258 void SwitchShipLogoEnablecxx . . $ SwitchShipLogoEnable(d4f767463ce0a6b3).(int i) {
1259 bool enable = (i) ? true : false;
1260 basethiscxx . . $ basethis.->EnableShipLogoscxx . . $ DMFCBase#EnableShipLogos(b45ddcbc8423892c).(enable);
1261 DLLAddHUDMessage(DTXT_SHIPLOGOSMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2681:9`!, (enable) ? DTXT_ENABLEDcxx . . $ `netgames/dmfc/dmfcinternal.h:2682:9`! : DTXT_DISABLEDcxx . . $ `netgames/dmfc/dmfcinternal.h:2683:9`!);
1262 }
1263
1264 void SwitchAudioTauntsEnablecxx . . $ SwitchAudioTauntsEnable(d4f767463ce0a6b3).(int i) {
1265 bool enable = (i) ? true : false;
1266 basethiscxx . . $ basethis.->EnableAudioTauntscxx . . $ DMFCBase#EnableAudioTaunts(b45ddcbc8423892c).(enable);
1267 DLLAddHUDMessage(DTXT_AUDIOTAUNTSMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2708:9`!, (enable) ? DTXT_ENABLEDcxx . . $ `netgames/dmfc/dmfcinternal.h:2682:9`! : DTXT_DISABLEDcxx . . $ `netgames/dmfc/dmfcinternal.h:2683:9`!);
1268 }
1269
1270 // Rehashs the hosts.allow/deny lists
1271 void RehashAllowDenyListscxx . . $ RehashAllowDenyLists(d4f767463ce0a6b3).(int i) {
1272 if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!)
1273 return;
1274
1275 DLLAddHUDMessage(DTXT_REHASHINGMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2684:9`!);
1276
1277 basethiscxx . . $ basethis.->RehashAllowDenycxx . . $ DMFCBase#RehashAllowDeny(49f6e7a06ebc5aa8).();
1278 }
1279
1280 void SwitchLossPingIndicatorcxx . . $ SwitchLossPingIndicator(d4f767463ce0a6b3).(int i) {
1281 bool enable = (i) ? true : false;
1282 basethiscxx . . $ basethis.->EnableLossGuagecxx . . $ DMFCBase#EnableLossGuage(b45ddcbc8423892c).(enable);
1283 DLLAddHUDMessage(DTXT_LOSSINDICATORcxx . . $ `netgames/dmfc/dmfcinternal.h:2713:9`!, (enable) ? DTXT_ENABLEDcxx . . $ `netgames/dmfc/dmfcinternal.h:2682:9`! : DTXT_DISABLEDcxx . . $ `netgames/dmfc/dmfcinternal.h:2683:9`!);
1284 }