//
// PlayerObject::toggleRollMode from 0x14039b570 to 0x14039b6ee (382 bytes)
//
// 21 xrefs:
// > GJBaseGameLayer::setupLevelStart @ 0x1402124af
// > GJBaseGameLayer::setupLevelStart @ 0x140212545
// > GJBaseGameLayer::setupLevelStart @ 0x14021255c
// > GJBaseGameLayer::setupLevelStart @ 0x1402127dd
// > GJBaseGameLayer::setupLevelStart @ 0x140212876
// > GJBaseGameLayer::setupLevelStart @ 0x140212920
// > GJBaseGameLayer::setupLevelStart @ 0x1402129b9
// > GJBaseGameLayer::switchToRobotMode @ 0x140212c5a
// > GJBaseGameLayer::switchToSpiderMode @ 0x140212d4a
// > GJBaseGameLayer::switchToRollMode @ 0x140212ee7
// > GJBaseGameLayer::collisionCheckObjects @ 0x140214efc
// > GJBaseGameLayer::collisionCheckObjects @ 0x140215274
// > GJBaseGameLayer::collisionCheckObjects @ 0x140215286
// > GJBaseGameLayer::collisionCheckObjects @ 0x14021539b
// > GJBaseGameLayer::collisionCheckObjects @ 0x140215495
// > MenuGameLayer::resetPlayer @ 0x140332b63
// > MenuGameLayer::resetPlayer @ 0x1403330f4
// > PlayerObject::resetObject @ 0x140397378
// > PlayerObject::switchedToMode @ 0x14039be6d
// > PlayerObject::copyAttributes @ 0x1403a057f
// > ??> @ 0x1406d65d8
//
// 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
//
// Hidden C++ exception states: #wind=2
void PlayerObject::toggleRollMode(PlayerObject *a1, bool a2, bool a3)
{
float m_vehicleSize; // xmm0_4
int v7; // edx
__int64 v8; // rax
int m_maybeSavedPlayerFrame; // edx
void *v10; // [rsp+30h] [rbp+8h] BYREF
__int16 v11; // [rsp+38h] [rbp+10h]
if ( a1->m_isBall != a2 )
{
a1->m_gameModeChangedTime = a1->m_totalTime;
a1->m_isBall = a2;
if ( a2 )
PlayerObject::switchedToMode(a1, BallPortal);
m_vehicleSize = a1->m_vehicleSize;
if ( a1->m_isBall )
{
if ( m_vehicleSize == 1.0 || !a1->m_defaultMiniIcon )
{
v8 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v10 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v8 = qword_1406C2ED8;
}
v7 = *(_DWORD *)(v8 + 732) - *(_DWORD *)(v8 + 736);
}
else
{
v7 = 0;
}
PlayerObject::updatePlayerRollFrame(a1, v7);
if ( !a3 )
{
v11 = 13055;
LOWORD(v10) = 13055;
BYTE2(v10) = 50;
PlayerObject::spawnPortalCircle(a1, (cocos2d::ccColor3B *)&v10, 50.0);
}
}
else
{
if ( m_vehicleSize == 1.0 || !a1->m_defaultMiniIcon )
m_maybeSavedPlayerFrame = a1->m_maybeSavedPlayerFrame;
else
m_maybeSavedPlayerFrame = 0;
PlayerObject::updatePlayerFrame(a1, m_maybeSavedPlayerFrame);
((void (__fastcall *)(PlayerObject *))a1->setRotation)(a1);
}
*(_WORD *)&a1->m_isRotating = 0;
a1->m_isBallRotating = 0;
a1->m_rotationSpeed = 0.0;
if ( a2 )
{
PlayerObject::updatePlayerArt(a1);
PlayerObject::updateDashArt(a1);
}
}
}