| 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/dmfc/dmfcpackets.cpp $ |
| 21 |
* $Revision: 1.1.1.1 $ |
| 22 |
* $Date: 2003/08/26 03:57:21 $ |
| 23 |
* $Author: kevinb $ |
| 24 |
* |
| 25 |
* DMFC Special packet handling functions |
| 26 |
* |
| 27 |
* $Log: dmfcpackets.cpp,v $ |
| 28 |
* Revision 1.1.1.1 2003/08/26 03:57:21 kevinb |
| 29 |
* initial 1.5 import |
| 30 |
* |
| 31 |
* |
| 32 |
* 29 8/21/99 12:32a Jeff |
| 33 |
* Changed the name of the GetRealGametime function to |
| 34 |
* GetRealGametimePacket since it was confusing some compilers with the |
| 35 |
* other GetRealGametime function. |
| 36 |
* |
| 37 |
* 28 7/09/99 2:54p Jeff |
| 38 |
* handle gametime better (pause it when needed) if the server is 'waiting |
| 39 |
* for players' |
| 40 |
* |
| 41 |
* 27 7/08/99 6:25p Jeff |
| 42 |
* remote admin in and working |
| 43 |
* |
| 44 |
* 26 7/08/99 2:39a Jeff |
| 45 |
* rough implementation of remote administration checked in. Still needs |
| 46 |
* some polishing, but should work basically. |
| 47 |
* |
| 48 |
* 25 5/13/99 4:55p Ardussi |
| 49 |
* changes for compiling on the Mac |
| 50 |
* |
| 51 |
* 24 5/12/99 11:05p Jeff |
| 52 |
* dmfc and multiplayer games now have endian friendly packets (*whew*) |
| 53 |
* |
| 54 |
* 23 4/07/99 9:24p Jeff |
| 55 |
* fixed bug in sending team names over |
| 56 |
* |
| 57 |
* 22 3/17/99 12:24p Jeff |
| 58 |
* converted DMFC to be COM interface |
| 59 |
* |
| 60 |
* 21 2/11/99 12:51a Jeff |
| 61 |
* changed names of exported variables |
| 62 |
* |
| 63 |
* 20 12/08/98 4:47p Jeff |
| 64 |
* umm, various changes, fixed pilot pics so that they work for everyone |
| 65 |
* now |
| 66 |
* |
| 67 |
* 19 12/08/98 12:17p Jeff |
| 68 |
* various changes that include an improved Team Control dialog (doesn't |
| 69 |
* switch teams until exit..) and spew/respawn players that change teams |
| 70 |
* |
| 71 |
* 18 11/17/98 12:36p Jeff |
| 72 |
* fixed bug in sending new team name to clients |
| 73 |
* |
| 74 |
* 17 11/16/98 5:35p Jeff |
| 75 |
* removed log functions, added support for changing team names, fixed ctf |
| 76 |
* to work better with different team names |
| 77 |
* |
| 78 |
* 16 11/11/98 7:19p Jeff |
| 79 |
* changes made so that a dedicated server's team is always -1 (team game |
| 80 |
* or not) |
| 81 |
* |
| 82 |
* 15 10/29/98 7:01p Jeff |
| 83 |
* creation of team placement dialog. Moved TranslateEvent into DMFC |
| 84 |
* |
| 85 |
* 14 10/23/98 11:22a Jeff |
| 86 |
* changes to handle mixcase, and display the client netgame info |
| 87 |
* correctly |
| 88 |
* |
| 89 |
* 13 10/20/98 12:16p Jeff |
| 90 |
* added death message filter, hud callsign filter |
| 91 |
* |
| 92 |
* 12 10/08/98 3:37p Jeff |
| 93 |
* general improvements (Netgame info things, save to registry). Changes |
| 94 |
* so it would send packets on NETSEQ_OBJECTS |
| 95 |
* |
| 96 |
* 11 9/30/98 4:21p Jeff |
| 97 |
* team changing is handled correctly |
| 98 |
* |
| 99 |
* 10 9/25/98 8:02p Jason |
| 100 |
* added checks for jeff |
| 101 |
* |
| 102 |
* 9 9/21/98 7:11p Jeff |
| 103 |
* made InputCommand interface API and moved existing input commands to |
| 104 |
* the interface. Changed mprintf/ASSERT so they are valid in DMFC |
| 105 |
* |
| 106 |
* $NoKeywords: $ |
| 107 |
*/ |
| 108 |
|
| 109 |
#include "gamedll_header.h"cxx . . $ `<file>/netgames/includes/gamedll_header.h`/ |
| 110 |
#include "DMFC.h"cxx . . $ `<file>/netgames/includes/DMFC.h`/ |
| 111 |
#include "dmfcinternal.h"cxx . . $ `<file>/netgames/dmfc/dmfcinternal.h`/ |
| 112 |
|
| 113 |
|
| 114 |
// DMFCBase::RegisterPacketReceiver |
| 115 |
// |
| 116 |
// Sets up a handler for a Special Packet ID. When a special packet is recieved it's ID is compared |
| 117 |
// to the ID's given to this function. If any match than it calls the handler given to process |
| 118 |
// the packet. |
| 119 |
// id = ID of the packet |
| 120 |
// func = Function handler to handle the packet. Must be declared like void MyFunction(uint8_t *data); |
| 121 |
void DMFCBasecxx . . $ DMFCBase#::RegisterPacketReceivercxx . . $ DMFCBase#RegisterPacketReceiver(6efe5766e3bef270).(uint8_tcxx . . $ uint8_t# id, void (*func)(uint8_tcxx . . $ uint8_t# *)) { |
| 122 |
// go to the last handler |
| 123 |
tSPHandlercxx . . $ tSPHandler# *current, *last; |
| 124 |
|
| 125 |
if (!SPRootcxx . . $ DMFCBase#SPRoot.) { |
| 126 |
// handle special case for first node being added |
| 127 |
SPRootcxx . . $ DMFCBase#SPRoot. = (tSPHandlercxx . . $ tSPHandler# *)malloccxx . . $ malloc(9f008b2a9698428b).(sizeof(tSPHandlercxx . . $ tSPHandler#)); |
| 128 |
if (!SPRootcxx . . $ DMFCBase#SPRoot.) |
| 129 |
return; |
| 130 |
current = SPRootcxx . . $ DMFCBase#SPRoot.; |
| 131 |
} else { |
| 132 |
last = current = SPRootcxx . . $ DMFCBase#SPRoot.; |
| 133 |
while (current) { |
| 134 |
last = current; |
| 135 |
current = current->nextcxx . . $ tSPHandler#next.; |
| 136 |
} |
| 137 |
|
| 138 |
// allocate memory for the node |
| 139 |
current = (tSPHandlercxx . . $ tSPHandler# *)malloccxx . . $ malloc(9f008b2a9698428b).(sizeof(tSPHandlercxx . . $ tSPHandler#)); |
| 140 |
if (!current) |
| 141 |
return; |
| 142 |
// add it to the list |
| 143 |
last->nextcxx . . $ tSPHandler#next. = current; |
| 144 |
} |
| 145 |
|
| 146 |
// fill in the struct |
| 147 |
current->nextcxx . . $ tSPHandler#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 148 |
current->IDcxx . . $ tSPHandler#ID. = id; |
| 149 |
current->typecxx . . $ tSPHandler#type. = SPH_FUNCcxx . . $ `netgames/includes/DMFC.h:438:9`!; |
| 150 |
current->funccxx . . $ tSPHandler#func. = func; |
| 151 |
} |
| 152 |
void DMFCBasecxx . . $ DMFCBase#::RegisterPacketReceivercxx . . $ DMFCBase#RegisterPacketReceiver(9b94200667d08e70).(uint8_tcxx . . $ uint8_t# id, void (DMFCBasecxx . . $ DMFCBase#::*func)(uint8_tcxx . . $ uint8_t# *)) { |
| 153 |
// go to the last handler |
| 154 |
tSPHandlercxx . . $ tSPHandler# *current, *last; |
| 155 |
|
| 156 |
if (!SPRootcxx . . $ DMFCBase#SPRoot.) { |
| 157 |
// handle special case for first node being added |
| 158 |
SPRootcxx . . $ DMFCBase#SPRoot. = (tSPHandlercxx . . $ tSPHandler# *)malloccxx . . $ malloc(9f008b2a9698428b).(sizeof(tSPHandlercxx . . $ tSPHandler#)); |
| 159 |
if (!SPRootcxx . . $ DMFCBase#SPRoot.) |
| 160 |
return; |
| 161 |
current = SPRootcxx . . $ DMFCBase#SPRoot.; |
| 162 |
} else { |
| 163 |
last = current = SPRootcxx . . $ DMFCBase#SPRoot.; |
| 164 |
while (current) { |
| 165 |
last = current; |
| 166 |
current = current->nextcxx . . $ tSPHandler#next.; |
| 167 |
} |
| 168 |
|
| 169 |
// allocate memory for the node |
| 170 |
current = (tSPHandlercxx . . $ tSPHandler# *)malloccxx . . $ malloc(9f008b2a9698428b).(sizeof(tSPHandlercxx . . $ tSPHandler#)); |
| 171 |
if (!current) |
| 172 |
return; |
| 173 |
// add it to the list |
| 174 |
last->nextcxx . . $ tSPHandler#next. = current; |
| 175 |
} |
| 176 |
|
| 177 |
// fill in the struct |
| 178 |
current->nextcxx . . $ tSPHandler#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 179 |
current->IDcxx . . $ tSPHandler#ID. = id; |
| 180 |
current->typecxx . . $ tSPHandler#type. = SPH_DMFCFUNCcxx . . $ `netgames/includes/DMFC.h:437:9`!; |
| 181 |
current->DMFCfunccxx . . $ tSPHandler#DMFCfunc. = func; |
| 182 |
} |
| 183 |
|
| 184 |
// DMFCBase::StartPacket |
| 185 |
// |
| 186 |
// Initializes a packet so it is ready to be sent out. |
| 187 |
// data = pointer to buffer of data for packet. This buffer should be MAX_GAME_DATA_SIZE in size, even |
| 188 |
// if you don't plan on using all that data, there is header information that is added |
| 189 |
// in this function. |
| 190 |
// id = ID of the Special packet. When the packet is recieved by whomever, this is the ID that determines which |
| 191 |
// handler to |
| 192 |
// call. |
| 193 |
// count = pointer to your packet index pointer |
| 194 |
void DMFCBasecxx . . $ DMFCBase#::StartPacketcxx . . $ DMFCBase#StartPacket(261852a8f74abaa0).(uint8_tcxx . . $ uint8_t# *data, uint8_tcxx . . $ uint8_t# id, int *count) { |
| 195 |
*count = 0; |
| 196 |
|
| 197 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(id, data, count); // set the first byte (invisible to coder) as the id |
| 198 |
} |
| 199 |
|
| 200 |
// DMFCBase::SendPacket |
| 201 |
// |
| 202 |
// Ships a Special Packet away to the destination. This call must be preceeded by a StartPacket call |
| 203 |
// data = buffer of data to be sent out (same buffer that was passed to StartPacket |
| 204 |
// size = size (in bytes) of the packet |
| 205 |
// destination = either a player number, SP_ALL for all the players or SP_SERVER to send to the server (if you are a |
| 206 |
// client) |
| 207 |
void DMFCBasecxx . . $ DMFCBase#::SendPacketcxx . . $ DMFCBase#SendPacket(49a5bbab55ea8abc).(uint8_tcxx . . $ uint8_t# *data, int size, int destination) { |
| 208 |
ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(size < MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`! - 2); // allow for a header by the d3 |
| 209 |
if (size >= MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`! - 2) |
| 210 |
return; |
| 211 |
|
| 212 |
// if we are the server and are trying to send to the server then exit out |
| 213 |
if ((GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) && (destination == SP_SERVERcxx . . $ `netgames/includes/DMFC.h:436:9`!)) { |
| 214 |
return; |
| 215 |
} |
| 216 |
|
| 217 |
// we can safely send this packet out to it's appropriate destination |
| 218 |
|
| 219 |
// see if we are trying to send to the server, it's specially handled |
| 220 |
if (destination == SP_SERVERcxx . . $ `netgames/includes/DMFC.h:436:9`!) { |
| 221 |
DLLMultiClientSendSpecialPacket(data, size); |
| 222 |
return; |
| 223 |
} |
| 224 |
|
| 225 |
// server trying to send to clients |
| 226 |
if (GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() == LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`!) { |
| 227 |
// we can't send client to client |
| 228 |
return; |
| 229 |
} |
| 230 |
|
| 231 |
// if server is trying to send to all the clients then we need to send to each individual |
| 232 |
if (destination == SP_ALLcxx . . $ `netgames/includes/DMFC.h:435:9`!) { |
| 233 |
int pnum; |
| 234 |
for (pnum = 0; pnum < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; pnum++) { |
| 235 |
|
| 236 |
if ((pnum != GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).()) && (PacketCheckPlayerNumcxx . . $ DMFCBase#PacketCheckPlayerNum(83c267b20bac841a).(pnum))) { |
| 237 |
// ship it! |
| 238 |
DLLMultiSendSpecialPacket(pnum, data, size); |
| 239 |
} |
| 240 |
} |
| 241 |
return; |
| 242 |
} |
| 243 |
|
| 244 |
// we are only sending to one client |
| 245 |
if (destination != GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).()) |
| 246 |
DLLMultiSendSpecialPacket(destination, data, size); |
| 247 |
} |
| 248 |
|
| 249 |
// DMFCBase::GetGameStateRequest |
| 250 |
// |
| 251 |
// Receiver for the server from a client asking for the state of the game |
| 252 |
void DMFCBasecxx . . $ DMFCBase#::GetGameStateRequestcxx . . $ DMFCBase#GetGameStateRequest(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) { |
| 253 |
int pnum; |
| 254 |
int count = 0; |
| 255 |
pnum = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count); |
| 256 |
CallOnGameStateRequestcxx . . $ DMFCBase#CallOnGameStateRequest(d4f767463ce0a6b3).(pnum); |
| 257 |
} |
| 258 |
|
| 259 |
// DMFCBase::SendTeamAssignment |
| 260 |
// |
| 261 |
// A DMFC Special Packet function, this sends a team assignment packet to all the players. Server only. |
| 262 |
// playernum = player to change teams |
| 263 |
// team = new team |
| 264 |
void DMFCBasecxx . . $ DMFCBase#::SendTeamAssignmentcxx . . $ DMFCBase#SendTeamAssignment(6908015b96d379c0).(int playernum, int team, bool spew_onrespawn) { |
| 265 |
if (GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 266 |
return; |
| 267 |
|
| 268 |
uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 269 |
int count = 0; |
| 270 |
|
| 271 |
StartPacketcxx . . $ DMFCBase#StartPacket(261852a8f74abaa0).(data, SPID_TEAMASSIGNMENTcxx . . $ `netgames/dmfc/dmfcinternal.h:2760:9`!, &count); |
| 272 |
|
| 273 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).((spew_onrespawn) ? 1 : 0, data, &count); |
| 274 |
MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(playernum, data, &count); |
| 275 |
MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(team, data, &count); |
| 276 |
|
| 277 |
SendPacketcxx . . $ DMFCBase#SendPacket(49a5bbab55ea8abc).(data, count, SP_ALLcxx . . $ `netgames/includes/DMFC.h:435:9`!); |
| 278 |
} |
| 279 |
|
| 280 |
// DMFCBase::GetTeamAssignmentPacket |
| 281 |
// |
| 282 |
// Reciever for the team assignment packet. |
| 283 |
void DMFCBasecxx . . $ DMFCBase#::GetTeamAssignmentPacketcxx . . $ DMFCBase#GetTeamAssignmentPacket(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) { |
| 284 |
int count = 0; |
| 285 |
bool spew = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count) ? true : false; |
| 286 |
|
| 287 |
int pnum = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count); |
| 288 |
int team = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count); |
| 289 |
|
| 290 |
if (CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(pnum)) { |
| 291 |
Playerscxx . . $ DMFCBase#Players.[pnum].teamcxx . . $ player#team. = team; |
| 292 |
CallOnPlayerChangeTeamcxx . . $ DMFCBase#CallOnPlayerChangeTeam(23bb497e4fbd6c85).(pnum, team, true, spew); |
| 293 |
} |
| 294 |
} |
| 295 |
|
| 296 |
// DMFCBase::GetChangeTeamPacket |
| 297 |
// |
| 298 |
// Reciever for the change team packet.(Server Only) |
| 299 |
void DMFCBasecxx . . $ DMFCBase#::GetChangeTeamPacketcxx . . $ DMFCBase#GetChangeTeamPacket(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) { |
| 300 |
if (GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 301 |
return; |
| 302 |
// We recieved a request for a player to change teams |
| 303 |
|
| 304 |
int count = 0; |
| 305 |
|
| 306 |
bool spew_on_respawn = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count) ? true : false; |
| 307 |
int pnum = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count); |
| 308 |
int newteam = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count); |
| 309 |
if (newteam == 255) |
| 310 |
newteam = -1; |
| 311 |
|
| 312 |
if (!AllowTeamChangecxx . . $ DMFCBase#AllowTeamChange(c9857a73d68e59ba).()) { |
| 313 |
return; |
| 314 |
} |
| 315 |
|
| 316 |
if (!CallOnCanChangeTeamcxx . . $ DMFCBase#CallOnCanChangeTeam(cf9ef193275fa6d8).(pnum, newteam)) { |
| 317 |
return; |
| 318 |
} |
| 319 |
|
| 320 |
if (!CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(pnum)) |
| 321 |
return; |
| 322 |
|
| 323 |
if ((newteam < 0) || (newteam > m_iNumTeamscxx . . $ DMFCBase#m_iNumTeams.)) |
| 324 |
return; |
| 325 |
|
| 326 |
Playerscxx . . $ DMFCBase#Players.[pnum].teamcxx . . $ player#team. = newteam; |
| 327 |
CallOnPlayerChangeTeamcxx . . $ DMFCBase#CallOnPlayerChangeTeam(23bb497e4fbd6c85).(pnum, newteam, true, spew_on_respawn); |
| 328 |
SendTeamAssignmentcxx . . $ DMFCBase#SendTeamAssignment(6908015b96d379c0).(pnum, newteam, spew_on_respawn); |
| 329 |
} |
| 330 |
|
| 331 |
// DMFCBase::SendChangeTeamRequest |
| 332 |
// |
| 333 |
// Sends a request to the server to change teams (Client Only) |
| 334 |
void DMFCBasecxx . . $ DMFCBase#::SendChangeTeamRequestcxx . . $ DMFCBase#SendChangeTeamRequest(918ebd27a9ddbad3).(int newteam, bool spew_onrespawn) { |
| 335 |
uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 336 |
int count = 0; |
| 337 |
|
| 338 |
StartPacketcxx . . $ DMFCBase#StartPacket(261852a8f74abaa0).(data, SPID_CHANGETEAMcxx . . $ `netgames/dmfc/dmfcinternal.h:2761:9`!, &count); |
| 339 |
|
| 340 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).((spew_onrespawn) ? 1 : 0, data, &count); |
| 341 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).(), data, &count); |
| 342 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).((newteam == -1) ? 255 : newteam, data, &count); |
| 343 |
|
| 344 |
SendPacketcxx . . $ DMFCBase#SendPacket(49a5bbab55ea8abc).(data, count, SP_SERVERcxx . . $ `netgames/includes/DMFC.h:436:9`!); |
| 345 |
} |
| 346 |
|
| 347 |
// DMFCBase::GetDMFCGameInfo |
| 348 |
// |
| 349 |
// Receives information about the DMFC game |
| 350 |
void DMFCBasecxx . . $ DMFCBase#::GetDMFCGameInfocxx . . $ DMFCBase#GetDMFCGameInfo(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) { |
| 351 |
int count = 0; |
| 352 |
|
| 353 |
uint8_tcxx . . $ uint8_t# level = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count); // server's HUD Callsign max level |
| 354 |
m_bMakeClientsWaitcxx . . $ DMFCBase#m_bMakeClientsWait. = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count) ? true : false; |
| 355 |
SwitchServerHudCallsignLevelcxx . . $ DMFCBase#SwitchServerHudCallsignLevel(ac50b47256ae7414).(level); |
| 356 |
|
| 357 |
int num_teams = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count); |
| 358 |
|
| 359 |
char buffer[256]; |
| 360 |
|
| 361 |
if (num_teams > 1) { |
| 362 |
MultiGetStringcxx . . $ MultiGetString(e054694168e1d38e).(buffer, data, &count); |
| 363 |
SetTeamNamecxx . . $ DMFCBase#SetTeamName(dc3004c27659fe3).(RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!, buffer, false); |
| 364 |
|
| 365 |
MultiGetStringcxx . . $ MultiGetString(e054694168e1d38e).(buffer, data, &count); |
| 366 |
SetTeamNamecxx . . $ DMFCBase#SetTeamName(dc3004c27659fe3).(BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!, buffer, false); |
| 367 |
|
| 368 |
MultiGetStringcxx . . $ MultiGetString(e054694168e1d38e).(buffer, data, &count); |
| 369 |
SetTeamNamecxx . . $ DMFCBase#SetTeamName(dc3004c27659fe3).(GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!, buffer, false); |
| 370 |
|
| 371 |
MultiGetStringcxx . . $ MultiGetString(e054694168e1d38e).(buffer, data, &count); |
| 372 |
SetTeamNamecxx . . $ DMFCBase#SetTeamName(dc3004c27659fe3).(YELLOW_TEAMcxx . . $ `netgames/includes/DMFC.h:430:9`!, buffer, false); |
| 373 |
} |
| 374 |
|
| 375 |
WaitForServercxx . . $ DMFCBase#WaitForServer(b45ddcbc8423892c).(m_bMakeClientsWaitcxx . . $ DMFCBase#m_bMakeClientsWait.); |
| 376 |
} |
| 377 |
|
| 378 |
// DMFCBase::SendDMFCGameInfo |
| 379 |
// |
| 380 |
// Sends information about the DMFC game |
| 381 |
void DMFCBasecxx . . $ DMFCBase#::SendDMFCGameInfocxx . . $ DMFCBase#SendDMFCGameInfo(d4f767463ce0a6b3).(int player) { |
| 382 |
int r_len, b_len, g_len, y_len; |
| 383 |
int count = 0; |
| 384 |
uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 385 |
|
| 386 |
StartPacketcxx . . $ DMFCBase#StartPacket(261852a8f74abaa0).(data, SPID_DMFCGAMEINFOcxx . . $ `netgames/dmfc/dmfcinternal.h:2763:9`!, &count); |
| 387 |
|
| 388 |
if (GetNumTeamscxx . . $ DMFCBase#GetNumTeams(b126dc7c1de90089).() > 1) { |
| 389 |
// team game |
| 390 |
r_len = strlen(GetTeamStringcxx . . $ DMFCBase#GetTeamString(f7ae7e56280f18ae).(RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!)) + 1; |
| 391 |
b_len = strlen(GetTeamStringcxx . . $ DMFCBase#GetTeamString(f7ae7e56280f18ae).(BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!) + 1); |
| 392 |
g_len = strlen(GetTeamStringcxx . . $ DMFCBase#GetTeamString(f7ae7e56280f18ae).(GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!) + 1); |
| 393 |
y_len = strlen(GetTeamStringcxx . . $ DMFCBase#GetTeamString(f7ae7e56280f18ae).(YELLOW_TEAMcxx . . $ `netgames/includes/DMFC.h:430:9`!) + 1); |
| 394 |
|
| 395 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(m_iServerHUDCallsignLevelcxx . . $ DMFCBase#m_iServerHUDCallsignLevel., data, &count); |
| 396 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(m_bMakeClientsWaitcxx . . $ DMFCBase#m_bMakeClientsWait., data, &count); |
| 397 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(GetNumTeamscxx . . $ DMFCBase#GetNumTeams(b126dc7c1de90089).(), data, &count); |
| 398 |
|
| 399 |
MultiAddStringcxx . . $ MultiAddString(ac7a41cf4c80e28).(GetTeamStringcxx . . $ DMFCBase#GetTeamString(f7ae7e56280f18ae).(RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!), data, &count); |
| 400 |
MultiAddStringcxx . . $ MultiAddString(ac7a41cf4c80e28).(GetTeamStringcxx . . $ DMFCBase#GetTeamString(f7ae7e56280f18ae).(BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!), data, &count); |
| 401 |
MultiAddStringcxx . . $ MultiAddString(ac7a41cf4c80e28).(GetTeamStringcxx . . $ DMFCBase#GetTeamString(f7ae7e56280f18ae).(GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!), data, &count); |
| 402 |
MultiAddStringcxx . . $ MultiAddString(ac7a41cf4c80e28).(GetTeamStringcxx . . $ DMFCBase#GetTeamString(f7ae7e56280f18ae).(YELLOW_TEAMcxx . . $ `netgames/includes/DMFC.h:430:9`!), data, &count); |
| 403 |
|
| 404 |
} else { |
| 405 |
// non-team game |
| 406 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(m_iServerHUDCallsignLevelcxx . . $ DMFCBase#m_iServerHUDCallsignLevel., data, &count); |
| 407 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(m_bMakeClientsWaitcxx . . $ DMFCBase#m_bMakeClientsWait., data, &count); |
| 408 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(GetNumTeamscxx . . $ DMFCBase#GetNumTeams(b126dc7c1de90089).(), data, &count); |
| 409 |
} |
| 410 |
|
| 411 |
SendPacketcxx . . $ DMFCBase#SendPacket(49a5bbab55ea8abc).(data, count, player); |
| 412 |
|
| 413 |
SendRealGametimecxx . . $ DMFCBase#SendRealGametime(d4f767463ce0a6b3).(player); |
| 414 |
} |
| 415 |
|
| 416 |
// DMFCBase::SendRealGametime |
| 417 |
// |
| 418 |
// Updates a player about the 'real' game time |
| 419 |
void DMFCBasecxx . . $ DMFCBase#::SendRealGametimecxx . . $ DMFCBase#SendRealGametime(d4f767463ce0a6b3).(int pnum) { |
| 420 |
int count = 0; |
| 421 |
uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 422 |
|
| 423 |
StartPacketcxx . . $ DMFCBase#StartPacket(261852a8f74abaa0).(data, SPID_REALGAMETIMEcxx . . $ `netgames/dmfc/dmfcinternal.h:2774:9`!, &count); |
| 424 |
|
| 425 |
MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(RealGametimecxx . . $ DMFCBase#RealGametime., data, &count); |
| 426 |
|
| 427 |
if (m_iProtectedFlagscxx . . $ DMFCBase#m_iProtectedFlags. & DMFC_PRF_PAUSETIMEcxx . . $ `netgames/dmfc/dmfcinternal.h:2391:9`!) { |
| 428 |
// time is paused |
| 429 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(1, data, &count); |
| 430 |
} else { |
| 431 |
// time is not paused |
| 432 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(0, data, &count); |
| 433 |
} |
| 434 |
|
| 435 |
SendPacketcxx . . $ DMFCBase#SendPacket(49a5bbab55ea8abc).(data, count, pnum); |
| 436 |
} |
| 437 |
|
| 438 |
// DMFCBase::GetRealGametime |
| 439 |
// |
| 440 |
// handles a packet about updating the real game time |
| 441 |
void DMFCBasecxx . . $ DMFCBase#::GetRealGametimePacketcxx . . $ DMFCBase#GetRealGametimePacket(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) { |
| 442 |
int count = 0; |
| 443 |
|
| 444 |
RealGametimecxx . . $ DMFCBase#RealGametime. = MultiGetFloatcxx . . $ MultiGetFloat(fe244d2c191680c4).(data, &count); |
| 445 |
|
| 446 |
if (MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count)) { |
| 447 |
// time is paused |
| 448 |
ENABLE_FLAGScxx . . $ `netgames/dmfc/dmfcinternal.h:2371:9`!(m_iProtectedFlags, DMFC_PRF_PAUSETIMEcxx . . $ `netgames/dmfc/dmfcinternal.h:2391:9`!); |
| 449 |
} else { |
| 450 |
// time is not paused |
| 451 |
DISABLE_FLAGScxx . . $ `netgames/dmfc/dmfcinternal.h:2372:9`!(m_iProtectedFlags, DMFC_PRF_PAUSETIMEcxx . . $ `netgames/dmfc/dmfcinternal.h:2391:9`!); |
| 452 |
} |
| 453 |
} |
| 454 |
|
| 455 |
// DMFCBase::SendRemoteKey |
| 456 |
// |
| 457 |
// Sends out the players remote admin key |
| 458 |
void DMFCBasecxx . . $ DMFCBase#::SendRemoteKeycxx . . $ DMFCBase#SendRemoteKey(d4f767463ce0a6b3).(int pnum) { |
| 459 |
// Send this user's remote admin key |
| 460 |
player_recordcxx . . $ player_record# *pr = PRec_GetPRecordByPnumcxx . . $ PRec_GetPRecordByPnum(6359c6f28dd028ae).(pnum); |
| 461 |
int precnum = -1; |
| 462 |
if (pr) { |
| 463 |
precnum = translate_precptr_to_indexcxx . . $ translate_precptr_to_index(94a7156e227b3396).(pr); |
| 464 |
} |
| 465 |
if (precnum != -1) { |
| 466 |
int count = 0; |
| 467 |
uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 468 |
|
| 469 |
StartPacketcxx . . $ DMFCBase#StartPacket(261852a8f74abaa0).(data, SPID_REMOTEKEYcxx . . $ `netgames/dmfc/dmfcinternal.h:2773:9`!, &count); |
| 470 |
|
| 471 |
uint8_tcxx . . $ uint8_t# *key = Remote_GetKeycxx . . $ Remote_GetKey(f18dc31a6ecbac56).(precnum); |
| 472 |
memcpy(&data[count], key, 8); |
| 473 |
count += 8; |
| 474 |
|
| 475 |
SendPacketcxx . . $ DMFCBase#SendPacket(49a5bbab55ea8abc).(data, count, pnum); |
| 476 |
} else { |
| 477 |
Int3cxx . . $ `netgames/includes/DMFC.h:378:9`!(); |
| 478 |
} |
| 479 |
} |
| 480 |
|
| 481 |
// DMFCBase::GetRemoteKey |
| 482 |
// |
| 483 |
// Handles a new remote key from the server |
| 484 |
void DMFCBasecxx . . $ DMFCBase#::GetRemoteKeycxx . . $ DMFCBase#GetRemoteKey(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) { |
| 485 |
int count = 0; |
| 486 |
uint8_tcxx . . $ uint8_t# key[8]; |
| 487 |
memcpy(key, &data[count], 8); |
| 488 |
count += 8; |
| 489 |
Remote_SetMyKeycxx . . $ Remote_SetMyKey(f25546b61a629de7).(key); |
| 490 |
} |
| 491 |
|
| 492 |
// DMFCBase::RequestGameState |
| 493 |
// |
| 494 |
// Sends a request to the server for the game state |
| 495 |
void DMFCBasecxx . . $ DMFCBase#::RequestGameStatecxx . . $ DMFCBase#RequestGameState(49f6e7a06ebc5aa8).(void) { |
| 496 |
if (GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 497 |
return; |
| 498 |
int count = 0; |
| 499 |
uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 500 |
StartPacketcxx . . $ DMFCBase#StartPacket(261852a8f74abaa0).(data, SPID_REQGAMESTATEcxx . . $ `netgames/dmfc/dmfcinternal.h:2762:9`!, &count); |
| 501 |
|
| 502 |
MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).(), data, &count); |
| 503 |
|
| 504 |
SendPacketcxx . . $ DMFCBase#SendPacket(49a5bbab55ea8abc).(data, count, SP_SERVERcxx . . $ `netgames/includes/DMFC.h:436:9`!); |
| 505 |
} |
| 506 |
|
| 507 |
void DMFCBasecxx . . $ DMFCBase#::SendVersionToClientcxx . . $ DMFCBase#SendVersionToClient(d4f767463ce0a6b3).(int pnum) { |
| 508 |
if (GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 509 |
return; |
| 510 |
int count = 0; |
| 511 |
uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 512 |
|
| 513 |
StartPacketcxx . . $ DMFCBase#StartPacket(261852a8f74abaa0).(data, SPID_VERSIONIDcxx . . $ `netgames/dmfc/dmfcinternal.h:2764:9`!, &count); |
| 514 |
|
| 515 |
MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(DMFC_VERSION_MAJORcxx . . $ `netgames/dmfc/dmfcinternal.h:263:9`!, data, &count); |
| 516 |
MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(DMFC_VERSION_MINORcxx . . $ `netgames/dmfc/dmfcinternal.h:264:9`!, data, &count); |
| 517 |
|
| 518 |
SendPacketcxx . . $ DMFCBase#SendPacket(49a5bbab55ea8abc).(data, count, pnum); |
| 519 |
} |
| 520 |
|
| 521 |
void DMFCBasecxx . . $ DMFCBase#::GetDMFCVersionCheckcxx . . $ DMFCBase#GetDMFCVersionCheck(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) { |
| 522 |
int major, minor, count = 0; |
| 523 |
|
| 524 |
major = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count); |
| 525 |
minor = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count); |
| 526 |
|
| 527 |
if ((major != DMFC_VERSION_MAJORcxx . . $ `netgames/dmfc/dmfcinternal.h:263:9`!) || (minor != DMFC_VERSION_MINORcxx . . $ `netgames/dmfc/dmfcinternal.h:264:9`!)) { |
| 528 |
char buffer[200]; |
| •529 |
snprintf(buffer, sizeof(buffer), "Expecting Version %d.%d, found %d.%d", major, minor, DMFC_VERSION_MAJORcxx . . $ `netgames/dmfc/dmfcinternal.h:263:9`!, |
| 530 |
DMFC_VERSION_MINORcxx . . $ `netgames/dmfc/dmfcinternal.h:264:9`!); |
| 531 |
FatalError(buffer); |
| 532 |
} |
| 533 |
} |
| 534 |
|
| 535 |
// DMFCBase::SendRequestForPlayerRecords |
| 536 |
// |
| 537 |
// |
| 538 |
// Sends a request to the server to send the player records |
| 539 |
void DMFCBasecxx . . $ DMFCBase#::SendRequestForPlayerRecordscxx . . $ DMFCBase#SendRequestForPlayerRecords(49f6e7a06ebc5aa8).(void) { |
| 540 |
if (GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 541 |
return; |
| 542 |
int count = 0; |
| 543 |
uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 544 |
StartPacketcxx . . $ DMFCBase#StartPacket(261852a8f74abaa0).(data, SPID_PRECORDREQcxx . . $ `netgames/dmfc/dmfcinternal.h:2766:9`!, &count); |
| 545 |
|
| 546 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).(), data, &count); |
| 547 |
|
| 548 |
SendPacketcxx . . $ DMFCBase#SendPacket(49a5bbab55ea8abc).(data, count, SP_SERVERcxx . . $ `netgames/includes/DMFC.h:436:9`!); |
| 549 |
} |
| 550 |
|
| 551 |
// DMFCBase::ReceiveRequestForPlayerRecords |
| 552 |
// |
| 553 |
// |
| 554 |
// Recieves and processes a request for a player record |
| 555 |
void DMFCBasecxx . . $ DMFCBase#::ReceiveRequestForPlayerRecordscxx . . $ DMFCBase#ReceiveRequestForPlayerRecords(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) { |
| 556 |
if (GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 557 |
return; |
| 558 |
int count = 0; |
| 559 |
int pnum = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count); |
| 560 |
PRec_SendPRecToPlayercxx . . $ PRec_SendPRecToPlayer(d4f767463ce0a6b3).(pnum); |
| 561 |
|
| 562 |
// send the player his remote admin key |
| 563 |
SendRemoteKeycxx . . $ DMFCBase#SendRemoteKey(d4f767463ce0a6b3).(pnum); |
| 564 |
} |
| 565 |
|
| 566 |
// DMFCBase::SendControlMessageToPlayer |
| 567 |
// |
| 568 |
// |
| 569 |
// Sends a [1 byte] control message to a player |
| 570 |
void DMFCBasecxx . . $ DMFCBase#::SendControlMessageToPlayercxx . . $ DMFCBase#SendControlMessageToPlayer(9633529ce3c4ff50).(int pnum, uint8_tcxx . . $ uint8_t# msg) { |
| 571 |
int count = 0; |
| 572 |
uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 573 |
StartPacketcxx . . $ DMFCBase#StartPacket(261852a8f74abaa0).(data, SPID_CONTROLMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2767:9`!, &count); |
| 574 |
|
| 575 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(msg, data, &count); |
| 576 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).(), data, &count); |
| 577 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(pnum, data, &count); |
| 578 |
|
| 579 |
if (GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) { |
| 580 |
// send it to the server to forward to a client |
| 581 |
SendPacketcxx . . $ DMFCBase#SendPacket(49a5bbab55ea8abc).(data, count, SP_SERVERcxx . . $ `netgames/includes/DMFC.h:436:9`!); |
| 582 |
} else |
| 583 |
SendPacketcxx . . $ DMFCBase#SendPacket(49a5bbab55ea8abc).(data, count, pnum); |
| 584 |
} |
| 585 |
|
| 586 |
// DMFCBase::ReceiveControlMessage |
| 587 |
// |
| 588 |
// |
| 589 |
// Handles a control message |
| 590 |
void DMFCBasecxx . . $ DMFCBase#::ReceiveControlMessagecxx . . $ DMFCBase#ReceiveControlMessage(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) { |
| 591 |
int count = 0; |
| 592 |
uint8_tcxx . . $ uint8_t# msg = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count); |
| 593 |
uint8_tcxx . . $ uint8_t# src = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count); |
| 594 |
uint8_tcxx . . $ uint8_t# dst = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count); |
| 595 |
|
| 596 |
if ((GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) && (dst != SP_SERVERcxx . . $ `netgames/includes/DMFC.h:436:9`! || dst != GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).())) { |
| 597 |
// forward this packet to the correct player |
| 598 |
uint8_tcxx . . $ uint8_t# fdata[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 599 |
count = 0; |
| 600 |
|
| 601 |
StartPacketcxx . . $ DMFCBase#StartPacket(261852a8f74abaa0).(fdata, SPID_CONTROLMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2767:9`!, &count); |
| 602 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(msg, fdata, &count); |
| 603 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(src, fdata, &count); |
| 604 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(dst, fdata, &count); |
| 605 |
SendPacketcxx . . $ DMFCBase#SendPacket(49a5bbab55ea8abc).(fdata, count, dst); |
| 606 |
} else { |
| 607 |
// handle the packet |
| 608 |
CallOnControlMessagecxx . . $ DMFCBase#CallOnControlMessage(d5cb1b1d97598ec6).(msg, src); |
| 609 |
} |
| 610 |
} |
| 611 |
|
| 612 |
// DMFCBase::SendNetGameInfoSync |
| 613 |
// |
| 614 |
// Sends out a NetGame info sync packet to all the players |
| 615 |
void DMFCBasecxx . . $ DMFCBase#::SendNetGameInfoSynccxx . . $ DMFCBase#SendNetGameInfoSync(d4f767463ce0a6b3).(int to_who) { |
| 616 |
if (GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 617 |
return; |
| 618 |
|
| 619 |
uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 620 |
int count = 0; |
| 621 |
StartPacketcxx . . $ DMFCBase#StartPacket(261852a8f74abaa0).(data, SPID_NETGAMESYNCcxx . . $ `netgames/dmfc/dmfcinternal.h:2768:9`!, &count); |
| 622 |
|
| 623 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(Netgamecxx . . $ DMFCBase#Netgame.->packets_per_secondcxx . . $ netgame_info#packets_per_second., data, &count); |
| 624 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).((Netgamecxx . . $ DMFCBase#Netgame.->flagscxx . . $ netgame_info#flags. & NF_KILLGOALcxx . . $ `Descent3/multi_external.h:227:9`!) ? 1 : 0, data, &count); |
| 625 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).((Netgamecxx . . $ DMFCBase#Netgame.->flagscxx . . $ netgame_info#flags. & NF_TIMERcxx . . $ `Descent3/multi_external.h:226:9`!) ? 1 : 0, data, &count); |
| 626 |
|
| 627 |
MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(Netgamecxx . . $ DMFCBase#Netgame.->timelimitcxx . . $ netgame_info#timelimit., data, &count); |
| 628 |
MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(Netgamecxx . . $ DMFCBase#Netgame.->killgoalcxx . . $ netgame_info#killgoal., data, &count); |
| 629 |
MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(Netgamecxx . . $ DMFCBase#Netgame.->respawn_timecxx . . $ netgame_info#respawn_time., data, &count); |
| 630 |
MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(Netgamecxx . . $ DMFCBase#Netgame.->max_playerscxx . . $ netgame_info#max_players., data, &count); |
| 631 |
|
| 632 |
SendPacketcxx . . $ DMFCBase#SendPacket(49a5bbab55ea8abc).(data, count, to_who); |
| 633 |
} |
| 634 |
|
| 635 |
// DMFCBase::ReceiveNetGameInfoSync |
| 636 |
// |
| 637 |
// Receives a NetGame info sync packet from the server |
| 638 |
void DMFCBasecxx . . $ DMFCBase#::ReceiveNetGameInfoSynccxx . . $ DMFCBase#ReceiveNetGameInfoSync(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) { |
| 639 |
int count = 0; |
| 640 |
|
| 641 |
Netgamecxx . . $ DMFCBase#Netgame.->packets_per_secondcxx . . $ netgame_info#packets_per_second. = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count); |
| 642 |
if (MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count)) |
| 643 |
Netgamecxx . . $ DMFCBase#Netgame.->flagscxx . . $ netgame_info#flags. |= NF_KILLGOALcxx . . $ `Descent3/multi_external.h:227:9`!; |
| 644 |
else |
| 645 |
Netgamecxx . . $ DMFCBase#Netgame.->flagscxx . . $ netgame_info#flags. &= ~NF_KILLGOALcxx . . $ `Descent3/multi_external.h:227:9`!; |
| 646 |
if (MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count)) |
| 647 |
Netgamecxx . . $ DMFCBase#Netgame.->flagscxx . . $ netgame_info#flags. |= NF_TIMERcxx . . $ `Descent3/multi_external.h:226:9`!; |
| 648 |
else |
| 649 |
Netgamecxx . . $ DMFCBase#Netgame.->flagscxx . . $ netgame_info#flags. &= ~NF_TIMERcxx . . $ `Descent3/multi_external.h:226:9`!; |
| 650 |
|
| 651 |
Netgamecxx . . $ DMFCBase#Netgame.->timelimitcxx . . $ netgame_info#timelimit. = MultiGetUshortcxx . . $ MultiGetUshort(4574463662eb5370).(data, &count); |
| 652 |
Netgamecxx . . $ DMFCBase#Netgame.->killgoalcxx . . $ netgame_info#killgoal. = MultiGetUshortcxx . . $ MultiGetUshort(4574463662eb5370).(data, &count); |
| 653 |
Netgamecxx . . $ DMFCBase#Netgame.->respawn_timecxx . . $ netgame_info#respawn_time. = MultiGetUshortcxx . . $ MultiGetUshort(4574463662eb5370).(data, &count); |
| 654 |
Netgamecxx . . $ DMFCBase#Netgame.->max_playerscxx . . $ netgame_info#max_players. = MultiGetUshortcxx . . $ MultiGetUshort(4574463662eb5370).(data, &count); |
| 655 |
} |
| 656 |
|
| 657 |
// DMFCBase::SendNewTeamName |
| 658 |
// |
| 659 |
// Tells the clients about a team's new name |
| 660 |
void DMFCBasecxx . . $ DMFCBase#::SendNewTeamNamecxx . . $ DMFCBase#SendNewTeamName(d4f767463ce0a6b3).(int team) { |
| 661 |
if (GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 662 |
return; |
| 663 |
|
| 664 |
int count = 0; |
| 665 |
uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 666 |
StartPacketcxx . . $ DMFCBase#StartPacket(261852a8f74abaa0).(data, SPID_NEWTEAMNAMEcxx . . $ `netgames/dmfc/dmfcinternal.h:2769:9`!, &count); |
| 667 |
|
| 668 |
MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(team, data, &count); |
| 669 |
MultiAddStringcxx . . $ MultiAddString(ac7a41cf4c80e28).(DMFC_team_namescxx . . $ DMFCBase#DMFC_team_names.[team], data, &count); |
| 670 |
|
| 671 |
SendPacketcxx . . $ DMFCBase#SendPacket(49a5bbab55ea8abc).(data, count, SP_ALLcxx . . $ `netgames/includes/DMFC.h:435:9`!); |
| 672 |
} |
| 673 |
|
| 674 |
// DMFCBase::ReceiveNewTeamName |
| 675 |
// |
| 676 |
// The server is telling us about a new team name |
| 677 |
void DMFCBasecxx . . $ DMFCBase#::ReceiveNewTeamNamecxx . . $ DMFCBase#ReceiveNewTeamName(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) { |
| 678 |
int count = 0; |
| 679 |
int team = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count); |
| 680 |
|
| 681 |
ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(team >= 0 && team < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!); |
| 682 |
if (team < 0 || team >= DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!) |
| 683 |
return; // invalid team |
| 684 |
|
| 685 |
char old_teamname[MAX_TEAMNAME_LENcxx . . $ `netgames/includes/DMFC.h:443:9`!]; |
| 686 |
strcpy(old_teamname, DMFC_team_namescxx . . $ DMFCBase#DMFC_team_names.[team]); |
| 687 |
|
| 688 |
MultiGetStringcxx . . $ MultiGetString(e054694168e1d38e).(DMFC_team_namescxx . . $ DMFCBase#DMFC_team_names.[team], data, &count); |
| 689 |
|
| 690 |
CallOnTeamChangeNamecxx . . $ DMFCBase#CallOnTeamChangeName(5665db83c1ca01b7).(team, old_teamname, DMFC_team_namescxx . . $ DMFCBase#DMFC_team_names.[team]); |
| 691 |
} |