mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-08 03:28:03 +03:00
Add ExecuteScriptFile();
This commit is contained in:
parent
106c3ef0d8
commit
2f9c8c6894
3 changed files with 8 additions and 2 deletions
|
@ -474,7 +474,7 @@ GAME_STATUS DoTitle(int index)
|
||||||
std::string err;
|
std::string err;
|
||||||
if (!level->ScriptFileName.empty())
|
if (!level->ScriptFileName.empty())
|
||||||
{
|
{
|
||||||
g_GameScript->ExecuteScript(level->ScriptFileName);
|
g_GameScript->ExecuteScriptFile(level->ScriptFileName);
|
||||||
g_GameScript->InitCallbacks();
|
g_GameScript->InitCallbacks();
|
||||||
g_GameScript->SetCallbackDrawString([](std::string const key, D3DCOLOR col, int x, int y, int flags)
|
g_GameScript->SetCallbackDrawString([](std::string const key, D3DCOLOR col, int x, int y, int flags)
|
||||||
{
|
{
|
||||||
|
@ -588,7 +588,7 @@ GAME_STATUS DoLevel(int index, std::string ambient, bool loadFromSavegame)
|
||||||
|
|
||||||
if (!level->ScriptFileName.empty())
|
if (!level->ScriptFileName.empty())
|
||||||
{
|
{
|
||||||
g_GameScript->ExecuteScript(level->ScriptFileName);
|
g_GameScript->ExecuteScriptFile(level->ScriptFileName);
|
||||||
g_GameScript->InitCallbacks();
|
g_GameScript->InitCallbacks();
|
||||||
g_GameScript->SetCallbackDrawString([](std::string const key, D3DCOLOR col, int x, int y, int flags)
|
g_GameScript->SetCallbackDrawString([](std::string const key, D3DCOLOR col, int x, int y, int flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -678,6 +678,11 @@ void LuaVariables::SetVariable(sol::table tab, std::string key, sol::object valu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameScript::ExecuteScriptFile(const std::string & luaFilename)
|
||||||
|
{
|
||||||
|
ExecuteScript(luaFilename);
|
||||||
|
}
|
||||||
|
|
||||||
void GameScript::ExecuteFunction(std::string const & name)
|
void GameScript::ExecuteFunction(std::string const & name)
|
||||||
{
|
{
|
||||||
sol::protected_function func = (*m_lua)["LevelFuncs"][name.c_str()];
|
sol::protected_function func = (*m_lua)["LevelFuncs"][name.c_str()];
|
||||||
|
|
|
@ -85,6 +85,7 @@ std::optional<std::reference_wrapper<UserDisplayString>> GetDisplayString(Displa
|
||||||
void AssignItemsAndLara();
|
void AssignItemsAndLara();
|
||||||
|
|
||||||
|
|
||||||
|
void ExecuteScriptFile(const std::string& luaFilename);
|
||||||
void ExecuteFunction(std::string const & name);
|
void ExecuteFunction(std::string const & name);
|
||||||
void MakeItemInvisible(short id);
|
void MakeItemInvisible(short id);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue