{"type": "func", "start": 5371541632, "end": 5371542286, "name": "GJSmartTemplate::smartObjectToType", "pseudocode": "// \n// GJSmartTemplate::smartObjectToType from 0x1402b3880 to 0x1402b3b0e (654 bytes)\n// \n// 13 xrefs:\n// > EditorUI::addObjectsToSmartTemplate @ 0x140115ddc\n// > EditorUI::createSmartObjectsFromTemplate @ 0x140116f6e\n// > EditorUI::createSmartObjectsFromTemplate @ 0x1401170e6\n// > GJSmartTemplate::keyFromNeighbors @ 0x1402b3da6\n// > GJSmartTemplate::keyFromNeighbors @ 0x1402b3db6\n// > GJSmartTemplate::keyFromNeighbors @ 0x1402b3dc5\n// > GJSmartTemplate::keyFromNeighbors @ 0x1402b3dd4\n// > GJSmartTemplate::keyFromNeighbors @ 0x1402b3de3\n// > GJSmartTemplate::keyFromNeighbors @ 0x1402b3df2\n// > GJSmartTemplate::keyFromNeighbors @ 0x1402b3e00\n// > GJSmartTemplate::keyFromNeighbors @ 0x1402b3e0f\n// > GJSmartTemplate::keyFromNeighbors @ 0x1402b3e2b\n// > <???> @ 0x1406d23d8\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\nSmartBlockType GJSmartTemplate::smartObjectToType(SmartGameObject *a1, cocos2d::CCPoint a2)\n{\n  SmartBlockType v4; // ebx\n  int v5; // ecx\n  int v6; // ecx\n  float v7; // xmm0_4\n  bool v8; // dl\n\n  v4 = 48;\n  if ( a1 )\n  {\n    v5 = a1->m_objectID - 2895;\n    if ( v5 )\n    {\n      v6 = v5 - 1;\n      if ( v6 )\n      {\n        if ( v6 == 1 )\n        {\n          v7 = fabs(COERCE_FLOAT(COERCE_UNSIGNED_INT64(((double (__fastcall *)(SmartGameObject *))a1->getRotation)(a1))));\n          v8 = v7 == 90.0 || v7 == 270.0;\n          switch ( a1->m_slopeDirection )\n          {\n            case 0:\n            case 7:\n              v4 = WideSlope1;\n              if ( v8 )\n                v4 = WideSlope9;\n              break;\n            case 1:\n            case 5:\n              v4 = 8 * v8 + 65;\n              break;\n            case 2:\n            case 4:\n              v4 = WideSlope3;\n              if ( v8 )\n                v4 = WideSlope11;\n              break;\n            case 3:\n            case 6:\n              v4 = 8 * v8 + 67;\n              break;\n            default:\n              break;\n          }\n        }\n      }\n      else\n      {\n        switch ( a1->m_slopeDirection )\n        {\n          case 0:\n          case 7:\n            v4 = NormalSlope1;\n            break;\n          case 1:\n          case 5:\n            v4 = NormalSlope3;\n            break;\n          case 2:\n          case 4:\n            v4 = NormalSlope2;\n            break;\n          case 3:\n          case 6:\n            v4 = NormalSlope4;\n            break;\n          default:\n            break;\n        }\n      }\n    }\n    else\n    {\n      v4 = Block;\n    }\n  }\n  if ( !cocos2d::CCPoint::equals(*(const struct cocos2d::CCPoint **)&a2) )\n  {\n    switch ( v4 )\n    {\n      case WideSlope1:\n      case WideSlope5:\n        if ( **(float **)&a2 > a1->getPosition_0(a1)->x )\n        {\n          if ( v4 == WideSlope1 )\n          {\n            v4 = WideSlope2;\n          }\n          else if ( v4 == WideSlope5 )\n          {\n            v4 = WideSlope6;\n          }\n        }\n        break;\n      case WideSlope3:\n      case WideSlope7:\n        if ( a1->getPosition_0(a1)->x > **(float **)&a2 )\n        {\n          if ( v4 == WideSlope3 )\n          {\n            v4 = WideSlope4;\n          }\n          else if ( v4 == WideSlope7 )\n          {\n            v4 = WideSlope8;\n          }\n        }\n        break;\n      case WideSlope9:\n      case WideSlope11:\n        if ( a1->getPosition_0(a1)->y > *(float *)(*(_QWORD *)&a2 + 4LL) )\n        {\n          if ( v4 == WideSlope9 )\n          {\n            v4 = WideSlope10;\n          }\n          else if ( v4 == WideSlope11 )\n          {\n            v4 = WideSlope12;\n          }\n        }\n        break;\n      case WideSlope13:\n      case WideSlope15:\n        if ( *(float *)(*(_QWORD *)&a2 + 4LL) > a1->getPosition_0(a1)->y )\n        {\n          if ( v4 == WideSlope13 )\n          {\n            v4 = WideSlope14;\n          }\n          else if ( v4 == WideSlope15 )\n          {\n            v4 = WideSlope16;\n          }\n        }\n        break;\n      default:\n        return v4;\n    }\n  }\n  return v4;\n}", "assembly": "; \n; GJSmartTemplate::smartObjectToType from 0x1402b3880 to 0x1402b3b0e (654 bytes)\n; \n; 13 xrefs:\n; > EditorUI::addObjectsToSmartTemplate @ 0x140115ddc\n; > EditorUI::createSmartObjectsFromTemplate @ 0x140116f6e\n; > EditorUI::createSmartObjectsFromTemplate @ 0x1401170e6\n; > GJSmartTemplate::keyFromNeighbors @ 0x1402b3da6\n; > GJSmartTemplate::keyFromNeighbors @ 0x1402b3db6\n; > GJSmartTemplate::keyFromNeighbors @ 0x1402b3dc5\n; > GJSmartTemplate::keyFromNeighbors @ 0x1402b3dd4\n; > GJSmartTemplate::keyFromNeighbors @ 0x1402b3de3\n; > GJSmartTemplate::keyFromNeighbors @ 0x1402b3df2\n; > GJSmartTemplate::keyFromNeighbors @ 0x1402b3e00\n; > GJSmartTemplate::keyFromNeighbors @ 0x1402b3e0f\n; > GJSmartTemplate::keyFromNeighbors @ 0x1402b3e2b\n; > <???> @ 0x1406d23d8\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, 0x1402b3880\nmov     [rsp+arg_8], rbp                                               ; +0x5, 0x1402b3885\nmov     [rsp+arg_10], rsi                                              ; +0xa, 0x1402b388a\npush    rdi                                                            ; +0xf, 0x1402b388f\nsub     rsp, 20h                                                       ; +0x10, 0x1402b3890\nlea     rbp, cs:140000000h                                             ; +0x14, 0x1402b3894\nmov     rsi, rdx                                                       ; +0x1b, 0x1402b389b\nmov     rdi, rcx                                                       ; +0x1e, 0x1402b389e\nmov     ebx, 30h ; '0'                                                 ; +0x21, 0x1402b38a1\ntest    rcx, rcx                                                       ; +0x26, 0x1402b38a6\njz      def_1402B3918; jumptable 00000001402B3918 default case         ; +0x29, 0x1402b38a9\nmov     ecx, [rcx+40Ch]                                                ; +0x2f, 0x1402b38af\nsub     ecx, 0B4Fh                                                     ; +0x35, 0x1402b38b5\njz      loc_1402B3988                                                  ; +0x3b, 0x1402b38bb\nsub     ecx, 1                                                         ; +0x41, 0x1402b38c1\njz      loc_1402B3954                                                  ; +0x44, 0x1402b38c4\ncmp     ecx, 1                                                         ; +0x4a, 0x1402b38ca\njnz     def_1402B3918; jumptable 00000001402B3918 default case         ; +0x4d, 0x1402b38cd\nmov     rax, [rdi]                                                     ; +0x53, 0x1402b38d3\nmov     rcx, rdi                                                       ; +0x56, 0x1402b38d6\ncall    qword ptr [rax+158h]                                           ; +0x59, 0x1402b38d9\nandps   xmm0, cs:xmmword_1406243C0                                     ; +0x5f, 0x1402b38df\nucomiss xmm0, cs:dword_140623294                                       ; +0x66, 0x1402b38e6\njp      short loc_1402B38F1                                            ; +0x6d, 0x1402b38ed\njz      short loc_1402B38FC                                            ; +0x6f, 0x1402b38ef\nucomiss xmm0, cs:dword_140623424                                       ; +0x71, 0x1402b38f1\njp      short loc_1402B3900                                            ; +0x78, 0x1402b38f8\njnz     short loc_1402B3900                                            ; +0x7a, 0x1402b38fa\nmov     dl, 1                                                          ; +0x7c, 0x1402b38fc\njmp     short loc_1402B3902                                            ; +0x7e, 0x1402b38fe\nxor     dl, dl                                                         ; +0x80, 0x1402b3900\nmovsxd  rax, dword ptr [rdi+444h]                                      ; +0x82, 0x1402b3902\ncmp     eax, 7; switch 8 cases                                         ; +0x89, 0x1402b3909\nja      short def_1402B3918; jumptable 00000001402B3918 default case   ; +0x8c, 0x1402b390c\nmov     ecx, ss:(jpt_1402B3918 - 140000000h)[rbp+rax*4]                ; +0x8e, 0x1402b390e\nadd     rcx, rbp                                                       ; +0x95, 0x1402b3915\njmp     rcx; switch jump                                               ; +0x98, 0x1402b3918\ntest    dl, dl; jumptable 00000001402B3918 cases 0,7                   ; +0x9a, 0x1402b391a\nmov     ebx, 36h ; '6'                                                 ; +0x9c, 0x1402b391c\nmov     eax, 45h ; 'E'                                                 ; +0xa1, 0x1402b3921\ncmovnz  ebx, eax                                                       ; +0xa6, 0x1402b3926\njmp     short def_1402B3918; jumptable 00000001402B3918 default case   ; +0xa9, 0x1402b3929\ntest    dl, dl; jumptable 00000001402B3918 cases 2,4                   ; +0xab, 0x1402b392b\nmov     ebx, 38h ; '8'                                                 ; +0xad, 0x1402b392d\nmov     eax, 47h ; 'G'                                                 ; +0xb2, 0x1402b3932\ncmovnz  ebx, eax                                                       ; +0xb7, 0x1402b3937\njmp     short def_1402B3918; jumptable 00000001402B3918 default case   ; +0xba, 0x1402b393a\nmovzx   eax, dl; jumptable 00000001402B3918 cases 1,5                  ; +0xbc, 0x1402b393c\nlea     ebx, ds:41h[rax*8]                                             ; +0xbf, 0x1402b393f\njmp     short def_1402B3918; jumptable 00000001402B3918 default case   ; +0xc6, 0x1402b3946\nmovzx   eax, dl; jumptable 00000001402B3918 cases 3,6                  ; +0xc8, 0x1402b3948\nlea     ebx, ds:43h[rax*8]                                             ; +0xcb, 0x1402b394b\njmp     short def_1402B3918; jumptable 00000001402B3918 default case   ; +0xd2, 0x1402b3952\nmovsxd  rax, dword ptr [rdi+444h]                                      ; +0xd4, 0x1402b3954\ncmp     eax, 7; switch 8 cases                                         ; +0xdb, 0x1402b395b\nja      short def_1402B3918; jumptable 00000001402B3918 default case   ; +0xde, 0x1402b395e\nmov     ecx, ss:(jpt_1402B396A - 140000000h)[rbp+rax*4]                ; +0xe0, 0x1402b3960\nadd     rcx, rbp                                                       ; +0xe7, 0x1402b3967\njmp     rcx; switch jump                                               ; +0xea, 0x1402b396a\nmov     ebx, 32h ; '2'; jumptable 00000001402B396A cases 0,7           ; +0xec, 0x1402b396c\njmp     short def_1402B3918; jumptable 00000001402B3918 default case   ; +0xf1, 0x1402b3971\nmov     ebx, 33h ; '3'; jumptable 00000001402B396A cases 2,4           ; +0xf3, 0x1402b3973\njmp     short def_1402B3918; jumptable 00000001402B3918 default case   ; +0xf8, 0x1402b3978\nmov     ebx, 34h ; '4'; jumptable 00000001402B396A cases 1,5           ; +0xfa, 0x1402b397a\njmp     short def_1402B3918; jumptable 00000001402B3918 default case   ; +0xff, 0x1402b397f\nmov     ebx, 35h ; '5'; jumptable 00000001402B396A cases 3,6           ; +0x101, 0x1402b3981\njmp     short def_1402B3918; jumptable 00000001402B3918 default case   ; +0x106, 0x1402b3986\nmov     ebx, 31h ; '1'                                                 ; +0x108, 0x1402b3988\nlea     rdx, stru_1406C1F88; jumptable 00000001402B3918 default case   ; +0x10d, 0x1402b398d\nmov     rcx, rsi                                                       ; +0x114, 0x1402b3994\ncall    cs:?equals@CCPoint@cocos2d@@QEBA_NAEBV12@@Z; cocos2d::CCPoint::equals(cocos2d::CCPoint const &) ; +0x117, 0x1402b3997\ntest    al, al                                                         ; +0x11d, 0x1402b399d\njnz     def_1402B39C5; jumptable 00000001402B39C5 default case, cases 55,57-64,66,68,70,72,74 ; +0x11f, 0x1402b399f\nlea     eax, [rbx-36h]; switch 22 cases                                ; +0x125, 0x1402b39a5\ncmp     eax, 15h                                                       ; +0x128, 0x1402b39a8\nja      def_1402B39C5; jumptable 00000001402B39C5 default case, cases 55,57-64,66,68,70,72,74 ; +0x12b, 0x1402b39ab\ncdqe                                                                   ; +0x131, 0x1402b39b1\nmovzx   eax, ds:(byte_1402B3AF8 - 140000000h)[rax+rbp]                 ; +0x133, 0x1402b39b3\nmov     ecx, ss:(jpt_1402B39C5 - 140000000h)[rbp+rax*4]                ; +0x13b, 0x1402b39bb\nadd     rcx, rbp                                                       ; +0x142, 0x1402b39c2\njmp     rcx; switch jump                                               ; +0x145, 0x1402b39c5\nmov     rax, [rdi]; jumptable 00000001402B39C5 cases 54,65             ; +0x147, 0x1402b39c7\nmov     rcx, rdi                                                       ; +0x14a, 0x1402b39ca\ncall    qword ptr [rax+0C8h]                                           ; +0x14d, 0x1402b39cd\nmovss   xmm0, dword ptr [rsi]                                          ; +0x153, 0x1402b39d3\ncomiss  xmm0, dword ptr [rax]                                          ; +0x157, 0x1402b39d7\njbe     def_1402B39C5; jumptable 00000001402B39C5 default case, cases 55,57-64,66,68,70,72,74 ; +0x15a, 0x1402b39da\ncmp     ebx, 36h ; '6'                                                 ; +0x160, 0x1402b39e0\njz      short loc_1402B39F8                                            ; +0x163, 0x1402b39e3\ncmp     ebx, 41h ; 'A'                                                 ; +0x165, 0x1402b39e5\njnz     def_1402B39C5; jumptable 00000001402B39C5 default case, cases 55,57-64,66,68,70,72,74 ; +0x168, 0x1402b39e8\nmov     ebx, 42h ; 'B'                                                 ; +0x16e, 0x1402b39ee\njmp     def_1402B39C5; jumptable 00000001402B39C5 default case, cases 55,57-64,66,68,70,72,74 ; +0x173, 0x1402b39f3\nmov     ebx, 37h ; '7'                                                 ; +0x178, 0x1402b39f8\njmp     def_1402B39C5; jumptable 00000001402B39C5 default case, cases 55,57-64,66,68,70,72,74 ; +0x17d, 0x1402b39fd\nmov     rax, [rdi]; jumptable 00000001402B39C5 cases 56,67             ; +0x182, 0x1402b3a02\nmov     rcx, rdi                                                       ; +0x185, 0x1402b3a05\ncall    qword ptr [rax+0C8h]                                           ; +0x188, 0x1402b3a08\nmovss   xmm0, dword ptr [rax]                                          ; +0x18e, 0x1402b3a0e\ncomiss  xmm0, dword ptr [rsi]                                          ; +0x192, 0x1402b3a12\njbe     short def_1402B39C5; jumptable 00000001402B39C5 default case, cases 55,57-64,66,68,70,72,74 ; +0x195, 0x1402b3a15\ncmp     ebx, 38h ; '8'                                                 ; +0x197, 0x1402b3a17\njz      short loc_1402B3A28                                            ; +0x19a, 0x1402b3a1a\ncmp     ebx, 43h ; 'C'                                                 ; +0x19c, 0x1402b3a1c\njnz     short def_1402B39C5; jumptable 00000001402B39C5 default case, cases 55,57-64,66,68,70,72,74 ; +0x19f, 0x1402b3a1f\nmov     ebx, 44h ; 'D'                                                 ; +0x1a1, 0x1402b3a21\njmp     short def_1402B39C5; jumptable 00000001402B39C5 default case, cases 55,57-64,66,68,70,72,74 ; +0x1a6, 0x1402b3a26\nmov     ebx, 39h ; '9'                                                 ; +0x1a8, 0x1402b3a28\njmp     short def_1402B39C5; jumptable 00000001402B39C5 default case, cases 55,57-64,66,68,70,72,74 ; +0x1ad, 0x1402b3a2d\nmov     rax, [rdi]; jumptable 00000001402B39C5 cases 69,71             ; +0x1af, 0x1402b3a2f\nmov     rcx, rdi                                                       ; +0x1b2, 0x1402b3a32\ncall    qword ptr [rax+0C8h]                                           ; +0x1b5, 0x1402b3a35\nmovss   xmm0, dword ptr [rax+4]                                        ; +0x1bb, 0x1402b3a3b\ncomiss  xmm0, dword ptr [rsi+4]                                        ; +0x1c0, 0x1402b3a40\njbe     short def_1402B39C5; jumptable 00000001402B39C5 default case, cases 55,57-64,66,68,70,72,74 ; +0x1c4, 0x1402b3a44\ncmp     ebx, 45h ; 'E'                                                 ; +0x1c6, 0x1402b3a46\njz      short loc_1402B3A57                                            ; +0x1c9, 0x1402b3a49\ncmp     ebx, 47h ; 'G'                                                 ; +0x1cb, 0x1402b3a4b\njnz     short def_1402B39C5; jumptable 00000001402B39C5 default case, cases 55,57-64,66,68,70,72,74 ; +0x1ce, 0x1402b3a4e\nmov     ebx, 48h ; 'H'                                                 ; +0x1d0, 0x1402b3a50\njmp     short def_1402B39C5; jumptable 00000001402B39C5 default case, cases 55,57-64,66,68,70,72,74 ; +0x1d5, 0x1402b3a55\nmov     ebx, 46h ; 'F'                                                 ; +0x1d7, 0x1402b3a57\njmp     short def_1402B39C5; jumptable 00000001402B39C5 default case, cases 55,57-64,66,68,70,72,74 ; +0x1dc, 0x1402b3a5c\nmov     rax, [rdi]; jumptable 00000001402B39C5 cases 73,75             ; +0x1de, 0x1402b3a5e\nmov     rcx, rdi                                                       ; +0x1e1, 0x1402b3a61\ncall    qword ptr [rax+0C8h]                                           ; +0x1e4, 0x1402b3a64\nmovss   xmm0, dword ptr [rsi+4]                                        ; +0x1ea, 0x1402b3a6a\ncomiss  xmm0, dword ptr [rax+4]                                        ; +0x1ef, 0x1402b3a6f\njbe     short def_1402B39C5; jumptable 00000001402B39C5 default case, cases 55,57-64,66,68,70,72,74 ; +0x1f3, 0x1402b3a73\ncmp     ebx, 49h ; 'I'                                                 ; +0x1f5, 0x1402b3a75\njz      short loc_1402B3A86                                            ; +0x1f8, 0x1402b3a78\ncmp     ebx, 4Bh ; 'K'                                                 ; +0x1fa, 0x1402b3a7a\njnz     short def_1402B39C5; jumptable 00000001402B39C5 default case, cases 55,57-64,66,68,70,72,74 ; +0x1fd, 0x1402b3a7d\nmov     ebx, 4Ch ; 'L'                                                 ; +0x1ff, 0x1402b3a7f\njmp     short def_1402B39C5; jumptable 00000001402B39C5 default case, cases 55,57-64,66,68,70,72,74 ; +0x204, 0x1402b3a84\nmov     ebx, 4Ah ; 'J'                                                 ; +0x206, 0x1402b3a86\nmov     rbp, [rsp+28h+arg_8]; jumptable 00000001402B39C5 default case, cases 55,57-64,66,68,70,72,74 ; +0x20b, 0x1402b3a8b\nmov     eax, ebx                                                       ; +0x210, 0x1402b3a90\nmov     rbx, [rsp+28h+arg_0]                                           ; +0x212, 0x1402b3a92\nmov     rsi, [rsp+28h+arg_10]                                          ; +0x217, 0x1402b3a97\nadd     rsp, 20h                                                       ; +0x21c, 0x1402b3a9c\npop     rdi                                                            ; +0x220, 0x1402b3aa0\nretn                                                                   ; +0x221, 0x1402b3aa1\nalign 4                                                                ; +0x222, 0x1402b3aa2\ndd offset loc_1402B391A - 140000000h; jump table for switch statement  ; +0x224, 0x1402b3aa4\ndd offset loc_1402B396C - 140000000h; jump table for switch statement  ; +0x244, 0x1402b3ac4\ndd offset loc_1402B39C7 - 140000000h; jump table for switch statement  ; +0x264, 0x1402b3ae4\ndb      0,     4,     1,     4; indirect table for switch statement    ; +0x278, 0x1402b3af8", "xrefs": ["EditorUI::addObjectsToSmartTemplate @ 0x140115ddc", "EditorUI::createSmartObjectsFromTemplate @ 0x140116f6e", "EditorUI::createSmartObjectsFromTemplate @ 0x1401170e6", "GJSmartTemplate::keyFromNeighbors @ 0x1402b3da6", "GJSmartTemplate::keyFromNeighbors @ 0x1402b3db6", "GJSmartTemplate::keyFromNeighbors @ 0x1402b3dc5", "GJSmartTemplate::keyFromNeighbors @ 0x1402b3dd4", "GJSmartTemplate::keyFromNeighbors @ 0x1402b3de3", "GJSmartTemplate::keyFromNeighbors @ 0x1402b3df2", "GJSmartTemplate::keyFromNeighbors @ 0x1402b3e00", "GJSmartTemplate::keyFromNeighbors @ 0x1402b3e0f", "GJSmartTemplate::keyFromNeighbors @ 0x1402b3e2b", "<???> @ 0x1406d23d8"], "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"}