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


C++ SetBodygroup函数代码示例

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


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

示例1: SetHullType

void CASW_Parasite::Spawn( void )
{	
	SetHullType(HULL_TINY);

	BaseClass::Spawn();

	SetModel( SWARM_PARASITE_MODEL);

	if (FClassnameIs(this, "asw_parasite_defanged"))
	{
		m_bDefanged = true;
		m_iHealth	= ASWGameRules()->ModifyAlienHealthBySkillLevel(10);
		SetBodygroup( 0, 1 );
		m_fSuicideTime = gpGlobals->curtime + 60;
	}
	else
	{
		m_bDefanged = false;
		m_iHealth	= ASWGameRules()->ModifyAlienHealthBySkillLevel(25);
		SetBodygroup( 0, 0 );
		m_fSuicideTime = 0;
	}

	SetMoveType( MOVETYPE_STEP );
	SetHullType(HULL_TINY);
	SetCollisionGroup( ASW_COLLISION_GROUP_PARASITE );
	SetViewOffset( Vector(6, 0, 11) ) ;		// Position of the eyes relative to NPC's origin.

	m_NPCState	= NPC_STATE_NONE;

	CapabilitiesAdd( bits_CAP_MOVE_GROUND | bits_CAP_INNATE_RANGE_ATTACK1 );

	m_bInfesting = false;
	
}
开发者ID:detoxhby,项目名称:SwarmDirector2,代码行数:35,代码来源:asw_parasite.cpp

示例2: IgniteEnd

void CZombie::MonsterThink( void )
{
	pev->nextthink = gpGlobals->time + 0.1;

	if (m_fNextIgnite && gpGlobals->time >= m_fNextIgnite)
	{
		if (m_iIgniteCounter >= 7)//burn for 7 seconds
		{
			IgniteEnd();
		}
		else
		{
			RealTakeDamage(pev, pev, 10, DMG_GENERIC|DMG_NEVERGIB);
			m_iIgniteCounter++;
			m_fNextIgnite = gpGlobals->time + 1;
		}

		if (pev->health <= 0)
		{
			SetBodygroup(BODYGROUP_HEAD, SUBMDL_HEAD_NO);

			if (m_iInjuryType & DAMAGE_BLOW_HEAD)
				SetBodygroup(BODYGROUP_BODY, SUBMDL_BODY_SKELETON_NOSKULL);
			else
				SetBodygroup(BODYGROUP_BODY, SUBMDL_BODY_SKELETON);

			m_iInjuryType |= DAMAGE_DESTROY_FLESH;
		}
	}

	if (!m_fEndfrozen)
		CBaseMonster::MonsterThink();//Do not run AI
	else if (gpGlobals->time >= m_fEndfrozen)
		FrozenEnd();
}
开发者ID:mittorn,项目名称:hlwe_src,代码行数:35,代码来源:mon_zombie.cpp

示例3: GetAbsOrigin

//------------------------------------------------------------------------------
// Purpose :
// Input   :
// Output  :
//------------------------------------------------------------------------------
void CNPC_MissileDefense::Gib(void)
{
	// Sparks
	for (int i = 0; i < 4; i++)
	{
		Vector sparkPos = GetAbsOrigin();
		sparkPos.x += random->RandomFloat(-12,12);
		sparkPos.y += random->RandomFloat(-12,12);
		sparkPos.z += random->RandomFloat(-12,12);
		g_pEffects->Sparks(sparkPos);
	}
	// Smoke
	UTIL_Smoke(GetAbsOrigin(), random->RandomInt(10, 15), 10);

	// Light
	CBroadcastRecipientFilter filter;

	te->DynamicLight( filter, 0.0,
			&GetAbsOrigin(), 255, 180, 100, 0, 100, 0.1, 0 );

	// Remove top parts
	SetBodygroup( 1, 0 );
	SetBodygroup( 2, 0 );
	SetBodygroup( 3, 0 );
	SetBodygroup( 4, 0 );
	m_takedamage = 0;
	SetThink(NULL);
	
	// Throw manhackgibs
	CGib::SpawnSpecificGibs( this, MD_GIB_COUNT, 300, 500, MD_GIB_MODEL);
}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:36,代码来源:npc_missiledefense.cpp

