[qw] Move netgraph setup into cl_ngraph

This finally gets cl_screen so it can be merged.
This commit is contained in:
Bill Currie 2022-11-02 10:33:06 +09:00
parent 010b61ee8b
commit 9f01cb25fe
4 changed files with 20 additions and 15 deletions

View file

@ -297,8 +297,7 @@ extern struct cbuf_s *cl_stbuf;
struct cvar_s;
void Cvar_Info (void *data, const struct cvar_s *cvar);
extern struct view_s cl_netgraph_view;
void CL_NetGraph (struct view_s view);
void CL_NetGraph_Init (void);
void CL_NetGraph_Init_Cvars (void);
extern struct view_s cl_screen_view;

View file

@ -1510,6 +1510,7 @@ CL_Init (void)
Cbuf_DeleteStack (con_module->data->console->cbuf);
con_module->data->console->cbuf = cl_cbuf;
}
CL_NetGraph_Init ();
S_Init (&cl.viewentity, &host_frametime);
CDAudio_Init ();

View file

@ -42,6 +42,8 @@
#include "QF/va.h"
#include "QF/ui/view.h"
#include "client/hud.h"
#include "compat.h"
#include "qw/include/cl_parse.h"
@ -84,7 +86,8 @@ static cvar_t cl_netgraph_height_cvar = {
.flags = CVAR_ARCHIVE,
.value = { .type = &cexpr_int, .value = &cl_netgraph_height },
};
view_t cl_netgraph_view;
static view_t cl_netgraph_view;
static void
cl_netgraph_f (void *data, const cvar_t *cvar)
@ -105,13 +108,11 @@ cl_netgraph_height_f (void *data, const cvar_t *cvar)
}
}
void
CL_NetGraph (view_t view)
static void
CL_NetGraph (view_pos_t abs, view_pos_t len)
{
int lost, a, l, x, y, i, o;
int timings[NET_TIMINGS];
view_pos_t abs = View_GetAbs (view);
view_pos_t len = View_GetLen (view);
if (cl_netgraph_box) {
r_funcs->Draw_TextBox (abs.x, abs.y, NET_TIMINGS / 8,
@ -151,6 +152,18 @@ CL_NetGraph (view_t view)
*/
}
void
CL_NetGraph_Init (void)
{
cl_netgraph_view = View_New (hud_registry, cl_screen_view);
View_SetPos (cl_netgraph_view, 0, hud_sb_lines);
View_SetLen (cl_netgraph_view, NET_TIMINGS + 16, cl_netgraph_height + 25);
View_SetGravity (cl_netgraph_view, grav_southwest);
void *f = CL_NetGraph;
Ent_SetComponent (cl_netgraph_view.id, hud_func, cl_netgraph_view.reg, &f);
View_SetVisible (cl_netgraph_view, cl_netgraph);
}
void
CL_NetGraph_Init_Cvars (void)
{

View file

@ -254,14 +254,6 @@ CL_Init_Screen (void)
View_SetGravity (pause_view, grav_center);
Ent_SetComponent (pause_view.id, hud_cachepic, pause_view.reg, &name);
View_SetVisible (pause_view, 0);
cl_netgraph_view = View_New (hud_registry, cl_screen_view);
View_SetPos (cl_netgraph_view, 0, hud_sb_lines);
View_SetLen (cl_netgraph_view, NET_TIMINGS + 16, cl_netgraph_height + 25);
View_SetGravity (cl_netgraph_view, grav_southwest);
Ent_SetComponent (cl_netgraph_view.id, hud_func, cl_netgraph_view.reg,
CL_NetGraph);
View_SetVisible (cl_netgraph_view, cl_netgraph);
}
void