Mercurial > mm7
comparison Render.cpp @ 1413:3881d2f94eb1
UseNPCSkill
DIALOGUE_USE_NPC_ABILITY
author | Nomad |
---|---|
date | Sat, 27 Jul 2013 16:09:00 +0200 |
parents | 38df78aba732 |
children | 5930342f092b a8b1bbac95d4 |
comparison
equal
deleted
inserted
replaced
1412:182d58b2a34c | 1413:3881d2f94eb1 |
---|---|
48 RenderBillboard pBillboardRenderList[500]; | 48 RenderBillboard pBillboardRenderList[500]; |
49 unsigned int uNumBillboardsToDraw; | 49 unsigned int uNumBillboardsToDraw; |
50 int uNumSpritesDrawnThisFrame; // weak | 50 int uNumSpritesDrawnThisFrame; // weak |
51 | 51 |
52 RenderVertexSoft array_507D30[50]; | 52 RenderVertexSoft array_507D30[50]; |
53 RenderVertexSoft array_508690[50]; | |
54 RenderVertexSoft array_508FF0[50]; | |
55 RenderVertexSoft array_509950[50]; | |
56 RenderVertexSoft array_50A2B0[50]; | |
57 RenderVertexSoft array_50AC10[50]; | 53 RenderVertexSoft array_50AC10[50]; |
58 | |
59 RenderVertexSoft array_73D150[20]; | 54 RenderVertexSoft array_73D150[20]; |
60 | 55 |
61 RenderVertexD3D3 d3d_vertex_buffer[50]; | 56 RenderVertexD3D3 d3d_vertex_buffer[50]; |
62 | |
63 RenderVertexSoft *ptr_801A04; | |
64 RenderVertexSoft *ptr_801A08; | |
65 | |
66 RenderVertexSoft pVerticesSR_801A10[384]; | |
67 RenderVertexSoft pVerticesSR_806210[384]; | |
68 | 57 |
69 void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1); | 58 void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1); |
70 | 59 |
71 /* 384 */ | 60 /* 384 */ |
72 #pragma pack(push, 1) | 61 #pragma pack(push, 1) |
381 --pOutdoorCamera->field_44; | 370 --pOutdoorCamera->field_44; |
382 } | 371 } |
383 } | 372 } |
384 } | 373 } |
385 | 374 |
386 //----- (0048034E) -------------------------------------------------------- | |
387 void Render::DrawTerrainD3D(int a1, int a2, int a3, int unk4) | |
388 { | |
389 //int v3; // esi@1 | |
390 int v4; // edi@1 | |
391 int v5; // ebx@2 | |
392 int v6; // eax@2 | |
393 int v7; // eax@3 | |
394 RenderVertexSoft *v8; // edi@3 | |
395 RenderVertexSoft *v9; // ebx@4 | |
396 RenderVertexSoft *v10; // ecx@4 | |
397 float v11; // eax@6 | |
398 double v12; // ST5C_8@6 | |
399 double v13; // ST2C_8@6 | |
400 int v14; // eax@6 | |
401 double v15; // st7@6 | |
402 struct Polygon *pTile; // ebx@12 | |
403 unsigned __int16 v17; // ax@12 | |
404 int v18; // eax@13 | |
405 signed int v22; // eax@13 | |
406 Vec3_float_ *norm; // eax@15 | |
407 //double v24; // st6@17 | |
408 double v25; // ST54_8@17 | |
409 unsigned __int8 v26; // sf@17 | |
410 unsigned __int8 v27; // of@17 | |
411 double v28; // st5@19 | |
412 double v29; // st5@19 | |
413 double v30; // st5@19 | |
414 double v31; // st5@19 | |
415 struct struct8 *v32; // esi@21 | |
416 double v3a; // st7@32 | |
417 int v33; // edi@38 | |
418 unsigned int v34; // ecx@47 | |
419 char v35; // zf@47 | |
420 unsigned int v36; // eax@50 | |
421 int v37; // eax@54 | |
422 //Polygon *v38; // ecx@55 | |
423 unsigned int v39; // eax@59 | |
424 struct Polygon *v40; // ebx@62 | |
425 unsigned __int16 pTileBitmapsID; // ax@62 | |
426 int v42; // eax@63 | |
427 LightmapBuilder *v43; // ecx@63 | |
428 int v44; // eax@63 | |
429 int v45; // eax@63 | |
430 int v46; // eax@63 | |
431 signed int v47; // eax@63 | |
432 Vec3_float_ *v48; // eax@65 | |
433 double v49; // st6@67 | |
434 double v50; // ST4C_8@67 | |
435 double v51; // st5@71 | |
436 double v52; // st5@71 | |
437 double v53; // st5@71 | |
438 double v54; // st7@84 | |
439 unsigned int v55; // ecx@98 | |
440 unsigned int v56; // eax@101 | |
441 int v57; // eax@105 | |
442 unsigned int v58; // eax@109 | |
443 struct Polygon *v59; // esi@112 | |
444 unsigned __int16 v60; // ax@112 | |
445 int v61; // eax@113 | |
446 signed int v62; // eax@113 | |
447 Vec3_float_ *v63; // eax@114 | |
448 double v64; // st6@116 | |
449 double v65; // ST3C_8@116 | |
450 double v66; // st5@120 | |
451 double v67; // st5@120 | |
452 double v68; // st5@120 | |
453 double v69; // st7@133 | |
454 int v70; // edi@138 | |
455 struct Polygon *v71; // esi@147 | |
456 unsigned int v72; // ecx@147 | |
457 unsigned int v73; // eax@150 | |
458 int v74; // eax@154 | |
459 unsigned int v75; // eax@158 | |
460 //unsigned int v76; // [sp-10h] [bp-E0h]@61 | |
461 int v77; // [sp-Ch] [bp-DCh]@61 | |
462 IDirect3DTexture2 *v78; // [sp-8h] [bp-D8h]@61 | |
463 //int v79; // [sp-4h] [bp-D4h]@61 | |
464 bool v80; // [sp+0h] [bp-D0h]@59 | |
465 bool v81; // [sp+0h] [bp-D0h]@109 | |
466 int v82; // [sp+54h] [bp-7Ch]@1 | |
467 int v83; // [sp+60h] [bp-70h]@1 | |
468 int v84; // [sp+6Ch] [bp-64h]@1 | |
469 int v85; // [sp+70h] [bp-60h]@63 | |
470 float a4; // [sp+74h] [bp-5Ch]@73 | |
471 float v87; // [sp+78h] [bp-58h]@122 | |
472 int v88; // [sp+7Ch] [bp-54h]@1 | |
473 int v89; // [sp+80h] [bp-50h]@6 | |
474 int v93; // [sp+90h] [bp-40h]@2 | |
475 int X; // [sp+94h] [bp-3Ch]@1 | |
476 float v95; // [sp+98h] [bp-38h]@21 | |
477 LightmapBuilder *v96; // [sp+9Ch] [bp-34h]@73 | |
478 int v97; // [sp+A0h] [bp-30h]@6 | |
479 int sX; // [sp+A4h] [bp-2Ch]@6 | |
480 unsigned int uNumVertices; // [sp+A8h] [bp-28h]@73 | |
481 int v100; // [sp+ACh] [bp-24h]@122 | |
482 int sY; // [sp+B0h] [bp-20h]@6 | |
483 RenderVertexSoft *v102; // [sp+B4h] [bp-1Ch]@3 | |
484 unsigned int a5; // [sp+B8h] [bp-18h]@21 | |
485 RenderVertexSoft *v101; // [sp+BCh] [bp-14h]@6 | |
486 Vec3_float_ *v99; // [sp+C0h] [bp-10h]@17 | |
487 RenderVertexSoft *pVertices; // [sp+C4h] [bp-Ch]@6 | |
488 RenderVertexSoft *pVertices2; // [sp+C8h] [bp-8h]@6 | |
489 char v108; // [sp+CFh] [bp-1h]@36 | |
490 float thisd; // [sp+D8h] [bp+8h]@6 | |
491 float thise; // [sp+D8h] [bp+8h]@6 | |
492 float thisf; // [sp+D8h] [bp+8h]@17 | |
493 IndoorCameraD3D *thisa; // [sp+D8h] [bp+8h]@23 | |
494 float thisg; // [sp+D8h] [bp+8h]@67 | |
495 IndoorCameraD3D *thisb; // [sp+D8h] [bp+8h]@75 | |
496 float thish; // [sp+D8h] [bp+8h]@116 | |
497 IndoorCameraD3D *thisc; // [sp+D8h] [bp+8h]@124 | |
498 char this_3; // [sp+DBh] [bp+Bh]@30 | |
499 char this_3a; // [sp+DBh] [bp+Bh]@82 | |
500 char this_3b; // [sp+DBh] [bp+Bh]@131 | |
501 | |
502 static stru154 static_sub_0048034E_stru_154; | |
503 static stru154 stru_76D5A8; | |
504 //v3 = a1; | |
505 v82 = a2; | |
506 v83 = a3; | |
507 X = abs(unk4); | |
508 v4 = 0; | |
509 v88 = 0; | |
510 v84 = a1 - 1; | |
511 /* if ( a1 - 1 > 0 ) | |
512 { | |
513 while ( 1 ) | |
514 { | |
515 v5 = abs(X);//v5 = 13108 | |
516 v6 = abs(v83);//v6 = 13108 | |
517 --X; | |
518 //__debugbreak(); // uncoment & refactor following large if | |
519 v93 = (int)&terrain_76E5C8[(v5 << 7) + v6]; | |
520 /*if ( !v93->field_0 || ((v7 = 48 * v4, v8 = &pVerticesSR_806210[v4], a2 = v8, !v82) ? (v9 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7), | |
521 v10 = &pVerticesSR_806210[1] + v7) : (v9 = &pVerticesSR_806210[1] + v7, v10 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7)), | |
522 ((a8 = v9, | |
523 pVertices = &pVerticesSR_801A10[1] + v7, | |
524 v11 = v8->vWorldPosition.x, | |
525 v101 = v10, | |
526 v12 = v11 + 6.755399441055744e15, | |
527 sX = LODWORD(v12), | |
528 v13 = v8->vWorldPosition.y + 6.755399441055744e15, | |
529 sY = LODWORD(v13), | |
530 thisd = (v10->vWorldPosition.x + v8->vWorldPosition.x) * 0.5, | |
531 v14 = WorldPosToGridCellX(floorf(thisd + 0.5f)),//maybe current camera position X | |
532 v15 = v9->vWorldPosition.y + v8->vWorldPosition.y, | |
533 v89 = v14, | |
534 thise = v15 * 0.5, | |
535 _this = (LightmapBuilder *)WorldPosToGridCellZ(floorf(thisd + 0.5f)),//maybe current camera position Z | |
536 WorldPosToGridCellX(sX), | |
537 WorldPosToGridCellZ(sY), | |
538 !byte_4D864C) | |
539 || !(pGame->uFlags & 0x80)) | |
540 && !_481EFA_clip_terrain_poly(v8, v9, v101, pVertices, 1)) )*/ | |
541 /*if ( !&terrain_76E5C8[(v5 << 7) + v6] ) | |
542 goto LABEL_162*/ | |
543 v8 = &pVerticesSR_806210[v4]; | |
544 //pVertices2 = &pVerticesSR_801A10[v4 + 1]; | |
545 //v102 = v8; | |
546 if (!v82) | |
547 { | |
548 pVertices = &pVerticesSR_801A10[v4]; | |
549 v101 = &pVerticesSR_806210[v4 + 1]; | |
550 } | |
551 else | |
552 { | |
553 pVertices = &pVerticesSR_801A10[v4 + 1]; | |
554 v101 = &pVerticesSR_806210[v4]; | |
555 } | |
556 sX = floorf(v8->vWorldPosition.x + 0.5f); | |
557 sY = floorf(v8->vWorldPosition.z + 0.5f); | |
558 v89 = WorldPosToGridCellX(floorf((v101->vWorldPosition.x + v8->vWorldPosition.x) / 2 + 0.5f)); | |
559 v97 = WorldPosToGridCellZ(floorf((pVertices->vWorldPosition.z + v8->vWorldPosition.z) / 2 + 0.5f)); | |
560 /*WorldPosToGridCellX(sX); | |
561 WorldPosToGridCellZ(sY); | |
562 if ((!byte_4D864C || !(pGame->uFlags & 0x80)) && !_481EFA_clip_terrain_poly(v8, pVertices, v101, pVertices2, 1)) | |
563 if ( v8->vWorldPosition.y != pVertices->vWorldPosition.y || pVertices->vWorldPosition.y != pVertices2->vWorldPosition.y | |
564 || pVertices2->vWorldPosition.y != v101->vWorldPosition.y ) | |
565 break;*/ | |
566 pTile = &array_77EC08[pOutdoorCamera->uNumPolygons]; | |
567 pTile->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); | |
568 if ( pTile->uTileBitmapID != -1 ) | |
569 { | |
570 pTile->flags = 0x8010 |pOutdoor->GetSomeOtherTileInfo(sX, sY); | |
571 pTile->field_32 = 0; | |
572 pTile->field_59 = 1; | |
573 pTile->terrain_grid_x = (char)v97; | |
574 __debugbreak(); // warning C4700: uninitialized local variable 'v93' used | |
575 pTile->field_34 = *(_WORD *)(v93 + 2); | |
576 pTile->terrain_grid_z = v89; | |
577 v22 = pTerrainNormalIndices[2 * (v97 + 128 * v89) + 1]; | |
578 if ( v22 < 0 || v22 > uNumTerrainNormals - 1 ) | |
579 norm = 0; | |
580 else | |
581 norm = &pTerrainNormals[v22]; | |
582 thisf = 20.0 - ( -(((float)pOutdoor->vSunlight.x / 65536.0) * norm->x) - | |
583 (((float)pOutdoor->vSunlight.y / 65536.0) * norm->y) - | |
584 (((float)pOutdoor->vSunlight.z / 65536.0) * norm->z)) * 20.0; | |
585 //v25 = thisf + 6.7553994e15; | |
586 //v27 = pOutdoorCamera->uNumPolygons > 1999; | |
587 //v26 = pOutdoorCamera->uNumPolygons - 1999 < 0; | |
588 pTile->dimming_level = floorf(thisf + 0.5f); | |
589 if ( pOutdoorCamera->uNumPolygons >= 1999 ) | |
590 return; | |
591 ++pOutdoorCamera->uNumPolygons; | |
592 //if ( !_481FC9_terrain(v8, pVertices, v101, v16) )//Ritor1: It's temporary | |
593 //goto LABEL_126; | |
594 //{ | |
595 //--pOutdoorCamera->uNumPolygons; | |
596 //goto LABEL_162; | |
597 //} | |
598 __debugbreak(); // warning C4700: uninitialized local variable 'v102' used | |
599 memcpy(&array_50AC10[0], v102, 0x30u); | |
600 array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); | |
601 array_50AC10[0].u = 0.0; | |
602 array_50AC10[0].v = 0.0; | |
603 memcpy(&array_50AC10[1], pVertices, sizeof(array_50AC10[1])); | |
604 array_50AC10[1]._rhw = 1.0 / (pVertices->vWorldViewPosition.x + 0.0000001000000011686097); | |
605 array_50AC10[1].u = 0.0; | |
606 array_50AC10[1].v = 1.0; | |
607 __debugbreak(); // warning C4700: uninitialized local variable 'pVertices2' used | |
608 memcpy(&array_50AC10[2], pVertices2, sizeof(array_50AC10[2])); | |
609 array_50AC10[2]._rhw = 1.0 / (pVertices2->vWorldViewPosition.x + 0.0000001000000011686097); | |
610 array_50AC10[2].u = 1.0; | |
611 array_50AC10[2].v = 1.0; | |
612 memcpy(&array_50AC10[3], v101, sizeof(array_50AC10[3])); | |
613 array_50AC10[3]._rhw = 1.0 / (v101->vWorldViewPosition.x + 0.0000001000000011686097); | |
614 array_50AC10[3].u = 1.0; | |
615 array_50AC10[3].v = 0.0; | |
616 /*if ( !(byte_76D5C0 & 1) ) | |
617 { | |
618 byte_76D5C0 |= 1u; | |
619 stru154(stru_76D5A8); | |
620 atexit(loc_481199); | |
621 }*/ | |
622 v32 = (struct8 *)array_50AC10; | |
623 v97 = (int)pGame->pLightmapBuilder; | |
624 pGame->pLightmapBuilder->StackLights_TerrainFace(norm, &v95, array_50AC10, 4, 1); | |
625 pDecalBuilder->_49BE8A(pTile, norm, &v95, array_50AC10, 4, 1); | |
626 a5 = 4; | |
627 if ( byte_4D864C && pGame->uFlags & 0x80 ) | |
628 { | |
629 thisa = pGame->pIndoorCameraD3D; | |
630 if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, &a5, 0) == 1 && !a5 ) | |
631 goto LABEL_162; | |
632 thisa->ViewTransform(array_50AC10, a5); | |
633 thisa->Project(array_50AC10, a5, 0); | |
634 } | |
635 this_3 = v102->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0 | |
636 || v101->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0; | |
637 v3a = (double)pOutdoorCamera->shading_dist_mist; | |
638 v108 = v3a < v102->vWorldViewPosition.x || v3a < pVertices->vWorldViewPosition.x | |
639 || v3a < v101->vWorldViewPosition.x || v3a < pVertices2->vWorldViewPosition.x; | |
640 v33 = 0; | |
641 pGame->pLightmapBuilder->std__vector_000004_size = 0; | |
642 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) | |
643 { | |
644 if ( this_3 ) | |
645 v33 = 3; | |
646 else | |
647 v33 = v108 != 0 ? 5 : 0; | |
648 static_sub_0048034E_stru_154.ClassifyPolygon(norm, v95); | |
649 if ( pDecalBuilder->uNumDecals > 0 ) | |
650 pDecalBuilder->ApplyDecals(31 - pTile->dimming_level, 4, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, *(float *)&v33, -1); | |
651 } | |
652 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
653 pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, v33); | |
654 v34 = a5; | |
655 //v35 = byte_4D864C == 0; | |
656 pTile->uNumVertices = a5; | |
657 if ( !byte_4D864C || ~pGame->uFlags & 0x80 ) | |
658 { | |
659 if ( this_3 ) | |
660 { | |
661 v36 = sr_424CD7(v34); | |
662 pTile->uNumVertices = v36; | |
663 OutdoorCamera::Project(v36); | |
664 } | |
665 if ( v108 ) | |
666 { | |
667 v36 = sr_424EE0_MakeFanFromTriangle(v34); | |
668 pTile->uNumVertices = v36; | |
669 OutdoorCamera::Project(v36); | |
670 } | |
671 } | |
672 //v37 = *(int *)&v16->flags; | |
673 if ( ~pTile->flags & 1 ) | |
674 { | |
675 if ( pTile->flags & 2 && pTile->uTileBitmapID == pRenderer->hd_water_tile_id ) | |
676 { | |
677 v80 = false; | |
678 v39 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]; | |
679 } | |
680 else | |
681 { | |
682 v39 = pTile->uTileBitmapID; | |
683 v80 = true; | |
684 } | |
685 //v79 = 0; | |
686 //v78 = pBitmaps_LOD->pHardwareTextures[v39]; | |
687 pTile->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v39];// Ritor1: It's temporary | |
688 v77 = (int)pTile; | |
689 //v76 = v16->uNumVertices; | |
690 //LABEL_161: | |
691 pRenderer->DrawTerrainPolygon(pTile->uNumVertices, pTile, pBitmaps_LOD->pHardwareTextures[v39], false, v80); | |
692 goto LABEL_162; | |
693 } | |
694 LABEL_56: | |
695 pTile->DrawBorderTiles(); | |
696 } | |
697 LABEL_162: | |
698 v4 = v88 + 1; | |
699 if ( ++v88 >= v84 ) | |
700 return; | |
701 } | |
702 /* v40 = &array_77EC08[pOutdoorCamera->uNumPolygons]; | |
703 v40->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); | |
704 if ( v40->uTileBitmapID == -1 ) | |
705 goto LABEL_162; | |
706 v42 = pOutdoor->GetSomeOtherTileInfo(sX, sY); | |
707 BYTE1(v42) |= 0x80u; | |
708 v43 = pGame->pLightmapBuilder; | |
709 *(int *)&v40->flags = v42; | |
710 v44 = v93; | |
711 v40->field_59 = 1; | |
712 v40->terrain_grid_x = (char)v43; | |
713 v40->field_34 = *(_WORD *)(v44 + 2); | |
714 v45 = v89; | |
715 v40->terrain_grid_z = v89; | |
716 v46 = 4 * ((char)v43 + (v45 << 7)); | |
717 v85 = v46; | |
718 v47 = *(unsigned __int16 *)((char *)pTerrainNormalIndices + v46 + 2);// v47 = pTerrainNormalIndices[v46 + 1]; | |
719 if ( v47 < 0 || v47 > (signed int)(uNumTerrainNormals - 1) ) | |
720 v48 = 0; | |
721 else | |
722 v48 = &pTerrainNormals[v47]; | |
723 v49 = v92 * v48->y; | |
724 //v99 = v48; | |
725 thisg = 20.0 - (-v49 - v91 * v48->z - v90 * v48->x) * 20.0; | |
726 v50 = thisg + 6.755399441055744e15; | |
727 v40->dimming_level = LOBYTE(v50); | |
728 if ( LOBYTE(v50) < 0 ) | |
729 v40->dimming_level = 0; | |
730 if ( pOutdoorCamera->uNumPolygons >= 1999 ) | |
731 return; | |
732 ++pOutdoorCamera->uNumPolygons; | |
733 /*if ( !_481FC9_terrain(pVertices, pVertices2, v8, v40) ) // Ritor1: It's temporary | |
734 //goto LABEL_77; | |
735 { | |
736 --pOutdoorCamera->uNumPolygons; | |
737 goto LABEL_112; | |
738 }*/ | |
739 /*memcpy(&array_50AC10[0], v102, 0x30u); | |
740 array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); | |
741 array_50AC10[0].u = 0.0; | |
742 array_50AC10[0].v = 0.0; | |
743 memcpy(&array_50AC10[1], pVertices, sizeof(array_50AC10[1])); | |
744 array_50AC10[1]._rhw = 1.0 / pVertices->vWorldViewPosition.x + 0.0000001000000011686097; | |
745 array_50AC10[1].u = 0.0; | |
746 array_50AC10[1].v = 1.0; | |
747 memcpy(&array_50AC10[2], pVertices2, sizeof(array_50AC10[2])); | |
748 array_50AC10[2]._rhw = 1.0 / pVertices2->vWorldViewPosition.x + 0.0000001000000011686097; | |
749 array_50AC10[2].u = 1.0; | |
750 array_50AC10[2].v = 1.0; | |
751 static stru154 static_sub_0048034E_stru_76D590; | |
752 /*static bool __init_flag2 = false; | |
753 if (!__init_flag2) | |
754 { | |
755 __init_flag2 = true; | |
756 stru154::stru154(&static_sub_0048034E_stru_76D590); | |
757 }*/ | |
758 /*if ( !(byte_76D5C0 & 2) ) | |
759 { | |
760 byte_76D5C0 |= 2; | |
761 Polygon(stru_76D590); | |
762 atexit(loc_48118F); | |
763 }*/ | |
764 /*v96 = pGame->pLightmapBuilder; | |
765 pGame->pLightmapBuilder->StackLights_TerrainFace(v48, (float *)&a4, array_50AC10, 3, 0); | |
766 pDecalBuilder->_49BE8A(v40, v48, &a4, array_50AC10, 3, 0); | |
767 uNumVertices = 3; | |
768 if ( byte_4D864C && pGame->uFlags & 0x80 ) | |
769 { | |
770 thisb = pGame->pIndoorCameraD3D; | |
771 if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, &uNumVertices, 0) == 1 && !uNumVertices ) | |
772 { | |
773 //LABEL_77: | |
774 --pOutdoorCamera->uNumPolygons; | |
775 goto LABEL_112; | |
776 } | |
777 thisb->ViewTransform(array_50AC10, uNumVertices); | |
778 thisb->Project(array_50AC10, uNumVertices, 0); | |
779 } | |
780 this_3a = v102->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0; | |
781 v54 = (double)pOutdoorCamera->shading_dist_mist; | |
782 v108 = v54 < v102->vWorldViewPosition.x || v54 < pVertices->vWorldViewPosition.x || v54 < pVertices2->vWorldViewPosition.x; | |
783 pVertices = 0; | |
784 v96->std__vector_000004_size = 0; | |
785 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) | |
786 { | |
787 if ( this_3a ) | |
788 pVertices = (RenderVertexSoft *)3; | |
789 else | |
790 pVertices = (RenderVertexSoft *)(v108 != 0 ? 5 : 0); | |
791 //a8 = (RenderVertexSoft *)(this_3a ? 3 : v108 != 0 ? 5 : 0); | |
792 static_sub_0048034E_stru_76D590.ClassifyPolygon(v48, *(float *)&a4); | |
793 if ( pDecalBuilder->uNumDecals > 0 ) | |
794 pDecalBuilder->ApplyDecals(31 - v40->dimming_level, 4, &static_sub_0048034E_stru_76D590, uNumVertices, array_50AC10, 0, (char)pVertices, -1); | |
795 } | |
796 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
797 v96->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_76D590, uNumVertices, array_50AC10, 0, (char)pVertices); | |
798 v55 = uNumVertices; | |
799 //v35 = byte_4D864C == 0; | |
800 v40->uNumVertices = uNumVertices; | |
801 if ( !byte_76D5C0 || !(pGame->uFlags & 0x80) ) | |
802 { | |
803 if ( this_3a ) | |
804 { | |
805 v56 = sr_424CD7(v55); | |
806 } | |
807 else | |
808 { | |
809 if ( !v108 ) | |
810 goto LABEL_105; | |
811 v56 = sr_424EE0_MakeFanFromTriangle(v55); | |
812 } | |
813 v40->uNumVertices = v56; | |
814 OutdoorCamera::Project(v56); | |
815 } | |
816 LABEL_105: | |
817 v57 = *(int *)&v40->flags; | |
818 if ( BYTE1(v57) & 1 ) | |
819 { | |
820 v40->DrawBorderTiles(); | |
821 } | |
822 else | |
823 { | |
824 if ( v57 & 2 && v40->uTileBitmapID == pRenderer->hd_water_tile_id ) | |
825 { | |
826 v81 = false; | |
827 v58 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]; | |
828 } | |
829 else | |
830 { | |
831 v58 = v40->uTileBitmapID; | |
832 v81 = true; | |
833 } | |
834 pRenderer->DrawTerrainPolygon(v40->uNumVertices, v40, pBitmaps_LOD->pHardwareTextures[v58], 0, v81); | |
835 } | |
836 LABEL_112: | |
837 v59 = &array_77EC08[pOutdoorCamera->uNumPolygons]; | |
838 //a8 = (RenderVertexSoft *)&array_77EC08[pOutdoorCamera->uNumPolygons]; | |
839 v59->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); | |
840 if ( v59->uTileBitmapID == -1 ) | |
841 goto LABEL_162; | |
842 *(int *)&v59->flags = pOutdoor->GetSomeOtherTileInfo(sX, sY); | |
843 v61 = v93; | |
844 v59->field_59 = 1; | |
845 v59->field_34 = *(_WORD *)(v61 + 2); | |
846 v59->terrain_grid_z = v89; | |
847 v59->terrain_grid_x = v97; | |
848 v62 = *(unsigned __int16 *)((char *)pTerrainNormalIndices + v85); | |
849 if ( v62 > (signed int)(uNumTerrainNormals - 1) ) | |
850 v63 = 0; | |
851 else | |
852 v63 = &pTerrainNormals[v62]; | |
853 v64 = v92 * v63->y; | |
854 //v99 = v63; | |
855 thish = 20.0 - (-v64 - v91 * v63->y - v90 * v63->x) * 20.0; | |
856 v59->dimming_level = floorf(thish + 0.5f); | |
857 if ( v59->dimming_level < 0 ) | |
858 v59->dimming_level = 0; | |
859 if ( pOutdoorCamera->uNumPolygons >= 1999 ) | |
860 return; | |
861 ++pOutdoorCamera->uNumPolygons; | |
862 if ( !_481FC9_terrain(v101, v102, pVertices2, v59) ) | |
863 { | |
864 //LABEL_126: | |
865 --pOutdoorCamera->uNumPolygons; | |
866 goto LABEL_162; | |
867 } | |
868 memcpy(&array_50AC10[0], v102, 0x30u); | |
869 array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); | |
870 array_50AC10[0].u = 0.0; | |
871 array_50AC10[0].v = 0.0; | |
872 memcpy(&array_50AC10[1], pVertices2, sizeof(array_50AC10[1])); | |
873 array_50AC10[1]._rhw = 1.0 / pVertices2->vWorldViewPosition.x + 0.0000001000000011686097; | |
874 array_50AC10[1].u = 1.0; | |
875 array_50AC10[1].v = 1.0; | |
876 memcpy(&array_50AC10[2], v101, sizeof(array_50AC10[2])); | |
877 array_50AC10[2]._rhw = 1.0 / v101->vWorldViewPosition.x + 0.0000001000000011686097; | |
878 array_50AC10[2].u = 1.0; | |
879 array_50AC10[2].v = 0.0; | |
880 static stru154 static_sub_0048034E_stru_76D578; | |
881 /*static bool __init_flag1 = false; | |
882 if (!__init_flag1) | |
883 { | |
884 __init_flag1 = true; | |
885 stru154::stru154(&static_sub_0048034E_stru_76D578); | |
886 }*/ | |
887 /* v96 = pGame->pLightmapBuilder; | |
888 pGame->pLightmapBuilder->StackLights_TerrainFace(v63, &v87, array_50AC10, 3, 1); | |
889 pDecalBuilder->_49BE8A(v40, v63, &v87, array_50AC10, 3, 1); | |
890 v100 = 3; | |
891 if ( byte_4D864C && pGame->uFlags & 0x80 ) | |
892 { | |
893 thisc = pGame->pIndoorCameraD3D; | |
894 if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, (unsigned int *)&v100, 0) == 1 && !v100 ) | |
895 //goto LABEL_126; | |
896 { | |
897 --pOutdoorCamera->uNumPolygons; | |
898 goto LABEL_162; | |
899 } | |
900 thisc->ViewTransform(array_50AC10, v100); | |
901 thisc->Project(array_50AC10, v100, 0); | |
902 } | |
903 this_3b = v102->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0 | |
904 || v101->vWorldViewPosition.x < 8.0; | |
905 v69 = (double)pOutdoorCamera->shading_dist_mist; | |
906 v108 = v69 < v102->vWorldViewPosition.x || v69 < pVertices2->vWorldViewPosition.x || v69 < v101->vWorldViewPosition.x; | |
907 v70 = 0; | |
908 v96->std__vector_000004_size = 0; | |
909 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) | |
910 { | |
911 if ( this_3b ) | |
912 v70 = 3; | |
913 else | |
914 v70 = v108 != 0 ? 5 : 0; | |
915 static_sub_0048034E_stru_76D578.ClassifyPolygon(v63, v87); | |
916 if ( pDecalBuilder->uNumDecals > 0 ) | |
917 pDecalBuilder->ApplyDecals(31 - v40->dimming_level, 4, &static_sub_0048034E_stru_76D578, v100, array_50AC10, 0, v70, -1); | |
918 } | |
919 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
920 v96->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_76D578, v100, array_50AC10, 0, v70); | |
921 v71 = v59; | |
922 v72 = v100; | |
923 //v35 = byte_4D864C == 0; | |
924 v59->uNumVertices = v100;//??? | |
925 if ( !byte_4D864C && pGame->uFlags & 0x80 ) | |
926 goto LABEL_154; | |
927 if ( this_3b ) | |
928 { | |
929 v73 = sr_424CD7(v72); | |
930 } | |
931 else | |
932 { | |
933 if ( !v108 ) | |
934 { | |
935 LABEL_154: | |
936 v74 = v71->flags; | |
937 if ( !(BYTE1(v74) & 1) ) | |
938 { | |
939 if ( v74 & 2 && v71->uTileBitmapID == pRenderer->hd_water_tile_id ) | |
940 { | |
941 v80 = false; | |
942 v75 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]; | |
943 } | |
944 else | |
945 { | |
946 v75 = v71->uTileBitmapID; | |
947 v80 = true; | |
948 } | |
949 //v79 = 0; | |
950 v78 = pBitmaps_LOD->pHardwareTextures[v75]; | |
951 v71->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v75];// Ritor1: It's temporary | |
952 //v77 = (int)v71; | |
953 //v76 = v71->uNumVertices; | |
954 //goto LABEL_161; | |
955 pRenderer->DrawTerrainPolygon(v71->uNumVertices, (Polygon *)v71, v78, 0, v80); | |
956 goto LABEL_162; | |
957 } | |
958 v38 = (Polygon *)v71; | |
959 goto LABEL_56; | |
960 } | |
961 v73 = sr_424EE0_MakeFanFromTriangle(v72); | |
962 } | |
963 v71->uNumVertices = v73; | |
964 OutdoorCamera::Project(v73); | |
965 goto LABEL_154; | |
966 } | |
967 }*/ | |
968 | 375 |
969 | 376 |
970 //----- (0047BACF) -------------------------------------------------------- | 377 //----- (0047BACF) -------------------------------------------------------- |
971 void Render::TransformBillboardsAndSetPalettesODM() | 378 void Render::TransformBillboardsAndSetPalettesODM() |
972 { | 379 { |