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
This commit is contained in:
arsenicviscera 2026-03-09 20:22:53 -07:00
parent e6eafda90e
commit eae3eaa0cd
6 changed files with 40 additions and 15 deletions

View file

@ -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<MultiplayerLocalPlayer> 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);
}
}

View file

@ -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__

View file

@ -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

View file

@ -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);

View file

@ -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)

View file

@ -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
}