//
// GJSmartBlockPreview::addTemplateGuide from 0x6704e4 to 0x670816 (818 bytes)
//
// 2 xrefs:
// > GJSmartBlockPreview::addTemplateGuide @ 0x670b40
// > BrowseSmartTemplateLayer::addPrefabMenuItem @ 0x673bd4
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:55:50 +0000
//
cocos2d::CCArray *__fastcall GJSmartBlockPreview::addTemplateGuide(unsigned __int8 *a1, int a2, float a3)
{
cocos2d::CCArray *v6; // r8
float v7; // s16
int v8; // r0
GJSmartBlockPreviewSprite *v9; // r0
int v10; // r2
cocos2d::CCNode *v11; // r7
unsigned __int8 *v12; // r0
int v13; // r5
ObjectToolbox *v14; // r4
int v15; // r0
char *v16; // r0
char *v17; // r4
size_t v18; // r0
const char *v19; // r1
cocos2d::CCSprite *v20; // r0
cocos2d::CCSprite *v21; // r4
void (__fastcall *v22)(cocos2d::CCSprite *, _BYTE *); // r11
int v23; // r11
int i; // r5
int v25; // r10
int v26; // r3
char *v27; // r1
const char *v28; // r1
cocos2d::CCSprite *v29; // r0
cocos2d::CCSprite *v30; // r4
bool v31; // zf
void (__fastcall *v32)(cocos2d::CCSprite *, void *); // r3
unsigned __int8 *v34; // [sp+0h] [bp-54h]
void (__fastcall *v35)(cocos2d::CCSprite *, _BYTE *); // [sp+4h] [bp-50h]
__int16 v36; // [sp+24h] [bp-30h] BYREF
char v37; // [sp+26h] [bp-2Eh]
_BYTE v38[8]; // [sp+28h] [bp-2Ch] BYREF
float v39; // [sp+30h] [bp-24h] BYREF
float v40; // [sp+34h] [bp-20h]
_BYTE v41[8]; // [sp+38h] [bp-1Ch] BYREF
int v42[2]; // [sp+40h] [bp-14h] BYREF
cocos2d::CCSprite *v43; // [sp+48h] [bp-Ch]
v6 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)a1);
v7 = *(float *)(*(int (__fastcall **)(unsigned __int8 *))(*(_DWORD *)a1 + 164))(a1);
v8 = (*(int (__fastcall **)(unsigned __int8 *))(*(_DWORD *)a1 + 164))(a1);
v9 = (GJSmartBlockPreviewSprite *)cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v38,
v7 * 0.5,
*(float *)(v8 + 4) * 0.5);
v36 = -1;
v10 = *(_DWORD *)(a2 + 28);
v37 = -1;
if ( !v10 )
{
if ( *(_DWORD *)a2 )
v36 = -256;
else
v36 = 255;
v37 = 0;
}
v11 = GJSmartBlockPreviewSprite::create(v9);
(*(void (__fastcall **)(unsigned __int8 *, cocos2d::CCNode *))(*(_DWORD *)a1 + 228))(a1, v11);
v34 = (unsigned __int8 *)(a2 + 4);
v12 = std::string::at((unsigned __int8 *)(a2 + 4), 0);
v13 = *v12;
v14 = (ObjectToolbox *)ObjectToolbox::sharedState((ObjectToolbox *)v12);
v15 = GJSmartTemplate::smartTypeToObjectKey(v13);
v16 = ObjectToolbox::intKeyToFrame(v14, v15);
v42[0] = 0;
v42[1] = 0;
v43 = nullptr;
v17 = v16;
v18 = strlen(v16);
std::string::__init(v42, v17, v18);
if ( (v42[0] & 1) != 0 )
v20 = v43;
else
v20 = (cocos2d::CCSprite *)((char *)v42 + 1);
v21 = (cocos2d::CCSprite *)cocos2d::CCSprite::createWithSpriteFrameName(v20, v19);
GJSmartTemplate::applyTransformationsForType(v13, v21);
(*(void (__fastcall **)(cocos2d::CCSprite *, __int16 *))(*(_DWORD *)v21 + 480))(v21, &v36);
v22 = *(void (__fastcall **)(cocos2d::CCSprite *, _BYTE *))(*(_DWORD *)v21 + 92);
GJSmartTemplate::offsetForType((cocos2d::CCPoint *)&v39, v13);
cocos2d::CCPoint::operator+(v41, v38, &v39);
v22(v21, v41);
(*(void (__fastcall **)(cocos2d::CCNode *, cocos2d::CCSprite *, _DWORD))(*(_DWORD *)v11 + 232))(v11, v21, 0);
v23 = (unsigned __int8)(unsigned int)(float)(a3 * 255.0);
(*(void (__fastcall **)(cocos2d::CCSprite *, int))(*(_DWORD *)v21 + 456))(v21, v23);
cocos2d::CCArray::addObject(v6, v21);
(*(void (__fastcall **)(cocos2d::CCSprite *, _DWORD))(*(_DWORD *)v21 + 36))(v21, 0);
for ( i = 1; i != 9; ++i )
{
v25 = *std::string::at(v34, i);
if ( !GJSmartTemplate::shouldDiscardObject(v25, i) )
{
v26 = GJSmartTemplate::smartTypeToObjectKey(v25);
if ( v26 == 2896 )
{
v27 = "smartBlock02b_001.png";
}
else if ( v26 == 2897 )
{
v27 = "smartBlock03b_001.png";
}
else
{
v27 = "smartBlock01b_001.png";
}
std::string::assign(v42, v27);
if ( (v42[0] & 1) != 0 )
v29 = v43;
else
v29 = (cocos2d::CCSprite *)((char *)v42 + 1);
v30 = (cocos2d::CCSprite *)cocos2d::CCSprite::createWithSpriteFrameName(v29, v28);
GJSmartTemplate::applyTransformationsForType(v25, v30);
(*(void (__fastcall **)(cocos2d::CCNode *, cocos2d::CCSprite *, _DWORD))(*(_DWORD *)v11 + 232))(v11, v30, 0);
GJSmartTemplate::offsetForType((cocos2d::CCPoint *)&v39, v25);
if ( i == 1 || (unsigned int)(i - 5) <= 1 )
v40 = v40 + 30.0;
if ( i == 2 || (unsigned int)(i - 7) <= 1 )
v40 = v40 - 30.0;
if ( (i & 0xFFFFFFFB) == 3 || i == 5 )
v39 = v39 - 30.0;
if ( (i & 0xFFFFFFFD) == 4 || i == 8 )
v39 = v39 + 30.0;
v35 = *(void (__fastcall **)(cocos2d::CCSprite *, _BYTE *))(*(_DWORD *)v30 + 92);
cocos2d::CCPoint::operator+(v41, v38, &v39);
v35(v30, v41);
v31 = *std::string::at(a1 + 264, i) == 48;
v32 = *(void (__fastcall **)(cocos2d::CCSprite *, void *))(*(_DWORD *)v30 + 480);
if ( v31 )
{
v32(v30, &unk_BEF433);
(*(void (__fastcall **)(cocos2d::CCSprite *, _DWORD))(*(_DWORD *)v30 + 456))(
v30,
(unsigned __int8)(unsigned int)(float)(a3 * 150.0));
(*(void (__fastcall **)(cocos2d::CCSprite *, int))(*(_DWORD *)v30 + 36))(v30, 2);
}
else
{
v32(v30, &v36);
(*(void (__fastcall **)(cocos2d::CCSprite *, int))(*(_DWORD *)v30 + 456))(v30, v23);
(*(void (__fastcall **)(cocos2d::CCSprite *, int))(*(_DWORD *)v30 + 36))(v30, 1);
}
cocos2d::CCArray::addObject(v6, v30);
}
}
std::string::~string((int)v42);
return v6;
}