Mercurial > mm7
comparison Indoor.cpp @ 1439:468f434a8d8a
Слияние
author | Ritor1 |
---|---|
date | Mon, 22 Jul 2013 18:00:58 +0600 |
parents | bc99e1a48bea 8ea496564034 |
children | b67a3e0d6fc3 |
comparison
equal
deleted
inserted
replaced
1438:bc99e1a48bea | 1439:468f434a8d8a |
---|---|
61 LEVEL_TYPE uCurrentlyLoadedLevelType = LEVEL_null; | 61 LEVEL_TYPE uCurrentlyLoadedLevelType = LEVEL_null; |
62 | 62 |
63 stru320 stru_F8AD28; // idb | 63 stru320 stru_F8AD28; // idb |
64 stru337 stru_F81018; | 64 stru337 stru_F81018; |
65 stru167_wrap array_5118E8; | 65 stru167_wrap array_5118E8; |
66 BspRenderer_stru2 stru_F8A590; | 66 BspRenderer_PortalViewportData stru_F8A590; |
67 BspRenderer *pBspRenderer = new BspRenderer; // idb | 67 BspRenderer *pBspRenderer = new BspRenderer; // idb |
68 stru141 stru_721530; | 68 stru141 stru_721530; |
69 std::array<stru352, 480> stru_F83B80; | 69 std::array<stru352, 480> stru_F83B80; |
70 | 70 |
71 | 71 |
312 IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID, pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].std__vector_0007AC, 4, pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].pPortalBounding); | 312 IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID, pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].std__vector_0007AC, 4, pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].pPortalBounding); |
313 } | 313 } |
314 } | 314 } |
315 else for (uint j = 0; j < pBspRenderer->num_faces; ++j ) | 315 else for (uint j = 0; j < pBspRenderer->num_faces; ++j ) |
316 { | 316 { |
317 pBLVRenderParams->field_7C = &pBspRenderer->nodes[pBspRenderer->faces[j].uNodeID].field_C; | 317 __debugbreak(); // no SW |
318 IndoorLocation::ExecDraw_sw(pBspRenderer->faces[j].uFaceID); | 318 //pBLVRenderParams->field_7C = &pBspRenderer->nodes[pBspRenderer->faces[j].uNodeID].PortalScreenData; |
319 //IndoorLocation::ExecDraw_sw(pBspRenderer->faces[j].uFaceID); | |
319 } | 320 } |
320 } | 321 } |
321 | 322 |
322 //----- (00440BED) -------------------------------------------------------- | 323 //----- (00440BED) -------------------------------------------------------- |
323 void __fastcall sub_440BED(IndoorLocation_drawstru *_this) | 324 void __fastcall sub_440BED(IndoorLocation_drawstru *_this) |
345 v1 = pBLVRenderParams->pRenderTarget; | 346 v1 = pBLVRenderParams->pRenderTarget; |
346 v7 = 0; | 347 v7 = 0; |
347 for(int i=0; i < pBspRenderer->num_nodes; i++) | 348 for(int i=0; i < pBspRenderer->num_nodes; i++) |
348 { | 349 { |
349 BspRenderer_stru0 *pNode = &pBspRenderer->nodes[i]; | 350 BspRenderer_stru0 *pNode = &pBspRenderer->nodes[i]; |
350 v4 = pRenderer->uTargetSurfacePitch * pNode->field_C._viewport_space_y; | 351 v4 = pRenderer->uTargetSurfacePitch * pNode->PortalScreenData._viewport_space_y; |
351 if ( pNode->field_C._viewport_space_y <= pNode->field_C._viewport_space_w ) | 352 if ( pNode->PortalScreenData._viewport_space_y <= pNode->PortalScreenData._viewport_space_w ) |
352 { | 353 { |
353 //v5 = (char *)&pBspRenderer->nodes[0].field_C.array_3D8[pNode->field_C._viewport_space_y + v7]; | 354 //v5 = (char *)&pBspRenderer->nodes[0].field_C.array_3D8[pNode->field_C._viewport_space_y + v7]; |
354 v5 = &pNode->field_C.viewport_right_side[pNode->field_C._viewport_space_y]; | 355 v5 = &pNode->PortalScreenData.viewport_right_side[pNode->PortalScreenData._viewport_space_y]; |
355 v8 = &pNode->field_C.viewport_left_side[pNode->field_C._viewport_space_y]; | 356 v8 = &pNode->PortalScreenData.viewport_left_side[pNode->PortalScreenData._viewport_space_y]; |
356 do | 357 do |
357 { | 358 { |
358 v1[v4 + *v8] = 255; | 359 v1[v4 + *v8] = 255; |
359 ++pNode->field_C._viewport_space_y; | 360 ++pNode->PortalScreenData._viewport_space_y; |
360 v1[v4 + *v5] = 255; | 361 v1[v4 + *v5] = 255; |
361 v4 += pRenderer->uTargetSurfacePitch; | 362 v4 += pRenderer->uTargetSurfacePitch; |
362 ++v5; | 363 ++v5; |
363 ++v8; | 364 ++v8; |
364 } | 365 } |
365 while ( pNode->field_C._viewport_space_y <= pNode->field_C._viewport_space_w ); | 366 while ( pNode->PortalScreenData._viewport_space_y <= pNode->PortalScreenData._viewport_space_w ); |
366 } | 367 } |
367 } | 368 } |
368 } | 369 } |
369 } | 370 } |
370 } | 371 } |
581 v23 = pTextureFrameTable->GetFrameTexture(pFace->uBitmapID, pBLVRenderParams->field_0_timer_); | 582 v23 = pTextureFrameTable->GetFrameTexture(pFace->uBitmapID, pBLVRenderParams->field_0_timer_); |
582 v27 = pBitmaps_LOD->pHardwareTextures[v23]; | 583 v27 = pBitmaps_LOD->pHardwareTextures[v23]; |
583 } | 584 } |
584 else | 585 else |
585 { | 586 { |
586 v17 = 0xFFD0D0D0; | 587 v17 = 0xFF808080; |
587 v23 = pFace->uBitmapID; | 588 v23 = pFace->uBitmapID; |
588 v27 = pBitmaps_LOD->pHardwareTextures[v23]; | 589 v27 = pBitmaps_LOD->pHardwareTextures[v23]; |
589 } | 590 } |
590 | 591 |
591 if (pFace->uAttributes & FACE_DO_NOT_LIGHT) | 592 if (pFace->uAttributes & FACE_DO_NOT_LIGHT) |
592 _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID); | 593 pRenderer->DrawIndoorPolygonNoLight(uNumVerticesa, uFaceID); |
593 else | 594 else |
594 pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, PID(OBJECT_BModel, uFaceID), v17, 0); | 595 pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, PID(OBJECT_BModel, uFaceID), v17, 0); |
595 return; | 596 return; |
596 } | 597 } |
597 } | 598 } |
598 } | 599 } |
599 } | 600 } |
600 | 601 |
601 //----- (004AFF79) -------------------------------------------------------- | |
602 void IndoorLocation::ExecDraw_sw(unsigned int uFaceID) | |
603 { | |
604 unsigned int v1; // ebx@1 | |
605 BLVFace *v2; // esi@3 | |
606 unsigned int v3; // eax@3 | |
607 Texture *v4; // eax@8 | |
608 Texture *v5; // edi@8 | |
609 int v6; // eax@9 | |
610 int v7; // eax@9 | |
611 int v8; // ecx@17 | |
612 int v9; // ebx@17 | |
613 int v10; // eax@17 | |
614 int v11; // esi@17 | |
615 unsigned int v12; // eax@17 | |
616 int j; // ecx@19 | |
617 int v14; // edx@20 | |
618 int v15; // eax@20 | |
619 int v16; // edx@20 | |
620 int i; // ebx@22 | |
621 int v18; // ecx@23 | |
622 int v19; // eax@23 | |
623 int v20; // eax@23 | |
624 int v21; // eax@24 | |
625 unsigned __int8 *v22; // ecx@24 | |
626 int v23; // ebx@24 | |
627 int v24; // esi@25 | |
628 int v25; // eax@28 | |
629 unsigned __int16 *v26; // eax@28 | |
630 unsigned int v27; // eax@29 | |
631 int v28; // eax@30 | |
632 char *v29; // esi@31 | |
633 int v30; // eax@33 | |
634 int v31; // eax@33 | |
635 int v32; // eax@35 | |
636 int v33; // edx@35 | |
637 signed int v34; // ebx@35 | |
638 int v35; // eax@35 | |
639 int v36; // ebx@35 | |
640 signed int v37; // ebx@35 | |
641 signed int v38; // edi@35 | |
642 unsigned int v39; // edi@36 | |
643 int v40; // edx@40 | |
644 int v41; // ecx@40 | |
645 signed int v42; // edx@40 | |
646 int v43; // edx@42 | |
647 int v44; // eax@42 | |
648 unsigned __int16 *v45; // eax@43 | |
649 int *v46; // esi@44 | |
650 unsigned __int16 *v47; // edi@44 | |
651 unsigned int v48; // edx@44 | |
652 int v49; // ebx@44 | |
653 char v50; // cl@44 | |
654 char v51; // ch@44 | |
655 unsigned int v52; // ebx@46 | |
656 int v53; // edx@46 | |
657 unsigned int v54; // ebx@46 | |
658 int v55; // edx@46 | |
659 unsigned int v56; // ebx@47 | |
660 int v57; // edx@47 | |
661 int v58; // ebx@47 | |
662 int v59; // edx@47 | |
663 unsigned __int16 *v60; // eax@50 | |
664 int *v61; // esi@51 | |
665 unsigned __int16 *v62; // edi@51 | |
666 unsigned int v63; // edx@51 | |
667 int v64; // ebx@51 | |
668 char v65; // cl@51 | |
669 char v66; // ch@51 | |
670 unsigned int v67; // ebx@53 | |
671 int v68; // edx@53 | |
672 unsigned int v69; // ebx@53 | |
673 int v70; // edx@53 | |
674 unsigned int v71; // ebx@54 | |
675 int v72; // edx@54 | |
676 int v73; // ebx@54 | |
677 int v74; // edx@54 | |
678 unsigned __int16 *v75; // eax@58 | |
679 int *v76; // esi@59 | |
680 int v77; // edi@59 | |
681 unsigned int v78; // edx@59 | |
682 int v79; // ebx@59 | |
683 char v80; // cl@59 | |
684 char v81; // ch@59 | |
685 int v82; // ebx@61 | |
686 int v83; // edx@61 | |
687 unsigned int v84; // ebx@62 | |
688 int v85; // edx@62 | |
689 unsigned __int16 *v86; // eax@65 | |
690 int *v87; // esi@66 | |
691 int v88; // edi@66 | |
692 unsigned int v89; // edx@66 | |
693 int v90; // ebx@66 | |
694 char v91; // cl@66 | |
695 char v92; // ch@66 | |
696 int v93; // ebx@68 | |
697 int v94; // edx@68 | |
698 unsigned __int16 v95; // bx@69 | |
699 int v96; // edx@69 | |
700 unsigned __int8 *v97; // [sp+Ch] [bp-9Ch]@24 | |
701 unsigned __int8 *v98; // [sp+10h] [bp-98h]@24 | |
702 unsigned __int8 *v99; // [sp+14h] [bp-94h]@24 | |
703 unsigned __int8 *v100; // [sp+18h] [bp-90h]@24 | |
704 int v101; // [sp+1Ch] [bp-8Ch]@40 | |
705 int v102; // [sp+20h] [bp-88h]@31 | |
706 BLVFace *v103; // [sp+24h] [bp-84h]@3 | |
707 unsigned __int16 *v104; // [sp+28h] [bp-80h]@24 | |
708 int v105; // [sp+2Ch] [bp-7Ch]@30 | |
709 int v106; // [sp+30h] [bp-78h]@24 | |
710 int v107; // [sp+34h] [bp-74h]@9 | |
711 Texture *v108; // [sp+38h] [bp-70h]@8 | |
712 int v109; // [sp+3Ch] [bp-6Ch]@9 | |
713 unsigned int v110; // [sp+40h] [bp-68h]@24 | |
714 unsigned int v111; // [sp+44h] [bp-64h]@1 | |
715 int *k; // [sp+48h] [bp-60h]@31 | |
716 int v113; // [sp+4Ch] [bp-5Ch]@35 | |
717 int v114; // [sp+50h] [bp-58h]@35 | |
718 int v115; // [sp+54h] [bp-54h]@42 | |
719 unsigned __int8 *v116; // [sp+58h] [bp-50h]@35 | |
720 int v117; // [sp+5Ch] [bp-4Ch]@33 | |
721 int a1; // [sp+60h] [bp-48h]@27 | |
722 int v119; // [sp+64h] [bp-44h]@17 | |
723 int v120; // [sp+68h] [bp-40h]@23 | |
724 unsigned int v121; // [sp+6Ch] [bp-3Ch]@40 | |
725 unsigned int v122; // [sp+70h] [bp-38h]@35 | |
726 int v123; // [sp+74h] [bp-34h]@30 | |
727 int v124; // [sp+78h] [bp-30h]@17 | |
728 int v125; // [sp+7Ch] [bp-2Ch]@35 | |
729 unsigned int v126; // [sp+80h] [bp-28h]@9 | |
730 int v127; // [sp+84h] [bp-24h]@17 | |
731 int v128; // [sp+88h] [bp-20h]@9 | |
732 int *pZPixel; // [sp+8Ch] [bp-1Ch]@28 | |
733 int a2; // [sp+90h] [bp-18h]@16 | |
734 unsigned int v131; // [sp+94h] [bp-14h]@17 | |
735 unsigned __int16 *pColorPixel; // [sp+98h] [bp-10h]@28 | |
736 int v133; // [sp+9Ch] [bp-Ch]@17 | |
737 int v134; // [sp+A0h] [bp-8h]@17 | |
738 int v135; // [sp+A4h] [bp-4h]@24 | |
739 | |
740 v1 = uFaceID; | |
741 v111 = pRenderer->uTargetSurfacePitch; | |
742 if ( (uFaceID & 0x80000000u) == 0 ) | |
743 { | |
744 if ( (signed int)uFaceID < (signed int)pIndoor->uNumFaces ) | |
745 { | |
746 v2 = &pIndoor->pFaces[uFaceID]; | |
747 v103 = v2; | |
748 v3 = v2->uAttributes; | |
749 if ( !(BYTE1(v3) & 0x20) ) | |
750 { | |
751 if ( v3 & 0x400000 ) | |
752 { | |
753 sub_4ADD1D(uFaceID); | |
754 return; | |
755 } | |
756 if ( !(v3 & 0x10) || (sub_4AD504(uFaceID), pRenderer->pRenderD3D) ) | |
757 { | |
758 v4 = v2->GetTexture(); | |
759 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
760 v5 = v4; | |
761 v108 = v4; | |
762 if ( v4 ) | |
763 { | |
764 v6 = v4->palette_id2; | |
765 LOBYTE(v2->uAttributes) |= 0x80u; | |
766 v109 = v6; | |
767 sub_4AE5F1(v1); | |
768 v126 = stru_F8AD28.pDeltaUV[0]; | |
769 v128 = stru_F8AD28.pDeltaUV[1]; | |
770 v107 = bUseLoResSprites; | |
771 v7 = sub_423B5D(v1); | |
772 if ( v7 ) | |
773 { | |
774 if ( sub_424829(v7, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) | |
775 { | |
776 if ( v2->uPolygonType == 1 ) | |
777 { | |
778 for ( i = 0; i < stru_F8AD28.uNumLightsApplied; stru_F8AD28._blv_lights_ys[v18] = v20 ) | |
779 { | |
780 v18 = i; | |
781 v120 = stru_F8AD28._blv_lights_xs[i]; | |
782 v134 = (unsigned __int64)(v120 * (signed __int64)-stru_F8AD28.plane_4.vNormal.y) >> 16; | |
783 v133 = stru_F8AD28.plane_4.vNormal.x; | |
784 v120 = stru_F8AD28._blv_lights_ys[i]; | |
785 v133 = (unsigned __int64)(v120 * (signed __int64)stru_F8AD28.plane_4.vNormal.x) >> 16; | |
786 v19 = v128; | |
787 stru_F8AD28._blv_lights_xs[i] = v126 | |
788 + v134 | |
789 + ((unsigned __int64)(v120 | |
790 * (signed __int64)stru_F8AD28.plane_4.vNormal.x) >> 16); | |
791 v20 = v19 - stru_F8AD28._blv_lights_zs[i++]; | |
792 } | |
793 } | |
794 else | |
795 { | |
796 if ( v2->uPolygonType != 3 ) | |
797 { | |
798 if ( v2->uPolygonType == 4 ) | |
799 { | |
800 LABEL_16: | |
801 a2 = 0; | |
802 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
803 { | |
804 do | |
805 { | |
806 v8 = a2; | |
807 v9 = stru_F8AD28._blv_lights_xs[a2]; | |
808 v131 = stru_F8AD28._blv_lights_ys[a2]; | |
809 v10 = stru_F8AD28._blv_lights_zs[a2]; | |
810 v11 = (signed int)(v10 * stru_F8AD28.plane_4.vNormal.z | |
811 + stru_F8AD28.plane_4.dist | |
812 + v9 * stru_F8AD28.plane_4.vNormal.x | |
813 + v131 * stru_F8AD28.plane_4.vNormal.y) >> 16; | |
814 v119 = v9 | |
815 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
816 * (signed __int64)((signed int)(v10 * stru_F8AD28.plane_4.vNormal.z | |
817 + stru_F8AD28.plane_4.dist | |
818 + v9 * stru_F8AD28.plane_4.vNormal.x | |
819 + v131 * stru_F8AD28.plane_4.vNormal.y) >> 16)) >> 16); | |
820 v131 -= (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)v11) >> 16; | |
821 v127 = v10 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)v11) >> 16); | |
822 stru_F8AD28._blv_lights_xs[a2] = ((unsigned __int64)(v119 | |
823 * (signed __int64)stru_F8AD28.vec_14.x) >> 16) | |
824 + ((unsigned __int64)((signed int)v131 | |
825 * (signed __int64)stru_F8AD28.vec_14.y) >> 16); | |
826 v124 = (unsigned __int64)(v119 * (signed __int64)stru_F8AD28.vec_20.x) >> 16; | |
827 v134 = (unsigned __int64)((signed int)v131 * (signed __int64)stru_F8AD28.vec_20.y) >> 16; | |
828 v133 = (unsigned __int64)(v127 * (signed __int64)stru_F8AD28.vec_20.z) >> 16; | |
829 v12 = v126; | |
830 stru_F8AD28._blv_lights_ys[v8] = v124 | |
831 + ((unsigned __int64)((signed int)v131 | |
832 * (signed __int64)stru_F8AD28.vec_20.y) >> 16) | |
833 + ((unsigned __int64)(v127 | |
834 * (signed __int64)stru_F8AD28.vec_20.z) >> 16); | |
835 stru_F8AD28._blv_lights_xs[v8] += v12; | |
836 stru_F8AD28._blv_lights_ys[v8] += v128; | |
837 ++a2; | |
838 } | |
839 while ( a2 < stru_F8AD28.uNumLightsApplied ); | |
840 v2 = v103; | |
841 } | |
842 goto LABEL_24; | |
843 } | |
844 if ( v2->uPolygonType != 5 ) | |
845 { | |
846 if ( v2->uPolygonType != 6 ) | |
847 goto LABEL_24; | |
848 goto LABEL_16; | |
849 } | |
850 } | |
851 for ( j = 0; j < stru_F8AD28.uNumLightsApplied; *(int *)v15 = v16 ) | |
852 { | |
853 v14 = v128; | |
854 stru_F8AD28._blv_lights_xs[j] += v126; | |
855 v15 = 4 * j + 16297672; | |
856 v16 = v14 - stru_F8AD28._blv_lights_ys[j++]; | |
857 } | |
858 } | |
859 LABEL_24: | |
860 v135 = 1; | |
861 pGame->_44ED0A(v2, &v135, 31); | |
862 v104 = sr_sub_47C24C_get_palette(v2, v109, 0, 1); | |
863 v134 = stru_F8AD28.field_44; | |
864 v106 = stru_F8AD28.field_48; | |
865 v21 = stru_F8A590._viewport_space_y; | |
866 a2 = stru_F8A590._viewport_space_y; | |
867 v110 = v111 * stru_F8A590._viewport_space_y; | |
868 v97 = v5->pLevelOfDetail0_prolly_alpha_mask; | |
869 v98 = v5->pLevelOfDetail1; | |
870 v99 = v5->pLevelOfDetail2; | |
871 v22 = v5->pLevelOfDetail3; | |
872 v23 = 640 * stru_F8A590._viewport_space_y; | |
873 v119 = 640 * stru_F8A590._viewport_space_y; | |
874 v100 = v22; | |
875 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
876 { | |
877 v24 = 2 * stru_F8A590._viewport_space_y; | |
878 v120 = 2 * stru_F8A590._viewport_space_y; | |
879 while ( 1 ) | |
880 { | |
881 a1 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v24); | |
882 sub_4AE313(a1, v21, &stru_F81018.field_0); | |
883 if ( LOBYTE(viewparams->field_20) ) | |
884 { | |
885 v27 = v111 * (v24 - pBLVRenderParams->uViewportY); | |
886 pZPixel = &pBLVRenderParams->pTargetZBuffer[2 | |
887 * (*(__int16 *)((char *)stru_F8A590.viewport_left_side + v24) | |
888 + 320 * (v24 - pBLVRenderParams->uViewportY)) | |
889 - pBLVRenderParams->uViewportX]; | |
890 pColorPixel = &pBLVRenderParams->pRenderTarget[v27 | |
891 + 2 * *(__int16 *)((char *)stru_F8A590.viewport_left_side + v24) | |
892 - pBLVRenderParams->uViewportX]; | |
893 v26 = &pBLVRenderParams->pRenderTarget[v27 | |
894 + 2 * *(__int16 *)((char *)stru_F8A590.viewport_right_side + v24) | |
895 - pBLVRenderParams->uViewportX]; | |
896 v23 = v119; | |
897 } | |
898 else | |
899 { | |
900 v25 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v24); | |
901 pZPixel = &pBLVRenderParams->pTargetZBuffer[v25 + v23]; | |
902 pColorPixel = &pBLVRenderParams->pRenderTarget[v25 + v110]; | |
903 v26 = &pBLVRenderParams->pRenderTarget[v110 + *(__int16 *)((char *)stru_F8A590.viewport_right_side + v24)]; | |
904 } | |
905 v131 = (unsigned int)v26; | |
906 HIWORD(v28) = HIWORD(stru_F81018.field_0.field_0); | |
907 LOWORD(v28) = 0; | |
908 v105 = stru_F8AD28.field_0 | v28; | |
909 v123 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
910 if ( (unsigned int)pColorPixel < v131 ) | |
911 { | |
912 v102 = v107 + v106; | |
913 v29 = (char *)&stru_F81018.field_34.field_8; | |
914 a1 += v134; | |
915 for ( k = &stru_F81018.field_34.field_8; ; v29 = (char *)k ) | |
916 { | |
917 sub_4AE313(a1, a2, (stru337_stru0 *)(v29 - 8)); | |
918 v30 = *((int *)v29 - 2); | |
919 LOWORD(v30) = 0; | |
920 v117 = v105; | |
921 v31 = stru_F8AD28.field_0 | v30; | |
922 if ( v105 <= (unsigned int)v31 ) | |
923 v117 = v31; | |
924 v105 = v31; | |
925 v32 = *((int *)v29 - 14); | |
926 v122 = *((int *)v29 - 14) >> v107; | |
927 v33 = *((int *)v29 - 13); | |
928 v125 = *((int *)v29 - 13) >> v107; | |
929 v34 = *((int *)v29 - 1) - v32; | |
930 v113 = (*(int *)v29 - v33) >> v102; | |
931 v35 = *((int *)v29 - 11); | |
932 v114 = v34 >> v102; | |
933 v116 = (&v97)[4 * v35]; | |
934 v36 = v35 + 16 - v5->uWidthLn2; | |
935 v133 = v35 + 16; | |
936 v127 = v35 + v36; | |
937 v37 = v5->uWidthMinus1 >> v35; | |
938 v38 = v5->uHeightMinus1 >> v35 << (v35 + 16); | |
939 v128 = v37; | |
940 v126 = v38; | |
941 v39 = (unsigned int)(LOBYTE(viewparams->field_20) ? &pColorPixel[2 * v134] : &pColorPixel[v134]); | |
942 if ( v39 > v131 ) | |
943 v39 = v131; | |
944 v40 = *((short *)v29 + 1); | |
945 v41 = *((short *)v29 - 1); | |
946 v121 = v39; | |
947 v42 = sub_4AE491(v41, v40); | |
948 v101 = v42; | |
949 v124 = (signed int)(v39 - (int)pColorPixel) >> 1; | |
950 if ( v123 >> 16 == v42 >> 16 || v135 & 2 ) | |
951 { | |
952 v123 = (int)sr_sub_47C24C_get_palette(v103, v109, v123 >> 16, 1); | |
953 if ( LOBYTE(viewparams->field_20) ) | |
954 { | |
955 v86 = pColorPixel; | |
956 if ( (unsigned int)pColorPixel < v121 ) | |
957 { | |
958 v87 = pZPixel; | |
959 v88 = v123; | |
960 v89 = v122; | |
961 v90 = v125; | |
962 v91 = v133; | |
963 v92 = v127; | |
964 if ( v124 & 2 ) | |
965 { | |
966 *pZPixel = v117; | |
967 v87 -= 2; | |
968 v86 = pColorPixel + 2; | |
969 goto LABEL_69; | |
970 } | |
971 do | |
972 { | |
973 v86 += 4; | |
974 v93 = *(&v116[v128 & (v89 >> v91)] + ((v126 & v90) >> v92)); | |
975 v94 = v117; | |
976 LOWORD(v93) = *(short *)(v88 + 2 * v93); | |
977 *v87 = v117; | |
978 v87[1] = v94; | |
979 v87[640] = v94; | |
980 v87[641] = v94; | |
981 *(v86 - 4) = v93; | |
982 *(v86 - 3) = v93; | |
983 v86[636] = v93; | |
984 v86[637] = v93; | |
985 v87[2] = v94; | |
986 v87[3] = v94; | |
987 v87[642] = v94; | |
988 v87[643] = v94; | |
989 v122 += v114; | |
990 v125 += v113; | |
991 v89 = v122; | |
992 v90 = v125; | |
993 LABEL_69: | |
994 v87 += 4; | |
995 v95 = *(short *)(v88 + 2 * *(&v116[v128 & (v89 >> v91)] + ((v126 & v90) >> v92))); | |
996 v96 = v114; | |
997 *(v86 - 2) = v95; | |
998 *(v86 - 1) = v95; | |
999 v86[638] = v95; | |
1000 v86[639] = v95; | |
1001 v122 += v96; | |
1002 v125 += v113; | |
1003 v89 = v122; | |
1004 v90 = v125; | |
1005 } | |
1006 while ( (unsigned int)v86 < v121 ); | |
1007 pColorPixel = v86; | |
1008 pZPixel = v87; | |
1009 } | |
1010 } | |
1011 else | |
1012 { | |
1013 v75 = pColorPixel; | |
1014 if ( (unsigned int)pColorPixel < v121 ) | |
1015 { | |
1016 v76 = pZPixel; | |
1017 v77 = v123; | |
1018 v78 = v122; | |
1019 v79 = v125; | |
1020 v80 = v133; | |
1021 v81 = v127; | |
1022 if ( v124 & 1 ) | |
1023 { | |
1024 *pZPixel = v117; | |
1025 --v76; | |
1026 v75 = pColorPixel + 1; | |
1027 goto LABEL_62; | |
1028 } | |
1029 do | |
1030 { | |
1031 v75 += 2; | |
1032 v82 = *(&v116[v128 & (v78 >> v80)] + ((v126 & v79) >> v81)); | |
1033 v83 = v117; | |
1034 LOWORD(v82) = *(short *)(v77 + 2 * v82); | |
1035 *v76 = v117; | |
1036 *(v75 - 2) = v82; | |
1037 v76[1] = v83; | |
1038 v122 += v114; | |
1039 v125 += v113; | |
1040 v78 = v122; | |
1041 v79 = v125; | |
1042 LABEL_62: | |
1043 v84 = (unsigned int)(&v116[v128 & (v78 >> v80)] + ((v126 & v79) >> v81)); | |
1044 v76 += 2; | |
1045 v85 = v114; | |
1046 *(v75 - 1) = *(short *)(v77 + 2 * *(char *)v84); | |
1047 v122 += v85; | |
1048 v125 += v113; | |
1049 v78 = v122; | |
1050 v79 = v125; | |
1051 } | |
1052 while ( (unsigned int)v75 < v121 ); | |
1053 pColorPixel = v75; | |
1054 pZPixel = v76; | |
1055 } | |
1056 } | |
1057 } | |
1058 else | |
1059 { | |
1060 v43 = (v42 - v123) >> v106; | |
1061 v44 = v123 - v43; | |
1062 v123 = v43; | |
1063 v115 = v44; | |
1064 if ( LOBYTE(viewparams->field_20) ) | |
1065 { | |
1066 v60 = pColorPixel; | |
1067 if ( (unsigned int)pColorPixel < v121 ) | |
1068 { | |
1069 v61 = pZPixel; | |
1070 v62 = v104; | |
1071 v63 = v122; | |
1072 v64 = v125; | |
1073 v65 = v133; | |
1074 v66 = v127; | |
1075 if ( v124 & 2 ) | |
1076 { | |
1077 *pZPixel = v117; | |
1078 v61 += 2; | |
1079 v60 = pColorPixel + 2; | |
1080 goto LABEL_54; | |
1081 } | |
1082 do | |
1083 { | |
1084 v67 = (v128 & (v63 >> v65)) + ((v126 & v64) >> v66); | |
1085 v68 = v123 + v115; | |
1086 v60 += 4; | |
1087 v115 = v68; | |
1088 v69 = ((v68 & 0xFFFF0000u) >> 8) + v116[v67]; | |
1089 v70 = v117; | |
1090 LOWORD(v69) = v62[v69]; | |
1091 *v61 = v117; | |
1092 v61[1] = v70; | |
1093 v61[640] = v70; | |
1094 v61[641] = v70; | |
1095 *(v60 - 4) = v69; | |
1096 *(v60 - 3) = v69; | |
1097 v60[636] = v69; | |
1098 v60[637] = v69; | |
1099 v61[2] = v70; | |
1100 v61[3] = v70; | |
1101 v61[642] = v70; | |
1102 v61[643] = v70; | |
1103 v122 += v114; | |
1104 v125 += v113; | |
1105 v63 = v122; | |
1106 v64 = v125; | |
1107 v61 += 4; | |
1108 LABEL_54: | |
1109 v71 = (v128 & (v63 >> v65)) + ((v126 & v64) >> v66); | |
1110 v72 = v123 + v115; | |
1111 v73 = v116[v71]; | |
1112 v115 = v72; | |
1113 LOWORD(v73) = v62[((v72 & 0xFFFF0000u) >> 8) + v73]; | |
1114 v74 = v114; | |
1115 *(v60 - 2) = v73; | |
1116 *(v60 - 1) = v73; | |
1117 v60[638] = v73; | |
1118 v60[639] = v73; | |
1119 v122 += v74; | |
1120 v125 += v113; | |
1121 v63 = v122; | |
1122 v64 = v125; | |
1123 } | |
1124 while ( (unsigned int)v60 < v121 ); | |
1125 pColorPixel = v60; | |
1126 pZPixel = v61; | |
1127 } | |
1128 } | |
1129 else | |
1130 { | |
1131 v45 = pColorPixel; | |
1132 if ( (unsigned int)pColorPixel < v121 ) | |
1133 { | |
1134 v46 = pZPixel; | |
1135 v47 = v104; | |
1136 v48 = v122; | |
1137 v49 = v125; | |
1138 v50 = v133; | |
1139 v51 = v127; | |
1140 if ( v124 & 1 ) | |
1141 { | |
1142 *pZPixel = v117; | |
1143 ++v46; | |
1144 v45 = pColorPixel + 1; | |
1145 goto LABEL_47; | |
1146 } | |
1147 do | |
1148 { | |
1149 v52 = (v128 & (v48 >> v50)) + ((v126 & v49) >> v51); | |
1150 v53 = v123 + v115; | |
1151 v45 += 2; | |
1152 v115 = v53; | |
1153 v54 = ((v53 & 0xFFFF0000u) >> 8) + v116[v52]; | |
1154 v55 = v117; | |
1155 LOWORD(v54) = v47[v54]; | |
1156 *v46 = v117; | |
1157 *(v45 - 2) = v54; | |
1158 v46[1] = v55; | |
1159 v122 += v114; | |
1160 v125 += v113; | |
1161 v48 = v122; | |
1162 v49 = v125; | |
1163 v46 += 2; | |
1164 LABEL_47: | |
1165 v56 = (v128 & (v48 >> v50)) + ((v126 & v49) >> v51); | |
1166 v57 = v123 + v115; | |
1167 v58 = v116[v56]; | |
1168 v115 = v57; | |
1169 LOWORD(v58) = v47[((v57 & 0xFFFF0000u) >> 8) + v58]; | |
1170 v59 = v114; | |
1171 *(v45 - 1) = v58; | |
1172 v122 += v59; | |
1173 v125 += v113; | |
1174 v48 = v122; | |
1175 v49 = v125; | |
1176 } | |
1177 while ( (unsigned int)v45 < v121 ); | |
1178 pColorPixel = v45; | |
1179 pZPixel = v46; | |
1180 } | |
1181 } | |
1182 } | |
1183 k += 13; | |
1184 v5 = v108; | |
1185 v123 = v101; | |
1186 a1 += v134; | |
1187 if ( (unsigned int)pColorPixel >= v131 ) | |
1188 break; | |
1189 } | |
1190 v23 = v119; | |
1191 v24 = v120; | |
1192 } | |
1193 ++a2; | |
1194 v110 += v111; | |
1195 v23 += 640; | |
1196 v24 += 2; | |
1197 v120 = v24; | |
1198 v119 = v23; | |
1199 if ( a2 > stru_F8A590._viewport_space_w ) | |
1200 break; | |
1201 v21 = a2; | |
1202 } | |
1203 } | |
1204 return; | |
1205 } | |
1206 } | |
1207 } | |
1208 } | |
1209 } | |
1210 } | |
1211 } | |
1212 } | |
1213 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
1214 | 602 |
1215 | 603 |
1216 | 604 |
1217 //----- (004B0E07) -------------------------------------------------------- | 605 //----- (004B0E07) -------------------------------------------------------- |
1218 unsigned int __fastcall sub_4B0E07(unsigned int uFaceID) | 606 unsigned int __fastcall sub_4B0E07(unsigned int uFaceID) |
1335 nodes[num_nodes].uFaceID = uFaceID; | 723 nodes[num_nodes].uFaceID = uFaceID; |
1336 nodes[num_nodes].uViewportX = pBLVRenderParams->uViewportX; | 724 nodes[num_nodes].uViewportX = pBLVRenderParams->uViewportX; |
1337 nodes[num_nodes].uViewportZ = pBLVRenderParams->uViewportZ; | 725 nodes[num_nodes].uViewportZ = pBLVRenderParams->uViewportZ; |
1338 nodes[num_nodes].uViewportY = pBLVRenderParams->uViewportY; | 726 nodes[num_nodes].uViewportY = pBLVRenderParams->uViewportY; |
1339 nodes[num_nodes].uViewportW = pBLVRenderParams->uViewportW; | 727 nodes[num_nodes].uViewportW = pBLVRenderParams->uViewportW; |
1340 nodes[num_nodes].field_C.GetViewportData(pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY, | 728 nodes[num_nodes].PortalScreenData.GetViewportData(pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY, |
1341 pBLVRenderParams->uViewportZ, pBLVRenderParams->uViewportW); | 729 pBLVRenderParams->uViewportZ, pBLVRenderParams->uViewportW); |
1342 AddBspNodeToRenderList(++num_nodes - 1); | 730 AddBspNodeToRenderList(++num_nodes - 1); |
1343 return; | 731 return; |
1344 } | 732 } |
1345 } | 733 } |
1350 if (nodes[node_id].uSectorID != pFace->uSectorID) | 738 if (nodes[node_id].uSectorID != pFace->uSectorID) |
1351 v9 = -v9; | 739 v9 = -v9; |
1352 if (v9 >= 0) | 740 if (v9 >= 0) |
1353 return; | 741 return; |
1354 | 742 |
1355 auto num_vertices = sub_423B5D(uFaceID); | 743 auto num_vertices = GetPortalScreenCoord(uFaceID); |
1356 if (num_vertices < 2) | 744 if (num_vertices < 2) |
1357 return; | 745 return; |
1358 | 746 |
1359 auto face_min_screenspace_x = stru_50B700._screen_space_x[0], | 747 auto face_min_screenspace_x = PortalFace._screen_space_x[0], |
1360 face_max_screenspace_x = stru_50B700._screen_space_x[0]; | 748 face_max_screenspace_x = PortalFace._screen_space_x[0]; |
1361 auto face_min_screenspace_y = stru_50B700._screen_space_y[0], | 749 auto face_min_screenspace_y = PortalFace._screen_space_y[0], |
1362 face_max_screenspace_y = stru_50B700._screen_space_y[0]; | 750 face_max_screenspace_y = PortalFace._screen_space_y[0]; |
1363 for (uint i = 1; i < num_vertices; ++i) | 751 for (uint i = 1; i < num_vertices; ++i) |
1364 { | 752 { |
1365 if (face_min_screenspace_x > stru_50B700._screen_space_x[i]) | 753 if (face_min_screenspace_x > PortalFace._screen_space_x[i]) |
1366 face_min_screenspace_x = stru_50B700._screen_space_x[i]; | 754 face_min_screenspace_x = PortalFace._screen_space_x[i]; |
1367 if (face_max_screenspace_x < stru_50B700._screen_space_x[i]) | 755 if (face_max_screenspace_x < PortalFace._screen_space_x[i]) |
1368 face_max_screenspace_x = stru_50B700._screen_space_x[i]; | 756 face_max_screenspace_x = PortalFace._screen_space_x[i]; |
1369 | 757 |
1370 if (face_min_screenspace_y > stru_50B700._screen_space_y[i]) | 758 if (face_min_screenspace_y > PortalFace._screen_space_y[i]) |
1371 face_min_screenspace_y = stru_50B700._screen_space_y[i]; | 759 face_min_screenspace_y = PortalFace._screen_space_y[i]; |
1372 if (face_max_screenspace_y < stru_50B700._screen_space_y[i]) | 760 if (face_max_screenspace_y < PortalFace._screen_space_y[i]) |
1373 face_max_screenspace_y = stru_50B700._screen_space_y[i]; | 761 face_max_screenspace_y = PortalFace._screen_space_y[i]; |
1374 } | 762 } |
1375 //_screen_space_x = 719, 568, 493 | 763 //_screen_space_x = 719, 568, 493 |
1376 //savegame: qw , 0Bh and 0x1D4h | 764 //savegame: qw , 0Bh and 0x1D4h |
1377 //problem here when standing near/on portal, condition is false because of face_min_screenspace_x > p->uViewportZ | 765 //problem here when standing near/on portal, condition is false because of face_min_screenspace_x > p->uViewportZ |
1378 if (face_max_screenspace_x >= nodes[node_id].uViewportX && | 766 if (face_max_screenspace_x >= nodes[node_id].uViewportX && |
1379 face_min_screenspace_x <= nodes[node_id].uViewportZ && | 767 face_min_screenspace_x <= nodes[node_id].uViewportZ && |
1380 face_max_screenspace_y >= nodes[node_id].uViewportY && | 768 face_max_screenspace_y >= nodes[node_id].uViewportY && |
1381 face_min_screenspace_y <= nodes[node_id].uViewportW && | 769 face_min_screenspace_y <= nodes[node_id].uViewportW && |
1382 sub_424829(num_vertices, &nodes[num_nodes].field_C, &nodes[node_id].field_C, uFaceID)) | 770 PortalFrustrum(num_vertices, &nodes[num_nodes].PortalScreenData, &nodes[node_id].PortalScreenData, uFaceID)) |
1383 { | 771 { |
1384 pTransitionSector = pFace->uSectorID; | 772 pTransitionSector = pFace->uSectorID; |
1385 if (nodes[node_id].uSectorID == pTransitionSector ) | 773 if (nodes[node_id].uSectorID == pTransitionSector ) |
1386 pTransitionSector = pFace->uBackSectorID; | 774 pTransitionSector = pFace->uBackSectorID; |
1387 nodes[num_nodes].uSectorID = pTransitionSector; | 775 nodes[num_nodes].uSectorID = pTransitionSector; |
1479 v3->nodes[v3->num_nodes].uFaceID = uFaceID; | 867 v3->nodes[v3->num_nodes].uFaceID = uFaceID; |
1480 v3->nodes[v3->num_nodes].uViewportX = LOWORD(pBLVRenderParams->uViewportX); | 868 v3->nodes[v3->num_nodes].uViewportX = LOWORD(pBLVRenderParams->uViewportX); |
1481 v3->nodes[v3->num_nodes].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ); | 869 v3->nodes[v3->num_nodes].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ); |
1482 v3->nodes[v3->num_nodes].uViewportY = LOWORD(pBLVRenderParams->uViewportY); | 870 v3->nodes[v3->num_nodes].uViewportY = LOWORD(pBLVRenderParams->uViewportY); |
1483 v3->nodes[v3->num_nodes].uViewportW = LOWORD(pBLVRenderParams->uViewportW); | 871 v3->nodes[v3->num_nodes].uViewportW = LOWORD(pBLVRenderParams->uViewportW); |
1484 v3->nodes[v3->num_nodes++].field_C.GetViewportData( | 872 v3->nodes[v3->num_nodes++].PortalScreenData.GetViewportData( |
1485 SLOWORD(pBLVRenderParams->uViewportX), | 873 SLOWORD(pBLVRenderParams->uViewportX), |
1486 pBLVRenderParams->uViewportY, | 874 pBLVRenderParams->uViewportY, |
1487 SLOWORD(pBLVRenderParams->uViewportZ), | 875 SLOWORD(pBLVRenderParams->uViewportZ), |
1488 pBLVRenderParams->uViewportW); | 876 pBLVRenderParams->uViewportW); |
1489 v7 = v3->num_nodes - 1; | 877 v7 = v3->num_nodes - 1; |
1498 + v4->pFacePlane_old.vNormal.z * (v8->z - pBLVRenderParams->vPartyPos.z); | 886 + v4->pFacePlane_old.vNormal.z * (v8->z - pBLVRenderParams->vPartyPos.z); |
1499 if ( *((short *)v5 + 2004) != v4->uSectorID ) | 887 if ( *((short *)v5 + 2004) != v4->uSectorID ) |
1500 v9 = -v9; | 888 v9 = -v9; |
1501 if ( v9 < 0 ) | 889 if ( v9 < 0 ) |
1502 { | 890 { |
1503 v10 = sub_423B5D(uFaceID); | 891 v10 = GetPortalScreenCoord(uFaceID); |
1504 v19 = v10; | 892 v19 = v10; |
1505 if ( v10 ) | 893 if ( v10 ) |
1506 { | 894 { |
1507 v11 = stru_50B700._screen_space_x[0]; | 895 v11 = PortalFace._screen_space_x[0]; |
1508 v12 = stru_50B700._screen_space_y[0]; | 896 v12 = PortalFace._screen_space_y[0]; |
1509 v23 = stru_50B700._screen_space_x[0]; | 897 v23 = PortalFace._screen_space_x[0]; |
1510 v13 = 1; | 898 v13 = 1; |
1511 v22 = stru_50B700._screen_space_y[0]; | 899 v22 = PortalFace._screen_space_y[0]; |
1512 if ( v10 > 1 ) | 900 if ( v10 > 1 ) |
1513 { | 901 { |
1514 do | 902 do |
1515 { | 903 { |
1516 v14 = stru_50B700._screen_space_x[v13]; | 904 v14 = PortalFace._screen_space_x[v13]; |
1517 if ( v14 < v23 ) | 905 if ( v14 < v23 ) |
1518 v23 = stru_50B700._screen_space_x[v13]; | 906 v23 = PortalFace._screen_space_x[v13]; |
1519 if ( v14 > v11 ) | 907 if ( v14 > v11 ) |
1520 v11 = stru_50B700._screen_space_x[v13]; | 908 v11 = PortalFace._screen_space_x[v13]; |
1521 v15 = stru_50B700._screen_space_y[v13]; | 909 v15 = PortalFace._screen_space_y[v13]; |
1522 if ( v15 < v22 ) | 910 if ( v15 < v22 ) |
1523 v22 = stru_50B700._screen_space_y[v13]; | 911 v22 = PortalFace._screen_space_y[v13]; |
1524 if ( v15 > v12 ) | 912 if ( v15 > v12 ) |
1525 v12 = stru_50B700._screen_space_y[v13]; | 913 v12 = PortalFace._screen_space_y[v13]; |
1526 v10 = v19; | 914 v10 = v19; |
1527 ++v13; | 915 ++v13; |
1528 } | 916 } |
1529 while ( v13 < v19 ); | 917 while ( v13 < v19 ); |
1530 } | 918 } |
1531 if ( v11 >= *((short *)v20 + 2005) | 919 if ( v11 >= *((short *)v20 + 2005) |
1532 && v23 <= *((short *)v20 + 2007) | 920 && v23 <= *((short *)v20 + 2007) |
1533 && v12 >= *((short *)v20 + 2006) | 921 && v12 >= *((short *)v20 + 2006) |
1534 && v22 <= *((short *)v20 + 2008) | 922 && v22 <= *((short *)v20 + 2008) |
1535 && sub_424829(v10, &v3->nodes[v3->num_nodes].field_C, (BspRenderer_stru2 *)(v20 + 4020), uFaceID) ) | 923 && PortalFrustrum(v10, &v3->nodes[v3->num_nodes].PortalScreenData, (BspRenderer_PortalViewportData *)(v20 + 4020), uFaceID) ) |
1536 { | 924 { |
1537 v16 = v21->uSectorID; | 925 v16 = v21->uSectorID; |
1538 if ( *((short *)v20 + 2004) == v16 ) | 926 if ( *((short *)v20 + 2004) == v16 ) |
1539 v16 = v21->uBackSectorID; | 927 v16 = v21->uBackSectorID; |
1540 v3->nodes[v3->num_nodes].uSectorID = v16; | 928 v3->nodes[v3->num_nodes].uSectorID = v16; |
1585 if ( v1 >= 0 ) | 973 if ( v1 >= 0 ) |
1586 { | 974 { |
1587 if ( v1 < (signed int)pIndoor->uNumFaces ) | 975 if ( v1 < (signed int)pIndoor->uNumFaces ) |
1588 { | 976 { |
1589 v2 = pBspRenderer->faces[i].uFaceID; | 977 v2 = pBspRenderer->faces[i].uFaceID; |
1590 pBLVRenderParams->field_7C = &pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].field_C; | 978 pBLVRenderParams->field_7C = &pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].PortalScreenData; |
1591 v3 = sub_423B5D(v2); | 979 v3 = GetPortalScreenCoord(v2); |
1592 if ( v3 ) | 980 if ( v3 ) |
1593 { | 981 { |
1594 if ( sub_424829(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) | 982 if ( PortalFrustrum(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) |
1595 { | 983 { |
1596 v4 = stru_F8A590._viewport_space_y; | 984 v4 = stru_F8A590._viewport_space_y; |
1597 v5 = pBLVRenderParams->pRenderTarget; | 985 v5 = pBLVRenderParams->pRenderTarget; |
1598 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | 986 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) |
1599 { | 987 { |
5610 local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; | 4998 local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; |
5611 local_0.uDiffuse = 0xFF3C1E; | 4999 local_0.uDiffuse = 0xFF3C1E; |
5612 local_0.x = v5; | 5000 local_0.x = v5; |
5613 local_0.y = (double)v2->vPosition.y; | 5001 local_0.y = (double)v2->vPosition.y; |
5614 local_0.z = (double)v2->vPosition.z; | 5002 local_0.z = (double)v2->vPosition.z; |
5615 local_0.flt_10 = 0.0; | 5003 local_0.r = 0.0; |
5616 local_0.flt_14 = 0.0; | 5004 local_0.g = 0.0; |
5617 local_0.flt_18 = 0.0; | 5005 local_0.b = 0.0; |
5618 local_0.flt_28 = 1.0; | 5006 local_0.flt_28 = 1.0; |
5619 local_0.timeToLive = (rand() & 0x80) + 128; | 5007 local_0.timeToLive = (rand() & 0x80) + 128; |
5620 local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); | 5008 local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); |
5621 pGame->pParticleEngine->AddParticle(&local_0); | 5009 pGame->pParticleEngine->AddParticle(&local_0); |
5622 return; | 5010 return; |
5732 pBspRenderer->nodes[0].uSectorID = pBLVRenderParams->uPartySectorID; | 5120 pBspRenderer->nodes[0].uSectorID = pBLVRenderParams->uPartySectorID; |
5733 pBspRenderer->nodes[0].uViewportW = pBLVRenderParams->uViewportW; | 5121 pBspRenderer->nodes[0].uViewportW = pBLVRenderParams->uViewportW; |
5734 pBspRenderer->nodes[0].uViewportZ = pBLVRenderParams->uViewportZ; | 5122 pBspRenderer->nodes[0].uViewportZ = pBLVRenderParams->uViewportZ; |
5735 pBspRenderer->nodes[0].uViewportY = pBLVRenderParams->uViewportY; | 5123 pBspRenderer->nodes[0].uViewportY = pBLVRenderParams->uViewportY; |
5736 pBspRenderer->nodes[0].uViewportX = pBLVRenderParams->uViewportX; | 5124 pBspRenderer->nodes[0].uViewportX = pBLVRenderParams->uViewportX; |
5737 pBspRenderer->nodes[0].field_C.GetViewportData(pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY, | 5125 pBspRenderer->nodes[0].PortalScreenData.GetViewportData(pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY, |
5738 pBLVRenderParams->uViewportZ, pBLVRenderParams->uViewportW); | 5126 pBLVRenderParams->uViewportZ, pBLVRenderParams->uViewportW); |
5739 pBspRenderer->nodes[0].uFaceID = -1; | 5127 pBspRenderer->nodes[0].uFaceID = -1; |
5740 pBspRenderer->nodes[0].viewing_portal_id = -1; | 5128 pBspRenderer->nodes[0].viewing_portal_id = -1; |
5741 pBspRenderer->num_nodes = 1; | 5129 pBspRenderer->num_nodes = 1; |
5742 AddBspNodeToRenderList(0); | 5130 AddBspNodeToRenderList(0); |
5744 | 5132 |
5745 pBspRenderer->MakeVisibleSectorList(); | 5133 pBspRenderer->MakeVisibleSectorList(); |
5746 } | 5134 } |
5747 | 5135 |
5748 //----- (0043F9E1) -------------------------------------------------------- | 5136 //----- (0043F9E1) -------------------------------------------------------- |
5749 void BspRenderer_stru2::GetViewportData(__int16 x, int y, __int16 z, int w) | 5137 void BspRenderer_PortalViewportData::GetViewportData(__int16 x, int y, __int16 z, int w) |
5750 { | 5138 { |
5751 _viewport_space_y = y; | 5139 _viewport_space_y = y; |
5752 _viewport_space_w = w; | 5140 _viewport_space_w = w; |
5753 | 5141 |
5754 for (uint i = 0; i < 480; ++i) | 5142 for (uint i = 0; i < 480; ++i) |
6829 UpdateActors_BLV(); | 6217 UpdateActors_BLV(); |
6830 BLV_UpdateDoors(); | 6218 BLV_UpdateDoors(); |
6831 check_event_triggers(); | 6219 check_event_triggers(); |
6832 } | 6220 } |
6833 //----- (00424829) -------------------------------------------------------- | 6221 //----- (00424829) -------------------------------------------------------- |
6834 bool sub_424829(int pNumVertices, BspRenderer_stru2 *a2, BspRenderer_stru2 *a3, int uFaceID) | 6222 // Finds out if current portal can be seen through the previous portal |
6223 bool PortalFrustrum(int pNumVertices, BspRenderer_PortalViewportData *far_portal, BspRenderer_PortalViewportData *near_portal, int uFaceID) | |
6835 { | 6224 { |
6836 //int v4; // edi@1 | |
6837 //BspRenderer_stru2 *v5; // ebx@1 | |
6838 int v6; // eax@3 | |
6839 int min_y; // esi@5 | 6225 int min_y; // esi@5 |
6840 int max_y; // edx@5 | 6226 int max_y; // edx@5 |
6841 //int v9; // ecx@6 | 6227 int current_ID; // eax@12 |
6842 int v10; // eax@12 | |
6843 //int v11; // edi@13 | |
6844 //int v12; // edx@18 | |
6845 int v13; // eax@22 | 6228 int v13; // eax@22 |
6846 //int v14; // edi@28 | |
6847 int v15; // ecx@29 | 6229 int v15; // ecx@29 |
6848 //int v16; // edi@30 | |
6849 //int v17; // edx@35 | |
6850 int v18; // eax@39 | 6230 int v18; // eax@39 |
6851 int v19; // eax@44 | 6231 int v19; // eax@44 |
6852 int v20; // ecx@44 | 6232 int v20; // ecx@44 |
6853 //int v21; // edi@45 | |
6854 int v22; // edi@46 | 6233 int v22; // edi@46 |
6855 //__int16 *v23; // ecx@47 | |
6856 int v24; // edx@48 | 6234 int v24; // edx@48 |
6857 //int v25; // eax@50 | |
6858 int v26; // eax@55 | 6235 int v26; // eax@55 |
6859 signed int v27; // edi@55 | 6236 signed int v27; // edi@55 |
6860 //int v28; // edx@56 | |
6861 int v29; // edx@57 | 6237 int v29; // edx@57 |
6862 //int v30; // eax@59 | |
6863 int v31; // eax@64 | 6238 int v31; // eax@64 |
6864 signed int v32; // edi@64 | 6239 signed int v32; // edi@64 |
6865 //int v33; // edx@65 | |
6866 int v34; // eax@66 | 6240 int v34; // eax@66 |
6867 int v35; // dx@66 | 6241 int v35; // dx@66 |
6868 __int16 v36; // dx@67 | 6242 __int16 v36; // dx@67 |
6869 __int16 v37; // di@67 | 6243 //__int16 v37; // di@67 |
6870 __int16 v38; // dx@67 | 6244 __int16 v38; // dx@67 |
6871 //BspRenderer_stru2 *v39; // ecx@69 | |
6872 //int v40; // edx@69 | |
6873 //int v41; // edi@70 | |
6874 //__int16 *v42; // eax@76 | |
6875 //__int16 *v43; // eax@81 | |
6876 //__int16 *v45; // eax@87 | |
6877 int v46; // edx@87 | 6245 int v46; // edx@87 |
6878 //__int16 v47; // cx@88 | |
6879 //int v48; // eax@93 | |
6880 int v49; // esi@93 | 6246 int v49; // esi@93 |
6881 //__int16 *v50; // ecx@94 | |
6882 //int v51; // eax@95 | |
6883 //int v52; // eax@97 | |
6884 int v53; // [sp+Ch] [bp-34h]@44 | 6247 int v53; // [sp+Ch] [bp-34h]@44 |
6885 int v54; // [sp+10h] [bp-30h]@0 | 6248 int v54; // [sp+10h] [bp-30h]@0 |
6886 int v55; // [sp+14h] [bp-2Ch]@12 | 6249 int min_y_ID2; // [sp+14h] [bp-2Ch]@12 |
6887 //__int16 *v56; // [sp+14h] [bp-2Ch]@47 | |
6888 //__int16 v57; // [sp+14h] [bp-2Ch]@76 | |
6889 //__int16 v58; // [sp+14h] [bp-2Ch]@81 | |
6890 int v59; // [sp+14h] [bp-2Ch]@87 | 6250 int v59; // [sp+14h] [bp-2Ch]@87 |
6891 //BspRenderer_stru2 *v60; // [sp+18h] [bp-28h]@1 | |
6892 int v61; // [sp+1Ch] [bp-24h]@29 | 6251 int v61; // [sp+1Ch] [bp-24h]@29 |
6893 int v62; // [sp+20h] [bp-20h]@0 | 6252 int v62; // [sp+20h] [bp-20h]@0 |
6894 signed int v63; // [sp+24h] [bp-1Ch]@3 | 6253 signed int direction1; // [sp+24h] [bp-1Ch]@3 |
6895 signed int v64; // [sp+28h] [bp-18h]@3 | 6254 signed int direction2; // [sp+28h] [bp-18h]@3 |
6896 int v65; // [sp+2Ch] [bp-14h]@5 | 6255 int min_y_ID; // [sp+2Ch] [bp-14h]@5 |
6897 //int v66; // [sp+2Ch] [bp-14h]@39 | |
6898 //int v67; // [sp+30h] [bp-10h]@22 | |
6899 int v68; // [sp+34h] [bp-Ch]@12 | |
6900 int v69; // [sp+34h] [bp-Ch]@29 | 6256 int v69; // [sp+34h] [bp-Ch]@29 |
6901 int v70; // [sp+34h] [bp-Ch]@46 | 6257 int v70; // [sp+34h] [bp-Ch]@46 |
6902 int v71; // [sp+34h] [bp-Ch]@75 | 6258 |
6903 int v72; // [sp+34h] [bp-Ch]@80 | |
6904 //int v73; // [sp+38h] [bp-8h]@11 | |
6905 //int v74; // [sp+3Ch] [bp-4h]@1 | |
6906 //int a3a; // [sp+48h] [bp+8h]@76 | |
6907 //int a3b; // [sp+48h] [bp+8h]@87 | |
6908 | |
6909 //try graphic engine with function returning 1 always, and without | |
6910 //return true; | |
6911 if ( pNumVertices <= 1 ) | 6259 if ( pNumVertices <= 1 ) |
6912 return false; | 6260 return false; |
6913 min_y = stru_50B700._screen_space_y[0]; | 6261 min_y = PortalFace._screen_space_y[0]; |
6914 v65 = 0; | 6262 min_y_ID = 0; |
6915 max_y = stru_50B700._screen_space_y[0]; | 6263 max_y = PortalFace._screen_space_y[0]; |
6916 if ( !stru_50B700.field_0 ) | 6264 //face direction( ) |
6917 { | 6265 if ( !PortalFace.direction ) |
6918 v63 = 1; | 6266 { |
6919 v64 = -1; | 6267 direction1 = 1; |
6268 direction2 = -1; | |
6920 } | 6269 } |
6921 else | 6270 else |
6922 { | 6271 { |
6923 v63 = -1; | 6272 direction1 = -1; |
6924 v64 = 1; | 6273 direction2 = 1; |
6925 } | 6274 } |
6926 | 6275 |
6927 for ( v6 = 1; v6 < pNumVertices; ++v6 ) | 6276 //get min and max y for portal( y ) |
6928 { | 6277 for ( uint i = 1; i < pNumVertices; ++i ) |
6929 if ( stru_50B700._screen_space_y[v6] >= min_y ) | 6278 { |
6930 { | 6279 if (PortalFace._screen_space_y[i] < min_y) |
6931 if ( stru_50B700._screen_space_y[v6] > max_y ) | 6280 { |
6932 max_y = stru_50B700._screen_space_y[v6]; | 6281 min_y_ID = i; |
6933 } | 6282 min_y = PortalFace._screen_space_y[i]; |
6934 if ( stru_50B700._screen_space_y[v6] < min_y ) | 6283 } |
6935 { | 6284 else if (PortalFace._screen_space_y[i] > max_y) |
6936 v65 = v6; | 6285 { |
6937 min_y = stru_50B700._screen_space_y[v6]; | 6286 max_y = PortalFace._screen_space_y[i]; |
6938 } | 6287 } |
6939 } | 6288 } |
6940 if ( max_y == min_y ) | 6289 if ( max_y == min_y ) |
6941 return false; | 6290 return false; |
6942 | 6291 |
6943 v10 = v65; | 6292 //***************************************************************************************************************************** |
6944 a2->_viewport_space_y = min_y; | 6293 far_portal->_viewport_space_y = min_y; |
6945 a2->_viewport_space_w = max_y; | 6294 far_portal->_viewport_space_w = max_y; |
6946 v55 = v65; | 6295 current_ID = min_y_ID; |
6947 | 6296 min_y_ID2 = min_y_ID; |
6948 for ( v68 = 0; v68 < pNumVertices; ++v68 ) | 6297 |
6949 { | 6298 for ( uint i = 0; i < pNumVertices; ++i ) |
6950 v10 += v64; | 6299 { |
6951 if ( v10 < pNumVertices ) | 6300 current_ID += direction2; |
6952 { | 6301 if ( current_ID < pNumVertices ) |
6953 if ( v10 < 0 ) | 6302 { |
6954 v10 += pNumVertices; | 6303 if ( current_ID < 0 ) |
6304 current_ID += pNumVertices; | |
6955 } | 6305 } |
6956 else | 6306 else |
6957 v10 -= pNumVertices; | 6307 current_ID -= pNumVertices; |
6958 if ( stru_50B700._screen_space_y[v10] <= stru_50B700._screen_space_y[v65] ) | 6308 if ( PortalFace._screen_space_y[current_ID] <= PortalFace._screen_space_y[min_y_ID] )// |
6959 { | 6309 { |
6960 v55 = v10; | 6310 min_y_ID2 = current_ID; |
6961 v65 = v10; | 6311 min_y_ID = current_ID; |
6962 } | 6312 } |
6963 if ( stru_50B700._screen_space_y[v10] == max_y ) | 6313 if ( PortalFace._screen_space_y[current_ID] == max_y ) |
6964 break; | 6314 break; |
6965 } | 6315 } |
6966 v13 = v55 + v64; | 6316 |
6317 v13 = min_y_ID2 + direction2; | |
6967 if ( v13 < pNumVertices ) | 6318 if ( v13 < pNumVertices ) |
6968 { | 6319 { |
6969 if ( v13 < 0 ) | 6320 if ( v13 < 0 ) |
6970 v13 += pNumVertices; | 6321 v13 += pNumVertices; |
6971 } | 6322 } |
6972 else | 6323 else |
6973 v13 -= pNumVertices; | 6324 v13 -= pNumVertices; |
6974 if ( stru_50B700._screen_space_y[v13] != stru_50B700._screen_space_y[v55] ) | 6325 if ( PortalFace._screen_space_y[v13] != PortalFace._screen_space_y[min_y_ID2] ) |
6975 { | 6326 { |
6976 v62 = stru_50B700._screen_space_x[v55] << 16; | 6327 v62 = PortalFace._screen_space_x[min_y_ID2] << 16; |
6977 v54 = ((stru_50B700._screen_space_x[v13] - stru_50B700._screen_space_x[v55]) << 16) / (stru_50B700._screen_space_y[v13] - stru_50B700._screen_space_y[v55]); | 6328 v54 = ((PortalFace._screen_space_x[v13] - PortalFace._screen_space_x[min_y_ID2]) << 16) / |
6978 a2->viewport_left_side[min_y] = LOWORD(stru_50B700._screen_space_x[v55]); | 6329 (PortalFace._screen_space_y[v13] - PortalFace._screen_space_y[min_y_ID2]); |
6979 } | 6330 far_portal->viewport_left_side[min_y] = (short)PortalFace._screen_space_x[min_y_ID2]; |
6980 v15 = v65; | 6331 } |
6981 v61 = v65; | 6332 //**************************************************************************************************************************************** |
6982 | 6333 // |
6334 v15 = min_y_ID; | |
6335 v61 = min_y_ID; | |
6983 for ( v69 = 0; v69 < pNumVertices; ++v69 ) | 6336 for ( v69 = 0; v69 < pNumVertices; ++v69 ) |
6984 { | 6337 { |
6985 v15 += v63; | 6338 v15 += direction1; |
6986 if ( v15 < pNumVertices ) | 6339 if ( v15 < pNumVertices ) |
6987 { | 6340 { |
6988 if ( v15 < 0 ) | 6341 if ( v15 < 0 ) |
6989 v15 += pNumVertices; | 6342 v15 += pNumVertices; |
6990 } | 6343 } |
6991 else | 6344 else |
6992 v15 -= pNumVertices; | 6345 v15 -= pNumVertices; |
6993 if ( stru_50B700._screen_space_y[v15] <= stru_50B700._screen_space_y[v65] ) | 6346 if ( PortalFace._screen_space_y[v15] <= PortalFace._screen_space_y[min_y_ID] ) |
6994 { | 6347 { |
6995 v61 = v15; | 6348 v61 = v15; |
6996 v65 = v15; | 6349 min_y_ID = v15; |
6997 } | 6350 } |
6998 if ( stru_50B700._screen_space_y[v15] == max_y ) | 6351 if ( PortalFace._screen_space_y[v15] == max_y ) |
6999 break; | 6352 break; |
7000 } | 6353 } |
7001 v18 = v63 + v61; | 6354 v18 = direction1 + v61; |
7002 if ( v18 < pNumVertices ) | 6355 if ( v18 < pNumVertices ) |
7003 { | 6356 { |
7004 if ( v18 < 0 ) | 6357 if ( v18 < 0 ) |
7005 v18 += pNumVertices; | 6358 v18 += pNumVertices; |
7006 } | 6359 } |
7007 else | 6360 else |
7008 v18 -= pNumVertices; | 6361 v18 -= pNumVertices; |
7009 v19 = v18; | 6362 v19 = v18; |
7010 v20 = v61; | 6363 v20 = v61; |
7011 if ( stru_50B700._screen_space_y[v19] != stru_50B700._screen_space_y[v61] ) | 6364 if ( PortalFace._screen_space_y[v19] != PortalFace._screen_space_y[v61] ) |
7012 { | 6365 { |
7013 v61 = stru_50B700._screen_space_x[v20] << 16; | 6366 v61 = PortalFace._screen_space_x[v20] << 16; |
7014 v53 = ((stru_50B700._screen_space_x[v19] - stru_50B700._screen_space_x[v20]) << 16) / stru_50B700._screen_space_y[v19] - stru_50B700._screen_space_y[v20]; | 6367 v53 = ((PortalFace._screen_space_x[v19] - PortalFace._screen_space_x[v20]) << 16) / |
7015 a2->viewport_right_side[max_y] = LOWORD(stru_50B700._screen_space_x[v20]); | 6368 (PortalFace._screen_space_y[v19] - PortalFace._screen_space_y[v20]); |
7016 } | 6369 far_portal->viewport_right_side[max_y] = (short)PortalFace._screen_space_x[v20]; |
6370 } | |
6371 //**************************************************************************************************************************************** | |
7017 v22 = min_y; | 6372 v22 = min_y; |
7018 if ( min_y <= max_y ) | 6373 if ( min_y <= max_y ) |
7019 { | 6374 { |
7020 //v56 = &a2->array_3D8[v7]; | |
7021 //v23 = &a2->array_18[v7]; | |
7022 for ( v70 = min_y; v70 <= max_y; ++v70 ) | 6375 for ( v70 = min_y; v70 <= max_y; ++v70 ) |
7023 { | 6376 { |
7024 v24 = v13; | 6377 v24 = v13; |
7025 if ( v22 >= stru_50B700._screen_space_y[v13] && v22 != max_y ) | 6378 if ( v22 >= PortalFace._screen_space_y[v13] && v22 != max_y ) |
7026 { | 6379 { |
7027 v13 = v64 + v13; | 6380 v13 = direction2 + v13; |
7028 if ( v13 < pNumVertices ) | 6381 if ( v13 < pNumVertices ) |
7029 { | 6382 { |
7030 if ( v13 < 0 ) | 6383 if ( v13 < 0 ) |
7031 v13 += pNumVertices; | 6384 v13 += pNumVertices; |
7032 } | 6385 } |
7033 else | 6386 else |
7034 v13 -= pNumVertices; | 6387 v13 -= pNumVertices; |
7035 v26 = v13; | 6388 v26 = v13; |
7036 //v27 = stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24]; | 6389 if ( PortalFace._screen_space_y[v26] - PortalFace._screen_space_y[v24] > 0 ) |
7037 if ( stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24] > 0 ) | |
7038 { | 6390 { |
7039 v54 = ((stru_50B700._screen_space_x[v26] - stru_50B700._screen_space_x[v24]) << 16) / stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24]; | 6391 v54 = ((PortalFace._screen_space_x[v26] - PortalFace._screen_space_x[v24]) << 16) / (PortalFace._screen_space_y[v26] - PortalFace._screen_space_y[v24]); |
7040 v62 = stru_50B700._screen_space_x[v24] << 16; | 6392 v62 = PortalFace._screen_space_x[v24] << 16; |
7041 } | 6393 } |
7042 } | 6394 } |
7043 v29 = v18; | 6395 v29 = v18; |
7044 if ( v70 >= stru_50B700._screen_space_y[v18] && v70 != max_y ) | 6396 if ( v70 >= PortalFace._screen_space_y[v18] && v70 != max_y ) |
7045 { | 6397 { |
7046 v18 += v63; | 6398 v18 += direction1; |
7047 if ( v18 < pNumVertices ) | 6399 if ( v18 < pNumVertices ) |
7048 { | 6400 { |
7049 if ( v18 < 0 ) | 6401 if ( v18 < 0 ) |
7050 v18 += pNumVertices; | 6402 v18 += pNumVertices; |
7051 } | 6403 } |
7052 else | 6404 else |
7053 v18 -= pNumVertices; | 6405 v18 -= pNumVertices; |
7054 v31 = v18; | 6406 v31 = v18; |
7055 //v32 = stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29]; | 6407 if ( PortalFace._screen_space_y[v31] - PortalFace._screen_space_y[v29] > 0 ) |
7056 if ( stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29] > 0 ) | |
7057 { | 6408 { |
7058 v53 = ((stru_50B700._screen_space_x[v31] - stru_50B700._screen_space_x[v29]) << 16) / stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29]; | 6409 v53 = ((PortalFace._screen_space_x[v31] - PortalFace._screen_space_x[v29]) << 16) / (PortalFace._screen_space_y[v31] - PortalFace._screen_space_y[v29]); |
7059 v61 = stru_50B700._screen_space_x[v29] << 16; | 6410 v61 = PortalFace._screen_space_x[v29] << 16; |
7060 } | 6411 } |
7061 } | 6412 } |
7062 //v34 = (char *)a2->array_18 - (char *)a2->array_3D8; | 6413 far_portal->viewport_left_side[v70] = HIWORD(v62); |
7063 //v35 = *(__int16 *)((char *)&a2->array_3D8[v70] + v34); | 6414 far_portal->viewport_right_side[v70] = HIWORD(v61); |
7064 //v35 = HIWORD(v62); | 6415 if ( far_portal->viewport_left_side[v70] > far_portal->viewport_right_side[v70] ) |
7065 a2->viewport_left_side[v70] = HIWORD(v62); | 6416 { |
7066 a2->viewport_right_side[v70] = HIWORD(v61); | 6417 v36 = far_portal->viewport_left_side[v70] ^ far_portal->viewport_right_side[v70]; |
7067 //v34 = &a2->array_3D8[v70]; | 6418 //v37 = far_portal->viewport_right_side[v70]; |
7068 //v35 = a2->array_3D8[v70]; | 6419 far_portal->viewport_left_side[v70] = v36; |
7069 if ( a2->viewport_left_side[v70] > a2->viewport_right_side[v70] ) | 6420 v38 = far_portal->viewport_right_side[v70] ^ v36; |
7070 { | 6421 far_portal->viewport_left_side[v70] ^= v38; |
7071 v36 = a2->viewport_left_side[v70] ^ a2->viewport_right_side[v70]; | 6422 far_portal->viewport_right_side[v70] = v38; |
7072 v37 = a2->viewport_right_side[v70]; | 6423 } |
7073 a2->viewport_left_side[v70] = v36; | |
7074 v38 = v37 ^ v36; | |
7075 a2->viewport_left_side[v70] ^= v38; | |
7076 a2->viewport_right_side[v70] = v38; | |
7077 } | |
7078 //++v56; | |
7079 v62 += v54; | 6424 v62 += v54; |
7080 v22 = v70 + 1; | 6425 v22 = v70 + 1; |
7081 v61 += v53; | 6426 v61 += v53; |
7082 //++v23; | 6427 } |
7083 } | 6428 } |
7084 } | 6429 //***************************************************************************************************************************** |
7085 if ( max_y < a3->_viewport_space_y ) | 6430 // check portals coordinates and determine max, min( , - ) |
6431 if ( max_y < near_portal->_viewport_space_y ) | |
7086 return false; | 6432 return false; |
7087 if ( min_y > a3->_viewport_space_w ) | 6433 if ( min_y > near_portal->_viewport_space_w ) |
7088 return false; | 6434 return false; |
7089 if ( min_y < a3->_viewport_space_y ) | 6435 if ( min_y < near_portal->_viewport_space_y ) |
7090 min_y = a3->_viewport_space_y; | 6436 min_y = near_portal->_viewport_space_y; |
7091 if ( max_y > a3->_viewport_space_w ) | 6437 if ( max_y > near_portal->_viewport_space_w ) |
7092 max_y = a3->_viewport_space_w; | 6438 max_y = near_portal->_viewport_space_w; |
7093 if ( min_y <= max_y ) | 6439 if ( min_y <= max_y ) |
7094 { | 6440 { |
7095 //a3a = (char *)a2 - (char *)a3; | 6441 for ( min_y; min_y <= max_y; ++min_y ) |
7096 //v42 = &a3->array_3D8[v7]; | 6442 { |
7097 //v57 = *(__int16 *)((char *)v42 + a3a); | 6443 if ( far_portal->viewport_right_side[min_y] >= near_portal->viewport_left_side[min_y] |
7098 for ( v71 = min_y; v71 <= max_y; ++v71 ) | 6444 && far_portal->viewport_left_side[min_y] <= near_portal->viewport_right_side[min_y] ) |
7099 { | |
7100 if ( a2->viewport_left_side[v71] >= a3->viewport_left_side[v71] && a2->viewport_left_side[v71] <= a3->viewport_right_side[v71] ) | |
7101 break; | 6445 break; |
7102 //++v57; | |
7103 ++min_y; | |
7104 //++v42; | |
7105 } | 6446 } |
7106 } | 6447 } |
7107 if ( max_y < min_y ) | 6448 if ( max_y < min_y ) |
7108 return false; | 6449 return false; |
7109 //a3a = (char *)a2 - (char *)a3; | 6450 for ( max_y; max_y >= min_y; --max_y ) |
7110 //v43 = &a3->array_3D8[v8]; | 6451 { |
7111 //v58 = *(__int16 *)((char *)v43 + a3a); | 6452 if ( far_portal->viewport_right_side[max_y] >= near_portal->viewport_left_side[max_y] |
7112 for ( v72 = max_y; v72 >= min_y; --v72 ) | 6453 && far_portal->viewport_left_side[max_y] <= near_portal->viewport_right_side[max_y] ) |
7113 { | |
7114 if ( a2->viewport_right_side[v72] >= a3->viewport_left_side[v72] && a2->viewport_left_side[v72] <= a3->viewport_right_side[v72] ) | |
7115 break; | 6454 break; |
7116 //--v58; | |
7117 --max_y; | |
7118 //--v43; | |
7119 //v8 = v8; | |
7120 } | 6455 } |
7121 if ( min_y >= max_y ) | 6456 if ( min_y >= max_y ) |
7122 return false; | 6457 return false; |
7123 //a3b = (char *)a3 - (char *)a2; | 6458 //************************************************************************************************************************************* |
7124 v59 = min_y; | 6459 v59 = min_y; |
7125 //v45 = &a2->array_18[v7]; | |
7126 | |
7127 for ( v46 = max_y - min_y + 1; v46; --v46 ) | 6460 for ( v46 = max_y - min_y + 1; v46; --v46 ) |
7128 { | 6461 { |
7129 //v47 = *(__int16 *)((char *)v45 + a3b); | 6462 if ( far_portal->viewport_left_side[v59] < near_portal->viewport_left_side[v59] ) |
7130 if ( a2->viewport_left_side[v59] < a3->viewport_left_side[v59] ) | 6463 far_portal->viewport_left_side[v59] = near_portal->viewport_left_side[v59]; |
7131 a2->viewport_left_side[v59] = a3->viewport_left_side[v59]; | 6464 if ( far_portal->viewport_right_side[v59] > near_portal->viewport_right_side[v59] ) |
7132 if ( a2->viewport_right_side[v59] > a3->viewport_right_side[v59] ) | 6465 far_portal->viewport_right_side[v59] = near_portal->viewport_right_side[v59]; |
7133 a2->viewport_right_side[v59] = a3->viewport_right_side[v59]; | |
7134 ++v59; | 6466 ++v59; |
7135 //++v45; | 6467 } |
7136 } | 6468 far_portal->_viewport_space_y = min_y; |
7137 a2->_viewport_space_y = min_y; | 6469 far_portal->_viewport_space_w = max_y; |
7138 a2->_viewport_space_w = max_y; | 6470 far_portal->_viewport_space_x = far_portal->viewport_left_side[min_y]; |
7139 a2->field_8 = a2->viewport_left_side[min_y]; | 6471 far_portal->_viewport_space_z = far_portal->viewport_right_side[min_y]; |
7140 //v48 = a2->viewport_right_side[v7]; | 6472 far_portal->_viewport_x_minID = min_y; |
7141 a2->field_10 = min_y; | 6473 far_portal->_viewport_z_maxID = min_y; |
7142 a2->field_14 = min_y; | |
7143 a2->field_C = a2->viewport_right_side[min_y]; | |
7144 v49 = min_y + 1; | 6474 v49 = min_y + 1; |
7145 if ( v49 <= max_y ) | 6475 if ( v49 <= max_y ) |
7146 { | 6476 { |
7147 //v50 = &a2->array_3D8[v49]; | |
7148 for ( v49; v49 <= max_y; ++v49 ) | 6477 for ( v49; v49 <= max_y; ++v49 ) |
7149 { | 6478 { |
7150 //v51 = a2->array_18[v49]; | 6479 if ( far_portal->viewport_left_side[v49] < far_portal->_viewport_space_x ) |
7151 if ( a2->viewport_left_side[v49] < a2->field_8 ) | 6480 { |
7152 { | 6481 far_portal->_viewport_space_x = far_portal->viewport_left_side[v49]; |
7153 a2->field_8 = a2->viewport_left_side[v49]; | 6482 far_portal->_viewport_x_minID = v49; |
7154 a2->field_10 = v49; | 6483 } |
7155 } | 6484 if ( far_portal->viewport_right_side[v49] > far_portal->_viewport_space_z ) |
7156 if ( a2->viewport_right_side[v49] > a2->field_C ) | 6485 { |
7157 { | 6486 far_portal->_viewport_space_z = far_portal->viewport_right_side[v49]; |
7158 a2->field_C = a2->viewport_right_side[v49]; | 6487 far_portal->_viewport_z_maxID = v49; |
7159 a2->field_14 = v49; | 6488 } |
7160 } | |
7161 //++v50; | |
7162 } | 6489 } |
7163 } | 6490 } |
7164 return true; | 6491 return true; |
7165 } | 6492 } |
7166 //----- (00423B5D) -------------------------------------------------------- | 6493 //----- (00423B5D) -------------------------------------------------------- |
7167 int __fastcall sub_423B5D(unsigned int uFaceID) | 6494 int __fastcall GetPortalScreenCoord(unsigned int uFaceID) |
7168 { | 6495 { |
7169 BLVFace *pFace; // ebx@1 | 6496 BLVFace *pFace; // ebx@1 |
7170 //Vec3_short_ *v2; // esi@1 | 6497 int pNextVertices; // edx@11 |
7171 //int v3; // ST28_4@1 | 6498 int t; // ST28_4@12 |
7172 //__int16 v4; // ST2C_2@1 | 6499 int pScreenX; // eax@22 |
7173 //signed int v5; // esi@1 | 6500 int pScreenY; // eax@27 |
7174 //Vec3_short_ *v6; // eax@4 | 6501 signed int left_num_vertices; // edi@31 |
7175 //signed int v7; // edi@5 | 6502 signed int right_num_vertices; // ebx@41 |
7176 //signed int bFound; // eax@5 | 6503 signed int top_num_vertices; // edi@51 |
7177 //signed int v9; // ecx@10 | 6504 int bottom_num_vertices; // ebx@61 |
7178 //int v10; // eax@10 | |
7179 //int v11; // edx@11 | |
7180 int t; | |
7181 //signed int v13; // edx@12 | |
7182 //signed __int64 v14; // qtt@12 | |
7183 //char *v15; // ebx@12 | |
7184 //int v16; // ST28_4@14 | |
7185 //signed int v17; // eax@14 | |
7186 //signed __int64 v18; // qtt@14 | |
7187 signed int v19; // edx@15 | |
7188 signed int v20; // edx@17 | |
7189 signed int v21; // ebx@19 | |
7190 signed int v22; // esi@20 | |
7191 int v23; // edi@21 | |
7192 int v24; // eax@21 | |
7193 int v25; // eax@22 | |
7194 int v26; // eax@22 | |
7195 signed int v27; // ST30_4@24 | |
7196 signed __int64 v28; // qtt@24 | |
7197 int v29; // ST18_4@25 | |
7198 int v30; // eax@26 | |
7199 int v31; // eax@27 | |
7200 int v32; // eax@27 | |
7201 signed int v33; // ST30_4@29 | |
7202 signed __int64 v34; // qtt@29 | |
7203 int v35; // ST30_4@30 | |
7204 signed int v36; // edi@31 | |
7205 unsigned int v37; // eax@31 | |
7206 bool v38; // edx@31 | |
7207 int v39; // ecx@31 | |
7208 int v40; // ecx@32 | |
7209 int v41; // esi@32 | |
7210 int v42; // eax@34 | |
7211 signed int v43; // ebx@41 | |
7212 unsigned int v44; // eax@41 | |
7213 signed int v45; // ecx@42 | |
7214 int v46; // esi@42 | |
7215 int v47; // eax@44 | |
7216 signed int v48; // edi@51 | |
7217 unsigned int v49; // eax@51 | |
7218 bool v50; // edx@51 | |
7219 int v51; // ecx@51 | |
7220 int v52; // ecx@52 | |
7221 int v53; // esi@52 | |
7222 int v54; // eax@54 | |
7223 int v55; // ebx@61 | |
7224 unsigned int v56; // eax@61 | |
7225 signed int v57; // ecx@62 | |
7226 int v58; // esi@62 | |
7227 int v59; // eax@64 | |
7228 char v61; // zf@72 | |
7229 signed int v62; // edx@75 | 6505 signed int v62; // edx@75 |
7230 int v63; // ecx@76 | 6506 int v63; // ecx@76 |
7231 int v64; // esi@76 | 6507 int v64; // esi@76 |
7232 int v65; // ecx@83 | 6508 int v65; // ecx@83 |
7233 //signed int v66; // [sp+14h] [bp-14h]@3 | |
7234 int v67; // [sp+14h] [bp-14h]@34 | |
7235 int v68; // [sp+14h] [bp-14h]@44 | |
7236 int v69; // [sp+14h] [bp-14h]@54 | |
7237 int v70; // [sp+14h] [bp-14h]@64 | |
7238 signed int v71; // [sp+14h] [bp-14h]@75 | 6509 signed int v71; // [sp+14h] [bp-14h]@75 |
7239 //IndoorCameraD3D *_this; // [sp+18h] [bp-10h]@1 | |
7240 bool current_vertices_flag; // [sp+18h] [bp-10h]@9 | 6510 bool current_vertices_flag; // [sp+18h] [bp-10h]@9 |
7241 int thisb; // [sp+18h] [bp-10h]@12 | |
7242 int thisc; // [sp+18h] [bp-10h]@20 | |
7243 bool thisd; // [sp+18h] [bp-10h]@41 | |
7244 bool thise; // [sp+18h] [bp-10h]@61 | |
7245 int thisf; // [sp+18h] [bp-10h]@74 | 6511 int thisf; // [sp+18h] [bp-10h]@74 |
7246 signed int depth_num_vertices; // [sp+1Ch] [bp-Ch]@9 | 6512 signed int depth_num_vertices; // [sp+1Ch] [bp-Ch]@9 |
7247 int v80; // [sp+1Ch] [bp-Ch]@76 | 6513 int v80; // [sp+1Ch] [bp-Ch]@76 |
7248 bool next_vertices_flag; // [sp+20h] [bp-8h]@10 | 6514 bool next_vertices_flag; // [sp+20h] [bp-8h]@10 |
7249 bool v82; // [sp+20h] [bp-8h]@32 | |
7250 bool v83; // [sp+20h] [bp-8h]@42 | |
7251 bool v84; // [sp+20h] [bp-8h]@52 | |
7252 bool v85; // [sp+20h] [bp-8h]@62 | |
7253 //signed int v86; // [sp+24h] [bp-4h]@9 | |
7254 signed int v87; // [sp+24h] [bp-4h]@19 | |
7255 signed int v88; // [sp+24h] [bp-4h]@31 | |
7256 signed int v89; // [sp+24h] [bp-4h]@41 | |
7257 signed int v90; // [sp+24h] [bp-4h]@51 | |
7258 signed int v91; // [sp+24h] [bp-4h]@61 | |
7259 | 6515 |
7260 pFace = &pIndoor->pFaces[uFaceID]; | 6516 pFace = &pIndoor->pFaces[uFaceID]; |
7261 memset(&stru_50B700, 0, sizeof(stru367)); | 6517 memset(&PortalFace, 0, sizeof(stru367)); |
7262 //_this = pGame->pIndoorCameraD3D; | 6518 |
7263 //v2 = &pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]]; | 6519 //get direction the face( )********************************************************************************* |
7264 //v3 = *(_DWORD *)pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x; | |
7265 //v4 = pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z; | |
7266 //v5 = 0; | |
7267 if ( pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x) | 6520 if ( pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x) |
7268 + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y) | 6521 + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y) |
7269 + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z) < 0 ) | 6522 + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pIndoor->pFaces[uFaceID].pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z) < 0 ) |
7270 { | 6523 { |
7271 stru_50B700.field_0 = 1; | 6524 PortalFace.direction = true; |
7272 } | 6525 } |
7273 else | 6526 else |
7274 { | 6527 { |
7275 stru_50B700.field_0 = 0; | 6528 PortalFace.direction = false; |
7276 if ( !(pFace->Portal()) ) | 6529 if ( !(pFace->Portal()) ) |
7277 return 0; | 6530 return 0; |
7278 } | 6531 } |
7279 //v66 = pFace->uNumVertices; | 6532 //***************************************************************************************************************************************** |
6533 //generate/cinvertetion in camera location coordinates(/ ) | |
6534 | |
6535 //for new coordinates: | |
6536 //int x = 0x AAAA BBBB; | |
6537 //AAAA - integer( ), BBBB - fractional() | |
6538 //float v = HIWORD(x) + LOWORD(x) / 65535.0f; | |
6539 //0x0351A281 849(351 ) A281 ( BBBB ) | |
6540 //if in HIWORD: FFFF = -1 | |
6541 //FFFE = -2 | |
6542 //FFFD = -3 | |
6543 //.... | |
6544 //8000 = -32767 | |
6545 //7FFF = 32767 | |
6546 //7FFE = 32766 | |
6547 // LOWORD FFFF , | |
6548 // hiword loword FFFF FFFF , | |
6549 // 7FFF /Nomad/ | |
6550 | |
7280 if ( (signed int)pFace->uNumVertices > 0 ) | 6551 if ( (signed int)pFace->uNumVertices > 0 ) |
7281 { | 6552 { |
7282 for (uint i = 0; i < pFace->uNumVertices; ++i) | 6553 for (uint i = 0; i < pFace->uNumVertices; ++i) |
7283 { | 6554 { |
7284 //v6 = &pIndoor->pVertices[pFace->pVertexIDs[v5]]; | 6555 pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(pIndoor->pVertices[pFace->pVertexIDs[i]].x, |
7285 pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( | 6556 pIndoor->pVertices[pFace->pVertexIDs[i]].y, |
7286 pIndoor->pVertices[pFace->pVertexIDs[i]].x, | 6557 pIndoor->pVertices[pFace->pVertexIDs[i]].z, |
7287 pIndoor->pVertices[pFace->pVertexIDs[i]].y, | 6558 &PortalFace._view_transformed_z[i + 3], &PortalFace._view_transformed_x[i + 3], &PortalFace._view_transformed_y[i + 3], 0); |
7288 pIndoor->pVertices[pFace->pVertexIDs[i]].z, | 6559 } |
7289 &stru_50B700._view_transformed_xs[i + 3], | 6560 } |
7290 &stru_50B700._view_transformed_zs[i + 3], | 6561 //***************************************************************************************************************************************** |
7291 &stru_50B700._view_transformed_ys[i + 3], | 6562 //check vertices for the nearest plane( ) |
7292 0); | |
7293 } | |
7294 } | |
7295 //v7 = pFace->uNumVertices; | |
7296 if ( pFace->uNumVertices <= 0 ) | 6563 if ( pFace->uNumVertices <= 0 ) |
7297 return 0; | 6564 return 0; |
7298 bool bFound = false; | 6565 bool bFound = false; |
7299 for (uint i = 0; i < pFace->uNumVertices; ++i) | 6566 for (uint i = 0; i < pFace->uNumVertices; ++i) |
7300 { | 6567 { |
7301 if ( stru_50B700._view_transformed_xs[i + 3] >= 524288 ) | 6568 if ( PortalFace._view_transformed_z[i + 3] >= 524288 )// 8.0(0x80000) |
7302 { | 6569 { |
7303 bFound = true; | 6570 bFound = true; |
7304 break; | 6571 break; |
7305 } | 6572 } |
7306 } | 6573 } |
7307 if ( !bFound ) | 6574 if ( !bFound ) |
7308 return 0; | 6575 return 0; |
7309 | 6576 //***************************************************************************************************************************************** |
6577 //check for near clip plane( ) | |
6578 // | |
6579 // v0 v1 | |
6580 // ._________________. | |
6581 // / \ | |
6582 // / \ | |
6583 // v5. . v2 | |
6584 // | | | |
6585 // | | | |
6586 // | | | |
6587 // ---------------------------- 8.0(near_clip) | |
6588 // | | | |
6589 // ._______________________. | |
6590 // v4 v3 | |
7310 depth_num_vertices = 0; | 6591 depth_num_vertices = 0; |
7311 stru_50B700._view_transformed_xs[pFace->uNumVertices + 3] = stru_50B700._view_transformed_xs[3]; | 6592 PortalFace._view_transformed_z[pFace->uNumVertices + 3] = PortalFace._view_transformed_z[3]; |
7312 stru_50B700._view_transformed_zs[pFace->uNumVertices + 3] = stru_50B700._view_transformed_zs[3]; | 6593 PortalFace._view_transformed_x[pFace->uNumVertices + 3] = PortalFace._view_transformed_x[3]; |
7313 stru_50B700._view_transformed_ys[pFace->uNumVertices + 3] = stru_50B700._view_transformed_ys[3]; | 6594 PortalFace._view_transformed_y[pFace->uNumVertices + 3] = PortalFace._view_transformed_y[3]; |
7314 current_vertices_flag = stru_50B700._view_transformed_xs[3] >= 524288; | 6595 current_vertices_flag = PortalFace._view_transformed_z[3] >= 524288;// 8.0(0x80000) |
7315 //v86 = 1; | |
7316 if ( pFace->uNumVertices >= 1 ) | 6596 if ( pFace->uNumVertices >= 1 ) |
7317 { | 6597 { |
7318 for ( uint i = 1; i <= pFace->uNumVertices; ++i) | 6598 for ( uint i = 1; i <= pFace->uNumVertices; ++i) |
7319 { | 6599 { |
7320 //v9 = v86; | 6600 next_vertices_flag = PortalFace._view_transformed_z[i + 3] >= 524288;// 8.0(0x80000) |
7321 //v10 = stru_50B700._view_transformed_xs[v86 + 3]; | 6601 if ( current_vertices_flag ^ next_vertices_flag )// |
7322 next_vertices_flag = stru_50B700._view_transformed_xs[i + 3] >= 524288; | 6602 { |
7323 if ( current_vertices_flag ^ next_vertices_flag ) | 6603 if ( next_vertices_flag )// |
7324 { | |
7325 //v11 = stru_50B700._view_transformed_xs[i + 2]; | |
7326 if ( next_vertices_flag ) | |
7327 { | 6604 { |
7328 //t = near_clip - v0.z/v1.z - v0.z | 6605 //t = near_clip - v0.z / v1.z - v0.z |
7329 // near_clip = 8.0(524288) | 6606 t = fixpoint_div(524288 - PortalFace._view_transformed_z[i + 2], PortalFace._view_transformed_z[i + 3] - PortalFace._view_transformed_z[i + 2]); |
7330 t = 524288 - stru_50B700._view_transformed_xs[i + 2] / stru_50B700._view_transformed_xs[i + 3] - stru_50B700._view_transformed_xs[i + 2]; | 6607 //New_x = (v1.x - v0.x)*t + v0.x |
7331 // new_x = (v1.x - v0.x) * t + v0.x | 6608 PortalFace._view_transformed_x[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_x[i + 3] |
7332 stru_50B700._view_transformed_zs[depth_num_vertices] = (unsigned __int64)(stru_50B700._view_transformed_zs[i + 3] | 6609 - PortalFace._view_transformed_x[i + 2]) * t) >> 16) + PortalFace._view_transformed_x[i + 2]; |
7333 - stru_50B700._view_transformed_zs[i + 2]) * t + stru_50B700._view_transformed_zs[i + 2]; | 6610 //New_y = (v1.y - v0.y)*t + v0.y |
7334 //new_y = (v1.y - v0.y)*t + v0.y | 6611 PortalFace._view_transformed_y[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_y[i + 3] - PortalFace._view_transformed_y[i + 2]) |
7335 stru_50B700._view_transformed_ys[depth_num_vertices] = (unsigned __int64)(stru_50B700._view_transformed_ys[i + 3] - stru_50B700._view_transformed_ys[i + 2]) | 6612 * t) >> 16) + PortalFace._view_transformed_y[i + 2]; |
7336 * t + stru_50B700._view_transformed_ys[i + 2]; | 6613 //New_z = 8.0(0x80000) |
7337 stru_50B700._view_transformed_xs[depth_num_vertices] = 524288; | 6614 PortalFace._view_transformed_z[depth_num_vertices] = 524288; |
7338 } | 6615 } |
6616 else// | |
6617 { | |
6618 //t = near_clip - v1.z / v0.z - v1.z | |
6619 t = fixpoint_div(524288 - PortalFace._view_transformed_z[i + 3], PortalFace._view_transformed_z[i + 2] - PortalFace._view_transformed_z[i + 3]); | |
6620 //New_x = (v0.x - v1.x)*t + v1.x | |
6621 PortalFace._view_transformed_x[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_x[i + 2] | |
6622 - PortalFace._view_transformed_x[i + 3]) * t) >> 16) + PortalFace._view_transformed_x[i + 3]; | |
6623 //New_y = (v0.x - v1.y)*t + v1.y | |
6624 PortalFace._view_transformed_y[depth_num_vertices] = ((unsigned __int64)((PortalFace._view_transformed_y[i + 2] - PortalFace._view_transformed_y[i + 3]) | |
6625 * t) >> 16) + PortalFace._view_transformed_y[i + 3]; | |
6626 //New_z = 8.0(0x80000) | |
6627 PortalFace._view_transformed_z[depth_num_vertices] = 524288; | |
6628 } | |
6629 depth_num_vertices++; | |
6630 } | |
6631 if ( next_vertices_flag )// | |
6632 { | |
6633 pNextVertices = depth_num_vertices++; | |
6634 PortalFace._view_transformed_z[pNextVertices] = PortalFace._view_transformed_z[i + 3]; | |
6635 PortalFace._view_transformed_x[pNextVertices] = PortalFace._view_transformed_x[i + 3]; | |
6636 PortalFace._view_transformed_y[pNextVertices] = PortalFace._view_transformed_y[i + 3]; | |
6637 } | |
6638 current_vertices_flag = next_vertices_flag; | |
6639 } | |
6640 } | |
6641 //: ( ) | |
6642 //************************************************************************************************************************************ | |
6643 //convertion in screen coordinates( ) | |
6644 PortalFace._view_transformed_z[depth_num_vertices] = PortalFace._view_transformed_z[0]; | |
6645 PortalFace._view_transformed_x[depth_num_vertices] = PortalFace._view_transformed_x[0]; | |
6646 PortalFace._view_transformed_y[depth_num_vertices] = PortalFace._view_transformed_y[0]; | |
6647 for ( uint i = 0; i < depth_num_vertices; ++i ) | |
6648 { | |
6649 if ( (abs(PortalFace._view_transformed_x[i]) >> 13) <= abs(PortalFace._view_transformed_z[i]) ) | |
6650 pScreenX = fixpoint_div(PortalFace._view_transformed_x[i], PortalFace._view_transformed_z[i]); | |
6651 else | |
6652 { | |
6653 if ( PortalFace._view_transformed_x[i] >= 0 ) | |
6654 { | |
6655 if (PortalFace._view_transformed_z[i] >= 0) | |
6656 pScreenX = 0x400000; // 64.0 | |
7339 else | 6657 else |
7340 { | 6658 pScreenX = 0xFFC00000; // -63.0 |
7341 //t = near_clip - v1.z/v0.z - v1.z | 6659 } |
7342 t = 524288 - stru_50B700._view_transformed_xs[i + 3] / stru_50B700._view_transformed_xs[i + 2] - stru_50B700._view_transformed_xs[i + 3]; | 6660 else |
7343 // new_x = (v0.x - v1.x) * t + v1.x | 6661 { |
7344 stru_50B700._view_transformed_zs[depth_num_vertices] = (unsigned __int64)(stru_50B700._view_transformed_zs[i + 2] | 6662 if (PortalFace._view_transformed_z[i] >= 0) |
7345 - stru_50B700._view_transformed_zs[i + 3]) * t + stru_50B700._view_transformed_zs[i + 3]; | 6663 pScreenX = 0xFFC00000; // -63.0 |
7346 //new_y = (v0.y - v1.y)*t + v1.y | 6664 else |
7347 stru_50B700._view_transformed_ys[depth_num_vertices] = (unsigned __int64)(stru_50B700._view_transformed_ys[i + 2] - stru_50B700._view_transformed_ys[i + 3]) | 6665 pScreenX = 0x400000; // 64.0 |
7348 * t + stru_50B700._view_transformed_ys[i + 3]; | 6666 } |
7349 stru_50B700._view_transformed_xs[depth_num_vertices] = 524288; | 6667 } |
7350 } | 6668 |
7351 v19 = depth_num_vertices++; | 6669 if ( (abs(PortalFace._view_transformed_y[i]) >> 13) <= abs(PortalFace._view_transformed_z[i]) ) |
7352 //v7 = pFace->uNumVertices; | 6670 pScreenY = fixpoint_div(PortalFace._view_transformed_y[i], PortalFace._view_transformed_z[i]); |
7353 //stru_50B700._view_transformed_ys[v19] = thisb + *(_DWORD *)v15; | |
7354 //stru_50B700._view_transformed_xs[v19] = 524288; | |
7355 } | |
7356 if ( next_vertices_flag ) | |
7357 { | |
7358 v20 = depth_num_vertices++; | |
7359 stru_50B700._view_transformed_xs[v20] = stru_50B700._view_transformed_xs[i + 3]; | |
7360 stru_50B700._view_transformed_zs[v20] = stru_50B700._view_transformed_zs[i + 3]; | |
7361 stru_50B700._view_transformed_ys[v20] = stru_50B700._view_transformed_ys[i + 3]; | |
7362 } | |
7363 current_vertices_flag = next_vertices_flag; | |
7364 } | |
7365 } | |
7366 | |
7367 | |
7368 v21 = depth_num_vertices; | |
7369 stru_50B700._view_transformed_xs[depth_num_vertices] = stru_50B700._view_transformed_xs[0]; | |
7370 stru_50B700._view_transformed_zs[depth_num_vertices] = stru_50B700._view_transformed_zs[0]; | |
7371 stru_50B700._view_transformed_ys[depth_num_vertices] = stru_50B700._view_transformed_ys[0]; | |
7372 for ( v87 = 0; v87 < depth_num_vertices; ++v87 ) | |
7373 { | |
7374 v22 = v87; | |
7375 thisc = abs(stru_50B700._view_transformed_xs[v87]); | |
7376 if ( (abs(stru_50B700._view_transformed_zs[v87]) >> 13) <= thisc ) | |
7377 { | |
7378 v27 = stru_50B700._view_transformed_zs[v22]; | |
7379 LODWORD(v28) = v27 << 16; | |
7380 HIDWORD(v28) = v27 >> 16; | |
7381 v26 = v28 / stru_50B700._view_transformed_xs[v22]; | |
7382 v23 = 0; | |
7383 } | |
7384 else | 6671 else |
7385 { | 6672 { |
7386 v23 = 0; | 6673 if ( PortalFace._view_transformed_y[i] >= 0 ) |
7387 v24 = 0; | 6674 { |
7388 if ( stru_50B700._view_transformed_zs[v22] >= 0 ) | 6675 if (PortalFace._view_transformed_z[i] >= 0) |
7389 { | 6676 pScreenY = 0x400000; // 64.0 |
7390 //LOBYTE(v24) = stru_50B700._view_transformed_xs[v22] >= 0; | |
7391 //v26 = ((v24 - 1) & 0xFF800000) + 4194304; | |
7392 if (stru_50B700._view_transformed_xs[v22] >= 0) | |
7393 v26 = 0x400000; // 64.0 | |
7394 else | 6677 else |
7395 v26 = 0xFFC00000; | 6678 pScreenY = 0xFFC00000; // -63.0 |
7396 } | 6679 } |
7397 else | 6680 else |
7398 { | 6681 { |
7399 //LOBYTE(v24) = stru_50B700._view_transformed_xs[v22] >= 0; | 6682 if (PortalFace._view_transformed_z[i] >= 0) |
7400 //v25 = v24 - 1; | 6683 pScreenY = 0xFFC00000; // -63.0 |
7401 //v26 = (v25 & 0x800000) - 4194304; | |
7402 if (stru_50B700._view_transformed_xs[v22] >= 0) | |
7403 v26 = 0xFFC00000; // -63.0 | |
7404 else | 6684 else |
7405 v26 = 0x400000; | 6685 pScreenY = 0x400000; // 64.0 |
7406 } | 6686 } |
7407 } | 6687 } |
7408 | 6688 PortalFace._screen_space_x[i + 12] = pBLVRenderParams->uViewportCenterX - ((unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)pScreenX) >> 16); |
7409 v29 = stru_50B700._view_transformed_ys[v22]; | 6689 PortalFace._screen_space_y[i + 12] = pBLVRenderParams->uViewportCenterY - ((unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)pScreenY) >> 16); |
7410 stru_50B700._screen_space_x[v22 + 12] = v26; | 6690 } |
7411 if ( (abs(v29) >> 13) <= thisc ) | 6691 // : , , () |
7412 { | 6692 //****************************************************************************************************************************************** |
7413 v33 = stru_50B700._view_transformed_ys[v22]; | 6693 // - ,.. |
7414 LODWORD(v34) = v33 << 16; | 6694 // . , x() = 8, = 468( ), . |
7415 HIDWORD(v34) = v33 >> 16; | 6695 // |
7416 v32 = v34 / stru_50B700._view_transformed_xs[v22]; | 6696 //check for left_clip plane( ) |
7417 } | 6697 left_num_vertices = 0; |
7418 else | 6698 PortalFace._screen_space_x[depth_num_vertices + 12] = PortalFace._screen_space_x[12]; |
7419 { | 6699 PortalFace._screen_space_y[depth_num_vertices + 12] = PortalFace._screen_space_y[12]; |
7420 v30 = 0; | 6700 current_vertices_flag = PortalFace._screen_space_x[12] >= (signed int)pBLVRenderParams->uViewportX;//8.0 |
7421 if ( stru_50B700._view_transformed_ys[v22] >= v23 ) | |
7422 { | |
7423 //LOBYTE(v30) = stru_50B700._view_transformed_xs[v22] >= v23; | |
7424 //v32 = ((v30 - 1) & 0xFF800000) + 4194304; | |
7425 if (stru_50B700._view_transformed_xs[v22] >= v23) | |
7426 v32 = 0x400000; // 64.0 | |
7427 else | |
7428 v32 = 0xFFC00000; | |
7429 } | |
7430 else | |
7431 { | |
7432 //LOBYTE(v30) = stru_50B700._view_transformed_xs[v22] >= v23; | |
7433 //v31 = v30 - 1; | |
7434 //v32 = (v31 & 0x800000) - 4194304; | |
7435 if (stru_50B700._view_transformed_xs[v22] >= v23) | |
7436 v32 = 0xFFC00000; // -63.0 | |
7437 else | |
7438 v32 = 0x400000; | |
7439 } | |
7440 } | |
7441 stru_50B700._screen_space_y[v22 + 12] = v32; | |
7442 stru_50B700._screen_space_x[v22 + 12] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) | |
7443 * (signed __int64)stru_50B700._screen_space_x[v22 + 12]) >> 16; | |
7444 v35 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)stru_50B700._screen_space_y[v22 + 12]) >> 16; | |
7445 stru_50B700._screen_space_x[v22 + 12] = pBLVRenderParams->uViewportCenterX - stru_50B700._screen_space_x[v22 + 12]; | |
7446 stru_50B700._screen_space_y[v22 + 12] = pBLVRenderParams->uViewportCenterY - v35; | |
7447 //++v87; | |
7448 } | |
7449 v36 = 0; | |
7450 stru_50B700._screen_space_x[v21 + 12] = stru_50B700._screen_space_x[12]; | |
7451 stru_50B700._screen_space_y[v21 + 12] = stru_50B700._screen_space_y[12]; | |
7452 v37 = pBLVRenderParams->uViewportX; | |
7453 v38 = stru_50B700._screen_space_x[12] < (signed int)pBLVRenderParams->uViewportX; | |
7454 LOBYTE(v38) = stru_50B700._screen_space_x[12] >= (signed int)pBLVRenderParams->uViewportX; | |
7455 v39 = 1; | |
7456 v88 = 1; | |
7457 if ( depth_num_vertices < 1 ) | 6701 if ( depth_num_vertices < 1 ) |
7458 return 0; | 6702 return 0; |
7459 do | 6703 for ( uint i = 1; i <= depth_num_vertices; ++i ) |
7460 { | 6704 { |
7461 v40 = v39; | 6705 next_vertices_flag = PortalFace._screen_space_x[i + 12] >= (signed int)pBLVRenderParams->uViewportX; |
7462 v41 = stru_50B700._screen_space_x[v40 + 12]; | 6706 if ( current_vertices_flag ^ next_vertices_flag ) |
7463 v82 = v41 >= (signed int)v37; | 6707 { |
7464 if ( v38 ^ v82 ) | 6708 if ( next_vertices_flag ) |
7465 { | 6709 { |
7466 if ( v41 >= (signed int)v37 ) | 6710 //t = left_clip - v0.x / v1.x - v0.x |
7467 { | 6711 t = fixpoint_div(pBLVRenderParams->uViewportX - PortalFace._screen_space_x[i + 11], PortalFace._screen_space_x[i + 12] - PortalFace._screen_space_x[i + 11]); |
7468 v67 = (signed int)(v37 - stru_50B700._screen_space_x[v40 + 11]) | 6712 //New_y = (v1.y - v0.y)*t + v0.y |
7469 * (signed __int64)(stru_50B700._screen_space_y[v40 + 12] - stru_50B700._screen_space_y[v40 + 11]) | 6713 PortalFace._screen_space_y[left_num_vertices + 9] = ((signed int)((PortalFace._screen_space_y[i + 12]- PortalFace._screen_space_y[i + 11]) |
7470 / (v41 - stru_50B700._screen_space_x[v40 + 11]); | 6714 * t) >> 16) + PortalFace._screen_space_y[i + 11]; |
7471 v42 = stru_50B700._screen_space_y[v40 + 11]; | 6715 //New_x = left_clip |
6716 PortalFace._screen_space_x[left_num_vertices + 9] = pBLVRenderParams->uViewportX; | |
7472 } | 6717 } |
7473 else | 6718 else |
7474 { | 6719 { |
7475 v67 = (signed int)(v37 - v41) | 6720 //t = left_clip - v1.x / v0.x - v1.x |
7476 * (signed __int64)(stru_50B700._screen_space_y[v40 + 11] - stru_50B700._screen_space_y[v40 + 12]) | 6721 t = fixpoint_div(pBLVRenderParams->uViewportX - PortalFace._screen_space_x[i + 12], PortalFace._screen_space_x[i + 11] - PortalFace._screen_space_x[i + 12]); |
7477 / (stru_50B700._screen_space_x[v40 + 11] - v41); | 6722 //New_y = (v0.y - v1.y)*t + v1.y |
7478 v42 = stru_50B700._screen_space_y[v40 + 12]; | 6723 PortalFace._screen_space_y[left_num_vertices + 9] = ((signed int)(( PortalFace._screen_space_y[i + 11] - PortalFace._screen_space_y[i + 12]) |
7479 } | 6724 * t) >> 16) + PortalFace._screen_space_y[i + 12]; |
7480 ++v36; | 6725 //New_x = left_clip |
7481 stru_50B700._screen_space_y[v36 + 8] = v67 + v42; | 6726 PortalFace._screen_space_x[left_num_vertices + 9] = pBLVRenderParams->uViewportX; |
7482 v37 = pBLVRenderParams->uViewportX; | 6727 } |
7483 stru_50B700._screen_space_x[v36 + 8] = pBLVRenderParams->uViewportX; | 6728 left_num_vertices++; |
7484 } | 6729 } |
7485 v38 = v82; | 6730 if ( next_vertices_flag ) |
7486 if ( v82 ) | 6731 { |
7487 { | 6732 pNextVertices = left_num_vertices++; |
7488 stru_50B700._screen_space_x[v36 + 9] = stru_50B700._screen_space_x[v40 + 12]; | 6733 PortalFace._screen_space_x[pNextVertices + 9] = PortalFace._screen_space_x[i + 12]; |
7489 stru_50B700._screen_space_y[v36++ + 9] = stru_50B700._screen_space_y[v40 + 12]; | 6734 PortalFace._screen_space_y[pNextVertices + 9] = PortalFace._screen_space_y[i + 12]; |
7490 } | 6735 } |
7491 v39 = v88++ + 1; | 6736 current_vertices_flag = next_vertices_flag; |
7492 } | 6737 } |
7493 while ( v88 <= depth_num_vertices ); | 6738 //********************************************************************************************************************************* |
7494 if ( !v36 | 6739 //for right_clip plane( ) |
7495 || (v43 = 0, | 6740 right_num_vertices = 0; |
7496 stru_50B700._screen_space_x[v36 + 9] = stru_50B700._screen_space_x[9], | 6741 PortalFace._screen_space_x[left_num_vertices + 9] = PortalFace._screen_space_x[9]; |
7497 stru_50B700._screen_space_y[v36 + 9] = stru_50B700._screen_space_y[9], | 6742 PortalFace._screen_space_y[left_num_vertices + 9] = PortalFace._screen_space_y[9]; |
7498 v44 = pBLVRenderParams->uViewportZ, | 6743 current_vertices_flag = PortalFace._screen_space_x[9] <= (signed int)pBLVRenderParams->uViewportZ;//468.0 |
7499 thisd = stru_50B700._screen_space_x[9] <= (signed int)pBLVRenderParams->uViewportZ, | 6744 if (left_num_vertices < 1) |
7500 v89 = 1, | |
7501 v36 < 1) ) | |
7502 return 0; | 6745 return 0; |
7503 do | 6746 for ( uint i = 1; i <= left_num_vertices; ++i ) |
7504 { | 6747 { |
7505 v45 = v89; | 6748 next_vertices_flag = PortalFace._screen_space_x[i + 9] <= (signed int)pBLVRenderParams->uViewportZ; |
7506 v46 = stru_50B700._screen_space_x[v89 + 9]; | 6749 if ( current_vertices_flag ^ next_vertices_flag ) |
7507 v83 = v46 <= (signed int)v44; | 6750 { |
7508 if ( thisd ^ v83 ) | 6751 if ( next_vertices_flag ) |
7509 { | 6752 { |
7510 if ( v46 <= (signed int)v44 ) | 6753 //t = right_clip - v1.x / v0.x - v1.x |
7511 { | 6754 t = fixpoint_div(pBLVRenderParams->uViewportZ - PortalFace._screen_space_x[i + 8], PortalFace._screen_space_x[i + 9] - PortalFace._screen_space_x[i + 8]); |
7512 v68 = (signed int)(v44 - stru_50B700._screen_space_x[v45 + 8]) | 6755 //New_y = (v0.y - v1.y)*t + v1.y |
7513 * (signed __int64)(stru_50B700._screen_space_y[v45 + 9] - stru_50B700._screen_space_y[v45 + 8]) | 6756 PortalFace._screen_space_y[right_num_vertices + 6] = ((signed int)((PortalFace._screen_space_y[i + 9] - PortalFace._screen_space_y[i + 8]) |
7514 / (v46 - stru_50B700._screen_space_x[v45 + 8]); | 6757 * t) >> 16) + PortalFace._screen_space_y[i + 8]; |
7515 v47 = stru_50B700._screen_space_y[v45 + 8]; | 6758 //New_x = right_clip |
6759 PortalFace._screen_space_x[right_num_vertices + 6] = pBLVRenderParams->uViewportZ; | |
7516 } | 6760 } |
7517 else | 6761 else |
7518 { | 6762 { |
7519 v68 = (signed int)(v44 - v46) | 6763 //t = right_clip - v0.x / v1.x - v0.x |
7520 * (signed __int64)(stru_50B700._screen_space_y[v45 + 8] - stru_50B700._screen_space_y[v45 + 9]) | 6764 t = fixpoint_div(pBLVRenderParams->uViewportZ - PortalFace._screen_space_x[i + 9], PortalFace._screen_space_x[i + 8] - PortalFace._screen_space_x[i + 9]); |
7521 / (stru_50B700._screen_space_x[v45 + 8] - v46); | 6765 //New_y = (v1.y - v0.y)*t + v0.y |
7522 v47 = stru_50B700._screen_space_y[v45 + 9]; | 6766 PortalFace._screen_space_y[right_num_vertices + 6] = ((signed int)((PortalFace._screen_space_y[i + 8] - PortalFace._screen_space_y[i + 9]) |
7523 } | 6767 * t) >> 16) + PortalFace._screen_space_y[i + 9]; |
7524 ++v43; | 6768 //New_x = right_clip |
7525 stru_50B700._screen_space_y[v43 + 5] = v68 + v47; | 6769 PortalFace._screen_space_x[right_num_vertices + 6] = pBLVRenderParams->uViewportZ; |
7526 v44 = pBLVRenderParams->uViewportZ; | 6770 } |
7527 stru_50B700._screen_space_x[v43 + 5] = pBLVRenderParams->uViewportZ; | 6771 right_num_vertices++; |
7528 } | 6772 } |
7529 if ( v83 ) | 6773 if ( next_vertices_flag ) |
7530 { | 6774 { |
7531 stru_50B700._screen_space_x[v43 + 6] = stru_50B700._screen_space_x[v45 + 9]; | 6775 pNextVertices = right_num_vertices++; |
7532 stru_50B700._screen_space_y[v43++ + 6] = stru_50B700._screen_space_y[v45 + 9]; | 6776 PortalFace._screen_space_x[pNextVertices + 6] = PortalFace._screen_space_x[i + 9]; |
7533 } | 6777 PortalFace._screen_space_y[pNextVertices + 6] = PortalFace._screen_space_y[i + 9]; |
7534 ++v89; | 6778 } |
7535 thisd = v83; | 6779 current_vertices_flag = next_vertices_flag; |
7536 } | 6780 } |
7537 while ( v89 <= v36 ); | 6781 //************************************************************************************************************************************ |
7538 if ( !v43 | 6782 // for top clip plane |
7539 || (v48 = 0, | 6783 top_num_vertices = 0; |
7540 stru_50B700._screen_space_x[v43 + 6] = stru_50B700._screen_space_x[6], | 6784 PortalFace._screen_space_x[right_num_vertices + 6] = PortalFace._screen_space_x[6]; |
7541 stru_50B700._screen_space_y[v43 + 6] = stru_50B700._screen_space_y[6], | 6785 PortalFace._screen_space_y[right_num_vertices + 6] = PortalFace._screen_space_y[6]; |
7542 v49 = pBLVRenderParams->uViewportY, | 6786 |
7543 v50 = stru_50B700._screen_space_y[6] < (signed int)pBLVRenderParams->uViewportY, | 6787 current_vertices_flag = PortalFace._screen_space_y[6] >= (signed int)pBLVRenderParams->uViewportY;//8.0 |
7544 LOBYTE(v50) = stru_50B700._screen_space_y[6] >= (signed int)pBLVRenderParams->uViewportY, | 6788 if ( right_num_vertices < 1 ) |
7545 v51 = 1, | |
7546 v90 = 1, | |
7547 v43 < 1) ) | |
7548 return 0; | 6789 return 0; |
7549 do | 6790 for ( uint i = 1; i <= right_num_vertices; ++i ) |
7550 { | 6791 { |
7551 v52 = v51; | 6792 next_vertices_flag = PortalFace._screen_space_y[i + 6] >= (signed int)pBLVRenderParams->uViewportY; |
7552 v53 = stru_50B700._screen_space_y[v52 + 6]; | 6793 if ( current_vertices_flag ^ next_vertices_flag ) |
7553 v84 = v53 >= (signed int)v49; | 6794 { |
7554 if ( v50 ^ v84 ) | 6795 if ( next_vertices_flag ) |
7555 { | 6796 { |
7556 if ( v53 >= (signed int)v49 ) | 6797 t = fixpoint_div(pBLVRenderParams->uViewportY - PortalFace._screen_space_y[i + 5], PortalFace._screen_space_y[i + 6] - PortalFace._screen_space_y[i + 5]); |
7557 { | 6798 PortalFace._screen_space_x[top_num_vertices + 3] = ((signed int)((PortalFace._screen_space_x[i + 6] - PortalFace._screen_space_x[i + 5]) |
7558 v69 = (signed int)(v49 - stru_50B700._screen_space_y[v52 + 5]) | 6799 * t) >> 16) + PortalFace._screen_space_x[i + 5]; |
7559 * (signed __int64)(stru_50B700._screen_space_x[v52 + 6] - stru_50B700._screen_space_x[v52 + 5]) | 6800 PortalFace._screen_space_y[top_num_vertices + 3] = pBLVRenderParams->uViewportY; |
7560 / (v53 - stru_50B700._screen_space_y[v52 + 5]); | |
7561 v54 = stru_50B700._screen_space_x[v52 + 5]; | |
7562 } | 6801 } |
7563 else | 6802 else |
7564 { | 6803 { |
7565 v69 = (signed int)(v49 - v53) | 6804 t = fixpoint_div(pBLVRenderParams->uViewportY - PortalFace._screen_space_y[i + 6], PortalFace._screen_space_y[i + 5] - PortalFace._screen_space_y[i + 6]); |
7566 * (signed __int64)(stru_50B700._screen_space_x[v52 + 5] - stru_50B700._screen_space_x[v52 + 6]) | 6805 PortalFace._screen_space_x[top_num_vertices + 3] = ((signed int)((PortalFace._screen_space_x[i + 5]- PortalFace._screen_space_x[i + 6]) |
7567 / (stru_50B700._screen_space_y[v52 + 5] - v53); | 6806 * t) >> 16) + PortalFace._screen_space_x[i + 6]; |
7568 v54 = stru_50B700._screen_space_x[v52 + 6]; | 6807 PortalFace._screen_space_y[top_num_vertices + 3] = pBLVRenderParams->uViewportY; |
7569 } | 6808 } |
7570 ++v48; | 6809 top_num_vertices++; |
7571 stru_50B700._screen_space_x[v48 + 2] = v69 + v54; | 6810 } |
7572 v49 = pBLVRenderParams->uViewportY; | 6811 current_vertices_flag = next_vertices_flag; |
7573 stru_50B700._screen_space_y[v48 + 2] = pBLVRenderParams->uViewportY; | 6812 if ( next_vertices_flag ) |
7574 } | 6813 { |
7575 v50 = v84; | 6814 pNextVertices = top_num_vertices++; |
7576 if ( v84 ) | 6815 PortalFace._screen_space_x[pNextVertices + 3] = PortalFace._screen_space_x[i + 6]; |
7577 { | 6816 PortalFace._screen_space_y[pNextVertices + 3] = PortalFace._screen_space_y[i + 6]; |
7578 stru_50B700._screen_space_x[v48 + 3] = stru_50B700._screen_space_x[v52 + 6]; | 6817 } |
7579 stru_50B700._screen_space_y[v48++ + 3] = stru_50B700._screen_space_y[v52 + 6]; | 6818 } |
7580 } | 6819 //********************************************************************************************************************************** |
7581 v51 = v90++ + 1; | 6820 //for bottom_clip plane( ) |
7582 } | 6821 bottom_num_vertices = 0; |
7583 while ( v90 <= v43 ); | 6822 PortalFace._screen_space_x[top_num_vertices + 3] = PortalFace._screen_space_x[3]; |
7584 if ( !v48 | 6823 PortalFace._screen_space_y[top_num_vertices + 3] = PortalFace._screen_space_y[3]; |
7585 || (v55 = 0, | 6824 current_vertices_flag = PortalFace._screen_space_y[3] <= (signed int)pBLVRenderParams->uViewportW;//351.0 |
7586 stru_50B700._screen_space_x[v48 + 3] = stru_50B700._screen_space_x[3], | 6825 if ( top_num_vertices < 1 ) |
7587 stru_50B700._screen_space_y[v48 + 3] = stru_50B700._screen_space_y[3], | |
7588 v56 = pBLVRenderParams->uViewportW, | |
7589 thise = stru_50B700._screen_space_y[3] <= (signed int)pBLVRenderParams->uViewportW, | |
7590 v91 = 1, | |
7591 v48 < 1) ) | |
7592 return 0; | 6826 return 0; |
7593 do | 6827 for ( uint i =1; i <= top_num_vertices; ++i ) |
7594 { | 6828 { |
7595 v57 = v91; | 6829 next_vertices_flag = PortalFace._screen_space_y[i + 3] <= (signed int)pBLVRenderParams->uViewportW; |
7596 v58 = stru_50B700._screen_space_y[v91 + 3]; | 6830 if ( current_vertices_flag ^ next_vertices_flag ) |
7597 v85 = v58 <= (signed int)v56; | 6831 { |
7598 if ( thise ^ v85 ) | 6832 if ( next_vertices_flag ) |
7599 { | 6833 { |
7600 if ( v58 <= (signed int)v56 ) | 6834 t = fixpoint_div(pBLVRenderParams->uViewportW - PortalFace._screen_space_y[i + 2], PortalFace._screen_space_y[i + 3] - PortalFace._screen_space_y[i + 2]); |
7601 { | 6835 PortalFace._screen_space_x[bottom_num_vertices] = ((signed int)((PortalFace._screen_space_x[i + 3] - PortalFace._screen_space_x[i + 2]) |
7602 v70 = (signed int)(v56 - stru_50B700._screen_space_y[v57 + 2]) | 6836 * t) >> 16) + PortalFace._screen_space_x[i + 2]; |
7603 * (signed __int64)(stru_50B700._screen_space_x[v57 + 3] - stru_50B700._screen_space_x[v57 + 2]) | 6837 PortalFace._screen_space_y[bottom_num_vertices] = pBLVRenderParams->uViewportW; |
7604 / (v58 - stru_50B700._screen_space_y[v57 + 2]); | |
7605 v59 = stru_50B700._screen_space_x[v57 + 2]; | |
7606 } | 6838 } |
7607 else | 6839 else |
7608 { | 6840 { |
7609 v70 = (signed int)(v56 - v58) | 6841 t = fixpoint_div(pBLVRenderParams->uViewportW - PortalFace._screen_space_y[i + 3], PortalFace._screen_space_y[i + 2] - PortalFace._screen_space_y[i + 3]); |
7610 * (signed __int64)(stru_50B700._screen_space_x[v57 + 2] - stru_50B700._screen_space_x[v57 + 3]) | 6842 PortalFace._screen_space_x[bottom_num_vertices] = ((signed int)((PortalFace._screen_space_x[i + 2] - PortalFace._screen_space_x[i + 3]) |
7611 / (stru_50B700._screen_space_y[v57 + 2] - v58); | 6843 * t) >> 16) + PortalFace._screen_space_x[i + 3]; |
7612 v59 = stru_50B700._screen_space_x[v57 + 3]; | 6844 PortalFace._screen_space_y[bottom_num_vertices] = pBLVRenderParams->uViewportW; |
7613 } | 6845 } |
7614 ++v55; | 6846 bottom_num_vertices++; |
7615 //stru_50B700._screen_space_y[v55 + 59] = v70 + v59; | 6847 } |
7616 stru_50B700._screen_space_x[v55 - 1] = v70 + v59; | 6848 if ( next_vertices_flag ) |
7617 v56 = pBLVRenderParams->uViewportW; | 6849 { |
7618 //stru_50B700._view_transformed_xs[v55 + 47] = pBLVRenderParams->uViewportW; | 6850 pNextVertices = bottom_num_vertices++; |
7619 stru_50B700._screen_space_y[v55 - 1] = pBLVRenderParams->uViewportW; | 6851 PortalFace._screen_space_x[pNextVertices] = PortalFace._screen_space_x[i + 3]; |
7620 } | 6852 PortalFace._screen_space_y[pNextVertices] = PortalFace._screen_space_y[i + 3]; |
7621 if ( v85 ) | 6853 } |
7622 { | 6854 current_vertices_flag = next_vertices_flag; |
7623 stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[v57 + 3]; | 6855 } |
7624 stru_50B700._screen_space_y[v55++] = stru_50B700._screen_space_y[v57 + 3]; | 6856 //*************************************************************************************************************************************** |
7625 } | 6857 |
7626 ++v91; | 6858 if ( !bottom_num_vertices ) |
7627 thise = v85; | |
7628 } | |
7629 while ( v91 <= v48 ); | |
7630 if ( !v55 ) | |
7631 return 0; | 6859 return 0; |
7632 v61 = pRenderer->pRenderD3D == 0; | 6860 PortalFace._screen_space_x[bottom_num_vertices] = PortalFace._screen_space_x[0]; |
7633 stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[0]; | 6861 PortalFace._screen_space_y[bottom_num_vertices] = PortalFace._screen_space_y[0]; |
7634 stru_50B700._screen_space_y[v55] = stru_50B700._screen_space_y[0]; | 6862 //check for software( ) |
7635 if ( v61 && v55 > 3 ) | 6863 if ( !pRenderer->pRenderD3D && bottom_num_vertices > 3 ) |
7636 { | 6864 { |
7637 stru_50B700._screen_space_x[v55 + 1] = stru_50B700._screen_space_x[1]; | 6865 PortalFace._screen_space_x[bottom_num_vertices + 1] = PortalFace._screen_space_x[1]; |
7638 stru_50B700._screen_space_y[v55 + 1] = stru_50B700._screen_space_y[1]; | 6866 PortalFace._screen_space_y[bottom_num_vertices + 1] = PortalFace._screen_space_y[1]; |
7639 thisf = 2 * (stru_50B700.field_0 != 0) - 1; | 6867 thisf = PortalFace.direction == true ? 1 : - 1; |
7640 if ( v55 > 0 ) | 6868 if ( bottom_num_vertices > 0 ) |
7641 { | 6869 { |
7642 v62 = 1; | 6870 v62 = 1; |
7643 v71 = 1; | 6871 v71 = 1; |
7644 do | 6872 do |
7645 { | 6873 { |
7646 v63 = v62 - 1; | 6874 v63 = v62 - 1; |
7647 v64 = v62 + 1; | 6875 v64 = v62 + 1; |
7648 v80 = v62 + 1; | 6876 v80 = v62 + 1; |
7649 if ( v62 - 1 >= v55 ) | 6877 if ( v62 - 1 >= bottom_num_vertices ) |
7650 v63 -= v55; | 6878 v63 -= bottom_num_vertices; |
7651 if ( v62 >= v55 ) | 6879 if ( v62 >= bottom_num_vertices ) |
7652 v62 -= v55; | 6880 v62 -= bottom_num_vertices; |
7653 if ( v64 >= v55 ) | 6881 if ( v64 >= bottom_num_vertices ) |
7654 v64 -= v55; | 6882 v64 -= bottom_num_vertices; |
7655 if ( thisf | 6883 if ( thisf * ((PortalFace._screen_space_y[v64] - PortalFace._screen_space_y[v63]) |
7656 * ((stru_50B700._screen_space_y[v64] - stru_50B700._screen_space_y[v63]) | 6884 * (PortalFace._screen_space_x[v62] - PortalFace._screen_space_x[v63]) |
7657 * (stru_50B700._screen_space_x[v62] - stru_50B700._screen_space_x[v63]) | 6885 - (PortalFace._screen_space_y[v62] - PortalFace._screen_space_y[v63]) |
7658 - (stru_50B700._screen_space_y[v62] - stru_50B700._screen_space_y[v63]) | 6886 * (PortalFace._screen_space_x[v64] - PortalFace._screen_space_x[v63])) < 0 ) |
7659 * (stru_50B700._screen_space_x[v64] - stru_50B700._screen_space_x[v63])) < 0 ) | |
7660 { | 6887 { |
7661 v62 = v80; | 6888 v62 = v80; |
7662 v71 = v80; | 6889 v71 = v80; |
7663 } | 6890 } |
7664 else | 6891 else |
7665 { | 6892 { |
7666 v62 = v71; | 6893 v62 = v71; |
7667 v65 = v71; | 6894 v65 = v71; |
7668 if ( v71 < v55 || (v65 = v71 - v55, v71 - v55 < v55) ) | 6895 if ( v71 < bottom_num_vertices || (v65 = v71 - bottom_num_vertices, v71 - bottom_num_vertices < bottom_num_vertices) ) |
7669 { | 6896 { |
7670 memcpy( | 6897 memcpy(&PortalFace._screen_space_y[v65], &PortalFace._screen_space_y[v65 + 1], |
7671 &stru_50B700._screen_space_y[v65], | 6898 4 * ((unsigned int)(4 * (bottom_num_vertices - v65)) >> 2)); |
7672 &stru_50B700._screen_space_y[v65 + 1], | 6899 memcpy(&PortalFace._screen_space_x[v65], &PortalFace._screen_space_x[v65 + 1], |
7673 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); | 6900 4 * ((unsigned int)(4 * (bottom_num_vertices - v65)) >> 2)); |
7674 memcpy( | |
7675 &stru_50B700._screen_space_x[v65], | |
7676 &stru_50B700._screen_space_x[v65 + 1], | |
7677 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); | |
7678 } | 6901 } |
7679 --v55; | 6902 --bottom_num_vertices; |
7680 } | 6903 } |
7681 } | 6904 } |
7682 while ( v62 - 1 < v55 ); | 6905 while ( v62 - 1 < bottom_num_vertices ); |
7683 } | 6906 } |
7684 stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[0]; | 6907 PortalFace._screen_space_x[bottom_num_vertices] = PortalFace._screen_space_x[0]; |
7685 stru_50B700._screen_space_y[v55] = stru_50B700._screen_space_y[0]; | 6908 PortalFace._screen_space_y[bottom_num_vertices] = PortalFace._screen_space_y[0]; |
7686 } | 6909 } |
7687 return v55; | 6910 return bottom_num_vertices; |
7688 } | 6911 } |