Fix weapons reload bug on save/restore.

This commit is contained in:
Andrey Akhmichin 2022-11-03 23:01:42 +05:00
parent 35d6edf6dc
commit e4f4666f5d
No known key found for this signature in database
GPG Key ID: 1F180D249B0643C0
6 changed files with 17 additions and 10 deletions

View File

@ -197,6 +197,9 @@ void CAK47::PrimaryAttack()
void CAK47::Reload( void )
{
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == AK47_MAX_CLIP )
return;
DefaultReload( AK47_MAX_CLIP, AK47_RELOAD, 3.0 );
}

View File

@ -169,12 +169,12 @@ void CGOLDENGUN::Reload( void )
{
int iResult;
if (m_iClip == GOLDENGUN_MAX_CLIP)
return;
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == GOLDENGUN_MAX_CLIP )
return;
if (m_iClip == 0)
{
iResult = DefaultReload( GOLDENGUN_MAX_CLIP, GOLDENGUN_RELOAD2, 2.7, 0 );
iResult = DefaultReload( GOLDENGUN_MAX_CLIP, GOLDENGUN_RELOAD, 2.7, 0 );
}
else
{

View File

@ -149,12 +149,12 @@ void CJackal::Reload( void )
{
int iResult;
if (m_iClip == JACKAL_MAX_CLIP)
return;
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == JACKAL_MAX_CLIP )
return;
if (m_iClip == 0)
{
iResult = DefaultReload( JACKAL_MAX_CLIP, Jackal_RELOAD2, 2.7, 0 );
iResult = DefaultReload( JACKAL_MAX_CLIP, Jackal_RELOAD, 2.7, 0 );
}
else
{

View File

@ -442,8 +442,10 @@ void CModman::FireHorn()
void CModman::Reload( void )
{
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == CROSSBOW_MAX_CLIP )
return;
if ( DefaultReload( 5, CROSSBOW_RELOAD, 4.5 ) )
if ( DefaultReload( CROSSBOW_MAX_CLIP, CROSSBOW_RELOAD, 4.5 ) )
{
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/xbow_reload1.wav", RANDOM_FLOAT(0.95, 1.0), ATTN_NORM, 0, 93 + RANDOM_LONG(0,0xF));
}

View File

@ -185,6 +185,8 @@ void CMW2::PrimaryAttack()
void CMW2::Reload( void )
{
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == MW2_MAX_CLIP )
return;
DefaultReload( MW2_MAX_CLIP, MW2_RELOAD, 3.0 );
}

View File

@ -164,8 +164,8 @@ void CZAPPER::Reload( void )
{
int iResult;
if (m_iClip == ZAPPER_MAX_CLIP)
return;
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == ZAPPER_MAX_CLIP )
return;
if (m_iClip == 0)
{
@ -173,7 +173,7 @@ void CZAPPER::Reload( void )
}
else
{
iResult = DefaultReload( ZAPPER_MAX_CLIP, ZAPPER_RELOAD, 1.5, 0 );
iResult = DefaultReload( ZAPPER_MAX_CLIP, ZAPPER_RELOAD_NOT_EMPTY, 1.5, 0 );
}
if (iResult)
{