//
// EditorUI::constrainGameLayerPosition from 0x1401bf010 to 0x1401bf266 (598 bytes)
//
// 9 xrefs:
// > EditorUI::init @ 0x1401ab26c
// > EditorUI::sliderChanged @ 0x1401ae0f8
// > EditorUI::moveGamelayer @ 0x1401ae99e
// > EditorUI::centerCameraOnPoint @ 0x1401b1530
// > EditorUI::updateZoom @ 0x1401b4d7b
// > EditorUI::ccTouchMoved @ 0x1401c07d3
// > EditorUI::ccTouchMoved @ 0x1401c0cb6
// > sub_1401C4B40 @ 0x1401c503e
// > ??> @ 0x14091a57c
//
// 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:28:02 +0000
//
__int64 __fastcall EditorUI::constrainGameLayerPosition(__int64 a1, float a2, float a3)
{
const struct cocos2d::CCPoint *v4; // rax
float v5; // xmm6_4
__int64 v6; // rcx
cocos2d::CCDirector *v7; // rax
float ScreenLeft; // xmm0_4
__int64 v9; // rbx
__int64 v10; // rax
__int64 v11; // rax
__int64 v12; // rcx
cocos2d::CCDirector *v13; // rax
float ScreenTop; // xmm6_4
__int64 v15; // rcx
cocos2d::CCDirector *v16; // rax
float ScreenRight; // xmm0_4
__int64 v18; // rax
__int64 v19; // rcx
__int64 v20; // rbx
int v21; // eax
__int64 v22; // rax
__int64 v23; // rax
__int64 v24; // rax
float v26[2]; // [rsp+20h] [rbp-60h] BYREF
float v27[2]; // [rsp+28h] [rbp-58h] BYREF
float v28[2]; // [rsp+30h] [rbp-50h] BYREF
_BYTE v29[8]; // [rsp+38h] [rbp-48h] BYREF
float v30; // [rsp+90h] [rbp+10h] BYREF
float v31; // [rsp+94h] [rbp+14h]
float v32; // [rsp+A8h] [rbp+28h] BYREF
float v33; // [rsp+ACh] [rbp+2Ch]
v4 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(*(_QWORD *)(a1 + 1512) + 4296LL)
+ 200LL))(*(_QWORD *)(*(_QWORD *)(a1 + 1512)
+ 4296LL));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v30, v4);
(*(void (__fastcall **)(_QWORD, int *))(**(_QWORD **)(*(_QWORD *)(a1 + 1512) + 4296LL) + 184LL))(
*(_QWORD *)(*(_QWORD *)(a1 + 1512) + 4296LL),
&dword_14090A6E8);
v5 = *(float *)(a1 + 900);
v7 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v6);
ScreenLeft = cocos2d::CCDirector::getScreenLeft(v7);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v27, ScreenLeft, v5);
v9 = *(_QWORD *)(*(_QWORD *)(a1 + 1512) + 4296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v29, (float)(a2 * 30.0) - 30.0, (float)(a3 * 30.0) + 90.0);
cocos2d::CCNode::convertToWorldSpace(v9, &v32, v10);
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 1512), v29, &v32);
cocos2d::CCPoint::operator=(&v32, v11);
v13 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v12);
ScreenTop = cocos2d::CCDirector::getScreenTop(v13);
v16 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v15);
ScreenRight = cocos2d::CCDirector::getScreenRight(v16);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v28, ScreenRight, ScreenTop);
v18 = *(_QWORD *)(a1 + 1512);
v19 = *(_QWORD *)(v18 + 3528);
v20 = *(_QWORD *)(v18 + 4296);
v21 = 80;
if ( *(_BYTE *)(v19 + 461) )
v21 = 1000;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v29, 240030.0, (float)((float)((float)v21 * 30.0) + 90.0) + 30.0);
cocos2d::CCNode::convertToWorldSpace(v20, v26, v22);
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 1512), v29, v26);
cocos2d::CCPoint::operator=(v26, v23);
v24 = *(_QWORD *)(a1 + 1512);
v30 = fmaxf(fminf(v30, v27[0] - v32), v28[0] - v26[0]);
v31 = fmaxf(fminf(v31, v27[1] - v33), v28[1] - v26[1]);
return (*(__int64 (__fastcall **)(_QWORD, float *))(**(_QWORD **)(v24 + 4296) + 184LL))(*(_QWORD *)(v24 + 4296), &v30);
}