comparison DecalBuilder.cpp @ 1077:2210109f280d

DecalBuilder, AI_SpellAttack sparkles
author zipi
date Sat, 25 May 2013 18:46:48 +0100
parents 9b6e252658e8
children 81a30c2e3e0a
comparison
equal deleted inserted replaced
1076:9b6e252658e8 1077:2210109f280d
126 double v24; // st7@21 126 double v24; // st7@21
127 int v25; // ebx@21 127 int v25; // ebx@21
128 double v26; // st7@21 128 double v26; // st7@21
129 int v27; // edi@21 129 int v27; // edi@21
130 double v28; // st7@21 130 double v28; // st7@21
131 int v29; // ST10_4@21 131 float v29; // ST10_4@21
132 int v30; // ST08_4@21 132 int v30; // ST08_4@21
133 //DecalBuilder *v31; // esi@21 133 //DecalBuilder *v31; // esi@21
134 int v32; // [sp+4h] [bp-44h]@18 134 int v32; // [sp+4h] [bp-44h]@18
135 RenderVertexSoft *v33; // [sp+8h] [bp-40h]@21 135 float v33; // [sp+8h] [bp-40h]@21
136 stru314 *v34; // [sp+Ch] [bp-3Ch]@21 136 stru314 *v34; // [sp+Ch] [bp-3Ch]@21
137 float v35; // [sp+10h] [bp-38h]@21 137 float v35; // [sp+10h] [bp-38h]@21
138 float v36; // [sp+14h] [bp-34h]@17 138 float v36; // [sp+14h] [bp-34h]@17
139 int v37; // [sp+18h] [bp-30h]@17 139 int v37; // [sp+18h] [bp-30h]@17
140 int a5a; // [sp+28h] [bp-20h]@21 140 int a5a; // [sp+28h] [bp-20h]@21
235 //LODWORD(v36) = (uint32)a6; 235 //LODWORD(v36) = (uint32)a6;
236 a5a = v25; 236 a5a = v25;
237 v39 = v27; 237 v39 = v27;
238 LODWORD(v35) = a5; 238 LODWORD(v35) = a5;
239 v34 = &static_AE4F60; 239 v34 = &static_AE4F60;
240 *(float *)&v33 = v28; 240 v33 = v28;
241 v32 = v23 | (v22 << 8); 241 v32 = v23 | (v22 << 8);
242 *(float *)&v29 = v21->radius; 242 v29 = v21->radius;
243 v30 = (int)v21; 243 //v30 = (int)v21;
244 //v31 = thisa; 244 //v31 = thisa;
245 if ( !this->_49B790_build_decal_geometry(v42, a3, v30, (int)&a5a, v29, v43, v33, &static_AE4F60, a5, a6, a8) ) 245 if ( !this->_49B790_build_decal_geometry(v42, a3, (DecalBuilder_stru0 *)v21, (int)&a5a, SLODWORD(v29), v43, v33, &static_AE4F60, a5, a6, a8) )
246 { 246 {
247 MessageBoxW(nullptr, L"Error: Failed to build decal geometry", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:114", 0); 247 MessageBoxW(nullptr, L"Error: Failed to build decal geometry", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:114", 0);
248 } 248 }
249 ++_a7; 249 ++_a7;
250 ++a6b; 250 ++a6b;
253 } 253 }
254 return 1; 254 return 1;
255 } 255 }
256 256
257 //----- (0049B790) -------------------------------------------------------- 257 //----- (0049B790) --------------------------------------------------------
258 char DecalBuilder::_49B790_build_decal_geometry(int a2, char a3, int a4, int a5, int a6, unsigned int uColorMultiplier, RenderVertexSoft *a8, stru314 *a9, signed int a10, RenderVertexSoft *a11, char uClipFlags) 258 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)
259 { 259 {
260 DecalBuilder *v12; // esi@1 260 DecalBuilder *v12; // esi@1
261 Decal *v13; // edi@2 261 Decal *v13; // edi@2
262 char *v14; // eax@2 262 int *v14; // eax@2
263 double v15; // st7@4 263 double v15; // st7@4
264 double v16; // st7@4 264 double v16; // st7@4
265 int v17; // eax@4 265 int v17; // eax@4
266 stru314 *v18; // ebx@4 266 stru314 *v18; // ebx@4
267 double v19; // st7@4 267 double v19; // st7@4
283 const char *v35; // [sp-Ch] [bp-2Ch]@15 283 const char *v35; // [sp-Ch] [bp-2Ch]@15
284 int v36; // [sp-8h] [bp-28h]@15 284 int v36; // [sp-8h] [bp-28h]@15
285 std::string v37; // [sp-4h] [bp-24h]@15 285 std::string v37; // [sp-4h] [bp-24h]@15
286 float v38; // [sp+8h] [bp-18h]@6 286 float v38; // [sp+8h] [bp-18h]@6
287 RenderVertexSoft *v39; // [sp+Ch] [bp-14h]@6 287 RenderVertexSoft *v39; // [sp+Ch] [bp-14h]@6
288 unsigned int *v40; // [sp+10h] [bp-10h]@6 288 unsigned int v40; // [sp+10h] [bp-10h]@6
289
290 int a6a;
291 RenderVertexSoft *a8a;
292 unsigned int a8b = 0;
289 293
290 v12 = this; 294 v12 = this;
291 if ( *(float *)&a6 == 0.0 ) 295 if ( a6 == 0.0 )
292 goto LABEL_24; 296 return 1;
293 v13 = &this->std__vector_pDecals[this->field_308008]; 297 v13 = &this->std__vector_pDecals[this->field_308008];
294 v14 = (char *)&this->std__vector_pDecals[this->field_308008].field_C1C; 298 v14 = &this->std__vector_pDecals[this->field_308008].field_C1C;
295 this->std__vector_pDecals[this->field_308008].field_C18 = (DecalBuilder_stru0 *)a4; 299 this->std__vector_pDecals[this->field_308008].field_C18 = a4;
296 *(int *)v14 = 0; 300 *v14 = 0;
297 if ( a3 & 2 ) 301 if ( a3 & 2 )
298 *(int *)v14 = 1; 302 *v14 = 1;
299 v15 = *(float *)&a6 - *(float *)&a8; 303 v15 = a6 - a8;
300 *(float *)&this->field_30C028 = v15; 304 this->field_30C028 = v15;
301 v16 = sqrt((*(float *)&a6 + *(float *)&a6 - v15) * v15); 305 v16 = sqrt((a6 + a6 - v15) * v15);
302 *(float *)&v12->field_30C02C = v16; 306 v12->field_30C02C = v16;
303 v17 = a5; 307 v17 = a5;
304 v18 = a9; 308 v18 = a9;
305 v12->flt_30C030 = 1.0 - (*(float *)&a6 - v16) / *(float *)&a6; 309 v12->flt_30C030 = 1.0 - (a6 - v16) / a6;
306 v13->field_C08 = (signed __int64)((double)*(signed int *)v17 - *(float *)&a8 * v18->field_4.x); 310 v13->field_C08 = (signed __int64)((double)*(signed int *)v17 - a8 * v18->field_4.x);
307 v13->field_C0A = (signed __int64)((double)*(signed int *)(a5 + 4) - *(float *)&a8 * v18->field_4.y); 311 v13->field_C0A = (signed __int64)((double)*(signed int *)(a5 + 4) - a8 * v18->field_4.y);
308 v19 = *(float *)&a6; 312 v19 = a6;
309 v13->field_C0C = (signed __int64)((double)*(signed int *)(a5 + 8) - *(float *)&a8 * v18->field_4.z); 313 v13->field_C0C = (signed __int64)((double)*(signed int *)(a5 + 8) - a8 * v18->field_4.z);
310 v20 = v19 * v12->flt_30C030; 314 v20 = v19 * v12->flt_30C030;
311 a8 = v13->pVertices; 315 a8a = v13->pVertices;
312 v12->field_30C034 = v20; 316 v12->field_30C034 = v20;
313 v12->field_30C010 = v20 * v18->field_10.x; 317 v12->field_30C010 = v20 * v18->field_10.x;
314 v12->field_30C014 = v20 * v18->field_10.y; 318 v12->field_30C014 = v20 * v18->field_10.y;
315 v12->field_30C018 = v20 * v18->field_10.z; 319 v12->field_30C018 = v20 * v18->field_10.z;
316 v12->field_30C01C = v20 * v18->field_1C.x; 320 v12->field_30C01C = v20 * v18->field_1C.x;
317 v12->field_30C020 = v20 * v18->field_1C.y; 321 v12->field_30C020 = v20 * v18->field_1C.y;
318 v12->field_30C024 = v20 * v18->field_1C.z; 322 v12->field_30C024 = v20 * v18->field_1C.z;
319 a6 = v13->field_C08; 323 a6a = v13->field_C08;
320 v21 = (double)a6; 324 v21 = (double)a6a;
321 v22 = v21 - v12->field_30C01C; 325 v22 = v21 - v12->field_30C01C;
322 a6 = v13->field_C0A; 326 a6a = v13->field_C0A;
323 v13->pVertices[0].vWorldPosition.x = v22 + v12->field_30C010; 327 v13->pVertices[0].vWorldPosition.x = v22 + v12->field_30C010;
324 v23 = (double)a6; 328 v23 = (double)a6a;
325 v24 = v23 - v12->field_30C020 + v12->field_30C014; 329 v24 = v23 - v12->field_30C020 + v12->field_30C014;
326 v25 = (char *)&v13->pVertices[0].vWorldPosition.y; 330 v25 = (char *)&v13->pVertices[0].vWorldPosition.y;
327 a6 = v13->field_C0C; 331 a6 = v13->field_C0C;
328 v26 = 4; 332 v26 = 4;
329 v13->pVertices[0].vWorldPosition.y = v24; 333 v13->pVertices[0].vWorldPosition.y = v24;
330 v27 = (double)a6; 334 v27 = (double)a6a;
331 *(float *)&a6 = v27; 335 a6 = v27;
332 v13->pVertices[0].vWorldPosition.z = v27 - v12->field_30C024 + v12->field_30C018; 336 v13->pVertices[0].vWorldPosition.z = v27 - v12->field_30C024 + v12->field_30C018;
333 v13->pVertices[0].u = 0.0; 337 v13->pVertices[0].u = 0.0;
334 v13->pVertices[0].v = 0.0; 338 v13->pVertices[0].v = 0.0;
335 v13->pVertices[1].vWorldPosition.x = v21 - v12->field_30C01C - v12->field_30C010; 339 v13->pVertices[1].vWorldPosition.x = v21 - v12->field_30C01C - v12->field_30C010;
336 v13->pVertices[1].vWorldPosition.y = v23 - v12->field_30C020 - v12->field_30C014; 340 v13->pVertices[1].vWorldPosition.y = v23 - v12->field_30C020 - v12->field_30C014;
342 v13->pVertices[2].vWorldPosition.z = v27 + v12->field_30C024 - v12->field_30C018; 346 v13->pVertices[2].vWorldPosition.z = v27 + v12->field_30C024 - v12->field_30C018;
343 v13->pVertices[2].u = 1.0; 347 v13->pVertices[2].u = 1.0;
344 v13->pVertices[2].v = 1.0; 348 v13->pVertices[2].v = 1.0;
345 v13->pVertices[3].vWorldPosition.x = v21 + v12->field_30C01C + v12->field_30C010; 349 v13->pVertices[3].vWorldPosition.x = v21 + v12->field_30C01C + v12->field_30C010;
346 v13->pVertices[3].vWorldPosition.y = v23 + v12->field_30C020 + v12->field_30C014; 350 v13->pVertices[3].vWorldPosition.y = v23 + v12->field_30C020 + v12->field_30C014;
347 v13->pVertices[3].vWorldPosition.z = *(float *)&a6 + v12->field_30C024 + v12->field_30C018; 351 v13->pVertices[3].vWorldPosition.z = a6 + v12->field_30C024 + v12->field_30C018;
348 v13->pVertices[3].u = 1.0; 352 v13->pVertices[3].u = 1.0;
349 v13->pVertices[3].v = 0.0; 353 v13->pVertices[3].v = 0.0;
350 do 354 do
351 { 355 {
352 v28 = v18->field_4.y * *(float *)v25 356 v28 = v18->field_4.y * *(float *)v25
359 --v26; 363 --v26;
360 *((float *)v25 - 11) = *((float *)v25 - 11) - v28 * v18->field_4.z; 364 *((float *)v25 - 11) = *((float *)v25 - 11) - v28 * v18->field_4.z;
361 } 365 }
362 while ( v26 ); 366 while ( v26 );
363 v13->uColorMultiplier = uColorMultiplier; 367 v13->uColorMultiplier = uColorMultiplier;
364 v40 = (unsigned int *)&v13->uNumVertices; 368 //v40 = (unsigned int *)&v13->uNumVertices;
365 v39 = v13->pVertices; 369 v39 = v13->pVertices;
366 v13->uNumVertices = 4; 370 v13->uNumVertices = 4;
367 v13->field_C14 = a2; 371 v13->field_C14 = a2;
368 v29 = v18->field_4.z; 372 v29 = v18->field_4.z;
369 a6 = (int)&v13->uNumVertices; 373 //a6a = (unsigned int *)&v13->uNumVertices;
370 v38 = v29; 374 v38 = v29;
371 result = pGame->pStru9Instance->_4980B9(a11, a10, v18->field_4.x, v18->field_4.y, v38, v39, v40); 375 result = pGame->pStru9Instance->_4980B9(a11, a10, v18->field_4.x, v18->field_4.y, v38, v39, (unsigned int*)&v13->uNumVertices);
372 if ( result ) 376 if ( result )
373 { 377 {
374 v31 = (unsigned int *)a6; 378 //v31 = a6a;
375 if ( !*(int *)a6 ) 379 if ( !v13->uNumVertices )
376 goto LABEL_24; 380 return 1;
377 v32 = a8; 381 v32 = a8a;
378 v40 = *(unsigned int **)a6; 382 //v40 = *a6a;
379 v39 = a8; 383 v39 = a8a;
380 pGame->pIndoorCameraD3D->ViewTransform(a8, (unsigned int)v40); 384 pGame->pIndoorCameraD3D->ViewTransform(a8a, (unsigned int)v13->uNumVertices);
381 v40 = 0; 385 v40 = 0;
382 pGame->pIndoorCameraD3D->Project(v32, *v31, 0); 386 pGame->pIndoorCameraD3D->Project(v32, *v31, 0);
383 if ( !(uClipFlags & 1) ) 387 if ( !(uClipFlags & 1) )
384 { 388 {
385 LABEL_19:
386 ++v12->field_308008; 389 ++v12->field_308008;
387 v34 = 1024; 390 v34 = 1024;
388 if ( v12->field_308008 == 1024 ) 391 if ( v12->field_308008 == 1024 )
389 v12->field_308008 = 0; 392 v12->field_308008 = 0;
390 if ( (signed int)(v12->std__vector_pDecals_size + 1) <= 1024 ) 393 if ( (signed int)(v12->std__vector_pDecals_size + 1) <= 1024 )
391 v34 = v12->std__vector_pDecals_size + 1; 394 v34 = v12->std__vector_pDecals_size + 1;
392 v12->std__vector_pDecals_size = v34; 395 v12->std__vector_pDecals_size = v34;
393 goto LABEL_24; 396 return 1;
394 } 397 }
395 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) 398 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
396 { 399 {
397 if ( uClipFlags & 2 ) 400 if ( uClipFlags & 2 )
398 { 401 {
399 v40 = (unsigned int *)&a8; 402 v40 = (int)&a8;
400 v39 = v12->pVertices; 403 v39 = v12->pVertices;
401 pGame->pIndoorCameraD3D->_436CDC_mess_with_lightmap__clipflag_2(v32, *v31, v12->pVertices, (unsigned int *)&a8); 404 pGame->pIndoorCameraD3D->_436CDC_mess_with_lightmap__clipflag_2(v32, *v31, v12->pVertices, &a8b);
402 LABEL_14: 405 v40 = (int)v31;
403 v40 = v31;
404 v39 = v12->pVertices; 406 v39 = v12->pVertices;
405 pGame->pIndoorCameraD3D->_437143((unsigned int)a8, v32, v12->pVertices, v31); 407 pGame->pIndoorCameraD3D->_437143(a8b, v32, v12->pVertices, v31);
406 goto LABEL_18;
407 } 408 }
408 if ( uClipFlags & 4 ) 409 else if ( uClipFlags & 4 )
409 { 410 {
410 v40 = (unsigned int *)&a8; 411 v40 = (int)&a8;
411 v39 = v12->pVertices; 412 v39 = v12->pVertices;
412 pGame->pIndoorCameraD3D->_436F09_mess_with_lightmap__clipflag_4(v32, *v31, v12->pVertices, (unsigned int *)&a8); 413 pGame->pIndoorCameraD3D->_436F09_mess_with_lightmap__clipflag_4(v32, *v31, v12->pVertices, &a8b);
413 goto LABEL_14; 414 v40 = (int)v31;
415 v39 = v12->pVertices;
416 pGame->pIndoorCameraD3D->_437143(a8b, v32, v12->pVertices, v31);
414 } 417 }
415 v39 = (RenderVertexSoft *)"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:258"; 418 else
416 v35 = "Undefined clip flag specified"; 419 {
420 v39 = (RenderVertexSoft *)"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:258";
421 v35 = "Undefined clip flag specified";
422 MessageBoxA(nullptr, v35, (const char *)v39, 0);
423 }
417 } 424 }
418 else 425 else
419 { 426 {
420 v39 = (RenderVertexSoft *)"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:263"; 427 v39 = (RenderVertexSoft *)"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:263";
421 v35 = "Lightpoly builder native indoor clipping not implemented"; 428 v35 = "Lightpoly builder native indoor clipping not implemented";
429 MessageBoxA(nullptr, v35, (const char *)v39, 0);
422 } 430 }
423 MessageBoxA(nullptr, v35, (const char *)v39, 0); 431 if ( a8b != 0 )
424 LABEL_18: 432 {
425 if ( *(float *)&a8 != 0.0 ) 433 ++v12->field_308008;
426 goto LABEL_19; 434 v34 = 1024;
427 LABEL_24: 435 if ( v12->field_308008 == 1024 )
436 v12->field_308008 = 0;
437 if ( (signed int)(v12->std__vector_pDecals_size + 1) <= 1024 )
438 v34 = v12->std__vector_pDecals_size + 1;
439 v12->std__vector_pDecals_size = v34;
440 return 1;
441 }
428 result = 1; 442 result = 1;
429 } 443 }
430 return result; 444 return result;
431 } 445 }
432 446