//
// PlayerObject::togglePlayerScale from 0x1403a0700 to 0x1403a0d44 (1604 bytes)
//
// 10 xrefs:
// > GJBaseGameLayer::setupLevelStart @ 0x1402122ac
// > GJBaseGameLayer::setupLevelStart @ 0x1402122cb
// > GJBaseGameLayer::collisionCheckObjects @ 0x1402155d7
// > GJBaseGameLayer::collisionCheckObjects @ 0x14021565d
// > MenuGameLayer::resetPlayer @ 0x14033283a
// > MenuGameLayer::resetPlayer @ 0x14033324d
// > PlayerObject::resetObject @ 0x1403973c3
// > PlayerObject::copyAttributes @ 0x1403a05fe
// > PlayerObject::loadFromCheckpoint @ 0x1403a2a7f
// > ??> @ 0x1406d6944
//
// 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=5
void PlayerObject::togglePlayerScale(PlayerObject *a1, bool a2, bool a3)
{
float m_vehicleSize; // xmm0_4
int m_maybeSavedPlayerFrame; // edx
__int64 v7; // rax
float v8; // xmm1_4
float v9; // xmm0_4
bool *p_m_playEffects; // rbx
bool *v11; // rcx
GhostTrailEffect *m_ghostTrail; // rdx
cocos2d::CCMotionStreak *m_shipStreak; // rcx
GJActionManager *m_actionManager; // rdi
struct cocos2d::CCObject *v15; // rax
float v16; // xmm6_4
__int64 v17; // rax
struct cocos2d::CCScaleTo *v18; // rax
struct cocos2d::CCEaseElasticOut *v19; // rbx
__int64 v20; // rdi
GJBaseGameLayer *v21; // rdi
float *v22; // rax
float *v23; // rbx
__int64 v24; // rcx
cocos2d::CCDirector *v25; // rax
float v26; // xmm7_4
float v27; // xmm6_4
float v28; // xmm9_4
float v29; // xmm0_4
cocos2d::CCPoint v30; // rax
cocos2d::CCPoint v31; // rbx
cocos2d::CCPoint v32; // rax
cocos2d::ccColor3B v33[5]; // [rsp+58h] [rbp-49h] BYREF
cocos2d::CCPoint v34; // [rsp+70h] [rbp-31h] BYREF
cocos2d::CCPoint v35; // [rsp+78h] [rbp-29h] BYREF
cocos2d::CCPoint v36; // [rsp+80h] [rbp-21h] BYREF
void *v37; // [rsp+108h] [rbp+67h]
void *v38; // [rsp+108h] [rbp+67h]
__int16 v39; // [rsp+108h] [rbp+67h]
void *v40; // [rsp+120h] [rbp+7Fh]
m_vehicleSize = a1->m_vehicleSize;
if ( m_vehicleSize == 1.0 && !a2 )
return;
if ( a2 )
{
if ( m_vehicleSize != 1.0 )
return;
a1->m_vehicleSize = 0.60000002;
if ( !a1->m_defaultMiniIcon )
goto LABEL_22;
if ( a1->m_isBall )
{
PlayerObject::updatePlayerRollFrame(a1, 0);
goto LABEL_22;
}
if ( a1->m_isRobot || a1->m_isDart )
goto LABEL_22;
m_maybeSavedPlayerFrame = 0;
LABEL_21:
PlayerObject::updatePlayerFrame(a1, m_maybeSavedPlayerFrame);
goto LABEL_22;
}
if ( a1->m_isPlatformer )
a1->m_stateScale = 2;
a1->m_vehicleSize = 1.0;
if ( !a1->m_defaultMiniIcon )
goto LABEL_22;
if ( a1->m_isBall )
{
v7 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v37 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v37);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v7 = qword_1406C2ED8;
}
PlayerObject::updatePlayerRollFrame(a1, *(_DWORD *)(v7 + 732) - *(_DWORD *)(v7 + 736));
goto LABEL_22;
}
if ( !a1->m_isRobot && !a1->m_isDart )
{
m_maybeSavedPlayerFrame = a1->m_maybeSavedPlayerFrame;
goto LABEL_21;
}
LABEL_22:
v8 = a1->m_vehicleSize;
a1->m_spriteWidthScale = v8;
a1->m_spriteHeightScale = v8;
cocos2d::CCParticleSystem::loadScaledDefaults(a1->m_landParticles0, v8);
cocos2d::CCParticleSystem::loadScaledDefaults(a1->m_landParticles1, a1->m_vehicleSize);
cocos2d::CCParticleSystem::loadScaledDefaults(a1->m_playerGroundParticles, a1->m_vehicleSize);
cocos2d::CCParticleSystem::loadScaledDefaults(a1->m_vehicleGroundParticles, a1->m_vehicleSize);
cocos2d::CCParticleSystem::loadScaledDefaults(a1->m_trailingParticles, a1->m_vehicleSize);
cocos2d::CCParticleSystem::loadScaledDefaults(a1->m_shipClickParticles, a1->m_vehicleSize);
cocos2d::CCParticleSystem::loadScaledDefaults(a1->m_ufoClickParticles, a1->m_vehicleSize);
cocos2d::CCParticleSystem::loadScaledDefaults(a1->m_robotBurstParticles, a1->m_vehicleSize);
cocos2d::CCParticleSystem::loadScaledDefaults(a1->m_dashParticles, a1->m_vehicleSize);
cocos2d::CCParticleSystem::loadScaledDefaults(a1->m_swingBurstParticles1, a1->m_vehicleSize);
cocos2d::CCParticleSystem::loadScaledDefaults(a1->m_swingBurstParticles2, a1->m_vehicleSize);
v9 = 1.0;
if ( a1->m_isDart )
v9 = 0.80000001;
cocos2d::CCMotionStreak::setStroke(a1->m_regularTrail, (float)(a1->m_streakStrokeWidth * a1->m_vehicleSize) * v9);
p_m_playEffects = &a1->m_playEffects;
if ( a1->m_playEffects || (v11 = &a1->m_playEffects, a1->m_isDart) )
{
a1->m_waveTrail->m_waveSize = a1->m_vehicleSize;
v11 = &a1->m_playEffects;
}
m_ghostTrail = a1->m_ghostTrail;
if ( m_ghostTrail )
{
m_ghostTrail->m_playerScale = a1->m_vehicleSize;
p_m_playEffects = v11;
}
m_shipStreak = a1->m_shipStreak;
if ( m_shipStreak )
sub_1403862B0(m_shipStreak, a1->m_shipStreakType, (__int64)a1);
m_actionManager = a1->m_actionManager;
v15 = cocos2d::CCDictionary::objectForKey(m_actionManager->m_internalActions, 6);
if ( v15 )
{
((void (__fastcall *)(struct cocos2d::CCObject *))v15->__vftable[1].isEqual)(v15);
cocos2d::CCDictionary::removeObjectForKey(m_actionManager->m_internalActions, 6);
p_m_playEffects = &a1->m_playEffects;
}
v16 = a1->m_vehicleSize;
if ( !*p_m_playEffects || a1->m_maybeReducedEffects )
goto LABEL_44;
v17 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v38 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v38);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v17 = qword_1406C2ED8;
}
if ( *(_BYTE *)(*(_QWORD *)(v17 + 520) + 12837LL) )
{
LABEL_44:
((void (__fastcall *)(PlayerObject *))a1->setScaleX)(a1);
((void (__fastcall *)(PlayerObject *))a1->setScaleY)(a1);
}
else
{
v18 = cocos2d::CCScaleTo::create(0.5, v16, v16);
v19 = cocos2d::CCEaseElasticOut::create(v18);
v19->setTag(v19, 6);
cocos2d::CCDictionary::setObject(
a1->m_actionManager->m_internalActions,
v19,
v19->cocos2d::CCEaseElastic::cocos2d::CCActionEase::cocos2d::CCActionInterval::cocos2d::CCFiniteTimeAction::cocos2d::CCAction::m_nTag);
v19->startWithTarget(v19, a1);
v39 = -256;
if ( a1->m_vehicleSize != 1.0 )
v39 = 255;
if ( !a3 )
{
v20 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v40 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v40);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v20 = qword_1406C2ED8;
}
v21 = *(GJBaseGameLayer **)(v20 + 520);
cocos2d::CCPoint::CCPoint(&v34);
v23 = v22;
v25 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v24);
cocos2d::CCDirector::getWinSize(v25);
v26 = *v23 - 50.0;
v27 = *v23 + 100.0;
v28 = (float)((float)((float)rand() / 32767.0) * (float)(v27 - v26)) + v26;
v29 = v21->m_objectLayer->getScale(v21->m_objectLayer);
cocos2d::CCPoint::CCPoint(v29, v28);
*(_WORD *)&v33[0].r = v39;
v33[0].b = -106;
cocos2d::CCPoint::CCPoint(&v35);
v31 = v30;
cocos2d::CCPoint::CCPoint(&v36);
GJBaseGameLayer::lightningFlash(v21, v32, v31, v33, 5.0, 0.5, 0, 1, 1.0);
*(_WORD *)&v33[0].r = v39;
v33[0].b = -106;
PlayerObject::spawnPortalCircle(a1, v33, 45.0);
PlayerObject::spawnScaleCircle(a1);
}
}
if ( a1->m_isBall && a1->m_isRotating && !a1->m_isLocked && !a1->m_isDashing )
{
*(_WORD *)&a1->m_isRotating = 0;
a1->m_isBallRotating = 0;
a1->m_rotationSpeed = 0.0;
PlayerObject::runBallRotation(a1, 1.0);
}
PlayerObject::placeStreakPoint(a1);
PlayerObject::updateRobotAnimationSpeed(a1);
}