//
// PlayerObject::toggleVisibility from 0x100403080 to 0x10040328f (527 bytes)
//
// 8 xrefs:
// > GJBaseGameLayer::processOptionsTrigger @ 0x10013cd06
// > GJBaseGameLayer::processOptionsTrigger @ 0x10013cd2f
// > GJBaseGameLayer::togglePlayerVisibility @ 0x10013ced4
// > GJBaseGameLayer::togglePlayerVisibility_1 @ 0x10014ea53
// > GJBaseGameLayer::togglePlayerVisibility_1 @ 0x10014ea70
// > PlayerObject::resetObject @ 0x10041205f
// > PlayerObject::spawnFromPlayer @ 0x10041b865
// > PlayerObject::loadFromCheckpoint @ 0x10041cd46
//
// 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::toggleVisibility(PlayerObject *a1, bool a2)
{
__int64 v2; // rax
bool v3; // r14
GameManager *v5; // rax
HardStreak *m_waveTrail; // r14
double *v7; // rax
cocos2d::CCPoint v8; // xmm0_8
cocos2d::CCMotionStreak *v9; // rdi
unsigned int v10; // r14d
cocos2d::CCParticleSystem *v11; // r15
cocos2d::CCMotionStreak *m_shipStreak; // rdi
_QWORD v13[4]; // [rsp+0h] [rbp-20h] BYREF
v13[0] = v2;
v3 = !a2;
if ( a1->m_isHidden != !a2 )
{
if ( a2 )
{
a1->m_isHidden = v3;
((void (__fastcall *)(PlayerObject *, __int64))a1->setVisible)(a1, 1);
if ( a1->m_isShip || a1->m_isBird || a1->m_isDart || a1->m_isSwing )
{
PlayerObject::resetStreak(a1);
PlayerObject::activateStreak(a1);
cocos2d::CCParticleSystem::resetSystem(a1->m_trailingParticles);
if ( a1->m_isDart )
{
if ( !a1->m_maybeReducedEffects && !a1->m_isLocked && a1->m_fadeOutStreak )
{
if ( !a1->m_playEffects || (v5 = GameManager::sharedState(), !GJBaseGameLayer::isFlipping(v5->m_playLayer)) )
{
m_waveTrail = a1->m_waveTrail;
v7 = (double *)((__int64 (__fastcall *)(PlayerObject *))a1->getPosition)(a1);
*(double *)&v8 = sub_10028CC60(v13, v7);
HardStreak::addPoint(m_waveTrail, v8);
}
}
a1->m_justPlacedStreak = 0;
}
else if ( a1->m_isShip && !a1->m_isPlatformer )
{
m_shipStreak = a1->m_shipStreak;
if ( m_shipStreak )
((void (__fastcall *)(cocos2d::CCMotionStreak *, __int64))m_shipStreak->setVisible)(m_shipStreak, 1);
}
}
else if ( a1->m_alwaysShowStreak )
{
PlayerObject::resetStreak(a1);
PlayerObject::activateStreak(a1);
}
}
else
{
cocos2d::CCNode::stopActionByTag(a1, 11);
a1->m_isHidden = v3;
((void (__fastcall *)(PlayerObject *, _QWORD))a1->setVisible)(a1, 0);
PlayerObject::deactivateStreak(a1, 1);
v9 = a1->m_shipStreak;
if ( v9 )
((void (__fastcall *)(cocos2d::CCMotionStreak *, _QWORD))v9->setVisible)(v9, 0);
if ( (unsigned int)sub_100720070(a1->m_particleSystems) )
{
v10 = 0;
do
{
v11 = (cocos2d::CCParticleSystem *)sub_1007200C0(a1->m_particleSystems, v10);
cocos2d::CCParticleSystem::resetSystem(v11);
cocos2d::CCParticleSystem::stopSystem(v11);
++v10;
}
while ( v10 < (unsigned int)sub_100720070(a1->m_particleSystems) );
}
}
}
}