diff --git a/Minecraft.Client/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Common/Audio/SoundEngine.cpp index fb6c4887e..4d356c132 100644 --- a/Minecraft.Client/Common/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Common/Audio/SoundEngine.cpp @@ -1334,6 +1334,38 @@ void SoundEngine::playMusicUpdate() // char *SoundName = (char *)ConvertSoundPathToName(name); // strcat((char *)szStreamName,SoundName); + const bool isCD = (m_musicID >= m_iStream_CD_1); + const char* folder = isCD ? "cds/" : "music/"; + + FILE* pFile = nullptr; + if (fopen_s(&pFile, reinterpret_cast(m_szStreamName), "rb") == 0 && pFile) + { + fclose(pFile); + } + else + { + const char* extensions[] = { ".wav" }; // only wav works outside of binka files to my knowledge, i've only tested ogg, wav, mp3 and only wav worked out of the bunch + size_t count = sizeof(extensions) / sizeof(extensions[0]); + bool found = false; + + for (size_t i = 0; i < count; i++) + { + int n = sprintf_s(reinterpret_cast(m_szStreamName), 512, "%s%s%s%s", m_szMusicPath, folder, m_szStreamFileA[m_musicID], extensions[i]); + if (n < 0) continue; + + if (fopen_s(&pFile, reinterpret_cast(m_szStreamName), "rb") == 0 && pFile) + { + fclose(pFile); + found = true; + break; + } + } + + if (!found) + { + return; + } + } app.DebugPrintf("Starting streaming - %s\n",m_szStreamName); diff --git a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp index 1f612e95d..76c414b20 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp @@ -73,7 +73,7 @@ void IUIScene_AbstractContainerMenu::Initialize(int iPad, AbstractContainerMenu* m_iCurrSlotX = 0; m_iCurrSlotY = 0; #endif // TAP_DETECTION - // + // // for(int i=0;itouch[0].x)-m_oldvTouchPos.x) * m_fTouchPadMulX; float fNewY=(((float)pTouchPadData->touch[0].y)-m_oldvTouchPos.y) * m_fTouchPadMulY; - // relative positions - needs a deadzone + // relative positions - needs a deadzone if(fNewX>m_fTouchPadDeadZoneX) { @@ -329,11 +329,11 @@ void IUIScene_AbstractContainerMenu::onMouseTick() if(fNewY>m_fTouchPadDeadZoneY) { - vPointerPos.y=m_oldvPointerPos.y+((fNewY-m_fTouchPadDeadZoneY)*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f)); + vPointerPos.y=m_oldvPointerPos.y+((fNewY-m_fTouchPadDeadZoneY)*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f)); } else if(fNewY<-m_fTouchPadDeadZoneY) { - vPointerPos.y=m_oldvPointerPos.y+((fNewY+m_fTouchPadDeadZoneY)*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f)); + vPointerPos.y=m_oldvPointerPos.y+((fNewY+m_fTouchPadDeadZoneY)*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f)); } // Clamp to pointer extents. @@ -343,7 +343,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() else if ( vPointerPos.y > m_fPointerMaxY ) vPointerPos.y = m_fPointerMaxY; bStickInput = true; - m_eCurrTapState=eTapStateNoInput; + m_eCurrTapState=eTapStateNoInput; } else { @@ -510,7 +510,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() ( vPointerPos.y >= sectionPos.y ) && ( vPointerPos.y <= itemMax.y ) ) { // Pointer is over this control! - eSectionUnderPointer = eSection; + eSectionUnderPointer = eSection; vSnapPos.x = itemPos.x + ( itemSize.x / 2.0f ); vSnapPos.y = itemPos.y + ( itemSize.y / 2.0f ); @@ -602,7 +602,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() if(!IsVisible(eSectionUnderPointer)) eSectionUnderPointer = eSectionNone; // If we are not over any slot, set focus elsewhere. - if ( eSectionUnderPointer == eSectionNone ) + if ( eSectionUnderPointer == eSectionNone ) { setFocusToPointer( getPad() ); #ifdef TAP_DETECTION @@ -808,7 +808,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() if ( bSlotHasItem ) { // Item in hand and item in slot ... is item in slot the same as in out hand? If so, can we stack on to it? - if ( bCarriedIsSameAsSlot ) + if ( bCarriedIsSameAsSlot ) { // Can we stack more into this slot? if ( iSlotStackSizeRemaining == 0 ) @@ -946,7 +946,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() else { buttonY = eToolTipQuickMove; - } + } break; case ArmorRecipes::eArmorType_Leggings: if(isSlotEmpty(eSectionInventoryArmor,2)) @@ -1104,15 +1104,15 @@ void IUIScene_AbstractContainerMenu::onMouseTick() // ingredient slot empty buttonY = eToolTipQuickMoveIngredient; } - } + } else { // valid potion? Glass bottle with water in it is a 'potion' too. if(iId==Item::potion_Id) { // space available? - if(isSlotEmpty(eSectionBrewingBottle1,0) || - isSlotEmpty(eSectionBrewingBottle2,0) || + if(isSlotEmpty(eSectionBrewingBottle1,0) || + isSlotEmpty(eSectionBrewingBottle2,0) || isSlotEmpty(eSectionBrewingBottle3,0)) { buttonY = eToolTipQuickMoveIngredient; @@ -1139,8 +1139,8 @@ void IUIScene_AbstractContainerMenu::onMouseTick() { // is there already something in the ingredient slot? if(isSlotEmpty(eSectionEnchantSlot,0)) - { - // tool slot empty + { + // tool slot empty switch(iId) { case Item::bow_Id: @@ -1182,7 +1182,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() buttonY = eToolTipQuickMove; break; default: - buttonY=eToolTipQuickMoveTool; + buttonY=eToolTipQuickMoveTool; break; } } @@ -1190,10 +1190,10 @@ void IUIScene_AbstractContainerMenu::onMouseTick() { buttonY = eToolTipQuickMove; } - } + } else { - buttonY=eToolTipQuickMove; + buttonY=eToolTipQuickMove; } } else @@ -1328,7 +1328,16 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b // Standard left click buttonNum = 0; quickKeyHeld = FALSE; - ui.PlayUISFX(eSFX_Press); + + if( IsSectionSlotList( m_eCurrSection ) ) + { + int currentIndex = getCurrentIndex( m_eCurrSection ) - getSectionStartOffset(m_eCurrSection); + + bool bSlotHasItem = !isSlotEmpty(m_eCurrSection, currentIndex); + if ( bSlotHasItem ) + ui.PlayUISFX(eSFX_Press); + } + // } break; case ACTION_MENU_X: @@ -1383,7 +1392,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b } else { - ui.CloseUIScenes(iPad); + ui.CloseUIScenes(iPad); } bHandled = true; @@ -1475,7 +1484,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b { handleOutsideClicked(iPad, buttonNum, quickKeyHeld); } - else // + else // { // over empty space or something else??? handleOtherClicked(iPad,m_eCurrSection,buttonNum,quickKeyHeld?true:false); @@ -1611,4 +1620,4 @@ vector *IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slo vector *IUIScene_AbstractContainerMenu::GetSectionHoverText(ESceneSection eSection) { return NULL; -} \ No newline at end of file +} diff --git a/Minecraft.Client/LocalPlayer.cpp b/Minecraft.Client/LocalPlayer.cpp index 2af0feab7..bb25105f7 100644 --- a/Minecraft.Client/LocalPlayer.cpp +++ b/Minecraft.Client/LocalPlayer.cpp @@ -342,7 +342,7 @@ void LocalPlayer::aiStep() { if (jumpTriggerTime == 0) { - jumpTriggerTime = 10; // was 7 + jumpTriggerTime = 7; // the 4J team changed it to 10 because of additional requirements to initiate flight twoJumpsRegistered = false; } else @@ -350,7 +350,7 @@ void LocalPlayer::aiStep() twoJumpsRegistered = true; } } - else if( ( !input->jumping ) && ( jumpTriggerTime > 0 ) && twoJumpsRegistered ) + else if(jumpTriggerTime > 0 && twoJumpsRegistered) //the 4J team checked if the player was NOT jumping after the two jumps, aka had let go of the jump button { #ifndef _CONTENT_PACKAGE printf("flying was %s\n", abilities.flying ? "on" : "off");