Debian Codegraph @

netgames/monsterball/monsterball.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/monsterball/monsterball.cpp $
21 * $Revision: 1.1.1.1 $
22 * $Date: 2003/08/26 03:58:29 $
23 * $Author: kevinb $
24 *
25 * Monmsterball Multiplayer game
26 *
27 * $Log: monsterball.cpp,v $
28 * Revision 1.1.1.1 2003/08/26 03:58:29 kevinb
29 * initial 1.5 import
30 *
31 *
32 * 43 9/24/01 3:17p Matt
33 * Only show results for two teams, since there are always only two teams.
34 *
35 * 42 9/24/01 2:28p Matt
36 * Allowed room for longer team name on results screen.
37 *
38 * 41 9/13/01 5:30p Matt
39 * Added a team member list to the stats display.
40 *
41 * 40 10/21/99 2:46p Kevin
42 * Macintosh merge!
43 *
44 * 39 8/17/99 5:53p Jeff
45 * track ranks on PXO
46 *
47 * 38 7/15/99 1:18a Jeff
48 * fixed up $scores
49 *
50 * 37 7/12/99 2:27p Jeff
51 * fixed PLR to only display the team label for the disconnected list if
52 * there are people in the list
53 *
54 * 36 7/11/99 6:55p Jeff
55 * fixed PLR so it doesn't go off the screen on long lists and active
56 * players in the game are shown first
57 *
58 * 35 5/23/99 3:04a Jason
59 * fixed bug with player rankings not being updated correctly
60 *
61 * 34 5/13/99 5:08p Ardussi
62 * changes for compiling on the Mac
63 *
64 * 33 5/12/99 11:04p Jeff
65 * dmfc and multiplayer games now have endian friendly packets (*whew*)
66 *
67 * 32 5/12/99 11:29a Jeff
68 * changed for loop variable for sanity...
69 *
70 * 31 5/09/99 6:20a Jeff
71 * improved Entropy (added sounds, max virii per room). Fixed rendering
72 * bugs for other multiplayer dlls.
73 *
74 * 30 5/08/99 3:54p Jeff
75 * fixed Post level results screen. Fixed welcome messages. Fixed save
76 * stats to file generation
77 *
78 * 29 5/08/99 5:07a Jeff
79 * a little touch ups on PLR (needs work)
80 *
81 * 28 5/07/99 1:45p Jeff
82 * don't count dedicated server in team size count
83 *
84 * 27 4/30/99 7:37p Jeff
85 * cool effects when you score
86 *
87 * 26 4/28/99 4:24a Jeff
88 * added safety checks to prevent crashes
89 *
90 * 25 4/27/99 3:44p Jeff
91 * fixed requirement keywords
92 *
93 * 24 4/23/99 6:15p Jeff
94 * fixed double calls to GameClose
95 *
96 * 23 4/23/99 12:43p Jeff
97 * forgot to call CloseGame
98 *
99 * 22 4/22/99 7:15p Jeff
100 * changed requirement strings
101 *
102 * 21 4/21/99 5:34p Jeff
103 * added requirements
104 *
105 * 20 4/19/99 6:23p Jeff
106 * Linux compile
107 *
108 * 19 3/31/99 5:49p Jeff
109 * fixed bug of displaying icon accidently
110 *
111 * 18 3/27/99 4:53p Jeff
112 * player rankings in multiplayer games implemented. Fixed join message
113 * so it doesn't get cut off
114 *
115 * 17 3/19/99 5:42p Jeff
116 * high res font fixups
117 *
118 * 16 3/19/99 12:54p Jeff
119 * base support for requesting the number of teams for a multiplayer game
120 *
121 * 15 3/17/99 12:23p Jeff
122 * converted DMFC to be COM interface
123 *
124 * 14 2/11/99 6:09p Jeff
125 * localized
126 *
127 * 13 2/11/99 12:49a Jeff
128 * changed names of exported variables
129 *
130 * 12 2/10/99 1:48p Matt
131 * Changed object handle symbolic constants
132 *
133 * 11 2/09/99 3:32p Jeff
134 * table file parser takes quotes strings for force keywords
135 *
136 * 10 2/05/99 7:03p Jeff
137 * table file parsing macros put in
138 *
139 * 9 1/31/99 7:26p Matt
140 * Renamed a bunch of functions to have HUD capitalized
141 *
142 * 8 1/24/99 8:32p Jeff
143 * a bunch of updates to get 100% up to date, added individual scoring.
144 *
145 * 7 1/21/99 11:16p Jeff
146 * exported vecmat functions
147 *
148 * 6 1/20/99 8:05p Jeff
149 * fixed some bugs
150 *
151 * 5 1/20/99 2:28p Jeff
152 *
153 * 4 1/19/99 9:54p Jeff
154 * improvements added...very complete
155 *
156 * 3 1/19/99 5:34p Jeff
157 * updated monsterball
158 *
159 * 2 1/18/99 12:06a Jeff
160 * updated to get 90% of base functionality in
161 *
162 * $NoKeywords: $
163 */
164
165 #include <cmath>
166
167 #include "gamedll_header.h"cxx . . $ `<file>/netgames/includes/gamedll_header.h`/
168 #include "idmfc.h"cxx . . $ `<file>/netgames/includes/idmfc.h`/
169 #include "monsterball.h"cxx . . $ `<file>/netgames/monsterball/monsterball.h`/
170 #include <string.h>
171 #include "monsterstr.h"cxx . . $ `<file>/netgames/monsterball/monsterstr.h`/
172
173 #include <algorithm>
174
175 IDMFCcxx . . $ IDMFC# *DMFCBasecxx . . $ DMFCBase. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
176 static IDmfcStatscxx . . $ IDmfcStats# *dstatcxx . . $ dstat. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
177 static roomcxx . . $ room# *dRoomscxx . . $ dRooms.;
178 static objectcxx . . $ object# *dObjectscxx . . $ dObjects.;
179 static playercxx . . $ player# *dPlayerscxx . . $ dPlayers.;
180 static vis_effectcxx . . $ vis_effect# *dVisEffectscxx . . $ dVisEffects.;
181 //////////////////////////////////
182 // defines
183 #define SPID_NEWPLAYERcxx . . $ `netgames/monsterball/monsterball.cpp:183:9`! 0
184 #define SPID_HITINFOcxx . . $ `netgames/monsterball/monsterball.cpp:184:9`! 1
185
186 #define MONSTERBALL_ID_NAMEcxx . . $ `netgames/monsterball/monsterball.cpp:186:9`! "Monsterball"
187 #define MONSTERBALL_SND_SCOREcxx . . $ `netgames/monsterball/monsterball.cpp:187:9`! "Extra life"
188 #define MONSTERBALL_SND_PICKUPcxx . . $ `netgames/monsterball/monsterball.cpp:188:9`! "IGotIt"
189 #define MONSTERBALL_SND_HITcxx . . $ `netgames/monsterball/monsterball.cpp:189:9`! "Monsterball Hit"
190 #define MONSTERBALL_LOSEcxx . . $ `netgames/monsterball/monsterball.cpp:190:9`! "Drop unknown "
191 /*
192 $$TABLE_SOUND "Extra life"
193 $$TABLE_GENERIC "Monsterball"
194 $$TABLE_SOUND "IGotIt"
195 $$TABLE_SOUND "Monsterball Hit"
196 $$TABLE_SOUND "Drop unknown "
197 */
198
199 #define SCORE_DRAGINcxx . . $ `netgames/monsterball/monsterball.cpp:199:9`! 3
200 #define SCORE_HITINcxx . . $ `netgames/monsterball/monsterball.cpp:200:9`! 1
201
202 #define MAX_MONSTERBALL_VELcxx . . $ `netgames/monsterball/monsterball.cpp:202:9`! 120.0f
203
204 //////////////////////////////////
205 // Structs
206
207 struct tPlayerStatcxx . . $ tPlayerStat# {
208 int Scorecxx . . $ tPlayerStat#Score.[2];
209 int BadScorecxx . . $ tPlayerStat#BadScore.[2];
210 };
211
212 static int pack_pstatcxx . . $ pack_pstat(60b9885aab282f36).(tPlayerStatcxx . . $ tPlayerStat# *user_info, uint8_tcxx . . $ uint8_t# *data);
213 static int unpack_pstatcxx . . $ unpack_pstat(60b9885aab282f36).(tPlayerStatcxx . . $ tPlayerStat# *user_info, uint8_tcxx . . $ uint8_t# *data);
214
215 int pack_pstatcxx . . $ pack_pstat(60b9885aab282f36).(tPlayerStatcxx . . $ tPlayerStat# *user_info, uint8_tcxx . . $ uint8_t# *data) {
216 int count = 0;
217 MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(user_info->Scorecxx . . $ tPlayerStat#Score.[0], data, &count);
218 MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(user_info->Scorecxx . . $ tPlayerStat#Score.[1], data, &count);
219 MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(user_info->BadScorecxx . . $ tPlayerStat#BadScore.[0], data, &count);
220 MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(user_info->BadScorecxx . . $ tPlayerStat#BadScore.[1], data, &count);
221 return count;
222 }
223
224 int unpack_pstatcxx . . $ unpack_pstat(60b9885aab282f36).(tPlayerStatcxx . . $ tPlayerStat# *user_info, uint8_tcxx . . $ uint8_t# *data) {
225 int count = 0;
226 user_info->Scorecxx . . $ tPlayerStat#Score.[0] = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count);
227 user_info->Scorecxx . . $ tPlayerStat#Score.[1] = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count);
228 user_info->BadScorecxx . . $ tPlayerStat#BadScore.[0] = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count);
229 user_info->BadScorecxx . . $ tPlayerStat#BadScore.[1] = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count);
230 return count;
231 }
232
233 struct weapon_collide_infocxx . . $ weapon_collide_info# {
234 vectorcxx . . $ vector# rotvelcxx . . $ weapon_collide_info#rotvel.;
235 vectorcxx . . $ vector# velocitycxx . . $ weapon_collide_info#velocity.;
236 vectorcxx . . $ vector# poscxx . . $ weapon_collide_info#pos.;
237 matrixcxx . . $ matrix# orientcxx . . $ weapon_collide_info#orient.;
238 float masscxx . . $ weapon_collide_info#mass.;
239 float sizecxx . . $ weapon_collide_info#size.;
240 };
241
242 structcxx . . $ $anonymous_type_fbc4dbe14b124390_0# {
243 int idcxx . . $ $anonymous_type_fbc4dbe14b124390_0#id., roomcxx . . $ $anonymous_type_fbc4dbe14b124390_0#room.;
244 int objhandlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#objhandle.;
245 int owner_handlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#owner_handle.;
246 int iconcxx . . $ $anonymous_type_fbc4dbe14b124390_0#icon.;
247 vectorcxx . . $ vector# poscxx . . $ $anonymous_type_fbc4dbe14b124390_0#pos.;
248 } Monsterball_infocxx . . $ Monsterball_info.;
249
250 //////////////////////////////////
251 // Globals
252
253 static int SortedPLRPlayerscxx . . $ SortedPLRPlayers.[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!][MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!];
254 static int TeamScorescxx . . $ TeamScores.[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!];
255 static int SortedTeamscxx . . $ SortedTeams.[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!];
256 static int SortedPlayerscxx . . $ SortedPlayers.[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!];
257
258 static int NumOfTeamscxx . . $ NumOfTeams. = 2;
259 static int WhoJustScoredcxx . . $ WhoJustScored. = -1, WhoJustScoredTimercxx . . $ WhoJustScoredTimer. = -1;
260 static int GoalRoomscxx . . $ GoalRooms.[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!];
261 static int Highlight_bmpcxx . . $ Highlight_bmp.;
262 static int LastHitPnumcxx . . $ LastHitPnum. = -1;
263
264 static bool players_sortedcxx . . $ players_sorted. = false; // the Sorted*[] have been sorted
265 static bool DisplayPowerBBlinkcxx . . $ DisplayPowerBBlink. = true;
266 static bool DisplayScoreBlinkcxx . . $ DisplayScoreBlink. = true;
267 static bool DisplayScoreScreencxx . . $ DisplayScoreScreen. = false;
268 static bool display_my_welcomecxx . . $ display_my_welcome. = false;
269 static bool monsterball_info_setcxx . . $ monsterball_info_set. = false;
270
271 ///////////////////////////////////////////////
272 // localization info
273 static char **StringTablecxx . . $ StringTable.;
274 static int StringTableSizecxx . . $ StringTableSize. = 0;
275 static const char *_ErrorStringcxx . . $ _ErrorString. = "Missing String";
276 const char *GetStringFromTablecxx . . $ GetStringFromTable(f7ae7e56280f18ae).(int d) {
277 if ((d < 0) || (d >= StringTableSizecxx . . $ StringTableSize.))
278 return _ErrorStringcxx . . $ _ErrorString.;
279 else
280 return StringTablecxx . . $ StringTable.[d];
281 }
282 ///////////////////////////////////////////////
283
284 //////////////////////////////////
285 // Prototypes
286 static void DisplayHUDScorescxx . . $ DisplayHUDScores(c7a20e4e05358911).(struct tHUDItemcxx . . $ tHUDItem# *hitem);
287 static void DisplayStatscxx . . $ DisplayStats(49f6e7a06ebc5aa8).(void);
288 static void GetGameStartPacketcxx . . $ GetGameStartPacket(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data);
289 static void SendGameStartPacketcxx . . $ SendGameStartPacket(d4f767463ce0a6b3).(int pnum);
290 static bool GetMonsterballInfocxx . . $ GetMonsterballInfo(83c267b20bac841a).(int id);
291 static void SortTeamscxx . . $ SortTeams(49f6e7a06ebc5aa8).(void);
292 static void DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(int player_num);
293 static void OnTimerScorecxx . . $ OnTimerScore(49f6e7a06ebc5aa8).(void);
294 static void OnTimercxx . . $ OnTimer(49f6e7a06ebc5aa8).(void);
295 static void OnTimerScoreKillcxx . . $ OnTimerScoreKill(49f6e7a06ebc5aa8).(void);
296 static void OnTimerKillcxx . . $ OnTimerKill(49f6e7a06ebc5aa8).(void);
297 static void OnTimerRegencxx . . $ OnTimerRegen(49f6e7a06ebc5aa8).(void);
298 static void OnTimerRegenKillcxx . . $ OnTimerRegenKill(49f6e7a06ebc5aa8).(void);
299 static void SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(char *filename);
300 static void SortPlayerSlotscxx . . $ SortPlayerSlots(621ccea12ecf5b06).(int *sorted_list, int count);
301 static void SendLastHitInfocxx . . $ SendLastHitInfo(49f6e7a06ebc5aa8).(void);
302 static void GetLastHitInfocxx . . $ GetLastHitInfo(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data);
303
304 static void HandlePickupPowerballcxx . . $ HandlePickupPowerball(419c470199a90a97).(objectcxx . . $ object# *owner);
305 static void HandleLosePowerballcxx . . $ HandleLosePowerball(b45ddcbc8423892c).(bool play_sound);
306 static void HandleMonsterballCollideWithObjectcxx . . $ HandleMonsterballCollideWithObject(584c77d2760d8df8).(objectcxx . . $ object# *ball, objectcxx . . $ object# *player, vectorcxx . . $ vector# *point, vectorcxx . . $ vector# *normal);
307 static void HandleMonsterballCollideWithWeaponcxx . . $ HandleMonsterballCollideWithWeapon(11f88944088ca047).(objectcxx . . $ object# *ball, weapon_collide_infocxx . . $ weapon_collide_info# *winfo, vectorcxx . . $ vector# *point, vectorcxx . . $ vector# *normal);
308 static void bump_objectcxx . . $ bump_object(7e4af21ed1fe297c).(objectcxx . . $ object# *object0, vectorcxx . . $ vector# *rotvel, vectorcxx . . $ vector# *velocity, vectorcxx . . $ vector# *pos, matrixcxx . . $ matrix# *orient, float mass,
309 float size, vectorcxx . . $ vector# *collision_point, vectorcxx . . $ vector# *collision_normal, float rot_scale,
310 float vel_scale);
311 static void DoMonsterballScoreEffectcxx . . $ DoMonsterballScoreEffect(49f6e7a06ebc5aa8).(void);
312 static void OnClientPlayerEntersGamecxx . . $ OnClientPlayerEntersGame(d4f767463ce0a6b3).(int player_num);
313
314 static bool ValidateOwnercxx . . $ ValidateOwner(719e024848da80a4).(int *pnum, objectcxx . . $ object# **obj);
315
316 void DetermineScorecxx . . $ DetermineScore(74c02bb7c84e7fae).(int precord_num, int column_num, char *buffer, int buffer_size) {
317 player_recordcxx . . $ player_record# *pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(precord_num);
318 if (!pr || pr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.) {
319 buffer[0] = '\0';
320 return;
321 }
322
323 tPlayerStatcxx . . $ tPlayerStat# *stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.;
324
325 if (column_num == 2) {
326 snprintf(buffer, buffer_size, "%d", (stat) ? stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0);
327 } else {
328 snprintf(buffer, buffer_size, "%d", (stat) ? stat->BadScorecxx . . $ tPlayerStat#BadScore.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0);
329 }
330 }
331
332 void TeamScoreCallbackcxx . . $ TeamScoreCallback(99469d7ff9a1485a).(int team, char *buffer, int buffer_size) {
333 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(team >= 0 && team < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!);
334
335 snprintf(buffer, buffer_size, " %d", TeamScorescxx . . $ TeamScores.[team]);
336 }
337
338 void ShowStatBitmapcxx . . $ ShowStatBitmap(dac02d3a3b31dff4).(int precord_num, int column_num, int x, int y, int w, int h, uint8_tcxx . . $ uint8_t# alpha_to_use) {
339 player_recordcxx . . $ player_record# *pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(precord_num);
340
341 if (!pr || pr->statecxx . . $ player_record#state. != STATE_INGAMEcxx . . $ STATE_INGAME.)
342 return;
343
344 int pnum;
345 objectcxx . . $ object# *owner;
346
347 if (!ValidateOwnercxx . . $ ValidateOwner(719e024848da80a4).(&pnum, &owner))
348 return;
349
350 // the owner is still valid
351 if (pnum == pr->pnumcxx . . $ player_record#pnum.) {
352 DLLRenderHUDQuad(x + 2, y, 10, 10, 0, 0, 1, 1, Monsterball_infocxx . . $ Monsterball_info..iconcxx . . $ $anonymous_type_fbc4dbe14b124390_0#icon., alpha_to_use, 0);
353 }
354 }
355
356 #define NUM_TEAMScxx . . $ `netgames/monsterball/monsterball.cpp:356:9`! 2
357
358 // This function gets called by the game when it wants to learn some info about the game
359 void DLLFUNCCALLcxx . . $ `lib/module.h:93:10`! DLLGetGameInfocxx . . $ DLLGetGameInfo(e5c6dce1fbda187a).(tDLLOptionscxx . . $ tDLLOptions# *options) {
360 options->flagscxx . . $ tDLLOptions#flags. = DOF_MAXTEAMScxx . . $ `netgames/includes/gamedll_header.h:105:9`! | DOF_MINTEAMScxx . . $ `netgames/includes/gamedll_header.h:106:9`!;
361 options->max_teamscxx . . $ tDLLOptions#max_teams. = NUM_TEAMScxx . . $ `netgames/monsterball/monsterball.cpp:356:9`!;
362 options->min_teamscxx . . $ tDLLOptions#min_teams. = NUM_TEAMScxx . . $ `netgames/monsterball/monsterball.cpp:356:9`!;
363 strcpy(options->game_namecxx . . $ tDLLOptions#game_name., TXT_GAMENAMEcxx . . $ `netgames/monsterball/monsterstr.h:31:9`!);
364 strcpy(options->requirementscxx . . $ tDLLOptions#requirements., "MINGOALS2,GOALPERTEAM,SPEC1");
365 }
366
367 // Initializes the game function pointers
368 void DLLFUNCCALLcxx . . $ `lib/module.h:93:10`! DLLGameInitcxx . . $ DLLGameInit(937c1f75cb8fa6b1).(int *api_func, uint8_tcxx . . $ uint8_t# *all_ok, int num_teams_to_use) {
369 *all_ok = 1;
370 DMFCBasecxx . . $ DMFCBase. = CreateDMFC();
371 if (!DMFCBasecxx . . $ DMFCBase.) {
372 *all_ok = 0;
373 return;
374 }
375
376 dstatcxx . . $ dstat. = CreateDmfcStats();
377 if (!dstatcxx . . $ dstat.) {
378 *all_ok = 0;
379 return;
380 }
381
382 DMFCBasecxx . . $ DMFCBase.->LoadFunctionscxx . . $ IDMFC#LoadFunctions(11b0e290e57a7e53).(api_func);
383
384 // Setup event handlers
385 DMFCBasecxx . . $ DMFCBase.->Set_OnCanChangeTeamcxx . . $ IDMFC#Set_OnCanChangeTeam(6e1a2bea835f83b9).(OnCanChangeTeamcxx . . $ OnCanChangeTeam(cf9ef193275fa6d8).);
386 DMFCBasecxx . . $ DMFCBase.->Set_OnClientPlayerDisconnectcxx . . $ IDMFC#Set_OnClientPlayerDisconnect(94eb4457dc8d4d10).(OnClientPlayerDisconnectcxx . . $ OnClientPlayerDisconnect(d4f767463ce0a6b3).);
387 DMFCBasecxx . . $ DMFCBase.->Set_OnPlayerEntersObservercxx . . $ IDMFC#Set_OnPlayerEntersObserver(44e0dd9f073bbf0e).(OnPlayerEntersObservercxx . . $ OnPlayerEntersObserver(14473714f2cc5bd2).);
388 DMFCBasecxx . . $ DMFCBase.->Set_OnClientPlayerKilledcxx . . $ IDMFC#Set_OnClientPlayerKilled(7da43329b4117518).(OnClientPlayerKilledcxx . . $ OnClientPlayerKilled(766a1b7183ffa4b4).);
389 DMFCBasecxx . . $ DMFCBase.->Set_OnServerObjectShieldsChangedcxx . . $ IDMFC#Set_OnServerObjectShieldsChanged(b4782650c5a9a534).(OnServerObjectShieldsChangedcxx . . $ OnServerObjectShieldsChanged(4ebbd0c3cbf1b78a).);
390 DMFCBasecxx . . $ DMFCBase.->Set_OnGameStateRequestcxx . . $ IDMFC#Set_OnGameStateRequest(94eb4457dc8d4d10).(OnGameStateRequestcxx . . $ OnGameStateRequest(d4f767463ce0a6b3).);
391 DMFCBasecxx . . $ DMFCBase.->Set_OnServerGameCreatedcxx . . $ IDMFC#Set_OnServerGameCreated(964b12a25712bdc3).(OnServerGameCreatedcxx . . $ OnServerGameCreated(49f6e7a06ebc5aa8).);
392 DMFCBasecxx . . $ DMFCBase.->Set_OnClientLevelStartcxx . . $ IDMFC#Set_OnClientLevelStart(964b12a25712bdc3).(OnClientLevelStartcxx . . $ OnClientLevelStart(49f6e7a06ebc5aa8).);
393 DMFCBasecxx . . $ DMFCBase.->Set_OnPlayerConnectcxx . . $ IDMFC#Set_OnPlayerConnect(94eb4457dc8d4d10).(OnPlayerConnectcxx . . $ OnPlayerConnect(d4f767463ce0a6b3).);
394 DMFCBasecxx . . $ DMFCBase.->Set_OnIntervalcxx . . $ IDMFC#Set_OnInterval(964b12a25712bdc3).(OnIntervalcxx . . $ OnInterval(49f6e7a06ebc5aa8).);
395 DMFCBasecxx . . $ DMFCBase.->Set_OnHUDIntervalcxx . . $ IDMFC#Set_OnHUDInterval(964b12a25712bdc3).(OnHUDIntervalcxx . . $ OnHUDInterval(49f6e7a06ebc5aa8).);
396 DMFCBasecxx . . $ DMFCBase.->Set_OnKeypresscxx . . $ IDMFC#Set_OnKeypress(94eb4457dc8d4d10).(OnKeypresscxx . . $ OnKeypress(d4f767463ce0a6b3).);
397 DMFCBasecxx . . $ DMFCBase.->Set_OnServerCollidecxx . . $ IDMFC#Set_OnServerCollide(e28f4bc3414414f0).(OnServerCollidecxx . . $ OnServerCollide(584c77d2760d8df8).);
398 DMFCBasecxx . . $ DMFCBase.->Set_OnClientCollidecxx . . $ IDMFC#Set_OnClientCollide(e28f4bc3414414f0).(OnClientCollidecxx . . $ OnClientCollide(584c77d2760d8df8).);
399 DMFCBasecxx . . $ DMFCBase.->Set_OnServerPlayerChangeSegmentcxx . . $ IDMFC#Set_OnServerPlayerChangeSegment(d20c6d03e4c9e417).(OnServerPlayerChangeSegmentcxx . . $ OnServerPlayerChangeSegment(b1146eedae1e1d0b).);
400 DMFCBasecxx . . $ DMFCBase.->Set_OnClientPlayerChangeSegmentcxx . . $ IDMFC#Set_OnClientPlayerChangeSegment(d20c6d03e4c9e417).(OnClientPlayerChangeSegmentcxx . . $ OnClientPlayerChangeSegment(b1146eedae1e1d0b).);
401 DMFCBasecxx . . $ DMFCBase.->Set_OnServerObjectChangeSegmentcxx . . $ IDMFC#Set_OnServerObjectChangeSegment(5769ea49e0370569).(OnServerObjectChangeSegmentcxx . . $ OnServerObjectChangeSegment(a7790401ac9fc765).);
402 DMFCBasecxx . . $ DMFCBase.->Set_OnClientObjectChangeSegmentcxx . . $ IDMFC#Set_OnClientObjectChangeSegment(5769ea49e0370569).(OnClientObjectChangeSegmentcxx . . $ OnClientObjectChangeSegment(a7790401ac9fc765).);
403 DMFCBasecxx . . $ DMFCBase.->Set_OnSaveStatsToFilecxx . . $ IDMFC#Set_OnSaveStatsToFile(964b12a25712bdc3).(OnSaveStatsToFilecxx . . $ OnSaveStatsToFile(49f6e7a06ebc5aa8).);
404 DMFCBasecxx . . $ DMFCBase.->Set_OnLevelEndSaveStatsToFilecxx . . $ IDMFC#Set_OnLevelEndSaveStatsToFile(964b12a25712bdc3).(OnLevelEndSaveStatsToFilecxx . . $ OnLevelEndSaveStatsToFile(49f6e7a06ebc5aa8).);
405 DMFCBasecxx . . $ DMFCBase.->Set_OnDisconnectSaveStatsToFilecxx . . $ IDMFC#Set_OnDisconnectSaveStatsToFile(964b12a25712bdc3).(OnDisconnectSaveStatsToFilecxx . . $ OnDisconnectSaveStatsToFile(49f6e7a06ebc5aa8).);
406 DMFCBasecxx . . $ DMFCBase.->Set_OnPLRIntervalcxx . . $ IDMFC#Set_OnPLRInterval(964b12a25712bdc3).(OnPLRIntervalcxx . . $ OnPLRInterval(49f6e7a06ebc5aa8).);
407 DMFCBasecxx . . $ DMFCBase.->Set_OnPLRInitcxx . . $ IDMFC#Set_OnPLRInit(964b12a25712bdc3).(OnPLRInitcxx . . $ OnPLRInit(49f6e7a06ebc5aa8).);
408 DMFCBasecxx . . $ DMFCBase.->Set_OnPrintScorescxx . . $ IDMFC#Set_OnPrintScores(94eb4457dc8d4d10).(OnPrintScorescxx . . $ OnPrintScores(d4f767463ce0a6b3).);
409 DMFCBasecxx . . $ DMFCBase.->Set_OnClientPlayerEntersGamecxx . . $ IDMFC#Set_OnClientPlayerEntersGame(94eb4457dc8d4d10).(OnClientPlayerEntersGamecxx . . $ OnClientPlayerEntersGame(d4f767463ce0a6b3).);
410
411 // setup arrays
412 dRoomscxx . . $ dRooms. = DMFCBasecxx . . $ DMFCBase.->GetRoomscxx . . $ IDMFC#GetRooms(80f895f1fc5a89de).();
413 dObjectscxx . . $ dObjects. = DMFCBasecxx . . $ DMFCBase.->GetObjectscxx . . $ IDMFC#GetObjects(26f25deff401d7e4).();
414 dPlayerscxx . . $ dPlayers. = DMFCBasecxx . . $ DMFCBase.->GetPlayerscxx . . $ IDMFC#GetPlayers(51ff8e716a252304).();
415 dVisEffectscxx . . $ dVisEffects. = DMFCBasecxx . . $ DMFCBase.->GetVisEffectArraycxx . . $ IDMFC#GetVisEffectArray(cbc3a0d74bd34739).();
416
417 netgame_infocxx . . $ netgame_info# *Netgame = DMFCBasecxx . . $ DMFCBase.->GetNetgameInfocxx . . $ IDMFC#GetNetgameInfo(242e78cd5130aa12).();
418 Netgame->flagscxx . . $ netgame_info#flags. |= (NF_TRACK_RANKcxx . . $ `Descent3/multi_external.h:243:9`!);
419
420 DMFCBasecxx . . $ DMFCBase.->GameInitcxx . . $ IDMFC#GameInit(d4f767463ce0a6b3).(NumOfTeamscxx . . $ NumOfTeams.);
421 DLLCreateStringTable("monster.str", &StringTablecxx . . $ StringTable., &StringTableSizecxx . . $ StringTableSize.);
422 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "%d strings loaded from string table\n", StringTableSize);
423
424 // add the death and suicide messages
425 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_KILLEDAcxx . . $ `netgames/monsterball/monsterstr.h:32:9`!, true);
426 DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDEAcxx . . $ `netgames/monsterball/monsterstr.h:33:9`!);
427
428 // setup the Playerstats struct so DMFC can handle it automatically when a new player enters the game
429 DMFCBasecxx . . $ DMFCBase.->SetupPlayerRecordcxx . . $ IDMFC#SetupPlayerRecord(7df49e8a00e47932).(sizeof(tPlayerStatcxx . . $ tPlayerStat#), (int (*)(void *, uint8_tcxx . . $ uint8_t# *))pack_pstatcxx . . $ pack_pstat(60b9885aab282f36).,
430 (int (*)(void *, uint8_tcxx . . $ uint8_t# *))unpack_pstatcxx . . $ unpack_pstat(60b9885aab282f36).);
431
432 // register special packet receivers
433 DMFCBasecxx . . $ DMFCBase.->RegisterPacketReceivercxx . . $ IDMFC#RegisterPacketReceiver(6efe5766e3bef270).(SPID_NEWPLAYERcxx . . $ `netgames/monsterball/monsterball.cpp:183:9`!, GetGameStartPacketcxx . . $ GetGameStartPacket(f25546b61a629de7).);
434 DMFCBasecxx . . $ DMFCBase.->RegisterPacketReceivercxx . . $ IDMFC#RegisterPacketReceiver(6efe5766e3bef270).(SPID_HITINFOcxx . . $ `netgames/monsterball/monsterball.cpp:184:9`!, GetLastHitInfocxx . . $ GetLastHitInfo(f25546b61a629de7).);
435
436 DMFCBasecxx . . $ DMFCBase.->SetNumberOfTeamscxx . . $ IDMFC#SetNumberOfTeams(d4f767463ce0a6b3).(NumOfTeamscxx . . $ NumOfTeams.);
437
438 DMFCBasecxx . . $ DMFCBase.->AddHUDItemCallbackcxx . . $ IDMFC#AddHUDItemCallback(97c9b33f56b4265c).(HI_TEXTcxx . . $ `netgames/includes/DMFC.h:440:9`!, DisplayHUDScorescxx . . $ DisplayHUDScores(c7a20e4e05358911).);
439
440 Monsterball_infocxx . . $ Monsterball_info..iconcxx . . $ $anonymous_type_fbc4dbe14b124390_0#icon. = DLLbm_AllocLoadFileBitmap("PowerballIcon.ogf", 0, BITMAP_FORMAT_1555cxx . . $ `lib/bitmap.h:56:9`!);
441 if (Monsterball_infocxx . . $ Monsterball_info..iconcxx . . $ $anonymous_type_fbc4dbe14b124390_0#icon. == -1)
442 Monsterball_infocxx . . $ Monsterball_info..iconcxx . . $ $anonymous_type_fbc4dbe14b124390_0#icon. = BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!;
443
444 DisplayScoreScreencxx . . $ DisplayScoreScreen. = false;
445
446 // TableFileAdd("Monsterball.Gam");
447
448 Highlight_bmpcxx . . $ Highlight_bmp. = DLLbm_AllocBitmap(32, 32, 0);
449 if (Highlight_bmpcxx . . $ Highlight_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) {
450 uint16_tcxx . . $ uint16_t# *data = DLLbm_data(Highlight_bmpcxx . . $ Highlight_bmp., 0);
451 if (!data) {
452 // bail on out of here
453 *all_ok = 0;
454 return;
455 }
456 for (int x = 0; x < 32 * 32; x++) {
457 data[x] = GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(50, 50, 50) | OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`!;
458 }
459 }
460
461 // Initialize the Stats Manager
462 // ----------------------------
463 tDmfcStatsInitcxx . . $ tDmfcStatsInit# tsi;
464 tDmfcStatsColumnInfocxx . . $ tDmfcStatsColumnInfo# pl_col[8];
465 char gname[20];
466 strcpy(gname, TXT_STATGAMENAMEcxx . . $ `netgames/monsterball/monsterstr.h:64:9`!);
467
468 tsi.flagscxx . . $ tDmfcStatsInit#flags. = DSIF_SHOW_PICcxx . . $ `netgames/includes/DMFC.h:619:9`! | DSIF_SHOW_OBSERVERICONcxx . . $ `netgames/includes/DMFC.h:627:9`! | DSIF_SEPERATE_BY_TEAMcxx . . $ `netgames/includes/DMFC.h:615:9`!;
469 tsi.cColumnCountDetailedcxx . . $ tDmfcStatsInit#cColumnCountDetailed. = 0;
470 tsi.cColumnCountPlayerListcxx . . $ tDmfcStatsInit#cColumnCountPlayerList. = 8;
471 tsi.clbDetailedColumnBMPcxx . . $ tDmfcStatsInit#clbDetailedColumnBMP. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
472 tsi.clbDetailedColumncxx . . $ tDmfcStatsInit#clbDetailedColumn. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
473 tsi.clbPlayerColumncxx . . $ tDmfcStatsInit#clbPlayerColumn. = DetermineScorecxx . . $ DetermineScore(74c02bb7c84e7fae).;
474 tsi.clbPlayerColumnBMPcxx . . $ tDmfcStatsInit#clbPlayerColumnBMP. = ShowStatBitmapcxx . . $ ShowStatBitmap(dac02d3a3b31dff4).;
475 tsi.DetailedColumnscxx . . $ tDmfcStatsInit#DetailedColumns. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
476 tsi.GameNamecxx . . $ tDmfcStatsInit#GameName. = gname;
477 tsi.MaxNumberDisplayedcxx . . $ tDmfcStatsInit#MaxNumberDisplayed. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
478 tsi.PlayerListColumnscxx . . $ tDmfcStatsInit#PlayerListColumns. = pl_col;
479 tsi.SortedPlayerRecordscxx . . $ tDmfcStatsInit#SortedPlayerRecords. = SortedPlayerscxx . . $ SortedPlayers.;
480 tsi.clTeamLinecxx . . $ tDmfcStatsInit#clTeamLine. = TeamScoreCallbackcxx . . $ TeamScoreCallback(99469d7ff9a1485a).;
481
482 pl_col[0].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.;
483 pl_col[0].titlecxx . . $ tDmfcStatsColumnInfo#title.[0] = '\0';
484 pl_col[0].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_BMPcxx . . $ DSCOL_BMP.;
485 pl_col[0].widthcxx . . $ tDmfcStatsColumnInfo#width. = 15;
486
487 pl_col[1].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.;
488 strcpy(pl_col[1].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_PILOTcxx . . $ `netgames/monsterball/monsterstr.h:34:9`!);
489 pl_col[1].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_PILOT_NAMEcxx . . $ DSCOL_PILOT_NAME.;
490 pl_col[1].widthcxx . . $ tDmfcStatsColumnInfo#width. = 110;
491
492 pl_col[2].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.;
493 strcpy(pl_col[2].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_POINTScxx . . $ `netgames/monsterball/monsterstr.h:35:9`!);
494 pl_col[2].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_CUSTOMcxx . . $ DSCOL_CUSTOM.;
495 pl_col[2].widthcxx . . $ tDmfcStatsColumnInfo#width. = 51;
496
497 pl_col[3].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.;
498 strcpy(pl_col[3].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_BLUNDERScxx . . $ `netgames/monsterball/monsterstr.h:36:9`!);
499 pl_col[3].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_CUSTOMcxx . . $ DSCOL_CUSTOM.;
500 pl_col[3].widthcxx . . $ tDmfcStatsColumnInfo#width. = 64;
501
502 pl_col[4].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.;
503 strcpy(pl_col[4].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_KILLSSHORTcxx . . $ `netgames/monsterball/monsterstr.h:37:9`!);
504 pl_col[4].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_KILLS_LEVELcxx . . $ DSCOL_KILLS_LEVEL.;
505 pl_col[4].widthcxx . . $ tDmfcStatsColumnInfo#width. = 41;
506
507 pl_col[5].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.;
508 strcpy(pl_col[5].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_DEATHSSHORTcxx . . $ `netgames/monsterball/monsterstr.h:38:9`!);
509 pl_col[5].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_DEATHS_LEVELcxx . . $ DSCOL_DEATHS_LEVEL.;
510 pl_col[5].widthcxx . . $ tDmfcStatsColumnInfo#width. = 41;
511
512 pl_col[6].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.;
513 strcpy(pl_col[6].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_SUICIDESSHORTcxx . . $ `netgames/monsterball/monsterstr.h:39:9`!);
514 pl_col[6].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_SUICIDES_LEVELcxx . . $ DSCOL_SUICIDES_LEVEL.;
515 pl_col[6].widthcxx . . $ tDmfcStatsColumnInfo#width. = 41;
516
517 pl_col[7].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.;
518 strcpy(pl_col[7].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_PINGcxx . . $ `netgames/monsterball/monsterstr.h:40:9`!);
519 pl_col[7].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_PINGcxx . . $ DSCOL_PING.;
520 pl_col[7].widthcxx . . $ tDmfcStatsColumnInfo#width. = 40;
521
522 dstatcxx . . $ dstat.->Initializecxx . . $ IDmfcStats#Initialize(645910a8ad01b658).(&tsi);
523 }
524
525 // Called when the DLL is shutdown
526 void DLLFUNCCALLcxx . . $ `lib/module.h:93:10`! DLLGameClosecxx . . $ DLLGameClose(49f6e7a06ebc5aa8).() {
527 if (Monsterball_infocxx . . $ Monsterball_info..iconcxx . . $ $anonymous_type_fbc4dbe14b124390_0#icon. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!)
528 DLLbm_FreeBitmap(Monsterball_infocxx . . $ Monsterball_info..iconcxx . . $ $anonymous_type_fbc4dbe14b124390_0#icon.);
529
530 DLLDestroyStringTable(StringTablecxx . . $ StringTable., StringTableSizecxx . . $ StringTableSize.);
531
532 if (dstatcxx . . $ dstat.) {
533 dstatcxx . . $ dstat.->DestroyPointercxx . . $ IObject#DestroyPointer(49f6e7a06ebc5aa8).();
534 dstatcxx . . $ dstat. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
535 }
536
537 if (DMFCBasecxx . . $ DMFCBase.) {
538 DMFCBasecxx . . $ DMFCBase.->GameClosecxx . . $ IDMFC#GameClose(49f6e7a06ebc5aa8).();
539 DMFCBasecxx . . $ DMFCBase.->DestroyPointercxx . . $ IObject#DestroyPointer(49f6e7a06ebc5aa8).();
540 DMFCBasecxx . . $ DMFCBase. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
541 }
542 }
543
544 bool OnCanChangeTeamcxx . . $ OnCanChangeTeam(cf9ef193275fa6d8).(int pnum, int newteam) {
545 if (!DMFCBasecxx . . $ DMFCBase.->OnCanChangeTeamcxx . . $ IDMFC#OnCanChangeTeam(cf9ef193275fa6d8).(pnum, newteam))
546 return false;
547
548 int p;
549 if (!ValidateOwnercxx . . $ ValidateOwner(719e024848da80a4).(&p, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!))
550 return true;
551
552 if (p == pnum)
553 return false;
554
555 return true;
556 }
557
558 void OnHUDIntervalcxx . . $ OnHUDInterval(49f6e7a06ebc5aa8).(void) {
559 dstatcxx . . $ dstat.->DoFramecxx . . $ IDmfcStats#DoFrame(49f6e7a06ebc5aa8).();
560 DMFCBasecxx . . $ DMFCBase.->DisplayOutrageLogocxx . . $ IDMFC#DisplayOutrageLogo(49f6e7a06ebc5aa8).();
561
562 DMFCBasecxx . . $ DMFCBase.->OnHUDIntervalcxx . . $ IDMFC#OnHUDInterval(49f6e7a06ebc5aa8).();
563 }
564
565 void OnIntervalcxx . . $ OnInterval(49f6e7a06ebc5aa8).(void) {
566 SortPlayerSlotscxx . . $ SortPlayerSlots(621ccea12ecf5b06).(SortedPlayerscxx . . $ SortedPlayers., MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!);
567 players_sortedcxx . . $ players_sorted. = true;
568 SortTeamscxx . . $ SortTeams(49f6e7a06ebc5aa8).();
569
570 if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) {
571 // make sure velocity of the ball isn't more than MAX_MONSTERBALL_VEL
572 objectcxx . . $ object# *ball;
573 if (!DLLObjGet(Monsterball_infocxx . . $ Monsterball_info..objhandlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#objhandle., &ball)) {
574 // blah!
575 FatalError("MONSTERBALL IS MISSING\n");
576 }
577
578 float mag = DLLvm_GetMagnitudeFast(&ball->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.);
579 if (mag > MAX_MONSTERBALL_VELcxx . . $ `netgames/monsterball/monsterball.cpp:202:9`!) {
580 ball->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. /=cxx . . $ `operator/=`(f132838b2cd11d6). mag;
581 ball->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. *=cxx . . $ `operator*=`(f132838b2cd11d6). MAX_MONSTERBALL_VELcxx . . $ `netgames/monsterball/monsterball.cpp:202:9`!;
582 }
583 }
584
585 DMFCBasecxx . . $ DMFCBase.->OnIntervalcxx . . $ IDMFC#OnInterval(49f6e7a06ebc5aa8).();
586 }
587
588 void OnKeypresscxx . . $ OnKeypress(d4f767463ce0a6b3).(int key) {
589 dllinfocxx . . $ dllinfo# *Data = DMFCBasecxx . . $ DMFCBase.->GetDLLInfoCallDatacxx . . $ IDMFC#GetDLLInfoCallData(4458c5bdce97a5c3).();
590 switch (key) {
591 case K_F7cxx . . $ `netgames/includes/DMFCKeyCodes.h:118:9`!:
592 DisplayScoreScreencxx . . $ DisplayScoreScreen. = !DisplayScoreScreencxx . . $ DisplayScoreScreen.;
593 DMFCBasecxx . . $ DMFCBase.->EnableOnScreenMenucxx . . $ IDMFC#EnableOnScreenMenu(b45ddcbc8423892c).(false);
594 dstatcxx . . $ dstat.->Enablecxx . . $ IDmfcStats#Enable(b45ddcbc8423892c).(DisplayScoreScreencxx . . $ DisplayScoreScreen.);
595 break;
596 case K_PAGEDOWNcxx . . $ `netgames/includes/DMFCKeyCodes.h:147:9`!:
597 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.) {
598 dstatcxx . . $ dstat.->ScrollDowncxx . . $ IDmfcStats#ScrollDown(49f6e7a06ebc5aa8).();
599 Data->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1;
600 }
601 break;
602 case K_PAGEUPcxx . . $ `netgames/includes/DMFCKeyCodes.h:144:9`!:
603 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.) {
604 dstatcxx . . $ dstat.->ScrollUpcxx . . $ IDmfcStats#ScrollUp(49f6e7a06ebc5aa8).();
605 Data->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1;
606 }
607 break;
608 case K_F6cxx . . $ `netgames/includes/DMFCKeyCodes.h:117:9`!:
609 DisplayScoreScreencxx . . $ DisplayScoreScreen. = false;
610 dstatcxx . . $ dstat.->Enablecxx . . $ IDmfcStats#Enable(b45ddcbc8423892c).(false);
611 break;
612 case K_ESCcxx . . $ `netgames/includes/DMFCKeyCodes.h:97:9`!:
613 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.) {
614 dstatcxx . . $ dstat.->Enablecxx . . $ IDmfcStats#Enable(b45ddcbc8423892c).(false);
615 DisplayScoreScreencxx . . $ DisplayScoreScreen. = false;
616 Data->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1;
617 }
618 break;
619 }
620
621 DMFCBasecxx . . $ DMFCBase.->OnKeypresscxx . . $ IDMFC#OnKeypress(d4f767463ce0a6b3).(key);
622 }
623
624 // The server has just started, so clear out all the stats and game info
625 void OnServerGameCreatedcxx . . $ OnServerGameCreated(49f6e7a06ebc5aa8).(void) {
626 DMFCBasecxx . . $ DMFCBase.->OnServerGameCreatedcxx . . $ IDMFC#OnServerGameCreated(49f6e7a06ebc5aa8).();
627 tPlayerStatcxx . . $ tPlayerStat# *stat;
628 player_recordcxx . . $ player_record# *pr;
629 int i;
630
631 for (i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) {
632 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(i);
633 if (!pr)
634 continue;
635
636 stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.;
637 if (stat) {
638 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] = stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!] = 0;
639 stat->BadScorecxx . . $ tPlayerStat#BadScore.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] = stat->BadScorecxx . . $ tPlayerStat#BadScore.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!] = 0;
640 }
641 }
642
643 for (i = 0; i < NumOfTeamscxx . . $ NumOfTeams.; i++) {
644 TeamScorescxx . . $ TeamScores.[i] = 0;
645 }
646 }
647
648 void OnServerCollidecxx . . $ OnServerCollide(584c77d2760d8df8).(objectcxx . . $ object# *me_obj, objectcxx . . $ object# *it_obj, vectorcxx . . $ vector# *point, vectorcxx . . $ vector# *normal) {
649 if (!me_obj || !it_obj) {
650 DMFCBasecxx . . $ DMFCBase.->OnServerCollidecxx . . $ IDMFC#OnServerCollide(584c77d2760d8df8).(me_obj, it_obj, point, normal);
651 return;
652 }
653
654 // check to see if the collision was with the Monsterball
655 if (me_obj->handlecxx . . $ object#handle. == Monsterball_infocxx . . $ Monsterball_info..objhandlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#objhandle.) {
656
657 LastHitPnumcxx . . $ LastHitPnum. = -1;
658
659 switch (it_obj->typecxx . . $ object#type.) {
660 case OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!: {
661 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerAlivecxx . . $ IDMFC#IsPlayerAlive(83c267b20bac841a).(it_obj->idcxx . . $ object#id.)) {
662 LastHitPnumcxx . . $ LastHitPnum. = it_obj->idcxx . . $ object#id.;
663
664 // call the event on the client so they can do any physics sim
665 DMFCBasecxx . . $ DMFCBase.->CallClientEventcxx . . $ IDMFC#CallClientEvent(d7a7761809021567).(EVT_CLIENT_GAMECOLLIDEcxx . . $ `lib/d3events.h:95:9`!, DMFCBasecxx . . $ DMFCBase.->GetMeObjNumcxx . . $ IDMFC#GetMeObjNum(b126dc7c1de90089).(), DMFCBasecxx . . $ DMFCBase.->GetItObjNumcxx . . $ IDMFC#GetItObjNum(b126dc7c1de90089).(), -1, true);
666 DMFCBasecxx . . $ DMFCBase.->CallOnClientCollidecxx . . $ IDMFC#CallOnClientCollide(584c77d2760d8df8).(me_obj, it_obj, point, normal);
667 }
668 } break;
669 case OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!: {
670 objectcxx . . $ object# *parent;
671 DLLGetUltimateParentForObject(&parent, it_obj);
672 if (parent->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
673 LastHitPnumcxx . . $ LastHitPnum. = parent->idcxx . . $ object#id.;
674 }
675
676 weapon_collide_infocxx . . $ weapon_collide_info# winfo;
677 winfo.rotvelcxx . . $ weapon_collide_info#rotvel..xcxx . . $ vector#x. = it_obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotvelcxx . . $ physics_info#$anonymous_type_1#rotvel..xcxx . . $ vector#x.;
678 winfo.rotvelcxx . . $ weapon_collide_info#rotvel..ycxx . . $ vector#y. = it_obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotvelcxx . . $ physics_info#$anonymous_type_1#rotvel..ycxx . . $ vector#y.;
679 winfo.rotvelcxx . . $ weapon_collide_info#rotvel..zcxx . . $ vector#z. = it_obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotvelcxx . . $ physics_info#$anonymous_type_1#rotvel..zcxx . . $ vector#z.;
680 winfo.velocitycxx . . $ weapon_collide_info#velocity..xcxx . . $ vector#x. = it_obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity..xcxx . . $ vector#x.;
681 winfo.velocitycxx . . $ weapon_collide_info#velocity..ycxx . . $ vector#y. = it_obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity..ycxx . . $ vector#y.;
682 winfo.velocitycxx . . $ weapon_collide_info#velocity..zcxx . . $ vector#z. = it_obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity..zcxx . . $ vector#z.;
683 winfo.poscxx . . $ weapon_collide_info#pos..xcxx . . $ vector#x. = it_obj->poscxx . . $ object#pos..xcxx . . $ vector#x.;
684 winfo.poscxx . . $ weapon_collide_info#pos..ycxx . . $ vector#y. = it_obj->poscxx . . $ object#pos..ycxx . . $ vector#y.;
685 winfo.poscxx . . $ weapon_collide_info#pos..zcxx . . $ vector#z. = it_obj->poscxx . . $ object#pos..zcxx . . $ vector#z.;
686 winfo.orientcxx . . $ weapon_collide_info#orient..fveccxx . . $ matrix#fvec..xcxx . . $ vector#x. = it_obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec..xcxx . . $ vector#x.;
687 winfo.orientcxx . . $ weapon_collide_info#orient..fveccxx . . $ matrix#fvec..ycxx . . $ vector#y. = it_obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec..ycxx . . $ vector#y.;
688 winfo.orientcxx . . $ weapon_collide_info#orient..fveccxx . . $ matrix#fvec..zcxx . . $ vector#z. = it_obj->orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec..zcxx . . $ vector#z.;
689 winfo.orientcxx . . $ weapon_collide_info#orient..uveccxx . . $ matrix#uvec..xcxx . . $ vector#x. = it_obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec..xcxx . . $ vector#x.;
690 winfo.orientcxx . . $ weapon_collide_info#orient..uveccxx . . $ matrix#uvec..ycxx . . $ vector#y. = it_obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec..ycxx . . $ vector#y.;
691 winfo.orientcxx . . $ weapon_collide_info#orient..uveccxx . . $ matrix#uvec..zcxx . . $ vector#z. = it_obj->orientcxx . . $ object#orient..uveccxx . . $ matrix#uvec..zcxx . . $ vector#z.;
692 winfo.orientcxx . . $ weapon_collide_info#orient..rveccxx . . $ matrix#rvec..xcxx . . $ vector#x. = it_obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec..xcxx . . $ vector#x.;
693 winfo.orientcxx . . $ weapon_collide_info#orient..rveccxx . . $ matrix#rvec..ycxx . . $ vector#y. = it_obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec..ycxx . . $ vector#y.;
694 winfo.orientcxx . . $ weapon_collide_info#orient..rveccxx . . $ matrix#rvec..zcxx . . $ vector#z. = it_obj->orientcxx . . $ object#orient..rveccxx . . $ matrix#rvec..zcxx . . $ vector#z.;
695 winfo.masscxx . . $ weapon_collide_info#mass. = it_obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..masscxx . . $ physics_info#mass.;
696 winfo.sizecxx . . $ weapon_collide_info#size. = it_obj->sizecxx . . $ object#size.;
697 HandleMonsterballCollideWithWeaponcxx . . $ HandleMonsterballCollideWithWeapon(11f88944088ca047).(me_obj, &winfo, point, normal);
698 } break;
699 }
700 }
701
702 // check to see if the collision was between a player and another player, who has the powerball
703 if (me_obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && (it_obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! || it_obj->typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!)) {
704 if (it_obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && !DMFCBasecxx . . $ DMFCBase.->IsPlayerAlivecxx . . $ IDMFC#IsPlayerAlive(83c267b20bac841a).(it_obj->idcxx . . $ object#id.)) {
705 // the collided player isn't alive
706 } else {
707 int p;
708 if (ValidateOwnercxx . . $ ValidateOwner(719e024848da80a4).(&p, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) {
709 if (p == me_obj->idcxx . . $ object#id.) {
710 // the player has the powerball
711 DMFCBasecxx . . $ DMFCBase.->CallClientEventcxx . . $ IDMFC#CallClientEvent(d7a7761809021567).(EVT_CLIENT_GAMECOLLIDEcxx . . $ `lib/d3events.h:95:9`!, DMFCBasecxx . . $ DMFCBase.->GetMeObjNumcxx . . $ IDMFC#GetMeObjNum(b126dc7c1de90089).(), DMFCBasecxx . . $ DMFCBase.->GetItObjNumcxx . . $ IDMFC#GetItObjNum(b126dc7c1de90089).(), -1, true);
712 DMFCBasecxx . . $ DMFCBase.->CallOnClientCollidecxx . . $ IDMFC#CallOnClientCollide(584c77d2760d8df8).(me_obj, it_obj, point, normal);
713 }
714 }
715 }
716 }
717
718 DMFCBasecxx . . $ DMFCBase.->OnServerCollidecxx . . $ IDMFC#OnServerCollide(584c77d2760d8df8).(me_obj, it_obj, point, normal);
719 }
720
721 void OnClientPlayerDisconnectcxx . . $ OnClientPlayerDisconnect(d4f767463ce0a6b3).(int player_num) {
722 int p;
723 if (ValidateOwnercxx . . $ ValidateOwner(719e024848da80a4).(&p, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) {
724 if (p == player_num) {
725 HandleLosePowerballcxx . . $ HandleLosePowerball(b45ddcbc8423892c).(true);
726 }
727 }
728 DMFCBasecxx . . $ DMFCBase.->OnClientPlayerDisconnectcxx . . $ IDMFC#OnClientPlayerDisconnect(d4f767463ce0a6b3).(player_num);
729 }
730
731 void OnPlayerEntersObservercxx . . $ OnPlayerEntersObserver(14473714f2cc5bd2).(int pnum, objectcxx . . $ object# *piggy) {
732 int p;
733 if (ValidateOwnercxx . . $ ValidateOwner(719e024848da80a4).(&p, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) {
734 if (p == pnum) {
735 HandleLosePowerballcxx . . $ HandleLosePowerball(b45ddcbc8423892c).(true);
736 }
737 }
738
739 DMFCBasecxx . . $ DMFCBase.->OnPlayerEntersObservercxx . . $ IDMFC#OnPlayerEntersObserver(14473714f2cc5bd2).(pnum, piggy);
740 }
741
742 void OnClientPlayerKilledcxx . . $ OnClientPlayerKilled(766a1b7183ffa4b4).(objectcxx . . $ object# *killer_obj, int victim_pnum) {
743 int p;
744 if (ValidateOwnercxx . . $ ValidateOwner(719e024848da80a4).(&p, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) {
745 if (p == victim_pnum) {
746 HandleLosePowerballcxx . . $ HandleLosePowerball(b45ddcbc8423892c).(true);
747 }
748 }
749
750 DMFCBasecxx . . $ DMFCBase.->OnClientPlayerKilledcxx . . $ IDMFC#OnClientPlayerKilled(766a1b7183ffa4b4).(killer_obj, victim_pnum);
751 }
752
753 void HandleLosePowerballcxx . . $ HandleLosePowerball(b45ddcbc8423892c).(bool play_sound) {
754 static int sound = -1;
755
756 objectcxx . . $ object# *owner;
757 if (!ValidateOwnercxx . . $ ValidateOwner(719e024848da80a4).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, &owner))
758 return;
759
760 objectcxx . . $ object# *ball;
761 if (!DLLObjGet(Monsterball_infocxx . . $ Monsterball_info..objhandlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#objhandle., &ball)) {
762 // blah!
763 FatalError("MONSTERBALL IS MISSING\n");
764 }
765
766 if (play_sound) {
767 if (sound == -1)
768 sound = DLLFindSoundName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(MONSTERBALL_LOSEcxx . . $ `netgames/monsterball/monsterball.cpp:190:9`!));
769 if (sound != -1)
770 DLLPlay2dSound(sound, 1);
771 }
772
773 if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!)
774 DLLUnattachFromParent(ball);
775
776 Monsterball_infocxx . . $ Monsterball_info..owner_handlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#owner_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
777 }
778
779 void HandlePickupPowerballcxx . . $ HandlePickupPowerball(419c470199a90a97).(objectcxx . . $ object# *owner) {
780 static int sound = -1;
781
782 if (sound == -1)
783 sound = DLLFindSoundName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(MONSTERBALL_SND_PICKUPcxx . . $ `netgames/monsterball/monsterball.cpp:188:9`!));
784 if (sound != -1)
785 DLLPlay2dSound(sound, MAX_GAME_VOLUMEcxx . . $ `netgames/includes/gamedll_header.h:59:9`! / 2);
786
787 if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) {
788 // if it was a player, attach the ball to the player
789 objectcxx . . $ object# *bobj;
790 if (!DLLObjGet(Monsterball_infocxx . . $ Monsterball_info..objhandlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#objhandle., &bobj)) {
791 FatalError("Monster Ball not found\n");
792 }
793
794 bool ret = DLLAttachObject(owner, 0, bobj, 0, true);
795 if (!ret) {
796 // blah!
797 mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "COULDN'T ATTACH MONSTERBALL TO PLAYER!!!!!!\n");
798 }
799 }
800
801 Monsterball_infocxx . . $ Monsterball_info..owner_handlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#owner_handle. = owner->handlecxx . . $ object#handle.;
802 }
803
804 void OnClientCollidecxx . . $ OnClientCollide(584c77d2760d8df8).(objectcxx . . $ object# *me_obj, objectcxx . . $ object# *it_obj, vectorcxx . . $ vector# *point, vectorcxx . . $ vector# *normal) {
805 // three things can happen in here
806 // 1) The collision is between the ball (with no owner) and a player
807 // 2) The collision is between the owner and another player or weapon
808 // 3) The collision is between the ball and a robot
809
810 if (me_obj && me_obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
811 // case 2: me_obj = owner
812 // Result: The owner is to lose the monsterball
813 HandleLosePowerballcxx . . $ HandleLosePowerball(b45ddcbc8423892c).(true);
814 DMFCBasecxx . . $ DMFCBase.->OnClientCollidecxx . . $ IDMFC#OnClientCollide(584c77d2760d8df8).(me_obj, it_obj, point, normal);
815 return;
816 }
817
818 if (me_obj && me_obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!) {
819
820 if (it_obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!) {
821 // case 3: me_obj = monsterball it_obj = robot
822 if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) {
823 // do the physics on the Monsterball
824 HandleMonsterballCollideWithObjectcxx . . $ HandleMonsterballCollideWithObject(584c77d2760d8df8).(me_obj, it_obj, point, normal);
825 }
826 }
827
828 if (it_obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
829 // case 1: me_obj = monsterball it_obj = player
830 // Result: The player is to pickup the monsterball (as long as it has no owner)
831 int p = 0;
832 if (!ValidateOwnercxx . . $ ValidateOwner(719e024848da80a4).(&p, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) && p != it_obj->idcxx . . $ object#id.) {
833 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(it_obj->type == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!);
834 // HandlePickupPowerball(it_obj);
835 HandleMonsterballCollideWithObjectcxx . . $ HandleMonsterballCollideWithObject(584c77d2760d8df8).(me_obj, it_obj, point, normal);
836 }
837 }
838
839 DMFCBasecxx . . $ DMFCBase.->OnClientCollidecxx . . $ IDMFC#OnClientCollide(584c77d2760d8df8).(me_obj, it_obj, point, normal);
840 return;
841 }
842
843 DMFCBasecxx . . $ DMFCBase.->OnClientCollidecxx . . $ IDMFC#OnClientCollide(584c77d2760d8df8).(me_obj, it_obj, point, normal);
844 }
845
846 void OnServerObjectShieldsChangedcxx . . $ OnServerObjectShieldsChanged(4ebbd0c3cbf1b78a).(objectcxx . . $ object# *obj, float amount) {
847 if (!obj)
848 return;
849 if (obj->handlecxx . . $ object#handle. == Monsterball_infocxx . . $ Monsterball_info..objhandlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#objhandle.) {
850 obj->shieldscxx . . $ object#shields. += amount;
851 }
852 }
853
854 void OnServerObjectChangeSegmentcxx . . $ OnServerObjectChangeSegment(a7790401ac9fc765).(objectcxx . . $ object# *obj, int newseg, int oldseg) {
855 if (!obj) {
856 DMFCBasecxx . . $ DMFCBase.->OnServerObjectChangeSegmentcxx . . $ IDMFC#OnServerObjectChangeSegment(a7790401ac9fc765).(obj, newseg, oldseg);
857 return;
858 }
859
860 if (obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! && obj->handlecxx . . $ object#handle. == Monsterball_infocxx . . $ Monsterball_info..objhandlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#objhandle.) {
861 // this is the monster ball, see if it's going into a goal room
862 bool is_goal = false;
863 for (int i = 0; i < NumOfTeamscxx . . $ NumOfTeams.; i++) {
864 if (newseg == GoalRoomscxx . . $ GoalRooms.[i]) {
865 is_goal = true;
866 break;
867 }
868 }
869
870 if (is_goal && !ValidateOwnercxx . . $ ValidateOwner(719e024848da80a4).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) {
871 // it's a team goal
872 SendLastHitInfocxx . . $ SendLastHitInfo(49f6e7a06ebc5aa8).();
873 DMFCBasecxx . . $ DMFCBase.->CallClientEventcxx . . $ IDMFC#CallClientEvent(d7a7761809021567).(EVT_CLIENT_GAMEOBJCHANGESEGcxx . . $ `lib/d3events.h:122:9`!, DMFCBasecxx . . $ DMFCBase.->GetMeObjNumcxx . . $ IDMFC#GetMeObjNum(b126dc7c1de90089).(), DMFCBasecxx . . $ DMFCBase.->GetItObjNumcxx . . $ IDMFC#GetItObjNum(b126dc7c1de90089).(), -1,
874 true);
875 DMFCBasecxx . . $ DMFCBase.->CallOnClientObjectChangeSegmentcxx . . $ IDMFC#CallOnClientObjectChangeSegment(a7790401ac9fc765).(obj, newseg, oldseg);
876 }
877 }
878
879 DMFCBasecxx . . $ DMFCBase.->OnServerObjectChangeSegmentcxx . . $ IDMFC#OnServerObjectChangeSegment(a7790401ac9fc765).(obj, newseg, oldseg);
880 }
881
882 void OnClientObjectChangeSegmentcxx . . $ OnClientObjectChangeSegment(a7790401ac9fc765).(objectcxx . . $ object# *obj, int newseg, int oldseg) {
883 static int sound = -1;
884
885 if (!obj) {
886 DMFCBasecxx . . $ DMFCBase.->OnClientObjectChangeSegmentcxx . . $ IDMFC#OnClientObjectChangeSegment(a7790401ac9fc765).(obj, newseg, oldseg);
887 FatalError("INVALID OBJECT PASSED INTO OnClientObjectChangeSegment()");
888 return;
889 }
890 int team = -1;
891
892 for (int i = 0; i < NumOfTeamscxx . . $ NumOfTeams.; i++) {
893 if (newseg == GoalRoomscxx . . $ GoalRooms.[i]) {
894 team = i;
895 break;
896 }
897 }
898
899 if (team < 0 || team >= NumOfTeamscxx . . $ NumOfTeams.) {
900 FatalError("NOT A GOAL ROOM\n");
901 return;
902 }
903
904 if (sound == -1)
905 sound = DLLFindSoundName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(MONSTERBALL_SND_SCOREcxx . . $ `netgames/monsterball/monsterball.cpp:187:9`!));
906 if (sound != -1)
907 DLLPlay2dSound(sound, MAX_GAME_VOLUMEcxx . . $ `netgames/includes/gamedll_header.h:59:9`! * 0.66f);
908
909 DoMonsterballScoreEffectcxx . . $ DoMonsterballScoreEffect(49f6e7a06ebc5aa8).();
910
911 DLLvm_MakeVectorZero(&obj->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity.);
912 DLLvm_MakeIdentity(&obj->orientcxx . . $ object#orient.);
913 DLLObjSetPos(obj, &Monsterball_infocxx . . $ Monsterball_info..poscxx . . $ $anonymous_type_fbc4dbe14b124390_0#pos., Monsterball_infocxx . . $ Monsterball_info..roomcxx . . $ $anonymous_type_fbc4dbe14b124390_0#room., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, false);
914
915 if (!DMFCBasecxx . . $ DMFCBase.->CheckPlayerNumcxx . . $ IDMFC#CheckPlayerNum(83c267b20bac841a).(LastHitPnumcxx . . $ LastHitPnum.)) {
916 if (SCORE_HITINcxx . . $ `netgames/monsterball/monsterball.cpp:200:9`! == 1) {
917 DLLAddHUDMessage(TXT_SCOREONEcxx . . $ `netgames/monsterball/monsterstr.h:41:9`!, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team));
918 } else {
919 DLLAddHUDMessage(TXT_SCOREMULTIcxx . . $ `netgames/monsterball/monsterstr.h:42:9`!, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team), SCORE_HITINcxx . . $ `netgames/monsterball/monsterball.cpp:200:9`!);
920 }
921 } else {
922 int last_hit_team = dPlayerscxx . . $ dPlayers.[LastHitPnumcxx . . $ LastHitPnum.].teamcxx . . $ player#team.;
923 char *callsign = dPlayerscxx . . $ dPlayers.[LastHitPnumcxx . . $ LastHitPnum.].callsigncxx . . $ player#callsign.;
924 tPlayerStatcxx . . $ tPlayerStat# *stat = (tPlayerStatcxx . . $ tPlayerStat# *)DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordDatacxx . . $ IDMFC#GetPlayerRecordData(d1680a912d714170).(LastHitPnumcxx . . $ LastHitPnum.);
925
926 if (last_hit_team != team) {
927 // he scored for the other team!!!
928
929 if (SCORE_HITINcxx . . $ `netgames/monsterball/monsterball.cpp:200:9`! == 1) {
930 DLLAddHUDMessage(TXT_BLUNDERSCOREcxx . . $ `netgames/monsterball/monsterstr.h:43:9`!, callsign, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team));
931 } else {
932 DLLAddHUDMessage(TXT_BLUNDERMULTISCOREcxx . . $ `netgames/monsterball/monsterstr.h:44:9`!, callsign, SCORE_HITINcxx . . $ `netgames/monsterball/monsterball.cpp:200:9`!, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team));
933 }
934
935 if (stat) {
936 stat->BadScorecxx . . $ tPlayerStat#BadScore.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]++;
937 stat->BadScorecxx . . $ tPlayerStat#BadScore.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]++;
938 }
939 } else {
940 // good score!
941 if (SCORE_HITINcxx . . $ `netgames/monsterball/monsterball.cpp:200:9`! == 1) {
942 DLLAddHUDMessage(TXT_PLAYERSCOREcxx . . $ `netgames/monsterball/monsterstr.h:45:9`!, callsign, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team));
943 } else {
944 DLLAddHUDMessage(TXT_PLAYERMULTISCOREcxx . . $ `netgames/monsterball/monsterstr.h:46:9`!, callsign, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team), SCORE_HITINcxx . . $ `netgames/monsterball/monsterball.cpp:200:9`!);
945 }
946
947 if (stat) {
948 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]++;
949 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]++;
950 }
951 }
952 }
953
954 TeamScorescxx . . $ TeamScores.[team] += SCORE_HITINcxx . . $ `netgames/monsterball/monsterball.cpp:200:9`!;
955
956 // do killgoal check
957 int goal;
958 if ((DMFCBasecxx . . $ DMFCBase.->GetScoreLimitcxx . . $ IDMFC#GetScoreLimit(18a3c31ed0aa5760).(&goal)) && (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!)) {
959 if (TeamScorescxx . . $ TeamScores.[team] >= goal)
960 DMFCBasecxx . . $ DMFCBase.->EndLevelcxx . . $ IDMFC#EndLevel(49f6e7a06ebc5aa8).();
961 }
962
963 // Set a Timer to display
964 if (WhoJustScoredTimercxx . . $ WhoJustScoredTimer. != -1)
965 DMFCBasecxx . . $ DMFCBase.->KillTimercxx . . $ IDMFC#KillTimer(d4f767463ce0a6b3).(WhoJustScoredTimercxx . . $ WhoJustScoredTimer.);
966 WhoJustScoredTimercxx . . $ WhoJustScoredTimer. = DMFCBasecxx . . $ DMFCBase.->SetTimerIntervalcxx . . $ IDMFC#SetTimerInterval(695c251031f3a34d).(OnTimerScorecxx . . $ OnTimerScore(49f6e7a06ebc5aa8)., 0.5f, 5.0f, OnTimerScoreKillcxx . . $ OnTimerScoreKill(49f6e7a06ebc5aa8).);
967 WhoJustScoredcxx . . $ WhoJustScored. = team;
968
969 DMFCBasecxx . . $ DMFCBase.->OnClientObjectChangeSegmentcxx . . $ IDMFC#OnClientObjectChangeSegment(a7790401ac9fc765).(obj, newseg, oldseg);
970 }
971
972 void OnServerPlayerChangeSegmentcxx . . $ OnServerPlayerChangeSegment(b1146eedae1e1d0b).(int player_num, int newseg, int oldseg) {
973 if (player_num == -1)
974 return;
975 if (newseg == GoalRoomscxx . . $ GoalRooms.[DMFCBasecxx . . $ DMFCBase.->GetPlayerTeamcxx . . $ IDMFC#GetPlayerTeam(7864480464b09eea).(player_num)]) {
976 // check to see if a player dragged the ball into the goal
977 int p;
978 if (ValidateOwnercxx . . $ ValidateOwner(719e024848da80a4).(&p, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) {
979 // a player currently has the monsterball
980 if (p == player_num) {
981 // it's this player
982 DMFCBasecxx . . $ DMFCBase.->CallClientEventcxx . . $ IDMFC#CallClientEvent(d7a7761809021567).(EVT_CLIENT_GAMEPLAYERCHANGESEGcxx . . $ `lib/d3events.h:97:9`!, DMFCBasecxx . . $ DMFCBase.->GetMeObjNumcxx . . $ IDMFC#GetMeObjNum(b126dc7c1de90089).(), DMFCBasecxx . . $ DMFCBase.->GetItObjNumcxx . . $ IDMFC#GetItObjNum(b126dc7c1de90089).(), -1);
983 DMFCBasecxx . . $ DMFCBase.->CallOnClientPlayerChangeSegmentcxx . . $ IDMFC#CallOnClientPlayerChangeSegment(b1146eedae1e1d0b).(player_num, newseg, oldseg);
984 }
985 }
986 }
987 DMFCBasecxx . . $ DMFCBase.->OnServerPlayerChangeSegmentcxx . . $ IDMFC#OnServerPlayerChangeSegment(b1146eedae1e1d0b).(player_num, newseg, oldseg);
988 }
989
990 void OnClientPlayerChangeSegmentcxx . . $ OnClientPlayerChangeSegment(b1146eedae1e1d0b).(int player_num, int newseg, int oldseg) {
991 // If we get here, than a player dragged the powerball into their goal
992 static int sound = -1;
993 objectcxx . . $ object# *bobj;
994 int p;
995
996 // if we got here than the player with the Monsterball has entered his team's goal!
997
998 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(83c267b20bac841a).(player_num))
999 return; // dedicated server
1000
1001 if (!ValidateOwnercxx . . $ ValidateOwner(719e024848da80a4).(&p, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) {
1002 return;
1003 }
1004 if (p != player_num)
1005 return;
1006
1007 HandleLosePowerballcxx . . $ HandleLosePowerball(b45ddcbc8423892c).(false);
1008
1009 if (!DLLObjGet(Monsterball_infocxx . . $ Monsterball_info..objhandlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#objhandle., &bobj)) {
1010 FatalError("MonsterBall Is Missing!\n");
1011 }
1012
1013 DLLObjSetPos(bobj, &Monsterball_infocxx . . $ Monsterball_info..poscxx . . $ $anonymous_type_fbc4dbe14b124390_0#pos., Monsterball_infocxx . . $ Monsterball_info..roomcxx . . $ $anonymous_type_fbc4dbe14b124390_0#room., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, false);
1014
1015 if (SCORE_DRAGINcxx . . $ `netgames/monsterball/monsterball.cpp:199:9`! == 1)
1016 DLLAddHUDMessage(TXT_SCOREONEcxx . . $ `netgames/monsterball/monsterstr.h:41:9`!, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(dPlayerscxx . . $ dPlayers.[player_num].teamcxx . . $ player#team.));
1017 else
1018 DLLAddHUDMessage(TXT_SCOREMULTIcxx . . $ `netgames/monsterball/monsterstr.h:42:9`!, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(dPlayerscxx . . $ dPlayers.[player_num].teamcxx . . $ player#team.), SCORE_DRAGINcxx . . $ `netgames/monsterball/monsterball.cpp:199:9`!);
1019
1020 TeamScorescxx . . $ TeamScores.[dPlayerscxx . . $ dPlayers.[player_num].teamcxx . . $ player#team.] += SCORE_DRAGINcxx . . $ `netgames/monsterball/monsterball.cpp:199:9`!;
1021
1022 if (sound == -1)
1023 sound = DLLFindSoundName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(MONSTERBALL_SND_SCOREcxx . . $ `netgames/monsterball/monsterball.cpp:187:9`!));
1024 if (sound != -1)
1025 DLLPlay2dSound(sound, MAX_GAME_VOLUMEcxx . . $ `netgames/includes/gamedll_header.h:59:9`! / 2);
1026
1027 // do killgoal check
1028 int goal;
1029 if ((DMFCBasecxx . . $ DMFCBase.->GetScoreLimitcxx . . $ IDMFC#GetScoreLimit(18a3c31ed0aa5760).(&goal)) && (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!)) {
1030 if (TeamScorescxx . . $ TeamScores.[dPlayerscxx . . $ dPlayers.[player_num].teamcxx . . $ player#team.] >= goal)
1031 DMFCBasecxx . . $ DMFCBase.->EndLevelcxx . . $ IDMFC#EndLevel(49f6e7a06ebc5aa8).();
1032 }
1033
1034 // Set a Timer to display
1035 if (WhoJustScoredTimercxx . . $ WhoJustScoredTimer. != -1)
1036 DMFCBasecxx . . $ DMFCBase.->KillTimercxx . . $ IDMFC#KillTimer(d4f767463ce0a6b3).(WhoJustScoredTimercxx . . $ WhoJustScoredTimer.);
1037 WhoJustScoredTimercxx . . $ WhoJustScoredTimer. = DMFCBasecxx . . $ DMFCBase.->SetTimerIntervalcxx . . $ IDMFC#SetTimerInterval(695c251031f3a34d).(OnTimerScorecxx . . $ OnTimerScore(49f6e7a06ebc5aa8)., 0.5f, 5.0f, OnTimerScoreKillcxx . . $ OnTimerScoreKill(49f6e7a06ebc5aa8).);
1038 WhoJustScoredcxx . . $ WhoJustScored. = dPlayerscxx . . $ dPlayers.[player_num].teamcxx . . $ player#team.;
1039 }
1040
1041 // The server has started a new level, so clear out any scores needed to be reset
1042 void OnClientLevelStartcxx . . $ OnClientLevelStart(49f6e7a06ebc5aa8).(void) {
1043 DMFCBasecxx . . $ DMFCBase.->OnClientLevelStartcxx . . $ IDMFC#OnClientLevelStart(49f6e7a06ebc5aa8).();
1044
1045 tPlayerStatcxx . . $ tPlayerStat# *stat;
1046 int i;
1047 player_recordcxx . . $ player_record# *pr;
1048
1049 for (i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) {
1050 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(i);
1051 if (pr)
1052 stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.;
1053 else
1054 stat = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1055 if (stat) {
1056 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] = 0;
1057 stat->BadScorecxx . . $ tPlayerStat#BadScore.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] = 0;
1058 }
1059 }
1060
1061 for (i = 0; i < NumOfTeamscxx . . $ NumOfTeams.; i++) {
1062 TeamScorescxx . . $ TeamScores.[i] = 0;
1063 GoalRoomscxx . . $ GoalRooms.[i] = DLLGetGoalRoomForTeam(i);
1064 }
1065 LastHitPnumcxx . . $ LastHitPnum. = -1;
1066
1067 DLLMultiPaintGoalRooms(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1068
1069 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "Getting Monsterball info\n");
1070 if (!GetMonsterballInfocxx . . $ GetMonsterballInfo(83c267b20bac841a).(DLLFindObjectIDName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(MONSTERBALL_ID_NAMEcxx . . $ `netgames/monsterball/monsterball.cpp:186:9`!)))) {
1071 FatalError("Error finding Monsterball room\n");
1072 }
1073
1074 if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) {
1075 int objnum = DLLObjCreate(OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!, Monsterball_infocxx . . $ Monsterball_info..idcxx . . $ $anonymous_type_fbc4dbe14b124390_0#id., Monsterball_infocxx . . $ Monsterball_info..roomcxx . . $ $anonymous_type_fbc4dbe14b124390_0#room., &Monsterball_infocxx . . $ Monsterball_info..poscxx . . $ $anonymous_type_fbc4dbe14b124390_0#pos., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!,
1076 OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!);
1077 if (objnum == -1)
1078 FatalError("Unable to create Monsterball");
1079
1080 dObjectscxx . . $ dObjects.[objnum].mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotdragcxx . . $ physics_info#rotdrag. = 5.0f;
1081
1082 DLLMultiSendObject(&dObjectscxx . . $ dObjects.[objnum], 1, true);
1083 Monsterball_infocxx . . $ Monsterball_info..objhandlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#objhandle. = dObjectscxx . . $ dObjects.[objnum].handlecxx . . $ object#handle.;
1084 Monsterball_infocxx . . $ Monsterball_info..owner_handlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#owner_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
1085 monsterball_info_setcxx . . $ monsterball_info_set. = true;
1086 } else {
1087 DMFCBasecxx . . $ DMFCBase.->RequestGameStatecxx . . $ IDMFC#RequestGameState(49f6e7a06ebc5aa8).();
1088 }
1089 players_sortedcxx . . $ players_sorted. = false;
1090 }
1091
1092 // A New Player has entered the game, so we want to send him a game status packet that
1093 // has information about the game
1094 void OnGameStateRequestcxx . . $ OnGameStateRequest(d4f767463ce0a6b3).(int player_num) {
1095 SendGameStartPacketcxx . . $ SendGameStartPacket(d4f767463ce0a6b3).(player_num);
1096 DMFCBasecxx . . $ DMFCBase.->OnGameStateRequestcxx . . $ IDMFC#OnGameStateRequest(d4f767463ce0a6b3).(player_num);
1097 }
1098
1099 // A new player has entered the game, zero their stats out
1100 void OnPlayerConnectcxx . . $ OnPlayerConnect(d4f767463ce0a6b3).(int player_num) {
1101 tPlayerStatcxx . . $ tPlayerStat# *stat = (tPlayerStatcxx . . $ tPlayerStat# *)DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordDatacxx . . $ IDMFC#GetPlayerRecordData(d1680a912d714170).(player_num);
1102 if (stat) {
1103 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] = 0;
1104 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!] = 0;
1105 stat->BadScorecxx . . $ tPlayerStat#BadScore.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] = 0;
1106 stat->BadScorecxx . . $ tPlayerStat#BadScore.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!] = 0;
1107 }
1108
1109 DMFCBasecxx . . $ DMFCBase.->OnPlayerConnectcxx . . $ IDMFC#OnPlayerConnect(d4f767463ce0a6b3).(player_num);
1110 }
1111
1112 // A new player has entered the game, zero there stats out
1113 void OnClientPlayerEntersGamecxx . . $ OnClientPlayerEntersGame(d4f767463ce0a6b3).(int player_num) {
1114 DMFCBasecxx . . $ DMFCBase.->OnClientPlayerEntersGamecxx . . $ IDMFC#OnClientPlayerEntersGame(d4f767463ce0a6b3).(player_num);
1115 if (player_num != DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).())
1116 DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(player_num);
1117 else
1118 display_my_welcomecxx . . $ display_my_welcome. = true;
1119 }
1120
1121 bool compare_slotscxx . . $ compare_slots(cf9ef193275fa6d8).(int a, int b) {
1122 int ascore, bscore;
1123 player_recordcxx . . $ player_record# *apr, *bpr;
1124 tPlayerStatcxx . . $ tPlayerStat# *astat, *bstat;
1125
1126 apr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(a);
1127 bpr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(b);
1128 if (!apr)
1129 return true;
1130 if (!bpr)
1131 return false;
1132 if (apr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.)
1133 return true;
1134 if (bpr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.)
1135 return false;
1136 astat = (tPlayerStatcxx . . $ tPlayerStat# *)apr->user_infocxx . . $ player_record#user_info.;
1137 bstat = (tPlayerStatcxx . . $ tPlayerStat# *)bpr->user_infocxx . . $ player_record#user_info.;
1138
1139 if ((apr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) && (bpr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.)) {
1140 // both players were in the game
1141 ascore = (astat) ? astat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0;
1142 bscore = (bstat) ? bstat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0;
1143 return (ascore < bscore);
1144 }
1145 if ((apr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) && (bpr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.)) {
1146 // apr gets priority since he was in the game on exit
1147 return false;
1148 }
1149 if ((apr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.) && (bpr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.)) {
1150 // bpr gets priority since he was in the game on exit
1151 return true;
1152 }
1153 // if we got here then both players were disconnected
1154 ascore = (astat) ? astat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0;
1155 bscore = (bstat) ? bstat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0;
1156 return (ascore < bscore);
1157 }
1158
1159 void SortPlayerSlotscxx . . $ SortPlayerSlots(621ccea12ecf5b06).(int *sorted_list, int count) {
1160 int tempsort[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!];
1161 int i, t, j;
1162
1163 for (i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) {
1164 tempsort[i] = i;
1165 }
1166
1167 for (i = 1; i <= MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`! - 1; i++) {
1168 t = tempsort[i];
1169 // Shift elements down until
1170 // insertion point found.
1171 for (j = i - 1; j >= 0 && compare_slotscxx . . $ compare_slots(cf9ef193275fa6d8).(tempsort[j], t); j--) {
1172 tempsort[j + 1] = tempsort[j];
1173 }
1174 // insert
1175 tempsort[j + 1] = t;
1176 }
1177
1178 // copy the array over
1179 memcpy(sorted_list, tempsort, count * sizeof(int));
1180 }
1181
1182 void OnPLRInitcxx . . $ OnPLRInit(49f6e7a06ebc5aa8).(void) {
1183 monsterball_info_setcxx . . $ monsterball_info_set. = false; // for the next level
1184
1185 SortPlayerSlotscxx . . $ SortPlayerSlots(621ccea12ecf5b06).(SortedPlayerscxx . . $ SortedPlayers., MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!);
1186
1187 // Now fill in the final structure of sorted names
1188 int TeamCount[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!];
1189 player_recordcxx . . $ player_record# *pr;
1190 int team, i;
1191
1192 for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++)
1193 TeamCount[i] = 0;
1194 for (i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) {
1195 int slot = SortedPlayerscxx . . $ SortedPlayers.[i];
1196 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(slot);
1197 if (pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) {
1198
1199 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
1200 continue; // skip dedicated server
1201
1202 team = (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) ? dPlayerscxx . . $ dPlayers.[pr->pnumcxx . . $ player_record#pnum.].teamcxx . . $ player#team. : pr->teamcxx . . $ player_record#team.;
1203
1204 if (team >= NumOfTeamscxx . . $ NumOfTeams.)
1205 team = 0;
1206 SortedPLRPlayerscxx . . $ SortedPLRPlayers.[team][TeamCount[team]] = slot;
1207 TeamCount[team]++;
1208 }
1209 }
1210 for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) {
1211 if (TeamCount[i] < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!)
1212 SortedPLRPlayerscxx . . $ SortedPLRPlayers.[i][TeamCount[i]] = -1;
1213 }
1214
1215 DMFCBasecxx . . $ DMFCBase.->OnPLRInitcxx . . $ IDMFC#OnPLRInit(49f6e7a06ebc5aa8).();
1216 }
1217
1218 void OnPLRIntervalcxx . . $ OnPLRInterval(49f6e7a06ebc5aa8).(void) {
1219 DMFCBasecxx . . $ DMFCBase.->OnPLRIntervalcxx . . $ IDMFC#OnPLRInterval(49f6e7a06ebc5aa8).();
1220
1221 int TeamCol = 35;
1222 int NameCol = 190;
1223 int PointCol = 280;
1224 int BlunderCol = 340;
1225 int KillsCol = 410;
1226 int DeathsCol = 450;
1227 int SuicidesCol = 490;
1228 int y = 40;
1229 int slot;
1230 player_recordcxx . . $ player_record# *pr;
1231 tPlayerStatcxx . . $ tPlayerStat# *stat;
1232
1233 DLLgrtext_SetFont((DMFCBasecxx . . $ DMFCBase.->GetGameFontTranslateArraycxx . . $ IDMFC#GetGameFontTranslateArray(a7741f82f5fc3640).())[SMALL_UI_FONT_INDEXcxx . . $ `Descent3/gamefont.h:99:9`!]);
1234 int height = DLLgrfont_GetHeight((DMFCBasecxx . . $ DMFCBase.->GetGameFontTranslateArraycxx . . $ IDMFC#GetGameFontTranslateArray(a7741f82f5fc3640).())[SMALL_UI_FONT_INDEXcxx . . $ `Descent3/gamefont.h:99:9`!]) + 1;
1235
1236 // print out header
1237 DLLgrtext_SetColor(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 150));
1238 DLLgrtext_Printf(NameCol, y, TXT_PILOTcxx . . $ `netgames/monsterball/monsterstr.h:34:9`!);
1239 DLLgrtext_Printf(PointCol, y, TXT_POINTScxx . . $ `netgames/monsterball/monsterstr.h:35:9`!);
1240 DLLgrtext_Printf(BlunderCol, y, TXT_BLUNDERScxx . . $ `netgames/monsterball/monsterstr.h:36:9`!);
1241 DLLgrtext_Printf(KillsCol, y, TXT_KILLSSHORTcxx . . $ `netgames/monsterball/monsterstr.h:37:9`!);
1242 DLLgrtext_Printf(DeathsCol, y, TXT_DEATHSSHORTcxx . . $ `netgames/monsterball/monsterstr.h:38:9`!);
1243 DLLgrtext_Printf(SuicidesCol, y, TXT_SUICIDESSHORTcxx . . $ `netgames/monsterball/monsterstr.h:39:9`!);
1244 y += height;
1245 bool has_members;
1246 bool doing_connected = true;
1247 do_disconnected_folk:
1248
1249 for (int team = 0; team < NUM_TEAMScxx . . $ `netgames/monsterball/monsterball.cpp:356:9`!; team++) {
1250 // process this team
1251 bool show_team_label;
1252 show_team_label = false;
1253
1254 if (!doing_connected) {
1255 int temp_idx;
1256 temp_idx = 0;
1257
1258 while (SortedPLRPlayerscxx . . $ SortedPLRPlayers.[team][temp_idx] != -1) {
1259 int pnum = DMFCBasecxx . . $ DMFCBase.->WasPlayerInGameAtLevelEndcxx . . $ IDMFC#WasPlayerInGameAtLevelEnd(7864480464b09eea).(SortedPLRPlayerscxx . . $ SortedPLRPlayers.[team][temp_idx]);
1260 if (pnum == -1) {
1261 show_team_label = true;
1262 break;
1263 }
1264 temp_idx++;
1265 }
1266 } else {
1267 show_team_label = true;
1268 }
1269
1270 if (show_team_label) {
1271 // is there anyone on this team?
1272 DLLgrtext_SetColor(DMFCBasecxx . . $ DMFCBase.->GetTeamColorcxx . . $ IDMFC#GetTeamColor(46cc46841198e427).(team));
1273 DLLgrtext_Printf(TeamCol, y, TXT_HUDDISPLAYcxx . . $ `netgames/monsterball/monsterstr.h:47:9`!, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team), TeamScorescxx . . $ TeamScores.[team]);
1274 }
1275 has_members = false;
1276
1277 for (int index = 0; index < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; index++) {
1278 // get the player num
1279 slot = SortedPLRPlayerscxx . . $ SortedPLRPlayers.[team][index];
1280 if (slot == -1) // we are done with this team
1281 break;
1282
1283 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(slot);
1284 if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) {
1285
1286 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
1287 continue; // skip dedicated server
1288
1289 int pnum = DMFCBasecxx . . $ DMFCBase.->WasPlayerInGameAtLevelEndcxx . . $ IDMFC#WasPlayerInGameAtLevelEnd(7864480464b09eea).(slot);
1290
1291 if ((doing_connected && pnum == -1) || (!doing_connected && pnum != -1))
1292 continue; // we're not handling them right now
1293
1294 if (pnum != -1) {
1295 DLLgrtext_SetColor(DMFCBasecxx . . $ DMFCBase.->GetTeamColorcxx . . $ IDMFC#GetTeamColor(46cc46841198e427).(team));
1296 } else {
1297 DLLgrtext_SetColor(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(128, 128, 128));
1298 }
1299
1300 char tempbuffer[40];
1301 strcpy(tempbuffer, pr->callsigncxx . . $ player_record#callsign.);
1302 DMFCBasecxx . . $ DMFCBase.->ClipStringcxx . . $ IDMFC#ClipString(8677479218165cd4).(PointCol - NameCol - 10, tempbuffer, true);
1303
1304 // valid player
1305 stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.;
1306 DLLgrtext_Printf(NameCol, y, "%s", tempbuffer);
1307 DLLgrtext_Printf(PointCol, y, "%d", (stat) ? stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0);
1308 DLLgrtext_Printf(BlunderCol, y, "%d", (stat) ? stat->BadScorecxx . . $ tPlayerStat#BadScore.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0);
1309 DLLgrtext_Printf(KillsCol, y, "%d", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
1310 DLLgrtext_Printf(DeathsCol, y, "%d", pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
1311 DLLgrtext_Printf(SuicidesCol, y, "%d", pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
1312 y += height;
1313 has_members = true;
1314
1315 if (y >= 440)
1316 goto quick_exit;
1317 }
1318 } // end for
1319 // on to the next team
1320
1321 if (!has_members)
1322 y += height; // on to the next line
1323
1324 if (y >= 440)
1325 goto quick_exit;
1326 } // end for
1327
1328 if (doing_connected) {
1329 doing_connected = false;
1330 goto do_disconnected_folk;
1331 }
1332
1333 quick_exit:;
1334 }
1335
1336 void OnPrintScorescxx . . $ OnPrintScores(d4f767463ce0a6b3).(int level) {
1337 char buffer[256];
1338 char name[50];
1339 size_t t;
1340 size_t pos[7];
1341 size_t len[7];
1342
1343 for (int i = 0; i < NumOfTeamscxx . . $ NumOfTeams.; i++) {
1344 snprintf(buffer, sizeof(buffer), "%s:%d\n", DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(i), TeamScorescxx . . $ TeamScores.[i]);
1345 DPrintf(buffer);
1346 }
1347
1348 memset(buffer, ' ', 256);
1349 pos[0] = 0;
1350 t = len[0] = 20; // give ample room for pilot name
1351 pos[1] = pos[0] + t + 1;
1352 t = len[1] = strlen(TXT_POINTScxx . . $ `netgames/monsterball/monsterstr.h:35:9`!);
1353 pos[2] = pos[1] + t + 1;
1354 t = len[2] = strlen(TXT_BLUNDERScxx . . $ `netgames/monsterball/monsterstr.h:36:9`!);
1355 pos[3] = pos[1] + t + 1;
1356 t = len[3] = strlen(TXT_KILLScxx . . $ `netgames/monsterball/monsterstr.h:48:9`!);
1357 pos[4] = pos[2] + t + 1;
1358 t = len[4] = strlen(TXT_DEATHScxx . . $ `netgames/monsterball/monsterstr.h:49:9`!);
1359 pos[5] = pos[3] + t + 1;
1360 t = len[5] = strlen(TXT_SUICIDEScxx . . $ `netgames/monsterball/monsterstr.h:50:9`!);
1361 pos[6] = pos[4] + t + 1;
1362 t = len[6] = strlen(TXT_PINGcxx . . $ `netgames/monsterball/monsterstr.h:40:9`!);
1363
1364 memcpy(&buffer[pos[0]], TXT_PILOTcxx . . $ `netgames/monsterball/monsterstr.h:34:9`!, strlen(TXT_PILOTcxx . . $ `netgames/monsterball/monsterstr.h:34:9`!));
1365 memcpy(&buffer[pos[1]], TXT_POINTScxx . . $ `netgames/monsterball/monsterstr.h:35:9`!, len[1]);
1366 memcpy(&buffer[pos[2]], TXT_BLUNDERScxx . . $ `netgames/monsterball/monsterstr.h:36:9`!, len[2]);
1367 memcpy(&buffer[pos[3]], TXT_KILLScxx . . $ `netgames/monsterball/monsterstr.h:48:9`!, len[3]);
1368 memcpy(&buffer[pos[4]], TXT_DEATHScxx . . $ `netgames/monsterball/monsterstr.h:49:9`!, len[4]);
1369 memcpy(&buffer[pos[5]], TXT_SUICIDEScxx . . $ `netgames/monsterball/monsterstr.h:50:9`!, len[5]);
1370 memcpy(&buffer[pos[6]], TXT_PINGcxx . . $ `netgames/monsterball/monsterstr.h:40:9`!, len[6]);
1371 buffer[pos[6] + len[6] + 1] = '\n';
1372 buffer[pos[6] + len[6] + 2] = '\0';
1373 DPrintf(buffer);
1374
1375 int slot;
1376 player_recordcxx . . $ player_record# *pr;
1377 int pcount;
1378
1379 if (level < 0 || level >= MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!)
1380 pcount = MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!;
1381 else
1382 pcount = level;
1383
1384 int sortedplayers[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!];
1385 DMFCBasecxx . . $ DMFCBase.->GetSortedPlayerSlotscxx . . $ IDMFC#GetSortedPlayerSlots(621ccea12ecf5b06).(sortedplayers, MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!);
1386
1387 for (int i = 0; i < pcount; i++) {
1388 slot = sortedplayers[i];
1389 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(slot);
1390 tPlayerStatcxx . . $ tPlayerStat# *stat;
1391 if ((pr) && (pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.)) {
1392
1393 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
1394 continue; // skip dedicated server
1395
1396 snprintf(name, sizeof(name), "%s%s:", (pr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.) ? "*" : "", pr->callsigncxx . . $ player_record#callsign.);
1397 name[19] = '\0';
1398
1399 stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.;
1400
1401 memset(buffer, ' ', 256);
1402 t = strlen(name);
1403 memcpy(&buffer[pos[0]], name, (t < len[0]) ? t : len[0]);
1404 snprintf(name, sizeof(name), "%d", (stat) ? stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0);
1405 t = strlen(name);
1406 memcpy(&buffer[pos[1]], name, (t < len[1]) ? t : len[1]);
1407 snprintf(name, sizeof(name), "%d", (stat) ? stat->BadScorecxx . . $ tPlayerStat#BadScore.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0);
1408 t = strlen(name);
1409 memcpy(&buffer[pos[2]], name, (t < len[2]) ? t : len[2]);
1410 snprintf(name, sizeof(name), "%d", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
1411 t = strlen(name);
1412 memcpy(&buffer[pos[3]], name, (t < len[2]) ? t : len[3]);
1413 snprintf(name, sizeof(name), "%d", pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
1414 t = strlen(name);
1415 memcpy(&buffer[pos[4]], name, (t < len[3]) ? t : len[4]);
1416 snprintf(name, sizeof(name), "%d", pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
1417 t = strlen(name);
1418 memcpy(&buffer[pos[5]], name, (t < len[4]) ? t : len[5]);
1419
1420 if (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.)
1421 snprintf(name, sizeof(name), "%.0f", (DMFCBasecxx . . $ DMFCBase.->GetNetPlayerscxx . . $ IDMFC#GetNetPlayers(d09959b2d64446dd).())[pr->pnumcxx . . $ player_record#pnum.].ping_timecxx . . $ netplayer#ping_time. * 1000.0f);
1422 else
1423 strcpy(name, "---");
1424 t = strlen(name);
1425 memcpy(&buffer[pos[6]], name, (t < len[6]) ? t : len[6]);
1426 buffer[pos[6] + len[6] + 1] = '\n';
1427 buffer[pos[6] + len[6] + 2] = '\0';
1428 DPrintf(buffer);
1429 }
1430 }
1431 }
1432
1433 void SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(char *filename) {
1434 CFILEcxx . . $ CFILE# *file;
1435 DLLOpenCFILE(&file, filenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "wt");
1436 if (!file) {
1437 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "Unable to open output file\n");
1438 return;
1439 }
1440
1441 // write out game stats
1442 #define BUFSIZEcxx . . $ `netgames/monsterball/monsterball.cpp:1442:9`! 150
1443 char buffer[BUFSIZEcxx . . $ `netgames/monsterball/monsterball.cpp:1442:9`!];
1444 char tempbuffer[25];
1445 int sortedslots[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!];
1446 player_recordcxx . . $ player_record# *pr, *dpr;
1447 tPInfoStatcxx . . $ tPInfoStat# stat;
1448 int count, p;
1449 tPlayerStatcxx . . $ tPlayerStat# *st;
1450
1451 // sort the stats
1452 DMFCBasecxx . . $ DMFCBase.->GetSortedPlayerSlotscxx . . $ IDMFC#GetSortedPlayerSlots(621ccea12ecf5b06).(sortedslots, MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!);
1453 SortTeamscxx . . $ SortTeams(49f6e7a06ebc5aa8).();
1454 count = 1;
1455
1456 snprintf(buffer, sizeof(buffer), TXT_SAVESTATSAcxx . . $ `netgames/monsterball/monsterstr.h:51:9`!, (DMFCBasecxx . . $ DMFCBase.->GetNetgameInfocxx . . $ IDMFC#GetNetgameInfo(242e78cd5130aa12).())->namecxx . . $ netgame_info#name.,
1457 (DMFCBasecxx . . $ DMFCBase.->GetCurrentMissioncxx . . $ IDMFC#GetCurrentMission(d7a4f7ca6f9cb411).())->cur_levelcxx . . $ tMission#cur_level.);
1458 DLLcf_WriteString(file, buffer);
1459
1460 for (p = 0; p < NumOfTeamscxx . . $ NumOfTeams.; p++) {
1461 int team_i = SortedTeamscxx . . $ SortedTeams.[p];
1462 memset(buffer, ' ', BUFSIZEcxx . . $ `netgames/monsterball/monsterball.cpp:1442:9`!);
1463 snprintf(tempbuffer, sizeof(tempbuffer), TXT_SAVESTATSTEAMcxx . . $ `netgames/monsterball/monsterstr.h:52:9`!, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team_i));
1464 memcpy(&buffer[0], tempbuffer, strlen(tempbuffer));
1465 snprintf(tempbuffer, sizeof(tempbuffer), "[%d]", TeamScorescxx . . $ TeamScores.[team_i]);
1466 memcpy(&buffer[20], tempbuffer, strlen(tempbuffer));
1467 buffer[20 + strlen(tempbuffer)] = '\0';
1468 DLLcf_WriteString(file, buffer);
1469 }
1470
1471 // Write team members
1472 DLLcf_WriteString(file, ""); // blank line
1473 for (int t = 0; t < NumOfTeamscxx . . $ NumOfTeams.; t++) {
1474 int team_i = SortedTeamscxx . . $ SortedTeams.[t];
1475
1476 snprintf(buffer, sizeof(buffer), TXT_SAVESTATSTEAMcxx . . $ `netgames/monsterball/monsterstr.h:52:9`!, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team_i));
1477 strncat(buffer, ":", sizeof(buffer) - strlen(buffer) - 1);
1478 DLLcf_WriteString(file, buffer);
1479
1480 for (p = 0; p < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; p++) {
1481 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(sortedslots[p]);
1482 if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) {
1483
1484 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
1485 continue; // skip dedicated server
1486
1487 if (pr->teamcxx . . $ player_record#team. == team_i) { // Check if current team
1488 snprintf(buffer, sizeof(buffer), " %s", pr->callsigncxx . . $ player_record#callsign.);
1489 DLLcf_WriteString(file, buffer);
1490 }
1491 }
1492 }
1493 }
1494 DLLcf_WriteString(file, ""); // blank line
1495
1496 snprintf(buffer, sizeof(buffer), "%s", TXT_SAVESTATSBcxx . . $ `netgames/monsterball/monsterstr.h:53:9`!);
1497 DLLcf_WriteString(file, buffer);
1498
1499 snprintf(buffer, sizeof(buffer), "%s", TXT_SAVESTATSCcxx . . $ `netgames/monsterball/monsterstr.h:54:9`!);
1500 DLLcf_WriteString(file, buffer);
1501 strcpy(buffer, "--------------------------------------------------------------------------------------");
1502 DLLcf_WriteString(file, buffer);
1503
1504 for (p = 0; p < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; p++) {
1505 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(sortedslots[p]);
1506 if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) {
1507
1508 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
1509 continue; // skip dedicated server
1510
1511 st = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.;
1512 memset(buffer, ' ', BUFSIZEcxx . . $ `netgames/monsterball/monsterball.cpp:1442:9`!);
1513
1514 snprintf(tempbuffer, sizeof(tempbuffer), "%d)", count);
1515 memcpy(&buffer[0], tempbuffer, strlen(tempbuffer));
1516
1517 snprintf(tempbuffer, sizeof(tempbuffer), "%s%s", (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) ? "" : "*", pr->callsigncxx . . $ player_record#callsign.);
1518 memcpy(&buffer[5], tempbuffer, strlen(tempbuffer));
1519
1520 snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", (st) ? st->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0,
1521 (st) ? st->Scorecxx . . $ tPlayerStat#Score.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!] : 0);
1522 memcpy(&buffer[34], tempbuffer, strlen(tempbuffer));
1523
1524 snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", (st) ? st->BadScorecxx . . $ tPlayerStat#BadScore.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0,
1525 (st) ? st->BadScorecxx . . $ tPlayerStat#BadScore.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!] : 0);
1526 memcpy(&buffer[42], tempbuffer, strlen(tempbuffer));
1527
1528 snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!],
1529 pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
1530 memcpy(&buffer[55], tempbuffer, strlen(tempbuffer));
1531
1532 snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!],
1533 pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
1534 memcpy(&buffer[67], tempbuffer, strlen(tempbuffer));
1535
1536 snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!],
1537 pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
1538 memcpy(&buffer[78], tempbuffer, strlen(tempbuffer));
1539
1540 size_t pos = 78 + strlen(tempbuffer) + 1;
1541 if (pos < BUFSIZEcxx . . $ `netgames/monsterball/monsterball.cpp:1442:9`!)
1542 buffer[pos] = '\0';
1543
1544 buffer[BUFSIZEcxx . . $ `netgames/monsterball/monsterball.cpp:1442:9`! - 1] = '\0';
1545 DLLcf_WriteString(file, buffer);
1546 count++;
1547 }
1548 }
1549
1550 DLLcf_WriteString(file, TXT_SAVESTATSDcxx . . $ `netgames/monsterball/monsterstr.h:56:9`!);
1551
1552 count = 1;
1553 for (p = 0; p < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; p++) {
1554 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(p);
1555 if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) {
1556
1557 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
1558 continue; // skip dedicated server
1559
1560 // Write out header
1561 snprintf(buffer, sizeof(buffer), "%d) %s%s (%s)", count, (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) ? "" : "*", pr->callsigncxx . . $ player_record#callsign.,
1562 DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(pr->teamcxx . . $ player_record#team.));
1563 DLLcf_WriteString(file, buffer);
1564 size_t length = strlen(buffer);
1565 memset(buffer, '=', length);
1566 buffer[length] = '\0';
1567 DLLcf_WriteString(file, buffer);
1568
1569 // time in game
1570 snprintf(buffer, sizeof(buffer), TXT_TIMEINGAMEcxx . . $ `netgames/monsterball/monsterstr.h:57:9`!, DMFCBasecxx . . $ DMFCBase.->GetTimeStringcxx . . $ IDMFC#GetTimeString(3b344d7a46e3c2ff).(DMFCBasecxx . . $ DMFCBase.->GetTimeInGamecxx . . $ IDMFC#GetTimeInGame(5cde91ea12d43f46).(p)));
1571 DLLcf_WriteString(file, buffer);
1572
1573 if (DMFCBasecxx . . $ DMFCBase.->FindPInfoStatFirstcxx . . $ IDMFC#FindPInfoStatFirst(e8124cb919632806).(p, &stat)) {
1574 snprintf(buffer, sizeof(buffer), "%s", TXT_SAVESTATSEcxx . . $ `netgames/monsterball/monsterstr.h:58:9`!);
1575 DLLcf_WriteString(file, buffer);
1576
1577 if (stat.slotcxx . . $ tPInfoStat#slot. != p) {
1578 memset(buffer, ' ', BUFSIZEcxx . . $ `netgames/monsterball/monsterball.cpp:1442:9`!);
1579 dpr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(stat.slotcxx . . $ tPInfoStat#slot.);
1580
1581 if (dpr) {
1582 strncpy(tempbuffer, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(dpr->teamcxx . . $ player_record#team.), sizeof(tempbuffer));
1583 memcpy(buffer, tempbuffer, strlen(tempbuffer));
1584
1585 strcpy(tempbuffer, dpr->callsigncxx . . $ player_record#callsign.);
1586 memcpy(&buffer[6], tempbuffer, strlen(tempbuffer));
1587
1588 snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.killscxx . . $ tPInfoStat#kills.);
1589 memcpy(&buffer[36], tempbuffer, strlen(tempbuffer));
1590
1591 snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.deathscxx . . $ tPInfoStat#deaths.);
1592 memcpy(&buffer[46], tempbuffer, strlen(tempbuffer));
1593
1594 size_t pos = 46 + strlen(tempbuffer) + 1;
1595 if (pos < BUFSIZEcxx . . $ `netgames/monsterball/monsterball.cpp:1442:9`!)
1596 buffer[pos] = '\0';
1597
1598 buffer[BUFSIZEcxx . . $ `netgames/monsterball/monsterball.cpp:1442:9`! - 1] = '\0';
1599 DLLcf_WriteString(file, buffer);
1600 }
1601 }
1602
1603 while (DMFCBasecxx . . $ DMFCBase.->FindPInfoStatNextcxx . . $ IDMFC#FindPInfoStatNext(4ead3766c292904).(&stat)) {
1604 if (stat.slotcxx . . $ tPInfoStat#slot. != p) {
1605 memset(buffer, ' ', BUFSIZEcxx . . $ `netgames/monsterball/monsterball.cpp:1442:9`!);
1606 dpr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(stat.slotcxx . . $ tPInfoStat#slot.);
1607 if (dpr) {
1608 strcpy(tempbuffer, dpr->callsigncxx . . $ player_record#callsign.);
1609 memcpy(buffer, tempbuffer, strlen(tempbuffer));
1610
1611 snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.killscxx . . $ tPInfoStat#kills.);
1612 memcpy(&buffer[30], tempbuffer, strlen(tempbuffer));
1613
1614 snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.deathscxx . . $ tPInfoStat#deaths.);
1615 memcpy(&buffer[40], tempbuffer, strlen(tempbuffer));
1616
1617 size_t pos = 40 + strlen(tempbuffer) + 1;
1618 if (pos < BUFSIZEcxx . . $ `netgames/monsterball/monsterball.cpp:1442:9`!)
1619 buffer[pos] = '\0';
1620
1621 buffer[BUFSIZEcxx . . $ `netgames/monsterball/monsterball.cpp:1442:9`! - 1] = '\0';
1622 DLLcf_WriteString(file, buffer);
1623 }
1624 }
1625 }
1626 }
1627 DMFCBasecxx . . $ DMFCBase.->FindPInfoStatClosecxx . . $ IDMFC#FindPInfoStatClose(49f6e7a06ebc5aa8).();
1628 DLLcf_WriteString(file, ""); // skip a line
1629 count++;
1630 }
1631 }
1632
1633 // done writing stats
1634 DLLcfclose(file);
1635 DLLAddHUDMessage(TXT_STATSSAVEDcxx . . $ `netgames/monsterball/monsterstr.h:59:9`!);
1636 }
1637
1638 #define ROOTFILENAMEcxx . . $ `netgames/monsterball/monsterball.cpp:1638:9`! "MonsterBall"
1639 void OnSaveStatsToFilecxx . . $ OnSaveStatsToFile(49f6e7a06ebc5aa8).(void) {
1640 char filename[256];
1641 DMFCBasecxx . . $ DMFCBase.->GenerateStatFilenamecxx . . $ IDMFC#GenerateStatFilename(4d4dad76095ad7d8).(filename, ROOTFILENAMEcxx . . $ `netgames/monsterball/monsterball.cpp:1638:9`!, false);
1642 SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(filename);
1643 }
1644
1645 void OnLevelEndSaveStatsToFilecxx . . $ OnLevelEndSaveStatsToFile(49f6e7a06ebc5aa8).(void) {
1646 char filename[256];
1647 DMFCBasecxx . . $ DMFCBase.->GenerateStatFilenamecxx . . $ IDMFC#GenerateStatFilename(4d4dad76095ad7d8).(filename, ROOTFILENAMEcxx . . $ `netgames/monsterball/monsterball.cpp:1638:9`!, true);
1648 SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(filename);
1649 }
1650
1651 void OnDisconnectSaveStatsToFilecxx . . $ OnDisconnectSaveStatsToFile(49f6e7a06ebc5aa8).(void) {
1652 char filename[256];
1653 DMFCBasecxx . . $ DMFCBase.->GenerateStatFilenamecxx . . $ IDMFC#GenerateStatFilename(4d4dad76095ad7d8).(filename, ROOTFILENAMEcxx . . $ `netgames/monsterball/monsterball.cpp:1638:9`!, false);
1654 SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(filename);
1655 }
1656
1657 //////////////////////////////////////////////
1658 // NON-DMFC Functions
1659 //////////////////////////////////////////////
1660 void DisplayHUDScorescxx . . $ DisplayHUDScores(c7a20e4e05358911).(struct tHUDItemcxx . . $ tHUDItem# *hitem) {
1661 if (display_my_welcomecxx . . $ display_my_welcome.) {
1662 DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).());
1663 display_my_welcomecxx . . $ display_my_welcome. = false;
1664 }
1665
1666 if (!monsterball_info_setcxx . . $ monsterball_info_set. || !players_sortedcxx . . $ players_sorted. ||
1667 DisplayScoreScreencxx . . $ DisplayScoreScreen.) // interval hasn't been called yet or we are display the stats
1668 return;
1669
1670 int height = DLLgrfont_GetHeight((DMFCBasecxx . . $ DMFCBase.->GetGameFontTranslateArraycxx . . $ IDMFC#GetGameFontTranslateArray(a7741f82f5fc3640).())[HUD_FONT_INDEXcxx . . $ `Descent3/gamefont.h:97:9`!]) + 3;
1671 int y, x, team, p;
1672
1673 uint8_tcxx . . $ uint8_t# alpha = DMFCBasecxx . . $ DMFCBase.->ConvertHUDAlphacxx . . $ IDMFC#ConvertHUDAlpha(50106d451684defa).((uint8_tcxx . . $ uint8_t#)255);
1674
1675 if (!ValidateOwnercxx . . $ ValidateOwner(719e024848da80a4).(&p, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) {
1676 p = -1;
1677 }
1678
1679 y = (DMFCBasecxx . . $ DMFCBase.->GetGameWindowHcxx . . $ IDMFC#GetGameWindowH(b126dc7c1de90089).() / 2) - ((height * 2) / 2);
1680 x = 510;
1681
1682 team = DMFCBasecxx . . $ DMFCBase.->GetMyTeamcxx . . $ IDMFC#GetMyTeam(b126dc7c1de90089).();
1683 DLLRenderHUDText(DMFCBasecxx . . $ DMFCBase.->GetTeamColorcxx . . $ IDMFC#GetTeamColor(46cc46841198e427).(team), 255, 0, x, 0, TXT_SAVESTATSTEAMcxx . . $ `netgames/monsterball/monsterstr.h:52:9`!, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team));
1684
1685 int powerteam = -1;
1686 if (p != -1)
1687 powerteam = DMFCBasecxx . . $ DMFCBase.->GetPlayerTeamcxx . . $ IDMFC#GetPlayerTeam(7864480464b09eea).(p);
1688
1689 int myteam = DMFCBasecxx . . $ DMFCBase.->GetMyTeamcxx . . $ IDMFC#GetMyTeam(b126dc7c1de90089).();
1690 int team_count;
1691
1692 // determine coordinates to use here
1693 // we'll use a virtual width of 85 pixels on a 640x480 screen
1694 // so first determine the new width
1695 int name_width = 100.0f * DMFCBasecxx . . $ DMFCBase.->GetHudAspectXcxx . . $ IDMFC#GetHudAspectX(9b8c9e39889c762c).();
1696 int score_width = DLLgrtext_GetTextLineWidth("888");
1697 int name_x = DMFCBasecxx . . $ DMFCBase.->GetGameWindowWcxx . . $ IDMFC#GetGameWindowW(b126dc7c1de90089).() - name_width - score_width - 10;
1698 int score_x = DMFCBasecxx . . $ DMFCBase.->GetGameWindowWcxx . . $ IDMFC#GetGameWindowW(b126dc7c1de90089).() - score_width - 5;
1699 int icon_size = height - 3;
1700 int icon_x = name_x - icon_size - 3;
1701 DLLgrtext_SetAlpha(alpha);
1702 char name[256];
1703
1704 for (int i = 0; i < NumOfTeamscxx . . $ NumOfTeams.; i++) {
1705 team = SortedTeamscxx . . $ SortedTeams.[i];
1706
1707 if ((WhoJustScoredcxx . . $ WhoJustScored. != team) || (DisplayScoreBlinkcxx . . $ DisplayScoreBlink.)) {
1708 if (team == myteam && Highlight_bmpcxx . . $ Highlight_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) {
1709 // draw the highlite bar in the background
1710 DLLrend_SetAlphaValue(alpha * 0.50f);
1711 DLLrend_SetZBufferState(0);
1712 DLLrend_SetTextureType(TT_LINEARcxx . . $ TT_LINEAR.);
1713 DLLrend_SetLighting(LS_NONEcxx . . $ LS_NONE.);
1714 DLLrend_SetAlphaType(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!);
1715 DLLrend_DrawScaledBitmap(name_x - 2, y - 2, score_x + score_width + 2, y + height - 1, Highlight_bmpcxx . . $ Highlight_bmp., 0, 0, 1,
1716 1, 1.0, -1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1717 DLLrend_SetZBufferState(1);
1718 }
1719
1720 team_count = 0;
1721 for (int q = 0; q < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; q++) {
1722 if (DMFCBasecxx . . $ DMFCBase.->CheckPlayerNumcxx . . $ IDMFC#CheckPlayerNum(83c267b20bac841a).(q) && dPlayerscxx . . $ dPlayers.[q].teamcxx . . $ player#team. == team && !DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(83c267b20bac841a).(q))
1723 team_count++;
1724 }
1725
1726 DLLgrtext_SetColor(DMFCBasecxx . . $ DMFCBase.->GetTeamColorcxx . . $ IDMFC#GetTeamColor(46cc46841198e427).(team));
1727
1728 snprintf(name, sizeof(name), TXT_HUDSCOREcxx . . $ `netgames/monsterball/monsterstr.h:60:9`!, team_count, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team));
1729 DMFCBasecxx . . $ DMFCBase.->ClipStringcxx . . $ IDMFC#ClipString(8677479218165cd4).(name_width, name, true);
1730
1731 DLLgrtext_Printf(name_x, y, name);
1732 DLLgrtext_Printf(score_x, y, "[%d]", TeamScorescxx . . $ TeamScores.[team]);
1733 }
1734 y += height;
1735 }
1736 }
1737
1738 void GetLastHitInfocxx . . $ GetLastHitInfo(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) {
1739 int size = 0;
1740
1741 LastHitPnumcxx . . $ LastHitPnum. = (int8_t)MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &size);
1742 }
1743 void SendLastHitInfocxx . . $ SendLastHitInfo(49f6e7a06ebc5aa8).(void) {
1744 int size = 0;
1745 uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!];
1746
1747 DMFCBasecxx . . $ DMFCBase.->StartPacketcxx . . $ IDMFC#StartPacket(261852a8f74abaa0).(data, SPID_HITINFOcxx . . $ `netgames/monsterball/monsterball.cpp:184:9`!, &size);
1748
1749 MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(LastHitPnumcxx . . $ LastHitPnum., data, &size);
1750
1751 DMFCBasecxx . . $ DMFCBase.->SendPacketcxx . . $ IDMFC#SendPacket(49a5bbab55ea8abc).(data, size, SP_ALLcxx . . $ `netgames/includes/DMFC.h:435:9`!);
1752 }
1753
1754 void GetGameStartPacketcxx . . $ GetGameStartPacket(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) {
1755 int i, count = 0;
1756
1757 // team scores
1758 for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) {
1759 TeamScorescxx . . $ TeamScores.[i] = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count);
1760 }
1761
1762 // who has the Monsterball
1763 int8_t temp;
1764 temp = (int8_t)MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count);
1765 if (temp == -1) {
1766 Monsterball_infocxx . . $ Monsterball_info..owner_handlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#owner_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
1767 } else {
1768 if (DMFCBasecxx . . $ DMFCBase.->CheckPlayerNumcxx . . $ IDMFC#CheckPlayerNum(83c267b20bac841a).(temp))
1769 Monsterball_infocxx . . $ Monsterball_info..owner_handlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#owner_handle. = dObjectscxx . . $ dObjects.[dPlayerscxx . . $ dPlayers.[temp].objnumcxx . . $ player#objnum.].handlecxx . . $ object#handle.;
1770 else
1771 Monsterball_infocxx . . $ Monsterball_info..owner_handlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#owner_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
1772 }
1773
1774 monsterball_info_setcxx . . $ monsterball_info_set. = true;
1775
1776 temp = (int8_t)MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count);
1777 NumOfTeamscxx . . $ NumOfTeams. = temp;
1778
1779 // we need to find the objnum of the Monsterball...its there somewhere
1780 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "Looking for Monsterball in level\n");
1781 int objnum = -1;
1782
1783 for (i = 0; i < MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!; i++) {
1784 if ((dObjectscxx . . $ dObjects.[i].typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!) && (dObjectscxx . . $ dObjects.[i].idcxx . . $ object#id. == Monsterball_infocxx . . $ Monsterball_info..idcxx . . $ $anonymous_type_fbc4dbe14b124390_0#id.)) {
1785 // here it is
1786 objnum = i;
1787 break;
1788 }
1789 }
1790 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "Monsterball %s\n", (objnum == -1) ? "Not Found" : "Found");
1791 if (objnum == -1) {
1792 FatalError("Couldn't Find Monsterball when it should be there");
1793 }
1794
1795 Monsterball_infocxx . . $ Monsterball_info..objhandlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#objhandle. = dObjectscxx . . $ dObjects.[objnum].handlecxx . . $ object#handle.;
1796 }
1797
1798 void SendGameStartPacketcxx . . $ SendGameStartPacket(d4f767463ce0a6b3).(int pnum) {
1799 int i, count = 0;
1800 uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!];
1801
1802 DMFCBasecxx . . $ DMFCBase.->StartPacketcxx . . $ IDMFC#StartPacket(261852a8f74abaa0).(data, SPID_NEWPLAYERcxx . . $ `netgames/monsterball/monsterball.cpp:183:9`!, &count);
1803
1804 // add the team scores
1805 for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) {
1806 MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(TeamScorescxx . . $ TeamScores.[i], data, &count);
1807 }
1808
1809 int8_t temp;
1810 int p;
1811
1812 // who has the Monsterball if anyone
1813 if (ValidateOwnercxx . . $ ValidateOwner(719e024848da80a4).(&p, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) {
1814 temp = p;
1815 } else {
1816 temp = -1;
1817 }
1818 MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(temp, data, &count);
1819
1820 // number of teams
1821 temp = NumOfTeamscxx . . $ NumOfTeams.;
1822 MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(temp, data, &count);
1823
1824 // we're done
1825 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "Sending Game State to %s\n", dPlayers[pnum].callsign);
1826 DMFCBasecxx . . $ DMFCBase.->SendPacketcxx . . $ IDMFC#SendPacket(49a5bbab55ea8abc).(data, count, pnum);
1827 }
1828
1829 bool GetMonsterballInfocxx . . $ GetMonsterballInfo(83c267b20bac841a).(int id) {
1830 if (id == -1)
1831 return false;
1832
1833 Monsterball_infocxx . . $ Monsterball_info..idcxx . . $ $anonymous_type_fbc4dbe14b124390_0#id. = id;
1834
1835 // find the room with the RF_SPECIAL1
1836 for (int i = 0; i <= DMFCBasecxx . . $ DMFCBase.->GetHighestRoomIndexcxx . . $ IDMFC#GetHighestRoomIndex(b126dc7c1de90089).(); i++) {
1837 if (dRoomscxx . . $ dRooms.[i].flagscxx . . $ room#flags. & RF_SPECIAL1cxx . . $ `Descent3/room_external.h:185:9`!) {
1838 // here's the Monsterball!
1839 Monsterball_infocxx . . $ Monsterball_info..roomcxx . . $ $anonymous_type_fbc4dbe14b124390_0#room. = i;
1840 DLLComputeRoomCenter(&Monsterball_infocxx . . $ Monsterball_info..poscxx . . $ $anonymous_type_fbc4dbe14b124390_0#pos., &dRoomscxx . . $ dRooms.[i]);
1841 return true;
1842 }
1843 }
1844 return false;
1845 }
1846
1847 #define compGTcxx . . $ `netgames/monsterball/monsterball.cpp:1847:9`!(a, b) (a < b)
1848 // insert sort
1849 void SortTeamscxx . . $ SortTeams(49f6e7a06ebc5aa8).(void) {
1850 int t;
1851 int i, j;
1852
1853 // copy scores into scoreinfo array
1854 for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) {
1855 SortedTeamscxx . . $ SortedTeams.[i] = i;
1856 }
1857
1858 for (i = 1; i <= DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`! - 1; i++) {
1859 t = SortedTeamscxx . . $ SortedTeams.[i];
1860
1861 // Shift elements down until
1862 // insertion point found.
1863 for (j = i - 1; j >= 0 && compGTcxx . . $ `netgames/monsterball/monsterball.cpp:1847:9`!(TeamScores[SortedTeams[j]], TeamScores[t]); j--) {
1864 SortedTeamscxx . . $ SortedTeams.[j + 1] = SortedTeamscxx . . $ SortedTeams.[j];
1865 }
1866
1867 // insert
1868 SortedTeamscxx . . $ SortedTeams.[j + 1] = t;
1869 }
1870 }
1871
1872 void DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(int player_num) {
1873 char name_buffer[64];
1874 strcpy(name_buffer, (DMFCBasecxx . . $ DMFCBase.->GetPlayerscxx . . $ IDMFC#GetPlayers(51ff8e716a252304).())[player_num].callsigncxx . . $ player#callsign.);
1875
1876 if (player_num == DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()) {
1877 int team = DMFCBasecxx . . $ DMFCBase.->GetMyTeamcxx . . $ IDMFC#GetMyTeam(b126dc7c1de90089).();
1878 if (team == -1)
1879 return;
1880
1881 DLLAddHUDMessage(TXT_WELCOMEcxx . . $ `netgames/monsterball/monsterstr.h:61:9`!, name_buffer);
1882 DLLAddColoredHUDMessage(DMFCBasecxx . . $ DMFCBase.->GetTeamColorcxx . . $ IDMFC#GetTeamColor(46cc46841198e427).(team), TXT_ONTEAMcxx . . $ `netgames/monsterball/monsterstr.h:62:9`!, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team));
1883 } else {
1884 int team = dPlayerscxx . . $ dPlayers.[player_num].teamcxx . . $ player#team.;
1885 if (team == -1)
1886 return;
1887
1888 DLLAddColoredHUDMessage(DMFCBasecxx . . $ DMFCBase.->GetTeamColorcxx . . $ IDMFC#GetTeamColor(46cc46841198e427).(team), TXT_JOINEDcxx . . $ `netgames/monsterball/monsterstr.h:63:9`!, name_buffer, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team));
1889 }
1890 }
1891
1892 void OnTimerScorecxx . . $ OnTimerScore(49f6e7a06ebc5aa8).(void) { DisplayScoreBlinkcxx . . $ DisplayScoreBlink. = !DisplayScoreBlinkcxx . . $ DisplayScoreBlink.; }
1893 void OnTimerScoreKillcxx . . $ OnTimerScoreKill(49f6e7a06ebc5aa8).(void) {
1894 DisplayScoreBlinkcxx . . $ DisplayScoreBlink. = true;
1895 WhoJustScoredcxx . . $ WhoJustScored. = WhoJustScoredTimercxx . . $ WhoJustScoredTimer. = -1;
1896 }
1897
1898 // -------------------------------------------------------------------------
1899
1900 void HandleMonsterballCollideWithObjectcxx . . $ HandleMonsterballCollideWithObject(584c77d2760d8df8).(objectcxx . . $ object# *ball, objectcxx . . $ object# *player, vectorcxx . . $ vector# *point, vectorcxx . . $ vector# *normal) {
1901 static int sound = -1;
1902 if (sound == -1)
1903 sound = DLLFindSoundName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(MONSTERBALL_SND_HITcxx . . $ `netgames/monsterball/monsterball.cpp:189:9`!));
1904 if (sound != -1)
1905 DLLPlay3dSound(sound, ball, MAX_GAME_VOLUMEcxx . . $ `netgames/includes/gamedll_header.h:59:9`! / 3, 0);
1906
1907 // bump_object(ball,&player->mtype.phys_info.rotvel,&player->mtype.phys_info.velocity,
1908 // &player->pos, &player->orient, player->mtype.phys_info.mass, player->size,point,normal,1.0f,1.0f);
1909 }
1910
1911 void HandleMonsterballCollideWithWeaponcxx . . $ HandleMonsterballCollideWithWeapon(11f88944088ca047).(objectcxx . . $ object# *ball, weapon_collide_infocxx . . $ weapon_collide_info# *winfo, vectorcxx . . $ vector# *point, vectorcxx . . $ vector# *normal) {
1912 static int sound = -1;
1913 if (sound == -1)
1914 sound = DLLFindSoundName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(MONSTERBALL_SND_HITcxx . . $ `netgames/monsterball/monsterball.cpp:189:9`!));
1915 if (sound != -1)
1916 DLLPlay3dSound(sound, ball, 0, 0); // FIXME: volume was set to 0 here, is that right?
1917
1918 bump_objectcxx . . $ bump_object(7e4af21ed1fe297c).(ball, &winfo->rotvelcxx . . $ weapon_collide_info#rotvel., &winfo->velocitycxx . . $ weapon_collide_info#velocity., &winfo->poscxx . . $ weapon_collide_info#pos., &winfo->orientcxx . . $ weapon_collide_info#orient., winfo->masscxx . . $ weapon_collide_info#mass., winfo->sizecxx . . $ weapon_collide_info#size., point,
1919 normal, -0.3f, 5.0f);
1920 }
1921
1922 void bump_objectcxx . . $ bump_object(7e4af21ed1fe297c).(objectcxx . . $ object# *object0, vectorcxx . . $ vector# *rotvel, vectorcxx . . $ vector# *velocity, vectorcxx . . $ vector# *pos, matrixcxx . . $ matrix# *orient, float mass, float size,
1923 vectorcxx . . $ vector# *collision_point, vectorcxx . . $ vector# *collision_normal, float rot_scalar, float vel_scalar) {
1924 objectcxx . . $ object# *t = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1925 objectcxx . . $ object# *other = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1926
1927 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(std::isfinite(rotvel->x));
1928 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(std::isfinite(rotvel->y));
1929 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(std::isfinite(rotvel->z));
1930 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(std::isfinite(object0->mtype.phys_info.rotvel.x));
1931 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(std::isfinite(object0->mtype.phys_info.rotvel.y));
1932 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(std::isfinite(object0->mtype.phys_info.rotvel.z));
1933 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(std::isfinite(velocity->x));
1934 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(std::isfinite(velocity->y));
1935 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(std::isfinite(velocity->z));
1936 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(std::isfinite(object0->mtype.phys_info.velocity.x));
1937 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(std::isfinite(object0->mtype.phys_info.velocity.y));
1938 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(std::isfinite(object0->mtype.phys_info.velocity.z));
1939
1940 vectorcxx . . $ vector# r1 = *collision_point -cxx . . $ operator-(b77b703cd1e43e33). object0->poscxx . . $ object#pos.;
1941 vectorcxx . . $ vector# r2 = *collision_point -cxx . . $ operator-(b77b703cd1e43e33). (*pos);
1942 vectorcxx . . $ vector# w1;
1943 vectorcxx . . $ vector# w2;
1944 vectorcxx . . $ vector# n1;
1945 vectorcxx . . $ vector# n2;
1946 float temp1;
1947 float temp2;
1948
1949 float j;
1950
1951 matrixcxx . . $ matrix# o_t1 = object0->orientcxx . . $ object#orient.;
1952 matrixcxx . . $ matrix# o_t2 = *orient;
1953
1954 DLLvm_TransposeMatrix(&o_t1);
1955 DLLvm_TransposeMatrix(&o_t2);
1956
1957 vectorcxx . . $ vector# cmp1 = object0->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotvelcxx . . $ physics_info#$anonymous_type_1#rotvel. *cxx . . $ `operator*`(14b8f9ac5c1e7b85). o_t1;
1958 vectorcxx . . $ vector# cmp2 = (*rotvel) *cxx . . $ `operator*`(14b8f9ac5c1e7b85). o_t2;
1959
1960 DLLConvertEulerToAxisAmount(&cmp1, &n1, &temp1);
1961 DLLConvertEulerToAxisAmount(&cmp2, &n2, &temp2);
1962
1963 n1 *=cxx . . $ `operator*=`(f132838b2cd11d6). temp1;
1964 n2 *=cxx . . $ `operator*=`(f132838b2cd11d6). temp2;
1965
1966 if (temp1 != 0.0f) {
1967 DLLvm_CrossProduct(&w1, &n1, &r1);
1968 } else {
1969 w1.xcxx . . $ vector#x. = 0;
1970 w1.ycxx . . $ vector#y. = 0;
1971 w1.zcxx . . $ vector#z. = 0;
1972 }
1973
1974 if (temp2 != 0.0f) {
1975 DLLvm_CrossProduct(&w2, &n2, &r2);
1976 } else {
1977 w2.xcxx . . $ vector#x. = 0;
1978 w2.ycxx . . $ vector#y. = 0;
1979 w2.zcxx . . $ vector#z. = 0;
1980 }
1981
1982 vectorcxx . . $ vector# p1 = object0->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. +cxx . . $ operator+(b77b703cd1e43e33). w1;
1983 vectorcxx . . $ vector# p2 = (*velocity) +cxx . . $ operator+(b77b703cd1e43e33). w2;
1984 float v_rel;
1985
1986 float m1 = object0->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..masscxx . . $ physics_info#mass.;
1987 float m2 = mass;
1988
1989 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(m1 != 0.0f && m2 != 0.0f);
1990
1991 v_rel = *collision_normal *cxx . . $ `operator*`(4a721543d64e126a). (p1 -cxx . . $ operator-(b77b703cd1e43e33). p2);
1992
1993 float e;
1994 e = vel_scalar;
1995
1996 vectorcxx . . $ vector# c1;
1997 vectorcxx . . $ vector# c2;
1998 vectorcxx . . $ vector# cc1;
1999 vectorcxx . . $ vector# cc2;
2000 float cv1;
2001 float cv2;
2002
2003 float i1 = (2.0f / 5.0f) * m1 * object0->sizecxx . . $ object#size. * object0->sizecxx . . $ object#size.;
2004 float i2 = (2.0f / 5.0f) * m2 * size;
2005
2006 if (i1 < .0000001)
2007 i1 = .0000001f;
2008 if (i2 < .0000001)
2009 i2 = .0000001f;
2010
2011 DLLvm_CrossProduct(&c1, &r1, collision_normal);
2012 DLLvm_CrossProduct(&c2, &r2, collision_normal);
2013
2014 c1 =cxx . . $ vector#`operator=`(c0842353a20857d). c1 /cxx . . $ `operator/`(252247219a31502c). i1;
2015 c2 =cxx . . $ vector#`operator=`(c0842353a20857d). c2 /cxx . . $ `operator/`(252247219a31502c). i2;
2016
2017 DLLvm_CrossProduct(&cc1, &c1, &r1);
2018 DLLvm_CrossProduct(&cc2, &c2, &r2);
2019
2020 cv1 = (*collision_normal) *cxx . . $ `operator*`(4a721543d64e126a). c1;
2021 cv2 = (*collision_normal) *cxx . . $ `operator*`(4a721543d64e126a). c2;
2022
2023 j = (-(1.0f + e)) * v_rel;
2024 j /= (1 / m1 + 1 / m2 + cv1 + cv2);
2025
2026 // apply the force to the player
2027 vectorcxx . . $ vector# new_vel;
2028 new_vel =cxx . . $ vector#`operator=`(c0842353a20857d). ((j *cxx . . $ `operator*`(9d6577ff3e9faa29). (*collision_normal)) /cxx . . $ `operator/`(252247219a31502c). m1);
2029
2030 // make sure the velocity falls within a valid range
2031 float mag = DLLvm_GetMagnitudeFast(&new_vel);
2032
2033 new_vel /=cxx . . $ `operator/=`(f132838b2cd11d6). mag;
2034
2035 mag = stdcxx . . $ std/::clampcxx . . $ std/clamp(3dbe0c69cb86ae06).(mag, 10.0f, 20.0f);
2036
2037 new_vel *=cxx . . $ `operator*=`(f132838b2cd11d6). mag;
2038
2039 object0->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..velocitycxx . . $ physics_info#velocity. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). new_vel;
2040
2041 vectorcxx . . $ vector# jcn = j *cxx . . $ `operator*`(9d6577ff3e9faa29). (*collision_normal);
2042
2043 DLLvm_CrossProduct(&c1, &r1, &jcn);
2044
2045 n1 =cxx . . $ vector#`operator=`(c0842353a20857d). (c1) /cxx . . $ `operator/`(252247219a31502c). i1;
2046
2047 temp1 = DLLvm_NormalizeVector(&n1);
2048
2049 vectorcxx . . $ vector# txx1;
2050 DLLConvertAxisAmountToEuler(&n1, &temp1, &txx1);
2051
2052 float rotscale1;
2053 rotscale1 = rot_scalar;
2054
2055 // change the player's rotational velocity
2056 object0->mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..rotvelcxx . . $ physics_info#$anonymous_type_1#rotvel. +=cxx . . $ `operator+=`(801a8d6f7ab7bef9). (txx1 *cxx . . $ `operator*`(14b8f9ac5c1e7b85). object0->orientcxx . . $ object#orient.) *cxx . . $ `operator*`(252247219a31502c). rotscale1;
2057
2058 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(std::isfinite(object0->mtype.phys_info.rotvel.x));
2059 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(std::isfinite(object0->mtype.phys_info.rotvel.y));
2060 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(std::isfinite(object0->mtype.phys_info.rotvel.z));
2061 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(std::isfinite(object0->mtype.phys_info.velocity.x));
2062 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(std::isfinite(object0->mtype.phys_info.velocity.y));
2063 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(std::isfinite(object0->mtype.phys_info.velocity.z));
2064 }
2065
2066 bool ValidateOwnercxx . . $ ValidateOwner(719e024848da80a4).(int *pnum, objectcxx . . $ object# **obj) {
2067 if (Monsterball_infocxx . . $ Monsterball_info..owner_handlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#owner_handle. == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!)
2068 return false;
2069
2070 objectcxx . . $ object# *owner;
2071 if (!DLLObjGet(Monsterball_infocxx . . $ Monsterball_info..owner_handlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#owner_handle., &owner)) {
2072 // the object no longer exists
2073 Monsterball_infocxx . . $ Monsterball_info..owner_handlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#owner_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
2074 return false;
2075 }
2076
2077 if (owner->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! || (dPlayerscxx . . $ dPlayers.[owner->idcxx . . $ object#id.].flagscxx . . $ player#flags. & (PLAYER_FLAGS_DYINGcxx . . $ `Descent3/player_external.h:80:9`! | PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`!))) {
2078 // the owner isn't a player playing
2079 Monsterball_infocxx . . $ Monsterball_info..owner_handlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#owner_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!;
2080 return false;
2081 }
2082
2083 if (pnum)
2084 *pnum = owner->idcxx . . $ object#id.;
2085 if (obj)
2086 *obj = owner;
2087 return true;
2088 }
2089
2090 void DoMonsterballScoreEffectcxx . . $ DoMonsterballScoreEffect(49f6e7a06ebc5aa8).(void) {
2091 objectcxx . . $ object# *Monsterball;
2092 if (!DLLObjGet(Monsterball_infocxx . . $ Monsterball_info..objhandlecxx . . $ $anonymous_type_fbc4dbe14b124390_0#objhandle., &Monsterball))
2093 return;
2094
2095 vectorcxx . . $ vector# start_pos, end_pos;
2096 int start_room, end_room;
2097 bool doing_start = false;
2098
2099 vectorcxx . . $ vector# m_pos, i_pos;
2100 int m_room, i_room;
2101
2102 m_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Monsterball->poscxx . . $ object#pos.;
2103 m_room = Monsterball->roomnumcxx . . $ object#roomnum.;
2104 i_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). Monsterball_infocxx . . $ Monsterball_info..poscxx . . $ $anonymous_type_fbc4dbe14b124390_0#pos.;
2105 i_room = Monsterball_infocxx . . $ Monsterball_info..roomcxx . . $ $anonymous_type_fbc4dbe14b124390_0#room.;
2106
2107 //////////////////////////////////////
2108 float lifetime = 4.0f;
2109 float thickness = 17.5f;
2110 float slidetime = 0.3f;
2111 uint16_tcxx . . $ uint16_t# color = GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(30, 255, 30);
2112 int numtiles = 1;
2113 bool autotile = true;
2114 int sat_count = 2;
2115 int texture_id = DLLFindTextureName("ThickLineLightning");
2116 //////////////////////////////////////
2117
2118 for (int q = 0; q < 2; q++) {
2119 ////////////////////////////////
2120 vectorcxx . . $ vector# check_pos;
2121 fvi_querycxx . . $ fvi_query# fq;
2122 fvi_infocxx . . $ fvi_info# hit_data;
2123 int hit_type;
2124
2125 fq.p0cxx . . $ fvi_query#p0. = (doing_start) ? &m_pos : &i_pos;
2126 fq.p1cxx . . $ fvi_query#p1. = &check_pos;
2127 fq.startroomcxx . . $ fvi_query#startroom. = (doing_start) ? m_room : i_room;
2128 fq.radcxx . . $ fvi_query#rad. = 3.0f;
2129 fq.flagscxx . . $ fvi_query#flags. = FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`! | FQ_IGNORE_NON_LIGHTMAP_OBJECTScxx . . $ `lib/findintersection_external.h:68:9`!;
2130 fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = Monsterball - dObjectscxx . . $ dObjects.;
2131 fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
2132
2133 // find top of room
2134 check_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). (doing_start) ? m_pos : i_pos;
2135 check_pos.ycxx . . $ vector#y. *= 50000;
2136 hit_type = DLLfvi_FindIntersection(&fq, &hit_data, false);
2137
2138 if (hit_type == HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`!)
2139 return;
2140
2141 start_room = hit_data.hit_roomcxx . . $ fvi_info#hit_room.;
2142 start_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). hit_data.hit_pntcxx . . $ fvi_info#hit_pnt.;
2143
2144 check_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). (doing_start) ? m_pos : i_pos;
2145 check_pos.ycxx . . $ vector#y. *= -50000;
2146 hit_type = DLLfvi_FindIntersection(&fq, &hit_data, false);
2147
2148 if (hit_type == HIT_NONEcxx . . $ `lib/findintersection_external.h:45:9`!)
2149 return;
2150
2151 end_room = hit_data.hit_roomcxx . . $ fvi_info#hit_room.;
2152 end_pos =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). hit_data.hit_pntcxx . . $ fvi_info#hit_pnt.;
2153
2154 int visnum = DLLVisEffectCreate(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, THICK_LIGHTNING_INDEXcxx . . $ `Descent3/fireball_external.h:62:9`!, start_room, &start_pos);
2155 if (visnum >= 0) {
2156 vis_effectcxx . . $ vis_effect# *vis = &dVisEffectscxx . . $ dVisEffects.[visnum];
2157 vis->lifeleftcxx . . $ vis_effect#lifeleft. = lifetime;
2158 vis->lifetimecxx . . $ vis_effect#lifetime. = lifetime;
2159 vis->end_poscxx . . $ vis_effect#end_pos. =cxx . . $ vector#`operator=`(a48bc7e93a8dae5e). end_pos;
2160
2161 vis->custom_handlecxx . . $ vis_effect#custom_handle. = texture_id;
2162
2163 vis->lighting_colorcxx . . $ vis_effect#lighting_color. = color;
2164 vis->billboard_infocxx . . $ vis_effect#billboard_info..widthcxx . . $ axis_billboard_info#width. = thickness;
2165 vis->billboard_infocxx . . $ vis_effect#billboard_info..texturecxx . . $ axis_billboard_info#texture. = autotile;
2166 vis->velocitycxx . . $ vis_effect#velocity..xcxx . . $ vector#x. = sat_count;
2167 vis->velocitycxx . . $ vis_effect#velocity..ycxx . . $ vector#y. = slidetime;
2168 vis->velocitycxx . . $ vis_effect#velocity..zcxx . . $ vector#z. = numtiles;
2169
2170 vis->flagscxx . . $ vis_effect#flags. = VF_USES_LIFELEFTcxx . . $ `Descent3/viseffect_external.h:64:9`! | VF_WINDSHIELD_EFFECTcxx . . $ `Descent3/viseffect_external.h:65:9`! | VF_LINK_TO_VIEWERcxx . . $ `Descent3/viseffect_external.h:72:9`! | VF_EXPANDcxx . . $ `Descent3/viseffect_external.h:69:9`!;
2171 vis->sizecxx . . $ vis_effect#size. = DLLvm_VectorDistanceQuick(&vis->poscxx . . $ vis_effect#pos., &vis->end_poscxx . . $ vis_effect#end_pos.);
2172 }
2173
2174 color = GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(100, 255, 150);
2175 visnum = DLLVisEffectCreate(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, SUN_CORONA_INDEXcxx . . $ `Descent3/fireball_external.h:60:9`!, start_room, &start_pos);
2176 if (visnum >= 0) {
2177 vis_effectcxx . . $ vis_effect# *vis = &dVisEffectscxx . . $ dVisEffects.[visnum];
2178 vis->lifeleftcxx . . $ vis_effect#lifeleft. = lifetime;
2179 vis->lifetimecxx . . $ vis_effect#lifetime. = lifetime;
2180
2181 vis->lighting_colorcxx . . $ vis_effect#lighting_color. = color;
2182
2183 vis->flagscxx . . $ vis_effect#flags. = VF_USES_LIFELEFTcxx . . $ `Descent3/viseffect_external.h:64:9`! | VF_WINDSHIELD_EFFECTcxx . . $ `Descent3/viseffect_external.h:65:9`! | VF_LINK_TO_VIEWERcxx . . $ `Descent3/viseffect_external.h:72:9`!;
2184 vis->sizecxx . . $ vis_effect#size. = 4;
2185 }
2186 visnum = DLLVisEffectCreate(VIS_FIREBALLcxx . . $ `Descent3/viseffect_external.h:61:9`!, SUN_CORONA_INDEXcxx . . $ `Descent3/fireball_external.h:60:9`!, end_room, &end_pos);
2187 if (visnum >= 0) {
2188 vis_effectcxx . . $ vis_effect# *vis = &dVisEffectscxx . . $ dVisEffects.[visnum];
2189 vis->lifeleftcxx . . $ vis_effect#lifeleft. = lifetime;
2190 vis->lifetimecxx . . $ vis_effect#lifetime. = lifetime;
2191
2192 vis->lighting_colorcxx . . $ vis_effect#lighting_color. = color;
2193
2194 vis->flagscxx . . $ vis_effect#flags. = VF_USES_LIFELEFTcxx . . $ `Descent3/viseffect_external.h:64:9`! | VF_WINDSHIELD_EFFECTcxx . . $ `Descent3/viseffect_external.h:65:9`! | VF_LINK_TO_VIEWERcxx . . $ `Descent3/viseffect_external.h:72:9`!;
2195 vis->sizecxx . . $ vis_effect#size. = 4;
2196 }
2197
2198 DLLCreateRandomSparks(randcxx . . $ rand(9efc7249d839d30e).() % 200 + 50, (doing_start) ? &m_pos : &i_pos, (doing_start) ? m_room : i_room,
2199 HOT_SPARK_INDEXcxx . . $ `Descent3/fireball_external.h:37:9`!, (randcxx . . $ rand(9efc7249d839d30e).() % 3) + 2);
2200
2201 doing_start = !doing_start;
2202 }
2203
2204 if (Monsterball->effect_infocxx . . $ object#effect_info.) {
2205 Monsterball->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. &= ~EF_CLOAKEDcxx . . $ `Descent3/object_external.h:197:9`!;
2206 Monsterball->effect_infocxx . . $ object#effect_info.->type_flagscxx . . $ effect_info_s#type_flags. |= EF_FADING_INcxx . . $ `Descent3/object_external.h:206:9`!;
2207 Monsterball->effect_infocxx . . $ object#effect_info.->fade_timecxx . . $ effect_info_s#fade_time. = 4.0f;
2208 Monsterball->effect_infocxx . . $ object#effect_info.->cloak_timecxx . . $ effect_info_s#cloak_time. = 0;
2209 Monsterball->effect_infocxx . . $ object#effect_info.->fade_max_timecxx . . $ effect_info_s#fade_max_time. = 4.0f;
2210 }
2211 }