// // GJBaseGameLayer::checkCollisions from 0x894970 to 0x8958e4 (3956 bytes) // // 3 xrefs: // > GJBaseGameLayer::update @ 0x89e0a8 // > GJBaseGameLayer::update @ 0x89e40c // > @ 0x6ad40 // // 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 // int GJBaseGameLayer::checkCollisions(GJBaseGameLayer *a1, PlayerObject *a2, float a3, bool a4) { cocos2d::CCPoint v8; // x1 unsigned int m_wasTeleported; // w22 float m_vehicleSize; // s0 float m_unkAngle1; // s10 float v12; // s11 unsigned int m_isDualMode; // w21 float v14; // s10 _BOOL4 m_isOutOfBounds; // w20 _BOOL4 m_isPlatformer; // w0 int v17; // w19 _BOOL4 m_jumpBuffered; // w21 float MaxPortalY; // s9 long double v21; // q0 float v22; // s12 float v23; // s9 int v24; // w23 double v25; // d10 _BOOL4 v26; // w22 void (__fastcall *v27)(PlayerObject *__hidden, const cocos2d::CCPoint *); // x26 const cocos2d::CCPoint *v28; // x0 float YVelocity; // s10 double v30; // d9 PlayerObject_vtbl *v31; // x1 float v32; // s0 float v33; // s0 int v34; // w19 int v35; // w20 unsigned __int64 v36; // x23 int v37; // w22 int v38; // w0 std::vector *, std::allocator *>> **m_start; // x0 std::vector *, std::allocator *>> **m_finish; // x1 __int64 v41; // x21 unsigned __int64 v42; // x2 int v43; // w21 int v44; // w2 __int64 v45; // x21 std::vector *, std::allocator *>> *v46; // x19 __int64 v47; // x26 unsigned __int64 v48; // x0 int v49; // w26 bool v50; // cc int v51; // w0 unsigned __int64 v52; // x20 GJBaseGameLayer *v53; // x27 __int64 v54; // x24 __int64 v55; // x23 int v56; // w22 char **v57; // x25 unsigned __int64 v58; // x28 __int64 *v59; // x8 __int64 v60; // x3 int v61; // w26 __int64 v62; // x19 __int64 *v63; // x20 __int64 *v64; // x0 std::uintptr_t *m_bitptr; // x0 char *v66; // x2 __int64 v67; // x0 const cocos2d::CCPoint *(__fastcall *getPosition)(cocos2d::CCNode *__hidden); // x2 void (__fastcall *setPosition)(PlayerObject *__hidden, const cocos2d::CCPoint *); // x24 __int64 v70; // x0 void (__fastcall *v71)(PlayerObject *__hidden, const cocos2d::CCPoint *); // x21 const cocos2d::CCPoint *v72; // x0 void (__fastcall *v73)(PlayerObject *__hidden, const cocos2d::CCPoint *); // x24 const cocos2d::CCPoint *v74; // x0 int m_calcNonEffectObjectsSize; // w3 _BOOL4 m_isCollidingWithSlope; // w20 int v77; // w23 cocos2d::CCRect *v78; // x19 float v79; // s0 float v80; // s9 float v81; // s0 float v82; // s10 float v83; // s0 float v84; // s12 int m_solidCollisionObjectsCount; // w0 float v86; // s0 float v87; // s11 GameObject *v88; // x21 cocos2d::CCRect *ObjectRectPointer; // x24 float v90; // s0 float v91; // s0 float v92; // s0 float v93; // s0 const cocos2d::CCRect *v94; // x0 float v95; // s0 float v96; // s0 float v97; // s0 float v98; // s0 PlayerObject *m_player1; // x0 __int64 v100; // x20 int v101; // w21 const cocos2d::CCRect *v102; // x0 float v103; // s0 float v104; // s9 float v105; // s0 float v106; // s12 float v107; // s0 float v108; // s11 float v109; // s0 float v110; // s10 GameObject *v111; // x19 cocos2d::CCRect *v112; // x0 cocos2d::CCRect *v113; // x23 OBB2D *v114; // x23 OBB2D *v115; // x24 float v116; // s0 float v117; // s0 float v118; // s0 float v119; // s0 float v120; // s9 int v121; // w22 PlayerObject *v122; // x0 const cocos2d::CCPoint *(__fastcall *v123)(cocos2d::CCNode *__hidden); // x2 void (__fastcall *v124)(PlayerObject *__hidden, const cocos2d::CCPoint *); // x24 float x; // s0 PlayerObject *v126; // x26 void (__fastcall *v127)(PlayerObject *__hidden, const cocos2d::CCPoint *); // x24 float v128; // s0 float v129; // s1 bool canStickToGround; // w0 float *v131; // [xsp+98h] [xbp+98h] _BOOL4 v132; // [xsp+C0h] [xbp+C0h] int v133; // [xsp+C4h] [xbp+C4h] int v134; // [xsp+C8h] [xbp+C8h] int v135; // [xsp+C8h] [xbp+C8h] int v136; // [xsp+CCh] [xbp+CCh] __int64 v137; // [xsp+D0h] [xbp+D0h] unsigned __int64 v138; // [xsp+D8h] [xbp+D8h] char *v139; // [xsp+E0h] [xbp+E0h] __int64 v140; // [xsp+E8h] [xbp+E8h] long double v141; // [xsp+F0h] [xbp+F0h] __int64 v142; // [xsp+F0h] [xbp+F0h] int v143; // [xsp+100h] [xbp+100h] int v144; // [xsp+104h] [xbp+104h] cocos2d::CCPoint v146[2]; // [xsp+110h] [xbp+110h] BYREF v132 = a4; v8 = (cocos2d::CCPoint)_stack_chk_guard; m_wasTeleported = a2->m_wasTeleported; a2->m_wasTeleported = 0; v146[1] = v8; PlayerObject::preCollision(a2); m_vehicleSize = a2->m_vehicleSize; m_unkAngle1 = a2->m_unkAngle1; v12 = 0.0; if ( m_vehicleSize != 1.0 ) v12 = (float)(m_unkAngle1 * (float)(1.0 - m_vehicleSize)) * 0.5; m_isDualMode = 0; v14 = m_unkAngle1 * 0.5; if ( !a1->m_gameState.m_isFreeMode ) { m_isDualMode = 1; if ( !PlayerObject::isFlying(a2) && !a2->m_isBall && !a2->m_isSpider ) m_isDualMode = a1->m_gameState.m_isDualMode; } v131 = &a1->m_varianceValues.__elems_[1975]; m_isOutOfBounds = a2->m_isOutOfBounds; m_isPlatformer = a1->m_isPlatformer; a2->m_isOutOfBounds = 0; if ( m_isPlatformer ) { if ( a2->getPosition(a2)->x < -30.0 ) { v17 = 0; getPosition = a2->getPosition; setPosition = a2->setPosition; a2->m_platformerXVelocity = 0.0; v70 = (__int64)getPosition(a2); cocos2d::CCPoint::CCPoint(v146, -30.0, *(float *)(v70 + 4)); setPosition(a2, v146); goto LABEL_7; } } else if ( a2->m_isGoingLeft ) { v17 = a2->getPosition(a2)->x < -30.0; goto LABEL_7; } v17 = 0; LABEL_7: if ( (float)((float)(v14 + 90.0) - v12) > a2->getPosition(a2)->y && (!m_isDualMode || !PlayerObject::isFlying(a2) && !a2->m_isBall && !a1->m_gameState.m_isDualMode && !a2->m_isSpider) ) { if ( a2->m_isUpsideDown ) { v17 = 1; if ( PlayerObject::isSafeFlip(a2, 0.1) ) { v71 = a2->setPosition; v72 = a2->getPosition(a2); cocos2d::CCPoint::CCPoint(v146, v72->x, (float)(v14 + 90.0) - v12); v71(a2, v146); PlayerObject::hitGround(a2, nullptr, 1); PlayerObject::updateCollide(a2, (PlayerCollisionDirection)0, nullptr); a2->m_isOnGround2 = 0; return 0; } } else if ( !a2->m_maybeIsBoosted ) { v73 = a2->setPosition; v74 = a2->getPosition(a2); cocos2d::CCPoint::CCPoint(v146, v74->x, (float)(v14 + 90.0) - v12); v73(a2, v146); PlayerObject::hitGround(a2, nullptr, 0); PlayerObject::updateCollide(a2, (PlayerCollisionDirection)1, nullptr); if ( m_isDualMode <= m_wasTeleported ) goto LABEL_12; goto LABEL_24; } if ( m_isDualMode <= m_wasTeleported ) goto LABEL_12; goto LABEL_24; } if ( a2->getPosition(a2)->y > (float)(v12 + a1->m_maxGameplayY) ) v17 = 1; if ( m_isDualMode <= m_wasTeleported ) goto LABEL_12; LABEL_24: m_jumpBuffered = 0; MaxPortalY = GJBaseGameLayer::getMaxPortalY(a1); *(float *)&v21 = GJBaseGameLayer::getMinPortalY(a1); v22 = MaxPortalY - a1->m_gameState.m_unkUint17; if ( a2->m_isShip ) m_jumpBuffered = a2->m_jumpBuffered; v141 = v21; v23 = (float)(MaxPortalY - v14) + v12; if ( v23 >= a2->getPosition(a2)->y ) { v120 = (float)(v14 + *(float *)&v141) - v12; if ( v120 > a2->getPosition(a2)->y ) { if ( !a2->m_wasOnSlope || a2->getPosition(a2)->y >= (float)(v120 - v14) ) { if ( PlayerObject::destroyFromHitHead(a2) && a2->m_isUpsideDown ) { if ( !PlayerObject::isSafeHeadTest(a2) ) { LABEL_94: LOBYTE(v17) = 1; goto LABEL_13; } YVelocity = PlayerObject::getYVelocity(a2); if ( a2->m_isUpsideDown ) { v121 = 0; v122 = a2; v123 = a2->getPosition; v124 = a2->setPosition; } else { canStickToGround = PlayerObject::canStickToGround(a2); v123 = a2->getPosition; v124 = a2->setPosition; v121 = canStickToGround && v22 != 0.0; v122 = a2; } x = v123(v122)->x; cocos2d::CCPoint::CCPoint(v146, x, v120 + 0.0); v124(a2, v146); PlayerObject::pushDown(a2); } else { v121 = 0; YVelocity = PlayerObject::getYVelocity(a2); if ( !a2->m_isUpsideDown ) v121 = PlayerObject::canStickToGround(a2) && v22 != 0.0; if ( PlayerObject::canStickToGround(a2) || a1->m_gameState.m_cameraZoom == a1->m_gameState.m_targetCameraZoom ) { v126 = a2; v127 = a2->setPosition; v128 = a2->getPosition(a2)->x; v129 = 0.0; } else { v126 = a2; v127 = a2->setPosition; v128 = a2->getPosition(a2)->x; v129 = 1.0; } cocos2d::CCPoint::CCPoint(v146, v128, v120 + v129); v127(v126, v146); if ( !a2->m_isShip && !a2->m_isSwing || PlayerObject::getYVelocity(a2) < 0.0 ) PlayerObject::hitGround(a2, nullptr, a2->m_isUpsideDown); } PlayerObject::updateCollide(a2, (PlayerCollisionDirection)!a2->m_isUpsideDown, nullptr); if ( !v121 || (v30 = YVelocity, YVelocity >= PlayerObject::getYVelocity(a2)) ) { if ( v22 >= 0.0 || !a2->m_isUpsideDown ) { LABEL_40: a2->m_wasOnSlope = 0; if ( !v17 ) goto LABEL_43; goto LABEL_13; } goto LABEL_37; } LABEL_39: PlayerObject::setYVelocity(a2, v30, 0); goto LABEL_40; } LOBYTE(v17) = 1; goto LABEL_13; } LABEL_12: if ( !v17 ) goto LABEL_43; goto LABEL_13; } if ( a2->m_wasOnSlope && *(float *)(((__int64 (__fastcall *)(PlayerObject *, long double))a2->getPosition)(a2, v141) + 4) > (float)(v14 + v23) ) { goto LABEL_94; } if ( !PlayerObject::destroyFromHitHead(a2) || a2->m_isUpsideDown ) { v24 = 0; goto LABEL_31; } v24 = 1; if ( PlayerObject::isSafeHeadTest(a2) ) { LABEL_31: v25 = PlayerObject::getYVelocity(a2); v26 = a2->m_isUpsideDown && PlayerObject::canStickToGround(a2) && v22 != 0.0; v27 = a2->setPosition; v28 = a2->getPosition(a2); cocos2d::CCPoint::CCPoint(v146, v28->x, v23); v27(a2, v146); if ( v24 ) { PlayerObject::pushDown(a2); } else if ( PlayerObject::getYVelocity(a2) > 0.0 ) { PlayerObject::hitGround(a2, nullptr, !a2->m_isUpsideDown); } YVelocity = v25; PlayerObject::updateCollide(a2, (PlayerCollisionDirection)a2->m_isUpsideDown, nullptr); if ( !v26 || (v30 = YVelocity, YVelocity <= PlayerObject::getYVelocity(a2)) ) { if ( v22 <= 0.0 || a2->m_isUpsideDown ) goto LABEL_40; LABEL_37: if ( !m_jumpBuffered ) goto LABEL_40; v30 = YVelocity; goto LABEL_39; } goto LABEL_39; } LOBYTE(v17) = 1; LABEL_13: if ( m_isOutOfBounds ) { if ( !v132 ) a1->destroyPlayer(a1, a2, nullptr); return 1; } LABEL_43: v31 = a2->GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable; a2->m_isOutOfBounds = v17; v32 = v31->getPosition(a2)->x; if ( v32 > 0.0 ) { v33 = *(float *)((__int64 (__fastcall *)(PlayerObject *, float))a2->getPosition)(a2, v32); if ( v33 < 10000000.0 ) v34 = (int)(float)(*(float *)((__int64 (__fastcall *)(PlayerObject *, float))a2->getPosition)(a2, v33) * a1->m_sectionXFactor); else v34 = (int)(float)(a1->m_sectionXFactor * 10000000.0); v35 = v34 + 1; v36 = v34 + 1; if ( a2->getPosition(a2)->y <= 0.0 ) { v38 = 1; v37 = 0; v36 = v35; LABEL_50: v133 = v38; if ( v34 <= 1 ) { v134 = v35; v143 = 0; } else { v143 = v34 - 1; v134 = v35; } goto LABEL_52; } LABEL_47: if ( a2->getPosition(a2)->y < 10000000.0 ) v37 = (int)(float)(a2->getPosition(a2)->y * a1->m_sectionYFactor); else v37 = (int)(float)(a1->m_sectionYFactor * 10000000.0); v38 = v37 + 1; goto LABEL_50; } v36 = 1; if ( *(float *)(((__int64 (__fastcall *)(PlayerObject *, float))a2->getPosition)(a2, v32) + 4) > 0.0 ) { v34 = 0; v35 = 1; goto LABEL_47; } v134 = 1; v133 = 1; v37 = 0; v143 = 0; LABEL_52: m_start = a1->m_nonEffectObjects.m_start; m_finish = a1->m_nonEffectObjects.m_finish; v41 = m_finish - m_start; v42 = v41 - 1; v43 = v41 - 1; if ( v42 >= v36 ) v44 = v134; else v44 = v43; v135 = v44; if ( v37 <= 1 ) v136 = 0; else v136 = v37 - 1; a1->m_solidCollisionObjectsCount = 0; a1->m_hazardCollisionObjectsCount = 0; if ( m_start != m_finish && v143 <= v44 ) { v45 = v143; while ( 1 ) { v46 = m_start[v45]; if ( v46 ) { v47 = v46->m_finish - v46->m_start; v48 = v47 - 1; v49 = v47 - 1; v50 = v133 > v48; v51 = v133; if ( v50 ) v51 = v49; v144 = v51; if ( v136 <= v51 ) { v52 = v136; v53 = a1; v54 = v136; v55 = v136; v56 = v136; while ( 1 ) { v57 = (char **)v46->m_start[v55]; if ( v57 ) { v58 = v52 >> 6; v140 = v52 >> 6; v59 = (__int64 *)&v53->m_nonEffectObjectsFlags.m_start[v45]->m_start.m_bitptr[v140]; v142 = 1LL << (v52 & 0x3F); v60 = *v59; v61 = v53->m_nonEffectObjectsSizes.m_start[v45]->m_start[v54]; if ( (*v59 & v142) != 0 ) { v62 = 8LL * v61; v139 = &(*v57)[v62]; if ( *v57 != v139 ) { v137 = (__int64)*v57; std::__introsort_loop<__gnu_cxx::__normal_iterator>,long,__gnu_cxx::__ops::_Iter_comp_iter>( *v57, v139, 2 * (63 - __clz(v62 >> 3)), (__int64 (__fastcall *)(__int64, __int64))mIDCompSort); if ( v62 <= 135 ) { std::__insertion_sort<__gnu_cxx::__normal_iterator>,__gnu_cxx::__ops::_Iter_comp_iter>( v137, (__int64 *)v139, (__int64 (__fastcall *)(__int64 *, __int64 *))mIDCompSort); } else { std::__insertion_sort<__gnu_cxx::__normal_iterator>,__gnu_cxx::__ops::_Iter_comp_iter>( v137, (__int64 *)(v137 + 128), (__int64 (__fastcall *)(__int64 *, __int64 *))mIDCompSort); if ( v139 != (char *)(v137 + 128) ) { v138 = v52; v63 = (__int64 *)(v137 + 128); do { v64 = v63++; std::__unguarded_linear_insert<__gnu_cxx::__normal_iterator>,__gnu_cxx::__ops::_Val_comp_iter>( v64, (__int64 (__fastcall *)(__int64 *, __int64 *))mIDCompSort); } while ( v139 != (char *)v63 ); v52 = v138; } } m_bitptr = v53->m_nonEffectObjectsFlags.m_start[v45]->m_start.m_bitptr; v59 = (__int64 *)&m_bitptr[v140]; v60 = m_bitptr[v58]; } if ( v61 > 0 ) { v66 = *v57; v67 = 0; do { *(_DWORD *)(*(_QWORD *)&v66[8 * v67] + 624LL) = v67; ++v67; } while ( v61 > (int)v67 ); } *v59 = v60 & ~v142; } GJBaseGameLayer::collisionCheckObjects(v53, a2, (std::vector *)v57, v61, a3); } ++v56; ++v55; ++v54; ++v52; if ( v144 < v56 ) break; v46 = v53->m_nonEffectObjects.m_start[v45]; } a1 = v53; } } ++v45; if ( v135 < ++v143 ) break; m_start = a1->m_nonEffectObjects.m_start; } } m_calcNonEffectObjectsSize = a1->m_calcNonEffectObjectsSize; if ( m_calcNonEffectObjectsSize > 0 ) GJBaseGameLayer::collisionCheckObjects( a1, a2, (std::vector *)(v131 + 370), m_calcNonEffectObjectsSize, a3); if ( a2->m_lastGroundObject ) m_isCollidingWithSlope = a2->m_isCollidingWithSlope; else m_isCollidingWithSlope = 0; v77 = 0; v78 = (cocos2d::CCRect *)a2->getObjectRect(a2); cocos2d::CCRect::getMaxX(v78); v80 = v79; cocos2d::CCRect::getMinX(v78); v82 = v81; cocos2d::CCRect::getMaxY(v78); v84 = v83; cocos2d::CCRect::getMinY(v78); m_solidCollisionObjectsCount = a1->m_solidCollisionObjectsCount; v87 = v86; if ( m_solidCollisionObjectsCount > 0 ) { do { while ( 1 ) { v88 = a1->m_solidCollisionObjects.m_start[m_solidCollisionObjectsCount - 1 - v77]; if ( !GameObject::getGroupDisabled(v88) ) { ObjectRectPointer = GameObject::getObjectRectPointer(v88); if ( m_isCollidingWithSlope && v88->m_groupCount > 0 ) m_isCollidingWithSlope = !PlayerObject::testForMoving(a2, a3, v88); cocos2d::CCRect::getMinX(ObjectRectPointer); if ( v90 <= v80 ) { cocos2d::CCRect::getMaxX(ObjectRectPointer); if ( v91 >= v82 ) { cocos2d::CCRect::getMinY(ObjectRectPointer); if ( v92 <= v84 ) { cocos2d::CCRect::getMaxY(ObjectRectPointer); if ( v87 <= v93 ) break; } } } } m_solidCollisionObjectsCount = a1->m_solidCollisionObjectsCount; if ( m_solidCollisionObjectsCount <= ++v77 ) goto LABEL_115; } ++v77; PlayerObject::collidedWithObject(a2, a3, v88); v94 = a2->getObjectRect(a2); cocos2d::CCRect::operator=(v78, v94); cocos2d::CCRect::getMaxX(v78); v80 = v95; cocos2d::CCRect::getMinX(v78); v82 = v96; cocos2d::CCRect::getMaxY(v78); v84 = v97; cocos2d::CCRect::getMinY(v78); m_solidCollisionObjectsCount = a1->m_solidCollisionObjectsCount; v87 = v98; } while ( m_solidCollisionObjectsCount > v77 ); } LABEL_115: m_player1 = a1->m_player1; if ( m_player1->m_isDead ) PlayerObject::removePlacedCheckpoint(m_player1); v100 = 0; v101 = 0; v102 = a2->getObjectRect(a2); cocos2d::CCRect::operator=(v78, v102); cocos2d::CCRect::getMaxX(v78); v104 = v103; cocos2d::CCRect::getMinX(v78); v106 = v105; cocos2d::CCRect::getMaxY(v78); v108 = v107; cocos2d::CCRect::getMinY(v78); v110 = v109; a2->updateOrientedBox(a2); if ( a1->m_hazardCollisionObjectsCount > 0 ) { do { v111 = a1->m_hazardCollisionObjects.m_start[v100]; if ( !GameObject::getGroupDisabled(v111) ) { v112 = GameObject::getObjectRectPointer(v111); v113 = v112; if ( v111->m_objectRadius <= 0.0 ) { cocos2d::CCRect::getMinX(v112); if ( v104 < v116 ) goto LABEL_119; cocos2d::CCRect::getMaxX(v113); if ( v106 > v117 ) goto LABEL_119; cocos2d::CCRect::getMinY(v113); if ( v108 < v118 ) goto LABEL_119; cocos2d::CCRect::getMaxY(v113); if ( v110 > v119 ) goto LABEL_119; } else if ( !GJBaseGameLayer::playerCircleCollision(a1, a2, v111) ) { goto LABEL_119; } if ( !v111->m_shouldUseOuterOb || a1->m_levelSettings->m_fixRadiusCollision && v111->m_objectRadius > 0.0 || (v114 = v111->getOrientedBox(v111), v115 = a2->getOrientedBox(a2), OBB2D::overlaps1Way(v114)) && OBB2D::overlaps1Way(v115) ) { if ( !v132 ) { a1->destroyPlayer(a1, a2, v111); return 1; } return 1; } } LABEL_119: ++v101; ++v100; } while ( a1->m_hazardCollisionObjectsCount > v101 ); } PlayerObject::postCollision(a2, a3, *((_BYTE *)v131 + 1912)); return 0; }
GD Web Decomp Icon

GD Web Decomp

Raw Source