RhythmGame 1.4.3
Loading...
Searching...
No Matches
BmsGameReferee.h
Go to the documentation of this file.
1//
2// Created by bobini on 21.06.23.
3//
4
5#ifndef RHYTHMGAME_BMSGAMEREFEREE_H
6#define RHYTHMGAME_BMSGAMEREFEREE_H
7
8#include <span>
10#include "input/BmsKeys.h"
11#include "BmsLiveScore.h"
13#include "sounds/Sound.h"
14
18namespace gameplay_logic {
19
27{
28 using BgmType = std::pair<std::chrono::nanoseconds, sounds::Sound*>;
29
30 std::array<std::vector<rules::HitRules::Note>,
32 notes;
33 std::array<std::vector<rules::HitRules::Mine>,
35 mines;
36 std::vector<BgmType> bgms;
37 std::span<BgmType> currentBgms;
38 std::vector<charts::BmsNotesData::BpmChangeValues> bpmChanges;
39 std::vector<charts::BmsNotesData::SpeedChange> speedChanges;
40 std::unordered_map<uint64_t, std::shared_ptr<sounds::Sound>> sounds;
41 rules::HitRules hitRules;
42 BmsLiveScore* score;
43 std::shared_ptr<sounds::Sound> mineHitSound;
44 static constexpr auto inputKeyCount =
45 static_cast<int>(input::BmsKey::Col2sDown) + 1;
46 std::array<bool, inputKeyCount> pressedKeys{};
47 std::array<int, charts::BmsNotesData::columnNumber> pressedState{};
48
49 public:
50 using Position = double;
51
56
57 private:
58 void addNote(decltype(notes)::value_type& column,
59 decltype(mines)::value_type& minesColumn,
61 int index);
62
63 public:
64 explicit BmsGameReferee(
65 std::array<std::vector<charts::BmsNotesData::Note>,
67 const std::vector<std::pair<charts::BmsNotesData::Time, uint64_t>>&
68 bgmNotes,
69 std::vector<charts::BmsNotesData::BpmChangeValues> bpmChanges,
70 std::vector<charts::BmsNotesData::SpeedChange> speedChanges,
71 std::shared_ptr<sounds::Sound> mineHitSound,
72 BmsLiveScore* score,
73 std::unordered_map<uint64_t, std::shared_ptr<sounds::Sound>> sounds,
74 rules::HitRules hitRules);
85 void update(std::chrono::nanoseconds offsetFromStart,
86 bool lastUpdate = false);
87
88 auto getBpm(std::chrono::nanoseconds offsetFromStart) const
90
91 auto getSpeedMultiplier(std::chrono::nanoseconds offsetFromStart) const
92 -> double;
93 auto hasSpeedChanges() const -> bool { return !speedChanges.empty(); }
94
99 {
100 Position position; // Expressed in beats * scroll
101 Position beatPosition; // Expressed in beats
102 };
111 std::chrono::nanoseconds offsetFromStart)
112 -> PositionInfo;
113
121 auto passPressed(std::chrono::nanoseconds offsetFromStart,
122 input::BmsKey key) -> void;
130 auto passReleased(std::chrono::nanoseconds offsetFromStart,
131 input::BmsKey key) -> void;
132};
133} // namespace gameplay_logic
134
135#endif // RHYTHMGAME_BMSGAMEREFEREE_H
int column
Definition BmsReplayData.cpp:41
int64_t offsetFromStart
Definition BmsReplayData.cpp:38
zip_uint64_t index
Definition SongAssetStore.cpp:436
The update manager of notes and sounds during gameplay.
Definition BmsGameReferee.h:27
BmsGameReferee(const BmsGameReferee &)=delete
auto getBpm(std::chrono::nanoseconds offsetFromStart) const -> charts::BmsNotesData::BpmChangeValues
Definition BmsGameReferee.cpp:168
void update(std::chrono::nanoseconds offsetFromStart, bool lastUpdate=false)
Update the internal state of the referee.
Definition BmsGameReferee.cpp:127
auto getSpeedMultiplier(std::chrono::nanoseconds offsetFromStart) const -> double
Definition BmsGameReferee.cpp:60
static auto getPosition(charts::BmsNotesData::BpmChangeValues bpm, std::chrono::nanoseconds offsetFromStart) -> PositionInfo
Get the position in the chart, expressed in beats.
Definition BmsGameReferee.cpp:208
auto hasSpeedChanges() const -> bool
Definition BmsGameReferee.h:93
BmsGameReferee(BmsGameReferee &&)=default
BmsGameReferee & operator=(const BmsGameReferee &)=delete
BmsGameReferee & operator=(BmsGameReferee &&)=default
auto passPressed(std::chrono::nanoseconds offsetFromStart, input::BmsKey key) -> void
Handle a key press event.
Definition BmsGameReferee.cpp:185
auto passReleased(std::chrono::nanoseconds offsetFromStart, input::BmsKey key) -> void
Handle a key press event.
Definition BmsGameReferee.cpp:227
double Position
Definition BmsGameReferee.h:50
The score that gets updated during gameplay.
Definition BmsLiveScore.h:57
The class that determines which notes get hit or missed.
Definition HitRules.h:36
Classes and functions mostly related to gameplay.
Definition ArenaGameplaySource.h:10
BmsKey
The keys used for BMS.
Definition BmsKeys.h:20
The namespace for all sound related classes.
Definition HitRules.h:16
Definition BmsNotesData.h:81
Definition BmsNotesData.h:67
static constexpr auto columnNumber
Definition BmsNotesData.h:101
The position at which we are in the chart.
Definition BmsGameReferee.h:99
Position beatPosition
Definition BmsGameReferee.h:101
Position position
Definition BmsGameReferee.h:100