Debian Codegraph @

Descent3/buddymenu.cpp

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
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/buddymenu.cpp $
21 * $Revision: 31 $
22 * $Date: 9/05/01 12:26p $
23 * $Author: Matt $
24 *
25 * Guidebot menu system.
26 *
27 * $Log: /DescentIII/main/buddymenu.cpp $
28 *
29 * 31 9/05/01 12:26p Matt
30 * Flush low-level mouse click queue before bringing up buddy, save, and
31 * load menus since these menus would otherwise get clicks that occurred
32 * before they existed.
33 *
34 * 30 4/30/99 7:49p Jason
35 * setups urgent/non urgent reliable stuff better
36 *
37 * 29 4/30/99 1:29p Samir
38 * fixed buddy menu a-z selections.
39 *
40 * 28 4/27/99 1:56p Jeff
41 * audio taunts stuff in pilot menu, added stringtables
42 *
43 * 27 4/27/99 4:41a Jeff
44 * made multiplayer friendly
45 *
46 * 26 4/24/99 5:41p Samir
47 * keys should work properly for buddy menu.
48 *
49 * 25 4/22/99 10:25p Chris
50 * Added a comment block
51 *
52 * $NoKeywords: $
53 */
54
55 #include "help.h"cxx . . $ `<file>/Descent3/help.h`/
56 #include "mono.h"cxx . . $ `<file>/ddebug/mono.h`/
57 #include "renderer.h"cxx . . $ `<file>/lib/renderer.h`/
58 #include "render.h"cxx . . $ `<file>/Descent3/render.h`/
59 #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/
60 #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/
61 #include "game.h"cxx . . $ `<file>/Descent3/game.h`/
62 #include "cfile.h"cxx . . $ `<file>/cfile/cfile.h`/
63 #include "application.h"cxx . . $ `<file>/lib/application.h`/
64 #include <stdlib.h>
65 #include <string.h>
66 #include <stdarg.h>
67 #include "newui.h"cxx . . $ `<file>/Descent3/newui.h`/
68 #include "grtext.h"cxx . . $ `<file>/grtext/grtext.h`/
69 #include "gamefont.h"cxx . . $ `<file>/Descent3/gamefont.h`/
70 #include "AIMain.h"cxx . . $ `<file>/Descent3/AIMain.h`/
71 #include "robot.h"cxx . . $ `<file>/Descent3/robot.h`/
72 #include "hud.h"cxx . . $ `<file>/Descent3/hud.h`/
73 #include "stringtable.h"cxx . . $ `<file>/Descent3/stringtable.h`/
74 #include "textaux.h"cxx . . $ `<file>/lib/textaux.h`/
75 #include "multi.h"cxx . . $ `<file>/Descent3/multi.h`/
76
77 #include "osiris_share.h"cxx . . $ `<file>/Descent3/osiris_share.h`/
78 #include "multi.h"cxx . . $ `<file>/Descent3/multi.h`/
79
80 #define GB_MENU_REQ_TEXTcxx . . $ `Descent3/buddymenu.cpp:80:9`! 1
81 #define GB_MENU_REQ_SELECTcxx . . $ `Descent3/buddymenu.cpp:81:9`! 2
82
83 #define IDH_QUITcxx . . $ `Descent3/buddymenu.cpp:83:9`! 50
84 #define WND_HELP_Wcxx . . $ `Descent3/buddymenu.cpp:84:9`! 320
85 #define WND_HELP_Hcxx . . $ `Descent3/buddymenu.cpp:85:9`! 384
86 #define WND_HELP_Xcxx . . $ `Descent3/buddymenu.cpp:86:9`! (Game_window_w - WND_HELP_W) / 2
87 #define WND_HELP_Ycxx . . $ `Descent3/buddymenu.cpp:87:9`! (Game_window_h - WND_HELP_H) / 2
88 #define BUDDYMENU_ITEM_Xcxx . . $ `Descent3/buddymenu.cpp:88:9`! 10
89 #define BUDDYMENU_ITEM_Wcxx . . $ `Descent3/buddymenu.cpp:89:9`! 226
90 #define UID_BUDDYCMDcxx . . $ `Descent3/buddymenu.cpp:90:9`! 0x100
91
92 static gb_menucxx . . $ gb_menu# Guidebot_menu_datacxx . . $ Guidebot_menu_data.;
93 static int Guidebot_data_download_statuscxx . . $ Guidebot_data_download_status.;
94
95 // downloads data for the buddybot
96 // on return: if 1, process data
97 // if 0, abort
98 // if -1, no guidebot
99 static int BuddyBotDownloadDatacxx . . $ BuddyBotDownloadData(b126dc7c1de90089).(void);
100 static void BuddyProcessCommandcxx . . $ BuddyProcessCommand(d4f767463ce0a6b3).(int res);
101
102 void BuddyDisplaycxx . . $ BuddyDisplay(49f6e7a06ebc5aa8).(void) {
103 newuiTiledWindowcxx . . $ newuiTiledWindow# gbcommand_wndcxx . . $ newuiTiledWindow#newuiTiledWindow(49f6e7a06ebc5aa8).;
104 newuiSheetcxx . . $ newuiSheet# *sheet;
105 bool exit_menu = false;
106 int strs_to_print, index, height;
107
108 if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`! && (!(Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. & NF_ALLOWGUIDEBOTcxx . . $ `Descent3/multi_external.h:232:9`!))) {
109 // only in single player games, and multiplayer games that allow guidebot
110 return;
111 }
112
113 strs_to_print = 0;
114
115 if (BuddyBotDownloadDatacxx . . $ BuddyBotDownloadData(b126dc7c1de90089).() != 1)
116 return;
117
118 gbcommand_wnd.Createcxx . . $ newuiTiledWindow#Create(9860cac3d762132).(Guidebot_menu_datacxx . . $ Guidebot_menu_data..titlecxx . . $ gb_menu#title., 0, 0, WND_HELP_Wcxx . . $ `Descent3/buddymenu.cpp:84:9`!, WND_HELP_Hcxx . . $ `Descent3/buddymenu.cpp:85:9`!);
119 sheet = gbcommand_wnd.GetSheetcxx . . $ newuiTiledWindow#GetSheet(661381a276e5b628).();
120
121 // add commands
122 sheet->NewGroupcxx . . $ newuiSheet#NewGroup(465b27e37ce794b1).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 10, 10);
123 gbcommand_wnd.AddAcceleratorKeycxx . . $ UIWindow#AddAcceleratorKey(3e454b8ccf442868).(KEY_F4cxx . . $ `ddio/ddio_common.h:285:9`!, UID_CANCELcxx . . $ `ui/ui.h:369:9`!);
124
125 for (index = 0; index < Guidebot_menu_datacxx . . $ Guidebot_menu_data..num_commandscxx . . $ gb_menu#num_commands.; index++) {
126 char buf[256 + 32], buf2[256 + 32];
127 if (index < 9) {
128 snprintf(buf, sizeof(buf), "%d. %s", index + 1, Guidebot_menu_datacxx . . $ Guidebot_menu_data..command_textcxx . . $ gb_menu#command_text.[index]);
129 } else {
130 snprintf(buf, sizeof(buf), "%c. %s", 'A' + (index - 9), Guidebot_menu_datacxx . . $ Guidebot_menu_data..command_textcxx . . $ gb_menu#command_text.[index]);
131 }
132
133 textaux_WordWrapcxx . . $ textaux_WordWrap(2480230cce71d9d7).(buf, buf2, BUDDYMENU_ITEM_Wcxx . . $ `Descent3/buddymenu.cpp:89:9`!, MONITOR9_NEWUI_FONTcxx . . $ `Descent3/gamefont.h:115:9`!);
134 grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(MONITOR9_NEWUI_FONTcxx . . $ `Descent3/gamefont.h:115:9`!);
135 height = grtext_GetTextHeightcxx . . $ grtext_GetTextHeight(5c4306d8553b3696).(buf2);
136
137 sheet->AddHotspotcxx . . $ newuiSheet#AddHotspot(9900cc9f47e11d13).(buf, BUDDYMENU_ITEM_Wcxx . . $ `Descent3/buddymenu.cpp:89:9`!, height, index + UID_BUDDYCMDcxx . . $ `Descent3/buddymenu.cpp:90:9`!,
138 (index == 0 || index == (Guidebot_menu_datacxx . . $ Guidebot_menu_data..num_commandscxx . . $ gb_menu#num_commands. - 1)) ? true : false);
139 if (index < (N_WINDOW_ACCELScxx . . $ `ui/ui.h:1051:9`! - 1)) {
140 if (index < 9) {
141 int key = ddio_AsciiToKeycxx . . $ ddio_AsciiToKey(7864480464b09eea).('1' + index);
142 gbcommand_wnd.AddAcceleratorKeycxx . . $ UIWindow#AddAcceleratorKey(3e454b8ccf442868).(key, index + UID_BUDDYCMDcxx . . $ `Descent3/buddymenu.cpp:90:9`!);
143 } else {
144 int key = ddio_AsciiToKeycxx . . $ ddio_AsciiToKey(7864480464b09eea).('a' + (index - 9));
145 gbcommand_wnd.AddAcceleratorKeycxx . . $ UIWindow#AddAcceleratorKey(3e454b8ccf442868).(key, index + UID_BUDDYCMDcxx . . $ `Descent3/buddymenu.cpp:90:9`!);
146 }
147 }
148 }
149
150 // Double space
151 sheet->NewGroupcxx . . $ newuiSheet#NewGroup(465b27e37ce794b1).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, WND_HELP_Wcxx . . $ `Descent3/buddymenu.cpp:84:9`! - 240, WND_HELP_Hcxx . . $ `Descent3/buddymenu.cpp:85:9`! - 96, NEWUI_ALIGN_HORIZcxx . . $ NEWUI_ALIGN_HORIZ.);
152 sheet->AddLongButtoncxx . . $ newuiSheet#AddLongButton(680bf41633375800).(TXT_PRESSESCRETcxx . . $ `Descent3/stringtable.h:79:9`!, UID_CANCELcxx . . $ `ui/ui.h:369:9`!);
153 gbcommand_wnd.AddAcceleratorKeycxx . . $ UIWindow#AddAcceleratorKey(3e454b8ccf442868).(KEY_ESCcxx . . $ `ddio/ddio_common.h:267:9`!, UID_OKcxx . . $ `ui/ui.h:368:9`!);
154
155 gbcommand_wnd.Opencxx . . $ UIWindow#Open(49f6e7a06ebc5aa8).();
156
157 // Mouse clicks from gameplay will be read by the dialog without this flush
158 ddio_MouseQueueFlushcxx . . $ ddio_MouseQueueFlush(49f6e7a06ebc5aa8).();
159
160 while (!exit_menu) {
161 int res = gbcommand_wnd.DoUIcxx . . $ newuiTiledWindow#DoUI(b126dc7c1de90089).();
162
163 // handle all UI results.
164 switch (res) {
165 case UID_OKcxx . . $ `ui/ui.h:368:9`!:
166 case UID_CANCELcxx . . $ `ui/ui.h:369:9`!:
167 // TODO: Save menu options to variables
168 exit_menu = true;
169 break;
170 case NEWUIRES_FORCEQUITcxx . . $ `Descent3/newui_core.h:131:9`!:
171 exit_menu = true;
172 break;
173 default:
174 BuddyProcessCommandcxx . . $ BuddyProcessCommand(d4f767463ce0a6b3).(res);
175 exit_menu = true;
176 break;
177 }
178 }
179
180 gbcommand_wnd.Closecxx . . $ UIWindow#Close(49f6e7a06ebc5aa8).();
181 gbcommand_wnd.Destroycxx . . $ UIWindow#Destroy(49f6e7a06ebc5aa8).();
182 }
183
184 static void MultiAskforGuidebotMenucxx . . $ MultiAskforGuidebotMenu(49f6e7a06ebc5aa8).() {
185 int size_offset;
186 int count = 0;
187 uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!];
188 // Only process this if we are the client
189 if (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. != LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!) {
190 Int3cxx . . $ `misc/pserror.h:247:9`!(); // We shouldn't be here... get Kevin
191 return;
192 }
193 size_offset = START_DATAcxx . . $ START_DATA(8c36ee1faa9e0a0b).(MP_GUIDEBOTMENU_REQUESTcxx . . $ `Descent3/multi.h:635:9`!, data, &count);
194 MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(GB_MENU_REQ_TEXTcxx . . $ `Descent3/buddymenu.cpp:80:9`!, data, &count);
195 END_DATAcxx . . $ END_DATA(dde21517a502ab05).(count, data, size_offset);
196 nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].reliable_socketcxx . . $ netplayer#reliable_socket., data, count);
197 }
198
199 static void MultiStuffGuidebotMenuDatacxx . . $ MultiStuffGuidebotMenuData(e552b9a1f52b135d).(uint8_tcxx . . $ uint8_t# *data, int *count, gb_menucxx . . $ gb_menu# *menu) {
200 int i;
201 // Get the menu data and stick it here
202 // length of the title
203 int slen = strlen(menu->titlecxx . . $ gb_menu#title.) + 1;
204 MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(slen, data, count);
205 memcpy(data + *count, menu->titlecxx . . $ gb_menu#title., slen);
206 *count += slen;
207
208 MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(menu->num_commandscxx . . $ gb_menu#num_commands., data, count);
209 for (i = 0; i < menu->num_commandscxx . . $ gb_menu#num_commands.; i++) {
210 slen = strlen(menu->command_textcxx . . $ gb_menu#command_text.[i]) + 1;
211 MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(slen, data, count);
212 memcpy(data + *count, menu->command_textcxx . . $ gb_menu#command_text.[i], slen);
213 *count += slen;
214
215 MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(menu->command_idcxx . . $ gb_menu#command_id.[i], data, count);
216
217 MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(menu->command_typecxx . . $ gb_menu#command_type.[i], data, count);
218
219 slen = strlen(menu->dialog_textcxx . . $ gb_menu#dialog_text.[i]) + 1;
220 MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(slen, data, count);
221 memcpy(data + *count, menu->dialog_textcxx . . $ gb_menu#dialog_text.[i], slen);
222 *count += slen;
223 }
224 }
225
226 // TODO -- Call this function when the client selects a menu item
227 void MultiSendGuidebotMenuSelectioncxx . . $ MultiSendGuidebotMenuSelection(42ff5bb989597209).(gb_comcxx . . $ gb_com# *command) {
228 int size_offset;
229 int count = 0;
230 uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!];
231
232 // Only process this if we are the client
233 if (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. != LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!) {
234 Int3cxx . . $ `misc/pserror.h:247:9`!(); // We shouldn't be here... get Kevin
235 return;
236 }
237
238 size_offset = START_DATAcxx . . $ START_DATA(8c36ee1faa9e0a0b).(MP_GUIDEBOTMENU_REQUESTcxx . . $ `Descent3/multi.h:635:9`!, data, &count);
239 MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(GB_MENU_REQ_SELECTcxx . . $ `Descent3/buddymenu.cpp:81:9`!, data, &count);
240
241 MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(command->actioncxx . . $ gb_com#action., data, &count);
242 MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(command->indexcxx . . $ gb_com#index., data, &count);
243
244 if (command->ptrcxx . . $ gb_com#ptr.) {
245 int len = strlen((char *)command->ptrcxx . . $ gb_com#ptr.) + 1;
246 MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(len, data, &count);
247 memcpy(data + count, command->ptrcxx . . $ gb_com#ptr., len);
248 count += len;
249 } else {
250 MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(0, data, &count);
251 }
252
253 END_DATAcxx . . $ END_DATA(dde21517a502ab05).(count, data, size_offset);
254 nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].reliable_socketcxx . . $ netplayer#reliable_socket., data, count);
255 }
256
257 static void MultiSendGuidebotMenuTextcxx . . $ MultiSendGuidebotMenuText(d620de63593a4994).(gb_menucxx . . $ gb_menu# *menu, int slot) {
258 int size_offset;
259 int count = 0;
260
261 uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!];
262 // Only process this if we are the server
263 if (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) {
264 Int3cxx . . $ `misc/pserror.h:247:9`!(); // We shouldn't be here... get Kevin
265 return;
266 }
267 size_offset = START_DATAcxx . . $ START_DATA(8c36ee1faa9e0a0b).(MP_GUIDEBOTMENU_DATAcxx . . $ `Descent3/multi.h:636:9`!, data, &count);
268
269 MultiStuffGuidebotMenuDatacxx . . $ MultiStuffGuidebotMenuData(e552b9a1f52b135d).(data, &count, menu);
270
271 END_DATAcxx . . $ END_DATA(dde21517a502ab05).(count, data, size_offset);
272 nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[slot].reliable_socketcxx . . $ netplayer#reliable_socket., data, count, false);
273 }
274
275 static void MultiReadGuidebotMenuDatacxx . . $ MultiReadGuidebotMenuData(e552b9a1f52b135d).(uint8_tcxx . . $ uint8_t# *data, int *count, gb_menucxx . . $ gb_menu# *menu) {
276
277 int i;
278 // Get the menu data and stick it here
279 // length of the title
280 int slen = MultiGetShortcxx . . $ MultiGetShort(82c3ad32bc1210f5).(data, count);
281 memcpy(menu->titlecxx . . $ gb_menu#title., data + *count, slen);
282 *count += slen;
283
284 menu->num_commandscxx . . $ gb_menu#num_commands. = MultiGetShortcxx . . $ MultiGetShort(82c3ad32bc1210f5).(data, count);
285
286 for (i = 0; i < menu->num_commandscxx . . $ gb_menu#num_commands.; i++) {
287 slen = MultiGetShortcxx . . $ MultiGetShort(82c3ad32bc1210f5).(data, count);
288 memcpy(menu->command_textcxx . . $ gb_menu#command_text.[i], data + *count, slen);
289 *count += slen;
290
291 menu->command_idcxx . . $ gb_menu#command_id.[i] = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, count);
292
293 menu->command_typecxx . . $ gb_menu#command_type.[i] = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, count);
294
295 slen = MultiGetShortcxx . . $ MultiGetShort(82c3ad32bc1210f5).(data, count);
296 memcpy(menu->dialog_textcxx . . $ gb_menu#dialog_text.[i], data + *count, slen);
297 *count += slen;
298 }
299 }
300
301 void MultiDoGuidebotMenuRequestcxx . . $ MultiDoGuidebotMenuRequest(fc0f0e1646c32816).(uint8_tcxx . . $ uint8_t# *data, int slot) {
302
303 int count = 0;
304 SKIP_HEADERcxx . . $ SKIP_HEADER(849dbebf9185c2d3).(data, &count);
305 // Only process this if we are the server
306 if (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!) {
307 Int3cxx . . $ `misc/pserror.h:247:9`!(); // We shouldn't be here... get Kevin
308 return;
309 }
310
311 int command = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count);
312
313 switch (command) {
314 case GB_MENU_REQ_TEXTcxx . . $ `Descent3/buddymenu.cpp:80:9`!: {
315 // Client wants text to put in his menu
316 // Generate a menu struct and send it off
317 objectcxx . . $ object# *b_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(Buddy_handlecxx . . $ Buddy_handle.[slot]);
318 ASSERTcxx . . $ `misc/pserror.h:246:9`!(b_obj);
319
320 gb_comcxx . . $ gb_com# command;
321 gb_menucxx . . $ gb_menu# menu;
322
323 command.actioncxx . . $ gb_com#action. = COM_GET_MENUcxx . . $ `scripts/osiris_common.h:954:9`!;
324 command.ptrcxx . . $ gb_com#ptr. = (void *)&menu;
325
326 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(b_obj, AIN_USER_DEFINEDcxx . . $ `Descent3/aistruct_external.h:301:9`!, (void *)&command);
327
328 MultiSendGuidebotMenuTextcxx . . $ MultiSendGuidebotMenuText(d620de63593a4994).(&menu, slot);
329 } break;
330 case GB_MENU_REQ_SELECTcxx . . $ `Descent3/buddymenu.cpp:81:9`!: {
331 gb_comcxx . . $ gb_com# command;
332 objectcxx . . $ object# *b_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(Buddy_handlecxx . . $ Buddy_handle.[slot]);
333 ASSERTcxx . . $ `misc/pserror.h:246:9`!(b_obj);
334
335 command.actioncxx . . $ gb_com#action. = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count);
336 command.indexcxx . . $ gb_com#index. = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count);
337
338 int len = MultiGetShortcxx . . $ MultiGetShort(82c3ad32bc1210f5).(data, &count);
339
340 if (len > 0) {
341 command.ptrcxx . . $ gb_com#ptr. = data + count;
342 count += len;
343 } else {
344 command.ptrcxx . . $ gb_com#ptr. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
345 }
346
347 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(b_obj, AIN_USER_DEFINEDcxx . . $ `Descent3/aistruct_external.h:301:9`!, (void *)&command);
348 } break;
349 default:
350 Int3cxx . . $ `misc/pserror.h:247:9`!(); // We shouldn't be here either...get Kevin
351 }
352 }
353
354 void MultiDoGuidebotMenuDatacxx . . $ MultiDoGuidebotMenuData(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) {
355 int count = 0;
356 SKIP_HEADERcxx . . $ SKIP_HEADER(849dbebf9185c2d3).(data, &count);
357 if (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. != LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!) {
358 Int3cxx . . $ `misc/pserror.h:247:9`!();
359 return;
360 }
361 // Server is telling us about the menu -- we should display it now
362 MultiReadGuidebotMenuDatacxx . . $ MultiReadGuidebotMenuData(e552b9a1f52b135d).(data, &count, &Guidebot_menu_datacxx . . $ Guidebot_menu_data.);
363
364 Guidebot_data_download_statuscxx . . $ Guidebot_data_download_status. = 1;
365 Multi_bail_ui_menucxx . . $ Multi_bail_ui_menu. = true;
•366 mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Received Guidebot data from server\n");
367 }
368
369 // downloads data for the buddybot
370 // on return: if 1, process data
371 // if 0, abort
372 // if -1, no guidebot
373 int BuddyBotDownloadDatacxx . . $ BuddyBotDownloadData(b126dc7c1de90089).(void) {
374 if ((!(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) || (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. != LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!)) {
375 // no need to download data, we already have access to it
376 // fill in Guidebot_menu_data and leave
377 objectcxx . . $ object# *b_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(Buddy_handlecxx . . $ Buddy_handle.[Player_objectcxx . . $ Player_object.->idcxx . . $ object#id.]);
378 ASSERTcxx . . $ `misc/pserror.h:246:9`!(b_obj);
379
380 gb_comcxx . . $ gb_com# command;
381 command.actioncxx . . $ gb_com#action. = COM_GET_MENUcxx . . $ `scripts/osiris_common.h:954:9`!;
382 command.ptrcxx . . $ gb_com#ptr. = (void *)&Guidebot_menu_datacxx . . $ Guidebot_menu_data.;
383
384 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(b_obj, AIN_USER_DEFINEDcxx . . $ `Descent3/aistruct_external.h:301:9`!, (void *)&command);
385
386 if (Guidebot_menu_datacxx . . $ Guidebot_menu_data..num_commandscxx . . $ gb_menu#num_commands. == 0) {
387 AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_NOGUIDEBOTcxx . . $ `Descent3/stringtable.h:78:9`!);
388 return -1;
389 }
390
391 return 1;
392 }
393
394 // we are a client in a multiplayer game, we must request from the server
395 Guidebot_data_download_statuscxx . . $ Guidebot_data_download_status. = 0; // processesing
396 MultiAskforGuidebotMenucxx . . $ MultiAskforGuidebotMenu(49f6e7a06ebc5aa8).();
397
398 // now we must 'process' until Guidebot_data_download_status no longer is 0
399 newuiTiledWindowcxx . . $ newuiTiledWindow# hwndcxx . . $ newuiTiledWindow#newuiTiledWindow(49f6e7a06ebc5aa8).;
400 newuiSheetcxx . . $ newuiSheet# *sheet;
401 hwnd.Createcxx . . $ newuiTiledWindow#Create(9860cac3d762132).(TXT_GUIDEBOTcxx . . $ `Descent3/stringtable.h:868:9`!, 0, 0, 288, 128);
402 sheet = hwnd.GetSheetcxx . . $ newuiTiledWindow#GetSheet(661381a276e5b628).();
403 sheet->NewGroupcxx . . $ newuiSheet#NewGroup(465b27e37ce794b1).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 5, 10);
404 sheet->AddTextcxx . . $ newuiSheet#AddText(326aeb464d16410c).(TXT_ACCESSGUIDEBOTcxx . . $ `Descent3/stringtable.h:869:9`!);
405 sheet->NewGroupcxx . . $ newuiSheet#NewGroup(465b27e37ce794b1).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 40, 30);
406 sheet->AddTextcxx . . $ newuiSheet#AddText(326aeb464d16410c).(TXT_ESCTOCANCELcxx . . $ `Descent3/stringtable.h:870:9`!);
407 hwnd.AddAcceleratorKeycxx . . $ UIWindow#AddAcceleratorKey(3e454b8ccf442868).(KEY_ESCcxx . . $ `ddio/ddio_common.h:267:9`!, UID_CANCELcxx . . $ `ui/ui.h:369:9`!);
408
409 hwnd.Opencxx . . $ UIWindow#Open(49f6e7a06ebc5aa8).();
410 while (Guidebot_data_download_statuscxx . . $ Guidebot_data_download_status. == 0) {
411 int res = hwnd.DoUIcxx . . $ newuiTiledWindow#DoUI(b126dc7c1de90089).();
412
413 switch (res) {
414 case UID_OKcxx . . $ `ui/ui.h:368:9`!:
415 case UID_CANCELcxx . . $ `ui/ui.h:369:9`!:
416 case NEWUIRES_FORCEQUITcxx . . $ `Descent3/newui_core.h:131:9`!:
417 if (Guidebot_data_download_statuscxx . . $ Guidebot_data_download_status. == 1) {
•418 // we received data
419 Multi_bail_ui_menucxx . . $ Multi_bail_ui_menu. = false;
420 } else {
421 Guidebot_data_download_statuscxx . . $ Guidebot_data_download_status. = -1;
422 }
423 break;
424 default:
425 break;
426 }
427 }
428 hwnd.Closecxx . . $ UIWindow#Close(49f6e7a06ebc5aa8).();
429 hwnd.Destroycxx . . $ UIWindow#Destroy(49f6e7a06ebc5aa8).();
430
431 if (Guidebot_data_download_statuscxx . . $ Guidebot_data_download_status. == 1) {
432 if (Guidebot_menu_datacxx . . $ Guidebot_menu_data..num_commandscxx . . $ gb_menu#num_commands. == 0) {
433 AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_NOGUIDEBOTcxx . . $ `Descent3/stringtable.h:78:9`!);
434 return -1;
435 }
436 return 1;
437 }
438 return 0;
439 }
440
441 void BuddyProcessCommandcxx . . $ BuddyProcessCommand(d4f767463ce0a6b3).(int res) {
442 gb_comcxx . . $ gb_com# command;
443 char answer[8];
444
445 int index = res - UID_BUDDYCMDcxx . . $ `Descent3/buddymenu.cpp:90:9`!;
446
447 command.actioncxx . . $ gb_com#action. = COM_DO_ACTIONcxx . . $ `scripts/osiris_common.h:955:9`!;
448 command.indexcxx . . $ gb_com#index. = Guidebot_menu_datacxx . . $ Guidebot_menu_data..command_idcxx . . $ gb_menu#command_id.[index];
449 if (Guidebot_menu_datacxx . . $ Guidebot_menu_data..command_typecxx . . $ gb_menu#command_type.[index] == GBCT_STRING_DIALOGcxx . . $ `scripts/osiris_common.h:952:9`!) {
450 answer[0] = '\0';
451
452 DoEditDialogcxx . . $ DoEditDialog(79e5ffcc21f8a1c7).(Guidebot_menu_datacxx . . $ Guidebot_menu_data..dialog_textcxx . . $ gb_menu#dialog_text.[index], answer, sizeof(answer) - 1);
453 command.ptrcxx . . $ gb_com#ptr. = (void *)answer;
454 } else {
455 command.ptrcxx . . $ gb_com#ptr. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
456 }
457
458 if ((!(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) || (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. != LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!)) {
459 objectcxx . . $ object# *b_obj = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(Buddy_handlecxx . . $ Buddy_handle.[Player_objectcxx . . $ Player_object.->idcxx . . $ object#id.]);
460 ASSERTcxx . . $ `misc/pserror.h:246:9`!(b_obj);
461
462 AINotifycxx . . $ AINotify(f32b5964aaa42c22).(b_obj, AIN_USER_DEFINEDcxx . . $ `Descent3/aistruct_external.h:301:9`!, (void *)&command);
463 } else {
464 MultiSendGuidebotMenuSelectioncxx . . $ MultiSendGuidebotMenuSelection(42ff5bb989597209).(&command);
465 }
466 }