project-kyoku/src/modes/classicmode/game/classicmapcreator.cpp

82 lines
2.1 KiB
C++
Raw Normal View History

#include "classicmapcreator.h"
2021-09-28 05:48:06 +02:00
#include "classicarrownote.h"
2022-05-17 06:22:18 +02:00
#include "gamecontext.h"
// Replace with interface by dependency injection
#include "graphics/animations/classicflyinganimationscenario.h"
#include "graphics/animations/classicdyinganimationscenario.h"
//
2022-05-17 06:22:18 +02:00
auto classic::createBeatmap(const std::string& filepath, const std::shared_ptr<GameContext>& context) -> Beatmap
{
(void) filepath;
2021-12-29 15:59:18 +01:00
kku::microsec starting_beat_offset = 402162;
int amount_of_beats = 209;
2021-12-29 15:59:18 +01:00
kku::microsec interval = 1412162;
kku::microsec tempo_interval = interval / 4;
kku::microsec note_input_offset = 412162 / 2;
2021-07-21 20:15:56 +02:00
//microsec note_input_offset_fast = 412162 / 6;
2021-12-29 15:59:18 +01:00
kku::microsec bpm_iterator = starting_beat_offset;
kku::microsec bpm_end = starting_beat_offset + (interval * amount_of_beats);
2021-12-29 15:59:18 +01:00
std::vector<kku::microsec> input_intervals = {note_input_offset / 3, note_input_offset / 3 * 2, note_input_offset};
std::set<ClassicNote*, kku::NotePtrComparator> notes;
input_intervals.shrink_to_fit();
bpm_iterator += tempo_interval;
float x = 90.;
2021-07-15 04:45:52 +02:00
int counter = 3;
while (bpm_iterator < bpm_end)
{
2022-05-17 06:22:18 +02:00
ArrowElement element;
2022-05-17 06:22:18 +02:00
element.position = kku::Point(x, 390.f);
element.falling_curve_interpolation = {};
2022-01-11 21:15:24 +01:00
element.keys = {kku::SystemEvent::Key::Code::W,
kku::SystemEvent::Key::Code::Up};
2022-05-17 06:22:18 +02:00
element.type = Type::UP;
bool hold = false;
2021-07-15 04:45:52 +02:00
if (counter == 0)
{
2022-05-17 06:22:18 +02:00
hold = true;
2022-01-11 21:15:24 +01:00
element.keys = {kku::SystemEvent::Key::Code::D,
kku::SystemEvent::Key::Code::Right};
2022-05-17 06:22:18 +02:00
element.type = Type::RIGHT;
counter = 13;
2021-07-15 04:45:52 +02:00
}
--counter;
2022-05-17 06:22:18 +02:00
ClassicArrowNote::Init init
{
context,
bpm_iterator,
input_intervals,
{element},
hold
};
notes.insert(new ClassicArrowNote(std::move(init)));
2021-07-21 20:15:56 +02:00
bpm_iterator += tempo_interval;
x += 70;
if (x >= 1200)
x = 90.;
}
2021-10-03 17:23:28 +02:00
return {std::move(notes), note_input_offset * 8};
}