Mercurial > mm7
comparison DecalBuilder.cpp @ 2245:8817c398b792
for RasterLine2D
author | Ritor1 |
---|---|
date | Tue, 25 Feb 2014 20:02:06 +0600 |
parents | e18200fcfb50 |
children | aff7a7b072b7 |
comparison
equal
deleted
inserted
replaced
2244:66c509997062 | 2245:8817c398b792 |
---|---|
234 v33 = v28; | 234 v33 = v28; |
235 v32 = v23 | (v22 << 8); | 235 v32 = v23 | (v22 << 8); |
236 v29 = v21->radius; | 236 v29 = v21->radius; |
237 //v30 = (int)v21; | 237 //v30 = (int)v21; |
238 //v31 = thisa; | 238 //v31 = thisa; |
239 if ( !this->_49B790_build_decal_geometry(v42, a3, (DecalBuilder_stru0 *)v21, (int)&a5a, SLODWORD(v29), v43, v33, &static_AE4F60, a5, a6, a8) ) | 239 if ( !this->_49B790_build_decal_geometry(v42, a3, (Bloodsplat *)v21, (int)&a5a, SLODWORD(v29), v43, v33, &static_AE4F60, a5, a6, a8) ) |
240 { | 240 { |
241 MessageBoxW(nullptr, L"Error: Failed to build decal geometry", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:114", 0); | 241 MessageBoxW(nullptr, L"Error: Failed to build decal geometry", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:114", 0); |
242 } | 242 } |
243 ++_a7; | 243 ++_a7; |
244 ++a6b; | 244 ++a6b; |
247 } | 247 } |
248 return 1; | 248 return 1; |
249 } | 249 } |
250 | 250 |
251 //----- (0049B790) -------------------------------------------------------- | 251 //----- (0049B790) -------------------------------------------------------- |
252 char DecalBuilder::_49B790_build_decal_geometry(int a2, char a3, DecalBuilder_stru0 *a4, int a5, float a6, unsigned int uColorMultiplier, float a8, stru314 *a9, signed int a10, RenderVertexSoft *a11, char uClipFlags) | 252 char DecalBuilder::_49B790_build_decal_geometry(int a2, char a3, Bloodsplat *a4, int a5, float a6, unsigned int uColorMultiplier, float a8, stru314 *a9, signed int a10, RenderVertexSoft *a11, char uClipFlags) |
253 { | 253 { |
254 DecalBuilder *v12; // esi@1 | 254 //DecalBuilder *v12; // esi@1 |
255 Decal *v13; // edi@2 | 255 Decal *v13; // edi@2 |
256 int *v14; // eax@2 | 256 int *v14; // eax@2 |
257 double v15; // st7@4 | 257 //double v15; // st7@4 |
258 double v16; // st7@4 | 258 //double v16; // st7@4 |
259 int v17; // eax@4 | 259 //int v17; // eax@4 |
260 stru314 *v18; // ebx@4 | 260 //stru314 *v18; // ebx@4 |
261 double v19; // st7@4 | 261 //double v19; // st7@4 |
262 double v20; // st7@4 | 262 //double v20; // st7@4 |
263 double v21; // st7@4 | 263 //double v21; // st7@4 |
264 double v22; // st6@4 | 264 //double v22; // st6@4 |
265 double v23; // st6@4 | 265 //double v23; // st6@4 |
266 double v24; // st5@4 | 266 //double v24; // st5@4 |
267 char *v25; // eax@4 | 267 //char *v25; // eax@4 |
268 signed int v26; // ecx@4 | 268 //signed int v26; // ecx@4 |
269 double v27; // st5@4 | 269 //double v27; // st5@4 |
270 double v28; // st7@5 | 270 double v28; // st7@5 |
271 double v29; // st7@6 | 271 //double v29; // st7@6 |
272 char result; // al@6 | 272 char result; // al@6 |
273 unsigned int *v31; // edi@7 | 273 unsigned int *v31; // edi@7 |
274 RenderVertexSoft *v32; // ebx@8 | 274 RenderVertexSoft *v32; // ebx@8 |
275 std::string *v33; // ecx@15 | 275 std::string *v33; // ecx@15 |
276 int v34; // eax@19 | 276 int v34; // eax@19 |
277 const char *v35; // [sp-Ch] [bp-2Ch]@15 | 277 const char *v35; // [sp-Ch] [bp-2Ch]@15 |
278 int v36; // [sp-8h] [bp-28h]@15 | 278 int v36; // [sp-8h] [bp-28h]@15 |
279 std::string v37; // [sp-4h] [bp-24h]@15 | 279 std::string v37; // [sp-4h] [bp-24h]@15 |
280 float v38; // [sp+8h] [bp-18h]@6 | 280 //float v38; // [sp+8h] [bp-18h]@6 |
281 RenderVertexSoft *v39; // [sp+Ch] [bp-14h]@6 | 281 //RenderVertexSoft *v39; // [sp+Ch] [bp-14h]@6 |
282 unsigned int v40; // [sp+10h] [bp-10h]@6 | 282 //unsigned int v40; // [sp+10h] [bp-10h]@6 |
283 | 283 |
284 int a6a; | 284 //int a6a; |
285 RenderVertexSoft *a8a; | 285 //RenderVertexSoft *a8a; |
286 unsigned int a8b = 0; | 286 unsigned int a8b = 0; |
287 | 287 |
288 v12 = this; | 288 //v12 = this; |
289 if ( a6 == 0.0 ) | 289 if ( a6 == 0.0 ) |
290 return 1; | 290 return 1; |
291 v13 = &this->std__vector_pDecals[this->field_308008]; | 291 v13 = &this->std__vector_pDecals[this->field_308008]; |
292 v14 = &this->std__vector_pDecals[this->field_308008].field_C1C; | 292 v14 = &this->std__vector_pDecals[this->field_308008].field_C1C; |
293 this->std__vector_pDecals[this->field_308008].field_C18 = a4; | 293 this->std__vector_pDecals[this->field_308008].field_C18 = (DecalBuilder_stru0 *)a4; |
294 *v14 = 0; | 294 *v14 = 0; |
295 if ( a3 & 2 ) | 295 if ( a3 & 2 ) |
296 *v14 = 1; | 296 *v14 = 1; |
297 v15 = a6 - a8; | 297 //v15 = a6 - a8; |
298 this->field_30C028 = v15; | 298 this->field_30C028 = a6 - a8; |
299 v16 = sqrt((a6 + a6 - v15) * v15); | 299 //v16 = sqrt((a6 + a6 - this->field_30C028) * this->field_30C028); |
300 v12->field_30C02C = v16; | 300 this->field_30C02C = sqrt((a6 + a6 - this->field_30C028) * this->field_30C028); |
301 v17 = a5; | 301 //v17 = a5; |
302 v18 = a9; | 302 //v18 = a9; |
303 v12->flt_30C030 = 1.0 - (a6 - v16) / a6; | 303 this->flt_30C030 = 1.0 - (a6 - this->field_30C02C) / a6; |
304 v13->field_C08 = (signed __int64)((double)*(signed int *)v17 - a8 * v18->field_4.x); | 304 v13->field_C08 = (signed __int64)((double)*(signed int *)a5 - a8 * a9->field_4.x); |
305 v13->field_C0A = (signed __int64)((double)*(signed int *)(a5 + 4) - a8 * v18->field_4.y); | 305 v13->field_C0A = (signed __int64)((double)*(signed int *)(a5 + 4) - a8 * a9->field_4.y); |
306 v19 = a6; | 306 //v19 = a6; |
307 v13->field_C0C = (signed __int64)((double)*(signed int *)(a5 + 8) - a8 * v18->field_4.z); | 307 v13->field_C0C = (signed __int64)((double)*(signed int *)(a5 + 8) - a8 * a9->field_4.z); |
308 v20 = v19 * v12->flt_30C030; | 308 //v20 = a6 * this->flt_30C030; |
309 a8a = v13->pVertices; | 309 //a8a = v13->pVertices; |
310 v12->field_30C034 = v20; | 310 this->field_30C034 = a6 * this->flt_30C030; |
311 v12->field_30C010 = v20 * v18->field_10.x; | 311 this->field_30C010 = this->field_30C034 * a9->field_10.x; |
312 v12->field_30C014 = v20 * v18->field_10.y; | 312 this->field_30C014 = this->field_30C034 * a9->field_10.y; |
313 v12->field_30C018 = v20 * v18->field_10.z; | 313 this->field_30C018 = this->field_30C034 * a9->field_10.z; |
314 v12->field_30C01C = v20 * v18->field_1C.x; | 314 this->field_30C01C = this->field_30C034 * a9->field_1C.x; |
315 v12->field_30C020 = v20 * v18->field_1C.y; | 315 this->field_30C020 = this->field_30C034 * a9->field_1C.y; |
316 v12->field_30C024 = v20 * v18->field_1C.z; | 316 this->field_30C024 = this->field_30C034 * a9->field_1C.z; |
317 a6a = v13->field_C08; | 317 //a6a = v13->field_C08; |
318 v21 = (double)a6a; | 318 //v21 = (double)v13->field_C08; |
319 v22 = v21 - v12->field_30C01C; | 319 //v22 = (double)v13->field_C08 - this->field_30C01C; |
320 a6a = v13->field_C0A; | 320 //a6a = v13->field_C0A; |
321 v13->pVertices[0].vWorldPosition.x = v22 + v12->field_30C010; | 321 v13->pVertices[0].vWorldPosition.x = (double)v13->field_C08 - this->field_30C01C + this->field_30C010; |
322 v23 = (double)a6a; | 322 v13->pVertices[0].vWorldPosition.y = (double)v13->field_C0A - this->field_30C020 + this->field_30C014; |
323 v24 = v23 - v12->field_30C020 + v12->field_30C014; | 323 v13->pVertices[0].vWorldPosition.z = (double)v13->field_C0A - this->field_30C024 + this->field_30C018; |
324 v25 = (char *)&v13->pVertices[0].vWorldPosition.y; | |
325 a6 = v13->field_C0C; | |
326 v26 = 4; | |
327 v13->pVertices[0].vWorldPosition.y = v24; | |
328 v27 = (double)a6a; | |
329 a6 = v27; | |
330 v13->pVertices[0].vWorldPosition.z = v27 - v12->field_30C024 + v12->field_30C018; | |
331 v13->pVertices[0].u = 0.0; | 324 v13->pVertices[0].u = 0.0; |
332 v13->pVertices[0].v = 0.0; | 325 v13->pVertices[0].v = 0.0; |
333 v13->pVertices[1].vWorldPosition.x = v21 - v12->field_30C01C - v12->field_30C010; | 326 |
334 v13->pVertices[1].vWorldPosition.y = v23 - v12->field_30C020 - v12->field_30C014; | 327 v13->pVertices[1].vWorldPosition.x = (double)v13->field_C08 - this->field_30C01C - this->field_30C010; |
335 v13->pVertices[1].vWorldPosition.z = v27 - v12->field_30C024 - v12->field_30C018; | 328 v13->pVertices[1].vWorldPosition.y = (double)v13->field_C0A - this->field_30C020 - this->field_30C014; |
329 v13->pVertices[1].vWorldPosition.z = (double)v13->field_C0A - this->field_30C024 - this->field_30C018; | |
336 v13->pVertices[1].u = 0.0; | 330 v13->pVertices[1].u = 0.0; |
337 v13->pVertices[1].v = 1.0; | 331 v13->pVertices[1].v = 1.0; |
338 v13->pVertices[2].vWorldPosition.x = v21 + v12->field_30C01C - v12->field_30C010; | 332 |
339 v13->pVertices[2].vWorldPosition.y = v23 + v12->field_30C020 - v12->field_30C014; | 333 v13->pVertices[2].vWorldPosition.x = (double)v13->field_C08 + this->field_30C01C - this->field_30C010; |
340 v13->pVertices[2].vWorldPosition.z = v27 + v12->field_30C024 - v12->field_30C018; | 334 v13->pVertices[2].vWorldPosition.y = (double)v13->field_C0A + this->field_30C020 - this->field_30C014; |
335 v13->pVertices[2].vWorldPosition.z = (double)v13->field_C0A + this->field_30C024 - this->field_30C018; | |
341 v13->pVertices[2].u = 1.0; | 336 v13->pVertices[2].u = 1.0; |
342 v13->pVertices[2].v = 1.0; | 337 v13->pVertices[2].v = 1.0; |
343 v13->pVertices[3].vWorldPosition.x = v21 + v12->field_30C01C + v12->field_30C010; | 338 |
344 v13->pVertices[3].vWorldPosition.y = v23 + v12->field_30C020 + v12->field_30C014; | 339 v13->pVertices[3].vWorldPosition.x = (double)v13->field_C08 + this->field_30C01C + this->field_30C010; |
345 v13->pVertices[3].vWorldPosition.z = a6 + v12->field_30C024 + v12->field_30C018; | 340 v13->pVertices[3].vWorldPosition.y = (double)v13->field_C0A + this->field_30C020 + this->field_30C014; |
341 v13->pVertices[3].vWorldPosition.z = (double)v13->field_C0A + this->field_30C024 + this->field_30C018; | |
346 v13->pVertices[3].u = 1.0; | 342 v13->pVertices[3].u = 1.0; |
347 v13->pVertices[3].v = 0.0; | 343 v13->pVertices[3].v = 0.0; |
348 do | 344 |
349 { | 345 for ( uint i = 0; i < 4; ++i ) |
350 v28 = v18->field_4.y * *(float *)v25 | 346 { |
351 + *((float *)v25 - 1) * v18->field_4.x | 347 v28 = a9->field_4.x * v13->pVertices[i].vWorldPosition.x |
352 + *((float *)v25 + 1) * v18->field_4.z | 348 + a9->field_4.y * v13->pVertices[i].vWorldPosition.y |
353 + v18->dist; | 349 + a9->field_4.z * v13->pVertices[i].vWorldPosition.z |
354 *((float *)v25 - 1) = *((float *)v25 - 1) - v28 * v18->field_4.x; | 350 + a9->dist; |
355 *(float *)v25 = *(float *)v25 - v28 * v18->field_4.y; | 351 v13->pVertices[i].vWorldPosition.x = v13->pVertices[i].vWorldPosition.x - v28 * a9->field_4.x; |
356 v25 += 48; | 352 v13->pVertices[i].vWorldPosition.y = v13->pVertices[i].vWorldPosition.y - v28 * a9->field_4.y; |
357 --v26; | 353 v13->pVertices[i].vWorldPosition.z = v13->pVertices[i].vWorldPosition.z - v28 * a9->field_4.z; |
358 *((float *)v25 - 11) = *((float *)v25 - 11) - v28 * v18->field_4.z; | 354 //v25 += 48; |
359 } | 355 } |
360 while ( v26 ); | |
361 v13->uColorMultiplier = uColorMultiplier; | 356 v13->uColorMultiplier = uColorMultiplier; |
362 //v40 = (unsigned int *)&v13->uNumVertices; | 357 //v40 = (unsigned int *)&v13->uNumVertices; |
363 v39 = v13->pVertices; | 358 //v39 = v13->pVertices; |
364 v13->uNumVertices = 4; | 359 v13->uNumVertices = 4; |
365 v13->field_C14 = a2; | 360 v13->field_C14 = a2; |
366 v29 = v18->field_4.z; | 361 //v29 = a9->field_4.z; |
367 //a6a = (unsigned int *)&v13->uNumVertices; | 362 //a6a = (unsigned int *)&v13->uNumVertices; |
368 v38 = v29; | 363 //v38 = a9->field_4.z; |
369 result = pGame->pStru9Instance->_4980B9(a11, a10, v18->field_4.x, v18->field_4.y, v38, v39, (unsigned int*)&v13->uNumVertices); | 364 result = pGame->pStru9Instance->_4980B9(a11, a10, a9->field_4.x, a9->field_4.y, a9->field_4.z, v13->pVertices, (unsigned int*)&v13->uNumVertices); |
370 if ( result ) | 365 if ( result ) |
371 { | 366 { |
372 //v31 = a6a; | 367 //v31 = a6a; |
373 if ( !v13->uNumVertices ) | 368 if ( !v13->uNumVertices ) |
374 return 1; | 369 return 1; |
375 v32 = a8a; | 370 //v32 = a8a; |
376 //v40 = *a6a; | 371 //v40 = *a6a; |
377 v39 = a8a; | 372 //v39 = a8a; |
378 pGame->pIndoorCameraD3D->ViewTransform(a8a, (unsigned int)v13->uNumVertices); | 373 pGame->pIndoorCameraD3D->ViewTransform(v13->pVertices, (unsigned int)v13->uNumVertices); |
379 v40 = 0; | 374 //v40 = 0; |
380 pGame->pIndoorCameraD3D->Project(v32, v13->uNumVertices, 0); | 375 pGame->pIndoorCameraD3D->Project(v13->pVertices, v13->uNumVertices, 0); |
381 if ( !(uClipFlags & 1) ) | 376 if ( !(uClipFlags & 1) ) |
382 { | 377 { |
383 ++v12->field_308008; | 378 ++this->field_308008; |
384 v34 = 1024; | 379 v34 = 1024; |
385 if ( v12->field_308008 == 1024 ) | 380 if ( this->field_308008 == 1024 ) |
386 v12->field_308008 = 0; | 381 this->field_308008 = 0; |
387 if ( (signed int)(v12->std__vector_pDecals_size + 1) <= 1024 ) | 382 if ( (signed int)(this->std__vector_pDecals_size + 1) <= 1024 ) |
388 v34 = v12->std__vector_pDecals_size + 1; | 383 v34 = this->std__vector_pDecals_size + 1; |
389 v12->std__vector_pDecals_size = v34; | 384 this->std__vector_pDecals_size = v34; |
390 return 1; | 385 return 1; |
391 } | 386 } |
392 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | 387 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) |
393 { | 388 { |
394 if ( uClipFlags & 2 ) | 389 if ( uClipFlags & 2 ) |
395 { | 390 { |
396 v40 = (int)&a8; | 391 //v40 = (int)&a8; |
397 v39 = v12->pVertices; | 392 //v39 = this->pVertices; |
398 __debugbreak(); // warning C4700: uninitialized local variable 'v31' used | 393 //__debugbreak(); // warning C4700: uninitialized local variable 'v31' used |
399 pGame->pIndoorCameraD3D->_436CDC_mess_with_lightmap__clipflag_2(v32, *v31, v12->pVertices, &a8b); | 394 pGame->pIndoorCameraD3D->_436CDC_mess_with_lightmap__clipflag_2(v13->pVertices, v13->uNumVertices, this->pVertices, &a8b); |
400 v40 = (int)v31; | 395 //v40 = (int)v31; |
401 v39 = v12->pVertices; | 396 //v39 = this->pVertices; |
402 pGame->pIndoorCameraD3D->_437143(a8b, v32, v12->pVertices, v31); | 397 pGame->pIndoorCameraD3D->_437143(a8b, v13->pVertices, this->pVertices, (unsigned int *)v13->uNumVertices); |
403 } | 398 } |
404 else if ( uClipFlags & 4 ) | 399 else if ( uClipFlags & 4 ) |
405 { | 400 { |
406 v40 = (int)&a8; | 401 //v40 = (int)&a8; |
407 v39 = v12->pVertices; | 402 //v39 = this->pVertices; |
408 pGame->pIndoorCameraD3D->_436F09_mess_with_lightmap__clipflag_4(v32, *v31, v12->pVertices, &a8b); | 403 pGame->pIndoorCameraD3D->_436F09_mess_with_lightmap__clipflag_4(v13->pVertices, v13->uNumVertices, this->pVertices, &a8b); |
409 v40 = (int)v31; | 404 //v40 = (int)v31; |
410 v39 = v12->pVertices; | 405 //v39 = this->pVertices; |
411 pGame->pIndoorCameraD3D->_437143(a8b, v32, v12->pVertices, v31); | 406 pGame->pIndoorCameraD3D->_437143(a8b, v13->pVertices, this->pVertices, (unsigned int *)v13->uNumVertices); |
412 } | 407 } |
413 else | 408 else |
414 { | 409 MessageBoxA(nullptr, "Undefined clip flag specified", "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:258", 0); |
415 v39 = (RenderVertexSoft *)"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:258"; | |
416 v35 = "Undefined clip flag specified"; | |
417 MessageBoxA(nullptr, v35, (const char *)v39, 0); | |
418 } | |
419 } | 410 } |
420 else | 411 else |
412 MessageBoxA(nullptr, "Lightpoly builder native indoor clipping not implemented", "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:263", 0); | |
413 if ( a8b != 0 ) | |
421 { | 414 { |
422 v39 = (RenderVertexSoft *)"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:263"; | 415 ++this->field_308008; |
423 v35 = "Lightpoly builder native indoor clipping not implemented"; | 416 v34 = 1024; |
424 MessageBoxA(nullptr, v35, (const char *)v39, 0); | 417 if ( this->field_308008 == 1024 ) |
418 this->field_308008 = 0; | |
419 if ( (signed int)(this->std__vector_pDecals_size + 1) <= 1024 ) | |
420 v34 = this->std__vector_pDecals_size + 1; | |
421 this->std__vector_pDecals_size = v34; | |
422 return 1; | |
425 } | 423 } |
426 if ( a8b != 0 ) | |
427 { | |
428 ++v12->field_308008; | |
429 v34 = 1024; | |
430 if ( v12->field_308008 == 1024 ) | |
431 v12->field_308008 = 0; | |
432 if ( (signed int)(v12->std__vector_pDecals_size + 1) <= 1024 ) | |
433 v34 = v12->std__vector_pDecals_size + 1; | |
434 v12->std__vector_pDecals_size = v34; | |
435 return 1; | |
436 } | |
437 result = 1; | 424 result = 1; |
438 } | 425 } |
439 return result; | 426 return result; |
440 } | 427 } |
441 | 428 |