From eae3eaa0cdf1d5c33285377bfe4ca15df89432ef Mon Sep 17 00:00:00 2001 From: arsenicviscera Date: Mon, 9 Mar 2026 20:22:53 -0700 Subject: [PATCH] Fixed improper music selection Switched the "eStream" and "m_szStreamFileA" enumerators so the overworld music does not encapsulate the creative and menu world enums. *Added 2 new int ranges within the SoundEngine object for creative and menu music. Changed "SoundEngine::getMusicID" to account the state of the game and play music accordingly. *Note that mash-ups in this version do not discriminate overworld, creative, and menu music so those all have the same ranges as placeholder. :D --- Minecraft.Client/Common/Audio/SoundEngine.cpp | 32 +++++++++++++++---- Minecraft.Client/Common/Audio/SoundEngine.h | 11 ++++--- Minecraft.Client/Common/BuildVer.h | 4 +-- Minecraft.Client/Common/Consoles_App.cpp | 2 +- Minecraft.Client/Common/UI/UIController.cpp | 2 +- Minecraft.Client/DLCTexturePack.cpp | 4 ++- 6 files changed, 40 insertions(+), 15 deletions(-) diff --git a/Minecraft.Client/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Common/Audio/SoundEngine.cpp index 24cb7bf45..25ee64524 100644 --- a/Minecraft.Client/Common/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Common/Audio/SoundEngine.cpp @@ -114,6 +114,9 @@ const char *SoundEngine::m_szStreamFileA[eStream_Max]= "hal4", "nuance1", "nuance2", + "piano1", + "piano2", + "piano3", #ifndef _XBOX "creative1", @@ -128,9 +131,7 @@ const char *SoundEngine::m_szStreamFileA[eStream_Max]= "menu4", #endif - "piano1", - "piano2", - "piano3", + // Nether "nether1", @@ -191,7 +192,7 @@ void SoundEngine::init(Options* pOptions) return; } -void SoundEngine::SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int iNetherMin, int iNetherMax, int iEndMin, int iEndMax, int iCD1) +void SoundEngine::SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int iNetherMin, int iNetherMax, int iEndMin, int iEndMax, int iCD1, int iCreativeMin, int iCreativeMax, int iMenuMin, int iMenuMax) { m_iStream_Overworld_Min=iOverworldMin; m_iStream_Overworld_Max=iOverWorldMax; @@ -200,6 +201,10 @@ void SoundEngine::SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int i m_iStream_End_Min=iEndMin; m_iStream_End_Max=iEndMax; m_iStream_CD_1=iCD1; + m_iStream_Creative_Min=iCreativeMin; + m_iStream_Creative_Max=iCreativeMax; + m_iStream_Menu_Min=iMenuMin; + m_iStream_Menu_Max=iMenuMax; // array to monitor recently played tracks if(m_bHeardTrackA) @@ -407,7 +412,7 @@ SoundEngine::SoundEngine() SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3, eStream_Nether1,eStream_Nether4, eStream_end_dragon,eStream_end_end, - eStream_CD_1); + eStream_CD_1, eStream_Overworld_Creative1, eStream_Overworld_Creative6, eStream_Overworld_Menu1, eStream_Overworld_Menu4); m_musicID=getMusicID(LevelData::DIMENSION_OVERWORLD); @@ -797,9 +802,19 @@ int SoundEngine::getMusicID(int iDomain) if(pMinecraft==nullptr) { // any track from the overworld - return GetRandomishTrack(m_iStream_Overworld_Min,m_iStream_Overworld_Max); + return GetRandomishTrack(m_iStream_Menu_Min,m_iStream_Menu_Max); } + int localPlayerIdx = pMinecraft->localPlayerIdx; + std::shared_ptr localPlayer = pMinecraft->localplayers[localPlayerIdx]; + + if (localPlayer == nullptr) + { + // any track from the overworld + return GetRandomishTrack(m_iStream_Menu_Min,m_iStream_Menu_Max); + } + + GameType* gt = Player::getPlayerGamePrivilege(localPlayer->getAllPlayerGamePrivileges(), Player::ePlayerGamePrivilege_CreativeMode) ? GameType::CREATIVE : GameType::SURVIVAL; if(pMinecraft->skins->isUsingDefaultSkin()) { switch(iDomain) @@ -812,6 +827,11 @@ int SoundEngine::getMusicID(int iDomain) //return m_iStream_Nether_Min + random->nextInt(m_iStream_Nether_Max-m_iStream_Nether_Min); default: //overworld //return m_iStream_Overworld_Min + random->nextInt(m_iStream_Overworld_Max-m_iStream_Overworld_Min); + + if (gt == GameType::CREATIVE) + { + return GetRandomishTrack(m_iStream_Creative_Min,m_iStream_Creative_Max); + } return GetRandomishTrack(m_iStream_Overworld_Min,m_iStream_Overworld_Max); } } diff --git a/Minecraft.Client/Common/Audio/SoundEngine.h b/Minecraft.Client/Common/Audio/SoundEngine.h index 2134c491c..744c0f2d2 100644 --- a/Minecraft.Client/Common/Audio/SoundEngine.h +++ b/Minecraft.Client/Common/Audio/SoundEngine.h @@ -17,6 +17,9 @@ enum eMUSICFILES eStream_Overworld_hal4, eStream_Overworld_nuance1, eStream_Overworld_nuance2, + eStream_Overworld_piano1, + eStream_Overworld_piano2, + eStream_Overworld_piano3, // <-- make piano3 the last overworld one #ifndef _XBOX // Add the new music tracks eStream_Overworld_Creative1, @@ -30,9 +33,7 @@ enum eMUSICFILES eStream_Overworld_Menu3, eStream_Overworld_Menu4, #endif - eStream_Overworld_piano1, - eStream_Overworld_piano2, - eStream_Overworld_piano3, // <-- make piano3 the last overworld one + // Nether eStream_Nether1, eStream_Nether2, @@ -128,7 +129,7 @@ public: bool isStreamingWavebankReady(); // 4J Added int getMusicID(int iDomain); int getMusicID(const wstring& name); - void SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int iNetherMin, int iNetherMax, int iEndMin, int iEndMax, int iCD1); + void SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int iNetherMin, int iNetherMax, int iEndMin, int iEndMax, int iCD1, int iCreativeMin, int iCreativeMax, int iMenuMin, int iMenuMax); void updateMiniAudio(); void playMusicUpdate(); @@ -179,6 +180,8 @@ private: int m_iStream_Nether_Min,m_iStream_Nether_Max; int m_iStream_End_Min,m_iStream_End_Max; int m_iStream_CD_1; + int m_iStream_Creative_Min,m_iStream_Creative_Max; + int m_iStream_Menu_Min,m_iStream_Menu_Max; bool *m_bHeardTrackA; #ifdef __ORBIS__ diff --git a/Minecraft.Client/Common/BuildVer.h b/Minecraft.Client/Common/BuildVer.h index eaa77d26a..a5a9494ac 100644 --- a/Minecraft.Client/Common/BuildVer.h +++ b/Minecraft.Client/Common/BuildVer.h @@ -1,7 +1,7 @@ #pragma once #define VER_PRODUCTBUILD 560 -#define VER_PRODUCTVERSION_STR_W L"DEV (unknown version)" +#define VER_PRODUCTVERSION_STR_W L"" #define VER_FILEVERSION_STR_W VER_PRODUCTVERSION_STR_W -#define VER_BRANCHVERSION_STR_W L"UNKNOWN BRANCH" +#define VER_BRANCHVERSION_STR_W L"UNKNOWN/" #define VER_NETWORK VER_PRODUCTBUILD diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index c3a623d5f..ea1013d29 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -3757,7 +3757,7 @@ void CMinecraftApp::HandleXuiActions(void) pMinecraft->soundEngine->SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3, eStream_Nether1,eStream_Nether4, eStream_end_dragon,eStream_end_end, - eStream_CD_1); + eStream_CD_1, eStream_Overworld_Creative1, eStream_Overworld_Creative6, eStream_Overworld_Menu1, eStream_Overworld_Menu4); #endif pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1); diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index b12ea5e73..5e97b9b24 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -2067,7 +2067,7 @@ void UIController::NavigateToHomeMenu() pMinecraft->soundEngine->SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3, eStream_Nether1,eStream_Nether4, eStream_end_dragon,eStream_end_end, - eStream_CD_1); + eStream_CD_1, eStream_Overworld_Creative1, eStream_Overworld_Creative6, eStream_Overworld_Menu1, eStream_Overworld_Menu4); pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1); // if(pDLCTexPack->m_pStreamedWaveBank!=nullptr) diff --git a/Minecraft.Client/DLCTexturePack.cpp b/Minecraft.Client/DLCTexturePack.cpp index f1304a9ef..47b5128c4 100644 --- a/Minecraft.Client/DLCTexturePack.cpp +++ b/Minecraft.Client/DLCTexturePack.cpp @@ -483,8 +483,10 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen iEndStart=iOverworldC+iNetherC; iEndC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_End); + + //DLC packs don't differentiate survival, creative, and menu music so for now they are all the same range. Minecraft::GetInstance()->soundEngine->SetStreamingSounds(iOverworldStart,iOverworldStart+iOverworldC-1, - iNetherStart,iNetherStart+iNetherC-1,iEndStart,iEndStart+iEndC-1,iEndStart+iEndC); // push the CD start to after + iNetherStart,iNetherStart+iNetherC-1,iEndStart,iEndStart+iEndC-1,iEndStart+iEndC, iOverworldStart,iOverworldStart+iOverworldC-1,iOverworldStart,iOverworldStart+iOverworldC-1); // push the CD start to after } #endif }