From af376cc21c7130e4d62257778b6f08fb03056120 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 18 Jul 2017 00:44:26 +1000 Subject: [PATCH] Make g_balance_damagepush_speedfactor a networked variable rather than relying on the client's setting --- qcsrc/client/autocvars.qh | 1 - qcsrc/client/main.qc | 1 + qcsrc/client/main.qh | 1 + qcsrc/common/effects/qc/damageeffects.qc | 2 +- qcsrc/server/client.qc | 6 ++++++ qcsrc/server/teamplay.qc | 6 +++--- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 4cfc5bbe0b..2711cd182f 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -152,7 +152,6 @@ float autocvar_crosshair_ring_reload_size; float autocvar_crosshair_size; int autocvar_ekg; float autocvar_fov; -float autocvar_g_balance_damagepush_speedfactor; bool autocvar_hud_cursormode = true; float autocvar_hud_colorflash_alpha; bool autocvar_hud_configure_checkcollisions; diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 1467a99ccf..13b63652bb 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -976,6 +976,7 @@ NET_HANDLE(ENT_CLIENT_INIT, bool isnew) forcefog = strzone(ReadString()); armorblockpercent = ReadByte() / 255.0; + damagepush_speedfactor = ReadByte() / 255.0; serverflags = ReadByte(); diff --git a/qcsrc/client/main.qh b/qcsrc/client/main.qh index bbf69d28d1..a2f4d18bba 100644 --- a/qcsrc/client/main.qh +++ b/qcsrc/client/main.qh @@ -86,6 +86,7 @@ void centerprint_generic(float new_id, string strMessage, float duration, float const float ALPHA_MIN_VISIBLE = 0.003; float armorblockpercent; +float damagepush_speedfactor; //hooks int calledhooks; diff --git a/qcsrc/common/effects/qc/damageeffects.qc b/qcsrc/common/effects/qc/damageeffects.qc index 71e1e2a7bc..c62bbd6b68 100644 --- a/qcsrc/common/effects/qc/damageeffects.qc +++ b/qcsrc/common/effects/qc/damageeffects.qc @@ -244,7 +244,7 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew) if(it.damageforcescale) if(vdist(thisforce, !=, 0)) { - it.velocity = it.velocity + damage_explosion_calcpush(it.damageforcescale * thisforce, it.velocity, autocvar_g_balance_damagepush_speedfactor); + it.velocity = it.velocity + damage_explosion_calcpush(it.damageforcescale * thisforce, it.velocity, damagepush_speedfactor); UNSET_ONGROUND(it); } diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 635bed7cf7..abb5693a34 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -772,6 +772,7 @@ void ClientInit_misc(entity this) else WriteString(channel, ""); WriteByte(channel, this.count * 255.0); // g_balance_armor_blockpercent + WriteByte(channel, this.cnt * 255.0); // g_balance_damagepush_speedfactor WriteByte(channel, serverflags); WriteCoord(channel, autocvar_g_trueaim_minrange); } @@ -784,6 +785,11 @@ void ClientInit_CheckUpdate(entity this) this.count = autocvar_g_balance_armor_blockpercent; this.SendFlags |= 1; } + if(this.cnt != autocvar_g_balance_damagepush_speedfactor) + { + this.cnt = autocvar_g_balance_damagepush_speedfactor; + this.SendFlags |= 1; + } } void ClientInit_Spawn() diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 1cc9db2b97..d991794b75 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -351,7 +351,7 @@ void GetTeamCounts(entity ignore) cb1 = cb1 + bvalue; } } - if(t == NUM_TEAM_2) + else if(t == NUM_TEAM_2) { if(c2 >= 0) { @@ -359,7 +359,7 @@ void GetTeamCounts(entity ignore) cb2 = cb2 + bvalue; } } - if(t == NUM_TEAM_3) + else if(t == NUM_TEAM_3) { if(c3 >= 0) { @@ -367,7 +367,7 @@ void GetTeamCounts(entity ignore) cb3 = cb3 + bvalue; } } - if(t == NUM_TEAM_4) + else if(t == NUM_TEAM_4) { if(c4 >= 0) { -- 2.39.2