From 2d109e615b3ce9edb2c527593bed8c78ab3f2eb1 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 21 Dec 2021 00:36:42 +0900 Subject: [PATCH] [client] Clean up a stray reference to the renderer Reaching into the renderer internals for r_worldmodel doesn't work when the plugins are not static. --- include/client/particles.h | 3 +++ libs/client/cl_particles.c | 8 +++----- nq/source/cl_main.c | 8 ++++++++ qw/source/cl_main.c | 8 ++++++++ 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/include/client/particles.h b/include/client/particles.h index 0e499f53b..a56762bd8 100644 --- a/include/client/particles.h +++ b/include/client/particles.h @@ -71,4 +71,7 @@ extern float cl_realtime; void CL_Particles_Init (void); +struct model_s; +void CL_LoadPointFile (const struct model_s *model); + #endif // __client_particles_h_ diff --git a/libs/client/cl_particles.c b/libs/client/cl_particles.c index 5f92df3bc..e43a028c2 100644 --- a/libs/client/cl_particles.c +++ b/libs/client/cl_particles.c @@ -222,15 +222,15 @@ add_particle (ptype_t type, vec4f_t pos, vec4f_t vel, float live, int color, particle_new (type, part_tex_dot, pos, 1, vel, live, color, 1, ramp); } -static void -pointfile_f (void) +void +CL_LoadPointFile (const model_t *model) { const char *name; char *mapname; int c; QFile *f; - mapname = strdup (r_worldentity.renderer.model->path); + mapname = strdup (model->path); if (!mapname) Sys_Error ("Can't duplicate mapname!"); QFS_StripExtension (mapname, mapname); @@ -1272,8 +1272,6 @@ CL_Particles_Init (void) { mtwist_seed (&mt, 0xdeadbeef); cl_psystem = r_funcs->ParticleSystem (); - Cmd_AddCommand ("pointfile", pointfile_f, - "Load a pointfile to determine map leaks."); easter_eggs = Cvar_Get ("easter_eggs", "0", CVAR_NONE, easter_eggs_f, "Enables easter eggs."); particles_style = Cvar_Get ("particles_style", "1", CVAR_ARCHIVE, diff --git a/nq/source/cl_main.c b/nq/source/cl_main.c index d7b474171..cd5ab5730 100644 --- a/nq/source/cl_main.c +++ b/nq/source/cl_main.c @@ -424,6 +424,12 @@ CL_NextDemo (void) cls.demonum++; } +static void +pointfile_f (void) +{ + CL_LoadPointFile (cl.worldmodel); +} + static void CL_PrintEntities_f (void) { @@ -604,6 +610,8 @@ CL_Init (cbuf_t *cbuf) V_Init (); + Cmd_AddCommand ("pointfile", pointfile_f, + "Load a pointfile to determine map leaks."); Cmd_AddCommand ("entities", CL_PrintEntities_f, "No Description"); Cmd_AddCommand ("disconnect", CL_Disconnect_f, "No Description"); Cmd_AddCommand ("maplist", Con_Maplist_f, "List available maps"); diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index a5b462735..98ed535a5 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -237,6 +237,12 @@ CL_Quit_f (void) Sys_Quit (); } +static void +pointfile_f (void) +{ + CL_LoadPointFile (cl.worldmodel); +} + static void CL_Version_f (void) { @@ -1229,6 +1235,8 @@ CL_Init (void) cl.players = calloc (MAX_CLIENTS, sizeof (player_info_t)); // register our commands + Cmd_AddCommand ("pointfile", pointfile_f, + "Load a pointfile to determine map leaks."); Cmd_AddCommand ("version", CL_Version_f, "Report version information"); Cmd_AddCommand ("changing", CL_Changing_f, "Used when maps are changing"); Cmd_AddCommand ("disconnect", CL_Disconnect_f, "Disconnect from server");