Debian Codegraph @

netgames/hyperanarchy/hyperanarchy.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/hyperanarchy/hyperanarchy.cpp $
21 * $Revision: 1.1.1.1 $
22 * $Date: 2003/08/26 03:57:56 $
23 * $Author: kevinb $
24 *
25 * <insert description of file here>
26 *
27 * $Log: hyperanarchy.cpp,v $
28 * Revision 1.1.1.1 2003/08/26 03:57:56 kevinb
29 * initial 1.5 import
30 *
31 *
32 * 68 10/21/99 9:27p Jeff
33 * B.A. Macintosh code merge
34 *
35 * 67 7/12/99 1:22p Jeff
36 * updated for new netflags
37 *
38 * 66 7/11/99 6:45p Jeff
39 * cleaner plr if the list is too long
40 *
41 * 65 5/23/99 3:04a Jason
42 * fixed bug with player rankings not being updated correctly
43 *
44 * 64 5/20/99 5:03p Jeff
45 * fixed HUD display bugs
46 *
47 * 63 5/12/99 11:04p Jeff
48 * dmfc and multiplayer games now have endian friendly packets (*whew*)
49 *
50 * 62 5/12/99 11:28a Jeff
51 * added sourcesafe comment block
52 *
53 * $NoKeywords: $
54 */
55
56 #include <stdlib.h>
57 #include <string.h>
58 #include "gamedll_header.h"cxx . . $ `<file>/netgames/includes/gamedll_header.h`/
59 #include "idmfc.h"cxx . . $ `<file>/netgames/includes/idmfc.h`/
60 #include "HyperAnarchy.h"cxx . . $ `<file>/netgames/hyperanarchy/HyperAnarchy.h`/
61 #include "hyperstr.h"cxx . . $ `<file>/netgames/hyperanarchy/hyperstr.h`/
62 IDMFCcxx . . $ IDMFC# *DMFCBasecxx . . $ DMFCBase. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
63 static IDmfcStatscxx . . $ IDmfcStats# *dstatcxx . . $ dstat. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
64 static objectcxx . . $ object# *dObjectscxx . . $ dObjects.;
65 static playercxx . . $ player# *dPlayerscxx . . $ dPlayers.;
66
67 #define SPID_HYPERINFOcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:67:9`! 0
68 #define SPID_HYPERPOScxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:68:9`! 1
69 #define HCM_PLAYERCOLORcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:69:9`! 0
70 #define HCM_NORMALcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:70:9`! 1
71
72 struct tPlayerStatcxx . . $ tPlayerStat# {
73 int Scorecxx . . $ tPlayerStat#Score.[2];
74 };
75
76 static int pack_pstatcxx . . $ pack_pstat(60b9885aab282f36).(tPlayerStatcxx . . $ tPlayerStat# *user_info, uint8_tcxx . . $ uint8_t# *data);
77 static int unpack_pstatcxx . . $ unpack_pstat(60b9885aab282f36).(tPlayerStatcxx . . $ tPlayerStat# *user_info, uint8_tcxx . . $ uint8_t# *data);
78
79 int pack_pstatcxx . . $ pack_pstat(60b9885aab282f36).(tPlayerStatcxx . . $ tPlayerStat# *user_info, uint8_tcxx . . $ uint8_t# *data) {
80 int count = 0;
81 MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(user_info->Scorecxx . . $ tPlayerStat#Score.[0], data, &count);
82 MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(user_info->Scorecxx . . $ tPlayerStat#Score.[1], data, &count);
83 return count;
84 }
85
86 int unpack_pstatcxx . . $ unpack_pstat(60b9885aab282f36).(tPlayerStatcxx . . $ tPlayerStat# *user_info, uint8_tcxx . . $ uint8_t# *data) {
87 int count = 0;
88 user_info->Scorecxx . . $ tPlayerStat#Score.[0] = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count);
89 user_info->Scorecxx . . $ tPlayerStat#Score.[1] = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count);
90 return count;
91 }
92
93 static int SortedPlayerscxx . . $ SortedPlayers.[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!];
94 static bool DisplayScoreScreencxx . . $ DisplayScoreScreen.;
95 static int HyperOrbIDcxx . . $ HyperOrbID. = -1;
96 static int WhoHasOrbcxx . . $ WhoHasOrb. = -1;
97 static int KillCountcxx . . $ KillCount. = 0;
98 static int HyperOrbIconcxx . . $ HyperOrbIcon. = -1;
99 static bool DisplayFlagBlinkcxx . . $ DisplayFlagBlink. = true;
100 static int WhoJustScoredTimercxx . . $ WhoJustScoredTimer. = -1;
101 static int HyperMoveTimercxx . . $ HyperMoveTimer. = -1;
102 static uint8_tcxx . . $ uint8_t# HUD_color_modelcxx . . $ HUD_color_model. = HCM_PLAYERCOLORcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:69:9`!;
103 static int Highlight_bmpcxx . . $ Highlight_bmp. = -1;
104 static bool display_my_welcomecxx . . $ display_my_welcome. = false;
105
106 static void OnClientPlayerEntersGamecxx . . $ OnClientPlayerEntersGame(d4f767463ce0a6b3).(int player_num);
107
108 ///////////////////////////////////////////////
109 // localization info
110 static char **StringTablecxx . . $ StringTable.;
111 static int StringTableSizecxx . . $ StringTableSize. = 0;
112 static const char *_ErrorStringcxx . . $ _ErrorString. = "Missing String";
113 const char *GetStringFromTablecxx . . $ GetStringFromTable(f7ae7e56280f18ae).(int d) {
114 if ((d < 0) || (d >= StringTableSizecxx . . $ StringTableSize.))
115 return _ErrorStringcxx . . $ _ErrorString.;
116 else
117 return StringTablecxx . . $ StringTable.[d];
118 }
119 ///////////////////////////////////////////////
120
121 static void SwitchHUDColorcxx . . $ SwitchHUDColor(d4f767463ce0a6b3).(int i);
122 // handles a Hyper Anarchy Game State packet
123 static void ReceiveHyperGameStatecxx . . $ ReceiveHyperGameState(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data);
124 // sends a Hyper Anarchy Game State packet
125 static void SendHyperGameStatecxx . . $ SendHyperGameState(d4f767463ce0a6b3).(int playernum);
126 // Displays HUD scores
127 static void DisplayHUDScorescxx . . $ DisplayHUDScores(c7a20e4e05358911).(struct tHUDItemcxx . . $ tHUDItem# *hitem);
128 // Displays the Stats screen
129 static void DisplayScorescxx . . $ DisplayScores(49f6e7a06ebc5aa8).(void);
130 // Sorts based on score
131 static void SortPlayerScorescxx . . $ SortPlayerScores(621ccea12ecf5b06).(int *sortedindex, int size);
132 // Updates the effect on all the players
133 static void UpdateEffectcxx . . $ UpdateEffect(49f6e7a06ebc5aa8).(void);
134 // Displays the Welcome Screen
135 static void DisplayWelcomeScreencxx . . $ DisplayWelcomeScreen(d4f767463ce0a6b3).(int pnum);
136 // Handler for menu item for turning on/off blinking hud
137 static void SwitchBlinkingHudcxx . . $ SwitchBlinkingHud(d4f767463ce0a6b3).(int i);
138 // Generates a valid random room
139 static int GetRandomValidRoomcxx . . $ GetRandomValidRoom(b126dc7c1de90089).(void);
140 // Moves the HyperOrb to the center of a random room
141 // if objnum is -1, than the HyperOrb is created and moved
142 static void MoveHyperOrbToRoomcxx . . $ MoveHyperOrbToRoom(d4f767463ce0a6b3).(int objnum);
143 // Given a room the HyperOrb is created and placed in the center of it
144 static void CreateHyperOrbInRoomcxx . . $ CreateHyperOrbInRoom(d4f767463ce0a6b3).(int room);
145 // Given the objnum and room it will move the HyperOrb to the center of that room. Objnum better be valid.
146 static void MoveHyperOrbToRoomCentercxx . . $ MoveHyperOrbToRoomCenter(3e454b8ccf442868).(int objnum, int room);
147 // handles a Hyper Anarchy Object Placement packet
148 static void ReceiveHyperPoscxx . . $ ReceiveHyperPos(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data);
149 // Searches through all the objects and looks for the HyperOrb, returns it's objnum. -1 if it doesn't exist
150 static int FindHyperObjectNumcxx . . $ FindHyperObjectNum(b126dc7c1de90089).(void);
151 // Searches through all the player's inventory, returns the pnum of the player who has the HyperOrb, -1
152 // if no one does.
153 static int FindHyperOrbInInventorycxx . . $ FindHyperOrbInInventory(b126dc7c1de90089).(void);
154 static void ResetTimercxx . . $ ResetTimer(49f6e7a06ebc5aa8).(void);
155 static void SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(char *filename);
156
157 void DetermineScorecxx . . $ DetermineScore(74c02bb7c84e7fae).(int precord_num, int column_num, char *buffer, int buffer_size) {
158 player_recordcxx . . $ player_record# *pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(precord_num);
159 if (!pr || pr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.) {
160 buffer[0] = '\0';
161 return;
162 }
163
164 tPlayerStatcxx . . $ tPlayerStat# *stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.;
165
166 snprintf(buffer, buffer_size, "%d[%d]", stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!], stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
167 }
168
169 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) {
170 player_recordcxx . . $ player_record# *pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(precord_num);
171
172 if (pr && pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) {
173 if (WhoHasOrbcxx . . $ WhoHasOrb. == pr->pnumcxx . . $ player_record#pnum.) {
174 // draw hyper orb icon
175 DLLRenderHUDQuad(x + 3, y, 10, 10, 0, 0, 1, 1, HyperOrbIconcxx . . $ HyperOrbIcon., alpha_to_use, 0);
176 }
177 }
178 }
179
180 // Timer handlers
181 void OnTimercxx . . $ OnTimer(49f6e7a06ebc5aa8).(void);
182 void OnTimerKillcxx . . $ OnTimerKill(49f6e7a06ebc5aa8).(void);
183 void OnTimerFlagReturncxx . . $ OnTimerFlagReturn(49f6e7a06ebc5aa8).(void);
184 void OnTimerFlagReturnKillcxx . . $ OnTimerFlagReturnKill(49f6e7a06ebc5aa8).(void);
185
186 // This function gets called by the game when it wants to learn some info about the game
187 void DLLFUNCCALLcxx . . $ `lib/module.h:93:10`! DLLGetGameInfocxx . . $ DLLGetGameInfo(e5c6dce1fbda187a).(tDLLOptionscxx . . $ tDLLOptions# *options) {
188 options->flagscxx . . $ tDLLOptions#flags. = DOF_MAXTEAMScxx . . $ `netgames/includes/gamedll_header.h:105:9`!;
189 options->max_teamscxx . . $ tDLLOptions#max_teams. = 1;
190 strcpy(options->game_namecxx . . $ tDLLOptions#game_name., TXT_GAMENAMEcxx . . $ `netgames/hyperanarchy/hyperstr.h:44:9`!);
191 strcpy(options->requirementscxx . . $ tDLLOptions#requirements., "");
192 }
193
194 // Initializes the game function pointers
195 void DLLFUNCCALLcxx . . $ `lib/module.h:93:10`! DLLGameInitcxx . . $ DLLGameInit(937c1f75cb8fa6b1).(int *api_func, uint8_tcxx . . $ uint8_t# *all_ok, int num_teams_to_use) {
196 *all_ok = 1;
197 DMFCBasecxx . . $ DMFCBase. = CreateDMFC();
198 if (!DMFCBasecxx . . $ DMFCBase.) {
199 *all_ok = 0;
200 return;
201 }
202
203 dstatcxx . . $ dstat. = CreateDmfcStats();
204 if (!dstatcxx . . $ dstat.) {
205 *all_ok = 0;
206 return;
207 }
208
209 DMFCBasecxx . . $ DMFCBase.->LoadFunctionscxx . . $ IDMFC#LoadFunctions(11b0e290e57a7e53).(api_func);
210
211 DMFCBasecxx . . $ DMFCBase.->Set_OnIntervalcxx . . $ IDMFC#Set_OnInterval(964b12a25712bdc3).(OnIntervalcxx . . $ OnInterval(49f6e7a06ebc5aa8).);
212 DMFCBasecxx . . $ DMFCBase.->Set_OnHUDIntervalcxx . . $ IDMFC#Set_OnHUDInterval(964b12a25712bdc3).(OnHUDIntervalcxx . . $ OnHUDInterval(49f6e7a06ebc5aa8).);
213 DMFCBasecxx . . $ DMFCBase.->Set_OnKeypresscxx . . $ IDMFC#Set_OnKeypress(94eb4457dc8d4d10).(OnKeypresscxx . . $ OnKeypress(d4f767463ce0a6b3).);
214 DMFCBasecxx . . $ DMFCBase.->Set_OnServerGameCreatedcxx . . $ IDMFC#Set_OnServerGameCreated(964b12a25712bdc3).(OnServerGameCreatedcxx . . $ OnServerGameCreated(49f6e7a06ebc5aa8).);
215 DMFCBasecxx . . $ DMFCBase.->Set_OnServerLevelStartcxx . . $ IDMFC#Set_OnServerLevelStart(964b12a25712bdc3).(OnServerLevelStartcxx . . $ OnServerLevelStart(49f6e7a06ebc5aa8).);
216 DMFCBasecxx . . $ DMFCBase.->Set_OnClientLevelStartcxx . . $ IDMFC#Set_OnClientLevelStart(964b12a25712bdc3).(OnClientLevelStartcxx . . $ OnClientLevelStart(49f6e7a06ebc5aa8).);
217 DMFCBasecxx . . $ DMFCBase.->Set_OnClientLevelEndcxx . . $ IDMFC#Set_OnClientLevelEnd(964b12a25712bdc3).(OnClientLevelEndcxx . . $ OnClientLevelEnd(49f6e7a06ebc5aa8).);
218 DMFCBasecxx . . $ DMFCBase.->Set_OnGameStateRequestcxx . . $ IDMFC#Set_OnGameStateRequest(94eb4457dc8d4d10).(OnGameStateRequestcxx . . $ OnGameStateRequest(d4f767463ce0a6b3).);
219 DMFCBasecxx . . $ DMFCBase.->Set_OnPlayerConnectcxx . . $ IDMFC#Set_OnPlayerConnect(94eb4457dc8d4d10).(OnPlayerConnectcxx . . $ OnPlayerConnect(d4f767463ce0a6b3).);
220 DMFCBasecxx . . $ DMFCBase.->Set_OnServerCollidecxx . . $ IDMFC#Set_OnServerCollide(74ea2c9f51d3637e).(OnServerCollidecxx . . $ OnServerCollide(6273fa812ac58a8).);
221 DMFCBasecxx . . $ DMFCBase.->Set_OnClientCollidecxx . . $ IDMFC#Set_OnClientCollide(74ea2c9f51d3637e).(OnClientCollidecxx . . $ OnClientCollide(6273fa812ac58a8).);
222 DMFCBasecxx . . $ DMFCBase.->Set_OnClientPlayerKilledcxx . . $ IDMFC#Set_OnClientPlayerKilled(7da43329b4117518).(OnClientPlayerKilledcxx . . $ OnClientPlayerKilled(766a1b7183ffa4b4).);
223 DMFCBasecxx . . $ DMFCBase.->Set_OnPLRIntervalcxx . . $ IDMFC#Set_OnPLRInterval(964b12a25712bdc3).(OnPLRIntervalcxx . . $ OnPLRInterval(49f6e7a06ebc5aa8).);
224 DMFCBasecxx . . $ DMFCBase.->Set_OnPLRInitcxx . . $ IDMFC#Set_OnPLRInit(964b12a25712bdc3).(OnPLRInitcxx . . $ OnPLRInit(49f6e7a06ebc5aa8).);
225 DMFCBasecxx . . $ DMFCBase.->Set_OnServerPlayerDisconnectcxx . . $ IDMFC#Set_OnServerPlayerDisconnect(94eb4457dc8d4d10).(OnServerPlayerDisconnectcxx . . $ OnServerPlayerDisconnect(d4f767463ce0a6b3).);
226 DMFCBasecxx . . $ DMFCBase.->Set_OnClientPlayerDisconnectcxx . . $ IDMFC#Set_OnClientPlayerDisconnect(94eb4457dc8d4d10).(OnClientPlayerDisconnectcxx . . $ OnClientPlayerDisconnect(d4f767463ce0a6b3).);
227 DMFCBasecxx . . $ DMFCBase.->Set_OnSaveStatsToFilecxx . . $ IDMFC#Set_OnSaveStatsToFile(964b12a25712bdc3).(OnSaveStatsToFilecxx . . $ OnSaveStatsToFile(49f6e7a06ebc5aa8).);
228 DMFCBasecxx . . $ DMFCBase.->Set_OnLevelEndSaveStatsToFilecxx . . $ IDMFC#Set_OnLevelEndSaveStatsToFile(964b12a25712bdc3).(OnLevelEndSaveStatsToFilecxx . . $ OnLevelEndSaveStatsToFile(49f6e7a06ebc5aa8).);
229 DMFCBasecxx . . $ DMFCBase.->Set_OnDisconnectSaveStatsToFilecxx . . $ IDMFC#Set_OnDisconnectSaveStatsToFile(964b12a25712bdc3).(OnDisconnectSaveStatsToFilecxx . . $ OnDisconnectSaveStatsToFile(49f6e7a06ebc5aa8).);
230 DMFCBasecxx . . $ DMFCBase.->Set_OnPrintScorescxx . . $ IDMFC#Set_OnPrintScores(94eb4457dc8d4d10).(OnPrintScorescxx . . $ OnPrintScores(d4f767463ce0a6b3).);
231 DMFCBasecxx . . $ DMFCBase.->Set_OnPlayerEntersObservercxx . . $ IDMFC#Set_OnPlayerEntersObserver(44e0dd9f073bbf0e).(OnPlayerEntersObservercxx . . $ OnPlayerEntersObserver(14473714f2cc5bd2).);
232 DMFCBasecxx . . $ DMFCBase.->Set_OnClientPlayerEntersGamecxx . . $ IDMFC#Set_OnClientPlayerEntersGame(94eb4457dc8d4d10).(OnClientPlayerEntersGamecxx . . $ OnClientPlayerEntersGame(d4f767463ce0a6b3).);
233
234 DLLCreateStringTable("hyper.str", &StringTablecxx . . $ StringTable., &StringTableSizecxx . . $ StringTableSize.);
235 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "%d strings loaded from string table\n", StringTableSize);
236 if (!StringTableSizecxx . . $ StringTableSize.) {
237 *all_ok = 0;
238 return;
239 }
240
241 // add the anarchy menu/submenus
242 IMenuItemcxx . . $ IMenuItem# *lev1, *lev2, *MainMenu;
243 lev1 = CreateMenuItemWArgs(TXT_GAMENAMEcxx . . $ `netgames/hyperanarchy/hyperstr.h:44:9`!, MIT_NORMALcxx . . $ `netgames/includes/DMFC.h:513:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
244
245 lev2 = CreateMenuItemWArgs(TXT_HUDSCORECOLORScxx . . $ `netgames/hyperanarchy/hyperstr.h:47:9`!, MIT_STATEcxx . . $ `netgames/includes/DMFC.h:515:9`!, 0, SwitchHUDColorcxx . . $ SwitchHUDColor(d4f767463ce0a6b3).);
246 lev2->SetStateItemListcxx . . $ IMenuItem#SetStateItemList(d49b86907ad5c83b).(2, TXT_PLAYERCOLORScxx . . $ `netgames/hyperanarchy/hyperstr.h:48:9`!, TXT_NORMALcxx . . $ `netgames/hyperanarchy/hyperstr.h:49:9`!);
247 lev2->SetStatecxx . . $ IMenuItem#SetState(d4f767463ce0a6b3).(HUD_color_modelcxx . . $ HUD_color_model.);
248 lev1->AddSubMenucxx . . $ IMenuItem#AddSubMenu(7cad07ba2f70ae18).(lev2);
249
250 MainMenu = DMFCBasecxx . . $ DMFCBase.->GetOnScreenMenucxx . . $ IDMFC#GetOnScreenMenu(8efbf9c7cdf9c614).();
251 MainMenu->AddSubMenucxx . . $ IMenuItem#AddSubMenu(7cad07ba2f70ae18).(lev1);
252
253 dObjectscxx . . $ dObjects. = DMFCBasecxx . . $ DMFCBase.->GetObjectscxx . . $ IDMFC#GetObjects(26f25deff401d7e4).();
254 dPlayerscxx . . $ dPlayers. = DMFCBasecxx . . $ DMFCBase.->GetPlayerscxx . . $ IDMFC#GetPlayers(51ff8e716a252304).();
255
256 DMFCBasecxx . . $ DMFCBase.->GameInitcxx . . $ IDMFC#GameInit(d4f767463ce0a6b3).(1);
257
258 // add the death and suicide messages
259 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH1cxx . . $ `netgames/hyperanarchy/hyperstr.h:31:9`!, true);
260 DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE1cxx . . $ `netgames/hyperanarchy/hyperstr.h:32:9`!);
261
262 HyperOrbIDcxx . . $ HyperOrbID. = DLLFindObjectIDName("Hyperorb");
263 if (HyperOrbIDcxx . . $ HyperOrbID. == -1) {
264 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "Hyper Anarchy: BIG WARNING, COULDN'T FIND HyperOrb ID...YOUR GAME IS IN JEOPARDY!\n");
265 *all_ok = 0;
266 return;
267 }
268
269 // setup the Playerstats struct so DMFC can handle it automatically when a new player enters the game
270 DMFCBasecxx . . $ DMFCBase.->SetupPlayerRecordcxx . . $ IDMFC#SetupPlayerRecord(7df49e8a00e47932).(sizeof(tPlayerStatcxx . . $ tPlayerStat#), (int (*)(void *, uint8_tcxx . . $ uint8_t# *))pack_pstatcxx . . $ pack_pstat(60b9885aab282f36).,
271 (int (*)(void *, uint8_tcxx . . $ uint8_t# *))unpack_pstatcxx . . $ unpack_pstat(60b9885aab282f36).);
272
273 DMFCBasecxx . . $ DMFCBase.->RegisterPacketReceivercxx . . $ IDMFC#RegisterPacketReceiver(6efe5766e3bef270).(SPID_HYPERINFOcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:67:9`!, ReceiveHyperGameStatecxx . . $ ReceiveHyperGameState(f25546b61a629de7).);
274 DMFCBasecxx . . $ DMFCBase.->RegisterPacketReceivercxx . . $ IDMFC#RegisterPacketReceiver(6efe5766e3bef270).(SPID_HYPERPOScxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:68:9`!, ReceiveHyperPoscxx . . $ ReceiveHyperPos(f25546b61a629de7).);
275
276 DMFCBasecxx . . $ DMFCBase.->SetNumberOfTeamscxx . . $ IDMFC#SetNumberOfTeams(d4f767463ce0a6b3).(1);
277 (DMFCBasecxx . . $ DMFCBase.->GetNetgameInfocxx . . $ IDMFC#GetNetgameInfo(242e78cd5130aa12).())->flagscxx . . $ netgame_info#flags. |= (NF_DAMAGE_FRIENDLYcxx . . $ `Descent3/multi_external.h:235:9`! | NF_TRACK_RANKcxx . . $ `Descent3/multi_external.h:243:9`!);
278
279 DMFCBasecxx . . $ DMFCBase.->AddHUDItemCallbackcxx . . $ IDMFC#AddHUDItemCallback(97c9b33f56b4265c).(HI_TEXTcxx . . $ `netgames/includes/DMFC.h:440:9`!, DisplayHUDScorescxx . . $ DisplayHUDScores(c7a20e4e05358911).);
280
281 DisplayScoreScreencxx . . $ DisplayScoreScreen. = false;
282 WhoHasOrbcxx . . $ WhoHasOrb. = -1;
283 KillCountcxx . . $ KillCount. = 0;
284 HyperMoveTimercxx . . $ HyperMoveTimer. = -1;
285 HyperOrbIconcxx . . $ HyperOrbIcon. = DLLbm_AllocLoadFileBitmap("HyperOrbICON.ogf", 0, BITMAP_FORMAT_1555cxx . . $ `lib/bitmap.h:56:9`!);
286 if (HyperOrbIconcxx . . $ HyperOrbIcon. == -1) {
287 *all_ok = 0;
288 return;
289 }
290
291 Highlight_bmpcxx . . $ Highlight_bmp. = DLLbm_AllocBitmap(32, 32, 0);
292 if (Highlight_bmpcxx . . $ Highlight_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) {
293 uint16_tcxx . . $ uint16_t# *data = DLLbm_data(Highlight_bmpcxx . . $ Highlight_bmp., 0);
294 if (!data) {
295 // bail on out of here
296 *all_ok = 0;
297 return;
298 }
299 for (int x = 0; x < 32 * 32; x++) {
300 data[x] = GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(50, 50, 50) | OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`!;
301 }
302 }
303
304 // Initialize the Stats Manager
305 // ----------------------------
306
307 tDmfcStatsInitcxx . . $ tDmfcStatsInit# tsi;
308 tDmfcStatsColumnInfocxx . . $ tDmfcStatsColumnInfo# pl_col[7];
309 char gname[20];
310 strcpy(gname, TXT_STATSGAMENAMEcxx . . $ `netgames/hyperanarchy/hyperstr.h:45:9`!);
311
312 tsi.flagscxx . . $ tDmfcStatsInit#flags. = DSIF_SHOW_PICcxx . . $ `netgames/includes/DMFC.h:619:9`! | DSIF_SHOW_OBSERVERICONcxx . . $ `netgames/includes/DMFC.h:627:9`!;
313 tsi.cColumnCountDetailedcxx . . $ tDmfcStatsInit#cColumnCountDetailed. = 0;
314 tsi.cColumnCountPlayerListcxx . . $ tDmfcStatsInit#cColumnCountPlayerList. = 7;
315 tsi.clbDetailedColumncxx . . $ tDmfcStatsInit#clbDetailedColumn. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
316 tsi.clbDetailedColumnBMPcxx . . $ tDmfcStatsInit#clbDetailedColumnBMP. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
317 tsi.clbPlayerColumncxx . . $ tDmfcStatsInit#clbPlayerColumn. = DetermineScorecxx . . $ DetermineScore(74c02bb7c84e7fae).;
318 tsi.clbPlayerColumnBMPcxx . . $ tDmfcStatsInit#clbPlayerColumnBMP. = ShowStatBitmapcxx . . $ ShowStatBitmap(dac02d3a3b31dff4).;
319 tsi.DetailedColumnscxx . . $ tDmfcStatsInit#DetailedColumns. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
320 tsi.GameNamecxx . . $ tDmfcStatsInit#GameName. = gname;
321 tsi.MaxNumberDisplayedcxx . . $ tDmfcStatsInit#MaxNumberDisplayed. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
322 tsi.PlayerListColumnscxx . . $ tDmfcStatsInit#PlayerListColumns. = pl_col;
323 tsi.SortedPlayerRecordscxx . . $ tDmfcStatsInit#SortedPlayerRecords. = SortedPlayerscxx . . $ SortedPlayers.;
324
325 pl_col[0].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.;
326 pl_col[0].titlecxx . . $ tDmfcStatsColumnInfo#title.[0] = '\0';
327 pl_col[0].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_BMPcxx . . $ DSCOL_BMP.;
328 pl_col[0].widthcxx . . $ tDmfcStatsColumnInfo#width. = 15;
329
330 pl_col[1].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_SHIPCOLORcxx . . $ DSCOLOR_SHIPCOLOR.;
331 strcpy(pl_col[1].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_PILOTcxx . . $ `netgames/hyperanarchy/hyperstr.h:33:9`!);
332 pl_col[1].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_PILOT_NAMEcxx . . $ DSCOL_PILOT_NAME.;
333 pl_col[1].widthcxx . . $ tDmfcStatsColumnInfo#width. = 120;
334
335 pl_col[2].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_SHIPCOLORcxx . . $ DSCOLOR_SHIPCOLOR.;
336 strcpy(pl_col[2].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_SCOREcxx . . $ `netgames/hyperanarchy/hyperstr.h:37:9`!);
337 pl_col[2].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_CUSTOMcxx . . $ DSCOL_CUSTOM.;
338 pl_col[2].widthcxx . . $ tDmfcStatsColumnInfo#width. = 60;
339
340 pl_col[3].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_SHIPCOLORcxx . . $ DSCOLOR_SHIPCOLOR.;
341 strcpy(pl_col[3].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_KILLS_SHORTcxx . . $ `netgames/hyperanarchy/hyperstr.h:58:9`!);
342 pl_col[3].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_KILLS_LEVELcxx . . $ DSCOL_KILLS_LEVEL.;
343 pl_col[3].widthcxx . . $ tDmfcStatsColumnInfo#width. = 57;
344
345 pl_col[4].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_SHIPCOLORcxx . . $ DSCOLOR_SHIPCOLOR.;
346 strcpy(pl_col[4].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_DEATHS_SHORTcxx . . $ `netgames/hyperanarchy/hyperstr.h:59:9`!);
347 pl_col[4].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_DEATHS_LEVELcxx . . $ DSCOL_DEATHS_LEVEL.;
348 pl_col[4].widthcxx . . $ tDmfcStatsColumnInfo#width. = 57;
349
350 pl_col[5].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_SHIPCOLORcxx . . $ DSCOLOR_SHIPCOLOR.;
351 strcpy(pl_col[5].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_SUICIDES_SHORTcxx . . $ `netgames/hyperanarchy/hyperstr.h:60:9`!);
352 pl_col[5].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_SUICIDES_LEVELcxx . . $ DSCOL_SUICIDES_LEVEL.;
353 pl_col[5].widthcxx . . $ tDmfcStatsColumnInfo#width. = 57;
354
355 pl_col[6].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_SHIPCOLORcxx . . $ DSCOLOR_SHIPCOLOR.;
356 strcpy(pl_col[6].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_PINGcxx . . $ `netgames/hyperanarchy/hyperstr.h:46:9`!);
357 pl_col[6].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_PINGcxx . . $ DSCOL_PING.;
358 pl_col[6].widthcxx . . $ tDmfcStatsColumnInfo#width. = 40;
359
360 dstatcxx . . $ dstat.->Initializecxx . . $ IDmfcStats#Initialize(645910a8ad01b658).(&tsi);
361 }
362
363 // Called when the DLL is shutdown
364 void DLLFUNCCALLcxx . . $ `lib/module.h:93:10`! DLLGameClosecxx . . $ DLLGameClose(49f6e7a06ebc5aa8).() {
365 if (Highlight_bmpcxx . . $ Highlight_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!)
366 DLLbm_FreeBitmap(Highlight_bmpcxx . . $ Highlight_bmp.);
367
368 DLLDestroyStringTable(StringTablecxx . . $ StringTable., StringTableSizecxx . . $ StringTableSize.);
369 if (HyperOrbIconcxx . . $ HyperOrbIcon. > 0)
370 DLLbm_FreeBitmap(HyperOrbIconcxx . . $ HyperOrbIcon.);
371
372 if (dstatcxx . . $ dstat.) {
373 dstatcxx . . $ dstat.->DestroyPointercxx . . $ IObject#DestroyPointer(49f6e7a06ebc5aa8).();
374 dstatcxx . . $ dstat. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
375 }
376
377 if (DMFCBasecxx . . $ DMFCBase.) {
378 DMFCBasecxx . . $ DMFCBase.->GameClosecxx . . $ IDMFC#GameClose(49f6e7a06ebc5aa8).();
379 DMFCBasecxx . . $ DMFCBase.->DestroyPointercxx . . $ IObject#DestroyPointer(49f6e7a06ebc5aa8).();
380 DMFCBasecxx . . $ DMFCBase. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
381 }
382 }
383
384 //////////////////////////////////////////////////////////////
385 /////// Overrides ///////////////////////////////////////////
386
387 void OnHUDIntervalcxx . . $ OnHUDInterval(49f6e7a06ebc5aa8).(void) {
388 dstatcxx . . $ dstat.->DoFramecxx . . $ IDmfcStats#DoFrame(49f6e7a06ebc5aa8).();
389 DMFCBasecxx . . $ DMFCBase.->DisplayOutrageLogocxx . . $ IDMFC#DisplayOutrageLogo(49f6e7a06ebc5aa8).();
390
391 DMFCBasecxx . . $ DMFCBase.->OnHUDIntervalcxx . . $ IDMFC#OnHUDInterval(49f6e7a06ebc5aa8).();
392 }
393
394 void OnIntervalcxx . . $ OnInterval(49f6e7a06ebc5aa8).(void) {
395 // Set a Timer to display
396 if ((HyperMoveTimercxx . . $ HyperMoveTimer. == -1) && (WhoHasOrbcxx . . $ WhoHasOrb. == -1))
397 HyperMoveTimercxx . . $ HyperMoveTimer. = DMFCBasecxx . . $ DMFCBase.->SetTimerIntervalcxx . . $ IDMFC#SetTimerInterval(695c251031f3a34d).(OnTimerFlagReturncxx . . $ OnTimerFlagReturn(49f6e7a06ebc5aa8)., 30.0f, 30.0f);
398
399 SortPlayerScorescxx . . $ SortPlayerScores(621ccea12ecf5b06).(SortedPlayerscxx . . $ SortedPlayers., MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!);
400 DMFCBasecxx . . $ DMFCBase.->OnIntervalcxx . . $ IDMFC#OnInterval(49f6e7a06ebc5aa8).();
401 }
402
403 void OnPlayerEntersObservercxx . . $ OnPlayerEntersObserver(14473714f2cc5bd2).(int pnum, objectcxx . . $ object# *piggy) {
404 if (WhoHasOrbcxx . . $ WhoHasOrb. == pnum) {
405 WhoHasOrbcxx . . $ WhoHasOrb. = -1;
406 KillCountcxx . . $ KillCount. = 0;
407 HyperMoveTimercxx . . $ HyperMoveTimer. = -1;
408 DLLAddHUDMessage(TXT_LOSTORBcxx . . $ `netgames/hyperanarchy/hyperstr.h:38:9`!, dPlayerscxx . . $ dPlayers.[pnum].callsigncxx . . $ player#callsign.);
409
410 UpdateEffectcxx . . $ UpdateEffect(49f6e7a06ebc5aa8).();
411 }
412
413 DMFCBasecxx . . $ DMFCBase.->OnPlayerEntersObservercxx . . $ IDMFC#OnPlayerEntersObserver(14473714f2cc5bd2).(pnum, piggy);
414 }
415
416 void OnKeypresscxx . . $ OnKeypress(d4f767463ce0a6b3).(int key) {
417 dllinfocxx . . $ dllinfo# *Data = DMFCBasecxx . . $ DMFCBase.->GetDLLInfoCallDatacxx . . $ IDMFC#GetDLLInfoCallData(4458c5bdce97a5c3).();
418 switch (key) {
419 case K_F7cxx . . $ `netgames/includes/DMFCKeyCodes.h:118:9`!:
420 DisplayScoreScreencxx . . $ DisplayScoreScreen. = !DisplayScoreScreencxx . . $ DisplayScoreScreen.;
421 DMFCBasecxx . . $ DMFCBase.->EnableOnScreenMenucxx . . $ IDMFC#EnableOnScreenMenu(b45ddcbc8423892c).(false);
422 dstatcxx . . $ dstat.->Enablecxx . . $ IDmfcStats#Enable(b45ddcbc8423892c).(DisplayScoreScreencxx . . $ DisplayScoreScreen.);
423 break;
424 case K_PAGEDOWNcxx . . $ `netgames/includes/DMFCKeyCodes.h:147:9`!:
425 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.) {
426 dstatcxx . . $ dstat.->ScrollDowncxx . . $ IDmfcStats#ScrollDown(49f6e7a06ebc5aa8).();
427 Data->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1;
428 }
429 break;
430 case K_PAGEUPcxx . . $ `netgames/includes/DMFCKeyCodes.h:144:9`!:
431 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.) {
432 dstatcxx . . $ dstat.->ScrollUpcxx . . $ IDmfcStats#ScrollUp(49f6e7a06ebc5aa8).();
433 Data->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1;
434 }
435 break;
436 case K_F6cxx . . $ `netgames/includes/DMFCKeyCodes.h:117:9`!:
437 DisplayScoreScreencxx . . $ DisplayScoreScreen. = false;
438 dstatcxx . . $ dstat.->Enablecxx . . $ IDmfcStats#Enable(b45ddcbc8423892c).(false);
439 break;
440 case K_ESCcxx . . $ `netgames/includes/DMFCKeyCodes.h:97:9`!:
441 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.) {
442 dstatcxx . . $ dstat.->Enablecxx . . $ IDmfcStats#Enable(b45ddcbc8423892c).(false);
443 DisplayScoreScreencxx . . $ DisplayScoreScreen. = false;
444 Data->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1;
445 }
446 break;
447 }
448
449 DMFCBasecxx . . $ DMFCBase.->OnKeypresscxx . . $ IDMFC#OnKeypress(d4f767463ce0a6b3).(key);
450 }
451
452 // The server has just started, so clear out all the stats and game info
453 void OnServerGameCreatedcxx . . $ OnServerGameCreated(49f6e7a06ebc5aa8).(void) {
454 DMFCBasecxx . . $ DMFCBase.->OnServerGameCreatedcxx . . $ IDMFC#OnServerGameCreated(49f6e7a06ebc5aa8).();
455 player_recordcxx . . $ player_record# *pr;
456 tPlayerStatcxx . . $ tPlayerStat# *stat;
457 for (int i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) {
458 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(i);
459 if (pr)
460 stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.;
461 else
462 stat = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
463 if (stat) {
464 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] = 0;
465 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!] = 0;
466 }
467 }
468 }
469
470 void OnServerLevelStartcxx . . $ OnServerLevelStart(49f6e7a06ebc5aa8).(void) {
471 // Now create a hyper orb in a random room -eek
472 if (HyperOrbIDcxx . . $ HyperOrbID. != -1) {
473 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "Attempting to create HyperOrb in a random room\n");
474 int room = GetRandomValidRoomcxx . . $ GetRandomValidRoom(b126dc7c1de90089).();
475 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "Room %d selected\n", room);
476 // We got a good room
477 // Safe to create the flag
478 CreateHyperOrbInRoomcxx . . $ CreateHyperOrbInRoom(d4f767463ce0a6b3).(room);
479 }
480
481 KillCountcxx . . $ KillCount. = 0;
482 WhoHasOrbcxx . . $ WhoHasOrb. = -1;
483 HyperMoveTimercxx . . $ HyperMoveTimer. = -1;
484 UpdateEffectcxx . . $ UpdateEffect(49f6e7a06ebc5aa8).();
485
486 DMFCBasecxx . . $ DMFCBase.->OnServerLevelStartcxx . . $ IDMFC#OnServerLevelStart(49f6e7a06ebc5aa8).();
487 }
488
489 void OnClientLevelEndcxx . . $ OnClientLevelEnd(49f6e7a06ebc5aa8).(void) { DMFCBasecxx . . $ DMFCBase.->OnClientLevelEndcxx . . $ IDMFC#OnClientLevelEnd(49f6e7a06ebc5aa8).(); }
490
491 // The server has started a new level, so clear out level scores
492 void OnClientLevelStartcxx . . $ OnClientLevelStart(49f6e7a06ebc5aa8).(void) {
493 DMFCBasecxx . . $ DMFCBase.->OnClientLevelStartcxx . . $ IDMFC#OnClientLevelStart(49f6e7a06ebc5aa8).();
494
495 player_recordcxx . . $ player_record# *pr;
496 tPlayerStatcxx . . $ tPlayerStat# *stat;
497 for (int i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) {
498 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(i);
499 if (pr)
500 stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.;
501 else
502 stat = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
503 if (stat) {
504 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] = 0;
505 }
506 }
507
508 DMFCBasecxx . . $ DMFCBase.->RequestGameStatecxx . . $ IDMFC#RequestGameState(49f6e7a06ebc5aa8).();
509 UpdateEffectcxx . . $ UpdateEffect(49f6e7a06ebc5aa8).();
510 }
511
512 // We need to send all the inventory info out to the new player
513 void OnGameStateRequestcxx . . $ OnGameStateRequest(d4f767463ce0a6b3).(int player_num) {
514 SendHyperGameStatecxx . . $ SendHyperGameState(d4f767463ce0a6b3).(player_num);
515 DMFCBasecxx . . $ DMFCBase.->OnGameStateRequestcxx . . $ IDMFC#OnGameStateRequest(d4f767463ce0a6b3).(player_num);
516 }
517
518 // A new player has entered the game, zero there stats out
519 void OnPlayerConnectcxx . . $ OnPlayerConnect(d4f767463ce0a6b3).(int player_num) {
520 tPlayerStatcxx . . $ tPlayerStat# *stat = (tPlayerStatcxx . . $ tPlayerStat# *)DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordDatacxx . . $ IDMFC#GetPlayerRecordData(d1680a912d714170).(player_num);
521 if (stat) {
522 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] = 0;
523 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!] = 0;
524 }
525
526 DMFCBasecxx . . $ DMFCBase.->OnPlayerConnectcxx . . $ IDMFC#OnPlayerConnect(d4f767463ce0a6b3).(player_num);
527 }
528
529 // A new player has entered the game, zero there stats out
530 void OnClientPlayerEntersGamecxx . . $ OnClientPlayerEntersGame(d4f767463ce0a6b3).(int player_num) {
531 DMFCBasecxx . . $ DMFCBase.->OnClientPlayerEntersGamecxx . . $ IDMFC#OnClientPlayerEntersGame(d4f767463ce0a6b3).(player_num);
532 if (player_num != DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).())
533 DisplayWelcomeScreencxx . . $ DisplayWelcomeScreen(d4f767463ce0a6b3).(player_num);
534 else
535 display_my_welcomecxx . . $ display_my_welcome. = true;
536 }
537
538 void OnPrintScorescxx . . $ OnPrintScores(d4f767463ce0a6b3).(int level) {
539 char buffer[256];
540 char name[50];
541 memset(buffer, ' ', 256);
542
543 size_t t;
544 size_t pos[6];
545 size_t len[6];
546 pos[0] = 0;
547 t = len[0] = 20; // give ample room for pilot name
548 pos[1] = pos[0] + t + 1;
549 t = len[1] = strlen(TXT_SCOREcxx . . $ `netgames/hyperanarchy/hyperstr.h:37:9`!);
550 pos[2] = pos[1] + t + 1;
551 t = len[2] = strlen(TXT_KILLScxx . . $ `netgames/hyperanarchy/hyperstr.h:34:9`!);
552 pos[3] = pos[2] + t + 1;
553 t = len[3] = strlen(TXT_DEATHScxx . . $ `netgames/hyperanarchy/hyperstr.h:35:9`!);
554 pos[4] = pos[3] + t + 1;
555 t = len[4] = strlen(TXT_SUICIDEScxx . . $ `netgames/hyperanarchy/hyperstr.h:36:9`!);
556 pos[5] = pos[4] + t + 1;
557 t = len[5] = strlen(TXT_PINGcxx . . $ `netgames/hyperanarchy/hyperstr.h:46:9`!);
558
559 memcpy(&buffer[pos[0]], TXT_PILOTcxx . . $ `netgames/hyperanarchy/hyperstr.h:33:9`!, strlen(TXT_PILOTcxx . . $ `netgames/hyperanarchy/hyperstr.h:33:9`!));
560 memcpy(&buffer[pos[1]], TXT_SCOREcxx . . $ `netgames/hyperanarchy/hyperstr.h:37:9`!, len[1]);
561 memcpy(&buffer[pos[2]], TXT_KILLScxx . . $ `netgames/hyperanarchy/hyperstr.h:34:9`!, len[2]);
562 memcpy(&buffer[pos[3]], TXT_DEATHScxx . . $ `netgames/hyperanarchy/hyperstr.h:35:9`!, len[3]);
563 memcpy(&buffer[pos[4]], TXT_SUICIDEScxx . . $ `netgames/hyperanarchy/hyperstr.h:36:9`!, len[4]);
564 memcpy(&buffer[pos[5]], TXT_PINGcxx . . $ `netgames/hyperanarchy/hyperstr.h:46:9`!, len[5]);
565 buffer[pos[5] + len[5] + 1] = '\n';
566 buffer[pos[5] + len[5] + 2] = '\0';
567 DPrintf(buffer);
568
569 int slot;
570 player_recordcxx . . $ player_record# *pr;
571 int pcount;
572
573 if (level < 0 || level >= MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!)
574 pcount = MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!;
575 else
576 pcount = level;
577
578 int sortedplayers[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!];
579 DMFCBasecxx . . $ DMFCBase.->GetSortedPlayerSlotscxx . . $ IDMFC#GetSortedPlayerSlots(621ccea12ecf5b06).(sortedplayers, MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!);
580
581 for (int i = 0; i < pcount; i++) {
582 slot = sortedplayers[i];
583 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(slot);
584 if ((pr) && (pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.)) {
585
586 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
587 continue; // skip dedicated server
588
589 snprintf(name, sizeof(name), "%s%s:", (pr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.) ? "*" : "", pr->callsigncxx . . $ player_record#callsign.);
590 name[19] = '\0';
591
592 tPlayerStatcxx . . $ tPlayerStat# *stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.;
593
594 memset(buffer, ' ', 256);
595 t = strlen(name);
596 memcpy(&buffer[pos[0]], name, (t < len[0]) ? t : len[0]);
597 snprintf(name, sizeof(name), "%d[%d]", (stat) ? stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0,
598 (stat) ? stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!] : 0);
599 t = strlen(name);
600 memcpy(&buffer[pos[1]], name, (t < len[1]) ? t : len[1]);
601 snprintf(name, sizeof(name), "%d[%d]", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!], pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
602 t = strlen(name);
603 memcpy(&buffer[pos[2]], name, (t < len[2]) ? t : len[2]);
604 snprintf(name, sizeof(name), "%d[%d]", pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!], pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
605 t = strlen(name);
606 memcpy(&buffer[pos[3]], name, (t < len[3]) ? t : len[3]);
607 snprintf(name, sizeof(name), "%d[%d]", pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!], pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
608 t = strlen(name);
609 memcpy(&buffer[pos[4]], name, (t < len[4]) ? t : len[4]);
610
611 if (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.)
612 snprintf(name, sizeof(name), "%.0f", (DMFCBasecxx . . $ DMFCBase.->GetNetPlayerscxx . . $ IDMFC#GetNetPlayers(d09959b2d64446dd).())[pr->pnumcxx . . $ player_record#pnum.].ping_timecxx . . $ netplayer#ping_time. * 1000.0f);
613 else
614 strcpy(name, "---");
615 t = strlen(name);
616 memcpy(&buffer[pos[5]], name, (t < len[5]) ? t : len[5]);
617 buffer[pos[5] + len[5] + 1] = '\n';
618 buffer[pos[5] + len[5] + 2] = '\0';
619 DPrintf(buffer);
620 }
621 }
622 }
623
624 bool compare_slotscxx . . $ compare_slots(cf9ef193275fa6d8).(int a, int b) {
625 int ascore, bscore;
626 player_recordcxx . . $ player_record# *apr, *bpr;
627 tPlayerStatcxx . . $ tPlayerStat# *astat, *bstat;
628
629 apr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(a);
630 bpr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(b);
631 if (!apr)
632 return true;
633 if (!bpr)
634 return false;
635 if (apr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.)
636 return true;
637 if (bpr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.)
638 return false;
639 astat = (tPlayerStatcxx . . $ tPlayerStat# *)apr->user_infocxx . . $ player_record#user_info.;
640 bstat = (tPlayerStatcxx . . $ tPlayerStat# *)bpr->user_infocxx . . $ player_record#user_info.;
641
642 if ((apr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) && (bpr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.)) {
643 // both players were in the game
644 ascore = (astat) ? astat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0;
645 bscore = (bstat) ? bstat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0;
646 return (ascore < bscore);
647 }
648 if ((apr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) && (bpr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.)) {
649 // apr gets priority since he was in the game on exit
650 return false;
651 }
652 if ((apr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.) && (bpr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.)) {
653 // bpr gets priority since he was in the game on exit
654 return true;
655 }
656 // if we got here then both players were disconnected
657 ascore = (astat) ? astat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0;
658 bscore = (bstat) ? bstat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0;
659 return (ascore < bscore);
660 }
661
662 void OnPLRInitcxx . . $ OnPLRInit(49f6e7a06ebc5aa8).(void) {
663 int i, t, j;
664
665 for (i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) {
666 SortedPlayerscxx . . $ SortedPlayers.[i] = i;
667 }
668
669 for (i = 1; i <= MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`! - 1; i++) {
670 t = SortedPlayerscxx . . $ SortedPlayers.[i];
671 // Shift elements down until
672 // insertion point found.
673 for (j = i - 1; j >= 0 && compare_slotscxx . . $ compare_slots(cf9ef193275fa6d8).(SortedPlayerscxx . . $ SortedPlayers.[j], t); j--) {
674 SortedPlayerscxx . . $ SortedPlayers.[j + 1] = SortedPlayerscxx . . $ SortedPlayers.[j];
675 }
676 // insert
677 SortedPlayerscxx . . $ SortedPlayers.[j + 1] = t;
678 }
679
680 DMFCBasecxx . . $ DMFCBase.->OnPLRInitcxx . . $ IDMFC#OnPLRInit(49f6e7a06ebc5aa8).();
681 }
682
683 void OnPLRIntervalcxx . . $ OnPLRInterval(49f6e7a06ebc5aa8).(void) {
684 #define PLAYERS_COLcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:684:9`! 110
685 #define SCORE_COLcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:685:9`! 240
686 #define KILLS_COLcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:686:9`! 300
687 #define DEATHS_COLcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:687:9`! 360
688 #define SUICIDES_COLcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:688:9`! 420
689
690 DMFCBasecxx . . $ DMFCBase.->OnPLRIntervalcxx . . $ IDMFC#OnPLRInterval(49f6e7a06ebc5aa8).();
691
692 int y = 40;
693 int height = DLLgrfont_GetHeight((DMFCBasecxx . . $ DMFCBase.->GetGameFontTranslateArraycxx . . $ IDMFC#GetGameFontTranslateArray(a7741f82f5fc3640).())[SMALL_UI_FONT_INDEXcxx . . $ `Descent3/gamefont.h:99:9`!]) + 1;
694
695 DLLgrtext_SetFont((DMFCBasecxx . . $ DMFCBase.->GetGameFontTranslateArraycxx . . $ IDMFC#GetGameFontTranslateArray(a7741f82f5fc3640).())[SMALL_UI_FONT_INDEXcxx . . $ `Descent3/gamefont.h:99:9`!]);
696
697 // print out header
698 DLLgrtext_SetColor(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 150));
699 DLLgrtext_Printf(PLAYERS_COLcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:684:9`!, y, TXT_PILOTcxx . . $ `netgames/hyperanarchy/hyperstr.h:33:9`!);
700 DLLgrtext_Printf(SCORE_COLcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:685:9`!, y, TXT_SCOREcxx . . $ `netgames/hyperanarchy/hyperstr.h:37:9`!);
701 DLLgrtext_Printf(KILLS_COLcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:686:9`!, y, TXT_KILLScxx . . $ `netgames/hyperanarchy/hyperstr.h:34:9`!);
702 DLLgrtext_Printf(DEATHS_COLcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:687:9`!, y, TXT_DEATHScxx . . $ `netgames/hyperanarchy/hyperstr.h:35:9`!);
703 DLLgrtext_Printf(SUICIDES_COLcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:688:9`!, y, TXT_SUICIDEScxx . . $ `netgames/hyperanarchy/hyperstr.h:36:9`!);
704 y += height;
705
706 // print out player stats
707 int rank = 1;
708 int slot;
709 tPlayerStatcxx . . $ tPlayerStat# *stat;
710 player_recordcxx . . $ player_record# *pr;
711
712 for (int i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) {
713 slot = SortedPlayerscxx . . $ SortedPlayers.[i];
714 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(slot);
715 if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) {
716
717 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
718 continue; // skip dedicated server
719
720 stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.;
721
722 int pnum = DMFCBasecxx . . $ DMFCBase.->WasPlayerInGameAtLevelEndcxx . . $ IDMFC#WasPlayerInGameAtLevelEnd(7864480464b09eea).(slot);
723 if (pnum != -1) {
724 DLLgrtext_SetColor((DMFCBasecxx . . $ DMFCBase.->GetPlayerColorscxx . . $ IDMFC#GetPlayerColors(ac695d451f96e4aa).())[pnum]);
725 } else {
726 DLLgrtext_SetColor(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(128, 128, 128));
727 }
728
729 DLLgrtext_Printf(PLAYERS_COLcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:684:9`!, y, "%d)%s", rank, pr->callsigncxx . . $ player_record#callsign.);
730 DLLgrtext_Printf(SCORE_COLcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:685:9`!, y, "%d[%d]", (stat) ? stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0,
731 (stat) ? stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!] : 0);
732 DLLgrtext_Printf(KILLS_COLcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:686:9`!, y, "%d[%d]", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!], pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
733 DLLgrtext_Printf(DEATHS_COLcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:687:9`!, y, "%d[%d]", pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!], pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
734 DLLgrtext_Printf(SUICIDES_COLcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:688:9`!, y, "%d[%d]", pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!], pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
735 y += height;
736 rank++;
737 if (y >= 440)
738 goto quick_exit;
739 }
740 }
741
742 quick_exit:;
743 }
744
745 void OnServerCollidecxx . . $ OnServerCollide(6273fa812ac58a8).(objectcxx . . $ object# *me_obj, objectcxx . . $ object# *it_obj) {
746 if (!me_obj || !it_obj)
747 return;
748
749 if (it_obj->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
750 DMFCBasecxx . . $ DMFCBase.->OnServerCollidecxx . . $ IDMFC#OnServerCollide(6273fa812ac58a8).(me_obj, it_obj);
751 return;
752 }
753
754 if ((me_obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) && (DLLInvCheckItem(it_obj->idcxx . . $ object#id., OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, HyperOrbIDcxx . . $ HyperOrbID.))) {
755 /*
756 //Two Players collided...one had orb
757 DLLmprintf(0,"Player2Player\n");
758 DMFCBase->CallClientEvent(EVT_CLIENT_GAMECOLLIDE,DMFCBase->GetMeObjNum(),DMFCBase->GetItObjNum(),-1);
759 DMFCBase->CallOnClientCollide(me_obj,it_obj);
760 */
761 } else if (me_obj->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! && me_obj->idcxx . . $ object#id. == HyperOrbIDcxx . . $ HyperOrbID.) {
762 // A Player collided with the HyperOrb
763 // Sent this information to the clients to process
764 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);
765 DMFCBasecxx . . $ DMFCBase.->CallOnClientCollidecxx . . $ IDMFC#CallOnClientCollide(6273fa812ac58a8).(me_obj, it_obj);
766 }
767
768 DMFCBasecxx . . $ DMFCBase.->OnServerCollidecxx . . $ IDMFC#OnServerCollide(6273fa812ac58a8).(me_obj, it_obj);
769 }
770
771 void OnClientCollidecxx . . $ OnClientCollide(6273fa812ac58a8).(objectcxx . . $ object# *me_objp, objectcxx . . $ object# *it_objp) {
772 if (me_objp->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
773 // spew this puppy
774 DLLPlayerSpewInventory(it_objp, false, false);
775 DLLAddHUDMessage(TXT_LOSTORBcxx . . $ `netgames/hyperanarchy/hyperstr.h:38:9`!, dPlayerscxx . . $ dPlayers.[it_objp->idcxx . . $ object#id.].callsigncxx . . $ player#callsign.);
776 WhoHasOrbcxx . . $ WhoHasOrb. = -1;
777 KillCountcxx . . $ KillCount. = 0;
778 HyperMoveTimercxx . . $ HyperMoveTimer. = -1;
779 UpdateEffectcxx . . $ UpdateEffect(49f6e7a06ebc5aa8).();
780 } else {
781 // We'll only get here if me_objp is HyperOrb and it_objp is the collider
782 WhoHasOrbcxx . . $ WhoHasOrb. = it_objp->idcxx . . $ object#id.;
783 KillCountcxx . . $ KillCount. = 0; // reset this variable, since they just picked up the HyperOrb
784
785 // add the hyper orb to the players inventory
786 DLLInvAddTypeID(it_objp->idcxx . . $ object#id., me_objp->typecxx . . $ object#type., me_objp->idcxx . . $ object#id., -1, -1, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
787 // if we are the server, remove the orb from the world and tell the clients to do the same
788 if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) {
789 DLLSetObjectDeadFlag(me_objp, true, 0);
790 }
791
792 DLLAddHUDMessage(TXT_GOTORBcxx . . $ `netgames/hyperanarchy/hyperstr.h:39:9`!, dPlayerscxx . . $ dPlayers.[it_objp->idcxx . . $ object#id.].callsigncxx . . $ player#callsign.);
793
794 // Play a sound
795 int id = DLLFindSoundName("PwrHyperOrb");
796 if (id != -1)
797 DLLPlay3dSound(id, &dObjectscxx . . $ dObjects.[dPlayerscxx . . $ dPlayers.[DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()].objnumcxx . . $ player#objnum.], 1, 0);
798 UpdateEffectcxx . . $ UpdateEffect(49f6e7a06ebc5aa8).();
799
800 // Set a Timer to display
801 if (WhoJustScoredTimercxx . . $ WhoJustScoredTimer. != -1)
802 DMFCBasecxx . . $ DMFCBase.->KillTimercxx . . $ IDMFC#KillTimer(d4f767463ce0a6b3).(WhoJustScoredTimercxx . . $ WhoJustScoredTimer.);
803 WhoJustScoredTimercxx . . $ WhoJustScoredTimer. = DMFCBasecxx . . $ DMFCBase.->SetTimerIntervalcxx . . $ IDMFC#SetTimerInterval(695c251031f3a34d).(OnTimercxx . . $ OnTimer(49f6e7a06ebc5aa8)., 0.5f, 5.0f, OnTimerKillcxx . . $ OnTimerKill(49f6e7a06ebc5aa8).);
804 }
805 DMFCBasecxx . . $ DMFCBase.->OnClientCollidecxx . . $ IDMFC#OnClientCollide(6273fa812ac58a8).(me_objp, it_objp);
806 }
807
808 void OnClientPlayerKilledcxx . . $ OnClientPlayerKilled(766a1b7183ffa4b4).(objectcxx . . $ object# *killer_obj, int victim_pnum) {
809 int score = 0;
810 int kpnum;
811
812 if (killer_obj) {
813 if ((killer_obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) || (killer_obj->typecxx . . $ object#type. == OBJ_GHOSTcxx . . $ `Descent3/object_external.h:172:9`!))
814 kpnum = killer_obj->idcxx . . $ object#id.;
815 else if (killer_obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || (killer_obj->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`! && killer_obj->ai_infocxx . . $ object#ai_info.)) {
816 // countermeasure kill
817 kpnum = DMFCBasecxx . . $ DMFCBase.->GetCounterMeasureOwnercxx . . $ IDMFC#GetCounterMeasureOwner(2da2a862cad4c994).(killer_obj);
818 } else {
819 kpnum = -1;
820 }
821 } else
822 kpnum = -1;
823
824 bool suicide = (bool)(kpnum == victim_pnum);
825
826 if (victim_pnum == WhoHasOrbcxx . . $ WhoHasOrb.) {
827 // The guy with the score orb lost it!
828 KillCountcxx . . $ KillCount.++;
829 if (!suicide) {
830 score = KillCountcxx . . $ KillCount. + 1;
831 if (score > 5)
832 score = 5;
833 } else {
834 score = -(KillCountcxx . . $ KillCount. + 1);
835 if (score < -5)
836 score = -5;
837 }
838
839 WhoHasOrbcxx . . $ WhoHasOrb. = -1;
840 KillCountcxx . . $ KillCount. = 0;
841 HyperMoveTimercxx . . $ HyperMoveTimer. = -1;
842 DLLAddHUDMessage(TXT_LOSTORBcxx . . $ `netgames/hyperanarchy/hyperstr.h:38:9`!, dPlayerscxx . . $ dPlayers.[victim_pnum].callsigncxx . . $ player#callsign.);
843
844 UpdateEffectcxx . . $ UpdateEffect(49f6e7a06ebc5aa8).();
845 } else {
846
847 if (kpnum != -1) {
848 // Was the killer the guy with the HyperOrb?
849 if (kpnum == WhoHasOrbcxx . . $ WhoHasOrb.) {
850 // Yup!
851 KillCountcxx . . $ KillCount.++;
852 score = KillCountcxx . . $ KillCount. + 1;
853 if (score > 5)
854 score = 5;
855 if (!suicide)
856 DLLAddHUDMessage(TXT_SCOREPOINTScxx . . $ `netgames/hyperanarchy/hyperstr.h:40:9`!, dPlayerscxx . . $ dPlayers.[kpnum].callsigncxx . . $ player#callsign., score);
857 } else {
858 // Nope!
859 if (!suicide)
860 score = 1;
861 else
862 score = -1;
863 }
864 }
865 }
866
867 tPlayerStatcxx . . $ tPlayerStat# *stat = (tPlayerStatcxx . . $ tPlayerStat# *)DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordDatacxx . . $ IDMFC#GetPlayerRecordData(d1680a912d714170).(kpnum);
868
869 if (kpnum != -1 && stat) {
870 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] += score;
871 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!] += score;
872 }
873
874 if ((DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) && (kpnum != -1) && (stat)) {
875 // check the score to see if we hit the limit
876 if ((DMFCBasecxx . . $ DMFCBase.->GetScoreLimitcxx . . $ IDMFC#GetScoreLimit(18a3c31ed0aa5760).(&score))) {
877 if (score <= stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]) {
878 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "Score limit reached\n");
879 DMFCBasecxx . . $ DMFCBase.->EndLevelcxx . . $ IDMFC#EndLevel(49f6e7a06ebc5aa8).();
880 }
881 }
882 }
883
884 DMFCBasecxx . . $ DMFCBase.->OnClientPlayerKilledcxx . . $ IDMFC#OnClientPlayerKilled(766a1b7183ffa4b4).(killer_obj, victim_pnum);
885 }
886
887 void OnServerPlayerDisconnectcxx . . $ OnServerPlayerDisconnect(d4f767463ce0a6b3).(int player_num) {
888 DMFCBasecxx . . $ DMFCBase.->OnServerPlayerDisconnectcxx . . $ IDMFC#OnServerPlayerDisconnect(d4f767463ce0a6b3).(player_num);
889 if (player_num == WhoHasOrbcxx . . $ WhoHasOrb.) {
890 // send this event to the clients so they can handle it
891 DMFCBasecxx . . $ DMFCBase.->CallClientEventcxx . . $ IDMFC#CallClientEvent(d7a7761809021567).(EVT_CLIENT_GAMEPLAYERDISCONNECTcxx . . $ `lib/d3events.h:100:9`!, DMFCBasecxx . . $ DMFCBase.->GetMeObjNumcxx . . $ IDMFC#GetMeObjNum(b126dc7c1de90089).(), DMFCBasecxx . . $ DMFCBase.->GetItObjNumcxx . . $ IDMFC#GetItObjNum(b126dc7c1de90089).(), -1);
892 DMFCBasecxx . . $ DMFCBase.->CallOnClientPlayerDisconnectcxx . . $ IDMFC#CallOnClientPlayerDisconnect(d4f767463ce0a6b3).(player_num);
893 }
894 }
895
896 void OnClientPlayerDisconnectcxx . . $ OnClientPlayerDisconnect(d4f767463ce0a6b3).(int player_num) {
897 if (player_num == WhoHasOrbcxx . . $ WhoHasOrb.) {
898 WhoHasOrbcxx . . $ WhoHasOrb. = -1;
899 KillCountcxx . . $ KillCount. = 0;
900 HyperMoveTimercxx . . $ HyperMoveTimer. = -1;
901 ResetTimercxx . . $ ResetTimer(49f6e7a06ebc5aa8).();
902 }
903 DMFCBasecxx . . $ DMFCBase.->OnClientPlayerDisconnectcxx . . $ IDMFC#OnClientPlayerDisconnect(d4f767463ce0a6b3).(player_num);
904 }
905
906 void SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(char *filename) {
907 CFILEcxx . . $ CFILE# *file;
908 DLLOpenCFILE(&file, filenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "wt");
909 if (!file) {
910 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "Unable to open output file\n");
911 return;
912 }
913
914 // write out game stats
915 #define BUFSIZEcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:915:9`! 150
916 char buffer[BUFSIZEcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:915:9`!];
917 char tempbuffer[25];
918 int sortedslots[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!];
919 player_recordcxx . . $ player_record# *pr, *dpr;
920 tPInfoStatcxx . . $ tPInfoStat# stat;
921 tPlayerStatcxx . . $ tPlayerStat# *ps;
922 int count, p;
923
924 // sort the stats
925 SortPlayerScorescxx . . $ SortPlayerScores(621ccea12ecf5b06).(sortedslots, MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!);
926 count = 1;
927
928 snprintf(buffer, sizeof(buffer), TXT_SAVESTATSAcxx . . $ `netgames/hyperanarchy/hyperstr.h:50:9`!, (DMFCBasecxx . . $ DMFCBase.->GetNetgameInfocxx . . $ IDMFC#GetNetgameInfo(242e78cd5130aa12).())->namecxx . . $ netgame_info#name.,
929 (DMFCBasecxx . . $ DMFCBase.->GetCurrentMissioncxx . . $ IDMFC#GetCurrentMission(d7a4f7ca6f9cb411).())->cur_levelcxx . . $ tMission#cur_level.);
930 DLLcf_WriteString(file, buffer);
931
932 snprintf(buffer, sizeof(buffer), "%s", TXT_SAVESTATSBcxx . . $ `netgames/hyperanarchy/hyperstr.h:51:9`!);
933 DLLcf_WriteString(file, buffer);
934
935 snprintf(buffer, sizeof(buffer), "%s", TXT_SAVESTATSCcxx . . $ `netgames/hyperanarchy/hyperstr.h:52:9`!);
936 DLLcf_WriteString(file, buffer);
937 strcpy(buffer, "----------------------------------------------------------------------------------------------");
938 DLLcf_WriteString(file, buffer);
939
940 for (p = 0; p < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; p++) {
941 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(sortedslots[p]);
942 if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) {
943
944 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
945 continue; // skip dedicated server
946
947 memset(buffer, ' ', BUFSIZEcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:915:9`!);
948
949 ps = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.;
950
951 snprintf(tempbuffer, sizeof(tempbuffer), "%d)", count);
952 memcpy(&buffer[0], tempbuffer, strlen(tempbuffer));
953
954 snprintf(tempbuffer, sizeof(tempbuffer), "%s%s", (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) ? "" : "*", pr->callsigncxx . . $ player_record#callsign.);
955 memcpy(&buffer[7], tempbuffer, strlen(tempbuffer));
956
957 if (ps) {
958 snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", ps->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!], ps->Scorecxx . . $ tPlayerStat#Score.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
959 memcpy(&buffer[35], tempbuffer, strlen(tempbuffer));
960 }
961
962 snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!],
963 pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
964 memcpy(&buffer[47], tempbuffer, strlen(tempbuffer));
965
966 snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!],
967 pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
968 memcpy(&buffer[59], tempbuffer, strlen(tempbuffer));
969
970 snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!],
971 pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
972 memcpy(&buffer[70], tempbuffer, strlen(tempbuffer));
973
974 snprintf(tempbuffer, sizeof(tempbuffer), "%s", DMFCBasecxx . . $ DMFCBase.->GetTimeStringcxx . . $ IDMFC#GetTimeString(3b344d7a46e3c2ff).(DMFCBasecxx . . $ DMFCBase.->GetTimeInGamecxx . . $ IDMFC#GetTimeInGame(5cde91ea12d43f46).(sortedslots[p])));
975 memcpy(&buffer[81], tempbuffer, strlen(tempbuffer));
976
977 size_t pos = 81 + strlen(tempbuffer) + 1;
978
979 if (pos < BUFSIZEcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:915:9`!)
980 buffer[pos] = '\0';
981
982 buffer[BUFSIZEcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:915:9`! - 1] = '\0';
983 DLLcf_WriteString(file, buffer);
984 count++;
985 }
986 }
987
988 DLLcf_WriteString(file, TXT_SAVESTATSDcxx . . $ `netgames/hyperanarchy/hyperstr.h:54:9`!);
989
990 count = 1;
991 for (p = 0; p < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; p++) {
992 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(p);
993 if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) {
994
995 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
996 continue; // skip dedicated server
997
998 // Write out header
999 snprintf(buffer, sizeof(buffer), "%d) %s%s", count, (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) ? "" : "*", pr->callsigncxx . . $ player_record#callsign.);
1000 DLLcf_WriteString(file, buffer);
1001 size_t length = strlen(buffer);
1002 memset(buffer, '=', length);
1003 buffer[length] = '\0';
1004 DLLcf_WriteString(file, buffer);
1005
1006 // time in game
1007 snprintf(buffer, sizeof(buffer), TXT_TIMEINGAMEcxx . . $ `netgames/hyperanarchy/hyperstr.h:55:9`!, DMFCBasecxx . . $ DMFCBase.->GetTimeStringcxx . . $ IDMFC#GetTimeString(3b344d7a46e3c2ff).(DMFCBasecxx . . $ DMFCBase.->GetTimeInGamecxx . . $ IDMFC#GetTimeInGame(5cde91ea12d43f46).(p)));
1008 DLLcf_WriteString(file, buffer);
1009
1010 if (DMFCBasecxx . . $ DMFCBase.->FindPInfoStatFirstcxx . . $ IDMFC#FindPInfoStatFirst(e8124cb919632806).(p, &stat)) {
1011 snprintf(buffer, sizeof(buffer), "%s", TXT_SAVESTATSEcxx . . $ `netgames/hyperanarchy/hyperstr.h:56:9`!);
1012 DLLcf_WriteString(file, buffer);
1013
1014 if (stat.slotcxx . . $ tPInfoStat#slot. != p) {
1015 memset(buffer, ' ', BUFSIZEcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:915:9`!);
1016 dpr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(stat.slotcxx . . $ tPInfoStat#slot.);
1017
1018 if (dpr) {
1019 snprintf(tempbuffer, sizeof(tempbuffer), "%s", dpr->callsigncxx . . $ player_record#callsign.);
1020 memcpy(buffer, tempbuffer, strlen(tempbuffer));
1021
1022 snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.killscxx . . $ tPInfoStat#kills.);
1023 memcpy(&buffer[30], tempbuffer, strlen(tempbuffer));
1024
1025 snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.deathscxx . . $ tPInfoStat#deaths.);
1026 memcpy(&buffer[40], tempbuffer, strlen(tempbuffer));
1027
1028 size_t pos = 40 + strlen(tempbuffer) + 1;
1029 if (pos < BUFSIZEcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:915:9`!)
1030 buffer[pos] = '\0';
1031
1032 buffer[BUFSIZEcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:915:9`! - 1] = '\0';
1033 DLLcf_WriteString(file, buffer);
1034 }
1035 }
1036
1037 while (DMFCBasecxx . . $ DMFCBase.->FindPInfoStatNextcxx . . $ IDMFC#FindPInfoStatNext(4ead3766c292904).(&stat)) {
1038 if (stat.slotcxx . . $ tPInfoStat#slot. != p) {
1039 memset(buffer, ' ', BUFSIZEcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:915:9`!);
1040 dpr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(stat.slotcxx . . $ tPInfoStat#slot.);
1041
1042 if (dpr) {
1043 strncpy(tempbuffer, dpr->callsigncxx . . $ player_record#callsign., sizeof(tempbuffer));
1044 memcpy(buffer, tempbuffer, strlen(tempbuffer));
1045
1046 snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.killscxx . . $ tPInfoStat#kills.);
1047 memcpy(&buffer[30], tempbuffer, strlen(tempbuffer));
1048
1049 snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.deathscxx . . $ tPInfoStat#deaths.);
1050 memcpy(&buffer[40], tempbuffer, strlen(tempbuffer));
1051
1052 size_t pos = 40 + strlen(tempbuffer) + 1;
1053 if (pos < BUFSIZEcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:915:9`!)
1054 buffer[pos] = '\0';
1055
1056 buffer[BUFSIZEcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:915:9`! - 1] = '\0';
1057 DLLcf_WriteString(file, buffer);
1058 }
1059 }
1060 }
1061 }
1062 DMFCBasecxx . . $ DMFCBase.->FindPInfoStatClosecxx . . $ IDMFC#FindPInfoStatClose(49f6e7a06ebc5aa8).();
1063 DLLcf_WriteString(file, ""); // skip a line
1064 count++;
1065 }
1066 }
1067
1068 // done writing stats
1069 DLLcfclose(file);
1070 DLLAddHUDMessage(TXT_STATSAVEDcxx . . $ `netgames/hyperanarchy/hyperstr.h:57:9`!);
1071 }
1072
1073 #define ROOTFILENAMEcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:1073:9`! "Hyper"
1074 void OnSaveStatsToFilecxx . . $ OnSaveStatsToFile(49f6e7a06ebc5aa8).(void) {
1075 char filename[256];
1076 DMFCBasecxx . . $ DMFCBase.->GenerateStatFilenamecxx . . $ IDMFC#GenerateStatFilename(4d4dad76095ad7d8).(filename, ROOTFILENAMEcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:1073:9`!, false);
1077 SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(filename);
1078 }
1079
1080 void OnLevelEndSaveStatsToFilecxx . . $ OnLevelEndSaveStatsToFile(49f6e7a06ebc5aa8).(void) {
1081 char filename[256];
1082 DMFCBasecxx . . $ DMFCBase.->GenerateStatFilenamecxx . . $ IDMFC#GenerateStatFilename(4d4dad76095ad7d8).(filename, ROOTFILENAMEcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:1073:9`!, true);
1083 SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(filename);
1084 }
1085
1086 void OnDisconnectSaveStatsToFilecxx . . $ OnDisconnectSaveStatsToFile(49f6e7a06ebc5aa8).(void) {
1087 char filename[256];
1088 DMFCBasecxx . . $ DMFCBase.->GenerateStatFilenamecxx . . $ IDMFC#GenerateStatFilename(4d4dad76095ad7d8).(filename, ROOTFILENAMEcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:1073:9`!, false);
1089 SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(filename);
1090 }
1091
1092 /////////////////////////////////////////////////////////////
1093 /////////////////////////////////////////////////////////////
1094
1095 // handles a Hyper Anarchy Game State packet
1096 void ReceiveHyperGameStatecxx . . $ ReceiveHyperGameState(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) {
1097 // remove all the HyperOrbs from everyone's inventory
1098 for (int i = 0; i < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; i++)
1099 DLLInvRemove(i, OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, HyperOrbIDcxx . . $ HyperOrbID.);
1100
1101 int count = 0;
1102 WhoHasOrbcxx . . $ WhoHasOrb. = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count);
1103 KillCountcxx . . $ KillCount. = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count);
1104
1105 if (WhoHasOrbcxx . . $ WhoHasOrb. != -1) {
1106 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "%s has the score orb!\n", dPlayers[WhoHasOrb].callsign);
1107 DLLInvAddTypeID(WhoHasOrbcxx . . $ WhoHasOrb., OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, HyperOrbIDcxx . . $ HyperOrbID., -1, -1, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1108 }
1109 UpdateEffectcxx . . $ UpdateEffect(49f6e7a06ebc5aa8).();
1110 }
1111
1112 // sends a Hyper Anarchy Game State packet
1113 void SendHyperGameStatecxx . . $ SendHyperGameState(d4f767463ce0a6b3).(int playernum) {
1114 bool updateall = false;
1115 int count = 0;
1116 uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!];
1117 DMFCBasecxx . . $ DMFCBase.->StartPacketcxx . . $ IDMFC#StartPacket(261852a8f74abaa0).(data, SPID_HYPERINFOcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:67:9`!, &count);
1118
1119 if ((WhoHasOrbcxx . . $ WhoHasOrb. != -1) && (!DMFCBasecxx . . $ DMFCBase.->CheckPlayerNumcxx . . $ IDMFC#CheckPlayerNum(83c267b20bac841a).(WhoHasOrbcxx . . $ WhoHasOrb.))) {
1120 WhoHasOrbcxx . . $ WhoHasOrb. = -1;
1121 KillCountcxx . . $ KillCount. = 0;
1122 HyperMoveTimercxx . . $ HyperMoveTimer. = -1;
1123 updateall = true;
1124 }
1125
1126 MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(WhoHasOrbcxx . . $ WhoHasOrb., data, &count);
1127 MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(KillCountcxx . . $ KillCount., data, &count);
1128
1129 DMFCBasecxx . . $ DMFCBase.->SendPacketcxx . . $ IDMFC#SendPacket(49a5bbab55ea8abc).(data, count, (updateall) ? SP_ALLcxx . . $ `netgames/includes/DMFC.h:435:9`! : playernum);
1130
1131 if (updateall) {
1132 // remove all the HyperOrbs from everyone's inventory
1133 for (int i = 0; i < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; i++)
1134 DLLInvRemove(i, OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, HyperOrbIDcxx . . $ HyperOrbID.);
1135 UpdateEffectcxx . . $ UpdateEffect(49f6e7a06ebc5aa8).();
1136 }
1137 }
1138
1139 // Displays HUD scores
1140 void DisplayHUDScorescxx . . $ DisplayHUDScores(c7a20e4e05358911).(struct tHUDItemcxx . . $ tHUDItem# *hitem) {
1141 if (display_my_welcomecxx . . $ display_my_welcome.) {
1142 DisplayWelcomeScreencxx . . $ DisplayWelcomeScreen(d4f767463ce0a6b3).(DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).());
1143 display_my_welcomecxx . . $ display_my_welcome. = false;
1144 }
1145
1146 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.)
1147 return;
1148
1149 int height = DLLgrfont_GetHeight((DMFCBasecxx . . $ DMFCBase.->GetGameFontTranslateArraycxx . . $ IDMFC#GetGameFontTranslateArray(a7741f82f5fc3640).())[HUD_FONT_INDEXcxx . . $ `Descent3/gamefont.h:97:9`!]) + 3;
1150 uint8_tcxx . . $ uint8_t# alpha = DMFCBasecxx . . $ DMFCBase.->ConvertHUDAlphacxx . . $ IDMFC#ConvertHUDAlpha(50106d451684defa).((uint8_tcxx . . $ uint8_t#)((DisplayScoreScreencxx . . $ DisplayScoreScreen.) ? 128 : 255));
1151 int y = (DMFCBasecxx . . $ DMFCBase.->GetGameWindowHcxx . . $ IDMFC#GetGameWindowH(b126dc7c1de90089).() / 2) - ((height * 5) / 2);
1152 int x = 510;
1153 int rank = 1;
1154 ddgr_colorcxx . . $ ddgr_color# color = 0;
1155 bool hasorb;
1156 char temp[50];
1157 bool hdisp = false;
1158
1159 // determine coordinates to use here
1160 // we'll use a virtual width of 85 pixels on a 640x480 screen
1161 // so first determine the new width
1162 int name_width = 85.0f * DMFCBasecxx . . $ DMFCBase.->GetHudAspectXcxx . . $ IDMFC#GetHudAspectX(9b8c9e39889c762c).();
1163 int score_width = DLLgrtext_GetTextLineWidth("888");
1164 int name_x = DMFCBasecxx . . $ DMFCBase.->GetGameWindowWcxx . . $ IDMFC#GetGameWindowW(b126dc7c1de90089).() - name_width - score_width - 10;
1165 int score_x = DMFCBasecxx . . $ DMFCBase.->GetGameWindowWcxx . . $ IDMFC#GetGameWindowW(b126dc7c1de90089).() - score_width - 5;
1166 int icon_size = height - 3;
1167 int icon_x = name_x - 5 - icon_size;
1168 bool player_shown;
1169
1170 #define NUM_PLAYERS_TO_SHOW_PLUS_ONEcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:1170:9`! 6
1171
1172 for (int i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) {
1173 int slot = SortedPlayerscxx . . $ SortedPlayers.[i];
1174 player_recordcxx . . $ player_record# *pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(slot);
1175 player_shown = false;
1176
1177 if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) {
1178 hasorb = false;
1179
1180 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
1181 continue; // skip dedicated server
1182
1183 if ((pr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.) || (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME. && !DMFCBasecxx . . $ DMFCBase.->IsPlayerObservercxx . . $ IDMFC#IsPlayerObserver(83c267b20bac841a).(pr->pnumcxx . . $ player_record#pnum.))) {
1184 tPlayerStatcxx . . $ tPlayerStat# *stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.;
1185
1186 if ((rank < NUM_PLAYERS_TO_SHOW_PLUS_ONEcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:1170:9`!) ||
1187 (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME. && pr->pnumcxx . . $ player_record#pnum. == DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()))
1188 player_shown = true;
1189
1190 if (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME. && WhoHasOrbcxx . . $ WhoHasOrb. == pr->pnumcxx . . $ player_record#pnum.) {
1191 hasorb = true;
1192 if (player_shown)
1193 hdisp = true;
1194 }
1195
1196 if (((pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) && (WhoHasOrbcxx . . $ WhoHasOrb. != pr->pnumcxx . . $ player_record#pnum.)) || (DisplayFlagBlinkcxx . . $ DisplayFlagBlink.) ||
1197 pr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.) {
1198 strcpy(temp, pr->callsigncxx . . $ player_record#callsign.);
1199 DMFCBasecxx . . $ DMFCBase.->ClipStringcxx . . $ IDMFC#ClipString(8677479218165cd4).(name_width, temp, true);
1200
1201 if (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME. && pr->pnumcxx . . $ player_record#pnum. == DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()) {
1202
1203 switch (HUD_color_modelcxx . . $ HUD_color_model.) {
1204 case HCM_PLAYERCOLORcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:69:9`!:
1205 color = (DMFCBasecxx . . $ DMFCBase.->GetPlayerColorscxx . . $ IDMFC#GetPlayerColors(ac695d451f96e4aa).())[pr->pnumcxx . . $ player_record#pnum.];
1206 break;
1207 case HCM_NORMALcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:70:9`!:
1208 color = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(40, 255, 40);
1209 break;
1210 };
1211
1212 if (Highlight_bmpcxx . . $ Highlight_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) {
1213 // draw the highlight bar in the background
1214 DLLrend_SetAlphaValue(alpha * 0.50f);
1215 DLLrend_SetZBufferState(0);
1216 DLLrend_SetTextureType(TT_LINEARcxx . . $ TT_LINEAR.);
1217 DLLrend_SetLighting(LS_NONEcxx . . $ LS_NONE.);
1218 DLLrend_SetAlphaType(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!);
1219
1220 DLLrend_DrawScaledBitmap(icon_x - 2, y - 2, score_x + score_width + 2, y + height - 1, Highlight_bmpcxx . . $ Highlight_bmp., 0,
1221 0, 1, 1, 1.0f, -1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1222 DLLrend_SetZBufferState(1);
1223 }
1224
1225 DLLgrtext_SetAlpha(alpha);
1226 DLLgrtext_SetColor(color);
1227 DLLgrtext_Printf(name_x, y, temp);
1228 DLLgrtext_Printf(score_x, y, "%d", (stat) ? stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0);
1229
1230 } else if (rank < NUM_PLAYERS_TO_SHOW_PLUS_ONEcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:1170:9`!) {
1231 if (pr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.) {
1232 color = GR_GREYcxx . . $ `netgames/includes/DMFC.h:432:9`!;
1233 } else {
1234 switch (HUD_color_modelcxx . . $ HUD_color_model.) {
1235 case HCM_PLAYERCOLORcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:69:9`!:
1236 color = (DMFCBasecxx . . $ DMFCBase.->GetPlayerColorscxx . . $ IDMFC#GetPlayerColors(ac695d451f96e4aa).())[pr->pnumcxx . . $ player_record#pnum.];
1237 break;
1238 case HCM_NORMALcxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:70:9`!:
1239 color = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(40, 255, 40);
1240 break;
1241 };
1242 }
1243
1244 DLLgrtext_SetAlpha(alpha);
1245 DLLgrtext_SetColor(color);
1246 DLLgrtext_Printf(name_x, y, temp);
1247 DLLgrtext_Printf(score_x, y, "%d", (stat) ? stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0);
1248 }
1249 }
1250
1251 if (hasorb && DisplayFlagBlinkcxx . . $ DisplayFlagBlink.) {
1252 DLLrend_SetZBufferState(0);
1253 DLLrend_SetTextureType(TT_LINEARcxx . . $ TT_LINEAR.);
1254 DLLrend_SetAlphaValue(alpha);
1255 DLLrend_SetLighting(LS_NONEcxx . . $ LS_NONE.);
1256 DLLrend_SetWrapType(WT_CLAMPcxx . . $ WT_CLAMP.);
1257 DLLrend_SetAlphaType(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!);
1258 DLLrend_DrawScaledBitmap(icon_x, y, icon_x + icon_size, y + icon_size, HyperOrbIconcxx . . $ HyperOrbIcon., 0, 0, 1, 1, 1.0f, -1,
1259 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1260 DLLrend_SetZBufferState(1);
1261 }
1262
1263 if (player_shown)
1264 y += height;
1265 rank++;
1266 }
1267 }
1268 }
1269
1270 if (WhoHasOrbcxx . . $ WhoHasOrb. != -1 && DisplayFlagBlinkcxx . . $ DisplayFlagBlink. && !hdisp) {
1271 player_recordcxx . . $ player_record# *pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordByPnumcxx . . $ IDMFC#GetPlayerRecordByPnum(6359c6f28dd028ae).(WhoHasOrbcxx . . $ WhoHasOrb.);
1272 if (pr && pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) {
1273 // the player with the orb needs to be shown
1274 strcpy(temp, dPlayerscxx . . $ dPlayers.[WhoHasOrbcxx . . $ WhoHasOrb.].callsigncxx . . $ player#callsign.);
1275 DMFCBasecxx . . $ DMFCBase.->ClipStringcxx . . $ IDMFC#ClipString(8677479218165cd4).(name_width, temp, true);
1276
1277 DLLgrtext_SetAlpha(alpha);
1278 DLLgrtext_SetColor(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(40, 255, 40));
1279 DLLgrtext_Printf(name_x, y, temp);
1280
1281 tPlayerStatcxx . . $ tPlayerStat# *stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.;
1282 DLLgrtext_Printf(score_x, y, "%d", (stat) ? stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0);
1283
1284 DLLrend_SetZBufferState(0);
1285 DLLrend_SetTextureType(TT_LINEARcxx . . $ TT_LINEAR.);
1286 DLLrend_SetAlphaValue(alpha);
1287 DLLrend_SetLighting(LS_NONEcxx . . $ LS_NONE.);
1288 DLLrend_SetWrapType(WT_CLAMPcxx . . $ WT_CLAMP.);
1289 DLLrend_SetAlphaType(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!);
1290 DLLrend_DrawScaledBitmap(icon_x, y, icon_x + icon_size, y + icon_size, HyperOrbIconcxx . . $ HyperOrbIcon., 0, 0, 1, 1, 1.0f, -1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1291 DLLrend_SetZBufferState(1);
1292 }
1293 }
1294
1295 // Display the HyperOrb in the corner if we have it
1296 if (DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).() == WhoHasOrbcxx . . $ WhoHasOrb.) {
1297 DLLrend_SetZBufferState(0);
1298 DLLrend_SetTextureType(TT_LINEARcxx . . $ TT_LINEAR.);
1299 DLLrend_SetAlphaValue(alpha);
1300 DLLrend_SetLighting(LS_NONEcxx . . $ LS_NONE.);
1301 DLLrend_SetWrapType(WT_CLAMPcxx . . $ WT_CLAMP.);
1302 DLLrend_SetAlphaType(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!);
1303 int x1, x2, y1, y2;
1304 x1 = DMFCBasecxx . . $ DMFCBase.->GetGameWindowWcxx . . $ IDMFC#GetGameWindowW(b126dc7c1de90089).() - 5 - DLLbm_w(HyperOrbIconcxx . . $ HyperOrbIcon., 0);
1305 y1 = 25;
1306 x2 = x1 + DLLbm_w(HyperOrbIconcxx . . $ HyperOrbIcon., 0);
1307 y2 = y1 + DLLbm_h(HyperOrbIconcxx . . $ HyperOrbIcon., 0);
1308 DLLrend_DrawScaledBitmap(x1, y1, x2, y2, HyperOrbIconcxx . . $ HyperOrbIcon., 0, 0, 1, 1, 1.0f, -1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1309 DLLrend_SetZBufferState(1);
1310 }
1311 }
1312
1313 // Update Effect on the guy who has the Orb
1314 void UpdateEffectcxx . . $ UpdateEffect(49f6e7a06ebc5aa8).(void) {
1315 float redb[4];
1316 float greenb[4];
1317 float blueb[4];
1318 int i;
1319
1320 for (i = 0; i < 4; i++) {
1321 redb[i] = 0.83f;
1322 greenb[i] = 0.17f;
1323 blueb[i] = 0;
1324 }
1325
1326 for (i = 0; i < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; i++) {
1327 if (DMFCBasecxx . . $ DMFCBase.->CheckPlayerNumcxx . . $ IDMFC#CheckPlayerNum(83c267b20bac841a).(i)) {
1328 // Player valid
1329 if (i == WhoHasOrbcxx . . $ WhoHasOrb.) {
1330 // Do the effect on this guy
1331 DLLPlayerSetRotatingBall(i, 3, 4, redb, greenb, blueb);
1332 } else {
1333 // Reset effect on this guy
1334 DLLPlayerSetRotatingBall(i, 0, 4, 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`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1335 }
1336 }
1337 }
1338 }
1339
1340 // Displays the Welcome Screen
1341 void DisplayWelcomeScreencxx . . $ DisplayWelcomeScreen(d4f767463ce0a6b3).(int player_num) {
1342 char name_buffer[64];
1343 strcpy(name_buffer, (DMFCBasecxx . . $ DMFCBase.->GetPlayerscxx . . $ IDMFC#GetPlayers(51ff8e716a252304).())[player_num].callsigncxx . . $ player#callsign.);
1344
1345 if (player_num == DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()) {
1346 DLLAddHUDMessage(TXT_WELCOMEcxx . . $ `netgames/hyperanarchy/hyperstr.h:42:9`!, name_buffer);
1347 } else {
1348 DLLAddHUDMessage(TXT_JOINEDcxx . . $ `netgames/hyperanarchy/hyperstr.h:43:9`!, name_buffer);
1349 }
1350 }
1351
1352 void SortPlayerScorescxx . . $ SortPlayerScores(621ccea12ecf5b06).(int *sortedindex, int size) {
1353 int tempsort[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!];
1354 int i, t, j;
1355
1356 for (i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) {
1357 tempsort[i] = i;
1358 }
1359
1360 for (i = 1; i <= MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`! - 1; i++) {
1361 t = tempsort[i];
1362 // Shift elements down until
1363 // insertion point found.
1364 for (j = i - 1; j >= 0 && compare_slotscxx . . $ compare_slots(cf9ef193275fa6d8).(tempsort[j], t); j--) {
1365 tempsort[j + 1] = tempsort[j];
1366 }
1367 // insert
1368 tempsort[j + 1] = t;
1369 }
1370
1371 // copy the array over
1372 memcpy(sortedindex, tempsort, ((size > MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!) ? MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`! : size) * sizeof(int));
1373 }
1374
1375 // Generates a valid random room
1376 int GetRandomValidRoomcxx . . $ GetRandomValidRoom(b126dc7c1de90089).(void) {
1377 while (1) {
1378 int room;
1379 room = randcxx . . $ rand(9efc7249d839d30e).() % (DMFCBasecxx . . $ DMFCBase.->GetHighestRoomIndexcxx . . $ IDMFC#GetHighestRoomIndex(b126dc7c1de90089).() + 1);
1380 if ((!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(room)) && ((DMFCBasecxx . . $ DMFCBase.->GetRoomscxx . . $ IDMFC#GetRooms(80f895f1fc5a89de).())[room].usedcxx . . $ room#used.)) {
1381 if (!((DMFCBasecxx . . $ DMFCBase.->GetRoomscxx . . $ IDMFC#GetRooms(80f895f1fc5a89de).())[room].flagscxx . . $ room#flags. & RF_EXTERNALcxx . . $ `Descent3/room_external.h:177:9`!)) {
1382 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "Room %d selected\n", room);
1383 return room;
1384 }
1385 }
1386 }
1387 }
1388
1389 // Moves the HyperOrb to the center of a random room
1390 // if objnum is -1, than the HyperOrb is created and moved
1391 void MoveHyperOrbToRoomcxx . . $ MoveHyperOrbToRoom(d4f767463ce0a6b3).(int objnum) {
1392 if ((objnum < 0) || (objnum >= MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!))
1393 objnum = -1;
1394 else if (dObjectscxx . . $ dObjects.[objnum].typecxx . . $ object#type. != OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!)
1395 objnum = -1;
1396
1397 if (objnum == -1) {
1398 // we need to create it and place it somewhere in the level
1399 CreateHyperOrbInRoomcxx . . $ CreateHyperOrbInRoom(d4f767463ce0a6b3).(GetRandomValidRoomcxx . . $ GetRandomValidRoom(b126dc7c1de90089).());
1400 } else {
1401 // we need to just move it
1402 MoveHyperOrbToRoomCentercxx . . $ MoveHyperOrbToRoomCenter(3e454b8ccf442868).(objnum, GetRandomValidRoomcxx . . $ GetRandomValidRoom(b126dc7c1de90089).());
1403 }
1404 }
1405
1406 // Given a room the HyperOrb is created and placed in the center of it
1407 void CreateHyperOrbInRoomcxx . . $ CreateHyperOrbInRoom(d4f767463ce0a6b3).(int room) {
1408 if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!)
1409 return;
1410 vectorcxx . . $ vector# vpos;
1411 int objnum;
1412 DLLComputeRoomCenter(&vpos, &((DMFCBasecxx . . $ DMFCBase.->GetRoomscxx . . $ IDMFC#GetRooms(80f895f1fc5a89de).())[room]));
1413 objnum = DLLObjCreate(OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, HyperOrbIDcxx . . $ HyperOrbID., room, &vpos, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!);
1414 DLLMultiSendObject(&dObjectscxx . . $ dObjects.[objnum], 0, true);
1415 }
1416
1417 // Given the objnum and room it will move the HyperOrb to the center of that room. Objnum better be valid.
1418 void MoveHyperOrbToRoomCentercxx . . $ MoveHyperOrbToRoomCenter(3e454b8ccf442868).(int objnum, int room) {
1419 vectorcxx . . $ vector# home_pos;
1420 DLLComputeRoomCenter(&home_pos, &((DMFCBasecxx . . $ DMFCBase.->GetRoomscxx . . $ IDMFC#GetRooms(80f895f1fc5a89de).())[room]));
1421 DLLObjSetPos(&dObjectscxx . . $ dObjects.[objnum], &home_pos, room, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, false);
1422 if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) { // tell the clients to move
1423 uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!];
1424 int count = 0;
1425
1426 DMFCBasecxx . . $ DMFCBase.->StartPacketcxx . . $ IDMFC#StartPacket(261852a8f74abaa0).(data, SPID_HYPERPOScxx . . $ `netgames/hyperanarchy/hyperanarchy.cpp:68:9`!, &count);
1427 MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(room, data, &count);
1428 DMFCBasecxx . . $ DMFCBase.->SendPacketcxx . . $ IDMFC#SendPacket(49a5bbab55ea8abc).(data, count, SP_ALLcxx . . $ `netgames/includes/DMFC.h:435:9`!);
1429 }
1430 }
1431
1432 // handles a Hyper Anarchy Object Placement packet
1433 void ReceiveHyperPoscxx . . $ ReceiveHyperPos(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) {
1434 int count = 0;
1435 int room = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count);
1436
1437 // first find the Orb's number
1438 int objnum = FindHyperObjectNumcxx . . $ FindHyperObjectNum(b126dc7c1de90089).();
1439 if (objnum == -1) {
1440 // THIS BETTER NOT HAPPEN!!!!!!!
1441 Int3cxx . . $ `netgames/includes/DMFC.h:378:9`!();
1442 }
1443 MoveHyperOrbToRoomCentercxx . . $ MoveHyperOrbToRoomCenter(3e454b8ccf442868).(objnum, room);
1444 }
1445
1446 // Searches through all the objects and looks for the HyperOrb, returns it's objnum. -1 if it doesn't exist
1447 int FindHyperObjectNumcxx . . $ FindHyperObjectNum(b126dc7c1de90089).(void) {
1448 // go through all the objects until we find it
1449 for (int i = 0; i < MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!; i++) {
1450 if ((dObjectscxx . . $ dObjects.[i].typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!) && (dObjectscxx . . $ dObjects.[i].idcxx . . $ object#id. == HyperOrbIDcxx . . $ HyperOrbID.)) {
1451 // we found it
1452 return i;
1453 }
1454 }
1455 return -1;
1456 }
1457
1458 // Searches through all the player's inventory, returns the pnum of the player who has the HyperOrb, -1
1459 // if no one does.
1460 int FindHyperOrbInInventorycxx . . $ FindHyperOrbInInventory(b126dc7c1de90089).(void) {
1461 // go through everyone's inventory looking for HyperOrb
1462 for (int pnum = 0; pnum < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; pnum++) {
1463 if (DMFCBasecxx . . $ DMFCBase.->CheckPlayerNumcxx . . $ IDMFC#CheckPlayerNum(83c267b20bac841a).(pnum)) {
1464 if (DLLInvCheckItem(pnum, OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, HyperOrbIDcxx . . $ HyperOrbID.))
1465 return pnum;
1466 }
1467 }
1468 return -1;
1469 }
1470
1471 void ResetTimercxx . . $ ResetTimer(49f6e7a06ebc5aa8).(void) {
1472 if (HyperMoveTimercxx . . $ HyperMoveTimer. != -1)
1473 DMFCBasecxx . . $ DMFCBase.->KillTimercxx . . $ IDMFC#KillTimer(d4f767463ce0a6b3).(HyperMoveTimercxx . . $ HyperMoveTimer.);
1474 HyperMoveTimercxx . . $ HyperMoveTimer. = -1;
1475 }
1476
1477 /////////////////////////////////
1478 // Timer event handlers
1479 void OnTimercxx . . $ OnTimer(49f6e7a06ebc5aa8).(void) { DisplayFlagBlinkcxx . . $ DisplayFlagBlink. = !DisplayFlagBlinkcxx . . $ DisplayFlagBlink.; }
1480 void OnTimerKillcxx . . $ OnTimerKill(49f6e7a06ebc5aa8).(void) { DisplayFlagBlinkcxx . . $ DisplayFlagBlink. = true; }
1481
1482 void OnTimerFlagReturncxx . . $ OnTimerFlagReturn(49f6e7a06ebc5aa8).(void) {
1483 if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!)
1484 return;
1485 if (WhoHasOrbcxx . . $ WhoHasOrb. == -1) {
1486 // time to return move the hyperorb home
1487 int objnum = FindHyperObjectNumcxx . . $ FindHyperObjectNum(b126dc7c1de90089).();
1488 if (objnum != -1) {
1489 // ok, so it's in some place, lets move it home
1490 MoveHyperOrbToRoomcxx . . $ MoveHyperOrbToRoom(d4f767463ce0a6b3).(objnum);
1491 } else {
1492 // did it disappear?, check all the players inventories
1493 WhoHasOrbcxx . . $ WhoHasOrb. = FindHyperOrbInInventorycxx . . $ FindHyperOrbInInventory(b126dc7c1de90089).();
1494 if (WhoHasOrbcxx . . $ WhoHasOrb. == -1) { // no one has it, it's missing!, create it and place it in a room
1495 MoveHyperOrbToRoomcxx . . $ MoveHyperOrbToRoom(d4f767463ce0a6b3).(-1);
1496 }
1497 }
1498 }
1499 HyperMoveTimercxx . . $ HyperMoveTimer. = -1;
1500 }
1501
1502 void OnTimerFlagReturnKillcxx . . $ OnTimerFlagReturnKill(49f6e7a06ebc5aa8).(void) { HyperMoveTimercxx . . $ HyperMoveTimer. = -1; }
1503
1504 void SwitchHUDColorcxx . . $ SwitchHUDColor(d4f767463ce0a6b3).(int i) { HUD_color_modelcxx . . $ HUD_color_model. = i; }