void CWeaponBM16::PlayReloadSound() { if(m_magazine.size()==1) PlaySound ("sndReload1",get_LastFP()); else PlaySound ("sndReload",get_LastFP()); }
void CWeaponMagazined::UpdateSounds () { if (Device.dwFrame == dwUpdateSounds_Frame) return; dwUpdateSounds_Frame = Device.dwFrame; // ref_sound positions if (sndShow.playing ()) sndShow.set_position (get_LastFP()); if (sndHide.playing ()) sndHide.set_position (get_LastFP()); if (sndShot.playing ()) sndShot.set_position (get_LastFP()); if (sndReload.playing ()) sndReload.set_position (get_LastFP()); if (sndEmptyClick.playing ()) sndEmptyClick.set_position (get_LastFP()); }
void CWeaponKnife::OnAnimationEnd(u32 state) { switch (state) { case eHiding: SwitchState(eHidden); break; case eFire: case eFire2: { if(m_attackStart) { m_attackStart = false; if(GetState()==eFire) m_pHUD->animPlay(random_anim(mhud_attack_e), TRUE, this, GetState()); else m_pHUD->animPlay(random_anim(mhud_attack2_e), TRUE, this, GetState()); Fvector p1, d; p1.set(get_LastFP()); d.set(get_LastFD()); if(H_Parent()) smart_cast<CEntity*>(H_Parent())->g_fireParams(this, p1,d); else break; KnifeStrike(p1,d); } else SwitchState(eIdle); }break; case eShowing: case eIdle: SwitchState(eIdle); break; } }
void CWeaponMagazined::switch2_Showing() { PlaySound(sndShow, get_LastFP()); m_bPending = true; PlayAnimShow(); }
void CWeaponMagazinedWGrenade::UpdateSounds () { inherited::UpdateSounds (); Fvector P = get_LastFP(); m_sounds.SetPosition("sndShotG", P); m_sounds.SetPosition("sndReloadG", P); m_sounds.SetPosition("sndSwitch", P); }
void CWeaponMagazined::state_Fire(float dt) { VERIFY(fTimeToFire > 0.f); Fvector p1, d; p1.set(get_LastFP()); d.set(get_LastFD()); if (!H_Parent()) return; CInventoryOwner* io = smart_cast<CInventoryOwner*>(H_Parent()); if (NULL == io->inventory().ActiveItem()) { Log("current_state", GetState()); Log("next_state", GetNextState()); Log("state_time", m_dwStateTime); Log("item_sect", cNameSect().c_str()); Log("H_Parent", H_Parent()->cNameSect().c_str()); } smart_cast<CEntity*> (H_Parent())->g_fireParams(this, p1, d); if (m_iShotNum == 0) { m_vStartPos = p1; m_vStartDir = d; }; VERIFY(!m_magazine.empty()); // Msg("%d && %d && (%d || %d) && (%d || %d)", !m_magazine.empty(), fTime<=0, IsWorking(), m_bFireSingleShot, m_iQueueSize < 0, m_iShotNum < m_iQueueSize); while (!m_magazine.empty() && fTime <= 0 && (IsWorking() || m_bFireSingleShot) && (m_iQueueSize < 0 || m_iShotNum < m_iQueueSize)) { m_bFireSingleShot = false; VERIFY(fTimeToFire > 0.f); fTime += fTimeToFire; ++m_iShotNum; OnShot(); static int i = 0; if (i || m_iShotNum > m_iShootEffectorStart) { // Do Weapon Callback. (Cribbledirge) StateSwitchCallback(GameObject::eOnActorWeaponFire, GameObject::eOnNPCWeaponFire); FireTrace(p1, d); } else { FireTrace(m_vStartPos, m_vStartDir); } } if (m_iShotNum == m_iQueueSize) m_bStopedAfterQueueFired = true; UpdateSounds(); }
void CWeaponRPG7::switch2_Fire() { m_iShotNum = 0; m_bFireSingleShot = true; bWorking = false; if(GetState()==eFire && getRocketCount()) { Fvector p1, d1, p; Fvector p2, d2, d; p1.set (get_LastFP()); d1.set (get_LastFD()); p = p1; d = d1; CEntity* E = smart_cast<CEntity*> (H_Parent()); if(E) { E->g_fireParams (this, p2,d2); p = p2; d = d2; if(IsHudModeNow()) { Fvector p0; float dist = HUD().GetCurrentRayQuery().range; p0.mul (d2,dist); p0.add (p1); p = p1; d.sub (p0,p1); d.normalize_safe(); } } Fmatrix launch_matrix; launch_matrix.identity (); launch_matrix.k.set (d); Fvector::generate_orthonormal_basis(launch_matrix.k, launch_matrix.j, launch_matrix.i); launch_matrix.c.set (p); d.normalize (); d.mul (m_fLaunchSpeed); CRocketLauncher::LaunchRocket (launch_matrix, d, zero_vel); CExplosiveRocket* pGrenade = smart_cast<CExplosiveRocket*>(getCurrentRocket()); VERIFY (pGrenade); pGrenade->SetInitiator (H_Parent()->ID()); if (OnServer()) { NET_Packet P; u_EventGen (P,GE_LAUNCH_ROCKET,ID()); P.w_u16 (u16(getCurrentRocket()->ID())); u_EventSend (P); } } }
void CWeaponMagazined::switch2_Hiding() { CWeapon::FireEnd(); PlaySound(sndHide, get_LastFP()); PlayAnimHide(); m_bPending = true; }
void CWeaponPistol::PlayAnimHide() { VERIFY(GetState()==eHiding); if(iAmmoElapsed==0) { PlaySound ("sndClose", get_LastFP()); PlayHUDMotion ("anm_hide_empty" , TRUE, this, GetState()); } else inherited::PlayAnimHide(); }
void CWeaponPistol::PlayAnimHide() { VERIFY(GetState()==eHiding); if(m_opened) { PlaySound (sndClose,get_LastFP()); CWeaponPistol::WWPMotions& m = wwpm_current(); m_pHUD->animPlay (random_anim(m.mhud_close), TRUE, this, GetState()); } else inherited::PlayAnimHide(); }
//переключение режимов стрельбы одиночными и очередями bool CWeaponMagazined::SwitchMode() { if (eIdle != GetState() || IsPending()) return false; if (SingleShotMode()) m_iQueueSize = WEAPON_ININITE_QUEUE; else m_iQueueSize = 1; PlaySound(sndEmptyClick, get_LastFP()); return true; }
void CWeaponPistol::OnShot () { PlaySound (m_sSndShotCurrent.c_str(),get_LastFP()); AddShotEffector (); PlayAnimShoot (); // Shell Drop Fvector vel; PHGetLinearVell(vel); OnShellDrop (get_LastSP(), vel); // ќгонь из ствола StartFlameParticles (); R_ASSERT2(!m_pFlameParticles || !m_pFlameParticles->IsLooped(), "can't set looped particles system for shoting with pistol"); //дым из ствола StartSmokeParticles (get_LastFP(), vel); }
void CWeaponMagazined::OnShot() { // Sound PlaySound(*m_pSndShotCurrent, get_LastFP()); // Camera AddShotEffector(); // Animation PlayAnimShoot(); // Shell Drop Fvector vel; PHGetLinearVell(vel); OnShellDrop(get_LastSP(), vel); // Огонь из ствола StartFlameParticles(); //дым из ствола ForceUpdateFireParticles(); StartSmokeParticles(get_LastFP(), vel); }
void CWeaponKnife::OnMotionMark(u32 state, const motion_marks& M) { inherited::OnMotionMark(state, M); if(state==eFire || state==eFire2) { Fvector p1, d; p1.set (get_LastFP()); d.set (get_LastFD()); if(H_Parent()) { smart_cast<CEntity*>(H_Parent())->g_fireParams(this, p1,d); KnifeStrike(p1,d); } } }
void CWeaponMagazined::UpdateSounds() { if (Device.dwFrame == dwUpdateSounds_Frame) return; dwUpdateSounds_Frame = Device.dwFrame; // ref_sound positions if (sndShow.playing()) sndShow.set_position(get_LastFP()); if (sndHide.playing()) sndHide.set_position(get_LastFP()); if (sndShot.playing()) sndShot.set_position(get_LastFP()); if (sndReload.playing()) sndReload.set_position(get_LastFP()); if (sndEmptyClick.playing()) sndEmptyClick.set_position(get_LastFP()); if (sndSightsUp.playing()) sndSightsUp.set_position(get_LastFP()); //Daemonion - iron sight audio - sights being raised if (sndSightsDown.playing()) sndSightsDown.set_position(get_LastFP()); //Daemonion - iron sight audio - sights being lowered }
void CWeapon::debug_draw_firedeps() { #ifdef DEBUG if(hud_adj_mode==5||hud_adj_mode==6||hud_adj_mode==7) { CDebugRenderer &render = Level().debug_renderer(); if(hud_adj_mode==5) render.draw_aabb(get_LastFP(), 0.005f,0.005f,0.005f,D3DCOLOR_XRGB(255,0,0)); if(hud_adj_mode==6) render.draw_aabb(get_LastFP2(), 0.005f,0.005f,0.005f,D3DCOLOR_XRGB(0,0,255)); if(hud_adj_mode==7) render.draw_aabb(get_LastSP(), 0.005f,0.005f,0.005f,D3DCOLOR_XRGB(0,255,0)); } #endif // DEBUG }
bool CWeaponMagazinedWGrenade::SwitchMode() { bool bUsefulStateToSwitch = ((eIdle==GetState())||(eHidden==GetState())||(eMisfire==GetState())||(eMagEmpty==GetState())) && (!IsPending()); if(!bUsefulStateToSwitch) return false; if(!IsGrenadeLauncherAttached()) return false; SetPending (TRUE); PerformSwitchGL (); PlaySound ("sndSwitch", get_LastFP()); PlayAnimModeSwitch (); m_dwAmmoCurrentCalcFrame = 0; return true; }
void CWeaponPistol::UpdateSounds() { inherited::UpdateSounds(); if (sndClose.playing()) sndClose.set_position (get_LastFP()); }
void CWeaponPistol::UpdateSounds() { inherited::UpdateSounds(); m_sounds.SetPosition("sndClose", get_LastFP()); }
void CWeaponMagazined::PlayReloadSound() { PlaySound(sndReload, get_LastFP()); }
void CWeaponMagazined::OnEmptyClick() { PlaySound(sndEmptyClick, get_LastFP()); }