コード例 #1
1
ファイル: AIController.cpp プロジェクト: Foreven/Unreal4-1
void AAIController::GrabDebugSnapshot(FVisualLogEntry* Snapshot) const
{
	FVisualLogStatusCategory MyCategory;
	MyCategory.Category = TEXT("AI Controller");
	MyCategory.Add(TEXT("Pawn"), GetNameSafe(GetPawn()));
	AActor* FocusActor = GetFocusActor();
	MyCategory.Add(TEXT("Focus"), GetDebugName(FocusActor));

	if (FocusActor == nullptr)
	{
		MyCategory.Add(TEXT("Focus Location"), TEXT_AI_LOCATION(GetFocalPoint()));
	}
	Snapshot->Status.Add(MyCategory);

	if (GetPawn())
	{
		Snapshot->Location = GetPawn()->GetActorLocation();
	}

	if (PathFollowingComponent)
	{
		PathFollowingComponent->DescribeSelfToVisLog(Snapshot);
	}

	if (BrainComponent != NULL)
	{
		BrainComponent->DescribeSelfToVisLog(Snapshot);
	}

	if (PerceptionComponent != NULL)
	{
		PerceptionComponent->DescribeSelfToVisLog(Snapshot);
	}
}
コード例 #2
0
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CPointTeleport::Activate( void )
{
	CBaseEntity *pTarget = GetNextTarget();
	if (pTarget)
	{
		if ( pTarget->GetMoveParent() != NULL )
		{
			Warning("ERROR: (%s) can't teleport object (%s) as it has a parent!\n",GetDebugName(),pTarget->GetDebugName());

			return;
		}
		if (m_spawnflags & SF_TELEPORT_TO_SPAWN_POS)
		{
			m_vSaveOrigin = pTarget->GetAbsOrigin();
			m_vSaveAngles = pTarget->GetAbsAngles();
		}
		else
		{
			m_vSaveOrigin = GetAbsOrigin();
			m_vSaveAngles = GetAbsAngles();
		}
	}
	else
	{
		Warning("ERROR: (%s) given no target.  Deleting.\n",GetDebugName());
		UTIL_Remove(this);
		return;
	}
	BaseClass::Activate();
}
コード例 #3
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CAI_Relationship::Spawn()
{
	m_bIsActive = false;

	if (m_iszSubject == NULL_STRING)
	{
		DevWarning("ai_relationship '%s' with no subject specified, removing.\n", GetDebugName());
		UTIL_Remove(this);
	}
	else if (m_target == NULL_STRING)
	{
		DevWarning("ai_relationship '%s' with no target specified, removing.\n", GetDebugName());
		UTIL_Remove(this);
	}
}
コード例 #4
0
ファイル: ai_dynamiclink.cpp プロジェクト: BenLubar/riflemod
//---------------------------------------------------------
//---------------------------------------------------------
void CAI_RadialLinkController::Activate()
{
	BaseClass::Activate();

	m_bAtRest = false;
	m_vecAtRestOrigin = vec3_invalid;

	// Force re-evaluation
	SetThink( &CAI_RadialLinkController::PollMotionThink );

	// Spread think times out.
	SetNextThink( gpGlobals->curtime + random->RandomFloat( 0.0f, 1.0f) );

	if( GetParent() != NULL )
	{
		float flDist = GetAbsOrigin().DistTo( GetParent()->GetAbsOrigin() );

		if( flDist > 200.0f )
		{
			// Warn at the console if a link controller is far away from its parent. This
			// most likely means that a level designer has copied an entity without researching its hierarchy.
			DevMsg("RadialLinkController (%s) is far from its parent!\n", GetDebugName() );
		}
	}
}
コード例 #5
0
ファイル: wizpage.cpp プロジェクト: stahta01/codeblocks_r7456
//------------------------------------------------------------------------------
void WizCompilerPanel::OnPageChanging(wxWizardEvent& event)
{
    if (event.GetDirection() != 0) // !=0 forward, ==0 backward
    {
        if (GetCompilerID().IsEmpty())
        {
            cbMessageBox(_("You must select a compiler for your project..."), _("Error"), wxICON_ERROR, GetParent());
            event.Veto();
            return;
        }
        if (m_AllowConfigChange && !GetWantDebug() && !GetWantRelease())
        {
            cbMessageBox(_("You must select at least one configuration..."), _("Error"), wxICON_ERROR, GetParent());
            event.Veto();
            return;
        }

        if (m_AllowConfigChange)
        {
            ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("scripts"));

            cfg->Write(_T("/generic_wizard/want_debug"), (bool)GetWantDebug());
            cfg->Write(_T("/generic_wizard/debug_name"), GetDebugName());
            cfg->Write(_T("/generic_wizard/debug_output"), GetDebugOutputDir());
            cfg->Write(_T("/generic_wizard/debug_objects_output"), GetDebugObjectOutputDir());

            cfg->Write(_T("/generic_wizard/want_release"), (bool)GetWantRelease());
            cfg->Write(_T("/generic_wizard/release_name"), GetReleaseName());
            cfg->Write(_T("/generic_wizard/release_output"), GetReleaseOutputDir());
            cfg->Write(_T("/generic_wizard/release_objects_output"), GetReleaseObjectOutputDir());
        }
    }
    WizPageBase::OnPageChanging(event); // let the base class handle it too
}
コード例 #6
0
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
                 void CAI_OperatorGoal::EnableGoal( CAI_BaseNPC *pAI )
{
    CAI_OperatorBehavior *pBehavior;

    if ( !pAI->GetBehavior( &pBehavior ) )
    {
        return;
    }

    CBaseEntity *pPosition = gEntList.FindEntityByName(NULL, m_target);

    if( !pPosition )
    {
        DevMsg("ai_goal_operator called %s with invalid position ent!\n", GetDebugName() );
        return;
    }


    CBaseEntity *pContextTarget = NULL;

    if( m_iszContextTarget != NULL_STRING )
    {
        pContextTarget = gEntList.FindEntityByName( NULL, m_iszContextTarget );
    }

    pBehavior->SetParameters(this, pPosition, pContextTarget);
}
コード例 #7
0
//-----------------------------------------------------------------------------
// Purpose: Called after all entities have spawned on new map or savegame load.
//-----------------------------------------------------------------------------
void CPointAngleSensor::Activate(void)
{
	BaseClass::Activate();

	if (!m_hTargetEntity)
	{
		m_hTargetEntity = gEntList.FindEntityByName( NULL, m_target );
	}

	if (!m_hLookAtEntity && (m_nLookAtName != NULL_STRING))
	{
		m_hLookAtEntity = gEntList.FindEntityByName( NULL, m_nLookAtName );
		if (!m_hLookAtEntity)
		{
			DevMsg(1, "Angle sensor '%s' could not find look at entity '%s'.\n", GetDebugName(), STRING(m_nLookAtName));
		}
	}

	// It's okay to not have a look at entity, it just means we measure and output the angles
	// of the target entity without testing them against the look at entity.
	if (!m_bDisabled && m_hTargetEntity)
	{
		SetNextThink( gpGlobals->curtime );
	}
}
コード例 #8
0
ファイル: ai_dynamiclink.cpp プロジェクト: BenLubar/riflemod
//------------------------------------------------------------------------------
// Purpose : Updates network link state if dynamic link state has changed
// Input   :
// Output  :
//------------------------------------------------------------------------------
void CAI_DynamicLink::SetLinkState(void)
{
	if ( !gm_bInitialized )
	{
		// Safe to quietly return. Consistency will be enforced when InitDynamicLinks() is called
		return;
	}

	if (m_nSrcID == NO_NODE || m_nDestID == NO_NODE)
	{
		Vector pos = GetAbsOrigin();
		DevWarning("ERROR: Dynamic link at %f %f %f pointing to invalid node ID!!\n", pos.x, pos.y, pos.z);
		return;
	}

	// ------------------------------------------------------------------
	// Now update the node links...
	//  Nodes share links so we only have to find the node from the src 
	//  For now just using one big AINetwork so find src node on that network
	// ------------------------------------------------------------------
	CAI_Node *pSrcNode = g_pBigAINet->GetNode( m_nSrcID, false );
	if ( !pSrcNode )							 
		return;

	CAI_Link* pLink = FindLink();
	if ( !pLink )
	{
		DevMsg("Dynamic Link Error: (%s) unable to form between nodes %d and %d\n", GetDebugName(), m_nSrcID, m_nDestID );
		return;
	}

	pLink->m_pDynamicLink = this;
	if (m_nLinkState == LINK_OFF)
	{
		pLink->m_LinkInfo |=  bits_LINK_OFF;
	}
	else
	{
		pLink->m_LinkInfo &= ~bits_LINK_OFF;
	}

	if ( m_bPreciseMovement )
	{
		pLink->m_LinkInfo |= bits_LINK_PRECISE_MOVEMENT;
	}
	else
	{
		pLink->m_LinkInfo &= ~bits_LINK_PRECISE_MOVEMENT;
	}

	if ( m_nPriority == 0 )
	{
		pLink->m_LinkInfo &= ~bits_PREFER_AVOID;
	}
	else
	{
		pLink->m_LinkInfo |= bits_PREFER_AVOID;
	}
}
コード例 #9
0
ファイル: bitbuf.cpp プロジェクト: paralin/hl2sdk
bool bf_write::WriteBits(const void *pInData, int nBits)
{
#if defined( BB_PROFILING )
	VPROF( "bf_write::WriteBits" );
#endif

	unsigned char *pOut = (unsigned char*)pInData;
	int nBitsLeft = nBits;

	if((m_iCurBit+nBits) > m_nDataBits)
	{
		SetOverflowFlag();
		CallErrorHandler( BITBUFERROR_BUFFER_OVERRUN, GetDebugName() );
		return false;
	}

	// Get output dword-aligned.
	while(((unsigned long)pOut & 3) != 0 && nBitsLeft >= 8)
	{

		WriteUBitLong( *pOut, 8, false );
		++pOut;
		nBitsLeft -= 8;
	}
	
	// check if we can use fast memcpy if m_iCurBit is byte aligned
	if ( (nBitsLeft >= 32) && (m_iCurBit & 7) == 0 )
	{
		int numbytes = (nBitsLeft >> 3); 
		int numbits = numbytes << 3;
		
		// Bounds checking..
		// TODO: May not need this check anymore
		if((m_iCurBit+numbits) > m_nDataBits)
		{
			m_iCurBit = m_nDataBits;
			SetOverflowFlag();
			CallErrorHandler( BITBUFERROR_BUFFER_OVERRUN, GetDebugName() );
			return false;
		}
		
		Q_memcpy( m_pData+(m_iCurBit>>3), pOut, numbytes );
		pOut += numbytes;
		nBitsLeft -= numbits;
		m_iCurBit += numbits;
	}
コード例 #10
0
ファイル: DialogSession.cpp プロジェクト: aronarts/FireNET
int CDialogSession::ScheduleNextLine(float dt)
{
	m_bHaveSchedule = true;
	m_nextTimeDelay = dt;
	++m_nextScriptLine;

	if (m_nextScriptLine < m_pScript->GetNumLines())
	{
		DiaLOG::Log(DiaLOG::eAlways, "[DIALOG] CDialogSession: %s Scheduling next line %d/%d [cur=%d] at %f", 
			GetDebugName(), m_nextScriptLine, m_pScript->GetNumLines()-1, m_curScriptLine, m_curTime+m_nextTimeDelay);
	}
	else
	{
		DiaLOG::Log(DiaLOG::eAlways, "[DIALOG] CDialogSession: %s Scheduling END [cur=%d] at %f", 
			GetDebugName(), m_curScriptLine, m_curTime+m_nextTimeDelay);
	}
	return m_nextScriptLine;
}
コード例 #11
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *pOther - 
//-----------------------------------------------------------------------------
void CTriggerPortalCleanser::EndTouch(CBaseEntity *pOther)
{
	BaseClass::EndTouch(pOther);

	if ( portal_cleanser_debug.GetBool() )
	{
		Msg("%s END-TOUCH: for %s\n", GetDebugName(), pOther->GetDebugName() );
	}
}
コード例 #12
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTeamControlPoint::Spawn( void )
{
	// Validate our default team
	if ( m_iDefaultOwner < 0 || m_iDefaultOwner >= GetNumberOfTeams() )
	{
		Warning( "team_control_point '%s' has bad point_default_owner.\n", GetDebugName() );
		m_iDefaultOwner = TEAM_UNASSIGNED;
	}

#ifdef TF_DLL
	if ( m_iszCaptureStartSound == NULL_STRING )
	{
		m_iszCaptureStartSound = AllocPooledString( "Hologram.Start" );
	}
	if ( m_iszCaptureEndSound == NULL_STRING )
	{
		m_iszCaptureEndSound = AllocPooledString( "Hologram.Stop" );
	}
	if ( m_iszCaptureInProgress == NULL_STRING )
	{
		m_iszCaptureInProgress = AllocPooledString( "Hologram.Move" );
	}
	if ( m_iszCaptureInterrupted == NULL_STRING )
	{
		m_iszCaptureInterrupted = AllocPooledString( "Hologram.Interrupted" );
	}
#endif

	Precache();

	InternalSetOwner( m_iDefaultOwner, false );	//init the owner of this point

	SetActive( !m_bStartDisabled );

	BaseClass::Spawn();

	SetPlaybackRate( 1.0 );
	SetThink( &CTeamControlPoint::AnimThink );
	SetNextThink( gpGlobals->curtime + 0.1f );

	if ( FBitSet( m_spawnflags, SF_CAP_POINT_HIDE_MODEL ) )
	{
		AddEffects( EF_NODRAW );
	}

	if ( FBitSet( m_spawnflags, SF_CAP_POINT_HIDE_SHADOW ) )
	{
		AddEffects( EF_NOSHADOW );
	}

	m_flLastContestedAt = -1;

	m_pCaptureInProgressSound = NULL;


}
コード例 #13
0
ファイル: flex_expresser.cpp プロジェクト: Au-heppa/swarm-sdk
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
CAI_Expresser *CFlexExpresser::CreateExpresser( void )
{
	AssertMsg1( !m_pExpresser, "LEAK: Double-created expresser for FlexExpresser %s", GetDebugName() );

	m_pExpresser = new CAI_ExpresserWithFollowup(this);
	if ( !m_pExpresser )
		return NULL;
	
	m_pExpresser->Connect(this);
	return m_pExpresser;
}
コード例 #14
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *pOther - 
//-----------------------------------------------------------------------------
void CTriggerPortal::EndTouch(CBaseEntity *pOther)
{
	BaseClass::EndTouch(pOther);

	if ( portal_debug.GetBool() )
	{
		Msg("%s ENDTOUCH: for %s\n", GetDebugName(), pOther->GetDebugName() );
	}

	EHANDLE hHandle;
	hHandle = pOther;
	m_hDisabledForEntities.FindAndRemove( hHandle );
}
コード例 #15
0
//-----------------------------------------------------------------------------
// Purpose: Changes the team controlling this zone
// Input  : newTeam - the new team to change to
//-----------------------------------------------------------------------------
void CControlZone::SetControllingTeam( CBaseEntity *pActivator, int newTeam )
{
	DevMsg( 1, "trigger_controlzone: (%s) changing team to: %d\n", GetDebugName(), newTeam );

	// remember this team as the defenders of the zone
	m_iDefendingTeam = GetTeamNumber();

	// reset state, firing the output
	ChangeTeam(newTeam);
	m_ControllingTeam.Set( GetTeamNumber(), pActivator, this );
	m_iLocked = FALSE;
	m_iTryingToChangeToTeam = 0;
	SetNextThink( TICK_NEVER_THINK );
}
コード例 #16
0
//------------------------------------------------------------------------------
// Purpose :
// Input   :
// Output  :
//------------------------------------------------------------------------------
void CGrenadePathfollower::Launch( float flLaunchSpeed, string_t sPathCornerName)
{
	m_pPathTarget = gEntList.FindEntityByName( NULL, sPathCornerName );
	if (m_pPathTarget)
	{
		m_flFlySpeed = flLaunchSpeed;
		Vector vTargetDir = (m_pPathTarget->GetAbsOrigin() - GetAbsOrigin());
		VectorNormalize(vTargetDir);
		SetAbsVelocity( m_flFlySpeed * vTargetDir );
		QAngle angles;
		VectorAngles( GetAbsVelocity(), angles );
		SetLocalAngles( angles );
	}
	else
	{
		Warning( "ERROR: Grenade_Pathfollower (%s) with no pathcorner!\n",GetDebugName());
		return;
	}

	// Make this thing come to life
	RemoveSolidFlags( FSOLID_NOT_SOLID );
	SetMoveType( MOVETYPE_FLYGRAVITY );
	RemoveEffects( EF_NODRAW );

	SetUse( &CGrenadePathfollower::DetonateUse );
	SetTouch( &CGrenadePathfollower::GrenadeTouch );
	SetThink( &CGrenadePathfollower::AimThink );

	SetNextThink( gpGlobals->curtime + 0.1f );

	// Make the trail
	m_hRocketTrail = RocketTrail::CreateRocketTrail();

	if ( m_hRocketTrail )
	{
		m_hRocketTrail->m_Opacity = 0.2f;
		m_hRocketTrail->m_SpawnRate = 100;
		m_hRocketTrail->m_ParticleLifetime = 0.5f;
		m_hRocketTrail->m_StartColor.Init( 0.65f, 0.65f , 0.65f );
		m_hRocketTrail->m_EndColor.Init( 0.0, 0.0, 0.0 );
		m_hRocketTrail->m_StartSize = 8;
		m_hRocketTrail->m_EndSize = 16;
		m_hRocketTrail->m_SpawnRadius = 4;
		m_hRocketTrail->m_MinSpeed = 2;
		m_hRocketTrail->m_MaxSpeed = 16;
		
		m_hRocketTrail->SetLifetime( 999 );
		m_hRocketTrail->FollowEntity( this, "0" );
	}
}
コード例 #17
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPointCommentaryNode::Activate( void )
{
	m_iNodeNumberMax = g_CommentarySystem.GetCommentaryNodeCount();

	if ( m_iszViewTarget != NULL_STRING )
	{
		m_hViewTarget = gEntList.FindEntityByName( NULL, m_iszViewTarget );
		if ( !m_hViewTarget )
		{
			Warning("%s: %s could not find viewtarget %s.\n", GetClassName(), GetDebugName(), STRING(m_iszViewTarget) );
		}
	}

	if ( m_iszViewPosition != NULL_STRING )
	{
		m_hViewPosition = gEntList.FindEntityByName( NULL, m_iszViewPosition );
		if ( !m_hViewPosition.Get() )
		{
			Warning("%s: %s could not find viewposition %s.\n", GetClassName(), GetDebugName(), STRING(m_iszViewPosition) );
		}
	}

	BaseClass::Activate();
}
コード例 #18
0
ファイル: pointteleport.cpp プロジェクト: EspyEspurr/game
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CPointTeleport::InputTeleport( inputdata_t &inputdata )
{
	// Attempt to find the entity in question
	CBaseEntity *pTarget = gEntList.FindEntityByName( NULL, m_target, this, inputdata.pActivator, inputdata.pCaller );
	if ( pTarget == NULL )
		return;

	// If teleport object is in a movement hierarchy, remove it first
	if ( EntityMayTeleport( pTarget ) == false )
	{
		Warning("ERROR: (%s) can't teleport object (%s) as it has a parent (%s)!\n",GetDebugName(),pTarget->GetDebugName(),pTarget->GetMoveParent()->GetDebugName());
		return;
	}
	pTarget->Teleport( &m_vSaveOrigin, &m_vSaveAngles, NULL );
}
コード例 #19
0
ファイル: pointteleport.cpp プロジェクト: Au-heppa/swarm-sdk
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void CPointTeleport::Activate( void )
{
	// Start with our origin point
	m_vSaveOrigin = GetAbsOrigin();
	m_vSaveAngles = GetAbsAngles();

	// Save off the spawn position of the target if instructed to do so
	if ( m_spawnflags & SF_TELEPORT_TO_SPAWN_POS )
	{
		CBaseEntity *pTarget = gEntList.FindEntityByName( NULL, m_target );
		if ( pTarget )
		{
			// If teleport object is in a movement hierarchy, remove it first
			if ( EntityMayTeleport( pTarget ) )
			{
				// Save the points
				m_vSaveOrigin = pTarget->GetAbsOrigin();
				m_vSaveAngles = pTarget->GetAbsAngles();
			}
			else
			{
				Warning("ERROR: (%s) can't teleport object (%s) as it has a parent (%s)!\n",GetDebugName(),pTarget->GetDebugName(),pTarget->GetMoveParent()->GetDebugName());
				BaseClass::Activate();
				return;
			}
		}
		else
		{
			Warning("ERROR: (%s) target '%s' not found. Deleting.\n", GetDebugName(), STRING(m_target));
			UTIL_Remove( this );
			return;
		}
	}

	BaseClass::Activate();
}
コード例 #20
0
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CPointTeleport::InputTeleport( inputdata_t &inputdata )
{
	CBaseEntity *pTarget = GetNextTarget();
	if (pTarget)
	{
		// If teleport object is in a movement hierarchy, remove it first
		if ( pTarget->GetMoveParent() != NULL )
		{
			Warning("ERROR: (%s) can't teleport object (%s) as it has a parent (%s)!\n",GetDebugName(),pTarget->GetDebugName(),pTarget->GetMoveParent()->GetDebugName());
			return;
		}

		pTarget->Teleport( &m_vSaveOrigin, &m_vSaveAngles, NULL );
	}
}
コード例 #21
0
ファイル: gameweaponmanager.cpp プロジェクト: NEITMod/HL2BM2
//---------------------------------------------------------
//---------------------------------------------------------
void CGameWeaponManager::Spawn()
{
	SetThink( &CGameWeaponManager::Think );
	SetNextThink( gpGlobals->curtime );
	CBaseEntity *pEntity = CreateEntityByName( STRING(m_iszWeaponName) );
	if ( !pEntity )
	{
		DevMsg("%s removed itself!\n", GetDebugName() );
		UTIL_Remove(this);
	}
	else
	{
		m_bExpectingWeapon = ( dynamic_cast<CBaseCombatWeapon *>(pEntity) != NULL );
		UTIL_Remove(pEntity);
	}
}
コード例 #22
0
ファイル: flex_expresser.cpp プロジェクト: Au-heppa/swarm-sdk
// does not call to base class spawn.
void CFlexExpresser::Spawn( void )
{
	const char *szModel = (char *)STRING( GetModelName() );
	if (!szModel || !*szModel)
	{
		Warning( "WARNING: %s at %.0f %.0f %0.f missing modelname\n", GetDebugName(), GetAbsOrigin().x, GetAbsOrigin().y, GetAbsOrigin().z );
	}
	else
	{
	    PrecacheModel( szModel );
	    SetModel( szModel );
	}
	Precache();

	if ( m_spawnflags & FCYCLER_NOTSOLID )
	{
		SetSolid( SOLID_NONE );
	}
	else
	{
		SetSolid( SOLID_BBOX );
		AddSolidFlags( FSOLID_NOT_STANDABLE );
	}
	SetMoveType( MOVETYPE_NONE );

	// funcorators are immortal
	m_takedamage		= DAMAGE_NO;
	m_iHealth			= 80000;// no cycler should die

	m_flPlaybackRate	= 1.0f;
	m_flGroundSpeed		= 0;


	SetNextThink( gpGlobals->curtime + 1.0f );

	ResetSequenceInfo( );

	InitBoneControllers();

	/*
	if (GetNumFlexControllers() < 5)
		Warning( "cycler_flex used on model %s without enough flexes.\n", szModel );
	*/

	CreateExpresser();
}
コード例 #23
0
CBaseEntity* CASW_Base_Spawner::GetOrderTarget()
{
	// find entity with name m_AlienOrderTargetName
	if (GetAlienOrderTarget() == NULL &&
		(m_AlienOrders == AOT_MoveTo || m_AlienOrders == AOT_MoveToIgnoringMarines )
		)
	{
		m_hAlienOrderTarget = gEntList.FindEntityByName( NULL, m_AlienOrderTargetName, NULL );

		if( !GetAlienOrderTarget() )
		{
			DevWarning("%s: asw_spawner can't find order object: %s\n", GetDebugName(), STRING(m_AlienOrderTargetName) );
			return NULL;
		}
	}
	return GetAlienOrderTarget();
}
コード例 #24
0
//------------------------------------------------------------------------------
// Purpose :
//------------------------------------------------------------------------------
void CLookDoor::Spawn(void)
{
	BaseClass::Spawn();

	if (m_target == NULL_STRING)
	{
		Warning( "ERROR: DoorLook (%s) given no target.  Rejecting spawn.\n",GetDebugName());
		return;
	}
	CLookDoorThinker* pLookThinker = (CLookDoorThinker*)CreateEntityByName("lookdoorthinker");
	if (pLookThinker)
	{
		pLookThinker->SetThink(CLookDoorThinker::LookThink);
		pLookThinker->m_hLookDoor = this;
		pLookThinker->SetNextThink( gpGlobals->curtime + 0.1f );
	}
}
コード例 #25
0
int CHL1NPCTalker::PlayScriptedSentence( const char *pszSentence, float delay, float volume, soundlevel_t soundlevel, bool bConcurrent, CBaseEntity *pListener )
{
	if( hl1_debug_sentence_volume.GetBool() )
	{
		Msg( "SENTENCE: %s Vol:%f SndLevel:%d\n", GetDebugName(), volume, soundlevel );
	}

	if( hl1_fixup_sentence_sndlevel.GetBool() )
	{
		if( soundlevel < SNDLVL_TALKING )
		{
			soundlevel = SNDLVL_TALKING;
		}
	}

	return BaseClass::PlayScriptedSentence( pszSentence, delay, volume, soundlevel, bConcurrent, pListener );
}
コード例 #26
0
ファイル: pointteleport.cpp プロジェクト: Au-heppa/swarm-sdk
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void CPointTeleport::DoTeleport( inputdata_t &inputdata, const Vector &vecOrigin, const QAngle &angRotation, bool bOverrideTarget )
{
	// Attempt to find the entity in question
	CBaseEntity *pTarget;
	if( bOverrideTarget )
	{
		// Use the inputdata to find the entity that the designer supplied in the parameter override 
		pTarget = gEntList.FindEntityByName( NULL, inputdata.value.String(), this, inputdata.pActivator, inputdata.pCaller );
	}
	else
	{
		// Default behavior: Just find the entity that I am hardwired in Hammer to teleport.
		pTarget = gEntList.FindEntityByName( NULL, m_target, this, inputdata.pActivator, inputdata.pCaller );
	}

	if ( pTarget == NULL )
		return;

	// If teleport object is in a movement hierarchy, remove it first
	if ( EntityMayTeleport( pTarget ) == false )
	{
		Warning("ERROR: (%s) can't teleport object (%s) as it has a parent (%s)!\n",GetDebugName(),pTarget->GetDebugName(),pTarget->GetMoveParent()->GetDebugName());
		return;
	}

	// in episodic, we have a special spawn flag that forces Gordon into a duck
#ifdef HL2_EPISODIC
	if ( (m_spawnflags & SF_TELEPORT_INTO_DUCK) && pTarget->IsPlayer() ) 
	{
		CBasePlayer *pPlayer = ToBasePlayer( pTarget );
		if ( pPlayer != NULL )
		{
			pPlayer->m_nButtons |= IN_DUCK;
			pPlayer->AddFlag( FL_DUCKING );
			pPlayer->m_Local.m_bDucked = true;
			pPlayer->m_Local.m_bDucking = true;
			pPlayer->m_Local.m_nDuckTimeMsecs = 0;
			pPlayer->SetViewOffset( VEC_DUCK_VIEW );
			pPlayer->SetCollisionBounds( VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX );
		}
	}		
#endif

	pTarget->Teleport( &vecOrigin, &angRotation, NULL );
}
コード例 #27
0
ファイル: pathtrack.cpp プロジェクト: AluminumKen/hl2sb-src
//-----------------------------------------------------------------------------
// Connects up the previons + next pointers 
//-----------------------------------------------------------------------------
void CPathTrack::Link( void  )
{
	CBaseEntity *pTarget;

	if ( m_target != NULL_STRING )
	{
		pTarget = gEntList.FindEntityByName( NULL, m_target );

		if ( pTarget == this)
		{
			Warning("ERROR: path_track (%s) refers to itself as a target!\n", GetDebugName());
			
			//FIXME: Why were we removing this?  If it was already connected to, we weren't updating the other linked
			//		 end, causing problems with walking through bogus memory links!  -- jdw

			//UTIL_Remove(this);
			//return;
		}
		else if ( pTarget )
		{
			m_pnext = dynamic_cast<CPathTrack*>( pTarget );

			if ( m_pnext )		// If no next pointer, this is the end of a path
			{
				m_pnext->SetPrevious( this );
			}
		}
		else
		{
			Warning("Dead end link: %s\n", STRING( m_target ) );
		}
	}

	// Find "alternate" path
	if ( m_altName != NULL_STRING )
	{
		pTarget = gEntList.FindEntityByName( NULL, m_altName );
		if ( pTarget )
		{
			m_paltpath = dynamic_cast<CPathTrack*>( pTarget );
			m_paltpath->SetPrevious( this );
		}
	}
}
//-----------------------------------------------------------------------------
// Spawn
//-----------------------------------------------------------------------------
void CAmbientGenericFMOD::Spawn( void )
{
	char *szSoundFile = (char *)STRING( m_iszSound );
	if ( !m_iszSound || strlen( szSoundFile ) < 1 )
	{
		Warning( "Empty %s (%s) at %.2f, %.2f, %.2f\n", GetClassname(), GetDebugName(), GetAbsOrigin().x, GetAbsOrigin().y, GetAbsOrigin().z );
		UTIL_Remove(this);
		return;
	}

	if ( m_iszSound == NULL_STRING )
	{
		UTIL_Remove(this);
		return;
	}

    SetSolid( SOLID_NONE );
    SetMoveType( MOVETYPE_NONE );
}
コード例 #29
0
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CPropVehicleChoreoGeneric::InputOpen( inputdata_t &inputdata )
{
	int nSequence = LookupSequence( "open" );

	// Set to the desired anim, or default anim if the desired is not present
	if ( nSequence > ACTIVITY_NOT_AVAILABLE )
	{
		SetCycle( 0 );
		m_flAnimTime = gpGlobals->curtime;
		ResetSequence( nSequence );
		ResetClientsideFrame();
	}
	else
	{
		// Not available try to get default anim
		Msg( "Choreo Generic Vehicle %s: missing open sequence\n", GetDebugName() );
		SetSequence( 0 );
	}
}
コード例 #30
0
ファイル: sound.cpp プロジェクト: Rayman1103/HLComplete
//-----------------------------------------------------------------------------
// Spawn
//-----------------------------------------------------------------------------
void CAmbientGeneric::Spawn( void )
{
	m_iSoundLevel = ComputeSoundlevel( m_radius, FBitSet( m_spawnflags, SF_AMBIENT_SOUND_EVERYWHERE )?true:false );
	ComputeMaxAudibleDistance( );

	char *szSoundFile = (char *)STRING( m_iszSound );
	if ( !m_iszSound || strlen( szSoundFile ) < 1 )
	{
		Warning( "Empty %s (%s) at %.2f, %.2f, %.2f\n", GetClassname(), GetDebugName(), GetAbsOrigin().x, GetAbsOrigin().y, GetAbsOrigin().z );
		UTIL_Remove(this);
		return;
	}

    SetSolid( SOLID_NONE );
    SetMoveType( MOVETYPE_NONE );

	// Set up think function for dynamic modification 
	// of ambient sound's pitch or volume. Don't
	// start thinking yet.

	SetThink(&CAmbientGeneric::RampThink);
	SetNextThink( TICK_NEVER_THINK );

	m_fActive = false;

	if ( FBitSet ( m_spawnflags, SF_AMBIENT_SOUND_NOT_LOOPING ) )
	{
		m_fLooping = false;
	}
	else
	{
		m_fLooping = true;
	}

	m_hSoundSource = NULL;
	m_nSoundSourceEntIndex = -1;

	Precache( );

	// init all dynamic modulation parms
	InitModulationParms();
}