Mercurial > mm7
comparison mm7_3.cpp @ 87:170259c8c71f
Слияние
author | Ritor1 |
---|---|
date | Mon, 04 Feb 2013 09:17:49 +0600 |
parents | ec84db4c8f9d 1faa29fd4c2d |
children | 98cd93e14777 |
comparison
equal
deleted
inserted
replaced
86:ec84db4c8f9d | 87:170259c8c71f |
---|---|
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; |
5024 } | 5029 } |
5025 | 5030 |
5026 //----- (00476750) -------------------------------------------------------- | 5031 //----- (00476750) -------------------------------------------------------- |
5027 void __cdecl InitializeAutonotes() | 5032 void __cdecl InitializeAutonotes() |
5028 { | 5033 { |
5029 char *v0; // ebp@3 | 5034 Autonote *v0; // ebp@3 |
5030 int v1; // ebx@4 | 5035 int v1; // ebx@4 |
5031 char *v2; // esi@4 | 5036 char *v2; // esi@4 |
5032 char v3; // cl@5 | 5037 char v3; // cl@5 |
5033 int v4; // eax@5 | 5038 int v4; // eax@5 |
5034 int v5; // edi@9 | 5039 char *v5; // edi@9 |
5035 signed int v6; // [sp+0h] [bp-4h]@4 | 5040 signed int v6; // [sp+0h] [bp-4h]@4 |
5036 | 5041 |
5037 if ( pAutonoteTXT_Raw ) | 5042 if ( pAutonoteTXT_Raw ) |
5038 pAllocator->FreeChunk(pAutonoteTXT_Raw); | 5043 pAllocator->FreeChunk(pAutonoteTXT_Raw); |
5039 pAutonoteTXT_Raw = 0; | 5044 pAutonoteTXT_Raw = 0; |
5040 pAutonoteTXT_Raw = (char *)pEvents_LOD->LoadRaw("autonote.txt", 0); | 5045 pAutonoteTXT_Raw = (char *)pEvents_LOD->LoadRaw("autonote.txt", 0); |
5041 strtok(pAutonoteTXT_Raw, "\r"); | 5046 strtok(pAutonoteTXT_Raw, "\r"); |
5042 v0 = (char *)&pAutonoteTxt[0].eType; | 5047 v0 = pAutonoteTxt; |
5043 for (uint i = 0; i < 195; ++i) | 5048 for (uint i = 0; i < 195; ++i) |
5044 { | 5049 { |
5045 v1 = 0; | 5050 v1 = 0; |
5046 v2 = strtok(0, "\r") + 1; | 5051 v2 = strtok(0, "\r") + 1; |
5047 v6 = 0; | 5052 v6 = 0; |
5052 while ( v3 != 9 && v3 ) | 5057 while ( v3 != 9 && v3 ) |
5053 { | 5058 { |
5054 ++v4; | 5059 ++v4; |
5055 v3 = v2[v4]; | 5060 v3 = v2[v4]; |
5056 } | 5061 } |
5057 v5 = (int)&v2[v4]; | 5062 v5 = &v2[v4]; |
5058 if ( !v2[v4] ) | 5063 if ( !v2[v4] ) |
5059 v6 = 1; | 5064 v6 = 1; |
5060 *(char *)v5 = 0; | 5065 *v5 = 0; |
5061 if ( v4 ) | 5066 if ( v4 ) |
5062 { | 5067 { |
5063 if ( v1 == 1 ) | 5068 if ( v1 == 1 ) |
5064 { | 5069 { |
5065 *((int *)v0 - 1) = (int)RemoveQuotes(v2); | 5070 v0->pText = RemoveQuotes(v2); |
5066 } | 5071 } |
5067 else | 5072 else |
5068 { | 5073 { |
5069 if ( v1 == 2 ) | 5074 if ( v1 == 2 ) |
5070 { | 5075 { |
5073 if ( _strcmpi(v2, "stat") ) | 5078 if ( _strcmpi(v2, "stat") ) |
5074 { | 5079 { |
5075 if ( _strcmpi(v2, "seer") ) | 5080 if ( _strcmpi(v2, "seer") ) |
5076 { | 5081 { |
5077 if ( _strcmpi(v2, "obelisk") ) | 5082 if ( _strcmpi(v2, "obelisk") ) |
5078 *(int *)v0 = 5 - (_strcmpi(v2, "teacher") != 0); | 5083 v0->eType = (AUTONOTE_TYPE)(5 - (_strcmpi(v2, "teacher") != 0)); |
5079 else | 5084 else |
5080 *(int *)v0 = 2; | 5085 v0->eType = (AUTONOTE_TYPE)2; |
5081 } | 5086 } |
5082 else | 5087 else |
5083 { | 5088 { |
5084 *(int *)v0 = 3; | 5089 v0->eType = (AUTONOTE_TYPE)3; |
5085 } | 5090 } |
5086 } | 5091 } |
5087 else | 5092 else |
5088 { | 5093 { |
5089 *(int *)v0 = 1; | 5094 v0->eType = (AUTONOTE_TYPE)1; |
5090 } | 5095 } |
5091 } | 5096 } |
5092 else | 5097 else |
5093 { | 5098 { |
5094 *(int *)v0 = 0; | 5099 v0->eType = (AUTONOTE_TYPE)0; |
5095 } | 5100 } |
5096 } | 5101 } |
5097 } | 5102 } |
5098 } | 5103 } |
5099 else | 5104 else |
5100 { | 5105 { |
5101 v6 = 1; | 5106 v6 = 1; |
5102 } | 5107 } |
5103 ++v1; | 5108 ++v1; |
5104 v2 = (char *)(v5 + 1); | 5109 v2 = v5 + 1; |
5105 } | 5110 } |
5106 while ( v1 - 1 <= 2 && !v6 ); | 5111 while ( v1 - 1 <= 2 && !v6 ); |
5107 v0 += 8; | 5112 ++v0; |
5108 } | 5113 } |
5109 //while ( (signed int)v0 < (signed int)&pScrolls[1] ); | 5114 //while ( (signed int)v0 < (signed int)&pScrolls[1] ); |
5110 } | 5115 } |
5111 | 5116 |
5112 | 5117 |
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 |
15447 pX = pOutdoor->pBModels[v4].vBoundingCenter.x - v19; | 15485 pX = pOutdoor->pBModels[v4].vBoundingCenter.x - v19; |
15448 pY = pOutdoor->pBModels[v4].vBoundingCenter.y - v20; | 15486 pY = pOutdoor->pBModels[v4].vBoundingCenter.y - v20; |
15449 v5 = abs((signed)pY); | 15487 v5 = abs((signed)pY); |
15450 v6 = abs((signed)pX); | 15488 v6 = abs((signed)pX); |
15451 v7 = sub_4621DA(v6, v5, v2); | 15489 v7 = sub_4621DA(v6, v5, v2); |
15452 v8 = pOutdoor->pBModels; | 15490 v8 = &pOutdoor->pBModels[0]; |
15453 if ( v7 < 2 * pOutdoor->pBModels[v4].sBoundingRadius ) | 15491 if ( v7 < 2 * pOutdoor->pBModels[v4].sBoundingRadius ) |
15454 { | 15492 { |
15455 v11 = __OFSUB__(pOutdoor->pBModels[v4].uNumFaces, v2); | 15493 v11 = __OFSUB__(pOutdoor->pBModels[v4].uNumFaces, v2); |
15456 v9 = pOutdoor->pBModels[v4].uNumFaces == v2; | 15494 v9 = pOutdoor->pBModels[v4].uNumFaces == v2; |
15457 v10 = ((pOutdoor->pBModels[v4].uNumFaces - v2) & 0x80000000u) != 0; | 15495 v10 = ((pOutdoor->pBModels[v4].uNumFaces - v2) & 0x80000000u) != 0; |
15504 int v3; // eax@3 | 15542 int v3; // eax@3 |
15505 int v4; // esi@5 | 15543 int v4; // esi@5 |
15506 int v5; // edi@6 | 15544 int v5; // edi@6 |
15507 int v6; // eax@6 | 15545 int v6; // eax@6 |
15508 int v7; // eax@6 | 15546 int v7; // eax@6 |
15509 BSPModel *v8; // ecx@6 | 15547 BSPModel **v8; // ecx@6 |
15510 unsigned __int8 v9; // zf@7 | 15548 unsigned __int8 v9; // zf@7 |
15511 unsigned __int8 v10; // sf@7 | 15549 unsigned __int8 v10; // sf@7 |
15512 ODMFace *v11; // eax@9 | 15550 ODMFace *v11; // eax@9 |
15513 __int16 v12; // cx@9 | 15551 __int16 v12; // cx@9 |
15514 const char *v13; // eax@11 | 15552 const char *v13; // eax@11 |
15543 && uCurrentlyLoadedLevelType == LEVEL_Outdoor | 15581 && uCurrentlyLoadedLevelType == LEVEL_Outdoor |
15544 && (v4 = 0, v20 = 0, (signed int)v16 > 0) ) | 15582 && (v4 = 0, v20 = 0, (signed int)v16 > 0) ) |
15545 { | 15583 { |
15546 while ( 1 ) | 15584 while ( 1 ) |
15547 { | 15585 { |
15548 pX = *(int *)((char *)&pOutdoor->pBModels->vBoundingCenter.x + v4) - v1; | 15586 pX = *(int *)((char *)&pOutdoor->pBModels[v4].vBoundingCenter.x) - v1; |
15549 pY = *(int *)((char *)&pOutdoor->pBModels->vBoundingCenter.y + v4) - LODWORD(v19); | 15587 pY = *(int *)((char *)&pOutdoor->pBModels[v4].vBoundingCenter.y) - LODWORD(v19); |
15550 v5 = abs((signed)pY); | 15588 v5 = abs((signed)pY); |
15551 v6 = abs((signed)pX); | 15589 v6 = abs((signed)pX); |
15552 v7 = sub_4621DA(v6, v5, 0); | 15590 v7 = sub_4621DA(v6, v5, 0); |
15553 v8 = pOutdoor->pBModels; | 15591 v8 = &pOutdoor->pBModels; |
15554 if ( v7 < *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v4) ) | 15592 if ( v7 < *(int *)((char *)&pOutdoor->pBModels[v4].sBoundingRadius) ) |
15555 { | 15593 { |
15556 v9 = *(unsigned int *)((char *)&pOutdoor->pBModels->uNumFaces + v4) == 0; | 15594 v9 = pOutdoor->pBModels[v4].uNumFaces == 0; |
15557 v10 = *(signed int *)((char *)&pOutdoor->pBModels->uNumFaces + v4) < 0; | 15595 v10 = pOutdoor->pBModels[v4].uNumFaces < 0; |
15558 v21 = 0; | 15596 v21 = 0; |
15559 if ( !(v10 | v9) ) | 15597 if ( !(v10 | v9) ) |
15560 { | 15598 { |
15561 v22 = 0; | 15599 v22 = 0; |
15562 do | 15600 do |
15563 { | 15601 { |
15564 v11 = &(*(ODMFace **)((char *)&v8->pFaces + v4))[v22 / 0x134]; | 15602 v11 = &v8[v4]->pFaces[v22 / 0x134]; |
15565 v12 = v11->sCogTriggeredID; | 15603 v12 = v11->sCogTriggeredID; |
15566 if ( v12 ) | 15604 if ( v12 ) |
15567 { | 15605 { |
15568 if ( !(BYTE2(v11->uAttributes) & 0x10) ) | 15606 if ( !(BYTE2(v11->uAttributes) & 0x10) ) |
15569 { | 15607 { |
15575 v17 = v14; | 15613 v17 = v14; |
15576 } | 15614 } |
15577 } | 15615 } |
15578 } | 15616 } |
15579 ++v21; | 15617 ++v21; |
15580 v8 = pOutdoor->pBModels; | 15618 v8 = &pOutdoor->pBModels; |
15581 v22 += 308; | 15619 v22 += 308; |
15582 } | 15620 } |
15583 while ( v21 < *(signed int *)((char *)&pOutdoor->pBModels->uNumFaces + v4) ); | 15621 while ( v21 < pOutdoor->pBModels[v4].uNumFaces ); |
15584 } | 15622 } |
15585 result = v17; | 15623 result = v17; |
15586 if ( v17 ) | 15624 if ( v17 ) |
15587 break; | 15625 break; |
15588 } | 15626 } |
16202 { | 16240 { |
16203 if ( v16 == 24 ) | 16241 if ( v16 == 24 ) |
16204 { | 16242 { |
16205 v23 = v0->evtf; | 16243 v23 = v0->evtf; |
16206 LABEL_63: | 16244 LABEL_63: |
16207 v24 = (&dword_721660)[8 * v23]; | 16245 v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; |
16208 if ( !v24 ) | 16246 if ( !v24 ) |
16209 { | 16247 { |
16210 v24 = ""; | 16248 v24 = ""; |
16211 v15->uControlParam = 0; | 16249 v15->uControlParam = 0; |
16212 } | 16250 } |
17765 v90 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | 17803 v90 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); |
17766 if ( _5C3420_pDecoration ) | 17804 if ( _5C3420_pDecoration ) |
17767 { | 17805 { |
17768 if ( _5C3420_pDecoration == (LevelDecoration *)1 ) | 17806 if ( _5C3420_pDecoration == (LevelDecoration *)1 ) |
17769 { | 17807 { |
17770 ptr_F8B1E8 = (&dword_721664)[8 * v90]; | 17808 ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; |
17771 goto LABEL_291; | 17809 goto LABEL_291; |
17772 } | 17810 } |
17773 if ( a3 == 1 ) | 17811 if ( a3 == 1 ) |
17774 { | 17812 { |
17775 v91 = (&dword_721664)[8 * v90]; | 17813 v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; |
17776 LABEL_248: | 17814 LABEL_248: |
17777 ShowStatusBarString(v91, 2u); | 17815 ShowStatusBarString(v91, 2u); |
17778 goto LABEL_291; | 17816 goto LABEL_291; |
17779 } | 17817 } |
17780 } | 17818 } |
17789 goto LABEL_291; | 17827 goto LABEL_291; |
17790 case EVENT_ShowMessage: | 17828 case EVENT_ShowMessage: |
17791 v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | 17829 v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); |
17792 if ( _5C3420_pDecoration ) | 17830 if ( _5C3420_pDecoration ) |
17793 { | 17831 { |
17794 v93 = (&dword_721664)[8 * v92]; | 17832 v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; |
17795 byte_5B0938[0] = 0; | 17833 byte_5B0938[0] = 0; |
17796 ptr_F8B1E8 = v93; | 17834 ptr_F8B1E8 = v93; |
17797 } | 17835 } |
17798 else | 17836 else |
17799 { | 17837 { |
18324 void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle) | 18362 void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle) |
18325 { | 18363 { |
18326 unsigned int v3; // ebx@1 | 18364 unsigned int v3; // ebx@1 |
18327 unsigned int v4; // ebp@1 | 18365 unsigned int v4; // ebp@1 |
18328 signed int v5; // edi@1 | 18366 signed int v5; // edi@1 |
18329 char *v6; // esi@4 | 18367 Actor *v6; // esi@4 |
18330 size_t v7; // ecx@10 | 18368 size_t v7; // ecx@10 |
18331 char *v8; // eax@11 | 18369 Actor *v8; // eax@11 |
18332 unsigned __int16 v9; // dx@14 | 18370 unsigned __int16 v9; // dx@14 |
18333 | 18371 |
18334 v4 = uGroupID; | 18372 v4 = uGroupID; |
18335 v5 = Standing; | 18373 v5 = Standing; |
18336 v3 = uFlag; | 18374 v3 = uFlag; |
18338 { | 18376 { |
18339 if ( bToggle ) | 18377 if ( bToggle ) |
18340 { | 18378 { |
18341 if ( (signed int)uNumActors > Standing ) | 18379 if ( (signed int)uNumActors > Standing ) |
18342 { | 18380 { |
18343 v6 = (char *)&pActors[0].uAttributes; | 18381 v6 = pActors;//[0].uAttributes; |
18344 do | 18382 do |
18345 { | 18383 { |
18346 if ( *((_DWORD *)v6 + 168) == v4 ) | 18384 if ( v6->uGroup == v4 ) |
18347 { | 18385 { |
18348 *(_DWORD *)v6 |= v3; | 18386 v6->uAttributes |= v3; |
18349 if ( v3 == 0x10000 ) | 18387 if ( v3 == 0x10000 ) |
18350 { | 18388 { |
18351 *((_WORD *)v6 + 70) = Disabled; | 18389 v6->uAIState = Disabled; |
18352 ((Actor *)(v6 - 36))->UpdateAnimation(); | 18390 v6->UpdateAnimation(); |
18353 } | 18391 } |
18354 } | 18392 } |
18355 ++v5; | 18393 ++v5; |
18356 v6 += 836; | 18394 ++v6; |
18357 } | 18395 } |
18358 while ( v5 < (signed int)uNumActors ); | 18396 while ( v5 < (signed int)uNumActors ); |
18359 } | 18397 } |
18360 } | 18398 } |
18361 else | 18399 else |
18362 { | 18400 { |
18363 v7 = uNumActors; | 18401 v7 = uNumActors; |
18364 if ( (signed int)uNumActors > Standing ) | 18402 if ( (signed int)uNumActors > Standing ) |
18365 { | 18403 { |
18366 v8 = (char *)&pActors[0].uAIState; | 18404 v8 = pActors;//[0].uAIState; |
18367 do | 18405 do |
18368 { | 18406 { |
18369 if ( *((_DWORD *)v8 + 133) == v4 ) | 18407 if ( v8->uGroup == v4 ) |
18370 { | 18408 { |
18371 if ( v3 == 0x10000 ) | 18409 if ( v3 == 0x10000 ) |
18372 { | 18410 { |
18373 v9 = *(_WORD *)v8; | 18411 v9 = v8->uAIState; |
18374 if ( *(_WORD *)v8 != Dead ) | 18412 if ( v8->uAIState != Dead ) |
18375 { | 18413 { |
18376 if ( v9 != 4 && v9 != 11 ) | 18414 if ( v9 != 4 && v9 != 11 ) |
18377 *(_WORD *)v8 = Standing; | 18415 v8->uAIState = Standing; |
18378 } | 18416 } |
18379 } | 18417 } |
18380 *((_DWORD *)v8 - 35) &= ~v3; | 18418 LODWORD(v8->uAttributes) &= ~v3; |
18381 } | 18419 } |
18382 v8 += 836; | 18420 ++v8; |
18383 --v7; | 18421 --v7; |
18384 } | 18422 } |
18385 while ( v7 ); | 18423 while ( v7 ); |
18386 } | 18424 } |
18387 } | 18425 } |
19863 // 4F75D8: using guessed type int ai_arrays_size; | 19901 // 4F75D8: using guessed type int ai_arrays_size; |
19864 | 19902 |
19865 //----- (004016FA) -------------------------------------------------------- | 19903 //----- (004016FA) -------------------------------------------------------- |
19866 int __cdecl BLV_4016FA_AI() | 19904 int __cdecl BLV_4016FA_AI() |
19867 { | 19905 { |
19868 char *v0; // esi@2 | 19906 Actor *v0; // esi@2 |
19869 int v1; // eax@4 | 19907 int v1; // eax@4 |
19870 int v2; // ebx@4 | 19908 int v2; // ebx@4 |
19871 unsigned int v3; // ecx@4 | 19909 unsigned int v3; // ecx@4 |
19872 int v4; // edx@5 | 19910 int v4; // edx@5 |
19873 int v5; // edx@7 | 19911 int v5; // edx@7 |
19887 signed int v19; // edi@31 | 19925 signed int v19; // edi@31 |
19888 Actor *v20; // esi@32 | 19926 Actor *v20; // esi@32 |
19889 bool v21; // eax@33 | 19927 bool v21; // eax@33 |
19890 int v22; // eax@34 | 19928 int v22; // eax@34 |
19891 signed int v23; // ebx@36 | 19929 signed int v23; // ebx@36 |
19892 char *v24; // esi@37 | 19930 Actor *v24; // esi@37 |
19893 signed int v25; // eax@40 | 19931 signed int v25; // eax@40 |
19894 int v26; // eax@43 | 19932 int v26; // eax@43 |
19895 int v27; // ebx@45 | 19933 int v27; // ebx@45 |
19896 int j; // edi@45 | 19934 int j; // edi@45 |
19897 unsigned int v29; // eax@46 | 19935 unsigned int v29; // eax@46 |
19915 v37 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); | 19953 v37 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); |
19916 v45 = 0; | 19954 v45 = 0; |
19917 v43 = 0; | 19955 v43 = 0; |
19918 if ( (signed int)uNumActors > 0 ) | 19956 if ( (signed int)uNumActors > 0 ) |
19919 { | 19957 { |
19920 v0 = (char *)&pActors[0].uAttributes; | 19958 v0 = pActors;//[0].uAttributes; |
19921 do | 19959 do |
19922 { | 19960 { |
19923 v0[1] &= 0xFBu; | 19961 BYTE1(v0->uAttributes) &= 0xFBu; |
19924 if ( ! ((Actor *)(v0 - 36))->CanAct() ) | 19962 if ( ! v0->CanAct() ) |
19925 goto LABEL_60; | 19963 goto LABEL_60; |
19926 v39 = abs(pParty->vPosition.z - *((short *)v0 + 55)); | 19964 v39 = abs(pParty->vPosition.z - v0->vPosition.z); |
19927 v38 = abs(pParty->vPosition.y - *((short *)v0 + 54)); | 19965 v38 = abs(pParty->vPosition.y - v0->vPosition.y); |
19928 v1 = abs(pParty->vPosition.x - *((short *)v0 + 53)); | 19966 v1 = abs(pParty->vPosition.x - v0->vPosition.x); |
19929 v2 = v38; | 19967 v2 = v38; |
19930 v3 = v39; | 19968 v3 = v39; |
19931 if ( v1 < v38 ) | 19969 if ( v1 < v38 ) |
19932 { | 19970 { |
19933 v4 = v1; | 19971 v4 = v1; |
19945 v6 = v3; | 19983 v6 = v3; |
19946 v3 = v2; | 19984 v3 = v2; |
19947 v2 = v6; | 19985 v2 = v6; |
19948 } | 19986 } |
19949 v7 = ((unsigned int)(11 * v2) >> 5) + (v3 >> 2) + v1; | 19987 v7 = ((unsigned int)(11 * v2) >> 5) + (v3 >> 2) + v1; |
19950 v8 = *((short *)v0 + 50); | 19988 v8 = v0->uActorRadius; |
19951 v9 = v7 - v8; | 19989 v9 = v7 - v8; |
19952 v40 = v7 - v8; | 19990 v40 = v7 - v8; |
19953 if ( v40 < 0 ) | 19991 if ( v40 < 0 ) |
19954 { | 19992 { |
19955 v9 = 0; | 19993 v9 = 0; |
19956 v40 = 0; | 19994 v40 = 0; |
19957 } | 19995 } |
19958 if ( v9 < 10240 ) | 19996 if ( v9 < 10240 ) |
19959 { | 19997 { |
19960 v10 = *(int *)v0 & 0xFEFFFFFF; | 19998 v10 = v0->uAttributes & 0xFEFFFFFF; |
19961 *(int *)v0 = v10; | 19999 v0->uAttributes = v10; |
19962 if ( v10 & 0x80000 || ((Actor *)(v0 - 36))->GetActorsRelation(0) ) | 20000 if ( v10 & 0x80000 || v0->GetActorsRelation(0) ) |
19963 { | 20001 { |
19964 v11 = (pParty->uFlags & 0x10) == 0; | 20002 v11 = (pParty->uFlags & 0x10) == 0; |
19965 *(int *)v0 = v10 | 0x1000000; | 20003 v0->uAttributes = v10 | 0x1000000; |
19966 if ( v11 && (double)v40 < 307.2 ) | 20004 if ( v11 && (double)v40 < 307.2 ) |
19967 pParty->uFlags |= 0x10u; | 20005 pParty->uFlags |= 0x10u; |
19968 if ( !(pParty->uFlags & 0x20) && v9 < 5120 ) | 20006 if ( !(pParty->uFlags & 0x20) && v9 < 5120 ) |
19969 pParty->uFlags |= 0x20u; | 20007 pParty->uFlags |= 0x20u; |
19970 } | 20008 } |
19973 ai_array_4F7DB0_actor_ids[v12] = v43; | 20011 ai_array_4F7DB0_actor_ids[v12] = v43; |
19974 } | 20012 } |
19975 else | 20013 else |
19976 { | 20014 { |
19977 LABEL_60: | 20015 LABEL_60: |
19978 v0[1] &= 0xBFu; | 20016 BYTE1(v0->uAttributes) &= 0xBFu; |
19979 } | 20017 } |
19980 ++v43; | 20018 ++v43; |
19981 v0 += 836; | 20019 ++v0; |
19982 } | 20020 } |
19983 while ( v43 < (signed int)uNumActors ); | 20021 while ( v43 < (signed int)uNumActors ); |
19984 } | 20022 } |
19985 v13 = 0; | 20023 v13 = 0; |
19986 if ( v45 > 0 ) | 20024 if ( v45 > 0 ) |
20032 } | 20070 } |
20033 v23 = 0; | 20071 v23 = 0; |
20034 ai_arrays_size = v19; | 20072 ai_arrays_size = v19; |
20035 if ( (signed int)uNumActors > 0 ) | 20073 if ( (signed int)uNumActors > 0 ) |
20036 { | 20074 { |
20037 v24 = (char *)&pActors[0].uAttributes; | 20075 v24 = pActors;//[0].uAttributes; |
20038 do | 20076 do |
20039 { | 20077 { |
20040 if ( ((Actor *)(v24 - 36))->CanAct() && *((short *)v24 + 61) == v37 ) | 20078 if ( v24->CanAct() && v24->uSectorID == v37 ) |
20041 { | 20079 { |
20042 v25 = 0; | 20080 v25 = 0; |
20043 if ( v19 <= 0 ) | 20081 if ( v19 <= 0 ) |
20044 { | 20082 { |
20045 LABEL_43: | 20083 LABEL_43: |
20046 v26 = ai_arrays_size; | 20084 v26 = ai_arrays_size; |
20047 v24[1] |= 0x40u; | 20085 BYTE1(v24->uAttributes) |= 0x40u; |
20048 ++ai_arrays_size; | 20086 ++ai_arrays_size; |
20049 ai_array_4F6638_actor_ids[v26] = v23; | 20087 ai_array_4F6638_actor_ids[v26] = v23; |
20050 } | 20088 } |
20051 else | 20089 else |
20052 { | 20090 { |
20057 goto LABEL_43; | 20095 goto LABEL_43; |
20058 } | 20096 } |
20059 } | 20097 } |
20060 } | 20098 } |
20061 ++v23; | 20099 ++v23; |
20062 v24 += 836; | 20100 ++v24; |
20063 } | 20101 } |
20064 while ( v23 < (signed int)uNumActors ); | 20102 while ( v23 < (signed int)uNumActors ); |
20065 } | 20103 } |
20066 v27 = ai_arrays_size; | 20104 v27 = ai_arrays_size; |
20067 for ( j = 0; j < v45; ++j ) | 20105 for ( j = 0; j < v45; ++j ) |
20118 unsigned int v0; // esi@4 | 20156 unsigned int v0; // esi@4 |
20119 int v1; // eax@7 | 20157 int v1; // eax@7 |
20120 int v2; // ecx@7 | 20158 int v2; // ecx@7 |
20121 int v3; // eax@7 | 20159 int v3; // eax@7 |
20122 signed int v4; // edi@10 | 20160 signed int v4; // edi@10 |
20123 char *v5; // esi@12 | 20161 Actor *v5; // esi@12 |
20124 signed int v6; // eax@14 | 20162 signed int v6; // eax@14 |
20125 __int16 v7; // cx@14 | 20163 __int16 v7; // cx@14 |
20126 Player **v8; // esi@20 | 20164 Player **v8; // esi@20 |
20127 Player *pPlayer; // ecx@21 | 20165 Player *pPlayer; // ecx@21 |
20128 Actor *pActor; // esi@34 | 20166 Actor *pActor; // esi@34 |
20229 { | 20267 { |
20230 pParty->field_1613C = 0; | 20268 pParty->field_1613C = 0; |
20231 v84 = 0; | 20269 v84 = 0; |
20232 if ( (signed int)uNumActors > 0 ) | 20270 if ( (signed int)uNumActors > 0 ) |
20233 { | 20271 { |
20234 v5 = (char *)&pActors[0].sCurrentHP; | 20272 v5 = pActors;//[0].sCurrentHP; |
20235 do | 20273 do |
20236 { | 20274 { |
20237 if ( ((Actor *)(v5 - 40))->CanAct() ) | 20275 if ( v5->CanAct() ) |
20238 { | 20276 { |
20239 v6 = stru_50C198.CalcMagicalDamageToActor((Actor *)(v5 - 40), 5, v4); | 20277 v6 = stru_50C198.CalcMagicalDamageToActor(v5, 5, v4); |
20240 v7 = *(short *)v5 - v6; | 20278 v7 = v5->sCurrentHP - v6; |
20241 *(short *)v5 = v7; | 20279 v5->sCurrentHP = v7; |
20242 if ( v6 ) | 20280 if ( v6 ) |
20243 { | 20281 { |
20244 if ( v7 >= 0 ) | 20282 if ( v7 >= 0 ) |
20245 { | 20283 { |
20246 Actor::_4030AD(v84, 4, 0); | 20284 Actor::_4030AD(v84, 4, 0); |
20247 } | 20285 } |
20248 else | 20286 else |
20249 { | 20287 { |
20250 Actor::Die(v84); | 20288 Actor::Die(v84); |
20251 if ( *((int *)v5 + 19) ) | 20289 if ( v5->pMonsterInfo.uExp ) |
20252 sub_4269A2_GivePartyExp(pMonsterStats->pInfos[*((short *)v5 + 28)].uExp); | 20290 sub_4269A2_GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp); |
20253 } | 20291 } |
20254 } | 20292 } |
20255 } | 20293 } |
20256 ++v84; | 20294 ++v84; |
20257 v5 += 836; | 20295 ++v5; |
20258 } | 20296 } |
20259 while ( (signed int)v84 < (signed int)uNumActors ); | 20297 while ( (signed int)v84 < (signed int)uNumActors ); |
20260 } | 20298 } |
20261 v8 = &pPlayers[1]; | 20299 v8 = &pPlayers[1]; |
20262 do | 20300 do |