2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 struct client_s
*clients
; // [maxclients]
27 int serverflags
; // episode completion information
28 qboolean changelevel_issued
; // cleared when at SV_SpawnServer
31 //=============================================================================
33 typedef enum {ss_loading
, ss_active
} server_state_t
;
37 qboolean active
; // false if only a net client
40 qboolean loadgame
; // handle connections specially
44 int lastcheck
; // used by PF_checkclient
47 char name
[64]; // map name
51 char modelname
[64]; // maps/<name>.bsp, for model_precache[0]
52 struct model_s
*worldmodel
;
53 char *model_precache
[MAX_MODELS
]; // NULL terminated
54 struct model_s
*models
[MAX_MODELS
];
55 char *sound_precache
[MAX_SOUNDS
]; // NULL terminated
56 char *lightstyles
[MAX_LIGHTSTYLES
];
59 edict_t
*edicts
; // can NOT be array indexed, because
60 // edict_t is variable sized, but can
61 // be used to reference the world ent
62 server_state_t state
; // some actions are only valid during load
65 byte datagram_buf
[MAX_DATAGRAM
];
67 sizebuf_t reliable_datagram
; // copied to all clients at end of frame
68 byte reliable_datagram_buf
[MAX_DATAGRAM
];
71 byte signon_buf
[8192];
75 #define NUM_PING_TIMES 16
76 #define NUM_SPAWN_PARMS 16
78 typedef struct client_s
80 qboolean active
; // false = client is free
81 qboolean spawned
; // false = don't send datagrams
82 qboolean dropasap
; // has been told to go to another level
83 qboolean privileged
; // can execute any host command
84 qboolean sendsignon
; // only valid before spawned
86 double last_message
; // reliable messages must be sent
89 struct qsocket_s
*netconnection
; // communications handle
91 usercmd_t cmd
; // movement
92 vec3_t wishdir
; // intended motion calced from cmd
94 sizebuf_t message
; // can be added to at any time,
95 // copied and clear once per frame
96 byte msgbuf
[MAX_MSGLEN
];
97 edict_t
*edict
; // EDICT_NUM(clientnum+1)
98 char name
[32]; // for printing to other people
101 float ping_times
[NUM_PING_TIMES
];
102 int num_pings
; // ping_times[num_pings%NUM_PING_TIMES]
104 // spawn parms are carried from level to level
105 float spawn_parms
[NUM_SPAWN_PARMS
];
107 // client known data for deltas
112 //=============================================================================
114 // edict->movetype values
115 #define MOVETYPE_NONE 0 // never moves
116 #define MOVETYPE_ANGLENOCLIP 1
117 #define MOVETYPE_ANGLECLIP 2
118 #define MOVETYPE_WALK 3 // gravity
119 #define MOVETYPE_STEP 4 // gravity, special edge handling
120 #define MOVETYPE_FLY 5
121 #define MOVETYPE_TOSS 6 // gravity
122 #define MOVETYPE_PUSH 7 // no clip to world, push and crush
123 #define MOVETYPE_NOCLIP 8
124 #define MOVETYPE_FLYMISSILE 9 // extra size to monsters
125 #define MOVETYPE_BOUNCE 10
127 #define MOVETYPE_BOUNCEMISSILE 11 // bounce w/o gravity
128 #define MOVETYPE_FOLLOW 12 // track movement of aiment
131 // edict->solid values
132 #define SOLID_NOT 0 // no interaction with other objects
133 #define SOLID_TRIGGER 1 // touch on edge, but not blocking
134 #define SOLID_BBOX 2 // touch on edge, block
135 #define SOLID_SLIDEBOX 3 // touch on edge, but not an onground
136 #define SOLID_BSP 4 // bsp clip, touch on edge, block
138 // edict->deadflag values
150 //#define FL_GLIMPSE 4
151 #define FL_CONVEYOR 4
153 #define FL_INWATER 16
154 #define FL_MONSTER 32
155 #define FL_GODMODE 64
156 #define FL_NOTARGET 128
158 #define FL_ONGROUND 512
159 #define FL_PARTIALGROUND 1024 // not all corners are valid
160 #define FL_WATERJUMP 2048 // player jumping out of water
161 #define FL_JUMPRELEASED 4096 // for jump debouncing
163 #define FL_FLASHLIGHT 8192
164 #define FL_ARCHIVE_OVERRIDE 1048576
169 #define EF_BRIGHTFIELD 1
170 #define EF_MUZZLEFLASH 2
171 #define EF_BRIGHTLIGHT 4
172 #define EF_DIMLIGHT 8
173 #define EF_REDLIGHT 16
174 #define EF_BLUELIGHT 32
176 #define EF_DARKLIGHT 16
177 #define EF_DARKFIELD 32
179 #define EF_NODRAW 128
182 #define SPAWNFLAG_NOT_EASY 256
183 #define SPAWNFLAG_NOT_MEDIUM 512
184 #define SPAWNFLAG_NOT_HARD 1024
185 #define SPAWNFLAG_NOT_DEATHMATCH 2048
189 #define SFL_EPISODE_1 1
190 #define SFL_EPISODE_2 2
191 #define SFL_EPISODE_3 4
192 #define SFL_EPISODE_4 8
193 #define SFL_NEW_UNIT 16
194 #define SFL_NEW_EPISODE 32
195 #define SFL_CROSS_TRIGGERS 65280
198 //============================================================================
200 extern cvar_t teamplay
;
202 extern cvar_t deathmatch
;
204 extern cvar_t fraglimit
;
205 extern cvar_t timelimit
;
207 extern server_static_t svs
; // persistant server info
208 extern server_t sv
; // local server
210 extern client_t
*host_client
;
212 extern jmp_buf host_abortserver
;
214 extern double host_time
;
216 extern edict_t
*sv_player
;
218 //===========================================================
222 void SV_StartParticle (vec3_t org
, vec3_t dir
, int color
, int count
);
223 void SV_StartSound (edict_t
*entity
, int channel
, char *sample
, int volume
,
226 void SV_DropClient (qboolean crash
);
228 void SV_SendClientMessages (void);
229 void SV_ClearDatagram (void);
231 int SV_ModelIndex (char *name
);
233 void SV_SetIdealPitch (void);
235 void SV_AddUpdates (void);
237 void SV_ClientThink (void);
238 void SV_AddClientToServer (struct qsocket_s
*ret
);
240 void SV_ClientPrintf (char *fmt
, ...);
241 void SV_BroadcastPrintf (char *fmt
, ...);
243 void SV_Physics (void);
245 qboolean
SV_CheckBottom (edict_t
*ent
);
246 qboolean
SV_movestep (edict_t
*ent
, vec3_t move
, qboolean relink
);
248 void SV_WriteClientdataToMessage (edict_t
*ent
, sizebuf_t
*msg
);
250 void SV_MoveToGoal (void);
252 void SV_CheckForNewClients (void);
253 void SV_RunClients (void);
254 void SV_SaveSpawnparms ();
256 void SV_SpawnServer (char *server
, char *startspot
);
258 void SV_SpawnServer (char *server
);