From dcc13109b9c70152e6d9c9374e7a4ef2248ea028 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Tue, 2 Jan 2018 07:26:32 +0500 Subject: [PATCH] Override UseDecrement and iItemSlot calls. Fix weapons reload. --- cl_dll/health.cpp | 3 --- dlls/eftd/ak47.cpp | 2 +- dlls/eftd/mac10.cpp | 2 +- dlls/weapons.h | 18 ++++++++++++++++++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/cl_dll/health.cpp b/cl_dll/health.cpp index 34d2c466..eb180121 100644 --- a/cl_dll/health.cpp +++ b/cl_dll/health.cpp @@ -187,9 +187,6 @@ int CHudHealth::Draw( float flTime ) if( ( gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH ) || gEngfuncs.IsSpectateOnly() ) return 1; - if( !m_hSprite ) - m_hSprite = LoadSprite( "sprites/%d_pain.spr" ); - if( !( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_SUIT ) ) ) ) return 1; diff --git a/dlls/eftd/ak47.cpp b/dlls/eftd/ak47.cpp index 0ccd7ab6..08c6d5ce 100644 --- a/dlls/eftd/ak47.cpp +++ b/dlls/eftd/ak47.cpp @@ -185,7 +185,7 @@ void CAK47::PrimaryAttack() void CAK47::Reload(void) { - if (m_pPlayer->ammo_ak47 <= 0) + if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == AK47_MAX_CLIP ) return; DefaultReload(AK47_MAX_CLIP, AK47_RELOAD, 2.0); diff --git a/dlls/eftd/mac10.cpp b/dlls/eftd/mac10.cpp index 64c6d387..653c5c60 100644 --- a/dlls/eftd/mac10.cpp +++ b/dlls/eftd/mac10.cpp @@ -170,7 +170,7 @@ void CMac10::PrimaryAttack() void CMac10::Reload(void) { - if (m_pPlayer->ammo_mac10 <= 0) + if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == MAC10_MAX_CLIP ) return; DefaultReload(MAC10_MAX_CLIP, MAC10_RELOAD, 3.2); diff --git a/dlls/weapons.h b/dlls/weapons.h index 37033579..874cd0a6 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -1023,6 +1023,7 @@ class CAK47 : public CBasePlayerWeapon public: void Spawn( void ); void Precache( void ); + int iItemSlot( void ) { return 3; } int GetItemInfo( ItemInfo *p ); BOOL AddToPlayer( CBasePlayer *pPlayer ); @@ -1031,6 +1032,14 @@ public: void Reload( void ); void WeaponIdle( void ); + BOOL UseDecrement( void ) + { +#if defined( CLIENT_WEAPONS ) + return TRUE; +#else + return FALSE; +#endif + } private: int m_iShell; unsigned short m_usAK47; @@ -1041,6 +1050,7 @@ class CMac10 : public CBasePlayerWeapon public: void Spawn( void ); void Precache( void ); + int iItemSlot( void ) { return 2; } int GetItemInfo( ItemInfo *p ); BOOL AddToPlayer( CBasePlayer *pPlayer ); @@ -1049,6 +1059,14 @@ public: void Reload( void ); void WeaponIdle( void ); + BOOL UseDecrement( void ) + { +#if defined( CLIENT_WEAPONS ) + return TRUE; +#else + return FALSE; +#endif + } private: int m_iShell; unsigned short m_usMac10;