header/whitespace sweep continues.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-08-28 23:05:45 +00:00
parent 11489550ba
commit ade99607cc
18 changed files with 385 additions and 590 deletions

View file

@ -26,10 +26,10 @@
$Id$
*/
/* ZOID
* This takes over player controls for spectator automatic camera.
* Player moves as a spectator, but the camera tracks and enemy player
*/
/*
ZOID - This takes over player controls for spectator automatic camera.
Player moves as a spectator, but the camera tracks and enemy player
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
@ -43,13 +43,13 @@
#include <math.h>
#include "compat.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/msg.h"
#include "cl_cam.h"
#include "client.h"
#include "compat.h"
#include "pmove.h"
#include "sbar.h"
@ -72,9 +72,9 @@ cvar_t *cl_chasecam;
cvar_t *cl_camera_maxpitch;
cvar_t *cl_camera_maxyaw;
double cam_lastviewtime;
qboolean cam_forceview;
vec3_t cam_viewangles;
double cam_lastviewtime;
int spec_track = 0; // player# of who we are tracking
int autocam = CAM_NONE;
@ -83,8 +83,7 @@ int autocam = CAM_NONE;
static void
vectoangles (vec3_t vec, vec3_t ang)
{
float forward;
float yaw, pitch;
float forward, pitch, yaw;
if (vec[1] == 0 && vec[0] == 0) {
yaw = 0;
@ -115,7 +114,6 @@ vlen (vec3_t v)
return sqrt (v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
}
// returns true if weapon model should be drawn in camera mode
qboolean
Cam_DrawViewModel (void)
@ -128,7 +126,6 @@ Cam_DrawViewModel (void)
return false;
}
// returns true if we should draw this player, we don't if we are chase camming
qboolean
Cam_DrawPlayer (int playernum)
@ -139,7 +136,6 @@ Cam_DrawPlayer (int playernum)
return true;
}
void
Cam_Unlock (void)
{
@ -152,7 +148,6 @@ Cam_Unlock (void)
}
}
void
Cam_Lock (int playernum)
{
@ -167,7 +162,6 @@ Cam_Lock (int playernum)
Sbar_Changed ();
}
pmtrace_t
Cam_DoTrace (vec3_t vec1, vec3_t vec2)
{
@ -183,15 +177,14 @@ Cam_DoTrace (vec3_t vec1, vec3_t vec2)
return PM_PlayerMove (pmove.origin, vec2);
}
// Returns distance or 9999 if invalid for some reason
static float
Cam_TryFlyby (player_state_t * self, player_state_t * player, vec3_t vec,
qboolean checkvis)
{
vec3_t v;
pmtrace_t trace;
float len;
pmtrace_t trace;
vec3_t v;
vectoangles (vec, v);
// v[0] = -v[0];
@ -219,14 +212,13 @@ Cam_TryFlyby (player_state_t * self, player_state_t * player, vec3_t vec,
return len;
}
// Is player visible?
static qboolean
Cam_IsVisible (player_state_t * player, vec3_t vec)
{
float d;
pmtrace_t trace;
vec3_t v;
float d;
trace = Cam_DoTrace (player->origin, vec);
if (trace.fraction != 1 || /* trace.inopen || */ trace.inwater)
@ -239,7 +231,6 @@ Cam_IsVisible (player_state_t * player, vec3_t vec)
return true;
}
static qboolean
InitFlyby (player_state_t * self, player_state_t * player, int checkvis)
{
@ -250,8 +241,8 @@ InitFlyby (player_state_t * self, player_state_t * player, int checkvis)
VectorCopy (player->viewangles, vec);
vec[0] = 0;
AngleVectors (vec, forward, right, up);
// for (i = 0; i < 3; i++)
// forward[i] *= 3;
// for (i = 0; i < 3; i++)
// forward[i] *= 3;
max = 1000;
VectorAdd (forward, up, vec2);
@ -322,7 +313,7 @@ InitFlyby (player_state_t * self, player_state_t * player, int checkvis)
}
// ack, can't find him
if (max >= 1000) {
// Cam_Unlock();
// Cam_Unlock();
return false;
}
locked = true;
@ -330,7 +321,6 @@ InitFlyby (player_state_t * self, player_state_t * player, int checkvis)
return true;
}
static void
Cam_CheckHighTarget (void)
{
@ -352,7 +342,6 @@ Cam_CheckHighTarget (void)
Cam_Unlock ();
}
// ZOID
//
// Take over the user controls and track a player.
@ -360,10 +349,10 @@ Cam_CheckHighTarget (void)
void
Cam_Track (usercmd_t *cmd)
{
player_state_t *player, *self;
frame_t *frame;
vec3_t vec;
float len;
frame_t *frame;
player_state_t *player, *self;
vec3_t vec;
if (!cl.spectator)
return;
@ -407,7 +396,8 @@ Cam_Track (usercmd_t *cmd)
VectorCopy (player->viewangles, cl.viewangles);
VectorCopy (player->origin, desired_position);
if (memcmp (&desired_position, &self->origin, sizeof (desired_position))
if (memcmp (&desired_position, &self->origin,
sizeof (desired_position))
!= 0) {
MSG_WriteByte (&cls.netchan.message, clc_tmove);
MSG_WriteCoord (&cls.netchan.message, desired_position[0]);
@ -439,7 +429,6 @@ Cam_Track (usercmd_t *cmd)
}
}
#if 0
static float
adjustang (float current, float ideal, float speed)
@ -473,14 +462,12 @@ adjustang (float current, float ideal, float speed)
}
#endif
#if 0
void
Cam_SetView (void)
{
return;
player_state_t *player, *self;
frame_t *frame;
player_state_t *player, *self;
vec3_t vec, vec2;
if (cls.state != ca_active || !cl.spectator || !autocam || !locked)
@ -503,20 +490,19 @@ Cam_SetView (void)
adjustang (cam_viewangles[PITCH], vec2[PITCH],
cl_camera_maxpitch->value);
cam_viewangles[YAW] =
adjustang (cam_viewangles[YAW], vec2[YAW], cl_camera_maxyaw->value);
adjustang (cam_viewangles[YAW], vec2[YAW],
cl_camera_maxyaw->value);
}
VectorCopy (cam_viewangles, cl.viewangles);
VectorCopy (cl.viewangles, cl.simangles);
}
#endif
void
Cam_FinishMove (usercmd_t *cmd)
{
int i;
int end, i;
player_info_t *s;
int end;
if (cls.state != ca_active)
return;
@ -584,7 +570,7 @@ Cam_FinishMove (usercmd_t *cmd)
}
oldbuttons |= BUTTON_JUMP; // don't jump again until released
}
// Con_Printf("Selecting track target...\n");
// Con_Printf("Selecting track target...\n");
if (locked && autocam)
end = (spec_track + 1) % MAX_CLIENTS;
@ -610,7 +596,6 @@ Cam_FinishMove (usercmd_t *cmd)
autocam = locked = false;
}
void
Cam_Reset (void)
{
@ -618,7 +603,6 @@ Cam_Reset (void)
spec_track = 0;
}
void
CL_Cam_Init_Cvars (void)
{

View file

@ -36,12 +36,13 @@
# include <strings.h>
#endif
#include "client.h"
#include "QF/console.h"
#include "QF/cmd.h"
#include "QF/msg.h"
#include "QF/teamplay.h"
#include "client.h"
/*
Cmd_ForwardToServer
@ -87,7 +88,6 @@ Cmd_ForwardToServer (void)
}
}
// don't forward the first argument
void
Cmd_ForwardToServer_f (void)
@ -111,12 +111,12 @@ Cmd_ForwardToServer_f (void)
}
}
void
cl_Cmd_Init (void)
{
// register our commands
Cmd_AddCommand ("cmd", Cmd_ForwardToServer_f, "Send a command to the server.\n"
Cmd_AddCommand ("cmd", Cmd_ForwardToServer_f, "Send a command to the "
"server.\n"
"Commands:\n"
"download - Same as the command.\n"
"kill - Same as the command.\n"

View file

@ -35,36 +35,38 @@
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/time.h>
#include <unistd.h>
#include "QF/console.h"
#include "QF/cmd.h"
#include "QF/cvar.h"
#include "QF/msg.h"
#include "QF/qendian.h"
#include "QF/sys.h"
#include "QF/va.h"
#include "QF/cvar.h"
#include "compat.h"
#include "cl_main.h"
#include "client.h"
#include "compat.h"
#include "host.h"
#include "pmove.h"
int cl_timeframes_isactive;
int cl_timeframes_index;
struct timeval *cl_timeframes_array;
int cl_timeframes_isactive;
int cl_timeframes_index;
int demotime_cached;
struct timeval *cl_timeframes_array;
#define CL_TIMEFRAMES_ARRAYBLOCK 4096
extern cvar_t *cl_timeframes;
void CL_FinishTimeDemo (void);
void CL_TimeFrames_Reset (void);
void CL_TimeFrames_DumpLog (void);
void CL_FinishTimeDemo (void);
int demotime_cached;
/*
DEMO CODE
@ -97,12 +99,10 @@ CL_StopPlayback (void)
CL_FinishTimeDemo ();
}
#define dem_cmd 0
#define dem_read 1
#define dem_set 2
/*
CL_WriteDemoCmd
@ -111,9 +111,9 @@ CL_StopPlayback (void)
void
CL_WriteDemoCmd (usercmd_t *pcmd)
{
int i;
float fl;
byte c;
float fl;
int i;
usercmd_t cmd;
// Con_Printf("write: %ld bytes, %4.4f\n", msg->cursize, realtime);
@ -143,7 +143,6 @@ CL_WriteDemoCmd (usercmd_t *pcmd)
Qflush (cls.demofile);
}
/*
CL_WriteDemoMessage
@ -152,9 +151,9 @@ CL_WriteDemoCmd (usercmd_t *pcmd)
void
CL_WriteDemoMessage (sizebuf_t *msg)
{
int len;
float fl;
byte c;
float fl;
int len;
// Con_Printf("write: %ld bytes, %4.4f\n", msg->cursize, realtime);
@ -174,16 +173,14 @@ CL_WriteDemoMessage (sizebuf_t *msg)
Qflush (cls.demofile);
}
qboolean
CL_GetDemoMessage (void)
{
int r, i, j;
float f;
float demotime;
byte c;
usercmd_t *pcmd;
float demotime, f;
static float cached_demotime;
int r, i, j;
usercmd_t *pcmd;
// read the time from the packet
if (demotime_cached) {
@ -264,11 +261,12 @@ CL_GetDemoMessage (void)
// get the next message
Qread (cls.demofile, &net_message->message->cursize, 4);
net_message->message->cursize = LittleLong (net_message->message->cursize);
// Con_Printf("read: %ld bytes\n", net_message->message->cursize);
// Con_Printf("read: %ld bytes\n", net_message->message->cursize);
if (net_message->message->cursize > MAX_MSGLEN)
// Sys_Error ("Demo message > MAX_MSGLEN");
Host_EndGame ("Demo message > MAX_MSGLEN");
r = Qread (cls.demofile, net_message->message->data, net_message->message->cursize);
r = Qread (cls.demofile, net_message->message->data,
net_message->message->cursize);
if (r != net_message->message->cursize) {
CL_StopPlayback ();
return 0;
@ -291,7 +289,6 @@ CL_GetDemoMessage (void)
return 1;
}
/*
CL_GetMessage
@ -311,7 +308,6 @@ CL_GetMessage (void)
return true;
}
/*
CL_Stop_f
@ -324,21 +320,20 @@ CL_Stop_f (void)
Con_Printf ("Not recording a demo.\n");
return;
}
// write a disconnect message to the demo file
// write a disconnect message to the demo file
SZ_Clear (net_message->message);
MSG_WriteLong (net_message->message, -1); // -1 sequence means out of band
MSG_WriteLong (net_message->message, -1); // -1 sequence means out of band
MSG_WriteByte (net_message->message, svc_disconnect);
MSG_WriteString (net_message->message, "EndOfDemo");
CL_WriteDemoMessage (net_message->message);
// finish up
// finish up
Qclose (cls.demofile);
cls.demofile = NULL;
cls.demorecording = false;
Con_Printf ("Completed demo\n");
}
/*
CL_WriteDemoMessage
@ -347,10 +342,9 @@ CL_Stop_f (void)
void
CL_WriteRecordDemoMessage (sizebuf_t *msg, int seq)
{
int len;
int i;
float fl;
byte c;
float fl;
int len, i;
// Con_Printf("write: %ld bytes, %4.4f\n", msg->cursize, realtime);
@ -375,15 +369,14 @@ CL_WriteRecordDemoMessage (sizebuf_t *msg, int seq)
Qflush (cls.demofile);
}
void
CL_WriteSetDemoMessage (void)
{
int len;
float fl;
byte c;
float fl;
int len;
//Con_Printf("write: %ld bytes, %4.4f\n", msg->cursize, realtime);
// Con_Printf("write: %ld bytes, %4.4f\n", msg->cursize, realtime);
if (!cls.demorecording)
return;
@ -402,7 +395,6 @@ CL_WriteSetDemoMessage (void)
Qflush (cls.demofile);
}
/*
CL_Record_f
@ -411,17 +403,16 @@ CL_WriteSetDemoMessage (void)
void
CL_Record_f (void)
{
int c;
char name[MAX_OSPATH];
sizebuf_t buf;
char buf_data[MAX_MSGLEN];
int n, i, j;
char buf_data[MAX_MSGLEN], name[MAX_OSPATH];
char *s;
int c, n, i, j;
int seq = 1;
entity_t *ent;
entity_state_t *es, blankes;
player_info_t *player;
sizebuf_t buf;
extern char gamedirfile[];
int seq = 1;
c = Cmd_Argc ();
if (c != 2) {
@ -439,8 +430,7 @@ CL_Record_f (void)
snprintf (name, sizeof (name), "%s/%s", com_gamedir, Cmd_Argv (1));
// open the demo file
//
// open the demo file
COM_DefaultExtension (name, ".qwd");
cls.demofile = Qopen (name, "wb");
@ -454,13 +444,13 @@ CL_Record_f (void)
/*-------------------------------------------------*/
// serverdata
// serverdata
// send the info about the new client to all connected clients
memset (&buf, 0, sizeof (buf));
buf.data = buf_data;
buf.maxsize = sizeof (buf_data);
// send the serverdata
// send the serverdata
MSG_WriteByte (&buf, svc_serverdata);
MSG_WriteLong (&buf, PROTOCOL_VERSION);
MSG_WriteLong (&buf, cl.servercount);
@ -498,7 +488,7 @@ CL_Record_f (void)
CL_WriteRecordDemoMessage (&buf, seq++);
SZ_Clear (&buf);
// soundlist
// soundlist
MSG_WriteByte (&buf, svc_soundlist);
MSG_WriteByte (&buf, 0);
@ -523,7 +513,7 @@ CL_Record_f (void)
CL_WriteRecordDemoMessage (&buf, seq++);
SZ_Clear (&buf);
}
// modellist
// modellist
MSG_WriteByte (&buf, svc_modellist);
MSG_WriteByte (&buf, 0);
@ -548,8 +538,7 @@ CL_Record_f (void)
CL_WriteRecordDemoMessage (&buf, seq++);
SZ_Clear (&buf);
}
// spawnstatic
// spawnstatic
for (i = 0; i < cl.num_statics; i++) {
ent = cl_static_entities + i;
@ -577,11 +566,10 @@ CL_Record_f (void)
}
}
// spawnstaticsound
// spawnstaticsound
// static sounds are skipped in demos, life is hard
// baselines
// baselines
memset (&blankes, 0, sizeof (blankes));
for (i = 0; i < MAX_EDICTS; i++) {
es = cl_baselines + i;
@ -613,7 +601,7 @@ CL_Record_f (void)
CL_WriteRecordDemoMessage (&buf, seq++);
SZ_Clear (&buf);
}
// send current status of all other players
// send current status of all other players
for (i = 0; i < MAX_CLIENTS; i++) {
player = cl.players + i;
@ -645,7 +633,7 @@ CL_Record_f (void)
}
}
// send all current light styles
// send all current light styles
for (i = 0; i < MAX_LIGHTSTYLES; i++) {
MSG_WriteByte (&buf, svc_lightstyle);
MSG_WriteByte (&buf, (char) i);
@ -688,7 +676,6 @@ CL_Record_f (void)
// done
}
/*
CL_ReRecord_f
@ -697,8 +684,8 @@ CL_Record_f (void)
void
CL_ReRecord_f (void)
{
int c;
char name[MAX_OSPATH];
int c;
c = Cmd_Argc ();
if (c != 2) {
@ -716,8 +703,7 @@ CL_ReRecord_f (void)
snprintf (name, sizeof (name), "%s/%s", com_gamedir, Cmd_Argv (1));
// open the demo file
//
// open the demo file
COM_DefaultExtension (name, ".qwd");
cls.demofile = Qopen (name, "wb");
@ -733,7 +719,6 @@ CL_ReRecord_f (void)
CL_BeginServerConnect ();
}
/*
CL_PlayDemo_f
@ -770,12 +755,11 @@ CL_PlayDemo_f (void)
realtime = 0;
}
void
CL_FinishTimeDemo (void)
{
int frames;
float time;
int frames;
cls.timedemo = false;
@ -791,7 +775,6 @@ CL_FinishTimeDemo (void)
cl_timeframes_isactive = 0;
}
/*
CL_TimeDemo_f
@ -845,7 +828,10 @@ CL_TimeFrames_AddTimestamp (void)
int retval;
if (cl_timeframes_isactive) {
if (!(cl_timeframes_index % CL_TIMEFRAMES_ARRAYBLOCK))
cl_timeframes_array = realloc (cl_timeframes_array, sizeof(struct timeval) * ((cl_timeframes_index / CL_TIMEFRAMES_ARRAYBLOCK) + 1) * CL_TIMEFRAMES_ARRAYBLOCK);
cl_timeframes_array = realloc
(cl_timeframes_array, sizeof(struct timeval) *
((cl_timeframes_index / CL_TIMEFRAMES_ARRAYBLOCK) + 1) *
CL_TIMEFRAMES_ARRAYBLOCK);
if (cl_timeframes_array == NULL)
Sys_Error ("Unable to allocate timeframes buffer\n");
retval = gettimeofday(cl_timeframes_array + cl_timeframes_index, NULL);
@ -858,11 +844,11 @@ CL_TimeFrames_AddTimestamp (void)
void CL_TimeFrames_DumpLog (void)
{
VFile *outputfile;
char e_path[MAX_OSPATH];
char *filename = "timeframes.txt";
int i;
long frame;
int i;
VFile *outputfile;
if (cl_timeframes_isactive == 0)
return;
@ -875,10 +861,12 @@ void CL_TimeFrames_DumpLog (void)
return;
}
for (i = 1; i < cl_timeframes_index; i++) {
frame = (cl_timeframes_array[i].tv_sec - cl_timeframes_array[i - 1].tv_sec);
frame = (cl_timeframes_array[i].tv_sec -
cl_timeframes_array[i - 1].tv_sec);
if (frame < 999) {
frame *= 1000000;
frame += cl_timeframes_array[i].tv_usec - cl_timeframes_array[i - 1].tv_usec;
frame += cl_timeframes_array[i].tv_usec -
cl_timeframes_array[i - 1].tv_usec;
} else
frame = 999999999;

View file

@ -88,14 +88,13 @@ CL_ClearEnts ()
void
CL_NewDlight (int key, vec3_t org, int effects)
{
float radius;
dlight_t *dl;
static vec3_t normal = {0.4, 0.2, 0.05};
static vec3_t red = {0.5, 0.05, 0.05};
static vec3_t blue = {0.05, 0.05, 0.5};
static vec3_t purple = {0.5, 0.05, 0.5};
dlight_t *dl;
float radius;
if (!(effects & (EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT)))
return;
@ -124,16 +123,15 @@ CL_NewDlight (int key, vec3_t org, int effects)
dl->radius = radius;
}
/*
PACKET ENTITY PARSING / LINKING
*/
/* PACKET ENTITY PARSING / LINKING */
int bitcounts[32]; // / just for protocol profiling
/*
CL_ParseDelta
Can go from either a baseline or a previous packet_entity
*/
int bitcounts[32]; // / just for protocol profiling
void
CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits)
{
@ -237,8 +235,8 @@ CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits)
void
FlushEntityPacket (void)
{
int word;
entity_state_t olde, newe;
int word;
Con_DPrintf ("FlushEntityPacket\n");
@ -271,12 +269,10 @@ FlushEntityPacket (void)
void
CL_ParsePacketEntities (qboolean delta)
{
int oldpacket, newpacket;
packet_entities_t *oldp, *newp, dummy;
int oldindex, newindex;
int word, newnum, oldnum;
qboolean full;
byte from;
int oldindex, newindex, newnum, oldnum, oldpacket, newpacket, word;
packet_entities_t *oldp, *newp, dummy;
qboolean full;
newpacket = cls.netchan.incoming_sequence & UPDATE_MASK;
newp = &cl.frames[newpacket].packet_entities;
@ -399,15 +395,14 @@ CL_ParsePacketEntities (qboolean delta)
void
CL_LinkPacketEntities (void)
{
entity_t **ent;
packet_entities_t *pack;
entity_state_t *s1;
model_t *model;
int i;
int pnum;
dlight_t *dl;
extern int cl_playerindex;
entity_t **ent;
entity_state_t *s1;
int pnum, i;
extern int cl_h_playerindex, cl_gib1index, cl_gib2index, cl_gib3index;
extern int cl_playerindex;
model_t *model;
packet_entities_t *pack;
pack = &cl.frames[cls.netchan.incoming_sequence &
UPDATE_MASK].packet_entities;
@ -546,9 +541,7 @@ CL_LinkPacketEntities (void)
}
}
/*
PROJECTILE PARSING / LINKING
*/
/* PROJECTILE PARSING / LINKING */
typedef struct {
int modelindex;
@ -557,9 +550,8 @@ typedef struct {
#define MAX_PROJECTILES 32
projectile_t cl_projectiles[MAX_PROJECTILES];
int cl_num_projectiles;
extern int cl_spikeindex;
int cl_num_projectiles;
extern int cl_spikeindex;
void
CL_ClearProjectiles (void)
@ -602,9 +594,9 @@ CL_ParseProjectiles (void)
void
CL_LinkProjectiles (void)
{
entity_t **ent;
int i;
projectile_t *pr;
entity_t **ent;
for (i = 0, pr = cl_projectiles; i < cl_num_projectiles; i++, pr++) {
if (pr->modelindex < 1)
@ -631,18 +623,14 @@ CL_LinkProjectiles (void)
}
}
extern int cl_spikeindex, cl_playerindex, cl_flagindex;
extern int parsecountmod;
extern double parsecounttime;
extern int cl_spikeindex, cl_playerindex, cl_flagindex, parsecountmod;
void
CL_ParsePlayerinfo (void)
{
int msec;
int flags;
int flags, msec, num, i;
player_state_t *state;
int num;
int i;
num = MSG_ReadByte (net_message);
if (num > MAX_CLIENTS)
@ -702,7 +690,6 @@ CL_ParsePlayerinfo (void)
VectorCopy (state->command.angles, state->viewangles);
}
/*
CL_AddFlagModels
@ -711,10 +698,10 @@ CL_ParsePlayerinfo (void)
void
CL_AddFlagModels (entity_t *ent, int team)
{
int i;
float f;
vec3_t v_forward, v_right, v_up;
entity_t **newent;
float f;
int i;
vec3_t v_forward, v_right, v_up;
if (cl_flagindex == -1)
return;
@ -769,14 +756,14 @@ CL_AddFlagModels (entity_t *ent, int team)
AngleVectors (ent->angles, v_forward, v_right, v_up);
v_forward[2] = -v_forward[2]; // reverse z component
for (i = 0; i < 3; i++)
(*newent)->origin[i] = ent->origin[i] - f * v_forward[i] + 22 * v_right[i];
(*newent)->origin[i] = ent->origin[i] - f * v_forward[i] + 22 *
v_right[i];
(*newent)->origin[2] -= 16;
VectorCopy (ent->angles, (*newent)->angles)
(*newent)->angles[2] -= 45;
}
/*
CL_LinkPlayers
@ -786,16 +773,14 @@ CL_AddFlagModels (entity_t *ent, int team)
void
CL_LinkPlayers (void)
{
int i, j;
player_info_t *info;
double playertime;
entity_t **ent;
frame_t *frame;
int msec, oldphysent, i, j;
player_info_t *info;
player_state_t exact;
player_state_t *state;
player_state_t exact;
double playertime;
entity_t **ent;
int msec;
frame_t *frame;
int oldphysent;
vec3_t org;
vec3_t org;
playertime = realtime - cls.latency + 0.02;
if (playertime > realtime)
@ -875,11 +860,13 @@ CL_LinkPlayers (void)
(*ent)->angles[PITCH] = -state->viewangles[PITCH] / 3;
(*ent)->angles[YAW] = state->viewangles[YAW];
(*ent)->angles[ROLL] = 0;
(*ent)->angles[ROLL] = V_CalcRoll ((*ent)->angles, state->velocity) * 4;
(*ent)->angles[ROLL] =
V_CalcRoll ((*ent)->angles, state->velocity) * 4;
// only predict half the move to minimize overruns
msec = 500 * (playertime - state->state_time);
if (msec <= 0 || (!cl_predict_players->int_val && !cl_predict_players2->int_val)) {
if (msec <= 0 || (!cl_predict_players->int_val &&
!cl_predict_players2->int_val)) {
VectorCopy (state->origin, (*ent)->origin);
} else { // predict players movement
state->command.msec = msec = min (msec, 255);
@ -895,11 +882,9 @@ CL_LinkPlayers (void)
CL_AddFlagModels ((*ent), 0);
else if (state->effects & EF_FLAG2)
CL_AddFlagModels ((*ent), 1);
}
}
/*
CL_SetSolid
@ -908,10 +893,10 @@ CL_LinkPlayers (void)
void
CL_SetSolidEntities (void)
{
int i;
frame_t *frame;
packet_entities_t *pak;
entity_state_t *state;
frame_t *frame;
int i;
packet_entities_t *pak;
pmove.physents[0].model = cl.worldmodel;
VectorCopy (vec3_origin, pmove.physents[0].origin);
@ -932,14 +917,14 @@ CL_SetSolidEntities (void)
|| cl.model_precache[state->modelindex]->clipbox) {
pmove.physents[pmove.numphysent].model =
cl.model_precache[state->modelindex];
VectorCopy (state->origin, pmove.physents[pmove.numphysent].origin);
VectorCopy (state->origin,
pmove.physents[pmove.numphysent].origin);
pmove.numphysent++;
}
}
}
/*
Calculate the new position of players, without other player clipping
@ -951,12 +936,11 @@ CL_SetSolidEntities (void)
void
CL_SetUpPlayerPrediction (qboolean dopred)
{
int j;
player_state_t *state;
player_state_t exact;
double playertime;
int msec;
double playertime;
frame_t *frame;
int msec, j;
player_state_t exact;
player_state_t *state;
struct predicted_player *pplayer;
playertime = realtime - cls.latency + 0.02;
@ -1004,7 +988,6 @@ CL_SetUpPlayerPrediction (qboolean dopred)
}
}
/*
CL_SetSolid
@ -1016,11 +999,11 @@ CL_SetUpPlayerPrediction (qboolean dopred)
void
CL_SetSolidPlayers (int playernum)
{
int j;
extern vec3_t player_mins;
extern vec3_t player_maxs;
int j;
physent_t *pent;
struct predicted_player *pplayer;
physent_t *pent;
extern vec3_t player_maxs, player_mins;
if (!cl_solid_players->int_val)
return;
@ -1048,7 +1031,6 @@ CL_SetSolidPlayers (int playernum)
}
}
/*
CL_EmitEntities
@ -1073,7 +1055,6 @@ CL_EmitEntities (void)
CL_UpdateTEnts ();
}
void
CL_Ents_Init (void)
{

View file

@ -38,7 +38,6 @@
#include "QF/checksum.h"
#include "QF/cmd.h"
#include "compat.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/input.h"
@ -51,6 +50,7 @@
#include "cl_input.h"
#include "cl_parse.h"
#include "client.h"
#include "compat.h"
#include "host.h"
#include "msg_ucmd.h"
#include "view.h"
@ -74,7 +74,6 @@ cvar_t *cl_nodelta;
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;
@ -148,28 +147,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)
{
@ -178,217 +173,186 @@ 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)
{
KeyDown (&in_right);
}
void
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)
{
@ -399,7 +363,6 @@ IN_Impulse (void)
Team_BestWeaponImpulse (); // HACK HACK HACK
}
/*
CL_KeyState
@ -449,7 +412,6 @@ CL_KeyState (kbutton_t *key)
return val;
}
//==========================================================================
cvar_t *cl_anglespeedkey;
@ -461,7 +423,6 @@ cvar_t *cl_sidespeed;
cvar_t *cl_upspeed;
cvar_t *cl_yawspeed;
/*
CL_AdjustAngles
@ -470,8 +431,7 @@ cvar_t *cl_yawspeed;
void
CL_AdjustAngles (void)
{
float speed;
float up, down;
float down, up, speed;
if (in_speed.state & 1)
speed = host_frametime * cl_anglespeedkey->value;
@ -514,7 +474,6 @@ CL_AdjustAngles (void)
}
/*
CL_BaseMove
@ -544,8 +503,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;
@ -572,7 +530,6 @@ CL_BaseMove (usercmd_t *cmd)
}
}
int
MakeChar (int i)
{
@ -584,20 +541,17 @@ MakeChar (int i)
return i;
}
void
CL_FinishMove (usercmd_t *cmd)
{
int i;
int ms;
int ms, i;
// 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;
// figure button bits
//
// figure button bits
if (in_attack.state & 3)
cmd->buttons |= 1;
in_attack.state &= ~2;
@ -623,29 +577,23 @@ CL_FinishMove (usercmd_t *cmd)
cmd->impulse = in_impulse;
in_impulse = 0;
// chop down so no extra bits are kept that the server wouldn't get
//
// chop down so no extra bits are kept that the server wouldn't get
cmd->forwardmove = MakeChar (cmd->forwardmove);
cmd->sidemove = MakeChar (cmd->sidemove);
cmd->upmove = MakeChar (cmd->upmove);
for (i = 0; i < 3; i++)
cmd->angles[i] =
((int) (cmd->angles[i] * 65536.0 / 360) & 65535) * (360.0 /
65536.0);
cmd->angles[i] = ((int) (cmd->angles[i] * (65536.0 / 360.0)) & 65535) *
(360.0 / 65536.0);
}
void
CL_SendCmd (void)
{
sizebuf_t buf;
byte data[128];
int i;
int checksumIndex, lost, seq_hash, i;
sizebuf_t buf;
usercmd_t *cmd, *oldcmd;
int checksumIndex;
int lost;
int seq_hash;
if (cls.demoplayback)
return; // sendcmds come from the demo
@ -673,8 +621,8 @@ CL_SendCmd (void)
Cam_FinishMove (cmd);
// send this and the previous cmds in the message, so
// if the last packet was dropped, it can be recovered
// send this and the previous cmds in the message, so
// if the last packet was dropped, it can be recovered
buf.maxsize = 128;
buf.cursize = 0;
buf.data = data;
@ -725,12 +673,10 @@ CL_SendCmd (void)
if (cls.demorecording)
CL_WriteDemoCmd (cmd);
// deliver the message
//
// deliver the message
Netchan_Transmit (&cls.netchan, buf.cursize, buf.data);
}
void
CL_Input_Init (void)
{
@ -807,7 +753,6 @@ CL_Input_Init (void)
"and +lookdown");
}
void
CL_Input_Init_Cvars (void)
{

View file

@ -26,31 +26,26 @@
$Id$
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef __sun
/* Sun's model_t in sys/model.h conflicts w/ Quake's model_t */
# define model_t sunmodel_t
#endif
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <errno.h>
#include <ctype.h>
#include <sys/types.h>
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_WINSOCK_H
# include <winsock.h>
#endif
@ -58,10 +53,13 @@
# include <rpc/types.h>
#endif
#include <ctype.h>
#include <errno.h>
#include <setjmp.h>
#include <sys/types.h>
#ifdef __sun
# undef model_t
# undef model_t // allow qf to use it's model_t
#endif
#include "QF/cdaudio.h"
@ -74,17 +72,16 @@
#include "QF/model.h"
#include "QF/msg.h"
#include "QF/plugin.h"
#include "QF/qendian.h"
#include "QF/qargs.h"
#include "QF/qendian.h"
#include "QF/screen.h"
#include "QF/sound.h"
#include "QF/sys.h"
#include "QF/teamplay.h"
#include "QF/vid.h"
#include "QF/va.h"
#include "QF/vfs.h"
#include "QF/vid.h"
#include "compat.h"
#include "bothdefs.h"
#include "buildnum.h"
#include "cl_cam.h"
@ -98,6 +95,7 @@
#include "cl_slist.h"
#include "cl_tent.h"
#include "client.h"
#include "compat.h"
#include "game.h"
#include "host.h"
#include "net.h"
@ -114,7 +112,6 @@ void CL_RemoveQFInfoKeys ();
qboolean noclip_anglehack; // remnant from old quake
cvar_t *fs_globalcfg;
cvar_t *fs_usercfg;
cvar_t *rcon_password;
@ -220,6 +217,7 @@ cvar_t *confirm_quit;
void CL_RSShot_f (void);
void
CL_Sbar_f (cvar_t *var)
{
@ -239,7 +237,6 @@ CL_Quit_f (void)
Sys_Quit ();
}
void
CL_Version_f (void)
{
@ -247,7 +244,6 @@ CL_Version_f (void)
Con_Printf ("Binary: " __TIME__ " " __DATE__ "\n");
}
/*
CL_SendConnectPacket
@ -256,9 +252,9 @@ CL_Version_f (void)
void
CL_SendConnectPacket (void)
{
netadr_t adr;
char data[2048];
double t1, t2;
netadr_t adr;
// JACK: Fixed bug where DNS lookups would cause two connects real fast
// Now, adds lookup time to the connect time.
@ -296,14 +292,13 @@ CL_SendConnectPacket (void)
// Info_SetValueForStarKey (cls.userinfo, "*ip", NET_AdrToString(adr),
// MAX_INFO_STRING);
// Con_Printf ("Connecting to %s...\n", cls.servername);
// Con_Printf ("Connecting to %s...\n", cls.servername);
snprintf (data, sizeof (data), "%c%c%c%cconnect %i %i %i \"%s\"\n",
255, 255, 255, 255, PROTOCOL_VERSION, cls.qport, cls.challenge,
cls.userinfo);
NET_SendPacket (strlen (data), data, adr);
}
/*
CL_CheckForResend
@ -312,9 +307,9 @@ CL_SendConnectPacket (void)
void
CL_CheckForResend (void)
{
netadr_t adr;
char data[2048];
double t1, t2;
netadr_t adr;
if (connect_time == -1)
return;
@ -348,7 +343,6 @@ CL_CheckForResend (void)
NET_SendPacket (strlen (data), data, adr);
}
void
CL_BeginServerConnect (void)
{
@ -356,7 +350,6 @@ CL_BeginServerConnect (void)
CL_CheckForResend ();
}
void
CL_Connect_f (void)
{
@ -375,7 +368,6 @@ CL_Connect_f (void)
CL_BeginServerConnect ();
}
/*
CL_Rcon_f
@ -386,9 +378,8 @@ void
CL_Rcon_f (void)
{
char message[1024];
int i;
int len, i;
netadr_t to;
int len;
snprintf (message, sizeof (message), "\377\377\377\377rcon %s ",
rcon_password->string);
@ -417,7 +408,6 @@ CL_Rcon_f (void)
NET_SendPacket (strlen (message) + 1, message, to);
}
void
CL_ClearState (void)
{
@ -436,17 +426,16 @@ CL_ClearState (void)
R_ClearDlights ();
R_ClearFires ();
// wipe the entire cl structure
// wipe the entire cl structure
memset (&cl, 0, sizeof (cl));
SZ_Clear (&cls.netchan.message);
// clear other arrays
// clear other arrays
memset (cl_efrags, 0, sizeof (cl_efrags));
memset (r_lightstyle, 0, sizeof (r_lightstyle));
}
/*
CL_StopCshifts
@ -456,13 +445,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
@ -514,14 +503,12 @@ CL_Disconnect (void)
}
void
CL_Disconnect_f (void)
{
CL_Disconnect ();
}
/*
CL_User_f
@ -532,8 +519,7 @@ CL_Disconnect_f (void)
void
CL_User_f (void)
{
int uid;
int i;
int uid, i;
if (Cmd_Argc () != 2) {
Con_Printf ("Usage: user <username / userid>\n");
@ -554,7 +540,6 @@ CL_User_f (void)
Con_Printf ("User not in server.\n");
}
/*
CL_Users_f
@ -563,8 +548,7 @@ CL_User_f (void)
void
CL_Users_f (void)
{
int i;
int c;
int c, i;
c = 0;
Con_Printf ("userid frags name\n");
@ -580,7 +564,6 @@ CL_Users_f (void)
Con_Printf ("%i total users\n", c);
}
/*
CL_FullServerinfo_f
@ -621,14 +604,12 @@ CL_FullServerinfo_f (void)
}
}
void
CL_AddQFInfoKeys (void)
{
char cap[100] = ""; // max of 98 or so flags
// set the capabilities info. single char flags (possibly with
// modifiefs)
// set the capabilities info. single char flags (possibly with modifiefs)
// defined capabilities (* = not implemented):
// z client can accept gzipped files.
// h * http transfers
@ -649,7 +630,6 @@ CL_AddQFInfoKeys (void)
Con_Printf ("QuakeForge server detected\n");
}
void
CL_RemoveQFInfoKeys (void)
{
@ -658,7 +638,6 @@ CL_RemoveQFInfoKeys (void)
Info_RemoveKey (cls.userinfo, "*qsg_version");
}
/*
CL_FullInfo_f
@ -668,8 +647,7 @@ CL_RemoveQFInfoKeys (void)
void
CL_FullInfo_f (void)
{
char key[512];
char value[512];
char key[512], value[512];
char *o;
const char *s;
@ -710,7 +688,6 @@ CL_FullInfo_f (void)
}
}
/*
CL_SetInfo_f
@ -739,7 +716,6 @@ CL_SetInfo_f (void)
Cmd_ForwardToServer ();
}
/*
CL_Packet_f
@ -751,9 +727,9 @@ void
CL_Packet_f (void)
{
char send[2048];
int i, l;
const char *in;
char *out;
const char *in;
int i, l;
netadr_t adr;
if (Cmd_Argc () != 3) {
@ -783,7 +759,6 @@ CL_Packet_f (void)
NET_SendPacket (out - send, send, adr);
}
/*
CL_NextDemo
@ -811,7 +786,6 @@ CL_NextDemo (void)
cls.demonum++;
}
/*
CL_Changing_f
@ -831,7 +805,6 @@ CL_Changing_f (void)
Con_Printf ("\nChanging map...\n");
}
/*
CL_Reconnect_f
@ -862,7 +835,6 @@ CL_Reconnect_f (void)
CL_BeginServerConnect ();
}
/*
CL_ConnectionlessPacket
@ -881,7 +853,7 @@ CL_ConnectionlessPacket (void)
clcp_temp = 0;
if (!cls.demoplayback)
Con_Printf ("%s: ", NET_AdrToString (net_from));
// Con_DPrintf ("%s", net_message.data + 5);
// Con_DPrintf ("%s", net_message.data + 5);
if (c == S2C_CONNECTION) {
Con_Printf ("connection\n");
if (cls.state >= ca_connected) {
@ -904,9 +876,10 @@ CL_ConnectionlessPacket (void)
Con_Printf ("client command\n");
if (!cl_allow_cmd_pkt->int_val
|| ((*(unsigned int *) net_from.ip != *(unsigned int *) net_local_adr.ip
&& *(unsigned int *) net_from.ip != htonl (INADDR_LOOPBACK)))) {
if (!cl_allow_cmd_pkt->int_val ||
((*(unsigned int *) net_from.ip !=
*(unsigned int *) net_local_adr.ip
&& *(unsigned int *) net_from.ip != htonl (INADDR_LOOPBACK)))) {
Con_Printf ("Command packet from remote host. Ignored.\n");
return;
}
@ -927,8 +900,8 @@ CL_ConnectionlessPacket (void)
if (!*localid->string) {
Con_Printf ("===========================\n");
Con_Printf ("Command packet received from local host, but no "
"localid has been set. You may need to upgrade your server "
"browser.\n");
"localid has been set. You may need to upgrade "
"your server browser.\n");
Con_Printf ("===========================\n");
return;
}
@ -1000,7 +973,7 @@ CL_ConnectionlessPacket (void)
Host_EndGame ("End of demo");
else
Con_Printf ("svc_disconnect\n");
// Host_EndGame ("Server disconnected");
// Host_EndGame ("Server disconnected");
return;
}
@ -1014,7 +987,8 @@ CL_ReadPackets (void)
while (CL_GetMessage ()) {
if (cls.demoplayback && net_packetlog->int_val)
Log_Incoming_Packet(net_message->message->data,net_message->message->cursize);
Log_Incoming_Packet(net_message->message->data,
net_message->message->cursize);
// remote command packet
if (*(int *) net_message->message->data == -1) {
@ -1042,13 +1016,11 @@ CL_ReadPackets (void)
continue; // wasn't accepted for some reason
CL_ParseServerMessage ();
// if (cls.demoplayback && cls.state >= ca_active && !CL_DemoBehind())
// return;
// if (cls.demoplayback && cls.state >= ca_active && !CL_DemoBehind())
// return;
}
//
// check timeout
//
if (cls.state >= ca_connected
&& realtime - cls.netchan.last_received > cl_timeout->value) {
Con_Printf ("\nServer connection timed out.\n");
@ -1058,7 +1030,6 @@ CL_ReadPackets (void)
}
void
CL_Download_f (void)
{
@ -1072,8 +1043,8 @@ CL_Download_f (void)
return;
}
snprintf (cls.downloadname, sizeof (cls.downloadname), "%s/%s", com_gamedir,
Cmd_Argv (1));
snprintf (cls.downloadname, sizeof (cls.downloadname), "%s/%s",
com_gamedir, Cmd_Argv (1));
COM_CreatePath (cls.downloadname);
@ -1091,14 +1062,12 @@ CL_Download_f (void)
}
}
void
Force_CenterView_f (void)
{
cl.viewangles[PITCH] = 0;
}
void
CL_SetState (cactive_t state)
{
@ -1114,7 +1083,6 @@ CL_SetState (cactive_t state)
}
}
void
CL_Init (void)
{
@ -1127,7 +1095,7 @@ CL_Init (void)
Info_SetValueForKey (cls.userinfo, "bottomcolor", "0", MAX_INFO_STRING, 0);
Info_SetValueForKey (cls.userinfo, "rate", "2500", MAX_INFO_STRING, 0);
Info_SetValueForKey (cls.userinfo, "msg", "1", MAX_INFO_STRING, 0);
// snprintf (st, sizeof(st), "%s-%04d", QW_VERSION, build_number());
// snprintf (st, sizeof(st), "%s-%04d", QW_VERSION, build_number());
snprintf (st, sizeof (st), "%s", QW_VERSION);
Info_SetValueForStarKey (cls.userinfo, "*ver", st, MAX_INFO_STRING, 0);
Info_SetValueForStarKey (cls.userinfo, "stdver", QW_QSG_VERSION,
@ -1139,8 +1107,8 @@ CL_Init (void)
Pmove_Init ();
SL_Init ();
// register our commands
// register our commands
Cmd_AddCommand ("version", CL_Version_f, "Report version information");
Cmd_AddCommand ("changing", CL_Changing_f, "Used when maps are changing");
Cmd_AddCommand ("disconnect", CL_Disconnect_f, "Disconnect from server");
@ -1148,7 +1116,8 @@ CL_Init (void)
"server'");
Cmd_AddCommand ("rerecord", CL_ReRecord_f, "Rerecord a demo on the same "
"server");
Cmd_AddCommand ("snap", CL_RSShot_f, "Take a screenshot and upload it to the server");
Cmd_AddCommand ("snap", CL_RSShot_f, "Take a screenshot and upload it to "
"the server");
Cmd_AddCommand ("stop", CL_Stop_f, "Stop recording a demo");
Cmd_AddCommand ("playdemo", CL_PlayDemo_f, "Play a recorded demo");
Cmd_AddCommand ("timedemo", CL_TimeDemo_f, "Play a demo as fast as your "
@ -1186,10 +1155,9 @@ CL_Init (void)
Cmd_AddCommand ("stopul", CL_StopUpload, "Tells the client to stop "
"uploading");
Cmd_AddCommand ("force_centerview", Force_CenterView_f, "force the view to "
"be level");
// forward to server commands
Cmd_AddCommand ("force_centerview", Force_CenterView_f, "force the view "
"to be level");
// forward to server commands
Cmd_AddCommand ("kill", Cmd_ForwardToServer, "Suicide :)");
Cmd_AddCommand ("pause", Cmd_ForwardToServer, "Pause the game");
Cmd_AddCommand ("say", Cmd_ForwardToServer, "Say something to all other "
@ -1200,14 +1168,14 @@ CL_Init (void)
"server info");
}
void
CL_Init_Cvars (void)
{
cl_model_crcs = Cvar_Get ("cl_model_crcs", "1", CVAR_ARCHIVE, NULL,
"Controls setting of emodel and pmodel info vars. Required by some "
"servers, but clearing this can make the difference between "
"connecting and not connecting on some others.");
"Controls setting of emodel and pmodel info "
"vars. Required by some servers, but clearing "
"this can make the difference between "
"connecting and not connecting on some others.");
confirm_quit = Cvar_Get ("confirm_quit", "1", CVAR_ARCHIVE, NULL,
"confirm quit command");
cl_allow_cmd_pkt = Cvar_Get ("cl_allow_cmd_pkt", "1", CVAR_NONE, NULL,
@ -1215,14 +1183,14 @@ CL_Init_Cvars (void)
cl_autoexec = Cvar_Get ("cl_autoexec", "0", CVAR_ROM, NULL,
"exec autoexec.cfg on gamedir change");
cl_cshift_bonus = Cvar_Get ("cl_cshift_bonus", "1", CVAR_ARCHIVE, NULL,
"Show bonus flash on item pickup");
"Show bonus flash on item pickup");
cl_cshift_contents = Cvar_Get ("cl_cshift_content", "1", CVAR_ARCHIVE,
NULL, "Shift view colors for contents "
"(water, slime, etc)");
cl_cshift_damage = Cvar_Get ("cl_cshift_damage", "1", CVAR_ARCHIVE, NULL,
"Shift view colors on damage");
"Shift view colors on damage");
cl_cshift_powerup = Cvar_Get ("cl_cshift_powerup", "1", CVAR_ARCHIVE, NULL,
"Shift view colors for powerups");
"Shift view colors for powerups");
cl_demospeed = Cvar_Get ("cl_demospeed", "1.0", CVAR_NONE, NULL,
"adjust demo playback speed. 1.0 = normal, "
"< 1 slow-mo, > 1 timelapse");
@ -1248,7 +1216,8 @@ CL_Init_Cvars (void)
"write config files?");
cl_shownet = Cvar_Get ("cl_shownet", "0", CVAR_NONE, NULL,
"show network packets. 0=off, 1=basic, 2=verbose");
cl_sbar = Cvar_Get ("cl_sbar", "0", CVAR_ARCHIVE, CL_Sbar_f, "status bar mode");
cl_sbar = Cvar_Get ("cl_sbar", "0", CVAR_ARCHIVE, CL_Sbar_f,
"status bar mode");
cl_sbar_separator = Cvar_Get ("cl_sbar_separator", "0", CVAR_ARCHIVE, NULL,
"turns on status bar separator");
cl_hudswap = Cvar_Get ("cl_hudswap", "0", CVAR_ARCHIVE, NULL,
@ -1295,9 +1264,7 @@ CL_Init_Cvars (void)
"No description");
cl_timeframes = Cvar_Get ("cl_timeframes", "0", CVAR_ARCHIVE, NULL,
"write timestamps for every frame");
// info mirrors
//
cl_name = Cvar_Get ("name", "unnamed", CVAR_ARCHIVE | CVAR_USERINFO,
Cvar_Info, "Player name");
password = Cvar_Get ("password", "", CVAR_USERINFO, Cvar_Info,
@ -1320,7 +1287,6 @@ CL_Init_Cvars (void)
R_Particles_Init_Cvars ();
}
/*
Host_EndGame
@ -1329,8 +1295,8 @@ CL_Init_Cvars (void)
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);
@ -1344,7 +1310,6 @@ Host_EndGame (const char *message, ...)
longjmp (host_abort, 1);
}
/*
Host_Error
@ -1353,9 +1318,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");
@ -1375,7 +1340,6 @@ Host_Error (const char *error, ...)
Sys_Error ("Host_Error: %s\n", string);
}
/*
Host_WriteConfiguration
@ -1403,7 +1367,6 @@ Host_WriteConfiguration (void)
}
}
/*
Host_SimulationTime
@ -1413,9 +1376,8 @@ Host_WriteConfiguration (void)
static inline float
Host_SimulationTime (float time)
{
float fps;
float fps, timedifference;
float timescale = 1.0;
float timedifference;
if (cls.demoplayback) {
timescale = max (0, cl_demospeed->value);
@ -1438,23 +1400,24 @@ Host_SimulationTime (float time)
return 0;
}
int nopacketcount;
/*
Host_Frame
Runs all active servers
*/
int nopacketcount;
void
Host_Frame (float time)
{
static double time1 = 0;
static double time2 = 0;
static double time3 = 0;
int pass1, pass2, pass3;
float sleeptime;
int pass1, pass2, pass3;
if (setjmp (host_abort)) // something bad happened, or the server disconnected
if (setjmp (host_abort))
// something bad happened, or the server disconnected
return;
// decide the simulation time
@ -1550,13 +1513,12 @@ Host_Frame (float time)
fps_count++;
}
static int
check_quakerc (void)
{
VFile *f;
const char *l, *p;
int ret = 1;
VFile *f;
COM_FOpenFile ("quake.rc", &f);
if (!f)
@ -1573,7 +1535,6 @@ check_quakerc (void)
return ret;
}
void
Host_Init (void)
{
@ -1667,8 +1628,9 @@ Host_Init (void)
CL_TimeFrames_Init();
// Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
Con_Printf ("%4.1f megs RAM used.\n", host_parms.memsize / (1024 * 1024.0));
// Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
Con_Printf ("%4.1f megs RAM used.\n", host_parms.memsize /
(1024 * 1024.0));
vid_basepal = (byte *) COM_LoadHunkFile ("gfx/palette.lmp");
if (!vid_basepal)
@ -1712,8 +1674,8 @@ Host_Init (void)
Cmd_StuffCmds_f ();
}
Cbuf_AddText
("echo Type connect <internet address> or use a server browser to connect to a game.\n");
Cbuf_AddText ("echo Type connect <internet address> or use a server "
"browser to connect to a game.\n");
Cbuf_AddText ("cl_warncmd 1\n");
Hunk_AllocName (0, "-HOST_HUNKLEVEL-");
@ -1731,7 +1693,6 @@ Host_Init (void)
CL_UpdateScreen (realtime);
}
/*
Host_Shutdown

View file

@ -32,9 +32,10 @@
#include <stdarg.h>
#include "QF/sys.h"
#include "host.h"
#include "compat.h"
#include "QF/sys.h"
qboolean
@ -43,7 +44,6 @@ ServerPaused (void)
return false;
}
void
SV_Error (char *error, ...)
{

View file

@ -36,22 +36,22 @@
# include <strings.h>
#endif
#include "compat.h"
#include "QF/cvar.h"
#include "QF/draw.h"
#include "QF/render.h"
#include "compat.h"
#include "cl_parse.h"
#include "client.h"
#include "r_cvar.h" //XXX
#include "sbar.h"
void
CL_NetGraph (int swap)
{
int a, l, x, y, h, i;
int lost;
char st[80];
int lost, a, l, x, y, h, i;
if (!r_netgraph->int_val)
return;

View file

@ -44,7 +44,6 @@
#include "QF/cdaudio.h"
#include "QF/cmd.h"
#include "compat.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/msg.h"
@ -62,14 +61,13 @@
#include "cl_skin.h"
#include "cl_tent.h"
#include "client.h"
#include "compat.h"
#include "host.h"
#include "pmove.h"
#include "protocol.h"
#include "sbar.h"
#include "view.h"
extern cvar_t *cl_autoexec;
char *svc_strings[] = {
"svc_bad",
"svc_nop",
@ -158,13 +156,14 @@ int cl_h_playerindex, cl_gib1index, cl_gib2index, cl_gib3index;
int packet_latency[NET_TIMINGS];
extern cvar_t *cl_autoexec;
int
CL_CalcNet (void)
{
int a, i;
int lost, a, i;
frame_t *frame;
int lost;
for (i = cls.netchan.outgoing_sequence - UPDATE_BACKUP + 1;
i <= cls.netchan.outgoing_sequence; i++) {
@ -189,7 +188,6 @@ CL_CalcNet (void)
return lost * 100 / NET_TIMINGS;
}
/*
CL_CheckOrDownloadFile
@ -245,15 +243,14 @@ CL_CheckOrDownloadFile (const char *filename)
return false;
}
struct model_s **snd_worldmodel = &cl.worldmodel;
void
Model_NextDownload (void)
{
char *s;
int i;
extern char gamedirfile[];
if (cls.downloadnumber == 0) {
@ -282,7 +279,8 @@ Model_NextDownload (void)
cl.model_precache[i] = Mod_ForName (cl.model_name[i], false);
if (!cl.model_precache[i]) {
Con_Printf ("\nThe required model file '%s' could not be found or downloaded.\n\n", cl.model_name[i]);
Con_Printf ("\nThe required model file '%s' could not be found or "
"downloaded.\n\n", cl.model_name[i]);
Con_Printf ("You may need to download or purchase a %s client "
"pack in order to play on this server.\n\n",
gamedirfile);
@ -298,11 +296,13 @@ Model_NextDownload (void)
info_key = emodel_name;
if (info_key && cl_model_crcs->int_val) {
aliashdr_t *ahdr = (aliashdr_t *) Mod_Extradata (cl.model_precache[i]);
aliashdr_t *ahdr = (aliashdr_t *) Mod_Extradata
(cl.model_precache[i]);
Info_SetValueForKey (cls.userinfo, info_key, va ("%d", ahdr->crc),
MAX_INFO_STRING, 0);
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
SZ_Print (&cls.netchan.message, va ("setinfo %s %d", info_key, ahdr->crc));
SZ_Print (&cls.netchan.message, va ("setinfo %s %d", info_key,
ahdr->crc));
}
}
@ -329,7 +329,6 @@ Model_NextDownload (void)
cl.worldmodel->checksum2));
}
void
Sound_NextDownload (void)
{
@ -370,7 +369,6 @@ Sound_NextDownload (void)
va (modellist_name, cl.servercount, 0));
}
void
CL_RequestNextDownload (void)
{
@ -392,7 +390,6 @@ CL_RequestNextDownload (void)
}
}
/*
CL_ParseDownload
@ -401,10 +398,8 @@ CL_RequestNextDownload (void)
void
CL_ParseDownload (void)
{
int size, percent;
byte name[1024];
int r;
int size, percent, r;
// read the data
size = MSG_ReadShort (net_message);
@ -466,7 +461,8 @@ CL_ParseDownload (void)
}
}
Qwrite (cls.download, net_message->message->data + net_message->readcount, size);
Qwrite (cls.download, net_message->message->data + net_message->readcount,
size);
net_message->readcount += size;
if (percent != 100) {
@ -524,19 +520,14 @@ CL_ParseDownload (void)
}
}
static byte *upload_data;
static int upload_pos;
static int upload_size;
static int upload_pos, upload_size;
void
CL_NextUpload (void)
{
byte buffer[1024];
int r;
int percent;
int size;
int percent, size, r;
if (!upload_data)
return;
@ -588,7 +579,6 @@ CL_StartUpload (byte * data, int size)
CL_NextUpload ();
}
qboolean
CL_IsUploading (void)
{
@ -597,7 +587,6 @@ CL_IsUploading (void)
return false;
}
void
CL_StopUpload (void)
{
@ -606,29 +595,24 @@ CL_StopUpload (void)
upload_data = NULL;
}
/*
SERVER CONNECTING MESSAGES
*/
/* SERVER CONNECTING MESSAGES */
void Draw_ClearCache (void);
void CL_ClearBaselines (void); // LordHavoc: BIG BUG-FIX!
// FIXME: Evil hack that doesn't deserve to see the light of day.
// (pending merge of nq and qw client_stat_t's)
int snd_viewentity;
void
CL_ParseServerData (void)
{
char *str;
char fn[MAX_OSPATH];
qboolean cflag = false;
extern char gamedirfile[MAX_OSPATH];
char *str;
int protover;
qboolean cflag = false;
extern char gamedirfile[MAX_OSPATH];
Con_DPrintf ("Serverdata packet received.\n");
@ -641,9 +625,9 @@ CL_ParseServerData (void)
if (protover != PROTOCOL_VERSION &&
!(cls.demoplayback
&& (protover <= 26 && protover >= 28)))
Host_EndGame
("Server returned version %i, not %i\nYou probably need to upgrade.\nCheck http://www.quakeworld.net/",
protover, PROTOCOL_VERSION);
Host_EndGame ("Server returned version %i, not %i\nYou probably "
"need to upgrade.\nCheck http://www.quakeworld.net/",
protover, PROTOCOL_VERSION);
cl.servercount = MSG_ReadLong (net_message);
@ -701,7 +685,8 @@ CL_ParseServerData (void)
movevars.entgravity = MSG_ReadFloat (net_message);
// 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);
// ask for the sound list next
@ -716,7 +701,6 @@ CL_ParseServerData (void)
CL_ClearBaselines ();
}
// LordHavoc: BIG BUG-FIX! Clear baselines each time it connects...
void
CL_ClearBaselines (void)
@ -733,13 +717,11 @@ CL_ClearBaselines (void)
}
}
void
CL_ParseSoundlist (void)
{
int numsounds;
char *str;
int n;
int numsounds, n;
// precache sounds
// memset (cl.sound_precache, 0, sizeof(cl.sound_precache));
@ -770,13 +752,11 @@ CL_ParseSoundlist (void)
Sound_NextDownload ();
}
void
CL_ParseModellist (void)
{
int nummodels;
int nummodels, n;
char *str;
int n;
// precache models and note certain default indexes
nummodels = MSG_ReadByte (net_message);
@ -821,7 +801,6 @@ CL_ParseModellist (void)
Model_NextDownload ();
}
void
CL_ParseBaseline (entity_state_t *es)
{
@ -844,7 +823,6 @@ CL_ParseBaseline (entity_state_t *es)
es->colormod = 255;
}
/*
CL_ParseStatic
@ -875,13 +853,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);
@ -892,21 +868,14 @@ CL_ParseStaticSound (void)
S_StaticSound (cl.sound_precache[sound_num], org, vol, atten);
}
/*
ACTION MESSAGES
*/
/* ACTION MESSAGES */
void
CL_ParseStartSoundPacket (void)
{
vec3_t pos;
int channel, ent;
int sound_num;
int volume;
float attenuation;
int i;
int channel, ent, sound_num, volume, i;
vec3_t pos;
channel = MSG_ReadShort (net_message);
@ -935,7 +904,6 @@ CL_ParseStartSoundPacket (void)
volume / 255.0, attenuation);
}
/*
CL_ParseClientdata
@ -944,9 +912,9 @@ CL_ParseStartSoundPacket (void)
void
CL_ParseClientdata (void)
{
int i;
float latency;
frame_t *frame;
int i;
// calculate simulated time of message
oldparsecountmod = parsecountmod;
@ -974,7 +942,6 @@ CL_ParseClientdata (void)
}
}
void
CL_ProcessUserInfo (int slot, player_info_t *player)
{
@ -996,11 +963,10 @@ CL_ProcessUserInfo (int slot, player_info_t *player)
//XXX CL_NewTranslation (slot);
}
void
CL_UpdateUserinfo (void)
{
int slot;
int slot;
player_info_t *player;
slot = MSG_ReadByte (net_message);
@ -1016,14 +982,12 @@ CL_UpdateUserinfo (void)
CL_ProcessUserInfo (slot, player);
}
void
CL_SetInfo (void)
{
char key[MAX_MSGLEN], value[MAX_MSGLEN];
int slot;
player_info_t *player;
char key[MAX_MSGLEN];
char value[MAX_MSGLEN];
slot = MSG_ReadByte (net_message);
if (slot >= MAX_CLIENTS)
@ -1045,12 +1009,10 @@ CL_SetInfo (void)
CL_ProcessUserInfo (slot, player);
}
void
CL_ServerInfo (void)
{
char key[MAX_MSGLEN];
char value[MAX_MSGLEN];
char key[MAX_MSGLEN], value[MAX_MSGLEN];
strncpy (key, MSG_ReadString (net_message), sizeof (key) - 1);
key[sizeof (key) - 1] = 0;
@ -1062,7 +1024,6 @@ CL_ServerInfo (void)
Info_SetValueForKey (cl.serverinfo, key, value, MAX_SERVERINFO_STRING, 0);
}
void
CL_SetStat (int stat, int value)
{
@ -1090,14 +1051,13 @@ CL_SetStat (int stat, int value)
cl.stats[stat] = value;
}
void
CL_MuzzleFlash (void)
{
vec3_t fv, rv, uv;
dlight_t *dl;
int i;
player_state_t *pl;
vec3_t fv, rv, uv;
i = MSG_ReadShort (net_message);
@ -1123,18 +1083,15 @@ CL_MuzzleFlash (void)
dl->color[2] = 0.05;
}
#define SHOWNET(x) if (cl_shownet->int_val == 2) Con_Printf ("%3i:%s\n", net_message->readcount-1, x);
int received_framecount;
void
CL_ParseServerMessage (void)
{
int cmd;
char *s;
int i, j;
int cmd, i, j;
received_framecount = host_framecount;
cl.last_servermessage = realtime;
@ -1146,7 +1103,6 @@ CL_ParseServerMessage (void)
else if (cl_shownet->int_val == 2)
Con_Printf ("------------------\n");
CL_ParseClientdata ();
// parse the message
@ -1255,24 +1211,24 @@ CL_ParseServerMessage (void)
Sbar_Changed ();
i = MSG_ReadByte (net_message);
if (i >= MAX_CLIENTS)
Host_EndGame
("CL_ParseServerMessage: svc_updatefrags > MAX_SCOREBOARD");
Host_EndGame ("CL_ParseServerMessage: svc_updatefrags > "
"MAX_SCOREBOARD");
cl.players[i].frags = MSG_ReadShort (net_message);
break;
case svc_updateping:
i = MSG_ReadByte (net_message);
if (i >= MAX_CLIENTS)
Host_EndGame
("CL_ParseServerMessage: svc_updateping > MAX_SCOREBOARD");
Host_EndGame ("CL_ParseServerMessage: svc_updateping > "
"MAX_SCOREBOARD");
cl.players[i].ping = MSG_ReadShort (net_message);
break;
case svc_updatepl:
i = MSG_ReadByte (net_message);
if (i >= MAX_CLIENTS)
Host_EndGame
("CL_ParseServerMessage: svc_updatepl > MAX_SCOREBOARD");
Host_EndGame ("CL_ParseServerMessage: svc_updatepl > "
"MAX_SCOREBOARD");
cl.players[i].pl = MSG_ReadByte (net_message);
break;
@ -1280,9 +1236,10 @@ CL_ParseServerMessage (void)
// time is sent over as seconds ago
i = MSG_ReadByte (net_message);
if (i >= MAX_CLIENTS)
Host_EndGame
("CL_ParseServerMessage: svc_updateentertime > MAX_SCOREBOARD");
cl.players[i].entertime = realtime - MSG_ReadFloat (net_message);
Host_EndGame ("CL_ParseServerMessage: svc_updateentertime "
"> MAX_SCOREBOARD");
cl.players[i].entertime = realtime - MSG_ReadFloat
(net_message);
break;
case svc_spawnbaseline:

View file

@ -52,7 +52,6 @@ void
CL_PredictUsercmd (player_state_t * from, player_state_t * to, usercmd_t *u,
qboolean spectator)
{
// Dabb: if there is no movement to start with, don't predict...
if(cl_nostatpred->int_val && !from->velocity[0] &&
!from->velocity[1] && !from->velocity[2]) {
@ -101,14 +100,12 @@ CL_PredictUsercmd (player_state_t * from, player_state_t * to, usercmd_t *u,
to->weaponframe = from->weaponframe;
}
void
CL_PredictMove (void)
{
int i;
float f;
frame_t *from, *to = NULL;
int oldphysent;
int oldphysent, i;
if (cl_pushlatency->value > 0)
Cvar_Set (cl_pushlatency, "0");
@ -150,8 +147,7 @@ CL_PredictMove (void)
return;
}
// Dabb: if there is no movement to start with, don't predict...
// Dabb: if there is no movement to start with, don't predict...
if(cl_nostatpred->int_val && !from->playerstate[cl.playernum].velocity[0]
&& !from->playerstate[cl.playernum].velocity[1]
&& !from->playerstate[cl.playernum].velocity[2]) {
@ -216,12 +212,11 @@ CL_PredictMove (void)
}
}
void
CL_Prediction_Init_Cvars (void)
{
cl_pushlatency = Cvar_Get ("pushlatency", "-999", CVAR_NONE, NULL,
"How much prediction should the client make");
"How much prediction should the client make");
cl_nopred = Cvar_Get ("cl_nopred", "0", CVAR_NONE, NULL,
"Set to turn off client prediction");
cl_nostatpred = Cvar_Get ("cl_nostatpred", "0", CVAR_NONE, NULL,

View file

@ -130,11 +130,11 @@ CL_UpdateScreen (double realtime)
void
CL_RSShot_f (void)
{
tex_t *tex = 0;
pcx_t *pcx = 0;
char st[128];
time_t now;
int pcx_len;
pcx_t *pcx = 0;
tex_t *tex = 0;
time_t now;
if (CL_IsUploading ())
return; // already one pending
@ -149,17 +149,21 @@ CL_RSShot_f (void)
time (&now);
strcpy (st, ctime (&now));
st[strlen (st) - 1] = 0;
SCR_DrawStringToSnap (st, tex, tex->width - strlen (st) * 8, tex->height - 1);
SCR_DrawStringToSnap (st, tex, tex->width - strlen (st) * 8,
tex->height - 1);
strncpy (st, cls.servername, sizeof (st));
st[sizeof (st) - 1] = 0;
SCR_DrawStringToSnap (st, tex, tex->width - strlen (st) * 8, tex->height - 11);
SCR_DrawStringToSnap (st, tex, tex->width - strlen (st) * 8,
tex->height - 11);
strncpy (st, cl_name->string, sizeof (st));
st[sizeof (st) - 1] = 0;
SCR_DrawStringToSnap (st, tex, tex->width - strlen (st) * 8, tex->height - 21);
SCR_DrawStringToSnap (st, tex, tex->width - strlen (st) * 8,
tex->height - 21);
pcx = EncodePCX (tex->data, tex->width, tex->height, tex->width, vid_basepal, true, &pcx_len);
pcx = EncodePCX (tex->data, tex->width, tex->height, tex->width,
vid_basepal, true, &pcx_len);
}
if (pcx) {
CL_StartUpload ((void *)pcx, pcx_len);

View file

@ -37,7 +37,6 @@
#endif
#include "QF/cmd.h"
#include "compat.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/msg.h"
@ -47,6 +46,7 @@
#include "cl_parse.h"
#include "cl_skin.h"
#include "client.h"
#include "compat.h"
#include "host.h"
cvar_t *noskins; //XXX FIXME
@ -60,8 +60,8 @@ char allskins[128];
void
Skin_NextDownload (void)
{
player_info_t *sc;
int i;
player_info_t *sc;
if (cls.downloadnumber == 0) {
Con_Printf ("Checking skins...\n");
@ -96,12 +96,12 @@ Skin_NextDownload (void)
if (cls.state != ca_active) { // get next signon phase
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
MSG_WriteString (&cls.netchan.message, va ("begin %i", cl.servercount));
MSG_WriteString (&cls.netchan.message, va ("begin %i",
cl.servercount));
Cache_Report (); // print remaining memory
}
}
/*
CL_Skins_f
@ -116,7 +116,6 @@ CL_Skins_f (void)
Skin_NextDownload ();
}
/*
CL_AllSkins_f
@ -129,13 +128,12 @@ CL_AllSkins_f (void)
CL_Skins_f ();
}
void
CL_Color_f (void)
{
// just for quake compatability...
int top, bottom;
char num[16];
int top, bottom;
if (Cmd_Argc () == 1) {
Con_Printf ("\"color\" is \"%s %s\"\n",
@ -165,7 +163,6 @@ CL_Color_f (void)
Cvar_Set (bottomcolor, num);
}
void
CL_Skin_Init (void)
{
@ -179,7 +176,6 @@ CL_Skin_Init (void)
"pants will match");
}
void
CL_Skin_Init_Cvars (void)
{
@ -194,12 +190,11 @@ CL_Skin_Init_Cvars (void)
Cvar_Info, "Players color on bottom");
}
void
CL_NewTranslation (int slot, skin_t *skin)
{
player_info_t *player;
char s[512];
player_info_t *player;
if (slot > MAX_CLIENTS)
Host_EndGame ("CL_NewTranslation: slot > MAX_CLIENTS");
@ -223,12 +218,14 @@ CL_NewTranslation (int slot, skin_t *skin)
if (!player->skin)
Skin_Find (player);
memcpy (skin, player->skin, sizeof (*skin));
skin->texture = skin_textures + slot; //FIXME
skin->data.texels = Skin_Cache(player->skin); //FIXME the breaks cache ownership
skin->texture = skin_textures + slot; // FIXME
skin->data.texels = Skin_Cache(player->skin);
// FIXME: breaks cache ownership
Skin_Do_Translation (player->skin, slot, skin);
} else {
memcpy (skin, player->skin, sizeof (*skin));
skin->texture = skin_textures + slot; //FIXME
skin->data.texels = Skin_Cache(player->skin); //FIXME the breaks cache ownership
skin->texture = skin_textures + slot; // FIXME
skin->data.texels = Skin_Cache(player->skin);
// FIXME: breaks cache ownership
}
}

View file

@ -33,9 +33,6 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
@ -54,6 +51,10 @@
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#include <ctype.h>
#include <stdlib.h>
@ -92,6 +93,7 @@ cvar_t *sl_filter;
cvar_t *sl_game;
cvar_t *sl_ping;
void
S_Refresh (server_entry_t *slrefresh)
{
@ -110,7 +112,6 @@ S_Refresh (server_entry_t *slrefresh)
slrefresh->waitstatus = 1;
}
server_entry_t *
SL_Add (server_entry_t *start, char *ip, char *desc)
{
@ -177,8 +178,7 @@ SL_Del (server_entry_t *start, server_entry_t *del)
server_entry_t *
SL_InsB (server_entry_t *start, server_entry_t *place, char *ip, char *desc)
{
server_entry_t *new;
server_entry_t *other;
server_entry_t *new, *other;
new = calloc (1, sizeof (server_entry_t));
@ -200,8 +200,8 @@ SL_InsB (server_entry_t *start, server_entry_t *place, char *ip, char *desc)
void
SL_Swap (server_entry_t *swap1, server_entry_t *swap2)
{
server_entry_t *next1, *next2, *prev1, *prev2;
int i;
server_entry_t *next1, *next2, *prev1, *prev2;
next1 = swap1->next;
next2 = swap2->next;
@ -302,8 +302,8 @@ SL_SaveF (VFile *f, server_entry_t *start)
void
SL_Shutdown (void)
{
VFile *f;
char e_path[MAX_OSPATH];
VFile *f;
if (fav_slist) {
Qexpand_squiggle (fs_userpath->string, e_path);
@ -317,12 +317,10 @@ SL_Shutdown (void)
SL_Del_All (all_slist);
}
char *
gettokstart (char *str, int req, char delim)
{
char *start = str;
int tok = 1;
while (*start == delim) {
@ -349,7 +347,6 @@ int
gettoklen (char *str, int req, char delim)
{
char *start = 0;
int len = 0;
start = gettokstart (str, req, delim);
@ -371,8 +368,8 @@ void timepassed (double time1, double *time2)
void
SL_SortEntry (server_entry_t *start)
{
server_entry_t *q;
int i = 0;
server_entry_t *q;
if (!start || !sl_sortby)
return;
@ -381,7 +378,8 @@ SL_SortEntry (server_entry_t *start)
{
if (sl_sortby->int_val)
{
if ((q->pongback) && (start->pongback) && (start->pongback > q->pongback))
if ((q->pongback) && (start->pongback) && (start->pongback >
q->pongback))
{
SL_Swap(start,q);
q = start;
@ -389,7 +387,8 @@ SL_SortEntry (server_entry_t *start)
} else {
i = 0;
while ((start->desc[i] != '\0') && (q->desc[i] != '\0') && (toupper(start->desc[i]) == toupper(q->desc[i])))
while ((start->desc[i] != '\0') && (q->desc[i] != '\0') &&
(toupper(start->desc[i]) == toupper(q->desc[i])))
i++;
if (toupper(start->desc[i]) > toupper(q->desc[i]))
{
@ -459,6 +458,7 @@ SL_Con_Details (server_entry_t *sldata, int slitemno)
{
int i, playercount;
server_entry_t *cp;
playercount = 0;
slist_last_details = slitemno;
cp = SL_Get_By_Num (sldata, (slitemno - 1));
@ -478,7 +478,8 @@ SL_Con_Details (server_entry_t *sldata, int slitemno)
for (i = 0; i < strlen(cp->status); i++)
if (cp->status[i] == '\n')
playercount++;
Con_Printf("Players: %i/%s\n", playercount, Info_ValueForKey(cp->status, "maxclients"));
Con_Printf("Players: %i/%s\n", playercount,
Info_ValueForKey(cp->status, "maxclients"));
// For Debug of Server Info
// Con_Printf("%s\n",cp->status);
@ -489,8 +490,8 @@ SL_Con_Details (server_entry_t *sldata, int slitemno)
void
SL_MasterUpdate(void)
{
netadr_t addy;
char data[] = "c\n\0";
netadr_t addy;
SL_Del_All(slist);
slist = NULL;
@ -555,8 +556,9 @@ SL_Command (void)
if (Cmd_Argc () == 2)
{
if(!which_slist)
Con_Printf("ERROR: This of for updating the servers from a list of masters\n");
else
Con_Printf("ERROR: This of for updating the servers from a "
"list of masters\n");
else
SL_MasterUpdate();
}
else
@ -589,6 +591,7 @@ void
MSL_ParseServerList(const char *msl_data)
{
int msl_ptr;
for (msl_ptr = 0; msl_ptr < strlen(msl_data); msl_ptr = msl_ptr + 6)
{
slist = SL_Add(slist, va("%i.%i.%i.%i:%i",
@ -604,12 +607,10 @@ server_entry_t *
SL_LoadF (VFile *f, server_entry_t *start)
{
//This could get messy
char line[256]; /* Long lines get truncated. */
int c = ' '; /* int so it can be compared to EOF properly */
int len;
int i;
char *st;
char *addr;
char line[256]; /* Long lines get truncated. */
char *addr, *st;
int len, i;
int c = ' '; /* int so it can be compared to EOF properly */
while (1) {
// First, get a line
@ -641,8 +642,8 @@ SL_LoadF (VFile *f, server_entry_t *start)
void SL_Init (void)
{
VFile *servlist;
char e_path[MAX_OSPATH];
VFile *servlist;
Qexpand_squiggle (fs_userpath->string, e_path);
if ((servlist = Qopen (va ("%s/servers.txt", e_path), "r"))) {
@ -658,18 +659,23 @@ void SL_Init (void)
fav_slist = slist;
all_slist = NULL;
which_slist = 0;
Cmd_AddCommand("slist",SL_Command,"console commands to access server list\n");
sl_sortby = Cvar_Get ("sl_sortby", "0", CVAR_ARCHIVE, SL_Sort, "0 = sort by name, 1 = sort by ping");
sl_filter = Cvar_Get ("sl_filter", "0", CVAR_NONE, NULL, "enable server filter");
sl_game = Cvar_Get ("sl_game", "", CVAR_ARCHIVE, NULL, "sets the serverlist game filter");
sl_ping = Cvar_Get ("sl_ping", "", CVAR_ARCHIVE, NULL, "sets the serverlist ping filter");
Cmd_AddCommand("slist",SL_Command,"console commands to access server "
"list\n");
sl_sortby = Cvar_Get ("sl_sortby", "0", CVAR_ARCHIVE, SL_Sort, "0 = sort "
"by name, 1 = sort by ping");
sl_filter = Cvar_Get ("sl_filter", "0", CVAR_NONE, NULL, "enable server "
"filter");
sl_game = Cvar_Get ("sl_game", "", CVAR_ARCHIVE, NULL, "sets the "
"serverlist game filter");
sl_ping = Cvar_Get ("sl_ping", "", CVAR_ARCHIVE, NULL, "sets the "
"serverlist ping filter");
}
int
SL_CheckStatus (const char *cs_from, const char *cs_data)
{
server_entry_t *temp;
const char *tmp_desc;
server_entry_t *temp;
for (temp = slist; temp; temp = temp->next)
if (temp->waitstatus)
@ -714,4 +720,3 @@ SL_CheckPing (const char *cp_from)
}
}
}

