//
// PlayLayer::applyEnterEffect from 0x5cdad8 to 0x5ce004 (1324 bytes)
//
// 2 xrefs:
// > PlayLayer::updateVisibility @ 0x5ce518
// > ??> @ 0x88fb0
//
// 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 PlayLayer::applyEnterEffect(PlayLayer *a1, GameObject *a2, int a3, bool a4)
{
cocos2d::CCPoint *p_m_enterEffectPosition; // x21
_BOOL4 v8; // w22
float v9; // s2
float v10; // s3
float RelativeModNew; // s8
bool v12; // w0
_BOOL4 v13; // w1
int m_enterType; // w0
int m_exitType; // w0
const cocos2d::CCPoint *v16; // x0
_BOOL4 m_usesAudioScale; // w0
cocos2d::CCDirector *v18; // x0
float y; // s1
float v20; // s0
cocos2d::CCDirector *v21; // x0
float v22; // s0
float v23; // s0
float v24; // s1
void (__fastcall *setPosition)(GameObject *__hidden, const cocos2d::CCPoint *); // x24
float v26; // s2
float v27; // s1
float v28; // [xsp+70h] [xbp+70h]
float v29; // [xsp+74h] [xbp+74h]
cocos2d::CCPoint v30; // [xsp+78h] [xbp+78h] BYREF
cocos2d::CCPoint v31; // [xsp+80h] [xbp+80h] BYREF
cocos2d::CCPoint v32; // 0:s0.4,4:s1.4
p_m_enterEffectPosition = &a1->m_enterEffectPosition;
v8 = a4;
cocos2d::CCPoint::CCPoint(&v31, &a1->m_enterEffectPosition);
v32.y = 0.0;
v32.x = 70.0;
RelativeModNew = PlayLayer::getRelativeModNew(a1, v32, v9, v10, (bool)&v31, 0);
v12 = GameObject::ignoreEnter(a2);
v13 = 1;
if ( !v12 )
v13 = RelativeModNew == 1.0;
if ( v8 )
m_enterType = a2->m_enterType;
else
m_enterType = a2->m_exitType;
if ( m_enterType != -1 && (m_enterType == -14 || a3 != -14) )
{
if ( v13 )
{
a2->m_unk3E8 = 1;
m_exitType = -1;
if ( v8 )
a2->m_enterType = -1;
else
a2->m_exitType = -1;
goto LABEL_24;
}
LABEL_27:
if ( v8 )
m_exitType = a2->m_enterType;
else
m_exitType = a2->m_exitType;
LABEL_24:
switch ( m_exitType )
{
case -13:
case -12:
case -11:
case -10:
case -9:
cocos2d::ccpForAngle((float)(*(float *)&a2->m_unk3D8 - 90.0) * 0.017453);
setPosition = a2->setPosition;
v26 = v29;
v24 = (float)(1.0 - RelativeModNew) * 100.0;
v23 = v24 * v28;
goto LABEL_52;
case -8:
v27 = 0.0;
setPosition = a2->setPosition;
v23 = (float)(1.0 - RelativeModNew) * 100.0;
goto LABEL_53;
case -7:
v27 = 0.0;
setPosition = a2->setPosition;
v23 = (float)(1.0 - RelativeModNew) * -100.0;
goto LABEL_53;
case -6:
v24 = 1.0 - RelativeModNew;
setPosition = a2->setPosition;
v23 = 0.0;
v26 = -100.0;
goto LABEL_52;
case -5:
v23 = 0.0;
v24 = 1.0 - RelativeModNew;
setPosition = a2->setPosition;
v26 = 100.0;
LABEL_52:
v27 = v24 * v26;
LABEL_53:
cocos2d::CCPoint::CCPoint(&v30, v23, v27);
cocos2d::CCPoint::operator+(&v31, p_m_enterEffectPosition, &v30);
setPosition(a2, &v31);
goto LABEL_17;
case -4:
if ( !a2->m_usesAudioScale || a2->m_hasNoAudioScale )
{
a2->setRScaleX(a2, (float)((float)(1.0 - RelativeModNew) * 0.75) + 1.0);
a2->setRScaleY(a2, (float)((float)(1.0 - RelativeModNew) * 0.75) + 1.0);
}
goto LABEL_50;
case -3:
if ( !a2->m_usesAudioScale || a2->m_hasNoAudioScale )
{
a2->setRScaleX(a2, RelativeModNew);
a2->setRScaleY(a2, RelativeModNew);
}
LABEL_50:
a2->setPosition(a2, p_m_enterEffectPosition);
break;
default:
a2->setPosition(a2, p_m_enterEffectPosition);
LABEL_17:
if ( !a2->m_usesAudioScale || a2->m_hasNoAudioScale )
{
a2->setRScaleX(a2, 1.0);
a2->setRScaleY(a2, 1.0);
}
break;
}
if ( RelativeModNew == 0.0 )
{
a2->m_unk3E8 = 1;
if ( v8 )
a2->m_enterType = -1;
else
a2->m_exitType = -1;
}
return;
}
if ( !v13 )
{
if ( v8 )
a2->m_enterType = a3;
else
a2->m_exitType = a3;
switch ( a3 )
{
case -13:
case -12:
v21 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v21);
if ( (float)(a1->m_gameState.m_cameraPosition2.y + (float)(v31.y * 0.5)) < a1->m_enterEffectPosition.y )
v22 = 180.0;
else
v22 = 0.0;
if ( a3 == -13 )
*(float *)&a2->m_unk3D8 = v22 + 180.0;
else
*(float *)&a2->m_unk3D8 = v22;
break;
case -11:
*(float *)&a2->m_unk3D8 = (float)((float)((float)((float)rand() * 4.6566e-10) * 2.0) + -1.0) * 180.0;
break;
case -10:
case -9:
v18 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v18);
y = a1->m_enterEffectPosition.y;
v20 = a1->m_gameState.m_cameraPosition2.y + (float)(v31.y * 0.5);
if ( a3 == -10 )
{
if ( v20 >= y )
a2->m_unk3D8 = -1036779520;
else
a2->m_unk3D8 = -1022951424;
}
else if ( v20 >= y )
{
a2->m_unk3D8 = 1110704128;
}
else
{
a2->m_unk3D8 = 1124532224;
}
break;
default:
goto LABEL_27;
}
goto LABEL_27;
}
v16 = a2->getPosition(a2);
cocos2d::CCPoint::CCPoint(&v31, v16);
if ( a1->m_enterEffectPosition.x != v31.x || a1->m_enterEffectPosition.y != v31.y )
a2->setPosition(a2, p_m_enterEffectPosition);
if ( a2->m_unk3E8 )
{
m_usesAudioScale = a2->m_usesAudioScale;
a2->m_unk3E8 = 0;
if ( !m_usesAudioScale || a2->m_hasNoAudioScale )
{
a2->setRScaleX(a2, 1.0);
a2->setRScaleY(a2, 1.0);
}
}
}