| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/dmfc/dmfcinputcommand.cpp $ |
| 21 | * $Revision: 1.1.1.1 $ |
| 22 | * $Date: 2003/08/26 03:57:20 $ |
| 23 | * $Author: kevinb $ |
| 24 | * |
| 25 | * Functions for Input commands (function handlers) |
| 26 | * |
| 27 | * $Log: dmfcinputcommand.cpp,v $ |
| 28 | * Revision 1.1.1.1 2003/08/26 03:57:20 kevinb |
| 29 | * initial 1.5 import |
| 30 | * |
| 31 | * |
| 32 | * 26 2/08/00 4:33a Jason |
| 33 | * Fixed memory overwrite during string parse |
| 34 | * |
| 35 | * 25 7/14/99 11:47a Jeff |
| 36 | * localized text for patch fixes |
| 37 | * |
| 38 | * 24 7/09/99 6:18p Jeff |
| 39 | * added $remoteadminlogout and $wait commands |
| 40 | * |
| 41 | * 23 7/08/99 2:39a Jeff |
| 42 | * rough implementation of remote administration checked in. Still needs |
| 43 | * some polishing, but should work basically. |
| 44 | * |
| 45 | * 22 5/07/99 12:52p Jeff |
| 46 | * audio taunt icon is ppic if available. coop has hard max team set of 4 |
| 47 | * |
| 48 | * 21 4/30/99 10:53p Jeff |
| 49 | * added $warp command |
| 50 | * |
| 51 | * 20 3/17/99 12:24p Jeff |
| 52 | * converted DMFC to be COM interface |
| 53 | * |
| 54 | * 19 2/11/99 12:50a Jeff |
| 55 | * changed names of exported variables |
| 56 | * |
| 57 | * 18 1/31/99 7:26p Matt |
| 58 | * Renamed a bunch of functions to have HUD capitalized |
| 59 | * |
| 60 | * 17 1/19/99 3:55a Jeff |
| 61 | * all strings localized out |
| 62 | * |
| 63 | * 16 1/06/99 12:53a Jeff |
| 64 | * put in support for $piggyback and $observer |
| 65 | * |
| 66 | * 15 1/04/99 12:21p Jeff |
| 67 | * added support for hosts.allow/deny and updates stats manager a little |
| 68 | * |
| 69 | * 14 12/08/98 12:17p Jeff |
| 70 | * various changes that include an improved Team Control dialog (doesn't |
| 71 | * switch teams until exit..) and spew/respawn players that change teams |
| 72 | * |
| 73 | * 13 11/16/98 5:35p Jeff |
| 74 | * removed log functions, added support for changing team names, fixed ctf |
| 75 | * to work better with different team names |
| 76 | * |
| 77 | * 12 11/11/98 7:19p Jeff |
| 78 | * changes made so that a dedicated server's team is always -1 (team game |
| 79 | * or not) |
| 80 | * |
| 81 | * 11 11/02/98 11:41a Jeff |
| 82 | * use my parse routines, and display help if the format of the command |
| 83 | * was wrong |
| 84 | * |
| 85 | * 10 11/01/98 1:59a Jeff |
| 86 | * made a $help inputcommand for help in a dedicated server environment |
| 87 | * |
| 88 | * 9 10/24/98 2:35p Matt |
| 89 | * Changed "callsign" to "name" or "player name" in the multiplayer menus |
| 90 | * and commands. |
| 91 | * |
| 92 | * 8 10/20/98 12:16p Jeff |
| 93 | * added death message filter, hud callsign filter |
| 94 | * |
| 95 | * 7 10/15/98 1:34p Jeff |
| 96 | * added scrollable onscreen menu. Remove ban in dmfc. prejoin event |
| 97 | * |
| 98 | * 6 10/08/98 3:37p Jeff |
| 99 | * general improvements (Netgame info things, save to registry). Changes |
| 100 | * so it would send packets on NETSEQ_OBJECTS |
| 101 | * |
| 102 | * 5 10/05/98 2:50p Jeff |
| 103 | * |
| 104 | * 4 9/30/98 3:50p Jeff |
| 105 | * general improvements (many) |
| 106 | * |
| 107 | * 3 9/23/98 4:17p Jeff |
| 108 | * basic changes/improvements, started changing death messages |
| 109 | * |
| 110 | * 2 9/21/98 7:11p Jeff |
| 111 | * made InputCommand interface API and moved existing input commands to |
| 112 | * the interface. Changed mprintf/ASSERT so they are valid in DMFC |
| 113 | * |
| 114 | * $NoKeywords: $ |
| 115 | */ |
| 116 | |
| 117 | #include "gamedll_header.h"cxx . . $ `<file>/netgames/includes/gamedll_header.h`/ |
| 118 | #include "DMFC.h"cxx . . $ `<file>/netgames/includes/DMFC.h`/ |
| 119 | #include "dmfcinternal.h"cxx . . $ `<file>/netgames/dmfc/dmfcinternal.h`/ |
| 120 | |
| 121 | #include <algorithm> |
| 122 | |
| 123 | extern DMFCBasecxx . . $ DMFCBase# *basethiscxx . . $ basethis.; |
| 124 | |
| 125 | bool StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(const char *string, char *word, int size, const char **newpos) { |
| 126 | *newpos = string; |
| 127 | word[0] = '\0'; |
| 128 | |
| 129 | // get through all the whitespace |
| 130 | while (*string && *string == ' ') |
| 131 | string++; |
| 132 | if (!(*string)) { |
| 133 | // nothing is left in the string |
| 134 | *newpos = string; |
| 135 | return false; |
| 136 | } |
| 137 | |
| 138 | // we're at the beginning of a word |
| 139 | while (*string && *string != ' ') { |
| 140 | if (size > 1) { |
| 141 | *word = *string; |
| 142 | size--; |
| 143 | word++; |
| 144 | } |
| 145 | |
| 146 | string++; |
| 147 | } |
| 148 | |
| 149 | // tack on an ending \0 |
| 150 | *word = '\0'; |
| 151 | |
| 152 | *newpos = string; |
| 153 | return true; |
| 154 | } |
| 155 | |
| 156 | bool StringParseNumbercxx . . $ StringParseNumber(8de6ed5103590a5a).(const char *string, int *number, const char **newpos) { |
| 157 | char temp[10]; |
| 158 | bool ret = StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(string, temp, 10, newpos); |
| 159 | if (!ret) { |
| 160 | *number = 0; |
| 161 | return false; |
| 162 | } |
| 163 | |
| 164 | *number = atoicxx . . $ atoi(f5ecf3191ed0cd93).(temp); |
| 165 | return true; |
| 166 | } |
| 167 | |
| 168 | // handle the client wishing to change teams |
| 169 | // Usage: "$team <string team_name>" where team_name is the name of the team you want to change to |
| 170 | void DMFCInputCommand_Teamcxx . . $ DMFCInputCommand_Team(85c52e162fed56f9).(const char *input_string) { |
| 171 | char team[100]; |
| 172 | |
| 173 | // parse "$team" |
| 174 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, team, 100, &input_string)) { |
| 175 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_TEAMcxx . . $ `netgames/dmfc/dmfcinternal.h:2582:9`!); |
| 176 | return; |
| 177 | } |
| 178 | |
| 179 | // parse team name |
| 180 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, team, 100, &input_string)) { |
| 181 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_TEAMcxx . . $ `netgames/dmfc/dmfcinternal.h:2582:9`!); |
| 182 | return; |
| 183 | } |
| 184 | |
| 185 | int t = basethiscxx . . $ basethis.->GetTeamFromStringcxx . . $ DMFCBase#GetTeamFromString(1ef8e6ec083aabb9).(team); |
| 186 | |
| 187 | int curr_team = basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[basethiscxx . . $ basethis.->GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).()].teamcxx . . $ player#team.; |
| 188 | |
| 189 | if ((t == -1) || (t == curr_team) || (curr_team == -1)) |
| 190 | return; |
| 191 | |
| 192 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Attempting to change teams to %s team\n", team); |
| 193 | DLLAddHUDMessage(DTXT_TEAMCHANGEATTEMPTcxx . . $ `netgames/dmfc/dmfcinternal.h:2650:9`!, team); |
| 194 | basethiscxx . . $ basethis.->RequestTeamChangecxx . . $ DMFCBase#RequestTeamChange(6908015b96d379c0).(t, basethiscxx . . $ basethis.->GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).(), true); |
| 195 | } |
| 196 | |
| 197 | // handle the server wanting to change the team for a player |
| 198 | // Usage: "$changeteam <int pnum> <string team_name>" where pnum is the playernum, and team_name is the name of the |
| 199 | // team |
| 200 | void DMFCInputCommand_ChangeTeamcxx . . $ DMFCInputCommand_ChangeTeam(85c52e162fed56f9).(const char *input_string) { |
| 201 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 202 | return; |
| 203 | char team[100]; |
| 204 | int p; |
| 205 | |
| 206 | // parse "$changeteam" |
| 207 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, team, 100, &input_string)) { |
| 208 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_CHANGETEAMcxx . . $ `netgames/dmfc/dmfcinternal.h:2512:9`!); |
| 209 | return; |
| 210 | } |
| 211 | |
| 212 | // parse the pnum |
| 213 | if (!StringParseNumbercxx . . $ StringParseNumber(8de6ed5103590a5a).(input_string, &p, &input_string)) { |
| 214 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_CHANGETEAMcxx . . $ `netgames/dmfc/dmfcinternal.h:2512:9`!); |
| 215 | return; |
| 216 | } |
| 217 | |
| 218 | // parse the newteam name |
| 219 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, team, 100, &input_string)) { |
| 220 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_CHANGETEAMcxx . . $ `netgames/dmfc/dmfcinternal.h:2512:9`!); |
| 221 | return; |
| 222 | } |
| 223 | |
| 224 | int t = basethiscxx . . $ basethis.->GetTeamFromStringcxx . . $ DMFCBase#GetTeamFromString(1ef8e6ec083aabb9).(team); |
| 225 | |
| 226 | int curr_team = basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[p].teamcxx . . $ player#team.; |
| 227 | |
| 228 | if ((!basethiscxx . . $ basethis.->CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(p)) || (t == -1) || (t == curr_team) || (curr_team == -1)) |
| 229 | return; |
| 230 | |
| 231 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Attempting to change %s to %s team\n", basethis->Players[p].callsign, team); |
| 232 | DLLAddHUDMessage(DTXT_STEAMCHANGEATTEMPTcxx . . $ `netgames/dmfc/dmfcinternal.h:2651:9`!, basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[p].callsigncxx . . $ player#callsign., team); |
| 233 | basethiscxx . . $ basethis.->RequestTeamChangecxx . . $ DMFCBase#RequestTeamChange(6908015b96d379c0).(t, p, true); |
| 234 | } |
| 235 | |
| 236 | // handle the client requesting playerinfo for a player |
| 237 | // Usage: "$playerinfo <int pnum>" where pnum is the playernum |
| 238 | void DMFCInputCommand_PlayerInfocxx . . $ DMFCInputCommand_PlayerInfo(85c52e162fed56f9).(const char *input_string) { |
| 239 | int p; |
| 240 | char temp[20]; |
| 241 | |
| 242 | // parse "$playerinfo" |
| 243 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, temp, 20, &input_string)) { |
| 244 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_PLAYERINFOcxx . . $ `netgames/dmfc/dmfcinternal.h:2538:9`!); |
| 245 | return; |
| 246 | } |
| 247 | |
| 248 | // parse pnum |
| 249 | if (!StringParseNumbercxx . . $ StringParseNumber(8de6ed5103590a5a).(input_string, &p, &input_string)) { |
| 250 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_PLAYERINFOcxx . . $ `netgames/dmfc/dmfcinternal.h:2538:9`!); |
| 251 | return; |
| 252 | } |
| 253 | |
| 254 | SwitchPlayerInfocxx . . $ SwitchPlayerInfo(d4f767463ce0a6b3).(p); |
| 255 | |
| 256 | if (basethiscxx . . $ basethis.->CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(p)) { |
| 257 | DLLAddHUDMessage(DTXT_GETPLAYERINFOcxx . . $ `netgames/dmfc/dmfcinternal.h:2652:9`!, basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[p].callsigncxx . . $ player#callsign.); |
| 258 | } |
| 259 | |
| 260 | if (basethiscxx . . $ basethis.->IAmDedicatedServercxx . . $ DMFCBase#IAmDedicatedServer(c9857a73d68e59ba).()) { |
| 261 | basethiscxx . . $ basethis.->DisplayPlayerInfocxx . . $ DMFCBase#DisplayPlayerInfo(918ebd27a9ddbad3).(BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!, true); |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | // handle the server requesting an autobalance of teams |
| 266 | // Usage: "$balance" |
| 267 | void DMFCInputCommand_Balancecxx . . $ DMFCInputCommand_Balance(85c52e162fed56f9).(const char *input_string) { |
| 268 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 269 | return; |
| 270 | BalanceTeamscxx . . $ BalanceTeams(d4f767463ce0a6b3).(0); |
| 271 | DLLAddHUDMessage(DTXT_BALANCETEAMMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2653:9`!); |
| 272 | } |
| 273 | |
| 274 | // handle turning off/on allowing the autobalancing of teams by the server |
| 275 | // Usage: "$autobalance <off/on>" if off/on is "off" (or equivalent) it will turn it off, else turn it on |
| 276 | void DMFCInputCommand_AutoBalancecxx . . $ DMFCInputCommand_AutoBalance(85c52e162fed56f9).(const char *input_string) { |
| 277 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 278 | return; |
| 279 | char s[20]; |
| 280 | |
| 281 | // parse "$autobalance" |
| 282 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 283 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_AUTOBALANCEcxx . . $ `netgames/dmfc/dmfcinternal.h:2491:9`!); |
| 284 | return; |
| 285 | } |
| 286 | |
| 287 | // parse the off/on |
| 288 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 289 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_AUTOBALANCEcxx . . $ `netgames/dmfc/dmfcinternal.h:2491:9`!); |
| 290 | return; |
| 291 | } |
| 292 | |
| 293 | int on = 1; |
| 294 | |
| 295 | if (!strnicmpcxx . . $ `linux/linux_fix.h:44:9`!(s, DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!, strlen(DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!))) |
| 296 | on = 0; |
| 297 | SwitchAutoTeamSelectcxx . . $ SwitchAutoTeamSelect(d4f767463ce0a6b3).(on); |
| 298 | DLLAddHUDMessage(DTXT_AUTOTEAMBALANCEMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2654:9`!, (on) ? DTXT_MNUONcxx . . $ `netgames/dmfc/dmfcinternal.h:2408:9`! : DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!); |
| 299 | } |
| 300 | |
| 301 | // handle turning off/on allowing clients to change their team |
| 302 | // Usage: "$allowteamchange <off/on>" if off/on is "off" (or equivalent) it will turn it off, else turn it on |
| 303 | void DMFCInputCommand_AllowTeamChangecxx . . $ DMFCInputCommand_AllowTeamChange(85c52e162fed56f9).(const char *input_string) { |
| 304 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 305 | return; |
| 306 | char s[20]; |
| 307 | |
| 308 | // parse "$allowteamchange" |
| 309 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 310 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_ALLOWTEAMCHANGEcxx . . $ `netgames/dmfc/dmfcinternal.h:2488:9`!); |
| 311 | return; |
| 312 | } |
| 313 | |
| 314 | // parse off/on |
| 315 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 316 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_ALLOWTEAMCHANGEcxx . . $ `netgames/dmfc/dmfcinternal.h:2488:9`!); |
| 317 | return; |
| 318 | } |
| 319 | |
| 320 | int on = 1; |
| 321 | if (!strnicmpcxx . . $ `linux/linux_fix.h:44:9`!(s, DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!, strlen(DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!))) |
| 322 | on = 0; |
| 323 | |
| 324 | SwitchTeamChangecxx . . $ SwitchTeamChange(d4f767463ce0a6b3).(on); |
| 325 | DLLAddHUDMessage(DTXT_ALLOWTEAMCHANGEMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2655:9`!, (on) ? DTXT_MNUONcxx . . $ `netgames/dmfc/dmfcinternal.h:2408:9`! : DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!); |
| 326 | } |
| 327 | |
| 328 | // handles kicking a player from the game |
| 329 | // Usage: "$kick <int pnum>" where pnum is the playernumber of the player you want to kick |
| 330 | void DMFCInputCommand_Kickcxx . . $ DMFCInputCommand_Kick(85c52e162fed56f9).(const char *input_string) { |
| 331 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 332 | return; |
| 333 | int p; |
| 334 | char temp[20]; |
| 335 | |
| 336 | // parse "$kick" |
| 337 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, temp, 20, &input_string)) { |
| 338 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_KICKcxx . . $ `netgames/dmfc/dmfcinternal.h:2524:9`!); |
| 339 | return; |
| 340 | } |
| 341 | |
| 342 | // parse pnum |
| 343 | if (!StringParseNumbercxx . . $ StringParseNumber(8de6ed5103590a5a).(input_string, &p, &input_string)) { |
| 344 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_KICKcxx . . $ `netgames/dmfc/dmfcinternal.h:2524:9`!); |
| 345 | return; |
| 346 | } |
| 347 | |
| 348 | if (!basethiscxx . . $ basethis.->CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(p)) |
| 349 | return; |
| 350 | KickPlayercxx . . $ KickPlayer(d4f767463ce0a6b3).(p); |
| 351 | if (p != *basethiscxx . . $ basethis.->Player_numcxx . . $ DMFCBase#Player_num.) |
| 352 | DLLAddHUDMessage(DTXT_KICKMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2656:9`!, basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[p].callsigncxx . . $ player#callsign.); |
| 353 | } |
| 354 | |
| 355 | // handles banning a player from the game |
| 356 | // Usage: "$ban <int pnum>" where pnum is the playernumber of the player to ban |
| 357 | void DMFCInputCommand_Bancxx . . $ DMFCInputCommand_Ban(85c52e162fed56f9).(const char *input_string) { |
| 358 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 359 | return; |
| 360 | int p; |
| 361 | char temp[20]; |
| 362 | |
| 363 | // parse "$ban" |
| 364 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, temp, 20, &input_string)) { |
| 365 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_BANcxx . . $ `netgames/dmfc/dmfcinternal.h:2506:9`!); |
| 366 | return; |
| 367 | } |
| 368 | |
| 369 | // parse pnum |
| 370 | if (!StringParseNumbercxx . . $ StringParseNumber(8de6ed5103590a5a).(input_string, &p, &input_string)) { |
| 371 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_BANcxx . . $ `netgames/dmfc/dmfcinternal.h:2506:9`!); |
| 372 | return; |
| 373 | } |
| 374 | |
| 375 | if (!basethiscxx . . $ basethis.->CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(p)) |
| 376 | return; |
| 377 | |
| 378 | BanPlayercxx . . $ BanPlayer(d4f767463ce0a6b3).(p); |
| 379 | if (p != *basethiscxx . . $ basethis.->Player_numcxx . . $ DMFCBase#Player_num.) |
| 380 | DLLAddHUDMessage(DTXT_BANMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2657:9`!, basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[p].callsigncxx . . $ player#callsign.); |
| 381 | } |
| 382 | |
| 383 | // handles ending the level |
| 384 | // Usage: "$endlevel" |
| 385 | void DMFCInputCommand_EndLevelcxx . . $ DMFCInputCommand_EndLevel(85c52e162fed56f9).(const char *input_string) { |
| 386 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 387 | return; |
| 388 | EndMultiLevelcxx . . $ EndMultiLevel(d4f767463ce0a6b3).(0); |
| 389 | DLLAddHUDMessage(DTXT_ENDLEVELMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2658:9`!); |
| 390 | } |
| 391 | |
| 392 | // handles the request to see all the players in the game |
| 393 | // Usage: "$players" |
| 394 | void DMFCInputCommand_Playerscxx . . $ DMFCInputCommand_Players(85c52e162fed56f9).(const char *input_string) { |
| 395 | // Dedicated server print out of all the players and their player nums |
| 396 | DPrintf(DTXT_PLAYERLISTHEADERcxx . . $ `netgames/dmfc/dmfcinternal.h:2674:9`!); |
| 397 | for (int i = 0; i < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; i++) { |
| 398 | if (basethiscxx . . $ basethis.->CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(i)) { |
| 399 | DPrintf("%02d: %s\n", i, basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[i].callsigncxx . . $ player#callsign.); |
| 400 | } |
| 401 | } |
| 402 | } |
| 403 | |
| 404 | // handles a request to see the scores/stats of the game (up to the mod to display the scores on request) |
| 405 | // Usage: "$scores" |
| 406 | void DMFCInputCommand_Scorescxx . . $ DMFCInputCommand_Scores(85c52e162fed56f9).(const char *input_string) { |
| 407 | int level; |
| 408 | char temp[20]; |
| 409 | |
| 410 | // parse $scores |
| 411 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, temp, 20, &input_string)) { |
| 412 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_SCOREScxx . . $ `netgames/dmfc/dmfcinternal.h:2554:9`!); |
| 413 | return; |
| 414 | } |
| 415 | |
| 416 | // see if there is a level |
| 417 | if (!StringParseNumbercxx . . $ StringParseNumber(8de6ed5103590a5a).(input_string, &level, &input_string)) |
| 418 | level = -1; |
| 419 | |
| 420 | // call the event that the user want to see the scores (dedicated server |
| 421 | basethiscxx . . $ basethis.->CallOnPrintScorescxx . . $ DMFCBase#CallOnPrintScores(d4f767463ce0a6b3).(level); |
| 422 | } |
| 423 | |
| 424 | // handles a request to turn on/off displaying callsigns on the HUD during the game. |
| 425 | // Usage: "$hudnames <full/team/none>" full = everyone team = only teammates none = noone |
| 426 | // NOTE: You can only set your HUD Callsign level up to the level that the server is |
| 427 | // So if the server is only allowing up to team, you won't be able to set to full |
| 428 | void DMFCInputCommand_HudCallsignscxx . . $ DMFCInputCommand_HudCallsigns(85c52e162fed56f9).(const char *input_string) { |
| 429 | char s[20]; |
| 430 | |
| 431 | // parse "$hudnames" |
| 432 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 433 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_HUDNAMEcxx . . $ `netgames/dmfc/dmfcinternal.h:2519:9`!); |
| 434 | return; |
| 435 | } |
| 436 | |
| 437 | // parse the level |
| 438 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 439 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_HUDNAMEcxx . . $ `netgames/dmfc/dmfcinternal.h:2519:9`!); |
| 440 | return; |
| 441 | } |
| 442 | |
| 443 | uint8_tcxx . . $ uint8_t# level = HUD_CALLSIGN_LEVEL_NONEcxx . . $ `netgames/dmfc/dmfcinternal.h:2778:9`!; |
| 444 | if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(s, DTXT_OSM_FULLcxx . . $ `netgames/dmfc/dmfcinternal.h:2456:9`!)) |
| 445 | level = HUD_CALLSIGN_LEVEL_FULLcxx . . $ `netgames/dmfc/dmfcinternal.h:2776:9`!; |
| 446 | else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(s, DTXT_IC_TEAMcxx . . $ `netgames/dmfc/dmfcinternal.h:2582:9`!)) |
| 447 | level = HUD_CALLSIGN_LEVEL_TEAMcxx . . $ `netgames/dmfc/dmfcinternal.h:2777:9`!; |
| 448 | |
| 449 | basethiscxx . . $ basethis.->SwitchShowHudCallsignLevelcxx . . $ DMFCBase#SwitchShowHudCallsignLevel(f2ac3508b56cd10).(level); |
| 450 | } |
| 451 | |
| 452 | // handles a request from the server to set the max HUD Callsign level |
| 453 | // Usage: "$serverhudnames <full/team/none>" same as $hudname but sets the max level for the server |
| 454 | void DMFCInputCommand_ServerHudCallsignscxx . . $ DMFCInputCommand_ServerHudCallsigns(85c52e162fed56f9).(const char *input_string) { |
| 455 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 456 | return; |
| 457 | |
| 458 | char s[20]; |
| 459 | |
| 460 | // parse "$serverhudnames" |
| 461 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 462 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_SERVERHUDNAMEScxx . . $ `netgames/dmfc/dmfcinternal.h:2556:9`!); |
| 463 | return; |
| 464 | } |
| 465 | |
| 466 | // parse the level |
| 467 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 468 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_SERVERHUDNAMEScxx . . $ `netgames/dmfc/dmfcinternal.h:2556:9`!); |
| 469 | return; |
| 470 | } |
| 471 | |
| 472 | uint8_tcxx . . $ uint8_t# level = HUD_CALLSIGN_LEVEL_NONEcxx . . $ `netgames/dmfc/dmfcinternal.h:2778:9`!; |
| 473 | if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(s, DTXT_OSM_FULLcxx . . $ `netgames/dmfc/dmfcinternal.h:2456:9`!)) |
| 474 | level = HUD_CALLSIGN_LEVEL_FULLcxx . . $ `netgames/dmfc/dmfcinternal.h:2776:9`!; |
| 475 | else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(s, DTXT_IC_TEAMcxx . . $ `netgames/dmfc/dmfcinternal.h:2582:9`!)) |
| 476 | level = HUD_CALLSIGN_LEVEL_TEAMcxx . . $ `netgames/dmfc/dmfcinternal.h:2777:9`!; |
| 477 | |
| 478 | basethiscxx . . $ basethis.->SwitchServerHudCallsignLevelcxx . . $ DMFCBase#SwitchServerHudCallsignLevel(ac50b47256ae7414).(level); |
| 479 | } |
| 480 | |
| 481 | // handles a request to save the game stats to file |
| 482 | // Usage: "$savestats" |
| 483 | void DMFCInputCommand_SaveStatscxx . . $ DMFCInputCommand_SaveStats(85c52e162fed56f9).(const char *input_string) { SaveStatsToFilecxx . . $ SaveStatsToFile(d4f767463ce0a6b3).(0); } |
| 484 | |
| 485 | // handles a request to enable/disable statistical messages |
| 486 | // Usage: "$statmsgs on/off" |
| 487 | void DMFCInputCommand_StatMsgscxx . . $ DMFCInputCommand_StatMsgs(85c52e162fed56f9).(const char *input_string) { |
| 488 | char s[20]; |
| 489 | |
| 490 | // parse "$statmsgs" |
| 491 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 492 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_STATMSGScxx . . $ `netgames/dmfc/dmfcinternal.h:2580:9`!); |
| 493 | return; |
| 494 | } |
| 495 | |
| 496 | // parse the level |
| 497 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 498 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_STATMSGScxx . . $ `netgames/dmfc/dmfcinternal.h:2580:9`!); |
| 499 | return; |
| 500 | } |
| 501 | |
| 502 | bool on = true; |
| 503 | if (!strnicmpcxx . . $ `linux/linux_fix.h:44:9`!(s, DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!, strlen(DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!))) |
| 504 | on = false; |
| 505 | basethiscxx . . $ basethis.->EnableStatisticalMessagescxx . . $ DMFCBase#EnableStatisticalMessages(b45ddcbc8423892c).(on); |
| 506 | DLLAddHUDMessage(DTXT_STATSMSGSETcxx . . $ `netgames/dmfc/dmfcinternal.h:2659:9`!, (on) ? DTXT_MNUONcxx . . $ `netgames/dmfc/dmfcinternal.h:2408:9`! : DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!); |
| 507 | } |
| 508 | |
| 509 | // handles a request to enable/disable the autosaving of the game stats on level end |
| 510 | // Usage: "$autosavelevel on/off" |
| 511 | void DMFCInputCommand_AutoSaveLevelcxx . . $ DMFCInputCommand_AutoSaveLevel(85c52e162fed56f9).(const char *input_string) { |
| 512 | char s[20]; |
| 513 | |
| 514 | // parse "$autosavelevel" |
| 515 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 516 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_AUTOSAVELEVELcxx . . $ `netgames/dmfc/dmfcinternal.h:2499:9`!); |
| 517 | return; |
| 518 | } |
| 519 | |
| 520 | // parse the on/off |
| 521 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 522 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_AUTOSAVELEVELcxx . . $ `netgames/dmfc/dmfcinternal.h:2499:9`!); |
| 523 | return; |
| 524 | } |
| 525 | |
| 526 | bool on = true; |
| 527 | if (!strnicmpcxx . . $ `linux/linux_fix.h:44:9`!(s, DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!, strlen(DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!))) |
| 528 | on = false; |
| 529 | basethiscxx . . $ basethis.->EnableAutoSaveLevelEndcxx . . $ DMFCBase#EnableAutoSaveLevelEnd(b45ddcbc8423892c).(on); |
| 530 | DLLAddHUDMessage(DTXT_AUTOSAVELEVELMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2660:9`!, (on) ? DTXT_MNUONcxx . . $ `netgames/dmfc/dmfcinternal.h:2408:9`! : DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!); |
| 531 | } |
| 532 | |
| 533 | // handles a request to enable/disable the autosaving of the game stats if we disconnect |
| 534 | // Usage: "$autosavedisconnect on/off" |
| 535 | void DMFCInputCommand_AutoSaveDisconnectcxx . . $ DMFCInputCommand_AutoSaveDisconnect(85c52e162fed56f9).(const char *input_string) { |
| 536 | char s[20]; |
| 537 | |
| 538 | // parse the "$autosavedisconnect" |
| 539 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 540 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_AUTOSAVEDISCcxx . . $ `netgames/dmfc/dmfcinternal.h:2495:9`!); |
| 541 | return; |
| 542 | } |
| 543 | |
| 544 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 545 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_AUTOSAVEDISCcxx . . $ `netgames/dmfc/dmfcinternal.h:2495:9`!); |
| 546 | return; |
| 547 | } |
| 548 | |
| 549 | bool on = true; |
| 550 | if (!strnicmpcxx . . $ `linux/linux_fix.h:44:9`!(s, DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!, strlen(DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!))) |
| 551 | on = false; |
| 552 | basethiscxx . . $ basethis.->EnableAutoSaveDisconnectcxx . . $ DMFCBase#EnableAutoSaveDisconnect(b45ddcbc8423892c).(on); |
| 553 | DLLAddHUDMessage(DTXT_AUTOSAVEDISCMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2661:9`!, (on) ? DTXT_MNUONcxx . . $ `netgames/dmfc/dmfcinternal.h:2408:9`! : DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!); |
| 554 | } |
| 555 | |
| 556 | // handles changing the level time limit of a netgame on the fly |
| 557 | // Usage: "$settimelimit <int minutes>" where minutes is the number of minutes |
| 558 | void DMFCInputCommand_SetTimeLimitcxx . . $ DMFCInputCommand_SetTimeLimit(85c52e162fed56f9).(const char *input_string) { |
| 559 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 560 | return; |
| 561 | int d; |
| 562 | char temp[20]; |
| 563 | |
| 564 | // parse "$settimelimit" |
| 565 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, temp, 20, &input_string)) { |
| 566 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_SETTIMELIMITcxx . . $ `netgames/dmfc/dmfcinternal.h:2577:9`!); |
| 567 | return; |
| 568 | } |
| 569 | |
| 570 | // parse the amount |
| 571 | if (!StringParseNumbercxx . . $ StringParseNumber(8de6ed5103590a5a).(input_string, &d, &input_string)) { |
| 572 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_SETTIMELIMITcxx . . $ `netgames/dmfc/dmfcinternal.h:2577:9`!); |
| 573 | return; |
| 574 | } |
| 575 | |
| 576 | if (d < 0) |
| 577 | d = 0; |
| 578 | |
| 579 | basethiscxx . . $ basethis.->Netgamecxx . . $ DMFCBase#Netgame.->timelimitcxx . . $ netgame_info#timelimit. = d; |
| 580 | |
| 581 | if (d == 0) { |
| 582 | basethiscxx . . $ basethis.->Netgamecxx . . $ DMFCBase#Netgame.->flagscxx . . $ netgame_info#flags. &= ~NF_TIMERcxx . . $ `Descent3/multi_external.h:226:9`!; |
| 583 | } else { |
| 584 | basethiscxx . . $ basethis.->Netgamecxx . . $ DMFCBase#Netgame.->flagscxx . . $ netgame_info#flags. |= NF_TIMERcxx . . $ `Descent3/multi_external.h:226:9`!; |
| 585 | } |
| 586 | |
| 587 | if (basethiscxx . . $ basethis.->Netgamecxx . . $ DMFCBase#Netgame.->flagscxx . . $ netgame_info#flags. & NF_TIMERcxx . . $ `Descent3/multi_external.h:226:9`!) |
| 588 | DLLAddHUDMessage(DTXT_TIMELIMITSETMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2662:9`!, d); |
| 589 | else |
| 590 | DLLAddHUDMessage(DTXT_TIMELIMITOFFMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2663:9`!); |
| 591 | |
| 592 | basethiscxx . . $ basethis.->SendNetGameInfoSynccxx . . $ DMFCBase#SendNetGameInfoSync(d4f767463ce0a6b3).(); |
| 593 | } |
| 594 | |
| 595 | // handles changing the level goal limit of a netgame on the fly |
| 596 | // Usage: "$setgoallimit <int goal>" where goal is the number of points |
| 597 | void DMFCInputCommand_SetGoalLimitcxx . . $ DMFCInputCommand_SetGoalLimit(85c52e162fed56f9).(const char *input_string) { |
| 598 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 599 | return; |
| 600 | int d; |
| 601 | char temp[20]; |
| 602 | |
| 603 | // parse "$setgoallimit" |
| 604 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, temp, 20, &input_string)) { |
| 605 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_SETGOALLIMITcxx . . $ `netgames/dmfc/dmfcinternal.h:2560:9`!); |
| 606 | return; |
| 607 | } |
| 608 | |
| 609 | if (!StringParseNumbercxx . . $ StringParseNumber(8de6ed5103590a5a).(input_string, &d, &input_string)) { |
| 610 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_SETGOALLIMITcxx . . $ `netgames/dmfc/dmfcinternal.h:2560:9`!); |
| 611 | return; |
| 612 | } |
| 613 | |
| 614 | if (d < 0) |
| 615 | d = 0; |
| 616 | basethiscxx . . $ basethis.->Netgamecxx . . $ DMFCBase#Netgame.->killgoalcxx . . $ netgame_info#killgoal. = d; |
| 617 | |
| 618 | if (d == 0) { |
| 619 | basethiscxx . . $ basethis.->Netgamecxx . . $ DMFCBase#Netgame.->flagscxx . . $ netgame_info#flags. &= ~NF_KILLGOALcxx . . $ `Descent3/multi_external.h:227:9`!; |
| 620 | } else { |
| 621 | basethiscxx . . $ basethis.->Netgamecxx . . $ DMFCBase#Netgame.->flagscxx . . $ netgame_info#flags. |= NF_KILLGOALcxx . . $ `Descent3/multi_external.h:227:9`!; |
| 622 | } |
| 623 | |
| 624 | if (basethiscxx . . $ basethis.->Netgamecxx . . $ DMFCBase#Netgame.->flagscxx . . $ netgame_info#flags. & NF_KILLGOALcxx . . $ `Descent3/multi_external.h:227:9`!) |
| 625 | DLLAddHUDMessage(DTXT_GOALLIMITSETMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2664:9`!, d); |
| 626 | else |
| 627 | DLLAddHUDMessage(DTXT_GOALLIMITOFFMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2665:9`!); |
| 628 | |
| 629 | basethiscxx . . $ basethis.->SendNetGameInfoSynccxx . . $ DMFCBase#SendNetGameInfoSync(d4f767463ce0a6b3).(); |
| 630 | } |
| 631 | |
| 632 | // handles changing the number of max players in a netgame |
| 633 | // Usage: "$setmaxplayers <int max>" where max is the maximum players |
| 634 | void DMFCInputCommand_SetMaxPlayerscxx . . $ DMFCInputCommand_SetMaxPlayers(85c52e162fed56f9).(const char *input_string) { |
| 635 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 636 | return; |
| 637 | int d; |
| 638 | char temp[20]; |
| 639 | |
| 640 | // parse "$setmaxplayers" |
| 641 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, temp, 20, &input_string)) { |
| 642 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_SETMAXPLAYERScxx . . $ `netgames/dmfc/dmfcinternal.h:2563:9`!); |
| 643 | return; |
| 644 | } |
| 645 | |
| 646 | // parse the number |
| 647 | if (!StringParseNumbercxx . . $ StringParseNumber(8de6ed5103590a5a).(input_string, &d, &input_string)) { |
| 648 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_SETMAXPLAYERScxx . . $ `netgames/dmfc/dmfcinternal.h:2563:9`!); |
| 649 | return; |
| 650 | } |
| 651 | |
| 652 | // get the number of players in the game currently |
| 653 | int curr_count = 0; |
| 654 | for (int i = 0; i < DLLMAX_PLAYERScxx . . $ `netgames/includes/DMFC.h:425:9`!; i++) { |
| 655 | if (basethiscxx . . $ basethis.->CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(i)) |
| 656 | curr_count++; |
| 657 | } |
| 658 | if (d < curr_count) |
| 659 | d = curr_count; |
| 660 | if (d > basethiscxx . . $ basethis.->Hard_max_playerscxx . . $ DMFCBase#Hard_max_players.) |
| 661 | d = basethiscxx . . $ basethis.->Hard_max_playerscxx . . $ DMFCBase#Hard_max_players.; |
| 662 | |
| 663 | basethiscxx . . $ basethis.->Netgamecxx . . $ DMFCBase#Netgame.->max_playerscxx . . $ netgame_info#max_players. = d; |
| 664 | |
| 665 | DLLAddHUDMessage(DTXT_MAXPLAYERSSETMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2666:9`!, d); |
| 666 | |
| 667 | basethiscxx . . $ basethis.->SendNetGameInfoSynccxx . . $ DMFCBase#SendNetGameInfoSync(d4f767463ce0a6b3).(); |
| 668 | } |
| 669 | |
| 670 | // handles changing the respawn time of the powerups in a level of a netgame |
| 671 | // Usage: "$setrespawntime <int seconds>" where seconds is the time in seconds |
| 672 | void DMFCInputCommand_SetRespawnTimecxx . . $ DMFCInputCommand_SetRespawnTime(85c52e162fed56f9).(const char *input_string) { |
| 673 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 674 | return; |
| 675 | int d; |
| 676 | char temp[20]; |
| 677 | |
| 678 | // parse "$setrespawntime" |
| 679 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, temp, 20, &input_string)) { |
| 680 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_SETRESPAWNTIMEcxx . . $ `netgames/dmfc/dmfcinternal.h:2570:9`!); |
| 681 | return; |
| 682 | } |
| 683 | |
| 684 | // parse the value |
| 685 | if (!StringParseNumbercxx . . $ StringParseNumber(8de6ed5103590a5a).(input_string, &d, &input_string)) { |
| 686 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_SETRESPAWNTIMEcxx . . $ `netgames/dmfc/dmfcinternal.h:2570:9`!); |
| 687 | return; |
| 688 | } |
| 689 | |
| 690 | if (d < 1) |
| 691 | d = 1; |
| 692 | |
| 693 | basethiscxx . . $ basethis.->Netgamecxx . . $ DMFCBase#Netgame.->respawn_timecxx . . $ netgame_info#respawn_time. = d; |
| 694 | |
| 695 | DLLAddHUDMessage(DTXT_RESPAWNTIMEMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2667:9`!, d); |
| 696 | |
| 697 | basethiscxx . . $ basethis.->SendNetGameInfoSynccxx . . $ DMFCBase#SendNetGameInfoSync(d4f767463ce0a6b3).(); |
| 698 | } |
| 699 | |
| 700 | // handle the client requesting netgame info |
| 701 | // Usage: "$netgameinfo" |
| 702 | void DMFCInputCommand_NetGameInfocxx . . $ DMFCInputCommand_NetGameInfo(85c52e162fed56f9).(const char *input_string) { |
| 703 | bool display = !basethiscxx . . $ basethis.->IsDisplayingNetGameInfocxx . . $ DMFCBase#IsDisplayingNetGameInfo(c9857a73d68e59ba).(); |
| 704 | basethiscxx . . $ basethis.->SwitchNetGameInfoDisplaycxx . . $ DMFCBase#SwitchNetGameInfoDisplay(d4f767463ce0a6b3).((display) ? 1 : 0); |
| 705 | |
| 706 | // always display this on this input command for the dedicated server |
| 707 | basethiscxx . . $ basethis.->DisplayNetGameInfocxx . . $ DMFCBase#DisplayNetGameInfo(918ebd27a9ddbad3).(-1, true); |
| 708 | } |
| 709 | |
| 710 | // handle the server changing the pps threshold of the game |
| 711 | // Usage: "$setpps <int pps>" where pps is the Packets Per Second |
| 712 | void DMFCInputCommand_SetPPScxx . . $ DMFCInputCommand_SetPPS(85c52e162fed56f9).(const char *input_string) { |
| 713 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 714 | return; |
| 715 | int d; |
| 716 | char temp[20]; |
| 717 | |
| 718 | //"$setpps" |
| 719 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, temp, 20, &input_string)) { |
| 720 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_SETPPScxx . . $ `netgames/dmfc/dmfcinternal.h:2567:9`!); |
| 721 | return; |
| 722 | } |
| 723 | |
| 724 | // parse value |
| 725 | if (!StringParseNumbercxx . . $ StringParseNumber(8de6ed5103590a5a).(input_string, &d, &input_string)) { |
| 726 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_SETPPScxx . . $ `netgames/dmfc/dmfcinternal.h:2567:9`!); |
| 727 | return; |
| 728 | } |
| 729 | |
| 730 | if (d < 1) |
| 731 | d = 1; |
| 732 | if (d > 20) |
| 733 | d = 20; |
| 734 | basethiscxx . . $ basethis.->Netgamecxx . . $ DMFCBase#Netgame.->packets_per_secondcxx . . $ netgame_info#packets_per_second. = d; |
| 735 | |
| 736 | DLLAddHUDMessage(DTXT_PPSSETMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2668:9`!, d); |
| 737 | |
| 738 | basethiscxx . . $ basethis.->SendNetGameInfoSynccxx . . $ DMFCBase#SendNetGameInfoSync(d4f767463ce0a6b3).(); |
| 739 | } |
| 740 | |
| 741 | // handles listing the ban list on a dedicated server (so if you want to remove a player from it) |
| 742 | // Usage: "$banlist" |
| 743 | void DMFCInputCommand_BanListcxx . . $ DMFCInputCommand_BanList(85c52e162fed56f9).(const char *input_string) { |
| 744 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 745 | return; |
| 746 | |
| 747 | int size = basethiscxx . . $ basethis.->GetNumBannedPlayerscxx . . $ DMFCBase#GetNumBannedPlayers(b126dc7c1de90089).(); |
| 748 | char buffer[100]; |
| 749 | |
| 750 | for (int i = 0; i < size; i++) { |
| 751 | char *ptr = basethiscxx . . $ basethis.->GetBannedPlayerCallsigncxx . . $ DMFCBase#GetBannedPlayerCallsign(ff224f080444ee45).(i); |
| 752 | if (ptr) { |
| 753 | snprintf(buffer, sizeof(buffer), "[%d]%s\n", i, ptr); |
| 754 | DPrintf(buffer); |
| 755 | } |
| 756 | } |
| 757 | } |
| 758 | |
| 759 | // handles removing a ban from a player, given the ban index num (see $banlist) |
| 760 | // Usage: "$removeban <int bannum>" where bannum is the number corresponding to that given during a $banlist |
| 761 | void DMFCInputCommand_RemoveBancxx . . $ DMFCInputCommand_RemoveBan(85c52e162fed56f9).(const char *input_string) { |
| 762 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 763 | return; |
| 764 | |
| 765 | int d; |
| 766 | char temp[20]; |
| 767 | |
| 768 | //"$removeban" |
| 769 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, temp, 20, &input_string)) { |
| 770 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_REMOVEBANcxx . . $ `netgames/dmfc/dmfcinternal.h:2548:9`!); |
| 771 | return; |
| 772 | } |
| 773 | |
| 774 | // value |
| 775 | if (!StringParseNumbercxx . . $ StringParseNumber(8de6ed5103590a5a).(input_string, &d, &input_string)) { |
| 776 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_REMOVEBANcxx . . $ `netgames/dmfc/dmfcinternal.h:2548:9`!); |
| 777 | return; |
| 778 | } |
| 779 | |
| 780 | if (basethiscxx . . $ basethis.->RemoveBancxx . . $ DMFCBase#RemoveBan(83c267b20bac841a).(d)) { |
| 781 | DLLAddHUDMessage(DTXT_BANREMOVEDMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2669:9`!); |
| 782 | DPrintf(DTXT_BANREMOVEDMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2669:9`!); |
| 783 | } else { |
| 784 | DLLAddHUDMessage(DTXT_BANNOTREMOVEDMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2670:9`!); |
| 785 | DPrintf(DTXT_BANNOTREMOVEDMSGcxx . . $ `netgames/dmfc/dmfcinternal.h:2670:9`!); |
| 786 | } |
| 787 | } |
| 788 | |
| 789 | // handles changing the filter for death messages |
| 790 | // Usage: "$killmsgfilter <full/simple/none>" |
| 791 | void DMFCInputCommand_KillMsgFiltercxx . . $ DMFCInputCommand_KillMsgFilter(85c52e162fed56f9).(const char *input_string) { |
| 792 | char s[20]; |
| 793 | |
| 794 | //"$killmsgfilter" |
| 795 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 796 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_KILLMSGFILTERcxx . . $ `netgames/dmfc/dmfcinternal.h:2526:9`!); |
| 797 | return; |
| 798 | } |
| 799 | |
| 800 | // parse level |
| 801 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 802 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_KILLMSGFILTERcxx . . $ `netgames/dmfc/dmfcinternal.h:2526:9`!); |
| 803 | return; |
| 804 | } |
| 805 | |
| 806 | uint8_tcxx . . $ uint8_t# level = DM_FILTER_FULLcxx . . $ `netgames/dmfc/dmfcinternal.h:2780:9`!; |
| 807 | if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(s, DTXT_PLAIN_NONEcxx . . $ `netgames/dmfc/dmfcinternal.h:2454:9`!)) |
| 808 | level = DM_FILTER_NONEcxx . . $ `netgames/dmfc/dmfcinternal.h:2782:9`!; |
| 809 | else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(s, DTXT_OSM_SIMPLEcxx . . $ `netgames/dmfc/dmfcinternal.h:2468:9`!)) |
| 810 | level = DM_FILTER_SIMPLEcxx . . $ `netgames/dmfc/dmfcinternal.h:2781:9`!; |
| 811 | |
| 812 | basethiscxx . . $ basethis.->SetDeathMessageFiltercxx . . $ DMFCBase#SetDeathMessageFilter(d4f767463ce0a6b3).(level); |
| 813 | } |
| 814 | |
| 815 | // handles the server changing a team's name |
| 816 | // Usage: "$setteamname <team_num> <new_team_name> |
| 817 | void DMFCInputCommand_SetTeamNamecxx . . $ DMFCInputCommand_SetTeamName(85c52e162fed56f9).(const char *input_string) { |
| 818 | char s[20]; |
| 819 | int team; |
| 820 | |
| 821 | // parse "$setteamname" |
| 822 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 823 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_SETTEAMNAMEcxx . . $ `netgames/dmfc/dmfcinternal.h:2574:9`!); |
| 824 | return; |
| 825 | } |
| 826 | |
| 827 | // parse team_num |
| 828 | if (!StringParseNumbercxx . . $ StringParseNumber(8de6ed5103590a5a).(input_string, &team, &input_string)) { |
| 829 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_SETTEAMNAMEcxx . . $ `netgames/dmfc/dmfcinternal.h:2574:9`!); |
| 830 | return; |
| 831 | } |
| 832 | |
| 833 | if (team < 0 || team > DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`!) { |
| 834 | DLLAddHUDMessage(DTXT_INVALIDTEAMcxx . . $ `netgames/dmfc/dmfcinternal.h:2675:9`!, DLLMAX_TEAMScxx . . $ `netgames/includes/DMFC.h:426:9`! - 1); |
| 835 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_SETTEAMNAMEcxx . . $ `netgames/dmfc/dmfcinternal.h:2574:9`!); |
| 836 | return; |
| 837 | } |
| 838 | |
| 839 | // parse team_name |
| 840 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(MAX_TEAMNAME_LENcxx . . $ `netgames/includes/DMFC.h:443:9`!, 20), &input_string)) { |
| 841 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_SETTEAMNAMEcxx . . $ `netgames/dmfc/dmfcinternal.h:2574:9`!); |
| 842 | return; |
| 843 | } |
| 844 | |
| 845 | basethiscxx . . $ basethis.->SetTeamNamecxx . . $ DMFCBase#SetTeamName(dc3004c27659fe3).(team, s, true); |
| 846 | } |
| 847 | |
| 848 | // handles a request for help to see a list of commands, dedicated server only |
| 849 | // Usage: "$help [command]" |
| 850 | void DMFCInputCommand_Helpcxx . . $ DMFCInputCommand_Help(85c52e162fed56f9).(const char *input_string) { |
| 851 | char s[20]; |
| 852 | |
| 853 | // parse "$help" |
| 854 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 855 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_HELPcxx . . $ `netgames/dmfc/dmfcinternal.h:2517:9`!); |
| 856 | return; |
| 857 | } |
| 858 | |
| 859 | // see if there is another command |
| 860 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 861 | s[0] = '\0'; |
| 862 | } |
| 863 | |
| 864 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(s); |
| 865 | } |
| 866 | |
| 867 | // handles a request to rehash the hosts.allow/deny |
| 868 | // Usage: "$rehash" |
| 869 | void DMFCInputCommand_Rehashcxx . . $ DMFCInputCommand_Rehash(85c52e162fed56f9).(const char *input_string) { |
| 870 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 871 | return; |
| 872 | |
| 873 | RehashAllowDenyListscxx . . $ RehashAllowDenyLists(d4f767463ce0a6b3).(0); |
| 874 | } |
| 875 | |
| 876 | // handles a request to enter/leave observer mode |
| 877 | // Usage: "$observer <on/off>" |
| 878 | void DMFCInputCommand_Observercxx . . $ DMFCInputCommand_Observer(85c52e162fed56f9).(const char *input_string) { |
| 879 | if (basethiscxx . . $ basethis.->IAmDedicatedServercxx . . $ DMFCBase#IAmDedicatedServer(c9857a73d68e59ba).()) { |
| 880 | DPrintf(DTXT_NOTINDEDICATEDcxx . . $ `netgames/dmfc/dmfcinternal.h:2671:9`!); |
| 881 | return; |
| 882 | } |
| 883 | |
| 884 | char s[20]; |
| 885 | bool turn_on = true; |
| 886 | objectcxx . . $ object# *pobj; |
| 887 | int pnum = basethiscxx . . $ basethis.->GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).(); |
| 888 | pobj = &basethiscxx . . $ basethis.->Objectscxx . . $ DMFCBase#Objects.[basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[pnum].objnumcxx . . $ player#objnum.]; |
| 889 | |
| 890 | // parse "$observer" |
| 891 | StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string); |
| 892 | |
| 893 | // see if there is another command |
| 894 | if (StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 895 | if (stricmpcxx . . $ `linux/linux_fix.h:43:9`!(s, DTXT_MNUONcxx . . $ `netgames/dmfc/dmfcinternal.h:2408:9`!)) |
| 896 | turn_on = false; |
| 897 | } else { |
| 898 | if (pobj->typecxx . . $ object#type. == OBJ_OBSERVERcxx . . $ `Descent3/object_external.h:182:9`!) { |
| 899 | turn_on = false; |
| 900 | } else { |
| 901 | turn_on = true; |
| 902 | } |
| 903 | } |
| 904 | |
| 905 | if (!basethiscxx . . $ basethis.->CallOnAllowObserverChangecxx . . $ DMFCBase#CallOnAllowObserverChange(efaadfb7dc14930a).(turn_on)) { |
| 906 | DLLAddHUDMessage(DTXT_OBSERVERDENIEDcxx . . $ `netgames/dmfc/dmfcinternal.h:2672:9`!); |
| 907 | return; |
| 908 | } |
| 909 | |
| 910 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "SwitchObserverMode %s [%d]\n", (turn_on) ? "On" : "Off", pnum); |
| 911 | |
| 912 | DLLMultiSendRequestToObserve(OBSERVER_MODE_ROAMcxx . . $ `Descent3/player_external.h:75:9`!, (turn_on) ? 1 : 0, 0); |
| 913 | } |
| 914 | |
| 915 | // handles a request to piggyback a player |
| 916 | // Usage: "$piggyback <pnum>" |
| 917 | void DMFCInputCommand_Piggybackcxx . . $ DMFCInputCommand_Piggyback(85c52e162fed56f9).(const char *input_string) { |
| 918 | if (basethiscxx . . $ basethis.->IAmDedicatedServercxx . . $ DMFCBase#IAmDedicatedServer(c9857a73d68e59ba).()) { |
| 919 | DPrintf(DTXT_NOTINDEDICATEDcxx . . $ `netgames/dmfc/dmfcinternal.h:2671:9`!); |
| 920 | return; |
| 921 | } |
| 922 | |
| 923 | char s[20]; |
| 924 | bool turn_on = true; |
| 925 | objectcxx . . $ object# *pobj; |
| 926 | int pnum = basethiscxx . . $ basethis.->GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).(); |
| 927 | pobj = &basethiscxx . . $ basethis.->Objectscxx . . $ DMFCBase#Objects.[basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[pnum].objnumcxx . . $ player#objnum.]; |
| 928 | int topnum = -1; |
| 929 | |
| 930 | // parse "$piggyback" |
| 931 | StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string); |
| 932 | |
| 933 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 934 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_PIGGYBACKcxx . . $ `netgames/dmfc/dmfcinternal.h:2536:9`!); |
| 935 | return; |
| 936 | } |
| 937 | |
| 938 | char *ptr = s; |
| 939 | while (*ptr) { |
| 940 | if (!isdigit(*ptr)) { |
| 941 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_PIGGYBACKcxx . . $ `netgames/dmfc/dmfcinternal.h:2536:9`!); |
| 942 | return; |
| 943 | } |
| 944 | ptr++; |
| 945 | } |
| 946 | |
| 947 | topnum = atoicxx . . $ atoi(f5ecf3191ed0cd93).(s); |
| 948 | if (!basethiscxx . . $ basethis.->CheckPlayerNumcxx . . $ DMFCBase#CheckPlayerNum(83c267b20bac841a).(topnum)) { |
| 949 | DLLAddHUDMessage(DTXT_INVALIDPNUMcxx . . $ `netgames/dmfc/dmfcinternal.h:2673:9`!); |
| 950 | return; |
| 951 | } |
| 952 | |
| 953 | if (pobj->typecxx . . $ object#type. == OBJ_OBSERVERcxx . . $ `Descent3/object_external.h:182:9`!) { |
| 954 | if (basethiscxx . . $ basethis.->CallOnAllowObserverChangecxx . . $ DMFCBase#CallOnAllowObserverChange(efaadfb7dc14930a).(false)) |
| 955 | DLLMultiSendRequestToObserve(OBSERVER_MODE_ROAMcxx . . $ `Descent3/player_external.h:75:9`!, 0, 0); |
| 956 | } |
| 957 | if (pnum == basethiscxx . . $ basethis.->GetPlayerNumcxx . . $ DMFCBase#GetPlayerNum(b126dc7c1de90089).()) { |
| 958 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Returning to self\n"); |
| 959 | return; |
| 960 | } |
| 961 | |
| 962 | if (basethiscxx . . $ basethis.->CallOnAllowObserverChangecxx . . $ DMFCBase#CallOnAllowObserverChange(efaadfb7dc14930a).(true)) { |
| 963 | mprintfcxx . . $ `netgames/dmfc/dmfcinternal.h:275:9`!(0, "Switching to piggyback for player %d\n", topnum); |
| 964 | DLLMultiSendRequestToObserve(OBSERVER_MODE_PIGGYBACKcxx . . $ `Descent3/player_external.h:76:9`!, 1, basethiscxx . . $ basethis.->Playerscxx . . $ DMFCBase#Players.[topnum].objnumcxx . . $ player#objnum.); |
| 965 | } |
| 966 | } |
| 967 | |
| 968 | // handles a request to warp to another level |
| 969 | // Usage: "$warp <level number>" |
| 970 | void DMFCInputCommand_Warpcxx . . $ DMFCInputCommand_Warp(85c52e162fed56f9).(const char *input_string) { |
| 971 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 972 | return; |
| 973 | |
| 974 | char s[20]; |
| 975 | int level; |
| 976 | |
| 977 | // parse "$warp" |
| 978 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 979 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_WARPcxx . . $ `netgames/dmfc/dmfcinternal.h:2715:9`!); |
| 980 | return; |
| 981 | } |
| 982 | |
| 983 | // parse levelnum |
| 984 | if (!StringParseNumbercxx . . $ StringParseNumber(8de6ed5103590a5a).(input_string, &level, &input_string)) { |
| 985 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_WARPcxx . . $ `netgames/dmfc/dmfcinternal.h:2715:9`!); |
| 986 | return; |
| 987 | } |
| 988 | |
| 989 | basethiscxx . . $ basethis.->WarpToLevelcxx . . $ DMFCBase#WarpToLevel(d4f767463ce0a6b3).(level); |
| 990 | } |
| 991 | |
| 992 | // handles enable/disable remote administration |
| 993 | // Usage: "$remoteadmin <on/off>" |
| 994 | extern bool Use_remote_admincxx . . $ Use_remote_admin.; |
| 995 | void DMFCInputCommand_RemoteAdmincxx . . $ DMFCInputCommand_RemoteAdmin(85c52e162fed56f9).(const char *input_string) { |
| 996 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 997 | return; |
| 998 | char s[20]; |
| 999 | |
| 1000 | // parse "$remoteadmin" |
| 1001 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 1002 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_REMOTEADMINcxx . . $ `netgames/dmfc/dmfcinternal.h:2739:9`!); |
| 1003 | return; |
| 1004 | } |
| 1005 | |
| 1006 | // parse the off/on |
| 1007 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 1008 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_REMOTEADMINcxx . . $ `netgames/dmfc/dmfcinternal.h:2739:9`!); |
| 1009 | return; |
| 1010 | } |
| 1011 | |
| 1012 | int on = 1; |
| 1013 | |
| 1014 | if (!strnicmpcxx . . $ `linux/linux_fix.h:44:9`!(s, DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!, strlen(DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!))) |
| 1015 | on = 0; |
| 1016 | |
| 1017 | Remote_Enablecxx . . $ Remote_Enable(b45ddcbc8423892c).((bool)(on != 0)); |
| 1018 | |
| 1019 | if (on && !Use_remote_admincxx . . $ Use_remote_admin.) { |
| 1020 | // no password set |
| 1021 | DLLAddHUDMessage(DTXT_UNABLETOREMOTEcxx . . $ `netgames/dmfc/dmfcinternal.h:2728:9`!); |
| 1022 | } else { |
| 1023 | DLLAddHUDMessage(DTXT_REMOTEADMINENABLEcxx . . $ `netgames/dmfc/dmfcinternal.h:2729:9`!, (Use_remote_admincxx . . $ Use_remote_admin.) ? DTXT_MNUONcxx . . $ `netgames/dmfc/dmfcinternal.h:2408:9`! : DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!); |
| 1024 | } |
| 1025 | } |
| 1026 | |
| 1027 | // handles setting/changing the remote administration password |
| 1028 | // Usage: "$remoteadminpass <password>" |
| 1029 | void DMFCInputCommand_RemoteAdminPasscxx . . $ DMFCInputCommand_RemoteAdminPass(85c52e162fed56f9).(const char *input_string) { |
| 1030 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 1031 | return; |
| 1032 | char s[64]; |
| 1033 | |
| 1034 | // parse "$remoteadminpass" |
| 1035 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 1036 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_REMOTEADMINPASScxx . . $ `netgames/dmfc/dmfcinternal.h:2747:9`!); |
| 1037 | return; |
| 1038 | } |
| 1039 | |
| 1040 | // parse the password |
| 1041 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 64, &input_string)) { |
| 1042 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_REMOTEADMINPASScxx . . $ `netgames/dmfc/dmfcinternal.h:2747:9`!); |
| 1043 | return; |
| 1044 | } |
| 1045 | |
| 1046 | Remote_SetPasswordcxx . . $ Remote_SetPassword(fda57c8427c60377).(s); |
| 1047 | DLLAddHUDMessage(DTXT_REMOTEADMINPASScxx . . $ `netgames/dmfc/dmfcinternal.h:2730:9`!); |
| 1048 | } |
| 1049 | |
| 1050 | // handles seeing who is logged in, and allows the server to log them out |
| 1051 | // If no parameter is given it lists all the players logged in. |
| 1052 | // To log out a player give the login-id as a parameter |
| 1053 | // Usage: "$remoteadminlogout [login-id]" |
| 1054 | void DMFCInputCommand_RemoteAdminLogoutcxx . . $ DMFCInputCommand_RemoteAdminLogout(85c52e162fed56f9).(const char *input_string) { |
| 1055 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 1056 | return; |
| 1057 | char s[64]; |
| 1058 | |
| 1059 | // parse "$remoteadminlogout" |
| 1060 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 64, &input_string)) { |
| 1061 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_REMOTEADMINLOGOUTcxx . . $ `netgames/dmfc/dmfcinternal.h:2742:9`!); |
| 1062 | return; |
| 1063 | } |
| 1064 | |
| 1065 | // see if there is another command |
| 1066 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 64, &input_string)) { |
| 1067 | // list who is logged in |
| 1068 | Remote_ListLoginscxx . . $ Remote_ListLogins(49f6e7a06ebc5aa8).(); |
| 1069 | return; |
| 1070 | } |
| 1071 | |
| 1072 | // logout |
| 1073 | int prec = atoicxx . . $ atoi(f5ecf3191ed0cd93).(s); |
| 1074 | Remote_Logoutcxx . . $ Remote_Logout(d4f767463ce0a6b3).(prec); |
| 1075 | } |
| 1076 | |
| 1077 | // handles a remote admin command |
| 1078 | // Usage: "$remote <command> <option parms> <...>" |
| 1079 | void DMFCInputCommand_Remotecxx . . $ DMFCInputCommand_Remote(85c52e162fed56f9).(const char *input_string) { |
| 1080 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() == LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 1081 | return; |
| 1082 | char s[20]; |
| 1083 | |
| 1084 | // parse "$remote" |
| 1085 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 1086 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_REMOTEcxx . . $ `netgames/dmfc/dmfcinternal.h:2736:9`!); |
| 1087 | return; |
| 1088 | } |
| 1089 | |
| 1090 | Remote_ClientProcesscxx . . $ Remote_ClientProcess(85c52e162fed56f9).(input_string + 1 /*for space*/); |
| 1091 | } |
| 1092 | |
| 1093 | // handles a request to make all clients wait/or stop waiting |
| 1094 | // Usage: "$wait <on/off>" |
| 1095 | void DMFCInputCommand_Waitcxx . . $ DMFCInputCommand_Wait(85c52e162fed56f9).(const char *input_string) { |
| 1096 | if (basethiscxx . . $ basethis.->GetLocalRolecxx . . $ DMFCBase#GetLocalRole(b126dc7c1de90089).() != LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`!) |
| 1097 | return; |
| 1098 | if (!basethiscxx . . $ basethis.->IAmDedicatedServercxx . . $ DMFCBase#IAmDedicatedServer(c9857a73d68e59ba).()) |
| 1099 | return; |
| 1100 | |
| 1101 | char s[20]; |
| 1102 | |
| 1103 | // parse "$wait" |
| 1104 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 1105 | return; |
| 1106 | } |
| 1107 | |
| 1108 | // parse the off/on |
| 1109 | if (!StringParseWordcxx . . $ StringParseWord(a346a35e515f1bd).(input_string, s, 20, &input_string)) { |
| 1110 | basethiscxx . . $ basethis.->DisplayInputCommandHelpcxx . . $ DMFCBase#DisplayInputCommandHelp(85c52e162fed56f9).(DTXT_IC_WAITcxx . . $ `netgames/dmfc/dmfcinternal.h:2751:9`!); |
| 1111 | return; |
| 1112 | } |
| 1113 | |
| 1114 | bool on = true; |
| 1115 | |
| 1116 | if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(s, DTXT_MNUOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2409:9`!)) |
| 1117 | on = false; |
| 1118 | else if (stricmpcxx . . $ `linux/linux_fix.h:43:9`!(s, DTXT_MNUONcxx . . $ `netgames/dmfc/dmfcinternal.h:2408:9`!)) { |
| 1119 | // it's not ON of OFF |
| 1120 | float wait_time = atofcxx . . $ atof(9b0361fcbc284e4f).(s); |
| 1121 | if (wait_time > 0) { |
| 1122 | DPrintf(DTXT_WAITSECScxx . . $ `netgames/dmfc/dmfcinternal.h:2731:9`!, wait_time); |
| 1123 | basethiscxx . . $ basethis.->PauseRealGameTimecxx . . $ DMFCBase#PauseRealGameTime(b45ddcbc8423892c).(true); |
| 1124 | basethiscxx . . $ basethis.->MakeClientsWaitcxx . . $ DMFCBase#MakeClientsWait(b45ddcbc8423892c).(true); |
| 1125 | basethiscxx . . $ basethis.->SetDedicatedWaitcxx . . $ DMFCBase#SetDedicatedWait(9364e6e7bff7660).(wait_time); |
| 1126 | } else if (wait_time == 0) { |
| 1127 | DPrintf(DTXT_WAITOFFcxx . . $ `netgames/dmfc/dmfcinternal.h:2732:9`!); |
| 1128 | basethiscxx . . $ basethis.->PauseRealGameTimecxx . . $ DMFCBase#PauseRealGameTime(b45ddcbc8423892c).(false); |
| 1129 | basethiscxx . . $ basethis.->MakeClientsWaitcxx . . $ DMFCBase#MakeClientsWait(b45ddcbc8423892c).(false); |
| 1130 | basethiscxx . . $ basethis.->SetDedicatedWaitcxx . . $ DMFCBase#SetDedicatedWait(9364e6e7bff7660).(0); |
| 1131 | } |
| 1132 | return; |
| 1133 | } |
| 1134 | |
| 1135 | // turn on client waiting |
| 1136 | if (on) { |
| 1137 | DPrintf(DTXT_WAITONcxx . . $ `netgames/dmfc/dmfcinternal.h:2733:9`!); |
| 1138 | } else { |
| 1139 | DPrintf(DTXT_WAITNOLONGERcxx . . $ `netgames/dmfc/dmfcinternal.h:2734:9`!); |
| 1140 | } |
| 1141 | |
| 1142 | basethiscxx . . $ basethis.->PauseRealGameTimecxx . . $ DMFCBase#PauseRealGameTime(b45ddcbc8423892c).(on); |
| 1143 | basethiscxx . . $ basethis.->MakeClientsWaitcxx . . $ DMFCBase#MakeClientsWait(b45ddcbc8423892c).(on); |
| 1144 | } |