#include <cmath>
#include <msp/core/algorithm.h>
#include <msp/core/maputils.h>
+#include <msp/core/raii.h>
#include "animate.h"
#include "fadeoverlay.h"
#include "sequencer.h"
Sequencer::Loader::Loader(Sequencer &s, Demo &d):
DataFile::ObjectLoader<Sequencer>(s),
- demo(d)
+ demo(d),
+ base_beat(0.0f)
{
+ add("base", &Loader::base);
add("define_action", &Loader::define_action);
add("instant", &Loader::instant);
add("segment", &Loader::segment);
}
+void Sequencer::Loader::base(float b)
+{
+ SetForScope<float> set_base(base_beat, base_beat+b);
+ load_sub_with(*this);
+}
+
void Sequencer::Loader::define_action(const string &n)
{
ActionDefLoader ldr(obj, demo);
void Sequencer::Loader::segment(float start, float end)
{
- SegmentLoader ldr(obj, start, end, demo);
+ SegmentLoader ldr(obj, base_beat+start, base_beat+end, demo);
load_sub_with(ldr);
}
{
private:
Demo &demo;
+ float base_beat;
public:
Loader(Sequencer &, Demo &);
private:
+ void base(float);
void define_action(const std::string &);
void instant(float);
void segment(float, float);