//
// GJRotationControl::onApplyAngle from 0x1401a2640 to 0x1401a284f (527 bytes)
//
// 4 xrefs:
// > EditorUI::keyDown @ 0x1401c1bd3
// > EditorUI::handleAction @ 0x1401c1c73
// > GJRotationControl::init @ 0x1401a24ad
// > ??> @ 0x140919910
//
// 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:27:48 +0000
//
// Hidden C++ exception states: #wind=1
void __fastcall GJRotationControl::onApplyAngle(__int64 a1)
{
__int64 v2; // rax
_BYTE *v3; // rax
size_t v4; // r8
const char *v5; // rcx
float v6; // xmm6_4
float v7; // xmm0_4
float v8; // xmm7_4
float v9; // xmm6_4
__int64 v10; // rcx
__int64 v11; // rdx
char *v12; // rcx
char *String[2]; // [rsp+38h] [rbp-50h] BYREF
__int64 v14; // [rsp+48h] [rbp-40h]
unsigned __int64 v15; // [rsp+50h] [rbp-38h]
v2 = *(_QWORD *)(a1 + 464);
if ( v2 )
{
v3 = (_BYTE *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(*(_QWORD *)(v2 + 592) + 600LL) + 8LL))(*(_QWORD *)(v2 + 592) + 600LL);
*(_OWORD *)String = 0;
v14 = 0;
v15 = 0;
v4 = -1;
do
++v4;
while ( v3[v4] );
sub_14003D230(String, v3, v4);
if ( v14 )
{
v5 = (const char *)String;
if ( v15 > 0xF )
v5 = String[0];
v6 = atof(v5);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 464) + 1032LL))(*(_QWORD *)(a1 + 464), 0);
v7 = fmodf(v6, 360.0);
v8 = v7;
if ( v7 <= 180.0 )
{
if ( v7 <= -180.0 )
v8 = v7 + 360.0;
}
else
{
v8 = v7 + -360.0;
}
v9 = v8 - *(float *)(a1 + 436);
if ( v9 <= 180.0 )
{
if ( v9 <= -180.0 )
v9 = v9 + 360.0;
}
else
{
v9 = v9 + -360.0;
}
if ( v9 != 0.0 )
{
v10 = *(_QWORD *)(a1 + 512);
if ( v10 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v10 + 8LL))(v10);
(***(void (__fastcall ****)(_QWORD, __int64, _QWORD))(a1 + 512))(
*(_QWORD *)(a1 + 512),
v11,
*(unsigned __int8 *)(a1 + 456));
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 512) + 16LL))(*(_QWORD *)(a1 + 512));
}
}
GJRotationControl::setAngle(a1);
}
else
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 464) + 1032LL))(*(_QWORD *)(a1 + 464), 0);
GJRotationControl::updateAngleInput(a1);
}
if ( v15 > 0xF )
{
v12 = String[0];
if ( v15 + 1 >= 0x1000 )
{
v12 = *((char **)String[0] - 1);
if ( (unsigned __int64)(String[0] - v12 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v12);
}
}
}