//
// PlayerObject::toggleGhostEffect from 0x1002c4158 to 0x1002c428c (308 bytes)
//
// 10 xrefs:
// > sub_100065528 @ 0x1000655bc
// > sub_100142430 @ 0x100142484
// > sub_100142430 @ 0x1001424c4
// > PlayLayer::playEndAnimationToPos @ 0x100144a74
// > PlayLayer::playPlatformerEndAnimationToPos @ 0x100144dc4
// > sub_10014C238 @ 0x10014c250
// > sub_10014C238 @ 0x10014c270
// > PlayerObject::resetObject @ 0x1002c3800
// > PlayerObject::playerDestroyed @ 0x1002c486c
// > PlayerObject::loadFromCheckpoint @ 0x1002cafd4
//
// This function is hookable on this platform (idp: arm, 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 11:02:32 +0000
//
__int64 __fastcall PlayerObject::toggleGhostEffect(__int64 result, int a2)
{
__int64 v2; // x19
unsigned __int8 *v3; // x0
int v4; // w20
int v5; // w21
int v6; // w22
__int64 v7; // x0
bool v8; // zf
__int64 v10; // x8
__int16 v11; // w9
__int64 v12; // x0
__int64 v13; // x0
__int64 v14; // x0
if ( *(_DWORD *)(result + 1788) != a2 )
{
v2 = result;
*(_DWORD *)(result + 1788) = a2;
result = *(_QWORD *)(result + 1792);
if ( result )
{
result = GhostTrailEffect::stopTrail();
*(_QWORD *)(v2 + 1792) = 0;
a2 = *(_DWORD *)(v2 + 1788);
}
if ( a2 == 1 )
{
v3 = (unsigned __int8 *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v2 + 1800) + 944LL))(*(_QWORD *)(v2 + 1800));
v4 = *v3;
v5 = v3[1];
v6 = v3[2];
v7 = GhostTrailEffect::create();
*(_QWORD *)(v2 + 1792) = v7;
*(_QWORD *)(v7 + 352) = v2;
if ( v4 )
v8 = 0;
else
v8 = v5 == 0;
if ( v8 && v6 == 0 )
{
*(_DWORD *)(v7 + 332) = *(_DWORD *)(v2 + 2472);
*(_DWORD *)(v7 + 368) = 1128792064;
*(_WORD *)(v7 + 384) = 0;
*(_BYTE *)(v7 + 386) = 0;
}
else
{
GhostTrailEffect::doBlendAdditive();
v10 = *(_QWORD *)(v2 + 1792);
*(_DWORD *)(v10 + 332) = *(_DWORD *)(v2 + 2472);
*(_DWORD *)(v10 + 368) = 1128792064;
v11 = *(_WORD *)(v2 + 2602);
*(_BYTE *)(v10 + 386) = *(_BYTE *)(v2 + 2604);
*(_WORD *)(v10 + 384) = v11;
}
v12 = GhostTrailEffect::runWithTarget(*(_QWORD *)(v2 + 1792), *(_QWORD *)(v2 + 1800), 0, 0.05, 0.4, 0.0, 0.6);
v13 = GameManager::sharedState(v12);
*(_QWORD *)(*(_QWORD *)(v2 + 1792) + 360LL) = *(_QWORD *)(*(_QWORD *)(v13 + 544) + 3920LL);
v14 = GameManager::sharedState(v13);
return (*(__int64 (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(*(_QWORD *)(v14 + 544) + 3920LL) + 456LL))(
*(_QWORD *)(*(_QWORD *)(v14 + 544) + 3920LL),
*(_QWORD *)(v2 + 1792));
}
}
return result;
}