Skip to content

Commit 30e4146

Browse files
committed
a victorian child would die from seeing this
1 parent 0558283 commit 30e4146

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/FMODAudioEngine.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ float stupidAccmulatorTooLazyToPutElsewhere = 0;
1111
class $modify(MenuLoopFMODHook, FMODAudioEngine) {
1212
void update(float dt) {
1313
FMODAudioEngine::update(dt);
14-
if (GJBaseGameLayer::get() || VANILLA_GD_MENU_LOOP_DISABLED) {
14+
SongManager& songManager = SongManager::get();
15+
if (songManager.getComingFromGJBGL() || GJBaseGameLayer::get() || VANILLA_GD_MENU_LOOP_DISABLED) {
1516
if (stupidAccmulatorTooLazyToPutElsewhere != 0) stupidAccmulatorTooLazyToPutElsewhere = 0;
1617
return;
1718
}
1819

1920
if (SongManager::get().getAdvancedLogs()) stupidAccmulatorTooLazyToPutElsewhere += dt;
2021
else if (stupidAccmulatorTooLazyToPutElsewhere != 0) stupidAccmulatorTooLazyToPutElsewhere = 0;
2122

22-
SongManager& songManager = SongManager::get();
2323
constexpr int channelNumber = 0;
2424

2525
FMOD::Channel* menuLoopChannelProbably = FMODAudioEngine::get()->getActiveMusicChannel(channelNumber);
@@ -37,7 +37,7 @@ class $modify(MenuLoopFMODHook, FMODAudioEngine) {
3737

3838
unsigned int position = 0;
3939
menuLoopChannelProbably->getPosition(&position, FMOD_TIMEUNIT_MS);
40-
if (position > songManager.getLastMenuLoopPosition() && !songManager.getComingFromGJBGL()) songManager.setLastMenuLoopPosition(position); // so the problem with trying to move this logic to GJBGL::init() is that by the time GJBGL::init() is called, FMOD's menu loop track has already been stopped and its position resets to 0. hence why we are here instead.
40+
if (position > songManager.getLastMenuLoopPosition()) songManager.setLastMenuLoopPosition(position); // so the problem with trying to move this logic to GJBGL::init() is that by the time GJBGL::init() is called, FMOD's menu loop track has already been stopped and its position resets to 0. hence why we are here instead.
4141

4242
if (!songManager.getConstantShuffleMode() || songManager.isOverride()) return;
4343
if (GJBaseGameLayer::get() || songManager.isOriginalMenuLoop() || songManager.getSongsSize() < 2) return;

src/ui/SongControlMenu.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ void SongControlMenu::onSkipBkwdButton(CCObject*) {
353353
const std::string& currSong = songManager.getCurrentSong();
354354
if (fmod->getActiveMusic(0) != currSong || !songManager.getSongToSongDataEntries().contains(currSong)) return;
355355

356-
songManager.setComingFromGJBGL(true);
357356
const int fullLength = songManager.getSongToSongDataEntries().find(songManager.getCurrentSong())->second.songLength;
358357
const int lastPosition = songManager.getLastMenuLoopPosition();
359358

@@ -366,7 +365,6 @@ void SongControlMenu::onSkipBkwdButton(CCObject*) {
366365
} else {
367366
fmod->getActiveMusicChannel(0)->setPosition(lastPosition - 5000, FMOD_TIMEUNIT_MS);
368367
}
369-
songManager.setComingFromGJBGL(false);
370368
}
371369

372370
void SongControlMenu::onSkipFwrdButton(CCObject*) {
@@ -380,7 +378,6 @@ void SongControlMenu::onSkipFwrdButton(CCObject*) {
380378
const int fullLength = songManager.getSongToSongDataEntries().find(songManager.getCurrentSong())->second.songLength;
381379
const int lastPosition = songManager.getLastMenuLoopPosition();
382380

383-
songManager.setComingFromGJBGL(true);
384381
if ((lastPosition + 5000) > fullLength) {
385382
if (songManager.getConstantShuffleMode()) {
386383
SongControl::shuffleSong();
@@ -391,7 +388,6 @@ void SongControlMenu::onSkipFwrdButton(CCObject*) {
391388
} else {
392389
fmod->getActiveMusicChannel(0)->setPosition(lastPosition + 5000, FMOD_TIMEUNIT_MS);
393390
}
394-
songManager.setComingFromGJBGL(false);
395391
}
396392

397393
void SongControlMenu::updateCurrentLabel() {

0 commit comments

Comments
 (0)