Skip to content

Commit

Permalink
break gameplay
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed May 25, 2024
1 parent fc3bed6 commit 1390ad7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
26 changes: 19 additions & 7 deletions src/Etterna/Models/Misc/AutoKeysounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@ AutoKeysounds::LoadAutoplaySoundsInto(RageSoundReader_Chain* pChain)
void
AutoKeysounds::LoadTracks(const Song* pSong,
RageSoundReader*& pShared,
RageSoundReader*& pPlayer1)
RageSoundReader*& pPlayer1,
RageSoundReader*& pPlayer2)
{
pPlayer1 = nullptr;
pShared = nullptr;
pPlayer2 = nullptr;

std::vector<std::string> vsMusicFile;
const auto sMusicPath = GAMESTATE->m_pCurSteps->GetMusicPath();
Expand Down Expand Up @@ -155,7 +157,7 @@ AutoKeysounds::FinishLoading()
Song* pSong = GAMESTATE->m_pCurSong;

std::vector<RageSoundReader*> apSounds;
LoadTracks(pSong, m_pSharedSound, m_pPlayerSounds);
LoadTracks(pSong, m_pSharedSound, m_pPlayerSounds[0], m_pPlayerSounds[1]);

// Load autoplay sounds, if any.
{
Expand Down Expand Up @@ -183,11 +185,21 @@ AutoKeysounds::FinishLoading()
m_pSharedSound = new RageSoundReader_Pan(m_pSharedSound);
apSounds.push_back(m_pSharedSound);

if (m_pPlayerSounds != nullptr) {
m_pPlayerSounds = new RageSoundReader_PitchChange(m_pPlayerSounds);
m_pPlayerSounds = new RageSoundReader_PostBuffering(m_pPlayerSounds);
m_pPlayerSounds = new RageSoundReader_Pan(m_pPlayerSounds);
apSounds.push_back(m_pPlayerSounds);
if (m_pPlayerSounds[0] != nullptr) {
m_pPlayerSounds[0] = new RageSoundReader_PitchChange(m_pPlayerSounds[0]);
m_pPlayerSounds[0] =
new RageSoundReader_PostBuffering(m_pPlayerSounds[0]);
m_pPlayerSounds[0] = new RageSoundReader_Pan(m_pPlayerSounds[0]);
apSounds.push_back(m_pPlayerSounds[0]);
}

if (m_pPlayerSounds[1] != nullptr) {
m_pPlayerSounds[1] =
new RageSoundReader_PitchChange(m_pPlayerSounds[1]);
m_pPlayerSounds[1] =
new RageSoundReader_PostBuffering(m_pPlayerSounds[1]);
m_pPlayerSounds[1] = new RageSoundReader_Pan(m_pPlayerSounds[1]);
apSounds.push_back(m_pPlayerSounds[1]);
}

if (apSounds.size() > 1) {
Expand Down
7 changes: 4 additions & 3 deletions src/Etterna/Models/Misc/AutoKeysounds.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,21 @@ class AutoKeysounds
{
if (pn == PLAYER_INVALID)
return nullptr;
return m_pPlayerSounds;
return m_pPlayerSounds[pn];
}

protected:
void LoadAutoplaySoundsInto(RageSoundReader_Chain* pChain);
static void LoadTracks(const Song* pSong,
RageSoundReader*& pGlobal,
RageSoundReader*& pPlayer1);
RageSoundReader*& pPlayer1,
RageSoundReader*& pPlayer2);

NoteData m_ndAutoKeysoundsOnly;
std::vector<RageSound> m_vKeysounds;
RageSound m_sSound;
RageSoundReader* m_pChain; // owned by m_sSound
RageSoundReader* m_pPlayerSounds; // owned by m_sSound
RageSoundReader* m_pPlayerSounds[1]; // owned by m_sSound
RageSoundReader* m_pSharedSound; // owned by m_sSound
};

Expand Down

0 comments on commit 1390ad7

Please sign in to comment.