2021-06-23 21:18:33 +02:00
|
|
|
#include "classicmapcreator.h"
|
|
|
|
#include "classicnote.h"
|
|
|
|
|
2021-08-10 21:08:45 +02:00
|
|
|
// Replace with interface by dependency injection
|
|
|
|
#include "classicflyinganimationscenario.h"
|
|
|
|
#include "classicdyinganimationscenario.h"
|
|
|
|
//
|
|
|
|
|
2021-08-09 20:59:40 +02:00
|
|
|
ClassicMapCreator::ClassicMapCreator(const std::shared_ptr<ClassicGraphicsManager>& manager) :
|
2021-06-23 21:18:33 +02:00
|
|
|
_graphics_manager(manager)
|
|
|
|
{}
|
|
|
|
|
|
|
|
Beatmap ClassicMapCreator::createBeatmap(const std::string& filepath) const
|
|
|
|
{
|
|
|
|
(void) filepath;
|
|
|
|
|
2021-07-19 19:59:23 +02:00
|
|
|
microsec starting_beat_offset = 362162;
|
2021-06-23 21:18:33 +02:00
|
|
|
int amount_of_beats = 209;
|
|
|
|
microsec interval = 1412162;
|
2021-07-19 19:59:23 +02:00
|
|
|
microsec tempo_interval = interval / 2;
|
|
|
|
microsec note_input_offset = 412162 / 2;
|
2021-07-21 20:15:56 +02:00
|
|
|
//microsec note_input_offset_fast = 412162 / 6;
|
2021-06-23 21:18:33 +02: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-07-21 20:15:56 +02:00
|
|
|
std::vector<ClassicNote*> notes;
|
2021-06-23 21:18:33 +02:00
|
|
|
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-08-10 21:08:45 +02:00
|
|
|
ClassicNote *note = new ClassicNote(
|
|
|
|
{
|
|
|
|
{input_intervals, bpm_iterator},
|
|
|
|
{input_intervals},
|
|
|
|
false,
|
|
|
|
ClassicNoteState::NONE,
|
|
|
|
{
|
|
|
|
ClassicNote::Element
|
|
|
|
{
|
|
|
|
{x, 390.},
|
|
|
|
false,
|
|
|
|
sf::Keyboard::Unknown,
|
|
|
|
Type::UP,
|
|
|
|
{},
|
|
|
|
{sf::Keyboard::W, sf::Keyboard::Up},
|
|
|
|
{nullptr},
|
|
|
|
{}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
note->elements[0].animations[ClassicNoteState::NONE] = nullptr;
|
|
|
|
note->elements[0].animations[ClassicNoteState::FLYING] = std::make_shared<ClassicFlyingAnimationScenario>();
|
|
|
|
note->elements[0].animations[ClassicNoteState::ACTIVE] = note->elements[0].animations[ClassicNoteState::FLYING];
|
|
|
|
note->elements[0].animations[ClassicNoteState::DYING] = std::make_shared<ClassicDyingAnimationScenario>();
|
|
|
|
note->elements[0].animations[ClassicNoteState::DEAD] = nullptr;
|
2021-07-15 04:45:52 +02:00
|
|
|
|
|
|
|
if (counter == 0)
|
|
|
|
{
|
2021-08-10 21:08:45 +02:00
|
|
|
note->hold = true;
|
|
|
|
note->elements[0].available_keys = {sf::Keyboard::D, sf::Keyboard::Right};
|
|
|
|
note->elements[0].type = Type::RIGHT;
|
2021-07-15 04:45:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
--counter;
|
|
|
|
|
2021-08-10 21:08:45 +02:00
|
|
|
notes.emplace_back(note);
|
2021-07-21 20:15:56 +02:00
|
|
|
|
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};
|
|
|
|
}
|