diff options
Diffstat (limited to 'src/script_system.cpp')
| -rw-r--r-- | src/script_system.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
| diff --git a/src/script_system.cpp b/src/script_system.cpp index 08d66d4..7109d98 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include "animation_system.h" | 5 | #include "animation_system.h" |
| 6 | #include "character_system.h" | 6 | #include "character_system.h" |
| 7 | #include "transform_system.h" | 7 | #include "transform_system.h" |
| 8 | #include "effect_system.h" | ||
| 8 | #include "vector.h" | 9 | #include "vector.h" |
| 9 | 10 | ||
| 10 | ScriptSystem::ScriptSystem(Game& game) : game_(game) { | 11 | ScriptSystem::ScriptSystem(Game& game) : game_(game) { |
| @@ -31,6 +32,7 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { | |||
| 31 | "message", | 32 | "message", |
| 32 | "displayMessage", &MessageSystem::displayMessage, | 33 | "displayMessage", &MessageSystem::displayMessage, |
| 33 | "showChoice", &MessageSystem::showChoice, | 34 | "showChoice", &MessageSystem::showChoice, |
| 35 | "displayCutsceneBars", &MessageSystem::displayCutsceneBars, | ||
| 34 | "hideCutsceneBars", &MessageSystem::hideCutsceneBars, | 36 | "hideCutsceneBars", &MessageSystem::hideCutsceneBars, |
| 35 | "isMessageActive", sol::property(&MessageSystem::isMessageActive), | 37 | "isMessageActive", sol::property(&MessageSystem::isMessageActive), |
| 36 | "getChoiceSelection", &MessageSystem::getChoiceSelection); | 38 | "getChoiceSelection", &MessageSystem::getChoiceSelection); |
| @@ -52,6 +54,13 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { | |||
| 52 | transform.initSprite(spriteId, vec2i{x, y}, layer); | 54 | transform.initSprite(spriteId, vec2i{x, y}, layer); |
| 53 | }); | 55 | }); |
| 54 | 56 | ||
| 57 | engine_.new_usertype<EffectSystem>( | ||
| 58 | "effect", | ||
| 59 | "fadeScreen", &EffectSystem::fadeScreen, | ||
| 60 | "isScreenFadeComplete", &EffectSystem::isScreenFadeComplete, | ||
| 61 | "fadeMap", &EffectSystem::fadeMap, | ||
| 62 | "isMapFadeComplete", &EffectSystem::isMapFadeComplete); | ||
| 63 | |||
| 55 | engine_.new_usertype<Mixer>( | 64 | engine_.new_usertype<Mixer>( |
| 56 | "mixer", | 65 | "mixer", |
| 57 | "playSound", &Mixer::playSound, | 66 | "playSound", &Mixer::playSound, |
| @@ -83,6 +92,12 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { | |||
| 83 | }); | 92 | }); |
| 84 | 93 | ||
| 85 | engine_.set_function( | 94 | engine_.set_function( |
| 95 | "effect", | ||
| 96 | [&] () -> EffectSystem& { | ||
| 97 | return game_.getSystem<EffectSystem>(); | ||
| 98 | }); | ||
| 99 | |||
| 100 | engine_.set_function( | ||
| 86 | "mixer", | 101 | "mixer", |
| 87 | [&] () -> Mixer& { | 102 | [&] () -> Mixer& { |
| 88 | return game_.getMixer(); | 103 | return game_.getMixer(); |
| @@ -130,12 +145,6 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { | |||
| 130 | game_.loadMap(filename, warpPoint, dir); | 145 | game_.loadMap(filename, warpPoint, dir); |
| 131 | }); | 146 | }); |
| 132 | 147 | ||
| 133 | engine_.set_function( | ||
| 134 | "setFadeoutProgress", | ||
| 135 | [&] (double val) { | ||
| 136 | game_.setFadeoutProgress(val); | ||
| 137 | }); | ||
| 138 | |||
| 139 | engine_.script_file("../res/scripts/common.lua"); | 148 | engine_.script_file("../res/scripts/common.lua"); |
| 140 | } | 149 | } |
| 141 | 150 | ||
