@@ -60,6 +60,11 @@ class $modify(MyPlayLayer, PlayLayer) {
6060
6161 return CCEaseElasticOut::create (action, easingRate);
6262 }
63+ void setupHasCompleted () {
64+ PlayLayer::setupHasCompleted ();
65+ if (!manager->deathAnimationsFromZilko ) return ;
66+ manager->selectedDeathAnimation = Loader::get ()->getLoadedMod (" zilko.death_animations" )->getSavedValue <int64_t >(" selected-animation" );
67+ }
6368 void resetLevel () {
6469 PlayLayer::resetLevel ();
6570 manager->addedNextKeyWhenLabel = false ;
@@ -150,11 +155,6 @@ class $modify(MyPlayLayer, PlayLayer) {
150155 bool isFromZilkoMod = false ;
151156 const bool isNewBest = MyPlayLayer::didPlayerDieAtNewBest ();
152157
153- if (CCNode* deathAnim = this ->getChildByID (" zilko.death_animations/death-animation" ); deathAnim && deathAnim->getTag () == 23 ) {
154- if (CCNode* crl = deathAnim->getChildByID (" reward-layer" ); crl && getModBool (" currencyLayer" )) crl->setVisible (false );
155- newBestNodeProbably = deathAnim->getChildByID (" container" );
156- isFromZilkoMod = true ;
157- }
158158 for (int i = static_cast <int >(getChildrenCount () - 1 ); i >= 0 ; i--) {
159159 // NEW [good]: int i = getChildrenCount() - 1; i >= 0; i--
160160 // ORIG [bad]: int i = getChildrenCount(); i-- > 0;
@@ -173,9 +173,14 @@ class $modify(MyPlayLayer, PlayLayer) {
173173 if (theLastCCNode->getZOrder () != 100 ) continue ;
174174 if (theLastCCNode->getChildrenCount () < 2 ) continue ;
175175 if (getModBool (" noVisibleNewBest" )) return theLastCCNode->setVisible (false );
176- if (!isFromZilkoMod ) newBestNodeProbably = theLastCCNode;
176+ if (!manager-> deathAnimationsFromZilko ) newBestNodeProbably = theLastCCNode;
177177 else theLastCCNode->setVisible (false );
178- break ;
178+ if (newBestNodeProbably) break ;
179+ if (manager->deathAnimationsFromZilko && theLastCCNode->getID () == " zilko.death_animations/death-animation" && theLastCCNode->getTag () == 23 ) {
180+ if (CCNode* crl = theLastCCNode->getChildByID (" reward-layer" ); crl && getModBool (" currencyLayer" )) crl->setVisible (false );
181+ newBestNodeProbably = theLastCCNode->getChildByID (" container" );
182+ isFromZilkoMod = true ;
183+ }
179184 }
180185
181186 if (!newBestNodeProbably || newBestNodeProbably->getUserObject (" modified-already" _spr)) return ;
0 commit comments