Пример #1
0
void CMarkerRPCs::SetMarkerTarget ( NetBitStreamInterface& bitStream )
{
    // Read out the marker id and if there's a new target
    ElementID ID;
    unsigned char ucTemp;
    if ( bitStream.Read ( ID ) &&
         bitStream.Read ( ucTemp ) )
    {
        // Grab the marker
        CClientMarker* pMarker = m_pMarkerManager->Get ( ID );
        if ( pMarker )
        {
            // Grab the checkpoint marker from it
            CClientCheckpoint* pCheckpoint = pMarker->GetCheckpoint ();
            if ( pCheckpoint )
            {
                // Handle this according to the temp char
                switch ( ucTemp )
                {
                    // No target?
                    case 0:
                    {
                        pCheckpoint->SetIcon ( CClientCheckpoint::ICON_NONE );
                        pCheckpoint->SetDirection ( CVector ( 1.0f, 0.0f, 0.0f ) );
                        pCheckpoint->SetHasTarget ( false );
                        pCheckpoint->ReCreateWithSameIdentifier();
                        break;
                    }

                    // Position target?
                    case 1:
                    {
                        // Read out the position
                        CVector vecPosition;
                        if ( bitStream.Read ( vecPosition.fX ) &&
                            bitStream.Read ( vecPosition.fY ) &&
                            bitStream.Read ( vecPosition.fZ ) )
                        {
                            // Set the icon to arrow and the target position
                            pCheckpoint->SetNextPosition ( vecPosition );
                            pCheckpoint->SetIcon ( CClientCheckpoint::ICON_ARROW );
                            pCheckpoint->SetHasTarget ( true );
                            pCheckpoint->SetTarget ( vecPosition );
                            pCheckpoint->ReCreateWithSameIdentifier();
                        }

                        break;
                    }
                }
            }
        }
    }
}
Пример #2
0
void CMarkerRPCs::SetMarkerIcon ( CClientEntity* pSource, NetBitStreamInterface& bitStream )
{
    // Read out the marker id and icon
    unsigned char ucIcon;
    if ( bitStream.Read ( ucIcon ) )
    {
        // Grab the marker
        CClientMarker* pMarker = m_pMarkerManager->Get ( pSource->GetID () );
        if ( pMarker )
        {
            // Convert it to a checkpoint
            CClientCheckpoint* pCheckpoint = pMarker->GetCheckpoint ();
            if ( pCheckpoint )
            {
                pCheckpoint->SetIcon ( static_cast < unsigned int > ( ucIcon ) );
            }
        }
    }
}
Пример #3
0
void CClientMarker::CreateOfType ( int iType )
{
    SAFE_DELETE ( m_pCollision )

    CVector vecOrigin;
    GetPosition ( vecOrigin );    
    switch ( iType )
    {
        case MARKER_CHECKPOINT:
        {
            CClientCheckpoint* pCheckpoint = new CClientCheckpoint ( this );
            pCheckpoint->SetCheckpointType ( CClientCheckpoint::TYPE_NORMAL );
            m_pMarker = pCheckpoint;
            m_pCollision = new CClientColCircle ( g_pClientGame->GetManager(), NULL, vecOrigin, GetSize() );
            m_pCollision->m_pOwningMarker = this;
            m_pCollision->SetHitCallback ( this );
            break;
        }

        case MARKER_RING:
        {
            CClientCheckpoint* pCheckpoint = new CClientCheckpoint ( this );
            pCheckpoint->SetCheckpointType ( CClientCheckpoint::TYPE_RING );
            m_pMarker = pCheckpoint;
            m_pCollision = new CClientColSphere ( g_pClientGame->GetManager(), NULL, vecOrigin, GetSize() );
            m_pCollision->m_pOwningMarker = this;
            m_pCollision->SetHitCallback ( this );
            break;
        }

        case MARKER_CYLINDER:
        {
            CClient3DMarker* p3DMarker = new CClient3DMarker ( this );
            p3DMarker->Set3DMarkerType ( CClient3DMarker::TYPE_CYLINDER );
            m_pMarker = p3DMarker;
            m_pCollision = new CClientColCircle ( g_pClientGame->GetManager(), NULL, vecOrigin, GetSize() );
            m_pCollision->m_pOwningMarker = this;
            m_pCollision->SetHitCallback ( this );
            break;
        }

        case MARKER_ARROW:
        {
            CClient3DMarker* p3DMarker = new CClient3DMarker ( this );
            p3DMarker->Set3DMarkerType ( CClient3DMarker::TYPE_ARROW );
            m_pMarker = p3DMarker;
            m_pCollision = new CClientColSphere ( g_pClientGame->GetManager(), NULL, vecOrigin, GetSize() );
            m_pCollision->m_pOwningMarker = this;
            m_pCollision->SetHitCallback ( this );
            break;
        }

        case MARKER_CORONA:
        {
            m_pMarker = new CClientCorona ( this );
            m_pCollision = new CClientColSphere ( g_pClientGame->GetManager(), NULL, vecOrigin, GetSize() );
            m_pCollision->m_pOwningMarker = this;
            m_pCollision->SetHitCallback ( this );
            break;
        }
        
        default:
            break;
    }
}