Skip to content

Commit

Permalink
Merge pull request #175 from smoogipoo/vunyunt-stamina-available-fingers
Browse files Browse the repository at this point in the history
Port TL-tapping staming changes
  • Loading branch information
peppy committed Nov 9, 2022
2 parents b089a57 + 19cdb93 commit 3d40335
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
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

0 comments on commit 3d40335

Please sign in to comment.