I have finally gotten my AA-12 shotgun to be automatic like a machine gun.. now since it has a drum magazine.. we want it to reload just like an SMG would.. the current shotgun code overrides so its only one shell at a time.. meaning it uses our reload animation 20 times to fill a whole magazine.. How do we get it to where it simply just does the reload animation then bam.. we have our 20 shells?
- Code: Select all
bool CWeaponAA12::StartReload( void )
{
CBaseCombatCharacter *pOwner = GetOwner();
if ( pOwner == NULL )
return false;
if (pOwner->GetAmmoCount(m_iPrimaryAmmoType) <= 0)
return false;
if (m_iClip1 >= GetMaxClip1())
return false;
// If AA12 totally emptied then a pump animation is needed
//NOTENOTE: This is kinda lame because the player doesn't get strong feedback on when the reload has finished,
// without the pump. Technically, it's incorrect, but it's good for feedback...
if (m_iClip1 <= 0)
{
m_bNeedPump = true;
}
int j = min(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType));
if (j <= 0)
return false;
SendWeaponAnim( ACT_SHOTGUN_RELOAD_START );
// Make AA12 shell visible
SetBodygroup(1,0);
pOwner->m_flNextAttack = gpGlobals->curtime;
m_flNextPrimaryAttack = gpGlobals->curtime + SequenceDuration();
m_bInReload = true;
return true;
}
//-----------------------------------------------------------------------------
// Purpose: Override so only reload one shell at a time
// Input :
// Output :
//-----------------------------------------------------------------------------
bool CWeaponAA12::Reload( void )
{
// Check that StartReload was called first
if (!m_bInReload)
{
Warning("ERROR: AA12 Reload called incorrectly!\n");
}
CBaseCombatCharacter *pOwner = GetOwner();
if ( pOwner == NULL )
return false;
if (pOwner->GetAmmoCount(m_iPrimaryAmmoType) <= 0)
return false;
if (m_iClip1 >= GetMaxClip1())
return false;
int j = min(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType));
if (j <= 0)
return false;
FillClip();
// Play reload on different channel as otherwise steals channel away from fire sound
WeaponSound(RELOAD);
SendWeaponAnim( ACT_VM_RELOAD );
pOwner->m_flNextAttack = gpGlobals->curtime;
m_flNextPrimaryAttack = gpGlobals->curtime + SequenceDuration();
return true;
}
//-----------------------------------------------------------------------------
// Purpose: Play finish reload anim and fill clip
// Input :
// Output :
//-----------------------------------------------------------------------------
void CWeaponAA12::FinishReload( void )
{
// Make AA12 shell invisible
SetBodygroup(1,1);
CBaseCombatCharacter *pOwner = GetOwner();
if ( pOwner == NULL )
return;
m_bInReload = false;
// Finish reload animation
SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH );
pOwner->m_flNextAttack = gpGlobals->curtime;
m_flNextPrimaryAttack = gpGlobals->curtime + SequenceDuration();
}
Showing off what we've got.. and in one part.. notice how it tries to reload, but only puts in 1 shell..












