Skip to content

Commit

Permalink
Find single weapon instead of just checking whether we switch to/from it
Browse files Browse the repository at this point in the history
  • Loading branch information
TomyLobo committed Mar 30, 2016
1 parent f8651c9 commit 97dae20
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions mp/src/game/shared/da/weapon_akimbobase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,31 +86,27 @@ Activity CAkimboBase::GetIdleActivity(void)
bool CAkimboBase::Deploy()
{
// Transfer iClip1 of single pistol to m_iRightClip
CWeaponDABase *from = GetPlayerOwner()->m_hSwitchFrom;
DAWeaponID eFromId = DA_WEAPON_NONE;
DAWeaponID eSingleId = AliasToWeaponID(GetSDKWpnData().m_szSingle);
if (from)
eFromId = from->GetWeaponID();
if (eFromId == eSingleId)
{
m_iRightClip = from->m_iClip1;
m_iClip1 = m_iLeftClip + m_iRightClip;
}

CWeaponDABase *pSingle = GetPlayerOwner()->FindWeapon(eSingleId);
Assert(pSingle);

m_iRightClip = pSingle->m_iClip1;
m_iClip1 = m_iLeftClip + m_iRightClip;

return BaseClass::Deploy();
}

bool CAkimboBase::Holster(CBaseCombatWeapon *pSwitchingTo)
{
// Transfer m_iRightClip into iClip1 of single pistol
CWeaponDABase *to = (CWeaponDABase *)pSwitchingTo;
DAWeaponID eToId = DA_WEAPON_NONE;
DAWeaponID eSingleId = AliasToWeaponID(GetSDKWpnData().m_szSingle);
if (to)
eToId = to->GetWeaponID();
if (eToId == eSingleId)
{
to->m_iClip1 = m_iRightClip;
}

CWeaponDABase *pSingle = GetPlayerOwner()->FindWeapon(eSingleId);
Assert(pSingle);

pSingle->m_iClip1 = m_iRightClip;

return BaseClass::Holster(pSwitchingTo);
}

Expand Down

0 comments on commit 97dae20

Please sign in to comment.