//
// PlayerObject::updateRobotAnimationSpeed from 0x62d6b4 to 0x62dca0 (1516 bytes)
//
// 4 xrefs:
// > PlayerObject::togglePlayerScale @ 0x62dea8
// > PlayerObject::updateTimeMod @ 0x62e0a4
// > PlayerObject::updateTimeMod @ 0x62e0f8
// > ??> @ 0xb4030
//
// 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 PlayerObject::updateRobotAnimationSpeed(PlayerObject *a1)
{
float m_playerSpeed; // s1
float v3; // s9
float v4; // s8
float v5; // s0
_BOOL4 m_isSpider; // w24
float v7; // s0
std::string *p_m_currentRobotAnimation; // x23
_DWORD *v9; // x22
stl::StringData::Internal *m_data; // x2
unsigned __int64 v11; // x21
stl::StringData::Internal *v12; // x1
unsigned __int64 v13; // x24
size_t v14; // x2
GJRobotSprite *m_robotSprite; // x19
char *v16; // x0
_DWORD *v17; // x22
unsigned __int64 v18; // x21
unsigned __int64 v19; // x23
size_t v20; // x2
char *v21; // x0
char *v22; // x0
unsigned int *v23; // x1
int v24; // w2
char *v25; // x19
unsigned int *v26; // x22
int v27; // w0
_DWORD *v28; // x22
unsigned __int64 v29; // x21
unsigned __int64 v30; // x23
size_t v31; // x2
unsigned __int64 v32; // x21
char *v33; // x0
unsigned int *v34; // x22
int v35; // w1
unsigned int *v36; // x22
int v37; // w1
unsigned int *v38; // x1
int v39; // w2
void *v40; // [xsp+70h] [xbp+70h] BYREF
void *v41; // [xsp+78h] [xbp+78h] BYREF
void *v42; // [xsp+80h] [xbp+80h] BYREF
m_playerSpeed = a1->m_playerSpeed;
v3 = 0.9;
if ( m_playerSpeed == 0.9 )
{
v4 = 1.0;
v3 = 1.0;
if ( a1->m_vehicleSize >= 1.0 )
goto LABEL_4;
LABEL_15:
v4 = 0.85;
v5 = v3 / 0.85;
goto LABEL_5;
}
if ( m_playerSpeed == 0.7 )
{
v4 = 1.0;
if ( a1->m_vehicleSize >= 1.0 )
{
LABEL_4:
v5 = v3;
goto LABEL_5;
}
goto LABEL_15;
}
if ( m_playerSpeed == 1.1 )
{
v3 = 1.15;
goto LABEL_18;
}
v3 = 1.3;
if ( m_playerSpeed == 1.3 )
{
LABEL_18:
if ( a1->m_vehicleSize < 1.0 )
{
v4 = 0.935;
v5 = v3 / 0.85;
}
else
{
v5 = v3;
v4 = 1.0 * 1.1;
}
goto LABEL_5;
}
if ( m_playerSpeed == 1.6 )
{
v3 = 1.5;
goto LABEL_18;
}
v5 = 1.0;
v4 = 1.0;
if ( a1->m_vehicleSize < 1.0 )
{
v5 = 1.1765;
v4 = 0.85;
}
v3 = 1.0;
if ( m_playerSpeed >= 1.1 )
v4 = v4 * 1.1;
LABEL_5:
SpriteAnimationManager::updateAnimationSpeed(a1->m_robotSprite->m_animationManager, v5);
SpriteAnimationManager::updateAnimationSpeed(a1->m_spiderSprite->m_animationManager, v3 / v4);
m_isSpider = a1->m_isSpider;
if ( !a1->m_isSpider )
goto LABEL_6;
sub_D18D28(&v40, &a1->m_spiderSprite->m_animationManager->m_currentAnimation);
sub_D153B8((int)&v41, "walk");
v17 = v41;
v18 = *((_QWORD *)v40 - 3);
v19 = *((_QWORD *)v41 - 3);
if ( v19 > v18 )
v20 = *((_QWORD *)v40 - 3);
else
v20 = *((_QWORD *)v41 - 3);
if ( memcmp(v40, v41, v20) || v18 - v19 + 0x80000000 > 0xFFFFFFFF || (_DWORD)v18 != (_DWORD)v19 )
{
sub_D153B8((int)&v42, "run");
m_isSpider = 0;
v28 = v42;
v29 = *((_QWORD *)v40 - 3);
v30 = *((_QWORD *)v42 - 3);
if ( v30 > v29 )
v31 = *((_QWORD *)v40 - 3);
else
v31 = *((_QWORD *)v42 - 3);
if ( !memcmp(v40, v42, v31) )
{
v32 = v29 - v30;
if ( v32 + 0x80000000 <= 0xFFFFFFFF )
m_isSpider = v32 == 0;
}
v33 = (char *)(v28 - 6);
if ( v28 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_64;
if ( &pthread_create )
{
v36 = v28 - 2;
do
v37 = __ldaxr(v36);
while ( __stlxr(v37 - 1, v36) );
}
else
{
v37 = *(v28 - 2);
*(v28 - 2) = v37 - 1;
}
if ( v37 > 0 )
{
LABEL_64:
v17 = v41;
}
else
{
operator delete(v33);
v17 = v41;
}
v21 = (char *)(v17 - 6);
if ( v17 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_35;
goto LABEL_69;
}
v21 = (char *)(v17 - 6);
if ( v17 - 6 != (_DWORD *)&qword_124B6B0 )
{
LABEL_69:
if ( &pthread_create )
{
v34 = v17 - 2;
do
v35 = __ldaxr(v34);
while ( __stlxr(v35 - 1, v34) );
}
else
{
v35 = *(v17 - 2);
*(v17 - 2) = v35 - 1;
}
if ( v35 <= 0 )
operator delete(v21);
}
LABEL_35:
if ( m_isSpider )
PlayerObject::playDynamicSpiderRun(a1);
v22 = (char *)v40 - 24;
if ( (char *)v40 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v23 = (unsigned int *)((char *)v40 - 8);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *((_DWORD *)v40 - 2);
*((_DWORD *)v40 - 2) = v24 - 1;
}
if ( v24 <= 0 )
operator delete(v22);
}
LABEL_6:
if ( a1->m_robotAnimation1Enabled && a1->m_playerSpeed == 0.7 )
{
p_m_currentRobotAnimation = &a1->m_currentRobotAnimation;
sub_D1798C(&a1->m_currentRobotAnimation, "run3", 4);
}
else
{
if ( a1->m_robotAnimation2Enabled )
{
v7 = a1->m_playerSpeed;
if ( v7 == 1.3 || v7 == 1.6 )
{
p_m_currentRobotAnimation = &a1->m_currentRobotAnimation;
sub_D1798C(&a1->m_currentRobotAnimation, "run2", 4);
if ( !a1->m_isRobot )
return;
goto LABEL_21;
}
}
p_m_currentRobotAnimation = &a1->m_currentRobotAnimation;
sub_D1798C(&a1->m_currentRobotAnimation, "run", 3);
}
if ( !a1->m_isRobot )
return;
LABEL_21:
sub_D18D28(&v41, &a1->m_robotSprite->m_animationManager->m_currentAnimation);
v9 = v41;
m_data = a1->m_currentRobotAnimation.m_data.m_data;
v11 = *((_QWORD *)v41 - 3);
v12 = m_data;
v13 = *((_QWORD *)m_data - 3);
if ( v13 > v11 )
v14 = *((_QWORD *)v41 - 3);
else
v14 = *((_QWORD *)m_data - 3);
if ( memcmp(v41, v12, v14) || v11 - v13 + 0x80000000 > 0xFFFFFFFF || (_DWORD)v11 != (_DWORD)v13 )
{
m_robotSprite = a1->m_robotSprite;
sub_D18D28(&v42, p_m_currentRobotAnimation);
CCAnimatedSprite::runAnimation((__int64)m_robotSprite, (__int64)&v42);
v16 = (char *)v42 - 24;
if ( (char *)v42 - 24 == (char *)&qword_124B6B0 )
goto LABEL_27;
if ( &pthread_create )
{
v38 = (unsigned int *)((char *)v42 - 8);
do
v39 = __ldaxr(v38);
while ( __stlxr(v39 - 1, v38) );
}
else
{
v39 = *((_DWORD *)v42 - 2);
*((_DWORD *)v42 - 2) = v39 - 1;
}
if ( v39 > 0 )
{
LABEL_27:
v9 = v41;
}
else
{
operator delete(v16);
v9 = v41;
}
}
v25 = (char *)(v9 - 6);
if ( v9 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = v9 - 2;
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *(v9 - 2);
*(v9 - 2) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v25);
}
}