changeset 678:35a97ce58790

fixed stru10::49C9E3 (cause for attempting to get cross product on zero vectors)
author Nomad
date Fri, 15 Mar 2013 15:58:18 +0200
parents 551f74425b17
children 0f25d026acfa c0bfb386b15f
files Indoor.cpp stru10.cpp
diffstat 2 files changed, 329 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/Indoor.cpp	Fri Mar 15 04:17:54 2013 +0200
+++ b/Indoor.cpp	Fri Mar 15 15:58:18 2013 +0200
@@ -1319,9 +1319,9 @@
         nodes[num_nodes].uViewportY = pBLVRenderParams->uViewportY;
         nodes[num_nodes].uViewportW = pBLVRenderParams->uViewportW;
         nodes[num_nodes++].field_C._43F9E1(pBLVRenderParams->uViewportX,
-                                             pBLVRenderParams->uViewportY,
-                                             pBLVRenderParams->uViewportZ,
-                                             pBLVRenderParams->uViewportW);
+                                           pBLVRenderParams->uViewportY,
+                                           pBLVRenderParams->uViewportZ,
+                                           pBLVRenderParams->uViewportW);
         AddBspNodeToRenderList(num_nodes - 1);
         return;
       }
--- a/stru10.cpp	Fri Mar 15 04:17:54 2013 +0200
+++ b/stru10.cpp	Fri Mar 15 15:58:18 2013 +0200
@@ -599,7 +599,7 @@
   if (pFace->uAttributes & 0x0100)
   {
     /*arg_4 = ([2].x + [0].x) * flt_4D84F0
-    var_18 = ([3].y + [1].y) * flt_4D84F0
+      var_18 = ([3].y + [1].y) * flt_4D84F0
 
       fld     dword ptr [ecx+94h]
       fadd    dword ptr [ecx+34h]
@@ -666,29 +666,341 @@
   //_EBX = arg0;
   //v15 = v31;
   //v16 = arg0;
-  float var_20 = var_8 * var_24;
-  var_8 = a3 * a1.z;
-  float arg_0 = var_8 + var_4;
+  //float var_20 = var_8 * var_24;
+  //var_8 = a3 * a1.z;
+  //float arg_0 = var_8 + var_4;
+
+/*
+
+
+
+.text:0049CBB3   fld     [ebp+var_8]			0	var8
+.text:0049CBB6 1 fmul    ds:flt_4D84E8			0	var8 * flt_4D84E8
+
+.text:0049CBBC 1 fld     [ebp+var_8]			0	var8
+							1	var8 * flt_4D84E8
+
+.text:0049CBBF 2 fmul    [ebp+var_28]			0	var8 * var28
+							1	var8 * flt_4D84E8
+
+.text:0049CBC2 2 fld     [ebp+var_8]			0	var8
+							1	var8 * var28
+							2	var8 * flt_4D84E8
+
+.text:0049CBC5 3 fmul    [ebp+var_24]			0	var8 * var24		768
+							1	var8 * var28		0
+							2	var8 * flt_4D84E8	0
+
+.text:0049CBD5 3 fst     [ebp+var_20]			0	var8 * var24		768
+							1	var8 * var28		0
+							2	var8 * flt_4D84E8	0
+					[var20]	var8 * var24	768
+
+.text:0049CBD8 3 fld     [ebp+a3]			0	a3			-1984
+							1	var8 * var24		768
+							2	var8 * var28		0
+							3	var8 * flt_4D84E8	0
+
+.text:0049CBDB 4 fmul    [ebp+a1.x]			0	a3 * a1.x		1984
+							1	var8 * var24		768
+							2	var8 * var28		0
+							3	var8 * flt_4D84E8	0
+
+.text:0049CBDE 4 fld     [ebp+a3]			0	a3
+							1	a3 * a1.x		1984
+							2	var8 * var24		768
+							3	var8 * var28		0
+							4	var8 * flt_4D84E8	0
+
+.text:0049CBE1 5 fmul    [ebp+a1.y]			0	a3 * a1.y		0
+							1	a3 * a1.x		1984
+							2	var8 * var24		768
+							3	var8 * var28		0
+							4	var8 * flt_4D84E8	0
+.text:0049CBE4 5 fld     [ebp+a3]
+.text:0049CBE7 6 fmul    [ebp+a1.z]			0	a3 * a1.z		0
+							1	a3 * a1.y		0
+							2	a3 * a1.x		1984
+							3	var8 * var24		768
+							4	var8 * var28		0
+							5	var8 * flt_4D84E8	0
+
+.text:0049CBEC 6 fstp    [ebp+var_8]
+					var8 <- a3 * a1.z	0
+
+.text:0049CBEF 5 fld     [ebp+arg4]			0	arg4			-1700
+							1	a3 * a1.y		0
+							2	a3 * a1.x		1984
+							3	var8 * var24		768
+							4	var8 * var28		0
+							5	var8 * flt_4D84E8	0
+
+.text:0049CBF2 6 fsub    st, st(2)			0	arg4 - a3 * a1.x	-3684
+							1	a3 * a1.y		0
+							2	a3 * a1.x		1984
+							3	var8 * var24		768
+							4	var8 * var28		0
+							5	var8 * flt_4D84E8	0
+
+.text:0049CBF4 6 fld     st				0	arg4 - a3 * a1.x	-3684
+							1	arg4 - a3 * a1.x	-3684
+							2	a3 * a1.y		0
+							3	a3 * a1.x		1984
+							4	var8 * var24		768
+							5	var8 * var28		0
+							6	var8 * flt_4D84E8	0
+
+.text:0049CBF6 7 fadd    st, st(6)			0	arg4 - a3 * a1.x + var8 * flt_4D84E8	-3684
+							1	arg4 - a3 * a1.x			-3684
+							2	a3 * a1.y				0
+							3	a3 * a1.x				1984
+							4	var8 * var24				768
+							5	var8 * var28				0
+							6	var8 * flt_4D84E8			0
+.text:0049CBF8 7 fstp    dword ptr [ebx]
+			[0].x <- arg4 - a3 * a1.x + var8 * flt_4D84E8		-3684
+
+.text:0049CBFA 6 fld     [ebp+var_18]			0	var18					1480
+							1	arg4 - a3 * a1.x			-3684
+							2	a3 * a1.y				0
+							3	a3 * a1.x				1984
+							4	var8 * var24				768
+							5	var8 * var28				0
+							6	var8 * flt_4D84E8			0
+
+.text:0049CBFD 7 fsub    st, st(2)			0	var18 - a3 * a1.y			1480
+							1	arg4 - a3 * a1.x			-3684
+							2	a3 * a1.y				0
+							3	a3 * a1.x				1984
+							4	var8 * var24				768
+							5	var8 * var28				0
+							6	var8 * flt_4D84E8			0
+
+.text:0049CBFF 7 fld     st				0	var18 - a3 * a1.y			1480
+							1	var18 - a3 * a1.y			1480
+							2	arg4 - a3 * a1.x			-3684
+							3	a3 * a1.y				0
+							4	a3 * a1.x				1984
+							5	var8 * var24				768
+							6	var8 * var28				0
+							7	var8 * flt_4D84E8			0
+
+.text:0049CC01 8 fadd    st, st(6)			0	var18 - a3 * a1.y + var8 * var28	1480
+							1	var18 - a3 * a1.y			1480
+							2	arg4 - a3 * a1.x			-3684
+							3	a3 * a1.y				0
+							4	a3 * a1.x				1984
+							5	var8 * var24				768
+							6	var8 * var28				0
+							7	var8 * flt_4D84E8			0
+
+.text:0049CC03 8 fstp    dword ptr [ebx+4]
+			[0].y <- var18 - a3 * a1.y + var8 * var28		1480
+
+.text:0049CC06 7 fld     [ebp+var_4]
+.text:0049CC09 8 fsub    [ebp+var_8]			0	var4 - a3 * a1.z			768
+							1	var18 - a3 * a1.y			1480
+							2	arg4 - a3 * a1.x			-3684
+							3	a3 * a1.y				0
+							4	a3 * a1.x				1984
+							5	var8 * var24				768
+							6	var8 * var28				0
+							7	var8 * flt_4D84E8			0
+.text:0049CC0C 8 fst     [ebp+a3]
+			a3 <- var4 - a3 * a1.z	768
+
+.text:0049CC0F 8 fadd    st, st(5)
+.text:0049CC11 8 fstp    dword ptr [ebx+8]
+			[0].z <- var4 - a3 * a1.z + var8 * var24	1536
+
+							0	var18 - a3 * a1.y			1480
+							1	arg4 - a3 * a1.x			-3684
+							2	a3 * a1.y				0
+							3	a3 * a1.x				1984
+							4	var8 * var24				768
+							5	var8 * var28				0
+							6	var8 * flt_4D84E8			0
+
+
+
+
+						[var20]	var8 * var24		768
+						[var8]	a3 * a1.z
+						[a3]	var4 - a3 * a1.z	768
+
+
+.text:0049CC14 7 fld     st(1)
+.text:0049CC16 8 fsub    st, st(7)			0	arg4 - a3 * a1.x - var8 * flt_4D84E8	-3684
+							1	var18 - a3 * a1.y			1480
+							2	arg4 - a3 * a1.x			-3684
+							3	a3 * a1.y				0
+							4	a3 * a1.x				1984
+							5	var8 * var24				768
+							6	var8 * var28				0
+							7	var8 * flt_4D84E8			0
+.text:0049CC18 8 fstp    dword ptr [ebx+30h]
+				[1].x <- arg4 - a3 * a1.x - var8 * flt_4D84E8		-3684
+
+							0	var18 - a3 * a1.y			1480
+							1	arg4 - a3 * a1.x			-3684
+							2	a3 * a1.y				0
+							3	a3 * a1.x				1984
+							4	var8 * var24				768
+							5	var8 * var28				0
+							6	var8 * flt_4D84E8			0
+.text:0049CC1B 7 fsub    st, st(5)
+.text:0049CC1D 7 fstp    dword ptr [ebx+34h]
+				[1].y <- var18 - a3 * a1.y - var8 * var28		1480
+.text:0049CC20 6 fstp    st
+							0	a3 * a1.y				0
+							1	a3 * a1.x				1984
+							2	var8 * var24				768
+							3	var8 * var28				0
+							4	var8 * flt_4D84E8			0
+
+
+						[var20]	var8 * var24		768
+						[var8]	a3 * a1.z
+						[a3]	var4 - a3 * a1.z	768
+
+.text:0049CC22 5 fld     [ebp+a3]			0	var4 - a3 * a1.z			768
+							1	a3 * a1.y				0
+							2	a3 * a1.x				1984
+							3	var8 * var24				768
+							4	var8 * var28				0
+							5	var8 * flt_4D84E8			0
+.text:0049CC25 6 fsub    st, st(3)
+.text:0049CC27 6 fstp    dword ptr [ebx+38h]
+			[1].z <- var4 - a3 * a1.z - var8 * var24	768 - 768 = 0
+
+							0	a3 * a1.y				0
+							1	a3 * a1.x				1984
+							2	var8 * var24				768
+							3	var8 * var28				0
+							4	var8 * flt_4D84E8			0
+
+
+.text:0049CC2A   fld     st(1)
+.text:0049CC2C 6 fadd    [ebp+arg4]			0	arg4 + a3 * a1.x			284
+							1	a3 * a1.y				0
+							2	a3 * a1.x				1984
+							3	var8 * var24				768
+							4	var8 * var28				0
+							5	var8 * flt_4D84E8			0
+.text:0049CC2F 6 fst     [ebp+a3]
+
+						[var20]	var8 * var24		768
+						[var8]	a3 * a1.z
+						[a3]	arg4 + a3 * a1.x	284
+.text:0049CC32 6 fsub    st, st(5)
+.text:0049CC34 6 fstp    dword ptr [ebx+60h]
+			[2].x <- arg4 + a3 * a1.x - var8 * flt_4D84E8		284
+
+							0	a3 * a1.y				0
+							1	a3 * a1.x				1984
+							2	var8 * var24				768
+							3	var8 * var28				0
+							4	var8 * flt_4D84E8			0
+
+.text:0049CC37 5 fadd    [ebp+var_18]			0	var18 + a3 * a1.y			1480
+							1	a3 * a1.x				1984
+							2	var8 * var24				768
+							3	var8 * var28				0
+							4	var8 * flt_4D84E8			0
+
+.text:0049CC3A 5 fstp    st(2)				0	a3 * a1.x				1984
+							1	var18 + a3 * a1.y			1480
+							2	var8 * var28				0
+							3	var8 * flt_4D84E8			0
+
+.text:0049CC3C 4 fstp    st				0	var18 + a3 * a1.y			1480
+							1	var8 * var28				0
+							2	var8 * flt_4D84E8			0
+
+.text:0049CC3E 3 fld     st				0	var18 + a3 * a1.y			1480
+							1	var18 + a3 * a1.y			1480
+							2	var8 * var28				0
+							3	var8 * flt_4D84E8			0
+.text:0049CC40 4 fsub    st, st(2)
+.text:0049CC42 4 fstp    dword ptr [ebx+64h]
+			[2].y <- var18 + a3 * a1.y - var8 * var28	1480
+
+							0	var18 + a3 * a1.y			1480
+							1	var8 * var28				0
+							2	var8 * flt_4D84E8			0
+
+						[var20]	var8 * var24		768
+						[var8]	a3 * a1.z
+						[a3]	arg4 + a3 * a1.x	284
+.text:0049CC45 3 fld     [ebp+var_8]
+.text:0049CC48 4 fadd    [ebp+var_4]			0	var4 + a3 * a1.z			768
+							1	var18 + a3 * a1.y			1480
+							2	var8 * var28				0
+							3	var8 * flt_4D84E8			0
+
+.text:0049CC4B 4 fst     [ebp+arg0]
+						[var20]	var8 * var24		768
+						[arg0]	var4 + a3 * a1.z	768
+						[var8]	a3 * a1.z		0
+						[a3]	arg4 + a3 * a1.x	284
+
+.text:0049CC4E 4 fsub    [ebp+var_20]
+.text:0049CC51 4 fstp    dword ptr [ebx+68h]
+			[2].z <- var4 + a3 * a1.z - var8 * var24		0
+
+
+
+						[var20]	var8 * var24		768
+						[arg0]	var4 + a3 * a1.z	768
+						[var8]	a3 * a1.z		0
+						[a3]	arg4 + a3 * a1.x	284
+
+
+							0	var18 + a3 * a1.y			1480
+							1	var8 * var28				0
+							2	var8 * flt_4D84E8			0
+
+.text:0049CC54 3 fld     [ebp+a3]
+.text:0049CC57 4 fadd    st, st(3)
+.text:0049CC59 4 fstp    dword ptr [ebx+90h]
+			[3].x <- arg4 + a3 * a1.x + var8 * flt_4D84E8		284
+
+.text:0049CC5F 3 fadd    st, st(1)
+.text:0049CC61 3 fstp    dword ptr [ebx+94h]
+			[3].y <- var18 + a3 * a1.y + var8 * var28		1480
+
+.text:0049CC67 2 fstp    st
+.text:0049CC69 1 fstp    st
+							0	empty
+.text:0049CC6B 0 fld     [ebp+arg0]
+.text:0049CC6E 1 fadd    [ebp+var_20]
+.text:0049CC71 1 fstp    dword ptr [ebx+98h]
+			[3].z <- var4 + a3 * a1.z + var8 * var24	1536
+
+							0 empty
+*/
 
   arg0[0].vWorldPosition.x = arg_4 - a3 * a1.x + var_8 * flt_4D84E8;
   arg0[0].vWorldPosition.y = var_18 - a3 * a1.y + var_8 * var_28;
-  arg0[0].vWorldPosition.z = var_4 - var_8 + var_8 * var_24;
+  arg0[0].vWorldPosition.z = var_4 - a3 * a1.z + var_8 * var_24;
+
   arg0[1].vWorldPosition.x = arg_4 - a3 * a1.x - var_8 * flt_4D84E8;
   arg0[1].vWorldPosition.y = var_18 - a3 * a1.y - var_8 * var_28;
-  arg0[1].vWorldPosition.z = (var_4 - var_8) - var_8 * var_24;
-  arg0[2].vWorldPosition.x = a3 * a1.x + arg_4 - var_8 * flt_4D84E8;
-  arg0[2].vWorldPosition.y = a3 * a1.y + var_18 - var_8 * var_28;
-  arg0[2].vWorldPosition.z = var_8 + var_4 - var_20;
-  arg0[3].vWorldPosition.x = (a3 * a1.x + arg_4) + var_8 * flt_4D84E8;
-  arg0[3].vWorldPosition.y = a3 * a1.y + var_18 + var_8 * var_28;
-  arg0[3].vWorldPosition.z = arg_0 + var_20;
+  arg0[1].vWorldPosition.z = var_4 - a3 * a1.z - var_8 * var_24;
 
-  a3 = (var_4 - var_8);
-  a3 = (a3 * a1.x + arg_4);
+  arg0[2].vWorldPosition.x = arg_4 + a3 * a1.x - var_8 * flt_4D84E8;
+  arg0[2].vWorldPosition.y = var_18 + a3 * a1.y - var_8 * var_28;
+  arg0[2].vWorldPosition.z = var_4 + a3 * a1.z - var_8 * var_24;
+
+  arg0[3].vWorldPosition.x = arg_4 + a3 * a1.x + var_8 * flt_4D84E8;
+  arg0[3].vWorldPosition.y = var_18 + a3 * a1.y + var_8 * var_28;
+  arg0[3].vWorldPosition.z = var_4 + a3 * a1.z + var_8 * var_24;
+
 
   a1.x = 0.0f;
   a1.y = 0.0f;
   a1.z = 0.0f;
+  a3 = arg_4 + a3 * a1.x;
 
   if (!_49C8DC(arg0, &a1, &a3))
     return false;