Mercurial > mm7
changeset 79:6ad816231528
structure fixes, death crash fix
author | zipi |
---|---|
date | Sat, 02 Feb 2013 16:52:36 +0000 |
parents | d56c13146285 |
children | 48f69ae3bc8d |
files | Outdoor.cpp SaveLoad.cpp Vis.cpp mm7_3.cpp mm7_6.cpp mm7_data.h |
diffstat | 6 files changed, 185 insertions(+), 133 deletions(-) [+] |
line wrap: on
line diff
--- a/Outdoor.cpp Tue Jan 29 07:51:31 2013 +0600 +++ b/Outdoor.cpp Sat Feb 02 16:52:36 2013 +0000 @@ -1772,7 +1772,7 @@ for (uint i = 0; i < uNumBModels; ++i) { //v48 = 0; - auto model = pBModels + i; + BSPModel *model = (BSPModel *)pBModels+i; model->pVertices.pVertices = nullptr; model->pFaces = nullptr; @@ -1856,7 +1856,7 @@ //v149 = 0; //Str2 = (char *)ptr; - auto face = model->pFaces + j; + ODMFace *face = (ODMFace *)model->pFaces+j; //pFilename = (char *)v149 + (unsigned int)v60[v48].pFaces; if (~face->uAttributes & 0x40) { @@ -2042,7 +2042,7 @@ //v77 = actualNumFacesInLevel = 0; uint actualNumFacesInLevel = 0; for (uint i = 0; i < uNumBModels; ++i) - actualNumFacesInLevel += pBModels[i].uNumFaces; + actualNumFacesInLevel += ((BSPModel *)pBModels+i)->uNumFaces; //v79 = ddm.uNumFacesInBModels; if (ddm.uNumFacesInBModels) @@ -2130,16 +2130,16 @@ //v151 = 0; for (uint i = 0; i < uNumBModels; ++i) { - auto model = pBModels + i; + auto model = pBModels[i]; //pNumItems = 0; //do //{ //v86 = pBModels; //thisa = 0; //v87 = (unsigned int)((char *)v86 + pNumItems); - for (uint j = 0; j < model->uNumFaces; ++j) + for (uint j = 0; j < model.uNumFaces; ++j) { - auto face = model->pFaces + j; + auto face = model.pFaces[j]; //if ( *(int *)(v87 + 76) > 0 ) //{ @@ -2147,7 +2147,7 @@ //do //{ //v106 = (char *)&File->uAttributes + *(int *)(v87 + 84); - memcpy(&face->uAttributes, pSrc, 4); + memcpy(&face.uAttributes, pSrc, 4); pSrc += 4; //v88 = pBModels; //++File; @@ -2160,20 +2160,20 @@ //v89 = pBModels; //thisa = 0; - for (uint j = 0; j < model->uNumFaces; ++j) + for (uint j = 0; j < model.uNumFaces; ++j) { - auto face = model->pFaces + j; + auto face = model.pFaces[j]; //pFilename = 0; //do //{ //v90 = (ODMFace *)&pFilename[*(unsigned int *)((char *)&v89->pFaces + pNumItems)]; //File = v90; - if (face->sCogTriggeredID) + if (face.sCogTriggeredID) { - if (face->HasEventHint()) - BYTE2(face->uAttributes) |= 0x10u; + if (face.HasEventHint()) + BYTE2(face.uAttributes) |= 0x10u; else - BYTE2(face->uAttributes) &= 0xEFu; + BYTE2(face.uAttributes) &= 0xEFu; } //++thisa; //v89 = pBModels;
--- a/SaveLoad.cpp Tue Jan 29 07:51:31 2013 +0600 +++ b/SaveLoad.cpp Sat Feb 02 16:52:36 2013 +0000 @@ -247,7 +247,7 @@ int v17; // esi@37 unsigned int v18; // ecx@38 unsigned int v19; // esi@39 - char *v20; // edx@39 + BSPModel *v20; // edx@39 void *v21; // esi@41 void *v22; // esi@41 BSPModel *v23; // eax@42 @@ -265,16 +265,16 @@ //std::string v35; // [sp-18h] [bp-288h]@8 const char *v36; // [sp-10h] [bp-280h]@6 const char *v37; // [sp-Ch] [bp-27Ch]@6 - const char *v38; // [sp-8h] [bp-278h]@8 + unsigned int *v38; // [sp-8h] [bp-278h]@8 CHAR Buffer; // [sp+Ch] [bp-264h]@59 - char Dir; // [sp+8Ch] [bp-1E4h]@51 - char Drive; // [sp+ACh] [bp-1C4h]@51 + char Dir[255]; // [sp+8Ch] [bp-1E4h]@51 + char Drive[255]; // [sp+ACh] [bp-1C4h]@51 SavegameHeader header; // [sp+CCh] [bp-1A4h]@10 //int v43; // [sp+CCh] [bp-1A4h]@10 //char Dest[20]; // [sp+E0h] [bp-190h]@10 //unsigned __int64 pTimePlayed; // [sp+F4h] [bp-17Ch]@10 - char Filename; // [sp+130h] [bp-140h]@51 - char Ext; // [sp+150h] [bp-120h]@51 + char Filename[255]; // [sp+130h] [bp-140h]@51 + char Ext[255]; // [sp+150h] [bp-120h]@51 char v48; // [sp+151h] [bp-11Fh]@51 char Source[32]; // [sp+170h] [bp-100h]@51 char Str[120]; // [sp+190h] [bp-E0h]@8 @@ -419,7 +419,7 @@ } if ( !a2 ) { - __debugbreak(); + //__debugbreak(); sub_42FA22_mess_with_laying_item_list(); v9 = (int)malloc(0xF4240); v71 = (std::string *)v9; @@ -446,7 +446,7 @@ v68 = 0; for (int i = 0; i <= (signed int)pIndoor->uNumFaces; ++i) { - v38 = (char *)v68 + (unsigned int)pIndoor->pFaces + 44; + v38 = &pIndoor->pFaces[i].uAttributes;//(char *)v68 + (unsigned int)pIndoor->pFaces + 44; memcpy(v11, v38, 4); v68 += 48; v11 = (char *)v11 + 4; @@ -489,11 +489,11 @@ if ( (signed int)pOutdoor->uNumBModels > 0 ) { v19 = pOutdoor->uNumBModels; - v20 = (char *)&pOutdoor->pBModels->uNumFaces; + v20 = &pOutdoor->pBModels[0]; do { - v18 += *(int *)v20; - v20 += 188; + v18 += v20->uNumFaces; + ++v20; --v19; pOutdoor->ddm.uNumFacesInBModels = v18; } @@ -512,16 +512,16 @@ { v23 = pOutdoor->pBModels; v24 = 76; - for (int i = 0; i <= (signed int)pOutdoor->uNumBModels ; ++i) + for (int i = 0; i < (signed int)pOutdoor->uNumBModels ; ++i) { - v25 = *(int *)&v23->pModelName[v24] == 0; - v26 = *(int *)&v23->pModelName[v24] < 0; + v25 = v23[i].uNumFaces == 0;//*(int *)&v23->pModelName[v24] == 0; + v26 = v23[i].uNumFaces < 0;//*(int *)&v23->pModelName[v24] < 0; if ( !(v26 | v25) ) { v68 = 0; - for (int j = 0; j <= *(int *)&pOutdoor->pBModels->pModelName[v24]; ++j) + for (int j = 0; j < pOutdoor->pBModels[i].uNumFaces;++j)//*(int *)&pOutdoor->pBModels->pModelName[v24]; ++j) { - v38 = (char *)v68 + *(int *)&v23->pModelName[v24 + 8] + 28; + v38 = &(v23[i].pFaces[j].uAttributes); //(char *)v68 + *(int *)&v23->pModelName[v24 + 8] + 28; memcpy(v22, v38, 4); v23 = pOutdoor->pBModels; v68 += 154; @@ -560,7 +560,7 @@ } v32 = v17 + 56; strcpy(Source, pCurrentMapName); - _splitpath(Source, &Drive, &Dir, &Filename, &Ext); + _splitpath(Source, Drive, Dir, Filename, Ext); v48 = 100; Size = v32 - (int)DstBuf; v69 = 999984;
--- a/Vis.cpp Tue Jan 29 07:51:31 2013 +0600 +++ b/Vis.cpp Sat Feb 02 16:52:36 2013 +0000 @@ -990,14 +990,18 @@ { v12 = a1a; a3[2 * a1a] = a6->pXInterceptDisplacements[a1a] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] + 12 * a6->pVertexIDs[a1a]); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] + 12 * a6->pVertexIDs[a1a]); + + pOutdoor->pBModels[v11].pVertices.pVertices[a6->pVertexIDs[a1a]].x; *(a5a - 1) = a6->pYInterceptDisplacements[v12] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] + 12 * a6->pVertexIDs[v12] + 4); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] + 12 * a6->pVertexIDs[v12] + 4); + + pOutdoor->pBModels[v11].pVertices.pVertices[a6->pVertexIDs[v12]].y; *(__int16 *)((char *)a5a + (int)(char *)a3 - (char *)a4) = a6->pXInterceptDisplacements[v12 + 1] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] - + 12 * a6->pVertexIDs[v12 + 1]); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] +// + 12 * a6->pVertexIDs[v12 + 1]); + + pOutdoor->pBModels[v11].pVertices.pVertices[a6->pVertexIDs[v12+1]].x; v13 = a6->pYInterceptDisplacements[v12 + 1] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] + 12 * a6->pVertexIDs[v12 + 1] + 4); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] + 12 * a6->pVertexIDs[v12 + 1] + 4); + + pOutdoor->pBModels[v11].pVertices.pVertices[a6->pVertexIDs[v12 + 1]].y; v14 = a5a; ++a1a; a5a += 2; @@ -1020,14 +1024,18 @@ { v16 = a1a; a3[2 * a1a] = a6->pXInterceptDisplacements[a1a] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] + 12 * a6->pVertexIDs[a1a]); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] + 12 * a6->pVertexIDs[a1a]); + + pOutdoor->pBModels[v15].pVertices.pVertices[a6->pVertexIDs[a1a]].x; *(a5b - 1) = a6->pZInterceptDisplacements[v16] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] + 12 * a6->pVertexIDs[v16] + 8); - *(__int16 *)((char *)a5b + (int)a3 - (int)a4) = a6->pXInterceptDisplacements[v16 + 1] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] - + 12 * a6->pVertexIDs[v16 + 1]); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] + 12 * a6->pVertexIDs[v16] + 8); + + pOutdoor->pBModels[v15].pVertices.pVertices[a6->pVertexIDs[v16]].y; + *(__int16 *)((char *)a5b + (int)a3 - (int)a4) = a6->pXInterceptDisplacements[v16 + 1] +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] +// + 12 * a6->pVertexIDs[v16 + 1]); + + pOutdoor->pBModels[v15].pVertices.pVertices[a6->pVertexIDs[v16+1]].x; v17 = a6->pZInterceptDisplacements[v16 + 1] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] + 12 * a6->pVertexIDs[v16 + 1] + 8); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] + 12 * a6->pVertexIDs[v16 + 1] + 8); + + pOutdoor->pBModels[v15].pVertices.pVertices[a6->pVertexIDs[v16+1]].z; v18 = a5b; ++a1a; a5b += 2; @@ -1048,15 +1056,19 @@ { v20 = a1a; a3[2 * a1a] = a6->pYInterceptDisplacements[a1a] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] + 12 * a6->pVertexIDs[a1a] + 4); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] + 12 * a6->pVertexIDs[a1a] + 4); + + pOutdoor->pBModels[v19].pVertices.pVertices[a6->pVertexIDs[a1a]].y; *(a5c - 1) = a6->pZInterceptDisplacements[v20] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] + 12 * a6->pVertexIDs[v20] + 8); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] + 12 * a6->pVertexIDs[v20] + 8); + + pOutdoor->pBModels[v19].pVertices.pVertices[a6->pVertexIDs[a1a]].z; *(__int16 *)((char *)a5c + (int)(char *)a3 - (char *)a4) = a6->pYInterceptDisplacements[v20 + 1] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] - + 12 * a6->pVertexIDs[v20 + 1] - + 4); - v21 = a6->pZInterceptDisplacements[v20 + 1] - + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] + 12 * a6->pVertexIDs[v20 + 1] + 8); +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] +// + 12 * a6->pVertexIDs[v20 + 1] +// + 4); + + pOutdoor->pBModels[v19].pVertices.pVertices[a6->pVertexIDs[v20+1]].y; + v21 = a6->pZInterceptDisplacements[v20 + 1] +// + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] + 12 * a6->pVertexIDs[v20 + 1] + 8); + + pOutdoor->pBModels[v19].pVertices.pVertices[a6->pVertexIDs[v20+1]].z; v22 = a5c; ++a1a; a5c += 2;
--- a/mm7_3.cpp Tue Jan 29 07:51:31 2013 +0600 +++ b/mm7_3.cpp Sat Feb 02 16:52:36 2013 +0000 @@ -3228,12 +3228,17 @@ { if ( v108 >> 6 < pOutdoor->uNumBModels ) { - v7 = (ODMFace *)&pOutdoor->pBModels[v108 >> 6].pFaces; + v7 = pOutdoor->pBModels[v108 >> 6].pFaces; v6 = v108 & 0x3F; - if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 ) + /*if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 ) { pParty->field_6F4_packedid = 8 * v108 | OBJECT_BModel; v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292); + }*/ + if ( BYTE3(v7[v6].uAttributes) & 4 ) + { + pParty->field_6F4_packedid = 8 * v108 | OBJECT_BModel; + v103 = v7[v6].sCogTriggeredID; } } } @@ -3774,7 +3779,7 @@ pParty->bFlying = 0; v46 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; v127 = v46; - v47 = &v46->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F]; + v47 = &v46->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F]; v48 = v47->pBoundingBox.z2 - v47->pBoundingBox.z1; v51 = __OFSUB__(v48, 32); v49 = v48 == 32; @@ -6676,10 +6681,10 @@ { IndoorCameraD3D *v0; // eax@3 char result; // al@3 - Vec3_int_ **v2; // ebx@4 - Vec3_int_ *v3; // eax@6 + BSPModel *v2; // ebx@4 + int v3; // eax@6 ODMFace *pFace; // esi@6 - int v5; // ecx@8 + Vec3_int_ *v5; // ecx@8 int v6; // eax@8 stru148 *v7; // ebx@8 LightmapBuilder *v8; // eax@8 @@ -6693,11 +6698,13 @@ unsigned int v16; // edi@22 int v17; // eax@24 int v18; // edi@34 - char *v19; // eax@35 - char *v20; // ecx@35 + RenderVertexSoft *v19; // eax@35 + unsigned short *v20; // ecx@35 + unsigned short *v20b; // ecx@35 + unsigned short *v20c; // ecx@35 Vec3_int_ *v21; // edx@36 int v22; // edx@36 - char *v23; // edi@37 + RenderVertexSoft *v23; // edi@37 int v24; // eax@50 int v25; // ecx@55 int v26; // eax@57 @@ -6716,7 +6723,8 @@ LightmapBuilder *v39; // [sp-8h] [bp-60h]@2 int v40; // [sp-4h] [bp-5Ch]@2 std::string *v41; // [sp+Ch] [bp-4Ch]@2 - Vec3_int_ *v42; // [sp+10h] [bp-48h]@6 + int v41b; + int v42; // [sp+10h] [bp-48h]@6 LightmapBuilder *pLightmapBuilder; // [sp+14h] [bp-44h]@8 float v44; // [sp+18h] [bp-40h]@10 float v45; // [sp+1Ch] [bp-3Ch]@10 @@ -6730,7 +6738,7 @@ int v53; // [sp+3Ch] [bp-1Ch]@8 Vec3_int_ *v54; // [sp+40h] [bp-18h]@6 int a1; // [sp+44h] [bp-14h]@3 - Vec3_int_ **v56; // [sp+48h] [bp-10h]@4 + BSPModel *v56; // [sp+48h] [bp-10h]@4 int uNumVertices; // [sp+4Ch] [bp-Ch]@34 int unused; // [sp+50h] [bp-8h]@3 int a3; // [sp+57h] [bp-1h]@2 @@ -6744,41 +6752,43 @@ a1 = 0; v47 = v0; result = LOBYTE(pOutdoor->pBModels); - v41 = (std::string *)pOutdoor->uNumBModels; + v41b = pOutdoor->uNumBModels; if ( (signed int)pOutdoor->uNumBModels > 0 ) { - v2 = (Vec3_int_ **)&pOutdoor->pBModels->uNumFaces; - v56 = (Vec3_int_ **)&pOutdoor->pBModels->uNumFaces; + v2 = pOutdoor->pBModels; + v56 = pOutdoor->pBModels; while ( 1 ) { if ( IsBModelVisible(a1, &unused) ) { - *(v2 - 3) = (Vec3_int_ *)((unsigned int)*(v2 - 3) | 1); - v3 = *v2; - pFace = (ODMFace *)v2[2]; + v2->field_40 |= 1u; + v3 = v2->uNumFaces; + pFace = v2->pFaces; v54 = 0; v46 = pFace; v42 = v3; - if ( (signed int)v3 > 0 ) + if ( v3 > 0 ) break; } LABEL_86: ++a1; - v2 += 47; + ++v2;// += 47; result = a1; v56 = v2; - if ( a1 >= (signed int)v41 ) + if ( a1 >= v41b ) return result; } while ( 1 ) { if (pFace->Invisible()) goto LABEL_85; - v5 = (int)*(v2 - 1); + //v5 = (int)*(v2 - 1); + v5 = v2->pVertices.pVertices; v6 = pFace->pVertexIDs[0]; v53 = 0; v7 = &array_77EC08[pOutdoorCamera->numStru148s]; - v8 = *(LightmapBuilder **)(v5 + 12 * v6 + 8); + //v8 = *(LightmapBuilder **)(v5 + 12 * v6 + 8); + v8 = (LightmapBuilder *)v5[v6].z; *(int *)&v7->flags = 0; pLightmapBuilder = v8; v9 = pFace->uTextureID; @@ -6865,12 +6875,16 @@ uNumVertices = v18; if ( v18 > 0 ) { - v19 = (char *)&array_73D150[0].vWorldPosition.z; - v20 = (char *)pFace->pTextureUIDs; + //v19 = (char *)&array_73D150[0].vWorldPosition.z; + //v20 = (char *)pFace->pTextureUIDs; + v19 = array_73D150; + v20 = pFace->pTextureUIDs; + v20b = pFace->pVertexIDs; + v20c = pFace->pTextureVIDs; v51 = v18; do { - v21 = &(*(v56 - 1))[*((short *)v20 - 20)]; +/* v21 = &(*(v56 - 1))[*((short *)v20 - 20)]; *((float *)v19 - 2) = (double)v21->x; *((float *)v19 - 1) = (double)v21->y; *(float *)v19 = (double)v21->z; @@ -6881,29 +6895,52 @@ v20 += 2; v10 = v51-- == 1; v52 = v22; - *((float *)v19 - 4) = (double)v22 * v44; + *((float *)v19 - 4) = (double)v22 * v44;*/ + + //v21 = (BSPVertexBuffer *)(*((_DWORD *)v56 - 1) + 12 * *(v20 - 20)); + v21 = &v56->pVertices.pVertices[*v20b]; + //*((float *)v19 - 2) = (double)v21->x; + //*((float *)v19 - 1) = (double)v21->y; + v19->vWorldPosition.x = (double)v21->x; + v19->vWorldPosition.y = (double)v21->y; + v19->vWorldPosition.z = (double)v21->z; + ++v19; + v52 = v7->sTextureDeltaU + (signed __int16)*v20; + //*((float *)v19 - 5) = (double)v52 * v45; + (v19-1)->u = (double)v52 * v45; + v22 = v7->sTextureDeltaV + (signed __int16)*v20c; + ++v20; + ++v20b; + ++v20c; + v10 = v51-- == 1; + v52 = v22; + //*((float *)v19 - 4) = (double)v22 * v44; + (v19-1)->v = (double)v22 * v44; } while ( !v10 ); - v23 = (char *)&array_73D150[0].vWorldViewPosition; + //v23 = (char *)&array_73D150[0].vWorldViewPosition; + v23 = array_73D150; v51 = uNumVertices; *(float *)&pLightmapBuilder = (double)(signed int)pLightmapBuilder; do { - if ( *(float *)&pLightmapBuilder == *((float *)v23 - 1) ) + //if ( *(float *)&pLightmapBuilder == *((float *)v23 - 1) ) + if ( *(float *)&pLightmapBuilder == v23->vWorldPosition.z ) ++v53; - v47->ViewTransform((RenderVertexSoft *)(v23 - 12), 1u); - if ( *(float *)v23 < 8.0 || (double)pOutdoorCamera->shading_dist_mist < *(float *)v23 ) - { - if ( *(float *)v23 >= 8.0 ) + //v47->ViewTransform((RenderVertexSoft *)(v23 - 12), 1u); + v47->ViewTransform(v23, 1u); + if ( v23->vWorldViewPosition.x < 8.0 || (double)pOutdoorCamera->shading_dist_mist < v23->vWorldViewPosition.x ) + { + if ( v23->vWorldViewPosition.x >= 8.0 ) v49 = 1; else v50 = 1; } else { - v47->Project((RenderVertexSoft *)(v23 - 12), 1u, 0); - } - v23 += 48; + v47->Project(v23, 1u, 0); + } + ++v23;// += 48; --v51; } while ( v51 ); @@ -7061,9 +7098,9 @@ BSPModel *Render::DrawBuildingsSW() { BSPModel *result; // eax@1 - unsigned int *v1; // ebx@2 + BSPModel *v1; // ebx@2 int v2; // eax@4 - int v3; // edi@4 + ODMFace *v3; // edi@4 int v4; // ecx@6 int v5; // eax@6 int v6; // ecx@6 @@ -7090,7 +7127,7 @@ signed int v27; // ecx@43 double v28; // st6@43 double v29; // st5@43 - int v30; // edx@44 + unsigned short *v30; // edx@44 int v31; // eax@44 double v32; // st4@45 int v33; // ecx@45 @@ -7136,12 +7173,12 @@ int v73; // [sp+8Ch] [bp-34h]@57 int v74; // [sp+90h] [bp-30h]@6 int v75; // [sp+94h] [bp-2Ch]@6 - int v76; // [sp+98h] [bp-28h]@4 + ODMFace *v76; // [sp+98h] [bp-28h]@4 int v77; // [sp+9Ch] [bp-24h]@6 - unsigned int *v78; // [sp+A0h] [bp-20h]@2 + BSPModel *v78; // [sp+A0h] [bp-20h]@2 int v79; // [sp+A4h] [bp-1Ch]@4 int a1; // [sp+A8h] [bp-18h]@1 - int v81; // [sp+ACh] [bp-14h]@7 + unsigned short *v81; // [sp+ACh] [bp-14h]@7 int v82; // [sp+B0h] [bp-10h]@6 int v83; // [sp+B4h] [bp-Ch]@6 signed int v84; // [sp+B8h] [bp-8h]@7 @@ -7149,20 +7186,20 @@ a2 = 0; a1 = 0; - result = pOutdoor->pBModels; + result = (BSPModel *)pOutdoor->pBModels; v66 = pOutdoor->uNumBModels; if ( (signed int)pOutdoor->uNumBModels > 0 ) { - v1 = &pOutdoor->pBModels->uNumFaces; - v78 = &pOutdoor->pBModels->uNumFaces; + v1 = pOutdoor->pBModels; + v78 = pOutdoor->pBModels; while ( 1 ) { if ( IsBModelVisible(a1, &a2) ) { - *(v1 - 3) |= 1u; - v2 = *v1; - v3 = v1[2]; - v79 = 0; + v1->field_40 |= 1u; + v2 = v1->uNumFaces; + v3 = (ODMFace *)v1->pFaces; + v74 = 0; v76 = v3; v68 = v2; if ( v2 > 0 ) @@ -7170,7 +7207,7 @@ } LABEL_73: ++a1; - v1 += 47; + ++v1; result = (BSPModel *)a1; v78 = v1; if ( a1 >= v66 ) @@ -7178,23 +7215,23 @@ } while ( 1 ) { - if ( !(*(char *)(v3 + 29) & 0x20) ) - { - v4 = 3 * *(short *)(v3 + 32); - v5 = (int)(v1 - 2); - v67 = (int)(v1 - 2); - v6 = *(int *)(*(v1 - 1) + 4 * v4 + 8) + 4; + if ( !v3->Invisible() ) + { + v4 = 3 * v3->pVertexIDs[0]; + v5 = (int)((char *)v1 - 8); + v67 = (int)((char *)v1 - 8); + v6 = *(_DWORD *)(*(&v1->uNumConvexFaces - 2) + 4 * v4 + 8) + 4; v82 = 0; v83 = v6; v74 = 0; - v7 = *(char *)(v3 + 302); + v7 = v3->uNumVertices; v75 = 0; v77 = v7; if ( v7 > 0 ) { v8 = (double)v83; v9 = (char *)&array_73D150[0].vWorldViewPosition; - v81 = v3 + 32; + v81 = v3->pVertexIDs; v83 = v7; *(float *)&v84 = v8; while ( 1 ) @@ -7239,9 +7276,9 @@ v82 = -pOutdoor->vSunlight.y; v84 = *(int *)(v3 + 4); v82 = (unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.y) >> 16; - v81 = -pOutdoor->vSunlight.z; + v81 = (unsigned __int16 *)-pOutdoor->vSunlight.z; v84 = *(int *)(v3 + 8); - v81 = (unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.z) >> 16; + v81 = (unsigned __int16 *)((unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.z) >> 16); v84 = v83 + v82 + ((unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.z) >> 16); v13 = (double)v84 * 0.000015258789; if ( v13 < 0.0 ) @@ -7315,7 +7352,7 @@ v29 = 1.0 / (double)v84; if ( v77 > 0 ) { - v30 = v3 + 112; + v30 = v3->pTextureVIDs; v31 = 0; v83 = v77; do @@ -7524,7 +7561,8 @@ v12 = v11 >> 16; if ( v22 <= pOutdoorCamera->shading_dist_mist + 2048 ) { - if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v10) + 512 ) + //if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v10) + 512 ) + if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels[v14].sBoundingRadius) + 512 ) { result = v12 < 0; LOBYTE(result) = v12 >= 0; @@ -15451,7 +15489,7 @@ v5 = abs((signed)pY); v6 = abs((signed)pX); v7 = sub_4621DA(v6, v5, v2); - v8 = pOutdoor->pBModels; + v8 = &pOutdoor->pBModels[0]; if ( v7 < 2 * pOutdoor->pBModels[v4].sBoundingRadius ) { v11 = __OFSUB__(pOutdoor->pBModels[v4].uNumFaces, v2); @@ -15508,7 +15546,7 @@ int v5; // edi@6 int v6; // eax@6 int v7; // eax@6 - BSPModel *v8; // ecx@6 + BSPModel **v8; // ecx@6 unsigned __int8 v9; // zf@7 unsigned __int8 v10; // sf@7 ODMFace *v11; // eax@9 @@ -15547,23 +15585,23 @@ { while ( 1 ) { - pX = *(int *)((char *)&pOutdoor->pBModels->vBoundingCenter.x + v4) - v1; - pY = *(int *)((char *)&pOutdoor->pBModels->vBoundingCenter.y + v4) - LODWORD(v19); + pX = *(int *)((char *)&pOutdoor->pBModels[v4].vBoundingCenter.x) - v1; + pY = *(int *)((char *)&pOutdoor->pBModels[v4].vBoundingCenter.y) - LODWORD(v19); v5 = abs((signed)pY); v6 = abs((signed)pX); v7 = sub_4621DA(v6, v5, 0); - v8 = pOutdoor->pBModels; - if ( v7 < *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v4) ) - { - v9 = *(unsigned int *)((char *)&pOutdoor->pBModels->uNumFaces + v4) == 0; - v10 = *(signed int *)((char *)&pOutdoor->pBModels->uNumFaces + v4) < 0; + v8 = &pOutdoor->pBModels; + if ( v7 < *(int *)((char *)&pOutdoor->pBModels[v4].sBoundingRadius) ) + { + v9 = pOutdoor->pBModels[v4].uNumFaces == 0; + v10 = pOutdoor->pBModels[v4].uNumFaces < 0; v21 = 0; if ( !(v10 | v9) ) { v22 = 0; do { - v11 = &(*(ODMFace **)((char *)&v8->pFaces + v4))[v22 / 0x134]; + v11 = &v8[v4]->pFaces[v22 / 0x134]; v12 = v11->sCogTriggeredID; if ( v12 ) { @@ -15579,10 +15617,10 @@ } } ++v21; - v8 = pOutdoor->pBModels; + v8 = &pOutdoor->pBModels; v22 += 308; } - while ( v21 < *(signed int *)((char *)&pOutdoor->pBModels->uNumFaces + v4) ); + while ( v21 < pOutdoor->pBModels[v4].uNumFaces ); } result = v17; if ( v17 )
--- a/mm7_6.cpp Tue Jan 29 07:51:31 2013 +0600 +++ b/mm7_6.cpp Sat Feb 02 16:52:36 2013 +0000 @@ -8671,33 +8671,35 @@ } //----- (0042FA22) -------------------------------------------------------- -char *__cdecl sub_42FA22_mess_with_laying_item_list() +LayingItem *__cdecl sub_42FA22_mess_with_laying_item_list() { size_t v0; // edx@1 int v1; // ebp@1 - char *result; // eax@1 - void *v3; // ebx@1 + LayingItem *result; // eax@1 + LayingItem *v3; // ebx@1 v0 = 0; v1 = 0; - result = (char *)&pLayingItems[0].uObjectDescID; + //result = (char *)&pLayingItems[0].uObjectDescID; + result = pLayingItems; v3 = pLayingItems; do { - if ( *(short *)result ) + if ( result->uObjectDescID ) { if ( v1 != v0 ) { - memcpy(v3, result - 2, 0x70u); - *(short *)result = 0; + memcpy(v3, result, 0x70u); + result->uObjectDescID = 0; } ++v0; - v3 = (char *)v3 + 112; + ++v3;// = (char *)v3 + 112; } - result += 112; + ++result;// += 112; ++v1; } - while ( (signed int)result < (signed int)((char *)&pObjectList->uNumObjects + 2) ); + //while ( (signed int)result < (signed int)((char *)&pObjectList->uNumObjects + 2) ); + while( result <= &pLayingItems[999] ); uNumLayingItems = v0; return result; }
--- a/mm7_data.h Tue Jan 29 07:51:31 2013 +0600 +++ b/mm7_data.h Sat Feb 02 16:52:36 2013 +0000 @@ -1,7 +1,7 @@ #pragma once #include <string> #include "OSAPI.h" - +#include "LayingItem.h" #include "VectorTypes.h" typedef char _UNKNOWN; @@ -1940,7 +1940,7 @@ signed int __cdecl sub_42F4DA(); bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9); void __fastcall sub_42F960_create_object(int x, int y, int z); // idb -char *__cdecl sub_42FA22_mess_with_laying_item_list(); +LayingItem *__cdecl sub_42FA22_mess_with_laying_item_list(); signed int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6); bool __fastcall sub_42FB5C(signed int a1); // int __cdecl crt_sub_42FBB7();