annotate Vis.cpp @ 194:650d96af8855

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