//
// GJBaseGameLayer::resetLevelVariables from 0x5b9474 to 0x5b9b0e (1690 bytes)
//
// 3 xrefs:
// > PlayLayer::resetLevel @ 0x412346
// > LevelEditorLayer::onStopPlaytest @ 0x4629a6
// > LevelEditorLayer::onPlaytest @ 0x46821a
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:53:40 +0000
//
int __fastcall GJBaseGameLayer::resetLevelVariables(GJBaseGameLayer *this)
{
char *v2; // r0
_DWORD *v3; // r3
int v4; // r3
GameManager *v5; // r0
GameManager *v6; // r0
GameManager *v7; // r0
cocos2d::CCArray **v8; // r0
FMODAudioEngine *v9; // r0
int v10; // r0
int v11; // r2
int v12; // r3
unsigned int v13; // r1
unsigned int v14; // r2
int v15; // r3
_BYTE *v16; // r3
_DWORD *v17; // r2
char v18; // r3
char v19; // r3
int v20; // r1
_DWORD *k; // r2
_DWORD *i; // r0
_DWORD *v23; // r6
_DWORD *v24; // r3
_DWORD *j; // r0
_DWORD *v26; // r6
_DWORD *v27; // r3
int v28; // r1
int v29; // r2
ShaderLayer *v30; // r0
int v31; // r2
int v32; // r3
int v33; // r2
int v34; // r3
int v35; // r2
int v36; // r3
int v37; // r6
int v38; // r0
char **v39; // r0
int v40; // r6
int v41; // r0
char **v42; // r0
int v43; // r6
int v44; // r0
char **v45; // r0
int v46; // r6
int v47; // r0
char **v48; // r0
int v49; // r6
int v50; // r0
char **v51; // r0
int v52; // r10
void (__fastcall *v53)(int, char *); // r11
float *v54; // r0
GJGroundLayer *v55; // r10
unsigned int v56; // r0
GJGroundLayer *v57; // r10
unsigned int v58; // r0
unsigned int v59; // r1
cocos2d::CCDirector *v60; // r0
int v61; // r0
_DWORD *v63; // r7
int v64; // r5
int *v65; // r3
int v66; // r6
_DWORD *v67; // r1
int v68; // r2
int v69; // r8
_DWORD *v70; // r2
int v71; // r9
int v72; // r10
int v73; // r0
int v74; // [sp+14h] [bp-30h]
_DWORD *v75; // [sp+18h] [bp-2Ch]
int v76; // [sp+1Ch] [bp-28h]
int v77; // [sp+20h] [bp-24h]
_DWORD *v78; // [sp+28h] [bp-1Ch]
int *v79; // [sp+2Ch] [bp-18h]
char v80[4]; // [sp+34h] [bp-10h] BYREF
float v81; // [sp+38h] [bp-Ch]
*((_DWORD *)this + 350) = 0;
v2 = (char *)this + 1084;
v3 = *((_DWORD **)v2 + 250);
*((_DWORD *)v2 + 73) = v3[73];
*((_DWORD *)v2 + 74) = v3[74];
v4 = v3[76];
v2[304] = 0;
v2[288] = 0;
*((_DWORD *)v2 + 75) = v4;
std::__tree,int>,std::__map_value_compare,std::__value_type,int>,std::less>,true>,std::allocator,int>>>::destroy(
(int)v2,
*((_DWORD **)this + 272));
*((_DWORD *)this + 271) = (char *)this + 1088;
*((_DWORD *)this + 273) = 0;
*((_DWORD *)this + 272) = 0;
std::__tree>::clear((int)this + 2516);
(*(void (__fastcall **)(GJBaseGameLayer *))(*(_DWORD *)this + 712))(this);
GJBaseGameLayer::unlinkAllEvents((char ****)this);
highestDeltaX = 0;
highestDeltaY = 0;
v6 = (GameManager *)GameManager::sharedState(v5);
GameManager::printGJLog(v6);
v8 = (cocos2d::CCArray **)GameManager::sharedState(v7);
v9 = (FMODAudioEngine *)GameManager::clearGJLog(v8);
v10 = FMODAudioEngine::sharedEngine(v9);
FMODAudioEngine::updateReverb(v10, 0, 0);
GJBaseGameLayer::updateBGArtSpeed((int)this, 0.1, 0.1);
GJBaseGameLayer::updateMGArtSpeed((int)this, 0.3, 0.5);
v11 = *((_DWORD *)this + 360);
*((_BYTE *)this + 1439) = 0;
while ( 1 )
{
v12 = *((_DWORD *)this + 361);
if ( v11 == v12 )
break;
*((_DWORD *)this + 361) = v12 - 4;
}
GJBaseGameLayer::clearActivatedAudioTriggers(this);
GJBaseGameLayer::removeTemporaryParticles(this, v13, v14);
*((_DWORD *)this + 348) = 0;
*((_BYTE *)this + 1396) = 0;
GJBaseGameLayer::updateSpecialLabels(this);
*((_BYTE *)this + 11272) = 0;
v15 = *((_DWORD *)this + 521);
if ( v15 )
{
*(_BYTE *)(*((_DWORD *)this + 381) + 940) = *(_BYTE *)(v15 + 368) ^ 1;
v16 = *((_BYTE **)this + 521);
*((_BYTE *)this + 1435) = v16[376];
v17 = *((_DWORD **)this + 352);
if ( v17 && v17[238] == 1 && (*((_BYTE *)this + 10614) || v17[67] - v17[68] == 22) )
*((_BYTE *)this + 1435) = 1;
*((_BYTE *)this + 1436) = v16[379];
*((_BYTE *)this + 1437) = v16[371];
if ( v16[369] )
v18 = 0;
else
v18 = *((_BYTE *)this + 10614) ^ 1;
*(_BYTE *)(*((_DWORD *)this + 519) + 2460) = v18;
if ( *(_BYTE *)(*((_DWORD *)this + 521) + 369) )
v19 = 0;
else
v19 = *((_BYTE *)this + 10614) ^ 1;
*(_BYTE *)(*((_DWORD *)this + 520) + 2460) = v19;
*(_BYTE *)(*((_DWORD *)this + 519) + 1177) = *(_BYTE *)(*((_DWORD *)this + 521) + 370);
*(_BYTE *)(*((_DWORD *)this + 520) + 1177) = *(_BYTE *)(*((_DWORD *)this + 521) + 370);
*(_BYTE *)(*((_DWORD *)this + 519) + 1178) = *(_BYTE *)(*((_DWORD *)this + 521) + 380);
*(_BYTE *)(*((_DWORD *)this + 520) + 1178) = *(_BYTE *)(*((_DWORD *)this + 521) + 380);
*(_BYTE *)(*((_DWORD *)this + 519) + 2465) = *((_BYTE *)this + 1435) ^ 1;
*(_BYTE *)(*((_DWORD *)this + 520) + 2465) = *((_BYTE *)this + 1435) ^ 1;
*(_BYTE *)(*((_DWORD *)this + 519) + 2466) = *(_BYTE *)(*((_DWORD *)this + 521) + 382);
*(_BYTE *)(*((_DWORD *)this + 520) + 2466) = *(_BYTE *)(*((_DWORD *)this + 521) + 382);
}
GJBaseGameLayer::resetActiveEnterEffects(this);
GJBaseGameLayer::resetSongTriggerValues(this);
if ( *((_DWORD *)this + 230) )
{
for ( i = *((_DWORD **)this + 229); i; i = v23 )
{
v23 = (_DWORD *)*i;
operator delete(i);
}
v24 = *((_DWORD **)this + 228);
k = nullptr;
*((_DWORD *)this + 229) = 0;
while ( i != v24 )
{
v20 = *((_DWORD *)this + 227);
*(_DWORD *)(v20 + 4 * (_DWORD)i) = 0;
i = (_DWORD *)((char *)i + 1);
}
*((_DWORD *)this + 230) = 0;
}
if ( *((_DWORD *)this + 266) )
{
for ( j = *((_DWORD **)this + 265); j; j = v26 )
{
v26 = (_DWORD *)*j;
operator delete(j);
}
v27 = *((_DWORD **)this + 264);
k = nullptr;
*((_DWORD *)this + 265) = 0;
while ( j != v27 )
{
v20 = *((_DWORD *)this + 263);
*(_DWORD *)(v20 + 4 * (_DWORD)j) = 0;
j = (_DWORD *)((char *)j + 1);
}
*((_DWORD *)this + 266) = 0;
}
*((_DWORD *)this + 202) = 0;
*((_DWORD *)this + 204) = 0;
*((_DWORD *)this + 236) = 0;
*((_DWORD *)this + 206) = 0;
*((_DWORD *)this + 207) = 0;
if ( !*((_BYTE *)this + 10614) )
{
v20 = *((_DWORD *)this + 2750);
for ( k = (_DWORD *)((char *)this + 11004); v20 != *k; *k -= 24 )
;
}
PlayerObject::releaseAllButtons(*((PlayerObject **)this + 519), v20, (int)k);
PlayerObject::releaseAllButtons(*((PlayerObject **)this + 520), v28, v29);
*((_QWORD *)this + 1359) = 0;
*((_BYTE *)this + 10881) = 1;
*((_BYTE *)this + 10580) = 0;
GJEffectManager::resetEffects(*((GJEffectManager **)this + 381));
std::__tree,int>,std::__map_value_compare,std::__value_type,int>,std::less>,true>,std::allocator,int>>>::destroy(
(int)this + 972,
*((_DWORD **)this + 244));
*((_DWORD *)this + 243) = (char *)this + 976;
*((_DWORD *)this + 245) = 0;
*((_DWORD *)this + 244) = 0;
v30 = *((ShaderLayer **)this + 2678);
if ( v30 )
{
ShaderLayer::resetAllShaders(v30);
GJBaseGameLayer::updateShaderLayer(this, 0.0);
}
GJBaseGameLayer::resetGradientLayers((int)this);
v31 = *((_DWORD *)this + 311);
while ( 1 )
{
v32 = *((_DWORD *)this + 312);
if ( v31 == v32 )
break;
*((_DWORD *)this + 312) = v32 - 28;
}
v33 = *((_DWORD *)this + 314);
while ( 1 )
{
v34 = *((_DWORD *)this + 315);
if ( v33 == v34 )
break;
*((_DWORD *)this + 315) = v34 - 60;
}
v35 = *((_DWORD *)this + 317);
while ( 1 )
{
v36 = *((_DWORD *)this + 318);
if ( v35 == v36 )
break;
*((_DWORD *)this + 318) = v36 - 60;
}
v37 = *((_DWORD *)this + 290);
while ( 1 )
{
v38 = *((_DWORD *)this + 291);
if ( v37 == v38 )
break;
v39 = (char **)(v38 - 200);
*((_DWORD *)this + 291) = v39;
EnterEffectInstance::~EnterEffectInstance(v39);
}
v40 = *((_DWORD *)this + 293);
while ( 1 )
{
v41 = *((_DWORD *)this + 294);
if ( v40 == v41 )
break;
v42 = (char **)(v41 - 200);
*((_DWORD *)this + 294) = v42;
EnterEffectInstance::~EnterEffectInstance(v42);
}
v43 = *((_DWORD *)this + 296);
while ( 1 )
{
v44 = *((_DWORD *)this + 297);
if ( v43 == v44 )
break;
v45 = (char **)(v44 - 200);
*((_DWORD *)this + 297) = v45;
EnterEffectInstance::~EnterEffectInstance(v45);
}
v46 = *((_DWORD *)this + 299);
while ( 1 )
{
v47 = *((_DWORD *)this + 300);
if ( v46 == v47 )
break;
v48 = (char **)(v47 - 200);
*((_DWORD *)this + 300) = v48;
EnterEffectInstance::~EnterEffectInstance(v48);
}
v49 = *((_DWORD *)this + 302);
while ( 1 )
{
v50 = *((_DWORD *)this + 303);
if ( v49 == v50 )
break;
v51 = (char **)(v50 - 200);
*((_DWORD *)this + 303) = v51;
EnterEffectInstance::~EnterEffectInstance(v51);
}
std::__hash_table,std::equal_to,std::allocator>::clear((_DWORD *)this + 305);
*((_BYTE *)this + 10829) = 1;
(*(void (__fastcall **)(GJBaseGameLayer *, int))(*(_DWORD *)this + 732))(this, 1065353216);
GJBaseGameLayer::updateMGOffsetY(this, 0.0, 0.0, 0, 0.0, -1, -1);
v52 = *((_DWORD *)this + 612);
v53 = *(void (__fastcall **)(int, char *))(*(_DWORD *)v52 + 92);
v54 = (float *)(*(int (__fastcall **)(int))(*(_DWORD *)v52 + 96))(v52);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v80, *v54, 0.0);
v53(v52, v80);
GJBaseGameLayer::resetCamera(this);
*(_DWORD *)(*((_DWORD *)this + 614) + 352) = 0;
*(_DWORD *)(*((_DWORD *)this + 615) + 352) = 0;
v55 = *((GJGroundLayer **)this + 614);
v56 = (*(int (__fastcall **)(GJGroundLayer *))(*(_DWORD *)v55 + 68))(v55);
GJGroundLayer::scaleGround(v55, v56);
v57 = *((GJGroundLayer **)this + 615);
v58 = (*(int (__fastcall **)(GJGroundLayer *))(*(_DWORD *)v57 + 68))(v57);
GJGroundLayer::scaleGround(v57, v58);
GJGroundLayer::updateShadowXPos(*((GJGroundLayer **)this + 614), 0.0, 0.0);
GJGroundLayer::updateShadows(*((GJGroundLayer **)this + 614));
GJGroundLayer::updateShadowXPos(*((GJGroundLayer **)this + 615), 0.0, 0.0);
GJGroundLayer::updateShadows(*((GJGroundLayer **)this + 615));
GJBaseGameLayer::togglePlayerStreakBlend((int)this, 1, 0);
*((_DWORD *)this + 241) = 0;
*((_QWORD *)this + 129) = 0;
cocos2d::CCPoint::operator=((char *)this + 1040, flt_D2C400);
*((_DWORD *)this + 256) = 0;
GJGroundLayer::toggleVisible02(*((_DWORD *)this + 614), 1);
GJGroundLayer::toggleVisible02(*((_DWORD *)this + 615), 1);
*((_DWORD *)this + 217) = 0;
GJGameState::stopTweenAction((unsigned int)this + 328, 0x19u);
*((_DWORD *)this + 166) = 0;
*((_DWORD *)this + 168) = 0;
*((_BYTE *)this + 576) = 0;
*((_BYTE *)this + 668) = 0;
*((_BYTE *)this + 10838) = *((_BYTE *)this + 10837);
*((_BYTE *)this + 10866) = 0;
GJBaseGameLayer::clearPickedUpItems((cocos2d::CCDictionary **)this);
*((_BYTE *)this + 856) = 0;
*((_BYTE *)this + 864) = 0;
*((_BYTE *)this + 10828) = 0;
*((_DWORD *)this + 215) = 0;
*((_DWORD *)this + 2700) = 1065353216;
cocos2d::CCNode::stopActionByTag(this, 14);
*((_DWORD *)this + 210) = 0;
*((_DWORD *)this + 211) = 0;
GJBaseGameLayer::resetPlayer(this);
GJBaseGameLayer::resetSpawnChannelIndex(this, v59);
cocos2d::CCNode::stopAllActions(*((cocos2d::CCNode **)this + 2698));
v60 = (cocos2d::CCDirector *)(*(int (__fastcall **)(_DWORD, _DWORD))(**((_DWORD **)this + 2698) + 172))(
*((_DWORD *)this + 2698),
0);
cocos2d::CCDirector::sharedDirector(v60);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v80);
v61 = (*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 519) + 96))(*((_DWORD *)this + 519));
*((float *)this + 213) = (float)(*(float *)(v61 + 4) - v81) + 90.0;
if ( *((_BYTE *)this + 10716) )
{
v63 = (_DWORD *)((char *)this + 11292);
v77 = (*((_DWORD *)this + 2824) - *((_DWORD *)this + 2823)) >> 2;
v64 = *((_DWORD *)this + 2649);
v65 = (int *)((char *)this + 10608);
v66 = 4 * v64;
while ( v64 <= *((_DWORD *)this + 2650) && v64 < v77 )
{
v67 = *(_DWORD **)(*v63 + v66);
if ( v67 )
v68 = (*(_DWORD *)(*(_DWORD *)(*v63 + v66) + 4) - *v67) >> 2;
else
v68 = -1;
v74 = v68;
v69 = *((_DWORD *)this + 2651);
v70 = (_DWORD *)((char *)this + 11376);
v71 = 4 * v69;
while ( v69 <= *v65 && v69 < v74 )
{
v75 = *(_DWORD **)(**(_DWORD **)(*v63 + v66) + v71);
if ( v75 )
{
v72 = 0;
v76 = *(_DWORD *)(**(_DWORD **)(*v70 + v66) + v71);
while ( v72 < v76 )
{
v79 = v65;
v78 = v70;
v73 = *(_DWORD *)(*v75 + 4 * v72++);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v73 + 656))(v73, 1);
v65 = v79;
v70 = v78;
}
}
++v69;
v71 += 4;
}
++v64;
v66 += 4;
}
}
return GJBaseGameLayer::toggleDualMode((int)this, nullptr, 0, nullptr, 0);
}