Mercurial > mm7
comparison stru9.cpp @ 1301:18665b8f66b2
yellow points remove
author | Ritor1 |
---|---|
date | Mon, 24 Jun 2013 13:47:13 +0600 |
parents | 7adc8b9b6a25 |
children | 8cd321994943 |
comparison
equal
deleted
inserted
replaced
1300:bedc304ab617 | 1301:18665b8f66b2 |
---|---|
173 return true; | 173 return true; |
174 } | 174 } |
175 | 175 |
176 | 176 |
177 //----- (004985FB) -------------------------------------------------------- | 177 //----- (004985FB) -------------------------------------------------------- |
178 bool stru9::CalcPortalShape(struct RenderVertexSoft *a1, signed int a2, struct RenderVertexSoft *a3, unsigned int *pOutNumVertices, struct Vec3_float_ *a5, float a6, char *a7, int unused) | 178 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) |
179 { | 179 { |
180 RenderVertexSoft *v9; // ecx@1 | 180 //RenderVertexSoft *v9; // ecx@1 |
181 Vec3_float_ *v10; // esi@1 | 181 //Vec3_float_ *v10; // esi@1 |
182 //char *v11; // ebx@1 | 182 //char *v11; // ebx@1 |
183 RenderVertexSoft *v12; // edi@1 | 183 //RenderVertexSoft *pVertices; // edi@1 |
184 double v13; // st7@1 | 184 double pLinelength1; // st7@1 |
185 //bool result; // eax@4 | 185 //bool result; // eax@4 |
186 signed int v15; // edx@9 | 186 signed int v15; // edx@9 |
187 RenderVertexSoft *v16; // ecx@9 | 187 RenderVertexSoft *pLineEnd; // ecx@9 |
188 double v17; // st7@9 | 188 double pLinelength2; // st7@9 |
189 double v18; // st6@12 | 189 double t; // st6@12 |
190 signed int v19; // [sp+Ch] [bp-Ch]@7 | 190 signed int v19; // [sp+Ch] [bp-Ch]@7 |
191 float v20; // [sp+10h] [bp-8h]@1 | 191 //float v20; // [sp+10h] [bp-8h]@1 |
192 bool v21; // [sp+14h] [bp-4h]@2 | 192 bool v21; // [sp+14h] [bp-4h]@2 |
193 | 193 |
194 v9 = a1; | 194 //v9 = a1; |
195 v10 = a5; | 195 //v10 = a5; |
196 //v11 = (char *)&a1->vWorldPosition.z; | 196 //v11 = (char *)&a1->vWorldPosition.z; |
197 auto v11 = a1; | 197 auto pLineStart = &a1[0]; |
198 v12 = a3; | 198 //pVertices = a3; |
199 v13 = a1->vWorldPosition.y * a5->y + a5->x * a1->vWorldPosition.x + a1->vWorldPosition.z * a5->z; | 199 pLinelength1 = a5->x * a1[0].vWorldPosition.x + a1[0].vWorldPosition.y * a5->y + a1[0].vWorldPosition.z * a5->z; |
200 v20 = v13; | 200 //v20 = v13; |
201 v21 = v13 >= a6; | 201 v21 = pLinelength1 >= a6; |
202 | 202 |
203 *pOutNumVertices = 0; | 203 *pOutNumVertices = 0; |
204 if ( a2 <= 0 ) | 204 if ( a2 <= 0 ) |
205 return false; | 205 return false; |
206 v19 = 1; | 206 v19 = 1; |
207 | |
207 while ( 1 ) | 208 while ( 1 ) |
208 { | 209 { |
209 if ( v21 ) | 210 if ( v21 ) |
210 { | 211 { |
211 ++a3; | 212 //++pVertices; |
212 memcpy(v12, v11, sizeof(RenderVertexSoft)); | 213 memcpy(pVertices, pLineStart, sizeof(RenderVertexSoft)); |
213 ++*pOutNumVertices; | 214 ++*pOutNumVertices; |
214 v10 = a5; | 215 //v10 = a5; |
215 v12 = a3; | 216 pVertices++; |
216 v9 = a1; | 217 //v9 = a1; |
217 } | 218 } |
218 v15 = 0; | 219 v15 = 0; |
219 v16 = &v9[v19 % a2]; | 220 pLineEnd = &a1[v19 % a2]; |
220 v17 = v16->vWorldPosition.z * v10->z + v16->vWorldPosition.y * v10->y + v10->x * v16->vWorldPosition.x; | 221 pLinelength2 = a5->x * pLineEnd->vWorldPosition.x + pLineEnd->vWorldPosition.y * a5->y + pLineEnd->vWorldPosition.z * a5->z; |
221 if ( v17 >= a6 ) | 222 if ( pLinelength2 >= a6 ) |
222 v15 = 1; | 223 v15 = 1; |
224 | |
223 if ( v21 != v15 ) | 225 if ( v21 != v15 ) |
224 { | 226 { |
225 v18 = (a6 - v20) / (v17 - v20); | 227 t = (a6 - pLinelength1) / (pLinelength2 - pLinelength1); |
226 v12->vWorldPosition.x = (v16->vWorldPosition.x - v11->vWorldPosition.x) * v18 + v11->vWorldPosition.x; | 228 pVertices->vWorldPosition.x = pLineStart->vWorldPosition.x + (pLineEnd->vWorldPosition.x - pLineStart->vWorldPosition.x) * t; |
227 v12->vWorldPosition.y = (v16->vWorldPosition.y - v11->vWorldPosition.y) * v18 + v11->vWorldPosition.y; | 229 pVertices->vWorldPosition.y = pLineStart->vWorldPosition.y + (pLineEnd->vWorldPosition.y - pLineStart->vWorldPosition.y) * t; |
228 v12->vWorldPosition.z = (v16->vWorldPosition.z - v11->vWorldPosition.z) * v18 + v11->vWorldPosition.z; | 230 pVertices->vWorldPosition.z = pLineStart->vWorldPosition.z + (pLineEnd->vWorldPosition.z - pLineStart->vWorldPosition.z) * t; |
229 v12->u = (v16->u - v11->u) * v18 + v11->u; | 231 pVertices->u = pLineStart->u + (pLineEnd->u - pLineStart->u) * t; |
230 v12->v = (v16->v - v11->v) * v18 + v11->v; | 232 pVertices->v = pLineStart->v + (pLineEnd->v - pLineStart->v) * t; |
231 ++v12; | 233 ++pVertices; |
232 a3 = v12; | 234 //a3 = pVertices; |
233 ++*pOutNumVertices; | 235 ++*pOutNumVertices; |
234 *a7 = 1; | 236 *a7 = 1; |
235 } | 237 } |
236 | 238 |
237 v11++; | 239 pLineStart++; |
238 v21 = v15; | 240 v21 = v15; |
239 v20 = v17; | 241 pLinelength1 = pLinelength2; |
240 if ( v19 >= a2 ) | 242 if ( v19 >= a2 ) |
241 break; | 243 break; |
242 v9 = a1; | 244 //v9 = a1; |
243 v19++; | 245 v19++; |
244 } | 246 } |
245 | 247 |
246 return *pOutNumVertices >= 3; | 248 return *pOutNumVertices >= 3; |
247 } | 249 } |