//
// PlayLayer::playGravityEffect from 0x1403b2050 to 0x1403b239d (845 bytes)
//
// 2 xrefs:
// > ??> @ 0x1405c9c90
// > ??> @ 0x1406d6e30
//
// 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
//
// Hidden C++ exception states: #wind=1
void PlayLayer::playGravityEffect(PlayLayer *a1, bool a2)
{
float v2; // xmm0_4
float v3; // xmm3_4
__int64 v6; // rax
int m_activeGravityEffects; // eax
cocos2d::CCDirector *v8; // rax
cocos2d::CCSprite *v9; // r14
_BOOL8 v10; // rdx
int m_gravityEffectIndex; // eax
unsigned int v12; // ebx
double v13; // xmm0_8
double v14; // xmm0_8
__int64 v15; // rax
double v16; // xmm0_8
__int64 v17; // rax
__int16 v18; // si
char v19; // r15
__int64 v20; // rax
cocos2d::CCArray *v21; // rsi
struct cocos2d::CCObject *v22; // rax
struct cocos2d::CCMoveTo *v23; // rbx
__int64 v24; // rax
struct cocos2d::CCSequence *v25; // rax
cocos2d::ccColor3B *v26; // r8
__int64 v27; // rbx
struct cocos2d::CCDelayTime *v28; // rax
struct cocos2d::CCSequence *v29; // rax
cocos2d::ccColor3B *v30; // r8
float v31; // [rsp+20h] [rbp-30h] BYREF
cocos2d::CCPoint v32; // [rsp+28h] [rbp-28h] BYREF
cocos2d::CCPoint v33[2]; // [rsp+30h] [rbp-20h] BYREF
void *v34; // [rsp+80h] [rbp+30h] BYREF
float v35; // [rsp+90h] [rbp+40h]
char v36; // [rsp+98h] [rbp+48h] BYREF
if ( !a1->m_disableGravityEffect )
{
v6 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v34 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v34);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v6 = qword_1406C2ED8;
}
if ( !*(_BYTE *)(v6 + 917) )
{
m_activeGravityEffects = a1->m_activeGravityEffects;
if ( m_activeGravityEffects < a1->m_totalGravityEffects )
{
a1->m_activeGravityEffects = m_activeGravityEffects + 1;
v8 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v8);
v9 = (cocos2d::CCSprite *)cocos2d::CCArray::objectAtIndex(a1->m_gravityEffects, a1->m_gravityEffectIndex);
LOBYTE(v10) = 1;
v9->removeFromParentAndCleanup(v9, v10);
m_gravityEffectIndex = a1->m_gravityEffectIndex;
v12 = 0;
if ( m_gravityEffectIndex < a1->m_totalGravityEffects - 1 )
a1->m_gravityEffectIndex = m_gravityEffectIndex + 1;
else
a1->m_gravityEffectIndex = 0;
v13 = cocos2d::CCPoint::CCPoint(v2, v35 * 0.5);
v14 = cocos2d::CCPoint::CCPoint(*(float *)&v13, v35 * 0.5);
if ( a1->m_player1->m_isSideways )
{
cocos2d::CCPoint::CCPoint(*(float *)&v14, v35 + 95.0);
v16 = cocos2d::CCPoint::operator=(&v31, v15);
cocos2d::CCPoint::CCPoint(*(float *)&v16, -95.0);
cocos2d::CCPoint::operator=(&v36, v17);
}
cocos2d::CCPoint::CCPoint(&v32);
cocos2d::CCPoint::CCPoint(v33);
if ( a2 )
{
cocos2d::CCPoint::operator=(&v32, &v31);
cocos2d::CCPoint::operator=(v33, &v36);
v18 = -1;
v19 = 0;
}
else
{
cocos2d::CCPoint::operator=(&v32, &v36);
cocos2d::CCPoint::operator=(v33, &v31);
cocos2d::CCSprite::setFlipY(v9, 1);
LOWORD(v34) = -256;
v19 = -1;
v18 = -256;
}
((void (__fastcall *)(cocos2d::CCSprite *))v9->setRotation)(v9);
a1->addChild_0(a1, v9, 0);
v9->setPosition_0(v9, &v32);
LOWORD(v34) = v18;
BYTE2(v34) = v19;
v20 = (__int64)v9->getChildByTag(v9, 1);
if ( v20 )
{
v21 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v20 + 464LL))(v20);
if ( cocos2d::CCArray::count(v21) )
{
do
{
v22 = cocos2d::CCArray::objectAtIndex(v21, v12);
(**(void (__fastcall ***)(__int64, void **))&v22[5].m_unknown2)((__int64)&v22[5].m_unknown2, &v34);
++v12;
}
while ( v12 < cocos2d::CCArray::count(v21) );
}
}
v23 = cocos2d::CCMoveTo::create(0.40000001, v33);
v24 = cocos2d::CCCallFunc::create(v9, sub_14003BE70);
v25 = cocos2d::CCSequence::create(v23, v24, 0);
cocos2d::CCNode::runAction((CCLightFlash *)v9, (cocos2d::CCPoint)v25, v26, v3, v31);
v27 = cocos2d::CCCallFunc::create(a1, PlayLayer::gravityEffectFinished);
v28 = cocos2d::CCDelayTime::create(0.40000001);
v29 = cocos2d::CCSequence::create(v28, v27, 0);
cocos2d::CCNode::runAction((CCLightFlash *)a1, (cocos2d::CCPoint)v29, v30, v3, v31);
}
}
}
}