-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ba2c11
commit d4d3e39
Showing
8 changed files
with
618 additions
and
539 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
* chopt - Star Power optimiser for Clone Hero | ||
* Copyright (C) 2020 Raymond Wright | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef CHOPT_PROCESSED_HPP | ||
#define CHOPT_PROCESSED_HPP | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
#include "chart.hpp" | ||
#include "points.hpp" | ||
#include "sp.hpp" | ||
#include "time.hpp" | ||
|
||
struct ActivationCandidate { | ||
PointPtr act_start; | ||
PointPtr act_end; | ||
Position earliest_activation_point {Beat(0.0), Measure(0.0)}; | ||
SpBar sp_bar {0.0, 0.0}; | ||
}; | ||
|
||
struct Activation { | ||
PointPtr act_start; | ||
PointPtr act_end; | ||
}; | ||
|
||
// Part of the return value of ProcessedSong::is_candidate_valid. Says if an | ||
// activation is valid, and if not whether the problem is too little or too much | ||
// Star Power. | ||
enum class ActValidity { success, insufficient_sp, surplus_sp }; | ||
|
||
// Return value of ProcessedSong::is_candidate_valid, providing information on | ||
// whether an activation is valid, and if so the earliest position it can end. | ||
struct ActResult { | ||
Position ending_position; | ||
ActValidity validity; | ||
}; | ||
|
||
struct Path { | ||
std::vector<Activation> activations; | ||
int score_boost; | ||
}; | ||
|
||
// Represents a song processed for Star Power optimisation. The constructor | ||
// should only fail due to OOM; invariants on the song are supposed to be | ||
// upheld by the constructors of the arguments. | ||
class ProcessedSong { | ||
private: | ||
// The order of these members is important. We must have m_converter before | ||
// m_points. | ||
TimeConverter m_converter; | ||
PointSet m_points; | ||
SpData m_sp_data; | ||
int m_total_solo_boost; | ||
|
||
public: | ||
ProcessedSong(const NoteTrack& track, int resolution, | ||
const SyncTrack& sync_track, double early_whammy, | ||
double squeeze); | ||
|
||
// Return the minimum and maximum amount of SP can be acquired between two | ||
// points. Does not include SP from the point act_start. first_point is | ||
// given for the purposes of counting SP grantings notes, e.g. if start is | ||
// after the middle of first_point's timing window. | ||
[[nodiscard]] SpBar total_available_sp(Beat start, PointPtr first_point, | ||
PointPtr act_start) const; | ||
// Returns an ActResult which says if an activation is valid, and if so the | ||
// earliest position it can end. | ||
[[nodiscard]] ActResult | ||
is_candidate_valid(const ActivationCandidate& activation) const; | ||
// Return the summary of a path. | ||
[[nodiscard]] std::string path_summary(const Path& path) const; | ||
|
||
[[nodiscard]] const PointSet& points() const { return m_points; } | ||
[[nodiscard]] const SpData& sp_data() const { return m_sp_data; } | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.