mirror of
https://github.com/ReMinecraftPE/mcpe.git
synced 2025-01-23 09:44:34 -05:00
* Improve the smoothness of the turn controls.
Thanks to @Kleadron on GitHub for the hint.
This commit is contained in:
parent
4735bd5cf0
commit
1a75690f52
4 changed files with 40 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue