Esempio n. 1
0
void C_ASW_Alien::GetShadowFromFlashlight(Vector &vecDir, float &fContribution) const
{
	if (gpGlobals->framecount == m_iLastCustomFrame)
	{
		return;
	}
	
	if ( ASWGameResource() )
	{
		// go through all marines
		int iMaxMarines = ASWGameResource()->GetMaxMarineResources();
		for (int i=0;i<iMaxMarines;i++)
		{
			C_ASW_Marine_Resource *pMR = ASWGameResource()->GetMarineResource(i);
			C_ASW_Marine *pMarine = pMR ? pMR->GetMarineEntity() : NULL;
			if (pMarine && pMarine->m_pFlashlight)	// if this is a marine with a flashlight
			{
				Vector diff = WorldSpaceCenter() - pMarine->EyePosition();
				if (diff.Length() < 700.0f)
				{
					diff.NormalizeInPlace();
					Vector vecMarineFacing(0,0,0);
					AngleVectors(pMarine->GetAbsAngles(), &vecMarineFacing);
					float dot = vecMarineFacing.Dot(diff);
					if (dot > 0.2)	// if the flashlight is facing us
					{
						vecDir += dot * diff;
						fContribution += (dot - 0.2f) * 1.25f;
					}
				}
			}
		}
	}
}
void asw_mesh_emitter_test_f()
{
	C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer();
	if (pPlayer && pPlayer->GetMarine())
	{
		C_ASW_Marine *pMarine = pPlayer->GetMarine();
		C_ASW_Mesh_Emitter *pEmitter = new C_ASW_Mesh_Emitter;
		if (pEmitter)
		{
			if (pEmitter->InitializeAsClientEntity( "models/swarm/DroneGibs/dronepart01.mdl", false ))
			{
				Vector vecForward;
				AngleVectors(pMarine->GetAbsAngles(), &vecForward);
				Vector vecEmitterPos = pMarine->GetAbsOrigin() + vecForward * 200.0f;
				Q_snprintf(pEmitter->m_szTemplateName, sizeof(pEmitter->m_szTemplateName), "dronegiblots");
				pEmitter->m_fScale = 1.0f;
				pEmitter->m_bEmit = true;
				pEmitter->SetAbsOrigin(vecEmitterPos);
				pEmitter->CreateEmitter(vec3_origin);
				pEmitter->SetAbsOrigin(vecEmitterPos);
				pEmitter->SetDieTime(gpGlobals->curtime + 15.0f);
			}
			else
			{
				pEmitter->Release();
			}
		}
	}
}
Esempio n. 3
0
static void GetPos( const CCommand &args, Vector &vecOrigin, QAngle &angles )
{
	int nSlot = GET_ACTIVE_SPLITSCREEN_SLOT();
	vecOrigin = MainViewOrigin(nSlot);
	angles = MainViewAngles(nSlot);

#ifdef INFESTED_DLL
	C_ASW_Marine *pMarine = C_ASW_Marine::GetLocalMarine();
	if ( pMarine )
	{
		vecOrigin = pMarine->GetAbsOrigin();
		angles = pMarine->GetAbsAngles();
	}
#endif
	if ( ( args.ArgC() == 2 && atoi( args[1] ) == 2 ) || FStrEq( args[0], "getpos_exact" ) )
	{
		C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
		if ( pPlayer )
		{
			vecOrigin = pPlayer->GetAbsOrigin();
			angles = pPlayer->GetAbsAngles();
		}
	}
}