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 b7d2a45a29
commit 47f5745304
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)