mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-26 14:30:48 +00:00
server.h aufräumen, Stufe 1
This commit is contained in:
parent
3c7426f836
commit
bc58c04af4
1 changed files with 16 additions and 111 deletions
|
@ -1,34 +1,21 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 Id Software, Inc.
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
// server.h
|
||||
|
||||
|
||||
//define PARANOID // speed sapping error checking
|
||||
|
||||
#include "../../common/header/common.h"
|
||||
#include "../../game/baseq2/game.h"
|
||||
|
||||
//=============================================================================
|
||||
|
||||
#define MAX_MASTERS 8 // max recipients for heartbeat packets
|
||||
#define MAX_MASTERS 8 /* max recipients for heartbeat packets */
|
||||
#define LATENCY_COUNTS 16
|
||||
#define RATE_MESSAGES 10
|
||||
|
||||
// MAX_CHALLENGES is made large to prevent a denial
|
||||
// of service attack that could cycle all of them
|
||||
// out before legitimate users connected
|
||||
#define MAX_CHALLENGES 1024
|
||||
|
||||
#define SV_OUTPUTBUF_LENGTH (MAX_MSGLEN - 16)
|
||||
|
||||
#define EDICT_NUM(n) ((edict_t *)((byte *)ge->edicts + ge->edict_size*(n)))
|
||||
#define NUM_FOR_EDICT(e) ( ((byte *)(e)-(byte *)ge->edicts ) / ge->edict_size)
|
||||
|
||||
typedef enum {
|
||||
ss_dead, // no map loaded
|
||||
ss_loading, // spawning level edicts
|
||||
|
@ -37,8 +24,6 @@ typedef enum {
|
|||
ss_demo,
|
||||
ss_pic
|
||||
} server_state_t;
|
||||
// some qc commands are only valid before the server has finished
|
||||
// initializing (precache commands, static sounds / objects, etc)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -66,10 +51,6 @@ typedef struct
|
|||
qboolean timedemo; // don't time sync
|
||||
} server_t;
|
||||
|
||||
#define EDICT_NUM(n) ((edict_t *)((byte *)ge->edicts + ge->edict_size*(n)))
|
||||
#define NUM_FOR_EDICT(e) ( ((byte *)(e)-(byte *)ge->edicts ) / ge->edict_size)
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
cs_free, // can be reused for a new connection
|
||||
|
@ -89,9 +70,6 @@ typedef struct
|
|||
int senttime; // for ping calculations
|
||||
} client_frame_t;
|
||||
|
||||
#define LATENCY_COUNTS 16
|
||||
#define RATE_MESSAGES 10
|
||||
|
||||
typedef struct client_s
|
||||
{
|
||||
client_state_t state;
|
||||
|
@ -134,18 +112,6 @@ typedef struct client_s
|
|||
netchan_t netchan;
|
||||
} client_t;
|
||||
|
||||
// a client can leave the server in one of four ways:
|
||||
// dropping properly by quiting or disconnecting
|
||||
// timing out if no valid messages are received for timeout.value seconds
|
||||
// getting kicked off by the server operator
|
||||
// a program error, like an overflowed reliable buffer
|
||||
|
||||
//=============================================================================
|
||||
|
||||
// MAX_CHALLENGES is made large to prevent a denial
|
||||
// of service attack that could cycle all of them
|
||||
// out before legitimate users connected
|
||||
#define MAX_CHALLENGES 1024
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -180,8 +146,6 @@ typedef struct
|
|||
byte demo_multicast_buf[MAX_MSGLEN];
|
||||
} server_static_t;
|
||||
|
||||
//=============================================================================
|
||||
|
||||
extern netadr_t net_from;
|
||||
extern sizebuf_t net_message;
|
||||
|
||||
|
@ -200,11 +164,6 @@ extern cvar_t *sv_enforcetime;
|
|||
extern client_t *sv_client;
|
||||
extern edict_t *sv_player;
|
||||
|
||||
//===========================================================
|
||||
|
||||
//
|
||||
// sv_main.c
|
||||
//
|
||||
void SV_FinalMessage (char *message, qboolean reconnect);
|
||||
void SV_DropClient (client_t *drop);
|
||||
|
||||
|
@ -224,23 +183,12 @@ void SV_UserinfoChanged (client_t *cl);
|
|||
void Master_Heartbeat (void);
|
||||
void Master_Packet (void);
|
||||
|
||||
//
|
||||
// sv_init.c
|
||||
//
|
||||
void SV_InitGame (void);
|
||||
void SV_Map (qboolean attractloop, char *levelstring, qboolean loadgame);
|
||||
|
||||
|
||||
//
|
||||
// sv_phys.c
|
||||
//
|
||||
void SV_PrepWorldFrame (void);
|
||||
|
||||
//
|
||||
// sv_send.c
|
||||
//
|
||||
typedef enum {RD_NONE, RD_CLIENT, RD_PACKET} redirect_t;
|
||||
#define SV_OUTPUTBUF_LENGTH (MAX_MSGLEN - 16)
|
||||
|
||||
extern char sv_outputbuf[SV_OUTPUTBUF_LENGTH];
|
||||
|
||||
|
@ -257,85 +205,42 @@ void SV_ClientPrintf (client_t *cl, int level, char *fmt, ...);
|
|||
void SV_BroadcastPrintf (int level, char *fmt, ...);
|
||||
void SV_BroadcastCommand (char *fmt, ...);
|
||||
|
||||
//
|
||||
// sv_user.c
|
||||
//
|
||||
void SV_Nextserver (void);
|
||||
void SV_ExecuteClientMessage (client_t *cl);
|
||||
|
||||
//
|
||||
// sv_ccmds.c
|
||||
//
|
||||
void SV_ReadLevelFile (void);
|
||||
void SV_Status_f (void);
|
||||
|
||||
//
|
||||
// sv_ents.c
|
||||
//
|
||||
void SV_WriteFrameToClient (client_t *client, sizebuf_t *msg);
|
||||
void SV_RecordDemoMessage (void);
|
||||
void SV_BuildClientFrame (client_t *client);
|
||||
|
||||
|
||||
void SV_Error (char *error, ...);
|
||||
|
||||
//
|
||||
// sv_game.c
|
||||
//
|
||||
extern game_export_t *ge;
|
||||
|
||||
void SV_InitGameProgs (void);
|
||||
void SV_ShutdownGameProgs (void);
|
||||
void SV_InitEdict (edict_t *e);
|
||||
|
||||
|
||||
|
||||
//============================================================
|
||||
|
||||
//
|
||||
// high level object sorting to reduce interaction tests
|
||||
//
|
||||
|
||||
void SV_ClearWorld (void);
|
||||
// called after the world model has been loaded, before linking any entities
|
||||
|
||||
// called after the world model has been loaded, before linking any entities
|
||||
void SV_UnlinkEdict (edict_t *ent);
|
||||
|
||||
// call before removing an entity, and before trying to move one,
|
||||
// so it doesn't clip against itself
|
||||
|
||||
void SV_LinkEdict (edict_t *ent);
|
||||
|
||||
// Needs to be called any time an entity changes origin, mins, maxs,
|
||||
// or solid. Automatically unlinks if needed.
|
||||
// sets ent->v.absmin and ent->v.absmax
|
||||
// sets ent->leafnums[] for pvs determination even if the entity
|
||||
// is not solid
|
||||
|
||||
int SV_AreaEdicts (vec3_t mins, vec3_t maxs, edict_t **list, int maxcount, int areatype);
|
||||
// fills in a table of edict pointers with edicts that have bounding boxes
|
||||
// that intersect the given area. It is possible for a non-axial bmodel
|
||||
// to be returned that doesn't actually intersect the area on an exact
|
||||
// test.
|
||||
// returns the number of pointers filled in
|
||||
// ??? does this always return the world?
|
||||
|
||||
//===================================================================
|
||||
|
||||
//
|
||||
// functions that interact with everything apropriate
|
||||
//
|
||||
int SV_PointContents (vec3_t p);
|
||||
// returns the CONTENTS_* value from the world at the given point.
|
||||
// Quake 2 extends this to also check entities, to allow moving liquids
|
||||
|
||||
|
||||
trace_t SV_Trace (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, edict_t *passedict, int contentmask);
|
||||
// mins and maxs are relative
|
||||
|
||||
// if the entire move stays in a solid volume, trace.allsolid will be set,
|
||||
// trace.startsolid will be set, and trace.fraction will be 0
|
||||
|
||||
// if the starting point is in a solid, it will be allowed to move out
|
||||
// to an open area
|
||||
|
||||
// passedict is explicitly excluded from clipping checks (normally NULL)
|
||||
|
||||
|
|
Loading…
Reference in a new issue