mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Disable input instead of showing an empty gui
This commit is contained in:
parent
2dbb5eea02
commit
2ae2d9ff1b
|
|
@ -2257,6 +2257,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
int iPad=player->GetXboxPad();
|
int iPad=player->GetXboxPad();
|
||||||
//OutputDebugString("Minecraft::tick\n");
|
//OutputDebugString("Minecraft::tick\n");
|
||||||
|
|
||||||
|
|
||||||
//4J-PB - only tick this player's stats
|
//4J-PB - only tick this player's stats
|
||||||
stats[iPad]->tick(iPad);
|
stats[iPad]->tick(iPad);
|
||||||
|
|
||||||
|
|
@ -2305,6 +2306,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
* progressRenderer.progressStagePercentage(0); } else {
|
* progressRenderer.progressStagePercentage(0); } else {
|
||||||
* serverConnection.tick(); serverConnection.sendPosition(player); } }
|
* serverConnection.tick(); serverConnection.sendPosition(player); } }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (screen == NULL && player != NULL )
|
if (screen == NULL && player != NULL )
|
||||||
{
|
{
|
||||||
if (player->getHealth() <= 0 && !ui.GetMenuDisplayed(iPad) )
|
if (player->getHealth() <= 0 && !ui.GetMenuDisplayed(iPad) )
|
||||||
|
|
@ -2313,7 +2315,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
}
|
}
|
||||||
else if (player->isSleeping() && level != NULL && level->isClientSide)
|
else if (player->isSleeping() && level != NULL && level->isClientSide)
|
||||||
{
|
{
|
||||||
// setScreen(new InBedChatScreen()); // 4J - TODO put back in
|
//setScreen(new InBedChatScreen()); // 4J - TODO put back in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (screen != NULL && (dynamic_cast<InBedChatScreen *>(screen)!=NULL) && !player->isSleeping())
|
else if (screen != NULL && (dynamic_cast<InBedChatScreen *>(screen)!=NULL) && !player->isSleeping())
|
||||||
|
|
@ -2350,7 +2352,11 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||||
#ifdef _WINDOWS64
|
#ifdef _WINDOWS64
|
||||||
if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsWindowFocused())
|
if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsWindowFocused())
|
||||||
{
|
{
|
||||||
g_KBMInput.SetMouseGrabbed(true);
|
g_KBMInput.SetMouseGrabbed(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (screen == NULL && !g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsWindowFocused()) {
|
||||||
|
g_KBMInput.SetMouseGrabbed(true);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// 4J-PB - add some tooltips if required
|
// 4J-PB - add some tooltips if required
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ void KeyboardMouseInput::Init()
|
||||||
m_mouseWheelAccum = 0;
|
m_mouseWheelAccum = 0;
|
||||||
m_mouseWheelConsumed = false;
|
m_mouseWheelConsumed = false;
|
||||||
m_mouseGrabbed = false;
|
m_mouseGrabbed = false;
|
||||||
|
m_mouseActive = true;
|
||||||
m_cursorHiddenForUI = false;
|
m_cursorHiddenForUI = false;
|
||||||
m_windowFocused = true;
|
m_windowFocused = true;
|
||||||
m_hasInput = false;
|
m_hasInput = false;
|
||||||
|
|
@ -200,10 +201,15 @@ int KeyboardMouseInput::GetMouseWheel()
|
||||||
|
|
||||||
void KeyboardMouseInput::OnRawMouseDelta(int dx, int dy)
|
void KeyboardMouseInput::OnRawMouseDelta(int dx, int dy)
|
||||||
{
|
{
|
||||||
|
if (!m_mouseActive)
|
||||||
|
return;
|
||||||
|
|
||||||
m_mouseDeltaAccumX += dx;
|
m_mouseDeltaAccumX += dx;
|
||||||
m_mouseDeltaAccumY += dy;
|
m_mouseDeltaAccumY += dy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool KeyboardMouseInput::IsKeyDown(int vkCode) const
|
bool KeyboardMouseInput::IsKeyDown(int vkCode) const
|
||||||
{
|
{
|
||||||
if (vkCode == VK_SHIFT || vkCode == VK_CONTROL || vkCode == VK_MENU)
|
if (vkCode == VK_SHIFT || vkCode == VK_CONTROL || vkCode == VK_MENU)
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,9 @@ public:
|
||||||
void SetScreenCursorHidden(bool hidden) { m_screenWantsCursorHidden = hidden; }
|
void SetScreenCursorHidden(bool hidden) { m_screenWantsCursorHidden = hidden; }
|
||||||
bool IsScreenCursorHidden() const { return m_screenWantsCursorHidden; }
|
bool IsScreenCursorHidden() const { return m_screenWantsCursorHidden; }
|
||||||
|
|
||||||
|
void SetActiveMouse(bool active) { m_mouseActive = active; }
|
||||||
|
bool IsActiveMouse() { return m_mouseActive; }
|
||||||
|
|
||||||
// Text input: buffer characters typed while the native keyboard scene is open
|
// Text input: buffer characters typed while the native keyboard scene is open
|
||||||
void OnChar(wchar_t c);
|
void OnChar(wchar_t c);
|
||||||
bool ConsumeChar(wchar_t &outChar);
|
bool ConsumeChar(wchar_t &outChar);
|
||||||
|
|
@ -133,6 +136,8 @@ private:
|
||||||
|
|
||||||
bool m_kbmActive;
|
bool m_kbmActive;
|
||||||
|
|
||||||
|
bool m_mouseActive;
|
||||||
|
|
||||||
bool m_screenWantsCursorHidden;
|
bool m_screenWantsCursorHidden;
|
||||||
|
|
||||||
static const int CHAR_BUFFER_SIZE = 32;
|
static const int CHAR_BUFFER_SIZE = 32;
|
||||||
|
|
|
||||||
|
|
@ -368,13 +368,6 @@ void Player::tick()
|
||||||
foodData.tick(dynamic_pointer_cast<Player>(shared_from_this()));
|
foodData.tick(dynamic_pointer_cast<Player>(shared_from_this()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WINDOWS64
|
|
||||||
if (g_KBMInput.IsKeyDown(VK_LSHIFT) && this->isSleeping())
|
|
||||||
{
|
|
||||||
stopSleepInBed(true, true, false);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// 4J Stu Debugging
|
// 4J Stu Debugging
|
||||||
if (!level->isClientSide)
|
if (!level->isClientSide)
|
||||||
{
|
{
|
||||||
|
|
@ -1865,10 +1858,7 @@ Player::BedSleepingResult Player::startSleepInBed(int x, int y, int z, bool bTes
|
||||||
setPos(x + .5f, y + 15.0f / 16.0f, z + .5f);
|
setPos(x + .5f, y + 15.0f / 16.0f, z + .5f);
|
||||||
}
|
}
|
||||||
m_isSleeping = true;
|
m_isSleeping = true;
|
||||||
|
g_KBMInput.SetActiveMouse(false);
|
||||||
#ifdef _WINDOWS64
|
|
||||||
Minecraft::GetInstance()->setScreen(new Screen());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
sleepCounter = 0;
|
sleepCounter = 0;
|
||||||
bedPosition = new Pos(x, y, z);
|
bedPosition = new Pos(x, y, z);
|
||||||
|
|
@ -1940,6 +1930,8 @@ void Player::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, bool save
|
||||||
}
|
}
|
||||||
|
|
||||||
m_isSleeping = false;
|
m_isSleeping = false;
|
||||||
|
g_KBMInput.SetActiveMouse(true);
|
||||||
|
|
||||||
if (!level->isClientSide && updateLevelList)
|
if (!level->isClientSide && updateLevelList)
|
||||||
{
|
{
|
||||||
level->updateSleepingPlayerList();
|
level->updateSleepingPlayerList();
|
||||||
|
|
@ -1956,10 +1948,6 @@ void Player::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, bool save
|
||||||
{
|
{
|
||||||
setRespawnPosition(bedPosition, false);
|
setRespawnPosition(bedPosition, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WINDOWS64
|
|
||||||
Minecraft::GetInstance()->setScreen(nullptr);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue