| 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 | |
| 19 | #ifndef DEDICATED_SERVER_H |
| 20 | #define DEDICATED_SERVER_Hcxx . . $ `lib/dedicated_server.h:20:9`! |
| 21 | |
| 22 | #define CVAR_GAMEINITcxx . . $ `lib/dedicated_server.h:22:9`! 0x0001 // this variable can be set/changed during server init |
| 23 | #define CVAR_GAMEPLAYcxx . . $ `lib/dedicated_server.h:23:9`! 0x0002 // this variable can be set/changed during game play |
| 24 | |
| 25 | enum cvar_typecxx . . $ cvar_type# { |
| 26 | CVAR_TYPE_INTcxx . . $ CVAR_TYPE_INT., |
| 27 | CVAR_TYPE_FLOATcxx . . $ CVAR_TYPE_FLOAT., |
| 28 | CVAR_TYPE_STRINGcxx . . $ CVAR_TYPE_STRING., |
| 29 | CVAR_TYPE_NONEcxx . . $ CVAR_TYPE_NONE., |
| 30 | }; |
| 31 | |
| 32 | struct cvar_entrycxx . . $ cvar_entry# { |
| 33 | const char *varnamecxx . . $ cvar_entry#varname.; |
| 34 | cvar_typecxx . . $ cvar_type# typecxx . . $ cvar_entry#type.; |
| 35 | void *dest_variablecxx . . $ cvar_entry#dest_variable.; |
| 36 | int var_mincxx . . $ cvar_entry#var_min., var_maxcxx . . $ cvar_entry#var_max.; |
| 37 | int16_t permissionscxx . . $ cvar_entry#permissions.; |
| 38 | }; |
| 39 | |
| 40 | extern bool Dedicated_servercxx . . $ Dedicated_server.; |
| 41 | |
| 42 | // Sets the value for a cvar INT type |
| 43 | void SetCVarIntcxx . . $ SetCVarInt(3e454b8ccf442868).(int index, int val); |
| 44 | |
| 45 | // Sets the value for a cvar FLOAT type |
| 46 | void SetCVarFloatcxx . . $ SetCVarFloat(43c79ee2f1b9aefe).(int index, float val); |
| 47 | |
| 48 | // Sets the value for a cvar string type |
| 49 | void SetCVarStringcxx . . $ SetCVarString(66835f578de1bcb3).(int index, const char *val); |
| 50 | |
| 51 | // The accessor function that sets the value of a cvar |
| 52 | void SetCVarcxx . . $ SetCVar(8d00172ec7558ddf).(const char *cvar_string, const char *cvar_argument, bool in_game_init); |
| 53 | |
| 54 | // The accessor function that sets the value of a cvar...INT only |
| 55 | void SetCVarcxx . . $ SetCVar(34d26762b42c433a).(const char *cvar_string, int cvar_argument); |
| 56 | |
| 57 | // The accessor function that sets the value of a cvar...FLOAT only |
| 58 | void SetCVarcxx . . $ SetCVar(42eacfea086a5352).(const char *cvar_string, float cvar_argument); |
| 59 | |
| 60 | // Starts a dedicated server and loads the server config file |
| 61 | void StartDedicatedServercxx . . $ StartDedicatedServer(49f6e7a06ebc5aa8).(); |
| 62 | |
| 63 | // Reads in the server config file for a dedicated server |
| 64 | // Returns true if everything is ok |
| 65 | int LoadServerConfigFilecxx . . $ LoadServerConfigFile(b126dc7c1de90089).(); |
| 66 | |
| 67 | // Called once per frame for the dedicated server |
| 68 | void DoDedicatedServerFramecxx . . $ DoDedicatedServerFrame(49f6e7a06ebc5aa8).(); |
| 69 | |
| 70 | // Prints a message to the console if the dedicated server is active |
| 71 | void PrintDedicatedMessagecxx . . $ PrintDedicatedMessage(326aeb464d16410c).(const char *fmt, ...); |
| 72 | |
| 73 | // Reads incoming data from the telnet connection to the server |
| 74 | void DedicatedReadTelnetcxx . . $ DedicatedReadTelnet(49f6e7a06ebc5aa8).(void); |
| 75 | |
| 76 | // Sends a string to all connected and logged in clients |
| 77 | void DedicatedSocketputscxx . . $ DedicatedSocketputs(fda57c8427c60377).(char *str); |
| 78 | |
| 79 | // Look for incoming connections |
| 80 | void ListenDedicatedSocketcxx . . $ ListenDedicatedSocket(49f6e7a06ebc5aa8).(void); |
| 81 | |
| 82 | // Init the socket and start listening |
| 83 | void InitDedicatedSocketcxx . . $ InitDedicatedSocket(ed53e3bbd3fa2f69).(uint16_tcxx . . $ uint16_t# port); |
| 84 | |
| 85 | #endif |