From 3bb147aad670c9cecebf214735e175c69f531804 Mon Sep 17 00:00:00 2001 From: retuci0 Date: Tue, 17 Mar 2026 08:55:06 +0100 Subject: [PATCH] added zoom with F --- Minecraft.Client/GameRenderer.cpp | 22 +++++++++++-------- .../Windows64/KeyboardMouseInput.h | 1 + .../Windows64/Windows64_Minecraft.cpp | 14 ++++++++++++ 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Minecraft.Client/GameRenderer.cpp b/Minecraft.Client/GameRenderer.cpp index 8c9dd5916..09ccde8ca 100644 --- a/Minecraft.Client/GameRenderer.cpp +++ b/Minecraft.Client/GameRenderer.cpp @@ -578,17 +578,21 @@ void GameRenderer::moveCameraToPlayer(float a) } +// fixed - retucio +void GameRenderer::zoomRegion(double zoom, double xa, double ya) { + // clamp zoom to reasonable range to avoid degenerate matrices + if (zoom < 0.1) zoom = 0.1; + if (zoom > 10.0) zoom = 10.0; -void GameRenderer::zoomRegion(double zoom, double xa, double ya) -{ - zoom = zoom; - zoom_x = xa; - zoom_y = ya; + this->zoom = zoom; + this->zoom_x = xa; + this->zoom_y = ya; } -void GameRenderer::unZoomRegion() -{ - zoom = 1; +void GameRenderer::unZoomRegion() { + this->zoom = 1.0; + this->zoom_x = 0.0; + this->zoom_y = 0.0; } // 4J added as we have more complex adjustments to make for fov & aspect on account of viewports @@ -2249,4 +2253,4 @@ int GameRenderer::getFpsCap(int option) void GameRenderer::updateAllChunks() { // mc->levelRenderer->updateDirtyChunks(mc->cameraTargetPlayer, true); -} +} \ No newline at end of file diff --git a/Minecraft.Client/Windows64/KeyboardMouseInput.h b/Minecraft.Client/Windows64/KeyboardMouseInput.h index 2079a72a1..5d54dd895 100644 --- a/Minecraft.Client/Windows64/KeyboardMouseInput.h +++ b/Minecraft.Client/Windows64/KeyboardMouseInput.h @@ -26,6 +26,7 @@ public: static const int KEY_CRAFTING = 'C'; static const int KEY_CRAFTING_ALT = 'R'; static const int KEY_CHAT = 'T'; + static const int KEY_ZOOM = 'F'; static const int KEY_CONFIRM = VK_RETURN; static const int KEY_CANCEL = VK_ESCAPE; static const int KEY_PAUSE = VK_ESCAPE; diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 81430ffcc..1f5ffda77 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -562,6 +562,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) vk = (lParam & (1 << 24)) ? VK_RCONTROL : VK_LCONTROL; else if (vk == VK_MENU) vk = (lParam & (1 << 24)) ? VK_RMENU : VK_LMENU; + g_KBMInput.OnKeyDown(vk); return DefWindowProc(hWnd, message, wParam, lParam); } @@ -1821,6 +1822,19 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, SetFocus(g_hWnd); } + // zoom with F - retucio + if (!ui.GetMenuDisplayed(0) && pMinecraft->screen == NULL) { + Minecraft* mc = Minecraft::GetInstance(); + if (mc && mc->gameRenderer) { + if (g_KBMInput.IsKeyDown(KeyboardMouseInput::KEY_ZOOM)) { + mc->gameRenderer->zoomRegion(5.0, 0.0, 0.0); + } else { + mc->gameRenderer->unZoomRegion(); + } + } + } + + #if 0 // has the game defined profile data been changed (by a profile load) if(app.uiGameDefinedDataChangedBitmask!=0)