//
// GJBaseGameLayer::collisionCheckObjects from 0x4922f4 to 0x492d24 (2608 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::checkCollisions @ 0x493860
// > GJBaseGameLayer::checkCollisions @ 0x493952
//
// 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)
{
int v7; // r9
int *p_m_solidCollisionObjectsIndex; // r8
cocos2d::CCRect *v9; // r6
float v10; // s16
float v11; // s17
float v12; // s18
int *p_m_solidCollisionObjectsCount; // r7
float v14; // s19
GameObject *v15; // r3
unsigned int m_objectType; // r2
bool v17; // zf
std::vector *p_m_hazardCollisionObjects; // r0
int m_hazardCollisionObjectsCount; // r1
std::vector *p_m_solidCollisionObjects; // r0
GameObjectType v21; // r0
GameObject_vtbl *v22; // r3
std::vector *v23; // r1
int v24; // r11
OBB2D *v25; // r10
OBB2D *v26; // r11
_BOOL4 v27; // r0
const cocos2d::CCRect *v28; // r0
_BOOL4 canBeActivatedByPlayer; // r0
bool m_isHide; // r10
const cocos2d::CCPoint *v31; // r0
int v32; // r2
bool v33; // r3
GameObject *v34; // r3
_BOOL4 m_hasNoEffects; // r2
GJBaseGameLayer *v36; // r0
GJGameEvent v37; // r1
_BOOL4 v38; // r0
bool v39; // r10
const cocos2d::CCPoint *v40; // r0
int v41; // r2
bool v42; // r3
GameObject *v43; // r3
_BOOL4 v44; // r2
int v45; // r2
_BOOL4 v46; // r0
bool v47; // r10
const cocos2d::CCPoint *v48; // r0
int v49; // r2
bool v50; // r3
GameObject *v51; // r3
_BOOL4 v52; // r1
bool v53; // r2
const cocos2d::CCPoint *v54; // r0
int v55; // r2
bool v56; // r3
int v57; // r3
bool m_isPlatformer; // r10
const cocos2d::CCPoint *v59; // r0
int v60; // r2
bool v61; // r3
bool v62; // r2
const cocos2d::CCPoint *v63; // r0
int v64; // r2
bool v65; // r3
bool v66; // r2
_BOOL4 m_isEditor; // r10
const cocos2d::CCPoint *v68; // r0
int v69; // r2
bool v70; // r3
GameObject *v71; // r1
const cocos2d::CCPoint *v72; // r0
int v73; // r2
bool v74; // r3
GameObject *v75; // r1
GameObject *v76; // r0
GJBaseGameLayer *v77; // r0
GJGameEvent v78; // r1
const cocos2d::CCRect *v79; // r0
int v80; // r3
const cocos2d::CCPoint *v81; // r0
int v82; // r2
bool v83; // r3
bool v84; // r2
const cocos2d::CCPoint *v85; // r0
int v86; // r2
bool v87; // r3
bool v88; // r2
GameObject *v91; // [sp+18h] [bp-2Ch] BYREF
cocos2d::CCRect v92; // [sp+1Ch] [bp-28h] BYREF
std::vector v93; // [sp+2Ch] [bp-18h] BYREF
v7 = 0;
p_m_solidCollisionObjectsIndex = &a1->m_solidCollisionObjectsIndex;
v9 = (cocos2d::CCRect *)a2->getObjectRect(a2);
v10 = COERCE_FLOAT(cocos2d::CCRect::getMaxX(v9));
v11 = COERCE_FLOAT(cocos2d::CCRect::getMinX(v9));
v12 = COERCE_FLOAT(cocos2d::CCRect::getMaxY(v9));
p_m_solidCollisionObjectsCount = &a1->m_solidCollisionObjectsCount;
v14 = COERCE_FLOAT(cocos2d::CCRect::getMinY(v9));
while ( v7 < a4 )
{
v15 = a3->m_start[v7];
m_objectType = v15->m_objectType;
v91 = v15;
if ( m_objectType == 7 || v15->m_isGroupDisabled || v15->m_isDisabled )
goto LABEL_125;
if ( m_objectType == 21 )
{
LABEL_18:
p_m_solidCollisionObjects = &a1->m_solidCollisionObjects;
if ( *p_m_solidCollisionObjectsIndex > *p_m_solidCollisionObjectsCount )
{
p_m_solidCollisionObjects->m_start[*p_m_solidCollisionObjectsCount] = v15;
}
else
{
std::vector::push_back((int)p_m_solidCollisionObjects, &v91);
++*p_m_solidCollisionObjectsIndex;
}
++*p_m_solidCollisionObjectsCount;
goto LABEL_125;
}
if ( m_objectType > 0x15 )
{
if ( m_objectType == 39 )
goto LABEL_125;
v17 = m_objectType == 47;
}
else
{
if ( !m_objectType )
goto LABEL_18;
v17 = m_objectType == 2;
}
if ( v17 )
{
p_m_hazardCollisionObjects = &a1->m_hazardCollisionObjects;
m_hazardCollisionObjectsCount = a1->m_hazardCollisionObjectsCount;
if ( a1->m_hazardCollisionObjectsIndex > m_hazardCollisionObjectsCount )
{
p_m_hazardCollisionObjects->m_start[m_hazardCollisionObjectsCount] = v15;
}
else
{
std::vector::push_back((int)p_m_hazardCollisionObjects, &v91);
++a1->m_hazardCollisionObjectsIndex;
}
++a1->m_hazardCollisionObjectsCount;
}
else
{
if ( ((int (__fastcall *)(GameObject *, PlayerObject *))v15->hasBeenActivatedByPlayer)(v15, a2) )
goto LABEL_125;
cocos2d::CCRect::CCRect(&v92);
v21 = v91->getType(v91);
v22 = v91->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v21 == Slope )
{
((void (__fastcall *)(std::vector *, GameObject *, int, int))v22->getObjectRect_0)(
&v93,
v91,
0x40000000,
0x40000000);
v23 = &v93;
}
else
{
v23 = (std::vector *)v22->getObjectRect(v91);
}
cocos2d::CCRect::operator=(&v92, v23);
if ( v91->m_objectRadius <= 0.0 )
{
if ( v10 < COERCE_FLOAT(cocos2d::CCRect::getMinX(&v92))
|| COERCE_FLOAT(cocos2d::CCRect::getMaxX(&v92)) < v11
|| v12 < COERCE_FLOAT(cocos2d::CCRect::getMinY(&v92))
|| COERCE_FLOAT(cocos2d::CCRect::getMaxY(&v92)) < v14 )
{
goto LABEL_125;
}
}
else if ( !GJBaseGameLayer::playerCircleCollision(a1, a2, v91) )
{
goto LABEL_125;
}
if ( v91->m_shouldUseOuterOb && (!a1->m_levelSettings->m_fixRadiusCollision || v91->m_objectRadius <= 0.0) )
{
v25 = (OBB2D *)((int (*)(void))v91->getOrientedBox)();
a2->updateOrientedBox(a2);
v26 = a2->getOrientedBox(a2);
v27 = OBB2D::overlaps1Way(v25);
if ( v27 )
v27 = OBB2D::overlaps1Way(v26);
v24 = v27;
}
else
{
v24 = 1;
}
if ( v91->getType(v91) == Slope )
{
v28 = v91->getObjectRect(v91);
cocos2d::CCRect::operator=(&v92, v28);
}
if ( v24 && GJBaseGameLayer::canTouchObject(a1, v91) )
{
switch ( v91->m_objectType )
{
case InverseGravityPortal:
canBeActivatedByPlayer = GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v91);
m_isHide = canBeActivatedByPlayer;
if ( canBeActivatedByPlayer )
{
if ( !a2->m_isUpsideDown && !v91->m_hasNoEffects )
a1->playGravityEffect(a1, 1);
v31 = v91->getPosition(v91);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, v31);
cocos2d::CCPoint::operator=((PlayerObject *)&a2->m_lastPortalPos, COERCE_FLOAT(&v93), v32, v33);
v34 = v91;
m_hasNoEffects = v91->m_hasNoEffects;
a2->m_lastActivatedPortal = v91;
if ( !m_hasNoEffects )
m_isHide = v34->m_isHide;
GJBaseGameLayer::flipGravity(a1, a2, 1, m_isHide);
GameObject::playShineEffect(v91);
v91->activatedByPlayer(v91, a2);
v36 = a1;
v37 = PortalGravityFlip;
goto LABEL_60;
}
break;
case NormalGravityPortal:
v38 = GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v91);
v39 = v38;
if ( v38 )
{
if ( a2->m_isUpsideDown && !v91->m_hasNoEffects )
((void (__fastcall *)(GJBaseGameLayer *))a1->playGravityEffect)(a1);
v40 = v91->getPosition(v91);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, v40);
cocos2d::CCPoint::operator=((PlayerObject *)&a2->m_lastPortalPos, COERCE_FLOAT(&v93), v41, v42);
v43 = v91;
v44 = v91->m_hasNoEffects;
a2->m_lastActivatedPortal = v91;
if ( !v44 )
v39 = v43->m_isHide;
GJBaseGameLayer::flipGravity(a1, a2, 0, v39);
GameObject::playShineEffect(v91);
v91->activatedByPlayer(v91, a2);
v36 = a1;
v37 = PortalGravityNormal;
goto LABEL_60;
}
break;
case ShipPortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v91) )
{
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v91);
v57 = 5;
goto LABEL_73;
}
break;
case CubePortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v91) )
{
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v91);
v54 = v91->getPosition(v91);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, v54);
cocos2d::CCPoint::operator=((PlayerObject *)&a2->m_lastPortalPos, COERCE_FLOAT(&v93), v55, v56);
a2->m_lastActivatedPortal = v91;
PlayerObject::switchedToMode(a2, CubePortal);
PlayerObject::modeDidChange(a2);
goto LABEL_129;
}
break;
case YellowJumpPad:
case PinkJumpPad:
case RedJumpPad:
case CustomRing|YellowJumpPad:
GJBaseGameLayer::bumpPlayer(a1, a2, (EffectGameObject *)v91);
break;
case YellowJumpPad|Hazard:
GJBaseGameLayer::gravBumpPlayer(a1, a2, (EffectGameObject *)v91);
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 *)v91);
break;
case InverseMirrorPortal:
m_isEditor = a1->m_isEditor;
if ( !a1->m_isEditor && GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v91) )
{
v85 = v91->getPosition(v91);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, v85);
cocos2d::CCPoint::operator=((PlayerObject *)&a2->m_lastPortalPos, COERCE_FLOAT(&v93), v86, v87);
v88 = v91->m_hasNoEffects;
a2->m_lastActivatedPortal = v91;
GJBaseGameLayer::toggleFlipped(a1, 1, v88);
GameObject::playShineEffect(v91);
((void (__fastcall *)(GameObject *, _DWORD))v91->triggerActivated)(v91, 0);
v36 = a1;
v37 = PortalFlip;
goto LABEL_132;
}
break;
case NormalMirrorPortal:
m_isEditor = a1->m_isEditor;
if ( !a1->m_isEditor && GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v91) )
{
v81 = v91->getPosition(v91);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, v81);
cocos2d::CCPoint::operator=((PlayerObject *)&a2->m_lastPortalPos, COERCE_FLOAT(&v93), v82, v83);
v84 = v91->m_hasNoEffects;
a2->m_lastActivatedPortal = v91;
GJBaseGameLayer::toggleFlipped(a1, m_isEditor, v84);
GameObject::playShineEffect(v91);
((void (__fastcall *)(GameObject *, _DWORD))v91->triggerActivated)(v91, 0);
v36 = a1;
v37 = PortalUnFlip;
goto LABEL_132;
}
break;
case BallPortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v91) )
{
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v91);
GJBaseGameLayer::switchToRollMode(a1, a2, v91, 0);
goto LABEL_129;
}
break;
case RegularSizePortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v91) )
{
v59 = v91->getPosition(v91);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, v59);
cocos2d::CCPoint::operator=((PlayerObject *)&a2->m_lastPortalPos, COERCE_FLOAT(&v93), v60, v61);
v62 = v91->m_hasNoEffects;
a2->m_lastActivatedPortal = v91;
PlayerObject::togglePlayerScale(a2, 0, v62);
GameObject::playShineEffect(v91);
v91->activatedByPlayer(v91, a2);
v36 = a1;
v37 = PortalNormalScale;
goto LABEL_60;
}
break;
case MiniSizePortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v91) )
{
v63 = v91->getPosition(v91);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, v63);
cocos2d::CCPoint::operator=((PlayerObject *)&a2->m_lastPortalPos, COERCE_FLOAT(&v93), v64, v65);
v66 = v91->m_hasNoEffects;
a2->m_lastActivatedPortal = v91;
PlayerObject::togglePlayerScale(a2, 1, v66);
GameObject::playShineEffect(v91);
v91->activatedByPlayer(v91, a2);
v36 = a1;
v37 = PortalMiniScale;
goto LABEL_60;
}
break;
case UfoPortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v91) )
{
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v91);
v57 = 19;
LABEL_73:
GJBaseGameLayer::switchToFlyMode(a1, a2, v91, 0, v57);
goto LABEL_129;
}
break;
case Modifier:
case EnterEffectObject:
GJBaseGameLayer::playerTouchedTrigger(a1, a2, (EffectGameObject *)v91);
break;
case SecretCoin:
if ( !a1->m_isPracticeMode )
{
((void (__fastcall *)(GameObject *, GJBaseGameLayer *, int))v91->triggerObject)(v91, a1, a2->m_uniqueID);
((void (__fastcall *)(GameObject *, _DWORD))v91->triggerActivated)(v91, 0);
GJBaseGameLayer::destroyObject(a1, v91);
if ( !GJBaseGameLayer::hasUniqueCoin(a1, (EffectGameObject *)v91) )
GJBaseGameLayer::pickupItem(a1, (EffectGameObject *)v91);
v36 = a1;
v37 = UserCoin;
goto LABEL_60;
}
break;
case DualPortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v91) )
{
v72 = v91->getPosition(v91);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, v72);
m_isEditor = 0;
cocos2d::CCPoint::operator=((PlayerObject *)&a2->m_lastPortalPos, COERCE_FLOAT(&v93), v73, v74);
v75 = v91;
a2->m_lastActivatedPortal = v91;
a1->m_player2->m_isBeingSpawnedByDualPortal = 1;
GJBaseGameLayer::toggleDualMode(a1, v75, 1, a2, 0);
v76 = v91;
a1->m_player2->m_isBeingSpawnedByDualPortal = 0;
GameObject::playShineEffect(v76);
((void (__fastcall *)(GameObject *, _DWORD))v91->triggerActivated)(v91, 0);
v36 = a1;
v37 = PortalDualOn;
goto LABEL_132;
}
break;
case SoloPortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v91) )
{
v68 = v91->getPosition(v91);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, v68);
m_isEditor = 0;
cocos2d::CCPoint::operator=((PlayerObject *)&a2->m_lastPortalPos, COERCE_FLOAT(&v93), v69, v70);
v71 = v91;
a2->m_lastActivatedPortal = v91;
GJBaseGameLayer::toggleDualMode(a1, v71, 0, a2, 0);
GameObject::playShineEffect(v91);
((void (__fastcall *)(GameObject *, _DWORD))v91->triggerActivated)(v91, 0);
v36 = a1;
v37 = PortalDualOff;
LABEL_132:
v45 = m_isEditor;
goto LABEL_133;
}
break;
case Slope:
PlayerObject::collidedWithSlope(a2, a5, v91, 0);
goto LABEL_124;
case WavePortal:
m_isPlatformer = a1->m_isPlatformer;
if ( m_isPlatformer || !GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v91) )
break;
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v91);
v80 = 26;
goto LABEL_128;
case RobotPortal:
if ( !GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v91) )
break;
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v91);
GJBaseGameLayer::switchToRobotMode(a1, a2, v91, 0);
goto LABEL_129;
case TeleportPortal:
if ( !GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v91) )
break;
GJBaseGameLayer::gameEventTriggered(a1, PortalTeleport, 0, 0);
GJBaseGameLayer::teleportPlayer(a1, (TeleportPortalObject *)v91, a2);
LABEL_124:
v79 = a2->getObjectRect(a2);
cocos2d::CCRect::operator=(v9, v79);
v10 = COERCE_FLOAT(cocos2d::CCRect::getMaxX(v9));
v11 = COERCE_FLOAT(cocos2d::CCRect::getMinX(v9));
v12 = COERCE_FLOAT(cocos2d::CCRect::getMaxY(v9));
v14 = COERCE_FLOAT(cocos2d::CCRect::getMinY(v9));
break;
case Collectible:
if ( GJEffectManager::hasBeenTriggered(a1->m_effectManager, v91->m_uniqueID, 0) )
goto LABEL_122;
GJEffectManager::storeTriggeredID(a1->m_effectManager, v91->m_uniqueID, 0);
if ( v91->m_objectID == 1268 )
{
memset(&v93, 0, sizeof(v93));
SpawnTriggerGameObject::updateRemapKeys((SpawnTriggerGameObject *)v91, &v93);
std::_Vector_base::~_Vector_base((void **)&v93.m_start);
}
v91->triggerObject(v91, a1, a2->m_uniqueID, nullptr);
v77 = a1;
v78 = PickupItem;
goto LABEL_121;
case Collectible|0x1:
if ( a1->m_isPracticeMode )
break;
if ( GJEffectManager::hasBeenTriggered(a1->m_effectManager, v91->m_uniqueID, a1->m_isPracticeMode) )
goto LABEL_122;
GJEffectManager::storeTriggeredID(a1->m_effectManager, v91->m_uniqueID, 0);
v91->triggerObject(v91, a1, a2->m_uniqueID, nullptr);
if ( !GJBaseGameLayer::hasUniqueCoin(a1, (EffectGameObject *)v91) )
GJBaseGameLayer::pickupItem(a1, (EffectGameObject *)v91);
v77 = a1;
v78 = UserCoin;
LABEL_121:
GJBaseGameLayer::gameEventTriggered(v77, v78, 0, 0);
LABEL_122:
((void (__fastcall *)(GameObject *, _DWORD))v91->triggerActivated)(v91, 0);
GJBaseGameLayer::destroyObject(a1, v91);
break;
case SpiderPortal:
if ( !GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v91) )
break;
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v91);
GJBaseGameLayer::switchToSpiderMode(a1, a2, v91, 0);
goto LABEL_129;
case DropRing|YellowJumpPad:
PlayerObject::touchedObject(a2, v91);
break;
case SwingPortal:
m_isPlatformer = a1->m_isPlatformer;
if ( m_isPlatformer || !GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v91) )
break;
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v91);
v80 = 41;
LABEL_128:
GJBaseGameLayer::switchToFlyMode(a1, a2, v91, m_isPlatformer, v80);
LABEL_129:
GameObject::playShineEffect(v91);
v91->activatedByPlayer(v91, a2);
break;
case GravityTogglePortal:
v46 = GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, (EffectGameObject *)v91);
v47 = v46;
if ( v46 )
{
if ( !v91->m_hasNoEffects )
a1->playGravityEffect(a1, !a2->m_isUpsideDown);
v48 = v91->getPosition(v91);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v93, v48);
cocos2d::CCPoint::operator=((PlayerObject *)&a2->m_lastPortalPos, COERCE_FLOAT(&v93), v49, v50);
v51 = v91;
v52 = v91->m_hasNoEffects;
v53 = !a2->m_isUpsideDown;
a2->m_lastActivatedPortal = v91;
if ( !v52 )
v47 = v51->m_isHide;
GJBaseGameLayer::flipGravity(a1, a2, v53, v47);
GameObject::playShineEffect(v91);
v91->activatedByPlayer(v91, a2);
v36 = a1;
v37 = PortalGravityInvert;
LABEL_60:
v45 = 0;
LABEL_133:
GJBaseGameLayer::gameEventTriggered(v36, v37, v45, v45);
}
break;
case GravityTogglePortal|NormalGravityPortal:
GJBaseGameLayer::playerTouchedRing(a1, a2, (RingObject *)v91);
goto LABEL_124;
default:
break;
}
}
}
LABEL_125:
++v7;
}
}