diff --git a/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp b/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp index f42b3ee02..27aa2f1f5 100644 --- a/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp +++ b/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp @@ -45,8 +45,8 @@ bool ChoiceTask::isCompleted() sendTelemetry(); enableConstraints(false, true); return true; - } - + } + if(ui.GetMenuDisplayed(tutorial->getPad())) { // If a menu is displayed, then we use the handleUIInput to complete the task diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index 8b38bbb3b..54a19cb1f 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -163,7 +163,7 @@ UIController::UIController() { m_uiDebugConsole = NULL; m_reloadSkinThread = NULL; - + m_navigateToHomeOnReload = false; m_bCleanupOnReload = false; @@ -279,7 +279,7 @@ void UIController::postInit() IggySetTextureSubstitutionCallbacks ( &UIController::TextureSubstitutionCreateCallback , &UIController::TextureSubstitutionDestroyCallback, this ); SetupFont(); - // + // loadSkins(); for(unsigned int i = 0; i < eUIGroup_COUNT; ++i) @@ -360,7 +360,7 @@ void UIController::SetupFont() app.m_dlcManager.LanguageChanged(); app.loadStringTable(); // Switch to use new string table, - + if (m_eTargetFont == m_eCurrentFont) { // 4J-JEV: If we're ingame, reload the font to update all the text. @@ -435,12 +435,12 @@ bool UIController::UsingBitmapFont() void UIController::tick() { SetupFont(); // If necessary, change font. - + if ( (m_navigateToHomeOnReload || m_bCleanupOnReload) && !ui.IsReloadingSkin() ) { ui.CleanUpSkinReload(); - - if (m_navigateToHomeOnReload || !g_NetworkManager.IsInSession()) + + if (m_navigateToHomeOnReload || !g_NetworkManager.IsInSession()) { ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MainMenu); } @@ -707,7 +707,7 @@ void UIController::CleanUpSkinReload() { if(!Minecraft::GetInstance()->skins->getSelected()->hasAudio()) { -#ifdef _DURANGO +#ifdef _DURANGO DWORD result = StorageManager.UnmountInstalledDLC(L"TPACK"); #else DWORD result = StorageManager.UnmountInstalledDLC("TPACK"); @@ -774,7 +774,7 @@ void UIController::handleInput() { #ifdef _DURANGO // 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; #endif 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 m_ActiveUIElement = NULL; - m_HighlightedUIElement = NULL; + m_HighlightedUIElement = NULL; // fullscreen first 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) { // fullscreen first @@ -1001,17 +1001,17 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) bool kbDown = false, kbPressed = false, kbReleased = false; 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_DOWN: kbDown = KMInput.IsKeyDown(VK_DOWN); kbPressed = KMInput.IsKeyPressed(VK_DOWN); kbReleased = KMInput.IsKeyReleased(VK_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_RIGHT: kbDown = KMInput.IsKeyDown(VK_RIGHT); kbPressed = KMInput.IsKeyPressed(VK_RIGHT); kbReleased = KMInput.IsKeyReleased(VK_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_A: kbDown = KMInput.IsKeyDown(VK_RETURN); kbPressed = KMInput.IsKeyPressed(VK_RETURN); kbReleased = KMInput.IsKeyReleased(VK_RETURN); break; - case ACTION_MENU_CANCEL: kbDown = KMInput.IsKeyDown(VK_ESCAPE); kbPressed = KMInput.IsKeyPressed(VK_ESCAPE); kbReleased = KMInput.IsKeyReleased(VK_ESCAPE); break; - case ACTION_MENU_B: kbDown = KMInput.IsKeyDown(VK_ESCAPE); kbPressed = KMInput.IsKeyPressed(VK_ESCAPE); kbReleased = KMInput.IsKeyReleased(VK_ESCAPE); break; - case ACTION_MENU_PAUSEMENU: kbDown = KMInput.IsKeyDown(VK_ESCAPE); kbPressed = KMInput.IsKeyPressed(VK_ESCAPE); kbReleased = KMInput.IsKeyReleased(VK_ESCAPE); break; - case ACTION_MENU_LEFT_SCROLL: kbDown = KMInput.IsKeyDown('Q'); kbPressed = KMInput.IsKeyPressed('Q'); kbReleased = KMInput.IsKeyReleased('Q'); break; - case ACTION_MENU_RIGHT_SCROLL: kbDown = KMInput.IsKeyDown('E'); kbPressed = KMInput.IsKeyPressed('E'); kbReleased = KMInput.IsKeyReleased('E'); 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(KMInput::KEY_DOWN); kbPressed = KMInput.IsKeyPressed(KMInput::KEY_DOWN); kbReleased = KMInput.IsKeyReleased(KMInput::KEY_DOWN); 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(KMInput::KEY); kbPressed = KMInput.IsKeyPressed(KMInput::KEY_RIGHT); kbReleased = KMInput.IsKeyReleased(KMInput::KEY_RIGHT); 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(KMInput::KEY_A); kbPressed = KMInput.IsKeyPressed(KMInput::KEY_A); kbReleased = KMInput.IsKeyReleased(KMInput::KEY_A); 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(KMInput::KEY_B); kbPressed = KMInput.IsKeyPressed(KMInput::KEY_B); kbReleased = KMInput.IsKeyReleased(KMInput::KEY_B); 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(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(KMInput::KEY_RIGHT_SCROLL); kbPressed = KMInput.IsKeyPressed(KMInput::KEY_RIGHT_SCROLL); kbReleased = KMInput.IsKeyReleased(KMInput::KEY_RIGHT_SCROLL); break; } pressed = pressed || kbPressed; 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, "\n\nEND TOTAL SWF MEMORY USAGE\n"); app.DebugPrintf(app.USER_SR, "********************************\n\n"); - } - else + } + else #endif #endif #endif @@ -1318,7 +1318,7 @@ void UIController::setupCustomDrawGameState() glLoadIdentity(); glOrtho(0, m_fScreenWidth, m_fScreenHeight, 0, 1000, 3000); glMatrixMode(GL_MODELVIEW); - glEnable(GL_ALPHA_TEST); + glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.1f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); @@ -1418,10 +1418,10 @@ void RADLINK UIController::CustomDrawCallback(void *user_callback_data, Iggy *pl //Description //Callback to create a user-defined texture to replace SWF-defined textures. //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. -//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). -//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. +//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. +//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. // //Discussion // @@ -1637,7 +1637,7 @@ bool UIController::NavigateBack(int iPad, bool forceUsePad, EUIScene eScene, EUI void UIController::NavigateToHomeMenu() { ui.CloseAllPlayersScenes(); - + // Alert the app the we no longer want to be informed of ethernet connections app.SetLiveLinkRequired( false ); @@ -1800,7 +1800,7 @@ void UIController::CloseUIScenes(int iPad, bool forceIPad) m_groups[(int)group]->closeAllScenes(); m_groups[(int)group]->getTooltips()->SetTooltips(-1); - + // This should cause the popup to dissappear TutorialPopupInfo 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 // 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); #endif } @@ -2124,7 +2124,7 @@ void UIController::PlayUISFX(ESoundEffect eSound) // Don't play multiple SFX on the same tick // (prevents horrible sounds when programmatically setting multiple checkboxes) if (time - m_lastUiSfx < 10) { return; } - m_lastUiSfx = time; + m_lastUiSfx = time; 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) { - WCHAR wcTime[20]; + WCHAR wcTime[20]; DWORD dwTimeTicks=(DWORD)app.getTrialTimer(); @@ -2433,7 +2433,7 @@ void UIController::ShowAutosaveCountdownTimer(bool show) void UIController::UpdateAutosaveCountdownTimer(unsigned int uiSeconds) { #if !(defined(_XBOX_ONE) || defined(__ORBIS__)) - WCHAR wcAutosaveCountdown[100]; + WCHAR wcAutosaveCountdown[100]; swprintf( wcAutosaveCountdown, 100, app.GetString(IDS_AUTOSAVE_COUNTDOWN),uiSeconds); if(m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()) m_groups[(int)eUIGroup_Fullscreen]->getPressStartToPlay()->setTrialTimer(wcAutosaveCountdown); #endif @@ -2603,7 +2603,7 @@ C4JStorage::EMessageResult UIController::RequestUGCMessageBox(UINT title/* = -1 #ifdef __ORBIS__ // Show the vague UGC system message in addition to our message ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_UGC_RESTRICTION, iPad ); - return C4JStorage::EMessage_ResultAccept; + return C4JStorage::EMessage_ResultAccept; #elif defined(__PSVITA__) ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, iPad ); UINT uiIDA[1]; @@ -2640,7 +2640,7 @@ C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox(UINT #ifdef __ORBIS__ // Show the vague UGC system message in addition to our message ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_UGC_RESTRICTION, iPad ); - return C4JStorage::EMessage_ResultAccept; + return C4JStorage::EMessage_ResultAccept; #elif defined(__PSVITA__) ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_AGE_RESTRICTION, iPad ); 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 *pScene = NULL; @@ -2822,7 +2822,7 @@ void UIController::TouchBoxesClear(UIScene *pUIScene) for (AUTO_VAR(it, m_TouchBoxes[eUIGroup][eUILayer][eUIscene].begin()); it != itEnd; it++) { UIELEMENT *element=(UIELEMENT *)*it; - delete element; + delete element; } m_TouchBoxes[eUIGroup][eUILayer][eUIscene].clear(); } @@ -2858,7 +2858,7 @@ bool UIController::TouchBoxHit(UIScene *pUIScene,S32 x, S32 y) return true; } } - } + } } //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 \ No newline at end of file +#endif diff --git a/Minecraft.Client/Input.cpp b/Minecraft.Client/Input.cpp index 6933a2d70..48f3728e6 100644 --- a/Minecraft.Client/Input.cpp +++ b/Minecraft.Client/Input.cpp @@ -50,10 +50,10 @@ void Input::tick(LocalPlayer *player) if (iPad == 0 && KMInput.IsCaptured()) { float kbX = 0.0f, kbY = 0.0f; - if (KMInput.IsKeyDown('W')) { kbY += 1.0f; sprintForward += 1.0f; usingKeyboardMovement = true; } - if (KMInput.IsKeyDown('S')) { kbY -= 1.0f; sprintForward -= 1.0f; usingKeyboardMovement = true; } - if (KMInput.IsKeyDown('A')) { kbX += 1.0f; usingKeyboardMovement = true; } // inverted like gamepad - if (KMInput.IsKeyDown('D')) { kbX -= 1.0f; usingKeyboardMovement = true; } + if (KMInput.IsKeyDown(KeyboardMouseInput::KEY_WALK_UP)) { 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(KeyboardMouseInput::KEY_WALK_LEFT)) { kbX += 1.0f; usingKeyboardMovement = true; } // inverted like gamepad + if (KMInput.IsKeyDown(KeyboardMouseInput::KEY_WALK_RIGHT)) { kbX -= 1.0f; usingKeyboardMovement = true; } // 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)) diff --git a/Minecraft.Client/LocalPlayer.cpp b/Minecraft.Client/LocalPlayer.cpp index bb25105f7..405b30ec9 100644 --- a/Minecraft.Client/LocalPlayer.cpp +++ b/Minecraft.Client/LocalPlayer.cpp @@ -142,7 +142,7 @@ void LocalPlayer::calculateFlight(float xa, float ya, float za) void LocalPlayer::serverAiStep() { Player::serverAiStep(); - + if( abilities.flying && abilities.mayfly ) { // snap y rotation for flying to nearest 90 degrees in world space @@ -160,7 +160,7 @@ void LocalPlayer::serverAiStep() float yRotDiff = yRotSnapped - yRotFinal; // Apply the same difference to the player rotated space angle float yRotInputAdjust = yRotInput + yRotDiff; - + // Calculate final x/y player-space movement required this->xxa = cos(yRotInputAdjust * ( PI / 180.0f) ) * fMag; this->yya = sin(yRotInputAdjust * ( PI / 180.0f) ) * fMag; @@ -294,7 +294,7 @@ void LocalPlayer::aiStep() #ifdef _WINDOWS64 // 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) { if (!isSprinting()) setSprinting(true); @@ -332,7 +332,7 @@ void LocalPlayer::aiStep() if (isSprinting() && (!forwardEnoughToContinueSprint || !enoughFoodToSprint || isSneaking() || isUsingItem())) { setSprinting(false); - } + } // 4J Stu - Fix for #52705 - Customer Encountered: Player can fly in bed while being in Creative mode. if (!isSleeping() && (abilities.mayfly || isAllowedToFly() )) @@ -373,7 +373,7 @@ void LocalPlayer::aiStep() abilities.flying = false; } } - + if (abilities.flying) { @@ -435,7 +435,7 @@ void LocalPlayer::aiStep() { jumpRidingScale = (float) jumpRidingTicks * .1f; } - else + else { jumpRidingScale = .8f + (2.f / ((float) (jumpRidingTicks - 9))) * .1f; } @@ -534,7 +534,7 @@ void LocalPlayer::aiStep() else { ProfileManager.SetCurrentGameActivity(m_iPad,CONTEXT_PRESENCE_MULTIPLAYER,false); - } + } } else { @@ -831,7 +831,7 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param) { #ifdef _DURANGO // 4J-JEV: Maybe we want to fine tune this later? #TODO - if ( !ProfileManager.IsGuest(GetXboxPad()) + if ( !ProfileManager.IsGuest(GetXboxPad()) && app.CanRecordStatsAndAchievements() && ProfileManager.IsFullVersion() ) @@ -910,7 +910,7 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param) toolStats[0][2] = GenericStats::itemsCrafted(Item::shovel_iron->id); toolStats[0][3] = GenericStats::itemsCrafted(Item::shovel_diamond->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][2] = GenericStats::itemsCrafted(Item::pickAxe_iron->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][3] = GenericStats::itemsCrafted(Item::hoe_diamond->id); toolStats[3][4] = GenericStats::itemsCrafted(Item::hoe_gold->id); - + bool justCraftedTool = false; for (int i=0; i<4; i++) { @@ -963,7 +963,7 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param) awardStat(GenericStats::MOARTools(), GenericStats::param_noArgs()); } } - + } #ifdef _XBOX @@ -1047,7 +1047,7 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param) numEmeraldMined = pStats->getTotalValue(emeraldMined); numEmeraldBought = pStats->getTotalValue(emeraldBought); totalSum = numEmeraldMined + numEmeraldBought; - + app.DebugPrintf( "[AwardStat] Check unlock 'The Haggler': " "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. { bool justPickedupWool = false; - + for (int i=0; i<16; i++) if ( stat == GenericStats::itemsCollected(Tile::wool_Id, i) ) justPickedupWool = true; @@ -1111,7 +1111,7 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param) if (justPickedupWool) { unsigned int woolCount = 0; - + for (unsigned int i = 0; i < 16; i++) { if (pStats->getTotalValue(GenericStats::itemsCollected(Tile::wool_Id, i)) > 0) @@ -1300,7 +1300,7 @@ void LocalPlayer::mapPlayerChunk(const unsigned int flagTileType) cout << "O"; 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; } else if (t != 0 && t < 10) { cout << t; 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; minecraft->gameMode->continueDestroyBlock(x, y, z, minecraft->hitResult->f); - + if(mayDestroyBlockAt(x,y,z)) { 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 - float dX = (float)x - lastClickX; + float dX = (float)x - lastClickX; float dY = (float)y - lastClickY; float dZ = (float)z - lastClickZ; bool newClick = false; @@ -1520,13 +1520,13 @@ bool LocalPlayer::handleMouseClick(int button) bool returnItemPlaced = false; if (button == 0 && missTime > 0) return false; - if (button == 0) + if (button == 0) { //app.DebugPrintf("handleMouseClick - Player %d is swinging\n",GetXboxPad()); 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 @@ -1538,7 +1538,7 @@ bool LocalPlayer::handleMouseClick(int button) shared_ptr mplp = dynamic_pointer_cast( shared_from_this() ); if(mplp && mplp->connection) mplp->StopSleeping(); - + } // 4J Stu - We should not accept any input while asleep, except the above to wake up if(isSleeping() && level != NULL && level->isClientSide) @@ -1560,9 +1560,9 @@ bool LocalPlayer::handleMouseClick(int button) } 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 - // 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 if(minecraft->hitResult->entity->GetType()==eTYPE_COW) @@ -1654,7 +1654,7 @@ void LocalPlayer::updateRichPresence() else if(selectedItem != NULL && selectedItem->id == Item::map_Id) { app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_MAP); - } + } else if ( (riding != NULL) && riding->instanceof(eTYPE_MINECART) ) { app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_RIDING_MINECART); diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 87f1b8bee..55f963825 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -79,7 +79,7 @@ //#define DEBUG_RENDER_SHOWS_PACKETS 1 //#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 #define DISABLE_LEVELTICK_THREAD @@ -96,7 +96,7 @@ TOUCHSCREENRECT QuickSelectRect[3]= { { 560, 890, 1360, 980 }, { 450, 840, 1449, 960 }, - { 320, 840, 1600, 970 }, + { 320, 840, 1600, 970 }, }; int QuickSelectBoxWidth[3]= @@ -1279,7 +1279,7 @@ void Minecraft::run_middle() if( pDLCPack ) { if(!pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" )) - { + { bTrialTexturepack=true; } } @@ -1401,7 +1401,7 @@ void Minecraft::run_middle() { delete m_pPsPlusUpsell; m_pPsPlusUpsell = NULL; - + if ( ProfileManager.HasPlayStationPlus(i) ) { app.DebugPrintf(" Player_%i is now authorised for PsPlus.\n", i); @@ -1450,13 +1450,13 @@ void Minecraft::run_middle() // Keyboard/mouse button presses for player 0 if (i == 0) { - if (KMInput.ConsumeKeyPress(VK_ESCAPE)) localplayers[i]->ullButtonsPressed |= 1LL<ullButtonsPressed |= 1LL<ullButtonsPressed |= 1LL<ullButtonsPressed |= 1LL<ullButtonsPressed |= 1LL<ullButtonsPressed |= 1LL<ullButtonsPressed |= 1LL<ullButtonsPressed |= 1LL<ullButtonsPressed |= 1LL<ullButtonsPressed |= 1LL<abilities.flying && KMInput.IsKeyDown(VK_SHIFT)) + if (localplayers[i]->abilities.flying && KMInput.IsKeyDown(KMInput::KEY_SNEAK)) localplayers[i]->ullButtonsPressed |= 1LL< heldItem = nullptr; if (player->inventory->IsHeldItem()) { - heldItem = player->inventory->getSelected(); + heldItem = player->inventory->getSelected(); } int heldItemId = heldItem != NULL ? heldItem->getItem()->id : -1; - + switch(entityType) { case eTYPE_CHICKEN: @@ -2846,7 +2846,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) case eTYPE_COW: { if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT; - + shared_ptr animal = dynamic_pointer_cast(hitResult->entity); if (animal->isLeashed() && animal->getLeashHolder() == player) @@ -2910,7 +2910,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) *piUse=IDS_TOOLTIPS_MILK; break; case Item::shears_Id: - { + { if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT; if(!animal->isBaby()) *piUse=IDS_TOOLTIPS_SHEAR; } @@ -2938,10 +2938,10 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) *piAction = IDS_TOOLTIPS_MINE; *piUse = IDS_TOOLTIPS_RIDE; // are we in the minecart already? - 4J-JEV: Doesn't matter anymore. break; - + case eTYPE_MINECART_FURNACE: *piAction = IDS_TOOLTIPS_MINE; - + // if you have coal, it'll go. Is there an object in hand? if (heldItemId == Item::coal_Id) *piUse=IDS_TOOLTIPS_USE; break; @@ -3022,7 +3022,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT; shared_ptr pig = dynamic_pointer_cast(hitResult->entity); - + if (pig->isLeashed() && pig->getLeashHolder() == player) { *piUse=IDS_TOOLTIPS_UNLEASH; @@ -3165,7 +3165,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) shared_ptr ocelot = dynamic_pointer_cast(hitResult->entity); if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT; - + if (ocelot->isLeashed() && ocelot->getLeashHolder() == player) { *piUse = IDS_TOOLTIPS_UNLEASH; @@ -3194,7 +3194,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) } else { - *piUse=IDS_TOOLTIPS_FEED; + *piUse=IDS_TOOLTIPS_FEED; } } @@ -3217,7 +3217,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) } } break; - + case eTYPE_PLAYER: { // 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: { shared_ptr horse = dynamic_pointer_cast(hitResult->entity); - + bool heldItemIsFood = false, heldItemIsLove = false, heldItemIsArmour = false; - + switch( heldItemId ) { case Item::wheat_Id: @@ -3340,7 +3340,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) *piUse = IDS_TOOLTIPS_FEED; } } - else if ( player->isSneaking() + else if ( player->isSneaking() || (heldItemId == Item::saddle_Id) || (horse->canWearArmor() && heldItemIsArmour) ) @@ -3349,7 +3349,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) if (*piUse == -1) *piUse = IDS_TOOLTIPS_OPEN; } else if ( horse->canWearBags() - && !horse->isChestedHorse() + && !horse->isChestedHorse() && (heldItemId == Tile::chest_Id) ) { // 4j - Attach saddle-bags (chest) to donkey or mule. @@ -3371,7 +3371,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // 4j - Ride tamed horse. *piUse = IDS_TOOLTIPS_MOUNT; } - + if (player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT; } break; @@ -3411,7 +3411,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) } } *piAction=IDS_TOOLTIPS_HIT; - break; + break; } break; } @@ -3644,7 +3644,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) player->abilities.debugflying = !player->abilities.debugflying; player->abilities.flying = !player->abilities.flying; } -#endif // PSVITA +#endif // PSVITA } #endif @@ -3721,7 +3721,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) } __uint64 ullButtonsPressed=player->ullButtonsPressed; - + bool selected = false; #ifdef __PSVITA__ // 4J-PB - use the touchscreen for quickselect @@ -3746,7 +3746,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) shared_ptr 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 int iCount=0; - + if(selectedItem != NULL) iCount=selectedItem->GetCount(); if(selectedItem != NULL && !( (player->ullButtonsPressed&(1LL<GetCount() == 1)) { @@ -4055,7 +4055,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) } #ifdef __PS3__ -// while(!g_tickLevelQueue.empty()) +// while(!g_tickLevelQueue.empty()) // { // Level* pLevel = g_tickLevelQueue.front(); // g_tickLevelQueue.pop(); @@ -4283,7 +4283,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt player->resetPos(); gameMode->initPlayer(player); - + player->SetXboxPad(iPrimaryPlayer); for(int i=0;idata.mouse.usFlags == MOUSE_MOVE_RELATIVE) { m_mouseDeltaXAccum += (float)raw->data.mouse.lLastX; - m_mouseDeltaYAccum += (float)raw->data.mouse.lLastY; + m_mouseDeltaYAccum += (float)raw->data.mouse.lLastY } } } diff --git a/Minecraft.Client/Windows64/KeyboardMouseInput.h b/Minecraft.Client/Windows64/KeyboardMouseInput.h index a09843f90..db4c457ac 100644 --- a/Minecraft.Client/Windows64/KeyboardMouseInput.h +++ b/Minecraft.Client/Windows64/KeyboardMouseInput.h @@ -15,6 +15,37 @@ class KeyboardMouseInput { 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(); diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 48040c664..104a9617d 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -1256,7 +1256,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, static bool altToggleSuppressCapture = false; bool shouldCapture = app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == NULL; // 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; } 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 - if (KMInput.IsKeyPressed(VK_F3)) + if (KMInput.IsKeyPressed(KMInput::KEY_DEBUG_CONSOLE_OVERLAY)) { static bool s_debugConsole = false; s_debugConsole = !s_debugConsole; @@ -1281,19 +1281,19 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, } #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); } #endif - if (KMInput.IsKeyPressed(VK_F11)) + if (KMInput.IsKeyPressed(KMInput::KEY_FULLSCREEN)) { ToggleFullscreen(); } // 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()) { @@ -1306,7 +1306,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, #ifdef _DEBUG_MENUS_ENABLED // F3 toggles onscreen debug info - if (KMInput.IsKeyPressed(VK_F3)) + if (KMInput.IsKeyPressed(KMInput::KEY_DEBUG_CONSOLE_OVERLAY)) { if (Minecraft* pMinecraft = Minecraft::GetInstance()) { @@ -1318,7 +1318,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, } // F4 opens debug overlay - if (KMInput.IsKeyPressed(VK_F4)) + if (KMInput.IsKeyPressed(KeyboardMouseInput::KEY_DEBUG_OVERLAY)) { if (Minecraft* pMinecraft = Minecraft::GetInstance()) { @@ -1617,4 +1617,4 @@ void MemPixStuff() PIXAddNamedCounter(((float)allSectsTotal)/(4096.0f),"MemSect total pages"); } -#endif \ No newline at end of file +#endif diff --git a/Minecraft.Client/stubs.cpp b/Minecraft.Client/stubs.cpp index 16215ba2f..647e9d9ea 100644 --- a/Minecraft.Client/stubs.cpp +++ b/Minecraft.Client/stubs.cpp @@ -143,18 +143,18 @@ void glTexGeni(int,int,int) #include DWORD XCamInitialize(){ return 0; } VOID XCamShutdown() {} - + DWORD XCamCreateStreamEngine( CONST XCAM_STREAM_ENGINE_INIT_PARAMS *pParams, PIXCAMSTREAMENGINE *ppEngine ) { return 0; } - + DWORD XCamSetView( XCAMZOOMFACTOR ZoomFactor, LONG XCenter, LONG YCenter, PXOVERLAPPED pOverlapped ) { return 0; } - + XCAMDEVICESTATE XCamGetStatus() { return XCAMDEVICESTATE_DISCONNECTED; } -#endif \ No newline at end of file +#endif diff --git a/build.bat b/build.bat new file mode 100644 index 000000000..59dcb3072 --- /dev/null +++ b/build.bat @@ -0,0 +1,3 @@ +cmake --build build --config Debug --target MinecraftClient +cd .\build\Debug +.\MinecraftClient.exe \ No newline at end of file