示例4: TraceAttack

void CHoundeye :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
	CSquadMonster :: TraceAttack( pevAttacker, flDamage, vecDir, ptr, bitsDamageType);

	//demembrage

	if ( gMultiDamage.pEntity != this )
		return;
	
	if ( ( pev->health - ( gMultiDamage.amount ) <= 0 )  && IsAlive() && m_iHasGibbed == 0 )
	{
		switch ( ptr->iHitgroup )
		{
		case HITGROUP_RIGHTLEG:
			SetBodygroup( LEG_R_GROUP, NO_MEMBRE);
			MakeGib ( 0, pevAttacker );
			break;
		case HITGROUP_LEFTLEG:
			SetBodygroup( LEG_L_GROUP, NO_MEMBRE);
			MakeGib ( 0, pevAttacker );
			break;
		case HITGROUP_HEAD:
			SetBodygroup( EYE_GROUP, NO_MEMBRE);
			break;
		case HITGROUP_MIDLEG:
			SetBodygroup( LEG_M_GROUP, NO_MEMBRE);
			MakeGib ( 0, pevAttacker );
			break;

		}
	}

}
开发者ID:jlecorre,项目名称:hlinvasion,代码行数:33,代码来源:houndeye.cpp

示例5: TraceAttack

void CZombie :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
	if (!pev->takedamage) return;

	if (ptr->iHitgroup == HITGROUP_HEAD && !(m_iInjuryType & DAMAGE_BLOW_HEAD) && !m_fEndfrozen)
	{
		flDamage *= 2;

		if (flDamage >= pev->health)
		{
			if (m_iInjuryType & DAMAGE_DESTROY_FLESH)
			{
				SetBodygroup(BODYGROUP_HEAD, SUBMDL_HEAD_NO);
				SetBodygroup(BODYGROUP_BODY, SUBMDL_BODY_SKELETON_NOSKULL);
			}
			else
			{
				SetBodygroup(BODYGROUP_HEAD, SUBMDL_HEAD_BLOWN);
			}

			FX_PlrGib( ptr->vecEndPos, GIBBED_HEAD );
			pev->health = 0;
			m_iInjuryType |= DAMAGE_BLOW_HEAD;
			Killed(pevAttacker, 0);
			FrozenEnd();
			IgniteEnd();
			return;
		}
	}

	CBaseMonster::TraceAttack(pevAttacker, flDamage, vecDir, ptr, bitsDamageType);
}
开发者ID:mittorn,项目名称:hlwe_src,代码行数:32,代码来源:mon_zombie.cpp

示例6: switch

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : origin - 
//			angles - 
//			event - 
//			*options - 
//-----------------------------------------------------------------------------
void C_BaseObject::FireEvent( const Vector& origin, const QAngle& angles, int event, const char *options )
{
	switch ( event )
	{
	default:
		{
			BaseClass::FireEvent( origin, angles, event, options );
		}
		break;
	case TF_OBJ_PLAYBUILDSOUND:
		{
			EmitSound( options );
		}
		break;
	case TF_OBJ_ENABLEBODYGROUP:
		{
			int index = FindBodygroupByName( options );
			if ( index >= 0 )
			{
				SetBodygroup( index, TF_OBJ_BODYGROUPTURNON );
			}
		}
		break;
	case TF_OBJ_DISABLEBODYGROUP:
		{
			int index = FindBodygroupByName( options );
			if ( index >= 0 )
			{
				SetBodygroup( index, TF_OBJ_BODYGROUPTURNOFF );
			}
		}
		break;
	case TF_OBJ_ENABLEALLBODYGROUPS:
	case TF_OBJ_DISABLEALLBODYGROUPS:
		{
			// Start at 1, because body 0 is the main .mdl body...
			// Is this the way we want to do this?
			int count = GetNumBodyGroups();
			for ( int i = 1; i < count; i++ )
			{
				int subpartcount = GetBodygroupCount( i );
				if ( subpartcount == 2 )
				{
					SetBodygroup( i, 
						( event == TF_OBJ_ENABLEALLBODYGROUPS ) ?
						TF_OBJ_BODYGROUPTURNON : TF_OBJ_BODYGROUPTURNOFF );
				}
				else
				{
					DevMsg( "TF_OBJ_ENABLE/DISABLEBODY GROUP:  %s has a group with %i subparts, should be exactly 2\n",
						GetClassname(), subpartcount );
				}
			}
		}
		break;
	}
}
开发者ID:Deathreus,项目名称:TF2Classic,代码行数:64,代码来源:c_baseobject.cpp

