annotate stru9.cpp @ 2291:69661f22ff03

stru319::PlayerHitOrMiss moved to Player class, cleaned up a bit, stru319::ActorHitOrMiss moved to Actor class, cleaned up a bit
author Grumpy7
date Sun, 16 Mar 2014 19:11:52 +0100
parents aff7a7b072b7
children ddb803517a48
rev   line source
2253
aff7a7b072b7 adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents: 1980
diff changeset
1 #define _CRT_SECURE_NO_WARNINGS
0
Ritor1
parents:
diff changeset
2 #include "stru9.h"
Ritor1
parents:
diff changeset
3 #include "IndoorCameraD3D.h"
Ritor1
parents:
diff changeset
4
Ritor1
parents:
diff changeset
5 #include "mm7_data.h"
Ritor1
parents:
diff changeset
6
Ritor1
parents:
diff changeset
7
Ritor1
parents:
diff changeset
8
Ritor1
parents:
diff changeset
9 //----- (00498377) --------------------------------------------------------
1188
Ritor1
parents: 795
diff changeset
10 bool stru9::_498377(struct RenderVertexSoft *pPortalBounding, unsigned int uNumVertices, struct IndoorCameraD3D_Vec4 *pVertices, struct RenderVertexSoft *pVertices2, unsigned int *pOutNumVertices)
0
Ritor1
parents:
diff changeset
11 {
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
12 int result; // eax@7
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
13 //unsigned int *v7; // ebx@7
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
14 //char *v8; // esi@8
0
Ritor1
parents:
diff changeset
15 RenderVertexSoft *v9; // ecx@9
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
16 //double v10; // st7@12
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
17 //double v11; // st6@12
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
18 //RenderVertexSoft *v12; // esi@13
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
19 //int v13; // ecx@25
691
c93f29773f84 Bsp render seems to work
Nomad
parents: 687
diff changeset
20 //VertexBuffer *v14; // edx@26
c93f29773f84 Bsp render seems to work
Nomad
parents: 687
diff changeset
21 //char *v15; // eax@26
c93f29773f84 Bsp render seems to work
Nomad
parents: 687
diff changeset
22 //unsigned int i; // ecx@26
1188
Ritor1
parents: 795
diff changeset
23 //int v17; // [sp+0h] [bp-28h]@9
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
24 //char *v18; // [sp+10h] [bp-18h]@8
0
Ritor1
parents:
diff changeset
25 RenderVertexSoft *v19; // [sp+14h] [bp-14h]@0
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
26 //RenderVertexSoft *v20; // [sp+18h] [bp-10h]@0
0
Ritor1
parents:
diff changeset
27 signed int v21; // [sp+1Ch] [bp-Ch]@7
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
28 //RenderVertexSoft *a2; // [sp+20h] [bp-8h]@8
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
29 //stru9 *thisa; // [sp+24h] [bp-4h]@1
0
Ritor1
parents:
diff changeset
30 signed int a3a; // [sp+38h] [bp+10h]@12
691
c93f29773f84 Bsp render seems to work
Nomad
parents: 687
diff changeset
31 //int a3b; // [sp+38h] [bp+10h]@25
0
Ritor1
parents:
diff changeset
32
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
33 //__debugbreak();
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
34 //thisa = this;
1195
1f92c110a4f2 indoor sub_424829
zipi
parents: 1188
diff changeset
35 return true;
0
Ritor1
parents:
diff changeset
36
Ritor1
parents:
diff changeset
37 static RenderVertexSoft static_AE3FB4;
691
c93f29773f84 Bsp render seems to work
Nomad
parents: 687
diff changeset
38 /*static bool __init_flag1 = false;
0
Ritor1
parents:
diff changeset
39 if (!__init_flag1)
Ritor1
parents:
diff changeset
40 {
Ritor1
parents:
diff changeset
41 __init_flag1 = true;
Ritor1
parents:
diff changeset
42
Ritor1
parents:
diff changeset
43 static_AE3FB4.flt_2C = 0.0;
691
c93f29773f84 Bsp render seems to work
Nomad
parents: 687
diff changeset
44 }*/
0
Ritor1
parents:
diff changeset
45
Ritor1
parents:
diff changeset
46 static stru312 static_AE3FA4; // idb
691
c93f29773f84 Bsp render seems to work
Nomad
parents: 687
diff changeset
47 /*static bool __init_flag2 = false;
0
Ritor1
parents:
diff changeset
48 if (!__init_flag2)
Ritor1
parents:
diff changeset
49 {
Ritor1
parents:
diff changeset
50 __init_flag2 = true;
Ritor1
parents:
diff changeset
51
Ritor1
parents:
diff changeset
52 //stru312::stru312(&static_AE3FA4);
691
c93f29773f84 Bsp render seems to work
Nomad
parents: 687
diff changeset
53 }*/
0
Ritor1
parents:
diff changeset
54
Ritor1
parents:
diff changeset
55 static VertexBuffer static_AE33A0; // idb
691
c93f29773f84 Bsp render seems to work
Nomad
parents: 687
diff changeset
56 /*static bool __init_flag3 = false;
0
Ritor1
parents:
diff changeset
57 if (!__init_flag3)
Ritor1
parents:
diff changeset
58 {
Ritor1
parents:
diff changeset
59 __init_flag3 = true;
Ritor1
parents:
diff changeset
60
Ritor1
parents:
diff changeset
61 //VertexBuffer::VertexBuffer(&static_AE33A0);
691
c93f29773f84 Bsp render seems to work
Nomad
parents: 687
diff changeset
62 }*/
0
Ritor1
parents:
diff changeset
63
1188
Ritor1
parents: 795
diff changeset
64 result = false;
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
65 //v7 = pOutNumVertices;
0
Ritor1
parents:
diff changeset
66 v21 = 0;
Ritor1
parents:
diff changeset
67 if ( (signed int)uNumVertices <= 0 )
Ritor1
parents:
diff changeset
68 {
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
69 *pOutNumVertices = 0;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
70 return true;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
71 }
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
72 //a2 = a1;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
73 //v8 = (char *)&a3->y;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
74 //v18 = (char *)&a3->y;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
75 //do
1188
Ritor1
parents: 795
diff changeset
76 for (uint j = 0; j < uNumVertices; j++ )
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
77 {
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
78 //v17 = result + 1;
1188
Ritor1
parents: 795
diff changeset
79 result = j;
Ritor1
parents: 795
diff changeset
80 v9 = &pPortalBounding[(j + 1) % (signed int)uNumVertices];
794
Nomad
parents: 716
diff changeset
81 if ( pPortalBounding->vWorldPosition.x != v9->vWorldPosition.x
Nomad
parents: 716
diff changeset
82 || pPortalBounding->vWorldPosition.y != v9->vWorldPosition.y
Nomad
parents: 716
diff changeset
83 || pPortalBounding->vWorldPosition.z != v9->vWorldPosition.z )
0
Ritor1
parents:
diff changeset
84 {
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
85 //v10 = a3->z;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
86 //v11 = a3->y;
0
Ritor1
parents:
diff changeset
87 ++v21;
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
88 //result = 0;
0
Ritor1
parents:
diff changeset
89 static_AE33A0.uNumVertices = 0;
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
90 //a3a = 0;
1188
Ritor1
parents: 795
diff changeset
91 static_AE3FA4.x = pVertices->x;
Ritor1
parents: 795
diff changeset
92 static_AE3FA4.y = pVertices->y;
Ritor1
parents: 795
diff changeset
93 static_AE3FA4.z = pVertices->z;
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
94 if ( (signed int)*pOutNumVertices <= 0 )
0
Ritor1
parents:
diff changeset
95 {
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
96 *pOutNumVertices = 0;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
97 return true;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
98 }
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
99 //do
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
100 for ( int i = 0; i < (signed int)*pOutNumVertices; i++ )
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
101 {
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
102 //v12 = &pVertices[result];
0
Ritor1
parents:
diff changeset
103 if ( result )
Ritor1
parents:
diff changeset
104 {
1188
Ritor1
parents: 795
diff changeset
105 if ( _4989E1(&pVertices2[i], &pVertices2[i], pPortalBounding, &static_AE3FA4)
Ritor1
parents: 795
diff changeset
106 && _498774(&pVertices2[i], &pVertices2[i], pPortalBounding, &static_AE3FA4, &static_AE3FB4) )
0
Ritor1
parents:
diff changeset
107 AddVertex(&static_AE33A0, &static_AE3FB4);
Ritor1
parents:
diff changeset
108 }
Ritor1
parents:
diff changeset
109 else
Ritor1
parents:
diff changeset
110 {
1188
Ritor1
parents: 795
diff changeset
111 v19 = &pVertices2[i];
0
Ritor1
parents:
diff changeset
112 }
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
113 //v20 = v12;
1287
Ritor1
parents: 1188
diff changeset
114 if ( AreVectorsCollinear(&pVertices2[i], pPortalBounding, &static_AE3FA4) )
1188
Ritor1
parents: 795
diff changeset
115 AddVertex(&static_AE33A0, &pVertices2[i]);
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
116 //pOutNumVertices = pOutNumVertices;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
117 //a3a++;
0
Ritor1
parents:
diff changeset
118 }
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
119 //while ( a3a < (signed int)*pOutNumVertices );
0
Ritor1
parents:
diff changeset
120 if ( !static_AE33A0.uNumVertices )
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
121 {
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
122 *pOutNumVertices = 0;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
123 return true;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
124 }
1188
Ritor1
parents: 795
diff changeset
125 if ( _4989E1(&pVertices2[result], v19, pPortalBounding, &static_AE3FA4)
Ritor1
parents: 795
diff changeset
126 && _498774(&pVertices2[result], v19, pPortalBounding, &static_AE3FA4, &static_AE3FB4) )
0
Ritor1
parents:
diff changeset
127 AddVertex(&static_AE33A0, &static_AE3FB4);
691
c93f29773f84 Bsp render seems to work
Nomad
parents: 687
diff changeset
128
c93f29773f84 Bsp render seems to work
Nomad
parents: 687
diff changeset
129 for (uint i = 0; i < static_AE33A0.uNumVertices; ++i)
c93f29773f84 Bsp render seems to work
Nomad
parents: 687
diff changeset
130 {
1188
Ritor1
parents: 795
diff changeset
131 pVertices2[i].vWorldPosition.x = static_AE33A0.pVertices[i].vWorldPosition.x;
Ritor1
parents: 795
diff changeset
132 pVertices2[i].vWorldPosition.y = static_AE33A0.pVertices[i].vWorldPosition.y;
Ritor1
parents: 795
diff changeset
133 pVertices2[i].vWorldPosition.z = static_AE33A0.pVertices[i].vWorldPosition.z;
Ritor1
parents: 795
diff changeset
134 pVertices2[i].u = static_AE33A0.pVertices[i].u;
Ritor1
parents: 795
diff changeset
135 pVertices2[i].v = static_AE33A0.pVertices[i].v;
691
c93f29773f84 Bsp render seems to work
Nomad
parents: 687
diff changeset
136 }
c93f29773f84 Bsp render seems to work
Nomad
parents: 687
diff changeset
137
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
138 //v13 = static_AE33A0.uNumVertices;
691
c93f29773f84 Bsp render seems to work
Nomad
parents: 687
diff changeset
139 /*a3b = 0;
0
Ritor1
parents:
diff changeset
140 if ( static_AE33A0.uNumVertices > 0 )
Ritor1
parents:
diff changeset
141 {
Ritor1
parents:
diff changeset
142 v14 = &static_AE33A0;
Ritor1
parents:
diff changeset
143 v15 = (char *)&pVertices->vWorldPosition.y;
Ritor1
parents:
diff changeset
144 for ( i = (char *)&static_AE33A0.pVertices[0].vWorldPosition.y - (char *)pVertices;
Ritor1
parents:
diff changeset
145 ;
Ritor1
parents:
diff changeset
146 i = (char *)&static_AE33A0.pVertices[0].vWorldPosition.y - (char *)pVertices )
Ritor1
parents:
diff changeset
147 {
Ritor1
parents:
diff changeset
148 ++a3b;
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
149 pVertices->vWorldPosition.x = v14->pVertices[0].vWorldPosition.x;
0
Ritor1
parents:
diff changeset
150 v14 = (VertexBuffer *)((char *)v14 + 48);
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
151 pVertices->vWorldPosition.y = *(float *)&v15[(char *)&static_AE33A0 - (char *)pVertices];
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
152 pVertices->vWorldPosition.z = *(float *)&v15[i];
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
153 pVertices->u = *(float *)&v15[(char *)&static_AE33A0.pVertices[0]._rhw - (char *)pVertices];
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
154 pVertices->v = *(float *)&v15[(char *)&static_AE33A0.pVertices[0].u - (char *)pVertices];
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
155 //static_AE33A0.uNumVertices = static_AE33A0.uNumVertices;
0
Ritor1
parents:
diff changeset
156 v15 += 48;
Ritor1
parents:
diff changeset
157 if ( a3b >= static_AE33A0.uNumVertices )
Ritor1
parents:
diff changeset
158 break;
Ritor1
parents:
diff changeset
159 }
691
c93f29773f84 Bsp render seems to work
Nomad
parents: 687
diff changeset
160 }*/
c93f29773f84 Bsp render seems to work
Nomad
parents: 687
diff changeset
161
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
162 //v7 = pOutNumVertices;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
163 //a3->y = a3->y;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
164 *pOutNumVertices = static_AE33A0.uNumVertices;
0
Ritor1
parents:
diff changeset
165 }
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
166 //result = v17;
794
Nomad
parents: 716
diff changeset
167 ++pPortalBounding;
1188
Ritor1
parents: 795
diff changeset
168 pVertices++;
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
169 //v18 = (char *)&a3->y;
0
Ritor1
parents:
diff changeset
170 }
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
171 //while ( v17 < (signed int)uNumVertices );
0
Ritor1
parents:
diff changeset
172 if ( v21 < 3 )
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
173 *pOutNumVertices = 0;
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
174 return true;
0
Ritor1
parents:
diff changeset
175 }
687
687b4365ee84 Indoor Portal
Ritor1
parents: 436
diff changeset
176
0
Ritor1
parents:
diff changeset
177
Ritor1
parents:
diff changeset
178 //----- (004985FB) --------------------------------------------------------
1301
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
179 bool stru9::CalcPortalShape(struct RenderVertexSoft *a1, signed int a2, struct RenderVertexSoft *pVertices, unsigned int *pOutNumVertices, struct Vec3_float_ *a5, float a6, char *a7, int unused)
0
Ritor1
parents:
diff changeset
180 {
1301
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
181 //RenderVertexSoft *v9; // ecx@1
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
182 //Vec3_float_ *v10; // esi@1
0
Ritor1
parents:
diff changeset
183 //char *v11; // ebx@1
1301
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
184 //RenderVertexSoft *pVertices; // edi@1
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
185 double pLinelength1; // st7@1
0
Ritor1
parents:
diff changeset
186 //bool result; // eax@4
Ritor1
parents:
diff changeset
187 signed int v15; // edx@9
1301
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
188 RenderVertexSoft *pLineEnd; // ecx@9
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
189 double pLinelength2; // st7@9
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
190 double t; // st6@12
0
Ritor1
parents:
diff changeset
191 signed int v19; // [sp+Ch] [bp-Ch]@7
1301
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
192 //float v20; // [sp+10h] [bp-8h]@1
0
Ritor1
parents:
diff changeset
193 bool v21; // [sp+14h] [bp-4h]@2
Ritor1
parents:
diff changeset
194
1301
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
195 //v9 = a1;
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
196 //v10 = a5;
0
Ritor1
parents:
diff changeset
197 //v11 = (char *)&a1->vWorldPosition.z;
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1924
diff changeset
198 RenderVertexSoft* pLineStart = &a1[0];
1301
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
199 //pVertices = a3;
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
200 pLinelength1 = a5->x * a1[0].vWorldPosition.x + a1[0].vWorldPosition.y * a5->y + a1[0].vWorldPosition.z * a5->z;
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
201 //v20 = v13;
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
202 v21 = pLinelength1 >= a6;
0
Ritor1
parents:
diff changeset
203
Ritor1
parents:
diff changeset
204 *pOutNumVertices = 0;
Ritor1
parents:
diff changeset
205 if ( a2 <= 0 )
Ritor1
parents:
diff changeset
206 return false;
Ritor1
parents:
diff changeset
207 v19 = 1;
1301
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
208
0
Ritor1
parents:
diff changeset
209 while ( 1 )
Ritor1
parents:
diff changeset
210 {
Ritor1
parents:
diff changeset
211 if ( v21 )
Ritor1
parents:
diff changeset
212 {
1301
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
213 //++pVertices;
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
214 memcpy(pVertices, pLineStart, sizeof(RenderVertexSoft));
0
Ritor1
parents:
diff changeset
215 ++*pOutNumVertices;
1301
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
216 //v10 = a5;
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
217 pVertices++;
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
218 //v9 = a1;
0
Ritor1
parents:
diff changeset
219 }
Ritor1
parents:
diff changeset
220 v15 = 0;
1301
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
221 pLineEnd = &a1[v19 % a2];
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
222 pLinelength2 = a5->x * pLineEnd->vWorldPosition.x + pLineEnd->vWorldPosition.y * a5->y + pLineEnd->vWorldPosition.z * a5->z;
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
223 if ( pLinelength2 >= a6 )
0
Ritor1
parents:
diff changeset
224 v15 = 1;
1301
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
225
0
Ritor1
parents:
diff changeset
226 if ( v21 != v15 )
Ritor1
parents:
diff changeset
227 {
1301
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
228 t = (a6 - pLinelength1) / (pLinelength2 - pLinelength1);
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
229 pVertices->vWorldPosition.x = pLineStart->vWorldPosition.x + (pLineEnd->vWorldPosition.x - pLineStart->vWorldPosition.x) * t;
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
230 pVertices->vWorldPosition.y = pLineStart->vWorldPosition.y + (pLineEnd->vWorldPosition.y - pLineStart->vWorldPosition.y) * t;
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
231 pVertices->vWorldPosition.z = pLineStart->vWorldPosition.z + (pLineEnd->vWorldPosition.z - pLineStart->vWorldPosition.z) * t;
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
232 pVertices->u = pLineStart->u + (pLineEnd->u - pLineStart->u) * t;
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
233 pVertices->v = pLineStart->v + (pLineEnd->v - pLineStart->v) * t;
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
234 ++pVertices;
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
235 //a3 = pVertices;
0
Ritor1
parents:
diff changeset
236 ++*pOutNumVertices;
Ritor1
parents:
diff changeset
237 *a7 = 1;
Ritor1
parents:
diff changeset
238 }
Ritor1
parents:
diff changeset
239
1301
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
240 pLineStart++;
0
Ritor1
parents:
diff changeset
241 v21 = v15;
1301
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
242 pLinelength1 = pLinelength2;
0
Ritor1
parents:
diff changeset
243 if ( v19 >= a2 )
Ritor1
parents:
diff changeset
244 break;
1301
18665b8f66b2 yellow points remove
Ritor1
parents: 1288
diff changeset
245 //v9 = a1;
0
Ritor1
parents:
diff changeset
246 v19++;
Ritor1
parents:
diff changeset
247 }
Ritor1
parents:
diff changeset
248
Ritor1
parents:
diff changeset
249 return *pOutNumVertices >= 3;
Ritor1
parents:
diff changeset
250 }
Ritor1
parents:
diff changeset
251
Ritor1
parents:
diff changeset
252 //----- (00498737) --------------------------------------------------------
Ritor1
parents:
diff changeset
253 void stru9::AddVertex(struct VertexBuffer *pVertexBuffer, struct RenderVertexSoft *pVertex)
Ritor1
parents:
diff changeset
254 {
436
4a42c2f97aa2 some itemgen crashes fixed
Gloval
parents: 168
diff changeset
255 // __debugbreak();
0
Ritor1
parents:
diff changeset
256 RenderVertexSoft *v3; // eax@1
Ritor1
parents:
diff changeset
257
Ritor1
parents:
diff changeset
258 v3 = &pVertexBuffer->pVertices[pVertexBuffer->uNumVertices];
Ritor1
parents:
diff changeset
259 v3->vWorldPosition.x = pVertex->vWorldPosition.x;
Ritor1
parents:
diff changeset
260 v3->vWorldPosition.y = pVertex->vWorldPosition.y;
Ritor1
parents:
diff changeset
261 v3->vWorldPosition.z = pVertex->vWorldPosition.z;
Ritor1
parents:
diff changeset
262 v3->u = pVertex->u;
Ritor1
parents:
diff changeset
263 v3->v = pVertex->v;
Ritor1
parents:
diff changeset
264 ++pVertexBuffer->uNumVertices;
Ritor1
parents:
diff changeset
265 }
Ritor1
parents:
diff changeset
266
Ritor1
parents:
diff changeset
267 //----- (00498774) --------------------------------------------------------
Ritor1
parents:
diff changeset
268 bool stru9::_498774(struct RenderVertexSoft *a1, struct RenderVertexSoft *a2, struct RenderVertexSoft *a3, struct stru312 *a4, struct RenderVertexSoft *a5)
Ritor1
parents:
diff changeset
269 {
Ritor1
parents:
diff changeset
270 RenderVertexSoft *v6; // ecx@5
1924
8cd321994943 MSVS 2012 project file & some compilation warning fixes
Nomad
parents: 1301
diff changeset
271 int result; // eax@5
0
Ritor1
parents:
diff changeset
272 double v8; // st7@5
Ritor1
parents:
diff changeset
273 __int16 v9; // fps@5
Ritor1
parents:
diff changeset
274 double v10; // st7@6
Ritor1
parents:
diff changeset
275 double v11; // st6@8
Ritor1
parents:
diff changeset
276 double v12; // st6@18
Ritor1
parents:
diff changeset
277 char v13; // c0@24
Ritor1
parents:
diff changeset
278 char v14; // c2@24
Ritor1
parents:
diff changeset
279 char v15; // c3@24
Ritor1
parents:
diff changeset
280 float a1a; // [sp+10h] [bp+8h]@5
Ritor1
parents:
diff changeset
281
Ritor1
parents:
diff changeset
282 __debugbreak();
Ritor1
parents:
diff changeset
283
Ritor1
parents:
diff changeset
284 static stru312 static_AE3388;
Ritor1
parents:
diff changeset
285 static stru312 static_AE3378;
Ritor1
parents:
diff changeset
286
Ritor1
parents:
diff changeset
287 v6 = a1;
Ritor1
parents:
diff changeset
288 static_AE3378.x = a1->vWorldPosition.x - a3->vWorldPosition.x;
Ritor1
parents:
diff changeset
289 static_AE3378.y = a1->vWorldPosition.y - a3->vWorldPosition.y;
Ritor1
parents:
diff changeset
290 HIWORD(result) = HIWORD(a4);
Ritor1
parents:
diff changeset
291 static_AE3378.z = a1->vWorldPosition.z - a3->vWorldPosition.z;
Ritor1
parents:
diff changeset
292 static_AE3388.x = a2->vWorldPosition.x - a1->vWorldPosition.x;
Ritor1
parents:
diff changeset
293 static_AE3388.y = a2->vWorldPosition.y - a1->vWorldPosition.y;
Ritor1
parents:
diff changeset
294 static_AE3388.z = a2->vWorldPosition.z - a1->vWorldPosition.z;
Ritor1
parents:
diff changeset
295 a1a = static_AE3388.x * a4->x + static_AE3388.z * a4->z + static_AE3388.y * a4->y;
Ritor1
parents:
diff changeset
296 v8 = static_AE3378.x * a4->x + static_AE3378.z * a4->z + static_AE3378.y * a4->y;
Ritor1
parents:
diff changeset
297 //UNDEF(v9);
Ritor1
parents:
diff changeset
298 if ( a1a != 0.0 )
Ritor1
parents:
diff changeset
299 {
Ritor1
parents:
diff changeset
300 v10 = -(v8 / a1a);
Ritor1
parents:
diff changeset
301 if ( a1a <= 0.0 )
Ritor1
parents:
diff changeset
302 {
Ritor1
parents:
diff changeset
303 if ( v10 <= 0.0 )
Ritor1
parents:
diff changeset
304 v12 = 0.0;
Ritor1
parents:
diff changeset
305 else
Ritor1
parents:
diff changeset
306 v12 = v10;
Ritor1
parents:
diff changeset
307 if ( v12 <= 1.0 )
Ritor1
parents:
diff changeset
308 {
Ritor1
parents:
diff changeset
309 if ( v10 <= 0.0 )
Ritor1
parents:
diff changeset
310 v10 = (float)0.0;
Ritor1
parents:
diff changeset
311 }
Ritor1
parents:
diff changeset
312 else
Ritor1
parents:
diff changeset
313 {
Ritor1
parents:
diff changeset
314 v10 = 1.0;
Ritor1
parents:
diff changeset
315 }
Ritor1
parents:
diff changeset
316 }
Ritor1
parents:
diff changeset
317 else
Ritor1
parents:
diff changeset
318 {
Ritor1
parents:
diff changeset
319 if ( v10 >= 1.0 )
Ritor1
parents:
diff changeset
320 v11 = 1.0;
Ritor1
parents:
diff changeset
321 else
Ritor1
parents:
diff changeset
322 v11 = v10;
Ritor1
parents:
diff changeset
323 if ( v11 >= 0.0 )
Ritor1
parents:
diff changeset
324 {
Ritor1
parents:
diff changeset
325 if ( v10 >= 1.0 )
Ritor1
parents:
diff changeset
326 v10 = (float)1.0;
Ritor1
parents:
diff changeset
327 }
Ritor1
parents:
diff changeset
328 else
Ritor1
parents:
diff changeset
329 {
Ritor1
parents:
diff changeset
330 v10 = 0.0;
Ritor1
parents:
diff changeset
331 }
Ritor1
parents:
diff changeset
332 }
Ritor1
parents:
diff changeset
333 result = (bool)a5;
Ritor1
parents:
diff changeset
334 a5->vWorldPosition.x = (a2->vWorldPosition.x - v6->vWorldPosition.x) * v10 + v6->vWorldPosition.x;
Ritor1
parents:
diff changeset
335 a5->vWorldPosition.y = (a2->vWorldPosition.y - v6->vWorldPosition.y) * v10 + v6->vWorldPosition.y;
Ritor1
parents:
diff changeset
336 a5->vWorldPosition.z = (a2->vWorldPosition.z - v6->vWorldPosition.z) * v10 + v6->vWorldPosition.z;
Ritor1
parents:
diff changeset
337 a5->u = (a2->u - v6->u) * v10 + v6->u;
Ritor1
parents:
diff changeset
338 a5->v = (a2->v - v6->v) * v10 + v6->v;
Ritor1
parents:
diff changeset
339 goto LABEL_15;
Ritor1
parents:
diff changeset
340 }
Ritor1
parents:
diff changeset
341 v13 = v8 < 0.0;
Ritor1
parents:
diff changeset
342 v14 = 0;
Ritor1
parents:
diff changeset
343 v15 = v8 == 0.0;
Ritor1
parents:
diff changeset
344 BYTE1(result) = HIBYTE(v9);
Ritor1
parents:
diff changeset
345 if ( v8 < 0.0 )
Ritor1
parents:
diff changeset
346 {
Ritor1
parents:
diff changeset
347 LABEL_15:
Ritor1
parents:
diff changeset
348 LOBYTE(result) = 1;
Ritor1
parents:
diff changeset
349 return result;
Ritor1
parents:
diff changeset
350 }
Ritor1
parents:
diff changeset
351 LOBYTE(result) = 0;
Ritor1
parents:
diff changeset
352 return result;
Ritor1
parents:
diff changeset
353 }
Ritor1
parents:
diff changeset
354 // AE3398: using guessed type char static_init_flag__AE3388_bit1__AE3378_bit2;
Ritor1
parents:
diff changeset
355
Ritor1
parents:
diff changeset
356 //----- (0049895A) --------------------------------------------------------
Ritor1
parents:
diff changeset
357 bool stru9::AreVectorsCollinear(struct RenderVertexSoft *a1, struct RenderVertexSoft *a2, struct stru312 *a3)
Ritor1
parents:
diff changeset
358 {
Ritor1
parents:
diff changeset
359 static stru312 static_F942A0;
Ritor1
parents:
diff changeset
360
Ritor1
parents:
diff changeset
361 static_F942A0.x = a1->vWorldPosition.x - a2->vWorldPosition.x;
Ritor1
parents:
diff changeset
362 static_F942A0.y = a1->vWorldPosition.y - a2->vWorldPosition.y;
Ritor1
parents:
diff changeset
363 static_F942A0.z = a1->vWorldPosition.z - a2->vWorldPosition.z;
Ritor1
parents:
diff changeset
364
Ritor1
parents:
diff changeset
365 static float flt_F942B4 = static_F942A0.z * a3->z + static_F942A0.y * a3->y + static_F942A0.x * a3->x;
Ritor1
parents:
diff changeset
366 if (flt_F942B4 >= 0)
Ritor1
parents:
diff changeset
367 return true;
Ritor1
parents:
diff changeset
368 return false;
Ritor1
parents:
diff changeset
369 }
Ritor1
parents:
diff changeset
370
Ritor1
parents:
diff changeset
371
Ritor1
parents:
diff changeset
372 //----- (004989E1) --------------------------------------------------------
Ritor1
parents:
diff changeset
373 bool stru9::_4989E1(struct RenderVertexSoft *a1, struct RenderVertexSoft *a2, struct RenderVertexSoft *a3, struct stru312 *a4)
Ritor1
parents:
diff changeset
374 {
Ritor1
parents:
diff changeset
375 bool r1;
Ritor1
parents:
diff changeset
376 bool r2;
Ritor1
parents:
diff changeset
377
Ritor1
parents:
diff changeset
378 r1 = AreVectorsCollinear(a1, a3, a4);
Ritor1
parents:
diff changeset
379 r2 = AreVectorsCollinear(a2, a3, a4);
Ritor1
parents:
diff changeset
380 return !r1 && r2 == 1 ||
Ritor1
parents:
diff changeset
381 r1 == 1 && !r2;
Ritor1
parents:
diff changeset
382 }
Ritor1
parents:
diff changeset
383
Ritor1
parents:
diff changeset
384 //----- (004980B9) --------------------------------------------------------
Ritor1
parents:
diff changeset
385 bool stru9::_4980B9(RenderVertexSoft *a1, unsigned int uNumVertices, float a3, float a4, float a5, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices)
Ritor1
parents:
diff changeset
386 {
Ritor1
parents:
diff changeset
387 RenderVertexSoft *v12; // ecx@9
Ritor1
parents:
diff changeset
388 double v13; // st7@12
Ritor1
parents:
diff changeset
389 double v14; // st6@12
Ritor1
parents:
diff changeset
390 double v15; // st5@12
Ritor1
parents:
diff changeset
391 signed int v25; // [sp+18h] [bp-Ch]@7
Ritor1
parents:
diff changeset
392
Ritor1
parents:
diff changeset
393 static RenderVertexSoft stru_AE4BFC;
Ritor1
parents:
diff changeset
394 static stru312 static_sub_4980B9_stru_AE4BEC; // idb
Ritor1
parents:
diff changeset
395 static VertexBuffer static_sub_4980B9_stru_AE3FE8; // idb
Ritor1
parents:
diff changeset
396
Ritor1
parents:
diff changeset
397 v25 = 0;
Ritor1
parents:
diff changeset
398 if (uNumVertices <= 0)
Ritor1
parents:
diff changeset
399 {
Ritor1
parents:
diff changeset
400 *pOutNumVertices = 0;
Ritor1
parents:
diff changeset
401 return true;
Ritor1
parents:
diff changeset
402 }
Ritor1
parents:
diff changeset
403
Ritor1
parents:
diff changeset
404 for (uint i = 0; i < uNumVertices; ++i)
Ritor1
parents:
diff changeset
405 {
Ritor1
parents:
diff changeset
406 v12 = &a1[(i + 1) % uNumVertices];
Ritor1
parents:
diff changeset
407 if (a1[i].vWorldPosition.x != v12->vWorldPosition.x ||
Ritor1
parents:
diff changeset
408 a1[i].vWorldPosition.y != v12->vWorldPosition.y ||
Ritor1
parents:
diff changeset
409 a1[i].vWorldPosition.z!= v12->vWorldPosition.z)
Ritor1
parents:
diff changeset
410 {
Ritor1
parents:
diff changeset
411 v13 = v12->vWorldPosition.x - a1[i].vWorldPosition.x;
Ritor1
parents:
diff changeset
412 v14 = v12->vWorldPosition.y - a1[i].vWorldPosition.y;
Ritor1
parents:
diff changeset
413 v15 = v12->vWorldPosition.z - a1[i].vWorldPosition.z;
Ritor1
parents:
diff changeset
414 ++v25;
Ritor1
parents:
diff changeset
415
Ritor1
parents:
diff changeset
416 static_sub_4980B9_stru_AE3FE8.uNumVertices = 0;
Ritor1
parents:
diff changeset
417 static_sub_4980B9_stru_AE4BEC.x = a4 * v15 - v14 * a5;
Ritor1
parents:
diff changeset
418 static_sub_4980B9_stru_AE4BEC.y = v13 * a5 - v15 * a3;
Ritor1
parents:
diff changeset
419 static_sub_4980B9_stru_AE4BEC.z = v14 * a3 - v13 * a4;
Ritor1
parents:
diff changeset
420 if (*pOutNumVertices == 0)
Ritor1
parents:
diff changeset
421 return true;
Ritor1
parents:
diff changeset
422
Ritor1
parents:
diff changeset
423 for (uint j = 0; j < *pOutNumVertices; ++j)
Ritor1
parents:
diff changeset
424 {
Ritor1
parents:
diff changeset
425 if (j)
Ritor1
parents:
diff changeset
426 {
Ritor1
parents:
diff changeset
427 if (_4989E1(&pOutVertices[j - 1], &pOutVertices[j], &a1[i], &static_sub_4980B9_stru_AE4BEC) &&
Ritor1
parents:
diff changeset
428 _498774(&pOutVertices[j - 1], &pOutVertices[j], &a1[i], &static_sub_4980B9_stru_AE4BEC, &stru_AE4BFC))
Ritor1
parents:
diff changeset
429 AddVertex(&static_sub_4980B9_stru_AE3FE8, &stru_AE4BFC);
Ritor1
parents:
diff changeset
430 }
Ritor1
parents:
diff changeset
431
Ritor1
parents:
diff changeset
432 if (AreVectorsCollinear(&pOutVertices[j], &a1[i], &static_sub_4980B9_stru_AE4BEC))
Ritor1
parents:
diff changeset
433 AddVertex(&static_sub_4980B9_stru_AE3FE8, &pOutVertices[j]);
Ritor1
parents:
diff changeset
434 }
Ritor1
parents:
diff changeset
435
Ritor1
parents:
diff changeset
436 if (!static_sub_4980B9_stru_AE3FE8.uNumVertices)
Ritor1
parents:
diff changeset
437 {
Ritor1
parents:
diff changeset
438 *pOutNumVertices = 0;
Ritor1
parents:
diff changeset
439 return true;
Ritor1
parents:
diff changeset
440 }
Ritor1
parents:
diff changeset
441 if (_4989E1(&pOutVertices[*pOutNumVertices - 1], &pOutVertices[0], &a1[i], &static_sub_4980B9_stru_AE4BEC) &&
Ritor1
parents:
diff changeset
442 _498774(&pOutVertices[*pOutNumVertices - 1], &pOutVertices[0], &a1[i], &static_sub_4980B9_stru_AE4BEC, &stru_AE4BFC) )
Ritor1
parents:
diff changeset
443 AddVertex(&static_sub_4980B9_stru_AE3FE8, &stru_AE4BFC);
Ritor1
parents:
diff changeset
444
Ritor1
parents:
diff changeset
445 for (uint j = 0; j < static_sub_4980B9_stru_AE3FE8.uNumVertices; ++j)
Ritor1
parents:
diff changeset
446 {
Ritor1
parents:
diff changeset
447 pOutVertices[j].vWorldPosition.y = static_sub_4980B9_stru_AE3FE8.pVertices[j].vWorldPosition.x;
Ritor1
parents:
diff changeset
448 pOutVertices[j].vWorldPosition.y = static_sub_4980B9_stru_AE3FE8.pVertices[j].vWorldPosition.y;
Ritor1
parents:
diff changeset
449 pOutVertices[j].vWorldPosition.z = static_sub_4980B9_stru_AE3FE8.pVertices[j].vWorldPosition.z;
Ritor1
parents:
diff changeset
450 pOutVertices[j].u = static_sub_4980B9_stru_AE3FE8.pVertices[j].u;
Ritor1
parents:
diff changeset
451 pOutVertices[j].v = static_sub_4980B9_stru_AE3FE8.pVertices[j].v;
Ritor1
parents:
diff changeset
452 }
Ritor1
parents:
diff changeset
453 *pOutNumVertices = static_sub_4980B9_stru_AE3FE8.uNumVertices;
Ritor1
parents:
diff changeset
454 }
Ritor1
parents:
diff changeset
455 }
Ritor1
parents:
diff changeset
456
Ritor1
parents:
diff changeset
457 if (v25 < 3)
Ritor1
parents:
diff changeset
458 *pOutNumVertices = 0;
Ritor1
parents:
diff changeset
459
Ritor1
parents:
diff changeset
460 return true;
Ritor1
parents:
diff changeset
461 }
Ritor1
parents:
diff changeset
462 // AE4C2C: using guessed type char static_sub_4980B9_byte_AE4C2C_init_flag;