//
// PlayerObject::toggleGhostEffect from 0x100400300 to 0x10040047f (383 bytes)
//
// 14 xrefs:
// > PlayLayer::removeAllObjects @ 0x10008072c
// > PlayLayer::removeAllObjects @ 0x100080775
// > PlayLayer::playEndAnimationToPos @ 0x1000839a4
// > PlayLayer::playEndAnimationToPos @ 0x100083b6e
// > PlayLayer::playPlatformerEndAnimationToPos @ 0x100083f02
// > PlayLayer::playPlatformerEndAnimationToPos @ 0x1000841a8
// > PlayLayer::playPlatformerEndAnimationToPos @ 0x1000841ba
// > PlayLayer::playPlatformerEndAnimationToPos @ 0x1000841ef
// > PlayLayer::toggleGhostEffect @ 0x10008d763
// > PlayLayer::toggleGhostEffect @ 0x10008d77f
// > PlayerObject::playCompleteEffect @ 0x1001f75e9
// > PlayerObject::resetObject @ 0x1003ff589
// > PlayerObject::playerDestroyed @ 0x100400c7b
// > PlayerObject::loadFromCheckpoint @ 0x100409bd1
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:30:02 +0000
//
void __fastcall PlayerObject::toggleGhostEffect(__int64 a1, int a2)
{
unsigned __int8 *v2; // rax
unsigned __int8 v3; // r12
unsigned __int8 v4; // r15
unsigned __int8 v5; // r14
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rax
if ( *(_DWORD *)(a1 + 1788) != a2 )
{
*(_DWORD *)(a1 + 1788) = a2;
if ( *(_QWORD *)(a1 + 1792) )
{
GhostTrailEffect::stopTrail();
*(_QWORD *)(a1 + 1792) = 0;
a2 = *(_DWORD *)(a1 + 1788);
}
if ( a2 == 1 )
{
v2 = (unsigned __int8 *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1800) + 944LL))(*(_QWORD *)(a1 + 1800));
v3 = *v2;
v4 = v2[1];
v5 = v2[2];
v6 = GhostTrailEffect::create();
*(_QWORD *)(a1 + 1792) = v6;
*(_QWORD *)(v6 + 352) = a1;
if ( __PAIR16__(v4, v3) || v5 )
{
GhostTrailEffect::doBlendAdditive(v6);
v7 = *(_QWORD *)(a1 + 1792);
*(_DWORD *)(v7 + 332) = *(_DWORD *)(a1 + 2472);
*(_DWORD *)(v7 + 368) = 1128792064;
*(_WORD *)(v7 + 384) = *(_WORD *)(a1 + 2602);
*(_BYTE *)(v7 + 386) = *(_BYTE *)(a1 + 2604);
}
else
{
*(_DWORD *)(v6 + 332) = *(_DWORD *)(a1 + 2472);
*(_DWORD *)(v6 + 368) = 1128792064;
*(_WORD *)(v6 + 384) = 0;
*(_BYTE *)(v6 + 386) = 0;
}
GhostTrailEffect::runWithTarget(
*(_QWORD *)(a1 + 1792),
*(_QWORD *)(a1 + 1800),
0,
0.050000001,
0.40000001,
0.0,
0.60000002);
*(_QWORD *)(*(_QWORD *)(a1 + 1792) + 360LL) = *(_QWORD *)(*(_QWORD *)(GameManager::sharedState() + 544) + 3920LL);
v8 = GameManager::sharedState();
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(*(_QWORD *)(v8 + 544) + 3920LL) + 456LL))(
*(_QWORD *)(*(_QWORD *)(v8 + 544) + 3920LL),
*(_QWORD *)(a1 + 1792));
}
}
}