Exemplo n.º 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;
                    }
                }
            }
        }
    }
}
Exemplo n.º 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 ) );
            }
        }
    }
}