本文整理汇总了C++中CHandle::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ CHandle::Get方法的具体用法?C++ CHandle::Get怎么用?C++ CHandle::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHandle
的用法示例。
在下文中一共展示了CHandle::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetSkyCameraList
//-----------------------------------------------------------------------------
// Retrives the current skycamera
//-----------------------------------------------------------------------------
CSkyCamera* GetCurrentSkyCamera()
{
if (g_hActiveSkybox.Get() == NULL)
{
g_hActiveSkybox = GetSkyCameraList();
}
return g_hActiveSkybox.Get();
}
示例2: Deactivate
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CGameUI::Deactivate( CBaseEntity *pActivator )
{
CBasePlayer *pPlayer = m_player;
AssertMsg(pPlayer, "CGameUI deactivated without a player!");
if (pPlayer)
{
// Re-enable player motion
if ( FBitSet( m_spawnflags, SF_GAMEUI_FREEZE_PLAYER ) )
{
m_player->RemoveFlag( FL_ATCONTROLS );
}
// Restore weapons
if ( FBitSet( m_spawnflags, SF_GAMEUI_HIDE_WEAPON ) )
{
// Turn the hud back on
pPlayer->m_Local.m_iHideHUD &= ~HIDEHUD_WEAPONSELECTION;
if ( m_hSaveWeapon.Get() )
{
m_player->Weapon_Switch( m_hSaveWeapon.Get() );
m_hSaveWeapon = NULL;
}
if ( pPlayer->GetActiveWeapon() )
{
pPlayer->GetActiveWeapon()->Deploy();
}
}
// Announce that the player is no longer controlling through us
m_playerOff.FireOutput( pPlayer, this, 0 );
// Clear out the axis controls
m_xaxis.Set( 0, pPlayer, this );
m_yaxis.Set( 0, pPlayer, this );
m_attackaxis.Set( 0, pPlayer, this );
m_attack2axis.Set( 0, pPlayer, this );
m_nLastButtonState = 0;
m_player = NULL;
}
else
{
Warning("%s Deactivate(): I have no player when called by %s!\n", GetEntityName().ToCStr(), pActivator->GetEntityName().ToCStr());
}
// Stop thinking
SetNextThink( TICK_NEVER_THINK );
}
示例3:
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
C_BaseCombatCharacter *C_PropCannon::GetPassenger( int nRole )
{
if ( nRole == VEHICLE_ROLE_DRIVER )
return m_hPlayer.Get();
return NULL;
}
示例4: ConstrainThink
//-----------------------------------------------------------------------------
// Purpose: Check to see if our target has moved beyond our length
//-----------------------------------------------------------------------------
void CHarpoon::ConstrainThink( void )
{
if ( !GetImpaledTarget() || !m_hLinkedHarpoon.Get() )
return;
// Moved too far away?
float flDistSq = m_hLinkedHarpoon->GetAbsOrigin().DistToSqr( GetImpaledTarget()->GetAbsOrigin() );
if ( flDistSq > m_flConstrainLength )
{
// Break the rope
if ( m_hRope )
{
m_hRope->DetachPoint(1);
m_hRope->DieAtNextRest();
m_hRope = NULL;
}
// If we're impaling a player, remove his movement constraint
if ( GetImpaledTarget()->IsPlayer() )
{
CBaseTFPlayer *pPlayer = (CBaseTFPlayer *)GetImpaledTarget();
pPlayer->DeactivateMovementConstraint();
}
SetThink( NULL );
}
else
{
SetNextThink( gpGlobals->curtime + 0.1f );
}
}
示例5:
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
C_BaseCombatCharacter *C_PropVehiclePrisonerPod::GetPassenger( int nRole )
{
if ( nRole == VEHICLE_ROLE_DRIVER )
return m_hPlayer.Get();
return NULL;
}
示例6: FindByRandom
void CPointEntityFinder::FindByRandom( void )
{
// TODO: optimize the case where there is no filter
m_hEntity = NULL;
CBaseFilter *pFilter = m_hFilter.Get();
CUtlVector<CBaseEntity *> ValidEnts;
CBaseEntity *pEntity = gEntList.FirstEnt();
do // note all valid entities.
{
if ( pFilter && pFilter->PassesFilter( this, pEntity ) )
{
ValidEnts.AddToTail( pEntity );
}
pEntity = gEntList.NextEnt( pEntity );
} while ( pEntity );
// pick one at random
if ( ValidEnts.Count() != 0 )
{
m_hEntity = ValidEnts[ RandomInt( 0, ValidEnts.Count() - 1 )];
}
}
示例7:
int C_QUA_Strider::GetPassengerRole( C_BaseCombatCharacter *pEnt )
{
if (m_hPlayer.Get() == pEnt)
{
return VEHICLE_ROLE_DRIVER;
}
return -1;
}
示例8: Deactivate
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CGameUI::Deactivate( CBaseEntity *pActivator )
{
CBasePlayer *pPlayer = m_player;
// If deactivated by the player using me
if ( pPlayer == pActivator )
{
// Re-enable player motion
if (FBitSet(m_spawnflags, SF_GAMEUI_FREEZE_PLAYER))
{
m_player->RemoveFlag( FL_ATCONTROLS );
}
// Restore weapons
if (FBitSet(m_spawnflags, SF_GAMEUI_HIDE_WEAPON))
{
// Turn the hud back on
pPlayer->m_Local.m_iHideHUD &= ~HIDEHUD_WEAPONS;
if (m_hSaveWeapon.Get())
{
m_player->Weapon_Switch( m_hSaveWeapon.Get() );
m_hSaveWeapon = NULL;
}
if ( pPlayer->GetActiveWeapon() )
{
pPlayer->GetActiveWeapon()->Deploy();
}
}
m_playerOff.FireOutput( pPlayer, this, 0 );
// clear out the axis controls
m_xaxis.Set( 0, pPlayer, this );
m_yaxis.Set( 0, pPlayer, this );
m_attackaxis.Set( 0, pPlayer, this );
m_attack2axis.Set( 0, pPlayer, this );
m_player = NULL;
SetNextThink( TICK_NEVER_THINK );
}
}
示例9: EntityPassesFilter
bool CFuncVPhysicsClip::EntityPassesFilter( CBaseEntity *pOther )
{
CBaseFilter* pFilter = (CBaseFilter*)(m_hFilter.Get());
if ( pFilter )
return pFilter->PassesFilter( this, pOther );
if ( pOther->GetMoveType() == MOVETYPE_VPHYSICS && pOther->VPhysicsGetObject()->IsMoveable() )
return true;
return false;
}
示例10: CheckTouching
bool CPhysicsNPCSolver::CheckTouching()
{
CAI_BaseNPC *pNPC = m_hNPC.Get();
if ( !pNPC )
return false;
CBaseEntity *pPhysicsEnt = m_hEntity.Get();
if ( !pPhysicsEnt )
return false;
IPhysicsObject *pPhysics = pPhysicsEnt->VPhysicsGetObject();
IPhysicsObject *pNPCPhysics = pNPC->VPhysicsGetObject();
if ( !pNPCPhysics || !pPhysics )
return false;
IPhysicsFrictionSnapshot *pSnapshot = pPhysics->CreateFrictionSnapshot();
bool found = false;
bool penetrate = false;
while ( pSnapshot->IsValid() )
{
IPhysicsObject *pOther = pSnapshot->GetObject(1);
if ( pOther == pNPCPhysics )
{
found = true;
if ( IsContactOnNPCHead(pSnapshot, pPhysics, pNPC ) )
{
penetrate = true;
pSnapshot->MarkContactForDelete();
}
break;
}
pSnapshot->NextFrictionData();
}
pSnapshot->DeleteAllMarkedContacts( true );
pPhysics->DestroyFrictionSnapshot( pSnapshot );
// if the object is penetrating something, check to see if it's intersecting this NPC
// if so, go ahead and switch over to penetration solver mode
if ( !penetrate && (pPhysics->GetGameFlags() & FVPHYSICS_PENETRATING) )
{
penetrate = IsIntersecting();
}
if ( penetrate )
{
pPhysicsEnt->ClearNavIgnore();
BecomePenetrationSolver();
}
return found;
}
示例11: InputActivate
//------------------------------------------------------------------------------
// Purpose :
//------------------------------------------------------------------------------
void CGameUI::InputActivate( inputdata_t &inputdata )
{
// If already in use, ignore activatation by others
if (( m_player.Get() != NULL ) && ( m_player.Get() != inputdata.pActivator ))
{
return;
}
if ( inputdata.pActivator && inputdata.pActivator->IsPlayer() )
{
m_player = (CBasePlayer *)inputdata.pActivator;
m_playerOn.FireOutput( inputdata.pActivator, this, 0 );
// Turn the hud off
SetNextThink( gpGlobals->curtime );
// Disable player motion
if (FBitSet(m_spawnflags, SF_GAMEUI_FREEZE_PLAYER))
{
m_player->AddFlag( FL_ATCONTROLS );
}
if (FBitSet(m_spawnflags, SF_GAMEUI_HIDE_WEAPON))
{
m_player->m_Local.m_iHideHUD |= HIDEHUD_WEAPONS;
if ( m_player->GetActiveWeapon() )
{
m_hSaveWeapon = m_player->GetActiveWeapon();
m_player->GetActiveWeapon()->Holster();
m_player->ClearActiveWeapon();
m_player->HideViewModels();
}
}
}
m_bForceUpdate = true;
}
示例12: FinishAct
//-----------------------------------------------------------------------------
// Purpose: The act has finished
//-----------------------------------------------------------------------------
void CInfoAct::FinishAct( )
{
if ( g_hCurrentAct.Get() != this )
{
DevWarning( 2, "Attempted to finish an act which wasn't started!\n" );
return;
}
ShutdownRespawnTimers();
switch( m_iWinners)
{
case 0:
m_OnFinishedTeamNone.FireOutput( this, this );
break;
case 1:
m_OnFinishedTeam1.FireOutput( this, this );
break;
case 2:
m_OnFinishedTeam2.FireOutput( this, this );
break;
default:
Assert(0);
break;
}
g_hCurrentAct = NULL;
// Tell all the clients
CRelieableBroadcastRecipientFilter filter;
UserMessageBegin( filter, "ActEnd" );
WRITE_BYTE( m_iWinners );
MessageEnd();
// Am I an intermission?
if ( HasSpawnFlags( SF_ACT_INTERMISSION ) )
{
// Cycle through all players and end the intermission for them
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CBaseTFPlayer *pPlayer = (CBaseTFPlayer*)UTIL_PlayerByIndex( i );
if ( pPlayer )
{
EndIntermission( pPlayer );
}
}
}
}
示例13: CreateEfficientSpotlight
//-----------------------------------------------------------------------------
// Creates the efficient spotlight
//-----------------------------------------------------------------------------
void CPointSpotlight::CreateEfficientSpotlight()
{
if ( m_hSpotlightTarget.Get() != NULL )
return;
SpotlightCreate();
m_vSpotlightCurrentPos = SpotlightCurrentPos();
m_hSpotlightTarget->SetAbsOrigin( m_vSpotlightCurrentPos );
m_hSpotlightTarget->m_vSpotlightOrg = GetAbsOrigin();
VectorSubtract( m_hSpotlightTarget->GetAbsOrigin(), m_hSpotlightTarget->m_vSpotlightOrg, m_hSpotlightTarget->m_vSpotlightDir );
m_flSpotlightCurLength = VectorNormalize( m_hSpotlightTarget->m_vSpotlightDir );
m_hSpotlightTarget->SetMoveType( MOVETYPE_NONE );
ComputeRenderInfo();
}
示例14: SetOwner
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void COrder::SetOwner( CBaseTFPlayer *pPlayer )
{
// Null out our m_hOwningPlayer so we don't recurse infinitely.
CHandle<CBaseTFPlayer> hPlayer = m_hOwningPlayer;
m_hOwningPlayer = 0;
if ( hPlayer.Get() && (hPlayer != pPlayer) )
{
Assert( hPlayer->GetOrder() == this );
hPlayer->SetOrder( NULL );
}
m_hOwningPlayer = pPlayer;
}
示例15: CC_Test_EHandle
// The test runs this command.
void CC_Test_EHandle()
{
if ( g_HandleTest.Get() )
{
g_HandleTest->m_bSendHandle = !g_HandleTest->m_bSendHandle;
}
else
{
CHandleTest *pHolder = CREATE_ENTITY( CHandleTest, "handle_test" );
pHolder->m_Handle = CREATE_ENTITY( CHandleDummy, "handle_dummy" );
pHolder->Spawn();
g_HandleTest = pHolder;
Msg( "Created EHANDLE test entity. Run this command again to transmit the second ent.\n" );
}
}