Trial a new Freeze cvar.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@457 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Steven 2011-06-10 03:04:51 +00:00
parent d546301342
commit 44ecfb19bb
2 changed files with 16 additions and 3 deletions

View file

@ -78,6 +78,7 @@ void SV_Init (void)
extern cvar_t sv_maxvelocity; extern cvar_t sv_maxvelocity;
extern cvar_t sv_gravity; extern cvar_t sv_gravity;
extern cvar_t sv_nostep; extern cvar_t sv_nostep;
extern cvar_t sv_freezenonclients;
extern cvar_t sv_friction; extern cvar_t sv_friction;
extern cvar_t sv_edgefriction; extern cvar_t sv_edgefriction;
extern cvar_t sv_stopspeed; extern cvar_t sv_stopspeed;
@ -97,6 +98,7 @@ void SV_Init (void)
Cvar_RegisterVariable (&sv_idealpitchscale, NULL); Cvar_RegisterVariable (&sv_idealpitchscale, NULL);
Cvar_RegisterVariable (&sv_aim, NULL); Cvar_RegisterVariable (&sv_aim, NULL);
Cvar_RegisterVariable (&sv_nostep, NULL); Cvar_RegisterVariable (&sv_nostep, NULL);
Cvar_RegisterVariable (&sv_freezenonclients, NULL);
Cvar_RegisterVariable (&sv_altnoclip, NULL); //johnfitz Cvar_RegisterVariable (&sv_altnoclip, NULL); //johnfitz
Cmd_AddCommand ("sv_protocol", &SV_Protocol_f); //johnfitz Cmd_AddCommand ("sv_protocol", &SV_Protocol_f); //johnfitz

View file

@ -45,6 +45,8 @@ cvar_t sv_stopspeed = {"sv_stopspeed","100"};
cvar_t sv_gravity = {"sv_gravity","800",false,true}; cvar_t sv_gravity = {"sv_gravity","800",false,true};
cvar_t sv_maxvelocity = {"sv_maxvelocity","2000"}; cvar_t sv_maxvelocity = {"sv_maxvelocity","2000"};
cvar_t sv_nostep = {"sv_nostep","0"}; cvar_t sv_nostep = {"sv_nostep","0"};
cvar_t sv_freezenonclients = {"sv_freezenonclients","0"};
#define MOVE_EPSILON 0.01 #define MOVE_EPSILON 0.01
@ -1169,7 +1171,8 @@ SV_Physics
*/ */
void SV_Physics (void) void SV_Physics (void)
{ {
int i; int i;
int entity_cap; // For sv_freezenonclients
edict_t *ent; edict_t *ent;
// let the progs know that a new frame has started // let the progs know that a new frame has started
@ -1184,7 +1187,14 @@ void SV_Physics (void)
// treat each object in turn // treat each object in turn
// //
ent = sv.edicts; ent = sv.edicts;
for (i=0 ; i<sv.num_edicts ; i++, ent = NEXT_EDICT(ent))
if (sv_freezenonclients.value)
entity_cap = svs.maxclients + 1; // Only run physics on clients and the world
else
entity_cap = sv.num_edicts;
//for (i=0 ; i<sv.num_edicts ; i++, ent = NEXT_EDICT(ent))
for (i=0 ; i<entity_cap ; i++, ent = NEXT_EDICT(ent))
{ {
if (ent->free) if (ent->free)
continue; continue;
@ -1216,5 +1226,6 @@ void SV_Physics (void)
if (pr_global_struct->force_retouch) if (pr_global_struct->force_retouch)
pr_global_struct->force_retouch--; pr_global_struct->force_retouch--;
sv.time += host_frametime; if (!sv_freezenonclients.value)
sv.time += host_frametime;
} }