Debian Codegraph @

netgames/coop/coop.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/coop/coop.cpp $
21 * $Revision: 1.1.1.1 $
22 * $Date: 2003/08/26 03:56:42 $
23 * $Author: kevinb $
24 *
25 * Co-Op Play
26 *
27 * $Log: coop.cpp,v $
28 * Revision 1.1.1.1 2003/08/26 03:56:42 kevinb
29 * initial 1.5 import
30 *
31 *
32 * 23 10/21/99 9:27p Jeff
33 * B.A. Macintosh code merge
34 *
35 * 22 7/12/99 1:17p Jeff
36 * added netgame flag NF_COOP
37 *
38 * 21 5/23/99 3:04a Jason
39 * fixed bug with player rankings not being updated correctly
40 *
41 * 20 5/19/99 3:53p Jeff
42 * fixed possible (???) bug with displaying hud names
43 *
44 * 19 5/12/99 11:04p Jeff
45 * dmfc and multiplayer games now have endian friendly packets (*whew*)
46 *
47 * 18 5/09/99 6:20a Jeff
48 * improved Entropy (added sounds, max virii per room). Fixed rendering
49 * bugs for other multiplayer dlls.
50 *
51 * 17 5/07/99 12:52p Jeff
52 * audio taunt icon is ppic if available. coop has hard max team set of 4
53 *
54 * 16 5/02/99 8:39a Jeff
55 * made quick & dirty PLR for coop
56 *
57 * 15 4/23/99 6:15p Jeff
58 * fixed double calls to GameClose
59 *
60 * 14 4/23/99 12:43p Jeff
61 * forgot to call CloseGame
62 *
63 * 13 4/21/99 5:34p Jeff
64 * added requirements
65 *
66 * 12 4/19/99 6:07p Jeff
67 * compile for Linux
68 *
69 * 11 3/27/99 4:53p Jeff
70 * player rankings in multiplayer games implemented. Fixed join message
71 * so it doesn't get cut off
72 *
73 * 10 3/19/99 12:54p Jeff
74 * base support for requesting the number of teams for a multiplayer game
75 *
76 * 9 3/18/99 8:40p Jeff
77 * hi res font fixes
78 *
79 * 8 3/17/99 12:23p Jeff
80 * converted DMFC to be COM interface
81 *
82 * 7 3/01/99 4:17p Jeff
83 * added net flag whether buddy bot allowed
84 *
85 * 6 2/11/99 3:09p Jeff
86 * localized
87 *
88 * 5 2/11/99 12:49a Jeff
89 * changed names of exported variables
90 *
91 * 3 2/07/99 2:06a Jeff
92 * updated coop...fixed bug when getting countermeasure owner, if owner is
93 * observer
94 *
95 * 2 2/03/99 7:22p Jeff
96 *
97 * 1 2/03/99 7:19p Jeff
98 *
99 * $NoKeywords: $
100 */
101
102 #include <string.h>
103 #include <stdio.h>
104 #include <stdlib.h>
105 #include "idmfc.h"cxx . . $ `<file>/netgames/includes/idmfc.h`/
106 #include "coop.h"cxx . . $ `<file>/netgames/coop/coop.h`/
107 #include "coopstr.h"cxx . . $ `<file>/netgames/coop/coopstr.h`/
108
109 #include <algorithm>
110
111 IDMFCcxx . . $ IDMFC# *DMFCBasecxx . . $ DMFCBase. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
112 static IDmfcStatscxx . . $ IDmfcStats# *dstatcxx . . $ dstat. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
113 static playercxx . . $ player# *dPlayerscxx . . $ dPlayers.;
114
115 struct tPlayerStatcxx . . $ tPlayerStat# {
116 int Scorecxx . . $ tPlayerStat#Score.[2];
117 };
118
119 static int pack_pstatcxx . . $ pack_pstat(60b9885aab282f36).(tPlayerStatcxx . . $ tPlayerStat# *user_info, uint8_tcxx . . $ uint8_t# *data);
120 static int unpack_pstatcxx . . $ unpack_pstat(60b9885aab282f36).(tPlayerStatcxx . . $ tPlayerStat# *user_info, uint8_tcxx . . $ uint8_t# *data);
121
122 int pack_pstatcxx . . $ pack_pstat(60b9885aab282f36).(tPlayerStatcxx . . $ tPlayerStat# *user_info, uint8_tcxx . . $ uint8_t# *data) {
123 int count = 0;
124 MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(user_info->Scorecxx . . $ tPlayerStat#Score.[0], data, &count);
125 MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(user_info->Scorecxx . . $ tPlayerStat#Score.[1], data, &count);
126 return count;
127 }
128
129 int unpack_pstatcxx . . $ unpack_pstat(60b9885aab282f36).(tPlayerStatcxx . . $ tPlayerStat# *user_info, uint8_tcxx . . $ uint8_t# *data) {
130 int count = 0;
131 user_info->Scorecxx . . $ tPlayerStat#Score.[0] = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count);
132 user_info->Scorecxx . . $ tPlayerStat#Score.[1] = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count);
133 return count;
134 }
135
136 ///////////////////////////////////////////////
137 // localization info
138 static char **StringTablecxx . . $ StringTable.;
139 static int StringTableSizecxx . . $ StringTableSize. = 0;
140 static const char *_ErrorStringcxx . . $ _ErrorString. = "Missing String";
141 const char *GetStringFromTablecxx . . $ GetStringFromTable(f7ae7e56280f18ae).(int d) {
142 if ((d < 0) || (d >= StringTableSizecxx . . $ StringTableSize.))
143 return _ErrorStringcxx . . $ _ErrorString.;
144 else
145 return StringTablecxx . . $ StringTable.[d];
146 }
147 ///////////////////////////////////////////////
148 static int SortedPlayerscxx . . $ SortedPlayers.[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!];
149 static bool DisplayScoreScreencxx . . $ DisplayScoreScreen. = false;
150 static bool FirstFramecxx . . $ FirstFrame. = false;
151 static bool display_my_welcomecxx . . $ display_my_welcome. = false;
152
153 static void DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(int player_num);
154 static void DisplayHUDScorescxx . . $ DisplayHUDScores(c7a20e4e05358911).(struct tHUDItemcxx . . $ tHUDItem# *hitem);
155 static void DetermineScorecxx . . $ DetermineScore(74c02bb7c84e7fae).(int precord_num, int column_num, char *buffer, int buffer_size);
156 static bool compare_slotscxx . . $ compare_slots(cf9ef193275fa6d8).(int a, int b);
157 static int Highlight_bmpcxx . . $ Highlight_bmp. = -1;
158
159 static void OnPLRIntervalcxx . . $ OnPLRInterval(49f6e7a06ebc5aa8).(void);
160 static void OnPLRInitcxx . . $ OnPLRInit(49f6e7a06ebc5aa8).(void);
161
162 void DetermineScorecxx . . $ DetermineScore(74c02bb7c84e7fae).(int precord_num, int column_num, char *buffer, int buffer_size) {
163 player_recordcxx . . $ player_record# *pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(precord_num);
164 if (!pr || pr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.) {
165 buffer[0] = '\0';
166 return;
167 }
168 tPlayerStatcxx . . $ tPlayerStat# *stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.;
169
170 snprintf(buffer, buffer_size, "%d", stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
171 }
172
173 // This function gets called by the game when it wants to learn some info about the game
174 void DLLFUNCCALLcxx . . $ `lib/module.h:93:10`! DLLGetGameInfocxx . . $ DLLGetGameInfo(e5c6dce1fbda187a).(tDLLOptionscxx . . $ tDLLOptions# *options) {
175 options->flagscxx . . $ tDLLOptions#flags. = DOF_MAXTEAMScxx . . $ `netgames/includes/gamedll_header.h:105:9`!;
176 options->max_teamscxx . . $ tDLLOptions#max_teams. = 1;
177 strcpy(options->game_namecxx . . $ tDLLOptions#game_name., TXT_COOPcxx . . $ `netgames/coop/coopstr.h:31:9`!);
178 strcpy(options->requirementscxx . . $ tDLLOptions#requirements., "COOP");
179 }
180
181 // Initializes the game function pointers
182 void DLLFUNCCALLcxx . . $ `lib/module.h:93:10`! DLLGameInitcxx . . $ DLLGameInit(937c1f75cb8fa6b1).(int *api_func, uint8_tcxx . . $ uint8_t# *all_ok, int num_teams_to_use) {
183 *all_ok = 1;
184 DMFCBasecxx . . $ DMFCBase. = CreateDMFC();
185 if (!DMFCBasecxx . . $ DMFCBase.) {
186 *all_ok = 0;
187 return;
188 }
189
190 dstatcxx . . $ dstat. = CreateDmfcStats();
191 if (!dstatcxx . . $ dstat.) {
192 *all_ok = 0;
193 return;
194 }
195
196 DMFCBasecxx . . $ DMFCBase.->LoadFunctionscxx . . $ IDMFC#LoadFunctions(11b0e290e57a7e53).(api_func);
197
198 // Setup event handlers
199 DMFCBasecxx . . $ DMFCBase.->Set_OnHUDIntervalcxx . . $ IDMFC#Set_OnHUDInterval(964b12a25712bdc3).(OnHUDIntervalcxx . . $ OnHUDInterval(49f6e7a06ebc5aa8).);
200 DMFCBasecxx . . $ DMFCBase.->Set_OnIntervalcxx . . $ IDMFC#Set_OnInterval(964b12a25712bdc3).(OnIntervalcxx . . $ OnInterval(49f6e7a06ebc5aa8).);
201 DMFCBasecxx . . $ DMFCBase.->Set_OnKeypresscxx . . $ IDMFC#Set_OnKeypress(94eb4457dc8d4d10).(OnKeypresscxx . . $ OnKeypress(d4f767463ce0a6b3).);
202 DMFCBasecxx . . $ DMFCBase.->Set_OnClientPlayerEntersGamecxx . . $ IDMFC#Set_OnClientPlayerEntersGame(94eb4457dc8d4d10).(OnClientPlayerEntersGamecxx . . $ OnClientPlayerEntersGame(d4f767463ce0a6b3).);
203 DMFCBasecxx . . $ DMFCBase.->Set_OnServerObjectKilledcxx . . $ IDMFC#Set_OnServerObjectKilled(74ea2c9f51d3637e).(OnServerObjectKilledcxx . . $ OnServerObjectKilled(6273fa812ac58a8).);
204 DMFCBasecxx . . $ DMFCBase.->Set_OnClientObjectKilledcxx . . $ IDMFC#Set_OnClientObjectKilled(74ea2c9f51d3637e).(OnClientObjectKilledcxx . . $ OnClientObjectKilled(6273fa812ac58a8).);
205 DMFCBasecxx . . $ DMFCBase.->Set_OnPlayerConnectcxx . . $ IDMFC#Set_OnPlayerConnect(94eb4457dc8d4d10).(OnPlayerConnectcxx . . $ OnPlayerConnect(d4f767463ce0a6b3).);
206 DMFCBasecxx . . $ DMFCBase.->Set_OnServerGameCreatedcxx . . $ IDMFC#Set_OnServerGameCreated(964b12a25712bdc3).(OnServerGameCreatedcxx . . $ OnServerGameCreated(49f6e7a06ebc5aa8).);
207 DMFCBasecxx . . $ DMFCBase.->Set_OnClientLevelStartcxx . . $ IDMFC#Set_OnClientLevelStart(964b12a25712bdc3).(OnClientLevelStartcxx . . $ OnClientLevelStart(49f6e7a06ebc5aa8).);
208 DMFCBasecxx . . $ DMFCBase.->Set_OnGameStateRequestcxx . . $ IDMFC#Set_OnGameStateRequest(94eb4457dc8d4d10).(OnGameStateRequestcxx . . $ OnGameStateRequest(d4f767463ce0a6b3).);
209 DMFCBasecxx . . $ DMFCBase.->Set_OnSaveStatsToFilecxx . . $ IDMFC#Set_OnSaveStatsToFile(964b12a25712bdc3).(OnSaveStatsToFilecxx . . $ OnSaveStatsToFile(49f6e7a06ebc5aa8).);
210 DMFCBasecxx . . $ DMFCBase.->Set_OnLevelEndSaveStatsToFilecxx . . $ IDMFC#Set_OnLevelEndSaveStatsToFile(964b12a25712bdc3).(OnLevelEndSaveStatsToFilecxx . . $ OnLevelEndSaveStatsToFile(49f6e7a06ebc5aa8).);
211 DMFCBasecxx . . $ DMFCBase.->Set_OnDisconnectSaveStatsToFilecxx . . $ IDMFC#Set_OnDisconnectSaveStatsToFile(964b12a25712bdc3).(OnDisconnectSaveStatsToFilecxx . . $ OnDisconnectSaveStatsToFile(49f6e7a06ebc5aa8).);
212 DMFCBasecxx . . $ DMFCBase.->Set_OnPrintScorescxx . . $ IDMFC#Set_OnPrintScores(94eb4457dc8d4d10).(OnPrintScorescxx . . $ OnPrintScores(d4f767463ce0a6b3).);
213 DMFCBasecxx . . $ DMFCBase.->Set_OnPLRIntervalcxx . . $ IDMFC#Set_OnPLRInterval(964b12a25712bdc3).(OnPLRIntervalcxx . . $ OnPLRInterval(49f6e7a06ebc5aa8).);
214 DMFCBasecxx . . $ DMFCBase.->Set_OnPLRInitcxx . . $ IDMFC#Set_OnPLRInit(964b12a25712bdc3).(OnPLRInitcxx . . $ OnPLRInit(49f6e7a06ebc5aa8).);
215
216 dPlayerscxx . . $ dPlayers. = DMFCBasecxx . . $ DMFCBase.->GetPlayerscxx . . $ IDMFC#GetPlayers(51ff8e716a252304).();
217
218 DLLCreateStringTable("Coop.str", &StringTablecxx . . $ StringTable., &StringTableSizecxx . . $ StringTableSize.);
219 mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "%d strings loaded from string table\n", StringTableSize);
220 if (!StringTableSizecxx . . $ StringTableSize.) {
221 *all_ok = 0;
222 return;
223 }
224
225 DMFCBasecxx . . $ DMFCBase.->GameInitcxx . . $ IDMFC#GameInit(d4f767463ce0a6b3).(1);
226
227 Highlight_bmpcxx . . $ Highlight_bmp. = DLLbm_AllocBitmap(32, 32, 0);
228 if (Highlight_bmpcxx . . $ Highlight_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) {
229 uint16_tcxx . . $ uint16_t# *data = DLLbm_data(Highlight_bmpcxx . . $ Highlight_bmp., 0);
230 if (!data) {
231 // bail on out of here
232 *all_ok = 0;
233 return;
234 }
235 for (int x = 0; x < 32 * 32; x++) {
236 data[x] = GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(50, 50, 50) | OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`!;
237 }
238 }
239
240 DMFCBasecxx . . $ DMFCBase.->AddHUDItemCallbackcxx . . $ IDMFC#AddHUDItemCallback(97c9b33f56b4265c).(HI_TEXTcxx . . $ `netgames/includes/DMFC.h:440:9`!, DisplayHUDScorescxx . . $ DisplayHUDScores(c7a20e4e05358911).);
241 DMFCBasecxx . . $ DMFCBase.->SetupPlayerRecordcxx . . $ IDMFC#SetupPlayerRecord(7df49e8a00e47932).(sizeof(tPlayerStatcxx . . $ tPlayerStat#), (int (*)(void *, uint8_tcxx . . $ uint8_t# *))pack_pstatcxx . . $ pack_pstat(60b9885aab282f36).,
242 (int (*)(void *, uint8_tcxx . . $ uint8_t# *))unpack_pstatcxx . . $ unpack_pstat(60b9885aab282f36).);
243 DMFCBasecxx . . $ DMFCBase.->SetNumberOfTeamscxx . . $ IDMFC#SetNumberOfTeams(d4f767463ce0a6b3).(1);
244
245 netgame_infocxx . . $ netgame_info# *netgameinfo = DMFCBasecxx . . $ DMFCBase.->GetNetgameInfocxx . . $ IDMFC#GetNetgameInfo(242e78cd5130aa12).();
246 netgameinfo->flagscxx . . $ netgame_info#flags. |= (NF_USE_ROBOTScxx . . $ `Descent3/multi_external.h:228:9`! | NF_RESPAWN_WAYPOINTcxx . . $ `Descent3/multi_external.h:240:9`! | NF_ALLOWGUIDEBOTcxx . . $ `Descent3/multi_external.h:232:9`! | NF_COOPcxx . . $ `Descent3/multi_external.h:244:9`!);
247 netgameinfo->max_playerscxx . . $ netgame_info#max_players. = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(4, netgameinfo->max_playerscxx . . $ netgame_info#max_players.);
248 DMFCBasecxx . . $ DMFCBase.->SetMaxPlayerHardLimitcxx . . $ IDMFC#SetMaxPlayerHardLimit(d4f767463ce0a6b3).(4);
249
250 // Initialize the Stats Manager
251 // ----------------------------
252 tDmfcStatsInitcxx . . $ tDmfcStatsInit# tsi;
253 tDmfcStatsColumnInfocxx . . $ tDmfcStatsColumnInfo# pl_col[5];
254 char gname[20];
255 strcpy(gname, TXT_STATGAMENAMEcxx . . $ `netgames/coop/coopstr.h:32:9`!);
256
257 tsi.flagscxx . . $ tDmfcStatsInit#flags. = DSIF_SHOW_PICcxx . . $ `netgames/includes/DMFC.h:619:9`! | DSIF_SHOW_OBSERVERICONcxx . . $ `netgames/includes/DMFC.h:627:9`! | DSIF_NOLASTKILLERcxx . . $ `netgames/includes/DMFC.h:630:9`! | DSIF_NOLASTVICTIMcxx . . $ `netgames/includes/DMFC.h:631:9`! | DSIF_NODETAILEDINFOcxx . . $ `netgames/includes/DMFC.h:632:9`! |
258 DSIF_SHOWPLAYERVIEWcxx . . $ `netgames/includes/DMFC.h:633:9`!;
259 tsi.cColumnCountDetailedcxx . . $ tDmfcStatsInit#cColumnCountDetailed. = 0;
260 tsi.cColumnCountPlayerListcxx . . $ tDmfcStatsInit#cColumnCountPlayerList. = 5;
261 tsi.clbDetailedColumncxx . . $ tDmfcStatsInit#clbDetailedColumn. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
262 tsi.clbDetailedColumnBMPcxx . . $ tDmfcStatsInit#clbDetailedColumnBMP. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
263 tsi.clbPlayerColumncxx . . $ tDmfcStatsInit#clbPlayerColumn. = DetermineScorecxx . . $ DetermineScore(74c02bb7c84e7fae).;
264 tsi.clbPlayerColumnBMPcxx . . $ tDmfcStatsInit#clbPlayerColumnBMP. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
265 tsi.DetailedColumnscxx . . $ tDmfcStatsInit#DetailedColumns. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
266 tsi.GameNamecxx . . $ tDmfcStatsInit#GameName. = gname;
267 tsi.MaxNumberDisplayedcxx . . $ tDmfcStatsInit#MaxNumberDisplayed. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
268 tsi.PlayerListColumnscxx . . $ tDmfcStatsInit#PlayerListColumns. = pl_col;
269 tsi.SortedPlayerRecordscxx . . $ tDmfcStatsInit#SortedPlayerRecords. = SortedPlayerscxx . . $ SortedPlayers.;
270
271 pl_col[0].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_SHIPCOLORcxx . . $ DSCOLOR_SHIPCOLOR.;
272 strcpy(pl_col[0].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_PILOTcxx . . $ `netgames/coop/coopstr.h:33:9`!);
273 pl_col[0].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_PILOT_NAMEcxx . . $ DSCOL_PILOT_NAME.;
274 pl_col[0].widthcxx . . $ tDmfcStatsColumnInfo#width. = 84;
275
276 pl_col[1].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_SHIPCOLORcxx . . $ DSCOLOR_SHIPCOLOR.;
277 strcpy(pl_col[1].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_KILLScxx . . $ `netgames/coop/coopstr.h:34:9`!);
278 pl_col[1].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_CUSTOMcxx . . $ DSCOL_CUSTOM.;
279 pl_col[1].widthcxx . . $ tDmfcStatsColumnInfo#width. = 51;
280
281 pl_col[2].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_SHIPCOLORcxx . . $ DSCOLOR_SHIPCOLOR.;
282 strcpy(pl_col[2].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_DEATHScxx . . $ `netgames/coop/coopstr.h:35:9`!);
283 pl_col[2].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_DEATHS_LEVELcxx . . $ DSCOL_DEATHS_LEVEL.;
284 pl_col[2].widthcxx . . $ tDmfcStatsColumnInfo#width. = 64;
285
286 pl_col[3].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_SHIPCOLORcxx . . $ DSCOLOR_SHIPCOLOR.;
287 strcpy(pl_col[3].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_SUICIDEScxx . . $ `netgames/coop/coopstr.h:36:9`!);
288 pl_col[3].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_SUICIDES_LEVELcxx . . $ DSCOL_SUICIDES_LEVEL.;
289 pl_col[3].widthcxx . . $ tDmfcStatsColumnInfo#width. = 69;
290
291 pl_col[4].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_SHIPCOLORcxx . . $ DSCOLOR_SHIPCOLOR.;
292 strcpy(pl_col[4].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_PINGcxx . . $ `netgames/coop/coopstr.h:37:9`!);
293 pl_col[4].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_PINGcxx . . $ DSCOL_PING.;
294 pl_col[4].widthcxx . . $ tDmfcStatsColumnInfo#width. = 40;
295
296 dstatcxx . . $ dstat.->Initializecxx . . $ IDmfcStats#Initialize(645910a8ad01b658).(&tsi);
297 }
298 // Called when the DLL is shutdown
299 void DLLFUNCCALLcxx . . $ `lib/module.h:93:10`! DLLGameClosecxx . . $ DLLGameClose(49f6e7a06ebc5aa8).() {
300 if (Highlight_bmpcxx . . $ Highlight_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!)
301 DLLbm_FreeBitmap(Highlight_bmpcxx . . $ Highlight_bmp.);
302
303 DLLDestroyStringTable(StringTablecxx . . $ StringTable., StringTableSizecxx . . $ StringTableSize.);
304
305 if (dstatcxx . . $ dstat.) {
306 dstatcxx . . $ dstat.->DestroyPointercxx . . $ IObject#DestroyPointer(49f6e7a06ebc5aa8).();
307 dstatcxx . . $ dstat. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
308 }
309
310 if (DMFCBasecxx . . $ DMFCBase.) {
311 DMFCBasecxx . . $ DMFCBase.->GameClosecxx . . $ IDMFC#GameClose(49f6e7a06ebc5aa8).();
312 DMFCBasecxx . . $ DMFCBase.->DestroyPointercxx . . $ IObject#DestroyPointer(49f6e7a06ebc5aa8).();
313 DMFCBasecxx . . $ DMFCBase. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
314 }
315 }
316
317 void OnHUDIntervalcxx . . $ OnHUDInterval(49f6e7a06ebc5aa8).(void) {
318 dstatcxx . . $ dstat.->DoFramecxx . . $ IDmfcStats#DoFrame(49f6e7a06ebc5aa8).();
319 DMFCBasecxx . . $ DMFCBase.->DisplayOutrageLogocxx . . $ IDMFC#DisplayOutrageLogo(49f6e7a06ebc5aa8).();
320 DMFCBasecxx . . $ DMFCBase.->OnHUDIntervalcxx . . $ IDMFC#OnHUDInterval(49f6e7a06ebc5aa8).();
321 }
322
323 bool compare_slotscxx . . $ compare_slots(cf9ef193275fa6d8).(int a, int b) {
324 int ascore, bscore;
325 player_recordcxx . . $ player_record# *apr, *bpr;
326 tPlayerStatcxx . . $ tPlayerStat# *astat, *bstat;
327
328 apr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(a);
329 bpr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(b);
330 if (!apr)
331 return true;
332 if (!bpr)
333 return false;
334 if (apr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.)
335 return true;
336 if (bpr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.)
337 return false;
338 astat = (tPlayerStatcxx . . $ tPlayerStat# *)apr->user_infocxx . . $ player_record#user_info.;
339 bstat = (tPlayerStatcxx . . $ tPlayerStat# *)bpr->user_infocxx . . $ player_record#user_info.;
340
341 if ((apr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) && (bpr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.)) {
342 // both players were in the game
343 ascore = (astat) ? astat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0;
344 bscore = (bstat) ? bstat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0;
345 return (ascore < bscore);
346 }
347 if ((apr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) && (bpr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.)) {
348 // apr gets priority since he was in the game on exit
349 return false;
350 }
351 if ((apr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.) && (bpr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.)) {
352 // bpr gets priority since he was in the game on exit
353 return true;
354 }
355 // if we got here then both players were disconnected
356 ascore = (astat) ? astat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0;
357 bscore = (bstat) ? bstat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0;
358 return (ascore < bscore);
359 }
360
361 void OnIntervalcxx . . $ OnInterval(49f6e7a06ebc5aa8).(void) {
362 // sort players
363 int i, t, j;
364
365 for (i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) {
366 SortedPlayerscxx . . $ SortedPlayers.[i] = i;
367 }
368
369 for (i = 1; i <= MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`! - 1; i++) {
370 t = SortedPlayerscxx . . $ SortedPlayers.[i];
371 // Shift elements down until
372 // insertion point found.
373 for (j = i - 1; j >= 0 && compare_slotscxx . . $ compare_slots(cf9ef193275fa6d8).(SortedPlayerscxx . . $ SortedPlayers.[j], t); j--) {
374 SortedPlayerscxx . . $ SortedPlayers.[j + 1] = SortedPlayerscxx . . $ SortedPlayers.[j];
375 }
376 // insert
377 SortedPlayerscxx . . $ SortedPlayers.[j + 1] = t;
378 }
379
380 FirstFramecxx . . $ FirstFrame. = true;
381 DMFCBasecxx . . $ DMFCBase.->OnIntervalcxx . . $ IDMFC#OnInterval(49f6e7a06ebc5aa8).();
382 }
383
384 void OnKeypresscxx . . $ OnKeypress(d4f767463ce0a6b3).(int key) {
385 dllinfocxx . . $ dllinfo# *Data = DMFCBasecxx . . $ DMFCBase.->GetDLLInfoCallDatacxx . . $ IDMFC#GetDLLInfoCallData(4458c5bdce97a5c3).();
386
387 switch (key) {
388 case K_F7cxx . . $ `netgames/includes/DMFCKeyCodes.h:118:9`!:
389 DisplayScoreScreencxx . . $ DisplayScoreScreen. = !DisplayScoreScreencxx . . $ DisplayScoreScreen.;
390 DMFCBasecxx . . $ DMFCBase.->EnableOnScreenMenucxx . . $ IDMFC#EnableOnScreenMenu(b45ddcbc8423892c).(false);
391 dstatcxx . . $ dstat.->Enablecxx . . $ IDmfcStats#Enable(b45ddcbc8423892c).(DisplayScoreScreencxx . . $ DisplayScoreScreen.);
392 break;
393 case K_PAGEDOWNcxx . . $ `netgames/includes/DMFCKeyCodes.h:147:9`!:
394 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.) {
395 dstatcxx . . $ dstat.->ScrollDowncxx . . $ IDmfcStats#ScrollDown(49f6e7a06ebc5aa8).();
396 Data->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1;
397 }
398 break;
399 case K_PAGEUPcxx . . $ `netgames/includes/DMFCKeyCodes.h:144:9`!:
400 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.) {
401 dstatcxx . . $ dstat.->ScrollUpcxx . . $ IDmfcStats#ScrollUp(49f6e7a06ebc5aa8).();
402 Data->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1;
403 }
404 break;
405 case K_F6cxx . . $ `netgames/includes/DMFCKeyCodes.h:117:9`!:
406 DisplayScoreScreencxx . . $ DisplayScoreScreen. = false;
407 dstatcxx . . $ dstat.->Enablecxx . . $ IDmfcStats#Enable(b45ddcbc8423892c).(false);
408 break;
409 case K_ESCcxx . . $ `netgames/includes/DMFCKeyCodes.h:97:9`!:
410 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.) {
411 dstatcxx . . $ dstat.->Enablecxx . . $ IDmfcStats#Enable(b45ddcbc8423892c).(false);
412 DisplayScoreScreencxx . . $ DisplayScoreScreen. = false;
413 Data->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1;
414 }
415 break;
416 }
417
418 DMFCBasecxx . . $ DMFCBase.->OnKeypresscxx . . $ IDMFC#OnKeypress(d4f767463ce0a6b3).(key);
419 }
420
421 void OnClientPlayerEntersGamecxx . . $ OnClientPlayerEntersGame(d4f767463ce0a6b3).(int player_num) {
422 if (player_num == DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()) {
423 FirstFramecxx . . $ FirstFrame. = false;
424 DisplayScoreScreencxx . . $ DisplayScoreScreen. = false;
425 }
426
427 DMFCBasecxx . . $ DMFCBase.->OnClientPlayerEntersGamecxx . . $ IDMFC#OnClientPlayerEntersGame(d4f767463ce0a6b3).(player_num);
428
429 if (player_num != DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).())
430 DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(player_num);
431 else
432 display_my_welcomecxx . . $ display_my_welcome. = true;
433 }
434
435 // A new player has entered the game, zero there stats out
436 void OnPlayerConnectcxx . . $ OnPlayerConnect(d4f767463ce0a6b3).(int player_num) {
437 DMFCBasecxx . . $ DMFCBase.->OnPlayerConnectcxx . . $ IDMFC#OnPlayerConnect(d4f767463ce0a6b3).(player_num);
438
439 tPlayerStatcxx . . $ tPlayerStat# *stat = (tPlayerStatcxx . . $ tPlayerStat# *)DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordDatacxx . . $ IDMFC#GetPlayerRecordData(d1680a912d714170).(player_num);
440 if (stat) {
441 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] = 0;
442 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!] = 0;
443 }
444 }
445
446 // The server has just started, so clear out all the stats and game info
447 void OnServerGameCreatedcxx . . $ OnServerGameCreated(49f6e7a06ebc5aa8).(void) {
448 DMFCBasecxx . . $ DMFCBase.->OnServerGameCreatedcxx . . $ IDMFC#OnServerGameCreated(49f6e7a06ebc5aa8).();
449 player_recordcxx . . $ player_record# *pr;
450 tPlayerStatcxx . . $ tPlayerStat# *stat;
451 for (int i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) {
452 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(i);
453 if (pr)
454 stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.;
455 else
456 stat = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
457 if (stat) {
458 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] = 0;
459 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!] = 0;
460 }
461 }
462 }
463
464 // The server has started a new level, so clear out level scores
465 void OnClientLevelStartcxx . . $ OnClientLevelStart(49f6e7a06ebc5aa8).(void) {
466 DMFCBasecxx . . $ DMFCBase.->OnClientLevelStartcxx . . $ IDMFC#OnClientLevelStart(49f6e7a06ebc5aa8).();
467 player_recordcxx . . $ player_record# *pr;
468 tPlayerStatcxx . . $ tPlayerStat# *stat;
469 for (int i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) {
470 pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(i);
471 if (pr)
472 stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.;
473 else
474 stat = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
475
476 if (stat) {
477 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] = 0;
478 }
479 }
480 DMFCBasecxx . . $ DMFCBase.->RequestGameStatecxx . . $ IDMFC#RequestGameState(49f6e7a06ebc5aa8).();
481 }
482
483 // We need to send all the inventory info out to the new player
484 void OnGameStateRequestcxx . . $ OnGameStateRequest(d4f767463ce0a6b3).(int player_num) { DMFCBasecxx . . $ DMFCBase.->OnGameStateRequestcxx . . $ IDMFC#OnGameStateRequest(d4f767463ce0a6b3).(player_num); }
485
486 void DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(int player_num) {
487 char name_buffer[64];
488 strcpy(name_buffer, (DMFCBasecxx . . $ DMFCBase.->GetPlayerscxx . . $ IDMFC#GetPlayers(51ff8e716a252304).())[player_num].callsigncxx . . $ player#callsign.);
489
490 if (player_num == DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()) {
491 DLLAddHUDMessage(TXT_WELCOMEcxx . . $ `netgames/coop/coopstr.h:38:9`!, name_buffer);
492 } else {
493 DLLAddHUDMessage(TXT_JOINEDcxx . . $ `netgames/coop/coopstr.h:39:9`!, name_buffer);
494 }
495 }
496
497 void OnServerObjectKilledcxx . . $ OnServerObjectKilled(6273fa812ac58a8).(objectcxx . . $ object# *obj, objectcxx . . $ object# *killer) {
498 if (!killer)
499 return; // can't handle this
500
501 if (obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || (obj->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`! && obj->ai_infocxx . . $ object#ai_info.)) {
502
503 // check to see if the killer is a player
504 bool ok_to_call = false;
505
506 if (killer->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) {
507 ok_to_call = true;
508 } else if (killer->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`!) {
509 if (DMFCBasecxx . . $ DMFCBase.->GetCounterMeasureOwnercxx . . $ IDMFC#GetCounterMeasureOwner(2da2a862cad4c994).(killer) != -1) {
510 ok_to_call = true;
511 }
512 }
513
514 if (ok_to_call) {
515 DMFCBasecxx . . $ DMFCBase.->CallClientEventcxx . . $ IDMFC#CallClientEvent(d7a7761809021567).(EVT_CLIENT_GAMEOBJKILLEDcxx . . $ `lib/d3events.h:124:9`!, DMFCBasecxx . . $ DMFCBase.->GetMeObjNumcxx . . $ IDMFC#GetMeObjNum(b126dc7c1de90089).(), DMFCBasecxx . . $ DMFCBase.->GetItObjNumcxx . . $ IDMFC#GetItObjNum(b126dc7c1de90089).(), -1);
516 DMFCBasecxx . . $ DMFCBase.->CallOnClientObjectKilledcxx . . $ IDMFC#CallOnClientObjectKilled(6273fa812ac58a8).(obj, killer);
517 }
518 }
519
520 DMFCBasecxx . . $ DMFCBase.->OnServerObjectKilledcxx . . $ IDMFC#OnServerObjectKilled(6273fa812ac58a8).(obj, killer);
521 }
522
523 void OnClientObjectKilledcxx . . $ OnClientObjectKilled(6273fa812ac58a8).(objectcxx . . $ object# *obj, objectcxx . . $ object# *killer) {
524 objectcxx . . $ object# *parent;
525 DLLGetUltimateParentForObject(&parent, killer);
526
527 if ((parent->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) && (parent->typecxx . . $ object#type. != OBJ_OBSERVERcxx . . $ `Descent3/object_external.h:182:9`!)) {
528 mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "Robot killed wasn't by a OBJ_PLAYER or OBJ_OBSERVER (%d)\n", parent->type);
529 return;
530 }
531
532 int killer_pnum = parent->idcxx . . $ object#id.;
533
534 player_recordcxx . . $ player_record# *pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordByPnumcxx . . $ IDMFC#GetPlayerRecordByPnum(6359c6f28dd028ae).(killer_pnum);
535 if (!pr) {
536 mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "Invalid player record!\n");
537 Int3cxx . . $ `netgames/includes/DMFC.h:378:9`!();
538 return;
539 }
540
541 tPlayerStatcxx . . $ tPlayerStat# *stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.;
542
543 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]++;
544 stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]++;
545
546 mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "%s's score is now %d\n", dPlayers[killer_pnum].callsign, stat->Score[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]);
547
548 DMFCBasecxx . . $ DMFCBase.->OnClientObjectKilledcxx . . $ IDMFC#OnClientObjectKilled(6273fa812ac58a8).(obj, killer);
549 }
550
551 void DisplayHUDScorescxx . . $ DisplayHUDScores(c7a20e4e05358911).(struct tHUDItemcxx . . $ tHUDItem# *hitem) {
552 if (!FirstFramecxx . . $ FirstFrame.)
553 return;
554
555 if (display_my_welcomecxx . . $ display_my_welcome.) {
556 DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).());
557 display_my_welcomecxx . . $ display_my_welcome. = false;
558 }
559
560 if (DisplayScoreScreencxx . . $ DisplayScoreScreen.)
561 return;
562
563 if (DMFCBasecxx . . $ DMFCBase.->IAmDedicatedServercxx . . $ IDMFC#IAmDedicatedServer(c9857a73d68e59ba).())
564 return;
565
566 int old_font = DLLgrtext_GetFont();
567 int start_y;
568 int i;
569
570 DLLgrtext_SetFont((DMFCBasecxx . . $ DMFCBase.->GetGameFontTranslateArraycxx . . $ IDMFC#GetGameFontTranslateArray(a7741f82f5fc3640).())[HUD_FONT_INDEXcxx . . $ `Descent3/gamefont.h:97:9`!]);
571 int height = DLLRenderHUDGetTextHeight("X") + 1;
572 int players_in_game = 0;
573
574 for (i = 0; i < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; i++) {
575 if (DMFCBasecxx . . $ DMFCBase.->CheckPlayerNumcxx . . $ IDMFC#CheckPlayerNum(83c267b20bac841a).(i) && !DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(83c267b20bac841a).(i)) {
576 players_in_game++;
577 }
578 }
579
580 if (players_in_game <= 0)
581 return;
582
583 players_in_game = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(players_in_game, 8);
584
585 start_y = (DMFCBasecxx . . $ DMFCBase.->GetGameWindowHcxx . . $ IDMFC#GetGameWindowH(b126dc7c1de90089).() / 2) - ((players_in_game * 5) / 2);
586 // determine coordinates to use here
587 // we'll use a virtual width of 85 pixels on a 640x480 screen
588 // so first determine the new width
589 int name_width = 85.0f * DMFCBasecxx . . $ DMFCBase.->GetHudAspectXcxx . . $ IDMFC#GetHudAspectX(9b8c9e39889c762c).();
590 int name_x = DMFCBasecxx . . $ DMFCBase.->GetGameWindowWcxx . . $ IDMFC#GetGameWindowW(b126dc7c1de90089).() - name_width - 10;
591
592 int pnum, index = 0;
593 uint8_tcxx . . $ uint8_t# alpha = DMFCBasecxx . . $ DMFCBase.->ConvertHUDAlphacxx . . $ IDMFC#ConvertHUDAlpha(50106d451684defa).((uint8_tcxx . . $ uint8_t#)((DisplayScoreScreencxx . . $ DisplayScoreScreen.) ? 128 : 255));
594
595 DLLgrtext_SetAlpha(alpha);
596 char name[64];
597
598 // Display only the players in the game
599 while ((players_in_game > 0) && (index < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!)) {
600 pnum = SortedPlayerscxx . . $ SortedPlayers.[index];
601
602 if (DMFCBasecxx . . $ DMFCBase.->CheckPlayerNumcxx . . $ IDMFC#CheckPlayerNum(83c267b20bac841a).(pnum) && !DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(83c267b20bac841a).(pnum)) {
603 // valid player
604 if (pnum == DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()) {
605 if (Highlight_bmpcxx . . $ Highlight_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) {
606 // draw the highlite bar in the background
607 DLLrend_SetAlphaValue(alpha * 0.50f);
608 DLLrend_SetZBufferState(0);
609 DLLrend_SetTextureType(TT_LINEARcxx . . $ TT_LINEAR.);
610 DLLrend_SetLighting(LS_NONEcxx . . $ LS_NONE.);
611 DLLrend_SetAlphaType(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!);
612
613 DLLrend_DrawScaledBitmap(name_x - 2, start_y - 2, DMFCBasecxx . . $ DMFCBase.->GetGameWindowWcxx . . $ IDMFC#GetGameWindowW(b126dc7c1de90089).() - 8, start_y + height + 1,
614 Highlight_bmpcxx . . $ Highlight_bmp., 0, 0, 1, 1, 1.0, -1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
615 DLLrend_SetZBufferState(1);
616 }
617 }
618
619 strcpy(name, dPlayerscxx . . $ dPlayers.[pnum].callsigncxx . . $ player#callsign.);
620 DMFCBasecxx . . $ DMFCBase.->ClipStringcxx . . $ IDMFC#ClipString(8677479218165cd4).(name_width, name, true);
621
622 DLLgrtext_SetColor((DMFCBasecxx . . $ DMFCBase.->GetPlayerColorscxx . . $ IDMFC#GetPlayerColors(ac695d451f96e4aa).())[pnum]);
623 DLLgrtext_Printf(name_x, start_y, name);
624
625 start_y += height;
626 players_in_game--;
627 }
628 index++;
629 }
630
631 DLLgrtext_SetFont(old_font);
632 }
633
634 void SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(char *filename) {
635 /*
636 CFILE *file;
637 DLLOpenCFILE(&file,filename,"wt");
638 if(!file){
639 mprintf(0,"Unable to open output file\n");
640 return;
641 }
642
643 //write out game stats
644 #define BUFSIZE 150
645 char buffer[BUFSIZE];
646 char tempbuffer[25];
647 int sortedslots[MAX_PLAYER_RECORDS];
648 player_record *pr,*dpr;
649 tPInfoStat stat;
650 int count,length,p;
651
652 count = 1;
653
654 sprintf(buffer,TXT_SAVE_HEADER,Netgame->name,Current_mission->cur_level);
655 DLLcf_WriteString(file,buffer);
656
657 sprintf(buffer,TXT_SAVE_HEADERB);
658 DLLcf_WriteString(file,buffer);
659 strcpy(buffer,"-----------------------------------------------------------------------------------");
660 DLLcf_WriteString(file,buffer);
661
662
663 tPlayerStat *st;
664 for(int s=0;s<MAX_PLAYER_RECORDS;s++){
665 p = SortedPlayers[s];
666 pr = GetPlayerRecord(p);
667 if( pr && pr->state!=STATE_EMPTY) {
668
669 if(IsPlayerDedicatedServer(pr))
670 continue; //skip dedicated server
671
672 st = (tPlayerStat *)pr->user_info;
673
674 memset(buffer,' ',BUFSIZE);
675
676 sprintf(tempbuffer,"%d)",count);
677 memcpy(&buffer[0],tempbuffer,strlen(tempbuffer));
678
679 sprintf(tempbuffer,"%s%s",(pr->state==STATE_INGAME)?"":"*",pr->callsign);
680 memcpy(&buffer[7],tempbuffer,strlen(tempbuffer));
681
682 sprintf(tempbuffer,"%d[%d]",st->Score[DSTAT_LEVEL],st->Score[DSTAT_OVERALL]);
683 memcpy(&buffer[36],tempbuffer,strlen(tempbuffer));
684
685 sprintf(tempbuffer,"%d[%d]",pr->dstats.deaths[DSTAT_LEVEL],pr->dstats.deaths[DSTAT_OVERALL]);
686 memcpy(&buffer[48],tempbuffer,strlen(tempbuffer));
687
688 sprintf(tempbuffer,"%d[%d]",pr->dstats.suicides[DSTAT_LEVEL],pr->dstats.suicides[DSTAT_OVERALL]);
689 memcpy(&buffer[60],tempbuffer,strlen(tempbuffer));
690
691 sprintf(tempbuffer,"%s",GetTimeString(GetTimeInGame(p)));
692 memcpy(&buffer[71],tempbuffer,strlen(tempbuffer));
693
694 int pos;
695 pos = 71 + strlen(tempbuffer) + 1;
696 if(pos<BUFSIZE)
697 buffer[pos] = '\0';
698
699 buffer[BUFSIZE-1] = '\0';
700 DLLcf_WriteString(file,buffer);
701 count++;
702 }
703 }
704
705 //done writing stats
706 DLLcfclose(file);
707 DLLAddHUDMessage(TXT_MSG_SAVESTATS);
708 */
709 }
710
711 #define ROOTFILENAMEcxx . . $ `netgames/coop/coop.cpp:711:9`! "D3Coop"
712 void OnSaveStatsToFilecxx . . $ OnSaveStatsToFile(49f6e7a06ebc5aa8).(void) {
713 char filename[256];
714 DMFCBasecxx . . $ DMFCBase.->GenerateStatFilenamecxx . . $ IDMFC#GenerateStatFilename(4d4dad76095ad7d8).(filename, ROOTFILENAMEcxx . . $ `netgames/coop/coop.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/coop/coop.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/coop/coop.cpp:711:9`!, false);
727 SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(filename);
728 }
729
730 void OnPrintScorescxx . . $ OnPrintScores(d4f767463ce0a6b3).(int level) {
731 /*
732 char buffer[256];
733 char name[50];
734 memset(buffer,' ',256);
735
736 int t;
737 int pos[5];
738 int len[5];
739 pos[0] = 0; t = len[0] = 20; //give ample room for pilot name
740 pos[1] = pos[0] + t + 1; t = len[1] = strlen(TXT_KILLS_SHORT);
741 pos[2] = pos[1] + t + 1; t = len[2] = strlen(TXT_DEATHS_SHORT);
742 pos[3] = pos[2] + t + 1; t = len[3] = strlen(TXT_SUICIDES_SHORT);
743 pos[4] = pos[3] + t + 1; t = len[4] = strlen(TXT_PING);
744
745 memcpy(&buffer[pos[0]],TXT_PILOT,strlen(TXT_PILOT));
746 memcpy(&buffer[pos[1]],TXT_KILLS_SHORT,len[1]);
747 memcpy(&buffer[pos[2]],TXT_DEATHS_SHORT,len[2]);
748 memcpy(&buffer[pos[3]],TXT_SUICIDES_SHORT,len[3]);
749 memcpy(&buffer[pos[4]],TXT_PING,len[4]);
750 buffer[pos[4]+len[4]+1] = '\n';
751 buffer[pos[4]+len[4]+2] = '\0';
752 DPrintf(buffer);
753
754 int slot;
755 player_record *pr;
756 int pcount;
757
758 if(level<0 || level>=MAX_PLAYER_RECORDS)
759 pcount = MAX_PLAYER_RECORDS;
760 else
761 pcount = level;
762
763 tPlayerStat *st;
764
765 for(int i=0;i<pcount;i++){
766 slot = SortedPlayers[i];
767 pr = GetPlayerRecord(slot);
768 if((pr)&&(pr->state!=STATE_EMPTY)){
769
770 if(IsPlayerDedicatedServer(pr))
771 continue; //skip dedicated server
772
773 st = (tPlayerStat *)pr->user_info;
774
775 sprintf(name,"%s%s:",(pr->state==STATE_DISCONNECTED)?"*":"",pr->callsign);
776 name[19] = '\0';
777
778 memset(buffer,' ',256);
779 t = strlen(name); memcpy(&buffer[pos[0]],name,(t<len[0])?t:len[0]);
780 sprintf(name,"%d",st->Score[DSTAT_LEVEL]);
781 t = strlen(name); memcpy(&buffer[pos[1]],name,(t<len[1])?t:len[1]);
782 sprintf(name,"%d",pr->dstats.deaths[DSTAT_LEVEL]);
783 t = strlen(name); memcpy(&buffer[pos[2]],name,(t<len[2])?t:len[2]);
784 sprintf(name,"%d",pr->dstats.suicides[DSTAT_LEVEL]);
785 t = strlen(name); memcpy(&buffer[pos[3]],name,(t<len[3])?t:len[3]);
786
787 if(pr->state==STATE_INGAME)
788 sprintf(name,"%.0f",NetPlayers[pr->pnum].ping_time*1000.0f);
789 else
790 strcpy(name,"---");
791 t = strlen(name); memcpy(&buffer[pos[4]],name,(t<len[4])?t:len[4]);
792 buffer[pos[4]+len[4]+1] = '\n';
793 buffer[pos[4]+len[4]+2] = '\0';
794 DPrintf(buffer);
795 }
796 }
797 */
798 }
799
800 static float PLRElapsedtimecxx . . $ PLRElapsedtime. = 0.0f;
801 static float PLRLasttimecxx . . $ PLRLasttime. = 0.0f;
802
803 void OnPLRInitcxx . . $ OnPLRInit(49f6e7a06ebc5aa8).(void) {
804 PLRElapsedtimecxx . . $ PLRElapsedtime. = 0.0f;
805 PLRLasttimecxx . . $ PLRLasttime. = DMFCBasecxx . . $ DMFCBase.->GetGametimecxx . . $ IDMFC#GetGametime(9b8c9e39889c762c).();
806 }
807
808 void OnPLRIntervalcxx . . $ OnPLRInterval(49f6e7a06ebc5aa8).(void) {
809 level_infocxx . . $ level_info# *li = DMFCBasecxx . . $ DMFCBase.->GetLevelInfocxx . . $ IDMFC#GetLevelInfo(9783071b1a9aeb74).();
810
811 int height = DLLgrfont_GetHeight((DMFCBasecxx . . $ DMFCBase.->GetGameFontTranslateArraycxx . . $ IDMFC#GetGameFontTranslateArray(a7741f82f5fc3640).())[BIG_FONT_INDEXcxx . . $ `Descent3/gamefont.h:96:9`!]);
812 DLLgrtext_SetFont((DMFCBasecxx . . $ DMFCBase.->GetGameFontTranslateArraycxx . . $ IDMFC#GetGameFontTranslateArray(a7741f82f5fc3640).())[BIG_FONT_INDEXcxx . . $ `Descent3/gamefont.h:96:9`!]);
813
814 int y = 240;
815
816 float ft, newtime;
817 newtime = DMFCBasecxx . . $ DMFCBase.->GetGametimecxx . . $ IDMFC#GetGametime(9b8c9e39889c762c).();
818 ft = newtime - PLRLasttimecxx . . $ PLRLasttime.;
819 PLRLasttimecxx . . $ PLRLasttime. = newtime;
820 PLRElapsedtimecxx . . $ PLRElapsedtime. += ft;
821
822 float alpha;
823
824 if (PLRElapsedtimecxx . . $ PLRElapsedtime. > 5.0f) {
825 alpha = 1.0f;
826 } else {
827 alpha = (5.0f - PLRElapsedtimecxx . . $ PLRElapsedtime.) / 5.0f;
828 }
829
830 DLLrend_ClearScreen(GR_BLACKcxx . . $ GR_BLACK.);
831 DLLgrtext_SetColor(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(40, 40, 255));
832 DLLgrtext_CenteredPrintf(0, y - height - 1, TXT_LEVELCOMPLETEcxx . . $ `netgames/coop/coopstr.h:40:9`!);
833
834 if (li) {
835 DLLgrtext_SetAlpha((uint8_tcxx . . $ uint8_t#)(alpha * 255.0f));
836 DLLgrtext_SetColor(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 255));
837 DLLgrtext_CenteredPrintf(0, y + 1, li->namecxx . . $ level_info#name.);
838 }
839
840 DLLgrtext_Flush();
841 }