From 6573acbc7471d5ec668237ced8723197f0ffa269 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 5 Mar 2022 01:14:43 +0900 Subject: [PATCH] [qw] Fix some segfaults in chase mode And unconditionally allow chase cam when playing demos. --- qw/source/cl_main.c | 5 +++++ qw/source/cl_parse.c | 1 + 2 files changed, 6 insertions(+) diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index 566fa1a10..3724a5a41 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -399,6 +399,9 @@ CL_ClearState (void) cl.maxclients = MAX_CLIENTS; cl.viewstate.voffs_enabled = 0; cl.viewstate.chasestate = &cl.chasestate; + cl.chasestate.viewstate = &cl.viewstate; + cl.viewstate.punchangle = (vec4f_t) {0, 0, 0, 1}; + // Note: we should probably hack around this and give diff values for // diff gamedirs @@ -623,6 +626,7 @@ CL_FullServerinfo_f (void) if ((p = Info_ValueForKey (cl.serverinfo, "chase")) && *p) { cl.viewstate.chase = atoi (p); } + cl.viewstate.chase |= cls.demoplayback; if ((p = Info_ValueForKey (cl.serverinfo, "cshifts")) && *p) { cl.sv_cshifts = atoi (p); } @@ -1341,6 +1345,7 @@ CL_Init_Cvars (void) Game_Init_Cvars (); Pmove_Init_Cvars (); Team_Init_Cvars (); + Chase_Init_Cvars (); V_Init_Cvars (); cl_pitchspeed->callback = cl_pitchspeed_f; diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index d25c42405..e73c7ad3d 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -414,6 +414,7 @@ Model_NextDownload (void) // all done cl.worldmodel = cl.model_precache[1]; + cl.chasestate.worldmodel = cl.worldmodel; CL_NewMap (cl.model_name[1]); // done with modellist, request first of static signon messages