diff mm7_3.cpp @ 63:a96ebf3123d2

23.01.13 (Rotate)
author Ritor1
date Wed, 23 Jan 2013 13:14:10 +0600
parents 979f13f456dc
children 31feb3432bbd
line wrap: on
line diff
--- a/mm7_3.cpp	Tue Jan 22 17:50:36 2013 +0600
+++ b/mm7_3.cpp	Wed Jan 23 13:14:10 2013 +0600
@@ -9360,166 +9360,36 @@
 }
 
 //----- (00481FC9) --------------------------------------------------------
-int __fastcall sub_481FC9(RenderVertexSoft *_ECX, RenderVertexSoft *a2, RenderVertexSoft *a3, stru148 *a4)
-{
-  __debugbreak();
-  return 0;
-  /*signed int result; // eax@5
-  __int64 v11; // ST08_8@6
-  __int64 v12; // ST08_8@6
-  __int64 v13; // ST08_8@6
-  __int64 v14; // ST08_8@6
-
-  __asm { fld     dword ptr [ecx+8] }
-  _ESI = a2;
-  _EDX = a3;
-  __asm { fcomp   dword ptr [esi+8] }
-  _EDI = a4;
-  __asm { fnstsw  ax }
-  if ( !__SETP__(HIBYTE(_AX) & 0x44, 0) )
-  {
-    __asm
-    {
-      fld     dword ptr [esi+8]
-      fcomp   dword ptr [edx+8]
-      fnstsw  ax
-    }
-    if ( !__SETP__(HIBYTE(_AX) & 0x44, 0) )
-      *(int *)&a4->flags |= 0x10u;
-  }
-  __asm
-  {
-    fld     dword ptr [ecx+0Ch]
-    fsub    dword ptr [esi+0Ch]
-    fstp    [ebp+var_C]
-    fld     dword ptr [ecx+10h]
-    fsub    dword ptr [esi+10h]
-    fstp    [ebp+var_14]
-    fld     dword ptr [ecx+14h]
-    fsub    dword ptr [esi+14h]
-    fstp    [ebp+arg_0]
-    fld     dword ptr [edx+0Ch]
-    fsub    dword ptr [esi+0Ch]
-    fstp    [ebp+var_10]
-    fld     dword ptr [edx+10h]
-    fsub    dword ptr [esi+10h]
-    fstp    [ebp+var_8]
-    fld     dword ptr [edx+14h]
-    fsub    dword ptr [esi+14h]
-    fstp    [ebp+var_4]
-    fld     dword ptr [ecx]
-    fsub    dword ptr [esi]
-    fld     dword ptr [ecx+4]
-    fsub    dword ptr [esi+4]
-    fld     dword ptr [ecx+8]
-    fsub    dword ptr [esi+8]
-    fld     dword ptr [edx]
-    fsub    dword ptr [esi]
-    fld     dword ptr [edx+4]
-    fsub    dword ptr [esi+4]
-    fld     dword ptr [edx+8]
-    fsub    dword ptr [esi+8]
-    fstp    [ebp+arg_4]
-    fld     st
-    fmul    st, st(3)
-    fld     [ebp+arg_4]
-    fmul    st, st(5)
-    fsubp   st(1), st
-    fild    pIndoorCamera->pos.x
-    fsub    dword ptr [esi]
-    fmulp   st(1), st
-    fld     [ebp+arg_4]
-    fmul    st, st(6)
-    fld     st(3)
-    fmul    st, st(5)
-    fsubp   st(1), st
-    fild    pIndoorCamera->pos.y
-    fsub    dword ptr [esi+4]
-    fmulp   st(1), st
-    faddp   st(1), st
-    fld     st(2)
-    fmul    st, st(5)
-    fld     st(2)
-    fmul    st, st(7)
-    fsubp   st(1), st
-    fild    pIndoorCamera->pos.z
-    fsub    dword ptr [esi+8]
-    fmulp   st(1), st
-    faddp   st(1), st
-    fcomp   ds:flt_4D84E8
-    fstp    st
-    fstp    st
-    fstp    st
-    fnstsw  ax
-    fstp    st
-    fstp    st
-  }
-  if ( __SETP__(HIBYTE(_AX) & 0x41, 0) )
-  {
-    __asm
-    {
-      fld     [ebp+var_4]
-      fmul    [ebp+var_14]
-      fld     [ebp+var_8]
-      fmul    [ebp+arg_0]
-      fsubp   st(1), st
-      fstp    [ebp+arg_4]
-      fld     [ebp+arg_4]
-      fadd    ds:flt_4D87D0
-      fstp    [ebp+var_20]
-      fld     [ebp+var_10]
-      fmul    [ebp+arg_0]
-      fld     [ebp+var_4]
-      fmul    [ebp+var_C]
-    }
-    _EDI->v_18.x = v11;
-    __asm
-    {
-      fsubp   st(1), st
-      fstp    [ebp+arg_4]
-      fld     [ebp+arg_4]
-      fadd    ds:flt_4D87D0
-      fstp    [ebp+var_20]
-      fld     [ebp+var_8]
-      fmul    [ebp+var_C]
-      fld     [ebp+var_10]
-      fmul    [ebp+var_14]
-    }
-    _EDI->v_18.y = v12;
-    __asm
-    {
-      fsubp   st(1), st
-      fstp    [ebp+arg_4]
-      fld     [ebp+arg_4]
-      fadd    ds:flt_4D87D0
-      fstp    [ebp+var_20]
-    }
-    _EDI->v_18.z = v13;
-    stru148::_486089_normalize_v_18(_EDI);
-    __asm
-    {
-      fild    dword ptr [edi+18h]
-      fmul    dword ptr [esi+0Ch]
-      fchs
-      fild    dword ptr [edi+1Ch]
-      fmul    dword ptr [esi+10h]
-      fsubp   st(1), st
-      fild    dword ptr [edi+20h]
-      fmul    dword ptr [esi+14h]
-      fsubp   st(1), st
-      fstp    [ebp+arg_4]
-      fld     [ebp+arg_4]
-      fadd    ds:flt_4D87D0
-      fstp    [ebp+var_20]
-    }
-    _EDI->field_24 = v14;
-    result = 1;
-  }
-  else
-  {
-    result = 0;
-  }
-  return result;*/
+int __fastcall sub_481FC9(RenderVertexSoft *a1, RenderVertexSoft *a2, RenderVertexSoft *a3, stru148 *a4)
+{
+  float arg_0, arg_4, var_4, var_8, var_c, var_10, var_14;
+
+  if (a1->vWorldPosition.y == a2->vWorldPosition.y && a2->vWorldPosition.y == a3->vWorldPosition.y)
+    a4->flags |= 0x10;
+  var_c = a1->vWorldViewPosition.x - a2->vWorldViewPosition.x;
+  var_14 = a1->vWorldViewPosition.y - a2->vWorldViewPosition.y;
+  arg_0 = a1->vWorldViewPosition.z - a2->vWorldViewPosition.z;
+  var_10 = a3->vWorldViewPosition.x - a2->vWorldViewPosition.x;
+  var_8 = a3->vWorldViewPosition.y - a2->vWorldViewPosition.y;
+  var_4 = a3->vWorldViewPosition.z - a2->vWorldViewPosition.z;
+  arg_4 = a3->vWorldPosition.y - a2->vWorldPosition.y;
+  if (((a3->vWorldPosition.y - a2->vWorldPosition.y) * (a1->vWorldPosition.x - a2->vWorldPosition.x) - (a3->vWorldPosition.x - a2->vWorldPosition.x) * (a1->vWorldPosition.y - a2->vWorldPosition.y)) * (pIndoorCamera->pos.y - a2->vWorldPosition.z) +
+      ((a3->vWorldPosition.z - a2->vWorldPosition.z) * (a1->vWorldPosition.y - a2->vWorldPosition.y) - (a3->vWorldPosition.y - a2->vWorldPosition.y) * (a1->vWorldPosition.z - a2->vWorldPosition.z)) * (pIndoorCamera->pos.x - a2->vWorldPosition.x) +
+      ((a3->vWorldPosition.x - a2->vWorldPosition.x) * (a1->vWorldPosition.z - a2->vWorldPosition.z) - (a3->vWorldPosition.z - a2->vWorldPosition.z) * (a1->vWorldPosition.x - a2->vWorldPosition.x)) * (pIndoorCamera->pos.z - a2->vWorldPosition.y) < 0)
+  {
+   arg_4 = var_4 * var_14 - var_8 * arg_0;
+   a4->v_18.x = floorf(arg_4 + 0.5f);
+   arg_4 = var_10 * arg_0 - var_4 * var_c;
+   a4->v_18.y = floorf(arg_4 + 0.5f);
+   arg_4 = var_8 * var_c - var_10 * var_14;
+   a4->v_18.z = floorf(arg_4 + 0.5f);
+   a4->_486089_normalize_v_18();
+   arg_4 = -(a4->v_18.x * a2->vWorldViewPosition.x) - a4->v_18.y * a2->vWorldViewPosition.y - a4->v_18.z * a2->vWorldViewPosition.z;
+   a4->field_24 = floorf(arg_4 + 0.5f);
+   return true;
+  }
+  else
+    return false;
 }