{"type": "func", "start": 5371678400, "end": 5371678791, "name": "LevelEditorLayer::rotationForSlopeNearObject", "pseudocode": "// \n// LevelEditorLayer::rotationForSlopeNearObject from 0x1402d4ec0 to 0x1402d5047 (391 bytes)\n// \n// 6 xrefs:\n// > EditorUI::transformObjectCall_1 @ 0x1401202b9\n// > EditorUI::transformObjectCall_1 @ 0x1401202e8\n// > EditorUI::transformObjectCall_1 @ 0x140120585\n// > EditorUI::transformObjectCall_1 @ 0x140120600\n// > EditorUI::transformObject @ 0x140120a3d\n// > <???> @ 0x1406d2fc0\n// \n// This function is hookable on this platform!\n// \n// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings\n// \n\nfloat LevelEditorLayer::rotationForSlopeNearObject(LevelEditorLayer *a1, GameObject *a2)\n{\n  cocos2d::CCRect *v4; // rax\n  cocos2d::CCArray *v5; // rsi\n  unsigned int v6; // ebx\n  GameObject *v7; // rdi\n  const struct cocos2d::CCRect *v9; // rax\n  int v10; // esi\n  int v11; // eax\n  int v12; // ebx\n  unsigned int m_slopeDirection; // eax\n  unsigned int v14; // eax\n  int v15; // ebx\n  cocos2d::CCRect v16; // [rsp+20h] [rbp-28h] BYREF\n  struct cocos2d::CCRect v17; // [rsp+30h] [rbp-18h] BYREF\n\n  GameObject::updateStartPos(a2);\n  ((void (__fastcall *)(GameObject *, struct cocos2d::CCRect *))a2->getObjectRect)(a2, &v17);\n  v4 = (cocos2d::CCRect *)cocos2d::CCRect::CCRect(&v16, &v17);\n  v5 = LevelEditorLayer::objectsInRect(a1, v4, 1);\n  v6 = 0;\n  if ( !cocos2d::CCArray::count(v5) )\n    return -1.0;\n  while ( 1 )\n  {\n    v7 = (GameObject *)cocos2d::CCArray::objectAtIndex(v5, v6);\n    if ( v7->getType(v7) == Slope )\n      break;\n    if ( ++v6 >= cocos2d::CCArray::count(v5) )\n      return -1.0;\n  }\n  GameObject::determineSlopeDirection(v7);\n  v9 = v7->getObjectRect_0(v7);\n  cocos2d::CCRect::CCRect(&v16, v9);\n  v10 = 106;\n  v11 = (int)(float)(atanf(v16.size.height / v16.size.width) * 57.29578);\n  v12 = -v11;\n  if ( !v7->m_slopeUphill )\n    v12 = v11;\n  m_slopeDirection = v7->m_slopeDirection;\n  if ( m_slopeDirection <= 6 && _bittest(&v10, m_slopeDirection) && !a2->isFlipY(a2)\n    || ((v14 = v7->m_slopeDirection, v14 > 6) || !_bittest(&v10, v14)) && a2->isFlipY(a2) )\n  {\n    if ( v12 <= 0 )\n      v15 = v12 - 180;\n    else\n      v15 = v12 + 180;\n    return (float)(v15 % 360);\n  }\n  return (float)v12;\n}", "assembly": "; \n; LevelEditorLayer::rotationForSlopeNearObject from 0x1402d4ec0 to 0x1402d5047 (391 bytes)\n; \n; 6 xrefs:\n; > EditorUI::transformObjectCall_1 @ 0x1401202b9\n; > EditorUI::transformObjectCall_1 @ 0x1401202e8\n; > EditorUI::transformObjectCall_1 @ 0x140120585\n; > EditorUI::transformObjectCall_1 @ 0x140120600\n; > EditorUI::transformObject @ 0x140120a3d\n; > <???> @ 0x1406d2fc0\n; \n; This function is hookable on this platform!\n; \n; Using BromaIDA 8.0.0 @ https:;github.com/Stazzical/BromaIDA\n; Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https:;github.com/geode-sdk/bindings\n; \n\nmov     [rsp+arg_0], rbx                                               ; +0x0, 0x1402d4ec0\nmov     [rsp+arg_8], rsi                                               ; +0x5, 0x1402d4ec5\nmov     [rsp+arg_10], rdi                                              ; +0xa, 0x1402d4eca\npush    r14                                                            ; +0xf, 0x1402d4ecf\nsub     rsp, 40h                                                       ; +0x11, 0x1402d4ed1\nmov     rbx, rcx                                                       ; +0x15, 0x1402d4ed5\nmov     r14, rdx                                                       ; +0x18, 0x1402d4ed8\nmov     rcx, rdx                                                       ; +0x1b, 0x1402d4edb\ncall    GameObject__updateStartPos                                     ; +0x1e, 0x1402d4ede\nmovss   xmm2, cs:flt_140622C24                                         ; +0x23, 0x1402d4ee3\nlea     rdx, [rsp+48h+var_18]                                          ; +0x2b, 0x1402d4eeb\nmov     rax, [r14]                                                     ; +0x30, 0x1402d4ef0\nmovaps  xmm3, xmm2                                                     ; +0x33, 0x1402d4ef3\nmov     rcx, r14                                                       ; +0x36, 0x1402d4ef6\ncall    qword ptr [rax+488h]                                           ; +0x39, 0x1402d4ef9\nlea     rdx, [rsp+48h+var_18]                                          ; +0x3f, 0x1402d4eff\nlea     rcx, [rsp+48h+var_28]                                          ; +0x44, 0x1402d4f04\ncall    cs:??0CCRect@cocos2d@@QEAA@AEBV01@@Z; cocos2d::CCRect::CCRect(cocos2d::CCRect const &) ; +0x49, 0x1402d4f09\nmov     r8b, 1                                                         ; +0x4f, 0x1402d4f0f\nmov     rcx, rbx                                                       ; +0x52, 0x1402d4f12\nmov     rdx, rax                                                       ; +0x55, 0x1402d4f15\ncall    LevelEditorLayer__objectsInRect                                ; +0x58, 0x1402d4f18\nmov     rcx, rax                                                       ; +0x5d, 0x1402d4f1d\nmov     rsi, rax                                                       ; +0x60, 0x1402d4f20\nxor     ebx, ebx                                                       ; +0x63, 0x1402d4f23\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x65, 0x1402d4f25\ntest    eax, eax                                                       ; +0x6b, 0x1402d4f2b\njz      short loc_1402D4F5E                                            ; +0x6d, 0x1402d4f2d\nnop                                                                    ; +0x6f, 0x1402d4f2f\nmov     edx, ebx                                                       ; +0x70, 0x1402d4f30\nmov     rcx, rsi                                                       ; +0x72, 0x1402d4f32\ncall    cs:?objectAtIndex@CCArray@cocos2d@@QEAAPEAVCCObject@2@I@Z; cocos2d::CCArray::objectAtIndex(uint) ; +0x75, 0x1402d4f35\nmov     rcx, rax                                                       ; +0x7b, 0x1402d4f3b\nmov     rdi, rax                                                       ; +0x7e, 0x1402d4f3e\nmov     rdx, [rax]                                                     ; +0x81, 0x1402d4f41\ncall    qword ptr [rdx+660h]                                           ; +0x84, 0x1402d4f44\ncmp     eax, 19h                                                       ; +0x8a, 0x1402d4f4a\njz      short loc_1402D4F7C                                            ; +0x8d, 0x1402d4f4d\nmov     rcx, rsi                                                       ; +0x8f, 0x1402d4f4f\ninc     ebx                                                            ; +0x92, 0x1402d4f52\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x94, 0x1402d4f54\ncmp     ebx, eax                                                       ; +0x9a, 0x1402d4f5a\njb      short loc_1402D4F30                                            ; +0x9c, 0x1402d4f5c\nmovss   xmm0, cs:dword_1406236F0                                       ; +0x9e, 0x1402d4f5e\nmov     rbx, [rsp+48h+arg_0]                                           ; +0xa6, 0x1402d4f66\nmov     rsi, [rsp+48h+arg_8]                                           ; +0xab, 0x1402d4f6b\nmov     rdi, [rsp+48h+arg_10]                                          ; +0xb0, 0x1402d4f70\nadd     rsp, 40h                                                       ; +0xb5, 0x1402d4f75\npop     r14                                                            ; +0xb9, 0x1402d4f79\nretn                                                                   ; +0xbb, 0x1402d4f7b\nmov     rcx, rdi                                                       ; +0xbc, 0x1402d4f7c\ncall    GameObject__determineSlopeDirection                            ; +0xbf, 0x1402d4f7f\nmov     rax, [rdi]                                                     ; +0xc4, 0x1402d4f84\nmov     rcx, rdi                                                       ; +0xc7, 0x1402d4f87\ncall    qword ptr [rax+490h]                                           ; +0xca, 0x1402d4f8a\nmov     rdx, rax                                                       ; +0xd0, 0x1402d4f90\nlea     rcx, [rsp+48h+var_28]                                          ; +0xd3, 0x1402d4f93\ncall    cs:??0CCRect@cocos2d@@QEAA@AEBV01@@Z; cocos2d::CCRect::CCRect(cocos2d::CCRect const &) ; +0xd8, 0x1402d4f98\nmovss   xmm0, [rsp+48h+var_1C]                                         ; +0xde, 0x1402d4f9e\ndivss   xmm0, [rsp+48h+var_20]; X                                      ; +0xe4, 0x1402d4fa4\ncall    atanf                                                          ; +0xea, 0x1402d4faa\nmulss   xmm0, cs:dword_140623200                                       ; +0xef, 0x1402d4faf\nmov     esi, 6Ah ; 'j'                                                 ; +0xf7, 0x1402d4fb7\ncvttss2si eax, xmm0                                                    ; +0xfc, 0x1402d4fbc\nmov     ebx, eax                                                       ; +0x100, 0x1402d4fc0\nneg     ebx                                                            ; +0x102, 0x1402d4fc2\ncmp     byte ptr [rdi+440h], 0                                         ; +0x104, 0x1402d4fc4\ncmovz   ebx, eax                                                       ; +0x10b, 0x1402d4fcb\nmov     eax, [rdi+444h]                                                ; +0x10e, 0x1402d4fce\ncmp     eax, 6                                                         ; +0x114, 0x1402d4fd4\nja      short loc_1402D4FEE                                            ; +0x117, 0x1402d4fd7\nbt      esi, eax                                                       ; +0x119, 0x1402d4fd9\njnb     short loc_1402D4FEE                                            ; +0x11c, 0x1402d4fdc\nmov     rax, [r14]                                                     ; +0x11e, 0x1402d4fde\nmov     rcx, r14                                                       ; +0x121, 0x1402d4fe1\ncall    qword ptr [rax+4F0h]                                           ; +0x124, 0x1402d4fe4\ntest    al, al                                                         ; +0x12a, 0x1402d4fea\njz      short loc_1402D500E                                            ; +0x12c, 0x1402d4fec\nmov     eax, [rdi+444h]                                                ; +0x12e, 0x1402d4fee\ncmp     eax, 6                                                         ; +0x134, 0x1402d4ff4\nja      short loc_1402D4FFE                                            ; +0x137, 0x1402d4ff7\nbt      esi, eax                                                       ; +0x139, 0x1402d4ff9\njb      short loc_1402D503B                                            ; +0x13c, 0x1402d4ffc\nmov     rax, [r14]                                                     ; +0x13e, 0x1402d4ffe\nmov     rcx, r14                                                       ; +0x141, 0x1402d5001\ncall    qword ptr [rax+4F0h]                                           ; +0x144, 0x1402d5004\ntest    al, al                                                         ; +0x14a, 0x1402d500a\njz      short loc_1402D503B                                            ; +0x14c, 0x1402d500c\nmov     eax, 0B60B60B7h                                                ; +0x14e, 0x1402d500e\ntest    ebx, ebx                                                       ; +0x153, 0x1402d5013\njle     short loc_1402D501F                                            ; +0x155, 0x1402d5015\nadd     ebx, 0B4h                                                      ; +0x157, 0x1402d5017\njmp     short loc_1402D5025                                            ; +0x15d, 0x1402d501d\nadd     ebx, 0FFFFFF4Ch                                                ; +0x15f, 0x1402d501f\nimul    ebx                                                            ; +0x165, 0x1402d5025\nadd     edx, ebx                                                       ; +0x167, 0x1402d5027\nsar     edx, 8                                                         ; +0x169, 0x1402d5029\nmov     eax, edx                                                       ; +0x16c, 0x1402d502c\nshr     eax, 1Fh                                                       ; +0x16e, 0x1402d502e\nadd     edx, eax                                                       ; +0x171, 0x1402d5031\nimul    eax, edx, 168h                                                 ; +0x173, 0x1402d5033\nsub     ebx, eax                                                       ; +0x179, 0x1402d5039\nmovd    xmm0, ebx                                                      ; +0x17b, 0x1402d503b\ncvtdq2ps xmm0, xmm0                                                    ; +0x17f, 0x1402d503f\njmp     loc_1402D4F66                                                  ; +0x182, 0x1402d5042", "xrefs": ["EditorUI::transformObjectCall_1 @ 0x1401202b9", "EditorUI::transformObjectCall_1 @ 0x1401202e8", "EditorUI::transformObjectCall_1 @ 0x140120585", "EditorUI::transformObjectCall_1 @ 0x140120600", "EditorUI::transformObject @ 0x140120a3d", "<???> @ 0x1406d2fc0"], "is_objc": false, "is_arm32": false, "is_arm64": false, "bida_info": "8.0.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings"}