2021-06-23 15:18:33 -04:00
|
|
|
#include "classicmapcreator.h"
|
2021-09-27 23:48:06 -04:00
|
|
|
#include "classicarrownote.h"
|
2021-06-23 15:18:33 -04:00
|
|
|
|
2021-08-10 15:08:45 -04:00
|
|
|
// Replace with interface by dependency injection
|
|
|
|
#include "classicflyinganimationscenario.h"
|
|
|
|
#include "classicdyinganimationscenario.h"
|
|
|
|
//
|
|
|
|
|
2021-08-09 14:59:40 -04:00
|
|
|
ClassicMapCreator::ClassicMapCreator(const std::shared_ptr<ClassicGraphicsManager>& manager) :
|
2021-06-23 15:18:33 -04:00
|
|
|
_graphics_manager(manager)
|
|
|
|
{}
|
|
|
|
|
|
|
|
Beatmap ClassicMapCreator::createBeatmap(const std::string& filepath) const
|
|
|
|
{
|
|
|
|
(void) filepath;
|
|
|
|
|
2021-07-19 13:59:23 -04:00
|
|
|
microsec starting_beat_offset = 362162;
|
2021-06-23 15:18:33 -04:00
|
|
|
int amount_of_beats = 209;
|
|
|
|
microsec interval = 1412162;
|
2021-10-03 11:23:28 -04:00
|
|
|
microsec tempo_interval = interval / 4;
|
2021-07-19 13:59:23 -04:00
|
|
|
microsec note_input_offset = 412162 / 2;
|
2021-07-21 14:15:56 -04:00
|
|
|
//microsec note_input_offset_fast = 412162 / 6;
|
2021-06-23 15:18:33 -04:00
|
|
|
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};
|
2021-10-03 11:23:28 -04:00
|
|
|
std::set<ClassicNote*, NotePtrCompt> notes;
|
2021-06-23 15:18:33 -04:00
|
|
|
input_intervals.shrink_to_fit();
|
|
|
|
|
|
|
|
bpm_iterator += tempo_interval;
|
|
|
|
|
|
|
|
float x = 90.;
|
|
|
|
|
2021-07-14 22:45:52 -04:00
|
|
|
int counter = 3;
|
|
|
|
|
2021-09-27 23:48:06 -04:00
|
|
|
const auto context = std::make_shared<Context>(Context{_graphics_manager});
|
|
|
|
|
2021-06-23 15:18:33 -04:00
|
|
|
while (bpm_iterator < bpm_end)
|
|
|
|
{
|
2021-09-27 23:48:06 -04:00
|
|
|
ArrowNoteInitializer init;
|
|
|
|
ArrowElementInitializer element;
|
|
|
|
init.initializer.intervals = input_intervals;
|
|
|
|
init.initializer.perfect_offset = bpm_iterator;
|
2021-09-14 15:02:23 -04:00
|
|
|
init.hold = false;
|
2021-09-27 23:48:06 -04:00
|
|
|
init.initializer.context = context;
|
2021-09-14 15:02:23 -04:00
|
|
|
|
2021-09-27 23:48:06 -04:00
|
|
|
element.element.coordinates = {x, 390.};
|
|
|
|
element.element.falling_curve_interpolation = {};
|
|
|
|
element.element.keys = {sf::Keyboard::W, sf::Keyboard::Up};
|
2021-09-14 15:02:23 -04:00
|
|
|
element.type = Type::UP;
|
2021-07-14 22:45:52 -04:00
|
|
|
|
|
|
|
if (counter == 0)
|
|
|
|
{
|
2021-09-14 15:02:23 -04:00
|
|
|
init.hold = true;
|
2021-09-27 23:48:06 -04:00
|
|
|
element.element.keys = {sf::Keyboard::D, sf::Keyboard::Right};
|
2021-09-14 15:02:23 -04:00
|
|
|
element.type = Type::RIGHT;
|
2021-07-14 22:45:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
--counter;
|
|
|
|
|
2021-09-14 15:02:23 -04:00
|
|
|
init.elements = {element};
|
|
|
|
|
2021-10-03 11:23:28 -04:00
|
|
|
notes.insert(new ClassicArrowNote(std::move(init)));
|
2021-07-21 14:15:56 -04:00
|
|
|
|
2021-06-23 15:18:33 -04:00
|
|
|
bpm_iterator += tempo_interval;
|
|
|
|
x += 70;
|
|
|
|
|
|
|
|
if (x >= 1200)
|
|
|
|
x = 90.;
|
|
|
|
}
|
|
|
|
|
2021-10-03 11:23:28 -04:00
|
|
|
return {std::move(notes), note_input_offset * 8};
|
2021-06-23 15:18:33 -04:00
|
|
|
}
|
2021-09-14 15:02:23 -04:00
|
|
|
|