//
// LevelEditorLayer::onStopPlaytest from 0x6627b4 to 0x662b88 (980 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::postUpdate @ 0x66ec48
// > EditorUI::onStopPlaytest @ 0x6962ac
// > ??> @ 0xc67f8
//
// 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 LevelEditorLayer::onStopPlaytest(LevelEditorLayer *a1)
{
float *v2; // x19
cocos2d::CCDirector *v3; // x0
LevelEditorLayer_vtbl *v4; // x1
PlayerObject *m_player1; // x0
PlayerObject *v6; // x1
std::vector *, std::allocator *>> **m_start; // x2
std::vector *, std::allocator *>> **m_finish; // x3
std::vector *, std::allocator *>> *v9; // x1
__int64 v10; // x0
unsigned __int64 v11; // x24
std::vector *v12; // x23
int v13; // w22
unsigned __int64 v14; // x28
__int64 v15; // x22
GameObject *v16; // x27
const cocos2d::CCPoint *v17; // x0
long double v18; // q1
long double v19; // q0
FMODAudioEngine *v20; // x0
FMODAudioEngine *v21; // x0
FMODAudioEngine *v22; // x0
EditorUI *m_editorUI; // x0
PlayerObject *m_player2; // x2
cocos2d::CCSprite *m_playtestDeathSprite; // x19
PlayerObject *v26; // x0
PlayerObject_vtbl *v27; // x1
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x20
__int64 v29; // x0
cocos2d::CCDirector *v30; // x0
float *v31; // [xsp+78h] [xbp+78h]
unsigned __int64 v32; // [xsp+80h] [xbp+80h]
__int64 v33; // [xsp+88h] [xbp+88h]
cocos2d::CCPoint v34; // [xsp+98h] [xbp+98h] BYREF
float v35; // [xsp+A0h] [xbp+A0h] BYREF
float v36; // [xsp+A4h] [xbp+A4h]
v31 = &a1->m_varianceValues.__elems_[1975];
v2 = &a1->m_varianceValues.__elems_[1975];
v3 = cocos2d::CCDirector::sharedDirector();
v3->getKeyboardDispatcher(v3)->m_bBlockRepeat = 0;
UILayer::editorPlaytest(a1->m_uiLayer, 0);
GJBaseGameLayer::restoreAllUIObjects(a1);
GJBaseGameLayer::resetStoppedAreaObjects(a1);
LevelEditorLayer::quickUpdateAllPositions(a1);
GJBaseGameLayer::resetLevelVariables(a1);
GJBaseGameLayer::syncBGTextures(a1);
LevelEditorLayer::removePlayerCollisionBlock(a1);
if ( *((_BYTE *)v2 + 1944) )
{
v30 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::resetSmoothFixCounter(v30);
cocos2d::CCDirector::sharedDirector()->m_bSmoothFixCheck = 0;
}
GJBaseGameLayer::setStartPosObject(a1, nullptr);
v4 = a1->GJBaseGameLayer::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_playtestTimeWarp = 1.0;
v4->updateTimeWarp(a1, 1.0);
a1->m_playbackMode = Not;
m_player1 = a1->m_player1;
a1->m_playtestCameraZoom = 1.0;
PlayerObject::releaseAllButtons(m_player1);
cocos2d::CCNode::pauseSchedulerAndActions(a1->m_player1);
LevelEditorLayer::updatePreviewParticles(a1);
GJBaseGameLayer::toggleDualMode(a1, nullptr, 0, a1->m_player1, 1);
v6 = a1->m_player1;
if ( v6->m_isDead )
{
v26 = a1->m_player1;
m_playtestDeathSprite = a1->m_playtestDeathSprite;
v27 = v6->GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
goto LABEL_27;
}
if ( a1->m_gameState.m_isDualMode )
{
m_player2 = a1->m_player2;
if ( m_player2->m_isDead )
{
m_playtestDeathSprite = a1->m_playtestDeathSprite;
v26 = a1->m_player2;
v27 = m_player2->GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
LABEL_27:
setPosition = m_playtestDeathSprite->setPosition;
v29 = (__int64)v27->getPosition(v26);
setPosition(m_playtestDeathSprite, (const cocos2d::CCPoint *)v29);
a1->m_playtestDeathSprite->setVisible(a1->m_playtestDeathSprite, 1);
v6 = a1->m_player1;
}
}
v32 = 0;
v6->setVisible(v6, 0);
a1->m_player2->setVisible(a1->m_player2, 0);
m_start = a1->m_sections.m_start;
m_finish = a1->m_sections.m_finish;
if ( m_finish - m_start )
{
do
{
v9 = m_start[v32];
if ( v9 )
{
v10 = v9->m_finish - v9->m_start;
if ( (int)v10 > 0 )
{
v11 = 0;
v33 = 4 * ((unsigned int)(v10 - 1) + 1LL);
do
{
v12 = m_start[v32]->m_start[v11 / 4];
if ( v12 )
{
v13 = a1->m_sectionSizes.m_start[v32]->m_start[v11 / 4];
if ( v13 > 0 )
{
v14 = 0;
v15 = 8 * ((unsigned int)(v13 - 1) + 1LL);
do
{
v16 = v12->m_start[v14 / 8];
v16->updateStartValues(v16);
v16->resetObject(v16);
v17 = v16->getPosition(v16);
cocos2d::CCPoint::CCPoint(&v34, v17);
v16->getRealPosition(v16);
*(float *)&v18 = v34.x;
*(float *)&v19 = v35;
if ( v34.x != v35 || (*(float *)&v18 = v34.y, *(float *)&v19 = v36, v34.y != v36) )
((void (__fastcall *)(GameObject *, float *, long double, long double))v16->setPosition)(
v16,
&v35,
v19,
v18);
v14 += 8LL;
v16->m_isObjectRectDirty = 1;
v16->m_isOrientedBoxDirty = 1;
v16->m_isDirty = 1;
}
while ( v14 != v15 );
m_start = a1->m_sections.m_start;
}
}
v11 += 4LL;
}
while ( v11 != v33 );
m_finish = a1->m_sections.m_finish;
}
}
++v32;
}
while ( v32 < m_finish - m_start );
}
LevelEditorLayer::resetToggledGroups(a1);
LevelEditorLayer::resetMovingObjects(a1);
LevelEditorLayer::updateAnimateOnTriggerObjects(a1, 1);
GJEffectManager::reset(a1->m_effectManager);
GJBaseGameLayer::resetGroupCounters(a1, 0);
v20 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::resumeAllAudio(v20);
v21 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllMusic(v21, 1);
v22 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllEffects(v22);
if ( *((_BYTE *)v31 + 1938) )
LevelEditorLayer::timeObjectChanged(a1);
m_editorUI = a1->m_editorUI;
if ( m_editorUI )
EditorUI::updateSlider(m_editorUI);
*((_BYTE *)v31 + 645) = 0;
}