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

View file

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