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
48 char modelname[64]; // maps/<name>.bsp, for model_precache[0]
49 struct model_s *worldmodel;
50 char *model_precache[MAX_MODELS]; // NULL terminated
51 struct model_s *models[MAX_MODELS];
52 char *sound_precache[MAX_SOUNDS]; // NULL terminated
53 char *lightstyles[MAX_LIGHTSTYLES];
56 edict_t *edicts; // can NOT be array indexed, because
57 // edict_t is variable sized, but can
58 // be used to reference the world ent
59 server_state_t state; // some actions are only valid during load
62 byte datagram_buf[MAX_DATAGRAM];
64 sizebuf_t reliable_datagram; // copied to all clients at end of frame
65 byte reliable_datagram_buf[MAX_DATAGRAM];
68 byte signon_buf[32768]; // LordHavoc: increased signon message buffer from 8192 to 32768
72 #define NUM_PING_TIMES 16
73 #define NUM_SPAWN_PARMS 16
75 typedef struct client_s
77 qboolean active; // false = client is free
78 qboolean spawned; // false = don't send datagrams
79 qboolean dropasap; // has been told to go to another level
80 qboolean privileged; // can execute any host command
81 qboolean sendsignon; // only valid before spawned
83 double last_message; // reliable messages must be sent
86 struct qsocket_s *netconnection; // communications handle
88 usercmd_t cmd; // movement
89 vec3_t wishdir; // intended motion calced from cmd
91 sizebuf_t message; // can be added to at any time,
92 // copied and clear once per frame
93 byte msgbuf[MAX_MSGLEN];
94 edict_t *edict; // EDICT_NUM(clientnum+1)
95 char name[32]; // for printing to other people
98 float ping_times[NUM_PING_TIMES];
99 int num_pings; // ping_times[num_pings%NUM_PING_TIMES]
101 // spawn parms are carried from level to level
102 float spawn_parms[NUM_SPAWN_PARMS];
104 // client known data for deltas
110 //=============================================================================
112 // edict->movetype values
113 #define MOVETYPE_NONE 0 // never moves
114 #define MOVETYPE_ANGLENOCLIP 1
115 #define MOVETYPE_ANGLECLIP 2
116 #define MOVETYPE_WALK 3 // gravity
117 #define MOVETYPE_STEP 4 // gravity, special edge handling
118 #define MOVETYPE_FLY 5
119 #define MOVETYPE_TOSS 6 // gravity
120 #define MOVETYPE_PUSH 7 // no clip to world, push and crush
121 #define MOVETYPE_NOCLIP 8
122 #define MOVETYPE_FLYMISSILE 9 // extra size to monsters
123 #define MOVETYPE_BOUNCE 10
124 #define MOVETYPE_BOUNCEMISSILE 11 // bounce w/o gravity
125 #define MOVETYPE_FOLLOW 12 // track movement of aiment
127 // edict->solid values
128 #define SOLID_NOT 0 // no interaction with other objects
129 #define SOLID_TRIGGER 1 // touch on edge, but not blocking
130 #define SOLID_BBOX 2 // touch on edge, block
131 #define SOLID_SLIDEBOX 3 // touch on edge, but not an onground
132 #define SOLID_BSP 4 // bsp clip, touch on edge, block
133 // LordHavoc: corpse code
134 #define SOLID_CORPSE 5 // same as SOLID_BBOX, except it behaves as SOLID_NOT against SOLID_SLIDEBOX objects (players/monsters)
136 // edict->deadflag values
148 //#define FL_GLIMPSE 4
149 #define FL_CONVEYOR 4
151 #define FL_INWATER 16
152 #define FL_MONSTER 32
153 #define FL_GODMODE 64
154 #define FL_NOTARGET 128
156 #define FL_ONGROUND 512
157 #define FL_PARTIALGROUND 1024 // not all corners are valid
158 #define FL_WATERJUMP 2048 // player jumping out of water
159 #define FL_JUMPRELEASED 4096 // for jump debouncing
163 #define EF_BRIGHTFIELD 1
164 #define EF_MUZZLEFLASH 2
165 #define EF_BRIGHTLIGHT 4
166 #define EF_DIMLIGHT 8
167 // added EF_ effects:
169 #define EF_ADDITIVE 32 // LordHavoc: Additive Rendering
173 #define SPAWNFLAG_NOT_EASY 256
174 #define SPAWNFLAG_NOT_MEDIUM 512
175 #define SPAWNFLAG_NOT_HARD 1024
176 #define SPAWNFLAG_NOT_DEATHMATCH 2048
178 //============================================================================
180 extern cvar_t teamplay;
182 extern cvar_t deathmatch;
184 extern cvar_t fraglimit;
185 extern cvar_t timelimit;
187 extern server_static_t svs; // persistant server info
188 extern server_t sv; // local server
190 extern client_t *host_client;
192 extern jmp_buf host_abortserver;
194 extern double host_time;
196 extern edict_t *sv_player;
198 //===========================================================
202 void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count);
203 void SV_StartSound (edict_t *entity, int channel, char *sample, int volume,
206 void SV_DropClient (qboolean crash);
208 void SV_SendClientMessages (void);
209 void SV_ClearDatagram (void);
211 int SV_ModelIndex (char *name);
213 void SV_SetIdealPitch (void);
215 void SV_AddUpdates (void);
217 void SV_ClientThink (void);
218 void SV_AddClientToServer (struct qsocket_s *ret);
220 void SV_ClientPrintf (char *fmt, ...);
221 void SV_BroadcastPrintf (char *fmt, ...);
223 void SV_Physics (void);
225 qboolean SV_CheckBottom (edict_t *ent);
226 qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink);
228 void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg);
230 void SV_MoveToGoal (void);
232 void SV_CheckForNewClients (void);
233 void SV_RunClients (void);
234 void SV_SaveSpawnparms ();
235 void SV_SpawnServer (char *server);