Revert "Prevent contextually wrong music from playing (#1138)"
Some checks are pending
Nightly Server Release / build (Windows64) (push) Waiting to run
Nightly Server Release / release (push) Blocked by required conditions
Nightly Server Release / Build and Push Docker Image (push) Blocked by required conditions
Nightly Server Release / cleanup (push) Blocked by required conditions
Nightly Release / build (Windows64) (push) Waiting to run
Nightly Release / release (push) Blocked by required conditions
Nightly Release / cleanup (push) Blocked by required conditions

This reverts commit 2d41711055.
This commit is contained in:
Loki 2026-04-14 17:00:35 -05:00 committed by GitHub
parent 1533b2138f
commit 2fba264c08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 17 additions and 38 deletions

View file

@ -114,9 +114,7 @@ const char *SoundEngine::m_szStreamFileA[eStream_Max]=
"hal4", "hal4",
"nuance1", "nuance1",
"nuance2", "nuance2",
"piano1",
"piano2",
"piano3",
#ifndef _XBOX #ifndef _XBOX
"creative1", "creative1",
"creative2", "creative2",
@ -129,6 +127,11 @@ const char *SoundEngine::m_szStreamFileA[eStream_Max]=
"menu3", "menu3",
"menu4", "menu4",
#endif #endif
"piano1",
"piano2",
"piano3",
// Nether // Nether
"nether1", "nether1",
"nether2", "nether2",
@ -188,7 +191,7 @@ void SoundEngine::init(Options* pOptions)
return; return;
} }
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) void SoundEngine::SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int iNetherMin, int iNetherMax, int iEndMin, int iEndMax, int iCD1)
{ {
m_iStream_Overworld_Min=iOverworldMin; m_iStream_Overworld_Min=iOverworldMin;
m_iStream_Overworld_Max=iOverWorldMax; m_iStream_Overworld_Max=iOverWorldMax;
@ -196,10 +199,6 @@ void SoundEngine::SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int i
m_iStream_Nether_Max=iNetherMax; m_iStream_Nether_Max=iNetherMax;
m_iStream_End_Min=iEndMin; m_iStream_End_Min=iEndMin;
m_iStream_End_Max=iEndMax; m_iStream_End_Max=iEndMax;
m_iStream_Creative_Min=iCreativeMin;
m_iStream_Creative_Max=iCreativeMax;
m_iStream_Menu_Min=iMenuMin;
m_iStream_Menu_Max=iMenuMax;
m_iStream_CD_1=iCD1; m_iStream_CD_1=iCD1;
// array to monitor recently played tracks // array to monitor recently played tracks
@ -408,7 +407,7 @@ SoundEngine::SoundEngine()
SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3, SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3,
eStream_Nether1,eStream_Nether4, eStream_Nether1,eStream_Nether4,
eStream_end_dragon,eStream_end_end, eStream_end_dragon,eStream_end_end,
eStream_CD_1, eStream_Overworld_Creative1, eStream_Overworld_Creative6, eStream_Overworld_Menu1, eStream_Overworld_Menu4); eStream_CD_1);
m_musicID=getMusicID(LevelData::DIMENSION_OVERWORLD); m_musicID=getMusicID(LevelData::DIMENSION_OVERWORLD);
@ -801,16 +800,7 @@ int SoundEngine::getMusicID(int iDomain)
if(pMinecraft==nullptr) if(pMinecraft==nullptr)
{ {
// any track from the overworld // any track from the overworld
return GetRandomishTrack(m_iStream_Menu_Min,m_iStream_Menu_Max); return GetRandomishTrack(m_iStream_Overworld_Min,m_iStream_Overworld_Max);
}
int localPlayerIdx = pMinecraft->getLocalPlayerIdx();
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);
} }
if(pMinecraft->skins->isUsingDefaultSkin()) if(pMinecraft->skins->isUsingDefaultSkin())
@ -824,13 +814,7 @@ int SoundEngine::getMusicID(int iDomain)
return GetRandomishTrack(m_iStream_Nether_Min,m_iStream_Nether_Max); return GetRandomishTrack(m_iStream_Nether_Min,m_iStream_Nether_Max);
//return m_iStream_Nether_Min + random->nextInt(m_iStream_Nether_Max-m_iStream_Nether_Min); //return m_iStream_Nether_Min + random->nextInt(m_iStream_Nether_Max-m_iStream_Nether_Min);
default: //overworld default: //overworld
GameType* gt = Player::getPlayerGamePrivilege(localPlayer->getAllPlayerGamePrivileges(), Player::ePlayerGamePrivilege_CreativeMode) ? GameType::CREATIVE : GameType::SURVIVAL;
//return m_iStream_Overworld_Min + random->nextInt(m_iStream_Overworld_Max-m_iStream_Overworld_Min); //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); return GetRandomishTrack(m_iStream_Overworld_Min,m_iStream_Overworld_Max);
} }
} }
@ -845,7 +829,7 @@ int SoundEngine::getMusicID(int iDomain)
//return m_iStream_Nether_Min + random->nextInt(m_iStream_Nether_Max-m_iStream_Nether_Min); //return m_iStream_Nether_Min + random->nextInt(m_iStream_Nether_Max-m_iStream_Nether_Min);
return GetRandomishTrack(m_iStream_Nether_Min,m_iStream_Nether_Max); return GetRandomishTrack(m_iStream_Nether_Min,m_iStream_Nether_Max);
default: //overworld default: //overworld
//Mash-ups don't have special ranges. //return m_iStream_Overworld_Min + random->nextInt(m_iStream_Overworld_Max-m_iStream_Overworld_Min);
return GetRandomishTrack(m_iStream_Overworld_Min,m_iStream_Overworld_Max); return GetRandomishTrack(m_iStream_Overworld_Min,m_iStream_Overworld_Max);
} }
} }

