1 // SONIC ROBO BLAST 2 2 //----------------------------------------------------------------------------- 3 // Copyright (C) 1998-2000 by DooM Legacy Team. 4 // Copyright (C) 1999-2020 by Sonic Team Junior. 5 // 6 // This program is free software distributed under the 7 // terms of the GNU General Public License, version 2. 8 // See the 'LICENSE' file for more details. 9 //----------------------------------------------------------------------------- 10 /// \file d_netcmd.h 11 /// \brief host/client network commands 12 /// commands are executed through the command buffer 13 /// like console commands 14 15 #ifndef __D_NETCMD__ 16 #define __D_NETCMD__ 17 18 #include "command.h" 19 20 // console vars 21 extern consvar_t cv_playername; 22 extern consvar_t cv_playercolor; 23 extern consvar_t cv_skin; 24 // secondary splitscreen player 25 extern consvar_t cv_playername2; 26 extern consvar_t cv_playercolor2; 27 extern consvar_t cv_skin2; 28 // saved versions of the above six 29 extern consvar_t cv_defaultplayercolor; 30 extern consvar_t cv_defaultskin; 31 extern consvar_t cv_defaultplayercolor2; 32 extern consvar_t cv_defaultskin2; 33 34 extern consvar_t cv_seenames, cv_allowseenames; 35 extern consvar_t cv_usemouse; 36 extern consvar_t cv_usejoystick; 37 extern consvar_t cv_usejoystick2; 38 #ifdef LJOYSTICK 39 extern consvar_t cv_joyport; 40 extern consvar_t cv_joyport2; 41 #endif 42 extern consvar_t cv_joyscale; 43 extern consvar_t cv_joyscale2; 44 45 // splitscreen with second mouse 46 extern consvar_t cv_mouse2port; 47 extern consvar_t cv_usemouse2; 48 #if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) 49 extern consvar_t cv_mouse2opt; 50 #endif 51 52 // normally in p_mobj but the .h is not read 53 extern consvar_t cv_itemrespawntime; 54 extern consvar_t cv_itemrespawn; 55 56 extern consvar_t cv_flagtime; 57 58 extern consvar_t cv_touchtag; 59 extern consvar_t cv_hidetime; 60 61 extern consvar_t cv_friendlyfire; 62 extern consvar_t cv_pointlimit; 63 extern consvar_t cv_timelimit; 64 extern consvar_t cv_numlaps; 65 extern consvar_t cv_basenumlaps; 66 extern UINT32 timelimitintics; 67 extern consvar_t cv_allowexitlevel; 68 69 extern consvar_t cv_hazardlog; 70 71 extern consvar_t cv_autobalance; 72 extern consvar_t cv_teamscramble; 73 extern consvar_t cv_scrambleonchange; 74 75 extern consvar_t cv_netstat; 76 77 extern consvar_t cv_countdowntime; 78 extern consvar_t cv_runscripts; 79 extern consvar_t cv_mute; 80 extern consvar_t cv_killingdead; 81 extern consvar_t cv_pause; 82 83 extern consvar_t cv_restrictskinchange, cv_allowteamchange, cv_respawntime; 84 85 extern consvar_t cv_teleporters, cv_superring, cv_supersneakers, cv_invincibility; 86 extern consvar_t cv_jumpshield, cv_watershield, cv_ringshield, cv_forceshield, cv_bombshield; 87 extern consvar_t cv_1up, cv_eggmanbox; 88 extern consvar_t cv_recycler; 89 90 extern consvar_t cv_itemfinder; 91 92 extern consvar_t cv_inttime, cv_coopstarposts, cv_cooplives, cv_advancemap, cv_playersforexit, cv_exitmove; 93 extern consvar_t cv_overtime; 94 extern consvar_t cv_startinglives; 95 96 // for F_finale.c 97 extern consvar_t cv_rollingdemos; 98 99 extern consvar_t cv_ringslinger, cv_soundtest; 100 101 extern consvar_t cv_specialrings, cv_powerstones, cv_matchboxes, cv_competitionboxes; 102 103 extern consvar_t cv_maxping; 104 extern consvar_t cv_pingtimeout; 105 extern consvar_t cv_showping; 106 107 108 extern consvar_t cv_skipmapcheck; 109 110 extern consvar_t cv_sleep; 111 112 extern consvar_t cv_perfstats; 113 114 extern char timedemo_name[256]; 115 extern boolean timedemo_csv; 116 extern char timedemo_csv_id[256]; 117 extern boolean timedemo_quit; 118 119 extern consvar_t cv_freedemocamera; 120 121 typedef enum 122 { 123 XD_NAMEANDCOLOR = 1, 124 XD_WEAPONPREF, // 2 125 XD_KICK, // 3 126 XD_NETVAR, // 4 127 XD_SAY, // 5 128 XD_MAP, // 6 129 XD_EXITLEVEL, // 7 130 XD_ADDFILE, // 8 131 XD_PAUSE, // 9 132 XD_ADDPLAYER, // 10 133 XD_TEAMCHANGE, // 11 134 XD_CLEARSCORES, // 12 135 // UNUSED 13 (Because I don't want to change these comments) 136 XD_VERIFIED = 14,//14 137 XD_RANDOMSEED, // 15 138 XD_RUNSOC, // 16 139 XD_REQADDFILE, // 17 140 XD_DELFILE, // 18 - replace next time we add an XD 141 XD_SETMOTD, // 19 142 XD_SUICIDE, // 20 143 XD_DEMOTED, // 21 144 XD_LUACMD, // 22 145 XD_LUAVAR, // 23 146 XD_LUAFILE, // 24 147 MAXNETXCMD 148 } netxcmd_t; 149 150 extern const char *netxcmdnames[MAXNETXCMD - 1]; 151 152 #if defined(_MSC_VER) 153 #pragma pack(1) 154 #endif 155 156 #ifdef _MSC_VER 157 #pragma warning(disable : 4214) 158 #endif 159 160 //Packet composition for Command_TeamChange_f() ServerTeamChange, etc. 161 //bitwise structs make packing bits a little easier, but byte alignment harder? 162 //todo: decide whether to make the other netcommands conform, or just get rid of this experiment. 163 typedef struct { 164 UINT32 playernum : 5; // value 0 to 31 165 UINT32 newteam : 5; // value 0 to 31 166 UINT32 verification : 1; // value 0 to 1 167 UINT32 autobalance : 1; // value 0 to 1 168 UINT32 scrambled : 1; // value 0 to 1 169 } ATTRPACK changeteam_packet_t; 170 171 #ifdef _MSC_VER 172 #pragma warning(default : 4214) 173 #endif 174 175 typedef struct { 176 UINT16 l; // liitle endian 177 UINT16 b; // big enian 178 } ATTRPACK changeteam_value_t; 179 180 //Since we do not want other files/modules to know about this data buffer we union it here with a Short Int. 181 //Other files/modules will hand the INT16 back to us and we will decode it here. 182 //We don't have to use a union, but we would then send four bytes instead of two. 183 typedef union { 184 changeteam_packet_t packet; 185 changeteam_value_t value; 186 } ATTRPACK changeteam_union; 187 188 #if defined(_MSC_VER) 189 #pragma pack() 190 #endif 191 192 // add game commands, needs cleanup 193 void D_RegisterServerCommands(void); 194 void D_RegisterClientCommands(void); 195 void CleanupPlayerName(INT32 playernum, const char *newname); 196 boolean EnsurePlayerNameIsGood(char *name, INT32 playernum); 197 void D_SendPlayerConfig(void); 198 void Command_ExitGame_f(void); 199 void Command_Retry_f(void); 200 void D_GameTypeChanged(INT32 lastgametype); // not a real _OnChange function anymore 201 void D_MapChange(INT32 pmapnum, INT32 pgametype, boolean pultmode, boolean presetplayers, INT32 pdelay, boolean pskipprecutscene, boolean pfromlevelselect); 202 boolean IsPlayerAdmin(INT32 playernum); 203 void SetAdminPlayer(INT32 playernum); 204 void ClearAdminPlayers(void); 205 void RemoveAdminPlayer(INT32 playernum); 206 void ItemFinder_OnChange(void); 207 void D_SetPassword(const char *pw); 208 209 // used for the player setup menu 210 UINT8 CanChangeSkin(INT32 playernum); 211 212 #endif 213