mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 07:11:41 +00:00
whitespace and headers.
This commit is contained in:
parent
d87b164450
commit
2f5e0cf603
24 changed files with 619 additions and 901 deletions
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/mathlib.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "world.h"
|
||||
|
||||
|
@ -43,11 +44,10 @@ cvar_t *chase_up;
|
|||
cvar_t *chase_right;
|
||||
cvar_t *chase_active;
|
||||
|
||||
vec3_t chase_pos;
|
||||
vec3_t chase_angles;
|
||||
|
||||
vec3_t chase_dest;
|
||||
vec3_t chase_dest_angles;
|
||||
vec3_t chase_pos;
|
||||
|
||||
|
||||
void
|
||||
|
@ -59,7 +59,6 @@ Chase_Init_Cvars (void)
|
|||
chase_active = Cvar_Get ("chase_active", "0", CVAR_NONE, NULL, "None");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Chase_Reset (void)
|
||||
{
|
||||
|
@ -67,7 +66,6 @@ Chase_Reset (void)
|
|||
// start position 12 units behind head
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TraceLine (vec3_t start, vec3_t end, vec3_t impact)
|
||||
{
|
||||
|
@ -79,7 +77,6 @@ TraceLine (vec3_t start, vec3_t end, vec3_t impact)
|
|||
VectorCopy (trace.endpos, impact);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Chase_Update (void)
|
||||
{
|
||||
|
@ -88,7 +85,6 @@ Chase_Update (void)
|
|||
vec3_t forward, up, right;
|
||||
vec3_t dest, stop;
|
||||
|
||||
|
||||
// if can't see player, reset
|
||||
AngleVectors (cl.viewangles, forward, right, up);
|
||||
|
||||
|
|
|
@ -36,12 +36,14 @@
|
|||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "client.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/msg.h"
|
||||
#include "QF/sizebuf.h"
|
||||
|
||||
#include "client.h"
|
||||
|
||||
|
||||
/*
|
||||
Cmd_ForwardToServer
|
||||
|
||||
|
@ -69,18 +71,18 @@ Cmd_ForwardToServer (void)
|
|||
SZ_Print (&cls.message, "\n");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
cl_Cmd_Init (void)
|
||||
{
|
||||
// register our commands
|
||||
Cmd_AddCommand ("cmd", Cmd_ForwardToServer, "Send a command to the server.\n"
|
||||
Cmd_AddCommand ("cmd", Cmd_ForwardToServer, "Send a command to the "
|
||||
"server.\n"
|
||||
"Commands:\n"
|
||||
"download - Same as the command.\n"
|
||||
"kill - Same as the command.\n"
|
||||
"msg (value) - Same as the command.\n"
|
||||
"prespawn (entity) (spot) - Find a spawn spot for the"
|
||||
" player entity.\n"
|
||||
"prespawn (entity) (spot) - Find a spawn spot for the "
|
||||
"player entity.\n"
|
||||
"spawn (entity) - Spawn the player entity.\n"
|
||||
"setinfo - Same as the command.\n"
|
||||
"serverinfo - Same as the command.");
|
||||
|
|
|
@ -38,13 +38,13 @@
|
|||
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/console.h"
|
||||
#include "compat.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/input.h"
|
||||
#include "QF/keys.h"
|
||||
#include "QF/msg.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "compat.h"
|
||||
#include "host.h"
|
||||
|
||||
/*
|
||||
|
@ -64,7 +64,6 @@
|
|||
state bit 2 is edge triggered on the down to up transition
|
||||
*/
|
||||
|
||||
|
||||
kbutton_t in_mlook, in_klook;
|
||||
kbutton_t in_left, in_right, in_forward, in_back;
|
||||
kbutton_t in_lookup, in_lookdown, in_moveleft, in_moveright;
|
||||
|
@ -77,8 +76,8 @@ int in_impulse;
|
|||
void
|
||||
KeyDown (kbutton_t *b)
|
||||
{
|
||||
int k;
|
||||
const char *c;
|
||||
int k;
|
||||
|
||||
c = Cmd_Argv (1);
|
||||
if (c[0])
|
||||
|
@ -107,8 +106,8 @@ KeyDown (kbutton_t *b)
|
|||
void
|
||||
KeyUp (kbutton_t *b)
|
||||
{
|
||||
int k;
|
||||
const char *c;
|
||||
int k;
|
||||
|
||||
c = Cmd_Argv (1);
|
||||
if (c[0])
|
||||
|
@ -138,28 +137,24 @@ KeyUp (kbutton_t *b)
|
|||
b->state |= 4; // impulse up
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_KLookDown (void)
|
||||
{
|
||||
KeyDown (&in_klook);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_KLookUp (void)
|
||||
{
|
||||
KeyUp (&in_klook);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_MLookDown (void)
|
||||
{
|
||||
KeyDown (&in_mlook);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_MLookUp (void)
|
||||
{
|
||||
|
@ -168,49 +163,42 @@ IN_MLookUp (void)
|
|||
V_StartPitchDrift ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_UpDown (void)
|
||||
{
|
||||
KeyDown (&in_up);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_UpUp (void)
|
||||
{
|
||||
KeyUp (&in_up);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_DownDown (void)
|
||||
{
|
||||
KeyDown (&in_down);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_DownUp (void)
|
||||
{
|
||||
KeyUp (&in_down);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_LeftDown (void)
|
||||
{
|
||||
KeyDown (&in_left);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_LeftUp (void)
|
||||
{
|
||||
KeyUp (&in_left);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_RightDown (void)
|
||||
{
|
||||
|
@ -223,168 +211,144 @@ IN_RightUp (void)
|
|||
KeyUp (&in_right);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_ForwardDown (void)
|
||||
{
|
||||
KeyDown (&in_forward);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_ForwardUp (void)
|
||||
{
|
||||
KeyUp (&in_forward);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_BackDown (void)
|
||||
{
|
||||
KeyDown (&in_back);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_BackUp (void)
|
||||
{
|
||||
KeyUp (&in_back);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_LookupDown (void)
|
||||
{
|
||||
KeyDown (&in_lookup);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_LookupUp (void)
|
||||
{
|
||||
KeyUp (&in_lookup);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_LookdownDown (void)
|
||||
{
|
||||
KeyDown (&in_lookdown);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_LookdownUp (void)
|
||||
{
|
||||
KeyUp (&in_lookdown);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_MoveleftDown (void)
|
||||
{
|
||||
KeyDown (&in_moveleft);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_MoveleftUp (void)
|
||||
{
|
||||
KeyUp (&in_moveleft);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_MoverightDown (void)
|
||||
{
|
||||
KeyDown (&in_moveright);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_MoverightUp (void)
|
||||
{
|
||||
KeyUp (&in_moveright);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_SpeedDown (void)
|
||||
{
|
||||
KeyDown (&in_speed);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_SpeedUp (void)
|
||||
{
|
||||
KeyUp (&in_speed);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_StrafeDown (void)
|
||||
{
|
||||
KeyDown (&in_strafe);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_StrafeUp (void)
|
||||
{
|
||||
KeyUp (&in_strafe);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_AttackDown (void)
|
||||
{
|
||||
KeyDown (&in_attack);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_AttackUp (void)
|
||||
{
|
||||
KeyUp (&in_attack);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_UseDown (void)
|
||||
{
|
||||
KeyDown (&in_use);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_UseUp (void)
|
||||
{
|
||||
KeyUp (&in_use);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_JumpDown (void)
|
||||
{
|
||||
KeyDown (&in_jump);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_JumpUp (void)
|
||||
{
|
||||
KeyUp (&in_jump);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_Impulse (void)
|
||||
{
|
||||
in_impulse = atoi (Cmd_Argv (1));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
CL_KeyState
|
||||
|
||||
|
@ -434,9 +398,6 @@ CL_KeyState (kbutton_t *key)
|
|||
return val;
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
|
||||
cvar_t *cl_anglespeedkey;
|
||||
cvar_t *cl_backspeed;
|
||||
cvar_t *cl_forwardspeed;
|
||||
|
@ -446,7 +407,6 @@ cvar_t *cl_sidespeed;
|
|||
cvar_t *cl_upspeed;
|
||||
cvar_t *cl_yawspeed;
|
||||
|
||||
|
||||
/*
|
||||
CL_AdjustAngles
|
||||
|
||||
|
@ -455,8 +415,7 @@ cvar_t *cl_yawspeed;
|
|||
void
|
||||
CL_AdjustAngles (void)
|
||||
{
|
||||
float speed;
|
||||
float up, down;
|
||||
float speed, up, down;
|
||||
|
||||
if (in_speed.state & 1)
|
||||
speed = host_frametime * cl_anglespeedkey->value;
|
||||
|
@ -499,7 +458,6 @@ CL_AdjustAngles (void)
|
|||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
CL_BaseMove
|
||||
|
||||
|
@ -531,8 +489,7 @@ CL_BaseMove (usercmd_t *cmd)
|
|||
cmd->forwardmove -= cl_backspeed->value * CL_KeyState (&in_back);
|
||||
}
|
||||
|
||||
// adjust for speed key
|
||||
//
|
||||
// adjust for speed key
|
||||
if (in_speed.state & 1) {
|
||||
cmd->forwardmove *= cl_movespeedkey->value;
|
||||
cmd->sidemove *= cl_movespeedkey->value;
|
||||
|
@ -563,10 +520,9 @@ CL_BaseMove (usercmd_t *cmd)
|
|||
void
|
||||
CL_SendMove (usercmd_t *cmd)
|
||||
{
|
||||
int i;
|
||||
int bits;
|
||||
sizebuf_t buf;
|
||||
byte data[128];
|
||||
int bits, i;
|
||||
sizebuf_t buf;
|
||||
|
||||
buf.maxsize = 128;
|
||||
buf.cursize = 0;
|
||||
|
@ -574,8 +530,7 @@ CL_SendMove (usercmd_t *cmd)
|
|||
|
||||
cl.cmd = *cmd;
|
||||
|
||||
// send the movement message
|
||||
//
|
||||
// send the movement message
|
||||
MSG_WriteByte (&buf, clc_move);
|
||||
|
||||
MSG_WriteFloat (&buf, cl.mtime[0]); // so server can get ping times
|
||||
|
@ -587,8 +542,7 @@ CL_SendMove (usercmd_t *cmd)
|
|||
MSG_WriteShort (&buf, cmd->sidemove);
|
||||
MSG_WriteShort (&buf, cmd->upmove);
|
||||
|
||||
// send button bits
|
||||
//
|
||||
// send button bits
|
||||
bits = 0;
|
||||
|
||||
if (in_attack.state & 3)
|
||||
|
@ -604,13 +558,12 @@ CL_SendMove (usercmd_t *cmd)
|
|||
MSG_WriteByte (&buf, in_impulse);
|
||||
in_impulse = 0;
|
||||
|
||||
// deliver the message
|
||||
//
|
||||
// deliver the message
|
||||
if (cls.demoplayback)
|
||||
return;
|
||||
|
||||
// always dump the first two message, because it may contain leftover inputs
|
||||
// from the last level
|
||||
// always dump the first two message, because it may contain leftover
|
||||
// inputs from the last level
|
||||
if (++cl.movemessages <= 2)
|
||||
return;
|
||||
|
||||
|
@ -620,7 +573,6 @@ CL_SendMove (usercmd_t *cmd)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_InitInput (void)
|
||||
{
|
||||
|
|
|
@ -97,7 +97,6 @@ CL_Sbar_f (cvar_t *var)
|
|||
r_lineadj = var->int_val ? sb_lines : 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_InitCvars (void)
|
||||
{
|
||||
|
@ -113,8 +112,7 @@ CL_InitCvars (void)
|
|||
"inform when execing a command");
|
||||
cl_name = Cvar_Get ("_cl_name", "player", CVAR_ARCHIVE, NULL,
|
||||
"Player name");
|
||||
cl_color = Cvar_Get ("_cl_color", "0", CVAR_ARCHIVE, NULL,
|
||||
"Player color");
|
||||
cl_color = Cvar_Get ("_cl_color", "0", CVAR_ARCHIVE, NULL, "Player color");
|
||||
cl_anglespeedkey = Cvar_Get ("cl_anglespeedkey", "1.5", CVAR_NONE, NULL,
|
||||
"turn `run' speed multiplier");
|
||||
cl_backspeed = Cvar_Get ("cl_backspeed", "200", CVAR_ARCHIVE, NULL,
|
||||
|
@ -157,7 +155,6 @@ CL_InitCvars (void)
|
|||
"display the current time");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_ClearState (void)
|
||||
{
|
||||
|
@ -192,7 +189,6 @@ CL_ClearState (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
CL_StopCshifts
|
||||
|
||||
|
@ -202,13 +198,13 @@ void
|
|||
CL_StopCshifts (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_CSHIFTS; i++)
|
||||
cl.cshifts[i].percent = 0;
|
||||
for (i = 0; i < MAX_CL_STATS; i++)
|
||||
cl.stats[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
CL_Disconnect
|
||||
|
||||
|
@ -250,7 +246,6 @@ CL_Disconnect (void)
|
|||
cls.signon = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_Disconnect_f (void)
|
||||
{
|
||||
|
@ -259,7 +254,6 @@ CL_Disconnect_f (void)
|
|||
Host_ShutdownServer (false);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
CL_EstablishConnection
|
||||
|
||||
|
@ -289,7 +283,6 @@ CL_EstablishConnection (const char *host)
|
|||
game_target = IMT_DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
CL_SignonReply
|
||||
|
||||
|
@ -332,7 +325,6 @@ CL_SignonReply (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
CL_NextDemo
|
||||
|
||||
|
@ -360,7 +352,6 @@ CL_NextDemo (void)
|
|||
cls.demonum++;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_PrintEntities_f (void)
|
||||
{
|
||||
|
@ -380,7 +371,6 @@ CL_PrintEntities_f (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SetPal
|
||||
|
||||
|
@ -390,9 +380,9 @@ void
|
|||
SetPal (int i)
|
||||
{
|
||||
#if 0
|
||||
static int old;
|
||||
byte pal[768];
|
||||
int c;
|
||||
static int old;
|
||||
|
||||
if (i == old)
|
||||
return;
|
||||
|
@ -418,7 +408,6 @@ SetPal (int i)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_NewDlight (int key, float x, float y, float z, float radius, float time,
|
||||
int type)
|
||||
|
@ -456,7 +445,6 @@ CL_NewDlight (int key, float x, float y, float z, float radius, float time,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
CL_LerpPoint
|
||||
|
||||
|
@ -501,17 +489,15 @@ CL_LerpPoint (void)
|
|||
return frac;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_RelinkEntities (void)
|
||||
{
|
||||
entity_t **_ent;
|
||||
entity_t *ent;
|
||||
int i, j;
|
||||
float frac, f, d;
|
||||
vec3_t delta;
|
||||
float bobjrotate;
|
||||
dlight_t *dl;
|
||||
float bobjrotate, frac, f, d;
|
||||
int i, j;
|
||||
vec3_t delta;
|
||||
|
||||
r_player_entity = &cl_entities[cl.viewentity];
|
||||
|
||||
|
@ -654,7 +640,6 @@ CL_RelinkEntities (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
CL_ReadFromServer
|
||||
|
||||
|
@ -692,7 +677,6 @@ CL_ReadFromServer (void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_SendCmd (void)
|
||||
{
|
||||
|
@ -728,7 +712,6 @@ CL_SendCmd (void)
|
|||
SZ_Clear (&cls.message);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_SetState (cactive_t state)
|
||||
{
|
||||
|
@ -744,14 +727,12 @@ CL_SetState (cactive_t state)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Force_CenterView_f (void)
|
||||
{
|
||||
cl.viewangles[PITCH] = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_Init (void)
|
||||
{
|
||||
|
@ -769,10 +750,8 @@ CL_Init (void)
|
|||
Cmd_AddCommand ("playdemo", CL_PlayDemo_f, "No Description");
|
||||
Cmd_AddCommand ("timedemo", CL_TimeDemo_f, "No Description");
|
||||
Cmd_AddCommand ("maplist", COM_Maplist_f, "No Description");
|
||||
|
||||
Cmd_AddCommand ("force_centerview", Force_CenterView_f, "force the view to "
|
||||
"be level");
|
||||
|
||||
Cmd_AddCommand ("force_centerview", Force_CenterView_f, "force the view "
|
||||
"to be level");
|
||||
|
||||
for (i = 0; i < MAX_STATIC_ENTITIES; i++) {
|
||||
cl_static_entities[i].baseline = &cl_static_entity_baselines[i];
|
||||
|
|
|
@ -119,17 +119,12 @@ CL_EntityNum (int num)
|
|||
return &cl_entities[num];
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_ParseStartSoundPacket (void)
|
||||
{
|
||||
vec3_t pos;
|
||||
int channel, ent;
|
||||
int sound_num;
|
||||
int volume;
|
||||
int field_mask;
|
||||
float attenuation;
|
||||
int i;
|
||||
int channel, ent, field_mask, sound_num, volume, i;
|
||||
vec3_t pos;
|
||||
|
||||
field_mask = MSG_ReadByte (net_message);
|
||||
|
||||
|
@ -159,7 +154,6 @@ CL_ParseStartSoundPacket (void)
|
|||
volume / 255.0, attenuation);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
CL_KeepaliveMessage
|
||||
|
||||
|
@ -169,11 +163,11 @@ CL_ParseStartSoundPacket (void)
|
|||
void
|
||||
CL_KeepaliveMessage (void)
|
||||
{
|
||||
byte olddata[8192];
|
||||
float time;
|
||||
static float lastmsg;
|
||||
int ret;
|
||||
sizebuf_t old;
|
||||
byte olddata[8192];
|
||||
|
||||
if (sv.active)
|
||||
return; // no need if server is local
|
||||
|
@ -182,7 +176,8 @@ CL_KeepaliveMessage (void)
|
|||
|
||||
// read messages from server, should just be nops
|
||||
old = *net_message->message;
|
||||
memcpy (olddata, net_message->message->data, net_message->message->cursize);
|
||||
memcpy (olddata, net_message->message->data,
|
||||
net_message->message->cursize);
|
||||
|
||||
do {
|
||||
ret = CL_GetMessage ();
|
||||
|
@ -202,7 +197,8 @@ CL_KeepaliveMessage (void)
|
|||
} while (ret);
|
||||
|
||||
*net_message->message = old;
|
||||
memcpy (net_message->message->data, olddata, net_message->message->cursize);
|
||||
memcpy (net_message->message->data, olddata,
|
||||
net_message->message->cursize);
|
||||
|
||||
// check time
|
||||
time = Sys_DoubleTime ();
|
||||
|
@ -218,18 +214,15 @@ CL_KeepaliveMessage (void)
|
|||
SZ_Clear (&cls.message);
|
||||
}
|
||||
|
||||
|
||||
struct model_s **snd_worldmodel = &cl.worldmodel;
|
||||
|
||||
|
||||
void
|
||||
CL_ParseServerInfo (void)
|
||||
{
|
||||
char *str;
|
||||
int i;
|
||||
int nummodels, numsounds;
|
||||
char model_precache[MAX_MODELS][MAX_QPATH];
|
||||
char sound_precache[MAX_SOUNDS][MAX_QPATH];
|
||||
char *str;
|
||||
int nummodels, numsounds, i;
|
||||
|
||||
Con_DPrintf ("Serverinfo packet received.\n");
|
||||
|
||||
|
@ -258,12 +251,14 @@ CL_ParseServerInfo (void)
|
|||
strncpy (cl.levelname, str, sizeof (cl.levelname) - 1);
|
||||
|
||||
// seperate the printfs so the server message can have a color
|
||||
Con_Printf ("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
|
||||
Con_Printf ("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36"
|
||||
"\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n"
|
||||
"\n");
|
||||
Con_Printf ("%c%s\n", 2, str);
|
||||
|
||||
// first we go through and touch all of the precache data that still
|
||||
// happens to be in the cache, so precaching something else doesn't
|
||||
// needlessly purge it
|
||||
// first we go through and touch all of the precache data that still
|
||||
// happens to be in the cache, so precaching something else doesn't
|
||||
// needlessly purge it
|
||||
|
||||
// precache models
|
||||
memset (cl.model_precache, 0, sizeof (cl.model_precache));
|
||||
|
@ -321,10 +316,8 @@ CL_ParseServerInfo (void)
|
|||
noclip_anglehack = false; // noclip is turned off at start
|
||||
}
|
||||
|
||||
|
||||
int bitcounts[16];
|
||||
|
||||
|
||||
/*
|
||||
CL_ParseUpdate
|
||||
|
||||
|
@ -335,13 +328,10 @@ int bitcounts[16];
|
|||
void
|
||||
CL_ParseUpdate (int bits)
|
||||
{
|
||||
int i;
|
||||
model_t *model;
|
||||
int modnum;
|
||||
qboolean forcelink;
|
||||
entity_t *ent;
|
||||
int num;
|
||||
int skin;
|
||||
int modnum, num, skin, i;
|
||||
model_t *model;
|
||||
qboolean forcelink;
|
||||
|
||||
if (cls.signon == SIGNONS - 1) {
|
||||
// first update is the final signon stage
|
||||
|
@ -372,7 +362,7 @@ CL_ParseUpdate (int bits)
|
|||
forcelink = false;
|
||||
|
||||
if (forcelink) {
|
||||
//FIXME do this right (ie, protocol support)
|
||||
// FIXME: do this right (ie, protocol support)
|
||||
ent->alpha = 1;
|
||||
ent->scale = 1;
|
||||
ent->glow_color = 254;
|
||||
|
@ -480,7 +470,6 @@ CL_ParseUpdate (int bits)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_ParseBaseline (entity_t *ent)
|
||||
{
|
||||
|
@ -503,7 +492,6 @@ CL_ParseBaseline (entity_t *ent)
|
|||
ent->baseline->colormod = 255;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
CL_ParseClientdata
|
||||
|
||||
|
@ -608,7 +596,6 @@ CL_ParseClientdata (int bits)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_ParseStatic (void)
|
||||
{
|
||||
|
@ -641,13 +628,11 @@ CL_ParseStatic (void)
|
|||
R_AddEfrags (ent);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_ParseStaticSound (void)
|
||||
{
|
||||
int sound_num, vol, atten, i;
|
||||
vec3_t org;
|
||||
int sound_num, vol, atten;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
org[i] = MSG_ReadCoord (net_message);
|
||||
|
@ -658,17 +643,14 @@ CL_ParseStaticSound (void)
|
|||
S_StaticSound (cl.sound_precache[sound_num], org, vol, atten);
|
||||
}
|
||||
|
||||
|
||||
#define SHOWNET(x) if(cl_shownet->int_val==2)Con_Printf ("%3i:%s\n", net_message->readcount-1, x);
|
||||
|
||||
int snd_viewentity;
|
||||
|
||||
|
||||
void
|
||||
CL_ParseServerMessage (void)
|
||||
{
|
||||
int cmd;
|
||||
int i;
|
||||
int cmd, i;
|
||||
|
||||
// if recording demos, copy the message out
|
||||
if (cl_shownet->int_val == 1)
|
||||
|
@ -703,7 +685,8 @@ CL_ParseServerMessage (void)
|
|||
// other commands
|
||||
switch (cmd) {
|
||||
default:
|
||||
Host_Error ("CL_ParseServerMessage: Illegible server message\n");
|
||||
Host_Error ("CL_ParseServerMessage: Illegible server "
|
||||
"message\n");
|
||||
break;
|
||||
|
||||
case svc_nop:
|
||||
|
@ -723,9 +706,8 @@ CL_ParseServerMessage (void)
|
|||
case svc_version:
|
||||
i = MSG_ReadLong (net_message);
|
||||
if (i != PROTOCOL_VERSION)
|
||||
Host_Error
|
||||
("CL_ParseServerMessage: Server is protocol %i instead of %i\n",
|
||||
i, PROTOCOL_VERSION);
|
||||
Host_Error ("CL_ParseServerMessage: Server is protocol %i "
|
||||
"instead of %i\n", i, PROTOCOL_VERSION);
|
||||
break;
|
||||
|
||||
case svc_disconnect:
|
||||
|
@ -783,8 +765,8 @@ CL_ParseServerMessage (void)
|
|||
Sbar_Changed ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i >= cl.maxclients)
|
||||
Host_Error
|
||||
("CL_ParseServerMessage: svc_updatename > MAX_SCOREBOARD");
|
||||
Host_Error ("CL_ParseServerMessage: svc_updatename > "
|
||||
"MAX_SCOREBOARD");
|
||||
strcpy (cl.scores[i].name, MSG_ReadString (net_message));
|
||||
break;
|
||||
|
||||
|
@ -792,8 +774,8 @@ CL_ParseServerMessage (void)
|
|||
Sbar_Changed ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i >= cl.maxclients)
|
||||
Host_Error
|
||||
("CL_ParseServerMessage: svc_updatefrags > MAX_SCOREBOARD");
|
||||
Host_Error ("CL_ParseServerMessage: svc_updatefrags > "
|
||||
"MAX_SCOREBOARD");
|
||||
cl.scores[i].frags = MSG_ReadShort (net_message);
|
||||
break;
|
||||
|
||||
|
@ -801,8 +783,8 @@ CL_ParseServerMessage (void)
|
|||
Sbar_Changed ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i >= cl.maxclients)
|
||||
Host_Error
|
||||
("CL_ParseServerMessage: svc_updatecolors > MAX_SCOREBOARD");
|
||||
Host_Error ("CL_ParseServerMessage: svc_updatecolors > "
|
||||
"MAX_SCOREBOARD");
|
||||
cl.scores[i].colors = MSG_ReadByte (net_message);
|
||||
//XXX CL_NewTranslation (i);
|
||||
break;
|
||||
|
@ -842,7 +824,8 @@ CL_ParseServerMessage (void)
|
|||
case svc_signonnum:
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i <= cls.signon)
|
||||
Host_Error ("Received signon %i when at %i", i, cls.signon);
|
||||
Host_Error ("Received signon %i when at %i", i,
|
||||
cls.signon);
|
||||
cls.signon = i;
|
||||
CL_SignonReply ();
|
||||
break;
|
||||
|
|
|
@ -48,6 +48,9 @@
|
|||
#include "client.h"
|
||||
#include "sbar.h"
|
||||
|
||||
extern void V_PrepBlend (void);
|
||||
|
||||
|
||||
void
|
||||
SCR_DrawNet (int swap)
|
||||
{
|
||||
|
@ -75,8 +78,6 @@ static SCR_Func scr_funcs[] = {
|
|||
0
|
||||
};
|
||||
|
||||
extern void V_PrepBlend (void);
|
||||
|
||||
void
|
||||
CL_UpdateScreen (double realtime)
|
||||
{
|
||||
|
|
|
@ -71,7 +71,6 @@ typedef struct {
|
|||
|
||||
explosion_t cl_explosions[MAX_EXPLOSIONS];
|
||||
|
||||
|
||||
sfx_t *cl_sfx_wizhit;
|
||||
sfx_t *cl_sfx_knighthit;
|
||||
sfx_t *cl_sfx_tink1;
|
||||
|
@ -106,6 +105,7 @@ static const particle_effect_t prot_to_rend[]={
|
|||
PE_UNKNOWN, // TE_BEAM
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
CL_TEnts_Init (void)
|
||||
{
|
||||
|
@ -123,7 +123,6 @@ CL_TEnts_Init (void)
|
|||
cl_spr_explod = Mod_ForName ("progs/s_explod.spr", true);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_Init_Entity (entity_t *ent)
|
||||
{
|
||||
|
@ -138,7 +137,6 @@ CL_Init_Entity (entity_t *ent)
|
|||
ent->pose1 = ent->pose2 = -1;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_ClearTEnts (void)
|
||||
{
|
||||
|
@ -157,13 +155,11 @@ CL_ClearTEnts (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
explosion_t *
|
||||
CL_AllocExplosion (void)
|
||||
{
|
||||
int i;
|
||||
float time;
|
||||
int index;
|
||||
int index, i;
|
||||
|
||||
for (i = 0; i < MAX_EXPLOSIONS; i++)
|
||||
if (!cl_explosions[i].ent.model)
|
||||
|
@ -180,14 +176,12 @@ CL_AllocExplosion (void)
|
|||
return &cl_explosions[index];
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_ParseBeam (model_t *m)
|
||||
{
|
||||
int ent;
|
||||
vec3_t start, end;
|
||||
beam_t *b;
|
||||
int i;
|
||||
int ent, i;
|
||||
vec3_t start, end;
|
||||
|
||||
ent = MSG_ReadShort (net_message);
|
||||
|
||||
|
@ -223,17 +217,15 @@ CL_ParseBeam (model_t *m)
|
|||
Con_Printf ("beam list overflow!\n");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_ParseTEnt (void)
|
||||
{
|
||||
byte type;
|
||||
vec3_t pos;
|
||||
dlight_t *dl;
|
||||
int rnd;
|
||||
int colorStart, colorLength;
|
||||
explosion_t *ex;
|
||||
int colorStart, colorLength, rnd;
|
||||
int cnt = -1;
|
||||
explosion_t *ex;
|
||||
vec3_t pos;
|
||||
|
||||
type = MSG_ReadByte (net_message);
|
||||
//XXX FIXME this is to get around an nq/qw protocol colission
|
||||
|
@ -404,17 +396,14 @@ CL_ParseTEnt (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_UpdateBeams (void)
|
||||
{
|
||||
int i;
|
||||
beam_t *b;
|
||||
vec3_t dist, org;
|
||||
float d;
|
||||
entity_t **ent;
|
||||
float yaw, pitch;
|
||||
float forward;
|
||||
float forward, pitch, yaw, d;
|
||||
int i;
|
||||
vec3_t dist, org;
|
||||
|
||||
// update lightning
|
||||
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++) {
|
||||
|
@ -466,14 +455,12 @@ CL_UpdateBeams (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_UpdateExplosions (void)
|
||||
{
|
||||
int i;
|
||||
int f;
|
||||
explosion_t *ex;
|
||||
entity_t **ent;
|
||||
explosion_t *ex;
|
||||
int f, i;
|
||||
|
||||
for (i = 0, ex = cl_explosions; i < MAX_EXPLOSIONS; i++, ex++) {
|
||||
if (!ex->ent.model)
|
||||
|
@ -492,7 +479,6 @@ CL_UpdateExplosions (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CL_UpdateTEnts (void)
|
||||
{
|
||||
|
@ -500,7 +486,6 @@ CL_UpdateTEnts (void)
|
|||
CL_UpdateExplosions ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
CL_ParseParticleEffect
|
||||
|
||||
|
@ -509,8 +494,8 @@ CL_UpdateTEnts (void)
|
|||
void
|
||||
CL_ParseParticleEffect (void)
|
||||
{
|
||||
vec3_t org, dir;
|
||||
int i, count, msgcount, color;
|
||||
vec3_t org, dir;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
org[i] = MSG_ReadCoord (net_message);
|
||||
|
|
|
@ -87,7 +87,6 @@ float v_dmg_time, v_dmg_roll, v_dmg_pitch;
|
|||
float v_blend[4];
|
||||
|
||||
extern cvar_t *vid_gamma;
|
||||
|
||||
extern int in_forward, in_forward2, in_back;
|
||||
|
||||
cshift_t cshift_empty = { {130, 80, 50}, 0};
|
||||
|
@ -100,23 +99,22 @@ cshift_t cshift_bonus = { {215, 186, 60}, 50};
|
|||
float
|
||||
V_CalcBob (void)
|
||||
{
|
||||
float bob;
|
||||
float cycle;
|
||||
float bob, cycle;
|
||||
|
||||
cycle = cl.time - (int) (cl.time / cl_bobcycle->value) * cl_bobcycle->value;
|
||||
cycle = cl.time - (int) (cl.time / cl_bobcycle->value) *
|
||||
cl_bobcycle->value;
|
||||
cycle /= cl_bobcycle->value;
|
||||
if (cycle < cl_bobup->value)
|
||||
cycle = M_PI * cycle / cl_bobup->value;
|
||||
else
|
||||
cycle =
|
||||
M_PI + M_PI * (cycle - cl_bobup->value) / (1.0 - cl_bobup->value);
|
||||
cycle = M_PI + M_PI * (cycle - cl_bobup->value) / (1.0 -
|
||||
cl_bobup->value);
|
||||
|
||||
// bob is proportional to velocity in the xy plane
|
||||
// (don't count Z, or jumping messes it up)
|
||||
// bob is proportional to velocity in the xy plane
|
||||
// (don't count Z, or jumping messes it up)
|
||||
|
||||
bob =
|
||||
sqrt (cl.velocity[0] * cl.velocity[0] +
|
||||
cl.velocity[1] * cl.velocity[1]) * cl_bob->value;
|
||||
bob = sqrt (cl.velocity[0] * cl.velocity[0] +
|
||||
cl.velocity[1] * cl.velocity[1]) * cl_bob->value;
|
||||
// Con_Printf ("speed: %5.1f\n", Length(cl.velocity));
|
||||
bob = bob * 0.3 + bob * 0.7 * sin (cycle);
|
||||
if (bob > 4)
|
||||
|
@ -124,10 +122,8 @@ V_CalcBob (void)
|
|||
else if (bob < -7)
|
||||
bob = -7;
|
||||
return bob;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
V_StartPitchDrift (void)
|
||||
{
|
||||
|
@ -142,7 +138,6 @@ V_StartPitchDrift (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
V_StopPitchDrift (void)
|
||||
{
|
||||
|
@ -151,7 +146,6 @@ V_StopPitchDrift (void)
|
|||
cl.pitchvel = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
V_DriftPitch
|
||||
|
||||
|
@ -215,22 +209,15 @@ V_DriftPitch (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
PALETTE FLASHES
|
||||
*/
|
||||
|
||||
/* PALETTE FLASHES */
|
||||
|
||||
void
|
||||
V_ParseDamage (void)
|
||||
{
|
||||
int armor, blood;
|
||||
vec3_t from;
|
||||
int i;
|
||||
vec3_t forward, right, up;
|
||||
entity_t *ent;
|
||||
float side;
|
||||
float count;
|
||||
float count, side;
|
||||
int armor, blood, i;
|
||||
vec3_t from, forward, right, up;
|
||||
|
||||
armor = MSG_ReadByte (net_message);
|
||||
blood = MSG_ReadByte (net_message);
|
||||
|
@ -282,7 +269,6 @@ V_ParseDamage (void)
|
|||
v_dmg_time = v_kicktime->value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
V_cshift_f (void)
|
||||
{
|
||||
|
@ -292,7 +278,6 @@ V_cshift_f (void)
|
|||
cshift_empty.percent = atoi (Cmd_Argv (4));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
V_BonusFlash_f
|
||||
|
||||
|
@ -306,7 +291,6 @@ V_BonusFlash_f (void)
|
|||
cl.cshifts[CSHIFT_BONUS] = cshift_bonus;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
V_SetContentsColor
|
||||
|
||||
|
@ -336,7 +320,6 @@ V_SetContentsColor (int contents)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
V_CalcPowerupCshift (void)
|
||||
{
|
||||
|
@ -378,7 +361,6 @@ V_CalcPowerupCshift (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
V_CalcBlend
|
||||
|
||||
|
@ -388,8 +370,8 @@ V_CalcPowerupCshift (void)
|
|||
void
|
||||
V_CalcBlend (void)
|
||||
{
|
||||
float r = 0, g = 0, b = 0, a = 0;
|
||||
float a2, a3;
|
||||
float r = 0, g = 0, b = 0, a = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_CSHIFTS; i++) {
|
||||
|
@ -421,7 +403,6 @@ V_CalcBlend (void)
|
|||
v_blend[3] = bound (0.0, a, 1.0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
V_PrepBlend (void)
|
||||
{
|
||||
|
@ -440,7 +421,8 @@ V_PrepBlend (void)
|
|||
cl.prev_cshifts[i].percent = cl.cshifts[i].percent;
|
||||
}
|
||||
for (j = 0; j < 3; j++) {
|
||||
if (cl.cshifts[i].destcolor[j] != cl.prev_cshifts[i].destcolor[j]) {
|
||||
if (cl.cshifts[i].destcolor[j] != cl.prev_cshifts[i].destcolor[j])
|
||||
{
|
||||
vid.cshift_changed = true;
|
||||
cl.prev_cshifts[i].destcolor[j] = cl.cshifts[i].destcolor[j];
|
||||
}
|
||||
|
@ -463,11 +445,7 @@ V_PrepBlend (void)
|
|||
V_CalcBlend();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
VIEW RENDERING
|
||||
*/
|
||||
|
||||
/* VIEW RENDERING */
|
||||
|
||||
float
|
||||
angledelta (float a)
|
||||
|
@ -478,13 +456,11 @@ angledelta (float a)
|
|||
return a;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CalcGunAngle (void)
|
||||
{
|
||||
float yaw, pitch, move;
|
||||
static float oldyaw = 0;
|
||||
static float oldpitch = 0;
|
||||
float yaw, pitch, move;
|
||||
static float oldpitch = 0, oldyaw = 0;
|
||||
|
||||
yaw = r_refdef.viewangles[YAW];
|
||||
pitch = -r_refdef.viewangles[PITCH];
|
||||
|
@ -528,7 +504,6 @@ CalcGunAngle (void)
|
|||
v_iyaw_level->value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
V_BoundOffsets (void)
|
||||
{
|
||||
|
@ -536,8 +511,8 @@ V_BoundOffsets (void)
|
|||
|
||||
ent = &cl_entities[cl.viewentity];
|
||||
|
||||
// absolutely bound refresh reletive to entity clipping hull
|
||||
// so the view can never be inside a solid wall
|
||||
// absolutely bound refresh reletive to entity clipping hull
|
||||
// so the view can never be inside a solid wall
|
||||
|
||||
if (r_refdef.vieworg[0] < ent->origin[0] - 14)
|
||||
r_refdef.vieworg[0] = ent->origin[0] - 14;
|
||||
|
@ -553,7 +528,6 @@ V_BoundOffsets (void)
|
|||
r_refdef.vieworg[2] = ent->origin[2] + 30;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
V_AddIdle
|
||||
|
||||
|
@ -573,7 +547,6 @@ V_AddIdle (void)
|
|||
v_iyaw_level->value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
V_CalcViewRoll
|
||||
|
||||
|
@ -602,7 +575,6 @@ V_CalcViewRoll (void)
|
|||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
V_CalcIntermissionRefdef (void)
|
||||
{
|
||||
|
@ -626,16 +598,14 @@ V_CalcIntermissionRefdef (void)
|
|||
Cvar_SetValue (v_idlescale, old);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
V_CalcRefdef (void)
|
||||
{
|
||||
entity_t *ent, *view;
|
||||
int i;
|
||||
vec3_t forward, right, up;
|
||||
vec3_t angles;
|
||||
float bob;
|
||||
static float oldz = 0;
|
||||
int i;
|
||||
vec3_t angles, forward, right, up;
|
||||
|
||||
V_DriftPitch ();
|
||||
|
||||
|
@ -644,9 +614,8 @@ V_CalcRefdef (void)
|
|||
// view is the weapon model (only visible from inside body)
|
||||
view = &cl.viewent;
|
||||
|
||||
|
||||
// transform the view offset by the model's matrix to get the offset from
|
||||
// model origin for the view
|
||||
// transform the view offset by the model's matrix to get the offset from
|
||||
// model origin for the view
|
||||
ent->angles[YAW] = cl.viewangles[YAW]; // the model should face
|
||||
// the view dir
|
||||
ent->angles[PITCH] = -cl.viewangles[PITCH]; // the model should face
|
||||
|
@ -659,9 +628,9 @@ V_CalcRefdef (void)
|
|||
VectorCopy (ent->origin, r_refdef.vieworg);
|
||||
r_refdef.vieworg[2] += cl.viewheight + bob;
|
||||
|
||||
// never let it sit exactly on a node line, because a water plane can
|
||||
// dissapear when viewed with the eye exactly on it.
|
||||
// the server protocol only specifies to 1/16 pixel, so add 1/32 in each axis
|
||||
// never let it sit exactly on a node line, because a water plane can
|
||||
// dissapear when viewed with the eye exactly on it.
|
||||
// server protocol only specifies to 1/16 pixel, so add 1/32 in each axis
|
||||
r_refdef.vieworg[0] += 1.0 / 32;
|
||||
r_refdef.vieworg[1] += 1.0 / 32;
|
||||
r_refdef.vieworg[2] += 1.0 / 32;
|
||||
|
@ -696,13 +665,13 @@ V_CalcRefdef (void)
|
|||
|
||||
for (i = 0; i < 3; i++) {
|
||||
view->origin[i] += forward[i] * bob * 0.4;
|
||||
// view->origin[i] += right[i]*bob*0.4;
|
||||
// view->origin[i] += up[i]*bob*0.8;
|
||||
// view->origin[i] += right[i]*bob*0.4;
|
||||
// view->origin[i] += up[i]*bob*0.8;
|
||||
}
|
||||
view->origin[2] += bob;
|
||||
|
||||
// fudge position around to keep amount of weapon visible
|
||||
// roughly equal with different FOV
|
||||
// fudge position around to keep amount of weapon visible
|
||||
// roughly equal with different FOV
|
||||
if (cl_sbar->int_val == 0 && scr_viewsize->int_val >= 100)
|
||||
;
|
||||
else if (scr_viewsize->int_val == 110)
|
||||
|
@ -730,7 +699,7 @@ V_CalcRefdef (void)
|
|||
|
||||
steptime = cl.time - cl.oldtime;
|
||||
if (steptime < 0)
|
||||
//FIXME I_Error ("steptime < 0");
|
||||
//FIXME I_Error ("steptime < 0");
|
||||
steptime = 0;
|
||||
|
||||
oldz += steptime * 80;
|
||||
|
@ -747,7 +716,6 @@ V_CalcRefdef (void)
|
|||
Chase_Update ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
V_RenderView
|
||||
|
||||
|
@ -777,61 +745,68 @@ V_RenderView (void)
|
|||
R_RenderView ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
V_Init (void)
|
||||
{
|
||||
Cmd_AddCommand ("v_cshift", V_cshift_f, "This adjusts all of the colors currently being displayed.\n"
|
||||
"Used when you are underwater, hit, have the Ring of Shadows, or Quad Damage. (v_cshift r g b intensity)");
|
||||
|
||||
Cmd_AddCommand ("bf", V_BonusFlash_f, "Background flash, used when you pick up an item");
|
||||
Cmd_AddCommand ("centerview", V_StartPitchDrift, "Centers the player's view ahead after +lookup or +lookdown \n"
|
||||
"Will not work while mlook is active or freelook is 1.");
|
||||
Cmd_AddCommand ("v_cshift", V_cshift_f, "This adjusts all of the colors "
|
||||
"currently being displayed.\n"
|
||||
"Used when you are underwater, hit, have the Ring of "
|
||||
"Shadows, or Quad Damage. (v_cshift r g b intensity)");
|
||||
Cmd_AddCommand ("bf", V_BonusFlash_f, "Background flash, used when you "
|
||||
"pick up an item");
|
||||
Cmd_AddCommand ("centerview", V_StartPitchDrift, "Centers the player's "
|
||||
"view ahead after +lookup or +lookdown\n"
|
||||
"Will not work while mlook is active or freelook is 1.");
|
||||
}
|
||||
|
||||
void
|
||||
V_Init_Cvars (void)
|
||||
{
|
||||
v_centermove = Cvar_Get ("v_centermove", "0.15", CVAR_NONE, NULL,
|
||||
"How far the player must move forward before the view re-centers");
|
||||
"How far the player must move forward before "
|
||||
"the view re-centers");
|
||||
v_centerspeed = Cvar_Get ("v_centerspeed", "500", CVAR_NONE, NULL,
|
||||
"How quickly you return to a center view after a lookup or lookdown");
|
||||
|
||||
"How quickly you return to a center view after "
|
||||
"a lookup or lookdown");
|
||||
v_iyaw_cycle = Cvar_Get ("v_iyaw_cycle", "2", CVAR_NONE, NULL,
|
||||
"How far you tilt right and left when v_idlescale is enabled");
|
||||
"How far you tilt right and left when "
|
||||
"v_idlescale is enabled");
|
||||
v_iroll_cycle = Cvar_Get ("v_iroll_cycle", "0.5", CVAR_NONE, NULL,
|
||||
"How quickly you tilt right and left when v_idlescale is enabled");
|
||||
"How quickly you tilt right and left when "
|
||||
"v_idlescale is enabled");
|
||||
v_ipitch_cycle = Cvar_Get ("v_ipitch_cycle", "1", CVAR_NONE, NULL,
|
||||
"How quickly you lean forwards and backwards when v_idlescale is enabled");
|
||||
"How quickly you lean forwards and backwards "
|
||||
"when v_idlescale is enabled");
|
||||
v_iyaw_level = Cvar_Get ("v_iyaw_level", "0.3", CVAR_NONE, NULL,
|
||||
"How far you tilt right and left when v_idlescale is enabled");
|
||||
"How far you tilt right and left when "
|
||||
"v_idlescale is enabled");
|
||||
v_iroll_level = Cvar_Get ("v_iroll_level", "0.1", CVAR_NONE, NULL,
|
||||
"How far you tilt right and left when v_idlescale is enabled");
|
||||
"How far you tilt right and left when "
|
||||
"v_idlescale is enabled");
|
||||
v_ipitch_level = Cvar_Get ("v_ipitch_level", "0.3", CVAR_NONE, NULL,
|
||||
"How far you lean forwards and backwards when v_idlescale is enabled");
|
||||
|
||||
"How far you lean forwards and backwards when "
|
||||
"v_idlescale is enabled");
|
||||
v_idlescale = Cvar_Get ("v_idlescale", "0", CVAR_NONE, NULL,
|
||||
"Toggles whether the view remains idle");
|
||||
"Toggles whether the view remains idle");
|
||||
|
||||
scr_ofsx = Cvar_Get ("scr_ofsx", "0", CVAR_NONE, NULL, "None");
|
||||
scr_ofsy = Cvar_Get ("scr_ofsy", "0", CVAR_NONE, NULL, "None");
|
||||
scr_ofsz = Cvar_Get ("scr_ofsz", "0", CVAR_NONE, NULL, "None");
|
||||
cl_rollspeed = Cvar_Get ("cl_rollspeed", "200", CVAR_NONE, NULL,
|
||||
"How quickly you straighten out after strafing");
|
||||
"How quickly you straighten out after strafing");
|
||||
cl_rollangle = Cvar_Get ("cl_rollangle", "2.0", CVAR_NONE, NULL,
|
||||
"How much your screen tilts when strafing");
|
||||
|
||||
"How much your screen tilts when strafing");
|
||||
cl_bob = Cvar_Get ("cl_bob", "0.02", CVAR_NONE, NULL,
|
||||
"How much your weapon moves up and down when walking");
|
||||
"How much your weapon moves up and down when walking");
|
||||
cl_bobcycle = Cvar_Get ("cl_bobcycle", "0.6", CVAR_NONE, NULL,
|
||||
"How quickly your weapon moves up and down when walking");
|
||||
cl_bobup = Cvar_Get ("cl_bobup", "0.5", CVAR_NONE, NULL,
|
||||
"How long your weapon stays up before cycling when walking");
|
||||
|
||||
"How quickly your weapon moves up and down when "
|
||||
"walking");
|
||||
cl_bobup = Cvar_Get ("cl_bobup", "0.5", CVAR_NONE, NULL, "How long your "
|
||||
"weapon stays up before cycling when walking");
|
||||
v_kicktime = Cvar_Get ("v_kicktime", "0.5", CVAR_NONE, NULL,
|
||||
"How long the kick from an attack lasts");
|
||||
"How long the kick from an attack lasts");
|
||||
v_kickroll = Cvar_Get ("v_kickroll", "0.6", CVAR_NONE, NULL,
|
||||
"How much you lean when hit");
|
||||
"How much you lean when hit");
|
||||
v_kickpitch = Cvar_Get ("v_kickpitch", "0.6", CVAR_NONE, NULL,
|
||||
"How much you look up when hit");
|
||||
"How much you look up when hit");
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "QF/cvar.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/vfs.h"
|
||||
|
||||
#include "game.h"
|
||||
|
||||
void Cvar_Info (struct cvar_s *var);
|
||||
|
@ -55,8 +56,8 @@ int static_registered = 1;
|
|||
void
|
||||
COM_CheckRegistered (void)
|
||||
{
|
||||
VFile *h;
|
||||
unsigned short check[128];
|
||||
VFile *h;
|
||||
|
||||
COM_FOpenFile ("gfx/pop.lmp", &h);
|
||||
static_registered = 0;
|
||||
|
@ -73,7 +74,6 @@ COM_CheckRegistered (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
COM_Init (void)
|
||||
{
|
||||
|
|
|
@ -30,12 +30,14 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <windows.h>
|
||||
#include "conproc.h"
|
||||
|
||||
#include "QF/console.h"
|
||||
|
||||
#include "conproc.h"
|
||||
|
||||
HANDLE heventDone;
|
||||
HANDLE hfileBuffer;
|
||||
HANDLE heventChildSend;
|
||||
|
@ -59,7 +61,7 @@ InitConProc (HANDLE hFile, HANDLE heventParent, HANDLE heventChild)
|
|||
{
|
||||
DWORD dwID;
|
||||
|
||||
// ignore if we don't have all the events.
|
||||
// ignore if we don't have all the events.
|
||||
if (!hFile || !heventParent || !heventChild)
|
||||
return;
|
||||
|
||||
|
@ -67,7 +69,7 @@ InitConProc (HANDLE hFile, HANDLE heventParent, HANDLE heventChild)
|
|||
heventParentSend = heventParent;
|
||||
heventChildSend = heventChild;
|
||||
|
||||
// so we'll know when to go away.
|
||||
// so we'll know when to go away.
|
||||
heventDone = CreateEvent (NULL, FALSE, FALSE, NULL);
|
||||
|
||||
if (!heventDone) {
|
||||
|
@ -81,15 +83,14 @@ InitConProc (HANDLE hFile, HANDLE heventParent, HANDLE heventChild)
|
|||
Con_Printf ("Couldn't create QHOST thread\n");
|
||||
return;
|
||||
}
|
||||
// save off the input/output handles.
|
||||
// save off the input/output handles.
|
||||
hStdout = GetStdHandle (STD_OUTPUT_HANDLE);
|
||||
hStdin = GetStdHandle (STD_INPUT_HANDLE);
|
||||
|
||||
// force 80 character width, at least 25 character height
|
||||
// force 80 character width, at least 25 character height
|
||||
SetConsoleCXCY (hStdout, 80, 25);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DeinitConProc (void)
|
||||
{
|
||||
|
@ -97,14 +98,13 @@ DeinitConProc (void)
|
|||
SetEvent (heventDone);
|
||||
}
|
||||
|
||||
|
||||
DWORD
|
||||
RequestProc (DWORD dwNichts)
|
||||
{
|
||||
int iBeginLine, iEndLine;
|
||||
int *pBuffer;
|
||||
DWORD dwRet;
|
||||
HANDLE heventWait[2];
|
||||
int iBeginLine, iEndLine;
|
||||
|
||||
heventWait[0] = heventParentSend;
|
||||
heventWait[1] = heventDone;
|
||||
|
@ -157,7 +157,6 @@ RequestProc (DWORD dwNichts)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LPVOID
|
||||
GetMappedBuffer (HANDLE hfileBuffer)
|
||||
{
|
||||
|
@ -169,14 +168,12 @@ GetMappedBuffer (HANDLE hfileBuffer)
|
|||
return pBuffer;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ReleaseMappedBuffer (LPVOID pBuffer)
|
||||
{
|
||||
UnmapViewOfFile (pBuffer);
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
GetScreenBufferLines (int *piLines)
|
||||
{
|
||||
|
@ -191,7 +188,6 @@ GetScreenBufferLines (int *piLines)
|
|||
return bRet;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
SetScreenBufferLines (int iLines)
|
||||
{
|
||||
|
@ -199,19 +195,17 @@ SetScreenBufferLines (int iLines)
|
|||
return SetConsoleCXCY (hStdout, 80, iLines);
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
ReadText (LPTSTR pszText, int iBeginLine, int iEndLine)
|
||||
{
|
||||
BOOL bRet;
|
||||
COORD coord;
|
||||
DWORD dwRead;
|
||||
BOOL bRet;
|
||||
|
||||
coord.X = 0;
|
||||
coord.Y = iBeginLine;
|
||||
|
||||
bRet = ReadConsoleOutputCharacter (hStdout,
|
||||
pszText,
|
||||
bRet = ReadConsoleOutputCharacter (hStdout, pszText,
|
||||
80 * (iEndLine - iBeginLine + 1),
|
||||
coord, &dwRead);
|
||||
|
||||
|
@ -222,13 +216,12 @@ ReadText (LPTSTR pszText, int iBeginLine, int iEndLine)
|
|||
return bRet;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
WriteText (LPCTSTR szText)
|
||||
{
|
||||
char upper, *sz;
|
||||
DWORD dwWritten;
|
||||
INPUT_RECORD rec;
|
||||
char upper, *sz;
|
||||
|
||||
sz = (LPTSTR) szText;
|
||||
|
||||
|
@ -260,7 +253,6 @@ WriteText (LPCTSTR szText)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
CharToCode (char c)
|
||||
{
|
||||
|
@ -285,7 +277,6 @@ CharToCode (char c)
|
|||
return c;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
SetConsoleCXCY (HANDLE hStdout, int cx, int cy)
|
||||
{
|
||||
|
@ -303,7 +294,7 @@ SetConsoleCXCY (HANDLE hStdout, int cx, int cy)
|
|||
if (!GetConsoleScreenBufferInfo (hStdout, &info))
|
||||
return FALSE;
|
||||
|
||||
// height
|
||||
// height
|
||||
info.srWindow.Left = 0;
|
||||
info.srWindow.Right = info.dwSize.X - 1;
|
||||
info.srWindow.Top = 0;
|
||||
|
@ -330,7 +321,7 @@ SetConsoleCXCY (HANDLE hStdout, int cx, int cy)
|
|||
if (!GetConsoleScreenBufferInfo (hStdout, &info))
|
||||
return FALSE;
|
||||
|
||||
// width
|
||||
// width
|
||||
info.srWindow.Left = 0;
|
||||
info.srWindow.Right = cx - 1;
|
||||
info.srWindow.Top = 0;
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include <stdarg.h>
|
||||
|
||||
#include "QF/cmd.h"
|
||||
#include "compat.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/draw.h"
|
||||
|
@ -51,13 +50,14 @@
|
|||
#include "QF/va.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "compat.h"
|
||||
|
||||
int con_ormask;
|
||||
console_t con_main;
|
||||
console_t con_chat;
|
||||
console_t *con; // point to either con_main or con_chat
|
||||
|
||||
int con_linewidth; // characters across screen
|
||||
int con_ormask;
|
||||
int con_totallines; // total lines in console scrollback
|
||||
|
||||
float con_cursorspeed = 4;
|
||||
|
@ -100,7 +100,6 @@ Con_ToggleConsole_f (void)
|
|||
Con_ClearNotify ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_ToggleChat_f (void)
|
||||
{
|
||||
|
@ -115,7 +114,6 @@ Con_ToggleChat_f (void)
|
|||
Con_ClearNotify ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_Clear_f (void)
|
||||
{
|
||||
|
@ -126,7 +124,6 @@ Con_Clear_f (void)
|
|||
con_main.display = con_main.current;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_ClearNotify (void)
|
||||
{
|
||||
|
@ -136,7 +133,6 @@ Con_ClearNotify (void)
|
|||
con_times[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_MessageMode_f (void)
|
||||
{
|
||||
|
@ -146,7 +142,6 @@ Con_MessageMode_f (void)
|
|||
key_dest = key_message;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_MessageMode2_f (void)
|
||||
{
|
||||
|
@ -156,12 +151,11 @@ Con_MessageMode2_f (void)
|
|||
key_dest = key_message;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_Resize (console_t *con)
|
||||
{
|
||||
int i, j, width, oldwidth, oldtotallines, numlines, numchars;
|
||||
char tbuf[CON_TEXTSIZE];
|
||||
int i, j, width, oldwidth, oldtotallines, numlines, numchars;
|
||||
|
||||
width = (vid.width >> 3) - 2;
|
||||
|
||||
|
@ -206,7 +200,6 @@ Con_Resize (console_t *con)
|
|||
con->display = con->current;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Con_CheckResize
|
||||
|
||||
|
@ -219,7 +212,6 @@ Con_CheckResize (void)
|
|||
Con_Resize (&con_chat);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_Init (const char *plugin_name)
|
||||
{
|
||||
|
@ -244,16 +236,14 @@ Con_Init (const char *plugin_name)
|
|||
con_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_Init_Cvars (void)
|
||||
{
|
||||
con_notifytime =
|
||||
Cvar_Get ("con_notifytime", "3", CVAR_NONE, NULL,
|
||||
"How long in seconds messages are displayed on screen");
|
||||
con_notifytime = Cvar_Get ("con_notifytime", "3", CVAR_NONE, NULL,
|
||||
"How long in seconds messages are displayed "
|
||||
"on screen");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_Linefeed (void)
|
||||
{
|
||||
|
@ -267,7 +257,6 @@ Con_Linefeed (void)
|
|||
' ', con_linewidth);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Con_Print
|
||||
|
||||
|
@ -278,10 +267,8 @@ Con_Linefeed (void)
|
|||
void
|
||||
Con_Print (const char *txt)
|
||||
{
|
||||
int y;
|
||||
int c, l;
|
||||
int mask, c, l, y;
|
||||
static int cr;
|
||||
int mask;
|
||||
|
||||
// echo to debugging console
|
||||
Sys_Printf ("%s", txt);
|
||||
|
@ -316,7 +303,6 @@ Con_Print (const char *txt)
|
|||
cr = false;
|
||||
}
|
||||
|
||||
|
||||
if (!con->x) {
|
||||
Con_Linefeed ();
|
||||
// mark time for transparent overlay
|
||||
|
@ -346,11 +332,7 @@ Con_Print (const char *txt)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
DRAWING
|
||||
*/
|
||||
|
||||
/* DRAWING */
|
||||
|
||||
/*
|
||||
Con_DrawInput
|
||||
|
@ -360,10 +342,9 @@ Con_Print (const char *txt)
|
|||
void
|
||||
Con_DrawInput (void)
|
||||
{
|
||||
int y;
|
||||
int i;
|
||||
char *text;
|
||||
char temp[MAXCMDLINE];
|
||||
char *text;
|
||||
int i, y;
|
||||
|
||||
if (key_dest != key_console && cls.state == ca_active)
|
||||
return; // don't draw anything (always draw if not active)
|
||||
|
@ -389,7 +370,6 @@ Con_DrawInput (void)
|
|||
Draw_Character ((i + 1) << 3, con_vislines - 22, text[i]);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Con_DrawNotify
|
||||
|
||||
|
@ -398,12 +378,9 @@ Con_DrawInput (void)
|
|||
void
|
||||
Con_DrawNotify (void)
|
||||
{
|
||||
int x, v;
|
||||
char *text;
|
||||
int i;
|
||||
char *s, *text;
|
||||
int skip, i, x, v;
|
||||
float time;
|
||||
char *s;
|
||||
int skip;
|
||||
|
||||
v = 0;
|
||||
for (i = con->current - NUM_CON_TIMES + 1; i <= con->current; i++) {
|
||||
|
@ -455,7 +432,6 @@ Con_DrawNotify (void)
|
|||
con_notifylines = v;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Con_DrawConsole
|
||||
|
||||
|
@ -464,10 +440,8 @@ Con_DrawNotify (void)
|
|||
void
|
||||
Con_DrawConsole (int lines)
|
||||
{
|
||||
int i, x, y;
|
||||
int rows;
|
||||
char *text;
|
||||
int row;
|
||||
int row, rows, i, x, y;
|
||||
|
||||
if (lines <= 0)
|
||||
return;
|
||||
|
@ -510,13 +484,12 @@ Con_DrawConsole (int lines)
|
|||
Con_DrawInput ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_DrawDownload (int lines)
|
||||
{
|
||||
int i, j, x, y, n;
|
||||
const char *text;
|
||||
char dlbar[1024];
|
||||
const char *text;
|
||||
int i, j, x, y, n;
|
||||
|
||||
if (!cls.download)
|
||||
return;
|
||||
|
@ -569,11 +542,10 @@ Con_DrawDownload (int lines)
|
|||
void
|
||||
Con_CompleteCommandLine (void)
|
||||
{
|
||||
const char *cmd = "";
|
||||
char *s;
|
||||
int c, v, a, i;
|
||||
int cmd_len;
|
||||
char *s;
|
||||
const char *cmd = "";
|
||||
const char **list[3] = {0, 0, 0};
|
||||
int cmd_len, c, v, a, i;
|
||||
|
||||
s = key_lines[edit_line] + 1;
|
||||
if (*s == '\\' || *s == '/')
|
||||
|
@ -656,4 +628,3 @@ Con_CompleteCommandLine (void)
|
|||
if (list[i])
|
||||
free (list[i]);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,20 +31,21 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/vfs.h"
|
||||
|
||||
#include "game.h"
|
||||
|
||||
qboolean standard_quake = false;
|
||||
qboolean hipnotic, rogue, abyss;
|
||||
|
||||
/*
|
||||
Game_Init
|
||||
*/
|
||||
|
||||
void
|
||||
Game_Init (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
// FIXME: make this dependant on QF metadata in the mission packs
|
||||
standard_quake = true;
|
||||
if ((i = COM_CheckParm ("-hipnotic"))) {
|
||||
|
|
176
nq/source/host.c
176
nq/source/host.c
|
@ -31,7 +31,6 @@
|
|||
#endif
|
||||
|
||||
#include "QF/cdaudio.h"
|
||||
#include "compat.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
|
@ -48,6 +47,7 @@
|
|||
#include "QF/vid.h"
|
||||
|
||||
#include "chase.h"
|
||||
#include "compat.h"
|
||||
#include "host.h"
|
||||
#include "r_local.h"
|
||||
#include "sbar.h"
|
||||
|
@ -61,31 +61,26 @@ extern void Host_Skin_Init (void);
|
|||
extern void Host_Skin_Init_Cvars (void);
|
||||
|
||||
/*
|
||||
A server can always be started, even if the system started out as a client
|
||||
to a remote system.
|
||||
|
||||
A server can always be started, even if the system started out as a client
|
||||
to a remote system.
|
||||
|
||||
A client can NOT be started if the system started as a dedicated server.
|
||||
|
||||
Memory is cleared / released when a server or client begins, not when they end.
|
||||
A client can NOT be started if the system started as a dedicated server.
|
||||
|
||||
Memory is cleared/released when a server or client begins, not when they end.
|
||||
*/
|
||||
|
||||
extern int fps_count;
|
||||
|
||||
qboolean msg_suppress_1 = 0;
|
||||
qboolean host_initialized; // true if into command execution
|
||||
|
||||
quakeparms_t host_parms;
|
||||
|
||||
qboolean host_initialized; // true if into command execution
|
||||
|
||||
double host_frametime;
|
||||
double host_time;
|
||||
double realtime; // without any filtering or bounding
|
||||
double oldrealtime; // last frame run
|
||||
|
||||
int host_framecount;
|
||||
int host_hunklevel;
|
||||
|
||||
int minimum_memory;
|
||||
|
||||
client_t *host_client; // current client
|
||||
|
@ -94,8 +89,6 @@ jmp_buf host_abortserver;
|
|||
|
||||
byte *vid_basepal;
|
||||
|
||||
extern cvar_t *cl_writecfg;
|
||||
|
||||
cvar_t *fs_globalcfg;
|
||||
cvar_t *fs_usercfg;
|
||||
|
||||
|
@ -108,24 +101,26 @@ cvar_t *serverprofile;
|
|||
cvar_t *fraglimit;
|
||||
cvar_t *timelimit;
|
||||
cvar_t *teamplay;
|
||||
|
||||
cvar_t *samelevel;
|
||||
cvar_t *noexit;
|
||||
cvar_t *samelevel;
|
||||
|
||||
cvar_t *skill;
|
||||
cvar_t *deathmatch;
|
||||
cvar_t *coop;
|
||||
cvar_t *deathmatch;
|
||||
|
||||
cvar_t *pausable;
|
||||
|
||||
cvar_t *temp1;
|
||||
|
||||
extern cvar_t *cl_writecfg;
|
||||
extern int fps_count;
|
||||
|
||||
|
||||
void
|
||||
Host_EndGame (const char *message, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char string[1024];
|
||||
va_list argptr;
|
||||
|
||||
va_start (argptr, message);
|
||||
vsnprintf (string, sizeof (string), message, argptr);
|
||||
|
@ -154,9 +149,9 @@ Host_EndGame (const char *message, ...)
|
|||
void
|
||||
Host_Error (const char *error, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char string[1024];
|
||||
static qboolean inerror = false;
|
||||
va_list argptr;
|
||||
|
||||
if (inerror)
|
||||
Sys_Error ("Host_Error: recursively entered");
|
||||
|
@ -183,7 +178,6 @@ Host_Error (const char *error, ...)
|
|||
longjmp (host_abortserver, 1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Host_FindMaxClients (void)
|
||||
{
|
||||
|
@ -227,7 +221,6 @@ Host_FindMaxClients (void)
|
|||
Cvar_SetValue (deathmatch, 0.0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Host_InitLocal (void)
|
||||
{
|
||||
|
@ -243,17 +236,17 @@ Host_InitLocal (void)
|
|||
sys_ticrate = Cvar_Get ("sys_ticrate", "0.05", CVAR_NONE, NULL, "None");
|
||||
serverprofile = Cvar_Get ("serverprofile", "0", CVAR_NONE, NULL, "None");
|
||||
|
||||
fraglimit = Cvar_Get ("fraglimit", "0", CVAR_SERVERINFO, Cvar_Info, "None");
|
||||
timelimit = Cvar_Get ("timelimit", "0", CVAR_SERVERINFO, Cvar_Info, "None");
|
||||
fraglimit = Cvar_Get ("fraglimit", "0", CVAR_SERVERINFO, Cvar_Info,
|
||||
"None");
|
||||
timelimit = Cvar_Get ("timelimit", "0", CVAR_SERVERINFO, Cvar_Info,
|
||||
"None");
|
||||
teamplay = Cvar_Get ("teamplay", "0", CVAR_SERVERINFO, Cvar_Info, "None");
|
||||
samelevel = Cvar_Get ("samelevel", "0", CVAR_NONE, NULL, "None");
|
||||
noexit = Cvar_Get ("noexit", "0", CVAR_SERVERINFO, Cvar_Info, "None");
|
||||
skill = Cvar_Get ("skill", "1", CVAR_NONE, NULL, "0 - 3");
|
||||
deathmatch = Cvar_Get ("deathmatch", "0", CVAR_NONE, NULL, "0, 1, or 2");
|
||||
coop = Cvar_Get ("coop", "0", CVAR_NONE, NULL, "0 or 1");
|
||||
|
||||
pausable = Cvar_Get ("pausable", "1", CVAR_NONE, NULL, "None");
|
||||
|
||||
temp1 = Cvar_Get ("temp1", "0", CVAR_NONE, NULL, "None");
|
||||
|
||||
Host_FindMaxClients ();
|
||||
|
@ -261,7 +254,6 @@ Host_InitLocal (void)
|
|||
host_time = 1.0; // so a think at time 0 won't get called
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Host_WriteConfiguration
|
||||
|
||||
|
@ -272,8 +264,8 @@ Host_WriteConfiguration (void)
|
|||
{
|
||||
VFile *f;
|
||||
|
||||
// dedicated servers initialize the host but don't parse and set the
|
||||
// config.cfg cvars
|
||||
// dedicated servers initialize the host but don't parse and set the
|
||||
// config.cfg cvars
|
||||
if (cl_writecfg->int_val && (host_initialized & !isDedicated)) {
|
||||
char *path = va ("%s/config.cfg", com_gamedir);
|
||||
f = Qopen (path, "w");
|
||||
|
@ -289,7 +281,6 @@ Host_WriteConfiguration (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SV_ClientPrintf
|
||||
|
||||
|
@ -299,8 +290,8 @@ Host_WriteConfiguration (void)
|
|||
void
|
||||
SV_ClientPrintf (const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char string[1024];
|
||||
va_list argptr;
|
||||
|
||||
va_start (argptr, fmt);
|
||||
vsnprintf (string, sizeof (string), fmt, argptr);
|
||||
|
@ -310,7 +301,6 @@ SV_ClientPrintf (const char *fmt, ...)
|
|||
MSG_WriteString (&host_client->message, string);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SV_BroadcastPrintf
|
||||
|
||||
|
@ -319,9 +309,9 @@ SV_ClientPrintf (const char *fmt, ...)
|
|||
void
|
||||
SV_BroadcastPrintf (const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char string[1024];
|
||||
int i;
|
||||
va_list argptr;
|
||||
|
||||
va_start (argptr, fmt);
|
||||
vsnprintf (string, sizeof (string), fmt, argptr);
|
||||
|
@ -334,7 +324,6 @@ SV_BroadcastPrintf (const char *fmt, ...)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Host_ClientCommands
|
||||
|
||||
|
@ -343,8 +332,8 @@ SV_BroadcastPrintf (const char *fmt, ...)
|
|||
void
|
||||
Host_ClientCommands (const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char string[1024];
|
||||
va_list argptr;
|
||||
|
||||
va_start (argptr, fmt);
|
||||
vsnprintf (string, sizeof (string), fmt, argptr);
|
||||
|
@ -354,7 +343,6 @@ Host_ClientCommands (const char *fmt, ...)
|
|||
MSG_WriteString (&host_client->message, string);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SV_DropClient
|
||||
|
||||
|
@ -364,15 +352,15 @@ Host_ClientCommands (const char *fmt, ...)
|
|||
void
|
||||
SV_DropClient (qboolean crash)
|
||||
{
|
||||
int saveSelf;
|
||||
int i;
|
||||
client_t *client;
|
||||
int saveSelf, i;
|
||||
|
||||
if (!crash) {
|
||||
// send any final messages (don't check for errors)
|
||||
if (NET_CanSendMessage (host_client->netconnection)) {
|
||||
MSG_WriteByte (&host_client->message, svc_disconnect);
|
||||
NET_SendMessage (host_client->netconnection, &host_client->message);
|
||||
NET_SendMessage (host_client->netconnection,
|
||||
&host_client->message);
|
||||
}
|
||||
|
||||
if (host_client->edict && host_client->spawned) {
|
||||
|
@ -388,17 +376,17 @@ SV_DropClient (qboolean crash)
|
|||
|
||||
Sys_Printf ("Client %s removed\n", host_client->name);
|
||||
}
|
||||
// break the net connection
|
||||
// break the net connection
|
||||
NET_Close (host_client->netconnection);
|
||||
host_client->netconnection = NULL;
|
||||
|
||||
// free the client (the body stays around)
|
||||
// free the client (the body stays around)
|
||||
host_client->active = false;
|
||||
host_client->name[0] = 0;
|
||||
host_client->old_frags = -999999;
|
||||
net_activeconnections--;
|
||||
|
||||
// send notification to all clients
|
||||
// send notification to all clients
|
||||
for (i = 0, client = svs.clients; i < svs.maxclients; i++, client++) {
|
||||
if (!client->active)
|
||||
continue;
|
||||
|
@ -414,7 +402,6 @@ SV_DropClient (qboolean crash)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Host_ShutdownServer
|
||||
|
||||
|
@ -423,22 +410,21 @@ SV_DropClient (qboolean crash)
|
|||
void
|
||||
Host_ShutdownServer (qboolean crash)
|
||||
{
|
||||
int i;
|
||||
int count;
|
||||
sizebuf_t buf;
|
||||
char message[4];
|
||||
double start;
|
||||
int count, i;
|
||||
sizebuf_t buf;
|
||||
|
||||
if (!sv.active)
|
||||
return;
|
||||
|
||||
sv.active = false;
|
||||
|
||||
// stop all client sounds immediately
|
||||
// stop all client sounds immediately
|
||||
if (cls.state == ca_connected)
|
||||
CL_Disconnect ();
|
||||
|
||||
// flush any pending messages - like the score!!!
|
||||
// flush any pending messages - like the score!!!
|
||||
start = Sys_DoubleTime ();
|
||||
do {
|
||||
count = 0;
|
||||
|
@ -460,7 +446,7 @@ Host_ShutdownServer (qboolean crash)
|
|||
}
|
||||
while (count);
|
||||
|
||||
// make sure all the clients know we're disconnecting
|
||||
// make sure all the clients know we're disconnecting
|
||||
buf.data = message;
|
||||
buf.maxsize = 4;
|
||||
buf.cursize = 0;
|
||||
|
@ -476,14 +462,11 @@ Host_ShutdownServer (qboolean crash)
|
|||
if (host_client->active)
|
||||
SV_DropClient (crash);
|
||||
|
||||
//
|
||||
// clear structures
|
||||
//
|
||||
// clear structures
|
||||
memset (&sv, 0, sizeof (sv));
|
||||
memset (svs.clients, 0, svs.maxclientslimit * sizeof (client_t));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Host_ClearMemory
|
||||
|
||||
|
@ -504,10 +487,6 @@ Host_ClearMemory (void)
|
|||
memset (&cl, 0, sizeof (cl));
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
|
||||
|
||||
/*
|
||||
Host_FilterTime
|
||||
|
||||
|
@ -537,7 +516,6 @@ Host_FilterTime (float time)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Host_GetConsoleCommands
|
||||
|
||||
|
@ -556,20 +534,19 @@ Host_GetConsoleCommands (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef FPS_20
|
||||
|
||||
void
|
||||
_Host_ServerFrame (void)
|
||||
{
|
||||
// run the world state
|
||||
// run the world state
|
||||
*sv_globals.frametime = host_frametime;
|
||||
|
||||
// read client messages
|
||||
// read client messages
|
||||
SV_RunClients ();
|
||||
|
||||
// move things around and think
|
||||
// always pause in single player if in console or menus
|
||||
// move things around and think
|
||||
// always pause in single player if in console or menus
|
||||
if (!sv.paused && (svs.maxclients > 1 || key_dest == key_game))
|
||||
SV_Physics ();
|
||||
}
|
||||
|
@ -577,16 +554,15 @@ _Host_ServerFrame (void)
|
|||
void
|
||||
Host_ServerFrame (void)
|
||||
{
|
||||
float save_host_frametime;
|
||||
float temp_host_frametime;
|
||||
float save_host_frametime, temp_host_frametime;
|
||||
|
||||
// run the world state
|
||||
// run the world state
|
||||
*sv_globals.frametime = host_frametime;
|
||||
|
||||
// set the time and clear the general datagram
|
||||
// set the time and clear the general datagram
|
||||
SV_ClearDatagram ();
|
||||
|
||||
// check for new clients
|
||||
// check for new clients
|
||||
SV_CheckForNewClients ();
|
||||
|
||||
temp_host_frametime = save_host_frametime = host_frametime;
|
||||
|
@ -600,7 +576,7 @@ Host_ServerFrame (void)
|
|||
}
|
||||
host_frametime = save_host_frametime;
|
||||
|
||||
// send all messages to the clients
|
||||
// send all messages to the clients
|
||||
SV_SendClientMessages ();
|
||||
}
|
||||
|
||||
|
@ -609,30 +585,29 @@ Host_ServerFrame (void)
|
|||
void
|
||||
Host_ServerFrame (void)
|
||||
{
|
||||
// run the world state
|
||||
// run the world state
|
||||
*sv_globals.frametime = host_frametime;
|
||||
|
||||
// set the time and clear the general datagram
|
||||
// set the time and clear the general datagram
|
||||
SV_ClearDatagram ();
|
||||
|
||||
// check for new clients
|
||||
// check for new clients
|
||||
SV_CheckForNewClients ();
|
||||
|
||||
// read client messages
|
||||
// read client messages
|
||||
SV_RunClients ();
|
||||
|
||||
// move things around and think
|
||||
// always pause in single player if in console or menus
|
||||
// move things around and think
|
||||
// always pause in single player if in console or menus
|
||||
if (!sv.paused && (svs.maxclients > 1 || key_dest == key_game))
|
||||
SV_Physics ();
|
||||
|
||||
// send all messages to the clients
|
||||
// send all messages to the clients
|
||||
SV_SendClientMessages ();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
Host_Frame
|
||||
|
||||
|
@ -641,22 +616,20 @@ Host_ServerFrame (void)
|
|||
void
|
||||
_Host_Frame (float time)
|
||||
{
|
||||
static double time1 = 0;
|
||||
static double time2 = 0;
|
||||
static double time3 = 0;
|
||||
int pass1, pass2, pass3;
|
||||
static double time1 = 0, time2 = 0, time3 = 0;
|
||||
int pass1, pass2, pass3;
|
||||
|
||||
if (setjmp (host_abortserver))
|
||||
return; // something bad happened, or the
|
||||
// server disconnected
|
||||
|
||||
// keep the random time dependent
|
||||
// keep the random time dependent
|
||||
rand ();
|
||||
|
||||
// decide the simulation time
|
||||
// decide the simulation time
|
||||
if (!Host_FilterTime (time))
|
||||
return; // don't run too fast, or packets
|
||||
// will flood out
|
||||
// will flood out
|
||||
|
||||
if (cls.state != ca_dedicated) {
|
||||
// get new key events
|
||||
|
@ -666,12 +639,12 @@ _Host_Frame (float time)
|
|||
IN_Commands ();
|
||||
}
|
||||
|
||||
// process console commands
|
||||
// process console commands
|
||||
Cbuf_Execute ();
|
||||
|
||||
NET_Poll ();
|
||||
|
||||
// if running the server locally, make intentions now
|
||||
// if running the server locally, make intentions now
|
||||
if (sv.active)
|
||||
CL_SendCmd ();
|
||||
|
||||
|
@ -681,7 +654,7 @@ _Host_Frame (float time)
|
|||
//
|
||||
//-------------------
|
||||
|
||||
// check for commands typed to the host
|
||||
// check for commands typed to the host
|
||||
Host_GetConsoleCommands ();
|
||||
|
||||
if (sv.active)
|
||||
|
@ -693,18 +666,18 @@ _Host_Frame (float time)
|
|||
//
|
||||
//-------------------
|
||||
|
||||
// if running the server remotely, send intentions now after
|
||||
// the incoming messages have been read
|
||||
// if running the server remotely, send intentions now after
|
||||
// the incoming messages have been read
|
||||
if (!sv.active)
|
||||
CL_SendCmd ();
|
||||
|
||||
host_time += host_frametime;
|
||||
|
||||
// fetch results from server
|
||||
// fetch results from server
|
||||
if (cls.state == ca_connected) {
|
||||
CL_ReadFromServer ();
|
||||
}
|
||||
// update video
|
||||
// update video
|
||||
if (host_speeds->int_val)
|
||||
time1 = Sys_DoubleTime ();
|
||||
|
||||
|
@ -722,7 +695,7 @@ _Host_Frame (float time)
|
|||
if (host_speeds->int_val)
|
||||
time2 = Sys_DoubleTime ();
|
||||
|
||||
// update audio
|
||||
// update audio
|
||||
if (cls.signon == SIGNONS) {
|
||||
S_Update (r_origin, vpn, vright, vup);
|
||||
R_DecayLights (host_frametime);
|
||||
|
@ -744,14 +717,13 @@ _Host_Frame (float time)
|
|||
fps_count++;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Host_Frame (float time)
|
||||
{
|
||||
double time1, time2;
|
||||
double time1, time2;
|
||||
static double timetotal;
|
||||
static int timecount;
|
||||
int i, c, m;
|
||||
int i, c, m;
|
||||
static int timecount;
|
||||
|
||||
if (!serverprofile->int_val) {
|
||||
_Host_Frame (time);
|
||||
|
@ -780,20 +752,16 @@ Host_Frame (float time)
|
|||
Con_Printf ("serverprofile: %2i clients %2i msec\n", c, m);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
|
||||
extern VFile *vcrFile;
|
||||
|
||||
#define VCR_SIGNATURE 0x56435231
|
||||
// "VCR1"
|
||||
|
||||
|
||||
void
|
||||
Host_InitVCR (quakeparms_t *parms)
|
||||
{
|
||||
int i, len, n;
|
||||
char *p;
|
||||
int i, len, n;
|
||||
|
||||
if (COM_CheckParm ("-playback")) {
|
||||
if (com_argc != 2)
|
||||
|
@ -850,13 +818,12 @@ Host_InitVCR (quakeparms_t *parms)
|
|||
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
check_quakerc (void)
|
||||
{
|
||||
VFile *f;
|
||||
const char *l, *p;
|
||||
int ret = 1;
|
||||
VFile *f;
|
||||
|
||||
COM_FOpenFile ("quake.rc", &f);
|
||||
if (!f)
|
||||
|
@ -873,11 +840,9 @@ check_quakerc (void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Host_Init (quakeparms_t *parms)
|
||||
{
|
||||
|
||||
if (standard_quake)
|
||||
minimum_memory = MINIMUM_MEMORY;
|
||||
else
|
||||
|
@ -1017,7 +982,6 @@ Host_Init (quakeparms_t *parms)
|
|||
CL_UpdateScreen (cl.time);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Host_Shutdown
|
||||
|
||||
|
@ -1035,7 +999,7 @@ Host_Shutdown (void)
|
|||
}
|
||||
isdown = true;
|
||||
|
||||
// keep Con_Printf from trying to update the screen
|
||||
// keep Con_Printf from trying to update the screen
|
||||
scr_disabled_for_loading = true;
|
||||
|
||||
Host_WriteConfiguration ();
|
||||
|
|
|
@ -40,10 +40,9 @@
|
|||
|
||||
cvar_t *registered;
|
||||
|
||||
qboolean com_modified; // set true if using non-id files
|
||||
|
||||
int static_registered = 1; // only for startup check, then set
|
||||
|
||||
qboolean com_modified; // set true if using non-id files
|
||||
qboolean msg_suppress_1 = 0;
|
||||
|
||||
void COM_Path_f (void);
|
||||
|
@ -60,8 +59,8 @@ void COM_Path_f (void);
|
|||
void
|
||||
COM_CheckRegistered (void)
|
||||
{
|
||||
VFile *h;
|
||||
unsigned short check[128];
|
||||
VFile *h;
|
||||
|
||||
COM_FOpenFile ("gfx/pop.lmp", &h);
|
||||
static_registered = 0;
|
||||
|
@ -78,7 +77,6 @@ COM_CheckRegistered (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
COM_Init (void)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include <stdarg.h>
|
||||
|
||||
#include "QF/cmd.h"
|
||||
#include "compat.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/draw.h"
|
||||
|
@ -51,27 +50,27 @@
|
|||
#include "QF/va.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "compat.h"
|
||||
|
||||
int con_ormask;
|
||||
console_t con_main;
|
||||
console_t con_chat;
|
||||
console_t *con; // point to either con_main or con_chat
|
||||
|
||||
int con_ormask;
|
||||
int con_linewidth; // characters across screen
|
||||
int con_totallines; // total lines in console scrollback
|
||||
|
||||
float con_cursorspeed = 4;
|
||||
int con_notifylines; // scan lines to clear for notify lines
|
||||
int con_vislines;
|
||||
|
||||
cvar_t *con_notifytime; // seconds
|
||||
|
||||
#define NUM_CON_TIMES 4
|
||||
float con_cursorspeed = 4;
|
||||
float con_times[NUM_CON_TIMES]; // realtime time the line was generated
|
||||
// for transparent notify lines
|
||||
|
||||
int con_vislines;
|
||||
int con_notifylines; // scan lines to clear for notify lines
|
||||
|
||||
qboolean con_debuglog;
|
||||
qboolean con_initialized;
|
||||
|
||||
#define MAXCMDLINE 256
|
||||
|
||||
|
@ -79,8 +78,6 @@ extern char key_lines[32][MAXCMDLINE];
|
|||
extern int edit_line;
|
||||
extern int key_linepos;
|
||||
|
||||
qboolean con_initialized;
|
||||
|
||||
|
||||
void
|
||||
Con_ToggleConsole_f (void)
|
||||
|
@ -100,7 +97,6 @@ Con_ToggleConsole_f (void)
|
|||
Con_ClearNotify ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_ToggleChat_f (void)
|
||||
{
|
||||
|
@ -119,7 +115,6 @@ Con_ToggleChat_f (void)
|
|||
Con_ClearNotify ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_Clear_f (void)
|
||||
{
|
||||
|
@ -130,7 +125,6 @@ Con_Clear_f (void)
|
|||
con_main.display = con_main.current;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_ClearNotify (void)
|
||||
{
|
||||
|
@ -140,7 +134,6 @@ Con_ClearNotify (void)
|
|||
con_times[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_MessageMode_f (void)
|
||||
{
|
||||
|
@ -150,7 +143,6 @@ Con_MessageMode_f (void)
|
|||
key_dest = key_message;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_MessageMode2_f (void)
|
||||
{
|
||||
|
@ -160,12 +152,11 @@ Con_MessageMode2_f (void)
|
|||
key_dest = key_message;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_Resize (console_t *con)
|
||||
{
|
||||
int i, j, width, oldwidth, oldtotallines, numlines, numchars;
|
||||
char tbuf[CON_TEXTSIZE];
|
||||
int i, j, width, oldwidth, oldtotallines, numlines, numchars;
|
||||
|
||||
width = (vid.width >> 3) - 2;
|
||||
|
||||
|
@ -210,7 +201,6 @@ Con_Resize (console_t *con)
|
|||
con->display = con->current;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Con_CheckResize
|
||||
|
||||
|
@ -223,7 +213,6 @@ Con_CheckResize (void)
|
|||
Con_Resize (&con_chat);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_Init (const char *plugin_name)
|
||||
{
|
||||
|
@ -248,16 +237,14 @@ Con_Init (const char *plugin_name)
|
|||
con_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_Init_Cvars (void)
|
||||
{
|
||||
con_notifytime =
|
||||
Cvar_Get ("con_notifytime", "3", CVAR_NONE, NULL,
|
||||
"How long in seconds messages are displayed on screen");
|
||||
con_notifytime = Cvar_Get ("con_notifytime", "3", CVAR_NONE, NULL,
|
||||
"How long in seconds messages are displayed on "
|
||||
"screen");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_Linefeed (void)
|
||||
{
|
||||
|
@ -271,7 +258,6 @@ Con_Linefeed (void)
|
|||
' ', con_linewidth);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Con_Print
|
||||
|
||||
|
@ -282,10 +268,8 @@ Con_Linefeed (void)
|
|||
void
|
||||
Con_Print (const char *txt)
|
||||
{
|
||||
int y;
|
||||
int c, l;
|
||||
int mask, c, l, y;
|
||||
static int cr;
|
||||
int mask;
|
||||
|
||||
// echo to debugging console
|
||||
Sys_Printf ("%s", txt);
|
||||
|
@ -350,11 +334,7 @@ Con_Print (const char *txt)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
DRAWING
|
||||
*/
|
||||
|
||||
/* DRAWING */
|
||||
|
||||
/*
|
||||
Con_DrawInput
|
||||
|
@ -364,10 +344,9 @@ Con_Print (const char *txt)
|
|||
void
|
||||
Con_DrawInput (void)
|
||||
{
|
||||
int y;
|
||||
int i;
|
||||
char *text;
|
||||
char temp[MAXCMDLINE];
|
||||
char *text;
|
||||
int i, y;
|
||||
|
||||
if (key_dest != key_console && cls.state == ca_active)
|
||||
return; // don't draw anything (always draw if not active)
|
||||
|
@ -393,7 +372,6 @@ Con_DrawInput (void)
|
|||
Draw_Character ((i + 1) << 3, con_vislines - 22, text[i]);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Con_DrawNotify
|
||||
|
||||
|
@ -402,12 +380,9 @@ Con_DrawInput (void)
|
|||
void
|
||||
Con_DrawNotify (void)
|
||||
{
|
||||
int x, v;
|
||||
char *text;
|
||||
int i;
|
||||
char *s, *text;
|
||||
float time;
|
||||
char *s;
|
||||
int skip;
|
||||
int skip, i, x, v;
|
||||
|
||||
v = 0;
|
||||
for (i = con->current - NUM_CON_TIMES + 1; i <= con->current; i++) {
|
||||
|
@ -459,7 +434,6 @@ Con_DrawNotify (void)
|
|||
con_notifylines = v;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Con_DrawConsole
|
||||
|
||||
|
@ -468,10 +442,8 @@ Con_DrawNotify (void)
|
|||
void
|
||||
Con_DrawConsole (int lines)
|
||||
{
|
||||
int i, x, y;
|
||||
int rows;
|
||||
char *text;
|
||||
int row;
|
||||
int row, rows, i, x, y;
|
||||
|
||||
if (lines <= 0)
|
||||
return;
|
||||
|
@ -514,13 +486,12 @@ Con_DrawConsole (int lines)
|
|||
Con_DrawInput ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Con_DrawDownload (int lines)
|
||||
{
|
||||
int i, j, x, y, n;
|
||||
const char *text;
|
||||
char dlbar[1024];
|
||||
const char *text;
|
||||
int i, j, x, y, n;
|
||||
|
||||
if (!cls.download)
|
||||
return;
|
||||
|
@ -573,10 +544,9 @@ Con_DrawDownload (int lines)
|
|||
void
|
||||
Con_CompleteCommandLine (void)
|
||||
{
|
||||
const char *cmd = "";
|
||||
char *s;
|
||||
int c, v, a, i;
|
||||
int cmd_len;
|
||||
char *s;
|
||||
const char *cmd = "";
|
||||
int cmd_len, c, v, a, i;
|
||||
const char **list[3] = {0, 0, 0};
|
||||
|
||||
s = key_lines[edit_line] + 1;
|
||||
|
@ -660,4 +630,3 @@ Con_CompleteCommandLine (void)
|
|||
if (list[i])
|
||||
free (list[i]);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,21 +38,23 @@
|
|||
#ifdef HAVE_CTYPE_H
|
||||
# include <ctype.h>
|
||||
#endif
|
||||
|
||||
#include <dirent.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "compat.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/vfs.h"
|
||||
#include "QF/zone.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/console.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "crudefile.h"
|
||||
|
||||
int cf_maxsize; // max combined file size (eg quota)
|
||||
int cf_cursize; // current combined file size
|
||||
|
||||
typedef struct cf_file_s {
|
||||
VFile *file;
|
||||
char *path;
|
||||
|
@ -61,15 +63,17 @@ typedef struct cf_file_s {
|
|||
int writtento;
|
||||
char mode; // 'r' for read, 'w' for write
|
||||
} cf_file_t;
|
||||
cf_file_t * cf_filep;
|
||||
int cf_filepcount; // elements in array
|
||||
int cf_openfiles; // used elements
|
||||
cvar_t *crudefile_quota;
|
||||
|
||||
cf_file_t *cf_filep;
|
||||
cvar_t *crudefile_quota;
|
||||
int cf_filepcount; // elements in array
|
||||
int cf_openfiles; // used elements
|
||||
|
||||
#define CF_DIR "cf/"
|
||||
#define CF_MAXFILES 100
|
||||
#define CF_BUFFERSIZE 256
|
||||
|
||||
|
||||
/*
|
||||
CF_ValidDesc
|
||||
|
||||
|
@ -93,12 +97,14 @@ int
|
|||
CF_AlreadyOpen (const char * path, char mode)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < cf_filepcount; i++) {
|
||||
if (!cf_filep[i].file)
|
||||
continue;
|
||||
if (mode == 'r' && cf_filep[i].mode == 'w' && strequal(path, cf_filep[i].path))
|
||||
if (mode == 'r' && cf_filep[i].mode == 'w' &&
|
||||
strequal (path, cf_filep[i].path))
|
||||
return 1;
|
||||
if (mode == 'w' && strequal(path, cf_filep[i].path))
|
||||
if (mode == 'w' && strequal (path, cf_filep[i].path))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -128,12 +134,12 @@ CF_GetFileSize (const char *path)
|
|||
void
|
||||
CF_BuildQuota ()
|
||||
{
|
||||
DIR *dir;
|
||||
char *file, *path;
|
||||
struct dirent *i;
|
||||
char *path;
|
||||
char *file;
|
||||
DIR *dir;
|
||||
|
||||
path = Hunk_TempAlloc (strlen (com_gamedir) + 1 + strlen (CF_DIR) + 256 + 1);
|
||||
path = Hunk_TempAlloc (strlen (com_gamedir) + 1 + strlen (CF_DIR) + 256 +
|
||||
1);
|
||||
if (!path)
|
||||
return;
|
||||
|
||||
|
@ -164,7 +170,9 @@ void
|
|||
CF_Init ()
|
||||
{
|
||||
CF_BuildQuota();
|
||||
crudefile_quota = Cvar_Get ("crudefile_quota", "-1", CVAR_ROM, NULL, "Maximum space available to the Crude File system, -1 to totally disable file writing");
|
||||
crudefile_quota = Cvar_Get ("crudefile_quota", "-1", CVAR_ROM, NULL,
|
||||
"Maximum space available to the Crude File "
|
||||
"system, -1 to totally disable file writing");
|
||||
cf_maxsize = crudefile_quota->int_val;
|
||||
}
|
||||
|
||||
|
@ -177,9 +185,11 @@ void
|
|||
CF_CloseAllFiles ()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < cf_filepcount; i++)
|
||||
if (cf_filep[i].file) {
|
||||
Con_DPrintf ("Warning: closing Crude File %d left over from last map\n", i);
|
||||
Con_DPrintf ("Warning: closing Crude File %d left over from last "
|
||||
"map\n", i);
|
||||
CF_Close(i);
|
||||
}
|
||||
}
|
||||
|
@ -194,12 +204,9 @@ CF_CloseAllFiles ()
|
|||
int
|
||||
CF_Open (const char *path, const char *mode)
|
||||
{
|
||||
char *fullpath;
|
||||
char *fullpath, *j;
|
||||
int desc, oldsize, i;
|
||||
VFile *file;
|
||||
int desc;
|
||||
int i;
|
||||
char *j;
|
||||
int oldsize;
|
||||
|
||||
if (cf_openfiles >= CF_MAXFILES) {
|
||||
return -1;
|
||||
|
@ -222,7 +229,8 @@ CF_Open (const char *path, const char *mode)
|
|||
return -1;
|
||||
}
|
||||
|
||||
fullpath = malloc(strlen(com_gamedir) + 1 + strlen(CF_DIR) + strlen(path) + 1);
|
||||
fullpath = malloc(strlen(com_gamedir) + 1 + strlen(CF_DIR) + strlen(path) +
|
||||
1);
|
||||
if (!fullpath) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -320,7 +328,8 @@ CF_Read (int desc)
|
|||
do {
|
||||
int foo;
|
||||
if (cf_filep[desc].size <= len) {
|
||||
char *t = realloc (cf_filep[desc].buf, cf_filep[desc].size + CF_BUFFERSIZE);
|
||||
char *t = realloc (cf_filep[desc].buf, cf_filep[desc].size +
|
||||
CF_BUFFERSIZE);
|
||||
if (!t) {
|
||||
Sys_Error ("CF_Read: memory allocation error!");
|
||||
}
|
||||
|
@ -350,7 +359,8 @@ CF_Write (int desc, const char *buf) // should be const char *, but Qwrite isn't
|
|||
{
|
||||
int len;
|
||||
|
||||
if (!CF_ValidDesc(desc) || cf_filep[desc].mode != 'w' || cf_cursize >= cf_maxsize) {
|
||||
if (!CF_ValidDesc(desc) || cf_filep[desc].mode != 'w' || cf_cursize >=
|
||||
cf_maxsize) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,17 +44,18 @@
|
|||
#include "QF/info.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/vfs.h"
|
||||
|
||||
#include "game.h"
|
||||
#include "server.h"
|
||||
|
||||
extern qboolean is_server;
|
||||
|
||||
|
||||
/*
|
||||
SV_Gamedir_f
|
||||
|
||||
Sets the gamedir and path to a different directory.
|
||||
*/
|
||||
|
||||
void
|
||||
SV_Gamedir_f (void)
|
||||
{
|
||||
|
@ -86,9 +87,6 @@ SV_Gamedir_f (void)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Game_Init
|
||||
*/
|
||||
void
|
||||
Game_Init (void)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
|
||||
#include <limits.h>
|
||||
|
||||
#include "compat.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/locs.h"
|
||||
#include "QF/qtypes.h"
|
||||
|
@ -46,25 +45,27 @@
|
|||
#include "QF/vfs.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "compat.h"
|
||||
|
||||
#define LOCATION_BLOCK 128 // 128 locations per block.
|
||||
|
||||
location_t **locations = NULL;
|
||||
int locations_alloced = 0;
|
||||
int locations_count = 0;
|
||||
int location_blocks = 0;
|
||||
int locations_alloced = 0;
|
||||
int locations_count = 0;
|
||||
int location_blocks = 0;
|
||||
|
||||
void locs_add (vec3_t location, const char *name);
|
||||
void locs_load (const char *filename);
|
||||
void locs_free (void);
|
||||
void locs_more (void);
|
||||
|
||||
|
||||
int
|
||||
locs_nearest (vec3_t loc)
|
||||
{
|
||||
location_t *cur;
|
||||
float best_distance = 9999999, distance;
|
||||
int i, j = -1;
|
||||
location_t *cur;
|
||||
|
||||
for (i = 0; i < locations_count; i++) {
|
||||
cur = locations[i];
|
||||
|
@ -81,6 +82,7 @@ location_t *
|
|||
locs_find (vec3_t target)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = locs_nearest(target);
|
||||
if (i == -1)
|
||||
return NULL;
|
||||
|
@ -111,13 +113,12 @@ locs_add (vec3_t location, const char *name)
|
|||
void
|
||||
locs_load (const char *filename)
|
||||
{
|
||||
VFile *file;
|
||||
const char *line;
|
||||
char tmp[PATH_MAX], foundname[MAX_OSPATH];
|
||||
char *t1, *t2;
|
||||
vec3_t loc;
|
||||
char tmp[PATH_MAX];
|
||||
char foundname[MAX_OSPATH];
|
||||
const char *line;
|
||||
int templength = 0;
|
||||
vec3_t loc;
|
||||
VFile *file;
|
||||
|
||||
snprintf(tmp,sizeof(tmp), "maps/%s",filename);
|
||||
templength = _COM_FOpenFile (tmp, &file, foundname, 1);
|
||||
|
@ -190,9 +191,9 @@ locs_more (void)
|
|||
void
|
||||
locs_save (const char *filename, qboolean gz)
|
||||
{
|
||||
VFile *locfd;
|
||||
int i;
|
||||
char locfile[MAX_OSPATH];
|
||||
int i;
|
||||
VFile *locfd;
|
||||
|
||||
if (gz) {
|
||||
if (strncmp(filename + strlen(filename) - 3,".gz",3) != 0)
|
||||
|
@ -224,14 +225,15 @@ locs_mark (vec3_t loc, const char *desc)
|
|||
|
||||
/*
|
||||
locs_edit
|
||||
|
||||
call with description to modify location description
|
||||
call with NULL description to modify location vectors
|
||||
*/
|
||||
|
||||
void
|
||||
locs_edit (vec3_t loc, const char *desc)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (locations_count) {
|
||||
i = locs_nearest (loc);
|
||||
if (!desc) {
|
||||
|
@ -252,6 +254,7 @@ void
|
|||
locs_del (vec3_t loc)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (locations_count) {
|
||||
i = locs_nearest (loc);
|
||||
Con_Printf ("Removing location marker for %s\n",
|
||||
|
|
|
@ -37,21 +37,21 @@
|
|||
#endif
|
||||
|
||||
#include "QF/msg.h"
|
||||
#include "net.h"
|
||||
#include "protocol.h"
|
||||
#include "QF/qendian.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "net.h"
|
||||
#include "protocol.h"
|
||||
|
||||
struct usercmd_s nullcmd;
|
||||
|
||||
|
||||
void
|
||||
MSG_WriteDeltaUsercmd (sizebuf_t *buf, usercmd_t *from, usercmd_t *cmd)
|
||||
{
|
||||
int bits;
|
||||
|
||||
//
|
||||
// send the movement message
|
||||
//
|
||||
// send the movement message
|
||||
bits = 0;
|
||||
if (cmd->angles[0] != from->angles[0])
|
||||
bits |= CM_ANGLE1;
|
||||
|
@ -102,7 +102,7 @@ MSG_ReadDeltaUsercmd (usercmd_t *from, usercmd_t *move)
|
|||
|
||||
bits = MSG_ReadByte (net_message);
|
||||
|
||||
// read current angles
|
||||
// read current angles
|
||||
if (bits & CM_ANGLE1)
|
||||
move->angles[0] = MSG_ReadAngle16 (net_message);
|
||||
if (bits & CM_ANGLE2)
|
||||
|
@ -110,7 +110,7 @@ MSG_ReadDeltaUsercmd (usercmd_t *from, usercmd_t *move)
|
|||
if (bits & CM_ANGLE3)
|
||||
move->angles[2] = MSG_ReadAngle16 (net_message);
|
||||
|
||||
// read movement
|
||||
// read movement
|
||||
if (bits & CM_FORWARD)
|
||||
move->forwardmove = MSG_ReadShort (net_message);
|
||||
if (bits & CM_SIDE)
|
||||
|
@ -118,13 +118,13 @@ MSG_ReadDeltaUsercmd (usercmd_t *from, usercmd_t *move)
|
|||
if (bits & CM_UP)
|
||||
move->upmove = MSG_ReadShort (net_message);
|
||||
|
||||
// read buttons
|
||||
// read buttons
|
||||
if (bits & CM_BUTTONS)
|
||||
move->buttons = MSG_ReadByte (net_message);
|
||||
|
||||
if (bits & CM_IMPULSE)
|
||||
move->impulse = MSG_ReadByte (net_message);
|
||||
|
||||
// read time to run command
|
||||
// read time to run command
|
||||
move->msec = MSG_ReadByte (net_message);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,9 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
#ifndef _WIN32
|
||||
# include <unistd.h>
|
||||
# ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
#else
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
@ -41,76 +43,72 @@
|
|||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "client.h"
|
||||
#include "compat.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/msg.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "compat.h"
|
||||
#include "net.h"
|
||||
|
||||
#define PACKET_HEADER 8
|
||||
|
||||
/*
|
||||
packet header
|
||||
-------------
|
||||
31 sequence
|
||||
1 does this message contain a reliable payload
|
||||
31 acknowledge sequence
|
||||
1 acknowledge receipt of even/odd message
|
||||
16 qport
|
||||
|
||||
packet header
|
||||
-------------
|
||||
31 sequence
|
||||
1 does this message contain a reliable payload
|
||||
31 acknowledge sequence
|
||||
1 acknowledge receipt of even/odd message
|
||||
16 qport
|
||||
The remote connection never knows if it missed a reliable message, the
|
||||
local side detects that it has been dropped by seeing a sequence acknowledge
|
||||
higher thatn the last reliable sequence, but without the correct evon/odd
|
||||
bit for the reliable set.
|
||||
|
||||
The remote connection never knows if it missed a reliable message, the
|
||||
local side detects that it has been dropped by seeing a sequence acknowledge
|
||||
higher thatn the last reliable sequence, but without the correct evon/odd
|
||||
bit for the reliable set.
|
||||
If the sender notices that a reliable message has been dropped, it will be
|
||||
retransmitted. It will not be retransmitted again until a message after the
|
||||
retransmit has been acknowledged and the reliable still failed to get there.
|
||||
|
||||
If the sender notices that a reliable message has been dropped, it will be
|
||||
retransmitted. It will not be retransmitted again until a message after
|
||||
the retransmit has been acknowledged and the reliable still failed to get there.
|
||||
if the sequence number is -1, the packet should be handled without a netcon
|
||||
|
||||
if the sequence number is -1, the packet should be handled without a netcon
|
||||
The reliable message can be added to at any time by doing
|
||||
MSG_Write* (&netchan->message, <data>).
|
||||
|
||||
The reliable message can be added to at any time by doing
|
||||
MSG_Write* (&netchan->message, <data>).
|
||||
If the message buffer is overflowed, either by a single message, or by
|
||||
multiple frames worth piling up while the last reliable transmit goes
|
||||
unacknowledged, the netchan signals a fatal error.
|
||||
|
||||
If the message buffer is overflowed, either by a single message, or by
|
||||
multiple frames worth piling up while the last reliable transmit goes
|
||||
unacknowledged, the netchan signals a fatal error.
|
||||
Reliable messages are always placed first in a packet, then the unreliable
|
||||
message is included if there is sufficient room.
|
||||
|
||||
Reliable messages are always placed first in a packet, then the unreliable
|
||||
message is included if there is sufficient room.
|
||||
To the receiver, there is no distinction between the reliable and unreliable
|
||||
parts of the message, they are just processed out as a single larger message.
|
||||
|
||||
To the receiver, there is no distinction between the reliable and unreliable
|
||||
parts of the message, they are just processed out as a single larger message.
|
||||
|
||||
Illogical packet sequence numbers cause the packet to be dropped, but do
|
||||
not kill the connection. This, combined with the tight window of valid
|
||||
reliable acknowledgement numbers provides protection against malicious
|
||||
address spoofing.
|
||||
|
||||
The qport field is a workaround for bad address translating routers that
|
||||
sometimes remap the client's source port on a packet during gameplay.
|
||||
|
||||
If the base part of the net address matches and the qport matches, then the
|
||||
channel matches even if the IP port differs. The IP port should be updated
|
||||
to the new value before sending out any replies.
|
||||
Illogical packet sequence numbers cause the packet to be dropped, but do
|
||||
not kill the connection. This, combined with the tight window of valid
|
||||
reliable acknowledgement numbers provides protection against malicious
|
||||
address spoofing.
|
||||
|
||||
The qport field is a workaround for bad address translating routers that
|
||||
sometimes remap the client's source port on a packet during gameplay.
|
||||
|
||||
If the base part of the net address matches and the qport matches, then the
|
||||
channel matches even if the IP port differs. The IP port should be updated
|
||||
to the new value before sending out any replies.
|
||||
*/
|
||||
|
||||
int net_drop;
|
||||
cvar_t *showpackets;
|
||||
cvar_t *showdrop;
|
||||
cvar_t *qport;
|
||||
|
||||
extern qboolean is_server;
|
||||
|
||||
/*
|
||||
Netchan_Init
|
||||
*/
|
||||
void
|
||||
Netchan_Init (void)
|
||||
{
|
||||
|
@ -130,12 +128,14 @@ void
|
|||
Netchan_Init_Cvars (void)
|
||||
{
|
||||
showpackets = Cvar_Get ("showpackets", "0", CVAR_NONE, NULL,
|
||||
"Show all network packets");
|
||||
showdrop = Cvar_Get ("showdrop", "0", CVAR_NONE, NULL,
|
||||
"Toggle the display of how many packets you are dropping");
|
||||
qport = Cvar_Get ("qport", "0", CVAR_NONE, NULL,
|
||||
"The internal port number for the game networking code."
|
||||
"Useful for clients who use multiple connections through one IP address (NAT/IP-MASQ) because default port is random.");
|
||||
"Show all network packets");
|
||||
showdrop = Cvar_Get ("showdrop", "0", CVAR_NONE, NULL, "Toggle the "
|
||||
"display of how many packets you are dropping");
|
||||
qport = Cvar_Get ("qport", "0", CVAR_NONE, NULL, "The internal port "
|
||||
"number for the game networking code. Useful for "
|
||||
"clients who use multiple connections through one "
|
||||
"IP address (NAT/IP-MASQ) because default port is "
|
||||
"random.");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -146,10 +146,10 @@ Netchan_Init_Cvars (void)
|
|||
void
|
||||
Netchan_OutOfBand (netadr_t adr, int length, byte * data)
|
||||
{
|
||||
sizebuf_t send;
|
||||
byte send_buf[MAX_MSGLEN + PACKET_HEADER];
|
||||
sizebuf_t send;
|
||||
|
||||
// write the packet header
|
||||
// write the packet header
|
||||
send.data = send_buf;
|
||||
send.maxsize = sizeof (send_buf);
|
||||
send.cursize = 0;
|
||||
|
@ -157,7 +157,7 @@ Netchan_OutOfBand (netadr_t adr, int length, byte * data)
|
|||
MSG_WriteLong (&send, -1); // -1 sequence means out of band
|
||||
SZ_Write (&send, data, length);
|
||||
|
||||
// send the datagram
|
||||
// send the datagram
|
||||
// zoid, no input in demo playback mode
|
||||
if (!is_server) {
|
||||
if (!cls.demoplayback)
|
||||
|
@ -175,8 +175,8 @@ Netchan_OutOfBand (netadr_t adr, int length, byte * data)
|
|||
void
|
||||
Netchan_OutOfBandPrint (netadr_t adr, const char *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char string[8192]; // ?? why static?
|
||||
va_list argptr;
|
||||
|
||||
va_start (argptr, format);
|
||||
vsnprintf (string, sizeof (string), format, argptr);
|
||||
|
@ -186,7 +186,6 @@ Netchan_OutOfBandPrint (netadr_t adr, const char *format, ...)
|
|||
Netchan_OutOfBand (adr, strlen (string), (byte *) string);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Netchan_Setup
|
||||
|
||||
|
@ -209,13 +208,13 @@ Netchan_Setup (netchan_t *chan, netadr_t adr, int qport)
|
|||
chan->rate = 1.0 / 2500;
|
||||
}
|
||||
|
||||
#define MAX_BACKUP 200
|
||||
|
||||
/*
|
||||
Netchan_CanPacket
|
||||
|
||||
Returns true if the bandwidth choke isn't active
|
||||
*/
|
||||
#define MAX_BACKUP 200
|
||||
qboolean
|
||||
Netchan_CanPacket (netchan_t *chan)
|
||||
{
|
||||
|
@ -224,7 +223,6 @@ Netchan_CanPacket (netchan_t *chan)
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Netchan_CanReliable
|
||||
|
||||
|
@ -246,32 +244,32 @@ qboolean ServerPaused (void);
|
|||
tries to send an unreliable message to a connection, and handles the
|
||||
transmition / retransmition of the reliable messages.
|
||||
|
||||
A 0 length will still generate a packet and deal with the reliable messages.
|
||||
0 length will still generate a packet and deal with the reliable messages.
|
||||
*/
|
||||
void
|
||||
Netchan_Transmit (netchan_t *chan, int length, byte * data)
|
||||
{
|
||||
sizebuf_t send;
|
||||
byte send_buf[MAX_MSGLEN + PACKET_HEADER];
|
||||
qboolean send_reliable;
|
||||
unsigned int w1, w2;
|
||||
int i;
|
||||
unsigned int w1, w2;
|
||||
qboolean send_reliable;
|
||||
sizebuf_t send;
|
||||
|
||||
// check for message overflow
|
||||
// check for message overflow
|
||||
if (chan->message.overflowed) {
|
||||
chan->fatal_error = true;
|
||||
Con_Printf ("%s:Outgoing message overflow\n",
|
||||
NET_AdrToString (chan->remote_address));
|
||||
return;
|
||||
}
|
||||
// if the remote side dropped the last reliable message, resend it
|
||||
// if the remote side dropped the last reliable message, resend it
|
||||
send_reliable = false;
|
||||
|
||||
if (chan->incoming_acknowledged > chan->last_reliable_sequence
|
||||
&& chan->incoming_reliable_acknowledged != chan->reliable_sequence)
|
||||
send_reliable = true;
|
||||
|
||||
// if the reliable transmit buffer is empty, copy the current message out
|
||||
// if the reliable transmit buffer is empty, copy the current message out
|
||||
if (!chan->reliable_length && chan->message.cursize) {
|
||||
memcpy (chan->reliable_buf, chan->message_buf, chan->message.cursize);
|
||||
chan->reliable_length = chan->message.cursize;
|
||||
|
@ -279,7 +277,7 @@ Netchan_Transmit (netchan_t *chan, int length, byte * data)
|
|||
chan->reliable_sequence ^= 1;
|
||||
send_reliable = true;
|
||||
}
|
||||
// write the packet header
|
||||
// write the packet header
|
||||
send.data = send_buf;
|
||||
send.maxsize = sizeof (send_buf);
|
||||
send.cursize = 0;
|
||||
|
@ -296,16 +294,16 @@ Netchan_Transmit (netchan_t *chan, int length, byte * data)
|
|||
if (!is_server)
|
||||
MSG_WriteShort (&send, cls.qport);
|
||||
|
||||
// copy the reliable message to the packet first
|
||||
// copy the reliable message to the packet first
|
||||
if (send_reliable) {
|
||||
SZ_Write (&send, chan->reliable_buf, chan->reliable_length);
|
||||
chan->last_reliable_sequence = chan->outgoing_sequence;
|
||||
}
|
||||
// add the unreliable part if space is available
|
||||
// add the unreliable part if space is available
|
||||
if (send.maxsize - send.cursize >= length)
|
||||
SZ_Write (&send, data, length);
|
||||
|
||||
// send the datagram
|
||||
// send the datagram
|
||||
i = chan->outgoing_sequence & (MAX_LATENT - 1);
|
||||
chan->outgoing_size[i] = send.cursize;
|
||||
chan->outgoing_time[i] = realtime;
|
||||
|
@ -328,7 +326,6 @@ Netchan_Transmit (netchan_t *chan, int length, byte * data)
|
|||
Con_Printf ("--> s=%i(%i) a=%i(%i) %i\n", chan->outgoing_sequence,
|
||||
send_reliable, chan->incoming_sequence,
|
||||
chan->incoming_reliable_sequence, send.cursize);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -340,9 +337,8 @@ Netchan_Transmit (netchan_t *chan, int length, byte * data)
|
|||
qboolean
|
||||
Netchan_Process (netchan_t *chan)
|
||||
{
|
||||
unsigned int sequence, sequence_ack;
|
||||
unsigned int reliable_ack, reliable_message;
|
||||
int qport;
|
||||
int qport;
|
||||
unsigned int reliable_ack, reliable_message, sequence, sequence_ack;
|
||||
|
||||
if (is_server) {
|
||||
if (!NET_CompareAdr (net_from, chan->remote_address))
|
||||
|
@ -352,7 +348,7 @@ Netchan_Process (netchan_t *chan)
|
|||
!NET_CompareAdr (net_from, chan->remote_address)) return false;
|
||||
}
|
||||
|
||||
// get sequence numbers
|
||||
// get sequence numbers
|
||||
MSG_BeginReading (net_message);
|
||||
sequence = MSG_ReadLong (net_message);
|
||||
sequence_ack = MSG_ReadLong (net_message);
|
||||
|
@ -371,7 +367,7 @@ Netchan_Process (netchan_t *chan)
|
|||
Con_Printf ("<-- s=%i(%i) a=%i(%i) %i\n", sequence, reliable_message,
|
||||
sequence_ack, reliable_ack, net_message->message->cursize);
|
||||
|
||||
// get a rate estimation
|
||||
// get a rate estimation
|
||||
#if 0
|
||||
if (chan->outgoing_sequence - sequence_ack < MAX_LATENT) {
|
||||
int i;
|
||||
|
@ -398,9 +394,7 @@ Netchan_Process (netchan_t *chan)
|
|||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// discard stale or duplicated packets
|
||||
//
|
||||
// discard stale or duplicated packets
|
||||
if (sequence <= (unsigned int) chan->incoming_sequence) {
|
||||
if (showdrop->int_val)
|
||||
Con_Printf ("%s:Out of order packet %i at %i\n",
|
||||
|
@ -408,9 +402,8 @@ Netchan_Process (netchan_t *chan)
|
|||
chan->incoming_sequence);
|
||||
return false;
|
||||
}
|
||||
//
|
||||
// dropped packets don't keep the message from being used
|
||||
//
|
||||
|
||||
// dropped packets don't keep the message from being used
|
||||
net_drop = sequence - (chan->incoming_sequence + 1);
|
||||
if (net_drop > 0) {
|
||||
chan->drop_count += 1;
|
||||
|
@ -421,26 +414,22 @@ Netchan_Process (netchan_t *chan)
|
|||
sequence - (chan->incoming_sequence + 1)
|
||||
, sequence);
|
||||
}
|
||||
//
|
||||
// if the current outgoing reliable message has been acknowledged
|
||||
// clear the buffer to make way for the next
|
||||
//
|
||||
|
||||
// if the current outgoing reliable message has been acknowledged
|
||||
// clear the buffer to make way for the next
|
||||
if (reliable_ack == (unsigned int) chan->reliable_sequence)
|
||||
chan->reliable_length = 0; // it has been received
|
||||
|
||||
//
|
||||
// if this message contains a reliable message, bump incoming_reliable_sequence
|
||||
//
|
||||
// if this message contains a reliable message, bump
|
||||
// incoming_reliable_sequence
|
||||
chan->incoming_sequence = sequence;
|
||||
chan->incoming_acknowledged = sequence_ack;
|
||||
chan->incoming_reliable_acknowledged = reliable_ack;
|
||||
if (reliable_message)
|
||||
chan->incoming_reliable_sequence ^= 1;
|
||||
|
||||
//
|
||||
// the message can now be read from the current message pointer
|
||||
// update statistics counters
|
||||
//
|
||||
// the message can now be read from the current message pointer
|
||||
// update statistics counters
|
||||
chan->frame_latency = chan->frame_latency * OLD_AVG
|
||||
+ (chan->outgoing_sequence - sequence_ack) * (1.0 - OLD_AVG);
|
||||
chan->frame_rate = chan->frame_rate * OLD_AVG
|
||||
|
|
|
@ -31,12 +31,18 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_IO_H
|
||||
# include <io.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
// FIXME: we did support Quake1 protocol too...
|
||||
|
||||
|
@ -44,12 +50,6 @@
|
|||
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/cvar.h"
|
||||
|
@ -68,14 +68,13 @@ cvar_t *net_loglevel;
|
|||
//extern server_t sv;
|
||||
extern qboolean is_server;
|
||||
|
||||
void Analyze_Server_Packet (const byte * data, int len);
|
||||
void Analyze_Client_Packet (const byte * data, int len);
|
||||
|
||||
void Parse_Server_Packet (void);
|
||||
void Parse_Client_Packet (void);
|
||||
|
||||
int Net_LogStart (const char *fname);
|
||||
void Net_LogStop (void);
|
||||
|
||||
void Analyze_Server_Packet (const byte * data, int len);
|
||||
void Analyze_Client_Packet (const byte * data, int len);
|
||||
void Parse_Server_Packet (void);
|
||||
void Parse_Client_Packet (void);
|
||||
void Net_LogStop (void);
|
||||
|
||||
// note: this is SUPPOSED to be duplicate, like many others
|
||||
const char *svc_string[] = {
|
||||
|
@ -93,7 +92,6 @@ const char *svc_string[] = {
|
|||
// should be \n terminated
|
||||
"svc_setangle", // [vec3] set the view angle to this
|
||||
// absolute value
|
||||
|
||||
"svc_serverdata", // [long] version ...
|
||||
"svc_lightstyle", // [byte] [string]
|
||||
"svc_updatename", // [byte] [string]
|
||||
|
@ -104,11 +102,9 @@ const char *svc_string[] = {
|
|||
"svc_particle", // [vec3] <variable>
|
||||
"svc_damage", // [byte] impact [byte] blood [vec3]
|
||||
// from
|
||||
|
||||
"svc_spawnstatic",
|
||||
"svc_spawnbinary",
|
||||
"svc_spawnbaseline",
|
||||
|
||||
"svc_temp_entity", // <variable>
|
||||
"svc_setpause",
|
||||
"svc_signonnum",
|
||||
|
@ -120,13 +116,10 @@ const char *svc_string[] = {
|
|||
"svc_finale", // [string] music [string] text
|
||||
"svc_cdtrack", // [byte] track [byte] looptrack
|
||||
"svc_sellscreen",
|
||||
|
||||
"svc_smallkick", // Quake svc_cutscene
|
||||
"svc_bigkick",
|
||||
|
||||
"svc_updateping",
|
||||
"svc_updateentertime",
|
||||
|
||||
"svc_updatestatlong",
|
||||
"svc_muzzleflash",
|
||||
"svc_updateuserinfo",
|
||||
|
@ -140,7 +133,6 @@ const char *svc_string[] = {
|
|||
"svc_deltapacketentities",
|
||||
"svc_maxspeed",
|
||||
"svc_entgravity",
|
||||
|
||||
"svc_setinfo",
|
||||
"svc_serverinfo",
|
||||
"svc_updatepl",
|
||||
|
@ -171,7 +163,7 @@ const char *clc_string[] = {
|
|||
};
|
||||
|
||||
#ifndef svc_spawnbinary
|
||||
#define svc_spawnbinary 21
|
||||
# define svc_spawnbinary 21
|
||||
#endif
|
||||
|
||||
// Quake1, obsolete for QW
|
||||
|
@ -189,17 +181,17 @@ static const char **Net_sound_precache;
|
|||
static sizebuf_t _packet;
|
||||
static msg_t packet = {0, 0, &_packet};
|
||||
|
||||
|
||||
/*
|
||||
NET_LogPrintf
|
||||
|
||||
Prints packet to logfile, adds time stamp etc.
|
||||
*/
|
||||
|
||||
void
|
||||
Net_LogPrintf (char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char text[2048];
|
||||
va_list argptr;
|
||||
|
||||
va_start (argptr, fmt);
|
||||
vsnprintf (text, sizeof (text), fmt, argptr);
|
||||
|
@ -277,17 +269,15 @@ Log_Incoming_Packet (const char *p, int len)
|
|||
return;
|
||||
|
||||
if (is_server) {
|
||||
Net_LogPrintf
|
||||
("\n<<<<<<<<<<<<<<<<<<<<< client to server %d bytes: <<<<<<<<<<<<<<<<<<<<<<<<\n",
|
||||
len);
|
||||
Net_LogPrintf ("\n<<<<<<<<<<<<<<<<<<<<< client to server %d bytes: "
|
||||
"<<<<<<<<<<<<<<<<<<<<<<<<\n", len);
|
||||
if (net_loglevel->int_val != 3)
|
||||
hex_dump_buf ((unsigned char *) p, len);
|
||||
if (net_loglevel->int_val > 1)
|
||||
Analyze_Client_Packet (p, len);
|
||||
} else {
|
||||
Net_LogPrintf
|
||||
("\n>>>>>>>>>>>>>>>>>>>>> server to client %d bytes: >>>>>>>>>>>>>>>>>>>>>>>>\n",
|
||||
len);
|
||||
Net_LogPrintf ("\n>>>>>>>>>>>>>>>>>>>>> server to client %d bytes: "
|
||||
">>>>>>>>>>>>>>>>>>>>>>>>\n", len);
|
||||
if (net_loglevel->int_val != 3)
|
||||
hex_dump_buf ((unsigned char *) p, len);;
|
||||
if (net_loglevel->int_val > 1)
|
||||
|
@ -303,17 +293,15 @@ Log_Outgoing_Packet (const char *p, int len)
|
|||
return;
|
||||
|
||||
if (is_server) {
|
||||
Net_LogPrintf
|
||||
("\n>>>>>>>>>>>>>>>>>>>>> server to client %d bytes: >>>>>>>>>>>>>>>>>>>>>>>>\n",
|
||||
len);
|
||||
Net_LogPrintf ("\n>>>>>>>>>>>>>>>>>>>>> server to client %d bytes: "
|
||||
">>>>>>>>>>>>>>>>>>>>>>>>\n", len);
|
||||
if (net_loglevel->int_val != 3)
|
||||
hex_dump_buf ((unsigned char *) p, len);;
|
||||
if (net_loglevel->int_val > 1)
|
||||
Analyze_Server_Packet (p, len);
|
||||
} else {
|
||||
Net_LogPrintf
|
||||
("\n<<<<<<<<<<<<<<<<<<<<< client to server %d bytes: <<<<<<<<<<<<<<<<<<<<<<<<\n",
|
||||
len);
|
||||
Net_LogPrintf ("\n<<<<<<<<<<<<<<<<<<<<< client to server %d bytes: "
|
||||
"<<<<<<<<<<<<<<<<<<<<<<<<\n", len);
|
||||
if (net_loglevel->int_val != 3)
|
||||
hex_dump_buf ((unsigned char *) p, len);;
|
||||
if (net_loglevel->int_val > 1)
|
||||
|
@ -325,10 +313,10 @@ Log_Outgoing_Packet (const char *p, int len)
|
|||
void
|
||||
Log_Delta(int bits)
|
||||
{
|
||||
entity_state_t to;
|
||||
int i;
|
||||
entity_state_t to;
|
||||
int i;
|
||||
|
||||
Net_LogPrintf ("\n\t");
|
||||
Net_LogPrintf ("\n\t");
|
||||
|
||||
// set everything to the state we are delta'ing from
|
||||
|
||||
|
@ -426,9 +414,9 @@ Analyze_Server_Packet (const byte * data, int len)
|
|||
void
|
||||
Parse_Server_Packet ()
|
||||
{
|
||||
long seq1, seq2;
|
||||
int c, i, ii, iii, mask1, mask2;
|
||||
char *s;
|
||||
int c, i, ii, iii, mask1, mask2;
|
||||
long seq1, seq2;
|
||||
|
||||
seq1 = MSG_ReadLong (&packet);
|
||||
if (packet.badread)
|
||||
|
@ -455,12 +443,12 @@ Parse_Server_Packet ()
|
|||
c = MSG_ReadByte (&packet);
|
||||
if (c == -1)
|
||||
break;
|
||||
// Net_LogPrintf("\n<%ld,%ld> ",seq1 & 0x7FFFFFFF,seq2 & 0x7FFFFFFF);
|
||||
// Net_LogPrintf("\n<%ld,%ld> ",seq1 & 0x7FFFFFFF,seq2 & 0x7FFFFFFF);
|
||||
Net_LogPrintf ("<%06x> [0x%02x] ", MSG_GetReadCount (&packet), c);
|
||||
|
||||
if (c < 53)
|
||||
Net_LogPrintf ("%s: ", svc_string[c]);
|
||||
// else Net_LogPrintf("(UNK: %d): ",c);
|
||||
// else Net_LogPrintf("(UNK: %d): ",c);
|
||||
|
||||
if (MSG_GetReadCount (&packet) > packet.message->cursize)
|
||||
return;
|
||||
|
@ -476,7 +464,8 @@ Parse_Server_Packet ()
|
|||
break;
|
||||
case svc_updatestat:
|
||||
i = MSG_ReadByte (&packet);
|
||||
Net_LogPrintf (" index: %d value: %d", i, MSG_ReadByte (&packet));
|
||||
Net_LogPrintf (" index: %d value: %d", i, MSG_ReadByte
|
||||
(&packet));
|
||||
break;
|
||||
case svc_version:
|
||||
#ifdef QUAKEWORLD
|
||||
|
@ -552,7 +541,8 @@ Parse_Server_Packet ()
|
|||
#endif
|
||||
break;
|
||||
case svc_updatefrags:
|
||||
Net_LogPrintf ("player: %d frags: %d", MSG_ReadByte (&packet),
|
||||
Net_LogPrintf ("player: %d frags: %d", MSG_ReadByte
|
||||
(&packet),
|
||||
MSG_ReadShort (&packet));
|
||||
break;
|
||||
case svc_clientdata:
|
||||
|
@ -568,7 +558,8 @@ Parse_Server_Packet ()
|
|||
#ifdef QUAKEWORLD
|
||||
Net_LogPrintf ("**QW OBSOLETE**");
|
||||
#else
|
||||
Net_LogPrintf ("%d %d", MSG_ReadByte (&packet), MSG_ReadByte ());
|
||||
Net_LogPrintf ("%d %d", MSG_ReadByte (&packet),
|
||||
MSG_ReadByte ());
|
||||
#endif
|
||||
break;
|
||||
case svc_particle:
|
||||
|
@ -586,19 +577,20 @@ Parse_Server_Packet ()
|
|||
|
||||
case svc_damage:
|
||||
// FIXME: parse damage
|
||||
Net_LogPrintf ("armor: %d health: %d", MSG_ReadByte (&packet),
|
||||
MSG_ReadByte (&packet));
|
||||
Net_LogPrintf ("armor: %d health: %d", MSG_ReadByte
|
||||
(&packet), MSG_ReadByte (&packet));
|
||||
Net_LogPrintf (" from %f,%f,%f", MSG_ReadCoord (&packet),
|
||||
MSG_ReadCoord (&packet), MSG_ReadCoord (&packet));
|
||||
MSG_ReadCoord (&packet), MSG_ReadCoord
|
||||
(&packet));
|
||||
break;
|
||||
case svc_spawnstatic:
|
||||
Net_LogPrintf ("Model: %d", MSG_ReadByte (&packet));
|
||||
Net_LogPrintf (" Frame: %d Color: %d Skin: %",
|
||||
MSG_ReadByte (&packet), MSG_ReadByte (&packet),
|
||||
MSG_ReadByte (&packet));
|
||||
MSG_ReadByte (&packet), MSG_ReadByte
|
||||
(&packet), MSG_ReadByte (&packet));
|
||||
for (i = 0; i < 3; i++)
|
||||
Net_LogPrintf ("%d: %f %f", i + 1, MSG_ReadCoord (&packet),
|
||||
MSG_ReadAngle (&packet));
|
||||
Net_LogPrintf ("%d: %f %f", i + 1, MSG_ReadCoord
|
||||
(&packet), MSG_ReadAngle (&packet));
|
||||
break;
|
||||
case svc_spawnbinary:
|
||||
Net_LogPrintf ("**OBSOLETE**");
|
||||
|
@ -626,25 +618,30 @@ Parse_Server_Packet ()
|
|||
case 10:
|
||||
case 11:
|
||||
case 13:
|
||||
Net_LogPrintf (" origin %f %f %f", MSG_ReadCoord (&packet),
|
||||
MSG_ReadCoord (&packet), MSG_ReadCoord (&packet));
|
||||
Net_LogPrintf (" origin %f %f %f", MSG_ReadCoord
|
||||
(&packet), MSG_ReadCoord (&packet),
|
||||
MSG_ReadCoord (&packet));
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
case 9:
|
||||
Net_LogPrintf (" created by %d", MSG_ReadShort (&packet));
|
||||
Net_LogPrintf (" origin: %f,%f,%f",
|
||||
MSG_ReadCoord (&packet), MSG_ReadCoord (&packet),
|
||||
Net_LogPrintf (" created by %d", MSG_ReadShort
|
||||
(&packet));
|
||||
Net_LogPrintf (" origin: %f,%f,%f", MSG_ReadCoord
|
||||
(&packet), MSG_ReadCoord (&packet),
|
||||
MSG_ReadCoord (&packet));
|
||||
Net_LogPrintf (" trace endpos: %f,%f,%f",
|
||||
MSG_ReadCoord (&packet), MSG_ReadCoord (&packet),
|
||||
MSG_ReadCoord (&packet),
|
||||
MSG_ReadCoord (&packet),
|
||||
MSG_ReadCoord (&packet));
|
||||
break;
|
||||
case 2:
|
||||
case 12:
|
||||
Net_LogPrintf (" count: %d", MSG_ReadByte (&packet));
|
||||
printf (" origin: %f,%f,%f", MSG_ReadCoord (&packet),
|
||||
MSG_ReadCoord (&packet), MSG_ReadCoord (&packet));
|
||||
Net_LogPrintf (" count: %d", MSG_ReadByte
|
||||
(&packet));
|
||||
printf (" origin: %f,%f,%f", MSG_ReadCoord
|
||||
(&packet), MSG_ReadCoord (&packet),
|
||||
MSG_ReadCoord (&packet));
|
||||
break;
|
||||
default:
|
||||
Net_LogPrintf (" unknown value %d for tempentity",
|
||||
|
@ -672,8 +669,10 @@ Parse_Server_Packet ()
|
|||
break;
|
||||
case svc_spawnstaticsound:
|
||||
Net_LogPrintf ("pos %f,%f,%f", MSG_ReadCoord (&packet),
|
||||
MSG_ReadCoord (&packet), MSG_ReadCoord (&packet));
|
||||
Net_LogPrintf ("%d %d %d", MSG_ReadByte (&packet), MSG_ReadByte (&packet),
|
||||
MSG_ReadCoord (&packet), MSG_ReadCoord
|
||||
(&packet));
|
||||
Net_LogPrintf ("%d %d %d", MSG_ReadByte (&packet),
|
||||
MSG_ReadByte (&packet),
|
||||
MSG_ReadByte (&packet));
|
||||
break;
|
||||
case svc_intermission:
|
||||
|
@ -720,7 +719,8 @@ Parse_Server_Packet ()
|
|||
break;
|
||||
case svc_download:
|
||||
ii = MSG_ReadShort (&packet);
|
||||
Net_LogPrintf ("%d bytes at %d", ii, MSG_ReadByte (&packet));
|
||||
Net_LogPrintf ("%d bytes at %d", ii, MSG_ReadByte
|
||||
(&packet));
|
||||
for (i = 0; i < ii; i++)
|
||||
MSG_ReadByte (&packet);
|
||||
break;
|
||||
|
@ -728,8 +728,9 @@ Parse_Server_Packet ()
|
|||
Net_LogPrintf ("\n\tPlayer: %d", MSG_ReadByte (&packet));
|
||||
mask1 = MSG_ReadShort (&packet);
|
||||
Net_LogPrintf (" Mask1: %d", mask1);
|
||||
Net_LogPrintf (" Origin: %f,%f,%f", MSG_ReadCoord (&packet),
|
||||
MSG_ReadCoord (&packet), MSG_ReadCoord (&packet));
|
||||
Net_LogPrintf (" Origin: %f,%f,%f", MSG_ReadCoord
|
||||
(&packet), MSG_ReadCoord (&packet),
|
||||
MSG_ReadCoord (&packet));
|
||||
Net_LogPrintf (" Frame: %d", MSG_ReadByte (&packet));
|
||||
|
||||
if (mask1 & PF_MSEC)
|
||||
|
@ -738,21 +739,29 @@ Parse_Server_Packet ()
|
|||
if (mask1 & PF_COMMAND) {
|
||||
mask2 = MSG_ReadByte (&packet); // command
|
||||
if (mask2 & 0x01)
|
||||
Net_LogPrintf (" Pitch: %f", MSG_ReadAngle16 (&packet));
|
||||
Net_LogPrintf (" Pitch: %f", MSG_ReadAngle16
|
||||
(&packet));
|
||||
if (mask2 & 0x80)
|
||||
Net_LogPrintf (" Yaw: %f", MSG_ReadAngle16 (&packet));
|
||||
Net_LogPrintf (" Yaw: %f", MSG_ReadAngle16
|
||||
(&packet));
|
||||
if (mask2 & 0x02)
|
||||
Net_LogPrintf (" Roll: %f", MSG_ReadAngle16 (&packet));
|
||||
Net_LogPrintf (" Roll: %f", MSG_ReadAngle16
|
||||
(&packet));
|
||||
if (mask2 & 0x04)
|
||||
Net_LogPrintf (" Speed1: %d", MSG_ReadShort (&packet));
|
||||
Net_LogPrintf (" Speed1: %d", MSG_ReadShort
|
||||
(&packet));
|
||||
if (mask2 & 0x08)
|
||||
Net_LogPrintf (" Speed2: %d", MSG_ReadShort (&packet));
|
||||
Net_LogPrintf (" Speed2: %d", MSG_ReadShort
|
||||
(&packet));
|
||||
if (mask2 & 0x10)
|
||||
Net_LogPrintf (" Speed3: %d", MSG_ReadShort (&packet));
|
||||
Net_LogPrintf (" Speed3: %d", MSG_ReadShort
|
||||
(&packet));
|
||||
if (mask2 & 0x20)
|
||||
Net_LogPrintf (" Flag: %d", MSG_ReadByte (&packet));
|
||||
Net_LogPrintf (" Flag: %d", MSG_ReadByte
|
||||
(&packet));
|
||||
if (mask2 & 0x40)
|
||||
Net_LogPrintf (" Impulse: %d", MSG_ReadByte (&packet));
|
||||
Net_LogPrintf (" Impulse: %d", MSG_ReadByte
|
||||
(&packet));
|
||||
Net_LogPrintf (" Msec: %d", MSG_ReadByte (&packet));
|
||||
}
|
||||
if (mask1 & PF_VELOCITY1)
|
||||
|
@ -769,7 +778,8 @@ Parse_Server_Packet ()
|
|||
Net_LogPrintf (" Effects: %d", MSG_ReadByte (&packet));
|
||||
|
||||
if (mask1 & PF_WEAPONFRAME)
|
||||
Net_LogPrintf (" Weapon frame: %d", MSG_ReadByte (&packet));
|
||||
Net_LogPrintf (" Weapon frame: %d", MSG_ReadByte
|
||||
(&packet));
|
||||
break;
|
||||
case svc_nails:
|
||||
ii = MSG_ReadByte (&packet);
|
||||
|
@ -822,22 +832,21 @@ Parse_Server_Packet ()
|
|||
Net_LogPrintf ("\n\t*End of sound list*");
|
||||
break;
|
||||
case svc_packetentities:
|
||||
|
||||
while (1) {
|
||||
mask1 = (unsigned short) MSG_ReadShort(&packet);
|
||||
if (packet.badread) {
|
||||
Net_LogPrintf ("Badread\n");
|
||||
return;
|
||||
}
|
||||
if (!mask1) break;
|
||||
while (1) {
|
||||
mask1 = (unsigned short) MSG_ReadShort(&packet);
|
||||
if (packet.badread) {
|
||||
Net_LogPrintf ("Badread\n");
|
||||
return;
|
||||
}
|
||||
if (!mask1) break;
|
||||
if (mask1 & U_REMOVE) Net_LogPrintf("UREMOVE ");
|
||||
Log_Delta(mask1);
|
||||
}
|
||||
Log_Delta(mask1);
|
||||
}
|
||||
break;
|
||||
case svc_deltapacketentities:
|
||||
Net_LogPrintf ("idx: %d", MSG_ReadByte (&packet));
|
||||
return;
|
||||
break;
|
||||
break;
|
||||
case svc_maxspeed:
|
||||
Net_LogPrintf ("%f", MSG_ReadFloat (&packet));
|
||||
break;
|
||||
|
@ -850,12 +859,12 @@ Parse_Server_Packet ()
|
|||
Net_LogPrintf ("Value: %s", MSG_ReadString (&packet));
|
||||
break;
|
||||
case svc_serverinfo:
|
||||
Net_LogPrintf ("Name: %s Value: %s", MSG_ReadString (&packet),
|
||||
MSG_ReadString (&packet));
|
||||
Net_LogPrintf ("Name: %s Value: %s", MSG_ReadString
|
||||
(&packet), MSG_ReadString (&packet));
|
||||
break;
|
||||
case svc_updatepl:
|
||||
Net_LogPrintf ("Player: %d Ploss: %d", MSG_ReadByte (&packet),
|
||||
MSG_ReadByte (&packet));
|
||||
Net_LogPrintf ("Player: %d Ploss: %d", MSG_ReadByte
|
||||
(&packet), MSG_ReadByte (&packet));
|
||||
break;
|
||||
default:
|
||||
Net_LogPrintf ("**UNKNOWN**: [%d]", c);
|
||||
|
@ -882,9 +891,8 @@ Analyze_Client_Packet (const byte * data, int len)
|
|||
void
|
||||
Parse_Client_Packet (void)
|
||||
{
|
||||
int i, c, ii;
|
||||
int mask, i, c, ii;
|
||||
long seq1, seq2;
|
||||
int mask;
|
||||
|
||||
seq1 = MSG_ReadLong (&packet);
|
||||
if (seq1 == -1) {
|
||||
|
@ -909,8 +917,9 @@ Parse_Client_Packet (void)
|
|||
c = MSG_ReadByte (&packet);
|
||||
if (c == -1)
|
||||
break;
|
||||
// Net_LogPrintf("<%ld,%ld> ",seq1 & 0x7FFFFFFF,seq2 & 0x7FFFFFFF);
|
||||
Net_LogPrintf ("\n<%06x> [0x%02x] ", MSG_GetReadCount (&packet), c);
|
||||
// Net_LogPrintf("<%ld,%ld> ",seq1 & 0x7FFFFFFF,seq2 & 0x7FFFFFFF);
|
||||
Net_LogPrintf ("\n<%06x> [0x%02x] ", MSG_GetReadCount (&packet),
|
||||
c);
|
||||
if (c < 8)
|
||||
Net_LogPrintf ("%s: ", clc_string[c]);
|
||||
|
||||
|
@ -928,21 +937,29 @@ Parse_Client_Packet (void)
|
|||
mask = MSG_ReadByte (&packet);
|
||||
Net_LogPrintf ("\n\t(%d) mask = %02x", i, mask);
|
||||
if (mask & 0x01)
|
||||
Net_LogPrintf (" Tilt: %f", MSG_ReadAngle16 (&packet));
|
||||
Net_LogPrintf (" Tilt: %f", MSG_ReadAngle16
|
||||
(&packet));
|
||||
if (mask & 0x80)
|
||||
Net_LogPrintf (" Yaw: %f", MSG_ReadAngle16 (&packet));
|
||||
Net_LogPrintf (" Yaw: %f", MSG_ReadAngle16
|
||||
(&packet));
|
||||
if (mask & 0x02)
|
||||
Net_LogPrintf (" Roll: %f", MSG_ReadAngle16 (&packet));
|
||||
Net_LogPrintf (" Roll: %f", MSG_ReadAngle16
|
||||
(&packet));
|
||||
if (mask & 0x04)
|
||||
Net_LogPrintf (" Fwd: %d", MSG_ReadShort (&packet));
|
||||
Net_LogPrintf (" Fwd: %d", MSG_ReadShort
|
||||
(&packet));
|
||||
if (mask & 0x08)
|
||||
Net_LogPrintf (" Right: %d", MSG_ReadShort (&packet));
|
||||
Net_LogPrintf (" Right: %d", MSG_ReadShort
|
||||
(&packet));
|
||||
if (mask & 0x10)
|
||||
Net_LogPrintf (" Up: %d", MSG_ReadShort (&packet));
|
||||
Net_LogPrintf (" Up: %d", MSG_ReadShort
|
||||
(&packet));
|
||||
if (mask & 0x20)
|
||||
Net_LogPrintf (" Flags: %d", MSG_ReadByte (&packet));
|
||||
Net_LogPrintf (" Flags: %d", MSG_ReadByte
|
||||
(&packet));
|
||||
if (mask & 0x40)
|
||||
Net_LogPrintf (" Impulse: %d", MSG_ReadByte (&packet));
|
||||
Net_LogPrintf (" Impulse: %d", MSG_ReadByte
|
||||
(&packet));
|
||||
Net_LogPrintf (" Msec: %d", MSG_ReadByte (&packet));
|
||||
}
|
||||
break;
|
||||
|
@ -955,7 +972,8 @@ Parse_Client_Packet (void)
|
|||
break;
|
||||
case clc_upload:
|
||||
ii = MSG_ReadShort (&packet);
|
||||
Net_LogPrintf ("%d bytes at %d", ii, MSG_ReadByte (&packet));
|
||||
Net_LogPrintf ("%d bytes at %d", ii, MSG_ReadByte
|
||||
(&packet));
|
||||
for (i = 0; i < ii; i++)
|
||||
MSG_ReadByte (&packet);
|
||||
break;
|
||||
|
@ -965,7 +983,6 @@ Parse_Client_Packet (void)
|
|||
}
|
||||
Net_LogPrintf ("\n");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1011,9 +1028,8 @@ Net_Log_Init (const char **sound_precache)
|
|||
// 3 = just parse
|
||||
// 4 = parse/hexdump, skip movement/empty messages
|
||||
|
||||
net_loglevel =
|
||||
Cvar_Get ("net_loglevel", "2", CVAR_NONE, NULL,
|
||||
"Packet logging/parsing");
|
||||
net_loglevel = Cvar_Get ("net_loglevel", "2", CVAR_NONE, NULL,
|
||||
"Packet logging/parsing");
|
||||
|
||||
Cmd_AddCommand ("net_packetlog_zap", Net_PacketLog_Zap_f,
|
||||
"clear the packet log file");
|
||||
|
|
|
@ -30,18 +30,9 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
@ -63,11 +54,16 @@
|
|||
#ifdef HAVE_SYS_FILIO_H
|
||||
# include <sys/filio.h>
|
||||
#endif
|
||||
|
||||
#ifdef NeXT
|
||||
# include <libc.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/msg.h"
|
||||
|
@ -95,19 +91,14 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
extern cvar_t *net_packetlog;
|
||||
|
||||
netadr_t net_local_adr;
|
||||
|
||||
netadr_t net_from;
|
||||
int net_socket;
|
||||
netadr_t net_local_adr;
|
||||
netadr_t net_from;
|
||||
|
||||
static sizebuf_t _net_message_message;
|
||||
static msg_t _net_message = {0, 0, &_net_message_message};
|
||||
msg_t *net_message = &_net_message;
|
||||
|
||||
extern qboolean is_server;
|
||||
|
||||
#define MAX_UDP_PACKET (MAX_MSGLEN*2)
|
||||
byte net_message_buffer[MAX_UDP_PACKET];
|
||||
|
||||
|
@ -115,7 +106,9 @@ byte net_message_buffer[MAX_UDP_PACKET];
|
|||
WSADATA winsockdata;
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
extern cvar_t *net_packetlog;
|
||||
extern qboolean is_server;
|
||||
|
||||
|
||||
void
|
||||
NetadrToSockadr (netadr_t *a, struct sockaddr_in *s)
|
||||
|
@ -143,7 +136,6 @@ NET_CompareBaseAdr (netadr_t a, netadr_t b)
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
qboolean
|
||||
NET_CompareAdr (netadr_t a, netadr_t b)
|
||||
{
|
||||
|
@ -185,11 +177,10 @@ NET_BaseAdrToString (netadr_t a)
|
|||
qboolean
|
||||
NET_StringToAdr (const char *s, netadr_t *a)
|
||||
{
|
||||
char copy[128];
|
||||
char *colon;
|
||||
struct hostent *h;
|
||||
struct sockaddr_in sadr;
|
||||
char *colon;
|
||||
char copy[128];
|
||||
|
||||
|
||||
memset (&sadr, 0, sizeof (sadr));
|
||||
sadr.sin_family = AF_INET;
|
||||
|
@ -223,8 +214,8 @@ qboolean
|
|||
NET_IsClientLegal (netadr_t *adr)
|
||||
{
|
||||
#if 0
|
||||
struct sockaddr_in sadr;
|
||||
int newsocket;
|
||||
struct sockaddr_in sadr;
|
||||
|
||||
if (adr->ip[0] == 127)
|
||||
return false; // no local connections period
|
||||
|
@ -248,15 +239,12 @@ NET_IsClientLegal (netadr_t *adr)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
||||
qboolean
|
||||
NET_GetPacket (void)
|
||||
{
|
||||
int ret;
|
||||
struct sockaddr_in from;
|
||||
socklen_t fromlen;
|
||||
struct sockaddr_in from;
|
||||
|
||||
fromlen = sizeof (from);
|
||||
ret =
|
||||
|
@ -292,15 +280,15 @@ NET_GetPacket (void)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Check for malformed packets
|
||||
|
||||
// Check for malformed packets
|
||||
if (is_server && ntohs(net_from.port)<1024) {
|
||||
Con_Printf ("Warning: Packet from %s dropped: Bad port\n",
|
||||
NET_AdrToString (net_from));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (from.sin_addr.s_addr==INADDR_ANY || from.sin_addr.s_addr==INADDR_BROADCAST) {
|
||||
if (from.sin_addr.s_addr==INADDR_ANY || from.sin_addr.s_addr ==
|
||||
INADDR_BROADCAST) {
|
||||
Con_Printf ("Warning: Packet dropped - bad address\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -316,8 +304,6 @@ NET_GetPacket (void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void
|
||||
NET_SendPacket (int length, void *data, netadr_t to)
|
||||
{
|
||||
|
@ -355,12 +341,10 @@ NET_SendPacket (int length, void *data, netadr_t to)
|
|||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
int
|
||||
UDP_OpenSocket (int port)
|
||||
{
|
||||
int newsocket;
|
||||
int newsocket, i;
|
||||
struct sockaddr_in address;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -369,7 +353,6 @@ UDP_OpenSocket (int port)
|
|||
#else
|
||||
int _true = 1;
|
||||
#endif
|
||||
int i;
|
||||
|
||||
memset (&address, 0, sizeof(address));
|
||||
|
||||
|
@ -378,7 +361,7 @@ UDP_OpenSocket (int port)
|
|||
if (ioctl (newsocket, FIONBIO, &_true) == -1)
|
||||
Sys_Error ("UDP_OpenSocket: ioctl FIONBIO:%s", strerror (errno));
|
||||
address.sin_family = AF_INET;
|
||||
//ZOID -- check for interface binding option
|
||||
// ZOID -- check for interface binding option
|
||||
if ((i = COM_CheckParm ("-ip")) != 0 && i < com_argc) {
|
||||
address.sin_addr.s_addr = inet_addr (com_argv[i + 1]);
|
||||
Con_Printf ("Binding to IP Interface Address of %s\n",
|
||||
|
@ -399,8 +382,8 @@ void
|
|||
NET_GetLocalAddress (void)
|
||||
{
|
||||
char buff[MAXHOSTNAMELEN];
|
||||
struct sockaddr_in address;
|
||||
socklen_t namelen;
|
||||
struct sockaddr_in address;
|
||||
|
||||
gethostname (buff, MAXHOSTNAMELEN);
|
||||
buff[MAXHOSTNAMELEN - 1] = 0;
|
||||
|
@ -415,15 +398,12 @@ NET_GetLocalAddress (void)
|
|||
Con_Printf ("IP address %s\n", NET_AdrToString (net_local_adr));
|
||||
}
|
||||
|
||||
/*
|
||||
NET_Init
|
||||
*/
|
||||
void
|
||||
NET_Init (int port)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
WORD wVersionRequested;
|
||||
int r;
|
||||
WORD wVersionRequested;
|
||||
|
||||
wVersionRequested = MAKEWORD (1, 1);
|
||||
|
||||
|
@ -431,28 +411,19 @@ NET_Init (int port)
|
|||
if (r)
|
||||
Sys_Error ("Winsock initialization failed.");
|
||||
#endif /* _WIN32 */
|
||||
//
|
||||
// open the single socket to be used for all communications
|
||||
//
|
||||
net_socket = UDP_OpenSocket (port);
|
||||
|
||||
//
|
||||
// init the message buffer
|
||||
//
|
||||
_net_message_message.maxsize = sizeof (net_message_buffer);
|
||||
_net_message_message.data = net_message_buffer;
|
||||
|
||||
//
|
||||
// determine my name & address
|
||||
//
|
||||
NET_GetLocalAddress ();
|
||||
|
||||
Con_Printf ("UDP Initialized\n");
|
||||
}
|
||||
|
||||
/*
|
||||
NET_Shutdown
|
||||
*/
|
||||
void
|
||||
NET_Shutdown (void)
|
||||
{
|
||||
|
|
|
@ -29,17 +29,47 @@
|
|||
$Id$
|
||||
*/
|
||||
|
||||
/* Sun's model_t in sys/model.h conflicts w/ Quake's model_t */
|
||||
#define model_t quakeforgemodel_t
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_FILIO_H
|
||||
# include <sys/filio.h>
|
||||
#endif
|
||||
#ifdef NeXT
|
||||
# include <libc.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <windows.h>
|
||||
# undef EWOULDBLOCK
|
||||
# define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifdef HAVE_IPV6
|
||||
# include <winsock2.h>
|
||||
# define _DEF_BYTE_
|
||||
|
@ -65,47 +95,10 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* Sun's model_t in sys/model.h conflicts w/ Quake's model_t */
|
||||
#define model_t quakeforgemodel_t
|
||||
|
||||
#ifndef _WIN32
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_FILIO_H
|
||||
# include <sys/filio.h>
|
||||
#endif
|
||||
|
||||
#undef model_t
|
||||
|
||||
#ifdef NeXT
|
||||
# include <libc.h>
|
||||
#endif
|
||||
|
||||
#include "QF/console.h"
|
||||
#include "QF/msg.h"
|
||||
#include "QF/qargs.h"
|
||||
|
@ -125,9 +118,8 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
netadr_t net_local_adr;
|
||||
|
||||
netadr_t net_from;
|
||||
netadr_t net_local_adr;
|
||||
int net_socket;
|
||||
|
||||
static sizebuf_t _net_message_message;
|
||||
|
@ -141,7 +133,6 @@ byte net_message_buffer[MAX_UDP_PACKET];
|
|||
WSADATA winsockdata;
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void
|
||||
NetadrToSockadr (netadr_t *a, struct sockaddr_in6 *s)
|
||||
|
@ -185,7 +176,6 @@ NET_CompareBaseAdr (netadr_t a, netadr_t b)
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
qboolean
|
||||
NET_CompareAdr (netadr_t a, netadr_t b)
|
||||
{
|
||||
|
@ -256,14 +246,12 @@ NET_BaseAdrToString (netadr_t a)
|
|||
qboolean
|
||||
NET_StringToAdr (const char *s, netadr_t *a)
|
||||
{
|
||||
|
||||
char copy[128];
|
||||
char *addrs, *space;
|
||||
char *ports = NULL;
|
||||
int err;
|
||||
struct addrinfo hints;
|
||||
struct addrinfo *resultp;
|
||||
char *space;
|
||||
char *ports = NULL;
|
||||
char copy[128];
|
||||
char *addrs;
|
||||
int err;
|
||||
struct sockaddr_storage ss;
|
||||
struct sockaddr_in6 *ss6;
|
||||
struct sockaddr_in *ss4;
|
||||
|
@ -291,11 +279,12 @@ NET_StringToAdr (const char *s, netadr_t *a)
|
|||
}
|
||||
}
|
||||
|
||||
// Con_Printf ("NET_StringToAdr: addrs %s ports %s\n",addrs, ports);
|
||||
// Con_Printf ("NET_StringToAdr: addrs %s ports %s\n",addrs, ports);
|
||||
|
||||
if ((err = getaddrinfo (addrs, ports, &hints, &resultp))) {
|
||||
// Error
|
||||
Con_Printf ("NET_StringToAdr: string %s:\n%s\n", s, gai_strerror (err));
|
||||
Con_Printf ("NET_StringToAdr: string %s:\n%s\n", s, gai_strerror
|
||||
(err));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -335,8 +324,8 @@ qboolean
|
|||
NET_IsClientLegal (netadr_t *adr)
|
||||
{
|
||||
#if 0
|
||||
struct sockaddr_in sadr;
|
||||
int newsocket;
|
||||
struct sockaddr_in sadr;
|
||||
|
||||
if (adr->ip[0] == 127)
|
||||
return false; // no local connections period
|
||||
|
@ -360,15 +349,12 @@ NET_IsClientLegal (netadr_t *adr)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
||||
qboolean
|
||||
NET_GetPacket (void)
|
||||
{
|
||||
int ret;
|
||||
struct sockaddr_in6 from;
|
||||
int ret;
|
||||
unsigned int fromlen;
|
||||
struct sockaddr_in6 from;
|
||||
|
||||
fromlen = sizeof (from);
|
||||
ret =
|
||||
|
@ -407,8 +393,6 @@ NET_GetPacket (void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void
|
||||
NET_SendPacket (int length, void *data, netadr_t to)
|
||||
{
|
||||
|
@ -441,16 +425,13 @@ NET_SendPacket (int length, void *data, netadr_t to)
|
|||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
int
|
||||
UDP_OpenSocket (int port)
|
||||
{
|
||||
int newsocket;
|
||||
char Buf[BUFSIZ], *Host, *Service;
|
||||
int newsocket, Error;
|
||||
struct sockaddr_in6 address;
|
||||
struct addrinfo hints, *res;
|
||||
int Error;
|
||||
char Buf[BUFSIZ], *Host, *Service;
|
||||
|
||||
#ifdef IPV6_BINDV6ONLY
|
||||
int dummy;
|
||||
|
@ -469,7 +450,7 @@ UDP_OpenSocket (int port)
|
|||
Sys_Error ("UDP_OpenSocket: ioctl FIONBIO: %s", strerror (errno));
|
||||
memset (&address, 0, sizeof (address));
|
||||
address.sin6_family = AF_INET6;
|
||||
//ZOID -- check for interface binding option
|
||||
// ZOID -- check for interface binding option
|
||||
|
||||
memset (&hints, 0, sizeof (hints));
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
|
@ -525,8 +506,8 @@ void
|
|||
NET_GetLocalAddress (void)
|
||||
{
|
||||
char buff[MAXHOSTNAMELEN];
|
||||
struct sockaddr_in6 address;
|
||||
unsigned int namelen;
|
||||
struct sockaddr_in6 address;
|
||||
|
||||
if (gethostname (buff, MAXHOSTNAMELEN) == -1)
|
||||
Sys_Error ("Net_GetLocalAddress: gethostname: %s", strerror (errno));
|
||||
|
@ -542,15 +523,12 @@ NET_GetLocalAddress (void)
|
|||
Con_Printf ("IP address %s\n", NET_AdrToString (net_local_adr));
|
||||
}
|
||||
|
||||
/*
|
||||
NET_Init
|
||||
*/
|
||||
void
|
||||
NET_Init (int port)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
WORD wVersionRequested;
|
||||
int r;
|
||||
WORD wVersionRequested;
|
||||
|
||||
wVersionRequested = MAKEWORD (1, 1);
|
||||
|
||||
|
@ -559,28 +537,19 @@ NET_Init (int port)
|
|||
Sys_Error ("Winsock initialization failed.");
|
||||
#endif /* _WIN32 */
|
||||
|
||||
//
|
||||
// open the single socket to be used for all communications
|
||||
//
|
||||
net_socket = UDP_OpenSocket (port);
|
||||
|
||||
//
|
||||
// init the message buffer
|
||||
//
|
||||
_net_message_message.maxsize = sizeof (net_message_buffer);
|
||||
_net_message_message.data = net_message_buffer;
|
||||
|
||||
//
|
||||
// determine my name & address
|
||||
//
|
||||
NET_GetLocalAddress ();
|
||||
|
||||
Con_Printf ("UDP Initialized\n");
|
||||
}
|
||||
|
||||
/*
|
||||
NET_Shutdown
|
||||
*/
|
||||
void
|
||||
NET_Shutdown (void)
|
||||
{
|
||||
|
|
|
@ -51,7 +51,6 @@ int watertype;
|
|||
float frametime;
|
||||
|
||||
vec3_t forward, right, up;
|
||||
|
||||
vec3_t player_mins = { -16, -16, -24 };
|
||||
vec3_t player_maxs = { 16, 16, 32 };
|
||||
|
||||
|
@ -115,12 +114,11 @@ PM_ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce)
|
|||
int
|
||||
PM_FlyMove (void)
|
||||
{
|
||||
int blocked, bumpcount, numbumps, numplanes, i, j;
|
||||
vec3_t dir;
|
||||
float time_left, d;
|
||||
int blocked, bumpcount, numbumps, numplanes, i, j;
|
||||
pmtrace_t trace;
|
||||
vec3_t dir, end, primal_velocity, original_velocity;
|
||||
vec3_t planes[MAX_CLIP_PLANES];
|
||||
vec3_t end, primal_velocity, original_velocity;
|
||||
|
||||
numbumps = 4;
|
||||
|
||||
|
@ -343,8 +341,8 @@ PM_GroundMove (void)
|
|||
void
|
||||
PM_Friction (void)
|
||||
{
|
||||
float *vel;
|
||||
float drop, friction, speed, newspeed;
|
||||
float *vel;
|
||||
pmtrace_t trace;
|
||||
vec3_t start, stop;
|
||||
|
||||
|
@ -494,9 +492,9 @@ PM_WaterMove (void)
|
|||
void
|
||||
PM_AirMove (void)
|
||||
{
|
||||
float fmove, smove, wishspeed;
|
||||
int i;
|
||||
vec3_t original, wishdir, wishvel;
|
||||
float fmove, smove, wishspeed;
|
||||
|
||||
fmove = pmove.cmd.forwardmove;
|
||||
smove = pmove.cmd.sidemove;
|
||||
|
@ -562,8 +560,7 @@ PM_CategorizePosition (void)
|
|||
pmtrace_t tr;
|
||||
vec3_t point;
|
||||
|
||||
// if the player hull point one unit down is solid, the player
|
||||
// is on ground
|
||||
// if the player hull point one unit down is solid, the player is on ground
|
||||
|
||||
// see if standing on something solid
|
||||
point[0] = pmove.origin[0];
|
||||
|
@ -615,8 +612,7 @@ void
|
|||
JumpButton (void)
|
||||
{
|
||||
if (pmove.dead) {
|
||||
pmove.oldbuttons |= BUTTON_JUMP; // don't jump again until
|
||||
// released
|
||||
pmove.oldbuttons |= BUTTON_JUMP; // don't jump again until released
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -736,8 +732,7 @@ SpectatorMove (void)
|
|||
float control, drop, friction, fmove, smove, speed, newspeed;
|
||||
float currentspeed, addspeed, accelspeed, wishspeed;
|
||||
int i;
|
||||
vec3_t wishvel;
|
||||
vec3_t wishdir;
|
||||
vec3_t wishdir, wishvel;
|
||||
|
||||
// friction
|
||||
speed = Length (pmove.velocity);
|
||||
|
|
Loading…
Reference in a new issue