//
// GJPFollowCommandLayer::init from 0x140398650 to 0x140398dd9 (1929 bytes)
//
// 3 xrefs:
// > GJPFollowCommandLayer::create @ 0x14039860e
// > ??> @ 0x140923174
// > ??> @ 0x140923180
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// 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:31:14 +0000
//
// Hidden C++ exception states: #wind=4
char __fastcall GJPFollowCommandLayer::init(_BYTE *a1, int a2, int a3, int a4)
{
char result; // al
__int64 v6; // rcx
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // rax
__int64 v12; // rax
__int64 v13; // rax
int v14; // edx
void *v15; // rcx
void **v16; // [rsp+88h] [rbp-80h] BYREF
_BYTE v17[8]; // [rsp+90h] [rbp-78h] BYREF
void **v18; // [rsp+98h] [rbp-70h] BYREF
void **v19; // [rsp+A0h] [rbp-68h] BYREF
float v20[2]; // [rsp+A8h] [rbp-60h] BYREF
__int128 v21; // [rsp+B0h] [rbp-58h] BYREF
__int64 v22; // [rsp+C0h] [rbp-48h]
__int64 v23; // [rsp+C8h] [rbp-40h]
void *Block[2]; // [rsp+D0h] [rbp-38h] BYREF
__m128i si128; // [rsp+E0h] [rbp-28h]
result = SetupTriggerPopup::init((_DWORD)a1, a2, a3, a4, 1134231552, 1, 0);
if ( result )
{
a1[744] = 1;
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1096LL))(a1);
*(_OWORD *)Block = 0;
Block[0] = sub_14003D460(0x20u);
si128.m128i_i64[0] = 27;
si128.m128i_i64[1] = 31;
strcpy((char *)Block[0], "Setup Follow Player Command");
SetupTriggerPopup::addTitle(a1, Block);
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 2;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "OK");
SetupTriggerPopup::addCloseButton(a1, Block);
v16 = Block;
*(_OWORD *)Block = 0;
si128 = 0u;
Block[0] = sub_14003D460(0xE0u);
si128.m128i_i64[0] = 214;
si128.m128i_i64[1] = 223;
strcpy(
(char *)Block[0],
"Make a group of objects follow the player's Y position.\n"
"Speed is how fast it snaps to the position. Leaving this at 1.0 makes it instantaneous.\n"
"Max Speed limits how fast the movement can be.");
v21 = 0;
v22 = 4;
v23 = 15;
strcpy((char *)&v21, "Help");
SetupTriggerPopup::addHelpButton(a1, &v21, Block);
SetupTriggerPopup::createMultiTriggerItemsCorner(a1);
v7 = cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize(v7, v20);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v17, v20[0] * 0.5, v20[1] * 0.5);
v19 = Block;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 6;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Speed:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v18, -110.0, 105.0);
cocos2d::CCPoint::operator+(v17, &v16, v8);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
90,
(unsigned int)Block,
(unsigned int)&v16,
1061997773,
0,
1,
10,
0,
0,
1065353216,
0,
0,
0,
3,
0);
v18 = Block;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 6;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Delay:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v19, 100.0, 105.0);
cocos2d::CCPoint::operator+(v17, &v16, v9);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
91,
(unsigned int)Block,
(unsigned int)&v16,
1061997773,
0,
1,
10,
0,
0,
1065353216,
0,
0,
0,
2,
0);
v18 = Block;
Block[1] = nullptr;
si128.m128i_i64[0] = 7;
si128.m128i_i64[1] = 15;
Block[0] = (void *)0x3A74657366664FLL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v19, -110.0, 35.0);
cocos2d::CCPoint::operator+(v17, &v16, v10);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
92,
(unsigned int)Block,
(unsigned int)&v16,
1061997773,
0,
2,
10,
0,
-1027080192,
1120403456,
0,
0,
0,
0,
0);
v18 = Block;
Block[1] = (void *)14948;
si128.m128i_i64[0] = 10;
si128.m128i_i64[1] = 15;
Block[0] = (void *)0x656570532078614DLL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v19, 100.0, 35.0);
cocos2d::CCPoint::operator+(v17, &v16, v11);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
105,
(unsigned int)Block,
(unsigned int)&v16,
1061997773,
0,
1,
10,
0,
0,
1120403456,
0,
0,
0,
1,
0);
v18 = Block;
Block[1] = (void *)14949;
si128.m128i_i64[0] = 10;
si128.m128i_i64[1] = 15;
Block[0] = (void *)0x6D69542065766F4DLL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v19, -110.0, -35.0);
cocos2d::CCPoint::operator+(v17, &v16, v12);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
10,
(unsigned int)Block,
(unsigned int)&v16,
1061997773,
0,
1,
10,
0,
0,
1092616192,
0,
0,
0,
2,
0);
si128 = _mm_load_si128((const __m128i *)&xmmword_140836600);
strcpy((char *)Block, "Target Group ID");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v18, 100.0, -50.0);
cocos2d::CCPoint::operator+(v17, &v16, v13);
v14 = (_DWORD)a1 + 544;
if ( !a1 )
v14 = 0;
IDNameInput::create((_DWORD)a1, v14, 1, 51, (__int64)Block, (__int64)&v16, 1061997773, 6, 0, 0, 0);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v15 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v15 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v15 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v15);
}
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1136LL))(a1);
a1[744] = 0;
return 1;
}
return result;
}