From de43ca634298a049c82fe0df2cab5f1da7e3e917 Mon Sep 17 00:00:00 2001 From: terencehill Date: Wed, 18 Nov 2020 23:52:51 +0100 Subject: [PATCH] Throw casings if chase_active is on and r_drawviewmodel is off --- qcsrc/client/main.qc | 3 +++ qcsrc/client/view.qc | 15 +++++++++++++++ qcsrc/common/effects/qc/casings.qc | 6 +++--- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 16600f743..1be1f5fd4 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -167,6 +167,9 @@ void Shutdown() if(autocvar_chase_active < 0) cvar_set("chase_active", "0"); + if (autocvar_r_drawviewmodel < 0) + cvar_set("r_drawviewmodel", "0"); + cvar_set("slowmo", cvar_defstring("slowmo")); // reset it back to 'default' if (!isdemo()) diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 51fbe195e..f39dbbefc 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -1633,6 +1633,21 @@ void CSQC_UpdateView(entity this, float w, float h) ticrate = STAT(MOVEVARS_TICRATE) * STAT(MOVEVARS_TIMESCALE); + if (autocvar_chase_active) + { + // in first person view if r_drawviewmodel is off weapon isn't visible + // and server doesn't throw any casing + // switching to 3rd person view r_drawviewmodel is set to -1 to let know the server casings + // can be thrown for self since own weapon model is visible + if (autocvar_r_drawviewmodel == 0 && STAT(HEALTH) > 0) + cvar_set("r_drawviewmodel", "-1"); + } + else + { + if (autocvar_r_drawviewmodel < 0) + cvar_set("r_drawviewmodel", "0"); + } + WaypointSprite_Load(); CSQCPlayer_SetCamera(); diff --git a/qcsrc/common/effects/qc/casings.qc b/qcsrc/common/effects/qc/casings.qc index 0e04984d6..3a6b38642 100644 --- a/qcsrc/common/effects/qc/casings.qc +++ b/qcsrc/common/effects/qc/casings.qc @@ -12,13 +12,13 @@ REGISTER_NET_TEMP(casings) #if defined(SVQC) .bool cvar_cl_casings; -.bool cvar_r_drawviewmodel; +.int cvar_r_drawviewmodel; #elif defined(CSQC) bool cvar_cl_casings; -bool cvar_r_drawviewmodel; +int cvar_r_drawviewmodel; #endif REPLICATE(cvar_cl_casings, bool, "cl_casings"); -REPLICATE(cvar_r_drawviewmodel, bool, "r_drawviewmodel"); +REPLICATE(cvar_r_drawviewmodel, int, "r_drawviewmodel"); #ifdef SVQC void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner, .entity weaponentity) -- 2.39.2