//
// GJSmartTemplate::offsetForDir from 0x100007460 to 0x10000756c (268 bytes)
//
// 18 xrefs:
// > GJSmartTemplate::keyFromNeighbors @ 0x10000717c
// > GJSmartTemplate::keyFromNeighbors @ 0x1000071ac
// > GJSmartTemplate::keyFromNeighbors @ 0x1000071dc
// > GJSmartTemplate::keyFromNeighbors @ 0x10000720c
// > GJSmartTemplate::keyFromNeighbors @ 0x10000723c
// > GJSmartTemplate::keyFromNeighbors @ 0x10000726c
// > GJSmartTemplate::keyFromNeighbors @ 0x10000729c
// > GJSmartTemplate::keyFromNeighbors @ 0x1000072cc
// > EditorUI::addObjectsToSmartTemplate @ 0x1003f114c
// > EditorUI::addObjectsToSmartTemplate @ 0x1003f1188
// > EditorUI::addObjectsToSmartTemplate @ 0x1003f11c4
// > EditorUI::addObjectsToSmartTemplate @ 0x1003f1200
// > EditorUI::addObjectsToSmartTemplate @ 0x1003f123c
// > EditorUI::addObjectsToSmartTemplate @ 0x1003f1278
// > EditorUI::addObjectsToSmartTemplate @ 0x1003f12b4
// > EditorUI::addObjectsToSmartTemplate @ 0x1003f12f0
// > EditorUI::getSmartNeighbor @ 0x1003f1634
// > EditorUI::getNeighbor @ 0x1003f2bb0
//
// 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
//
cocos2d::CCPoint __fastcall GJSmartTemplate::offsetForDir(GJSmartDirection a1, int a2)
{
__int64 v2; // x8
__int64 v5; // x19
ObjectToolbox *v6; // x0
__n128 v7; // q0
__n128 v8; // q1
float v9; // s2
__int64 v10; // x0
v5 = v2;
v6 = ObjectToolbox::sharedState();
if ( ObjectToolbox::gridNodeSizeForKey(v6, a2) == 15.0 )
v9 = 15.0;
else
v9 = 30.0;
if ( a1 > 4 )
{
if ( a1 <= TopRight )
{
if ( a1 != TopLeft )
{
v10 = v5;
v7.n128_f32[0] = v9;
LABEL_21:
v8.n128_f32[0] = v9;
return sub_100022980(v10, v7, v8);
}
v7.n128_f32[0] = -v9;
LABEL_20:
v10 = v5;
goto LABEL_21;
}
if ( a1 == BottomLeft )
{
v7.n128_f32[0] = -v9;
v10 = v5;
v8.n128_f32[0] = -v9;
return sub_100022980(v10, v7, v8);
}
if ( a1 != BottomRight )
{
LABEL_24:
v7.n128_u32[0] = 0;
goto LABEL_25;
}
v8.n128_f32[0] = -v9;
}
else
{
if ( a1 <= 2 )
{
if ( a1 != 1 )
{
if ( a1 == 2 )
{
v8.n128_f32[0] = -v9;
v7.n128_u32[0] = 0;
LABEL_26:
v10 = v5;
return sub_100022980(v10, v7, v8);
}
goto LABEL_24;
}
v7.n128_u32[0] = 0;
goto LABEL_20;
}
if ( a1 == 3 )
{
v7.n128_f32[0] = -v9;
LABEL_25:
v8.n128_u32[0] = 0;
goto LABEL_26;
}
v8.n128_u32[0] = 0;
}
v10 = v5;
v7.n128_f32[0] = v9;
return sub_100022980(v10, v7, v8);
}