//
// PlayerObject::updateRobotAnimationSpeed from 0x34464c to 0x344872 (550 bytes)
//
// 2 xrefs:
// > PlayerObject::togglePlayerScale @ 0x344af8
// > PlayerObject::updateTimeMod @ 0x344c60
//
// 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 *p_m_playerSpeed; // r9
float m_playerSpeed; // s15
float v4; // s16
bool v5; // fnf
SpriteAnimationManager *m_animationManager; // r0
float v7; // s14
float v8; // s17
_BOOL4 m_isSpider; // r5
std::string *p_m_currentRobotAnimation; // r0
char *v11; // r1
GJRobotSprite *m_robotSprite; // r7
_BYTE v13[4]; // [sp+8h] [bp-10h] BYREF
_BYTE v14[4]; // [sp+Ch] [bp-Ch] BYREF
_BYTE v15[4]; // [sp+10h] [bp-8h] BYREF
p_m_playerSpeed = &a1->m_playerSpeed;
m_playerSpeed = a1->m_playerSpeed;
v4 = 0.9;
if ( m_playerSpeed == 0.9 )
{
v4 = 1.0;
}
else if ( m_playerSpeed != 0.7 )
{
if ( m_playerSpeed == 1.1 )
{
v4 = 1.15;
}
else
{
v4 = 1.3;
if ( m_playerSpeed != 1.3 )
{
v4 = 1.5;
if ( m_playerSpeed != 1.6 )
v4 = 1.0;
}
}
}
v5 = a1->m_vehicleSize < 1.0;
m_animationManager = a1->m_robotSprite->m_animationManager;
v7 = 0.85;
if ( !v5 )
v7 = 1.0;
if ( m_playerSpeed < 1.1 )
v8 = v7;
else
v8 = v7 * 1.1;
SpriteAnimationManager::updateAnimationSpeed(m_animationManager, v4 / v7);
SpriteAnimationManager::updateAnimationSpeed(a1->m_spiderSprite->m_animationManager, v4 / v8);
m_isSpider = a1->m_isSpider;
if ( a1->m_isSpider )
{
sub_775C20(v13, &a1->m_spiderSprite->m_animationManager->m_currentAnimation);
sub_776584((int)v14, "walk");
if ( sub_774DBC(v13, v14) )
{
sub_776584((int)v15, "run");
m_isSpider = sub_774DBC(v13, v15) == 0;
sub_774008(v15);
}
sub_774008(v14);
if ( m_isSpider )
PlayerObject::playDynamicSpiderRun(a1);
sub_774008(v13);
}
if ( a1->m_robotAnimation1Enabled && *p_m_playerSpeed == 0.7 )
{
p_m_currentRobotAnimation = &a1->m_currentRobotAnimation;
v11 = "run3";
}
else if ( a1->m_robotAnimation2Enabled && (*p_m_playerSpeed == 1.3 || *p_m_playerSpeed == 1.6) )
{
p_m_currentRobotAnimation = &a1->m_currentRobotAnimation;
v11 = "run2";
}
else
{
p_m_currentRobotAnimation = &a1->m_currentRobotAnimation;
v11 = "run";
}
sub_7753D4((int)p_m_currentRobotAnimation, v11);
if ( a1->m_isRobot )
{
sub_775C20(v14, &a1->m_robotSprite->m_animationManager->m_currentAnimation);
if ( sub_774DBC(v14, &a1->m_currentRobotAnimation) )
{
m_robotSprite = a1->m_robotSprite;
sub_775C20(v15, &a1->m_currentRobotAnimation);
CCAnimatedSprite::runAnimation((int)m_robotSprite, (int)v15);
sub_774008(v15);
}
sub_774008(v14);
}
}