void CEntityAudioProxy::OnMove() { CRY_ASSERT_MESSAGE(!(((m_nFlags & eEAPF_CAN_MOVE_WITH_ENTITY) > 0) && ((m_pEntity->GetFlagsExtended() & ENTITY_FLAG_EXTENDED_AUDIO_LISTENER) > 0)), "An CEntityAudioProxy cannot have both flags (eEAPF_CAN_MOVE_WITH_ENTITY & ENTITY_FLAG_EXTENDED_AUDIO_LISTENER) set simultaneously!"); Matrix34 const& tm = m_pEntity->GetWorldTM(); CRY_ASSERT_MESSAGE(tm.IsValid(), "Invalid Matrix34 during CEntityAudioProxy::OnMove"); if ((m_nFlags & eEAPF_CAN_MOVE_WITH_ENTITY) > 0) { std::for_each(m_mapAuxAudioProxies.begin(), m_mapAuxAudioProxies.end(), SRepositionAudioProxy(tm)); } else if ((m_pEntity->GetFlagsExtended() & ENTITY_FLAG_EXTENDED_AUDIO_LISTENER) > 0) { Matrix34 position = tm; position += CVar::audioListenerOffset; if (!s_audioListenerLastTransformation.IsEquivalent(position, 0.01f)) { s_audioListenerLastTransformation = position; SAudioRequest oRequest; oRequest.nFlags = eARF_PRIORITY_NORMAL; oRequest.pOwner = this; SAudioListenerRequestData<eALRT_SET_POSITION> oRequestData(s_audioListenerLastTransformation); oRequest.pData = &oRequestData; gEnv->pAudioSystem->PushRequest(oRequest); // As this is an audio listener add its entity to the AreaManager for raising audio relevant events. gEnv->pEntitySystem->GetAreaManager()->MarkEntityForUpdate(m_pEntity->GetId()); } } }
void CEntityAudioProxy::OnMove() { Matrix34 tm = m_pEntity->GetWorldTM(); if (tm.IsValid()) { SATLWorldPosition const oPosition(tm, ZERO); std::for_each(m_mapAuxAudioProxies.begin(), m_mapAuxAudioProxies.end(), SRepositionAudioProxy(oPosition)); if ((m_pEntity->GetFlagsExtended() & ENTITY_FLAG_EXTENDED_AUDIO_LISTENER) != 0) { SAudioRequest oRequest; oRequest.nFlags = eARF_PRIORITY_NORMAL; oRequest.pOwner = this; SAudioListenerRequestData<eALRT_SET_POSITION> oRequestData(oPosition); oRequest.pData = &oRequestData; gEnv->pAudioSystem->PushRequest(oRequest); // As this is an audio listener add its entity to the AreaManager for raising audio relevant events. gEnv->pEntitySystem->GetAreaManager()->MarkEntityForUpdate(m_pEntity->GetId()); } } REINST("voice attachement lookup needs to be done by code creating entityaudioproxy for voice line on character"); //if (m_nAttachmentIndex != -1) //{ // if (ICharacterInstance* const pCharacter = m_pEntity->GetCharacter(0)) // { // if (m_nAttachmentIndex != -1) // { // if (IAttachmentManager const* const pAttachmentManager = pCharacter->GetIAttachmentManager()) // { // if (IAttachment const* const pAttachment = pAttachmentManager->GetInterfaceByIndex(m_nAttachmentIndex)) // { // tm = Matrix34(pAttachment->GetAttWorldAbsolute()); // } // } // } // else if (m_nBoneHead != -1) // { // // re-query SkeletonPose to prevent crash on removed Character // if (ISkeletonPose* const pSkeletonPose = pCharacter->GetISkeletonPose()) // { // tm = tm * Matrix34(pSkeletonPose->GetAbsJointByID(m_nBoneHead)); // } // } // } //} }