//
// PlayerObject::toggleGhostEffect from 0x3415f4 to 0x341700 (268 bytes)
//
// 10 xrefs:
// > PlayLayer::playEndAnimationToPos @ 0x310b7a
// > PlayLayer::toggleGhostEffect @ 0x312fac
// > PlayLayer::toggleGhostEffect @ 0x312fc0
// > PlayLayer::playPlatformerEndAnimationToPos @ 0x313ac6
// > PlayLayer::removeAllObjects @ 0x3148b0
// > PlayLayer::removeAllObjects @ 0x3148e0
// > PlayerObject::playerDestroyed @ 0x344152
// > PlayerObject::resetObject @ 0x347c80
// > PlayerObject::loadFromCheckpoint @ 0x350852
// > PlayerObject::playCompleteEffect @ 0x56638c
//
// 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 a2)
{
GhostTrailEffect *m_ghostTrail; // r0
float *p_m_vehicleSize; // r9
const cocos2d::ccColor3B *v5; // r0
GhostTrailEffect *v6; // r0
GhostTrailEffect *v7; // r3
GLubyte g; // r1
GLubyte b; // r2
GhostTrailEffect *v10; // r0
float v11; // r2
GhostTrailEffect *v12; // r3
GhostTrailEffect *v13; // r5
GameManager *v14; // r0
if ( a1->m_ghostType != a2 )
{
a1->m_ghostType = a2;
m_ghostTrail = a1->m_ghostTrail;
if ( m_ghostTrail )
{
GhostTrailEffect::stopTrail(m_ghostTrail);
a1->m_ghostTrail = nullptr;
}
if ( a1->m_ghostType == Enabled )
{
p_m_vehicleSize = &a1->m_vehicleSize;
v5 = a1->m_iconSprite->getColor(a1->m_iconSprite);
if ( v5->r || v5->g || v5->b )
{
v6 = GhostTrailEffect::create();
a1->m_ghostTrail = v6;
v6->m_playerObject = a1;
GhostTrailEffect::doBlendAdditive(a1->m_ghostTrail);
v7 = a1->m_ghostTrail;
v7->m_playerScale = *p_m_vehicleSize;
v7->m_opacity = 200.0;
g = a1->m_playerColor1.g;
b = a1->m_playerColor1.b;
v7->m_color.r = a1->m_playerColor1.r;
v7->m_color.g = g;
v7->m_color.b = b;
GhostTrailEffect::runWithTarget(a1->m_ghostTrail, a1->m_iconSprite, 0.05, 0.4, 0.0, 0.6, 0);
}
else
{
v10 = GhostTrailEffect::create();
v11 = *p_m_vehicleSize;
a1->m_ghostTrail = v10;
v10->m_playerObject = a1;
v12 = a1->m_ghostTrail;
v12->m_playerScale = v11;
v12->m_opacity = 200.0;
v12->m_color.r = 0;
v12->m_color.g = 0;
v12->m_color.b = 0;
GhostTrailEffect::runWithTarget(a1->m_ghostTrail, a1->m_iconSprite, 0.05, 0.4, 0.0, 0.6, 0);
}
v13 = a1->m_ghostTrail;
v13->m_objectLayer = GameManager::sharedState()->m_playLayer->m_objectLayer;
v14 = GameManager::sharedState();
v14->m_playLayer->m_objectLayer->addChild(v14->m_playLayer->m_objectLayer, a1->m_ghostTrail);
}
}
}