//
// GJBaseGameLayer::collisionCheckObjects from 0x1001e7f38 to 0x1001e8cec (3508 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::checkCollisions @ 0x1001e7b9c
// > GJBaseGameLayer::checkCollisions @ 0x1001e7bdc
//
// 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
//
// local variable allocation has failed, the output may be wrong!
void __fastcall GJBaseGameLayer::collisionCheckObjects(
GJBaseGameLayer *a1,
PlayerObject *a2,
std::vector *a3,
int a4,
float a5)
{
__int64 v6; // x23
float *v10; // x22
float v11; // s9
float v12; // s10
float v13; // s11
float v14; // s0
float v15; // s12
unsigned __int64 v16; // x25
bool *p_m_isEditor; // x24
__int64 v18; // x26
GameObject *v19; // x0
int m_objectType; // w8
int m_hazardCollisionObjectsCount; // w8
std::vector *p_p; // x1
int m_solidCollisionObjectsCount; // w8
__int64 v24; // x28
_BOOL4 v25; // w23
bool *v26; // x27
OBB2D *v27; // x23
OBB2D *v28; // x24
__n128 v29; // q0
__int64 v30; // x0
int m_currentChannel; // w8
int m_channelValue; // w9
GJBaseGameLayer *v33; // x0
GJGameEvent v34; // w1
TeleportPortalObject *v35; // x0
__int64 *v36; // x0
TeleportPortalObject *v37; // x9
char v38; // w9
EffectGameObject *v39; // x2
GJBaseGameLayer *v40; // x0
PlayerObject *v41; // x1
int v42; // w4
GJBaseGameLayer *v43; // x0
GJGameEvent v44; // w1
__int64 *v45; // x0
TeleportPortalObject *v46; // x8
__int64 *v47; // x0
TeleportPortalObject *v48; // x8
__int64 *v49; // x0
EffectGameObject *v50; // x1
__int64 *v51; // x0
EffectGameObject *v52; // x1
__int64 *v53; // x0
TeleportPortalObject *v54; // x8
TeleportPortalObject *v55; // x0
__int64 *v56; // x0
TeleportPortalObject *v57; // x8
char v58; // w8
TeleportPortalObject *v59; // x0
__int64 *v60; // x0
TeleportPortalObject *v61; // x8
char v62; // w8
__int64 *v63; // x0
TeleportPortalObject *v64; // x8
__int64 *v65; // x0
__int64 v66; // x0
TeleportPortalObject *v67; // x0
std::vector __p; // [xsp+0h] [xbp-B0h] BYREF
float v69[4]; // [xsp+18h] [xbp-98h] BYREF
TeleportPortalObject *v70; // [xsp+28h] [xbp-88h] BYREF
v6 = *(_QWORD *)&a4;
v10 = (float *)((__int64 (__fastcall *)(PlayerObject *))a2->getObjectRect)(a2);
v11 = sub_100022C30(v10);
v12 = sub_100022C40((__int64)v10);
v13 = sub_100022C48((__int64)v10);
v14 = sub_100022C58((__int64)v10);
if ( (int)v6 >= 1 )
{
v15 = v14;
v16 = 0;
p_m_isEditor = &a1->m_isEditor;
v18 = 8LL * (unsigned int)v6;
while ( 1 )
{
v19 = a3->__begin_[v16 / 8];
v70 = (TeleportPortalObject *)v19;
m_objectType = v19->m_objectType;
if ( m_objectType == 7 || v19->m_isGroupDisabled || v19->m_isDisabled )
goto LABEL_23;
if ( m_objectType <= 20 )
break;
if ( m_objectType == 21 )
goto LABEL_17;
if ( m_objectType != 39 )
{
if ( m_objectType == 47 )
goto LABEL_10;
LABEL_14:
if ( (((__int64 (__fastcall *)(GameObject *, PlayerObject *))v19->hasBeenActivatedByPlayer)(v19, a2) & 1) == 0 )
{
sub_100022B90(v69);
if ( ((unsigned int (__fastcall *)(TeleportPortalObject *))v70->getType)(v70) == 25 )
{
((void (__fastcall *)(std::vector *__return_ptr, float, float))v70->getObjectRect_0)(&__p, 2.0, 2.0);
p_p = &__p;
}
else
{
p_p = (std::vector *)((__int64 (__fastcall *)(TeleportPortalObject *))v70->getObjectRect)(v70);
}
sub_100022BB0(v69, (__int64)p_p);
if ( v70->m_objectRadius <= 0.0 )
{
if ( v11 >= sub_100022C40((__int64)v69)
&& sub_100022C30(v69) >= v12
&& v13 >= sub_100022C58((__int64)v69)
&& sub_100022C48((__int64)v69) >= v15 )
{
LABEL_28:
v24 = v6;
if ( v70->m_shouldUseOuterOb && (!a1->m_levelSettings->m_fixRadiusCollision || v70->m_objectRadius <= 0.0) )
{
v26 = p_m_isEditor;
v27 = (OBB2D *)((__int64 (*)(void))v70->getOrientedBox)();
((void (__fastcall *)(PlayerObject *))a2->updateOrientedBox)(a2);
v28 = (OBB2D *)((__int64 (__fastcall *)(PlayerObject *))a2->getOrientedBox)(a2);
v25 = OBB2D::overlaps1Way(v27) && OBB2D::overlaps1Way(v28);
p_m_isEditor = v26;
}
else
{
v25 = 1;
}
if ( ((unsigned int (__fastcall *)(TeleportPortalObject *))v70->getType)(v70) == 25 )
{
v30 = ((__int64 (__fastcall *)(TeleportPortalObject *))v70->getObjectRect)(v70);
v29.n128_f64[0] = sub_100022BB0(v69, v30);
}
if ( !v25
|| (m_currentChannel = a1->m_gameState.m_currentChannel) != 0
&& v70->m_classType == Effect
&& (m_channelValue = v70->m_channelValue) != 0
&& m_channelValue != m_currentChannel )
{
v6 = v24;
}
else
{
v6 = v24;
switch ( v70->m_objectType )
{
case InverseGravityPortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, v70) )
{
v59 = v70;
if ( !a2->m_isUpsideDown && !v70->m_hasNoEffects )
{
((void (__fastcall *)(GJBaseGameLayer *, __int64))a1->playGravityEffect)(a1, 1);
v59 = v70;
}
v60 = (__int64 *)((__int64 (__fastcall *)(TeleportPortalObject *))v59->getPosition)(v59);
sub_1000229B8((__int64 *)&__p, v60);
sub_1000229D0(&a2->m_lastPortalPos, (double *)&__p);
v61 = v70;
a2->m_lastActivatedPortal = v70;
v62 = v61->m_hasNoEffects || v61->m_isHide;
GJBaseGameLayer::flipGravity(a1, a2, 1, v62 & 1);
GameObject::playShineEffect(v70);
((void (__fastcall *)(TeleportPortalObject *, PlayerObject *))v70->activatedByPlayer)(v70, a2);
v43 = a1;
v44 = PortalGravityFlip;
goto LABEL_134;
}
break;
case NormalGravityPortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, v70) )
{
v55 = v70;
if ( a2->m_isUpsideDown && !v70->m_hasNoEffects )
{
((void (__fastcall *)(GJBaseGameLayer *, _QWORD))a1->playGravityEffect)(a1, 0);
v55 = v70;
}
v56 = (__int64 *)((__int64 (__fastcall *)(TeleportPortalObject *))v55->getPosition)(v55);
sub_1000229B8((__int64 *)&__p, v56);
sub_1000229D0(&a2->m_lastPortalPos, (double *)&__p);
v57 = v70;
a2->m_lastActivatedPortal = v70;
v58 = v57->m_hasNoEffects || v57->m_isHide;
GJBaseGameLayer::flipGravity(a1, a2, 0, v58 & 1);
GameObject::playShineEffect(v70);
((void (__fastcall *)(TeleportPortalObject *, PlayerObject *))v70->activatedByPlayer)(v70, a2);
v43 = a1;
v44 = PortalGravityNormal;
goto LABEL_134;
}
break;
case ShipPortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, v70) )
{
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v70);
v39 = v70;
v40 = a1;
v41 = a2;
v42 = 5;
goto LABEL_114;
}
break;
case CubePortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, v70) )
{
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v70);
v65 = (__int64 *)((__int64 (__fastcall *)(TeleportPortalObject *))v70->getPosition)(v70);
sub_1000229B8((__int64 *)&__p, v65);
sub_1000229D0(&a2->m_lastPortalPos, (double *)&__p);
a2->m_lastActivatedPortal = v70;
PlayerObject::switchedToMode(a2, CubePortal);
PlayerObject::modeDidChange(a2);
goto LABEL_117;
}
break;
case YellowJumpPad:
case PinkJumpPad:
case RedJumpPad:
case CustomRing|YellowJumpPad:
GJBaseGameLayer::bumpPlayer(a1, a2, v70);
break;
case YellowJumpPad|Hazard:
GJBaseGameLayer::gravBumpPlayer(a1, a2, v70);
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, v70);
break;
case InverseMirrorPortal:
if ( !*p_m_isEditor && GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, v70) )
{
v63 = (__int64 *)((__int64 (__fastcall *)(TeleportPortalObject *))v70->getPosition)(v70);
sub_1000229B8((__int64 *)&__p, v63);
sub_1000229D0(&a2->m_lastPortalPos, (double *)&__p);
v64 = v70;
a2->m_lastActivatedPortal = v70;
GJBaseGameLayer::toggleFlipped(a1, 1, v64->m_hasNoEffects);
GameObject::playShineEffect(v70);
((void (__fastcall *)(TeleportPortalObject *, float))v70->triggerActivated)(v70, 0.0);
v43 = a1;
v44 = PortalFlip;
goto LABEL_134;
}
break;
case NormalMirrorPortal:
if ( !*p_m_isEditor && GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, v70) )
{
v45 = (__int64 *)((__int64 (__fastcall *)(TeleportPortalObject *))v70->getPosition)(v70);
sub_1000229B8((__int64 *)&__p, v45);
sub_1000229D0(&a2->m_lastPortalPos, (double *)&__p);
v46 = v70;
a2->m_lastActivatedPortal = v70;
GJBaseGameLayer::toggleFlipped(a1, 0, v46->m_hasNoEffects);
GameObject::playShineEffect(v70);
((void (__fastcall *)(TeleportPortalObject *, float))v70->triggerActivated)(v70, 0.0);
v43 = a1;
v44 = PortalUnFlip;
goto LABEL_134;
}
break;
case BallPortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, v70) )
{
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v70);
GJBaseGameLayer::switchToRollMode(a1, a2, v70, 0);
goto LABEL_117;
}
break;
case RegularSizePortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, v70) )
{
v53 = (__int64 *)((__int64 (__fastcall *)(TeleportPortalObject *))v70->getPosition)(v70);
sub_1000229B8((__int64 *)&__p, v53);
sub_1000229D0(&a2->m_lastPortalPos, (double *)&__p);
v54 = v70;
a2->m_lastActivatedPortal = v70;
PlayerObject::togglePlayerScale(a2, 0, v54->m_hasNoEffects);
GameObject::playShineEffect(v70);
((void (__fastcall *)(TeleportPortalObject *, PlayerObject *))v70->activatedByPlayer)(v70, a2);
v43 = a1;
v44 = PortalNormalScale;
goto LABEL_134;
}
break;
case MiniSizePortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, v70) )
{
v47 = (__int64 *)((__int64 (__fastcall *)(TeleportPortalObject *))v70->getPosition)(v70);
sub_1000229B8((__int64 *)&__p, v47);
sub_1000229D0(&a2->m_lastPortalPos, (double *)&__p);
v48 = v70;
a2->m_lastActivatedPortal = v70;
PlayerObject::togglePlayerScale(a2, 1, v48->m_hasNoEffects);
GameObject::playShineEffect(v70);
((void (__fastcall *)(TeleportPortalObject *, PlayerObject *))v70->activatedByPlayer)(v70, a2);
v43 = a1;
v44 = PortalMiniScale;
goto LABEL_134;
}
break;
case UfoPortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, v70) )
{
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v70);
v39 = v70;
v40 = a1;
v41 = a2;
v42 = 19;
goto LABEL_114;
}
break;
case Modifier:
case EnterEffectObject:
GJBaseGameLayer::playerTouchedTrigger(a1, a2, v70);
break;
case SecretCoin:
if ( !p_m_isEditor[292] )
{
((void (__fastcall *)(TeleportPortalObject *, GJBaseGameLayer *, _QWORD, _QWORD, __n128))v70->triggerObject)(
v70,
a1,
(unsigned int)a2->m_uniqueID,
0,
v29);
((void (__fastcall *)(TeleportPortalObject *, float))v70->triggerActivated)(v70, 0.0);
GJBaseGameLayer::destroyObject(a1, v70);
if ( !GJBaseGameLayer::hasUniqueCoin(a1, v70) )
GJBaseGameLayer::pickupItem(a1, v70);
v43 = a1;
v44 = UserCoin;
goto LABEL_134;
}
break;
case DualPortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, v70) )
{
v49 = (__int64 *)((__int64 (__fastcall *)(TeleportPortalObject *))v70->getPosition)(v70);
sub_1000229B8((__int64 *)&__p, v49);
sub_1000229D0(&a2->m_lastPortalPos, (double *)&__p);
v50 = v70;
a2->m_lastActivatedPortal = v70;
a1->m_player2->m_isBeingSpawnedByDualPortal = 1;
GJBaseGameLayer::toggleDualMode(a1, v50, 1, a2, 0);
a1->m_player2->m_isBeingSpawnedByDualPortal = 0;
GameObject::playShineEffect(v70);
((void (__fastcall *)(TeleportPortalObject *, float))v70->triggerActivated)(v70, 0.0);
v43 = a1;
v44 = PortalDualOn;
goto LABEL_134;
}
break;
case SoloPortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, v70) )
{
v51 = (__int64 *)((__int64 (__fastcall *)(TeleportPortalObject *))v70->getPosition)(v70);
sub_1000229B8((__int64 *)&__p, v51);
sub_1000229D0(&a2->m_lastPortalPos, (double *)&__p);
v52 = v70;
a2->m_lastActivatedPortal = v70;
GJBaseGameLayer::toggleDualMode(a1, v52, 0, a2, 0);
GameObject::playShineEffect(v70);
((void (__fastcall *)(TeleportPortalObject *, float))v70->triggerActivated)(v70, 0.0);
v43 = a1;
v44 = PortalDualOff;
goto LABEL_134;
}
break;
case Slope:
PlayerObject::collidedWithSlope(a2, a5, v70, 0);
goto LABEL_119;
case WavePortal:
if ( p_m_isEditor[2] || !GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, v70) )
break;
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v70);
v39 = v70;
v40 = a1;
v41 = a2;
v42 = 26;
goto LABEL_114;
case RobotPortal:
if ( !GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, v70) )
break;
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v70);
GJBaseGameLayer::switchToRobotMode(a1, a2, v70, 0);
goto LABEL_117;
case TeleportPortal:
if ( !GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, v70) )
break;
GJBaseGameLayer::gameEventTriggered(a1, PortalTeleport, 0, 0);
GJBaseGameLayer::teleportPlayer(a1, v70, a2);
LABEL_119:
v66 = ((__int64 (__fastcall *)(PlayerObject *))a2->getObjectRect)(a2);
sub_100022BB0(v10, v66);
v11 = sub_100022C30(v10);
v12 = sub_100022C40((__int64)v10);
v13 = sub_100022C48((__int64)v10);
v15 = sub_100022C58((__int64)v10);
break;
case Collectible:
if ( GJEffectManager::hasBeenTriggered(a1->m_effectManager, v70->m_uniqueID, 0) )
goto LABEL_127;
GJEffectManager::storeTriggeredID(a1->m_effectManager, v70->m_uniqueID, 0);
v67 = v70;
if ( v70->m_objectID == 1268 )
{
memset(&__p, 0, sizeof(__p));
SpawnTriggerGameObject::updateRemapKeys((SpawnTriggerGameObject *)v70, &__p);
if ( __p.__begin_ )
{
__p.__end_ = __p.__begin_;
operator delete(__p.__begin_);
}
v67 = v70;
}
((void (__fastcall *)(TeleportPortalObject *, GJBaseGameLayer *, _QWORD, _QWORD))v67->triggerObject)(
v67,
a1,
(unsigned int)a2->m_uniqueID,
0);
v33 = a1;
v34 = PickupItem;
goto LABEL_126;
case Collectible|0x1:
if ( p_m_isEditor[292] )
break;
if ( GJEffectManager::hasBeenTriggered(a1->m_effectManager, v70->m_uniqueID, 0) )
goto LABEL_127;
GJEffectManager::storeTriggeredID(a1->m_effectManager, v70->m_uniqueID, 0);
((void (__fastcall *)(TeleportPortalObject *, GJBaseGameLayer *, _QWORD, _QWORD))v70->triggerObject)(
v70,
a1,
(unsigned int)a2->m_uniqueID,
0);
if ( !GJBaseGameLayer::hasUniqueCoin(a1, v70) )
GJBaseGameLayer::pickupItem(a1, v70);
v33 = a1;
v34 = UserCoin;
LABEL_126:
GJBaseGameLayer::gameEventTriggered(v33, v34, 0, 0);
LABEL_127:
((void (__fastcall *)(TeleportPortalObject *, float))v70->triggerActivated)(v70, 0.0);
GJBaseGameLayer::destroyObject(a1, v70);
break;
case SpiderPortal:
if ( !GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, v70) )
break;
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v70);
GJBaseGameLayer::switchToSpiderMode(a1, a2, v70, 0);
goto LABEL_117;
case DropRing|YellowJumpPad:
PlayerObject::touchedObject(a2, v70);
break;
case SwingPortal:
if ( p_m_isEditor[2] || !GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, v70) )
break;
GJBaseGameLayer::playerWillSwitchMode(a1, a2, v70);
v39 = v70;
v40 = a1;
v41 = a2;
v42 = 41;
LABEL_114:
GJBaseGameLayer::switchToFlyMode(v40, v41, v39, 0, v42);
LABEL_117:
GameObject::playShineEffect(v70);
((void (__fastcall *)(TeleportPortalObject *, PlayerObject *))v70->activatedByPlayer)(v70, a2);
break;
case GravityTogglePortal:
if ( GJBaseGameLayer::canBeActivatedByPlayer(a1, a2, v70) )
{
v35 = v70;
if ( !v70->m_hasNoEffects )
{
((void (__fastcall *)(GJBaseGameLayer *, bool))a1->playGravityEffect)(a1, !a2->m_isUpsideDown);
v35 = v70;
}
v36 = (__int64 *)((__int64 (__fastcall *)(TeleportPortalObject *))v35->getPosition)(v35);
sub_1000229B8((__int64 *)&__p, v36);
sub_1000229D0(&a2->m_lastPortalPos, (double *)&__p);
v37 = v70;
a2->m_lastActivatedPortal = v70;
v38 = v37->m_hasNoEffects || v37->m_isHide;
GJBaseGameLayer::flipGravity(a1, a2, !a2->m_isUpsideDown, v38 & 1);
GameObject::playShineEffect(v70);
((void (__fastcall *)(TeleportPortalObject *, PlayerObject *))v70->activatedByPlayer)(v70, a2);
v43 = a1;
v44 = PortalGravityInvert;
LABEL_134:
GJBaseGameLayer::gameEventTriggered(v43, v44, 0, 0);
}
break;
case GravityTogglePortal|NormalGravityPortal:
GJBaseGameLayer::playerTouchedRing(a1, a2, v70);
goto LABEL_119;
default:
break;
}
}
}
}
else if ( GJBaseGameLayer::playerCircleCollision(a1, a2, v70) )
{
goto LABEL_28;
}
}
}
LABEL_23:
v16 += 8LL;
if ( v18 == v16 )
return;
}
if ( !m_objectType )
{
LABEL_17:
m_solidCollisionObjectsCount = a1->m_solidCollisionObjectsCount;
if ( a1->m_solidCollisionObjectsIndex <= m_solidCollisionObjectsCount )
{
sub_1000115B8((__int64)&a1->m_solidCollisionObjects, &v70);
++a1->m_solidCollisionObjectsIndex;
m_solidCollisionObjectsCount = a1->m_solidCollisionObjectsCount;
}
else
{
a1->m_solidCollisionObjects.__begin_[m_solidCollisionObjectsCount] = v19;
}
a1->m_solidCollisionObjectsCount = m_solidCollisionObjectsCount + 1;
goto LABEL_23;
}
if ( m_objectType == 2 )
{
LABEL_10:
m_hazardCollisionObjectsCount = a1->m_hazardCollisionObjectsCount;
if ( a1->m_hazardCollisionObjectsIndex <= m_hazardCollisionObjectsCount )
{
sub_1000115B8((__int64)&a1->m_hazardCollisionObjects, &v70);
++a1->m_hazardCollisionObjectsIndex;
m_hazardCollisionObjectsCount = a1->m_hazardCollisionObjectsCount;
}
else
{
a1->m_hazardCollisionObjects.__begin_[m_hazardCollisionObjectsCount] = v19;
}
a1->m_hazardCollisionObjectsCount = m_hazardCollisionObjectsCount + 1;
goto LABEL_23;
}
goto LABEL_14;
}
}