//
// PlayerObject::spiderTestJumpInternal from 0x348af8 to 0x3493b8 (2240 bytes)
//
// 2 xrefs:
// > PlayerObject::spiderTestJumpInternal @ 0x34929c
// > PlayerObject::spiderTestJump @ 0x3493c0
//
// 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 PlayerObject::spiderTestJumpInternal(PlayerObject *a1, bool a2)
{
_BOOL4 m_isSideways; // r7
int v4; // r5
float v5; // s18
const cocos2d::CCRect *v6; // r0
float MinPortalY; // s17
float MaxPortalY; // s19
float width; // s15
float height; // s16
float v11; // s16
float v12; // s16
float y; // s16
float v14; // s16
float v15; // s16
float v16; // s16
float v17; // s16
float v18; // s15
_BOOL4 m_isGoingLeft; // r3
float x; // s16
float v21; // s12
bool v22; // zf
float v23; // s16
GJBaseGameLayer *m_gameLayer; // r9
cocos2d::CCArray *v25; // r0
GJBaseGameLayer *v26; // r9
cocos2d::CCArray *v27; // r8
cocos2d::CCArray *v28; // r9
int (**v29)(const void *, const void *); // r3
int (*v30)(const void *, const void *); // r10
GJBaseGameLayer *v31; // r8
float v32; // s22
unsigned int v33; // r10
const cocos2d::CCPoint *v34; // r0
GameObject *v35; // r6
int (*getObjectRect)(void); // r3
cocos2d::CCRect *v37; // r0
float v38; // r0
float v39; // s15
float v40; // s16
cocos2d::CCRect *v41; // r0
float v42; // r0
float v43; // s15
int v44; // r11
int v45; // r1
double v46; // d12
float v47; // s23
float v48; // s15
float v49; // s24
float v50; // s15
unsigned int i; // r6
int v52; // r0
int (*v53)(void); // r3
const cocos2d::CCRect *v54; // r0
int v55; // r7
int v56; // r0
float v57; // s15
int v58; // r0
float v59; // s15
const cocos2d::CCPoint *v60; // r0
int v61; // r0
cocos2d::CCPoint v62; // r1
GJBaseGameLayer *v63; // r0
cocos2d::CCRect *v64; // r0
float v65; // r0
float v66; // s15
cocos2d::CCRect *v67; // r0
float v68; // r0
float v69; // s15
float v70; // r3
int v71; // [sp+0h] [bp-9Ch]
bool v72; // [sp+4h] [bp-98h]
bool v73; // [sp+4h] [bp-98h]
bool v74; // [sp+4h] [bp-98h]
_BOOL4 v75; // [sp+Ch] [bp-90h]
_BOOL4 v76; // [sp+10h] [bp-8Ch]
cocos2d::CCPoint v77; // [sp+24h] [bp-78h] BYREF
cocos2d::CCPoint v78; // [sp+2Ch] [bp-70h] BYREF
cocos2d::CCRect v79; // [sp+34h] [bp-68h] BYREF
cocos2d::CCRect v80; // [sp+44h] [bp-58h] BYREF
cocos2d::CCRect v81; // [sp+54h] [bp-48h] BYREF
cocos2d::CCRect v82; // [sp+64h] [bp-38h] BYREF
cocos2d::CCRect v83; // [sp+74h] [bp-28h] BYREF
cocos2d::CCRect v84; // [sp+84h] [bp-18h] BYREF
cocos2d::CCRect v85; // 0:kr00_16.16
cocos2d::CCPoint v86; // 0:r3.4,4:^0.4
cocos2d::CCRect v87; // 0:r1.12,12:^0.4
cocos2d::CCRect v88; // 0:r1.12,12:^0.4
v76 = a2;
if ( a1->m_isDead || a1->m_isLocked || a1->m_maybeReducedEffects )
return;
m_isSideways = a1->m_isSideways;
v4 = !m_isSideways;
v5 = a1->m_vehicleSize * 8.0;
v75 = a1->m_isSideways || a1->m_gameLayer->m_gameState.m_isFreeMode || PlayerObject::isInBasicMode(a1);
v6 = a1->getObjectRect(a1);
cocos2d::CCRect::CCRect(&v79, v6);
cocos2d::CCRect::CCRect(&v80, &v79);
if ( a1->m_isSideways )
{
MaxPortalY = a1->getPosition(a1)->x + 3000.0;
if ( (float)(a1->getPosition(a1)->x - 3000.0) <= 0.0 )
MinPortalY = 0.0;
else
MinPortalY = a1->getPosition(a1)->x - 3000.0;
}
else if ( v75 )
{
MinPortalY = 90.0;
if ( (float)(a1->getPosition(a1)->y - 3000.0) > 90.0 )
MinPortalY = a1->getPosition(a1)->y - 3000.0;
MaxPortalY = a1->getPosition(a1)->y + 3000.0;
}
else
{
MinPortalY = GJBaseGameLayer::getMinPortalY(a1->m_gameLayer);
MaxPortalY = GJBaseGameLayer::getMaxPortalY(a1->m_gameLayer);
}
if ( a1->m_isUpsideDown )
{
y = v80.origin.y;
if ( v4 )
{
v80.origin.y = MinPortalY;
}
else
{
y = v80.origin.x;
v80.origin.x = MinPortalY;
}
v14 = (float)(y - MinPortalY) + 2.0;
if ( v4 )
v80.size.height = v14;
else
v80.size.width = v14;
}
else
{
width = v80.size.width;
height = v80.size.height;
if ( !v4 )
{
height = v80.size.width;
width = v80.origin.x;
}
v11 = height - 2.0;
if ( v4 )
width = v80.origin.y;
else
v11 = v11 + width;
if ( v4 )
v11 = v11 + width;
else
v80.origin.x = v11;
if ( v4 )
v80.origin.y = v11;
v12 = MaxPortalY - v11;
if ( v4 )
v80.size.height = v12;
else
v80.size.width = v12;
}
cocos2d::CCRect::CCRect(&v81, &v80);
if ( m_isSideways )
{
v81.size.height = v79.size.height;
v81.origin.y = v79.origin.y;
}
else
{
v81.size.width = v79.size.width;
v81.origin.x = v79.origin.x;
}
cocos2d::CCRect::CCRect(&v82, &v81);
if ( m_isSideways )
{
v15 = v80.size.height;
v82.size.height = v82.size.height + 4.0;
}
else
{
v15 = v80.size.width;
v82.size.width = v82.size.width + 4.0;
}
v16 = v15 - v5;
if ( m_isSideways )
v81.size.height = v5;
else
v81.size.width = v5;
v17 = v16 * 0.5;
if ( m_isSideways )
v81.origin.y = v81.origin.y + v17;
else
v81.origin.x = v81.origin.x + v17;
if ( a1->m_isPlatformer )
{
if ( m_isSideways )
{
v80.size.height = v80.size.height - 2.0;
v80.origin.y = v80.origin.y + 1.0;
}
else
{
v80.size.width = v80.size.width - 2.0;
v80.origin.x = v80.origin.x + 1.0;
}
}
else
{
v18 = v79.size.width;
m_isGoingLeft = a1->m_isGoingLeft;
x = v79.origin.x;
if ( m_isSideways )
v21 = v79.size.height;
else
v21 = v79.size.width;
if ( m_isSideways )
v80.size.height = (float)(v21 * 0.5) + 1.0;
else
v80.size.width = (float)(v21 * 0.5) + 1.0;
if ( m_isGoingLeft )
{
v22 = !m_isSideways;
if ( m_isSideways )
{
x = v79.origin.y;
v18 = v79.size.height;
}
v23 = (float)(x - (float)(v18 * 0.5)) - 1.0;
}
else
{
v22 = !m_isSideways;
if ( m_isSideways )
{
x = v79.origin.y;
v18 = v79.size.height;
}
v23 = x + (float)(v18 * 0.5);
}
if ( v22 )
v80.origin.x = v23;
else
v80.origin.y = v23;
}
m_gameLayer = a1->m_gameLayer;
cocos2d::CCRect::CCRect(&v84, &v80);
LODWORD(v85.origin.x) = &v84;
LODWORD(v85.origin.y) = 1;
v85.size.width = v70;
LODWORD(v85.size.height) = v71;
v25 = GJBaseGameLayer::staticObjectsInRect(m_gameLayer, v85, v72);
v26 = a1->m_gameLayer;
v27 = v25;
cocos2d::CCRect::CCRect(&v84, &v81);
LODWORD(v87.origin.y) = 1;
LODWORD(v87.origin.x) = &v84;
v28 = GJBaseGameLayer::damagingObjectsInRect(v26, v87, v73);
if ( a1->m_isSideways )
{
if ( a1->m_isUpsideDown )
v29 = (int (**)(const void *, const void *))&boxCompMaxX;
else
v29 = (int (**)(const void *, const void *))&boxCompMinX;
}
else if ( a1->m_isUpsideDown )
{
v29 = (int (**)(const void *, const void *))&boxCompMax;
}
else
{
v29 = (int (**)(const void *, const void *))&boxCompMin;
}
v30 = *v29;
if ( !cocos2d::CCArray::count(v27) && cocos2d::CCArray::count(v28) || v76 )
{
v31 = a1->m_gameLayer;
cocos2d::CCRect::CCRect(&v84, &v82);
LODWORD(v88.origin.x) = &v84;
LODWORD(v88.origin.y) = 1;
v76 = 1;
v27 = GJBaseGameLayer::staticObjectsInRect(v31, v88, v74);
}
if ( cocos2d::CCArray::count(v27) )
qsort(v27->data->arr, v27->data->num, 4u, v30);
if ( cocos2d::CCArray::count(v28) )
qsort(v28->data->arr, v28->data->num, 4u, v30);
if ( !cocos2d::CCArray::count(v27) )
{
if ( cocos2d::CCArray::count(v28) )
{
v56 = cocos2d::CCArray::objectAtIndex(v28, 0);
v32 = 0.0;
v55 = 1;
(*(void (__fastcall **)(cocos2d::CCRect *, int))(*(_DWORD *)v56 + 672))(&v84, v56);
v40 = v84.origin.y;
if ( !v4 )
v40 = v84.origin.x;
}
else
{
v32 = 0.0;
v55 = 0;
v40 = 0.0;
}
goto LABEL_133;
}
v32 = 0.0;
v33 = 0;
cocos2d::CCRect::CCRect(&v83, &v79);
v34 = a1->getPosition(a1);
cocos2d::CCPoint::CCPoint(&v77, v34);
while ( 1 )
{
if ( v33 >= cocos2d::CCArray::count(v27) )
{
v40 = 0.0;
goto LABEL_127;
}
v35 = (GameObject *)cocos2d::CCArray::objectAtIndex(v27, v33);
getObjectRect = (int (*)(void))v35->getObjectRect;
if ( a1->m_isUpsideDown )
{
v41 = (cocos2d::CCRect *)getObjectRect();
if ( v4 )
{
v42 = COERCE_FLOAT(cocos2d::CCRect::getMaxY(v41));
v43 = v79.size.height;
}
else
{
v42 = COERCE_FLOAT(cocos2d::CCRect::getMaxX(v41));
v43 = v79.size.width;
}
v40 = v42 + (float)(v43 * 0.5);
}
else
{
v37 = (cocos2d::CCRect *)getObjectRect();
if ( v4 )
{
v38 = COERCE_FLOAT(cocos2d::CCRect::getMinY(v37));
v39 = v79.size.height;
}
else
{
v38 = COERCE_FLOAT(cocos2d::CCRect::getMinX(v37));
v39 = v79.size.width;
}
v40 = v38 - (float)(v39 * 0.5);
}
if ( v35->getType(v35) == Slope )
{
v35->getRealPosition(&v78, v35);
if ( a1->m_isSideways )
PlayerObject::rotateGameplayObject(a1, v35);
if ( a1->m_isUpsideDown == GameObject::slopeFloorTop(v35) )
{
v44 = 0;
}
else
{
v44 = 1;
LODWORD(v46) = GameObject::slopeYPos(v35, v77.x);
HIDWORD(v46) = v45;
v35->getRealPosition(&v84.origin, v35);
v47 = v79.size.height;
v48 = v78.y;
v49 = v46 - v84.origin.y;
if ( !v4 )
{
v48 = v78.x;
v47 = v79.size.width;
}
v40 = (float)(v48 + v49) + (float)((float)(v47 * 0.5) * (float)-PlayerObject::flipMod(a1));
}
if ( a1->m_isSideways )
PlayerObject::unrotateGameplayObject(a1, v35);
}
else
{
v44 = 0;
}
v50 = v77.y;
if ( !v4 )
v50 = v77.x;
if ( a1->m_isUpsideDown )
break;
if ( v40 >= (float)(v50 - 10.0) )
goto LABEL_167;
LABEL_125:
++v33;
}
if ( v40 > (float)(v50 + 10.0) )
goto LABEL_125;
LABEL_167:
if ( a1->m_isPlatformer )
{
if ( !v44 )
goto LABEL_127;
LABEL_182:
for ( i = 0; i < cocos2d::CCArray::count(v27); ++i )
{
v52 = cocos2d::CCArray::objectAtIndex(v27, i);
if ( v33 != i )
{
v53 = *(int (**)(void))(*(_DWORD *)v52 + 656);
if ( v4 )
v83.origin.y = v40 - (float)(v79.size.height * 0.5);
else
v83.origin.x = v40 - (float)(v79.size.width * 0.5);
v54 = (const cocos2d::CCRect *)v53();
cocos2d::CCRect::CCRect(&v84, v54);
if ( !v44 )
{
if ( v4 )
{
v84.size.height = v84.size.height - 4.0;
v84.origin.y = v84.origin.y + 2.0;
}
else
{
v84.size.width = v84.size.width - 4.0;
v84.origin.x = v84.origin.x + 2.0;
}
}
if ( cocos2d::CCRect::intersectsRect(&v84, &v83) )
{
if ( v44 )
{
if ( v32 != 0.0 )
{
if ( a1->m_isUpsideDown )
{
if ( v40 <= v32 )
v40 = v32;
}
else if ( v40 >= v32 )
{
v40 = v32;
}
}
}
else
{
v40 = v32;
}
v32 = v40;
goto LABEL_125;
}
}
}
}
else
{
if ( !a1->m_isGoingLeft )
{
v64 = (cocos2d::CCRect *)v35->getObjectRect(v35);
if ( m_isSideways )
{
v65 = COERCE_FLOAT(cocos2d::CCRect::getMinY(v64));
v66 = v77.y;
}
else
{
v65 = COERCE_FLOAT(cocos2d::CCRect::getMinX(v64));
v66 = v77.x;
}
if ( v65 > v66 )
goto LABEL_182;
}
if ( a1->m_isGoingLeft )
{
v67 = (cocos2d::CCRect *)v35->getObjectRect(v35);
if ( m_isSideways )
{
v68 = COERCE_FLOAT(cocos2d::CCRect::getMaxY(v67));
v69 = v77.y;
}
else
{
v68 = COERCE_FLOAT(cocos2d::CCRect::getMaxX(v67));
v69 = v77.x;
}
if ( v68 < v69 )
goto LABEL_182;
}
}
LABEL_127:
v55 = 0;
LABEL_133:
if ( !a1->m_isPlatformer || v32 == 0.0 )
{
if ( v40 == 0.0 )
{
LABEL_141:
v57 = v79.size.height;
if ( !v4 )
v57 = v79.size.width;
if ( a1->m_isUpsideDown )
v40 = MinPortalY + (float)(v57 * 0.5);
else
v40 = MaxPortalY - (float)(v57 * 0.5);
}
}
else
{
if ( a1->m_isUpsideDown )
{
if ( v32 <= v40 )
goto LABEL_139;
goto LABEL_146;
}
if ( v32 < v40 )
goto LABEL_146;
LABEL_139:
if ( v40 == 0.0 )
{
if ( v32 == 0.0 )
goto LABEL_141;
LABEL_146:
v40 = v32;
}
}
if ( !v55 && cocos2d::CCArray::count(v28) )
{
v58 = cocos2d::CCArray::objectAtIndex(v28, 0);
(*(void (__fastcall **)(cocos2d::CCRect *, int))(*(_DWORD *)v58 + 672))(&v84, v58);
v59 = v84.origin.y;
if ( !v4 )
v59 = v84.origin.x;
if ( a1->m_isUpsideDown )
{
if ( v59 > v40 )
goto LABEL_164;
}
else
{
if ( v59 >= v40 )
goto LABEL_153;
LABEL_164:
if ( !v76 )
{
PlayerObject::spiderTestJumpInternal(a1, 1);
return;
}
v40 = v59;
}
}
LABEL_153:
v60 = a1->getPosition(a1);
cocos2d::CCPoint::CCPoint(&v77, v60);
cocos2d::CCPoint::CCPoint(&v78, &v77);
if ( v4 )
v78.y = v40;
else
v78.x = v40;
a1->setPosition(a1, &v78);
PlayerObject::flipGravity(a1, !a1->m_isUpsideDown, 1);
v61 = PlayerObject::flipMod(a1);
PlayerObject::setYVelocity(a1, (double)-v61, 36);
a1->m_isOnGround3 = 0;
a1->m_jumpBuffered = 0;
PlayerObject::resetCollisionLog(a1, 1);
if ( v4 )
a1->m_position.y = v78.y;
else
a1->m_position.x = v78.x;
a1->m_lastSpiderFlipTime = a1->m_totalTime;
cocos2d::CCPoint::CCPoint(&v83.origin, &v77);
cocos2d::CCPoint::CCPoint(&v84.origin, &v78);
LODWORD(v62.x) = &v83;
LODWORD(v62.y) = &v84;
PlayerObject::playSpiderDashEffect(a1, v62, v86);
if ( v75 )
{
v63 = a1->m_gameLayer;
if ( v63 )
GJBaseGameLayer::checkCameraLimitAfterTeleport(v63, a1, 60.0);
}
}