d_net.h (4027B)
1 /* 2 =========================================================================== 3 4 Doom 3 BFG Edition GPL Source Code 5 Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. 6 7 This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). 8 9 Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation, either version 3 of the License, or 12 (at your option) any later version. 13 14 Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>. 21 22 In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below. 23 24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 26 =========================================================================== 27 */ 28 29 #ifndef __D_NET__ 30 #define __D_NET__ 31 32 #include "d_player.h" 33 34 35 #ifdef __GNUG__ 36 #pragma interface 37 #endif 38 39 40 // 41 // Network play related stuff. 42 // There is a data struct that stores network 43 // communication related stuff, and another 44 // one that defines the actual packets to 45 // be transmitted. 46 // 47 48 #define DOOMCOM_ID 0x12345678l 49 50 // Max computers/players in a game. 51 #define MAXNETNODES 8 52 53 54 // Networking and tick handling related. 55 #define BACKUPTICS 64 56 57 typedef enum 58 { 59 CMD_SEND = 1, 60 CMD_GET = 2 61 62 } command_t; 63 64 65 // 66 // Network packet data. 67 // 68 typedef struct 69 { 70 // High bit is retransmit request. 71 unsigned checksum; 72 // Only valid if NCMD_RETRANSMIT. 73 byte retransmitfrom; 74 75 byte sourceDest; 76 77 byte starttic; 78 byte player; 79 byte numtics; 80 ticcmd_t cmds[BACKUPTICS]; 81 82 } doomdata_t; 83 84 85 86 87 struct doomcom_t 88 { 89 // Supposed to be DOOMCOM_ID? 90 long id; 91 92 // DOOM executes an int to execute commands. 93 short intnum; 94 // Communication between DOOM and the driver. 95 // Is CMD_SEND or CMD_GET. 96 short command; 97 // Is dest for send, set by get (-1 = no packet). 98 short remotenode; 99 100 // Number of bytes in doomdata to be sent 101 short datalength; 102 103 // Info common to all nodes. 104 // Console is allways node 0. 105 short numnodes; 106 // Flag: 1 = no duplication, 2-5 = dup for slow nets. 107 short ticdup; 108 // Flag: 1 = send a backup tic in every packet. 109 short extratics; 110 // Flag: 1 = deathmatch. 111 short deathmatch; 112 // Flag: -1 = new game, 0-5 = load savegame 113 short savegame; 114 short episode; // 1-3 115 short map; // 1-9 116 short skill; // 1-5 117 118 // Info specific to this node. 119 short consoleplayer; 120 short numplayers; 121 122 // These are related to the 3-display mode, 123 // in which two drones looking left and right 124 // were used to render two additional views 125 // on two additional computers. 126 // Probably not operational anymore. 127 // 1 = left, 0 = center, -1 = right 128 short angleoffset; 129 // 1 = drone 130 short drone; 131 132 // The packet data to be sent. 133 doomdata_t data; 134 135 } ; 136 137 138 class idUserCmdMgr; 139 140 // Create any new ticcmds and broadcast to other players. 141 void NetUpdate ( idUserCmdMgr * userCmdMgr ); 142 143 // Broadcasts special packets to other players 144 // to notify of game exit 145 void D_QuitNetGame (void); 146 147 //? how many ticks to run? 148 bool TryRunTics (void); 149 150 151 #endif 152 153 154