void CShotgun::StartReload(int zoomed) { //If reload was broken to shoot, do not start a reload before shooting if(m_break_reload) return; int ammoCount = m_pWeapon->GetAmmoCount(m_pShared->fireparams.ammo_type_class); if((ammoCount >= m_pShared->fireparams.clip_size) || m_reloading) return; m_max_shells = m_pShared->fireparams.clip_size - ammoCount; m_reload_was_broken = false; m_reloading = true; if(zoomed) m_pWeapon->ExitZoom(); IEntityClass *ammo = m_pShared->fireparams.ammo_type_class; m_pWeapon->OnStartReload(m_pWeapon->GetOwnerId(), ammo); m_pWeapon->PlayAction(g_pItemStrings->begin_reload, 0, false, CItem::eIPAF_Default|CItem::eIPAF_RepeatLastFrame); m_reload_pump = ammoCount > 0 ? false : true; uint32 animTime = m_pWeapon->GetCurrentAnimationTime(eIGS_FirstPerson); if(animTime==0) animTime = 500; //For DS m_pWeapon->GetScheduler()->TimerAction(animTime, CSchedulerAction<BeginReloadLoop>::Create(BeginReloadLoop(this, zoomed)), false); m_pWeapon->GetScheduler()->TimerAction((uint32)((m_pShared->fireparams.reload_time-0.125f)*1000), CSchedulerAction<SliderBack>::Create(this), false); }
void CShotgun::StartReload(int zoomed) { //If reload was broken to shoot, do not start a reload before shooting if(m_break_reload) return; int clipSize = GetClipSize(); int ammoCount = m_pWeapon->GetAmmoCount(m_fireParams->fireparams.ammo_type_class); if ((ammoCount >= clipSize) || m_reloading) return; CActor* pActor = m_pWeapon->GetOwnerActor(); m_max_shells = clipSize - ammoCount; m_reload_was_broken = false; m_reloading = true; if (zoomed) m_pWeapon->ExitZoom(true); IEntityClass* ammo = m_fireParams->fireparams.ammo_type_class; m_pWeapon->OnStartReload(m_pWeapon->GetOwnerId(), ammo); m_pWeapon->PlayAction(GetFragmentIds().begin_reload, 0, false, CItem::eIPAF_Default, -1); m_reload_pump = ammoCount > 0 ? false : true; uint32 animTime = m_pWeapon->GetCurrentAnimationTime(eIGS_Owner); if(animTime==0) animTime = 500; //For DS m_pWeapon->GetScheduler()->TimerAction(animTime, CSchedulerAction<BeginReloadLoop>::Create(BeginReloadLoop(this, zoomed)), false); }