aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/UI
diff options
context:
space:
mode:
Diffstat (limited to 'Minecraft.Client/Common/UI')
-rw-r--r--Minecraft.Client/Common/UI/UIController.cpp8
-rw-r--r--Minecraft.Client/Common/UI/UIController.h4
2 files changed, 11 insertions, 1 deletions
diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp
index 5375b784..95423642 100644
--- a/Minecraft.Client/Common/UI/UIController.cpp
+++ b/Minecraft.Client/Common/UI/UIController.cpp
@@ -2342,7 +2342,13 @@ void UIController::PlayUISFX(ESoundEffect eSound)
if (time - m_lastUiSfx < 10) { return; }
m_lastUiSfx = time;
- Minecraft::GetInstance()->soundEngine->playUI(eSound,1.0f,1.0f);
+ float pitch = 1.0f;
+ if (eSound == eSFX_Focus)
+ {
+ pitch += (m_randomDistribution(m_randomGenerator) - 0.5f) / 10;
+ }
+
+ Minecraft::GetInstance()->soundEngine->playUI(eSound,1.0f,pitch);
}
void UIController::DisplayGamertag(unsigned int iPad, bool show)
diff --git a/Minecraft.Client/Common/UI/UIController.h b/Minecraft.Client/Common/UI/UIController.h
index 373d67b2..f4b365b5 100644
--- a/Minecraft.Client/Common/UI/UIController.h
+++ b/Minecraft.Client/Common/UI/UIController.h
@@ -3,6 +3,7 @@ using namespace std;
#include "IUIController.h"
#include "UIEnums.h"
#include "UIGroup.h"
+#include <random>
class UIAbstractBitmapFont;
class UIBitmapFont;
@@ -63,6 +64,9 @@ private:
UITTFFont *m_mcTTFFont;
UIBitmapFont *m_moj7, *m_moj11;
+ std::mt19937 m_randomGenerator;
+ std::uniform_real_distribution<float> m_randomDistribution;
+
public:
void setCleanupOnReload();
void updateCurrentFont();