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


C++ CHL2_Player类代码示例

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


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

示例1: AddEffects

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPlayer_Control::ControlActivate( void )
{
	m_bActive			= true;
	AddEffects( EF_NODRAW );
	m_nPClipTraceDir	= PC_TRACE_LAST;
	m_flCurrMinClipDist = PCONTROL_CLIP_DIST;

	SetNextThink( gpGlobals->curtime );

	CHL2_Player*	pPlayer		= (CHL2_Player*)UTIL_GetLocalPlayer();

	Assert( pPlayer );

	// Save Data
	m_nSaveFOV			= pPlayer->GetFOV();
	m_vSaveOrigin		= pPlayer->GetLocalOrigin();
	m_vSaveAngles		= pPlayer->pl.v_angle.Get();				//TGB: 0000069 spectator first person fix (not really necessary but tidier)
	m_nSaveMoveType		= pPlayer->GetMoveType();
	m_nSaveMoveCollide	= pPlayer->GetMoveCollide();
	m_vSaveViewOffset	= pPlayer->GetViewOffset();
	m_pSaveWeapon		= pPlayer->GetActiveWeapon();

	pPlayer->AddSolidFlags( FSOLID_NOT_SOLID );
	pPlayer->SetLocalOrigin( GetLocalOrigin() );
	pPlayer->pl.v_angle.GetForModify()	= GetLocalAngles();			//TGB: 0000069 spectator first person fix (see above)
	pPlayer->SetViewOffset( vec3_origin );

	DispatchUpdateTransmitState();
}
开发者ID:TotallyMehis,项目名称:ZM-Updated,代码行数:32,代码来源:player_control.cpp

