//
// PlayerObject::toggleGhostEffect from 0x1002274f4 to 0x10022762c (312 bytes)
//
// 10 xrefs:
// > PlayerObject::playCompleteEffect @ 0x10005ce3c
// > PlayLayer::removeAllObjects @ 0x1001196a0
// > PlayLayer::removeAllObjects @ 0x1001196e0
// > PlayLayer::playEndAnimationToPos @ 0x10011ba78
// > PlayLayer::playPlatformerEndAnimationToPos @ 0x10011bdc4
// > PlayLayer::toggleGhostEffect @ 0x1001226f4
// > PlayLayer::toggleGhostEffect @ 0x100122714
// > PlayerObject::resetObject @ 0x100226bd8
// > PlayerObject::playerDestroyed @ 0x100227c0c
// > PlayerObject::loadFromCheckpoint @ 0x10022e268
//
// 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::toggleGhostEffect(PlayerObject *a1, GhostType m_ghostType)
{
GhostTrailEffect *m_ghostTrail; // x0
unsigned __int8 *v4; // x0
int v5; // w20
int v6; // w21
int v7; // w22
GhostTrailEffect *v8; // x0
bool v9; // zf
int v11; // w8
GhostTrailEffect *v12; // x20
GameManager *v13; // x0
if ( a1->m_ghostType != m_ghostType )
{
a1->m_ghostType = m_ghostType;
m_ghostTrail = a1->m_ghostTrail;
if ( m_ghostTrail )
{
GhostTrailEffect::stopTrail(m_ghostTrail);
a1->m_ghostTrail = nullptr;
m_ghostType = a1->m_ghostType;
}
if ( m_ghostType == Enabled )
{
v4 = (unsigned __int8 *)((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_iconSprite->getColor)(a1->m_iconSprite);
v5 = *v4;
v6 = v4[1];
v7 = v4[2];
v8 = GhostTrailEffect::create();
a1->m_ghostTrail = v8;
v8->m_playerObject = a1;
if ( v5 )
v9 = 0;
else
v9 = v6 == 0;
if ( v9 && v7 == 0 )
{
v11 = 0;
v8->m_playerScale = a1->m_vehicleSize;
v8->m_opacity = 200.0;
}
else
{
GhostTrailEffect::doBlendAdditive(v8);
v8 = a1->m_ghostTrail;
v8->m_playerScale = a1->m_vehicleSize;
v8->m_opacity = 200.0;
v11 = *(unsigned __int16 *)&a1->m_playerColor1.r | (a1->m_playerColor1.b << 16);
}
*(_WORD *)&v8->m_color.r = v11;
v8->m_color.b = BYTE2(v11);
GhostTrailEffect::runWithTarget(a1->m_ghostTrail, a1->m_iconSprite, 0.05, 0.4, 0.0, 0.6, 0);
v12 = a1->m_ghostTrail;
v12->m_objectLayer = GameManager::sharedState()->m_playLayer->m_objectLayer;
v13 = GameManager::sharedState();
((void (__fastcall *)(cocos2d::CCLayer *, GhostTrailEffect *))v13->m_playLayer->m_objectLayer->addChild)(
v13->m_playLayer->m_objectLayer,
a1->m_ghostTrail);
}
}
}