project-kyoku/src/classicgame/classicmapcreator.cpp

75 lines
2.3 KiB
C++
Raw Normal View History

#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;
2021-07-19 13:59:23 -04:00
microsec starting_beat_offset = 362162;
int amount_of_beats = 209;
microsec interval = 1412162;
2021-07-19 13:59:23 -04:00
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<Note*> notes;
input_intervals.shrink_to_fit();
bpm_iterator += tempo_interval;
float x = 90.;
2021-07-14 22:45:52 -04:00
int counter = 3;
while (bpm_iterator < bpm_end)
{
2021-07-14 22:45:52 -04:00
ClassicNote::ClassicNoteInitializer init;
2021-07-19 13:59:23 -04:00
ClassicNote::ClassicNoteInitializer::Element element;
2021-07-14 22:45:52 -04:00
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;
2021-07-19 13:59:23 -04:00
init.elements = {element};
notes.emplace_back(new ClassicNote(std::move(init), _graphics_manager));
2021-07-14 22:45:52 -04:00
if (counter == 0)
{
2021-07-19 13:59:23 -04:00
ClassicNote::ClassicNoteInitializer init2;
ClassicNote::ClassicNoteInitializer::Element element2;
init2.intervals = input_intervals;
init2.perfect_offset = bpm_iterator + note_input_offset_fast;
element2.coordinates = {x + 35, 390. + 50.};
2021-07-14 22:45:52 -04:00
element2.falling_curve_interpolation = {};
2021-07-19 13:59:23 -04:00
element2.keys = {sf::Keyboard::D, sf::Keyboard::Right};
element2.type = Type::RIGHT;
2021-07-14 22:45:52 -04:00
2021-07-19 13:59:23 -04:00
init2.elements = {element2};
notes.emplace_back(new ClassicNote(std::move(init2), _graphics_manager));
counter = 3;
2021-07-14 22:45:52 -04:00
}
--counter;
bpm_iterator += tempo_interval;
x += 70;
if (x >= 1200)
x = 90.;
}
return {std::move(notes), note_input_offset * 12};
}