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


C++ C_TFPlayer::GetObserverMode方法代码示例

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


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

示例1: ShouldDraw

bool CSpectatorTargetID::ShouldDraw( void )
{
    C_TFPlayer *pLocalTFPlayer = C_TFPlayer::GetLocalTFPlayer();
    if ( !pLocalTFPlayer )
        return false;

    if ( pLocalTFPlayer->GetObserverMode() <= OBS_MODE_NONE ||
         pLocalTFPlayer->GetObserverMode() == OBS_MODE_FREEZECAM )
        return false;

    return BaseClass::ShouldDraw();
}
开发者ID:hitmen047,项目名称:TF2HLCoop,代码行数:12,代码来源:tf_hud_target_id.cpp

示例2: DrawModel

//-----------------------------------------------------------------------------
// Purpose: Don't render the weapon if its supposed to be lowered and we have
// finished the lowering animation
//-----------------------------------------------------------------------------
int CTFViewModel::DrawModel( int flags )
{
    // Check for lowering the weapon
    C_TFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();

    Assert( pPlayer );

    bool bLowered = pPlayer->IsWeaponLowered();

    if ( bLowered && fabs( m_vLoweredWeaponOffset.x - cl_gunlowerangle.GetFloat() ) < 0.1 )
    {
        // fully lowered, stop drawing
        return 1;
    }

    C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();
    if ( pLocalPlayer && pLocalPlayer->GetObserverMode() == OBS_MODE_IN_EYE &&
            pLocalPlayer->GetObserverTarget() && pLocalPlayer->GetObserverTarget()->IsPlayer() )
    {
        pPlayer = ToTFPlayer( pLocalPlayer->GetObserverTarget() );

        if ( pPlayer != GetOwner() )
            return 0;
    }

    if ( pPlayer->IsAlive() == false )
    {
        return 0;
    }

    return BaseClass::DrawModel( flags );
}
开发者ID:MrBoomer568,项目名称:TF2Classic,代码行数:36,代码来源:tf_viewmodel.cpp

示例3: UpdateReinforcements

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFSpectatorGUI::UpdateReinforcements( void )
{
    if( !m_pReinforcementsLabel )
        return;

    C_TFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();
    if ( !pPlayer || pPlayer->IsHLTV() ||
        (pPlayer->GetTeamNumber() != TF_TEAM_RED && pPlayer->GetTeamNumber() != TF_TEAM_BLUE && pPlayer->GetTeamNumber() != TF_TEAM_GREEN && pPlayer->GetTeamNumber() != TF_TEAM_YELLOW) ||
        ( pPlayer->m_Shared.GetState() != TF_STATE_OBSERVER ) && ( pPlayer->m_Shared.GetState() != TF_STATE_DYING ) ||
        ( pPlayer->GetObserverMode() == OBS_MODE_FREEZECAM ) )
    {
        m_pReinforcementsLabel->SetVisible( false );
        return;
    }

    wchar_t wLabel[128];
    
    if ( TFGameRules()->InStalemate() )
    {
        g_pVGuiLocalize->ConstructString( wLabel, sizeof( wLabel ), g_pVGuiLocalize->Find( "#game_respawntime_stalemate" ), 0 );
    }
    else if ( TFGameRules()->State_Get() == GR_STATE_TEAM_WIN )
    {
        // a team has won the round
        g_pVGuiLocalize->ConstructString( wLabel, sizeof( wLabel ), g_pVGuiLocalize->Find( "#game_respawntime_next_round" ), 0 );
    }
    else
    {
        float flNextRespawn = TFGameRules()->GetNextRespawnWave( pPlayer->GetTeamNumber(), pPlayer );
        if ( !flNextRespawn )
        {
            m_pReinforcementsLabel->SetVisible( false );
            return;
        }

        int iRespawnWait = (flNextRespawn - gpGlobals->curtime);
        if ( iRespawnWait <= 0 )
        {
            g_pVGuiLocalize->ConstructString( wLabel, sizeof( wLabel ), g_pVGuiLocalize->Find("#game_respawntime_now" ), 0 );
        }
        else if ( iRespawnWait <= 1.0 )
        {
            g_pVGuiLocalize->ConstructString( wLabel, sizeof( wLabel ), g_pVGuiLocalize->Find("#game_respawntime_in_sec" ), 0 );
        }
        else
        {
            char szSecs[6];
            Q_snprintf( szSecs, sizeof(szSecs), "%d", iRespawnWait );
            wchar_t wSecs[4];
            g_pVGuiLocalize->ConvertANSIToUnicode(szSecs, wSecs, sizeof(wSecs));
            g_pVGuiLocalize->ConstructString( wLabel, sizeof( wLabel ), g_pVGuiLocalize->Find("#game_respawntime_in_secs" ), 1, wSecs );
        }
    }

    m_pReinforcementsLabel->SetVisible( true );
    m_pReinforcementsLabel->SetText( wLabel, true );
}
开发者ID:staticfox,项目名称:TF2Classic,代码行数:60,代码来源:tf_spectatorgui.cpp

