SHARE
TWEET

NieR:Automata ExCollision check

a guest Apr 19th, 2019 189 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. BOOL __fastcall ExCollision::check(ExCollision *a1)
  2. {
  3.   ExCollision *v1; // rbx
  4.   BOOL result; // eax
  5.   __int64 pOwner; // rdi
  6.   Vector4 v4; // xmm3
  7.   __m128i v5; // xmm1
  8.   int v6; // ecx
  9.   int v7; // ecx
  10.   int v8; // ecx
  11.   __int64 v9; // rdx
  12.   Vector4 v10; // xmm6
  13.   Vector4 vBonePos; // xmm7
  14.   int bone_index; // eax
  15.   Bone *pBone; // rax
  16.   __m128 v14; // xmm1
  17.   __m128 v15; // xmm0
  18.   __m128 v16; // xmm6
  19.   int v17; // xmm0_4
  20.   __m128 v18; // xmm2
  21.   Vector4 a2; // [rsp+30h] [rbp-48h]
  22.   __m128 v20; // [rsp+40h] [rbp-38h]
  23.   EntityHandle hOwner; // [rsp+88h] [rbp+10h]
  24.  
  25.   v1 = a1;
  26.   if ( (qword_141415BD0 & 0x80000000) != 0i64 || qword_141415BC8 & 0x200000000000i64 || !a1->m_bEnabled || !*(_DWORD *)&a1->gap60[40] || !GetEntityInfoFromHandle(&a1->m_hOwner) )
  27.     return 0;
  28.   hOwner = v1->m_hOwner;
  29.   pOwner = (__int64)GetEntityFromHandleFast(&hOwner);
  30.   if ( !pOwner )
  31.     return 0;
  32.   ExCollision::sub_140135140(v1, &a2);
  33.   v4 = a2;
  34.   if ( (_mm_movemask_ps(_mm_cmpeqps(a2.vec, (__m128)0i64)) & 7) == 7 )
  35.     return 0;
  36.   v5 = _mm_cmpeq_epi32(_mm_and_si128(_mm_load_si128((const __m128i *)&g_vMaxVector), (__m128i)a2), (__m128i)g_vMaxVector);
  37.   if ( _mm_movemask_ps((__m128)_mm_andnot_si128(_mm_cmpeq_epi32(_mm_and_si128(_mm_load_si128((const __m128i *)&stru_140E940C0), (__m128i)a2), (__m128i)stru_140E94130), v5)) & 7 )
  38.     return 0;
  39.   v1->v0xD0 = a2;
  40.   v6 = *(_DWORD *)&v1->gap60[36];
  41.   *(_DWORD *)&v1->gap60[28] = v1->dword110;
  42.   v7 = v6 - 1;
  43.   if ( v7 )
  44.   {
  45.     v8 = v7 - 1;
  46.     if ( !v8 )
  47.     {
  48.       if ( g_qword_1417C0358 )
  49.       {
  50.         result = sub_140896730((__int64)&v1->m_vec0x20, (__int64)g_qword_1417C0358, (__m128 *)&a2, (__int128 *)v5.m128i_i64[0], *(float *)&v1->dwordB0, &v1->gap60[16]);
  51.         v1->dword18 = result;
  52.         return result;
  53.       }
  54.       goto LABEL_26;
  55.     }
  56.     if ( v8 == 1 )
  57.     {
  58.       v9 = (unsigned int)v1->dword88;
  59.       v10 = g_vDefault;
  60.       vBonePos = g_vDefault;
  61.       if ( (_DWORD)v9 == -1 )
  62.       {
  63.         vBonePos = *(Vector4 *)(pOwner + 0x50);
  64.       }
  65.       else
  66.       {
  67.         bone_index = GetBoneIndex((CModelData *)(pOwner + 0x550), v9);
  68.         if ( bone_index >= 0 && bone_index < *(_DWORD *)(pOwner + 0x568) )
  69.         {
  70.           pBone = (Bone *)(*(_QWORD *)(pOwner + 0x560) + 0xB0i64 * bone_index);// bones
  71.           if ( pBone )
  72.             vBonePos = pBone->m_vPosition;
  73.         }
  74.       }
  75.       v14 = _mm_mul_ps(*(__m128 *)&v1->dword98, *(__m128 *)&v1->dword98);
  76.       v15 = _mm_shuffle_ps(v14, v14, 102);
  77.       v14.m128_f32[0] = (float)(v14.m128_f32[0] + v15.m128_f32[0]) + COERCE_FLOAT(_mm_shuffle_ps(v15, v15, 85));
  78.       if ( COERCE_FLOAT(_mm_sqrt_ps(_mm_shuffle_ps(v14, v14, 0))) > 0.0 )
  79.       {
  80.         v16 = *(__m128 *)&v1->dword98;
  81.         v10 = (Vector4)_mm_add_ps(
  82.                          _mm_mul_ps(_mm_shuffle_ps(v16, v16, 170), *(__m128 *)(pOwner + 0xE0)),
  83.                          _mm_add_ps(_mm_mul_ps(_mm_shuffle_ps(v16, v16, 85), *(__m128 *)(pOwner + 0xD0)), _mm_mul_ps(_mm_shuffle_ps(*(__m128 *)&v1->dword98, v16, 0), *(__m128 *)(pOwner + 0xC0))));
  84.       }
  85.       v17 = v1->dwordB0;
  86.       v20 = _mm_add_ps(vBonePos.vec, v10.vec);
  87.       if ( g_qword_1417C0358 )
  88.       {
  89.         result = sub_1408968A0((__int64)g_qword_1417C0358, (__int64)&v1->m_vec0x20, (__int64)&a2, (__int64)&v20, v17, &v1->gap60[16]);
  90.         v1->dword18 = result;
  91.         return result;
  92.       }
  93.       goto LABEL_26;
  94.     }
  95.   }
  96.   else
  97.   {
  98.     v18 = *(__m128 *)&v1->dwordC0;
  99.     v20 = _mm_add_ps(
  100.             _mm_mul_ps(
  101.               _mm_add_ps(
  102.                 _mm_mul_ps(_mm_shuffle_ps(v18, v18, 170), *(__m128 *)(pOwner + 224)),
  103.                 _mm_add_ps(_mm_mul_ps(_mm_shuffle_ps(v18, v18, 85), *(__m128 *)(pOwner + 208)), _mm_mul_ps(_mm_shuffle_ps(*(__m128 *)&v1->dwordC0, v18, 0), *(__m128 *)(pOwner + 192)))),
  104.               _mm_shuffle_ps((__m128)(unsigned int)v1->dwordB0, (__m128)(unsigned int)v1->dwordB0, 0)),
  105.             v4.vec);
  106.     if ( !g_qword_1417C0358 )
  107.     {
  108. LABEL_26:
  109.       result = 0;
  110.       v1->dword18 = 0;
  111.       return result;
  112.     }
  113.     v1->dword18 = sub_1408965C0((__int64)g_qword_1417C0358, (__int64)&v1->m_vec0x20, (__int64)&a2, (__int64)&v20, &v1->gap60[16]);
  114.   }
  115.   return v1->dword18;
  116. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top