Exemplo n.º 1
0
void CWeaponBM16::PlayReloadSound()
{
	if(m_magazine.size()==1)	
		PlaySound	("sndReload1",get_LastFP());
	else						
		PlaySound	("sndReload",get_LastFP());
}
Exemplo n.º 2
0
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());
}
Exemplo n.º 3
0
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;	
	}
}
Exemplo n.º 4
0
void CWeaponMagazined::switch2_Showing()
{
	PlaySound(sndShow, get_LastFP());

	m_bPending = true;
	PlayAnimShow();
}
Exemplo n.º 5
0
void CWeaponMagazinedWGrenade::UpdateSounds	()
{
	inherited::UpdateSounds			();
	Fvector P						= get_LastFP();
	m_sounds.SetPosition("sndShotG", P);
	m_sounds.SetPosition("sndReloadG", P);
	m_sounds.SetPosition("sndSwitch", P);
}
Exemplo n.º 6
0
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();
}
Exemplo n.º 7
0
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);
		}
	}
}
Exemplo n.º 8
0
void CWeaponMagazined::switch2_Hiding()
{
	CWeapon::FireEnd();

	PlaySound(sndHide, get_LastFP());

	PlayAnimHide();
	m_bPending = true;
}
Exemplo n.º 9
0
void CWeaponPistol::PlayAnimHide()
{
	VERIFY(GetState()==eHiding);
	if(iAmmoElapsed==0) 
	{
		PlaySound			("sndClose", get_LastFP());
		PlayHUDMotion		("anm_hide_empty" , TRUE, this, GetState());
	} 
	else 
		inherited::PlayAnimHide();
}
Exemplo n.º 10
0
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();
}
Exemplo n.º 11
0
//переключение режимов стрельбы одиночными и очередями
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;
}
Exemplo n.º 12
0
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);
}
Exemplo n.º 13
0
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);
}
Exemplo n.º 14
0
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);
		}
	}
}
Exemplo n.º 15
0
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
}
Exemplo n.º 16
0
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
}
Exemplo n.º 17
0
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;
}
Exemplo n.º 18
0
void CWeaponPistol::UpdateSounds()
{
	inherited::UpdateSounds();

	if (sndClose.playing()) sndClose.set_position	(get_LastFP());
}
Exemplo n.º 19
0
void CWeaponPistol::UpdateSounds()
{
	inherited::UpdateSounds();
	m_sounds.SetPosition("sndClose", get_LastFP());
}
Exemplo n.º 20
0
void CWeaponMagazined::PlayReloadSound()
{
	PlaySound(sndReload, get_LastFP());
}
Exemplo n.º 21
0
void CWeaponMagazined::OnEmptyClick()
{
	PlaySound(sndEmptyClick, get_LastFP());
}