From 31dc0e443efc0aae48e11a0d98e699dbed5c7dcf Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 10 Feb 2021 12:11:27 -0500 Subject: Added fade out around map change Also moved script system first in the loop so that the camera can catch up before rendering. Also added a map change from map 2 back to map 1. --- src/script_system.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/script_system.cpp') diff --git a/src/script_system.cpp b/src/script_system.cpp index 6e38905..a5e9403 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp @@ -56,6 +56,12 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { game_.loadMap(filename, warpPoint); }); + engine_.set_function( + "setFadeoutProgress", + [&] (double val) { + game_.setFadeoutProgress(val); + }); + engine_.script_file("../res/scripts/common.lua"); } @@ -64,7 +70,7 @@ void ScriptSystem::tick(double dt) { auto result = (*callable_)(dt); if (!result.valid()) { sol::error e = result; - throw std::runtime_error(e.what()); + throw e; } if (!*callable_) { @@ -90,7 +96,7 @@ void ScriptSystem::runScript(std::string name) { auto result = (*callable_)(); if (!result.valid()) { sol::error e = result; - throw std::runtime_error(e.what()); + throw e; } if (!*callable_) { -- cgit 1.4.1