//
// GJBaseGameLayer::collisionCheckObjects from 0x88b734 to 0x88c758 (4132 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::checkCollisions @ 0x894e58
// > GJBaseGameLayer::checkCollisions @ 0x895214
// > ??> @ 0x4f218
//
// 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::collisionCheckObjects(
GJBaseGameLayer *a1,
PlayerObject *a2,
std::vector *a3,
int a4,
float a5)
{
cocos2d::CCRect *v9; // x25
float v10; // s0
float v11; // s8
float v12; // s0
float v13; // s9
float v14; // s0
float v15; // s10
float v16; // s0
float v17; // s11
__int64 v18; // x19
GameObject *v19; // x0
GameObjectType m_objectType; // w1
int m_hazardCollisionObjectsIndex; // w3
int m_hazardCollisionObjectsCount; // w1
GameObject **v23; // x2
int m_solidCollisionObjectsIndex; // w3
int m_solidCollisionObjectsCount; // w1
GameObject **m_finish; // x2
const cocos2d::CCRect *v27; // x0
GameObject *v28; // x0
const cocos2d::CCRect *v29; // x0
float v30; // s0
float v31; // s0
float v32; // s0
float v33; // s0
const cocos2d::CCRect *v34; // x0
const cocos2d::CCRect *v35; // x0
float v36; // s0
float v37; // s0
float v38; // s0
float v39; // s0
bool v40; // w3
GameObject *v41; // x0
const cocos2d::CCPoint *v42; // x0
float v43; // s0
float v44; // s1
GameObject *v45; // x0
bool m_isUpsideDown; // w2
bool v47; // w2
bool v48; // w3
GameObject *v49; // x2
GJBaseGameLayer *v50; // x0
PlayerObject *v51; // x1
int v52; // w4
GameObject *v53; // x0
const cocos2d::CCPoint *v54; // x0
float v55; // s0
float v56; // s1
GameObject *v57; // x1
const cocos2d::CCPoint *v58; // x0
float v59; // s0
float v60; // s1
GameObject *v61; // x1
GameObject *v62; // x0
const cocos2d::CCPoint *v63; // x0
float v64; // s0
float v65; // s1
GameObject *v66; // x2
const cocos2d::CCPoint *v67; // x0
float v68; // s0
float v69; // s1
GameObject *v70; // x2
const cocos2d::CCPoint *v71; // x0
float v72; // s0
float v73; // s1
GameObject *v74; // x2
const cocos2d::CCPoint *v75; // x0
float v76; // s0
float v77; // s1
GameObject *v78; // x2
const cocos2d::CCPoint *v79; // x0
float v80; // s0
float v81; // s1
bool v82; // w3
GameObject *v83; // x0
const cocos2d::CCPoint *v84; // x0
float v85; // s0
float v86; // s1
GameObject *v87; // x0
bool v88; // w3
bool canBeActivatedByPlayer; // w3
GameObject *v90; // x0
const cocos2d::CCPoint *v91; // x0
float v92; // s0
float v93; // s1
GameObject *v94; // x0
bool m_isHide; // w3
OBB2D *v96; // [xsp+98h] [xbp+98h]
OBB2D *v97; // [xsp+A0h] [xbp+A0h]
bool v98; // [xsp+A0h] [xbp+A0h]
bool v99; // [xsp+A0h] [xbp+A0h]
bool v100; // [xsp+A0h] [xbp+A0h]
bool v101; // [xsp+A0h] [xbp+A0h]
bool v102; // [xsp+A0h] [xbp+A0h]
bool v103; // [xsp+A0h] [xbp+A0h]
GameObject *v105; // [xsp+B8h] [xbp+B8h] BYREF
cocos2d::CCRect v106; // [xsp+C0h] [xbp+C0h] BYREF
std::vector p; // [xsp+D0h] [xbp+D0h] BYREF
v9 = (cocos2d::CCRect *)a2->getObjectRect(a2);
cocos2d::CCRect::getMaxX(v9);
v11 = v10;
cocos2d::CCRect::getMinX(v9);
v13 = v12;
cocos2d::CCRect::getMaxY(v9);
v15 = v14;
cocos2d::CCRect::getMinY(v9);
v17 = v16;
if ( a4 > 0 )
{
v18 = 0;
while ( 1 )
{
v19 = a3->m_start[v18];
v105 = v19;
m_objectType = v19->m_objectType;
if ( m_objectType == Decoration || v19->m_isGroupDisabled || v19->m_isDisabled )
goto LABEL_4;
switch ( m_objectType )
{
case Solid:
case Breakable:
m_solidCollisionObjectsIndex = a1->m_solidCollisionObjectsIndex;
m_solidCollisionObjectsCount = a1->m_solidCollisionObjectsCount;
if ( m_solidCollisionObjectsIndex > m_solidCollisionObjectsCount )
{
a1->m_solidCollisionObjects.m_start[m_solidCollisionObjectsCount] = v19;
}
else
{
m_finish = a1->m_solidCollisionObjects.m_finish;
if ( m_finish == a1->m_solidCollisionObjects.m_reserveEnd )
{
std::vector::_M_emplace_back_aux(
(__int64)&a1->m_solidCollisionObjects,
&v105);
m_solidCollisionObjectsIndex = a1->m_solidCollisionObjectsIndex;
m_solidCollisionObjectsCount = a1->m_solidCollisionObjectsCount;
}
else
{
if ( m_finish )
{
*m_finish = v19;
m_finish = a1->m_solidCollisionObjects.m_finish;
}
a1->m_solidCollisionObjects.m_finish = m_finish + 1;
}
a1->m_solidCollisionObjectsIndex = m_solidCollisionObjectsIndex + 1;
}
a1->m_solidCollisionObjectsCount = m_solidCollisionObjectsCount + 1;
goto LABEL_4;
case Hazard:
case AnimatedHazard:
m_hazardCollisionObjectsIndex = a1->m_hazardCollisionObjectsIndex;
m_hazardCollisionObjectsCount = a1->m_hazardCollisionObjectsCount;
if ( m_hazardCollisionObjectsIndex > m_hazardCollisionObjectsCount )
{
a1->m_hazardCollisionObjects.m_start[m_hazardCollisionObjectsCount] = v19;
}
else
{
v23 = a1->m_hazardCollisionObjects.m_finish;
if ( v23 == a1->m_hazardCollisionObjects.m_reserveEnd )
{
std::vector::_M_emplace_back_aux(
(__int64)&a1->m_hazardCollisionObjects,
&v105);
m_hazardCollisionObjectsIndex = a1->m_hazardCollisionObjectsIndex;
m_hazardCollisionObjectsCount = a1->m_hazardCollisionObjectsCount;
}
else
{
if ( v23 )
{
*v23 = v19;
v23 = a1->m_hazardCollisionObjects.m_finish;
}
a1->m_hazardCollisionObjects.m_finish = v23 + 1;
}
a1->m_hazardCollisionObjectsIndex = m_hazardCollisionObjectsIndex + 1;
}
a1->m_hazardCollisionObjectsCount = m_hazardCollisionObjectsCount + 1;
goto LABEL_4;
case CollisionObject:
goto LABEL_4;
default:
if ( v19->hasBeenActivatedByPlayer(v19, a2) )
goto LABEL_4;
cocos2d::CCRect::CCRect(&v106);
if ( v105->getType(v105) == Slope )
{
v105->getObjectRect_0(v105, 2.0, 2.0);
cocos2d::CCRect::operator=(&v106, &p);
}
else
{
v27 = v105->getObjectRect(v105);
cocos2d::CCRect::operator=(&v106, v27);
}
if ( v105->m_objectRadius <= 0.0 )
{
cocos2d::CCRect::getMinX(&v106);
if ( v30 > v11 )
goto LABEL_4;
cocos2d::CCRect::getMaxX(&v106);
if ( v31 < v13 )
goto LABEL_4;
cocos2d::CCRect::getMinY(&v106);
if ( v32 > v15 )
goto LABEL_4;
cocos2d::CCRect::getMaxY(&v106);
if ( v33 < v17 )
goto LABEL_4;
}
else if ( !GJBaseGameLayer::playerCircleCollision(a1, a2, v105) )
{
goto LABEL_4;
}
v28 = v105;
if ( v105->m_shouldUseOuterOb && (!a1->m_levelSettings->m_fixRadiusCollision || v105->m_objectRadius <= 0.0) )
{
v97 = v105->getOrientedBox(v105);
a2->updateOrientedBox(a2);
v96 = a2->getOrientedBox(a2);
if ( !OBB2D::overlaps1Way(v97) || !OBB2D::overlaps1Way(v96) )
{
if ( v105->getType(v105) == Slope )
{
v29 = v105->getObjectRect(v105);
cocos2d::CCRect::operator=(&v106, v29);
}
goto LABEL_4;
}
v28 = v105;
}
if ( v28->getType(v28) == Slope )
{
v34 = v105->getObjectRect(v105);
cocos2d::CCRect::operator=(&v106, v34);
}
if ( GJBaseGameLayer::canTouchObject(a1, v105) )
{
switch ( v105->m_objectType )
{
case InverseGravityPortal:
canBeActivatedByPlayer = GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v105);
if ( canBeActivatedByPlayer )
{
if ( a2->m_isUpsideDown )
{
v90 = v105;
}
else
{
v90 = v105;
if ( !v105->m_hasNoEffects )
{
v103 = canBeActivatedByPlayer;
a1->playGravityEffect(a1, 1);
v90 = v105;
canBeActivatedByPlayer = v103;
}
}
v102 = canBeActivatedByPlayer;
v91 = v90->getPosition(v90);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&p, v91);
cocos2d::CCPoint::operator=(&a2->m_lastPortalPos, v92, v93);
v94 = v105;
a2->m_lastActivatedPortal = v105;
m_isHide = v102;
if ( !v94->m_hasNoEffects )
m_isHide = v94->m_isHide;
GJBaseGameLayer::flipGravity(a1, a2, 1, m_isHide);
GameObject::playShineEffect(v105);
v105->activatedByPlayer(v105, a2);
GJBaseGameLayer::gameEventTriggered(a1, PortalGravityFlip, 0, 0);
}
break;
case NormalGravityPortal:
v82 = GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v105);
if ( v82 )
{
if ( a2->m_isUpsideDown )
{
v83 = v105;
if ( !v105->m_hasNoEffects )
{
v101 = v82;
a1->playGravityEffect(a1, 0);
v83 = v105;
v82 = v101;
}
}
else
{
v83 = v105;
}
v100 = v82;
v84 = v83->getPosition(v83);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&p, v84);
cocos2d::CCPoint::operator=(&a2->m_lastPortalPos, v85, v86);
v87 = v105;
a2->m_lastActivatedPortal = v105;
v88 = v100;
if ( !v87->m_hasNoEffects )
v88 = v87->m_isHide;
GJBaseGameLayer::flipGravity(a1, a2, 0, v88);
GameObject::playShineEffect(v105);
v105->activatedByPlayer(v105, a2);
GJBaseGameLayer::gameEventTriggered(a1, PortalGravityNormal, 0, 0);
}
break;
case ShipPortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v105) )
{
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v105);
v50 = a1;
v51 = a2;
v49 = v105;
v52 = 5;
goto LABEL_62;
}
break;
case CubePortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v105) )
{
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v105);
v79 = v105->getPosition(v105);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&p, v79);
cocos2d::CCPoint::operator=(&a2->m_lastPortalPos, v80, v81);
a2->m_lastActivatedPortal = v105;
PlayerObject::switchedToMode(a2, CubePortal);
PlayerObject::modeDidChange(a2);
goto LABEL_63;
}
break;
case YellowJumpPad:
case PinkJumpPad:
case RedJumpPad:
case CustomRing|YellowJumpPad:
GJBaseGameLayer::bumpPlayer(a1, a2, (EffectGameObject *)v105);
break;
case YellowJumpPad|Hazard:
GJBaseGameLayer::gravBumpPlayer(a1, a2, (EffectGameObject *)v105);
break;
case YellowJumpRing:
case PinkJumpRing:
case GravityRing:
case GreenRing:
case DropRing:
case RedJumpRing:
case CustomRing:
case DashRing:
case GravityDashRing:
case GravityTogglePortal|0x1:
GJBaseGameLayer::playerTouchedRing(a1, a2, (RingObject *)v105);
break;
case InverseMirrorPortal:
if ( !a1->m_isEditor && GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v105) )
{
v75 = v105->getPosition(v105);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&p, v75);
cocos2d::CCPoint::operator=(&a2->m_lastPortalPos, v76, v77);
v78 = v105;
a2->m_lastActivatedPortal = v105;
GJBaseGameLayer::toggleFlipped(a1, 1, v78->m_hasNoEffects);
GameObject::playShineEffect(v105);
v105->triggerActivated(v105, 0.0);
GJBaseGameLayer::gameEventTriggered(a1, PortalFlip, 0, 0);
}
break;
case NormalMirrorPortal:
if ( !a1->m_isEditor && GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v105) )
{
v71 = v105->getPosition(v105);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&p, v71);
cocos2d::CCPoint::operator=(&a2->m_lastPortalPos, v72, v73);
v74 = v105;
a2->m_lastActivatedPortal = v105;
GJBaseGameLayer::toggleFlipped(a1, 0, v74->m_hasNoEffects);
GameObject::playShineEffect(v105);
v105->triggerActivated(v105, 0.0);
GJBaseGameLayer::gameEventTriggered(a1, PortalUnFlip, 0, 0);
}
break;
case BallPortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v105) )
{
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v105);
GJBaseGameLayer::switchToRollMode(a1, a2, v105, 0);
goto LABEL_63;
}
break;
case RegularSizePortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v105) )
{
v67 = v105->getPosition(v105);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&p, v67);
cocos2d::CCPoint::operator=(&a2->m_lastPortalPos, v68, v69);
v70 = v105;
a2->m_lastActivatedPortal = v105;
PlayerObject::togglePlayerScale(a2, 0, v70->m_hasNoEffects);
GameObject::playShineEffect(v105);
v105->activatedByPlayer(v105, a2);
GJBaseGameLayer::gameEventTriggered(a1, PortalNormalScale, 0, 0);
}
break;
case MiniSizePortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v105) )
{
v63 = v105->getPosition(v105);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&p, v63);
cocos2d::CCPoint::operator=(&a2->m_lastPortalPos, v64, v65);
v66 = v105;
a2->m_lastActivatedPortal = v105;
PlayerObject::togglePlayerScale(a2, 1, v66->m_hasNoEffects);
GameObject::playShineEffect(v105);
v105->activatedByPlayer(v105, a2);
GJBaseGameLayer::gameEventTriggered(a1, PortalMiniScale, 0, 0);
}
break;
case UfoPortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v105) )
{
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v105);
v50 = a1;
v51 = a2;
v49 = v105;
v52 = 19;
goto LABEL_62;
}
break;
case Modifier:
case EnterEffectObject:
GJBaseGameLayer::playerTouchedTrigger(a1, a2, (EffectGameObject *)v105);
break;
case SecretCoin:
if ( !a1->m_isPracticeMode )
{
v105->triggerObject(v105, a1, a2->m_uniqueID, nullptr);
v105->triggerActivated(v105, 0.0);
GJBaseGameLayer::destroyObject(a1, v105);
if ( !GJBaseGameLayer::hasUniqueCoin(a1, (EffectGameObject *)v105) )
GJBaseGameLayer::pickupItem(a1, (EffectGameObject *)v105);
GJBaseGameLayer::gameEventTriggered(a1, UserCoin, 0, 0);
}
break;
case DualPortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v105) )
{
v58 = v105->getPosition(v105);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&p, v58);
cocos2d::CCPoint::operator=(&a2->m_lastPortalPos, v59, v60);
v61 = v105;
a2->m_lastActivatedPortal = v105;
a1->m_player2->m_isBeingSpawnedByDualPortal = 1;
GJBaseGameLayer::toggleDualMode(a1, v61, 1, a2, 0);
v62 = v105;
a1->m_player2->m_isBeingSpawnedByDualPortal = 0;
GameObject::playShineEffect(v62);
v105->triggerActivated(v105, 0.0);
GJBaseGameLayer::gameEventTriggered(a1, PortalDualOn, 0, 0);
}
break;
case SoloPortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v105) )
{
v54 = v105->getPosition(v105);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&p, v54);
cocos2d::CCPoint::operator=(&a2->m_lastPortalPos, v55, v56);
v57 = v105;
a2->m_lastActivatedPortal = v105;
GJBaseGameLayer::toggleDualMode(a1, v57, 0, a2, 0);
GameObject::playShineEffect(v105);
v105->triggerActivated(v105, 0.0);
GJBaseGameLayer::gameEventTriggered(a1, PortalDualOff, 0, 0);
}
break;
case Slope:
PlayerObject::collidedWithSlope(a2, a5, v105, 0);
goto LABEL_52;
case WavePortal:
if ( a1->m_isPlatformer || !GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v105) )
break;
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v105);
v50 = a1;
v51 = a2;
v49 = v105;
v52 = 26;
goto LABEL_62;
case RobotPortal:
if ( !GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v105) )
break;
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v105);
GJBaseGameLayer::switchToRobotMode(a1, a2, v105, 0);
goto LABEL_63;
case TeleportPortal:
if ( !GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v105) )
break;
GJBaseGameLayer::gameEventTriggered(a1, PortalTeleport, 0, 0);
GJBaseGameLayer::teleportPlayer(a1, (TeleportPortalObject *)v105, a2);
LABEL_52:
v35 = a2->getObjectRect(a2);
cocos2d::CCRect::operator=(v9, v35);
cocos2d::CCRect::getMaxX(v9);
v11 = v36;
cocos2d::CCRect::getMinX(v9);
v13 = v37;
cocos2d::CCRect::getMaxY(v9);
v15 = v38;
cocos2d::CCRect::getMinY(v9);
v17 = v39;
break;
case Collectible:
if ( !GJEffectManager::hasBeenTriggered(a1->m_effectManager, v105->m_uniqueID, 0) )
{
GJEffectManager::storeTriggeredID(a1->m_effectManager, v105->m_uniqueID, 0);
v53 = v105;
if ( v105->m_objectID == 1268 )
{
memset(&p, 0, sizeof(p));
SpawnTriggerGameObject::updateRemapKeys((SpawnTriggerGameObject *)v105, &p);
if ( p.m_start )
operator delete(p.m_start);
v53 = v105;
}
v53->triggerObject(v53, a1, a2->m_uniqueID, nullptr);
GJBaseGameLayer::gameEventTriggered(a1, PickupItem, 0, 0);
}
goto LABEL_69;
case Collectible|0x1:
if ( a1->m_isPracticeMode )
break;
if ( !GJEffectManager::hasBeenTriggered(a1->m_effectManager, v105->m_uniqueID, 0) )
{
GJEffectManager::storeTriggeredID(a1->m_effectManager, v105->m_uniqueID, 0);
v105->triggerObject(v105, a1, a2->m_uniqueID, nullptr);
if ( !GJBaseGameLayer::hasUniqueCoin(a1, (EffectGameObject *)v105) )
GJBaseGameLayer::pickupItem(a1, (EffectGameObject *)v105);
GJBaseGameLayer::gameEventTriggered(a1, UserCoin, 0, 0);
}
LABEL_69:
v105->triggerActivated(v105, 0.0);
GJBaseGameLayer::destroyObject(a1, v105);
break;
case SpiderPortal:
if ( !GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v105) )
break;
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v105);
GJBaseGameLayer::switchToSpiderMode(a1, a2, v105, 0);
goto LABEL_63;
case DropRing|YellowJumpPad:
PlayerObject::touchedObject(a2, v105);
break;
case SwingPortal:
if ( a1->m_isPlatformer || !GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v105) )
break;
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v105);
v49 = v105;
v50 = a1;
v51 = a2;
v52 = 41;
LABEL_62:
GJBaseGameLayer::switchToFlyMode(v50, v51, v49, 0, v52);
LABEL_63:
GameObject::playShineEffect(v105);
v105->activatedByPlayer(v105, a2);
break;
case GravityTogglePortal:
v40 = GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v105);
if ( v40 )
{
v41 = v105;
if ( !v105->m_hasNoEffects )
{
v98 = v40;
a1->playGravityEffect(a1, !a2->m_isUpsideDown);
v41 = v105;
v40 = v98;
}
v99 = v40;
v42 = v41->getPosition(v41);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&p, v42);
cocos2d::CCPoint::operator=(&a2->m_lastPortalPos, v43, v44);
v45 = v105;
m_isUpsideDown = a2->m_isUpsideDown;
a2->m_lastActivatedPortal = v105;
v47 = !m_isUpsideDown;
v48 = v99;
if ( !v45->m_hasNoEffects )
v48 = v45->m_isHide;
GJBaseGameLayer::flipGravity(a1, a2, v47, v48);
GameObject::playShineEffect(v105);
v105->activatedByPlayer(v105, a2);
GJBaseGameLayer::gameEventTriggered(a1, PortalGravityInvert, 0, 0);
}
break;
case GravityTogglePortal|NormalGravityPortal:
GJBaseGameLayer::playerTouchedRing(a1, a2, (RingObject *)v105);
goto LABEL_52;
default:
break;
}
}
LABEL_4:
if ( ++v18 == (unsigned int)(a4 - 1) + 1LL )
return;
break;
}
}
}
}