当前位置: 首页>>代码示例>>C++>>正文


C++ LookupAttachment函数代码示例

本文整理汇总了C++中LookupAttachment函数的典型用法代码示例。如果您正苦于以下问题:C++ LookupAttachment函数的具体用法?C++ LookupAttachment怎么用?C++ LookupAttachment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LookupAttachment函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Precache

//=========================================================
// Spawn
//=========================================================
void CGenericActor::Spawn()
{
    Precache();

    SetModel( STRING( GetModelName() ) );

    /*
    	if ( FStrEq( STRING( GetModelName() ), "models/player.mdl" ) )
    		UTIL_SetSize(this, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX);
    	else
    		UTIL_SetSize(this, VEC_HULL_MIN, VEC_HULL_MAX);
    */

    if ( FStrEq( STRING( GetModelName() ), "models/player.mdl" ) ||
            FStrEq( STRING( GetModelName() ), "models/holo.mdl" ) ||
            FStrEq( STRING( GetModelName() ), "models/blackout.mdl" ) )
    {
        UTIL_SetSize(this, VEC_HULL_MIN, VEC_HULL_MAX);
    }
    else
    {
        UTIL_SetSize(this, NAI_Hull::Mins(HULL_HUMAN), NAI_Hull::Maxs(HULL_HUMAN));
    }

    if ( !FStrEq( STRING( GetModelName() ), "models/blackout.mdl" ) )
    {
        SetSolid( SOLID_BBOX );
        AddSolidFlags( FSOLID_NOT_STANDABLE );
    }
    else
    {
        SetSolid( SOLID_NONE );
    }

    SetMoveType( MOVETYPE_STEP );
    SetBloodColor( BLOOD_COLOR_RED );
    m_iHealth			= 8;
    m_flFieldOfView		= 0.5;// indicates the width of this NPC's forward view cone ( as a dotproduct result )
    m_NPCState			= NPC_STATE_NONE;

    CapabilitiesAdd( bits_CAP_MOVE_GROUND | bits_CAP_OPEN_DOORS );

    // remove head turn if no eyes or forward attachment
    if (LookupAttachment( "eyes" ) > 0 && LookupAttachment( "forward" ) > 0)
    {
        CapabilitiesAdd(  bits_CAP_TURN_HEAD | bits_CAP_ANIMATEDFACE );
    }

    if (m_strHullName != NULL_STRING)
    {
        SetHullType( NAI_Hull::LookupId( STRING( m_strHullName ) ) );
    }
    else
    {
        SetHullType( HULL_HUMAN );
    }
    SetHullSizeNormal( );

    NPCInit();
}
开发者ID:KermitAudio,项目名称:MSS,代码行数:63,代码来源:genericactor.cpp

示例2: while

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CNPC_Portal_FloorTurret::Activate( void )
{
	BaseClass::Activate();

	// Find all nearby physics objects and add them to the list of objects we will sense
	CBaseEntity *pObject = gEntList.FindEntityByClassname( NULL, "prop_physics" );
	while ( pObject )
	{
		// Tell the AI sensing list that we want to consider this
		g_AI_SensedObjectsManager.AddEntity( pObject );

		pObject = gEntList.FindEntityByClassname( pObject, "prop_physics" );
	}

	pObject = gEntList.FindEntityByClassname( NULL, "func_physbox" );
	while ( pObject )
	{
		// Tell the AI sensing list that we want to consider this
		g_AI_SensedObjectsManager.AddEntity( pObject );

		pObject = gEntList.FindEntityByClassname( pObject, "func_physbox" );
	}

	m_iLastState = TURRET_AUTO_SEARCHING;

	m_iBarrelAttachments[ 0 ] = LookupAttachment( "LFT_Gun1_Muzzle" );
	m_iBarrelAttachments[ 1 ] = LookupAttachment( "RT_Gun1_Muzzle" );
	m_iBarrelAttachments[ 2 ] = LookupAttachment( "LFT_Gun2_Muzzle" );
	m_iBarrelAttachments[ 3 ] = LookupAttachment( "RT_Gun2_Muzzle" );
}
开发者ID:RubberWar,项目名称:Portal-2,代码行数:33,代码来源:npc_portal_turret_floor.cpp

示例3: GetLocalOrigin

