Skip to content

Commit be3b409

Browse files
committed
hmmmmmmmmmmmmmm
1 parent 6fd726e commit be3b409

File tree

4 files changed

+57
-2
lines changed

4 files changed

+57
-2
lines changed

mod.json

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"geode": "4.4.0",
2+
"geode": "4.7.0",
33
"gd": {
44
"win": "2.2074",
55
"mac": "2.2074",
66
"ios": "2.2074",
77
"android": "2.2074"
88
},
9-
"version": "v1.7.2",
9+
"version": "v1.7.3",
1010
"id": "raydeeux.deathscreentweaks",
1111
"name": "DeathScreenTweaks",
1212
"developers": [
@@ -39,6 +39,24 @@
3939
"type": "bool",
4040
"default": false
4141
},
42+
"screenshotOnDeath": {
43+
"name": "Auto-Screenshot on Death",
44+
"description": "Automatically take a screenshot when getting a New Best.\n\n<cy>\"But this could've been a toggle in PRNTSCRN!\"</c> No.",
45+
"type": "bool",
46+
"default": false
47+
},
48+
"screenshotOnDeathPreference": {
49+
"name": "Auto-Screenshot Preferred Type (READ!)",
50+
"description": "Pick the kind of screenshot you want. No, you can't have all of the types of screenshots; pick wisely!\n\n<cy>\"But this could've been a toggle in PRNTSCRN!\"</c> No.",
51+
"type": "string",
52+
"default": "Screenshot As-Is",
53+
"one-of": [
54+
"Screenshot As-Is",
55+
"Screenshot the Level, Keep UI",
56+
"Screenshot the Level, Hide (~99% of) UI",
57+
"Screenshot the Level, Use PRNTSCRN Settings"
58+
]
59+
},
4260
"changeDeathText": {
4361
"name": "Change \"New Best\" Texts",
4462
"description": "Leaving this enabled is semi-important, since it's kind of the original purpose of this mod. You can disable it though if you want, I guess.",
@@ -308,6 +326,9 @@
308326
"resources/*.mp3"
309327
]
310328
},
329+
"dependencies": {
330+
"ninxout.prntscrn": ">=1.0.3"
331+
},
311332
"incompatibilities": {
312333
"raydeeux.disturbingnewbests": {
313334
"version": ">=1.0.0",

src/Manager.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class Manager {
2323

2424
bool completedJDDNCheck = false;
2525

26+
bool hasPRNTSCRN = false;
2627
bool hasNextKeyWhenLoaded = false;
2728
bool addedNextKeyWhenLabel = false;
2829

src/MenuLayer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class $modify(MyMenuLayer, MenuLayer) {
2222
}
2323
manager->completedJDDNCheck = true;
2424
manager->hasNextKeyWhenLoaded = Loader::get()->isModLoaded("alphalaneous.next_key_when");
25+
manager->hasPRNTSCRN = Loader::get()->isModLoaded("ninxout.prntscrn");
2526
return true;
2627
}
2728
};

src/PlayLayer.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <ninxout.prntscrn/include/api.hpp>
12
#include <Geode/modify/PlayLayer.hpp>
23
#include <algorithm>
34
#include <random>
@@ -18,6 +19,28 @@ class $modify(MyPlayLayer, PlayLayer) {
1819
static bool isNewBest(PlayLayer* pl) {
1920
return pl->getCurrentPercentInt() > pl->m_level->m_normalPercent.value();
2021
}
22+
static bool isNewBestFloat(PlayLayer* pl) {
23+
return pl->getCurrentPercent() > pl->m_level->m_normalPercent.value();
24+
}
25+
void PRNTSCRNOnDeath(float) {
26+
const std::string& screenshotPreference = getModString("screenshotOnDeathPreference");
27+
log::info("screenshotPreference: {}", screenshotPreference);
28+
if (!manager->hasPRNTSCRN) return;
29+
log::info("screenshotPreference: {}, mod is loaded", screenshotPreference);
30+
if (screenshotPreference == "Screenshot the Level, Keep UI") {
31+
(void) PRNTSCRN::screenshotPlayLayerWithoutAnyVisibilityFilters();
32+
} else if (screenshotPreference == "Screenshot the Level, Hide (~99% of) UI") {
33+
bool originalSetting = Loader::get()->getLoadedMod("ninxout.prntscrn")->getSettingValue<bool>("hide-ui");
34+
Loader::get()->getLoadedMod("ninxout.prntscrn")->setSettingValue<bool>("hide-ui", true);
35+
(void) PRNTSCRN::screenshotNode(this);
36+
Loader::get()->getLoadedMod("ninxout.prntscrn")->setSettingValue<bool>("hide-ui", originalSetting);
37+
} else if (screenshotPreference == "Screenshot the Level, Use PRNTSCRN Settings") {
38+
(void) PRNTSCRN::screenshotNode(this);
39+
} else {
40+
(void) PRNTSCRN::screenshotNode(CCScene::get());
41+
}
42+
log::info("screenshot Taken?");
43+
}
2144
void resetLevel() {
2245
PlayLayer::resetLevel();
2346
Manager::getSharedInstance()->addedNextKeyWhenLabel = false;
@@ -145,4 +168,13 @@ class $modify(MyPlayLayer, PlayLayer) {
145168
if (fontID != 0 && fontID != -3 && getModBool("customFontGoldColor")) hopefullyALabel->setColor({254, 207, 6});
146169
}
147170
}
171+
void showNewBest(bool newReward, int orbs, int diamonds, bool demonKey, bool noRetry, bool noTitle) {
172+
PlayLayer::showNewBest(newReward, orbs, diamonds, demonKey, noRetry, noTitle);
173+
log::info("isNewBestFloat: {}", MyPlayLayer::isNewBestFloat(this));
174+
log::info("manager->hasPRNTSCRN: {}", manager->hasPRNTSCRN);
175+
if (manager->hasPRNTSCRN && MyPlayLayer::isNewBestFloat(this) && getModBool("screenshotOnDeath")) {
176+
log::info("screenshottingg.......");
177+
this->scheduleOnce(schedule_selector(MyPlayLayer::PRNTSCRNOnDeath), .5f);
178+
}
179+
}
148180
};

0 commit comments

Comments
 (0)