Beispiel #1
0
void CPedRPCs::SetPedRotation ( CClientEntity* pSource, NetBitStreamInterface& bitStream )
{
    SPedRotationSync rotation;
    unsigned char ucTimeContext;
    if ( bitStream.Read ( &rotation ) &&
         bitStream.Read ( ucTimeContext ) )
    {
        uchar ucNewWay = 0;
        if ( bitStream.GetNumberOfBytesUsed () > 0 )
            bitStream.Read ( ucNewWay );

        CClientPed* pPed = m_pPedManager->Get ( pSource->GetID (), true );
        if ( pPed )
        {
            if ( ucNewWay == 1 )
                pPed->SetCurrentRotationNew ( rotation.data.fRotation );
            else
                pPed->SetCurrentRotation ( rotation.data.fRotation );

            if ( !IS_PLAYER ( pPed ) )
                pPed->SetCameraRotation ( rotation.data.fRotation );
            pPed->SetSyncTimeContext ( ucTimeContext );
        }
    }
}