//
// EditorUI::constrainGameLayerPosition from 0x1003e4400 to 0x1003e45b4 (436 bytes)
//
// 6 xrefs:
// > EditorUI::init @ 0x1003c6050
// > EditorUI::sliderChanged @ 0x1003c6f0c
// > EditorUI::moveGamelayer @ 0x1003e7834
// > EditorUI::centerCameraOnObject @ 0x1003ea1e4
// > EditorUI::updateZoom @ 0x1003ee7f0
// > EditorUI::ccTouchMoved @ 0x1003f8d70
//
// 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 EditorUI::constrainGameLayerPosition(EditorUI *a1, float a2, float a3)
{
__int64 *v6; // x0
float v7; // s0
cocos2d::CCDirector *v8; // x0
__n128 v9; // q0
__n128 v10; // q1
cocos2d::CCLayer *m_objectLayer; // x20
__n128 v12; // q0
__n128 v13; // q1
cocos2d::CCDirector *v14; // x0
float v15; // s8
cocos2d::CCDirector *v16; // x0
__n128 v17; // q1
__n128 v18; // q0
__n128 v19; // q1
LevelEditorLayer *m_editorLayer; // x8
cocos2d::CCNode *v21; // x20
__n128 v22; // q0
float32x2_t v23; // d1
float32x2_t v24; // d0
float32x2_t v25; // d1
cocos2d::CCPoint v26; // [xsp+0h] [xbp-60h] BYREF
float32x2_t v27; // [xsp+8h] [xbp-58h] BYREF
float32x2_t v28; // [xsp+10h] [xbp-50h] BYREF
float32x2_t v29; // [xsp+18h] [xbp-48h] BYREF
float32x2_t v30; // [xsp+20h] [xbp-40h] BYREF
int8x8_t v31; // [xsp+28h] [xbp-38h] BYREF
v6 = (__int64 *)((__int64 (__fastcall *)(cocos2d::CCLayer *))a1->m_editorLayer->m_objectLayer->getPosition)(a1->m_editorLayer->m_objectLayer);
v7 = sub_1000229B8((__int64 *)&v31, v6);
((void (__fastcall *)(cocos2d::CCLayer *, int *, float))a1->m_editorLayer->m_objectLayer->setPosition)(
a1->m_editorLayer->m_objectLayer,
&dword_10086E8B0,
v7);
v8 = cocos2d::CCDirector::sharedDirector();
v9.n128_f32[0] = sub_1001768D8((__int64)v8);
v10.n128_u32[0] = LODWORD(a1->m_constrainedHeight);
sub_100022980(v9, v10, &v30);
m_objectLayer = a1->m_editorLayer->m_objectLayer;
v12.n128_f32[0] = (float)(a2 * 30.0) + -30.0;
v13.n128_f32[0] = (float)(a3 * 30.0) + 90.0;
sub_100022980(v12, v13, &v28);
cocos2d::CCNode::convertToWorldSpace(m_objectLayer, (const cocos2d::CCPoint *)&v28);
cocos2d::CCNode::convertToNodeSpace(a1->m_editorLayer, (const cocos2d::CCPoint *)&v29);
sub_1000229D0(&v29, (double *)&v28);
v14 = cocos2d::CCDirector::sharedDirector();
v15 = sub_1001768E0((__int64)v14);
v16 = cocos2d::CCDirector::sharedDirector();
v17.n128_u32[0] = sub_1001768C8((__int64)v16);
v18.n128_f32[0] = v15;
sub_100022980(v18, v17, &v28);
m_editorLayer = a1->m_editorLayer;
v21 = m_editorLayer->m_objectLayer;
v22.n128_u32[0] = 1117782016;
if ( m_editorLayer->m_levelSettings->m_dynamicLevelHeight )
v22.n128_f32[0] = 1000.0;
v19.n128_f32[0] = (float)((float)(v22.n128_f32[0] * 30.0) + 90.0) + 30.0;
v22.n128_u32[0] = 1214932864;
sub_100022980(v22, v19, &v26);
cocos2d::CCNode::convertToWorldSpace(v21, &v26);
cocos2d::CCNode::convertToNodeSpace(a1->m_editorLayer, (const cocos2d::CCPoint *)&v27);
sub_1000229D0(&v27, (double *)&v26);
v23 = vsub_f32(v30, v29);
v24 = (float32x2_t)vbsl_s8((int8x8_t)vcgt_f32((float32x2_t)v31, v23), (int8x8_t)v23, v31);
v25 = vsub_f32(v28, v27);
v31 = vbsl_s8((int8x8_t)vcgt_f32(v25, v24), (int8x8_t)v25, (int8x8_t)v24);
((void (__fastcall *)(cocos2d::CCLayer *, int8x8_t *))a1->m_editorLayer->m_objectLayer->setPosition)(
a1->m_editorLayer->m_objectLayer,
&v31);
}