Beispiel #1
0
void CShootingObject::Load	(LPCSTR section)
{
	if(pSettings->line_exist(section,"light_disabled"))
	{
		m_bLightShotEnabled		= !pSettings->r_bool(section,"light_disabled");
	}else
		m_bLightShotEnabled		= true;

	//время затрачиваемое на выстрел
	fOneShotTime			= pSettings->r_float		(section,"rpm");
	VERIFY(fOneShotTime>0.f);
	fOneShotTime			= 60.f / fOneShotTime;

	LoadFireParams		(section);
	LoadLights			(section, "");
	LoadShellParticles	(section, "");
	LoadFlameParticles	(section, "");
}
Beispiel #2
0
void CWeaponMagazined::InitAddons()
{
	//////////////////////////////////////////////////////////////////////////
	// Прицел
	m_fIronSightZoomFactor = READ_IF_EXISTS(pSettings, r_float, cNameSect(), "ironsight_zoom_factor", 50.0f);

	if (IsScopeAttached())
	{
		if (m_eScopeStatus == ALife::eAddonAttachable)
		{
			m_sScopeName = pSettings->r_string(cNameSect(), "scope_name");
			m_iScopeX = pSettings->r_s32(cNameSect(), "scope_x");
			m_iScopeY = pSettings->r_s32(cNameSect(), "scope_y");

			shared_str scope_tex_name;
			scope_tex_name = pSettings->r_string(*m_sScopeName, "scope_texture");
			m_fScopeZoomFactor = pSettings->r_float(*m_sScopeName, "scope_zoom_factor");

			if (m_UIScope) xr_delete(m_UIScope);
			m_UIScope = xr_new<CUIStaticItem>();

			//			m_UIScope->Init(*scope_tex_name, "hud\\default", 0, 0, alNone);
			m_UIScope->Init(*scope_tex_name, "hud\\scopes", 0, 0, alNone);	// KD: special shader that account screen resolution
		}
		else if (m_eScopeStatus == ALife::eAddonPermanent)
		{
			m_fScopeZoomFactor = pSettings->r_float(cNameSect(), "scope_zoom_factor");
			shared_str scope_tex_name;
			scope_tex_name = pSettings->r_string(cNameSect(), "scope_texture");

			if (m_UIScope) xr_delete(m_UIScope);
			m_UIScope = xr_new<CUIStaticItem>();
			//			m_UIScope->Init(*scope_tex_name, "hud\\default", 0, 0, alNone);
			m_UIScope->Init(*scope_tex_name, "hud\\scopes", 0, 0, alNone);	// KD: special shader that account screen resolution
		}
	}
	else
	{
		if (m_UIScope) xr_delete(m_UIScope);

		if (IsZoomEnabled())
			m_fIronSightZoomFactor = pSettings->r_float(cNameSect(), "scope_zoom_factor");
	}

	if (IsSilencerAttached() && SilencerAttachable())
	{
		m_sFlameParticlesCurrent = m_sSilencerFlameParticles;
		m_sSmokeParticlesCurrent = m_sSilencerSmokeParticles;
		m_pSndShotCurrent = &sndSilencerShot;

		//сила выстрела
		LoadFireParams(*cNameSect(), "");

		//подсветка от выстрела
		LoadLights(*cNameSect(), "silencer_");
		ApplySilencerKoeffs();
	}
	else
	{
		m_sFlameParticlesCurrent = m_sFlameParticles;
		m_sSmokeParticlesCurrent = m_sSmokeParticles;
		m_pSndShotCurrent = &sndShot;

		//сила выстрела
		LoadFireParams(*cNameSect(), "");
		//подсветка от выстрела
		LoadLights(*cNameSect(), "");
	}

	inherited::InitAddons();
}