//
// PlayerObject::resetTouchedRings from 0x100412940 to 0x100412bd1 (657 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::update @ 0x100151eb9
// > GJBaseGameLayer::update @ 0x100151ed0
//
// 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 __fastcall PlayerObject::resetTouchedRings(PlayerObject *a1, bool a2)
{
cocos2d::CCArray *m_touchingRings; // rdi
unsigned int i; // r14d
__int64 v5; // rax
unsigned __int64 value; // rdi
unsigned __int64 v7; // rcx
unsigned __int64 v8; // rdx
unsigned __int64 v9; // r9
__int64 v10; // rsi
std::__hash_node_base *> *v11; // rax
std::__hash_node_base *>::__next_pointer next; // r8
unsigned __int64 v13; // rdi
std::__hash_node_base *>::__next_pointer v14; // rax
unsigned __int64 v15; // rax
std::__hash_node_base *>::__next_pointer v16; // rdi
std::__hash_node_base *> *v17; // r14
unsigned __int64 v18; // rsi
m_touchingRings = a1->m_touchingRings;
if ( a2 )
{
sub_100720270(m_touchingRings);
goto LABEL_35;
}
if ( (unsigned int)sub_100720070(m_touchingRings) )
{
for ( i = 0; i < (unsigned int)sub_100720070(a1->m_touchingRings); ++i )
{
while ( 1 )
{
v5 = sub_1007200C0(a1->m_touchingRings, i);
value = a1->m_touchedRings.__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;
if ( !value )
goto LABEL_34;
v7 = *(int *)(v5 + 916);
v8 = ((value - ((value >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((value - ((value >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL);
v9 = (0x101010101010101LL * ((v8 + (v8 >> 4)) & 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v9 <= 1 )
{
v10 = v7 & (value - 1);
v11 = a1->m_touchedRings.__table_.__bucket_list_.__ptr_.__value_[v10];
if ( !v11 )
goto LABEL_34;
goto LABEL_13;
}
v10 = *(int *)(v5 + 916);
if ( value <= v7 )
break;
LABEL_12:
v11 = a1->m_touchedRings.__table_.__bucket_list_.__ptr_.__value_[v10];
if ( v11 )
goto LABEL_13;
LABEL_34:
sub_100720230(a1->m_touchingRings, i, 1);
if ( i >= (unsigned int)sub_100720070(a1->m_touchingRings) )
goto LABEL_35;
}
if ( (value | v7) >> 32 )
{
v10 = v7 % value;
goto LABEL_12;
}
v10 = (unsigned int)v7 % (unsigned int)value;
v11 = a1->m_touchedRings.__table_.__bucket_list_.__ptr_.__value_[v10];
if ( !v11 )
goto LABEL_34;
LABEL_13:
next = v11->__next_;
if ( !v11->__next_ )
goto LABEL_34;
if ( (unsigned int)v9 < 2 )
{
v13 = value - 1;
while ( 1 )
{
v14 = next[1].__next_;
if ( v14 == (std::__hash_node_base *>::__next_pointer)v7 )
{
if ( LODWORD(next[2].__next_) == (_DWORD)v7 )
goto LABEL_31;
}
else if ( (v13 & (unsigned __int64)v14) != v10 )
{
goto LABEL_34;
}
next = next->__next_;
if ( !next )
goto LABEL_34;
}
}
while ( 1 )
{
v15 = (unsigned __int64)next[1].__next_;
if ( v15 == v7 )
break;
if ( v15 < value )
goto LABEL_27;
if ( (value | v15) >> 32 )
{
v15 %= value;
LABEL_27:
if ( v15 != v10 )
goto LABEL_34;
goto LABEL_22;
}
if ( (unsigned int)v15 % (unsigned int)value != v10 )
goto LABEL_34;
LABEL_22:
next = next->__next_;
if ( !next )
goto LABEL_34;
}
if ( LODWORD(next[2].__next_) != (_DWORD)v7 )
goto LABEL_22;
LABEL_31:
;
}
}
LABEL_35:
if ( a1->m_touchedRings.__table_.__p2_.__value_ )
{
v16 = a1->m_touchedRings.__table_.__p1_.__value_.__next_;
if ( v16 )
{
do
{
v17 = v16->__next_;
operator delete(v16);
v16 = v17;
}
while ( v17 );
}
a1->m_touchedRings.__table_.__p1_.__value_.__next_ = nullptr;
v18 = a1->m_touchedRings.__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;
if ( v18 )
__bzero(a1->m_touchedRings.__table_.__bucket_list_.__ptr_.__value_, 8 * v18);
a1->m_touchedRings.__table_.__p2_.__value_ = 0;
}
}