From 1656242563d14fa564bab8d4bc40054ab8998553 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 27 Feb 2021 12:05:45 -0500 Subject: Added background music (defined on a per-map basis) --- src/script_system.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/script_system.cpp') diff --git a/src/script_system.cpp b/src/script_system.cpp index 1846de2..7f9f908 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp @@ -97,7 +97,17 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { "mixer", "playSound", &Mixer::playSound, "loopSound", &Mixer::loopSound, - "stopChannel", &Mixer::stopChannel); + "stopChannel", &Mixer::stopChannel, + "playMusic", &Mixer::playMusic, + "fadeoutMusic", &Mixer::fadeoutMusic, + "isPlayingMusic", &Mixer::isPlayingMusic, + "getPlayingTrack", &Mixer::getPlayingTrack); + + engine_.new_usertype( + "map", + "getWarpPoint", &Map::getWarpPoint, + "hasMusic", &Map::hasMusic, + "getMusic", &Map::getMusic); engine_.set_function( "message", @@ -190,9 +200,9 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { }); engine_.set_function( - "getWarpPoint", - [&] (std::string warp) { - return game_.getMap().getWarpPoint(warp); + "getMap", + [&] () -> const Map& { + return game_.getMap(); }); engine_.set_function( -- cgit 1.4.1