From 182e3b0d67f41e2e109b0440dcd90a51f49b28fa Mon Sep 17 00:00:00 2001 From: GabsPuNs Date: Mon, 18 May 2026 20:40:15 -0400 Subject: [PATCH] Idk. Just changes i guess --- Minecraft.Client/Minecraft.cpp | 42 ++++++++++--------- .../Windows64/Windows64_Minecraft.cpp | 13 +++++- 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index bd4756a8..6d3a1269 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -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(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 diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 3aa15325..1b18e258 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -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() &&