@@ -151,32 +151,33 @@ class $modify(MyPlayLayer, PlayLayer) {
151151 const bool isNewBest = MyPlayLayer::didPlayerDieAtNewBest ();
152152
153153 if (CCNode* deathAnim = this ->getChildByID (" zilko.death_animations/death-animation" )) {
154- if (deathAnim->getChildByType <CurrencyRewardLayer*>(0 )) {
154+ if (deathAnim->getChildByType <CCLayerColor*>(0 )) {
155+ if (CurrencyRewardLayer* crl = deathAnim->getChildByType <CurrencyRewardLayer*>(0 ); crl && getModBool (" currencyLayer" )) crl->setVisible (false );
155156 newBestNodeProbably = static_cast <CCNode*>(deathAnim->getChildren ()->objectAtIndex (1 ));
156157 isFromZilkoMod = true ;
157158 }
158- } else {
159- for (int i = static_cast <int >(getChildrenCount () - 1 ); i >= 0 ; i--) {
160- // NEW [good]: int i = getChildrenCount() - 1; i >= 0; i--
161- // ORIG [bad]: int i = getChildrenCount(); i-- > 0;
162- auto theLastCCNode = typeinfo_cast<CCNode*>(this ->getChildren ()->objectAtIndex (i));
163- if (const auto crl = typeinfo_cast<CurrencyRewardLayer*>(theLastCCNode)) {
164- // hide CurrencyRewardLayer
165- if (getModBool (" currencyLayer" )) {
166- theLastCCNode->setVisible (false );
167- if (crl->m_orbsLabel ) hasOrbsLabel = true ;
168- if (crl->m_keysLabel ) hasKeyLabel = true ;
169- if (crl->m_diamonds > 0 || crl->m_orbs > 0 ) hasDiamondsOrOrbs = m_level->m_stars .value () > 0 ;
170- }
171- continue ;
159+ }
160+ for (int i = static_cast <int >(getChildrenCount () - 1 ); i >= 0 ; i--) {
161+ // NEW [good]: int i = getChildrenCount() - 1; i >= 0; i--
162+ // ORIG [bad]: int i = getChildrenCount(); i-- > 0;
163+ auto theLastCCNode = typeinfo_cast<CCNode*>(this ->getChildren ()->objectAtIndex (i));
164+ if (const auto crl = typeinfo_cast<CurrencyRewardLayer*>(theLastCCNode)) {
165+ // hide CurrencyRewardLayer
166+ if (getModBool (" currencyLayer" )) {
167+ theLastCCNode->setVisible (false );
168+ if (crl->m_orbsLabel ) hasOrbsLabel = true ;
169+ if (crl->m_keysLabel ) hasKeyLabel = true ;
170+ if (crl->m_diamonds > 0 || crl->m_orbs > 0 ) hasDiamondsOrOrbs = m_level->m_stars .value () > 0 ;
172171 }
173- if (!theLastCCNode || theLastCCNode == this ->m_uiLayer ) continue ; // skip UILayer
174- if (theLastCCNode->getZOrder () != 100 ) continue ;
175- if (theLastCCNode->getChildrenCount () < 2 ) continue ;
176- if (getModBool (" noVisibleNewBest" )) return theLastCCNode->setVisible (false );
177- newBestNodeProbably = theLastCCNode;
178- break ;
172+ continue ;
179173 }
174+ if (!theLastCCNode || theLastCCNode == this ->m_uiLayer ) continue ; // skip UILayer
175+ if (theLastCCNode->getZOrder () != 100 ) continue ;
176+ if (theLastCCNode->getChildrenCount () < 2 ) continue ;
177+ if (getModBool (" noVisibleNewBest" )) return theLastCCNode->setVisible (false );
178+ if (!isFromZilkoMod) newBestNodeProbably = theLastCCNode;
179+ else theLastCCNode->setVisible (false );
180+ break ;
180181 }
181182
182183 if (!newBestNodeProbably || newBestNodeProbably->getUserObject (" modified-already" _spr)) return ;
0 commit comments