void CClumpModelInfo::DeleteRwObject() { RpClump *pClump = (RpClump*)m_rwObject; if (pClump) { v3 = Get2DEffectAtomic(m_rwObject); if ( v3 ) { v4 = *(_DWORD *)(g2dEffectPluginOffset + *(_DWORD *)(v3 + 24)); if ( v4 ) v5 = *(_DWORD *)v4; else LOBYTE(v5) = 0; pThis->uc2DFxCount -= v5; } RpClumpDestroy(pClump); m_rwObject = 0; RemoveTexDictionaryRef(); size_t animIndex = GetAnimFileIndex(); if (animIndex != -1) { CAnimManager::RemoveAnimBlockRef(animIndex); } if ( HIBYTE(pThis->flags) & 8 ) LOBYTE(v1) = CBaseModelInfo__DeleteCollisionModel(pThis); } }
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; }
/////////////////////////////////////// // // Remove clothes that have been unused the longest // /////////////////////////////////////// bool RemoveOldestUnused ( void ) { uint uiBestAge = -1; std::vector < SSavedClumpInfo >::iterator uiBestIndex; CTickCount timeNow = CTickCount::Now (); for ( std::vector < SSavedClumpInfo >::iterator iter = savedClumpList.begin () ; iter != savedClumpList.end () ; ++iter ) { const SSavedClumpInfo& info = *iter; if ( info.bUnused ) { uint uiAge = ( timeNow - info.timeUnused ).ToInt (); if ( uiAge > m_uiMinCacheTime ) { if ( uiAge > uiBestAge || uiBestAge == -1 ) { uiBestAge = uiAge; uiBestIndex = iter; } } } } if ( uiBestAge == -1 ) return false; const SSavedClumpInfo& info = *uiBestIndex; #ifdef CLOTHES_REF_TEST RpGeometry* pGeometry = ( ( RpAtomic* ) ( ( info.pClump->atomics.root.next ) - 0x8 ) )->geometry; pGeometry->refs -= 20; #endif RpClumpDestroy ( info.pClump ); assert ( info.bUnused ); m_Stats.uiNumTotal--; m_Stats.uiNumUnused--; m_Stats.uiNumRemoved++; savedClumpList.erase ( uiBestIndex ); return true; }
void CAnimManager::LoadAnimFiles(void) { CAnimManager::LoadAnimFile("ANIM\\PED.IFP"); void *mem = gta_nw(sizeof(CAnimBlendAssocGroup) * 25 + 8); CAnimManager::ms_aAnimAssocGroups = (CAnimBlendAssocGroup *)construct_array( mem, &CAnimBlendAssocGroup::ctor, &CAnimBlendAssocGroup::dtor, sizeof(CAnimBlendAssocGroup), 25); for(int i = 0; i < 25; i++){ void *model = CModelInfo::ms_modelInfoPtrs[CAnimManager::ms_aAnimAssocDefinitions[i].modelIndex]; // wtf? //((void (__thiscall*)(void*)) (*(void***)model)[5])(model); // no-op // CClumpModelInfo::CreateInstance() RpClump *clump = ((RpClump* (__thiscall*)(void*)) (*(void***)model)[3])(model); RpAnimBlendClumpInit(clump); CAnimBlendAssocGroup *group = &CAnimManager::ms_aAnimAssocGroups[i]; AnimAssocDefinition *def = &CAnimManager::ms_aAnimAssocDefinitions[i]; group->CreateAssociations(def->blockName, clump, def->animNames, def->animCount); for(int j = 0; j < group->numAssociations; j++) group->GetAnimation(def->animInfoList[j].animId)->flags |= def->animInfoList[j].flags; RpClumpDestroy(clump); } }
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; }