| 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/multi_server.cpp $ |
| 21 | * $Revision: 276 $ |
| 22 | * $Date: 9/19/01 7:26p $ |
| 23 | * $Author: Matt $ |
| 24 | * |
| 25 | * Multiplayer server code |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/multi_server.cpp $ |
| 28 | * |
| 29 | * 276 9/19/01 7:26p Matt |
| 30 | * Fix for clients not hearing when the server player took omega damage. |
| 31 | * |
| 32 | * 275 9/10/01 3:39p Matt |
| 33 | * Always send the server position, because we always say that the server |
| 34 | * is visible. This should fix some or all ghost ship problems. |
| 35 | * |
| 36 | * 274 2/19/00 6:45p Jason |
| 37 | * fixed dumb -usesmoothing bug...server was turning it on when it |
| 38 | * shouldn't have |
| 39 | * |
| 40 | * 273 9/28/99 7:08a Kevin |
| 41 | * Fixed bug with MultiAddVector calls getting passes the wrong pointers |
| 42 | * |
| 43 | * 272 9/16/99 2:37p Kevin |
| 44 | * don't send server or observer position updates |
| 45 | * |
| 46 | * 271 9/02/99 3:35p Jason |
| 47 | * send secondary fire reliable in a C/S game |
| 48 | * |
| 49 | * 270 9/01/99 4:12p Kevin |
| 50 | * Byte ordering fixes for the macintosh |
| 51 | * |
| 52 | * 269 8/20/99 9:45a Kevin |
| 53 | * Rankings changes! |
| 54 | * |
| 55 | * 268 8/17/99 1:27p Kevin |
| 56 | * fixed wacky rank bug |
| 57 | * |
| 58 | * 267 8/02/99 12:25p Jason |
| 59 | * fixed bug in ranking system |
| 60 | * |
| 61 | * 266 7/20/99 12:57p Jason |
| 62 | * added MOTD to server |
| 63 | * |
| 64 | * 265 7/08/99 5:45p Jason |
| 65 | * don't track rank if flag isn't set |
| 66 | * |
| 67 | * 264 5/24/99 11:58p Matt |
| 68 | * Removed Jason's previous fix because he and I decided it was too risky |
| 69 | * to change the night before the (hopefully) final build. |
| 70 | * |
| 71 | * 263 5/24/99 10:19p Jason |
| 72 | * fixed objects disappearing over terrain |
| 73 | * |
| 74 | * 262 5/23/99 7:37p Jason |
| 75 | * changed rankins so it is a little more fair to players |
| 76 | * |
| 77 | * 261 5/23/99 3:05a Jason |
| 78 | * fixed bug with player rankings not being updated correctly |
| 79 | * |
| 80 | * 260 5/22/99 3:10a Jason |
| 81 | * fixed weird invisible powerup bug |
| 82 | * |
| 83 | * 259 5/22/99 12:33a Jason |
| 84 | * added sending of physics flags upon joining |
| 85 | * |
| 86 | * 258 5/21/99 7:08p Jason |
| 87 | * fixed some weird multiplayer rejoin anomalies |
| 88 | * |
| 89 | * 257 5/20/99 4:55p Jason |
| 90 | * added heartbeats to server |
| 91 | * |
| 92 | * 256 5/20/99 2:53p Jason |
| 93 | * made autowaypoints work in coop |
| 94 | * |
| 95 | * 255 5/20/99 2:48a Matt |
| 96 | * Auto-waypoints now stored & used per player. Manual waypoints will all |
| 97 | * players, once Jason makes it work. |
| 98 | * |
| 99 | * 254 5/19/99 4:58p Jason |
| 100 | * changes for ranking system |
| 101 | * |
| 102 | * 253 5/19/99 12:11p Jason |
| 103 | * fixed some issues with multiplayer |
| 104 | * |
| 105 | * 252 5/17/99 6:27p Jason |
| 106 | * added reliable overrun message |
| 107 | * |
| 108 | * 251 5/13/99 7:18p Jason |
| 109 | * upped the limit of players disconnecting while joining |
| 110 | * |
| 111 | * 250 5/12/99 7:45p Jason |
| 112 | * fixed boneheaded powerup repositioning bug...I should be shot. |
| 113 | * |
| 114 | * 249 5/12/99 4:19p Jason |
| 115 | * pick a random start position for server |
| 116 | * |
| 117 | * 248 5/12/99 2:42p Jason |
| 118 | * changed default netgame difficult to hotshot (1.0 scalar) |
| 119 | * |
| 120 | * 247 5/12/99 1:57p Jason |
| 121 | * fixed yet more buggy/ugly code |
| 122 | * |
| 123 | * 246 5/11/99 9:42p Jeff |
| 124 | * send tracker id of players to other players |
| 125 | * |
| 126 | * 245 5/11/99 10:59a Kevin |
| 127 | * Ship allow/dissalow works now! |
| 128 | * |
| 129 | * 244 5/10/99 10:23p Ardussi |
| 130 | * changes to compile on Mac |
| 131 | * |
| 132 | * 243 5/10/99 8:28p Jason |
| 133 | * adjusted blackshark popping bug |
| 134 | * |
| 135 | * 242 5/10/99 5:35p Kevin |
| 136 | * New command line options for heat and scoring API enhancements |
| 137 | * |
| 138 | * 241 5/10/99 3:13a Jeff |
| 139 | * put in missing prototype |
| 140 | * |
| 141 | * 240 5/10/99 2:54a Jason |
| 142 | * fixed player spawning in opposite team waypoints |
| 143 | * |
| 144 | * 239 5/10/99 1:45a Jason |
| 145 | * took out robot and turret position counters |
| 146 | * |
| 147 | * 238 5/09/99 1:34p Kevin |
| 148 | * Added diffuculty level system to multiplayer |
| 149 | * |
| 150 | * 237 5/08/99 12:10p Kevin |
| 151 | * |
| 152 | * 236 5/08/99 12:09p Kevin |
| 153 | * fixed dedicated server num team selection |
| 154 | * |
| 155 | * 235 5/07/99 6:59p Jason |
| 156 | * fixed marker/guided nonvis issues |
| 157 | * |
| 158 | * 234 5/07/99 2:51p Jason |
| 159 | * fixed a bunch of endlevel multiplayer issues |
| 160 | * |
| 161 | * 233 5/06/99 3:26a Kevin |
| 162 | * heat scoring stuff |
| 163 | * |
| 164 | * 232 5/05/99 5:42p Jason |
| 165 | * fixed various multiplayer issues, including sequencing bugs and cheat |
| 166 | * prevention |
| 167 | * |
| 168 | * 231 5/03/99 4:22p Jeff |
| 169 | * changed byte var to uint8_t type for Linux |
| 170 | * |
| 171 | * 230 5/03/99 2:36p Jason |
| 172 | * changes for multiplayer games |
| 173 | * |
| 174 | * 229 5/03/99 8:38a Jeff |
| 175 | * handle world states for room's with goal/special flag change |
| 176 | * |
| 177 | * 228 5/02/99 2:32p Kevin |
| 178 | * fixed various dedicated server problems. |
| 179 | * |
| 180 | * 227 5/01/99 4:06p Jeff |
| 181 | * fixed #incldue for Linux |
| 182 | * |
| 183 | * 226 4/30/99 7:50p Jason |
| 184 | * setups urgent/non urgent reliable stuff better |
| 185 | * |
| 186 | * 225 4/30/99 5:06p Kevin |
| 187 | * misc dedicated server, networking and low memory enhancements |
| 188 | * |
| 189 | * 224 4/29/99 11:02p Jeff |
| 190 | * added the ability for the server to set audio taunt delay time via |
| 191 | * command line option and/or dedicated server console |
| 192 | * |
| 193 | * 223 4/29/99 12:23p Jason |
| 194 | * fixed blackshark related problem with powerups |
| 195 | * |
| 196 | * 222 4/29/99 2:00a Chris |
| 197 | * Added the portal blockage support |
| 198 | * |
| 199 | * 221 4/28/99 2:27a Jeff |
| 200 | * added buddybot world states |
| 201 | * |
| 202 | * 220 4/27/99 12:08p Kevin |
| 203 | * fixed team count dialog |
| 204 | * |
| 205 | * 219 4/25/99 5:20p Jason |
| 206 | * fixed some more coop bugs |
| 207 | * |
| 208 | * 218 4/23/99 5:32p Kevin |
| 209 | * Fixed a few mission bugs. |
| 210 | * |
| 211 | * 217 4/23/99 3:33p Kevin |
| 212 | * mission file/multiplayer mod keyword system |
| 213 | * |
| 214 | * 216 4/21/99 11:05a Kevin |
| 215 | * new ps_rand and ps_srand to replace rand & srand |
| 216 | * |
| 217 | * 215 4/20/99 3:32p Kevin |
| 218 | * made it possible for an edit box to not have a cancel button... used it |
| 219 | * for choosing team count for server |
| 220 | * |
| 221 | * 214 4/17/99 4:34p Jason |
| 222 | * changes for robot/turret tracking |
| 223 | * |
| 224 | * 212 4/08/99 11:08a Jason |
| 225 | * cleaned up a variable naming problem |
| 226 | * |
| 227 | * 211 4/06/99 6:24p Jason |
| 228 | * various fixes for multiplayer |
| 229 | * |
| 230 | * 210 4/05/99 10:54a Matt |
| 231 | * Added auto-waypoint system |
| 232 | * |
| 233 | * 209 4/03/99 6:34p Jeff |
| 234 | * fixed bug with calling BOA_IsVisible, in which it was passing in an |
| 235 | * object number instead of a room number |
| 236 | * |
| 237 | * 208 4/02/99 6:31p Jason |
| 238 | * Fixed multiplayer powerup/player start bugs |
| 239 | * |
| 240 | * 207 3/29/99 7:31p Jason |
| 241 | * added better handling of non-vis generic objects |
| 242 | * |
| 243 | * 206 3/27/99 2:20p Jason |
| 244 | * transmit rankings when a player joins |
| 245 | * |
| 246 | * 205 3/25/99 3:29p Jason |
| 247 | * added option to randomize powerup respawn points |
| 248 | * |
| 249 | * 204 3/25/99 1:41p Jason |
| 250 | * took out mprintfs |
| 251 | * |
| 252 | * 203 3/25/99 11:20a Jason |
| 253 | * fixed fog state bug |
| 254 | * |
| 255 | * 202 3/24/99 1:41p Jeff |
| 256 | * some dedicated server fixups...ability to set number of teams |
| 257 | * |
| 258 | * 201 3/23/99 6:09p Kevin |
| 259 | * Added team count prompt for Jeff |
| 260 | * |
| 261 | * 200 3/22/99 6:22p Jeff |
| 262 | * added 2 more audio taunts. a mulitplayer event when someone plays an |
| 263 | * audio taunt. option to disable audio taunts. |
| 264 | * |
| 265 | * 199 3/16/99 12:06p Kevin |
| 266 | * Enabled rankings, but took out the hud message in the OEM build |
| 267 | * |
| 268 | * 198 3/11/99 9:10p Jeff |
| 269 | * fixed remaining known bugs in demo system (DemoWriteObjCreate being |
| 270 | * called twice and </<= problems with |
| 271 | * Highest_room_index/Highest_object_index). |
| 272 | * |
| 273 | * 197 3/11/99 6:31p Jeff |
| 274 | * numerous fixes to demo system in multiplayer games (when |
| 275 | * recording/playback a demo in a multiplayer game) |
| 276 | * |
| 277 | * 196 3/11/99 3:36p Jason |
| 278 | * made k factor for ranks always be the same regardless of skill level |
| 279 | * |
| 280 | * 195 3/11/99 11:03a Jason |
| 281 | * turned off rankings for oem and demo builds |
| 282 | * |
| 283 | * 194 3/04/99 3:46p Jason |
| 284 | * fixed some multisafe stuff |
| 285 | * |
| 286 | * 193 3/02/99 11:05p 3dsmax |
| 287 | * took out dot product throttling |
| 288 | * |
| 289 | * 192 3/02/99 5:50p Kevin |
| 290 | * Ouch. Duplicate structures existed and were conflicting. |
| 291 | * |
| 292 | * 191 2/25/99 8:55p Jeff |
| 293 | * Inventory supports level change persistant items. Inventory supports |
| 294 | * time-out objects. Inventory Reset changed (takes a level of reset |
| 295 | * now). Quad lasers stay across level change (single player). Guidebot |
| 296 | * bug fixed (now back in ship on level start). Quads time out when |
| 297 | * spewed. Invulnerability and cloak powerups no longer use game |
| 298 | * event/callbacks, so they can be saved in game saves (moved to |
| 299 | * MakePlayerInvulnerable and MakeObjectInvisible) |
| 300 | * |
| 301 | * 190 2/25/99 12:44p Jason |
| 302 | * fixed some major multiplayer bugs |
| 303 | * |
| 304 | * 189 2/25/99 11:00a Matt |
| 305 | * Added new explosion system. |
| 306 | * |
| 307 | * 188 2/25/99 10:30a Jason |
| 308 | * added nonvis generic/robot system |
| 309 | * |
| 310 | * 187 2/24/99 1:02p Jason |
| 311 | * various fixes for multiplayer |
| 312 | * |
| 313 | * 186 2/24/99 11:21a Jason |
| 314 | * Fixed bugs for OEM build |
| 315 | * |
| 316 | * 185 2/17/99 2:12p Jason |
| 317 | * fixed up some coop vis issues |
| 318 | * |
| 319 | * 184 2/16/99 5:56p Jason |
| 320 | * added guided missiles to positional updates |
| 321 | * |
| 322 | * 183 2/16/99 3:47p Jason |
| 323 | * added marker updates to multiplayer server stream |
| 324 | * |
| 325 | * 182 2/15/99 7:50p Jeff |
| 326 | * new pilot file class and read/write system checked in...should be more |
| 327 | * robust than old |
| 328 | * |
| 329 | * 181 2/10/99 5:43p Jason |
| 330 | * adjusted ranking formula |
| 331 | * |
| 332 | * 180 2/09/99 6:52p Jeff |
| 333 | * implemented 'typing inidcator' in multiplayer...players that are typing |
| 334 | * messages have an icon on them |
| 335 | * |
| 336 | * 179 2/09/99 9:58a Chris |
| 337 | * Massive BOA update :) Terrain happy now. Vis happy now. Sound happy |
| 338 | * now. |
| 339 | * |
| 340 | * 178 2/08/99 5:25p Jeff |
| 341 | * removed all calls to MultiSendRemoveObject, incorportated into |
| 342 | * SetObjectDeadFlag. Fixes sequencing issues in multiplayer |
| 343 | * |
| 344 | * 177 2/03/99 6:32p Jason |
| 345 | * more changes for world states |
| 346 | * |
| 347 | * 176 2/03/99 4:26p Jason |
| 348 | * made multiplayer coop actually work! |
| 349 | * |
| 350 | * 175 2/03/99 12:15p Jason |
| 351 | * added multiplayer vis optimizations |
| 352 | * |
| 353 | * 174 2/02/99 7:06p Jason |
| 354 | * added ranking system |
| 355 | * |
| 356 | * 173 2/01/99 3:47p Jason |
| 357 | * added more multisafe functionality |
| 358 | * |
| 359 | * 172 1/31/99 7:26p Matt |
| 360 | * Renamed a bunch of functions to have HUD capitalized |
| 361 | * |
| 362 | * 171 1/31/99 1:03a Jason |
| 363 | * made multiplayer code leaner |
| 364 | * |
| 365 | * 170 1/28/99 6:17p Jason |
| 366 | * added markers |
| 367 | * |
| 368 | * 169 1/27/99 5:47p Jeff |
| 369 | * audio taunts implemented! |
| 370 | * |
| 371 | * 168 1/26/99 11:38a Jason |
| 372 | * small changes for level loading |
| 373 | * |
| 374 | * 167 1/21/99 11:34p Jason |
| 375 | * integrated some vis changes |
| 376 | * |
| 377 | * 166 1/21/99 11:15p Jeff |
| 378 | * pulled out some structs and defines from header files and moved them |
| 379 | * into seperate header files so that multiplayer dlls don't require major |
| 380 | * game headers, just those new headers. Side effect is a shorter build |
| 381 | * time. Also cleaned up some header file #includes that weren't needed. |
| 382 | * This affected polymodel.h, object.h, player.h, vecmat.h, room.h, |
| 383 | * manage.h and multi.h |
| 384 | * |
| 385 | * 165 1/20/99 8:06p Jeff |
| 386 | * added members into DLLinfo struct for game change segment events, pass |
| 387 | * them over on execute dll packets |
| 388 | * |
| 389 | * 164 1/18/99 2:46p Matt |
| 390 | * Combined flags & flags2 fields in object struct |
| 391 | * |
| 392 | * 163 1/17/99 11:59p Jeff |
| 393 | * removed call to the change seg event for player, since it's done in |
| 394 | * ObjSetPos(). Also send over collide data on collide event |
| 395 | * (EVT_CLIENT_GAMECOLLIDE) |
| 396 | * |
| 397 | * 162 1/15/99 3:52a Jeff |
| 398 | * added the point and normal fields of DLLInfo to be passed for client |
| 399 | * events |
| 400 | * |
| 401 | * 161 1/13/99 3:13p Jason |
| 402 | * more work on world states |
| 403 | * |
| 404 | * 160 1/08/99 2:56p Samir |
| 405 | * Ripped out OSIRIS1. |
| 406 | * |
| 407 | * 159 1/07/99 11:51a Kevin |
| 408 | * Added support for joining servers on alternate ports and hosting behind |
| 409 | * a proxy/firewall |
| 410 | * |
| 411 | * 158 1/06/99 12:34p Jason |
| 412 | * misc changes for multiplayer |
| 413 | * |
| 414 | * 157 1/05/99 12:45p Jason |
| 415 | * fixed PPS thing to be more tolerant of low bandwidth players |
| 416 | * |
| 417 | * 156 1/04/99 8:38p Jason |
| 418 | * one more time! |
| 419 | * |
| 420 | * 155 1/04/99 8:37p Jason |
| 421 | * another test |
| 422 | * |
| 423 | * 154 1/04/99 7:58p Jason |
| 424 | * fixed packet throttling...it didn't work with the new architecture very |
| 425 | * well! |
| 426 | * |
| 427 | * 153 1/04/99 7:35p Jason |
| 428 | * fixed popping problem |
| 429 | * |
| 430 | * 152 1/04/99 7:16p Jason |
| 431 | * testing a theory about popping problems |
| 432 | * |
| 433 | * 151 1/04/99 12:54p Jason |
| 434 | * added some world state packets |
| 435 | * |
| 436 | * 150 12/30/98 10:54a Jason |
| 437 | * added positional priorities to server updates |
| 438 | * |
| 439 | * 149 12/21/98 10:22a Jason |
| 440 | * added auto pps |
| 441 | * |
| 442 | * 148 12/16/98 12:05p Kevin |
| 443 | * GameSpy! |
| 444 | * |
| 445 | * 147 12/16/98 11:29a Jason |
| 446 | * added smoothing command line option |
| 447 | * |
| 448 | * 146 12/16/98 11:26a Jason |
| 449 | * more changes for 1.1 multiplayer |
| 450 | * |
| 451 | * 145 12/15/98 12:59p Jason |
| 452 | * added debug mprintf |
| 453 | * |
| 454 | * 144 12/15/98 10:53a Jason |
| 455 | * yet more changes for 1.1 |
| 456 | * |
| 457 | * 143 12/14/98 5:32p Jason |
| 458 | * added multisafe functions |
| 459 | * |
| 460 | * 142 12/08/98 4:52p Jeff |
| 461 | * changed the pilot pics packing to use Ushort instead of short just for |
| 462 | * my conscience...removed some annoying mprintf's too |
| 463 | * |
| 464 | * 141 12/04/98 7:05p Jason |
| 465 | * fixed problems with peer 2 peer |
| 466 | * |
| 467 | * 140 12/02/98 10:30a Jason |
| 468 | * added additional damage types for client-side multiplayer |
| 469 | * |
| 470 | * 139 12/01/98 5:48p Jeff |
| 471 | * added pilot picture id to netplayer struct |
| 472 | * |
| 473 | * 138 12/01/98 5:36p Jason |
| 474 | * took out additional damage sound for now |
| 475 | * |
| 476 | * 137 12/01/98 3:42p Jason |
| 477 | * made additional damage play a sound |
| 478 | * |
| 479 | * 136 12/01/98 12:47p Jason |
| 480 | * got rid of NF_DROPMISORDERED and added NF_USE_SMOOTHING |
| 481 | * |
| 482 | * 135 11/28/98 3:11p Jason |
| 483 | * made observers not send their positions |
| 484 | * |
| 485 | * 134 11/11/98 7:18p Jeff |
| 486 | * changes made so that a dedicated server's team is always -1 (team game |
| 487 | * or not) |
| 488 | * |
| 489 | * 133 11/11/98 11:41a Jason |
| 490 | * added sunlight damage |
| 491 | * |
| 492 | * 132 11/10/98 11:16a Jason |
| 493 | * fixed some multiplayer bugs with powerups disappearing |
| 494 | * |
| 495 | * |
| 496 | * 131 11/06/98 5:43p Jason |
| 497 | * made pings sent not reliably |
| 498 | * |
| 499 | * 130 10/30/98 4:24p Jason |
| 500 | * changes for multiplayer |
| 501 | * |
| 502 | * 129 10/29/98 7:09p Jason |
| 503 | * fixed server vis problem |
| 504 | * |
| 505 | * 128 10/28/98 5:07p Jason |
| 506 | * more changes for cleaner multiplayer |
| 507 | * |
| 508 | * 127 10/28/98 11:51a Jason |
| 509 | * fixed some multiplayer problems, plus redid coop a bit to make it |
| 510 | * cleaner |
| 511 | * |
| 512 | * 126 10/27/98 10:17a Jason |
| 513 | * changes for new architecture |
| 514 | * |
| 515 | * 125 10/22/98 12:28p Kevin |
| 516 | * Fixed pings in peer-peer |
| 517 | * |
| 518 | * 124 10/22/98 10:39a Kevin |
| 519 | * Fixed DirectPlay |
| 520 | * |
| 521 | * 123 10/20/98 2:53a Kevin |
| 522 | * gunboy crap |
| 523 | * |
| 524 | * 122 10/19/98 11:46p Jason |
| 525 | * changes for multiplayer debug layer |
| 526 | * |
| 527 | * 121 10/19/98 7:18p Matt |
| 528 | * Added system to support different types of damage to the player and |
| 529 | * have these different types make different sounds. |
| 530 | * |
| 531 | * 120 10/19/98 5:07p Jason |
| 532 | * put vis stuff back in |
| 533 | * |
| 534 | * 119 10/17/98 12:46p Kevin |
| 535 | * Beta 4 fixes |
| 536 | * |
| 537 | * 118 10/16/98 2:52p Jason |
| 538 | * trying to debug world states |
| 539 | * |
| 540 | * 117 10/14/98 11:46a Jason |
| 541 | * made camera scripts work correctly |
| 542 | * |
| 543 | * 116 10/13/98 9:26p Jason |
| 544 | * trying to track down wind problems |
| 545 | * |
| 546 | * 115 10/07/98 1:07p Jason |
| 547 | * added more safety precautions |
| 548 | * |
| 549 | * 114 10/05/98 7:23p Jason |
| 550 | * added protective layer onto multiplayer |
| 551 | * |
| 552 | * 113 10/05/98 11:08a Jason |
| 553 | * fixed some potential gap problems in the multiplayer sequencing code |
| 554 | * |
| 555 | * 112 10/02/98 5:51p Jason |
| 556 | * made default max players 16 on the dedicated server |
| 557 | * |
| 558 | * 111 10/01/98 12:41p Jason |
| 559 | * more world state stuff |
| 560 | * |
| 561 | * 110 10/01/98 11:29a Jason |
| 562 | * changes for world states in multiplayer games |
| 563 | * |
| 564 | * 109 10/01/98 10:22a Jason |
| 565 | * added mprintf |
| 566 | * |
| 567 | * 108 9/29/98 2:23p Kevin |
| 568 | * More UI tweaks |
| 569 | * |
| 570 | * 107 9/29/98 11:18a Jeff |
| 571 | * fixed OBJ_DUMMY problems on client join objects |
| 572 | * |
| 573 | * 106 9/28/98 6:36p Kevin |
| 574 | * added dummy objects to get sent over in join |
| 575 | * |
| 576 | * 105 9/28/98 6:20p Jason |
| 577 | * added persistant data from scripts |
| 578 | * |
| 579 | * 104 9/25/98 9:25p Jason |
| 580 | * turned vis stuff back on |
| 581 | * |
| 582 | * 103 9/25/98 4:21p Jason |
| 583 | * more multiplayer bug checking |
| 584 | * |
| 585 | * 102 9/25/98 12:06a Jason |
| 586 | * fixed some multiplayer scripting issues |
| 587 | * |
| 588 | * 101 9/16/98 7:42p Kevin |
| 589 | * Called first frame for dll in non mastertracker games. |
| 590 | * |
| 591 | * 100 9/15/98 5:44p Jason |
| 592 | * more work on dedicated server |
| 593 | * |
| 594 | * 99 9/15/98 4:31p Jason |
| 595 | * added more functionality for the dedicated server |
| 596 | * |
| 597 | * 98 9/15/98 12:42p Jason |
| 598 | * got dedicated server actually working |
| 599 | * |
| 600 | * 97 9/04/98 3:46p Kevin |
| 601 | * Added ping_time to Netplayers struct. It's updated in peer-peer and |
| 602 | * client server |
| 603 | * |
| 604 | * 96 9/02/98 6:54p Kevin |
| 605 | * Fixed general directplay support up, and got modem-modem working |
| 606 | * |
| 607 | * 95 8/19/98 11:49a Kevin |
| 608 | * Got DirectPlay IPX working, and localized connection DLLs |
| 609 | * |
| 610 | * 94 8/14/98 4:54p Kevin |
| 611 | * More directplay stuff |
| 612 | * |
| 613 | * 93 8/13/98 6:32p Kevin |
| 614 | * Initial implementation of directplay API |
| 615 | * |
| 616 | * 92 8/10/98 4:58p Kevin |
| 617 | * Send robot orientation as 3 angles |
| 618 | * |
| 619 | * 91 8/07/98 12:27p Kevin |
| 620 | * Added network stuff for energy/shield conversion |
| 621 | * |
| 622 | * 90 8/05/98 10:46a Kevin |
| 623 | * sound & bmp exchange fixes |
| 624 | * |
| 625 | */ |
| 626 | |
| 627 | #include "args.h"cxx . . $ `<file>/Descent3/args.h`/ |
| 628 | #include "multi.h"cxx . . $ `<file>/Descent3/multi.h`/ |
| 629 | #include "multi_server.h"cxx . . $ `<file>/Descent3/multi_server.h`/ |
| 630 | #include "player.h"cxx . . $ `<file>/Descent3/player.h`/ |
| 631 | #include "game.h"cxx . . $ `<file>/Descent3/game.h`/ |
| 632 | #include "mono.h"cxx . . $ `<file>/ddebug/mono.h`/ |
| 633 | #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/ |
| 634 | #include "hud.h"cxx . . $ `<file>/Descent3/hud.h`/ |
| 635 | #include "pilot.h"cxx . . $ `<file>/Descent3/pilot.h`/ |
| 636 | #include "BOA.h"cxx . . $ `<file>/Descent3/BOA.h`/ |
| 637 | #include "LoadLevel.h"cxx . . $ `<file>/Descent3/LoadLevel.h`/ |
| 638 | #include "Mission.h"cxx . . $ `<file>/Descent3/Mission.h`/ |
| 639 | #include "game2dll.h"cxx . . $ `<file>/lib/game2dll.h`/ |
| 640 | #include "stringtable.h"cxx . . $ `<file>/Descent3/stringtable.h`/ |
| 641 | |
| 642 | // #define USE_DIRECTPLAY |
| 643 | |
| 644 | #ifdef USE_DIRECTPLAY |
| 645 | #include "directplay.h" |
| 646 | #endif |
| 647 | |
| 648 | #include "dedicated_server.h"cxx . . $ `<file>/lib/dedicated_server.h`/ |
| 649 | #include "damage.h"cxx . . $ `<file>/Descent3/damage.h`/ |
| 650 | // #include "gamespy.h" |
| 651 | #include "multi_world_state.h"cxx . . $ `<file>/Descent3/multi_world_state.h`/ |
| 652 | #include "ObjScript.h"cxx . . $ `<file>/Descent3/ObjScript.h`/ |
| 653 | #include "marker.h"cxx . . $ `<file>/Descent3/marker.h`/ |
| 654 | #include "findintersection.h"cxx . . $ `<file>/physics/findintersection.h`/ |
| 655 | #include "weapon.h"cxx . . $ `<file>/Descent3/weapon.h`/ |
| 656 | #include "weather.h"cxx . . $ `<file>/Descent3/weather.h`/ |
| 657 | #include "doorway.h"cxx . . $ `<file>/Descent3/doorway.h`/ |
| 658 | #include "object_lighting.h"cxx . . $ `<file>/Descent3/object_lighting.h`/ |
| 659 | #include "ship.h"cxx . . $ `<file>/Descent3/ship.h`/ |
| 660 | #include "pstring.h"cxx . . $ `<file>/misc/pstring.h`/ |
| 661 | #include "audiotaunts.h"cxx . . $ `<file>/Descent3/audiotaunts.h`/ |
| 662 | |
| 663 | #include "ui.h"cxx . . $ `<file>/ui/ui.h`/ |
| 664 | #include "newui.h"cxx . . $ `<file>/Descent3/newui.h`/ |
| 665 | #include "multi_dll_mgr.h"cxx . . $ `<file>/Descent3/multi_dll_mgr.h`/ |
| 666 | #include "spew.h"cxx . . $ `<file>/Descent3/spew.h`/ |
| 667 | #include "psrand.h"cxx . . $ `<file>/misc/psrand.h`/ |
| 668 | #include "polymodel.h"cxx . . $ `<file>/model/polymodel.h`/ |
| 669 | #include "init.h"cxx . . $ `<file>/Descent3/init.h`/ |
| 670 | #include "../md5/md5.h"cxx . . $ `<file>/md5/md5.h`/ |
| 671 | |
| 672 | #include <algorithm> |
| 673 | |
| 674 | void MultiProcessShipChecksumcxx . . $ MultiProcessShipChecksum(54a9d97b34104f61).(MD5cxx . . $ MD5# *md5, int ship_index); |
| 675 | |
| 676 | int GameDLLGetConnectingPlayersTeamcxx . . $ GameDLLGetConnectingPlayersTeam(7864480464b09eea).(int slot); |
| 677 | |
| 678 | int Moved_robotscxx . . $ Moved_robots.[MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!][MAX_CHANGED_OBJECTScxx . . $ `Descent3/multi_server.h:30:9`!]; |
| 679 | uint16_tcxx . . $ uint16_t# Num_moved_robotscxx . . $ Num_moved_robots.[MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!]; |
| 680 | |
| 681 | int Changed_animcxx . . $ Changed_anim.[MAX_CHANGED_OBJECTScxx . . $ `Descent3/multi_server.h:30:9`!][MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!]; |
| 682 | uint16_tcxx . . $ uint16_t# Num_changed_animcxx . . $ Num_changed_anim.[MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!]; |
| 683 | |
| 684 | int Changed_wb_animcxx . . $ Changed_wb_anim.[MAX_CHANGED_OBJECTScxx . . $ `Descent3/multi_server.h:30:9`!][MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!]; |
| 685 | uint16_tcxx . . $ uint16_t# Num_changed_wb_animcxx . . $ Num_changed_wb_anim.[MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!]; |
| 686 | |
| 687 | int Changed_turretcxx . . $ Changed_turret.[MAX_CHANGED_OBJECTScxx . . $ `Descent3/multi_server.h:30:9`!][MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!]; |
| 688 | uint16_tcxx . . $ uint16_t# Num_changed_turretcxx . . $ Num_changed_turret.[MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!]; |
| 689 | |
| 690 | float last_sent_bytescxx . . $ last_sent_bytes.[MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!]; |
| 691 | float Multi_last_send_visiblecxx . . $ Multi_last_send_visible.[MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!]; |
| 692 | uint32_tcxx . . $ uint32_t# Multi_visible_playerscxx . . $ Multi_visible_players.[MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!]; |
| 693 | extern int Buddy_handlecxx . . $ Buddy_handle.[MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!]; |
| 694 | extern char Multi_message_of_the_daycxx . . $ Multi_message_of_the_day.[]; |
| 695 | |
| 696 | int Join_response_stringscxx . . $ Join_response_strings.[] = {TXI_MLTOKcxx . . $ `Descent3/stringtable.h:187:9`!, TXI_MLTNOTSERVcxx . . $ `Descent3/stringtable.h:188:9`!, TXI_MLTDORKcxx . . $ `Descent3/stringtable.h:189:9`!, TXI_MLTNOTENOUGHSTRcxx . . $ `Descent3/stringtable.h:190:9`!, TXI_MLTGAMEFULLcxx . . $ `Descent3/stringtable.h:191:9`!}; |
| 697 | |
| 698 | // d3_net_game_data D3_tracker_info; |
| 699 | float LastTrackerDataUpdatecxx . . $ LastTrackerDataUpdate.; |
| 700 | |
| 701 | int MTReadingPilotcxx . . $ MTReadingPilot. = -1; |
| 702 | int MTWritingPilotcxx . . $ MTWritingPilot. = -1; |
| 703 | |
| 704 | int Player_countcxx . . $ Player_count. = 0; // The total number of players playing the game |
| 705 | |
| 706 | extern int Use_file_xfercxx . . $ Use_file_xfer.; |
| 707 | |
| 708 | uint32_tcxx . . $ uint32_t# Secret_net_idcxx . . $ Secret_net_id. = 0; |
| 709 | // Stars a multiplayer server. If playing is non-zero, then the server is a player in the |
| 710 | // game |
| 711 | // Server only |
| 712 | void MultiStartServercxx . . $ MultiStartServer(99469d7ff9a1485a).(int playing, char *scriptname, int dedicated_server_num_teams) { |
| 713 | // Clear out some stuff |
| 714 | for (int i = 0; i < MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!; i++) { |
| 715 | memset(&NetPlayerscxx . . $ NetPlayers.[i], 0, sizeof(netplayercxx . . $ netplayer#)); |
| 716 | Multi_send_sizecxx . . $ Multi_send_size.[i] = 0; |
| 717 | |
| 718 | for (int t = 0; t < MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!; t++) |
| 719 | Multi_last_sent_timecxx . . $ Multi_last_sent_time.[i][t] = 0; |
| 720 | |
| 721 | Player_fire_packetcxx . . $ Player_fire_packet.[i].fired_on_this_framecxx . . $ player_fire_packet#fired_on_this_frame. = PFP_NO_FIREDcxx . . $ `Descent3/multi.h:659:9`!; |
| 722 | |
| 723 | Multi_reliable_send_sizecxx . . $ Multi_reliable_send_size.[i] = 0; |
| 724 | Multi_reliable_last_send_timecxx . . $ Multi_reliable_last_send_time.[i] = 0; |
| 725 | |
| 726 | Multi_reliable_urgentcxx . . $ Multi_reliable_urgent.[i] = 0; |
| 727 | Multi_last_send_visiblecxx . . $ Multi_last_send_visible.[i] = 0; |
| 728 | Multi_visible_playerscxx . . $ Multi_visible_players.[i] = 0xFFFFFFFF; |
| 729 | |
| 730 | Num_moved_robotscxx . . $ Num_moved_robots.[i] = 0; |
| 731 | Num_changed_animcxx . . $ Num_changed_anim.[i] = 0; |
| 732 | Num_changed_turretcxx . . $ Num_changed_turret.[i] = 0; |
| 733 | Num_changed_wb_animcxx . . $ Num_changed_wb_anim.[i] = 0; |
| 734 | last_sent_bytescxx . . $ last_sent_bytes.[i] = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!(); |
| 735 | NetPlayerscxx . . $ NetPlayers.[i].file_xfer_flagscxx . . $ netplayer#file_xfer_flags. = NETFILE_NONEcxx . . $ `Descent3/multi.h:683:9`!; |
| 736 | NetPlayerscxx . . $ NetPlayers.[i].ship_logocxx . . $ netplayer#ship_logo.[0] = 0; |
| 737 | NetPlayerscxx . . $ NetPlayers.[i].voice_taunt1cxx . . $ netplayer#voice_taunt1.[0] = 0; |
| 738 | NetPlayerscxx . . $ NetPlayers.[i].voice_taunt2cxx . . $ netplayer#voice_taunt2.[0] = 0; |
| 739 | NetPlayerscxx . . $ NetPlayers.[i].voice_taunt3cxx . . $ netplayer#voice_taunt3.[0] = 0; |
| 740 | NetPlayerscxx . . $ NetPlayers.[i].voice_taunt4cxx . . $ netplayer#voice_taunt4.[0] = 0; |
| 741 | NetPlayerscxx . . $ NetPlayers.[i].pilot_pic_idcxx . . $ netplayer#pilot_pic_id. = PPIC_INVALID_IDcxx . . $ `Descent3/pilot_class.h:126:9`!; |
| 742 | NetPlayerscxx . . $ NetPlayers.[i].custom_file_seqcxx . . $ netplayer#custom_file_seq. = NETFILE_ID_NOFILEcxx . . $ `Descent3/multi.h:688:9`!; |
| 743 | PlayerSetCustomTexturecxx . . $ PlayerSetCustomTexture(3c8082c546dd2ea0).(i, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 744 | |
| 745 | NetPlayerscxx . . $ NetPlayers.[i].ping_timecxx . . $ netplayer#ping_time. = 0; |
| 746 | NetPlayerscxx . . $ NetPlayers.[i].last_ping_timecxx . . $ netplayer#last_ping_time. = 0; |
| 747 | } |
| 748 | NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].custom_file_seqcxx . . $ netplayer#custom_file_seq. = 0xff; |
| 749 | Current_pilotcxx . . $ Current_pilot..get_multiplayer_datacxx . . $ pilot#get_multiplayer_data(ea6e7aa10f4b80f5).(NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].ship_logocxx . . $ netplayer#ship_logo., NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].voice_taunt1cxx . . $ netplayer#voice_taunt1., |
| 750 | NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].voice_taunt2cxx . . $ netplayer#voice_taunt2., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].voice_taunt3cxx . . $ netplayer#voice_taunt3., |
| 751 | NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].voice_taunt4cxx . . $ netplayer#voice_taunt4.); |
| 752 | |
| 753 | // ship_logo |
| 754 | if (NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].ship_logocxx . . $ netplayer#ship_logo.[0]) |
| 755 | PlayerSetCustomTexturecxx . . $ PlayerSetCustomTexture(3c8082c546dd2ea0).(Player_numcxx . . $ Player_num., NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].ship_logocxx . . $ netplayer#ship_logo.); |
| 756 | |
| 757 | Player_numcxx . . $ Player_num. = 0; |
| 758 | NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].flagscxx . . $ netplayer#flags. = NPF_SERVERcxx . . $ `Descent3/multi_external.h:166:9`! | NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!; |
| 759 | |
| 760 | // Strip trailing .d3m if there is one |
| 761 | int sl = strlen(scriptname); |
| 762 | if (scriptname[sl - 4] == '.' && scriptname[sl - 3] == 'd' && scriptname[sl - 2] == '3' && scriptname[sl - 1] == 'm') |
| 763 | scriptname[sl - 4] = 0; |
| 764 | |
| 765 | NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].sequencecxx . . $ netplayer#sequence. = NETSEQ_PREGAMEcxx . . $ `Descent3/multi_external.h:148:9`!; |
| 766 | |
| 767 | Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. = LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!; |
| 768 | Netgamecxx . . $ Netgame..server_sequencecxx . . $ netgame_info#server_sequence. = 0; |
| 769 | Netgamecxx . . $ Netgame..server_versioncxx . . $ netgame_info#server_version. = MULTI_VERSIONcxx . . $ `Descent3/multi.h:517:9`!; |
| 770 | |
| 771 | Game_modecxx . . $ Game_mode. = GM_NETWORKcxx . . $ `Descent3/game.h:281:9`!; |
| 772 | |
| 773 | // Setup audio taunt delay time |
| 774 | int audiotauntdelayarg = FindArgcxx . . $ FindArg(5c4306d8553b3696).("-audiotauntdelay"); |
| 775 | if (audiotauntdelayarg > 0) { |
| 776 | float t; |
| 777 | char adt_str[64], *p; |
| 778 | strcpy(adt_str, GameArgscxx . . $ GameArgs.[audiotauntdelayarg + 1]); |
| 779 | p = adt_str; |
| 780 | while (*p && (*p == ' ' || *p == '\t')) |
| 781 | p++; |
| 782 | t = atof(p); |
| 783 | if (t == 0) |
| 784 | t = 5.0f; |
| 785 | |
| 786 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "MULTI: Setting audio taunt delay time to %.2f seconds\n", t); |
| 787 | taunt_SetDelayTimecxx . . $ taunt_SetDelayTime(9364e6e7bff7660).(t); |
| 788 | } else { |
| 789 | taunt_SetDelayTimecxx . . $ taunt_SetDelayTime(9364e6e7bff7660).(5.0f); |
| 790 | } |
| 791 | |
| 792 | // Temporary name fix |
| 793 | Current_pilotcxx . . $ Current_pilot..get_namecxx . . $ pilot#get_name(fda57c8427c60377).(Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].callsigncxx . . $ player#callsign.); |
| 794 | |
| 795 | // setup the server's pilot id |
| 796 | Current_pilotcxx . . $ Current_pilot..get_multiplayer_datacxx . . $ pilot#get_multiplayer_data(ea6e7aa10f4b80f5).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, &NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].pilot_pic_idcxx . . $ netplayer#pilot_pic_id.); |
| 797 | |
| 798 | // Choose ship |
| 799 | char pshipmodel[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!]; |
| 800 | Current_pilotcxx . . $ Current_pilot..get_shipcxx . . $ pilot#get_ship(fda57c8427c60377).(pshipmodel); |
| 801 | |
| 802 | Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].ship_indexcxx . . $ player#ship_index. = FindShipNamecxx . . $ FindShipName(5c4306d8553b3696).(pshipmodel); |
| 803 | if (Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].ship_indexcxx . . $ player#ship_index. < 0) |
| 804 | Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].ship_indexcxx . . $ player#ship_index. = 0; |
| 805 | |
| 806 | SetGamemodeScriptcxx . . $ SetGamemodeScript(34d26762b42c433a).(scriptname, dedicated_server_num_teams); |
| 807 | |
| 808 | MultiFlushAllIncomingBufferscxx . . $ MultiFlushAllIncomingBuffers(49f6e7a06ebc5aa8).(); |
| 809 | #ifdef USE_DIRECTPLAY |
| 810 | dp_StartGame(Netgame.name); |
| 811 | #endif |
| 812 | |
| 813 | // gspy_StartGame(Netgame.name); |
| 814 | // We use this to identify clients.... |
| 815 | ps_srandcxx . . $ ps_srand(cb2f890c2fdad230).(timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!()); |
| 816 | Secret_net_idcxx . . $ Secret_net_id. = ps_randcxx . . $ ps_rand(b126dc7c1de90089).() * ps_randcxx . . $ ps_rand(b126dc7c1de90089).(); |
| 817 | LastPacketReceivedcxx . . $ LastPacketReceived. = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!(); |
| 818 | |
| 819 | // At this point we have a level checksum, so add the ships into the mix |
| 820 | for (int i = 0; i < MAX_SHIPScxx . . $ `Descent3/ship.h:122:9`!; i++) |
| 821 | if (Shipscxx . . $ Ships.[i].usedcxx . . $ ship#used.) |
| 822 | MultiGetShipChecksumcxx . . $ MultiGetShipChecksum(7864480464b09eea).(i); |
| 823 | } |
| 824 | |
| 825 | // Checks if the selected mission and script are compatible |
| 826 | // Return values: |
| 827 | //-1 Not compatible! |
| 828 | //>=0 Number of teams supported for this mod & level |
| 829 | |
| 830 | #define SCRIPTBADFORMISSIONcxx . . $ `Descent3/multi_server.cpp:830:9`! -1 |
| 831 | |
| 832 | int CheckMissionForScriptcxx . . $ CheckMissionForScript(60b24ab836da28f5).(char *mission, char *script, int dedicated_server_num_teams) { |
| 833 | char mod_keys[MAX_KEYWORDLENcxx . . $ `Descent3/Mission.h:186:9`!]; |
| 834 | if (!GetDLLRequirementscxx . . $ GetDLLRequirements(89c8e27db0bdb94e).(script, mod_keys, MAX_KEYWORDLENcxx . . $ `Descent3/Mission.h:186:9`!)) { |
| 835 | return SCRIPTBADFORMISSIONcxx . . $ `Descent3/multi_server.cpp:830:9`!; |
| 836 | } |
| 837 | int teams = MissionGetKeywordscxx . . $ MissionGetKeywords(2f051e3560ff300f).(mission, mod_keys); |
| 838 | // Bad match! |
| 839 | if (teams == -1) { |
| 840 | if (!Dedicated_servercxx . . $ Dedicated_server.) { |
| 841 | DoMessageBoxcxx . . $ DoMessageBox(dcc99837539e9edc).(script, TXT_MSNNOTCOMPATIBLEcxx . . $ `Descent3/stringtable.h:838:9`!, MSGBOX_OKcxx . . $ `Descent3/newui_core.h:78:9`!); |
| 842 | return SCRIPTBADFORMISSIONcxx . . $ `Descent3/multi_server.cpp:830:9`!; |
| 843 | } else { |
| 844 | PrintDedicatedMessagecxx . . $ PrintDedicatedMessage(326aeb464d16410c).(TXT_MSNNOTCOMPATIBLEcxx . . $ `Descent3/stringtable.h:838:9`!); |
| 845 | PrintDedicatedMessagecxx . . $ PrintDedicatedMessage(326aeb464d16410c).("\n"); |
| 846 | } |
| 847 | } |
| 848 | |
| 849 | // See how many teams this dll will allow. |
| 850 | int desired_teams = 1; |
| 851 | int max_teams, min_teams; |
| 852 | |
| 853 | GetDLLNumTeamInfocxx . . $ GetDLLNumTeamInfo(f3a8223d1a54ec76).(script, &min_teams, &max_teams); |
| 854 | |
| 855 | if (min_teams > teams) { |
| 856 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "This multiplayer game requires more teams than the mission supports!\n"); |
| 857 | return SCRIPTBADFORMISSIONcxx . . $ `Descent3/multi_server.cpp:830:9`!; |
| 858 | } |
| 859 | // Use whatever is smaller, the dll's max teams, or what the missions supports |
| 860 | if (max_teams > teams) |
| 861 | max_teams = teams; |
| 862 | |
| 863 | if (Dedicated_servercxx . . $ Dedicated_server.) { |
| 864 | teams = min_teams; |
| 865 | |
| 866 | if (min_teams != max_teams) { |
| 867 | // they can set the number of teams for this game |
| 868 | // make sure it's valid |
| 869 | if (dedicated_server_num_teams >= min_teams && dedicated_server_num_teams <= max_teams) { |
| 870 | teams = dedicated_server_num_teams; |
| 871 | } else { |
| 872 | // invalid num teams |
| 873 | PrintDedicatedMessagecxx . . $ PrintDedicatedMessage(326aeb464d16410c).(TXT_INVALIDNUMTEAMScxx . . $ `Descent3/stringtable.h:785:9`!, teams); |
| 874 | PrintDedicatedMessagecxx . . $ PrintDedicatedMessage(326aeb464d16410c).("\n"); |
| 875 | } |
| 876 | } |
| 877 | |
| 878 | } else { |
| 879 | if (min_teams != max_teams) { |
| 880 | char a_num_teams[5]; |
| 881 | char team_count_msg[300]; |
| 882 | snprintf(a_num_teams, sizeof(a_num_teams), "%d", min_teams); |
| 883 | snprintf(team_count_msg, sizeof(team_count_msg), "%s %s (%d - %d)", TXT_TEAMCOUNTPROMPTcxx . . $ `Descent3/stringtable.h:782:9`!, script, min_teams, |
| 884 | max_teams); |
| 885 | retry_team_count: |
| 886 | int res = DoEditDialogcxx . . $ DoEditDialog(79e5ffcc21f8a1c7).(team_count_msg, a_num_teams, 4); |
| 887 | if (res) { |
| 888 | desired_teams = atoi(a_num_teams); |
| 889 | if ((desired_teams > max_teams) || (desired_teams < min_teams)) { |
| 890 | DoMessageBoxcxx . . $ DoMessageBox(dcc99837539e9edc).(script, TXT_INVALIDTEAMCOUNTcxx . . $ `Descent3/stringtable.h:590:9`!, MSGBOX_OKcxx . . $ `Descent3/newui_core.h:78:9`!); |
| 891 | goto retry_team_count; |
| 892 | } else { |
| 893 | teams = desired_teams; |
| 894 | } |
| 895 | } else { |
| 896 | return SCRIPTBADFORMISSIONcxx . . $ `Descent3/multi_server.cpp:830:9`!; |
| 897 | } |
| 898 | } |
| 899 | } |
| 900 | |
| 901 | return teams; |
| 902 | } |
| 903 | |
| 904 | // multi_check_listen() calls low level routines to see if we have a connection from a client we |
| 905 | // should accept. |
| 906 | void MultiCheckListencxx . . $ MultiCheckListen(49f6e7a06ebc5aa8).() { |
| 907 | int i; |
| 908 | network_addresscxx . . $ network_address# addr; |
| 909 | SOCKETcxx . . $ `lib/networking.h:217:9`! sock = INVALID_SOCKETcxx . . $ `lib/networking.h:221:9`!; |
| 910 | |
| 911 | // call routine which calls select to see if we need to check for a connect from a client |
| 912 | // by passing addr, we are telling check_for_listen to do the accept and return who it was from in |
| 913 | // addr. The |
| 914 | sock = nw_CheckListenSocketcxx . . $ nw_CheckListenSocket(974bd2fc5f961852).(&addr); |
| 915 | if (sock != INVALID_SOCKETcxx . . $ `lib/networking.h:221:9`!) { |
| 916 | // the connection was accepted. Find a free slot for this new player |
| 917 | for (i = 0; i < MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!; i++) { |
| 918 | if (i == Player_numcxx . . $ Player_num.) |
| 919 | continue; |
| 920 | |
| 921 | if (!(NetPlayerscxx . . $ NetPlayers.[i].flagscxx . . $ netplayer#flags. & NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!)) { |
| 922 | // This slot is free! |
| 923 | MultiSendConnectionAcceptedcxx . . $ MultiSendConnectionAccepted(151c8734e58a666a).(i, sock, &addr); |
| 924 | break; |
| 925 | } |
| 926 | } |
| 927 | |
| 928 | // if we didn't find a player, close the socket |
| 929 | if (i == MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!) { |
| 930 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Got accept on my listen socket, but no free slots. Closing socket.\n"); |
| 931 | nw_CloseSocketcxx . . $ nw_CloseSocket(11b0e290e57a7e53).(&sock); |
| 932 | } |
| 933 | } |
| 934 | } |
| 935 | |
| 936 | // Tells the client that we're done sending players |
| 937 | void MultiSendDonePlayerscxx . . $ MultiSendDonePlayers(d4f767463ce0a6b3).(int slot) { |
| 938 | int size; |
| 939 | uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 940 | int count = 0; |
| 941 | |
| 942 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Sending done players\n"); |
| 943 | |
| 944 | size = START_DATAcxx . . $ START_DATA(8c36ee1faa9e0a0b).(MP_DONE_PLAYERScxx . . $ `Descent3/multi.h:530:9`!, data, &count); |
| 945 | int num = MultiCountPlayerscxx . . $ MultiCountPlayers(b126dc7c1de90089).(); |
| 946 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(num, data, &count); |
| 947 | END_DATAcxx . . $ END_DATA(dde21517a502ab05).(count, data, size); |
| 948 | |
| 949 | nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[slot].reliable_socketcxx . . $ netplayer#reliable_socket., data, count); |
| 950 | } |
| 951 | |
| 952 | // Tells the client that we're done sending buildings |
| 953 | void MultiSendDoneBuildingscxx . . $ MultiSendDoneBuildings(d4f767463ce0a6b3).(int slot) { |
| 954 | int size; |
| 955 | uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 956 | int count = 0; |
| 957 | |
| 958 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Sending done buildings\n"); |
| 959 | |
| 960 | size = START_DATAcxx . . $ START_DATA(8c36ee1faa9e0a0b).(MP_DONE_BUILDINGScxx . . $ `Descent3/multi.h:539:9`!, data, &count); |
| 961 | END_DATAcxx . . $ END_DATA(dde21517a502ab05).(count, data, size); |
| 962 | |
| 963 | nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[slot].reliable_socketcxx . . $ netplayer#reliable_socket., data, count); |
| 964 | } |
| 965 | |
| 966 | // Tells the client that we're done sending objects |
| 967 | void MultiSendDoneObjectscxx . . $ MultiSendDoneObjects(d4f767463ce0a6b3).(int slot) { |
| 968 | int size; |
| 969 | uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 970 | int count = 0; |
| 971 | |
| 972 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Sending done objects\n"); |
| 973 | |
| 974 | // Take the level checksum and clone it. |
| 975 | MD5cxx . . $ MD5# playermd5(*Level_md5cxx . . $ Level_md5.); |
| 976 | // Generate a random salt value and send it to the client. |
| 977 | int salt = ps_randcxx . . $ ps_rand(b126dc7c1de90089).(); |
| 978 | // process the salt through the md5 |
| 979 | playermd5.updatecxx . . $ MD5#update(f349c77f591a7878).(salt); |
| 980 | // process the ships through the md5 |
| 981 | for (int i = 0; i < MAX_SHIPScxx . . $ `Descent3/ship.h:122:9`!; i++) |
| 982 | if (Shipscxx . . $ Ships.[i].usedcxx . . $ ship#used.) |
| 983 | MultiProcessShipChecksumcxx . . $ MultiProcessShipChecksum(54a9d97b34104f61).(&playermd5, i); |
| 984 | // save the digest value in the netplayer slot |
| 985 | playermd5.digestcxx . . $ MD5#digest(2c93ef52c863c53f).(NetPlayerscxx . . $ NetPlayers.[slot].digestcxx . . $ netplayer#digest.); |
| 986 | |
| 987 | size = START_DATAcxx . . $ START_DATA(8c36ee1faa9e0a0b).(MP_DONE_OBJECTScxx . . $ `Descent3/multi.h:542:9`!, data, &count); |
| 988 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(salt, data, &count); |
| 989 | END_DATAcxx . . $ END_DATA(dde21517a502ab05).(count, data, size); |
| 990 | |
| 991 | nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[slot].reliable_socketcxx . . $ netplayer#reliable_socket., data, count); |
| 992 | } |
| 993 | |
| 994 | // Tells the client that we're done sending the world states |
| 995 | void MultiSendDoneWorldStatescxx . . $ MultiSendDoneWorldStates(d4f767463ce0a6b3).(int slot) { |
| 996 | int size; |
| 997 | uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 998 | int count = 0; |
| 999 | |
| 1000 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Sending done world states\n"); |
| 1001 | |
| 1002 | size = START_DATAcxx . . $ START_DATA(8c36ee1faa9e0a0b).(MP_DONE_WORLD_STATEScxx . . $ `Descent3/multi.h:610:9`!, data, &count); |
| 1003 | END_DATAcxx . . $ END_DATA(dde21517a502ab05).(count, data, size); |
| 1004 | |
| 1005 | nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[slot].reliable_socketcxx . . $ netplayer#reliable_socket., data, count); |
| 1006 | } |
| 1007 | |
| 1008 | // Clears all the player markers belonging to a particular slot |
| 1009 | void MultiClearPlayerMarkerscxx . . $ MultiClearPlayerMarkers(d4f767463ce0a6b3).(int slot) { |
| 1010 | int m1 = slot * 2; |
| 1011 | int m2 = (slot * 2) + 1; |
| 1012 | |
| 1013 | for (int i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) { |
| 1014 | if (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_MARKERcxx . . $ `Descent3/object_external.h:175:9`! && (Objectscxx . . $ Objects.[i].idcxx . . $ object#id. == m1 || Objectscxx . . $ Objects.[i].idcxx . . $ object#id. == m2)) { |
| 1015 | SetObjectDeadFlagcxx . . $ SetObjectDeadFlag(80a724877f6428f2).(&Objectscxx . . $ Objects.[i], true, false); |
| 1016 | } |
| 1017 | } |
| 1018 | } |
| 1019 | |
| 1020 | // Tells our clients that a player disconnected |
| 1021 | void MultiSendPlayerDisconnectcxx . . $ MultiSendPlayerDisconnect(d4f767463ce0a6b3).(int slot) { |
| 1022 | int size, count = 0; |
| 1023 | uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 1024 | |
| 1025 | size = START_DATAcxx . . $ START_DATA(8c36ee1faa9e0a0b).(MP_DISCONNECTcxx . . $ `Descent3/multi.h:532:9`!, data, &count); |
| 1026 | |
| 1027 | // Send player whose disconnected |
| 1028 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(slot, data, &count); |
| 1029 | |
| 1030 | END_DATAcxx . . $ END_DATA(dde21517a502ab05).(count, data, size); |
| 1031 | |
| 1032 | if (Game_is_master_tracker_gamecxx . . $ Game_is_master_tracker_game.) { |
| 1033 | NetPlayerscxx . . $ NetPlayers.[slot].flagscxx . . $ netplayer#flags. |= NPF_MT_WRITING_PILOTcxx . . $ `Descent3/multi_external.h:169:9`!; |
| 1034 | } |
| 1035 | for (int i = 0; i < MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!; i++) { |
| 1036 | if (i == Player_numcxx . . $ Player_num. || i == slot) |
| 1037 | continue; |
| 1038 | |
| 1039 | if (NetPlayerscxx . . $ NetPlayers.[i].flagscxx . . $ netplayer#flags. & NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!) |
| 1040 | nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[i].reliable_socketcxx . . $ netplayer#reliable_socket., data, count); |
| 1041 | } |
| 1042 | } |
| 1043 | |
| 1044 | #define DISCONNECT_TIMEcxx . . $ `Descent3/multi_server.cpp:1044:9`! 10 |
| 1045 | // Disconnects all players that haven't been heard from in a while |
| 1046 | // Server only |
| 1047 | void MultiDisconnectDeadPlayerscxx . . $ MultiDisconnectDeadPlayers(49f6e7a06ebc5aa8).() { |
| 1048 | for (int i = 0; i < MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!; i++) { |
| 1049 | if (i == Player_numcxx . . $ Player_num.) |
| 1050 | continue; |
| 1051 | |
| 1052 | if (NetPlayerscxx . . $ NetPlayers.[i].flagscxx . . $ netplayer#flags. & NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!) { |
| 1053 | float cur_time = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!(); |
| 1054 | |
| 1055 | if (!nw_CheckReliableSocketcxx . . $ nw_CheckReliableSocket(7864480464b09eea).(NetPlayerscxx . . $ NetPlayers.[i].reliable_socketcxx . . $ netplayer#reliable_socket.)) { |
| 1056 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Disconnecting player %d because the reliable socket closed.\n", i); |
| 1057 | AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).("%s (%s)", TXT_RELIABLE_OVERRUNcxx . . $ `Descent3/stringtable.h:921:9`!, Playerscxx . . $ Players.[i].callsigncxx . . $ player#callsign.); |
| 1058 | MultiDisconnectPlayercxx . . $ MultiDisconnectPlayer(d4f767463ce0a6b3).(i); |
| 1059 | } else if (NetPlayerscxx . . $ NetPlayers.[i].sequencecxx . . $ netplayer#sequence. > NETSEQ_LEVEL_STARTcxx . . $ `Descent3/multi_external.h:150:9`! && NetPlayerscxx . . $ NetPlayers.[i].sequencecxx . . $ netplayer#sequence. != NETSEQ_LEVEL_ENDcxx . . $ `Descent3/multi_external.h:162:9`!) { |
| 1060 | if (cur_time - NetPlayerscxx . . $ NetPlayers.[i].last_packet_timecxx . . $ netplayer#last_packet_time. > DISCONNECT_TIMEcxx . . $ `Descent3/multi_server.cpp:1044:9`!) { |
| 1061 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "8sec disconnecting player %d. Last packet time=%f Sequence=%d\n", |
| 1062 | i, |
| 1063 | cur_time - NetPlayers[i].last_packet_time, |
| 1064 | NetPlayers[i].sequence); |
| 1065 | MultiDisconnectPlayercxx . . $ MultiDisconnectPlayer(d4f767463ce0a6b3).(i); |
| 1066 | } |
| 1067 | } else // If not playing (ie joining, give them longer) |
| 1068 | { |
| 1069 | if (cur_time - NetPlayerscxx . . $ NetPlayers.[i].last_packet_timecxx . . $ netplayer#last_packet_time. > (DISCONNECT_TIMEcxx . . $ `Descent3/multi_server.cpp:1044:9`! * 15)) { |
| 1070 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Too long...disconnecting player %d. Last packet time=%f Sequence=%d\n", |
| 1071 | i, |
| 1072 | cur_time - NetPlayers[i].last_packet_time, |
| 1073 | NetPlayers[i].sequence); |
| 1074 | MultiDisconnectPlayercxx . . $ MultiDisconnectPlayer(d4f767463ce0a6b3).(i); |
| 1075 | } |
| 1076 | } |
| 1077 | } |
| 1078 | } |
| 1079 | } |
| 1080 | |
| 1081 | // Disconnect a player for whatever reason |
| 1082 | // Server only |
| 1083 | void MultiDisconnectPlayercxx . . $ MultiDisconnectPlayer(d4f767463ce0a6b3).(int slot) { |
| 1084 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Netgame.local_role == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!); |
| 1085 | |
| 1086 | DLLInfocxx . . $ DLLInfo..me_handlecxx . . $ dllinfo#me_handle. = DLLInfocxx . . $ DLLInfo..it_handlecxx . . $ dllinfo#it_handle. = Objectscxx . . $ Objects.[Playerscxx . . $ Players.[slot].objnumcxx . . $ player#objnum.].handlecxx . . $ object#handle.; |
| 1087 | CallGameDLLcxx . . $ CallGameDLL(32ca0c0c7dbc2fcf).(EVT_GAMEPLAYERDISCONNECTcxx . . $ `lib/d3events.h:71:9`!, &DLLInfocxx . . $ DLLInfo.); |
| 1088 | |
| 1089 | if (NetPlayerscxx . . $ NetPlayers.[slot].flagscxx . . $ netplayer#flags. & NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!) { |
| 1090 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Disconnecting player %d (%s)...\n", slot, Players[slot].callsign); |
| 1091 | if (NetPlayerscxx . . $ NetPlayers.[slot].file_xfer_flagscxx . . $ netplayer#file_xfer_flags. != NETFILE_NONEcxx . . $ `Descent3/multi.h:683:9`!) { |
| 1092 | MultiCancelFilecxx . . $ MultiCancelFile(b1146eedae1e1d0b).(slot, NetPlayerscxx . . $ NetPlayers.[slot].custom_file_seqcxx . . $ netplayer#custom_file_seq., NetPlayerscxx . . $ NetPlayers.[slot].file_xfer_whocxx . . $ netplayer#file_xfer_who.); |
| 1093 | } |
| 1094 | nw_CloseSocketcxx . . $ nw_CloseSocket(11b0e290e57a7e53).(&NetPlayerscxx . . $ NetPlayers.[slot].reliable_socketcxx . . $ netplayer#reliable_socket.); |
| 1095 | |
| 1096 | if (NetPlayerscxx . . $ NetPlayers.[slot].sequencecxx . . $ netplayer#sequence. == NETSEQ_PLAYINGcxx . . $ `Descent3/multi_external.h:161:9`!) { |
| 1097 | PlayerSpewInventorycxx . . $ PlayerSpewInventory(80a724877f6428f2).(&Objectscxx . . $ Objects.[Playerscxx . . $ Players.[slot].objnumcxx . . $ player#objnum.], true, true); |
| 1098 | MultiMakePlayerGhostcxx . . $ MultiMakePlayerGhost(d4f767463ce0a6b3).(slot); |
| 1099 | AddHUDMessagecxx . . $ AddHUDMessage(f90d95ab21fd6d97).(TXT_MLTDISCONNECTEDcxx . . $ `Descent3/stringtable.h:278:9`!, Playerscxx . . $ Players.[slot].callsigncxx . . $ player#callsign.); |
| 1100 | } |
| 1101 | |
| 1102 | NetPlayerscxx . . $ NetPlayers.[slot].flagscxx . . $ netplayer#flags. &= ~NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!; |
| 1103 | NetPlayerscxx . . $ NetPlayers.[slot].secret_net_idcxx . . $ netplayer#secret_net_id. = 0; |
| 1104 | MultiClearGuidebotcxx . . $ MultiClearGuidebot(d4f767463ce0a6b3).(slot); |
| 1105 | MultiClearPlayerMarkerscxx . . $ MultiClearPlayerMarkers(d4f767463ce0a6b3).(slot); |
| 1106 | MultiSendPlayerDisconnectcxx . . $ MultiSendPlayerDisconnect(d4f767463ce0a6b3).(slot); |
| 1107 | Playerscxx . . $ Players.[slot].flagscxx . . $ player#flags. = 0; |
| 1108 | |
| 1109 | } else |
| 1110 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Trying to disconnect a non-existant player!\n"); |
| 1111 | } |
| 1112 | |
| 1113 | // Sends existing players to a joining player |
| 1114 | // Sends to "slot" and describes player "which" |
| 1115 | // Server only |
| 1116 | void MultiSendPlayercxx . . $ MultiSendPlayer(3e454b8ccf442868).(int slot, int which) { |
| 1117 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Netgame.local_role == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!); |
| 1118 | |
| 1119 | uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 1120 | int count = 0; |
| 1121 | int size_offset; |
| 1122 | |
| 1123 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Sending MP_PLAYER packet to player %d!\n", slot); |
| 1124 | |
| 1125 | size_offset = START_DATAcxx . . $ START_DATA(8c36ee1faa9e0a0b).(MP_PLAYERcxx . . $ `Descent3/multi.h:525:9`!, data, &count); |
| 1126 | |
| 1127 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(which, data, &count); |
| 1128 | |
| 1129 | // Add name |
| 1130 | int len = strlen(Playerscxx . . $ Players.[which].callsigncxx . . $ player#callsign.) + 1; |
| 1131 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(len, data, &count); |
| 1132 | memcpy(&data[count], Playerscxx . . $ Players.[which].callsigncxx . . $ player#callsign., len); |
| 1133 | count += len; |
| 1134 | |
| 1135 | // Add name |
| 1136 | len = strlen(Shipscxx . . $ Ships.[Playerscxx . . $ Players.[which].ship_indexcxx . . $ player#ship_index.].namecxx . . $ ship#name.) + 1; |
| 1137 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(len, data, &count); |
| 1138 | memcpy(&data[count], Shipscxx . . $ Ships.[Playerscxx . . $ Players.[which].ship_indexcxx . . $ player#ship_index.].namecxx . . $ ship#name., len); |
| 1139 | count += len; |
| 1140 | |
| 1141 | // Add flags, shields, inventory |
| 1142 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(Playerscxx . . $ Players.[which].flagscxx . . $ player#flags., data, &count); |
| 1143 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(Playerscxx . . $ Players.[which].weapon_flagscxx . . $ player#weapon_flags., data, &count); |
| 1144 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(NetPlayerscxx . . $ NetPlayers.[which].flagscxx . . $ netplayer#flags., data, &count); |
| 1145 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(Objectscxx . . $ Objects.[Playerscxx . . $ Players.[which].objnumcxx . . $ player#objnum.].shieldscxx . . $ object#shields., data, &count); |
| 1146 | |
| 1147 | // Add position, roomnum, and terrain flag |
| 1148 | |
| 1149 | // Just for safety sake add the object number |
| 1150 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(Playerscxx . . $ Players.[which].objnumcxx . . $ player#objnum., data, &count); |
| 1151 | |
| 1152 | // If this is a team game, get the first start position |
| 1153 | if (slot == which) { |
| 1154 | int myteam = GameDLLGetConnectingPlayersTeamcxx . . $ GameDLLGetConnectingPlayersTeam(7864480464b09eea).(slot); |
| 1155 | |
| 1156 | uint8_tcxx . . $ uint8_t# temp_team = (myteam == -1) ? 255 : myteam; |
| 1157 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(temp_team, data, &count); |
| 1158 | |
| 1159 | if (myteam >= 0 && myteam <= 4) |
| 1160 | Playerscxx . . $ Players.[slot].teamcxx . . $ player#team. = myteam; |
| 1161 | |
| 1162 | if (temp_team == 255) |
| 1163 | Playerscxx . . $ Players.[slot].start_indexcxx . . $ player#start_index. = slot; |
| 1164 | else |
| 1165 | Playerscxx . . $ Players.[slot].start_indexcxx . . $ player#start_index. = PlayerGetRandomStartPositioncxx . . $ PlayerGetRandomStartPosition(7864480464b09eea).(slot); |
| 1166 | |
| 1167 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(Playerscxx . . $ Players.[slot].start_indexcxx . . $ player#start_index., data, &count); |
| 1168 | } else { |
| 1169 | uint8_tcxx . . $ uint8_t# temp_team = (Playerscxx . . $ Players.[which].teamcxx . . $ player#team. == -1) ? 255 : Playerscxx . . $ Players.[which].teamcxx . . $ player#team.; |
| 1170 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(temp_team, data, &count); |
| 1171 | } |
| 1172 | |
| 1173 | // Tell them if this player is currently observing |
| 1174 | if (Objectscxx . . $ Objects.[Playerscxx . . $ Players.[which].objnumcxx . . $ player#objnum.].typecxx . . $ object#type. == OBJ_OBSERVERcxx . . $ `Descent3/object_external.h:182:9`!) |
| 1175 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(1, data, &count); |
| 1176 | else |
| 1177 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(0, data, &count); |
| 1178 | |
| 1179 | // send the player's address |
| 1180 | memcpy(data + count, &NetPlayerscxx . . $ NetPlayers.[which].addrcxx . . $ netplayer#addr., sizeof(network_addresscxx . . $ network_address#)); |
| 1181 | count += sizeof(network_addresscxx . . $ network_address#); |
| 1182 | |
| 1183 | // PPS |
| 1184 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(NetPlayerscxx . . $ NetPlayers.[which].ppscxx . . $ netplayer#pps., data, &count); |
| 1185 | |
| 1186 | // pilot picture id |
| 1187 | MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(NetPlayerscxx . . $ NetPlayers.[which].pilot_pic_idcxx . . $ netplayer#pilot_pic_id., data, &count); |
| 1188 | |
| 1189 | // Ranking |
| 1190 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(Playerscxx . . $ Players.[which].rankcxx . . $ player#rank., data, &count); |
| 1191 | |
| 1192 | // Mastertracker id |
| 1193 | if (Game_is_master_tracker_gamecxx . . $ Game_is_master_tracker_game.) { |
| 1194 | int len = strlen(Playerscxx . . $ Players.[which].tracker_idcxx . . $ player#tracker_id.) + 1; |
| 1195 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(len, data, &count); |
| 1196 | memcpy(&data[count], Playerscxx . . $ Players.[which].tracker_idcxx . . $ player#tracker_id., len); |
| 1197 | count += len; |
| 1198 | } |
| 1199 | |
| 1200 | END_DATAcxx . . $ END_DATA(dde21517a502ab05).(count, data, size_offset); |
| 1201 | |
| 1202 | // Send it out |
| 1203 | nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[slot].reliable_socketcxx . . $ netplayer#reliable_socket., data, count); |
| 1204 | } |
| 1205 | |
| 1206 | // Sends blownup buildings to a joining player |
| 1207 | // Server only |
| 1208 | void MultiSendBuildingscxx . . $ MultiSendBuildings(d4f767463ce0a6b3).(int slot) { |
| 1209 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Netgame.local_role == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!); |
| 1210 | |
| 1211 | uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 1212 | int count = 0; |
| 1213 | int size_offset; |
| 1214 | |
| 1215 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Sending MP_BUILDING packet to player %d!\n", slot); |
| 1216 | |
| 1217 | size_offset = START_DATAcxx . . $ START_DATA(8c36ee1faa9e0a0b).(MP_BUILDINGcxx . . $ `Descent3/multi.h:541:9`!, data, &count); |
| 1218 | |
| 1219 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(Multi_num_buildings_changedcxx . . $ Multi_num_buildings_changed., data, &count); |
| 1220 | |
| 1221 | for (int i = 0; i < MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!; i++) { |
| 1222 | if (Multi_building_statescxx . . $ Multi_building_states.[i] != 0) { |
| 1223 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).((uint16_tcxx . . $ uint16_t#)i, data, &count); |
| 1224 | } |
| 1225 | } |
| 1226 | |
| 1227 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(count < MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!); |
| 1228 | |
| 1229 | END_DATAcxx . . $ END_DATA(dde21517a502ab05).(count, data, size_offset); |
| 1230 | |
| 1231 | // Send it out |
| 1232 | nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[slot].reliable_socketcxx . . $ netplayer#reliable_socket., data, count); |
| 1233 | } |
| 1234 | |
| 1235 | // Returns true if we should send an update about this object |
| 1236 | bool MultiIsValidMovedObjectcxx . . $ MultiIsValidMovedObject(39516aeee13ca5ab).(objectcxx . . $ object# *obj) { |
| 1237 | bool good = false; |
| 1238 | |
| 1239 | if (obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || obj->typecxx . . $ object#type. == OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`! || obj->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`!) |
| 1240 | good = true; |
| 1241 | |
| 1242 | if (good == true) { |
| 1243 | if (obj->flagscxx . . $ object#flags. & (OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!)) |
| 1244 | good = false; |
| 1245 | if (!(obj->flagscxx . . $ object#flags. & OF_CLIENT_KNOWScxx . . $ `Descent3/object_external.h:289:9`!)) |
| 1246 | good = false; |
| 1247 | |
| 1248 | // Still going? Good! |
| 1249 | if (good == true) { |
| 1250 | if (obj->movement_typecxx . . $ object#movement_type. == MT_WALKINGcxx . . $ `Descent3/object_external.h:235:9`! || obj->movement_typecxx . . $ object#movement_type. == MT_PHYSICScxx . . $ `Descent3/object_external.h:234:9`!) |
| 1251 | return true; |
| 1252 | } |
| 1253 | } |
| 1254 | |
| 1255 | // Didn't pass all the tests else it wouldn't make it this fare |
| 1256 | return false; |
| 1257 | } |
| 1258 | |
| 1259 | void MultiSendJoinDemoObjectscxx . . $ MultiSendJoinDemoObjects(d4f767463ce0a6b3).(int slot) { |
| 1260 | uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 1261 | int count = 0; |
| 1262 | int size_offset, i; |
| 1263 | |
| 1264 | int num_demo_objects = 0; |
| 1265 | for (i = 0; i < MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!; i++) { |
| 1266 | if (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`! && Objectscxx . . $ Objects.[i].flagscxx . . $ object#flags. & OF_CLIENTDEMOOBJECTcxx . . $ `Descent3/object_external.h:303:9`!) { |
| 1267 | num_demo_objects++; |
| 1268 | } |
| 1269 | } |
| 1270 | |
| 1271 | ASSERTcxx . . $ `misc/pserror.h:246:9`!((num_demo_objects * sizeof(uint16_t) + sizeof(uint16_t)) < MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!); |
| 1272 | |
| 1273 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Sending DemoJoinObjects (%d)\n", num_demo_objects); |
| 1274 | |
| 1275 | count = 0; |
| 1276 | size_offset = START_DATAcxx . . $ START_DATA(8c36ee1faa9e0a0b).(MP_SEND_DEMO_OBJECT_FLAGScxx . . $ `Descent3/multi.h:634:9`!, data, &count); |
| 1277 | |
| 1278 | MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(num_demo_objects, data, &count); |
| 1279 | |
| 1280 | for (i = 0; i < MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!; i++) { |
| 1281 | if (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. != OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`! && Objectscxx . . $ Objects.[i].flagscxx . . $ object#flags. & OF_CLIENTDEMOOBJECTcxx . . $ `Descent3/object_external.h:303:9`!) { |
| 1282 | MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(i, data, &count); |
| 1283 | } |
| 1284 | } |
| 1285 | |
| 1286 | END_DATAcxx . . $ END_DATA(dde21517a502ab05).(count, data, size_offset); |
| 1287 | nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[slot].reliable_socketcxx . . $ netplayer#reliable_socket., data, count); |
| 1288 | } |
| 1289 | |
| 1290 | int StuffObjectIntoPacketcxx . . $ StuffObjectIntoPacket(1986db6aef80da2d).(objectcxx . . $ object# *obj, uint8_tcxx . . $ uint8_t# *data) { |
| 1291 | uint32_tcxx . . $ uint32_t# index; |
| 1292 | int count = 0; |
| 1293 | bool obj_is_dummy = false; |
| 1294 | |
| 1295 | MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(obj - Objectscxx . . $ Objects., data, &count); |
| 1296 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(obj->typecxx . . $ object#type., data, &count); |
| 1297 | |
| 1298 | // Send old object type if it's a dummy |
| 1299 | if (obj->typecxx . . $ object#type. == OBJ_DUMMYcxx . . $ `Descent3/object_external.h:181:9`!) { |
| 1300 | obj_is_dummy = true; |
| 1301 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(obj->dummy_typecxx . . $ object#dummy_type., data, &count); |
| 1302 | ObjUnGhostObjectcxx . . $ ObjUnGhostObject(d4f767463ce0a6b3).(obj - Objectscxx . . $ Objects.); |
| 1303 | } |
| 1304 | |
| 1305 | if (obj->typecxx . . $ object#type. != OBJ_CAMERAcxx . . $ `Descent3/object_external.h:169:9`! && obj->typecxx . . $ object#type. != OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!) { |
| 1306 | // Stuff the checksum |
| 1307 | index = MultiGetMatchChecksumcxx . . $ MultiGetMatchChecksum(58c590d1186ea715).(obj->typecxx . . $ object#type., obj->idcxx . . $ object#id.); |
| 1308 | MultiAddUintcxx . . $ MultiAddUint(c51d06dbd74b8495).(index, data, &count); |
| 1309 | } |
| 1310 | |
| 1311 | if (obj->typecxx . . $ object#type. != OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! && obj->typecxx . . $ object#type. != OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!) { |
| 1312 | multi_orientationcxx . . $ multi_orientation# mat; |
| 1313 | MultiMakeMatrixcxx . . $ MultiMakeMatrix(fa48605267a12641).(&mat, &obj->orientcxx . . $ object#orient.); |
| 1314 | MultiMatrixMakeEndianFriendlycxx . . $ MultiMatrixMakeEndianFriendly(65dda6e21b1f7c2d).(&mat); |
| 1315 | memcpy(&data[count], &mat, sizeof(multi_orientationcxx . . $ multi_orientation#)); |
| 1316 | count += sizeof(multi_orientationcxx . . $ multi_orientation#); |
| 1317 | } |
| 1318 | |
| 1319 | // Send position |
| 1320 | if (obj->typecxx . . $ object#type. != OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!) { |
| 1321 | // memcpy (&data[count],&obj->pos,sizeof(vector)); |
| 1322 | // count+=sizeof(vector); |
| 1323 | MultiAddVectorcxx . . $ MultiAddVector(f5e3e9791ffe6d9f).(obj->poscxx . . $ object#pos., data, &count); |
| 1324 | |
| 1325 | // Send room number and terrain flag |
| 1326 | MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(obj->roomnum), data, &count); |
| 1327 | |
| 1328 | if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(obj)) |
| 1329 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(1, data, &count); |
| 1330 | else |
| 1331 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(0, data, &count); |
| 1332 | |
| 1333 | if (obj->flagscxx . . $ object#flags. & OF_USES_LIFELEFTcxx . . $ `Descent3/object_external.h:276:9`!) { |
| 1334 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->lifeleft < 255); |
| 1335 | MultiAddUbytecxx . . $ MultiAddUbyte(3bbe8835367eaa4e).(obj->lifeleftcxx . . $ object#lifeleft., data, &count); |
| 1336 | } else |
| 1337 | MultiAddUbytecxx . . $ MultiAddUbyte(3bbe8835367eaa4e).(255, data, &count); |
| 1338 | } |
| 1339 | |
| 1340 | if (obj->typecxx . . $ object#type. == OBJ_MARKERcxx . . $ `Descent3/object_external.h:175:9`!) { |
| 1341 | // Add marker message to the end of this |
| 1342 | uint8_tcxx . . $ uint8_t# len = strlen(MarkerMessagescxx . . $ MarkerMessages.[obj->idcxx . . $ object#id.]) + 1; |
| 1343 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(len, data, &count); |
| 1344 | memcpy(data + count, MarkerMessagescxx . . $ MarkerMessages.[obj->idcxx . . $ object#id.], len); |
| 1345 | count += len; |
| 1346 | } |
| 1347 | |
| 1348 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(count < MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!); |
| 1349 | |
| 1350 | // we need to reghost the object if what originally a ghost |
| 1351 | if (obj_is_dummy) { |
| 1352 | ObjGhostObjectcxx . . $ ObjGhostObject(d4f767463ce0a6b3).(obj - Objectscxx . . $ Objects.); |
| 1353 | } |
| 1354 | |
| 1355 | return count; |
| 1356 | } |
| 1357 | |
| 1358 | // Sends objects to a joining player |
| 1359 | // Server only |
| 1360 | #define MAX_OBJECTS_PER_PACKETcxx . . $ `Descent3/multi_server.cpp:1360:9`! 50 |
| 1361 | void MultiSendJoinObjectscxx . . $ MultiSendJoinObjects(d4f767463ce0a6b3).(int slot) { |
| 1362 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Netgame.local_role == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!); |
| 1363 | |
| 1364 | uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 1365 | uint16_tcxx . . $ uint16_t# outgoing_objects[MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!]; |
| 1366 | int count = 0; |
| 1367 | int size_offset; |
| 1368 | int i; |
| 1369 | |
| 1370 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Sending MP_JOIN_OBJECTS packet to player %d!\n", slot); |
| 1371 | |
| 1372 | uint16_tcxx . . $ uint16_t# total_objects = 0; |
| 1373 | last_sent_bytescxx . . $ last_sent_bytes.[slot] = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!(); |
| 1374 | |
| 1375 | Num_moved_robotscxx . . $ Num_moved_robots.[slot] = 0; |
| 1376 | Num_changed_animcxx . . $ Num_changed_anim.[slot] = 0; |
| 1377 | Num_changed_turretcxx . . $ Num_changed_turret.[slot] = 0; |
| 1378 | Num_changed_wb_animcxx . . $ Num_changed_wb_anim.[slot] = 0; |
| 1379 | |
| 1380 | // Count how many powerups/robots we have to send and make a list |
| 1381 | for (i = 0; i < MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!; i++) { |
| 1382 | if (Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! || Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_MARKERcxx . . $ `Descent3/object_external.h:175:9`! || |
| 1383 | Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_CAMERAcxx . . $ `Descent3/object_external.h:169:9`! || Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_CLUTTERcxx . . $ `Descent3/object_external.h:171:9`! || Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`! || |
| 1384 | Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_DUMMYcxx . . $ `Descent3/object_external.h:181:9`! || Objectscxx . . $ Objects.[i].typecxx . . $ object#type. == OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!) { |
| 1385 | outgoing_objects[total_objects] = i; |
| 1386 | total_objects++; |
| 1387 | |
| 1388 | if (MultiIsValidMovedObjectcxx . . $ MultiIsValidMovedObject(39516aeee13ca5ab).(&Objectscxx . . $ Objects.[i])) { |
| 1389 | if (Num_changed_animcxx . . $ Num_changed_anim.[slot] < MAX_CHANGED_OBJECTScxx . . $ `Descent3/multi_server.h:30:9`!) { |
| 1390 | Changed_animcxx . . $ Changed_anim.[Num_changed_animcxx . . $ Num_changed_anim.[slot]][slot] = Objectscxx . . $ Objects.[i].handlecxx . . $ object#handle.; |
| 1391 | Num_changed_animcxx . . $ Num_changed_anim.[slot]++; |
| 1392 | } |
| 1393 | |
| 1394 | objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[i]; |
| 1395 | polyobj_infocxx . . $ polyobj_info# *p_info = &obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info.; |
| 1396 | if (p_info->multi_turret_infocxx . . $ polyobj_info#multi_turret_info..num_turretscxx . . $ multi_turret#num_turrets.) { |
| 1397 | if (Num_changed_turretcxx . . $ Num_changed_turret.[slot] < MAX_CHANGED_OBJECTScxx . . $ `Descent3/multi_server.h:30:9`!) { |
| 1398 | Changed_turretcxx . . $ Changed_turret.[Num_changed_turretcxx . . $ Num_changed_turret.[slot]][slot] = Objectscxx . . $ Objects.[i].handlecxx . . $ object#handle.; |
| 1399 | Num_changed_turretcxx . . $ Num_changed_turret.[slot]++; |
| 1400 | } |
| 1401 | } |
| 1402 | } |
| 1403 | } |
| 1404 | } |
| 1405 | |
| 1406 | // Only send up to n objects in a packet lest we overflow outgoing packet size |
| 1407 | |
| 1408 | int cur_object = 0; |
| 1409 | int objects_to_go = total_objects; |
| 1410 | |
| 1411 | while (objects_to_go > 0) { |
| 1412 | int num_objects_this_packet = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(MAX_OBJECTS_PER_PACKETcxx . . $ `Descent3/multi_server.cpp:1360:9`!, objects_to_go); |
| 1413 | int overflow = 0; |
| 1414 | |
| 1415 | count = 0; |
| 1416 | size_offset = START_DATAcxx . . $ START_DATA(8c36ee1faa9e0a0b).(MP_JOIN_OBJECTScxx . . $ `Descent3/multi.h:544:9`!, data, &count); |
| 1417 | int num_objs_offset = count; |
| 1418 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(0, data, &count); |
| 1419 | |
| 1420 | // Actually add the objects to our outgoing buffer |
| 1421 | for (i = 0; i < num_objects_this_packet && !overflow; i++) { |
| 1422 | // Add objnum and id |
| 1423 | objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[outgoing_objects[i + cur_object]]; |
| 1424 | uint8_tcxx . . $ uint8_t# obj_data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 1425 | |
| 1426 | int num_bytes = StuffObjectIntoPacketcxx . . $ StuffObjectIntoPacket(1986db6aef80da2d).(obj, obj_data); |
| 1427 | |
| 1428 | // If their is an overflow, send it out! |
| 1429 | if ((num_bytes + count) >= MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!) { |
| 1430 | num_objects_this_packet = i; |
| 1431 | data[num_objs_offset] = num_objects_this_packet; |
| 1432 | END_DATAcxx . . $ END_DATA(dde21517a502ab05).(count, data, size_offset); |
| 1433 | nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[slot].reliable_socketcxx . . $ netplayer#reliable_socket., data, count, false); |
| 1434 | overflow = 1; |
| 1435 | } else { |
| 1436 | memcpy(&data[count], obj_data, num_bytes); |
| 1437 | count += num_bytes; |
| 1438 | } |
| 1439 | } |
| 1440 | |
| 1441 | if (!overflow) { |
| 1442 | data[num_objs_offset] = num_objects_this_packet; |
| 1443 | END_DATAcxx . . $ END_DATA(dde21517a502ab05).(count, data, size_offset); |
| 1444 | nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[slot].reliable_socketcxx . . $ netplayer#reliable_socket., data, count, false); |
| 1445 | } |
| 1446 | |
| 1447 | cur_object += num_objects_this_packet; |
| 1448 | objects_to_go -= num_objects_this_packet; |
| 1449 | } |
| 1450 | |
| 1451 | MultiSendJoinDemoObjectscxx . . $ MultiSendJoinDemoObjects(d4f767463ce0a6b3).(slot); |
| 1452 | } |
| 1453 | |
| 1454 | void MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(int slot, uint8_tcxx . . $ uint8_t# *big_data, int *big_count, uint8_tcxx . . $ uint8_t# *cur_data, int *cur_count, |
| 1455 | int *size_offset) { |
| 1456 | if (*big_count + *cur_count >= (MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`! - 3)) { |
| 1457 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Starting another world packet!\n"); |
| 1458 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_ENDcxx . . $ `Descent3/multi_world_state.h:46:9`!, big_data, big_count); |
| 1459 | END_DATAcxx . . $ END_DATA(dde21517a502ab05).(*big_count, big_data, *size_offset); |
| 1460 | |
| 1461 | // Send it out |
| 1462 | nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[slot].reliable_socketcxx . . $ netplayer#reliable_socket., big_data, *big_count); |
| 1463 | |
| 1464 | // Restart another packet |
| 1465 | *big_count = 0; |
| 1466 | *size_offset = START_DATAcxx . . $ START_DATA(8c36ee1faa9e0a0b).(MP_WORLD_STATEScxx . . $ `Descent3/multi.h:611:9`!, big_data, big_count); |
| 1467 | } |
| 1468 | |
| 1469 | memcpy(&big_data[*big_count], cur_data, *cur_count); |
| 1470 | *big_count += *cur_count; |
| 1471 | *cur_count = 0; |
| 1472 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(*big_count < (MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`! - 3)); |
| 1473 | } |
| 1474 | |
| 1475 | doorwaycxx . . $ doorway# *GetDoorwayFromObjectcxx . . $ GetDoorwayFromObject(fd3f60e6b7ee6406).(int door_obj_handle); |
| 1476 | // Function that sends all the changed world states to an incoming player |
| 1477 | void MultiSendWorldStatescxx . . $ MultiSendWorldStates(d4f767463ce0a6b3).(int slot) { |
| 1478 | int i; |
| 1479 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Netgame.local_role == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!); |
| 1480 | |
| 1481 | uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 1482 | uint8_tcxx . . $ uint8_t# cur_data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 1483 | int cur_count; |
| 1484 | int count = 0; |
| 1485 | int size_offset; |
| 1486 | |
| 1487 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Sending MP_WORLD_STATES packet to player %d!\n", slot); |
| 1488 | |
| 1489 | size_offset = START_DATAcxx . . $ START_DATA(8c36ee1faa9e0a0b).(MP_WORLD_STATEScxx . . $ `Descent3/multi.h:611:9`!, data, &count); |
| 1490 | |
| 1491 | // Send MOTD |
| 1492 | if (Dedicated_servercxx . . $ Dedicated_server. && Multi_message_of_the_daycxx . . $ Multi_message_of_the_day.[0] != 0) { |
| 1493 | cur_count = 0; |
| 1494 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_MOTDcxx . . $ `Descent3/multi_world_state.h:45:9`!, cur_data, &cur_count); |
| 1495 | MultiAddStringcxx . . $ MultiAddString(ac7a41cf4c80e28).(Multi_message_of_the_daycxx . . $ Multi_message_of_the_day., cur_data, &cur_count); |
| 1496 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1497 | } |
| 1498 | |
| 1499 | // Send weather |
| 1500 | cur_count = 0; |
| 1501 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_WEATHERcxx . . $ `Descent3/multi_world_state.h:27:9`!, cur_data, &cur_count); |
| 1502 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(Weathercxx . . $ Weather..flagscxx . . $ weather#flags., cur_data, &cur_count); |
| 1503 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(Weathercxx . . $ Weather..rain_intensity_scalarcxx . . $ weather#rain_intensity_scalar., cur_data, &cur_count); |
| 1504 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(Weathercxx . . $ Weather..snow_intensity_scalarcxx . . $ weather#snow_intensity_scalar., cur_data, &cur_count); |
| 1505 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(Weathercxx . . $ Weather..lightning_interval_timecxx . . $ weather#lightning_interval_time., cur_data, &cur_count); |
| 1506 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(Weathercxx . . $ Weather..lightning_rand_valuecxx . . $ weather#lightning_rand_value., cur_data, &cur_count); |
| 1507 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1508 | |
| 1509 | // Send broke glass |
| 1510 | if (Num_broke_glasscxx . . $ Num_broke_glass. > 0) { |
| 1511 | for (i = 0; i < Num_broke_glasscxx . . $ Num_broke_glass.; i++) { |
| 1512 | cur_count = 0; |
| 1513 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_ROOM_GLASScxx . . $ `Descent3/multi_world_state.h:36:9`!, cur_data, &cur_count); |
| 1514 | MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(Broke_glass_roomscxx . . $ Broke_glass_rooms.[i], cur_data, &cur_count); |
| 1515 | MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(Broke_glass_facescxx . . $ Broke_glass_faces.[i], cur_data, &cur_count); |
| 1516 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1517 | } |
| 1518 | } |
| 1519 | |
| 1520 | // Send waypoint |
| 1521 | cur_count = 0; |
| 1522 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_WAYPOINTcxx . . $ `Descent3/multi_world_state.h:28:9`!, cur_data, &cur_count); |
| 1523 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(Current_waypointcxx . . $ Current_waypoint., cur_data, &cur_count); |
| 1524 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1525 | |
| 1526 | // Send player bit-fields |
| 1527 | cur_count = 0; |
| 1528 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_PLAYERBFcxx . . $ `Descent3/multi_world_state.h:32:9`!, cur_data, &cur_count); |
| 1529 | MultiAddUintcxx . . $ MultiAddUint(c51d06dbd74b8495).(Players_typingcxx . . $ Players_typing., cur_data, &cur_count); |
| 1530 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1531 | |
| 1532 | // Do room stuff |
| 1533 | for (i = 0; i <= Highest_room_indexcxx . . $ Highest_room_index.; i++) { |
| 1534 | if (!Roomscxx . . $ Rooms.[i].usedcxx . . $ room#used.) |
| 1535 | continue; |
| 1536 | |
| 1537 | if (Roomscxx . . $ Rooms.[i].room_change_flagscxx . . $ room#room_change_flags. & RCF_WINDcxx . . $ `Descent3/multi_world_state.h:52:9`!) { |
| 1538 | cur_count = 0; |
| 1539 | |
| 1540 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_ROOM_WINDcxx . . $ `Descent3/multi_world_state.h:22:9`!, cur_data, &cur_count); |
| 1541 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(i, cur_data, &cur_count); |
| 1542 | |
| 1543 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(Roomscxx . . $ Rooms.[i].windcxx . . $ room#wind..xcxx . . $ vector#x., cur_data, &cur_count); |
| 1544 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(Roomscxx . . $ Rooms.[i].windcxx . . $ room#wind..ycxx . . $ vector#y., cur_data, &cur_count); |
| 1545 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(Roomscxx . . $ Rooms.[i].windcxx . . $ room#wind..zcxx . . $ vector#z., cur_data, &cur_count); |
| 1546 | |
| 1547 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1548 | } |
| 1549 | if (Roomscxx . . $ Rooms.[i].room_change_flagscxx . . $ room#room_change_flags. & RCF_FOGcxx . . $ `Descent3/multi_world_state.h:53:9`!) { |
| 1550 | cur_count = 0; |
| 1551 | |
| 1552 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_ROOM_FOGcxx . . $ `Descent3/multi_world_state.h:23:9`!, cur_data, &cur_count); |
| 1553 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(i, cur_data, &cur_count); |
| 1554 | |
| 1555 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(Roomscxx . . $ Rooms.[i].fog_depthcxx . . $ room#fog_depth., cur_data, &cur_count); |
| 1556 | MultiAddUbytecxx . . $ MultiAddUbyte(3bbe8835367eaa4e).(Roomscxx . . $ Rooms.[i].fog_rcxx . . $ room#fog_r. * 255.0, cur_data, &cur_count); |
| 1557 | MultiAddUbytecxx . . $ MultiAddUbyte(3bbe8835367eaa4e).(Roomscxx . . $ Rooms.[i].fog_gcxx . . $ room#fog_g. * 255.0, cur_data, &cur_count); |
| 1558 | MultiAddUbytecxx . . $ MultiAddUbyte(3bbe8835367eaa4e).(Roomscxx . . $ Rooms.[i].fog_bcxx . . $ room#fog_b. * 255.0, cur_data, &cur_count); |
| 1559 | |
| 1560 | if (Roomscxx . . $ Rooms.[i].flagscxx . . $ room#flags. & RF_FOGcxx . . $ `Descent3/room_external.h:184:9`!) |
| 1561 | MultiAddUbytecxx . . $ MultiAddUbyte(3bbe8835367eaa4e).(1, cur_data, &cur_count); |
| 1562 | else |
| 1563 | MultiAddUbytecxx . . $ MultiAddUbyte(3bbe8835367eaa4e).(0, cur_data, &cur_count); |
| 1564 | |
| 1565 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1566 | } |
| 1567 | |
| 1568 | if (Roomscxx . . $ Rooms.[i].room_change_flagscxx . . $ room#room_change_flags. & RCF_LIGHTINGcxx . . $ `Descent3/multi_world_state.h:55:9`!) { |
| 1569 | cur_count = 0; |
| 1570 | |
| 1571 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_ROOM_LIGHTINGcxx . . $ `Descent3/multi_world_state.h:24:9`!, cur_data, &cur_count); |
| 1572 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(i, cur_data, &cur_count); |
| 1573 | MultiAddUbytecxx . . $ MultiAddUbyte(3bbe8835367eaa4e).(Roomscxx . . $ Rooms.[i].pulse_timecxx . . $ room#pulse_time., cur_data, &cur_count); |
| 1574 | MultiAddUbytecxx . . $ MultiAddUbyte(3bbe8835367eaa4e).(Roomscxx . . $ Rooms.[i].pulse_offsetcxx . . $ room#pulse_offset., cur_data, &cur_count); |
| 1575 | |
| 1576 | if (Roomscxx . . $ Rooms.[i].flagscxx . . $ room#flags. & RF_FLICKERcxx . . $ `Descent3/room_external.h:194:9`!) |
| 1577 | MultiAddUbytecxx . . $ MultiAddUbyte(3bbe8835367eaa4e).(1, cur_data, &cur_count); |
| 1578 | else |
| 1579 | MultiAddUbytecxx . . $ MultiAddUbyte(3bbe8835367eaa4e).(0, cur_data, &cur_count); |
| 1580 | |
| 1581 | if (Roomscxx . . $ Rooms.[i].flagscxx . . $ room#flags. & RF_STROBEcxx . . $ `Descent3/room_external.h:193:9`!) |
| 1582 | MultiAddUbytecxx . . $ MultiAddUbyte(3bbe8835367eaa4e).(1, cur_data, &cur_count); |
| 1583 | else |
| 1584 | MultiAddUbytecxx . . $ MultiAddUbyte(3bbe8835367eaa4e).(0, cur_data, &cur_count); |
| 1585 | |
| 1586 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1587 | } |
| 1588 | |
| 1589 | if (Roomscxx . . $ Rooms.[i].room_change_flagscxx . . $ room#room_change_flags. & RCF_TEXTUREcxx . . $ `Descent3/multi_world_state.h:57:9`!) { |
| 1590 | for (int t = 0; t < Roomscxx . . $ Rooms.[i].num_facescxx . . $ room#num_faces.; t++) { |
| 1591 | if (Roomscxx . . $ Rooms.[i].facescxx . . $ room#faces.[t].flagscxx . . $ face#flags. & FF_TEXTURE_CHANGEDcxx . . $ `Descent3/room_external.h:115:9`!) { |
| 1592 | cur_count = 0; |
| 1593 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_ROOM_TEXTUREcxx . . $ `Descent3/multi_world_state.h:25:9`!, cur_data, &cur_count); |
| 1594 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(i, cur_data, &cur_count); |
| 1595 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(t, cur_data, &cur_count); |
| 1596 | MultiAddStringcxx . . $ MultiAddString(ac7a41cf4c80e28).(GameTexturescxx . . $ GameTextures.[Roomscxx . . $ Rooms.[i].facescxx . . $ room#faces.[t].tmapcxx . . $ face#tmap.].namecxx . . $ texture#name., cur_data, &cur_count); |
| 1597 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1598 | } |
| 1599 | } |
| 1600 | } |
| 1601 | |
| 1602 | if (Roomscxx . . $ Rooms.[i].room_change_flagscxx . . $ room#room_change_flags. & RCF_GOALSPECIAL_FLAGScxx . . $ `Descent3/multi_world_state.h:62:9`!) { |
| 1603 | int mask = (RF_SPECIAL1cxx . . $ `Descent3/room_external.h:185:9`! | RF_SPECIAL2cxx . . $ `Descent3/room_external.h:186:9`! | RF_SPECIAL3cxx . . $ `Descent3/room_external.h:187:9`! | RF_SPECIAL4cxx . . $ `Descent3/room_external.h:188:9`! | RF_SPECIAL5cxx . . $ `Descent3/room_external.h:189:9`! | RF_SPECIAL6cxx . . $ `Descent3/room_external.h:190:9`! | RF_GOAL1cxx . . $ `Descent3/room_external.h:178:9`! | |
| 1604 | RF_GOAL2cxx . . $ `Descent3/room_external.h:179:9`! | RF_GOAL3cxx . . $ `Descent3/room_external.h:182:9`! | RF_GOAL4cxx . . $ `Descent3/room_external.h:183:9`!); |
| 1605 | int change_mask = (Roomscxx . . $ Rooms.[i].flagscxx . . $ room#flags. & mask); |
| 1606 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_ROOM_GOALSPECFLAGcxx . . $ `Descent3/multi_world_state.h:41:9`!, cur_data, &cur_count); |
| 1607 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(i, cur_data, &cur_count); |
| 1608 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(change_mask, cur_data, &cur_count); |
| 1609 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1610 | } |
| 1611 | |
| 1612 | if (Roomscxx . . $ Rooms.[i].room_change_flagscxx . . $ room#room_change_flags. & RCF_DAMAGEcxx . . $ `Descent3/multi_world_state.h:59:9`!) { |
| 1613 | cur_count = 0; |
| 1614 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_ROOM_DAMAGEcxx . . $ `Descent3/multi_world_state.h:33:9`!, cur_data, &cur_count); |
| 1615 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(i, cur_data, &cur_count); |
| 1616 | |
| 1617 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(Roomscxx . . $ Rooms.[i].damagecxx . . $ room#damage., cur_data, &cur_count); |
| 1618 | MultiAddUbytecxx . . $ MultiAddUbyte(3bbe8835367eaa4e).(Roomscxx . . $ Rooms.[i].damage_typecxx . . $ room#damage_type., cur_data, &cur_count); |
| 1619 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1620 | } |
| 1621 | if (Roomscxx . . $ Rooms.[i].room_change_flagscxx . . $ room#room_change_flags. & RCF_REFUELcxx . . $ `Descent3/multi_world_state.h:60:9`!) { |
| 1622 | cur_count = 0; |
| 1623 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_ROOM_REFUELcxx . . $ `Descent3/multi_world_state.h:34:9`!, cur_data, &cur_count); |
| 1624 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(i, cur_data, &cur_count); |
| 1625 | |
| 1626 | if (Roomscxx . . $ Rooms.[i].flagscxx . . $ room#flags. & RF_FUELCENcxx . . $ `Descent3/room_external.h:175:9`!) |
| 1627 | MultiAddUbytecxx . . $ MultiAddUbyte(3bbe8835367eaa4e).(1, cur_data, &cur_count); |
| 1628 | else |
| 1629 | MultiAddUbytecxx . . $ MultiAddUbyte(3bbe8835367eaa4e).(0, cur_data, &cur_count); |
| 1630 | |
| 1631 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1632 | } |
| 1633 | |
| 1634 | if (Roomscxx . . $ Rooms.[i].room_change_flagscxx . . $ room#room_change_flags. & RCF_PORTAL_RENDERcxx . . $ `Descent3/multi_world_state.h:58:9`!) { |
| 1635 | for (int t = 0; t < Roomscxx . . $ Rooms.[i].num_portalscxx . . $ room#num_portals.; t++) { |
| 1636 | if (Roomscxx . . $ Rooms.[i].portalscxx . . $ room#portals.[t].flagscxx . . $ portal#flags. & PF_CHANGEDcxx . . $ `Descent3/room_external.h:159:9`!) { |
| 1637 | cur_count = 0; |
| 1638 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_ROOM_PORTAL_RENDERcxx . . $ `Descent3/multi_world_state.h:26:9`!, cur_data, &cur_count); |
| 1639 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(i, cur_data, &cur_count); |
| 1640 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(t, cur_data, &cur_count); |
| 1641 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(Roomscxx . . $ Rooms.[i].portalscxx . . $ room#portals.[t].flagscxx . . $ portal#flags., cur_data, &cur_count); |
| 1642 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1643 | } |
| 1644 | } |
| 1645 | } |
| 1646 | |
| 1647 | if (Roomscxx . . $ Rooms.[i].room_change_flagscxx . . $ room#room_change_flags. & RCF_PORTAL_BLOCKcxx . . $ `Descent3/multi_world_state.h:61:9`!) { |
| 1648 | for (int t = 0; t < Roomscxx . . $ Rooms.[i].num_portalscxx . . $ room#num_portals.; t++) { |
| 1649 | if (Roomscxx . . $ Rooms.[i].portalscxx . . $ room#portals.[t].flagscxx . . $ portal#flags. & PF_CHANGEDcxx . . $ `Descent3/room_external.h:159:9`!) { |
| 1650 | cur_count = 0; |
| 1651 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_ROOM_PORTAL_BLOCKcxx . . $ `Descent3/multi_world_state.h:39:9`!, cur_data, &cur_count); |
| 1652 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(i, cur_data, &cur_count); |
| 1653 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(t, cur_data, &cur_count); |
| 1654 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(Roomscxx . . $ Rooms.[i].portalscxx . . $ room#portals.[t].flagscxx . . $ portal#flags., cur_data, &cur_count); |
| 1655 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1656 | } |
| 1657 | } |
| 1658 | } |
| 1659 | } |
| 1660 | |
| 1661 | // Do object stuff |
| 1662 | for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) { |
| 1663 | objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[i]; |
| 1664 | |
| 1665 | if ((obj->typecxx . . $ object#type. == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) || (obj->flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!)) |
| 1666 | continue; |
| 1667 | |
| 1668 | if (obj->typecxx . . $ object#type. == OBJ_DOORcxx . . $ `Descent3/object_external.h:177:9`!) { |
| 1669 | doorwaycxx . . $ doorway# *dp; |
| 1670 | dp = GetDoorwayFromObjectcxx . . $ GetDoorwayFromObject(fd3f60e6b7ee6406).(Objectscxx . . $ Objects.[i].handlecxx . . $ object#handle.); |
| 1671 | cur_count = 0; |
| 1672 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_DOORcxx . . $ `Descent3/multi_world_state.h:29:9`!, cur_data, &cur_count); |
| 1673 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(i, cur_data, &cur_count); |
| 1674 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(dp->statecxx . . $ doorway#state., cur_data, &cur_count); |
| 1675 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).((dp->flagscxx . . $ doorway#flags. & DF_LOCKEDcxx . . $ `Descent3/doorway.h:110:9`!) != 0, cur_data, &cur_count); |
| 1676 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(dp->positioncxx . . $ doorway#position., cur_data, &cur_count); |
| 1677 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1678 | } |
| 1679 | |
| 1680 | if (obj->change_flagscxx . . $ object#change_flags. & OCF_LIGHT_DISTANCEcxx . . $ `Descent3/multi_world_state.h:66:9`!) { |
| 1681 | cur_count = 0; |
| 1682 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_LIGHT_DISTANCEcxx . . $ `Descent3/multi_world_state.h:30:9`!, cur_data, &cur_count); |
| 1683 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(i, cur_data, &cur_count); |
| 1684 | |
| 1685 | light_infocxx . . $ light_info# *li = ObjGetLightInfocxx . . $ ObjGetLightInfo(fae61030adf16a8b).(obj); |
| 1686 | if (li) |
| 1687 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(li->light_distancecxx . . $ light_info#light_distance., cur_data, &cur_count); |
| 1688 | else |
| 1689 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(0, cur_data, &cur_count); |
| 1690 | |
| 1691 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1692 | } |
| 1693 | |
| 1694 | if (obj->change_flagscxx . . $ object#change_flags. & OCF_LIGHT_COLORcxx . . $ `Descent3/multi_world_state.h:67:9`!) { |
| 1695 | cur_count = 0; |
| 1696 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_LIGHT_COLORcxx . . $ `Descent3/multi_world_state.h:35:9`!, cur_data, &cur_count); |
| 1697 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(i, cur_data, &cur_count); |
| 1698 | |
| 1699 | light_infocxx . . $ light_info# *li = ObjGetLightInfocxx . . $ ObjGetLightInfo(fae61030adf16a8b).(obj); |
| 1700 | if (li) { |
| 1701 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(li->red_light1cxx . . $ light_info#red_light1., cur_data, &cur_count); |
| 1702 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(li->green_light1cxx . . $ light_info#green_light1., cur_data, &cur_count); |
| 1703 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(li->blue_light1cxx . . $ light_info#blue_light1., cur_data, &cur_count); |
| 1704 | } else { |
| 1705 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(0, cur_data, &cur_count); |
| 1706 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(0, cur_data, &cur_count); |
| 1707 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(0, cur_data, &cur_count); |
| 1708 | } |
| 1709 | |
| 1710 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1711 | } |
| 1712 | |
| 1713 | if (obj->change_flagscxx . . $ object#change_flags. & OCF_NO_RENDERcxx . . $ `Descent3/multi_world_state.h:65:9`!) { |
| 1714 | cur_count = 0; |
| 1715 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_NO_RENDERcxx . . $ `Descent3/multi_world_state.h:43:9`!, cur_data, &cur_count); |
| 1716 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(i, cur_data, &cur_count); |
| 1717 | |
| 1718 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1719 | } |
| 1720 | |
| 1721 | if (obj->change_flagscxx . . $ object#change_flags. & OCF_PHYS_FLAGScxx . . $ `Descent3/multi_world_state.h:68:9`!) { |
| 1722 | cur_count = 0; |
| 1723 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_OBJECT_PHYS_FLAGScxx . . $ `Descent3/multi_world_state.h:44:9`!, cur_data, &cur_count); |
| 1724 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(i, cur_data, &cur_count); |
| 1725 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(Objectscxx . . $ Objects.[i].mtypecxx . . $ object#mtype..phys_infocxx . . $ object#$anonymous_type_8#phys_info..flagscxx . . $ physics_info#flags., cur_data, &cur_count); |
| 1726 | |
| 1727 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1728 | } |
| 1729 | |
| 1730 | // Check to see if we have an attached object |
| 1731 | if (obj->attach_childrencxx . . $ object#attach_children. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 1732 | cur_count = 0; |
| 1733 | |
| 1734 | poly_modelcxx . . $ poly_model# *pm = &Poly_modelscxx . . $ Poly_models.[obj->rtypecxx . . $ object#rtype..pobj_infocxx . . $ object#$anonymous_type_10#pobj_info..model_numcxx . . $ polyobj_info#model_num.]; |
| 1735 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_OBJECT_ATTACHcxx . . $ `Descent3/multi_world_state.h:42:9`!, cur_data, &cur_count); |
| 1736 | MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(i, cur_data, &cur_count); |
| 1737 | |
| 1738 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(pm->n_attachcxx . . $ poly_model#n_attach., cur_data, &cur_count); |
| 1739 | |
| 1740 | for (int t = 0; t < pm->n_attachcxx . . $ poly_model#n_attach.; t++) { |
| 1741 | objectcxx . . $ object# *child = ObjGetcxx . . $ ObjGet(11672e354c0b263a).(obj->attach_childrencxx . . $ object#attach_children.[t]); |
| 1742 | if (!child) |
| 1743 | MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(65535, cur_data, &cur_count); |
| 1744 | else { |
| 1745 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(child->flags & OF_ATTACHEDcxx . . $ `Descent3/object_external.h:273:9`!); |
| 1746 | MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(OBJNUMcxx . . $ `Descent3/object.h:700:9`!(child), cur_data, &cur_count); |
| 1747 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(child->attach_indexcxx . . $ object#$anonymous_type_7#attach_index., cur_data, &cur_count); |
| 1748 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(child->attach_typecxx . . $ object#attach_type., cur_data, &cur_count); |
| 1749 | |
| 1750 | if (child->attach_typecxx . . $ object#attach_type. == AT_RADcxx . . $ `Descent3/object_external.h:252:9`!) |
| 1751 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(child->attach_distcxx . . $ object#$anonymous_type_7#attach_dist. / child->sizecxx . . $ object#size., cur_data, &cur_count); |
| 1752 | } |
| 1753 | } |
| 1754 | |
| 1755 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1756 | } |
| 1757 | } |
| 1758 | |
| 1759 | // Do spew stuff |
| 1760 | int spewcount = 0; |
| 1761 | for (i = 0; i < MAX_SPEW_EFFECTScxx . . $ `Descent3/spew.h:131:9`!; i++) { |
| 1762 | |
| 1763 | if (SpewEffectscxx . . $ SpewEffects.[i].inusecxx . . $ spewinfo#inuse.) { |
| 1764 | spewcount++; |
| 1765 | cur_count = 0; |
| 1766 | spewinfocxx . . $ spewinfo# *sp = &SpewEffectscxx . . $ SpewEffects.[i]; |
| 1767 | |
| 1768 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_SPEWcxx . . $ `Descent3/multi_world_state.h:31:9`!, cur_data, &cur_count); |
| 1769 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(i, cur_data, &cur_count); |
| 1770 | |
| 1771 | if (sp->use_gunpointcxx . . $ spewinfo#use_gunpoint.) { |
| 1772 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(1, cur_data, &cur_count); |
| 1773 | MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(sp->gpcxx . . $ spewinfo#$anonymous_type_0#gp..obj_handlecxx . . $ guninfo#obj_handle. & HANDLE_OBJNUM_MASKcxx . . $ `Descent3/object.h:642:9`!, cur_data, &cur_count); |
| 1774 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(sp->gpcxx . . $ spewinfo#$anonymous_type_0#gp..gunpointcxx . . $ guninfo#gunpoint., cur_data, &cur_count); |
| 1775 | } else { |
| 1776 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(0, cur_data, &cur_count); |
| 1777 | // memcpy (&cur_data[cur_count],&sp->pt.normal,sizeof(vector)); |
| 1778 | // cur_count+=sizeof(vector); |
| 1779 | MultiAddVectorcxx . . $ MultiAddVector(f5e3e9791ffe6d9f).(sp->ptcxx . . $ spewinfo#$anonymous_type_0#pt..normalcxx . . $ pointinfo#normal., cur_data, &cur_count); |
| 1780 | // memcpy (&cur_data[cur_count],&sp->pt.origin,sizeof(vector)); |
| 1781 | // cur_count+=sizeof(vector); |
| 1782 | MultiAddVectorcxx . . $ MultiAddVector(f5e3e9791ffe6d9f).(sp->ptcxx . . $ spewinfo#$anonymous_type_0#pt..origincxx . . $ pointinfo#origin., cur_data, &cur_count); |
| 1783 | |
| 1784 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(sp->ptcxx . . $ spewinfo#$anonymous_type_0#pt..room_numcxx . . $ pointinfo#room_num., cur_data, &cur_count); |
| 1785 | } |
| 1786 | |
| 1787 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(sp->randomcxx . . $ spewinfo#random., cur_data, &cur_count); |
| 1788 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(sp->real_objcxx . . $ spewinfo#real_obj., cur_data, &cur_count); |
| 1789 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(sp->effect_typecxx . . $ spewinfo#effect_type., cur_data, &cur_count); |
| 1790 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(sp->phys_infocxx . . $ spewinfo#phys_info., cur_data, &cur_count); |
| 1791 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(sp->dragcxx . . $ spewinfo#drag., cur_data, &cur_count); |
| 1792 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(sp->masscxx . . $ spewinfo#mass., cur_data, &cur_count); |
| 1793 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(sp->time_intcxx . . $ spewinfo#time_int., cur_data, &cur_count); |
| 1794 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(sp->longevitycxx . . $ spewinfo#longevity., cur_data, &cur_count); |
| 1795 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(sp->lifetimecxx . . $ spewinfo#lifetime., cur_data, &cur_count); |
| 1796 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(sp->sizecxx . . $ spewinfo#size., cur_data, &cur_count); |
| 1797 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(sp->speedcxx . . $ spewinfo#speed., cur_data, &cur_count); |
| 1798 | |
| 1799 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1800 | } |
| 1801 | } |
| 1802 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Send %d spew events\n", spewcount); |
| 1803 | |
| 1804 | // Send buddybot handles if needed |
| 1805 | if (Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. & NF_ALLOWGUIDEBOTcxx . . $ `Descent3/multi_external.h:232:9`!) { |
| 1806 | for (int i = 0; i < MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!; i++) { |
| 1807 | if (Buddy_handlecxx . . $ Buddy_handle.[i] != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) { |
| 1808 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_BUDDYBOTScxx . . $ `Descent3/multi_world_state.h:37:9`!, cur_data, &cur_count); |
| 1809 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(i, cur_data, &cur_count); |
| 1810 | MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(Buddy_handlecxx . . $ Buddy_handle.[i] & HANDLE_OBJNUM_MASKcxx . . $ `Descent3/object.h:642:9`!, cur_data, &cur_count); |
| 1811 | MultiStoreWorldPacketcxx . . $ MultiStoreWorldPacket(49537f12bc958274).(slot, data, &count, cur_data, &cur_count, &size_offset); |
| 1812 | } |
| 1813 | } |
| 1814 | } |
| 1815 | |
| 1816 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(WS_ENDcxx . . $ `Descent3/multi_world_state.h:46:9`!, data, &count); |
| 1817 | |
| 1818 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(count < MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!); |
| 1819 | |
| 1820 | END_DATAcxx . . $ END_DATA(dde21517a502ab05).(count, data, size_offset); |
| 1821 | |
| 1822 | // Send it out |
| 1823 | nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[slot].reliable_socketcxx . . $ netplayer#reliable_socket., data, count, false); |
| 1824 | } |
| 1825 | |
| 1826 | // Sends this reliable packet to everyone except the server and the named slot |
| 1827 | void MultiSendReliablyToAllExceptcxx . . $ MultiSendReliablyToAllExcept(ff9a57d40a1b8fe8).(int except, uint8_tcxx . . $ uint8_t# *data, int size, int seq_threshold, bool urgent) { |
| 1828 | for (int i = 0; i < MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!; i++) { |
| 1829 | if (!(NetPlayerscxx . . $ NetPlayers.[i].flagscxx . . $ netplayer#flags. & NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!)) |
| 1830 | continue; |
| 1831 | |
| 1832 | // Don't send to these clowns |
| 1833 | if (i == except || i == Player_numcxx . . $ Player_num.) |
| 1834 | continue; |
| 1835 | |
| 1836 | if (NetPlayerscxx . . $ NetPlayers.[i].sequencecxx . . $ netplayer#sequence. >= seq_threshold && NetPlayerscxx . . $ NetPlayers.[i].sequencecxx . . $ netplayer#sequence. != NETSEQ_LEVEL_ENDcxx . . $ `Descent3/multi_external.h:162:9`!) |
| 1837 | nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[i].reliable_socketcxx . . $ netplayer#reliable_socket., data, size, urgent); |
| 1838 | } |
| 1839 | } |
| 1840 | |
| 1841 | // Sends this nonreliable packet to everyone except the server and the named slot |
| 1842 | void MultiSendToAllExceptcxx . . $ MultiSendToAllExcept(34ee600be5240935).(int except, uint8_tcxx . . $ uint8_t# *data, int size, int seq_threshold) { |
| 1843 | |
| 1844 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Netgame.local_role == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!); |
| 1845 | for (int i = 0; i < MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!; i++) { |
| 1846 | if (!(NetPlayerscxx . . $ NetPlayers.[i].flagscxx . . $ netplayer#flags. & NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!)) |
| 1847 | continue; |
| 1848 | |
| 1849 | // Don't send to these clowns |
| 1850 | if (i == except || i == Player_numcxx . . $ Player_num.) |
| 1851 | continue; |
| 1852 | |
| 1853 | if (seq_threshold == -1 || (NetPlayerscxx . . $ NetPlayers.[i].sequencecxx . . $ netplayer#sequence. >= seq_threshold && NetPlayerscxx . . $ NetPlayers.[i].sequencecxx . . $ netplayer#sequence. != NETSEQ_LEVEL_ENDcxx . . $ `Descent3/multi_external.h:162:9`!)) |
| 1854 | nw_Sendcxx . . $ nw_Send(102d2f582237fe86).(&NetPlayerscxx . . $ NetPlayers.[i].addrcxx . . $ netplayer#addr., data, size, 0); |
| 1855 | } |
| 1856 | } |
| 1857 | |
| 1858 | // Flushes all receive sockets so that there is no data coming from them |
| 1859 | void MultiFlushAllIncomingBufferscxx . . $ MultiFlushAllIncomingBuffers(49f6e7a06ebc5aa8).() { |
| 1860 | uint8_tcxx . . $ uint8_t# *data; |
| 1861 | network_addresscxx . . $ network_address# from_addr; |
| 1862 | int size; |
| 1863 | |
| 1864 | data = &(Multi_receive_buffercxx . . $ Multi_receive_buffer.[0]); |
| 1865 | |
| 1866 | // get all incoming data and throw it away |
| 1867 | while ((size = nw_Receivecxx . . $ nw_Receive(4faaf8d0141e84f4).(data, &from_addr)) > 0) |
| 1868 | ; |
| 1869 | |
| 1870 | if (Netgamecxx . . $ Netgame..local_rolecxx . . $ netgame_info#local_role. == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) { |
| 1871 | // Flush reliable sockets |
| 1872 | for (int i = 0; i < MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!; i++) { |
| 1873 | if (Player_numcxx . . $ Player_num. == i) |
| 1874 | continue; |
| 1875 | |
| 1876 | if ((NetPlayerscxx . . $ NetPlayers.[i].flagscxx . . $ netplayer#flags. & NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!) && (NetPlayerscxx . . $ NetPlayers.[i].reliable_socketcxx . . $ netplayer#reliable_socket. != INVALID_SOCKETcxx . . $ `lib/networking.h:221:9`!) && |
| 1877 | (NetPlayerscxx . . $ NetPlayers.[i].reliable_socketcxx . . $ netplayer#reliable_socket. != 0)) { |
| 1878 | while ((size = nw_ReceiveReliablecxx . . $ nw_ReceiveReliable(ef9024b465536c23).(NetPlayerscxx . . $ NetPlayers.[i].reliable_socketcxx . . $ netplayer#reliable_socket., data, MAX_RECEIVE_SIZEcxx . . $ `Descent3/multi.h:677:9`!)) > 0) |
| 1879 | ; |
| 1880 | } |
| 1881 | } |
| 1882 | } |
| 1883 | } |
| 1884 | |
| 1885 | // Checks to see if its any powerups need repositioning on the client machine |
| 1886 | void MultiCheckToRepositionPowerupscxx . . $ MultiCheckToRepositionPowerups(49f6e7a06ebc5aa8).() { |
| 1887 | int i; |
| 1888 | static int invis_id = -2; |
| 1889 | |
| 1890 | if (invis_id == -2) { |
| 1891 | invis_id = FindObjectIDNamecxx . . $ FindObjectIDName(5c4306d8553b3696).("InvisiblePowerup"); |
| 1892 | } |
| 1893 | |
| 1894 | int changed = 0; |
| 1895 | |
| 1896 | for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) { |
| 1897 | objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[i]; |
| 1898 | if (obj->typecxx . . $ object#type. != OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!) |
| 1899 | continue; |
| 1900 | |
| 1901 | if (obj->idcxx . . $ object#id. == invis_id) |
| 1902 | continue; |
| 1903 | |
| 1904 | if (obj->flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!) |
| 1905 | continue; |
| 1906 | |
| 1907 | if (obj->flagscxx . . $ object#flags. & OF_STOPPED_THIS_FRAMEcxx . . $ `Descent3/object_external.h:272:9`!) { |
| 1908 | // Send out our positional change |
| 1909 | int count = 0; |
| 1910 | uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 1911 | int size = START_DATAcxx . . $ START_DATA(8c36ee1faa9e0a0b).(MP_POWERUP_REPOSITIONcxx . . $ `Descent3/multi.h:564:9`!, data, &count); |
| 1912 | changed++; |
| 1913 | |
| 1914 | MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(i, data, &count); |
| 1915 | // memcpy (&data[count],&obj->pos,sizeof(vector)); |
| 1916 | // count+=sizeof(vector); |
| 1917 | MultiAddVectorcxx . . $ MultiAddVector(f5e3e9791ffe6d9f).(obj->poscxx . . $ object#pos., data, &count); |
| 1918 | |
| 1919 | // Send room number and terrain flag |
| 1920 | MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(CELLNUMcxx . . $ `lib/object_external_struct.h:121:9`!(obj->roomnum), data, &count); |
| 1921 | |
| 1922 | if (OBJECT_OUTSIDEcxx . . $ `lib/object_external_struct.h:130:9`!(obj)) |
| 1923 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(1, data, &count); |
| 1924 | else |
| 1925 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(0, data, &count); |
| 1926 | |
| 1927 | END_DATAcxx . . $ END_DATA(dde21517a502ab05).(count, data, size); |
| 1928 | MultiSendReliablyToAllExceptcxx . . $ MultiSendReliablyToAllExcept(ff9a57d40a1b8fe8).(Player_numcxx . . $ Player_num., data, count, NETSEQ_OBJECTScxx . . $ `Descent3/multi_external.h:158:9`!, false); |
| 1929 | } |
| 1930 | } |
| 1931 | |
| 1932 | if (changed > 0) { |
| 1933 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Stopped=%d\n", changed); |
| 1934 | } |
| 1935 | } |
| 1936 | |
| 1937 | // Checks to see if its time to respawn any powerups |
| 1938 | void MultiCheckToRespawnPowerupscxx . . $ MultiCheckToRespawnPowerups(49f6e7a06ebc5aa8).() { |
| 1939 | int i, t; |
| 1940 | |
| 1941 | for (i = 0; i < Num_powerup_timercxx . . $ Num_powerup_timer.; i++) { |
| 1942 | if (Powerup_timercxx . . $ Powerup_timer.[i].respawn_timecxx . . $ powerup_timer#respawn_time. < Gametimecxx . . $ Gametime.) { |
| 1943 | // This powerup needs to be respawned, so find a vacant spot |
| 1944 | int num_cand = 0; |
| 1945 | int candidates[MAX_RESPAWNScxx . . $ `Descent3/multi.h:714:9`!]; |
| 1946 | |
| 1947 | for (t = 0; t < Num_powerup_respawncxx . . $ Num_powerup_respawn.; t++) { |
| 1948 | if (Powerup_respawncxx . . $ Powerup_respawn.[t].usedcxx . . $ powerup_respawn#used. == 0) { |
| 1949 | if (Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. & NF_RANDOMIZE_RESPAWNcxx . . $ `Descent3/multi_external.h:241:9`!) { |
| 1950 | // We found a spot! |
| 1951 | candidates[num_cand++] = t; |
| 1952 | } else { |
| 1953 | if (Powerup_timercxx . . $ Powerup_timer.[i].idcxx . . $ powerup_timer#id. == Powerup_respawncxx . . $ Powerup_respawn.[t].original_idcxx . . $ powerup_respawn#original_id.) |
| 1954 | candidates[num_cand++] = t; |
| 1955 | } |
| 1956 | } |
| 1957 | } |
| 1958 | |
| 1959 | if (num_cand == 0) { |
| 1960 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Couldn't find a good spot to respawn!!!\n"); |
| 1961 | return; |
| 1962 | } |
| 1963 | |
| 1964 | t = candidates[ps_randcxx . . $ ps_rand(b126dc7c1de90089).() % num_cand]; |
| 1965 | |
| 1966 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Respawning powerup with id of %d.\n", Powerup_timer[i].id); |
| 1967 | Powerup_respawncxx . . $ Powerup_respawn.[t].usedcxx . . $ powerup_respawn#used. = 1; |
| 1968 | int objnum = |
| 1969 | ObjCreatecxx . . $ ObjCreate(849c3da80a4f387f).(OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, Powerup_timercxx . . $ Powerup_timer.[i].idcxx . . $ powerup_timer#id., Powerup_respawncxx . . $ Powerup_respawn.[t].roomnumcxx . . $ powerup_respawn#roomnum., &Powerup_respawncxx . . $ Powerup_respawn.[t].poscxx . . $ powerup_respawn#pos., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1970 | if (objnum > -1) |
| 1971 | MultiSendObjectcxx . . $ MultiSendObject(d7354c60e612ede5).(&Objectscxx . . $ Objects.[objnum], 1); |
| 1972 | |
| 1973 | InitObjectScriptscxx . . $ InitObjectScripts(674fac047436fc5b).(&Objectscxx . . $ Objects.[objnum]); |
| 1974 | Powerup_respawncxx . . $ Powerup_respawn.[t].objnumcxx . . $ powerup_respawn#objnum. = objnum; |
| 1975 | |
| 1976 | // Now erase this powerup from our timer info |
| 1977 | for (t = i; t < Num_powerup_timercxx . . $ Num_powerup_timer. - 1; t++) |
| 1978 | Powerup_timercxx . . $ Powerup_timer.[t] =cxx . . $ powerup_timer#`operator=`(fbc81e2525ba6370). Powerup_timercxx . . $ Powerup_timer.[t + 1]; |
| 1979 | |
| 1980 | Num_powerup_timercxx . . $ Num_powerup_timer.--; |
| 1981 | i--; |
| 1982 | } |
| 1983 | } |
| 1984 | } |
| 1985 | |
| 1986 | extern int Multi_occludedcxx . . $ Multi_occluded.; |
| 1987 | // Sends out positional updates based on clients pps |
| 1988 | void MultiSendPositionalUpdatescxx . . $ MultiSendPositionalUpdates(d4f767463ce0a6b3).(int to_slot) { |
| 1989 | uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 1990 | |
| 1991 | // Figure out if we should send positional updates to players |
| 1992 | for (int i = 0; i < MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!; i++) { |
| 1993 | uint8_tcxx . . $ uint8_t# send_position = 0, timer_popped = 0; |
| 1994 | |
| 1995 | if ((Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. & NF_PEER_PEERcxx . . $ `Descent3/multi_external.h:230:9`!) && i != Player_numcxx . . $ Player_num.) |
| 1996 | continue; // Don't send out other positions if in peer mode |
| 1997 | |
| 1998 | // Don't send out position of the server in dedicated mode. |
| 1999 | if (Dedicated_servercxx . . $ Dedicated_server. && (i == Player_numcxx . . $ Player_num.)) |
| 2000 | continue; |
| 2001 | |
| 2002 | // Don't send out position of dead players (ghosts) or observers |
| 2003 | if (Objectscxx . . $ Objects.[Playerscxx . . $ Players.[i].objnumcxx . . $ player#objnum.].typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) |
| 2004 | continue; |
| 2005 | |
| 2006 | if (i != Player_numcxx . . $ Player_num.) |
| 2007 | Multi_last_sent_timecxx . . $ Multi_last_sent_time.[to_slot][i] += Frametimecxx . . $ Frametime.; |
| 2008 | |
| 2009 | if (i == to_slot) |
| 2010 | continue; |
| 2011 | |
| 2012 | if (!(NetPlayerscxx . . $ NetPlayers.[i].flagscxx . . $ netplayer#flags. & NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!)) { |
| 2013 | Multi_visible_playerscxx . . $ Multi_visible_players.[i] &= ~(1 << to_slot); |
| 2014 | Multi_visible_playerscxx . . $ Multi_visible_players.[to_slot] &= ~(1 << i); |
| 2015 | continue; |
| 2016 | } |
| 2017 | |
| 2018 | if (NetPlayerscxx . . $ NetPlayers.[i].sequencecxx . . $ netplayer#sequence. != NETSEQ_PLAYINGcxx . . $ `Descent3/multi_external.h:161:9`!) { |
| 2019 | Multi_visible_playerscxx . . $ Multi_visible_players.[i] &= ~(1 << to_slot); |
| 2020 | Multi_visible_playerscxx . . $ Multi_visible_players.[to_slot] &= ~(1 << i); |
| 2021 | continue; |
| 2022 | } |
| 2023 | |
| 2024 | // Find out the player priority of this player in relation to the to_slot player |
| 2025 | float pps_check_time = NetPlayerscxx . . $ NetPlayers.[to_slot].ppscxx . . $ netplayer#pps.; |
| 2026 | |
| 2027 | /*if (pps_check_time>=8) |
| 2028 | { |
| 2029 | vector subvec=Objects[Players[i].objnum].pos-Objects[Players[to_slot].objnum].pos; |
| 2030 | float mag=vm_GetMagnitudeFast (&subvec); |
| 2031 | subvec/=mag; |
| 2032 | |
| 2033 | float dp=vm_DotProduct (&subvec,&Objects[Players[to_slot].objnum].orient.fvec); |
| 2034 | dp=fabs(dp); |
| 2035 | |
| 2036 | pps_check_time=((float)pps_check_time/2.0)+((dp*((float)pps_check_time/2.0))+(dp*.9)); |
| 2037 | pps_check_time=std::clamp(pps_check_time,6.0,20.0); |
| 2038 | |
| 2039 | int pps=pps_check_time; |
| 2040 | pps_check_time=pps; |
| 2041 | }*/ |
| 2042 | |
| 2043 | // Set the timer as popped if it actually did |
| 2044 | if (Multi_last_sent_timecxx . . $ Multi_last_sent_time.[to_slot][i] > (1.0 / pps_check_time)) |
| 2045 | timer_popped = 1; |
| 2046 | |
| 2047 | // if (i==Player_num) // Always send server position |
| 2048 | // send_position=1; |
| 2049 | |
| 2050 | int num_src_to_check = 1; |
| 2051 | int srcs[10]; |
| 2052 | srcs[0] = Playerscxx . . $ Players.[to_slot].objnumcxx . . $ player#objnum.; |
| 2053 | |
| 2054 | // Check for guideds |
| 2055 | if (Playerscxx . . $ Players.[to_slot].guided_objcxx . . $ player#guided_obj. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 2056 | srcs[num_src_to_check++] = Playerscxx . . $ Players.[to_slot].guided_objcxx . . $ player#guided_obj. - Objectscxx . . $ Objects.; |
| 2057 | |
| 2058 | if (Playerscxx . . $ Players.[to_slot].small_dll_objcxx . . $ player#small_dll_obj. != -1) { |
| 2059 | int objnum = Playerscxx . . $ Players.[to_slot].small_dll_objcxx . . $ player#small_dll_obj.; |
| 2060 | if (Objectscxx . . $ Objects.[objnum].flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`! || Objectscxx . . $ Objects.[objnum].typecxx . . $ object#type. == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) { |
| 2061 | Playerscxx . . $ Players.[to_slot].small_dll_objcxx . . $ player#small_dll_obj. = -1; |
| 2062 | } else { |
| 2063 | srcs[num_src_to_check] = objnum; |
| 2064 | num_src_to_check++; |
| 2065 | } |
| 2066 | } |
| 2067 | |
| 2068 | // See if there are any small views we need to send for |
| 2069 | // Do left view |
| 2070 | if (Playerscxx . . $ Players.[to_slot].small_left_objcxx . . $ player#small_left_obj. != -1) { |
| 2071 | int objnum = Playerscxx . . $ Players.[to_slot].small_left_objcxx . . $ player#small_left_obj.; |
| 2072 | if (Objectscxx . . $ Objects.[objnum].flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`! || Objectscxx . . $ Objects.[objnum].typecxx . . $ object#type. == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`! || Objectscxx . . $ Objects.[objnum].typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!) { |
| 2073 | Playerscxx . . $ Players.[to_slot].small_left_objcxx . . $ player#small_left_obj. = -1; |
| 2074 | } else { |
| 2075 | srcs[num_src_to_check] = objnum; |
| 2076 | num_src_to_check++; |
| 2077 | } |
| 2078 | } |
| 2079 | |
| 2080 | // Do right view |
| 2081 | if (Playerscxx . . $ Players.[to_slot].small_right_objcxx . . $ player#small_right_obj. != -1) { |
| 2082 | int objnum = Playerscxx . . $ Players.[to_slot].small_right_objcxx . . $ player#small_right_obj.; |
| 2083 | if ((Objectscxx . . $ Objects.[objnum].flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`!) || (Objectscxx . . $ Objects.[objnum].typecxx . . $ object#type. == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) || |
| 2084 | (Objectscxx . . $ Objects.[objnum].typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!)) { |
| 2085 | Playerscxx . . $ Players.[to_slot].small_right_objcxx . . $ player#small_right_obj. = -1; |
| 2086 | } else { |
| 2087 | srcs[num_src_to_check] = objnum; |
| 2088 | num_src_to_check++; |
| 2089 | } |
| 2090 | } |
| 2091 | |
| 2092 | for (int t = 0; t < num_src_to_check; t++) { |
| 2093 | int room_a = Objectscxx . . $ Objects.[srcs[t]].roomnumcxx . . $ object#roomnum.; |
| 2094 | int room_b = Objectscxx . . $ Objects.[Playerscxx . . $ Players.[i].objnumcxx . . $ player#objnum.].roomnumcxx . . $ object#roomnum.; |
| 2095 | |
| 2096 | if (BOA_IsVisiblecxx . . $ BOA_IsVisible(cf9ef193275fa6d8).(room_a, room_b)) |
| 2097 | send_position = 1; |
| 2098 | |
| 2099 | if (Player_fire_packetcxx . . $ Player_fire_packet.[i].fired_on_this_framecxx . . $ player_fire_packet#fired_on_this_frame. != PFP_NO_FIREDcxx . . $ `Descent3/multi.h:659:9`!) { |
| 2100 | timer_popped = 1; |
| 2101 | |
| 2102 | if (Player_fire_packetcxx . . $ Player_fire_packet.[i].wb_indexcxx . . $ player_fire_packet#wb_index. >= SECONDARY_INDEXcxx . . $ `Descent3/weapon.h:255:9`!) { |
| 2103 | send_position = 1; |
| 2104 | } else { |
| 2105 | if (BOA_IsVisiblecxx . . $ BOA_IsVisible(cf9ef193275fa6d8).(Player_fire_packetcxx . . $ Player_fire_packet.[i].dest_roomnumcxx . . $ player_fire_packet#dest_roomnum., Objectscxx . . $ Objects.[srcs[t]].roomnumcxx . . $ object#roomnum.)) |
| 2106 | send_position = 1; |
| 2107 | } |
| 2108 | } |
| 2109 | } |
| 2110 | |
| 2111 | // Always send the server position, because we always say that the server is visible. This |
| 2112 | // should fix some or all ghost ship problems. |
| 2113 | if (i == Player_numcxx . . $ Player_num.) { |
| 2114 | send_position = 1; |
| 2115 | } |
| 2116 | |
| 2117 | if (timer_popped) { |
| 2118 | if (i != Player_numcxx . . $ Player_num.) |
| 2119 | Multi_last_sent_timecxx . . $ Multi_last_sent_time.[to_slot][i] = 0; |
| 2120 | |
| 2121 | if (send_position) { |
| 2122 | Multi_visible_playerscxx . . $ Multi_visible_players.[to_slot] |= (1 << i); |
| 2123 | |
| 2124 | int count = MultiStuffPositioncxx . . $ MultiStuffPosition(b2cc8657ba51080d).(i, data); |
| 2125 | NetPlayerscxx . . $ NetPlayers.[to_slot].total_bytes_sentcxx . . $ netplayer#total_bytes_sent. += count; |
| 2126 | |
| 2127 | int add_count = 0; |
| 2128 | // Send firing if needed |
| 2129 | if (Player_fire_packetcxx . . $ Player_fire_packet.[i].fired_on_this_framecxx . . $ player_fire_packet#fired_on_this_frame. == PFP_FIREDcxx . . $ `Descent3/multi.h:660:9`!) |
| 2130 | add_count = MultiStuffPlayerFirecxx . . $ MultiStuffPlayerFire(b2cc8657ba51080d).(i, &data[count]); |
| 2131 | count += add_count; |
| 2132 | // Add in guided stuff |
| 2133 | if (Playerscxx . . $ Players.[i].guided_objcxx . . $ player#guided_obj. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 2134 | add_count = MultiStuffGuidedInfocxx . . $ MultiStuffGuidedInfo(b2cc8657ba51080d).(i, &data[count]); |
| 2135 | count += add_count; |
| 2136 | } |
| 2137 | |
| 2138 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(count < MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!); |
| 2139 | |
| 2140 | nw_Sendcxx . . $ nw_Send(102d2f582237fe86).(&NetPlayerscxx . . $ NetPlayers.[to_slot].addrcxx . . $ netplayer#addr., data, count, 0); |
| 2141 | |
| 2142 | // TODO: SEND RELIABLE WEAPON FIRE HERE |
| 2143 | if (Player_fire_packetcxx . . $ Player_fire_packet.[i].fired_on_this_framecxx . . $ player_fire_packet#fired_on_this_frame. == PFP_FIRED_RELIABLEcxx . . $ `Descent3/multi.h:661:9`!) { |
| 2144 | // mprintf(0,"NEED TO SEND RELIABLE FIRE FOR %d\n",i); |
| 2145 | count = MultiStuffPlayerFirecxx . . $ MultiStuffPlayerFire(b2cc8657ba51080d).(i, data); |
| 2146 | nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[to_slot].reliable_socketcxx . . $ netplayer#reliable_socket., data, count, true); |
| 2147 | } |
| 2148 | } else { |
| 2149 | Multi_visible_playerscxx . . $ Multi_visible_players.[to_slot] &= ~(1 << i); |
| 2150 | Multi_occludedcxx . . $ Multi_occluded.++; |
| 2151 | } |
| 2152 | } |
| 2153 | } |
| 2154 | } |
| 2155 | |
| 2156 | // Figures out which robots have moved since the last time this player slot was updated |
| 2157 | void MultiUpdateRobotMovedListcxx . . $ MultiUpdateRobotMovedList(d4f767463ce0a6b3).(int slot) { |
| 2158 | bool skip_this_obj = false; |
| 2159 | // check for moved robots |
| 2160 | for (int a = 0; a <= Highest_object_indexcxx . . $ Highest_object_index.; a++) { |
| 2161 | objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[a]; |
| 2162 | if (obj->typecxx . . $ object#type. == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) |
| 2163 | continue; |
| 2164 | |
| 2165 | if (MultiIsValidMovedObjectcxx . . $ MultiIsValidMovedObject(39516aeee13ca5ab).(obj)) { |
| 2166 | if ((obj->flagscxx . . $ object#flags. & OF_MOVED_THIS_FRAMEcxx . . $ `Descent3/object_external.h:274:9`!)) { |
| 2167 | skip_this_obj = false; |
| 2168 | // mprintf(0,"Object %d (type=%d) moved this frame!\n",a,obj->type); |
| 2169 | // Check to see if this robot is on the list already |
| 2170 | for (int b = 0; b < Num_moved_robotscxx . . $ Num_moved_robots.[slot] && !skip_this_obj; b++) { |
| 2171 | if (Moved_robotscxx . . $ Moved_robots.[slot][b] == obj->handlecxx . . $ object#handle.) { |
| 2172 | skip_this_obj = true; |
| 2173 | } |
| 2174 | } |
| 2175 | |
| 2176 | if (!skip_this_obj) { |
| 2177 | Moved_robotscxx . . $ Moved_robots.[slot][Num_moved_robotscxx . . $ Num_moved_robots.[slot]] = obj->handlecxx . . $ object#handle.; |
| 2178 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Objects[a].flags & OF_CLIENT_KNOWScxx . . $ `Descent3/object_external.h:289:9`!); |
| 2179 | Num_moved_robotscxx . . $ Num_moved_robots.[slot]++; |
| 2180 | } |
| 2181 | } |
| 2182 | } |
| 2183 | } |
| 2184 | } |
| 2185 | |
| 2186 | // Sets up our data structures so that the nonvisible robots will be sent when they are needed |
| 2187 | void MultiSetupNonVisRobotscxx . . $ MultiSetupNonVisRobots(14473714f2cc5bd2).(int slot, objectcxx . . $ object# *obj) { obj->generic_nonvis_flagscxx . . $ object#generic_nonvis_flags. |= (1 << slot); } |
| 2188 | |
| 2189 | // Sends out a list of generics that this client can't see |
| 2190 | void MultiSendGenericNonViscxx . . $ MultiSendGenericNonVis(8a9b5558cd8e6824).(int slot, uint16_tcxx . . $ uint16_t# *objarray, int num) { |
| 2191 | uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 2192 | int count = 0; |
| 2193 | int size_offset; |
| 2194 | |
| 2195 | size_offset = START_DATAcxx . . $ START_DATA(8c36ee1faa9e0a0b).(MP_GENERIC_NONVIScxx . . $ `Descent3/multi.h:633:9`!, data, &count); |
| 2196 | |
| 2197 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(num, data, &count); |
| 2198 | |
| 2199 | for (int i = 0; i < num; i++) { |
| 2200 | MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(objarray[i], data, &count); |
| 2201 | } |
| 2202 | |
| 2203 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(count < MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!); |
| 2204 | |
| 2205 | END_DATAcxx . . $ END_DATA(dde21517a502ab05).(count, data, size_offset); |
| 2206 | |
| 2207 | // Send it out |
| 2208 | nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[slot].reliable_socketcxx . . $ netplayer#reliable_socket., data, count); |
| 2209 | } |
| 2210 | |
| 2211 | // Does the bookkeeping that needs to be done for non visible generic objects and a player |
| 2212 | void MultiDoNonVisGenericForSlotcxx . . $ MultiDoNonVisGenericForSlot(d4f767463ce0a6b3).(int slot) { |
| 2213 | // Keep track of the ones we need to send about |
| 2214 | uint16_tcxx . . $ uint16_t# send_out[MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!]; |
| 2215 | int num_to_send = 0; |
| 2216 | int i; |
| 2217 | |
| 2218 | // Deal with non-vis objects |
| 2219 | for (i = 0; i <= Highest_object_indexcxx . . $ Highest_object_index.; i++) { |
| 2220 | int objnum = i; |
| 2221 | objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[i]; |
| 2222 | if (obj->typecxx . . $ object#type. == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) |
| 2223 | continue; |
| 2224 | |
| 2225 | if (obj->generic_nonvis_flagscxx . . $ object#generic_nonvis_flags. & (1 << slot)) { |
| 2226 | if (MultiIsValidMovedObjectcxx . . $ MultiIsValidMovedObject(39516aeee13ca5ab).(obj)) { |
| 2227 | if (!(obj->generic_sent_nonviscxx . . $ object#generic_sent_nonvis. & (1 << slot))) { |
| 2228 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj->flags & OF_CLIENT_KNOWScxx . . $ `Descent3/object_external.h:289:9`!); |
| 2229 | send_out[num_to_send++] = objnum; |
| 2230 | obj->generic_sent_nonviscxx . . $ object#generic_sent_nonvis. |= (1 << slot); |
| 2231 | } |
| 2232 | |
| 2233 | bool skip_this_obj = false; |
| 2234 | int b; |
| 2235 | |
| 2236 | // For movement, Check to see if this robot is on the list already |
| 2237 | for (b = 0; b < Num_moved_robotscxx . . $ Num_moved_robots.[slot] && !skip_this_obj; b++) { |
| 2238 | if (Moved_robotscxx . . $ Moved_robots.[slot][b] == obj->handlecxx . . $ object#handle.) { |
| 2239 | skip_this_obj = true; |
| 2240 | } |
| 2241 | } |
| 2242 | |
| 2243 | if (!skip_this_obj) { |
| 2244 | if (Num_moved_robotscxx . . $ Num_moved_robots.[slot] < MAX_CHANGED_OBJECTScxx . . $ `Descent3/multi_server.h:30:9`!) { |
| 2245 | Moved_robotscxx . . $ Moved_robots.[slot][Num_moved_robotscxx . . $ Num_moved_robots.[slot]] = obj->handlecxx . . $ object#handle.; |
| 2246 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Objects[i].flags & OF_CLIENT_KNOWScxx . . $ `Descent3/object_external.h:289:9`!); |
| 2247 | Num_moved_robotscxx . . $ Num_moved_robots.[slot]++; |
| 2248 | } |
| 2249 | } |
| 2250 | |
| 2251 | // Now do changed anim |
| 2252 | skip_this_obj = false; |
| 2253 | // Check to see if this robot is on the list already |
| 2254 | for (b = 0; b < Num_changed_animcxx . . $ Num_changed_anim.[slot]; b++) { |
| 2255 | if (Changed_animcxx . . $ Changed_anim.[b][slot] == Objectscxx . . $ Objects.[objnum].handlecxx . . $ object#handle.) { |
| 2256 | skip_this_obj = true; |
| 2257 | break; |
| 2258 | } |
| 2259 | } |
| 2260 | if (skip_this_obj == false) { |
| 2261 | if (Num_changed_animcxx . . $ Num_changed_anim.[slot] < MAX_CHANGED_OBJECTScxx . . $ `Descent3/multi_server.h:30:9`!) { |
| 2262 | Changed_animcxx . . $ Changed_anim.[Num_changed_animcxx . . $ Num_changed_anim.[slot]][slot] = Objectscxx . . $ Objects.[objnum].handlecxx . . $ object#handle.; |
| 2263 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Objects[i].flags & OF_CLIENT_KNOWScxx . . $ `Descent3/object_external.h:289:9`!); |
| 2264 | Num_changed_animcxx . . $ Num_changed_anim.[slot]++; |
| 2265 | } |
| 2266 | } |
| 2267 | |
| 2268 | // Now do changed turrets |
| 2269 | skip_this_obj = false; |
| 2270 | // Check to see if this robot is on the list already |
| 2271 | for (b = 0; b < Num_changed_turretcxx . . $ Num_changed_turret.[slot]; b++) { |
| 2272 | if (Changed_turretcxx . . $ Changed_turret.[b][slot] == Objectscxx . . $ Objects.[objnum].handlecxx . . $ object#handle.) { |
| 2273 | skip_this_obj = true; |
| 2274 | break; |
| 2275 | } |
| 2276 | } |
| 2277 | if (skip_this_obj == false) { |
| 2278 | if (Num_changed_turretcxx . . $ Num_changed_turret.[slot] < MAX_CHANGED_OBJECTScxx . . $ `Descent3/multi_server.h:30:9`!) { |
| 2279 | Changed_turretcxx . . $ Changed_turret.[Num_changed_turretcxx . . $ Num_changed_turret.[slot]][slot] = Objectscxx . . $ Objects.[objnum].handlecxx . . $ object#handle.; |
| 2280 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Objects[i].flags & OF_CLIENT_KNOWScxx . . $ `Descent3/object_external.h:289:9`!); |
| 2281 | Num_changed_turretcxx . . $ Num_changed_turret.[slot]++; |
| 2282 | } |
| 2283 | } |
| 2284 | |
| 2285 | // Finally, do WB anim |
| 2286 | skip_this_obj = false; |
| 2287 | // Check to see if this robot is on the list already |
| 2288 | for (b = 0; b < Num_changed_wb_animcxx . . $ Num_changed_wb_anim.[slot]; b++) { |
| 2289 | if (Changed_wb_animcxx . . $ Changed_wb_anim.[b][slot] == Objectscxx . . $ Objects.[objnum].handlecxx . . $ object#handle.) { |
| 2290 | skip_this_obj = true; |
| 2291 | break; |
| 2292 | } |
| 2293 | } |
| 2294 | if (skip_this_obj == false) { |
| 2295 | if (Num_changed_wb_animcxx . . $ Num_changed_wb_anim.[slot] < MAX_CHANGED_OBJECTScxx . . $ `Descent3/multi_server.h:30:9`!) { |
| 2296 | Changed_wb_animcxx . . $ Changed_wb_anim.[Num_changed_wb_animcxx . . $ Num_changed_wb_anim.[slot]][slot] = Objectscxx . . $ Objects.[objnum].handlecxx . . $ object#handle.; |
| 2297 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Objects[i].flags & OF_CLIENT_KNOWScxx . . $ `Descent3/object_external.h:289:9`!); |
| 2298 | Num_changed_wb_animcxx . . $ Num_changed_wb_anim.[slot]++; |
| 2299 | } |
| 2300 | } |
| 2301 | } |
| 2302 | |
| 2303 | // Clear our flag |
| 2304 | obj->generic_nonvis_flagscxx . . $ object#generic_nonvis_flags. &= ~(1 << slot); |
| 2305 | } |
| 2306 | } |
| 2307 | |
| 2308 | // Now send out what we need to |
| 2309 | if (num_to_send > 0) { |
| 2310 | int num_packets = num_to_send / 100; |
| 2311 | int num_left = num_to_send % 100; |
| 2312 | |
| 2313 | for (i = 0; i < num_packets; i++) |
| 2314 | MultiSendGenericNonViscxx . . $ MultiSendGenericNonVis(8a9b5558cd8e6824).(slot, &send_out[i * 100], 100); |
| 2315 | |
| 2316 | // Send out leftovers |
| 2317 | if (num_left > 0) |
| 2318 | MultiSendGenericNonViscxx . . $ MultiSendGenericNonVis(8a9b5558cd8e6824).(slot, &send_out[num_packets * 100], num_left); |
| 2319 | } |
| 2320 | } |
| 2321 | |
| 2322 | // Returns true or false based on whether or not the player can see this generic object in a multiplayer game |
| 2323 | // This takes into account markers, dll objects, and other stuff |
| 2324 | bool MultiIsGenericVisibleToPlayercxx . . $ MultiIsGenericVisibleToPlayer(cf9ef193275fa6d8).(int test_objnum, int to_slot) { |
| 2325 | int srcs[10], num_src_to_check = 1; |
| 2326 | |
| 2327 | srcs[0] = Playerscxx . . $ Players.[to_slot].objnumcxx . . $ player#objnum.; |
| 2328 | |
| 2329 | if (Playerscxx . . $ Players.[to_slot].guided_objcxx . . $ player#guided_obj. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 2330 | srcs[num_src_to_check++] = Playerscxx . . $ Players.[to_slot].guided_objcxx . . $ player#guided_obj. - Objectscxx . . $ Objects.; |
| 2331 | |
| 2332 | if (Playerscxx . . $ Players.[to_slot].small_dll_objcxx . . $ player#small_dll_obj. != -1) { |
| 2333 | int objnum = Playerscxx . . $ Players.[to_slot].small_dll_objcxx . . $ player#small_dll_obj.; |
| 2334 | if (Objectscxx . . $ Objects.[objnum].flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`! || Objectscxx . . $ Objects.[objnum].typecxx . . $ object#type. == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`!) { |
| 2335 | Playerscxx . . $ Players.[to_slot].small_dll_objcxx . . $ player#small_dll_obj. = -1; |
| 2336 | } else { |
| 2337 | srcs[num_src_to_check] = objnum; |
| 2338 | num_src_to_check++; |
| 2339 | } |
| 2340 | } |
| 2341 | // See if there are any small views we need to send for |
| 2342 | // Do left view |
| 2343 | if (Playerscxx . . $ Players.[to_slot].small_left_objcxx . . $ player#small_left_obj. != -1) { |
| 2344 | int objnum = Playerscxx . . $ Players.[to_slot].small_left_objcxx . . $ player#small_left_obj.; |
| 2345 | if (Objectscxx . . $ Objects.[objnum].flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`! || Objectscxx . . $ Objects.[objnum].typecxx . . $ object#type. == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`! || Objectscxx . . $ Objects.[objnum].typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!) { |
| 2346 | Playerscxx . . $ Players.[to_slot].small_left_objcxx . . $ player#small_left_obj. = -1; |
| 2347 | } else { |
| 2348 | srcs[num_src_to_check] = objnum; |
| 2349 | num_src_to_check++; |
| 2350 | } |
| 2351 | } |
| 2352 | |
| 2353 | // Do right view |
| 2354 | if (Playerscxx . . $ Players.[to_slot].small_right_objcxx . . $ player#small_right_obj. != -1) { |
| 2355 | int objnum = Playerscxx . . $ Players.[to_slot].small_right_objcxx . . $ player#small_right_obj.; |
| 2356 | if (Objectscxx . . $ Objects.[objnum].flagscxx . . $ object#flags. & OF_DEADcxx . . $ `Descent3/object_external.h:270:9`! || Objectscxx . . $ Objects.[objnum].typecxx . . $ object#type. == OBJ_NONEcxx . . $ `Descent3/object_external.h:159:9`! || Objectscxx . . $ Objects.[objnum].typecxx . . $ object#type. == OBJ_WEAPONcxx . . $ `Descent3/object_external.h:165:9`!) { |
| 2357 | Playerscxx . . $ Players.[to_slot].small_right_objcxx . . $ player#small_right_obj. = -1; |
| 2358 | } else { |
| 2359 | srcs[num_src_to_check] = objnum; |
| 2360 | num_src_to_check++; |
| 2361 | } |
| 2362 | } |
| 2363 | |
| 2364 | for (int t = 0; t < num_src_to_check; t++) { |
| 2365 | if (BOA_IsVisiblecxx . . $ BOA_IsVisible(cf9ef193275fa6d8).(Objectscxx . . $ Objects.[test_objnum].roomnumcxx . . $ object#roomnum., Objectscxx . . $ Objects.[srcs[t]].roomnumcxx . . $ object#roomnum.)) |
| 2366 | return true; |
| 2367 | } |
| 2368 | |
| 2369 | return false; |
| 2370 | } |
| 2371 | |
| 2372 | // Does robot stuff for a particular client |
| 2373 | void MultiDoServerRobotFramecxx . . $ MultiDoServerRobotFrame(d4f767463ce0a6b3).(int slot) { |
| 2374 | int rcount = 0; |
| 2375 | int m = 0; |
| 2376 | uint8_tcxx . . $ uint8_t# rdata[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 2377 | |
| 2378 | // send robot information for any robots that have moved. |
| 2379 | for (m = 0; m < Num_moved_robotscxx . . $ Num_moved_robots.[slot]; m++) { |
| 2380 | int send_position = 0; |
| 2381 | int objnum = Moved_robotscxx . . $ Moved_robots.[slot][m] & HANDLE_OBJNUM_MASKcxx . . $ `Descent3/object.h:642:9`!; |
| 2382 | |
| 2383 | if (Moved_robotscxx . . $ Moved_robots.[slot][m] != Objectscxx . . $ Objects.[objnum].handlecxx . . $ object#handle.) { |
| 2384 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Caught handle objnum problem!\n"); |
| 2385 | continue; |
| 2386 | } |
| 2387 | |
| 2388 | if (MultiIsGenericVisibleToPlayercxx . . $ MultiIsGenericVisibleToPlayer(cf9ef193275fa6d8).(objnum, slot)) |
| 2389 | send_position = 1; |
| 2390 | |
| 2391 | if (send_position) { |
| 2392 | rcount = MultiStuffRobotPositioncxx . . $ MultiStuffRobotPosition(9bed83f5e0cbe331).(objnum, rdata); |
| 2393 | if (rcount > 0) { |
| 2394 | if (Multi_send_sizecxx . . $ Multi_send_size.[slot] + rcount >= MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!) |
| 2395 | MultiSendFullPacketcxx . . $ MultiSendFullPacket(3e454b8ccf442868).(slot, 0); |
| 2396 | memcpy(&Multi_send_buffercxx . . $ Multi_send_buffer.[slot][Multi_send_sizecxx . . $ Multi_send_size.[slot]], rdata, rcount); |
| 2397 | Multi_send_sizecxx . . $ Multi_send_size.[slot] += rcount; |
| 2398 | } |
| 2399 | |
| 2400 | Objectscxx . . $ Objects.[objnum].generic_sent_nonviscxx . . $ object#generic_sent_nonvis. &= ~(1 << slot); |
| 2401 | } else |
| 2402 | MultiSetupNonVisRobotscxx . . $ MultiSetupNonVisRobots(14473714f2cc5bd2).(slot, &Objectscxx . . $ Objects.[objnum]); |
| 2403 | } |
| 2404 | |
| 2405 | // clear the robot movement flag for this player |
| 2406 | Num_moved_robotscxx . . $ Num_moved_robots.[slot] = 0; |
| 2407 | |
| 2408 | // Now do anim changed stuff |
| 2409 | for (m = 0; m < Num_changed_animcxx . . $ Num_changed_anim.[slot]; m++) { |
| 2410 | int send_position = 0; |
| 2411 | int objnum = Changed_animcxx . . $ Changed_anim.[m][slot] & HANDLE_OBJNUM_MASKcxx . . $ `Descent3/object.h:642:9`!; |
| 2412 | |
| 2413 | objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[objnum]; |
| 2414 | |
| 2415 | if (Changed_animcxx . . $ Changed_anim.[m][slot] != obj->handlecxx . . $ object#handle.) { |
| 2416 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Caught anim handle objnum problem!\n"); |
| 2417 | continue; |
| 2418 | } |
| 2419 | |
| 2420 | if (MultiIsGenericVisibleToPlayercxx . . $ MultiIsGenericVisibleToPlayer(cf9ef193275fa6d8).(objnum, slot)) |
| 2421 | send_position = 1; |
| 2422 | |
| 2423 | if (send_position) { |
| 2424 | rcount = MultiStuffObjAnimUpdatecxx . . $ MultiStuffObjAnimUpdate(9bed83f5e0cbe331).(objnum, rdata); |
| 2425 | if (Multi_send_sizecxx . . $ Multi_send_size.[slot] + rcount >= MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!) |
| 2426 | MultiSendFullPacketcxx . . $ MultiSendFullPacket(3e454b8ccf442868).(slot, 0); |
| 2427 | memcpy(&Multi_send_buffercxx . . $ Multi_send_buffer.[slot][Multi_send_sizecxx . . $ Multi_send_size.[slot]], rdata, rcount); |
| 2428 | Multi_send_sizecxx . . $ Multi_send_size.[slot] += rcount; |
| 2429 | Objectscxx . . $ Objects.[objnum].generic_sent_nonviscxx . . $ object#generic_sent_nonvis. &= ~(1 << slot); |
| 2430 | } else |
| 2431 | MultiSetupNonVisRobotscxx . . $ MultiSetupNonVisRobots(14473714f2cc5bd2).(slot, &Objectscxx . . $ Objects.[objnum]); |
| 2432 | } |
| 2433 | // Clear changed animation for this player |
| 2434 | Num_changed_animcxx . . $ Num_changed_anim.[slot] = 0; |
| 2435 | |
| 2436 | // Now send any changed turrets |
| 2437 | for (m = 0; m < Num_changed_turretcxx . . $ Num_changed_turret.[slot]; m++) { |
| 2438 | int send_position = 0; |
| 2439 | int objnum = Changed_turretcxx . . $ Changed_turret.[m][slot] & HANDLE_OBJNUM_MASKcxx . . $ `Descent3/object.h:642:9`!; |
| 2440 | |
| 2441 | objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[objnum]; |
| 2442 | |
| 2443 | if (Changed_turretcxx . . $ Changed_turret.[m][slot] != obj->handlecxx . . $ object#handle.) { |
| 2444 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Caught turret handle objnum problem!\n"); |
| 2445 | continue; |
| 2446 | } |
| 2447 | |
| 2448 | if (MultiIsGenericVisibleToPlayercxx . . $ MultiIsGenericVisibleToPlayer(cf9ef193275fa6d8).(objnum, slot)) |
| 2449 | send_position = 1; |
| 2450 | |
| 2451 | if (send_position) { |
| 2452 | rcount = MultiStuffTurretUpdatecxx . . $ MultiStuffTurretUpdate(9bed83f5e0cbe331).(objnum, rdata); |
| 2453 | if (Multi_send_sizecxx . . $ Multi_send_size.[slot] + rcount >= MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!) |
| 2454 | MultiSendFullPacketcxx . . $ MultiSendFullPacket(3e454b8ccf442868).(slot, 0); |
| 2455 | memcpy(&Multi_send_buffercxx . . $ Multi_send_buffer.[slot][Multi_send_sizecxx . . $ Multi_send_size.[slot]], rdata, rcount); |
| 2456 | Multi_send_sizecxx . . $ Multi_send_size.[slot] += rcount; |
| 2457 | Objectscxx . . $ Objects.[objnum].generic_sent_nonviscxx . . $ object#generic_sent_nonvis. &= ~(1 << slot); |
| 2458 | } else |
| 2459 | MultiSetupNonVisRobotscxx . . $ MultiSetupNonVisRobots(14473714f2cc5bd2).(slot, &Objectscxx . . $ Objects.[objnum]); |
| 2460 | } |
| 2461 | // Clear changed turret flag for this player |
| 2462 | Num_changed_turretcxx . . $ Num_changed_turret.[slot] = 0; |
| 2463 | |
| 2464 | // Next is weapon battery animation states |
| 2465 | for (m = 0; m < Num_changed_wb_animcxx . . $ Num_changed_wb_anim.[slot]; m++) { |
| 2466 | int send_position = 0; |
| 2467 | int objnum = Changed_wb_animcxx . . $ Changed_wb_anim.[m][slot] & HANDLE_OBJNUM_MASKcxx . . $ `Descent3/object.h:642:9`!; |
| 2468 | |
| 2469 | objectcxx . . $ object# *obj = &Objectscxx . . $ Objects.[objnum]; |
| 2470 | |
| 2471 | if (Changed_wb_animcxx . . $ Changed_wb_anim.[m][slot] != obj->handlecxx . . $ object#handle.) { |
| 2472 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Caught wb anim handle objnum problem!\n"); |
| 2473 | continue; |
| 2474 | } |
| 2475 | |
| 2476 | if (MultiIsGenericVisibleToPlayercxx . . $ MultiIsGenericVisibleToPlayer(cf9ef193275fa6d8).(objnum, slot)) |
| 2477 | send_position = 1; |
| 2478 | |
| 2479 | if (send_position) { |
| 2480 | rcount = MultiStuffObjWBAnimUpdatecxx . . $ MultiStuffObjWBAnimUpdate(9bed83f5e0cbe331).(objnum, rdata); |
| 2481 | if (Multi_send_sizecxx . . $ Multi_send_size.[slot] + rcount >= MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!) |
| 2482 | MultiSendFullPacketcxx . . $ MultiSendFullPacket(3e454b8ccf442868).(slot, 0); |
| 2483 | memcpy(&Multi_send_buffercxx . . $ Multi_send_buffer.[slot][Multi_send_sizecxx . . $ Multi_send_size.[slot]], rdata, rcount); |
| 2484 | Multi_send_sizecxx . . $ Multi_send_size.[slot] += rcount; |
| 2485 | Objectscxx . . $ Objects.[objnum].generic_sent_nonviscxx . . $ object#generic_sent_nonvis. &= ~(1 << slot); |
| 2486 | } else |
| 2487 | MultiSetupNonVisRobotscxx . . $ MultiSetupNonVisRobots(14473714f2cc5bd2).(slot, &Objectscxx . . $ Objects.[objnum]); |
| 2488 | } |
| 2489 | |
| 2490 | Num_changed_wb_animcxx . . $ Num_changed_wb_anim.[slot] = 0; |
| 2491 | |
| 2492 | MultiSendFullPacketcxx . . $ MultiSendFullPacket(3e454b8ccf442868).(slot, 0); |
| 2493 | |
| 2494 | MultiDoNonVisGenericForSlotcxx . . $ MultiDoNonVisGenericForSlot(d4f767463ce0a6b3).(slot); |
| 2495 | } |
| 2496 | |
| 2497 | // Shoots a straight vector from all the firing players and finds out what room |
| 2498 | // they hit. This is useful for vis stuff |
| 2499 | |
| 2500 | void MultiGetDestFireRoomscxx . . $ MultiGetDestFireRooms(49f6e7a06ebc5aa8).() { |
| 2501 | for (int i = 0; i < MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!; i++) { |
| 2502 | if (!(NetPlayerscxx . . $ NetPlayers.[i].flagscxx . . $ netplayer#flags. & NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!)) |
| 2503 | continue; |
| 2504 | if (NetPlayerscxx . . $ NetPlayers.[i].flagscxx . . $ netplayer#flags. != NETSEQ_PLAYINGcxx . . $ `Descent3/multi_external.h:161:9`!) |
| 2505 | continue; |
| 2506 | |
| 2507 | if (Player_fire_packetcxx . . $ Player_fire_packet.[i].fired_on_this_framecxx . . $ player_fire_packet#fired_on_this_frame. == PFP_NO_FIREDcxx . . $ `Descent3/multi.h:659:9`!) |
| 2508 | continue; |
| 2509 | |
| 2510 | // Ok, so now we know the player has fired, so just cast a ray and see where it hits |
| 2511 | fvi_querycxx . . $ fvi_query# fq; |
| 2512 | fvi_infocxx . . $ fvi_info# hit_data; |
| 2513 | int fate; |
| 2514 | |
| 2515 | vectorcxx . . $ vector# dest_vector = Objectscxx . . $ Objects.[Playerscxx . . $ Players.[i].objnumcxx . . $ player#objnum.].poscxx . . $ object#pos. +cxx . . $ operator+(b77b703cd1e43e33). (Objectscxx . . $ Objects.[Playerscxx . . $ Players.[i].objnumcxx . . $ player#objnum.].orientcxx . . $ object#orient..fveccxx . . $ matrix#fvec. *cxx . . $ `operator*`(252247219a31502c). 50000); |
| 2516 | |
| 2517 | fq.p0cxx . . $ fvi_query#p0. = &Objectscxx . . $ Objects.[Playerscxx . . $ Players.[i].objnumcxx . . $ player#objnum.].poscxx . . $ object#pos.; |
| 2518 | fq.startroomcxx . . $ fvi_query#startroom. = Objectscxx . . $ Objects.[Playerscxx . . $ Players.[i].objnumcxx . . $ player#objnum.].roomnumcxx . . $ object#roomnum.; |
| 2519 | fq.p1cxx . . $ fvi_query#p1. = &dest_vector; |
| 2520 | fq.radcxx . . $ fvi_query#rad. = .05f; |
| 2521 | fq.thisobjnumcxx . . $ fvi_query#thisobjnum. = -1; |
| 2522 | fq.ignore_obj_listcxx . . $ fvi_query#ignore_obj_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 2523 | fq.flagscxx . . $ fvi_query#flags. = FQ_IGNORE_NON_LIGHTMAP_OBJECTScxx . . $ `lib/findintersection_external.h:68:9`! | FQ_CHECK_OBJScxx . . $ `lib/findintersection_external.h:59:9`!; |
| 2524 | |
| 2525 | fate = fvi_FindIntersectioncxx . . $ fvi_FindIntersection(e1c4d7bd350effc8).(&fq, &hit_data); |
| 2526 | |
| 2527 | if (hit_data.hit_roomcxx . . $ fvi_info#hit_room. < 0) |
| 2528 | Player_fire_packetcxx . . $ Player_fire_packet.[i].dest_roomnumcxx . . $ player_fire_packet#dest_roomnum. = hit_data.hit_roomcxx . . $ fvi_info#hit_room.; |
| 2529 | else { |
| 2530 | if (hit_data.hit_roomcxx . . $ fvi_info#hit_room. > Highest_room_indexcxx . . $ Highest_room_index.) |
| 2531 | Player_fire_packetcxx . . $ Player_fire_packet.[i].dest_roomnumcxx . . $ player_fire_packet#dest_roomnum. = Highest_room_indexcxx . . $ Highest_room_index. + 1; |
| 2532 | else { |
| 2533 | if (Roomscxx . . $ Rooms.[hit_data.hit_roomcxx . . $ fvi_info#hit_room.].flagscxx . . $ room#flags. & RF_EXTERNALcxx . . $ `Descent3/room_external.h:177:9`!) { |
| 2534 | int roomnum = GetTerrainRoomFromPoscxx . . $ GetTerrainRoomFromPos(177d9005acf670a0).(&hit_data.hit_pntcxx . . $ fvi_info#hit_pnt.); |
| 2535 | Player_fire_packetcxx . . $ Player_fire_packet.[i].dest_roomnumcxx . . $ player_fire_packet#dest_roomnum. = roomnum; |
| 2536 | } else |
| 2537 | Player_fire_packetcxx . . $ Player_fire_packet.[i].dest_roomnumcxx . . $ player_fire_packet#dest_roomnum. = hit_data.hit_roomcxx . . $ fvi_info#hit_room.; |
| 2538 | } |
| 2539 | } |
| 2540 | } |
| 2541 | } |
| 2542 | |
| 2543 | int Multi_occludedcxx . . $ Multi_occluded. = 0; |
| 2544 | #define MT_DATA_UPDATE_INTERVALcxx . . $ `Descent3/multi_server.cpp:2544:9`! 300 // 300 seconds |
| 2545 | // Does whatever the server needs to do for this frame |
| 2546 | void MultiDoServerFramecxx . . $ MultiDoServerFrame(49f6e7a06ebc5aa8).() { |
| 2547 | int i; |
| 2548 | |
| 2549 | if (Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. & NF_EXIT_NOWcxx . . $ `Descent3/multi_external.h:229:9`!) { |
| 2550 | // DLL says we should bail! |
| 2551 | Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. &= ~NF_EXIT_NOWcxx . . $ `Descent3/multi_external.h:229:9`!; |
| 2552 | MultiLeaveGamecxx . . $ MultiLeaveGame(49f6e7a06ebc5aa8).(); |
| 2553 | SetFunctionModecxx . . $ SetFunctionMode(63b1daf7e687142b).(MENU_MODEcxx . . $ MENU_MODE.); |
| 2554 | return; |
| 2555 | } |
| 2556 | |
| 2557 | if (NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].sequencecxx . . $ netplayer#sequence. == NETSEQ_PREGAMEcxx . . $ `Descent3/multi_external.h:148:9`!) { |
| 2558 | MultiFlushAllIncomingBufferscxx . . $ MultiFlushAllIncomingBuffers(49f6e7a06ebc5aa8).(); |
| 2559 | NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].sequencecxx . . $ netplayer#sequence. = NETSEQ_PLAYINGcxx . . $ `Descent3/multi_external.h:161:9`!; |
| 2560 | |
| 2561 | Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].time_in_gamecxx . . $ player#time_in_game. = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!(); |
| 2562 | |
| 2563 | // Pick a start slot for me |
| 2564 | Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].start_indexcxx . . $ player#start_index. = PlayerGetRandomStartPositioncxx . . $ PlayerGetRandomStartPosition(7864480464b09eea).(Player_numcxx . . $ Player_num.); |
| 2565 | PlayerMoveToStartPoscxx . . $ PlayerMoveToStartPos(3e454b8ccf442868).(Player_numcxx . . $ Player_num., Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].start_indexcxx . . $ player#start_index.); |
| 2566 | |
| 2567 | // Update the tracker if it's a master tracker game |
| 2568 | CallMultiDLLcxx . . $ CallMultiDLL(d4f767463ce0a6b3).(MT_EVT_FIRST_FRAMEcxx . . $ `Descent3/multi_dll_mgr.h:89:9`!); |
| 2569 | if (Game_is_master_tracker_gamecxx . . $ Game_is_master_tracker_game.) { |
| 2570 | NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].flagscxx . . $ netplayer#flags. |= NPF_MT_READING_PILOTcxx . . $ `Descent3/multi_external.h:168:9`!; |
| 2571 | strcpy(MTPilotinfocxx . . $ MTPilotinfo.[Player_numcxx . . $ Player_num.].tracker_idcxx . . $ vmt_descent3_struct#tracker_id., Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].tracker_idcxx . . $ player#tracker_id.); |
| 2572 | strcpy(MTPilotinfocxx . . $ MTPilotinfo.[Player_numcxx . . $ Player_num.].pilot_namecxx . . $ vmt_descent3_struct#pilot_name., Playerscxx . . $ Players.[Player_numcxx . . $ Player_num.].callsigncxx . . $ player#callsign.); |
| 2573 | NetPlayerscxx . . $ NetPlayers.[Player_numcxx . . $ Player_num.].flagscxx . . $ netplayer#flags. &= ~NPF_WROTE_RANKcxx . . $ `Descent3/multi_external.h:171:9`!; |
| 2574 | } |
| 2575 | |
| 2576 | if (Dedicated_servercxx . . $ Dedicated_server.) // Make this player an observer |
| 2577 | PlayerSwitchToObservercxx . . $ PlayerSwitchToObserver(b1146eedae1e1d0b).(Player_numcxx . . $ Player_num., OBSERVER_MODE_ROAMcxx . . $ `Descent3/player_external.h:75:9`!); |
| 2578 | |
| 2579 | for (int i = 0; i < MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!; i++) |
| 2580 | Multi_visible_playerscxx . . $ Multi_visible_players.[i] = 0xFFFFFFFF; |
| 2581 | } |
| 2582 | |
| 2583 | if (Game_is_master_tracker_gamecxx . . $ Game_is_master_tracker_game.) { |
| 2584 | CallMultiDLLcxx . . $ CallMultiDLL(d4f767463ce0a6b3).(MT_EVT_FRAMEcxx . . $ `Descent3/multi_dll_mgr.h:90:9`!); |
| 2585 | } |
| 2586 | |
| 2587 | // Check for new connections |
| 2588 | MultiCheckListencxx . . $ MultiCheckListen(49f6e7a06ebc5aa8).(); |
| 2589 | MultiDisconnectDeadPlayerscxx . . $ MultiDisconnectDeadPlayers(49f6e7a06ebc5aa8).(); |
| 2590 | MultiCheckToRespawnPowerupscxx . . $ MultiCheckToRespawnPowerups(49f6e7a06ebc5aa8).(); |
| 2591 | MultiCheckToRepositionPowerupscxx . . $ MultiCheckToRepositionPowerups(49f6e7a06ebc5aa8).(); |
| 2592 | |
| 2593 | // get the other net players data |
| 2594 | MultiProcessIncomingcxx . . $ MultiProcessIncoming(49f6e7a06ebc5aa8).(); |
| 2595 | |
| 2596 | // Find destination room if they fired |
| 2597 | MultiGetDestFireRoomscxx . . $ MultiGetDestFireRooms(49f6e7a06ebc5aa8).(); |
| 2598 | |
| 2599 | Player_countcxx . . $ Player_count. = 1; |
| 2600 | |
| 2601 | // Send out data |
| 2602 | for (i = 0; i < MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!; i++) { |
| 2603 | |
| 2604 | // Check to see if we should send rank to everyone |
| 2605 | if (Game_is_master_tracker_gamecxx . . $ Game_is_master_tracker_game.) { |
| 2606 | if (NetPlayerscxx . . $ NetPlayers.[i].flagscxx . . $ netplayer#flags. & NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!) { |
| 2607 | if (Playerscxx . . $ Players.[i].rankcxx . . $ player#rank. != -1) { |
| 2608 | if (!(NetPlayerscxx . . $ NetPlayers.[i].flagscxx . . $ netplayer#flags. & NPF_WROTE_RANKcxx . . $ `Descent3/multi_external.h:171:9`!)) { |
| 2609 | MultiSendInitialRankcxx . . $ MultiSendInitialRank(d4f767463ce0a6b3).(i); |
| 2610 | NetPlayerscxx . . $ NetPlayers.[i].flagscxx . . $ netplayer#flags. |= NPF_WROTE_RANKcxx . . $ `Descent3/multi_external.h:171:9`!; |
| 2611 | } |
| 2612 | } |
| 2613 | } |
| 2614 | } |
| 2615 | |
| 2616 | if (i == Player_numcxx . . $ Player_num.) { |
| 2617 | |
| 2618 | // START: code to fix clients not hearing server omega damage |
| 2619 | // Note the code here to keep us from sending the damage every frame. Since NetPlayers[].pps doesn't |
| 2620 | // seem to be defined for the server/player, I've hard-coded it to 12 fps. |
| 2621 | Multi_last_sent_timecxx . . $ Multi_last_sent_time.[i][Player_numcxx . . $ Player_num.] += Frametimecxx . . $ Frametime.; |
| 2622 | float last_client_update = Multi_last_sent_timecxx . . $ Multi_last_sent_time.[i][Player_numcxx . . $ Player_num.]; |
| 2623 | |
| 2624 | // Send other info if the timer has popped |
| 2625 | if (last_client_update > (1.0 / 12.0)) // was: (float)NetPlayers[i].pps |
| 2626 | { |
| 2627 | // Check to see if there is additional damage or shields to be added to this guy |
| 2628 | if (Multi_additional_damagecxx . . $ Multi_additional_damage.[i] != 0) { |
| 2629 | if (!(Playerscxx . . $ Players.[i].flagscxx . . $ player#flags. & (PLAYER_FLAGS_DYINGcxx . . $ `Descent3/player_external.h:80:9`! | PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`!))) |
| 2630 | MultiSendAdditionalDamagecxx . . $ MultiSendAdditionalDamage(c2f439e40e2f19ed).(i, Multi_additional_damage_typecxx . . $ Multi_additional_damage_type.[i], Multi_additional_damagecxx . . $ Multi_additional_damage.[i]); |
| 2631 | Multi_additional_damagecxx . . $ Multi_additional_damage.[i] = 0; |
| 2632 | Multi_additional_damage_typecxx . . $ Multi_additional_damage_type.[i] = PD_NONEcxx . . $ `Descent3/damage_external.h:23:9`!; |
| 2633 | } |
| 2634 | |
| 2635 | Multi_last_sent_timecxx . . $ Multi_last_sent_time.[i][Player_numcxx . . $ Player_num.] = 0; |
| 2636 | } |
| 2637 | // END: code to fix clients not hearing server omega damage |
| 2638 | |
| 2639 | continue; |
| 2640 | } |
| 2641 | |
| 2642 | if (NetPlayerscxx . . $ NetPlayers.[i].flagscxx . . $ netplayer#flags. & NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!) { |
| 2643 | // Check to see if this guy as any special requests |
| 2644 | if (NetPlayerscxx . . $ NetPlayers.[i].sequencecxx . . $ netplayer#sequence. == NETSEQ_REQUEST_PLAYERScxx . . $ `Descent3/multi_external.h:153:9`!) { |
| 2645 | for (int t = 0; t < MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!; t++) { |
| 2646 | if (NetPlayerscxx . . $ NetPlayers.[t].flagscxx . . $ netplayer#flags. & NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!) { |
| 2647 | MultiSendPlayercxx . . $ MultiSendPlayer(3e454b8ccf442868).(i, t); |
| 2648 | } |
| 2649 | } |
| 2650 | |
| 2651 | NetPlayerscxx . . $ NetPlayers.[i].sequencecxx . . $ netplayer#sequence. = NETSEQ_PLAYERScxx . . $ `Descent3/multi_external.h:154:9`!; |
| 2652 | MultiSendDonePlayerscxx . . $ MultiSendDonePlayers(d4f767463ce0a6b3).(i); |
| 2653 | } |
| 2654 | |
| 2655 | if (NetPlayerscxx . . $ NetPlayers.[i].sequencecxx . . $ netplayer#sequence. == NETSEQ_REQUEST_BUILDINGScxx . . $ `Descent3/multi_external.h:155:9`!) { |
| 2656 | MultiSendBuildingscxx . . $ MultiSendBuildings(d4f767463ce0a6b3).(i); |
| 2657 | NetPlayerscxx . . $ NetPlayers.[i].sequencecxx . . $ netplayer#sequence. = NETSEQ_BUILDINGScxx . . $ `Descent3/multi_external.h:156:9`!; |
| 2658 | MultiSendDoneBuildingscxx . . $ MultiSendDoneBuildings(d4f767463ce0a6b3).(i); |
| 2659 | } |
| 2660 | if (NetPlayerscxx . . $ NetPlayers.[i].sequencecxx . . $ netplayer#sequence. == NETSEQ_REQUEST_OBJECTScxx . . $ `Descent3/multi_external.h:157:9`!) { |
| 2661 | MultiSendJoinObjectscxx . . $ MultiSendJoinObjects(d4f767463ce0a6b3).(i); |
| 2662 | NetPlayerscxx . . $ NetPlayers.[i].sequencecxx . . $ netplayer#sequence. = NETSEQ_OBJECTScxx . . $ `Descent3/multi_external.h:158:9`!; |
| 2663 | MultiSendDoneObjectscxx . . $ MultiSendDoneObjects(d4f767463ce0a6b3).(i); |
| 2664 | } |
| 2665 | if (NetPlayerscxx . . $ NetPlayers.[i].sequencecxx . . $ netplayer#sequence. == NETSEQ_REQUEST_WORLDcxx . . $ `Descent3/multi_external.h:159:9`!) { |
| 2666 | MultiSendWorldStatescxx . . $ MultiSendWorldStates(d4f767463ce0a6b3).(i); |
| 2667 | NetPlayerscxx . . $ NetPlayers.[i].sequencecxx . . $ netplayer#sequence. = NETSEQ_WORLDcxx . . $ `Descent3/multi_external.h:160:9`!; |
| 2668 | MultiSendDoneWorldStatescxx . . $ MultiSendDoneWorldStates(d4f767463ce0a6b3).(i); |
| 2669 | } else if (NetPlayerscxx . . $ NetPlayers.[i].sequencecxx . . $ netplayer#sequence. == NETSEQ_PLAYINGcxx . . $ `Descent3/multi_external.h:161:9`!) { |
| 2670 | Player_countcxx . . $ Player_count.++; |
| 2671 | |
| 2672 | if ((!(Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. & NF_PEER_PEERcxx . . $ `Descent3/multi_external.h:230:9`!)) && |
| 2673 | ((timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!() - NetPlayerscxx . . $ NetPlayers.[i].last_ping_timecxx . . $ netplayer#last_ping_time.) > MULTI_PING_INTERVALcxx . . $ `Descent3/multi.h:520:9`!)) { |
| 2674 | MultiSendPingcxx . . $ MultiSendPing(d4f767463ce0a6b3).(i); |
| 2675 | } |
| 2676 | // If we actually want to send custom data out.. |
| 2677 | if (Use_file_xfercxx . . $ Use_file_xfer.) { |
| 2678 | // Check to see if we need to request any files from this bozo |
| 2679 | if ((NetPlayerscxx . . $ NetPlayers.[i].custom_file_seqcxx . . $ netplayer#custom_file_seq. != NETFILE_ID_NOFILEcxx . . $ `Descent3/multi.h:688:9`!) && |
| 2680 | (NetPlayerscxx . . $ NetPlayers.[i].custom_file_seqcxx . . $ netplayer#custom_file_seq. != NETFILE_ID_DONEcxx . . $ `Descent3/multi.h:694:9`!)) { |
| 2681 | // See if we are already sending or receiving a file from this player |
| 2682 | if (NetPlayerscxx . . $ NetPlayers.[i].file_xfer_flagscxx . . $ netplayer#file_xfer_flags. == NETFILE_NONEcxx . . $ `Descent3/multi.h:683:9`!) { |
| 2683 | // Check to see if we have this file in our cache |
| 2684 | // Time to ask for the file specified in the sequence |
| 2685 | MultiAskForFilecxx . . $ MultiAskForFile(1dc4f76fb2e63523).(NetPlayerscxx . . $ NetPlayers.[i].custom_file_seqcxx . . $ netplayer#custom_file_seq., i, i); |
| 2686 | } |
| 2687 | } |
| 2688 | } |
| 2689 | |
| 2690 | // Send the client how much data we have sent him so far. |
| 2691 | if ((timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!() - last_sent_bytescxx . . $ last_sent_bytes.[i]) > 5) { |
| 2692 | MultiSendBytesSentcxx . . $ MultiSendBytesSent(d4f767463ce0a6b3).(i); |
| 2693 | last_sent_bytescxx . . $ last_sent_bytes.[i] = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!(); |
| 2694 | } |
| 2695 | |
| 2696 | if ((timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!() - Multi_last_send_visiblecxx . . $ Multi_last_send_visible.[i]) > .5) { |
| 2697 | Multi_last_send_visiblecxx . . $ Multi_last_send_visible.[i] = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!(); |
| 2698 | MultiSendVisiblePlayerscxx . . $ MultiSendVisiblePlayers(d4f767463ce0a6b3).(i); |
| 2699 | } |
| 2700 | |
| 2701 | // Figure out which robots moved this frame |
| 2702 | MultiUpdateRobotMovedListcxx . . $ MultiUpdateRobotMovedList(d4f767463ce0a6b3).(i); |
| 2703 | |
| 2704 | Multi_last_sent_timecxx . . $ Multi_last_sent_time.[i][Player_numcxx . . $ Player_num.] += Frametimecxx . . $ Frametime.; |
| 2705 | float last_client_update = Multi_last_sent_timecxx . . $ Multi_last_sent_time.[i][Player_numcxx . . $ Player_num.]; |
| 2706 | |
| 2707 | // Send out all players movement |
| 2708 | MultiSendPositionalUpdatescxx . . $ MultiSendPositionalUpdates(d4f767463ce0a6b3).(i); |
| 2709 | |
| 2710 | // Send other info if the timer has popped |
| 2711 | if (last_client_update > (1.0 / (float)NetPlayerscxx . . $ NetPlayers.[i].ppscxx . . $ netplayer#pps.)) { |
| 2712 | // Send out robot updates if needed |
| 2713 | MultiDoServerRobotFramecxx . . $ MultiDoServerRobotFrame(d4f767463ce0a6b3).(i); |
| 2714 | |
| 2715 | // Check to see if there is additional damage or shields to be added to this guy |
| 2716 | if (Multi_additional_damagecxx . . $ Multi_additional_damage.[i] != 0) { |
| 2717 | if (!(Playerscxx . . $ Players.[i].flagscxx . . $ player#flags. & (PLAYER_FLAGS_DYINGcxx . . $ `Descent3/player_external.h:80:9`! | PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`!))) |
| 2718 | MultiSendAdditionalDamagecxx . . $ MultiSendAdditionalDamage(c2f439e40e2f19ed).(i, Multi_additional_damage_typecxx . . $ Multi_additional_damage_type.[i], Multi_additional_damagecxx . . $ Multi_additional_damage.[i]); |
| 2719 | Multi_additional_damagecxx . . $ Multi_additional_damage.[i] = 0; |
| 2720 | Multi_additional_damage_typecxx . . $ Multi_additional_damage_type.[i] = PD_NONEcxx . . $ `Descent3/damage_external.h:23:9`!; |
| 2721 | } |
| 2722 | |
| 2723 | Multi_last_sent_timecxx . . $ Multi_last_sent_time.[i][Player_numcxx . . $ Player_num.] = 0; |
| 2724 | } |
| 2725 | } |
| 2726 | } |
| 2727 | } |
| 2728 | |
| 2729 | for (i = 0; i < MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!; i++) |
| 2730 | Player_fire_packetcxx . . $ Player_fire_packet.[i].fired_on_this_framecxx . . $ player_fire_packet#fired_on_this_frame. = PFP_NO_FIREDcxx . . $ `Descent3/multi.h:659:9`!; |
| 2731 | |
| 2732 | mprintf_atcxx . . $ `ddebug/mono.h:83:9`!(2, 5, 0, "Occ=%d ", Multi_occluded); |
| 2733 | |
| 2734 | // If this is a dedicated server then we should get possible input |
| 2735 | if (Dedicated_servercxx . . $ Dedicated_server.) |
| 2736 | DoDedicatedServerFramecxx . . $ DoDedicatedServerFrame(49f6e7a06ebc5aa8).(); |
| 2737 | } |
| 2738 | |
| 2739 | // Tells clients to execute dlls on their machines |
| 2740 | void MultiSendClientExecuteDLLcxx . . $ MultiSendClientExecuteDLL(cff815c6df1ba97c).(int eventnum, int me_objnum, int it_objnum, int to, dllinfocxx . . $ dllinfo# *info) { |
| 2741 | uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 2742 | int count = 0; |
| 2743 | int size_offset; |
| 2744 | |
| 2745 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(to >= -1 && to < MAX_PLAYERScxx . . $ `Descent3/player_external_struct.h:86:9`!); |
| 2746 | |
| 2747 | if (to == Player_numcxx . . $ Player_num.) |
| 2748 | return; |
| 2749 | // mprintf(0,"Sending MP_EXECUTE_DLL packet to slot %d! type=%d |
| 2750 | // id=%d\n",to,Objects[me_objnum].type,Objects[me_objnum].id); |
| 2751 | |
| 2752 | size_offset = START_DATAcxx . . $ START_DATA(8c36ee1faa9e0a0b).(MP_EXECUTE_DLLcxx . . $ `Descent3/multi.h:557:9`!, data, &count, 1); |
| 2753 | |
| 2754 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(eventnum, data, &count); |
| 2755 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(me_objnum, data, &count); |
| 2756 | MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(it_objnum, data, &count); |
| 2757 | |
| 2758 | if (info) { |
| 2759 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(1, data, &count); |
| 2760 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(info->fParamcxx . . $ dllinfo#fParam., data, &count); |
| 2761 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(info->iParamcxx . . $ dllinfo#iParam., data, &count); |
| 2762 | |
| 2763 | switch (eventnum) { |
| 2764 | case EVT_CLIENT_GAMEWALLCOLLIDEcxx . . $ `lib/d3events.h:121:9`!: |
| 2765 | case EVT_GAMEWALLCOLLIDEcxx . . $ `lib/d3events.h:78:9`!: |
| 2766 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(info->collide_infocxx . . $ dllinfo#collide_info..pointcxx . . $ game_collide_info#point..xcxx . . $ vector#x., data, &count); |
| 2767 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(info->collide_infocxx . . $ dllinfo#collide_info..pointcxx . . $ game_collide_info#point..ycxx . . $ vector#y., data, &count); |
| 2768 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(info->collide_infocxx . . $ dllinfo#collide_info..pointcxx . . $ game_collide_info#point..zcxx . . $ vector#z., data, &count); |
| 2769 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(info->collide_infocxx . . $ dllinfo#collide_info..normalcxx . . $ game_collide_info#normal..xcxx . . $ vector#x., data, &count); |
| 2770 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(info->collide_infocxx . . $ dllinfo#collide_info..normalcxx . . $ game_collide_info#normal..ycxx . . $ vector#y., data, &count); |
| 2771 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(info->collide_infocxx . . $ dllinfo#collide_info..normalcxx . . $ game_collide_info#normal..zcxx . . $ vector#z., data, &count); |
| 2772 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(info->collide_infocxx . . $ dllinfo#collide_info..hitspeedcxx . . $ game_collide_info#hitspeed., data, &count); |
| 2773 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(info->collide_infocxx . . $ dllinfo#collide_info..hit_dotcxx . . $ game_collide_info#hit_dot., data, &count); |
| 2774 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(info->collide_infocxx . . $ dllinfo#collide_info..hitsegcxx . . $ game_collide_info#hitseg., data, &count); |
| 2775 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(info->collide_infocxx . . $ dllinfo#collide_info..hitwallcxx . . $ game_collide_info#hitwall., data, &count); |
| 2776 | break; |
| 2777 | case EVT_CLIENT_GAMECOLLIDEcxx . . $ `lib/d3events.h:95:9`!: |
| 2778 | case EVT_GAMECOLLIDEcxx . . $ `lib/d3events.h:67:9`!: |
| 2779 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(info->collide_infocxx . . $ dllinfo#collide_info..pointcxx . . $ game_collide_info#point..xcxx . . $ vector#x., data, &count); |
| 2780 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(info->collide_infocxx . . $ dllinfo#collide_info..pointcxx . . $ game_collide_info#point..ycxx . . $ vector#y., data, &count); |
| 2781 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(info->collide_infocxx . . $ dllinfo#collide_info..pointcxx . . $ game_collide_info#point..zcxx . . $ vector#z., data, &count); |
| 2782 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(info->collide_infocxx . . $ dllinfo#collide_info..normalcxx . . $ game_collide_info#normal..xcxx . . $ vector#x., data, &count); |
| 2783 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(info->collide_infocxx . . $ dllinfo#collide_info..normalcxx . . $ game_collide_info#normal..ycxx . . $ vector#y., data, &count); |
| 2784 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(info->collide_infocxx . . $ dllinfo#collide_info..normalcxx . . $ game_collide_info#normal..zcxx . . $ vector#z., data, &count); |
| 2785 | break; |
| 2786 | case EVT_GAMEOBJCHANGESEGcxx . . $ `lib/d3events.h:79:9`!: |
| 2787 | case EVT_CLIENT_GAMEOBJCHANGESEGcxx . . $ `lib/d3events.h:122:9`!: |
| 2788 | case EVT_GAMEPLAYERCHANGESEGcxx . . $ `lib/d3events.h:68:9`!: |
| 2789 | case EVT_CLIENT_GAMEPLAYERCHANGESEGcxx . . $ `lib/d3events.h:97:9`!: |
| 2790 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(info->newsegcxx . . $ dllinfo#newseg., data, &count); |
| 2791 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(info->oldsegcxx . . $ dllinfo#oldseg., data, &count); |
| 2792 | break; |
| 2793 | } |
| 2794 | } else { |
| 2795 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(0, data, &count); |
| 2796 | } |
| 2797 | |
| 2798 | END_DATAcxx . . $ END_DATA(dde21517a502ab05).(count, data, size_offset); |
| 2799 | |
| 2800 | // Send it out |
| 2801 | if (to == -1) |
| 2802 | MultiSendReliablyToAllExceptcxx . . $ MultiSendReliablyToAllExcept(ff9a57d40a1b8fe8).(Player_numcxx . . $ Player_num., data, count, NETSEQ_OBJECTScxx . . $ `Descent3/multi_external.h:158:9`!, false); |
| 2803 | else |
| 2804 | nw_SendReliablecxx . . $ nw_SendReliable(f6b56715d3e5e15a).(NetPlayerscxx . . $ NetPlayers.[to].reliable_socketcxx . . $ netplayer#reliable_socket., data, count); |
| 2805 | } |
| 2806 | |
| 2807 | // Resets the settings that a server uses |
| 2808 | void MultiResetSettingscxx . . $ MultiResetSettings(49f6e7a06ebc5aa8).() { |
| 2809 | strcpy(Netgamecxx . . $ Netgame..scriptnamecxx . . $ netgame_info#scriptname., "Anarchy.d3m"); |
| 2810 | strcpy(Netgamecxx . . $ Netgame..connection_namecxx . . $ netgame_info#connection_name., "Direct TCP~IP"); |
| 2811 | strcpy(Netgamecxx . . $ Netgame..missioncxx . . $ netgame_info#mission., "fury.mn3"); |
| 2812 | strcpy(Netgamecxx . . $ Netgame..namecxx . . $ netgame_info#name., "Generic D3 Game"); |
| 2813 | |
| 2814 | Netgamecxx . . $ Netgame..packets_per_secondcxx . . $ netgame_info#packets_per_second. = 10; |
| 2815 | Netgamecxx . . $ Netgame..respawn_timecxx . . $ netgame_info#respawn_time. = 60; |
| 2816 | Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. = NF_RANDOMIZE_RESPAWNcxx . . $ `Descent3/multi_external.h:241:9`!; |
| 2817 | Netgamecxx . . $ Netgame..max_playerscxx . . $ netgame_info#max_players. = 8; |
| 2818 | Netgamecxx . . $ Netgame..difficultycxx . . $ netgame_info#difficulty. = 2; |
| 2819 | |
| 2820 | // Clear MOTD |
| 2821 | Multi_message_of_the_daycxx . . $ Multi_message_of_the_day.[0] = 0; |
| 2822 | } |
| 2823 | |
| 2824 | #define LEVEL_SPANcxx . . $ `Descent3/multi_server.cpp:2824:9`! 10.0f |
| 2825 | |
| 2826 | #define KILL_BASEcxx . . $ `Descent3/multi_server.cpp:2826:9`! 0.52f |
| 2827 | #define DEATH_BASEcxx . . $ `Descent3/multi_server.cpp:2827:9`! 0.50f |
| 2828 | |
| 2829 | #define KILL_SCALARcxx . . $ `Descent3/multi_server.cpp:2829:9`! (KILL_BASEcxx . . $ `Descent3/multi_server.cpp:2826:9`! / LEVEL_SPANcxx . . $ `Descent3/multi_server.cpp:2824:9`!) |
| 2830 | #define DEATH_SCALARcxx . . $ `Descent3/multi_server.cpp:2830:9`! (DEATH_BASEcxx . . $ `Descent3/multi_server.cpp:2827:9`! / LEVEL_SPANcxx . . $ `Descent3/multi_server.cpp:2824:9`!) |
| 2831 | |
| 2832 | int GetRankLevelcxx . . $ GetRankLevel(7864480464b09eea).(int rank) { |
| 2833 | if (rank < 600) |
| 2834 | return 1; |
| 2835 | if (rank < 900) |
| 2836 | return 2; |
| 2837 | if (rank < 1200) |
| 2838 | return 3; |
| 2839 | if (rank < 1500) |
| 2840 | return 4; |
| 2841 | if (rank < 1800) |
| 2842 | return 5; |
| 2843 | if (rank < 2100) |
| 2844 | return 6; |
| 2845 | if (rank < 2400) |
| 2846 | return 7; |
| 2847 | if (rank < 2600) |
| 2848 | return 8; |
| 2849 | if (rank < 3000) |
| 2850 | return 9; |
| 2851 | return 10; |
| 2852 | } |
| 2853 | |
| 2854 | // Given two objects, calculates rank for them after a kill |
| 2855 | float CalculateNewRankingcxx . . $ CalculateNewRanking(1c3643c22442ce3c).(objectcxx . . $ object# *obj_a, objectcxx . . $ object# *obj_b, int won) { |
| 2856 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(obj_a->type == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && obj_b->type == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!); |
| 2857 | |
| 2858 | float rank_a = Playerscxx . . $ Players.[obj_a->idcxx . . $ object#id.].rankcxx . . $ player#rank.; |
| 2859 | float rank_b = Playerscxx . . $ Players.[obj_b->idcxx . . $ object#id.].rankcxx . . $ player#rank.; |
| 2860 | |
| 2861 | int level_a = GetRankLevelcxx . . $ GetRankLevel(7864480464b09eea).((int)rank_a); |
| 2862 | int level_b = GetRankLevelcxx . . $ GetRankLevel(7864480464b09eea).((int)rank_b); |
| 2863 | |
| 2864 | if ((obj_a == obj_b) && won) |
| 2865 | return rank_a; |
| 2866 | |
| 2867 | if (won) { |
| 2868 | rank_a += (KILL_SCALARcxx . . $ `Descent3/multi_server.cpp:2829:9`! * float(level_b - level_a) + KILL_BASEcxx . . $ `Descent3/multi_server.cpp:2826:9`!); |
| 2869 | } else { |
| 2870 | rank_a -= (DEATH_SCALARcxx . . $ `Descent3/multi_server.cpp:2830:9`! * float(level_a - level_b) + DEATH_BASEcxx . . $ `Descent3/multi_server.cpp:2827:9`!); |
| 2871 | } |
| 2872 | float new_rank = rank_a; |
| 2873 | |
| 2874 | if (new_rank < 0) |
| 2875 | new_rank = 0; |
| 2876 | |
| 2877 | return new_rank; |
| 2878 | } |
| 2879 | |
| 2880 | /* |
| 2881 | // Given two objects, calculates rank for them after a kill |
| 2882 | float CalculateNewRanking (object *obj_a,object *obj_b,int won) |
| 2883 | { |
| 2884 | ASSERT (obj_a->type==OBJ_PLAYER && obj_b->type==OBJ_PLAYER); |
| 2885 | |
| 2886 | float rank_a=Players[obj_a->id].rank; |
| 2887 | float rank_b=Players[obj_b->id].rank; |
| 2888 | |
| 2889 | float k_factor; |
| 2890 | float g_factor=400; |
| 2891 | float scalar; |
| 2892 | int num_players=Player_count; |
| 2893 | |
| 2894 | if (num_players>8) |
| 2895 | num_players=8; |
| 2896 | if (num_players<2) |
| 2897 | num_players=2; |
| 2898 | |
| 2899 | scalar=1.0-(((num_players-2)/6.0)*.5); |
| 2900 | g_factor=400*(1.0+(((num_players-2)/6.0)*.4)); |
| 2901 | |
| 2902 | k_factor=16; |
| 2903 | k_factor*=scalar; |
| 2904 | |
| 2905 | float delta_r=rank_b-rank_a; |
| 2906 | float expected_wins = 1.0/((pow(10.0,delta_r / g_factor) + 1)); |
| 2907 | float new_rank = (k_factor * (won - (expected_wins))); |
| 2908 | |
| 2909 | if (won && new_rank<.005f) |
| 2910 | new_rank=.005f; |
| 2911 | |
| 2912 | |
| 2913 | // This prevents players of vastly different rank from hurting each the better rank |
| 2914 | if ((rank_a-rank_b)>400 && !won) |
| 2915 | new_rank=0; |
| 2916 | |
| 2917 | new_rank=Players[obj_a->id].rank+new_rank; |
| 2918 | |
| 2919 | if (new_rank<0) |
| 2920 | new_rank=0; |
| 2921 | |
| 2922 | mprintf(0,"Player %s rating is now %f\n",Players[obj_a->id].callsign,new_rank); |
| 2923 | |
| 2924 | return new_rank; |
| 2925 | } |
| 2926 | */ |
| 2927 | |
| 2928 | // Returns a ranking index based on the player rating |
| 2929 | // If rankbuf is non-null, fills in the string corresponding to that rank |
| 2930 | // Returns -1 if not a pxo game (ie no rankings in this game) |
| 2931 | int GetRankIndexcxx . . $ GetRankIndex(3c8082c546dd2ea0).(int pnum, char *rankbuf) { |
| 2932 | if (!Game_is_master_tracker_gamecxx . . $ Game_is_master_tracker_game.) |
| 2933 | return -1; |
| 2934 | |
| 2935 | float ranking = Playerscxx . . $ Players.[pnum].rankcxx . . $ player#rank.; |
| 2936 | int val = 0; |
| 2937 | |
| 2938 | if (ranking >= 0 && ranking < 600) |
| 2939 | val = 0; |
| 2940 | else if (ranking >= 600 && ranking < 900) |
| 2941 | val = 1; |
| 2942 | else if (ranking >= 900 && ranking < 1200) |
| 2943 | val = 2; |
| 2944 | else if (ranking >= 1200 && ranking < 1500) |
| 2945 | val = 3; |
| 2946 | else if (ranking >= 1500 && ranking < 1800) |
| 2947 | val = 4; |
| 2948 | else if (ranking >= 1800 && ranking < 2100) |
| 2949 | val = 5; |
| 2950 | else if (ranking >= 2100 && ranking < 2400) |
| 2951 | val = 6; |
| 2952 | else if (ranking >= 2400 && ranking < 2600) |
| 2953 | val = 7; |
| 2954 | else if (ranking >= 2600 && ranking < 3000) |
| 2955 | val = 8; |
| 2956 | else if (ranking >= 3000) |
| 2957 | val = 9; |
| 2958 | |
| 2959 | if (rankbuf) |
| 2960 | sprintf(rankbuf, "%s", TXTcxx . . $ `Descent3/stringtable.h:24:9`!(TXT_MULTI_RANKScxx . . $ `Descent3/stringtable.h:731:9`! + val)); |
| 2961 | |
| 2962 | return val; |
| 2963 | } |
| 2964 | |
| 2965 | // Tells the clients to change rank for a player |
| 2966 | void MultiSendChangeRankcxx . . $ MultiSendChangeRank(e245be2ee4c3bdaf).(int pnum, char *str, uint8_tcxx . . $ uint8_t# goodnews) { |
| 2967 | int size; |
| 2968 | uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 2969 | int count = 0; |
| 2970 | |
| 2971 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Sending change rank!\n"); |
| 2972 | |
| 2973 | size = START_DATAcxx . . $ START_DATA(8c36ee1faa9e0a0b).(MP_CHANGE_RANKcxx . . $ `Descent3/multi.h:642:9`!, data, &count); |
| 2974 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(pnum, data, &count); |
| 2975 | MultiAddStringcxx . . $ MultiAddString(ac7a41cf4c80e28).(str, data, &count); |
| 2976 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(goodnews, data, &count); |
| 2977 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(Playerscxx . . $ Players.[pnum].rankcxx . . $ player#rank., data, &count); |
| 2978 | END_DATAcxx . . $ END_DATA(dde21517a502ab05).(count, data, size); |
| 2979 | |
| 2980 | MultiSendReliablyToAllExceptcxx . . $ MultiSendReliablyToAllExcept(ff9a57d40a1b8fe8).(Player_numcxx . . $ Player_num., data, count, NETSEQ_PLAYINGcxx . . $ `Descent3/multi_external.h:161:9`!, false); |
| 2981 | MultiDoChangeRankcxx . . $ MultiDoChangeRank(f25546b61a629de7).(data); |
| 2982 | } |
| 2983 | |
| 2984 | // Does PXO stuff and sends out messages demoting/promoting the player |
| 2985 | void ChangeRankIndexcxx . . $ ChangeRankIndex(3e454b8ccf442868).(int old_index, int pnum) { |
| 2986 | char str[255]; |
| 2987 | int new_index = GetRankIndexcxx . . $ GetRankIndex(3c8082c546dd2ea0).(pnum); |
| 2988 | uint8_tcxx . . $ uint8_t# goodnews = 1; |
| 2989 | |
| 2990 | if (old_index < new_index) // promoted |
| 2991 | { |
| 2992 | snprintf(str, sizeof(str), "%s %s %s %s!", Playerscxx . . $ Players.[pnum].callsigncxx . . $ player#callsign., TXT_HAS_BEENcxx . . $ `Descent3/stringtable.h:741:9`!, TXT_PROMOTEDcxx . . $ `Descent3/stringtable.h:742:9`!, |
| 2993 | TXTcxx . . $ `Descent3/stringtable.h:24:9`!(TXT_MULTI_RANKScxx . . $ `Descent3/stringtable.h:731:9`! + new_index)); |
| 2994 | goodnews = 1; |
| 2995 | } else { |
| 2996 | snprintf(str, sizeof(str), "%s %s %s %s!", Playerscxx . . $ Players.[pnum].callsigncxx . . $ player#callsign., TXT_HAS_BEENcxx . . $ `Descent3/stringtable.h:741:9`!, TXT_DEMOTEDcxx . . $ `Descent3/stringtable.h:743:9`!, |
| 2997 | TXTcxx . . $ `Descent3/stringtable.h:24:9`!(TXT_MULTI_RANKScxx . . $ `Descent3/stringtable.h:731:9`! + new_index)); |
| 2998 | goodnews = 0; |
| 2999 | } |
| 3000 | |
| 3001 | MultiSendChangeRankcxx . . $ MultiSendChangeRank(e245be2ee4c3bdaf).(pnum, str, goodnews); |
| 3002 | } |
| 3003 | |
| 3004 | // Given a killer and killed player, calculates their new rankings |
| 3005 | void GetNewRankingscxx . . $ GetNewRankings(6273fa812ac58a8).(objectcxx . . $ object# *killed, objectcxx . . $ object# *killer) { |
| 3006 | float killed_rank; |
| 3007 | float killer_rank; |
| 3008 | |
| 3009 | // #ifdef OEM |
| 3010 | // return; |
| 3011 | // #endif |
| 3012 | |
| 3013 | #ifdef DEMO |
| 3014 | return; |
| 3015 | #endif |
| 3016 | |
| 3017 | if (!killer || !killed) |
| 3018 | return; |
| 3019 | |
| 3020 | if (!(Netgamecxx . . $ Netgame..flagscxx . . $ netgame_info#flags. & NF_TRACK_RANKcxx . . $ `Descent3/multi_external.h:243:9`!)) |
| 3021 | return; |
| 3022 | |
| 3023 | if (killed->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! || killer->typecxx . . $ object#type. != OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) |
| 3024 | return; |
| 3025 | |
| 3026 | int old_killed_index = GetRankIndexcxx . . $ GetRankIndex(3c8082c546dd2ea0).(killed->idcxx . . $ object#id.); |
| 3027 | int old_killer_index = GetRankIndexcxx . . $ GetRankIndex(3c8082c546dd2ea0).(killer->idcxx . . $ object#id.); |
| 3028 | |
| 3029 | if (killed == killer) // Suicide, always subract .5 points |
| 3030 | { |
| 3031 | Playerscxx . . $ Players.[killer->idcxx . . $ object#id.].rankcxx . . $ player#rank. -= .5; |
| 3032 | if (Playerscxx . . $ Players.[killer->idcxx . . $ object#id.].rankcxx . . $ player#rank. < 0) { |
| 3033 | Playerscxx . . $ Players.[killer->idcxx . . $ object#id.].rankcxx . . $ player#rank. = 0; |
| 3034 | } |
| 3035 | |
| 3036 | if (GetRankIndexcxx . . $ GetRankIndex(3c8082c546dd2ea0).(killer->idcxx . . $ object#id.) != old_killer_index) |
| 3037 | ChangeRankIndexcxx . . $ ChangeRankIndex(3e454b8ccf442868).(old_killer_index, killer->idcxx . . $ object#id.); |
| 3038 | } else { |
| 3039 | killed_rank = CalculateNewRankingcxx . . $ CalculateNewRanking(1c3643c22442ce3c).(killed, killer, 0); |
| 3040 | killer_rank = CalculateNewRankingcxx . . $ CalculateNewRanking(1c3643c22442ce3c).(killer, killed, 1); |
| 3041 | |
| 3042 | Playerscxx . . $ Players.[killer->idcxx . . $ object#id.].rankcxx . . $ player#rank. = killer_rank; |
| 3043 | Playerscxx . . $ Players.[killed->idcxx . . $ object#id.].rankcxx . . $ player#rank. = killed_rank; |
| 3044 | |
| 3045 | if (GetRankIndexcxx . . $ GetRankIndex(3c8082c546dd2ea0).(killer->idcxx . . $ object#id.) != old_killer_index) |
| 3046 | ChangeRankIndexcxx . . $ ChangeRankIndex(3e454b8ccf442868).(old_killer_index, killer->idcxx . . $ object#id.); |
| 3047 | |
| 3048 | if (GetRankIndexcxx . . $ GetRankIndex(3c8082c546dd2ea0).(killed->idcxx . . $ object#id.) != old_killed_index) |
| 3049 | ChangeRankIndexcxx . . $ ChangeRankIndex(3e454b8ccf442868).(old_killed_index, killed->idcxx . . $ object#id.); |
| 3050 | } |
| 3051 | } |