//
// PlayerObject::spiderTestJumpInternal from 0x1403943f0 to 0x14039516d (3453 bytes)
//
// 6 xrefs:
// > PlayerObject::spiderTestJump @ 0x14039434b
// > PlayerObject::spiderTestJumpInternal @ 0x140394fbd
// > PlayerObject::bumpPlayer @ 0x14039f732
// > ??> @ 0x140697ae0
// > ??> @ 0x140697be0
// > ??> @ 0x1406d62e4
//
// 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)
{
bool m_isSideways; // si
float v5; // xmm8_4
bool v6; // bl
__int128 width_low; // xmm7
unsigned int v8; // r12d
const struct cocos2d::CCRect *v9; // rax
float MinPortalY; // xmm14_4
float MaxPortalY; // xmm15_4
float v12; // xmm0_4
float v13; // xmm0_4
float v14; // xmm0_4
float height; // xmm2_4
float width; // xmm3_4
float v17; // xmm0_4
__int128 x_low; // xmm0
cocos2d::CCRect *v19; // rax
cocos2d::CCArray *v20; // r15
cocos2d::CCRect *v21; // rax
bool v22; // r8
cocos2d::CCArray *v23; // r13
int (__cdecl *v24)(const void *, const void *); // rbx
int (__cdecl *v25)(const void *, const void *); // rax
cocos2d::CCRect *v26; // rax
float v27; // xmm9_4
int v28; // ebx
struct cocos2d::CCObject *v29; // rax
GameObject *v30; // rbx
float v31; // xmm6_4
cocos2d::CCRect *v32; // rax
cocos2d::CCRect *v33; // rax
cocos2d::CCObject_vtbl *v34; // rax
cocos2d::CCRect *v35; // rax
float MaxX; // xmm0_4
cocos2d::CCRect *v37; // rax
char v38; // r14
unsigned int m_slopeDirection; // eax
int v40; // ecx
bool v41; // al
double v42; // xmm0_8
float v43; // xmm1_4
int v44; // eax
double v45; // xmm1_8
double v46; // xmm6_8
float v47; // xmm0_4
float v48; // xmm1_4
bool v49; // cf
cocos2d::CCRect *v50; // rcx
float MinY; // xmm0_4
float y; // xmm1_4
cocos2d::CCRect *v53; // rcx
float MaxY; // xmm0_4
float x; // xmm1_4
unsigned int v56; // ebx
struct cocos2d::CCObject *v57; // rax
const struct cocos2d::CCRect *v58; // rax
struct cocos2d::CCObject *v59; // rax
_DWORD *v60; // rax
struct cocos2d::CCObject *v61; // rax
float *v62; // rax
float v63; // xmm0_4
int v65; // r8d
cocos2d::CCDictionary *m_collisionLogTop; // rcx
cocos2d::CCPoint v67; // rax
cocos2d::CCPoint v68; // rbx
cocos2d::CCPoint v69; // rax
GJBaseGameLayer *m_gameLayer; // rcx
cocos2d::CCRect v71; // [rsp+28h] [rbp-E0h] BYREF
cocos2d::CCRect v72; // [rsp+38h] [rbp-D0h] BYREF
cocos2d::CCRect v73; // [rsp+48h] [rbp-C0h] BYREF
cocos2d::CCRect v74; // [rsp+58h] [rbp-B0h] BYREF
cocos2d::CCRect v75; // [rsp+68h] [rbp-A0h] BYREF
_DWORD v76[2]; // [rsp+78h] [rbp-90h] BYREF
cocos2d::CCPoint v77; // [rsp+80h] [rbp-88h] BYREF
cocos2d::CCPoint v78; // [rsp+88h] [rbp-80h] BYREF
cocos2d::CCRect v79; // [rsp+90h] [rbp-78h] BYREF
cocos2d::CCRect v80; // [rsp+A0h] [rbp-68h] BYREF
cocos2d::CCRect v81; // [rsp+B0h] [rbp-58h] BYREF
cocos2d::CCRect v82; // [rsp+C0h] [rbp-48h] BYREF
bool v83; // [rsp+1C8h] [rbp+C0h]
bool v84; // [rsp+1D0h] [rbp+C8h]
cocos2d::CCPoint v85; // [rsp+1D8h] [rbp+D0h] BYREF
cocos2d::CCPoint v86; // [rsp+1E0h] [rbp+D8h] BYREF
v84 = a2;
if ( a1->m_isDead || a1->m_isLocked || a1->m_maybeReducedEffects )
return;
m_isSideways = a1->m_isSideways;
v5 = a1->m_vehicleSize * 8.0;
v6 = m_isSideways
|| a1->m_gameLayer->m_gameState.m_isFreeMode
|| !a1->m_isShip && !a1->m_isBird && !a1->m_isDart && !a1->m_isSwing && !a1->m_isBall && !a1->m_isSpider;
LODWORD(width_low) = 0;
LOBYTE(v8) = 0;
v83 = v6;
v9 = a1->getObjectRect_0(a1);
cocos2d::CCRect::CCRect(&v72, v9);
cocos2d::CCRect::CCRect(&v71, &v72);
if ( a1->m_isSideways )
{
MaxPortalY = a1->getPosition_0(a1)->x + 3000.0;
MinPortalY = fmaxf(0.0, a1->getPosition_0(a1)->x - 3000.0);
}
else if ( v6 )
{
MinPortalY = fmaxf(90.0, a1->getPosition_0(a1)->y - 3000.0);
MaxPortalY = a1->getPosition_0(a1)->y + 3000.0;
}
else
{
MinPortalY = GJBaseGameLayer::getMinPortalY(a1->m_gameLayer);
MaxPortalY = GJBaseGameLayer::getMaxPortalY(a1->m_gameLayer);
}
if ( a1->m_isUpsideDown )
{
if ( m_isSideways )
{
v14 = v71.origin.x - MinPortalY;
v71.origin.x = MinPortalY;
v12 = v14 + 2.0;
goto LABEL_25;
}
v17 = v71.origin.y - MinPortalY;
v71.origin.y = MinPortalY;
v13 = v17 + 2.0;
}
else
{
if ( m_isSideways )
{
v71.origin.x = v71.origin.x + (float)(v71.size.width - 2.0);
v12 = MaxPortalY - v71.origin.x;
LABEL_25:
v71.size.width = v12;
cocos2d::CCRect::CCRect(&v73, &v71);
v73.size.height = v72.size.height;
v73.origin.y = v72.origin.y;
cocos2d::CCRect::CCRect(&v75, &v73);
height = v71.size.height;
width = v71.size.width;
v73.size.height = v5;
v75.size.height = v75.size.height + 4.0;
v73.origin.y = v73.origin.y + (float)((float)(v71.size.height - v5) * 0.5);
goto LABEL_28;
}
v71.origin.y = v71.origin.y + (float)(v71.size.height - 2.0);
v13 = MaxPortalY - v71.origin.y;
}
v71.size.height = v13;
cocos2d::CCRect::CCRect(&v73, &v71);
v73.size.width = v72.size.width;
v73.origin.x = v72.origin.x;
cocos2d::CCRect::CCRect(&v75, &v73);
width = v71.size.width;
height = v71.size.height;
v73.size.width = v5;
v75.size.width = v75.size.width + 4.0;
v73.origin.x = v73.origin.x + (float)((float)(v71.size.width - v5) * 0.5);
LABEL_28:
if ( a1->m_isPlatformer )
{
if ( !m_isSideways )
{
x_low = LODWORD(v71.origin.x);
v71.origin.x = v71.origin.x + 1.0;
v71.size.width = width + -2.0;
goto LABEL_43;
}
x_low = LODWORD(v71.origin.y);
*(float *)&x_low = v71.origin.y + 1.0;
v71.size.height = height + -2.0;
}
else
{
if ( m_isSideways )
{
x_low = LODWORD(v72.size.height);
v71.size.height = (float)(v72.size.height * 0.5) + 1.0;
}
else
{
x_low = LODWORD(v72.size.width);
v71.size.width = (float)(v72.size.width * 0.5) + 1.0;
}
if ( !a1->m_isGoingLeft )
{
if ( m_isSideways )
v71.origin.y = (float)(v72.size.height * 0.5) + v72.origin.y;
else
v71.origin.x = (float)(v72.size.width * 0.5) + v72.origin.x;
goto LABEL_43;
}
if ( !m_isSideways )
{
x_low = LODWORD(v72.origin.x);
v71.origin.x = (float)(v72.origin.x - (float)(v72.size.width * 0.5)) - 1.0;
goto LABEL_43;
}
x_low = LODWORD(v72.origin.y);
*(float *)&x_low = (float)(v72.origin.y - (float)(v72.size.height * 0.5)) - 1.0;
}
LODWORD(v71.origin.y) = x_low;
LABEL_43:
cocos2d::CCRect::CCRect(&v80, &v71);
v20 = GJBaseGameLayer::staticObjectsInRect(a1->m_gameLayer, v19, 1);
cocos2d::CCRect::CCRect(&v81, &v73);
v23 = GJBaseGameLayer::damagingObjectsInRect(a1->m_gameLayer, v21, v22);
if ( a1->m_isSideways )
{
v24 = (int (__cdecl *)(const void *, const void *))sub_1403863E0;
v25 = (int (__cdecl *)(const void *, const void *))sub_140386440;
}
else
{
v24 = (int (__cdecl *)(const void *, const void *))sub_140386320;
v25 = (int (__cdecl *)(const void *, const void *))sub_140386380;
}
if ( a1->m_isUpsideDown )
v24 = v25;
if ( !cocos2d::CCArray::count(v20) && cocos2d::CCArray::count(v23) || a2 )
{
v84 = 1;
cocos2d::CCRect::CCRect(&v82, &v75);
v20 = GJBaseGameLayer::staticObjectsInRect(a1->m_gameLayer, v26, 1);
}
if ( cocos2d::CCArray::count(v20) )
qsort(v20->data->arr, v20->data->num, 8u, v24);
if ( cocos2d::CCArray::count(v23) )
qsort(v23->data->arr, v23->data->num, 8u, v24);
v27 = 0.0;
v28 = 1;
if ( cocos2d::CCArray::count(v20) )
{
cocos2d::CCRect::CCRect(&v79, &v72);
a1->getPosition_0(a1);
cocos2d::CCPoint::CCPoint(&v85);
v8 = 0;
if ( !cocos2d::CCArray::count(v20) )
goto LABEL_95;
while ( 1 )
{
v29 = cocos2d::CCArray::objectAtIndex(v20, v8);
v30 = (GameObject *)v29;
if ( a1->m_isUpsideDown )
{
v34 = v29->__vftable;
if ( m_isSideways )
{
width_low = LODWORD(v72.size.width);
v35 = (cocos2d::CCRect *)((__int64 (__fastcall *)(GameObject *))v34[16].isEqual)(v30);
MaxX = cocos2d::CCRect::getMaxX(v35);
}
else
{
width_low = LODWORD(v72.size.height);
v37 = (cocos2d::CCRect *)((__int64 (__fastcall *)(GameObject *))v34[16].isEqual)(v30);
MaxX = cocos2d::CCRect::getMaxY(v37);
}
*(float *)&width_low = (float)(*(float *)&width_low * 0.5) + MaxX;
}
else
{
if ( m_isSideways )
{
v31 = v72.size.width;
v32 = (cocos2d::CCRect *)((__int64 (__fastcall *)(struct cocos2d::CCObject *))v29->__vftable[16].isEqual)(v29);
*(float *)&x_low = cocos2d::CCRect::getMinX(v32);
}
else
{
v31 = v72.size.height;
v33 = (cocos2d::CCRect *)((__int64 (__fastcall *)(struct cocos2d::CCObject *))v29->__vftable[16].isEqual)(v29);
*(float *)&x_low = cocos2d::CCRect::getMinY(v33);
}
*((_QWORD *)&width_low + 1) = *((_QWORD *)&x_low + 1);
*(float *)&width_low = *(float *)&x_low - (float)(v31 * 0.5);
}
v38 = 0;
if ( v30->getType(v30) == Slope )
{
((void (__fastcall *)(GameObject *, _DWORD *))v30->getRealPosition)(v30, v76);
if ( a1->m_isSideways )
PlayerObject::rotateGameplayObject(a1, v30);
m_slopeDirection = v30->m_slopeDirection;
v41 = false;
if ( m_slopeDirection <= 6 )
{
v40 = 106;
if ( _bittest(&v40, m_slopeDirection) )
v41 = true;
}
if ( v41 != a1->m_isUpsideDown )
{
v42 = GameObject::slopeYPos(v30, v85.x);
v43 = *(float *)(((__int64 (__fastcall *)(GameObject *, cocos2d::CCPoint *))v30->getRealPosition)(v30, &v78)
+ 4);
v44 = -1;
v45 = v43;
if ( !a1->m_isUpsideDown )
v44 = 1;
v46 = v42 - v45;
if ( m_isSideways )
{
width_low = v76[0];
v48 = v72.size.width;
}
else
{
width_low = v76[1];
v48 = v72.size.height;
}
v47 = v46;
v38 = 1;
*(float *)&width_low = (float)(*(float *)&width_low + v47) - (float)((float)(v48 * 0.5) * (float)v44);
}
if ( a1->m_isSideways )
PlayerObject::unrotateGameplayObject(a1, v30);
}
if ( a1->m_isUpsideDown )
{
if ( m_isSideways )
x_low = LODWORD(v85.x);
else
x_low = LODWORD(v85.y);
v49 = (float)(*(float *)&x_low + 10.0) < *(float *)&width_low;
}
else if ( m_isSideways )
{
x_low = LODWORD(v85.x);
v49 = *(float *)&width_low < (float)(v85.x - 10.0);
}
else
{
x_low = LODWORD(v85.y);
v49 = *(float *)&width_low < (float)(v85.y - 10.0);
}
if ( v49 )
goto LABEL_126;
if ( a1->m_isPlatformer )
{
if ( !v38 )
goto LABEL_94;
}
else
{
if ( !a1->m_isGoingLeft )
{
v50 = (cocos2d::CCRect *)v30->getObjectRect_0(v30);
if ( m_isSideways )
{
MinY = cocos2d::CCRect::getMinY(v50);
y = v85.y;
}
else
{
MinY = cocos2d::CCRect::getMinX(v50);
y = v85.x;
}
if ( MinY > y )
goto LABEL_107;
if ( !a1->m_isGoingLeft )
goto LABEL_94;
}
v53 = (cocos2d::CCRect *)v30->getObjectRect_0(v30);
if ( m_isSideways )
{
MaxY = cocos2d::CCRect::getMaxY(v53);
x = v85.y;
}
else
{
MaxY = cocos2d::CCRect::getMaxX(v53);
x = v85.x;
}
if ( x <= MaxY )
{
LABEL_94:
LOBYTE(v8) = 0;
v28 = 1;
goto LABEL_95;
}
}
LABEL_107:
v56 = 0;
if ( !cocos2d::CCArray::count(v20) )
goto LABEL_94;
while ( 1 )
{
v57 = cocos2d::CCArray::objectAtIndex(v20, v56);
if ( v8 != v56 )
{
*((_QWORD *)&x_low + 1) = *((_QWORD *)&width_low + 1);
if ( m_isSideways )
v79.origin.x = *(float *)&width_low - (float)(v72.size.width * 0.5);
else
v79.origin.y = *(float *)&width_low - (float)(v72.size.height * 0.5);
v58 = (const struct cocos2d::CCRect *)((__int64 (__fastcall *)(struct cocos2d::CCObject *))v57->__vftable[16].isEqual)(v57);
cocos2d::CCRect::CCRect(&v74, v58);
if ( !v38 )
{
if ( m_isSideways )
{
x_low = LODWORD(v74.size.width);
v74.size.width = v74.size.width + -4.0;
v74.origin.x = v74.origin.x + 2.0;
}
else
{
x_low = LODWORD(v74.size.height);
v74.size.height = v74.size.height + -4.0;
v74.origin.y = v74.origin.y + 2.0;
}
}
if ( cocos2d::CCRect::intersectsRect(&v74, &v79) )
break;
}
if ( ++v56 >= cocos2d::CCArray::count(v20) )
goto LABEL_94;
}
if ( !v38 )
goto LABEL_126;
if ( v27 == 0.0 )
goto LABEL_125;
if ( !a1->m_isUpsideDown )
{
if ( v27 <= *(float *)&width_low )
goto LABEL_126;
LABEL_125:
v27 = *(float *)&width_low;
goto LABEL_126;
}
if ( *(float *)&width_low > v27 )
goto LABEL_125;
LABEL_126:
LODWORD(width_low) = 0;
if ( ++v8 >= cocos2d::CCArray::count(v20) )
goto LABEL_94;
}
}
if ( cocos2d::CCArray::count(v23) )
{
LOBYTE(v8) = 1;
v59 = cocos2d::CCArray::objectAtIndex(v23, 0);
v60 = (_DWORD *)((__int64 (__fastcall *)(struct cocos2d::CCObject *, cocos2d::CCPoint *))v59->__vftable[16].encodeWithCoder)(
v59,
&v85);
if ( m_isSideways )
LODWORD(width_low) = *v60;
else
LODWORD(width_low) = v60[1];
}
LABEL_95:
if ( a1->m_isPlatformer )
{
if ( v27 != 0.0 )
{
if ( a1->m_isUpsideDown )
{
if ( v27 <= *(float *)&width_low )
goto LABEL_138;
}
else if ( *(float *)&width_low <= v27 )
{
goto LABEL_138;
}
*(float *)&width_low = v27;
}
}
else
{
v27 = 0.0;
}
LABEL_138:
if ( *(float *)&width_low == 0.0 )
{
if ( v27 == 0.0 )
{
if ( a1->m_isUpsideDown )
{
if ( m_isSideways )
*(float *)&width_low = (float)(v72.size.width * 0.5) + MinPortalY;
else
*(float *)&width_low = (float)(v72.size.height * 0.5) + MinPortalY;
}
else if ( m_isSideways )
{
*(float *)&width_low = MaxPortalY - (float)(v72.size.width * 0.5);
}
else
{
*(float *)&width_low = MaxPortalY - (float)(v72.size.height * 0.5);
}
}
else
{
*(float *)&width_low = v27;
}
}
if ( !(_BYTE)v8 && cocos2d::CCArray::count(v23) )
{
v61 = cocos2d::CCArray::objectAtIndex(v23, 0);
v62 = (float *)((__int64 (__fastcall *)(struct cocos2d::CCObject *, cocos2d::CCPoint *))v61->__vftable[16].encodeWithCoder)(
v61,
&v85);
v63 = m_isSideways ? *v62 : v62[1];
if ( !(a1->m_isUpsideDown ? v63 <= *(float *)&width_low : *(float *)&width_low <= v63) )
{
if ( !v84 )
{
PlayerObject::spiderTestJumpInternal(a1, 1);
return;
}
*(float *)&width_low = v63;
}
}
a1->getPosition_0(a1);
cocos2d::CCPoint::CCPoint(&v77);
cocos2d::CCPoint::CCPoint(&v86);
if ( m_isSideways )
LODWORD(v86.x) = width_low;
else
LODWORD(v86.y) = width_low;
a1->setPosition_0(a1, &v86);
PlayerObject::flipGravity(a1, !a1->m_isUpsideDown, 1);
if ( !a1->m_isUpsideDown )
v28 = -1;
PlayerObject::setYVelocity(a1, (double)v28, v65);
m_collisionLogTop = a1->m_collisionLogTop;
a1->m_isOnGround3 = 0;
a1->m_jumpBuffered = 0;
cocos2d::CCDictionary::removeAllObjects(m_collisionLogTop);
cocos2d::CCDictionary::removeAllObjects(a1->m_collisionLogBottom);
cocos2d::CCDictionary::removeAllObjects(a1->m_collisionLogLeft);
cocos2d::CCDictionary::removeAllObjects(a1->m_collisionLogRight);
*(_QWORD *)&a1->m_unk50C = -1;
*(_QWORD *)&a1->m_lastCollisionBottom = -1;
*(_QWORD *)&a1->m_lastCollisionLeft = -1;
if ( m_isSideways )
a1->m_position.x = v86.x;
else
a1->m_position.y = v86.y;
a1->m_lastSpiderFlipTime = a1->m_totalTime;
cocos2d::CCPoint::CCPoint(&v85);
v68 = v67;
cocos2d::CCPoint::CCPoint(&v78);
PlayerObject::playSpiderDashEffect(a1, v69, v68);
if ( v83 )
{
m_gameLayer = a1->m_gameLayer;
if ( m_gameLayer )
GJBaseGameLayer::checkCameraLimitAfterTeleport(m_gameLayer, a1, 60.0);
}
}