本文整理汇总了C++中CCSPlayer::GetAbsOrigin方法的典型用法代码示例。如果您正苦于以下问题:C++ CCSPlayer::GetAbsOrigin方法的具体用法?C++ CCSPlayer::GetAbsOrigin怎么用?C++ CCSPlayer::GetAbsOrigin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCSPlayer
的用法示例。
在下文中一共展示了CCSPlayer::GetAbsOrigin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void CC4::PlayArmingBeeps( void )
{
float flStartTime = m_fArmedTime - WEAPON_C4_ARM_TIME;
float flProgress = ( gpGlobals->curtime - flStartTime ) / ( WEAPON_C4_ARM_TIME - 0.75 );
int currentFrame = (int)( (float)iNumArmingAnimFrames * flProgress );
int i;
for( i=0;i<NUM_BEEPS;i++ )
{
if( currentFrame <= m_iBeepFrames[i] )
{
break;
}
else if( !m_bPlayedArmingBeeps[i] )
{
m_bPlayedArmingBeeps[i] = true;
CCSPlayer *owner = GetPlayerOwner();
Vector soundPosition = owner->GetAbsOrigin() + Vector( 0, 0, 5 );
CPASAttenuationFilter filter( soundPosition );
filter.RemoveRecipient( owner );
// remove anyone that is first person spec'ing the planter
int i;
CBasePlayer *pPlayer;
for( i=1;i<=gpGlobals->maxClients;i++ )
{
pPlayer = UTIL_PlayerByIndex( i );
if ( !pPlayer )
continue;
if( pPlayer->GetObserverMode() == OBS_MODE_IN_EYE && pPlayer->GetObserverTarget() == GetOwner() )
{
filter.RemoveRecipient( pPlayer );
}
}
EmitSound(filter, entindex(), "c4.click");
break;
}
}
}
示例2: if
//.........这里部分代码省略.........
return;
}
else
{
if( gpGlobals->curtime >= m_fArmedTime ) //the c4 is ready to be armed
{
//check to make sure the player is still in the bomb target area
PlaceBomb = true;
}
else if( ( gpGlobals->curtime >= (m_fArmedTime - 0.75) ) && ( !m_bBombPlacedAnimation ) )
{
//call the c4 Placement animation
m_bBombPlacedAnimation = true;
//SendWeaponAnim( C4_DROP, UseDecrement() ? 1: 0 );
#if !defined( CLIENT_DLL )
// player "place" animation
//pPlayer->SetAnimation( PLAYER_HOLDBOMB );
#endif
}
}
}
if ( PlaceBomb && m_bStartedArming )
{
m_bStartedArming = false;
m_fArmedTime = 0;
if( pPlayer->m_bInBombZone )
{
#if !defined( CLIENT_DLL )
//Broadcast("BOMBPL");
CPlantedC4::ShootSatchelCharge( pPlayer, pPlayer->GetAbsOrigin(), QAngle(0,0,0) );
// send director message, that something important happened here
/*
MESSAGE_BEGIN( MSG_SPEC, SVC_DIRECTOR );
WRITE_BYTE ( 9 ); // command length in bytes
WRITE_BYTE ( DRC_CMD_EVENT ); // bomb placed
WRITE_SHORT( ENTINDEX(pPlayer->edict()) );
WRITE_SHORT( 0 );
WRITE_LONG( 11 | DRC_FLAG_FACEPLAYER ); // eventflags (priority and flags)
MESSAGE_END();
*/
// tell the Ts the bomb has been planted (on radar)
CTeam *pTeam = GetGlobalTeam( TEAM_TERRORIST );
for ( int iPlayer=0; iPlayer < pTeam->GetNumPlayers(); iPlayer++ )
{
CBasePlayer *pTempPlayer = pTeam->GetPlayer( iPlayer );
if ( pTempPlayer->m_lifeState != LIFE_DEAD )
{
/*
MESSAGE_BEGIN( MSG_ONE, gmsgBombDrop, NULL, pTempPlayer->pev );
WRITE_COORD( pBomb->pev->origin.x );
WRITE_COORD( pBomb->pev->origin.y );
WRITE_COORD( pBomb->pev->origin.z );
WRITE_BYTE( 1 ); // bomb was planted
MESSAGE_END();
*/
}
}
UTIL_ClientPrintAll( HUD_PRINTCENTER,"#Bomb_Planted" );
示例3: filter
// For CTs to defuse the c4
void CPlantedC4::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
//Can't defuse if its already defused or if it has blown up
if( !m_bBombTicking )
{
SetUse( NULL );
return;
}
CCSPlayer *player = dynamic_cast< CCSPlayer* >( pActivator );
if ( !player || player->GetTeamNumber() != TEAM_CT )
return;
if ( m_bStartDefuse )
{
if ( player != m_pBombDefuser )
{
if ( player->m_iNextTimeCheck < gpGlobals->curtime )
{
ClientPrint( player, HUD_PRINTCENTER, "#Bomb_Already_Being_Defused" );
player->m_iNextTimeCheck = gpGlobals->curtime + 1;
}
return;
}
m_flNextDefuse = gpGlobals->curtime + 0.5;
}
else
{
// freeze the player in place while defusing
player->SetMaxSpeed( 1 );
IGameEvent * event = gameeventmanager->CreateEvent("bomb_begindefuse" );
if( event )
{
event->SetInt( "userid", player->GetUserID() );
if ( player->HasDefuser() )
{
event->SetInt( "haskit", 1 );
// TODO show messages on clients on event
ClientPrint( player, HUD_PRINTCENTER, "#Defusing_Bomb_With_Defuse_Kit" );
}
else
{
event->SetInt( "haskit", 0 );
// TODO show messages on clients on event
ClientPrint( player, HUD_PRINTCENTER, "#Defusing_Bomb_Without_Defuse_Kit" );
}
event->SetInt( "priority", 8 );
gameeventmanager->FireEvent( event );
}
Vector soundPosition = player->GetAbsOrigin() + Vector( 0, 0, 5 );
CPASAttenuationFilter filter( soundPosition );
EmitSound( filter, entindex(), "c4.disarmstart" );
m_flDefuseLength = player->HasDefuser() ? 5 : 10;
m_flNextDefuse = gpGlobals->curtime + 0.5;
m_pBombDefuser = player;
m_bStartDefuse = TRUE;
player->m_bIsDefusing = true;
m_flDefuseCountDown = gpGlobals->curtime + m_flDefuseLength;
//start the progress bar
player->SetProgressBarTime( m_flDefuseLength );
}
}