Register SetAmbientTrack and PlayAudioTrack. Make PlayAudioTrack static, pass its string arg by reference-to-const, and let it use the loop bool passed in instead of the one stored in global state.

Improve some text formatting in the header.
This commit is contained in:
hispidence 2021-07-04 14:33:57 +01:00
parent 9386993bcd
commit 33dcd85a06
2 changed files with 13 additions and 10 deletions

View file

@ -18,6 +18,9 @@ extern bool const WarningsAsErrors = true;
GameScript::GameScript(sol::state* lua) : LuaHandler{ lua }
{
m_lua->set_function("SetAmbientTrack", &GameScript::SetAmbientTrack);
m_lua->set_function("PlayAudioTrack", &GameScript::PlayAudioTrack);
GameScriptItemInfo::Register(m_lua);
GameScriptPosition::Register(m_lua);
GameScriptRotation::Register(m_lua);
@ -224,9 +227,9 @@ std::unique_ptr<GameScriptItemInfo> GameScript::GetItemByName(std::string name)
return std::make_unique<GameScriptItemInfo>(m_itemsMapName[name]);
}
void GameScript::PlayAudioTrack(std::string trackName, bool looped)
void GameScript::PlayAudioTrack(std::string const & trackName, bool looped)
{
S_CDPlay(trackName, g_AudioTracks[trackName].looped);
S_CDPlay(trackName, looped);
}
void GameScript::PlaySoundEffect(int id, GameScriptPosition p, int flags)

View file

@ -81,10 +81,10 @@ public:
void ResetVariables();
// Sound
void PlayAudioTrack(std::string trackName, bool looped);
static void PlayAudioTrack(std::string const & trackName, bool looped);
void PlaySoundEffect(int id, GameScriptPosition pos, int flags);
void PlaySoundEffect(int id, int flags);
void SetAmbientTrack(std::string const & trackName);
static void SetAmbientTrack(std::string const & trackName);
// Special FX
void AddLightningArc(GameScriptPosition src, GameScriptPosition dest, GameScriptColor color, int lifetime, int amplitude, int beamWidth, int segments, int flags);