From bb5add5c03ce144141611843a4787c7deaddceb8 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Wed, 18 Mar 2020 17:34:34 +0100 Subject: [PATCH 1/8] Record number of punches thrown while holding down the button --- mp/src/game/client/sdk/c_sdk_player.cpp | 2 ++ mp/src/game/client/sdk/c_sdk_player.h | 6 ++++++ mp/src/game/server/sdk/sdk_player.cpp | 1 + mp/src/game/server/sdk/sdk_player.h | 6 ++++++ mp/src/game/shared/sdk/sdk_weapon_melee.cpp | 5 +++++ mp/src/game/shared/sdk/weapon_sdkbase.cpp | 7 +++++++ 6 files changed, 27 insertions(+) diff --git a/mp/src/game/client/sdk/c_sdk_player.cpp b/mp/src/game/client/sdk/c_sdk_player.cpp index 014697611..da8c97699 100644 --- a/mp/src/game/client/sdk/c_sdk_player.cpp +++ b/mp/src/game/client/sdk/c_sdk_player.cpp @@ -192,6 +192,7 @@ END_RECV_TABLE() BEGIN_RECV_TABLE_NOBASE( C_SDKPlayer, DT_SDKLocalPlayerExclusive ) RecvPropInt( RECVINFO( m_iShotsFired ) ), + RecvPropInt( RECVINFO( m_iPunchesThrown ) ), RecvPropVector( RECVINFO_NAME( m_vecNetworkOrigin, m_vecOrigin ) ), RecvPropFloat( RECVINFO_NAME( m_angEyeAngles.x, m_angEyeAngles[0] ) ), @@ -338,6 +339,7 @@ BEGIN_PREDICTION_DATA( C_SDKPlayer ) DEFINE_PRED_FIELD( m_flDisarmRedraw, FIELD_FLOAT, FTYPEDESC_INSENDTABLE ), DEFINE_PRED_FIELD( m_flCycle, FIELD_FLOAT, FTYPEDESC_OVERRIDE | FTYPEDESC_PRIVATE | FTYPEDESC_NOERRORCHECK ), DEFINE_PRED_FIELD( m_iShotsFired, FIELD_INTEGER, FTYPEDESC_INSENDTABLE ), + DEFINE_PRED_FIELD( m_iPunchesThrown, FIELD_INTEGER, FTYPEDESC_INSENDTABLE ), DEFINE_PRED_FIELD( m_flStylePoints, FIELD_FLOAT, FTYPEDESC_INSENDTABLE ), DEFINE_PRED_FIELD( m_flStyleSkillCharge, FIELD_FLOAT, FTYPEDESC_INSENDTABLE ), DEFINE_PRED_FIELD( m_flStyleSkillActivationTime, FIELD_FLOAT, FTYPEDESC_INSENDTABLE ), diff --git a/mp/src/game/client/sdk/c_sdk_player.h b/mp/src/game/client/sdk/c_sdk_player.h index 3508639ef..4e1c07e18 100644 --- a/mp/src/game/client/sdk/c_sdk_player.h +++ b/mp/src/game/client/sdk/c_sdk_player.h @@ -153,6 +153,11 @@ class C_SDKPlayer : public C_BasePlayer void ClearShotsFired() { m_iShotsFired = 0; } int GetShotsFired() { return m_iShotsFired; } + void IncreasePunchesThrown() { m_iPunchesThrown++; if (m_iPunchesThrown > 16) m_iPunchesThrown = 16; } + void DecreasePunchesThrown() { m_iPunchesThrown--; if (m_iPunchesThrown < 0) m_iPunchesThrown = 0; } + void ClearPunchesThrown() { m_iPunchesThrown = 0; } + int GetPunchesThrown() { return m_iPunchesThrown; } + virtual void DoMuzzleFlash(int iAkimbo = 0); virtual void MakeTracer( const Vector &vecTracerSrc, const trace_t &tr, int iTracerType, bool bUseTracerAttachment ); @@ -306,6 +311,7 @@ class C_SDKPlayer : public C_BasePlayer CInterpolatedVar< QAngle > m_iv_angEyeAngles; CNetworkVar( int, m_iShotsFired ); // number of shots fired recently + CNetworkVar( int, m_iPunchesThrown ); // number of punches thrown recently CNetworkVar( float, m_flFreezeUntil ); CNetworkVar( float, m_flFreezeAmount ); diff --git a/mp/src/game/server/sdk/sdk_player.cpp b/mp/src/game/server/sdk/sdk_player.cpp index 46b63ebff..8dbf9067a 100644 --- a/mp/src/game/server/sdk/sdk_player.cpp +++ b/mp/src/game/server/sdk/sdk_player.cpp @@ -170,6 +170,7 @@ END_SEND_TABLE() BEGIN_SEND_TABLE_NOBASE( CSDKPlayer, DT_SDKLocalPlayerExclusive ) SendPropInt( SENDINFO( m_iShotsFired ), 8, SPROP_UNSIGNED ), + SendPropInt( SENDINFO( m_iPunchesThrown ), 8, SPROP_UNSIGNED ), // send a hi-res origin to the local player for use in prediction SendPropVector (SENDINFO(m_vecOrigin), -1, SPROP_NOSCALE|SPROP_CHANGES_OFTEN, 0.0f, HIGH_DEFAULT, SendProxy_Origin ), diff --git a/mp/src/game/server/sdk/sdk_player.h b/mp/src/game/server/sdk/sdk_player.h index ad580a008..25a492043 100644 --- a/mp/src/game/server/sdk/sdk_player.h +++ b/mp/src/game/server/sdk/sdk_player.h @@ -167,6 +167,7 @@ class CSDKPlayer : public CBaseMultiplayerPlayer CNetworkQAngle( m_angEyeAngles ); // Copied from EyeAngles() so we can send it to the client. CNetworkVar( int, m_iShotsFired ); // number of shots fired recently + CNetworkVar( int, m_iPunchesThrown ); // number of punches thrown recently // Tracks our ragdoll entity. CNetworkHandle( CBaseEntity, m_hRagdoll ); // networked entity handle @@ -277,6 +278,11 @@ class CSDKPlayer : public CBaseMultiplayerPlayer void ClearShotsFired() { m_iShotsFired = 0; } int GetShotsFired() { return m_iShotsFired; } + void IncreasePunchesThrown() { m_iPunchesThrown++; if (m_iPunchesThrown > 16) m_iPunchesThrown = 16; } + void DecreasePunchesThrown() { m_iPunchesThrown--; if (m_iPunchesThrown < 0) m_iPunchesThrown = 0; } + void ClearPunchesThrown() { m_iPunchesThrown = 0; } + int GetPunchesThrown() { return m_iPunchesThrown; } + virtual void FreezePlayer(float flAmount = 0, float flTime = -1); virtual bool PlayerFrozen(); diff --git a/mp/src/game/shared/sdk/sdk_weapon_melee.cpp b/mp/src/game/shared/sdk/sdk_weapon_melee.cpp index 2e52d2024..9410ac0bb 100644 --- a/mp/src/game/shared/sdk/sdk_weapon_melee.cpp +++ b/mp/src/game/shared/sdk/sdk_weapon_melee.cpp @@ -108,6 +108,11 @@ void CWeaponSDKMelee::ItemPostFrame( void ) { WeaponIdle(); } + + if ( !( pPlayer->m_nButtons & (IN_ATTACK|IN_ATTACK2) ) && pPlayer->GetPunchesThrown() ) + { + pPlayer->ClearPunchesThrown(); + } } void CWeaponSDKMelee::PrimaryAttack() diff --git a/mp/src/game/shared/sdk/weapon_sdkbase.cpp b/mp/src/game/shared/sdk/weapon_sdkbase.cpp index f2d77da11..20a6606c6 100644 --- a/mp/src/game/shared/sdk/weapon_sdkbase.cpp +++ b/mp/src/game/shared/sdk/weapon_sdkbase.cpp @@ -603,6 +603,8 @@ void CWeaponSDKBase::Swing() { Hit( traceHit, m_bSwingSecondary ); } + + pOwner->IncreasePunchesThrown(); } Activity CWeaponSDKBase::ChooseIntersectionPointAndActivity( trace_t &hitTrace, const Vector &mins, const Vector &maxs, CSDKPlayer *pOwner ) @@ -1558,6 +1560,11 @@ void CWeaponSDKBase::ItemPostFrame( void ) pPlayer->DecreaseShotsFired(); } } + + if ( !( pPlayer->m_nButtons & IN_ATTACK2 ) ) + { + pPlayer->ClearPunchesThrown(); + } } ConVar da_drop_overflow_on_pickup("da_drop_overflow_on_pickup", "0", FCVAR_ARCHIVE | FCVAR_USERINFO | FCVAR_CLIENTDLL, "Enable to drop weapons in order to make room for what you pick up."); From 31f2c5a81381aad89683942829e74b5a6d82b2e3 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Wed, 18 Mar 2020 18:21:19 +0100 Subject: [PATCH 2/8] Limit melee bursts to 5 hits in a row --- mp/src/game/shared/sdk/weapon_sdkbase.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mp/src/game/shared/sdk/weapon_sdkbase.cpp b/mp/src/game/shared/sdk/weapon_sdkbase.cpp index 20a6606c6..a36e970b5 100644 --- a/mp/src/game/shared/sdk/weapon_sdkbase.cpp +++ b/mp/src/game/shared/sdk/weapon_sdkbase.cpp @@ -449,6 +449,9 @@ void CWeaponSDKBase::StartSwing(bool bIsSecondary, bool bIsStockAttack) if ( !pOwner ) return; + if (pOwner->GetPunchesThrown() > 5) + return; + if (!bIsStockAttack && bIsSecondary && pOwner->m_Shared.IsDiving()) return; From 78367ec9adb94246da9fa5f790092a6a6edc1bac Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Wed, 18 Mar 2020 18:37:18 +0100 Subject: [PATCH 3/8] Rearrange stuff --- mp/src/game/shared/sdk/weapon_sdkbase.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mp/src/game/shared/sdk/weapon_sdkbase.cpp b/mp/src/game/shared/sdk/weapon_sdkbase.cpp index a36e970b5..9d8e2115f 100644 --- a/mp/src/game/shared/sdk/weapon_sdkbase.cpp +++ b/mp/src/game/shared/sdk/weapon_sdkbase.cpp @@ -787,10 +787,11 @@ float CWeaponSDKBase::GetMeleeDamage( bool bIsSecondary, CSDKPlayer* pVictim ) c { CSDKPlayer *pPlayer = ToSDKPlayer( GetOwner() ); - // The heavier the damage the more it hurts. - float flDamage = RemapVal(GetSDKWpnData().iWeight, 7, 20, 45, 80); + float flDamage; //bool bIsStockAttack = pPlayer && pPlayer->GetActiveSDKWeapon() && !pPlayer->GetActiveSDKWeapon()->IsMeleeWeapon(); + // The heavier the damage the more it hurts. + flDamage = RemapVal(GetSDKWpnData().iWeight, 7, 20, 45, 80); if (pVictim) { From 90069ac7f2d4e2423cbac256e182aa0abddafa48 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Wed, 18 Mar 2020 18:51:54 +0100 Subject: [PATCH 4/8] Use damage values from the weapon script for non-stock-attack melee --- mp/src/game/shared/sdk/weapon_sdkbase.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mp/src/game/shared/sdk/weapon_sdkbase.cpp b/mp/src/game/shared/sdk/weapon_sdkbase.cpp index 9d8e2115f..c980da5d2 100644 --- a/mp/src/game/shared/sdk/weapon_sdkbase.cpp +++ b/mp/src/game/shared/sdk/weapon_sdkbase.cpp @@ -789,9 +789,16 @@ float CWeaponSDKBase::GetMeleeDamage( bool bIsSecondary, CSDKPlayer* pVictim ) c float flDamage; - //bool bIsStockAttack = pPlayer && pPlayer->GetActiveSDKWeapon() && !pPlayer->GetActiveSDKWeapon()->IsMeleeWeapon(); - // The heavier the damage the more it hurts. - flDamage = RemapVal(GetSDKWpnData().iWeight, 7, 20, 45, 80); + bool bIsStockAttack = pPlayer && pPlayer->GetActiveSDKWeapon() && !pPlayer->GetActiveSDKWeapon()->IsMeleeWeapon(); + if (bIsStockAttack) + { + // The heavier the damage the more it hurts. + flDamage = RemapVal(GetSDKWpnData().iWeight, 7, 20, 45, 80); + } + else { + // Get the damage from the weapon script. + flDamage = bIsSecondary ? GetSDKWpnData().m_iSecondaryDamage : GetSDKWpnData().m_iDamage; + } if (pVictim) { From 8af5dad296e7dafcc8e044f449342f82ef12229e Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Wed, 18 Mar 2020 18:54:25 +0100 Subject: [PATCH 5/8] Tone down non-stock-attack melee damage to previous values --- mp/game/dab/scripts/weapon_brawl.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mp/game/dab/scripts/weapon_brawl.txt b/mp/game/dab/scripts/weapon_brawl.txt index a47a34ebf..6a53bfe16 100755 --- a/mp/game/dab/scripts/weapon_brawl.txt +++ b/mp/game/dab/scripts/weapon_brawl.txt @@ -1,8 +1,8 @@ WeaponData { // Weapon characteristics: - "Damage" "45" // Punch - "SecondaryDamage" "85" // Kick + "Damage" "25" // Punch + "SecondaryDamage" "45" // Kick "Bullets" "1" // bullets per shoot "CycleTime" "0.35" // time between shoots "SecondaryCycleTime" "0.6" From 4c7d768419cbd3e96ddc6568491e6e211e00e763 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Wed, 18 Mar 2020 18:55:05 +0100 Subject: [PATCH 6/8] Tone down stock-attack melee damage to match non-stock-attack melee damage --- mp/src/game/shared/sdk/weapon_sdkbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mp/src/game/shared/sdk/weapon_sdkbase.cpp b/mp/src/game/shared/sdk/weapon_sdkbase.cpp index c980da5d2..fe7af13c8 100644 --- a/mp/src/game/shared/sdk/weapon_sdkbase.cpp +++ b/mp/src/game/shared/sdk/weapon_sdkbase.cpp @@ -793,7 +793,7 @@ float CWeaponSDKBase::GetMeleeDamage( bool bIsSecondary, CSDKPlayer* pVictim ) c if (bIsStockAttack) { // The heavier the damage the more it hurts. - flDamage = RemapVal(GetSDKWpnData().iWeight, 7, 20, 45, 80); + flDamage = RemapVal(GetSDKWpnData().iWeight, 7, 20, 25, 45); } else { // Get the damage from the weapon script. From 4143edc4ab86a42304e4b6feec94a3afd6fe6ccc Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Wed, 18 Mar 2020 18:56:43 +0100 Subject: [PATCH 7/8] Scale melee style charge usage based on damage --- mp/src/game/shared/sdk/weapon_sdkbase.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mp/src/game/shared/sdk/weapon_sdkbase.cpp b/mp/src/game/shared/sdk/weapon_sdkbase.cpp index fe7af13c8..cd815ed9c 100644 --- a/mp/src/game/shared/sdk/weapon_sdkbase.cpp +++ b/mp/src/game/shared/sdk/weapon_sdkbase.cpp @@ -584,10 +584,7 @@ void CWeaponSDKBase::Swing() } } - if (m_bSwingSecondary) - pOwner->UseStyleCharge(SKILL_BOUNCER, 5); - else - pOwner->UseStyleCharge(SKILL_BOUNCER, 2.5f); + pOwner->UseStyleCharge(SKILL_BOUNCER, GetMeleeDamage(m_bSwingSecondary, NULL) / 10); // ------------------------- // Miss From 8585057be486be8e7b07ca74d0b70d8012d2f3e4 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Wed, 23 Dec 2020 03:21:35 +0100 Subject: [PATCH 8/8] Reduce akimbo melee damage to single gun damage This leaves the attack speed as is in order to introduce an intentional disadvantage to players using akimbo guns over single guns. --- mp/src/game/shared/sdk/weapon_sdkbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mp/src/game/shared/sdk/weapon_sdkbase.cpp b/mp/src/game/shared/sdk/weapon_sdkbase.cpp index cd815ed9c..4ce5e0c42 100644 --- a/mp/src/game/shared/sdk/weapon_sdkbase.cpp +++ b/mp/src/game/shared/sdk/weapon_sdkbase.cpp @@ -790,7 +790,7 @@ float CWeaponSDKBase::GetMeleeDamage( bool bIsSecondary, CSDKPlayer* pVictim ) c if (bIsStockAttack) { // The heavier the damage the more it hurts. - flDamage = RemapVal(GetSDKWpnData().iWeight, 7, 20, 25, 45); + flDamage = RemapVal(GetWeight(), 7, 20, 25, 45); } else { // Get the damage from the weapon script.