示例7: SetModel

//---------------------------------------------------------
// Zombie model
//---------------------------------------------------------
void CNPC_Infected::SetZombieModel( void )
{
	SetModel( "models/infected/common_male01.mdl" );
	SetHullType( HULL_HUMAN );
		
	SetBodygroup ( 0, RandomInt (0, 3 ) ); // Head
	SetBodygroup ( 1, RandomInt (0, 5 ) ); // Upper body
	SetBodygroup ( 2, RandomInt (0, 3 ) ); // Lower body, changes the number of legs cut off (kaitek666: was commented out. Why?)
		
	m_nSkin = random->RandomInt( 0, INFECTED_SKIN_COUNT-1 );
}
开发者ID:wrenchmods,项目名称:Sleepless,代码行数:14,代码来源:npc_infected.cpp

示例8: SetNextThink

void CWeaponPortalgun::Think( void )
{
	//Allow descended classes a chance to do something before the think function
	if ( PreThink() )
		return;

	SetNextThink( gpGlobals->curtime + 0.1f );

	CPortal_Player *pPlayer = ToPortalPlayer( GetOwner() );

	if ( !pPlayer || pPlayer->GetActiveWeapon() != this )
	{
		m_fCanPlacePortal1OnThisSurface = 1.0f;
		m_fCanPlacePortal2OnThisSurface = 1.0f;
		return;
	}

	// Test portal placement
	m_fCanPlacePortal1OnThisSurface = ( ( m_bCanFirePortal1 ) ? ( FirePortal( false, 0, 1 ) ) : ( 0.0f ) );
	m_fCanPlacePortal2OnThisSurface = ( ( m_bCanFirePortal2 ) ? ( FirePortal( true, 0, 2 ) ) : ( 0.0f ) );

	// Draw obtained portal color chips
	int iSlot1State = ( ( m_bCanFirePortal1 ) ? ( 0 ) : ( 1 ) ); // FIXME: Portal gun might have only red but not blue;
	int iSlot2State = ( ( m_bCanFirePortal2 ) ? ( 0 ) : ( 1 ) );

	SetBodygroup( 1, iSlot1State );
	SetBodygroup( 2, iSlot2State );

	if ( pPlayer->GetViewModel() )
	{
		pPlayer->GetViewModel()->SetBodygroup( 1, iSlot1State );
		pPlayer->GetViewModel()->SetBodygroup( 2, iSlot2State );
	}

	// HACK HACK! Used to make the gun visually change when going through a cleanser!
	if ( m_fEffectsMaxSize1 > 4.0f )
	{
		m_fEffectsMaxSize1 -= gpGlobals->frametime * 400.0f;
		if ( m_fEffectsMaxSize1 < 4.0f )
			m_fEffectsMaxSize1 = 4.0f;
	}

	if ( m_fEffectsMaxSize2 > 4.0f )
	{
		m_fEffectsMaxSize2 -= gpGlobals->frametime * 400.0f;
		if ( m_fEffectsMaxSize2 < 4.0f )
			m_fEffectsMaxSize2 = 4.0f;
	}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:49,代码来源:weapon_portalgun.cpp

示例9: SetBodygroup

void CObjectTeleporter::ShowDirectionArrow( bool bShow )
{
	if ( bShow != m_bShowDirectionArrow )
	{
		if ( m_iDirectionBodygroup >= 0 )
		{
			SetBodygroup( m_iDirectionBodygroup, bShow ? 1 : 0 );
		}
			
		m_bShowDirectionArrow = bShow;

		if ( bShow )
		{
			CObjectTeleporter *pMatch = GetMatchingTeleporter();

			Assert( pMatch );

			Vector vecToOwner = pMatch->GetAbsOrigin() - GetAbsOrigin();
			QAngle angleToExit;
			VectorAngles( vecToOwner, Vector(0,0,1), angleToExit );
			angleToExit -= GetAbsAngles();

			// pose param is flipped and backwards, adjust.
			//m_flYawToExit = anglemod( -angleToExit.y + 180.0 );
			m_flYawToExit = AngleNormalize( -angleToExit.y + 180.0 );
			// For whatever reason the original code normalizes angle 0 to 360 while pose param
			// takes angle from -180 to 180. I have no idea how did this work properly
			// in official TF2 all this time. (Nicknine)
		}
	}
}
开发者ID:Deathreus,项目名称:TF2Classic,代码行数:31,代码来源:tf_obj_teleporter.cpp

示例10: GetStudioHdr

void StudioModel::scaleMeshes (float scale)
{
	CStudioHdr *pStudioHdr = GetStudioHdr();
	if (!pStudioHdr)
		return;

	int i, j, k;

	// manadatory to access correct verts
	SetCurrentModel();

	// scale verts
	int tmp = m_bodynum;
	for (i = 0; i < pStudioHdr->numbodyparts(); i++)
	{
		mstudiobodyparts_t *pbodypart = pStudioHdr->pBodypart( i );
		for (j = 0; j < pbodypart->nummodels; j++)
		{
			SetBodygroup (i, j);
			SetupModel (i);

			const mstudio_modelvertexdata_t *vertData = m_pmodel->GetVertexData();

			for (k = 0; k < m_pmodel->numvertices; k++)
			{
				*vertData->Position(k) *= scale;
			}
		}
	}

	m_bodynum = tmp;

	// scale complex hitboxes
	int hitboxset = g_MDLViewer->GetCurrentHitboxSet();

	mstudiobbox_t *pbboxes = pStudioHdr->pHitbox( 0, hitboxset );
	for (i = 0; i < pStudioHdr->iHitboxCount( hitboxset ); i++)
	{
		VectorScale (pbboxes[i].bbmin, scale, pbboxes[i].bbmin);
		VectorScale (pbboxes[i].bbmax, scale, pbboxes[i].bbmax);
	}

	// scale bounding boxes
	for (i = 0; i < pStudioHdr->GetNumSeq(); i++)
	{
		mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( i );
		Vector tmp;

		tmp = seqdesc.bbmin;
		VectorScale( tmp, scale, tmp );
		seqdesc.bbmin = tmp;

		tmp = seqdesc.bbmax;
		VectorScale( tmp, scale, tmp );
		seqdesc.bbmax = tmp;

	}

	// maybe scale exeposition, pivots, attachments
}
开发者ID:chrizonix,项目名称:RCBot2,代码行数:60,代码来源:studio_utils.cpp

示例11: Precache

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void Dota_Resupply::Spawn( void )
{
	Precache();

	BaseClass::Spawn();

	SetModel( STRING( GetModelName() ) );
	SetMoveType( MOVETYPE_NONE );
	SetSolid( SOLID_VPHYSICS );
	CreateVPhysics();

	ResetSequence( LookupSequence( "Idle" ) );
	SetBodygroup( 1, true );

	m_flCloseTime = gpGlobals->curtime;
	m_flAnimTime = gpGlobals->curtime;
	m_flPlaybackRate = 0.0;
	SetCycle( 0 );

	m_takedamage = DAMAGE_EVENTS_ONLY;

	// Issue #28: JMS - 2013-10-12 - ammobox needs to fire a new modevent letting all clients know that one is spawned
	IGameEvent *pEvent = gameeventmanager->CreateEvent( "ammobox_spawn" );
	if ( pEvent )
	{
		pEvent->SetInt( "entindex", entindex() );
		gameeventmanager->FireEvent( pEvent );
	}
}
开发者ID:schroe2a,项目名称:DotaSource2,代码行数:32,代码来源:dota_resupply.cpp

示例12: Deploy

//-----------------------------------------------------------------------------
// Here's where we deal with weapons, ladders, etc.
//-----------------------------------------------------------------------------
void CVehicleTeleportStation::OnItemPostFrame( CBaseTFPlayer *pDriver )
{
	// I can't do anything if I'm not active
	if ( !ShouldBeActive() )
		return;

	if ( GetPassengerRole( pDriver ) != VEHICLE_DRIVER )
		return;

	if ( !IsDeployed() && ( pDriver->m_afButtonPressed & IN_ATTACK ) )
	{
		if ( ValidDeployPosition() )
		{
			Deploy();
		}
	}
	else if ( IsDeployed() && ( pDriver->m_afButtonPressed & IN_ATTACK ) )
	{
		UnDeploy();

		SetControlPanelsActive( false );
		SetBodygroup( 1, true );
		RemoveCornerSprites();
		SetContextThink( NULL, 0, TELEPORT_STATION_THINK_CONTEXT );
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:29,代码来源:tf_vehicle_teleport_station.cpp

示例13: StartMonster

//=========================================================
// StartMonster
//=========================================================
void CSquadMonster :: StartMonster( void )
{
    CBaseMonster :: StartMonster();

    if ( ( m_afCapability & bits_CAP_SQUAD ) && !InSquad() )
    {
        if ( !FStringNull( pev->netname ) )
        {
            // if I have a groupname, I can only recruit if I'm flagged as leader
            if ( !( pev->spawnflags & SF_SQUADMONSTER_LEADER ) )
            {
                return;
            }
        }

        // try to form squads now.
        int iSquadSize = SquadRecruit( 1024, 4 );

        if ( iSquadSize )
        {
            ALERT ( at_aiconsole, "Squad of %d %s formed\n", iSquadSize, STRING( pev->classname ) );
        }

        if ( IsLeader() && FClassnameIs ( pev, "monster_human_grunt" ) )
        {
            SetBodygroup( 1, 1 ); // UNDONE: truly ugly hack
            pev->skin = 0;
        }

    }
}
开发者ID:jlecorre,项目名称:hlinvasion,代码行数:34,代码来源:squadmonster.cpp

示例14: SetBodygroup

void CObjectTeleporter::ShowDirectionArrow( bool bShow )
{
	if ( bShow != m_bShowDirectionArrow )
	{
		if ( m_iDirectionBodygroup >= 0 )
		{
			SetBodygroup( m_iDirectionBodygroup, bShow ? 1 : 0 );
		}
			
		m_bShowDirectionArrow = bShow;

		if ( bShow )
		{
			CObjectTeleporter *pMatch = GetMatchingTeleporter();

			Assert( pMatch );

			Vector vecToOwner = pMatch->GetAbsOrigin() - GetAbsOrigin();
			QAngle angleToExit;
			VectorAngles( vecToOwner, Vector(0,0,1), angleToExit );
			angleToExit -= GetAbsAngles();

			// pose param is flipped and backwards, adjust.
			m_flYawToExit = anglemod( -angleToExit.y + 180 );
		}
	}
}
开发者ID:hitmen047,项目名称:TF2HLCoop,代码行数:27,代码来源:tf_obj_teleporter.cpp

示例15: Precache

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

	SetModel( "models/hl1bar.mdl");

	SetRenderColor( 255, 255, 255, 255 );
	
	SetHullType(HULL_HUMAN);
	SetHullSizeNormal();

	SetSolid( SOLID_BBOX );
	AddSolidFlags( FSOLID_NOT_STANDABLE );
	SetMoveType( MOVETYPE_STEP );
	m_bloodColor		= BLOOD_COLOR_RED;
	m_iHealth			= sk_barneyhl1_health.GetFloat();
	SetViewOffset( Vector ( 0, 0, 100 ) );// position of the eyes relative to monster's origin.
	m_flFieldOfView		= VIEW_FIELD_WIDE; // NOTE: we need a wide field of view so npc will notice player and say hello
	m_NPCState			= NPC_STATE_NONE;

	SetBodygroup( 1, 0 );

	m_fGunDrawn			= false;

	CapabilitiesClear();
	CapabilitiesAdd( bits_CAP_MOVE_GROUND | bits_CAP_OPEN_DOORS | bits_CAP_AUTO_DOORS | bits_CAP_USE | bits_CAP_DOORS_GROUP);
	CapabilitiesAdd( bits_CAP_INNATE_RANGE_ATTACK1 | bits_CAP_TURN_HEAD | bits_CAP_ANIMATEDFACE );
	
	NPCInit();
	
	SetUse( &CNPC_HL1Barney::FollowerUse );
}
开发者ID:hitmen047,项目名称:TF2HLCoop,代码行数:35,代码来源:hl1_npc_barney.cpp


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