//
// GJBaseGameLayer::update from 0x140237850 to 0x1402393e0 (7056 bytes)
//
// 4 xrefs:
// > ??> @ 0x140566bc8
// > ??> @ 0x140585f20
// > ??> @ 0x1405c97b0
// > ??> @ 0x1406ce148
//
// 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 GJBaseGameLayer::update(GJBaseGameLayer *a1, float a2)
{
GJBaseGameLayer *v3; // rcx
double v4; // xmm12_8
double ModifiedDelta; // xmm10_8
double v6; // xmm9_8
double v7; // xmm7_8
double v8; // xmm10_8
float v9; // xmm0_4
__int64 v10; // rcx
int v11; // r11d
double v12; // xmm10_8
double v13; // xmm5_8
double v14; // xmm7_8
double v15; // xmm8_8
cocos2d::CCDirector *v16; // rax
__m128i *p_m_areaMovedCountDisplay; // rdx
unsigned __int64 p_m_followedCountDisplay; // r8
int *p_m_areaScaledCountDisplay; // rcx
__int64 v20; // r10
__m128 v21; // xmm2
__int64 v22; // rax
char v23; // r13
int v24; // r15d
float v25; // xmm1_4
cocos2d::CCPoint *QuadPart; // r12
double v27; // xmm11_8
double v28; // xmm12_8
double v29; // xmm13_8
double v30; // xmm9_8
double v31; // xmm0_8
double v32; // xmm1_8
double v33; // xmm7_8
std::_Vector_val>::pointer Myfirst; // rbx
std::_Vector_val>::pointer Mylast; // rdi
double v36; // xmm8_8
double m_timestamp; // xmm6_8
bool v38; // zf
__int64 v39; // rdx
float v40; // xmm15_4
std::set> *p_m_spawnTuples; // r14
GJGameState *p_m_gameState; // r13
float v43; // xmm10_4
float v44; // xmm9_4
bool v45; // r15
int m_tickIndex; // ecx
int v47; // ecx
std::_Tree_val, std::pair>>>::_Nodeptr Myhead; // r14
_QWORD *v49; // rbx
void *v50; // rcx
std::_Tree_val>>::_Nodeptr v51; // rdi
_QWORD *v52; // rbx
void *v53; // rcx
float m_timeModRelated; // xmm6_4
bool m_timeModRelated2; // bl
PlayerObject *m_player1; // rbx
PlayerObject *m_player2; // rbx
std::_List_val>>::_Nodeptr v58; // rdx
__int64 *i; // rax
_QWORD *v60; // rdi
_QWORD *v61; // rbx
void *v62; // rcx
bool m_isDualMode; // di
PlayerObject *v64; // rbx
float v65; // xmm6_4
PlayerObject *v66; // rbx
float v67; // xmm0_4
PlayerObject *v68; // rcx
float m_unkUnused3; // xmm6_4
PlayerObject *v70; // rcx
float v71; // xmm6_4
bool v72; // bl
float v73; // xmm6_4
PlayerObject *v74; // rdx
PlayerObject *v75; // r8
float v76; // xmm0_4
int m_followRelated; // ecx
PlayerObject *v78; // rdx
PlayerObject *v79; // r8
float v80; // xmm0_4
int v81; // ecx
__int64 v82; // rax
__int64 v83; // rax
int m_unkUint5; // eax
std::_List_val>>::_Nodeptr v85; // r14
__int64 *j; // rbx
int v87; // eax
int v88; // edi
int m_unkUint12; // ecx
__int64 v90; // rax
PlayerObject *v91; // rax
PlayerObject *v92; // rax
int v93; // edx
std::_Vector_val>::pointer v94; // r8
std::_List_val>>::_Nodeptr v95; // rax
std::_List_val>>::_Nodeptr v96; // rbx
__int64 v97; // rdi
std::_Vector_val>>>>>::pointer v98; // r8
std::_Simple_types>>>>::value_type *v99; // rcx
std::_List_val>>::_Nodeptr Ptr; // rax
std::_List_val>>::_Nodeptr v101; // rax
std::_List_simple_types>::_Node *v102; // rdi
_QWORD *v103; // rax
_QWORD *v104; // rbx
float v105; // xmm0_4
PlayerObject *v106; // rbx
int v107; // eax
int v108; // r11d
double v109; // xmm1_8
std::_List_val>>>::_Nodeptr v110; // r12
_QWORD *k; // rbx
__int64 *v112; // r14
__int64 *m; // r15
__int64 v114; // rdi
__int64 v115; // rax
std::_List_val>>>::_Nodeptr v116; // r12
_QWORD *n; // rbx
__int64 *v118; // r14
__int64 *ii; // r15
__int64 v120; // rdi
__int64 v121; // rax
char v122; // di
PlayerObject *v123; // rcx
__int64 v124; // rax
__int64 v125; // rcx
__int64 v126; // rax
float m_levelFlipping; // xmm7_4
cocos2d::CCDirector *v128; // rax
float v129; // xmm6_4
const cocos2d::CCPoint *v130; // rax
float v131; // xmm0_4
float v132; // xmm6_4
const cocos2d::CCPoint *v133; // rax
double v134; // xmm0_8
const cocos2d::CCPoint *v135; // rax
float m_cameraShakeFactor; // xmm0_4
float v137; // xmm6_4
float v138; // xmm0_4
float v139; // xmm1_4
std::_List_val>>>::_Nodeptr v140; // rax
int *v141; // rbx
FMODAudioEngine *v142; // rcx
std::_Vector_val>>>>>>::pointer v143; // rcx
std::_Simple_types>>>>>::value_type *v144; // rax
int *v145; // r8
std::_List_val>>>::_Nodeptr v146; // r8
int *v147; // rdi
float v148; // xmm6_4
float m_timeWarp; // [rsp+20h] [rbp-E0h]
double v150; // [rsp+28h] [rbp-D8h]
double v151; // [rsp+30h] [rbp-D0h]
int v152; // [rsp+38h] [rbp-C8h] BYREF
float v153; // [rsp+3Ch] [rbp-C4h]
double v154; // [rsp+40h] [rbp-C0h]
double v155; // [rsp+48h] [rbp-B8h]
cocos2d::CCPoint v156; // [rsp+50h] [rbp-B0h] BYREF
cocos2d::CCPoint v157; // [rsp+58h] [rbp-A8h] BYREF
double v158; // [rsp+60h] [rbp-A0h]
double v159; // [rsp+68h] [rbp-98h]
_BYTE v160[32]; // [rsp+70h] [rbp-90h] BYREF
cocos2d::CCPoint v161; // [rsp+90h] [rbp-70h] BYREF
cocos2d::CCPoint v162; // [rsp+98h] [rbp-68h] BYREF
char v163[184]; // [rsp+A0h] [rbp-60h] BYREF
LARGE_INTEGER PerformanceCount; // [rsp+1A0h] [rbp+A0h] BYREF
char v165; // [rsp+1A8h] [rbp+A8h]
int v166; // [rsp+1B0h] [rbp+B0h]
int v167; // [rsp+1B8h] [rbp+B8h]
if ( !byte_1406C10A0 )
{
QueryPerformanceFrequency(&Frequency);
byte_1406C10A0 = 1;
}
QueryPerformanceCounter(&PerformanceCount);
v4 = (double)(int)PerformanceCount.LowPart / (double)(int)Frequency.LowPart;
v159 = v4;
if ( a1->m_resumeTimer <= 0 && a1->m_audioPaused )
{
GJBaseGameLayer::resumeAudio(v3);
a1->m_audioPaused = 0;
}
if ( a1->m_started )
((void (__fastcall *)(GJBaseGameLayer *))a1->applyTimeWarp)(a1);
ModifiedDelta = a2;
if ( a1->m_started )
ModifiedDelta = GJBaseGameLayer::getModifiedDelta(a1, a2);
else
a1->m_extraDelta = 0.0;
v6 = ModifiedDelta;
v151 = ModifiedDelta;
v7 = ModifiedDelta / a1->m_gameState.m_timeWarp;
if ( a1->m_started && a1->m_resumeTimer <= 0 )
{
if ( ModifiedDelta > 0.0 )
{
v8 = ModifiedDelta * 60.0;
a1->m_player1->m_maybeIsColliding = 0;
a1->m_player2->m_maybeIsColliding = 0;
if ( !a1->m_player1->m_isLocked )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&PerformanceCount);
a1->m_player1->setPosition_0(a1->m_player1, (const cocos2d::CCPoint *)&PerformanceCount);
}
if ( a1->m_gameState.m_isDualMode && !a1->m_player2->m_isLocked )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&PerformanceCount);
a1->m_player2->setPosition_0(a1->m_player2, (const cocos2d::CCPoint *)&PerformanceCount);
}
v9 = v8 / fminf(a1->m_gameState.m_timeWarp, 1.0) * 4.0;
v11 = (int)fmaxf(1.0, roundf(v9));
v166 = v11;
a1->m_jumping = 0;
v12 = v8 / (double)v11;
v158 = v12;
v13 = v6 / (double)v11;
v150 = v13;
v14 = v7 / (double)v11;
v154 = v14;
v15 = v13 * 60.0;
v155 = v13 * 60.0;
if ( !a1->m_unk322a && a1->m_unk3251 )
{
v16 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v10);
a1->m_gameState.m_cameraStepDiff.x = 15.0
- (float)(75.0
- (float)(**(float **)&cocos2d::CCDirector::getWinSize(v16) * 0.5));
v13 = v150;
v11 = v166;
}
a1->m_unk3251 = 0;
p_m_areaMovedCountDisplay = (__m128i *)&a1->m_areaMovedCountDisplay;
p_m_followedCountDisplay = (unsigned __int64)&a1->m_followedCountDisplay;
if ( &a1->m_areaMovedCountDisplay > &a1->m_followedCount
|| p_m_followedCountDisplay < (unsigned __int64)&a1->m_areaMovedCount )
{
v22 = 3;
do
{
v21 = _mm_add_ps(
_mm_mul_ps(_mm_cvtepi32_ps(_mm_loadu_si128(p_m_areaMovedCountDisplay - 3)), (__m128)xmmword_140624070),
_mm_mul_ps(_mm_cvtepi32_ps(_mm_loadu_si128(p_m_areaMovedCountDisplay)), (__m128)xmmword_140624090));
*p_m_areaMovedCountDisplay++ = _mm_cvttps_epi32(v21);
--v22;
}
while ( v22 );
}
else
{
p_m_followedCountDisplay = 12;
p_m_areaScaledCountDisplay = &a1->m_areaScaledCountDisplay;
v20 = 3;
do
{
*(p_m_areaScaledCountDisplay - 1) = (int)(float)((float)((float)*(p_m_areaScaledCountDisplay - 13) * 0.1)
+ (float)((float)*(p_m_areaScaledCountDisplay - 1) * 0.89999998));
v21.m128_f32[0] = (float)((float)*(p_m_areaScaledCountDisplay - 12) * 0.1)
+ (float)((float)*p_m_areaScaledCountDisplay * 0.89999998);
*p_m_areaScaledCountDisplay = (int)v21.m128_f32[0];
p_m_areaScaledCountDisplay[1] = (int)(float)((float)((float)*(p_m_areaScaledCountDisplay - 11) * 0.1)
+ (float)((float)p_m_areaScaledCountDisplay[1] * 0.89999998));
p_m_areaScaledCountDisplay[2] = (int)(float)((float)((float)*(p_m_areaScaledCountDisplay - 10) * 0.1)
+ (float)((float)p_m_areaScaledCountDisplay[2] * 0.89999998));
p_m_areaScaledCountDisplay += 4;
--v20;
}
while ( v20 );
}
m_timeWarp = a1->m_gameState.m_timeWarp;
v23 = 0;
v165 = 0;
v24 = 0;
v167 = 0;
if ( v11 > 0 )
{
v25 = v14;
v153 = v25;
QuadPart = (cocos2d::CCPoint *)PerformanceCount.QuadPart;
while ( 1 )
{
v27 = v12;
v28 = v13;
v29 = v14;
v30 = v15;
a1->m_isBetweenSteps = 0;
if ( !a1->m_clickBetweenSteps
|| (v31 = v25,
v32 = v25 * 0.5,
v33 = a1->m_timestamp + v31,
Myfirst = a1->m_queuedButtons._Mypair._Myval2._Myfirst,
Mylast = a1->m_queuedButtons._Mypair._Myval2._Mylast,
Myfirst == Mylast) )
{
LABEL_39:
v38 = !a1->m_isBetweenSteps;
}
else
{
v36 = a1->m_timestamp + v32;
while ( 1 )
{
m_timestamp = Myfirst->m_timestamp;
if ( m_timestamp >= v36 && v33 > m_timestamp && GJBaseGameLayer::buttonIsRelevant(a1, Myfirst) )
break;
if ( m_timestamp < v33 && ++Myfirst != Mylast )
continue;
goto LABEL_39;
}
a1->m_isBetweenSteps = 1;
v27 = v12 * 0.5;
v28 = v150 * 0.5;
v29 = v154 * 0.5;
v30 = v155 * 0.5;
v38 = !a1->m_isBetweenSteps;
}
v39 = v38;
PerformanceCount.LowPart = v38;
p_m_spawnTuples = &a1->m_spawnTuples;
p_m_gameState = &a1->m_gameState;
v43 = v28;
v44 = v30;
do
{
v45 = (_DWORD)v39 == 1 && v24 == v166 - 1;
*(_QWORD *)&a1->m_areaMovedCount = 0;
*(_QWORD *)&a1->m_areaRotatedCount = 0;
*(_QWORD *)&a1->m_areaMovedCountTotal = 0;
*(_QWORD *)&a1->m_areaRotatedCountTotal = 0;
*(_QWORD *)&a1->m_movedCount = 0;
*(_QWORD *)&a1->m_rotatedCount = 0;
a1->m_gameState.m_totalTime = v28 + a1->m_gameState.m_totalTime;
a1->m_gameState.m_unkDouble3 = v29 + a1->m_gameState.m_unkDouble3;
if ( !a1->m_levelEndAnimationStarted && !a1->m_playerDied )
{
a1->m_timePlayed = v29 + a1->m_timePlayed;
m_tickIndex = a1->m_tickIndex;
if ( a1->m_isBetweenSteps )
v47 = m_tickIndex + 1;
else
v47 = m_tickIndex + 2;
a1->m_tickIndex = v47;
((void (__fastcall *)(GJBaseGameLayer *, __int64, unsigned __int64))a1->updateAttemptTime)(
a1,
v39,
p_m_followedCountDisplay);
LODWORD(v39) = PerformanceCount.LowPart;
}
a1->m_player1->m_totalTime = a1->m_gameState.m_totalTime;
a1->m_player2->m_totalTime = a1->m_gameState.m_totalTime;
if ( !a1->m_isBetweenSteps || !(_DWORD)v39 )
{
Myhead = a1->m_destroyObjectValues._Mypair._Myval2._Myval2._Myhead;
v49 = *((_QWORD **)Myhead + 1);
while ( !*((_BYTE *)v49 + 25) )
{
sub_14024EA90(&a1->m_destroyObjectValues, &a1->m_destroyObjectValues, v49[2]);
v50 = v49;
v49 = (_QWORD *)*v49;
j_j_free(v50);
}
*((_QWORD *)Myhead + 1) = Myhead;
*(_QWORD *)Myhead = Myhead;
*((_QWORD *)Myhead + 2) = Myhead;
a1->m_destroyObjectValues._Mypair._Myval2._Myval2._Mysize = 0;
p_m_spawnTuples = &a1->m_spawnTuples;
v51 = a1->m_spawnTuples._Mypair._Myval2._Myval2._Myhead;
v52 = *((_QWORD **)v51 + 1);
while ( !*((_BYTE *)v52 + 25) )
{
sub_140093E00((__int64)&a1->m_spawnTuples, (__int64)&a1->m_spawnTuples, v52[2]);
v53 = v52;
v52 = (_QWORD *)*v52;
j_j_free(v53);
}
*((_QWORD *)v51 + 1) = v51;
*(_QWORD *)v51 = v51;
*((_QWORD *)v51 + 2) = v51;
a1->m_spawnTuples._Mypair._Myval2._Myval2._Mysize = 0;
}
GJEffectManager::updateSpawnTriggers(a1->m_effectManager, v43);
m_timeModRelated = a1->m_gameState.m_timeModRelated;
if ( m_timeModRelated != 0.0 )
{
m_timeModRelated2 = a1->m_gameState.m_timeModRelated2;
a1->m_gameState.m_timeModRelated = 0.0;
a1->m_gameState.m_timeModRelated2 = 0;
PlayerObject::updateTimeMod(a1->m_player1, m_timeModRelated, m_timeModRelated2);
if ( a1->m_gameState.m_isDualMode )
PlayerObject::updateTimeMod(a1->m_player2, m_timeModRelated, m_timeModRelated2);
}
((void (__fastcall *)(GJBaseGameLayer *))a1->applyTimeWarp)(a1);
v40 = v29;
GJBaseGameLayer::processCommands(a1, v40, a1->m_isBetweenSteps, v45);
PlayerObject::resetTouchedRings(a1->m_player1, 0);
if ( a1->m_gameState.m_isDualMode )
PlayerObject::resetTouchedRings(a1->m_player2, 0);
m_player1 = a1->m_player1;
cocos2d::CCDictionary::removeAllObjects(m_player1->m_collisionLogTop);
cocos2d::CCDictionary::removeAllObjects(m_player1->m_collisionLogBottom);
cocos2d::CCDictionary::removeAllObjects(m_player1->m_collisionLogLeft);
cocos2d::CCDictionary::removeAllObjects(m_player1->m_collisionLogRight);
m_player1->m_unk50C = m_player1->m_lastCollisionBottom;
m_player1->m_unk510 = m_player1->m_lastCollisionTop;
*(_QWORD *)&m_player1->m_lastCollisionBottom = -1;
*(_QWORD *)&m_player1->m_lastCollisionLeft = -1;
if ( a1->m_gameState.m_isDualMode )
{
m_player2 = a1->m_player2;
cocos2d::CCDictionary::removeAllObjects(m_player2->m_collisionLogTop);
cocos2d::CCDictionary::removeAllObjects(m_player2->m_collisionLogBottom);
cocos2d::CCDictionary::removeAllObjects(m_player2->m_collisionLogLeft);
cocos2d::CCDictionary::removeAllObjects(m_player2->m_collisionLogRight);
m_player2->m_unk50C = m_player2->m_lastCollisionBottom;
m_player2->m_unk510 = m_player2->m_lastCollisionTop;
*(_QWORD *)&m_player2->m_lastCollisionBottom = -1;
*(_QWORD *)&m_player2->m_lastCollisionLeft = -1;
}
v58 = a1->m_effectManager->m_unkMap288._List._Mypair._Myval2._Myhead;
for ( i = *(__int64 **)v58; i != (__int64 *)v58; i = (__int64 *)*i )
*((_BYTE *)i + 20) = 0;
v60 = p_m_spawnTuples->_Mypair._Myval2._Myval2._Myhead;
v61 = *((_QWORD **)p_m_spawnTuples->_Mypair._Myval2._Myval2._Myhead + 1);
while ( !*((_BYTE *)v61 + 25) )
{
sub_140093E00((__int64)p_m_spawnTuples, (__int64)p_m_spawnTuples, v61[2]);
v62 = v61;
v61 = (_QWORD *)*v61;
j_j_free(v62);
}
v60[1] = v60;
*v60 = v60;
v60[2] = v60;
p_m_spawnTuples->_Mypair._Myval2._Myval2._Mysize = 0;
m_isDualMode = a1->m_gameState.m_isDualMode;
v64 = a1->m_player1;
v65 = v64->getPosition_0(v64)->y - v64->m_lastPosition.y;
v66 = a1->m_player1;
if ( !a1->m_playerDied && fabs(v65 - v66->m_yVelocityRelated3) > v27 * 16.0 )
v65 = 0.0;
v67 = v66->getPosition_0(a1->m_player1)->x - v66->m_lastPosition.x;
if ( a1->m_playerDied )
v67 = 0.0;
a1->m_effectManager->m_unk780 = v67;
if ( a1->m_playerDied )
v65 = 0.0;
a1->m_effectManager->m_unk784 = v65;
a1->m_effectManager->m_unk788 = -a1->m_gameState.m_cameraStepDiff.x;
a1->m_effectManager->m_unk78C = -a1->m_gameState.m_cameraStepDiff.y;
v68 = a1->m_player1;
m_unkUnused3 = v68->m_unkUnused3;
a1->m_effectManager->m_unk790 = v68->getRotation(v68) - m_unkUnused3;
v70 = a1->m_player2;
v71 = v70->m_unkUnused3;
a1->m_effectManager->m_unk794 = v70->getRotation(v70) - v71;
if ( !a1->m_playerDied )
GJEffectManager::updateTimers(a1->m_effectManager, v43, v21.m128_f32[0]);
GJEffectManager::prepareMoveActions(a1->m_effectManager, v43, !v45);
GJBaseGameLayer::processMoveActionsStep(a1, v43, v45);
GJEffectManager::postMoveActions(a1->m_effectManager);
a1->updateVerifyDamage(a1);
GJBaseGameLayer::updateCollisionBlocks(a1);
if ( !a1->m_playerDied )
{
v72 = a1->m_isEditor || a1->m_ignoreDamage;
a1->m_player2->m_maybeReverseSpeed = a1->m_player1->m_maybeReverseSpeed;
a1->m_player2->m_maybeReverseAcceleration = a1->m_player1->m_maybeReverseAcceleration;
PlayerObject::updateInternalActions(a1->m_player1, v43);
if ( a1->m_gameState.m_isDualMode )
PlayerObject::updateInternalActions(a1->m_player2, v43);
((void (__fastcall *)(PlayerObject *))a1->m_player1->update)(a1->m_player1);
v74 = a1->m_player1;
if ( !a1->m_enable22Changes || !v74->m_isLocked )
{
v21.m128_f32[0] = v27;
v73 = v27;
if ( GJBaseGameLayer::checkCollisions(a1, v74, v73, v72) == 1 && a1->m_isEditor && !a1->m_ignoreDamage )
a1->playerTookDamage(a1, a1->m_player1);
}
v75 = a1->m_player1;
v76 = v43 + v75->m_unk838;
v75->m_unk838 = v76;
m_followRelated = v75->m_followRelated;
if ( v76 >= 0.0099999998 )
{
v75->m_unk838 = v76 - 0.0099999998;
v75->m_followRelated = ++m_followRelated;
}
v75->m_playerFollowFloats._Mypair._Myval2._Myfirst[m_followRelated % 200] = v75->m_obPosition.y;
if ( m_isDualMode && a1->m_gameState.m_isDualMode )
{
((void (__fastcall *)(PlayerObject *))a1->m_player2->update)(a1->m_player2);
v78 = a1->m_player2;
if ( !a1->m_enable22Changes || !v78->m_isLocked )
{
v21.m128_f32[0] = v27;
if ( GJBaseGameLayer::checkCollisions(a1, v78, v21.m128_f32[0], v72) == 1
&& a1->m_isEditor
&& !a1->m_ignoreDamage )
{
a1->playerTookDamage(a1, a1->m_player2);
}
}
v79 = a1->m_player2;
v80 = v43 + v79->m_unk838;
v79->m_unk838 = v80;
v81 = v79->m_followRelated;
if ( v80 >= 0.0099999998 )
{
v79->m_unk838 = v80 - 0.0099999998;
v79->m_followRelated = ++v81;
}
v79->m_playerFollowFloats._Mypair._Myval2._Myfirst[v81 % 200] = v79->m_obPosition.y;
}
a1->m_gameState.m_levelTime = v28 / a1->m_gameState.m_timeWarp + a1->m_gameState.m_levelTime;
GJBaseGameLayer::checkSpawnObjects(a1);
a1->m_player1->m_unkUnused3 = a1->m_player1->getRotation(a1->m_player1);
a1->m_player2->m_unkUnused3 = a1->m_player2->getRotation(a1->m_player2);
PlayerObject::updateRotation_1(a1->m_player1, v44);
if ( a1->m_gameState.m_isDualMode )
PlayerObject::updateRotation_1(a1->m_player2, v44);
a1->m_player1->getPosition_0(a1->m_player1);
cocos2d::CCPoint::CCPoint(&v161);
cocos2d::CCPoint::operator=(&a1->m_player1->m_shipRotation, v82);
if ( a1->m_gameState.m_isDualMode )
{
a1->m_player2->getPosition_0(a1->m_player2);
cocos2d::CCPoint::CCPoint(&v162);
cocos2d::CCPoint::operator=(&a1->m_player2->m_shipRotation, v83);
}
m_unkUint5 = a1->m_gameState.m_unkUint5;
if ( !m_unkUint5 || (unsigned int)(m_unkUint5 + 1000) <= a1->m_gameState.m_unkUint6 )
{
a1->m_gameState.m_unkUint5 = a1->m_gameState.m_unkUint6;
++a1->m_gameState.m_unkUint11;
v85 = a1->m_savePositionValues._List._Mypair._Myval2._Myhead;
for ( j = *(__int64 **)v85; j != (__int64 *)v85; j = (__int64 *)*j )
{
v87 = *((_DWORD *)j + 4);
v152 = v87;
v88 = *((_DWORD *)j + 5);
m_unkUint12 = 0;
if ( v87 <= 0 )
{
switch ( v87 )
{
case -3:
m_unkUint12 = a1->m_gameState.m_unkUint12;
QuadPart = &a1->m_gameState.m_cameraPosition2;
break;
case -2:
v92 = a1->m_player2;
m_unkUint12 = v92->m_unk52C;
QuadPart = &v92->m_lastPosition;
break;
case -1:
v91 = a1->m_player1;
m_unkUint12 = v91->m_unk52C;
QuadPart = &v91->m_lastPosition;
break;
}
}
else
{
v90 = *(_QWORD *)(*(_QWORD *)sub_14024E530(&a1->m_savePositionObjects, v160, &v152) + 24LL);
QuadPart = (cocos2d::CCPoint *)(v90 + 1232);
m_unkUint12 = *(_DWORD *)(v90 + 1348);
}
v93 = 2 * (m_unkUint12 + a1->m_gameState.m_unkUint11 % v88);
v94 = a1->m_gameState.m_unkVecFloat1._Mypair._Myval2._Myfirst;
v94[v93] = QuadPart->x;
v94[v93 + 1] = QuadPart->y;
}
p_m_spawnTuples = &a1->m_spawnTuples;
}
a1->m_gameState.m_unkUint17 = GJBaseGameLayer::getMaxPortalY(a1);
a1->checkForEnd(a1);
a1->m_timestamp = v28 + a1->m_timestamp;
}
GJEffectManager::postCollisionCheck(a1->m_effectManager);
GJBaseGameLayer::checkRepellPlayer(a1);
v95 = a1->m_gameState.m_stateObjects._List._Mypair._Myval2._Myhead;
v96 = *(std::_List_val>>::_Nodeptr *)v95;
if ( *(std::_List_val>>::_Nodeptr *)v95 != v95 )
{
do
{
v97 = *((_QWORD *)v96 + 3);
if ( *(_DWORD *)(v97 + 1364) < (signed int)a1->m_gameState.m_commandIndex )
*(_BYTE *)(v97 + 1360) = 0;
if ( !*(_BYTE *)(v97 + 1360) )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v97 + 1664LL))(v97);
if ( *(_BYTE *)(v97 + 760) )
{
v96 = *(std::_List_val>>::_Nodeptr *)v96;
}
else
{
(*(void (__fastcall **)(__int64, GJBaseGameLayer *))(*(_QWORD *)v97 + 1672LL))(v97, a1);
v98 = a1->m_gameState.m_stateObjects._Vec._Mypair._Myval2._Myfirst;
v99 = &v98[2
* ((0x100000001B3LL
* (*((unsigned __int8 *)v96 + 19)
^ (0x100000001B3LL
* (*((unsigned __int8 *)v96 + 18)
^ (0x100000001B3LL
* (*((unsigned __int8 *)v96 + 17)
^ (0x100000001B3LL * (*((unsigned __int8 *)v96 + 16) ^ 0xCBF29CE484222325uLL))))))))
& a1->m_gameState.m_stateObjects._Mask)];
Ptr = v99->_Ptr;
if ( v99[1]._Ptr == v96 )
{
if ( Ptr == v96 )
{
v101 = a1->m_gameState.m_stateObjects._List._Mypair._Myval2._Myhead;
v98[2
* ((0x100000001B3LL
* (*((unsigned __int8 *)v96 + 19)
^ (0x100000001B3LL
* (*((unsigned __int8 *)v96 + 18)
^ (0x100000001B3LL
* (*((unsigned __int8 *)v96 + 17)
^ (0x100000001B3LL * (*((unsigned __int8 *)v96 + 16) ^ 0xCBF29CE484222325uLL))))))))
& a1->m_gameState.m_stateObjects._Mask)]._Ptr = v101;
}
else
{
v101 = *((std::_List_val>>::_Nodeptr *)v96
+ 1);
}
v99[1]._Ptr = v101;
}
else if ( Ptr == v96 )
{
v98[2
* ((0x100000001B3LL
* (*((unsigned __int8 *)v96 + 19)
^ (0x100000001B3LL
* (*((unsigned __int8 *)v96 + 18)
^ (0x100000001B3LL
* (*((unsigned __int8 *)v96 + 17)
^ (0x100000001B3LL * (*((unsigned __int8 *)v96 + 16) ^ 0xCBF29CE484222325uLL))))))))
& a1->m_gameState.m_stateObjects._Mask)] = *(std::_Vector_val>>>>>::pointer)v96;
}
v102 = *(std::_List_simple_types>::_Node **)v96;
--a1->m_gameState.m_stateObjects._List._Mypair._Myval2._Mysize;
**((_QWORD **)v96 + 1) = v102;
*((_QWORD *)v102 + 1) = *((_QWORD *)v96 + 1);
j_j_free(v96);
v96 = v102;
}
}
while ( v96 != a1->m_gameState.m_stateObjects._List._Mypair._Myval2._Myhead );
p_m_gameState = &a1->m_gameState;
p_m_spawnTuples = &a1->m_spawnTuples;
}
GJGameState::processStateTriggers(p_m_gameState);
v103 = p_m_gameState->m_tweenActions._List._Mypair._Myval2._Myhead;
v104 = (_QWORD *)*v103;
if ( (_QWORD *)*v103 != v103 )
{
do
{
GJValueTween::step((GJValueTween *)((char *)v104 + 20), v43);
v105 = *((float *)v104 + 9);
switch ( *((_DWORD *)v104 + 4) )
{
case 1:
p_m_gameState->m_cameraPosition.x = v105;
break;
case 2:
p_m_gameState->m_cameraPosition.y = v105;
break;
case 7:
p_m_gameState->m_levelFlipping = v105;
break;
case 9:
p_m_gameState->m_portalY = v105;
break;
case 0xA:
p_m_gameState->m_unkPoint6.x = v105;
break;
case 0xB:
p_m_gameState->m_unkPoint6.y = v105;
break;
case 0xC:
p_m_gameState->m_unkPoint8.x = v105;
break;
case 0xD:
p_m_gameState->m_unkPoint8.y = v105;
break;
case 0xE:
p_m_gameState->m_cameraZoom = v105;
break;
case 0xF:
p_m_gameState->m_cameraOffset.x = v105;
break;
case 0x10:
p_m_gameState->m_cameraOffset.y = v105;
break;
case 0x11:
p_m_gameState->m_cameraAngle = v105;
break;
case 0x12:
p_m_gameState->m_unkPoint26.x = v105;
break;
case 0x13:
p_m_gameState->m_unkPoint26.y = v105;
break;
case 0x14:
p_m_gameState->m_middleGroundOffsetY = v105;
break;
case 0x15:
p_m_gameState->m_unkPoint12.x = v105;
break;
case 0x16:
p_m_gameState->m_unkPoint12.y = v105;
break;
case 0x19:
p_m_gameState->m_unkFloat9 = v105;
break;
default:
break;
}
if ( *((_BYTE *)v104 + 48) )
v104 = *(_QWORD **)sub_14024D170(&p_m_gameState->m_tweenActions, v163, v104);
else
v104 = (_QWORD *)*v104;
}
while ( v104 != (_QWORD *)p_m_gameState->m_tweenActions._List._Mypair._Myval2._Myhead );
p_m_spawnTuples = &a1->m_spawnTuples;
}
GJBaseGameLayer::updateCamera(a1, v44);
a1->checkSnapshot(a1);
if ( a1->m_isPracticeMode )
{
v106 = a1->m_player1;
if ( v106->m_canPlaceCheckpoint )
{
PlayerObject::tryPlaceCheckpoint(a1->m_player1);
v106->m_canPlaceCheckpoint = 0;
}
if ( (v106->m_isShip || v106->m_isBird || v106->m_isDart || v106->m_isSwing) && v106->m_uniqueID == 1 )
{
v107 = v106->m_onFlyCheckpointTries + 1;
v106->m_onFlyCheckpointTries = v107;
if ( v107 >= 20 )
{
v106->m_onFlyCheckpointTries = 0;
PlayerObject::tryPlaceCheckpoint(v106);
}
}
if ( v106->m_checkpointTimeout && sub_14003CF30() - v106->m_lastCheckpointTime > 0.1000000014901161 )
v106->m_checkpointTimeout = 0;
}
a1->processCheckpoints(a1);
v39 = PerformanceCount.LowPart + 1;
PerformanceCount.LowPart = v39;
v24 = v167;
}
while ( (int)v39 < 2 );
if ( a1->m_gameState.m_queuedTimeWarp > 0.0 )
{
((void (__fastcall *)(GJBaseGameLayer *))a1->updateTimeWarp)(a1);
((void (__fastcall *)(GJBaseGameLayer *))a1->applyTimeWarp)(a1);
}
v21.m128_i32[0] = LODWORD(a1->m_gameState.m_timeWarp);
if ( v21.m128_f32[0] == m_timeWarp )
break;
v108 = v166;
v13 = v150;
v6 = v151;
if ( v166 - v24 - 1 <= 0 )
goto LABEL_185;
v109 = (float)((double)(v166 - v24 - 1) * v150);
v6 = v151 - v109;
v151 = v151 - v109;
a1->m_extraDelta = v109 + a1->m_extraDelta;
v24 = v108;
v23 = 1;
v165 = 1;
LABEL_186:
m_timeWarp = v21.m128_f32[0];
v167 = ++v24;
v12 = v158;
v14 = v154;
v15 = v155;
v25 = v153;
if ( v24 >= v108 )
{
v4 = v159;
goto LABEL_188;
}
}
v13 = v150;
v6 = v151;
v108 = v166;
LABEL_185:
v23 = v165;
goto LABEL_186;
}
LABEL_188:
if ( a1->m_isPlatformer )
GJBaseGameLayer::updateSpecialLabels(a1);
GJBaseGameLayer::updateTimerLabels(a1);
v110 = a1->m_labelObjects._List._Mypair._Myval2._Myhead;
for ( k = *(_QWORD **)v110; k != (_QWORD *)v110; k = (_QWORD *)*k )
{
v112 = (__int64 *)k[3];
for ( m = (__int64 *)k[4]; v112 != m; ++v112 )
{
v114 = *v112;
if ( *(_BYTE *)(*v112 + 773) && *(_BYTE *)(v114 + 1864) )
{
v115 = sub_14003BDB0((__int64)v160, v114 + 1872);
LabelGameObject::updateLabel(v114, v115);
}
}
}
v116 = a1->m_timeLabelObjects._List._Mypair._Myval2._Myhead;
for ( n = *(_QWORD **)v116; n != (_QWORD *)v116; n = (_QWORD *)*n )
{
v118 = (__int64 *)n[3];
for ( ii = (__int64 *)n[4]; v118 != ii; ++v118 )
{
v120 = *v118;
if ( *(_BYTE *)(*v118 + 773) && *(_BYTE *)(v120 + 1864) )
{
v121 = sub_14003BDB0((__int64)v160, v120 + 1872);
LabelGameObject::updateLabel(v120, v121);
}
}
}
v122 = 0;
cocos2d::CCPoint::CCPoint(&v156);
cocos2d::CCPoint::CCPoint(&v157);
v123 = a1->m_player1;
if ( !v123->m_isLocked )
{
v123->getPosition_0(v123);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&PerformanceCount);
cocos2d::CCPoint::operator=(&a1->m_player1->m_position, v124);
if ( a1->m_gameState.m_isDualMode )
{
a1->m_player2->getPosition_0(a1->m_player2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&PerformanceCount);
cocos2d::CCPoint::operator=(&a1->m_player2->m_position, v126);
}
m_levelFlipping = a1->m_gameState.m_levelFlipping;
if ( m_levelFlipping != 0.0 && m_levelFlipping != 1.0 )
{
if ( a1->m_cameraFlip == -1.0 )
m_levelFlipping = 1.0 - m_levelFlipping;
v122 = 1;
v128 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v125);
v129 = **(float **)&cocos2d::CCDirector::getWinSize(v128);
v130 = a1->m_player1->getPosition_0(a1->m_player1);
v131 = (float)(v130->x - a1->m_gameState.m_cameraPosition.x)
+ (float)(v130->x - a1->m_gameState.m_cameraPosition.x);
v132 = (float)((float)(v129 / a1->m_gameState.m_cameraZoom) - v131) * m_levelFlipping;
cocos2d::CCPoint::CCPoint(v131, v132);
v133 = a1->m_player1->getPosition_0(a1->m_player1);
cocos2d::CCPoint::operator+(v133, &PerformanceCount);
v134 = cocos2d::CCPoint::operator=(&v156, &PerformanceCount);
if ( a1->m_gameState.m_isDualMode )
{
cocos2d::CCPoint::CCPoint(*(float *)&v134, v132);
v135 = a1->m_player2->getPosition_0(a1->m_player2);
cocos2d::CCPoint::operator+(v135, &PerformanceCount);
cocos2d::CCPoint::operator=(&v157, &PerformanceCount);
}
}
}
m_cameraShakeFactor = a1->m_gameState.m_cameraShakeFactor;
a1->m_gameState.m_cameraShakeEnabled = m_cameraShakeFactor > 0.0;
if ( m_cameraShakeFactor > 0.0 )
a1->m_gameState.m_cameraShakeFactor = m_cameraShakeFactor - v6;
v137 = v6;
GJEffectManager::updateEffects(a1->m_effectManager, v137);
HardStreak::updateStroke(a1->m_player1->m_waveTrail, v137);
HardStreak::updateStroke(a1->m_player2->m_waveTrail, v137);
GJBaseGameLayer::updateGradientLayers(a1);
GJBaseGameLayer::updateShaderLayer(a1, v137);
if ( v122 )
{
a1->m_player1->setPosition_0(a1->m_player1, &v156);
if ( a1->m_gameState.m_isDualMode )
a1->m_player2->setPosition_0(a1->m_player2, &v157);
}
((void (__fastcall *)(GJBaseGameLayer *))a1->postUpdate)(a1);
GJBaseGameLayer::updateGuideArt(a1);
GJBaseGameLayer::updateProximityVolumeEffects(a1);
GJBaseGameLayer::updateAudioVisualizer(a1);
v138 = a1->m_gameState.m_levelFlipping;
if ( (v138 == 0.0 || v138 == 1.0) && a1->m_gameState.m_unkBool12 )
{
PlayerObject::levelFlipFinished(a1->m_player1);
if ( a1->m_gameState.m_isDualMode )
PlayerObject::levelFlipFinished(a1->m_player2);
*(_WORD *)&a1->m_gameState.m_unkBool11 = 0;
}
v139 = a1->m_songTriggerInterval + v6;
a1->m_songTriggerInterval = v139;
if ( v139 >= 1.0 )
{
a1->m_songTriggerInterval = 0.0;
v140 = a1->m_gameState.m_songTriggerStateVectors._List._Mypair._Myval2._Myhead;
v141 = *(int **)v140;
if ( *(std::_List_val>>>::_Nodeptr *)v140 != v140 )
{
do
{
v142 = (FMODAudioEngine *)qword_1406C2E88;
if ( !qword_1406C2E88 )
{
PerformanceCount.QuadPart = (LONGLONG)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine((FMODAudioEngine *)PerformanceCount.QuadPart);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v142 = (FMODAudioEngine *)qword_1406C2E88;
}
if ( FMODAudioEngine::isMusicPlaying_1(v142, v141[4]) )
{
v141 = *(int **)v141;
}
else
{
v143 = a1->m_gameState.m_songTriggerStateVectors._Vec._Mypair._Myval2._Myfirst;
v144 = &v143[2
* ((0x100000001B3LL
* (*((unsigned __int8 *)v141 + 19)
^ (0x100000001B3LL
* (*((unsigned __int8 *)v141 + 18)
^ (0x100000001B3LL
* (*((unsigned __int8 *)v141 + 17)
^ (0x100000001B3LL * (*((unsigned __int8 *)v141 + 16) ^ 0xCBF29CE484222325uLL))))))))
& a1->m_gameState.m_songTriggerStateVectors._Mask)];
v145 = (int *)v144->_Ptr;
if ( (int *)v144[1]._Ptr == v141 )
{
if ( v145 == v141 )
{
v146 = a1->m_gameState.m_songTriggerStateVectors._List._Mypair._Myval2._Myhead;
v143[2
* ((0x100000001B3LL
* (*((unsigned __int8 *)v141 + 19)
^ (0x100000001B3LL
* (*((unsigned __int8 *)v141 + 18)
^ (0x100000001B3LL
* (*((unsigned __int8 *)v141 + 17)
^ (0x100000001B3LL * (*((unsigned __int8 *)v141 + 16) ^ 0xCBF29CE484222325uLL))))))))
& a1->m_gameState.m_songTriggerStateVectors._Mask)]._Ptr = v146;
}
else
{
v146 = *((std::_List_val>>>::_Nodeptr *)v141
+ 1);
}
v144[1]._Ptr = v146;
}
else if ( v145 == v141 )
{
v143[2
* ((0x100000001B3LL
* (*((unsigned __int8 *)v141 + 19)
^ (0x100000001B3LL
* (*((unsigned __int8 *)v141 + 18)
^ (0x100000001B3LL
* (*((unsigned __int8 *)v141 + 17)
^ (0x100000001B3LL * (*((unsigned __int8 *)v141 + 16) ^ 0xCBF29CE484222325uLL))))))))
& a1->m_gameState.m_songTriggerStateVectors._Mask)] = *(std::_Vector_val>>>>>>::pointer)v141;
}
v147 = *(int **)v141;
--a1->m_gameState.m_songTriggerStateVectors._List._Mypair._Myval2._Mysize;
**((_QWORD **)v141 + 1) = v147;
*((_QWORD *)v147 + 1) = *((_QWORD *)v141 + 1);
sub_1400CDA80((__int64)(v141 + 6));
j_j_free(v141);
v141 = v147;
}
}
while ( v141 != (int *)a1->m_gameState.m_songTriggerStateVectors._List._Mypair._Myval2._Myhead );
v23 = v165;
}
}
a1->m_areaObjectsUpdated = 0;
a1->m_timestamp = v4;
a1->m_isBetweenSteps = 0;
if ( v23 )
((void (__fastcall *)(GJBaseGameLayer *))a1->update)(a1);
}
}
else
{
a1->m_gameState.m_totalTime = ModifiedDelta + a1->m_gameState.m_totalTime;
a1->m_gameState.m_unkDouble3 = v7 + a1->m_gameState.m_unkDouble3;
v148 = ModifiedDelta;
GJEffectManager::updateEffects(a1->m_effectManager, v148);
HardStreak::updateStroke(a1->m_player1->m_waveTrail, v148);
HardStreak::updateStroke(a1->m_player2->m_waveTrail, v148);
GJBaseGameLayer::updateGradientLayers(a1);
GJBaseGameLayer::updateShaderLayer(a1, v148);
((void (__fastcall *)(GJBaseGameLayer *))a1->postUpdate)(a1);
GJBaseGameLayer::updateGuideArt(a1);
GJBaseGameLayer::updateAudioVisualizer(a1);
if ( !byte_1406C10A0 )
{
QueryPerformanceFrequency(&Frequency);
byte_1406C10A0 = 1;
}
QueryPerformanceCounter(&PerformanceCount);
a1->m_timestamp = (double)(int)PerformanceCount.LowPart / (double)(int)Frequency.LowPart;
}
}