void CASW_Zombie::CreateEyeGlows( void )
{
	//Create our Eye sprites
	if ( m_pEyeGlow[0] == NULL )
	{
		m_pEyeGlow[0] = CSprite::SpriteCreate( ZOMBIE_GLOW_SPRITE, GetLocalOrigin(), false );
		m_pEyeGlow[0]->SetAttachment( this, LookupAttachment( "LeftEye" ) );
	
		m_pEyeGlow[0]->SetTransparency( kRenderTransAdd, 128, 0, 0, 128, kRenderFxNoDissipation );
		m_pEyeGlow[0]->SetBrightness( 164, 0.1f );
		m_pEyeGlow[0]->SetScale( 0.1f, 0.1f );
		m_pEyeGlow[0]->SetColor( 128, 0, 0 );
		m_pEyeGlow[0]->SetAsTemporary();
	}
	if ( m_pEyeGlow[1] == NULL )
	{
		m_pEyeGlow[1] = CSprite::SpriteCreate( ZOMBIE_GLOW_SPRITE, GetLocalOrigin(), false );
		m_pEyeGlow[1]->SetAttachment( this, LookupAttachment( "RightEye" ) );
		
		m_pEyeGlow[1]->SetTransparency( kRenderTransAdd, 128, 0, 0, 128, kRenderFxNoDissipation );
		m_pEyeGlow[1]->SetBrightness( 164, 0.1f );
		m_pEyeGlow[1]->SetScale( 0.1f, 0.1f );
		m_pEyeGlow[1]->SetColor( 128, 0, 0 );
		m_pEyeGlow[1]->SetAsTemporary();
	}
}
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:26,代码来源:asw_zombie.cpp

