MOVETYPE_WALK on non-clients now links the edict like it should (major bugfix)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@195
d7cf8633-e32d-0410-b094-
e92efae38249
Returns false if the time is too short to run a frame
===================
*/
Returns false if the time is too short to run a frame
===================
*/
-qboolean Host_FilterTime (float time)
+qboolean Host_FilterTime (double time)
realtime += time;
if (slowmo.value < 0.0f)
realtime += time;
if (slowmo.value < 0.0f)
if (host_maxfps.value < host_minfps.value)
Cvar_SetValue("host_maxfps", host_minfps.value);
if (host_maxfps.value < host_minfps.value)
Cvar_SetValue("host_maxfps", host_minfps.value);
- if ((!cls.timedemo) && ((realtime - oldrealtime) < (1.0 / host_maxfps.value)))
- return false; // framerate is too high
+ // check if framerate is too high
+ if (!cls.timedemo)
+ {
+ timecap = sys_ticrate.value;
+ if (cls.state == ca_connected)
+ timecap = 1.0 / host_maxfps.value;
+
+ if ((realtime - oldrealtime) < timecap)
+ return false;
+ }
host_realframetime = host_frametime = realtime - oldrealtime; // LordHavoc: copy into host_realframetime as well
oldrealtime = realtime;
host_realframetime = host_frametime = realtime - oldrealtime; // LordHavoc: copy into host_realframetime as well
oldrealtime = realtime;
// decide the simulation time
if (!Host_FilterTime (time))
// decide the simulation time
if (!Host_FilterTime (time))
- return; // don't run too fast, or packets will flood out
+ {
+ // if time was rejected, don't totally hog the CPU
+ Sys_Sleep();
+ return;
+ }
// get new key events
Sys_SendKeyEvents ();
// get new key events
Sys_SendKeyEvents ();
SV_AddGravity (ent);
SV_CheckStuck (ent);
SV_WalkMove (ent);
SV_AddGravity (ent);
SV_CheckStuck (ent);
SV_WalkMove (ent);
+ SV_LinkEdict (ent, true);
}
break;
case MOVETYPE_TOSS:
}
break;
case MOVETYPE_TOSS:
+void Sys_Sleep(void)
+{
+ usleep(1);
+}
+
int main (int c, char **v)
{
int main (int c, char **v)
{