示例#1
0
void CClientPickup::StreamIn ( bool bInstantly )
{
    // Create it
    Create ();

    // Notify the streamer we've created it
    NotifyCreate ();
}
示例#2
0
void CClientMarker::StreamIn ( bool bInstantly )
{
    // Not already streamed in?
    if ( !IsStreamedIn ( ) )
    {
        // Stream the marker in
        m_pMarker->StreamIn ();

        // Increment streamed in counter
        ++m_uiStreamedInMarkers;

        // Tell the streamer we've created this object
        NotifyCreate ();
    }
}
示例#3
0
void CClientObject::Create ( void )
{
    // Not already created an object?
    if ( !m_pObject )
    {
        // Check again that the limit isn't reached. We are required to do so because
        // we load async. The streamer isn't always aware of our limits.
        if ( !CClientObjectManager::IsObjectLimitReached () )
        {
            // Add a reference to the object
            m_pModelInfo->ModelAddRef ( BLOCKING, "CClientObject::Create" );

            // If the new object is not breakable, allow it into the vertical line test
            g_pMultiplayer->AllowCreatedObjectsInVerticalLineTest ( !CClientObjectManager::IsBreakableModel ( m_usModel ) );

            // Create the object
            m_pObject = g_pGame->GetPools ()->AddObject ( m_usModel, m_bIsLowLod, m_bBreakingDisabled );

            // Restore default behaviour
            g_pMultiplayer->AllowCreatedObjectsInVerticalLineTest ( false );

            if ( m_pObject )
            {                
                // Put our pointer in its stored pointer
                m_pObject->SetStoredPointer ( this );

                // Add XRef
                g_pClientGame->GetGameEntityXRefManager ()->AddEntityXRef ( this, m_pObject );

                // If set to true,this has the effect of forcing the object to be static at all times
                m_pObject->SetStaticWaitingForCollision ( m_bIsStatic );

                // Apply our data to the object
                m_pObject->Teleport ( m_vecPosition.fX, m_vecPosition.fY, m_vecPosition.fZ );
                m_pObject->SetOrientation ( m_vecRotation.fX, m_vecRotation.fY, m_vecRotation.fZ );
                #ifndef MTA_BUILDINGS
                m_pObject->ProcessCollision ();
                #endif
                m_pObject->SetupLighting ();

                UpdateVisibility ();
                if ( !m_bUsesCollision ) SetCollisionEnabled ( false );
                if ( m_vecScale.fX != 1.0f &&
                     m_vecScale.fY != 1.0f &&
                     m_vecScale.fZ != 1.0f)
                    SetScale ( m_vecScale );
                m_pObject->SetAreaCode ( m_ucInterior );
                SetAlpha ( m_ucAlpha );
                m_pObject->SetHealth ( m_fHealth );

                // Set object mass
                if ( m_fMass != -1.0f )
                    m_pObject->SetMass ( m_fMass );

                // Reattach to an entity + any entities attached to this
                ReattachEntities ();

                // Validate this entity again
                m_pManager->RestoreEntity ( this );

                // Tell the streamer we've created this object
                NotifyCreate ();

                // Done
                return;
            }
            else
            {
                // Remove our reference to the object again
                m_pModelInfo->RemoveRef ();
            }
        }

        // Tell the streamer we could not create it
        NotifyUnableToCreate ();
    }
}