summary refs log tree commit diff stats
path: root/src/script_system.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-10 12:11:27 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-02-10 12:11:27 -0500
commit31dc0e443efc0aae48e11a0d98e699dbed5c7dcf (patch)
tree17e044698531fc1af82dddcbd144ae93d3ae0252 /src/script_system.cpp
parentfb58cb31804da7e5e40fc861927060a183962441 (diff)
downloadtanetane-31dc0e443efc0aae48e11a0d98e699dbed5c7dcf.tar.gz
tanetane-31dc0e443efc0aae48e11a0d98e699dbed5c7dcf.tar.bz2
tanetane-31dc0e443efc0aae48e11a0d98e699dbed5c7dcf.zip
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.
Diffstat (limited to 'src/script_system.cpp')
-rw-r--r--src/script_system.cpp10
1 files changed, 8 insertions, 2 deletions
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) {
56 game_.loadMap(filename, warpPoint); 56 game_.loadMap(filename, warpPoint);
57 }); 57 });
58 58
59 engine_.set_function(
60 "setFadeoutProgress",
61 [&] (double val) {
62 game_.setFadeoutProgress(val);
63 });
64
59 engine_.script_file("../res/scripts/common.lua"); 65 engine_.script_file("../res/scripts/common.lua");
60} 66}
61 67
@@ -64,7 +70,7 @@ void ScriptSystem::tick(double dt) {
64 auto result = (*callable_)(dt); 70 auto result = (*callable_)(dt);
65 if (!result.valid()) { 71 if (!result.valid()) {
66 sol::error e = result; 72 sol::error e = result;
67 throw std::runtime_error(e.what()); 73 throw e;
68 } 74 }
69 75
70 if (!*callable_) { 76 if (!*callable_) {
@@ -90,7 +96,7 @@ void ScriptSystem::runScript(std::string name) {
90 auto result = (*callable_)(); 96 auto result = (*callable_)();
91 if (!result.valid()) { 97 if (!result.valid()) {
92 sol::error e = result; 98 sol::error e = result;
93 throw std::runtime_error(e.what()); 99 throw e;
94 } 100 }
95 101
96 if (!*callable_) { 102 if (!*callable_) {