1
0
Fork 0
forked from fte/fteqw

Split cl_nolerp into cl_nolerp and cl_nolerp_netquake. This means that netquake can have a different default. This allows it to be smoother without arcane tweeking.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3084 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2008-12-03 02:42:05 +00:00
parent f01514060e
commit 4e1f6daf9f
5 changed files with 54 additions and 11 deletions

View file

@ -33,6 +33,7 @@ extern cvar_t cl_r2g;
extern cvar_t r_powerupglow; extern cvar_t r_powerupglow;
extern cvar_t v_powerupshell; extern cvar_t v_powerupshell;
extern cvar_t cl_nolerp; extern cvar_t cl_nolerp;
extern cvar_t cl_nolerp_netquake;
extern cvar_t cl_gibfilter, cl_deadbodyfilter; extern cvar_t cl_gibfilter, cl_deadbodyfilter;
extern int cl_playerindex; extern int cl_playerindex;
@ -1538,6 +1539,21 @@ packet_entities_t *CL_ProcessPacketEntities(float *servertime, qboolean nolerp)
return packnew; return packnew;
} }
qboolean CL_MayLerp(void)
{
//force lerping when playing low-framerate demos.
if (cls.demoplayback == DPB_MVD || cls.demoplayback == DPB_EZTV)
return true;
#ifdef NQPROT
if (cls.demoplayback == DPB_NETQUAKE)
return true;
if (cls.protocol == CP_NETQUAKE) //this includes DP protocols.
return !cl_nolerp_netquake.value;
#endif
return !cl_nolerp.value;
}
void CL_LinkPacketEntities (void) void CL_LinkPacketEntities (void)
{ {
entity_t *ent; entity_t *ent;
@ -1560,7 +1576,7 @@ void CL_LinkPacketEntities (void)
CL_CalcClientTime(); CL_CalcClientTime();
servertime = cl.servertime; servertime = cl.servertime;
nolerp = !!cl_nolerp.value && cls.demoplayback != DPB_MVD && cls.demoplayback != DPB_EZTV; nolerp = !CL_MayLerp() && cls.demoplayback != DPB_MVD && cls.demoplayback != DPB_EZTV;
#ifdef NQPROT #ifdef NQPROT
nolerp = nolerp && cls.demoplayback != DPB_NETQUAKE; nolerp = nolerp && cls.demoplayback != DPB_NETQUAKE;
#endif #endif
@ -1882,9 +1898,7 @@ void CL_LinkPacketEntities (void)
ent->forcedshader = NULL; ent->forcedshader = NULL;
#endif #endif
if (cl_nolerp.value) if (CL_MayLerp())
f = 1;
else
{ {
//figure out the lerp factor //figure out the lerp factor
if (cl.lerpents[s1->number].lerprate<=0) if (cl.lerpents[s1->number].lerprate<=0)
@ -1896,6 +1910,8 @@ void CL_LinkPacketEntities (void)
if (f>1) if (f>1)
f=1; f=1;
} }
else
f = 1;
ent->lerpfrac = 1-(cl.servertime-cl.lerpents[s1->number].lerptime)/cl.lerpents[s1->number].lerprate; ent->lerpfrac = 1-(cl.servertime-cl.lerpents[s1->number].lerptime)/cl.lerpents[s1->number].lerprate;
if (ent->lerpfrac<0) if (ent->lerpfrac<0)

View file

@ -51,6 +51,7 @@ cvar_t cl_maxfps = SCVARF("cl_maxfps", "1000", CVAR_ARCHIVE);
cvar_t cl_nopext = SCVARF("cl_nopext", "0", CVAR_ARCHIVE); cvar_t cl_nopext = SCVARF("cl_nopext", "0", CVAR_ARCHIVE);
cvar_t cl_pext_mask = SCVAR("cl_pext_mask", "0xffffffff"); cvar_t cl_pext_mask = SCVAR("cl_pext_mask", "0xffffffff");
cvar_t cl_nolerp = SCVAR("cl_nolerp", "1"); cvar_t cl_nolerp = SCVAR("cl_nolerp", "1");
cvar_t cl_nolerp_netquake = SCVAR("cl_nolerp_netquake", "0");
cvar_t hud_tracking_show = SCVAR("hud_tracking_show", "1"); cvar_t hud_tracking_show = SCVAR("hud_tracking_show", "1");
cvar_t cfg_save_name = SCVARF("cfg_save_name", "fte", CVAR_ARCHIVE); cvar_t cfg_save_name = SCVARF("cfg_save_name", "fte", CVAR_ARCHIVE);
@ -2180,6 +2181,7 @@ void CL_ConnectionlessPacket (void)
Con_Printf ("accept\n"); Con_Printf ("accept\n");
Validation_Apply_Ruleset(); Validation_Apply_Ruleset();
Netchan_Setup(NS_CLIENT, &cls.netchan, net_from, cls.qport); Netchan_Setup(NS_CLIENT, &cls.netchan, net_from, cls.qport);
CL_ParseEstablished();
Con_DPrintf ("CL_EstablishConnection: connected to %s\n", cls.servername); Con_DPrintf ("CL_EstablishConnection: connected to %s\n", cls.servername);
@ -2222,6 +2224,7 @@ client_connect: //fixme: make function
} }
compress = cls.netchan.compress; compress = cls.netchan.compress;
Netchan_Setup (NS_CLIENT, &cls.netchan, net_from, cls.qport); Netchan_Setup (NS_CLIENT, &cls.netchan, net_from, cls.qport);
CL_ParseEstablished();
cls.netchan.compress = compress; cls.netchan.compress = compress;
#ifdef Q3CLIENT #ifdef Q3CLIENT
if (cls.protocol != CP_QUAKE3) if (cls.protocol != CP_QUAKE3)
@ -2339,6 +2342,7 @@ void CLNQ_ConnectionlessPacket(void)
Con_TPrintf (TLC_DUPCONNECTION); Con_TPrintf (TLC_DUPCONNECTION);
return; return;
} }
//this is the port that we're meant to respond to.
net_from.port = htons((short)MSG_ReadLong()); net_from.port = htons((short)MSG_ReadLong());
if (MSG_ReadByte() == 1) //a proquake server adds a little extra info if (MSG_ReadByte() == 1) //a proquake server adds a little extra info
@ -2348,6 +2352,7 @@ void CLNQ_ConnectionlessPacket(void)
if (MSG_ReadByte() == 1) if (MSG_ReadByte() == 1)
{ {
//its a 'pure' server.
Con_Printf("ProQuake sucks\nGo play on a decent server.\n"); Con_Printf("ProQuake sucks\nGo play on a decent server.\n");
return; return;
} }
@ -2356,6 +2361,7 @@ void CLNQ_ConnectionlessPacket(void)
Validation_Apply_Ruleset(); Validation_Apply_Ruleset();
Netchan_Setup (NS_CLIENT, &cls.netchan, net_from, cls.qport); Netchan_Setup (NS_CLIENT, &cls.netchan, net_from, cls.qport);
CL_ParseEstablished();
cls.netchan.isnqprotocol = true; cls.netchan.isnqprotocol = true;
cls.netchan.compress = 0; cls.netchan.compress = 0;
cls.protocol = CP_NETQUAKE; cls.protocol = CP_NETQUAKE;
@ -2869,6 +2875,7 @@ void CL_Init (void)
Cvar_Register (&cl_deadbodyfilter, "Item effects"); Cvar_Register (&cl_deadbodyfilter, "Item effects");
Cvar_Register (&cl_nolerp, "Item effects"); Cvar_Register (&cl_nolerp, "Item effects");
Cvar_Register (&cl_nolerp_netquake, "Item effects");
Cvar_Register (&r_drawflame, "Item effects"); Cvar_Register (&r_drawflame, "Item effects");

