// // PlayLayer::resetLevel from 0x1000be350 to 0x1000bef25 (3029 bytes) // // 1 xrefs: // > @ 0x1008b7460 // // This function is hookable on this platform! // // Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings // void __fastcall PlayLayer::resetLevel(PlayLayer *a1) { bool m_ignoreDamage; // al cocos2d::CCLabelBMFont *m_statusLabel; // rdi const char *v4; // rsi FMODAudioEngine *v5; // rax FMODAudioEngine *v6; // rax std::string::size_type m_replayRandSeed; // rdi EndPortalObject *m_endPortal; // rdi float m_endXPosition; // xmm0_4 EndPortalObject *v10; // r14 double m_attemptTime; // xmm0_8 unsigned int v12; // r14d GameObject *v13; // r13 int m_outerSectionIndex; // eax double m_positionX; // xmm2_8 double v16; // xmm0_8 double v17; // xmm1_8 double m_positionY; // xmm2_8 float m_sectionXFactor; // xmm1_4 float m_sectionYFactor; // xmm0_4 int v21; // eax int m_middleSectionIndex; // eax unsigned __int64 v23; // r14 StartPosObject *m_startPosObject; // rax CheckpointObject *m_currentCheckpoint; // rsi LevelSettingsObject **p_m_startSettings; // rax double v27; // xmm0_8 PlayerObject *m_player2; // rdi std::string *v29; // rsi double v30; // xmm0_8 PlayerObject *m_player1; // r15 const cocos2d::CCPoint *v32; // rax PlayerObject *v33; // r15 __int64 v34; // rsi GameStatsManager *v35; // rax GJGameLevel *m_level; // r15 int v37; // r12d float v38; // xmm0_4 bool m_started; // r15 bool isJumpButtonPressed_1; // al cocos2d::CCArray *m_batchNodes; // rax cocos2d::ccArray *data; // rax cocos2d::CCNode **arr; // r12 unsigned __int64 v44; // r13 unsigned int v45; // r14d unsigned int v46; // eax int v47; // ecx int v48; // r8d int v49; // r9d cocos2d::CCAction *v50; // rax float v51; // [rsp+0h] [rbp-60h] BYREF _BYTE v52[4]; // [rsp+8h] [rbp-58h] BYREF float v53; // [rsp+Ch] [rbp-54h] std::string v54; // [rsp+10h] [rbp-50h] BYREF float v55; // [rsp+34h] [rbp-2Ch] if ( a1->m_freezeStartCamera || !a1->m_isPlatformer && !a1->m_isPracticeMode ) { m_ignoreDamage = a1->m_ignoreDamage; if ( a1->m_isIgnoreDamageEnabled ) { a1->m_isIgnoreDamageEnabled = m_ignoreDamage; if ( !m_ignoreDamage ) { a1->m_ignoreDamage = 0; a1->m_player1->m_maybeCanRunIntoBlocks = 0; a1->m_player2->m_maybeCanRunIntoBlocks = 0; m_statusLabel = a1->m_statusLabel; if ( m_statusLabel ) { ((void (__fastcall *)(cocos2d::CCLabelBMFont *, bool))m_statusLabel->setVisible)( m_statusLabel, a1->m_isTestMode); if ( a1->m_ignoreDamage ) { v4 = "Ignore Damage"; } else if ( a1->m_isIgnoreDamageEnabled ) { v4 = "Used Ignore Damage"; } else { if ( !a1->m_isTestMode ) goto LABEL_16; v4 = "Testmode"; } ((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_statusLabel->setString)( a1->m_statusLabel, v4); } } } else { a1->m_isIgnoreDamageEnabled = m_ignoreDamage; } } LABEL_16: if ( !a1->m_freezeStartCamera ) { v5 = FMODAudioEngine::sharedEngine(); FMODAudioEngine::stopAllEffects(v5); if ( !a1->m_isPracticeMode || a1->m_practiceMusicSync ) { if ( a1->m_isPlatformer ) { v6 = FMODAudioEngine::sharedEngine(); FMODAudioEngine::pauseAllMusic(v6, 0); } else { GJBaseGameLayer::pauseAudio(a1); } } } GJBaseGameLayer::preResumeGame(a1); qword_1009A3EA0 = clock(); GJBaseGameLayer::resetLevelVariables(a1); if ( a1->m_hitboxesOnDeath && (!a1->m_isDebugDrawEnabled || !a1->m_isPracticeMode) && !a1->m_playerDied && ((unsigned __int8 (__fastcall *)(cocos2d::CCDrawNode *))a1->m_debugDrawNode->isVisible)(a1->m_debugDrawNode) ) { cocos2d::CCDrawNode::clear(a1->m_debugDrawNode); ((void (__fastcall *)(cocos2d::CCDrawNode *, _QWORD))a1->m_debugDrawNode->setVisible)(a1->m_debugDrawNode, 0); } a1->m_gameState.m_commandIndex = 0; a1->m_gameState.m_currentProgress = 0; a1->m_areaObjectsUpdated = 1; a1->m_activatedCheckpoint = nullptr; a1->m_tryPlaceCheckpoint = 0; *(_QWORD *)&a1->m_unk32ec = 0; a1->m_unk32d0 = 0; if ( !a1->m_useReplay || (m_replayRandSeed = a1->m_replayRandSeed) == 0 ) { gettimeofday((timeval *)&v54, nullptr); m_replayRandSeed = v54.__r_.__value_.__r.__words[0] * SLODWORD(v54.__r_.__value_.__r.__words[1]); } a1->m_randomSeed = m_replayRandSeed; GameToolbox::fast_srand(m_replayRandSeed); a1->m_activeObjectsCount = 0; a1->m_unk36ce = 0; a1->m_unk36c8 = 0; UILayer::toggleMenuVisibility(a1->m_uiLayer, 1); *(_WORD *)&a1->m_hasCompletedLevel = 0; a1->m_levelEndAnimationStarted = 0; m_endPortal = a1->m_endPortal; if ( m_endPortal ) { a1->m_endChecked = 0; *(_WORD *)&m_endPortal->m_flippedX = 0; ((void (__fastcall *)(EndPortalObject *, float))m_endPortal->setScaleX)(m_endPortal, 1.0); m_endXPosition = a1->m_endXPosition; a1->m_levelLength = m_endXPosition; v10 = a1->m_endPortal; sub_10028CBE0(&v54, m_endXPosition, 225.0); ((void (__fastcall *)(EndPortalObject *, std::string *))v10->setStartPos)(v10, &v54); GJBaseGameLayer::reorderObjectSection(a1, a1->m_endPortal); ((void (__fastcall *)(EndPortalObject *, __int64))a1->m_endPortal->deactivateObject)(a1->m_endPortal, 1); } a1->m_endLayerStars = 0; a1->m_hasJumped = 0; *(_QWORD *)&a1->m_orbs = 0; a1->m_secretKey = 0; std::string::assign((std::string *)&a1->m_recordString, ""); a1->m_unk3900 = 0.0; a1->m_activeGravityEffects = 0; UILayer::enableMenu(a1->m_uiLayer); GJBaseGameLayer::resetActiveEnterEffects(a1); m_attemptTime = a1->m_attemptTime; if ( m_attemptTime > a1->m_bestAttemptTime ) a1->m_bestAttemptTime = m_attemptTime; a1->m_clicks = 0; a1->m_attemptTime = 0.0; *(_OWORD *)&a1->m_currentTime = 0; v12 = 0; ((void (__fastcall *)(PlayLayer *, _QWORD))a1->toggleGlitter)(a1, 0); if ( (unsigned int)sub_100720070(a1->m_objects) ) { do { v13 = (GameObject *)sub_1007200C0(a1->m_objects, v12); ((void (__fastcall *)(std::string *, GameObject *))v13->getRealPosition)(&v54, v13); ((void (__fastcall *)(GameObject *))v13->resetObject)(v13); m_outerSectionIndex = v13->m_outerSectionIndex; if ( m_outerSectionIndex < 0 ) goto LABEL_58; m_positionX = v13->m_positionX; v16 = 0.0; v17 = 0.0; if ( m_positionX > 0.0 ) { m_sectionXFactor = a1->m_sectionXFactor; if ( m_positionX >= 10000000.0 ) { v17 = (float)(m_sectionXFactor * 10000000.0); m_positionY = v13->m_positionY; if ( m_positionY > 0.0 ) { LABEL_49: m_sectionYFactor = a1->m_sectionYFactor; if ( m_positionY >= 10000000.0 ) { v16 = (float)(m_sectionYFactor * 10000000.0); if ( m_outerSectionIndex != (int)v17 ) { LABEL_53: GJBaseGameLayer::reorderObjectSection(a1, v13); v21 = v13->m_outerSectionIndex; if ( v21 > a1->m_rightSectionIndex || v21 < a1->m_leftSectionIndex || (m_middleSectionIndex = v13->m_middleSectionIndex, m_middleSectionIndex > a1->m_topSectionIndex) || m_middleSectionIndex < a1->m_bottomSectionIndex ) { ((void (__fastcall *)(GameObject *, __int64))v13->deactivateObject)(v13, 1); } goto LABEL_58; } } else { v16 = m_positionY * m_sectionYFactor; if ( m_outerSectionIndex != (int)v17 ) goto LABEL_53; } goto LABEL_43; } } else { v17 = m_positionX * m_sectionXFactor; m_positionY = v13->m_positionY; if ( m_positionY > 0.0 ) goto LABEL_49; } } else { m_positionY = v13->m_positionY; if ( m_positionY > 0.0 ) goto LABEL_49; } if ( m_outerSectionIndex != (int)v17 ) goto LABEL_53; LABEL_43: if ( v13->m_middleSectionIndex != (int)v16 ) goto LABEL_53; LABEL_58: v55 = *(float *)&v54.__r_.__value_.__l.0; ((void (__fastcall *)(float *, GameObject *))v13->getRealPosition)(&v51, v13); if ( v55 != v51 || (v55 = *((float *)v54.__r_.__value_.__r.__words + 1), ((void (__fastcall *)(_BYTE *, GameObject *))v13->getRealPosition)(v52, v13), v55 != v53) ) { v13->m_isDirty = 1; ((void (__fastcall *)(GameObject *, __int64))v13->setObjectRectDirty)(v13, 1); ((void (__fastcall *)(GameObject *, __int64))v13->setOrientedRectDirty)(v13, 1); } ++v12; } while ( v12 < (unsigned int)sub_100720070(a1->m_objects) ); } AudioEffectsLayer::resetAudioVars(a1->m_audioEffectsLayer); PlayLayer::loadDefaultColors(a1); if ( (unsigned int)sub_100720070(a1->m_checkpointArray) ) { v23 = sub_1007200E0(a1->m_checkpointArray); PlayLayer::loadFromCheckpoint(a1, (CheckpointObject *)v23); if ( a1->m_useReplay ) goto LABEL_67; } else { v23 = 0; if ( a1->m_useReplay ) goto LABEL_67; } GJEffectManager::getPersistentStateString(&v54, a1->m_effectManager); std::string::operator=((std::string *)&a1->m_persistentStateString, &v54); if ( (*(_BYTE *)&v54.__r_.__value_.__s.0 & 1) != 0 ) operator delete(v54.__r_.__value_.__l.__data_); LABEL_67: GJEffectManager::resetUsedItemState(a1->m_effectManager); if ( v23 ) { a1->m_unk3251 = 0; if ( !a1->m_useReplay ) GJBaseGameLayer::resetRecord(a1, a1->m_gameState.m_unkUint4, 0); } else { *(_OWORD *)&a1->m_timePlayed = 0; GJBaseGameLayer::resetRecord(a1, 0, 0); m_startPosObject = a1->m_startPosObject; a1->m_unk32e0 = a1->m_randomSeed; if ( m_startPosObject ) { m_currentCheckpoint = a1->m_currentCheckpoint; if ( m_currentCheckpoint ) { PlayLayer::loadFromCheckpoint(a1, m_currentCheckpoint); goto LABEL_76; } p_m_startSettings = &m_startPosObject->m_startSettings; } else { p_m_startSettings = &a1->m_levelSettings; } GJBaseGameLayer::setupLevelStart(a1, *p_m_startSettings); } LABEL_76: ((void (__fastcall *)(PlayerObject *))a1->m_player1->getPosition)(a1->m_player1); sub_10028CC60(&v54); v27 = sub_10028CC90(); m_player2 = a1->m_player2; if ( a1->m_gameState.m_isDualMode ) { ((void (__fastcall *)(PlayerObject *, std::string *, double))m_player2->getPosition)(m_player2, &v54, v27); sub_10028CC60(&v54); v29 = &v54; v30 = sub_10028CC90(); if ( v23 ) goto LABEL_83; } else { ((void (__fastcall *)(PlayerObject *, void *, double))m_player2->setPosition)(m_player2, &unk_10099EE80, v27); sub_10028CC60(&v54); v29 = &v54; v30 = sub_10028CC90(); if ( v23 ) goto LABEL_83; } m_player1 = a1->m_player1; v32 = (const cocos2d::CCPoint *)((__int64 (__fastcall *)(PlayerObject *, std::string *, double))m_player1->getPosition)( m_player1, &v54, v30); GameObject::setLastPosition(m_player1, v32); v33 = a1->m_player2; v29 = (std::string *)((__int64 (__fastcall *)(PlayerObject *))v33->getPosition)(v33); GameObject::setLastPosition(v33, (const cocos2d::CCPoint *)v29); if ( a1->m_startPosObject && !a1->m_currentCheckpoint ) GJBaseGameLayer::loadStartPosObject(a1); LABEL_83: GJBaseGameLayer::updatePlayerCollisionBlocks(a1); if ( !a1->m_unk322a ) { PlayerObject::playSpawnEffect(a1->m_player1); if ( a1->m_gameState.m_isDualMode ) PlayerObject::playSpawnEffect(a1->m_player2); } GJBaseGameLayer::stopCameraShake(a1); if ( !(v23 | (unsigned __int64)a1->m_startPosObject) ) { a1->m_startingFromBeginning = 1; GJBaseGameLayer::checkSpawnObjects(a1); goto LABEL_93; } if ( !v23 ) { LABEL_93: GJBaseGameLayer::updateProximityVolumeEffects(a1); GJBaseGameLayer::updateLevelColors(a1); GJBaseGameLayer::updateCamera(a1, 0.0); ((void (__fastcall *)(PlayLayer *, std::string *, double))a1->updateVisibility)(a1, v29, 0.0); GJBaseGameLayer::updateGradientLayers(a1); GJBaseGameLayer::updateShaderLayer(a1, 0.0); PlayLayer::updateAttempts(a1); a1->m_savedAttempts = a1->m_attempts; std::string::operator=( (std::string *)&a1->m_savedPersistentStateString, (const std::string *)&a1->m_persistentStateString); goto LABEL_94; } v34 = *(unsigned int *)(v23 + 3148); if ( (int)v34 > 0 ) { memset(&v54, 0, sizeof(v54)); ((void (__fastcall *)(PlayLayer *, __int64, _QWORD, std::string *, _QWORD, _QWORD, double))a1->spawnGroup)( a1, v34, 0, &v54, *(unsigned int *)(v23 + 3144), 0, 0.0); if ( v54.__r_.__value_.__r.__words[0] ) { v54.__r_.__value_.__l.__size_ = v54.__r_.__value_.__r.__words[0]; operator delete((void *)v54.__r_.__value_.__r.__words[0]); } } GJBaseGameLayer::gameEventTriggered(a1, CheckpointRespawn, 0, 0); GJBaseGameLayer::updateProximityVolumeEffects(a1); GJBaseGameLayer::updateLevelColors(a1); GJBaseGameLayer::updateCamera(a1, 0.0); ((void (__fastcall *)(PlayLayer *, double))a1->updateVisibility)(a1, 0.0); GJBaseGameLayer::updateGradientLayers(a1); GJBaseGameLayer::updateShaderLayer(a1, 0.0); PlayLayer::updateAttempts(a1); LABEL_94: v35 = GameStatsManager::sharedState(); GameStatsManager::incrementStat_1(v35, "2"); m_level = a1->m_level; v37 = m_level->m_attempts.random - m_level->m_attempts.seed; m_level->m_attempts.value = v37 + 1; v38 = (float)((float)rand() * 4.6566129e-10) * 1000.0; m_level->m_attempts.seed = (int)v38; m_level->m_attempts.random = v37 + (int)v38 + 1; PlayLayer::updateProgressbar(a1); GJBaseGameLayer::refreshCounterLabels(a1); m_started = a1->m_started; if ( a1->m_isPlatformer ) { a1->m_started = 0; } else if ( v23 == 0 && m_started && !a1->m_startPosObject ) { PlayLayer::startMusic(a1); } if ( GameManager::sharedState()->m_recordGameplay && !a1->m_isPracticeMode && !a1->m_isTestMode ) { cocos2d::CCNode::stopActionByTag(a1, 31); a1->m_recordingStopped = 0; } GJBaseGameLayer::removeReleasedButtons(a1); isJumpButtonPressed_1 = UILayer::isJumpButtonPressed_1(a1->m_uiLayer); GJBaseGameLayer::queueButton(a1, 1, isJumpButtonPressed_1, 0, 0.0); if ( !a1->m_isPracticeMode && !a1->m_isIgnoreDamageEnabled ) a1->m_damageVerified = 0; a1->m_freezeStartCamera = 0; a1->m_skipArtReload = 0; GJBaseGameLayer::syncBGTextures(a1); qword_1009A3EA8 = clock(); qword_1009A3EB0 = qword_1009A3EA8 - qword_1009A3EA0; m_batchNodes = a1->m_batchNodes; if ( m_batchNodes ) { data = m_batchNodes->data; if ( data->num ) { arr = (cocos2d::CCNode **)data->arr; v44 = (unsigned __int64)&arr[data->num - 1]; do { if ( !*arr ) break; cocos2d::CCNode::qsortAllChildrenWithIndex(*arr++); } while ( (unsigned __int64)arr <= v44 ); } } GJBaseGameLayer::sortSectionVector(a1); if ( a1->m_isPlatformer && (m_started || a1->m_platformerRestart) ) { a1->m_platformerRestart = 0; if ( !v23 ) { v45 = (unsigned int)cocos2d::CCDelayTime::create(0.2); v46 = (unsigned int)cocos2d::CCCallFunc::create( a1, (cocos2d::SEL_CallFunc)(unsigned __int64)PlayLayer::startGameDelayed); v50 = (cocos2d::CCAction *)sub_1003B5760(v45, v46, 0, v47, v48, v49); cocos2d::CCNode::runAction(a1, v50); a1->m_startingFromBeginning = 0; a1->m_audioPaused = 1; return; } a1->m_started = 1; a1->m_startingFromBeginning = 0; a1->m_audioPaused = 1; } else { a1->m_startingFromBeginning = 0; a1->m_audioPaused = 1; if ( !v23 ) return; } sub_10028CC90(); sub_10028CC90(); sub_10028CC90(); }
GD Web Decomp Icon

GD Web Decomp

Raw Source