//
// GJTransformControl::init from 0x100053170 to 0x100053441 (721 bytes)
//
// 1 xrefs:
// > ??> @ 0x1008b0968
//
// 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
//
bool __fastcall GJTransformControl::init(GJTransformControl *a1)
{
bool result; // al
unsigned int v3; // r14d
cocos2d::CCNode *v4; // rax
cocos2d::CCNode *v5; // rax
cocos2d::CCSprite *v6; // rax
CCMenuItemSpriteExtra *v7; // rax
cocos2d::CCMenu *v8; // rax
cocos2d::CCNode *m_mainNodeParent; // rdi
cocos2d::CCMenu *v10; // rsi
cocos2d::CCArray *v11; // rax
const std::string::value_type *v12; // rsi
const char *data; // rdi
cocos2d::CCSprite *v14; // r13
GJTransformControl *v15; // rdi
GameManager *v16; // rax
cocos2d::CCArray *m_warpSprites; // rax
cocos2d::ccArray *v18; // rax
cocos2d::CCObject **arr; // r14
unsigned __int64 v20; // r15
__int64 v21; // rax
std::string v22; // [rsp+8h] [rbp-48h] BYREF
float v23; // [rsp+20h] [rbp-30h]
bool v24; // [rsp+27h] [rbp-29h]
result = cocos2d::CCLayer::init(a1);
if ( result )
{
v24 = result;
v3 = 1;
((void (__fastcall *)(GJTransformControl *, __int64))a1->setTouchEnabled)(a1, 1);
((void (__fastcall *)(GJTransformControl *, __int64 *))a1->setAnchorPoint)(a1, &qword_10099EC08);
v4 = cocos2d::CCNode::create();
a1->m_mainNode = v4;
((void (__fastcall *)(GJTransformControl *, cocos2d::CCNode *))a1->addChild)(a1, v4);
v5 = cocos2d::CCNode::create();
a1->m_mainNodeParent = v5;
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCNode *))a1->m_mainNode->addChild)(a1->m_mainNode, v5);
a1->m_touchID = -1;
v6 = cocos2d::CCSprite::createWithSpriteFrameName("warpLockOffBtn_001.png");
v7 = CCMenuItemSpriteExtra::create(
v6,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)GJTransformControl::onToggleLockScale);
a1->m_warpLockButton = v7;
v8 = cocos2d::CCMenu::createWithItem(v7);
m_mainNodeParent = a1->m_mainNodeParent;
v10 = v8;
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCMenu *))m_mainNodeParent->addChild)(m_mainNodeParent, v8);
v11 = (cocos2d::CCArray *)sub_10071F9E0(m_mainNodeParent, v10);
a1->m_warpSprites = v11;
cocos2d::CCObject::retain(v11);
do
{
strcpy((char *)&v22, "$warpBtn_02_001.png");
v23 = 0.0;
v12 = "warpBtn_01_001.png";
switch ( v3 )
{
case 1u:
case 0xCu:
goto LABEL_6;
case 0xAu:
v12 = "warpBtn_03_001.png";
LABEL_6:
std::string::assign(&v22, v12);
break;
case 0xBu:
std::string::assign(&v22, "warpBtn_03_001.png");
v23 = 90.0;
break;
default:
break;
}
data = v22.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v22.__r_.__value_.__s.0 & 1) != 0 )
data = v22.__r_.__value_.__l.__data_;
v14 = cocos2d::CCSprite::createWithSpriteFrameName(data);
v15 = a1;
if ( v3 != 1 )
{
v15 = a1;
if ( v3 != 12 )
v15 = (GJTransformControl *)a1->m_mainNodeParent;
}
((void (__fastcall *)(GJTransformControl *, cocos2d::CCSprite *, __int64))v15->addChild_0)(v15, v14, 100);
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))v14->setTag)(v14, v3);
((void (__fastcall *)(cocos2d::CCSprite *, float))v14->setRotation)(v14, v23);
sub_10071FCD0(a1->m_warpSprites, v14);
if ( (*(_BYTE *)&v22.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v22.__r_.__value_.__l.__data_);
++v3;
}
while ( v3 != 13 );
v16 = GameManager::sharedState();
if ( GameManager::getGameVariable(v16, "0169") )
{
a1->m_buttonScale = 0.5;
m_warpSprites = a1->m_warpSprites;
if ( !m_warpSprites )
{
LABEL_23:
v21 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_warpLockButton->getNormalImage)(a1->m_warpLockButton);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v21 + 160LL))(v21, 1.0);
return v24;
}
}
else
{
a1->m_buttonScale = 1.0;
m_warpSprites = a1->m_warpSprites;
if ( !m_warpSprites )
goto LABEL_23;
}
v18 = m_warpSprites->data;
if ( v18->num )
{
arr = v18->arr;
v20 = (unsigned __int64)&arr[v18->num - 1];
do
{
if ( !*arr )
break;
((void (__fastcall *)(cocos2d::CCObject *, float))(*arr)->__vftable[2].copyWithZone)(
*arr,
a1->m_buttonScale * 0.69999999);
++arr;
}
while ( (unsigned __int64)arr <= v20 );
}
goto LABEL_23;
}
return result;
}