int GroundClass::Sleep (void)
{
	int retval = 0;
	if (!IsAwake()){
		return retval;
	}

	// NULL any targets our ai might have
	if ( gai ){
		gai->SetGroundTarget( NULL );
		gai->SetAirTarget( NULL );
	}

	if ( battalionFireControl ){
		VuDeReferenceEntity( battalionFireControl );
		battalionFireControl = NULL;
	}

	// Put away any weapon graphics
	if (Sms){
		Sms->FreeWeaponGraphics();
	}

	SimVehicleClass::Sleep();

	// Dispose of our truck, if we have one.
	if (truckDrawable){
		OTWDriver.RemoveObject(truckDrawable, TRUE);
		truckDrawable = NULL;
	}
	return retval;
}
int EjectedPilotClass::Sleep (void)
{
int retval = 0;

	if (!IsAwake())
		return retval;

	return SimMoverClass::Sleep();
}
Exemple #3
0
//--------------------------------------------------------------------------------------------------
void q3Body::Render( q3Render* render ) const
{
	bool awake = IsAwake( );
	q3Box* box = m_boxes;

	while ( box )
	{
		box->Render( m_tx, awake, render );
		box = box->next;
	}
}
int DebrisClass::Wake(){
	int retval = 0;
	if (IsAwake())
		return retval;

	BombClass::Wake();
	if ( parent )
	{
         x = parent->XPos();
         y = parent->YPos();
         z = parent->ZPos();

		ShiAssert( parent->IsSim() );
	}

	return retval;
}
int FlareClass::Wake (void)
{
	int retval = 0;

	if (IsAwake()){ return retval; }

	BombClass::Wake();

   //OTWDriver.InsertObject(trail);

	if ( parent ){
         x = parent->XPos();
         y = parent->YPos();
         z = parent->ZPos();
	}

	return retval;
}
SquadronClass::~SquadronClass (void)
	{
	if (IsAwake())
		Sleep();
	}
//---------------------------------------------------------
//---------------------------------------------------------
void CBounceBomb::SearchThink()
{
	if( !UTIL_FindClientInPVS(edict()) )
	{
		// Sleep!
		SetNextThink( gpGlobals->curtime + 0.5 );
		return;
	}

	if(	(CAI_BaseNPC::m_nDebugBits & bits_debugDisableAI) )
	{
		if( IsAwake() )
		{
			Wake(false);
		}

		SetNextThink( gpGlobals->curtime + 0.5 );
		return;
	}

	SetNextThink( gpGlobals->curtime + 0.1 );
	StudioFrameAdvance();

	if( m_pConstraint && gpGlobals->curtime - m_flTimeGrabbed >= 1.0f )
	{
		m_OnPulledUp.FireOutput( this, this );
		SetMineState( MINE_STATE_CAPTIVE );
		return;
	}

	float flNearestNPCDist = FindNearestNPC();

	if( flNearestNPCDist <= BOUNCEBOMB_WARN_RADIUS )
	{
		if( !IsAwake() )
		{
			Wake( true );
		}
	}
	else
	{
 		if( IsAwake() )
		{
			Wake( false );
		}

		return;
	}

	if( flNearestNPCDist <= BOUNCEBOMB_DETONATE_RADIUS && !IsFriend( m_hNearestNPC ) )
	{
		if( m_bBounce )
		{
			SetMineState( MINE_STATE_TRIGGERED );
		}
		else
		{
			// Don't pop up in the air, just explode if the NPC gets closer than explode radius.
			SetThink( &CBounceBomb::ExplodeThink );
			SetNextThink( gpGlobals->curtime + m_flExplosionDelay );
		}
	}
}
int GroundClass::Wake(void)
{
	if (IsAwake()){ return 0; }
	SimVehicleClass::Wake();

	Tpoint pos;
	int retval = 0;

	if (Sms) {
		Sms->AddWeaponGraphics();
	}

	// Pick a groupId. KCK: Is this even being used?
	groupId = GetCampaignObject()->Id().num_;

	if ( !gai->rank ){
		drawPointer->SetLabel ("", 0xff00ff00);
	}

	// edg: I'm not sure if drawpointer has valid position yet?
	drawPointer->GetPosition( &pos );
    SetPosition (XPos(), YPos(), pos.z - 0.7f );
	ShiAssert(XPos() > 0.0F && YPos() > 0.0F )

	// determine if its a foot squad or not -- Real thinking done in addobj.cpp
	isFootSquad = (drawPointer->GetClass() == DrawableObject::Guys);

	// Determine if this vehicle has a truck and create it, if needed
	if (drawPointer && isTowed){
		// Place truck 20 feet behind us
		Tpoint		simView;
		int			vistype;
		mlTrig		trig;
		int tracktorType;

		// RV - Biker - Make the tracktor random
		tracktorType = (rand() % 3);
		bool teamUs = (
			TeamInfo[GetCountry()] && (
				TeamInfo[GetCountry()]->equipment == toe_us || TeamInfo[GetCountry()]->equipment == toe_rok
			)
		);
		int vtIdx;
		switch (tracktorType){
			case 0: 
				vtIdx =  teamUs ? F4_GENERIC_US_TRUCK_TYPE_SMALL   : F4_GENERIC_OPFOR_TRUCK_TYPE_SMALL;   
			break;
			case 1: 
				vtIdx =  teamUs ? F4_GENERIC_US_TRUCK_TYPE_LARGE   : F4_GENERIC_OPFOR_TRUCK_TYPE_LARGE;   
			break;
			default: 
				vtIdx = teamUs ? F4_GENERIC_US_TRUCK_TYPE_TRAILER : F4_GENERIC_OPFOR_TRUCK_TYPE_TRAILER; 
			break;
		}
		vistype = Falcon4ClassTable[vtIdx].visType[Status() & VIS_TYPE_MASK];

		mlSinCos (&trig, Yaw());
		simView.x = XPos()-20.0F*trig.cos;
		simView.y = YPos()-20.0F*trig.sin;
		simView.z = ZPos();
		if (vistype > 0){
			truckDrawable = new DrawableGroundVehicle(vistype, &simView, Yaw()+PI, drawPointer->GetScale());
		}
	}

	// when we wake the object, default it to not labeled unless
	// it's the main guy
	if (drawPointer && gai->rank != GNDAI_BATTALION_COMMANDER){
		drawPointer->SetLabel ("", 0xff00ff00);		// Don't label
		SetLocalFlag(NOT_LABELED);
	}

	return retval;
}
BrigadeClass::~BrigadeClass (void)
	{
	if (IsAwake())
		Sleep();
	}
TaskForceClass::~TaskForceClass (void)
{
    if (IsAwake())
        Sleep();
}