@@ -42,7 +42,7 @@ class $modify(MyPlayLayer, PlayLayer) {
4242 PlayLayer::updateProgressbar ();
4343 if (!getModBool (" enabled" ) || m_level->isPlatformer () || !m_player1->m_isDead || m_isPlatformer) return ;
4444 CCNode* newBestNodeProbably = nullptr ;
45- bool foundCurrencyRewardLayer = false ;
45+ bool hasOrbsLabel = false ;
4646 bool hasKeyLabel = false ;
4747 const bool isNewBest = MyPlayLayer::isNewBest (this );
4848 for (int i = static_cast <int >(getChildrenCount () - 1 ); i >= 0 ; i--) {
@@ -52,8 +52,8 @@ class $modify(MyPlayLayer, PlayLayer) {
5252 if (const auto crl = typeinfo_cast<CurrencyRewardLayer*>(theLastCCNode)) {
5353 // hide CurrencyRewardLayer
5454 if (getModBool (" currencyLayer" )) {
55- foundCurrencyRewardLayer = true ;
5655 theLastCCNode->setVisible (false );
56+ if (crl->m_orbsLabel ) hasOrbsLabel = true ;
5757 if (crl->m_keysLabel ) hasKeyLabel = true ;
5858 }
5959 continue ;
@@ -65,27 +65,31 @@ class $modify(MyPlayLayer, PlayLayer) {
6565 newBestNodeProbably = theLastCCNode;
6666 break ;
6767 }
68- if (!newBestNodeProbably) return ;
69- if (manager->hasNextKeyWhenLoaded && getModBool (" currencyLayer" ) && !manager->addedNextKeyWhenLabel && m_level->m_stars .value () > 1 && foundCurrencyRewardLayer) {
70- CCLabelBMFont* nextKeyWhen = CCLabelBMFont::create (fmt::format (" Key: {}/500" , GameStatsManager::sharedState ()->getTotalCollectedCurrency () % 500 ).c_str (), " bigFont.fnt" );
71- nextKeyWhen->setID (" next-key-when-orbs-compat-label" _spr);
72- nextKeyWhen->setTag (8042025 );
73- nextKeyWhen->setScale (.5f );
74- nextKeyWhen->setColor ({45 , 255 , 255 });
75- nextKeyWhen->setPosition (newBestNodeProbably->getContentSize () / 2 .f );
76- nextKeyWhen->setPositionY (nextKeyWhen->getPositionY () - 90 .f );
77- newBestNodeProbably->addChild (nextKeyWhen);
78- manager->addedNextKeyWhenLabel = true ;
68+ if (!newBestNodeProbably || newBestNodeProbably->getUserObject (" modified-already" _spr)) return ;
69+ newBestNodeProbably->setUserObject (" modified-already" _spr, CCBool::create (true ));
70+ if (manager->hasNextKeyWhenLoaded && getModBool (" currencyLayer" ) && getModBool (" currencyLayerNextKeyWhenCompat" ) && !manager->addedNextKeyWhenLabel && m_level->m_stars .value () > 1 ) {
71+ if (hasOrbsLabel) {
72+ CCLabelBMFont* nextKeyWhen = CCLabelBMFont::create (fmt::format (" Key: {}/500" , GameStatsManager::sharedState ()->getTotalCollectedCurrency () % 500 ).c_str (), " bigFont.fnt" );
73+ nextKeyWhen->setID (" next-key-when-orbs-compat-label" _spr);
74+ nextKeyWhen->setTag (8042025 );
75+ nextKeyWhen->setScale (.5f );
76+ nextKeyWhen->setColor ({45 , 255 , 255 });
77+ nextKeyWhen->setPosition (newBestNodeProbably->getContentSize () / 2 .f );
78+ nextKeyWhen->setPositionY (nextKeyWhen->getPositionY () - 90 .f );
79+ newBestNodeProbably->addChild (nextKeyWhen);
80+ }
7981 if (hasKeyLabel) {
8082 CCLabelBMFont* newKeyLabel = CCLabelBMFont::create (" (+1 Key!)" , " bigFont.fnt" );
8183 newKeyLabel->setID (" next-key-when-key-compat-label" _spr);
8284 newKeyLabel->setTag (8052025 );
8385 newKeyLabel->setScale (.5f );
8486 newKeyLabel->setColor ({235 , 235 , 235 });
85- newKeyLabel->setPosition (nextKeyWhen->getPosition ());
86- newKeyLabel->setPositionY (nextKeyWhen->getPositionY () - 25 .f );
87+ newKeyLabel->setPosition (newBestNodeProbably->getContentSize () / 2 .f );
88+ newKeyLabel->setPositionY (newKeyLabel->getPositionY () - 90 .f );
89+ if (hasOrbsLabel) newKeyLabel->setPositionY (newKeyLabel->getPositionY () - 15 .f );
8790 newBestNodeProbably->addChild (newKeyLabel);
8891 }
92+ manager->addedNextKeyWhenLabel = true ;
8993 }
9094 std::smatch match;
9195 for (CCNode* child : CCArrayExt<CCNode*>(newBestNodeProbably->getChildren ())) {
0 commit comments