@@ -43,16 +43,18 @@ class $modify(MyPlayLayer, PlayLayer) {
4343 if (!getModBool (" enabled" ) || m_level->isPlatformer () || !m_player1->m_isDead || m_isPlatformer) return ;
4444 CCNode* newBestNodeProbably = nullptr ;
4545 bool foundCurrencyRewardLayer = false ;
46+ bool hasKeyLabel = false ;
4647 const bool isNewBest = MyPlayLayer::isNewBest (this );
4748 for (int i = static_cast <int >(getChildrenCount () - 1 ); i >= 0 ; i--) {
4849 // NEW [good]: int i = getChildrenCount() - 1; i >= 0; i--
4950 // ORIG [bad]: int i = getChildrenCount(); i-- > 0;
5051 auto theLastCCNode = typeinfo_cast<CCNode*>(this ->getChildren ()->objectAtIndex (i));
51- if (typeinfo_cast<CurrencyRewardLayer*>(theLastCCNode)) {
52+ if (const auto crl = typeinfo_cast<CurrencyRewardLayer*>(theLastCCNode)) {
5253 // hide CurrencyRewardLayer
5354 if (getModBool (" currencyLayer" )) {
5455 foundCurrencyRewardLayer = true ;
5556 theLastCCNode->setVisible (false );
57+ if (crl->m_keysLabel ) hasKeyLabel = true ;
5658 }
5759 continue ;
5860 }
@@ -66,15 +68,26 @@ class $modify(MyPlayLayer, PlayLayer) {
6668 if (!newBestNodeProbably) return ;
6769 if (manager->hasNextKeyWhenLoaded && getModBool (" currencyLayer" ) && !manager->addedNextKeyWhenLabel && m_level->m_stars .value () > 1 && foundCurrencyRewardLayer) {
6870 CCLabelBMFont* nextKeyWhen = CCLabelBMFont::create (fmt::format (" Key: {}/500" , GameStatsManager::sharedState ()->getTotalCollectedCurrency () % 500 ).c_str (), " bigFont.fnt" );
69- nextKeyWhen->setID (" next-key-when-compat-label" _spr);
71+ nextKeyWhen->setID (" next-key-when-orbs- compat-label" _spr);
7072 nextKeyWhen->setTag (8042025 );
7173 nextKeyWhen->setScale (.5f );
7274 nextKeyWhen->setColor ({45 , 255 , 255 });
7375 nextKeyWhen->setPosition (newBestNodeProbably->getContentSize () / 2 .f );
7476 nextKeyWhen->setPositionY (nextKeyWhen->getPositionY () - 90 .f );
7577 newBestNodeProbably->addChild (nextKeyWhen);
7678 manager->addedNextKeyWhenLabel = true ;
79+ if (hasKeyLabel) {
80+ CCLabelBMFont* newKeyLabel = CCLabelBMFont::create (" (+1 Key!)" , " bigFont.fnt" );
81+ newKeyLabel->setID (" next-key-when-key-compat-label" _spr);
82+ newKeyLabel->setTag (8052025 );
83+ newKeyLabel->setScale (.5f );
84+ newKeyLabel->setColor ({235 , 235 , 235 });
85+ newKeyLabel->setPosition (nextKeyWhen->getPosition ());
86+ newKeyLabel->setPositionY (nextKeyWhen->getPositionY () - 25 .f );
87+ newBestNodeProbably->addChild (newKeyLabel);
88+ }
7789 }
90+ std::smatch match;
7891 for (CCNode* child : CCArrayExt<CCNode*>(newBestNodeProbably->getChildren ())) {
7992 if (child->getID () == " next-key-when-compat-label" _spr) continue ;
8093 const auto hopefullyALabel = typeinfo_cast<CCLabelBMFont*>(child);
@@ -85,7 +98,6 @@ class $modify(MyPlayLayer, PlayLayer) {
8598 // this is the node displaying where you died as a new best
8699 if (isNewBest && getModBool (" accuratePercent" )) return hopefullyALabel->setString (fmt::format (" {:.{}f}%" , getCurrentPercent (), getModInt (" accuracy" )).c_str ());
87100 // i have to do all of this because robtop's wonderful technology shows percent from previous death if i dont include all of this
88- std::smatch match;
89101 if (!std::regex_match (nodeString, match, manager->percentRegex )) continue ;
90102 auto percent = std::regex_replace (nodeString, std::regex (" %" ), " " );
91103 auto percentAsInt = utils::numFromString<int >(percent);
@@ -129,4 +141,4 @@ class $modify(MyPlayLayer, PlayLayer) {
129141 if (fontID != 0 && fontID != -3 && getModBool (" customFontGoldColor" )) hopefullyALabel->setColor ({254 , 207 , 6 });
130142 }
131143 }
132- };
144+ };
0 commit comments