2021-06-23 21:18:33 +02:00
|
|
|
#include "classicmapcreator.h"
|
|
|
|
#include "classicnote.h"
|
|
|
|
|
|
|
|
ClassicMapCreator::ClassicMapCreator(const std::unique_ptr<ClassicGraphicsManager>& manager) :
|
|
|
|
_graphics_manager(manager)
|
|
|
|
{}
|
|
|
|
|
|
|
|
Beatmap ClassicMapCreator::createBeatmap(const std::string& filepath) const
|
|
|
|
{
|
|
|
|
(void) filepath;
|
|
|
|
|
|
|
|
microsec starting_beat_offset = 352162;
|
|
|
|
int amount_of_beats = 209;
|
|
|
|
microsec interval = 1412162;
|
2021-06-24 20:04:09 +02:00
|
|
|
microsec tempo_interval = interval / 4;
|
2021-06-23 21:18:33 +02:00
|
|
|
microsec note_input_offset = 412162 / 3;
|
|
|
|
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<Note*> notes;
|
|
|
|
input_intervals.shrink_to_fit();
|
|
|
|
|
|
|
|
bpm_iterator += tempo_interval;
|
|
|
|
|
|
|
|
float x = 90.;
|
|
|
|
|
2021-07-15 04:45:52 +02:00
|
|
|
int counter = 3;
|
|
|
|
|
2021-06-23 21:18:33 +02:00
|
|
|
while (bpm_iterator < bpm_end)
|
|
|
|
{
|
2021-07-15 04:45:52 +02:00
|
|
|
ClassicNote::ClassicNoteInitializer init;
|
|
|
|
ClassicNote::ClassicNoteInitializer::Element element, element2;
|
|
|
|
init.intervals = input_intervals;
|
|
|
|
init.perfect_offset = bpm_iterator;
|
|
|
|
|
|
|
|
element.coordinates = {x, 390.};
|
|
|
|
element.falling_curve_interpolation = {};
|
|
|
|
element.keys = {sf::Keyboard::W, sf::Keyboard::Up};
|
|
|
|
element.type = Type::UP;
|
|
|
|
|
|
|
|
if (counter == 0)
|
|
|
|
{
|
|
|
|
counter = 3;
|
|
|
|
element2.coordinates = {x, 300.};
|
|
|
|
element2.falling_curve_interpolation = {};
|
|
|
|
element2.keys = {sf::Keyboard::A, sf::Keyboard::Left};
|
|
|
|
element2.type = Type::LEFT;
|
|
|
|
|
|
|
|
init.elements = {element, element2};
|
|
|
|
}
|
|
|
|
else
|
|
|
|
init.elements = {element};
|
|
|
|
|
|
|
|
--counter;
|
|
|
|
|
|
|
|
notes.emplace_back(new ClassicNote(std::move(init), _graphics_manager));
|
2021-06-23 21:18:33 +02:00
|
|
|
bpm_iterator += tempo_interval;
|
|
|
|
x += 70;
|
|
|
|
|
|
|
|
if (x >= 1200)
|
|
|
|
x = 90.;
|
|
|
|
}
|
|
|
|
|
|
|
|
return {std::move(notes), note_input_offset * 12};
|
|
|
|
}
|