Made LUA script optional; Deleted my bugged test code for volumes;

This commit is contained in:
MontyTRC89 2021-07-06 11:54:34 +02:00
parent 7daed7abb6
commit 99f476f3b9
2 changed files with 15 additions and 10 deletions

View file

@ -815,8 +815,11 @@ GAME_STATUS DoLevel(int index, std::string ambient, bool loadFromSavegame)
GameScriptLevel* level = g_GameFlow->Levels[index];
std::string err;
g_GameScript->ExecuteScript(level->ScriptFileName, err);
g_GameScript->InitCallbacks();
if (!level->ScriptFileName.empty())
{
g_GameScript->ExecuteScript(level->ScriptFileName, err);
g_GameScript->InitCallbacks();
}
// Restore the game?
if (loadFromSavegame)
@ -955,10 +958,7 @@ void TestTriggers(short *data, int heavy, int HeavyFlags)
{
// Execute trigger
//g_GameScript->ExecuteScript();
Lara.gunType = WEAPON_UZI;
}
else
Lara.gunType = WEAPON_NONE;
/*if (volumeBox.Intersects(laraBox))
{

View file

@ -407,27 +407,32 @@ static void doCallback(sol::protected_function const & func) {
void GameScript::OnStart()
{
doCallback(m_onStart);
if (m_onStart.valid())
doCallback(m_onStart);
}
void GameScript::OnLoad()
{
doCallback(m_onLoad);
if (m_onLoad.valid())
doCallback(m_onLoad);
}
void GameScript::OnControlPhase()
{
doCallback(m_onControlPhase);
if (m_onControlPhase.valid())
doCallback(m_onControlPhase);
}
void GameScript::OnSave()
{
doCallback(m_onSave);
if (m_onSave.valid())
doCallback(m_onSave);
}
void GameScript::OnEnd()
{
doCallback(m_onEnd);
if (m_onEnd.valid())
doCallback(m_onEnd);
}
void GameScript::InitCallbacks()