75 lines
2.1 KiB
C++
75 lines
2.1 KiB
C++
#include "classicmapcreator.h"
|
|
#include "classicarrownote.h"
|
|
|
|
// Replace with interface by dependency injection
|
|
#include "classicflyinganimationscenario.h"
|
|
#include "classicdyinganimationscenario.h"
|
|
//
|
|
|
|
ClassicMapCreator::ClassicMapCreator(const std::shared_ptr<ClassicGraphicsManager>& manager) :
|
|
_graphics_manager(manager)
|
|
{}
|
|
|
|
Beatmap ClassicMapCreator::createBeatmap(const std::string& filepath) const
|
|
{
|
|
(void) filepath;
|
|
|
|
microsec starting_beat_offset = 362162;
|
|
int amount_of_beats = 209;
|
|
microsec interval = 1412162;
|
|
microsec tempo_interval = interval / 2;
|
|
microsec note_input_offset = 412162 / 2;
|
|
//microsec note_input_offset_fast = 412162 / 6;
|
|
microsec bpm_iterator = starting_beat_offset;
|
|
microsec bpm_end = starting_beat_offset + (interval * amount_of_beats);
|
|
|
|
std::vector<microsec> input_intervals = {note_input_offset / 3, note_input_offset / 3 * 2, note_input_offset};
|
|
std::vector<ClassicNote*> notes;
|
|
input_intervals.shrink_to_fit();
|
|
|
|
bpm_iterator += tempo_interval;
|
|
|
|
float x = 90.;
|
|
|
|
int counter = 3;
|
|
|
|
const auto context = std::make_shared<Context>(Context{_graphics_manager});
|
|
|
|
while (bpm_iterator < bpm_end)
|
|
{
|
|
ArrowNoteInitializer init;
|
|
ArrowElementInitializer element;
|
|
init.initializer.intervals = input_intervals;
|
|
init.initializer.perfect_offset = bpm_iterator;
|
|
init.hold = false;
|
|
init.initializer.context = context;
|
|
|
|
element.element.coordinates = {x, 390.};
|
|
element.element.falling_curve_interpolation = {};
|
|
element.element.keys = {sf::Keyboard::W, sf::Keyboard::Up};
|
|
element.type = Type::UP;
|
|
|
|
if (counter == 0)
|
|
{
|
|
init.hold = true;
|
|
element.element.keys = {sf::Keyboard::D, sf::Keyboard::Right};
|
|
element.type = Type::RIGHT;
|
|
}
|
|
|
|
--counter;
|
|
|
|
init.elements = {element};
|
|
|
|
notes.emplace_back(new ClassicArrowNote(std::move(init)));
|
|
|
|
bpm_iterator += tempo_interval;
|
|
x += 70;
|
|
|
|
if (x >= 1200)
|
|
x = 90.;
|
|
}
|
|
|
|
return {std::move(notes), note_input_offset * 12};
|
|
}
|
|
|