Idk. Just changes i guess

This commit is contained in:
GabsPuNs
2026-05-18 20:40:15 -04:00
parent 26448295ae
commit 182e3b0d67
2 changed files with 33 additions and 22 deletions

View File

@@ -1203,30 +1203,32 @@ void Minecraft::applyFrameMouseLook()
// Per-frame mouse look: consume mouse deltas every frame instead of waiting
// for the 20Hz game tick. Apply the same delta to both xRot/yRot AND xRotO/yRotO
// so the render interpolation instantly reflects the change without waiting for a tick.
if (level == nullptr) return;
if (level == nullptr || !g_KBMInput.IsMouseGrabbed())
return;
float rawDx = 0.0f, rawDy = 0.0f;
g_KBMInput.ConsumeMouseDelta(rawDx, rawDy);
if (rawDx == 0.0f && rawDy == 0.0f)
return;
for (int i = 0; i < XUSER_MAX_COUNT; i++)
{
if (localplayers[i] == nullptr) continue;
if (localplayers[i] == nullptr)
continue;
int iPad = localplayers[i]->GetXboxPad();
if (iPad != 0) continue; // Mouse only applies to pad 0
if (iPad != 0)
continue; // Mouse only applies to pad 0
if (!g_KBMInput.IsMouseGrabbed()) continue;
if (localgameModes[iPad] == nullptr) continue;
float rawDx, rawDy;
g_KBMInput.ConsumeMouseDelta(rawDx, rawDy);
if (rawDx == 0.0f && rawDy == 0.0f) continue;
if (localgameModes[iPad] == nullptr)
continue;
float mouseSensitivity = static_cast<float>(app.GetGameSettings(iPad, eGameSetting_Sensitivity_InGame)) / 100.0f;
float mdx = rawDx * mouseSensitivity;
float mdy = -rawDy * mouseSensitivity;
if (app.GetGameSettings(iPad, eGameSetting_ControlInvertLook))
mdy = -mdy;
// Apply 0.15f scaling (same as Entity::interpolateTurn / Entity::turn)
float dyaw = mdx * 0.15f;
float dpitch = -mdy * 0.15f;
float dyaw = rawDx * mouseSensitivity * 0.15f;
float dpitch = rawDy * mouseSensitivity * 0.15f;
if (app.GetGameSettings(iPad, eGameSetting_ControlInvertLook))
dpitch = -dpitch;
// Apply to both current and old rotation so render interpolation
// reflects the change immediately (no 50ms tick delay)
@@ -1236,10 +1238,10 @@ void Minecraft::applyFrameMouseLook()
localplayers[i]->xRotO += dpitch;
// Clamp pitch
if (localplayers[i]->xRot < -90.0f) localplayers[i]->xRot = -90.0f;
if (localplayers[i]->xRot > 90.0f) localplayers[i]->xRot = 90.0f;
if (localplayers[i]->xRotO < -90.0f) localplayers[i]->xRotO = -90.0f;
if (localplayers[i]->xRotO > 90.0f) localplayers[i]->xRotO = 90.0f;
localplayers[i]->xRot = std::clamp(localplayers[i]->xRot, -90.0f, 90.0f);
localplayers[i]->xRotO = std::clamp(localplayers[i]->xRotO, -90.0f, 90.0f);
break;
}
}
#endif

View File

@@ -461,6 +461,8 @@ IDXGISwapChain* g_pSwapChain = nullptr;
ID3D11RenderTargetView* g_pRenderTargetView = nullptr;
ID3D11DepthStencilView* g_pDepthStencilView = nullptr;
ID3D11Texture2D* g_pDepthStencilBuffer = nullptr;
static const float kClearColorWhite[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
static const float kClearColorBlack[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
//
// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
@@ -843,7 +845,7 @@ HRESULT InitDevice()
sd.Width = width;
sd.Height = height;
sd.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_SHADER_INPUT;
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
sd.SampleDesc.Count = 1;
sd.SampleDesc.Quality = 0;
sd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
@@ -1021,7 +1023,7 @@ static bool ResizeD3D(int newW, int newH)
sd.Width = bbW;
sd.Height = bbH;
sd.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_SHADER_INPUT;
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
sd.SampleDesc.Count = 1;
sd.SampleDesc.Quality = 0;
sd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
@@ -1577,7 +1579,14 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
continue;
}
const float* clearColor = app.GetGameStarted() ? kClearColorBlack : kClearColorWhite;
RenderManager.SetClearColour(clearColor);
RenderManager.StartFrame();
if (!app.GetGameStarted())
{
RenderManager.SetClearColour(kClearColorWhite); // set intro scene background to white
RenderManager.Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
#if 0
if(pMinecraft->soundEngine->isStreamingWavebankReady() &&
!pMinecraft->soundEngine->isPlayingStreamingGameMusic() &&