From 9dd628718378362a91d9a087d2e93746b502e4af Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 6 Jan 2020 22:21:19 +1000 Subject: [PATCH] Fix glitchy jumping while bloodloss is in effect --- .../mutators/mutator/bloodloss/_mod.inc | 4 +--- .../common/mutators/mutator/bloodloss/_mod.qh | 4 +--- .../{sv_bloodloss.qc => bloodloss.qc} | 22 ++++++++++++++++--- .../{sv_bloodloss.qh => bloodloss.qh} | 0 qcsrc/common/stats.qh | 5 +++++ 5 files changed, 26 insertions(+), 9 deletions(-) rename qcsrc/common/mutators/mutator/bloodloss/{sv_bloodloss.qc => bloodloss.qc} (75%) rename qcsrc/common/mutators/mutator/bloodloss/{sv_bloodloss.qh => bloodloss.qh} (100%) diff --git a/qcsrc/common/mutators/mutator/bloodloss/_mod.inc b/qcsrc/common/mutators/mutator/bloodloss/_mod.inc index 768808db7..16e6308ac 100644 --- a/qcsrc/common/mutators/mutator/bloodloss/_mod.inc +++ b/qcsrc/common/mutators/mutator/bloodloss/_mod.inc @@ -1,4 +1,2 @@ // generated file; do not modify -#ifdef SVQC - #include -#endif +#include diff --git a/qcsrc/common/mutators/mutator/bloodloss/_mod.qh b/qcsrc/common/mutators/mutator/bloodloss/_mod.qh index e6ad248c6..b1d45e279 100644 --- a/qcsrc/common/mutators/mutator/bloodloss/_mod.qh +++ b/qcsrc/common/mutators/mutator/bloodloss/_mod.qh @@ -1,4 +1,2 @@ // generated file; do not modify -#ifdef SVQC - #include -#endif +#include diff --git a/qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qc b/qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc similarity index 75% rename from qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qc rename to qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc index 95356bb4f..c92a08869 100644 --- a/qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qc +++ b/qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc @@ -1,8 +1,13 @@ -#include "sv_bloodloss.qh" +#include "bloodloss.qh" -float autocvar_g_bloodloss; +#ifdef GAMEQC +#ifdef SVQC REGISTER_MUTATOR(bloodloss, autocvar_g_bloodloss); +#elif defined(CSQC) +REGISTER_MUTATOR(bloodloss, true); +#endif +#ifdef SVQC .float bloodloss_timer; MUTATOR_HOOKFUNCTION(bloodloss, PlayerPreThink) @@ -20,7 +25,7 @@ MUTATOR_HOOKFUNCTION(bloodloss, PlayerPreThink) if(time >= player.bloodloss_timer) { if(player.vehicle) - vehicles_exit(player.vehicle, VHEF_RELEASE); + vehicles_exit(player.vehicle, VHEF_RELEASE); // TODO: boots player out of their vehicle each health rot tick! if(player.event_damage) player.event_damage(player, player, player, 1, DEATH_ROT.m_id, DMG_NOWEP, player.origin, '0 0 0'); player.bloodloss_timer = time + 0.5 + random() * 0.5; @@ -45,3 +50,14 @@ MUTATOR_HOOKFUNCTION(bloodloss, BuildMutatorsPrettyString) { M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Blood loss"); } +#endif + +#ifdef CSQC +MUTATOR_HOOKFUNCTION(bloodloss, PlayerJump) +{ + if(STAT(HEALTH) <= STAT(BLOODLOSS)) + return true; +} +#endif + +#endif diff --git a/qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qh b/qcsrc/common/mutators/mutator/bloodloss/bloodloss.qh similarity index 100% rename from qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qh rename to qcsrc/common/mutators/mutator/bloodloss/bloodloss.qh diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index 1a9b35ec0..8b769538e 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -288,6 +288,11 @@ REGISTER_STAT(WALLJUMP_DELAY, float, autocvar_g_walljump_delay) REGISTER_STAT(WALLJUMP_FORCE, float, autocvar_g_walljump_force) REGISTER_STAT(LASTWJ, float) +#ifdef SVQC +float autocvar_g_bloodloss; +#endif +REGISTER_STAT(BLOODLOSS, float, autocvar_g_bloodloss) + // freeze tag, clan arena REGISTER_STAT(REDALIVE, int) REGISTER_STAT(BLUEALIVE, int) -- 2.39.2