| 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/ctf/ctf.cpp $ |
| 21 | * $Revision: 1.1.1.1 $ |
| 22 | * $Date: 2003/08/26 03:56:47 $ |
| 23 | * $Author: kevinb $ |
| 24 | * |
| 25 | * <insert description of file here> |
| 26 | * |
| 27 | * $Log: ctf.cpp,v $ |
| 28 | * Revision 1.1.1.1 2003/08/26 03:56:47 kevinb |
| 29 | * initial 1.5 import |
| 30 | * |
| 31 | * |
| 32 | * 140 10/03/01 1:05p Matt |
| 33 | * Made team_name buffer large enough to hold the team number *plus* the |
| 34 | * number of players on the team. |
| 35 | * |
| 36 | * 139 9/24/01 2:28p Matt |
| 37 | * Allowed room for longer team name on results screen. |
| 38 | * |
| 39 | * 138 9/20/01 12:58p Matt |
| 40 | * Added a team member list to the stats file. |
| 41 | * |
| 42 | * 137 10/21/99 9:27p Jeff |
| 43 | * B.A. Macintosh code merge |
| 44 | * |
| 45 | * 136 9/03/99 5:30p Jeff |
| 46 | * use the flag's roomnumber instead of the player's roomnum when checking |
| 47 | * for a score (in case of a really thin room that the flag is in) |
| 48 | * |
| 49 | * 135 8/17/99 5:53p Jeff |
| 50 | * track ranks on PXO |
| 51 | * |
| 52 | * 134 7/15/99 1:17a Jeff |
| 53 | * fixed up $scores |
| 54 | * |
| 55 | * 133 7/13/99 12:10p Jeff |
| 56 | * added some specific text taunt token decoding |
| 57 | * |
| 58 | * 132 7/12/99 2:27p Jeff |
| 59 | * fixed PLR to only display the team label for the disconnected list if |
| 60 | * there are people in the list |
| 61 | * |
| 62 | * 131 7/11/99 6:54p Jeff |
| 63 | * fixed PLR so it doesn't go off the screen on long lists and active |
| 64 | * players in the game are shown first |
| 65 | * |
| 66 | * 130 6/10/99 5:21p Jeff |
| 67 | * fixed crash in french version, due to local array being to small |
| 68 | * |
| 69 | * 129 5/26/99 4:38a Jeff |
| 70 | * fixed ctf bad scoring bugs |
| 71 | * |
| 72 | * 128 5/23/99 3:04a Jason |
| 73 | * fixed bug with player rankings not being updated correctly |
| 74 | * |
| 75 | * 127 5/20/99 7:54p 3dsmax |
| 76 | * changed number of attach points |
| 77 | * |
| 78 | * 126 5/12/99 11:04p Jeff |
| 79 | * dmfc and multiplayer games now have endian friendly packets (*whew*) |
| 80 | * |
| 81 | * 125 5/12/99 11:28a Jeff |
| 82 | * added sourcesafe comment block |
| 83 | * |
| 84 | * $NoKeywords: $ |
| 85 | */ |
| 86 | |
| 87 | #include "gamedll_header.h"cxx . . $ `<file>/netgames/includes/gamedll_header.h`/ |
| 88 | #include <string.h> |
| 89 | |
| 90 | #include "idmfc.h"cxx . . $ `<file>/netgames/includes/idmfc.h`/ |
| 91 | #include "ctf.h"cxx . . $ `<file>/netgames/ctf/ctf.h`/ |
| 92 | #include "CTFstr.h"cxx . . $ `<file>/netgames/ctf/CTFstr.h`/ |
| 93 | |
| 94 | IDMFCcxx . . $ IDMFC# *DMFCBasecxx . . $ DMFCBase.; |
| 95 | static IDmfcStatscxx . . $ IDmfcStats# *dstatcxx . . $ dstat.; |
| 96 | |
| 97 | static objectcxx . . $ object# *dObjectscxx . . $ dObjects.; |
| 98 | static playercxx . . $ player# *dPlayerscxx . . $ dPlayers.; |
| 99 | static roomcxx . . $ room# *dRoomscxx . . $ dRooms.; |
| 100 | static netplayercxx . . $ netplayer# *dNetPlayerscxx . . $ dNetPlayers.; |
| 101 | |
| 102 | #define SPID_GAMESTATEcxx . . $ `netgames/ctf/ctf.cpp:102:9`! 0x01 |
| 103 | #define SPID_ADDDELFLAGcxx . . $ `netgames/ctf/ctf.cpp:103:9`! 0x02 |
| 104 | #define SPID_COLLIDEcxx . . $ `netgames/ctf/ctf.cpp:104:9`! 0x03 |
| 105 | |
| 106 | // Inventory flags |
| 107 | #define FLAGMASK_REDTEAMcxx . . $ `netgames/ctf/ctf.cpp:107:9`! 0x01 |
| 108 | #define FLAGMASK_BLUETEAMcxx . . $ `netgames/ctf/ctf.cpp:108:9`! 0x02 |
| 109 | #define FLAGMASK_GREENTEAMcxx . . $ `netgames/ctf/ctf.cpp:109:9`! 0x04 |
| 110 | #define FLAGMASK_YELLOWTEAMcxx . . $ `netgames/ctf/ctf.cpp:110:9`! 0x08 |
| 111 | |
| 112 | // athome masks |
| 113 | #define REDAHcxx . . $ `netgames/ctf/ctf.cpp:113:9`! 0x001 |
| 114 | #define BLUEAHcxx . . $ `netgames/ctf/ctf.cpp:114:9`! 0x002 |
| 115 | #define GREENAHcxx . . $ `netgames/ctf/ctf.cpp:115:9`! 0x004 |
| 116 | #define YELLOWAHcxx . . $ `netgames/ctf/ctf.cpp:116:9`! 0x008 |
| 117 | |
| 118 | #define FLAG_TIMEOUT_VALUEcxx . . $ `netgames/ctf/ctf.cpp:118:9`! 120 |
| 119 | // Sound name defines |
| 120 | #define SOUND_PICKUPFLAG_OWNTEAMcxx . . $ `netgames/ctf/ctf.cpp:120:9`! "CTFPickupFlag1" |
| 121 | #define SOUND_PICKUPFLAG_OTHERTEAMcxx . . $ `netgames/ctf/ctf.cpp:121:9`! "CTFPickupFlag1" |
| 122 | #define SOUND_SCORE_OWNTEAMcxx . . $ `netgames/ctf/ctf.cpp:122:9`! "CTFScore1" |
| 123 | #define SOUND_SCORE_OTHERTEAMcxx . . $ `netgames/ctf/ctf.cpp:123:9`! "CTFScore1" |
| 124 | #define SOUND_LOSEFLAG_OWNTEAMcxx . . $ `netgames/ctf/ctf.cpp:124:9`! "CTFLostFlag1" |
| 125 | #define SOUND_LOSEFLAG_OTHERTEAMcxx . . $ `netgames/ctf/ctf.cpp:125:9`! "CTFLostFlag1" |
| 126 | #define SOUND_FLAGRETURNED_OWNTEAMcxx . . $ `netgames/ctf/ctf.cpp:126:9`! "CTFReturnedFlag1" |
| 127 | #define SOUND_FLAGRETURNED_OTHERTEAMcxx . . $ `netgames/ctf/ctf.cpp:127:9`! "CTFReturnedFlag1" |
| 128 | #define SOUND_HATTRICK_FIRSTcxx . . $ `netgames/ctf/ctf.cpp:128:9`! "CTFHatTrick" |
| 129 | #define SOUND_HATTRICK_REGULARcxx . . $ `netgames/ctf/ctf.cpp:129:9`! "CTFHatTrick" |
| 130 | /* |
| 131 | $$TABLE_SOUND "CTFPickupFlag1" |
| 132 | $$TABLE_SOUND "CTFPickupFlag1" |
| 133 | $$TABLE_SOUND "CTFScore1" |
| 134 | $$TABLE_SOUND "CTFScore1" |
| 135 | $$TABLE_SOUND "CTFLostFlag1" |
| 136 | $$TABLE_SOUND "CTFLostFlag1" |
| 137 | $$TABLE_SOUND "CTFReturnedFlag1" |
| 138 | $$TABLE_SOUND "CTFReturnedFlag1" |
| 139 | $$TABLE_SOUND "CTFHatTrick" |
| 140 | $$TABLE_SOUND "CTFHatTrick" |
| 141 | */ |
| 142 | static int snd_return_ownteamcxx . . $ snd_return_ownteam. = -1; |
| 143 | static int snd_return_otherteamcxx . . $ snd_return_otherteam. = -1; |
| 144 | static int snd_pickedup_otherteamcxx . . $ snd_pickedup_otherteam. = -1; |
| 145 | static int snd_pickedup_ownteamcxx . . $ snd_pickedup_ownteam. = -1; |
| 146 | static int snd_score_ownteamcxx . . $ snd_score_ownteam. = -1; |
| 147 | static int snd_score_otherteamcxx . . $ snd_score_otherteam. = -1; |
| 148 | static int snd_lose_ownteamcxx . . $ snd_lose_ownteam. = -1; |
| 149 | static int snd_lose_otherteamcxx . . $ snd_lose_otherteam. = -1; |
| 150 | static int snd_hattrick_firstcxx . . $ snd_hattrick_first. = -1; |
| 151 | static int snd_hattrick_regcxx . . $ snd_hattrick_reg. = -1; |
| 152 | |
| 153 | struct tPlayerStatcxx . . $ tPlayerStat# { // Overall scores (throughout the game) |
| 154 | int Scorecxx . . $ tPlayerStat#Score.[2]; |
| 155 | }; |
| 156 | static int pack_pstatcxx . . $ pack_pstat(60b9885aab282f36).(tPlayerStatcxx . . $ tPlayerStat# *user_info, uint8_tcxx . . $ uint8_t# *data); |
| 157 | static int unpack_pstatcxx . . $ unpack_pstat(60b9885aab282f36).(tPlayerStatcxx . . $ tPlayerStat# *user_info, uint8_tcxx . . $ uint8_t# *data); |
| 158 | int pack_pstatcxx . . $ pack_pstat(60b9885aab282f36).(tPlayerStatcxx . . $ tPlayerStat# *user_info, uint8_tcxx . . $ uint8_t# *data) { |
| 159 | int count = 0; |
| 160 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(user_info->Scorecxx . . $ tPlayerStat#Score.[0], data, &count); |
| 161 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(user_info->Scorecxx . . $ tPlayerStat#Score.[1], data, &count); |
| 162 | return count; |
| 163 | } |
| 164 | |
| 165 | int unpack_pstatcxx . . $ unpack_pstat(60b9885aab282f36).(tPlayerStatcxx . . $ tPlayerStat# *user_info, uint8_tcxx . . $ uint8_t# *data) { |
| 166 | int count = 0; |
| 167 | user_info->Scorecxx . . $ tPlayerStat#Score.[0] = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count); |
| 168 | user_info->Scorecxx . . $ tPlayerStat#Score.[1] = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count); |
| 169 | return count; |
| 170 | } |
| 171 | |
| 172 | static int SortedPlayerscxx . . $ SortedPlayers.[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!]; // sorted player nums |
| 173 | static int SortedPLRPlayerscxx . . $ SortedPLRPlayers.[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!][MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!]; |
| 174 | |
| 175 | static int TeamScorescxx . . $ TeamScores.[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!]; // teams scores |
| 176 | static int OverallTeamScorescxx . . $ OverallTeamScores.[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!]; // overall scores per team |
| 177 | static int SortedTeamscxx . . $ SortedTeams.[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!]; // sorted team scores |
| 178 | static int Highlight_bmpcxx . . $ Highlight_bmp. = -1; |
| 179 | static bool DisplayScoreScreencxx . . $ DisplayScoreScreen.; |
| 180 | static bool Someone_has_hattrickcxx . . $ Someone_has_hattrick. = false; // this is false if no one has had a hattrick this level |
| 181 | static bool First_game_framecxx . . $ First_game_frame. = false; |
| 182 | |
| 183 | static int FlagIDscxx . . $ FlagIDs.[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!]; // Flag Object ID's |
| 184 | static int AFlagIDscxx . . $ AFlagIDs.[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!]; // Attached Flag Object ID's |
| 185 | static int GoalRoomscxx . . $ GoalRooms.[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!]; // Goal Rooms for Teams |
| 186 | static int FlagBmpcxx . . $ FlagBmp.[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!]; // Flag Bitmap handles |
| 187 | static int FlagAHBmpcxx . . $ FlagAHBmp.[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!]; // Flag At Home Bitmap handles |
| 188 | static int DimFlagAHBmpcxx . . $ DimFlagAHBmp.[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!]; // Dimmed versions of the Flag At Home Bitmaps |
| 189 | static bool FlagAtHomecxx . . $ FlagAtHome.[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!]; // Flag At Home bools |
| 190 | static int HasFlagcxx . . $ HasFlag.[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!]; // List of Playernums of who has what flag, -1 if no one does |
| 191 | static bool DisplayFlagBlinkcxx . . $ DisplayFlagBlink. = true, DisplayScoreBlinkcxx . . $ DisplayScoreBlink. = true; |
| 192 | static int WhoJustFlaggedcxx . . $ WhoJustFlagged. = -1, WhoJustFlaggedTimercxx . . $ WhoJustFlaggedTimer. = -1; |
| 193 | static int WhoJustScoredcxx . . $ WhoJustScored. = -1, WhoJustScoredTimercxx . . $ WhoJustScoredTimer. = -1; |
| 194 | static int CTFNumOfTeamscxx . . $ CTFNumOfTeams. = 2; |
| 195 | static int ChildFlagscxx . . $ ChildFlags.[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!]; // Object handles of attached flags as a player has em |
| 196 | |
| 197 | static float Flag_timeout_timerscxx . . $ Flag_timeout_timers.[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!]; |
| 198 | static bool display_my_welcomecxx . . $ display_my_welcome. = false; |
| 199 | |
| 200 | static void OnTimerScoreKillcxx . . $ OnTimerScoreKill(49f6e7a06ebc5aa8).(void); // timer callback: when a score flash timer ends |
| 201 | static void OnTimerScorecxx . . $ OnTimerScore(49f6e7a06ebc5aa8).(void); // timer callback: on a score flash interval |
| 202 | static void OnTimercxx . . $ OnTimer(49f6e7a06ebc5aa8).(void); // timer callback: when a flag taken flash timer ends |
| 203 | static void OnTimerKillcxx . . $ OnTimerKill(49f6e7a06ebc5aa8).(void); // timer callback: on a flag taken flash interval |
| 204 | static void DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(int player_num); // displays a welcome message to the player when he joins |
| 205 | static void SortTeamScorescxx . . $ SortTeamScores(ce8f7825f8908cfa).(int *sortedindex, int *scores); // sorts an array of team scores, filling in the sorted index |
| 206 | // numbers |
| 207 | static void DisplayHUDScorescxx . . $ DisplayHUDScores(c7a20e4e05358911).(struct tHUDItemcxx . . $ tHUDItem# *hitem); // callback when the HUD info is to be drawn |
| 208 | static void ReceiveGameStatecxx . . $ ReceiveGameState(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data); // callback when a gamestate packet is received from the server |
| 209 | static void SendGameStatecxx . . $ SendGameState(d4f767463ce0a6b3).(int playernum); // called when the server is to send gamestate packet to a client |
| 210 | static void SetColoredBallscxx . . $ SetColoredBalls(918ebd27a9ddbad3).( |
| 211 | int playernum, |
| 212 | bool reset = false); // sets the colored balls around a player (determined by what is in their inventory) |
| 213 | static void ChangeNumberOfTeamscxx . . $ ChangeNumberOfTeams(d4f767463ce0a6b3).(int newsize); // called when the number of teams in the game is changed or to be changed |
| 214 | static void DoFlagReturnedHomecxx . . $ DoFlagReturnedHome(d4f767463ce0a6b3).(int team); // called to handle any events when a flag is returned home for a team |
| 215 | static void DoLoseFlagcxx . . $ DoLoseFlag(d4f767463ce0a6b3).(int team); // called to handle any events when a team loses their flag |
| 216 | static void TellClientsToAddorDelFlagcxx . . $ TellClientsToAddorDelFlag(cb82e25e9f99304e).(int pnum, int team, int objnum, bool add); |
| 217 | static void ServerIsTellingMeToAddorDelAFlagcxx . . $ ServerIsTellingMeToAddorDelAFlag(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data); |
| 218 | static void OnGetTokenStringcxx . . $ OnGetTokenString(655c4eff246c5519).(char *src, char *dest, int dest_size); |
| 219 | // returns the number of flags a player has, 0 if none, or an invalid pnum |
| 220 | static int GetFlagCountForPlayercxx . . $ GetFlagCountForPlayer(7864480464b09eea).(int pnum); |
| 221 | // returns the mask of which flags this player currently has |
| 222 | static uint8_tcxx . . $ uint8_t# GetFlagMaskForPlayercxx . . $ GetFlagMaskForPlayer(bc0fba5608a0bfe7).(int pnum); |
| 223 | // adds a flag to a player, as a precaution, it will go through all the players and makes sure that no one |
| 224 | // has the flag that is being added. If they are adding the flag, than remove that flag from whoever we thought |
| 225 | // had it it will return false if it had to remove a flag from a player |
| 226 | static bool GivePlayerFlagcxx . . $ GivePlayerFlag(7b9b7da826ebfeee).(int pnum, uint8_tcxx . . $ uint8_t# team); |
| 227 | // this function takes a flag away from the player, useful for when he scores, spews, disconnects, or observer modes |
| 228 | static void LoseFlagForPlayercxx . . $ LoseFlagForPlayer(7170367bda245568).(int pnum, uint8_tcxx . . $ uint8_t# team, bool remove_from_inven = true); |
| 229 | |
| 230 | /////////////////////////////////////////////// |
| 231 | // localization info/functions |
| 232 | static char **StringTablecxx . . $ StringTable.; |
| 233 | static int StringTableSizecxx . . $ StringTableSize. = 0; |
| 234 | static const char *_ErrorStringcxx . . $ _ErrorString. = "Missing String"; |
| 235 | const char *GetStringcxx . . $ GetString(f7ae7e56280f18ae).(int d) { |
| 236 | if ((d < 0) || (d >= StringTableSizecxx . . $ StringTableSize.)) |
| 237 | return _ErrorStringcxx . . $ _ErrorString.; |
| 238 | else |
| 239 | return StringTablecxx . . $ StringTable.[d]; |
| 240 | } |
| 241 | static void SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(char *filename); |
| 242 | static void DetermineScorecxx . . $ DetermineScore(74c02bb7c84e7fae).(int precord_num, int column_num, char *buffer, int buffer_size); |
| 243 | static void ShowStatBitmapcxx . . $ ShowStatBitmap(dac02d3a3b31dff4).(int precord_num, int column_num, int x, int y, int w, int h, uint8_tcxx . . $ uint8_t# alpha_to_use); |
| 244 | |
| 245 | // This function gets called by the game when it wants to learn some info about the game |
| 246 | void DLLFUNCCALLcxx . . $ `lib/module.h:93:10`! DLLGetGameInfocxx . . $ DLLGetGameInfo(e5c6dce1fbda187a).(tDLLOptionscxx . . $ tDLLOptions# *options) { |
| 247 | options->flagscxx . . $ tDLLOptions#flags. = DOF_MAXTEAMScxx . . $ `netgames/includes/gamedll_header.h:105:9`! | DOF_MINTEAMScxx . . $ `netgames/includes/gamedll_header.h:106:9`!; |
| 248 | options->max_teamscxx . . $ tDLLOptions#max_teams. = 4; |
| 249 | options->min_teamscxx . . $ tDLLOptions#min_teams. = 2; |
| 250 | strcpy(options->game_namecxx . . $ tDLLOptions#game_name., TXT_CTFcxx . . $ `netgames/ctf/CTFstr.h:53:9`!); |
| 251 | strcpy(options->requirementscxx . . $ tDLLOptions#requirements., "MINGOALS2,GOALPERTEAM"); |
| 252 | } |
| 253 | |
| 254 | void DetermineScorecxx . . $ DetermineScore(74c02bb7c84e7fae).(int precord_num, int column_num, char *buffer, int buffer_size) { |
| 255 | player_recordcxx . . $ player_record# *pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(precord_num); |
| 256 | if (!pr || pr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.) { |
| 257 | buffer[0] = '\0'; |
| 258 | return; |
| 259 | } |
| 260 | |
| 261 | tPlayerStatcxx . . $ tPlayerStat# *stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.; |
| 262 | snprintf(buffer, buffer_size, "%d", (stat) ? stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0); |
| 263 | } |
| 264 | |
| 265 | void TeamScoreCallbackcxx . . $ TeamScoreCallback(99469d7ff9a1485a).(int team, char *buffer, int buffer_size) { |
| 266 | ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(team >= 0 && team < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!); |
| 267 | |
| 268 | snprintf(buffer, buffer_size, " %d", TeamScorescxx . . $ TeamScores.[team]); |
| 269 | } |
| 270 | |
| 271 | void ShowStatBitmapcxx . . $ ShowStatBitmap(dac02d3a3b31dff4).(int precord_num, int column_num, int x, int y, int w, int h, uint8_tcxx . . $ uint8_t# alpha_to_use) { |
| 272 | player_recordcxx . . $ player_record# *pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(precord_num); |
| 273 | int flagcount, flagmask; |
| 274 | |
| 275 | if (pr && pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) { |
| 276 | |
| 277 | flagcount = GetFlagCountForPlayercxx . . $ GetFlagCountForPlayer(7864480464b09eea).(pr->pnumcxx . . $ player_record#pnum.); |
| 278 | |
| 279 | if (!flagcount) |
| 280 | return; |
| 281 | |
| 282 | flagmask = GetFlagMaskForPlayercxx . . $ GetFlagMaskForPlayer(bc0fba5608a0bfe7).(pr->pnumcxx . . $ player_record#pnum.); |
| 283 | |
| 284 | // Display the flags that this player has |
| 285 | x = x + w - (11 * flagcount); |
| 286 | for (int q = 0; q < CTFNumOfTeamscxx . . $ CTFNumOfTeams.; q++) { |
| 287 | // draw all the flags the player has in his inventory |
| 288 | if (flagmask & 0x01) { |
| 289 | // player has this flag |
| 290 | DLLRenderHUDQuad(x, y, 10, 10, 0, 0, 1, 1, FlagBmpcxx . . $ FlagBmp.[q], alpha_to_use, 0); |
| 291 | x += 11; |
| 292 | } |
| 293 | |
| 294 | // rotate 1 bit for next flag |
| 295 | flagmask = flagmask >> 1; |
| 296 | } |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | /////////////////////////////////////////////// |
| 301 | // Initializes the game function pointers |
| 302 | void DLLFUNCCALLcxx . . $ `lib/module.h:93:10`! DLLGameInitcxx . . $ DLLGameInit(937c1f75cb8fa6b1).(int *api_func, uint8_tcxx . . $ uint8_t# *all_ok, int num_teams_to_use) { |
| 303 | *all_ok = 1; |
| 304 | DMFCBasecxx . . $ DMFCBase. = CreateDMFC(); |
| 305 | if (!DMFCBasecxx . . $ DMFCBase.) { |
| 306 | *all_ok = 0; |
| 307 | return; |
| 308 | } |
| 309 | |
| 310 | dstatcxx . . $ dstat. = CreateDmfcStats(); |
| 311 | if (!dstatcxx . . $ dstat.) { |
| 312 | *all_ok = 0; |
| 313 | return; |
| 314 | } |
| 315 | |
| 316 | DMFCBasecxx . . $ DMFCBase.->LoadFunctionscxx . . $ IDMFC#LoadFunctions(11b0e290e57a7e53).(api_func); |
| 317 | |
| 318 | // Setup event handlers |
| 319 | DMFCBasecxx . . $ DMFCBase.->Set_OnIntervalcxx . . $ IDMFC#Set_OnInterval(964b12a25712bdc3).(OnIntervalcxx . . $ OnInterval(49f6e7a06ebc5aa8).); |
| 320 | DMFCBasecxx . . $ DMFCBase.->Set_OnHUDIntervalcxx . . $ IDMFC#Set_OnHUDInterval(964b12a25712bdc3).(OnHUDIntervalcxx . . $ OnHUDInterval(49f6e7a06ebc5aa8).); |
| 321 | DMFCBasecxx . . $ DMFCBase.->Set_OnKeypresscxx . . $ IDMFC#Set_OnKeypress(94eb4457dc8d4d10).(OnKeypresscxx . . $ OnKeypress(d4f767463ce0a6b3).); |
| 322 | DMFCBasecxx . . $ DMFCBase.->Set_OnServerGameCreatedcxx . . $ IDMFC#Set_OnServerGameCreated(964b12a25712bdc3).(OnServerGameCreatedcxx . . $ OnServerGameCreated(49f6e7a06ebc5aa8).); |
| 323 | DMFCBasecxx . . $ DMFCBase.->Set_OnClientLevelStartcxx . . $ IDMFC#Set_OnClientLevelStart(964b12a25712bdc3).(OnClientLevelStartcxx . . $ OnClientLevelStart(49f6e7a06ebc5aa8).); |
| 324 | DMFCBasecxx . . $ DMFCBase.->Set_OnClientLevelEndcxx . . $ IDMFC#Set_OnClientLevelEnd(964b12a25712bdc3).(OnClientLevelEndcxx . . $ OnClientLevelEnd(49f6e7a06ebc5aa8).); |
| 325 | DMFCBasecxx . . $ DMFCBase.->Set_OnGameStateRequestcxx . . $ IDMFC#Set_OnGameStateRequest(94eb4457dc8d4d10).(OnGameStateRequestcxx . . $ OnGameStateRequest(d4f767463ce0a6b3).); |
| 326 | DMFCBasecxx . . $ DMFCBase.->Set_OnPlayerConnectcxx . . $ IDMFC#Set_OnPlayerConnect(94eb4457dc8d4d10).(OnPlayerConnectcxx . . $ OnPlayerConnect(d4f767463ce0a6b3).); |
| 327 | DMFCBasecxx . . $ DMFCBase.->Set_OnClientPlayerKilledcxx . . $ IDMFC#Set_OnClientPlayerKilled(7da43329b4117518).(OnClientPlayerKilledcxx . . $ OnClientPlayerKilled(766a1b7183ffa4b4).); |
| 328 | DMFCBasecxx . . $ DMFCBase.->Set_OnServerCollidecxx . . $ IDMFC#Set_OnServerCollide(74ea2c9f51d3637e).(OnServerCollidecxx . . $ OnServerCollide(6273fa812ac58a8).); |
| 329 | // DMFCBase->Set_OnClientCollide(OnClientCollide); |
| 330 | DMFCBasecxx . . $ DMFCBase.->Set_OnPLRIntervalcxx . . $ IDMFC#Set_OnPLRInterval(964b12a25712bdc3).(OnPLRIntervalcxx . . $ OnPLRInterval(49f6e7a06ebc5aa8).); |
| 331 | DMFCBasecxx . . $ DMFCBase.->Set_OnPLRInitcxx . . $ IDMFC#Set_OnPLRInit(964b12a25712bdc3).(OnPLRInitcxx . . $ OnPLRInit(49f6e7a06ebc5aa8).); |
| 332 | DMFCBasecxx . . $ DMFCBase.->Set_OnCanChangeTeamcxx . . $ IDMFC#Set_OnCanChangeTeam(6e1a2bea835f83b9).(OnCanChangeTeamcxx . . $ OnCanChangeTeam(cf9ef193275fa6d8).); |
| 333 | DMFCBasecxx . . $ DMFCBase.->Set_OnSaveStatsToFilecxx . . $ IDMFC#Set_OnSaveStatsToFile(964b12a25712bdc3).(OnSaveStatsToFilecxx . . $ OnSaveStatsToFile(49f6e7a06ebc5aa8).); |
| 334 | DMFCBasecxx . . $ DMFCBase.->Set_OnLevelEndSaveStatsToFilecxx . . $ IDMFC#Set_OnLevelEndSaveStatsToFile(964b12a25712bdc3).(OnLevelEndSaveStatsToFilecxx . . $ OnLevelEndSaveStatsToFile(49f6e7a06ebc5aa8).); |
| 335 | DMFCBasecxx . . $ DMFCBase.->Set_OnDisconnectSaveStatsToFilecxx . . $ IDMFC#Set_OnDisconnectSaveStatsToFile(964b12a25712bdc3).(OnDisconnectSaveStatsToFilecxx . . $ OnDisconnectSaveStatsToFile(49f6e7a06ebc5aa8).); |
| 336 | DMFCBasecxx . . $ DMFCBase.->Set_OnPrintScorescxx . . $ IDMFC#Set_OnPrintScores(94eb4457dc8d4d10).(OnPrintScorescxx . . $ OnPrintScores(d4f767463ce0a6b3).); |
| 337 | DMFCBasecxx . . $ DMFCBase.->Set_OnPlayerEntersObservercxx . . $ IDMFC#Set_OnPlayerEntersObserver(44e0dd9f073bbf0e).(OnPlayerEntersObservercxx . . $ OnPlayerEntersObserver(14473714f2cc5bd2).); |
| 338 | DMFCBasecxx . . $ DMFCBase.->Set_OnClientPlayerDisconnectcxx . . $ IDMFC#Set_OnClientPlayerDisconnect(94eb4457dc8d4d10).(OnClientPlayerDisconnectcxx . . $ OnClientPlayerDisconnect(d4f767463ce0a6b3).); |
| 339 | DMFCBasecxx . . $ DMFCBase.->Set_OnPlayerChangeTeamcxx . . $ IDMFC#Set_OnPlayerChangeTeam(de68047fd69e86f6).(OnPlayerChangeTeamcxx . . $ OnPlayerChangeTeam(23bb497e4fbd6c85).); |
| 340 | DMFCBasecxx . . $ DMFCBase.->Set_OnGetTokenStringcxx . . $ IDMFC#Set_OnGetTokenString(723abb0b76eae20f).(OnGetTokenStringcxx . . $ OnGetTokenString(655c4eff246c5519).); |
| 341 | |
| 342 | // Setup arrays for easier to read code |
| 343 | dObjectscxx . . $ dObjects. = DMFCBasecxx . . $ DMFCBase.->GetObjectscxx . . $ IDMFC#GetObjects(26f25deff401d7e4).(); |
| 344 | dPlayerscxx . . $ dPlayers. = DMFCBasecxx . . $ DMFCBase.->GetPlayerscxx . . $ IDMFC#GetPlayers(51ff8e716a252304).(); |
| 345 | dRoomscxx . . $ dRooms. = DMFCBasecxx . . $ DMFCBase.->GetRoomscxx . . $ IDMFC#GetRooms(80f895f1fc5a89de).(); |
| 346 | dNetPlayerscxx . . $ dNetPlayers. = DMFCBasecxx . . $ DMFCBase.->GetNetPlayerscxx . . $ IDMFC#GetNetPlayers(d09959b2d64446dd).(); |
| 347 | |
| 348 | netgame_infocxx . . $ netgame_info# *Netgame = DMFCBasecxx . . $ DMFCBase.->GetNetgameInfocxx . . $ IDMFC#GetNetgameInfo(242e78cd5130aa12).(); |
| 349 | Netgame->flagscxx . . $ netgame_info#flags. |= (NF_TRACK_RANKcxx . . $ `Descent3/multi_external.h:243:9`!); |
| 350 | |
| 351 | CTFNumOfTeamscxx . . $ CTFNumOfTeams. = num_teams_to_use; |
| 352 | |
| 353 | DMFCBasecxx . . $ DMFCBase.->GameInitcxx . . $ IDMFC#GameInit(d4f767463ce0a6b3).(CTFNumOfTeamscxx . . $ CTFNumOfTeams.); |
| 354 | DLLCreateStringTable("CTF.str", &StringTablecxx . . $ StringTable., &StringTableSizecxx . . $ StringTableSize.); |
| 355 | DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "%d strings loaded from string table\n", StringTableSize); |
| 356 | if (!StringTableSizecxx . . $ StringTableSize.) { |
| 357 | *all_ok = 0; |
| 358 | return; |
| 359 | } |
| 360 | |
| 361 | ChangeNumberOfTeamscxx . . $ ChangeNumberOfTeams(d4f767463ce0a6b3).(CTFNumOfTeamscxx . . $ CTFNumOfTeams.); |
| 362 | |
| 363 | // add the death and suicide messages |
| 364 | DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH1cxx . . $ `netgames/ctf/CTFstr.h:24:9`!, true); |
| 365 | DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH2cxx . . $ `netgames/ctf/CTFstr.h:25:9`!, true); |
| 366 | DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH3cxx . . $ `netgames/ctf/CTFstr.h:26:9`!, false); |
| 367 | DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH4cxx . . $ `netgames/ctf/CTFstr.h:27:9`!, false); |
| 368 | DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH5cxx . . $ `netgames/ctf/CTFstr.h:28:9`!, true); |
| 369 | DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH6cxx . . $ `netgames/ctf/CTFstr.h:29:9`!, true); |
| 370 | DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH7cxx . . $ `netgames/ctf/CTFstr.h:30:9`!, false); |
| 371 | DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH8cxx . . $ `netgames/ctf/CTFstr.h:31:9`!, true); |
| 372 | DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH9cxx . . $ `netgames/ctf/CTFstr.h:32:9`!, true); |
| 373 | DMFCBasecxx . . $ DMFCBase.->AddDeathMessagecxx . . $ IDMFC#AddDeathMessage(90ef5b561fbcb8de).(TXT_DEATH10cxx . . $ `netgames/ctf/CTFstr.h:33:9`!, true); |
| 374 | |
| 375 | DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE1cxx . . $ `netgames/ctf/CTFstr.h:34:9`!); |
| 376 | DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE2cxx . . $ `netgames/ctf/CTFstr.h:35:9`!); |
| 377 | DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE3cxx . . $ `netgames/ctf/CTFstr.h:36:9`!); |
| 378 | DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE4cxx . . $ `netgames/ctf/CTFstr.h:37:9`!); |
| 379 | DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE5cxx . . $ `netgames/ctf/CTFstr.h:38:9`!); |
| 380 | DMFCBasecxx . . $ DMFCBase.->AddSuicideMessagecxx . . $ IDMFC#AddSuicideMessage(85c52e162fed56f9).(TXT_SUICIDE6cxx . . $ `netgames/ctf/CTFstr.h:39:9`!); |
| 381 | |
| 382 | // setup the Playerstats struct so DMFC can handle it automatically when a new player enters the game |
| 383 | DMFCBasecxx . . $ DMFCBase.->SetupPlayerRecordcxx . . $ IDMFC#SetupPlayerRecord(7df49e8a00e47932).(sizeof(tPlayerStatcxx . . $ tPlayerStat#), (int (*)(void *, uint8_tcxx . . $ uint8_t# *))pack_pstatcxx . . $ pack_pstat(60b9885aab282f36)., |
| 384 | (int (*)(void *, uint8_tcxx . . $ uint8_t# *))unpack_pstatcxx . . $ unpack_pstat(60b9885aab282f36).); |
| 385 | |
| 386 | DMFCBasecxx . . $ DMFCBase.->AddHUDItemCallbackcxx . . $ IDMFC#AddHUDItemCallback(97c9b33f56b4265c).(HI_TEXTcxx . . $ `netgames/includes/DMFC.h:440:9`!, DisplayHUDScorescxx . . $ DisplayHUDScores(c7a20e4e05358911).); |
| 387 | |
| 388 | DMFCBasecxx . . $ DMFCBase.->RegisterPacketReceivercxx . . $ IDMFC#RegisterPacketReceiver(6efe5766e3bef270).(SPID_GAMESTATEcxx . . $ `netgames/ctf/ctf.cpp:102:9`!, ReceiveGameStatecxx . . $ ReceiveGameState(f25546b61a629de7).); |
| 389 | DMFCBasecxx . . $ DMFCBase.->RegisterPacketReceivercxx . . $ IDMFC#RegisterPacketReceiver(6efe5766e3bef270).(SPID_ADDDELFLAGcxx . . $ `netgames/ctf/ctf.cpp:103:9`!, ServerIsTellingMeToAddorDelAFlagcxx . . $ ServerIsTellingMeToAddorDelAFlag(f25546b61a629de7).); |
| 390 | DMFCBasecxx . . $ DMFCBase.->RegisterPacketReceivercxx . . $ IDMFC#RegisterPacketReceiver(6efe5766e3bef270).(SPID_COLLIDEcxx . . $ `netgames/ctf/ctf.cpp:104:9`!, OnClientCollidecxx . . $ OnClientCollide(f25546b61a629de7).); |
| 391 | |
| 392 | // Load all the bitmaps |
| 393 | FlagBmpcxx . . $ FlagBmp.[RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!] = DLLbm_AllocLoadFileBitmap("RedFlagIcon.ogf", 0, BITMAP_FORMAT_1555cxx . . $ `lib/bitmap.h:56:9`!); |
| 394 | FlagBmpcxx . . $ FlagBmp.[BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!] = DLLbm_AllocLoadFileBitmap("BlueFlagIcon.ogf", 0, BITMAP_FORMAT_1555cxx . . $ `lib/bitmap.h:56:9`!); |
| 395 | FlagBmpcxx . . $ FlagBmp.[GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!] = DLLbm_AllocLoadFileBitmap("GreenFlagIcon.ogf", 0, BITMAP_FORMAT_1555cxx . . $ `lib/bitmap.h:56:9`!); |
| 396 | FlagBmpcxx . . $ FlagBmp.[YELLOW_TEAMcxx . . $ `netgames/includes/DMFC.h:430:9`!] = DLLbm_AllocLoadFileBitmap("YellowFlagIcon.ogf", 0, BITMAP_FORMAT_1555cxx . . $ `lib/bitmap.h:56:9`!); |
| 397 | // athome bitmaps |
| 398 | FlagAHBmpcxx . . $ FlagAHBmp.[RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!] = DLLbm_AllocLoadFileBitmap("RedFlagIcon.ogf", 0, BITMAP_FORMAT_1555cxx . . $ `lib/bitmap.h:56:9`!); |
| 399 | FlagAHBmpcxx . . $ FlagAHBmp.[BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!] = DLLbm_AllocLoadFileBitmap("BlueFlagIcon.ogf", 0, BITMAP_FORMAT_1555cxx . . $ `lib/bitmap.h:56:9`!); |
| 400 | FlagAHBmpcxx . . $ FlagAHBmp.[GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!] = DLLbm_AllocLoadFileBitmap("GreenFlagIcon.ogf", 0, BITMAP_FORMAT_1555cxx . . $ `lib/bitmap.h:56:9`!); |
| 401 | FlagAHBmpcxx . . $ FlagAHBmp.[YELLOW_TEAMcxx . . $ `netgames/includes/DMFC.h:430:9`!] = DLLbm_AllocLoadFileBitmap("YellowFlagIcon.ogf", 0, BITMAP_FORMAT_1555cxx . . $ `lib/bitmap.h:56:9`!); |
| 402 | DimFlagAHBmpcxx . . $ DimFlagAHBmp.[RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!] = DLLbm_AllocLoadFileBitmap("RedFlagIconDim.ogf", 0, BITMAP_FORMAT_1555cxx . . $ `lib/bitmap.h:56:9`!); |
| 403 | DimFlagAHBmpcxx . . $ DimFlagAHBmp.[BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!] = DLLbm_AllocLoadFileBitmap("BlueFlagIconDim.ogf", 0, BITMAP_FORMAT_1555cxx . . $ `lib/bitmap.h:56:9`!); |
| 404 | DimFlagAHBmpcxx . . $ DimFlagAHBmp.[GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!] = DLLbm_AllocLoadFileBitmap("GreenFlagIconDim.ogf", 0, BITMAP_FORMAT_1555cxx . . $ `lib/bitmap.h:56:9`!); |
| 405 | DimFlagAHBmpcxx . . $ DimFlagAHBmp.[YELLOW_TEAMcxx . . $ `netgames/includes/DMFC.h:430:9`!] = DLLbm_AllocLoadFileBitmap("YellowFlagIconDim.ogf", 0, BITMAP_FORMAT_1555cxx . . $ `lib/bitmap.h:56:9`!); |
| 406 | // fill in the IDs |
| 407 | |
| 408 | FlagIDscxx . . $ FlagIDs.[RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!] = DLLFindObjectIDName("FlagRed"); |
| 409 | FlagIDscxx . . $ FlagIDs.[BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!] = DLLFindObjectIDName("Flagblue"); |
| 410 | FlagIDscxx . . $ FlagIDs.[GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!] = DLLFindObjectIDName("FlagGreen"); |
| 411 | FlagIDscxx . . $ FlagIDs.[YELLOW_TEAMcxx . . $ `netgames/includes/DMFC.h:430:9`!] = DLLFindObjectIDName("FlagYellow"); |
| 412 | AFlagIDscxx . . $ AFlagIDs.[RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!] = DLLFindObjectIDName("ShipRedFlag"); |
| 413 | AFlagIDscxx . . $ AFlagIDs.[BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!] = DLLFindObjectIDName("ShipBlueFlag"); |
| 414 | AFlagIDscxx . . $ AFlagIDs.[GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!] = DLLFindObjectIDName("ShipGreenFlag"); |
| 415 | AFlagIDscxx . . $ AFlagIDs.[YELLOW_TEAMcxx . . $ `netgames/includes/DMFC.h:430:9`!] = DLLFindObjectIDName("ShipYellowFlag"); |
| 416 | |
| 417 | // give initial values for the at home so they're set |
| 418 | FlagAtHomecxx . . $ FlagAtHome.[RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!] = FlagAtHomecxx . . $ FlagAtHome.[BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!] = FlagAtHomecxx . . $ FlagAtHome.[GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!] = FlagAtHomecxx . . $ FlagAtHome.[YELLOW_TEAMcxx . . $ `netgames/includes/DMFC.h:430:9`!] = false; |
| 419 | |
| 420 | // make sure all was init ok |
| 421 | for (int i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) { |
| 422 | if ((FlagBmpcxx . . $ FlagBmp.[i] <= BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) || (FlagAHBmpcxx . . $ FlagAHBmp.[i] <= BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) || |
| 423 | (DimFlagAHBmpcxx . . $ DimFlagAHBmp.[i] <= BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) || (FlagIDscxx . . $ FlagIDs.[i] < 0) || (AFlagIDscxx . . $ AFlagIDs.[i] < 0)) { |
| 424 | *all_ok = 0; |
| 425 | return; |
| 426 | } |
| 427 | } |
| 428 | |
| 429 | Highlight_bmpcxx . . $ Highlight_bmp. = DLLbm_AllocBitmap(32, 32, 0); |
| 430 | if (Highlight_bmpcxx . . $ Highlight_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) { |
| 431 | uint16_tcxx . . $ uint16_t# *data = DLLbm_data(Highlight_bmpcxx . . $ Highlight_bmp., 0); |
| 432 | if (!data) { |
| 433 | // bail on out of here |
| 434 | *all_ok = 0; |
| 435 | return; |
| 436 | } |
| 437 | for (int x = 0; x < 32 * 32; x++) { |
| 438 | data[x] = GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(50, 50, 50) | OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`!; |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | // Load in and touch all the sounds so they're ready to rock |
| 443 | snd_score_ownteamcxx . . $ snd_score_ownteam. = DLLFindSoundName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(SOUND_SCORE_OWNTEAMcxx . . $ `netgames/ctf/ctf.cpp:122:9`!)); |
| 444 | if (snd_score_ownteamcxx . . $ snd_score_ownteam. != -1) |
| 445 | DLLTouchSound(snd_score_ownteamcxx . . $ snd_score_ownteam.); |
| 446 | snd_score_otherteamcxx . . $ snd_score_otherteam. = DLLFindSoundName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(SOUND_SCORE_OTHERTEAMcxx . . $ `netgames/ctf/ctf.cpp:123:9`!)); |
| 447 | if (snd_score_otherteamcxx . . $ snd_score_otherteam. != -1) |
| 448 | DLLTouchSound(snd_score_otherteamcxx . . $ snd_score_otherteam.); |
| 449 | snd_pickedup_otherteamcxx . . $ snd_pickedup_otherteam. = DLLFindSoundName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(SOUND_PICKUPFLAG_OWNTEAMcxx . . $ `netgames/ctf/ctf.cpp:120:9`!)); |
| 450 | if (snd_pickedup_otherteamcxx . . $ snd_pickedup_otherteam. != -1) |
| 451 | DLLTouchSound(snd_pickedup_otherteamcxx . . $ snd_pickedup_otherteam.); |
| 452 | snd_pickedup_ownteamcxx . . $ snd_pickedup_ownteam. = DLLFindSoundName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(SOUND_PICKUPFLAG_OTHERTEAMcxx . . $ `netgames/ctf/ctf.cpp:121:9`!)); |
| 453 | if (snd_pickedup_ownteamcxx . . $ snd_pickedup_ownteam. != -1) |
| 454 | DLLTouchSound(snd_pickedup_ownteamcxx . . $ snd_pickedup_ownteam.); |
| 455 | snd_return_ownteamcxx . . $ snd_return_ownteam. = DLLFindSoundName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(SOUND_FLAGRETURNED_OWNTEAMcxx . . $ `netgames/ctf/ctf.cpp:126:9`!)); |
| 456 | if (snd_return_ownteamcxx . . $ snd_return_ownteam. != -1) |
| 457 | DLLTouchSound(snd_return_ownteamcxx . . $ snd_return_ownteam.); |
| 458 | snd_return_otherteamcxx . . $ snd_return_otherteam. = DLLFindSoundName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(SOUND_FLAGRETURNED_OTHERTEAMcxx . . $ `netgames/ctf/ctf.cpp:127:9`!)); |
| 459 | if (snd_return_otherteamcxx . . $ snd_return_otherteam. != -1) |
| 460 | DLLTouchSound(snd_return_otherteamcxx . . $ snd_return_otherteam.); |
| 461 | snd_lose_ownteamcxx . . $ snd_lose_ownteam. = DLLFindSoundName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(SOUND_LOSEFLAG_OWNTEAMcxx . . $ `netgames/ctf/ctf.cpp:124:9`!)); |
| 462 | if (snd_lose_ownteamcxx . . $ snd_lose_ownteam. != -1) |
| 463 | DLLTouchSound(snd_lose_ownteamcxx . . $ snd_lose_ownteam.); |
| 464 | snd_lose_otherteamcxx . . $ snd_lose_otherteam. = DLLFindSoundName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(SOUND_LOSEFLAG_OTHERTEAMcxx . . $ `netgames/ctf/ctf.cpp:125:9`!)); |
| 465 | if (snd_lose_otherteamcxx . . $ snd_lose_otherteam. != -1) |
| 466 | DLLTouchSound(snd_lose_otherteamcxx . . $ snd_lose_otherteam.); |
| 467 | snd_hattrick_firstcxx . . $ snd_hattrick_first. = DLLFindSoundName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(SOUND_HATTRICK_FIRSTcxx . . $ `netgames/ctf/ctf.cpp:128:9`!)); |
| 468 | if (snd_hattrick_firstcxx . . $ snd_hattrick_first. != -1) |
| 469 | DLLTouchSound(snd_hattrick_firstcxx . . $ snd_hattrick_first.); |
| 470 | snd_hattrick_regcxx . . $ snd_hattrick_reg. = DLLFindSoundName(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(SOUND_HATTRICK_REGULARcxx . . $ `netgames/ctf/ctf.cpp:129:9`!)); |
| 471 | if (snd_hattrick_regcxx . . $ snd_hattrick_reg. != -1) |
| 472 | DLLTouchSound(snd_hattrick_regcxx . . $ snd_hattrick_reg.); |
| 473 | |
| 474 | DisplayScoreScreencxx . . $ DisplayScoreScreen. = false; |
| 475 | |
| 476 | // Initialize the Stats Manager |
| 477 | // ---------------------------- |
| 478 | |
| 479 | tDmfcStatsInitcxx . . $ tDmfcStatsInit# tsi; |
| 480 | tDmfcStatsColumnInfocxx . . $ tDmfcStatsColumnInfo# pl_col[7]; |
| 481 | char gname[32]; |
| 482 | strcpy(gname, TXT_CTFcxx . . $ `netgames/ctf/CTFstr.h:53:9`!); |
| 483 | |
| 484 | tsi.flagscxx . . $ tDmfcStatsInit#flags. = DSIF_SHOW_PICcxx . . $ `netgames/includes/DMFC.h:619:9`! | DSIF_SHOW_OBSERVERICONcxx . . $ `netgames/includes/DMFC.h:627:9`! | DSIF_SEPERATE_BY_TEAMcxx . . $ `netgames/includes/DMFC.h:615:9`!; |
| 485 | tsi.cColumnCountDetailedcxx . . $ tDmfcStatsInit#cColumnCountDetailed. = 0; |
| 486 | tsi.cColumnCountPlayerListcxx . . $ tDmfcStatsInit#cColumnCountPlayerList. = 7; |
| 487 | tsi.clbDetailedColumnBMPcxx . . $ tDmfcStatsInit#clbDetailedColumnBMP. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 488 | tsi.clbDetailedColumncxx . . $ tDmfcStatsInit#clbDetailedColumn. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 489 | tsi.clbPlayerColumncxx . . $ tDmfcStatsInit#clbPlayerColumn. = DetermineScorecxx . . $ DetermineScore(74c02bb7c84e7fae).; |
| 490 | tsi.clbPlayerColumnBMPcxx . . $ tDmfcStatsInit#clbPlayerColumnBMP. = ShowStatBitmapcxx . . $ ShowStatBitmap(dac02d3a3b31dff4).; |
| 491 | tsi.DetailedColumnscxx . . $ tDmfcStatsInit#DetailedColumns. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 492 | tsi.GameNamecxx . . $ tDmfcStatsInit#GameName. = gname; |
| 493 | tsi.MaxNumberDisplayedcxx . . $ tDmfcStatsInit#MaxNumberDisplayed. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 494 | tsi.PlayerListColumnscxx . . $ tDmfcStatsInit#PlayerListColumns. = pl_col; |
| 495 | tsi.SortedPlayerRecordscxx . . $ tDmfcStatsInit#SortedPlayerRecords. = SortedPlayerscxx . . $ SortedPlayers.; |
| 496 | tsi.clTeamLinecxx . . $ tDmfcStatsInit#clTeamLine. = TeamScoreCallbackcxx . . $ TeamScoreCallback(99469d7ff9a1485a).; |
| 497 | |
| 498 | pl_col[0].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.; |
| 499 | pl_col[0].titlecxx . . $ tDmfcStatsColumnInfo#title.[0] = '\0'; |
| 500 | pl_col[0].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_BMPcxx . . $ DSCOL_BMP.; |
| 501 | pl_col[0].widthcxx . . $ tDmfcStatsColumnInfo#width. = 33; |
| 502 | |
| 503 | pl_col[1].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.; |
| 504 | strcpy(pl_col[1].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_PILOTcxx . . $ `netgames/ctf/CTFstr.h:48:9`!); |
| 505 | pl_col[1].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_PILOT_NAMEcxx . . $ DSCOL_PILOT_NAME.; |
| 506 | pl_col[1].widthcxx . . $ tDmfcStatsColumnInfo#width. = 120; |
| 507 | |
| 508 | pl_col[2].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.; |
| 509 | strcpy(pl_col[2].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_POINTScxx . . $ `netgames/ctf/CTFstr.h:52:9`!); |
| 510 | pl_col[2].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_CUSTOMcxx . . $ DSCOL_CUSTOM.; |
| 511 | pl_col[2].widthcxx . . $ tDmfcStatsColumnInfo#width. = 52; |
| 512 | |
| 513 | pl_col[3].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.; |
| 514 | strcpy(pl_col[3].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_KILLS_SHORTcxx . . $ `netgames/ctf/CTFstr.h:68:9`!); |
| 515 | pl_col[3].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_KILLS_LEVELcxx . . $ DSCOL_KILLS_LEVEL.; |
| 516 | pl_col[3].widthcxx . . $ tDmfcStatsColumnInfo#width. = 47; |
| 517 | |
| 518 | pl_col[4].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.; |
| 519 | strcpy(pl_col[4].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_DEATHS_SHORTcxx . . $ `netgames/ctf/CTFstr.h:69:9`!); |
| 520 | pl_col[4].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_DEATHS_LEVELcxx . . $ DSCOL_DEATHS_LEVEL.; |
| 521 | pl_col[4].widthcxx . . $ tDmfcStatsColumnInfo#width. = 47; |
| 522 | |
| 523 | pl_col[5].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.; |
| 524 | strcpy(pl_col[5].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_SUICIDES_SHORTcxx . . $ `netgames/ctf/CTFstr.h:70:9`!); |
| 525 | pl_col[5].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_SUICIDES_LEVELcxx . . $ DSCOL_SUICIDES_LEVEL.; |
| 526 | pl_col[5].widthcxx . . $ tDmfcStatsColumnInfo#width. = 47; |
| 527 | |
| 528 | pl_col[6].color_typecxx . . $ tDmfcStatsColumnInfo#color_type. = DSCOLOR_TEAMcxx . . $ DSCOLOR_TEAM.; |
| 529 | strcpy(pl_col[6].titlecxx . . $ tDmfcStatsColumnInfo#title., TXT_PINGcxx . . $ `netgames/ctf/CTFstr.h:54:9`!); |
| 530 | pl_col[6].typecxx . . $ tDmfcStatsColumnInfo#type. = DSCOL_PINGcxx . . $ DSCOL_PING.; |
| 531 | pl_col[6].widthcxx . . $ tDmfcStatsColumnInfo#width. = 40; |
| 532 | |
| 533 | dstatcxx . . $ dstat.->Initializecxx . . $ IDmfcStats#Initialize(645910a8ad01b658).(&tsi); |
| 534 | } |
| 535 | // Called when the DLL is shutdown |
| 536 | void DLLFUNCCALLcxx . . $ `lib/module.h:93:10`! DLLGameClosecxx . . $ DLLGameClose(49f6e7a06ebc5aa8).() { |
| 537 | //@@SaveConfig(); |
| 538 | //@@DMFCBase->CFGClose(); |
| 539 | |
| 540 | // Free all the bitmaps |
| 541 | DLLbm_FreeBitmap(FlagBmpcxx . . $ FlagBmp.[RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!]); |
| 542 | DLLbm_FreeBitmap(FlagBmpcxx . . $ FlagBmp.[BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!]); |
| 543 | DLLbm_FreeBitmap(FlagBmpcxx . . $ FlagBmp.[GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!]); |
| 544 | DLLbm_FreeBitmap(FlagBmpcxx . . $ FlagBmp.[YELLOW_TEAMcxx . . $ `netgames/includes/DMFC.h:430:9`!]); |
| 545 | DLLbm_FreeBitmap(DimFlagAHBmpcxx . . $ DimFlagAHBmp.[RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!]); |
| 546 | DLLbm_FreeBitmap(DimFlagAHBmpcxx . . $ DimFlagAHBmp.[BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!]); |
| 547 | DLLbm_FreeBitmap(DimFlagAHBmpcxx . . $ DimFlagAHBmp.[GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!]); |
| 548 | DLLbm_FreeBitmap(DimFlagAHBmpcxx . . $ DimFlagAHBmp.[YELLOW_TEAMcxx . . $ `netgames/includes/DMFC.h:430:9`!]); |
| 549 | DLLbm_FreeBitmap(FlagAHBmpcxx . . $ FlagAHBmp.[RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!]); |
| 550 | DLLbm_FreeBitmap(FlagAHBmpcxx . . $ FlagAHBmp.[BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!]); |
| 551 | DLLbm_FreeBitmap(FlagAHBmpcxx . . $ FlagAHBmp.[GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!]); |
| 552 | DLLbm_FreeBitmap(FlagAHBmpcxx . . $ FlagAHBmp.[YELLOW_TEAMcxx . . $ `netgames/includes/DMFC.h:430:9`!]); |
| 553 | |
| 554 | if (Highlight_bmpcxx . . $ Highlight_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) |
| 555 | DLLbm_FreeBitmap(Highlight_bmpcxx . . $ Highlight_bmp.); |
| 556 | |
| 557 | DLLDestroyStringTable(StringTablecxx . . $ StringTable., StringTableSizecxx . . $ StringTableSize.); |
| 558 | |
| 559 | if (dstatcxx . . $ dstat.) { |
| 560 | dstatcxx . . $ dstat.->DestroyPointercxx . . $ IObject#DestroyPointer(49f6e7a06ebc5aa8).(); |
| 561 | dstatcxx . . $ dstat. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 562 | } |
| 563 | |
| 564 | if (DMFCBasecxx . . $ DMFCBase.) { |
| 565 | DMFCBasecxx . . $ DMFCBase.->GameClosecxx . . $ IDMFC#GameClose(49f6e7a06ebc5aa8).(); |
| 566 | DMFCBasecxx . . $ DMFCBase.->DestroyPointercxx . . $ IObject#DestroyPointer(49f6e7a06ebc5aa8).(); |
| 567 | DMFCBasecxx . . $ DMFCBase. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 568 | } |
| 569 | } |
| 570 | |
| 571 | ///////////////////////////////////////////////////////////// |
| 572 | // DMFC Overrides |
| 573 | |
| 574 | // OnHUDInterval |
| 575 | void OnHUDIntervalcxx . . $ OnHUDInterval(49f6e7a06ebc5aa8).(void) { |
| 576 | dstatcxx . . $ dstat.->DoFramecxx . . $ IDmfcStats#DoFrame(49f6e7a06ebc5aa8).(); |
| 577 | |
| 578 | DMFCBasecxx . . $ DMFCBase.->DisplayOutrageLogocxx . . $ IDMFC#DisplayOutrageLogo(49f6e7a06ebc5aa8).(); |
| 579 | |
| 580 | DMFCBasecxx . . $ DMFCBase.->OnHUDIntervalcxx . . $ IDMFC#OnHUDInterval(49f6e7a06ebc5aa8).(); |
| 581 | } |
| 582 | |
| 583 | // OnInterval |
| 584 | void OnIntervalcxx . . $ OnInterval(49f6e7a06ebc5aa8).(void) { |
| 585 | DMFCBasecxx . . $ DMFCBase.->GetSortedPlayerSlotscxx . . $ IDMFC#GetSortedPlayerSlots(621ccea12ecf5b06).(SortedPlayerscxx . . $ SortedPlayers., MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!); |
| 586 | |
| 587 | SortTeamScorescxx . . $ SortTeamScores(ce8f7825f8908cfa).(SortedTeamscxx . . $ SortedTeams., TeamScorescxx . . $ TeamScores.); |
| 588 | |
| 589 | // Determine if a flag has timed out yet |
| 590 | for (int i = 0; i < CTFNumOfTeamscxx . . $ CTFNumOfTeams.; i++) { |
| 591 | if ((HasFlagcxx . . $ HasFlag.[i] == -1) && (!FlagAtHomecxx . . $ FlagAtHome.[i])) { |
| 592 | // check the time out values |
| 593 | if (DMFCBasecxx . . $ DMFCBase.->GetGametimecxx . . $ IDMFC#GetGametime(9b8c9e39889c762c).() >= Flag_timeout_timerscxx . . $ Flag_timeout_timers.[i]) { |
| 594 | // the timeout has expired, move home! |
| 595 | vectorcxx . . $ vector# home_pos; |
| 596 | int home, objnum; |
| 597 | |
| 598 | Flag_timeout_timerscxx . . $ Flag_timeout_timers.[i] = 0; |
| 599 | FlagAtHomecxx . . $ FlagAtHome.[i] = true; |
| 600 | HasFlagcxx . . $ HasFlag.[i] = -1; |
| 601 | home = GoalRoomscxx . . $ GoalRooms.[i]; |
| 602 | objnum = -1; |
| 603 | |
| 604 | // find the flag objnum |
| 605 | for (int o = 0; o < MAX_OBJECTScxx . . $ `lib/object_external_struct.h:107:9`!; o++) { |
| 606 | if (dObjectscxx . . $ dObjects.[o].typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`! && dObjectscxx . . $ dObjects.[o].idcxx . . $ object#id. == FlagIDscxx . . $ FlagIDs.[i]) { |
| 607 | // found it |
| 608 | objnum = o; |
| 609 | break; |
| 610 | } |
| 611 | } |
| 612 | |
| 613 | if (objnum == -1) { |
| 614 | // hmm couldn't find the flag |
| 615 | // this is messed up...will create the flag on the server and all will be happy |
| 616 | if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) { |
| 617 | int flagid = FlagIDscxx . . $ FlagIDs.[i]; |
| 618 | if ((flagid != -1) && (home >= 0) && (home <= DMFCBasecxx . . $ DMFCBase.->GetHighestRoomIndexcxx . . $ IDMFC#GetHighestRoomIndex(b126dc7c1de90089).()) && |
| 619 | (!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(home)) && (dRoomscxx . . $ dRooms.[home].usedcxx . . $ room#used.)) { |
| 620 | // Safe to create the flag |
| 621 | DLLComputeRoomCenter(&home_pos, &dRoomscxx . . $ dRooms.[home]); |
| 622 | objnum = DLLObjCreate(OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, flagid, home, &home_pos, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!); |
| 623 | DLLMultiSendObject(&dObjectscxx . . $ dObjects.[objnum], 0, true); |
| 624 | } |
| 625 | } |
| 626 | } else { |
| 627 | if ((home >= 0) && (home <= DMFCBasecxx . . $ DMFCBase.->GetHighestRoomIndexcxx . . $ IDMFC#GetHighestRoomIndex(b126dc7c1de90089).()) && (!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(home)) && |
| 628 | (dRoomscxx . . $ dRooms.[home].usedcxx . . $ room#used.)) { |
| 629 | DLLComputeRoomCenter(&home_pos, &dRoomscxx . . $ dRooms.[home]); |
| 630 | DLLObjSetPos(&dObjectscxx . . $ dObjects.[objnum], &home_pos, home, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, false); |
| 631 | } |
| 632 | } |
| 633 | } |
| 634 | } |
| 635 | } |
| 636 | |
| 637 | DMFCBasecxx . . $ DMFCBase.->OnIntervalcxx . . $ IDMFC#OnInterval(49f6e7a06ebc5aa8).(); |
| 638 | |
| 639 | First_game_framecxx . . $ First_game_frame. = true; |
| 640 | } |
| 641 | |
| 642 | // OnKeypress |
| 643 | // What it needs to do: |
| 644 | // 1) Test for F7 keypress |
| 645 | void OnKeypresscxx . . $ OnKeypress(d4f767463ce0a6b3).(int key) { |
| 646 | dllinfocxx . . $ dllinfo# *Data; |
| 647 | Data = DMFCBasecxx . . $ DMFCBase.->GetDLLInfoCallDatacxx . . $ IDMFC#GetDLLInfoCallData(4458c5bdce97a5c3).(); |
| 648 | |
| 649 | switch (key) { |
| 650 | case K_F7cxx . . $ `netgames/includes/DMFCKeyCodes.h:118:9`!: |
| 651 | DisplayScoreScreencxx . . $ DisplayScoreScreen. = !DisplayScoreScreencxx . . $ DisplayScoreScreen.; |
| 652 | DMFCBasecxx . . $ DMFCBase.->EnableOnScreenMenucxx . . $ IDMFC#EnableOnScreenMenu(b45ddcbc8423892c).(false); |
| 653 | dstatcxx . . $ dstat.->Enablecxx . . $ IDmfcStats#Enable(b45ddcbc8423892c).(DisplayScoreScreencxx . . $ DisplayScoreScreen.); |
| 654 | break; |
| 655 | case K_PAGEDOWNcxx . . $ `netgames/includes/DMFCKeyCodes.h:147:9`!: |
| 656 | if (DisplayScoreScreencxx . . $ DisplayScoreScreen.) { |
| 657 | dstatcxx . . $ dstat.->ScrollDowncxx . . $ IDmfcStats#ScrollDown(49f6e7a06ebc5aa8).(); |
| 658 | Data->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1; |
| 659 | } |
| 660 | break; |
| 661 | case K_PAGEUPcxx . . $ `netgames/includes/DMFCKeyCodes.h:144:9`!: |
| 662 | if (DisplayScoreScreencxx . . $ DisplayScoreScreen.) { |
| 663 | dstatcxx . . $ dstat.->ScrollUpcxx . . $ IDmfcStats#ScrollUp(49f6e7a06ebc5aa8).(); |
| 664 | Data->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1; |
| 665 | } |
| 666 | break; |
| 667 | case K_F6cxx . . $ `netgames/includes/DMFCKeyCodes.h:117:9`!: |
| 668 | DisplayScoreScreencxx . . $ DisplayScoreScreen. = false; |
| 669 | dstatcxx . . $ dstat.->Enablecxx . . $ IDmfcStats#Enable(b45ddcbc8423892c).(false); |
| 670 | break; |
| 671 | case K_ESCcxx . . $ `netgames/includes/DMFCKeyCodes.h:97:9`!: |
| 672 | if (DisplayScoreScreencxx . . $ DisplayScoreScreen.) { |
| 673 | dstatcxx . . $ dstat.->Enablecxx . . $ IDmfcStats#Enable(b45ddcbc8423892c).(false); |
| 674 | DisplayScoreScreencxx . . $ DisplayScoreScreen. = false; |
| 675 | Data->iRetcxx . . $ dllinfo#$anonymous_type_0#iRet. = 1; |
| 676 | } |
| 677 | break; |
| 678 | } |
| 679 | |
| 680 | DMFCBasecxx . . $ DMFCBase.->OnKeypresscxx . . $ IDMFC#OnKeypress(d4f767463ce0a6b3).(key); |
| 681 | } |
| 682 | |
| 683 | // OnServerGameCreated |
| 684 | // What it needs to do: |
| 685 | // 1) Zero out all the stats for every player |
| 686 | // 2) Zero out team scores |
| 687 | // 3) Display welcome message to server |
| 688 | void OnServerGameCreatedcxx . . $ OnServerGameCreated(49f6e7a06ebc5aa8).(void) { |
| 689 | DMFCBasecxx . . $ DMFCBase.->OnServerGameCreatedcxx . . $ IDMFC#OnServerGameCreated(49f6e7a06ebc5aa8).(); |
| 690 | tPlayerStatcxx . . $ tPlayerStat# *stat; |
| 691 | player_recordcxx . . $ player_record# *pr; |
| 692 | int i; |
| 693 | |
| 694 | for (i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) { |
| 695 | pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(i); |
| 696 | if (pr) { |
| 697 | stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.; |
| 698 | if (stat) { |
| 699 | stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] = 0; |
| 700 | stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!] = 0; |
| 701 | } |
| 702 | } |
| 703 | } |
| 704 | for (i = 0; i < CTFNumOfTeamscxx . . $ CTFNumOfTeams.; i++) { |
| 705 | TeamScorescxx . . $ TeamScores.[i] = 0; |
| 706 | OverallTeamScorescxx . . $ OverallTeamScores.[i] = 0; |
| 707 | } |
| 708 | } |
| 709 | |
| 710 | // OnClientLevelStart |
| 711 | // What it needs to do: |
| 712 | // 1) Zero out level scores for everyone |
| 713 | // 2) Reset colored balls |
| 714 | // 3) Zero out team scores |
| 715 | // 4) Set number of teams |
| 716 | // 5) If we are the server, create the flags and send them to the clients |
| 717 | void OnClientLevelStartcxx . . $ OnClientLevelStart(49f6e7a06ebc5aa8).(void) { |
| 718 | int i; |
| 719 | |
| 720 | DMFCBasecxx . . $ DMFCBase.->OnClientLevelStartcxx . . $ IDMFC#OnClientLevelStart(49f6e7a06ebc5aa8).(); |
| 721 | |
| 722 | First_game_framecxx . . $ First_game_frame. = false; |
| 723 | |
| 724 | for (i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) { |
| 725 | SortedPlayerscxx . . $ SortedPlayers.[i] = -1; |
| 726 | } |
| 727 | for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) { |
| 728 | |
| 729 | SortedTeamscxx . . $ SortedTeams.[i] = -1; |
| 730 | Flag_timeout_timerscxx . . $ Flag_timeout_timers.[i] = 0; |
| 731 | ChildFlagscxx . . $ ChildFlags.[i] = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; |
| 732 | } |
| 733 | |
| 734 | Someone_has_hattrickcxx . . $ Someone_has_hattrick. = false; |
| 735 | |
| 736 | tPlayerStatcxx . . $ tPlayerStat# *stat; |
| 737 | player_recordcxx . . $ player_record# *pr; |
| 738 | for (i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) { |
| 739 | pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(i); |
| 740 | if (pr) { |
| 741 | stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.; |
| 742 | if (stat) { |
| 743 | stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] = 0; |
| 744 | } |
| 745 | } |
| 746 | } |
| 747 | for (i = 0; i < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; i++) { |
| 748 | SetColoredBallscxx . . $ SetColoredBalls(918ebd27a9ddbad3).(i, true); |
| 749 | } |
| 750 | |
| 751 | // fill in the goal room #'s |
| 752 | for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) { |
| 753 | GoalRoomscxx . . $ GoalRooms.[i] = DLLGetGoalRoomForTeam(i); |
| 754 | FlagAtHomecxx . . $ FlagAtHome.[i] = true; |
| 755 | HasFlagcxx . . $ HasFlag.[i] = -1; |
| 756 | TeamScorescxx . . $ TeamScores.[i] = 0; |
| 757 | } |
| 758 | |
| 759 | DMFCBasecxx . . $ DMFCBase.->SetNumberOfTeamscxx . . $ IDMFC#SetNumberOfTeams(d4f767463ce0a6b3).(CTFNumOfTeamscxx . . $ CTFNumOfTeams.); |
| 760 | DLLMultiPaintGoalRooms(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 761 | |
| 762 | // Bash the inventory since it doesn't get reset for the server |
| 763 | DLLInvReset(DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).(), true); |
| 764 | |
| 765 | // Display our welcome message |
| 766 | display_my_welcomecxx . . $ display_my_welcome. = true; |
| 767 | |
| 768 | // If we are the server create the flags |
| 769 | if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) { |
| 770 | // Get the game state |
| 771 | DMFCBasecxx . . $ DMFCBase.->RequestGameStatecxx . . $ IDMFC#RequestGameState(49f6e7a06ebc5aa8).(); |
| 772 | return; |
| 773 | } |
| 774 | |
| 775 | vectorcxx . . $ vector# vpos; |
| 776 | int objnum; |
| 777 | int flagid, goalroom; |
| 778 | |
| 779 | for (i = 0; i < CTFNumOfTeamscxx . . $ CTFNumOfTeams.; i++) { |
| 780 | flagid = FlagIDscxx . . $ FlagIDs.[i]; |
| 781 | goalroom = GoalRoomscxx . . $ GoalRooms.[i]; |
| 782 | if ((flagid != -1) && (goalroom >= 0) && (goalroom <= DMFCBasecxx . . $ DMFCBase.->GetHighestRoomIndexcxx . . $ IDMFC#GetHighestRoomIndex(b126dc7c1de90089).()) && |
| 783 | (!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(goalroom)) && (dRoomscxx . . $ dRooms.[goalroom].usedcxx . . $ room#used.)) { |
| 784 | // Safe to create the flag |
| 785 | DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "Creating %s Flag\n", DMFCBase->GetTeamString(i)); |
| 786 | DLLComputeRoomCenter(&vpos, &dRoomscxx . . $ dRooms.[goalroom]); |
| 787 | objnum = DLLObjCreate(OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, flagid, goalroom, &vpos, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!); |
| 788 | DLLMultiSendObject(&dObjectscxx . . $ dObjects.[objnum], 0, true); |
| 789 | } |
| 790 | } |
| 791 | } |
| 792 | |
| 793 | // OnServerCollide |
| 794 | // What it needs to do: |
| 795 | // 1) See if the player has collided with a flag, if so pass to clients |
| 796 | void OnServerCollidecxx . . $ OnServerCollide(6273fa812ac58a8).(objectcxx . . $ object# *me_obj, objectcxx . . $ object# *it_obj) { |
| 797 | // see if we need to send this event to the clients |
| 798 | // only if me==player it==flag powerup |
| 799 | if (!me_obj || !it_obj) |
| 800 | return; |
| 801 | if ((me_obj->typecxx . . $ object#type. == OBJ_PLAYERcxx . . $ `Descent3/object_external.h:164:9`! || me_obj->typecxx . . $ object#type. == OBJ_GHOSTcxx . . $ `Descent3/object_external.h:172:9`!) && (it_obj->typecxx . . $ object#type. == OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!)) |
| 802 | if ((it_obj->idcxx . . $ object#id. == FlagIDscxx . . $ FlagIDs.[RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!]) || (it_obj->idcxx . . $ object#id. == FlagIDscxx . . $ FlagIDs.[BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!]) || |
| 803 | (it_obj->idcxx . . $ object#id. == FlagIDscxx . . $ FlagIDs.[GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!]) || (it_obj->idcxx . . $ object#id. == FlagIDscxx . . $ FlagIDs.[YELLOW_TEAMcxx . . $ `netgames/includes/DMFC.h:430:9`!])) { |
| 804 | |
| 805 | // Start a packet for the collide |
| 806 | uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 807 | int count = 0; |
| 808 | DMFCBasecxx . . $ DMFCBase.->StartPacketcxx . . $ IDMFC#StartPacket(261852a8f74abaa0).(data, SPID_COLLIDEcxx . . $ `netgames/ctf/ctf.cpp:104:9`!, &count); |
| 809 | int start = count; |
| 810 | |
| 811 | // we need me, it and me roomnum |
| 812 | MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).((me_obj - dObjectscxx . . $ dObjects.), data, &count); |
| 813 | MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).((it_obj - dObjectscxx . . $ dObjects.), data, &count); |
| 814 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(it_obj->roomnumcxx . . $ object#roomnum., data, &count); |
| 815 | |
| 816 | DMFCBasecxx . . $ DMFCBase.->SendPacketcxx . . $ IDMFC#SendPacket(49a5bbab55ea8abc).(data, count, SP_ALLcxx . . $ `netgames/includes/DMFC.h:435:9`!); |
| 817 | OnClientCollidecxx . . $ OnClientCollide(f25546b61a629de7).(&data[start]); |
| 818 | } |
| 819 | } |
| 820 | |
| 821 | // OnClientCollide |
| 822 | // What it needs to do: |
| 823 | // 1) See if Player collided with own flag |
| 824 | // 1.1) Check to see if in home goal |
| 825 | // 1.1.1) Reset colored balls |
| 826 | // 1.1.2) Remove all the flags from the inventory, send them back to their home goal |
| 827 | // 1.1.3) Add scores |
| 828 | // 1.1.4) Print out score |
| 829 | // 1.1.5) Do Kill Goal check |
| 830 | // 1,2) Move home flag to center of base |
| 831 | // 2) else collide with another team's flag |
| 832 | // 2.1) Add flag to inventory |
| 833 | // 2.2) Set rotating balls |
| 834 | // 2.3) Print out message |
| 835 | void OnClientCollidecxx . . $ OnClientCollide(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) { |
| 836 | objectcxx . . $ object# *me_obj, *it_obj; |
| 837 | int me_roomnum; |
| 838 | int count = 0; |
| 839 | int me_serv_objnum, it_serv_objnum, me_client_objnum, it_client_objnum; |
| 840 | |
| 841 | me_serv_objnum = MultiGetUshortcxx . . $ MultiGetUshort(4574463662eb5370).(data, &count); |
| 842 | it_serv_objnum = MultiGetUshortcxx . . $ MultiGetUshort(4574463662eb5370).(data, &count); |
| 843 | me_roomnum = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count); |
| 844 | |
| 845 | me_client_objnum = DMFCBasecxx . . $ DMFCBase.->ConvertServerToLocalObjnumcxx . . $ IDMFC#ConvertServerToLocalObjnum(7864480464b09eea).(me_serv_objnum); |
| 846 | it_client_objnum = DMFCBasecxx . . $ DMFCBase.->ConvertServerToLocalObjnumcxx . . $ IDMFC#ConvertServerToLocalObjnum(7864480464b09eea).(it_serv_objnum); |
| 847 | |
| 848 | if (me_client_objnum == -1 || it_client_objnum == -1) { |
| 849 | Int3cxx . . $ `netgames/includes/DMFC.h:378:9`!(); |
| 850 | return; |
| 851 | } |
| 852 | |
| 853 | me_obj = &dObjectscxx . . $ dObjects.[me_client_objnum]; |
| 854 | it_obj = &dObjectscxx . . $ dObjects.[it_client_objnum]; |
| 855 | |
| 856 | // now process the collide |
| 857 | |
| 858 | int fteam = -1; // flags team |
| 859 | int pnum = me_obj->idcxx . . $ object#id.; // player number |
| 860 | int pteam = DMFCBasecxx . . $ DMFCBase.->GetPlayerTeamcxx . . $ IDMFC#GetPlayerTeam(7864480464b09eea).(pnum); // player's team |
| 861 | int i; |
| 862 | bool play_return_home_msg = false; |
| 863 | |
| 864 | for (i = 0; i < CTFNumOfTeamscxx . . $ CTFNumOfTeams.; i++) { |
| 865 | if (it_obj->idcxx . . $ object#id. == FlagIDscxx . . $ FlagIDs.[i]) |
| 866 | fteam = i; |
| 867 | } |
| 868 | |
| 869 | if (fteam == -1) { |
| 870 | return; // something wrong, as none of the IDs are one of the flag's IDs |
| 871 | } |
| 872 | |
| 873 | // Reset the timer for this flag since it's guaranteed someone owns it now |
| 874 | // or it has been sent home. |
| 875 | Flag_timeout_timerscxx . . $ Flag_timeout_timers.[fteam] = 0; |
| 876 | |
| 877 | // Did player collide with his own team's flag? |
| 878 | if (fteam == pteam) { |
| 879 | int16_t flag_count = 0; |
| 880 | vectorcxx . . $ vector# fpos; |
| 881 | int groom; |
| 882 | int flagcount; |
| 883 | int flagmask; |
| 884 | |
| 885 | bool captured_flags[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!]; |
| 886 | for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) { |
| 887 | captured_flags[i] = false; |
| 888 | } |
| 889 | |
| 890 | // Check what room the player is in, if they're not in home base, then it's no score |
| 891 | if (GoalRoomscxx . . $ GoalRooms.[fteam] == me_roomnum) { |
| 892 | // ok so he is in his home base, now find out how many flags he has, score for each and return them home |
| 893 | flagcount = GetFlagCountForPlayercxx . . $ GetFlagCountForPlayer(7864480464b09eea).(pnum); |
| 894 | flagmask = GetFlagMaskForPlayercxx . . $ GetFlagMaskForPlayer(bc0fba5608a0bfe7).(pnum); |
| 895 | |
| 896 | // now loop through the flags, check to see if we have them and handle it |
| 897 | for (i = 0; i < CTFNumOfTeamscxx . . $ CTFNumOfTeams.; i++) { |
| 898 | if (flagmask & 0x01) { |
| 899 | // we have the flag we're currently working on |
| 900 | captured_flags[i] = true; |
| 901 | groom = GoalRoomscxx . . $ GoalRooms.[i]; |
| 902 | if ((groom >= 0) && (groom <= DMFCBasecxx . . $ DMFCBase.->GetHighestRoomIndexcxx . . $ IDMFC#GetHighestRoomIndex(b126dc7c1de90089).()) && (!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(groom)) && |
| 903 | (dRoomscxx . . $ dRooms.[groom].usedcxx . . $ room#used.)) { |
| 904 | // the room is valid, so move it back to home |
| 905 | |
| 906 | LoseFlagForPlayercxx . . $ LoseFlagForPlayer(7170367bda245568).(pnum, i); |
| 907 | |
| 908 | if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) { |
| 909 | // if we are the server create the object and send it on it's way to the player's |
| 910 | DLLComputeRoomCenter(&fpos, &dRoomscxx . . $ dRooms.[groom]); |
| 911 | int objnum = DLLObjCreate(OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, FlagIDscxx . . $ FlagIDs.[i], groom, &fpos, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!); |
| 912 | DLLMultiSendObject(&dObjectscxx . . $ dObjects.[objnum], 1, true); |
| 913 | } // end server create |
| 914 | } // end room ok |
| 915 | |
| 916 | // set it's at home flag |
| 917 | FlagAtHomecxx . . $ FlagAtHome.[i] = true; |
| 918 | } // end flag check |
| 919 | // rotate the flagmask over one to check for the next flag |
| 920 | flagmask = flagmask >> 1; |
| 921 | } // end for loop |
| 922 | |
| 923 | // remove any rotating balls |
| 924 | SetColoredBallscxx . . $ SetColoredBalls(918ebd27a9ddbad3).(pnum, true); |
| 925 | |
| 926 | // Now handle any scoring |
| 927 | int score = 0; |
| 928 | switch (flagcount) { |
| 929 | case 0: |
| 930 | break; |
| 931 | case 1: |
| 932 | score = 1; |
| 933 | break; |
| 934 | case 2: |
| 935 | score = 3; |
| 936 | break; |
| 937 | case 3: |
| 938 | score = 9; |
| 939 | break; |
| 940 | } |
| 941 | |
| 942 | // print out the message and add to the scores |
| 943 | |
| 944 | if (score) { |
| 945 | tPlayerStatcxx . . $ tPlayerStat# *stat = (tPlayerStatcxx . . $ tPlayerStat# *)DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordDatacxx . . $ IDMFC#GetPlayerRecordData(d1680a912d714170).(pnum); |
| 946 | if (stat) { |
| 947 | stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] += score; |
| 948 | stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!] += score; |
| 949 | |
| 950 | if (stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] == 3) { |
| 951 | if (Someone_has_hattrickcxx . . $ Someone_has_hattrick.) { |
| 952 | DLLAddHUDMessage(TXT_HATTRICKcxx . . $ `netgames/ctf/CTFstr.h:55:9`!, dPlayerscxx . . $ dPlayers.[pnum].callsigncxx . . $ player#callsign.); |
| 953 | if (snd_hattrick_regcxx . . $ snd_hattrick_reg. != -1) |
| 954 | DLLPlay2dSound(snd_hattrick_regcxx . . $ snd_hattrick_reg., MAX_GAME_VOLUMEcxx . . $ `netgames/includes/gamedll_header.h:59:9`! / 2); |
| 955 | } else { |
| 956 | DLLAddHUDMessage(TXT_HATTRICKFIRSTcxx . . $ `netgames/ctf/CTFstr.h:56:9`!, dPlayerscxx . . $ dPlayers.[pnum].callsigncxx . . $ player#callsign.); |
| 957 | if (snd_hattrick_firstcxx . . $ snd_hattrick_first. != -1) |
| 958 | DLLPlay2dSound(snd_hattrick_firstcxx . . $ snd_hattrick_first., MAX_GAME_VOLUMEcxx . . $ `netgames/includes/gamedll_header.h:59:9`! / 2); |
| 959 | Someone_has_hattrickcxx . . $ Someone_has_hattrick. = true; |
| 960 | } |
| 961 | } |
| 962 | } |
| 963 | |
| 964 | TeamScorescxx . . $ TeamScores.[pteam] += score; |
| 965 | OverallTeamScorescxx . . $ OverallTeamScores.[pteam] += score; |
| 966 | int newscore = TeamScorescxx . . $ TeamScores.[pteam]; |
| 967 | |
| 968 | switch (flagcount) { |
| 969 | case 1: { |
| 970 | char t[20]; |
| 971 | t[0] = '\0'; |
| 972 | for (int c = 0; c < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; c++) { |
| 973 | if (captured_flags[c]) { |
| 974 | strcpy(t, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(c)); |
| 975 | break; |
| 976 | } |
| 977 | } |
| 978 | DLLAddHUDMessage(TXT_CAPTUREcxx . . $ `netgames/ctf/CTFstr.h:57:9`!, dPlayerscxx . . $ dPlayers.[pnum].callsigncxx . . $ player#callsign., DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(pteam), t); |
| 979 | } break; |
| 980 | case 2: { |
| 981 | char t[2][20]; |
| 982 | t[0][0] = '\0'; |
| 983 | t[1][0] = '\0'; |
| 984 | int index = 0; |
| 985 | for (int c = 0; c < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; c++) { |
| 986 | if (captured_flags[c]) { |
| 987 | strcpy(t[index], DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(c)); |
| 988 | index++; |
| 989 | if (index == 2) |
| 990 | break; |
| 991 | } |
| 992 | } |
| 993 | DLLAddHUDMessage(TXT_CAPTURETWOcxx . . $ `netgames/ctf/CTFstr.h:58:9`!, dPlayerscxx . . $ dPlayers.[pnum].callsigncxx . . $ player#callsign., DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(pteam), t[0], t[1]); |
| 994 | } break; |
| 995 | case 3: { |
| 996 | char t[3][20]; |
| 997 | t[0][0] = '\0'; |
| 998 | t[1][0] = '\0'; |
| 999 | t[2][0] = '\0'; |
| 1000 | |
| 1001 | int index = 0; |
| 1002 | for (int c = 0; c < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; c++) { |
| 1003 | if (captured_flags[c]) { |
| 1004 | strcpy(t[index], DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(c)); |
| 1005 | index++; |
| 1006 | if (index == 3) |
| 1007 | break; |
| 1008 | } |
| 1009 | } |
| 1010 | DLLAddHUDMessage(TXT_CAPTURETHREEcxx . . $ `netgames/ctf/CTFstr.h:59:9`!, dPlayerscxx . . $ dPlayers.[pnum].callsigncxx . . $ player#callsign., DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(pteam), t[0], t[1], t[2]); |
| 1011 | } |
| 1012 | } |
| 1013 | |
| 1014 | if (dPlayerscxx . . $ dPlayers.[DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()].teamcxx . . $ player#team. == pteam) { |
| 1015 | if (snd_score_ownteamcxx . . $ snd_score_ownteam. != -1) |
| 1016 | DLLPlay2dSound(snd_score_ownteamcxx . . $ snd_score_ownteam., MAX_GAME_VOLUMEcxx . . $ `netgames/includes/gamedll_header.h:59:9`! / 2); |
| 1017 | } else { |
| 1018 | if (snd_score_otherteamcxx . . $ snd_score_otherteam. != -1) |
| 1019 | DLLPlay2dSound(snd_score_otherteamcxx . . $ snd_score_otherteam., MAX_GAME_VOLUMEcxx . . $ `netgames/includes/gamedll_header.h:59:9`! / 2); |
| 1020 | } |
| 1021 | |
| 1022 | // Set a Timer to display |
| 1023 | if (WhoJustScoredTimercxx . . $ WhoJustScoredTimer. != -1) |
| 1024 | DMFCBasecxx . . $ DMFCBase.->KillTimercxx . . $ IDMFC#KillTimer(d4f767463ce0a6b3).(WhoJustScoredTimercxx . . $ WhoJustScoredTimer.); |
| 1025 | WhoJustScoredTimercxx . . $ WhoJustScoredTimer. = DMFCBasecxx . . $ DMFCBase.->SetTimerIntervalcxx . . $ IDMFC#SetTimerInterval(695c251031f3a34d).(OnTimerScorecxx . . $ OnTimerScore(49f6e7a06ebc5aa8)., 0.5f, 5.0f, OnTimerScoreKillcxx . . $ OnTimerScoreKill(49f6e7a06ebc5aa8).); |
| 1026 | WhoJustScoredcxx . . $ WhoJustScored. = pteam; |
| 1027 | } |
| 1028 | // do the killgoal check |
| 1029 | int killgoal; |
| 1030 | if (DMFCBasecxx . . $ DMFCBase.->GetScoreLimitcxx . . $ IDMFC#GetScoreLimit(18a3c31ed0aa5760).(&killgoal)) { |
| 1031 | if (TeamScorescxx . . $ TeamScores.[pteam] >= killgoal) { |
| 1032 | // That's all she wrote for this level |
| 1033 | DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "OnClientCollide:Kill Goal Reached!\n"); |
| 1034 | DMFCBasecxx . . $ DMFCBase.->EndLevelcxx . . $ IDMFC#EndLevel(49f6e7a06ebc5aa8).(); |
| 1035 | } |
| 1036 | } |
| 1037 | } else { |
| 1038 | DoFlagReturnedHomecxx . . $ DoFlagReturnedHome(d4f767463ce0a6b3).(pteam); |
| 1039 | if (DMFCBasecxx . . $ DMFCBase.->CheckPlayerNumcxx . . $ IDMFC#CheckPlayerNum(83c267b20bac841a).(pnum)) { |
| 1040 | char parm1[20], parm2[20]; |
| 1041 | strcpy(parm1, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(pteam)); |
| 1042 | strcpy(parm2, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(fteam)); |
| 1043 | DLLAddHUDMessage(TXT_RETURNcxx . . $ `netgames/ctf/CTFstr.h:60:9`!, dPlayerscxx . . $ dPlayers.[pnum].callsigncxx . . $ player#callsign., parm1, parm2); |
| 1044 | } |
| 1045 | } |
| 1046 | |
| 1047 | // since the player collided with his own team's flag we need to move the flag back home |
| 1048 | FlagAtHomecxx . . $ FlagAtHome.[pteam] = true; |
| 1049 | HasFlagcxx . . $ HasFlag.[pteam] = -1; |
| 1050 | vectorcxx . . $ vector# home_pos; |
| 1051 | int home = GoalRoomscxx . . $ GoalRooms.[pteam]; |
| 1052 | |
| 1053 | if ((home >= 0) && (home <= DMFCBasecxx . . $ DMFCBase.->GetHighestRoomIndexcxx . . $ IDMFC#GetHighestRoomIndex(b126dc7c1de90089).()) && (!ROOMNUM_OUTSIDEcxx . . $ `lib/object_external_struct.h:127:9`!(home)) && (dRoomscxx . . $ dRooms.[home].usedcxx . . $ room#used.)) { |
| 1054 | DLLComputeRoomCenter(&home_pos, &dRoomscxx . . $ dRooms.[home]); |
| 1055 | DLLObjSetPos(it_obj, &home_pos, home, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, false); |
| 1056 | } |
| 1057 | |
| 1058 | } // end Player Collides with own team's flag |
| 1059 | else { |
| 1060 | // The Player collide with another team's flag |
| 1061 | FlagAtHomecxx . . $ FlagAtHome.[fteam] = false; |
| 1062 | |
| 1063 | // add the flag to the player |
| 1064 | GivePlayerFlagcxx . . $ GivePlayerFlag(7b9b7da826ebfeee).(pnum, fteam); |
| 1065 | |
| 1066 | if (dPlayerscxx . . $ dPlayers.[DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()].teamcxx . . $ player#team. == dPlayerscxx . . $ dPlayers.[pnum].teamcxx . . $ player#team.) { |
| 1067 | if (snd_pickedup_ownteamcxx . . $ snd_pickedup_ownteam. != -1) |
| 1068 | DLLPlay2dSound(snd_pickedup_ownteamcxx . . $ snd_pickedup_ownteam., MAX_GAME_VOLUMEcxx . . $ `netgames/includes/gamedll_header.h:59:9`! / 2); |
| 1069 | } else { |
| 1070 | if (snd_pickedup_otherteamcxx . . $ snd_pickedup_otherteam. != -1) |
| 1071 | DLLPlay2dSound(snd_pickedup_otherteamcxx . . $ snd_pickedup_otherteam., MAX_GAME_VOLUMEcxx . . $ `netgames/includes/gamedll_header.h:59:9`! / 2); |
| 1072 | } |
| 1073 | |
| 1074 | // Set a Timer to display |
| 1075 | if (WhoJustFlaggedTimercxx . . $ WhoJustFlaggedTimer. != -1) |
| 1076 | DMFCBasecxx . . $ DMFCBase.->KillTimercxx . . $ IDMFC#KillTimer(d4f767463ce0a6b3).(WhoJustFlaggedTimercxx . . $ WhoJustFlaggedTimer.); |
| 1077 | WhoJustFlaggedTimercxx . . $ WhoJustFlaggedTimer. = DMFCBasecxx . . $ DMFCBase.->SetTimerIntervalcxx . . $ IDMFC#SetTimerInterval(695c251031f3a34d).(OnTimercxx . . $ OnTimer(49f6e7a06ebc5aa8)., 0.5f, 5.0f, OnTimerKillcxx . . $ OnTimerKill(49f6e7a06ebc5aa8).); |
| 1078 | WhoJustFlaggedcxx . . $ WhoJustFlagged. = fteam; |
| 1079 | |
| 1080 | char parm1[20], parm2[20]; |
| 1081 | strcpy(parm1, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(pteam)); |
| 1082 | strcpy(parm2, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(fteam)); |
| 1083 | if (dObjectscxx . . $ dObjects.[dPlayerscxx . . $ dPlayers.[pnum].objnumcxx . . $ player#objnum.].roomnumcxx . . $ object#roomnum. == GoalRoomscxx . . $ GoalRooms.[fteam]) { |
| 1084 | DLLAddHUDMessage(TXT_PICKUPFLAGcxx . . $ `netgames/ctf/CTFstr.h:42:9`!, dPlayerscxx . . $ dPlayers.[pnum].callsigncxx . . $ player#callsign., parm1, parm2); |
| 1085 | } else { |
| 1086 | DLLAddHUDMessage(TXT_PICKUPFLAGSPEWcxx . . $ `netgames/ctf/CTFstr.h:41:9`!, dPlayerscxx . . $ dPlayers.[pnum].callsigncxx . . $ player#callsign., parm1, parm2); |
| 1087 | } |
| 1088 | |
| 1089 | // remove the flag from the world |
| 1090 | if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) { |
| 1091 | // tell the clients to remove this flag |
| 1092 | DLLSetObjectDeadFlag(it_obj, true, false); |
| 1093 | } |
| 1094 | } |
| 1095 | } |
| 1096 | |
| 1097 | // OnGameStateRequest |
| 1098 | // 1) Send game state to new player |
| 1099 | void OnGameStateRequestcxx . . $ OnGameStateRequest(d4f767463ce0a6b3).(int player_num) { |
| 1100 | SendGameStatecxx . . $ SendGameState(d4f767463ce0a6b3).(player_num); |
| 1101 | DMFCBasecxx . . $ DMFCBase.->OnGameStateRequestcxx . . $ IDMFC#OnGameStateRequest(d4f767463ce0a6b3).(player_num); |
| 1102 | } |
| 1103 | |
| 1104 | void OnPlayerConnectcxx . . $ OnPlayerConnect(d4f767463ce0a6b3).(int player_num) { |
| 1105 | DMFCBasecxx . . $ DMFCBase.->OnPlayerConnectcxx . . $ IDMFC#OnPlayerConnect(d4f767463ce0a6b3).(player_num); |
| 1106 | |
| 1107 | tPlayerStatcxx . . $ tPlayerStat# *stat; |
| 1108 | stat = (tPlayerStatcxx . . $ tPlayerStat# *)DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordDatacxx . . $ IDMFC#GetPlayerRecordData(d1680a912d714170).(player_num); |
| 1109 | if (stat) { |
| 1110 | stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] = 0; |
| 1111 | stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!] = 0; |
| 1112 | } |
| 1113 | |
| 1114 | if (player_num != DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()) { |
| 1115 | // announce the arrival of the player |
| 1116 | DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(player_num); |
| 1117 | } |
| 1118 | } |
| 1119 | |
| 1120 | void OnClientLevelEndcxx . . $ OnClientLevelEnd(49f6e7a06ebc5aa8).(void) { DMFCBasecxx . . $ DMFCBase.->OnClientLevelEndcxx . . $ IDMFC#OnClientLevelEnd(49f6e7a06ebc5aa8).(); } |
| 1121 | |
| 1122 | void OnPlayerChangeTeamcxx . . $ OnPlayerChangeTeam(23bb497e4fbd6c85).(int player_num, int newteam, bool announce, bool spew_onrespawn) { |
| 1123 | DMFCBasecxx . . $ DMFCBase.->OnPlayerChangeTeamcxx . . $ IDMFC#OnPlayerChangeTeam(23bb497e4fbd6c85).(player_num, newteam, announce, spew_onrespawn); |
| 1124 | player_recordcxx . . $ player_record# *pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordByPnumcxx . . $ IDMFC#GetPlayerRecordByPnum(6359c6f28dd028ae).(player_num); |
| 1125 | } |
| 1126 | |
| 1127 | // OnClientPlayerKilled |
| 1128 | // 1) If suicide add to suicides |
| 1129 | // 2) Else add to killer's kill, add to victim's deaths |
| 1130 | // 3) Reset colored balls |
| 1131 | // 4) If killed in a flag's home goal than put it in the center of the room |
| 1132 | void OnClientPlayerKilledcxx . . $ OnClientPlayerKilled(766a1b7183ffa4b4).(objectcxx . . $ object# *killer_obj, int victim_pnum) { |
| 1133 | int kpnum = -1; |
| 1134 | |
| 1135 | if (killer_obj) { |
| 1136 | 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`!)) |
| 1137 | kpnum = killer_obj->idcxx . . $ object#id.; |
| 1138 | 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`!) { |
| 1139 | // countermeasure kill |
| 1140 | kpnum = DMFCBasecxx . . $ DMFCBase.->GetCounterMeasureOwnercxx . . $ IDMFC#GetCounterMeasureOwner(2da2a862cad4c994).(killer_obj); |
| 1141 | } else { |
| 1142 | kpnum = -1; |
| 1143 | } |
| 1144 | } |
| 1145 | |
| 1146 | HandlePlayerSpewcxx . . $ HandlePlayerSpew(d4f767463ce0a6b3).(victim_pnum); |
| 1147 | DMFCBasecxx . . $ DMFCBase.->OnClientPlayerKilledcxx . . $ IDMFC#OnClientPlayerKilled(766a1b7183ffa4b4).(killer_obj, victim_pnum); |
| 1148 | } |
| 1149 | |
| 1150 | void OnClientPlayerDisconnectcxx . . $ OnClientPlayerDisconnect(d4f767463ce0a6b3).(int player_num) { |
| 1151 | HandlePlayerSpewcxx . . $ HandlePlayerSpew(d4f767463ce0a6b3).(player_num); |
| 1152 | DMFCBasecxx . . $ DMFCBase.->OnClientPlayerDisconnectcxx . . $ IDMFC#OnClientPlayerDisconnect(d4f767463ce0a6b3).(player_num); |
| 1153 | } |
| 1154 | |
| 1155 | void OnPlayerEntersObservercxx . . $ OnPlayerEntersObserver(14473714f2cc5bd2).(int pnum, objectcxx . . $ object# *piggy) { |
| 1156 | HandlePlayerSpewcxx . . $ HandlePlayerSpew(d4f767463ce0a6b3).(pnum); |
| 1157 | DMFCBasecxx . . $ DMFCBase.->OnPlayerEntersObservercxx . . $ IDMFC#OnPlayerEntersObserver(14473714f2cc5bd2).(pnum, piggy); |
| 1158 | } |
| 1159 | |
| 1160 | bool OnCanChangeTeamcxx . . $ OnCanChangeTeam(cf9ef193275fa6d8).(int pnum, int newteam) { |
| 1161 | if (!DMFCBasecxx . . $ DMFCBase.->OnCanChangeTeamcxx . . $ IDMFC#OnCanChangeTeam(cf9ef193275fa6d8).(pnum, newteam)) |
| 1162 | return false; |
| 1163 | |
| 1164 | if (GetFlagCountForPlayercxx . . $ GetFlagCountForPlayer(7864480464b09eea).(pnum)) { |
| 1165 | DMFCBasecxx . . $ DMFCBase.->AnnounceTeamChangeDenycxx . . $ IDMFC#AnnounceTeamChangeDeny(d4f767463ce0a6b3).(pnum); |
| 1166 | return false; |
| 1167 | } |
| 1168 | |
| 1169 | return true; |
| 1170 | } |
| 1171 | |
| 1172 | bool compare_slotscxx . . $ compare_slots(cf9ef193275fa6d8).(int a, int b) { |
| 1173 | int ascore, bscore; |
| 1174 | player_recordcxx . . $ player_record# *apr, *bpr; |
| 1175 | tPlayerStatcxx . . $ tPlayerStat# *astat, *bstat; |
| 1176 | |
| 1177 | apr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(a); |
| 1178 | bpr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(b); |
| 1179 | if (!apr) |
| 1180 | return true; |
| 1181 | if (!bpr) |
| 1182 | return false; |
| 1183 | if (apr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.) |
| 1184 | return true; |
| 1185 | if (bpr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.) |
| 1186 | return false; |
| 1187 | astat = (tPlayerStatcxx . . $ tPlayerStat# *)apr->user_infocxx . . $ player_record#user_info.; |
| 1188 | bstat = (tPlayerStatcxx . . $ tPlayerStat# *)bpr->user_infocxx . . $ player_record#user_info.; |
| 1189 | |
| 1190 | if ((apr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) && (bpr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.)) { |
| 1191 | // both players were in the game |
| 1192 | ascore = (astat) ? astat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0; |
| 1193 | bscore = (bstat) ? bstat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0; |
| 1194 | return (ascore < bscore); |
| 1195 | } |
| 1196 | if ((apr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) && (bpr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.)) { |
| 1197 | // apr gets priority since he was in the game on exit |
| 1198 | return false; |
| 1199 | } |
| 1200 | if ((apr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.) && (bpr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.)) { |
| 1201 | // bpr gets priority since he was in the game on exit |
| 1202 | return true; |
| 1203 | } |
| 1204 | // if we got here then both players were disconnected |
| 1205 | ascore = (astat) ? astat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0; |
| 1206 | bscore = (bstat) ? bstat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0; |
| 1207 | return (ascore < bscore); |
| 1208 | } |
| 1209 | |
| 1210 | void OnPLRInitcxx . . $ OnPLRInit(49f6e7a06ebc5aa8).(void) { |
| 1211 | int tempsort[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!]; |
| 1212 | int i, t, j; |
| 1213 | |
| 1214 | for (i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) { |
| 1215 | tempsort[i] = i; |
| 1216 | } |
| 1217 | |
| 1218 | for (i = 1; i <= MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`! - 1; i++) { |
| 1219 | t = tempsort[i]; |
| 1220 | // Shift elements down until |
| 1221 | // insertion point found. |
| 1222 | for (j = i - 1; j >= 0 && compare_slotscxx . . $ compare_slots(cf9ef193275fa6d8).(tempsort[j], t); j--) { |
| 1223 | tempsort[j + 1] = tempsort[j]; |
| 1224 | } |
| 1225 | // insert |
| 1226 | tempsort[j + 1] = t; |
| 1227 | } |
| 1228 | |
| 1229 | // copy the array over |
| 1230 | memcpy(SortedPlayerscxx . . $ SortedPlayers., tempsort, MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`! * sizeof(int)); |
| 1231 | |
| 1232 | // Now fill in the final structure of sorted names |
| 1233 | int TeamCount[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!]; |
| 1234 | int team; |
| 1235 | for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) |
| 1236 | TeamCount[i] = 0; |
| 1237 | for (i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) { |
| 1238 | int slot = SortedPlayerscxx . . $ SortedPlayers.[i]; |
| 1239 | player_recordcxx . . $ player_record# *pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(slot); |
| 1240 | if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) { |
| 1241 | |
| 1242 | if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr)) |
| 1243 | continue; // skip dedicated server |
| 1244 | |
| 1245 | team = (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) ? dPlayerscxx . . $ dPlayers.[pr->pnumcxx . . $ player_record#pnum.].teamcxx . . $ player#team. : pr->teamcxx . . $ player_record#team.; |
| 1246 | |
| 1247 | if (team >= CTFNumOfTeamscxx . . $ CTFNumOfTeams.) |
| 1248 | team = 0; |
| 1249 | |
| 1250 | SortedPLRPlayerscxx . . $ SortedPLRPlayers.[team][TeamCount[team]] = slot; |
| 1251 | |
| 1252 | TeamCount[team]++; |
| 1253 | } |
| 1254 | } |
| 1255 | for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) { |
| 1256 | if (TeamCount[i] < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!) |
| 1257 | SortedPLRPlayerscxx . . $ SortedPLRPlayers.[i][TeamCount[i]] = -1; |
| 1258 | } |
| 1259 | |
| 1260 | DMFCBasecxx . . $ DMFCBase.->OnPLRInitcxx . . $ IDMFC#OnPLRInit(49f6e7a06ebc5aa8).(); |
| 1261 | } |
| 1262 | |
| 1263 | void OnPLRIntervalcxx . . $ OnPLRInterval(49f6e7a06ebc5aa8).(void) { |
| 1264 | DMFCBasecxx . . $ DMFCBase.->OnPLRIntervalcxx . . $ IDMFC#OnPLRInterval(49f6e7a06ebc5aa8).(); |
| 1265 | |
| 1266 | int TeamCol = 35; |
| 1267 | int NameCol = 180; |
| 1268 | int PointsCol = 320; |
| 1269 | int KillsCol = 370; |
| 1270 | int DeathsCol = 410; |
| 1271 | int SuicidesCol = 450; |
| 1272 | int y = 40; |
| 1273 | int slot; |
| 1274 | bool had_members; |
| 1275 | player_recordcxx . . $ player_record# *pr; |
| 1276 | tPlayerStatcxx . . $ tPlayerStat# *stat; |
| 1277 | |
| 1278 | DLLgrtext_SetFont((DMFCBasecxx . . $ DMFCBase.->GetGameFontTranslateArraycxx . . $ IDMFC#GetGameFontTranslateArray(a7741f82f5fc3640).())[SMALL_UI_FONT_INDEXcxx . . $ `Descent3/gamefont.h:99:9`!]); |
| 1279 | |
| 1280 | int height = DLLgrfont_GetHeight((DMFCBasecxx . . $ DMFCBase.->GetGameFontTranslateArraycxx . . $ IDMFC#GetGameFontTranslateArray(a7741f82f5fc3640).())[SMALL_UI_FONT_INDEXcxx . . $ `Descent3/gamefont.h:99:9`!]) + 1; |
| 1281 | |
| 1282 | // print out header |
| 1283 | DLLgrtext_SetColor(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(255, 255, 150)); |
| 1284 | DLLgrtext_Printf(PointsCol, y, TXT_POINTScxx . . $ `netgames/ctf/CTFstr.h:52:9`!); |
| 1285 | DLLgrtext_Printf(NameCol, y, TXT_PILOTcxx . . $ `netgames/ctf/CTFstr.h:48:9`!); |
| 1286 | DLLgrtext_Printf(KillsCol, y, TXT_KILLS_SHORTcxx . . $ `netgames/ctf/CTFstr.h:68:9`!); |
| 1287 | DLLgrtext_Printf(DeathsCol, y, TXT_DEATHS_SHORTcxx . . $ `netgames/ctf/CTFstr.h:69:9`!); |
| 1288 | DLLgrtext_Printf(SuicidesCol, y, TXT_SUICIDES_SHORTcxx . . $ `netgames/ctf/CTFstr.h:70:9`!); |
| 1289 | y += height; |
| 1290 | |
| 1291 | bool doing_connected = true; |
| 1292 | |
| 1293 | do_disconnected_folk: |
| 1294 | |
| 1295 | for (int team = 0; team < CTFNumOfTeamscxx . . $ CTFNumOfTeams.; team++) { |
| 1296 | // process this team |
| 1297 | bool show_team_label; |
| 1298 | show_team_label = false; |
| 1299 | |
| 1300 | if (!doing_connected) { |
| 1301 | int temp_idx; |
| 1302 | temp_idx = 0; |
| 1303 | |
| 1304 | while (SortedPLRPlayerscxx . . $ SortedPLRPlayers.[team][temp_idx] != -1) { |
| 1305 | int pnum = DMFCBasecxx . . $ DMFCBase.->WasPlayerInGameAtLevelEndcxx . . $ IDMFC#WasPlayerInGameAtLevelEnd(7864480464b09eea).(SortedPLRPlayerscxx . . $ SortedPLRPlayers.[team][temp_idx]); |
| 1306 | if (pnum == -1) { |
| 1307 | show_team_label = true; |
| 1308 | break; |
| 1309 | } |
| 1310 | temp_idx++; |
| 1311 | } |
| 1312 | } else { |
| 1313 | show_team_label = true; |
| 1314 | } |
| 1315 | |
| 1316 | if (show_team_label) { |
| 1317 | // is there anyone on this team? |
| 1318 | DLLgrtext_SetColor(DMFCBasecxx . . $ DMFCBase.->GetTeamColorcxx . . $ IDMFC#GetTeamColor(46cc46841198e427).(team)); |
| 1319 | DLLgrtext_Printf(TeamCol, y, TXT_TEAMSCOREFORMcxx . . $ `netgames/ctf/CTFstr.h:44:9`!, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team), TeamScorescxx . . $ TeamScores.[team], |
| 1320 | OverallTeamScorescxx . . $ OverallTeamScores.[team]); |
| 1321 | } |
| 1322 | had_members = false; |
| 1323 | |
| 1324 | for (int index = 0; index < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; index++) { |
| 1325 | // get the player num |
| 1326 | slot = SortedPLRPlayerscxx . . $ SortedPLRPlayers.[team][index]; |
| 1327 | if (slot == -1) // we are done with this team |
| 1328 | break; |
| 1329 | |
| 1330 | pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(slot); |
| 1331 | if (!pr || pr->statecxx . . $ player_record#state. == STATE_EMPTYcxx . . $ STATE_EMPTY.) |
| 1332 | continue; |
| 1333 | |
| 1334 | if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr)) |
| 1335 | continue; |
| 1336 | |
| 1337 | if ((doing_connected && DMFCBasecxx . . $ DMFCBase.->WasPlayerInGameAtLevelEndcxx . . $ IDMFC#WasPlayerInGameAtLevelEnd(7864480464b09eea).(slot) == -1) || |
| 1338 | (!doing_connected && DMFCBasecxx . . $ DMFCBase.->WasPlayerInGameAtLevelEndcxx . . $ IDMFC#WasPlayerInGameAtLevelEnd(7864480464b09eea).(slot) != -1)) |
| 1339 | continue; // we're not handling them right now |
| 1340 | |
| 1341 | stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.; |
| 1342 | |
| 1343 | int pnum = DMFCBasecxx . . $ DMFCBase.->WasPlayerInGameAtLevelEndcxx . . $ IDMFC#WasPlayerInGameAtLevelEnd(7864480464b09eea).(slot); |
| 1344 | if (pnum != -1) { |
| 1345 | DLLgrtext_SetColor(DMFCBasecxx . . $ DMFCBase.->GetTeamColorcxx . . $ IDMFC#GetTeamColor(46cc46841198e427).(team)); |
| 1346 | } else { |
| 1347 | DLLgrtext_SetColor(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(128, 128, 128)); |
| 1348 | } |
| 1349 | |
| 1350 | // valid player |
| 1351 | char temp[120]; |
| 1352 | snprintf(temp, sizeof(temp), "%s", pr->callsigncxx . . $ player_record#callsign.); |
| 1353 | DMFCBasecxx . . $ DMFCBase.->ClipStringcxx . . $ IDMFC#ClipString(8677479218165cd4).(PointsCol - NameCol - 10, temp, true); |
| 1354 | |
| 1355 | DLLgrtext_Printf(NameCol, y, "%s", temp); |
| 1356 | DLLgrtext_Printf(PointsCol, y, "%d", (stat) ? stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0); |
| 1357 | DLLgrtext_Printf(KillsCol, y, "%d", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]); |
| 1358 | DLLgrtext_Printf(DeathsCol, y, "%d", pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]); |
| 1359 | DLLgrtext_Printf(SuicidesCol, y, "%d", pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]); |
| 1360 | y += height; |
| 1361 | |
| 1362 | if (y >= 440) |
| 1363 | goto quick_exit; |
| 1364 | |
| 1365 | had_members = true; |
| 1366 | |
| 1367 | } // end for |
| 1368 | |
| 1369 | if (!had_members) { |
| 1370 | // skip a line |
| 1371 | y += height; |
| 1372 | |
| 1373 | if (y >= 440) |
| 1374 | goto quick_exit; |
| 1375 | } |
| 1376 | // on to the next team |
| 1377 | } // end for |
| 1378 | |
| 1379 | if (doing_connected) { |
| 1380 | doing_connected = false; |
| 1381 | goto do_disconnected_folk; |
| 1382 | } |
| 1383 | |
| 1384 | quick_exit:; |
| 1385 | } |
| 1386 | |
| 1387 | void SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(char *filename) { |
| 1388 | CFILEcxx . . $ CFILE# *file; |
| 1389 | DLLOpenCFILE(&file, filenamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "wt"); |
| 1390 | if (!file) { |
| 1391 | DLLmprintfcxx . . $ `netgames/includes/DMFC.h:343:9`!(0, "Unable to open output file\n"); |
| 1392 | return; |
| 1393 | } |
| 1394 | |
| 1395 | // write out game stats |
| 1396 | #define BUFSIZEcxx . . $ `netgames/ctf/ctf.cpp:1396:9`! 150 |
| 1397 | char buffer[BUFSIZEcxx . . $ `netgames/ctf/ctf.cpp:1396:9`!]; |
| 1398 | char tempbuffer[25]; |
| 1399 | int sortedslots[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!]; |
| 1400 | player_recordcxx . . $ player_record# *pr, *dpr; |
| 1401 | tPInfoStatcxx . . $ tPInfoStat# stat; |
| 1402 | tPlayerStatcxx . . $ tPlayerStat# *ps; |
| 1403 | int count, p; |
| 1404 | int team; |
| 1405 | |
| 1406 | // sort the stats |
| 1407 | DMFCBasecxx . . $ DMFCBase.->GetSortedPlayerSlotscxx . . $ IDMFC#GetSortedPlayerSlots(621ccea12ecf5b06).(sortedslots, MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!); |
| 1408 | |
| 1409 | int i, t, j; |
| 1410 | |
| 1411 | for (i = 0; i < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; i++) { |
| 1412 | sortedslots[i] = i; |
| 1413 | } |
| 1414 | |
| 1415 | for (i = 1; i <= MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`! - 1; i++) { |
| 1416 | t = sortedslots[i]; |
| 1417 | // Shift elements down until |
| 1418 | // insertion point found. |
| 1419 | for (j = i - 1; j >= 0 && compare_slotscxx . . $ compare_slots(cf9ef193275fa6d8).(sortedslots[j], t); j--) { |
| 1420 | sortedslots[j + 1] = sortedslots[j]; |
| 1421 | } |
| 1422 | // insert |
| 1423 | sortedslots[j + 1] = t; |
| 1424 | } |
| 1425 | |
| 1426 | count = 1; |
| 1427 | |
| 1428 | snprintf(buffer, sizeof(buffer), TXT_STAT_HEADINGcxx . . $ `netgames/ctf/CTFstr.h:61:9`!, (DMFCBasecxx . . $ DMFCBase.->GetNetgameInfocxx . . $ IDMFC#GetNetgameInfo(242e78cd5130aa12).())->namecxx . . $ netgame_info#name., |
| 1429 | (DMFCBasecxx . . $ DMFCBase.->GetCurrentMissioncxx . . $ IDMFC#GetCurrentMission(d7a4f7ca6f9cb411).())->cur_levelcxx . . $ tMission#cur_level.); |
| 1430 | DLLcf_WriteString(file, buffer); |
| 1431 | |
| 1432 | for (i = 0; i < DMFCBasecxx . . $ DMFCBase.->GetNumTeamscxx . . $ IDMFC#GetNumTeams(b126dc7c1de90089).(); i++) { |
| 1433 | int team = SortedTeamscxx . . $ SortedTeams.[i]; |
| 1434 | |
| 1435 | snprintf(buffer, sizeof(buffer), "%s: %d[%d]", DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team), TeamScorescxx . . $ TeamScores.[team], |
| 1436 | OverallTeamScorescxx . . $ OverallTeamScores.[team]); |
| 1437 | DLLcf_WriteString(file, buffer); |
| 1438 | } |
| 1439 | strcpy(buffer, "\r\n"); |
| 1440 | DLLcf_WriteString(file, buffer); |
| 1441 | |
| 1442 | // Write team members |
| 1443 | DLLcf_WriteString(file, ""); // blank line |
| 1444 | for (t = 0; t < DMFCBasecxx . . $ DMFCBase.->GetNumTeamscxx . . $ IDMFC#GetNumTeams(b126dc7c1de90089).(); t++) { |
| 1445 | int team_i = SortedTeamscxx . . $ SortedTeams.[t]; |
| 1446 | |
| 1447 | snprintf(buffer, sizeof(buffer), "%s:", DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team_i)); |
| 1448 | DLLcf_WriteString(file, buffer); |
| 1449 | |
| 1450 | for (p = 0; p < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; p++) { |
| 1451 | pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(sortedslots[p]); |
| 1452 | if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) { |
| 1453 | |
| 1454 | if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr)) |
| 1455 | continue; // skip dedicated server |
| 1456 | |
| 1457 | if (pr->teamcxx . . $ player_record#team. == team_i) { // Check if current team |
| 1458 | snprintf(buffer, sizeof(buffer), " %s", pr->callsigncxx . . $ player_record#callsign.); |
| 1459 | DLLcf_WriteString(file, buffer); |
| 1460 | } |
| 1461 | } |
| 1462 | } |
| 1463 | } |
| 1464 | DLLcf_WriteString(file, ""); // blank line |
| 1465 | |
| 1466 | snprintf(buffer, sizeof(buffer), "%s", TXT_STAT_HEADINGAcxx . . $ `netgames/ctf/CTFstr.h:62:9`!); |
| 1467 | DLLcf_WriteString(file, buffer); |
| 1468 | strcpy(buffer, "--------------------------------------------------------------------------------------------------"); |
| 1469 | DLLcf_WriteString(file, buffer); |
| 1470 | |
| 1471 | for (int pslot = 0; pslot < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; pslot++) { |
| 1472 | int real_slot = sortedslots[pslot]; |
| 1473 | pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(real_slot); |
| 1474 | if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) { |
| 1475 | |
| 1476 | if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr)) |
| 1477 | continue; // skip dedicated server |
| 1478 | |
| 1479 | // we have a valid play |
| 1480 | ps = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.; |
| 1481 | memset(buffer, ' ', BUFSIZEcxx . . $ `netgames/ctf/ctf.cpp:1396:9`!); |
| 1482 | |
| 1483 | team = pr->teamcxx . . $ player_record#team.; |
| 1484 | |
| 1485 | snprintf(tempbuffer, sizeof(tempbuffer), "%d)", count); |
| 1486 | memcpy(&buffer[0], tempbuffer, strlen(tempbuffer)); |
| 1487 | |
| 1488 | snprintf(tempbuffer, sizeof(tempbuffer), "%.6s", DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team)); |
| 1489 | memcpy(&buffer[5], tempbuffer, strlen(tempbuffer)); |
| 1490 | |
| 1491 | snprintf(tempbuffer, sizeof(tempbuffer), "%s%s", (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) ? "" : "*", pr->callsigncxx . . $ player_record#callsign.); |
| 1492 | memcpy(&buffer[12], tempbuffer, strlen(tempbuffer)); |
| 1493 | |
| 1494 | if (ps) { |
| 1495 | snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", ps->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!], ps->Scorecxx . . $ tPlayerStat#Score.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]); |
| 1496 | memcpy(&buffer[41], tempbuffer, strlen(tempbuffer)); |
| 1497 | } |
| 1498 | |
| 1499 | snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!], |
| 1500 | pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]); |
| 1501 | memcpy(&buffer[53], tempbuffer, strlen(tempbuffer)); |
| 1502 | |
| 1503 | snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!], |
| 1504 | pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]); |
| 1505 | memcpy(&buffer[65], tempbuffer, strlen(tempbuffer)); |
| 1506 | |
| 1507 | snprintf(tempbuffer, sizeof(tempbuffer), "%d[%d]", pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!], |
| 1508 | pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_OVERALLcxx . . $ `netgames/includes/DMFC.h:528:9`!]); |
| 1509 | memcpy(&buffer[76], tempbuffer, strlen(tempbuffer)); |
| 1510 | |
| 1511 | snprintf(tempbuffer, sizeof(tempbuffer), "%s", DMFCBasecxx . . $ DMFCBase.->GetTimeStringcxx . . $ IDMFC#GetTimeString(3b344d7a46e3c2ff).(DMFCBasecxx . . $ DMFCBase.->GetTimeInGamecxx . . $ IDMFC#GetTimeInGame(5cde91ea12d43f46).(real_slot))); |
| 1512 | memcpy(&buffer[86], tempbuffer, strlen(tempbuffer)); |
| 1513 | |
| 1514 | size_t pos = 86 + strlen(tempbuffer) + 1; |
| 1515 | if (pos < BUFSIZEcxx . . $ `netgames/ctf/ctf.cpp:1396:9`!) |
| 1516 | buffer[pos] = '\0'; |
| 1517 | |
| 1518 | buffer[BUFSIZEcxx . . $ `netgames/ctf/ctf.cpp:1396:9`! - 1] = '\0'; |
| 1519 | DLLcf_WriteString(file, buffer); |
| 1520 | |
| 1521 | count++; |
| 1522 | } |
| 1523 | } // end for |
| 1524 | |
| 1525 | DLLcf_WriteString(file, TXT_STAT_HEADINGBcxx . . $ `netgames/ctf/CTFstr.h:64:9`!); |
| 1526 | |
| 1527 | count = 1; |
| 1528 | for (int s = 0; s < MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; s++) { |
| 1529 | p = sortedslots[s]; |
| 1530 | pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(p); |
| 1531 | if (pr && pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.) { |
| 1532 | |
| 1533 | if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr)) |
| 1534 | continue; // skip dedicated server |
| 1535 | |
| 1536 | // Write out header |
| 1537 | snprintf(buffer, sizeof(buffer), "%d) %s%s", count, (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) ? "" : "*", pr->callsigncxx . . $ player_record#callsign.); |
| 1538 | DLLcf_WriteString(file, buffer); |
| 1539 | size_t length = strlen(buffer); |
| 1540 | memset(buffer, '=', length); |
| 1541 | buffer[length] = '\0'; |
| 1542 | DLLcf_WriteString(file, buffer); |
| 1543 | |
| 1544 | // time in game |
| 1545 | snprintf(buffer, sizeof(buffer), TXT_STAT_TIGcxx . . $ `netgames/ctf/CTFstr.h:65:9`!, DMFCBasecxx . . $ DMFCBase.->GetTimeStringcxx . . $ IDMFC#GetTimeString(3b344d7a46e3c2ff).(DMFCBasecxx . . $ DMFCBase.->GetTimeInGamecxx . . $ IDMFC#GetTimeInGame(5cde91ea12d43f46).(p))); |
| 1546 | DLLcf_WriteString(file, buffer); |
| 1547 | |
| 1548 | if (DMFCBasecxx . . $ DMFCBase.->FindPInfoStatFirstcxx . . $ IDMFC#FindPInfoStatFirst(e8124cb919632806).(p, &stat)) { |
| 1549 | snprintf(buffer, sizeof(buffer), "%s", TXT_STAT_HEADINGCcxx . . $ `netgames/ctf/CTFstr.h:66:9`!); |
| 1550 | DLLcf_WriteString(file, buffer); |
| 1551 | |
| 1552 | if (stat.slotcxx . . $ tPInfoStat#slot. != p) { |
| 1553 | memset(buffer, ' ', BUFSIZEcxx . . $ `netgames/ctf/ctf.cpp:1396:9`!); |
| 1554 | dpr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(stat.slotcxx . . $ tPInfoStat#slot.); |
| 1555 | |
| 1556 | if (dpr) { |
| 1557 | snprintf(tempbuffer, sizeof(tempbuffer), "%s", dpr->callsigncxx . . $ player_record#callsign.); |
| 1558 | memcpy(buffer, tempbuffer, strlen(tempbuffer)); |
| 1559 | |
| 1560 | snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.killscxx . . $ tPInfoStat#kills.); |
| 1561 | memcpy(&buffer[30], tempbuffer, strlen(tempbuffer)); |
| 1562 | |
| 1563 | snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.deathscxx . . $ tPInfoStat#deaths.); |
| 1564 | memcpy(&buffer[40], tempbuffer, strlen(tempbuffer)); |
| 1565 | |
| 1566 | size_t pos = 40 + strlen(tempbuffer) + 1; |
| 1567 | if (pos < BUFSIZEcxx . . $ `netgames/ctf/ctf.cpp:1396:9`!) |
| 1568 | buffer[pos] = '\0'; |
| 1569 | |
| 1570 | buffer[BUFSIZEcxx . . $ `netgames/ctf/ctf.cpp:1396:9`! - 1] = '\0'; |
| 1571 | DLLcf_WriteString(file, buffer); |
| 1572 | } |
| 1573 | } |
| 1574 | |
| 1575 | while (DMFCBasecxx . . $ DMFCBase.->FindPInfoStatNextcxx . . $ IDMFC#FindPInfoStatNext(4ead3766c292904).(&stat)) { |
| 1576 | if (stat.slotcxx . . $ tPInfoStat#slot. != p) { |
| 1577 | memset(buffer, ' ', BUFSIZEcxx . . $ `netgames/ctf/ctf.cpp:1396:9`!); |
| 1578 | dpr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(stat.slotcxx . . $ tPInfoStat#slot.); |
| 1579 | if (dpr) { |
| 1580 | snprintf(tempbuffer, sizeof(tempbuffer), "%s", dpr->callsigncxx . . $ player_record#callsign.); |
| 1581 | memcpy(buffer, tempbuffer, strlen(tempbuffer)); |
| 1582 | |
| 1583 | snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.killscxx . . $ tPInfoStat#kills.); |
| 1584 | memcpy(&buffer[30], tempbuffer, strlen(tempbuffer)); |
| 1585 | |
| 1586 | snprintf(tempbuffer, sizeof(tempbuffer), "%d", stat.deathscxx . . $ tPInfoStat#deaths.); |
| 1587 | memcpy(&buffer[40], tempbuffer, strlen(tempbuffer)); |
| 1588 | |
| 1589 | size_t pos = 40 + strlen(tempbuffer) + 1; |
| 1590 | if (pos < BUFSIZEcxx . . $ `netgames/ctf/ctf.cpp:1396:9`!) |
| 1591 | buffer[pos] = '\0'; |
| 1592 | |
| 1593 | buffer[BUFSIZEcxx . . $ `netgames/ctf/ctf.cpp:1396:9`! - 1] = '\0'; |
| 1594 | DLLcf_WriteString(file, buffer); |
| 1595 | } |
| 1596 | } |
| 1597 | } |
| 1598 | } |
| 1599 | DMFCBasecxx . . $ DMFCBase.->FindPInfoStatClosecxx . . $ IDMFC#FindPInfoStatClose(49f6e7a06ebc5aa8).(); |
| 1600 | DLLcf_WriteString(file, ""); // skip a line |
| 1601 | count++; |
| 1602 | } |
| 1603 | } |
| 1604 | |
| 1605 | // done writing stats |
| 1606 | DLLcfclose(file); |
| 1607 | DLLAddHUDMessage(TXT_STAT_SAVEDcxx . . $ `netgames/ctf/CTFstr.h:67:9`!); |
| 1608 | } |
| 1609 | |
| 1610 | #define ROOTFILENAMEcxx . . $ `netgames/ctf/ctf.cpp:1610:9`! "CTF" |
| 1611 | void OnSaveStatsToFilecxx . . $ OnSaveStatsToFile(49f6e7a06ebc5aa8).(void) { |
| 1612 | char filename[256]; |
| 1613 | DMFCBasecxx . . $ DMFCBase.->GenerateStatFilenamecxx . . $ IDMFC#GenerateStatFilename(4d4dad76095ad7d8).(filename, ROOTFILENAMEcxx . . $ `netgames/ctf/ctf.cpp:1610:9`!, false); |
| 1614 | SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(filename); |
| 1615 | } |
| 1616 | |
| 1617 | void OnLevelEndSaveStatsToFilecxx . . $ OnLevelEndSaveStatsToFile(49f6e7a06ebc5aa8).(void) { |
| 1618 | char filename[256]; |
| 1619 | DMFCBasecxx . . $ DMFCBase.->GenerateStatFilenamecxx . . $ IDMFC#GenerateStatFilename(4d4dad76095ad7d8).(filename, ROOTFILENAMEcxx . . $ `netgames/ctf/ctf.cpp:1610:9`!, true); |
| 1620 | SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(filename); |
| 1621 | } |
| 1622 | |
| 1623 | void OnDisconnectSaveStatsToFilecxx . . $ OnDisconnectSaveStatsToFile(49f6e7a06ebc5aa8).(void) { |
| 1624 | char filename[256]; |
| 1625 | DMFCBasecxx . . $ DMFCBase.->GenerateStatFilenamecxx . . $ IDMFC#GenerateStatFilename(4d4dad76095ad7d8).(filename, ROOTFILENAMEcxx . . $ `netgames/ctf/ctf.cpp:1610:9`!, false); |
| 1626 | SaveStatsToFilecxx . . $ SaveStatsToFile(fda57c8427c60377).(filename); |
| 1627 | } |
| 1628 | |
| 1629 | void OnPrintScorescxx . . $ OnPrintScores(d4f767463ce0a6b3).(int level) { |
| 1630 | char buffer[256]; |
| 1631 | char name[70]; |
| 1632 | size_t t; |
| 1633 | size_t pos[6]; |
| 1634 | size_t len[6]; |
| 1635 | |
| 1636 | for (int i = 0; i < CTFNumOfTeamscxx . . $ CTFNumOfTeams.; i++) { |
| 1637 | snprintf(buffer, sizeof(buffer), "%s:%d\n", DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(i), TeamScorescxx . . $ TeamScores.[i]); |
| 1638 | DPrintf(buffer); |
| 1639 | } |
| 1640 | |
| 1641 | memset(buffer, ' ', 256); |
| 1642 | pos[0] = 0; |
| 1643 | t = len[0] = 30; // give ample room for pilot name |
| 1644 | pos[1] = pos[0] + t + 1; |
| 1645 | t = len[1] = strlen(TXT_POINTScxx . . $ `netgames/ctf/CTFstr.h:52:9`!); |
| 1646 | pos[2] = pos[1] + t + 1; |
| 1647 | t = len[2] = strlen(TXT_KILLS_SHORTcxx . . $ `netgames/ctf/CTFstr.h:68:9`!); |
| 1648 | pos[3] = pos[2] + t + 1; |
| 1649 | t = len[3] = strlen(TXT_DEATHS_SHORTcxx . . $ `netgames/ctf/CTFstr.h:69:9`!); |
| 1650 | pos[4] = pos[3] + t + 1; |
| 1651 | t = len[4] = strlen(TXT_SUICIDES_SHORTcxx . . $ `netgames/ctf/CTFstr.h:70:9`!); |
| 1652 | pos[5] = pos[4] + t + 1; |
| 1653 | t = len[5] = strlen(TXT_PINGcxx . . $ `netgames/ctf/CTFstr.h:54:9`!); |
| 1654 | |
| 1655 | memcpy(&buffer[pos[0]], TXT_PILOTcxx . . $ `netgames/ctf/CTFstr.h:48:9`!, strlen(TXT_PILOTcxx . . $ `netgames/ctf/CTFstr.h:48:9`!)); |
| 1656 | memcpy(&buffer[pos[1]], TXT_POINTScxx . . $ `netgames/ctf/CTFstr.h:52:9`!, len[1]); |
| 1657 | memcpy(&buffer[pos[2]], TXT_KILLS_SHORTcxx . . $ `netgames/ctf/CTFstr.h:68:9`!, len[2]); |
| 1658 | memcpy(&buffer[pos[3]], TXT_DEATHS_SHORTcxx . . $ `netgames/ctf/CTFstr.h:69:9`!, len[3]); |
| 1659 | memcpy(&buffer[pos[4]], TXT_SUICIDES_SHORTcxx . . $ `netgames/ctf/CTFstr.h:70:9`!, len[4]); |
| 1660 | memcpy(&buffer[pos[5]], TXT_PINGcxx . . $ `netgames/ctf/CTFstr.h:54:9`!, len[5]); |
| 1661 | buffer[pos[5] + len[5] + 1] = '\n'; |
| 1662 | buffer[pos[5] + len[5] + 2] = '\0'; |
| 1663 | DPrintf(buffer); |
| 1664 | |
| 1665 | int slot; |
| 1666 | player_recordcxx . . $ player_record# *pr; |
| 1667 | int pcount; |
| 1668 | |
| 1669 | if (level < 0 || level >= MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!) |
| 1670 | pcount = MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!; |
| 1671 | else |
| 1672 | pcount = level; |
| 1673 | |
| 1674 | int sortedplayers[MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!]; |
| 1675 | DMFCBasecxx . . $ DMFCBase.->GetSortedPlayerSlotscxx . . $ IDMFC#GetSortedPlayerSlots(621ccea12ecf5b06).(sortedplayers, MAX_PLAYER_RECORDScxx . . $ `netgames/includes/DMFC.h:526:9`!); |
| 1676 | |
| 1677 | for (int i = 0; i < pcount; i++) { |
| 1678 | slot = sortedplayers[i]; |
| 1679 | pr = DMFCBasecxx . . $ DMFCBase.->GetPlayerRecordcxx . . $ IDMFC#GetPlayerRecord(6359c6f28dd028ae).(slot); |
| 1680 | if ((pr) && (pr->statecxx . . $ player_record#state. != STATE_EMPTYcxx . . $ STATE_EMPTY.)) { |
| 1681 | |
| 1682 | if (DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(6a9c0d4ad435bebf).(pr)) |
| 1683 | continue; // skip dedicated server |
| 1684 | |
| 1685 | snprintf(name, sizeof(name), "%s%s: %.8s", (pr->statecxx . . $ player_record#state. == STATE_DISCONNECTEDcxx . . $ STATE_DISCONNECTED.) ? "*" : "", pr->callsigncxx . . $ player_record#callsign., |
| 1686 | DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(pr->teamcxx . . $ player_record#team.)); |
| 1687 | name[29] = '\0'; |
| 1688 | |
| 1689 | tPlayerStatcxx . . $ tPlayerStat# *stat; |
| 1690 | stat = (tPlayerStatcxx . . $ tPlayerStat# *)pr->user_infocxx . . $ player_record#user_info.; |
| 1691 | |
| 1692 | memset(buffer, ' ', 256); |
| 1693 | t = strlen(name); |
| 1694 | memcpy(&buffer[pos[0]], name, (t < len[0]) ? t : len[0]); |
| 1695 | snprintf(name, sizeof(name), "%d", (stat) ? stat->Scorecxx . . $ tPlayerStat#Score.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!] : 0); |
| 1696 | t = strlen(name); |
| 1697 | memcpy(&buffer[pos[1]], name, (t < len[1]) ? t : len[1]); |
| 1698 | snprintf(name, sizeof(name), "%d", pr->dstatscxx . . $ player_record#dstats..killscxx . . $ t_dstat#kills.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]); |
| 1699 | t = strlen(name); |
| 1700 | memcpy(&buffer[pos[2]], name, (t < len[2]) ? t : len[2]); |
| 1701 | snprintf(name, sizeof(name), "%d", pr->dstatscxx . . $ player_record#dstats..deathscxx . . $ t_dstat#deaths.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]); |
| 1702 | t = strlen(name); |
| 1703 | memcpy(&buffer[pos[3]], name, (t < len[3]) ? t : len[3]); |
| 1704 | snprintf(name, sizeof(name), "%d", pr->dstatscxx . . $ player_record#dstats..suicidescxx . . $ t_dstat#suicides.[DSTAT_LEVELcxx . . $ `netgames/includes/DMFC.h:527:9`!]); |
| 1705 | t = strlen(name); |
| 1706 | memcpy(&buffer[pos[4]], name, (t < len[4]) ? t : len[4]); |
| 1707 | |
| 1708 | if (pr->statecxx . . $ player_record#state. == STATE_INGAMEcxx . . $ STATE_INGAME.) |
| 1709 | snprintf(name, sizeof(name), "%.0f", dNetPlayerscxx . . $ dNetPlayers.[pr->pnumcxx . . $ player_record#pnum.].ping_timecxx . . $ netplayer#ping_time. * 1000.0f); |
| 1710 | else |
| 1711 | strcpy(name, "---"); |
| 1712 | t = strlen(name); |
| 1713 | memcpy(&buffer[pos[5]], name, (t < len[5]) ? t : len[5]); |
| 1714 | buffer[pos[5] + len[5] + 1] = '\n'; |
| 1715 | buffer[pos[5] + len[5] + 2] = '\0'; |
| 1716 | DPrintf(buffer); |
| 1717 | } |
| 1718 | } |
| 1719 | } |
| 1720 | |
| 1721 | // DMFCApp::HandlePlayerSpew |
| 1722 | // |
| 1723 | // If a player dies, becomes an observer or disconnects, it's possible that they |
| 1724 | // have a flag or more. This function will handle setting certain variables, timer |
| 1725 | // and other various settings related to a flag spew |
| 1726 | void HandlePlayerSpewcxx . . $ HandlePlayerSpew(d4f767463ce0a6b3).(int pnum) { |
| 1727 | // Handle dropping the flag if the player had one |
| 1728 | uint8_tcxx . . $ uint8_t# flaginfo = GetFlagCountForPlayercxx . . $ GetFlagCountForPlayer(7864480464b09eea).(pnum); |
| 1729 | uint8_tcxx . . $ uint8_t# flagmask = GetFlagMaskForPlayercxx . . $ GetFlagMaskForPlayer(bc0fba5608a0bfe7).(pnum); |
| 1730 | |
| 1731 | if (flaginfo == 0) { |
| 1732 | return; |
| 1733 | } |
| 1734 | |
| 1735 | // Ok the player has flags, lets make sure everything that needs to happen, happens |
| 1736 | // 1) We need to clear flags and colored ball indicator |
| 1737 | // 2) If they are dying in a homebase of one of the flags they have, than set the |
| 1738 | // flag home. |
| 1739 | // 3) Start a timer if the flag spews outside of a base |
| 1740 | |
| 1741 | // If we got here than the player has a flag |
| 1742 | vectorcxx . . $ vector# fpos; // used to hold the center pos of the room |
| 1743 | |
| 1744 | bool play_lose = false; // set true if the player lost a flag (ummm, this is guaranteed) |
| 1745 | |
| 1746 | // loop through all the possible flags and check to see what they had |
| 1747 | for (int color = 0; color < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; color++) { |
| 1748 | // check if the ID exists, and if this player had that color flag |
| 1749 | if ((FlagIDscxx . . $ FlagIDs.[color] != -1) && (flagmask & 0x01)) { |
| 1750 | |
| 1751 | play_lose = true; |
| 1752 | |
| 1753 | // now check to see if they are in the flag's home goal |
| 1754 | if (GoalRoomscxx . . $ GoalRooms.[color] == dObjectscxx . . $ dObjects.[pnum].roomnumcxx . . $ object#roomnum.) { |
| 1755 | // we are! |
| 1756 | // so remove the flag from the inventory (so it don't get spewed) |
| 1757 | DLLInvRemove(pnum, OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, FlagIDscxx . . $ FlagIDs.[color]); |
| 1758 | DoFlagReturnedHomecxx . . $ DoFlagReturnedHome(d4f767463ce0a6b3).(color); |
| 1759 | |
| 1760 | // set the at home flag |
| 1761 | FlagAtHomecxx . . $ FlagAtHome.[color] = true; |
| 1762 | if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) { |
| 1763 | // if we are the server put the flag back in the center of the goal and tell all the players to do the same |
| 1764 | DLLComputeRoomCenter(&fpos, &dRoomscxx . . $ dRooms.[GoalRoomscxx . . $ GoalRooms.[color]]); |
| 1765 | int objnum = DLLObjCreate(OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, FlagIDscxx . . $ FlagIDs.[color], GoalRoomscxx . . $ GoalRooms.[color], &fpos, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!); |
| 1766 | DLLMultiSendObject(&dObjectscxx . . $ dObjects.[objnum], 1, true); |
| 1767 | } |
| 1768 | } else { |
| 1769 | // ok the flag is spewing out into the great beyond |
| 1770 | // Start the timer! |
| 1771 | Flag_timeout_timerscxx . . $ Flag_timeout_timers.[color] = DMFCBasecxx . . $ DMFCBase.->GetGametimecxx . . $ IDMFC#GetGametime(9b8c9e39889c762c).() + FLAG_TIMEOUT_VALUEcxx . . $ `netgames/ctf/ctf.cpp:118:9`!; |
| 1772 | } |
| 1773 | |
| 1774 | // player has the flag |
| 1775 | LoseFlagForPlayercxx . . $ LoseFlagForPlayer(7170367bda245568).(pnum, color, false); |
| 1776 | } |
| 1777 | // rotate flagmask so it is pointing at the next bit |
| 1778 | flagmask = (flagmask >> 1); |
| 1779 | } |
| 1780 | |
| 1781 | // Reset colored balls |
| 1782 | SetColoredBallscxx . . $ SetColoredBalls(918ebd27a9ddbad3).(pnum, true); |
| 1783 | |
| 1784 | if (play_lose) |
| 1785 | DoLoseFlagcxx . . $ DoLoseFlag(d4f767463ce0a6b3).(DMFCBasecxx . . $ DMFCBase.->GetPlayerTeamcxx . . $ IDMFC#GetPlayerTeam(7864480464b09eea).(pnum)); |
| 1786 | } |
| 1787 | |
| 1788 | ///////////////////////////////////////////////////////////// |
| 1789 | // CTF Functions |
| 1790 | void DisplayHUDScorescxx . . $ DisplayHUDScores(c7a20e4e05358911).(struct tHUDItemcxx . . $ tHUDItem# *hitem) { |
| 1791 | if (display_my_welcomecxx . . $ display_my_welcome.) { |
| 1792 | // announce our arrival to ourselves (as server) |
| 1793 | DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()); |
| 1794 | display_my_welcomecxx . . $ display_my_welcome. = false; |
| 1795 | } |
| 1796 | |
| 1797 | if (!First_game_framecxx . . $ First_game_frame. || DisplayScoreScreencxx . . $ DisplayScoreScreen.) // interval hasn't been called yet or we are display the stats |
| 1798 | return; |
| 1799 | |
| 1800 | uint8_tcxx . . $ uint8_t# alpha = DMFCBasecxx . . $ DMFCBase.->ConvertHUDAlphacxx . . $ IDMFC#ConvertHUDAlpha(50106d451684defa).((uint8_tcxx . . $ uint8_t#)((DisplayScoreScreencxx . . $ DisplayScoreScreen.) ? 128 : 255)); |
| 1801 | |
| 1802 | int height = DLLgrfont_GetHeight((DMFCBasecxx . . $ DMFCBase.->GetGameFontTranslateArraycxx . . $ IDMFC#GetGameFontTranslateArray(a7741f82f5fc3640).())[HUD_FONT_INDEXcxx . . $ `Descent3/gamefont.h:97:9`!]) + 3; |
| 1803 | |
| 1804 | int y = 170; |
| 1805 | int x = 540; |
| 1806 | int team = DMFCBasecxx . . $ DMFCBase.->GetPlayerTeamcxx . . $ IDMFC#GetPlayerTeam(7864480464b09eea).(DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()); |
| 1807 | int myteam = team; |
| 1808 | int i; |
| 1809 | |
| 1810 | // Flag bitmaps |
| 1811 | // if (HasFlag[team]!=-1) then draw a dimmed flag with the team flag of who has it on top |
| 1812 | // if (HasFlag[team]==-1) && (FlagAtHome[team]==true) then draw normal flag |
| 1813 | // if (HasFlag[team]==-1) && (FlagAtHome[team]==false) then draw dimmed flag |
| 1814 | int cx, cy; |
| 1815 | for (i = 0; i < CTFNumOfTeamscxx . . $ CTFNumOfTeams.; i++) { |
| 1816 | // first determine the x and y |
| 1817 | switch (i) { |
| 1818 | case RED_TEAMcxx . . $ `netgames/includes/DMFC.h:427:9`!: |
| 1819 | cx = x; |
| 1820 | cy = height + 5; |
| 1821 | break; |
| 1822 | case BLUE_TEAMcxx . . $ `netgames/includes/DMFC.h:428:9`!: |
| 1823 | cx = x + 33; |
| 1824 | cy = height + 5; |
| 1825 | break; |
| 1826 | case GREEN_TEAMcxx . . $ `netgames/includes/DMFC.h:429:9`!: |
| 1827 | cx = x; |
| 1828 | cy = 2 * height + 41; |
| 1829 | break; |
| 1830 | case YELLOW_TEAMcxx . . $ `netgames/includes/DMFC.h:430:9`!: |
| 1831 | cx = x + 33; |
| 1832 | cy = 2 * height + 41; |
| 1833 | break; |
| 1834 | } |
| 1835 | |
| 1836 | if ((WhoJustFlaggedcxx . . $ WhoJustFlagged. != i) || (DisplayFlagBlinkcxx . . $ DisplayFlagBlink.)) { |
| 1837 | if (HasFlagcxx . . $ HasFlag.[i] != -1) { |
| 1838 | // draw dimmed flag with corner as the team who has the flag |
| 1839 | DLLRenderHUDQuad(cx, cy, DLLbm_w(DimFlagAHBmpcxx . . $ DimFlagAHBmp.[i], 0), DLLbm_h(DimFlagAHBmpcxx . . $ DimFlagAHBmp.[i], 0), 0, 0, 1, 1, DimFlagAHBmpcxx . . $ DimFlagAHBmp.[i], |
| 1840 | alpha, 0); |
| 1841 | DLLRenderHUDQuad(cx + 16, cy, 16, 16, 0, 0, 1, 1, FlagBmpcxx . . $ FlagBmp.[DMFCBasecxx . . $ DMFCBase.->GetPlayerTeamcxx . . $ IDMFC#GetPlayerTeam(7864480464b09eea).(HasFlagcxx . . $ HasFlag.[i])], alpha, 0); |
| 1842 | } else { |
| 1843 | if (FlagAtHomecxx . . $ FlagAtHome.[i]) { |
| 1844 | // draw normal flag |
| 1845 | DLLRenderHUDQuad(cx, cy, DLLbm_w(FlagAHBmpcxx . . $ FlagAHBmp.[i], 0), DLLbm_h(FlagAHBmpcxx . . $ FlagAHBmp.[i], 0), 0, 0, 1, 1, FlagAHBmpcxx . . $ FlagAHBmp.[i], alpha, |
| 1846 | 0); |
| 1847 | } else { |
| 1848 | // draw dimmed flag |
| 1849 | int f_height = DLLbm_h(DimFlagAHBmpcxx . . $ DimFlagAHBmp.[i], 0); |
| 1850 | DLLRenderHUDQuad(cx, cy, DLLbm_w(DimFlagAHBmpcxx . . $ DimFlagAHBmp.[i], 0), f_height, 0, 0, 1, 1, DimFlagAHBmpcxx . . $ DimFlagAHBmp.[i], alpha, 0); |
| 1851 | |
| 1852 | // Draw timeout time |
| 1853 | int time_left; |
| 1854 | time_left = (int)(Flag_timeout_timerscxx . . $ Flag_timeout_timers.[i] - DMFCBasecxx . . $ DMFCBase.->GetGametimecxx . . $ IDMFC#GetGametime(9b8c9e39889c762c).()); |
| 1855 | if (time_left > 0 && Flag_timeout_timerscxx . . $ Flag_timeout_timers.[i] != 0) { |
| 1856 | int minutes; |
| 1857 | minutes = time_left / 60; |
| 1858 | time_left = time_left % 60; |
| 1859 | DLLRenderHUDText(GR_GREENcxx . . $ GR_GREEN., alpha, 0, cx, cy + 2 + f_height, "%01d:%02d", minutes, time_left); |
| 1860 | } |
| 1861 | } |
| 1862 | } |
| 1863 | } |
| 1864 | } |
| 1865 | |
| 1866 | x = 520; |
| 1867 | |
| 1868 | if (Highlight_bmpcxx . . $ Highlight_bmp. <= BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) { |
| 1869 | // write the name of your team at the top of the screen since for some reason we don't a highlight bmp |
| 1870 | DLLRenderHUDText(DMFCBasecxx . . $ DMFCBase.->GetTeamColorcxx . . $ IDMFC#GetTeamColor(46cc46841198e427).(team), alpha, 0, x, y, TXT_TEAMFORMcxx . . $ `netgames/ctf/CTFstr.h:45:9`!, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team)); |
| 1871 | y += height; |
| 1872 | } |
| 1873 | |
| 1874 | // determine coordinates to use here |
| 1875 | // we'll use a virtual width of 85 pixels on a 640x480 screen |
| 1876 | // so first determine the new width |
| 1877 | int name_width = 85.0f * DMFCBasecxx . . $ DMFCBase.->GetHudAspectXcxx . . $ IDMFC#GetHudAspectX(9b8c9e39889c762c).(); |
| 1878 | int score_width = DLLgrtext_GetTextLineWidth("888"); |
| 1879 | int name_x = DMFCBasecxx . . $ DMFCBase.->GetGameWindowWcxx . . $ IDMFC#GetGameWindowW(b126dc7c1de90089).() - name_width - score_width - 10; |
| 1880 | int score_x = DMFCBasecxx . . $ DMFCBase.->GetGameWindowWcxx . . $ IDMFC#GetGameWindowW(b126dc7c1de90089).() - score_width - 5; |
| 1881 | y = (DMFCBasecxx . . $ DMFCBase.->GetGameWindowHcxx . . $ IDMFC#GetGameWindowH(b126dc7c1de90089).() / 2) - ((height * DMFCBasecxx . . $ DMFCBase.->GetNumTeamscxx . . $ IDMFC#GetNumTeams(b126dc7c1de90089).()) / 2); |
| 1882 | |
| 1883 | // draw the team scores |
| 1884 | for (team = 0; team < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; team++) { |
| 1885 | i = SortedTeamscxx . . $ SortedTeams.[team]; |
| 1886 | |
| 1887 | if (i >= CTFNumOfTeamscxx . . $ CTFNumOfTeams.) |
| 1888 | continue; |
| 1889 | |
| 1890 | if ((WhoJustScoredcxx . . $ WhoJustScored. != i) || (DisplayScoreBlinkcxx . . $ DisplayScoreBlink.)) { |
| 1891 | |
| 1892 | // determine the number of players on the team |
| 1893 | int num_players; |
| 1894 | num_players = 0; |
| 1895 | for (int w = 0; w < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; w++) { |
| 1896 | if (DMFCBasecxx . . $ DMFCBase.->CheckPlayerNumcxx . . $ IDMFC#CheckPlayerNum(83c267b20bac841a).(w) && dPlayerscxx . . $ dPlayers.[w].teamcxx . . $ player#team. == i && !DMFCBasecxx . . $ DMFCBase.->IsPlayerDedicatedServercxx . . $ IDMFC#IsPlayerDedicatedServer(83c267b20bac841a).(w)) |
| 1897 | num_players++; |
| 1898 | } |
| 1899 | |
| 1900 | if (i == myteam && Highlight_bmpcxx . . $ Highlight_bmp. > BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) { |
| 1901 | // draw the highlite bar in the background |
| 1902 | DLLrend_SetAlphaValue(alpha * 0.50f); |
| 1903 | DLLrend_SetZBufferState(0); |
| 1904 | DLLrend_SetTextureType(TT_LINEARcxx . . $ TT_LINEAR.); |
| 1905 | DLLrend_SetLighting(LS_NONEcxx . . $ LS_NONE.); |
| 1906 | DLLrend_SetAlphaType(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!); |
| 1907 | |
| 1908 | DLLrend_DrawScaledBitmap(name_x - 2, y - 2, score_x + score_width + 2, y + height - 1, Highlight_bmpcxx . . $ Highlight_bmp., 0, 0, 1, |
| 1909 | 1, 1.0, BITMAP_FORMAT_1555cxx . . $ `lib/bitmap.h:56:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1910 | DLLrend_SetZBufferState(1); |
| 1911 | } |
| 1912 | |
| 1913 | char team_name[MAX_TEAMNAME_LENcxx . . $ `netgames/includes/DMFC.h:443:9`! + 5]; |
| 1914 | snprintf(team_name, sizeof(team_name), "[%d]%s", num_players, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(i)); |
| 1915 | // DMFCBase->ClipString(615 - x - 10,team_name,true); |
| 1916 | // DLLRenderHUDText(DMFCBase->GetTeamColor(i),alpha,0,x,y,team_name); |
| 1917 | // DLLRenderHUDText(DMFCBase->GetTeamColor(i),alpha,0,615,y,"%d",TeamScores[i]); |
| 1918 | DMFCBasecxx . . $ DMFCBase.->ClipStringcxx . . $ IDMFC#ClipString(8677479218165cd4).(name_width, team_name, true); |
| 1919 | |
| 1920 | DLLgrtext_SetAlpha(alpha); |
| 1921 | DLLgrtext_SetColor(DMFCBasecxx . . $ DMFCBase.->GetTeamColorcxx . . $ IDMFC#GetTeamColor(46cc46841198e427).(i)); |
| 1922 | DLLgrtext_Printf(name_x, y, team_name); |
| 1923 | DLLgrtext_Printf(score_x, y, "%d", TeamScorescxx . . $ TeamScores.[i]); |
| 1924 | } |
| 1925 | y += height; |
| 1926 | } |
| 1927 | |
| 1928 | // draw the bitmap for any flags you have currently |
| 1929 | int flagcount; |
| 1930 | int flagmask; |
| 1931 | |
| 1932 | flagcount = GetFlagCountForPlayercxx . . $ GetFlagCountForPlayer(7864480464b09eea).(DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()); |
| 1933 | flagmask = GetFlagMaskForPlayercxx . . $ GetFlagMaskForPlayer(bc0fba5608a0bfe7).(DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()); |
| 1934 | |
| 1935 | if (flagcount == 0) |
| 1936 | return; |
| 1937 | |
| 1938 | y += 5; |
| 1939 | |
| 1940 | for (i = 0; i < CTFNumOfTeamscxx . . $ CTFNumOfTeams.; i++) { |
| 1941 | if (flagmask & 0x01) { |
| 1942 | // we have the flag |
| 1943 | DLLRenderHUDQuad(x, y, DLLbm_w(FlagBmpcxx . . $ FlagBmp.[i], 0) / 2, DLLbm_h(FlagBmpcxx . . $ FlagBmp.[i], 0) / 2, 0, 0, 1, 1, FlagBmpcxx . . $ FlagBmp.[i], alpha, 0); |
| 1944 | x += DLLbm_w(FlagBmpcxx . . $ FlagBmp.[i], 0) + 3; |
| 1945 | } |
| 1946 | // adjust the flagmask for the next flag |
| 1947 | flagmask = flagmask >> 1; |
| 1948 | } |
| 1949 | } |
| 1950 | |
| 1951 | #define compGTcxx . . $ `netgames/ctf/ctf.cpp:1951:9`!(a, b) (a < b) |
| 1952 | void SortTeamScorescxx . . $ SortTeamScores(ce8f7825f8908cfa).(int *sortedindex, int *scores) { |
| 1953 | int t; |
| 1954 | int i, j; |
| 1955 | |
| 1956 | // copy scores into scoreinfo array |
| 1957 | for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) { |
| 1958 | sortedindex[i] = i; |
| 1959 | } |
| 1960 | |
| 1961 | for (i = 1; i <= DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`! - 1; i++) { |
| 1962 | t = sortedindex[i]; |
| 1963 | |
| 1964 | // Shift elements down until |
| 1965 | // insertion point found. |
| 1966 | for (j = i - 1; j >= 0 && compGTcxx . . $ `netgames/ctf/ctf.cpp:1951:9`!(scores[sortedindex[j]], scores[t]); j--) { |
| 1967 | sortedindex[j + 1] = sortedindex[j]; |
| 1968 | } |
| 1969 | // insert |
| 1970 | sortedindex[j + 1] = t; |
| 1971 | } |
| 1972 | } |
| 1973 | |
| 1974 | void DisplayWelcomeMessagecxx . . $ DisplayWelcomeMessage(d4f767463ce0a6b3).(int player_num) { |
| 1975 | char name_buffer[64]; |
| 1976 | strcpy(name_buffer, (DMFCBasecxx . . $ DMFCBase.->GetPlayerscxx . . $ IDMFC#GetPlayers(51ff8e716a252304).())[player_num].callsigncxx . . $ player#callsign.); |
| 1977 | |
| 1978 | if (player_num == DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()) { |
| 1979 | DLLAddHUDMessage(TXT_WELCOMEcxx . . $ `netgames/ctf/CTFstr.h:46:9`!, name_buffer); |
| 1980 | } else { |
| 1981 | DLLAddHUDMessage(TXT_JOINEDcxx . . $ `netgames/ctf/CTFstr.h:47:9`!, name_buffer); |
| 1982 | } |
| 1983 | } |
| 1984 | |
| 1985 | // adds a colored ball to a player (without removing what he has already) |
| 1986 | void SetColoredBallscxx . . $ SetColoredBalls(918ebd27a9ddbad3).(int playernum, bool reset) { |
| 1987 | float redb[4]; |
| 1988 | float greenb[4]; |
| 1989 | float blueb[4]; |
| 1990 | |
| 1991 | if (reset) { |
| 1992 | DLLPlayerSetRotatingBall(playernum, 0, 0, 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`!); |
| 1993 | return; |
| 1994 | } |
| 1995 | |
| 1996 | int flagcount; |
| 1997 | int flagmask; |
| 1998 | |
| 1999 | bool red, blue, green, yellow; |
| 2000 | red = blue = green = yellow = false; |
| 2001 | |
| 2002 | flagcount = GetFlagCountForPlayercxx . . $ GetFlagCountForPlayer(7864480464b09eea).(playernum); |
| 2003 | flagmask = GetFlagMaskForPlayercxx . . $ GetFlagMaskForPlayer(bc0fba5608a0bfe7).(playernum); |
| 2004 | |
| 2005 | if (flagcount == 0) { |
| 2006 | DLLPlayerSetRotatingBall(playernum, 0, 0, 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`!); |
| 2007 | return; |
| 2008 | } |
| 2009 | |
| 2010 | if (flagmask & FLAGMASK_REDTEAMcxx . . $ `netgames/ctf/ctf.cpp:107:9`!) |
| 2011 | red = true; |
| 2012 | if (flagmask & FLAGMASK_BLUETEAMcxx . . $ `netgames/ctf/ctf.cpp:108:9`!) |
| 2013 | blue = true; |
| 2014 | if (flagmask & FLAGMASK_GREENTEAMcxx . . $ `netgames/ctf/ctf.cpp:109:9`!) |
| 2015 | green = true; |
| 2016 | if (flagmask & FLAGMASK_YELLOWTEAMcxx . . $ `netgames/ctf/ctf.cpp:110:9`!) |
| 2017 | yellow = true; |
| 2018 | |
| 2019 | for (int i = 0; i < flagcount; i++) { |
| 2020 | if (red) { |
| 2021 | red = false; |
| 2022 | redb[i] = 1; |
| 2023 | greenb[i] = 0; |
| 2024 | blueb[i] = 0; |
| 2025 | } else if (blue) { |
| 2026 | blue = false; |
| 2027 | redb[i] = 0; |
| 2028 | greenb[i] = 0; |
| 2029 | blueb[i] = 1; |
| 2030 | } else if (green) { |
| 2031 | green = false; |
| 2032 | redb[i] = 0; |
| 2033 | greenb[i] = 1; |
| 2034 | blueb[i] = 0; |
| 2035 | } else if (yellow) { |
| 2036 | yellow = false; |
| 2037 | redb[i] = 1; |
| 2038 | greenb[i] = 1; |
| 2039 | blueb[i] = 0; |
| 2040 | } |
| 2041 | } |
| 2042 | |
| 2043 | DLLPlayerSetRotatingBall(playernum, flagcount, 0, redb, greenb, blueb); |
| 2044 | } |
| 2045 | |
| 2046 | // Allows for dynamic changing of the number of teams in the game |
| 2047 | void ChangeNumberOfTeamscxx . . $ ChangeNumberOfTeams(d4f767463ce0a6b3).(int newsize) { |
| 2048 | CTFNumOfTeamscxx . . $ CTFNumOfTeams. = newsize; |
| 2049 | DMFCBasecxx . . $ DMFCBase.->SetNumberOfTeamscxx . . $ IDMFC#SetNumberOfTeams(d4f767463ce0a6b3).(CTFNumOfTeamscxx . . $ CTFNumOfTeams.); |
| 2050 | } |
| 2051 | |
| 2052 | void DoFlagReturnedHomecxx . . $ DoFlagReturnedHome(d4f767463ce0a6b3).(int team) { |
| 2053 | if (DMFCBasecxx . . $ DMFCBase.->GetPlayerTeamcxx . . $ IDMFC#GetPlayerTeam(7864480464b09eea).(DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()) == team) { |
| 2054 | if (snd_return_ownteamcxx . . $ snd_return_ownteam. != -1) |
| 2055 | DLLPlay2dSound(snd_return_ownteamcxx . . $ snd_return_ownteam., MAX_GAME_VOLUMEcxx . . $ `netgames/includes/gamedll_header.h:59:9`! / 2); |
| 2056 | } else { |
| 2057 | if (snd_return_otherteamcxx . . $ snd_return_otherteam. != -1) |
| 2058 | DLLPlay2dSound(snd_return_otherteamcxx . . $ snd_return_otherteam., MAX_GAME_VOLUMEcxx . . $ `netgames/includes/gamedll_header.h:59:9`! / 2); |
| 2059 | } |
| 2060 | } |
| 2061 | |
| 2062 | void DoLoseFlagcxx . . $ DoLoseFlag(d4f767463ce0a6b3).(int team) { |
| 2063 | if (DMFCBasecxx . . $ DMFCBase.->GetPlayerTeamcxx . . $ IDMFC#GetPlayerTeam(7864480464b09eea).(DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).()) == team) { |
| 2064 | if (snd_lose_ownteamcxx . . $ snd_lose_ownteam. != -1) |
| 2065 | DLLPlay2dSound(snd_lose_ownteamcxx . . $ snd_lose_ownteam., MAX_GAME_VOLUMEcxx . . $ `netgames/includes/gamedll_header.h:59:9`! / 2); |
| 2066 | } else { |
| 2067 | if (snd_lose_otherteamcxx . . $ snd_lose_otherteam. != -1) |
| 2068 | DLLPlay2dSound(snd_lose_otherteamcxx . . $ snd_lose_otherteam., MAX_GAME_VOLUMEcxx . . $ `netgames/includes/gamedll_header.h:59:9`! / 2); |
| 2069 | } |
| 2070 | } |
| 2071 | |
| 2072 | // VerifyFlagPosition |
| 2073 | // Call this at certain intervals to verify a flags position. It will look at the |
| 2074 | // flags room and makes sure that if it's in it's home room, the correct values |
| 2075 | // are set, and vice versa. |
| 2076 | void VerifyFlagPositioncxx . . $ VerifyFlagPosition(49f6e7a06ebc5aa8).(void) {} |
| 2077 | |
| 2078 | // AddFlagToPlayer |
| 2079 | // gives a player a flag |
| 2080 | bool AddFlagToPlayercxx . . $ AddFlagToPlayer(1432650661211742).(int pnum, int team, int flagobjnum) { |
| 2081 | objectcxx . . $ object# *pobj = &dObjectscxx . . $ dObjects.[dPlayerscxx . . $ dPlayers.[pnum].objnumcxx . . $ player#objnum.]; |
| 2082 | bool ret = true; |
| 2083 | |
| 2084 | if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) { |
| 2085 | // We're the server, so we need to create the flag and tell the clients, and then attach it |
| 2086 | flagobjnum = DLLObjCreate(OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, AFlagIDscxx . . $ AFlagIDs.[team], pobj->roomnumcxx . . $ object#roomnum., &pobj->poscxx . . $ object#pos., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!); |
| 2087 | |
| 2088 | if (flagobjnum != -1) { |
| 2089 | // tell the clients that the flag has been created and they should attach it |
| 2090 | TellClientsToAddorDelFlagcxx . . $ TellClientsToAddorDelFlag(cb82e25e9f99304e).(pnum, team, flagobjnum, true); |
| 2091 | } |
| 2092 | |
| 2093 | // Attach the flag |
| 2094 | |
| 2095 | // 1st figure out how many flags the guy already has |
| 2096 | // ------------------------------------------------- |
| 2097 | int max_num_attach = 3; // based off chrishack for multiplayer |
| 2098 | int num_attached = 0; |
| 2099 | |
| 2100 | if (!pobj->attach_childrencxx . . $ object#attach_children.) |
| 2101 | ret = false; |
| 2102 | else { |
| 2103 | for (int ap = 0; ap < max_num_attach; ap++) { |
| 2104 | if (pobj->attach_childrencxx . . $ object#attach_children.[ap] != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) { |
| 2105 | // attempt to make sure it's a valid object |
| 2106 | objectcxx . . $ object# *tobj; |
| 2107 | if (DLLObjGet(pobj->attach_childrencxx . . $ object#attach_children.[ap], &tobj)) { |
| 2108 | num_attached++; |
| 2109 | } |
| 2110 | } |
| 2111 | } |
| 2112 | |
| 2113 | // 2nd num_attached is the current number of flags this object has |
| 2114 | // --------------------------------------------------------------- |
| 2115 | switch (num_attached) { |
| 2116 | case 0: { |
| 2117 | // the easy case, nothing is attached, so just attach it to ap0 |
| 2118 | ret = DLLAttachObject(pobj, 0, &dObjectscxx . . $ dObjects.[flagobjnum], 0, true); |
| 2119 | } break; |
| 2120 | |
| 2121 | case 1: { |
| 2122 | bool retval; |
| 2123 | objectcxx . . $ object# *tobj; |
| 2124 | |
| 2125 | // we should have a flag at ap0, move it to ap1 |
| 2126 | ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(pobj->attach_children[0] != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!); |
| 2127 | int saved_ap0 = pobj->attach_childrencxx . . $ object#attach_children.[0]; |
| 2128 | retval = DLLUnattachChild(pobj, 0); |
| 2129 | ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(retval); |
| 2130 | |
| 2131 | retval = DLLObjGet(saved_ap0, &tobj); |
| 2132 | ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(retval); |
| 2133 | |
| 2134 | // attach to ap1 |
| 2135 | retval = DLLAttachObject(pobj, 1, tobj, 0, true); |
| 2136 | ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(retval); |
| 2137 | |
| 2138 | // attach new flag to ap2 |
| 2139 | retval = DLLAttachObject(pobj, 2, &dObjectscxx . . $ dObjects.[flagobjnum], 0, true); |
| 2140 | ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(retval); |
| 2141 | |
| 2142 | ret = retval; |
| 2143 | |
| 2144 | } break; |
| 2145 | |
| 2146 | case 2: { |
| 2147 | // we should have a flag at ap1 and ap2 |
| 2148 | // so just add this to ap3 |
| 2149 | |
| 2150 | // attach new flag to ap3 |
| 2151 | ret = DLLAttachObject(pobj, 0, &dObjectscxx . . $ dObjects.[flagobjnum], 0, true); |
| 2152 | |
| 2153 | } break; |
| 2154 | |
| 2155 | case 3: |
| 2156 | default: { |
| 2157 | Int3cxx . . $ `netgames/includes/DMFC.h:378:9`!(); // Get Jeff |
| 2158 | ret = false; |
| 2159 | } break; |
| 2160 | } |
| 2161 | } |
| 2162 | |
| 2163 | if (!ret) { |
| 2164 | // couldn't attach the flag |
| 2165 | mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "CTF: COULDN'T ATTACH FLAG TO PLAYER, DELETING\n"); |
| 2166 | // tell the clients to remove this flag |
| 2167 | DLLSetObjectDeadFlag(&dObjectscxx . . $ dObjects.[flagobjnum], true, false); |
| 2168 | } |
| 2169 | } |
| 2170 | |
| 2171 | if (flagobjnum == -1) { |
| 2172 | // there was an error creating the flag...not good |
| 2173 | mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "CTF: Couldn't create/unhash flag for attachment\n"); |
| 2174 | DMFCBasecxx . . $ DMFCBase.->DisconnectMecxx . . $ IDMFC#DisconnectMe(49f6e7a06ebc5aa8).(); |
| 2175 | return false; |
| 2176 | } |
| 2177 | |
| 2178 | ChildFlagscxx . . $ ChildFlags.[team] = dObjectscxx . . $ dObjects.[flagobjnum].handlecxx . . $ object#handle.; |
| 2179 | |
| 2180 | return ret; |
| 2181 | } |
| 2182 | |
| 2183 | // RemoveFlagFromPlayer |
| 2184 | // removes a flag from a player |
| 2185 | bool RemoveFlagFromPlayercxx . . $ RemoveFlagFromPlayer(cf9ef193275fa6d8).(int pnum, int team) { |
| 2186 | int flagobjnum = -1; |
| 2187 | |
| 2188 | if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) { |
| 2189 | |
| 2190 | if (ChildFlagscxx . . $ ChildFlags.[team] == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) |
| 2191 | return false; |
| 2192 | |
| 2193 | objectcxx . . $ object# *fptr; |
| 2194 | if (!DLLObjGet(ChildFlagscxx . . $ ChildFlags.[team], &fptr)) { |
| 2195 | // the flag is already dead?!? |
| 2196 | return false; |
| 2197 | } |
| 2198 | |
| 2199 | DLLSetObjectDeadFlag(fptr, true, false); |
| 2200 | |
| 2201 | // tell the clients to remove the flag |
| 2202 | TellClientsToAddorDelFlagcxx . . $ TellClientsToAddorDelFlag(cb82e25e9f99304e).(pnum, team, -1, false); |
| 2203 | } |
| 2204 | |
| 2205 | ChildFlagscxx . . $ ChildFlags.[team] = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; |
| 2206 | |
| 2207 | return true; |
| 2208 | } |
| 2209 | |
| 2210 | void TellClientsToAddorDelFlagcxx . . $ TellClientsToAddorDelFlag(cb82e25e9f99304e).(int pnum, int team, int objnum, bool add) { |
| 2211 | if (add) { |
| 2212 | // if we are adding a flag, than we need to send the object to them to make sure that |
| 2213 | // they have it for when we go to process it |
| 2214 | DLLMultiSendObject(&dObjectscxx . . $ dObjects.[objnum], false, true); |
| 2215 | } |
| 2216 | |
| 2217 | uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 2218 | int size = 0; |
| 2219 | DMFCBasecxx . . $ DMFCBase.->StartPacketcxx . . $ IDMFC#StartPacket(261852a8f74abaa0).(data, SPID_ADDDELFLAGcxx . . $ `netgames/ctf/ctf.cpp:103:9`!, &size); |
| 2220 | |
| 2221 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(pnum, data, &size); |
| 2222 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(team, data, &size); |
| 2223 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(add, data, &size); |
| 2224 | |
| 2225 | if (add) { |
| 2226 | // add the objnum of the flag and pack it into the packet |
| 2227 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(objnum, data, &size); |
| 2228 | } |
| 2229 | |
| 2230 | DMFCBasecxx . . $ DMFCBase.->SendPacketcxx . . $ IDMFC#SendPacket(49a5bbab55ea8abc).(data, size, SP_ALLcxx . . $ `netgames/includes/DMFC.h:435:9`!); |
| 2231 | } |
| 2232 | |
| 2233 | void ServerIsTellingMeToAddorDelAFlagcxx . . $ ServerIsTellingMeToAddorDelAFlag(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) { |
| 2234 | int size = 0; |
| 2235 | int pnum, team; |
| 2236 | bool add; |
| 2237 | |
| 2238 | pnum = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &size); |
| 2239 | team = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &size); |
| 2240 | add = (MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &size)) ? true : false; |
| 2241 | |
| 2242 | // determine if we should add or delete a flag |
| 2243 | if (add) { |
| 2244 | int objnum; |
| 2245 | objnum = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &size); |
| 2246 | objnum = DMFCBasecxx . . $ DMFCBase.->ConvertServerToLocalObjnumcxx . . $ IDMFC#ConvertServerToLocalObjnum(7864480464b09eea).(objnum); |
| 2247 | if (objnum == -1) { |
| 2248 | // uh oh...corruption??? |
| 2249 | FatalError("CTF: Server->Local Object Corruption\n"); |
| 2250 | return; |
| 2251 | } |
| 2252 | AddFlagToPlayercxx . . $ AddFlagToPlayer(1432650661211742).(pnum, team, objnum); |
| 2253 | } else { |
| 2254 | RemoveFlagFromPlayercxx . . $ RemoveFlagFromPlayer(cf9ef193275fa6d8).(pnum, team); |
| 2255 | } |
| 2256 | } |
| 2257 | |
| 2258 | ///////////////////////////////// |
| 2259 | // Timer event handlers |
| 2260 | void OnTimercxx . . $ OnTimer(49f6e7a06ebc5aa8).(void) { DisplayFlagBlinkcxx . . $ DisplayFlagBlink. = !DisplayFlagBlinkcxx . . $ DisplayFlagBlink.; } |
| 2261 | void OnTimerKillcxx . . $ OnTimerKill(49f6e7a06ebc5aa8).(void) { |
| 2262 | DisplayFlagBlinkcxx . . $ DisplayFlagBlink. = true; |
| 2263 | WhoJustFlaggedcxx . . $ WhoJustFlagged. = WhoJustFlaggedTimercxx . . $ WhoJustFlaggedTimer. = -1; |
| 2264 | } |
| 2265 | |
| 2266 | void OnTimerScorecxx . . $ OnTimerScore(49f6e7a06ebc5aa8).(void) { DisplayScoreBlinkcxx . . $ DisplayScoreBlink. = !DisplayScoreBlinkcxx . . $ DisplayScoreBlink.; } |
| 2267 | void OnTimerScoreKillcxx . . $ OnTimerScoreKill(49f6e7a06ebc5aa8).(void) { |
| 2268 | DisplayScoreBlinkcxx . . $ DisplayScoreBlink. = true; |
| 2269 | WhoJustScoredcxx . . $ WhoJustScored. = WhoJustScoredTimercxx . . $ WhoJustScoredTimer. = -1; |
| 2270 | } |
| 2271 | |
| 2272 | /////////////////////////////////////////////////////////////////////////////////// |
| 2273 | int PackBytecxx . . $ PackByte(9e413ca3807fc198).(uint8_tcxx . . $ uint8_t# byte, uint8_tcxx . . $ uint8_t# *buffer, int pos) { |
| 2274 | buffer[pos] = byte; |
| 2275 | pos++; |
| 2276 | return pos; |
| 2277 | } |
| 2278 | |
| 2279 | int UnPackBytecxx . . $ UnPackByte(cbd32763675342dd).(uint8_tcxx . . $ uint8_t# *byte, uint8_tcxx . . $ uint8_t# *buffer, int pos) { |
| 2280 | *byte = buffer[pos]; |
| 2281 | pos++; |
| 2282 | return pos; |
| 2283 | } |
| 2284 | |
| 2285 | int PackBytescxx . . $ PackBytes(ba07669c0fa85ec5).(uint8_tcxx . . $ uint8_t# *bytes, int count, uint8_tcxx . . $ uint8_t# *buffer, int pos) { |
| 2286 | memcpy(&buffer[pos], bytes, count); |
| 2287 | pos += count; |
| 2288 | return pos; |
| 2289 | } |
| 2290 | |
| 2291 | int UnPackBytescxx . . $ UnPackBytes(ba07669c0fa85ec5).(uint8_tcxx . . $ uint8_t# *bytes, int count, uint8_tcxx . . $ uint8_t# *buffer, int pos) { |
| 2292 | memcpy(bytes, &buffer[pos], count); |
| 2293 | pos += count; |
| 2294 | return pos; |
| 2295 | } |
| 2296 | |
| 2297 | int PackWordcxx . . $ PackWord(e36c459080d5a858).(uint16_tcxx . . $ uint16_t# word, uint8_tcxx . . $ uint8_t# *buffer, int pos) { return PackBytescxx . . $ PackBytes(ba07669c0fa85ec5).((uint8_tcxx . . $ uint8_t# *)&word, sizeof(uint16_tcxx . . $ uint16_t#), buffer, pos); } |
| 2298 | |
| 2299 | int UnPackWordcxx . . $ UnPackWord(90e82fd4bbf7dbb2).(uint16_tcxx . . $ uint16_t# *word, uint8_tcxx . . $ uint8_t# *buffer, int pos) { return UnPackBytescxx . . $ UnPackBytes(ba07669c0fa85ec5).((uint8_tcxx . . $ uint8_t# *)word, sizeof(uint16_tcxx . . $ uint16_t#), buffer, pos); } |
| 2300 | |
| 2301 | int PackIntcxx . . $ PackInt(ef9024b465536c23).(int data, uint8_tcxx . . $ uint8_t# *buffer, int pos) { return PackBytescxx . . $ PackBytes(ba07669c0fa85ec5).((uint8_tcxx . . $ uint8_t# *)&data, sizeof(int), buffer, pos); } |
| 2302 | |
| 2303 | int UnPackIntcxx . . $ UnPackInt(9a8e3b1c63ddc7cf).(int *data, uint8_tcxx . . $ uint8_t# *buffer, int pos) { return UnPackBytescxx . . $ UnPackBytes(ba07669c0fa85ec5).((uint8_tcxx . . $ uint8_t# *)data, sizeof(int), buffer, pos); } |
| 2304 | |
| 2305 | int PackArraycxx . . $ PackArray(4f0eddf647fb9ba2).(uint8_tcxx . . $ uint8_t# *data, int size, int count, uint8_tcxx . . $ uint8_t# *buffer, int pos) { |
| 2306 | return PackBytescxx . . $ PackBytes(ba07669c0fa85ec5).(data, size * count, buffer, pos); |
| 2307 | } |
| 2308 | |
| 2309 | int UnPackArraycxx . . $ UnPackArray(4f0eddf647fb9ba2).(uint8_tcxx . . $ uint8_t# *data, int size, int count, uint8_tcxx . . $ uint8_t# *buffer, int pos) { |
| 2310 | return UnPackBytescxx . . $ UnPackBytes(ba07669c0fa85ec5).(data, size * count, buffer, pos); |
| 2311 | } |
| 2312 | |
| 2313 | void SendGameStatecxx . . $ SendGameState(d4f767463ce0a6b3).(int pnum) { |
| 2314 | uint8_tcxx . . $ uint8_t# data[MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`!]; |
| 2315 | int count = 0; |
| 2316 | int i; |
| 2317 | |
| 2318 | DMFCBasecxx . . $ DMFCBase.->StartPacketcxx . . $ IDMFC#StartPacket(261852a8f74abaa0).(data, SPID_GAMESTATEcxx . . $ `netgames/ctf/ctf.cpp:102:9`!, &count); |
| 2319 | |
| 2320 | // pack number of teams in this game |
| 2321 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(CTFNumOfTeamscxx . . $ CTFNumOfTeams., data, &count); |
| 2322 | |
| 2323 | // pack flag whether someone has scored a hattrick |
| 2324 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(Someone_has_hattrickcxx . . $ Someone_has_hattrick., data, &count); |
| 2325 | |
| 2326 | for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) { |
| 2327 | // Pack FlagAtHome |
| 2328 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(FlagAtHomecxx . . $ FlagAtHome.[i], data, &count); |
| 2329 | |
| 2330 | // pack flag timeout timers |
| 2331 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(Flag_timeout_timerscxx . . $ Flag_timeout_timers.[i], data, &count); |
| 2332 | |
| 2333 | // pack team scores |
| 2334 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(TeamScorescxx . . $ TeamScores.[i], data, &count); |
| 2335 | |
| 2336 | // pack overall team scores |
| 2337 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(OverallTeamScorescxx . . $ OverallTeamScores.[i], data, &count); |
| 2338 | |
| 2339 | // pack who has flag data |
| 2340 | MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(HasFlagcxx . . $ HasFlag.[i], data, &count); |
| 2341 | } |
| 2342 | |
| 2343 | uint16_tcxx . . $ uint16_t# server_objnums[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!]; |
| 2344 | for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) { |
| 2345 | if (ChildFlagscxx . . $ ChildFlags.[i] == OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) { |
| 2346 | // slot not in use |
| 2347 | server_objnums[i] = 65535; |
| 2348 | } else { |
| 2349 | // should be a valid slot |
| 2350 | objectcxx . . $ object# *obj; |
| 2351 | |
| 2352 | if (!DLLObjGet(ChildFlagscxx . . $ ChildFlags.[i], &obj)) { |
| 2353 | // ok it's not a valid slot...hrm |
| 2354 | ChildFlagscxx . . $ ChildFlags.[i] = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; |
| 2355 | server_objnums[i] = 65535; |
| 2356 | } else { |
| 2357 | // it's valid |
| 2358 | int objnum = (obj - dObjectscxx . . $ dObjects.); |
| 2359 | server_objnums[i] = objnum; |
| 2360 | } |
| 2361 | } |
| 2362 | } |
| 2363 | |
| 2364 | // pack attached flag handles |
| 2365 | for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) { |
| 2366 | MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(server_objnums[i], data, &count); |
| 2367 | } |
| 2368 | |
| 2369 | DMFCBasecxx . . $ DMFCBase.->SendPacketcxx . . $ IDMFC#SendPacket(49a5bbab55ea8abc).(data, count, pnum); |
| 2370 | } |
| 2371 | |
| 2372 | void ReceiveGameStatecxx . . $ ReceiveGameState(f25546b61a629de7).(uint8_tcxx . . $ uint8_t# *data) { |
| 2373 | int count = 0; |
| 2374 | int num_teams; |
| 2375 | int i; |
| 2376 | |
| 2377 | for (i = 0; i < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; i++) { |
| 2378 | // reset everything |
| 2379 | SetColoredBallscxx . . $ SetColoredBalls(918ebd27a9ddbad3).(i, true); |
| 2380 | for (int t = 0; t < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; t++) { |
| 2381 | while (DLLInvCheckItem(i, OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, FlagIDscxx . . $ FlagIDs.[t])) { |
| 2382 | DLLInvRemove(i, OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, FlagIDscxx . . $ FlagIDs.[t]); |
| 2383 | } |
| 2384 | } |
| 2385 | } |
| 2386 | |
| 2387 | // Read num teams |
| 2388 | num_teams = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count); |
| 2389 | ChangeNumberOfTeamscxx . . $ ChangeNumberOfTeams(d4f767463ce0a6b3).(num_teams); |
| 2390 | |
| 2391 | // see if someone has had a hattrick yet |
| 2392 | Someone_has_hattrickcxx . . $ Someone_has_hattrick. = (MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count)) ? true : false; |
| 2393 | |
| 2394 | for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) { |
| 2395 | // UnPack FlagAtHome |
| 2396 | FlagAtHomecxx . . $ FlagAtHome.[i] = (MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, &count)) ? true : false; |
| 2397 | |
| 2398 | // unpack flag timeout timers |
| 2399 | Flag_timeout_timerscxx . . $ Flag_timeout_timers.[i] = MultiGetFloatcxx . . $ MultiGetFloat(fe244d2c191680c4).(data, &count); |
| 2400 | |
| 2401 | // unpack team scores |
| 2402 | TeamScorescxx . . $ TeamScores.[i] = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count); |
| 2403 | |
| 2404 | // unpack overall team scores |
| 2405 | OverallTeamScorescxx . . $ OverallTeamScores.[i] = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count); |
| 2406 | |
| 2407 | // unpack who has flag data |
| 2408 | HasFlagcxx . . $ HasFlag.[i] = MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(data, &count); |
| 2409 | } |
| 2410 | |
| 2411 | // go through the HasFlag array and put items in the inventory, and add colored balls |
| 2412 | for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) { |
| 2413 | if (HasFlagcxx . . $ HasFlag.[i] != -1) { |
| 2414 | DLLInvAddTypeID(HasFlagcxx . . $ HasFlag.[i], OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, FlagIDscxx . . $ FlagIDs.[i], -1, -1, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 2415 | |
| 2416 | // put some balls on the guy |
| 2417 | SetColoredBallscxx . . $ SetColoredBalls(918ebd27a9ddbad3).(HasFlagcxx . . $ HasFlag.[i]); |
| 2418 | } |
| 2419 | } |
| 2420 | |
| 2421 | uint16_tcxx . . $ uint16_t# server_objnums[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!]; |
| 2422 | // unpack attached flag handles |
| 2423 | for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) { |
| 2424 | server_objnums[i] = MultiGetUshortcxx . . $ MultiGetUshort(4574463662eb5370).(data, &count); |
| 2425 | } |
| 2426 | |
| 2427 | // the final step, match the server_objnums->ChildFlags and Attach the flags |
| 2428 | for (i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) { |
| 2429 | if (server_objnums[i] != 65535) { |
| 2430 | // we should have a real object here |
| 2431 | uint16_tcxx . . $ uint16_t# our_objnum = DMFCBasecxx . . $ DMFCBase.->ConvertServerToLocalObjnumcxx . . $ IDMFC#ConvertServerToLocalObjnum(7864480464b09eea).(server_objnums[i]); |
| 2432 | |
| 2433 | if (our_objnum == -1) { |
| 2434 | // fatal error |
| 2435 | mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "CTF: Local Objnums don't match server objnums\n"); |
| 2436 | ChildFlagscxx . . $ ChildFlags.[i] = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; |
| 2437 | DMFCBasecxx . . $ DMFCBase.->DisconnectMecxx . . $ IDMFC#DisconnectMe(49f6e7a06ebc5aa8).(); |
| 2438 | } else { |
| 2439 | // yeah! a valid objnum, attach it!!! |
| 2440 | if (HasFlagcxx . . $ HasFlag.[i] != -1) |
| 2441 | AddFlagToPlayercxx . . $ AddFlagToPlayer(1432650661211742).(HasFlagcxx . . $ HasFlag.[i], i, our_objnum); |
| 2442 | else { |
| 2443 | // hmm, HasFlag doesn't match ChildFlags |
| 2444 | mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "CTF: HasFlag doesn't match ChildFlags!!!!\n"); |
| 2445 | ChildFlagscxx . . $ ChildFlags.[i] = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; |
| 2446 | } |
| 2447 | } |
| 2448 | } else { |
| 2449 | // ok invalid... |
| 2450 | ChildFlagscxx . . $ ChildFlags.[i] = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; |
| 2451 | } |
| 2452 | } |
| 2453 | } |
| 2454 | |
| 2455 | /* |
| 2456 | ******************************************************************************************** |
| 2457 | */ |
| 2458 | |
| 2459 | // returns the number of flags a player has, 0 if none, or an invalid pnum |
| 2460 | int GetFlagCountForPlayercxx . . $ GetFlagCountForPlayer(7864480464b09eea).(int pnum) { |
| 2461 | // 1st check the pnum, make sure it is OK, is it isn't, return 0 |
| 2462 | if (pnum < 0 || pnum >= DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!) { |
| 2463 | // invalid player number, return 0 flags |
| 2464 | mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "CTF: Invalid PNUM passed to GetFlagCountForPlayer()\n"); |
| 2465 | return 0; |
| 2466 | } |
| 2467 | |
| 2468 | int flag_count = 0; |
| 2469 | // 2nd, go through all the team flags, and check the player's inventory, see if they have the ID, |
| 2470 | // if so, add it to their count |
| 2471 | for (int i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) { |
| 2472 | if (DLLInvCheckItem(pnum, OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, FlagIDscxx . . $ FlagIDs.[i])) { |
| 2473 | // they have this flag |
| 2474 | flag_count++; |
| 2475 | } |
| 2476 | } |
| 2477 | |
| 2478 | return flag_count; |
| 2479 | } |
| 2480 | |
| 2481 | // returns the mask of which flags this player currently has |
| 2482 | uint8_tcxx . . $ uint8_t# GetFlagMaskForPlayercxx . . $ GetFlagMaskForPlayer(bc0fba5608a0bfe7).(int pnum) { |
| 2483 | // 1st check the pnum, make sure it is OK, if it isn't, return 0, meaning no flags |
| 2484 | if (pnum < 0 || pnum >= DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!) { |
| 2485 | // invalid player number, return 0 flags |
| 2486 | mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "CTF: Invalid PNUM passed to GetFlagMaskForPlayer()\n"); |
| 2487 | return 0; |
| 2488 | } |
| 2489 | |
| 2490 | int flag_mask = 0; |
| 2491 | uint8_tcxx . . $ uint8_t# mask = 0x01; |
| 2492 | |
| 2493 | // 2nd go through all the teams flags, and check the player's inventory, see if they have the ID, |
| 2494 | // if so, OR the current mask to the running flag_mask |
| 2495 | for (int i = 0; i < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; i++) { |
| 2496 | if (DLLInvCheckItem(pnum, OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, FlagIDscxx . . $ FlagIDs.[i])) { |
| 2497 | // the have this flag |
| 2498 | flag_mask |= mask; |
| 2499 | } |
| 2500 | // adjust the mask because we are moving to the next flag |
| 2501 | mask = mask << 1; |
| 2502 | } |
| 2503 | |
| 2504 | return flag_mask; |
| 2505 | } |
| 2506 | |
| 2507 | // adds a flag to a player, as a precaution, it will go through all the players and makes sure that no one |
| 2508 | // has the flag that is being added. If they are adding the flag, than remove that flag from whoever we thought |
| 2509 | // had it it will return false if it had to remove a flag from a player |
| 2510 | bool GivePlayerFlagcxx . . $ GivePlayerFlag(7b9b7da826ebfeee).(int pnum, uint8_tcxx . . $ uint8_t# team) { |
| 2511 | // 1st check the player num, make sure it is valid |
| 2512 | if (!DMFCBasecxx . . $ DMFCBase.->CheckPlayerNumcxx . . $ IDMFC#CheckPlayerNum(83c267b20bac841a).(pnum)) { |
| 2513 | // not a valid player |
| 2514 | mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "CTF: Invalid pnum passed to GivePlayerFlag()\n"); |
| 2515 | return false; |
| 2516 | } |
| 2517 | |
| 2518 | // 2nd check to make sure the team given is valid, and not our own team |
| 2519 | if (team >= CTFNumOfTeamscxx . . $ CTFNumOfTeams.) { |
| 2520 | // not a valid team |
| 2521 | mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "CTF: Invalid team passed to GivePlayerFlag() (team>=CTFNumOfTeams)\n"); |
| 2522 | return false; |
| 2523 | } |
| 2524 | if (team == DMFCBasecxx . . $ DMFCBase.->GetPlayerTeamcxx . . $ IDMFC#GetPlayerTeam(7864480464b09eea).(pnum)) { |
| 2525 | // we can't add a flag of the same team to a player |
| 2526 | mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "CTF: In GivePlayerFlag(), trying to add a player's home team flag\n"); |
| 2527 | return false; |
| 2528 | } |
| 2529 | |
| 2530 | // 3rd, make sure no one else currently has this flag |
| 2531 | // we'll check our HasFlags[] first |
| 2532 | if (HasFlagcxx . . $ HasFlag.[team] != -1) { |
| 2533 | // hmm, we have someone listed as already having this flag...odd |
| 2534 | mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "CTF: In GivePlayerFlag(), trying to add a flag, but we see someone else should already have it\n"); |
| 2535 | int player = HasFlagcxx . . $ HasFlag.[team]; |
| 2536 | if (DMFCBasecxx . . $ DMFCBase.->CheckPlayerNumcxx . . $ IDMFC#CheckPlayerNum(83c267b20bac841a).(player)) { |
| 2537 | // this player is in the game... |
| 2538 | // make sure this player doesn't have the flag in his inventory |
| 2539 | while (DLLInvCheckItem(player, OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, FlagIDscxx . . $ FlagIDs.[team])) { |
| 2540 | // we have it listed that he does |
| 2541 | mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "CTF: In GivePlayerFlag(), we detected the flag in someone elses inventory\n"); |
| 2542 | // remove all the flags that this player has of this team...very weird |
| 2543 | DLLInvRemove(player, OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, FlagIDscxx . . $ FlagIDs.[team]); |
| 2544 | SetColoredBallscxx . . $ SetColoredBalls(918ebd27a9ddbad3).(player, false); |
| 2545 | // check to see if the player had a flag attached to him |
| 2546 | if (ChildFlagscxx . . $ ChildFlags.[team] != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`! && DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) { |
| 2547 | // he does have a flag attached to him...kill it |
| 2548 | RemoveFlagFromPlayercxx . . $ RemoveFlagFromPlayer(cf9ef193275fa6d8).(player, team); |
| 2549 | } |
| 2550 | } |
| 2551 | } |
| 2552 | // reset this value of the array |
| 2553 | HasFlagcxx . . $ HasFlag.[team] = -1; |
| 2554 | if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) { |
| 2555 | mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "CTF: Game must be out of sync, requesting game state\n"); |
| 2556 | DMFCBasecxx . . $ DMFCBase.->RequestGameStatecxx . . $ IDMFC#RequestGameState(49f6e7a06ebc5aa8).(); |
| 2557 | } |
| 2558 | } |
| 2559 | |
| 2560 | // loop through all the players and make sure they don't have this flag |
| 2561 | for (int player = 0; player < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; player++) { |
| 2562 | // check to see if it's an active player |
| 2563 | if (!DMFCBasecxx . . $ DMFCBase.->CheckPlayerNumcxx . . $ IDMFC#CheckPlayerNum(83c267b20bac841a).(player)) |
| 2564 | continue; |
| 2565 | |
| 2566 | // remove all the flags the player has |
| 2567 | while (DLLInvCheckItem(player, OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, FlagIDscxx . . $ FlagIDs.[team])) { |
| 2568 | mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "CTF: In GivePlayerFlag(), detected a flag in a stranger's inventory\n"); |
| 2569 | DLLInvRemove(player, OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, FlagIDscxx . . $ FlagIDs.[team]); |
| 2570 | SetColoredBallscxx . . $ SetColoredBalls(918ebd27a9ddbad3).(player, false); |
| 2571 | // check to see if the player had a flag attached to him |
| 2572 | if (ChildFlagscxx . . $ ChildFlags.[team] != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`! && DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) { |
| 2573 | // he does have a flag attached to him...kill it |
| 2574 | RemoveFlagFromPlayercxx . . $ RemoveFlagFromPlayer(cf9ef193275fa6d8).(player, team); |
| 2575 | } |
| 2576 | } |
| 2577 | } |
| 2578 | |
| 2579 | // ok, when we get here everything should be ducky, just add the flag and do the necessary things |
| 2580 | DLLInvAddTypeID(pnum, OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, FlagIDscxx . . $ FlagIDs.[team], -1, -1, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 2581 | HasFlagcxx . . $ HasFlag.[team] = pnum; |
| 2582 | SetColoredBallscxx . . $ SetColoredBalls(918ebd27a9ddbad3).(pnum); |
| 2583 | |
| 2584 | if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) { |
| 2585 | // so we got here and added a flag to the player, now we need to attach the flag to the player |
| 2586 | if (!AddFlagToPlayercxx . . $ AddFlagToPlayer(1432650661211742).(pnum, team)) { |
| 2587 | // there was an error adding the flag,,,,ack! |
| 2588 | mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "CTF: In GivePlayerFlag(), couldn't attach the flag to the player\n"); |
| 2589 | } |
| 2590 | } |
| 2591 | |
| 2592 | return true; |
| 2593 | } |
| 2594 | |
| 2595 | // this function takes a flag away from the player, useful for when he scores, spews, disconnects, or observer modes |
| 2596 | void LoseFlagForPlayercxx . . $ LoseFlagForPlayer(7170367bda245568).(int pnum, uint8_tcxx . . $ uint8_t# team, bool remove_from_inven) { |
| 2597 | // 1st check the player number |
| 2598 | if (pnum < 0 || pnum >= DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!) { |
| 2599 | mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "CTF:Invalid pnum passed to LoseFlagForPlayer()\n"); |
| 2600 | return; |
| 2601 | } |
| 2602 | |
| 2603 | // 2nd check the team number |
| 2604 | if (team >= CTFNumOfTeamscxx . . $ CTFNumOfTeams.) { |
| 2605 | mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "CTF:Invalid team passed to LoseFlagForPlayer()\n"); |
| 2606 | return; |
| 2607 | } |
| 2608 | |
| 2609 | if (team == DMFCBasecxx . . $ DMFCBase.->GetPlayerTeamcxx . . $ IDMFC#GetPlayerTeam(7864480464b09eea).(pnum)) { |
| 2610 | mprintfcxx . . $ `netgames/includes/DMFC.h:423:9`!(0, "CTF:Invalid team passed to LoseFlagForPlayer()...same team as player\n"); |
| 2611 | return; |
| 2612 | } |
| 2613 | |
| 2614 | // ok, we have it registered that the flag belongs to us |
| 2615 | while (remove_from_inven && DLLInvCheckItem(pnum, OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, FlagIDscxx . . $ FlagIDs.[team])) { |
| 2616 | DLLInvRemove(pnum, OBJ_POWERUPcxx . . $ `Descent3/object_external.h:167:9`!, FlagIDscxx . . $ FlagIDs.[team]); |
| 2617 | } |
| 2618 | |
| 2619 | SetColoredBallscxx . . $ SetColoredBalls(918ebd27a9ddbad3).(pnum); |
| 2620 | HasFlagcxx . . $ HasFlag.[team] = -1; |
| 2621 | |
| 2622 | // check to see if the player had a flag attached to him |
| 2623 | if (ChildFlagscxx . . $ ChildFlags.[team] != OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!) { |
| 2624 | // he does have a flag attached to him...kill it |
| 2625 | if (DMFCBasecxx . . $ DMFCBase.->GetLocalRolecxx . . $ IDMFC#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) { |
| 2626 | // remove this flag and tell the clients to do so, cause we're the server |
| 2627 | RemoveFlagFromPlayercxx . . $ RemoveFlagFromPlayer(cf9ef193275fa6d8).(pnum, team); |
| 2628 | } |
| 2629 | } |
| 2630 | } |
| 2631 | |
| 2632 | void OnGetTokenStringcxx . . $ OnGetTokenString(655c4eff246c5519).(char *src, char *dest, int dest_size) { |
| 2633 | if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(src, "flag")) { |
| 2634 | int mypnum = DMFCBasecxx . . $ DMFCBase.->GetPlayerNumcxx . . $ IDMFC#GetPlayerNum(b126dc7c1de90089).(); |
| 2635 | int flagcount = GetFlagCountForPlayercxx . . $ GetFlagCountForPlayer(7864480464b09eea).(mypnum); |
| 2636 | int flagmask = GetFlagMaskForPlayercxx . . $ GetFlagMaskForPlayer(bc0fba5608a0bfe7).(mypnum); |
| 2637 | int team; |
| 2638 | bool hasflag[DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!]; |
| 2639 | |
| 2640 | for (team = 0; team < CTFNumOfTeamscxx . . $ CTFNumOfTeams.; team++) { |
| 2641 | // draw all the flags the player has in his inventory |
| 2642 | if (flagmask & 0x01) { |
| 2643 | // player has this flag |
| 2644 | hasflag[team] = true; |
| 2645 | } else { |
| 2646 | hasflag[team] = false; |
| 2647 | } |
| 2648 | |
| 2649 | // rotate 1 bit for next flag |
| 2650 | flagmask = flagmask >> 1; |
| 2651 | } |
| 2652 | for (; team < DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!; team++) { |
| 2653 | hasflag[team] = false; |
| 2654 | } |
| 2655 | |
| 2656 | switch (flagcount) { |
| 2657 | case 1: { |
| 2658 | char t[64]; |
| 2659 | for (team = 0; team < CTFNumOfTeamscxx . . $ CTFNumOfTeams.; team++) { |
| 2660 | if (hasflag[team]) { |
| 2661 | strcpy(t, DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team)); |
| 2662 | break; |
| 2663 | } |
| 2664 | } |
| 2665 | |
| 2666 | strncpy(dest, t, dest_size - 1); |
| 2667 | dest[dest_size - 1] = '\0'; |
| 2668 | return; |
| 2669 | } break; |
| 2670 | case 2: { |
| 2671 | char t[2][64]; |
| 2672 | int found = 0; |
| 2673 | for (team = 0; team < CTFNumOfTeamscxx . . $ CTFNumOfTeams.; team++) { |
| 2674 | if (hasflag[team]) { |
| 2675 | strcpy(t[found], DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team)); |
| 2676 | found++; |
| 2677 | if (found == flagcount) |
| 2678 | break; |
| 2679 | } |
| 2680 | } |
| 2681 | |
| 2682 | char buffer[256]; |
| 2683 | snprintf(buffer, sizeof(buffer), "%s and %s", t[0], t[1]); |
| 2684 | strncpy(dest, buffer, dest_size - 1); |
| 2685 | dest[dest_size - 1] = '\0'; |
| 2686 | return; |
| 2687 | } break; |
| 2688 | case 3: { |
| 2689 | char t[3][64]; |
| 2690 | int found = 0; |
| 2691 | for (team = 0; team < CTFNumOfTeamscxx . . $ CTFNumOfTeams.; team++) { |
| 2692 | if (hasflag[team]) { |
| 2693 | strcpy(t[found], DMFCBasecxx . . $ DMFCBase.->GetTeamStringcxx . . $ IDMFC#GetTeamString(f7ae7e56280f18ae).(team)); |
| 2694 | found++; |
| 2695 | if (found == flagcount) |
| 2696 | break; |
| 2697 | } |
| 2698 | } |
| 2699 | |
| 2700 | char buffer[256]; |
| 2701 | snprintf(buffer, sizeof(buffer), "%s, %s and %s", t[0], t[1], t[2]); |
| 2702 | strncpy(dest, buffer, dest_size - 1); |
| 2703 | dest[dest_size - 1] = '\0'; |
| 2704 | return; |
| 2705 | |
| 2706 | } break; |
| 2707 | default: |
| 2708 | strncpy(dest, "No", dest_size - 1); |
| 2709 | dest[dest_size - 1] = '\0'; |
| 2710 | return; |
| 2711 | break; |
| 2712 | } |
| 2713 | } |
| 2714 | |
| 2715 | DMFCBasecxx . . $ DMFCBase.->OnGetTokenStringcxx . . $ IDMFC#OnGetTokenString(655c4eff246c5519).(src, dest, dest_size); |
| 2716 | } |