//
// GameToolbox::alignItemsHorisontally from 0x2eba34 to 0x2ebba0 (364 bytes)
//
// 44 xrefs:
// > UILayer::init @ 0x30e254
// > DemonFilterSelectLayer::init @ 0x3ac696
// > LevelSearchLayer::init @ 0x3aebb8
// > LevelSearchLayer::init @ 0x3aee3e
// > EditLevelLayer::setupLevelInfo @ 0x3b656a
// > EditLevelLayer::setupLevelInfo @ 0x3b6598
// > EditLevelLayer::setupLevelInfo @ 0x3b65c6
// > EditLevelLayer::setupLevelInfo @ 0x3b661a
// > ShareLevelLayer::setupStars @ 0x3b8b48
// > ShareLevelLayer::setupStars @ 0x3b8b68
// > ShareLevelLayer::init @ 0x3b925e
// > RateLevelLayer::init @ 0x40830e
// > RateLevelLayer::init @ 0x4083c0
// > EndLevelLayer::customSetup @ 0x429dd6
// > SongInfoLayer::init @ 0x42e622
// > ShareCommentLayer::init @ 0x4322e6
// > sub_453550 @ 0x453728
// > GJRateLevelLayer::init @ 0x4548ec
// > GJRateLevelLayer::init @ 0x45492c
// > GJRateLevelLayer::init @ 0x454d04
// > RateStarsLayer::init @ 0x455d06
// > RateStarsLayer::init @ 0x455d46
// > RateStarsLayer::init @ 0x455efc
// > NewgroundsInfoLayer::init @ 0x45e9e6
// > NCSInfoLayer::init @ 0x4604f4
// > AccountRegisterLayer::init @ 0x46855e
// > AccountLoginLayer::init @ 0x4697ae
// > UIPOptionsLayer::init @ 0x4a9992
// > GJWriteMessagePopup::init @ 0x4aec4e
// > GJAccountSettingsLayer::init @ 0x4b6612
// > ProfilePage::loadPageFromUserInfo @ 0x4c6230
// > ProfilePage::loadPageFromUserInfo @ 0x4c6662
// > DemonInfoPopup::init @ 0x4c84b8
// > GauntletSelectLayer::setupGauntlets @ 0x4d9314
// > PurchaseItemPopup::init @ 0x4e4346
// > RateDemonLayer::init @ 0x4e650e
// > RateDemonLayer::init @ 0x4e65c0
// > WorldLevelPage::init @ 0x4ff0ca
// > SetGroupIDLayer::init @ 0x50acee
// > SetupGradientPopup::init @ 0x551614
// > SetupGradientPopup::init @ 0x551652
// > SetupShaderEffectPopup::setupShaderTrigger @ 0x552112
// > SetupShaderEffectPopup::setupShaderTrigger @ 0x552150
// > ShareListLayer::init @ 0x592ede
//
// 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 GameToolbox::alignItemsHorisontally(cocos2d::CCArray *a1, float a2, cocos2d::CCPoint a3, bool a4)
{
float x; // r9
float y; // r8
float v8; // s16
cocos2d::ccArray *data; // r2
cocos2d::CCObject **arr; // r4
cocos2d::CCObject **v11; // r5
int v12; // r11
int v13; // t1
const cocos2d::CCSize *v14; // r1
float v15; // s17
cocos2d::ccArray *v16; // r3
cocos2d::CCObject **v17; // r6
cocos2d::CCObject **v18; // r5
float i; // s16
int v20; // r4
int v21; // t1
const cocos2d::CCSize *v22; // r1
float width; // s19
float v24; // r0
int v25; // r0
float v26; // s19
void (__fastcall *v27)(int, cocos2d::CCPoint *); // [sp+4h] [bp-20h]
void (__fastcall *v28)(int, cocos2d::CCPoint *); // [sp+4h] [bp-20h]
cocos2d::CCSize v29; // [sp+Ch] [bp-18h] BYREF
cocos2d::CCPoint v30; // [sp+14h] [bp-10h] BYREF
x = a3.x;
y = a3.y;
v8 = -a2;
if ( a1 )
{
data = a1->data;
if ( data->num )
{
arr = data->arr;
v11 = &arr[data->num] + 0x3FFFFFFF;
while ( arr <= v11 )
{
v13 = (int)*arr++;
v12 = v13;
if ( !v13 )
break;
if ( y == 0.0 )
v14 = (const cocos2d::CCSize *)(*(int (__fastcall **)(int))(*(_DWORD *)v12 + 156))(v12);
else
v14 = &stru_AC54F8;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v30, v14);
v15 = v30.x;
v8 = v8 + (float)(a2 + (float)(v15 * (*(float (__fastcall **)(int))(*(_DWORD *)v12 + 68))(v12)));
}
}
v16 = a1->data;
if ( v16->num )
{
v17 = v16->arr;
v18 = &v17[v16->num] + 0x3FFFFFFF;
for ( i = -(float)(v8 * 0.5);
v17 <= v18;
i = i + (float)(a2 + (float)(v26 * (*(float (__fastcall **)(int))(*(_DWORD *)v20 + 68))(v20))) )
{
v21 = (int)*v17++;
v20 = v21;
if ( !v21 )
break;
if ( y == 0.0 )
v22 = (const cocos2d::CCSize *)(*(int (__fastcall **)(int))(*(_DWORD *)v20 + 156))(v20);
else
v22 = &stru_AC54F8;
cocos2d::CCSize::CCSize(&v29, v22);
width = v29.width;
v27 = *(void (__fastcall **)(int, cocos2d::CCPoint *))(*(_DWORD *)v20 + 92);
v24 = (*(float (__fastcall **)(int))(*(_DWORD *)v20 + 68))(v20);
cocos2d::CCPoint::CCPoint(&v30, i + (float)((float)(width * v24) * 0.5), 0.0);
v27(v20, &v30);
v28 = *(void (__fastcall **)(int, cocos2d::CCPoint *))(*(_DWORD *)v20 + 92);
v25 = (*(int (__fastcall **)(int))(*(_DWORD *)v20 + 96))(v20);
cocos2d::CCPoint::operator+(&v30, LODWORD(x), v25);
v28(v20, &v30);
v26 = v29.width;
}
}
}
}