View file

@ -23,10 +23,6 @@ enum eMUSICFILES
eStream_Overworld_hal4, eStream_Overworld_hal4,
eStream_Overworld_nuance1, eStream_Overworld_nuance1,
eStream_Overworld_nuance2, eStream_Overworld_nuance2,
//Moved these to separate
eStream_Overworld_piano1,
eStream_Overworld_piano2,
eStream_Overworld_piano3, // <-- make piano3 the last overworld one
#ifndef _XBOX #ifndef _XBOX
// Add the new music tracks // Add the new music tracks
eStream_Overworld_Creative1, eStream_Overworld_Creative1,
@ -40,7 +36,9 @@ enum eMUSICFILES
eStream_Overworld_Menu3, eStream_Overworld_Menu3,
eStream_Overworld_Menu4, eStream_Overworld_Menu4,
#endif #endif
eStream_Overworld_piano1,
eStream_Overworld_piano2,
eStream_Overworld_piano3, // <-- make piano3 the last overworld one
// Nether // Nether
eStream_Nether1, eStream_Nether1,
eStream_Nether2, eStream_Nether2,
@ -136,7 +134,7 @@ public:
bool isStreamingWavebankReady(); // 4J Added bool isStreamingWavebankReady(); // 4J Added
int getMusicID(int iDomain); int getMusicID(int iDomain);
int getMusicID(const wstring& name); int getMusicID(const wstring& name);
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 SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int iNetherMin, int iNetherMax, int iEndMin, int iEndMax, int iCD1);
void updateMiniAudio(); void updateMiniAudio();
void playMusicUpdate(); void playMusicUpdate();
@ -187,8 +185,6 @@ private:
int m_iStream_Nether_Min,m_iStream_Nether_Max; int m_iStream_Nether_Min,m_iStream_Nether_Max;
int m_iStream_End_Min,m_iStream_End_Max; int m_iStream_End_Min,m_iStream_End_Max;
int m_iStream_CD_1; 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; bool *m_bHeardTrackA;
#ifdef __ORBIS__ #ifdef __ORBIS__

View file

@ -3778,7 +3778,7 @@ void CMinecraftApp::HandleXuiActions(void)
pMinecraft->soundEngine->SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3, pMinecraft->soundEngine->SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3,
eStream_Nether1,eStream_Nether4, eStream_Nether1,eStream_Nether4,
eStream_end_dragon,eStream_end_end, eStream_end_dragon,eStream_end_end,
eStream_CD_1, eStream_Overworld_Creative1, eStream_Overworld_Creative6, eStream_Overworld_Menu1, eStream_Overworld_Menu4); eStream_CD_1);
#endif #endif
pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1); pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1);

View file

@ -2071,7 +2071,7 @@ void UIController::NavigateToHomeMenu()
pMinecraft->soundEngine->SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3, pMinecraft->soundEngine->SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3,
eStream_Nether1,eStream_Nether4, eStream_Nether1,eStream_Nether4,
eStream_end_dragon,eStream_end_end, eStream_end_dragon,eStream_end_end,
eStream_CD_1, eStream_Overworld_Creative1, eStream_Overworld_Creative6, eStream_Overworld_Menu1, eStream_Overworld_Menu4); eStream_CD_1);
pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1); pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1);
// if(pDLCTexPack->m_pStreamedWaveBank!=nullptr) // if(pDLCTexPack->m_pStreamedWaveBank!=nullptr)

View file

@ -483,9 +483,8 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen
iEndStart=iOverworldC+iNetherC; iEndStart=iOverworldC+iNetherC;
iEndC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_End); iEndC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_End);
//Mash-up packs don't have these custom ranges.
Minecraft::GetInstance()->soundEngine->SetStreamingSounds(iOverworldStart,iOverworldStart+iOverworldC-1, Minecraft::GetInstance()->soundEngine->SetStreamingSounds(iOverworldStart,iOverworldStart+iOverworldC-1,
iNetherStart,iNetherStart+iNetherC-1,iEndStart,iEndStart+iEndC-1,iEndStart+iEndC, iOverworldStart,iOverworldStart+iOverworldC-1,iOverworldStart,iOverworldStart+iOverworldC-1); // push the CD start to after iNetherStart,iNetherStart+iNetherC-1,iEndStart,iEndStart+iEndC-1,iEndStart+iEndC); // push the CD start to after
} }
#endif #endif
} }