bool TEffect::ApplyInternal(bass_p pChannel) { if (IsRemoved()) return false; bUpdated = true; iErrorCode = BASS_OK; if (eType == BASS_FX_UNKNOWN) { iErrorCode = BASS_ERROR_ILLPARAM; return false; } if (pChannel == BASS_NULL) { iErrorCode = BASS_ERROR_HANDLE; return false; } bass_p pOldChannel = this->pChannel; if (pOldChannel != pChannel) { this->pChannel = pChannel; if (pOldChannel != BASS_NULL && pFX != BASS_NULL) { BASS_ChannelRemoveFX(pOldChannel, pFX); pFX = BASS_NULL; } } else { if (pFX != BASS_NULL && bEnabled) { return true; } } if (!bEnabled) { RemoveFX(); return true; } pFX = BASS_ChannelSetFX(pChannel, eType, 0); iErrorCode = BASS_ErrorGetCode(); if (iErrorCode != BASS_OK) { RemoveFX(); return false; } UpdateInternal(); ResetInternal(); return true; }
void TEffect::Remove() { lock_guard<mutex> Lock(MutexLock); RemoveFX(); pChannel = BASS_NULL; bIsRemoved = true; }
void TEffect::UpdateInternal() { if (bIsRemoved) return; if (pFX == BASS_NULL) return; if (!bEnabled) { RemoveFX(); return; } if (!bUpdated) return; void* pParamData = this->GetData(); if (ISNULLPTR(pParamData)) return; BASS_FXSetParameters(pFX, pParamData); iErrorCode = BASS_ErrorGetCode(); bUpdated = (iErrorCode == BASS_OK); }
LTBOOL CProjectileFX::Update() { if (!m_pClientDE) return LTFALSE; if (g_pClientMultiplayerMgr->IsConnectedToRemoteServer( ) && m_hServerObject) { // If this is a local fx, we control the position of the "server object"... if (m_bLocal) { if (!MoveServerObj()) { Detonate(LTNULL); // Remove the "server" object... m_pClientDE->RemoveObject(m_hServerObject); m_hServerObject = LTNULL; m_bWantRemove = LTTRUE; } } } // Update fx positions... LTRotation rRot; LTVector vPos; if (m_hServerObject) { g_pLTClient->GetObjectPos(m_hServerObject, &vPos); g_pLTClient->GetObjectRotation(m_hServerObject, &rRot); } // See if it is time to go away... if (m_bWantRemove) { RemoveFX(); return LTFALSE; } if (m_pSmokeTrail) { m_pSmokeTrail->Update(); } if (m_hFlare) { g_pLTClient->SetObjectPos(m_hFlare, &vPos); g_pLTClient->SetObjectRotation(m_hFlare, &rRot); } if (m_hLight) { g_pLTClient->SetObjectPos(m_hLight, &vPos); g_pLTClient->SetObjectRotation(m_hLight, &rRot); } if (m_hFlyingSound) { ((ILTClientSoundMgr*)m_pClientDE->SoundMgr())->SetSoundPosition(m_hFlyingSound, &vPos); } // Update this here so m_vLastServPos is updated after we use it... CSpecialFX::Update(); return LTTRUE; }