//
// PlayerObject::toggleGhostEffect from 0x628c3c to 0x628da0 (356 bytes)
//
// 11 xrefs:
// > PlayLayer::playEndAnimationToPos @ 0x5cc1d0
// > PlayLayer::toggleGhostEffect @ 0x5d073c
// > PlayLayer::toggleGhostEffect @ 0x5d0764
// > PlayLayer::playPlatformerEndAnimationToPos @ 0x5d1868
// > PlayLayer::removeAllObjects @ 0x5d2c1c
// > PlayLayer::removeAllObjects @ 0x5d2cdc
// > PlayerObject::playerDestroyed @ 0x62cf6c
// > PlayerObject::resetObject @ 0x632678
// > PlayerObject::loadFromCheckpoint @ 0x63b4c4
// > PlayerObject::playCompleteEffect @ 0xa26adc
// > ??> @ 0x5ade0
//
// 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::toggleGhostEffect(PlayerObject *a1, GhostType m_ghostType)
{
GhostTrailEffect *m_ghostTrail; // x0
const cocos2d::ccColor3B *v4; // x0
GhostTrailEffect *v5; // x0
float m_vehicleSize; // w4
GhostTrailEffect *v7; // x3
cocos2d::CCSprite *m_iconSprite; // x1
GhostTrailEffect *v9; // x0
GhostTrailEffect *v10; // x20
GameManager *v11; // x0
GhostTrailEffect *v12; // x0
GhostTrailEffect *v13; // x0
GLubyte g; // w1
GLubyte r; // w3
if ( a1->m_ghostType != m_ghostType )
{
m_ghostTrail = a1->m_ghostTrail;
a1->m_ghostType = m_ghostType;
if ( m_ghostTrail )
{
GhostTrailEffect::stopTrail(m_ghostTrail);
a1->m_ghostTrail = nullptr;
m_ghostType = a1->m_ghostType;
}
if ( m_ghostType == Enabled )
{
v4 = a1->m_iconSprite->getColor(a1->m_iconSprite);
if ( *(_WORD *)&v4->r || v4->b )
{
v12 = GhostTrailEffect::create();
a1->m_ghostTrail = v12;
v12->m_playerObject = a1;
GhostTrailEffect::doBlendAdditive(a1->m_ghostTrail);
v13 = a1->m_ghostTrail;
v13->m_playerScale = a1->m_vehicleSize;
v13->m_opacity = 200.0;
g = a1->m_playerColor1.g;
r = a1->m_playerColor1.r;
v13->m_color.b = a1->m_playerColor1.b;
v13->m_color.r = r;
v13->m_color.g = g;
m_iconSprite = a1->m_iconSprite;
v9 = a1->m_ghostTrail;
}
else
{
v5 = GhostTrailEffect::create();
a1->m_ghostTrail = v5;
m_vehicleSize = a1->m_vehicleSize;
v5->m_playerObject = a1;
v7 = a1->m_ghostTrail;
v7->m_color.r = 0;
v7->m_color.g = 0;
v7->m_color.b = 0;
m_iconSprite = a1->m_iconSprite;
v9 = a1->m_ghostTrail;
v7->m_playerScale = m_vehicleSize;
v7->m_opacity = 200.0;
}
GhostTrailEffect::runWithTarget(v9, m_iconSprite, 0.05, 0.4, 0.0, 0.6, 0);
v10 = a1->m_ghostTrail;
v10->m_objectLayer = GameManager::sharedState()->m_playLayer->m_objectLayer;
v11 = GameManager::sharedState();
v11->m_playLayer->m_objectLayer->addChild(v11->m_playLayer->m_objectLayer, a1->m_ghostTrail);
}
}
}