1 /* Emacs style mode select -*- C++ -*-
2 *-----------------------------------------------------------------------------
5 * PrBoom a Doom port merged with LxDoom and LSDLDoom
6 * based on BOOM, a modified and improved DOOM engine
7 * Copyright (C) 1999 by
8 * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
9 * Copyright (C) 1999-2000 by
10 * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
30 *-----------------------------------------------------------------------------*/
45 // Network play related stuff.
46 // There is a data struct that stores network
47 // communication related stuff, and another
48 // one that defines the actual packets to
52 #define DOOMCOM_ID 0x12345678l
54 // Max computers/players in a game.
58 // Networking and tick handling related.
70 // Network packet data.
74 // High bit is retransmit request.
76 // Only valid if NCMD_RETRANSMIT.
82 ticcmd_t cmds
[BACKUPTICS
];
87 // Startup packet difference
89 // Added so we can send more startup data to synch things like
90 // bobbing, recoil, etc.
91 // this is just mapped over the ticcmd_t array when setup packet is sent
93 // Note: the original code takes care of startskill, deathmatch, nomonsters
94 // respawn, startepisode, startmap
95 // Note: for phase 1 we need to add monsters_remember, variable_friction,
96 // weapon_recoil, allow_pushers, over_under, player_bobbing,
97 // fastparm, demo_insurance, and the rngseed
98 //Stick all options into bytes so we don't need to mess with bitfields
99 //WARNING: make sure this doesn't exceed the size of the ticcmds area!
100 //sizeof(ticcmd_t)*BACKUPTICS
101 //This is the current length of our extra stuff
103 //killough 5/2/98: this should all be replaced by calls to G_WriteOptions()
104 //and G_ReadOptions(), which were specifically designed to set up packets.
105 //By creating a separate struct and functions to read/write the options,
106 //you now have two functions and data to maintain instead of just one.
107 //If the array in g_game.c which G_WriteOptions()/G_ReadOptions() operates
108 //on, is too large (more than sizeof(ticcmd_t)*BACKUPTICS), it can
109 //either be shortened, or the net code needs to divide it up
110 //automatically into packets. The STARTUPLEN below is non-portable.
111 //There's a portable way to do it without having to know the sizes.
113 #define STARTUPLEN 12
116 byte monsters_remember
;
117 byte variable_friction
;
124 unsigned long rngseed
;
125 char filler
[sizeof(ticcmd_t
)*BACKUPTICS
-STARTUPLEN
];
129 // Leave space, so low values corresponding to normal netgame setup packets can be ignored
138 byte value
[sizeof(ticcmd_t
)*BACKUPTICS
- sizeof(netmisctype_t
) - sizeof(size_t)];
143 // Supposed to be DOOMCOM_ID?
146 // DOOM executes an int to execute commands.
148 // Communication between DOOM and the driver.
149 // Is CMD_SEND or CMD_GET.
151 // Is dest for send, set by get (-1 = no packet).
154 // Number of bytes in doomdata to be sent
157 // Info common to all nodes.
158 // Console is allways node 0.
160 // Flag: 1 = no duplication, 2-5 = dup for slow nets.
162 // Flag: 1 = send a backup tic in every packet.
164 // Flag: 1 = deathmatch.
166 // Flag: -1 = new game, 0-5 = load savegame
168 short episode
; // 1-3
172 // Info specific to this node.
176 // These are related to the 3-display mode,
177 // in which two drones looking left and right
178 // were used to render two additional views
179 // on two additional computers.
180 // Probably not operational anymore.
181 // 1 = left, 0 = center, -1 = right
186 // The packet data to be sent.
191 // Create any new ticcmds and broadcast to other players.
192 void NetUpdate (void);
193 // Create any new ticcmds
194 void D_BuildNewTiccmds (void);
196 // Broadcasts special packets to other players
197 // to notify of game exit
198 void D_QuitNetGame (void);
200 //? how many ticks to run?
201 void TryRunTics (void);
203 // CPhipps - move to header file
204 void D_InitNetGame (void); // This does the setup
205 void D_CheckNetGame(void); // This waits for game start
207 // CPhipps - misc info broadcast
208 void D_NetSendMisc(netmisctype_t type
, size_t len
, void* data
);
210 // CPhipps - ask server for a wad file we need
211 boolean
D_NetGetWad(const char* name
);