示例4: Q_strncpy

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CObjectBuffStation::InitAttachmentData( void )
{
	// Initialize the attachment data.
	char szAttachName[13];

	m_nPlayerCount = 0;
	Q_strncpy( szAttachName, "playercable1", 13 );
	for ( int iPlayer = 0; iPlayer < BUFF_STATION_MAX_PLAYERS; ++iPlayer )
	{
		m_hPlayers.Set( iPlayer, NULL );

		szAttachName[11] = '1' + iPlayer;
		m_aPlayerAttachInfo[iPlayer].m_iAttachPoint = LookupAttachment( szAttachName );
	}

	m_nObjectCount = 0;
	Q_strncpy( szAttachName, "objectcable1", 13 );	
	for ( int iObject = 0; iObject < BUFF_STATION_MAX_OBJECTS; ++iObject )
	{
		m_hObjects.Set( iObject, NULL );

		szAttachName[11] = '1' + iObject;
		m_aObjectAttachInfo[iObject].m_iAttachPoint = LookupAttachment( szAttachName );
	}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:28,代码来源:tf_obj_buff_station.cpp

示例5: UTIL_Tracer

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : &startPos - 
//			&endPos - 
//			width - 
//			useMuzzle - 
//-----------------------------------------------------------------------------
void CASW_PropJeep::DrawBeam( const Vector &startPos, const Vector &endPos, float width )
{
	//Tracer down the middle
	UTIL_Tracer( startPos, endPos, 0, TRACER_DONT_USE_ATTACHMENT, 6500, false, "GaussTracer" );

	//Draw the main beam shaft
	CBeam *pBeam = CBeam::BeamCreate( GAUSS_BEAM_SPRITE, 0.5 );
	
	pBeam->SetStartPos( startPos );
	pBeam->PointEntInit( endPos, this );
	pBeam->SetEndAttachment( LookupAttachment("Muzzle") );
	pBeam->SetWidth( width );
	pBeam->SetEndWidth( 0.05f );
	pBeam->SetBrightness( 255 );
	pBeam->SetColor( 255, 185+random->RandomInt( -16, 16 ), 40 );
	pBeam->RelinkBeam();
	pBeam->LiveForTime( 0.1f );

	//Draw electric bolts along shaft
	pBeam = CBeam::BeamCreate( GAUSS_BEAM_SPRITE, 3.0f );
	
	pBeam->SetStartPos( startPos );
	pBeam->PointEntInit( endPos, this );
	pBeam->SetEndAttachment( LookupAttachment("Muzzle") );

	pBeam->SetBrightness( random->RandomInt( 64, 255 ) );
	pBeam->SetColor( 255, 255, 150+random->RandomInt( 0, 64 ) );
	pBeam->RelinkBeam();
	pBeam->LiveForTime( 0.1f );
	pBeam->SetNoise( 1.6f );
	pBeam->SetEndWidth( 0.1f );
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:39,代码来源:asw_jeep.cpp

示例6: switch

void CObjectSentrygun::FinishUpgrading( void )
{
	m_iState.Set( SENTRY_STATE_SEARCHING );
	m_hEnemy = NULL;

	switch( m_iUpgradeLevel )
	{
	case 1:
		SetModel( SENTRY_MODEL_LEVEL_1 );
		break;
	case 2:
		SetModel( SENTRY_MODEL_LEVEL_2 );
		break;
	case 3:
		SetModel( SENTRY_MODEL_LEVEL_3 );
		break;
	default:
		Assert(0);
		break;
	}

	// Look up the new attachments
	m_iAttachments[SENTRYGUN_ATTACHMENT_MUZZLE] = LookupAttachment( "muzzle_l" );
	m_iAttachments[SENTRYGUN_ATTACHMENT_MUZZLE_ALT] = LookupAttachment( "muzzle_r" );
	m_iAttachments[SENTRYGUN_ATTACHMENT_ROCKET_L] = LookupAttachment( "rocket_l" );
	m_iAttachments[SENTRYGUN_ATTACHMENT_ROCKET_R] = LookupAttachment( "rocket_r" );

	BaseClass::FinishUpgrading();
}
开发者ID:MrBoomer568,项目名称:TF2Classic,代码行数:29,代码来源:tf_obj_sentrygun.cpp

示例7: LookupAttachment

//-----------------------------------------------------------------------------
// Purpose: Sets up the attachment point lookup for the model
//-----------------------------------------------------------------------------
void C_WeaponStunStick::SetupAttachmentPoints( void )
{
	// Setup points for both types of views
	if ( ShouldDrawUsingViewModel() )
	{
		const char *szBeamAttachNamesTop[NUM_BEAM_ATTACHMENTS] =
		{
			"spark1a","spark2a","spark3a","spark4a",
			"spark5a","spark6a","spark7a","spark8a",
			"spark9a",
		};

		const char *szBeamAttachNamesBottom[NUM_BEAM_ATTACHMENTS] =
		{
			"spark1b","spark2b","spark3b","spark4b",
			"spark5b","spark6b","spark7b","spark8b",
			"spark9b",
		};
		
		// Lookup and store all connections
		for ( int i = 0; i < NUM_BEAM_ATTACHMENTS; i++ )
		{
			m_BeamAttachments[i].IDs[0] = LookupAttachment( szBeamAttachNamesTop[i] );
			m_BeamAttachments[i].IDs[1] = LookupAttachment( szBeamAttachNamesBottom[i] );
		}

		// Setup the center beam point
		m_BeamCenterAttachment = LookupAttachment( BEAM_ATTACH_CORE_NAME );
	}
	else
	{
		// Setup the center beam point
		m_BeamCenterAttachment = 1;
	}
}
开发者ID:NEITMod,项目名称:HL2BM2,代码行数:38,代码来源:weapon_stunstick.cpp

示例8: LookupAttachment

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CWeaponGauss::DrawBeam( const Vector &startPos, const Vector &endPos, float width, bool useMuzzle )
{

#ifndef CLIENT_DLL

	//Draw the main beam shaft
	CBeam *m_pBeam = CBeam::BeamCreate( GAUSS_BEAM_SPRITE, width );

	if ( useMuzzle )
	{
		m_pBeam->PointEntInit( endPos, this );
		m_pBeam->SetEndAttachment( LookupAttachment("Muzzle") );
		m_pBeam->SetWidth( width / 4.0f );
		m_pBeam->SetEndWidth( width );
		m_pBeam->RelinkBeam();
	}

	else
	{
		m_pBeam->SetStartPos( startPos );
		m_pBeam->SetEndPos( endPos );
		m_pBeam->SetWidth( width );
		m_pBeam->SetEndWidth( width / 4.0f );
		m_pBeam->RelinkBeam();
	}
	m_pBeam->SetBrightness( 255 );
	m_pBeam->SetColor( 255, 145+random->RandomInt( -16, 16 ), 0 );
	m_pBeam->LiveForTime( 0.1f );
	m_pBeam->RelinkBeam();
	//Draw electric bolts along shaft
	for ( int i = 0; i < 3; i++ )
	{
		m_pBeam = CBeam::BeamCreate( GAUSS_BEAM_SPRITE, (width/2.0f) + i );
		
		if ( useMuzzle )
		{
			m_pBeam->PointEntInit( endPos, this );
			m_pBeam->SetEndAttachment( LookupAttachment("Muzzle") );
			m_pBeam->RelinkBeam();
		}
		else
		{
			m_pBeam->SetStartPos( startPos );
			m_pBeam->SetEndPos( endPos );
			m_pBeam->RelinkBeam();
		}
		m_pBeam->SetBrightness( random->RandomInt( 64, 255 ) );
	    m_pBeam->SetColor( 255, 255, 150+random->RandomInt( 0, 64 ) );
		m_pBeam->LiveForTime( 0.1f );
		m_pBeam->SetNoise( 1.6f * i );
		m_pBeam->SetEndWidth( 0.1f );
		m_pBeam->RelinkBeam();
	}
#endif
return;
}
开发者ID:Sub-Zero1324,项目名称:HL2-DM-Gauss-Gun-Code,代码行数:59,代码来源:weapon_gauss.cpp

示例9: LookupAttachment

	int CWeaponElite::GetMuzzleAttachment( void )
	{
		if ( m_bFireRight )  //even number
		{
			return LookupAttachment( "muzzle_flash_r" );
		}
		else
		{
			return LookupAttachment( "muzzle_flash_l" );	
		}
	}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:11,代码来源:weapon_elite.cpp

示例10: LookupAttachment

void QUA_helicopter::Activate() {
	BaseClass::Activate();
	m_nGunBaseAttachment = LookupAttachment("gun");
	m_nMachineGunMuzzleAttachment = LookupAttachment( "muzzle" );
	m_nBombAttachment=LookupAttachment("Bomb");
	Vector vecWorldBarrelPos;
	QAngle worldBarrelAngle;
	matrix3x4_t matRefToWorld;
	GetAttachment( m_nMachineGunMuzzleAttachment, vecWorldBarrelPos, worldBarrelAngle );
	GetAttachment(m_nGunBaseAttachment, matRefToWorld );
	VectorITransform( vecWorldBarrelPos, matRefToWorld, m_vecBarrelPos );
}
开发者ID:WorldGamers,项目名称:Mobile-Forces-Source,代码行数:12,代码来源:vehicle_helicopter.cpp

示例11: LookupAttachment

//-----------------------------------------------------------------------------
// Sets up various attachment points once the model is selected 
//-----------------------------------------------------------------------------
void CObjectBaseMannedGun::OnModelSelected()
{
	m_nBarrelAttachment = LookupAttachment( "barrel" );
	m_nBarrelPivotAttachment = LookupAttachment( "barrelpivot" );
	m_nStandAttachment = LookupAttachment( "vehicle_feet_passenger0" );
	m_nEyesAttachment = LookupAttachment( "vehicle_eyes_passenger0" );

	// Find the barrel height in its quiescent state...
	Vector vBarrel;
	QAngle vBarrelAngles;
	GetAttachmentLocal( m_nBarrelAttachment, vBarrel, vBarrelAngles );
	m_flBarrelHeight = vBarrel.z;
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:16,代码来源:tf_obj_base_manned_gun.cpp

示例12: Precache

//-----------------------------------------------------------------------------
// Purpose: the entity
//-----------------------------------------------------------------------------
void CNPC_RocketTurret::Spawn( void )
{ 
	Precache();

	BaseClass::Spawn();

	SetViewOffset( vec3_origin );

	AddEFlags( EFL_NO_DISSOLVE );

	SetModel( ROCKET_TURRET_MODEL_NAME );
	SetSolid( SOLID_VPHYSICS );

	m_iMuzzleAttachment = LookupAttachment ( "barrel" );
	m_iLightAttachment = LookupAttachment ( "eye" );

	m_iPosePitch = LookupPoseParameter( "aim_pitch" );
	m_iPoseYaw   = LookupPoseParameter( "aim_yaw" );

	m_vecCurrentAngles = m_vecGoalAngles = GetAbsAngles();

	CreateVPhysics();

	//Set our autostart state
	m_bEnabled	 = ( ( m_spawnflags & SF_ROCKET_TURRET_START_INACTIVE ) == false );

	// Set Locked sprite
	if ( m_bEnabled )
	{
		m_iLaserState = 1;
		SetSequence(LookupSequence("idle"));
	}
	else
	{
		m_iLaserState = 0;
		SetSequence(LookupSequence("inactive"));
	}
	SetCycle(1.0f);
	UpdateSkin( ROCKET_SKIN_IDLE );

	SetPoseParameter( "aim_pitch", 0 );
	SetPoseParameter( "aim_yaw", -180 );

	if ( m_bEnabled )
	{
		SetThink( &CNPC_RocketTurret::FollowThink );
	}
	
	SetNextThink( gpGlobals->curtime + ROCKET_TURRET_THINK_RATE );
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:53,代码来源:npc_rocket_turret.cpp

示例13: LookupAttachment

//-----------------------------------------------------------------------------
// Purpose: Spawn the entity
//-----------------------------------------------------------------------------
void CNPC_Portal_FloorTurret::Spawn( void )
{ 
	BaseClass::Spawn();

	m_iBarrelAttachments[ 0 ] = LookupAttachment( "LFT_Gun1_Muzzle" );
	m_iBarrelAttachments[ 1 ] = LookupAttachment( "RT_Gun1_Muzzle" );
	m_iBarrelAttachments[ 2 ] = LookupAttachment( "LFT_Gun2_Muzzle" );
	m_iBarrelAttachments[ 3 ] = LookupAttachment( "RT_Gun2_Muzzle" );

	m_fSearchSpeed = RandomFloat( 1.0f, 1.4f );
	m_fMovingTargetThreashold = 20.0f;

	m_bNoAlarmSounds = true;
	m_bOutOfAmmo = ( m_spawnflags & SF_FLOOR_TURRET_OUT_OF_AMMO ) != 0;
}
开发者ID:RubberWar,项目名称:Portal-2,代码行数:18,代码来源:npc_portal_turret_floor.cpp

示例14: GetDriver

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CASW_PropJeep::CheckWaterLevel( void )
{
	CBaseEntity *pEntity = GetDriver();
	if ( pEntity && pEntity->IsPlayer() )
	{
		CBasePlayer *pPlayer = static_cast<CBasePlayer*>( pEntity );
		
		Vector vecAttachPoint;
		QAngle vecAttachAngles;
		
		// Check eyes. (vehicle_driver_eyes point)
		int iAttachment = LookupAttachment( "vehicle_driver_eyes" );
		GetAttachment( iAttachment, vecAttachPoint, vecAttachAngles );

		// Add the jeep's Z view offset
		Vector vecUp;
		AngleVectors( vecAttachAngles, NULL, NULL, &vecUp );
		vecUp.z = clamp( vecUp.z, 0.0f, vecUp.z );
		vecAttachPoint.z += r_JeepViewZHeight.GetFloat() * vecUp.z;

		bool bEyes = ( UTIL_PointContents( vecAttachPoint, MASK_WATER ) & MASK_WATER ) ? true : false;
		if ( bEyes )
		{
			pPlayer->SetWaterLevel( WL_Eyes );
			return;
		}

		// Check waist.  (vehicle_engine point -- see parent function).
		if ( m_WaterData.m_bBodyInWater )
		{
			pPlayer->SetWaterLevel( WL_Waist );
			return;
		}

		// Check feet. (vehicle_feet_passenger0 point)
		iAttachment = LookupAttachment( "vehicle_feet_passenger0" );
		GetAttachment( iAttachment, vecAttachPoint, vecAttachAngles );
		bool bFeet = ( UTIL_PointContents( vecAttachPoint, MASK_WATER ) & MASK_WATER ) ? true : false;
		if ( bFeet )
		{
			pPlayer->SetWaterLevel( WL_Feet );
			return;
		}

		// Not in water.
		pPlayer->SetWaterLevel( WL_NotInWater );
	}
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:51,代码来源:asw_jeep.cpp

示例15: LookupAttachment

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void C_PropVehicleDriveable::RestrictView( float *pYawBounds, float *pPitchBounds,
										   float *pRollBounds, QAngle &vecViewAngles )
{
	int eyeAttachmentIndex = LookupAttachment( "vehicle_driver_eyes" );
	Vector vehicleEyeOrigin;
	QAngle vehicleEyeAngles;
	GetAttachmentLocal( eyeAttachmentIndex, vehicleEyeOrigin, vehicleEyeAngles );

	// Limit the yaw.
	if ( pYawBounds )
	{
		float flAngleDiff = AngleDiff( vecViewAngles.y, vehicleEyeAngles.y );
		flAngleDiff = clamp( flAngleDiff, pYawBounds[0], pYawBounds[1] );
		vecViewAngles.y = vehicleEyeAngles.y + flAngleDiff;
	}

	// Limit the pitch.
	if ( pPitchBounds )
	{
		float flAngleDiff = AngleDiff( vecViewAngles.x, vehicleEyeAngles.x );
		flAngleDiff = clamp( flAngleDiff, pPitchBounds[0], pPitchBounds[1] );
		vecViewAngles.x = vehicleEyeAngles.x + flAngleDiff;
	}

	// Limit the roll.
	if ( pRollBounds )
	{
		float flAngleDiff = AngleDiff( vecViewAngles.z, vehicleEyeAngles.z );
		flAngleDiff = clamp( flAngleDiff, pRollBounds[0], pRollBounds[1] );
		vecViewAngles.z = vehicleEyeAngles.z + flAngleDiff;
	}
}
开发者ID:WorldGamers,项目名称:Mobile-Forces-Source,代码行数:35,代码来源:c_prop_vehicle.cpp


注:本文中的LookupAttachment函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。