//
// PlayerObject::toggleGhostEffect from 0x100413220 to 0x100413399 (377 bytes)
//
// 14 xrefs:
// > PlayLayer::removeAllObjects @ 0x1000b30cc
// > PlayLayer::removeAllObjects @ 0x1000b3115
// > PlayLayer::playEndAnimationToPos @ 0x1000b60dc
// > PlayLayer::playEndAnimationToPos @ 0x1000b62a6
// > PlayLayer::playPlatformerEndAnimationToPos @ 0x1000b6642
// > PlayLayer::playPlatformerEndAnimationToPos @ 0x1000b68e8
// > PlayLayer::playPlatformerEndAnimationToPos @ 0x1000b68fa
// > PlayLayer::playPlatformerEndAnimationToPos @ 0x1000b692f
// > PlayLayer::toggleGhostEffect @ 0x1000bf143
// > PlayLayer::toggleGhostEffect @ 0x1000bf15f
// > PlayerObject::playCompleteEffect @ 0x1002140b9
// > PlayerObject::resetObject @ 0x100412459
// > PlayerObject::playerDestroyed @ 0x100413b9b
// > PlayerObject::loadFromCheckpoint @ 0x10041cdb0
//
// 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; // rdi
unsigned __int8 *v4; // rax
unsigned __int8 v5; // r12
unsigned __int8 v6; // r15
unsigned __int8 v7; // r14
GhostTrailEffect *v8; // rax
int v9; // ecx
GhostTrailEffect *v10; // r14
GameManager *v11; // rax
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 ( __PAIR16__(v6, v5) || v7 )
{
GhostTrailEffect::doBlendAdditive(v8);
v8 = a1->m_ghostTrail;
v8->m_playerScale = a1->m_vehicleSize;
v8->m_opacity = 200.0;
v9 = *(unsigned __int16 *)&a1->m_playerColor1.r | (a1->m_playerColor1.b << 16);
}
else
{
v8->m_playerScale = a1->m_vehicleSize;
v8->m_opacity = 200.0;
v9 = 0;
}
*(_WORD *)&v8->m_color.r = v9;
v8->m_color.b = BYTE2(v9);
GhostTrailEffect::runWithTarget(a1->m_ghostTrail, a1->m_iconSprite, 0.050000001, 0.40000001, 0.0, 0.60000002, 0);
v10 = a1->m_ghostTrail;
v10->m_objectLayer = GameManager::sharedState()->m_playLayer->m_objectLayer;
v11 = GameManager::sharedState();
((void (__fastcall *)(cocos2d::CCLayer *, GhostTrailEffect *))v11->m_playLayer->m_objectLayer->addChild)(
v11->m_playLayer->m_objectLayer,
a1->m_ghostTrail);
}
}
}