View file

@ -29,18 +29,18 @@
#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_CONIO_H
# include <conio.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

View file

@ -192,10 +192,9 @@ int skipframes;
int
main (int c, const char *v[])
{
int j;
double time, oldtime, newtime;
// static char cwd[1024];
double time, oldtime, newtime;
int j;
// signal(SIGFPE, floating_point_exception_handler);
signal (SIGFPE, SIG_IGN);

View file

@ -76,13 +76,13 @@ HANDLE qwclsemaphore;
static HANDLE hinput, houtput, tevent;
extern cvar_t *sys_nostdout;
void MaskExceptions (void);
void Sys_PopFPCW (void);
void Sys_PushFPCW_SetHigh (void);
void Sys_InitFloatTime (void);
extern cvar_t *sys_nostdout;
/*
Sys_Init_Cvars
@ -218,12 +218,12 @@ const char *
Sys_ConsoleInput (void)
{
char *clipText, *textCopied;
int ch, i; // , count;
static char text[256];
int ch, i; // , count;
static int len;
INPUT_RECORD recs[1024];
DWORD numread, numevents, dummy;
HANDLE th;
INPUT_RECORD recs[1024];
for (;;) {
if (!GetNumberOfConsoleInputEvents (hinput, &numevents))
@ -342,8 +342,8 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
{
// MSG msg;
static char cwd[1024];
int t;
double time, oldtime, newtime;
int t;
MEMORYSTATUS lpBuffer;
#ifdef SPLASH_SCREEN
RECT rect;

View file

@ -75,7 +75,6 @@ typedef struct {
explosion_t cl_explosions[MAX_EXPLOSIONS];
sfx_t *cl_sfx_wizhit;
sfx_t *cl_sfx_knighthit;
sfx_t *cl_sfx_tink1;
@ -110,6 +109,7 @@ static const particle_effect_t prot_to_rend[]={
PE_UNKNOWN, // TE_BEAM
};
void
CL_TEnts_Init (void)
{
@ -127,7 +127,6 @@ CL_TEnts_Init (void)
cl_spr_explod = Mod_ForName ("progs/s_explod.spr", true);
}
void
CL_Init_Entity (entity_t *ent)
{
@ -142,7 +141,6 @@ CL_Init_Entity (entity_t *ent)
ent->pose1 = ent->pose2 = -1;
}
void
CL_ClearTEnts (void)
{
@ -161,13 +159,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)
@ -184,14 +180,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);
@ -229,17 +223,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;
byte type;
dlight_t *dl;
explosion_t *ex;
int cnt = -1;
int colorStart, colorLength, rnd;
int cnt = -1;
vec3_t pos;
type = MSG_ReadByte (net_message);
switch (type) {
@ -404,13 +396,11 @@ 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;
unsigned seed;
// update lightning
@ -442,7 +432,8 @@ CL_UpdateBeams (void)
pitch += 360;
}
seed = b->seed + ((int)(cl.time * BEAM_SEED_INTERVAL) % BEAM_SEED_INTERVAL);
seed = b->seed + ((int)(cl.time * BEAM_SEED_INTERVAL) %
BEAM_SEED_INTERVAL);
// add new entities for the lightning
VectorCopy (b->start, org);
@ -466,14 +457,12 @@ CL_UpdateBeams (void)
}
}
void
CL_UpdateExplosions (void)
{
int i;
int f;
explosion_t *ex;
int f, i;
entity_t **ent;
explosion_t *ex;
for (i = 0, ex = cl_explosions; i < MAX_EXPLOSIONS; i++, ex++) {
if (!ex->ent.model)
@ -492,7 +481,6 @@ CL_UpdateExplosions (void)
}
}
void
CL_UpdateTEnts (void)
{

View file

@ -53,12 +53,6 @@
especially when crossing a water boudnary.
*/
extern cvar_t *cl_cshift_bonus;
extern cvar_t *cl_cshift_contents;
extern cvar_t *cl_cshift_damage;
extern cvar_t *cl_cshift_powerup;
extern cvar_t *vid_gamma;
cvar_t *cl_rollspeed;
cvar_t *cl_rollangle;
@ -96,14 +90,18 @@ cshift_t cshift_slime = { {0, 25, 5}, 150};
cshift_t cshift_lava = { {255, 80, 0}, 150};
cshift_t cshift_bonus = { {215, 186, 60}, 50};
extern cvar_t *cl_cshift_bonus;
extern cvar_t *cl_cshift_contents;
extern cvar_t *cl_cshift_damage;
extern cvar_t *cl_cshift_powerup;
extern cvar_t *vid_gamma;
float
V_CalcRoll (vec3_t angles, vec3_t velocity)
{
float side, sign, value;
vec3_t forward, right, up;
float sign;
float side;
float value;
AngleVectors (angles, forward, right, up);
side = DotProduct (velocity, right);
@ -120,13 +118,12 @@ V_CalcRoll (vec3_t angles, vec3_t velocity)
return side * sign;
}
float
V_CalcBob (void)
{
static double bobtime;
static float bob;
float cycle;
float cycle;
static float bob;
if (cl.spectator)
return 0;
@ -135,7 +132,8 @@ V_CalcBob (void)
return bob; // just use old value
bobtime += host_frametime;
cycle = bobtime - (int) (bobtime / cl_bobcycle->value) * cl_bobcycle->value;
cycle = bobtime - (int) (bobtime / cl_bobcycle->value) *
cl_bobcycle->value;
cycle /= cl_bobcycle->value;
if (cycle < cl_bobup->value)
cycle = M_PI * cycle / cl_bobup->value;
@ -243,19 +241,14 @@ V_DriftPitch (void)
}
}
/*
PALETTE FLASHES
*/
/* PALETTE FLASHES */
void
V_ParseDamage (void)
{
int armor, blood;
vec3_t from;
int i;
vec3_t forward, right, up;
float side;
float count;
float count, side;
int armor, blood, i;
vec3_t forward, from, right, up;
armor = MSG_ReadByte (net_message);
blood = MSG_ReadByte (net_message);
@ -415,8 +408,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++) {
@ -466,7 +459,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];
}
@ -489,9 +483,7 @@ V_PrepBlend (void)
V_CalcBlend();
}
/*
VIEW RENDERING
*/
/* VIEW RENDERING */
float
angledelta (float a)
@ -506,8 +498,7 @@ void
CalcGunAngle (void)
{
float yaw, pitch, move;
static float oldyaw = 0;
static float oldpitch = 0;
static float oldpitch = 0, oldyaw = 0;
yaw = r_refdef.viewangles[YAW];
pitch = -r_refdef.viewangles[PITCH];
@ -631,11 +622,11 @@ void
V_CalcRefdef (void)
{
entity_t *view;
int i;
vec3_t forward, right, up;
float bob;
static float oldz = 0;
int i;
int zofs = 22;
vec3_t forward, right, up;
if (cl.stdver)
zofs = cl.stats[STAT_VIEWHEIGHT];