//
// GJSmartTemplate::offsetForDir from 0x1004263f0 to 0x1004264b3 (195 bytes)
//
// 18 xrefs:
// > EditorUI::addObjectsToSmartTemplate @ 0x10004163a
// > EditorUI::addObjectsToSmartTemplate @ 0x10004172a
// > EditorUI::addObjectsToSmartTemplate @ 0x10004181d
// > EditorUI::addObjectsToSmartTemplate @ 0x10004190d
// > EditorUI::addObjectsToSmartTemplate @ 0x1000419fd
// > EditorUI::addObjectsToSmartTemplate @ 0x100041aed
// > EditorUI::addObjectsToSmartTemplate @ 0x100041bd4
// > EditorUI::addObjectsToSmartTemplate @ 0x100041cce
// > EditorUI::addObjectsToSmartTemplate @ 0x10004230f
// > EditorUI::addObjectsToSmartTemplate @ 0x100042354
// > EditorUI::addObjectsToSmartTemplate @ 0x100042399
// > EditorUI::addObjectsToSmartTemplate @ 0x1000423de
// > EditorUI::addObjectsToSmartTemplate @ 0x100042423
// > EditorUI::addObjectsToSmartTemplate @ 0x100042468
// > EditorUI::addObjectsToSmartTemplate @ 0x1000424ad
// > EditorUI::addObjectsToSmartTemplate @ 0x1000424f2
// > EditorUI::getSmartNeighbor @ 0x100042956
// > EditorUI::getNeighbor @ 0x1000445b2
//
// 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
//
// local variable allocation has failed, the output may be wrong!
cocos2d::CCPoint __fastcall GJSmartTemplate::offsetForDir(GJSmartDirection a1, int a2)
{
int v2; // edx
__m128 v3; // xmm0
int v4; // r15d
ObjectToolbox *v5; // rax
__m128 v6; // rt1
cocos2d::CCPoint v7; // xmm2_8
float x; // xmm1_4
cocos2d::CCPoint result; // 0:xmm0_8.8
v4 = v2;
v5 = ObjectToolbox::sharedState();
v3.f32[0] = ObjectToolbox::gridNodeSizeForKey(v5, v4);
v6.i32[0] = 1097859072;
v7 = (cocos2d::CCPoint)*((unsigned int *)&unk_10081B8F0 + (_mm_cvtsi128_si32((__m128i)_mm_cmpeq_ss(v3, v6)) & 1));
switch ( a2 )
{
case 1:
goto LABEL_3;
case 2:
v7.x = -v7.x;
LABEL_3:
result = 0;
goto LABEL_11;
case 3:
v7 = (cocos2d::CCPoint)(*(_QWORD *)&v7 ^ 0x8000000080000000LL);
goto LABEL_6;
case 4:
LABEL_6:
x = 0.0;
goto LABEL_8;
case 5:
result = (cocos2d::CCPoint)(*(_QWORD *)&v7 ^ 0x8000000080000000LL);
goto LABEL_11;
case 6:
goto LABEL_10;
case 7:
v7 = (cocos2d::CCPoint)(*(_QWORD *)&v7 ^ 0x8000000080000000LL);
LABEL_10:
result = v7;
LABEL_11:
x = v7.x;
break;
case 8:
x = -v7.x;
LABEL_8:
result = v7;
break;
default:
result = 0;
x = 0.0;
break;
}
sub_10028CBE0(*(float **)&a1, result.x, x);
return result;
}