//
// EditorUI::constrainGameLayerPosition from 0x10002a910 to 0x10002ab00 (496 bytes)
//
// 9 xrefs:
// > EditorUI::init @ 0x10000a682
// > EditorUI::sliderChanged @ 0x10000b7cf
// > EditorUI::constrainGameLayerPosition_1 @ 0x10002efa0
// > EditorUI::moveGamelayer @ 0x10002f3fe
// > EditorUI::findAndSelectObject @ 0x1000334e3
// > EditorUI::centerCameraOnObject @ 0x100033679
// > EditorUI::updateZoom @ 0x10003dae7
// > EditorUI::ccTouchMoved @ 0x10004f6a0
// > EditorUI::scrollWheel @ 0x1000517fc
//
// 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 v3; // rax
double v4; // xmm0_8
cocos2d::CCDirector *v5; // rax
cocos2d::CCLayer *m_objectLayer; // r15
cocos2d::CCDirector *v7; // rax
cocos2d::CCDirector *v8; // rax
double v9; // xmm0_8
LevelEditorLayer *m_editorLayer; // rax
const cocos2d::CCPoint *v11; // r15
float v12; // xmm1_4
char v13; // [rsp+8h] [rbp-68h] BYREF
unsigned __int64 v14; // [rsp+10h] [rbp-60h] BYREF
unsigned __int64 v15; // [rsp+18h] [rbp-58h] BYREF
unsigned __int64 v16; // [rsp+20h] [rbp-50h] BYREF
unsigned __int64 v17; // [rsp+28h] [rbp-48h] BYREF
float v18; // [rsp+34h] [rbp-3Ch]
unsigned __int64 v19; // [rsp+38h] [rbp-38h] BYREF
float v20; // [rsp+44h] [rbp-2Ch]
v20 = a3;
v18 = a2;
v3 = ((__int64 (__fastcall *)(cocos2d::CCLayer *))a1->m_editorLayer->m_objectLayer->getPosition)(a1->m_editorLayer->m_objectLayer);
v4 = sub_10028CC60(&v17, v3);
((void (__fastcall *)(cocos2d::CCLayer *, __int64 *, double))a1->m_editorLayer->m_objectLayer->setPosition)(
a1->m_editorLayer->m_objectLayer,
&qword_10099EC08,
v4);
v5 = cocos2d::CCDirector::sharedDirector();
*(float *)&v4 = sub_100484D90(v5);
sub_10028CBE0(&v14, *(float *)&v4, a1->m_constrainedHeight);
m_objectLayer = a1->m_editorLayer->m_objectLayer;
sub_10028CBE0(&v19, (float)(v18 * 30.0) + -30.0, (float)(v20 * 30.0) + 90.0);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v15, (const cocos2d::CCPoint *)m_objectLayer);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v19, (const cocos2d::CCPoint *)a1->m_editorLayer);
sub_10028CC90(&v15, &v19);
v7 = cocos2d::CCDirector::sharedDirector();
v20 = sub_100484DA0(v7, &v19);
v8 = cocos2d::CCDirector::sharedDirector();
v9 = sub_100484D70(v8);
sub_10028CBE0(&v19, v20, *(float *)&v9);
m_editorLayer = a1->m_editorLayer;
v11 = (const cocos2d::CCPoint *)m_editorLayer->m_objectLayer;
if ( m_editorLayer->m_levelSettings->m_dynamicLevelHeight )
v12 = 30120.0;
else
v12 = 2520.0;
sub_10028CBE0(&v13, 240030.0, v12);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v16, v11);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v13, (const cocos2d::CCPoint *)a1->m_editorLayer);
sub_10028CC90(&v16, &v13);
_mm_storel_ps(
(double *)&v17,
_mm_max_ps(_mm_sub_ps((__m128)v19, (__m128)v16), _mm_min_ps(_mm_sub_ps((__m128)v14, (__m128)v15), (__m128)v17)));
((void (__fastcall *)(cocos2d::CCLayer *, unsigned __int64 *))a1->m_editorLayer->m_objectLayer->setPosition)(
a1->m_editorLayer->m_objectLayer,
&v17);
}