Skip to content

Commit e00d3d7

Browse files
committed
atp idek anymore
1 parent 2d7c432 commit e00d3d7

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

src/Manager.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class Manager {
3232

3333
float lastDeathPercent = -10.f;
3434

35+
float currentDeathPercentForQueueInMainLoader = -1.f;
36+
3537
FMOD::Sound* sound;
3638
FMOD::Channel* channel;
3739
FMOD::System* system = FMODAudioEngine::sharedEngine()->m_system;

src/PlayLayer.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class $modify(MyPlayLayer, PlayLayer) {
6262
}
6363
void setupHasCompleted() {
6464
PlayLayer::setupHasCompleted();
65+
manager->lastDeathPercent = -10.f;
6566
if (!manager->deathAnimationsFromZilko) return;
6667
manager->selectedDeathAnimation = Loader::get()->getLoadedMod("zilko.death_animations")->getSavedValue<int64_t>("selected-animation");
6768
}
@@ -75,6 +76,7 @@ class $modify(MyPlayLayer, PlayLayer) {
7576
void onQuit() {
7677
PlayLayer::onQuit();
7778
manager->lastDeathPercent = -10.f;
79+
manager->currentDeathPercentForQueueInMainLoader = -1.f;
7880
if (!manager->channel) return;
7981
STOP_MANAGER_CHANNEL
8082
}
@@ -145,6 +147,8 @@ class $modify(MyPlayLayer, PlayLayer) {
145147
}
146148
}
147149
void findAndModifyTheNewBestNode() {
150+
if (!getModBool("enabled") || !m_level || m_level->isPlatformer() || m_isPlatformer) return;
151+
148152
CCNode* newBestNodeProbably = nullptr;
149153
bool hasOrbsLabel = false;
150154
bool hasKeyLabel = false;
@@ -184,6 +188,7 @@ class $modify(MyPlayLayer, PlayLayer) {
184188
newBestNodeProbably->setUserObject("modified-already"_spr, CCBool::create(true));
185189

186190
if (!isFromZilkoMod) MyPlayLayer::applyNodeTraitsCustomization(newBestNodeProbably, hasDiamondsOrOrbs);
191+
// out of respect for zilko's mod i will not be changing its duration
187192

188193
if (manager->hasNextKeyWhenLoaded && getModBool("currencyLayer") && getModBool("currencyLayerNextKeyWhenCompat") && !manager->addedNextKeyWhenLabel && m_level->m_stars.value() > 1) {
189194
if (hasOrbsLabel || isFromZilkoMod) {
@@ -222,7 +227,7 @@ class $modify(MyPlayLayer, PlayLayer) {
222227

223228
if (nodeString.ends_with("%") && fontFile == "bigFont.fnt") {
224229
// this is the node displaying where you died as a new best
225-
if (isNewBest && getModBool("accuratePercent")) return hopefullyALabel->setString(fmt::format("{:.{}f}%", getCurrentPercent(), getModInt("accuracy")).c_str());
230+
if (isNewBest && getModBool("accuratePercent")) return hopefullyALabel->setString(fmt::format("{:.{}f}%", manager->lastDeathPercent, getModInt("accuracy")).c_str());
226231
// i have to do all of this because robtop's wonderful technology shows percent from previous death if i dont include all of this
227232
if (!std::regex_match(nodeString, match, manager->percentRegex)) continue;
228233
auto percent = std::regex_replace(nodeString, std::regex("%"), "");
@@ -235,7 +240,7 @@ class $modify(MyPlayLayer, PlayLayer) {
235240
log::info("getCurrentPercentInt: {}", currPercent);
236241

237242
if (!getModBool("accuratePercent")) hopefullyALabel->setString(fmt::format("{}%", currPercent).c_str());
238-
else hopefullyALabel->setString(fmt::format("{:.{}f}%", getCurrentPercent(), getModInt("accuracy")).c_str());
243+
else hopefullyALabel->setString(fmt::format("{:.{}f}%", manager->lastDeathPercent, getModInt("accuracy")).c_str());
239244
continue;
240245
}
241246

@@ -280,6 +285,9 @@ class $modify(MyPlayLayer, PlayLayer) {
280285
}
281286
void showNewBest(bool newReward, int orbs, int diamonds, bool demonKey, bool noRetry, bool noTitle) {
282287
PlayLayer::showNewBest(newReward, orbs, diamonds, demonKey, noRetry, noTitle);
288+
Loader::get()->queueInMainThread([this]() {
289+
MyPlayLayer::findAndModifyTheNewBestNode();
290+
});
283291
if (!getModBool("enabled") || !m_player1->m_isDead || this->m_isPracticeMode || this->m_isTestMode || m_isPlatformer || (m_level && m_level->isPlatformer())) return;
284292
if (!manager->hasPRNTSCRN || !getModBool("screenshotOnDeath")) return;
285293
this->scheduleOnce(schedule_selector(MyPlayLayer::PRNTSCRNOnDeath), .24f);

src/PlayerObject.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <Geode/modify/PlayerObject.hpp>
22
#include <filesystem>
3-
43
#include "Manager.hpp"
54

65
#define getBool Mod::get()->getSettingValue<bool>
@@ -25,6 +24,10 @@ class $modify(MyPlayerObject, PlayerObject) {
2524
const auto theLevel = pl->m_level;
2625
if (!theLevel || theLevel->isPlatformer()) return;
2726
if (this == pl->m_player2 && theLevel->m_twoPlayerMode) return;
27+
if (this == pl->m_player1 && !this->m_isDead) return;
28+
29+
Manager* manager = Manager::getSharedInstance();
30+
manager->lastDeathPercent = pl->getCurrentPercent();
2831

2932
const bool isNewBest = MyPlayerObject::isNewBest(pl);
3033
const bool shouldPlayNewBestSFX = getBool("newBestSFX") && isNewBest;
@@ -40,7 +43,6 @@ class $modify(MyPlayerObject, PlayerObject) {
4043
const auto fmod = FMODAudioEngine::get();
4144
if (!fmod) return;
4245

43-
Manager* manager = Manager::getSharedInstance();
4446
const float plCurrentPercent = pl->getCurrentPercent();
4547
const float originalDeathPercent = manager->lastDeathPercent;
4648
const bool shouldActivateSisyphusMode = getBool("sisyphus") && std::abs(originalDeathPercent - plCurrentPercent) <= static_cast<float>(std::clamp(getFloat("sisyphusThreshold"), .01, 10.));

0 commit comments

Comments
 (0)