//
// PlayerObject::hitGround from 0x344188 to 0x344612 (1162 bytes)
//
// 12 xrefs:
// > PlayerObject::hitGroundNoJump @ 0x344638
// > PlayerObject::collidedWithObjectInternal @ 0x345e96
// > PlayerObject::collidedWithObjectInternal @ 0x34606a
// > PlayerObject::collidedWithObjectInternal @ 0x34641c
// > PlayerObject::collidedWithObjectInternal @ 0x346526
// > PlayerObject::collidedWithObjectInternal @ 0x3466b4
// > PlayerObject::collidedWithSlopeInternal @ 0x34bfaa
// > MenuGameLayer::update @ 0x3a9d64
// > GJBaseGameLayer::checkCollisions @ 0x493bf2
// > GJBaseGameLayer::checkCollisions @ 0x493c3e
// > GJBaseGameLayer::checkCollisions @ 0x493c8a
// > GJBaseGameLayer::checkCollisions @ 0x493df0
//
// 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::hitGround(PlayerObject *a1, GameObject *a2, bool a3)
{
_BOOL4 v4; // r8
int m_objectMaterial; // r3
double m_yVelocity; // d8
double v8; // d8
PlayerObject *v9; // r0
int v10; // r1
float *p_m_fallStartY; // r5
float v12; // s15
PlayerObject *v13; // r0
int v14; // r1
cocos2d::CCParticleSystemQuad *m_landParticles1; // r5
void (__fastcall *setAngle)(cocos2d::CCParticleSystem *__hidden, float); // r9
float m_landParticlesAngle; // s18
int v18; // r0
void (__fastcall *setGravity)(cocos2d::CCParticleSystem *__hidden, const cocos2d::CCPoint *); // r10
const cocos2d::CCPoint *v20; // r0
float m_landParticleRelatedY; // s18
float x; // r11
int v23; // r0
int v24; // r0
cocos2d::CCParticleSystemQuad_vtbl *v25; // r3
float v26; // r2
void (__fastcall *setRotation)(cocos2d::CCParticleSystem *__hidden, float); // r3
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
const cocos2d::CCPoint *v29; // r0
GJRobotSprite *m_robotSprite; // r7
const cocos2d::CCPoint *v31; // r0
float v32; // s14
float v33; // s15
cocos2d::CCPoint v34; // [sp+Ch] [bp-18h] BYREF
cocos2d::CCPoint v35; // [sp+14h] [bp-10h] BYREF
v4 = a3;
if ( a2 )
m_objectMaterial = a2->m_objectMaterial;
else
m_objectMaterial = 0;
a1->m_groundObjectMaterial = m_objectMaterial;
a1->m_isOnIce = 0;
m_yVelocity = a1->m_yVelocity;
v8 = m_yVelocity * (double)PlayerObject::flipMod(a1);
if ( !a1->m_gameLayer || a1->m_isDart )
goto LABEL_29;
if ( PlayerObject::playerIsFalling(a1, -14.0) )
{
v9 = a1;
v10 = 5;
}
else if ( PlayerObject::playerIsFalling(a1, -8.0) )
{
v9 = a1;
v10 = 4;
}
else if ( PlayerObject::playerIsFalling(a1, -4.0) )
{
v9 = a1;
v10 = 3;
}
else
{
if ( !PlayerObject::playerIsFalling(a1, -1.0) )
goto LABEL_17;
v9 = a1;
if ( a1->m_isOnGround2 )
v10 = 1;
else
v10 = 2;
}
PlayerObject::gameEventTriggered(v9, v10, a1->m_groundObjectMaterial);
LABEL_17:
p_m_fallStartY = &a1->m_fallStartY;
if ( a1->m_fallStartY != 0.0 )
{
v12 = fabsf(*p_m_fallStartY - a1->getPosition(a1)->y);
if ( v12 > 0.0 )
{
if ( v12 > 450.0 )
{
v13 = a1;
v14 = 68;
LABEL_27:
PlayerObject::gameEventTriggered(v13, v14, a1->m_groundObjectMaterial);
goto LABEL_28;
}
if ( v12 > 300.0 )
{
v13 = a1;
v14 = 67;
goto LABEL_27;
}
if ( v12 > 150.0 )
{
v13 = a1;
v14 = 66;
goto LABEL_27;
}
if ( v12 > 7.5 )
{
v13 = a1;
v14 = 65;
goto LABEL_27;
}
}
LABEL_28:
*p_m_fallStartY = 0.0;
}
LABEL_29:
PlayerObject::setYVelocity(a1, 0.0, 43);
a1->m_isSliding = 0;
if ( !a1->m_isOnGround2 && !v4 && !PlayerObject::levelFlipping(a1) && !a1->m_isHidden )
{
m_landParticles1 = a1->m_landParticles1;
if ( a1->m_useLandParticles0 )
m_landParticles1 = a1->m_landParticles0;
a1->m_useLandParticles0 ^= 1u;
if ( m_landParticles1->getParticleCount(m_landParticles1) <= 2 )
{
setAngle = m_landParticles1->setAngle;
m_landParticlesAngle = a1->m_landParticlesAngle;
v18 = PlayerObject::flipMod(a1);
((void (__fastcall *)(cocos2d::CCParticleSystemQuad *, _DWORD))setAngle)(
m_landParticles1,
m_landParticlesAngle * (float)v18);
setGravity = m_landParticles1->setGravity;
v20 = a1->m_landParticles0->getGravity(a1->m_landParticles0);
m_landParticleRelatedY = a1->m_landParticleRelatedY;
x = v20->x;
v23 = PlayerObject::flipMod(a1);
cocos2d::CCPoint::CCPoint(&v35, x, m_landParticleRelatedY * (float)v23);
setGravity(m_landParticles1, &v35);
v24 = PlayerObject::flipMod(a1);
cocos2d::CCPoint::CCPoint(&v34, 0.0, (float)(-15 * v24) * a1->m_vehicleSize);
v25 = m_landParticles1->cocos2d::CCParticleSystem::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( a1->m_isSideways )
{
v26 = v34.x;
setRotation = v25->setRotation;
v34.x = v34.y;
v34.y = v26;
((void (__fastcall *)(cocos2d::CCParticleSystemQuad *, int))setRotation)(m_landParticles1, 1119092736);
}
else
{
((void (__fastcall *)(cocos2d::CCParticleSystemQuad *, _DWORD))v25->setRotation)(m_landParticles1, 0);
}
if ( a2 && a2->getType(a2) == Slope )
{
v32 = 0.0;
if ( a1->m_isSideways )
v32 = 90.0;
v33 = v32 + a1->m_slopeRotation * 57.2957802;
((void (__fastcall *)(cocos2d::CCParticleSystemQuad *, _DWORD))m_landParticles1->setRotation)(
m_landParticles1,
LODWORD(v33));
}
setPosition = m_landParticles1->setPosition;
v29 = a1->getPosition(a1);
cocos2d::CCPoint::operator+(&v35, v29, &v34);
setPosition(m_landParticles1, &v35);
cocos2d::CCParticleSystem::resetSystem(m_landParticles1);
}
}
if ( !a1->m_justPlacedStreak )
{
PlayerObject::placeStreakPoint(a1);
a1->m_justPlacedStreak = 1;
}
if ( !a1->m_isOnGround2 && !a1->m_isDashing )
{
if ( a1->m_isRobot )
{
m_robotSprite = a1->m_robotSprite;
sub_775C20(&v35, &a1->m_currentRobotAnimation);
CCAnimatedSprite::runAnimation((int)m_robotSprite, (int)&v35);
sub_774008(&v35);
}
else if ( a1->m_isSpider )
{
PlayerObject::playDynamicSpiderRun(a1);
}
}
a1->m_isOnGround2 = 1;
a1->m_unkA29 = !v4;
if ( v8 <= 5.0 )
{
a1->m_isOnGround = 1;
a1->m_lastLandTime = a1->m_totalTime;
}
a1->m_isOnGround3 = 1;
a1->m_stateOnGround = 2;
if ( !a1->m_isBall && (a1->m_isRotating || a1->m_wasOnSlope) )
PlayerObject::stopRotation(a1, 1, 17);
if ( a1->m_isBall && a1->m_isBallRotating && !a1->m_isOnSlope )
PlayerObject::stopRotation(a1, 1, 16);
if ( a1->m_isBall && a1->m_isBallRotating2 )
PlayerObject::stopRotation(a1, 0, 18);
if ( a1->m_isBall && !a1->m_isRotating )
PlayerObject::runRotateAction(a1, 0, 6);
if ( !a1->m_isBall
&& !PlayerObject::isFlying(a1)
&& !a1->m_isOnSlope
&& !a1->m_wasOnSlope
&& (int)a1->getRotation(a1) % 90 )
{
PlayerObject::stopRotation(a1, 1, 19);
}
v31 = a1->getPosition(a1);
cocos2d::CCPoint::operator=(&a1->m_lastGroundedPos, v31);
if ( !PlayerObject::isFlying(a1) && a1->m_shouldTryPlacingCheckpoint )
{
PlayerObject::deactivateStreak(a1, 0);
a1->m_canPlaceCheckpoint = 1;
}
a1->m_shouldTryPlacingCheckpoint = 0;
}