Skip to content
Draft
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
2 changes: 2 additions & 0 deletions Themes/_fallback/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ EffectsReceptor=Add alternative behaviors to the receptors and notes.
EffectsArrow=Add alternative behaviors to the receptors and notes.
EnableAttackSounds=If enabled, a sound effect will play when an attack begins or ends.
EnableMineHitSound=If enabled, a sound will play when a mine is stepped on.
EnableNoteskinHitSounds=If enabled, noteskin hitsounds will play if available.
EnablePitchRates=If enabled, changing the rate of a song will change the pitch accordingly. If not enabled, the pitch is not modified.
EventMode=When set to &oq;ON&cq;, and you can continue playing forever. Failing will also take you back to the the Select Music or Select Course screen.
Exit=
Expand Down Expand Up @@ -905,6 +906,7 @@ EffectsReceptor=Effects
EffectsArrow=
EnableAttackSounds=Attack Sounds
EnableMineHitSound=Mine Sounds
EnableNoteskinHitSounds=Noteskin HitSounds
EnablePitchRates=Pitch On Rates
Entry %d=Entry %d
EventMode=Event Mode
Expand Down
5 changes: 3 additions & 2 deletions Themes/_fallback/metrics.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2186,7 +2186,7 @@ Line21="conf,Center1Player"
Fallback="ScreenOptionsServiceChild"
NextScreen="ScreenOptionsService"
PrevScreen="ScreenOptionsService"
LineNames="1,2,3,RefreshRate,FSType,4,5,6,7,8,9,11,13,FNR,14,17,FRGlobal,FRGameplay,19,20,GO"
LineNames="1,2,3,RefreshRate,FSType,4,5,6,7,8,9,11,13,FNR,14,17,FRGlobal,FRGameplay,19,20,21,GO"
Line1="lua,ConfDisplayMode()"
Line2="lua,ConfAspectRatio()"
Line3="lua,ConfDisplayResolution()"
Expand All @@ -2206,9 +2206,10 @@ Line14="conf,ShowStats"
Line16="conf,AttractSoundFrequency"
Line17="lua,SoundVolumeControl()"
Line19="conf,EnableMineHitSound"
Line20="conf,EnableNoteskinHitSounds"
LineFRGlobal="lua,FrameLimitGlobal()"
LineFRGameplay="lua,FrameLimitGameplay()"
Line20="lua,VisualDelaySeconds()"
Line21="lua,VisualDelaySeconds()"
LineGO="lua,GlobalOffsetSeconds()"

[ScreenOptionsAdvanced]
Expand Down
46 changes: 45 additions & 1 deletion src/Etterna/Actor/Gameplay/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ static Preference<float> m_fTimingWindowScale("TimingWindowScale", 1.0F);
static Preference1D<float> m_fTimingWindowSeconds(TimingWindowSecondsInit,
NUM_TimingWindow);
static Preference<bool> g_bEnableMineSoundPlayback("EnableMineHitSound", true);
static Preference<bool> g_bEnableNoteskinHitsounds("EnableNoteskinHitSounds", true);

// moved out of being members of player.h
static ThemeMetric<float> GRAY_ARROWS_Y_STANDARD;
Expand Down Expand Up @@ -280,6 +281,9 @@ Player::~Player()
REPLAYS->ReleaseReplay(pbReplay);

SAFE_DELETE(m_pNoteField);
for (auto& [judge, hitsound] : m_mHitsounds) {
SAFE_DELETE(hitsound);
}
for (unsigned i = 0; i < m_vpHoldJudgment.size(); ++i) {
SAFE_DELETE(m_vpHoldJudgment[i]);
}
Expand Down Expand Up @@ -453,6 +457,32 @@ Player::Init(const std::string& sType,
ActorUtil::LoadAllCommands(*m_pNoteField, sType);
this->AddChild(m_pNoteField);
}

