aboutsummaryrefslogtreecommitdiff
path: root/src/parsec/net_glob.cpp
blob: 6e04ec4b7fc7e950cba266fc6fb4ba8259da4770 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/*
 * PARSEC - Global Variables
 *
 * $Author: uberlinuxguy $ - $Date: 2004/09/15 12:25:30 $
 *
 * Orginally written by:
 *   Copyright (c) Clemens Beer        <cbx@parsec.org>   2002
 *   Copyright (c) Markus Hadwiger     <msh@parsec.org>   1996-2000
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */ 

// C library
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>

// compilation flags/debug support
#include "config.h"
#include "debug.h"

// general definitions
#include "general.h"
#include "objstruc.h"

// local module header
#include "net_glob.h"

// subsystem headers
#include "net_defs.h"

// engine globals
#include "e_global.h"

//NOTE:
// the inclusion order of NET_GLOB.H and NET_DEFS.H
// has to be this way, because one inline function
// in NET_DEFS.H references PlayerId and NET_GLOB.C
// won't compile if the prototype in NET_GLOB.H is
// not included beforehand.

// proprietary module headers
#include "net_udpdf.h"


// net id of local player -----------------------------------------------------
//
int 			LocalPlayerId		= PLAYERID_ANONYMOUS;


// name of local player -------------------------------------------------------
//
char			LocalPlayerName[ MAX_PLAYER_NAME + 1 ];


// miscellaneous network game globals -----------------------------------------
//
int 			NetAvailable			= FALSE;
int 			NetworkGameMask			= NETWORK_GAME_OFF;
int				NetConnected			= NETWORK_GAME_OFF;		// connect status
int				NetJoined				= FALSE;				// join status
int 			EntryMode				= FALSE;
int 			ShipDowned				= FALSE;
int				Packet_Send_Frequency	= DEFAULT_CLIENT_SEND_FREQUENCY; /* 20Hz */
int 			Packet_Send_Frametime	= FRAME_MEASURE_TIMEBASE / Packet_Send_Frequency;
int				Packet_Recv_Rate		= DEFAULT_CLIENT_RECV_RATE;

// indicates whether we have received a full playerstate from the server ------
//
int				HaveFullPlayerState     = FALSE;

// # of refframes the server times out ----------------------------------------
//
refframe_t		ServerTimeoutFrames		= DEFAULT_TIMEOUT_SERVER_CONNECTION;


// allows to select a specific interface on a multi-homed host ----------------
//
int				NetInterfaceSelect	= 0;

// name of server to resolve ( used by NET_ServerConnect() implementation) ----
//
char*			CurServerToResolve  = NULL;

// node of server to jump to (used by NET_ServerJump() implementation) --------
//
node_t*			CurJumpServerNode	= NULL;


// current maximum number of players (in peer-to-peer or on server) -----------
//
int 			CurMaxPlayers		= MAX_NET_ALLOC_SLOTS;


// server ID of current server ------------------------------------------------
//
int				CurServerID         = -1;


// current maximum size of the packet payload ---------------------------------
//
int				CurMaxDataLength	= NET_UDP_DATA_LENGTH;


// id of player whose killstat will be sent next ------------------------------
//
int 			CurKillUpdate		= 0;


// id of last player who killed us --------------------------------------------
//
int 			CurKiller			= KILLERID_UNKNOWN;


// current universe (game area on same server/connection) ---------------------
//
int 			MyUniverse			= 0;


// number of active remote players (including local player!) ------------------
//
int				NumRemPlayers		= 0;


// id that will be appended to next message for sequencing purposes -----------
//
int				CurSendMessageId_PEER	= 1;


// current game time ----------------------------------------------------------
//
int 			CurGameTime			= GAME_PEERTOPEER;


// fictitious name of current server (not related to the actual host name) ----
//
char*			CurServerName		= NULL;


// current ping to current server (for display purposes) ----------------------
//
int 			CurServerPing		= -1;


// ping time to server (gets set on ping reply processing) --------------------
//
int				ServerPingTime		= -1;


// global remote event list administration ------------------------------------
//
int 			RE_List_Avail;
char*			RE_List_CurPos;


// info needed about each remote player ---------------------------------------
//
int 			Player_Status[ MAX_NET_ALLOC_SLOTS ];
GenObject *		Player_Ship[ MAX_NET_ALLOC_SLOTS ];
int 			Player_ShipId[ MAX_NET_ALLOC_SLOTS ];
int 			Player_AliveCounter[ MAX_NET_ALLOC_SLOTS ];
int 			Player_UpToDate[ MAX_NET_ALLOC_SLOTS ];
int 			Player_KillStat[ MAX_NET_ALLOC_SLOTS ];
int 			Player_LastMsgId[ MAX_NET_ALLOC_SLOTS ];
int				Player_LastUpdateGameStateMsgId[ MAX_NET_ALLOC_SLOTS ];
char	  		Player_Name[ MAX_NET_ALLOC_SLOTS ][ MAX_PLAYER_NAME + 1 ];


// list of masterservers to query ---------------------------------------------
//
char*			Masters[ MAX_MASTERSERVERS ] = { NULL, NULL, NULL };


// jump table for networking subsystem ----------------------------------------
//
net_subsys_jtab_s	net_subsys_jtab;


// module registration function -----------------------------------------------
//
REGISTER_MODULE( NET_GLOB )
{

}