// // GJBaseGameLayer::toggleDualMode from 0x1402168d0 to 0x140216e79 (1449 bytes) // // 9 xrefs: // > GJBaseGameLayer::setupLevelStart @ 0x140212296 // > GJBaseGameLayer::collisionCheckObjects @ 0x14021580d // > GJBaseGameLayer::collisionCheckObjects @ 0x1402158a5 // > GJBaseGameLayer::resetLevelVariables @ 0x14023baba // > LevelEditorLayer::onStopPlaytest @ 0x1402e093b // > PlayLayer::loadFromCheckpoint @ 0x1403b78c5 // > @ 0x14067f41c // > @ 0x14067f474 // > @ 0x1406cd140 // // 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 GJBaseGameLayer::toggleDualMode(GJBaseGameLayer *a1, GameObject *a2, bool a3, PlayerObject *a4, bool a5) { GameObject *v6; // rbp bool v8; // al UILayer *m_uiLayer; // rcx bool m_inPlatformer; // dl PlayerObject **p_m_player2; // rsi _BOOL8 v12; // rdx cocos2d::CCNode *v13; // rax PlayerObject *v14; // rsi bool m_unkBool31; // bl PlayerObject *m_player1; // r15 __int64 v17; // rdx bool m_isUpsideDown; // dl int v19; // r8d double m_yVelocity; // xmm1_8 PlayerObject *m_player2; // rbx bool v22; // zf PlayerObject *v23; // rcx PlayerObject *v24; // r8 bool *p_m_isEditor; // rbx PlayerObject **v26; // r15 PlayerObject *v27; // rdx int *p_m_uniqueID; // rcx PlayerObject **v29; // r12 bool *v30; // r13 PlayerObject *v31; // r13 unsigned int v32; // esi cocos2d::CCParticleSystem *v33; // rbx PlayerObject *v34; // rsi float v35; // xmm1_4 PlayerObject *v36; // rcx float v37; // xmm0_4 float v38; // xmm0_4 float v39; // xmm1_4 float v40; // xmm1_4 PlayerObject *v41; // rax int v42; // r8d PlayerObject *v43; // rcx PlayerObject *v44; // rcx PlayerObject *v45; // rbx PlayerObject_vtbl *v46; // rdi float v47; // [rsp+20h] [rbp-38h] int v48; // [rsp+70h] [rbp+18h] BYREF v6 = a2; if ( a1->m_gameState.m_isDualMode == a3 ) return; a1->m_gameState.m_isDualMode = a3; v8 = a3 && a1->m_levelSettings->m_twoPlayerMode; m_uiLayer = a1->m_uiLayer; if ( m_uiLayer->m_dualMode != v8 ) { m_inPlatformer = m_uiLayer->m_inPlatformer; m_uiLayer->m_dualMode = v8; UILayer::togglePlatformerMode(m_uiLayer, m_inPlatformer); } p_m_player2 = &a1->m_player2; a1->m_player1->m_unkA99 = a1->m_gameState.m_isDualMode; a1->m_player2->m_unkA99 = a1->m_gameState.m_isDualMode; if ( a1->m_gameState.m_isDualMode ) { (*p_m_player2)->resetObject(*p_m_player2); if ( !(*p_m_player2)->getParent(*p_m_player2) ) { v13 = a1->m_player1->getParent(a1->m_player1); v13->addChild_0(v13, *p_m_player2, 59); if ( !a1->m_isEditor ) PlayerObject::addAllParticles(*p_m_player2); } v14 = *p_m_player2; LOBYTE(v12) = 1; m_unkBool31 = a1->m_gameState.m_unkBool31; m_player1 = a1->m_player1; v14->setVisible(v14, v12); LOBYTE(v17) = -1; v14->setOpacity(&v14->cocos2d::CCRGBAProtocol, v17); PlayerObject::copyAttributes(v14); m_isUpsideDown = m_player1->m_isUpsideDown; if ( m_unkBool31 ) { PlayerObject::flipGravity(v14, m_isUpsideDown, 1); m_yVelocity = m_player1->m_yVelocity; } else { PlayerObject::flipGravity(v14, !m_isUpsideDown, 1); m_yVelocity = -m_player1->m_yVelocity; } PlayerObject::setYVelocity(v14, m_yVelocity, v19); v14->m_isOnGround = 0; v14->m_isOnGround2 = 0; PlayerObject::toggleVisibility(v14, !m_player1->m_isHidden); if ( v14->m_isDart ) PlayerObject::placeStreakPoint(v14); if ( a1->m_levelSettings->m_twoPlayerMode ) { m_player2 = a1->m_player2; if ( !m_player2->m_inputsLocked ) { v48 = 1; *(_BYTE *)sub_1400CDBF0((__int64 *)&m_player2->m_holdingButtons, &v48) = 0; } if ( !m_player2->m_controlsDisabled ) { if ( m_player2->m_jumpBuffered ) PlayerObject::placeStreakPoint(m_player2); v22 = !m_player2->m_isDashing; *(_WORD *)&m_player2->m_jumpBuffered = 0; m_player2->m_touchedPad = 1; if ( !v22 ) PlayerObject::stopDashing(m_player2); } } if ( !a1->m_isEditor && !a5 ) { PlayerObject::spawnDualCircle(a1->m_player1); PlayerObject::spawnDualCircle(a1->m_player2); } if ( v6 ) a1->m_gameState.m_lastActivatedPortal2 = v6; GJBaseGameLayer::playerWillSwitchMode(a1, a4, v6); return; } v23 = a1->m_player1; v24 = v23; if ( v23->m_isDart ) { if ( a4 ) { if ( a4->m_uniqueID == v23->m_uniqueID ) goto LABEL_36; p_m_player2 = &a1->m_player2; } PlayerObject::createFadeOutDartStreak(v23); v24 = a1->m_player1; } LABEL_36: p_m_isEditor = &a1->m_isEditor; v26 = p_m_player2; if ( a1->m_isEditor ) { p_m_uniqueID = &a4->m_uniqueID; v30 = &a1->m_isEditor; v29 = p_m_player2; if ( a4 ) { LABEL_42: a2 = *p_m_player2; v26 = v29; p_m_isEditor = v30; if ( *p_m_uniqueID == (*p_m_player2)->m_uniqueID ) PlayerObject::copyAttributes(v24); } } else if ( a4 ) { v27 = *p_m_player2; if ( a4->m_uniqueID == (*p_m_player2)->m_uniqueID ) v27 = v24; GJBaseGameLayer::playExitDualEffect(a1, v27); v24 = a1->m_player1; p_m_uniqueID = &a4->m_uniqueID; v29 = &a1->m_player2; v30 = &a1->m_isEditor; goto LABEL_42; } LOBYTE(a2) = 1; ((void (__fastcall *)(PlayerObject *, GameObject *, PlayerObject *))(*v26)->removeFromParentAndCleanup)(*v26, a2, v24); (*v26)->setOpacity(&(*v26)->cocos2d::CCRGBAProtocol, 0); PlayerObject::releaseAllButtons(*v26); v31 = *v26; v32 = 0; if ( cocos2d::CCArray::count((*v26)->m_particleSystems) ) { do { v33 = (cocos2d::CCParticleSystem *)cocos2d::CCArray::objectAtIndex(v31->m_particleSystems, v32); cocos2d::CCParticleSystem::resetSystem(v33); cocos2d::CCParticleSystem::stopSystem(v33); v33->removeFromParentAndCleanup(v33, 0); ++v32; } while ( v32 < cocos2d::CCArray::count(v31->m_particleSystems) ); v26 = &a1->m_player2; p_m_isEditor = &a1->m_isEditor; } v34 = *v26; cocos2d::CCMotionStreak::stopStroke((*v26)->m_regularTrail); if ( v34->m_fadeOutStreak ) { v22 = !v34->m_playEffects; v34->m_fadeOutStreak = 0; if ( v22 ) v35 = 0.60000002; else v35 = 0.2; PlayerObject::fadeOutStreak2(v34, v35); } if ( !*p_m_isEditor ) { v36 = a1->m_player1; LOWORD(v48) = -256; BYTE2(v48) = 100; PlayerObject::spawnPortalCircle(v36, (cocos2d::ccColor3B *)&v48, 50.0); } a1->m_gameState.m_lastActivatedPortal2 = nullptr; if ( v6 ) { if ( v6->m_classType == Effect ) { a1->m_gameState.m_isFreeMode = v6[1].m_sBlendFunc.src; a1->m_gameState.m_unkBool9 = (bool)v6[1].m_pobTexture; if ( BYTE1(v6[1].m_sBlendFunc.src) ) { v37 = *(float *)&v6[1].m_sBlendFunc.dst; a1->m_gameState.m_unkFloat3 = v37; v38 = fmaxf(v37, 1.0); v39 = *((float *)&v6[1].m_sBlendFunc + 2); if ( v38 >= 40.0 ) v38 = 40.0; a1->m_gameState.m_unkFloat3 = v38; v40 = fmaxf(v39, 0.0); if ( v40 >= 1.0 ) v40 = 1.0; a1->m_gameState.m_unkFloat2 = v40; } } } v41 = a1->m_player1; v42 = 6; if ( v41->m_isShip || v41->m_isBird || v41->m_isDart || v41->m_isSwing ) { v42 = 5; } else if ( v41->m_isBall ) { v42 = 16; } else if ( v41->m_isSpider ) { v42 = 33; } GJBaseGameLayer::updateDualGround(a1, a4, v42, 0, v47); v43 = a1->m_player1; if ( v43->m_isDart && (!a4 || a4->m_uniqueID != v43->m_uniqueID) ) { PlayerObject::resetStreak(v43); PlayerObject::placeStreakPoint(a1->m_player1); v44 = a1->m_player2; if ( v44->m_isDart ) { v45 = a1->m_player1; v46 = v45->GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable; v44->getRotation(v44); ((void (__fastcall *)(PlayerObject *))v46->setRotation)(v45); } } }
GD Web Decomp Icon

GD Web Decomp

Raw Source