//
// LevelEditorLayer::addTriggersWithTargetGroupID from 0x1000edd00 to 0x1000ee239 (1337 bytes)
//
// 0 xrefs:
//
// 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 LevelEditorLayer::addTriggersWithTargetGroupID(
LevelEditorLayer *a1,
std::unordered_set *a2,
std::unordered_set *a3,
cocos2d::CCArray *a4,
std::unordered_map *a5,
int a6)
{
cocos2d::CCArray *m_objects; // rax
cocos2d::ccArray *data; // rax
int **arr; // r13
int **v11; // r15
SpawnTriggerGameObject *v12; // rbx
__int64 v13; // rax
int *v14; // r11
unsigned __int64 value; // rdi
unsigned __int64 v16; // rcx
unsigned __int64 v17; // r10
__int64 v18; // rsi
std::__hash_node_base, void *> *> *v19; // rax
std::__hash_node_base, void *> *>::__next_pointer next; // r8
unsigned __int64 v21; // rdi
unsigned __int64 v22; // rax
std::__hash_node_base, void *> *>::__next_pointer v23; // rax
unsigned __int64 v24; // rdi
int v25; // ebx
unsigned __int64 v26; // r8
unsigned __int64 v27; // rsi
std::__hash_node_base *> **v28; // r11
std::__hash_node_base *> *v29; // rax
std::__hash_node_base *>::__next_pointer v30; // r10
std::__hash_node_base *>::__next_pointer v31; // rdx
SpawnTriggerGameObject *v32; // r11
std::unordered_set *v33; // rbx
std::unordered_set *v34; // r15
std::unordered_map *v35; // r12
int v36; // r14d
ChanceObject *RemapWithSource; // rax
unsigned __int64 v38; // rax
unsigned __int64 v39; // rsi
std::__hash_node_base *> *v40; // rax
std::__hash_node_base *>::__next_pointer v41; // r10
unsigned __int64 v42; // rdi
unsigned __int64 v43; // rax
std::__hash_node_base *>::__next_pointer v44; // rax
int *p_m_uniqueID; // [rsp+8h] [rbp-68h] BYREF
int **v46; // [rsp+10h] [rbp-60h]
cocos2d::CCArray *v47; // [rsp+18h] [rbp-58h]
std::unordered_set *v48; // [rsp+20h] [rbp-50h]
int m_uniqueID; // [rsp+2Ch] [rbp-44h] BYREF
int v50; // [rsp+30h] [rbp-40h]
int v51; // [rsp+34h] [rbp-3Ch]
int *v52; // [rsp+38h] [rbp-38h]
char v53[41]; // [rsp+47h] [rbp-29h] BYREF
v47 = a4;
v48 = a3;
m_objects = a1->m_objects;
if ( m_objects )
{
data = m_objects->data;
if ( data->num )
{
arr = (int **)data->arr;
v11 = &arr[data->num - 1];
v48 = (std::unordered_set *)((char *)v48 + 16);
do
{
v14 = *arr;
if ( !*arr )
return;
if ( v14[312] != 1 || a6 > 0 && v14[257] != a6 )
goto LABEL_5;
value = a5->__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;
if ( !value )
goto LABEL_37;
v16 = v14[229];
v17 = (0x101010101010101LL
* ((((value - ((value >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((value - ((value >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)
+ ((((value - ((value >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((value - ((value >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)) >> 4))
& 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v17 > 1 )
{
v18 = v14[229];
if ( value > v16 )
goto LABEL_17;
if ( (value | v16) >> 32 )
{
v18 = v16 % value;
LABEL_17:
v19 = a5->__table_.__bucket_list_.__ptr_.__value_[v18];
if ( !v19 )
goto LABEL_37;
goto LABEL_18;
}
v18 = (unsigned int)v16 % (unsigned int)value;
v19 = a5->__table_.__bucket_list_.__ptr_.__value_[v18];
if ( !v19 )
goto LABEL_37;
}
else
{
v18 = v16 & (value - 1);
v19 = a5->__table_.__bucket_list_.__ptr_.__value_[v18];
if ( !v19 )
goto LABEL_37;
}
LABEL_18:
next = v19->__next_;
if ( v19->__next_ )
{
if ( (unsigned int)v17 < 2 )
{
v21 = value - 1;
while ( 1 )
{
v23 = next[1].__next_;
if ( v23 == (std::__hash_node_base, void *> *>::__next_pointer)v16 )
{
if ( LODWORD(next[2].__next_) == (_DWORD)v16 )
goto LABEL_5;
}
else if ( (v21 & (unsigned __int64)v23) != v18 )
{
goto LABEL_37;
}
next = next->__next_;
if ( !next )
goto LABEL_37;
}
}
while ( 1 )
{
v22 = (unsigned __int64)next[1].__next_;
if ( v22 == v16 )
{
if ( LODWORD(next[2].__next_) == (_DWORD)v16 )
goto LABEL_5;
goto LABEL_22;
}
if ( v22 < value )
goto LABEL_27;
if ( (value | v22) >> 32 )
break;
if ( (unsigned int)v22 % (unsigned int)value != v18 )
goto LABEL_37;
LABEL_22:
next = next->__next_;
if ( !next )
goto LABEL_37;
}
v22 %= value;
LABEL_27:
if ( v22 != v18 )
goto LABEL_37;
goto LABEL_22;
}
LABEL_37:
v24 = a2->__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;
if ( !v24 )
goto LABEL_5;
v25 = v14[366];
v26 = (0x101010101010101LL
* ((((v24 - ((v24 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v24 - ((v24 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)
+ ((((v24 - ((v24 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v24 - ((v24 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)) >> 4))
& 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v26 > 1 )
{
v27 = v25;
if ( v24 <= v25 )
{
if ( (v24 | v25) >> 32 )
v27 = v25 % v24;
else
v27 = v25 % (unsigned int)v24;
}
}
else
{
v27 = v25 & (v24 - 1);
}
v52 = *arr;
v28 = a2->__table_.__bucket_list_.__ptr_.__value_;
v29 = a2->__table_.__bucket_list_.__ptr_.__value_[v27];
if ( !v29 || (v30 = v29->__next_) == nullptr )
{
LABEL_68:
v25 = v52[367];
if ( (unsigned int)v26 <= 1 )
{
v39 = v25 & (v24 - 1);
v40 = v28[v39];
v32 = (SpawnTriggerGameObject *)v52;
if ( !v40 )
goto LABEL_5;
goto LABEL_75;
}
v39 = v25;
if ( v24 > v25 )
{
LABEL_74:
v40 = v28[v39];
v32 = (SpawnTriggerGameObject *)v52;
if ( !v40 )
goto LABEL_5;
goto LABEL_75;
}
if ( (v24 | v25) >> 32 )
{
v39 = v25 % v24;
goto LABEL_74;
}
v39 = v25 % (unsigned int)v24;
v40 = v28[v39];
v32 = (SpawnTriggerGameObject *)v52;
if ( !v40 )
goto LABEL_5;
LABEL_75:
v41 = v40->__next_;
if ( !v40->__next_ )
goto LABEL_5;
if ( (unsigned int)v26 < 2 )
{
v42 = v24 - 1;
while ( 1 )
{
v44 = v41[1].__next_;
if ( v44 == (std::__hash_node_base *>::__next_pointer)v25 )
{
if ( LODWORD(v41[2].__next_) == v25 )
goto LABEL_53;
}
else if ( (v42 & (unsigned __int64)v44) != v39 )
{
goto LABEL_5;
}
v41 = v41->__next_;
if ( !v41 )
goto LABEL_5;
}
}
while ( 2 )
{
v43 = (unsigned __int64)v41[1].__next_;
if ( v43 == v25 )
{
if ( LODWORD(v41[2].__next_) == v25 )
goto LABEL_53;
}
else if ( v43 < v24 )
{
LABEL_84:
if ( v43 != v39 )
goto LABEL_5;
}
else
{
if ( (v24 | v43) >> 32 )
{
v43 %= v24;
goto LABEL_84;
}
if ( (unsigned int)v43 % (unsigned int)v24 != v39 )
goto LABEL_5;
}
v41 = v41->__next_;
if ( !v41 )
goto LABEL_5;
continue;
}
}
if ( (unsigned int)v26 < 2 )
{
while ( 1 )
{
v31 = v30[1].__next_;
if ( v31 == (std::__hash_node_base *>::__next_pointer)v25 )
{
if ( LODWORD(v30[2].__next_) == v25 )
goto LABEL_52;
}
else if ( ((v24 - 1) & (unsigned __int64)v31) != v27 )
{
goto LABEL_68;
}
v30 = v30->__next_;
if ( !v30 )
goto LABEL_68;
}
}
while ( 1 )
{
v38 = (unsigned __int64)v30[1].__next_;
if ( v38 == v25 )
break;
if ( v38 >= v24 )
{
if ( (v24 | v38) >> 32 )
v38 %= v24;
else
v38 = (unsigned int)v38 % (unsigned int)v24;
}
if ( v38 != v27 )
goto LABEL_68;
LABEL_61:
v30 = v30->__next_;
if ( !v30 )
goto LABEL_68;
}
if ( LODWORD(v30[2].__next_) != v25 )
goto LABEL_61;
LABEL_52:
v32 = (SpawnTriggerGameObject *)v52;
LABEL_53:
v50 = v25;
if ( v25 > 0 )
{
if ( v32->m_objectID == 1268 )
{
v33 = v48;
v46 = v11;
while ( 1 )
{
v33 = (std::unordered_set *)v33->__table_.__bucket_list_.__ptr_.__value_;
if ( !v33 )
break;
v34 = a2;
v35 = a5;
v36 = a6;
RemapWithSource = SpawnTriggerGameObject::getRemapWithSource(
v32,
(int)v33->__table_.__p1_.__value_.__next_);
v32 = (SpawnTriggerGameObject *)v52;
a6 = v36;
a5 = v35;
a2 = v34;
v11 = v46;
if ( RemapWithSource )
goto LABEL_5;
}
}
v51 = a6;
v12 = v32;
sub_10071FCD0(v47, v32);
m_uniqueID = v12->m_uniqueID;
p_m_uniqueID = &m_uniqueID;
v13 = sub_100105AF0(a5, &m_uniqueID, &unk_100816708, &p_m_uniqueID, v53);
a6 = v51;
*(_DWORD *)(v13 + 20) = v50;
}
LABEL_5:
++arr;
}
while ( arr <= v11 );
}
}
}