Debian Codegraph @

netgames/anarchy/anarchy.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/anarchy/anarchy.cpp $
21 * $Revision: 1.1.1.1 $
22 * $Date: 2003/08/26 03:56:37 $
23 * $Author: kevinb $
24 *
25 * <insert description of file here>
26 *
27 * $Log: anarchy.cpp,v $
28 * Revision 1.1.1.1 2003/08/26 03:56:37 kevinb
29 * initial 1.5 import
30 *
31 *
32 * 84 11/08/99 11:42p Jeff
33 * SourceSafe Test...ignore
34 *
35 * 83 10/21/99 9:27p Jeff
36 * B.A. Macintosh code merge
37 *
38 * 82 7/12/99 1:22p Jeff
39 * updated for new netflags
40 *
41 * 81 7/11/99 6:43p Jeff
42 * cleaner plr if the list is too long
43 *
44 * 80 5/23/99 3:04a Jason
45 * fixed bug with player rankings not being updated correctly
46 *
47 * 79 5/12/99 11:28a Jeff
48 * added sourcesafe comment block
49 *
50 * $NoKeywords: $
51 */
52
53 #include <string.h>
54 #include <stdio.h>
55 #include <stdlib.h>
56 #include "idmfc.h"cxx . . $ `<file>/netgames/includes/idmfc.h`/
57 #include "Anarchy.h"cxx . . $ `<file>/netgames/anarchy/Anarchy.h`/
58 #include "anarchystr.h"cxx . . $ `<file>/netgames/anarchy/anarchystr.h`/
59
60 #include <algorithm>
61
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
65 static int SortedPlayerscxx . . $ SortedPlayers.[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!]; // sorted player nums
66 static bool DisplayScoreScreencxx . . $ DisplayScoreScreen.;
67 static int Highlight_bmpcxx . . $ Highlight_bmp. = -1;
68
69 #define AHD_NONEcxx . . $ `netgames/anarchy/anarchy.cpp:69:9`! 0
70 #define AHD_SCOREcxx . . $ `netgames/anarchy/anarchy.cpp:70:9`! 1
71 #define AHD_EFFICIENCYcxx . . $ `netgames/anarchy/anarchy.cpp:71:9`! 2
72 #define ACM_PLAYERCOLORcxx . . $ `netgames/anarchy/anarchy.cpp:72:9`! 0
73 #define ACM_NORMALcxx . . $ `netgames/anarchy/anarchy.cpp:73:9`! 1
74 static uint8_tcxx . . $ uint8_t# Anarchy_hud_displaycxx . . $ Anarchy_hud_display. = AHD_SCOREcxx . . $ `netgames/anarchy/anarchy.cpp:70:9`!;
75 static uint8_tcxx . . $ uint8_t# HUD_color_modelcxx . . $ HUD_color_model. = ACM_PLAYERCOLORcxx . . $ `netgames/anarchy/anarchy.cpp:72:9`!;
76 static bool display_my_welcomecxx . . $ display_my_welcome. = false;
77
78 static void DisplayHUDScorescxx . . $ DisplayHUDScores(c7a20e4e05358911).(struct tHUDItemcxx . . $ tHUDItem# *hitem);
79 static void DisplayScorescxx . . $ DisplayScores(49f6e7a06ebc5aa8).(void);
80 static void DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(int player_num);
81 static void SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(char *filename);
82 static void SwitchHUDColorcxx . . $ SwitchHUDColor(d4f767463ce0a6b3).(int i);
83 static void SwitchAnarchyScorescxx . . $ SwitchAnarchyScores(d4f767463ce0a6b3).(int i);
84 static const char *GetStringcxx . . $ GetString(f7ae7e56280f18ae).(int d);
85 static void DetermineScorecxx . . $ DetermineScore(74c02bb7c84e7fae).(int precord_num, int column_num, char *buffer, int buffer_size);
86
87 ///////////////////////////////////////////////
88 // localization info
89 static char **StringTablecxx . . $ StringTable.;
90 static int StringTableSizecxx . . $ StringTableSize. = 0;
91 static const char *_ErrorStringcxx . . $ _ErrorString. = "Missing String";
92 const char *GetStringcxx . . $ GetString(f7ae7e56280f18ae).(int d) {
93 if ((d < 0) || (d >= StringTableSizecxx . . $ StringTableSize.))
94 return _ErrorStringcxx . . $ _ErrorString.;
95 else
96 return StringTablecxx . . $ StringTable.[d];
97 }
98 ///////////////////////////////////////////////
99
100 void SwitchAnarchyScorescxx . . $ SwitchAnarchyScores(d4f767463ce0a6b3).(int i) {
101 if (i < 0)
102 i = 0;
103 if (i > 2)
104 i = 2;
105
106 Anarchy_hud_displaycxx . . $ Anarchy_hud_display. = i;
107
108 switch (i) {
109 case AHD_NONEcxx . . $ `netgames/anarchy/anarchy.cpp:69:9`!:
110 DLLAddHUDMessage(TXT_HUDD_NONEcxx . . $ `netgames/anarchy/anarchystr.h:49:9`!);
111 break;
112 case AHD_SCOREcxx . . $ `netgames/anarchy/anarchy.cpp:70:9`!:
113 DLLAddHUDMessage(TXT_HUDD_SCOREScxx . . $ `netgames/anarchy/anarchystr.h:50:9`!);
114 break;
115 case AHD_EFFICIENCYcxx . . $ `netgames/anarchy/anarchy.cpp:71:9`!:
116 DLLAddHUDMessage(TXT_HUDD_EFFICcxx . . $ `netgames/anarchy/anarchystr.h:51:9`!);
117 break;
118 };
119 }
120
121 // This function gets called by the game when it wants to learn some info about the game
122 void DLLFUNCCALLcxx . . $ `lib/module.h:93:10`! DLLGetGameInfocxx . . $ DLLGetGameInfo(e5c6dce1fbda187a).(tDLLOptionscxx . . $ tDLLOptions# *options) {
123 options->flagscxx . . $ tDLLOptions#flags. = DOF_MAXTEAMScxx . . $ `netgames/includes/gamedll_header.h:105:9`!;
124 options->max_teamscxx . . $ tDLLOptions#max_teams. = 1;
125 strcpy(options->game_namecxx . . $ tDLLOptions#game_name., "Anarchy");
126 strcpy(options->requirementscxx . . $ tDLLOptions#requirements., "");
127 }
128
129 // Initializes the game function pointers
130 void DLLFUNCCALLcxx . . $ `lib/module.h:93:10`! DLLGameInitcxx . . $ DLLGameInit(937c1f75cb8fa6b1).(int *api_func, uint8_tcxx . . $ uint8_t# *all_ok, int num_teams_to_use) {
131 *all_ok = 1;
132 DMFCBasecxx . . $ DMFCBase. = CreateDMFC();
133 if (!DMFCBasecxx . . $ DMFCBase.) {
134 *all_ok = 0;
135 return;
136 }
137
138 dstatcxx . . $ dstat. = CreateDmfcStats();
139 if (!dstatcxx . . $ dstat.) {
140 *all_ok = 0;
141 return;
142 }
143
144 DMFCBasecxx . . $ DMFCBase.->LoadFunctionscxx . . $ IDMFC#LoadFunctions(11b0e290e57a7e53).(api_func);
145
146 // Setup the event handlers that we handle
147 DMFCBasecxx . . $ DMFCBase.->Set_OnKeypresscxx . . $ IDMFC#Set_OnKeypress(94eb4457dc8d4d10).(OnKeypresscxx . . $ OnKeypress(d4f767463ce0a6b3).);
148 DMFCBasecxx . . $ DMFCBase.->Set_OnHUDIntervalcxx . . $ IDMFC#Set_OnHUDInterval(964b12a25712bdc3).(OnHUDIntervalcxx . . $ OnHUDInterval(49f6e7a06ebc5aa8).);
149 DMFCBasecxx . . $ DMFCBase.->Set_OnIntervalcxx . . $ IDMFC#Set_OnInterval(964b12a25712bdc3).(OnIntervalcxx . . $ OnInterval(49f6e7a06ebc5aa8).);
150 DMFCBasecxx . . $ DMFCBase.->Set_OnClientPlayerKilledcxx . . $ IDMFC#Set_OnClientPlayerKilled(7da43329b4117518).(OnClientPlayerKilledcxx . . $ OnClientPlayerKilled(766a1b7183ffa4b4).);
151 DMFCBasecxx . . $ DMFCBase.->Set_OnClientPlayerEntersGamecxx . . $ IDMFC#Set_OnClientPlayerEntersGame(94eb4457dc8d4d10).(OnClientPlayerEntersGamecxx . . $ OnClientPlayerEntersGame(d4f767463ce0a6b3).);
152 DMFCBasecxx . . $ DMFCBase.->Set_OnClientLevelStartcxx . . $ IDMFC#Set_OnClientLevelStart(964b12a25712bdc3).(OnClientLevelStartcxx . . $ OnClientLevelStart(49f6e7a06ebc5aa8).);
153 DMFCBasecxx . . $ DMFCBase.->Set_OnClientLevelEndcxx . . $ IDMFC#Set_OnClientLevelEnd(964b12a25712bdc3).(OnClientLevelEndcxx . . $ OnClientLevelEnd(49f6e7a06ebc5aa8).);
154 DMFCBasecxx . . $ DMFCBase.->Set_OnServerGameCreatedcxx . . $ IDMFC#Set_OnServerGameCreated(964b12a25712bdc3).(OnServerGameCreatedcxx . . $ OnServerGameCreated(49f6e7a06ebc5aa8).);
155 DMFCBasecxx . . $ DMFCBase.->Set_OnPLRIntervalcxx . . $ IDMFC#Set_OnPLRInterval(964b12a25712bdc3).(OnPLRIntervalcxx . . $ OnPLRInterval(49f6e7a06ebc5aa8).);
156 DMFCBasecxx . . $ DMFCBase.->Set_OnPLRInitcxx . . $ IDMFC#Set_OnPLRInit(964b12a25712bdc3).(OnPLRInitcxx . . $ OnPLRInit(49f6e7a06ebc5aa8).);
157 DMFCBasecxx . . $ DMFCBase.->Set_OnSaveStatsToFilecxx . . $ IDMFC#Set_OnSaveStatsToFile(964b12a25712bdc3).(OnSaveStatsToFilecxx . . $ OnSaveStatsToFile(49f6e7a06ebc5aa8).);
158 DMFCBasecxx . . $ DMFCBase.->Set_OnLevelEndSaveStatsToFilecxx . . $ IDMFC#Set_OnLevelEndSaveStatsToFile(964b12a25712bdc3).(OnLevelEndSaveStatsToFilecxx . . $ OnLevelEndSaveStatsToFile(49f6e7a06ebc5aa8).);
159 DMFCBasecxx . . $ DMFCBase.->Set_OnDisconnectSaveStatsToFilecxx . . $ IDMFC#Set_OnDisconnectSaveStatsToFile(964b12a25712bdc3).(OnDisconnectSaveStatsToFilecxx . . $ OnDisconnectSaveStatsToFile(49f6e7a06ebc5aa8).);
160 DMFCBasecxx . . $ DMFCBase.->Set_OnPrintScorescxx . . $ IDMFC#Set_OnPrintScores(94eb4457dc8d4d10).(OnPrintScorescxx . . $ OnPrintScores(d4f767463ce0a6b3).);
161
162 DLLCreateStringTable("Anarchy.str", &StringTablecxx . . $ StringTable., &StringTableSizecxx . . $ StringTableSize.);
163 mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "%d strings loaded from string table\n", StringTableSize);
164 if (!StringTableSizecxx . . $ StringTableSize.) {
165 *all_ok = 0;
166 return;
167 }
168
169 AnarchyGameInitcxx . . $ AnarchyGameInit(d4f767463ce0a6b3).(1);
170
171 // add the death and suicide messages
172 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH1cxx . . $ `netgames/anarchy/anarchystr.h:24:9`!, true);
173 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH2cxx . . $ `netgames/anarchy/anarchystr.h:25:9`!, true);
174 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH3cxx . . $ `netgames/anarchy/anarchystr.h:26:9`!, false);
175 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH4cxx . . $ `netgames/anarchy/anarchystr.h:27:9`!, false);
176 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH5cxx . . $ `netgames/anarchy/anarchystr.h:28:9`!, true);
177 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH6cxx . . $ `netgames/anarchy/anarchystr.h:29:9`!, true);
178 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH7cxx . . $ `netgames/anarchy/anarchystr.h:30:9`!, false);
179 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH8cxx . . $ `netgames/anarchy/anarchystr.h:31:9`!, true);
180 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH9cxx . . $ `netgames/anarchy/anarchystr.h:32:9`!, true);
181 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH10cxx . . $ `netgames/anarchy/anarchystr.h:33:9`!, true);
182
183 DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE1cxx . . $ `netgames/anarchy/anarchystr.h:34:9`!);
184 DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE2cxx . . $ `netgames/anarchy/anarchystr.h:35:9`!);
185 DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE3cxx . . $ `netgames/anarchy/anarchystr.h:36:9`!);
186 DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE4cxx . . $ `netgames/anarchy/anarchystr.h:37:9`!);
187 DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE5cxx . . $ `netgames/anarchy/anarchystr.h:38:9`!);
188 DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE6cxx . . $ `netgames/anarchy/anarchystr.h:39:9`!);
189
190 DMFCBasecxx . . $ DMFCBase.->SetNumberOfTeamscxx . . $ IDMFC#SetNumberOfTeams(d4f767463ce0a6b3).(1);
191
192 netgame_infocxx . . $ netgame_info# *Netgame = DMFCBasecxx . . $ DMFCBase.->GetNetgameInfocxx . . $ IDMFC#GetNetgameInfo(242e78cd5130aa12).();
193 Netgame->flagscxx . . $ netgame_info#flags. |= (NF_DAMAGE_FRIENDLYcxx . . $ `Descent3/multi_external.h:235:9`! | NF_TRACK_RANKcxx . . $ `Descent3/multi_external.h:243:9`!);
194
195 Highlight_bmpcxx . . $ Highlight_bmp. = DLLbm_AllocBitmap(32, 32, 0);
196 if (Highlight_bmpcxx . . $ Highlight_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) {
197 uint16_tcxx . . $ uint16_t# *data = DLLbm_data(Highlight_bmpcxx . . $ Highlight_bmp., 0);
198 if (!data) {
199 // bail on out of here
200 *all_ok = 0;
201 return;
202 }
203 for (int x = 0; x < 32 * 32; x++) {
204 data[x] = GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(50, 50, 50) | OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`!;
205 }
206 }
207
208 DMFCBasecxx . . $ DMFCBase.->AddHUDItemCallbackcxx . . $ IDMFC#AddHUDItemCallback(97c9b33f56b4265c).(HI_TEXTcxx . . $ `netgames/includes/DMFC.h:440:9`!, DisplayHUDScorescxx . . $ DisplayHUDScores(c7a20e4e05358911).);
209
210 DisplayScoreScreencxx . . $ DisplayScoreScreen. = false;
211 }
212 // Called when the DLL is shutdown
213 void DLLFUNCCALLcxx . . $ `lib/module.h:93:10`! DLLGameClosecxx . . $ DLLGameClose(49f6e7a06ebc5aa8).() {
214 if (Highlight_bmpcxx . . $ Highlight_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!)
215 DLLbm_FreeBitmap(Highlight_bmpcxx . . $ Highlight_bmp.);
216
217 DLLDestroyStringTable(StringTablecxx . . $ StringTable., StringTableSizecxx . . $ StringTableSize.);
218
219 if (dstatcxx . . $ dstat.) {
220 dstatcxx . . $ dstat.->DestroyPointercxx . . $ IObject#DestroyPointer(49f6e7a06ebc5aa8).();
221 dstatcxx . . $ dstat. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
222 }
223
224 if (DMFCBasecxx . . $ DMFCBase.) {
225 AnarchyGameClosecxx . . $ AnarchyGameClose(49f6e7a06ebc5aa8).();
226 DMFCBasecxx . . $ DMFCBase.->GameClosecxx . . $ IDMFC#GameClose(49f6e7a06ebc5aa8).();
227 DMFCBasecxx . . $ DMFCBase.->DestroyPointercxx . . $ IObject#DestroyPointer(49f6e7a06ebc5aa8).();
228 DMFCBasecxx . . $ DMFCBase. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
229 }
230 }
231
232 void DetermineScorecxx . . $ DetermineScore(74c02bb7c84e7fae).(int precord_num, int column_num, char *buffer, int buffer_size) {
233 player_recordcxx . . $ player_record# *pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(precord_num);
234 if (!pr || pr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.) {
235 buffer[0] = '\0';
236 return;
237 }
238
239 snprintf(buffer, buffer_size, "%d", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] - pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
240 }
241
242 void AnarchyGameClosecxx . . $ AnarchyGameClose(49f6e7a06ebc5aa8).(void) {}
243
244 // DMFCApp::GameInit
245 //
246 // Sets up all the DLL functions and pointers and preps the class for use. This ABSOLUTLY must be
247 // called, so if you override DMFCApp::GameInit, make sure that you put a call to this somewhere in
248 // the override.
249 void AnarchyGameInitcxx . . $ AnarchyGameInit(d4f767463ce0a6b3).(int teams) {
250 // add the anarchy menu/submenus
251 IMenuItemcxx . . $ IMenuItem# *lev1, *lev2;
252
253 lev1 = CreateMenuItemWArgs("Anarchy", MIT_NORMALcxx . . $ `netgames/includes/DMFC.h:513:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
254
255 lev2 = CreateMenuItemWArgs(TXT_MNU_HUDSTYLEcxx . . $ `netgames/anarchy/anarchystr.h:52:9`!, MIT_STATEcxx . . $ `netgames/includes/DMFC.h:515:9`!, 0, SwitchAnarchyScorescxx . . $ SwitchAnarchyScores(d4f767463ce0a6b3).);
256 lev2->SetStateItemListcxx . . $ IMenuItem#SetStateItemList(d49b86907ad5c83b).(3, TXT_NONEcxx . . $ `netgames/anarchy/anarchystr.h:53:9`!, TXT_SCOREHDcxx . . $ `netgames/anarchy/anarchystr.h:54:9`!, TXT_EFFICIENCYcxx . . $ `netgames/anarchy/anarchystr.h:55:9`!);
257 lev2->SetStatecxx . . $ IMenuItem#SetState(d4f767463ce0a6b3).(1);
258 lev1->AddSubMenucxx . . $ IMenuItem#AddSubMenu(7cad07ba2f70ae18).(lev2);
259
260 lev2 = CreateMenuItemWArgs(TXT_MNU_HUDCOLORcxx . . $ `netgames/anarchy/anarchystr.h:56:9`!, MIT_STATEcxx . . $ `netgames/includes/DMFC.h:515:9`!, 0, SwitchHUDColorcxx . . $ SwitchHUDColor(d4f767463ce0a6b3).);
261 lev2->SetStateItemListcxx . . $ IMenuItem#SetStateItemList(d49b86907ad5c83b).(2, TXT_PLAYERCOLORScxx . . $ `netgames/anarchy/anarchystr.h:57:9`!, TXT_NORMALcxx . . $ `netgames/anarchy/anarchystr.h:58:9`!);
262 lev2->SetStatecxx . . $ IMenuItem#SetState(d4f767463ce0a6b3).(HUD_color_modelcxx . . $ HUD_color_model.);
263 lev1->AddSubMenucxx . . $ IMenuItem#AddSubMenu(7cad07ba2f70ae18).(lev2);
264
265 lev2 = DMFCBasecxx . . $ DMFCBase.->GetOnScreenMenucxx . . $ IDMFC#GetOnScreenMenu(8efbf9c7cdf9c614).();
266 lev2->AddSubMenucxx . . $ IMenuItem#AddSubMenu(7cad07ba2f70ae18).(lev1);
267
268 DMFCBasecxx . . $ DMFCBase.->GameInitcxx . . $ IDMFC#GameInit(d4f767463ce0a6b3).(teams);
269
270 // Initialize the Stats Manager
271 // ----------------------------
272
273 tDmfcStatsInitcxx . . $ tDmfcStatsInit# tsi;
274 tDmfcStatsColumnInfocxx . . $ tDmfcStatsColumnInfo# pl_col[6];
275 char gname[20];
276 strcpy(gname, "Anarchy");
277
278 tsi.flagscxx . . $ tDmfcStatsInit#flags. = DSIF_SHOW_PICcxx . . $ `netgames/includes/DMFC.h:619:9`! | DSIF_SHOW_OBSERVERICONcxx . . $ `netgames/includes/DMFC.h:627:9`!;
279 tsi.cColumnCountDetailedcxx . . $ tDmfcStatsInit#cColumnCountDetailed. = 0;
280 tsi.cColumnCountPlayerListcxx . . $ tDmfcStatsInit#cColumnCountPlayerList. = 6;
281 tsi.clbDetailedColumncxx . . $ tDmfcStatsInit#clbDetailedColumn. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
282 tsi.clbDetailedColumnBMPcxx . . $ tDmfcStatsInit#clbDetailedColumnBMP. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
283 tsi.clbPlayerColumncxx . . $ tDmfcStatsInit#clbPlayerColumn. = DetermineScorecxx . . $ DetermineScore(74c02bb7c84e7fae).;
284 tsi.clbPlayerColumnBMPcxx . . $ tDmfcStatsInit#clbPlayerColumnBMP. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
285 tsi.DetailedColumnscxx . . $ tDmfcStatsInit#DetailedColumns. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
286 tsi.GameNamecxx . . $ tDmfcStatsInit#GameName. = gname;
287 tsi.MaxNumberDisplayedcxx . . $ tDmfcStatsInit#MaxNumberDisplayed. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
288 tsi.PlayerListColumnscxx . . $ tDmfcStatsInit#PlayerListColumns. = pl_col;
289 tsi.SortedPlayerRecordscxx . . $ tDmfcStatsInit#SortedPlayerRecords. = SortedPlayerscxx . . $ SortedPlayers.;
290
291 pl_col[0].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_SHIPCOLORcxx . . $ DSCOLOR_SHIPCOLOR.;
292 strcpy(pl_col[0].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_PILOTcxx . . $ `netgames/anarchy/anarchystr.h:40:9`!);
293 pl_col[0].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_PILOT_NAMEcxx . . $ DSCOL_PILOT_NAME.;
294 pl_col[0].widthcxx . . $ tDmfcStatsColumnInfo#width. = 120;
295
296 pl_col[1].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_SHIPCOLORcxx . . $ DSCOLOR_SHIPCOLOR.;
297 strcpy(pl_col[1].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_SCOREcxx . . $ `netgames/anarchy/anarchystr.h:44:9`!);
298 pl_col[1].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_CUSTOMcxx . . $ DSCOL_CUSTOM.;
299 pl_col[1].widthcxx . . $ tDmfcStatsColumnInfo#width. = 50;
300
301 pl_col[2].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_SHIPCOLORcxx . . $ DSCOLOR_SHIPCOLOR.;
302 strcpy(pl_col[2].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_KILLS_SHORTcxx . . $ `netgames/anarchy/anarchystr.h:69:9`!);
303 pl_col[2].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_KILLS_LEVELcxx . . $ DSCOL_KILLS_LEVEL.;
304 pl_col[2].widthcxx . . $ tDmfcStatsColumnInfo#width. = 50;
305
306 pl_col[3].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_SHIPCOLORcxx . . $ DSCOLOR_SHIPCOLOR.;
307 strcpy(pl_col[3].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_DEATHS_SHORTcxx . . $ `netgames/anarchy/anarchystr.h:70:9`!);
308 pl_col[3].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_DEATHS_LEVELcxx . . $ DSCOL_DEATHS_LEVEL.;
309 pl_col[3].widthcxx . . $ tDmfcStatsColumnInfo#width. = 60;
310
311 pl_col[4].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_SHIPCOLORcxx . . $ DSCOLOR_SHIPCOLOR.;
312 strcpy(pl_col[4].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_SUICIDES_SHORTcxx . . $ `netgames/anarchy/anarchystr.h:71:9`!);
313 pl_col[4].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_SUICIDES_LEVELcxx . . $ DSCOL_SUICIDES_LEVEL.;
314 pl_col[4].widthcxx . . $ tDmfcStatsColumnInfo#width. = 65;
315
316 pl_col[5].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_SHIPCOLORcxx . . $ DSCOLOR_SHIPCOLOR.;
317 strcpy(pl_col[5].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_PINGcxx . . $ `netgames/anarchy/anarchystr.h:59:9`!);
318 pl_col[5].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_PINGcxx . . $ DSCOL_PING.;
319 pl_col[5].widthcxx . . $ tDmfcStatsColumnInfo#width. = 40;
320
321 dstatcxx . . $ dstat.->Initializecxx . . $ IDmfcStats#Initialize(645910a8ad01b658).(&tsi);
322 }
323
324 void OnHUDIntervalcxx . . $ OnHUDInterval(49f6e7a06ebc5aa8).(void) {
325 dstatcxx . . $ dstat.->DoFramecxx . . $ IDmfcStats#DoFrame(49f6e7a06ebc5aa8).();
326 DMFCBasecxx . . $ DMFCBase.->DisplayOutrageLogocxx . . $ IDMFC#DisplayOutrageLogo(49f6e7a06ebc5aa8).();
327 DMFCBasecxx . . $ DMFCBase.->OnHUDIntervalcxx . . $ IDMFC#OnHUDInterval(49f6e7a06ebc5aa8).();
328 }
329
330 void OnIntervalcxx . . $ OnInterval(49f6e7a06ebc5aa8).(void) {
331 DMFCBasecxx . . $ DMFCBase.->GetSortedPlayerSlotscxx . . $ IDMFC#GetSortedPlayerSlots(621ccea12ecf5b06).(SortedPlayerscxx . . $ SortedPlayers., MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!);
332 DMFCBasecxx . . $ DMFCBase.->OnIntervalcxx . . $ IDMFC#OnInterval(49f6e7a06ebc5aa8).();
333 }
334
335 void OnKeypresscxx . . $ OnKeypress(d4f767463ce0a6b3).(int key) {
336 dllinfocxx . . $ dllinfo# *Data = DMFCBasecxx . . $ DMFCBase.->GetDLLInfoCallDatacxx . . $ IDMFC#GetDLLInfoCallData(4458c5bdce97a5c3).();
337
338 switch (key) {
339 case K_F7cxx . . $ `netgames/includes/DMFCKeyCodes.h:118:9`!:
340 DisplayScoreScreencxx . . $ DisplayScoreScreen. = !DisplayScoreScreencxx . . $ DisplayScoreScreen.;
341 DMFCBasecxx . . $ DMFCBase.->EnableOnScreenMenucxx . . $ IDMFC#EnableOnScreenMenu(b45ddcbc8423892c).(false);
342 dstatcxx . . $ dstat.->Enablecxx . . $ IDmfcStats#Enable(b45ddcbc8423892c).(DisplayScoreScreencxx . . $ DisplayScoreScreen.);
343 break;
344 case K_PAGEDOWNcxx . . $ `netgames/includes/DMFCKeyCodes.h:147:9`!:
345 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.) {
346 dstatcxx . . $ dstat.->ScrollDowncxx . . $ IDmfcStats#ScrollDown(49f6e7a06ebc5aa8).();
347 Data->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1;
348 }
349 break;
350 case K_PAGEUPcxx . . $ `netgames/includes/DMFCKeyCodes.h:144:9`!:
351 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.) {
352 dstatcxx . . $ dstat.->ScrollUpcxx . . $ IDmfcStats#ScrollUp(49f6e7a06ebc5aa8).();
353 Data->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1;
354 }
355 break;
356 case K_F6cxx . . $ `netgames/includes/DMFCKeyCodes.h:117:9`!:
357 DisplayScoreScreencxx . . $ DisplayScoreScreen. = false;
358 dstatcxx . . $ dstat.->Enablecxx . . $ IDmfcStats#Enable(b45ddcbc8423892c).(false);
359 break;
360 case K_ESCcxx . . $ `netgames/includes/DMFCKeyCodes.h:97:9`!:
361 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.) {
362 dstatcxx . . $ dstat.->Enablecxx . . $ IDmfcStats#Enable(b45ddcbc8423892c).(false);
363 DisplayScoreScreencxx . . $ DisplayScoreScreen. = false;
364 Data->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1;
365 }
366 break;
367 }
368
369 DMFCBasecxx . . $ DMFCBase.->OnKeypresscxx . . $ IDMFC#OnKeypress(d4f767463ce0a6b3).(key);
370 }
371
372 // The server has just started, so clear out all the stats and game info
373 void OnServerGameCreatedcxx . . $ OnServerGameCreated(49f6e7a06ebc5aa8).(void) { DMFCBasecxx . . $ DMFCBase.->OnServerGameCreatedcxx . . $ IDMFC#OnServerGameCreated(49f6e7a06ebc5aa8).(); }
374
375 // The server has started a new level, so clear out any scores needed to be reset
376 void OnClientLevelStartcxx . . $ OnClientLevelStart(49f6e7a06ebc5aa8).(void) {
377 for (int i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) {
378 SortedPlayerscxx . . $ SortedPlayers.[i] = -1;
379 }
380
381 DMFCBasecxx . . $ DMFCBase.->OnClientLevelStartcxx . . $ IDMFC#OnClientLevelStart(49f6e7a06ebc5aa8).();
382 }
383
384 void OnClientLevelEndcxx . . $ OnClientLevelEnd(49f6e7a06ebc5aa8).(void) { DMFCBasecxx . . $ DMFCBase.->OnClientLevelEndcxx . . $ IDMFC#OnClientLevelEnd(49f6e7a06ebc5aa8).(); }
385
386 // A new player has entered the game, zero their stats out
387 void OnClientPlayerEntersGamecxx . . $ OnClientPlayerEntersGame(d4f767463ce0a6b3).(int player_num) {
388 DMFCBasecxx . . $ DMFCBase.->OnClientPlayerEntersGamecxx . . $ IDMFC#OnClientPlayerEntersGame(d4f767463ce0a6b3).(player_num);
389
390 if (player_num != DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).())
391 DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(player_num);
392 else
393 display_my_welcomecxx . . $ display_my_welcome. = true;
394 }
395
396 // We need to adjust the scores
397 void OnClientPlayerKilledcxx . . $ OnClientPlayerKilled(766a1b7183ffa4b4).(objectcxx . . $ object# *killer_obj, int victim_pnum) {
398 DMFCBasecxx . . $ DMFCBase.->OnClientPlayerKilledcxx . . $ IDMFC#OnClientPlayerKilled(766a1b7183ffa4b4).(killer_obj, victim_pnum);
399 player_recordcxx . . $ player_record# *kpr;
400
401 int kpnum;
402
403 if (killer_obj) {
404 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`!))
405 kpnum = killer_obj->idcxx . . $ object#id.;
406 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`!) {
407 // countermeasure kill
408 kpnum = DMFCBasecxx . . $ DMFCBase.->GetCounterMeasureOwnercxx . . $ IDMFC#GetCounterMeasureOwner(2da2a862cad4c994).(killer_obj);
409 } else {
410 kpnum = -1;
411 }
412 } else {
413 kpnum = -1;
414 }
415
416 kpr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordByPnumcxx . . $ IDMFC#GetPlayerRecordByPnum(6359c6f28dd028ae).(kpnum);
417 if (kpr) {
418 int goal;
419 if (DMFCBasecxx . . $ DMFCBase.->GetScoreLimitcxx . . $ IDMFC#GetScoreLimit(18a3c31ed0aa5760).(&goal)) {
420 int score = kpr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] - kpr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!];
421 if (score >= goal) {
422 DMFCBasecxx . . $ DMFCBase.->EndLevelcxx . . $ IDMFC#EndLevel(49f6e7a06ebc5aa8).();
423 }
424 }
425 }
426 }
427
428 bool compare_slotscxx . . $ compare_slots(cf9ef193275fa6d8).(int a, int b) {
429 int ascore, bscore;
430 player_recordcxx . . $ player_record# *apr, *bpr;
431 apr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(a);
432 bpr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(b);
433 if (!apr)
434 return true;
435 if (!bpr)
436 return false;
437 if (apr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.)
438 return true;
439 if (bpr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.)
440 return false;
441 if ((apr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) && (bpr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.)) {
442 // both players were in the game
443 ascore = apr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] - apr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!];
444 bscore = bpr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] - bpr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!];
445 return (ascore < bscore);
446 }
447 if ((apr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) && (bpr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.)) {
448 // apr gets priority since he was in the game on exit
449 return false;
450 }
451 if ((apr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.) && (bpr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.)) {
452 // bpr gets priority since he was in the game on exit
453 return true;
454 }
455 // if we got here then both players were disconnected
456 ascore = apr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] - apr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!];
457 bscore = bpr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] - bpr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!];
458 return (ascore < bscore);
459 }
460
461 void OnPLRInitcxx . . $ OnPLRInit(49f6e7a06ebc5aa8).(void) {
462 int tempsort[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!];
463 int i, t, j;
464
465 for (i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) {
466 tempsort[i] = i;
467 }
468
469 for (i = 1; i <= MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`! - 1; i++) {
470 t = tempsort[i];
471 // Shift elements down until
472 // insertion point found.
473 for (j = i - 1; j >= 0 && compare_slotscxx . . $ compare_slots(cf9ef193275fa6d8).(tempsort[j], t); j--) {
474 tempsort[j + 1] = tempsort[j];
475 }
476 // insert
477 tempsort[j + 1] = t;
478 }
479
480 // copy the array over
481 memcpy(SortedPlayerscxx . . $ SortedPlayers., tempsort, DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`! * sizeof(int));
482
483 DMFCBasecxx . . $ DMFCBase.->OnPLRInitcxx . . $ IDMFC#OnPLRInit(49f6e7a06ebc5aa8).();
484 }
485
486 void OnPLRIntervalcxx . . $ OnPLRInterval(49f6e7a06ebc5aa8).(void) {
487 #define PLAYERS_COLcxx . . $ `netgames/anarchy/anarchy.cpp:487:9`! 130
488 #define SCORE_COLcxx . . $ `netgames/anarchy/anarchy.cpp:488:9`! 280
489 #define DEATHS_COLcxx . . $ `netgames/anarchy/anarchy.cpp:489:9`! 330
490 #define SUICIDES_COLcxx . . $ `netgames/anarchy/anarchy.cpp:490:9`! 390
491 #define TOTAL_COLcxx . . $ `netgames/anarchy/anarchy.cpp:491:9`! 460
492
493 DMFCBasecxx . . $ DMFCBase.->OnPLRIntervalcxx . . $ IDMFC#OnPLRInterval(49f6e7a06ebc5aa8).();
494
495 int y = 40;
496
497 int height = DLLgrfont_GetHeight((DMFCBasecxx . . $ DMFCBase.->GetGameFontTranslateArraycxx . . $ IDMFC#GetGameFontTranslateArray(a7741f82f5fc3640).())[SMALL_UI_FONT_INDEXcxx . . $ `Descent3/gamefont.h:99:9`!]) + 1;
498 DLLgrtext_SetFont((DMFCBasecxx . . $ DMFCBase.->GetGameFontTranslateArraycxx . . $ IDMFC#GetGameFontTranslateArray(a7741f82f5fc3640).())[SMALL_UI_FONT_INDEXcxx . . $ `Descent3/gamefont.h:99:9`!]);
499
500 // print out header
501 DLLgrtext_SetColor(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 150));
502 DLLgrtext_Printf(PLAYERS_COLcxx . . $ `netgames/anarchy/anarchy.cpp:487:9`!, y, TXT_PILOTcxx . . $ `netgames/anarchy/anarchystr.h:40:9`!);
503 DLLgrtext_Printf(SCORE_COLcxx . . $ `netgames/anarchy/anarchy.cpp:488:9`!, y, TXT_KILLS_SHORTcxx . . $ `netgames/anarchy/anarchystr.h:69:9`!);
504 DLLgrtext_Printf(DEATHS_COLcxx . . $ `netgames/anarchy/anarchy.cpp:489:9`!, y, TXT_DEATHS_SHORTcxx . . $ `netgames/anarchy/anarchystr.h:70:9`!);
505 DLLgrtext_Printf(SUICIDES_COLcxx . . $ `netgames/anarchy/anarchy.cpp:490:9`!, y, TXT_SUICIDES_SHORTcxx . . $ `netgames/anarchy/anarchystr.h:71:9`!);
506 DLLgrtext_Printf(TOTAL_COLcxx . . $ `netgames/anarchy/anarchy.cpp:491:9`!, y, TXT_SCOREcxx . . $ `netgames/anarchy/anarchystr.h:44:9`!);
507 y += height;
508
509 // print out player stats
510 int rank = 1;
511 int slot, pnum;
512 player_recordcxx . . $ player_record# *pr;
513
514 for (int i = 0; i < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; i++) {
515 slot = SortedPlayerscxx . . $ SortedPlayers.[i];
516 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(slot);
517 if ((pr) && (pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.)) {
518
519 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
520 continue; // skip a dedicated server
521
522 pnum = DMFCBasecxx . . $ DMFCBase.->WasPlayerInGameAtLevelEndcxx . . $ IDMFC#WasPlayerInGameAtLevelEnd(7864480464b09eea).(slot);
523 if (pnum != -1) {
524 DLLgrtext_SetColor((DMFCBasecxx . . $ DMFCBase.->GetPlayerColorscxx . . $ IDMFC#GetPlayerColors(ac695d451f96e4aa).())[pnum]);
525 } else {
526 DLLgrtext_SetColor(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(128, 128, 128));
527 }
528
529 char temp[100];
530 snprintf(temp, sizeof(temp), "%d)%s", rank, pr->callsigncxx . . $ player_record#callsign.);
531 DMFCBasecxx . . $ DMFCBase.->ClipStringcxx . . $ IDMFC#ClipString(8677479218165cd4).(SCORE_COLcxx . . $ `netgames/anarchy/anarchy.cpp:488:9`! - PLAYERS_COLcxx . . $ `netgames/anarchy/anarchy.cpp:487:9`! - 10, temp, true);
532 DLLgrtext_Printf(PLAYERS_COLcxx . . $ `netgames/anarchy/anarchy.cpp:487:9`!, y, "%s", temp);
533
534 DLLgrtext_Printf(SCORE_COLcxx . . $ `netgames/anarchy/anarchy.cpp:488:9`!, y, "%d", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
535 DLLgrtext_Printf(DEATHS_COLcxx . . $ `netgames/anarchy/anarchy.cpp:489:9`!, y, "%d", pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
536 DLLgrtext_Printf(SUICIDES_COLcxx . . $ `netgames/anarchy/anarchy.cpp:490:9`!, y, "%d", pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
537 DLLgrtext_Printf(TOTAL_COLcxx . . $ `netgames/anarchy/anarchy.cpp:491:9`!, y, "%d", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] - pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
538 y += height;
539 rank++;
540
541 if (y >= 440)
542 goto quick_exit;
543 }
544 }
545
546 quick_exit:;
547 }
548
549 void SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(char *filename) {
550 CFILEcxx . . $ CFILE# *file;
551 DLLOpenCFILE(&file, filenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "wt");
552 if (!file) {
553 mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "Unable to open output file\n");
554 return;
555 }
556
557 // write out game stats
558 #define BUFSIZEcxx . . $ `netgames/anarchy/anarchy.cpp:558:9`! 150
559 char buffer[BUFSIZEcxx . . $ `netgames/anarchy/anarchy.cpp:558:9`!];
560 char tempbuffer[25];
561 int sortedslots[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!];
562 player_recordcxx . . $ player_record# *pr, *dpr;
563 tPInfoStatcxx . . $ tPInfoStat# stat;
564 int count, p;
565
566 // sort the stats
567 DMFCBasecxx . . $ DMFCBase.->GetSortedPlayerSlotscxx . . $ IDMFC#GetSortedPlayerSlots(621ccea12ecf5b06).(sortedslots, MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!);
568 count = 1;
569
570 snprintf(buffer, sizeof(buffer), TXT_SAVE_HEADERcxx . . $ `netgames/anarchy/anarchystr.h:60:9`!, (DMFCBasecxx . . $ DMFCBase.->GetNetgameInfocxx . . $ IDMFC#GetNetgameInfo(242e78cd5130aa12).())->namecxx . . $ netgame_info#name.,
571 (DMFCBasecxx . . $ DMFCBase.->GetCurrentMissioncxx . . $ IDMFC#GetCurrentMission(d7a4f7ca6f9cb411).())->cur_levelcxx . . $ tMission#cur_level.);
572 DLLcf_WriteString(file, buffer);
573
574 snprintf(buffer, sizeof(buffer), "%s", TXT_SAVE_HEADERBcxx . . $ `netgames/anarchy/anarchystr.h:61:9`!);
575 DLLcf_WriteString(file, buffer);
576 strcpy(buffer, "-----------------------------------------------------------------------------------------------");
577 DLLcf_WriteString(file, buffer);
578
579 for (int s = 0; s < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; s++) {
580 p = sortedslots[s];
581 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(p);
582 if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) {
583
584 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
585 continue; // skip dedicated server
586
587 memset(buffer, ' ', BUFSIZEcxx . . $ `netgames/anarchy/anarchy.cpp:558:9`!);
588
589 snprintf(tempbuffer, sizeof(tempbuffer), "%d)", count);
590 memcpy(&buffer[0], tempbuffer, strlen(tempbuffer));
591
592 snprintf(tempbuffer, sizeof(tempbuffer), "%s%s", (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) ? "" : "*", pr->callsigncxx . . $ player_record#callsign.);
593 memcpy(&buffer[7], tempbuffer, strlen(tempbuffer));
594
595 snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]",
596 pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] - pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!],
597 pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!] - pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
598 memcpy(&buffer[36], tempbuffer, strlen(tempbuffer));
599
600 snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!],
601 pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
602 memcpy(&buffer[48], tempbuffer, strlen(tempbuffer));
603
604 snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!],
605 pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
606 memcpy(&buffer[60], tempbuffer, strlen(tempbuffer));
607
608 snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!],
609 pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
610 memcpy(&buffer[71], tempbuffer, strlen(tempbuffer));
611
612 snprintf(tempbuffer, sizeof(tempbuffer), "%s", DMFCBasecxx . . $ DMFCBase.->GetTimeStringcxx . . $ IDMFC#GetTimeString(3b344d7a46e3c2ff).(DMFCBasecxx . . $ DMFCBase.->GetTimeInGamecxx . . $ IDMFC#GetTimeInGame(5cde91ea12d43f46).(p)));
613 memcpy(&buffer[82], tempbuffer, strlen(tempbuffer));
614
615 size_t pos = 82 + strlen(tempbuffer) + 1;
616 if (pos < BUFSIZEcxx . . $ `netgames/anarchy/anarchy.cpp:558:9`!)
617 buffer[pos] = '\0';
618
619 buffer[BUFSIZEcxx . . $ `netgames/anarchy/anarchy.cpp:558:9`! - 1] = '\0';
620 DLLcf_WriteString(file, buffer);
621 count++;
622 }
623 }
624
625 DLLcf_WriteString(file, TXT_SAVE_HEADERCcxx . . $ `netgames/anarchy/anarchystr.h:63:9`!);
626
627 count = 1;
628 for (p = 0; p < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; p++) {
629 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(p);
630 if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) {
631
632 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
633 continue; // skip dedicated server
634
635 // Write out header
636 snprintf(buffer, sizeof(buffer), "%d) %s%s", count, (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) ? "" : "*", pr->callsigncxx . . $ player_record#callsign.);
637 DLLcf_WriteString(file, buffer);
638 size_t length = strlen(buffer);
639 memset(buffer, '=', length);
640 buffer[length] = '\0';
641 DLLcf_WriteString(file, buffer);
642
643 // time in game
644 snprintf(buffer, sizeof(buffer), TXT_SAVE_TIMEINGAMEcxx . . $ `netgames/anarchy/anarchystr.h:64:9`!, DMFCBasecxx . . $ DMFCBase.->GetTimeStringcxx . . $ IDMFC#GetTimeString(3b344d7a46e3c2ff).(DMFCBasecxx . . $ DMFCBase.->GetTimeInGamecxx . . $ IDMFC#GetTimeInGame(5cde91ea12d43f46).(p)));
645 DLLcf_WriteString(file, buffer);
646
647 if (DMFCBasecxx . . $ DMFCBase.->FindPInfoStatFirstcxx . . $ IDMFC#FindPInfoStatFirst(e8124cb919632806).(p, &stat)) {
648 snprintf(buffer, sizeof(buffer), "%s", TXT_SAVE_KILLERLISTcxx . . $ `netgames/anarchy/anarchystr.h:65:9`!);
649 DLLcf_WriteString(file, buffer);
650
651 if (stat.slotcxx . . $ tPInfoStat#slot. != p) {
652 memset(buffer, ' ', BUFSIZEcxx . . $ `netgames/anarchy/anarchy.cpp:558:9`!);
653 dpr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(stat.slotcxx . . $ tPInfoStat#slot.);
654
655 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(dpr != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
656 if (dpr) {
657 snprintf(tempbuffer, sizeof(tempbuffer), "%s", dpr->callsigncxx . . $ player_record#callsign.);
658 memcpy(buffer, tempbuffer, strlen(tempbuffer));
659
660 snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.killscxx . . $ tPInfoStat#kills.);
661 memcpy(&buffer[30], tempbuffer, strlen(tempbuffer));
662
663 snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.deathscxx . . $ tPInfoStat#deaths.);
664 memcpy(&buffer[40], tempbuffer, strlen(tempbuffer));
665
666 size_t pos = 40 + strlen(tempbuffer) + 1;
667 if (pos < BUFSIZEcxx . . $ `netgames/anarchy/anarchy.cpp:558:9`!)
668 buffer[pos] = '\0';
669
670 buffer[BUFSIZEcxx . . $ `netgames/anarchy/anarchy.cpp:558:9`! - 1] = '\0';
671 DLLcf_WriteString(file, buffer);
672 }
673 }
674
675 while (DMFCBasecxx . . $ DMFCBase.->FindPInfoStatNextcxx . . $ IDMFC#FindPInfoStatNext(4ead3766c292904).(&stat)) {
676 if (stat.slotcxx . . $ tPInfoStat#slot. != p) {
677 memset(buffer, ' ', BUFSIZEcxx . . $ `netgames/anarchy/anarchy.cpp:558:9`!);
678 dpr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(stat.slotcxx . . $ tPInfoStat#slot.);
679
680 if (dpr) {
681 snprintf(tempbuffer, sizeof(tempbuffer), "%s", dpr->callsigncxx . . $ player_record#callsign.);
682 memcpy(buffer, tempbuffer, strlen(tempbuffer));
683
684 snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.killscxx . . $ tPInfoStat#kills.);
685 memcpy(&buffer[30], tempbuffer, strlen(tempbuffer));
686
687 snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.deathscxx . . $ tPInfoStat#deaths.);
688 memcpy(&buffer[40], tempbuffer, strlen(tempbuffer));
689
690 size_t pos = 40 + strlen(tempbuffer) + 1;
691 if (pos < BUFSIZEcxx . . $ `netgames/anarchy/anarchy.cpp:558:9`!)
692 buffer[pos] = '\0';
693
694 buffer[BUFSIZEcxx . . $ `netgames/anarchy/anarchy.cpp:558:9`! - 1] = '\0';
695 DLLcf_WriteString(file, buffer);
696 }
697 }
698 }
699 }
700 DMFCBasecxx . . $ DMFCBase.->FindPInfoStatClosecxx . . $ IDMFC#FindPInfoStatClose(49f6e7a06ebc5aa8).();
701 DLLcf_WriteString(file, ""); // skip a line
702 count++;
703 }
704 }
705
706 // done writing stats
707 DLLcfclose(file);
708 DLLAddHUDMessage(TXT_MSG_SAVESTATScxx . . $ `netgames/anarchy/anarchystr.h:66:9`!);
709 }
710
711 #define ROOTFILENAMEcxx . . $ `netgames/anarchy/anarchy.cpp:711:9`! "Anarchy"
712 void OnSaveStatsToFilecxx . . $ OnSaveStatsToFile(49f6e7a06ebc5aa8).(void) {
713 char filename[256];
714 DMFCBasecxx . . $ DMFCBase.->GenerateStatFilenamecxx . . $ IDMFC#GenerateStatFilename(4d4dad76095ad7d8).(filename, ROOTFILENAMEcxx . . $ `netgames/anarchy/anarchy.cpp:711:9`!, false);
715 SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(filename);
716 }
717
718 void OnLevelEndSaveStatsToFilecxx . . $ OnLevelEndSaveStatsToFile(49f6e7a06ebc5aa8).(void) {
719 char filename[256];
720 DMFCBasecxx . . $ DMFCBase.->GenerateStatFilenamecxx . . $ IDMFC#GenerateStatFilename(4d4dad76095ad7d8).(filename, ROOTFILENAMEcxx . . $ `netgames/anarchy/anarchy.cpp:711:9`!, true);
721 SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(filename);
722 }
723
724 void OnDisconnectSaveStatsToFilecxx . . $ OnDisconnectSaveStatsToFile(49f6e7a06ebc5aa8).(void) {
725 char filename[256];
726 DMFCBasecxx . . $ DMFCBase.->GenerateStatFilenamecxx . . $ IDMFC#GenerateStatFilename(4d4dad76095ad7d8).(filename, ROOTFILENAMEcxx . . $ `netgames/anarchy/anarchy.cpp:711:9`!, false);
727 SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(filename);
728 }
729
730 void OnPrintScorescxx . . $ OnPrintScores(d4f767463ce0a6b3).(int level) {
731 char buffer[256];
732 char name[50];
733 memset(buffer, ' ', 256);
734
735 size_t t;
736 size_t pos[6];
737 size_t len[6];
738 pos[0] = 0;
739 t = len[0] = 20; // give ample room for pilot name
740 pos[1] = pos[0] + t + 1;
741 t = len[1] = strlen(TXT_POINTScxx . . $ `netgames/anarchy/anarchystr.h:48:9`!);
742 pos[2] = pos[1] + t + 1;
743 t = len[2] = strlen(TXT_KILLS_SHORTcxx . . $ `netgames/anarchy/anarchystr.h:69:9`!);
744 pos[3] = pos[2] + t + 1;
745 t = len[3] = strlen(TXT_DEATHS_SHORTcxx . . $ `netgames/anarchy/anarchystr.h:70:9`!);
746 pos[4] = pos[3] + t + 1;
747 t = len[4] = strlen(TXT_SUICIDES_SHORTcxx . . $ `netgames/anarchy/anarchystr.h:71:9`!);
748 pos[5] = pos[4] + t + 1;
749 t = len[5] = strlen(TXT_PINGcxx . . $ `netgames/anarchy/anarchystr.h:59:9`!);
750
751 memcpy(&buffer[pos[0]], TXT_PILOTcxx . . $ `netgames/anarchy/anarchystr.h:40:9`!, strlen(TXT_PILOTcxx . . $ `netgames/anarchy/anarchystr.h:40:9`!));
752 memcpy(&buffer[pos[1]], TXT_POINTScxx . . $ `netgames/anarchy/anarchystr.h:48:9`!, len[1]);
753 memcpy(&buffer[pos[2]], TXT_KILLS_SHORTcxx . . $ `netgames/anarchy/anarchystr.h:69:9`!, len[2]);
754 memcpy(&buffer[pos[3]], TXT_DEATHS_SHORTcxx . . $ `netgames/anarchy/anarchystr.h:70:9`!, len[3]);
755 memcpy(&buffer[pos[4]], TXT_SUICIDES_SHORTcxx . . $ `netgames/anarchy/anarchystr.h:71:9`!, len[4]);
756 memcpy(&buffer[pos[5]], TXT_PINGcxx . . $ `netgames/anarchy/anarchystr.h:59:9`!, len[5]);
757 buffer[pos[5] + len[5] + 1] = '\n';
758 buffer[pos[5] + len[5] + 2] = '\0';
759 DPrintf(buffer);
760
761 int slot;
762 player_recordcxx . . $ player_record# *pr;
763 int pcount;
764
765 if (level < 0 || level >= MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!)
766 pcount = MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!;
767 else
768 pcount = level;
769
770 int sortedplayers[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!];
771 DMFCBasecxx . . $ DMFCBase.->GetSortedPlayerSlotscxx . . $ IDMFC#GetSortedPlayerSlots(621ccea12ecf5b06).(sortedplayers, MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!);
772
773 for (int i = 0; i < pcount; i++) {
774 slot = sortedplayers[i];
775 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(slot);
776 if ((pr) && (pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.)) {
777
778 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
779 continue; // skip dedicated server
780
781 snprintf(name, sizeof(name), "%s%s:", (pr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.) ? "*" : "", pr->callsigncxx . . $ player_record#callsign.);
782 name[19] = '\0';
783
784 memset(buffer, ' ', 256);
785 t = strlen(name);
786 memcpy(&buffer[pos[0]], name, (t < len[0]) ? t : len[0]);
787 snprintf(name, sizeof(name), "%d", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] - pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
788 t = strlen(name);
789 memcpy(&buffer[pos[1]], name, (t < len[1]) ? t : len[1]);
790 snprintf(name, sizeof(name), "%d", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
791 t = strlen(name);
792 memcpy(&buffer[pos[2]], name, (t < len[2]) ? t : len[2]);
793 snprintf(name, sizeof(name), "%d", pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
794 t = strlen(name);
795 memcpy(&buffer[pos[3]], name, (t < len[3]) ? t : len[3]);
796 snprintf(name, sizeof(name), "%d", pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
797 t = strlen(name);
798 memcpy(&buffer[pos[4]], name, (t < len[4]) ? t : len[4]);
799
800 if (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.)
801 snprintf(name, sizeof(name), "%.0f", (DMFCBasecxx . . $ DMFCBase.->GetNetPlayerscxx . . $ IDMFC#GetNetPlayers(d09959b2d64446dd).())[pr->pnumcxx . . $ player_record#pnum.].ping_timecxx . . $ netplayer#ping_time. * 1000.0f);
802 else
803 strcpy(name, "---");
804 t = strlen(name);
805 memcpy(&buffer[pos[5]], name, (t < len[5]) ? t : len[5]);
806 buffer[pos[5] + len[5] + 1] = '\n';
807 buffer[pos[5] + len[5] + 2] = '\0';
808 DPrintf(buffer);
809 }
810 }
811 }
812
813 void DisplayHUDScorescxx . . $ DisplayHUDScores(c7a20e4e05358911).(struct tHUDItemcxx . . $ tHUDItem# *hitem) {
814 if (display_my_welcomecxx . . $ display_my_welcome.) {
815 DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).());
816 display_my_welcomecxx . . $ display_my_welcome. = false;
817 }
818
819 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.)
820 return;
821
822 int height = DLLgrfont_GetHeight((DMFCBasecxx . . $ DMFCBase.->GetGameFontTranslateArraycxx . . $ IDMFC#GetGameFontTranslateArray(a7741f82f5fc3640).())[HUD_FONT_INDEXcxx . . $ `Descent3/gamefont.h:97:9`!]) + 3;
823 uint8_tcxx . . $ uint8_t# alpha = DMFCBasecxx . . $ DMFCBase.->ConvertHUDAlphacxx . . $ IDMFC#ConvertHUDAlpha(50106d451684defa).((uint8_tcxx . . $ uint8_t#)((DisplayScoreScreencxx . . $ DisplayScoreScreen.) ? 128 : 255));
824 int y = (DMFCBasecxx . . $ DMFCBase.->GetGameWindowHcxx . . $ IDMFC#GetGameWindowH(b126dc7c1de90089).() / 2) - ((height * 5) / 2);
825 int x = 520;
826 ddgr_colorcxx . . $ ddgr_color# color = 0;
827
828 int rank = 1;
829 player_recordcxx . . $ player_record# *pr;
830
831 // Display your Kills & Deaths on the top corners of the screen
832 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordByPnumcxx . . $ IDMFC#GetPlayerRecordByPnum(6359c6f28dd028ae).(DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).());
833 if (pr) {
834 int y = 25, x;
835 int lwidth;
836 char buffer[20];
837
838 int w_kill, w_death, max_w;
839 w_kill = DLLgrtext_GetTextLineWidth(TXT_KILLScxx . . $ `netgames/anarchy/anarchystr.h:41:9`!);
840 w_death = DLLgrtext_GetTextLineWidth(TXT_DEATHScxx . . $ `netgames/anarchy/anarchystr.h:42:9`!);
841 max_w = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(w_kill, w_death);
842
843 x = DMFCBasecxx . . $ DMFCBase.->GetGameWindowWcxx . . $ IDMFC#GetGameWindowW(b126dc7c1de90089).() - DMFCBasecxx . . $ DMFCBase.->GetGameWindowWcxx . . $ IDMFC#GetGameWindowW(b126dc7c1de90089).() * 0.0078125f;
844 DLLgrtext_SetColor(GR_GREENcxx . . $ GR_GREEN.);
845 DLLgrtext_SetAlpha(alpha);
846 DLLgrtext_Printf(x - (max_w / 2) - (w_kill / 2), y, TXT_KILLScxx . . $ `netgames/anarchy/anarchystr.h:41:9`!);
847 y += height;
848
849 snprintf(buffer, sizeof(buffer), "%d", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
850 lwidth = DLLgrtext_GetTextLineWidth(buffer);
851 DLLgrtext_SetColor(GR_GREENcxx . . $ GR_GREEN.);
852 DLLgrtext_SetAlpha(alpha);
853 DLLgrtext_Printf(x - (max_w / 2) - (lwidth / 2), y, buffer);
854 y += height + 3;
855
856 DLLgrtext_SetColor(GR_GREENcxx . . $ GR_GREEN.);
857 DLLgrtext_SetAlpha(alpha);
858 DLLgrtext_Printf(x - (max_w / 2) - (w_death / 2), y, TXT_DEATHScxx . . $ `netgames/anarchy/anarchystr.h:42:9`!);
859 y += height;
860
861 snprintf(buffer, sizeof(buffer), "%d", pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
862 lwidth = DLLgrtext_GetTextLineWidth(buffer);
863 DLLgrtext_SetColor(GR_GREENcxx . . $ GR_GREEN.);
864 DLLgrtext_SetAlpha(alpha);
865 DLLgrtext_Printf(x - (max_w / 2) - (lwidth / 2), y, buffer);
866 }
867
868 int ESortedPlayers[DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!];
869
870 switch (Anarchy_hud_displaycxx . . $ Anarchy_hud_display.) {
871 case AHD_NONEcxx . . $ `netgames/anarchy/anarchy.cpp:69:9`!:
872 return;
873 break;
874 case AHD_EFFICIENCYcxx . . $ `netgames/anarchy/anarchy.cpp:71:9`!:
875 DMFCBasecxx . . $ DMFCBase.->GetSortedPlayerSlotscxx . . $ IDMFC#GetSortedPlayerSlots(621ccea12ecf5b06).(ESortedPlayers, DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!);
876 break;
877 }
878
879 char name[30];
880
881 // determine coordinates to use here
882 // we'll use a virtual width of 85 pixels on a 640x480 screen
883 // so first determine the new width
884 int name_width = 85.0f * DMFCBasecxx . . $ DMFCBase.->GetHudAspectXcxx . . $ IDMFC#GetHudAspectX(9b8c9e39889c762c).();
885 int score_width = DLLgrtext_GetTextLineWidth("888");
886 int name_x = DMFCBasecxx . . $ DMFCBase.->GetGameWindowWcxx . . $ IDMFC#GetGameWindowW(b126dc7c1de90089).() - name_width - score_width - 10;
887 int score_x = DMFCBasecxx . . $ DMFCBase.->GetGameWindowWcxx . . $ IDMFC#GetGameWindowW(b126dc7c1de90089).() - score_width - 5;
888
889 for (int i = 0; i < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; i++) {
890 int slot;
891
892 if (Anarchy_hud_displaycxx . . $ Anarchy_hud_display. == AHD_EFFICIENCYcxx . . $ `netgames/anarchy/anarchy.cpp:71:9`!)
893 slot = ESortedPlayers[i];
894 else
895 slot = SortedPlayerscxx . . $ SortedPlayers.[i];
896
897 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(slot);
898
899 if ((pr) && (pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.)) {
900
901 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
902 continue; // skip dedicated server
903
904 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.))) {
905
906 if (pr->pnumcxx . . $ player_record#pnum. == DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()) {
907
908 switch (HUD_color_modelcxx . . $ HUD_color_model.) {
909 case ACM_PLAYERCOLORcxx . . $ `netgames/anarchy/anarchy.cpp:72:9`!:
910 color = (DMFCBasecxx . . $ DMFCBase.->GetPlayerColorscxx . . $ IDMFC#GetPlayerColors(ac695d451f96e4aa).())[pr->pnumcxx . . $ player_record#pnum.];
911 break;
912 case ACM_NORMALcxx . . $ `netgames/anarchy/anarchy.cpp:73:9`!:
913 color = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(40, 255, 40);
914 break;
915 };
916
917 if (Highlight_bmpcxx . . $ Highlight_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) {
918 // draw the highlite bar in the background
919 DLLrend_SetAlphaValue(alpha * 0.50f);
920 DLLrend_SetZBufferState(0);
921 DLLrend_SetTextureType(TT_LINEARcxx . . $ TT_LINEAR.);
922 DLLrend_SetLighting(LS_NONEcxx . . $ LS_NONE.);
923 DLLrend_SetAlphaType(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!);
924 DLLrend_DrawScaledBitmap(name_x - 2, y - 2, score_x + score_width + 2, y + height - 1, Highlight_bmpcxx . . $ Highlight_bmp., 0, 0,
925 1, 1, 1.0, -1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
926 DLLrend_SetZBufferState(1);
927 }
928
929 strcpy(name, pr->callsigncxx . . $ player_record#callsign.);
930 DMFCBasecxx . . $ DMFCBase.->ClipStringcxx . . $ IDMFC#ClipString(8677479218165cd4).(name_width, name, true);
931
932 DLLgrtext_SetAlpha(alpha);
933 DLLgrtext_SetColor(color);
934 DLLgrtext_Printf(name_x, y, "%s", name);
935
936 if (Anarchy_hud_displaycxx . . $ Anarchy_hud_display. == AHD_EFFICIENCYcxx . . $ `netgames/anarchy/anarchy.cpp:71:9`!) {
937 float t = pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] + pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] + pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!];
938 float value = (float)(pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]) / ((t) ? t : 0.0000001f);
939 DLLgrtext_Printf(score_x, y, "%.1f", value);
940 } else {
941 DLLgrtext_Printf(score_x, y, "%d", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] - pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
942 }
943
944 y += height;
945 } else if (rank < 6) {
946
947 if (pr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.) {
948 color = GR_GREYcxx . . $ `netgames/includes/DMFC.h:432:9`!;
949 } else {
950 switch (HUD_color_modelcxx . . $ HUD_color_model.) {
951 case ACM_PLAYERCOLORcxx . . $ `netgames/anarchy/anarchy.cpp:72:9`!:
952 color = (DMFCBasecxx . . $ DMFCBase.->GetPlayerColorscxx . . $ IDMFC#GetPlayerColors(ac695d451f96e4aa).())[pr->pnumcxx . . $ player_record#pnum.];
953 break;
954 case ACM_NORMALcxx . . $ `netgames/anarchy/anarchy.cpp:73:9`!:
955 color = GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(40, 255, 40);
956 break;
957 };
958 }
959 strcpy(name, pr->callsigncxx . . $ player_record#callsign.);
960 DMFCBasecxx . . $ DMFCBase.->ClipStringcxx . . $ IDMFC#ClipString(8677479218165cd4).(name_width, name, true);
961
962 DLLgrtext_SetAlpha(alpha);
963 DLLgrtext_SetColor(color);
964 DLLgrtext_Printf(name_x, y, "%s", name);
965
966 if (Anarchy_hud_displaycxx . . $ Anarchy_hud_display. == AHD_EFFICIENCYcxx . . $ `netgames/anarchy/anarchy.cpp:71:9`!) {
967 float t = pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] + pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] + pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!];
968 float value = (float)(pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]) / ((t) ? t : 0.0000001f);
969 DLLgrtext_Printf(score_x, y, "%.1f", value);
970 } else {
971 DLLgrtext_Printf(score_x, y, "%d", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] - pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
972 }
973
974 y += height;
975 }
976 rank++;
977 }
978 }
979 }
980 }
981
982 void DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(int player_num) {
983 char name_buffer[64];
984 strcpy(name_buffer, (DMFCBasecxx . . $ DMFCBase.->GetPlayerscxx . . $ IDMFC#GetPlayers(51ff8e716a252304).())[player_num].callsigncxx . . $ player#callsign.);
985
986 if (player_num == DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()) {
987 DLLAddHUDMessage(TXT_WELCOMEcxx . . $ `netgames/anarchy/anarchystr.h:46:9`!, name_buffer);
988 } else {
989 DLLAddHUDMessage(TXT_JOINEDcxx . . $ `netgames/anarchy/anarchystr.h:47:9`!, name_buffer);
990 }
991 }
992
993 void SwitchHUDColorcxx . . $ SwitchHUDColor(d4f767463ce0a6b3).(int i) {
994 if (i < 0 || i > 1)
995 return;
996 HUD_color_modelcxx . . $ HUD_color_model. = i;
997
998 switch (HUD_color_modelcxx . . $ HUD_color_model.) {
999 case ACM_PLAYERCOLORcxx . . $ `netgames/anarchy/anarchy.cpp:72:9`!:
1000 DLLAddHUDMessage(TXT_MSG_COLORPLRcxx . . $ `netgames/anarchy/anarchystr.h:67:9`!);
1001 break;
1002 case ACM_NORMALcxx . . $ `netgames/anarchy/anarchy.cpp:73:9`!:
1003 DLLAddHUDMessage(TXT_MSG_COLORNORMcxx . . $ `netgames/anarchy/anarchystr.h:68:9`!);
1004 break;
1005 };
1006 }