| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/dmfc/dmfcclient.cpp $ |
| 21 | * $Revision: 1.1.1.1 $ |
| 22 | * $Date: 2003/08/26 03:57:20 $ |
| 23 | * $Author: kevinb $ |
| 24 | * |
| 25 | * Client Event handlers |
| 26 | * |
| 27 | * $Log: dmfcclient.cpp,v $ |
| 28 | * Revision 1.1.1.1 2003/08/26 03:57:20 kevinb |
| 29 | * initial 1.5 import |
| 30 | * |
| 31 | * |
| 32 | * 92 9/05/01 6:04p Matt |
| 33 | * Added code to save the user's preferred HUD name level setting even if |
| 34 | * the server bashes it down. |
| 35 | * |
| 36 | * 91 7/15/99 3:33p Jeff |
| 37 | * play a sound when a player disconnects/leaves the game |
| 38 | * |
| 39 | * 90 7/13/99 12:11p Jeff |
| 40 | * added some specific text taunt token decoding |
| 41 | * |
| 42 | * 89 7/13/99 10:05a Jeff |
| 43 | * text taunt token decoding |
| 44 | * |
| 45 | * 88 7/09/99 7:02p Jeff |
| 46 | * put in countdown timer for when a level is about to end |
| 47 | * |
| 48 | * 87 7/09/99 6:17p Jeff |
| 49 | * added $remoteadminlogout and $wait commands |
| 50 | * |
| 51 | * 86 7/09/99 2:53p Jeff |
| 52 | * handle gametime better (pause it when needed) if the server is 'waiting |
| 53 | * for players' |
| 54 | * |
| 55 | * 85 7/08/99 9:56p Jeff |
| 56 | * added event handler for weapon fired event |
| 57 | * |
| 58 | * 84 7/08/99 2:39a Jeff |
| 59 | * rough implementation of remote administration checked in. Still needs |
| 60 | * some polishing, but should work basically. |
| 61 | * |
| 62 | * 83 7/07/99 6:10p Jeff |
| 63 | * don't count the time that a player is in observer mode for death/kill |
| 64 | * messages |
| 65 | * |
| 66 | * 82 6/22/99 5:41p Jeff |
| 67 | * removed int3 (causing probs in Linux) |
| 68 | * |
| 69 | * 81 6/11/99 5:36p Jeff |
| 70 | * removed ai_info #ifdefs (better way of doing it) |
| 71 | * |
| 72 | * 80 6/10/99 12:41p Jeff |
| 73 | * no ai_info in non-Outrage builds |
| 74 | * |
| 75 | * 79 5/24/99 11:05p Jeff |
| 76 | * fixed bug for dedicated server team getting reset on endlevel |
| 77 | * |
| 78 | * 78 5/11/99 9:42p Jeff |
| 79 | * fixed bug changing teams while dead |
| 80 | * |
| 81 | * 77 5/10/99 2:43a Jeff |
| 82 | * handle new scheme of player's joining in a team game, where the team is |
| 83 | * set before player enters game in the main code, but the team is |
| 84 | * determined via event call to dmfc |
| 85 | * |
| 86 | * 76 5/08/99 4:45a Jeff |
| 87 | * fixed printscreen position |
| 88 | * |
| 89 | * 75 5/08/99 4:30a Jeff |
| 90 | * fixed sequencing bug where clients never got a level end event for the |
| 91 | * multiplayer games |
| 92 | * |
| 93 | * 74 5/07/99 5:16p Jeff |
| 94 | * fixed player disconnect at level end |
| 95 | * |
| 96 | * 73 5/07/99 2:21p Jeff |
| 97 | * fixed (?) not disconnecting clients on level end |
| 98 | * |
| 99 | * 72 5/04/99 8:46p Jeff |
| 100 | * display icon when someone plays an audio taunt |
| 101 | * |
| 102 | * 71 4/03/99 4:06p Jeff |
| 103 | * added loss/ping gauge |
| 104 | * |
| 105 | * 70 3/30/99 7:42p Jeff |
| 106 | * fixed a misspelling on a function name |
| 107 | * |
| 108 | * 69 3/22/99 6:20p Jeff |
| 109 | * added 2 more audio taunts. a mulitplayer event when someone plays an |
| 110 | * audio taunt. option to disable audio taunts. |
| 111 | * |
| 112 | * 68 3/22/99 1:55p Jeff |
| 113 | * make sure initialization happens (possible crashing) |
| 114 | * |
| 115 | * 67 3/17/99 12:23p Jeff |
| 116 | * converted DMFC to be COM interface |
| 117 | * |
| 118 | * 66 2/11/99 12:50a Jeff |
| 119 | * changed names of exported variables |
| 120 | * |
| 121 | * 65 2/09/99 3:32p Jeff |
| 122 | * table file parser takes quotes strings for force keywords |
| 123 | * |
| 124 | * 64 2/07/99 1:19a Jeff |
| 125 | * added new multiplayer game events EVT_GAMEOBJKILLED and |
| 126 | * EVT_GAMEOBJDESTROYED |
| 127 | * |
| 128 | * 63 2/05/99 8:24p Jeff |
| 129 | * added table file parser macros |
| 130 | * |
| 131 | * 62 2/04/99 7:17p Jeff |
| 132 | * put in sounds for hud messages |
| 133 | * |
| 134 | * 61 2/02/99 8:43a Chris |
| 135 | * I made buildings with AI work correctly (ie really big robots should be |
| 136 | * buildings) |
| 137 | * anim to and from states are now shorts instead of bytes |
| 138 | * |
| 139 | * 60 2/01/99 10:52p Jeff |
| 140 | * added sounds for kills (teammate and regular) |
| 141 | * |
| 142 | * 59 1/31/99 7:26p Matt |
| 143 | * Renamed a bunch of functions to have HUD capitalized |
| 144 | * |
| 145 | * 58 1/19/99 3:55a Jeff |
| 146 | * all strings localized out |
| 147 | * |
| 148 | * 56 1/15/99 3:54a Jeff |
| 149 | * exported a couple more functions. Added event handlers for Weapon |
| 150 | * collide event |
| 151 | * |
| 152 | * 55 1/12/99 2:55p Jeff |
| 153 | * added/finished the waiting for player's to join dialog |
| 154 | * |
| 155 | * 54 1/10/99 7:41p Jeff |
| 156 | * added initial version of waitforplayers dialog |
| 157 | * |
| 158 | * 53 1/07/99 5:01p Jeff |
| 159 | * added Int3's and updated all net games to use stats manager...correctly |
| 160 | * too |
| 161 | * |
| 162 | * 52 1/06/99 7:02p Jeff |
| 163 | * added a multiplayer event for game controls |
| 164 | * |
| 165 | * 51 12/23/98 6:38p Kevin |
| 166 | * All UDP data (except gamespy) now uses one (registered) port number |
| 167 | * |
| 168 | * 50 12/08/98 4:47p Jeff |
| 169 | * umm, various changes, fixed pilot pics so that they work for everyone |
| 170 | * now |
| 171 | * |
| 172 | * 49 12/08/98 3:29p Jeff |
| 173 | * updated the team control dialog so the server can determine if they |
| 174 | * want to make the clients wait |
| 175 | * |
| 176 | * 48 12/08/98 12:17p Jeff |
| 177 | * various changes that include an improved Team Control dialog (doesn't |
| 178 | * switch teams until exit..) and spew/respawn players that change teams |
| 179 | * |
| 180 | * 47 12/03/98 7:05p Jeff |
| 181 | * updated new stats |
| 182 | * |
| 183 | * 46 12/01/98 6:56p Jeff |
| 184 | * put in quick and dirty implementation of pilot pics for testing |
| 185 | * |
| 186 | * 45 11/19/98 5:56p Jeff |
| 187 | * added slider exported and improved Hoard |
| 188 | * |
| 189 | * 44 11/17/98 6:29p Jeff |
| 190 | * mod can specify whether or not to display the team setup dialog on team |
| 191 | * game start. Added a menu item to display team setup dialog in mid-game |
| 192 | * |
| 193 | * 43 11/16/98 5:35p Jeff |
| 194 | * removed log functions, added support for changing team names, fixed ctf |
| 195 | * to work better with different team names |
| 196 | * |
| 197 | * 42 11/11/98 7:19p Jeff |
| 198 | * changes made so that a dedicated server's team is always -1 (team game |
| 199 | * or not) |
| 200 | * |
| 201 | * 41 11/11/98 12:47p Jeff |
| 202 | * fixed bug where it would give team change messages in a non-team game |
| 203 | * |
| 204 | * 40 11/01/98 1:59a Jeff |
| 205 | * made a $help inputcommand for help in a dedicated server environment |
| 206 | * |
| 207 | * 39 10/30/98 12:47p Jeff |
| 208 | * cut down a couple bytes on memory usage |
| 209 | * |
| 210 | * 38 10/29/98 7:01p Jeff |
| 211 | * creation of team placement dialog. Moved TranslateEvent into DMFC |
| 212 | * |
| 213 | * 37 10/20/98 12:16p Jeff |
| 214 | * added death message filter, hud callsign filter |
| 215 | * |
| 216 | * 36 10/18/98 7:59p Jeff |
| 217 | * functions added to dmfc for client->server objnum matching. Banning |
| 218 | * now uses tracker id when available. |
| 219 | * |
| 220 | * 35 10/15/98 6:18p Jeff |
| 221 | * created the is player banned event, removed prejoin event |
| 222 | * |
| 223 | * 34 10/15/98 1:34p Jeff |
| 224 | * added scrollable onscreen menu. Remove ban in dmfc. prejoin event |
| 225 | * |
| 226 | * 33 10/13/98 2:15a Jeff |
| 227 | * created new event for when a player leaves a multiplayer game. Fixed |
| 228 | * some 'english' bugs in the network games. |
| 229 | * |
| 230 | * 32 10/11/98 2:57a Jeff |
| 231 | * added new multiplayer event EVT_GAME_INTERVAL, which is to be called on |
| 232 | * interval, and EVT_HUD_INTERVAL is only to be called when the hud is to |
| 233 | * be rendered |
| 234 | * |
| 235 | * 31 10/08/98 3:37p Jeff |
| 236 | * general improvements (Netgame info things, save to registry). Changes |
| 237 | * so it would send packets on NETSEQ_OBJECTS |
| 238 | * |
| 239 | * 30 10/05/98 2:49p Jeff |
| 240 | * |
| 241 | * 29 10/01/98 7:02p Jeff |
| 242 | * implemented colored HUD callsigns |
| 243 | * |
| 244 | * 28 10/01/98 11:30a Jeff |
| 245 | * made the observer mode events into just a client event |
| 246 | * |
| 247 | * 27 9/30/98 4:21p Jeff |
| 248 | * team changing is handled correctly |
| 249 | * |
| 250 | * 26 9/30/98 4:07p Jeff |
| 251 | * |
| 252 | * 25 9/30/98 3:50p Jeff |
| 253 | * general improvements (many) |
| 254 | * |
| 255 | * 24 9/28/98 5:05p Jeff |
| 256 | * made the statisitical death messages an option in the menu |
| 257 | * |
| 258 | * 23 9/25/98 7:57p Jeff |
| 259 | * removed CheckPInfo call |
| 260 | * |
| 261 | * 22 9/25/98 7:25p Jeff |
| 262 | * |
| 263 | * 21 9/25/98 4:50p Jeff |
| 264 | * |
| 265 | * 20 9/24/98 6:54p Jeff |
| 266 | * added DisconnectMe() and made use of it when you get kicked/banned |
| 267 | * |
| 268 | * 19 9/24/98 5:52p Jeff |
| 269 | * starting adding statistical death messages, checked in for testing |
| 270 | * |
| 271 | * 18 9/23/98 4:56p Jeff |
| 272 | * set teams always for 1 team game |
| 273 | * |
| 274 | * 17 9/23/98 4:17p Jeff |
| 275 | * basic changes/improvements, started changing death messages |
| 276 | * |
| 277 | * 16 9/21/98 7:11p Jeff |
| 278 | * made InputCommand interface API and moved existing input commands to |
| 279 | * the interface. Changed mprintf/ASSERT so they are valid in DMFC |
| 280 | * |
| 281 | * $NoKeywords: $ |
| 282 | */ |
| 283 | |
| 284 | #include "gamedll_header.h"cxx . . $ `<file>/netgames/includes/gamedll_header.h`/ |
| 285 | #include "DMFC.h"cxx . . $ `<file>/netgames/includes/DMFC.h`/ |
| 286 | #include "dmfcinternal.h"cxx . . $ `<file>/netgames/dmfc/dmfcinternal.h`/ |
| 287 | |
| 288 | #define SND_MYTEAM_TEAMMATE_KILLEDcxx . . $ `netgames/dmfc/dmfcclient.cpp:288:9`! "PlayerDeath" |
| 289 | #define SND_NONTEAM_KILLcxx . . $ `netgames/dmfc/dmfcclient.cpp:289:9`! "PlayerDeath" |
| 290 | |
| 291 | /* |
| 292 | $$TABLE_SOUND "PlayerDeath" |
| 293 | */ |
| 294 | |
| 295 | // ######################### Client allowed event handlers############################ |
| 296 | |
| 297 | // DMFCBase::OnClientPlayerKilled (Only called if server tells client to execute) |
| 298 | // |
| 299 | // Event handler for when a player gets killed, either by another player or some other way. |
| 300 | // killer_obj = object pointer to the object that killed the player |
| 301 | // victim_pnum = player number of the player that got killed |
| 302 | void DMFCBasecxx . . $ DMFCBase#::OnClientPlayerKilledcxx . . $ DMFCBase#OnClientPlayerKilled(766a1b7183ffa4b4).(objectcxx . . $ object# *killer_obj, int victim_pnum) { |
| 303 | uint32_tcxx . . $ uint32_t# hash = 0xFFFFFFFF; |
| 304 | int kpnum; |
| 305 | player_recordcxx . . $ player_record# *kpr, *vpr; |
| 306 | |
| 307 | if (!killer_obj) { |
| 308 | kpnum = -1; |
| 309 | } else { |
| 310 | if ((killer_obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`!) || (killer_obj->typecxx . . $ object#type. == OBJ_GHOSTcxx . . $ `Descent3/object_external.h:172:9`!) || (killer_obj->typecxx . . $ object#type. == OBJ_OBSERVERcxx . . $ `Descent3/object_external.h:182:9`!)) { |
| 311 | kpnum = killer_obj->idcxx . . $ object#id.; |
| 312 | |
| 313 | // now we need to extract out the weapon of the kill |
| 314 | if (Datacxx . . $ DMFCBase#Data.->iParamcxx . . $ dllinfo#iParam. != -1) |
| 315 | hash = (uint32_tcxx . . $ uint32_t#)Datacxx . . $ DMFCBase#Data.->iParamcxx . . $ dllinfo#iParam.; |
| 316 | } else if (killer_obj->typecxx . . $ object#type. == OBJ_ROBOTcxx . . $ `Descent3/object_external.h:162:9`! || (killer_obj->typecxx . . $ object#type. == OBJ_BUILDINGcxx . . $ `Descent3/object_external.h:176:9`! && killer_obj->ai_infocxx . . $ object#ai_info.)) { |
| 317 | // countermeasure kill |
| 318 | kpnum = GetCounterMeasureOwnercxx . . $ DMFCBase#GetCounterMeasureOwner(2da2a862cad4c994).(killer_obj); |
| 319 | } else |
| 320 | kpnum = -1; |
| 321 | } |
| 322 | |
| 323 | if (victim_pnum != -1) { |
| 324 | if (kpnum == victim_pnum) { |
| 325 | // suicide |
| 326 | vpr = PRec_GetPRecordByPnumcxx . . $ PRec_GetPRecordByPnum(6359c6f28dd028ae).(victim_pnum); |
| 327 | if (vpr) { |
| 328 | vpr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]++; |
| 329 | vpr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]++; |
| 330 | } |
| 331 | UpdatePInfocxx . . $ DMFCBase#UpdatePInfo(b1146eedae1e1d0b).(kpnum, kpnum, 1); |
| 332 | } else { |
| 333 | // regular death |
| 334 | vpr = PRec_GetPRecordByPnumcxx . . $ PRec_GetPRecordByPnum(6359c6f28dd028ae).(victim_pnum); |
| 335 | |
| 336 | if (vpr) { |
| 337 | vpr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]++; |
| 338 | vpr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]++; |
| 339 | } |
| 340 | |
| 341 | if (kpnum != -1) { |
| 342 | kpr = PRec_GetPRecordByPnumcxx . . $ PRec_GetPRecordByPnum(6359c6f28dd028ae).(kpnum); |
| 343 | if (kpr) { |
| 344 | kpr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]++; |
| 345 | kpr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]++; |
| 346 | } |
| 347 | UpdatePInfocxx . . $ DMFCBase#UpdatePInfo(b1146eedae1e1d0b).(victim_pnum, kpnum, 1); |
| 348 | } |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | static int teammate_kill_id = -2; |
| 353 | static int nonteam_kill_id = -2; |
| 354 | |
| 355 | if (killer_obj && killer_obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! && victim_pnum != -1) { |
| 356 | |
| 357 | if (Playerscxx . . $ DMFCBase#Players.[killer_obj->idcxx . . $ object#id.].teamcxx . . $ player#team. == Playerscxx . . $ DMFCBase#Players.[victim_pnum].teamcxx . . $ player#team. && (GetNumTeamscxx . . $ DMFCBase#GetNumTeams(b126dc7c1de90089).() >= 2) && |
| 358 | (killer_obj->idcxx . . $ object#id. != victim_pnum)) { |
| 359 | // a teammate killed another teammate! |
| 360 | if (teammate_kill_id == -2) { |
| 361 | teammate_kill_id = DLLFindSoundName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(SND_MYTEAM_TEAMMATE_KILLEDcxx . . $ `netgames/dmfc/dmfcclient.cpp:288:9`!)); |
| 362 | } |
| 363 | if (teammate_kill_id != -1) { |
| 364 | DLLPlay2dSound(teammate_kill_id, MAX_GAME_VOLUMEcxx . . $ `netgames/includes/gamedll_header.h:59:9`! / 2); |
| 365 | } |
| 366 | } else { |
| 367 | // normal kill sound |
| 368 | if (nonteam_kill_id == -2) { |
| 369 | nonteam_kill_id = DLLFindSoundName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(SND_NONTEAM_KILLcxx . . $ `netgames/dmfc/dmfcclient.cpp:289:9`!)); |
| 370 | } |
| 371 | if (nonteam_kill_id != -1) { |
| 372 | DLLPlay2dSound(nonteam_kill_id, MAX_GAME_VOLUMEcxx . . $ `netgames/includes/gamedll_header.h:59:9`! / 2); |
| 373 | } |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | // if DMFC is supposed to handle Deathmessages, than do one |
| 378 | if (m_iProtectedFlagscxx . . $ DMFCBase#m_iProtectedFlags. & DMFC_PRF_AUTODEATHMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2376:9`!) |
| 379 | DoRandomDeathMessagecxx . . $ DMFCBase#DoRandomDeathMessage(f59d17f8b9f2d3e1).(GetItObjNumcxx . . $ DMFCBase#GetItObjNum(b126dc7c1de90089).(), GetMeObjNumcxx . . $ DMFCBase#GetMeObjNum(b126dc7c1de90089).(), hash); |
| 380 | } |
| 381 | |
| 382 | // DMFCBase::OnClientPlayerExploded (Only called if server tells client to execute) |
| 383 | // |
| 384 | // Event handler for when a player explodes. Gets called after a EVT_GAMEPLAYERKILLED event. |
| 385 | // player_num = player number of the player exploding |
| 386 | void DMFCBasecxx . . $ DMFCBase#::OnClientPlayerExplodedcxx . . $ DMFCBase#OnClientPlayerExploded(d4f767463ce0a6b3).(int player_num) {} |
| 387 | |
| 388 | // DMFCBase::OnClientCollide (Only called if server tells client to execute) |
| 389 | // |
| 390 | // Event handler for when two objects collide. At least one of the two objects is a player or a robot. |
| 391 | // Be aware that this event will be called twice per collision, the second time it is called the me and |
| 392 | // it objects will be flipped. |
| 393 | // ALSO NOTE: In order for the OnClientCollide() that passes the point and normal to have valid values |
| 394 | // the server must pass true to the parameter to send arguments in CallClientEvent(). |
| 395 | // me_obj = object pointer to the me object |
| 396 | // it_obj = object pointer to the it object |
| 397 | void DMFCBasecxx . . $ DMFCBase#::OnClientCollidecxx . . $ DMFCBase#OnClientCollide(6273fa812ac58a8).(objectcxx . . $ object# *me_obj, objectcxx . . $ object# *it_obj) {} |
| 398 | void DMFCBasecxx . . $ DMFCBase#::OnClientCollidecxx . . $ DMFCBase#OnClientCollide(584c77d2760d8df8).(objectcxx . . $ object# *me_obj, objectcxx . . $ object# *it_obj, vectorcxx . . $ vector# *point, vectorcxx . . $ vector# *normal) {} |
| 399 | |
| 400 | // DMFCBase::OnClientPlayerChangeSegment (Only called if server tells client to execute) |
| 401 | // |
| 402 | // Event handler for when a player changes rooms or a "large" terrain cell |
| 403 | // (8x8 Terrain block). |
| 404 | // player_num = player number of the player who just changed the room/segment |
| 405 | // newseg = New room/cell location |
| 406 | // oldseg = Old room/cell location |
| 407 | void DMFCBasecxx . . $ DMFCBase#::OnClientPlayerChangeSegmentcxx . . $ DMFCBase#OnClientPlayerChangeSegment(b1146eedae1e1d0b).(int player_num, int newseg, int oldseg) {} |
| 408 | |
| 409 | // DMFCBase::OnClientObjectChangeSegment (Only called if server tells client to execute) |
| 410 | // |
| 411 | // Event handler for when a player changes rooms or a "large" terrain cell |
| 412 | // (8x8 Terrain block). |
| 413 | // obj = Object pointer of the object who just changed the room/segment |
| 414 | // newseg = New room/cell location |
| 415 | // oldseg = Old room/cell location |
| 416 | void DMFCBasecxx . . $ DMFCBase#::OnClientObjectChangeSegmentcxx . . $ DMFCBase#OnClientObjectChangeSegment(a7790401ac9fc765).(objectcxx . . $ object# *obj, int newseg, int oldseg) {} |
| 417 | |
| 418 | // DMFCBase::OnClientPlayerEntersGame (Only called if server tells client to execute) |
| 419 | // |
| 420 | // Event handler for when a player enters the game. This will only get called once per |
| 421 | // player, it usually gets called right after they connect to the server to start playing. |
| 422 | // player_num = player number of the player entering the game |
| 423 | void DMFCBasecxx . . $ DMFCBase#::OnClientPlayerEntersGamecxx . . $ DMFCBase#OnClientPlayerEntersGame(d4f767463ce0a6b3).(int player_num) { |
| 424 | if ((GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) || (player_num != GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).())) { |
| 425 | int slot; |
| 426 | |
| 427 | if (IsMasterTrackerGamecxx . . $ DMFCBase#IsMasterTrackerGame(c9857a73d68e59ba).()) |
| 428 | slot = PRec_FindPlayercxx . . $ PRec_FindPlayer(4f784f6a1e751a10).(Playerscxx . . $ DMFCBase#Players.[player_num].callsigncxx . . $ player#callsign., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, Playerscxx . . $ DMFCBase#Players.[player_num].tracker_idcxx . . $ player#tracker_id.); |
| 429 | else |
| 430 | slot = PRec_FindPlayercxx . . $ PRec_FindPlayer(4f784f6a1e751a10).(Playerscxx . . $ DMFCBase#Players.[player_num].callsigncxx . . $ player#callsign., &NetPlayerscxx . . $ DMFCBase#NetPlayers.[player_num].addrcxx . . $ netplayer#addr., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 431 | |
| 432 | if (slot == -1) { |
| 433 | // we have a new player |
| 434 | slot = PRec_GetFreeSlotcxx . . $ PRec_GetFreeSlot(b126dc7c1de90089).(); |
| 435 | if (!PRec_AssignPlayerToSlotcxx . . $ PRec_AssignPlayerToSlot(a983d75b38abae39).(player_num, slot, Playerscxx . . $ DMFCBase#Players., NetPlayerscxx . . $ DMFCBase#NetPlayers.)) |
| 436 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Unable to assign New Player (%s) to Player Record slot #%d\n", Players[player_num].callsign, slot); |
| 437 | else |
| 438 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "(%s) has been assigned to Player Record slot #%d\n", Players[player_num].callsign, slot); |
| 439 | CallOnPlayerConnectcxx . . $ DMFCBase#CallOnPlayerConnect(d4f767463ce0a6b3).(player_num); |
| 440 | } else { |
| 441 | // we have a reconnecting player |
| 442 | if (!PRec_ReconnectPlayerToSlotcxx . . $ PRec_ReconnectPlayerToSlot(a983d75b38abae39).(player_num, slot, Playerscxx . . $ DMFCBase#Players., NetPlayerscxx . . $ DMFCBase#NetPlayers.)) |
| 443 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Unable to reassign reconnecting player (%s) to Player Record slot #%d\n", |
| 444 | Players[player_num].callsign, slot); |
| 445 | else |
| 446 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Reconnected player (%s) to Player Record slot #%d\n", Players[player_num].callsign, slot); |
| 447 | CallOnPlayerReconnectcxx . . $ DMFCBase#CallOnPlayerReconnect(d4f767463ce0a6b3).(player_num); |
| 448 | } |
| 449 | } |
| 450 | |
| 451 | // If the correct options are set, go into the D1/D2 style wait screen |
| 452 | if (GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`! && (player_num == GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).())) { |
| 453 | |
| 454 | if (GetNumTeamscxx . . $ DMFCBase#GetNumTeams(b126dc7c1de90089).() > 1 && (!(m_iProtectedFlagscxx . . $ DMFCBase#m_iProtectedFlags. & DMFC_PRF_NOTEAMSELECTONSTARTcxx . . $ `netgames/dmfc/dmfcinternal.h:2386:9`!))) { |
| 455 | // Display the team placement dialog |
| 456 | static char enable; |
| 457 | enable = 1; |
| 458 | StartUIWindowcxx . . $ DMFCBase#StartUIWindow(6ca3d68f5c5f0975).(UIID_TEAMPLACEMENTcxx . . $ `netgames/dmfc/dmfcinternal.h:2784:9`!, &enable); |
| 459 | } |
| 460 | |
| 461 | if (GetNumTeamscxx . . $ DMFCBase#GetNumTeams(b126dc7c1de90089).() < 2 && (!(m_iProtectedFlagscxx . . $ DMFCBase#m_iProtectedFlags. & DMFC_PRF_NOWAITFORPLAYERScxx . . $ `netgames/dmfc/dmfcinternal.h:2389:9`!))) { |
| 462 | StartUIWindowcxx . . $ DMFCBase#StartUIWindow(6ca3d68f5c5f0975).(UIID_WAITFORPLAYERScxx . . $ `netgames/dmfc/dmfcinternal.h:2785:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | // Load up the pilot picture bitmap |
| 467 | //-------------------------------- |
| 468 | if (player_num == GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).()) { |
| 469 | // since we are entering the game, go through all the players and setup their bitmaps |
| 470 | for (int w = 0; w < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; w++) { |
| 471 | if (CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(w) || (w == 0 && GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!)) { |
| 472 | if (PilotPicBmpHandlescxx . . $ DMFCBase#PilotPicBmpHandles.[w] > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) { |
| 473 | DLLbm_FreeBitmap(PilotPicBmpHandlescxx . . $ DMFCBase#PilotPicBmpHandles.[w]); |
| 474 | PilotPicBmpHandlescxx . . $ DMFCBase#PilotPicBmpHandles.[w] = BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!; |
| 475 | } |
| 476 | |
| 477 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "PPIC ID: %d is %d\n", w, NetPlayers[w].pilot_pic_id); |
| 478 | if (NetPlayerscxx . . $ DMFCBase#NetPlayers.[w].pilot_pic_idcxx . . $ netplayer#pilot_pic_id. != 65535) { |
| 479 | PilotPicBmpHandlescxx . . $ DMFCBase#PilotPicBmpHandles.[w] = DLLPPic_GetBitmapHandle(NetPlayerscxx . . $ DMFCBase#NetPlayers.[w].pilot_pic_idcxx . . $ netplayer#pilot_pic_id.); |
| 480 | if (PilotPicBmpHandlescxx . . $ DMFCBase#PilotPicBmpHandles.[w] < BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) |
| 481 | PilotPicBmpHandlescxx . . $ DMFCBase#PilotPicBmpHandles.[w] = BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!; |
| 482 | } else { |
| 483 | PilotPicBmpHandlescxx . . $ DMFCBase#PilotPicBmpHandles.[w] = BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!; |
| 484 | } |
| 485 | } else { |
| 486 | PilotPicBmpHandlescxx . . $ DMFCBase#PilotPicBmpHandles.[w] = BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!; |
| 487 | } |
| 488 | } |
| 489 | } else { |
| 490 | if (PilotPicBmpHandlescxx . . $ DMFCBase#PilotPicBmpHandles.[player_num] > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) { |
| 491 | DLLbm_FreeBitmap(PilotPicBmpHandlescxx . . $ DMFCBase#PilotPicBmpHandles.[player_num]); |
| 492 | PilotPicBmpHandlescxx . . $ DMFCBase#PilotPicBmpHandles.[player_num] = BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!; |
| 493 | } |
| 494 | |
| 495 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "PPIC ID: %d is %d\n", player_num, NetPlayers[player_num].pilot_pic_id); |
| 496 | if (NetPlayerscxx . . $ DMFCBase#NetPlayers.[player_num].pilot_pic_idcxx . . $ netplayer#pilot_pic_id. != 65535) { |
| 497 | PilotPicBmpHandlescxx . . $ DMFCBase#PilotPicBmpHandles.[player_num] = DLLPPic_GetBitmapHandle(NetPlayerscxx . . $ DMFCBase#NetPlayers.[player_num].pilot_pic_idcxx . . $ netplayer#pilot_pic_id.); |
| 498 | if (PilotPicBmpHandlescxx . . $ DMFCBase#PilotPicBmpHandles.[player_num] < BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) |
| 499 | PilotPicBmpHandlescxx . . $ DMFCBase#PilotPicBmpHandles.[player_num] = BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!; |
| 500 | } else { |
| 501 | PilotPicBmpHandlescxx . . $ DMFCBase#PilotPicBmpHandles.[player_num] = BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!; |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | // Play the player hud message sound |
| 506 | static int sound_id = -2; |
| 507 | if (sound_id == -2) { |
| 508 | sound_id = DLLFindSoundName("Hudmessage"); |
| 509 | } |
| 510 | |
| 511 | if (sound_id > -1 && GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).() != player_num) { |
| 512 | DLLPlay2dSound(sound_id, MAX_GAME_VOLUMEcxx . . $ `netgames/includes/gamedll_header.h:59:9`! / 2); |
| 513 | } |
| 514 | } |
| 515 | |
| 516 | // DMFCBase::OnClientPlayerDisconnect |
| 517 | // |
| 518 | // Event handler for when a player disconnects from the server. |
| 519 | // player_num = player number of the player that just disconnected |
| 520 | void DMFCBasecxx . . $ DMFCBase#::OnClientPlayerDisconnectcxx . . $ DMFCBase#OnClientPlayerDisconnect(d4f767463ce0a6b3).(int player_num) { |
| 521 | // Play the player hud message sound |
| 522 | static int sound_id = -2; |
| 523 | if (sound_id == -2) { |
| 524 | sound_id = DLLFindSoundName("Hudmessage"); |
| 525 | } |
| 526 | |
| 527 | if (sound_id > -1 && GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).() != player_num) { |
| 528 | DLLPlay2dSound(sound_id, MAX_GAME_VOLUMEcxx . . $ `netgames/includes/gamedll_header.h:59:9`! / 2); |
| 529 | } |
| 530 | |
| 531 | // save the team |
| 532 | PRec_SetPlayerTeamcxx . . $ PRec_SetPlayerTeam(3e454b8ccf442868).(player_num, Playerscxx . . $ DMFCBase#Players.[player_num].teamcxx . . $ player#team.); |
| 533 | |
| 534 | if (!PRec_DisconnectPlayercxx . . $ PRec_DisconnectPlayer(83c267b20bac841a).(player_num)) |
| 535 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Unable to disconnect player (%s) from Player Records\n", Players[player_num].callsign); |
| 536 | else |
| 537 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Disconnected player (%s) from Player Records\n", Players[player_num].callsign); |
| 538 | } |
| 539 | |
| 540 | // DMFCBase::OnMeDisconnectFromServer |
| 541 | // |
| 542 | // Event handler that gets called if we disconnect from the server for some reason (not purposesly quit) |
| 543 | void DMFCBasecxx . . $ DMFCBase#::OnMeDisconnectFromServercxx . . $ DMFCBase#OnMeDisconnectFromServer(49f6e7a06ebc5aa8).(void) { |
| 544 | // We're disconnecting so save the stats to file |
| 545 | if (m_iProtectedFlagscxx . . $ DMFCBase#m_iProtectedFlags. & DMFC_PRF_AUTOSAVEDISCcxx . . $ `netgames/dmfc/dmfcinternal.h:2382:9`!) |
| 546 | CallOnDisconnectSaveStatsToFilecxx . . $ DMFCBase#CallOnDisconnectSaveStatsToFile(49f6e7a06ebc5aa8).(); |
| 547 | } |
| 548 | |
| 549 | // DMFCBase::OnClientGameCreated (Only called if server tells client to execute) |
| 550 | // |
| 551 | // Event handler when the server's game first gets started. This will only be called once |
| 552 | // while the server is running, and that is when the server first starts up. |
| 553 | void DMFCBasecxx . . $ DMFCBase#::OnClientGameCreatedcxx . . $ DMFCBase#OnClientGameCreated(49f6e7a06ebc5aa8).(void) {} |
| 554 | |
| 555 | // DMFCBase::OnClientLevelChange (Only called if server tells client to execute) |
| 556 | // |
| 557 | // Event handler when the server changes levels. This will get called after a level ends and a server |
| 558 | // is starting a new level. |
| 559 | void DMFCBasecxx . . $ DMFCBase#::OnClientLevelChangecxx . . $ DMFCBase#OnClientLevelChange(49f6e7a06ebc5aa8).(void) {} |
| 560 | |
| 561 | // DMFCBase::OnClientLevelStart (Only called if server tells client to execute) |
| 562 | // |
| 563 | // Event handler for when a multiplayer level is starting up. This will get called right before the level |
| 564 | // starts. |
| 565 | void DMFCBasecxx . . $ DMFCBase#::OnClientLevelStartcxx . . $ DMFCBase#OnClientLevelStart(49f6e7a06ebc5aa8).(void) { |
| 566 | // Clear this array so we don't get weird anomalies |
| 567 | ResetPlayersInGamecxx . . $ DMFCBase#ResetPlayersInGame(49f6e7a06ebc5aa8).(); |
| 568 | |
| 569 | // Reset the timers |
| 570 | InitTimerscxx . . $ DMFCBase#InitTimers(49f6e7a06ebc5aa8).(); |
| 571 | |
| 572 | // Reset level stats of Player Records |
| 573 | PRec_LevelResetcxx . . $ PRec_LevelReset(49f6e7a06ebc5aa8).(); |
| 574 | |
| 575 | // reset the pinfo list |
| 576 | ResetPInfocxx . . $ DMFCBase#ResetPInfo(49f6e7a06ebc5aa8).(); |
| 577 | |
| 578 | // Request Player Records |
| 579 | SendRequestForPlayerRecordscxx . . $ DMFCBase#SendRequestForPlayerRecords(49f6e7a06ebc5aa8).(); |
| 580 | |
| 581 | DisplayTauntIndicatorcxx . . $ DMFCBase#DisplayTauntIndicator. = false; |
| 582 | } |
| 583 | |
| 584 | // DMFCBase::OnClientLevelEnd |
| 585 | // |
| 586 | // Event handler for when a multiplayer level is ending. |
| 587 | void DMFCBasecxx . . $ DMFCBase#::OnClientLevelEndcxx . . $ DMFCBase#OnClientLevelEnd(49f6e7a06ebc5aa8).(void) { |
| 588 | MarkPlayersInGamecxx . . $ DMFCBase#MarkPlayersInGame(49f6e7a06ebc5aa8).(); |
| 589 | |
| 590 | if (m_iProtectedFlagscxx . . $ DMFCBase#m_iProtectedFlags. & DMFC_PRF_AUTOSAVELEVELENDcxx . . $ `netgames/dmfc/dmfcinternal.h:2381:9`!) |
| 591 | CallOnLevelEndSaveStatsToFilecxx . . $ DMFCBase#CallOnLevelEndSaveStatsToFile(49f6e7a06ebc5aa8).(); |
| 592 | |
| 593 | KillAllTimerscxx . . $ DMFCBase#KillAllTimers(49f6e7a06ebc5aa8).(); |
| 594 | ENABLE_FLAGScxx . . $ `netgames/dmfc/dmfcinternal.h:2371:9`!(m_iProtectedFlags, DMFC_PRF_PLRFIRSTTIMEcxx . . $ `netgames/dmfc/dmfcinternal.h:2374:9`!); |
| 595 | |
| 596 | // Call PLRInit so data can be initialized |
| 597 | CallOnPLRInitcxx . . $ DMFCBase#CallOnPLRInit(49f6e7a06ebc5aa8).(); |
| 598 | |
| 599 | for (int i = 0; i < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; i++) { |
| 600 | if ((NetPlayerscxx . . $ DMFCBase#NetPlayers.[i].flagscxx . . $ netplayer#flags. & NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`!) && |
| 601 | (NetPlayerscxx . . $ DMFCBase#NetPlayers.[i].sequencecxx . . $ netplayer#sequence. >= NETSEQ_PLAYINGcxx . . $ `Descent3/multi_external.h:161:9`! || NetPlayerscxx . . $ DMFCBase#NetPlayers.[i].sequencecxx . . $ netplayer#sequence. == NETSEQ_WAITING_FOR_LEVELcxx . . $ `Descent3/multi_external.h:149:9`!)) { |
| 602 | |
| 603 | // save the team |
| 604 | PRec_SetPlayerTeamcxx . . $ PRec_SetPlayerTeam(3e454b8ccf442868).(i, Playerscxx . . $ DMFCBase#Players.[i].teamcxx . . $ player#team.); |
| 605 | |
| 606 | if (!PRec_DisconnectPlayercxx . . $ PRec_DisconnectPlayer(83c267b20bac841a).(i)) |
| 607 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Unable to disconnect player (%s) from Player Records\n", Players[i].callsign); |
| 608 | else |
| 609 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Disconnected player (%s) from Player Records\n", Players[i].callsign); |
| 610 | } |
| 611 | } |
| 612 | } |
| 613 | |
| 614 | // DMFCBase::OnPlayerEntersObserver |
| 615 | // |
| 616 | // Event handler when a player becomes an observer mode |
| 617 | // If they are piggybacking another player than piggy is the object pointer, else it's NULL |
| 618 | void DMFCBasecxx . . $ DMFCBase#::OnPlayerEntersObservercxx . . $ DMFCBase#OnPlayerEntersObserver(14473714f2cc5bd2).(int pnum, objectcxx . . $ object# *piggy) { |
| 619 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Player %d entering observermode %s\n", pnum, (piggy) ? "Piggyback" : "Roam"); |
| 620 | player_recordcxx . . $ player_record# *pr = PRec_GetPRecordByPnumcxx . . $ PRec_GetPRecordByPnum(6359c6f28dd028ae).(pnum); |
| 621 | if (pr && pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) { |
| 622 | PInfocxx . . $ PInfo# *pi = pr->pinfocxx . . $ player_record#pinfo.; |
| 623 | ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(pi != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 624 | pi->EnterObserverModecxx . . $ PInfo#EnterObserverMode(49f6e7a06ebc5aa8).(); |
| 625 | } else { |
| 626 | Int3cxx . . $ `netgames/includes/DMFC.h:378:9`!(); |
| 627 | } |
| 628 | } |
| 629 | |
| 630 | // DMFCBase::OnPlayerExitsObserver |
| 631 | // |
| 632 | // Event handler when a player is leaving observer mode |
| 633 | void DMFCBasecxx . . $ DMFCBase#::OnPlayerExitsObservercxx . . $ DMFCBase#OnPlayerExitsObserver(d4f767463ce0a6b3).(int pnum) { |
| 634 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Player %d leaving observer mode\n", pnum); |
| 635 | player_recordcxx . . $ player_record# *pr = PRec_GetPRecordByPnumcxx . . $ PRec_GetPRecordByPnum(6359c6f28dd028ae).(pnum); |
| 636 | if (pr && pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) { |
| 637 | PInfocxx . . $ PInfo# *pi = pr->pinfocxx . . $ player_record#pinfo.; |
| 638 | ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(pi != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 639 | pi->ExitObserverModecxx . . $ PInfo#ExitObserverMode(49f6e7a06ebc5aa8).(); |
| 640 | } else { |
| 641 | Int3cxx . . $ `netgames/includes/DMFC.h:378:9`!(); |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | // DMFCBase::OnCanChangeTeam |
| 646 | // |
| 647 | // Called to determine if a player can change teams, you can override this so the server won't |
| 648 | // let a player change teams if it is not desired (for that player) |
| 649 | bool DMFCBasecxx . . $ DMFCBase#::OnCanChangeTeamcxx . . $ DMFCBase#OnCanChangeTeam(cf9ef193275fa6d8).(int pnum, int newteam) { |
| 650 | if (Playerscxx . . $ DMFCBase#Players.[pnum].teamcxx . . $ player#team. == -1) |
| 651 | return false; // no team switching for dedicated server |
| 652 | |
| 653 | // AnnounceTeamChangeDeny(pnum); |
| 654 | return true; |
| 655 | } |
| 656 | |
| 657 | // DMFCBase::OnSaveStatsToFile |
| 658 | // |
| 659 | // |
| 660 | // The user is requesting the game stats to be saved to file, you must handle this completly on |
| 661 | // the game's side, nothing is done in DMFC |
| 662 | void DMFCBasecxx . . $ DMFCBase#::OnSaveStatsToFilecxx . . $ DMFCBase#OnSaveStatsToFile(49f6e7a06ebc5aa8).(void) { mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "User requested stats to be saved!\n"); } |
| 663 | |
| 664 | // DMFCBase::OnLevelEndSaveStatsToFile |
| 665 | // |
| 666 | // |
| 667 | // The game should save the "End of Level" stats to file. You must handle this completly on |
| 668 | // the game's side, nothing is done in DMFC |
| 669 | void DMFCBasecxx . . $ DMFCBase#::OnLevelEndSaveStatsToFilecxx . . $ DMFCBase#OnLevelEndSaveStatsToFile(49f6e7a06ebc5aa8).(void) {} |
| 670 | |
| 671 | // DMFCBase::OnDisconnectSaveStatsToFile |
| 672 | // |
| 673 | // |
| 674 | // The game should save the stats because the player (only ourself as the client in the game), |
| 675 | // has disconnected. |
| 676 | void DMFCBasecxx . . $ DMFCBase#::OnDisconnectSaveStatsToFilecxx . . $ DMFCBase#OnDisconnectSaveStatsToFile(49f6e7a06ebc5aa8).(void) {} |
| 677 | |
| 678 | // DMFCBase::OnSpecialPacket |
| 679 | // |
| 680 | // Event handler for when a special packet arrives and needs to be processed. |
| 681 | // Both the server and client can get this event, although it is more common for the |
| 682 | // client to recieve these. |
| 683 | void DMFCBasecxx . . $ DMFCBase#::OnSpecialPacketcxx . . $ DMFCBase#OnSpecialPacket(49f6e7a06ebc5aa8).(void) { |
| 684 | if (!SPRootcxx . . $ DMFCBase#SPRoot.) |
| 685 | return; |
| 686 | |
| 687 | // see if we have a handler for the ID, if so, call the handler, else do nothing |
| 688 | uint8_tcxx . . $ uint8_t# *data = Datacxx . . $ DMFCBase#Data.->special_datacxx . . $ dllinfo#special_data.; |
| 689 | int id = data[0]; |
| 690 | |
| 691 | tSPHandlercxx . . $ tSPHandler# *current; |
| 692 | current = SPRootcxx . . $ DMFCBase#SPRoot.; |
| 693 | while (current) { |
| 694 | if (current->IDcxx . . $ tSPHandler#ID. == id) { |
| 695 | // we got a winner |
| 696 | switch (current->typecxx . . $ tSPHandler#type.) { |
| 697 | case SPH_DMFCFUNCcxx . . $ `netgames/includes/DMFC.h:437:9`!: |
| 698 | if (current->DMFCfunccxx . . $ tSPHandler#DMFCfunc.) |
| 699 | (this->*current->DMFCfunccxx . . $ tSPHandler#DMFCfunc.)(data + 1); |
| 700 | break; |
| 701 | case SPH_FUNCcxx . . $ `netgames/includes/DMFC.h:438:9`!: |
| 702 | if (current->funccxx . . $ tSPHandler#func.) |
| 703 | (*current->funccxx . . $ tSPHandler#func.)(data + 1); |
| 704 | break; |
| 705 | } |
| 706 | return; |
| 707 | } |
| 708 | current = current->nextcxx . . $ tSPHandler#next.; |
| 709 | } |
| 710 | } |
| 711 | |
| 712 | // DMFCBase::OnHUDInterval |
| 713 | // |
| 714 | // Event handler that gets called once a frame when it's time to render the HUD images |
| 715 | void DMFCBasecxx . . $ DMFCBase#::OnHUDIntervalcxx . . $ DMFCBase#OnHUDInterval(49f6e7a06ebc5aa8).(void) { |
| 716 | if (m_bMakeClientsWaitcxx . . $ DMFCBase#m_bMakeClientsWait.) |
| 717 | WaitingForServerLoopcxx . . $ DMFCBase#WaitingForServerLoop(49f6e7a06ebc5aa8).(); |
| 718 | if (m_iProtectedFlagscxx . . $ DMFCBase#m_iProtectedFlags. & DMFC_PRF_DISPPLAYERINFOcxx . . $ `netgames/dmfc/dmfcinternal.h:2378:9`!) |
| 719 | DisplayPlayerInfocxx . . $ DMFCBase#DisplayPlayerInfo(918ebd27a9ddbad3).(MenuBackgroundBMPcxx . . $ DMFCBase#MenuBackgroundBMP.); |
| 720 | if (m_iProtectedFlagscxx . . $ DMFCBase#m_iProtectedFlags. & DMFC_PRF_DISPNETGAMEINFOcxx . . $ `netgames/dmfc/dmfcinternal.h:2379:9`!) |
| 721 | DisplayNetGameInfocxx . . $ DMFCBase#DisplayNetGameInfo(918ebd27a9ddbad3).(MenuBackgroundBMPcxx . . $ DMFCBase#MenuBackgroundBMP.); |
| 722 | LossGuageFramecxx . . $ DMFCBase#LossGuageFrame(49f6e7a06ebc5aa8).(); |
| 723 | DisplayTauntIndicatorFramecxx . . $ DMFCBase#DisplayTauntIndicatorFrame(49f6e7a06ebc5aa8).(); |
| 724 | |
| 725 | if (m_iProtectedFlagscxx . . $ DMFCBase#m_iProtectedFlags. & DMFC_PRF_INOPTIONScxx . . $ `netgames/dmfc/dmfcinternal.h:2384:9`!) { |
| 726 | // Update all the state submenus so they are reporting the correct value |
| 727 | if (TeamMenuItemcxx . . $ DMFCBase#TeamMenuItem.) |
| 728 | TeamMenuItemcxx . . $ DMFCBase#TeamMenuItem.->SetStatecxx . . $ MenuItem#SetState(d4f767463ce0a6b3).(GetPlayerTeamcxx . . $ DMFCBase#GetPlayerTeam(7864480464b09eea).(GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).())); |
| 729 | if (AutoBalanceItemcxx . . $ DMFCBase#AutoBalanceItem.) |
| 730 | AutoBalanceItemcxx . . $ DMFCBase#AutoBalanceItem.->SetStatecxx . . $ MenuItem#SetState(d4f767463ce0a6b3).((m_iProtectedFlagscxx . . $ DMFCBase#m_iProtectedFlags. & DMFC_PRF_AUTOTEAMSELECTcxx . . $ `netgames/dmfc/dmfcinternal.h:2377:9`!) ? 1 : 0); |
| 731 | if (AllowTeamChangeItemcxx . . $ DMFCBase#AllowTeamChangeItem.) |
| 732 | AllowTeamChangeItemcxx . . $ DMFCBase#AllowTeamChangeItem.->SetStatecxx . . $ MenuItem#SetState(d4f767463ce0a6b3).(AllowTeamChangecxx . . $ DMFCBase#AllowTeamChange(c9857a73d68e59ba).() ? 1 : 0); |
| 733 | if (ObserverItemcxx . . $ DMFCBase#ObserverItem.) |
| 734 | ObserverItemcxx . . $ DMFCBase#ObserverItem.->SetStatecxx . . $ MenuItem#SetState(d4f767463ce0a6b3).((Objectscxx . . $ DMFCBase#Objects.[Playerscxx . . $ DMFCBase#Players.[GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).()].objnumcxx . . $ player#objnum.].typecxx . . $ object#type. == OBJ_OBSERVERcxx . . $ `Descent3/object_external.h:182:9`!) ? 1 : 0); |
| 735 | if (StatisticMessagesItemcxx . . $ DMFCBase#StatisticMessagesItem.) |
| 736 | StatisticMessagesItemcxx . . $ DMFCBase#StatisticMessagesItem.->SetStatecxx . . $ MenuItem#SetState(d4f767463ce0a6b3).((m_iProtectedFlagscxx . . $ DMFCBase#m_iProtectedFlags. & DMFC_PRF_DISPSTATHUDMSGScxx . . $ `netgames/dmfc/dmfcinternal.h:2380:9`!) ? 1 : 0); |
| 737 | if (SaveStatsLevelEndItemcxx . . $ DMFCBase#SaveStatsLevelEndItem.) |
| 738 | SaveStatsLevelEndItemcxx . . $ DMFCBase#SaveStatsLevelEndItem.->SetStatecxx . . $ MenuItem#SetState(d4f767463ce0a6b3).((m_iProtectedFlagscxx . . $ DMFCBase#m_iProtectedFlags. & DMFC_PRF_AUTOSAVELEVELENDcxx . . $ `netgames/dmfc/dmfcinternal.h:2381:9`!) ? 1 : 0); |
| 739 | if (SaveStatsDisconnectItemcxx . . $ DMFCBase#SaveStatsDisconnectItem.) |
| 740 | SaveStatsDisconnectItemcxx . . $ DMFCBase#SaveStatsDisconnectItem.->SetStatecxx . . $ MenuItem#SetState(d4f767463ce0a6b3).((m_iProtectedFlagscxx . . $ DMFCBase#m_iProtectedFlags. & DMFC_PRF_AUTOSAVEDISCcxx . . $ `netgames/dmfc/dmfcinternal.h:2382:9`!) ? 1 : 0); |
| 741 | if (MenuBackgroundItemcxx . . $ DMFCBase#MenuBackgroundItem.) |
| 742 | MenuBackgroundItemcxx . . $ DMFCBase#MenuBackgroundItem.->SetStatecxx . . $ MenuItem#SetState(d4f767463ce0a6b3).((m_iProtectedFlagscxx . . $ DMFCBase#m_iProtectedFlags. & DMFC_PRF_DISPMENUBACKGRcxx . . $ `netgames/dmfc/dmfcinternal.h:2383:9`!) ? 1 : 0); |
| 743 | if (NetGameInfoItemcxx . . $ DMFCBase#NetGameInfoItem.) |
| 744 | NetGameInfoItemcxx . . $ DMFCBase#NetGameInfoItem.->SetStatecxx . . $ MenuItem#SetState(d4f767463ce0a6b3).(IsDisplayingNetGameInfocxx . . $ DMFCBase#IsDisplayingNetGameInfo(c9857a73d68e59ba).() ? 1 : 0); |
| 745 | if (HUDCallsignsItemcxx . . $ DMFCBase#HUDCallsignsItem.) |
| 746 | HUDCallsignsItemcxx . . $ DMFCBase#HUDCallsignsItem.->SetStatecxx . . $ MenuItem#SetState(d4f767463ce0a6b3).(m_iMyCurrentHUDCallsignLevelcxx . . $ DMFCBase#m_iMyCurrentHUDCallsignLevel.); |
| 747 | if (ServerHUDCallsignsItemcxx . . $ DMFCBase#ServerHUDCallsignsItem.) |
| 748 | ServerHUDCallsignsItemcxx . . $ DMFCBase#ServerHUDCallsignsItem.->SetStatecxx . . $ MenuItem#SetState(d4f767463ce0a6b3).(m_iServerHUDCallsignLevelcxx . . $ DMFCBase#m_iServerHUDCallsignLevel.); |
| 749 | if (DeathMessageFilterItemcxx . . $ DMFCBase#DeathMessageFilterItem.) |
| 750 | DeathMessageFilterItemcxx . . $ DMFCBase#DeathMessageFilterItem.->SetStatecxx . . $ MenuItem#SetState(d4f767463ce0a6b3).(m_iDeathMessageFiltercxx . . $ DMFCBase#m_iDeathMessageFilter.); |
| 751 | if (ShipLogosItemcxx . . $ DMFCBase#ShipLogosItem.) |
| 752 | ShipLogosItemcxx . . $ DMFCBase#ShipLogosItem.->SetStatecxx . . $ MenuItem#SetState(d4f767463ce0a6b3).(AreLogosEnabledcxx . . $ DMFCBase#AreLogosEnabled(c9857a73d68e59ba).() ? 1 : 0); |
| 753 | if (HUDIndicatorItemcxx . . $ DMFCBase#HUDIndicatorItem.) |
| 754 | HUDIndicatorItemcxx . . $ DMFCBase#HUDIndicatorItem.->SetStatecxx . . $ MenuItem#SetState(d4f767463ce0a6b3).(LossGuageEnabledcxx . . $ DMFCBase#LossGuageEnabled. ? 1 : 0); |
| 755 | |
| 756 | // We have an options screen up, so draw it |
| 757 | DrawMenucxx . . $ DMFCBase#DrawMenu(49f6e7a06ebc5aa8).(); |
| 758 | } |
| 759 | |
| 760 | // DisplayPilotPicsFrame(); |
| 761 | |
| 762 | // Display countdown if needed |
| 763 | DisplayTimelimitCountdowncxx . . $ DMFCBase#DisplayTimelimitCountdown(49f6e7a06ebc5aa8).(); |
| 764 | |
| 765 | DLLgrtext_Flush(); |
| 766 | } |
| 767 | |
| 768 | // DMFCBase::OnInterval |
| 769 | // |
| 770 | // Event handler that gets called once a frame |
| 771 | void DMFCBasecxx . . $ DMFCBase#::OnIntervalcxx . . $ DMFCBase#OnInterval(49f6e7a06ebc5aa8).(void) { |
| 772 | if (!(m_iProtectedFlagscxx . . $ DMFCBase#m_iProtectedFlags. & DMFC_PRF_PAUSETIMEcxx . . $ `netgames/dmfc/dmfcinternal.h:2391:9`!)) { |
| 773 | RealGametimecxx . . $ DMFCBase#RealGametime. += *Frametimecxx . . $ DMFCBase#Frametime.; // increment the timer |
| 774 | } |
| 775 | |
| 776 | // If we are a dedicated server, we are waiting, and there is a wait time |
| 777 | // check to see if it's time to disable |
| 778 | if (GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`! && IAmDedicatedServercxx . . $ DMFCBase#IAmDedicatedServer(c9857a73d68e59ba).() && m_bMakeClientsWaitcxx . . $ DMFCBase#m_bMakeClientsWait.) { |
| 779 | if (DedicatedLevelWaitcxx . . $ DMFCBase#DedicatedLevelWait. > 0 && DedicatedLevelWaitcxx . . $ DMFCBase#DedicatedLevelWait. <= (*Gametimecxx . . $ DMFCBase#Gametime.)) { |
| 780 | // time to stop waiting! |
| 781 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Telling clients that they can play!\n"); |
| 782 | DPrintf("Allowing Clients To Play\n"); |
| 783 | PauseRealGameTimecxx . . $ DMFCBase#PauseRealGameTime(b45ddcbc8423892c).(false); |
| 784 | MakeClientsWaitcxx . . $ DMFCBase#MakeClientsWait(b45ddcbc8423892c).(false); |
| 785 | } |
| 786 | } |
| 787 | |
| 788 | // CheckPInfo(); |
| 789 | |
| 790 | // Process remote admin frame |
| 791 | Remote_ProcessFramecxx . . $ Remote_ProcessFrame(49f6e7a06ebc5aa8).(); |
| 792 | |
| 793 | // Process all currently running timers |
| 794 | ProcessTimerscxx . . $ DMFCBase#ProcessTimers(49f6e7a06ebc5aa8).(); |
| 795 | |
| 796 | // Handle time limit games |
| 797 | float tleft; |
| 798 | if (GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) { |
| 799 | if ((m_iProtectedFlagscxx . . $ DMFCBase#m_iProtectedFlags. & DMFC_PRF_AUTOTIMELIMITcxx . . $ `netgames/dmfc/dmfcinternal.h:2375:9`!) && (GetTimeLeftcxx . . $ DMFCBase#GetTimeLeft(7f1546a85f5329ec).(&tleft))) { |
| 800 | if (tleft <= 0) { |
| 801 | EndLevelcxx . . $ DMFCBase#EndLevel(49f6e7a06ebc5aa8).(); |
| 802 | return; |
| 803 | } |
| 804 | } |
| 805 | } |
| 806 | } |
| 807 | |
| 808 | // DMFCBase::OnPLRInterval |
| 809 | // |
| 810 | // Event handler that gets called once a frame when the Post Level Results screen is being display |
| 811 | void DMFCBasecxx . . $ DMFCBase#::OnPLRIntervalcxx . . $ DMFCBase#OnPLRInterval(49f6e7a06ebc5aa8).(void) { |
| 812 | DLLgrtext_SetFont(Game_fontscxx . . $ DMFCBase#Game_fonts.[SMALL_UI_FONT_INDEXcxx . . $ `Descent3/gamefont.h:99:9`!]); |
| 813 | DLLgrtext_SetColor(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 40, 40)); |
| 814 | DLLgrtext_CenteredPrintf(0, 13, Netgamecxx . . $ DMFCBase#Netgame.->scriptnamecxx . . $ netgame_info#scriptname.); |
| 815 | DLLgrtext_CenteredPrintf(0, 461, DTXT_PRESSPRNTSCRNcxx . . $ `netgames/dmfc/dmfcinternal.h:2638:9`!); |
| 816 | } |
| 817 | |
| 818 | // DMFCBase::OnPLRInit |
| 819 | // |
| 820 | // Event handler that gets called the first frame of the PLR screen for each level |
| 821 | void DMFCBasecxx . . $ DMFCBase#::OnPLRInitcxx . . $ DMFCBase#OnPLRInit(49f6e7a06ebc5aa8).(void) { DISABLE_FLAGScxx . . $ `netgames/dmfc/dmfcinternal.h:2372:9`!(m_iProtectedFlags, DMFC_PRF_PLRFIRSTTIMEcxx . . $ `netgames/dmfc/dmfcinternal.h:2374:9`!); } |
| 822 | |
| 823 | // DMFCBase::OnKeypress |
| 824 | // |
| 825 | // Event handler for when a user presses a key while in the game |
| 826 | // key = Key code of the key being pressed |
| 827 | void DMFCBasecxx . . $ DMFCBase#::OnKeypresscxx . . $ DMFCBase#OnKeypress(d4f767463ce0a6b3).(int key) { |
| 828 | if (m_iProtectedFlagscxx . . $ DMFCBase#m_iProtectedFlags. & DMFC_PRF_INOPTIONScxx . . $ `netgames/dmfc/dmfcinternal.h:2384:9`!) { |
| 829 | Datacxx . . $ DMFCBase#Data.->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1; |
| 830 | // Handle keyboard input for an options menu |
| 831 | if (key == K_F6cxx . . $ `netgames/includes/DMFCKeyCodes.h:117:9`! || key == K_ESCcxx . . $ `netgames/includes/DMFCKeyCodes.h:97:9`!) { // escape out of options |
| 832 | DISABLE_FLAGScxx . . $ `netgames/dmfc/dmfcinternal.h:2372:9`!(m_iProtectedFlags, DMFC_PRF_INOPTIONScxx . . $ `netgames/dmfc/dmfcinternal.h:2384:9`!); |
| 833 | } |
| 834 | if (key == K_ENTERcxx . . $ `netgames/includes/DMFCKeyCodes.h:98:9`!) { |
| 835 | Menucxx . . $ DMFCBase#Menu..Executecxx . . $ MenuItem#Execute(49f6e7a06ebc5aa8).(); |
| 836 | } |
| 837 | switch (key) { |
| 838 | case K_DOWNcxx . . $ `netgames/includes/DMFCKeyCodes.h:149:9`!: { |
| 839 | Menucxx . . $ DMFCBase#Menu..Downcxx . . $ MenuItem#Down(c9857a73d68e59ba).(); |
| 840 | } break; |
| 841 | case K_UPcxx . . $ `netgames/includes/DMFCKeyCodes.h:148:9`!: { |
| 842 | Menucxx . . $ DMFCBase#Menu..Upcxx . . $ MenuItem#Up(c9857a73d68e59ba).(); |
| 843 | } break; |
| 844 | case K_RIGHTcxx . . $ `netgames/includes/DMFCKeyCodes.h:151:9`!: { |
| 845 | Menucxx . . $ DMFCBase#Menu..Forwardcxx . . $ MenuItem#Forward(c9857a73d68e59ba).(); |
| 846 | } break; |
| 847 | case K_LEFTcxx . . $ `netgames/includes/DMFCKeyCodes.h:150:9`!: { |
| 848 | Menucxx . . $ DMFCBase#Menu..Backcxx . . $ MenuItem#Back(c9857a73d68e59ba).(); |
| 849 | } break; |
| 850 | } |
| 851 | } else if (key == K_F6cxx . . $ `netgames/includes/DMFCKeyCodes.h:117:9`!) { |
| 852 | ENABLE_FLAGScxx . . $ `netgames/dmfc/dmfcinternal.h:2371:9`!(m_iProtectedFlags, DMFC_PRF_INOPTIONScxx . . $ `netgames/dmfc/dmfcinternal.h:2384:9`!); |
| 853 | } |
| 854 | } |
| 855 | |
| 856 | // DMFCBase::OnInputString |
| 857 | // |
| 858 | // Event handler for when the user types a message at the console (F8) that begins with a $ |
| 859 | // input_string = string that was typed |
| 860 | void DMFCBasecxx . . $ DMFCBase#::OnInputStringcxx . . $ DMFCBase#OnInputString(fda57c8427c60377).(char *input_string) { |
| 861 | if (!InputCommandHandlecxx . . $ DMFCBase#InputCommandHandle(c6b7e35ff6de5671).(input_string)) { |
| 862 | // The input command wasn't handled! |
| 863 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "DMFC Warning: Input Command '%s' wasn't handled\n", input_string); |
| 864 | } |
| 865 | } |
| 866 | |
| 867 | // DMFCBase::OnPlayerChangeTeam |
| 868 | // |
| 869 | // Called when a player changes team |
| 870 | void DMFCBasecxx . . $ DMFCBase#::OnPlayerChangeTeamcxx . . $ DMFCBase#OnPlayerChangeTeam(23bb497e4fbd6c85).(int player_num, int newteam, bool announce, bool spew_everything) { |
| 871 | player_recordcxx . . $ player_record# *pr = GetPlayerRecordByPnumcxx . . $ DMFCBase#GetPlayerRecordByPnum(6359c6f28dd028ae).(player_num); |
| 872 | if (pr) { |
| 873 | if (GetNumTeamscxx . . $ DMFCBase#GetNumTeams(b126dc7c1de90089).() > 1 && announce && newteam != -1) |
| 874 | DLLAddHUDMessage(DTXT_CHANGETEAMcxx . . $ `netgames/dmfc/dmfcinternal.h:2639:9`!, pr->callsigncxx . . $ player_record#callsign., GetTeamStringcxx . . $ DMFCBase#GetTeamString(f7ae7e56280f18ae).(newteam)); |
| 875 | pr->teamcxx . . $ player_record#team. = newteam; |
| 876 | |
| 877 | // only respawn them if they are not dead |
| 878 | if (!((Playerscxx . . $ DMFCBase#Players.[player_num].flagscxx . . $ player#flags. & PLAYER_FLAGS_DYINGcxx . . $ `Descent3/player_external.h:80:9`!) || (Playerscxx . . $ DMFCBase#Players.[player_num].flagscxx . . $ player#flags. & PLAYER_FLAGS_DEADcxx . . $ `Descent3/player_external.h:81:9`!))) { |
| 879 | RespawnPlayercxx . . $ DMFCBase#RespawnPlayer(d06ec138c316ab3d).(player_num, false, spew_everything); |
| 880 | } |
| 881 | } |
| 882 | } |
| 883 | |
| 884 | // DMFCBase::OnClientObjectShieldsChanged |
| 885 | // |
| 886 | // Event handler for when an objects shield's change |
| 887 | void DMFCBasecxx . . $ DMFCBase#::OnClientObjectShieldsChangedcxx . . $ DMFCBase#OnClientObjectShieldsChanged(4ebbd0c3cbf1b78a).(objectcxx . . $ object# *obj, float amount) {} |
| 888 | |
| 889 | // DMFCBase::OnWeaponFired |
| 890 | // |
| 891 | // Event handler for when an object fires a weapon |
| 892 | void DMFCBasecxx . . $ DMFCBase#::OnWeaponFiredcxx . . $ DMFCBase#OnWeaponFired(6273fa812ac58a8).(objectcxx . . $ object# *weapon_obj, objectcxx . . $ object# *shooter) {} |
| 893 | |
| 894 | // DMFCBase::OnPlayerReconnect |
| 895 | // |
| 896 | // |
| 897 | // This player is reconnecting to the game |
| 898 | void DMFCBasecxx . . $ DMFCBase#::OnPlayerReconnectcxx . . $ DMFCBase#OnPlayerReconnect(d4f767463ce0a6b3).(int player_num) { |
| 899 | if (GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) { |
| 900 | // restore their team |
| 901 | int team = PRec_GetPlayerTeamcxx . . $ PRec_GetPlayerTeam(7864480464b09eea).(player_num); |
| 902 | if (team != Playerscxx . . $ DMFCBase#Players.[player_num].teamcxx . . $ player#team.) { |
| 903 | // hey! Jason hasn't set the correct team for this player |
| 904 | ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(player_num == 0); // this is only going to happen for the server |
| 905 | } |
| 906 | |
| 907 | SendTeamAssignmentcxx . . $ DMFCBase#SendTeamAssignment(6908015b96d379c0).(player_num, team, false); |
| 908 | Playerscxx . . $ DMFCBase#Players.[player_num].teamcxx . . $ player#team. = team; |
| 909 | CallOnPlayerChangeTeamcxx . . $ DMFCBase#CallOnPlayerChangeTeam(23bb497e4fbd6c85).(player_num, team, false, false); |
| 910 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Reassigning (%s) to %s team\n", Players[player_num].callsign, GetTeamString(team)); |
| 911 | } |
| 912 | } |
| 913 | |
| 914 | // DMFCBase::OnPlayerConnect |
| 915 | // |
| 916 | // |
| 917 | // This player is connecting to the game for the first time |
| 918 | void DMFCBasecxx . . $ DMFCBase#::OnPlayerConnectcxx . . $ DMFCBase#OnPlayerConnect(d4f767463ce0a6b3).(int player_num) { |
| 919 | if (GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) { |
| 920 | |
| 921 | // a dedicated server MUST be given a -1 team |
| 922 | //------------------------------------------ |
| 923 | if (player_num == 0 && IAmDedicatedServercxx . . $ DMFCBase#IAmDedicatedServer(c9857a73d68e59ba).()) { |
| 924 | Playerscxx . . $ DMFCBase#Players.[0].teamcxx . . $ player#team. = -1; |
| 925 | } |
| 926 | |
| 927 | // get team assignment |
| 928 | if (m_iProtectedFlagscxx . . $ DMFCBase#m_iProtectedFlags. & DMFC_PRF_AUTOTEAMSELECTcxx . . $ `netgames/dmfc/dmfcinternal.h:2377:9`!) { |
| 929 | // JEFF: Commented out since team's are now determined right when a client connects |
| 930 | //@@int team = GetTeamForNewPlayer(player_num,m_iNumTeams); |
| 931 | int team = Playerscxx . . $ DMFCBase#Players.[player_num].teamcxx . . $ player#team.; |
| 932 | SendTeamAssignmentcxx . . $ DMFCBase#SendTeamAssignment(6908015b96d379c0).(player_num, team, false); |
| 933 | //@@Players[player_num].team = team; |
| 934 | CallOnPlayerChangeTeamcxx . . $ DMFCBase#CallOnPlayerChangeTeam(23bb497e4fbd6c85).(player_num, team, false, false); |
| 935 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Assigning (%s) to %s team\n", Players[player_num].callsign, GetTeamString(team)); |
| 936 | } |
| 937 | } |
| 938 | } |
| 939 | |
| 940 | // DMFCBase::OnControlMessage |
| 941 | // |
| 942 | // |
| 943 | // There is a control message sent from someone |
| 944 | void DMFCBasecxx . . $ DMFCBase#::OnControlMessagecxx . . $ DMFCBase#OnControlMessage(d5cb1b1d97598ec6).(uint8_tcxx . . $ uint8_t# msg, int from_pnum) { |
| 945 | switch (msg) { |
| 946 | case CM_KICKEDcxx . . $ `netgames/dmfc/dmfcinternal.h:281:9`!: { |
| 947 | DLLAddHUDMessage(DTXT_KICKEDMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2428:9`!); |
| 948 | DisconnectMecxx . . $ DMFCBase#DisconnectMe(49f6e7a06ebc5aa8).(); |
| 949 | } break; |
| 950 | case CM_BANNEDcxx . . $ `netgames/dmfc/dmfcinternal.h:282:9`!: { |
| 951 | DLLAddHUDMessage(DTXT_BANNEDMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2429:9`!); |
| 952 | DisconnectMecxx . . $ DMFCBase#DisconnectMe(49f6e7a06ebc5aa8).(); |
| 953 | } break; |
| 954 | case CM_TEAMCHANGEDENIEDcxx . . $ `netgames/dmfc/dmfcinternal.h:283:9`!: { |
| 955 | // if we get this, the server is telling us that the request for a |
| 956 | // team change has been denied |
| 957 | AnnounceTeamChangeDenycxx . . $ DMFCBase#AnnounceTeamChangeDeny(d4f767463ce0a6b3).(*Player_numcxx . . $ DMFCBase#Player_num.); |
| 958 | } break; |
| 959 | case CM_SIGNALSTARTcxx . . $ `netgames/dmfc/dmfcinternal.h:284:9`!: { |
| 960 | if (from_pnum == 0) { |
| 961 | // we can move!! |
| 962 | WaitForServercxx . . $ DMFCBase#WaitForServer(b45ddcbc8423892c).(false); |
| 963 | } |
| 964 | } break; |
| 965 | case CM_SIGNALWAITcxx . . $ `netgames/dmfc/dmfcinternal.h:285:9`!: { |
| 966 | if (from_pnum == 0) { |
| 967 | // we got to wait |
| 968 | WaitForServercxx . . $ DMFCBase#WaitForServer(b45ddcbc8423892c).(true); |
| 969 | } |
| 970 | } break; |
| 971 | case CM_PAUSETIMEcxx . . $ `netgames/dmfc/dmfcinternal.h:286:9`!: { |
| 972 | ENABLE_FLAGScxx . . $ `netgames/dmfc/dmfcinternal.h:2371:9`!(m_iProtectedFlags, DMFC_PRF_PAUSETIMEcxx . . $ `netgames/dmfc/dmfcinternal.h:2391:9`!); |
| 973 | } break; |
| 974 | case CM_UNPAUSETIMEcxx . . $ `netgames/dmfc/dmfcinternal.h:287:9`!: { |
| 975 | DISABLE_FLAGScxx . . $ `netgames/dmfc/dmfcinternal.h:2372:9`!(m_iProtectedFlags, DMFC_PRF_PAUSETIMEcxx . . $ `netgames/dmfc/dmfcinternal.h:2391:9`!); |
| 976 | } break; |
| 977 | }; |
| 978 | } |
| 979 | |
| 980 | // DMFCBase::OnAllowObserverChange |
| 981 | // |
| 982 | // |
| 983 | // returns true if the requested change for observer mode should go through |
| 984 | bool DMFCBasecxx . . $ DMFCBase#::OnAllowObserverChangecxx . . $ DMFCBase#OnAllowObserverChange(efaadfb7dc14930a).(bool turnonobserver) { return true; } |
| 985 | |
| 986 | // DMFCBase::OnClientShowUI |
| 987 | // |
| 988 | // |
| 989 | // The game is saying it's ok to do any UI |
| 990 | void DMFCBasecxx . . $ DMFCBase#::OnClientShowUIcxx . . $ DMFCBase#OnClientShowUI(6ca3d68f5c5f0975).(int id, void *user_data) { |
| 991 | switch (id) { |
| 992 | case UIID_TEAMPLACEMENTcxx . . $ `netgames/dmfc/dmfcinternal.h:2784:9`!: { |
| 993 | bool clients_wait; |
| 994 | bool call_from_game; |
| 995 | uint8_tcxx . . $ uint8_t# d = *(uint8_tcxx . . $ uint8_t# *)user_data; |
| 996 | |
| 997 | clients_wait = (d & 0x01) ? true : false; |
| 998 | call_from_game = (d & 0x02) ? false : true; |
| 999 | |
| 1000 | DoDMFCUITeamPlacementcxx . . $ DMFCBase#DoDMFCUITeamPlacement(b0b38cda41d4ede4).(clients_wait, call_from_game); |
| 1001 | } break; |
| 1002 | case UIID_WAITFORPLAYERScxx . . $ `netgames/dmfc/dmfcinternal.h:2785:9`!: { |
| 1003 | DoDMFCUIWaitForPlayerscxx . . $ DMFCBase#DoDMFCUIWaitForPlayers(b45ddcbc8423892c).(true); |
| 1004 | } break; |
| 1005 | }; |
| 1006 | } |
| 1007 | |
| 1008 | // DMFCBase::OnPrintScores |
| 1009 | // |
| 1010 | // |
| 1011 | // The user is requesting that the scores be printed out (For Dedicated Server use). Use DPrintf |
| 1012 | // level: -1 Requesting all the available scores |
| 1013 | // n Print only the top n scores |
| 1014 | // Override this to how you see fit, but it should conform to the above. |
| 1015 | void DMFCBasecxx . . $ DMFCBase#::OnPrintScorescxx . . $ DMFCBase#OnPrintScores(d4f767463ce0a6b3).(int level) {} |
| 1016 | |
| 1017 | // DMFCBase::OnGetHudCallSignColor |
| 1018 | // |
| 1019 | // This is an event sent in by the game requesting what color it should draw the HUD callsign |
| 1020 | // of the passed in playernum. Using GR_RGB return the color from the function. This function |
| 1021 | // gets called every frame that the player is on the clients HUD. |
| 1022 | ddgr_colorcxx . . $ ddgr_color# DMFCBasecxx . . $ DMFCBase#::OnGetHudCallSignColorcxx . . $ DMFCBase#OnGetHudCallSignColor(46cc46841198e427).(int playernum) { |
| 1023 | if (!CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(playernum)) |
| 1024 | return GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 255); |
| 1025 | |
| 1026 | if (GetNumTeamscxx . . $ DMFCBase#GetNumTeams(b126dc7c1de90089).() <= 1) |
| 1027 | return GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(0, 255, 0); |
| 1028 | |
| 1029 | return GetTeamColorcxx . . $ DMFCBase#GetTeamColor(46cc46841198e427).(GetPlayerTeamcxx . . $ DMFCBase#GetPlayerTeam(7864480464b09eea).(playernum)); |
| 1030 | } |
| 1031 | |
| 1032 | // DMFCBase::OnTeamChangeName |
| 1033 | // |
| 1034 | // This event occurs on the client when a team's name has just changed |
| 1035 | void DMFCBasecxx . . $ DMFCBase#::OnTeamChangeNamecxx . . $ DMFCBase#OnTeamChangeName(5665db83c1ca01b7).(int team, char *oldname, char *newname) { |
| 1036 | char names[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!][MAX_TEAMNAME_LENcxx . . $ `netgames/includes/DMFC.h:443:9`!]; |
| 1037 | strcpy(names[RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!], GetTeamStringcxx . . $ DMFCBase#GetTeamString(f7ae7e56280f18ae).(RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!)); |
| 1038 | strcpy(names[BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!], GetTeamStringcxx . . $ DMFCBase#GetTeamString(f7ae7e56280f18ae).(BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!)); |
| 1039 | if (TeamMenuItemcxx . . $ DMFCBase#TeamMenuItem.) { |
| 1040 | switch (m_iNumTeamscxx . . $ DMFCBase#m_iNumTeams.) { |
| 1041 | case 2: |
| 1042 | TeamMenuItemcxx . . $ DMFCBase#TeamMenuItem.->SetStateItemListcxx . . $ MenuItem#SetStateItemList(d49b86907ad5c83b).(m_iNumTeamscxx . . $ DMFCBase#m_iNumTeams., names[RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!], names[BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!]); |
| 1043 | break; |
| 1044 | case 3: |
| 1045 | strcpy(names[GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!], GetTeamStringcxx . . $ DMFCBase#GetTeamString(f7ae7e56280f18ae).(GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!)); |
| 1046 | TeamMenuItemcxx . . $ DMFCBase#TeamMenuItem.->SetStateItemListcxx . . $ MenuItem#SetStateItemList(d49b86907ad5c83b).(m_iNumTeamscxx . . $ DMFCBase#m_iNumTeams., names[RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!], names[BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!], names[GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!]); |
| 1047 | break; |
| 1048 | case 4: |
| 1049 | strcpy(names[GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!], GetTeamStringcxx . . $ DMFCBase#GetTeamString(f7ae7e56280f18ae).(GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!)); |
| 1050 | strcpy(names[YELLOW_TEAMcxx . . $ `netgames/includes/DMFC.h:430:9`!], GetTeamStringcxx . . $ DMFCBase#GetTeamString(f7ae7e56280f18ae).(YELLOW_TEAMcxx . . $ `netgames/includes/DMFC.h:430:9`!)); |
| 1051 | TeamMenuItemcxx . . $ DMFCBase#TeamMenuItem.->SetStateItemListcxx . . $ MenuItem#SetStateItemList(d49b86907ad5c83b).(m_iNumTeamscxx . . $ DMFCBase#m_iNumTeams., names[RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!], names[BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!], names[GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!], |
| 1052 | names[YELLOW_TEAMcxx . . $ `netgames/includes/DMFC.h:430:9`!]); |
| 1053 | break; |
| 1054 | } |
| 1055 | } |
| 1056 | } |
| 1057 | |
| 1058 | // DMFCBase::OnDoControls |
| 1059 | // |
| 1060 | // This event occurs when there is a new back of game controls data |
| 1061 | void DMFCBasecxx . . $ DMFCBase#::OnDoControlscxx . . $ DMFCBase#OnDoControls(728771fc1cd83448).(game_controlscxx . . $ game_controls# *controls) { |
| 1062 | memcpy(&Last_game_controlscxx . . $ DMFCBase#Last_game_controls., controls, sizeof(Last_game_controlscxx . . $ DMFCBase#Last_game_controls.)); |
| 1063 | } |
| 1064 | |
| 1065 | // DMFCBase::OnClientWallCollide |
| 1066 | // |
| 1067 | // Called by the game when their is a collision between an object and a wall |
| 1068 | void DMFCBasecxx . . $ DMFCBase#::OnClientWallCollidecxx . . $ DMFCBase#OnClientWallCollide(cd5bbf25e955f730).(objectcxx . . $ object# *obj, float hitspeed, int hitseg, int hitwall, vectorcxx . . $ vector# *hitpt, |
| 1069 | vectorcxx . . $ vector# *wall_normal, float hit_dot) {} |
| 1070 | |
| 1071 | // DMFCBase::OnClientObjectKilled |
| 1072 | // |
| 1073 | // Called when an object is being killed |
| 1074 | // Not automatically sent to clients (OnClientObjectKilled) |
| 1075 | // killer might not be valid (NULL) |
| 1076 | void DMFCBasecxx . . $ DMFCBase#::OnClientObjectKilledcxx . . $ DMFCBase#OnClientObjectKilled(6273fa812ac58a8).(objectcxx . . $ object# *obj, objectcxx . . $ object# *killer) {} |
| 1077 | |
| 1078 | // DMFCBase::OnClientObjectDestroyed |
| 1079 | // |
| 1080 | // Called when an object is about to be deleted |
| 1081 | // Not automatically sent to clients |
| 1082 | void DMFCBasecxx . . $ DMFCBase#::OnClientObjectDestroyedcxx . . $ DMFCBase#OnClientObjectDestroyed(419c470199a90a97).(objectcxx . . $ object# *obj) {} |
| 1083 | |
| 1084 | // DMFCBase::OnPlayAudioTaunt |
| 1085 | // |
| 1086 | // This event occurs when a player plays an audio taunt |
| 1087 | void DMFCBasecxx . . $ DMFCBase#::OnPlayAudioTauntcxx . . $ DMFCBase#OnPlayAudioTaunt(d4f767463ce0a6b3).(int pnum) { |
| 1088 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "%s plays an audio taunt\n", Players[pnum].callsign); |
| 1089 | SetPlayerTauntIndicatorcxx . . $ DMFCBase#SetPlayerTauntIndicator(d4f767463ce0a6b3).(pnum); |
| 1090 | } |
| 1091 | |
| 1092 | // DMFCBase::OnGetTokenString |
| 1093 | // |
| 1094 | // This event occurs when a text macro is being used that has tokens |
| 1095 | // in it, if you have a specific token, override this event to handle it. |
| 1096 | void DMFCBasecxx . . $ DMFCBase#::OnGetTokenStringcxx . . $ DMFCBase#OnGetTokenString(655c4eff246c5519).(char *src, char *dest, int dest_size) { |
| 1097 | *dest = '\0'; |
| 1098 | |
| 1099 | if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(src, "e")) { |
| 1100 | // energy |
| 1101 | char buffer[64]; |
| 1102 | int mypnum = GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).(); |
| 1103 | snprintf(buffer, sizeof(buffer), "%.0f", Playerscxx . . $ DMFCBase#Players.[mypnum].energycxx . . $ player#energy.); |
| 1104 | strncpy(dest, buffer, dest_size - 1); |
| 1105 | dest[dest_size - 1] = '\0'; |
| 1106 | return; |
| 1107 | } |
| 1108 | |
| 1109 | if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(src, "s")) { |
| 1110 | // shields |
| 1111 | char buffer[64]; |
| 1112 | int mypnum = GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).(); |
| 1113 | snprintf(buffer, sizeof(buffer), "%.0f", Objectscxx . . $ DMFCBase#Objects.[Playerscxx . . $ DMFCBase#Players.[mypnum].objnumcxx . . $ player#objnum.].shieldscxx . . $ object#shields.); |
| 1114 | strncpy(dest, buffer, dest_size - 1); |
| 1115 | dest[dest_size - 1] = '\0'; |
| 1116 | return; |
| 1117 | } |
| 1118 | } |