Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 26 additions & 10 deletions Minecraft.Client/Common/Audio/SoundEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ const char *SoundEngine::m_szStreamFileA[eStream_Max]=
"hal4",
"nuance1",
"nuance2",

"piano1",
"piano2",
"piano3",
#ifndef _XBOX
"creative1",
"creative2",
Expand All @@ -127,11 +129,6 @@ const char *SoundEngine::m_szStreamFileA[eStream_Max]=
"menu3",
"menu4",
#endif

"piano1",
"piano2",
"piano3",

// Nether
"nether1",
"nether2",
Expand Down Expand Up @@ -191,14 +188,18 @@ 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;
m_iStream_Nether_Min=iNetherMin;
m_iStream_Nether_Max=iNetherMax;
m_iStream_End_Min=iEndMin;
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;

// array to monitor recently played tracks
Expand Down Expand Up @@ -407,7 +408,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);

Expand Down Expand Up @@ -797,7 +798,16 @@ 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->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())
Expand All @@ -811,7 +821,13 @@ int SoundEngine::getMusicID(int iDomain)
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);
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);

if (gt == GameType::CREATIVE)
{
return GetRandomishTrack(m_iStream_Creative_Min,m_iStream_Creative_Max);
}
return GetRandomishTrack(m_iStream_Overworld_Min,m_iStream_Overworld_Max);
}
}
Expand All @@ -826,7 +842,7 @@ int SoundEngine::getMusicID(int iDomain)
//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);
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);
}
}
Expand Down
12 changes: 8 additions & 4 deletions Minecraft.Client/Common/Audio/SoundEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ enum eMUSICFILES
eStream_Overworld_hal4,
eStream_Overworld_nuance1,
eStream_Overworld_nuance2,
//Moved these to separate
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,
Expand All @@ -30,9 +34,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,
Expand Down Expand Up @@ -128,7 +130,7 @@ class SoundEngine : public ConsoleSoundEngine
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();

Expand Down Expand Up @@ -179,6 +181,8 @@ class SoundEngine : public ConsoleSoundEngine
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__
Expand Down
2 changes: 1 addition & 1 deletion Minecraft.Client/Common/Consoles_App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion Minecraft.Client/Common/UI/UIController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion Minecraft.Client/DLCTexturePack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,9 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen
iEndStart=iOverworldC+iNetherC;
iEndC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_End);

//Mash-up packs don't have these custom ranges.
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
}
Expand Down
Loading