Debian Codegraph @

Descent3/mmItem.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 * $Source: $
21 * $Revision: 27 $
22 * $Author: Matt $
23 * $Date: 12/06/01 9:26a $
24 *
25 * main menu interface
26 *
27 * $Log: /DescentIII/Main/mmItem.cpp $
28 *
29 * 27 12/06/01 9:26a Matt
30 * Added code to override main menu bitmap.
31 *
32 * 26 3/20/00 12:17p Matt
33 * Merge of Duane's post-1.3 changes.
34 * Don't show build number in release versions (Mac only)
35 *
36 * 25 8/02/99 9:01a Duane
37 * turned off menusound for mac
38 *
39 * 24 4/29/99 3:21a Samir
40 * reorganized main menu music to work in config, multiplayer, whereever.
41 *
42 * 23 4/21/99 4:10p Samir
43 * changed sound names for table file.
44 *
45 * 22 4/20/99 1:58a Matt
46 * Changed version number text from old UI font to briefing font.
47 *
48 * 21 4/18/99 8:35p Samir
49 * replaced placeholder sounds with newer placeholder sounds.
50 *
51 * 20 4/15/99 2:32p Kevin
52 * Added some code for the Demo
53 *
54 * 19 4/14/99 11:48a Matt
55 * Moved the main menu movie to the movies directory
56 *
57 * 18 4/02/99 3:03p Samir
58 * opengl doesn't use main menu movie.
59 *
60 * 17 3/31/99 11:53a Samir
61 * slow opengl code for movies.
62 *
63 * 16 3/23/99 9:06p Samir
64 * properly sync wait dialog and sound system calls.
65 *
66 * 15 3/22/99 10:14a Kevin
67 * Added a build number to the release builds of main. Also put in code to
68 * increment the build number each time a release build is done.
69 *
70 * 14 3/18/99 10:13a Samir
71 * new main menu interface.
72 *
73 * 13 3/02/99 11:52a Kevin
74 * Fixes for OEM Beta 4.1
75 *
76 * 12 2/26/99 5:34p Samir
77 * oem screen.
78 *
79 * 11 2/20/99 12:33p Kevin
80 * Added some OEM stuff
81 *
82 * 10 10/23/98 7:05p Samir
83 * fixed keyboard select prob.
84 *
85 * 9 10/22/98 5:23p Matt
86 * Moved the version number and made it not print the build number if the
87 * build number was zero.
88 *
89 * 8 10/20/98 3:52p Samir
90 * tweaked main menu look.
91 *
92 * 7 10/13/98 6:06p Samir
93 * fixed booboo.
94 *
95 * 6 10/13/98 5:51p Samir
96 * moved version number
97 *
98 * 5 10/13/98 3:16p Samir
99 * enhanced gadgets some more with new effects (added Credits option).
100 *
101 * 4 10/13/98 12:03p Kevin
102 * Changed use of preprocessors for debug, etc.
103 *
104 * 3 10/12/98 4:40p Samir
105 * fancy effect for hotspots in main menu.
106 *
107 * 2 10/12/98 1:46p Samir
108 * initial new main menu
109 *
110 */
111
112 #include "mmItem.h"cxx . . $ `<file>/Descent3/mmItem.h`/
113 #include "game.h"cxx . . $ `<file>/Descent3/game.h`/
114 #include "program.h"cxx . . $ `<file>/Descent3/program.h`/
115 #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/
116 #include "cinematics.h"cxx . . $ `<file>/Descent3/cinematics.h`/
117 #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/
118 #include "soundload.h"cxx . . $ `<file>/sndlib/soundload.h`/
119 #include "d3music.h"cxx . . $ `<file>/Descent3/d3music.h`/
120
121 #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/
122 // #include <malloc.h>
123 #include "mem.h"cxx . . $ `<file>/mem/mem.h`/
124
125 #include <string.h>
126
127 // externed from newui.cpp
128 extern int UI_frame_resultcxx . . $ UI_frame_result.;
129
130 static mmInterfacecxx . . $ mmInterface# *MM_objectcxx . . $ MM_object. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
131 // attached window.
132 mmInterfacecxx . . $ mmInterface# *mmItemcxx . . $ mmItem#::m_windowcxx . . $ mmItem#m_window. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
133
134 const char *MMSoundFilescxx . . $ MMSoundFiles.[N_MM_SOUNDScxx . . $ `Descent3/mmItem.h:90:9`!] = {"MenuBeepEnter", "MenuBeepSelect"};
135 void PlayMenuSoundcxx . . $ PlayMenuSound(918ebd27a9ddbad3).(int sound_index, bool wait_till_done = false);
136
137 /*
138 $$TABLE_SOUND "MenuBeepEnter"
139 $$TABLE_SOUND "MenuBeepSelect"
140 */
141
142 //////////////////////////////////////////////////////////////////////
143 // Construction/Destruction
144 //////////////////////////////////////////////////////////////////////
145
146 mmItemcxx . . $ mmItem#::mmItemcxx . . $ mmItem#mmItem(49f6e7a06ebc5aa8).() { m_textcxx . . $ mmItem#m_text. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; }
147
148 mmItemcxx . . $ mmItem#::~cxx . . $ mmItem#`~mmItem`(ced63f7c635d850d).mmItemcxx . . $ mmItem#() {
149 if (m_textcxx . . $ mmItem#m_text.)
150 mem_freecxx . . $ `mem/mem.h:80:9`!(m_text);
151 }
152
153 // attaches a window to all mmitems.
154 void mmItemcxx . . $ mmItem#::AttachInterfacecxx . . $ mmItem#AttachInterface(b617a8135d67409).(mmInterfacecxx . . $ mmInterface# *wnd) { mmItemcxx . . $ mmItem#::m_windowcxx . . $ mmItem#m_window. = wnd; }
155
156 void mmItemcxx . . $ mmItem#::Createcxx . . $ mmItem#Create(c9e50ccfae272660).(int id, int key, int x, int y, const char *text, int flags, tmmItemFXcxx . . $ tmmItemFX# init_fx) {
157 m_alphacxx . . $ mmItem#m_alpha. = 0;
158 m_satcountcxx . . $ mmItem#m_satcount. = 0;
159 m_fxqueuecxx . . $ mmItem#m_fxqueue..flushcxx . . $ tmmItemQueue#flush(49f6e7a06ebc5aa8).();
160
161 m_textcxx . . $ mmItem#m_text. = text ? mem_strdupcxx . . $ `mem/mem.h:81:9`!(text) : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
162 m_fxqueuecxx . . $ mmItem#m_fxqueue..sendcxx . . $ tmmItemQueue#send(b6058802d21cb2be).(init_fx);
163 m_curfxcxx . . $ mmItem#m_curfx. = mmItemFXNullcxx . . $ mmItemFXNull.;
164 m_process_speedcxx . . $ mmItem#m_process_speed. = 0.0f;
165
166 // set colors
167 m_colorscxx . . $ mmItem#m_colors.[0] = MMITEM_COLORcxx . . $ `Descent3/mmItem.h:83:9`!;
168 m_last_frametimecxx . . $ mmItem#m_last_frametime. = UI_TIMEcxx . . $ UI_TIME(9b8c9e39889c762c).();
169
170 UIGadgetcxx . . $ UIGadget#::Createcxx . . $ UIGadget#Create(43707b8add2f137d).(m_windowcxx . . $ mmItem#m_window., id, x, y, 0, 0, UIF_FITcxx . . $ `ui/ui.h:343:9`! | flags);
171 UIGadgetcxx . . $ UIGadget#::SetHotkeycxx . . $ UIGadget#SetHotkey(d4f767463ce0a6b3).(key);
172 }
173
174 void mmItemcxx . . $ mmItem#::AddEffectcxx . . $ mmItem#AddEffect(9a2e9a6d763c3e3f).(tmmItemFXcxx . . $ tmmItemFX# fx) { m_fxqueuecxx . . $ mmItem#m_fxqueue..sendcxx . . $ tmmItemQueue#send(b6058802d21cb2be).(fx); }
175
176 void mmItemcxx . . $ mmItem#::ClearEffectscxx . . $ mmItem#ClearEffects(49f6e7a06ebc5aa8).() { m_fxqueuecxx . . $ mmItem#m_fxqueue..flushcxx . . $ tmmItemQueue#flush(49f6e7a06ebc5aa8).(); }
177
178 // override: called when resized or before drawing.
179 void mmItemcxx . . $ mmItem#::OnFormatcxx . . $ mmItem#OnFormat(49f6e7a06ebc5aa8).() {
180 if (m_Flagscxx . . $ UIGadget#m_Flags. & UIF_FITcxx . . $ `ui/ui.h:343:9`!) {
181 ui_DrawSetFontcxx . . $ ui_DrawSetFont(d4f767463ce0a6b3).(MMITEM_FONTcxx . . $ `Descent3/mmItem.h:82:9`!);
182
183 m_Wcxx . . $ UIObject#m_W. = (m_textcxx . . $ mmItem#m_text. ? ui_GetTextWidthcxx . . $ ui_GetTextWidth(5c4306d8553b3696).(m_textcxx . . $ mmItem#m_text.) : 0);
184 m_Hcxx . . $ UIObject#m_H. = (m_textcxx . . $ mmItem#m_text. ? ui_GetTextHeightcxx . . $ ui_GetTextHeight(5c4306d8553b3696).(m_textcxx . . $ mmItem#m_text.) : 0);
185 }
186
187 UIGadgetcxx . . $ UIGadget#::OnFormatcxx . . $ UIGadget#OnFormat(49f6e7a06ebc5aa8).();
188 }
189
190 // override: behavior when gadget is destroyed.
191 void mmItemcxx . . $ mmItem#::OnDestroycxx . . $ mmItem#OnDestroy(49f6e7a06ebc5aa8).() {
192 if (m_textcxx . . $ mmItem#m_text.) {
193 mem_freecxx . . $ `mem/mem.h:80:9`!(m_text);
194 m_textcxx . . $ mmItem#m_text. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
195 }
196 }
197
198 void mmItemcxx . . $ mmItem#::OnSelectcxx . . $ mmItem#OnSelect(49f6e7a06ebc5aa8).() {
199 PlayMenuSoundcxx . . $ PlayMenuSound(918ebd27a9ddbad3).(m_windowcxx . . $ mmItem#m_window.->SoundHandlescxx . . $ mmInterface#SoundHandles.[MM_SELECT_SOUNDcxx . . $ `Descent3/mmItem.h:91:9`!], true);
200 UIGadgetcxx . . $ UIGadget#::OnSelectcxx . . $ UIGadget#OnSelect(49f6e7a06ebc5aa8).();
201 }
202
203 // override: behavior when mouse button is pressed.
204 void mmItemcxx . . $ mmItem#::OnMouseBtnDowncxx . . $ mmItem#OnMouseBtnDown(d4f767463ce0a6b3).(int btn) {
205 if (btn == UILMSEBTNcxx . . $ `ui/uisys.h:36:9`!) {
206 LOCK_FOCUScxx . . $ `ui/uisys.h:107:9`!(this);
207 }
208 }
209
210 // override: behavior when mouse button is released.
211 void mmItemcxx . . $ mmItem#::OnMouseBtnUpcxx . . $ mmItem#OnMouseBtnUp(d4f767463ce0a6b3).(int btn) {
212 if (btn == UILMSEBTNcxx . . $ `ui/uisys.h:36:9`!) {
213 if (HasFocuscxx . . $ UIGadget#HasFocus(50ce9a9e25b4a850).()) {
214 if (PT_IN_GADGETcxx . . $ PT_IN_GADGET(55d2799d541f12b5).(UIGadgetcxx . . $ UIGadget#::m_Wndcxx . . $ UIGadget#m_Wnd., this, UI_inputcxx . . $ UI_input..mxcxx . . $ tUIInput#mx., UI_inputcxx . . $ UI_input..mycxx . . $ tUIInput#my.)) {
215 OnSelectcxx . . $ mmItem#OnSelect(49f6e7a06ebc5aa8).();
216 }
217 }
218 UNLOCK_FOCUScxx . . $ `ui/uisys.h:109:9`!(this);
219 }
220 }
221
222 // override: behavior when gadget loses input focus.
223 void mmItemcxx . . $ mmItem#::OnLostFocuscxx . . $ mmItem#OnLostFocus(49f6e7a06ebc5aa8).() { AddEffectcxx . . $ mmItem#AddEffect(9a2e9a6d763c3e3f).(mmItemFXFadeOutToNormalcxx . . $ mmItemFXFadeOutToNormal.); }
224
225 // override: behavior when gadget gains input focus.
226 void mmItemcxx . . $ mmItem#::OnGainFocuscxx . . $ mmItem#OnGainFocus(49f6e7a06ebc5aa8).() {
227 AddEffectcxx . . $ mmItem#AddEffect(9a2e9a6d763c3e3f).(mmItemFXFadeInToBrightcxx . . $ mmItemFXFadeInToBright.);
228 PlayMenuSoundcxx . . $ PlayMenuSound(918ebd27a9ddbad3).(m_windowcxx . . $ mmItem#m_window.->SoundHandlescxx . . $ mmInterface#SoundHandles.[MM_FOCUS_SOUNDcxx . . $ `Descent3/mmItem.h:92:9`!]);
229 }
230
231 // override: behavior when gadget is processed
232 void mmItemcxx . . $ mmItem#::OnUserProcesscxx . . $ mmItem#OnUserProcess(49f6e7a06ebc5aa8).() {
233 // if (HasFocus() && !PT_IN_GADGET(m_Wnd, this, UI_input.mx, UI_input.my)) {
234 // LostFocus();
235 // }
236 }
237
238 // override: behavior when gadget is being drawn.
239 void mmItemcxx . . $ mmItem#::OnDrawcxx . . $ mmItem#OnDraw(49f6e7a06ebc5aa8).() {
240 // if not disabled, do fancy effects.
241 if (m_textcxx . . $ mmItem#m_text.) {
242 int i;
243
244 ui_DrawSetFontcxx . . $ ui_DrawSetFont(d4f767463ce0a6b3).(MMITEM_FONTcxx . . $ `Descent3/mmItem.h:82:9`!);
245 ui_DrawSetTextTypecxx . . $ ui_DrawSetTextType(d4f767463ce0a6b3).(0);
246 ui_SetCharAlphacxx . . $ ui_SetCharAlpha(ac50b47256ae7414).(255);
247 ui_DrawStringcxx . . $ ui_DrawString(c261e420eb73c8b5).(m_colorscxx . . $ mmItem#m_colors.[0], 0, 0, m_textcxx . . $ mmItem#m_text.);
248 ui_DrawSetTextTypecxx . . $ ui_DrawSetTextType(d4f767463ce0a6b3).(UI_TEXTTYPE_SATURATEcxx . . $ `ui/uidraw.h:52:9`!);
249 ui_SetCharAlphacxx . . $ ui_SetCharAlpha(ac50b47256ae7414).((uint8_tcxx . . $ uint8_t#)m_alphacxx . . $ mmItem#m_alpha.);
250 for (i = 0; i < m_satcountcxx . . $ mmItem#m_satcount.; i++)
251 ui_DrawStringcxx . . $ ui_DrawString(c261e420eb73c8b5).(m_colorscxx . . $ mmItem#m_colors.[0], 0, 0, m_textcxx . . $ mmItem#m_text.);
252 }
253
254 if ((UI_TIMEcxx . . $ UI_TIME(9b8c9e39889c762c).() - m_last_frametimecxx . . $ mmItem#m_last_frametime.) >= m_process_speedcxx . . $ mmItem#m_process_speed.) {
255 // process special fx.
256 switch (m_curfxcxx . . $ mmItem#m_curfx.) {
257 case mmItemFXNullcxx . . $ mmItemFXNull.:
258 break;
259 case mmItemFXNormalcxx . . $ mmItemFXNormal.:
260 m_alphacxx . . $ mmItem#m_alpha. = MMITEM_ALPHAcxx . . $ `Descent3/mmItem.h:80:9`!;
261 m_satcountcxx . . $ mmItem#m_satcount. = MMITEM_SATcxx . . $ `Descent3/mmItem.h:81:9`!;
262 m_process_speedcxx . . $ mmItem#m_process_speed. = 0.0f;
263 m_curfxcxx . . $ mmItem#m_curfx. = mmItemFXNullcxx . . $ mmItemFXNull.;
264 break;
265
266 case mmItemFXFadeOutToNormalcxx . . $ mmItemFXFadeOutToNormal.:
267 m_process_speedcxx . . $ mmItem#m_process_speed. = 0.075f;
268 m_satcountcxx . . $ mmItem#m_satcount. = (m_satcountcxx . . $ mmItem#m_satcount. < MMITEM_SATcxx . . $ `Descent3/mmItem.h:81:9`!) ? MMITEM_SATcxx . . $ `Descent3/mmItem.h:81:9`! : (m_satcountcxx . . $ mmItem#m_satcount. - 1);
269 if (m_satcountcxx . . $ mmItem#m_satcount. == MMITEM_SATcxx . . $ `Descent3/mmItem.h:81:9`!) {
270 m_curfxcxx . . $ mmItem#m_curfx. = mmItemFXNullcxx . . $ mmItemFXNull.;
271 }
272 break;
273
274 case mmItemFXFadeInToBrightcxx . . $ mmItemFXFadeInToBright.:
275 m_process_speedcxx . . $ mmItem#m_process_speed. = 0.075f;
276 m_satcountcxx . . $ mmItem#m_satcount. = (m_satcountcxx . . $ mmItem#m_satcount. > 2) ? 2 : (m_satcountcxx . . $ mmItem#m_satcount. + 1);
277 if (m_satcountcxx . . $ mmItem#m_satcount. == 2) {
278 m_curfxcxx . . $ mmItem#m_curfx. = mmItemFXNullcxx . . $ mmItemFXNull.;
279 }
280 break;
281 }
282
283 // grab new fx.
284 if (m_curfxcxx . . $ mmItem#m_curfx. == mmItemFXNullcxx . . $ mmItemFXNull.) {
285 tmmItemFXcxx . . $ tmmItemFX# newfx;
286 if (m_fxqueuecxx . . $ mmItem#m_fxqueue..recvcxx . . $ tmmItemQueue#recv(7c630a96e4db74eb).(&newfx)) {
287 m_process_speedcxx . . $ mmItem#m_process_speed. = 0.0f;
288 m_curfxcxx . . $ mmItem#m_curfx. = newfx;
289 }
290 }
291
292 m_last_frametimecxx . . $ mmItem#m_last_frametime. = UI_TIMEcxx . . $ UI_TIME(9b8c9e39889c762c).();
293 }
294 }
295
296 //////////////////////////////////////////////////////////////////////////////
297 // MAIN MENU INTERFACE CODE
298
299 #include "stdlib.h" //need this to get _MAX_PATH, which really ought to be in ddio.h
300
301 bool static_menu_backgroundcxx . . $ static_menu_background. = false;
302
303 void mmInterfacecxx . . $ mmInterface#::Createcxx . . $ mmInterface#Create(49f6e7a06ebc5aa8).() {
304 int i;
305
306 MM_objectcxx . . $ MM_object. = this;
307
308 UIWindowcxx . . $ UIWindow#::Createcxx . . $ UIWindow#Create(1559a299834bcdd5).(0, 0, Max_window_wcxx . . $ Max_window_w., Max_window_hcxx . . $ Max_window_h.);
309 mmItemcxx . . $ mmItem#::AttachInterfacecxx . . $ mmItem#AttachInterface(b617a8135d67409).(this);
310
311 #ifndef MOVIE_MENUcxx . . $ `Descent3/mmItem.h:78:9`!
312 #if defined(OEM)
313 if (!LoadLargeBitmap("oemmenu.ogf", &m_art)) {
314 Error("Unable to load main menu art oemmenu.ogf.");
315 }
316 #elif defined(DEMO)
317 if (!LoadLargeBitmap("demomenu.ogf", &m_art)) {
318 Error("Unable to load main menu art demomenu.ogf.");
319 }
320 #else
321 if (!LoadLargeBitmap("mainmenu.ogf", &m_art)) {
322 Error("Unable to load main menu art mainmenu.ogf.");
323 }
324 #endif
325 #else
326 if (cfexistcxx . . $ cfexist(293b0826c8d9cb54).("mainmenuoverride.ogf"cxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)) {
327 if (!LoadLargeBitmapcxx . . $ LoadLargeBitmap(df64d18e3909f364).("mainmenuoverride.ogf", &m_artcxx . . $ mmInterface#m_art.)) {
328 Errorcxx . . $ Error(326aeb464d16410c).("Unable to load main menu art mainmenuoverride.ogf.");
329 }
330 m_moviecxx . . $ mmInterface#m_movie. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
331 static_menu_backgroundcxx . . $ static_menu_background. = true;
332 } else {
333 char filename[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!];
334 ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(filename, Base_directorycxx . . $ Base_directory., "movies", "mainmenu", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
335 m_moviecxx . . $ mmInterface#m_movie. = StartMoviecxx . . $ StartMovie(deeedf85fc470a35).(filename, true);
336
337 if (!m_moviecxx . . $ mmInterface#m_movie.) //[ISB] Didn't find the menu movie?
338 {
339 if (!LoadLargeBitmapcxx . . $ LoadLargeBitmap(df64d18e3909f364).("mainmenu.ogf", &m_artcxx . . $ mmInterface#m_art.)) {
340 Errorcxx . . $ Error(326aeb464d16410c).("Unable to load main menu art mainmenu.ogf.");
341 } else {
342 static_menu_backgroundcxx . . $ static_menu_background. = true;
343 }
344 }
345 }
346 #endif
347
348 // load sounds and music
349 for (i = 0; i < N_MM_SOUNDScxx . . $ `Descent3/mmItem.h:90:9`!; i++) {
350 SoundHandlescxx . . $ mmInterface#SoundHandles.[i] = FindSoundNamecxx . . $ FindSoundName(5c4306d8553b3696).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(MMSoundFiles[i]));
351 }
352
353 D3MusicStartcxx . . $ D3MusicStart(85c52e162fed56f9).("mainmenu.omf");
354 SetMusicRegioncxx . . $ mmInterface#SetMusicRegion(d4f767463ce0a6b3).(MM_MUSIC_REGIONcxx . . $ `Descent3/mmItem.h:94:9`!);
355
356 SetUICallbackcxx . . $ SetUICallback(964b12a25712bdc3).(MenuScenecxx . . $ MenuScene(49f6e7a06ebc5aa8).);
357 m_nmenu_itemscxx . . $ mmInterface#m_nmenu_items. = 0;
358 }
359
360 // does user interface.
361 int mmInterfacecxx . . $ mmInterface#::DoUIcxx . . $ mmInterface#DoUI(b126dc7c1de90089).() {
362 UI_frame_resultcxx . . $ UI_frame_result. = -1;
363 ui_ShowCursorcxx . . $ ui_ShowCursor(c9857a73d68e59ba).();
364
365 SetUICallbackcxx . . $ SetUICallback(964b12a25712bdc3).(MenuScenecxx . . $ MenuScene(49f6e7a06ebc5aa8).);
366
367 while (UI_frame_resultcxx . . $ UI_frame_result. == -1) {
368 Descentcxx . . $ Descent.->defercxx . . $ oeApplication#defer(db52760e79bf9054).();
369 DoUIFramecxx . . $ DoUIFrame(49f6e7a06ebc5aa8).();
370 rend_Flipcxx . . $ rend_Flip(49f6e7a06ebc5aa8).();
371 }
372
373 ui_HideCursorcxx . . $ ui_HideCursor(c9857a73d68e59ba).();
374 ui_Flushcxx . . $ ui_Flush(49f6e7a06ebc5aa8).();
375
376 return UI_frame_resultcxx . . $ UI_frame_result.;
377 }
378
379 // add item.
380 bool mmInterfacecxx . . $ mmInterface#::AddItemcxx . . $ mmInterface#AddItem(f6af4ec68985d813).(int id, int key, const char *text, int type) {
381 if (m_nmenu_itemscxx . . $ mmInterface#m_nmenu_items. == N_MMENU_ITEMScxx . . $ `Descent3/mmItem.h:86:9`!) {
382 Int3cxx . . $ `misc/pserror.h:247:9`!(); // N_MMENU_ITEMS needs to be upped! (Samir)
383 return false;
384 }
385
386 m_menuitemscxx . . $ mmInterface#m_menuitems.[m_nmenu_itemscxx . . $ mmInterface#m_nmenu_items.].Createcxx . . $ mmItem#Create(c9e50ccfae272660).(id, key, MMITEM_Xcxx . . $ `Descent3/mmItem.h:84:9`!, MMITEM_Ycxx . . $ `Descent3/mmItem.h:85:9`! + (m_nmenu_itemscxx . . $ mmInterface#m_nmenu_items. * 20), text,
387 (type == 1) ? UIF_GROUP_STARTcxx . . $ `ui/ui.h:349:9`!
388 : (type == 2) ? UIF_GROUP_ENDcxx . . $ `ui/ui.h:350:9`!
389 : (type == 3) ? (UIF_GROUP_STARTcxx . . $ `ui/ui.h:349:9`! + UIF_GROUP_ENDcxx . . $ `ui/ui.h:350:9`!)
390 : 0);
391 m_nmenu_itemscxx . . $ mmInterface#m_nmenu_items.++;
392
393 return true;
394 }
395
396 // When interface is being nuked.
397 void mmInterfacecxx . . $ mmInterface#::OnDestroycxx . . $ mmInterface#OnDestroy(49f6e7a06ebc5aa8).() {
398 UIWindowcxx . . $ UIWindow#::OnDestroycxx . . $ UIWindow#OnDestroy(49f6e7a06ebc5aa8).();
399
400 D3MusicStopcxx . . $ D3MusicStop(49f6e7a06ebc5aa8).();
401 Sound_systemcxx . . $ Sound_system..StopAllSoundscxx . . $ hlsSystem#StopAllSounds(49f6e7a06ebc5aa8).();
402
403 if (static_menu_backgroundcxx . . $ static_menu_background.) {
404 FreeLargeBitmapcxx . . $ FreeLargeBitmap(99797d0c91a30e0c).(&m_artcxx . . $ mmInterface#m_art.);
405 } else {
406 #ifdef MOVIE_MENUcxx . . $ `Descent3/mmItem.h:78:9`!
407 if (m_moviecxx . . $ mmInterface#m_movie.) {
408 EndMoviecxx . . $ EndMovie(3a711f4329c1fcf3).(m_moviecxx . . $ mmInterface#m_movie.);
409 m_moviecxx . . $ mmInterface#m_movie. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
410 }
411 #else
412 FreeLargeBitmap(&m_art);
413 #endif
414 }
415
416 SetUICallbackcxx . . $ SetUICallback(964b12a25712bdc3).(DEFAULT_UICALLBACKcxx . . $ `Descent3/newui_core.h:125:9`!);
417 MM_objectcxx . . $ MM_object. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
418 }
419
420 // displays the copyright text
421 void mmInterfacecxx . . $ mmInterface#::CopyrightTextcxx . . $ mmInterface#CopyrightText(49f6e7a06ebc5aa8).() {
422 int i;
423 char type[16];
424 type[0] = 0;
425 #ifdef DEMO
426 strcpy(type, "Demo ");
427 #endif
428
429 if (PROGRAMcxx . . $ `Descent3/program.h:183:9`!(beta))
430 strcpy(type, "Beta ");
431
432 #ifdef OEM
433 strcat(type, "OEM ");
434 #endif
435
436 if (Program_versioncxx . . $ Program_version..version_typecxx . . $ program_version#version_type. == DEVELOPMENT_VERSIONcxx . . $ `Descent3/program.h:162:9`!) {
437 strcat(type, "Dev");
438 } else if (Program_versioncxx . . $ Program_version..version_typecxx . . $ program_version#version_type. == RELEASE_VERSIONcxx . . $ `Descent3/program.h:163:9`!) {
439 strcat(type, "Ver");
440 }
441
442 int x = Max_window_wcxx . . $ Max_window_w. - 164, y = Max_window_hcxx . . $ Max_window_h. - 29; // was -128 and -16
443
444 // attempt to print text nicely.
445 grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(BRIEFING_FONTcxx . . $ `Descent3/gamefont.h:111:9`!);
446 grtext_SetAlphacxx . . $ grtext_SetAlpha(ac50b47256ae7414).(192);
447 grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 32, 32));
448
449 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x, y, "%s %d.%d.%d %s", type, Program_versioncxx . . $ Program_version..majorcxx . . $ program_version#major.,
450 Program_versioncxx . . $ Program_version..minorcxx . . $ program_version#minor., Program_versioncxx . . $ Program_version..buildcxx . . $ program_version#build., D3_GIT_HASHcxx . . $ `build/lib/d3_version.h:27:9`!);
451 grtext_SetFlagscxx . . $ grtext_SetFlags(d4f767463ce0a6b3).(GRTEXTFLAG_SHADOWcxx . . $ `grtext/grtext.h:120:9`!);
452 grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x, y, "%s %d.%d.%d %s", type, Program_versioncxx . . $ Program_version..majorcxx . . $ program_version#major.,
453 Program_versioncxx . . $ Program_version..minorcxx . . $ program_version#minor., Program_versioncxx . . $ Program_version..buildcxx . . $ program_version#build., D3_GIT_HASHcxx . . $ `build/lib/d3_version.h:27:9`!);
454
455 grtext_Flushcxx . . $ grtext_Flush(49f6e7a06ebc5aa8).();
456 }
457
458 void mmInterfacecxx . . $ mmInterface#::SetMusicRegioncxx . . $ mmInterface#SetMusicRegion(d4f767463ce0a6b3).(int region) {
459 if (region == -1) {
460 D3MusicStopcxx . . $ D3MusicStop(49f6e7a06ebc5aa8).();
461 D3MusicStartcxx . . $ D3MusicStart(85c52e162fed56f9).("mainmenu.omf");
462 SetMusicRegioncxx . . $ mmInterface#SetMusicRegion(d4f767463ce0a6b3).(MM_MUSIC_REGIONcxx . . $ `Descent3/mmItem.h:94:9`!);
463 } else {
464 D3MusicSetRegioncxx . . $ D3MusicSetRegion(472b8ebd11b2ca81).(region, true);
465 }
466 }
467
468 // display menu scene
469 void MenuScenecxx . . $ MenuScene(49f6e7a06ebc5aa8).() {
470 extern bool NewUI_wait_dialogcxx . . $ NewUI_wait_dialog.; // is wait dialog up?
471
472 if (MM_objectcxx . . $ MM_object.) {
473 StartFramecxx . . $ StartFrame(b45ddcbc8423892c).();
474
475 if (static_menu_backgroundcxx . . $ static_menu_background.) {
476 DrawLargeBitmapcxx . . $ DrawLargeBitmap(a00f4917c93a8455).(&MM_objectcxx . . $ MM_object.->m_artcxx . . $ mmInterface#m_art., 0, 0, 1.0f);
477 } else {
478 #ifdef MOVIE_MENUcxx . . $ `Descent3/mmItem.h:78:9`!
479 FrameMoviecxx . . $ FrameMovie(3359cecd32520d88).(MM_objectcxx . . $ MM_object.->m_moviecxx . . $ mmInterface#m_movie., -1, -1, true);
480 #else
481 DrawLargeBitmap(&MM_object->m_art, 0, 0, 1.0f);
482 #endif
483 }
484
485 MM_objectcxx . . $ MM_object.->CopyrightTextcxx . . $ mmInterface#CopyrightText(49f6e7a06ebc5aa8).();
486
487 EndFramecxx . . $ EndFrame(49f6e7a06ebc5aa8).();
488 }
489 }
490
491 #define N_MENU_SOUND_SLOTScxx . . $ `Descent3/mmItem.cpp:491:9`! 4
492
493 void PlayMenuSoundcxx . . $ PlayMenuSound(918ebd27a9ddbad3).(int sound_index, bool wait_till_done) {
494 int sound_uid;
495
496 Sound_systemcxx . . $ Sound_system..BeginSoundFramecxx . . $ hlsSystem#BeginSoundFrame(b45ddcbc8423892c).(false);
497 sound_uid = Sound_systemcxx . . $ Sound_system..Play2dSoundcxx . . $ hlsSystem#Play2dSound(d251026853493025).(sound_index, 1.0f);
498 Sound_systemcxx . . $ Sound_system..EndSoundFramecxx . . $ hlsSystem#EndSoundFrame(49f6e7a06ebc5aa8).();
499
500 if (wait_till_done) {
501 float timer = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!();
502 while (Sound_systemcxx . . $ Sound_system..IsSoundPlayingcxx . . $ hlsSystem#IsSoundPlaying(83c267b20bac841a).(sound_uid) && ((timer + 5.0f) > timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!())) {
503 Sound_systemcxx . . $ Sound_system..BeginSoundFramecxx . . $ hlsSystem#BeginSoundFrame(b45ddcbc8423892c).(false);
504 Descentcxx . . $ Descent.->defercxx . . $ oeApplication#defer(db52760e79bf9054).();
505 Sound_systemcxx . . $ Sound_system..EndSoundFramecxx . . $ hlsSystem#EndSoundFrame(49f6e7a06ebc5aa8).();
506 }
507 }
508 }