mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-10 14:52:08 +00:00
host_frametime --> sv_frametime for server;
CVAR_FIXME cleanup.
This commit is contained in:
parent
5096ce59c3
commit
3644a3056e
8 changed files with 27 additions and 74 deletions
|
@ -57,7 +57,7 @@ extern cvar_t *sys_nostdout;
|
||||||
extern cvar_t *developer;
|
extern cvar_t *developer;
|
||||||
|
|
||||||
extern qboolean host_initialized; /* True if into command execution. */
|
extern qboolean host_initialized; /* True if into command execution. */
|
||||||
extern double host_frametime;
|
//extern double host_frametime;
|
||||||
extern double realtime; /* Not bounded in any way, changed at
|
extern double realtime; /* Not bounded in any way, changed at
|
||||||
start of every frame, never reset */
|
start of every frame, never reset */
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,8 @@ extern qboolean noclip_anglehack;
|
||||||
extern cvar_t *sys_ticrate;
|
extern cvar_t *sys_ticrate;
|
||||||
extern cvar_t *password;
|
extern cvar_t *password;
|
||||||
|
|
||||||
|
extern double host_frametime; // Tonik
|
||||||
|
|
||||||
extern byte *host_basepal;
|
extern byte *host_basepal;
|
||||||
extern byte *host_colormap;
|
extern byte *host_colormap;
|
||||||
extern int host_framecount; // incremented every frame, never reset
|
extern int host_framecount; // incremented every frame, never reset
|
||||||
|
|
|
@ -364,6 +364,8 @@ extern int host_hunklevel;
|
||||||
extern FILE *sv_logfile;
|
extern FILE *sv_logfile;
|
||||||
extern FILE *sv_fraglogfile;
|
extern FILE *sv_fraglogfile;
|
||||||
|
|
||||||
|
extern double sv_frametime;
|
||||||
|
|
||||||
//===========================================================
|
//===========================================================
|
||||||
// FIXME: declare exported functions in their own relevant .h
|
// FIXME: declare exported functions in their own relevant .h
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "r_local.h"
|
#include "r_local.h"
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
#include "commdef.h"
|
#include "commdef.h"
|
||||||
|
#include "quakedef.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|
|
@ -411,7 +411,7 @@ void SV_SpawnServer (char *server)
|
||||||
sv.state = ss_active;
|
sv.state = ss_active;
|
||||||
|
|
||||||
// run two frames to allow everything to settle
|
// run two frames to allow everything to settle
|
||||||
host_frametime = 0.1;
|
sv_frametime = 0.1;
|
||||||
SV_Physics ();
|
SV_Physics ();
|
||||||
SV_Physics ();
|
SV_Physics ();
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ quakeparms_t host_parms;
|
||||||
|
|
||||||
qboolean host_initialized; // true if into command execution (compatability)
|
qboolean host_initialized; // true if into command execution (compatability)
|
||||||
|
|
||||||
double host_frametime;
|
double sv_frametime;
|
||||||
double realtime; // without any filtering or bounding
|
double realtime; // without any filtering or bounding
|
||||||
|
|
||||||
int host_hunklevel;
|
int host_hunklevel;
|
||||||
|
|
|
@ -56,36 +56,16 @@ solid_edge items only clip against bsp models.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* cvar_t sv_maxvelocity = {"sv_maxvelocity","2000"};
|
|
||||||
CVAR_FIXME */
|
|
||||||
cvar_t *sv_maxvelocity;
|
cvar_t *sv_maxvelocity;
|
||||||
|
|
||||||
/* cvar_t sv_gravity = { "sv_gravity", "800"};
|
|
||||||
CVAR_FIXME */
|
|
||||||
cvar_t *sv_gravity;
|
cvar_t *sv_gravity;
|
||||||
/* cvar_t sv_stopspeed = { "sv_stopspeed", "100"};
|
|
||||||
CVAR_FIXME */
|
|
||||||
cvar_t *sv_stopspeed;
|
cvar_t *sv_stopspeed;
|
||||||
/* cvar_t sv_maxspeed = { "sv_maxspeed", "320"};
|
|
||||||
CVAR_FIXME */
|
|
||||||
cvar_t *sv_maxspeed;
|
cvar_t *sv_maxspeed;
|
||||||
/* cvar_t sv_spectatormaxspeed = { "sv_spectatormaxspeed", "500"};
|
|
||||||
CVAR_FIXME */
|
|
||||||
cvar_t *sv_spectatormaxspeed;
|
cvar_t *sv_spectatormaxspeed;
|
||||||
/* cvar_t sv_accelerate = { "sv_accelerate", "10"};
|
|
||||||
CVAR_FIXME */
|
|
||||||
cvar_t *sv_accelerate;
|
cvar_t *sv_accelerate;
|
||||||
/* cvar_t sv_airaccelerate = { "sv_airaccelerate", "0.7"};
|
|
||||||
CVAR_FIXME */
|
|
||||||
cvar_t *sv_airaccelerate;
|
cvar_t *sv_airaccelerate;
|
||||||
/* cvar_t sv_wateraccelerate = { "sv_wateraccelerate", "10"};
|
|
||||||
CVAR_FIXME */
|
|
||||||
cvar_t *sv_wateraccelerate;
|
cvar_t *sv_wateraccelerate;
|
||||||
/* cvar_t sv_friction = { "sv_friction", "4"};
|
|
||||||
CVAR_FIXME */
|
|
||||||
cvar_t *sv_friction;
|
cvar_t *sv_friction;
|
||||||
/* cvar_t sv_waterfriction = { "sv_waterfriction", "4"};
|
|
||||||
CVAR_FIXME */
|
|
||||||
cvar_t *sv_waterfriction;
|
cvar_t *sv_waterfriction;
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,17 +123,9 @@ void SV_CheckVelocity (edict_t *ent)
|
||||||
Con_Printf ("Got a NaN origin on %s\n", PR_GetString(ent->v.classname));
|
Con_Printf ("Got a NaN origin on %s\n", PR_GetString(ent->v.classname));
|
||||||
ent->v.origin[i] = 0;
|
ent->v.origin[i] = 0;
|
||||||
}
|
}
|
||||||
/* if (ent->v.velocity[i] > sv_maxvelocity.value)
|
|
||||||
CVAR_FIXME */
|
|
||||||
if (ent->v.velocity[i] > sv_maxvelocity->value)
|
if (ent->v.velocity[i] > sv_maxvelocity->value)
|
||||||
/* ent->v.velocity[i] = sv_maxvelocity.value;
|
|
||||||
CVAR_FIXME */
|
|
||||||
ent->v.velocity[i] = sv_maxvelocity->value;
|
ent->v.velocity[i] = sv_maxvelocity->value;
|
||||||
/* else if (ent->v.velocity[i] < -sv_maxvelocity.value)
|
|
||||||
CVAR_FIXME */
|
|
||||||
else if (ent->v.velocity[i] < -sv_maxvelocity->value)
|
else if (ent->v.velocity[i] < -sv_maxvelocity->value)
|
||||||
/* ent->v.velocity[i] = -sv_maxvelocity.value;
|
|
||||||
CVAR_FIXME */
|
|
||||||
ent->v.velocity[i] = -sv_maxvelocity->value;
|
ent->v.velocity[i] = -sv_maxvelocity->value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,7 +149,7 @@ qboolean SV_RunThink (edict_t *ent)
|
||||||
thinktime = ent->v.nextthink;
|
thinktime = ent->v.nextthink;
|
||||||
if (thinktime <= 0)
|
if (thinktime <= 0)
|
||||||
return true;
|
return true;
|
||||||
if (thinktime > sv.time + host_frametime)
|
if (thinktime > sv.time + sv_frametime)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (thinktime < sv.time)
|
if (thinktime < sv.time)
|
||||||
|
@ -421,7 +393,7 @@ SV_AddGravity
|
||||||
*/
|
*/
|
||||||
void SV_AddGravity (edict_t *ent, float scale)
|
void SV_AddGravity (edict_t *ent, float scale)
|
||||||
{
|
{
|
||||||
ent->v.velocity[2] -= scale * movevars.gravity * host_frametime;
|
ent->v.velocity[2] -= scale * movevars.gravity * sv_frametime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -635,14 +607,14 @@ float l;
|
||||||
oldltime = ent->v.ltime;
|
oldltime = ent->v.ltime;
|
||||||
|
|
||||||
thinktime = ent->v.nextthink;
|
thinktime = ent->v.nextthink;
|
||||||
if (thinktime < ent->v.ltime + host_frametime)
|
if (thinktime < ent->v.ltime + sv_frametime)
|
||||||
{
|
{
|
||||||
movetime = thinktime - ent->v.ltime;
|
movetime = thinktime - ent->v.ltime;
|
||||||
if (movetime < 0)
|
if (movetime < 0)
|
||||||
movetime = 0;
|
movetime = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
movetime = host_frametime;
|
movetime = sv_frametime;
|
||||||
|
|
||||||
if (movetime)
|
if (movetime)
|
||||||
{
|
{
|
||||||
|
@ -700,8 +672,8 @@ void SV_Physics_Noclip (edict_t *ent)
|
||||||
if (!SV_RunThink (ent))
|
if (!SV_RunThink (ent))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VectorMA (ent->v.angles, host_frametime, ent->v.avelocity, ent->v.angles);
|
VectorMA (ent->v.angles, sv_frametime, ent->v.avelocity, ent->v.angles);
|
||||||
VectorMA (ent->v.origin, host_frametime, ent->v.velocity, ent->v.origin);
|
VectorMA (ent->v.origin, sv_frametime, ent->v.velocity, ent->v.origin);
|
||||||
|
|
||||||
SV_LinkEdict (ent, false);
|
SV_LinkEdict (ent, false);
|
||||||
}
|
}
|
||||||
|
@ -784,10 +756,10 @@ void SV_Physics_Toss (edict_t *ent)
|
||||||
SV_AddGravity (ent, 1.0);
|
SV_AddGravity (ent, 1.0);
|
||||||
|
|
||||||
// move angles
|
// move angles
|
||||||
VectorMA (ent->v.angles, host_frametime, ent->v.avelocity, ent->v.angles);
|
VectorMA (ent->v.angles, sv_frametime, ent->v.avelocity, ent->v.angles);
|
||||||
|
|
||||||
// move origin
|
// move origin
|
||||||
VectorScale (ent->v.velocity, host_frametime, move);
|
VectorScale (ent->v.velocity, sv_frametime, move);
|
||||||
trace = SV_PushEntity (ent, move);
|
trace = SV_PushEntity (ent, move);
|
||||||
if (trace.fraction == 1)
|
if (trace.fraction == 1)
|
||||||
return;
|
return;
|
||||||
|
@ -851,7 +823,7 @@ void SV_Physics_Step (edict_t *ent)
|
||||||
|
|
||||||
SV_AddGravity (ent, 1.0);
|
SV_AddGravity (ent, 1.0);
|
||||||
SV_CheckVelocity (ent);
|
SV_CheckVelocity (ent);
|
||||||
SV_FlyMove (ent, host_frametime, NULL);
|
SV_FlyMove (ent, sv_frametime, NULL);
|
||||||
SV_LinkEdict (ent, true);
|
SV_LinkEdict (ent, true);
|
||||||
|
|
||||||
if ( (int)ent->v.flags & FL_ONGROUND ) // just hit ground
|
if ( (int)ent->v.flags & FL_ONGROUND ) // just hit ground
|
||||||
|
@ -945,14 +917,14 @@ void SV_Physics_PPusher (edict_t *ent)
|
||||||
oldltime = ent->v.ltime;
|
oldltime = ent->v.ltime;
|
||||||
|
|
||||||
thinktime = ent->v.nextthink;
|
thinktime = ent->v.nextthink;
|
||||||
if (thinktime < ent->v.ltime + host_frametime)
|
if (thinktime < ent->v.ltime + sv_frametime)
|
||||||
{
|
{
|
||||||
movetime = thinktime - ent->v.ltime;
|
movetime = thinktime - ent->v.ltime;
|
||||||
if (movetime < 0)
|
if (movetime < 0)
|
||||||
movetime = 0;
|
movetime = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
movetime = host_frametime;
|
movetime = sv_frametime;
|
||||||
|
|
||||||
// if (movetime)
|
// if (movetime)
|
||||||
// {
|
// {
|
||||||
|
@ -1035,7 +1007,7 @@ void SV_RunNewmis (void)
|
||||||
if (!pr_global_struct->newmis)
|
if (!pr_global_struct->newmis)
|
||||||
return;
|
return;
|
||||||
ent = PROG_TO_EDICT(pr_global_struct->newmis);
|
ent = PROG_TO_EDICT(pr_global_struct->newmis);
|
||||||
host_frametime = 0.05;
|
sv_frametime = 0.05;
|
||||||
pr_global_struct->newmis = 0;
|
pr_global_struct->newmis = 0;
|
||||||
|
|
||||||
SV_RunEntity (ent);
|
SV_RunEntity (ent);
|
||||||
|
@ -1054,20 +1026,14 @@ void SV_Physics (void)
|
||||||
static double old_time;
|
static double old_time;
|
||||||
|
|
||||||
// don't bother running a frame if sys_ticrate seconds haven't passed
|
// don't bother running a frame if sys_ticrate seconds haven't passed
|
||||||
host_frametime = realtime - old_time;
|
sv_frametime = realtime - old_time;
|
||||||
/* if (host_frametime < sv_mintic.value)
|
if (sv_frametime < sv_mintic->value)
|
||||||
CVAR_FIXME */
|
|
||||||
if (host_frametime < sv_mintic->value)
|
|
||||||
return;
|
return;
|
||||||
/* if (host_frametime > sv_maxtic.value)
|
if (sv_frametime > sv_maxtic->value)
|
||||||
CVAR_FIXME */
|
sv_frametime = sv_maxtic->value;
|
||||||
if (host_frametime > sv_maxtic->value)
|
|
||||||
/* host_frametime = sv_maxtic.value;
|
|
||||||
CVAR_FIXME */
|
|
||||||
host_frametime = sv_maxtic->value;
|
|
||||||
old_time = realtime;
|
old_time = realtime;
|
||||||
|
|
||||||
pr_global_struct->frametime = host_frametime;
|
pr_global_struct->frametime = sv_frametime;
|
||||||
|
|
||||||
SV_ProgStartFrame ();
|
SV_ProgStartFrame ();
|
||||||
|
|
||||||
|
@ -1097,32 +1063,14 @@ void SV_Physics (void)
|
||||||
|
|
||||||
void SV_SetMoveVars(void)
|
void SV_SetMoveVars(void)
|
||||||
{
|
{
|
||||||
/* movevars.gravity = sv_gravity.value;
|
|
||||||
CVAR_FIXME */
|
|
||||||
movevars.gravity = sv_gravity->value;
|
movevars.gravity = sv_gravity->value;
|
||||||
/* movevars.stopspeed = sv_stopspeed.value;
|
|
||||||
CVAR_FIXME */
|
|
||||||
movevars.stopspeed = sv_stopspeed->value;
|
movevars.stopspeed = sv_stopspeed->value;
|
||||||
/* movevars.maxspeed = sv_maxspeed.value;
|
|
||||||
CVAR_FIXME */
|
|
||||||
movevars.maxspeed = sv_maxspeed->value;
|
movevars.maxspeed = sv_maxspeed->value;
|
||||||
/* movevars.spectatormaxspeed = sv_spectatormaxspeed.value;
|
|
||||||
CVAR_FIXME */
|
|
||||||
movevars.spectatormaxspeed = sv_spectatormaxspeed->value;
|
movevars.spectatormaxspeed = sv_spectatormaxspeed->value;
|
||||||
/* movevars.accelerate = sv_accelerate.value;
|
|
||||||
CVAR_FIXME */
|
|
||||||
movevars.accelerate = sv_accelerate->value;
|
movevars.accelerate = sv_accelerate->value;
|
||||||
/* movevars.airaccelerate = sv_airaccelerate.value;
|
|
||||||
CVAR_FIXME */
|
|
||||||
movevars.airaccelerate = sv_airaccelerate->value;
|
movevars.airaccelerate = sv_airaccelerate->value;
|
||||||
/* movevars.wateraccelerate = sv_wateraccelerate.value;
|
|
||||||
CVAR_FIXME */
|
|
||||||
movevars.wateraccelerate = sv_wateraccelerate->value;
|
movevars.wateraccelerate = sv_wateraccelerate->value;
|
||||||
/* movevars.friction = sv_friction.value;
|
|
||||||
CVAR_FIXME */
|
|
||||||
movevars.friction = sv_friction->value;
|
movevars.friction = sv_friction->value;
|
||||||
/* movevars.waterfriction = sv_waterfriction.value;
|
|
||||||
CVAR_FIXME */
|
|
||||||
movevars.waterfriction = sv_waterfriction->value;
|
movevars.waterfriction = sv_waterfriction->value;
|
||||||
movevars.entgravity = 1.0;
|
movevars.entgravity = 1.0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1474,10 +1474,10 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean inside)
|
||||||
SV_CalcRoll (sv_player->v.angles, sv_player->v.velocity)*4;
|
SV_CalcRoll (sv_player->v.angles, sv_player->v.velocity)*4;
|
||||||
}
|
}
|
||||||
|
|
||||||
host_frametime = min(0.1, ucmd->msec * 0.001);
|
sv_frametime = min(0.1, ucmd->msec * 0.001);
|
||||||
|
|
||||||
if (!host_client->spectator) {
|
if (!host_client->spectator) {
|
||||||
pr_global_struct->frametime = host_frametime;
|
pr_global_struct->frametime = sv_frametime;
|
||||||
|
|
||||||
pr_global_struct->time = sv.time;
|
pr_global_struct->time = sv.time;
|
||||||
pr_global_struct->self = EDICT_TO_PROG(sv_player);
|
pr_global_struct->self = EDICT_TO_PROG(sv_player);
|
||||||
|
|
Loading…
Reference in a new issue