Merge remote-tracking branch 'upstream/master' into dwm-vsync

This commit is contained in:
Kleadron
2023-08-01 02:46:30 -07:00
4 changed files with 38 additions and 7 deletions

View File

@@ -238,10 +238,6 @@ void AppPlatform_windows::recenterMouse()
void AppPlatform_windows::setMouseGrabbed(bool b)
{
// only if stuff has changed do we update
if (m_bGrabbedMouse == b)
return;
m_bGrabbedMouse = b;
if (m_bActuallyGrabbedMouse == (b && m_bIsFocused))

View File

@@ -179,6 +179,30 @@ void SoundSystemWindows::playAt(const SoundDesc& sound, float x, float y, float
return;
}
// references:
// https://gamedev.net/forums/topic/337397-sound-volume-question-directsound/3243306/
// https://learn.microsoft.com/en-us/previous-versions/windows/desktop/mt708939(v=vs.85)
// Conversion from 0-1 linear volume to directsound logarithmic volume..
// This seems to work for the most part, but accuracy testing should be done for actual MCPE, water splashing is pretty quiet.
float attenuation = volume;//Lerp(DSBVOLUME_MIN, DSBVOLUME_MAX, volume);
// clamp the attenuation value
if (attenuation < 0.0f)
attenuation = 0.0f;
else if (attenuation > 1.0f)
attenuation = 1.0f;
if (attenuation == 0)
{
// no sound would come out, maybe skip playing this sound?
attenuation = DSBVOLUME_MIN;
}
else
{
attenuation = floorf(2000.0f * log10f(attenuation) + 0.5f);
}
(*soundbuffer)->SetVolume(LONG(attenuation));
(*soundbuffer)->Play(0, 0, 0);
m_buffers.push_back(soundbuffer);
}

View File

@@ -41,7 +41,7 @@ void PauseScreen::init()
#ifdef ENH_ADD_OPTIONS_PAUSE
// TODO: when visible or quit&copy are on, lower this
m_btnOptions.m_width = 160;
m_btnOptions.m_yPos = 144;
m_btnOptions.m_yPos = 112;
m_btnOptions.m_xPos = m_btnBack.m_xPos;
#endif
@@ -55,10 +55,13 @@ void PauseScreen::init()
//m_buttons.push_back(&m_btnQuitAndCopy);
if (m_pMinecraft->m_pRakNetInstance)
if (m_pMinecraft->m_pRakNetInstance && m_pMinecraft->m_pRakNetInstance->m_bIsHost)
{
updateServerVisibilityText();
m_buttons.push_back(&m_btnVisible);
#ifdef ENH_ADD_OPTIONS_PAUSE
m_btnOptions.m_yPos += 32;
#endif
}
for (auto thing : m_buttons)

View File

@@ -432,6 +432,10 @@ void GameRenderer::renderLevel(float f)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
setupFog(0);
#ifndef ORIGINAL_CODE
glShadeModel(GL_SMOOTH);
#endif
glEnable(GL_BLEND);
glDisable(GL_CULL_FACE);
// glDepthMask(false); -- added in 0.1.1j. Introduces more issues than fixes
@@ -441,7 +445,11 @@ void GameRenderer::renderLevel(float f)
pLR->render(pMob, 1, f);
glDepthMask(true);
#ifndef ORIGINAL_CODE
glShadeModel(GL_FLAT);
#endif
glEnable(GL_CULL_FACE);
glDisable(GL_BLEND);