mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-09 00:24:15 +00:00
fix: Prevent contextually wrong music from playing (#1138)
This commit is contained in:
@@ -114,7 +114,9 @@ const char *SoundEngine::m_szStreamFileA[eStream_Max]=
|
|||||||
"hal4",
|
"hal4",
|
||||||
"nuance1",
|
"nuance1",
|
||||||
"nuance2",
|
"nuance2",
|
||||||
|
"piano1",
|
||||||
|
"piano2",
|
||||||
|
"piano3",
|
||||||
#ifndef _XBOX
|
#ifndef _XBOX
|
||||||
"creative1",
|
"creative1",
|
||||||
"creative2",
|
"creative2",
|
||||||
@@ -127,11 +129,6 @@ const char *SoundEngine::m_szStreamFileA[eStream_Max]=
|
|||||||
"menu3",
|
"menu3",
|
||||||
"menu4",
|
"menu4",
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
"piano1",
|
|
||||||
"piano2",
|
|
||||||
"piano3",
|
|
||||||
|
|
||||||
// Nether
|
// Nether
|
||||||
"nether1",
|
"nether1",
|
||||||
"nether2",
|
"nether2",
|
||||||
@@ -191,7 +188,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)
|
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_Min=iOverworldMin;
|
||||||
m_iStream_Overworld_Max=iOverWorldMax;
|
m_iStream_Overworld_Max=iOverWorldMax;
|
||||||
@@ -199,6 +196,10 @@ 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
|
||||||
@@ -407,7 +408,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_CD_1, eStream_Overworld_Creative1, eStream_Overworld_Creative6, eStream_Overworld_Menu1, eStream_Overworld_Menu4);
|
||||||
|
|
||||||
m_musicID=getMusicID(LevelData::DIMENSION_OVERWORLD);
|
m_musicID=getMusicID(LevelData::DIMENSION_OVERWORLD);
|
||||||
|
|
||||||
@@ -800,7 +801,16 @@ 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_Overworld_Min,m_iStream_Overworld_Max);
|
return GetRandomishTrack(m_iStream_Menu_Min,m_iStream_Menu_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())
|
||||||
@@ -814,7 +824,13 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -829,7 +845,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
|
||||||
//return m_iStream_Overworld_Min + random->nextInt(m_iStream_Overworld_Max-m_iStream_Overworld_Min);
|
//Mash-ups don't have special ranges.
|
||||||
return GetRandomishTrack(m_iStream_Overworld_Min,m_iStream_Overworld_Max);
|
return GetRandomishTrack(m_iStream_Overworld_Min,m_iStream_Overworld_Max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ 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,
|
||||||
@@ -36,9 +40,7 @@ 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,
|
||||||
@@ -134,7 +136,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);
|
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 updateMiniAudio();
|
||||||
void playMusicUpdate();
|
void playMusicUpdate();
|
||||||
|
|
||||||
@@ -185,6 +187,8 @@ 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__
|
||||||
|
|||||||
@@ -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_CD_1, eStream_Overworld_Creative1, eStream_Overworld_Creative6, eStream_Overworld_Menu1, eStream_Overworld_Menu4);
|
||||||
#endif
|
#endif
|
||||||
pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1);
|
pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
|||||||
@@ -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_CD_1, eStream_Overworld_Creative1, eStream_Overworld_Creative6, eStream_Overworld_Menu1, eStream_Overworld_Menu4);
|
||||||
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)
|
||||||
|
|||||||
@@ -483,8 +483,9 @@ 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); // 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
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user