diff --git a/source/App/Minecraft.cpp b/source/App/Minecraft.cpp index 7bb0af3..df46835 100644 --- a/source/App/Minecraft.cpp +++ b/source/App/Minecraft.cpp @@ -432,14 +432,17 @@ void Minecraft::tickInput() Keyboard::_index = -1; Mouse::_inputs.clear(); Mouse::_index = -1; +} #ifndef ORIGINAL_CODE - if (m_bGrabbedMouse) - { - platform()->recenterMouse(); - } -#endif +void Minecraft::tickMouse() +{ + if (!m_bGrabbedMouse) + return; + + platform()->recenterMouse(); } +#endif void Minecraft::_levelGenerated() { @@ -527,6 +530,8 @@ void Minecraft::update() m_pLevel->updateLights(); } + tickMouse(); + m_pGameRenderer->render(m_timer.field_18); } diff --git a/source/App/Minecraft.hpp b/source/App/Minecraft.hpp index 874e8c2..b5285ec 100644 --- a/source/App/Minecraft.hpp +++ b/source/App/Minecraft.hpp @@ -53,6 +53,10 @@ public: void cancelLocateMultiplayer(); void locateMultiplayer(); +#ifndef ORIGINAL_CODE + void tickMouse(); +#endif + virtual void onGraphicsReset(); virtual void update() override; virtual void init() override; diff --git a/source/Renderer/GameRenderer.cpp b/source/Renderer/GameRenderer.cpp index 16db20f..894647e 100644 --- a/source/Renderer/GameRenderer.cpp +++ b/source/Renderer/GameRenderer.cpp @@ -498,7 +498,26 @@ void GameRenderer::render(float f) if (!pMC->m_options.field_240) { - // TODO + // @TODO: untangle this code + float v17 = xd + field_14; + float v18 = field_18; + float v19 = field_1C; + field_14 = v17; + float v20 = mult1 * 0.25f * (v17 - v18); + float v21 = v19 + (v20 - v19) * 0.5f; + field_1C = v21; + if ((v20 <= 0.0 || v20 <= v21) && (v20 >= 0.0 || v20 >= v21)) + v21 = mult1 * 0.25f * (v17 - v18); + float v22 = yd + field_20; + field_18 = v18 + v21; + float v23 = field_24; + field_20 = v22; + float v24 = mult1 * 0.15f * (v22 - v23); + float v25 = field_28 + (v24 - field_28) * 0.5f; + field_28 = v25; + if ((v24 <= 0.0 || v24 <= v25) && (v24 >= 0.0 || v24 >= v25)) + v25 = v24; + field_24 = v23 + v25; } pMC->m_pLocalPlayer->turn(diff_field_84 * field_7C, diff_field_84 * multPitch * field_80); diff --git a/source/Renderer/GameRenderer.hpp b/source/Renderer/GameRenderer.hpp index 15123ad..da87dba 100644 --- a/source/Renderer/GameRenderer.hpp +++ b/source/Renderer/GameRenderer.hpp @@ -49,7 +49,12 @@ public: float field_8 = 0.0f; int field_C = 0; Entity* field_10 = nullptr; - //... + float field_14 = 0.0f; + float field_18 = 0.0f; + float field_1C = 0.0f; + float field_20 = 0.0f; + float field_24 = 0.0f; + float field_28 = 0.0f; float field_2C = 4.0f; float field_30 = 4.0f; float field_34 = 0.0f;