copy and paste again :3

This commit is contained in:
2026-08-26 18:51:43 -05:00
parent aecc5ede11
commit 1bb3be26ec
5 changed files with 124 additions and 2 deletions
+46 -1
View File
@@ -18,6 +18,7 @@ Input::Input()
lReset = false;
rReset = false;
m_gamepadSneaking = false;
}
void Input::tick(LocalPlayer *player)
@@ -40,6 +41,24 @@ void Input::tick(LocalPlayer *player)
else
ya = 0.0f;
#ifdef _WINDOWS64
// WASD movement (combine with gamepad)
if (iPad == 0)
{
float kbX = 0.0f, kbY = 0.0f;
if (KMInput.IsKeyDown('W')) kbY += 1.0f;
if (KMInput.IsKeyDown('S')) kbY -= 1.0f;
if (KMInput.IsKeyDown('A')) kbX += 1.0f; // inverted like gamepad
if (KMInput.IsKeyDown('D')) kbX -= 1.0f;
// Normalize diagonal
if (kbX != 0.0f && kbY != 0.0f) { kbX *= 0.707f; kbY *= 0.707f; }
if (pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_LEFT) || pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_RIGHT))
xa = max(min(xa + kbX, 1.0f), -1.0f);
if (pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_FORWARD) || pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_BACKWARD))
ya = max(min(ya + kbY, 1.0f), -1.0f);
}
#endif
#ifndef _CONTENT_PACKAGE
if (app.GetFreezePlayers())
{
@@ -62,9 +81,16 @@ void Input::tick(LocalPlayer *player)
{
if((player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_SNEAK_TOGGLE)) && pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_SNEAK_TOGGLE))
{
sneaking=!sneaking;
m_gamepadSneaking=!m_gamepadSneaking;
}
}
sneaking = m_gamepadSneaking;
#ifdef _WINDOWS64
// Keyboard hold-to-sneak (overrides gamepad toggle)
if (iPad == 0 && KMInput.IsKeyDown(VK_SHIFT) && !player->abilities.flying)
sneaking = true;
#endif
if(sneaking)
{
@@ -101,6 +127,19 @@ void Input::tick(LocalPlayer *player)
}
player->interpolateTurn(tx * abs(tx) * turnSpeed, ty * abs(ty) * turnSpeed);
#ifdef _WINDOWS64
// Mouse look (added after stick-based turn)
if (iPad == 0 && KMInput.IsCaptured())
{
float mouseSensitivity = 1.25f;
float mdx = KMInput.GetMouseDeltaX() * mouseSensitivity;
float mdy = -KMInput.GetMouseDeltaY() * mouseSensitivity;
if (app.GetGameSettings(iPad, eGameSetting_ControlInvertLook))
mdy = -mdy;
player->interpolateTurn(mdx, mdy);
}
#endif
//jumping = controller.isButtonPressed(0);
@@ -110,6 +149,12 @@ void Input::tick(LocalPlayer *player)
else
jumping = false;
#ifdef _WINDOWS64
// Keyboard jump (Space)
if (iPad == 0 && KMInput.IsKeyDown(VK_SPACE) && pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_JUMP))
jumping = true;
#endif
#ifndef _CONTENT_PACKAGE
if (app.GetFreezePlayers()) jumping = false;
#endif