//
// PlayerObject::spawnFromPlayer from 0x1004085d0 to 0x100408700 (304 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::toggleDualMode @ 0x100101893
// > GJBaseGameLayer::spawnPlayer2 @ 0x100107289
//
// 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:05 +0000
//
void __fastcall PlayerObject::spawnFromPlayer(
__int64 a1,
__int64 a2,
int a3,
double a4,
double a5,
double a6,
__m128 a7)
{
double v8; // xmm0_8
unsigned __int8 v9; // al
__m128d v10; // xmm0
double v11; // xmm1_8
__m128d v12; // xmm3
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 344LL))(a1, 1);
v8 = (*(double (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 912LL))(a1, 255);
PlayerObject::copyAttributes(a1, a2, v8, a5, a6, a7);
v9 = *(_BYTE *)(a2 + 2423);
if ( !a3 )
{
PlayerObject::flipGravity(a1, v9, 1, v8);
v10 = (__m128d)*(unsigned __int64 *)(a2 + 2392);
v11 = _mm_cvtepi32_pd(_mm_cvttpd_epi32(v10)).f64[0];
if ( v10.f64[0] == v11 )
goto LABEL_6;
goto LABEL_5;
}
PlayerObject::flipGravity(a1, v9 ^ 1, 1, v8);
v10.f64[0] = -*(double *)(a2 + 2392);
v10.f64[1] = -0.0;
v11 = _mm_cvtepi32_pd(_mm_cvttpd_epi32(v10)).f64[0];
if ( v11 != v10.f64[0] )
{
LABEL_5:
v10.f64[0] = (v10.f64[0] - v11) * 1000.0;
v12 = _mm_or_pd(_mm_and_pd((__m128d)xmmword_100A04960, v10), (__m128d)xmmword_100A04D50);
v12.f64[0] = v12.f64[0] + v10.f64[0];
v10.f64[0] = _mm_round_sd((__m128d)0LL, v12, 11).f64[0] / 1000.0 + v11;
}
LABEL_6:
*(double *)(a1 + 2392) = v10.f64[0];
*(_BYTE *)(a1 + 2425) = 0;
*(_BYTE *)(a1 + 2500) = 0;
PlayerObject::toggleVisibility(a1, *(_BYTE *)(a2 + 1787) ^ 1);
if ( *(_BYTE *)(a1 + 2420) == 1 )
sub_1003F05E0(a1);
}