]> git.tdb.fi Git - libs/demoscene.git/blobdiff - source/sequencer.cpp
Allow specifying one-off actions inside segments
[libs/demoscene.git] / source / sequencer.cpp
index 8bca70bb368764d7a94058b95aaf595623a95913..0297c4397ff254bf30d26d95a44f4ec7909a1122 100644 (file)
@@ -1,6 +1,7 @@
 #include <cmath>
 #include <msp/core/algorithm.h>
 #include <msp/core/maputils.h>
+#include "animate.h"
 #include "fadeoverlay.h"
 #include "sequencer.h"
 #include "stage.h"
@@ -15,8 +16,10 @@ Sequencer::Sequencer(float bpm):
 {
        set_beats_per_minute(bpm);
 
+       register_action_type<Animate>("animate");
        register_action_type<FadeOverlay::Fade>("fade");
        register_action_type<Stage::UseInView>("use_stage");
+       register_action_type<Stage::SetCamera>("set_camera");
 }
 
 void Sequencer::set_beats_per_minute(float bpm)
@@ -156,7 +159,7 @@ void Sequencer::Loader::instant(float beat)
 
 void Sequencer::Loader::segment(float start, float end)
 {
-       SegmentLoader ldr(obj, start, end);
+       SegmentLoader ldr(obj, start, end, demo);
        load_sub_with(ldr);
 }
 
@@ -166,7 +169,7 @@ Sequencer::ActionDefLoader::ActionDefLoader(Sequencer &s, Demo &d):
        demo(d)
 {
        for(const auto &t: obj.action_types)
-               add(t.first, t.second->get_loader_func());
+               add(t.first, t.second->get_def_loader_func());
 }
 
 void Sequencer::ActionDefLoader::finished()
@@ -176,12 +179,15 @@ void Sequencer::ActionDefLoader::finished()
 }
 
 
-Sequencer::SegmentLoader::SegmentLoader(Sequencer &s, float b, float e):
+Sequencer::SegmentLoader::SegmentLoader(Sequencer &s, float b, float e, Demo &d):
        ObjectLoader<Sequencer>(s),
        start_beat(b),
-       end_beat(e)
+       end_beat(e),
+       demo(d)
 {
        add("apply", &SegmentLoader::apply);
+       for(const auto &t: obj.action_types)
+               add(t.first, t.second->get_loader_func());
 }
 
 void Sequencer::SegmentLoader::apply(const string &n)