RpClump *CClumpModelInfo::CreateInstance() { if (GetRwObject() == NULL) { return NULL; } AddRef(); RpClump *pCloned = RpClumpClone((RpClump*)GetRwObject()); RpAtomic *pFirst = GetFirstAtomic(pCloned); if (pFirst) { if(RpSkinGeometryGetSkin(pFirst->geometry) != NULL) { if(!dwUnknownFlag10) { RpHAnimHierarchy *pHAnim = GetAnimHierarchyFromClump(pCloned); RpClumpForAllAtomics(pCloned, SetAtomicHAnimHierarchyCB, pHAnim); RtAnimAnimation *pAnim = RpAnimBlendCreateAnimationForHierarchy(pHAnim); RtAnimInterpolatorSetCurrentAnim(pHAnim->currentAnim, pAnim); pHAnim->flags = rpHANIMHIERARCHYUPDATEMODELLINGMATRICES | rpHANIMHIERARCHYUPDATELTMS; } } } if (GetIsRoad()) { RpAnimBlendClumpInit(pCloned); CAnimBlendHierarchy *pAnim = CAnimManager::GetAnimationByID(GetHashKey(), &CAnimManager::AnimBlocks[m_AnimId]); if (pAnim) { CAnimManager::BlendAnimation(pCloned, pAnim, 2, 1.0f); } } RemoveRef(); return pCloned; }
~CToken() { if (x0_objRef) { if (x4_lockHeld) x0_objRef->Unlock(); RemoveRef(); } }
CToken& operator=(CToken&& other) { Unlock(); RemoveRef(); x0_objRef = other.x0_objRef; other.x0_objRef = nullptr; x4_lockHeld = other.x4_lockHeld; other.x4_lockHeld = false; return *this; }
CToken& operator=(const CToken& other) { Unlock(); RemoveRef(); x0_objRef = other.x0_objRef; if (x0_objRef) { ++x0_objRef->x0_refCount; if (other.x4_lockHeld) Lock(); } return *this; }