Advertisement
Martymoose98

MapInstance creation?

Jul 25th, 2022
1,095
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.53 KB | None | 0 0
  1. __int64 __fastcall MapInstance_sub_140835FC0(__int64 *rcx0, _DWORD *a2, int a3)
  2. {
  3.   __int64 result; // rax
  4.   int v4; // esi
  5.   _DWORD *v5; // rdi
  6.   __int64 v6; // rbx
  7.   __int64 v7; // rsi
  8.   __int64 v8; // rsi
  9.   void *v9; // r15
  10.   signed int v10; // xmm6_4
  11.   signed __int64 v11; // rax
  12.   __int64 *v12; // rax
  13.   __int64 *v13; // rdi
  14.   Create_t a1; // [rsp+30h] [rbp-D0h]
  15.   set_info_t set_info; // [rsp+90h] [rbp-70h]
  16.  
  17.   result = *((unsigned int *)rcx0 + 2);
  18.   v4 = a3;
  19.   v5 = a2;
  20.   v6 = (__int64)rcx0;
  21.   if ( *((_DWORD *)rcx0 + 3) != (_DWORD)result || (result = BittestGameFlags(1), (_DWORD)result) || !v4 )
  22.   {
  23.     *(_DWORD *)(v6 + 56) = 5;
  24.   }
  25.   else
  26.   {
  27.     v7 = *(_QWORD *)v6;
  28.     if ( !*(_QWORD *)v6 )
  29.     {
  30.       *(_DWORD *)(v6 + 12) = -1;
  31. LABEL_6:
  32.       *(_DWORD *)(v6 + 56) = 3;
  33.       return result;
  34.     }
  35.     if ( !*(_DWORD *)(v7 + 48) )
  36.       goto LABEL_6;
  37.     v8 = v7 + 8;
  38.     if ( !v8 )
  39.     {
  40.       *(_DWORD *)(v6 + 12) = -1;
  41.       *(_DWORD *)(v6 + 56) = 4;
  42.       return result;
  43.     }
  44.     v9 = (void *)DataFile__sub_14026AC20((_QWORD *)(v8 + 8), "wmb", 0);
  45.     if ( v9 )
  46.     {
  47.       Create_t::Invalidate(&a1);
  48.       Matrix4x4::InitIndentity(&set_info.m_mat);
  49.       v10 = 0;
  50.       Vector3Aligned::sub_7FF696E25E40(&set_info.m_vPosition);
  51.       Vector3Aligned::sub_7FF696E25E40(&set_info.m_vRotation);
  52.       Vector3Aligned::sub_7FF696E25E40(&set_info.m_vScale);
  53.       *(_QWORD *)&set_info.m_dwSetType = 0i64;
  54.       *(_QWORD *)&set_info.m_i0x078 = 0i64;
  55.       set_info.m_i0x080 = -1;
  56.       set_info.m_i0x084 = 0;
  57.       set_info.m_i0x088 = 1;
  58.       set_info.m_i0x08C = -1;
  59.       Vector3Aligned::Copy(&set_info.m_vPosition, (Vector3Aligned *)(v6 + 0x10));
  60.       Vector3Aligned::sub_140265E60((unsigned __int64)&set_info.m_vRotation);
  61.       Vector3Aligned::sub_140265E60((unsigned __int64)&set_info.m_vScale);
  62.       set_info.m_i0x080 = *(_DWORD *)(v6 + 8);
  63.       a1.m_ObjectIds[1] = 0x90001;
  64.       a1.m_pSetInfo = &set_info;
  65.       a1.m_szName = "MapInstance";
  66.       a1.m_ObjectIds[0] = 0x90001;
  67.       a1.m_dwFlags = 0x40000000;
  68.       a1.m_pWMB = v9;
  69.       a1.m_pDatBuffers = (void *)(v8 + 8);
  70.       a1.m_pBXM = (void *)CObjReadManager::Work::QueryFilePointer((__int64 *)(v8 + 8), "ObjectParam.bxm");
  71.       result = (__int64)CSceneEntitySystem::CreateEntity(&g_pSceneEntitySystem, &a1);
  72.       *(_QWORD *)(v6 + 0x28) = result;
  73.       if ( !result )
  74.         return result;
  75.       if ( v5 )
  76.       {
  77.         v11 = 0i64;
  78.         while ( *v5 != -1 )
  79.         {
  80.           ++v11;
  81.           v5 += 3;
  82.           if ( v11 >= 14 )
  83.             goto LABEL_21;
  84.         }
  85.         *v5 = *(_DWORD *)(v6 + 8);
  86.         if ( stru_14102A000.m_ObjectId != 1 || (qword_1410297C0 & 0x80u) != 0i64 )
  87.           v10 = 0x3F800000;
  88.         v5[1] = v10;
  89.         v5[2] = 0;
  90.       }
  91. LABEL_21:
  92.       *(_QWORD *)(v6 + 48) = CEntityInfo::GetParent(*(CEntityInfo **)(v6 + 40));
  93.       *(_DWORD *)(v6 + 32) = 0;
  94.       *(_DWORD *)(v6 + 36) = 1;
  95.       *(_DWORD *)(v6 + 60) = 1;
  96.     }
  97.     if ( ((*(_DWORD *)v8 & 0xF0000) - 0x20000) & 0xFFFDFFFF )
  98.     {
  99.       v12 = sub_1407DA720(*(_DWORD *)v8);
  100.       v13 = v12;
  101.       if ( v12 )
  102.       {
  103.         if ( *(_DWORD *)v12 == 1 )
  104.         {
  105.           Vector3Aligned::Copy((Vector3Aligned *)v12 + 1, (Vector3Aligned *)(v6 + 16));
  106.           *((_DWORD *)v13 + 8) = 0;
  107.           *((_DWORD *)v13 + 10) = 0;
  108.           *((_DWORD *)v13 + 34) = 0;
  109.           *(_DWORD *)v13 = 2;
  110.         }
  111.       }
  112.     }
  113.     result = sub_1403D1A60((__int64)&unk_141274460, v8);
  114.     *(_DWORD *)(v6 + 56) = 3;
  115.   }
  116.   return result;
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement