//
// SecretGame01Layer::resetGame from 0x59e078 to 0x59e3be (838 bytes)
//
// 1 xrefs:
// > SecretLayer6::startGame01 @ 0x59e3f2
//
// 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 SecretGame01Layer::resetGame(SecretGame01Layer *a1)
{
cocos2d::CCArray *m_gameObjects; // r2
int RowsForDifficulty; // r11
cocos2d::CCDirector *v4; // r0
float v5; // s17
float v6; // s15
float v7; // s16
float v8; // s17
cocos2d::ccArray *data; // r2
cocos2d::CCObject **arr; // r6
cocos2d::CCObject **v11; // r5
int v12; // r0
int v13; // t1
int i; // r2
int v15; // r8
int v16; // r7
float v17; // s15
cocos2d::CCSprite *v18; // r6
void (__fastcall *setColor)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r2
cocos2d::CCSprite *v20; // r8
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
void (__fastcall *v22)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r2
CCMenuItemSpriteExtra *v23; // r8
float v24; // r2
cocos2d::CCEaseElasticOut *v25; // r0
float v26; // r2
cocos2d::CCAction *v27; // r0
cocos2d::CCSequence *v28; // r7
cocos2d::CCFiniteTimeAction *v29; // r0
cocos2d::CCAction *v30; // r0
void (__fastcall *v31)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+Ch] [bp-50h]
cocos2d::CCSprite *v32; // [sp+1Ch] [bp-40h] BYREF
cocos2d::CCSprite *v33; // [sp+20h] [bp-3Ch] BYREF
char *v34; // [sp+24h] [bp-38h] BYREF
int v35; // [sp+28h] [bp-34h] BYREF
cocos2d::CCSize v36; // [sp+2Ch] [bp-30h] BYREF
cocos2d::CCPoint v37; // [sp+34h] [bp-28h] BYREF
cocos2d::CCPoint v38; // [sp+3Ch] [bp-20h] BYREF
void (*v39)(SecretGame01Layer *, cocos2d::CCObject *); // [sp+44h] [bp-18h]
int v40; // [sp+48h] [bp-14h]
cocos2d::CCPoint v41; // [sp+4Ch] [bp-10h] BYREF
m_gameObjects = a1->m_gameObjects;
if ( m_gameObjects )
{
data = m_gameObjects->data;
if ( data->num )
{
arr = data->arr;
v11 = &arr[data->num] + 0x3FFFFFFF;
while ( arr <= v11 )
{
v13 = (int)*arr++;
v12 = v13;
if ( !v13 )
break;
(*(void (__fastcall **)(int, int))(*(_DWORD *)v12 + 256))(v12, 1);
}
}
}
cocos2d::CCArray::removeAllObjects(a1->m_gameObjects);
RowsForDifficulty = SecretGame01Layer::getRowsForDifficulty(a1, a1->m_gameDifficulty);
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v36, v4);
cocos2d::CCPoint::CCPoint(&v37, v36.width * 0.5, v36.height * 0.5);
v5 = (float)((float)RowsForDifficulty * 0.5) * 30.0;
v6 = (float)((float)(RowsForDifficulty - 1) * 0.5) * 8.0;
v7 = (float)(v5 + v37.y) + v6;
v8 = (float)(v37.x - v5) - v6;
SecretGame01Layer::getFrameForDifficulty((SecretGame01Layer *)&v32, (int)a1, 0);
sub_776584((int)&v34, (char *)v32);
sub_776584((int)&v35, "_001.png");
sub_776584((int)&v38, "_2_001.png");
for ( i = 0; ; i = *(_DWORD *)(LODWORD(v38.x) - 12) + v15 )
{
v15 = sub_774834(&v34, &v35, i);
if ( v15 == -1 )
break;
sub_776454(&v34, v15, *(_DWORD *)(v35 - 12), &v38);
}
sub_774008(&v38);
sub_774008(&v35);
sub_776584((int)&v33, v34);
v16 = 0;
sub_774008(&v34);
while ( v16 != RowsForDifficulty * RowsForDifficulty )
{
v17 = floorf((float)v16 / (float)RowsForDifficulty);
v18 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v32);
setColor = v18->setColor;
memset(&v41, 75, 3);
setColor(v18, (const cocos2d::ccColor3B *)&v41);
v20 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v33);
v18->addChild_0(v18, v20, -1);
setPosition = v20->setPosition;
cocos2d::CCNode::convertToNodeSpace(&v41, v18, &stru_AC7FC8);
setPosition(v20, &v41);
v22 = v20->setColor;
memset(&v41, 60, 3);
v22(v20, (const cocos2d::ccColor3B *)&v41);
v39 = SecretGame01Layer::onSelectButton;
v40 = 0;
v23 = CCMenuItemSpriteExtra::create(
v18,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SecretGame01Layer::onSelectButton, (unsigned int)a1));
CCMenuItemSpriteExtra::setSizeMult(v23, 1.2);
v23->setTag(v23, v16);
cocos2d::CCArray::addObject(a1->m_gameObjects, v23);
a1->m_mainMenu->addChild(a1->m_mainMenu, v23);
cocos2d::CCPoint::CCPoint(
&v38,
(float)(v8 + 15.0) + (float)((float)(v16 % RowsForDifficulty) * 38.0),
v7 - (float)((float)(int)v17 * 38.0));
v31 = v23->setPosition;
cocos2d::CCNode::convertToNodeSpace(&v41, a1->m_mainMenu, &v38);
v31(v23, &v41);
++v16;
((void (__fastcall *)(cocos2d::CCSprite *, int))v18->setScale)(v18, 1036831949);
v25 = (cocos2d::CCEaseElasticOut *)cocos2d::CCScaleTo::create((cocos2d::CCScaleTo *)0x3F19999A, 1.0, v24);
v27 = (cocos2d::CCAction *)cocos2d::CCEaseElasticOut::create(v25, (cocos2d::CCActionInterval *)0x3F19999A, v26);
cocos2d::CCNode::runAction(v18, v27);
}
a1->m_mainMenu->setTouchEnabled(a1->m_mainMenu, 0);
a1->m_selectedObject = 0;
v28 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create(0.8);
v41.y = 0.0;
LODWORD(v41.x) = SecretGame01Layer::gameStep01;
v29 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(a1, SecretGame01Layer::gameStep01, 0);
v30 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v28, v29, 0);
cocos2d::CCNode::runAction(a1, v30);
sub_774008(&v33);
sub_774008(&v32);
}