示例2: UTIL_GetLocalPlayer

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : &inputdata - 
//-----------------------------------------------------------------------------
void CEnvZoom::InputZoom( inputdata_t &inputdata )
{
	CBasePlayer *pPlayer = UTIL_GetLocalPlayer();

	if ( pPlayer )
	{

#ifdef HL2_DLL
		if ( pPlayer == pPlayer->GetFOVOwner() )
		{
			CHL2_Player *pHLPlayer = static_cast<CHL2_Player*>( pPlayer );

			pHLPlayer->StopZooming();
		}
#endif

		// If the player's already holding a fov from another env_zoom, we're allowed to overwrite it
		if ( pPlayer->GetFOVOwner() && FClassnameIs( pPlayer->GetFOVOwner(), "env_zoom" ) )
		{
			pPlayer->ClearZoomOwner();
		}

		//Stuff the values
		pPlayer->SetFOV( this, m_nFOV, m_flSpeed );
	}
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:30,代码来源:env_zoom.cpp

示例3: defined

//-----------------------------------------------------------------------------
// Purpose: 
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CBaseHLCombatWeapon::Deploy( void )
{
	// If we should be lowered, deploy in the lowered position
	// We have to ask the player if the last time it checked, the weapon was lowered
#if defined( HL2_DLL ) || defined( HL2_CLIENT_DLL )
	if ( GetOwner() && GetOwner()->IsPlayer() )
	{
		CHL2_Player *pPlayer = assert_cast<CHL2_Player*>( GetOwner() );
		if ( pPlayer->IsWeaponLowered() )
		{
			if ( SelectWeightedSequence( ACT_VM_IDLE_LOWERED ) != ACTIVITY_NOT_AVAILABLE )
			{
				if ( DefaultDeploy( (char*)GetViewModel(), (char*)GetWorldModel(), ACT_VM_IDLE_LOWERED, (char*)GetAnimPrefix() ) )
				{
					m_bLowered = true;

					// Stomp the next attack time to fix the fact that the lower idles are long
					pPlayer->SetNextAttack( gpGlobals->curtime + 1.0 );
					m_flNextPrimaryAttack = gpGlobals->curtime + 1.0;
					m_flNextSecondaryAttack	= gpGlobals->curtime + 1.0;
					return true;
				}
			}
		}
	}
#endif

	m_bLowered = false;
	return BaseClass::Deploy();
}
开发者ID:hitmen047,项目名称:TF2HLCoop,代码行数:34,代码来源:basehlcombatweapon_shared.cpp

示例4: RemoveEffects

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPlayer_Control::ControlDeactivate( void )
{
	m_bActive = false;
	RemoveEffects( EF_NODRAW );

	SetThink(NULL);
	SetTouch(NULL);

	CHL2_Player*	pPlayer  = (CHL2_Player*)UTIL_GetLocalPlayer();

	Assert( pPlayer );
	
	// Restore Data
	pPlayer->SetFOV( this, m_nSaveFOV );
	pPlayer->RemoveSolidFlags( FSOLID_NOT_SOLID );
	pPlayer->SetLocalOrigin( m_vSaveOrigin );
	pPlayer->SetLocalAngles( m_vSaveAngles );	// Note: Set GetLocalAngles(), not pl->v_angle
	pPlayer->SnapEyeAngles( m_vSaveAngles );
	pPlayer->StopFollowingEntity();
	pPlayer->SetMoveType( m_nSaveMoveType, m_nSaveMoveCollide );
	pPlayer->SetViewOffset( m_vSaveViewOffset );
	pPlayer->SetControlClass( CLASS_NONE );

	DispatchUpdateTransmitState();
}
开发者ID:TotallyMehis,项目名称:ZM-Updated,代码行数:28,代码来源:player_control.cpp

示例5: GetLocalOrigin

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPlayer_Missile::InputActivate( inputdata_t &inputdata )
{
	// Make sure not already active
	if (m_bActive)
	{
		return;
	}

	BaseClass::InputActivate( inputdata );

	Vector origin = GetLocalOrigin();
	origin.z	+= 50;
	SetLocalOrigin( origin );
	RemoveSolidFlags( FSOLID_NOT_SOLID );
	Relink();

	// Using player angles to determine turning.  Initailze to 0,0,0
	CHL2_Player*	pPlayer		= (CHL2_Player*)UTIL_PlayerByIndex( 1 );

	Assert( pPlayer );

	pPlayer->SetLocalAngles( vec3_angle );	// Note: Set GetLocalAngles(), not pl.v_angle
	pPlayer->SnapEyeAngles( vec3_angle );				// Force reset
	pPlayer->SetFOV( 100 );

	engine->SetView( pPlayer->edict(), edict() );

	m_flStatic					= 0;
	SetThink(Launch);
	SetNextThink( gpGlobals->curtime + m_flLaunchDelay );
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:34,代码来源:player_missile.cpp

示例6: UTIL_GetNearestPlayer

bool CNPC_Zombine::AllowedToSprint( void )
{
	if ( IsOnFire() )
		return false;
	
	//If you're sprinting then there's no reason to sprint again.
	if ( IsSprinting() )
		return false;

	int iChance = SPRINT_CHANCE_VALUE;

	//Secobmod FixMe ?? also changed to HL2MPRules
	CHL2_Player *pPlayer = dynamic_cast <CHL2_Player*> ( UTIL_GetNearestPlayer(GetAbsOrigin() ));
	//CHL2MP_Player *pPlayer = dynamic_cast<CHL2MP_Player *>( UTIL_GetNearestPlayer(GetAbsOrigin() );

	if ( pPlayer )
	{
#ifdef MFS
		if ( HL2MPRules()->IsAlyxInDarknessMode() && pPlayer->FlashlightIsOn() == false )
#else
		if (IsAlyxInDarknessMode() && pPlayer->FlashlightIsOn() == false)
#endif
		{
			iChance = SPRINT_CHANCE_VALUE_DARKNESS;
		}

		//Bigger chance of this happening if the player is not looking at the zombie
		if ( pPlayer->FInViewCone( this ) == false )
		{
			iChance *= 2;
		}
	}

	if ( HasGrenade() ) 
	{
		iChance *= 4;
	}

	//Below 25% health they'll always sprint
	if ( ( GetHealth() > GetMaxHealth() * 0.5f ) )
	{
		if ( IsStrategySlotRangeOccupied( SQUAD_SLOT_ZOMBINE_SPRINT1, SQUAD_SLOT_ZOMBINE_SPRINT2 ) == true )
			return false;
		
		if ( random->RandomInt( 0, 100 ) > iChance )
			return false;
		
		if ( m_flSprintRestTime > gpGlobals->curtime )
			return false;
	}

	float flLength = ( GetEnemy()->WorldSpaceCenter() - WorldSpaceCenter() ).Length();

	if ( flLength > MAX_SPRINT_DISTANCE )
		return false;

	return true;
}
开发者ID:WorldGamers,项目名称:Mobile-Forces-Source,代码行数:58,代码来源:npc_zombine.cpp

示例7: GetHL2Player

//-----------------------------------------------------------------------------
// Purpose: 
// Output : inline LadderMove*
//-----------------------------------------------------------------------------
inline LadderMove_t *CHL2GameMovement::GetLadderMove()
{
	CHL2_Player *p = GetHL2Player();
	if ( !p )
	{
		return NULL;
	}
	return p->GetLadderMove();
}
开发者ID:paralin,项目名称:hl2sdk,代码行数:13,代码来源:hl_gamemovement.cpp

示例8: ClientActive

void ClientActive( edict_t *pEdict, bool bLoadGame )
{
	CHL2_Player *pPlayer = dynamic_cast< CHL2_Player* >( CBaseEntity::Instance( pEdict ) );
	Assert( pPlayer );

	if ( !pPlayer )
	{
		return;
	}

	pPlayer->InitialSpawn();

	if ( !bLoadGame )
	{
		pPlayer->Spawn();
	}
}
开发者ID:SizzlingStats,项目名称:hl2sdk-ob-valve,代码行数:17,代码来源:hl2_client.cpp

示例9: ToBasePlayer

//-----------------------------------------------------------------------------
// Purpose: Allows the weapon to choose proper weapon idle animation
//-----------------------------------------------------------------------------
void CBaseHLCombatWeapon::WeaponIdle( void )
{
	CBasePlayer *pPlayer = ToBasePlayer(GetOwner());
	if ( pPlayer )
	{
		if ( pPlayer->m_bIsRunning || !pPlayer->GetGroundEntity() || pPlayer->m_bShouldLowerWeapon )
			return;
	}

	//See if we should idle high or low
	if ( WeaponShouldBeLowered() )
	{
#if !defined( CLIENT_DLL )
		CHL2_Player *pPlayer = dynamic_cast<CHL2_Player*>(GetOwner());

		if( pPlayer )
		{
			pPlayer->Weapon_Lower();
		}
#endif

		// Move to lowered position if we're not there yet
		if ( GetActivity() != ACT_VM_IDLE_LOWERED && GetActivity() != ACT_VM_IDLE_TO_LOWERED 
			 && GetActivity() != ACT_TRANSITION )
		{
			SendWeaponAnim( ACT_VM_IDLE_LOWERED );
		}
		else if ( HasWeaponIdleTimeElapsed() )
		{
			// Keep idling low
			SendWeaponAnim( ACT_VM_IDLE_LOWERED );
		}
	}
	else
	{
		// See if we need to raise immediately
		if ( m_flRaiseTime < gpGlobals->curtime && GetActivity() == ACT_VM_IDLE_LOWERED ) 
		{
			SendWeaponAnim( ACT_VM_IDLE );
		}
		else if ( HasWeaponIdleTimeElapsed() ) 
		{
			SendWeaponAnim( ACT_VM_IDLE );
		}
	}
}
开发者ID:BerntA,项目名称:tfo-code,代码行数:49,代码来源:basehlcombatweapon_shared.cpp

示例10: ControlDeactivate

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPlayer_Missile::ControlDeactivate( void )
{
	BaseClass::ControlDeactivate();

	CHL2_Player*	pPlayer		= (CHL2_Player*)UTIL_PlayerByIndex( 1 );

	Assert( pPlayer );

	engine->SetView( pPlayer->edict(), pPlayer->edict() );

	pPlayer->m_Local.m_iHideHUD &= ~HIDEHUD_WEAPONS;

	SetAbsVelocity( vec3_origin );
	SetLocalAngles( m_vSpawnAng );
	SetLocalOrigin( m_vSpawnPos );
	m_fEffects		|= EF_NODRAW;
	Relink();
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:21,代码来源:player_missile.cpp

示例11: SetupMove

void CHLPlayerMove::SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, CMoveData *move )
{
	// Call the default SetupMove code.
	BaseClass::SetupMove( player, ucmd, pHelper, move );

	// Convert to HL2 data.
	CHL2_Player *pHLPlayer = static_cast<CHL2_Player*>( player );
	Assert( pHLPlayer );

	CHLMoveData *pHLMove = static_cast<CHLMoveData*>( move );
	Assert( pHLMove );

	player->m_flForwardMove = ucmd->forwardmove;
	player->m_flSideMove = ucmd->sidemove;

	pHLMove->m_bIsSprinting = pHLPlayer->IsSprinting();

	if ( gpGlobals->frametime != 0 )
	{
		IServerVehicle *pVehicle = player->GetVehicle();

		if ( pVehicle )
		{
			pVehicle->SetupMove( player, ucmd, pHelper, move ); 

			if ( !m_bWasInVehicle )
			{
				m_bWasInVehicle = true;
				m_vecSaveOrigin.Init();
			}
		}
		else
		{
			m_vecSaveOrigin = player->GetAbsOrigin();
			if ( m_bWasInVehicle )
			{
				m_bWasInVehicle = false;
			}
		}
	}
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:41,代码来源:hl_playermove.cpp

示例12: ClientPutInServer

/*
===========
ClientPutInServer

called each time a player is spawned into the game
============
*/
void ClientPutInServer( edict_t *pEdict, const char *playername )
{
	// Allocate a CBasePlayer for pev, and call spawn
	CHL2_Player *pPlayer = CHL2_Player::CreatePlayer( "player", pEdict );
	pPlayer->SetPlayerName( playername );
}
开发者ID:SizzlingStats,项目名称:hl2sdk-ob-valve,代码行数:13,代码来源:hl2_client.cpp


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