mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2024-11-10 06:31:56 +00:00
Committing my merges of client.h and net.h.. Got rid of snd_dma.c changes
made before, it breaks a few things but it needs to be committed so they can be fixed..
This commit is contained in:
parent
004003ccb0
commit
3c55b43e25
14 changed files with 677 additions and 838 deletions
|
@ -34,7 +34,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include <net.h>
|
||||
#include <qtypes.h>
|
||||
#include <zone.h>
|
||||
#if defined(UQUAKE) || defined(QUAKEWORLD)
|
||||
# include <protocol.h>
|
||||
#endif
|
||||
#include <vid.h>
|
||||
#include <render.h>
|
||||
#include <common.h>
|
||||
|
@ -54,10 +56,10 @@ typedef struct
|
|||
// to do move prediction and to generate a drawable entity
|
||||
typedef struct
|
||||
{
|
||||
int messagenum; // all player's won't be updated each frame
|
||||
int messagenum; // all players not updated each frame
|
||||
|
||||
double state_time; // not the same as the packet time,
|
||||
// because player commands come asyncronously
|
||||
double state_time; // not same as packet time b/c
|
||||
// player commands come async
|
||||
usercmd_t command; // last command for prediction
|
||||
|
||||
vec3_t origin;
|
||||
|
@ -73,7 +75,7 @@ typedef struct
|
|||
int flags; // dead, gib, etc
|
||||
|
||||
float waterjumptime;
|
||||
int onground; // -1 = in air, else pmove entity number
|
||||
int onground; // -1 = in air or pmove entity number
|
||||
int oldbuttons;
|
||||
} player_state_t;
|
||||
|
||||
|
@ -108,14 +110,15 @@ typedef struct
|
|||
// generated on client side
|
||||
usercmd_t cmd; // cmd that generated the frame
|
||||
double senttime; // time cmd was sent off
|
||||
int delta_sequence; // sequence number to delta from, -1 = full update
|
||||
int delta_sequence; // sequence number to delta from
|
||||
// -1 = full update
|
||||
|
||||
// received from server
|
||||
double receivedtime; // time message was received, or -1
|
||||
player_state_t playerstate[MAX_CLIENTS]; // message received that reflects performing
|
||||
// the usercmd
|
||||
player_state_t playerstate[MAX_CLIENTS]; // message received,
|
||||
// reflects performing the usercmd
|
||||
packet_entities_t packet_entities;
|
||||
qboolean invalid; // true if the packet_entities delta was invalid
|
||||
qboolean invalid; // if packet_entities delta is invalid
|
||||
} frame_t;
|
||||
|
||||
|
||||
|
@ -126,6 +129,10 @@ typedef struct
|
|||
#define NUM_CSHIFTS 4
|
||||
|
||||
|
||||
// only UQuake uses these
|
||||
#define NAME_LENGTH 64
|
||||
#define SIGNONS 4
|
||||
|
||||
//
|
||||
// client_state_t should hold all pieces of the client state
|
||||
//
|
||||
|
@ -138,6 +145,9 @@ typedef struct
|
|||
float die; // stop lighting after this time
|
||||
float decay; // drop this each second
|
||||
float minlight; // don't add when contributing less
|
||||
#ifdef QUAKE2
|
||||
qboolean dark;
|
||||
#endif // QUAKE2
|
||||
float color[4];
|
||||
} dlight_t;
|
||||
|
||||
|
@ -147,17 +157,30 @@ typedef struct
|
|||
char map[MAX_STYLESTRING];
|
||||
} lightstyle_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[MAX_SCOREBOARDNAME];
|
||||
float entertime;
|
||||
int frags;
|
||||
int colors; // two 4 bit fields
|
||||
byte translations[VID_GRADES*256];
|
||||
} scoreboard_t;
|
||||
|
||||
|
||||
#ifdef QUAKEWORLD
|
||||
# define MAX_EFRAGS 512
|
||||
#elif UQUAKE
|
||||
# define MAX_EFRAGS 640
|
||||
#endif // FIXME: do we NEED two settings here?
|
||||
|
||||
#define MAX_MAPSTRING 2048
|
||||
#define MAX_DEMOS 8
|
||||
#define MAX_DEMONAME 16
|
||||
|
||||
typedef enum {
|
||||
ca_dedicated, // server with no ability to start a client
|
||||
ca_disconnected, // full screen console with no connection
|
||||
ca_demostart, // starting up a demo
|
||||
ca_connected, // netchan_t established, waiting for svc_serverdata
|
||||
ca_connected, // connected, waiting for svc_serverdata
|
||||
ca_onserver, // processing data lists, donwloading, etc
|
||||
ca_active // everything is in, so frames can be rendered
|
||||
} cactive_t;
|
||||
|
@ -176,19 +199,15 @@ typedef enum {
|
|||
//
|
||||
typedef struct
|
||||
{
|
||||
// connection information
|
||||
cactive_t state;
|
||||
cactive_t state; // connection info
|
||||
netchan_t netchan; // network stuff
|
||||
|
||||
// network stuff
|
||||
netchan_t netchan;
|
||||
|
||||
// private userinfo for sending to masterless servers
|
||||
#ifdef QUAKEWORLD
|
||||
char userinfo[MAX_INFO_STRING];
|
||||
|
||||
char servername[MAX_OSPATH]; // name of server from original connect
|
||||
|
||||
char servername[MAX_OSPATH];
|
||||
int qport;
|
||||
|
||||
// download stuff
|
||||
FILE *download; // file transfer from server
|
||||
char downloadtempname[MAX_OSPATH];
|
||||
char downloadname[MAX_OSPATH];
|
||||
|
@ -196,32 +215,31 @@ typedef struct
|
|||
dltype_t downloadtype;
|
||||
int downloadpercent;
|
||||
|
||||
// demo loop control
|
||||
int demonum; // -1 = don't play demos
|
||||
char demos[MAX_DEMOS][MAX_DEMONAME]; // when not playing
|
||||
int challenge;
|
||||
float latency; // rolling average
|
||||
#elif UQUAKE
|
||||
char mapstring[MAX_QPATH];
|
||||
char spawnparms[MAX_MAPSTRING]; // to restart level
|
||||
|
||||
// demo recording info must be here, because record is started before
|
||||
// entering a map (and clearing client_state_t)
|
||||
int signon;
|
||||
struct qsocket_s *netcon;
|
||||
#endif // QUAKEWORLD else UQUAKE
|
||||
|
||||
// demos - this stuff can't go into client_state_t
|
||||
int demonum;
|
||||
char demos[MAX_DEMOS][MAX_DEMONAME];
|
||||
qboolean demorecording;
|
||||
qboolean demoplayback;
|
||||
qboolean timedemo;
|
||||
gzFile *demofile;
|
||||
float td_lastframe; // to meter out one message a frame
|
||||
int td_startframe; // host_framecount at start
|
||||
float td_starttime; // realtime at second frame of timedemo
|
||||
float td_lastframe;
|
||||
int td_startframe;
|
||||
float td_starttime;
|
||||
|
||||
int challenge;
|
||||
|
||||
float latency; // rolling average
|
||||
} client_static_t;
|
||||
|
||||
extern client_static_t cls;
|
||||
|
||||
//
|
||||
// the client_state_t structure is wiped completely at every
|
||||
// server signon
|
||||
//
|
||||
|
||||
//
|
||||
// the client_state_t structure is wiped completely at every
|
||||
// server signon
|
||||
|
@ -229,17 +247,17 @@ extern client_static_t cls;
|
|||
typedef struct
|
||||
{
|
||||
int movemessages; // since connecting to this server
|
||||
// throw out the first couple, so the player
|
||||
// doesn't accidentally do something the
|
||||
// first frame
|
||||
// throw out the first couple, so the
|
||||
// player doesn't accidentally do
|
||||
// something the first frame
|
||||
|
||||
// information for local display
|
||||
int stats[MAX_CL_STATS]; // health, etc
|
||||
float item_gettime[32]; //cl.time of aquiring item, for blinking
|
||||
float faceanimtime; // use anim frame if cl.time < this
|
||||
float item_gettime[32]; // for item blinking
|
||||
float faceanimtime; // for face anims
|
||||
|
||||
cshift_t cshifts[NUM_CSHIFTS]; // color shifts for damage, powerups
|
||||
cshift_t prev_cshifts[NUM_CSHIFTS]; // and content types
|
||||
cshift_t cshifts[NUM_CSHIFTS]; // color shifts
|
||||
cshift_t prev_cshifts[NUM_CSHIFTS];
|
||||
|
||||
// the client maintains its own idea of view angles, which are
|
||||
// sent to the server each frame. And only reset at level change
|
||||
|
@ -247,8 +265,7 @@ typedef struct
|
|||
vec3_t viewangles;
|
||||
|
||||
// the client simulates or interpolates movement to get these values
|
||||
double time; // this is the time value that the client
|
||||
// is rendering at. allways <= realtime
|
||||
double time; // time clientis rendering at, <= realtime
|
||||
|
||||
// pitch drifting vars
|
||||
float pitchvel;
|
||||
|
@ -260,8 +277,8 @@ typedef struct
|
|||
qboolean paused; // send over by server
|
||||
|
||||
int completed_time; // latched at intermission start
|
||||
float punchangle; // temporar yview kick from weapon firing
|
||||
int intermission; // don't change view angle, full screen, etc
|
||||
float punchangle; // temporary yview for weapon kick
|
||||
int intermission; // don't change view, full screen, etc
|
||||
|
||||
//
|
||||
// information that is static for the entire time connected to a server
|
||||
|
@ -292,9 +309,10 @@ typedef struct
|
|||
char serverinfo[MAX_SERVERINFO_STRING];
|
||||
|
||||
int parsecount; // server message counter
|
||||
int validsequence; // this is the sequence number of the last good
|
||||
// packetentity_t we got. If this is 0, we can't
|
||||
// render a frame yet
|
||||
int validsequence; // this is the sequence number of
|
||||
// the last good packetentity_t we
|
||||
// got. If this is 0, we can't render
|
||||
// a frame yet
|
||||
int spectator;
|
||||
|
||||
double last_ping_request; // while showing scoreboard
|
||||
|
@ -312,26 +330,26 @@ typedef struct
|
|||
#elif defined(UQUAKE)
|
||||
// UQ specific.
|
||||
int num_entities; // held in cl_entities array
|
||||
float last_received_message; // (realtime) for net trouble icon
|
||||
float last_received_message; // (time) for net trouble icon
|
||||
double mtime[2]; // the timestamp of last two messages
|
||||
double oldtime; // previous cl.time, time-oldtime is used
|
||||
// to decay light values and smooth step ups
|
||||
double oldtime; // previous cl.time, time-oldtime is
|
||||
// used to decay light values and
|
||||
// smooth step ups
|
||||
|
||||
qboolean onground;
|
||||
qboolean inwater;
|
||||
float viewheight;
|
||||
float idealpitch;
|
||||
// frag scoreboard
|
||||
struct scoreboard_t *scores; // [cl.maxclients]
|
||||
|
||||
struct usercmd_t cmd; // last command sent to the server
|
||||
int items; // inventory bit flags
|
||||
vec3_t mviewangles[2]; // during demo playback viewangles is lerped
|
||||
vec3_t mviewangles[2]; // in demos, viewangles is lerped
|
||||
// between these
|
||||
vec3_t mvelocity[2]; // update by server, used for lean+bob
|
||||
// (0 is newest)
|
||||
vec3_t velocity; // lerped between mvelocity[0] and [1]
|
||||
#endif
|
||||
#endif // QUAKEWORLD else UQUAKE
|
||||
} client_state_t;
|
||||
|
||||
extern client_state_t cl;
|
||||
|
@ -339,7 +357,16 @@ extern client_state_t cl;
|
|||
//
|
||||
// cvars
|
||||
//
|
||||
#ifdef UQUAKE
|
||||
extern cvar_t cl_name;
|
||||
extern cvar_t cl_color;
|
||||
extern cvar_t cl_autofire;
|
||||
extern cvar_t cl_nolerp;
|
||||
#endif // UQUAKE
|
||||
#ifdef QUAKEWORLD
|
||||
extern cvar_t cl_warncmd;
|
||||
extern cvar_t name;
|
||||
#endif // QUAKEWORLD
|
||||
extern cvar_t cl_upspeed;
|
||||
extern cvar_t cl_forwardspeed;
|
||||
extern cvar_t cl_backspeed;
|
||||
|
@ -368,21 +395,25 @@ extern cvar_t m_side;
|
|||
|
||||
extern cvar_t _windowed_mouse;
|
||||
|
||||
extern cvar_t name;
|
||||
|
||||
|
||||
#define MAX_TEMP_ENTITIES 64 // lightning bolts, etc
|
||||
#define MAX_STATIC_ENTITIES 128 // torches, etc
|
||||
|
||||
|
||||
// FIXME, allocate dynamically
|
||||
#ifdef QUAKEWORLD
|
||||
extern entity_state_t cl_baselines[MAX_EDICTS];
|
||||
#endif // QUAKEWORLD
|
||||
#ifdef UQUAKE
|
||||
extern entity_t cl_entities[MAX_EDICTS];
|
||||
extern entity_t cl_temp_entities[MAX_TEMP_ENTITIES];
|
||||
#endif // UQUAKE
|
||||
extern efrag_t cl_efrags[MAX_EFRAGS];
|
||||
extern entity_t cl_static_entities[MAX_STATIC_ENTITIES];
|
||||
extern lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
|
||||
extern dlight_t cl_dlights[MAX_DLIGHTS];
|
||||
|
||||
extern qboolean nomaster;
|
||||
extern char *server_version; // version of server we connected to
|
||||
extern char *server_version;
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
@ -398,19 +429,34 @@ void Host_WriteConfiguration (void);
|
|||
|
||||
void CL_EstablishConnection (char *host);
|
||||
|
||||
#ifdef UQUAKE
|
||||
void CL_Signon1 (void);
|
||||
void CL_Signon2 (void);
|
||||
void CL_Signon3 (void);
|
||||
void CL_Signon4 (void);
|
||||
#endif // UQUAKE
|
||||
|
||||
void CL_Disconnect (void);
|
||||
void CL_Disconnect_f (void);
|
||||
void CL_NextDemo (void);
|
||||
#ifdef QUAKEWORLD
|
||||
qboolean CL_DemoBehind(void);
|
||||
|
||||
void CL_BeginServerConnect(void);
|
||||
#endif // QUAKEWORLD
|
||||
|
||||
|
||||
#define MAX_VISEDICTS 256
|
||||
|
||||
extern int cl_numvisedicts, cl_oldnumvisedicts;
|
||||
#ifdef QUAKEWORLD
|
||||
extern entity_t *cl_visedicts, *cl_oldvisedicts;
|
||||
extern entity_t cl_visedicts_list[2][MAX_VISEDICTS];
|
||||
extern char emodel_name[], pmodel_name[], prespawn_name[],
|
||||
modellist_name[], soundlist_name[];
|
||||
#elif UQUAKE
|
||||
extern entity_t *cl_visedicts[MAX_VISEDICTS];
|
||||
#endif // QUAKEWORLD else UQUAKE
|
||||
|
||||
extern char emodel_name[], pmodel_name[], prespawn_name[], modellist_name[], soundlist_name[];
|
||||
|
||||
//
|
||||
// cl_input
|
||||
|
@ -434,7 +480,9 @@ void CL_UpdateTEnts (void);
|
|||
|
||||
void CL_ClearState (void);
|
||||
|
||||
#ifdef QUAKEWORLD
|
||||
void CL_ReadPackets (void);
|
||||
#endif // QUAKEWORLD
|
||||
|
||||
int CL_ReadFromServer (void);
|
||||
void CL_WriteToServer (usercmd_t *cmd);
|
||||
|
@ -448,29 +496,37 @@ char *Key_KeynumToString (int keynum);
|
|||
// cl_demo.c
|
||||
//
|
||||
void CL_StopPlayback (void);
|
||||
#ifdef QUAKEWORLD
|
||||
qboolean CL_GetMessage (void);
|
||||
void CL_WriteDemoCmd (usercmd_t *pcmd);
|
||||
#elif UQUAKE
|
||||
int CL_GetMessage (void);
|
||||
#endif // QUAKEWORLD else UQUAKE
|
||||
|
||||
void CL_Stop_f (void);
|
||||
void CL_Record_f (void);
|
||||
#ifdef QUAKEWORLD
|
||||
void CL_ReRecord_f (void);
|
||||
#endif // QUAKEWORLD
|
||||
void CL_PlayDemo_f (void);
|
||||
void CL_TimeDemo_f (void);
|
||||
|
||||
//
|
||||
// cl_parse.c
|
||||
//
|
||||
void CL_ParseServerMessage (void);
|
||||
void CL_NewTranslation (int slot);
|
||||
#ifdef QUAKEWORLD
|
||||
#define NET_TIMINGS 256
|
||||
#define NET_TIMINGSMASK 255
|
||||
extern int packet_latency[NET_TIMINGS];
|
||||
int CL_CalcNet (void);
|
||||
void CL_ParseServerMessage (void);
|
||||
void CL_NewTranslation (int slot);
|
||||
qboolean CL_CheckOrDownloadFile (char *filename);
|
||||
qboolean CL_IsUploading(void);
|
||||
void CL_NextUpload(void);
|
||||
void CL_StartUpload (byte *data, int size);
|
||||
void CL_StopUpload(void);
|
||||
#endif // QUAKEWORLD
|
||||
|
||||
//
|
||||
// view.c
|
||||
|
@ -492,6 +548,7 @@ void V_CalcBlend (void);
|
|||
void CL_InitTEnts (void);
|
||||
void CL_ClearTEnts (void);
|
||||
|
||||
#ifdef QUAKEWORLD
|
||||
//
|
||||
// cl_ents.c
|
||||
//
|
||||
|
@ -558,4 +615,6 @@ void Skin_NextDownload (void);
|
|||
#define RSSHOT_WIDTH 320
|
||||
#define RSSHOT_HEIGHT 200
|
||||
|
||||
#endif // QUAKEWORLD
|
||||
|
||||
#endif // _CLIENT_H
|
|
@ -24,7 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#ifndef _COMMON_H
|
||||
#define _COMMON_H
|
||||
|
||||
#ifdef QUAKEWORLD
|
||||
# include <bothdefs.h>
|
||||
#endif
|
||||
#include <register_check.h>
|
||||
#include <qtypes.h>
|
||||
|
||||
|
|
245
common/config.h
Normal file
245
common/config.h
Normal file
|
@ -0,0 +1,245 @@
|
|||
/* common/config.h. Generated automatically by configure. */
|
||||
/* common/config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define if you don't have vprintf but do have _doprnt. */
|
||||
/* #undef HAVE_DOPRNT */
|
||||
|
||||
/* Define if you have a working `mmap' system call. */
|
||||
#define HAVE_MMAP 1
|
||||
|
||||
/* Define if you have the vprintf function. */
|
||||
#define HAVE_VPRINTF 1
|
||||
|
||||
/* Define as __inline if that's what the C compiler calls it. */
|
||||
/* #undef inline */
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
|
||||
/* Define if your <sys/time.h> declares struct tm. */
|
||||
/* #undef TM_IN_SYS_TIME */
|
||||
|
||||
/* Define if your processor stores words with the most significant
|
||||
byte first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
/* #undef WORDS_BIGENDIAN */
|
||||
|
||||
/* Define if the X Window System is missing or not being used. */
|
||||
/* #undef X_DISPLAY_MISSING */
|
||||
|
||||
/* Version strings */
|
||||
#define QF_VERSION "0.2-devel"
|
||||
#define VERSION "2.40"
|
||||
|
||||
/* Define if you want to use QF-style defaults instead of Id-style */
|
||||
/* #undef NEWSTYLE */
|
||||
|
||||
/* Define this to the subdirectory name of the default game */
|
||||
#define GAMENAME "id1"
|
||||
|
||||
/* Define this if you have OGL */
|
||||
#define HAS_OGL 1
|
||||
|
||||
/* Define if you have the XFree86 DGA extension */
|
||||
#define HAS_DGA 1
|
||||
|
||||
/* If your version of OpenGL uses APIENTRY, define GLAPIENTRY to be APIENTRY*/
|
||||
/* #undef GLAPIENTRY */
|
||||
|
||||
/* Define this to something sane if you don't have stricmp */
|
||||
#define stricmp strcasecmp
|
||||
|
||||
/* Define if you have the dlopen function. */
|
||||
#define HAVE_DLOPEN 1
|
||||
|
||||
/* Define this if you are using Mesa */
|
||||
#define XMESA 1
|
||||
|
||||
/* Define this if you have GL_COLOR_INDEX8_EXT in GL/gl.h */
|
||||
#define HAVE_GL_COLOR_INDEX8_EXT 1
|
||||
|
||||
/* Define this if C symbols are prefixed with an underscore */
|
||||
/* #undef HAVE_SYM_PREFIX_UNDERSCORE */
|
||||
|
||||
/* Define this if you have a Linux-style CD-ROM API */
|
||||
#define USE_LINUX_CD 1
|
||||
|
||||
/* Define this if you have a BSD-style CD-ROM API */
|
||||
/* #undef USE_BSD_CD */
|
||||
|
||||
/* Define this to use experimental code */
|
||||
/* #undef _EXPERIMENTAL_ */
|
||||
|
||||
/* Define this if your system has zlib */
|
||||
/* #undef HAS_ZLIB */
|
||||
|
||||
/* Define this if your system has socklen_t */
|
||||
#define HAVE_SOCKLEN_T 1
|
||||
|
||||
/* Define this if your system has size_t */
|
||||
#define HAVE_SIZE_T 1
|
||||
|
||||
/* Define if you have the _ftime function. */
|
||||
/* #undef HAVE__FTIME */
|
||||
|
||||
/* Define if you have the _snprintf function. */
|
||||
/* #undef HAVE__SNPRINTF */
|
||||
|
||||
/* Define if you have the _vsnprintf function. */
|
||||
/* #undef HAVE__VSNPRINTF */
|
||||
|
||||
/* Define if you have the connect function. */
|
||||
#define HAVE_CONNECT 1
|
||||
|
||||
/* Define if you have the dlopen function. */
|
||||
#define HAVE_DLOPEN 1
|
||||
|
||||
/* Define if you have the fcntl function. */
|
||||
#define HAVE_FCNTL 1
|
||||
|
||||
/* Define if you have the ftime function. */
|
||||
#define HAVE_FTIME 1
|
||||
|
||||
/* Define if you have the gethostbyname function. */
|
||||
#define HAVE_GETHOSTBYNAME 1
|
||||
|
||||
/* Define if you have the gethostname function. */
|
||||
#define HAVE_GETHOSTNAME 1
|
||||
|
||||
/* Define if you have the getpagesize function. */
|
||||
#define HAVE_GETPAGESIZE 1
|
||||
|
||||
/* Define if you have the gettimeofday function. */
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
|
||||
/* Define if you have the getwd function. */
|
||||
#define HAVE_GETWD 1
|
||||
|
||||
/* Define if you have the mkdir function. */
|
||||
#define HAVE_MKDIR 1
|
||||
|
||||
/* Define if you have the putenv function. */
|
||||
#define HAVE_PUTENV 1
|
||||
|
||||
/* Define if you have the select function. */
|
||||
#define HAVE_SELECT 1
|
||||
|
||||
/* Define if you have the snprintf function. */
|
||||
#define HAVE_SNPRINTF 1
|
||||
|
||||
/* Define if you have the socket function. */
|
||||
#define HAVE_SOCKET 1
|
||||
|
||||
/* Define if you have the stat function. */
|
||||
#define HAVE_STAT 1
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#define HAVE_STRERROR 1
|
||||
|
||||
/* Define if you have the strsep function. */
|
||||
#define HAVE_STRSEP 1
|
||||
|
||||
/* Define if you have the strstr function. */
|
||||
#define HAVE_STRSTR 1
|
||||
|
||||
/* Define if you have the vsnprintf function. */
|
||||
#define HAVE_VSNPRINTF 1
|
||||
|
||||
/* Define if you have the <arpa/inet.h> header file. */
|
||||
#define HAVE_ARPA_INET_H 1
|
||||
|
||||
/* Define if you have the <asm/io.h> header file. */
|
||||
#define HAVE_ASM_IO_H 1
|
||||
|
||||
/* Define if you have the <dlfcn.h> header file. */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
/* Define if you have the <dsound.h> header file. */
|
||||
/* #undef HAVE_DSOUND_H */
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define if you have the <initguid.h> header file. */
|
||||
/* #undef HAVE_INITGUID_H */
|
||||
|
||||
/* Define if you have the <linux/soundcard.h> header file. */
|
||||
#define HAVE_LINUX_SOUNDCARD_H 1
|
||||
|
||||
/* Define if you have the <machine/soundcard.h> header file. */
|
||||
/* #undef HAVE_MACHINE_SOUNDCARD_H */
|
||||
|
||||
/* Define if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define if you have the <mme/mme_public.h> header file. */
|
||||
/* #undef HAVE_MME_MME_PUBLIC_H */
|
||||
|
||||
/* Define if you have the <mme/mmsystem.h> header file. */
|
||||
/* #undef HAVE_MME_MMSYSTEM_H */
|
||||
|
||||
/* Define if you have the <mmsystem.h> header file. */
|
||||
/* #undef HAVE_MMSYSTEM_H */
|
||||
|
||||
/* Define if you have the <netdb.h> header file. */
|
||||
#define HAVE_NETDB_H 1
|
||||
|
||||
/* Define if you have the <netinet/in.h> header file. */
|
||||
#define HAVE_NETINET_IN_H 1
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define if you have the <sys/asoundlib.h> header file. */
|
||||
#define HAVE_SYS_ASOUNDLIB_H 1
|
||||
|
||||
/* Define if you have the <sys/audioio.h> header file. */
|
||||
/* #undef HAVE_SYS_AUDIOIO_H */
|
||||
|
||||
/* Define if you have the <sys/filio.h> header file. */
|
||||
/* #undef HAVE_SYS_FILIO_H */
|
||||
|
||||
/* Define if you have the <sys/io.h> header file. */
|
||||
#define HAVE_SYS_IO_H 1
|
||||
|
||||
/* Define if you have the <sys/ioctl.h> header file. */
|
||||
#define HAVE_SYS_IOCTL_H 1
|
||||
|
||||
/* Define if you have the <sys/mman.h> header file. */
|
||||
#define HAVE_SYS_MMAN_H 1
|
||||
|
||||
/* Define if you have the <sys/socket.h> header file. */
|
||||
#define HAVE_SYS_SOCKET_H 1
|
||||
|
||||
/* Define if you have the <sys/soundcard.h> header file. */
|
||||
#define HAVE_SYS_SOUNDCARD_H 1
|
||||
|
||||
/* Define if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define if you have the <sys/timeb.h> header file. */
|
||||
#define HAVE_SYS_TIMEB_H 1
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define if you have the <windows.h> header file. */
|
||||
/* #undef HAVE_WINDOWS_H */
|
||||
|
||||
/* Define if you have the db library (-ldb). */
|
||||
/* #undef HAVE_LIBDB */
|
||||
|
||||
/* Define if you have the m library (-lm). */
|
||||
#define HAVE_LIBM 1
|
||||
|
||||
/* Define if struct ioc_read_toc_single_entry has field entry. */
|
||||
/* #undef HAVE_STRUCT_IOC_READ_TOC_SINGLE_ENTRY_ENTRY */
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
/*
|
||||
net.h - interface to the networking layer
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
||||
Please see the file "AUTHORS" for a list of contributors
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -19,12 +21,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
#ifndef _NET_H
|
||||
#define _NET_H
|
||||
#ifndef __NET_H
|
||||
#define __NET_H
|
||||
|
||||
|
||||
#include <qtypes.h>
|
||||
#include <common.h>
|
||||
#include <cvar.h>
|
||||
#include <qstructs.h>
|
||||
#include <common.h>
|
||||
|
||||
#define PORT_ANY -1
|
||||
|
||||
// Uncomment this line for IPv6 support
|
||||
//#define LINUX_IPV6
|
||||
|
||||
struct qsockaddr
|
||||
{
|
||||
|
@ -33,6 +42,26 @@ struct qsockaddr
|
|||
};
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#ifdef LINUX_IPV6
|
||||
unsigned int ip[4];
|
||||
#else
|
||||
byte ip[4];
|
||||
#endif
|
||||
unsigned short port;
|
||||
unsigned short pad;
|
||||
} netadr_t;
|
||||
|
||||
extern netadr_t net_local_adr;
|
||||
extern netadr_t net_from; // address of who sent the packet
|
||||
extern sizebuf_t net_message;
|
||||
|
||||
|
||||
extern int net_socket;
|
||||
|
||||
#ifdef UQUAKE
|
||||
// This ifdef is for clarity, not compilability
|
||||
#define NET_NAMELEN 64
|
||||
|
||||
#define NET_MAXMESSAGE 8192
|
||||
|
@ -48,71 +77,8 @@ struct qsockaddr
|
|||
#define NETFLAG_UNRELIABLE 0x00100000
|
||||
#define NETFLAG_CTL 0x80000000
|
||||
|
||||
|
||||
#define NET_PROTOCOL_VERSION 3
|
||||
|
||||
// This is the network info/connection protocol. It is used to find Quake
|
||||
// servers, get info about them, and connect to them. Once connected, the
|
||||
// Quake game protocol (documented elsewhere) is used.
|
||||
//
|
||||
//
|
||||
// General notes:
|
||||
// game_name is currently always "QUAKE", but is there so this same protocol
|
||||
// can be used for future games as well; can you say Quake2?
|
||||
//
|
||||
// CCREQ_CONNECT
|
||||
// string game_name "QUAKE"
|
||||
// byte net_protocol_version NET_PROTOCOL_VERSION
|
||||
//
|
||||
// CCREQ_SERVER_INFO
|
||||
// string game_name "QUAKE"
|
||||
// byte net_protocol_version NET_PROTOCOL_VERSION
|
||||
//
|
||||
// CCREQ_PLAYER_INFO
|
||||
// byte player_number
|
||||
//
|
||||
// CCREQ_RULE_INFO
|
||||
// string rule
|
||||
//
|
||||
//
|
||||
//
|
||||
// CCREP_ACCEPT
|
||||
// long port
|
||||
//
|
||||
// CCREP_REJECT
|
||||
// string reason
|
||||
//
|
||||
// CCREP_SERVER_INFO
|
||||
// string server_address
|
||||
// string host_name
|
||||
// string level_name
|
||||
// byte current_players
|
||||
// byte max_players
|
||||
// byte protocol_version NET_PROTOCOL_VERSION
|
||||
//
|
||||
// CCREP_PLAYER_INFO
|
||||
// byte player_number
|
||||
// string name
|
||||
// long colors
|
||||
// long frags
|
||||
// long connect_time
|
||||
// string address
|
||||
//
|
||||
// CCREP_RULE_INFO
|
||||
// string rule
|
||||
// string value
|
||||
|
||||
// note:
|
||||
// There are two address forms used above. The short form is just
|
||||
// a port number. The address that goes along with the port is
|
||||
// defined as "whatever address you receive this reponse from".
|
||||
// This lets us use the host OS to solve the problem of multiple
|
||||
// host addresses (possibly with no routing between them); the
|
||||
// host will use the right address when we reply to the inbound
|
||||
// connection request. The long from is a full address and port
|
||||
// in a string. It is used for returning the address of a server
|
||||
// that is not running locally.
|
||||
|
||||
#define CCREQ_CONNECT 0x01
|
||||
#define CCREQ_SERVER_INFO 0x02
|
||||
#define CCREQ_PLAYER_INFO 0x03
|
||||
|
@ -124,45 +90,6 @@ struct qsockaddr
|
|||
#define CCREP_PLAYER_INFO 0x84
|
||||
#define CCREP_RULE_INFO 0x85
|
||||
|
||||
typedef struct {
|
||||
qboolean fatal_error;
|
||||
float last_received;
|
||||
|
||||
float frame_latency;
|
||||
float frame_rate;
|
||||
|
||||
int drop_count;
|
||||
int good_count;
|
||||
|
||||
#ifdef QUAKEWORLD
|
||||
netadr_t remote_address;
|
||||
int qport;
|
||||
#endif
|
||||
|
||||
double cleartime;
|
||||
double rate;
|
||||
|
||||
int incoming_sequence;
|
||||
int incoming_acknowledged;
|
||||
int incoming_reliable_acknowledged;
|
||||
int incoming_reliable_sequence;
|
||||
|
||||
int outgoing_sequence;
|
||||
int outgoing_reliable;
|
||||
int last_reliable_sequence;
|
||||
|
||||
sizebuf_t message;
|
||||
byte message_bug[MAX_MSGLEN];
|
||||
|
||||
int reliable_length;
|
||||
byte reliable_buf[MAX_MSGLEN];
|
||||
|
||||
#ifdef QUAKEWORLD
|
||||
int outgoing_size[MAX_LATENT];
|
||||
int outgoing_time[MAX_LATENT];
|
||||
#endif
|
||||
} netchan_t;
|
||||
|
||||
typedef struct qsocket_s
|
||||
{
|
||||
struct qsocket_s *next;
|
||||
|
@ -254,7 +181,6 @@ extern int DEFAULTnet_hostport;
|
|||
extern int net_hostport;
|
||||
|
||||
extern int net_driverlevel;
|
||||
extern cvar_t hostname;
|
||||
extern char playername[];
|
||||
extern int playercolor;
|
||||
|
||||
|
@ -262,7 +188,89 @@ extern int messagesSent;
|
|||
extern int messagesReceived;
|
||||
extern int unreliableMessagesSent;
|
||||
extern int unreliableMessagesReceived;
|
||||
#endif // UQUAKE
|
||||
|
||||
|
||||
void NET_Init (int port);
|
||||
void NET_Shutdown (void);
|
||||
qboolean NET_GetPacket (void);
|
||||
void NET_SendPacket (int length, void *data, netadr_t to);
|
||||
|
||||
qboolean NET_CompareAdr (netadr_t a, netadr_t b);
|
||||
qboolean NET_CompareBaseAdr (netadr_t a, netadr_t b);
|
||||
char *NET_AdrToString (netadr_t a);
|
||||
char *NET_BaseAdrToString (netadr_t a);
|
||||
qboolean NET_StringToAdr (char *s, netadr_t *a);
|
||||
qboolean NET_IsClientLegal(netadr_t *adr);
|
||||
|
||||
//============================================================================
|
||||
|
||||
#define OLD_AVG 0.99 // total = oldtotal*OLD_AVG + new*(1-OLD_AVG)
|
||||
|
||||
#define MAX_LATENT 32
|
||||
|
||||
typedef struct
|
||||
{
|
||||
qboolean fatal_error;
|
||||
|
||||
float last_received; // for timeouts
|
||||
|
||||
// the statistics are cleared at each client begin, because
|
||||
// the server connecting process gives a bogus picture of the data
|
||||
float frame_latency; // rolling average
|
||||
float frame_rate;
|
||||
|
||||
int drop_count; // # dropped/good packets,
|
||||
int good_count; // cleared each level
|
||||
|
||||
netadr_t remote_address;
|
||||
int qport;
|
||||
|
||||
// bandwidth estimator
|
||||
double cleartime; // realtime > nc->cleartime
|
||||
// means we're free to go
|
||||
double rate; // seconds / byte
|
||||
|
||||
// sequencing variables
|
||||
int incoming_sequence;
|
||||
int incoming_acknowledged;
|
||||
int incoming_reliable_acknowledged; // single bit
|
||||
|
||||
int incoming_reliable_sequence; // single bit, local
|
||||
|
||||
int outgoing_sequence;
|
||||
int reliable_sequence; // single bit
|
||||
int last_reliable_sequence; // # of last send
|
||||
|
||||
// reliable staging and holding areas
|
||||
sizebuf_t message; // write buffer
|
||||
byte message_buf[MAX_MSGLEN];
|
||||
|
||||
int reliable_length;
|
||||
byte reliable_buf[MAX_MSGLEN]; // unacked reliable msg
|
||||
|
||||
// time and size data to calculate bandwidth
|
||||
int outgoing_size[MAX_LATENT];
|
||||
double outgoing_time[MAX_LATENT];
|
||||
} netchan_t;
|
||||
|
||||
#ifdef QUAKEWORLD
|
||||
extern int net_drop; // packets dropped before this one
|
||||
|
||||
void Netchan_Init (void);
|
||||
void Netchan_Transmit (netchan_t *chan, int length, byte *data);
|
||||
void Netchan_OutOfBand (netadr_t adr, int length, byte *data);
|
||||
void Netchan_OutOfBandPrint (netadr_t adr, char *format, ...);
|
||||
qboolean Netchan_Process (netchan_t *chan);
|
||||
void Netchan_Setup (netchan_t *chan, netadr_t adr, int qport);
|
||||
|
||||
qboolean Netchan_CanPacket (netchan_t *chan);
|
||||
qboolean Netchan_CanReliable (netchan_t *chan);
|
||||
#endif
|
||||
|
||||
extern cvar_t hostname;
|
||||
|
||||
#ifdef UQUAKE
|
||||
qsocket_t *NET_NewQSocket (void);
|
||||
void NET_FreeQSocket(qsocket_t *);
|
||||
double SetNetTime(void);
|
||||
|
@ -363,5 +371,6 @@ extern qboolean slistSilent;
|
|||
extern qboolean slistLocal;
|
||||
|
||||
void NET_Slist_f (void);
|
||||
#endif // UQUAKE
|
||||
|
||||
#endif // _NET_H
|
||||
#endif // __NET_H
|
|
@ -50,4 +50,5 @@ typedef struct
|
|||
int percent; // 0-256
|
||||
} cshift_t;
|
||||
|
||||
#include <cl_state.h>
|
||||
#endif // _QSTRUCTS_H
|
||||
|
|
|
@ -39,8 +39,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include <winquake.h>
|
||||
#endif
|
||||
|
||||
snd_t snd;
|
||||
|
||||
void S_Play(void);
|
||||
void S_PlayVol(void);
|
||||
void S_SoundList(void);
|
||||
|
@ -390,7 +388,7 @@ channel_t *SND_PickChannel(int entnum, int entchannel)
|
|||
}
|
||||
|
||||
// don't let monster sounds override player sounds
|
||||
if (channels[ch_idx].entnum == snd.playernum && entnum != snd.playernum && channels[ch_idx].sfx)
|
||||
if (channels[ch_idx].entnum == cl.playernum -1 && entnum != cl.playernum -1 && channels[ch_idx].sfx)
|
||||
continue;
|
||||
|
||||
if (channels[ch_idx].end - paintedtime < life_left)
|
||||
|
@ -424,7 +422,7 @@ void SND_Spatialize(channel_t *ch)
|
|||
sfx_t *sndfx;
|
||||
|
||||
// anything coming from the view entity will allways be full volume
|
||||
if (ch->entnum == snd.playernum)
|
||||
if (ch->entnum == cl.playernum -1)
|
||||
{
|
||||
ch->leftvol = ch->master_vol;
|
||||
ch->rightvol = ch->master_vol;
|
||||
|
@ -692,10 +690,10 @@ void S_UpdateAmbientSounds (void)
|
|||
return;
|
||||
|
||||
// calc ambient sound levels
|
||||
if (!snd.worldmodel)
|
||||
if (cl.worldmodel == NULL)
|
||||
return;
|
||||
|
||||
l = Mod_PointInLeaf (listener_origin, snd.worldmodel);
|
||||
l = Mod_PointInLeaf (listener_origin, cl.worldmodel);
|
||||
if (!l || !ambient_level.value)
|
||||
{
|
||||
for (ambient_channel = 0 ; ambient_channel< NUM_AMBIENTS ; ambient_channel++)
|
||||
|
@ -1018,7 +1016,7 @@ void S_LocalSound (char *sound)
|
|||
Con_Printf ("S_LocalSound: can't cache %s\n", sound);
|
||||
return;
|
||||
}
|
||||
S_StartSound (snd.playernum, -1, sfx, vec3_origin, 1, 1);
|
||||
S_StartSound (cl.playernum -1, -1, sfx, vec3_origin, 1, 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,6 +28,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include <qdefs.h>
|
||||
#include <zone.h>
|
||||
#include <cvar.h>
|
||||
#include <model.h>
|
||||
#include <qstructs.h>
|
||||
#include <client.h>
|
||||
|
||||
#define DEFAULT_SOUND_PACKET_VOLUME 255
|
||||
#define DEFAULT_SOUND_PACKET_ATTENUATION 1.0
|
||||
|
@ -97,12 +100,6 @@ typedef struct
|
|||
} wavinfo_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int playernum;
|
||||
struct model_s *worldmodel;
|
||||
} snd_t;
|
||||
extern snd_t snd;
|
||||
|
||||
void S_Init (void);
|
||||
void S_Startup (void);
|
||||
void S_Shutdown (void);
|
||||
|
|
61
doc/uquake_net.txt
Normal file
61
doc/uquake_net.txt
Normal file
|
@ -0,0 +1,61 @@
|
|||
// This is the network info/connection protocol. It is used to find Quake
|
||||
// servers, get info about them, and connect to them. Once connected, the
|
||||
// Quake game protocol (documented elsewhere) is used.
|
||||
//
|
||||
//
|
||||
// General notes:
|
||||
// game_name is currently always "QUAKE", but is there so this same protocol
|
||||
// can be used for future games as well; can you say Quake2?
|
||||
//
|
||||
// CCREQ_CONNECT
|
||||
// string game_name "QUAKE"
|
||||
// byte net_protocol_version NET_PROTOCOL_VERSION
|
||||
//
|
||||
// CCREQ_SERVER_INFO
|
||||
// string game_name "QUAKE"
|
||||
// byte net_protocol_version NET_PROTOCOL_VERSION
|
||||
//
|
||||
// CCREQ_PLAYER_INFO
|
||||
// byte player_number
|
||||
//
|
||||
// CCREQ_RULE_INFO
|
||||
// string rule
|
||||
//
|
||||
//
|
||||
//
|
||||
// CCREP_ACCEPT
|
||||
// long port
|
||||
//
|
||||
// CCREP_REJECT
|
||||
// string reason
|
||||
//
|
||||
// CCREP_SERVER_INFO
|
||||
// string server_address
|
||||
// string host_name
|
||||
// string level_name
|
||||
// byte current_players
|
||||
// byte max_players
|
||||
// byte protocol_version NET_PROTOCOL_VERSION
|
||||
//
|
||||
// CCREP_PLAYER_INFO
|
||||
// byte player_number
|
||||
// string name
|
||||
// long colors
|
||||
// long frags
|
||||
// long connect_time
|
||||
// string address
|
||||
//
|
||||
// CCREP_RULE_INFO
|
||||
// string rule
|
||||
// string value
|
||||
|
||||
// note:
|
||||
// There are two address forms used above. The short form is just
|
||||
// a port number. The address that goes along with the port is
|
||||
// defined as "whatever address you receive this reponse from".
|
||||
// This lets us use the host OS to solve the problem of multiple
|
||||
// host addresses (possibly with no routing between them); the
|
||||
// host will use the right address when we reply to the inbound
|
||||
// connection request. The long from is a full address and port
|
||||
// in a string. It is used for returning the address of a server
|
||||
// that is not running locally.
|
|
@ -257,7 +257,7 @@ void Model_NextDownload (void)
|
|||
}
|
||||
|
||||
// all done
|
||||
snd.worldmodel = cl.worldmodel = cl.model_precache[1];
|
||||
cl.worldmodel = cl.model_precache[1];
|
||||
R_NewMap ();
|
||||
Hunk_Check (); // make sure nothing is hurt
|
||||
|
||||
|
@ -590,8 +590,7 @@ void CL_ParseServerData (void)
|
|||
}
|
||||
|
||||
// parse player slot, high bit means spectator
|
||||
snd.playernum = cl.playernum = MSG_ReadByte ();
|
||||
snd.playernum++;
|
||||
cl.playernum = MSG_ReadByte ();
|
||||
if (cl.playernum & 128)
|
||||
{
|
||||
cl.spectator = true;
|
||||
|
|
131
qw_common/net.h
131
qw_common/net.h
|
@ -1,131 +0,0 @@
|
|||
/*
|
||||
net.h - interface to the networking layer
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
||||
Please see the file "AUTHORS" for a list of contributors
|
||||
|
||||
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 _NET_H
|
||||
#define _NET_H
|
||||
|
||||
|
||||
#include <qtypes.h>
|
||||
#include <common.h>
|
||||
#include <cvar.h>
|
||||
|
||||
#define PORT_ANY -1
|
||||
|
||||
// Uncomment this line for IPv6 support
|
||||
//#define LINUX_IPV6
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#ifdef LINUX_IPV6
|
||||
unsigned int ip[4];
|
||||
#else
|
||||
byte ip[4];
|
||||
#endif
|
||||
unsigned short port;
|
||||
unsigned short pad;
|
||||
} netadr_t;
|
||||
|
||||
extern netadr_t net_local_adr;
|
||||
extern netadr_t net_from; // address of who sent the packet
|
||||
extern sizebuf_t net_message;
|
||||
|
||||
|
||||
extern int net_socket;
|
||||
|
||||
void NET_Init (int port);
|
||||
void NET_Shutdown (void);
|
||||
qboolean NET_GetPacket (void);
|
||||
void NET_SendPacket (int length, void *data, netadr_t to);
|
||||
|
||||
qboolean NET_CompareAdr (netadr_t a, netadr_t b);
|
||||
qboolean NET_CompareBaseAdr (netadr_t a, netadr_t b);
|
||||
char *NET_AdrToString (netadr_t a);
|
||||
char *NET_BaseAdrToString (netadr_t a);
|
||||
qboolean NET_StringToAdr (char *s, netadr_t *a);
|
||||
qboolean NET_IsClientLegal(netadr_t *adr);
|
||||
|
||||
//============================================================================
|
||||
|
||||
#define OLD_AVG 0.99 // total = oldtotal*OLD_AVG + new*(1-OLD_AVG)
|
||||
|
||||
#define MAX_LATENT 32
|
||||
|
||||
typedef struct
|
||||
{
|
||||
qboolean fatal_error;
|
||||
|
||||
float last_received; // for timeouts
|
||||
|
||||
// the statistics are cleared at each client begin, because
|
||||
// the server connecting process gives a bogus picture of the data
|
||||
float frame_latency; // rolling average
|
||||
float frame_rate;
|
||||
|
||||
int drop_count; // dropped packets, cleared each level
|
||||
int good_count; // cleared each level
|
||||
|
||||
netadr_t remote_address;
|
||||
int qport;
|
||||
|
||||
// bandwidth estimator
|
||||
double cleartime; // if realtime > nc->cleartime, free to go
|
||||
double rate; // seconds / byte
|
||||
|
||||
// sequencing variables
|
||||
int incoming_sequence;
|
||||
int incoming_acknowledged;
|
||||
int incoming_reliable_acknowledged; // single bit
|
||||
|
||||
int incoming_reliable_sequence; // single bit, maintained local
|
||||
|
||||
int outgoing_sequence;
|
||||
int reliable_sequence; // single bit
|
||||
int last_reliable_sequence; // sequence number of last send
|
||||
|
||||
// reliable staging and holding areas
|
||||
sizebuf_t message; // writing buffer to send to server
|
||||
byte message_buf[MAX_MSGLEN];
|
||||
|
||||
int reliable_length;
|
||||
byte reliable_buf[MAX_MSGLEN]; // unacked reliable message
|
||||
|
||||
// time and size data to calculate bandwidth
|
||||
int outgoing_size[MAX_LATENT];
|
||||
double outgoing_time[MAX_LATENT];
|
||||
} netchan_t;
|
||||
|
||||
extern int net_drop; // packets dropped before this one
|
||||
|
||||
void Netchan_Init (void);
|
||||
void Netchan_Transmit (netchan_t *chan, int length, byte *data);
|
||||
void Netchan_OutOfBand (netadr_t adr, int length, byte *data);
|
||||
void Netchan_OutOfBandPrint (netadr_t adr, char *format, ...);
|
||||
qboolean Netchan_Process (netchan_t *chan);
|
||||
void Netchan_Setup (netchan_t *chan, netadr_t adr, int qport);
|
||||
|
||||
qboolean Netchan_CanPacket (netchan_t *chan);
|
||||
qboolean Netchan_CanReliable (netchan_t *chan);
|
||||
|
||||
extern cvar_t hostname;
|
||||
|
||||
#endif // _NET_H
|
|
@ -321,8 +321,7 @@ void CL_ParseServerInfo (void)
|
|||
|
||||
|
||||
// local state
|
||||
cl_entities[0].model = snd.worldmodel = cl.worldmodel =
|
||||
cl.model_precache[1];
|
||||
cl_entities[0].model = cl.worldmodel = cl.model_precache[1];
|
||||
|
||||
R_NewMap ();
|
||||
|
||||
|
@ -637,7 +636,7 @@ void CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_setview:
|
||||
snd.playernum = cl.playernum = MSG_ReadShort ();
|
||||
cl.playernum = MSG_ReadShort ();
|
||||
cl.playernum--;
|
||||
break;
|
||||
|
||||
|
|
|
@ -28,6 +28,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include <sys.h>
|
||||
#include <client.h>
|
||||
|
||||
#define MAX_BEAMS 24
|
||||
typedef struct
|
||||
{
|
||||
int entity;
|
||||
struct model_s *model;
|
||||
float endtime;
|
||||
vec3_t start, end;
|
||||
} beam_t;
|
||||
|
||||
int num_temp_entities;
|
||||
entity_t cl_temp_entities[MAX_TEMP_ENTITIES];
|
||||
beam_t cl_beams[MAX_BEAMS];
|
||||
|
|
430
uquake/client.h
430
uquake/client.h
|
@ -1,430 +0,0 @@
|
|||
/*
|
||||
client.h
|
||||
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 _CLIENT_H
|
||||
#define _CLIENT_H
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef HAS_ZLIB
|
||||
#include <zlib.h>
|
||||
#else
|
||||
#include <nozip.h>
|
||||
#endif
|
||||
|
||||
#include <qtypes.h>
|
||||
#include <common.h>
|
||||
#include <quakefs.h>
|
||||
#include <vid.h>
|
||||
#include <net.h>
|
||||
#include <bspfile.h>
|
||||
#include <model.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vec3_t viewangles;
|
||||
|
||||
// intended velocities
|
||||
float forwardmove;
|
||||
float sidemove;
|
||||
float upmove;
|
||||
#ifdef QUAKE2
|
||||
byte lightlevel;
|
||||
#endif
|
||||
} usercmd_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int length;
|
||||
char map[MAX_STYLESTRING];
|
||||
} lightstyle_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[MAX_SCOREBOARDNAME];
|
||||
float entertime;
|
||||
int frags;
|
||||
int colors; // two 4 bit fields
|
||||
byte translations[VID_GRADES*256];
|
||||
} scoreboard_t;
|
||||
|
||||
#define CSHIFT_CONTENTS 0
|
||||
#define CSHIFT_DAMAGE 1
|
||||
#define CSHIFT_BONUS 2
|
||||
#define CSHIFT_POWERUP 3
|
||||
#define NUM_CSHIFTS 4
|
||||
|
||||
#define NAME_LENGTH 64
|
||||
|
||||
|
||||
//
|
||||
// client_state_t should hold all pieces of the client state
|
||||
//
|
||||
|
||||
#define SIGNONS 4 // signon messages to receive before connected
|
||||
|
||||
#define MAX_DLIGHTS 32
|
||||
typedef struct
|
||||
{
|
||||
vec3_t origin;
|
||||
float radius;
|
||||
float die; // stop lighting after this time
|
||||
float decay; // drop this each second
|
||||
float minlight; // don't add when contributing less
|
||||
int key;
|
||||
#ifdef QUAKE2
|
||||
qboolean dark; // subtracts light instead of adding
|
||||
#endif
|
||||
} dlight_t;
|
||||
|
||||
|
||||
#define MAX_BEAMS 24
|
||||
typedef struct
|
||||
{
|
||||
int entity;
|
||||
struct model_s *model;
|
||||
float endtime;
|
||||
vec3_t start, end;
|
||||
} beam_t;
|
||||
|
||||
#define MAX_EFRAGS 640
|
||||
|
||||
#define MAX_MAPSTRING 2048
|
||||
#define MAX_DEMOS 8
|
||||
#define MAX_DEMONAME 16
|
||||
|
||||
typedef enum {
|
||||
ca_dedicated, // a dedicated server with no ability to start a client
|
||||
ca_disconnected, // full screen console with no connection
|
||||
ca_connected, // valid netcon, talking to a server
|
||||
ca_onserver, // processing data lists, etc
|
||||
ca_active // everything is in, so frames can be rendered
|
||||
} cactive_t;
|
||||
|
||||
//
|
||||
// the client_static_t structure is persistant through an arbitrary number
|
||||
// of server connections
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
cactive_t state;
|
||||
|
||||
netchan_t netchan;
|
||||
|
||||
#ifdef QUAKEWORLD
|
||||
char userinfo[MAX_INFO_STRING];
|
||||
char servername[MAX_OSPATH];
|
||||
|
||||
// download stuff
|
||||
int qport;
|
||||
FILE *download;
|
||||
char downloadtempname[MAX_OSPATH];
|
||||
char downloadname[MAX_OSPATH];
|
||||
int downloadnumber;
|
||||
dltyle_t downloadtype;
|
||||
int downloadpercent;
|
||||
|
||||
int challenge;
|
||||
float latency;
|
||||
#endif
|
||||
|
||||
#ifdef UQUAKE
|
||||
// personalization data sent to server
|
||||
char mapstring[MAX_QPATH];
|
||||
char spawnparms[MAX_MAPSTRING]; // to restart a level
|
||||
|
||||
// connection information
|
||||
int signon; // 0 to SIGNONS
|
||||
struct qsocket_s *netcon;
|
||||
// sizebuf_t message; // net msg write buffer
|
||||
#endif
|
||||
|
||||
// demos - this stuff can't go into client_state_t
|
||||
int demonum; // -1 == don't play
|
||||
char demos[MAX_DEMOS][MAX_DEMONAME]; // when not playing
|
||||
qboolean demorecording;
|
||||
qboolean demoplayback;
|
||||
qboolean timedemo;
|
||||
int forcetrack; // -1 == normal cd track
|
||||
gzFile *demofile;
|
||||
int td_lastframe; // for msg timing
|
||||
int td_startframe; // inits to host_framecount
|
||||
float td_starttime; // of 2nd frame of timedemo
|
||||
} client_static_t;
|
||||
|
||||
extern client_static_t cls;
|
||||
|
||||
//
|
||||
// the client_state_t structure is wiped completely at every
|
||||
// server signon
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
int movemessages; // since connecting to this server
|
||||
// throw out the first couple, so the player
|
||||
// doesn't accidentally do something the
|
||||
// first frame
|
||||
|
||||
// information for local display
|
||||
int stats[MAX_CL_STATS]; // health, etc
|
||||
float item_gettime[32]; //cl.time of aquiring item, for blinking
|
||||
float faceanimtime; // use anim frame if cl.time < this
|
||||
|
||||
cshift_t cshifts[NUM_CSHIFTS]; // color shifts for damage, powerups
|
||||
cshift_t prev_cshifts[NUM_CSHIFTS]; // and content types
|
||||
|
||||
// the client maintains its own idea of view angles, which are
|
||||
// sent to the server each frame. And only reset at level change
|
||||
// and teleport times
|
||||
vec3_t viewangles;
|
||||
|
||||
// the client simulates or interpolates movement to get these values
|
||||
double time; // this is the time value that the client
|
||||
// is rendering at. allways <= realtime
|
||||
|
||||
// pitch drifting vars
|
||||
float pitchvel;
|
||||
qboolean nodrift;
|
||||
float driftmove;
|
||||
double laststop;
|
||||
|
||||
|
||||
qboolean paused; // send over by server
|
||||
|
||||
int completed_time; // latched at intermission start
|
||||
float punchangle; // temporar yview kick from weapon firing
|
||||
int intermission; // don't change view angle, full screen, etc
|
||||
|
||||
//
|
||||
// information that is static for the entire time connected to a server
|
||||
//
|
||||
struct model_s *model_precache[MAX_MODELS];
|
||||
struct sfx_s *sound_precache[MAX_SOUNDS];
|
||||
|
||||
char levelname[40]; // for display on solo scoreboard
|
||||
|
||||
// refresh related state
|
||||
struct model_s *worldmodel; // cl_entitites[0].model
|
||||
struct efrag_s *free_efrags;
|
||||
int num_statics; // held in cl_staticentities array
|
||||
|
||||
int cdtrack; // cd audio
|
||||
|
||||
entity_t viewent; // weapon model
|
||||
int playernum;
|
||||
int gametype;
|
||||
int maxclients;
|
||||
|
||||
#ifdef QUAKEWORLD
|
||||
// QW specific!
|
||||
// all player information
|
||||
player_info_t players[MAX_CLIENTS];
|
||||
int servercount; // server identification for prespawns
|
||||
|
||||
char serverinfo[MAX_SERVERINFO_STRING];
|
||||
|
||||
int parsecount; // server message counter
|
||||
int validsequence; // this is the sequence number of the last good
|
||||
// packetentity_t we got. If this is 0, we can't
|
||||
// render a frame yet
|
||||
int spectator;
|
||||
|
||||
double last_ping_request; // while showing scoreboard
|
||||
|
||||
frame_t frames[UPDATE_BACKUP];
|
||||
|
||||
vec3_t simorg;
|
||||
vec3_t simvel;
|
||||
vec3_t simangles;
|
||||
//
|
||||
// information that is static for the entire time connected to a server
|
||||
//
|
||||
char model_name[MAX_MODELS][MAX_QPATH];
|
||||
char sound_name[MAX_SOUNDS][MAX_QPATH];
|
||||
#elif defined(UQUAKE)
|
||||
// UQ specific.
|
||||
int num_entities; // held in cl_entities array
|
||||
float last_received_message; // (realtime) for net trouble icon
|
||||
double mtime[2]; // the timestamp of last two messages
|
||||
double oldtime; // previous cl.time, time-oldtime is used
|
||||
// to decay light values and smooth step ups
|
||||
|
||||
qboolean onground;
|
||||
qboolean inwater;
|
||||
float viewheight;
|
||||
float idealpitch;
|
||||
// frag scoreboard
|
||||
scoreboard_t *scores; // [cl.maxclients]
|
||||
|
||||
usercmd_t cmd; // last command sent to the server
|
||||
int items; // inventory bit flags
|
||||
vec3_t mviewangles[2]; // during demo playback viewangles is lerped
|
||||
// between these
|
||||
vec3_t mvelocity[2]; // update by server, used for lean+bob
|
||||
// (0 is newest)
|
||||
vec3_t velocity; // lerped between mvelocity[0] and [1]
|
||||
#endif
|
||||
} client_state_t;
|
||||
|
||||
extern client_state_t cl;
|
||||
|
||||
//
|
||||
// cvars
|
||||
//
|
||||
extern cvar_t cl_name;
|
||||
extern cvar_t cl_color;
|
||||
|
||||
extern cvar_t cl_upspeed;
|
||||
extern cvar_t cl_forwardspeed;
|
||||
extern cvar_t cl_backspeed;
|
||||
extern cvar_t cl_sidespeed;
|
||||
|
||||
extern cvar_t cl_movespeedkey;
|
||||
|
||||
extern cvar_t cl_yawspeed;
|
||||
extern cvar_t cl_pitchspeed;
|
||||
|
||||
extern cvar_t cl_anglespeedkey;
|
||||
|
||||
extern cvar_t cl_autofire;
|
||||
|
||||
extern cvar_t cl_shownet;
|
||||
extern cvar_t cl_nolerp;
|
||||
|
||||
extern cvar_t cl_sbar;
|
||||
extern cvar_t cl_hudswap;
|
||||
|
||||
extern cvar_t cl_pitchdriftspeed;
|
||||
extern cvar_t lookspring;
|
||||
extern cvar_t lookstrafe;
|
||||
extern cvar_t sensitivity;
|
||||
|
||||
extern cvar_t m_pitch;
|
||||
extern cvar_t m_yaw;
|
||||
extern cvar_t m_forward;
|
||||
extern cvar_t m_side;
|
||||
|
||||
extern cvar_t _windowed_mouse;
|
||||
|
||||
#define MAX_TEMP_ENTITIES 64 // lightning bolts, etc
|
||||
#define MAX_STATIC_ENTITIES 128 // torches, etc
|
||||
|
||||
// FIXME, allocate dynamically
|
||||
extern efrag_t cl_efrags[MAX_EFRAGS];
|
||||
extern entity_t cl_entities[MAX_EDICTS];
|
||||
extern entity_t cl_static_entities[MAX_STATIC_ENTITIES];
|
||||
extern lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
|
||||
extern dlight_t cl_dlights[MAX_DLIGHTS];
|
||||
extern entity_t cl_temp_entities[MAX_TEMP_ENTITIES];
|
||||
extern beam_t cl_beams[MAX_BEAMS];
|
||||
|
||||
//=============================================================================
|
||||
|
||||
//
|
||||
// cl_main
|
||||
//
|
||||
dlight_t *CL_AllocDlight (int key);
|
||||
void CL_DecayLights (void);
|
||||
|
||||
void CL_Init (void);
|
||||
|
||||
void CL_EstablishConnection (char *host);
|
||||
void CL_Signon1 (void);
|
||||
void CL_Signon2 (void);
|
||||
void CL_Signon3 (void);
|
||||
void CL_Signon4 (void);
|
||||
|
||||
void CL_Disconnect (void);
|
||||
void CL_Disconnect_f (void);
|
||||
void CL_NextDemo (void);
|
||||
|
||||
#define MAX_VISEDICTS 256
|
||||
extern int cl_numvisedicts;
|
||||
extern entity_t *cl_visedicts[MAX_VISEDICTS];
|
||||
|
||||
//
|
||||
// cl_input
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
int down[2]; // key nums holding it down
|
||||
int state; // low bit is down state
|
||||
} kbutton_t;
|
||||
|
||||
extern kbutton_t in_mlook, in_klook;
|
||||
extern kbutton_t in_strafe;
|
||||
extern kbutton_t in_speed;
|
||||
|
||||
void CL_InitInput (void);
|
||||
void CL_SendCmd (void);
|
||||
void CL_SendMove (usercmd_t *cmd);
|
||||
|
||||
void CL_ParseTEnt (void);
|
||||
void CL_UpdateTEnts (void);
|
||||
|
||||
void CL_ClearState (void);
|
||||
|
||||
|
||||
int CL_ReadFromServer (void);
|
||||
void CL_WriteToServer (usercmd_t *cmd);
|
||||
void CL_BaseMove (usercmd_t *cmd);
|
||||
|
||||
|
||||
float CL_KeyState (kbutton_t *key);
|
||||
char *Key_KeynumToString (int keynum);
|
||||
|
||||
//
|
||||
// cl_demo.c
|
||||
//
|
||||
void CL_StopPlayback (void);
|
||||
int CL_GetMessage (void);
|
||||
|
||||
void CL_Stop_f (void);
|
||||
void CL_Record_f (void);
|
||||
void CL_PlayDemo_f (void);
|
||||
void CL_TimeDemo_f (void);
|
||||
|
||||
//
|
||||
// cl_parse.c
|
||||
//
|
||||
void CL_ParseServerMessage (void);
|
||||
void CL_NewTranslation (int slot);
|
||||
|
||||
//
|
||||
// view
|
||||
//
|
||||
void V_StartPitchDrift (void);
|
||||
void V_StopPitchDrift (void);
|
||||
|
||||
void V_RenderView (void);
|
||||
void V_UpdatePalette (void);
|
||||
void V_Register (void);
|
||||
void V_ParseDamage (void);
|
||||
void V_SetContentsColor (int contents);
|
||||
void V_CalcBlend (void);
|
||||
|
||||
|
||||
//
|
||||
// cl_tent
|
||||
//
|
||||
void CL_InitTEnts (void);
|
||||
void CL_SignonReply (void);
|
||||
#endif // _CLIENT_H
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
protocol.h - communications protocol (quake1)
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
|
@ -17,7 +18,9 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// protocol.h -- communications protocols
|
||||
|
||||
#ifndef __PROTOCOL_H
|
||||
#define __PROTOCOL_H
|
||||
|
||||
#define PROTOCOL_VERSION 15
|
||||
|
||||
|
@ -165,3 +168,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define TE_IMPLOSION 14
|
||||
#define TE_RAILTRAIL 15
|
||||
#endif
|
||||
|
||||
typedef struct usercmd_s
|
||||
{
|
||||
byte msec;
|
||||
vec3_t angles;
|
||||
#ifdef UQUAKE
|
||||
float forwardmove, sidemove, upmove;
|
||||
#elif QUAKEWORLD
|
||||
short forwardmove, sidemove, upmove;
|
||||
#endif
|
||||
byte buttons;
|
||||
byte impulse;
|
||||
#ifdef QUAKE2
|
||||
byte lightlevel;
|
||||
#endif
|
||||
} usercmd_t;
|
||||
|
||||
#endif // __PROTOCOL_H
|
||||
|
|
Loading…
Reference in a new issue