[client] Use realtime for net icon check

viewstate's time is from cl.time which is not what's used to set
last_servermessage (that uses realtime). After careful investigation, I
found that cl.time is not at all suitable and that the original id code
used realtime (I think it was just me being lazy when I merged the
code). Fixes the stuck net icon.
This commit is contained in:
Bill Currie 2022-12-01 17:50:13 +09:00
parent 07fd93a56f
commit 7a64bb1149
7 changed files with 11 additions and 2 deletions

View file

@ -60,6 +60,7 @@ typedef struct viewstate_s {
vec4f_t punchangle;
transform_t camera_transform;
double time;
double realtime;
double last_servermessage;
float frametime;
float height;

View file

@ -133,8 +133,8 @@ scr_draw_views (void)
View_SetVisible (pause_view, scr_showpause && r_data->paused);
View_SetVisible (ram_view, scr_showram && r_cache_thrash);
View_SetVisible (net_view, (!_vs->demoplayback
&& _vs->time - _vs->last_servermessage >= 0.3));
double msg_time = _vs->realtime - _vs->last_servermessage;
View_SetVisible (net_view, (!_vs->demoplayback && msg_time >= 0.3));
View_SetVisible (loading_view, _vs->loading);
// FIXME cvar callbacks
View_SetVisible (timegraph_view, r_timegraph);

View file

@ -431,6 +431,7 @@ CL_NextDemo (void)
cl.viewstate.loading = true;
cl.viewstate.time = cl.time;
cl.viewstate.realtime = realtime;
CL_UpdateScreen(&cl.viewstate);
if (!cls.demos[cls.demonum][0] || cls.demonum == MAX_DEMOS) {

View file

@ -297,6 +297,7 @@ Host_Map_f (void)
cl.viewstate.loading = true;
cl.viewstate.time = cl.time;
cl.viewstate.realtime = realtime;
CL_UpdateScreen (&cl.viewstate);
svs.serverflags = 0; // haven't completed an episode yet
@ -628,6 +629,7 @@ Host_Loadgame_f (void)
cl.viewstate.loading = true;
cl.viewstate.time = cl.time;
cl.viewstate.realtime = realtime;
CL_UpdateScreen (&cl.viewstate);
Sys_Printf ("Loading game from %s...\n", name->str);

View file

@ -1944,6 +1944,7 @@ Host_Frame (float time)
r_data->frametime = host_frametime;
cl.viewstate.time = realtime;
cl.viewstate.realtime = realtime;
if (!cls.demoplayback && cls.state == ca_active) {
CL_NetUpdate ();
}
@ -2090,6 +2091,7 @@ Host_Init (void)
CL_Init ();
cl.viewstate.time = realtime;
cl.viewstate.realtime = realtime;
CL_UpdateScreen (&cl.viewstate);
CL_UpdateScreen (&cl.viewstate);

View file

@ -285,6 +285,7 @@ Model_NextDownload (void)
if (cls.downloadnumber == 0) {
Sys_Printf ("Checking models...\n");
cl.viewstate.time = realtime;
cl.viewstate.realtime = realtime;
CL_UpdateScreen (&cl.viewstate);
cls.downloadnumber = 1;
}
@ -375,6 +376,7 @@ Sound_NextDownload (void)
if (cls.downloadnumber == 0) {
Sys_Printf ("Checking sounds...\n");
cl.viewstate.time = realtime;
cl.viewstate.realtime = realtime;
CL_UpdateScreen (&cl.viewstate);
cls.downloadnumber = 1;
}

View file

@ -101,6 +101,7 @@ Skin_NextDownload (void)
if (cls.downloadnumber == 0) {
Sys_Printf ("Checking skins...\n");
cl.viewstate.time = realtime;
cl.viewstate.realtime = realtime;
CL_UpdateScreen (&cl.viewstate);
}
cls.downloadtype = dl_skin;