//
// PlayerObject::loadFromCheckpoint from 0x350278 to 0x350af2 (2170 bytes)
//
// 2 xrefs:
// > PlayLayer::loadFromCheckpoint @ 0x31f518
// > PlayLayer::loadFromCheckpoint @ 0x31f538
//
// 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::loadFromCheckpoint(PlayerObject *a1, PlayerCheckpoint *a2)
{
float m_rotation; // r1
double m_yVelocityBeforeSlope; // r0
float m_slopeAngle; // r2
double m_scaleXRelated2; // r0
double m_scaleXRelated4; // r0
double unk_584; // r0
float m_slopeAngleRadians; // r2
double m_speedMultiplier; // r0
float m_trailingParticleLife; // r2
double m_gameModeChangedTime; // r0
float m_landParticlesAngle; // r2
double m_slopeRotation; // r0
double m_collidedTopMinY; // r0
double m_yVelocity; // r0
float m_xVelocityRelated2; // r2
double m_maybeReverseAcceleration; // r0
int v20; // r2
bool v21; // r3
double m_lastLandTime; // r0
float m_platformerVelocityRelated; // r2
double m_scaleXRelatedTime; // r0
bool m_controlsDisabled; // r3
cocos2d::CCArray *m_touchingRings; // r3
double m_totalTime; // r0
float m_yVelocityRelated3; // r2
double m_scaleXRelated; // r0
int v30; // r2
float m_xVelocityRelated; // r2
double m_maybeSlopeForce; // r0
double m_physDeltaRelated; // r0
double m_maybeSlidingStartTime; // r0
double m_maybeChangedDirectionAngle; // r0
int m_stateForce; // r3
bool v37; // r1
void (__fastcall *setPosition)(PlayerObject *__hidden, const cocos2d::CCPoint *); // r9
GhostType m_ghostType; // r1
int v40; // r2
bool v41; // r3
double m_snapDistance; // r0
float m_unk838; // r2
float m_slopeVelocity; // r2
cocos2d::ccArray *data; // r2
unsigned int num; // r3
cocos2d::CCObject **arr; // r2
unsigned int v48; // r6
cocos2d::CCObject **v49; // r8
cocos2d::CCObject *v50; // r1
cocos2d::CCObject *v51; // t1
PlayLayer *m_playLayer; // r6
GameManager *v53; // r0
int v54; // r2
PlayLayer *v55; // r3
PlayLayer *v56; // r6
GameManager *v57; // r0
GameManager *v58; // r0
GameManager *v59; // r0
GameManager *v60; // r0
PlayLayer *v61; // r6
GameManager *v62; // r0
PlayLayer *v63; // r6
GameManager *v64; // r0
_BOOL4 m_jumpBuffered; // r3
double m_lastFlipTime; // r0
double m_dashStartTime; // r0
cocos2d::CCPoint v68; // [sp+Ch] [bp-10h] BYREF
m_rotation = a2->m_rotation;
a1->m_maybeReducedEffects = 1;
((void (__fastcall *)(PlayerObject *, _DWORD))a1->setRotation)(a1, LODWORD(m_rotation));
m_yVelocityBeforeSlope = a2->m_yVelocityBeforeSlope;
m_slopeAngle = a2->m_slopeAngle;
a1->m_wasTeleported = a2->m_wasTeleported;
a1->m_fixGravityBug = a2->m_fixGravityBug;
a1->m_reverseSync = a2->m_reverseSync;
a1->m_yVelocityBeforeSlope = m_yVelocityBeforeSlope;
a1->m_slopeStartTime = a2->m_slopeStartTime;
a1->m_justPlacedStreak = a2->m_justPlacedStreak;
a1->m_lastCollisionBottom = a2->m_lastCollisionBottom;
a1->m_lastCollisionTop = a2->m_lastCollisionTop;
a1->m_lastCollisionLeft = a2->m_lastCollisionLeft;
a1->m_lastCollisionRight = a2->m_lastCollisionRight;
a1->m_unk50C = a2->m_unk50C;
a1->m_unk510 = a2->m_unk510;
a1->m_currentSlope2 = a2->m_currentSlope2;
a1->m_preLastGroundObject = a2->m_preLastGroundObject;
a1->m_slopeAngle = m_slopeAngle;
a1->m_slopeSlidingMaybeRotated = a2->m_slopeSlidingMaybeRotated;
a1->m_quickCheckpointMode = a2->m_quickCheckpointMode;
m_scaleXRelated2 = a2->m_scaleXRelated2;
a1->m_collidedObject = a2->m_collidedObject;
a1->m_lastGroundObject = a2->m_lastGroundObject;
a1->m_collidingWithLeft = a2->m_collidingWithLeft;
a1->m_collidingWithRight = a2->m_collidingWithRight;
a1->m_scaleXRelated2 = m_scaleXRelated2;
a1->m_groundYVelocity = a2->m_groundYVelocity;
a1->m_yVelocityRelated = a2->m_yVelocityRelated;
a1->m_scaleXRelated3 = a2->m_scaleXRelated3;
m_scaleXRelated4 = a2->m_scaleXRelated4;
a1->m_collidingBetweenSteps = a2->m_collidingBetweenSteps;
a1->m_scaleXRelated4 = m_scaleXRelated4;
a1->m_scaleXRelated5 = a2->m_scaleXRelated5;
unk_584 = a2->unk_584;
a1->m_isCollidingWithSlope = a2->m_isCollidingWithSlope;
a1->m_isBallRotating = a2->m_isBallRotating;
a1->m_unk669 = a2->m_unk669;
a1->m_currentPotentialSlope = a2->m_currentPotentialSlope;
a1->m_currentSlope = a2->m_currentSlope;
a1->unk_584 = unk_584;
m_slopeAngleRadians = a2->m_slopeAngleRadians;
m_speedMultiplier = a2->m_speedMultiplier;
a1->m_collidingWithSlopeId = a2->m_collidingWithSlopeId;
a1->m_slopeFlipGravityRelated = a2->m_slopeFlipGravityRelated;
a1->m_slopeAngleRadians = m_slopeAngleRadians;
a1->m_rotationSpeed = a2->m_rotationSpeed;
a1->m_rotateSpeed = a2->m_rotateSpeed;
m_trailingParticleLife = a2->m_trailingParticleLife;
a1->m_isRotating = a2->m_isRotating;
a1->m_isBallRotating2 = a2->m_isBallRotating2;
a1->m_speedMultiplier = m_speedMultiplier;
a1->m_yStart = a2->m_yStart;
a1->m_gravity = a2->m_gravity;
m_gameModeChangedTime = a2->m_gameModeChangedTime;
a1->m_trailingParticleLife = m_trailingParticleLife;
a1->m_gameModeChangedTime = m_gameModeChangedTime;
a1->m_padRingRelated = a2->m_padRingRelated;
a1->m_maybeIsFalling = a2->m_maybeIsFalling;
a1->m_shouldTryPlacingCheckpoint = a2->m_shouldTryPlacingCheckpoint;
a1->m_playEffects = a2->m_playEffects;
a1->m_isOnGround3 = a2->m_isOnGround3;
a1->m_lastSpiderFlipTime = a2->m_lastSpiderFlipTime;
a1->m_unkBool5 = a2->m_unkBool5;
a1->m_ringJumpRelated = a2->m_ringJumpRelated;
std::_Hashtable,std::__detail::_Identity,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::operator=(
(int)&a1->m_ringRelatedSet,
&a2->m_ringRelatedSet._M_h._M_buckets);
m_landParticlesAngle = a2->m_landParticlesAngle;
m_slopeRotation = a2->m_slopeRotation;
a1->m_maybeSpriteRelated = a2->m_maybeSpriteRelated;
a1->m_landParticlesAngle = m_landParticlesAngle;
a1->m_landParticleRelatedY = a2->m_landParticleRelatedY;
a1->m_slopeRotation = m_slopeRotation;
a1->m_currentSlopeYVelocity = a2->m_currentSlopeYVelocity;
a1->m_unk3d0 = a2->m_unk3d0;
a1->m_blackOrbRelated = a2->m_blackOrbRelated;
m_collidedTopMinY = a2->m_collidedTopMinY;
a1->m_unk3e0 = a2->m_unk3e0;
a1->m_unk3e1 = a2->m_unk3e1;
a1->m_isAccelerating = a2->m_isAccelerating;
a1->m_isCurrentSlopeTop = a2->m_isCurrentSlopeTop;
a1->m_collidedTopMinY = m_collidedTopMinY;
a1->m_collidedBottomMaxY = a2->m_collidedBottomMaxY;
a1->m_collidedLeftMaxX = a2->m_collidedLeftMaxX;
a1->m_collidedRightMinX = a2->m_collidedRightMinX;
a1->m_wasJumpBuffered = a2->m_wasJumpBuffered;
a1->m_wasRobotJump = a2->m_wasRobotJump;
m_yVelocity = a2->m_yVelocity;
m_xVelocityRelated2 = a2->m_xVelocityRelated2;
a1->m_stateJumpBuffered = a2->m_stateJumpBuffered;
a1->m_stateRingJump2 = a2->m_stateRingJump2;
a1->m_touchedRing = a2->m_touchedRing;
a1->m_touchedCustomRing = a2->m_touchedCustomRing;
a1->m_touchedGravityPortal = a2->m_touchedGravityPortal;
a1->m_maybeTouchedBreakableBlock = a2->m_maybeTouchedBreakableBlock;
a1->m_touchedPad = a2->m_touchedPad;
a1->m_yVelocity = m_yVelocity;
a1->m_fallSpeed = a2->m_fallSpeed;
m_maybeReverseAcceleration = a2->m_maybeReverseAcceleration;
a1->m_maybeUpsideDownSlope = a2->m_maybeUpsideDownSlope;
a1->m_reverseRelated = a2->m_reverseRelated;
a1->m_maybeReverseAcceleration = m_maybeReverseAcceleration;
a1->m_xVelocityRelated2 = m_xVelocityRelated2;
cocos2d::CCPoint::operator=(
(PlayerObject *)&a1->m_shipRotation,
COERCE_FLOAT((PlayerCheckpoint *)&a2->m_shipRotation),
SLODWORD(m_xVelocityRelated2),
(_BYTE)a1 - 40);
cocos2d::CCPoint::operator=(
(PlayerObject *)&a1->m_lastPortalPos,
COERCE_FLOAT((PlayerCheckpoint *)&a2->m_lastPortalPos),
v20,
v21);
m_lastLandTime = a2->m_lastLandTime;
a1->m_unkUnused3 = a2->m_unkUnused3;
m_platformerVelocityRelated = a2->m_platformerVelocityRelated;
a1->m_isOnGround2 = a2->m_isOnGround2;
a1->m_lastLandTime = m_lastLandTime;
m_scaleXRelatedTime = a2->m_scaleXRelatedTime;
a1->m_platformerVelocityRelated = m_platformerVelocityRelated;
a1->m_maybeIsBoosted = a2->m_maybeIsBoosted;
a1->m_scaleXRelatedTime = m_scaleXRelatedTime;
a1->m_isLocked = a2->m_isLocked;
m_controlsDisabled = a2->m_controlsDisabled;
a1->m_controlsDisabled = m_controlsDisabled;
cocos2d::CCPoint::operator=(
(PlayerObject *)&a1->m_lastGroundedPos,
COERCE_FLOAT((PlayerCheckpoint *)&a2->m_lastGroundedPos),
SLODWORD(m_platformerVelocityRelated),
m_controlsDisabled);
cocos2d::CCArray::removeAllObjects(a1->m_touchingRings);
m_touchingRings = a2->m_touchingRings;
if ( m_touchingRings )
{
data = m_touchingRings->data;
num = data->num;
if ( data->num )
{
arr = data->arr;
v48 = (unsigned int)(&arr[num] + 0x3FFFFFFF);
v49 = arr;
while ( (unsigned int)v49 <= v48 )
{
v51 = *v49++;
v50 = v51;
if ( !v51 )
break;
cocos2d::CCArray::addObject(a1->m_touchingRings, v50);
}
}
}
std::_Hashtable,std::__detail::_Identity,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::operator=(
(int)&a1->m_touchedRings,
&a2->m_touchedRings._M_h._M_buckets);
m_totalTime = a2->m_totalTime;
m_yVelocityRelated3 = a2->m_yVelocityRelated3;
a1->m_lastActivatedPortal = a2->m_lastActivatedPortal;
a1->m_totalTime = m_totalTime;
m_scaleXRelated = a2->m_scaleXRelated;
a1->m_yVelocityRelated3 = m_yVelocityRelated3;
v30 = *(_DWORD *)&a2->m_stateUnk;
a1->m_defaultMiniIcon = a2->m_defaultMiniIcon;
a1->m_swapColors = a2->m_swapColors;
a1->m_switchDashFireColor = a2->m_switchDashFireColor;
a1->m_stateOnGround = a2->m_stateOnGround;
*(_DWORD *)&a1->m_stateUnk = v30;
a1->m_stateBoostX = a2->m_stateBoostX;
a1->m_stateBoostY = a2->m_stateBoostY;
a1->m_maybeStateForce2 = a2->m_maybeStateForce2;
a1->m_stateScale = a2->m_stateScale;
a1->m_platformerXVelocity = a2->m_platformerXVelocity;
a1->m_holdingRight = a2->m_holdingRight;
a1->m_holdingLeft = a2->m_holdingLeft;
a1->m_leftPressedFirst = a2->m_leftPressedFirst;
a1->m_scaleXRelated = m_scaleXRelated;
m_xVelocityRelated = a2->m_xVelocityRelated;
a1->m_maybeHasStopped = a2->m_maybeHasStopped;
a1->m_xVelocityRelated = m_xVelocityRelated;
m_maybeSlopeForce = a2->m_maybeSlopeForce;
a1->m_maybeGoingCorrectSlopeDirection = a2->m_maybeGoingCorrectSlopeDirection;
a1->m_isSliding = a2->m_isSliding;
a1->m_maybeSlopeForce = m_maybeSlopeForce;
m_physDeltaRelated = a2->m_physDeltaRelated;
a1->m_isOnIce = a2->m_isOnIce;
a1->m_physDeltaRelated = m_physDeltaRelated;
m_maybeSlidingStartTime = a2->m_maybeSlidingStartTime;
a1->m_isOnGround4 = a2->m_isOnGround4;
a1->m_maybeSlidingTime = a2->m_maybeSlidingTime;
a1->m_maybeSlidingStartTime = m_maybeSlidingStartTime;
a1->m_changedDirectionsTime = a2->m_changedDirectionsTime;
a1->m_slopeEndTime = a2->m_slopeEndTime;
m_maybeChangedDirectionAngle = a2->m_maybeChangedDirectionAngle;
a1->m_isMoving = a2->m_isMoving;
a1->m_platformerMovingLeft = a2->m_platformerMovingLeft;
a1->m_platformerMovingRight = a2->m_platformerMovingRight;
a1->m_isSlidingRight = a2->m_isSlidingRight;
a1->m_maybeChangedDirectionAngle = m_maybeChangedDirectionAngle;
a1->m_unkUnused2 = a2->m_unkUnused2;
a1->m_stateNoAutoJump = a2->m_stateNoAutoJump;
a1->m_stateDartSlide = a2->m_stateDartSlide;
a1->m_stateHitHead = a2->m_stateHitHead;
a1->m_stateFlipGravity = a2->m_stateFlipGravity;
m_stateForce = a2->m_stateForce;
a1->m_stateForce = m_stateForce;
cocos2d::CCPoint::operator=(
(PlayerObject *)&a1->m_stateForceVector,
COERCE_FLOAT((PlayerCheckpoint *)&a2->m_stateForceVector),
(int)&a2->m_unkUnused2,
m_stateForce);
a1->m_affectedByForces = a2->m_affectedByForces;
std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::operator=(
(int)&a1->m_jumpPadRelated,
(int)&a2->m_jumpPadRelated);
v37 = !a2->m_isHidden;
a1->m_fallStartY = a2->m_fallStartY;
PlayerObject::toggleVisibility(a1, v37);
setPosition = a1->setPosition;
cocos2d::CCPoint::CCPoint(&v68, &a2->m_position);
setPosition(a1, &v68);
PlayerObject::flipGravity(a1, a2->m_isUpsideDown, 0);
PlayerObject::rotateGameplayOnly(a1, a2->m_isSideways);
m_ghostType = a2->m_ghostType;
a1->m_gravityMod = a2->m_gravityMod;
PlayerObject::toggleGhostEffect(a1, m_ghostType);
PlayerObject::togglePlayerScale(a1, a2->m_isMini, 0);
a1->m_maybeReverseSpeed = a2->m_maybeReverseSpeed;
cocos2d::CCPoint::CCPoint(&v68, &a2->m_lastPosition);
cocos2d::CCPoint::operator=((PlayerObject *)&a1->m_lastPosition, COERCE_FLOAT(&v68), v40, v41);
m_snapDistance = a2->m_snapDistance;
m_unk838 = a2->m_unk838;
a1->m_objectSnappedTo = a2->m_objectSnappedTo;
a1->m_snapDistance = m_snapDistance;
a1->m_accelerationOrSpeed = a2->m_accelerationOrSpeed;
a1->m_unk838 = m_unk838;
a1->m_followRelated = a2->m_followRelated;
std::vector::operator=((void **)&a1->m_playerFollowFloats.m_start, (void **)&a2->m_playerFollowFloats.m_start);
m_slopeVelocity = a2->m_slopeVelocity;
a1->m_wasOnSlope = a2->m_wasOnSlope;
a1->m_isOnSlope = a2->m_isOnSlope;
a1->m_slopeVelocity = m_slopeVelocity;
if ( a2->m_isGoingLeft )
PlayerObject::doReversePlayer(a1, 1);
PlayerObject::updateTimeMod(a1, a2->m_playerSpeed, 0);
if ( a2->m_isShip )
{
m_playLayer = GameManager::sharedState()->m_playLayer;
v53 = GameManager::sharedState();
v54 = 5;
v55 = v53->m_playLayer;
LABEL_15:
GJBaseGameLayer::switchToFlyMode(m_playLayer, a1, v55->m_gameState.m_lastActivatedPortal1, 1, v54);
goto LABEL_24;
}
if ( a2->m_isBall )
{
v56 = GameManager::sharedState()->m_playLayer;
v57 = GameManager::sharedState();
GJBaseGameLayer::switchToRollMode(v56, a1, v57->m_playLayer->m_gameState.m_lastActivatedPortal1, 1);
}
else
{
if ( a2->m_isBird )
{
m_playLayer = GameManager::sharedState()->m_playLayer;
v58 = GameManager::sharedState();
v54 = 19;
v55 = v58->m_playLayer;
goto LABEL_15;
}
if ( a2->m_isSwing )
{
m_playLayer = GameManager::sharedState()->m_playLayer;
v59 = GameManager::sharedState();
v54 = 41;
v55 = v59->m_playLayer;
goto LABEL_15;
}
if ( a2->m_isDart )
{
m_playLayer = GameManager::sharedState()->m_playLayer;
v60 = GameManager::sharedState();
v54 = 26;
v55 = v60->m_playLayer;
goto LABEL_15;
}
if ( a2->m_isRobot )
{
v61 = GameManager::sharedState()->m_playLayer;
v62 = GameManager::sharedState();
GJBaseGameLayer::switchToRobotMode(v61, a1, v62->m_playLayer->m_gameState.m_lastActivatedPortal1, 1);
}
else if ( a2->m_isSpider )
{
v63 = GameManager::sharedState()->m_playLayer;
v64 = GameManager::sharedState();
GJBaseGameLayer::switchToSpiderMode(v63, a1, v64->m_playLayer->m_gameState.m_lastActivatedPortal1, 1);
}
}
LABEL_24:
PlayerObject::resetStreak(a1);
m_jumpBuffered = a2->m_jumpBuffered;
a1->m_jumpBuffered = m_jumpBuffered;
if ( m_jumpBuffered && a2->m_isDashing )
{
a1->m_dashX = a2->m_dashX;
a1->m_dashY = a2->m_dashY;
a1->m_dashAngle = a2->m_dashAngle;
m_dashStartTime = a2->m_dashStartTime;
a1->m_dashRing = a2->m_dashRing;
a1->m_dashStartTime = m_dashStartTime;
PlayerObject::startDashing(a1, nullptr);
}
PlayerObject::setYVelocity(a1, a2->m_yVelocityUnrounded, 50);
m_lastFlipTime = a2->m_lastFlipTime;
a1->m_isOnGround = a2->m_isOnGround;
a1->m_lastFlipTime = m_lastFlipTime;
a1->m_decreaseBoostSlide = a2->m_decreaseBoostSlide;
if ( a2->m_platformerCheckpoint )
{
PlayerObject::releaseAllButtons(a1);
PlayerObject::setYVelocity(a1, 0.0, 50);
a1->m_platformerXVelocity = 0.0;
a1->m_isOnGround = 0;
}
((void (__fastcall *)(PlayerObject *, _DWORD))a1->setRotation)(a1, LODWORD(a2->m_rotation));
a1->m_maybeReducedEffects = 0;
if ( a1->m_isPlatformer )
PlayerObject::releaseAllButtons(a1);
}