make keybinds easier to change

This commit is contained in:
outis-gooner 2026-03-02 20:59:09 -08:00
parent b42a4a4e4d
commit cce03a8eed
10 changed files with 151 additions and 118 deletions

View file

@ -45,8 +45,8 @@ bool ChoiceTask::isCompleted()
sendTelemetry(); sendTelemetry();
enableConstraints(false, true); enableConstraints(false, true);
return true; return true;
} }
if(ui.GetMenuDisplayed(tutorial->getPad())) if(ui.GetMenuDisplayed(tutorial->getPad()))
{ {
// If a menu is displayed, then we use the handleUIInput to complete the task // If a menu is displayed, then we use the handleUIInput to complete the task

View file

@ -163,7 +163,7 @@ UIController::UIController()
{ {
m_uiDebugConsole = NULL; m_uiDebugConsole = NULL;
m_reloadSkinThread = NULL; m_reloadSkinThread = NULL;
m_navigateToHomeOnReload = false; m_navigateToHomeOnReload = false;
m_bCleanupOnReload = false; m_bCleanupOnReload = false;
@ -279,7 +279,7 @@ void UIController::postInit()
IggySetTextureSubstitutionCallbacks ( &UIController::TextureSubstitutionCreateCallback , &UIController::TextureSubstitutionDestroyCallback, this ); IggySetTextureSubstitutionCallbacks ( &UIController::TextureSubstitutionCreateCallback , &UIController::TextureSubstitutionDestroyCallback, this );
SetupFont(); SetupFont();
// //
loadSkins(); loadSkins();
for(unsigned int i = 0; i < eUIGroup_COUNT; ++i) for(unsigned int i = 0; i < eUIGroup_COUNT; ++i)
@ -360,7 +360,7 @@ void UIController::SetupFont()
app.m_dlcManager.LanguageChanged(); app.m_dlcManager.LanguageChanged();
app.loadStringTable(); // Switch to use new string table, app.loadStringTable(); // Switch to use new string table,
if (m_eTargetFont == m_eCurrentFont) if (m_eTargetFont == m_eCurrentFont)
{ {
// 4J-JEV: If we're ingame, reload the font to update all the text. // 4J-JEV: If we're ingame, reload the font to update all the text.
@ -435,12 +435,12 @@ bool UIController::UsingBitmapFont()
void UIController::tick() void UIController::tick()
{ {
SetupFont(); // If necessary, change font. SetupFont(); // If necessary, change font.
if ( (m_navigateToHomeOnReload || m_bCleanupOnReload) && !ui.IsReloadingSkin() ) if ( (m_navigateToHomeOnReload || m_bCleanupOnReload) && !ui.IsReloadingSkin() )
{ {
ui.CleanUpSkinReload(); ui.CleanUpSkinReload();
if (m_navigateToHomeOnReload || !g_NetworkManager.IsInSession()) if (m_navigateToHomeOnReload || !g_NetworkManager.IsInSession())
{ {
ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MainMenu); ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MainMenu);
} }
@ -707,7 +707,7 @@ void UIController::CleanUpSkinReload()
{ {
if(!Minecraft::GetInstance()->skins->getSelected()->hasAudio()) if(!Minecraft::GetInstance()->skins->getSelected()->hasAudio())
{ {
#ifdef _DURANGO #ifdef _DURANGO
DWORD result = StorageManager.UnmountInstalledDLC(L"TPACK"); DWORD result = StorageManager.UnmountInstalledDLC(L"TPACK");
#else #else
DWORD result = StorageManager.UnmountInstalledDLC("TPACK"); DWORD result = StorageManager.UnmountInstalledDLC("TPACK");
@ -774,7 +774,7 @@ void UIController::handleInput()
{ {
#ifdef _DURANGO #ifdef _DURANGO
// 4J-JEV: Added exception for primary play who migh've uttered speech commands. // 4J-JEV: Added exception for primary play who migh've uttered speech commands.
if(iPad != ProfileManager.GetPrimaryPad() if(iPad != ProfileManager.GetPrimaryPad()
&& (!InputManager.IsPadConnected(iPad) || !InputManager.IsPadLocked(iPad)) ) continue; && (!InputManager.IsPadConnected(iPad) || !InputManager.IsPadLocked(iPad)) ) continue;
#endif #endif
for(unsigned int key = 0; key <= ACTION_MAX_MENU; ++key) for(unsigned int key = 0; key <= ACTION_MAX_MENU; ++key)
@ -850,7 +850,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
{ {
// no active touch? clear active and highlighted touch UI elements // no active touch? clear active and highlighted touch UI elements
m_ActiveUIElement = NULL; m_ActiveUIElement = NULL;
m_HighlightedUIElement = NULL; m_HighlightedUIElement = NULL;
// fullscreen first // fullscreen first
UIScene *pScene=m_groups[(int)eUIGroup_Fullscreen]->getCurrentScene(); UIScene *pScene=m_groups[(int)eUIGroup_Fullscreen]->getCurrentScene();
@ -900,7 +900,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
} }
} }
} }
} }
else if(m_bTouchscreenPressed && pTouchData->reportNum==1) else if(m_bTouchscreenPressed && pTouchData->reportNum==1)
{ {
// fullscreen first // fullscreen first
@ -1001,17 +1001,17 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
bool kbDown = false, kbPressed = false, kbReleased = false; bool kbDown = false, kbPressed = false, kbReleased = false;
switch(key) switch(key)
{ {
case ACTION_MENU_UP: kbDown = KMInput.IsKeyDown(VK_UP); kbPressed = KMInput.IsKeyPressed(VK_UP); kbReleased = KMInput.IsKeyReleased(VK_UP); break; case ACTION_MENU_UP: kbDown = KMInput.IsKeyDown(KMInput::KEY_UP); kbPressed = KMInput.IsKeyPressed(KMInput::KEY_UP); kbReleased = KMInput.IsKeyReleased(KMInput::KEY_UP); break;
case ACTION_MENU_DOWN: kbDown = KMInput.IsKeyDown(VK_DOWN); kbPressed = KMInput.IsKeyPressed(VK_DOWN); kbReleased = KMInput.IsKeyReleased(VK_DOWN); break; case ACTION_MENU_DOWN: kbDown = KMInput.IsKeyDown(KMInput::KEY_DOWN); kbPressed = KMInput.IsKeyPressed(KMInput::KEY_DOWN); kbReleased = KMInput.IsKeyReleased(KMInput::KEY_DOWN); break;
case ACTION_MENU_LEFT: kbDown = KMInput.IsKeyDown(VK_LEFT); kbPressed = KMInput.IsKeyPressed(VK_LEFT); kbReleased = KMInput.IsKeyReleased(VK_LEFT); break; case ACTION_MENU_LEFT: kbDown = KMInput.IsKeyDown(KMInput::KEY_LEFT); kbPressed = KMInput.IsKeyPressed(KMInput::KEY_LEFT); kbReleased = KMInput.IsKeyReleased(KMInput::KEY_LEFT); break;
case ACTION_MENU_RIGHT: kbDown = KMInput.IsKeyDown(VK_RIGHT); kbPressed = KMInput.IsKeyPressed(VK_RIGHT); kbReleased = KMInput.IsKeyReleased(VK_RIGHT); break; case ACTION_MENU_RIGHT: kbDown = KMInput.IsKeyDown(KMInput::KEY); kbPressed = KMInput.IsKeyPressed(KMInput::KEY_RIGHT); kbReleased = KMInput.IsKeyReleased(KMInput::KEY_RIGHT); break;
case ACTION_MENU_OK: kbDown = KMInput.IsKeyDown(VK_RETURN); kbPressed = KMInput.IsKeyPressed(VK_RETURN); kbReleased = KMInput.IsKeyReleased(VK_RETURN); break; case ACTION_MENU_OK: kbDown = KMInput.IsKeyDown(KMInput::KEY_UP); kbPressed = KMInput.IsKeyPressed(KMInput::KEY_A); kbReleased = KMInput.IsKeyReleased(KMInput::KEY_A); break;
case ACTION_MENU_A: kbDown = KMInput.IsKeyDown(VK_RETURN); kbPressed = KMInput.IsKeyPressed(VK_RETURN); kbReleased = KMInput.IsKeyReleased(VK_RETURN); break; case ACTION_MENU_A: kbDown = KMInput.IsKeyDown(KMInput::KEY_A); kbPressed = KMInput.IsKeyPressed(KMInput::KEY_A); kbReleased = KMInput.IsKeyReleased(KMInput::KEY_A); break;
case ACTION_MENU_CANCEL: kbDown = KMInput.IsKeyDown(VK_ESCAPE); kbPressed = KMInput.IsKeyPressed(VK_ESCAPE); kbReleased = KMInput.IsKeyReleased(VK_ESCAPE); break; case ACTION_MENU_CANCEL: kbDown = KMInput.IsKeyDown(KMInput::KEY_B); kbPressed = KMInput.IsKeyPressed(KMInput::KEY_B); kbReleased = KMInput.IsKeyReleased(KMInput::KEY_B); break;
case ACTION_MENU_B: kbDown = KMInput.IsKeyDown(VK_ESCAPE); kbPressed = KMInput.IsKeyPressed(VK_ESCAPE); kbReleased = KMInput.IsKeyReleased(VK_ESCAPE); break; case ACTION_MENU_B: kbDown = KMInput.IsKeyDown(KMInput::KEY_B); kbPressed = KMInput.IsKeyPressed(KMInput::KEY_B); kbReleased = KMInput.IsKeyReleased(KMInput::KEY_B); break;
case ACTION_MENU_PAUSEMENU: kbDown = KMInput.IsKeyDown(VK_ESCAPE); kbPressed = KMInput.IsKeyPressed(VK_ESCAPE); kbReleased = KMInput.IsKeyReleased(VK_ESCAPE); break; case ACTION_MENU_PAUSEMENU: kbDown = KMInput.IsKeyDown(KMInput::KEY_B); kbPressed = KMInput.IsKeyPressed(KMInput::KEY_B); kbReleased = KMInput.IsKeyReleased(KMInput::KEY_B); break;
case ACTION_MENU_LEFT_SCROLL: kbDown = KMInput.IsKeyDown('Q'); kbPressed = KMInput.IsKeyPressed('Q'); kbReleased = KMInput.IsKeyReleased('Q'); break; case ACTION_MENU_LEFT_SCROLL: kbDown = KMInput.IsKeyDown(KMInput::KEY_LEFT_SCROLL); kbPressed = KMInput.IsKeyPressed(KMInput::KEY_LEFT_SCROLL); kbReleased = KMInput.IsKeyReleased(KMInput::KEY_LEFT_SCROLL); break;
case ACTION_MENU_RIGHT_SCROLL: kbDown = KMInput.IsKeyDown('E'); kbPressed = KMInput.IsKeyPressed('E'); kbReleased = KMInput.IsKeyReleased('E'); break; case ACTION_MENU_RIGHT_SCROLL: kbDown = KMInput.IsKeyDown(KMInput::KEY_RIGHT_SCROLL); kbPressed = KMInput.IsKeyPressed(KMInput::KEY_RIGHT_SCROLL); kbReleased = KMInput.IsKeyReleased(KMInput::KEY_RIGHT_SCROLL); break;
} }
pressed = pressed || kbPressed; pressed = pressed || kbPressed;
released = released || kbReleased; released = released || kbReleased;
@ -1120,8 +1120,8 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key)
app.DebugPrintf(app.USER_SR, "Total static: %d , Total dynamic: %d\n", totalStatic, totalDynamic); app.DebugPrintf(app.USER_SR, "Total static: %d , Total dynamic: %d\n", totalStatic, totalDynamic);
app.DebugPrintf(app.USER_SR, "\n\nEND TOTAL SWF MEMORY USAGE\n"); app.DebugPrintf(app.USER_SR, "\n\nEND TOTAL SWF MEMORY USAGE\n");
app.DebugPrintf(app.USER_SR, "********************************\n\n"); app.DebugPrintf(app.USER_SR, "********************************\n\n");
} }
else else
#endif #endif
#endif #endif
#endif #endif
@ -1318,7 +1318,7 @@ void UIController::setupCustomDrawGameState()
glLoadIdentity(); glLoadIdentity();
glOrtho(0, m_fScreenWidth, m_fScreenHeight, 0, 1000, 3000); glOrtho(0, m_fScreenWidth, m_fScreenHeight, 0, 1000, 3000);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glEnable(GL_ALPHA_TEST); glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.1f); glAlphaFunc(GL_GREATER, 0.1f);
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL); glDepthFunc(GL_LEQUAL);
@ -1418,10 +1418,10 @@ void RADLINK UIController::CustomDrawCallback(void *user_callback_data, Iggy *pl
//Description //Description
//Callback to create a user-defined texture to replace SWF-defined textures. //Callback to create a user-defined texture to replace SWF-defined textures.
//Parameters //Parameters
//width - Input value: optional number of pixels wide specified from AS3, or -1 if not defined. Output value: the number of pixels wide to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is. //width - Input value: optional number of pixels wide specified from AS3, or -1 if not defined. Output value: the number of pixels wide to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is.
//height - Input value: optional number of pixels high specified from AS3, or -1 if not defined. Output value: the number of pixels high to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is. //height - Input value: optional number of pixels high specified from AS3, or -1 if not defined. Output value: the number of pixels high to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is.
//destroy_callback_data - Optional additional output value you can set; the value will be passed along to the corresponding Iggy_TextureSubstitutionDestroyCallback (e.g. you can store the pointer to your own internal structure here). //destroy_callback_data - Optional additional output value you can set; the value will be passed along to the corresponding Iggy_TextureSubstitutionDestroyCallback (e.g. you can store the pointer to your own internal structure here).
//return - A platform-independent wrapped texture handle provided by GDraw, or NULL (NULL with throw an ActionScript 3 ArgumentError that the Flash developer can catch) Use by calling IggySetTextureSubstitutionCallbacks. //return - A platform-independent wrapped texture handle provided by GDraw, or NULL (NULL with throw an ActionScript 3 ArgumentError that the Flash developer can catch) Use by calling IggySetTextureSubstitutionCallbacks.
// //
//Discussion //Discussion
// //
@ -1637,7 +1637,7 @@ bool UIController::NavigateBack(int iPad, bool forceUsePad, EUIScene eScene, EUI
void UIController::NavigateToHomeMenu() void UIController::NavigateToHomeMenu()
{ {
ui.CloseAllPlayersScenes(); ui.CloseAllPlayersScenes();
// Alert the app the we no longer want to be informed of ethernet connections // Alert the app the we no longer want to be informed of ethernet connections
app.SetLiveLinkRequired( false ); app.SetLiveLinkRequired( false );
@ -1800,7 +1800,7 @@ void UIController::CloseUIScenes(int iPad, bool forceIPad)
m_groups[(int)group]->closeAllScenes(); m_groups[(int)group]->closeAllScenes();
m_groups[(int)group]->getTooltips()->SetTooltips(-1); m_groups[(int)group]->getTooltips()->SetTooltips(-1);
// This should cause the popup to dissappear // This should cause the popup to dissappear
TutorialPopupInfo popupInfo; TutorialPopupInfo popupInfo;
if(m_groups[(int)group]->getTutorialPopup()) m_groups[(int)group]->getTutorialPopup()->SetTutorialDescription(&popupInfo); if(m_groups[(int)group]->getTutorialPopup()) m_groups[(int)group]->getTutorialPopup()->SetTutorialDescription(&popupInfo);
@ -1951,7 +1951,7 @@ void UIController::SetMenuDisplayed(int iPad,bool bVal)
#ifdef _DURANGO #ifdef _DURANGO
// 4J-JEV: When in-game, allow player to toggle the 'Pause' and 'IngameInfo' menus via Kinnect. // 4J-JEV: When in-game, allow player to toggle the 'Pause' and 'IngameInfo' menus via Kinnect.
if (Minecraft::GetInstance()->running) if (Minecraft::GetInstance()->running)
InputManager.SetEnabledGtcButtons(_360_GTC_MENU | _360_GTC_PAUSE | _360_GTC_VIEW); InputManager.SetEnabledGtcButtons(_360_GTC_MENU | _360_GTC_PAUSE | _360_GTC_VIEW);
#endif #endif
} }
@ -2124,7 +2124,7 @@ void UIController::PlayUISFX(ESoundEffect eSound)
// Don't play multiple SFX on the same tick // Don't play multiple SFX on the same tick
// (prevents horrible sounds when programmatically setting multiple checkboxes) // (prevents horrible sounds when programmatically setting multiple checkboxes)
if (time - m_lastUiSfx < 10) { return; } if (time - m_lastUiSfx < 10) { return; }
m_lastUiSfx = time; m_lastUiSfx = time;
Minecraft::GetInstance()->soundEngine->playUI(eSound,1.0f,1.0f); Minecraft::GetInstance()->soundEngine->playUI(eSound,1.0f,1.0f);
} }
@ -2371,7 +2371,7 @@ void UIController::SetTrialTimerLimitSecs(unsigned int uiSeconds)
void UIController::UpdateTrialTimer(unsigned int iPad) void UIController::UpdateTrialTimer(unsigned int iPad)
{ {
WCHAR wcTime[20]; WCHAR wcTime[20];
DWORD dwTimeTicks=(DWORD)app.getTrialTimer(); DWORD dwTimeTicks=(DWORD)app.getTrialTimer();
@ -2433,7 +2433,7 @@ void UIController::ShowAutosaveCountdownTimer(bool show)
void UIController::UpdateAutosaveCountdownTimer(unsigned int uiSeconds) void UIController::UpdateAutosaveCountdownTimer(unsigned int uiSeconds)
{ {
#if !(defined(_XBOX_ONE) || defined(__ORBIS__)) #if !(defined(_XBOX_ONE) || defined(__ORBIS__))
WCHAR wcAutosaveCountdown[100]; WCHAR wcAutosaveCountdown[100];
swprintf( wcAutosaveCountdown, 100, app.GetString(IDS_AUTOSAVE_COUNTDOWN),uiSeconds); swprintf( wcAutosaveCountdown, 100, app.GetString(IDS_AUTOSAVE_COUNTDOWN),uiSeconds);
if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->setTrialTimer(wcAutosaveCountdown); if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->setTrialTimer(wcAutosaveCountdown);
#endif #endif
@ -2603,7 +2603,7 @@ C4JStorage::EMessageResult UIController::RequestUGCMessageBox(UINT title/* = -1
#ifdef __ORBIS__ #ifdef __ORBIS__
// Show the vague UGC system message in addition to our message // Show the vague UGC system message in addition to our message
ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_UGC_RESTRICTION, iPad ); ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_UGC_RESTRICTION, iPad );
return C4JStorage::EMessage_ResultAccept; return C4JStorage::EMessage_ResultAccept;
#elif defined(__PSVITA__) #elif defined(__PSVITA__)
ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, iPad ); ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, iPad );
UINT uiIDA[1]; UINT uiIDA[1];
@ -2640,7 +2640,7 @@ C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox(UINT
#ifdef __ORBIS__ #ifdef __ORBIS__
// Show the vague UGC system message in addition to our message // Show the vague UGC system message in addition to our message
ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_UGC_RESTRICTION, iPad ); ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_UGC_RESTRICTION, iPad );
return C4JStorage::EMessage_ResultAccept; return C4JStorage::EMessage_ResultAccept;
#elif defined(__PSVITA__) #elif defined(__PSVITA__)
ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_AGE_RESTRICTION, iPad ); ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_AGE_RESTRICTION, iPad );
return C4JStorage::EMessage_ResultAccept; return C4JStorage::EMessage_ResultAccept;
@ -2680,7 +2680,7 @@ void UIController::setFontCachingCalculationBuffer(int length)
} }
} }
// Returns the first scene of given type if it exists, NULL otherwise // Returns the first scene of given type if it exists, NULL otherwise
UIScene *UIController::FindScene(EUIScene sceneType) UIScene *UIController::FindScene(EUIScene sceneType)
{ {
UIScene *pScene = NULL; UIScene *pScene = NULL;
@ -2822,7 +2822,7 @@ void UIController::TouchBoxesClear(UIScene *pUIScene)
for (AUTO_VAR(it, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].begin()); it != itEnd; it++) for (AUTO_VAR(it, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].begin()); it != itEnd; it++)
{ {
UIELEMENT *element=(UIELEMENT *)*it; UIELEMENT *element=(UIELEMENT *)*it;
delete element; delete element;
} }
m_TouchBoxes[eUIGroup][eUILayer][eUIscene].clear(); m_TouchBoxes[eUIGroup][eUILayer][eUIscene].clear();
} }
@ -2858,7 +2858,7 @@ bool UIController::TouchBoxHit(UIScene *pUIScene,S32 x, S32 y)
return true; return true;
} }
} }
} }
} }
//app.DebugPrintf("MISS at x = %i y = %i\n", (int)x, (int)y); //app.DebugPrintf("MISS at x = %i y = %i\n", (int)x, (int)y);
@ -3137,4 +3137,4 @@ void UIController::SendTouchInput(unsigned int iPad, unsigned int key, bool bPre
} }
#endif #endif

View file

@ -50,10 +50,10 @@ void Input::tick(LocalPlayer *player)
if (iPad == 0 && KMInput.IsCaptured()) if (iPad == 0 && KMInput.IsCaptured())
{ {
float kbX = 0.0f, kbY = 0.0f; float kbX = 0.0f, kbY = 0.0f;
if (KMInput.IsKeyDown('W')) { kbY += 1.0f; sprintForward += 1.0f; usingKeyboardMovement = true; } if (KMInput.IsKeyDown(KeyboardMouseInput::KEY_WALK_UP)) { kbY += 1.0f; sprintForward += 1.0f; usingKeyboardMovement = true; }
if (KMInput.IsKeyDown('S')) { kbY -= 1.0f; sprintForward -= 1.0f; usingKeyboardMovement = true; } if (KMInput.IsKeyDown(KeyboardMouseInput::KEY_WALK_DOWN)) { kbY -= 1.0f; sprintForward -= 1.0f; usingKeyboardMovement = true; }
if (KMInput.IsKeyDown('A')) { kbX += 1.0f; usingKeyboardMovement = true; } // inverted like gamepad if (KMInput.IsKeyDown(KeyboardMouseInput::KEY_WALK_LEFT)) { kbX += 1.0f; usingKeyboardMovement = true; } // inverted like gamepad
if (KMInput.IsKeyDown('D')) { kbX -= 1.0f; usingKeyboardMovement = true; } if (KMInput.IsKeyDown(KeyboardMouseInput::KEY_WALK_RIGHT)) { kbX -= 1.0f; usingKeyboardMovement = true; }
// Normalize diagonal // Normalize diagonal
if (kbX != 0.0f && kbY != 0.0f) { kbX *= 0.707f; kbY *= 0.707f; } 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)) if (pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_LEFT) || pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_RIGHT))

View file

@ -142,7 +142,7 @@ void LocalPlayer::calculateFlight(float xa, float ya, float za)
void LocalPlayer::serverAiStep() void LocalPlayer::serverAiStep()
{ {
Player::serverAiStep(); Player::serverAiStep();
if( abilities.flying && abilities.mayfly ) if( abilities.flying && abilities.mayfly )
{ {
// snap y rotation for flying to nearest 90 degrees in world space // snap y rotation for flying to nearest 90 degrees in world space
@ -160,7 +160,7 @@ void LocalPlayer::serverAiStep()
float yRotDiff = yRotSnapped - yRotFinal; float yRotDiff = yRotSnapped - yRotFinal;
// Apply the same difference to the player rotated space angle // Apply the same difference to the player rotated space angle
float yRotInputAdjust = yRotInput + yRotDiff; float yRotInputAdjust = yRotInput + yRotDiff;
// Calculate final x/y player-space movement required // Calculate final x/y player-space movement required
this->xxa = cos(yRotInputAdjust * ( PI / 180.0f) ) * fMag; this->xxa = cos(yRotInputAdjust * ( PI / 180.0f) ) * fMag;
this->yya = sin(yRotInputAdjust * ( PI / 180.0f) ) * fMag; this->yya = sin(yRotInputAdjust * ( PI / 180.0f) ) * fMag;
@ -294,7 +294,7 @@ void LocalPlayer::aiStep()
#ifdef _WINDOWS64 #ifdef _WINDOWS64
// Keyboard sprint: Ctrl held while moving forward // Keyboard sprint: Ctrl held while moving forward
if (GetXboxPad() == 0 && input->usingKeyboardMovement && KMInput.IsKeyDown(VK_CONTROL) && sprintForward > 0.0f && if (GetXboxPad() == 0 && input->usingKeyboardMovement && KMInput.IsKeyDown(KMInput::KEY_SPRINT) && sprintForward > 0.0f &&
enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness) && onGround) enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness) && onGround)
{ {
if (!isSprinting()) setSprinting(true); if (!isSprinting()) setSprinting(true);
@ -332,7 +332,7 @@ void LocalPlayer::aiStep()
if (isSprinting() && (!forwardEnoughToContinueSprint || !enoughFoodToSprint || isSneaking() || isUsingItem())) if (isSprinting() && (!forwardEnoughToContinueSprint || !enoughFoodToSprint || isSneaking() || isUsingItem()))
{ {
setSprinting(false); setSprinting(false);
} }
// 4J Stu - Fix for #52705 - Customer Encountered: Player can fly in bed while being in Creative mode. // 4J Stu - Fix for #52705 - Customer Encountered: Player can fly in bed while being in Creative mode.
if (!isSleeping() && (abilities.mayfly || isAllowedToFly() )) if (!isSleeping() && (abilities.mayfly || isAllowedToFly() ))
@ -373,7 +373,7 @@ void LocalPlayer::aiStep()
abilities.flying = false; abilities.flying = false;
} }
} }
if (abilities.flying) if (abilities.flying)
{ {
@ -435,7 +435,7 @@ void LocalPlayer::aiStep()
{ {
jumpRidingScale = (float) jumpRidingTicks * .1f; jumpRidingScale = (float) jumpRidingTicks * .1f;
} }
else else
{ {
jumpRidingScale = .8f + (2.f / ((float) (jumpRidingTicks - 9))) * .1f; jumpRidingScale = .8f + (2.f / ((float) (jumpRidingTicks - 9))) * .1f;
} }
@ -534,7 +534,7 @@ void LocalPlayer::aiStep()
else else
{ {
ProfileManager.SetCurrentGameActivity(m_iPad,CONTEXT_PRESENCE_MULTIPLAYER,false); ProfileManager.SetCurrentGameActivity(m_iPad,CONTEXT_PRESENCE_MULTIPLAYER,false);
} }
} }
else else
{ {
@ -831,7 +831,7 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param)
{ {
#ifdef _DURANGO #ifdef _DURANGO
// 4J-JEV: Maybe we want to fine tune this later? #TODO // 4J-JEV: Maybe we want to fine tune this later? #TODO
if ( !ProfileManager.IsGuest(GetXboxPad()) if ( !ProfileManager.IsGuest(GetXboxPad())
&& app.CanRecordStatsAndAchievements() && app.CanRecordStatsAndAchievements()
&& ProfileManager.IsFullVersion() && ProfileManager.IsFullVersion()
) )
@ -910,7 +910,7 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param)
toolStats[0][2] = GenericStats::itemsCrafted(Item::shovel_iron->id); toolStats[0][2] = GenericStats::itemsCrafted(Item::shovel_iron->id);
toolStats[0][3] = GenericStats::itemsCrafted(Item::shovel_diamond->id); toolStats[0][3] = GenericStats::itemsCrafted(Item::shovel_diamond->id);
toolStats[0][4] = GenericStats::itemsCrafted(Item::shovel_gold->id); toolStats[0][4] = GenericStats::itemsCrafted(Item::shovel_gold->id);
toolStats[1][0] = GenericStats::itemsCrafted(Item::pickAxe_wood->id); toolStats[1][0] = GenericStats::itemsCrafted(Item::pickAxe_wood->id);
toolStats[1][1] = GenericStats::itemsCrafted(Item::pickAxe_stone->id); toolStats[1][1] = GenericStats::itemsCrafted(Item::pickAxe_stone->id);
toolStats[1][2] = GenericStats::itemsCrafted(Item::pickAxe_iron->id); toolStats[1][2] = GenericStats::itemsCrafted(Item::pickAxe_iron->id);
toolStats[1][3] = GenericStats::itemsCrafted(Item::pickAxe_diamond->id); toolStats[1][3] = GenericStats::itemsCrafted(Item::pickAxe_diamond->id);
@ -925,7 +925,7 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param)
toolStats[3][2] = GenericStats::itemsCrafted(Item::hoe_iron->id); toolStats[3][2] = GenericStats::itemsCrafted(Item::hoe_iron->id);
toolStats[3][3] = GenericStats::itemsCrafted(Item::hoe_diamond->id); toolStats[3][3] = GenericStats::itemsCrafted(Item::hoe_diamond->id);
toolStats[3][4] = GenericStats::itemsCrafted(Item::hoe_gold->id); toolStats[3][4] = GenericStats::itemsCrafted(Item::hoe_gold->id);
bool justCraftedTool = false; bool justCraftedTool = false;
for (int i=0; i<4; i++) for (int i=0; i<4; i++)
{ {
@ -963,7 +963,7 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param)
awardStat(GenericStats::MOARTools(), GenericStats::param_noArgs()); awardStat(GenericStats::MOARTools(), GenericStats::param_noArgs());
} }
} }
} }
#ifdef _XBOX #ifdef _XBOX
@ -1047,7 +1047,7 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param)
numEmeraldMined = pStats->getTotalValue(emeraldMined); numEmeraldMined = pStats->getTotalValue(emeraldMined);
numEmeraldBought = pStats->getTotalValue(emeraldBought); numEmeraldBought = pStats->getTotalValue(emeraldBought);
totalSum = numEmeraldMined + numEmeraldBought; totalSum = numEmeraldMined + numEmeraldBought;
app.DebugPrintf( app.DebugPrintf(
"[AwardStat] Check unlock 'The Haggler': " "[AwardStat] Check unlock 'The Haggler': "
"emerald_mined=%i, emerald_bought=%i, sum=%i.\n", "emerald_mined=%i, emerald_bought=%i, sum=%i.\n",
@ -1103,7 +1103,7 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param)
// AWARD : Rainbow Collection, collect all different colours of wool. // AWARD : Rainbow Collection, collect all different colours of wool.
{ {
bool justPickedupWool = false; bool justPickedupWool = false;
for (int i=0; i<16; i++) for (int i=0; i<16; i++)
if ( stat == GenericStats::itemsCollected(Tile::wool_Id, i) ) if ( stat == GenericStats::itemsCollected(Tile::wool_Id, i) )
justPickedupWool = true; justPickedupWool = true;
@ -1111,7 +1111,7 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param)
if (justPickedupWool) if (justPickedupWool)
{ {
unsigned int woolCount = 0; unsigned int woolCount = 0;
for (unsigned int i = 0; i < 16; i++) for (unsigned int i = 0; i < 16; i++)
{ {
if (pStats->getTotalValue(GenericStats::itemsCollected(Tile::wool_Id, i)) > 0) if (pStats->getTotalValue(GenericStats::itemsCollected(Tile::wool_Id, i)) > 0)
@ -1300,7 +1300,7 @@ void LocalPlayer::mapPlayerChunk(const unsigned int flagTileType)
cout << "O"; cout << "O";
else for (unsigned int y = 127; y > 0; y--) else for (unsigned int y = 127; y > 0; y--)
{ {
int t = cc->getTile(x,y,z); int t = cc->getTile(x,y,z);
if (flagTileType != 0 && t == flagTileType) { cout << "@"; break; } if (flagTileType != 0 && t == flagTileType) { cout << "@"; break; }
else if (t != 0 && t < 10) { cout << t; break; } else if (t != 0 && t < 10) { cout << t; break; }
else if (t > 0) { cout << "#"; break; } else if (t > 0) { cout << "#"; break; }
@ -1334,7 +1334,7 @@ void LocalPlayer::handleMouseDown(int button, bool down)
if( ( ( y == 0 ) || ( ( y == 127 ) && level->dimension->hasCeiling ) ) && level->dimension->id != 1 ) return; if( ( ( y == 0 ) || ( ( y == 127 ) && level->dimension->hasCeiling ) ) && level->dimension->id != 1 ) return;
minecraft->gameMode->continueDestroyBlock(x, y, z, minecraft->hitResult->f); minecraft->gameMode->continueDestroyBlock(x, y, z, minecraft->hitResult->f);
if(mayDestroyBlockAt(x,y,z)) if(mayDestroyBlockAt(x,y,z))
{ {
minecraft->particleEngine->crack(x, y, z, minecraft->hitResult->f); minecraft->particleEngine->crack(x, y, z, minecraft->hitResult->f);
@ -1372,7 +1372,7 @@ bool LocalPlayer::creativeModeHandleMouseClick(int button, bool buttonPressed)
} }
// Get distance from last click point in each axis // Get distance from last click point in each axis
float dX = (float)x - lastClickX; float dX = (float)x - lastClickX;
float dY = (float)y - lastClickY; float dY = (float)y - lastClickY;
float dZ = (float)z - lastClickZ; float dZ = (float)z - lastClickZ;
bool newClick = false; bool newClick = false;
@ -1520,13 +1520,13 @@ bool LocalPlayer::handleMouseClick(int button)
bool returnItemPlaced = false; bool returnItemPlaced = false;
if (button == 0 && missTime > 0) return false; if (button == 0 && missTime > 0) return false;
if (button == 0) if (button == 0)
{ {
//app.DebugPrintf("handleMouseClick - Player %d is swinging\n",GetXboxPad()); //app.DebugPrintf("handleMouseClick - Player %d is swinging\n",GetXboxPad());
swing(); swing();
} }
bool mayUse = true; bool mayUse = true;
// 4J-PB - Adding a special case in here for sleeping in a bed in a multiplayer game - we need to wake up, and we don't have the inbedchatscreen with a button // 4J-PB - Adding a special case in here for sleeping in a bed in a multiplayer game - we need to wake up, and we don't have the inbedchatscreen with a button
@ -1538,7 +1538,7 @@ bool LocalPlayer::handleMouseClick(int button)
shared_ptr<MultiplayerLocalPlayer> mplp = dynamic_pointer_cast<MultiplayerLocalPlayer>( shared_from_this() ); shared_ptr<MultiplayerLocalPlayer> mplp = dynamic_pointer_cast<MultiplayerLocalPlayer>( shared_from_this() );
if(mplp && mplp->connection) mplp->StopSleeping(); if(mplp && mplp->connection) mplp->StopSleeping();
} }
// 4J Stu - We should not accept any input while asleep, except the above to wake up // 4J Stu - We should not accept any input while asleep, except the above to wake up
if(isSleeping() && level != NULL && level->isClientSide) if(isSleeping() && level != NULL && level->isClientSide)
@ -1560,9 +1560,9 @@ bool LocalPlayer::handleMouseClick(int button)
} }
if (button == 1) if (button == 1)
{ {
// 4J-PB - if we milk a cow here, and end up with a bucket of milk, the if (mayUse && button == 1) further down will // 4J-PB - if we milk a cow here, and end up with a bucket of milk, the if (mayUse && button == 1) further down will
// then empty our bucket if we're pointing at a tile // then empty our bucket if we're pointing at a tile
// It looks like interact really should be returning a result so we can check this, but it's possibly just the // It looks like interact really should be returning a result so we can check this, but it's possibly just the
// milk bucket that causes a problem // milk bucket that causes a problem
if(minecraft->hitResult->entity->GetType()==eTYPE_COW) if(minecraft->hitResult->entity->GetType()==eTYPE_COW)
@ -1654,7 +1654,7 @@ void LocalPlayer::updateRichPresence()
else if(selectedItem != NULL && selectedItem->id == Item::map_Id) else if(selectedItem != NULL && selectedItem->id == Item::map_Id)
{ {
app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_MAP); app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_MAP);
} }
else if ( (riding != NULL) && riding->instanceof(eTYPE_MINECART) ) else if ( (riding != NULL) && riding->instanceof(eTYPE_MINECART) )
{ {
app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_RIDING_MINECART); app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_RIDING_MINECART);

View file

@ -79,7 +79,7 @@
//#define DEBUG_RENDER_SHOWS_PACKETS 1 //#define DEBUG_RENDER_SHOWS_PACKETS 1
//#define SPLITSCREEN_TEST //#define SPLITSCREEN_TEST
// If not disabled, this creates an event queue on a seperate thread so that the Level::tick calls can be offloaded // If not disabled, this creates an event queue on a seperate thread so that the Level::tick calls can be offloaded
// from the main thread, and have longer to run, since it's called at 20Hz instead of 60 // from the main thread, and have longer to run, since it's called at 20Hz instead of 60
#define DISABLE_LEVELTICK_THREAD #define DISABLE_LEVELTICK_THREAD
@ -96,7 +96,7 @@ TOUCHSCREENRECT QuickSelectRect[3]=
{ {
{ 560, 890, 1360, 980 }, { 560, 890, 1360, 980 },
{ 450, 840, 1449, 960 }, { 450, 840, 1449, 960 },
{ 320, 840, 1600, 970 }, { 320, 840, 1600, 970 },
}; };
int QuickSelectBoxWidth[3]= int QuickSelectBoxWidth[3]=
@ -1279,7 +1279,7 @@ void Minecraft::run_middle()
if( pDLCPack ) if( pDLCPack )
{ {
if(!pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" )) if(!pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" ))
{ {
bTrialTexturepack=true; bTrialTexturepack=true;
} }
} }
@ -1401,7 +1401,7 @@ void Minecraft::run_middle()
{ {
delete m_pPsPlusUpsell; delete m_pPsPlusUpsell;
m_pPsPlusUpsell = NULL; m_pPsPlusUpsell = NULL;
if ( ProfileManager.HasPlayStationPlus(i) ) if ( ProfileManager.HasPlayStationPlus(i) )
{ {
app.DebugPrintf("<Minecraft.cpp> Player_%i is now authorised for PsPlus.\n", i); app.DebugPrintf("<Minecraft.cpp> Player_%i is now authorised for PsPlus.\n", i);
@ -1450,13 +1450,13 @@ void Minecraft::run_middle()
// Keyboard/mouse button presses for player 0 // Keyboard/mouse button presses for player 0
if (i == 0) if (i == 0)
{ {
if (KMInput.ConsumeKeyPress(VK_ESCAPE)) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_PAUSEMENU; if (KMInput.ConsumeKeyPress(KMInput::KEY_PAUSE)) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_PAUSEMENU;
if (KMInput.ConsumeKeyPress('E')) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_INVENTORY; if (KMInput.ConsumeKeyPress(KMInput::KEY_INVEN)) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_INVENTORY;
if (KMInput.ConsumeKeyPress('Q')) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_DROP; if (KMInput.ConsumeKeyPress(KMInput::KEY_DROP)) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_DROP;
if (KMInput.ConsumeKeyPress('C')) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_CRAFTING; if (KMInput.ConsumeKeyPress(KMInput::KEY_CRAFT)) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_CRAFTING;
if (KMInput.ConsumeKeyPress(VK_F5)) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_RENDER_THIRD_PERSON; if (KMInput.ConsumeKeyPress(KMInput::KEY_TOGGLE_VIEW)) localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_RENDER_THIRD_PERSON;
// In flying mode, Shift held = sneak/descend // In flying mode, Shift held = sneak/descend
if (localplayers[i]->abilities.flying && KMInput.IsKeyDown(VK_SHIFT)) if (localplayers[i]->abilities.flying && KMInput.IsKeyDown(KMInput::KEY_SNEAK))
localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_SNEAK_TOGGLE; localplayers[i]->ullButtonsPressed |= 1LL<<MINECRAFT_ACTION_SNEAK_TOGGLE;
} }
#endif #endif
@ -2184,7 +2184,7 @@ void Minecraft::levelTickThreadInitFunc()
{ {
AABB::CreateNewThreadStorage(); AABB::CreateNewThreadStorage();
Vec3::CreateNewThreadStorage(); Vec3::CreateNewThreadStorage();
IntCache::CreateNewThreadStorage(); IntCache::CreateNewThreadStorage();
Compression::UseDefaultThreadStorage(); Compression::UseDefaultThreadStorage();
} }
@ -2801,10 +2801,10 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
shared_ptr<ItemInstance> heldItem = nullptr; shared_ptr<ItemInstance> heldItem = nullptr;
if (player->inventory->IsHeldItem()) if (player->inventory->IsHeldItem())
{ {
heldItem = player->inventory->getSelected(); heldItem = player->inventory->getSelected();
} }
int heldItemId = heldItem != NULL ? heldItem->getItem()->id : -1; int heldItemId = heldItem != NULL ? heldItem->getItem()->id : -1;
switch(entityType) switch(entityType)
{ {
case eTYPE_CHICKEN: case eTYPE_CHICKEN:
@ -2846,7 +2846,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
case eTYPE_COW: case eTYPE_COW:
{ {
if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT; if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
shared_ptr<Animal> animal = dynamic_pointer_cast<Animal>(hitResult->entity); shared_ptr<Animal> animal = dynamic_pointer_cast<Animal>(hitResult->entity);
if (animal->isLeashed() && animal->getLeashHolder() == player) if (animal->isLeashed() && animal->getLeashHolder() == player)
@ -2910,7 +2910,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
*piUse=IDS_TOOLTIPS_MILK; *piUse=IDS_TOOLTIPS_MILK;
break; break;
case Item::shears_Id: case Item::shears_Id:
{ {
if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT; if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
if(!animal->isBaby()) *piUse=IDS_TOOLTIPS_SHEAR; if(!animal->isBaby()) *piUse=IDS_TOOLTIPS_SHEAR;
} }
@ -2938,10 +2938,10 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
*piAction = IDS_TOOLTIPS_MINE; *piAction = IDS_TOOLTIPS_MINE;
*piUse = IDS_TOOLTIPS_RIDE; // are we in the minecart already? - 4J-JEV: Doesn't matter anymore. *piUse = IDS_TOOLTIPS_RIDE; // are we in the minecart already? - 4J-JEV: Doesn't matter anymore.
break; break;
case eTYPE_MINECART_FURNACE: case eTYPE_MINECART_FURNACE:
*piAction = IDS_TOOLTIPS_MINE; *piAction = IDS_TOOLTIPS_MINE;
// if you have coal, it'll go. Is there an object in hand? // if you have coal, it'll go. Is there an object in hand?
if (heldItemId == Item::coal_Id) *piUse=IDS_TOOLTIPS_USE; if (heldItemId == Item::coal_Id) *piUse=IDS_TOOLTIPS_USE;
break; break;
@ -3022,7 +3022,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT; if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
shared_ptr<Pig> pig = dynamic_pointer_cast<Pig>(hitResult->entity); shared_ptr<Pig> pig = dynamic_pointer_cast<Pig>(hitResult->entity);
if (pig->isLeashed() && pig->getLeashHolder() == player) if (pig->isLeashed() && pig->getLeashHolder() == player)
{ {
*piUse=IDS_TOOLTIPS_UNLEASH; *piUse=IDS_TOOLTIPS_UNLEASH;
@ -3165,7 +3165,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
shared_ptr<Ocelot> ocelot = dynamic_pointer_cast<Ocelot>(hitResult->entity); shared_ptr<Ocelot> ocelot = dynamic_pointer_cast<Ocelot>(hitResult->entity);
if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT; if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
if (ocelot->isLeashed() && ocelot->getLeashHolder() == player) if (ocelot->isLeashed() && ocelot->getLeashHolder() == player)
{ {
*piUse = IDS_TOOLTIPS_UNLEASH; *piUse = IDS_TOOLTIPS_UNLEASH;
@ -3194,7 +3194,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
} }
else else
{ {
*piUse=IDS_TOOLTIPS_FEED; *piUse=IDS_TOOLTIPS_FEED;
} }
} }
@ -3217,7 +3217,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
} }
} }
break; break;
case eTYPE_PLAYER: case eTYPE_PLAYER:
{ {
// Fix for #58576 - TU6: Content: Gameplay: Hit button prompt is available when attacking a host who has "Invisible" option turned on // Fix for #58576 - TU6: Content: Gameplay: Hit button prompt is available when attacking a host who has "Invisible" option turned on
@ -3283,9 +3283,9 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
case eTYPE_HORSE: case eTYPE_HORSE:
{ {
shared_ptr<EntityHorse> horse = dynamic_pointer_cast<EntityHorse>(hitResult->entity); shared_ptr<EntityHorse> horse = dynamic_pointer_cast<EntityHorse>(hitResult->entity);
bool heldItemIsFood = false, heldItemIsLove = false, heldItemIsArmour = false; bool heldItemIsFood = false, heldItemIsLove = false, heldItemIsArmour = false;
switch( heldItemId ) switch( heldItemId )
{ {
case Item::wheat_Id: case Item::wheat_Id:
@ -3340,7 +3340,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
*piUse = IDS_TOOLTIPS_FEED; *piUse = IDS_TOOLTIPS_FEED;
} }
} }
else if ( player->isSneaking() else if ( player->isSneaking()
|| (heldItemId == Item::saddle_Id) || (heldItemId == Item::saddle_Id)
|| (horse->canWearArmor() && heldItemIsArmour) || (horse->canWearArmor() && heldItemIsArmour)
) )
@ -3349,7 +3349,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
if (*piUse == -1) *piUse = IDS_TOOLTIPS_OPEN; if (*piUse == -1) *piUse = IDS_TOOLTIPS_OPEN;
} }
else if ( horse->canWearBags() else if ( horse->canWearBags()
&& !horse->isChestedHorse() && !horse->isChestedHorse()
&& (heldItemId == Tile::chest_Id) ) && (heldItemId == Tile::chest_Id) )
{ {
// 4j - Attach saddle-bags (chest) to donkey or mule. // 4j - Attach saddle-bags (chest) to donkey or mule.
@ -3371,7 +3371,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
// 4j - Ride tamed horse. // 4j - Ride tamed horse.
*piUse = IDS_TOOLTIPS_MOUNT; *piUse = IDS_TOOLTIPS_MOUNT;
} }
if (player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT; if (player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
} }
break; break;
@ -3411,7 +3411,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
} }
} }
*piAction=IDS_TOOLTIPS_HIT; *piAction=IDS_TOOLTIPS_HIT;
break; break;
} }
break; break;
} }
@ -3644,7 +3644,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
player->abilities.debugflying = !player->abilities.debugflying; player->abilities.debugflying = !player->abilities.debugflying;
player->abilities.flying = !player->abilities.flying; player->abilities.flying = !player->abilities.flying;
} }
#endif // PSVITA #endif // PSVITA
} }
#endif #endif
@ -3721,7 +3721,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
} }
__uint64 ullButtonsPressed=player->ullButtonsPressed; __uint64 ullButtonsPressed=player->ullButtonsPressed;
bool selected = false; bool selected = false;
#ifdef __PSVITA__ #ifdef __PSVITA__
// 4J-PB - use the touchscreen for quickselect // 4J-PB - use the touchscreen for quickselect
@ -3746,7 +3746,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
shared_ptr<ItemInstance> selectedItem = player->getSelectedItem(); shared_ptr<ItemInstance> selectedItem = player->getSelectedItem();
// Dropping items happens over network, so if we only have one then assume that we dropped it and should hide the item // Dropping items happens over network, so if we only have one then assume that we dropped it and should hide the item
int iCount=0; int iCount=0;
if(selectedItem != NULL) iCount=selectedItem->GetCount(); if(selectedItem != NULL) iCount=selectedItem->GetCount();
if(selectedItem != NULL && !( (player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_DROP)) && selectedItem->GetCount() == 1)) if(selectedItem != NULL && !( (player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_DROP)) && selectedItem->GetCount() == 1))
{ {
@ -4055,7 +4055,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
} }
#ifdef __PS3__ #ifdef __PS3__
// while(!g_tickLevelQueue.empty()) // while(!g_tickLevelQueue.empty())
// { // {
// Level* pLevel = g_tickLevelQueue.front(); // Level* pLevel = g_tickLevelQueue.front();
// g_tickLevelQueue.pop(); // g_tickLevelQueue.pop();
@ -4283,7 +4283,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt
player->resetPos(); player->resetPos();
gameMode->initPlayer(player); gameMode->initPlayer(player);
player->SetXboxPad(iPrimaryPlayer); player->SetXboxPad(iPrimaryPlayer);
for(int i=0;i<XUSER_MAX_COUNT;i++) for(int i=0;i<XUSER_MAX_COUNT;i++)
@ -4669,7 +4669,7 @@ void Minecraft::main()
} }
app.DebugPrintf("\n\n\n\n\n"); app.DebugPrintf("\n\n\n\n\n");
for(unsigned int i = 0; i < 256; ++i) for(unsigned int i = 0; i < 256; ++i)
{ {
if(Tile::tiles[i] != NULL) if(Tile::tiles[i] != NULL)
@ -5126,12 +5126,11 @@ int Minecraft::MustSignInReturnedPSN(void *pParam, int iPad, C4JStorage::EMessag
{ {
Minecraft* pMinecraft = (Minecraft *)pParam; Minecraft* pMinecraft = (Minecraft *)pParam;
if(result == C4JStorage::EMessage_ResultAccept) if(result == C4JStorage::EMessage_ResultAccept)
{ {
SQRNetworkManager_Orbis::AttemptPSNSignIn(&Minecraft::InGame_SignInReturned, pMinecraft, false, iPad); SQRNetworkManager_Orbis::AttemptPSNSignIn(&Minecraft::InGame_SignInReturned, pMinecraft, false, iPad);
} }
return 0; return 0;
} }
#endif #endif

View file

@ -96,7 +96,7 @@ void KeyboardMouseInput::OnRawMouseInput(LPARAM lParam)
if (raw->data.mouse.usFlags == MOUSE_MOVE_RELATIVE) if (raw->data.mouse.usFlags == MOUSE_MOVE_RELATIVE)
{ {
m_mouseDeltaXAccum += (float)raw->data.mouse.lLastX; m_mouseDeltaXAccum += (float)raw->data.mouse.lLastX;
m_mouseDeltaYAccum += (float)raw->data.mouse.lLastY; m_mouseDeltaYAccum += (float)raw->data.mouse.lLastY
} }
} }
} }

View file

@ -15,6 +15,37 @@
class KeyboardMouseInput class KeyboardMouseInput
{ {
public: public:
//game controls
const static int KEY_WALK_UP = 'W';
const static int KEY_WALK_DOWN = 'S';
const static int KEY_WALK_LEFT = 'A';
const static int KEY_WALK_RIGHT = 'D';
const static int KEY_SNEAK = VK_SHIFT;
const static int KEY_INVEN = 'E';
const static int KEY_DROP = 'Q';
const static int KEY_CRAFT = 'C';
const static int KEY_JUMP = VK_SPACE;
const static int KEY_SPRINT = VK_CONTROL;
const static int KEY_PAUSE = VK_ESCAPE;
//menu controls
const static int KEY_UP = VK_UP;
const static int KEY_DOWN = VK_DOWN;
const static int KEY_LEFT = VK_LEFT;
const static int KEY_RIGHT = VK_RIGHT;
const static int KEY_A = VK_RETURN;
const static int KEY_B = VK_ESCAPE;
const static int KEY_LEFT_SCROLL = 'Q';
const static int KEY_RIGHT_SCROLL = 'E';
//debug type shit
const static int KEY_TOGGLE_VIEW = VK_F5;
const static int KEY_DEBUG_OVERLAY = VK_F4;
const static int KEY_DEBUG_CONSOLE_OVERLAY = VK_F3;
const static int KEY_FULLSCREEN = VK_F11;
const static int KEY_TOGGLE_CAPTURE = VK_MENU;
const static int KEY_GAME_INFO_MENU = VK_TAB;
KeyboardMouseInput(); KeyboardMouseInput();
~KeyboardMouseInput(); ~KeyboardMouseInput();

View file

@ -1256,7 +1256,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
static bool altToggleSuppressCapture = false; static bool altToggleSuppressCapture = false;
bool shouldCapture = app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == NULL; bool shouldCapture = app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == NULL;
// Left Alt key toggles capture on/off for debugging // Left Alt key toggles capture on/off for debugging
if (KMInput.IsKeyPressed(VK_MENU)) if (KMInput.IsKeyPressed(KMInput::KEY_TOGGLE_CAPTURE))
{ {
if (KMInput.IsCaptured()) { KMInput.SetCapture(false); altToggleSuppressCapture = true; } if (KMInput.IsCaptured()) { KMInput.SetCapture(false); altToggleSuppressCapture = true; }
else if (shouldCapture) { KMInput.SetCapture(true); altToggleSuppressCapture = false; } else if (shouldCapture) { KMInput.SetCapture(true); altToggleSuppressCapture = false; }
@ -1273,7 +1273,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
} }
// F3 toggles the debug console overlay, F11 toggles fullscreen // F3 toggles the debug console overlay, F11 toggles fullscreen
if (KMInput.IsKeyPressed(VK_F3)) if (KMInput.IsKeyPressed(KMInput::KEY_DEBUG_CONSOLE_OVERLAY))
{ {
static bool s_debugConsole = false; static bool s_debugConsole = false;
s_debugConsole = !s_debugConsole; s_debugConsole = !s_debugConsole;
@ -1281,19 +1281,19 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
} }
#ifdef _DEBUG_MENUS_ENABLED #ifdef _DEBUG_MENUS_ENABLED
if (KMInput.IsKeyPressed(VK_F4)) if (KMInput.IsKeyPressed(KeyboardMouseInput::KEY_DEBUG_OVERLAY))
{ {
ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_DebugOverlay, NULL, eUILayer_Debug); ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_DebugOverlay, NULL, eUILayer_Debug);
} }
#endif #endif
if (KMInput.IsKeyPressed(VK_F11)) if (KMInput.IsKeyPressed(KMInput::KEY_FULLSCREEN))
{ {
ToggleFullscreen(); ToggleFullscreen();
} }
// TAB opens game info menu. - Vvis :3 - Updated by detectiveren // TAB opens game info menu. - Vvis :3 - Updated by detectiveren
if (KMInput.IsKeyPressed(VK_TAB) && !ui.GetMenuDisplayed(0)) if (KMInput.IsKeyPressed(KMInput::KEY_GAME_INFO_MENU) && !ui.GetMenuDisplayed(0))
{ {
if (Minecraft* pMinecraft = Minecraft::GetInstance()) if (Minecraft* pMinecraft = Minecraft::GetInstance())
{ {
@ -1306,7 +1306,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
#ifdef _DEBUG_MENUS_ENABLED #ifdef _DEBUG_MENUS_ENABLED
// F3 toggles onscreen debug info // F3 toggles onscreen debug info
if (KMInput.IsKeyPressed(VK_F3)) if (KMInput.IsKeyPressed(KMInput::KEY_DEBUG_CONSOLE_OVERLAY))
{ {
if (Minecraft* pMinecraft = Minecraft::GetInstance()) if (Minecraft* pMinecraft = Minecraft::GetInstance())
{ {
@ -1318,7 +1318,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
} }
// F4 opens debug overlay // F4 opens debug overlay
if (KMInput.IsKeyPressed(VK_F4)) if (KMInput.IsKeyPressed(KeyboardMouseInput::KEY_DEBUG_OVERLAY))
{ {
if (Minecraft* pMinecraft = Minecraft::GetInstance()) if (Minecraft* pMinecraft = Minecraft::GetInstance())
{ {
@ -1617,4 +1617,4 @@ void MemPixStuff()
PIXAddNamedCounter(((float)allSectsTotal)/(4096.0f),"MemSect total pages"); PIXAddNamedCounter(((float)allSectsTotal)/(4096.0f),"MemSect total pages");
} }
#endif #endif

View file

@ -143,18 +143,18 @@ void glTexGeni(int,int,int)
#include <xcam.h> #include <xcam.h>
DWORD XCamInitialize(){ return 0; } DWORD XCamInitialize(){ return 0; }
VOID XCamShutdown() {} VOID XCamShutdown() {}
DWORD XCamCreateStreamEngine( DWORD XCamCreateStreamEngine(
CONST XCAM_STREAM_ENGINE_INIT_PARAMS *pParams, CONST XCAM_STREAM_ENGINE_INIT_PARAMS *pParams,
PIXCAMSTREAMENGINE *ppEngine PIXCAMSTREAMENGINE *ppEngine
) { return 0; } ) { return 0; }
DWORD XCamSetView( DWORD XCamSetView(
XCAMZOOMFACTOR ZoomFactor, XCAMZOOMFACTOR ZoomFactor,
LONG XCenter, LONG XCenter,
LONG YCenter, LONG YCenter,
PXOVERLAPPED pOverlapped PXOVERLAPPED pOverlapped
) { return 0; } ) { return 0; }
XCAMDEVICESTATE XCamGetStatus() { return XCAMDEVICESTATE_DISCONNECTED; } XCAMDEVICESTATE XCamGetStatus() { return XCAMDEVICESTATE_DISCONNECTED; }
#endif #endif

3
build.bat Normal file
View file

@ -0,0 +1,3 @@
cmake --build build --config Debug --target MinecraftClient
cd .\build\Debug
.\MinecraftClient.exe