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


C++ CClientPlayer::GetStatusIcon方法代码示例

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


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

示例1: DrawDefault

void CNametags::DrawDefault ( void )
{
    // Grab the resolution width and height
    static float fResWidth = static_cast < float > ( g_pCore->GetGraphics ()->GetViewportWidth () );
    static float fResHeight = static_cast < float > ( g_pCore->GetGraphics ()->GetViewportHeight () );
        
    // Got any players that are not local?
    if ( m_pPlayerManager->Count () <= 1 ) return;

    list < CClientPlayer * > playerTags;

    // Grab the local player
    CClientPlayer* pLocalPlayer = m_pPlayerManager->GetLocalPlayer ();
    if ( !pLocalPlayer ) return;

    CClientVehicle* pSniperTargetedVehicle = NULL;
    CClientPlayer* pSniperTargetedPlayer = NULL;

    // Grab our current weapon slot. Use screen center if melee or none                
    eWeaponSlot eSlot = pLocalPlayer->GetCurrentWeaponSlot ();
    if ( eSlot >= WEAPONSLOT_TYPE_HANDGUN && eSlot <= WEAPONSLOT_TYPE_RIFLE )
    {
        CVector vecOrigin, vecTarget;
        pLocalPlayer->GetShotData ( &vecOrigin, &vecTarget ); 

        // Ignore the local player for this
        pLocalPlayer->WorldIgnore ( true );

        // Do the raycast
        CColPoint* pColPoint = NULL;
        CEntity* pEntity = NULL;
        g_pGame->GetWorld ()->ProcessLineOfSight ( &vecOrigin, &vecTarget, &pColPoint, &pEntity, true, true, true, true, true, true, false, true );
        if ( pColPoint ) pColPoint->Destroy ();

        // Un-ignore the local player
        pLocalPlayer->WorldIgnore ( false );
        

        // Did we find an entity?
        if ( pEntity )
        {
            // Grab the CClientEntity belonging to this game_sa entity
            CClientEntity* pClientEntity = reinterpret_cast < CClientEntity* > ( pEntity->GetStoredPointer () );
            if ( pClientEntity )
            {
                // Is it a vehicle? Is it a ped?
                eClientEntityType EntityType = pClientEntity->GetType ();
                switch ( EntityType )
                {
                    case CCLIENTVEHICLE:
                    {
                        pSniperTargetedVehicle = static_cast < CClientVehicle* > ( pClientEntity );
                        break;
                    }
                    case CCLIENTPLAYER:
                    {
                        pSniperTargetedPlayer = static_cast < CClientPlayer* > ( pClientEntity );
                        break;
                    }
                    default: break;
                }
            }
        }
    }

    // Grab the local player vehicle
    CClientVehicle* pLocalVehicle = pLocalPlayer->GetOccupiedVehicle ();
    CVehicle * pLocalGameVehicle = NULL;
    if ( pLocalVehicle ) pLocalGameVehicle = pLocalVehicle->GetGameVehicle ();

    CMatrix CameraMatrix;
    g_pGame->GetCamera ()->GetMatrix ( &CameraMatrix );

    // Remove collision from our local vehicle (if we have one)
    if ( pLocalVehicle ) pLocalVehicle->WorldIgnore ( true );

    // Draw the nametags we need to
    CVector vecPlayerPosition;
    CClientVehicle * pPlayerVehicle = NULL;
    float fDistanceExp;
    bool bCollision;
    CColPoint * pColPoint = NULL;
    CEntity * pGameEntity = NULL;
    CClientEntity * pEntity = NULL;
    CClientPlayer* pPlayer;
    CClientStreamElement * pElement;
    list < CClientStreamElement* > ::const_iterator iter = m_pPlayerStreamer->ActiveElementsBegin ();
    for ( ; iter != m_pPlayerStreamer->ActiveElementsEnd (); iter++ )
    {
        pElement = *iter;
        if ( !pElement->IsStreamedIn () ) continue;
        if ( pElement->GetType () != CCLIENTPLAYER ) continue;
        pPlayer = static_cast < CClientPlayer * > ( pElement );
        if ( pPlayer->IsLocalPlayer () ) continue;

        if ( pPlayer->GetStatusIcon ()->IsVisible () )
            pPlayer->GetStatusIcon ()->SetVisible ( false );

        // Get the distance from the camera
        pPlayer->GetPosition ( vecPlayerPosition );
//.........这里部分代码省略.........
开发者ID:AdiBoy,项目名称:multitheftauto,代码行数:101,代码来源:CNametags.cpp


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