//
// SetupAnimationPopup::init from 0x140408d60 to 0x140409b41 (3553 bytes)
//
// 2 xrefs:
// > SetupAnimationPopup::create @ 0x140408d1a
// > ??> @ 0x1406d8a08
//
// 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=6
bool SetupAnimationPopup::init(SetupAnimationPopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
bool result; // al
__int64 v5; // rcx
cocos2d::CCDirector *v6; // rax
struct cocos2d::CCLabelBMFont *v7; // rdi
cocos2d::CCLabelBMFont_vtbl *v8; // rbx
const cocos2d::CCPoint *v9; // rax
ButtonSprite *v10; // rbx
CCMenuItemSpriteExtra *v11; // rax
char v12; // di
int v13; // ebx
unsigned __int64 v14; // rax
__int64 v15; // rcx
const char *v16; // r8
cocos2d::CCString *v17; // rax
char *CString; // rax
size_t v19; // r8
void *v20; // rcx
char v21; // di
unsigned int v22; // ebx
void **v23; // r8
cocos2d::CCString *v24; // rax
char *v25; // rax
size_t v26; // r8
char v27; // di
unsigned int v28; // ebx
void **v29; // r8
cocos2d::CCString *v30; // rax
char *v31; // rax
size_t v32; // r8
__int128 *v33; // rdx
size_t v34; // r8
char *v35; // rdi
__int64 v36; // rbx
struct cocos2d::CCPoint v37; // rax
int i; // r15d
double v39; // xmm0_8
unsigned __int64 v40; // rbx
char *v41; // rcx
unsigned __int64 v42; // rcx
__int64 v43; // rdi
char *v44; // rsi
void *v45; // rcx
__int64 v46; // rax
void (*v47)(SetupAnimationPopup *, cocos2d::CCObject *); // rsi
unsigned __int64 v48; // rdi
void **v49; // rbx
unsigned __int64 v50; // rcx
__int64 v51; // rbx
char *v52; // rsi
void *v53; // rcx
__int64 v54; // rax
void **v55; // rcx
struct cocos2d::CCLabelBMFont *v56; // rbx
float v57; // xmm0_4
struct cocos2d::CCRect *v58; // rax
struct cocos2d::extension::CCScale9Sprite *v59; // rdi
__int64 v60; // rdx
const char *v61; // r9
CCTextInputNode *v62; // rdi
struct cocos2d::CCSprite *v63; // rbx
cocos2d::CCNode *v64; // rbx
float v65; // xmm0_4
struct cocos2d::CCSprite *v66; // rbx
cocos2d::CCNode *v67; // rbx
float v68; // xmm0_4
void *v69; // rcx
int v70; // [rsp+28h] [rbp-E0h]
float v71; // [rsp+58h] [rbp-B0h]
__int16 v72; // [rsp+64h] [rbp-A4h] BYREF
char v73; // [rsp+66h] [rbp-A2h]
__int16 v74; // [rsp+68h] [rbp-A0h]
cocos2d::CCPoint v75; // [rsp+70h] [rbp-98h] BYREF
ButtonSprite *v76; // [rsp+78h] [rbp-90h] BYREF
struct cocos2d::CCPoint v77; // [rsp+80h] [rbp-88h] BYREF
struct cocos2d::CCPoint v78; // [rsp+88h] [rbp-80h] BYREF
_QWORD Src[4]; // [rsp+90h] [rbp-78h] BYREF
cocos2d::CCPoint v80; // [rsp+B0h] [rbp-58h] BYREF
cocos2d::CCSize v81[2]; // [rsp+B8h] [rbp-50h] BYREF
cocos2d::CCRect v82; // [rsp+F0h] [rbp-18h] BYREF
void *v83[2]; // [rsp+100h] [rbp-8h] BYREF
__int64 v84; // [rsp+110h] [rbp+8h]
unsigned __int64 v85; // [rsp+118h] [rbp+10h]
unsigned __int128 v86; // [rsp+120h] [rbp+18h] BYREF
__int64 v87; // [rsp+130h] [rbp+28h]
__int64 v88; // [rsp+138h] [rbp+30h]
__int128 v89; // [rsp+140h] [rbp+38h] BYREF
__int64 v90; // [rsp+150h] [rbp+48h]
unsigned __int64 v91; // [rsp+158h] [rbp+50h]
result = SetupTriggerPopup::init(a1, a2, a3, 300.0, 240.0, 1);
if ( !result )
return result;
a1->determineStartValues(a1);
v6 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize(v6);
v7 = cocos2d::CCLabelBMFont::create("Setup Animation", "goldFont.fnt");
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v7);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v7->setScale_0)(v7);
v8 = v7->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(a1->m_height * 0.5, v71 * 0.5);
v8->setPosition_0(v7, v9);
v76 = (ButtonSprite *)operator new(0x2C0u);
v10 = ButtonSprite::ButtonSprite(v76);
if ( v10 )
{
if ( ButtonSprite::init_1(v10, "OK", 40, 0, 0.80000001, 1, "goldFont.fnt", "GJ_button_01.png", 30.0) )
{
cocos2d::CCObject::autorelease(v10);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v10->~ButtonSprite)(v10, 1);
v10 = nullptr;
}
}
v11 = CCMenuItemSpriteExtra::create(v10, nullptr, a1, (cocos2d::SEL_MenuHandler *)sub_14009BEF0);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v11);
v89 = 0;
*(_QWORD *)&v89 = sub_14003AA10(0x90u);
v90 = 140;
v91 = 143;
strcpy(
(char *)v89,
"Animates certain objects. Can also be used to activate animate on trigger objects.\n"
"The Animation ID specifies the animation:");
sub_140041270(&v89, "\nBig Beast: ", 0x14u);
v12 = 1;
v13 = 0;
do
{
if ( !v13 )
{
v86 = 0;
v15 = 4;
strcpy((char *)&v86, "bite");
goto LABEL_16;
}
if ( v13 == 1 )
{
v15 = 8;
v86 = 0x31306B6361747461uLL;
LABEL_16:
v14 = 15;
v88 = 15;
goto LABEL_17;
}
v14 = 15;
v88 = 15;
if ( v13 == 2 )
{
v15 = 12;
strcpy((char *)&v86, "attack01_end");
BYTE13(v86) = 0;
HIWORD(v86) = 0;
}
else
{
v86 = 0;
if ( v13 == 3 )
{
v15 = 6;
strcpy((char *)&v86, "idle01");
}
else
{
v15 = 0;
LOBYTE(v86) = 0;
}
}
LABEL_17:
v87 = v15;
if ( v15 )
{
if ( v13 )
{
sub_140041270(&v89, ", ", 2u);
v14 = v88;
}
v16 = (const char *)&v86;
if ( v14 > 0xF )
v16 = (const char *)v86;
v17 = cocos2d::CCString::createWithFormat("%i: %s", v13, v16);
CString = (char *)cocos2d::CCString::getCString(v17);
v19 = -1;
do
++v19;
while ( CString[v19] );
sub_140041270(&v89, CString, v19);
++v13;
v14 = v88;
}
else
{
v12 = 0;
}
if ( v14 > 0xF )
{
v20 = (void *)v86;
if ( v14 + 1 >= 0x1000 )
{
v20 = *(void **)(v86 - 8);
if ( (unsigned __int64)(v86 - (_QWORD)v20 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v20);
}
}
while ( v12 );
sub_140041270(&v89, "\n\nBat: ", 0xFu);
v21 = 1;
v22 = 0;
do
{
AnimatedGameObject::animationForID(v83, v22, 1584);
if ( v84 )
{
if ( v22 )
sub_140041270(&v89, ", ", 2u);
v23 = v83;
if ( v85 > 0xF )
v23 = (void **)v83[0];
v24 = cocos2d::CCString::createWithFormat("%i: %s", v22, (const char *)v23);
v25 = (char *)cocos2d::CCString::getCString(v24);
v26 = -1;
do
++v26;
while ( v25[v26] );
sub_140041270(&v89, v25, v26);
++v22;
}
else
{
v21 = 0;
}
sub_14003A830((__int64)v83);
}
while ( v21 );
sub_140041270(&v89, "\n\nSpikeball: ", 0x15u);
v27 = 1;
v28 = 0;
do
{
AnimatedGameObject::animationForID(v83, v28, 2012);
if ( v84 )
{
if ( v28 )
sub_140041270(&v89, ", ", 2u);
v29 = v83;
if ( v85 > 0xF )
v29 = (void **)v83[0];
v30 = cocos2d::CCString::createWithFormat("%i: %s", v28, (const char *)v29);
v31 = (char *)cocos2d::CCString::getCString(v30);
v32 = -1;
do
++v32;
while ( v31[v32] );
sub_140041270(&v89, v31, v32);
++v28;
}
else
{
v27 = 0;
}
sub_14003A830((__int64)v83);
}
while ( v27 );
v76 = (ButtonSprite *)&v86;
v33 = &v89;
if ( v91 > 0xF )
v33 = (__int128 *)v89;
v86 = 0;
v87 = 0;
v88 = 0;
v34 = -1;
do
++v34;
while ( *((_BYTE *)v33 + v34) );
sub_14003A930(&v86, v33, v34);
*(_OWORD *)v83 = 0;
v84 = 4;
v85 = 15;
strcpy((char *)v83, "Help");
v35 = InfoAlertButton::create((__int64)v83, (__int64)&v86);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, (cocos2d::CCNode *)v35);
v36 = *(_QWORD *)v35;
cocos2d::CCPoint::CCPoint(a1->m_width * 0.5, (float)((float)(v71 * 0.5) - (float)(a1->m_width * 0.5)) + 18.0);
v37 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v78);
(*(void (__fastcall **)(char *, struct cocos2d::CCPoint))(v36 + 184))(v35, v37);
for ( i = 0; i < 2; ++i )
{
*(_OWORD *)v83 = 0;
v84 = 0;
v85 = 15;
LOBYTE(v83[0]) = 0;
v39 = cocos2d::CCPoint::CCPoint(&v75);
if ( i )
{
v48 = v85;
if ( v85 < 0xC )
{
v50 = v85 >> 1;
if ( v85 <= 0x7FFFFFFFFFFFFFFFLL - (v85 >> 1) )
{
v51 = 15;
if ( v85 + v50 > 0xF )
v51 = v85 + v50;
}
else
{
v51 = 0x7FFFFFFFFFFFFFFFLL;
}
v52 = (char *)sub_14003AA10(v51 + 1);
v84 = 12;
v85 = v51;
LODWORD(v39) = *(_DWORD *)"Animation ID";
strcpy(v52, "Animation ID");
if ( v48 > 0xF )
{
v53 = v83[0];
if ( v48 + 1 >= 0x1000 )
{
v53 = *((void **)v83[0] - 1);
if ( (unsigned __int64)((char *)v83[0] - (char *)v53 - 8) > 0x1F )
LABEL_102:
invalid_parameter_noinfo_noreturn();
}
j_j_free(v53);
}
v83[0] = v52;
}
else
{
v49 = v83;
if ( v85 > 0xF )
v49 = (void **)v83[0];
v84 = 12;
memmove(v49, "Animation ID", 0xCu);
*((_BYTE *)v49 + 12) = 0;
}
cocos2d::CCPoint::CCPoint(*(float *)&v39, v71 * 0.5);
cocos2d::CCPoint::operator=(&v75, v54);
v47 = SetupAnimationPopup::onAnimationIDArrow;
}
else
{
v40 = v85;
if ( v85 < 8 )
{
v42 = v85 >> 1;
if ( v85 <= 0x7FFFFFFFFFFFFFFFLL - (v85 >> 1) )
{
v43 = 15;
if ( v42 + v85 > 0xF )
v43 = v42 + v85;
}
else
{
v43 = 0x7FFFFFFFFFFFFFFFLL;
}
v44 = (char *)sub_14003AA10(v43 + 1);
v84 = 8;
v85 = v43;
strcpy(v44, "Group ID");
if ( v40 > 0xF )
{
v45 = v83[0];
if ( v40 + 1 >= 0x1000 )
{
v45 = *((void **)v83[0] - 1);
if ( (unsigned __int64)((char *)v83[0] - (char *)v45 - 8) > 0x1F )
goto LABEL_102;
}
j_j_free(v45);
}
v83[0] = v44;
}
else
{
v41 = (char *)v83;
if ( v85 > 0xF )
v41 = (char *)v83[0];
v84 = 8;
strcpy(v41, "Group ID");
}
cocos2d::CCPoint::CCPoint(*(float *)&v39, v71 * 0.5);
cocos2d::CCPoint::operator=(&v75, v46);
v47 = SetupAnimationPopup::onTargetIDArrow;
}
v55 = v83;
if ( v85 > 0xF )
v55 = (void **)v83[0];
v56 = cocos2d::CCLabelBMFont::create((const char *)v55, "goldFont.fnt");
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v56);
v57 = ((float (__fastcall *)(struct cocos2d::CCLabelBMFont *))v56->setScale_0)(v56);
cocos2d::CCPoint::CCPoint(v57, 0.0);
cocos2d::CCPoint::operator+(&v75, &v80);
v56->setPosition_0(v56, &v80);
cocos2d::CCRect::CCRect(&v82, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v86, &v82);
v59 = cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v58);
LOBYTE(v60) = 100;
v59->setOpacity(&v59->cocos2d::CCRGBAProtocol, v60);
v72 = 0;
v73 = 0;
v59->setColor(&v59->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v72);
cocos2d::CCSize::CCSize(v81, 50.0, 30.0);
v59->setContentSize(v59, v81);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v59, -1);
v59->setPosition_0(v59, &v75);
v62 = CCTextInputNode::create(50.0, 40.0, "Num", v61, v70, (const char *)&qword_14052A4D8);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v62, 20);
v62->setPosition_0(v62, &v75);
v62->m_maxLabelScale = 0.60000002;
CCTextInputNode::refreshLabel(v62);
v62->m_maxLabelWidth = 200.0;
CCTextInputNode::refreshLabel(v62);
v62->m_textField->setVisible(v62->m_textField, 0);
v62->m_maxLabelLength = 6;
Src[1] = 14648;
Src[2] = 10;
Src[3] = 15;
Src[0] = 0x3736353433323130LL;
v81[1] = (cocos2d::CCSize)Src;
if ( &v62->m_allowedChars != (std::string *)Src )
sub_14003CCE0((void **)&v62->m_allowedChars, Src, 0xAu);
sub_14003A830((__int64)Src);
v74 = -21896;
*(_WORD *)&v62->m_placeholderColor.r = -21896;
v62->m_placeholderColor.b = -16;
CCTextInputNode::refreshLabel(v62);
v62->m_placeholderScale = 0.5;
CCTextInputNode::refreshLabel(v62);
v62->m_delegate = &a1->TextInputDelegate;
v62->m_numberInput = 1;
v62->setTag(v62, i);
cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v77);
v63 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v63->setScale_0)(v63);
v64 = CCMenuItemSpriteExtra::create(v63, nullptr, a1, (cocos2d::SEL_MenuHandler *)v47);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v64);
v65 = ((float (__fastcall *)(cocos2d::CCNode *, __int64))v64->setTag)(v64, 1);
cocos2d::CCPoint::CCPoint(v65, -50.0);
cocos2d::CCPoint::operator+(&v77, &v78);
v64->setPosition_0(v64, &v78);
v64[1].m_unknown5 = 0x40000000;
v66 = cocos2d::CCSprite::createWithSpriteFrameName("edit_rightBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v66->setScale_0)(v66);
v67 = CCMenuItemSpriteExtra::create(v66, nullptr, a1, (cocos2d::SEL_MenuHandler *)v47);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v67);
v68 = ((float (__fastcall *)(cocos2d::CCNode *, __int64))v67->setTag)(v67, 2);
cocos2d::CCPoint::CCPoint(v68, 50.0);
cocos2d::CCPoint::operator+(&v77, &v76);
v67->setPosition_0(v67, (const cocos2d::CCPoint *)&v76);
v67[1].m_unknown5 = 0x40000000;
if ( i )
a1->m_animationIDInput = v62;
else
a1->m_targetIDInput = v62;
if ( v85 > 0xF )
{
v69 = v83[0];
if ( v85 + 1 >= 0x1000 )
{
v69 = *((void **)v83[0] - 1);
if ( (unsigned __int64)((char *)v83[0] - (char *)v69 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v69);
}
}
SetupAnimationPopup::updateTextInputLabel(a1);
SetupAnimationPopup::updateAnimationTextInputLabel(a1);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
a1->m_disableTextDelegate = 0;
sub_14003A830((__int64)&v89);
return 1;
}