示例4: ShouldDraw

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool CHudBuildingStatusContainer::ShouldDraw( void )
{
    // Don't draw in freezecam
    C_TFPlayer *pPlayer = CTFPlayer::GetLocalTFPlayer();
    if ( pPlayer && pPlayer->GetObserverMode() == OBS_MODE_FREEZECAM )
        return false;

    return CHudElement::ShouldDraw();
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:12,代码来源:tf_hud_building_status.cpp

示例5: ShouldDraw

bool CHudSmokeBomb::ShouldDraw()
{
    C_TFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();

    // if we are spectating another player first person, check this player
    if ( pPlayer && ( pPlayer->GetObserverMode() == OBS_MODE_IN_EYE ) )
    {
        pPlayer = ToTFPlayer( pPlayer->GetObserverTarget() );
    }

    return ( pPlayer && pPlayer->IsAlive() && pPlayer->m_Shared.InCond( TF_COND_SMOKE_BOMB ) );
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:12,代码来源:tf_hud_smoke_bomb.cpp

示例6: OnTick

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFHudFlagObjectives::OnTick()
{
    // iterate through the flags to set their position in our HUD
    for ( int i = 0; i < g_Flags.Count(); i++ )
    {
        CCaptureFlag *pFlag = dynamic_cast< CCaptureFlag* >( ClientEntityList().GetEnt( g_Flags[i] ) );

        if ( pFlag )
        {
            if (!pFlag->IsDisabled())
            {
                if (m_pRedFlag && pFlag->GetTeamNumber() == TF_TEAM_RED)
                {
                    m_pRedFlag->SetEntity(pFlag);
                }
                else if (m_pBlueFlag && pFlag->GetTeamNumber() == TF_TEAM_BLUE)
                {
                    m_pBlueFlag->SetEntity(pFlag);
                }
                else if (m_pGreenFlag && pFlag->GetTeamNumber() == TF_TEAM_GREEN)
                {
                    m_pGreenFlag->SetEntity(pFlag);
                }
                else if (m_pYellowFlag && pFlag->GetTeamNumber() == TF_TEAM_YELLOW)
                {
                    m_pYellowFlag->SetEntity(pFlag);
                }
            }
        }
        else
        {
            // this isn't a valid index for a flag
            g_Flags.Remove( i );
        }
    }

    // are we playing captures for rounds?
    if ( tf_flag_caps_per_round.GetInt() > 0 )
    {
        C_TFTeam *pTeam = GetGlobalTFTeam( TF_TEAM_BLUE );
        if ( pTeam )
        {
            SetDialogVariable( "bluescore", pTeam->GetFlagCaptures() );
        }

        pTeam = GetGlobalTFTeam( TF_TEAM_RED );
        if ( pTeam )
        {
            SetDialogVariable( "redscore", pTeam->GetFlagCaptures() );
        }

        SetPlayingToLabelVisible( true );
        SetDialogVariable( "rounds", tf_flag_caps_per_round.GetInt() );
    }
    else // we're just playing straight score
    {
        C_TFTeam *pTeam = GetGlobalTFTeam( TF_TEAM_BLUE );
        if ( pTeam )
        {
            SetDialogVariable( "bluescore", pTeam->Get_Score() );
        }

        pTeam = GetGlobalTFTeam( TF_TEAM_RED );
        if ( pTeam )
        {
            SetDialogVariable( "redscore", pTeam->Get_Score() );
        }

        SetPlayingToLabelVisible( false );
    }

    // check the local player to see if they're spectating, OBS_MODE_IN_EYE, and the target entity is carrying the flag
    bool bSpecCarriedImage = false;
    C_TFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();
    if ( pPlayer && ( pPlayer->GetObserverMode() == OBS_MODE_IN_EYE ) )
    {
        // does our target have the flag?
        C_BaseEntity *pEnt = pPlayer->GetObserverTarget();
        if ( pEnt && pEnt->IsPlayer() )
        {
            C_TFPlayer *pTarget = static_cast< C_TFPlayer* >( pEnt );
            if ( pTarget->HasTheFlag() )
            {
                bSpecCarriedImage = true;

                CCaptureFlag *pPlayerFlag = dynamic_cast<CCaptureFlag*>(pTarget->GetItem());

                if (m_pSpecCarriedImage)
                {
                    switch (pPlayerFlag->GetTeamNumber())
                    {
                        case TF_TEAM_RED:
                            m_pSpecCarriedImage->SetImage(("%s_red", STRING(pPlayerFlag->m_szHudIcon)));
                            break;
                        case TF_TEAM_BLUE:
                            m_pSpecCarriedImage->SetImage(("%s_blue", STRING(pPlayerFlag->m_szHudIcon)));
                            break;
//.........这里部分代码省略.........
开发者ID:treetoon,项目名称:TF2Classic,代码行数:101,代码来源:tf_hud_flagstatus.cpp

示例7: Paint

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFArrowPanel::Paint()
{
    if ( !m_hEntity.Get() )
        return;

    C_BaseEntity *pEnt = m_hEntity.Get();
    IMaterial *pMaterial = m_NeutralMaterial;

    C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();

    // figure out what material we need to use
    if ( pEnt->GetTeamNumber() == TF_TEAM_RED )
    {
        pMaterial = m_RedMaterial;

        if ( pLocalPlayer && ( pLocalPlayer->GetObserverMode() == OBS_MODE_IN_EYE ) )
        {
            // is our target a player?
            C_BaseEntity *pTargetEnt = pLocalPlayer->GetObserverTarget();
            if ( pTargetEnt && pTargetEnt->IsPlayer() )
            {
                // does our target have the flag and are they carrying the flag we're currently drawing?
                C_TFPlayer *pTarget = static_cast< C_TFPlayer* >( pTargetEnt );
                if ( pTarget->HasTheFlag() && ( pTarget->GetItem() == pEnt ) )
                {
                    pMaterial = m_RedMaterialNoArrow;
                }
            }
        }
    }
    else if ( pEnt->GetTeamNumber() == TF_TEAM_BLUE )
    {
        pMaterial = m_BlueMaterial;

        if ( pLocalPlayer && ( pLocalPlayer->GetObserverMode() == OBS_MODE_IN_EYE ) )
        {
            // is our target a player?
            C_BaseEntity *pTargetEnt = pLocalPlayer->GetObserverTarget();
            if ( pTargetEnt && pTargetEnt->IsPlayer() )
            {
                // does our target have the flag and are they carrying the flag we're currently drawing?
                C_TFPlayer *pTarget = static_cast< C_TFPlayer* >( pTargetEnt );
                if ( pTarget->HasTheFlag() && ( pTarget->GetItem() == pEnt ) )
                {
                    pMaterial = m_BlueMaterialNoArrow;
                }
            }
        }
    }
    else if (pEnt->GetTeamNumber() == TF_TEAM_GREEN)
    {
        pMaterial = m_GreenMaterial;

        if (pLocalPlayer && (pLocalPlayer->GetObserverMode() == OBS_MODE_IN_EYE))
        {
            // is our target a player?
            C_BaseEntity *pTargetEnt = pLocalPlayer->GetObserverTarget();
            if (pTargetEnt && pTargetEnt->IsPlayer())
            {
                // does our target have the flag and are they carrying the flag we're currently drawing?
                C_TFPlayer *pTarget = static_cast< C_TFPlayer* >(pTargetEnt);
                if (pTarget->HasTheFlag() && (pTarget->GetItem() == pEnt))
                {
                    pMaterial = m_GreenMaterialNoArrow;
                }
            }
        }
    }
    else if (pEnt->GetTeamNumber() == TF_TEAM_YELLOW)
    {
        pMaterial = m_YellowMaterial;

        if (pLocalPlayer && (pLocalPlayer->GetObserverMode() == OBS_MODE_IN_EYE))
        {
            // is our target a player?
            C_BaseEntity *pTargetEnt = pLocalPlayer->GetObserverTarget();
            if (pTargetEnt && pTargetEnt->IsPlayer())
            {
                // does our target have the flag and are they carrying the flag we're currently drawing?
                C_TFPlayer *pTarget = static_cast< C_TFPlayer* >(pTargetEnt);
                if (pTarget->HasTheFlag() && (pTarget->GetItem() == pEnt))
                {
                    pMaterial = m_YellowMaterialNoArrow;
                }
            }
        }
    }

    int x = 0;
    int y = 0;
    ipanel()->GetAbsPos( GetVPanel(), x, y );
    int nWidth = GetWide();
    int nHeight = GetTall();

    CMatRenderContextPtr pRenderContext( materials );
    pRenderContext->MatrixMode( MATERIAL_MODEL );
    pRenderContext->PushMatrix(); 
//.........这里部分代码省略.........
开发者ID:treetoon,项目名称:TF2Classic,代码行数:101,代码来源:tf_hud_flagstatus.cpp


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