//
// GameToolbox::alignItemsHorisontally from 0x3cc830 to 0x3cc99e (366 bytes)
//
// 59 xrefs:
// > UILayer::init @ 0x3fdb18
// > LevelCell::loadCustomLevelCell @ 0x42ef04
// > CreateStartPosPopup::init @ 0x49062a
// > PauseLayer::customSetup @ 0x49153c
// > DemonFilterSelectLayer::init @ 0x495f2e
// > LevelSearchLayer::init @ 0x499120
// > LevelSearchLayer::init @ 0x499434
// > EditLevelLayer::setupLevelInfo @ 0x4a0b90
// > EditLevelLayer::setupLevelInfo @ 0x4a0bbe
// > EditLevelLayer::setupLevelInfo @ 0x4a0bec
// > EditLevelLayer::setupLevelInfo @ 0x4a0c48
// > ShareLevelLayer::setupStars @ 0x4a3698
// > ShareLevelLayer::setupStars @ 0x4a36b8
// > ShareLevelLayer::init @ 0x4a4456
// > RateLevelLayer::init @ 0x5113ce
// > RateLevelLayer::init @ 0x511480
// > EndLevelLayer::customSetup @ 0x5369f0
// > SongInfoLayer::addLinkRows @ 0x53acb0
// > ShareCommentLayer::init @ 0x541b80
// > sub_564E44 @ 0x56501c
// > GJRateLevelLayer::init @ 0x565de8
// > GJRateLevelLayer::init @ 0x565e2a
// > GJRateLevelLayer::init @ 0x5660bc
// > GJRateLevelListLayer::init @ 0x56766c
// > GJRateEditorSoundLayer::init @ 0x567bd2
// > RateStarsLayer::init @ 0x5697ee
// > RateStarsLayer::init @ 0x56982e
// > RateStarsLayer::init @ 0x5699e8
// > NewgroundsInfoLayer::init @ 0x57b572
// > NCSInfoLayer::init @ 0x57dd1c
// > AccountRegisterLayer::init @ 0x586cb6
// > AccountLoginLayer::init @ 0x58764a
// > UIPOptionsLayer::init @ 0x5d85e6
// > GJWriteMessagePopup::init @ 0x5dfa72
// > GJMessagePopup::loadFromGJMessage @ 0x5e06de
// > GJAccountSettingsLayer::init @ 0x5e4204
// > ProfilePage::setupAccountButtons @ 0x5f616c
// > MyStuffPopup::init @ 0x5f76ec
// > DemonInfoPopup::init @ 0x5f7f7e
// > ProfilePage::loadPageFromUserInfo @ 0x5fa1e4
// > GauntletSelectLayer::setupGauntlets @ 0x60cd68
// > PurchaseItemPopup::init @ 0x614152
// > RateDemonLayer::init @ 0x61638a
// > RateDemonLayer::init @ 0x61643c
// > WorldLevelPage::init @ 0x62f300
// > SetGroupIDLayer::init @ 0x63dc74
// > SetupGradientPopup::init @ 0x687ade
// > SetupGradientPopup::init @ 0x687b1c
// > SetupShaderEffectPopup::setupShaderTrigger @ 0x68dbc2
// > SetupShaderEffectPopup::setupShaderTrigger @ 0x68dc00
// > StartPosLayer::addModeButtons @ 0x6aacde
// > StartPosLayer::addSpeedButtons @ 0x6aae34
// > ShareListLayer::init @ 0x6d799c
// > GameSettingsLayer::setupTabs @ 0x710b1e
// > TabbedPopupLayer::createTabButtons @ 0x72dca0
// > RateStarsModLayer::init @ 0x79ec7a
// > RateStarsModLayer::init @ 0x79ecbe
// > RateStarsModLayer::init @ 0x79eebc
// > RateStarsModLayer::init @ 0x79ef72
//
// 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:46:38 +0000
//
float __fastcall GameToolbox::alignItemsHorisontally(float result, float a2, int a3, int a4)
{
float v6; // r6
float v8; // s16
_DWORD *v9; // r2
int *v10; // r4
int *v11; // r5
int v12; // r11
int v13; // t1
const cocos2d::CCSize *v14; // r1
float v15; // s17
_DWORD *v16; // r3
int *v17; // r6
int *v18; // r5
float i; // s16
int v20; // r4
int v21; // t1
const cocos2d::CCSize *v22; // r1
float v23; // s19
float v24; // r0
int v25; // r0
float v26; // s19
void (__fastcall *v27)(int, float *); // [sp+4h] [bp-20h]
void (__fastcall *v28)(int, float *); // [sp+4h] [bp-20h]
float v29[2]; // [sp+Ch] [bp-18h] BYREF
float v30[2]; // [sp+14h] [bp-10h] BYREF
v6 = result;
v8 = -a2;
if ( result != 0.0 )
{
v9 = *(_DWORD **)(LODWORD(result) + 52);
if ( *v9 )
{
v10 = (int *)v9[3];
v11 = &v10[*v9 - 1];
while ( v10 <= v11 )
{
v13 = *v10++;
v12 = v13;
if ( !v13 )
break;
if ( a4 )
v14 = (const cocos2d::CCSize *)&unk_D2A69C;
else
v14 = (const cocos2d::CCSize *)(*(int (__fastcall **)(int))(*(_DWORD *)v12 + 164))(v12);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v30, v14);
v15 = v30[0];
result = (*(float (__fastcall **)(int))(*(_DWORD *)v12 + 68))(v12);
v8 = v8 + (float)(a2 + (float)(v15 * result));
}
}
v16 = *(_DWORD **)(LODWORD(v6) + 52);
if ( *v16 )
{
v17 = (int *)v16[3];
v18 = &v17[*v16 - 1];
for ( i = -(float)(v8 * 0.5); v17 <= v18; i = i + (float)(a2 + (float)(v26 * result)) )
{
v21 = *v17++;
v20 = v21;
if ( !v21 )
break;
if ( a4 )
v22 = (const cocos2d::CCSize *)&unk_D2A69C;
else
v22 = (const cocos2d::CCSize *)(*(int (__fastcall **)(int))(*(_DWORD *)v20 + 164))(v20);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v29, v22);
v23 = v29[0];
v27 = *(void (__fastcall **)(int, float *))(*(_DWORD *)v20 + 92);
v24 = (*(float (__fastcall **)(int))(*(_DWORD *)v20 + 68))(v20);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v30, i + (float)((float)(v23 * v24) * 0.5), 0.0);
v27(v20, v30);
v28 = *(void (__fastcall **)(int, float *))(*(_DWORD *)v20 + 92);
v25 = (*(int (__fastcall **)(int))(*(_DWORD *)v20 + 96))(v20);
cocos2d::CCPoint::operator+(v30, a3, v25);
v28(v20, v30);
v26 = v29[0];
result = (*(float (__fastcall **)(int))(*(_DWORD *)v20 + 68))(v20);
}
}
}
return result;
}