Skip to content

Commit 8d00de6

Browse files
committed
baseline manager->channel->stop()
1 parent 1a8f0a5 commit 8d00de6

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/Manager.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ class Manager {
2929

3030
float lastDeathPercent = -10.f;
3131

32+
FMOD::Sound* sound;
33+
FMOD::Channel* channel;
34+
FMOD::System* system = FMODAudioEngine::sharedEngine()->m_system;
35+
3236
static Manager* getSharedInstance() {
3337
if (!instance) {
3438
instance = new Manager();

src/PlayLayer.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,18 +158,24 @@ class $modify(MyPlayLayer, PlayLayer) {
158158
this->scheduleOnce(schedule_selector(MyPlayLayer::PRNTSCRNOnDeath), .275f);
159159
}
160160
void PRNTSCRNOnDeath(float) {
161-
const std::string& screenshotOnDeathPreference = getModString("screenshotOnDeathPreference");
162-
if (screenshotOnDeathPreference == "Keep UI") {
161+
if (!manager->hasPRNTSCRN || !MyPlayLayer::isNewBestFloat(this) || !getModBool("screenshotOnDeath")) return;
162+
Mod* prntscrn = Loader::get()->getLoadedMod("ninxout.prntscrn");
163+
if (!prntscrn) return;
164+
const std::string& screenshotOnDeathPreference = utils::string::toLower(getModString("screenshotOnDeathPreference"));
165+
const bool originalHidePlayerValue = prntscrn->getSettingValue<bool>("hide-player");
166+
prntscrn->setSettingValue<bool>("hide-player", false);
167+
log::info("screenshotOnDeathPreference: {}", screenshotOnDeathPreference);
168+
if (screenshotOnDeathPreference == "keep ui") {
163169
(void) PRNTSCRN::screenshotNodeAdvanced(this, {FMODAudioEngine::get()}, {""_spr});
164-
} else if (screenshotOnDeathPreference == "Hide (~99% of) UI") {
165-
Mod* prntscrn = Loader::get()->getLoadedMod("ninxout.prntscrn");
166-
bool originalValue = prntscrn->getSettingValue<bool>("hide-ui");
170+
} else if (screenshotOnDeathPreference == "hide (~99% of) ui") {
171+
const bool originalHideUIValue = prntscrn->getSettingValue<bool>("hide-ui");
167172
prntscrn->setSettingValue<bool>("hide-ui", true);
168173
(void) PRNTSCRN::screenshotNode(this);
169-
prntscrn->setSettingValue<bool>("hide-ui", originalValue);
174+
prntscrn->setSettingValue<bool>("hide-ui", originalHideUIValue);
170175
} else {
171176
(void) PRNTSCRN::screenshotNode(this);
172177
}
173178
(void) PRNTSCRN::screenshotNodeAdvanced(CCScene::get(), {FMODAudioEngine::get()}, {""_spr});
179+
prntscrn->setSettingValue<bool>("hide-ui", originalHidePlayerValue);
174180
}
175181
};

0 commit comments

Comments
 (0)