//
// PlayerObject::spawnFromPlayer from 0x10041b760 to 0x10041b8eb (395 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::toggleDualMode @ 0x1001240a3
// > GJBaseGameLayer::spawnPlayer2 @ 0x100129859
//
// 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
//
// local variable allocation has failed, the output may be wrong!
void __fastcall PlayerObject::spawnFromPlayer(PlayerObject *a1, bool a2)
{
__int64 v2; // rax
int v3; // edx
int v4; // r15d
char v5; // al
__m128d v6; // xmm0
double v7; // xmm1_8
__m128d v8; // xmm3
GameManager *v9; // rax
HardStreak *m_waveTrail; // r14
double *v11; // rax
cocos2d::CCPoint v12; // xmm0_8
_QWORD v13[4]; // [rsp+0h] [rbp-20h] BYREF
v13[0] = v2;
v4 = v3;
((void (__fastcall *)(PlayerObject *, __int64))a1->setVisible)(a1, 1);
((void (__fastcall *)(PlayerObject *, __int64))a1->setOpacity)(a1, 255);
PlayerObject::copyAttributes(a1);
v5 = *(_BYTE *)(a2 + 2415LL);
if ( !v4 )
{
PlayerObject::flipGravity(a1, v5, 1);
v6 = (__m128d)*(unsigned __int64 *)(a2 + 2384LL);
v7 = _mm_cvtepi32_pd(_mm_cvttpd_epi32(v6)).f64[0];
if ( v6.f64[0] == v7 )
goto LABEL_6;
goto LABEL_5;
}
PlayerObject::flipGravity(a1, v5 != 1, 1);
v6.f64[0] = -*(double *)(a2 + 2384LL);
v6.f64[1] = -0.0;
v7 = _mm_cvtepi32_pd(_mm_cvttpd_epi32(v6)).f64[0];
if ( v7 != v6.f64[0] )
{
LABEL_5:
v6.f64[0] = (v6.f64[0] - v7) * 1000.0;
v8 = _mm_or_pd(_mm_and_pd((__m128d)xmmword_100816590, v6), (__m128d)xmmword_100816960);
v8.f64[0] = v8.f64[0] + v6.f64[0];
v6.f64[0] = _mm_round_sd((__m128d)0LL, v8, 11).f64[0] / 1000.0 + v7;
}
LABEL_6:
a1->m_yVelocity = v6.f64[0];
a1->m_isOnGround = 0;
a1->m_isOnGround2 = 0;
PlayerObject::toggleVisibility(a1, *(_BYTE *)(a2 + 1779LL) != 1);
if ( a1->m_isDart )
{
if ( !a1->m_maybeReducedEffects && !a1->m_isLocked && a1->m_fadeOutStreak )
{
if ( !a1->m_playEffects || (v9 = GameManager::sharedState(), !GJBaseGameLayer::isFlipping(v9->m_playLayer)) )
{
m_waveTrail = a1->m_waveTrail;
v11 = (double *)((__int64 (__fastcall *)(PlayerObject *))a1->getPosition)(a1);
*(double *)&v12 = sub_10028CC60(v13, v11);
HardStreak::addPoint(m_waveTrail, v12);
}
}
a1->m_justPlacedStreak = 0;
}
}