// // PlayLayer::resetLevel from 0x1403b8eb0 to 0x1403b9b92 (3298 bytes) // // 2 xrefs: // > @ 0x1405c9d10 // > @ 0x1406d70ac // // 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 // // Hidden C++ exception states: #wind=6 void PlayLayer::resetLevel(PlayLayer *a1) { float v1; // xmm3_4 bool m_ignoreDamage; // al FMODAudioEngine *v4; // rcx GJBaseGameLayer *v5; // rcx __int64 v6; // rdi __int64 *i; // rbx FMOD::Channel *v8; // rax __int64 m_replayRandSeed; // rax EndPortalObject *m_endPortal; // rax float v11; // xmm0_4 float m_endXPosition; // xmm1_4 EndPortalObject_vtbl *v13; // rbx __int64 v14; // rax EndPortalObject *v15; // rbx _BOOL8 v16; // rdx _BOOL8 v17; // rdx double m_attemptTime; // xmm0_8 unsigned int j; // edi GameObject *v20; // rbx int m_outerSectionIndex; // ecx double m_positionX; // xmm2_8 double v23; // xmm0_8 float m_sectionXFactor; // xmm1_4 int v25; // edx double m_positionY; // xmm2_8 double v27; // xmm0_8 float m_sectionYFactor; // xmm1_4 _BOOL8 v29; // rdx int v30; // eax int m_middleSectionIndex; // eax float *v32; // rax _BOOL8 v33; // rdx __int64 v34; // rax _BOOL8 v35; // rdx AudioEffectsLayer *m_audioEffectsLayer; // rbx cocos2d::CCArray *m_unk1c0; // rcx struct cocos2d::CCArray *v38; // rax CheckpointObject *Object; // r14 void **v40; // rdx GJEffectManager *m_effectManager; // rbx bool v42; // r8 StartPosObject *m_startPosObject; // rax CheckpointObject *m_currentCheckpoint; // rdx __int64 v45; // rax PlayerObject *m_player2; // rcx PlayerObject_vtbl *v47; // rax __int64 v48; // rax const cocos2d::CCPoint *v49; // rax const cocos2d::CCPoint *v50; // rax __int64 m_respawnID; // rdx void *v52; // rcx std::string *p_m_persistentStateString; // rdx GameStatsManager *v54; // rcx GJGameLevel *m_level; // rdi int v56; // ebx float v57; // xmm0_4 bool m_started; // r15 __int64 v59; // rax UILayer *m_uiLayer; // rax bool v61; // al std::_Vector_val>::pointer Mylast; // rdx cocos2d::CCArray *m_batchNodes; // rax cocos2d::ccArray *data; // rbx __int64 num; // rax cocos2d::CCNode **arr; // rbx cocos2d::CCNode **k; // rdi __int64 v68; // rbx struct cocos2d::CCDelayTime *v69; // rax struct cocos2d::CCSequence *v70; // rax cocos2d::ccColor3B *v71; // r8 void **v72; // [rsp+28h] [rbp-79h] FMODAudioEngine *v73; // [rsp+48h] [rbp-59h] BYREF void *Block[2]; // [rsp+50h] [rbp-51h] BYREF double v75; // [rsp+60h] [rbp-41h] cocos2d::CCPoint v76; // [rsp+68h] [rbp-39h] BYREF char v77[8]; // [rsp+70h] [rbp-31h] BYREF void *Src[4]; // [rsp+78h] [rbp-29h] BYREF if ( a1->m_freezeStartCamera || !a1->m_isPlatformer && !a1->m_isPracticeMode ) { m_ignoreDamage = a1->m_ignoreDamage; if ( !a1->m_isIgnoreDamageEnabled || m_ignoreDamage ) { a1->m_isIgnoreDamageEnabled = m_ignoreDamage; } else { a1->m_isIgnoreDamageEnabled = 0; a1->m_ignoreDamage = 0; a1->m_player1->m_maybeCanRunIntoBlocks = 0; a1->m_player2->m_maybeCanRunIntoBlocks = 0; PlayLayer::updateTestModeLabel(a1); } } if ( !a1->m_freezeStartCamera ) { v4 = (FMODAudioEngine *)qword_1406C2E88; if ( !qword_1406C2E88 ) { v73 = (FMODAudioEngine *)operator new(0x888u); qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v73); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88); v4 = (FMODAudioEngine *)qword_1406C2E88; } FMODAudioEngine::stopAllEffects(v4); if ( !a1->m_isPracticeMode || a1->m_practiceMusicSync ) { if ( a1->m_isPlatformer ) { v6 = qword_1406C2E88; if ( !qword_1406C2E88 ) { v73 = (FMODAudioEngine *)operator new(0x888u); qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v73); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88); v6 = qword_1406C2E88; } for ( i = **(__int64 ***)(v6 + 328); i != *(__int64 **)(v6 + 328); i = (__int64 *)*i ) { if ( !*((_BYTE *)i + 73) ) { v8 = FMODAudioEngine::channelForChannelID((FMODAudioEngine *)v6, *((_DWORD *)i + 6)); if ( v8 ) FMOD::ChannelControl::setPaused(v8, 1); } } } else { GJBaseGameLayer::pauseAudio(v5); } } } a1->m_resumeTimer = 2; dword_1406C10C4 = clock(); GJBaseGameLayer::resetLevelVariables(a1); if ( a1->m_hitboxesOnDeath && (!a1->m_isDebugDrawEnabled || !a1->m_isPracticeMode) && !a1->m_playerDied ) PlayLayer::toggleDebugDraw(a1); a1->m_gameState.m_commandIndex = 0; a1->m_gameState.m_currentProgress = 0; *(_QWORD *)&a1->m_unk32ec = 0; a1->m_areaObjectsUpdated = 1; a1->m_activatedCheckpoint = nullptr; a1->m_tryPlaceCheckpoint = 0; a1->m_unk32d0 = 0; if ( !a1->m_useReplay || (m_replayRandSeed = a1->m_replayRandSeed) == 0 ) { cocos2d::gettimeofday((cocos2d *)&v73, nullptr); m_replayRandSeed = HIDWORD(v73) * (int)v73; } a1->m_randomSeed = m_replayRandSeed; qword_1406C2E90 = 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; m_endPortal->m_flippedX = 0; a1->m_endPortal->m_startPosHeightRelated = 0; v11 = ((float (__fastcall *)(EndPortalObject *))a1->m_endPortal->setScaleX)(a1->m_endPortal); m_endXPosition = a1->m_endXPosition; a1->m_levelLength = m_endXPosition; v13 = a1->m_endPortal->GJBaseGameLayer::__vftable; cocos2d::CCPoint::CCPoint(v11, m_endXPosition); ((void (__fastcall *)(EndPortalObject *, __int64))v13->setStartPos)(a1->m_endPortal, v14); v15 = a1->m_endPortal; GJBaseGameLayer::removeObjectFromSection(a1, v15); a1->addToSection(a1, v15); LOBYTE(v16) = 1; a1->m_endPortal->deactivateObject(a1->m_endPortal, v16); } a1->m_endLayerStars = 0; *(_QWORD *)&a1->m_orbs = 0; a1->m_secretKey = 0; a1->m_hasJumped = 0; sub_14003CCE0((void **)&a1->m_recordString, byte_140518980, 0); a1->m_unk3900 = 0.0; a1->m_activeGravityEffects = 0; LOBYTE(v17) = 1; a1->m_uiLayer->m_pauseBtn->setEnabled(a1->m_uiLayer->m_pauseBtn, v17); 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; a1->m_currentTime = 0.0; a1->m_pauseDelta = 0.0; a1->toggleGlitter(a1, 0); for ( j = 0; j < cocos2d::CCArray::count(a1->m_objects); ++j ) { v20 = (GameObject *)cocos2d::CCArray::objectAtIndex(a1->m_objects, j); ((void (__fastcall *)(GameObject *, FMODAudioEngine **))v20->getRealPosition)(v20, &v73); v20->resetObject(v20); m_outerSectionIndex = v20->m_outerSectionIndex; if ( m_outerSectionIndex >= 0 ) { m_positionX = v20->m_positionX; if ( m_positionX > 0.0 ) { m_sectionXFactor = a1->m_sectionXFactor; v23 = m_positionX < 10000000.0 ? m_sectionXFactor * m_positionX : (float)(m_sectionXFactor * 10000000.0); } else { v23 = 0.0; } v25 = (int)v23; m_positionY = v20->m_positionY; if ( m_positionY > 0.0 ) { m_sectionYFactor = a1->m_sectionYFactor; v27 = m_positionY < 10000000.0 ? m_sectionYFactor * m_positionY : (float)(m_sectionYFactor * 10000000.0); } else { v27 = 0.0; } if ( v25 != m_outerSectionIndex || (int)v27 != v20->m_middleSectionIndex ) { GJBaseGameLayer::removeObjectFromSection(a1, v20); a1->addToSection(a1, v20); v30 = v20->m_outerSectionIndex; if ( v30 > a1->m_rightSectionIndex || v30 < a1->m_leftSectionIndex || (m_middleSectionIndex = v20->m_middleSectionIndex, m_middleSectionIndex > a1->m_topSectionIndex) || m_middleSectionIndex < a1->m_bottomSectionIndex ) { LOBYTE(v29) = 1; v20->deactivateObject(v20, v29); } } } v32 = (float *)((__int64 (__fastcall *)(GameObject *, char *))v20->getRealPosition)(v20, v77); if ( *(float *)&v73 == *v32 ) { v34 = ((__int64 (__fastcall *)(GameObject *, cocos2d::CCPoint *))v20->getRealPosition)(v20, &v76); if ( *((float *)&v73 + 1) == *(float *)(v34 + 4) ) continue; } v20->m_isDirty = 1; LOBYTE(v33) = 1; v20->setObjectRectDirty(v20, v33); LOBYTE(v35) = 1; v20->setOrientedRectDirty(v20, v35); } m_audioEffectsLayer = a1->m_audioEffectsLayer; m_unk1c0 = m_audioEffectsLayer->m_unk1c0; if ( m_unk1c0 ) { cocos2d::CCArray::removeAllObjects(m_unk1c0); cocos2d::CCObject::release(m_audioEffectsLayer->m_unk1c0); m_audioEffectsLayer->m_unk1c0 = nullptr; } v38 = cocos2d::CCArray::createWithArray(m_audioEffectsLayer->m_unk1bc); m_audioEffectsLayer->m_unk1c0 = v38; cocos2d::CCObject::retain(v38); m_audioEffectsLayer->m_timeElapsed = 0.0; PlayLayer::loadDefaultColors(a1); if ( cocos2d::CCArray::count(a1->m_checkpointArray) ) { Object = (CheckpointObject *)cocos2d::CCArray::lastObject(a1->m_checkpointArray); PlayLayer::loadFromCheckpoint(a1, Object); } else { Object = nullptr; } if ( !a1->m_useReplay ) { GJEffectManager::getPersistentStateString(&a1->m_effectManager->GJBaseGameLayer::__vftable, Src); if ( &a1->m_persistentStateString != (std::string *)Src ) { v40 = Src; if ( Src[3] > (void *)0xF ) v40 = (void **)Src[0]; sub_14003CCE0((void **)&a1->m_persistentStateString, v40, (size_t)Src[2]); } sub_14003A830((__int64)Src); } m_effectManager = a1->m_effectManager; sub_14005E0D0(&m_effectManager->m_unk3f0._Traitsobj._Mypair._Myval2._Myval2); sub_14005E0D0(&m_effectManager->m_unk430._Traitsobj._Mypair._Myval2._Myval2); if ( Object ) { a1->m_unk3251 = 0; if ( !a1->m_useReplay ) GJBaseGameLayer::resetRecord(a1, a1->m_gameState.m_unkUint4, v42); } else { a1->m_timePlayed = 0.0; *(_QWORD *)&a1->m_tickIndex = 0; GJBaseGameLayer::resetRecord(a1, 0, v42); a1->m_unk32e0 = a1->m_randomSeed; m_startPosObject = a1->m_startPosObject; if ( m_startPosObject ) { m_currentCheckpoint = a1->m_currentCheckpoint; if ( m_currentCheckpoint ) PlayLayer::loadFromCheckpoint(a1, m_currentCheckpoint); else GJBaseGameLayer::setupLevelStart(a1, m_startPosObject->m_startSettings); } else { GJBaseGameLayer::setupLevelStart(a1, a1->m_levelSettings); } } a1->m_player1->getPosition_0(a1->m_player1); cocos2d::CCPoint::CCPoint(&v76); cocos2d::CCPoint::operator=(&a1->m_player1->m_position, v45); m_player2 = a1->m_player2; v47 = m_player2->GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable; if ( a1->m_gameState.m_isDualMode ) ((void (*)(void))v47->getPosition_0)(); else v47->setPosition_0(m_player2, &stru_1406C2470); cocos2d::CCPoint::CCPoint(&v76); cocos2d::CCPoint::operator=(&a1->m_player2->m_position, v48); if ( !Object ) { v49 = a1->m_player1->getPosition_0(a1->m_player1); cocos2d::CCPoint::operator=(&a1->m_player1->m_lastPosition, v49); v50 = a1->m_player2->getPosition_0(a1->m_player2); cocos2d::CCPoint::operator=(&a1->m_player2->m_lastPosition, v50); if ( a1->m_startPosObject ) { if ( !a1->m_currentCheckpoint ) GJBaseGameLayer::loadStartPosObject(a1); } } GJBaseGameLayer::updatePlayerCollisionBlocks(a1); if ( !a1->m_unk322a ) { PlayerObject::playSpawnEffect(a1->m_player1); if ( a1->m_gameState.m_isDualMode ) PlayerObject::playSpawnEffect(a1->m_player2); } a1->m_gameState.m_cameraShakeEnabled = 0; a1->m_gameState.m_cameraShakeFactor = 0.0; if ( a1->m_startPosObject ) { if ( !Object ) goto LABEL_97; } else if ( !Object ) { a1->m_startingFromBeginning = 1; GJBaseGameLayer::checkSpawnObjects(a1); goto LABEL_97; } m_respawnID = (unsigned int)Object->m_respawnID; if ( (int)m_respawnID > 0 ) { *(_OWORD *)Block = 0; v75 = 0.0; v72 = Block; v1 = 0.0; ((void (__fastcall *)(TriggerEffectDelegate *, __int64, _QWORD))a1->spawnGroup)( &a1->TriggerEffectDelegate, m_respawnID, 0); v52 = Block[0]; if ( Block[0] ) { if ( (unsigned __int64)(4 * ((__int64)(*(_QWORD *)&v75 - (unsigned __int64)Block[0]) >> 2)) >= 0x1000 ) { v52 = *((void **)Block[0] - 1); if ( (unsigned __int64)((char *)Block[0] - (char *)v52 - 8) > 0x1F ) invalid_parameter_noinfo_noreturn(); } j_j_free(v52); } } GJBaseGameLayer::gameEventTriggered(a1, CheckpointRespawn, 0, 0); LABEL_97: GJBaseGameLayer::updateProximityVolumeEffects(a1); GJBaseGameLayer::updateLevelColors(a1); GJBaseGameLayer::updateCamera(a1, 0.0); ((void (__fastcall *)(PlayLayer *))a1->updateVisibility)(a1); GJBaseGameLayer::updateGradientLayers(a1); GJBaseGameLayer::updateShaderLayer(a1, 0.0); PlayLayer::updateAttempts(a1); if ( !Object ) { a1->m_savedAttempts = a1->m_attempts; if ( &a1->m_savedPersistentStateString != &a1->m_persistentStateString ) { p_m_persistentStateString = &a1->m_persistentStateString; if ( a1->m_persistentStateString.m_data.m_capacity > 0xF ) p_m_persistentStateString = (std::string *)a1->m_persistentStateString.m_data.m_bigStorage; sub_14003CCE0( (void **)&a1->m_savedPersistentStateString, p_m_persistentStateString, a1->m_persistentStateString.m_data.m_size); } } v54 = (GameStatsManager *)qword_1406C2EE8; if ( !qword_1406C2EE8 ) { v76 = (cocos2d::CCPoint)operator new(0x3E0u); qword_1406C2EE8 = sub_1401D0AE0(*(_QWORD *)&v76); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8); v54 = (GameStatsManager *)qword_1406C2EE8; } GameStatsManager::incrementStat(v54, (const char *)&word_140531EA0, 1); m_level = a1->m_level; v56 = m_level->m_attempts.random - m_level->m_attempts.seed + 1; m_level->m_attempts.value = v56; v57 = (float)((float)rand() / 32767.0) * 1000.0; m_level->m_attempts.seed = (int)v57; m_level->m_attempts.random = v56 + (int)v57; PlayLayer::updateProgressbar(a1); GJBaseGameLayer::refreshCounterLabels(a1); m_started = a1->m_started; if ( a1->m_isPlatformer ) { a1->m_started = 0; } else if ( m_started && !Object && !a1->m_startPosObject ) { PlayLayer::startMusic(a1); } v59 = qword_1406C2ED8; if ( !qword_1406C2ED8 ) { v76 = (cocos2d::CCPoint)operator new(0x668u); qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v76); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8); v59 = qword_1406C2ED8; } if ( *(_BYTE *)(v59 + 915) && !a1->m_isPracticeMode && !a1->m_isTestMode ) { cocos2d::CCNode::stopActionByTag(a1, 31); a1->m_recordingStopped = 0; } GJBaseGameLayer::removeReleasedButtons(a1); m_uiLayer = a1->m_uiLayer; v61 = m_uiLayer->m_p1TouchId != -1 || m_uiLayer->m_p1Jumping || m_uiLayer->m_p2TouchId != -1 || m_uiLayer->m_p2Jumping; *(void **)((char *)Block + 6) = nullptr; HIWORD(Block[1]) = 0; LODWORD(Block[0]) = 1; v75 = 0.0; Mylast = a1->m_queuedButtons._Mypair._Myval2._Mylast; *(void **)((char *)Block + 4) = (void *)v61; if ( Mylast == a1->m_queuedButtons._Mypair._Myval2._Myend ) { sub_140253010(&a1->m_queuedButtons._Mypair._Myval2._Myfirst, Mylast, (__int64)Block); } else { *(_OWORD *)&Mylast->m_button = *(_OWORD *)Block; Mylast->m_timestamp = v75; ++a1->m_queuedButtons._Mypair._Myval2._Mylast; } if ( !a1->m_isPracticeMode && !a1->m_isIgnoreDamageEnabled ) a1->m_damageVerified = 0; a1->m_freezeStartCamera = 0; a1->m_skipArtReload = 0; GJBaseGameLayer::syncBGTextures(a1); dword_1406C10C0 = clock(); m_batchNodes = a1->m_batchNodes; if ( m_batchNodes ) { data = m_batchNodes->data; num = data->num; if ( (_DWORD)num ) { arr = (cocos2d::CCNode **)data->arr; for ( k = &arr[num - 1]; arr <= k; ++arr ) { if ( !*arr ) break; cocos2d::CCNode::qsortAllChildrenWithIndex(*arr); } } } GJBaseGameLayer::sortSectionVector(a1); if ( a1->m_isPlatformer && (m_started || a1->m_platformerRestart) ) { a1->m_platformerRestart = 0; if ( !Object ) { v68 = cocos2d::CCCallFunc::create(a1, PlayLayer::startGameDelayed); v69 = cocos2d::CCDelayTime::create(0.2); v70 = cocos2d::CCSequence::create(v69, v68, 0); cocos2d::CCNode::runAction((CCLightFlash *)a1, (cocos2d::CCPoint)v70, v71, v1, *(float *)&v72); 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 ( !Object ) return; } cocos2d::CCPoint::operator=(&a1->m_gameState.m_cameraPosition2, &Object->m_gameState.m_cameraPosition2); cocos2d::CCPoint::operator=(&a1->m_gameState.m_cameraStepDiff, &Object->m_gameState.m_cameraStepDiff); cocos2d::CCPoint::operator=(&a1->m_gameState.m_unkPoint4, &Object->m_gameState.m_unkPoint4); }
GD Web Decomp Icon

GD Web Decomp

Raw Source