Mercurial > mm7
comparison mm7_4.cpp @ 1391:cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
stru148 -> struct Polygon
author | Nomad |
---|---|
date | Thu, 18 Jul 2013 14:42:54 +0200 |
parents | 613c77e51e38 |
children | 28f87f5234a1 |
comparison
equal
deleted
inserted
replaced
1390:613c77e51e38 | 1391:cc9a3a24d61d |
---|---|
10 #include "Sprites.h" | 10 #include "Sprites.h" |
11 #include "BSPModel.h" | 11 #include "BSPModel.h" |
12 #include "OutdoorCamera.h" | 12 #include "OutdoorCamera.h" |
13 #include "Mouse.h" | 13 #include "Mouse.h" |
14 #include "stru6.h" | 14 #include "stru6.h" |
15 #include "stru11.h" | |
16 #include "stru12.h" | |
17 | 15 |
18 #include "LightmapBuilder.h" | 16 #include "LightmapBuilder.h" |
19 #include "MM7.h" | 17 #include "MM7.h" |
20 #include "MapInfo.h" | 18 #include "MapInfo.h" |
21 #include "Game.h" | 19 #include "Game.h" |
527 } | 525 } |
528 } | 526 } |
529 } | 527 } |
530 } | 528 } |
531 | 529 |
532 //----- (00486F92) -------------------------------------------------------- | |
533 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans() | |
534 { | |
535 Span *v0; // ebx@1 | |
536 int v1; // eax@2 | |
537 Edge *v2; // ecx@3 | |
538 Edge *v3; // edx@3 | |
539 Edge *v4; // esi@6 | |
540 Edge *v5; // eax@7 | |
541 Edge *v6; // ecx@8 | |
542 Surf *v7; // esi@11 | |
543 double v8; // st7@13 | |
544 Surf *v9; // edi@13 | |
545 double v10; // st6@13 | |
546 double v11; // st7@14 | |
547 signed __int64 v12; // qax@14 | |
548 stru148 *v13; // eax@15 | |
549 Span *v14; // ecx@17 | |
550 double v15; // st7@28 | |
551 signed __int64 v16; // qax@28 | |
552 stru148 *v17; // eax@29 | |
553 Span *v18; // ecx@31 | |
554 Edge *i; // eax@40 | |
555 Edge *v20; // ecx@43 | |
556 Edge *v21; // esi@44 | |
557 double v22; // st7@45 | |
558 Edge *v23; // edx@48 | |
559 unsigned int v24; // [sp+10h] [bp-10h]@2 | |
560 float v25; // [sp+14h] [bp-Ch]@3 | |
561 Edge *v26; // [sp+18h] [bp-8h]@8 | |
562 unsigned int v27; // [sp+1Ch] [bp-4h]@1 | |
563 | |
564 v0 = pSpans; | |
565 stru_80C9D8.pSurf = &stru_80C980; | |
566 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; | |
567 stru_80C9A4.pSurf = &stru_80C980; | |
568 stru_80C980.pPrev = &stru_80C980; | |
569 stru_80C980.pNext = &stru_80C980; | |
570 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; | |
571 stru_80C980.field_8 = 0.0; | |
572 stru_80C980.field_4 = 0.0; | |
573 stru_80C9D8.pNext = &stru_80C9A4; | |
574 stru_80C9D8.pPrev = 0; | |
575 stru_80C9D8.field_8 = 1; | |
576 stru_80C9A4.pNext = 0; | |
577 stru_80C9A4.pPrev = &stru_80C9D8; | |
578 stru_80C9A4.field_8 = 0; | |
579 LODWORD(stru_80C980.field_0) = 0xC97423F0u; | |
580 v27 = pViewport->uViewportTL_Y; | |
581 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) | |
582 { | |
583 LABEL_51: | |
584 v0->field_8 = -1; | |
585 } | |
586 else | |
587 { | |
588 v1 = 52 * pViewport->uViewportTL_Y; | |
589 v24 = 52 * pViewport->uViewportTL_Y; | |
590 while ( 1 ) | |
591 { | |
592 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); | |
593 v3 = &stru_80C9D8; | |
594 v25 = (double)(signed int)v27; | |
595 if ( v2 != &defaultEdge ) | |
596 { | |
597 do | |
598 { | |
599 while ( 1 ) | |
600 { | |
601 v4 = v3->pNext; | |
602 if ( v2->field_0 <= (double)v4->field_0 ) | |
603 break; | |
604 v3 = v3->pNext; | |
605 } | |
606 v5 = v2->pNext; | |
607 v2->pNext = v4; | |
608 v2->pPrev = v3; | |
609 v3->pNext->pPrev = v2; | |
610 v3->pNext = v2; | |
611 v3 = v2; | |
612 v2 = v5; | |
613 } | |
614 while ( v5 != &defaultEdge ); | |
615 } | |
616 v6 = stru_80C9D8.pNext; | |
617 stru_80C980.field_20 = 0; | |
618 stru_80C980.field_22 = 1; | |
619 v26 = stru_80C9D8.pNext; | |
620 if ( stru_80C9D8.pNext ) | |
621 { | |
622 while ( 1 ) | |
623 { | |
624 v7 = v6->pSurf; | |
625 if ( v6->field_8 ) | |
626 { | |
627 ++v7->field_22; | |
628 if ( v7->field_22 == 1 ) | |
629 { | |
630 v8 = v6->field_0 + 2.0; | |
631 v9 = stru_80C980.pNext; | |
632 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0; | |
633 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4 | |
634 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8 | |
635 + stru_80C980.pNext->field_0 ) | |
636 { | |
637 do | |
638 v9 = v9->pNext; | |
639 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 ); | |
640 v7->pNext = v9; | |
641 v7->pPrev = v9->pPrev; | |
642 v9->pPrev->pNext = v7; | |
643 v9->pPrev = v7; | |
644 } | |
645 else | |
646 { | |
647 v11 = v6->field_0 + 0.5; | |
648 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20); | |
649 v0->field_C = v12; | |
650 if ( (signed __int16)v12 > 0 ) | |
651 { | |
652 v0->field_A = v27; | |
653 v0->field_8 = v9->field_20; | |
654 v13 = v9->pParent; | |
655 v0->pParent = v13; | |
656 if ( v13 ) | |
657 { | |
658 if ( v13->prolly_head ) | |
659 { | |
660 v14 = v13->prolly_tail; | |
661 if ( !v14 ) | |
662 return; | |
663 v14->pNext = v0; | |
664 } | |
665 else | |
666 { | |
667 v13->prolly_head = v0; | |
668 } | |
669 v13->prolly_tail = v0; | |
670 } | |
671 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
672 return; | |
673 ++v0; | |
674 ++pOutdoorCamera->uNumSpans; | |
675 } | |
676 v6 = v26; | |
677 v7->field_20 = (signed __int64)v11; | |
678 v7->pNext = v9; | |
679 v9->pPrev = v7; | |
680 stru_80C980.pNext = v7; | |
681 v7->pPrev = &stru_80C980; | |
682 } | |
683 } | |
684 } | |
685 else | |
686 { | |
687 --v7->field_22; | |
688 if ( !v7->field_22 ) | |
689 { | |
690 if ( stru_80C980.pNext == v7 ) | |
691 { | |
692 v15 = v6->field_0 + 0.5; | |
693 v16 = (signed __int64)(v15 - (double)v7->field_20); | |
694 v0->field_C = v16; | |
695 if ( (signed __int16)v16 > 0 ) | |
696 { | |
697 v0->field_A = v27; | |
698 v0->field_8 = v7->field_20; | |
699 v17 = v7->pParent; | |
700 v0->pParent = v17; | |
701 if ( v17 ) | |
702 { | |
703 if ( v17->prolly_head ) | |
704 { | |
705 v18 = v17->prolly_tail; | |
706 if ( !v18 ) | |
707 return; | |
708 v18->pNext = v0; | |
709 } | |
710 else | |
711 { | |
712 v17->prolly_head = v0; | |
713 } | |
714 v17->prolly_tail = v0; | |
715 } | |
716 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
717 return; | |
718 ++v0; | |
719 ++pOutdoorCamera->uNumSpans; | |
720 } | |
721 v7->pNext->field_20 = (signed __int64)v15; | |
722 v6 = v26; | |
723 } | |
724 v7->pNext->pPrev = v7->pPrev; | |
725 v7->pPrev->pNext = v7->pNext; | |
726 } | |
727 } | |
728 v26 = v6->pNext; | |
729 if ( !v26 ) | |
730 break; | |
731 v6 = v6->pNext; | |
732 } | |
733 } | |
734 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 ) | |
735 { | |
736 i->pPrev->pNext = i->pNext; | |
737 i->pNext->pPrev = i->pPrev; | |
738 } | |
739 v20 = stru_80C9D8.pNext; | |
740 if ( stru_80C9D8.pNext != &stru_80C9A4 ) | |
741 break; | |
742 LABEL_50: | |
743 ++v27; | |
744 v1 = v24 + 52; | |
745 v24 += 52; | |
746 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) | |
747 goto LABEL_51; | |
748 } | |
749 while ( 1 ) | |
750 { | |
751 v21 = v20->pNext; | |
752 if ( !v21 ) | |
753 break; | |
754 v22 = v20->field_4 + v20->field_0; | |
755 v20->field_0 = v22; | |
756 if ( v22 < stru_80C9D8.field_0 ) | |
757 v20->field_0 = stru_80C9D8.field_0 + 0.0000001; | |
758 while ( 1 ) | |
759 { | |
760 v23 = v20->pPrev; | |
761 if ( v20->field_0 >= (double)v23->field_0 ) | |
762 break; | |
763 v23->pNext = v20->pNext; | |
764 v20->pNext->pPrev = v23; | |
765 v23->pPrev->pNext = v20; | |
766 v20->pPrev = v23->pPrev; | |
767 v20->pNext = v23; | |
768 v23->pPrev = v20; | |
769 } | |
770 v20 = v21; | |
771 if ( v21 == &stru_80C9A4 ) | |
772 goto LABEL_50; | |
773 } | |
774 } | |
775 } | |
776 // 4EC3EC: using guessed type Edge defaultEdge; | |
777 | |
778 //----- (00487DA9) -------------------------------------------------------- | 530 //----- (00487DA9) -------------------------------------------------------- |
779 void __cdecl sub_487DA9() | 531 void __cdecl sub_487DA9() |
780 { | 532 { |
781 char *v0; // eax@1 | 533 char *v0; // eax@1 |
782 | 534 |
811 { | 563 { |
812 pSurfs->field_22 = 0; | 564 pSurfs->field_22 = 0; |
813 --v2; | 565 --v2; |
814 } | 566 } |
815 while ( v2 ); | 567 while ( v2 ); |
816 } | |
817 // 4EC3EC: using guessed type Edge defaultEdge; | |
818 | |
819 //----- (0048958E) -------------------------------------------------------- | |
820 stru12_MemoryBlock::stru12_MemoryBlock(int a2) | |
821 { | |
822 stru12_MemoryBlock *v2; // esi@1 | |
823 void *v3; // eax@1 | |
824 void *v4; // ecx@1 | |
825 stru12_MemoryBlock *result; // eax@1 | |
826 | |
827 v2 = this; | |
828 v3 = operator new(8 * a2 + 16); | |
829 v2->pBlockBase = v3; | |
830 v4 = (char *)v3 + PID_TYPE(-(signed int)v3); | |
831 result = v2; | |
832 v2->pAlignedBlock = v4; | |
833 } | |
834 | |
835 //----- (004895B7) -------------------------------------------------------- | |
836 stru12::stru12(stru11 *pStru11) | |
837 { | |
838 stru12 *v2; // esi@1 | |
839 | |
840 v2 = this; | |
841 this->field_44 = 0x41000000u; | |
842 this->field_4C = 0x46000000u; | |
843 //this->vdestructor_ptr = stru12::_4898E6; | |
844 this->field_48 = 0; | |
845 this->field_50 = 0; | |
846 this->field_54 = 0x33D6BF95u; | |
847 this->field_58 = 0; | |
848 | |
849 for (int i = 0; i < 12; ++i) | |
850 v2->pMemBlocks[i] = new stru12_MemoryBlock(640); | |
851 } | |
852 | |
853 //----- (00489810) -------------------------------------------------------- | |
854 stru12::~stru12() | |
855 { | |
856 for (int i = 0; i < 12; ++i) | |
857 delete pMemBlocks[i]; | |
858 } | |
859 | |
860 //----- (004898BF) -------------------------------------------------------- | |
861 stru12_MemoryBlock::~stru12_MemoryBlock() | |
862 { | |
863 stru12_MemoryBlock *v2; // esi@1 | |
864 void *v3; // ST00_4@1 | |
865 | |
866 v2 = this; | |
867 v3 = this->pBlockBase; | |
868 this->pAlignedBlock = 0; | |
869 free(v3); | |
870 v2->pBlockBase = 0; | |
871 /*if ( a2 & 1 ) | |
872 free(v2);*/ | |
873 } | |
874 | |
875 //----- (004898E6) -------------------------------------------------------- | |
876 void stru12::_4898E6() | |
877 { | |
878 void *v1; // eax@1 | |
879 void *v2; // edx@1 | |
880 char *v3; // edi@2 | |
881 double v4; // st7@2 | |
882 char *v5; // ebx@2 | |
883 double v6; // st6@3 | |
884 double v7; // st5@3 | |
885 double v8; // st4@3 | |
886 int v9; // esi@3 | |
887 double v10; // st3@3 | |
888 float v11; // ST34_4@5 | |
889 double v12; // st6@10 | |
890 double v13; // ST0C_8@10 | |
891 char *v14; // [sp+14h] [bp-44h]@2 | |
892 char *v15; // [sp+18h] [bp-40h]@2 | |
893 char *v16; // [sp+1Ch] [bp-3Ch]@2 | |
894 char *v17; // [sp+20h] [bp-38h]@2 | |
895 char *v18; // [sp+24h] [bp-34h]@2 | |
896 float v19; // [sp+30h] [bp-28h]@3 | |
897 float v20; // [sp+38h] [bp-20h]@3 | |
898 char *v21; // [sp+3Ch] [bp-1Ch]@2 | |
899 int v22; // [sp+40h] [bp-18h]@1 | |
900 char *v23; // [sp+44h] [bp-14h]@2 | |
901 char *v24; // [sp+48h] [bp-10h]@2 | |
902 int v25; // [sp+4Ch] [bp-Ch]@2 | |
903 float v26; // [sp+50h] [bp-8h]@3 | |
904 float v27; // [sp+54h] [bp-4h]@3 | |
905 | |
906 __debugbreak(); | |
907 v22 = 0; | |
908 v1 = this->pMemBlocks[1]->pAlignedBlock; | |
909 v2 = this->pMemBlocks[6]->pAlignedBlock; | |
910 if ( this->field_8C > 0 ) | |
911 { | |
912 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); | |
913 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); | |
914 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); | |
915 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); | |
916 v25 = (int)v1 - (int)v2; | |
917 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); | |
918 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); | |
919 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); | |
920 v4 = 1.0; | |
921 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); | |
922 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); | |
923 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); | |
924 do | |
925 { | |
926 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; | |
927 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; | |
928 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; | |
929 v7 = pIndoorCamera->fRotationYCosine; | |
930 v8 = pIndoorCamera->fRotationYSine; | |
931 v20 = pIndoorCamera->fRotationXCosine; | |
932 v19 = pIndoorCamera->fRotationXSine; | |
933 v9 = (int)((char *)v2 + (int)v21); | |
934 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; | |
935 if ( pIndoorCamera->sRotationX ) | |
936 { | |
937 v11 = v10; | |
938 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; | |
939 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
940 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; | |
941 } | |
942 else | |
943 { | |
944 *(float *)v9 = v10; | |
945 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
946 *(float *)((char *)v2 + (int)v5) = v6; | |
947 } | |
948 if ( *(float *)v9 >= 8.0 ) | |
949 { | |
950 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) | |
951 { | |
952 *(int *)v2 = 0; | |
953 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; | |
954 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX | |
955 - v12 * *(float *)((char *)v2 + (int)v3); | |
956 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY | |
957 - v12 * *(float *)((char *)v2 + (int)v5); | |
958 *(float *)((char *)v2 + (int)v16) = v4 | |
959 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
960 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); | |
961 v13 = *(float *)v9 + 6.7553994e15; | |
962 v4 = 1.0; | |
963 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); | |
964 } | |
965 else | |
966 { | |
967 *(int *)v2 = 2; | |
968 } | |
969 } | |
970 else | |
971 { | |
972 *(int *)v2 = 1; | |
973 } | |
974 ++v22; | |
975 v2 = (char *)v2 + 4; | |
976 } | |
977 while ( v22 < this->field_8C ); | |
978 } | |
979 this->field_8C = 0; | |
980 } | 568 } |
981 | 569 |
982 //----- (0048A959) -------------------------------------------------------- | 570 //----- (0048A959) -------------------------------------------------------- |
983 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) | 571 unsigned int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace) |
984 { | 572 { |
3329 b = max(0, min(255, b)); | 2917 b = max(0, min(255, b)); |
3330 | 2918 |
3331 return (a << 24) | (r << 16) | (g << 8) | b; | 2919 return (a << 24) | (r << 16) | (g << 8) | b; |
3332 } | 2920 } |
3333 | 2921 |
3334 //----- (004AD504) -------------------------------------------------------- | 2922 |
3335 int __fastcall sub_4AD504(signed int sFaceID) | |
3336 { | |
3337 int result; // eax@1 | |
3338 signed int v2; // ebx@1 | |
3339 BLVFace *v3; // esi@3 | |
3340 Texture *v4; // edi@6 | |
3341 int v5; // eax@7 | |
3342 int v6; // edx@7 | |
3343 int v7; // ecx@7 | |
3344 int v8; // ebx@8 | |
3345 int v9; // eax@8 | |
3346 int v10; // ebx@8 | |
3347 unsigned int v11; // ebx@9 | |
3348 int v12; // esi@10 | |
3349 int v13; // eax@13 | |
3350 unsigned __int16 *v14; // eax@13 | |
3351 unsigned int v15; // eax@14 | |
3352 unsigned __int16 *v16; // ebx@14 | |
3353 int v17; // eax@15 | |
3354 int v18; // ebx@15 | |
3355 int v19; // esi@15 | |
3356 int v20; // ecx@15 | |
3357 int v21; // eax@15 | |
3358 stru193_math *v22; // ebx@15 | |
3359 int v23; // eax@15 | |
3360 char *v24; // esi@16 | |
3361 int v25; // eax@18 | |
3362 int v26; // eax@18 | |
3363 int v27; // eax@20 | |
3364 signed int v28; // esi@20 | |
3365 signed int v29; // edx@20 | |
3366 signed int v30; // esi@20 | |
3367 signed int v31; // edi@20 | |
3368 int v32; // esi@20 | |
3369 int v33; // eax@26 | |
3370 int *v34; // esi@27 | |
3371 unsigned __int16 *v35; // edi@27 | |
3372 unsigned int v36; // edx@27 | |
3373 int v37; // ebx@27 | |
3374 char v38; // cl@27 | |
3375 char v39; // ch@27 | |
3376 int v40; // ebx@29 | |
3377 int v41; // edx@29 | |
3378 unsigned int v42; // ebx@30 | |
3379 int v43; // edx@30 | |
3380 int v44; // eax@33 | |
3381 int *v45; // esi@34 | |
3382 unsigned __int16 *v46; // edi@34 | |
3383 unsigned int v47; // edx@34 | |
3384 int v48; // ebx@34 | |
3385 char v49; // cl@34 | |
3386 char v50; // ch@34 | |
3387 int v51; // ebx@36 | |
3388 int v52; // edx@36 | |
3389 unsigned __int16 v53; // bx@37 | |
3390 int v54; // edx@37 | |
3391 int v55; // eax@40 | |
3392 int v56; // eax@41 | |
3393 int *v57; // esi@42 | |
3394 unsigned __int16 *v58; // edi@42 | |
3395 unsigned int v59; // edx@42 | |
3396 int v60; // ebx@42 | |
3397 char v61; // cl@42 | |
3398 char v62; // ch@42 | |
3399 unsigned int v63; // ebx@44 | |
3400 int v64; // edx@44 | |
3401 unsigned int v65; // ebx@44 | |
3402 int v66; // edx@44 | |
3403 unsigned int v67; // ebx@45 | |
3404 int v68; // edx@45 | |
3405 int v69; // ebx@45 | |
3406 int v70; // edx@45 | |
3407 int v71; // eax@48 | |
3408 int *v72; // esi@49 | |
3409 unsigned __int16 *v73; // edi@49 | |
3410 unsigned int v74; // edx@49 | |
3411 int v75; // ebx@49 | |
3412 char v76; // cl@49 | |
3413 char v77; // ch@49 | |
3414 unsigned int v78; // ebx@51 | |
3415 int v79; // edx@51 | |
3416 unsigned int v80; // ebx@51 | |
3417 int v81; // edx@51 | |
3418 unsigned int v82; // ebx@52 | |
3419 int v83; // edx@52 | |
3420 int v84; // ebx@52 | |
3421 int v85; // edx@52 | |
3422 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 | |
3423 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 | |
3424 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 | |
3425 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 | |
3426 int v90; // [sp+1Ch] [bp-88h]@20 | |
3427 BLVFace *v91; // [sp+20h] [bp-84h]@3 | |
3428 int v92; // [sp+24h] [bp-80h]@7 | |
3429 int i; // [sp+28h] [bp-7Ch]@7 | |
3430 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 | |
3431 unsigned int v95; // [sp+30h] [bp-74h]@1 | |
3432 Texture *v96; // [sp+34h] [bp-70h]@6 | |
3433 int v97; // [sp+38h] [bp-6Ch]@15 | |
3434 unsigned int v98; // [sp+3Ch] [bp-68h]@9 | |
3435 int v99; // [sp+40h] [bp-64h]@9 | |
3436 int v100; // [sp+44h] [bp-60h]@24 | |
3437 int v101; // [sp+48h] [bp-5Ch]@10 | |
3438 int v102; // [sp+4Ch] [bp-58h]@20 | |
3439 int v103; // [sp+50h] [bp-54h]@20 | |
3440 int v104; // [sp+54h] [bp-50h]@9 | |
3441 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 | |
3442 int v106; // [sp+5Ch] [bp-48h]@24 | |
3443 int v107; // [sp+60h] [bp-44h]@20 | |
3444 int v108; // [sp+64h] [bp-40h]@20 | |
3445 int v109; // [sp+68h] [bp-3Ch]@20 | |
3446 int v110; // [sp+6Ch] [bp-38h]@15 | |
3447 int v111; // [sp+70h] [bp-34h]@20 | |
3448 int a1; // [sp+74h] [bp-30h]@12 | |
3449 int a2; // [sp+78h] [bp-2Ch]@9 | |
3450 int *v114; // [sp+7Ch] [bp-28h]@16 | |
3451 int v115; // [sp+80h] [bp-24h]@18 | |
3452 int v116; // [sp+84h] [bp-20h]@7 | |
3453 unsigned int v117; // [sp+88h] [bp-1Ch]@15 | |
3454 unsigned int v118; // [sp+8Ch] [bp-18h]@24 | |
3455 int *v119; // [sp+90h] [bp-14h]@13 | |
3456 int v120; // [sp+94h] [bp-10h]@15 | |
3457 unsigned int v121; // [sp+98h] [bp-Ch]@15 | |
3458 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 | |
3459 unsigned int v123; // [sp+A0h] [bp-4h]@13 | |
3460 | |
3461 result = pRenderer->uTargetSurfacePitch; | |
3462 v2 = sFaceID; | |
3463 v95 = pRenderer->uTargetSurfacePitch; | |
3464 if ( sFaceID >= 0 ) | |
3465 { | |
3466 if ( sFaceID < (signed int)pIndoor->uNumFaces ) | |
3467 { | |
3468 v3 = &pIndoor->pFaces[sFaceID]; | |
3469 v91 = &pIndoor->pFaces[sFaceID]; | |
3470 if ( !pRenderer->pRenderD3D ) | |
3471 { | |
3472 result = GetPortalScreenCoord(sFaceID); | |
3473 if ( result ) | |
3474 { | |
3475 result = PortalFrustrum(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); | |
3476 if ( result ) | |
3477 { | |
3478 result = (int)v3->GetTexture(); | |
3479 v4 = (Texture *)result; | |
3480 v96 = (Texture *)result; | |
3481 if ( result ) | |
3482 { | |
3483 v5 = *(short *)(result + 38); | |
3484 LOBYTE(v3->uAttributes) |= 0x80u; | |
3485 v92 = v5; | |
3486 sub_4AE5F1(v2); | |
3487 ++pBLVRenderParams->field_84; | |
3488 v6 = stru_F8AD28.pDeltaUV[0]; | |
3489 v116 = stru_F8AD28.pDeltaUV[1]; | |
3490 v7 = 0; | |
3491 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) | |
3492 { | |
3493 v8 = v116; | |
3494 stru_F8AD28._blv_lights_xs[v7] += v6; | |
3495 v9 = 4 * v7 + 16297672; | |
3496 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; | |
3497 } | |
3498 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); | |
3499 result = stru_F8A590._viewport_space_y; | |
3500 a2 = stru_F8A590._viewport_space_y; | |
3501 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
3502 v99 = 640 * stru_F8A590._viewport_space_y; | |
3503 v86 = v4->pLevelOfDetail0_prolly_alpha_mask; | |
3504 v87 = v4->pLevelOfDetail1; | |
3505 v88 = v4->pLevelOfDetail2; | |
3506 v89 = v4->pLevelOfDetail3; | |
3507 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
3508 v104 = 2 * pBLVRenderParams->field_0_timer_; | |
3509 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
3510 { | |
3511 v12 = 2 * stru_F8A590._viewport_space_y; | |
3512 v101 = 2 * stru_F8A590._viewport_space_y; | |
3513 while ( 1 ) | |
3514 { | |
3515 a1 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v12); | |
3516 sub_4AE313(a1, result, &stru_F81018.field_0); | |
3517 if ( LOBYTE(viewparams->field_20) ) | |
3518 { | |
3519 v15 = v95 * (v12 - pBLVRenderParams->uViewportY); | |
3520 v119 = &pBLVRenderParams->pTargetZBuffer[2 | |
3521 * (*(__int16 *)((char *)stru_F8A590.viewport_left_side + v12) | |
3522 + 320 * (v12 - pBLVRenderParams->uViewportY)) | |
3523 - pBLVRenderParams->uViewportX]; | |
3524 v16 = &pBLVRenderParams->pRenderTarget[v15 | |
3525 + 2 * *(__int16 *)((char *)stru_F8A590.viewport_left_side + v12) | |
3526 - pBLVRenderParams->uViewportX]; | |
3527 v14 = &pBLVRenderParams->pRenderTarget[v15 | |
3528 + 2 * *(__int16 *)((char *)stru_F8A590.viewport_right_side + v12) | |
3529 - pBLVRenderParams->uViewportX]; | |
3530 v123 = (unsigned int)v16; | |
3531 } | |
3532 else | |
3533 { | |
3534 v13 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v12); | |
3535 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; | |
3536 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; | |
3537 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.viewport_right_side + v12)]; | |
3538 } | |
3539 v117 = (unsigned int)v14; | |
3540 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); | |
3541 v18 = stru_F81018.field_0.field_10; | |
3542 LOWORD(v17) = 0; | |
3543 v97 = stru_F8AD28.field_0 | v17; | |
3544 v110 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
3545 v19 = stru_F81018.field_0.field_4 >> i; | |
3546 v20 = 11 - v18; | |
3547 v116 = stru_F81018.field_0.field_8 >> i; | |
3548 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); | |
3549 v22 = stru_5C6E00; | |
3550 v122 = (unsigned __int16 *)v20; | |
3551 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); | |
3552 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); | |
3553 v120 = v116 + 4 * v23; | |
3554 if ( v123 < v117 ) | |
3555 { | |
3556 v24 = (char *)&stru_F81018.field_34.field_8; | |
3557 v114 = &stru_F81018.field_34.field_8; | |
3558 a1 += 16; | |
3559 while ( 1 ) | |
3560 { | |
3561 sub_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); | |
3562 v25 = *((int *)v24 - 2); | |
3563 LOWORD(v25) = 0; | |
3564 v115 = v97; | |
3565 v26 = stru_F8AD28.field_0 | v25; | |
3566 if ( v97 <= (unsigned int)v26 ) | |
3567 v115 = v26; | |
3568 v97 = v26; | |
3569 v27 = *((int *)v24 - 11); | |
3570 v28 = *((int *)v24 - 1); | |
3571 v105 = (&v86)[4 * v27]; | |
3572 v111 = v27 + 16; | |
3573 v29 = v4->uWidthMinus1; | |
3574 v109 = v27 + v27 + 16 - v4->uWidthLn2; | |
3575 v107 = v29 >> v27; | |
3576 v30 = v28 >> i; | |
3577 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); | |
3578 v31 = *v114 >> i; | |
3579 v122 = (unsigned __int16 *)(11 - v27); | |
3580 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); | |
3581 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); | |
3582 v108 = (signed int)(v116 - v121) >> 4; | |
3583 v103 = (v90 - v120) >> 4; | |
3584 v32 = v123 + 32; | |
3585 if ( LOBYTE(viewparams->field_20) ) | |
3586 v32 = v123 + 64; | |
3587 if ( v32 > v117 ) | |
3588 v32 = v117; | |
3589 v118 = v32; | |
3590 v100 = sub_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); | |
3591 v106 = (signed int)(v32 - v123) >> 1; | |
3592 if ( v110 >> 16 == v100 >> 16 ) | |
3593 { | |
3594 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); | |
3595 if ( LOBYTE(viewparams->field_20) ) | |
3596 { | |
3597 v44 = v123; | |
3598 if ( v123 < v118 ) | |
3599 { | |
3600 v45 = v119; | |
3601 v46 = v122; | |
3602 v47 = v121; | |
3603 v48 = v120; | |
3604 v49 = v111; | |
3605 v50 = v109; | |
3606 if ( v106 & 2 ) | |
3607 { | |
3608 *v119 = v115; | |
3609 v45 -= 2; | |
3610 v44 = v123 + 4; | |
3611 goto LABEL_37; | |
3612 } | |
3613 do | |
3614 { | |
3615 v44 += 8; | |
3616 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); | |
3617 v52 = v115; | |
3618 LOWORD(v51) = v46[v51]; | |
3619 *v45 = v115; | |
3620 v45[1] = v52; | |
3621 v45[640] = v52; | |
3622 v45[641] = v52; | |
3623 *(short *)(v44 - 8) = v51; | |
3624 *(short *)(v44 - 6) = v51; | |
3625 *(short *)(v44 + 1272) = v51; | |
3626 *(short *)(v44 + 1274) = v51; | |
3627 v45[2] = v52; | |
3628 v45[3] = v52; | |
3629 v45[642] = v52; | |
3630 v45[643] = v52; | |
3631 v121 += v108; | |
3632 v120 += v103; | |
3633 v47 = v121; | |
3634 v48 = v120; | |
3635 LABEL_37: | |
3636 v45 += 4; | |
3637 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; | |
3638 v54 = v108; | |
3639 *(short *)(v44 - 4) = v53; | |
3640 *(short *)(v44 - 2) = v53; | |
3641 *(short *)(v44 + 1276) = v53; | |
3642 *(short *)(v44 + 1278) = v53; | |
3643 v121 += v54; | |
3644 v120 += v103; | |
3645 v47 = v121; | |
3646 v48 = v120; | |
3647 } | |
3648 while ( v44 < v118 ); | |
3649 v123 = v44; | |
3650 v119 = v45; | |
3651 } | |
3652 } | |
3653 else | |
3654 { | |
3655 v33 = v123; | |
3656 if ( v123 < v118 ) | |
3657 { | |
3658 v34 = v119; | |
3659 v35 = v122; | |
3660 v36 = v121; | |
3661 v37 = v120; | |
3662 v38 = v111; | |
3663 v39 = v109; | |
3664 if ( v106 & 1 ) | |
3665 { | |
3666 *v119 = v115; | |
3667 --v34; | |
3668 v33 = v123 + 2; | |
3669 goto LABEL_30; | |
3670 } | |
3671 do | |
3672 { | |
3673 v33 += 4; | |
3674 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
3675 v41 = v115; | |
3676 LOWORD(v40) = v35[v40]; | |
3677 *v34 = v115; | |
3678 *(short *)(v33 - 4) = v40; | |
3679 v34[1] = v41; | |
3680 v121 += v108; | |
3681 v120 += v103; | |
3682 v36 = v121; | |
3683 v37 = v120; | |
3684 LABEL_30: | |
3685 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
3686 v34 += 2; | |
3687 v43 = v108; | |
3688 *(short *)(v33 - 2) = v35[*(char *)v42]; | |
3689 v121 += v43; | |
3690 v120 += v103; | |
3691 v36 = v121; | |
3692 v37 = v120; | |
3693 } | |
3694 while ( v33 < v118 ); | |
3695 v123 = v33; | |
3696 v119 = v34; | |
3697 } | |
3698 } | |
3699 } | |
3700 else | |
3701 { | |
3702 v55 = v110 - ((v100 - v110) >> 4); | |
3703 v110 = (v100 - v110) >> 4; | |
3704 v122 = (unsigned __int16 *)v55; | |
3705 if ( LOBYTE(viewparams->field_20) ) | |
3706 { | |
3707 v71 = v123; | |
3708 if ( v123 < v118 ) | |
3709 { | |
3710 v72 = v119; | |
3711 v73 = v94; | |
3712 v74 = v121; | |
3713 v75 = v120; | |
3714 v76 = v111; | |
3715 v77 = v109; | |
3716 if ( v106 & 2 ) | |
3717 { | |
3718 *v119 = v115; | |
3719 v72 += 2; | |
3720 v71 = v123 + 4; | |
3721 goto LABEL_52; | |
3722 } | |
3723 do | |
3724 { | |
3725 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
3726 v79 = (int)((char *)v122 + v110); | |
3727 v71 += 8; | |
3728 v122 = (unsigned __int16 *)v79; | |
3729 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; | |
3730 v81 = v115; | |
3731 LOWORD(v80) = v73[v80]; | |
3732 *v72 = v115; | |
3733 v72[1] = v81; | |
3734 v72[640] = v81; | |
3735 v72[641] = v81; | |
3736 *(short *)(v71 - 8) = v80; | |
3737 *(short *)(v71 - 6) = v80; | |
3738 *(short *)(v71 + 1272) = v80; | |
3739 *(short *)(v71 + 1274) = v80; | |
3740 v72[2] = v81; | |
3741 v72[3] = v81; | |
3742 v72[642] = v81; | |
3743 v72[643] = v81; | |
3744 v121 += v108; | |
3745 v120 += v103; | |
3746 v74 = v121; | |
3747 v75 = v120; | |
3748 v72 += 4; | |
3749 LABEL_52: | |
3750 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
3751 v83 = (int)((char *)v122 + v110); | |
3752 v84 = v105[v82]; | |
3753 v122 = (unsigned __int16 *)v83; | |
3754 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; | |
3755 v85 = v108; | |
3756 *(short *)(v71 - 4) = v84; | |
3757 *(short *)(v71 - 2) = v84; | |
3758 *(short *)(v71 + 1276) = v84; | |
3759 *(short *)(v71 + 1278) = v84; | |
3760 v121 += v85; | |
3761 v120 += v103; | |
3762 v74 = v121; | |
3763 v75 = v120; | |
3764 } | |
3765 while ( v71 < v118 ); | |
3766 v123 = v71; | |
3767 v119 = v72; | |
3768 } | |
3769 } | |
3770 else | |
3771 { | |
3772 v56 = v123; | |
3773 if ( v123 < v118 ) | |
3774 { | |
3775 v57 = v119; | |
3776 v58 = v94; | |
3777 v59 = v121; | |
3778 v60 = v120; | |
3779 v61 = v111; | |
3780 v62 = v109; | |
3781 if ( v106 & 1 ) | |
3782 { | |
3783 *v119 = v115; | |
3784 ++v57; | |
3785 v56 = v123 + 2; | |
3786 goto LABEL_45; | |
3787 } | |
3788 do | |
3789 { | |
3790 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
3791 v64 = (int)((char *)v122 + v110); | |
3792 v56 += 4; | |
3793 v122 = (unsigned __int16 *)v64; | |
3794 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; | |
3795 v66 = v115; | |
3796 LOWORD(v65) = v58[v65]; | |
3797 *v57 = v115; | |
3798 *(short *)(v56 - 4) = v65; | |
3799 v57[1] = v66; | |
3800 v121 += v108; | |
3801 v120 += v103; | |
3802 v59 = v121; | |
3803 v60 = v120; | |
3804 v57 += 2; | |
3805 LABEL_45: | |
3806 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
3807 v68 = (int)((char *)v122 + v110); | |
3808 v69 = v105[v67]; | |
3809 v122 = (unsigned __int16 *)v68; | |
3810 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; | |
3811 v70 = v108; | |
3812 *(short *)(v56 - 2) = v69; | |
3813 v121 += v70; | |
3814 v120 += v103; | |
3815 v59 = v121; | |
3816 v60 = v120; | |
3817 } | |
3818 while ( v56 < v118 ); | |
3819 v123 = v56; | |
3820 v119 = v57; | |
3821 } | |
3822 } | |
3823 } | |
3824 v114 += 13; | |
3825 v110 = v100; | |
3826 a1 += 16; | |
3827 v4 = v96; | |
3828 v121 = v116; | |
3829 v120 = v90; | |
3830 if ( v123 >= v117 ) | |
3831 break; | |
3832 v24 = (char *)v114; | |
3833 v22 = stru_5C6E00; | |
3834 } | |
3835 } | |
3836 ++a2; | |
3837 v98 += v95; | |
3838 result = a2; | |
3839 v101 += 2; | |
3840 v99 += 640; | |
3841 if ( a2 > stru_F8A590._viewport_space_w ) | |
3842 break; | |
3843 v12 = v101; | |
3844 result = a2; | |
3845 v11 = v98; | |
3846 } | |
3847 } | |
3848 } | |
3849 } | |
3850 } | |
3851 } | |
3852 } | |
3853 } | |
3854 return result; | |
3855 } | |
3856 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
3857 | |
3858 //----- (004ADD1D) -------------------------------------------------------- | |
3859 void __fastcall sub_4ADD1D(int uFaceID) | |
3860 { | |
3861 int v1; // edi@1 | |
3862 BLVFace *v2; // esi@3 | |
3863 signed int v3; // ebx@4 | |
3864 Texture *v4; // edi@9 | |
3865 signed int v5; // eax@9 | |
3866 char *v6; // edi@12 | |
3867 signed int v7; // eax@15 | |
3868 unsigned int v8; // eax@16 | |
3869 __int16 v9; // cx@19 | |
3870 unsigned __int8 *v10; // eax@19 | |
3871 unsigned __int16 *v11; // eax@19 | |
3872 int v12; // edi@19 | |
3873 int v13; // ebx@20 | |
3874 stru352 *v14; // esi@20 | |
3875 DWORD v15; // eax@22 | |
3876 signed int v16; // ecx@22 | |
3877 signed int v17; // ST68_4@22 | |
3878 int v18; // eax@22 | |
3879 int v19; // ecx@22 | |
3880 unsigned int v20; // esi@23 | |
3881 int v21; // edi@23 | |
3882 int v22; // eax@23 | |
3883 int *v23; // ebx@24 | |
3884 int v24; // edx@24 | |
3885 int v25; // ebx@25 | |
3886 unsigned __int16 v26; // cx@25 | |
3887 int v27; // edx@26 | |
3888 unsigned __int16 v28; // cx@26 | |
3889 unsigned __int8 v29; // sf@27 | |
3890 unsigned __int8 v30; // of@27 | |
3891 unsigned int v31; // esi@29 | |
3892 int v32; // edi@29 | |
3893 unsigned __int16 *v33; // eax@29 | |
3894 int *v34; // ebx@30 | |
3895 int v35; // edx@30 | |
3896 int v36; // ebx@31 | |
3897 unsigned __int16 v37; // cx@31 | |
3898 int v38; // edx@32 | |
3899 unsigned __int16 v39; // cx@32 | |
3900 Texture *v40; // [sp-10h] [bp-6Ch]@16 | |
3901 int v41; // [sp-Ch] [bp-68h]@15 | |
3902 unsigned int v42; // [sp+10h] [bp-4Ch]@1 | |
3903 signed int v43; // [sp+14h] [bp-48h]@12 | |
3904 signed int v44; // [sp+14h] [bp-48h]@22 | |
3905 int v45; // [sp+1Ch] [bp-40h]@22 | |
3906 int v46; // [sp+20h] [bp-3Ch]@22 | |
3907 int v47; // [sp+24h] [bp-38h]@19 | |
3908 char v48; // [sp+28h] [bp-34h]@19 | |
3909 int v49; // [sp+2Ch] [bp-30h]@19 | |
3910 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 | |
3911 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 | |
3912 int v52; // [sp+38h] [bp-24h]@22 | |
3913 int v53; // [sp+3Ch] [bp-20h]@22 | |
3914 signed int v54; // [sp+40h] [bp-1Ch]@12 | |
3915 int v55; // [sp+40h] [bp-1Ch]@20 | |
3916 int v56; // [sp+44h] [bp-18h]@20 | |
3917 stru352 *i; // [sp+48h] [bp-14h]@20 | |
3918 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 | |
3919 int v59; // [sp+50h] [bp-Ch]@4 | |
3920 int v60; // [sp+50h] [bp-Ch]@19 | |
3921 int v61; // [sp+54h] [bp-8h]@22 | |
3922 int *v62; // [sp+58h] [bp-4h]@23 | |
3923 int *v63; // [sp+58h] [bp-4h]@29 | |
3924 | |
3925 v1 = uFaceID; | |
3926 v42 = pRenderer->uTargetSurfacePitch; | |
3927 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) | |
3928 { | |
3929 v2 = &pIndoor->pFaces[uFaceID]; | |
3930 if ( pRenderer->pRenderD3D ) | |
3931 { | |
3932 v3 = sub_424579(uFaceID, &stru_F8AD28); | |
3933 v59 = v3; | |
3934 } | |
3935 else | |
3936 { | |
3937 v59 = GetPortalScreenCoord(uFaceID); | |
3938 v3 = v59; | |
3939 } | |
3940 if ( v3 && (pRenderer->pRenderD3D || PortalFrustrum(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) | |
3941 { | |
3942 v4 = v2->GetTexture(); | |
3943 v5 = 0; | |
3944 if ( v4 ) | |
3945 { | |
3946 if ( pRenderer->pRenderD3D ) | |
3947 { | |
3948 if ( v3 > 0 ) | |
3949 { | |
3950 v54 = v3; | |
3951 v43 = v3; | |
3952 v6 = (char *)&array_507D30[0].v; | |
3953 do | |
3954 { | |
3955 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); | |
3956 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; | |
3957 v6 += 48; | |
3958 --v54; | |
3959 } | |
3960 while ( v54 ); | |
3961 v3 = v59; | |
3962 v5 = v43; | |
3963 } | |
3964 v7 = v5; | |
3965 v41 = stru_F8AD28.field_0; | |
3966 array_507D30[v7].u = array_507D30[v7].u * 0.25; | |
3967 array_507D30[v7].v = array_507D30[v7].v * 0.25; | |
3968 if ( BYTE1(v2->uAttributes) & 0x40 ) | |
3969 { | |
3970 v40 = v2->GetTexture(); | |
3971 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); | |
3972 } | |
3973 else | |
3974 { | |
3975 v40 = v2->GetTexture(); | |
3976 v8 = v2->uBitmapID; | |
3977 } | |
3978 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); | |
3979 } | |
3980 else | |
3981 { | |
3982 v49 = v4->uWidthMinus1; | |
3983 v47 = v4->uHeightMinus1 << 16; | |
3984 v9 = 16 - v4->uWidthLn2; | |
3985 v10 = v4->pLevelOfDetail0_prolly_alpha_mask; | |
3986 LOBYTE(v2->uAttributes) |= 0x80u; | |
3987 v48 = v9; | |
3988 v50 = v10; | |
3989 sub_4AF412(); | |
3990 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
3991 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); | |
3992 v12 = stru_F8A590._viewport_space_y; | |
3993 v51 = v11; | |
3994 v60 = stru_F8A590._viewport_space_y; | |
3995 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
3996 { | |
3997 v13 = 2 * stru_F8A590._viewport_space_y; | |
3998 v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; | |
3999 v55 = 2 * stru_F8A590._viewport_space_y; | |
4000 v56 = 640 * stru_F8A590._viewport_space_y; | |
4001 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) | |
4002 { | |
4003 sub_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.viewport_left_side + v13), v12); | |
4004 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); | |
4005 v15 = GetTickCount(); | |
4006 v16 = v14->field_0; | |
4007 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; | |
4008 v45 = v14->field_4 >> 3; | |
4009 v44 = v16 >> 3; | |
4010 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; | |
4011 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; | |
4012 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
4013 v18 = v14->field_28; | |
4014 v19 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v13); | |
4015 LOWORD(v18) = 0; | |
4016 v46 = stru_F8AD28.field_0 | v18; | |
4017 v61 = *(__int16 *)((char *)stru_F8A590.viewport_right_side + v13) - v19; | |
4018 if ( LOBYTE(viewparams->field_20) ) | |
4019 { | |
4020 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
4021 - pBLVRenderParams->uViewportX]; | |
4022 v31 = v44; | |
4023 v32 = v45; | |
4024 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
4025 + 2 * v19 | |
4026 - pBLVRenderParams->uViewportX]; | |
4027 if ( v61 & 1 ) | |
4028 { | |
4029 --v61; | |
4030 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
4031 + 2 * v19 | |
4032 - pBLVRenderParams->uViewportX | |
4033 - 2]; | |
4034 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
4035 - pBLVRenderParams->uViewportX]; | |
4036 v35 = v46; | |
4037 v63 += 2; | |
4038 goto LABEL_32; | |
4039 } | |
4040 while ( 1 ) | |
4041 { | |
4042 v30 = __OFSUB__(v61, 2); | |
4043 v29 = v61 - 2 < 0; | |
4044 v61 -= 2; | |
4045 if ( v29 ^ v30 ) | |
4046 break; | |
4047 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); | |
4048 v31 += v52; | |
4049 v37 = v51[v36]; | |
4050 v32 += v53; | |
4051 v34 = v63; | |
4052 v35 = v46; | |
4053 *v33 = v37; | |
4054 v33[1] = v37; | |
4055 v33[640] = v37; | |
4056 v33[641] = v37; | |
4057 v63 += 4; | |
4058 v34[2] = v46; | |
4059 v34[3] = v46; | |
4060 v34[642] = v46; | |
4061 v34[643] = v46; | |
4062 LABEL_32: | |
4063 *v34 = v35; | |
4064 v34[1] = v35; | |
4065 v34[640] = v35; | |
4066 v34[641] = v35; | |
4067 v38 = v49 & (v31 >> 16); | |
4068 v33 += 4; | |
4069 v31 += v52; | |
4070 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; | |
4071 v32 += v53; | |
4072 *(v33 - 2) = v39; | |
4073 *(v33 - 1) = v39; | |
4074 v33[638] = v39; | |
4075 v33[639] = v39; | |
4076 } | |
4077 } | |
4078 else | |
4079 { | |
4080 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; | |
4081 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
4082 v20 = v44; | |
4083 v21 = v45; | |
4084 v22 = (int)v58; | |
4085 if ( v61 & 1 ) | |
4086 { | |
4087 --v61; | |
4088 v22 = (int)(v58 - 1); | |
4089 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
4090 v24 = v46; | |
4091 ++v62; | |
4092 goto LABEL_26; | |
4093 } | |
4094 while ( 1 ) | |
4095 { | |
4096 v30 = __OFSUB__(v61, 2); | |
4097 v29 = v61 - 2 < 0; | |
4098 v61 -= 2; | |
4099 if ( v29 ^ v30 ) | |
4100 break; | |
4101 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); | |
4102 v20 += v52; | |
4103 v26 = v51[v25]; | |
4104 v21 += v53; | |
4105 v23 = v62; | |
4106 v24 = v46; | |
4107 *(short *)v22 = v26; | |
4108 v62 += 2; | |
4109 v23[1] = v46; | |
4110 LABEL_26: | |
4111 *v23 = v24; | |
4112 v27 = v49 & (v20 >> 16); | |
4113 v22 += 4; | |
4114 v20 += v52; | |
4115 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; | |
4116 v21 += v53; | |
4117 *(short *)(v22 - 2) = v28; | |
4118 } | |
4119 } | |
4120 ++v60; | |
4121 ++i; | |
4122 v56 += 640; | |
4123 v55 += 2; | |
4124 if ( v60 > stru_F8A590._viewport_space_w ) | |
4125 break; | |
4126 v13 = v55; | |
4127 v12 = v60; | |
4128 } | |
4129 } | |
4130 } | |
4131 } | |
4132 } | |
4133 } | |
4134 } | |
4135 | |
4136 //----- (004AE1E7) -------------------------------------------------------- | |
4137 int __fastcall sub_4AE1E7(int a1, int a2, int a3) | |
4138 { | |
4139 int v3; // ebx@1 | |
4140 int v4; // edi@1 | |
4141 int v5; // esi@1 | |
4142 signed __int64 v6; // qtt@3 | |
4143 int v7; // esi@3 | |
4144 int v8; // eax@5 | |
4145 int result; // eax@5 | |
4146 int v10; // edx@5 | |
4147 int v11; // [sp+Ch] [bp-8h]@1 | |
4148 int v12; // [sp+1Ch] [bp+8h]@2 | |
4149 | |
4150 v3 = pBLVRenderParams->uViewportCenterY - a3; | |
4151 v4 = pBLVRenderParams->uViewportCenterX - a2; | |
4152 v11 = a1; | |
4153 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y | |
4154 + stru_F8AD28.field_7C | |
4155 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; | |
4156 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) | |
4157 { | |
4158 LODWORD(v6) = stru_F8AD28.vec_80.z << 16; | |
4159 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; | |
4160 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); | |
4161 } | |
4162 else | |
4163 { | |
4164 v7 = 1073741824; | |
4165 } | |
4166 v8 = stru_F8AD28.vec_9C.z; | |
4167 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z | |
4168 + stru_F8AD28.vec_8C.x | |
4169 + v4 * stru_F8AD28.vec_8C.y) | |
4170 * (signed __int64)v7) >> 16) | |
4171 + stru_F8AD28.field_98; | |
4172 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; | |
4173 v10 = result + stru_F8AD28.field_A8; | |
4174 stru_F83B80[v11].field_28 = v7; | |
4175 stru_F83B80[v11].field_4 = v10; | |
4176 return result; | |
4177 } | |
4178 | |
4179 //----- (004AE313) -------------------------------------------------------- | |
4180 int __fastcall sub_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) | |
4181 { | |
4182 int _dy; // ebx@1 | |
4183 int _dx; // edi@1 | |
4184 int v5; // ecx@1 | |
4185 int v6; // esi@1 | |
4186 int v7; // ST18_4@2 | |
4187 signed __int64 v8; // qtt@3 | |
4188 unsigned int v9; // ecx@3 | |
4189 int result; // eax@8 | |
4190 int v11; // [sp+Ch] [bp-8h]@1 | |
4191 | |
4192 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; | |
4193 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; | |
4194 ++pBLVRenderParams->field_88; | |
4195 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; | |
4196 v6 = v5 + _dx * stru_F8AD28.vec_80.x; | |
4197 v11 = v5 + _dx * stru_F8AD28.vec_80.x; | |
4198 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) | |
4199 { | |
4200 LODWORD(v8) = stru_F8AD28.vec_80.z << 16; | |
4201 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; | |
4202 v9 = v8 / v11; | |
4203 } | |
4204 else | |
4205 { | |
4206 v9 = 0x40000000u; | |
4207 } | |
4208 if ( (signed int)v9 >= stru_F8AD28.field_34 ) | |
4209 p->field_0 = v9; | |
4210 else | |
4211 p->field_0 = stru_F8AD28.field_34; | |
4212 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) | |
4213 * (signed __int64)(signed int)v9) >> 16) | |
4214 + stru_F8AD28.field_98 | |
4215 + (stru_F8AD28.pDeltaUV[0] << 16); | |
4216 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) | |
4217 * (signed __int64)(signed int)v9) >> 16) | |
4218 + stru_F8AD28.field_A8 | |
4219 + (stru_F8AD28.pDeltaUV[1] << 16); | |
4220 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); | |
4221 if ( result < 369620 || bUseLoResSprites ) | |
4222 { | |
4223 if ( result < 184810 ) | |
4224 p->field_10 = result > 92405; | |
4225 else | |
4226 p->field_10 = 2; | |
4227 } | |
4228 else | |
4229 { | |
4230 p->field_10 = 3; | |
4231 } | |
4232 return result; | |
4233 } | |
4234 | |
4235 //----- (004AE491) -------------------------------------------------------- | |
4236 int __fastcall sub_4AE491(signed int a1, signed int a2) | |
4237 { | |
4238 signed int v2; // eax@1 | |
4239 signed int v3; // edi@1 | |
4240 int v4; // ecx@1 | |
4241 int v5; // esi@2 | |
4242 int v6; // eax@2 | |
4243 int v7; // ebx@2 | |
4244 unsigned int v8; // ecx@2 | |
4245 int v9; // edx@5 | |
4246 int v10; // edx@7 | |
4247 unsigned int v11; // eax@8 | |
4248 int v13; // [sp+4h] [bp-18h]@2 | |
4249 int v14; // [sp+8h] [bp-14h]@2 | |
4250 signed int v15; // [sp+Ch] [bp-10h]@1 | |
4251 int v16; // [sp+14h] [bp-8h]@1 | |
4252 int v17; // [sp+18h] [bp-4h]@1 | |
4253 | |
4254 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); | |
4255 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); | |
4256 v17 = stru_F8AD28.uCurrentAmbientLightLevel; | |
4257 v4 = 0; | |
4258 v15 = v2; | |
4259 v16 = 0; | |
4260 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
4261 { | |
4262 do | |
4263 { | |
4264 v5 = v16; | |
4265 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); | |
4266 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); | |
4267 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
4268 v7 = v13; | |
4269 v8 = v14; | |
4270 if ( v6 < v13 ) | |
4271 { | |
4272 v6 = v13; | |
4273 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
4274 } | |
4275 if ( v6 < v14 ) | |
4276 { | |
4277 v9 = v6; | |
4278 v6 = v14; | |
4279 v8 = v9; | |
4280 } | |
4281 if ( v7 < (signed int)v8 ) | |
4282 { | |
4283 v10 = v8; | |
4284 v8 = v7; | |
4285 v7 = v10; | |
4286 } | |
4287 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; | |
4288 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) | |
4289 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); | |
4290 ++v16; | |
4291 v2 = v15; | |
4292 } | |
4293 while ( v16 < stru_F8AD28.uNumLightsApplied ); | |
4294 v4 = 0; | |
4295 } | |
4296 if ( stru_F8AD28.field_3E4 != v4 ) | |
4297 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); | |
4298 if ( v17 >= v4 ) | |
4299 { | |
4300 if ( v17 > 2031616 ) | |
4301 v17 = 2031616; | |
4302 } | |
4303 else | |
4304 { | |
4305 v17 = v4; | |
4306 } | |
4307 ++pBLVRenderParams->field_8C; | |
4308 return v17; | |
4309 } | |
4310 // 4AE491: using guessed type int __fastcall sub_4AE491(int, int); | |
4311 | |
4312 //----- (004AE5F1) -------------------------------------------------------- | |
4313 void __fastcall sub_4AE5F1(unsigned int uFaceID) | |
4314 { | |
4315 BLVFace *v1; // esi@1 | |
4316 BLVFaceExtra *v2; // ebx@1 | |
4317 int v3; // eax@1 | |
4318 int v4; // edi@1 | |
4319 Texture *v5; // edi@1 | |
4320 int v6; // eax@1 | |
4321 unsigned int v7; // eax@1 | |
4322 unsigned int v8; // ecx@1 | |
4323 unsigned int v9; // eax@1 | |
4324 unsigned int v10; // ecx@5 | |
4325 int v11; // edi@10 | |
4326 int v12; // ecx@10 | |
4327 int v13; // eax@10 | |
4328 int v14; // edx@10 | |
4329 int v15; // ebx@12 | |
4330 double v16; // st7@16 | |
4331 int v17; // eax@16 | |
4332 char *v18; // ebx@17 | |
4333 int v19; // ecx@19 | |
4334 int v20; // eax@19 | |
4335 int v21; // edx@21 | |
4336 int v22; // eax@23 | |
4337 int v23; // ST04_4@26 | |
4338 int v24; // edi@26 | |
4339 double v25; // st6@26 | |
4340 int v26; // eax@26 | |
4341 double v27; // st6@26 | |
4342 int v28; // ecx@26 | |
4343 char v29; // al@26 | |
4344 int v30; // edx@28 | |
4345 int v31; // ecx@28 | |
4346 BLVLightMM7 *v32; // ecx@32 | |
4347 int v33; // edi@33 | |
4348 int v34; // edx@33 | |
4349 int v35; // eax@33 | |
4350 int v36; // edi@35 | |
4351 int v37; // edx@37 | |
4352 int v38; // ebx@39 | |
4353 int v39; // edi@42 | |
4354 int v40; // eax@42 | |
4355 char *v41; // ebx@45 | |
4356 signed int v42; // ecx@47 | |
4357 int v43; // edi@47 | |
4358 int v44; // eax@49 | |
4359 int v45; // edx@51 | |
4360 int v46; // eax@53 | |
4361 int v47; // ST04_4@55 | |
4362 int v48; // edi@55 | |
4363 double v49; // st6@55 | |
4364 int v50; // eax@55 | |
4365 double v51; // st6@55 | |
4366 int v52; // eax@55 | |
4367 int v53; // ecx@57 | |
4368 int v54; // ecx@58 | |
4369 int v55; // ecx@59 | |
4370 int v56; // edx@62 | |
4371 int v57; // ecx@62 | |
4372 int v58; // eax@63 | |
4373 int v59; // edx@64 | |
4374 int v60; // ecx@67 | |
4375 int v61; // edx@67 | |
4376 int v62; // eax@68 | |
4377 int v63; // edx@69 | |
4378 signed int v64; // ecx@72 | |
4379 double v65; // st7@75 | |
4380 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 | |
4381 Vec3_int_ v67; // [sp+18h] [bp-28h]@9 | |
4382 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 | |
4383 int v69; // [sp+28h] [bp-18h]@10 | |
4384 int v70; // [sp+2Ch] [bp-14h]@10 | |
4385 int X; // [sp+30h] [bp-10h]@10 | |
4386 int v72; // [sp+34h] [bp-Ch]@10 | |
4387 int v73; // [sp+38h] [bp-8h]@10 | |
4388 int v74; // [sp+3Ch] [bp-4h]@10 | |
4389 | |
4390 v1 = &pIndoor->pFaces[uFaceID]; | |
4391 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
4392 v3 = v1->uBitmapID; | |
4393 v4 = v1->uBitmapID; | |
4394 v68 = v2; | |
4395 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
4396 v6 = 8 * uFaceID; | |
4397 LOBYTE(v6) = PID(OBJECT_BModel,uFaceID); | |
4398 stru_F8AD28.field_0 = v6; | |
4399 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; | |
4400 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; | |
4401 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; | |
4402 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; | |
4403 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; | |
4404 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
4405 v7 = GetTickCount(); | |
4406 v8 = v1->uAttributes; | |
4407 v9 = v7 >> 3; | |
4408 if ( v8 & 4 ) | |
4409 { | |
4410 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; | |
4411 } | |
4412 else | |
4413 { | |
4414 if ( v8 & 0x20 ) | |
4415 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; | |
4416 } | |
4417 v10 = v1->uAttributes; | |
4418 if ( BYTE1(v10) & 8 ) | |
4419 { | |
4420 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; | |
4421 } | |
4422 else | |
4423 { | |
4424 if ( v10 & 0x40 ) | |
4425 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; | |
4426 } | |
4427 v1->_get_normals(&v67, &v66); | |
4428 stru_F8AD28.vec_14.x = v67.x; | |
4429 stru_F8AD28.vec_14.y = v67.y; | |
4430 stru_F8AD28.vec_14.z = v67.z; | |
4431 stru_F8AD28.vec_20.x = v66.x; | |
4432 stru_F8AD28.vec_20.y = v66.y; | |
4433 stru_F8AD28.vec_20.z = v66.z; | |
4434 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; | |
4435 if ( pBLVRenderParams->sPartyRotX ) | |
4436 { | |
4437 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
4438 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; | |
4439 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
4440 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; | |
4441 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
4442 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
4443 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
4444 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
4445 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
4446 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
4447 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
4448 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
4449 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
4450 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
4451 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
4452 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
4453 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
4454 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
4455 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
4456 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
4457 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
4458 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
4459 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
4460 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
4461 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
4462 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
4463 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
4464 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
4465 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
4466 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
4467 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
4468 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
4469 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
4470 v73 = -65536 * pBLVRenderParams->vPartyPos.z; | |
4471 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
4472 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
4473 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
4474 v13 = pBLVRenderParams->vPartyPos.y; | |
4475 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
4476 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
4477 v14 = pBLVRenderParams->vPartyPos.x; | |
4478 } | |
4479 else | |
4480 { | |
4481 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
4482 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
4483 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
4484 - v70; | |
4485 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
4486 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
4487 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
4488 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
4489 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
4490 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
4491 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
4492 - v70; | |
4493 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
4494 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
4495 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
4496 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
4497 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
4498 - v70; | |
4499 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
4500 v14 = pBLVRenderParams->vPartyPos.x; | |
4501 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
4502 v13 = pBLVRenderParams->vPartyPos.y; | |
4503 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
4504 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
4505 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
4506 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
4507 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
4508 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
4509 v70 = -65536 * pBLVRenderParams->vPartyPos.z; | |
4510 } | |
4511 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
4512 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z | |
4513 + stru_F8AD28.plane_4.dist | |
4514 + stru_F8AD28.plane_4.vNormal.y * v13 | |
4515 + stru_F8AD28.plane_4.vNormal.x * v14; | |
4516 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
4517 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
4518 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
4519 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
4520 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
4521 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
4522 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
4523 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
4524 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; | |
4525 v15 = v70; | |
4526 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; | |
4527 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
4528 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); | |
4529 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
4530 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
4531 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; | |
4532 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; | |
4533 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; | |
4534 stru_F8AD28.field_38 = 0; | |
4535 stru_F8AD28.field_A8 = -(X | |
4536 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) | |
4537 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); | |
4538 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) | |
4539 { | |
4540 stru_F8AD28.field_3E4 = 1; | |
4541 stru_F8AD28.field_3E8 = *(int *)&v68->field_4; | |
4542 stru_F8AD28.field_3EC = *(int *)&v68->field_8; | |
4543 stru_F8AD28.field_3F0 = v68->field_1E; | |
4544 stru_F8AD28.field_3F4 = v68->field_20; | |
4545 } | |
4546 else | |
4547 { | |
4548 stru_F8AD28.field_3E4 = 0; | |
4549 } | |
4550 v16 = 0.0039215689; | |
4551 v17 = 116 * v1->uSectorID; | |
4552 v69 = v17; | |
4553 v74 = 0; | |
4554 v73 = 0; | |
4555 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; | |
4556 v70 = pMobileLightsStack->uNumLightsActive; | |
4557 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
4558 { | |
4559 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; | |
4560 do | |
4561 { | |
4562 if ( v74 >= 20 ) | |
4563 break; | |
4564 v19 = *((short *)v18 + 2); | |
4565 v20 = *((short *)v18 - 1); | |
4566 if ( v20 > v1->pBounding.x1 - v19 ) | |
4567 { | |
4568 if ( v20 < v19 + v1->pBounding.x2 ) | |
4569 { | |
4570 v21 = *(short *)v18; | |
4571 if ( v21 > v1->pBounding.y1 - v19 ) | |
4572 { | |
4573 if ( v21 < v19 + v1->pBounding.y2 ) | |
4574 { | |
4575 v22 = *((short *)v18 + 1); | |
4576 if ( v22 > v1->pBounding.z1 - v19 ) | |
4577 { | |
4578 if ( v22 < v19 + v1->pBounding.z2 ) | |
4579 { | |
4580 X = (v1->pFacePlane_old.dist | |
4581 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z | |
4582 + v21 * v1->pFacePlane_old.vNormal.y | |
4583 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; | |
4584 if ( X <= v19 ) | |
4585 { | |
4586 v23 = X; | |
4587 v24 = v74; | |
4588 stru_F8AD28._blv_lights_radii[v74] = v19; | |
4589 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; | |
4590 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; | |
4591 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); | |
4592 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; | |
4593 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); | |
4594 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; | |
4595 v25 = (double)(signed int)v68 * v16; | |
4596 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; | |
4597 v26 = (unsigned __int8)v18[8]; | |
4598 *(float *)(v24 * 4 + 16297992) = v25; | |
4599 v27 = (double)(signed int)v68; | |
4600 v68 = (BLVFaceExtra *)v26; | |
4601 *(float *)(v24 * 4 + 16298072) = v27 * v16; | |
4602 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; | |
4603 v16 = 0.0039215689; | |
4604 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); | |
4605 v28 = v74; | |
4606 v29 = v18[9]; | |
4607 ++v74; | |
4608 stru_F8AD28._blv_lights_types[v28] = v29; | |
4609 } | |
4610 } | |
4611 } | |
4612 } | |
4613 } | |
4614 } | |
4615 } | |
4616 ++v73; | |
4617 v18 += 18; | |
4618 v17 = v69; | |
4619 } | |
4620 while ( v73 < v70 ); | |
4621 } | |
4622 v30 = 0; | |
4623 v73 = 0; | |
4624 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
4625 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
4626 if ( v31 > 0 ) | |
4627 { | |
4628 while ( v74 < 20 ) | |
4629 { | |
4630 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; | |
4631 if ( !(v32->uAtributes & 8) ) | |
4632 { | |
4633 v33 = v1->pBounding.x1; | |
4634 v34 = v32->vPosition.x; | |
4635 X = v32->uBrightness; | |
4636 v35 = v32->uRadius; | |
4637 v68 = (BLVFaceExtra *)v32->uRadius; | |
4638 if ( v34 > v33 - v35 ) | |
4639 { | |
4640 if ( v34 < v35 + v1->pBounding.x2 ) | |
4641 { | |
4642 v36 = v32->vPosition.y; | |
4643 if ( v36 > v1->pBounding.y1 - v35 ) | |
4644 { | |
4645 if ( v36 < v35 + v1->pBounding.y2 ) | |
4646 { | |
4647 v37 = v32->vPosition.z; | |
4648 if ( v37 > v1->pBounding.z1 - v35 ) | |
4649 { | |
4650 if ( v37 < v35 + v1->pBounding.z2 ) | |
4651 { | |
4652 v38 = (v1->pFacePlane_old.dist | |
4653 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x | |
4654 + v37 * v1->pFacePlane_old.vNormal.z | |
4655 + v36 * v1->pFacePlane_old.vNormal.y) >> 16; | |
4656 if ( v38 >= 0 ) | |
4657 { | |
4658 if ( v38 <= v35 && v35 ) | |
4659 { | |
4660 v39 = v74; | |
4661 stru_F8AD28._blv_lights_radii[v74] = v35; | |
4662 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; | |
4663 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; | |
4664 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; | |
4665 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; | |
4666 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; | |
4667 v68 = (BLVFaceExtra *)v32->uRed; | |
4668 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; | |
4669 v68 = (BLVFaceExtra *)v32->uGreen; | |
4670 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; | |
4671 v68 = (BLVFaceExtra *)v32->uBlue; | |
4672 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; | |
4673 v16 = 0.0039215689; | |
4674 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); | |
4675 v40 = v74++; | |
4676 stru_F8AD28._blv_lights_types[v40] = 1; | |
4677 } | |
4678 } | |
4679 } | |
4680 } | |
4681 } | |
4682 } | |
4683 } | |
4684 } | |
4685 } | |
4686 v30 = v73++ + 1; | |
4687 if ( v73 >= v70 ) | |
4688 break; | |
4689 v17 = v69; | |
4690 } | |
4691 } | |
4692 v73 = 0; | |
4693 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
4694 { | |
4695 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; | |
4696 do | |
4697 { | |
4698 if ( v74 >= 20 ) | |
4699 break; | |
4700 v42 = *((short *)v41 + 2); | |
4701 v43 = *((short *)v41 - 1); | |
4702 if ( v43 > v1->pBounding.x1 - v42 ) | |
4703 { | |
4704 if ( v43 < v42 + v1->pBounding.x2 ) | |
4705 { | |
4706 v44 = *(short *)v41; | |
4707 if ( v44 > v1->pBounding.y1 - v42 ) | |
4708 { | |
4709 if ( v44 < v42 + v1->pBounding.y2 ) | |
4710 { | |
4711 v45 = *((short *)v41 + 1); | |
4712 if ( v45 > v1->pBounding.z1 - v42 ) | |
4713 { | |
4714 if ( v45 < v42 + v1->pBounding.z2 ) | |
4715 { | |
4716 v46 = (v1->pFacePlane_old.dist | |
4717 + *(short *)v41 * v1->pFacePlane_old.vNormal.y | |
4718 + v43 * v1->pFacePlane_old.vNormal.x | |
4719 + v45 * v1->pFacePlane_old.vNormal.z) >> 16; | |
4720 v69 = v46; | |
4721 if ( v46 >= 0 ) | |
4722 { | |
4723 if ( v46 <= v42 ) | |
4724 { | |
4725 v47 = v69; | |
4726 v48 = v74; | |
4727 stru_F8AD28._blv_lights_radii[v74] = v42; | |
4728 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; | |
4729 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); | |
4730 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; | |
4731 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); | |
4732 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; | |
4733 v49 = (double)(signed int)v68 * v16; | |
4734 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; | |
4735 v50 = (unsigned __int8)v41[8]; | |
4736 stru_F8AD28._blv_lights_rs[v48] = v49; | |
4737 v51 = (double)(signed int)v68; | |
4738 v68 = (BLVFaceExtra *)v50; | |
4739 stru_F8AD28._blv_lights_gs[v48] = v51 * v16; | |
4740 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; | |
4741 v16 = 0.0039215689; | |
4742 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); | |
4743 v52 = v74++; | |
4744 stru_F8AD28._blv_lights_types[v52] = 1; | |
4745 } | |
4746 } | |
4747 } | |
4748 } | |
4749 } | |
4750 } | |
4751 } | |
4752 } | |
4753 ++v73; | |
4754 v41 += 12; | |
4755 } | |
4756 while ( v73 < pStationaryLightsStack->uNumLightsActive ); | |
4757 } | |
4758 stru_F8AD28.uNumLightsApplied = v74; | |
4759 v53 = v1->pBounding.x2; | |
4760 if ( pBLVRenderParams->vPartyPos.x <= v53 ) | |
4761 { | |
4762 v55 = v1->pBounding.x1; | |
4763 if ( pBLVRenderParams->vPartyPos.x >= v55 ) | |
4764 v54 = 0; | |
4765 else | |
4766 v54 = v55 - pBLVRenderParams->vPartyPos.x; | |
4767 } | |
4768 else | |
4769 { | |
4770 v54 = pBLVRenderParams->vPartyPos.x - v53; | |
4771 } | |
4772 v56 = v1->pBounding.y2; | |
4773 v57 = v54 * v54; | |
4774 if ( pBLVRenderParams->vPartyPos.y <= v56 ) | |
4775 { | |
4776 v59 = v1->pBounding.y1; | |
4777 if ( pBLVRenderParams->vPartyPos.y >= v59 ) | |
4778 v58 = 0; | |
4779 else | |
4780 v58 = v59 - pBLVRenderParams->vPartyPos.y; | |
4781 } | |
4782 else | |
4783 { | |
4784 v58 = pBLVRenderParams->vPartyPos.y - v56; | |
4785 } | |
4786 v60 = v58 * v58 + v57; | |
4787 v61 = v1->pBounding.z2; | |
4788 if ( pBLVRenderParams->vPartyPos.z <= v61 ) | |
4789 { | |
4790 v63 = v1->pBounding.z1; | |
4791 if ( pBLVRenderParams->vPartyPos.z >= v63 ) | |
4792 v62 = 0; | |
4793 else | |
4794 v62 = v63 - pBLVRenderParams->vPartyPos.z; | |
4795 } | |
4796 else | |
4797 { | |
4798 v62 = pBLVRenderParams->vPartyPos.z - v61; | |
4799 } | |
4800 v64 = v62 * v62 + v60; | |
4801 if ( v64 ) | |
4802 stru_F8AD28.field_34 = integer_sqrt(v64) << 16; | |
4803 else | |
4804 stru_F8AD28.field_34 = 0; | |
4805 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); | |
4806 v65 = (double)(signed int)v68; | |
4807 if ( v65 >= 655.36 ) | |
4808 { | |
4809 if ( v65 >= 26214.4 ) | |
4810 { | |
4811 if ( v65 >= 45875.2 ) | |
4812 { | |
4813 stru_F8AD28.field_44 = 8; | |
4814 stru_F8AD28.field_48 = 3; | |
4815 } | |
4816 else | |
4817 { | |
4818 stru_F8AD28.field_44 = 16; | |
4819 stru_F8AD28.field_48 = 4; | |
4820 } | |
4821 } | |
4822 else | |
4823 { | |
4824 stru_F8AD28.field_44 = 32; | |
4825 stru_F8AD28.field_48 = 5; | |
4826 } | |
4827 } | |
4828 else | |
4829 { | |
4830 stru_F8AD28.field_44 = 64; | |
4831 stru_F8AD28.field_48 = 6; | |
4832 } | |
4833 } | |
4834 // 519AB4: using guessed type int uNumStationaryLightsApplied; | |
4835 | |
4836 //----- (004AF412) -------------------------------------------------------- | |
4837 int __cdecl sub_4AF412() | |
4838 { | |
4839 int v0; // ST20_4@2 | |
4840 int v1; // ST20_4@2 | |
4841 int v2; // ST20_4@2 | |
4842 int v3; // esi@2 | |
4843 int v4; // ST20_4@2 | |
4844 int v5; // ecx@2 | |
4845 int v6; // ebx@2 | |
4846 int v7; // edi@2 | |
4847 int v8; // edx@2 | |
4848 int v9; // eax@2 | |
4849 int result; // eax@4 | |
4850 | |
4851 stru_F8AD28.plane_4.vNormal.z = -65536; | |
4852 stru_F8AD28.vec_20.y = -65536; | |
4853 stru_F8AD28.plane_4.vNormal.x = 0; | |
4854 stru_F8AD28.plane_4.vNormal.y = 0; | |
4855 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; | |
4856 stru_F8AD28.vec_14.x = 65536; | |
4857 stru_F8AD28.vec_14.y = 0; | |
4858 stru_F8AD28.vec_14.z = 0; | |
4859 stru_F8AD28.vec_20.x = 0; | |
4860 stru_F8AD28.vec_20.z = 0; | |
4861 stru_F8AD28.uDefaultAmbientLightLevel = 0; | |
4862 if ( pBLVRenderParams->sPartyRotX ) | |
4863 { | |
4864 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
4865 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
4866 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
4867 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
4868 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
4869 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
4870 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
4871 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
4872 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
4873 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
4874 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
4875 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
4876 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
4877 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
4878 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
4879 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
4880 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
4881 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
4882 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
4883 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
4884 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
4885 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
4886 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
4887 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
4888 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
4889 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
4890 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
4891 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
4892 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
4893 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
4894 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
4895 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
4896 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
4897 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
4898 v6 = pBLVRenderParams->vPartyPos.z; | |
4899 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
4900 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
4901 v8 = pBLVRenderParams->vPartyPos.y; | |
4902 v9 = pBLVRenderParams->vPartyPos.x; | |
4903 } | |
4904 else | |
4905 { | |
4906 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
4907 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
4908 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
4909 * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
4910 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
4911 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
4912 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
4913 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
4914 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
4915 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
4916 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
4917 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
4918 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
4919 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
4920 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
4921 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
4922 v8 = pBLVRenderParams->vPartyPos.y; | |
4923 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
4924 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
4925 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
4926 v9 = pBLVRenderParams->vPartyPos.x; | |
4927 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
4928 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
4929 v6 = pBLVRenderParams->vPartyPos.z; | |
4930 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
4931 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
4932 v7 = -65536 * pBLVRenderParams->vPartyPos.z; | |
4933 } | |
4934 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
4935 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 | |
4936 + stru_F8AD28.plane_4.dist | |
4937 + stru_F8AD28.plane_4.vNormal.x * v9 | |
4938 + stru_F8AD28.plane_4.vNormal.z * v6; | |
4939 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
4940 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
4941 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
4942 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
4943 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
4944 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
4945 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
4946 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
4947 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
4948 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) | |
4949 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) | |
4950 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); | |
4951 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
4952 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
4953 result = 0; | |
4954 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) | |
4955 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) | |
4956 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); | |
4957 stru_F8AD28.field_38 = 0; | |
4958 stru_F8AD28.field_3E4 = 0; | |
4959 stru_F8AD28.uCurrentAmbientLightLevel = 0; | |
4960 stru_F8AD28.uNumLightsApplied = 0; | |
4961 stru_F8AD28.field_34 = 0; | |
4962 return result; | |
4963 } | |
4964 | 2923 |
4965 //----- (004B1447) -------------------------------------------------------- | 2924 //----- (004B1447) -------------------------------------------------------- |
4966 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) | 2925 Player *__fastcall sub_4B1447_party_fine(int a1, int a2, int a3) |
4967 { | 2926 { |
4968 signed int v3; // esi@1 | 2927 signed int v3; // esi@1 |