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

Add and implement hitsound option #1322

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
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.
HitsoundsEnabled=If enabled, a sound will play when you hit a note successfully.
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
HitsoundsEnabled=Hitsounds
EnablePitchRates=Pitch On Rates
Entry %d=Entry %d
EventMode=Event Mode
Expand Down
3 changes: 2 additions & 1 deletion Themes/_fallback/metrics.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2206,9 +2206,10 @@ Line14="conf,ShowStats"
Line16="conf,AttractSoundFrequency"
Line17="lua,SoundVolumeControl()"
Line19="conf,EnableMineHitSound"
Line20="conf,HitsoundsEnabled"
LineFRGlobal="lua,FrameLimitGlobal()"
LineFRGameplay="lua,FrameLimitGameplay()"
Line20="lua,VisualDelaySeconds()"
Line21="lua,VisualDelaySeconds()"
LineGO="lua,GlobalOffsetSeconds()"

[ScreenOptionsAdvanced]
Expand Down
9 changes: 8 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_bEnableHitsound("HitsoundsEnabled", false);

// moved out of being members of player.h
static ThemeMetric<float> GRAY_ARROWS_Y_STANDARD;
Expand Down Expand Up @@ -348,6 +349,7 @@ Player::Init(const std::string& sType,
RageSoundLoadParams SoundParams;
SoundParams.m_bSupportPan = true;
m_soundMine.Load(THEME->GetPathS(sType, "mine"), true, &SoundParams);
m_soundHit.Load(THEME->GetPathS(sType, "hitsound"), true, &SoundParams);

// calculate M-mod speed here, so we can adjust properly on a per-song
// basis.
Expand Down Expand Up @@ -568,7 +570,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 @@ -2133,6 +2135,11 @@ Player::Step(int col,
MISS_WINDOW_BEGIN_SEC)) {
score = TNS_W5;
}
if (g_bEnableHitsound){
if (fSecondsFromExact <= GetWindowSeconds(TW_W3)) { // Play hitsound if player did not cb
m_soundHit.Stop();
m_soundHit.Play(false);
}}
}
break;
}
Expand Down
1 change: 1 addition & 0 deletions src/Etterna/Actor/Gameplay/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ class Player : public ActorFrame
JudgedRows* m_pJudgedRows;

RageSound m_soundMine;
RageSound m_soundHit;

std::vector<RageSound> m_vKeysounds;

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("HitsoundsEnabled", MovePref<bool>, "No", "Yes"));
ADD(ConfOption("Invalid", MoveNop, "|Invalid option"));
}

Expand Down
Loading