void CSoundPlayer::Play3DSoundByName(CCharacterFollower* pAttacker, string strSoundName) { if (strSoundName.empty()) return; CRenderObject* pRenderObject = pAttacker->GetRenderObject(); if (NULL == pRenderObject) return; CVector3f pos = pRenderObject->GetCenterPosition(); const static CVector3f nullVel; Play3DCue(strSoundName.c_str(), pos, nullVel); }
//------------------------------------------------------------------------------ void CSoundPlayer::PlayFootstep(CCharacterFollower* pCharacter, string strCueNameTail) { if (NULL == pCharacter) return; CRenderObject* pRenderObject = pCharacter->GetRenderObject(); if (NULL == pRenderObject) return; string strCueName(""), strName(""); if (pCharacter->CppGetCtrlState(eFCS_InNormalHorse) || pCharacter->CppGetCtrlState(eFCS_InBattleHorse)) { strName = pCharacter->GetHorseName(); } else { strName = GetNameByCharacter(pCharacter); if (strName.empty()) return; if (!strCueNameTail.empty()) strCueNameTail = ""; } CSoundConfig* pSoundCfg = CSoundConfig::GetSoundCfg(strName); if (!pSoundCfg) return; strCueName = pSoundCfg->GetFootstepSound(); if (strCueName.empty()) return; int32 uMeterialID = pCharacter->GetHorseRenderObj()->GetTerrainMaterialIndex(); string strMeterial = CSoundConfig::GetMeterialString(uMeterialID); if (strMeterial.empty()) return; strCueName = strMeterial + "_" + strCueName; if (strCueNameTail != "") strCueName = strCueName + strCueNameTail; CVector3f pos = pRenderObject->GetCenterPosition(); const static CVector3f nullVel; Play3DCue(strCueName.c_str(), pos, nullVel); }