//
// PlayerObject::postCollision from 0x14038d580 to 0x14038f135 (7093 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::checkCollisions @ 0x1402148ef
// > ??> @ 0x1406d60bc
//
// 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!
// Hidden C++ exception states: #wind=18
void PlayerObject::postCollision(PlayerObject *a1, float a2, bool a3)
{
__int64 v3; // rdx
bool m_holdingLeft; // r14
bool m_holdingRight; // r15
GameObject *m_lastGroundObject; // rcx
GameObject *v8; // rax
GameObject *m_currentSlope2; // rcx
bool m_isOnSlope; // cl
GameObject *m_currentSlope; // rax
int v12; // r12d
float v13; // xmm12_4
double m_totalTime; // xmm2_8
bool m_isUpsideDown; // bl
float v16; // xmm0_4
float v17; // xmm0_4
float m_slopeVelocity; // xmm0_4
float v19; // xmm0_4
char v20; // al
double v21; // xmm2_8
double v22; // xmm1_8
float v23; // xmm6_4
float m_slopeAngle; // xmm8_4
float v25; // xmm7_4
bool m_isPlatformer; // si
double v27; // xmm1_8
int v28; // eax
bool m_isCurrentSlopeTop; // al
bool v30; // cf
bool v31; // zf
double m_yVelocity; // xmm0_8
float v33; // xmm6_4
bool v34; // cl
int v35; // eax
double v36; // xmm1_8
double v37; // xmm7_8
const struct cocos2d::CCRect *v38; // rax
char v39; // bl
float v40; // xmm7_4
float y; // xmm2_4
double m_collidedTopMinY; // xmm1_8
double v43; // xmm1_8
GameObject *v44; // rcx
float height; // xmm1_4
const struct cocos2d::CCRect *v46; // rax
double v47; // xmm0_8
int v48; // esi
GameObject *v49; // rcx
int m_slopeDirection; // ecx
PlayerObject_vtbl *v51; // rbx
const cocos2d::CCPoint *v52; // rax
GJBaseGameLayer *m_gameLayer; // rbx
const struct cocos2d::CCRect *v54; // rax
float v55; // xmm6_4
int v56; // r13d
float v57; // xmm7_4
double v58; // xmm0_8
cocos2d::CCRect *v59; // rax
cocos2d::CCArray *v60; // rax
char v61; // r14
char v62; // r15
cocos2d::ccArray *data; // rsi
__int64 num; // rax
cocos2d::CCObject **arr; // rsi
cocos2d::CCObject **v66; // r12
cocos2d::CCObject *v67; // rbx
bool v68; // zf
__int64 v69; // rcx
PlayerObject_vtbl *v70; // rbx
float v71; // xmm7_4
const cocos2d::CCPoint *v72; // rax
cocos2d::CCArray *v73; // rsi
unsigned int v74; // ebx
struct cocos2d::CCObject *v75; // rax
const struct cocos2d::CCRect *v76; // rax
float v77; // xmm6_4
float v78; // xmm7_4
const cocos2d::CCPoint *v79; // rax
double x; // xmm0_8
double m_collidedRightMinX; // xmm1_8
bool v82; // cc
__int64 v83; // rcx
double m_collidedLeftMaxX; // xmm1_8
GJBaseGameLayer *v85; // r13
const struct cocos2d::CCRect *v86; // rax
float v87; // xmm6_4
float v88; // xmm7_4
double v89; // xmm0_8
cocos2d::CCRect *v90; // rax
cocos2d::CCArray *v91; // rax
char v92; // r15
char v93; // r14
cocos2d::ccArray *v94; // rsi
__int64 v95; // rax
cocos2d::CCObject **v96; // rsi
cocos2d::CCObject **v97; // r12
cocos2d::CCObject *v98; // rbx
bool v99; // zf
__int64 v100; // rcx
PlayerObject_vtbl *v101; // rbx
const cocos2d::CCPoint *v102; // rax
const cocos2d::CCPoint *v103; // rax
cocos2d::CCArray *v104; // rsi
unsigned int v105; // ebx
struct cocos2d::CCObject *v106; // rax
char v107; // r14
GameObject *v108; // rax
GameObject *m_preLastGroundObject; // rbx
float v110; // xmm6_4
const cocos2d::CCPoint *v111; // rax
float v112; // xmm0_4
double v113; // xmm0_8
float v114; // xmm1_4
const cocos2d::CCPoint *v115; // rax
GameObject *v116; // rax
float v117; // xmm0_4
char m_platformerMovingLeft; // r10
char m_platformerMovingRight; // r9
char v120; // dl
char v121; // r8
char v122; // si
GameObject *v123; // rdx
float v124; // xmm3_4
float v125; // xmm1_4
float v126; // xmm2_4
GameObject *m_collidedObject; // rbx
float v128; // xmm13_4
float v129; // xmm12_4
const struct cocos2d::CCRect *v130; // rax
const struct cocos2d::CCRect *v131; // rax
bool m_isSideways; // al
float v133; // xmm0_4
bool v134; // si
float MinY; // xmm0_4
float MinX; // xmm6_4
float MaxX; // xmm0_4
bool v138; // al
cocos2d::CCRect *v139; // rax
char v140; // bl
GameObject *v141; // rdx
GameObject *v142; // rsi
cocos2d::CCRect *v143; // rax
double m_yVelocityRelated; // xmm2_8
float v145; // xmm10_4
double m_groundYVelocity; // xmm3_8
float v147; // xmm1_4
double v148; // xmm2_8
double m_scaleXRelated3; // xmm2_8
float v150; // xmm1_4
float v151; // xmm1_4
double v152; // xmm0_8
double m_scaleXRelated5; // xmm1_8
double m_scaleXRelated4; // xmm2_8
float v155; // xmm0_4
GameObject **p_m_collidingWithLeft; // rdx
GameObject *m_collidingWithLeft; // r9
GameObject **p_m_collidingWithRight; // r8
double v159; // xmm1_8
GameObject **v160; // rcx
double *p_m_platformerXVelocity; // rax
double m_scaleXRelated2; // xmm1_8
double v163; // xmm1_8
GJBaseGameLayer *v164; // rcx
GJBaseGameLayer *v165; // rcx
bool v166; // cc
GJBaseGameLayer *v167; // rcx
GJBaseGameLayer *v168; // rcx
GJBaseGameLayer *v169; // rcx
cocos2d::CCRect v170; // [rsp+40h] [rbp-C0h] BYREF
cocos2d::CCRect v171; // [rsp+50h] [rbp-B0h] BYREF
cocos2d::CCRect v172; // [rsp+60h] [rbp-A0h] BYREF
cocos2d::CCRect v173; // [rsp+70h] [rbp-90h] BYREF
cocos2d::CCRect v174; // [rsp+80h] [rbp-80h] BYREF
cocos2d::CCRect v175; // [rsp+90h] [rbp-70h] BYREF
cocos2d::CCRect v176[11]; // [rsp+A0h] [rbp-60h] BYREF
float v177; // [rsp+190h] [rbp+90h]
void *v178; // [rsp+190h] [rbp+90h]
void *v180; // [rsp+1A8h] [rbp+A8h] BYREF
v177 = a2 * 4.0;
if ( !a1->m_enableImpulseFix )
{
if ( a3 )
v177 = 0.5;
else
v177 = 1.0;
}
m_holdingLeft = a1->m_holdingLeft;
m_holdingRight = a1->m_holdingRight;
if ( m_holdingLeft && m_holdingRight )
{
if ( a1->m_leftPressedFirst )
m_holdingRight = 0;
else
m_holdingLeft = 0;
}
m_lastGroundObject = a1->m_lastGroundObject;
v8 = m_lastGroundObject;
if ( m_lastGroundObject && m_lastGroundObject->m_isGroupDisabled )
{
a1->m_lastGroundObject = nullptr;
v8 = nullptr;
}
m_currentSlope2 = a1->m_currentSlope2;
if ( m_currentSlope2 && m_currentSlope2->m_isGroupDisabled )
a1->m_currentSlope2 = nullptr;
if ( v8 )
a1->m_isOnIce = v8->m_isIceBlock;
m_isOnSlope = a1->m_isOnSlope;
if ( m_isOnSlope )
{
m_currentSlope = a1->m_currentSlope;
if ( m_currentSlope )
{
if ( !a1->m_maybeUpsideDownSlope )
a1->m_isOnIce = m_currentSlope->m_isIceBlock;
}
}
v12 = 1;
LODWORD(v180) = 1;
v13 = 5.0;
if ( m_isOnSlope != a1->m_wasOnSlope )
{
if ( a1->m_isDart )
PlayerObject::placeStreakPoint(a1);
if ( !a1->m_isOnSlope )
{
m_totalTime = a1->m_totalTime;
a1->m_slopeEndTime = m_totalTime;
m_isUpsideDown = a1->m_isUpsideDown;
if ( m_isUpsideDown )
{
m_slopeVelocity = a1->m_slopeVelocity;
if ( m_slopeVelocity >= 0.0 || a1->m_yVelocity <= m_slopeVelocity || !a1->m_isCurrentSlopeTop )
{
v19 = a1->m_slopeVelocity;
if ( v19 <= 0.0 || v19 <= a1->m_yVelocity || a1->m_isCurrentSlopeTop )
goto LABEL_41;
}
}
else
{
v16 = a1->m_slopeVelocity;
if ( v16 >= 0.0 || a1->m_yVelocity <= v16 || !a1->m_isCurrentSlopeTop )
{
v17 = a1->m_slopeVelocity;
if ( v17 <= 0.0 || v17 <= a1->m_yVelocity || a1->m_isCurrentSlopeTop )
{
LABEL_41:
v20 = 0;
LABEL_42:
if ( (!a1->m_maybeIsBoosted || a1->m_isShip || a1->m_isBird || a1->m_isDart || a1->m_isSwing || a1->m_isBall)
&& v20 )
{
v21 = m_totalTime - a1->m_slopeStartTime;
v22 = 1.0;
if ( v21 < 0.1000000014901161 )
v22 = fmax(0.4000000059604645, v21 * 10.0);
v23 = a1->m_slopeVelocity * v22;
m_slopeAngle = a1->m_slopeAngle;
v25 = cosf(m_slopeAngle) * 5.0;
m_isPlatformer = a1->m_isPlatformer;
if ( m_isPlatformer )
{
v27 = fabs(tanf(m_slopeAngle) * a1->m_platformerXVelocity) * 1.100000023841858;
v28 = 1;
if ( v23 < 0.0 )
v28 = -1;
v23 = v27 * (double)v28;
}
m_isCurrentSlopeTop = a1->m_isCurrentSlopeTop;
if ( m_isUpsideDown )
{
if ( !m_isCurrentSlopeTop && a1->m_slopeFlipGravityRelated )
{
v30 = v23 < a1->m_yVelocity;
v31 = v23 == a1->m_yVelocity;
goto LABEL_63;
}
}
else if ( !m_isCurrentSlopeTop || !a1->m_slopeFlipGravityRelated )
{
v30 = v23 < a1->m_yVelocity;
v31 = v23 == a1->m_yVelocity;
LABEL_63:
if ( !v30
&& !v31
&& (!m_isPlatformer
|| (m_holdingLeft || m_holdingRight) && fabs(a1->m_platformerXVelocity) >= (float)(v25 - 1.0)) )
{
PlayerObject::boostPlayer(a1, v23);
}
goto LABEL_69;
}
m_yVelocity = a1->m_yVelocity;
v30 = m_yVelocity < v23;
v31 = m_yVelocity == v23;
goto LABEL_63;
}
v34 = a1->m_isUpsideDown;
if ( v34 )
{
if ( a1->m_slopeVelocity <= 0.0 )
goto LABEL_69;
}
else if ( a1->m_slopeVelocity >= 0.0 )
{
LABEL_69:
if ( a1->m_maybeSlopeForce > 0.0
&& (m_holdingLeft && a1->m_isSlidingRight || m_holdingRight && !a1->m_isSlidingRight) )
{
a1->m_isSliding = 0;
a1->m_maybeSlopeForce = 0.0;
a1->m_isMoving = 1;
}
a1->m_currentSlopeYVelocity = 0.0;
a1->m_slopeVelocity = 0.0;
a1->m_slopeRotation = 0.0;
a1->m_currentSlope = nullptr;
goto LABEL_76;
}
if ( !a1->m_maybeIsBoosted && !a1->m_jumpBuffered && !a1->m_stateRingJump && a1->m_isCurrentSlopeTop == v34 )
{
a1->m_isOnGround2 = 0;
v35 = -1;
if ( !v34 )
v35 = 1;
v36 = (double)v35 * -a1->m_currentSlopeYVelocity;
v37 = (double)(int)v36;
if ( v36 != v37 )
v36 = round((v36 - v37) * 1000.0) / 1000.0 + v37;
a1->m_yVelocity = v36;
a1->m_isOnGround = 0;
if ( !a1->m_isLocked && !a1->m_isDashing )
{
*(_WORD *)&a1->m_isRotating = 0;
a1->m_isBallRotating = 0;
a1->m_rotationSpeed = 0.0;
if ( a1->m_isBall )
PlayerObject::runBallRotation(a1, 1.0);
else
PlayerObject::runNormalRotation(a1, 0, 1.0);
}
}
goto LABEL_69;
}
}
}
v20 = 1;
goto LABEL_42;
}
}
LABEL_76:
if ( a1->m_collidedTopMinY == 0.0 || a1->m_collidedBottomMaxY == 0.0 || a1->m_disablePlayerSqueeze )
goto LABEL_152;
if ( a1->m_isPlatformer )
v33 = 0.80000001;
else
v33 = 0.69999999;
v38 = (const struct cocos2d::CCRect *)((__int64 (__fastcall *)(PlayerObject *, __int64, bool))a1->getObjectRect_0)(
a1,
v3,
a3);
cocos2d::CCRect::CCRect(&v174, v38);
v39 = 0;
v40 = fabs(a1->m_collidedTopMinY - a1->m_collidedBottomMaxY);
y = a1->getPosition_0(a1)->y;
if ( v40 == 0.0 )
goto LABEL_106;
if ( !a1->m_isUpsideDown )
{
m_collidedTopMinY = a1->m_collidedTopMinY;
if ( y <= m_collidedTopMinY || a1->m_lastPosition.y <= m_collidedTopMinY )
goto LABEL_107;
LABEL_106:
v39 = 1;
goto LABEL_107;
}
v43 = a1->m_collidedTopMinY;
if ( v43 > y && v43 > a1->m_lastPosition.y )
goto LABEL_106;
LABEL_107:
if ( !a1->m_isPlatformer || (v44 = a1->m_currentSlope) == nullptr )
{
LABEL_122:
height = v174.size.height;
goto LABEL_123;
}
height = v174.size.height;
if ( v40 >= (float)(v174.size.height * v33) && v174.size.height >= v40 )
{
v46 = v44->getObjectRect_0(v44);
v47 = cocos2d::CCRect::CCRect(&v175, v46);
if ( cocos2d::CCRect::intersectsRect(&v174, &v175) )
{
v48 = 1;
v49 = a1->m_currentSlope;
v31 = !v49->m_slopeUphill;
m_slopeDirection = v49->m_slopeDirection;
if ( v31 )
{
if ( m_slopeDirection != 1 && (((m_slopeDirection - 3) & 0xFFFFFFFC) != 0 || m_slopeDirection == 4) )
goto LABEL_121;
}
else if ( m_slopeDirection == 1 || ((m_slopeDirection - 3) & 0xFFFFFFFC) == 0 && m_slopeDirection != 4 )
{
goto LABEL_121;
}
v48 = -1;
LABEL_121:
a1->m_platformerXVelocity = 0.0;
v51 = a1->GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->getPosition_0(a1);
cocos2d::CCPoint::CCPoint(*(float *)&v47, (float)((float)v48 * a2) + a1->m_lastPosition.x);
v51->setPosition_0(a1, v52);
goto LABEL_152;
}
goto LABEL_122;
}
LABEL_123:
if ( !v39 && (float)(height * v33) > v40 )
{
if ( a1->m_isPlatformer )
{
m_gameLayer = a1->m_gameLayer;
v171.origin = (cocos2d::CCPoint)m_gameLayer;
v54 = a1->getObjectRect_0(a1);
cocos2d::CCRect::CCRect(&v170, v54);
v170.origin.x = v170.origin.x + 1.0;
v170.origin.y = v170.origin.y + -1.0;
v170.size.width = v170.size.width + -2.0;
v170.size.height = v170.size.height + 2.0;
v55 = a1->getPosition_0(a1)->y;
v56 = 1;
while ( 2 )
{
v57 = ceilf((float)v56 * 0.5) * 3.0;
cocos2d::CCRect::CCRect(&v173, &v170);
if ( (v56 & 1) == 0 )
v57 = -v57;
v173.origin.x = v173.origin.x + v57;
v58 = cocos2d::CCRect::CCRect(v176, &v173);
v60 = GJBaseGameLayer::staticObjectsInRect(m_gameLayer, v59, 0);
v61 = 0;
v62 = 0;
if ( !v60
|| (data = v60->data, num = data->num, !(_DWORD)num)
|| (arr = data->arr, v66 = &arr[num - 1], arr > v66) )
{
LABEL_150:
v70 = a1->GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->getPosition_0(a1);
v71 = v57 + a1->getPosition_0(a1)->x;
cocos2d::CCPoint::CCPoint(*(float *)&v58, v71);
v70->setPosition_0(a1, v72);
v12 = 1;
goto LABEL_152;
}
do
{
v67 = *arr;
if ( !*arr )
break;
if ( v55 <= *(float *)(((__int64 (__fastcall *)(cocos2d::CCObject *))v67->__vftable[2].getTag)(*arr) + 4) )
{
LODWORD(v58) = *(_DWORD *)(((__int64 (__fastcall *)(cocos2d::CCObject *))v67->__vftable[2].getTag)(v67) + 4);
if ( *(float *)&v58 <= v55 )
goto LABEL_141;
v61 = 1;
v68 = v62 == 0;
}
else
{
v62 = 1;
v68 = v61 == 0;
}
if ( !v68 )
goto LABEL_141;
++arr;
}
while ( arr <= v66 );
if ( !v61 || !v62 )
goto LABEL_150;
LABEL_141:
++v56;
m_gameLayer = (GJBaseGameLayer *)v171.origin;
if ( v56 <= 8 )
continue;
break;
}
v12 = 1;
}
if ( a1->m_ignoreDamage )
goto LABEL_158;
if ( !a1->m_playEffects )
a1->setPosition_0(a1, &a1->m_lastPosition);
if ( a1->m_maybeCanRunIntoBlocks )
{
a1->m_maybeIsColliding = 1;
}
else
{
v69 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v172.origin = (cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v172.origin);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v69 = qword_1406C2ED8;
}
(*(void (__fastcall **)(_QWORD, PlayerObject *, _QWORD))(**(_QWORD **)(v69 + 520) + 1128LL))(
*(_QWORD *)(v69 + 520),
a1,
0);
}
}
LABEL_152:
if ( !a1->m_ignoreDamage )
{
if ( cocos2d::CCDictionary::count(a1->m_collisionLogTop) )
{
if ( cocos2d::CCDictionary::count(a1->m_collisionLogBottom) )
{
v73 = cocos2d::CCDictionary::allKeys(a1->m_collisionLogTop);
v74 = 0;
if ( cocos2d::CCArray::count(v73) )
{
while ( 1 )
{
v75 = cocos2d::CCArray::objectAtIndex(v73, v74);
if ( cocos2d::CCDictionary::objectForKey(a1->m_collisionLogBottom, SLODWORD(v75[1].__vftable)) )
break;
if ( ++v74 >= cocos2d::CCArray::count(v73) )
goto LABEL_158;
}
a1->setPosition_0(a1, &a1->m_lastPosition);
if ( !a1->m_maybeCanRunIntoBlocks )
{
v83 = qword_1406C2ED8;
if ( qword_1406C2ED8 )
{
LABEL_168:
(*(void (__fastcall **)(_QWORD, PlayerObject *, _QWORD))(**(_QWORD **)(v83 + 520) + 1128LL))(
*(_QWORD *)(v83 + 520),
a1,
0);
return;
}
LABEL_167:
v178 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v178);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v83 = qword_1406C2ED8;
goto LABEL_168;
}
LABEL_169:
a1->m_maybeIsColliding = 1;
return;
}
}
}
}
LABEL_158:
if ( !a1->m_isPlatformer )
goto LABEL_209;
if ( a1->m_collidedLeftMaxX == 0.0 )
goto LABEL_199;
if ( a1->m_collidedRightMinX == 0.0 )
goto LABEL_199;
v76 = a1->getObjectRect_0(a1);
cocos2d::CCRect::CCRect(&v175, v76);
v77 = v175.size.width - (float)(a1->m_vehicleSize * 5.0);
v78 = fabs(a1->m_collidedRightMinX - a1->m_collidedLeftMaxX);
v79 = a1->getPosition_0(a1);
if ( v78 == 0.0 )
goto LABEL_199;
x = v79->x;
if ( a1->m_platformerXVelocity < 0.0 )
{
m_collidedLeftMaxX = a1->m_collidedLeftMaxX;
if ( m_collidedLeftMaxX > x )
{
v82 = m_collidedLeftMaxX <= a1->m_lastPosition.x;
LABEL_172:
if ( !v82 )
goto LABEL_199;
}
}
else
{
m_collidedRightMinX = a1->m_collidedRightMinX;
if ( x > m_collidedRightMinX )
{
v82 = a1->m_lastPosition.x <= m_collidedRightMinX;
goto LABEL_172;
}
}
if ( v77 > v78 )
{
if ( a1->m_isPlatformer )
{
v85 = a1->m_gameLayer;
v86 = a1->getObjectRect_0(a1);
cocos2d::CCRect::CCRect(&v170, v86);
v170.origin.x = v170.origin.x + -1.0;
v170.origin.y = v170.origin.y + 1.0;
v170.size.width = v170.size.width + 2.0;
v170.size.height = v170.size.height + -2.0;
v87 = a1->getPosition_0(a1)->x;
while ( 2 )
{
v88 = ceilf((float)v12 * 0.5) * 3.0;
cocos2d::CCRect::CCRect(&v173, &v170);
if ( (v12 & 1) == 0 )
v88 = -v88;
v173.origin.y = v173.origin.y + v88;
v89 = cocos2d::CCRect::CCRect(v176, &v173);
v91 = GJBaseGameLayer::staticObjectsInRect(v85, v90, 0);
v92 = 0;
v93 = 0;
if ( !v91 || (v94 = v91->data, v95 = v94->num, !(_DWORD)v95) || (v96 = v94->arr, v97 = &v96[v95 - 1], v96 > v97) )
{
LABEL_197:
v101 = a1->GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->getPosition_0(a1);
v102 = a1->getPosition_0(a1);
cocos2d::CCPoint::CCPoint(*(float *)&v89, v102->x);
v101->setPosition_0(a1, v103);
goto LABEL_199;
}
do
{
v98 = *v96;
if ( !*v96 )
break;
if ( v87 <= *(float *)((__int64 (__fastcall *)(cocos2d::CCObject *))v98->__vftable[2].getTag)(*v96) )
{
LODWORD(v89) = *(_DWORD *)(((__int64 (__fastcall *)(cocos2d::CCObject *))v98->__vftable[2].getTag)(v98) + 4);
if ( *(float *)&v89 <= v87 )
goto LABEL_190;
v93 = 1;
v99 = v92 == 0;
}
else
{
v92 = 1;
v99 = v93 == 0;
}
if ( !v99 )
goto LABEL_190;
++v96;
}
while ( v96 <= v97 );
if ( !v92 || !v93 )
goto LABEL_197;
LABEL_190:
v12 = (_DWORD)v180 + 1;
LODWORD(v180) = v12;
if ( v12 <= 8 )
continue;
break;
}
}
if ( !a1->m_playEffects )
a1->setPosition_0(a1, &a1->m_lastPosition);
if ( a1->m_maybeCanRunIntoBlocks )
{
a1->m_maybeIsColliding = !a1->m_ignoreDamage;
}
else
{
v100 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v180 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v180);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v100 = qword_1406C2ED8;
}
(*(void (__fastcall **)(_QWORD, PlayerObject *, _QWORD))(**(_QWORD **)(v100 + 520) + 1128LL))(
*(_QWORD *)(v100 + 520),
a1,
0);
}
}
LABEL_199:
if ( !a1->m_ignoreDamage )
{
if ( cocos2d::CCDictionary::count(a1->m_collisionLogLeft) )
{
if ( cocos2d::CCDictionary::count(a1->m_collisionLogRight) )
{
v104 = cocos2d::CCDictionary::allKeys(a1->m_collisionLogLeft);
v105 = 0;
if ( cocos2d::CCArray::count(v104) )
{
while ( 1 )
{
v106 = cocos2d::CCArray::objectAtIndex(v104, v105);
if ( cocos2d::CCDictionary::objectForKey(a1->m_collisionLogRight, SLODWORD(v106[1].__vftable)) )
break;
if ( ++v105 >= cocos2d::CCArray::count(v104) )
goto LABEL_209;
}
a1->setPosition_0(a1, &a1->m_lastPosition);
if ( !a1->m_maybeCanRunIntoBlocks )
{
v83 = qword_1406C2ED8;
if ( qword_1406C2ED8 )
goto LABEL_168;
goto LABEL_167;
}
goto LABEL_169;
}
}
}
}
LABEL_209:
v107 = 0;
if ( !a1->m_isPlatformer )
goto LABEL_248;
v108 = a1->m_currentSlope2;
if ( v108 )
a1->m_preLastGroundObject = v108;
if ( a1->m_lastGroundObject || a1->m_preLastGroundObject )
{
if ( a1->m_isOnGround2 )
{
m_preLastGroundObject = a1->m_preLastGroundObject;
if ( !m_preLastGroundObject )
m_preLastGroundObject = a1->m_lastGroundObject;
}
else
{
if ( !a1->m_preLastGroundObject )
goto LABEL_228;
m_preLastGroundObject = a1->m_preLastGroundObject;
}
if ( !m_preLastGroundObject->m_isNonStickX )
{
cocos2d::CCPoint::CCPoint(&v171.origin);
((void (__fastcall *)(GameObject *, void **))m_preLastGroundObject->getRealPosition)(m_preLastGroundObject, &v180);
v110 = 0.0;
if ( m_preLastGroundObject->m_isScaleStick )
{
v110 = **(float **)&GameObject::getScalePosDelta(m_preLastGroundObject);
v111 = a1->getPosition_0(a1);
v112 = *(float *)&v180;
if ( *(float *)&v180 > v111->x )
v110 = v110 * -1.0;
}
else
{
v112 = *(float *)&v180;
}
if ( a1->m_isSideways )
{
v113 = (float)((float)(*((float *)&v180 + 1) - v171.origin.y) + v110);
v114 = 0.0;
}
else
{
v113 = (float)((float)(v112 - v171.origin.x) + v110);
v114 = v113;
}
a1->m_scaleXRelated = v113;
a1->m_scaleXRelated2 = v113;
cocos2d::CCPoint::CCPoint(*(float *)&v113, v114);
v115 = a1->getPosition_0(a1);
cocos2d::CCPoint::operator+(v115, &v172);
a1->setPosition_0(a1, (const cocos2d::CCPoint *)&v172);
v107 = 1;
a1->m_physDeltaRelated = (float)(a2 / 60.0) + a1->m_physDeltaRelated;
}
}
LABEL_228:
v116 = a1->m_currentSlope2;
if ( v116 && (a1->m_isOnSlope || a1->m_wasOnSlope) && !a1->m_maybeUpsideDownSlope && !v116->m_isGripSlope )
v117 = fabs(a1->m_slopeAngle * 57.29578);
else
v117 = 0.0;
if ( v117 > 40.0 )
{
m_platformerMovingLeft = a1->m_platformerMovingLeft;
m_platformerMovingRight = a1->m_platformerMovingRight;
if ( a1->m_slopeSlidingMaybeRotated )
{
if ( a1->m_isUpsideDown )
{
LABEL_238:
v120 = 1;
v121 = 0;
goto LABEL_239;
}
}
else if ( !a1->m_isUpsideDown )
{
goto LABEL_238;
}
v120 = 0;
v121 = 1;
LABEL_239:
a1->m_platformerMovingLeft = v121;
a1->m_platformerMovingRight = v120;
if ( m_platformerMovingLeft != v121 || m_platformerMovingRight != v120 )
a1->m_changedDirectionsTime = a1->m_totalTime;
a1->m_maybeChangedDirectionAngle = v117;
a1->m_maybeGoingCorrectSlopeDirection = 1;
goto LABEL_246;
}
*(_WORD *)&a1->m_platformerMovingLeft = 0;
LABEL_246:
if ( !a1->m_isOnGround2 )
a1->m_preLastGroundObject = nullptr;
LABEL_248:
v122 = 0;
v123 = a1->m_lastGroundObject;
if ( !v123 )
goto LABEL_261;
if ( a1->m_currentSlope2 )
goto LABEL_261;
if ( v123->m_isNonStickY )
goto LABEL_261;
cocos2d::CCPoint::CCPoint(&v171.origin);
((void (__fastcall *)(GameObject *, void **))a1->m_lastGroundObject->getRealPosition)(a1->m_lastGroundObject, &v180);
v124 = *(float *)(*(_QWORD *)&GameObject::getScalePosDelta(a1->m_lastGroundObject) + 4LL);
v125 = *(float *)&v180;
v126 = v171.origin.x;
if ( *(float *)&v180 == v171.origin.x && *((float *)&v180 + 1) == v171.origin.y && v124 == 0.0 )
goto LABEL_261;
if ( !a1->m_isSideways )
{
v125 = *((float *)&v180 + 1);
v126 = v171.origin.y;
}
if ( a1->m_isUpsideDown )
{
if ( (float)(v125 - v124) <= v126 )
goto LABEL_261;
goto LABEL_260;
}
if ( v126 > (float)(v125 + v124) )
LABEL_260:
v122 = 1;
LABEL_261:
if ( (!cocos2d::CCDictionary::count(a1->m_collisionLogBottom) || v122)
&& (a1->m_isCollidingWithSlope = 0,
m_collidedObject = a1->m_lastGroundObject,
a1->m_lastGroundObject = nullptr,
m_collidedObject)
&& v122 )
{
if ( a1->m_isPlatformer )
v13 = 10.0;
v128 = a2;
v129 = v13 * a2;
if ( m_collidedObject->m_isExtraSticky )
v129 = a2 * 20.0;
v130 = m_collidedObject->getObjectRect_0(m_collidedObject);
cocos2d::CCRect::CCRect(&v172, v130);
v131 = a1->getObjectRect_0(a1);
cocos2d::CCRect::CCRect(&v171, v131);
cocos2d::CCRect::CCRect(&v170, &v172);
m_isSideways = a1->m_isSideways;
if ( m_isSideways )
v170.size.width = v170.size.width + v129;
else
v170.size.height = v170.size.height + v129;
if ( a1->m_isUpsideDown )
{
if ( m_isSideways )
{
MinX = cocos2d::CCRect::getMinX(&v172);
MaxX = cocos2d::CCRect::getMaxX(&v171);
}
else
{
MinX = cocos2d::CCRect::getMinY(&v172);
MaxX = cocos2d::CCRect::getMaxY(&v171);
}
v134 = v129 > (float)(MinX - MaxX);
if ( a1->m_isSideways )
v170.origin.x = v170.origin.x - v129;
else
v170.origin.y = v170.origin.y - v129;
}
else if ( m_isSideways )
{
v133 = cocos2d::CCRect::getMinX(&v171);
v134 = v129 > (float)(v133 - cocos2d::CCRect::getMaxX(&v172));
}
else
{
MinY = cocos2d::CCRect::getMinY(&v171);
v134 = v129 > (float)(MinY - cocos2d::CCRect::getMaxY(&v172));
}
v138 = cocos2d::CCRect::intersectsRect(&v171, &v170);
if ( !v138 && a1->m_collidedObject )
{
v138 = 1;
m_collidedObject = a1->m_collidedObject;
}
if ( v134 && v138 )
{
a1->m_isCollidingWithSlope = 1;
cocos2d::CCRect::CCRect(v176, &stru_1406C2458);
PlayerObject::collidedWithObject(a1, 0.0, m_collidedObject, v139, 1);
}
}
else
{
v128 = a2;
}
v140 = 0;
v141 = a1->m_currentSlope2;
if ( v141 )
{
if ( !v141->m_isNonStickY )
{
cocos2d::CCPoint::CCPoint(&v171.origin);
((void (__fastcall *)(GameObject *, void **))a1->m_currentSlope2->getRealPosition)(a1->m_currentSlope2, &v180);
if ( *(float *)&v180 != v171.origin.x || *((float *)&v180 + 1) != v171.origin.y )
{
if ( a1->m_isUpsideDown )
{
if ( *((float *)&v180 + 1) <= v171.origin.y )
goto LABEL_298;
}
else if ( v171.origin.y <= *((float *)&v180 + 1) )
{
goto LABEL_298;
}
v140 = 1;
}
}
}
LABEL_298:
if ( !cocos2d::CCDictionary::count(a1->m_collisionLogBottom) || v140 )
{
a1->m_isCollidingWithSlope = 0;
v142 = a1->m_currentSlope2;
a1->m_currentSlope2 = nullptr;
if ( v140 )
{
a1->m_isCollidingWithSlope = 1;
if ( a1->m_isSideways )
{
cocos2d::CCRect::CCRect(v176, &stru_1406C2458);
PlayerObject::handleRotatedCollisionInternal(a1, 0.0, v142, v143, 0, 1, 1);
}
else
{
PlayerObject::collidedWithSlopeInternal(a1, 0.0, v142, 1);
}
}
}
m_yVelocityRelated = a1->m_yVelocityRelated;
if ( m_yVelocityRelated == 0.0 )
{
v145 = v177;
}
else
{
v145 = v177;
if ( a1->m_stateBoostX <= 0 )
{
m_groundYVelocity = a1->m_groundYVelocity;
v147 = fabs(m_yVelocityRelated - m_groundYVelocity);
if ( v147 > (float)(v177 * 0.5) )
{
if ( a1->m_isUpsideDown )
{
if ( m_yVelocityRelated < -5.0 && m_groundYVelocity > m_yVelocityRelated )
{
v148 = fmax(fmin(m_yVelocityRelated, 20.0), -20.0);
a1->m_yVelocityRelated = v148;
if ( a1->m_yVelocity < v148 )
{
LABEL_317:
a1->m_currentSlope2 = nullptr;
a1->m_lastGroundObject = nullptr;
goto LABEL_319;
}
LABEL_316:
PlayerObject::boostPlayer(a1, v148);
goto LABEL_317;
}
}
else if ( m_yVelocityRelated > 5.0 && m_yVelocityRelated > m_groundYVelocity )
{
v148 = fmax(fmin(m_yVelocityRelated, 20.0), -20.0);
a1->m_yVelocityRelated = v148;
if ( v148 < a1->m_yVelocity )
{
a1->m_currentSlope2 = nullptr;
a1->m_lastGroundObject = nullptr;
goto LABEL_319;
}
goto LABEL_316;
}
}
}
}
LABEL_319:
if ( !a1->m_isPlatformer )
goto LABEL_351;
m_scaleXRelated3 = a1->m_scaleXRelated3;
if ( m_scaleXRelated3 != 0.0
&& !a1->m_isOnGround2
&& a1->m_stateBoostY <= 0
&& !v107
&& a1->m_physDeltaRelated > 0.05000000074505806 )
{
v150 = fabs(m_scaleXRelated3 - a1->m_scaleXRelated2);
if ( v150 > (float)(v145 * 0.5) )
{
v151 = m_scaleXRelated3 * 0.8999999761581421 / v128;
v152 = v151 + a1->m_platformerXVelocity;
a1->m_platformerXVelocity = v152;
if ( fabs(v151) >= 2.0 )
{
a1->m_maybeHasStopped = 1;
a1->m_xVelocityRelated = v152;
}
a1->m_scaleXRelatedTime = 0.0;
}
}
m_scaleXRelated5 = a1->m_scaleXRelated5;
if ( m_scaleXRelated5 != 0.0 && a1->m_maybeStateForce2 <= 0 )
{
m_scaleXRelated4 = a1->m_scaleXRelated4;
v155 = fabs(m_scaleXRelated5 - m_scaleXRelated4);
if ( v155 > (float)(v145 * 0.5) )
{
p_m_collidingWithLeft = &a1->m_collidingWithLeft;
m_collidingWithLeft = a1->m_collidingWithLeft;
if ( m_collidingWithLeft && m_scaleXRelated5 > 5.0 && m_scaleXRelated5 > m_scaleXRelated4 )
{
p_m_collidingWithRight = &a1->m_collidingWithRight;
v159 = fmax(fmin(m_scaleXRelated5, 50.0), -50.0);
a1->m_scaleXRelated5 = v159;
v160 = &a1->m_collidingWithRight;
}
else
{
v160 = &a1->m_collidingWithRight;
if ( !a1->m_collidingWithRight || m_scaleXRelated5 >= -5.0 || m_scaleXRelated4 <= m_scaleXRelated5 )
goto LABEL_347;
p_m_collidingWithLeft = &a1->m_collidingWithLeft;
p_m_collidingWithRight = &a1->m_collidingWithRight;
v159 = fmax(fmin(m_scaleXRelated5, 50.0), -50.0);
a1->m_scaleXRelated5 = v159;
if ( !m_collidingWithLeft )
{
p_m_platformerXVelocity = &a1->m_platformerXVelocity;
goto LABEL_343;
}
}
p_m_platformerXVelocity = &a1->m_platformerXVelocity;
if ( v159 >= a1->m_platformerXVelocity )
{
LABEL_345:
*p_m_platformerXVelocity = v159;
a1->m_affectedByForces = 1;
a1->m_isAccelerating = 1;
LABEL_346:
*p_m_collidingWithLeft = nullptr;
*p_m_collidingWithRight = nullptr;
goto LABEL_347;
}
LABEL_343:
if ( !*v160 || *p_m_platformerXVelocity < v159 )
goto LABEL_346;
goto LABEL_345;
}
}
LABEL_347:
if ( !cocos2d::CCDictionary::count(a1->m_collisionLogLeft) )
a1->m_collidingWithLeft = nullptr;
if ( !cocos2d::CCDictionary::count(a1->m_collisionLogRight) )
a1->m_collidingWithRight = nullptr;
LABEL_351:
a1->m_collidedObject = nullptr;
m_scaleXRelated2 = a1->m_scaleXRelated2;
if ( m_scaleXRelated2 != 0.0 )
a1->m_scaleXRelatedTime = a1->m_totalTime;
if ( a1->m_scaleXRelated3 == 0.0 || m_scaleXRelated2 != 0.0 )
{
a1->m_scaleXRelated3 = m_scaleXRelated2;
}
else if ( a1->m_totalTime - a1->m_scaleXRelatedTime >= 0.03333333507180214 )
{
a1->m_scaleXRelated3 = 0.0;
}
a1->m_scaleXRelated2 = 0.0;
a1->m_yVelocityRelated = a1->m_groundYVelocity;
a1->m_groundYVelocity = 0.0;
a1->m_scaleXRelated5 = a1->m_scaleXRelated4;
a1->m_scaleXRelated4 = 0.0;
if ( !v107 )
a1->m_physDeltaRelated = 0.0;
if ( a1->m_isOnGround2 )
a1->m_maybeHasStopped = 0;
if ( a1->m_isOnSlope || a1->m_wasOnSlope )
goto LABEL_388;
a1->m_collidingWithSlopeId = 0;
v163 = a1->m_yVelocity;
if ( a1->m_isUpsideDown )
{
if ( v163 > 2.0 && a1->m_fallSpeed < 2.0 )
{
v167 = a1->m_gameLayer;
if ( v167 )
GJBaseGameLayer::gameEventTriggered(v167, FallSpeedLow, 0, a1->m_uniqueID);
}
if ( a1->m_yVelocity > 7.0 && a1->m_fallSpeed < 7.0 )
{
v168 = a1->m_gameLayer;
if ( v168 )
GJBaseGameLayer::gameEventTriggered(v168, FallSpeedMed, 0, a1->m_uniqueID);
}
if ( a1->m_yVelocity <= 14.0 )
goto LABEL_388;
v166 = a1->m_fallSpeed >= 14.0;
}
else
{
if ( v163 < -2.0 && a1->m_fallSpeed > -2.0 )
{
v164 = a1->m_gameLayer;
if ( v164 )
GJBaseGameLayer::gameEventTriggered(v164, FallSpeedLow, 0, a1->m_uniqueID);
}
if ( a1->m_yVelocity < -7.0 && a1->m_fallSpeed > -7.0 )
{
v165 = a1->m_gameLayer;
if ( v165 )
GJBaseGameLayer::gameEventTriggered(v165, FallSpeedMed, 0, a1->m_uniqueID);
}
if ( a1->m_yVelocity >= -14.0 )
goto LABEL_388;
v166 = a1->m_fallSpeed <= -14.0;
}
if ( !v166 )
{
v169 = a1->m_gameLayer;
if ( v169 )
GJBaseGameLayer::gameEventTriggered(v169, FallSpeedHigh, 0, a1->m_uniqueID);
}
LABEL_388:
a1->m_fallSpeed = a1->m_yVelocity;
--a1->m_reverseRelated;
}