From 5d12d96f87b4e3e5a6a3cb1e4f96ff59d99ec9bd Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 24 Apr 2012 12:22:50 +0000 Subject: [PATCH] bigfoot complained that the timedemo framecounts didn't match vanilla. So now it matches vanilla (both nq and qw), but does not match bigfoot's own engine, because bigfoot's engine cheats and does not match vanilla. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4032 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_demo.c | 68 ++++++++++++++++++++++------------------ engine/client/cl_main.c | 4 +-- engine/client/r_part.c | 6 ++-- engine/client/renderer.c | 2 +- fteqtv/qtv.h | 2 +- 5 files changed, 45 insertions(+), 37 deletions(-) diff --git a/engine/client/cl_demo.c b/engine/client/cl_demo.c index dbff238bb..01692230f 100644 --- a/engine/client/cl_demo.c +++ b/engine/client/cl_demo.c @@ -247,14 +247,14 @@ int readdemobytes(int *readpos, void *data, int len) else demopreparsedbytes += demo_preparsedemo(demobuffer+demopreparsedbytes, demobuffersize-demopreparsedbytes); } - else if (i < 0) - { //0 means no data available yet - endofdemo = true; - return 0; - } if (*readpos+len > demobuffersize) { + if (i < 0) + { //0 means no data available yet + endofdemo = true; + return 0; + } len = demobuffersize; return 0; } @@ -493,11 +493,12 @@ qboolean CL_GetDemoMessage (void) } #endif - //client is loading content, don't flood it with packets while its still got no map loaded - if (cl.sendprespawn) - return 0; - readnext: + if (demopos) + { + demo_flushbytes(demopos); + demopos = 0; + } // read the time from the packet if (cls.demoplayback == DPB_MVD || cls.demoplayback == DPB_EZTV) { @@ -513,7 +514,7 @@ readnext: if (readdemobytes(&demopos, &msecsadded, sizeof(msecsadded)) != sizeof(msecsadded)) { - Con_DPrintf("Not enoug buffered\n"); + Con_DPrintf("Not enough buffered\n"); demotime = olddemotime; nextdemotime = demotime; } @@ -534,29 +535,35 @@ readnext: demotime = LittleFloat(demotime); } + if (cl.sendprespawn) + { + CL_RequestNextDownload(); + if (!cls.timedemo) + return 0; + } + + // decide if it is time to grab the next message if (cls.timedemo) { - if (cls.state == ca_active || cl.validsequence) + if (cls.td_lastframe < 0) + cls.td_lastframe = demotime; + else if (demotime > cls.td_lastframe) { - if (cls.td_lastframe < 0) - cls.td_lastframe = demotime; - else if (host_framecount == cls.td_lastframe) - { - return 0; // already read this frame's message - } - if (cls.td_startframe == -1) - { //start the timer only once we are connected. - cls.td_starttime = Sys_DoubleTime(); - cls.td_startframe = host_framecount; - - //force the console up, we're done loading. - key_dest = key_game; - scr_con_current = 0; - } - if (cls.td_startframe == host_framecount+1) - cls.td_starttime = Sys_DoubleTime(); + cls.td_lastframe = demotime; + return 0; // already read this frame's message } + if (cls.td_startframe == -1 && cls.state == ca_active) + { //start the timer only once we are connected. + cls.td_starttime = Sys_DoubleTime(); + cls.td_startframe = host_framecount; + + //force the console up, we're done loading. + key_dest = key_game; + scr_con_current = 0; + } + if (cls.td_startframe == host_framecount+1) + cls.td_starttime = Sys_DoubleTime(); demtime = demotime; // warp } else if (!cl.paused && cls.state >= ca_onserver) @@ -673,6 +680,7 @@ readnext: readdemobytes (&demopos, &f, 4); cl.viewangles[0][i] = LittleFloat (f); } + goto readnext; /* }*/ break; @@ -779,7 +787,7 @@ readit: demo_flushbytes(demopos); olddemotime = demotime; - cls.td_lastframe = host_framecount; +// cls.td_lastframe = host_framecount; return 1; } @@ -2239,7 +2247,7 @@ void CL_TimeDemo_f (void) } //read the initial frame so load times don't count as part of the time - CL_ReadPackets(); +// CL_ReadPackets(); // cls.td_starttime will be grabbed at the second frame of the demo, so // all the loading time doesn't get counted diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index ba8423959..470a25af2 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -3701,8 +3701,6 @@ double Host_Frame (double time) pass1+pass2+pass3, pass1, pass2, pass3); } - host_framecount++; - fps_count++; IN_Commands (); @@ -3716,6 +3714,8 @@ double Host_Frame (double time) TP_UpdateAutoStatus(); + fps_count++; + host_framecount++; return 0; } diff --git a/engine/client/r_part.c b/engine/client/r_part.c index 483ae9fd5..9594700b9 100644 --- a/engine/client/r_part.c +++ b/engine/client/r_part.c @@ -123,8 +123,8 @@ void R_ParticleSystem_Callback(struct cvar_s *var, char *oldvalue) cvar_t r_rockettrail = CVARFC("r_rockettrail", "1", CVAR_SEMICHEAT, R_Rockettrail_Callback); cvar_t r_grenadetrail = CVARFC("r_grenadetrail", "1", CVAR_SEMICHEAT, R_Grenadetrail_Callback); -cvar_t r_particlesystem = CVARFC("r_particlesystem", IFMINIMAL("classic", "script"), CVAR_SEMICHEAT, R_ParticleSystem_Callback); -cvar_t r_particledesc = CVARAF("r_particledesc", "classic", "r_particlesdesc", CVAR_SEMICHEAT); +cvar_t r_particlesystem = CVARFC("r_particlesystem", IFMINIMAL("classic", "script"), CVAR_SEMICHEAT|CVAR_ARCHIVE, R_ParticleSystem_Callback); +cvar_t r_particledesc = CVARAF("r_particledesc", "classic", "r_particlesdesc", CVAR_SEMICHEAT|CVAR_ARCHIVE); extern cvar_t r_bouncysparks; extern cvar_t r_part_rain; extern cvar_t r_bloodstains; @@ -137,7 +137,7 @@ cvar_t r_part_sparks_trifan = CVAR("r_part_sparks_trifan", "1"); cvar_t r_part_sparks_textured = CVAR("r_part_sparks_textured", "1"); cvar_t r_part_beams = CVAR("r_part_beams", "1"); cvar_t r_part_contentswitch = CVARFD("r_part_contentswitch", "1", CVAR_ARCHIVE, "Enable particle effects to change based on content (ex. water)."); -cvar_t r_part_density = CVAR("r_part_density", "1"); +cvar_t r_part_density = CVARF("r_part_density", "1", CVAR_ARCHIVE); particleengine_t *pe; diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 851547149..1f9eb22d9 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -108,7 +108,7 @@ cvar_t r_lightmap_saturation = SCVAR ("r_lightmap_saturation", "1"); cvar_t r_lightstylesmooth = CVARF ("r_lightstylesmooth", "0", CVAR_ARCHIVE); cvar_t r_lightstylesmooth_limit = SCVAR ("r_lightstylesmooth_limit", "2"); cvar_t r_lightstylespeed = SCVAR ("r_lightstylespeed", "10"); -cvar_t r_loadlits = SCVAR ("r_loadlit", "1"); +cvar_t r_loadlits = CVARF ("r_loadlit", "1", CVAR_ARCHIVE); cvar_t r_menutint = SCVARF ("r_menutint", "0.68 0.4 0.13", CVAR_RENDERERCALLBACK); cvar_t r_netgraph = SCVAR ("r_netgraph", "0"); diff --git a/fteqtv/qtv.h b/fteqtv/qtv.h index 0925fa1fd..e79bd9b8e 100644 --- a/fteqtv/qtv.h +++ b/fteqtv/qtv.h @@ -228,7 +228,7 @@ size_t strlcpy(char *dst, const char *src, size_t siz); #ifdef LIBQTV -//#define Sys_Printf QTVSys_Printf +#define Sys_Printf QTVSys_Printf #endif #define VERSION "0.01" //this will be added to the serverinfo