comparison mm7_3.cpp @ 79:6ad816231528

structure fixes, death crash fix
author zipi
date Sat, 02 Feb 2013 16:52:36 +0000
parents 6ef241d53522
children 377535d6e366
comparison
equal deleted inserted replaced
78:d56c13146285 79:6ad816231528
3226 { 3226 {
3227 if ( v108 != _zero ) 3227 if ( v108 != _zero )
3228 { 3228 {
3229 if ( v108 >> 6 < pOutdoor->uNumBModels ) 3229 if ( v108 >> 6 < pOutdoor->uNumBModels )
3230 { 3230 {
3231 v7 = (ODMFace *)&pOutdoor->pBModels[v108 >> 6].pFaces; 3231 v7 = pOutdoor->pBModels[v108 >> 6].pFaces;
3232 v6 = v108 & 0x3F; 3232 v6 = v108 & 0x3F;
3233 if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 ) 3233 /*if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 )
3234 { 3234 {
3235 pParty->field_6F4_packedid = 8 * v108 | OBJECT_BModel; 3235 pParty->field_6F4_packedid = 8 * v108 | OBJECT_BModel;
3236 v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292); 3236 v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292);
3237 }*/
3238 if ( BYTE3(v7[v6].uAttributes) & 4 )
3239 {
3240 pParty->field_6F4_packedid = 8 * v108 | OBJECT_BModel;
3241 v103 = v7[v6].sCogTriggeredID;
3237 } 3242 }
3238 } 3243 }
3239 } 3244 }
3240 } 3245 }
3241 pParty->field_6F4_packedid = 8 * v108 | OBJECT_BModel; 3246 pParty->field_6F4_packedid = 8 * v108 | OBJECT_BModel;
3772 if ( (stru_721530.uFaceID & 7) == 6 ) 3777 if ( (stru_721530.uFaceID & 7) == 6 )
3773 { 3778 {
3774 pParty->bFlying = 0; 3779 pParty->bFlying = 0;
3775 v46 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; 3780 v46 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9];
3776 v127 = v46; 3781 v127 = v46;
3777 v47 = &v46->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F]; 3782 v47 = &v46->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F];
3778 v48 = v47->pBoundingBox.z2 - v47->pBoundingBox.z1; 3783 v48 = v47->pBoundingBox.z2 - v47->pBoundingBox.z1;
3779 v51 = __OFSUB__(v48, 32); 3784 v51 = __OFSUB__(v48, 32);
3780 v49 = v48 == 32; 3785 v49 = v48 == 32;
3781 v50 = v48 - 32 < 0; 3786 v50 = v48 - 32 < 0;
3782 v52 = v47->pFacePlane.vNormal.z; 3787 v52 = v47->pFacePlane.vNormal.z;
6674 //----- (0047840D) -------------------------------------------------------- 6679 //----- (0047840D) --------------------------------------------------------
6675 char Render::DrawBuildingsD3D() 6680 char Render::DrawBuildingsD3D()
6676 { 6681 {
6677 IndoorCameraD3D *v0; // eax@3 6682 IndoorCameraD3D *v0; // eax@3
6678 char result; // al@3 6683 char result; // al@3
6679 Vec3_int_ **v2; // ebx@4 6684 BSPModel *v2; // ebx@4
6680 Vec3_int_ *v3; // eax@6 6685 int v3; // eax@6
6681 ODMFace *pFace; // esi@6 6686 ODMFace *pFace; // esi@6
6682 int v5; // ecx@8 6687 Vec3_int_ *v5; // ecx@8
6683 int v6; // eax@8 6688 int v6; // eax@8
6684 stru148 *v7; // ebx@8 6689 stru148 *v7; // ebx@8
6685 LightmapBuilder *v8; // eax@8 6690 LightmapBuilder *v8; // eax@8
6686 int v9; // ecx@8 6691 int v9; // ecx@8
6687 char v10; // zf@8 6692 char v10; // zf@8
6691 unsigned int v14; // eax@18 6696 unsigned int v14; // eax@18
6692 unsigned int v15; // eax@22 6697 unsigned int v15; // eax@22
6693 unsigned int v16; // edi@22 6698 unsigned int v16; // edi@22
6694 int v17; // eax@24 6699 int v17; // eax@24
6695 int v18; // edi@34 6700 int v18; // edi@34
6696 char *v19; // eax@35 6701 RenderVertexSoft *v19; // eax@35
6697 char *v20; // ecx@35 6702 unsigned short *v20; // ecx@35
6703 unsigned short *v20b; // ecx@35
6704 unsigned short *v20c; // ecx@35
6698 Vec3_int_ *v21; // edx@36 6705 Vec3_int_ *v21; // edx@36
6699 int v22; // edx@36 6706 int v22; // edx@36
6700 char *v23; // edi@37 6707 RenderVertexSoft *v23; // edi@37
6701 int v24; // eax@50 6708 int v24; // eax@50
6702 int v25; // ecx@55 6709 int v25; // ecx@55
6703 int v26; // eax@57 6710 int v26; // eax@57
6704 int v27; // eax@57 6711 int v27; // eax@57
6705 int v28; // eax@58 6712 int v28; // eax@58
6714 RenderVertexSoft *v37; // [sp-10h] [bp-68h]@69 6721 RenderVertexSoft *v37; // [sp-10h] [bp-68h]@69
6715 int v38; // [sp-Ch] [bp-64h]@69 6722 int v38; // [sp-Ch] [bp-64h]@69
6716 LightmapBuilder *v39; // [sp-8h] [bp-60h]@2 6723 LightmapBuilder *v39; // [sp-8h] [bp-60h]@2
6717 int v40; // [sp-4h] [bp-5Ch]@2 6724 int v40; // [sp-4h] [bp-5Ch]@2
6718 std::string *v41; // [sp+Ch] [bp-4Ch]@2 6725 std::string *v41; // [sp+Ch] [bp-4Ch]@2
6719 Vec3_int_ *v42; // [sp+10h] [bp-48h]@6 6726 int v41b;
6727 int v42; // [sp+10h] [bp-48h]@6
6720 LightmapBuilder *pLightmapBuilder; // [sp+14h] [bp-44h]@8 6728 LightmapBuilder *pLightmapBuilder; // [sp+14h] [bp-44h]@8
6721 float v44; // [sp+18h] [bp-40h]@10 6729 float v44; // [sp+18h] [bp-40h]@10
6722 float v45; // [sp+1Ch] [bp-3Ch]@10 6730 float v45; // [sp+1Ch] [bp-3Ch]@10
6723 ODMFace *v46; // [sp+20h] [bp-38h]@6 6731 ODMFace *v46; // [sp+20h] [bp-38h]@6
6724 IndoorCameraD3D *v47; // [sp+24h] [bp-34h]@3 6732 IndoorCameraD3D *v47; // [sp+24h] [bp-34h]@3
6728 int v51; // [sp+34h] [bp-24h]@35 6736 int v51; // [sp+34h] [bp-24h]@35
6729 int v52; // [sp+38h] [bp-20h]@36 6737 int v52; // [sp+38h] [bp-20h]@36
6730 int v53; // [sp+3Ch] [bp-1Ch]@8 6738 int v53; // [sp+3Ch] [bp-1Ch]@8
6731 Vec3_int_ *v54; // [sp+40h] [bp-18h]@6 6739 Vec3_int_ *v54; // [sp+40h] [bp-18h]@6
6732 int a1; // [sp+44h] [bp-14h]@3 6740 int a1; // [sp+44h] [bp-14h]@3
6733 Vec3_int_ **v56; // [sp+48h] [bp-10h]@4 6741 BSPModel *v56; // [sp+48h] [bp-10h]@4
6734 int uNumVertices; // [sp+4Ch] [bp-Ch]@34 6742 int uNumVertices; // [sp+4Ch] [bp-Ch]@34
6735 int unused; // [sp+50h] [bp-8h]@3 6743 int unused; // [sp+50h] [bp-8h]@3
6736 int a3; // [sp+57h] [bp-1h]@2 6744 int a3; // [sp+57h] [bp-1h]@2
6737 6745
6738 if ( !pRenderer->pRenderD3D ) 6746 if ( !pRenderer->pRenderD3D )
6742 unused = 0; 6750 unused = 0;
6743 v0 = pGame->pIndoorCameraD3D; 6751 v0 = pGame->pIndoorCameraD3D;
6744 a1 = 0; 6752 a1 = 0;
6745 v47 = v0; 6753 v47 = v0;
6746 result = LOBYTE(pOutdoor->pBModels); 6754 result = LOBYTE(pOutdoor->pBModels);
6747 v41 = (std::string *)pOutdoor->uNumBModels; 6755 v41b = pOutdoor->uNumBModels;
6748 if ( (signed int)pOutdoor->uNumBModels > 0 ) 6756 if ( (signed int)pOutdoor->uNumBModels > 0 )
6749 { 6757 {
6750 v2 = (Vec3_int_ **)&pOutdoor->pBModels->uNumFaces; 6758 v2 = pOutdoor->pBModels;
6751 v56 = (Vec3_int_ **)&pOutdoor->pBModels->uNumFaces; 6759 v56 = pOutdoor->pBModels;
6752 while ( 1 ) 6760 while ( 1 )
6753 { 6761 {
6754 if ( IsBModelVisible(a1, &unused) ) 6762 if ( IsBModelVisible(a1, &unused) )
6755 { 6763 {
6756 *(v2 - 3) = (Vec3_int_ *)((unsigned int)*(v2 - 3) | 1); 6764 v2->field_40 |= 1u;
6757 v3 = *v2; 6765 v3 = v2->uNumFaces;
6758 pFace = (ODMFace *)v2[2]; 6766 pFace = v2->pFaces;
6759 v54 = 0; 6767 v54 = 0;
6760 v46 = pFace; 6768 v46 = pFace;
6761 v42 = v3; 6769 v42 = v3;
6762 if ( (signed int)v3 > 0 ) 6770 if ( v3 > 0 )
6763 break; 6771 break;
6764 } 6772 }
6765 LABEL_86: 6773 LABEL_86:
6766 ++a1; 6774 ++a1;
6767 v2 += 47; 6775 ++v2;// += 47;
6768 result = a1; 6776 result = a1;
6769 v56 = v2; 6777 v56 = v2;
6770 if ( a1 >= (signed int)v41 ) 6778 if ( a1 >= v41b )
6771 return result; 6779 return result;
6772 } 6780 }
6773 while ( 1 ) 6781 while ( 1 )
6774 { 6782 {
6775 if (pFace->Invisible()) 6783 if (pFace->Invisible())
6776 goto LABEL_85; 6784 goto LABEL_85;
6777 v5 = (int)*(v2 - 1); 6785 //v5 = (int)*(v2 - 1);
6786 v5 = v2->pVertices.pVertices;
6778 v6 = pFace->pVertexIDs[0]; 6787 v6 = pFace->pVertexIDs[0];
6779 v53 = 0; 6788 v53 = 0;
6780 v7 = &array_77EC08[pOutdoorCamera->numStru148s]; 6789 v7 = &array_77EC08[pOutdoorCamera->numStru148s];
6781 v8 = *(LightmapBuilder **)(v5 + 12 * v6 + 8); 6790 //v8 = *(LightmapBuilder **)(v5 + 12 * v6 + 8);
6791 v8 = (LightmapBuilder *)v5[v6].z;
6782 *(int *)&v7->flags = 0; 6792 *(int *)&v7->flags = 0;
6783 pLightmapBuilder = v8; 6793 pLightmapBuilder = v8;
6784 v9 = pFace->uTextureID; 6794 v9 = pFace->uTextureID;
6785 v10 = (BYTE1(pFace->uAttributes) & 0x40) == 0; 6795 v10 = (BYTE1(pFace->uAttributes) & 0x40) == 0;
6786 v48 = pFace->uTextureID; 6796 v48 = pFace->uTextureID;
6863 v50 = 0; 6873 v50 = 0;
6864 v49 = 0; 6874 v49 = 0;
6865 uNumVertices = v18; 6875 uNumVertices = v18;
6866 if ( v18 > 0 ) 6876 if ( v18 > 0 )
6867 { 6877 {
6868 v19 = (char *)&array_73D150[0].vWorldPosition.z; 6878 //v19 = (char *)&array_73D150[0].vWorldPosition.z;
6869 v20 = (char *)pFace->pTextureUIDs; 6879 //v20 = (char *)pFace->pTextureUIDs;
6880 v19 = array_73D150;
6881 v20 = pFace->pTextureUIDs;
6882 v20b = pFace->pVertexIDs;
6883 v20c = pFace->pTextureVIDs;
6870 v51 = v18; 6884 v51 = v18;
6871 do 6885 do
6872 { 6886 {
6873 v21 = &(*(v56 - 1))[*((short *)v20 - 20)]; 6887 /* v21 = &(*(v56 - 1))[*((short *)v20 - 20)];
6874 *((float *)v19 - 2) = (double)v21->x; 6888 *((float *)v19 - 2) = (double)v21->x;
6875 *((float *)v19 - 1) = (double)v21->y; 6889 *((float *)v19 - 1) = (double)v21->y;
6876 *(float *)v19 = (double)v21->z; 6890 *(float *)v19 = (double)v21->z;
6877 v19 += 48; 6891 v19 += 48;
6878 v52 = v7->sTextureDeltaU + *(short *)v20; 6892 v52 = v7->sTextureDeltaU + *(short *)v20;
6879 *((float *)v19 - 5) = (double)v52 * v45; 6893 *((float *)v19 - 5) = (double)v52 * v45;
6880 v22 = v7->sTextureDeltaV + *((short *)v20 + 20); 6894 v22 = v7->sTextureDeltaV + *((short *)v20 + 20);
6881 v20 += 2; 6895 v20 += 2;
6882 v10 = v51-- == 1; 6896 v10 = v51-- == 1;
6883 v52 = v22; 6897 v52 = v22;
6884 *((float *)v19 - 4) = (double)v22 * v44; 6898 *((float *)v19 - 4) = (double)v22 * v44;*/
6899
6900 //v21 = (BSPVertexBuffer *)(*((_DWORD *)v56 - 1) + 12 * *(v20 - 20));
6901 v21 = &v56->pVertices.pVertices[*v20b];
6902 //*((float *)v19 - 2) = (double)v21->x;
6903 //*((float *)v19 - 1) = (double)v21->y;
6904 v19->vWorldPosition.x = (double)v21->x;
6905 v19->vWorldPosition.y = (double)v21->y;
6906 v19->vWorldPosition.z = (double)v21->z;
6907 ++v19;
6908 v52 = v7->sTextureDeltaU + (signed __int16)*v20;
6909 //*((float *)v19 - 5) = (double)v52 * v45;
6910 (v19-1)->u = (double)v52 * v45;
6911 v22 = v7->sTextureDeltaV + (signed __int16)*v20c;
6912 ++v20;
6913 ++v20b;
6914 ++v20c;
6915 v10 = v51-- == 1;
6916 v52 = v22;
6917 //*((float *)v19 - 4) = (double)v22 * v44;
6918 (v19-1)->v = (double)v22 * v44;
6885 } 6919 }
6886 while ( !v10 ); 6920 while ( !v10 );
6887 v23 = (char *)&array_73D150[0].vWorldViewPosition; 6921 //v23 = (char *)&array_73D150[0].vWorldViewPosition;
6922 v23 = array_73D150;
6888 v51 = uNumVertices; 6923 v51 = uNumVertices;
6889 *(float *)&pLightmapBuilder = (double)(signed int)pLightmapBuilder; 6924 *(float *)&pLightmapBuilder = (double)(signed int)pLightmapBuilder;
6890 do 6925 do
6891 { 6926 {
6892 if ( *(float *)&pLightmapBuilder == *((float *)v23 - 1) ) 6927 //if ( *(float *)&pLightmapBuilder == *((float *)v23 - 1) )
6928 if ( *(float *)&pLightmapBuilder == v23->vWorldPosition.z )
6893 ++v53; 6929 ++v53;
6894 v47->ViewTransform((RenderVertexSoft *)(v23 - 12), 1u); 6930 //v47->ViewTransform((RenderVertexSoft *)(v23 - 12), 1u);
6895 if ( *(float *)v23 < 8.0 || (double)pOutdoorCamera->shading_dist_mist < *(float *)v23 ) 6931 v47->ViewTransform(v23, 1u);
6932 if ( v23->vWorldViewPosition.x < 8.0 || (double)pOutdoorCamera->shading_dist_mist < v23->vWorldViewPosition.x )
6896 { 6933 {
6897 if ( *(float *)v23 >= 8.0 ) 6934 if ( v23->vWorldViewPosition.x >= 8.0 )
6898 v49 = 1; 6935 v49 = 1;
6899 else 6936 else
6900 v50 = 1; 6937 v50 = 1;
6901 } 6938 }
6902 else 6939 else
6903 { 6940 {
6904 v47->Project((RenderVertexSoft *)(v23 - 12), 1u, 0); 6941 v47->Project(v23, 1u, 0);
6905 } 6942 }
6906 v23 += 48; 6943 ++v23;// += 48;
6907 --v51; 6944 --v51;
6908 } 6945 }
6909 while ( v51 ); 6946 while ( v51 );
6910 v18 = uNumVertices; 6947 v18 = uNumVertices;
6911 } 6948 }
7059 7096
7060 //----- (004789DE) -------------------------------------------------------- 7097 //----- (004789DE) --------------------------------------------------------
7061 BSPModel *Render::DrawBuildingsSW() 7098 BSPModel *Render::DrawBuildingsSW()
7062 { 7099 {
7063 BSPModel *result; // eax@1 7100 BSPModel *result; // eax@1
7064 unsigned int *v1; // ebx@2 7101 BSPModel *v1; // ebx@2
7065 int v2; // eax@4 7102 int v2; // eax@4
7066 int v3; // edi@4 7103 ODMFace *v3; // edi@4
7067 int v4; // ecx@6 7104 int v4; // ecx@6
7068 int v5; // eax@6 7105 int v5; // eax@6
7069 int v6; // ecx@6 7106 int v6; // ecx@6
7070 int v7; // ecx@6 7107 int v7; // ecx@6
7071 double v8; // st7@7 7108 double v8; // st7@7
7088 Texture *v25; // eax@43 7125 Texture *v25; // eax@43
7089 int v26; // esi@43 7126 int v26; // esi@43
7090 signed int v27; // ecx@43 7127 signed int v27; // ecx@43
7091 double v28; // st6@43 7128 double v28; // st6@43
7092 double v29; // st5@43 7129 double v29; // st5@43
7093 int v30; // edx@44 7130 unsigned short *v30; // edx@44
7094 int v31; // eax@44 7131 int v31; // eax@44
7095 double v32; // st4@45 7132 double v32; // st4@45
7096 int v33; // ecx@45 7133 int v33; // ecx@45
7097 char v34; // zf@45 7134 char v34; // zf@45
7098 BSPVertexBuffer *v35; // eax@50 7135 BSPVertexBuffer *v35; // eax@50
7134 int v71; // [sp+84h] [bp-3Ch]@23 7171 int v71; // [sp+84h] [bp-3Ch]@23
7135 float v72; // [sp+88h] [bp-38h]@69 7172 float v72; // [sp+88h] [bp-38h]@69
7136 int v73; // [sp+8Ch] [bp-34h]@57 7173 int v73; // [sp+8Ch] [bp-34h]@57
7137 int v74; // [sp+90h] [bp-30h]@6 7174 int v74; // [sp+90h] [bp-30h]@6
7138 int v75; // [sp+94h] [bp-2Ch]@6 7175 int v75; // [sp+94h] [bp-2Ch]@6
7139 int v76; // [sp+98h] [bp-28h]@4 7176 ODMFace *v76; // [sp+98h] [bp-28h]@4
7140 int v77; // [sp+9Ch] [bp-24h]@6 7177 int v77; // [sp+9Ch] [bp-24h]@6
7141 unsigned int *v78; // [sp+A0h] [bp-20h]@2 7178 BSPModel *v78; // [sp+A0h] [bp-20h]@2
7142 int v79; // [sp+A4h] [bp-1Ch]@4 7179 int v79; // [sp+A4h] [bp-1Ch]@4
7143 int a1; // [sp+A8h] [bp-18h]@1 7180 int a1; // [sp+A8h] [bp-18h]@1
7144 int v81; // [sp+ACh] [bp-14h]@7 7181 unsigned short *v81; // [sp+ACh] [bp-14h]@7
7145 int v82; // [sp+B0h] [bp-10h]@6 7182 int v82; // [sp+B0h] [bp-10h]@6
7146 int v83; // [sp+B4h] [bp-Ch]@6 7183 int v83; // [sp+B4h] [bp-Ch]@6
7147 signed int v84; // [sp+B8h] [bp-8h]@7 7184 signed int v84; // [sp+B8h] [bp-8h]@7
7148 int a2; // [sp+BCh] [bp-4h]@1 7185 int a2; // [sp+BCh] [bp-4h]@1
7149 7186
7150 a2 = 0; 7187 a2 = 0;
7151 a1 = 0; 7188 a1 = 0;
7152 result = pOutdoor->pBModels; 7189 result = (BSPModel *)pOutdoor->pBModels;
7153 v66 = pOutdoor->uNumBModels; 7190 v66 = pOutdoor->uNumBModels;
7154 if ( (signed int)pOutdoor->uNumBModels > 0 ) 7191 if ( (signed int)pOutdoor->uNumBModels > 0 )
7155 { 7192 {
7156 v1 = &pOutdoor->pBModels->uNumFaces; 7193 v1 = pOutdoor->pBModels;
7157 v78 = &pOutdoor->pBModels->uNumFaces; 7194 v78 = pOutdoor->pBModels;
7158 while ( 1 ) 7195 while ( 1 )
7159 { 7196 {
7160 if ( IsBModelVisible(a1, &a2) ) 7197 if ( IsBModelVisible(a1, &a2) )
7161 { 7198 {
7162 *(v1 - 3) |= 1u; 7199 v1->field_40 |= 1u;
7163 v2 = *v1; 7200 v2 = v1->uNumFaces;
7164 v3 = v1[2]; 7201 v3 = (ODMFace *)v1->pFaces;
7165 v79 = 0; 7202 v74 = 0;
7166 v76 = v3; 7203 v76 = v3;
7167 v68 = v2; 7204 v68 = v2;
7168 if ( v2 > 0 ) 7205 if ( v2 > 0 )
7169 break; 7206 break;
7170 } 7207 }
7171 LABEL_73: 7208 LABEL_73:
7172 ++a1; 7209 ++a1;
7173 v1 += 47; 7210 ++v1;
7174 result = (BSPModel *)a1; 7211 result = (BSPModel *)a1;
7175 v78 = v1; 7212 v78 = v1;
7176 if ( a1 >= v66 ) 7213 if ( a1 >= v66 )
7177 return result; 7214 return result;
7178 } 7215 }
7179 while ( 1 ) 7216 while ( 1 )
7180 { 7217 {
7181 if ( !(*(char *)(v3 + 29) & 0x20) ) 7218 if ( !v3->Invisible() )
7182 { 7219 {
7183 v4 = 3 * *(short *)(v3 + 32); 7220 v4 = 3 * v3->pVertexIDs[0];
7184 v5 = (int)(v1 - 2); 7221 v5 = (int)((char *)v1 - 8);
7185 v67 = (int)(v1 - 2); 7222 v67 = (int)((char *)v1 - 8);
7186 v6 = *(int *)(*(v1 - 1) + 4 * v4 + 8) + 4; 7223 v6 = *(_DWORD *)(*(&v1->uNumConvexFaces - 2) + 4 * v4 + 8) + 4;
7187 v82 = 0; 7224 v82 = 0;
7188 v83 = v6; 7225 v83 = v6;
7189 v74 = 0; 7226 v74 = 0;
7190 v7 = *(char *)(v3 + 302); 7227 v7 = v3->uNumVertices;
7191 v75 = 0; 7228 v75 = 0;
7192 v77 = v7; 7229 v77 = v7;
7193 if ( v7 > 0 ) 7230 if ( v7 > 0 )
7194 { 7231 {
7195 v8 = (double)v83; 7232 v8 = (double)v83;
7196 v9 = (char *)&array_73D150[0].vWorldViewPosition; 7233 v9 = (char *)&array_73D150[0].vWorldViewPosition;
7197 v81 = v3 + 32; 7234 v81 = v3->pVertexIDs;
7198 v83 = v7; 7235 v83 = v7;
7199 *(float *)&v84 = v8; 7236 *(float *)&v84 = v8;
7200 while ( 1 ) 7237 while ( 1 )
7201 { 7238 {
7202 v10 = *(int *)(v5 + 4) + 12 * *(short *)v81; 7239 v10 = *(int *)(v5 + 4) + 12 * *(short *)v81;
7237 v84 = *(int *)v3; 7274 v84 = *(int *)v3;
7238 v83 = (unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.x) >> 16; 7275 v83 = (unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.x) >> 16;
7239 v82 = -pOutdoor->vSunlight.y; 7276 v82 = -pOutdoor->vSunlight.y;
7240 v84 = *(int *)(v3 + 4); 7277 v84 = *(int *)(v3 + 4);
7241 v82 = (unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.y) >> 16; 7278 v82 = (unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.y) >> 16;
7242 v81 = -pOutdoor->vSunlight.z; 7279 v81 = (unsigned __int16 *)-pOutdoor->vSunlight.z;
7243 v84 = *(int *)(v3 + 8); 7280 v84 = *(int *)(v3 + 8);
7244 v81 = (unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.z) >> 16; 7281 v81 = (unsigned __int16 *)((unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.z) >> 16);
7245 v84 = v83 + v82 + ((unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.z) >> 16); 7282 v84 = v83 + v82 + ((unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.z) >> 16);
7246 v13 = (double)v84 * 0.000015258789; 7283 v13 = (double)v84 * 0.000015258789;
7247 if ( v13 < 0.0 ) 7284 if ( v13 < 0.0 )
7248 v13 = 0.0; 7285 v13 = 0.0;
7249 *(float *)&v84 = v13 * 31.0; 7286 *(float *)&v84 = v13 * 31.0;
7313 v84 = v25->uTextureHeight; 7350 v84 = v25->uTextureHeight;
7314 v28 = 1.0 / (double)v27; 7351 v28 = 1.0 / (double)v27;
7315 v29 = 1.0 / (double)v84; 7352 v29 = 1.0 / (double)v84;
7316 if ( v77 > 0 ) 7353 if ( v77 > 0 )
7317 { 7354 {
7318 v30 = v3 + 112; 7355 v30 = v3->pTextureVIDs;
7319 v31 = 0; 7356 v31 = 0;
7320 v83 = v77; 7357 v83 = v77;
7321 do 7358 do
7322 { 7359 {
7323 v32 = 1.0 / (*(float *)(v31 * 48 + 7590236) + 0.0000001); 7360 v32 = 1.0 / (*(float *)(v31 * 48 + 7590236) + 0.0000001);
7522 v11 = ((unsigned __int64)(stru_5C6E00->SinCos(angle) * (signed __int64)v19) >> 16) 7559 v11 = ((unsigned __int64)(stru_5C6E00->SinCos(angle) * (signed __int64)v19) >> 16)
7523 + ((unsigned __int64)(v15 * (signed __int64)v17) >> 16); 7560 + ((unsigned __int64)(v15 * (signed __int64)v17) >> 16);
7524 v12 = v11 >> 16; 7561 v12 = v11 >> 16;
7525 if ( v22 <= pOutdoorCamera->shading_dist_mist + 2048 ) 7562 if ( v22 <= pOutdoorCamera->shading_dist_mist + 2048 )
7526 { 7563 {
7527 if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v10) + 512 ) 7564 //if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v10) + 512 )
7565 if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels[v14].sBoundingRadius) + 512 )
7528 { 7566 {
7529 result = v12 < 0; 7567 result = v12 < 0;
7530 LOBYTE(result) = v12 >= 0; 7568 LOBYTE(result) = v12 >= 0;
7531 } 7569 }
7532 else 7570 else
15449 pX = pOutdoor->pBModels[v4].vBoundingCenter.x - v19; 15487 pX = pOutdoor->pBModels[v4].vBoundingCenter.x - v19;
15450 pY = pOutdoor->pBModels[v4].vBoundingCenter.y - v20; 15488 pY = pOutdoor->pBModels[v4].vBoundingCenter.y - v20;
15451 v5 = abs((signed)pY); 15489 v5 = abs((signed)pY);
15452 v6 = abs((signed)pX); 15490 v6 = abs((signed)pX);
15453 v7 = sub_4621DA(v6, v5, v2); 15491 v7 = sub_4621DA(v6, v5, v2);
15454 v8 = pOutdoor->pBModels; 15492 v8 = &pOutdoor->pBModels[0];
15455 if ( v7 < 2 * pOutdoor->pBModels[v4].sBoundingRadius ) 15493 if ( v7 < 2 * pOutdoor->pBModels[v4].sBoundingRadius )
15456 { 15494 {
15457 v11 = __OFSUB__(pOutdoor->pBModels[v4].uNumFaces, v2); 15495 v11 = __OFSUB__(pOutdoor->pBModels[v4].uNumFaces, v2);
15458 v9 = pOutdoor->pBModels[v4].uNumFaces == v2; 15496 v9 = pOutdoor->pBModels[v4].uNumFaces == v2;
15459 v10 = ((pOutdoor->pBModels[v4].uNumFaces - v2) & 0x80000000u) != 0; 15497 v10 = ((pOutdoor->pBModels[v4].uNumFaces - v2) & 0x80000000u) != 0;
15506 int v3; // eax@3 15544 int v3; // eax@3
15507 int v4; // esi@5 15545 int v4; // esi@5
15508 int v5; // edi@6 15546 int v5; // edi@6
15509 int v6; // eax@6 15547 int v6; // eax@6
15510 int v7; // eax@6 15548 int v7; // eax@6
15511 BSPModel *v8; // ecx@6 15549 BSPModel **v8; // ecx@6
15512 unsigned __int8 v9; // zf@7 15550 unsigned __int8 v9; // zf@7
15513 unsigned __int8 v10; // sf@7 15551 unsigned __int8 v10; // sf@7
15514 ODMFace *v11; // eax@9 15552 ODMFace *v11; // eax@9
15515 __int16 v12; // cx@9 15553 __int16 v12; // cx@9
15516 const char *v13; // eax@11 15554 const char *v13; // eax@11
15545 && uCurrentlyLoadedLevelType == LEVEL_Outdoor 15583 && uCurrentlyLoadedLevelType == LEVEL_Outdoor
15546 && (v4 = 0, v20 = 0, (signed int)v16 > 0) ) 15584 && (v4 = 0, v20 = 0, (signed int)v16 > 0) )
15547 { 15585 {
15548 while ( 1 ) 15586 while ( 1 )
15549 { 15587 {
15550 pX = *(int *)((char *)&pOutdoor->pBModels->vBoundingCenter.x + v4) - v1; 15588 pX = *(int *)((char *)&pOutdoor->pBModels[v4].vBoundingCenter.x) - v1;
15551 pY = *(int *)((char *)&pOutdoor->pBModels->vBoundingCenter.y + v4) - LODWORD(v19); 15589 pY = *(int *)((char *)&pOutdoor->pBModels[v4].vBoundingCenter.y) - LODWORD(v19);
15552 v5 = abs((signed)pY); 15590 v5 = abs((signed)pY);
15553 v6 = abs((signed)pX); 15591 v6 = abs((signed)pX);
15554 v7 = sub_4621DA(v6, v5, 0); 15592 v7 = sub_4621DA(v6, v5, 0);
15555 v8 = pOutdoor->pBModels; 15593 v8 = &pOutdoor->pBModels;
15556 if ( v7 < *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v4) ) 15594 if ( v7 < *(int *)((char *)&pOutdoor->pBModels[v4].sBoundingRadius) )
15557 { 15595 {
15558 v9 = *(unsigned int *)((char *)&pOutdoor->pBModels->uNumFaces + v4) == 0; 15596 v9 = pOutdoor->pBModels[v4].uNumFaces == 0;
15559 v10 = *(signed int *)((char *)&pOutdoor->pBModels->uNumFaces + v4) < 0; 15597 v10 = pOutdoor->pBModels[v4].uNumFaces < 0;
15560 v21 = 0; 15598 v21 = 0;
15561 if ( !(v10 | v9) ) 15599 if ( !(v10 | v9) )
15562 { 15600 {
15563 v22 = 0; 15601 v22 = 0;
15564 do 15602 do
15565 { 15603 {
15566 v11 = &(*(ODMFace **)((char *)&v8->pFaces + v4))[v22 / 0x134]; 15604 v11 = &v8[v4]->pFaces[v22 / 0x134];
15567 v12 = v11->sCogTriggeredID; 15605 v12 = v11->sCogTriggeredID;
15568 if ( v12 ) 15606 if ( v12 )
15569 { 15607 {
15570 if ( !(BYTE2(v11->uAttributes) & 0x10) ) 15608 if ( !(BYTE2(v11->uAttributes) & 0x10) )
15571 { 15609 {
15577 v17 = v14; 15615 v17 = v14;
15578 } 15616 }
15579 } 15617 }
15580 } 15618 }
15581 ++v21; 15619 ++v21;
15582 v8 = pOutdoor->pBModels; 15620 v8 = &pOutdoor->pBModels;
15583 v22 += 308; 15621 v22 += 308;
15584 } 15622 }
15585 while ( v21 < *(signed int *)((char *)&pOutdoor->pBModels->uNumFaces + v4) ); 15623 while ( v21 < pOutdoor->pBModels[v4].uNumFaces );
15586 } 15624 }
15587 result = v17; 15625 result = v17;
15588 if ( v17 ) 15626 if ( v17 )
15589 break; 15627 break;
15590 } 15628 }