Exemplo n.º 1
0
bool CFileLoader::LoadAtomicFile(RwStream* stream, uint32_t modelIndex)
{
    CAtomicModelInfo* info = CModelInfo::GetModelInfo(modelIndex)->AsAtomicModelInfoPtr();
    v4 = 0;
    if (info && info->flags & 0x8000)
    {
        v4 = 1;
        CVehicleModelInfo::UseCommonVehicleTexDicationary();
    }
    if (RwStreamFindChunk(stream, 16, NULL, NULL))
    {
        RpClump* read = RpClumpStreamRead(stream);
        if (!read)
        {
            if (v4)
            {
                CVehicleModelInfo::StopUsingCommonVehicleTexDicationary();
            }
            return false;
        }
        relatedModelIndex = modelIndex;
        RpClumpForAllAtomics(read, SetRelatedModelInfoCB, read);
        RpClumpDestroy(read);
    }
    if (!info->GetRwObject())
    {
        return false;
    }
    if (v4)
    {
        CVehicleModelInfo::StopUsingCommonVehicleTexDicationary();
    }
    return true;
}
Exemplo n.º 2
0
bool CFileLoader::LoadClumpFile(RwStream *stream, size_t model_id)
{
    char v2; // bl@1
    int v3; // ebp@1
    CVehicleModelInfo *v4; // esi@1
    RpClump *v5; // ebx@2
    RwFrame *v6; // ebp@2
    RpClump *v7; // eax@3
    RpClump *v8; // esi@3
    RwFrame *v9; // eax@4
    RpClump *v11; // edi@10
    CVehicleModelInfo *v12; // [sp+10h] [bp+10h]@1

    v3 = model_id;
    CVehicleModelInfo* v12 = static_cast<CVehicleModelInfo*>(CModelInfo::GetModelInfo(model_id));
    v4 = v12;
    v2 = (unsigned __int8)v12->__parent.__parent.__vmt->getType(v12) == 6;
    if ( HIBYTE(v12->__parent.__parent.flags) & 2 )
    {
        v5 = (RpClump *)RpClumpCreate();
        v6 = RwFrameCreate();
        v5->object.parent = v6;
        if ( !v7ed2d0(stream, 16, 0, 0) )
        {
        LABEL_6:
            ((void (__thiscall *)(CVehicleModelInfo *, RpClump *))v4->__parent.__parent.__vmt[1]._m04)(v4, v5);
            return 1;
        }
        while ( 1 )
        {
            v7 = RpClumpStreamRead(stream);
            v8 = v7;
            if ( !v7 )
            return 0;
            v9 = _rwFrameCloneAndLinkClones(v7->object.parent);
            v7f0b00(v6, v9);
            RpClumpForAllAtomics(v8, (int (__cdecl *)(_DWORD, _DWORD))dummy_537290, v5);
            RpClumpDestroy(v8);
            if ( !v7ed2d0(stream, 16, 0, 0) )
            {
                v4 = v12;
                goto LABEL_6;
            }
        }
    }
    if ( !v7ed2d0(stream, 16, 0, 0) )
    return 0;
    if ( v2 )
    {
    CCollisionPlugin__SetModelInfo(&v12->__parent.__parent);
    CVehicleModelInfo__UseCommonVehicleTexDicationary();
    }
    v11 = RpClumpStreamRead(stream);
    if ( v2 )
    {
    CCollisionPlugin__SetModelInfo(0);
    restoreTextureFindCallback();
    }
    if ( !v11 )
    return 0;
    ((void (__thiscall *)(CVehicleModelInfo *, RpClump *))v12->__parent.__parent.__vmt[1]._m04)(v12, v11);
    if ( v3 == 508 )
    v12->ucDoorCount = 2;
    return 1;
}