forked from metin-server/m2dev-client-src
New sound system & removed miles
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "StdAfx.h"
|
||||
#include "../effectLib/EffectManager.h"
|
||||
#include "../milesLib/SoundManager.h"
|
||||
#include "../AudioLib/SoundEngine.h"
|
||||
|
||||
#include "ActorInstance.h"
|
||||
#include "RaceData.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "StdAfx.h"
|
||||
#include "../EffectLib/EffectManager.h"
|
||||
#include "../milesLib/SoundManager.h"
|
||||
#include "../AudioLib/SoundEngine.h"
|
||||
|
||||
#include "ActorInstance.h"
|
||||
#include "FlyingObjectManager.h"
|
||||
@@ -29,9 +29,9 @@ void CActorInstance::SoundEventProcess(BOOL bCheckFrequency)
|
||||
if (!m_pkCurRaceMotionData)
|
||||
return;
|
||||
|
||||
const TSoundInstanceVector* c_pkVct_kSndInst = m_pkCurRaceMotionData->GetSoundInstanceVectorPointer();
|
||||
UpdateSoundInstance(m_kCurMotNode.dwcurFrame, *c_pkVct_kSndInst,
|
||||
m_x, m_y, m_z, bCheckFrequency);
|
||||
const NSound::TSoundInstanceVector* c_pkVct_kSndInst = m_pkCurRaceMotionData->GetSoundInstanceVectorPointer();
|
||||
SoundEngine::Instance().UpdateSoundInstance(m_x, m_y, m_z, m_kCurMotNode.dwcurFrame, c_pkVct_kSndInst,
|
||||
bCheckFrequency, m_isMain);
|
||||
}
|
||||
|
||||
void CActorInstance::MotionEventProcess(DWORD dwcurFrame, int iIndex, const CRaceMotionData::TMotionEventData * c_pData)
|
||||
@@ -247,7 +247,7 @@ void CActorInstance::ProcessMotionEventSound(const CRaceMotionData::TMotionEvent
|
||||
const CRaceMotionData::TMotionSoundEventData * c_pSoundData = (const CRaceMotionData::TMotionSoundEventData *)c_pData;
|
||||
|
||||
Tracenf("PLAY SOUND: %s", c_pSoundData->strSoundFileName.c_str());
|
||||
CSoundManager::Instance().PlaySound3D(m_x, m_y, m_z, c_pSoundData->strSoundFileName.c_str());
|
||||
SoundEngine::Instance().PlaySound3D(c_pSoundData->strSoundFileName.c_str(), m_x, m_y, m_z);
|
||||
}
|
||||
|
||||
void CActorInstance::ProcessMotionEventFly(const CRaceMotionData::TMotionEventData * c_pData)
|
||||
|
||||
@@ -1316,27 +1316,27 @@ void CArea::TAmbienceInstance::__Update(float fxCenter, float fyCenter, float fz
|
||||
void CArea::TAmbienceInstance::UpdateOnceSound(float fxCenter, float fyCenter, float fzCenter)
|
||||
{
|
||||
float fDistance = sqrtf((fx - fxCenter)*(fx - fxCenter) + (fy - fyCenter)*(fy - fyCenter) + (fz - fzCenter)*(fz - fzCenter));
|
||||
if (DWORD(fDistance) < dwRange)
|
||||
if (uint32_t(fDistance) < dwRange)
|
||||
{
|
||||
if (!pSample)
|
||||
if (!playSoundInstance)
|
||||
{
|
||||
if (AmbienceData.AmbienceSoundVector.empty())
|
||||
return;
|
||||
|
||||
const char * c_szFileName = AmbienceData.AmbienceSoundVector[0].c_str();
|
||||
pSample = CSoundManager::Instance().PlayAmbienceSound3D(fx, fy, fz, c_szFileName);
|
||||
// Tracef(" %d : OncePlay [%f] : %s\n", iPlaySoundIndex, fDistance, c_szFileName);
|
||||
const char* c_szFileName = AmbienceData.AmbienceSoundVector[0].c_str();
|
||||
playSoundInstance = SoundEngine::Instance().PlayAmbienceSound3D(fx, fy, fz, c_szFileName);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (playSoundInstance)
|
||||
{
|
||||
pSample.reset();
|
||||
playSoundInstance->Stop();
|
||||
playSoundInstance = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void CArea::TAmbienceInstance::UpdateStepSound(float fxCenter, float fyCenter, float fzCenter)
|
||||
{
|
||||
float fDistance = sqrtf((fx - fxCenter)*(fx - fxCenter) + (fy - fyCenter)*(fy - fyCenter) + (fz - fzCenter)*(fz - fzCenter));
|
||||
float fDistance = sqrtf((fx - fxCenter) * (fx - fxCenter) + (fy - fyCenter) * (fy - fyCenter) + (fz - fzCenter) * (fz - fzCenter));
|
||||
if (DWORD(fDistance) < dwRange)
|
||||
{
|
||||
float fcurTime = CTimer::Instance().GetCurrentSecond();
|
||||
@@ -1346,9 +1346,8 @@ void CArea::TAmbienceInstance::UpdateStepSound(float fxCenter, float fyCenter, f
|
||||
if (AmbienceData.AmbienceSoundVector.empty())
|
||||
return;
|
||||
|
||||
const char * c_szFileName = AmbienceData.AmbienceSoundVector[0].c_str();
|
||||
pSample = CSoundManager::Instance().PlayAmbienceSound3D(fx, fy, fz, c_szFileName);
|
||||
// Tracef(" %d : StepPlay [%f] : %s\n", iPlaySoundIndex, fDistance, c_szFileName);
|
||||
const char* c_szFileName = AmbienceData.AmbienceSoundVector[0].c_str();
|
||||
playSoundInstance = SoundEngine::Instance().PlayAmbienceSound3D(fx, fy, fz, c_szFileName);
|
||||
|
||||
fNextPlayTime = CTimer::Instance().GetCurrentSecond();
|
||||
fNextPlayTime += AmbienceData.fPlayInterval + frandom(0.0f, AmbienceData.fPlayIntervalVariation);
|
||||
@@ -1356,7 +1355,7 @@ void CArea::TAmbienceInstance::UpdateStepSound(float fxCenter, float fyCenter, f
|
||||
}
|
||||
else
|
||||
{
|
||||
pSample.reset();
|
||||
playSoundInstance = nullptr;
|
||||
fNextPlayTime = 0.0f;
|
||||
}
|
||||
}
|
||||
@@ -1364,20 +1363,24 @@ void CArea::TAmbienceInstance::UpdateStepSound(float fxCenter, float fyCenter, f
|
||||
void CArea::TAmbienceInstance::UpdateLoopSound(float fxCenter, float fyCenter, float fzCenter)
|
||||
{
|
||||
float fDistance = sqrtf((fx - fxCenter) * (fx - fxCenter) + (fy - fyCenter) * (fy - fyCenter) + (fz - fzCenter) * (fz - fzCenter));
|
||||
if (DWORD(fDistance) < dwRange)
|
||||
if (uint32_t(fDistance) < dwRange)
|
||||
{
|
||||
if (!pSample)
|
||||
if (!playSoundInstance)
|
||||
{
|
||||
pSample = CSoundManager::Instance().PlayAmbienceSound3D(fx, fy, fz, AmbienceData.AmbienceSoundVector[0], 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
pSample->SetVolume(__GetVolumeFromDistance(fDistance));
|
||||
if (AmbienceData.AmbienceSoundVector.empty())
|
||||
return;
|
||||
|
||||
const char* c_szFileName = AmbienceData.AmbienceSoundVector[0].c_str();
|
||||
playSoundInstance = SoundEngine::Instance().PlayAmbienceSound3D(fx, fy, fz, c_szFileName, 0);
|
||||
}
|
||||
|
||||
if (playSoundInstance)
|
||||
playSoundInstance->SetVolume(__GetVolumeFromDistance(fDistance));
|
||||
}
|
||||
else
|
||||
else if (playSoundInstance)
|
||||
{
|
||||
pSample.reset();
|
||||
playSoundInstance->Stop();
|
||||
playSoundInstance = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class CArea
|
||||
float fx, fy, fz;
|
||||
DWORD dwRange;
|
||||
float fMaxVolumeAreaPercentage;
|
||||
std::unique_ptr<SoundSample> pSample;
|
||||
MaSoundInstance* playSoundInstance;
|
||||
float fNextPlayTime;
|
||||
prt::TPropertyAmbience AmbienceData;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
class CProperty;
|
||||
|
||||
#include "../eterLib/SkyBox.h"
|
||||
#include "../mileslib/SoundManager.h"
|
||||
#include "../AudioLib/SoundEngine.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Property
|
||||
|
||||
@@ -295,7 +295,7 @@ float CRaceMotionData::GetEventStartTime(DWORD dwIndex) const
|
||||
return m_MotionEventDataVector[dwIndex]->fStartingTime;
|
||||
}
|
||||
|
||||
const TSoundInstanceVector * CRaceMotionData::GetSoundInstanceVectorPointer() const
|
||||
const NSound::TSoundInstanceVector * CRaceMotionData::GetSoundInstanceVectorPointer() const
|
||||
{
|
||||
return &m_SoundInstanceVector;
|
||||
}
|
||||
@@ -553,7 +553,7 @@ bool CRaceMotionData::SaveMotionData(const char * c_szFileName)
|
||||
#endif
|
||||
bool CRaceMotionData::LoadSoundScriptData(const char * c_szFileName)
|
||||
{
|
||||
TSoundDataVector SoundDataVector;
|
||||
NSound::TSoundDataVector SoundDataVector;
|
||||
if (!LoadSoundInformationPiece(c_szFileName, SoundDataVector))
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "MilesLib/Type.h"
|
||||
#include "AudioLib/Type.h"
|
||||
#include "RaceMotionDataEvent.h"
|
||||
|
||||
class CRaceMotionData
|
||||
@@ -253,7 +253,7 @@ class CRaceMotionData
|
||||
float GetEventStartTime(DWORD dwIndex) const;
|
||||
|
||||
// Sound Data
|
||||
const TSoundInstanceVector * GetSoundInstanceVectorPointer() const;
|
||||
const NSound::TSoundInstanceVector * GetSoundInstanceVectorPointer() const;
|
||||
|
||||
// File
|
||||
#ifdef WORLD_EDITOR
|
||||
@@ -291,7 +291,7 @@ class CRaceMotionData
|
||||
BOOL m_bCancelEnableSkill;
|
||||
|
||||
TMotionEventDataVector m_MotionEventDataVector;
|
||||
TSoundInstanceVector m_SoundInstanceVector;
|
||||
NSound::TSoundInstanceVector m_SoundInstanceVector;
|
||||
|
||||
private:
|
||||
BOOL m_hasSplashEvent;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "../eterBase/Random.h"
|
||||
|
||||
#include "../eterLib/StdAfx.h"
|
||||
#include "../milesLib/StdAfx.h"
|
||||
#include "../AudioLib/StdAfx.h"
|
||||
#include "../effectLib/StdAfx.h"
|
||||
|
||||
#include "GameType.h"
|
||||
|
||||
Reference in New Issue
Block a user