From 7da64d57a8a6820392d83837f508920eb36c63ff Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Sun, 1 Mar 2026 20:02:02 -0600 Subject: [PATCH] add keyboard/mouse controls for menus and gameplay wired up keyboard and mouse input for menu navigation, inventory cursor, crafting, and general UI interaction. added WASD movement, mouse look, left ctrl sprint, left shift sneak, and all the keybinds for gameplay. also fixed the sound engine crashing when it cant find a sound asset, and set up the x64 build with proper post-build steps for dlls and redist --- Minecraft.Client/Common/Audio/SoundEngine.cpp | 3 + .../UI/IUIScene_AbstractContainerMenu.cpp | 53 +++++++--- .../UI/IUIScene_AbstractContainerMenu.h | 12 +++ Minecraft.Client/Common/UI/UIController.cpp | 97 ++++++++++++++++++- Minecraft.Client/Common/UI/UIScene.h | 2 + .../UI/UIScene_AbstractContainerMenu.cpp | 58 +++++++++-- .../Common/UI/UIScene_AbstractContainerMenu.h | 2 + Minecraft.Client/Input.cpp | 31 +++++- Minecraft.Client/Input.h | 3 +- Minecraft.Client/KeyboardMouseInput.cpp | 27 ++++-- Minecraft.Client/KeyboardMouseInput.h | 2 + Minecraft.Client/LocalPlayer.cpp | 6 ++ Minecraft.Client/Minecraft.Client.vcxproj | 64 ++++++++++-- Minecraft.Client/Minecraft.cpp | 11 ++- Minecraft.Client/Minecraft.h | 1 + MinecraftConsoles.sln | 4 + 16 files changed, 335 insertions(+), 41 deletions(-) diff --git a/Minecraft.Client/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Common/Audio/SoundEngine.cpp index 4eaf7df..ef72dd8 100644 --- a/Minecraft.Client/Common/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Common/Audio/SoundEngine.cpp @@ -456,6 +456,9 @@ void SoundEngine::updateMiles() if ( SoundInfo.Status != MILESEVENT_SOUND_STATUS_COMPLETE ) { + if (SoundInfo.Sample == NULL) + continue; + // apply the master volume // watch for the 'special' volume levels bool isThunder = false; diff --git a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp index 97e7e9d..dac2f6e 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp @@ -15,6 +15,9 @@ #ifdef _WINDOWS64 #include "..\..\KeyboardMouseInput.h" +#include "UI.h" + +SavedInventoryCursorPos g_savedInventoryCursorPos = { 0.0f, 0.0f, false }; #endif IUIScene_AbstractContainerMenu::IUIScene_AbstractContainerMenu() @@ -470,20 +473,26 @@ void IUIScene_AbstractContainerMenu::onMouseTick() #ifdef _WINDOWS64 if (!g_KBMInput.IsMouseGrabbed()) { - int dx = g_KBMInput.GetMouseDeltaX(); - int dy = g_KBMInput.GetMouseDeltaY(); - if (dx != 0 || dy != 0) - { - float sensitivity = (float)app.GetGameSettings(iPad, eGameSetting_Sensitivity_InMenu) / 100.0f; - float mouseScale = sensitivity * 1.0f; - vPointerPos.x += (float)dx * mouseScale; - vPointerPos.y += (float)dy * mouseScale; - - if (vPointerPos.x < m_fPointerMinX) vPointerPos.x = m_fPointerMinX; - else if (vPointerPos.x > m_fPointerMaxX) vPointerPos.x = m_fPointerMaxX; - if (vPointerPos.y < m_fPointerMinY) vPointerPos.y = m_fPointerMinY; - else if (vPointerPos.y > m_fPointerMaxY) vPointerPos.y = m_fPointerMaxY; + int deltaX = g_KBMInput.GetMouseDeltaX(); + int deltaY = g_KBMInput.GetMouseDeltaY(); + extern HWND g_hWnd; + RECT rc; + GetClientRect(g_hWnd, &rc); + int winW = rc.right - rc.left; + int winH = rc.bottom - rc.top; + + if (winW > 0 && winH > 0) + { + float scaleX = (float)getMovieWidth() / (float)winW; + float scaleY = (float)getMovieHeight() / (float)winH; + + vPointerPos.x += (float)deltaX * scaleX; + vPointerPos.y += (float)deltaY * scaleY; + } + + if (deltaX != 0 || deltaY != 0) + { bStickInput = true; } } @@ -706,7 +715,11 @@ void IUIScene_AbstractContainerMenu::onMouseTick() // If there is no stick input, and we are over a slot, then snap pointer to slot centre. // 4J - TomK - only if this particular component allows so! +#ifdef _WINDOWS64 + if(g_KBMInput.IsMouseGrabbed() && CanHaveFocus(eSectionUnderPointer)) +#else if(CanHaveFocus(eSectionUnderPointer)) +#endif { vPointerPos.x = vSnapPos.x; vPointerPos.y = vSnapPos.y; @@ -714,7 +727,8 @@ void IUIScene_AbstractContainerMenu::onMouseTick() } } - // Clamp to pointer extents. + + // Clamp to pointer extents if ( vPointerPos.x < m_fPointerMinX ) vPointerPos.x = m_fPointerMinX; else if ( vPointerPos.x > m_fPointerMaxX ) vPointerPos.x = m_fPointerMaxX; if ( vPointerPos.y < m_fPointerMinY ) vPointerPos.y = m_fPointerMinY; @@ -1236,8 +1250,15 @@ void IUIScene_AbstractContainerMenu::onMouseTick() // Offset back to image top left. - vPointerPos.x -= m_fPointerImageOffsetX; - vPointerPos.y -= m_fPointerImageOffsetY; +#ifdef _WINDOWS64 + if (g_KBMInput.IsMouseGrabbed()) + { +#endif + vPointerPos.x -= m_fPointerImageOffsetX; + vPointerPos.y -= m_fPointerImageOffsetY; +#ifdef _WINDOWS64 + } +#endif // Update pointer position. // 4J-PB - do not allow sub pixel positions or we get broken lines in box edges diff --git a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h index bdb8bb4..54e716e 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h +++ b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h @@ -1,5 +1,15 @@ #pragma once +#ifdef _WINDOWS64 +struct SavedInventoryCursorPos +{ + float x; + float y; + bool hasSavedPos; +}; +extern SavedInventoryCursorPos g_savedInventoryCursorPos; +#endif + // Uncomment to enable tap input detection to jump 1 slot. Doesn't work particularly well yet, and I feel the system does not need it. // Would probably be required if we decide to slow down the pointer movement. // 4J Stu - There was a request to be able to navigate the scenes with the dpad, so I have used much of the TAP_DETECTION @@ -220,4 +230,6 @@ protected: public: virtual int getPad() = 0; + virtual int getMovieWidth() = 0; + virtual int getMovieHeight() = 0; }; diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index 2978d14..ffcc293 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -10,6 +10,7 @@ #include "..\..\..\Minecraft.World\net.minecraft.world.entity.boss.enderdragon.h" #ifdef _WINDOWS64 #include "..\..\KeyboardMouseInput.h" +#include "UIControl_Slider.h" #endif #include "..\..\EnderDragonRenderer.h" #include "..\..\MultiPlayerLocalPlayer.h" @@ -689,6 +690,100 @@ void UIController::tickInput() else #endif { +#ifdef _WINDOWS64 + if (!g_KBMInput.IsMouseGrabbed()) + { + UIScene *pScene = NULL; + for (int grp = 0; grp < eUIGroup_COUNT && !pScene; ++grp) + { + pScene = m_groups[grp]->GetTopScene(eUILayer_Debug); + if (!pScene) pScene = m_groups[grp]->GetTopScene(eUILayer_Tooltips); + if (!pScene) pScene = m_groups[grp]->GetTopScene(eUILayer_Error); + if (!pScene) pScene = m_groups[grp]->GetTopScene(eUILayer_Alert); + if (!pScene) pScene = m_groups[grp]->GetTopScene(eUILayer_Popup); + if (!pScene) pScene = m_groups[grp]->GetTopScene(eUILayer_Fullscreen); + if (!pScene) pScene = m_groups[grp]->GetTopScene(eUILayer_Scene); + } + if (pScene && pScene->getMovie()) + { + Iggy *movie = pScene->getMovie(); + F32 mouseX = (F32)g_KBMInput.GetMouseX(); + F32 mouseY = (F32)g_KBMInput.GetMouseY(); + + extern HWND g_hWnd; + if (g_hWnd) + { + RECT rc; + GetClientRect(g_hWnd, &rc); + int winW = rc.right - rc.left; + int winH = rc.bottom - rc.top; + if (winW > 0 && winH > 0) + { + mouseX = mouseX * (m_fScreenWidth / (F32)winW); + mouseY = mouseY * (m_fScreenHeight / (F32)winH); + } + } + + IggyFocusHandle currentFocus = IGGY_FOCUS_NULL; + IggyFocusableObject focusables[64]; + S32 numFocusables = 0; + IggyPlayerGetFocusableObjects(movie, ¤tFocus, focusables, 64, &numFocusables); + + IggyFocusHandle hitObject = IGGY_FOCUS_NULL; + for (S32 i = 0; i < numFocusables; ++i) + { + if (mouseX >= focusables[i].x0 && mouseX <= focusables[i].x1 && + mouseY >= focusables[i].y0 && mouseY <= focusables[i].y1) + { + hitObject = focusables[i].object; + break; + } + } + + if (hitObject != IGGY_FOCUS_NULL && hitObject != currentFocus) + { + IggyPlayerSetFocusRS(movie, hitObject, 0); + } + + if (g_KBMInput.IsMouseButtonDown(0) || g_KBMInput.IsMouseButtonPressed(0)) + { + vector *controls = pScene->GetControls(); + if (controls) + { + for (size_t i = 0; i < controls->size(); i++) + { + UIControl *ctrl = (*controls)[i]; + if (ctrl && ctrl->getControlType() == UIControl::eSlider && ctrl->getVisible()) + { + S32 cx = ctrl->getXPos(); + S32 cy = ctrl->getYPos(); + S32 cw = ctrl->getWidth(); + S32 ch = ctrl->getHeight(); + + if (mouseX >= cx && mouseX <= cx + cw && + mouseY >= cy && mouseY <= cy + ch) + { + UIControl_Slider *pSlider = (UIControl_Slider *)ctrl; + float fNewSliderPos = (mouseX - (float)cx) / (float)pSlider->GetRealWidth(); + if (fNewSliderPos < 0.0f) fNewSliderPos = 0.0f; + if (fNewSliderPos > 1.0f) fNewSliderPos = 1.0f; + pSlider->SetSliderTouchPos(fNewSliderPos); + break; + } + } + } + } + } + } + + + int wheel = g_KBMInput.GetMouseWheel(); + if (wheel > 0) + handleKeyPress(0, ACTION_MENU_UP); + else if (wheel < 0) + handleKeyPress(0, ACTION_MENU_DOWN); + } +#endif handleInput(); ++m_accumulatedTicks; } @@ -3050,4 +3145,4 @@ void UIController::SendTouchInput(unsigned int iPad, unsigned int key, bool bPre } -#endif \ No newline at end of file +#endif diff --git a/Minecraft.Client/Common/UI/UIScene.h b/Minecraft.Client/Common/UI/UIScene.h index 823c510..982b472 100644 --- a/Minecraft.Client/Common/UI/UIScene.h +++ b/Minecraft.Client/Common/UI/UIScene.h @@ -109,6 +109,8 @@ public: #ifdef __PSVITA__ UILayer *GetParentLayer() {return m_parentLayer;} EUIGroup GetParentLayerGroup() {return m_parentLayer->m_parentGroup->GetGroup();} +#endif +#if defined(__PSVITA__) || defined(_WINDOWS64) vector *GetControls() {return &m_controls;} #endif diff --git a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp index a1bd827..66b3569 100644 --- a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp @@ -2,6 +2,10 @@ #include "UI.h" #include "UIScene_AbstractContainerMenu.h" +#ifdef _WINDOWS64 +#include "..\..\KeyboardMouseInput.h" +#endif + #include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h" #include "..\..\..\Minecraft.World\net.minecraft.world.item.h" #include "..\..\MultiplayerLocalPlayer.h" @@ -35,6 +39,15 @@ UIScene_AbstractContainerMenu::~UIScene_AbstractContainerMenu() void UIScene_AbstractContainerMenu::handleDestroy() { app.DebugPrintf("UIScene_AbstractContainerMenu::handleDestroy\n"); + +#ifdef _WINDOWS64 + g_savedInventoryCursorPos.x = m_pointerPos.x; + g_savedInventoryCursorPos.y = m_pointerPos.y; + g_savedInventoryCursorPos.hasSavedPos = true; + + while (ShowCursor(TRUE) < 0); +#endif + Minecraft *pMinecraft = Minecraft::GetInstance(); if( pMinecraft->localgameModes[m_iPad] != NULL ) { @@ -59,6 +72,7 @@ void UIScene_AbstractContainerMenu::handleDestroy() ui.OverrideSFX(m_iPad,ACTION_MENU_RIGHT,false); ui.OverrideSFX(m_iPad,ACTION_MENU_UP,false); ui.OverrideSFX(m_iPad,ACTION_MENU_DOWN,false); + } void UIScene_AbstractContainerMenu::InitDataAssociations(int iPad, AbstractContainerMenu *menu, int startIndex) @@ -67,6 +81,9 @@ void UIScene_AbstractContainerMenu::InitDataAssociations(int iPad, AbstractConta void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex) { +#ifdef _WINDOWS64 + while (ShowCursor(FALSE) >= 0); +#endif m_labelInventory.init( app.GetString(IDS_INVENTORY) ); @@ -106,8 +123,8 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex) #ifdef __ORBIS__ // we need to map the touchpad rectangle to the UI rectangle. While it works great for the creative menu, it is much too sensitive for the smaller menus. //X coordinate of the touch point (0 to 1919) - //Y coordinate of the touch point (0 to 941: DUALSHOCK®4 wireless controllers and the CUH-ZCT1J/CAP-ZCT1J/CAP-ZCT1U controllers for the PlayStation®4 development tool, - //0 to 753: JDX-1000x series controllers for the PlayStation®4 development tool,) + //Y coordinate of the touch point (0 to 941: DUALSHOCK�4 wireless controllers and the CUH-ZCT1J/CAP-ZCT1J/CAP-ZCT1U controllers for the PlayStation�4 development tool, + //0 to 753: JDX-1000x series controllers for the PlayStation�4 development tool,) m_fTouchPadMulX=fPanelWidth/1919.0f; m_fTouchPadMulY=fPanelHeight/941.0f; m_fTouchPadDeadZoneX=15.0f*m_fTouchPadMulX; @@ -151,17 +168,39 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex) //m_pointerControl->SetPosition( &vPointerPos ); m_pointerPos = vPointerPos; +#ifdef _WINDOWS64 + if (g_savedInventoryCursorPos.hasSavedPos) + { + m_pointerPos.x = g_savedInventoryCursorPos.x; + m_pointerPos.y = g_savedInventoryCursorPos.y; + + if (m_pointerPos.x < m_fPointerMinX) m_pointerPos.x = m_fPointerMinX; + if (m_pointerPos.x > m_fPointerMaxX) m_pointerPos.x = m_fPointerMaxX; + if (m_pointerPos.y < m_fPointerMinY) m_pointerPos.y = m_fPointerMinY; + if (m_pointerPos.y > m_fPointerMaxY) m_pointerPos.y = m_fPointerMaxY; + } + + extern HWND g_hWnd; + RECT rc; + GetClientRect(g_hWnd, &rc); + POINT center; + center.x = (rc.right - rc.left) / 2; + center.y = (rc.bottom - rc.top) / 2; + ClientToScreen(g_hWnd, ¢er); + SetCursorPos(center.x, center.y); +#endif + IggyEvent mouseEvent; S32 width, height; m_parentLayer->getRenderDimensions(width, height); S32 x = m_pointerPos.x*((float)width/m_movieWidth); - S32 y = m_pointerPos.y*((float)height/m_movieHeight); + S32 y = m_pointerPos.y*((float)height/m_movieHeight); IggyMakeEventMouseMove( &mouseEvent, x, y); IggyEventResult result; IggyPlayerDispatchEventRS ( getMovie() , &mouseEvent , &result ); -#ifdef USE_POINTER_ACCEL +#ifdef USE_POINTER_ACCEL m_fPointerVelX = 0.0f; m_fPointerVelY = 0.0f; m_fPointerAccelX = 0.0f; @@ -173,13 +212,19 @@ void UIScene_AbstractContainerMenu::tick() { UIScene::tick(); +#ifdef _WINDOWS64 + SetCursor(NULL); +#endif + onMouseTick(); IggyEvent mouseEvent; S32 width, height; m_parentLayer->getRenderDimensions(width, height); - S32 x = m_pointerPos.x*((float)width/m_movieWidth); - S32 y = m_pointerPos.y*((float)height/m_movieHeight); + + S32 x = (S32)(m_pointerPos.x * ((float)width / m_movieWidth)); + S32 y = (S32)(m_pointerPos.y * ((float)height / m_movieHeight)); + IggyMakeEventMouseMove( &mouseEvent, x, y); // 4J Stu - This seems to be broken on Durango, so do it ourself @@ -192,6 +237,7 @@ void UIScene_AbstractContainerMenu::tick() IggyPlayerDispatchEventRS ( getMovie() , &mouseEvent , &result ); } + void UIScene_AbstractContainerMenu::render(S32 width, S32 height, C4JRender::eViewportType viewpBort) { m_cacheSlotRenders = true; diff --git a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.h b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.h index b98b376..c9491d6 100644 --- a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.h @@ -36,6 +36,8 @@ public: virtual void handleDestroy(); int getPad() { return m_iPad; } + int getMovieWidth() { return m_movieWidth; } + int getMovieHeight() { return m_movieHeight; } bool getIgnoreInput() { return m_bIgnoreInput; } void setIgnoreInput(bool bVal) { m_bIgnoreInput=bVal; } diff --git a/Minecraft.Client/Input.cpp b/Minecraft.Client/Input.cpp index bc95ad5..6772b3c 100644 --- a/Minecraft.Client/Input.cpp +++ b/Minecraft.Client/Input.cpp @@ -18,6 +18,7 @@ Input::Input() wasJumping = false; jumping = false; sneaking = false; + sprinting = false; lReset = false; rReset = false; @@ -93,11 +94,35 @@ void Input::tick(LocalPlayer *player) } #ifdef _WINDOWS64 - if (iPad == 0 && g_KBMInput.IsMouseGrabbed() && pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_SNEAK_TOGGLE)) + if (iPad == 0 && g_KBMInput.IsMouseGrabbed()) { + // Left Shift = sneak (hold to crouch) + if (pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_SNEAK_TOGGLE)) + { + if (!player->abilities.flying) + { + sneaking = g_KBMInput.IsKeyDown(KeyboardMouseInput::KEY_SNEAK); + } + } + + // Left Ctrl + forward = sprint (hold to sprint) if (!player->abilities.flying) { - sneaking = g_KBMInput.IsKeyDown(KeyboardMouseInput::KEY_SNEAK); + bool ctrlHeld = g_KBMInput.IsKeyDown(KeyboardMouseInput::KEY_SPRINT); + bool movingForward = (kbYA > 0.0f); + + if (ctrlHeld && movingForward) + { + sprinting = true; + } + else + { + sprinting = false; + } + } + else + { + sprinting = false; } } #endif @@ -144,7 +169,7 @@ void Input::tick(LocalPlayer *player) if (iPad == 0 && g_KBMInput.IsMouseGrabbed()) { float mouseSensitivity = ((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InGame)) / 100.0f; - float mouseLookScale = 1.0f; + float mouseLookScale = 5.0f; float mx = g_KBMInput.GetLookX(mouseSensitivity * mouseLookScale); float my = g_KBMInput.GetLookY(mouseSensitivity * mouseLookScale); diff --git a/Minecraft.Client/Input.h b/Minecraft.Client/Input.h index 0a44d76..1110981 100644 --- a/Minecraft.Client/Input.h +++ b/Minecraft.Client/Input.h @@ -10,7 +10,8 @@ public: bool wasJumping; bool jumping; bool sneaking; - + bool sprinting; + Input(); // 4J - added virtual void tick(LocalPlayer *player); diff --git a/Minecraft.Client/KeyboardMouseInput.cpp b/Minecraft.Client/KeyboardMouseInput.cpp index 9824581..31c5233 100644 --- a/Minecraft.Client/KeyboardMouseInput.cpp +++ b/Minecraft.Client/KeyboardMouseInput.cpp @@ -6,6 +6,9 @@ KeyboardMouseInput g_KBMInput; extern HWND g_hWnd; +// Forward declaration +static void ClipCursorToWindow(HWND hWnd); + // coded by notpies fr void KeyboardMouseInput::Init() { @@ -40,10 +43,6 @@ void KeyboardMouseInput::Init() rid.hwndTarget = g_hWnd; RegisterRawInputDevices(&rid, 1, sizeof(rid)); - if (g_hWnd) - { - while (ShowCursor(FALSE) >= 0) {} - } } void KeyboardMouseInput::ClearAllState() @@ -226,6 +225,9 @@ void KeyboardMouseInput::SetMouseGrabbed(bool grabbed) m_mouseGrabbed = grabbed; if (grabbed && g_hWnd) { + while (ShowCursor(FALSE) >= 0) {} + ClipCursorToWindow(g_hWnd); + RECT rc; GetClientRect(g_hWnd, &rc); POINT center; @@ -237,6 +239,11 @@ void KeyboardMouseInput::SetMouseGrabbed(bool grabbed) m_mouseDeltaAccumX = 0; m_mouseDeltaAccumY = 0; } + else if (!grabbed && g_hWnd) + { + while (ShowCursor(TRUE) < 0) {} + ClipCursor(NULL); + } } static void ClipCursorToWindow(HWND hWnd) @@ -257,8 +264,16 @@ void KeyboardMouseInput::SetWindowFocused(bool focused) m_windowFocused = focused; if (focused) { - while (ShowCursor(FALSE) >= 0) {} - ClipCursorToWindow(g_hWnd); + if (m_mouseGrabbed) + { + while (ShowCursor(FALSE) >= 0) {} + ClipCursorToWindow(g_hWnd); + } + else + { + while (ShowCursor(TRUE) < 0) {} + ClipCursor(NULL); + } } else { diff --git a/Minecraft.Client/KeyboardMouseInput.h b/Minecraft.Client/KeyboardMouseInput.h index 098e6e9..c82509a 100644 --- a/Minecraft.Client/KeyboardMouseInput.h +++ b/Minecraft.Client/KeyboardMouseInput.h @@ -18,9 +18,11 @@ public: static const int KEY_RIGHT = 'D'; static const int KEY_JUMP = VK_SPACE; static const int KEY_SNEAK = VK_LSHIFT; + static const int KEY_SPRINT = VK_LCONTROL; static const int KEY_INVENTORY = 'E'; static const int KEY_DROP = 'Q'; static const int KEY_CRAFTING = VK_TAB; + static const int KEY_CRAFTING_ALT = 'R'; static const int KEY_PAUSE = VK_ESCAPE; static const int KEY_THIRD_PERSON = VK_F5; static const int KEY_DEBUG_INFO = VK_F3; diff --git a/Minecraft.Client/LocalPlayer.cpp b/Minecraft.Client/LocalPlayer.cpp index ea66b9e..747d30a 100644 --- a/Minecraft.Client/LocalPlayer.cpp +++ b/Minecraft.Client/LocalPlayer.cpp @@ -328,6 +328,12 @@ void LocalPlayer::aiStep() } } if (isSneaking()) sprintTriggerTime = 0; +#ifdef _WINDOWS64 + if (input->sprinting && onGround && enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness) && !isSneaking()) + { + setSprinting(true); + } +#endif // 4J-PB - try not stopping sprint on collision //if (isSprinting() && (input->ya < runTreshold || horizontalCollision || !enoughFoodToSprint)) if (isSprinting() && (input->ya < runTreshold || !enoughFoodToSprint)) diff --git a/Minecraft.Client/Minecraft.Client.vcxproj b/Minecraft.Client/Minecraft.Client.vcxproj index 2137298..078a606 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj +++ b/Minecraft.Client/Minecraft.Client.vcxproj @@ -1311,6 +1311,17 @@ if not exist "$(TargetDir)\savedata" mkdir "$(TargetDir)\savedata" CopyToHardDrive $(RemoteRoot)=$(ImagePath);$(RemoteRoot)\res=Xbox\res;$(RemoteRoot)=Xbox\AvatarAwards;$(RemoteRoot)\Tutorial=Xbox\Tutorial\Tutorial;$(RemoteRoot)=Xbox\584111F70AAAAAAA;$(RemoteRoot)=Xbox\kinect\speech;$(RemoteRoot)=Xbox\XZP\TMSFiles.xzp + + copy /Y "$(TargetPath)" "$(ProjectDir)" +copy /Y "$(ProjectDir)Windows64\Iggy\lib\redist64\iggy_w64.dll" "$(ProjectDir)" +copy /Y "$(ProjectDir)Windows64\Miles\lib\redist64\mss64.dll" "$(ProjectDir)" +copy /Y "$(ProjectDir)Windows64\Iggy\lib\redist64\iggy_w64.dll" "$(OutDir)" +copy /Y "$(ProjectDir)Windows64\Miles\lib\redist64\mss64.dll" "$(OutDir)" +xcopy /Y /I /E "$(ProjectDir)redist64" "$(OutDir)redist64\" +if not exist "$(OutDir)Durango\Sound\" mkdir "$(OutDir)Durango\Sound\" +copy /Y "$(ProjectDir)Durango\Sound\Minecraft.msscmp" "$(OutDir)Durango\Sound\" + Copying exe and DLLs to Minecraft.Client and output folders + @@ -1421,7 +1432,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU true $(OutDir)$(ProjectName).pdb - d3d11.lib;..\Minecraft.World\x64_Release\Minecraft.World.lib;XInput9_1_0.lib;Windows64\Iggy\lib\iggy_w64.lib;%(AdditionalDependencies) + d3d11.lib;..\Minecraft.World\x64_Release\Minecraft.World.lib;XInput9_1_0.lib;Windows64\Iggy\lib\iggy_w64.lib;..\Minecraft.Client\Windows64\Miles\Lib\mss64.lib;%(AdditionalDependencies) NotSet false @@ -1439,6 +1450,17 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUCopyToHardDrive $(RemoteRoot)=$(ImagePath);$(RemoteRoot)\res=Xbox\res;$(RemoteRoot)=Xbox\AvatarAwards;$(RemoteRoot)\Tutorial=Xbox\Tutorial\Tutorial;$(RemoteRoot)=Xbox\584111F70AAAAAAA;$(RemoteRoot)=Xbox\kinect\speech;$(RemoteRoot)=Xbox\XZP\TMSFiles.xzp + + copy /Y "$(TargetPath)" "$(ProjectDir)" +copy /Y "$(ProjectDir)Windows64\Iggy\lib\redist64\iggy_w64.dll" "$(ProjectDir)" +copy /Y "$(ProjectDir)Windows64\Miles\lib\redist64\mss64.dll" "$(ProjectDir)" +copy /Y "$(ProjectDir)Windows64\Iggy\lib\redist64\iggy_w64.dll" "$(OutDir)" +copy /Y "$(ProjectDir)Windows64\Miles\lib\redist64\mss64.dll" "$(OutDir)" +xcopy /Y /I /E "$(ProjectDir)redist64" "$(OutDir)redist64\" +if not exist "$(OutDir)Durango\Sound\" mkdir "$(OutDir)Durango\Sound\" +copy /Y "$(ProjectDir)Durango\Sound\Minecraft.msscmp" "$(OutDir)Durango\Sound\" + Copying exe and DLLs to Minecraft.Client and output folders + @@ -34081,6 +34103,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue + true false true true @@ -34125,6 +34148,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue + true true true true @@ -34169,6 +34193,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue + true true true true @@ -34213,6 +34238,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue + true false true true @@ -34257,6 +34283,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue + true true true true @@ -34301,6 +34328,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue + true true true true @@ -34345,6 +34373,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue + true false true true @@ -34389,6 +34418,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue + true true true true @@ -34433,6 +34463,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue + true true true true @@ -34477,6 +34508,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue + true false true true @@ -34521,6 +34553,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue + true true true true @@ -34565,6 +34598,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue + true true true true @@ -34609,14 +34643,21 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue + true true - + + true + + true true - + + true + + true true true true @@ -34654,6 +34695,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue + true true true true @@ -34690,10 +34732,18 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true - - - - + + true + + + true + + + true + + + true + true true diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 8c6da75..d406a88 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -172,6 +172,7 @@ Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet //lastTickTime = System::currentTimeMillis(); recheckPlayerIn = 0; running = true; + showFpsCounter = false; unoccupiedQuadrant = -1; Stats::init(); @@ -1480,7 +1481,7 @@ void Minecraft::run_middle() if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_DROP)) localplayers[i]->ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<ullButtonsPressed|=1LL< 0) diff --git a/Minecraft.Client/Minecraft.h b/Minecraft.Client/Minecraft.h index 3076030..8cec348 100644 --- a/Minecraft.Client/Minecraft.h +++ b/Minecraft.Client/Minecraft.h @@ -211,6 +211,7 @@ private: public: void destroy(); volatile bool running; + bool showFpsCounter; wstring fpsString; void run(); // 4J-PB - split the run into 3 parts so we can run it from our xbox game loop diff --git a/MinecraftConsoles.sln b/MinecraftConsoles.sln index fd95ada..f132503 100644 --- a/MinecraftConsoles.sln +++ b/MinecraftConsoles.sln @@ -68,6 +68,7 @@ Global {F046C3CE-9749-4823-B32B-D9CC10B1A2C8}.ContentPackage|Windows64.Build.0 = ContentPackage|x64 {F046C3CE-9749-4823-B32B-D9CC10B1A2C8}.ContentPackage|Xbox 360.ActiveCfg = ContentPackage|x64 {F046C3CE-9749-4823-B32B-D9CC10B1A2C8}.Debug|Durango.ActiveCfg = Debug|x64 + {F046C3CE-9749-4823-B32B-D9CC10B1A2C8}.Debug|Durango.Build.0 = Debug|x64 {F046C3CE-9749-4823-B32B-D9CC10B1A2C8}.Debug|ORBIS.ActiveCfg = Debug|x64 {F046C3CE-9749-4823-B32B-D9CC10B1A2C8}.Debug|PS3.ActiveCfg = Debug|x64 {F046C3CE-9749-4823-B32B-D9CC10B1A2C8}.Debug|PSVita.ActiveCfg = Debug|x64 @@ -75,6 +76,7 @@ Global {F046C3CE-9749-4823-B32B-D9CC10B1A2C8}.Debug|Windows64.Build.0 = Debug|x64 {F046C3CE-9749-4823-B32B-D9CC10B1A2C8}.Debug|Xbox 360.ActiveCfg = Debug|x64 {F046C3CE-9749-4823-B32B-D9CC10B1A2C8}.Release|Durango.ActiveCfg = Release|x64 + {F046C3CE-9749-4823-B32B-D9CC10B1A2C8}.Release|Durango.Build.0 = Release|x64 {F046C3CE-9749-4823-B32B-D9CC10B1A2C8}.Release|ORBIS.ActiveCfg = Release|x64 {F046C3CE-9749-4823-B32B-D9CC10B1A2C8}.Release|PS3.ActiveCfg = Release|x64 {F046C3CE-9749-4823-B32B-D9CC10B1A2C8}.Release|PSVita.ActiveCfg = Release|x64 @@ -106,6 +108,7 @@ Global {1B9A8C38-DD48-448C-AA24-E1A35E0089A3}.ContentPackage|Windows64.ActiveCfg = ContentPackage|x64 {1B9A8C38-DD48-448C-AA24-E1A35E0089A3}.ContentPackage|Xbox 360.ActiveCfg = ContentPackage|x64 {1B9A8C38-DD48-448C-AA24-E1A35E0089A3}.Debug|Durango.ActiveCfg = Debug|x64 + {1B9A8C38-DD48-448C-AA24-E1A35E0089A3}.Debug|Durango.Build.0 = Debug|x64 {1B9A8C38-DD48-448C-AA24-E1A35E0089A3}.Debug|ORBIS.ActiveCfg = Debug|x64 {1B9A8C38-DD48-448C-AA24-E1A35E0089A3}.Debug|PS3.ActiveCfg = Debug|x64 {1B9A8C38-DD48-448C-AA24-E1A35E0089A3}.Debug|PSVita.ActiveCfg = Debug|x64 @@ -113,6 +116,7 @@ Global {1B9A8C38-DD48-448C-AA24-E1A35E0089A3}.Debug|Windows64.Build.0 = Debug|x64 {1B9A8C38-DD48-448C-AA24-E1A35E0089A3}.Debug|Xbox 360.ActiveCfg = Debug|x64 {1B9A8C38-DD48-448C-AA24-E1A35E0089A3}.Release|Durango.ActiveCfg = Release|x64 + {1B9A8C38-DD48-448C-AA24-E1A35E0089A3}.Release|Durango.Build.0 = Release|x64 {1B9A8C38-DD48-448C-AA24-E1A35E0089A3}.Release|ORBIS.ActiveCfg = Release|x64 {1B9A8C38-DD48-448C-AA24-E1A35E0089A3}.Release|PS3.ActiveCfg = Release|x64 {1B9A8C38-DD48-448C-AA24-E1A35E0089A3}.Release|PSVita.ActiveCfg = Release|x64