Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port TL-tapping stamina changes #175

Merged
merged 3 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions include/pp/performance/Beatmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class Beatmap
s32 NumSliders() const { return _numSliders; }
s32 NumSpinners() const { return _numSpinners; }
f32 DifficultyAttribute(EMods mods, EDifficultyAttributeType type) const;
EGamemode PlayMode() const { return _playmode; }

void SetRankedStatus(ERankedStatus rankedStatus) { _rankedStatus = rankedStatus; }
void SetScoreVersion(EScoreVersion scoreVersion) { _scoreVersion = scoreVersion; }
Expand All @@ -60,6 +61,7 @@ class Beatmap
void SetNumSpinners(s32 numSpinners) { _numSpinners = numSpinners; }
void SetDifficultyAttribute(EMods mods, EDifficultyAttributeType type, f32 value);
void SetMode(EGamemode mode) { _mode = mode; }
void SetPlayMode(EGamemode mode) { _playmode = mode; }

static bool ContainsAttribute(const std::string &difficultyAttributeName)
{
Expand All @@ -76,8 +78,13 @@ class Beatmap

// General information
s32 _id;

// The mode being processed. NOT the beatmap's playmode!
EGamemode _mode = EGamemode::Osu;

// The beatmap's playmode. This may differ from the mode currently being processed in the case of converted beatmaps.
EGamemode _playmode = EGamemode::Osu;

// Calculated difficulty
using difficulty_t = std::unordered_map<
std::underlying_type_t<EMods>,
Expand Down
3 changes: 2 additions & 1 deletion src/performance/Processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ void Processor::queryAllBeatmapDifficulties(u32 numThreads)
bool Processor::queryBeatmapDifficulty(DatabaseConnection& dbSlave, s32 startId, s32 endId)
{
std::string query = StrFormat(
"SELECT `osu_beatmaps`.`beatmap_id`,`countNormal`,`mods`,`attrib_id`,`value`,`approved`,`score_version`, `countSpinner`, `countSlider` "
"SELECT `osu_beatmaps`.`beatmap_id`,`countNormal`,`mods`,`attrib_id`,`value`,`approved`,`score_version`, `countSpinner`, `countSlider`,`playmode` "
"FROM `osu_beatmaps` "
"JOIN `osu_beatmap_difficulty_attribs` ON `osu_beatmaps`.`beatmap_id` = `osu_beatmap_difficulty_attribs`.`beatmap_id` "
"WHERE (`osu_beatmaps`.`playmode`=0 OR `osu_beatmaps`.`playmode`={0}) AND `osu_beatmap_difficulty_attribs`.`mode`={0} AND `approved` BETWEEN {1} AND {2}",
Expand Down Expand Up @@ -659,6 +659,7 @@ bool Processor::queryBeatmapDifficulty(DatabaseConnection& dbSlave, s32 startId,
beatmap.SetDifficultyAttribute(res[2], _difficultyAttributes[attribId], res[4]);

beatmap.SetMode(_gamemode);
beatmap.SetPlayMode(res[9]);
}

if (endId != 0) {
Expand Down
8 changes: 4 additions & 4 deletions src/performance/taiko/TaikoScore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void TaikoScore::computeDifficultyValue(const Beatmap &beatmap)
if ((_mods & EMods::Easy) > 0)
_difficultyValue *= 0.985f;

if ((_mods & EMods::Hidden) > 0)
if ((_mods & EMods::Hidden) > 0 && beatmap.PlayMode() == EGamemode::Taiko)
_difficultyValue *= 1.025f;

if ((_mods & EMods::HardRock) > 0)
Expand All @@ -99,9 +99,9 @@ void TaikoScore::computeAccuracyValue(const Beatmap &beatmap)
f32 lengthBonus = std::min(1.15f, std::pow(static_cast<f32>(TotalHits()) / 1500.0f, 0.3f));
_accuracyValue *= lengthBonus;

// Slight HDFL Bonus for accuracy. A clamp is used to prevent against negative values
if ((_mods & (EMods::Hidden | EMods::Flashlight)) == (EMods::Hidden | EMods::Flashlight))
_accuracyValue *= std::max(1.050f, 1.075f * lengthBonus);
// Slight HDFL Bonus for accuracy. A clamp is used to prevent against negative values.
if ((_mods & (EMods::Hidden | EMods::Flashlight)) == (EMods::Hidden | EMods::Flashlight) && beatmap.PlayMode() == EGamemode::Taiko)
_accuracyValue *= std::max(1.0f, 1.1f * lengthBonus);
}

f32 TaikoScore::Accuracy() const
Expand Down