mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-05-25 04:04:46 +00:00
Idk. Just changes i guess
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user