Esempio n. 1
0
CObjectSA::CObjectSA(CObjectSAInterface * objectInterface)
{
	DEBUG_TRACE("CObjectSA::CObjectSA(CObjectSAInterface * objectInterface)");
	this->SetInterface(objectInterface);
    m_ucAlpha = 255;
    CheckForGangTag ( );
}
Esempio n. 2
0
CObjectSA::CObjectSA(CObjectSAInterface* objectInterface)
{
    DEBUG_TRACE("CObjectSA::CObjectSA(CObjectSAInterface * objectInterface)");
    this->SetInterface(objectInterface);
    m_ucAlpha = 255;

    // Setup some flags
    this->BeingDeleted = FALSE;
    this->DoNotRemoveFromGame = FALSE;

    if (m_pInterface)
    {
        ResetScale();
        CheckForGangTag();
        m_pInterface->bStreamingDontDelete = true;
    }
}
Esempio n. 3
0
CObjectSA::CObjectSA(DWORD dwModel, bool bBreakingDisabled)
{
    DEBUG_TRACE("CObjectSA::CObjectSA( DWORD dwModel )");

    CWorldSA* world = (CWorldSA*)pGame->GetWorld();

    DWORD dwThis = 0;

#ifdef MTA_USE_BUILDINGS_AS_OBJECTS

    DWORD               dwFunc = 0x538090;            // CFileLoader__LoadObjectInstance
    CFileObjectInstance fileLoader;
    MemSetFast(&fileLoader, 0, sizeof(CFileObjectInstance));
    fileLoader.modelId = dwModel;
    fileLoader.rr = 1;
    fileLoader.areaNumber = 0;
    fileLoader.flags = -1;

    _asm
    {
        push    0
        lea     ecx, fileLoader
        push    ecx
        call    dwFunc
        add     esp, 8
        mov     dwThis, eax
    }

    this->SetInterface((CEntitySAInterface*)dwThis);

    MemPutFast<DWORD>(0xBCC0E0, dwThis);
    MemPutFast<DWORD>(0xBCC0D8, 1);

    dwFunc = 0x404DE0;            // CIplStore__SetupRelatedIpls
    DWORD dwTemp = 0;
    char  szTemp[255];
    strcpy(szTemp, "moo");

    _asm
    {
        push    0xBCC0E0
        push    -1
        lea     eax, szTemp
        push    eax
        call    dwFunc
        add     esp, 0xC
        mov     dwTemp, eax
    }

    dwFunc = 0x5B51E0;            // AddBuildingInstancesToWorld
    _asm
    {
        push    dwTemp
        call    dwFunc
        add     esp, 4
    }

    dwFunc = 0x405110;            // CIplStore__RemoveRelatedIpls
    _asm
    {
        push    -1
        call    dwFunc
        add     esp, 4
    }

    // VITAL to get colmodels to appear
    // this gets the level for a colmodel (colmodel+40)
    dwFunc = 0x4107A0;
    _asm
    {
        mov     eax, dwModel
        mov     eax, 0xA9B0C8[eax*4]
        mov     eax, [eax+20]
        movzx   eax, byte ptr [eax+40]
        push    eax
        call    dwFunc
        add     esp, 4
    }

#else

    DWORD CObjectCreate = FUNC_CObject_Create;
    DWORD dwObjectPtr = 0;
    _asm
    {
        push    1
        push    dwModel
        call    CObjectCreate
        add     esp, 8
        mov     dwObjectPtr, eax
    }
    if (dwObjectPtr)
    {
        this->SetInterface((CEntitySAInterface*)dwObjectPtr);

        world->Add(m_pInterface, CObject_Constructor);

        // Setup some flags
        this->BeingDeleted = FALSE;
        this->DoNotRemoveFromGame = FALSE;
        MemPutFast<BYTE>(dwObjectPtr + 316, 6);
        if (bBreakingDisabled)
        {
            // Set our immunities
            // Sum of all flags checked @ CPhysical__CanPhysicalBeDamaged
            CObjectSAInterface* pObjectSAInterface = GetObjectInterface();
            pObjectSAInterface->bBulletProof = true;
            pObjectSAInterface->bFireProof = true;
            pObjectSAInterface->bCollisionProof = true;
            pObjectSAInterface->bMeeleProof = true;
            pObjectSAInterface->bExplosionProof = true;
        }
        m_pInterface->bStreamingDontDelete = true;
    }
    else
    {
        // The exception handler doesn't work for some reason, so do this
        this->SetInterface(NULL);
    }
#endif

    this->internalID = pGame->GetPools()->GetObjectRef((DWORD*)this->GetInterface());

    m_ucAlpha = 255;

    if (m_pInterface)
    {
        ResetScale();
        CheckForGangTag();
    }
}
Esempio n. 4
0
CObjectSA::CObjectSA( DWORD dwModel )
{
	DEBUG_TRACE("CObjectSA::CObjectSA( DWORD dwModel )");

    CWorldSA * world = (CWorldSA *)pGame->GetWorld();

    DWORD dwThis = 0;
    
#ifdef MTA_USE_BUILDINGS_AS_OBJECTS

    DWORD dwFunc = 0x538090; // CFileLoader__LoadObjectInstance
    CFileObjectInstance fileLoader;
    memset(&fileLoader, 0, sizeof(CFileObjectInstance));
    fileLoader.modelId = dwModel;
    fileLoader.rr = 1;
    fileLoader.areaNumber = 0;
    fileLoader.flags = -1;

    _asm
    {
        push    0
        lea     ecx, fileLoader
        push    ecx
        call    dwFunc
        add     esp, 8
        mov     dwThis, eax
    }

    this->SetInterface((CEntitySAInterface*)dwThis);
    
    *(DWORD *)(0xBCC0E0) = dwThis; // dw_buildings_created_this_scene
    *(DWORD *)0xBCC0D8 = 1; // dw_current_ipl_line

    dwFunc = 0x404DE0; // CIplStore__SetupRelatedIpls
    DWORD dwTemp = 0;
    char szTemp[255];
    strcpy(szTemp, "moo");

    _asm
    {
        push    0xBCC0E0
        push    -1
        lea     eax, szTemp
        push    eax
        call    dwFunc
        add     esp, 0xC
        mov     dwTemp, eax
    }

//    _asm int 3
    dwFunc = 0x5B51E0; // AddBuildingInstancesToWorld
    _asm
    {
        push    dwTemp
        call    dwFunc
        add     esp, 4
    }

    dwFunc = 0x405110; // CIplStore__RemoveRelatedIpls
    _asm
    {
        push    -1
        call    dwFunc
        add     esp, 4
    }

    // VITAL to get colmodels to appear
    // this gets the level for a colmodel (colmodel+40)
    dwFunc = 0x4107A0;
    _asm
    {
        mov     eax, dwModel
        mov     eax, 0xA9B0C8[eax*4]
        mov     eax, [eax+20]
        movzx   eax, byte ptr [eax+40]
        push    eax
        call    dwFunc
        add     esp, 4
    }

#else


	DWORD CObjectCreate = FUNC_CObject_Create;	
	DWORD dwObjectPtr = 0;
	_asm
	{
		push	1
		push	dwModel
		call	CObjectCreate
		add		esp, 8
		mov		dwObjectPtr, eax
	}
    if ( dwObjectPtr )
    {
	    this->SetInterface((CEntitySAInterface *)dwObjectPtr);

	    world->Add( m_pInterface );

        // Setup some flags
        this->BeingDeleted = FALSE;
	    this->DoNotRemoveFromGame = FALSE;
        *(BYTE *)(dwObjectPtr + 316) = 6;   // Related to moving stuff (eg: fire hydrants, default is 2)
        m_pInterface->bStreamingDontDelete = true;
    }
    else
    {
        // The exception handler doesn't work for some reason, so do this
        this->SetInterface ( NULL );
    }
#endif

    this->internalID = pGame->GetPools ()->GetObjectRef ( (DWORD *)this->GetInterface () );

    m_ucAlpha = 255;
    CheckForGangTag ();
}