// Load noteskin hitsounds -Creosm
{
if (g_bEnableNoteskinHitsounds) {
auto NoteskinLock = LockNoteSkin( m_pPlayerState->m_PlayerOptions.GetStage().m_sNoteSkin );
int TNSIndex = TNS_W1;

for (std::string JudgementName : {"Marvelous", "Perfect", "Great", "Good", "Bad", "Miss"}) {

auto MetricJudgementHitsoundPath = NOTESKIN->GetMetric("Hitsound", JudgementName);
auto JudgeHitsoundPath = NOTESKIN->GetPath("", MetricJudgementHitsoundPath);

if (JudgeHitsoundPath != "") {
Locator::getLogger()->info("Found noteskin hitsound metric for judgement: {} using path: {}", JudgementName, JudgeHitsoundPath);

auto JudgeHitsound = new RageSound();
JudgeHitsound->Load(JudgeHitsoundPath, true);
m_mHitsounds[static_cast<TapNoteScore>(TNSIndex)] = JudgeHitsound;
};

TNSIndex--;

}
}
}

}
/**
* @brief Determine if a TapNote needs a tap note style judgment.
Expand Down Expand Up @@ -568,7 +598,7 @@ Player::Load()
const HighScore* pb = SCOREMAN->GetChartPBAt(
GAMESTATE->m_pCurSteps->GetChartKey(),
GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate);

// the latter condition checks for Grade_Failed, NUM_Grade, Grade_Invalid
if (pb == nullptr || pb->GetGrade() >= Grade_Failed) {
wifescorepersonalbest = m_pPlayerState->playertargetgoal;
Expand Down Expand Up @@ -1806,6 +1836,15 @@ Player::ScoreAllActiveHoldsLetGo()
}
}

void
Player::PlayHitsound(TapNoteScore tns)
{
if (g_bEnableNoteskinHitsounds && m_mHitsounds.contains(tns))
{
m_mHitsounds[tns]->Play(false);
}
}

void
Player::PlayKeysound(const TapNote& tn, TapNoteScore score)
{
Expand Down Expand Up @@ -2134,6 +2173,10 @@ Player::Step(int col,
score = TNS_W5;
}
}

PlayHitsound(score); // Misses are done in
// Player::UpdateTapNotesMissedOlderThan
// -Creosm
break;
}
break;
Expand Down Expand Up @@ -2597,6 +2640,7 @@ Player::UpdateTapNotesMissedOlderThan(float fMissIfOlderThanSeconds)
}
} else {
tn.result.tns = TNS_Miss;
PlayHitsound(TNS_Miss);

// avoid scoring notes that get passed when seeking in pm
// not sure how many rows grace time is needed (if any?)
Expand Down
4 changes: 4 additions & 0 deletions src/Etterna/Actor/Gameplay/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ class Player : public ActorFrame
void DrawHoldJudgments();
void SendComboMessages(unsigned int iOldCombo,
unsigned int iOldMissCombo) const;

void PlayHitsound(TapNoteScore tns);
void PlayKeysound(const TapNote& tn, TapNoteScore score);

void SetMineJudgment(TapNoteScore tns, int iTrack, int iRow);
Expand Down Expand Up @@ -286,6 +288,8 @@ class Player : public ActorFrame

RageSound m_soundMine;

std::map<TapNoteScore, RageSound*> m_mHitsounds;

std::vector<RageSound> m_vKeysounds;

bool m_bSendJudgmentAndComboMessages;
Expand Down
5 changes: 4 additions & 1 deletion src/Etterna/Actor/Gameplay/PlayerReplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ PlayerReplay::CheckForSteps(const std::chrono::steady_clock::time_point& tm)

const auto fSongBeat = GAMESTATE->m_Position.m_fSongBeat;
const auto iSongRow = BeatToNoteRow(fSongBeat);

std::vector<PlaybackEvent> evts;
std::vector<int> rows;
const auto it = playbackEvents.lower_bound(ARBITRARY_MIN_GAMEPLAY_NUMBER);
Expand Down Expand Up @@ -628,6 +628,7 @@ PlayerReplay::UpdateTapNotesMissedOlderThan(float fMissIfOlderThanSeconds)
m_pPrimaryScoreKeeper->HandleTapScore(tn);
} else {
tn.result.tns = TNS_Miss;
PlayHitsound(TNS_Miss);

if (GAMESTATE->CountNotesSeparately()) {
SetJudgment(iter.Row(), iter.Track(), tn);
Expand Down Expand Up @@ -840,6 +841,8 @@ PlayerReplay::Step(int col,
}
}

PlayHitsound(score);

// Do game-specific and mode-specific score mapping.
score = GAMESTATE->GetCurrentGame()->MapTapNoteScore(score);

Expand Down
1 change: 1 addition & 0 deletions src/Etterna/Screen/Options/ScreenOptionsMasterPrefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,7 @@ InitializeConfOptions()
ADD(c);
}
ADD(ConfOption("EnableMineHitSound", MovePref<bool>, "No", "Yes"));
ADD(ConfOption("EnableNoteskinHitSounds", MovePref<bool>, "No", "Yes"));
ADD(ConfOption("Invalid", MoveNop, "|Invalid option"));
}

Expand Down
Loading