Debian Codegraph @

netgames/tanarchy/tanarchy.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/tanarchy/tanarchy.cpp $
21 * $Revision: 1.1.1.1 $
22 * $Date: 2003/08/26 03:59:14 $
23 * $Author: kevinb $
24 *
25 * <insert description of file here>
26 *
27 * $Log: tanarchy.cpp,v $
28 * Revision 1.1.1.1 2003/08/26 03:59:14 kevinb
29 * initial 1.5 import
30 *
31 *
32 * 74 10/03/01 1:05p Matt
33 * Made team_name buffer large enough to hold the team number *plus* the
34 * number of players on the team.
35 *
36 * 73 9/24/01 2:28p Matt
37 * Allowed room for longer team name on results screen.
38 *
39 * 72 9/18/01 6:54p Matt
40 * Show results for NUM_TEAMS, not MAX_TEAMS.
41 * Removed some unused code.
42 *
43 * 71 9/13/01 5:31p Matt
44 * Added a team member list to the stats display.
45 * Fixed a non-terminated string bug.
46 *
47 * 70 10/21/99 3:28p Kevin
48 * Mac merge!
49 *
50 * 69 7/15/99 1:18a Jeff
51 * added $scores
52 *
53 * 68 7/12/99 2:27p Jeff
54 * fixed PLR to only display the team label for the disconnected list if
55 * there are people in the list
56 *
57 * 67 7/12/99 1:22p Jeff
58 * updated for new netflags
59 *
60 * 66 7/11/99 6:55p Jeff
61 * fixed PLR so it doesn't go off the screen on long lists and active
62 * players in the game are shown first
63 *
64 * 65 5/23/99 5:54p Jeff
65 * fixed HUD display
66 *
67 * 64 5/23/99 3:04a Jason
68 * fixed bug with player rankings not being updated correctly
69 *
70 * 63 5/12/99 11:04p Jeff
71 * dmfc and multiplayer games now have endian friendly packets (*whew*)
72 *
73 * 62 5/12/99 11:28a Jeff
74 * added sourcesafe comment block
75 *
76 * $NoKeywords: $
77 */
78
79 #include "gamedll_header.h"cxx . . $ `<file>/netgames/includes/gamedll_header.h`/
80 #include <string.h>
81 #include "idmfc.h"cxx . . $ `<file>/netgames/includes/idmfc.h`/
82 #include "tanDMFC.h"cxx . . $ `<file>/netgames/tanarchy/tanDMFC.h`/
83 #include "tanarchystr.h"cxx . . $ `<file>/netgames/tanarchy/tanarchystr.h`/
84 IDMFCcxx . . $ IDMFC# *DMFCBasecxx . . $ DMFCBase. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
85 static IDmfcStatscxx . . $ IDmfcStats# *dstatcxx . . $ dstat. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
86 static playercxx . . $ player# *dPlayerscxx . . $ dPlayers.;
87
88 #define SPID_NEWPLAYERcxx . . $ `netgames/tanarchy/tanarchy.cpp:88:9`! 0
89 #define NUM_TEAMScxx . . $ `netgames/tanarchy/tanarchy.cpp:89:9`! 2
90
91 static int SortedPLRPlayerscxx . . $ SortedPLRPlayers.[MAX_TEAMScxx . . $ `Descent3/player_external_struct.h:87:9`!][MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!];
92 static int TeamScorecxx . . $ TeamScore.[NUM_TEAMScxx . . $ `netgames/tanarchy/tanarchy.cpp:89:9`!];
93 static int SortedTeamscxx . . $ SortedTeams.[NUM_TEAMScxx . . $ `netgames/tanarchy/tanarchy.cpp:89:9`!];
94 static int SortedPlayerscxx . . $ SortedPlayers.[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!];
95 static bool DisplayScoreScreencxx . . $ DisplayScoreScreen.;
96 static bool display_my_welcomecxx . . $ display_my_welcome. = false;
97
98 static void GetGameStartPacketcxx . . $ GetGameStartPacket(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data);
99 static void SendGameStartPacketcxx . . $ SendGameStartPacket(d4f767463ce0a6b3).(int pnum);
100 static void DisplayScorescxx . . $ DisplayScores(49f6e7a06ebc5aa8).(void);
101 static void DisplayHUDScorescxx . . $ DisplayHUDScores(c7a20e4e05358911).(struct tHUDItemcxx . . $ tHUDItem# *hitem);
102 static void DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(int player_num);
103 static void SortTeamScorescxx . . $ SortTeamScores(ce8f7825f8908cfa).(int *sortedindex, int *scores);
104 void OnSaveStatsToFilecxx . . $ OnSaveStatsToFile(49f6e7a06ebc5aa8).(void);
105 static void OnLevelEndSaveStatsToFilecxx . . $ OnLevelEndSaveStatsToFile(49f6e7a06ebc5aa8).(void);
106 static void OnDisconnectSaveStatsToFilecxx . . $ OnDisconnectSaveStatsToFile(49f6e7a06ebc5aa8).(void);
107 static void OnPrintScorescxx . . $ OnPrintScores(d4f767463ce0a6b3).(int level);
108 static void DetermineScorecxx . . $ DetermineScore(74c02bb7c84e7fae).(int precord_num, int column_num, char *buffer, int buffer_size);
109 static void TeamScoreCallbackcxx . . $ TeamScoreCallback(99469d7ff9a1485a).(int team, char *buffer, int buffer_size);
110 static bool compare_slotscxx . . $ compare_slots(cf9ef193275fa6d8).(int a, int b);
111
112 static int Highlight_bmpcxx . . $ Highlight_bmp. = -1;
113
114 ///////////////////////////////////////////////
115 // localization info
116 static char **StringTablecxx . . $ StringTable.;
117 static int StringTableSizecxx . . $ StringTableSize. = 0;
118 static const char *_ErrorStringcxx . . $ _ErrorString. = "Missing String";
119 const char *GetStringFromTablecxx . . $ GetStringFromTable(f7ae7e56280f18ae).(int d) {
120 if ((d < 0) || (d >= StringTableSizecxx . . $ StringTableSize.))
121 return _ErrorStringcxx . . $ _ErrorString.;
122 else
123 return StringTablecxx . . $ StringTable.[d];
124 }
125 ///////////////////////////////////////////////
126
127 void DetermineScorecxx . . $ DetermineScore(74c02bb7c84e7fae).(int precord_num, int column_num, char *buffer, int buffer_size) {
128 player_recordcxx . . $ player_record# *pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(precord_num);
129 if (!pr || pr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.) {
130 buffer[0] = '\0';
131 return;
132 }
133
134 snprintf(buffer, buffer_size, "%d[%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`!],
135 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`!]);
136 }
137
138 void TeamScoreCallbackcxx . . $ TeamScoreCallback(99469d7ff9a1485a).(int team, char *buffer, int buffer_size) {
139 ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(team >= 0 && team < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!);
140
141 snprintf(buffer, buffer_size, " %d", TeamScorecxx . . $ TeamScore.[team]);
142 }
143
144 // This function gets called by the game when it wants to learn some info about the game
145 void DLLFUNCCALLcxx . . $ `lib/module.h:93:10`! DLLGetGameInfocxx . . $ DLLGetGameInfo(e5c6dce1fbda187a).(tDLLOptionscxx . . $ tDLLOptions# *options) {
146 options->flagscxx . . $ tDLLOptions#flags. = DOF_MAXTEAMScxx . . $ `netgames/includes/gamedll_header.h:105:9`! | DOF_MINTEAMScxx . . $ `netgames/includes/gamedll_header.h:106:9`!;
147 options->max_teamscxx . . $ tDLLOptions#max_teams. = 2;
148 options->min_teamscxx . . $ tDLLOptions#min_teams. = 2;
149 strcpy(options->game_namecxx . . $ tDLLOptions#game_name., TXT_GAMENAMEcxx . . $ `netgames/tanarchy/tanarchystr.h:58:9`!);
150 strcpy(options->requirementscxx . . $ tDLLOptions#requirements., "");
151 }
152
153 // Initializes the game function pointers
154 void DLLFUNCCALLcxx . . $ `lib/module.h:93:10`! DLLGameInitcxx . . $ DLLGameInit(937c1f75cb8fa6b1).(int *api_func, uint8_tcxx . . $ uint8_t# *all_ok, int num_teams_to_use) {
155 *all_ok = 1;
156 DMFCBasecxx . . $ DMFCBase. = CreateDMFC();
157 if (!DMFCBasecxx . . $ DMFCBase.) {
158 *all_ok = 0;
159 return;
160 }
161
162 dstatcxx . . $ dstat. = CreateDmfcStats();
163 if (!dstatcxx . . $ dstat.) {
164 *all_ok = 0;
165 return;
166 }
167 DMFCBasecxx . . $ DMFCBase.->LoadFunctionscxx . . $ IDMFC#LoadFunctions(11b0e290e57a7e53).(api_func);
168 DMFCBasecxx . . $ DMFCBase.->Set_OnGameStateRequestcxx . . $ IDMFC#Set_OnGameStateRequest(94eb4457dc8d4d10).(OnGameStateRequestcxx . . $ OnGameStateRequest(d4f767463ce0a6b3).);
169 DMFCBasecxx . . $ DMFCBase.->Set_OnClientPlayerKilledcxx . . $ IDMFC#Set_OnClientPlayerKilled(7da43329b4117518).(OnClientPlayerKilledcxx . . $ OnClientPlayerKilled(766a1b7183ffa4b4).);
170 DMFCBasecxx . . $ DMFCBase.->Set_OnServerGameCreatedcxx . . $ IDMFC#Set_OnServerGameCreated(964b12a25712bdc3).(OnServerGameCreatedcxx . . $ OnServerGameCreated(49f6e7a06ebc5aa8).);
171 DMFCBasecxx . . $ DMFCBase.->Set_OnClientLevelStartcxx . . $ IDMFC#Set_OnClientLevelStart(964b12a25712bdc3).(OnClientLevelStartcxx . . $ OnClientLevelStart(49f6e7a06ebc5aa8).);
172 DMFCBasecxx . . $ DMFCBase.->Set_OnClientLevelEndcxx . . $ IDMFC#Set_OnClientLevelEnd(964b12a25712bdc3).(OnClientLevelEndcxx . . $ OnClientLevelEnd(49f6e7a06ebc5aa8).);
173 DMFCBasecxx . . $ DMFCBase.->Set_OnClientPlayerEntersGamecxx . . $ IDMFC#Set_OnClientPlayerEntersGame(94eb4457dc8d4d10).(OnClientPlayerEntersGamecxx . . $ OnClientPlayerEntersGame(d4f767463ce0a6b3).);
174 DMFCBasecxx . . $ DMFCBase.->Set_OnIntervalcxx . . $ IDMFC#Set_OnInterval(964b12a25712bdc3).(OnIntervalcxx . . $ OnInterval(49f6e7a06ebc5aa8).);
175 DMFCBasecxx . . $ DMFCBase.->Set_OnHUDIntervalcxx . . $ IDMFC#Set_OnHUDInterval(964b12a25712bdc3).(OnHUDIntervalcxx . . $ OnHUDInterval(49f6e7a06ebc5aa8).);
176 DMFCBasecxx . . $ DMFCBase.->Set_OnKeypresscxx . . $ IDMFC#Set_OnKeypress(94eb4457dc8d4d10).(OnKeypresscxx . . $ OnKeypress(d4f767463ce0a6b3).);
177 DMFCBasecxx . . $ DMFCBase.->Set_OnPLRIntervalcxx . . $ IDMFC#Set_OnPLRInterval(964b12a25712bdc3).(OnPLRIntervalcxx . . $ OnPLRInterval(49f6e7a06ebc5aa8).);
178 DMFCBasecxx . . $ DMFCBase.->Set_OnPLRInitcxx . . $ IDMFC#Set_OnPLRInit(964b12a25712bdc3).(OnPLRInitcxx . . $ OnPLRInit(49f6e7a06ebc5aa8).);
179 DMFCBasecxx . . $ DMFCBase.->Set_OnSaveStatsToFilecxx . . $ IDMFC#Set_OnSaveStatsToFile(964b12a25712bdc3).(OnSaveStatsToFilecxx . . $ OnSaveStatsToFile(49f6e7a06ebc5aa8).);
180 DMFCBasecxx . . $ DMFCBase.->Set_OnLevelEndSaveStatsToFilecxx . . $ IDMFC#Set_OnLevelEndSaveStatsToFile(964b12a25712bdc3).(OnLevelEndSaveStatsToFilecxx . . $ OnLevelEndSaveStatsToFile(49f6e7a06ebc5aa8).);
181 DMFCBasecxx . . $ DMFCBase.->Set_OnDisconnectSaveStatsToFilecxx . . $ IDMFC#Set_OnDisconnectSaveStatsToFile(964b12a25712bdc3).(OnDisconnectSaveStatsToFilecxx . . $ OnDisconnectSaveStatsToFile(49f6e7a06ebc5aa8).);
182 DMFCBasecxx . . $ DMFCBase.->Set_OnPrintScorescxx . . $ IDMFC#Set_OnPrintScores(94eb4457dc8d4d10).(OnPrintScorescxx . . $ OnPrintScores(d4f767463ce0a6b3).);
183
184 dPlayerscxx . . $ dPlayers. = DMFCBasecxx . . $ DMFCBase.->GetPlayerscxx . . $ IDMFC#GetPlayers(51ff8e716a252304).();
185
186 DMFCBasecxx . . $ DMFCBase.->GameInitcxx . . $ IDMFC#GameInit(d4f767463ce0a6b3).(NUM_TEAMScxx . . $ `netgames/tanarchy/tanarchy.cpp:89:9`!);
187 DLLCreateStringTable("tanarchy.str", &StringTablecxx . . $ StringTable., &StringTableSizecxx . . $ StringTableSize.);
188 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "%d strings loaded from string table\n", StringTableSize);
189 if (!StringTableSizecxx . . $ StringTableSize.) {
190 *all_ok = 0;
191 return;
192 }
193
194 netgame_infocxx . . $ netgame_info# *Netgame = DMFCBasecxx . . $ DMFCBase.->GetNetgameInfocxx . . $ IDMFC#GetNetgameInfo(242e78cd5130aa12).();
195 Netgame->flagscxx . . $ netgame_info#flags. |= (NF_TRACK_RANKcxx . . $ `Descent3/multi_external.h:243:9`!);
196
197 // add the death and suicide messages
198 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH1cxx . . $ `netgames/tanarchy/tanarchystr.h:31:9`!, true);
199 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH2cxx . . $ `netgames/tanarchy/tanarchystr.h:32:9`!, true);
200 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH3cxx . . $ `netgames/tanarchy/tanarchystr.h:33:9`!, false);
201 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH4cxx . . $ `netgames/tanarchy/tanarchystr.h:34:9`!, false);
202 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH5cxx . . $ `netgames/tanarchy/tanarchystr.h:35:9`!, true);
203 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH6cxx . . $ `netgames/tanarchy/tanarchystr.h:36:9`!, true);
204 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH7cxx . . $ `netgames/tanarchy/tanarchystr.h:37:9`!, false);
205 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH8cxx . . $ `netgames/tanarchy/tanarchystr.h:38:9`!, true);
206 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH9cxx . . $ `netgames/tanarchy/tanarchystr.h:39:9`!, true);
207 DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH10cxx . . $ `netgames/tanarchy/tanarchystr.h:40:9`!, true);
208
209 DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE1cxx . . $ `netgames/tanarchy/tanarchystr.h:41:9`!);
210 DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE2cxx . . $ `netgames/tanarchy/tanarchystr.h:42:9`!);
211 DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE3cxx . . $ `netgames/tanarchy/tanarchystr.h:43:9`!);
212 DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE4cxx . . $ `netgames/tanarchy/tanarchystr.h:44:9`!);
213 DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE5cxx . . $ `netgames/tanarchy/tanarchystr.h:45:9`!);
214 DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE6cxx . . $ `netgames/tanarchy/tanarchystr.h:46:9`!);
215
216 // register special packet receivers
217 DMFCBasecxx . . $ DMFCBase.->RegisterPacketReceivercxx . . $ IDMFC#RegisterPacketReceiver(6efe5766e3bef270).(SPID_NEWPLAYERcxx . . $ `netgames/tanarchy/tanarchy.cpp:88:9`!, GetGameStartPacketcxx . . $ GetGameStartPacket(f25546b61a629de7).);
218
219 DMFCBasecxx . . $ DMFCBase.->SetNumberOfTeamscxx . . $ IDMFC#SetNumberOfTeams(d4f767463ce0a6b3).(NUM_TEAMScxx . . $ `netgames/tanarchy/tanarchy.cpp:89:9`!);
220
221 DMFCBasecxx . . $ DMFCBase.->AddHUDItemCallbackcxx . . $ IDMFC#AddHUDItemCallback(97c9b33f56b4265c).(HI_TEXTcxx . . $ `netgames/includes/DMFC.h:440:9`!, DisplayHUDScorescxx . . $ DisplayHUDScores(c7a20e4e05358911).);
222
223 DisplayScoreScreencxx . . $ DisplayScoreScreen. = false;
224
225 Highlight_bmpcxx . . $ Highlight_bmp. = DLLbm_AllocBitmap(32, 32, 0);
226 if (Highlight_bmpcxx . . $ Highlight_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) {
227 uint16_tcxx . . $ uint16_t# *data = DLLbm_data(Highlight_bmpcxx . . $ Highlight_bmp., 0);
228 if (!data) {
229 // bail on out of here
230 *all_ok = 0;
231 return;
232 }
233 for (int x = 0; x < 32 * 32; x++) {
234 data[x] = GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(50, 50, 50) | OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`!;
235 }
236 }
237
238 // Initialize the Stats Manager
239 // ----------------------------
240
241 tDmfcStatsInitcxx . . $ tDmfcStatsInit# tsi;
242 tDmfcStatsColumnInfocxx . . $ tDmfcStatsColumnInfo# pl_col[6];
243 char gname[20];
244 strcpy(gname, TXT_STATSGAMENAMEcxx . . $ `netgames/tanarchy/tanarchystr.h:68:9`!);
245
246 tsi.flagscxx . . $ tDmfcStatsInit#flags. = DSIF_SHOW_PICcxx . . $ `netgames/includes/DMFC.h:619:9`! | DSIF_SHOW_OBSERVERICONcxx . . $ `netgames/includes/DMFC.h:627:9`! | DSIF_SEPERATE_BY_TEAMcxx . . $ `netgames/includes/DMFC.h:615:9`!;
247 tsi.cColumnCountDetailedcxx . . $ tDmfcStatsInit#cColumnCountDetailed. = 0;
248 tsi.cColumnCountPlayerListcxx . . $ tDmfcStatsInit#cColumnCountPlayerList. = 6;
249 tsi.clbDetailedColumnBMPcxx . . $ tDmfcStatsInit#clbDetailedColumnBMP. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
250 tsi.clbDetailedColumncxx . . $ tDmfcStatsInit#clbDetailedColumn. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
251 tsi.clbPlayerColumncxx . . $ tDmfcStatsInit#clbPlayerColumn. = DetermineScorecxx . . $ DetermineScore(74c02bb7c84e7fae).;
252 tsi.clbPlayerColumnBMPcxx . . $ tDmfcStatsInit#clbPlayerColumnBMP. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
253 tsi.DetailedColumnscxx . . $ tDmfcStatsInit#DetailedColumns. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
254 tsi.GameNamecxx . . $ tDmfcStatsInit#GameName. = gname;
255 tsi.MaxNumberDisplayedcxx . . $ tDmfcStatsInit#MaxNumberDisplayed. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
256 tsi.PlayerListColumnscxx . . $ tDmfcStatsInit#PlayerListColumns. = pl_col;
257 tsi.SortedPlayerRecordscxx . . $ tDmfcStatsInit#SortedPlayerRecords. = SortedPlayerscxx . . $ SortedPlayers.;
258 tsi.clTeamLinecxx . . $ tDmfcStatsInit#clTeamLine. = TeamScoreCallbackcxx . . $ TeamScoreCallback(99469d7ff9a1485a).;
259
260 pl_col[0].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.;
261 strcpy(pl_col[0].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_PILOTcxx . . $ `netgames/tanarchy/tanarchystr.h:53:9`!);
262 pl_col[0].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_PILOT_NAMEcxx . . $ DSCOL_PILOT_NAME.;
263 pl_col[0].widthcxx . . $ tDmfcStatsColumnInfo#width. = 120;
264
265 pl_col[1].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.;
266 strcpy(pl_col[1].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_SCOREcxx . . $ `netgames/tanarchy/tanarchystr.h:59:9`!);
267 pl_col[1].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_CUSTOMcxx . . $ DSCOL_CUSTOM.;
268 pl_col[1].widthcxx . . $ tDmfcStatsColumnInfo#width. = 47;
269
270 pl_col[2].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.;
271 strcpy(pl_col[2].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_KILLScxx . . $ `netgames/tanarchy/tanarchystr.h:54:9`!);
272 pl_col[2].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_KILLS_LEVELcxx . . $ DSCOL_KILLS_LEVEL.;
273 pl_col[2].widthcxx . . $ tDmfcStatsColumnInfo#width. = 47;
274
275 pl_col[3].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.;
276 strcpy(pl_col[3].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_DEATHScxx . . $ `netgames/tanarchy/tanarchystr.h:55:9`!);
277 pl_col[3].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_DEATHS_LEVELcxx . . $ DSCOL_DEATHS_LEVEL.;
278 pl_col[3].widthcxx . . $ tDmfcStatsColumnInfo#width. = 57;
279
280 pl_col[4].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.;
281 strcpy(pl_col[4].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_SUICIDEScxx . . $ `netgames/tanarchy/tanarchystr.h:56:9`!);
282 pl_col[4].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_SUICIDES_LEVELcxx . . $ DSCOL_SUICIDES_LEVEL.;
283 pl_col[4].widthcxx . . $ tDmfcStatsColumnInfo#width. = 67;
284
285 pl_col[5].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.;
286 strcpy(pl_col[5].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_PINGcxx . . $ `netgames/tanarchy/tanarchystr.h:60:9`!);
287 pl_col[5].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_PINGcxx . . $ DSCOL_PING.;
288 pl_col[5].widthcxx . . $ tDmfcStatsColumnInfo#width. = 40;
289
290 dstatcxx . . $ dstat.->Initializecxx . . $ IDmfcStats#Initialize(645910a8ad01b658).(&tsi);
291 }
292 // Called when the DLL is shutdown
293 void DLLFUNCCALLcxx . . $ `lib/module.h:93:10`! DLLGameClosecxx . . $ DLLGameClose(49f6e7a06ebc5aa8).() {
294 if (Highlight_bmpcxx . . $ Highlight_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!)
295 DLLbm_FreeBitmap(Highlight_bmpcxx . . $ Highlight_bmp.);
296
297 DLLDestroyStringTable(StringTablecxx . . $ StringTable., StringTableSizecxx . . $ StringTableSize.);
298
299 if (dstatcxx . . $ dstat.) {
300 dstatcxx . . $ dstat.->DestroyPointercxx . . $ IObject#DestroyPointer(49f6e7a06ebc5aa8).();
301 dstatcxx . . $ dstat. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
302 }
303
304 if (DMFCBasecxx . . $ DMFCBase.) {
305 DMFCBasecxx . . $ DMFCBase.->GameClosecxx . . $ IDMFC#GameClose(49f6e7a06ebc5aa8).();
306 DMFCBasecxx . . $ DMFCBase.->DestroyPointercxx . . $ IObject#DestroyPointer(49f6e7a06ebc5aa8).();
307 DMFCBasecxx . . $ DMFCBase. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
308 }
309 }
310
311 // The server has just started, so clear out all the stats and game info
312 void OnServerGameCreatedcxx . . $ OnServerGameCreated(49f6e7a06ebc5aa8).(void) {
313 DMFCBasecxx . . $ DMFCBase.->OnServerGameCreatedcxx . . $ IDMFC#OnServerGameCreated(49f6e7a06ebc5aa8).();
314
315 for (int i = 0; i < NUM_TEAMScxx . . $ `netgames/tanarchy/tanarchy.cpp:89:9`!; i++) {
316 TeamScorecxx . . $ TeamScore.[i] = 0;
317 }
318 }
319
320 // The server has started a new level, so clear out level scores
321 void OnClientLevelStartcxx . . $ OnClientLevelStart(49f6e7a06ebc5aa8).(void) {
322 DMFCBasecxx . . $ DMFCBase.->OnClientLevelStartcxx . . $ IDMFC#OnClientLevelStart(49f6e7a06ebc5aa8).();
323 for (int i = 0; i < NUM_TEAMScxx . . $ `netgames/tanarchy/tanarchy.cpp:89:9`!; i++) {
324 TeamScorecxx . . $ TeamScore.[i] = 0;
325 }
326 DMFCBasecxx . . $ DMFCBase.->RequestGameStatecxx . . $ IDMFC#RequestGameState(49f6e7a06ebc5aa8).();
327 }
328
329 void OnClientLevelEndcxx . . $ OnClientLevelEnd(49f6e7a06ebc5aa8).(void) { DMFCBasecxx . . $ DMFCBase.->OnClientLevelEndcxx . . $ IDMFC#OnClientLevelEnd(49f6e7a06ebc5aa8).(); }
330
331 // A New Player has entered the game, so we want to send him a game status packet that
332 // has information about the game
333 void OnGameStateRequestcxx . . $ OnGameStateRequest(d4f767463ce0a6b3).(int player_num) {
334 SendGameStartPacketcxx . . $ SendGameStartPacket(d4f767463ce0a6b3).(player_num);
335 DMFCBasecxx . . $ DMFCBase.->OnGameStateRequestcxx . . $ IDMFC#OnGameStateRequest(d4f767463ce0a6b3).(player_num);
336 }
337
338 // A new player has entered the game, zero there stats out
339 void OnClientPlayerEntersGamecxx . . $ OnClientPlayerEntersGame(d4f767463ce0a6b3).(int player_num) {
340 DMFCBasecxx . . $ DMFCBase.->OnClientPlayerEntersGamecxx . . $ IDMFC#OnClientPlayerEntersGame(d4f767463ce0a6b3).(player_num);
341
342 if (player_num != DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).())
343 DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(player_num);
344 else
345 display_my_welcomecxx . . $ display_my_welcome. = true;
346 }
347
348 // We need to adjust the scores
349 void OnClientPlayerKilledcxx . . $ OnClientPlayerKilled(766a1b7183ffa4b4).(objectcxx . . $ object# *killer_obj, int victim_pnum) {
350 int kpnum;
351
352 if (killer_obj) {
353 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`!))
354 kpnum = killer_obj->idcxx . . $ object#id.;
355 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.)) {
356 // countermeasure kill
357 kpnum = DMFCBasecxx . . $ DMFCBase.->GetCounterMeasureOwnercxx . . $ IDMFC#GetCounterMeasureOwner(2da2a862cad4c994).(killer_obj);
358 } else {
359 kpnum = -1;
360 }
361 } else
362 kpnum = -1;
363
364 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(83c267b20bac841a).(victim_pnum))
365 return; // dedicated server
366
367 if (kpnum == victim_pnum && victim_pnum != -1)
368 // subtract from the team score
369 TeamScorecxx . . $ TeamScore.[dPlayerscxx . . $ dPlayers.[victim_pnum].teamcxx . . $ player#team.]--;
370 else if ((kpnum != -1) && (dPlayerscxx . . $ dPlayers.[kpnum].teamcxx . . $ player#team. != -1))
371 TeamScorecxx . . $ TeamScore.[dPlayerscxx . . $ dPlayers.[kpnum].teamcxx . . $ player#team.]++;
372
373 DMFCBasecxx . . $ DMFCBase.->OnClientPlayerKilledcxx . . $ IDMFC#OnClientPlayerKilled(766a1b7183ffa4b4).(killer_obj, victim_pnum);
374 }
375
376 void OnHUDIntervalcxx . . $ OnHUDInterval(49f6e7a06ebc5aa8).(void) {
377 dstatcxx . . $ dstat.->DoFramecxx . . $ IDmfcStats#DoFrame(49f6e7a06ebc5aa8).();
378
379 DMFCBasecxx . . $ DMFCBase.->DisplayOutrageLogocxx . . $ IDMFC#DisplayOutrageLogo(49f6e7a06ebc5aa8).();
380
381 DMFCBasecxx . . $ DMFCBase.->OnHUDIntervalcxx . . $ IDMFC#OnHUDInterval(49f6e7a06ebc5aa8).();
382 }
383
384 void OnIntervalcxx . . $ OnInterval(49f6e7a06ebc5aa8).(void) {
385 SortTeamScorescxx . . $ SortTeamScores(ce8f7825f8908cfa).(SortedTeamscxx . . $ SortedTeams., TeamScorecxx . . $ TeamScore.);
386 DMFCBasecxx . . $ DMFCBase.->GetSortedPlayerSlotscxx . . $ IDMFC#GetSortedPlayerSlots(621ccea12ecf5b06).(SortedPlayerscxx . . $ SortedPlayers., MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!);
387
388 // do killgoal check
389 int goal;
390 if (DMFCBasecxx . . $ DMFCBase.->GetScoreLimitcxx . . $ IDMFC#GetScoreLimit(18a3c31ed0aa5760).(&goal)) {
391 for (int i = 0; i < NUM_TEAMScxx . . $ `netgames/tanarchy/tanarchy.cpp:89:9`!; i++) {
392 if (TeamScorecxx . . $ TeamScore.[i] >= goal)
393 DMFCBasecxx . . $ DMFCBase.->EndLevelcxx . . $ IDMFC#EndLevel(49f6e7a06ebc5aa8).();
394 }
395 }
396 DMFCBasecxx . . $ DMFCBase.->OnIntervalcxx . . $ IDMFC#OnInterval(49f6e7a06ebc5aa8).();
397 }
398
399 void OnKeypresscxx . . $ OnKeypress(d4f767463ce0a6b3).(int key) {
400 dllinfocxx . . $ dllinfo# *Data = DMFCBasecxx . . $ DMFCBase.->GetDLLInfoCallDatacxx . . $ IDMFC#GetDLLInfoCallData(4458c5bdce97a5c3).();
401 switch (key) {
402 case K_F7cxx . . $ `netgames/includes/DMFCKeyCodes.h:118:9`!:
403 DisplayScoreScreencxx . . $ DisplayScoreScreen. = !DisplayScoreScreencxx . . $ DisplayScoreScreen.;
404 DMFCBasecxx . . $ DMFCBase.->EnableOnScreenMenucxx . . $ IDMFC#EnableOnScreenMenu(b45ddcbc8423892c).(false);
405 dstatcxx . . $ dstat.->Enablecxx . . $ IDmfcStats#Enable(b45ddcbc8423892c).(DisplayScoreScreencxx . . $ DisplayScoreScreen.);
406 break;
407 case K_PAGEDOWNcxx . . $ `netgames/includes/DMFCKeyCodes.h:147:9`!:
408 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.) {
409 dstatcxx . . $ dstat.->ScrollDowncxx . . $ IDmfcStats#ScrollDown(49f6e7a06ebc5aa8).();
410 Data->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1;
411 }
412 break;
413 case K_PAGEUPcxx . . $ `netgames/includes/DMFCKeyCodes.h:144:9`!:
414 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.) {
415 dstatcxx . . $ dstat.->ScrollUpcxx . . $ IDmfcStats#ScrollUp(49f6e7a06ebc5aa8).();
416 Data->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1;
417 }
418 break;
419 case K_F6cxx . . $ `netgames/includes/DMFCKeyCodes.h:117:9`!:
420 DisplayScoreScreencxx . . $ DisplayScoreScreen. = false;
421 dstatcxx . . $ dstat.->Enablecxx . . $ IDmfcStats#Enable(b45ddcbc8423892c).(false);
422 break;
423 case K_ESCcxx . . $ `netgames/includes/DMFCKeyCodes.h:97:9`!:
424 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.) {
425 dstatcxx . . $ dstat.->Enablecxx . . $ IDmfcStats#Enable(b45ddcbc8423892c).(false);
426 DisplayScoreScreencxx . . $ DisplayScoreScreen. = false;
427 Data->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1;
428 }
429 break;
430 }
431
432 DMFCBasecxx . . $ DMFCBase.->OnKeypresscxx . . $ IDMFC#OnKeypress(d4f767463ce0a6b3).(key);
433 }
434
435 bool compare_slotscxx . . $ compare_slots(cf9ef193275fa6d8).(int a, int b) {
436 int ascore, bscore;
437 player_recordcxx . . $ player_record# *apr, *bpr;
438 apr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(a);
439 bpr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(b);
440 if (!apr)
441 return true;
442 if (!bpr)
443 return false;
444 if (apr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.)
445 return true;
446 if (bpr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.)
447 return false;
448 if ((apr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) && (bpr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.)) {
449 // both players were in the game
450 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`!];
451 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`!];
452 return (ascore < bscore);
453 }
454 if ((apr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) && (bpr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.)) {
455 // apr gets priority since he was in the game on exit
456 return false;
457 }
458 if ((apr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.) && (bpr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.)) {
459 // bpr gets priority since he was in the game on exit
460 return true;
461 }
462 // if we got here then both players were disconnected
463 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`!];
464 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`!];
465 return (ascore < bscore);
466 }
467
468 void OnPLRInitcxx . . $ OnPLRInit(49f6e7a06ebc5aa8).(void) {
469 int i, t, j;
470
471 for (i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) {
472 SortedPlayerscxx . . $ SortedPlayers.[i] = i;
473 }
474
475 for (i = 1; i <= MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`! - 1; i++) {
476 t = SortedPlayerscxx . . $ SortedPlayers.[i];
477 // Shift elements down until
478 // insertion point found.
479 for (j = i - 1; j >= 0 && compare_slotscxx . . $ compare_slots(cf9ef193275fa6d8).(SortedPlayerscxx . . $ SortedPlayers.[j], t); j--) {
480 SortedPlayerscxx . . $ SortedPlayers.[j + 1] = SortedPlayerscxx . . $ SortedPlayers.[j];
481 }
482 // insert
483 SortedPlayerscxx . . $ SortedPlayers.[j + 1] = t;
484 }
485
486 // Now fill in the final structure of sorted names
487 int TeamCount[MAX_TEAMScxx . . $ `Descent3/player_external_struct.h:87:9`!];
488 int team;
489 for (i = 0; i < MAX_TEAMScxx . . $ `Descent3/player_external_struct.h:87:9`!; i++)
490 TeamCount[i] = 0;
491 for (i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) {
492 int slot = SortedPlayerscxx . . $ SortedPlayers.[i];
493 player_recordcxx . . $ player_record# *pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(slot);
494 if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) {
495
496 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
497 continue; // dedicated server
498
499 team = (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) ? dPlayerscxx . . $ dPlayers.[pr->pnumcxx . . $ player_record#pnum.].teamcxx . . $ player#team. : pr->teamcxx . . $ player_record#team.;
500 SortedPLRPlayerscxx . . $ SortedPLRPlayers.[team][TeamCount[team]] = slot;
501 TeamCount[team]++;
502 }
503 }
504 for (i = 0; i < MAX_TEAMScxx . . $ `Descent3/player_external_struct.h:87:9`!; i++) {
505 if (TeamCount[i] < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!)
506 SortedPLRPlayerscxx . . $ SortedPLRPlayers.[i][TeamCount[i]] = -1;
507 }
508
509 DMFCBasecxx . . $ DMFCBase.->OnPLRInitcxx . . $ IDMFC#OnPLRInit(49f6e7a06ebc5aa8).();
510 }
511
512 void OnPLRIntervalcxx . . $ OnPLRInterval(49f6e7a06ebc5aa8).(void) {
513 DMFCBasecxx . . $ DMFCBase.->OnPLRIntervalcxx . . $ IDMFC#OnPLRInterval(49f6e7a06ebc5aa8).();
514
515 int TeamCol = 35;
516 int NameCol = 190;
517 int KillsCol = 330;
518 int DeathsCol = 380;
519 int SuicidesCol = 430;
520 int y = 40;
521 int slot;
522 player_recordcxx . . $ player_record# *pr;
523
524 DLLgrtext_SetFont((DMFCBasecxx . . $ DMFCBase.->GetGameFontTranslateArraycxx . . $ IDMFC#GetGameFontTranslateArray(a7741f82f5fc3640).())[SMALL_UI_FONT_INDEXcxx . . $ `Descent3/gamefont.h:99:9`!]);
525 int height = DLLgrfont_GetHeight((DMFCBasecxx . . $ DMFCBase.->GetGameFontTranslateArraycxx . . $ IDMFC#GetGameFontTranslateArray(a7741f82f5fc3640).())[SMALL_UI_FONT_INDEXcxx . . $ `Descent3/gamefont.h:99:9`!]) + 1;
526
527 // print out header
528 DLLgrtext_SetColor(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 150));
529 DLLgrtext_Printf(NameCol, y, TXT_PILOTcxx . . $ `netgames/tanarchy/tanarchystr.h:53:9`!);
530 DLLgrtext_Printf(KillsCol, y, TXT_KILLScxx . . $ `netgames/tanarchy/tanarchystr.h:54:9`!);
531 DLLgrtext_Printf(DeathsCol, y, TXT_DEATHScxx . . $ `netgames/tanarchy/tanarchystr.h:55:9`!);
532 DLLgrtext_Printf(SuicidesCol, y, TXT_SUICIDEScxx . . $ `netgames/tanarchy/tanarchystr.h:56:9`!);
533 y += height;
534 bool has_members;
535 bool doing_connected = true;
536
537 do_disconnected_folk:
538
539 for (int team = 0; team < NUM_TEAMScxx . . $ `netgames/tanarchy/tanarchy.cpp:89:9`!; team++) {
540 // process this team
541 bool show_team_label;
542 show_team_label = false;
543
544 if (!doing_connected) {
545 int temp_idx;
546 temp_idx = 0;
547
548 while (SortedPLRPlayerscxx . . $ SortedPLRPlayers.[team][temp_idx] != -1) {
549 int pnum = DMFCBasecxx . . $ DMFCBase.->WasPlayerInGameAtLevelEndcxx . . $ IDMFC#WasPlayerInGameAtLevelEnd(7864480464b09eea).(SortedPLRPlayerscxx . . $ SortedPLRPlayers.[team][temp_idx]);
550 if (pnum == -1) {
551 show_team_label = true;
552 break;
553 }
554 temp_idx++;
555 }
556 } else {
557 show_team_label = true;
558 }
559
560 if (show_team_label) {
561 // is there anyone on this team?
562 DLLgrtext_SetColor(DMFCBasecxx . . $ DMFCBase.->GetTeamColorcxx . . $ IDMFC#GetTeamColor(46cc46841198e427).(team));
563 DLLgrtext_Printf(TeamCol, y, TXT_TEAMSCOREcxx . . $ `netgames/tanarchy/tanarchystr.h:49:9`!, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team), TeamScorecxx . . $ TeamScore.[team]);
564 }
565 has_members = false;
566
567 for (int index = 0; index < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; index++) {
568 // get the player num
569 slot = SortedPLRPlayerscxx . . $ SortedPLRPlayers.[team][index];
570 if (slot == -1) // we are done with this team
571 break;
572 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(slot);
573 if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) {
574
575 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
576 continue; // dedicated server
577
578 int pnum = DMFCBasecxx . . $ DMFCBase.->WasPlayerInGameAtLevelEndcxx . . $ IDMFC#WasPlayerInGameAtLevelEnd(7864480464b09eea).(slot);
579
580 if ((doing_connected && pnum == -1) || (!doing_connected && pnum != -1))
581 continue; // we're not handling them right now
582
583 if (pnum != -1) {
584 DLLgrtext_SetColor(DMFCBasecxx . . $ DMFCBase.->GetTeamColorcxx . . $ IDMFC#GetTeamColor(46cc46841198e427).(team));
585 } else {
586 DLLgrtext_SetColor(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(128, 128, 128));
587 }
588
589 // valid player
590 DLLgrtext_Printf(NameCol, y, "%s %d[%d]", pr->callsigncxx . . $ player_record#callsign.,
591 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`!],
592 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`!]);
593 DLLgrtext_Printf(KillsCol, 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`!]);
594 DLLgrtext_Printf(DeathsCol, 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`!]);
595 DLLgrtext_Printf(SuicidesCol, y, "%d[%d]", pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!],
596 pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
597 y += height;
598 has_members = true;
599
600 if (y >= 440)
601 goto quick_exit;
602 }
603 } // end for
604 // on to the next team
605 if (!has_members)
606 y += height;
607
608 if (y >= 440)
609 goto quick_exit;
610
611 } // end for
612
613 if (doing_connected) {
614 doing_connected = false;
615 goto do_disconnected_folk;
616 }
617
618 quick_exit:;
619 }
620
621 void SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(char *filename) {
622 CFILEcxx . . $ CFILE# *file;
623 DLLOpenCFILE(&file, filenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "wt");
624 if (!file) {
625 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "Unable to open output file\n");
626 return;
627 }
628
629 // write out game stats
630 #define BUFSIZEcxx . . $ `netgames/tanarchy/tanarchy.cpp:630:9`! 150
631 char buffer[BUFSIZEcxx . . $ `netgames/tanarchy/tanarchy.cpp:630:9`!];
632 char tempbuffer[25];
633 int sortedslots[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!];
634 player_recordcxx . . $ player_record# *pr, *dpr;
635 tPInfoStatcxx . . $ tPInfoStat# stat;
636 int count, p;
637
638 // sort the stats
639 DMFCBasecxx . . $ DMFCBase.->GetSortedPlayerSlotscxx . . $ IDMFC#GetSortedPlayerSlots(621ccea12ecf5b06).(sortedslots, MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!);
640 count = 1;
641
642 snprintf(buffer, sizeof(buffer), TXT_SAVESTATSAcxx . . $ `netgames/tanarchy/tanarchystr.h:61:9`!, (DMFCBasecxx . . $ DMFCBase.->GetNetgameInfocxx . . $ IDMFC#GetNetgameInfo(242e78cd5130aa12).())->namecxx . . $ netgame_info#name.,
643 (DMFCBasecxx . . $ DMFCBase.->GetCurrentMissioncxx . . $ IDMFC#GetCurrentMission(d7a4f7ca6f9cb411).())->cur_levelcxx . . $ tMission#cur_level.);
644 DLLcf_WriteString(file, buffer);
645
646 for (p = 0; p < NUM_TEAMScxx . . $ `netgames/tanarchy/tanarchy.cpp:89:9`!; p++) {
647 int team_i = SortedTeamscxx . . $ SortedTeams.[p];
648 memset(buffer, ' ', BUFSIZEcxx . . $ `netgames/tanarchy/tanarchy.cpp:630:9`!);
649 snprintf(tempbuffer, sizeof(tempbuffer), TXT_TEAMcxx . . $ `netgames/tanarchy/tanarchystr.h:48:9`!, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team_i));
650 memcpy(&buffer[0], tempbuffer, strlen(tempbuffer));
651 snprintf(tempbuffer, sizeof(tempbuffer), "[%d]", TeamScorecxx . . $ TeamScore.[team_i]);
652 memcpy(&buffer[20], tempbuffer, strlen(tempbuffer));
653 buffer[20 + strlen(tempbuffer)] = '\0';
654 DLLcf_WriteString(file, buffer);
655 }
656
657 // Write team members
658 DLLcf_WriteString(file, ""); // blank line
659 for (int t = 0; t < NUM_TEAMScxx . . $ `netgames/tanarchy/tanarchy.cpp:89:9`!; t++) {
660 int team_i = SortedTeamscxx . . $ SortedTeams.[t];
661
662 snprintf(buffer, sizeof(buffer), TXT_TEAMcxx . . $ `netgames/tanarchy/tanarchystr.h:48:9`!, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team_i));
663 strncat(buffer, ":", sizeof(buffer) - strlen(buffer) - 1);
664 DLLcf_WriteString(file, buffer);
665
666 for (p = 0; p < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; p++) {
667 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(sortedslots[p]);
668 if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) {
669
670 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
671 continue; // skip dedicated server
672
673 if (pr->teamcxx . . $ player_record#team. == team_i) { // Check if current team
674 snprintf(buffer, sizeof(buffer), " %s", pr->callsigncxx . . $ player_record#callsign.);
675 DLLcf_WriteString(file, buffer);
676 }
677 }
678 }
679 }
680 DLLcf_WriteString(file, ""); // blank line
681
682 snprintf(buffer, sizeof(buffer), "%s", TXT_SAVESTATSBcxx . . $ `netgames/tanarchy/tanarchystr.h:62:9`!);
683 DLLcf_WriteString(file, buffer);
684
685 snprintf(buffer, sizeof(buffer), "%s", TXT_SAVESTATSCcxx . . $ `netgames/tanarchy/tanarchystr.h:63:9`!);
686 DLLcf_WriteString(file, buffer);
687 strcpy(buffer, "-----------------------------------------------------------------------------");
688 DLLcf_WriteString(file, buffer);
689
690 for (p = 0; p < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; p++) {
691 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(sortedslots[p]);
692 if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) {
693
694 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
695 continue; // skip dedicated server
696
697 memset(buffer, ' ', BUFSIZEcxx . . $ `netgames/tanarchy/tanarchy.cpp:630:9`!);
698
699 snprintf(tempbuffer, sizeof(tempbuffer), "%d)", count);
700 memcpy(&buffer[0], tempbuffer, strlen(tempbuffer));
701
702 snprintf(tempbuffer, sizeof(tempbuffer), "%s%s", (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) ? "" : "*", pr->callsigncxx . . $ player_record#callsign.);
703 memcpy(&buffer[5], tempbuffer, strlen(tempbuffer));
704
705 snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]",
706 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`!],
707 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`!]);
708 memcpy(&buffer[34], tempbuffer, strlen(tempbuffer));
709
710 snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!],
711 pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
712 memcpy(&buffer[46], tempbuffer, strlen(tempbuffer));
713
714 snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!],
715 pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
716 memcpy(&buffer[58], tempbuffer, strlen(tempbuffer));
717
718 snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!],
719 pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]);
720 memcpy(&buffer[69], tempbuffer, strlen(tempbuffer));
721
722 size_t pos = 69 + strlen(tempbuffer) + 1;
723 if (pos < BUFSIZEcxx . . $ `netgames/tanarchy/tanarchy.cpp:630:9`!)
724 buffer[pos] = '\0';
725
726 buffer[BUFSIZEcxx . . $ `netgames/tanarchy/tanarchy.cpp:630:9`! - 1] = '\0';
727 DLLcf_WriteString(file, buffer);
728 count++;
729 }
730 }
731
732 DLLcf_WriteString(file, TXT_SAVESTATSDcxx . . $ `netgames/tanarchy/tanarchystr.h:64:9`!);
733
734 count = 1;
735 for (p = 0; p < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; p++) {
736 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(p);
737 if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) {
738
739 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
740 continue; // skip dedicated server
741
742 // Write out header
743 snprintf(buffer, sizeof(buffer), "%d) %s%s", count, (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) ? "" : "*", pr->callsigncxx . . $ player_record#callsign.);
744 DLLcf_WriteString(file, buffer);
745 size_t length = strlen(buffer);
746 memset(buffer, '=', length);
747 buffer[length] = '\0';
748 DLLcf_WriteString(file, buffer);
749
750 // time in game
751 snprintf(buffer, sizeof(buffer), TXT_TIMEINGAMEcxx . . $ `netgames/tanarchy/tanarchystr.h:65:9`!, DMFCBasecxx . . $ DMFCBase.->GetTimeStringcxx . . $ IDMFC#GetTimeString(3b344d7a46e3c2ff).(DMFCBasecxx . . $ DMFCBase.->GetTimeInGamecxx . . $ IDMFC#GetTimeInGame(5cde91ea12d43f46).(p)));
752 DLLcf_WriteString(file, buffer);
753
754 if (DMFCBasecxx . . $ DMFCBase.->FindPInfoStatFirstcxx . . $ IDMFC#FindPInfoStatFirst(e8124cb919632806).(p, &stat)) {
755 snprintf(buffer, sizeof(buffer), "%s", TXT_SAVESTATSEcxx . . $ `netgames/tanarchy/tanarchystr.h:66:9`!);
756 DLLcf_WriteString(file, buffer);
757
758 if (stat.slotcxx . . $ tPInfoStat#slot. != p) {
759 memset(buffer, ' ', BUFSIZEcxx . . $ `netgames/tanarchy/tanarchy.cpp:630:9`!);
760 dpr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(stat.slotcxx . . $ tPInfoStat#slot.);
761
762 if (dpr) {
763 snprintf(tempbuffer, sizeof(tempbuffer), "%s", dpr->callsigncxx . . $ player_record#callsign.);
764 memcpy(buffer, tempbuffer, strlen(tempbuffer));
765
766 snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.killscxx . . $ tPInfoStat#kills.);
767 memcpy(&buffer[30], tempbuffer, strlen(tempbuffer));
768
769 snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.deathscxx . . $ tPInfoStat#deaths.);
770 memcpy(&buffer[40], tempbuffer, strlen(tempbuffer));
771
772 size_t pos = 40 + strlen(tempbuffer) + 1;
773 if (pos < BUFSIZEcxx . . $ `netgames/tanarchy/tanarchy.cpp:630:9`!)
774 buffer[pos] = '\0';
775
776 buffer[BUFSIZEcxx . . $ `netgames/tanarchy/tanarchy.cpp:630:9`! - 1] = '\0';
777 DLLcf_WriteString(file, buffer);
778 }
779 }
780
781 while (DMFCBasecxx . . $ DMFCBase.->FindPInfoStatNextcxx . . $ IDMFC#FindPInfoStatNext(4ead3766c292904).(&stat)) {
782 if (stat.slotcxx . . $ tPInfoStat#slot. != p) {
783 memset(buffer, ' ', BUFSIZEcxx . . $ `netgames/tanarchy/tanarchy.cpp:630:9`!);
784 dpr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(stat.slotcxx . . $ tPInfoStat#slot.);
785
786 if (dpr) {
787 snprintf(tempbuffer, sizeof(tempbuffer), "%s", dpr->callsigncxx . . $ player_record#callsign.);
788 memcpy(buffer, tempbuffer, strlen(tempbuffer));
789
790 snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.killscxx . . $ tPInfoStat#kills.);
791 memcpy(&buffer[30], tempbuffer, strlen(tempbuffer));
792
793 snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.deathscxx . . $ tPInfoStat#deaths.);
794 memcpy(&buffer[40], tempbuffer, strlen(tempbuffer));
795
796 size_t pos = 40 + strlen(tempbuffer) + 1;
797 if (pos < BUFSIZEcxx . . $ `netgames/tanarchy/tanarchy.cpp:630:9`!)
798 buffer[pos] = '\0';
799
800 buffer[BUFSIZEcxx . . $ `netgames/tanarchy/tanarchy.cpp:630:9`! - 1] = '\0';
801 DLLcf_WriteString(file, buffer);
802 }
803 }
804 }
805 }
806 DMFCBasecxx . . $ DMFCBase.->FindPInfoStatClosecxx . . $ IDMFC#FindPInfoStatClose(49f6e7a06ebc5aa8).();
807 DLLcf_WriteString(file, ""); // skip a line
808 count++;
809 }
810 }
811
812 // done writing stats
813 DLLcfclose(file);
814 DLLAddHUDMessage(TXT_STATSSAVEDcxx . . $ `netgames/tanarchy/tanarchystr.h:67:9`!);
815 }
816
817 #define ROOTFILENAMEcxx . . $ `netgames/tanarchy/tanarchy.cpp:817:9`! "Team Anarchy"
818 void OnSaveStatsToFilecxx . . $ OnSaveStatsToFile(49f6e7a06ebc5aa8).(void) {
819 char filename[256];
820 DMFCBasecxx . . $ DMFCBase.->GenerateStatFilenamecxx . . $ IDMFC#GenerateStatFilename(4d4dad76095ad7d8).(filename, ROOTFILENAMEcxx . . $ `netgames/tanarchy/tanarchy.cpp:817:9`!, false);
821 SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(filename);
822 }
823
824 void OnLevelEndSaveStatsToFilecxx . . $ OnLevelEndSaveStatsToFile(49f6e7a06ebc5aa8).(void) {
825 char filename[256];
826 DMFCBasecxx . . $ DMFCBase.->GenerateStatFilenamecxx . . $ IDMFC#GenerateStatFilename(4d4dad76095ad7d8).(filename, ROOTFILENAMEcxx . . $ `netgames/tanarchy/tanarchy.cpp:817:9`!, true);
827 SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(filename);
828 }
829
830 void OnDisconnectSaveStatsToFilecxx . . $ OnDisconnectSaveStatsToFile(49f6e7a06ebc5aa8).(void) {
831 char filename[256];
832 DMFCBasecxx . . $ DMFCBase.->GenerateStatFilenamecxx . . $ IDMFC#GenerateStatFilename(4d4dad76095ad7d8).(filename, ROOTFILENAMEcxx . . $ `netgames/tanarchy/tanarchy.cpp:817:9`!, false);
833 SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(filename);
834 }
835
836 // Handles when we get a new player packet
837 void GetGameStartPacketcxx . . $ GetGameStartPacket(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) {
838 // get the team scores
839 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "Receiving Team Scores from server\n");
840 int count = 0, i;
841 for (i = 0; i < NUM_TEAMScxx . . $ `netgames/tanarchy/tanarchy.cpp:89:9`!; i++) {
842 TeamScorecxx . . $ TeamScore.[i] = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count);
843 }
844 }
845
846 // Handles sending a new player packet
847 void SendGameStartPacketcxx . . $ SendGameStartPacket(d4f767463ce0a6b3).(int pnum) {
848 int count = 0;
849 uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!];
850
851 DMFCBasecxx . . $ DMFCBase.->StartPacketcxx . . $ IDMFC#StartPacket(261852a8f74abaa0).(data, SPID_NEWPLAYERcxx . . $ `netgames/tanarchy/tanarchy.cpp:88:9`!, &count);
852
853 // add the team scores
854 int i;
855 for (i = 0; i < NUM_TEAMScxx . . $ `netgames/tanarchy/tanarchy.cpp:89:9`!; i++) {
856 MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(TeamScorecxx . . $ TeamScore.[i], data, &count);
857 }
858
859 // we're done
860 DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "Sending Team Scores to %s\n", dPlayers[pnum].callsign);
861 DMFCBasecxx . . $ DMFCBase.->SendPacketcxx . . $ IDMFC#SendPacket(49a5bbab55ea8abc).(data, count, pnum);
862 }
863
864 void DisplayHUDScorescxx . . $ DisplayHUDScores(c7a20e4e05358911).(struct tHUDItemcxx . . $ tHUDItem# *hitem) {
865 if (display_my_welcomecxx . . $ display_my_welcome.) {
866 DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).());
867 display_my_welcomecxx . . $ display_my_welcome. = false;
868 }
869
870 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.)
871 return;
872
873 int height = DLLgrfont_GetHeight((DMFCBasecxx . . $ DMFCBase.->GetGameFontTranslateArraycxx . . $ IDMFC#GetGameFontTranslateArray(a7741f82f5fc3640).())[HUD_FONT_INDEXcxx . . $ `Descent3/gamefont.h:97:9`!]) + 3;
874 int y = (DMFCBasecxx . . $ DMFCBase.->GetGameWindowHcxx . . $ IDMFC#GetGameWindowH(b126dc7c1de90089).() / 2) - ((height * NUM_TEAMScxx . . $ `netgames/tanarchy/tanarchy.cpp:89:9`!) / 2);
875 int x = 520;
876 uint8_tcxx . . $ uint8_t# alpha = DMFCBasecxx . . $ DMFCBase.->ConvertHUDAlphacxx . . $ IDMFC#ConvertHUDAlpha(50106d451684defa).((uint8_tcxx . . $ uint8_t#)((DisplayScoreScreencxx . . $ DisplayScoreScreen.) ? 128 : 255));
877 int team;
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 = 100.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 team = DMFCBasecxx . . $ DMFCBase.->GetMyTeamcxx . . $ IDMFC#GetMyTeam(b126dc7c1de90089).();
890 DLLRenderHUDText(DMFCBasecxx . . $ DMFCBase.->GetTeamColorcxx . . $ IDMFC#GetTeamColor(46cc46841198e427).(team), 255, 0, x, 0, TXT_TEAMcxx . . $ `netgames/tanarchy/tanarchystr.h:48:9`!, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team));
891 int num_players = 0;
892
893 for (int i = 0; i < NUM_TEAMScxx . . $ `netgames/tanarchy/tanarchy.cpp:89:9`!; i++) {
894 team = SortedTeamscxx . . $ SortedTeams.[i];
895 num_players = 0;
896
897 for (int q = 0; q < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; q++) {
898 if (DMFCBasecxx . . $ DMFCBase.->CheckPlayerNumcxx . . $ IDMFC#CheckPlayerNum(83c267b20bac841a).(q) && dPlayerscxx . . $ dPlayers.[q].teamcxx . . $ player#team. == team && !DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(83c267b20bac841a).(q))
899 num_players++;
900 }
901
902 if (team == DMFCBasecxx . . $ DMFCBase.->GetMyTeamcxx . . $ IDMFC#GetMyTeam(b126dc7c1de90089).()) {
903 if (Highlight_bmpcxx . . $ Highlight_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) {
904 // draw the highlite bar in the background
905 DLLrend_SetAlphaValue(alpha * 0.50f);
906 DLLrend_SetAlphaValue(alpha);
907 DLLrend_SetZBufferState(0);
908 DLLrend_SetTextureType(TT_LINEARcxx . . $ TT_LINEAR.);
909 DLLrend_SetLighting(LS_NONEcxx . . $ LS_NONE.);
910 DLLrend_SetAlphaType(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!);
911
912 DLLrend_DrawScaledBitmap(name_x - 2, y - 2, score_x + score_width + 2, y + height - 1, Highlight_bmpcxx . . $ Highlight_bmp., 0, 0, 1,
913 1, 1.0, -1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
914 DLLrend_SetZBufferState(1);
915 }
916 }
917
918 char team_name[MAX_TEAMNAME_LENcxx . . $ `netgames/includes/DMFC.h:443:9`! + 5];
919 snprintf(team_name, sizeof(team_name), "[%d]%s", num_players, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team));
920 DMFCBasecxx . . $ DMFCBase.->ClipStringcxx . . $ IDMFC#ClipString(8677479218165cd4).(name_width, team_name, true);
921
922 DLLgrtext_SetAlpha(alpha);
923 DLLgrtext_SetColor(DMFCBasecxx . . $ DMFCBase.->GetTeamColorcxx . . $ IDMFC#GetTeamColor(46cc46841198e427).(team));
924 DLLgrtext_Printf(name_x, y, team_name);
925 DLLgrtext_Printf(score_x, y, "%d", TeamScorecxx . . $ TeamScore.[team]);
926
927 // sprintf(name,TXT_TEAMSCORE,DMFCBase->GetTeamString(team));
928 // DMFCBase->ClipString(name_width,name,true);
929
930 y += height;
931 }
932 }
933
934 // insert sort
935 #define compGTcxx . . $ `netgames/tanarchy/tanarchy.cpp:935:9`!(a, b) (a < b)
936 void SortTeamScorescxx . . $ SortTeamScores(ce8f7825f8908cfa).(int *sortedindex, int *scores) {
937 int t;
938 int i, j;
939
940 // copy scores into scoreinfo array
941 for (i = 0; i < NUM_TEAMScxx . . $ `netgames/tanarchy/tanarchy.cpp:89:9`!; i++) {
942 sortedindex[i] = i;
943 }
944
945 for (i = 1; i <= NUM_TEAMScxx . . $ `netgames/tanarchy/tanarchy.cpp:89:9`! - 1; i++) {
946 t = sortedindex[i];
947
948 /* Shift elements down until */
949 /* insertion point found. */
950 for (j = i - 1; j >= 0 && compGTcxx . . $ `netgames/tanarchy/tanarchy.cpp:935:9`!(scores[sortedindex[j]], scores[t]); j--) {
951 sortedindex[j + 1] = sortedindex[j];
952 }
953
954 /* insert */
955 sortedindex[j + 1] = t;
956 }
957 }
958
959 void DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(int player_num) {
960 char name_buffer[64];
961 strcpy(name_buffer, (DMFCBasecxx . . $ DMFCBase.->GetPlayerscxx . . $ IDMFC#GetPlayers(51ff8e716a252304).())[player_num].callsigncxx . . $ player#callsign.);
962
963 if (player_num == DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()) {
964 int team = DMFCBasecxx . . $ DMFCBase.->GetMyTeamcxx . . $ IDMFC#GetMyTeam(b126dc7c1de90089).();
965 if (team == -1)
966 return;
967
968 DLLAddHUDMessage(TXT_WELCOMEcxx . . $ `netgames/tanarchy/tanarchystr.h:50:9`!, name_buffer);
969 DLLAddColoredHUDMessage(DMFCBasecxx . . $ DMFCBase.->GetTeamColorcxx . . $ IDMFC#GetTeamColor(46cc46841198e427).(team), TXT_TEAMJOINMSGcxx . . $ `netgames/tanarchy/tanarchystr.h:51:9`!, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team));
970 } else {
971 int team = dPlayerscxx . . $ dPlayers.[player_num].teamcxx . . $ player#team.;
972 if (team == -1)
973 return;
974
975 DLLAddColoredHUDMessage(DMFCBasecxx . . $ DMFCBase.->GetTeamColorcxx . . $ IDMFC#GetTeamColor(46cc46841198e427).(team), TXT_JOINEDcxx . . $ `netgames/tanarchy/tanarchystr.h:52:9`!, name_buffer, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team));
976 }
977 }
978
979 void OnPrintScorescxx . . $ OnPrintScores(d4f767463ce0a6b3).(int level) {
980 char buffer[256];
981 char name[70];
982 size_t t;
983 size_t pos[6];
984 size_t len[6];
985
986 for (int i = 0; i < NUM_TEAMScxx . . $ `netgames/tanarchy/tanarchy.cpp:89:9`!; i++) {
987 snprintf(buffer, sizeof(buffer), "%s:%d\n", DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(i), TeamScorecxx . . $ TeamScore.[i]);
988 DPrintf(buffer);
989 }
990
991 memset(buffer, ' ', 256);
992 pos[0] = 0;
993 t = len[0] = 30; // give ample room for pilot name
994 pos[1] = pos[0] + t + 1;
995 t = len[1] = strlen(TXT_POINTScxx . . $ `netgames/tanarchy/tanarchystr.h:57:9`!);
996 pos[2] = pos[1] + t + 1;
997 t = len[2] = strlen(TXT_KILLS_SHORTcxx . . $ `netgames/tanarchy/tanarchystr.h:69:9`!);
998 pos[3] = pos[2] + t + 1;
999 t = len[3] = strlen(TXT_DEATHS_SHORTcxx . . $ `netgames/tanarchy/tanarchystr.h:70:9`!);
1000 pos[4] = pos[3] + t + 1;
1001 t = len[4] = strlen(TXT_SUICIDES_SHORTcxx . . $ `netgames/tanarchy/tanarchystr.h:71:9`!);
1002 pos[5] = pos[4] + t + 1;
1003 t = len[5] = strlen(TXT_PINGcxx . . $ `netgames/tanarchy/tanarchystr.h:60:9`!);
1004
1005 memcpy(&buffer[pos[0]], TXT_PILOTcxx . . $ `netgames/tanarchy/tanarchystr.h:53:9`!, strlen(TXT_PILOTcxx . . $ `netgames/tanarchy/tanarchystr.h:53:9`!));
1006 memcpy(&buffer[pos[1]], TXT_POINTScxx . . $ `netgames/tanarchy/tanarchystr.h:57:9`!, len[1]);
1007 memcpy(&buffer[pos[2]], TXT_KILLS_SHORTcxx . . $ `netgames/tanarchy/tanarchystr.h:69:9`!, len[2]);
1008 memcpy(&buffer[pos[3]], TXT_DEATHS_SHORTcxx . . $ `netgames/tanarchy/tanarchystr.h:70:9`!, len[3]);
1009 memcpy(&buffer[pos[4]], TXT_SUICIDES_SHORTcxx . . $ `netgames/tanarchy/tanarchystr.h:71:9`!, len[4]);
1010 memcpy(&buffer[pos[5]], TXT_PINGcxx . . $ `netgames/tanarchy/tanarchystr.h:60:9`!, len[5]);
1011 buffer[pos[5] + len[5] + 1] = '\n';
1012 buffer[pos[5] + len[5] + 2] = '\0';
1013 DPrintf(buffer);
1014
1015 int slot;
1016 player_recordcxx . . $ player_record# *pr;
1017 int pcount;
1018
1019 if (level < 0 || level >= MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!)
1020 pcount = MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!;
1021 else
1022 pcount = level;
1023
1024 netplayercxx . . $ netplayer# *dNetPlayers = DMFCBasecxx . . $ DMFCBase.->GetNetPlayerscxx . . $ IDMFC#GetNetPlayers(d09959b2d64446dd).();
1025
1026 int sortedplayers[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!];
1027 DMFCBasecxx . . $ DMFCBase.->GetSortedPlayerSlotscxx . . $ IDMFC#GetSortedPlayerSlots(621ccea12ecf5b06).(sortedplayers, MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!);
1028
1029 for (int i = 0; i < pcount; i++) {
1030 slot = sortedplayers[i];
1031 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(slot);
1032 if ((pr) && (pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.)) {
1033
1034 if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr))
1035 continue; // skip dedicated server
1036
1037 snprintf(name, sizeof(name), "%s%s: %.8s", (pr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.) ? "*" : "", pr->callsigncxx . . $ player_record#callsign.,
1038 DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(pr->teamcxx . . $ player_record#team.));
1039 name[29] = '\0';
1040
1041 memset(buffer, ' ', 256);
1042 t = strlen(name);
1043 memcpy(&buffer[pos[0]], name, (t < len[0]) ? t : len[0]);
1044 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`!]);
1045 t = strlen(name);
1046 memcpy(&buffer[pos[1]], name, (t < len[1]) ? t : len[1]);
1047 snprintf(name, sizeof(name), "%d", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
1048 t = strlen(name);
1049 memcpy(&buffer[pos[2]], name, (t < len[2]) ? t : len[2]);
1050 snprintf(name, sizeof(name), "%d", pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
1051 t = strlen(name);
1052 memcpy(&buffer[pos[3]], name, (t < len[3]) ? t : len[3]);
1053 snprintf(name, sizeof(name), "%d", pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
1054 t = strlen(name);
1055 memcpy(&buffer[pos[4]], name, (t < len[4]) ? t : len[4]);
1056
1057 if (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.)
1058 snprintf(name, sizeof(name), "%.0f", dNetPlayers[pr->pnumcxx . . $ player_record#pnum.].ping_timecxx . . $ netplayer#ping_time. * 1000.0f);
1059 else
1060 strcpy(name, "---");
1061 t = strlen(name);
1062 memcpy(&buffer[pos[5]], name, (t < len[5]) ? t : len[5]);
1063 buffer[pos[5] + len[5] + 1] = '\n';
1064 buffer[pos[5] + len[5] + 2] = '\0';
1065 DPrintf(buffer);
1066 }
1067 }
1068 }