forked from cafeberry/cafeberry
added some kbm stuff
This commit is contained in:
@@ -90,6 +90,10 @@ int Minecraft::frameTimePos = 0;
|
||||
__int64 Minecraft::warezTime = 0;
|
||||
File Minecraft::workDir = File(L"");
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
static bool s_bHotbarKeyPrev[9] = {false,false,false,false,false,false,false,false,false};
|
||||
#endif
|
||||
|
||||
#ifdef __PSVITA__
|
||||
|
||||
TOUCHSCREENRECT QuickSelectRect[3]=
|
||||
@@ -501,6 +505,13 @@ void Minecraft::setScreen(Screen *screen)
|
||||
this->screen->removed();
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
if (screen != nullptr && InputManager.IsMouseCaptured())
|
||||
{
|
||||
InputManager.SetMouseCaptured(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
//4J Gordon: Do not force a stats save here
|
||||
/*if (dynamic_cast<TitleScreen *>(screen)!=NULL)
|
||||
{
|
||||
@@ -2184,8 +2195,39 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
if (iPad == ProfileManager.GetPrimaryPad())
|
||||
{
|
||||
if ((screen != nullptr || ui.GetMenuDisplayed(iPad)) && InputManager.IsMouseCaptured())
|
||||
{
|
||||
InputManager.SetMouseCaptured(false);
|
||||
}
|
||||
if (screen == nullptr && ui.GetMenuDisplayed(iPad))
|
||||
{
|
||||
if ((ui.IsContainerMenuDisplayed(iPad) && !ui.IsCraftingMenuDisplayed(iPad))
|
||||
#ifdef _WINDOWS64
|
||||
|| ui.IsControllerMode()
|
||||
#endif
|
||||
)
|
||||
{
|
||||
while (ShowCursor(FALSE) >= 0) {}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (ShowCursor(TRUE) < 0) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (screen == NULL && !ui.GetMenuDisplayed(iPad) )
|
||||
{
|
||||
#ifdef _WINDOWS64
|
||||
if (iPad == ProfileManager.GetPrimaryPad() && !InputManager.IsMouseCaptured() /*&& InputManager.IsWindowFocused()*/)
|
||||
{
|
||||
InputManager.SetMouseCaptured(true);
|
||||
}
|
||||
#endif
|
||||
// 4J-PB - add some tooltips if required
|
||||
int iA=-1, iB=-1, iX, iY=IDS_CONTROLS_INVENTORY, iLT=-1, iRT=-1, iLB=-1, iRB=-1, iLS=-1, iRS=-1;
|
||||
|
||||
@@ -3338,9 +3380,25 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||
{
|
||||
wheel = -1;
|
||||
}
|
||||
extern int g_iPendingHotbarScroll;
|
||||
int iNotchCount = 0;
|
||||
if (g_iPendingHotbarScroll > 0 && gameMode->isInputAllowed(MINECRAFT_ACTION_LEFT_SCROLL))
|
||||
{
|
||||
wheel = 1;
|
||||
iNotchCount = g_iPendingHotbarScroll;
|
||||
}
|
||||
else if (g_iPendingHotbarScroll < 0 && gameMode->isInputAllowed(MINECRAFT_ACTION_RIGHT_SCROLL))
|
||||
{
|
||||
wheel = -1;
|
||||
iNotchCount = -g_iPendingHotbarScroll;
|
||||
}
|
||||
g_iPendingHotbarScroll = 0;
|
||||
if (wheel != 0)
|
||||
{
|
||||
player->inventory->swapPaint(wheel);
|
||||
if (iNotchCount < 1) iNotchCount = 1;
|
||||
else if (iNotchCount > 12) iNotchCount = 12;
|
||||
for (int iNotch = 0; iNotch < iNotchCount; ++iNotch)
|
||||
player->inventory->swapPaint(wheel);
|
||||
|
||||
if( gameMode != NULL && gameMode->getTutorial() != NULL )
|
||||
{
|
||||
@@ -3356,7 +3414,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||
if (wheel > 0) wheel = 1;
|
||||
if (wheel < 0) wheel = -1;
|
||||
|
||||
options->flySpeed += wheel * .25f;
|
||||
options->flySpeed += wheel * .25f * (float)iNotchCount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3580,6 +3638,27 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||
__uint64 ullButtonsPressed=player->ullButtonsPressed;
|
||||
|
||||
bool selected = false;
|
||||
#ifdef _WINDOWS64
|
||||
if (iPad == ProfileManager.GetPrimaryPad())
|
||||
{
|
||||
for (int iSlot = 0; iSlot < 9; iSlot++)
|
||||
{
|
||||
if (InputManager.IsKeyDown('1' + iSlot) && !s_bHotbarKeyPrev[iSlot])
|
||||
{
|
||||
player->inventory->selected = iSlot;
|
||||
selected = true;
|
||||
|
||||
if( gameMode != NULL && gameMode->getTutorial() != NULL )
|
||||
{
|
||||
gameMode->getTutorial()->onSelectedItemChanged(player->inventory->getSelected());
|
||||
}
|
||||
|
||||
player->updateRichPresence();
|
||||
}
|
||||
s_bHotbarKeyPrev[iSlot] = InputManager.IsKeyDown('1' + iSlot);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef __PSVITA__
|
||||
// 4J-PB - use the touchscreen for quickselect
|
||||
SceTouchData* pTouchData = InputManager.GetTouchPadData(iPad,false);
|
||||
|
||||
Reference in New Issue
Block a user