View file

@ -33,6 +33,7 @@ int msgflags;
char cl_dp_csqc_progsname[128]; char cl_dp_csqc_progsname[128];
int cl_dp_csqc_progssize; int cl_dp_csqc_progssize;
int cl_dp_csqc_progscrc; int cl_dp_csqc_progscrc;
int cl_dp_serverextension_download;
char *svc_strings[] = char *svc_strings[] =
@ -298,6 +299,12 @@ qboolean CL_EnqueDownload(char *filename, char *localname, unsigned int flags)
if (!(flags & DLLF_IGNOREFAILED)) if (!(flags & DLLF_IGNOREFAILED))
{ {
#ifdef NQPROT
if (cls.protocol == CP_NETQUAKE)
if (!cl_dp_serverextension_download)
return false;
#endif
for (dl = cl.faileddownloads; dl; dl = dl->next) //yeah, so it failed... Ignore it. for (dl = cl.faileddownloads; dl; dl = dl->next) //yeah, so it failed... Ignore it.
{ {
if (!strcmp(dl->name, filename)) if (!strcmp(dl->name, filename))
@ -2213,6 +2220,15 @@ void CLQ2_ParseServerData (void)
void CL_ParseEstablished(void)
{
#ifdef NQPROT
cl_dp_serverextension_download = false;
cl_dp_csqc_progscrc = 0;
cl_dp_csqc_progssize = 0;
#endif
}
#ifdef NQPROT #ifdef NQPROT
//FIXME: move to header //FIXME: move to header
void CL_KeepaliveMessage(void){} void CL_KeepaliveMessage(void){}
@ -2312,7 +2328,8 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution.
return; return;
} }
strcpy (cl.model_name[nummodels], str); strcpy (cl.model_name[nummodels], str);
CL_CheckOrEnqueDownloadFile(str, NULL, 0); if (*str != '*') //not inline models!
CL_CheckOrEnqueDownloadFile(str, NULL, 0);
Mod_TouchModel (str); Mod_TouchModel (str);
} }
@ -2328,6 +2345,10 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution.
return; return;
} }
strcpy (cl.sound_name[numsounds], str); strcpy (cl.sound_name[numsounds], str);
#pragma message("the logic that we should have here is rather long")
//CL_CheckOrEnqueDownloadFile(str, NULL, 0);
S_TouchSound (str); S_TouchSound (str);
} }
@ -5301,6 +5322,7 @@ void CLNQ_ParseServerMessage (void)
Con_DPrintf ("stufftext: %s\n", s); Con_DPrintf ("stufftext: %s\n", s);
if (!strncmp(s, "cl_serverextension_download ", 14)) if (!strncmp(s, "cl_serverextension_download ", 14))
{ {
cl_dp_serverextension_download = true;
} }
else if (!strncmp(s, "\ncl_downloadbegin ", 17)) else if (!strncmp(s, "\ncl_downloadbegin ", 17))
CLDP_ParseDownloadBegin(s); CLDP_ParseDownloadBegin(s);

