1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-30 12:32:36 +00:00

Move current music from MechanicsManager to SoundManager

This commit is contained in:
Andrei Kortunov 2024-06-02 09:29:28 +04:00
parent a2e83d9a21
commit e762ae9703
5 changed files with 4 additions and 17 deletions

View File

@ -27,11 +27,6 @@ namespace ESM
class ESMWriter;
}
namespace MWSound
{
enum class MusicType;
}
namespace MWWorld
{
class Ptr;
@ -312,9 +307,6 @@ namespace MWBase
virtual float getAngleToPlayer(const MWWorld::Ptr& ptr) const = 0;
virtual MWMechanics::GreetingState getGreetingState(const MWWorld::Ptr& ptr) const = 0;
virtual bool isTurningToPlayer(const MWWorld::Ptr& ptr) const = 0;
virtual MWSound::MusicType getMusicType() const = 0;
virtual void setMusicType(MWSound::MusicType type) = 0;
};
}

View File

@ -250,7 +250,6 @@ namespace MWMechanics
, mClassSelected(false)
, mRaceSelected(false)
, mAI(true)
, mMusicType(MWSound::MusicType::Normal)
{
// buildPlayer no longer here, needs to be done explicitly after all subsystems are up and running
}

View File

@ -38,8 +38,6 @@ namespace MWMechanics
typedef std::map<ESM::RefId, OwnerMap> StolenItemsMap;
StolenItemsMap mStolenItems;
MWSound::MusicType mMusicType;
public:
void buildPlayer();
///< build player according to stored class/race/birthsign information. Will
@ -245,9 +243,6 @@ namespace MWMechanics
GreetingState getGreetingState(const MWWorld::Ptr& ptr) const override;
bool isTurningToPlayer(const MWWorld::Ptr& ptr) const override;
MWSound::MusicType getMusicType() const override { return mMusicType; }
void setMusicType(MWSound::MusicType type) override { mMusicType = type; }
private:
bool canCommitCrimeAgainst(const MWWorld::Ptr& victim, const MWWorld::Ptr& attacker);
bool canReportCrime(

View File

@ -115,6 +115,7 @@ namespace MWSound
, mOutput(std::make_unique<OpenAL_Output>(*this))
, mWaterSoundUpdater(makeWaterSoundUpdaterSettings())
, mSoundBuffers(*mOutput)
, mMusicType(MWSound::MusicType::Normal)
, mListenerUnderwater(false)
, mListenerPos(0, 0, 0)
, mListenerDir(1, 0, 0)
@ -307,10 +308,10 @@ namespace MWSound
const auto mechanicsManager = MWBase::Environment::get().getMechanicsManager();
// Can not interrupt scripted music by built-in playlists
if (mechanicsManager->getMusicType() == MusicType::MWScript && type != MusicType::MWScript)
if (mMusicType == MusicType::MWScript && type != MusicType::MWScript)
return;
mechanicsManager->setMusicType(type);
mMusicType = type;
advanceMusic(filename, fade);
}

View File

@ -86,7 +86,7 @@ namespace MWSound
TrackList mActiveTracks;
StreamPtr mMusic;
VFS::Path::Normalized mCurrentPlaylist;
MusicType mMusicType;
bool mListenerUnderwater;
osg::Vec3f mListenerPos;