//
// SetGroupIDLayer::onPaste from 0x140591980 to 0x140591b21 (417 bytes)
//
// 2 xrefs:
// > SetGroupIDLayer::init @ 0x1405902a8
// > ??> @ 0x14092cdbc
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// 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:34:32 +0000
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall SetGroupIDLayer::onPaste(__int64 a1)
{
__int64 v2; // r9
__int64 v3; // rbp
__int64 v4; // rbx
__int64 v5; // rdi
__int64 v6; // rdx
unsigned int *v7; // r8
__int64 v8; // rax
__int64 *v9; // r8
__int64 v10; // rcx
__int64 v11; // r8
unsigned __int64 v12; // r10
__int64 v13; // r8
unsigned int *v14; // rbx
__int64 v15; // rax
__int64 *v16; // rbx
__int64 *i; // rbp
__int64 result; // rax
void *v19; // [rsp+30h] [rbp+8h]
v2 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v19 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v19);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v2 = qword_14090BFD0;
}
v3 = *(_QWORD *)(a1 + 680);
v4 = *(_QWORD *)(a1 + 672);
v5 = *(_QWORD *)(v2 + 568);
v6 = *(_QWORD *)(v5 + 14776);
if ( v6 )
{
if ( v4 )
{
GameObject::duplicateAttributes(*(_QWORD *)(a1 + 672), v6);
*(_BYTE *)(v4 + 1156) = 1;
}
else if ( v3 )
{
v7 = *(unsigned int **)(v3 + 56);
v8 = *v7;
if ( (_DWORD)v8 )
{
v9 = *((__int64 **)v7 + 2);
if ( v9 <= &v9[v8 - 1] )
{
do
{
if ( !*v9 )
break;
GameObject::duplicateAttributes(*v9, *(_QWORD *)(v5 + 14776));
*(_BYTE *)(v10 + 1156) = 1;
v9 = (__int64 *)(v11 + 8);
}
while ( (unsigned __int64)v9 <= v12 );
}
}
}
if ( !GameManager::getGameVariable(v2, "0156") )
{
v13 = *(_QWORD *)(v5 + 14776);
if ( v13 )
{
if ( v4 )
{
LevelEditorLayer::applyGroupState(v5, v4, v13);
}
else if ( v3 )
{
v14 = *(unsigned int **)(v3 + 56);
v15 = *v14;
if ( (_DWORD)v15 )
{
v16 = *((__int64 **)v14 + 2);
for ( i = &v16[v15 - 1]; v16 <= i; ++v16 )
{
if ( !*v16 )
break;
LevelEditorLayer::applyGroupState(v5, *v16, *(_QWORD *)(v5 + 14776));
}
}
}
}
}
}
*(_BYTE *)(a1 + 797) = 1;
SetGroupIDLayer::determineStartValues(a1);
SetGroupIDLayer::updateGroupIDLabel(a1);
SetGroupIDLayer::updateEditorLabel(a1);
SetGroupIDLayer::updateEditorLabel2(a1);
SetGroupIDLayer::updateZOrderLabel(a1);
SetGroupIDLayer::updateZLayerButtons(a1);
result = SetGroupIDLayer::updateGroupIDButtons(a1);
*(_BYTE *)(a1 + 797) = 0;
return result;
}