Skip to content

Commit

Permalink
exclude random playback from initing randomly
Browse files Browse the repository at this point in the history
  • Loading branch information
xan1242 committed Feb 8, 2023
1 parent d8fca47 commit 8695306
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion NFSPS_CustomJukebox/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ void(__thiscall* sub_4ED910)(unsigned int dis, int unk) = (void(__thiscall*)(uns
bool bInHub = false;
bool bRandomizedPlayback = false;
bool bInitializeRandomly = false;
bool bPlayedOnce = false;
int IGMusicSequencer = 0;
int FEMusicSequencer = 0;

Expand Down Expand Up @@ -761,7 +762,13 @@ uint32_t __stdcall SFXObj_Music_GenNextMusicTrackID_Custom()
}

// get a random entry
result = allowedentries.at(bRandom(allowedentries.size())).SongKey;
if (bPlayedOnce)
result = allowedentries.at(bRandom(allowedentries.size())).SongKey;
else
{
result = allowedentries.at(0).SongKey;
bPlayedOnce = true;
}

allowedentries.clear();
}
Expand Down Expand Up @@ -1001,6 +1008,9 @@ void Init()
IGMusicSequencer = bRandom(TrackCount);
FEMusicSequencer = bRandom(TrackCount);
}

if (bRandomizedPlayback && bInitializeRandomly)
bPlayedOnce = true;
}

BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD reason, LPVOID /*lpReserved*/)
Expand Down

0 comments on commit 8695306

Please sign in to comment.