Take vanilla/TRNG stuff out of Tracks.lua (which is now no longer needed) and partially replicate it in the C++ side of things.

This commit is contained in:
hispidence 2022-01-30 18:04:36 +00:00
parent 4d8fbe279c
commit 14f0b710fb
6 changed files with 44 additions and 35 deletions

View file

@ -85,17 +85,6 @@ settings.lua shouldn't be bundled with any finished levels/games.
*/
m_lua->set_function("SetAnimations", &GameFlow::SetAnimations, this);
/*** tracks.lua.
__TODO CONFIRM PROPER BEHAVIOUR__
@section trackslua
*/
/***
@function SetAudioTracks
@tparam table table array-style table with @{AudioTrack} objects
*/
//TODO confirm proper behaviour
m_lua->set_function("SetAudioTracks", &GameFlow::SetAudioTracks, this);
/*** strings.lua.
These functions used in strings.lua, which is generated by TombIDE.
You will not need to call them manually.
@ -181,24 +170,9 @@ void GameFlow::SetGameFarView(byte val)
}
}
void GameFlow::SetAudioTracks(sol::as_table_t<std::vector<GameScriptAudioTrack>>&& src)
{
std::vector<GameScriptAudioTrack> tracks = std::move(src);
SoundTracks.clear();
for (auto t : tracks) {
SoundTrackInfo track;
track.Name = t.trackName;
track.Mask = 0;
track.Mode = t.looped ? SOUNDTRACK_PLAYTYPE::BGM : SOUNDTRACK_PLAYTYPE::OneShot;
SoundTracks.push_back(track);
}
}
void GameFlow::LoadGameFlowScript()
{
ExecuteScript("Scripts/Enums.lua");
ExecuteScript("Scripts/Tracks.lua");
ExecuteScript("Scripts/Gameflow.lua");
ExecuteScript("Scripts/Strings.lua");
ExecuteScript("Scripts/Settings.lua");

View file

@ -38,7 +38,6 @@ public:
~GameFlow();
void AddLevel(GameScriptLevel const& level);
void SetAudioTracks(sol::as_table_t<std::vector<GameScriptAudioTrack>>&& src);
void LoadGameFlowScript();
char const * GetString(const char* id) const;
void SetStrings(sol::nested<std::unordered_map<std::string, std::vector<std::string>>> && src);