{"type": "func", "start": 5372842064, "end": 5372842473, "name": "LevelEditorLayer::rotationForSlopeNearObject", "pseudocode": "// \n// LevelEditorLayer::rotationForSlopeNearObject from 0x1403f1050 to 0x1403f11e9 (409 bytes)\n// \n// 10 xrefs:\n// > EditorUI::handleEditorAction @ 0x1401c4015\n// > EditorUI::handleEditorAction @ 0x1401c4044\n// > EditorUI::handleEditorAction @ 0x1401c40d5\n// > EditorUI::handleEditorAction @ 0x1401c4104\n// > EditorUI::transformObjectCall_1 @ 0x1401ff4a5\n// > EditorUI::transformObjectCall_1 @ 0x1401ff4d8\n// > EditorUI::transformObjectCall_1 @ 0x1401ff6f5\n// > EditorUI::transformObjectCall_1 @ 0x1401ff780\n// > EditorUI::transformObject @ 0x1401ffc2d\n// > <???> @ 0x14092534c\n// \n// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n// \n// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n// Generated at Fri, 27 Nov 2026 11:31:47 +0000\n// \n\nfloat __fastcall LevelEditorLayer::rotationForSlopeNearObject(__int64 a1, __int64 a2)\n{\n  __int64 v4; // rax\n  __int64 v5; // r8\n  cocos2d::CCArray *v6; // rsi\n  unsigned int v7; // ebx\n  struct cocos2d::CCObject *v8; // rdi\n  const struct cocos2d::CCRect *v10; // rax\n  float v11; // xmm0_4\n  int v12; // ecx\n  int v13; // ebx\n  int v14; // ecx\n  int v15; // ebx\n  _BYTE v16[8]; // [rsp+20h] [rbp-28h] BYREF\n  float v17; // [rsp+28h] [rbp-20h]\n  float v18; // [rsp+2Ch] [rbp-1Ch]\n  _BYTE v19[24]; // [rsp+30h] [rbp-18h] BYREF\n\n  GameObject::updateStartPos(a2);\n  (*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)a2 + 1176LL))(a2, v19);\n  v4 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)v16, (const struct cocos2d::CCRect *)v19);\n  LOBYTE(v5) = 1;\n  v6 = (cocos2d::CCArray *)LevelEditorLayer::objectsInRect(a1, v4, v5);\n  v7 = 0;\n  if ( !cocos2d::CCArray::count(v6) )\n    return -1.0;\n  while ( 1 )\n  {\n    v8 = cocos2d::CCArray::objectAtIndex(v6, v7);\n    if ( (*(unsigned int (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v8 + 1648LL))(v8) == 25 )\n      break;\n    if ( ++v7 >= cocos2d::CCArray::count(v6) )\n      return -1.0;\n  }\n  GameObject::determineSlopeDirection((__int64)v8);\n  v10 = (const struct cocos2d::CCRect *)(*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v8 + 1184LL))(v8);\n  cocos2d::CCRect::CCRect((cocos2d::CCRect *)v16, v10);\n  v11 = atanf(v18 / v17);\n  v12 = *((_DWORD *)v8 + 273);\n  v13 = -(int)(float)(v11 * 57.29578);\n  if ( !*((_BYTE *)v8 + 1088) )\n    v13 = (int)(float)(v11 * 57.29578);\n  if ( (v12 == 1 || ((v12 - 3) & 0xFFFFFFFC) == 0 && v12 != 4)\n    && !(*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)a2 + 1280LL))(a2)\n    || (v14 = *((_DWORD *)v8 + 273), v14 != 1)\n    && (((v14 - 3) & 0xFFFFFFFC) != 0 || v14 == 4)\n    && (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)a2 + 1280LL))(a2) )\n  {\n    if ( v13 <= 0 )\n      v15 = v13 - 180;\n    else\n      v15 = v13 + 180;\n    return (float)(v15 % 360);\n  }\n  return (float)v13;\n}", "assembly": "; \n; LevelEditorLayer::rotationForSlopeNearObject from 0x1403f1050 to 0x1403f11e9 (409 bytes)\n; \n; 10 xrefs:\n; > EditorUI::handleEditorAction @ 0x1401c4015\n; > EditorUI::handleEditorAction @ 0x1401c4044\n; > EditorUI::handleEditorAction @ 0x1401c40d5\n; > EditorUI::handleEditorAction @ 0x1401c4104\n; > EditorUI::transformObjectCall_1 @ 0x1401ff4a5\n; > EditorUI::transformObjectCall_1 @ 0x1401ff4d8\n; > EditorUI::transformObjectCall_1 @ 0x1401ff6f5\n; > EditorUI::transformObjectCall_1 @ 0x1401ff780\n; > EditorUI::transformObject @ 0x1401ffc2d\n; > <???> @ 0x14092534c\n; \n; This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n; \n; Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n; Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n; Generated at Fri, 27 Nov 2026 11:31:47 +0000\n; \nmov     [rsp+arg_0], rbx                                               ; +0x0, 0x1403f1050\nmov     [rsp+arg_8], rsi                                               ; +0x5, 0x1403f1055\nmov     [rsp+arg_10], rdi                                              ; +0xa, 0x1403f105a\npush    r14                                                            ; +0xf, 0x1403f105f\nsub     rsp, 40h                                                       ; +0x11, 0x1403f1061\nmov     rbx, rcx                                                       ; +0x15, 0x1403f1065\nmov     r14, rdx                                                       ; +0x18, 0x1403f1068\nmov     rcx, rdx                                                       ; +0x1b, 0x1403f106b\ncall    GameObject__updateStartPos                                     ; +0x1e, 0x1403f106e\nmovss   xmm2, cs:flt_140835080                                         ; +0x23, 0x1403f1073\nlea     rdx, [rsp+48h+var_18]                                          ; +0x2b, 0x1403f107b\nmov     rax, [r14]                                                     ; +0x30, 0x1403f1080\nmovaps  xmm3, xmm2                                                     ; +0x33, 0x1403f1083\nmov     rcx, r14                                                       ; +0x36, 0x1403f1086\ncall    qword ptr [rax+498h]                                           ; +0x39, 0x1403f1089\nlea     rdx, [rsp+48h+var_18]                                          ; +0x3f, 0x1403f108f\nlea     rcx, [rsp+48h+var_28]                                          ; +0x44, 0x1403f1094\ncall    cs:??0CCRect@cocos2d@@QEAA@AEBV01@@Z; cocos2d::CCRect::CCRect(cocos2d::CCRect const &) ; +0x49, 0x1403f1099\nmov     r8b, 1                                                         ; +0x4f, 0x1403f109f\nmov     rcx, rbx                                                       ; +0x52, 0x1403f10a2\nmov     rdx, rax                                                       ; +0x55, 0x1403f10a5\ncall    LevelEditorLayer__objectsInRect                                ; +0x58, 0x1403f10a8\nmov     rcx, rax                                                       ; +0x5d, 0x1403f10ad\nmov     rsi, rax                                                       ; +0x60, 0x1403f10b0\nxor     ebx, ebx                                                       ; +0x63, 0x1403f10b3\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x65, 0x1403f10b5\ntest    eax, eax                                                       ; +0x6b, 0x1403f10bb\njz      short loc_1403F10F1                                            ; +0x6d, 0x1403f10bd\nnop                                                                    ; +0x6f, 0x1403f10bf\nmov     edx, ebx                                                       ; +0x70, 0x1403f10c0\nmov     rcx, rsi                                                       ; +0x72, 0x1403f10c2\ncall    cs:?objectAtIndex@CCArray@cocos2d@@QEAAPEAVCCObject@2@I@Z; cocos2d::CCArray::objectAtIndex(uint) ; +0x75, 0x1403f10c5\nmov     rdi, rax                                                       ; +0x7b, 0x1403f10cb\nmov     rcx, [rax]                                                     ; +0x7e, 0x1403f10ce\nmov     rdx, [rcx+670h]                                                ; +0x81, 0x1403f10d1\nmov     rcx, rax                                                       ; +0x88, 0x1403f10d8\ncall    rdx                                                            ; +0x8b, 0x1403f10db\ncmp     eax, 19h                                                       ; +0x8d, 0x1403f10dd\njz      short loc_1403F110F                                            ; +0x90, 0x1403f10e0\nmov     rcx, rsi                                                       ; +0x92, 0x1403f10e2\ninc     ebx                                                            ; +0x95, 0x1403f10e5\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x97, 0x1403f10e7\ncmp     ebx, eax                                                       ; +0x9d, 0x1403f10ed\njb      short loc_1403F10C0                                            ; +0x9f, 0x1403f10ef\nmovss   xmm0, cs:dword_140835C90                                       ; +0xa1, 0x1403f10f1\nmov     rbx, [rsp+48h+arg_0]                                           ; +0xa9, 0x1403f10f9\nmov     rsi, [rsp+48h+arg_8]                                           ; +0xae, 0x1403f10fe\nmov     rdi, [rsp+48h+arg_10]                                          ; +0xb3, 0x1403f1103\nadd     rsp, 40h                                                       ; +0xb8, 0x1403f1108\npop     r14                                                            ; +0xbc, 0x1403f110c\nretn                                                                   ; +0xbe, 0x1403f110e\nmov     rcx, rdi                                                       ; +0xbf, 0x1403f110f\ncall    GameObject__determineSlopeDirection                            ; +0xc2, 0x1403f1112\nmov     rax, [rdi]                                                     ; +0xc7, 0x1403f1117\nmov     rcx, rdi                                                       ; +0xca, 0x1403f111a\ncall    qword ptr [rax+4A0h]                                           ; +0xcd, 0x1403f111d\nmov     rdx, rax                                                       ; +0xd3, 0x1403f1123\nlea     rcx, [rsp+48h+var_28]                                          ; +0xd6, 0x1403f1126\ncall    cs:??0CCRect@cocos2d@@QEAA@AEBV01@@Z; cocos2d::CCRect::CCRect(cocos2d::CCRect const &) ; +0xdb, 0x1403f112b\nmovss   xmm0, [rsp+48h+var_1C]                                         ; +0xe1, 0x1403f1131\ndivss   xmm0, [rsp+48h+var_20]; X                                      ; +0xe7, 0x1403f1137\ncall    atanf                                                          ; +0xed, 0x1403f113d\nmulss   xmm0, cs:dword_1408356D4                                       ; +0xf2, 0x1403f1142\nmov     ecx, [rdi+444h]                                                ; +0xfa, 0x1403f114a\ncvttss2si eax, xmm0                                                    ; +0x100, 0x1403f1150\nmov     ebx, eax                                                       ; +0x104, 0x1403f1154\nneg     ebx                                                            ; +0x106, 0x1403f1156\ncmp     byte ptr [rdi+440h], 0                                         ; +0x108, 0x1403f1158\ncmovz   ebx, eax                                                       ; +0x10f, 0x1403f115f\ncmp     ecx, 1                                                         ; +0x112, 0x1403f1162\njz      short loc_1403F1176                                            ; +0x115, 0x1403f1165\nlea     eax, [rcx-3]                                                   ; +0x117, 0x1403f1167\ntest    eax, 0FFFFFFFCh                                                ; +0x11a, 0x1403f116a\njnz     short loc_1403F1186                                            ; +0x11f, 0x1403f116f\ncmp     ecx, 4                                                         ; +0x121, 0x1403f1171\njz      short loc_1403F1186                                            ; +0x124, 0x1403f1174\nmov     rax, [r14]                                                     ; +0x126, 0x1403f1176\nmov     rcx, r14                                                       ; +0x129, 0x1403f1179\ncall    qword ptr [rax+500h]                                           ; +0x12c, 0x1403f117c\ntest    al, al                                                         ; +0x132, 0x1403f1182\njz      short loc_1403F11B0                                            ; +0x134, 0x1403f1184\nmov     ecx, [rdi+444h]                                                ; +0x136, 0x1403f1186\ncmp     ecx, 1                                                         ; +0x13c, 0x1403f118c\njz      short loc_1403F11DD                                            ; +0x13f, 0x1403f118f\nlea     eax, [rcx-3]                                                   ; +0x141, 0x1403f1191\ntest    eax, 0FFFFFFFCh                                                ; +0x144, 0x1403f1194\njnz     short loc_1403F11A0                                            ; +0x149, 0x1403f1199\ncmp     ecx, 4                                                         ; +0x14b, 0x1403f119b\njnz     short loc_1403F11DD                                            ; +0x14e, 0x1403f119e\nmov     rax, [r14]                                                     ; +0x150, 0x1403f11a0\nmov     rcx, r14                                                       ; +0x153, 0x1403f11a3\ncall    qword ptr [rax+500h]                                           ; +0x156, 0x1403f11a6\ntest    al, al                                                         ; +0x15c, 0x1403f11ac\njz      short loc_1403F11DD                                            ; +0x15e, 0x1403f11ae\nmov     eax, 0B60B60B7h                                                ; +0x160, 0x1403f11b0\ntest    ebx, ebx                                                       ; +0x165, 0x1403f11b5\njle     short loc_1403F11C1                                            ; +0x167, 0x1403f11b7\nadd     ebx, 0B4h                                                      ; +0x169, 0x1403f11b9\njmp     short loc_1403F11C7                                            ; +0x16f, 0x1403f11bf\nadd     ebx, 0FFFFFF4Ch                                                ; +0x171, 0x1403f11c1\nimul    ebx                                                            ; +0x177, 0x1403f11c7\nadd     edx, ebx                                                       ; +0x179, 0x1403f11c9\nsar     edx, 8                                                         ; +0x17b, 0x1403f11cb\nmov     eax, edx                                                       ; +0x17e, 0x1403f11ce\nshr     eax, 1Fh                                                       ; +0x180, 0x1403f11d0\nadd     edx, eax                                                       ; +0x183, 0x1403f11d3\nimul    eax, edx, 168h                                                 ; +0x185, 0x1403f11d5\nsub     ebx, eax                                                       ; +0x18b, 0x1403f11db\nmovd    xmm0, ebx                                                      ; +0x18d, 0x1403f11dd\ncvtdq2ps xmm0, xmm0                                                    ; +0x191, 0x1403f11e1\njmp     loc_1403F10F9                                                  ; +0x194, 0x1403f11e4", "xrefs": ["EditorUI::handleEditorAction @ 0x1401c4015", "EditorUI::handleEditorAction @ 0x1401c4044", "EditorUI::handleEditorAction @ 0x1401c40d5", "EditorUI::handleEditorAction @ 0x1401c4104", "EditorUI::transformObjectCall_1 @ 0x1401ff4a5", "EditorUI::transformObjectCall_1 @ 0x1401ff4d8", "EditorUI::transformObjectCall_1 @ 0x1401ff6f5", "EditorUI::transformObjectCall_1 @ 0x1401ff780", "EditorUI::transformObject @ 0x1401ffc2d", "<???> @ 0x14092534c"], "is_objc": false, "is_32_bit": false, "is_64_bit": true, "idp_name": "pc", "bida_info": "8.3.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings"}