void CLIENTFX_INSTANCE::SetPos( const LTVector &vWorldPos, const LTVector &vCamRelPos ) { // Loop through all of the Muzzle flash's active FX and set the positions... if( m_collActiveFX.GetSize() ) { uint32 dwFlags; CBaseFX *pFX; LTVector vPos; CLinkListNode<FX_LINK> *pActiveFX = m_collActiveFX.GetHead(); while( pActiveFX ) { pFX = pActiveFX->m_Data.m_pFX; if( m_bPlayerView ) { g_pLTCCommon->GetObjectFlags( pFX->GetFXObject(), OFT_Flags, dwFlags ); dwFlags & FLAG_REALLYCLOSE ? vPos = vCamRelPos : vPos = vWorldPos; } else { vPos = vWorldPos; } pFX->SetPos( vPos ); pActiveFX = pActiveFX->m_pNext; } } }
void CLIENTFX_INSTANCE::DeleteFX(CLinkListNode<FX_LINK> *pDelNode) { if( !pDelNode ) return; CBaseFX* pDelFX = pDelNode->m_Data.m_pFX; if(pDelFX) { // Make sure no other active FX in this instance have this pDelFX has their parent... CLinkListNode<FX_LINK> *pActiveNode = m_collActiveFX.GetHead(); while( pActiveNode ) { CBaseFX *pPossibleChildFX = pActiveNode->m_Data.m_pFX; if( pPossibleChildFX && (pPossibleChildFX->GetParent() == pDelFX->GetFXObject())) { // NULL out the parent otherwise it will reference an object that is no longer there pPossibleChildFX->SetParent( LTNULL ); } pActiveNode = pActiveNode->m_pNext; } // Give the FX a chance to clean itself up pDelFX->Term(); CClientFXDB::GetSingleton().DeleteEffect(pDelFX); } //now remove this node from our list m_collActiveFX.Remove(pDelNode); }
bool CClientFXMgr::CreateFXKey( CLIENTFX_INSTANCE* pInst, FX_KEY* pKey ) { if( !pInst || !pKey ) return false; // // We need to go ahead and create this effect // assert(m_hCamera); FX_BASEDATA fxData; fxData.m_vPos = pInst->m_vPos; fxData.m_rRot = pInst->m_rRot; fxData.m_dwID = pInst->m_dwID; fxData.m_hTarget = pInst->m_hTarget; fxData.m_dwObjectFlags = pInst->m_dwObjectFlags; fxData.m_dwObjectFlags2 = pInst->m_dwObjectFlags2; fxData.m_bUseTargetData = pInst->m_bUseTargetData; fxData.m_vTargetPos = pInst->m_vTargetPos; fxData.m_vTargetNorm = pInst->m_vTargetNorm; fxData.m_hCamera = m_hCamera; // Save the parent fxData.m_hParent = pInst->m_hParent; // Is this FX supposed to be motion linked to another FX? if (pKey->m_bLinked) { CLinkListNode<FX_LINK> *pNode = pInst->m_collActiveFX.GetHead(); while (pNode) { if (pNode->m_Data.m_dwID == pKey->m_dwLinkedID) { // This is the one !!! if (pInst->ExistFX(pNode->m_Data.m_pFX)) { CBaseFX *pMotionLinkFX = pNode->m_Data.m_pFX; fxData.m_hParent = pMotionLinkFX->GetFXObject(); } // done break; } pNode = pNode->m_pNext; } } // Create the FX CBaseFX *pNewFX = CreateFX(pKey->m_pFxRef->m_sName, &fxData, pKey->m_pProps, pInst->m_hParent); if( pNewFX ) { pNewFX->SetVisible(false); pNewFX->ClearState(FS_INITIALFRAME | FS_ACTIVE | FS_SHUTTINGDOWN | FS_SUSPENDED); // Add it onto the list for link referencing FX_LINK fxLink; fxLink.m_dwID = pKey->m_dwID; fxLink.m_pFX = pNewFX; fxLink.m_pRef = pKey; pInst->m_collActiveFX.AddHead(fxLink); } else { return false; } return true; }