View file

@ -544,7 +544,7 @@ static void CL_LerpMove (int pnum, float msgtime)
int i; int i;
int from, to; int from, to;
if (cl_nolerp.value || cls.demoplayback == DPB_MVD || cls.demoplayback == DPB_EZTV) if (!CL_MayLerp() || cls.demoplayback == DPB_MVD || cls.demoplayback == DPB_EZTV)
return; return;
#ifdef NQPROT #ifdef NQPROT
@ -837,11 +837,7 @@ fixedorg:
to = &cl.frames[cl.ackedinputsequence & UPDATE_MASK]; to = &cl.frames[cl.ackedinputsequence & UPDATE_MASK];
#ifdef NQPROT if (Cam_TrackNum(pnum)>=0 && CL_MayLerp())
if (Cam_TrackNum(pnum)>=0 && !cl_nolerp.value && cls.demoplayback != DPB_MVD && cls.demoplayback != DPB_EZTV && cls.demoplayback != DPB_NETQUAKE)
#else
if (Cam_TrackNum(pnum)>=0 && !cl_nolerp.value && cls.demoplayback != DPB_MVD && cls.demoplayback != DPB_EZTV)
#endif
{ {
float f; float f;

View file

@ -806,6 +806,7 @@ extern int packet_latency[NET_TIMINGS];
int CL_CalcNet (void); int CL_CalcNet (void);
void CL_ParseServerMessage (void); void CL_ParseServerMessage (void);
void CL_DumpPacket(void); void CL_DumpPacket(void);
void CL_ParseEstablished(void);
void CLNQ_ParseServerMessage (void); void CLNQ_ParseServerMessage (void);
#ifdef Q2CLIENT #ifdef Q2CLIENT
void CLQ2_ParseServerMessage (void); void CLQ2_ParseServerMessage (void);
@ -878,6 +879,7 @@ void CL_LinkViewModel(void);
void CL_LinkPlayers (void); void CL_LinkPlayers (void);
void CL_LinkPacketEntities (void); void CL_LinkPacketEntities (void);
void CL_LinkProjectiles (void); void CL_LinkProjectiles (void);
qboolean CL_MayLerp(void);
// //
//clq3_parse.c //clq3_parse.c