示例#1
0
void CRagGib::Spawn( const char *szModel, const Vector &vecOrigin, const Vector &vecForce, float flFadeTime = 0.0 )
{
	SetSolid( SOLID_BBOX );
	AddSolidFlags( FSOLID_NOT_SOLID );
	SetModel( szModel );
	UTIL_SetSize(this, vec3_origin, vec3_origin);
	UTIL_SetOrigin( this, vecOrigin );
	if ( !BecomeRagdollOnClient( vecForce ) )
	{
		AddSolidFlags( FSOLID_NOT_STANDABLE );
		RemoveSolidFlags( FSOLID_NOT_SOLID );
	}

	if( flFadeTime > 0.0 )
	{
		SUB_StartFadeOut( flFadeTime );
	}
}
示例#2
0
CDumbfire *CDumbfire::ShootDumbfire( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity )
{
	CDumbfire *pDumbfire = GetClassPtr( (CDumbfire *)NULL );
	pDumbfire->Spawn();

	UTIL_SetOrigin( pDumbfire->pev, vecStart );
	pDumbfire->pev->velocity = vecVelocity;
	pDumbfire->pev->angles = UTIL_VecToAngles (pDumbfire->pev->velocity);
	pDumbfire->pev->owner = ENT(pevOwner);
	pDumbfire->SetThink ( Follow );
	pDumbfire->pev->nextthink = 0.1;
	pDumbfire->SetTouch( ExplodeTouch );
	pDumbfire->pev->dmg = dmg_dumbfire_missile.value * (mp_wpn_power.value/100);
	pDumbfire->pev->avelocity.z = -300;

	FX_Trail(pDumbfire->pev->origin, pDumbfire->entindex(), PROJ_DUMBFIRE );
	return pDumbfire;
}
示例#3
0
void AvHBasePlayerWeapon::Spawn()
{
	CBasePlayerWeapon::Spawn();

	this->pev->solid = SOLID_BBOX;
	this->pev->movetype = MOVETYPE_TOSS;
	UTIL_SetOrigin(this->pev, this->pev->origin);
	UTIL_SetSize(this->pev, kMarineItemMinSize, kMarineItemMaxSize);
	
	this->pev->iuser3 = AVH_USER3_MARINEITEM;

	#ifdef AVH_SERVER
	if(!this->GetIsPersistent())
	{
		this->mLifetime = AvHSUGetWeaponStayTime();
	}
	#endif
}
//=========================================================
//=========================================================
void CFlockingFlyerFlock :: SpawnFlock( void )
{
	float R = m_flFlockRadius;
	int iCount;
	Vector vecSpot;
	CFlockingFlyer *pBoid, *pLeader;

	pLeader = pBoid = NULL;

	for ( iCount = 0 ; iCount < m_cFlockSize ; iCount++ )
	{
		pBoid = GetClassPtr( (CFlockingFlyer *)NULL );

		if ( !pLeader ) 
		{
			// make this guy the leader.
			pLeader = pBoid;
			
			pLeader->m_pSquadLeader = pLeader;
			pLeader->m_pSquadNext = NULL;
		}

		vecSpot.x = RANDOM_FLOAT( -R, R );
		vecSpot.y = RANDOM_FLOAT( -R, R );
		vecSpot.z = RANDOM_FLOAT( 0, 16 );
		vecSpot = pev->origin + vecSpot;

		UTIL_SetOrigin(pBoid->pev, vecSpot);
		pBoid->pev->movetype = MOVETYPE_FLY;
		pBoid->SpawnCommonCode();
		pBoid->pev->flags &= ~FL_ONGROUND;
		pBoid->pev->velocity = g_vecZero;
		pBoid->pev->angles	 = pev->angles;
		
		pBoid->pev->frame = 0;
		pBoid->pev->nextthink = gpGlobals->time + 0.2;
		pBoid->SetThink( &CFlockingFlyer :: IdleThink );

		if ( pBoid != pLeader ) 
		{
			pLeader->SquadAdd( pBoid );
		}
	}
}
void COsprey :: Spawn( void )
{
	Precache( );
	// motor
	pev->movetype = MOVETYPE_FLY;
	pev->solid = SOLID_BBOX;

	if (pev->model)
		SET_MODEL(ENT(pev), STRING(pev->model)); //LRC
	else
		SET_MODEL(ENT(pev), "models/osprey.mdl");
	UTIL_SetSize(pev, Vector( -400, -400, -100), Vector(400, 400, 32));
	UTIL_SetOrigin( this, pev->origin );

	//ALERT(at_console, "Osprey origin %f %f %f\n", pev->origin.x, pev->origin.y, pev->origin.z);

	pev->flags |= FL_MONSTER;
	pev->takedamage		= DAMAGE_YES;
	m_flRightHealth		= 200;
	m_flLeftHealth		= 200;
	pev->health			= 400;

	pev->speed = 80; //LRC - default speed, in case path corners don't give a speed.

	m_flFieldOfView = 0; // 180 degrees

	pev->sequence = 0;
	ResetSequenceInfo( );
	pev->frame = RANDOM_LONG(0,0xFF);

	InitBoneControllers();

	SetThink(&COsprey :: FindAllThink );
	SetUse(&COsprey :: CommandUse );

	if (!(pev->spawnflags & SF_WAITFORTRIGGER))
	{
		SetNextThink( 1.0 );
	}

	m_pos2 = pev->origin;
	m_ang2 = pev->angles;
	m_vel2 = pev->velocity;
}
示例#6
0
文件: buttons.cpp 项目: FWGS/XashXT
void CMomentaryRotButton :: Spawn( void )
{
	// g-cont. just to have two seperate entities
	if( FClassnameIs( pev, "momentary_rot_door" ))
		SetBits( pev->spawnflags, SF_MOMENTARY_ROT_DOOR );

	Precache();

	AxisDir( pev );

	m_bUpdateTarget = true;

	if( pev->speed == 0 )
		pev->speed = 100;

	m_startPosition = bound( 0.0f, m_startPosition, 1.0f );

	if( m_flMoveDistance < 0 )
	{
		pev->movedir = pev->movedir * -1;
		m_flMoveDistance = -m_flMoveDistance;
	}

	m_direction = -1;

	m_start = GetLocalAngles() - pev->movedir * m_flMoveDistance * m_startPosition;
	m_end = GetLocalAngles() + pev->movedir * m_flMoveDistance * (1.0f - m_startPosition);

	pev->ideal_yaw = m_startPosition;
	m_iState = STATE_OFF;

	if( FBitSet( pev->spawnflags, SF_MOMENTARY_ROT_DOOR ))
		pev->solid = SOLID_BSP;
	else pev->solid = SOLID_NOT;

	pev->movetype = MOVETYPE_PUSH;

	SET_MODEL( edict(), GetModel() );
	UTIL_SetOrigin( this, GetLocalOrigin( ));
	m_lastUsed = 0;

	m_pUserData = WorldPhysic->CreateKinematicBodyFromEntity( this );
	SetUse( &CMomentaryRotButton::ButtonUse );
}
示例#7
0
//
// Tentacle Spawn
//
void CTentacle :: Spawn( )
{
	Precache( );

	pev->solid			= SOLID_BBOX;
	pev->movetype		= MOVETYPE_FLY;
	pev->effects		= 0;
	pev->health			= 75;
	pev->sequence		= 0;

	SET_MODEL(ENT(pev), "models/tentacle2.mdl");
	UTIL_SetSize( pev, Vector( -32, -32, 0 ), Vector( 32, 32, 64 ) );

	pev->takedamage		= DAMAGE_AIM;
	pev->flags			|= FL_MONSTER;
	
	m_bloodColor		= BLOOD_COLOR_GREEN;

	SetThink( &CTentacle::Start );
	SetTouch( &CTentacle::HitTouch );
	SetUse( &CTentacle::CommandUse );

	pev->nextthink = gpGlobals->time + 0.2;

	ResetSequenceInfo( );
	m_iDir = 1;

	pev->yaw_speed = 18;
	m_flInitialYaw = pev->angles.y;
	pev->ideal_yaw = m_flInitialYaw;

	g_fFlySound = FALSE;
	g_fSquirmSound = FALSE;

	m_iHitDmg = 20;

	if (m_flMaxYaw <= 0)
		m_flMaxYaw = 65;

	m_MonsterState = MONSTERSTATE_IDLE;

	// SetThink( Test );
	UTIL_SetOrigin( pev, pev->origin );
}
示例#8
0
void AvHSpitGun::FireProjectiles(void)
{
#ifdef AVH_SERVER
	
	// Spawn spit
	AvHSpit* theSpit = GetClassPtr((AvHSpit*)NULL );
	theSpit->Spawn();
	
	UTIL_MakeVectors(this->m_pPlayer->pev->v_angle);

	Vector vecAiming = gpGlobals->v_forward;
	Vector vecSrc = this->m_pPlayer->GetGunPosition( ) + vecAiming;
	
	UTIL_SetOrigin(theSpit->pev, vecSrc);

	// This needs to be the same as in EV_SpitGun
	Vector theBaseVelocity;
	VectorScale(this->pev->velocity, kSpitParentVelocityScalar, theBaseVelocity);
	
	Vector theStartVelocity;
	VectorMA(theBaseVelocity, kSpitVelocity, vecAiming, theStartVelocity);

	VectorCopy(theStartVelocity, theSpit->pev->velocity);

	// Set owner
	theSpit->pev->owner = ENT(this->m_pPlayer->pev);

	// Set spit's team :)
	theSpit->pev->team = this->m_pPlayer->pev->team;

	// Set amount of damage it will do
    float theFocusScalar = 1.0f;

    if(AvHSHUGetIsWeaponFocusable(AvHWeaponID(this->m_iId)))
    {
        theFocusScalar = AvHPlayerUpgrade::GetFocusDamageUpgrade(this->m_pPlayer->pev->iuser4);
    }

	float theDamage = this->mDamage*AvHPlayerUpgrade::GetAlienRangedDamageUpgrade(this->m_pPlayer->pev->iuser4)*theFocusScalar;
	theSpit->SetDamage(theDamage);

	#endif	
}
示例#9
0
CMGrenade * CMGrenade:: ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time )
{
	CMGrenade *pGrenade = CreateClassPtr( (CMGrenade *)NULL );

   if (pGrenade == NULL)  // no free monster edicts left?
      return NULL;

	pGrenade->Spawn();
	UTIL_SetOrigin( pGrenade->pev, vecStart );
	pGrenade->pev->velocity = vecVelocity;
	pGrenade->pev->angles = UTIL_VecToAngles(pGrenade->pev->velocity);
	pGrenade->pev->owner = ENT(pevOwner);
	
	pGrenade->SetTouch( BounceTouch );	// Bounce if touched
	
	// Take one second off of the desired detonation time and set the think to PreDetonate. PreDetonate
	// will insert a DANGER sound into the world sound list and delay detonation for one second so that 
	// the grenade explodes after the exact amount of time specified in the call to ShootTimed(). 

	pGrenade->pev->dmgtime = gpGlobals->time + time;
	pGrenade->SetThink( TumbleThink );
	pGrenade->pev->nextthink = gpGlobals->time + 0.1;
	if (time < 0.1)
	{
		pGrenade->pev->nextthink = gpGlobals->time;
		pGrenade->pev->velocity = Vector( 0, 0, 0 );
	}
		
	pGrenade->pev->sequence = RANDOM_LONG( 3, 6 );
	pGrenade->pev->framerate = 1.0;

	// Tumble through the air
	// pGrenade->pev->avelocity.x = -400;

	pGrenade->pev->gravity = 0.5;
	pGrenade->pev->friction = 0.8;

	SET_MODEL(ENT(pGrenade->pev), "models/w_grenade.mdl");
	pGrenade->pev->dmg = 100;

	return pGrenade;
}
示例#10
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CFire::SpawnEffect( fireType_e type, float scale )
{
	CBaseFire *pEffect = NULL;
	switch ( type )
	{
	default:
	case FIRE_NATURAL:
		{
			CFireSmoke	*fireSmoke = (CFireSmoke *) CreateEntityByName( "_firesmoke" );
			fireSmoke->EnableSmoke( ( m_spawnflags & SF_FIRE_SMOKELESS )==false );
			fireSmoke->EnableGlow( ( m_spawnflags & SF_FIRE_NO_GLOW )==false );
			fireSmoke->EnableVisibleFromAbove( ( m_spawnflags & SF_FIRE_VISIBLE_FROM_ABOVE )!=false );
			
			pEffect			= fireSmoke;
			m_nFireType		= FIRE_NATURAL;
			m_takedamage	= DAMAGE_YES;
		}
		break;

	case FIRE_PLASMA:
		{
			CPlasma	*plasma = (CPlasma *) CreateEntityByName( "_plasma" );
			plasma->EnableSmoke( true );
		
			pEffect			= plasma;
			m_nFireType		= FIRE_PLASMA;
			m_takedamage	= DAMAGE_YES;

			// Start burn sound
			EmitSound( "Fire.Plasma" );
		}
		break;
	}

	UTIL_SetOrigin( pEffect, GetAbsOrigin() );
	pEffect->Spawn();
	pEffect->SetParent( this );
	pEffect->Scale( m_flFireSize, m_flFireSize, 0 );
	//Start it going
	pEffect->Enable( ( m_spawnflags & SF_FIRE_START_ON ) );
	m_hEffect = pEffect;
}
示例#11
0
CGrenade *CGrenade::ShootContact(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity)
{
	CGrenade *pGrenade = GetClassPtr((CGrenade *)NULL);
	pGrenade->Spawn();

	pGrenade->pev->gravity = 0.5;
	UTIL_SetOrigin(pGrenade->pev, vecStart);
	pGrenade->pev->velocity = vecVelocity;
	pGrenade->pev->angles = UTIL_VecToAngles(pGrenade->pev->velocity);
	pGrenade->pev->owner = ENT(pevOwner);

	pGrenade->SetThink(&CGrenade::DangerSoundThink);
	pGrenade->pev->nextthink = gpGlobals->time;
	pGrenade->pev->avelocity.x = RANDOM_FLOAT(-100, -500);
	pGrenade->SetTouch(&CGrenade::ExplodeTouch);

	pGrenade->pev->dmg = gSkillData.plrDmgM203Grenade;
	pGrenade->m_bJustBlew = true;
	return pGrenade;
}
示例#12
0
void CAirtank :: Spawn( void )
{
	Precache( );
	// motor
	pev->movetype = MOVETYPE_FLY;
	pev->solid = SOLID_BBOX;

	SET_MODEL(ENT(pev), "models/w_oxygen.mdl");
	UTIL_SetSize(pev, Vector( -16, -16, 0), Vector(16, 16, 36));
	UTIL_SetOrigin( pev, pev->origin );

	SetTouch( TankTouch );
	SetThink( TankThink );

	pev->flags |= FL_MONSTER;
	pev->takedamage		= DAMAGE_YES;
	pev->health			= 20;
	pev->dmg			= 50;
	m_state				= 1;
}
CBaseEntity* MoveToRandomSpot( CBaseEntity *pEnt )
{
	if ( pEnt )
	{
#ifdef HL2SB
		CBasePlayer *pLocalPlayer = UTIL_GetNearestPlayer( pEnt->GetAbsOrigin() );
#else
		CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
#endif
		if ( pLocalPlayer )
		{			
			Vector vForward;
			pLocalPlayer->EyeVectors(&vForward );

			UTIL_SetOrigin( pEnt, GetRandomSpot() );
		}
	}

	return pEnt;
}
示例#14
0
void CCaptureObject::Captured(CBaseEntity *pPlayer)
{
	g_pGameRules->AddScoreToTeam(pev->team, 10);
	UTIL_EmitAmbientSound ( ENT(0), g_vecZero, "game/ctf_captured.wav", VOL_NORM, ATTN_NONE, 0, PITCH_NORM);
	UTIL_ShowMessage("#FLAG_CAPTURED", pPlayer);
	Reset(pPlayer);
	pev->impulse = CO_STAY;
	pev->origin = pev->startpos;
	UTIL_SetOrigin(pev, pev->origin);
	pev->angles = pev->v_angle;

	if (pPlayer == NULL)
		return;

	if (!pPlayer->IsPlayer())
		return;

	CBasePlayer *plr = (CBasePlayer *)pPlayer;
	plr->AddMoney (GIVE_CTF_WIN);
}
//-----------------------------------------------------------------------------
// Purpose: Create a missile
//-----------------------------------------------------------------------------
CGrenadeRocket *CGrenadeRocket::Create( const Vector &vecOrigin, const Vector &vecForward, edict_t *pentOwner = NULL, CBaseEntity *pRealOwner = NULL )
{
	CGrenadeRocket *pRocket = (CGrenadeRocket *)CreateEntityByName("grenade_rocket" );

	UTIL_SetOrigin( pRocket, vecOrigin );
	QAngle angles;
	VectorAngles( vecForward, angles );
	pRocket->SetLocalAngles( angles );
	pRocket->Spawn();
	pRocket->SetOwnerEntity( Instance( pentOwner ) );
	pRocket->m_pRealOwner = pRealOwner;

	if (pentOwner)
	{
		CBaseEntity *pOwnerEnt = GetContainingEntity( pentOwner );
		pRocket->ChangeTeam( pOwnerEnt->GetTeamNumber() );
	}

	return pRocket;
}
CASW_AOEGrenade_Projectile* CASW_HealGrenade_Projectile::Grenade_Projectile_Create( const Vector &position, const QAngle &angles, const Vector &velocity,
																							const AngularImpulse &angVelocity, CBaseEntity *pOwner,
																							float flHealPerSecond, float flInfestationCureAmount, float flRadius, float flDuration, float flTotalHealAmount )
{
	CASW_HealGrenade_Projectile *pGrenade = (CASW_HealGrenade_Projectile *)CreateEntityByName( "asw_healgrenade_projectile" );
	pGrenade->m_flHealPerSecond = flHealPerSecond;
	pGrenade->m_flInfestationCureAmount = flInfestationCureAmount;
	pGrenade->m_flRadius = flRadius;
	pGrenade->m_flDuration = flDuration;
	pGrenade->m_flHealAmountLeft = flTotalHealAmount;
	pGrenade->m_flHealAmountTotal = flTotalHealAmount;
	pGrenade->SetAbsAngles( angles );
	pGrenade->Spawn();
	pGrenade->SetOwnerEntity( pOwner );
	//Msg("making pBuffGrenade with velocity %f,%f,%f\n", velocity.x, velocity.y, velocity.z);
	UTIL_SetOrigin( pGrenade, position );
	pGrenade->SetAbsVelocity( velocity );

	return pGrenade;
}
示例#17
0
//=========================================================
CQuakeRocket *CQuakeRocket::CreateGrenade( Vector vecOrigin, Vector vecVelocity, CBaseEntity *pOwner )
{
	CQuakeRocket *pRocket = GetClassPtr( (CQuakeRocket *)NULL );

	UTIL_SetOrigin( pRocket->pev, vecOrigin );
	SET_MODEL(ENT(pRocket->pev), "models/grenade.mdl");
	pRocket->Spawn();
	pRocket->pev->classname = MAKE_STRING("grenade");
	pRocket->pev->owner = pOwner->edict();

	// Setup
	pRocket->pev->movetype = MOVETYPE_BOUNCE;
	pRocket->pev->solid = SOLID_BBOX;

	pRocket->pev->avelocity = Vector(300,300,300);
	
	// Velocity
	pRocket->pev->velocity = vecVelocity;
	pRocket->pev->angles = UTIL_VecToAngles(vecVelocity);
	pRocket->pev->friction = 0.5;

	// Touch
	pRocket->SetTouch( CQuakeRocket::GrenadeTouch );

	// set newmis duration
	if ( gpGlobals->deathmatch == 4 )
	{
		pRocket->m_flAttackFinished = gpGlobals->time + 1.1;	// What's this used for?
		if (pOwner)
			pOwner->TakeDamage( pOwner->pev, pOwner->pev, 10, DMG_GENERIC );
	}

	pRocket->pev->nextthink = gpGlobals->time + 2.5;
	pRocket->SetThink( CQuakeRocket::GrenadeExplode );

	PLAYBACK_EVENT_FULL (FEV_GLOBAL, pRocket->edict(), g_sTrail, 0.0, 
	(float *)&g_vecZero, (float *)&g_vecZero, 0.7, 0.0, pRocket->entindex(), GRENADE_TRAIL, 0, 0);


	return pRocket;
}
示例#18
0
CGrenade* CGrenade::ShootSmokeGrenade( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time, unsigned short usEvent )
{
    CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL );

    pGrenade->Spawn();
    UTIL_SetOrigin( pGrenade->pev, vecStart );

    pGrenade->pev->velocity	= vecVelocity;
    pGrenade->pev->angles	= pevOwner->angles;
    pGrenade->pev->owner	= ENT( pevOwner );

    pGrenade->m_bSGMulti	 = false;
    pGrenade->m_bSGDetonated = false;
    pGrenade->m_usEvent		 = usEvent;

    pGrenade->SetTouch( &CGrenade::BounceTouch );
    pGrenade->SetThink( &CGrenade::SG_TumbleThink );

    pGrenade->pev->dmgtime	= gpGlobals->time + time;
    pGrenade->pev->nextthink= gpGlobals->time + 0.1;

    if( time < 0.1 )
    {
        pGrenade->pev->nextthink= gpGlobals->time;
        pGrenade->pev->velocity	= g_vecZero;
    }

    pGrenade->pev->sequence	= RANDOM_LONG( 3, 6 );
    pGrenade->pev->framerate= 1.0;

    pGrenade->m_fJustBlew	= TRUE;
    pGrenade->m_SGSmoke		= 1;

    pGrenade->pev->gravity	= 0.5;
    pGrenade->pev->friction = 0.8;
    pGrenade->pev->dmg		= 35;

    SET_MODEL( ENT( pGrenade->pev ), "models/w_smokegrenade.mdl" );

    return pGrenade;
}
void COsprey::Spawn(void)
{
	Precache();
	// motor
	pev->movetype = MOVETYPE_FLY;
	pev->solid = SOLID_BBOX;

	if (pev->model)
		SET_MODEL(ENT(pev), STRING(pev->model)); //SOHL: Refresh 1.0
	else
		SET_MODEL(ENT(pev), "models/osprey.mdl");

	UTIL_SetSize(pev, Vector(-400, -400, -100), Vector(400, 400, 32));
	UTIL_SetOrigin(pev, pev->origin);

	pev->flags |= FL_MONSTER;
	pev->takedamage = DAMAGE_YES;
	m_flRightHealth = 200;
	m_flLeftHealth = 200;
	pev->health = 400;

	m_flFieldOfView = 0; // 180 degrees

	pev->sequence = 0;
	ResetSequenceInfo();
	pev->frame = RANDOM_LONG(0, 0xFF);

	InitBoneControllers();

	SetThink(&COsprey::FindAllThink);
	SetUse(&COsprey::CommandUse);

	if (!(pev->spawnflags & SF_WAITFORTRIGGER))
	{
		pev->nextthink = gpGlobals->time + 1.0;
	}

	m_pos2 = pev->origin;
	m_ang2 = pev->angles;
	m_vel2 = pev->velocity;
}
void CMomentaryDoor::Spawn( void )
{
	SetMovedir (pev);

	pev->solid		= SOLID_BSP;
	pev->movetype	= MOVETYPE_PUSH;

	UTIL_SetOrigin(this, pev->origin);
	SET_MODEL( ENT(pev), STRING(pev->model) );
	
//	if (pev->speed == 0)
//		pev->speed = 100;
	if (pev->dmg == 0)
		pev->dmg = 2;

	m_iState = STATE_OFF;
	
	m_vecPosition1	= pev->origin;
	// Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big
	m_vecPosition2	= m_vecPosition1 + (pev->movedir * (fabs( pev->movedir.x * (pev->size.x-2) ) + fabs( pev->movedir.y * (pev->size.y-2) ) + fabs( pev->movedir.z * (pev->size.z-2) ) - m_flLip));
	ASSERTSZ(m_vecPosition1 != m_vecPosition2, "door start/end positions are equal");

	//LRC: FIXME, move to PostSpawn
	if ( FBitSet (pev->spawnflags, SF_DOOR_START_OPEN) )
	{	// swap pos1 and pos2, put door at pos2
		UTIL_AssignOrigin(this, m_vecPosition2);
		Vector vecTemp = m_vecPosition2;
		m_vecPosition2 = m_vecPosition1;
		m_vecPosition1 = vecTemp;
	}

	if (m_pMoveWith)
	{
		m_vecPosition1 = m_vecPosition1 - m_pMoveWith->pev->origin;
		m_vecPosition2 = m_vecPosition2 - m_pMoveWith->pev->origin;
	}

	Precache();
	SetTouch( NULL );
	
}
示例#21
0
CASW_Boomer_Blob* CASW_Boomer_Blob::Boomer_Blob_Create( float flDamage, float fRadius, int iClusters, const Vector &position, const QAngle &angles, const Vector &velocity, 
														const AngularImpulse &angVelocity, CBaseEntity *pOwner )
{
	CASW_Boomer_Blob *pGrenade = ( CASW_Boomer_Blob * )CreateEntityByName( "asw_boomer_blob" );
	pGrenade->SetAbsAngles( angles );
	pGrenade->Spawn();
	pGrenade->m_flDamage = flDamage;
	pGrenade->m_DmgRadius = fRadius;
	pGrenade->m_hFirer = pOwner;
	pGrenade->SetOwnerEntity( pOwner );
	UTIL_SetOrigin( pGrenade, position );
	pGrenade->SetAbsVelocity( velocity );
	pGrenade->SetClusters( iClusters, true );
	pGrenade->CreateEffects();

	// hack attack!  for some reason, grenades refuse to be affect by damage forces until they're actually dead
	//  so we kill it immediately.
//	pGrenade->TakeDamage(CTakeDamageInfo(pGrenade, pGrenade, Vector(0, 0, 1), position, 10, DMG_SLASH));

	return pGrenade;
}
示例#22
0
void CTankCam :: Spawn( void )
{
	Precache();

	SET_MODEL(ENT(pev), "models/tank_cam.mdl");
	UTIL_SetSize(pev, Vector(0,0,0),Vector(0,0,0) );

	UTIL_SetOrigin( pev, pev->origin );

	pev->movetype = MOVETYPE_NOCLIP;
	pev->solid = SOLID_NOT;

	pev->classname = MAKE_STRING("info_tank_camera");	//necessaire pour le passage a la sauvegarde : getclassptr ne cree pas de pev->classname et donc l entite n est pas prise en compte

	pev->takedamage		= DAMAGE_NO;


	SetThink ( CamThink );
	pev->nextthink = gpGlobals->time + 1.5;

}
示例#23
0
void CRpg::UpdateSpot( void )
{
	if (m_fSpotActive)
	{
		if (!m_pSpot)
		{
			m_pSpot = CLaserSpot::CreateSpotRpg();
			EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/spot_on.wav", 1, ATTN_NORM);
			pev->skin = 0;
		}

		UTIL_MakeVectors( m_pPlayer->pev->v_angle );
		Vector vecSrc = m_pPlayer->GetGunPosition( ) + gpGlobals->v_forward * 24;
		Vector vecAiming = gpGlobals->v_forward;

		TraceResult tr;
		UTIL_TraceLine ( vecSrc, vecSrc + vecAiming * 16384, dont_ignore_monsters, ENT(m_pPlayer->pev), &tr );
		m_pSpot->pev->renderamt = RANDOM_FLOAT (210, 255);	
		UTIL_SetOrigin( m_pSpot->pev, tr.vecEndPos );
	}
}
示例#24
0
/* <fc2a1> ../cstrike/dlls/mpstubb.cpp:62 */
void CBaseMonster::__MAKE_VHOOK(MonsterInitDead)(void)
{
	InitBoneControllers();

	pev->solid = SOLID_BBOX;
	pev->movetype = MOVETYPE_TOSS;

	pev->frame = 0;
	ResetSequenceInfo();
	pev->framerate = 0;

	pev->max_health = pev->health;
	pev->deadflag = DEAD_DEAD;

	UTIL_SetSize(pev, g_vecZero, g_vecZero);
	UTIL_SetOrigin(pev, pev->origin);

	BecomeDead();
	SetThink(&CBaseEntity::SUB_Remove);
	pev->nextthink = gpGlobals->time + 0.5;
}
示例#25
0
/* <1d9c7> ../cstrike/dlls/bmodels.cpp:782 */
void CPendulum::__MAKE_VHOOK(Spawn)(void)
{
	// set the axis of rotation
	CBaseToggle::AxisDir(pev);

	if (pev->spawnflags & SF_DOOR_PASSABLE)
		pev->solid = SOLID_NOT;
	else
		pev->solid = SOLID_BSP;

	pev->movetype = MOVETYPE_PUSH;
	UTIL_SetOrigin(pev, pev->origin);
	SET_MODEL(ENT(pev), STRING(pev->model));

	if (m_distance == 0)
		return;

	if (pev->speed == 0)
		pev->speed = 100;

	// Calculate constant acceleration from speed and distance
	m_accel = (pev->speed * pev->speed) / (2 * fabs((float_precision)m_distance));
	m_maxSpeed = pev->speed;
	m_start = pev->angles;
	m_center = pev->angles + (m_distance * 0.5) * pev->movedir;

	if (pev->spawnflags & SF_BRUSH_ROTATE_INSTANT)
	{
		SetThink(&CPendulum::SUB_CallUseToggle);
		pev->nextthink = gpGlobals->time + 0.1f;
	}

	pev->speed = 0;
	SetUse(&CPendulum::PendulumUse);

	if (pev->spawnflags & SF_PENDULUM_SWING)
	{
		SetTouch (&CPendulum::RopeTouch);
	}
}
void CApache :: Spawn( void )
{
	Precache( );
	// motor
	pev->movetype = MOVETYPE_FLY;
	pev->solid = SOLID_BBOX;

	if (pev->model)
		SET_MODEL(ENT(pev), STRING(pev->model)); //LRC
	else
		SET_MODEL(ENT(pev), "models/apache.mdl");
	UTIL_SetSize( pev, Vector( -32, -32, -64 ), Vector( 32, 32, 0 ) );
	UTIL_SetOrigin( this, pev->origin );

	pev->flags |= FL_MONSTER;
	pev->takedamage		= DAMAGE_AIM;
	if (pev->health == 0)
		pev->health			= gSkillData.apacheHealth;

	m_flFieldOfView = -0.707; // 270 degrees

	pev->sequence = 0;
	ResetSequenceInfo( );
	pev->frame = RANDOM_LONG(0, 0xFF);

	InitBoneControllers();

	if (pev->spawnflags & SF_WAITFORTRIGGER)
	{
		SetUse(&CApache :: StartupUse );
	}
	else
	{
		SetThink(&CApache :: HuntThink );
		SetTouch(&CApache :: FlyTouch );
		SetNextThink( 1.0 );
	}

	m_iRockets = 10;
}
void CSatchelCharge::Spawn(void)
{
	Precache();
	// motor
	pev->movetype = MOVETYPE_BOUNCE;
	pev->solid = SOLID_BBOX;

	SET_MODEL(ENT(pev), "models/w_satchel.mdl");
	UTIL_SetSize(pev, Vector(-4, -4, -4), Vector(4, 4, 4));	// Uses point-sized, and can be stepped over
	UTIL_SetOrigin(this, pev->origin);

	SetTouch(&CSatchelCharge::SatchelSlide);
	SetUse(&CSatchelCharge::DetonateUse);
	SetThink(&CSatchelCharge::SatchelThink);
	SetNextThink(0.1);

	pev->gravity = 0.5;
	pev->friction = 0.8;

	pev->dmg = gSkillData.plrDmgSatchel;
	pev->sequence = 1;
}
示例#28
0
//-----------------------------------------------------------------------------
// Purpose: This think function should be called at the time when the HeadcrabCanister 
//          will be leaving the skybox and entering the world.
//-----------------------------------------------------------------------------
void CEnvHeadcrabCanister::HeadcrabCanisterSkyboxThink( void )
{
	// Use different position computation
	m_Shared.ConvertFromSkyboxToWorld();

	Vector vecEndPosition;
	QAngle vecEndAngles;
	m_Shared.GetPositionAtTime( gpGlobals->curtime, vecEndPosition, vecEndAngles );
	UTIL_SetOrigin( this, vecEndPosition );
	SetAbsAngles( vecEndAngles );
	RemoveEFlags( EFL_IN_SKYBOX );

	// Switch to the actual-scale model
	SetupWorldModel();

	// Futz with the smoke trail to get it working across the boundary
	m_hTrail->SetSkybox( vec3_origin, 1.0f );

	// Now we start looking for collisions
	SetThink( &CEnvHeadcrabCanister::HeadcrabCanisterWorldThink );
	SetNextThink( gpGlobals->curtime + 0.01f );
}
示例#29
0
void CMomentaryRotButton::__MAKE_VHOOK(Spawn)()
{
	CBaseToggle::AxisDir(pev);

	if (pev->speed == 0)
		pev->speed = 100;

	if (m_flMoveDistance < 0)
	{
		m_start = pev->angles + pev->movedir * m_flMoveDistance;
		m_end = pev->angles;

		// This will toggle to -1 on the first use()
		m_direction = 1;
		m_flMoveDistance = -m_flMoveDistance;
	}
	else
	{
		m_start = pev->angles;
		m_end = pev->angles + pev->movedir * m_flMoveDistance;

		// This will toggle to +1 on the first use()
		m_direction = -1;
	}

	if (pev->spawnflags & SF_MOMENTARY_DOOR)
		pev->solid = SOLID_BSP;
	else
		pev->solid = SOLID_NOT;

	pev->movetype = MOVETYPE_PUSH;
	UTIL_SetOrigin(pev, pev->origin);
	SET_MODEL(ENT(pev), STRING(pev->model));

	char *pszSound = ButtonSound(m_sounds);
	PRECACHE_SOUND(pszSound);
	pev->noise = ALLOC_STRING(pszSound);
	m_lastUsed = 0;
}
示例#30
0
void CASW_Parasite::Leap( const Vector &vecVel )
{
	SetTouch( &CASW_Parasite::LeapTouch );

	SetCondition( COND_FLOATING_OFF_GROUND );
	SetGroundEntity( NULL );

	m_flIgnoreWorldCollisionTime = gpGlobals->curtime + PARASITE_IGNORE_WORLD_COLLISION_TIME;

	if( HasHeadroom() )
	{
		// Take him off ground so engine doesn't instantly reset FL_ONGROUND.
		UTIL_SetOrigin( this, GetLocalOrigin() + Vector( 0, 0, 1 ) );
	}

	SetAbsVelocity( vecVel );

	// Think every frame so the player sees the headcrab where he actually is...
	m_bMidJump = true;
	SetThink( &CASW_Parasite::LeapThink );
	SetNextThink( gpGlobals->curtime );
}