annotate Vis.cpp @ 117:a64b244da76c

some things lod
author Nomad
date Tue, 13 Nov 2012 17:29:38 +0200
parents 918dca162239
children
rev   line source
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1 #include "Vis.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2 #include "Outdoor.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3 #include "Game.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
4 #include "Actor.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
5 #include "IndoorCamera.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
6 #include "Viewport.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
7 #include "stru157.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
9 #include "mm7_data.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
10 //#include "MM7.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
13 static Vis_stru1 Vis_static_sub_4C1944_stru_F8BDE8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
17 //----- (004C1026) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
18 Vis_stru1_stru0 *Vis::_4C1026(BLVFace *a2, unsigned int a3, float a4)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
19 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
20 char *v4; // eax@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
21 signed int v5; // ecx@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
22 BLVFace *v6; // ecx@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
23 unsigned int v7; // edi@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
24 Vec3_short_ *v8; // eax@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
25 char *v9; // edx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
26 signed int v10; // esi@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
27 Vec3_int_ **v11; // edx@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
28 char *v12; // eax@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
29 double v13; // st7@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
30 signed int v14; // ebx@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
31 Vis *v15; // ebx@15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
32 Vis_stru1_stru0 *result; // eax@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
33 Vis_stru1_stru0 *v17; // ecx@24
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
34 RenderVertexSoft pRay[2]; // [sp+20h] [bp-70h]@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
35 int v20; // [sp+84h] [bp-Ch]@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
36 int v21; // [sp+88h] [bp-8h]@16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
37 int v22; // [sp+8Ch] [bp-4h]@16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
38 signed int v23; // [sp+98h] [bp+8h]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
39
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
40 auto ecx0 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
41
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
42 static Vis_stru1 static_sub_4C1026_stru_F8FE00;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
43 static_sub_4C1026_stru_F8FE00.uNumPointers = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
44
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
45 static bool _init_flag = false;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
46 static RenderVertexSoft static_sub_4C1026_array_F8F200[64];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
47 if (!_init_flag)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
48 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
49 _init_flag = true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
50 for (uint i = 0; i < 64; ++i)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
51 static_sub_4C1026_array_F8F200[i].flt_2C = 0.0f;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
52 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
53
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
54 v6 = a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
55 v23 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
56 v7 = v6->uNumVertices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
57 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
58 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
59 if ( (signed int)v7 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
60 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
61 v8 = pIndoor->pVertices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
62 v9 = (char *)&static_sub_4C1026_array_F8F200[0].vWorldPosition.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
63 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
64 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
65 v10 = v23++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
66 v20 = v8[v6->pVertexIDs[v10]].x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
67 *((float *)v9 - 1) = (double)v20;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
68 v20 = v8[v6->pVertexIDs[v10]].y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
69 *(float *)v9 = (double)v20;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
70 v9 += 48;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
71 v20 = v8[v6->pVertexIDs[v10]].z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
72 *((float *)v9 - 11) = (double)v20;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
73 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
74 while ( v23 < (signed int)v7 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
75 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
76 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
77 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
78 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
79 if ( (signed int)v7 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
80 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
81 v11 = &pOutdoor->pBModels[a3 >> 9].pVertices.pVertices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
82 v12 = (char *)&static_sub_4C1026_array_F8F200[0].vWorldPosition.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
83 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
84 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
85 *((float *)v12 - 1) = (double)(*v11)[v6->pVertexIDs[v23]].x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
86 v13 = (double)(*v11)[v6->pVertexIDs[v23]].y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
87 v14 = v23++;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
88 *(float *)v12 = v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
89 v12 += 48;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
90 *((float *)v12 - 11) = (double)(*v11)[v6->pVertexIDs[v14]].z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
91 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
92 while ( v23 < (signed int)v7 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
93 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
94 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
95 pGame->pIndoorCameraD3D->ViewTransform(static_sub_4C1026_array_F8F200, v7);
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
96 pGame->pIndoorCameraD3D->Project(static_sub_4C1026_array_F8F200, v7, 1);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
97 v15 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
98 SortVectors_x(static_sub_4C1026_array_F8F200, 0, v7 - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
99 if ( static_sub_4C1026_array_F8F200[0].vWorldViewPosition.x > (double)a4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
100 || (_4C1495(static_sub_4C1026_array_F8F200, v7, (float *)&v21, (float *)&v22),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
101 _4C12C3_FindSomeBillboard(static_sub_4C1026_array_F8F200, v7, *(float *)&v21, *(float *)&v22))
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
102 || ((CastPickRay(pRay, *(float *)&v21, *(float *)&v22, a4), uCurrentlyLoadedLevelType != LEVEL_Indoor) ? PickOutdoor(a4, pRay, &static_sub_4C1026_stru_F8FE00, &a5, 1) : PickIndoor(a4, pRay, &static_sub_4C1026_stru_F8FE00, &a5),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
103 (static_sub_4C1026_stru_F8FE00.create_object_pointers(0),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
104 sort_object_pointers(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
105 static_sub_4C1026_stru_F8FE00.array_1804,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
106 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
107 static_sub_4C1026_stru_F8FE00.uNumPointers - 1),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
108 !static_sub_4C1026_stru_F8FE00.uNumPointers)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
109 || (result = static_sub_4C1026_stru_F8FE00.sub_4C2551(2, a3)) == 0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
110 || (signed int)static_sub_4C1026_stru_F8FE00.uNumPointers > 1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
111 && ((signed int)static_sub_4C1026_stru_F8FE00.uNumPointers <= 0 ? (v17 = 0) : (v17 = static_sub_4C1026_stru_F8FE00.array_1804[0]),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
112 result != v17)) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
113 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
114 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
115 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
116 // F91E08: using guessed type char static_sub_4C1026_byte_F91E08__init_flags;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
117
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
118 //----- (004C12C3) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
119 char Vis::_4C12C3_FindSomeBillboard(RenderVertexSoft *a1, int a2, float a3, float a4)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
120 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
121 signed int v5; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
122 char *v6; // edi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
123 double v7; // st7@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
124 int v8; // edx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
125 char *v9; // ecx@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
126 char result; // al@24
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
127 Vis *thisa; // [sp+10h] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
128 float thisb; // [sp+10h] [bp-8h]@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
129 signed int v13; // [sp+14h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
130 float a3a; // [sp+28h] [bp+10h]@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
131 float a4a; // [sp+2Ch] [bp+14h]@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
132
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
133 v13 = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
134 v5 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
135 thisa = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
136 if ( (signed int)pRenderer->uNumBillboardsToDraw <= 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
137 goto LABEL_28;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
138 v6 = (char *)&pRenderer->pBillboardRenderListD3D[0].uParentBillboardID;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
139 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
140 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
141 if ( IsPointInsideD3DBillboard((RenderBillboardD3D *)(v6 - 152), a3, a4)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
142 && (v13 == -1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
143 || (unsigned int)pBillboardRenderList[*(int *)v6].sZValue < pBillboardRenderList[pRenderer->pBillboardRenderListD3D[v13].uParentBillboardID].sZValue) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
144 v13 = v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
145 ++v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
146 v6 += 156;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
147 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
148 while ( v5 < (signed int)pRenderer->uNumBillboardsToDraw );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
149 if ( v13 == -1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
150 goto LABEL_28;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
151 v7 = 3.4028235e38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
152 v8 = a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
153 a4a = 3.4028235e38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
154 a3a = -3.4028235e38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
155 thisb = -3.4028235e38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
156 if ( a2 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
157 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
158 v9 = (char *)&a1->vWorldViewProjY;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
159 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
160 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
161 if ( *((float *)v9 - 1) < v7 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
162 v7 = *((float *)v9 - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
163 if ( *((float *)v9 - 1) > (double)a3a )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
164 a3a = *((float *)v9 - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
165 if ( *(float *)v9 < (double)a4a )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
166 a4a = *(float *)v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
167 if ( *(float *)v9 > (double)thisb )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
168 thisb = *(float *)v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
169 v9 += 48;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
170 --v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
171 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
172 while ( v8 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
173 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
174 if ( v7 < pRenderer->pBillboardRenderListD3D[v13].pQuards[0].pos.x
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
175 || pRenderer->pBillboardRenderListD3D[v13].pQuards[0].pos.y > (double)a4a
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
176 || pRenderer->pBillboardRenderListD3D[v13].pQuards[3].pos.x < (double)a3a
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
177 || pRenderer->pBillboardRenderListD3D[v13].pQuards[1].pos.y < (double)thisb )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
178 LABEL_28:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
179 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
180 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
181 result = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
182 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
183 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
184
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
185 //----- (004C1417) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
186 void Vis::GetPolygonCenter(RenderVertexD3D3 *pVertices, unsigned int uNumVertices, float *pCenterX, float *pCenterY)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
187 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
188 static RenderVertexD3D3 unk_F8EA00[64];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
189
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
190 memcpy(unk_F8EA00, pVertices, 32 * uNumVertices);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
191
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
192 SortVerticesByX(unk_F8EA00, 0, uNumVertices - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
193 *pCenterX = (unk_F8EA00[uNumVertices - 1].pos.x - unk_F8EA00[0].pos.x) * 0.5 + unk_F8EA00[0].pos.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
194
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
195 SortVerticesByY(unk_F8EA00, 0, uNumVertices - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
196 *pCenterY = (unk_F8EA00[uNumVertices - 1].pos.y - unk_F8EA00[0].pos.y) * 0.5 + unk_F8EA00[0].pos.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
197 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
198
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
199 //----- (004C1495) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
200 float *Vis::_4C1495(RenderVertexSoft *Src, int a2, float *a3, float *a4)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
201 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
202 char *v5; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
203 signed int v6; // ecx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
204 float *result; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
205 Vis *thisa; // [sp+0h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
206
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
207 thisa = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
208
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
209 static bool static_sub_4C1495_byte_F8E9F8__init_flags = false; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
210 static RenderVertexSoft static_sub_4C1495_array_F8DDF8[64];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
211 if ( !static_sub_4C1495_byte_F8E9F8__init_flags )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
212 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
213 static_sub_4C1495_byte_F8E9F8__init_flags = true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
214
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
215 for (uint i = 0; i < 64; ++i)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
216 static_sub_4C1495_array_F8DDF8[i].flt_2C = 0.0f;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
217 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
218
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
219 memcpy(static_sub_4C1495_array_F8DDF8, Src, 48 * a2);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
220 sort_objects_2(static_sub_4C1495_array_F8DDF8, 0, a2 - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
221 *a3 = (*(float *)&Vis_static_sub_4C1944_stru_F8BDE8.array_1804[12 * a2 + 509]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
222 - static_sub_4C1495_array_F8DDF8[0].vWorldViewProjX)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
223 * 0.5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
224 + static_sub_4C1495_array_F8DDF8[0].vWorldViewProjX;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
225 sort_objects_3(static_sub_4C1495_array_F8DDF8, 0, a2 - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
226 result = a4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
227 *a4 = (*(float *)&Vis_static_sub_4C1944_stru_F8BDE8.array_1804[12 * a2 + 510]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
228 - static_sub_4C1495_array_F8DDF8[0].vWorldViewProjY)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
229 * 0.5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
230 + static_sub_4C1495_array_F8DDF8[0].vWorldViewProjY;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
231 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
232 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
233
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
234 //----- (004C1542) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
235 void Vis::PickBillboards(float fPickDepth, float fX, float fY, Vis_stru1 *a4, stru157 *a2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
236 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
237 int v6; // ST1C_4@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
238 Vis_stru1_stru0 *v7; // edi@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
239 Vis *thisa; // [sp+20h] [bp-Ch]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
240 void **v9; // [sp+24h] [bp-8h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
241 unsigned int uD3DBillboardIdx; // [sp+28h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
242
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
243 uD3DBillboardIdx = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
244 thisa = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
245 if ( (signed int)pRenderer->uNumBillboardsToDraw > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
246 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
247 v9 = (void **)&pRenderer->pBillboardRenderListD3D[0].uParentBillboardID;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
248 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
249 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
250 if ( is_part_of_selection((BLVFace *)uD3DBillboardIdx, a2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
251 && IsPointInsideD3DBillboard((RenderBillboardD3D *)(v9 - 38), fX, fY) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
252 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
253 if ( DoesRayIntersectBillboard(fPickDepth, uD3DBillboardIdx) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
254 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
255 v6 = pBillboardRenderList[(int)*v9].sZValue;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
256 v7 = &a4->array_0004[a4->uNumPointers];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
257 v7->pObjectInfo = *v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
258 v7 = (Vis_stru1_stru0 *)((char *)v7 + 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
259 v7->pObjectInfo = (void *)v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
260 v7->sZValue = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
261 ++a4->uNumPointers;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
262 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
263 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
264 ++uD3DBillboardIdx;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
265 v9 += 39;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
266 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
267 while ( (signed int)uD3DBillboardIdx < (signed int)pRenderer->uNumBillboardsToDraw );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
268 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
269 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
270
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
271 //----- (004C1607) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
272 bool Vis::IsPointInsideD3DBillboard(RenderBillboardD3D *a1, float x, float y)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
273 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
274 RenderBillboardD3D *result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
275 double v5; // st7@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
276 float v6; // ecx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
277 float v7; // ST00_4@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
278 __int16 v8; // fps@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
279 double v9; // st6@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
280 char v10; // c0@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
281 char v11; // c2@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
282 char v12; // c3@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
283 __int16 v13; // fps@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
284 double v14; // st6@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
285 unsigned __int8 v15; // c0@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
286 char v16; // c2@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
287 unsigned __int8 v17; // c3@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
288 __int16 v18; // fps@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
289 double v19; // st6@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
290 char v20; // c0@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
291 char v21; // c2@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
292 char v22; // c3@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
293 __int16 v23; // fps@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
294 double v24; // st6@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
295 unsigned __int8 v25; // c0@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
296 char v26; // c2@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
297 unsigned __int8 v27; // c3@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
298 float v28; // [sp+4h] [bp-8h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
299 float v29; // [sp+8h] [bp-4h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
300 float a1a; // [sp+14h] [bp+8h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
301
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
302 result = a1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
303 if ( a1->uParentBillboardID == -1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
304 goto LABEL_14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
305 v5 = a1->pQuards[0].pos.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
306 a1a = a1->pQuards[3].pos.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
307 v6 = result->pQuards[0].pos.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
308 result = (RenderBillboardD3D *)LODWORD(result->pQuards[1].pos.y);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
309 v29 = v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
310 LODWORD(v28) = (int)result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
311 if ( v5 > a1a )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
312 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
313 v7 = v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
314 HIWORD(result) = HIWORD(v7);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
315 v5 = a1a;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
316 a1a = v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
317 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
318 if ( v6 > (double)v28 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
319 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
320 result = (RenderBillboardD3D *)LODWORD(v28);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
321 v28 = v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
322 LODWORD(v29) = (int)result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
323 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
324 v9 = x + 1.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
325 //UNDEF(v8);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
326 v10 = v9 < v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
327 v11 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
328 v12 = v9 == v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
329 BYTE1(result) = HIBYTE(v8);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
330 if ( v9 >= v5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
331 && (v14 = x - 1.0, /*UNDEF(v13),*/ v15 = v14 < a1a, v16 = 0, v17 = v14 == a1a, BYTE1(result) = HIBYTE(v13), v15 | v17)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
332 && (v19 = y + 1.0, /*UNDEF(v18),*/ v20 = v19 < v29, v21 = 0, v22 = v19 == v29, BYTE1(result) = HIBYTE(v18), v19 >= v29)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
333 && (v24 = y - 1.0, /*UNDEF(v23),*/ v25 = v24 < v28, v26 = 0, v27 = v24 == v28, BYTE1(result) = HIBYTE(v23), v25 | v27) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
334 LOBYTE(result) = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
335 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
336 LABEL_14:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
337 LOBYTE(result) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
338 return (bool)result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
339 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
340
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
341 //----- (004C16B4) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
342 void Vis::PickIndoor(float fDepth, RenderVertexSoft *pRay, Vis_stru1 *a4, stru157 *a5)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
343 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
344 int v5; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
345 signed int v6; // edi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
346 signed int v7; // esi@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
347 int v8; // ecx@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
348 int v9; // eax@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
349 unsigned int *pNumPointers; // eax@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
350 unsigned int v11; // ecx@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
351 Vis_stru1_stru0 *v12; // edi@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
352 RenderVertexSoft a1; // [sp+Ch] [bp-44h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
353 BLVFace *v14; // [sp+3Ch] [bp-14h]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
354 void *v15; // [sp+40h] [bp-10h]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
355 int v16; // [sp+44h] [bp-Ch]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
356 int v17; // [sp+48h] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
357 Vis *thisa; // [sp+4Ch] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
358
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
359 v5 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
360 thisa = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
361 v17 = 0;
116
918dca162239 stru170 -> BspRenderer
Nomad
parents: 77
diff changeset
362 for ( a1.flt_2C = 0.0; v17 < (signed int)pBspRenderer->uNumFaceIDs; ++v17 )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
363 {
116
918dca162239 stru170 -> BspRenderer
Nomad
parents: 77
diff changeset
364 v6 = pBspRenderer->pFaceIDs[2 * v5];
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
365 if ( v6 >= 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
366 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
367 if ( v6 < (signed int)pIndoor->uNumFaces )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
368 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
369 v7 = v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
370 if ( is_part_of_selection(&pIndoor->pFaces[v6], a5) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
371 {
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
372 if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[v7]) )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
373 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
374 if ( Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &a1, &pIndoor->pFaces[v7], 0xFFFFFFFFu) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
375 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
376 pGame->pIndoorCameraD3D->ViewTransform(&a1, 1u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
377 v9 = _48B561_mess_with_scaling_along_z(/*v8, */a1.vWorldViewPosition.x);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
378 LOWORD(v9) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
379 v15 = (void *)((8 * v6 | 6) + v9);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
380 pNumPointers = &a4->uNumPointers;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
381 v16 = 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
382 v11 = a4->uNumPointers;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
383 v14 = &pIndoor->pFaces[v7];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
384 v12 = &a4->array_0004[v11];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
385 v12->pObjectInfo = &pIndoor->pFaces[v7];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
386 v12 = (Vis_stru1_stru0 *)((char *)v12 + 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
387 v12->pObjectInfo = v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
388 v12->sZValue = v16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
389 ++*pNumPointers;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
390 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
391 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
392 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
393 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
394 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
395 v5 = v17 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
396 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
397 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
398
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
399 //----- (004C17CF) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
400 void Vis::PickOutdoor(float fDepth, RenderVertexSoft *pRay, Vis_stru1 *a4, stru157 *a5, char a6)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
401 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
402 int v6; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
403 unsigned int v7; // ecx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
404 BSPModel *v8; // ebx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
405 bool v9; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
406 int v10; // eax@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
407 ODMFace *v11; // esi@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
408 int v12; // ecx@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
409 int v13; // eax@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
410 unsigned int *pNumPointers; // eax@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
411 Vis_stru1_stru0 *v15; // edi@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
412 BLVFace thisa; // [sp+10h] [bp-B8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
413 RenderVertexSoft a1; // [sp+70h] [bp-58h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
414 void *v18; // [sp+A0h] [bp-28h]@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
415 void *v19; // [sp+A4h] [bp-24h]@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
416 int v20; // [sp+A8h] [bp-20h]@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
417 int v21; // [sp+ACh] [bp-1Ch]@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
418 Vis *v22; // [sp+B0h] [bp-18h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
419 int v23; // [sp+B4h] [bp-14h]@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
420 int v24; // [sp+B8h] [bp-10h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
421 unsigned int v25; // [sp+BCh] [bp-Ch]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
422 unsigned int v26; // [sp+C0h] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
423 int v27; // [sp+C4h] [bp-4h]@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
424
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
425 v22 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
426 v6 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
427 v7 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
428 v24 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
429 v26 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
430 a1.flt_2C = 0.0;
3
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
431 if (!pOutdoor)
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
432 return;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
433 if ( (signed int)pOutdoor->uNumBModels > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
434 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
435 v25 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
436 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
437 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
438 v8 = &pOutdoor->pBModels[v25 / 0xBC];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
439 v9 = IsBModelVisible(v7, &v24);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
440 if ( a6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
441 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
442 if ( v9 && v24 != v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
443 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
444 LABEL_8:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
445 v10 = v8->uNumFaces;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
446 v27 = v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
447 v21 = v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
448 if ( v10 > v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
449 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
450 v23 = v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
451 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
452 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
453 v11 = (ODMFace *)((char *)v8->pFaces + v23);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
454 if ( is_part_of_selection((BLVFace *)((char *)v8->pFaces + v23), a5) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
455 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
456 thisa.FromODM(v11);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
457 if ( Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &a1, &thisa, v26) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
458 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
459 pGame->pIndoorCameraD3D->ViewTransform(&a1, 1u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
460 v18 = v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
461 v13 = _48B561_mess_with_scaling_along_z(/*v12, */a1.vWorldViewPosition.x);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
462 LOWORD(v13) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
463 v20 = 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
464 v19 = (void *)((8 * (v27 | (v26 << 6)) | 6) + v13);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
465 pNumPointers = &a4->uNumPointers;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
466 v15 = &a4->array_0004[a4->uNumPointers];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
467 v15->pObjectInfo = v18;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
468 v15 = (Vis_stru1_stru0 *)((char *)v15 + 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
469 v15->pObjectInfo = v19;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
470 v15->sZValue = v20;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
471 ++*pNumPointers;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
472 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
473 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
474 ++v27;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
475 v23 += 308;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
476 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
477 while ( v27 < v21 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
478 v6 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
479 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
480 goto LABEL_15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
481 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
482 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
483 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
484 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
485 if ( v9 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
486 goto LABEL_8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
487 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
488 LABEL_15:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
489 v25 += 188;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
490 v7 = v26++ + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
491 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
492 while ( (signed int)v26 < (signed int)pOutdoor->uNumBModels );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
493 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
494 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
495
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
496 //----- (004C1930) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
497 //bool Vis::j_DoesRayIntersectBillboard(float fDepth, unsigned int uD3DBillboardIdx)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
498 //{return DoesRayIntersectBillboard(fDepth, uD3DBillboardIdx);}
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
499
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
500 //----- (004C1944) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
501 int Vis::_4C1944(int a2, unsigned int a3, int a4, int a5, int a6)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
502 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
503 float v6; // ST00_4@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
504 int result; // eax@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
505 stru157 v8; // [sp+18h] [bp-20h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
506 __int64 v9; // [sp+2Ch] [bp-Ch]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
507 Vis *v14; // [sp+34h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
508
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
509 v14 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
510
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
511 static Vis_stru1 Vis_static_sub_4C1944_stru_F8BDE8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
512
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
513 v8.field_4 = a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
514 v8.field_8 = a6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
515 v8.field_C = a5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
516 v8.field_10 = a4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
517 v9 = a3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
518 Vis_static_sub_4C1944_stru_F8BDE8.uNumPointers = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
519 v6 = (double)a3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
520 v8.field_0 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
521 _4C06F8(v6, &Vis_static_sub_4C1944_stru_F8BDE8, &v8);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
522 Vis_static_sub_4C1944_stru_F8BDE8.create_object_pointers(1u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
523 sort_object_pointers(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
524 Vis_static_sub_4C1944_stru_F8BDE8.array_1804,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
525 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
526 Vis_static_sub_4C1944_stru_F8BDE8.uNumPointers - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
527 if ( (signed int)Vis_static_sub_4C1944_stru_F8BDE8.uNumPointers <= 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
528 result = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
529 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
530 result = Vis_static_sub_4C1944_stru_F8BDE8.array_1804[0]->sZValue;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
531 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
532 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
533 // F8DDF0: using guessed type char Vis_static_sub_4C1944_byte_F8DDF0_init;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
534
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
535 //----- (004C1A02) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
536 void Vis::_4C1A02()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
537 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
538 RenderVertexSoft v1; // [sp+8h] [bp-C0h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
539 RenderVertexSoft v2; // [sp+38h] [bp-90h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
540 RenderVertexSoft v3; // [sp+68h] [bp-60h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
541 RenderVertexSoft v4; // [sp+98h] [bp-30h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
542
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
543 v4.flt_2C = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
544 v4.vWorldPosition.x = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
545 v4.vWorldPosition.y = 65536.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
546 v4.vWorldPosition.z = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
547 v3.flt_2C = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
548 v3.vWorldPosition.x = 65536.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
549 v3.vWorldPosition.y = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
550 v3.vWorldPosition.z = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
551 memcpy(&v1, &v3, sizeof(v1));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
552 v3.flt_2C = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
553 v3.vWorldPosition.x = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
554 v3.vWorldPosition.y = 65536.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
555 v3.vWorldPosition.z = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
556 memcpy(&v2, &v4, sizeof(v2));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
557 v4.flt_2C = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
558 v4.vWorldPosition.x = 65536.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
559 v4.vWorldPosition.y = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
560 v4.vWorldPosition.z = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
561 memcpy(&this->stru_200C, &v1, 0x60u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
562 memcpy(&v1, &v4, sizeof(v1));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
563 memcpy(&v2, &v3, sizeof(v2));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
564 memcpy(&this->stru_206C, &v1, 0x60u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
565 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
566
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
567 //----- (004C1ABA) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
568 bool Vis::SortVectors_x(RenderVertexSoft *a2, int a3, int a4)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
569 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
570 bool result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
571 RenderVertexSoft *v5; // edx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
572 int v6; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
573 int i; // ecx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
574 int v8; // esi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
575 int v9; // esi@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
576 RenderVertexSoft *v10; // eax@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
577 RenderVertexSoft v11; // [sp+4h] [bp-6Ch]@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
578 RenderVertexSoft v12; // [sp+34h] [bp-3Ch]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
579 int v13; // [sp+64h] [bp-Ch]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
580 Vis *thisa; // [sp+68h] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
581 RenderVertexSoft *v15; // [sp+6Ch] [bp-4h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
582
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
583 result = a4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
584 thisa = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
585 if ( a4 > a3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
586 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
587 v5 = a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
588 v15 = &a2[a4];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
589 v6 = a3 - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
590 memcpy(&v12, &a2[a4], sizeof(v12));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
591 for ( i = a4; ; i = v13 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
592 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
593 v8 = (int)&v5[v6].vWorldViewPosition;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
594 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
595 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
596 v8 += 48;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
597 ++v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
598 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
599 while ( *(float *)v8 < (double)v12.vWorldViewPosition.x );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
600 v9 = (int)&v5[i].vWorldViewPosition;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
601 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
602 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
603 v9 -= 48;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
604 --i;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
605 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
606 while ( *(float *)v9 > (double)v12.vWorldViewPosition.x );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
607 v13 = i;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
608 if ( v6 >= i )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
609 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
610 v10 = &v5[i];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
611 memcpy(&v11, &a2[v6], sizeof(v11));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
612 v5 = a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
613 memcpy(&a2[v6], v10, sizeof(a2[v6]));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
614 memcpy(v10, &v11, 0x30u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
615 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
616 memcpy(&v11, &v5[v6], sizeof(v11));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
617 memcpy(&v5[v6], v15, sizeof(v5[v6]));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
618 memcpy(v15, &v11, 0x30u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
619 SortVectors_x(v5, a3, v6 - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
620 SortVectors_x(a2, v6 + 1, a4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
621 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
622 return true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
623 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
624
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
625 //----- (004C1BAA) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
626 int Vis::get_object_zbuf_val(Vis_stru1_stru0 *a2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
627 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
628 unsigned int v2; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
629 int result; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
630 std::string v4; // [sp-18h] [bp-1Ch]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
631 const char *v5; // [sp-8h] [bp-Ch]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
632 int v6; // [sp-4h] [bp-8h]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
633 Vis *v7; // [sp+0h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
634
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
635 v7 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
636 v2 = a2->uObjectType;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
637 if ( (signed int)v2 <= 0 || (signed int)v2 > 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
638 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
639 MessageBoxW(nullptr, L"Undefined type requested for: CVis::get_object_zbuf_val()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Vis.cpp:1037", 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
640 result = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
641 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
642 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
643 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
644 result = a2->sZValue;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
645 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
646 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
647 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
648
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
649 //----- (004C1BF1) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
650 int Vis::get_picked_object_zbuf_val()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
651 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
652 int result; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
653
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
654 if ( (signed int)this->stru1.uNumPointers <= 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
655 result = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
656 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
657 result = get_object_zbuf_val(this->stru1.array_1804[0]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
658 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
659 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
660
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
661 //----- (004C1C0C) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
662 bool Vis::Intersect_Ray_Face(RenderVertexSoft *pRayStart, RenderVertexSoft *pRayEnd, float *pDepth, RenderVertexSoft *a4, BLVFace *a5, unsigned int a6)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
663 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
664 BLVFace *v7; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
665 bool result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
666 double v9; // st7@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
667 __int16 v10; // fps@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
668 char v11; // c0@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
669 char v12; // c2@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
670 char v13; // c3@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
671 __int16 v14; // fps@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
672 char v15; // c0@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
673 char v16; // c2@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
674 char v17; // c3@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
675 double v18; // st5@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
676 __int16 v19; // fps@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
677 char v20; // c0@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
678 char v21; // c2@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
679 char v22; // c3@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
680 unsigned __int8 v23; // c0@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
681 char v24; // c2@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
682 unsigned __int8 v25; // c3@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
683 char v26; // zf@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
684 double v27; // st6@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
685 __int16 v28; // fps@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
686 unsigned __int8 v29; // c0@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
687 char v30; // c2@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
688 unsigned __int8 v31; // c3@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
689 double v32; // st7@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
690 Vec2_short_ v33; // ST1E_4@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
691 Vec3_short_ v34; // ST04_6@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
692 float a5a; // [sp+30h] [bp+18h]@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
693 float a5b; // [sp+30h] [bp+18h]@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
694
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
695 v7 = a5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
696 result = a5->uAttributes;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
697 if ( result & 1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
698 || BYTE1(result) & 0x20
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
699 || (v9 = pRayEnd->vWorldPosition.z * a5->pFacePlane.vNormal.z
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
700 + a5->pFacePlane.vNormal.y * pRayEnd->vWorldPosition.y
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
701 + pRayEnd->vWorldPosition.x * a5->pFacePlane.vNormal.x,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
702 //UNDEF(v10),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
703 v11 = v9 < 0.0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
704 v12 = 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
705 v13 = v9 == 0.0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
706 BYTE1(result) = HIBYTE(v10),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
707 v9 == 0.0)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
708 || (/*UNDEF(v14),*/ v15 = v9 < 0.0, v16 = 0, v17 = v9 == 0.0, BYTE1(result) = HIBYTE(v14), v9 > 0.0) )// ray's away (>) from face surface or parallel (==)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
709 goto LABEL_12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
710 v18 = -(a5->pFacePlane.vNormal.y * pRayStart->vWorldPosition.y// ray-plane intersection
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
711 + pRayStart->vWorldPosition.x * a5->pFacePlane.vNormal.x
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
712 + pRayStart->vWorldPosition.z * a5->pFacePlane.vNormal.z
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
713 + a5->pFacePlane.dist);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
714 //UNDEF(v19);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
715 v20 = v9 < 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
716 v21 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
717 v22 = v9 == 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
718 BYTE1(result) = HIBYTE(v19);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
719 v23 = v18 < 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
720 v24 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
721 v25 = v18 == 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
722 v26 = (BYTE1(result) & 0x41) == 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
723 BYTE1(result) = HIBYTE(v19);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
724 if ( v26 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
725 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
726 if ( v18 < 0.0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
727 goto LABEL_12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
728 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
729 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
730 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
731 if ( !(v23 | v25) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
732 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
733 LABEL_12:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
734 LOBYTE(result) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
735 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
736 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
737 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
738 a5a = v18;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
739 v27 = a5a / v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
740 HIWORD(result) = HIWORD(pDepth);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
741 //UNDEF(v28);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
742 v29 = v27 < *pDepth;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
743 v30 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
744 v31 = v27 == *pDepth;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
745 BYTE1(result) = HIBYTE(v28);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
746 if ( !(v29 | v31)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
747 || (a4->vWorldPosition.x = v27 * pRayEnd->vWorldPosition.x + pRayStart->vWorldPosition.x,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
748 a4->vWorldPosition.y = v27 * pRayEnd->vWorldPosition.y + pRayStart->vWorldPosition.y,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
749 v32 = v27 * pRayEnd->vWorldPosition.z + pRayStart->vWorldPosition.z,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
750 a4->vWorldPosition.z = v32,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
751 v33.x = (signed __int64)a4->vWorldPosition.x,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
752 v33.y = (signed __int64)a4->vWorldPosition.y,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
753 *(int *)&v34.x = v33.x,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
754 v34.z = (signed __int64)v32,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
755 result = _4C1D2B(v7, v34, a6),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
756 *(float *)&result == 0.0) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
757 goto LABEL_12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
758 *(float *)&result = v27;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
759 a5b = v27;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
760 *(int *)pDepth = LODWORD(a5b);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
761 LOBYTE(result) = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
762 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
763 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
764
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
765 //----- (004C1D2B) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
766 int Vis::_4C1D2B(BLVFace *pFace, Vec3_short_ a2, unsigned int uModelID)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
767 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
768 BLVFace *v4; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
769 int v5; // esi@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
770 bool v6; // edi@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
771 int v7; // ecx@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
772 signed int v8; // edx@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
773 signed int v9; // eax@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
774 signed int v10; // ebx@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
775 int v11; // edi@16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
776 signed int v12; // ST28_4@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
777 signed __int64 v13; // qtt@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
778 signed int result; // eax@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
779 int v15; // [sp+10h] [bp-Ch]@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
780 signed int v16; // [sp+18h] [bp-4h]@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
781
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
782 v4 = pFace;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
783 if ( a2.z < pFace->pBounding.z1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
784 || a2.z > pFace->pBounding.z2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
785 || a2.x < pFace->pBounding.x1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
786 || a2.x > pFace->pBounding.x2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
787 || a2.y < pFace->pBounding.y1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
788 || a2.y > pFace->pBounding.y2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
789 || (uModelID != -1 ? _4C2186_BLV_IntersectBModel(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
790 (int *)&pFace,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
791 (int *)&uModelID,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
792 &word_F8BC48_displaced_face_intersect_plane_coords_a,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
793 &word_F8BD18_displaced_face_intersect_plane_coords_b,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
794 &a2,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
795 pFace,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
796 uModelID) : _4C1EE5_BLV_IntersectBModel_2(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
797 (int *)&pFace,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
798 (int *)&uModelID,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
799 &word_F8BC48_displaced_face_intersect_plane_coords_a,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
800 &word_F8BD18_displaced_face_intersect_plane_coords_b,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
801 &a2,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
802 pFace),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
803 v5 = 2 * v4->uNumVertices,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
804 v16 = 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
805 *(&word_F8BC48_displaced_face_intersect_plane_coords_a + v5) = word_F8BC48_displaced_face_intersect_plane_coords_a,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
806 *(&word_F8BD18_displaced_face_intersect_plane_coords_b + v5) = word_F8BD18_displaced_face_intersect_plane_coords_b,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
807 v15 = 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
808 v6 = word_F8BD18_displaced_face_intersect_plane_coords_b >= (signed int)uModelID,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
809 v5 <= 0) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
810 goto LABEL_25;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
811 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
812 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
813 if ( v16 >= 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
814 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
815 v7 = 2 * v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
816 v8 = *(&word_F8BD18_displaced_face_intersect_plane_coords_b + v15 + 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
817 if ( v6 ^ v8 >= (signed int)uModelID )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
818 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
819 v9 = *(__int16 *)((char *)&word_F8BC48_displaced_face_intersect_plane_coords_a + v7 + 2);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
820 if ( v9 >= (signed int)pFace )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
821 v10 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
822 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
823 v10 = 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
824 v11 = v10 | *(__int16 *)((char *)&word_F8BC48_displaced_face_intersect_plane_coords_a + v7) < (signed int)pFace;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
825 if ( v11 != 3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
826 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
827 if ( !v11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
828 || (v12 = v9 - *(__int16 *)((char *)&word_F8BC48_displaced_face_intersect_plane_coords_a + v7),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
829 LODWORD(v13) = v12 << 16,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
830 HIDWORD(v13) = v12 >> 16,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
831 *(__int16 *)((char *)&word_F8BC48_displaced_face_intersect_plane_coords_a + v7)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
832 + ((signed int)(((unsigned __int64)(v13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
833 / (v8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
834 - *(__int16 *)((char *)&word_F8BD18_displaced_face_intersect_plane_coords_b
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
835 + v7))
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
836 * (signed int)((uModelID
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
837 - *(__int16 *)((char *)&word_F8BD18_displaced_face_intersect_plane_coords_b
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
838 + v7)) << 16)) >> 16)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
839 + 32768) >> 16) >= (signed int)pFace) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
840 ++v16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
841 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
842 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
843 ++v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
844 v6 = v8 >= (signed int)uModelID;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
845 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
846 while ( v15 < v5 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
847 result = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
848 if ( v16 != 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
849 LABEL_25:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
850 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
851 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
852 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
853
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
854 //----- (004C1EE5) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
855 bool Vis::_4C1EE5_BLV_IntersectBModel_2(int *a1, int *a2, __int16 *a3, __int16 *a4, Vec3_short_ *a5, BLVFace *pFace)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
856 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
857 bool result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
858 unsigned int v8; // ecx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
859 Vec3_short_ *v9; // ecx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
860 __int16 *v10; // edx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
861 signed int v11; // ecx@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
862 char v12; // zf@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
863 Vec3_short_ *v13; // ecx@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
864 int v14; // edx@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
865 __int16 *v15; // edx@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
866 signed int v16; // ecx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
867 int v17; // edx@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
868 __int16 *v18; // edx@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
869 signed int v19; // ecx@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
870 signed int a5a; // [sp+24h] [bp+18h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
871 signed int a5b; // [sp+24h] [bp+18h]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
872 signed int a5c; // [sp+24h] [bp+18h]@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
873
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
874 result = (bool)pFace;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
875 v8 = pFace->uAttributes;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
876 if ( BYTE1(v8) & 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
877 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
878 v9 = a5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
879 a5a = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
880 *a1 = v9->x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
881 *a2 = v9->y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
882 if ( pFace->uNumVertices )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
883 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
884 v10 = a4 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
885 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
886 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
887 v11 = a5a;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
888 a3[2 * a5a] = pFace->pXInterceptDisplacements[a5a] + pIndoor->pVertices[pFace->pVertexIDs[a5a]].x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
889 *(v10 - 1) = pFace->pYInterceptDisplacements[v11] + pIndoor->pVertices[pFace->pVertexIDs[v11]].y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
890 *(__int16 *)((char *)v10 + (int)a3 - (int)a4) = pFace->pXInterceptDisplacements[v11 + 1]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
891 + pIndoor->pVertices[pFace->pVertexIDs[v11 + 1]].x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
892 ++a5a;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
893 *v10 = pFace->pYInterceptDisplacements[v11 + 1] + pIndoor->pVertices[pFace->pVertexIDs[v11 + 1]].y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
894 v10 += 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
895 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
896 while ( a5a < pFace->uNumVertices );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
897 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
898 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
899 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
900 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
901 v12 = (BYTE1(v8) & 2) == 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
902 v13 = a5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
903 if ( v12 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
904 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
905 v17 = a5->y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
906 a5c = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
907 *a1 = v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
908 *a2 = v13->z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
909 if ( pFace->uNumVertices )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
910 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
911 v18 = a4 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
912 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
913 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
914 v19 = a5c;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
915 a3[2 * a5c] = pFace->pYInterceptDisplacements[a5c] + pIndoor->pVertices[pFace->pVertexIDs[a5c]].y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
916 *(v18 - 1) = pFace->pZInterceptDisplacements[v19] + pIndoor->pVertices[pFace->pVertexIDs[v19]].z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
917 *(__int16 *)((char *)v18 + (int)(char *)a3 - (char *)a4) = pFace->pYInterceptDisplacements[v19 + 1]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
918 + pIndoor->pVertices[pFace->pVertexIDs[v19 + 1]].y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
919 ++a5c;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
920 *v18 = pFace->pZInterceptDisplacements[v19 + 1] + pIndoor->pVertices[pFace->pVertexIDs[v19 + 1]].z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
921 v18 += 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
922 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
923 while ( a5c < pFace->uNumVertices );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
924 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
925 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
926 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
927 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
928 v14 = a5->x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
929 a5b = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
930 *a1 = v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
931 *a2 = v13->z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
932 if ( pFace->uNumVertices )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
933 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
934 v15 = a4 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
935 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
936 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
937 v16 = a5b;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
938 a3[2 * a5b] = pFace->pXInterceptDisplacements[a5b] + pIndoor->pVertices[pFace->pVertexIDs[a5b]].x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
939 *(v15 - 1) = pFace->pZInterceptDisplacements[v16] + pIndoor->pVertices[pFace->pVertexIDs[v16]].z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
940 *(__int16 *)((char *)v15 + (int)a3 - (int)a4) = pFace->pXInterceptDisplacements[v16 + 1]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
941 + pIndoor->pVertices[pFace->pVertexIDs[v16 + 1]].x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
942 ++a5b;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
943 *v15 = pFace->pZInterceptDisplacements[v16 + 1] + pIndoor->pVertices[pFace->pVertexIDs[v16 + 1]].z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
944 v15 += 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
945 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
946 while ( a5b < pFace->uNumVertices );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
947 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
948 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
949 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
950 LOBYTE(result) = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
951 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
952 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
953
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
954 //----- (004C2186) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
955 bool Vis::_4C2186_BLV_IntersectBModel(int *a1, int *a2, __int16 *a3, __int16 *a4, Vec3_short_ *a5, BLVFace *a6, unsigned int uModelID)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
956 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
957 bool result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
958 int *v9; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
959 unsigned int v10; // ecx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
960 unsigned int v11; // edx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
961 signed int v12; // ecx@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
962 __int16 v13; // si@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
963 __int16 *v14; // ecx@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
964 unsigned int v15; // edx@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
965 signed int v16; // ecx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
966 __int16 v17; // si@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
967 __int16 *v18; // ecx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
968 unsigned int v19; // edx@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
969 signed int v20; // ecx@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
970 __int16 v21; // si@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
971 __int16 *v22; // ecx@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
972 signed int a1a; // [sp+14h] [bp+8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
973 __int16 *a5a; // [sp+24h] [bp+18h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
974 __int16 *a5b; // [sp+24h] [bp+18h]@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
975 __int16 *a5c; // [sp+24h] [bp+18h]@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
976
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
977 result = (bool)a6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
978 v9 = a1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
979 v10 = a6->uAttributes;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
980 a1a = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
981 if ( BYTE1(v10) & 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
982 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
983 *v9 = a5->x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
984 *a2 = a5->y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
985 if ( a6->uNumVertices )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
986 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
987 v11 = 188 * uModelID + 72;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
988 a5a = a4 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
989 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
990 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
991 v12 = a1a;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
992 a3[2 * a1a] = a6->pXInterceptDisplacements[a1a]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
993 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] + 12 * a6->pVertexIDs[a1a]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
994 *(a5a - 1) = a6->pYInterceptDisplacements[v12]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
995 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] + 12 * a6->pVertexIDs[v12] + 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
996 *(__int16 *)((char *)a5a + (int)(char *)a3 - (char *)a4) = a6->pXInterceptDisplacements[v12 + 1]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
997 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
998 + 12 * a6->pVertexIDs[v12 + 1]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
999 v13 = a6->pYInterceptDisplacements[v12 + 1]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1000 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] + 12 * a6->pVertexIDs[v12 + 1] + 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1001 v14 = a5a;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1002 ++a1a;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1003 a5a += 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1004 *v14 = v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1005 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1006 while ( a1a < a6->uNumVertices );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1007 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1008 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1009 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1010 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1011 if ( BYTE1(v10) & 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1012 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1013 *v9 = a5->x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1014 *a2 = a5->z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1015 if ( a6->uNumVertices )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1016 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1017 v15 = 188 * uModelID + 72;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1018 a5b = a4 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1019 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1020 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1021 v16 = a1a;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1022 a3[2 * a1a] = a6->pXInterceptDisplacements[a1a]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1023 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] + 12 * a6->pVertexIDs[a1a]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1024 *(a5b - 1) = a6->pZInterceptDisplacements[v16]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1025 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] + 12 * a6->pVertexIDs[v16] + 8);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1026 *(__int16 *)((char *)a5b + (int)a3 - (int)a4) = a6->pXInterceptDisplacements[v16 + 1]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1027 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1028 + 12 * a6->pVertexIDs[v16 + 1]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1029 v17 = a6->pZInterceptDisplacements[v16 + 1]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1030 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] + 12 * a6->pVertexIDs[v16 + 1] + 8);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1031 v18 = a5b;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1032 ++a1a;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1033 a5b += 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1034 *v18 = v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1035 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1036 while ( a1a < a6->uNumVertices );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1037 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1038 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1039 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1040 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1041 *v9 = a5->y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1042 *a2 = a5->z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1043 if ( a6->uNumVertices )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1044 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1045 v19 = 188 * uModelID + 72;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1046 a5c = a4 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1047 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1048 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1049 v20 = a1a;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1050 a3[2 * a1a] = a6->pYInterceptDisplacements[a1a]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1051 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] + 12 * a6->pVertexIDs[a1a] + 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1052 *(a5c - 1) = a6->pZInterceptDisplacements[v20]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1053 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] + 12 * a6->pVertexIDs[v20] + 8);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1054 *(__int16 *)((char *)a5c + (int)(char *)a3 - (char *)a4) = a6->pYInterceptDisplacements[v20 + 1]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1055 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1056 + 12 * a6->pVertexIDs[v20 + 1]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1057 + 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1058 v21 = a6->pZInterceptDisplacements[v20 + 1]
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1059 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] + 12 * a6->pVertexIDs[v20 + 1] + 8);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1060 v22 = a5c;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1061 ++a1a;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1062 a5c += 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1063 *v22 = v21;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1064 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1065 while ( a1a < a6->uNumVertices );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1066 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1067 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1068 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1069 LOBYTE(result) = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1070 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1071 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1072
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1073 //----- (004C248E) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1074 void Vis::CastPickRay(RenderVertexSoft *pRay, float fMouseX, float fMouseY, float fPickDepth)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1075 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1076 int v5; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1077 int v6; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1078 int v7; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1079 Vec3_int_ v8; // ST08_12@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1080 int v9; // ST04_4@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1081 int v10; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1082 RenderVertexSoft v11[2]; // [sp+2Ch] [bp-74h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1083 int v12; // [sp+8Ch] [bp-14h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1084 int v13; // [sp+90h] [bp-10h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1085 int outz; // [sp+94h] [bp-Ch]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1086 int outy; // [sp+98h] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1087 int v16; // [sp+9Ch] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1088
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1089 v5 = pIndoorCamera->pos.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1090 v6 = pIndoorCamera->pos.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1091 v13 = pIndoorCamera->pos.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1092 v12 = pIndoorCamera->pos.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1093 v16 = pIndoorCamera->pos.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1094 v7 = pIndoorCamera->sRotationY + UnprojectX((signed __int64)fMouseX);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1095 v8.z = v16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1096 v8.x = v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1097 v8.y = v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1098 v9 = pIndoorCamera->sRotationX + UnprojectY((signed __int64)fMouseY);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1099 v10 = _48B561_mess_with_scaling_along_z(/*(int)&fMouseX, */fPickDepth);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1100 Vec3_int_::Rotate(v10, v7, v9, v8, (int *)&fMouseX, &outy, &outz);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1101 v11[0].flt_2C = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1102 v11[0].vWorldPosition.x = (double)SLODWORD(fMouseX);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1103 v11[0].vWorldPosition.y = (double)outy;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1104 v11[0].vWorldPosition.z = (double)outz;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1105 v11[1].flt_2C = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1106 v11[1].vWorldPosition.x = (double)v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1107 v11[1].vWorldPosition.y = (double)v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1108 v11[1].vWorldPosition.z = (double)v16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1109 memcpy(pRay, &v11[1], 0x30u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1110 memcpy(&pRay[1], v11, sizeof(pRay[1]));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1111 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1112
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1113 //----- (004C2551) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1114 Vis_stru1_stru0 *Vis_stru1::sub_4C2551(int a2, int a3)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1115 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1116 unsigned int v3; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1117 signed int v4; // edx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1118 char *v5; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1119 Vis_stru1_stru0 *result; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1120
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1121 v3 = this->uNumPointers;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1122 v4 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1123 if ( (signed int)v3 <= 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1124 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1125 LABEL_6:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1126 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1127 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1128 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1129 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1130 v5 = (char *)&this->array_0004[0].sZValue;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1131 while ( *((int *)v5 + 1) != a2 || (*(int *)v5 & 0xFFFF) != a3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1132 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1133 ++v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1134 v5 += 12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1135 if ( v4 >= (signed int)v3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1136 goto LABEL_6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1137 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1138 result = &this->array_0004[v4];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1139 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1140 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1141 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1142
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1143 //----- (004C2591) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1144 Vis_stru1_stru0 **Vis_stru1::create_object_pointers(unsigned int flag)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1145 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1146 Vis_stru1_stru0 **result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1147 signed int v3; // esi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1148 Vis_stru1_stru0 *v4; // edx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1149 unsigned __int8 v5; // zf@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1150 unsigned __int8 v6; // sf@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1151 Vis_stru1_stru0 **v7; // ebx@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1152 Vis_stru1_stru0 *v8; // esi@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1153 signed int v9; // edi@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1154 Vis_stru1_stru0 **v10; // edx@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1155 std::string v11; // [sp-18h] [bp-28h]@19
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1156 const char *v12; // [sp-8h] [bp-18h]@19
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1157 int v13; // [sp-4h] [bp-14h]@19
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1158 char v14; // [sp+Ch] [bp-4h]@19
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1159
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1160 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1161 if ( flag )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1162 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1163 if ( flag == 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1164 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1165 v5 = this->uNumPointers == 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1166 v6 = (this->uNumPointers & 0x80000000u) != 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1167 BYTE3(flag) = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1168 if ( !(v6 | v5) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1169 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1170 v7 = this->array_1804;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1171 v8 = this->array_0004;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1172 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1173 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1174 v9 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1175 if ( (signed int)result > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1176 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1177 v10 = this->array_1804;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1178 while ( *v10 != v8 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1179 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1180 ++v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1181 ++v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1182 if ( v9 >= (signed int)result )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1183 goto LABEL_15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1184 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1185 BYTE3(flag) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1186 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1187 LABEL_15:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1188 if ( BYTE3(flag) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1189 *v7 = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1190 result = (Vis_stru1_stru0 **)((char *)result + 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1191 ++v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1192 ++v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1193 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1194 while ( (signed int)result < (signed int)this->uNumPointers );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1195 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1196 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1197 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1198 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1199 MessageBoxW(nullptr, L"Unknown pointer creation flag passed to ::create_object_pointers()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Vis.cpp:1358", 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1200 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1201 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1202 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1203 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1204 v3 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1205 if ( (signed int)this->uNumPointers > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1206 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1207 result = this->array_1804;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1208 v4 = this->array_0004;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1209 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1210 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1211 *result = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1212 ++v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1213 ++result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1214 ++v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1215 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1216 while ( v3 < (signed int)this->uNumPointers );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1217 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1218 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1219 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1220 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1221
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1222 //----- (004C264A) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1223 void Vis::sort_object_pointers(Vis_stru1_stru0 **pPointers, int left, int right)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1224 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1225 int v4; // edx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1226 int v5; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1227 int v6; // esi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1228 signed int i; // ecx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1229 int v8; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1230 int v9; // ebx@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1231 int v10; // ebx@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1232 Vis_stru1_stru0 *v11; // eax@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1233 Vis *thisa; // [sp+4h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1234 Vis_stru1_stru0 *a3a; // [sp+14h] [bp+Ch]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1235
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1236 v4 = left;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1237 v5 = right;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1238 thisa = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1239 if ( right > left )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1240 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1241 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1242 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1243 v6 = v4 - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1244 a3a = pPointers[v5];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1245 for ( i = v5; ; pPointers[i] = v11 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1246 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1247 v8 = a3a->sZValue;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1248 LOWORD(v8) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1249 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1250 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1251 ++v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1252 v9 = pPointers[v6]->sZValue;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1253 LOWORD(v9) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1254 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1255 while ( v9 < (unsigned int)v8 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1256 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1257 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1258 if ( i < 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1259 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1260 --i;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1261 v10 = pPointers[i]->sZValue;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1262 LOWORD(v10) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1263 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1264 while ( v10 > (unsigned int)v8 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1265 v11 = pPointers[v6];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1266 if ( v6 >= i )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1267 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1268 pPointers[v6] = pPointers[i];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1269 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1270 v5 = right;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1271 pPointers[v6] = pPointers[right];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1272 pPointers[right] = v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1273 sort_object_pointers(pPointers, v4, v6 - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1274 v4 = v6 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1275 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1276 while ( right > v6 + 1 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1277 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1278 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1279
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1280 //----- (004C26D0) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1281 bool Vis::SortVerticesByX(RenderVertexD3D3 *a2, unsigned int uStart, unsigned int uEnd)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1282 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1283 bool result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1284 RenderVertexD3D3 *v5; // edx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1285 RenderVertexD3D3 *v6; // esi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1286 void *v7; // edi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1287 unsigned int v8; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1288 RenderVertexD3D3 *v9; // ecx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1289 RenderVertexD3D3 *v10; // ecx@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1290 RenderVertexD3D3 *v11; // eax@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1291 RenderVertexD3D3 v12; // [sp+4h] [bp-4Ch]@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1292 RenderVertexD3D3 v13; // [sp+24h] [bp-2Ch]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1293 Vis *thisa; // [sp+44h] [bp-Ch]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1294 RenderVertexD3D3 *v15; // [sp+48h] [bp-8h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1295 unsigned int v16; // [sp+4Ch] [bp-4h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1296
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1297 result = uEnd;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1298 thisa = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1299 if ( (signed int)uEnd > (signed int)uStart )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1300 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1301 v5 = a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1302 v6 = &a2[uEnd];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1303 v7 = &v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1304 v15 = &a2[uEnd];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1305 v8 = uStart - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1306 v16 = uEnd;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1307 while ( 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1308 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1309 memcpy(v7, v6, 0x20u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1310 v9 = &v5[v8];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1311 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1312 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1313 ++v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1314 ++v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1315 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1316 while ( v9->pos.x < (double)v13.pos.x );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1317 v10 = &v5[v16];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1318 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1319 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1320 --v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1321 --v16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1322 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1323 while ( v10->pos.x > (double)v13.pos.x );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1324 if ( (signed int)v8 >= (signed int)v16 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1325 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1326 v11 = &v5[v16];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1327 memcpy(&v12, &a2[v8], sizeof(v12));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1328 v5 = a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1329 memcpy(&a2[v8], v11, sizeof(a2[v8]));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1330 v6 = &v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1331 v7 = v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1332 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1333 memcpy(&v12, &v5[v8], sizeof(v12));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1334 memcpy(&v5[v8], v15, sizeof(v5[v8]));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1335 memcpy(v15, &v12, 0x20u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1336 SortVerticesByX(v5, uStart, v8 - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1337 SortVerticesByX(a2, v8 + 1, uEnd);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1338 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1339 return true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1340 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1341
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1342 //----- (004C27AD) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1343 bool Vis::SortVerticesByY(RenderVertexD3D3 *a2, unsigned int uStart, unsigned int uEnd)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1344 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1345 bool result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1346 RenderVertexD3D3 *v5; // edx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1347 RenderVertexD3D3 *v6; // esi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1348 RenderVertexD3D3 v7; // qdi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1349 unsigned int v8; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1350 int v9; // ecx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1351 int v10; // ecx@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1352 float v11; // eax@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1353 RenderVertexD3D3 v12; // [sp+4h] [bp-4Ch]@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1354 char v13; // [sp+24h] [bp-2Ch]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1355 float v14; // [sp+28h] [bp-28h]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1356 Vis *thisa; // [sp+44h] [bp-Ch]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1357 RenderVertexD3D3 *v16; // [sp+48h] [bp-8h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1358 unsigned int v17; // [sp+4Ch] [bp-4h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1359
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1360 result = uEnd;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1361 thisa = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1362 if ( (signed int)uEnd > (signed int)uStart )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1363 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1364 v5 = a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1365 v6 = &a2[uEnd];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1366 LODWORD(v7.pos.x) = (int)&v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1367 v16 = &a2[uEnd];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1368 v8 = uStart - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1369 v17 = uEnd;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1370 while ( 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1371 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1372 memcpy(*(void **)&v7.pos.x, v6, 0x20u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1373 v9 = (int)&v5[v8].pos.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1374 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1375 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1376 v9 += 32;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1377 ++v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1378 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1379 while ( *(float *)v9 < (double)v14 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1380 v10 = (int)&v5[v17].pos.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1381 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1382 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1383 v10 -= 32;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1384 --v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1385 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1386 while ( *(float *)v10 > (double)v14 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1387 if ( (signed int)v8 >= (signed int)v17 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1388 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1389 LODWORD(v11) = (int)&v5[v17];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1390 memcpy(&v12, &a2[v8], sizeof(v12));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1391 v5 = a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1392 memcpy(&a2[v8], *(void **)&v11, sizeof(a2[v8]));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1393 v6 = &v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1394 v7.pos.x = v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1395 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1396 memcpy(&v12, &v5[v8], sizeof(v12));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1397 memcpy(&v5[v8], v16, sizeof(v5[v8]));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1398 memcpy(v16, &v12, 0x20u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1399 SortVerticesByY(v5, uStart, v8 - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1400 SortVerticesByY(a2, v8 + 1, uEnd);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1401 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1402 return true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1403 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1404
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1405 //----- (004C288E) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1406 bool Vis::sort_objects_2(RenderVertexSoft *pArray, int sLeft, int sRight)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1407 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1408 bool result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1409 RenderVertexSoft *v5; // edx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1410 int v6; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1411 int i; // ecx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1412 int v8; // esi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1413 int v9; // esi@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1414 RenderVertexSoft *v10; // eax@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1415 RenderVertexSoft v11; // [sp+4h] [bp-6Ch]@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1416 RenderVertexSoft v12; // [sp+34h] [bp-3Ch]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1417 float v13; // [sp+4Ch] [bp-24h]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1418 int v14; // [sp+64h] [bp-Ch]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1419 Vis *thisa; // [sp+68h] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1420 RenderVertexSoft *v16; // [sp+6Ch] [bp-4h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1421
77
8b0c4d626477 Party movement
Nomad
parents: 59
diff changeset
1422 __debugbreak();
8b0c4d626477 Party movement
Nomad
parents: 59
diff changeset
1423
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1424 result = sRight;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1425 thisa = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1426 if ( sRight > sLeft )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1427 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1428 v5 = pArray;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1429 v16 = &pArray[sRight];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1430 v6 = sLeft - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1431 memcpy(&v12, &pArray[sRight], sizeof(v12));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1432 for ( i = sRight; ; i = v14 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1433 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1434 v8 = (int)&v5[v6].vWorldViewProjX;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1435 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1436 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1437 v8 += 48;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1438 ++v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1439 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1440 while ( *(float *)v8 < (double)v13 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1441 v9 = (int)&v5[i].vWorldViewProjX;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1442 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1443 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1444 v9 -= 48;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1445 --i;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1446 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1447 while ( *(float *)v9 > (double)v13 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1448 v14 = i;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1449 if ( v6 >= i )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1450 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1451 v10 = &v5[i];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1452 memcpy(&v11, &pArray[v6], sizeof(v11));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1453 v5 = pArray;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1454 memcpy(&pArray[v6], v10, sizeof(pArray[v6]));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1455 memcpy(v10, &v11, 0x30u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1456 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1457 memcpy(&v11, &v5[v6], sizeof(v11));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1458 memcpy(&v5[v6], v16, sizeof(v5[v6]));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1459 memcpy(v16, &v11, 0x30u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1460 sort_objects_2(v5, sLeft, v6 - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1461 sort_objects_2(pArray, v6 + 1, sRight);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1462 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1463 return true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1464 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1465
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1466 //----- (004C297E) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1467 bool Vis::sort_objects_3(RenderVertexSoft *pArray, int sLeft, int sRight)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1468 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1469 bool result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1470 RenderVertexSoft *v5; // edx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1471 int v6; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1472 int i; // ecx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1473 int v8; // esi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1474 int v9; // esi@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1475 RenderVertexSoft *v10; // eax@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1476 char v11; // [sp+4h] [bp-6Ch]@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1477 RenderVertexSoft v12; // [sp+34h] [bp-3Ch]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1478 float v13; // [sp+50h] [bp-20h]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1479 int v14; // [sp+64h] [bp-Ch]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1480 Vis *thisa; // [sp+68h] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1481 RenderVertexSoft *v16; // [sp+6Ch] [bp-4h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1482
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1483 result = sRight;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1484 thisa = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1485 if ( sRight > sLeft )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1486 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1487 v5 = pArray;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1488 v16 = &pArray[sRight];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1489 v6 = sLeft - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1490 memcpy(&v12, &pArray[sRight], sizeof(v12));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1491 for ( i = sRight; ; i = v14 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1492 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1493 v8 = (int)&v5[v6].vWorldViewProjY;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1494 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1495 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1496 v8 += 48;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1497 ++v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1498 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1499 while ( *(float *)v8 < (double)v13 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1500 v9 = (int)&v5[i].vWorldViewProjY;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1501 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1502 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1503 v9 -= 48;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1504 --i;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1505 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1506 while ( *(float *)v9 > (double)v13 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1507 v14 = i;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1508 if ( v6 >= i )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1509 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1510 v10 = &v5[i];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1511 memcpy(&v11, &pArray[v6], 0x30u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1512 v5 = pArray;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1513 memcpy(&pArray[v6], v10, sizeof(pArray[v6]));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1514 memcpy(v10, &v11, 0x30u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1515 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1516 memcpy(&v11, &v5[v6], 0x30u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1517 memcpy(&v5[v6], v16, sizeof(v5[v6]));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1518 memcpy(v16, &v11, 0x30u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1519 sort_objects_3(v5, sLeft, v6 - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1520 sort_objects_3(pArray, v6 + 1, sRight);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1521 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1522 return true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1523 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1524
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1525
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1526 //----- (004C04AF) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1527 Vis::Vis()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1528 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1529 Vis *v1; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1530 Vis *result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1531 RenderVertexSoft v3; // [sp+Ch] [bp-60h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1532 RenderVertexSoft v4; // [sp+3Ch] [bp-30h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1533
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1534 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1535 v3.flt_2C = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1536 v3.vWorldPosition.x = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1537 v3.vWorldPosition.y = 65536.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1538 v3.vWorldPosition.z = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1539 v4.flt_2C = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1540 v4.vWorldPosition.x = 65536.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1541 v4.vWorldPosition.y = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1542 v4.vWorldPosition.z = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1543 memcpy(&v1->stru_200C, &v4, sizeof(v1->stru_200C));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1544 v4.flt_2C = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1545 v4.vWorldPosition.x = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1546 v4.vWorldPosition.y = 65536.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1547 v4.vWorldPosition.z = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1548 memcpy(&v1->stru_203C, &v3, sizeof(v1->stru_203C));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1549 v3.flt_2C = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1550 v3.vWorldPosition.x = 65536.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1551 v3.vWorldPosition.y = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1552 v3.vWorldPosition.z = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1553 memcpy(&v1->stru_206C, &v3, sizeof(v1->stru_206C));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1554 result = v1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1555 memcpy(&v1->stru_209C, &v4, sizeof(v1->stru_209C));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1556 v1->field_20CC = 512;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1557 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1558
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1559 //----- (004C055C) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1560 Vis_stru1::Vis_stru1()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1561 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1562 for (uint i = 0; i < 512; ++i)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1563 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1564 array_0004[i].pObjectInfo = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1565 array_0004[i].sZValue = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1566 array_0004[i].uObjectType = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1567 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1568 uNumPointers = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1569 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1570
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1571
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1572
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1573
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1574 //----- (004C05CC) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1575 bool Vis::_4C05CC(Vis_stru1 *a2, stru157 *a3, stru157 *a4)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1576 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1577 Vis_stru1 *v4; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1578 Vis *v5; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1579 char *v6; // edi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1580 float v7; // ST00_4@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1581 bool result; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1582 float v9; // [sp+4h] [bp-14h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1583
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1584 v4 = a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1585 v5 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1586 if ( !a2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1587 v4 = &this->stru1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1588 v4->uNumPointers = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1589 v6 = (char *)&this->field_20CC;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1590 v7 = (double)this->field_20CC;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1591 _4C06F8(v7, v4, a3);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1592 v9 = (double)*(signed int *)v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1593 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1594 _4C0D32_BLV(v9, v4, a4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1595 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1596 _4C0DEA_ODM(v9, v4, a4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1597 v4->create_object_pointers(1u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1598 sort_object_pointers(v4->array_1804, 0, v4->uNumPointers - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1599 return true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1600 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1601
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1602 //----- (004C0646) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1603 bool Vis::PickMouse(float fDepth, float fMouseX, float fMouseY, stru157 *a5, stru157 *a6)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1604 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1605 RenderVertexSoft pMouseRay[2]; // [sp+1Ch] [bp-60h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1606
45
bcc051713d20 BLV render & seffects
Nomad
parents: 3
diff changeset
1607 stru1.uNumPointers = 0;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1608 CastPickRay(pMouseRay, fMouseX, fMouseY, fDepth);
45
bcc051713d20 BLV render & seffects
Nomad
parents: 3
diff changeset
1609 PickBillboards(fDepth, fMouseX, fMouseY, &stru1, a5);
3
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
1610 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
45
bcc051713d20 BLV render & seffects
Nomad
parents: 3
diff changeset
1611 PickIndoor(fDepth, pMouseRay, &stru1, a6);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1612 else
45
bcc051713d20 BLV render & seffects
Nomad
parents: 3
diff changeset
1613 PickOutdoor(fDepth, pMouseRay, &stru1, a6, 0);
bcc051713d20 BLV render & seffects
Nomad
parents: 3
diff changeset
1614 stru1.create_object_pointers(0);
bcc051713d20 BLV render & seffects
Nomad
parents: 3
diff changeset
1615 sort_object_pointers(stru1.array_1804, 0, stru1.uNumPointers - 1);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1616 return true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1617 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1618
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1619 //----- (004C06F8) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1620 void Vis::_4C06F8(float arg0, Vis_stru1 *a3, stru157 *a2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1621 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1622 int v4; // ST18_4@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1623 Vis_stru1_stru0 *v5; // edi@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1624 void **v7; // [sp+24h] [bp-8h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1625 unsigned int uD3DBillboardIdx; // [sp+28h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1626
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1627 uD3DBillboardIdx = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1628 auto ecx0 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1629 if ( (signed int)pRenderer->uNumBillboardsToDraw > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1630 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1631 v7 = (void **)&pRenderer->pBillboardRenderListD3D[0].uParentBillboardID;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1632 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1633 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1634 if ( is_part_of_selection((BLVFace *)uD3DBillboardIdx, a2) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1635 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1636 if ( DoesRayIntersectBillboard(arg0, uD3DBillboardIdx) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1637 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1638 v4 = pBillboardRenderList[(int)*v7].sZValue;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1639 v5 = &a3->array_0004[a3->uNumPointers];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1640 v5->pObjectInfo = *v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1641 v5 = (Vis_stru1_stru0 *)((char *)v5 + 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1642 v5->pObjectInfo = (void *)v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1643 v5->sZValue = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1644 ++a3->uNumPointers;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1645 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1646 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1647 ++uD3DBillboardIdx;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1648 v7 += 39;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1649 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1650 while ( (signed int)uD3DBillboardIdx < (signed int)pRenderer->uNumBillboardsToDraw );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1651 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1652 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1653
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1654 //----- (004C0791) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1655 bool Vis::is_part_of_selection(BLVFace *uD3DBillboardIdx_or_pBLVFace_or_pODMFace, stru157 *a2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1656 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1657 stru157 *v3; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1658 int result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1659 int v5; // edx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1660 int v6; // ecx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1661 char v7; // zf@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1662 int v8; // esi@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1663 std::string *v9; // ecx@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1664 Actor *v10; // edi@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1665 char v11; // zf@26
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1666 const char *v12; // [sp-20h] [bp-2Ch]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1667 int v13; // [sp-1Ch] [bp-28h]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1668 std::string v14; // [sp-18h] [bp-24h]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1669 const char *v15; // [sp-8h] [bp-14h]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1670 int v16; // [sp-4h] [bp-10h]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1671
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1672 v3 = a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1673 result = a2->field_0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1674 if ( a2->field_0 != 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1675 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1676 if ( result != 2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1677 || (uCurrentlyLoadedLevelType != LEVEL_Indoor ? (v11 = LOWORD(uD3DBillboardIdx_or_pBLVFace_or_pODMFace[3].pFacePlane.vNormal.y) == 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1678 result = uD3DBillboardIdx_or_pBLVFace_or_pODMFace->pFacePlane_old.dist) : (v11 = pIndoor->pFaceExtras[uD3DBillboardIdx_or_pBLVFace_or_pODMFace->uFaceExtraID].uEventID == 0, result = uD3DBillboardIdx_or_pBLVFace_or_pODMFace->uAttributes),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1679 a2->field_4 != 1) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1680 goto LABEL_16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1681 if ( v11 || result & a2->field_C )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1682 goto LABEL_33;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1683 v7 = (result & a2->field_8) == 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1684 goto LABEL_32;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1685 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1686 v5 = a2->field_10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1687 result = (pBillboardRenderList[pRenderer->pBillboardRenderListD3D[(int)uD3DBillboardIdx_or_pBLVFace_or_pODMFace].uParentBillboardID].sZValue & 0xFFFF) >> 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1688 v6 = pBillboardRenderList[pRenderer->pBillboardRenderListD3D[(int)uD3DBillboardIdx_or_pBLVFace_or_pODMFace].uParentBillboardID].sZValue & 7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1689 if ( v5 & 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1690 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1691 v7 = v6 == a2->field_4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1692 goto LABEL_32;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1693 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1694 if ( v5 & 4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1695 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1696 v8 = a2->field_4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1697 if ( v6 != v8 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1698 goto LABEL_16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1699 if ( v8 != 5 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1700 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1701 v15 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Vis.cpp:207";
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1702 v12 = "Unsupported \"exclusion if no event\" type in CVis::is_part_of_selection";
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1703 LABEL_15:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1704 MessageBoxA(nullptr, v12, v15, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1705 return true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1706 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1707 result *= 32;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1708 if ( *(__int16 *)((char *)&pLevelDecorations[0].uCog + result)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1709 || *(__int16 *)((char *)&pLevelDecorations[0].field_16_event_id + result) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1710 goto LABEL_16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1711 result = pLevelDecorations[result / sizeof(LevelDecoration)].IsInteractive();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1712 goto LABEL_11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1713 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1714 if ( v6 == a2->field_4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1715 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1716 if ( v6 != 3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1717 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1718 v15 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Vis.cpp:245";
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1719 v12 = "Default case reached in VIS";
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1720 goto LABEL_15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1721 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1722 v10 = &pActors[result];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1723 result = 1 << LOBYTE(v10->uAIState);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1724 if ( result & a2->field_C
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1725 || !(result & a2->field_8)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1726 || v5 & 8 && (result = MonsterStats::BelongsToSupertype(v10->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) == 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1727 goto LABEL_33;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1728 if ( !(v3->field_10 & 1) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1729 goto LABEL_16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1730 result = v10->GetActorsRelation(nullptr);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1731 LABEL_11:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1732 v7 = result == 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1733 LABEL_32:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1734 if ( v7 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1735 goto LABEL_33;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1736 LABEL_16:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1737 return true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1738 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1739 LABEL_33:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1740 LOBYTE(result) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1741 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1742 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1743
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1744 //----- (004C091D) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1745 bool Vis::DoesRayIntersectBillboard(float fDepth, unsigned int uD3DBillboardIdx)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1746 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1747 unsigned int v3; // esi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1748 bool result; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1749 int v5; // ecx@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1750 double v6; // st7@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1751 __int16 v7; // fps@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1752 double v8; // st7@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1753 unsigned __int8 v9; // c0@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1754 char v10; // c2@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1755 unsigned __int8 v11; // c3@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1756 Vis_stru1_stru0 *v12; // eax@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1757 __int16 v13; // fps@16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1758 double v14; // st7@16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1759 char v15; // c0@16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1760 char v16; // c2@16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1761 char v17; // c3@16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1762 double v18; // st7@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1763 double v19; // st6@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1764 double v20; // st4@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1765 float v21; // ST0C_4@22
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1766 float v22; // ST08_4@22
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1767 signed int v23; // eax@27
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1768 double v24; // st7@32
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1769 double v25; // st6@32
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1770 float v26; // eax@32
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1771 double v27; // st7@36
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1772 double v28; // st6@36
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1773 __int16 v29; // fps@36
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1774 char v30; // c0@36
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1775 char v31; // c2@36
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1776 char v32; // c3@36
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1777 double v33; // st6@37
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1778 __int16 v34; // fps@37
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1779 char v35; // c0@37
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1780 char v36; // c2@37
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1781 char v37; // c3@37
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1782 __int16 v38; // fps@38
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1783 double v39; // st6@38
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1784 unsigned __int8 v40; // c0@38
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1785 char v41; // c2@38
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1786 unsigned __int8 v42; // c3@38
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1787 __int16 v43; // fps@39
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1788 double v44; // st6@39
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1789 char v45; // c0@39
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1790 char v46; // c2@39
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1791 char v47; // c3@39
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1792 Vis *v48; // esi@40
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1793 float v49; // ST08_4@40
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1794 Vis_stru1_stru0 *v50; // eax@45
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1795 RenderVertexSoft pRay[2]; // [sp+20h] [bp-DCh]@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1796 RenderVertexSoft a3[2]; // [sp+80h] [bp-7Ch]@22
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1797 float v53; // [sp+E0h] [bp-1Ch]@33
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1798 float v54; // [sp+E4h] [bp-18h]@32
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1799 float fBillboardCenterX; // [sp+E8h] [bp-14h]@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1800 float fBillboardCenterY; // [sp+ECh] [bp-10h]@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1801 unsigned int v57; // [sp+F0h] [bp-Ch]@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1802 float v58; // [sp+F4h] [bp-8h]@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1803 Vis *thisa; // [sp+F8h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1804 signed int a3a; // [sp+108h] [bp+Ch]@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1805 float a3b; // [sp+108h] [bp+Ch]@32
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1806
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1807 thisa = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1808
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1809 static Vis_stru1 Vis_static_stru_F91E10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1810
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1811 Vis_static_stru_F91E10.uNumPointers = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1812 v3 = uD3DBillboardIdx;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1813 result = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].uParentBillboardID;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1814 if ( result != -1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1815 && (v5 = pBillboardRenderList[result].sZValue,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1816 v6 = (double)(unsigned __int16)pBillboardRenderList[result].sZValue,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1817 result = v5 >> 16,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1818 v8 = v6 * 0.000015259022 + (double)(v5 >> 16),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1819 //UNDEF(v7),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1820 v9 = v8 < fDepth,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1821 v10 = 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1822 v11 = v8 == fDepth,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1823 BYTE1(result) = HIBYTE(v7),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1824 v9 | v11) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1825 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1826 LOWORD(v5) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1827 v57 = v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1828 GetPolygonCenter(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1829 pRenderer->pBillboardRenderListD3D[v3].pQuards,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1830 4u,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1831 &fBillboardCenterX,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1832 &fBillboardCenterY);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1833 CastPickRay(pRay, fBillboardCenterX, fBillboardCenterY, fDepth);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1834 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1835 PickIndoor(fDepth, pRay, &Vis_static_stru_F91E10, &a5);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1836 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1837 PickOutdoor(fDepth, pRay, &Vis_static_stru_F91E10, &a5, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1838 Vis_static_stru_F91E10.create_object_pointers(0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1839 sort_object_pointers(Vis_static_stru_F91E10.array_1804, 0, Vis_static_stru_F91E10.uNumPointers - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1840 HIWORD(result) = HIWORD(Vis_static_stru_F91E10.uNumPointers);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1841 if ( Vis_static_stru_F91E10.uNumPointers
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1842 && ((signed int)Vis_static_stru_F91E10.uNumPointers <= 0 ? (v12 = 0) : (v12 = Vis_static_stru_F91E10.array_1804[0]),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1843 result = v12->sZValue,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1844 LOWORD(result) = 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1845 result <= v57)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1846 || (double)(signed int)pViewport->uScreenX > fBillboardCenterX
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1847 || (double)(signed int)pViewport->uScreenZ < fBillboardCenterX
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1848 || (double)(signed int)pViewport->uScreenY > fBillboardCenterY
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1849 || (v14 = (double)(signed int)pViewport->uScreenW,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1850 //UNDEF(v13),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1851 v15 = v14 < fBillboardCenterY,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1852 v16 = 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1853 v17 = v14 == fBillboardCenterY,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1854 BYTE1(result) = HIBYTE(v13),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1855 v14 < fBillboardCenterY) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1856 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1857 a3a = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1858 result = (bool)&pRenderer->pBillboardRenderListD3D[v3].pQuards[0].pos.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1859
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1860 __debugbreak();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1861 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1862 LODWORD(v58) = (int)((char *)&pRenderer + v3 * 156 + 1062620);// pBillboardRenderListD3D+0x0C
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1863 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1864
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1865 while ( 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1866 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1867 v18 = *(float *)(result - 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1868 v19 = *(float *)result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1869 v20 = *(float *)(result - 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1870 Vis_static_stru_F91E10.uNumPointers = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1871 if ( v20 >= (double)(signed int)pViewport->uScreenX )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1872 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1873 if ( v18 <= (double)(signed int)pViewport->uScreenZ
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1874 && v19 >= (double)(signed int)pViewport->uScreenY
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1875 && v19 <= (double)(signed int)pViewport->uScreenW )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1876 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1877 v21 = v19;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1878 v22 = v18;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1879 CastPickRay(a3, v22, v21, fDepth);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1880 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1881 PickIndoor(fDepth, a3, &Vis_static_stru_F91E10, &a5);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1882 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1883 PickOutdoor(fDepth, a3, &Vis_static_stru_F91E10, &a5, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1884 Vis_static_stru_F91E10.create_object_pointers(0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1885 sort_object_pointers(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1886 Vis_static_stru_F91E10.array_1804,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1887 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1888 Vis_static_stru_F91E10.uNumPointers - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1889 result = Vis_static_stru_F91E10.uNumPointers;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1890 if ( !Vis_static_stru_F91E10.uNumPointers )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1891 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1892 v23 = (signed int)(Vis_static_stru_F91E10.uNumPointers <= 0 ? 0 : Vis_static_stru_F91E10.array_1804[0]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1893 result = *(int *)(v23 + 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1894 LOWORD(result) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1895 if ( result > v57 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1896 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1897 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1898 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1899 ++a3a;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1900 result = LODWORD(v58) + 32;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1901 LODWORD(v58) += 32;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1902 if ( a3a >= 4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1903 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1904 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1905 goto LABEL_49;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1906 v24 = pRenderer->pBillboardRenderListD3D[v3].pQuards[0].pos.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1907 v25 = pRenderer->pBillboardRenderListD3D[v3].pQuards[3].pos.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1908 v26 = pRenderer->pBillboardRenderListD3D[v3].pQuards[0].pos.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1909 v54 = pRenderer->pBillboardRenderListD3D[v3].pQuards[3].pos.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1910 v58 = v26;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1911 result = LODWORD(pRenderer->pBillboardRenderListD3D[v3].pQuards[1].pos.y);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1912 a3b = pRenderer->pBillboardRenderListD3D[v3].pQuards[1].pos.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1913 if ( v24 > v25 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1914 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1915 v53 = v24;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1916 v24 = v54;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1917 v25 = v53;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1918 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1919 if ( v58 > (double)a3b )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1920 a3b = v58;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1921 if ( (Vis_static_stru_F91E10.uNumPointers = 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1922 v27 = (v25 - v24) * 0.5,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1923 v28 = (double)(signed int)pViewport->uScreenX,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1924 //UNDEF(v29),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1925 v30 = v27 < v28,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1926 v31 = 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1927 v32 = v27 == v28,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1928 BYTE1(result) = HIBYTE(v29),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1929 v27 < v28)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1930 || (v33 = (double)(signed int)pViewport->uScreenZ,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1931 //UNDEF(v34),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1932 v35 = v27 < v33,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1933 v36 = 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1934 v37 = v27 == v33,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1935 BYTE1(result) = HIBYTE(v34),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1936 v27 > v33)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1937 || (v39 = (double)(signed int)pViewport->uScreenY,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1938 //UNDEF(v38),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1939 v40 = v39 < a3b,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1940 v41 = 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1941 v42 = v39 == a3b,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1942 BYTE1(result) = HIBYTE(v38),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1943 !(v40 | v42))
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1944 || (v44 = (double)(signed int)pViewport->uScreenW,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1945 //UNDEF(v43),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1946 v45 = v44 < a3b,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1947 v46 = 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1948 v47 = v44 == a3b,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1949 BYTE1(result) = HIBYTE(v43),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1950 v44 < a3b)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1951 || ((v48 = thisa, v49 = v27, CastPickRay(a3, v49, a3b, fDepth), uCurrentlyLoadedLevelType != LEVEL_Indoor) ? PickOutdoor(fDepth, a3, &Vis_static_stru_F91E10, &a5, 0) : PickIndoor(fDepth, a3, &Vis_static_stru_F91E10, &a5),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1952 (Vis_static_stru_F91E10.create_object_pointers(0),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1953 sort_object_pointers(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1954 Vis_static_stru_F91E10.array_1804,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1955 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1956 Vis_static_stru_F91E10.uNumPointers - 1),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1957 (result = Vis_static_stru_F91E10.uNumPointers) != 0)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1958 && ((signed int)Vis_static_stru_F91E10.uNumPointers <= 0 ? (v50 = 0) : (v50 = Vis_static_stru_F91E10.array_1804[0]),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1959 result = v50->sZValue,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1960 LOWORD(result) = 0,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1961 result <= v57)) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1962 goto LABEL_49;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1963 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1964 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1965 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1966 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1967 LOBYTE(result) = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1968 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1969 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1970 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1971 LABEL_49:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1972 return false;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1973 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1974 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1975 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1976 // F93E18: using guessed type char static_byte_F93E18_init;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1977
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1978 //----- (004C0D32) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1979 int Vis::_4C0D32_BLV(float a1, Vis_stru1 *arg4, stru157 *a2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1980 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1981 int result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1982 signed int v5; // esi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1983 BLVFace *v6; // edi@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1984 unsigned int v7; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1985 Vis_stru1_stru0 *v8; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1986 int v9; // ST18_4@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1987 unsigned int v10; // ST1C_4@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1988 unsigned int v11; // ecx@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1989 signed int i; // [sp+18h] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1990 Vis *thisa; // [sp+1Ch] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1991
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1992 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1993 thisa = this;
116
918dca162239 stru170 -> BspRenderer
Nomad
parents: 77
diff changeset
1994 for ( i = 0; i < (signed int)pBspRenderer->uNumFaceIDs; ++i )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1995 {
116
918dca162239 stru170 -> BspRenderer
Nomad
parents: 77
diff changeset
1996 v5 = pBspRenderer->pFaceIDs[2 * result];
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1997 if ( v5 >= 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1998 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1999 if ( v5 < (signed int)pIndoor->uNumFaces )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2000 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2001 v6 = &pIndoor->pFaces[v5];
59
5159d2e6f559 BLV render
Nomad
parents: 50
diff changeset
2002 if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[v5]) )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2003 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2004 if ( is_part_of_selection(v6, a2) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2005 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2006 v7 = 8 * v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2007 LOBYTE(v7) = 8 * v5 | 6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2008 v8 = _4C1026(v6, v7, a1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2009 if ( v8 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2010 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2011 v9 = v8->sZValue;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2012 v10 = v8->uObjectType;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2013 v11 = 3 * arg4->uNumPointers;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2014 arg4->array_0004[arg4->uNumPointers].pObjectInfo = v8->pObjectInfo;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2015 arg4->array_0004[4 * v11 / 0xC].sZValue = v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2016 arg4->array_0004[4 * v11 / 0xC].uObjectType = v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2017 ++arg4->uNumPointers;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2018 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2019 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2020 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2021 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2022 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2023 result = i + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2024 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2025 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2026 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2027
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2028 //----- (004C0DEA) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2029 void Vis::_4C0DEA_ODM(float arg0, Vis_stru1 *a3, stru157 *a2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2030 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2031 int v4; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2032 BSPModel *v5; // ebx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2033 unsigned __int8 v6; // zf@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2034 char v7; // sf@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2035 unsigned __int8 v8; // of@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2036 ODMFace *v9; // esi@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2037 unsigned int v10; // eax@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2038 Vis_stru1_stru0 *v11; // eax@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2039 unsigned int v12; // ecx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2040 BLVFace f; // [sp+10h] [bp-84h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2041 void *v14; // [sp+70h] [bp-24h]@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2042 int v15; // [sp+74h] [bp-20h]@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2043 unsigned int v16; // [sp+78h] [bp-1Ch]@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2044 int v17; // [sp+7Ch] [bp-18h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2045 Vis *v18; // [sp+80h] [bp-14h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2046 int v19; // [sp+84h] [bp-10h]@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2047 unsigned int v20; // [sp+88h] [bp-Ch]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2048 int v21; // [sp+8Ch] [bp-8h]@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2049 int a1; // [sp+90h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2050
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2051 auto ecx0 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2052 v18 = ecx0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2053 v4 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2054 v17 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2055 a1 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2056 if ( (signed int)pOutdoor->uNumBModels > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2057 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2058 v20 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2059 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2060 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2061 v5 = &pOutdoor->pBModels[v20 / 0xBC];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2062 if ( IsBModelVisible(a1, &v17) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2063 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2064 if ( v17 != v4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2065 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2066 v8 = __OFSUB__(v5->uNumFaces, v4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2067 v6 = v5->uNumFaces == v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2068 v7 = ((v5->uNumFaces - v4) & 0x80000000u) != 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2069 v21 = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2070 if ( !((unsigned __int8)(v7 ^ v8) | v6) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2071 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2072 v19 = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2073 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2074 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2075 v9 = (ODMFace *)((char *)v5->pFaces + v19);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2076 if ( is_part_of_selection((BLVFace *)((char *)v5->pFaces + v19), a2) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2077 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2078 f.FromODM(v9);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2079 v10 = 8 * (v21 | (a1 << 6));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2080 LOBYTE(v10) = v10 | 6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2081 v11 = _4C1026(&f, v10, arg0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2082 if ( v11 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2083 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2084 v14 = v11->pObjectInfo;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2085 v15 = v11->sZValue;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2086 v12 = a3->uNumPointers;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2087 v16 = v11->uObjectType;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2088 v12 *= 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2089 *((int *)&a3->array_0004[0].pObjectInfo + v12) = (int)v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2090 *(&a3->array_0004[0].sZValue + v12) = v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2091 *(&a3->array_0004[0].uObjectType + v12) = v16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2092 ++a3->uNumPointers;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2093 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2094 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2095 ++v21;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2096 v19 += 308;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2097 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2098 while ( v21 < (signed int)v5->uNumFaces );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2099 v4 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2100 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2101 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2102 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2103 ++a1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2104 v20 += 188;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2105 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2106 while ( a1 < (signed int)pOutdoor->uNumBModels );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2107 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2108 }