X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=sv_main.c;h=f656085c67ca1d8231ad957cd66caef0f6f8e48a;hb=a2bd5617e8017d15aad71e6e27060b7624601124;hp=c4168d2e5d41f0d264695d084a69311104fa1e33;hpb=4a705e0b274fb1a5489d32dd67a8c36418402e08;p=xonotic%2Fdarkplaces.git diff --git a/sv_main.c b/sv_main.c index c4168d2e..f656085c 100644 --- a/sv_main.c +++ b/sv_main.c @@ -129,7 +129,6 @@ cvar_t sv_gameplayfix_q1bsptracelinereportstexture = {CF_SERVER, "sv_gameplayfix cvar_t sv_gameplayfix_unstickplayers = {CF_SERVER, "sv_gameplayfix_unstickplayers", "0", "big hack to try and fix the rare case of MOVETYPE_WALK entities getting stuck in the world clipping hull."}; cvar_t sv_gameplayfix_unstickentities = {CF_SERVER, "sv_gameplayfix_unstickentities", "1", "hack to check if entities are crossing world collision hull and try to move them to the right position, superseded by sv_gameplayfix_nudgeoutofsolid"}; cvar_t sv_gameplayfix_fixedcheckwatertransition = {CF_SERVER, "sv_gameplayfix_fixedcheckwatertransition", "1", "fix two very stupid bugs in SV_CheckWaterTransition when watertype is CONTENTS_EMPTY (the bugs causes waterlevel to be 1 on first frame, -1 on second frame - the fix makes it 0 on both frames)"}; -cvar_t sv_gameplayfix_customstats = {CF_SERVER, "sv_gameplayfix_customstats", "0", "Disable stats higher than 220, for use by certain games such as Xonotic"}; cvar_t sv_gravity = {CF_SERVER | CF_NOTIFY, "sv_gravity","800", "how fast you fall (512 = roughly earth gravity)"}; cvar_t sv_init_frame_count = {CF_SERVER, "sv_init_frame_count", "2", "number of frames to run to allow everything to settle before letting clients connect"}; cvar_t sv_idealpitchscale = {CF_SERVER, "sv_idealpitchscale","0.8", "how much to look up/down slopes and stairs when not using freelook"}; @@ -144,6 +143,7 @@ cvar_t sv_nostep = {CF_SERVER | CF_NOTIFY, "sv_nostep","0", "prevents MOVETYPE_S cvar_t sv_playerphysicsqc = {CF_SERVER | CF_NOTIFY, "sv_playerphysicsqc", "1", "enables QuakeC function to override player physics"}; cvar_t sv_progs = {CF_SERVER, "sv_progs", "progs.dat", "selects which quakec progs.dat file to run" }; cvar_t sv_protocolname = {CF_SERVER, "sv_protocolname", "DP7", "selects network protocol to host for (values include QUAKE, QUAKEDP, NEHAHRAMOVIE, DP1 and up)"}; +cvar_t sv_qcstats = {CF_SERVER, "sv_qcstats", "0", "Disables engine sending of stats 220 and above, for use by certain games such as Xonotic, NOTE: it's strongly recommended that SVQC send correct STAT_MOVEVARS_TICRATE and STAT_MOVEVARS_TIMESCALE"}; cvar_t sv_random_seed = {CF_SERVER, "sv_random_seed", "", "random seed; when set, on every map start this random seed is used to initialize the random number generator. Don't touch it unless for benchmarking or debugging"}; cvar_t host_limitlocal = {CF_SERVER, "host_limitlocal", "0", "whether to apply rate limiting to the local player in a listen server (only useful for testing)"}; cvar_t sv_sound_land = {CF_SERVER, "sv_sound_land", "demon/dland2.wav", "sound to play when MOVETYPE_STEP entity hits the ground at high speed (empty cvar disables the sound)"}; @@ -613,7 +613,7 @@ void SV_Init (void) Cvar_RegisterVariable (&sv_gameplayfix_unstickplayers); Cvar_RegisterVariable (&sv_gameplayfix_unstickentities); Cvar_RegisterVariable (&sv_gameplayfix_fixedcheckwatertransition); - Cvar_RegisterVariable (&sv_gameplayfix_customstats); + Cvar_RegisterVariable (&sv_qcstats); Cvar_RegisterVariable (&sv_gravity); Cvar_RegisterVariable (&sv_init_frame_count); Cvar_RegisterVariable (&sv_idealpitchscale); @@ -796,7 +796,7 @@ void SV_SendServerinfo (client_t *client) SZ_Clear (&client->netconnection->message); MSG_WriteByte (&client->netconnection->message, svc_print); - dpsnprintf (message, sizeof (message), "\nServer: %s build %s (progs %i crc)\n", gamename, buildstring, prog->filecrc); + dpsnprintf (message, sizeof (message), "\nServer: %s (progs %i crc)\n", engineversion, prog->filecrc); MSG_WriteString (&client->netconnection->message,message); SV_StopDemoRecording(client); // to split up demos into different files @@ -2519,7 +2519,6 @@ const char *SV_TimingReport(char *buf, size_t buflen) return va(buf, buflen, "%.1f%% CPU, %.2f%% lost, offset avg %.1fms, max %.1fms, sdev %.1fms", sv.perf_cpuload * 100, sv.perf_lost * 100, sv.perf_offset_avg * 1000, sv.perf_offset_max * 1000, sv.perf_offset_sdev * 1000); } -extern cvar_t host_maxwait; extern cvar_t host_framerate; double SV_Frame(double time) { @@ -2712,7 +2711,6 @@ static int SV_ThreadFunc(void *voiddata) qbool playing = false; double sv_timer = 0; double sv_deltarealtime, sv_oldrealtime, sv_realtime; - double wait; int i; char vabuf[1024]; sv_realtime = Sys_DirtyTime(); @@ -2771,21 +2769,10 @@ static int SV_ThreadFunc(void *voiddata) } // if the accumulators haven't become positive yet, wait a while - wait = sv_timer * -1000000.0; - if (wait >= 1) + if (sv_timer < 0) { - double time0, delta; SV_UnlockThreadMutex(); // don't keep mutex locked while sleeping - if (host_maxwait.value <= 0) - wait = min(wait, 1000000.0); - else - wait = min(wait, host_maxwait.value * 1000.0); - if(wait < 1) - wait = 1; // because we cast to int - time0 = Sys_DirtyTime(); - Sys_Sleep((int)wait); - delta = Sys_DirtyTime() - time0;if (delta < 0 || delta >= 1800) delta = 0; - sv.perf_acc_sleeptime += delta; + sv.perf_acc_sleeptime += Sys_Sleep(-sv_timer); continue; }