//
// PlayerObject::spiderTestJumpInternal from 0x100224a9c to 0x10022559c (2816 bytes)
//
// 2 xrefs:
// > PlayerObject::spiderTestJump @ 0x10021e068
// > PlayerObject::spiderTestJumpInternal @ 0x10022555c
//
// 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 __fastcall PlayerObject::spiderTestJumpInternal(PlayerObject *a1, bool a2)
{
_BOOL4 v3; // w22
_BOOL4 m_isSideways; // w26
float m_vehicleSize; // s8
bool v6; // w27
__int64 v7; // x0
double v8; // d0
float MaxPortalY; // s12
float MinPortalY; // s11
float v11; // s8
__int64 v12; // x8
__int64 v13; // x10
__int64 v14; // x8
__int64 v15; // x10
float v16; // s0
__int64 v17; // x21
float v18; // s0
float v19; // s0
float v20; // s1
GJBaseGameLayer *m_gameLayer; // x20
double v22; // d0
cocos2d::CCArray *v23; // x21
GJBaseGameLayer *v24; // x20
double v25; // d0
cocos2d::CCArray *v26; // x25
int (__cdecl *v27)(const void *, const void *); // x9
int (__cdecl *v28)(const void *, const void *); // x10
int (__cdecl *v29)(const void *, const void *); // x23
GJBaseGameLayer *v30; // x21
double v31; // d0
int v32; // w0
int v33; // w23
double v34; // d0
__int64 *v35; // x0
__int64 v36; // x23
float v37; // s11
__int64 v38; // x22
__int64 v39; // x28
GameObject *v40; // x24
bool m_isUpsideDown; // w20
float *v42; // x0
float v43; // s0
float *v44; // x8
float *v45; // x8
float v46; // s1
float v47; // s10
int v48; // w0
int v49; // w8
_BOOL4 v50; // w20
double v51; // d10
float v52; // s0
__int64 v53; // x8
float v54; // s0
float v55; // s2
float *v56; // x9
float v57; // s0
_BOOL4 m_isPlatformer; // w8
__int64 v59; // x0
float v60; // s0
float *v61; // x8
float *v62; // x0
float v63; // s0
float *v64; // x8
__int64 v65; // x24
char v66; // w25
__int64 v67; // x0
__int64 v68; // x8
__int64 v69; // x0
_BOOL4 v70; // w0
_BOOL4 v71; // w8
__int64 v72; // x0
__int64 v73; // x8
float v74; // s0
_BOOL4 v75; // w8
float v76; // s1
__int64 v77; // x9
float v78; // s0
__int64 v79; // x9
float v80; // s0
__int64 v81; // x0
__int64 v82; // x8
float v83; // s0
_BOOL4 v84; // w8
__int64 *v85; // x0
__n128 v86; // q0
__int64 v87; // x21
double v88; // d0
double v89; // d1
GJBaseGameLayer *v90; // x0
float v91; // s1
float v92; // s2
float v93; // s3
float v94; // s1
float v95; // s2
float v96; // s3
float v97; // s1
float v98; // s2
float v99; // s3
float v100; // [xsp+4h] [xbp-13Ch]
int v101; // [xsp+8h] [xbp-138h]
bool v102; // [xsp+Ch] [xbp-134h]
cocos2d::CCArray *v103; // [xsp+10h] [xbp-130h]
__int64 v104[2]; // [xsp+38h] [xbp-108h] BYREF
__int64 v105; // [xsp+48h] [xbp-F8h] BYREF
__int64 v106; // [xsp+50h] [xbp-F0h] BYREF
__int64 v107[2]; // [xsp+58h] [xbp-E8h] BYREF
_QWORD v108[2]; // [xsp+68h] [xbp-D8h] BYREF
_QWORD v109[2]; // [xsp+78h] [xbp-C8h] BYREF
_QWORD v110[2]; // [xsp+88h] [xbp-B8h] BYREF
__int64 v111; // [xsp+98h] [xbp-A8h] BYREF
_BYTE v112[4]; // [xsp+A0h] [xbp-A0h] BYREF
_BYTE v113[12]; // [xsp+A4h] [xbp-9Ch] BYREF
cocos2d::CCRect v114; // 0:kr00_16.16
cocos2d::CCRect v115; // 0:kr10_16.16
cocos2d::CCRect v116; // 0:kr20_16.16
cocos2d::CCPoint v117; // 0:s0.4,4:s1.4
cocos2d::CCPoint v118; // 0:s2.4,4:s3.4
if ( a1->m_isDead || a1->m_isLocked || a1->m_maybeReducedEffects )
return;
v3 = a2;
m_isSideways = a1->m_isSideways;
m_vehicleSize = a1->m_vehicleSize;
if ( m_isSideways || a1->m_gameLayer->m_gameState.m_isFreeMode )
v6 = 1;
else
v6 = !a1->m_isShip && !a1->m_isBird && !a1->m_isDart && !a1->m_isSwing && !a1->m_isBall && !a1->m_isSpider;
v7 = ((__int64 (__fastcall *)(PlayerObject *))a1->getObjectRect)(a1);
sub_100022B98(&v111, v7);
v8 = sub_100022B98(v110, (__int64)&v111);
if ( a1->m_isSideways )
{
MaxPortalY = *(float *)((__int64 (__fastcall *)(PlayerObject *, double))a1->getPosition)(a1, v8) + 3000.0;
MinPortalY = 0.0;
if ( (float)(*(float *)((__int64 (__fastcall *)(PlayerObject *))a1->getPosition)(a1) + -3000.0) > 0.0 )
MinPortalY = *(float *)((__int64 (__fastcall *)(PlayerObject *))a1->getPosition)(a1) + -3000.0;
}
else if ( v6 )
{
MinPortalY = 90.0;
if ( (float)(*(float *)(((__int64 (__fastcall *)(PlayerObject *, double))a1->getPosition)(a1, v8) + 4) + -3000.0) > 90.0 )
MinPortalY = *(float *)(((__int64 (__fastcall *)(PlayerObject *))a1->getPosition)(a1) + 4) + -3000.0;
MaxPortalY = *(float *)(((__int64 (__fastcall *)(PlayerObject *))a1->getPosition)(a1) + 4) + 3000.0;
}
else
{
MinPortalY = GJBaseGameLayer::getMinPortalY(a1->m_gameLayer);
MaxPortalY = GJBaseGameLayer::getMaxPortalY(a1->m_gameLayer);
}
v11 = m_vehicleSize * 8.0;
if ( a1->m_isUpsideDown )
{
v12 = 4;
if ( m_isSideways )
v12 = 0;
v13 = 12;
if ( m_isSideways )
v13 = 8;
*(float *)((char *)v110 + v13) = (float)(*(float *)((char *)v110 + v12) - MinPortalY) + 2.0;
*(float *)((char *)v110 + v12) = MinPortalY;
}
else
{
v14 = 12;
if ( m_isSideways )
v14 = 8;
v15 = 4;
if ( m_isSideways )
v15 = 0;
v16 = *(float *)((char *)v110 + v15) + (float)(*(float *)((char *)v110 + v14) + -2.0);
*(float *)((char *)v110 + v15) = v16;
*(float *)((char *)v110 + v14) = MaxPortalY - v16;
}
sub_100022B98(v109, (__int64)v110);
if ( m_isSideways )
v17 = 12;
else
v17 = 8;
*(_DWORD *)((char *)v109 + v17) = *(_DWORD *)&v112[v17 - 8];
*((_DWORD *)v109 + m_isSideways) = *(_DWORD *)&v112[4 * m_isSideways - 8];
sub_100022B98(v108, (__int64)v109);
*(float *)((char *)v108 + v17) = *(float *)((char *)v108 + v17) + 4.0;
v18 = *(float *)((char *)v110 + v17);
*(float *)((char *)v109 + v17) = v11;
*((float *)v109 + m_isSideways) = *((float *)v109 + m_isSideways) + (float)((float)(v18 - v11) * 0.5);
if ( a1->m_isPlatformer )
{
*(float *)((char *)v110 + v17) = v18 + -2.0;
*((float *)v110 + m_isSideways) = *((float *)v110 + m_isSideways) + 1.0;
}
else
{
v19 = *(float *)&v112[v17 - 8] * 0.5;
*(float *)((char *)v110 + v17) = v19 + 1.0;
v20 = *(float *)&v112[4 * m_isSideways - 8];
if ( a1->m_isGoingLeft )
{
v19 = v20 - v19;
v20 = -1.0;
}
*((float *)v110 + m_isSideways) = v19 + v20;
}
m_gameLayer = a1->m_gameLayer;
v22 = sub_100022B98(v107, (__int64)v110);
v114.origin.x = *(float *)&v22;
v114.origin.y = v91;
v114.size.width = v92;
v114.size.height = v93;
v23 = GJBaseGameLayer::staticObjectsInRect(m_gameLayer, v114, (bool)v107);
v24 = a1->m_gameLayer;
v25 = sub_100022B98(v107, (__int64)v109);
v115.origin.x = *(float *)&v25;
v115.origin.y = v94;
v115.size.width = v95;
v115.size.height = v96;
v26 = GJBaseGameLayer::damagingObjectsInRect(v24, v115, (bool)v107);
v27 = (int (__cdecl *)(const void *, const void *))sub_100217530;
v28 = (int (__cdecl *)(const void *, const void *))sub_100217468;
if ( a1->m_isUpsideDown )
{
v27 = (int (__cdecl *)(const void *, const void *))sub_100217594;
v28 = (int (__cdecl *)(const void *, const void *))sub_1002174CC;
}
if ( a1->m_isSideways )
v29 = v27;
else
v29 = v28;
if ( (unsigned int)sub_10024A36C(v23) )
{
if ( !v3 )
goto LABEL_52;
goto LABEL_51;
}
if ( (unsigned int)sub_10024A36C(v26) || v3 )
{
LABEL_51:
v30 = a1->m_gameLayer;
v31 = sub_100022B98(v107, (__int64)v108);
LOBYTE(v3) = 1;
v116.origin.x = *(float *)&v31;
v116.origin.y = v97;
v116.size.width = v98;
v116.size.height = v99;
v23 = GJBaseGameLayer::staticObjectsInRect(v30, v116, (bool)v107);
goto LABEL_52;
}
LOBYTE(v3) = 0;
LABEL_52:
if ( (unsigned int)sub_10024A36C(v23) )
qsort(v23->data->arr, v23->data->num, 8u, v29);
if ( (unsigned int)sub_10024A36C(v26) )
qsort(v26->data->arr, v26->data->num, 8u, v29);
v32 = sub_10024A36C(v23);
v33 = v32;
if ( v32 )
{
v101 = v32;
v102 = v3;
v103 = v26;
v100 = MinPortalY;
v34 = sub_100022B98(v107, (__int64)&v111);
v35 = (__int64 *)((__int64 (__fastcall *)(PlayerObject *, double))a1->getPosition)(a1, v34);
sub_1000229B8(&v106, v35);
if ( !(unsigned int)sub_10024A36C(v23) )
{
v37 = 0.0;
LABEL_131:
v47 = 0.0;
goto LABEL_132;
}
v36 = 0;
v37 = 0.0;
if ( m_isSideways )
v38 = 0;
else
v38 = 4;
if ( m_isSideways )
v39 = 8;
else
v39 = 12;
while ( 1 )
{
v40 = (GameObject *)sub_10024A388(v23, v36);
m_isUpsideDown = a1->m_isUpsideDown;
v42 = (float *)((__int64 (__fastcall *)(GameObject *))v40->getObjectRect)(v40);
if ( m_isUpsideDown )
{
if ( m_isSideways )
{
v43 = sub_100022C30(v42);
v44 = (float *)v112;
}
else
{
v43 = sub_100022C48((__int64)v42);
v44 = (float *)v113;
}
v46 = *v44 * 0.5;
}
else
{
if ( m_isSideways )
{
v43 = sub_100022C40((__int64)v42);
v45 = (float *)v112;
}
else
{
v43 = sub_100022C58((__int64)v42);
v45 = (float *)v113;
}
v46 = *v45 * -0.5;
}
v47 = v43 + v46;
if ( ((unsigned int (__fastcall *)(GameObject *))v40->getType)(v40) == 25 )
{
((void (__fastcall *)(__int64 *__return_ptr, GameObject *))v40->getRealPosition)(v104, v40);
if ( a1->m_isSideways )
PlayerObject::rotateGameplayObject(a1, v40);
v48 = GameObject::slopeFloorTop(v40);
v49 = a1->m_isUpsideDown;
v50 = v49 != v48;
if ( v49 != v48 )
{
v51 = GameObject::slopeYPos(v40, *(float *)&v106);
((void (__fastcall *)(__int64 *__return_ptr, GameObject *))v40->getRealPosition)(&v105, v40);
v53 = 12;
if ( m_isSideways )
v53 = 8;
v52 = v51 - *((float *)&v105 + 1);
v54 = *(float *)((char *)v104 + v38) + v52;
v55 = -1.0;
if ( a1->m_isUpsideDown )
v55 = 1.0;
v47 = v54 + (float)((float)(*(float *)&v112[v53 - 8] * 0.5) * v55);
}
if ( a1->m_isSideways )
PlayerObject::unrotateGameplayObject(a1, v40);
}
else
{
v50 = 0;
}
v56 = (float *)&v106 + 1;
if ( m_isSideways )
v56 = (float *)&v106;
v57 = *v56;
if ( !a1->m_isUpsideDown )
break;
if ( v47 <= (float)(v57 + 10.0) )
goto LABEL_91;
LABEL_124:
v36 = (unsigned int)(v36 + 1);
if ( (unsigned int)v36 >= (unsigned int)sub_10024A36C(v23) )
goto LABEL_131;
}
if ( v47 < (float)(v57 + -10.0) )
goto LABEL_124;
LABEL_91:
m_isPlatformer = a1->m_isPlatformer;
if ( !v50 || !m_isPlatformer )
{
if ( m_isPlatformer )
goto LABEL_132;
if ( a1->m_isGoingLeft )
goto LABEL_99;
v59 = ((__int64 (__fastcall *)(GameObject *))v40->getObjectRect)(v40);
if ( m_isSideways )
{
v60 = sub_100022C58(v59);
v61 = (float *)&v106 + 1;
}
else
{
v60 = sub_100022C40(v59);
v61 = (float *)&v106;
}
if ( v60 <= *v61 )
{
if ( !a1->m_isGoingLeft )
goto LABEL_132;
LABEL_99:
v62 = (float *)((__int64 (__fastcall *)(GameObject *))v40->getObjectRect)(v40);
if ( m_isSideways )
{
v63 = sub_100022C48((__int64)v62);
v64 = (float *)&v106 + 1;
}
else
{
v63 = sub_100022C30(v62);
v64 = (float *)&v106;
}
if ( v63 >= *v64 )
goto LABEL_132;
}
}
if ( !(unsigned int)sub_10024A36C(v23) )
goto LABEL_132;
v65 = 0;
v66 = 1;
while ( 1 )
{
v67 = sub_10024A388(v23, v65);
if ( (_DWORD)v36 != (_DWORD)v65 )
{
v68 = 12;
if ( m_isSideways )
v68 = 8;
*(float *)((char *)v107 + v38) = v47 + (float)(*(float *)&v112[v68 - 8] * -0.5);
v69 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v67 + 1312LL))(v67);
sub_100022B98(v104, v69);
if ( !v50 )
{
*(float *)((char *)v104 + v39) = *(float *)((char *)v104 + v39) + -4.0;
*(float *)((char *)v104 + v38) = *(float *)((char *)v104 + v38) + 2.0;
}
v70 = sub_100022CB0((float *)v104, (float *)v107);
if ( v50 && v70 )
{
v66 = 0;
if ( v37 == 0.0 )
{
v37 = v47;
if ( v70 )
goto LABEL_123;
}
else
{
if ( a1->m_isUpsideDown )
v71 = v47 > v37;
else
v71 = v47 < v37;
if ( v71 )
v37 = v47;
if ( v70 )
{
LABEL_123:
if ( (v66 & 1) == 0 )
goto LABEL_124;
LABEL_132:
v26 = v103;
v33 = v101;
LOBYTE(v3) = v102;
LABEL_133:
v74 = 0.0;
if ( a1->m_isPlatformer )
v74 = v37;
if ( v74 == 0.0 )
{
if ( v47 == 0.0 )
{
v77 = 12;
if ( m_isSideways )
v77 = 8;
v78 = *(float *)&v112[v77 - 8] * 0.5;
if ( a1->m_isUpsideDown )
v47 = v100 + v78;
else
v47 = MaxPortalY - v78;
}
}
else
{
if ( a1->m_isUpsideDown )
v75 = v74 > v47;
else
v75 = v74 < v47;
if ( v75 )
v76 = v74;
else
v76 = v47;
if ( v76 == 0.0 )
v47 = v74;
else
v47 = v76;
}
if ( v33 )
goto LABEL_157;
goto LABEL_166;
}
}
}
else
{
v66 &= !v70;
if ( v70 )
goto LABEL_123;
}
}
v65 = (unsigned int)(v65 + 1);
if ( (unsigned int)v65 >= (unsigned int)sub_10024A36C(v23) )
goto LABEL_123;
}
}
if ( (unsigned int)sub_10024A36C(v26) )
{
v100 = MinPortalY;
v72 = sub_10024A388(v26, 0);
(*(void (__fastcall **)(__int64 *__return_ptr))(*(_QWORD *)v72 + 1344LL))(v107);
v73 = 4;
if ( m_isSideways )
v73 = 0;
v47 = *(float *)((char *)v107 + v73);
v37 = 0.0;
goto LABEL_133;
}
v79 = 12;
if ( m_isSideways )
v79 = 8;
v80 = *(float *)&v112[v79 - 8] * 0.5;
if ( a1->m_isUpsideDown )
v47 = MinPortalY + v80;
else
v47 = MaxPortalY - v80;
LABEL_157:
if ( !(unsigned int)sub_10024A36C(v26) )
goto LABEL_166;
v81 = sub_10024A388(v26, 0);
(*(void (__fastcall **)(__int64 *__return_ptr))(*(_QWORD *)v81 + 1344LL))(v107);
v82 = 4;
if ( m_isSideways )
v82 = 0;
v83 = *(float *)((char *)v107 + v82);
if ( a1->m_isUpsideDown )
v84 = v83 <= v47;
else
v84 = v83 >= v47;
if ( !v84 )
v47 = v83;
if ( !v3 && !v84 )
{
PlayerObject::spiderTestJumpInternal(a1, 1);
}
else
{
LABEL_166:
v85 = (__int64 *)((__int64 (__fastcall *)(PlayerObject *))a1->getPosition)(a1);
sub_1000229B8(v107, v85);
v86.n128_f32[0] = sub_1000229B8(v104, v107);
if ( m_isSideways )
v87 = 0;
else
v87 = 4;
*(float *)((char *)v104 + v87) = v47;
((void (__fastcall *)(PlayerObject *, __int64 *, __n128))a1->setPosition)(a1, v104, v86);
PlayerObject::flipGravity(a1, !a1->m_isUpsideDown, 1);
v88 = -1.0;
if ( a1->m_isUpsideDown )
v88 = 1.0;
v89 = (double)(int)v88;
if ( v88 != v89 )
v88 = round((v88 - v89) * 1000.0) / 1000.0 + v89;
a1->m_yVelocity = v88;
a1->m_isOnGround3 = 0;
a1->m_jumpBuffered = 0;
PlayerObject::resetCollisionLog(a1, 1);
*(float *)((char *)&a1->m_position.x + v87) = *(float *)((char *)v104 + v87);
a1->m_lastSpiderFlipTime = a1->m_totalTime;
sub_1000229B8(&v106, v107);
v117.x = sub_1000229B8(&v105, v104);
PlayerObject::playSpiderDashEffect(a1, v117, v118);
if ( v6 )
{
v90 = a1->m_gameLayer;
if ( v90 )
GJBaseGameLayer::checkCameraLimitAfterTeleport(v90, a1, 60.0);
}
}
}