mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2024-11-22 11:51:17 +00:00
Header file cleanup, so we can build more stuff which is completely common!
*.pak support!
This commit is contained in:
parent
ddfbc49092
commit
8ce43b2ec1
9 changed files with 267 additions and 226 deletions
|
@ -34,7 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <qtypes.h>
|
#include <qtypes.h>
|
||||||
#include <zone.h>
|
#include <zone.h>
|
||||||
#include <protocol.h>
|
#include <common_protocol.h>
|
||||||
#include <vid.h>
|
#include <vid.h>
|
||||||
#include <render.h>
|
#include <render.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
@ -104,7 +104,6 @@ typedef struct player_info_s
|
||||||
} player_info_t;
|
} player_info_t;
|
||||||
|
|
||||||
|
|
||||||
//#ifdef QUAKEWORLD
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
// generated on client side
|
// generated on client side
|
||||||
|
@ -145,9 +144,7 @@ typedef struct
|
||||||
float die; // stop lighting after this time
|
float die; // stop lighting after this time
|
||||||
float decay; // drop this each second
|
float decay; // drop this each second
|
||||||
float minlight; // don't add when contributing less
|
float minlight; // don't add when contributing less
|
||||||
#ifdef QUAKE2
|
|
||||||
qboolean dark;
|
qboolean dark;
|
||||||
#endif // QUAKE2
|
|
||||||
float color[4];
|
float color[4];
|
||||||
} dlight_t;
|
} dlight_t;
|
||||||
|
|
||||||
|
@ -198,7 +195,6 @@ typedef struct
|
||||||
cactive_t state; // connection info
|
cactive_t state; // connection info
|
||||||
netchan_t netchan; // network stuff
|
netchan_t netchan; // network stuff
|
||||||
|
|
||||||
//#ifdef QUAKEWORLD
|
|
||||||
char userinfo[MAX_INFO_STRING];
|
char userinfo[MAX_INFO_STRING];
|
||||||
char servername[MAX_OSPATH];
|
char servername[MAX_OSPATH];
|
||||||
int qport;
|
int qport;
|
||||||
|
@ -213,13 +209,11 @@ typedef struct
|
||||||
|
|
||||||
int challenge;
|
int challenge;
|
||||||
float latency; // rolling average
|
float latency; // rolling average
|
||||||
//#elif UQUAKE
|
|
||||||
char mapstring[MAX_QPATH];
|
char mapstring[MAX_QPATH];
|
||||||
char spawnparms[MAX_MAPSTRING]; // to restart level
|
char spawnparms[MAX_MAPSTRING]; // to restart level
|
||||||
|
|
||||||
int signon;
|
int signon;
|
||||||
struct qsocket_s *netcon;
|
struct qsocket_s *netcon;
|
||||||
//#endif // QUAKEWORLD else UQUAKE
|
|
||||||
|
|
||||||
// demos - this stuff can't go into client_state_t
|
// demos - this stuff can't go into client_state_t
|
||||||
int demonum;
|
int demonum;
|
||||||
|
@ -297,7 +291,6 @@ typedef struct
|
||||||
int gametype;
|
int gametype;
|
||||||
int maxclients;
|
int maxclients;
|
||||||
|
|
||||||
//#ifdef QUAKEWORLD
|
|
||||||
// QW specific!
|
// QW specific!
|
||||||
// all player information
|
// all player information
|
||||||
player_info_t players[MAX_CLIENTS];
|
player_info_t players[MAX_CLIENTS];
|
||||||
|
@ -324,7 +317,6 @@ typedef struct
|
||||||
//
|
//
|
||||||
char model_name[MAX_MODELS][MAX_QPATH];
|
char model_name[MAX_MODELS][MAX_QPATH];
|
||||||
char sound_name[MAX_SOUNDS][MAX_QPATH];
|
char sound_name[MAX_SOUNDS][MAX_QPATH];
|
||||||
//#elif defined(UQUAKE)
|
|
||||||
// UQ specific.
|
// UQ specific.
|
||||||
int num_entities; // held in cl_entities array
|
int num_entities; // held in cl_entities array
|
||||||
float last_received_message; // (time) for net trouble icon
|
float last_received_message; // (time) for net trouble icon
|
||||||
|
@ -346,7 +338,6 @@ typedef struct
|
||||||
vec3_t mvelocity[2]; // update by server, used for lean+bob
|
vec3_t mvelocity[2]; // update by server, used for lean+bob
|
||||||
// (0 is newest)
|
// (0 is newest)
|
||||||
vec3_t velocity; // lerped between mvelocity[0] and [1]
|
vec3_t velocity; // lerped between mvelocity[0] and [1]
|
||||||
//#endif // QUAKEWORLD else UQUAKE
|
|
||||||
} client_state_t;
|
} client_state_t;
|
||||||
|
|
||||||
extern client_state_t cl;
|
extern client_state_t cl;
|
||||||
|
@ -354,18 +345,18 @@ extern client_state_t cl;
|
||||||
//
|
//
|
||||||
// cvars
|
// cvars
|
||||||
//
|
//
|
||||||
#ifdef UQUAKE
|
//#ifdef UQUAKE
|
||||||
extern cvar_t *cl_name;
|
extern cvar_t *cl_name;
|
||||||
extern cvar_t *cl_color;
|
extern cvar_t *cl_color;
|
||||||
extern cvar_t *cl_autofire;
|
extern cvar_t *cl_autofire;
|
||||||
extern cvar_t *cl_nolerp;
|
extern cvar_t *cl_nolerp;
|
||||||
#endif // UQUAKE
|
//#endif // UQUAKE
|
||||||
extern cvar_t *cl_warncmd;
|
extern cvar_t *cl_warncmd;
|
||||||
#ifdef QUAKEWORLD
|
//#ifdef QUAKEWORLD
|
||||||
extern cvar_t *name;
|
extern cvar_t *name;
|
||||||
extern cvar_t *topcolor;
|
extern cvar_t *topcolor;
|
||||||
extern cvar_t *bottomcolor;
|
extern cvar_t *bottomcolor;
|
||||||
#endif // QUAKEWORLD
|
//#endif // QUAKEWORLD
|
||||||
extern cvar_t *rate;
|
extern cvar_t *rate;
|
||||||
extern cvar_t *host_speeds;
|
extern cvar_t *host_speeds;
|
||||||
extern cvar_t *cl_maxfps;
|
extern cvar_t *cl_maxfps;
|
||||||
|
@ -403,10 +394,10 @@ extern cvar_t *_windowed_mouse;
|
||||||
|
|
||||||
// FIXME, allocate dynamically
|
// FIXME, allocate dynamically
|
||||||
extern entity_state_t cl_baselines[MAX_EDICTS];
|
extern entity_state_t cl_baselines[MAX_EDICTS];
|
||||||
#ifdef UQUAKE
|
//#ifdef UQUAKE
|
||||||
entity_t cl_entities[MAX_EDICTS];
|
entity_t cl_entities[MAX_EDICTS];
|
||||||
entity_t cl_temp_entities[MAX_TEMP_ENTITIES];
|
entity_t cl_temp_entities[MAX_TEMP_ENTITIES];
|
||||||
#endif // UQUAKE
|
//#endif // UQUAKE
|
||||||
extern efrag_t cl_efrags[MAX_EFRAGS];
|
extern efrag_t cl_efrags[MAX_EFRAGS];
|
||||||
extern entity_t cl_static_entities[MAX_STATIC_ENTITIES];
|
extern entity_t cl_static_entities[MAX_STATIC_ENTITIES];
|
||||||
extern lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
|
extern lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
|
||||||
|
@ -435,20 +426,20 @@ void SetPal (int i);
|
||||||
void CL_RelinkEntities (void);
|
void CL_RelinkEntities (void);
|
||||||
void CL_ReadPackets (void);
|
void CL_ReadPackets (void);
|
||||||
|
|
||||||
#ifdef UQUAKE
|
//#ifdef UQUAKE
|
||||||
void CL_Signon1 (void);
|
void CL_Signon1 (void);
|
||||||
void CL_Signon2 (void);
|
void CL_Signon2 (void);
|
||||||
void CL_Signon3 (void);
|
void CL_Signon3 (void);
|
||||||
void CL_Signon4 (void);
|
void CL_Signon4 (void);
|
||||||
#endif // UQUAKE
|
//#endif // UQUAKE
|
||||||
|
|
||||||
void CL_Disconnect (void);
|
void CL_Disconnect (void);
|
||||||
void CL_Disconnect_f (void);
|
void CL_Disconnect_f (void);
|
||||||
void CL_NextDemo (void);
|
void CL_NextDemo (void);
|
||||||
#ifdef QUAKEWORLD
|
//#ifdef QUAKEWORLD
|
||||||
qboolean CL_DemoBehind(void);
|
qboolean CL_DemoBehind(void);
|
||||||
void CL_BeginServerConnect(void);
|
void CL_BeginServerConnect(void);
|
||||||
#endif // QUAKEWORLD
|
//#endif // QUAKEWORLD
|
||||||
|
|
||||||
|
|
||||||
#define MAX_VISEDICTS 256
|
#define MAX_VISEDICTS 256
|
||||||
|
@ -486,9 +477,9 @@ void CL_UpdateTEnts (void);
|
||||||
|
|
||||||
void CL_ClearState (void);
|
void CL_ClearState (void);
|
||||||
|
|
||||||
#ifdef QUAKEWORLD
|
//#ifdef QUAKEWORLD
|
||||||
void CL_ReadPackets (void);
|
void CL_ReadPackets (void);
|
||||||
#endif // QUAKEWORLD
|
//#endif // QUAKEWORLD
|
||||||
|
|
||||||
int CL_ReadFromServer (void);
|
int CL_ReadFromServer (void);
|
||||||
void CL_WriteToServer (usercmd_t *cmd);
|
void CL_WriteToServer (usercmd_t *cmd);
|
||||||
|
@ -503,17 +494,17 @@ char *Key_KeynumToString (int keynum);
|
||||||
//
|
//
|
||||||
void CL_StopPlayback (void);
|
void CL_StopPlayback (void);
|
||||||
int CL_GetMessage (void);
|
int CL_GetMessage (void);
|
||||||
#ifdef QUAKEWORLD
|
//#ifdef QUAKEWORLD
|
||||||
void CL_WriteDemoCmd (usercmd_t *pcmd);
|
void CL_WriteDemoCmd (usercmd_t *pcmd);
|
||||||
#elif defined(UQUAKE)
|
//#elif defined(UQUAKE)
|
||||||
void CL_SignonReply (void);
|
void CL_SignonReply (void);
|
||||||
#endif // QUAKEWORLD else UQUAKE
|
//#endif // QUAKEWORLD else UQUAKE
|
||||||
|
|
||||||
void CL_Stop_f (void);
|
void CL_Stop_f (void);
|
||||||
void CL_Record_f (void);
|
void CL_Record_f (void);
|
||||||
#ifdef QUAKEWORLD
|
//#ifdef QUAKEWORLD
|
||||||
void CL_ReRecord_f (void);
|
void CL_ReRecord_f (void);
|
||||||
#endif // QUAKEWORLD
|
//#endif // QUAKEWORLD
|
||||||
void CL_PlayDemo_f (void);
|
void CL_PlayDemo_f (void);
|
||||||
void CL_TimeDemo_f (void);
|
void CL_TimeDemo_f (void);
|
||||||
|
|
||||||
|
@ -522,7 +513,7 @@ void CL_TimeDemo_f (void);
|
||||||
//
|
//
|
||||||
void CL_ParseServerMessage (void);
|
void CL_ParseServerMessage (void);
|
||||||
void CL_NewTranslation (int slot);
|
void CL_NewTranslation (int slot);
|
||||||
#ifdef QUAKEWORLD
|
//#ifdef QUAKEWORLD
|
||||||
#define NET_TIMINGS 256
|
#define NET_TIMINGS 256
|
||||||
#define NET_TIMINGSMASK 255
|
#define NET_TIMINGSMASK 255
|
||||||
extern int packet_latency[NET_TIMINGS];
|
extern int packet_latency[NET_TIMINGS];
|
||||||
|
@ -532,7 +523,7 @@ qboolean CL_IsUploading(void);
|
||||||
void CL_NextUpload(void);
|
void CL_NextUpload(void);
|
||||||
void CL_StartUpload (byte *data, int size);
|
void CL_StartUpload (byte *data, int size);
|
||||||
void CL_StopUpload(void);
|
void CL_StopUpload(void);
|
||||||
#endif // QUAKEWORLD
|
//#endif // QUAKEWORLD
|
||||||
|
|
||||||
//
|
//
|
||||||
// view.c
|
// view.c
|
||||||
|
@ -553,9 +544,9 @@ void V_CalcBlend (void);
|
||||||
//
|
//
|
||||||
void CL_InitTEnts (void);
|
void CL_InitTEnts (void);
|
||||||
void CL_ClearTEnts (void);
|
void CL_ClearTEnts (void);
|
||||||
#ifdef UQUAKE
|
//#ifdef UQUAKE
|
||||||
void CL_SignonReply (void);
|
void CL_SignonReply (void);
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
//#ifdef QUAKEWORLD
|
//#ifdef QUAKEWORLD
|
||||||
//
|
//
|
||||||
|
|
|
@ -24,9 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#ifndef _COMMON_H
|
#ifndef _COMMON_H
|
||||||
#define _COMMON_H
|
#define _COMMON_H
|
||||||
|
|
||||||
#ifdef QUAKEWORLD
|
//#ifdef QUAKEWORLD
|
||||||
# include <bothdefs.h>
|
//# include <bothdefs.h>
|
||||||
#endif
|
//#endif
|
||||||
#include <register_check.h>
|
#include <register_check.h>
|
||||||
#include <qtypes.h>
|
#include <qtypes.h>
|
||||||
#include <cvar.h>
|
#include <cvar.h>
|
||||||
|
|
201
common/common_protocol.h
Normal file
201
common/common_protocol.h
Normal file
|
@ -0,0 +1,201 @@
|
||||||
|
/*
|
||||||
|
protocol.h - communications protocol (quake1)
|
||||||
|
Copyright (C) 1996-1997 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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __common_protocol_h
|
||||||
|
#define __common_protocol_h
|
||||||
|
|
||||||
|
/*
|
||||||
|
#if !(defined(QUAKEWORLD) || defined(UQUAKE))
|
||||||
|
#error This is NOT safe to include for common items.
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// game types sent by serverinfo
|
||||||
|
// these determine which intermission screen plays
|
||||||
|
#define GAME_COOP 0
|
||||||
|
#define GAME_DEATHMATCH 1
|
||||||
|
|
||||||
|
|
||||||
|
//==================
|
||||||
|
// note that there are some defs.qc that mirror to these numbers
|
||||||
|
// also related to svc_strings[] in cl_parse
|
||||||
|
//==================
|
||||||
|
|
||||||
|
//
|
||||||
|
// server to client
|
||||||
|
//
|
||||||
|
#define svc_bad 0
|
||||||
|
#define svc_nop 1
|
||||||
|
#define svc_disconnect 2
|
||||||
|
#define svc_updatestat 3 // [byte] [long]
|
||||||
|
#define svc_version 4 // [long] server version
|
||||||
|
#define svc_setview 5 // [short] entity number
|
||||||
|
#define svc_sound 6 // <see code>
|
||||||
|
#define svc_time 7 // [float] server time
|
||||||
|
#define svc_print 8 // [string] null terminated string
|
||||||
|
#define svc_stufftext 9 // [string] stuffed into client's console buffer
|
||||||
|
// the string should be \n terminated
|
||||||
|
#define svc_setangle 10 // [angle3] set the view angle to this absolute value
|
||||||
|
#define svc_lightstyle 12 // [byte] [string]
|
||||||
|
#define svc_updatename 13 // [byte] [string]
|
||||||
|
#define svc_updatefrags 14 // [byte] [short]
|
||||||
|
#define svc_clientdata 15 // <shortbits + data>
|
||||||
|
#define svc_stopsound 16 // <see code>
|
||||||
|
#define svc_updatecolors 17 // [byte] [byte]
|
||||||
|
#define svc_particle 18 // [vec3] <variable>
|
||||||
|
#define svc_damage 19
|
||||||
|
|
||||||
|
#define svc_spawnstatic 20
|
||||||
|
// svc_spawnbinary 21
|
||||||
|
#define svc_spawnbaseline 22
|
||||||
|
|
||||||
|
#define svc_temp_entity 23
|
||||||
|
|
||||||
|
#define svc_setpause 24 // [byte] on / off
|
||||||
|
#define svc_signonnum 25 // [byte] used for the signon sequence
|
||||||
|
|
||||||
|
#define svc_centerprint 26 // [string] to put in center of the screen
|
||||||
|
|
||||||
|
#define svc_killedmonster 27
|
||||||
|
#define svc_foundsecret 28
|
||||||
|
|
||||||
|
#define svc_spawnstaticsound 29 // [coord3] [byte] samp [byte] vol [byte] aten
|
||||||
|
|
||||||
|
#define svc_intermission 30 // [string] music
|
||||||
|
#define svc_finale 31 // [string] music [string] text
|
||||||
|
|
||||||
|
#define svc_cdtrack 32 // [byte] track [byte] looptrack
|
||||||
|
#define svc_sellscreen 33
|
||||||
|
|
||||||
|
|
||||||
|
#define svc_cutscene 34
|
||||||
|
// QUAKEWORLD
|
||||||
|
#define svc_smallkick 34 // set client punchangle to 2
|
||||||
|
#define svc_bigkick 35 // set client punchangle to 4
|
||||||
|
|
||||||
|
#define svc_updateping 36 // [byte] [short]
|
||||||
|
#define svc_updateentertime 37 // [byte] [float]
|
||||||
|
|
||||||
|
#define svc_updatestatlong 38 // [byte] [long]
|
||||||
|
|
||||||
|
#define svc_muzzleflash 39 // [short] entity
|
||||||
|
|
||||||
|
#define svc_updateuserinfo 40 // [byte] slot [long] uid
|
||||||
|
// [string] userinfo
|
||||||
|
|
||||||
|
#define svc_download 41 // [short] size [size bytes]
|
||||||
|
#define svc_playerinfo 42 // variable
|
||||||
|
#define svc_nails 43 // [byte] num [48 bits] xyzpy 12 12 12 4 8
|
||||||
|
#define svc_chokecount 44 // [byte] packets choked
|
||||||
|
#define svc_modellist 45 // [strings]
|
||||||
|
#define svc_soundlist 46 // [strings]
|
||||||
|
#define svc_packetentities 47 // [...]
|
||||||
|
#define svc_deltapacketentities 48 // [...]
|
||||||
|
#define svc_maxspeed 49 // maxspeed change, for prediction
|
||||||
|
#define svc_entgravity 50 // gravity change, for prediction
|
||||||
|
#define svc_setinfo 51 // setinfo on a client
|
||||||
|
#define svc_updatepl 53 // [byte] [byte]
|
||||||
|
|
||||||
|
//
|
||||||
|
// client to server
|
||||||
|
//
|
||||||
|
#define clc_bad 0
|
||||||
|
#define clc_nop 1
|
||||||
|
#define clc_disconnect 2
|
||||||
|
#define clc_move 3 // [usercmd_t]
|
||||||
|
#define clc_stringcmd 4 // [string] message
|
||||||
|
#define clc_delta 5 // [byte] sequence number, requests delta compression of message
|
||||||
|
#define clc_tmove 6 // teleport request, spectator only
|
||||||
|
#define clc_upload 7 // teleport request, spectator only
|
||||||
|
|
||||||
|
//==============================================
|
||||||
|
|
||||||
|
// playerinfo flags from server
|
||||||
|
// playerinfo allways sends: playernum, flags, origin[] and framenumber
|
||||||
|
|
||||||
|
#define PF_MSEC (1<<0)
|
||||||
|
#define PF_COMMAND (1<<1)
|
||||||
|
#define PF_VELOCITY1 (1<<2)
|
||||||
|
#define PF_VELOCITY2 (1<<3)
|
||||||
|
#define PF_VELOCITY3 (1<<4)
|
||||||
|
#define PF_MODEL (1<<5)
|
||||||
|
#define PF_SKINNUM (1<<6)
|
||||||
|
#define PF_EFFECTS (1<<7)
|
||||||
|
#define PF_WEAPONFRAME (1<<8) // only sent for view player
|
||||||
|
#define PF_DEAD (1<<9) // don't block movement any more
|
||||||
|
#define PF_GIB (1<<10) // offset the view height differently
|
||||||
|
#define PF_NOGRAV (1<<11) // don't apply gravity for prediction
|
||||||
|
|
||||||
|
//==============================================
|
||||||
|
|
||||||
|
// if the high bit of the client to server byte is set, the low bits are
|
||||||
|
// client move cmd bits
|
||||||
|
// ms and angle2 are allways sent, the others are optional
|
||||||
|
#define CM_ANGLE1 (1<<0)
|
||||||
|
#define CM_ANGLE3 (1<<1)
|
||||||
|
#define CM_FORWARD (1<<2)
|
||||||
|
#define CM_SIDE (1<<3)
|
||||||
|
#define CM_UP (1<<4)
|
||||||
|
#define CM_BUTTONS (1<<5)
|
||||||
|
#define CM_IMPULSE (1<<6)
|
||||||
|
#define CM_ANGLE2 (1<<7)
|
||||||
|
|
||||||
|
//
|
||||||
|
// temp entity events
|
||||||
|
//
|
||||||
|
#define TE_SPIKE 0
|
||||||
|
#define TE_SUPERSPIKE 1
|
||||||
|
#define TE_GUNSHOT 2
|
||||||
|
#define TE_EXPLOSION 3
|
||||||
|
#define TE_TAREXPLOSION 4
|
||||||
|
#define TE_LIGHTNING1 5
|
||||||
|
#define TE_LIGHTNING2 6
|
||||||
|
#define TE_WIZSPIKE 7
|
||||||
|
#define TE_KNIGHTSPIKE 8
|
||||||
|
#define TE_LIGHTNING3 9
|
||||||
|
#define TE_LAVASPLASH 10
|
||||||
|
#define TE_TELEPORT 11
|
||||||
|
#define TE_EXPLOSION2 12
|
||||||
|
|
||||||
|
// PGM 01/21/97
|
||||||
|
#define TE_BEAM 13
|
||||||
|
// PGM 01/21/97
|
||||||
|
|
||||||
|
// QUAKEWORLD
|
||||||
|
#define TE_BLOOD 12
|
||||||
|
#define TE_LIGHTNINGBLOOD 13
|
||||||
|
|
||||||
|
/*
|
||||||
|
==========================================================
|
||||||
|
|
||||||
|
ELEMENTS COMMUNICATED ACROSS THE NET
|
||||||
|
|
||||||
|
==========================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define MAX_CLIENTS 32
|
||||||
|
|
||||||
|
#define UPDATE_BACKUP 64 // copies of entity_state_t to keep buffered
|
||||||
|
// must be power of two
|
||||||
|
#define UPDATE_MASK (UPDATE_BACKUP-1)
|
||||||
|
|
||||||
|
#endif
|
|
@ -590,7 +590,7 @@ Host_Init (quakeparms_t *parms)
|
||||||
Mod_Init ();
|
Mod_Init ();
|
||||||
|
|
||||||
#ifdef UQUAKE
|
#ifdef UQUAKE
|
||||||
NET_Init ();
|
NET_Init (-1); // The port is not used, at all..
|
||||||
SV_Init ();
|
SV_Init ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
18
common/net.h
18
common/net.h
|
@ -61,7 +61,7 @@ extern sizebuf_t net_message;
|
||||||
|
|
||||||
extern int net_socket;
|
extern int net_socket;
|
||||||
|
|
||||||
#ifdef UQUAKE
|
//#ifdef UQUAKE
|
||||||
// This ifdef is for clarity, not compilability
|
// This ifdef is for clarity, not compilability
|
||||||
#define NET_NAMELEN 64
|
#define NET_NAMELEN 64
|
||||||
|
|
||||||
|
@ -189,11 +189,11 @@ extern int messagesSent;
|
||||||
extern int messagesReceived;
|
extern int messagesReceived;
|
||||||
extern int unreliableMessagesSent;
|
extern int unreliableMessagesSent;
|
||||||
extern int unreliableMessagesReceived;
|
extern int unreliableMessagesReceived;
|
||||||
#endif // UQUAKE
|
//#endif // UQUAKE
|
||||||
|
|
||||||
#ifdef QUAKEWORLD
|
//#ifdef QUAKEWORLD
|
||||||
void NET_Init (int port);
|
void NET_Init (int port);
|
||||||
#endif
|
//#endif
|
||||||
void NET_Shutdown (void);
|
void NET_Shutdown (void);
|
||||||
qboolean NET_GetPacket (void);
|
qboolean NET_GetPacket (void);
|
||||||
void NET_SendPacket (int length, void *data, netadr_t to);
|
void NET_SendPacket (int length, void *data, netadr_t to);
|
||||||
|
@ -256,7 +256,7 @@ typedef struct
|
||||||
double outgoing_time[MAX_LATENT];
|
double outgoing_time[MAX_LATENT];
|
||||||
} netchan_t;
|
} netchan_t;
|
||||||
|
|
||||||
#ifdef QUAKEWORLD
|
//#ifdef QUAKEWORLD
|
||||||
extern int net_drop; // packets dropped before this one
|
extern int net_drop; // packets dropped before this one
|
||||||
|
|
||||||
void Netchan_Init (void);
|
void Netchan_Init (void);
|
||||||
|
@ -268,11 +268,11 @@ void Netchan_Setup (netchan_t *chan, netadr_t adr, int qport);
|
||||||
|
|
||||||
qboolean Netchan_CanPacket (netchan_t *chan);
|
qboolean Netchan_CanPacket (netchan_t *chan);
|
||||||
qboolean Netchan_CanReliable (netchan_t *chan);
|
qboolean Netchan_CanReliable (netchan_t *chan);
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
extern cvar_t *hostname;
|
extern cvar_t *hostname;
|
||||||
|
|
||||||
#ifdef UQUAKE
|
//#ifdef UQUAKE
|
||||||
qsocket_t *NET_NewQSocket (void);
|
qsocket_t *NET_NewQSocket (void);
|
||||||
void NET_FreeQSocket(qsocket_t *);
|
void NET_FreeQSocket(qsocket_t *);
|
||||||
double SetNetTime(void);
|
double SetNetTime(void);
|
||||||
|
@ -305,7 +305,7 @@ extern double net_time;
|
||||||
extern sizebuf_t net_message;
|
extern sizebuf_t net_message;
|
||||||
extern int net_activeconnections;
|
extern int net_activeconnections;
|
||||||
|
|
||||||
void NET_Init (void);
|
//void NET_Init (void);
|
||||||
void NET_Shutdown (void);
|
void NET_Shutdown (void);
|
||||||
|
|
||||||
struct qsocket_s *NET_CheckNewConnections (void);
|
struct qsocket_s *NET_CheckNewConnections (void);
|
||||||
|
@ -373,7 +373,7 @@ extern qboolean slistSilent;
|
||||||
extern qboolean slistLocal;
|
extern qboolean slistLocal;
|
||||||
|
|
||||||
void NET_Slist_f (void);
|
void NET_Slist_f (void);
|
||||||
#endif // UQUAKE
|
//#endif // UQUAKE
|
||||||
|
|
||||||
#define MAX_PACKET_ENTITIES 64 // doesn't count nails
|
#define MAX_PACKET_ENTITIES 64 // doesn't count nails
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
|
@ -22,6 +22,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#ifndef __protocol_h
|
#ifndef __protocol_h
|
||||||
#define __protocol_h
|
#define __protocol_h
|
||||||
|
|
||||||
|
#include <common_protocol.h>
|
||||||
|
|
||||||
|
#if !(defined(QUAKEWORLD) || defined(UQUAKE))
|
||||||
|
#error This is NOT safe to include for common items.
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef UQUAKE
|
#ifdef UQUAKE
|
||||||
#define PROTOCOL_VERSION 15
|
#define PROTOCOL_VERSION 15
|
||||||
|
|
||||||
|
@ -143,32 +149,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#endif // QUAKEWORLD
|
#endif // QUAKEWORLD
|
||||||
|
|
||||||
// game types sent by serverinfo
|
|
||||||
// these determine which intermission screen plays
|
|
||||||
#define GAME_COOP 0
|
|
||||||
#define GAME_DEATHMATCH 1
|
|
||||||
|
|
||||||
|
|
||||||
//==================
|
|
||||||
// note that there are some defs.qc that mirror to these numbers
|
|
||||||
// also related to svc_strings[] in cl_parse
|
|
||||||
//==================
|
|
||||||
|
|
||||||
//
|
|
||||||
// server to client
|
|
||||||
//
|
|
||||||
#define svc_bad 0
|
|
||||||
#define svc_nop 1
|
|
||||||
#define svc_disconnect 2
|
|
||||||
#define svc_updatestat 3 // [byte] [long]
|
|
||||||
#define svc_version 4 // [long] server version
|
|
||||||
#define svc_setview 5 // [short] entity number
|
|
||||||
#define svc_sound 6 // <see code>
|
|
||||||
#define svc_time 7 // [float] server time
|
|
||||||
#define svc_print 8 // [string] null terminated string
|
|
||||||
#define svc_stufftext 9 // [string] stuffed into client's console buffer
|
|
||||||
// the string should be \n terminated
|
|
||||||
#define svc_setangle 10 // [angle3] set the view angle to this absolute value
|
|
||||||
#ifdef UQUAKE
|
#ifdef UQUAKE
|
||||||
#define svc_serverinfo 11 // [long] version
|
#define svc_serverinfo 11 // [long] version
|
||||||
// [string] signon string
|
// [string] signon string
|
||||||
|
@ -177,154 +157,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#else
|
#else
|
||||||
#define svc_serverdata 11 // [long] protocol ...
|
#define svc_serverdata 11 // [long] protocol ...
|
||||||
#endif
|
#endif
|
||||||
#define svc_lightstyle 12 // [byte] [string]
|
|
||||||
#define svc_updatename 13 // [byte] [string]
|
|
||||||
#define svc_updatefrags 14 // [byte] [short]
|
|
||||||
#define svc_clientdata 15 // <shortbits + data>
|
|
||||||
#define svc_stopsound 16 // <see code>
|
|
||||||
#define svc_updatecolors 17 // [byte] [byte]
|
|
||||||
#define svc_particle 18 // [vec3] <variable>
|
|
||||||
#define svc_damage 19
|
|
||||||
|
|
||||||
#define svc_spawnstatic 20
|
|
||||||
// svc_spawnbinary 21
|
|
||||||
#define svc_spawnbaseline 22
|
|
||||||
|
|
||||||
#define svc_temp_entity 23
|
|
||||||
|
|
||||||
#define svc_setpause 24 // [byte] on / off
|
|
||||||
#define svc_signonnum 25 // [byte] used for the signon sequence
|
|
||||||
|
|
||||||
#define svc_centerprint 26 // [string] to put in center of the screen
|
|
||||||
|
|
||||||
#define svc_killedmonster 27
|
|
||||||
#define svc_foundsecret 28
|
|
||||||
|
|
||||||
#define svc_spawnstaticsound 29 // [coord3] [byte] samp [byte] vol [byte] aten
|
|
||||||
|
|
||||||
#define svc_intermission 30 // [string] music
|
|
||||||
#define svc_finale 31 // [string] music [string] text
|
|
||||||
|
|
||||||
#define svc_cdtrack 32 // [byte] track [byte] looptrack
|
|
||||||
#define svc_sellscreen 33
|
|
||||||
|
|
||||||
|
|
||||||
#define svc_cutscene 34
|
|
||||||
// QUAKEWORLD
|
|
||||||
#define svc_smallkick 34 // set client punchangle to 2
|
|
||||||
#define svc_bigkick 35 // set client punchangle to 4
|
|
||||||
|
|
||||||
#define svc_updateping 36 // [byte] [short]
|
|
||||||
#define svc_updateentertime 37 // [byte] [float]
|
|
||||||
|
|
||||||
#define svc_updatestatlong 38 // [byte] [long]
|
|
||||||
|
|
||||||
#define svc_muzzleflash 39 // [short] entity
|
|
||||||
|
|
||||||
#define svc_updateuserinfo 40 // [byte] slot [long] uid
|
|
||||||
// [string] userinfo
|
|
||||||
|
|
||||||
#define svc_download 41 // [short] size [size bytes]
|
|
||||||
#define svc_playerinfo 42 // variable
|
|
||||||
#define svc_nails 43 // [byte] num [48 bits] xyzpy 12 12 12 4 8
|
|
||||||
#define svc_chokecount 44 // [byte] packets choked
|
|
||||||
#define svc_modellist 45 // [strings]
|
|
||||||
#define svc_soundlist 46 // [strings]
|
|
||||||
#define svc_packetentities 47 // [...]
|
|
||||||
#define svc_deltapacketentities 48 // [...]
|
|
||||||
#define svc_maxspeed 49 // maxspeed change, for prediction
|
|
||||||
#define svc_entgravity 50 // gravity change, for prediction
|
|
||||||
#define svc_setinfo 51 // setinfo on a client
|
|
||||||
#ifdef QUAKEWORLD
|
#ifdef QUAKEWORLD
|
||||||
#define svc_serverinfo 52 // serverinfo
|
#define svc_serverinfo 52 // serverinfo
|
||||||
#endif
|
#endif
|
||||||
#define svc_updatepl 53 // [byte] [byte]
|
|
||||||
|
|
||||||
//
|
|
||||||
// client to server
|
|
||||||
//
|
|
||||||
#define clc_bad 0
|
|
||||||
#define clc_nop 1
|
|
||||||
#define clc_disconnect 2
|
|
||||||
#define clc_move 3 // [usercmd_t]
|
|
||||||
#define clc_stringcmd 4 // [string] message
|
|
||||||
#define clc_delta 5 // [byte] sequence number, requests delta compression of message
|
|
||||||
#define clc_tmove 6 // teleport request, spectator only
|
|
||||||
#define clc_upload 7 // teleport request, spectator only
|
|
||||||
|
|
||||||
//==============================================
|
|
||||||
|
|
||||||
// playerinfo flags from server
|
|
||||||
// playerinfo allways sends: playernum, flags, origin[] and framenumber
|
|
||||||
|
|
||||||
#define PF_MSEC (1<<0)
|
|
||||||
#define PF_COMMAND (1<<1)
|
|
||||||
#define PF_VELOCITY1 (1<<2)
|
|
||||||
#define PF_VELOCITY2 (1<<3)
|
|
||||||
#define PF_VELOCITY3 (1<<4)
|
|
||||||
#define PF_MODEL (1<<5)
|
|
||||||
#define PF_SKINNUM (1<<6)
|
|
||||||
#define PF_EFFECTS (1<<7)
|
|
||||||
#define PF_WEAPONFRAME (1<<8) // only sent for view player
|
|
||||||
#define PF_DEAD (1<<9) // don't block movement any more
|
|
||||||
#define PF_GIB (1<<10) // offset the view height differently
|
|
||||||
#define PF_NOGRAV (1<<11) // don't apply gravity for prediction
|
|
||||||
|
|
||||||
//==============================================
|
|
||||||
|
|
||||||
// if the high bit of the client to server byte is set, the low bits are
|
|
||||||
// client move cmd bits
|
|
||||||
// ms and angle2 are allways sent, the others are optional
|
|
||||||
#define CM_ANGLE1 (1<<0)
|
|
||||||
#define CM_ANGLE3 (1<<1)
|
|
||||||
#define CM_FORWARD (1<<2)
|
|
||||||
#define CM_SIDE (1<<3)
|
|
||||||
#define CM_UP (1<<4)
|
|
||||||
#define CM_BUTTONS (1<<5)
|
|
||||||
#define CM_IMPULSE (1<<6)
|
|
||||||
#define CM_ANGLE2 (1<<7)
|
|
||||||
|
|
||||||
//
|
|
||||||
// temp entity events
|
|
||||||
//
|
|
||||||
#define TE_SPIKE 0
|
|
||||||
#define TE_SUPERSPIKE 1
|
|
||||||
#define TE_GUNSHOT 2
|
|
||||||
#define TE_EXPLOSION 3
|
|
||||||
#define TE_TAREXPLOSION 4
|
|
||||||
#define TE_LIGHTNING1 5
|
|
||||||
#define TE_LIGHTNING2 6
|
|
||||||
#define TE_WIZSPIKE 7
|
|
||||||
#define TE_KNIGHTSPIKE 8
|
|
||||||
#define TE_LIGHTNING3 9
|
|
||||||
#define TE_LAVASPLASH 10
|
|
||||||
#define TE_TELEPORT 11
|
|
||||||
#define TE_EXPLOSION2 12
|
|
||||||
|
|
||||||
// PGM 01/21/97
|
|
||||||
#define TE_BEAM 13
|
|
||||||
// PGM 01/21/97
|
|
||||||
|
|
||||||
#ifdef QUAKE2
|
#ifdef QUAKE2
|
||||||
#define TE_IMPLOSION 14
|
#define TE_IMPLOSION 14
|
||||||
#define TE_RAILTRAIL 15
|
#define TE_RAILTRAIL 15
|
||||||
#endif
|
#endif
|
||||||
// QUAKEWORLD
|
|
||||||
#define TE_BLOOD 12
|
|
||||||
#define TE_LIGHTNINGBLOOD 13
|
|
||||||
|
|
||||||
/*
|
|
||||||
==========================================================
|
|
||||||
|
|
||||||
ELEMENTS COMMUNICATED ACROSS THE NET
|
|
||||||
|
|
||||||
==========================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define MAX_CLIENTS 32
|
|
||||||
|
|
||||||
#define UPDATE_BACKUP 64 // copies of entity_state_t to keep buffered
|
|
||||||
// must be power of two
|
|
||||||
#define UPDATE_MASK (UPDATE_BACKUP-1)
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -36,6 +36,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include <zone.h>
|
#include <zone.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <fnmatch.h>
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -667,26 +669,31 @@ pack_t *COM_LoadPackZipFile (char *packfile)
|
||||||
void
|
void
|
||||||
COM_LoadGameDirectory(char *dir)
|
COM_LoadGameDirectory(char *dir)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
searchpath_t *search;
|
searchpath_t *search;
|
||||||
pack_t *pak;
|
pack_t *pak;
|
||||||
char pakfile[MAX_OSPATH];
|
char pakfile[MAX_OSPATH];
|
||||||
qboolean done = false;
|
DIR *dir_ptr;
|
||||||
|
struct dirent *dirent;
|
||||||
|
|
||||||
for ( i=0 ; !done ; i++ ) { // Load all Pak1 files
|
dir_ptr = opendir(dir);
|
||||||
snprintf(pakfile, sizeof(pakfile), "%s/pak%i.pak", dir, i);
|
|
||||||
|
|
||||||
pak = COM_LoadPackFile(pakfile);
|
while ((dirent = readdir(dir_ptr))) {
|
||||||
|
if (!fnmatch("*.pak", dirent->d_name, 0)) {
|
||||||
|
snprintf(pakfile, sizeof(pakfile), "%s/%s", dir, dirent->d_name);
|
||||||
|
|
||||||
if( !pak ) {
|
pak = COM_LoadPackFile(pakfile);
|
||||||
done = true;
|
|
||||||
} else {
|
if (!pak) {
|
||||||
search = Z_Malloc (sizeof(searchpath_t));
|
Sys_Error(va("Bad pakfile %s!!", pakfile));
|
||||||
search->pack = pak;
|
} else {
|
||||||
search->next = com_searchpaths;
|
search = Z_Malloc (sizeof(searchpath_t));
|
||||||
com_searchpaths = search;
|
search->pack = pak;
|
||||||
|
search->next = com_searchpaths;
|
||||||
|
com_searchpaths = search;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
closedir(dir_ptr);
|
||||||
|
|
||||||
#ifdef GENERATIONS
|
#ifdef GENERATIONS
|
||||||
for (done=false, i=0 ; !done ; i++ ) {
|
for (done=false, i=0 ; !done ; i++ ) {
|
||||||
|
|
|
@ -24,6 +24,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#ifndef _SERVER_H
|
#ifndef _SERVER_H
|
||||||
#define _SERVER_H
|
#define _SERVER_H
|
||||||
|
|
||||||
|
#if !(defined(QUAKEWORLD) || defined(UQUAKE))
|
||||||
|
#error This is NOT safe to include for common items.
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#pragma warning( disable : 4244 4127 4201 4214 4514 4305 4115 4018)
|
#pragma warning( disable : 4244 4127 4201 4214 4514 4305 4115 4018)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -816,7 +816,7 @@ NET_Init
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void NET_Init (void)
|
void NET_Init (int port)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int controlSocket;
|
int controlSocket;
|
||||||
|
|
Loading…
Reference in a new issue