//
// PlayerObject::addToTouchedRings from 0x449540 to 0x4496b8 (376 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::playerTouchedRing @ 0x5a890c
//
// 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:48:32 +0000
//
void __fastcall PlayerObject::addToTouchedRings(cocos2d::CCArray **this, RingObject *a2)
{
int v2; // r7
unsigned int v5; // r9
unsigned int v6; // r4
unsigned int v7; // r10
_DWORD *v8; // r3
_DWORD *i; // r6
unsigned int v10; // r0
int v11; // r1
cocos2d::CCArray *v12; // r0
cocos2d::CCArray *v13; // r6
float v14; // s13
float v15; // s15
bool v16; // r8
unsigned int v17; // r8
unsigned int v18; // r1
cocos2d::CCArray **v19; // r3
int v20; // r3
unsigned int v21; // r0
int v22; // r1
if ( !cocos2d::CCArray::containsObject(*(this + 519), a2) )
cocos2d::CCArray::addObject(*(this + 519), a2);
v5 = *((_DWORD *)a2 + 195);
v6 = (unsigned int)*(this + 521);
if ( v6 )
{
v7 = v6 - 1;
v2 = ((v6 - 1) & v6) != 0 ? v5 % v6 : v7 & v5;
v8 = *((_DWORD **)*(this + 520) + v2);
if ( v8 )
{
for ( i = (_DWORD *)*v8; i; i = (_DWORD *)*i )
{
v10 = i[1];
v11 = ((v6 - 1) & v6) != 0 ? v10 % v6 : v7 & v10;
if ( v11 != v2 )
break;
if ( i[2] == v5 )
return;
}
}
}
v12 = (cocos2d::CCArray *)operator new(0xCu);
*((_DWORD *)v12 + 2) = v5;
v13 = v12;
*((_DWORD *)v12 + 1) = v5;
*(_DWORD *)v12 = 0;
v14 = *((float *)this + 524);
v15 = (float)((unsigned int)*(this + 523) + 1);
if ( v15 > (float)((float)v6 * v14) )
{
v16 = v6 > 2 && ((v6 - 1) & v6) == 0;
goto LABEL_17;
}
if ( !v6 )
{
v16 = 0;
LABEL_17:
v17 = 2 * v6 + !v16;
v18 = (unsigned int)ceilf(v15 / v14);
if ( v18 < v17 )
v18 = v17;
std::__hash_table,std::equal_to,std::allocator>::rehash((int)(this + 520), v18);
v6 = (unsigned int)*(this + 521);
if ( ((v6 - 1) & v6) != 0 )
v2 = v5 % v6;
else
v2 = (v6 - 1) & v5;
}
v19 = *((cocos2d::CCArray ***)*(this + 520) + v2);
if ( v19 )
{
*(_DWORD *)v13 = *v19;
*v19 = v13;
}
else
{
*(_DWORD *)v13 = *(this + 522);
v20 = (int)*(this + 520);
*(this + 522) = v13;
*(_DWORD *)(v20 + 4 * v2) = this + 522;
if ( *(_DWORD *)v13 )
{
v21 = *(_DWORD *)(*(_DWORD *)v13 + 4);
if ( ((v6 - 1) & v6) != 0 )
v22 = v21 % v6;
else
v22 = (v6 - 1) & v21;
*((_DWORD *)*(this + 520) + v22) = v13;
}
}
*(this + 523) = (cocos2d::CCArray *)((char *)*(this + 523) + 1);
}