# HG changeset patch # User Nomad # Date 1361847640 -7200 # Node ID 7dfe960c323c9dc13579167b9bab1cb13f4d792e # Parent c43f156a95c92be0e4bb2b0fc0d9e8b02fc5b53c BLV_UpdateDoors diff -r c43f156a95c9 -r 7dfe960c323c Indoor.cpp --- a/Indoor.cpp Mon Feb 25 23:33:15 2013 +0400 +++ b/Indoor.cpp Tue Feb 26 05:00:40 2013 +0200 @@ -3482,40 +3482,40 @@ //----- (0046F228) -------------------------------------------------------- void __cdecl BLV_UpdateDoors() { - int v0; // ebx@1 - int v1; // edi@1 - BLVDoor *v2; // esi@3 - unsigned __int16 v3; // ax@3 - unsigned int v4; // ecx@5 - int v5; // eax@8 - int v6; // ecx@8 - int v7; // eax@12 - int v8; // eax@16 - unsigned __int8 v9; // zf@18 - char v10; // sf@18 - unsigned __int8 v11; // of@18 - int v12; // edi@19 - int v13; // ecx@19 - __int16 v14; // ax@19 + //int v0; // ebx@1 + //int v1; // edi@1 + //BLVDoor *v2; // esi@3 + //unsigned __int16 v3; // ax@3 + //unsigned int v4; // ecx@5 + //int v5; // eax@8 + //int v6; // ecx@8 + //int v7; // eax@12 + //int v8; // eax@16 + //unsigned __int8 v9; // zf@18 + //char v10; // sf@18 + //unsigned __int8 v11; // of@18 + //int v12; // edi@19 + //int v13; // ecx@19 + //__int16 v14; // ax@19 BLVFace *v15; // ebx@24 - unsigned __int16 *v16; // ecx@24 + //unsigned __int16 *v16; // ecx@24 Vec3_short_ *v17; // esi@24 int v18; // eax@24 int v19; // edx@24 signed int v20; // eax@24 - Vec3_short_ *v21; // ecx@24 - double v22; // st7@24 - double v23; // st6@24 + //Vec3_short_ *v21; // ecx@24 + //double v22; // st7@24 + //double v23; // st6@24 int v24; // esi@25 int v25; // eax@25 - BLVDoor *v26; // edi@25 + //BLVDoor *v26; // edi@25 signed __int64 v27; // qtt@27 BLVFaceExtra *v28; // esi@32 int v29; // ecx@34 int v30; // edx@34 unsigned __int64 v31; // qax@34 int v32; // eax@34 - unsigned __int16 *v33; // eax@35 + //unsigned __int16 *v33; // eax@35 Vec3_short_ *v34; // eax@35 int v35; // ecx@35 int v36; // edx@35 @@ -3523,291 +3523,298 @@ signed int v38; // edx@35 int v39; // eax@35 int v40; // edx@35 - unsigned __int8 v41; // cf@35 - unsigned __int16 *v42; // edi@36 + //unsigned __int8 v41; // cf@35 + //unsigned __int16 *v42; // edi@36 Vec3_short_ *v43; // edi@36 - int v44; // ecx@36 - int v45; // edi@36 - int v46; // ecx@36 - __int16 *v47; // edx@44 - int v48; // ecx@44 + //int v44; // ecx@36 + //int v45; // edi@36 + //int v46; // ecx@36 + //__int16 *v47; // edx@44 + //int v48; // ecx@44 unsigned int v49; // ecx@46 unsigned __int16 v50; // ax@48 unsigned int v51; // eax@51 unsigned __int16 v52; // ax@54 int v53; // ecx@57 - int v54; // edx@57 + //int v54; // edx@57 unsigned __int64 v55; // qax@57 int v56; // ecx@58 int v57; // eax@58 - int v58; // eax@59 - SoundID v59; // [sp-24h] [bp-88h]@12 - signed int v60; // [sp-20h] [bp-84h]@12 - unsigned int v61; // [sp-1Ch] [bp-80h]@12 - signed int v62; // [sp-18h] [bp-7Ch]@12 - signed int v63; // [sp-14h] [bp-78h]@12 - int v64; // [sp-10h] [bp-74h]@12 - unsigned int v65; // [sp-Ch] [bp-70h]@12 - int v66; // [sp-8h] [bp-6Ch]@12 - int v67; // [sp+8h] [bp-5Ch]@31 - int v68; // [sp+Ch] [bp-58h]@34 - int v69; // [sp+10h] [bp-54h]@34 - int v70; // [sp+14h] [bp-50h]@31 - int v71; // [sp+18h] [bp-4Ch]@34 - int v72; // [sp+1Ch] [bp-48h]@34 + //int v58; // eax@59 + //SoundID v59; // [sp-24h] [bp-88h]@12 + //signed int v60; // [sp-20h] [bp-84h]@12 + //unsigned int v61; // [sp-1Ch] [bp-80h]@12 + //signed int v62; // [sp-18h] [bp-7Ch]@12 + //signed int v63; // [sp-14h] [bp-78h]@12 + //int v64; // [sp-10h] [bp-74h]@12 + //unsigned int v65; // [sp-Ch] [bp-70h]@12 + //int v66; // [sp-8h] [bp-6Ch]@12 + Vec3_int_ v67; + //int v67; // [sp+8h] [bp-5Ch]@31 + //int v68; // [sp+Ch] [bp-58h]@34 + //int v69; // [sp+10h] [bp-54h]@34 + Vec3_int_ v70; + //int v70; // [sp+14h] [bp-50h]@31 + //int v71; // [sp+18h] [bp-4Ch]@34 + //int v72; // [sp+1Ch] [bp-48h]@34 int v73; // [sp+20h] [bp-44h]@24 - __int16 v74; // [sp+24h] [bp-40h]@24 + //__int16 v74; // [sp+24h] [bp-40h]@24 int v75; // [sp+28h] [bp-3Ch]@36 int v76; // [sp+2Ch] [bp-38h]@36 int v77; // [sp+30h] [bp-34h]@36 - int v78; // [sp+34h] [bp-30h]@36 - int v79; // [sp+38h] [bp-2Ch]@19 - unsigned int v80; // [sp+3Ch] [bp-28h]@2 - int v81; // [sp+40h] [bp-24h]@1 + //int v78; // [sp+34h] [bp-30h]@36 + //int v79; // [sp+38h] [bp-2Ch]@19 + //unsigned int v80; // [sp+3Ch] [bp-28h]@2 + //int v81; // [sp+40h] [bp-24h]@1 int v82; // [sp+44h] [bp-20h]@35 int v83; // [sp+48h] [bp-1Ch]@34 int v84; // [sp+4Ch] [bp-18h]@34 int v85; // [sp+50h] [bp-14h]@19 SoundID eDoorSoundID; // [sp+54h] [bp-10h]@1 - BLVDoor *v87; // [sp+58h] [bp-Ch]@3 + //BLVDoor *v87; // [sp+58h] [bp-Ch]@3 int v88; // [sp+5Ch] [bp-8h]@18 int v89; // [sp+60h] [bp-4h]@6 - v0 = 0; - v1 = 0; + //v0 = 0; + //v1 = 0; eDoorSoundID = (SoundID)pDoorSoundIDsByLocationID[dword_6BE13C_uCurrentlyLoadedLocationID]; - v81 = 0; - if ( pIndoor->uNumDoors > 0 ) + //v81 = 0; + //if ( pIndoor->uNumDoors > 0 ) + for (uint i = 0; i < pIndoor->uNumDoors; ++i) { - v80 = 0; - do - { - v2 = &pIndoor->pDoors[v80 / 0x50]; - v87 = &pIndoor->pDoors[v80 / 0x50]; - v3 = pIndoor->pDoors[v80 / 0x50].uState; - if ( v3 == (short)v0 || v3 == 2 ) + auto door = pIndoor->pDoors + i; + //v80 = 0; + //do + //{ + //v2 = &pIndoor->pDoors[v80 / 0x50]; + //v87 = &pIndoor->pDoors[v80 / 0x50]; + //v3 = door->uState; + if (door->uState == BLVDoor::Closed || door->uState == BLVDoor::Open) { - v2->uAttributes &= 0xFFFFFFFDu; + door->uAttributes &= 0xFFFFFFFDu; goto LABEL_62; } - v2->uTimeSinceTriggered += pEventTimer->uTimeElapsed; - v4 = v2->uTimeSinceTriggered; - if ( v2->uState == 1 ) + door->uTimeSinceTriggered += pEventTimer->uTimeElapsed; + //v4 = door->uTimeSinceTriggered; + if (door->uState == BLVDoor::Opening) { - v89 = (signed int)(v4 * v2->uCloseSpeed) / 128; - if ( v89 >= v2->uMoveLength ) + v89 = (signed int)(door->uTimeSinceTriggered * door->uCloseSpeed) / 128; + if ( v89 >= door->uMoveLength ) { - v89 = v2->uMoveLength; - v2->uState = BLVDoor::Open; + v89 = door->uMoveLength; + door->uState = BLVDoor::Open; LABEL_10: - if ( !(v2->uAttributes & 6) && v2->uNumVertices != (short)v0 ) + if ( !(door->uAttributes & 6) && door->uNumVertices != 0) { - v66 = v0; - v65 = v0; - v64 = v0; - v7 = 8 * v1; - v63 = v0; - v62 = -1; - LOBYTE(v7) = 8 * v1 | 1; - v61 = v0; - v60 = v7; - v59 = (SoundID)((int)eDoorSoundID + 1); -LABEL_17: - pAudioPlayer->PlaySound(v59, v60, v61, v62, v63, v64, v65, v66); - goto LABEL_18; + //v66 = 0; + //v65 = 0; + //v64 = 0; + //v7 = 8 * i | OBJECT_BLVDoor; + //v63 = 0; + //v62 = -1; + //LOBYTE(v7) = 8 * i | OBJECT_BLVDoor; + //v61 = 0; + //v60 = 8 * i | OBJECT_BLVDoor; + //v59 = (SoundID)((int)eDoorSoundID + 1); +//LABEL_17: + pAudioPlayer->PlaySound((SoundID)((int)eDoorSoundID + 1), 8 * i | OBJECT_BLVDoor, 0, -1, 0, 0, 0, 0); + //goto LABEL_18; } goto LABEL_18; } } else { - v5 = (signed int)(v4 * v2->uOpenSpeed) / 128; - v6 = v2->uMoveLength; - if ( v5 >= v6 ) + auto v5 = (signed int)(door->uTimeSinceTriggered * door->uOpenSpeed) / 128; + //v6 = door->uMoveLength; + if ( v5 >= door->uMoveLength) { - v89 = v0; - v2->uState = (BLVDoor::State)v0; + v89 = 0; + door->uState = BLVDoor::Closed; goto LABEL_10; } - v89 = v6 - v5; + v89 = door->uMoveLength - v5; } - if ( !(v2->uAttributes & 6) && v2->uNumVertices != (short)v0 ) + if ( !(door->uAttributes & 6) && door->uNumVertices) { - v66 = v0; - v65 = v0; - v64 = v0; - v8 = 8 * v1; - v63 = v0; - v62 = -1; - LOBYTE(v8) = 8 * v1 | 1; - v61 = 1; - v60 = v8; - v59 = eDoorSoundID; - goto LABEL_17; + //v66 = 0; + //v65 = 0; + //v64 = 0; + //v8 = 8 * i | OBJECT_BLVDoor; + //v63 = 0; + //v62 = -1; + //LOBYTE(v8) = 8 * v1 | 1; + //v61 = 1; + //v60 = 8 * i | OBJECT_BLVDoor; + //v59 = eDoorSoundID; + pAudioPlayer->PlaySound(eDoorSoundID, 8 * i | OBJECT_BLVDoor, 1, -1, 0, 0, 0, 0); + //goto LABEL_18; } LABEL_18: - v11 = __OFSUB__(v2->uNumVertices, (short)v0); - v9 = v2->uNumVertices == (short)v0; - v10 = (signed __int16)(v2->uNumVertices - v0) < 0; - v88 = v0; - if ( !((unsigned __int8)(v10 ^ v11) | v9) ) + //v11 = __OFSUB__(v2->uNumVertices, 0); + //v9 = v2->uNumVertices == 0; + //v10 = (signed __int16)(v2->uNumVertices - 0) < 0; + //v88 = 0; + //if (door->uNumVertices > 0) + for (uint j = 0; j < door->uNumVertices; ++j) { - do - { - v12 = v88; - v13 = v2->pVertexIDs[v88]; - v85 = v89; - v79 = v2->vDirection.x; - v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; - v13 *= 6; - *(__int16 *)((char *)&pIndoor->pVertices->x + v13) = ((unsigned int)(v79 * v89) >> 16) + v2->pXOffsets[v88]; - v85 = v89; - v79 = v2->vDirection.y; - v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; - *(__int16 *)((char *)&pIndoor->pVertices->y + v13) = ((unsigned int)(v79 * v89) >> 16) + v2->pYOffsets[v12]; - v85 = v89; - v79 = v2->vDirection.z; - v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; - v14 = ((unsigned int)(v79 * v89) >> 16) + v2->pZOffsets[v12]; - ++v88; - *(__int16 *)((char *)&pIndoor->pVertices->z + v13) = v14; - } - while ( v88 < v2->uNumVertices ); - v1 = v81; + //do + //{ + //v12 = v88; + //v13 = door->pVertexIDs[v88]; + //v85 = v89; + //v79 = door->vDirection.x; + //v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; + //v13 *= 6; + pIndoor->pVertices[door->pVertexIDs[j]].x = ((unsigned int)(door->vDirection.x * v89) >> 16) + door->pXOffsets[j]; + //v85 = v89; + //v79 = door->vDirection.y; + //v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; + pIndoor->pVertices[door->pVertexIDs[j]].y = ((unsigned int)(door->vDirection.y * v89) >> 16) + door->pYOffsets[j]; + //v85 = v89; + //v79 = door->vDirection.z; + //v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; + //v14 = ((unsigned int)(door->vDirection.z * v89) >> 16) + door->pZOffsets[j]; + pIndoor->pVertices[door->pVertexIDs[j]].z = ((unsigned int)(door->vDirection.z * v89) >> 16) + door->pZOffsets[j]; + //++v88; + //} + //while ( v88 < door->uNumVertices ); + //v1 = v81; } - v11 = __OFSUB__(v2->uNumFaces, (short)v0); - v9 = v2->uNumFaces == (short)v0; - v10 = (signed __int16)(v2->uNumFaces - v0) < 0; - v88 = v0; - if ( !((unsigned __int8)(v10 ^ v11) | v9) ) + //v11 = __OFSUB__(v2->uNumFaces, 0); + //v9 = v2->uNumFaces == 0; + //v10 = (signed __int16)(v2->uNumFaces - 0) < 0; + v88 = 0; + if (door->uNumFaces > 0) { while ( 1 ) { - v15 = &pIndoor->pFaces[v2->pFaceIDs[v88]]; - v16 = v15->pVertexIDs; - v17 = &pIndoor->pVertices[*v16]; + v15 = &pIndoor->pFaces[door->pFaceIDs[v88]]; + //v16 = v15->pVertexIDs; + v17 = &pIndoor->pVertices[v15->pVertexIDs[0]]; v18 = v15->pFacePlane_old.vNormal.y; v73 = *(int *)&v17->x; - v74 = v17->z; + //v74 = v17->z; v19 = v15->pFacePlane_old.vNormal.z; - v20 = -(v19 * v74 + (signed __int16)v73 * v15->pFacePlane_old.vNormal.x + SHIWORD(v73) * v18); + v20 = -(v19 * (int)v17->z + (signed __int16)v73 * v15->pFacePlane_old.vNormal.x + SHIWORD(v73) * v18); v15->pFacePlane_old.dist = v20; - v21 = &pIndoor->pVertices[*v16]; - v79 = v21->x; - v22 = (double)v79; - v23 = (double)v21->y; - v79 = v21->z; - v15->pFacePlane.dist = -((double)v79 * v15->pFacePlane.vNormal.z - + v23 * v15->pFacePlane.vNormal.y - + v22 * v15->pFacePlane.vNormal.x); + //v21 = &pIndoor->pVertices[v15->pVertexIDs[0]]; + //v79 = v21->x; + //v22 = (double)v21->x; + //v23 = (double)v21->y; + //v79 = v21->z; + v15->pFacePlane.dist = -((double)v17->z * v15->pFacePlane.vNormal.z + + (double)v17->y * v15->pFacePlane.vNormal.y + + (double)v17->x * v15->pFacePlane.vNormal.x); if ( v19 ) { v24 = abs(v20 >> 15); v25 = abs(v15->pFacePlane_old.vNormal.z); - v26 = v87; + //v26 = v87; if ( v24 > v25 ) Abortf( "Door Error\ndoor id: %i\nfacet no: %i\n\nOverflow dividing facet->d [%i] by facet->nz [%i]", - v87->uDoorID, - v87->pFaceIDs[v88], + door->uDoorID, + door->pFaceIDs[v88], v15->pFacePlane_old.dist, v15->pFacePlane_old.vNormal.z); - v79 = v15->pFacePlane_old.vNormal.z; - v85 = v15->pFacePlane_old.dist; - LODWORD(v27) = v85 << 16; - HIDWORD(v27) = v85 >> 16; - v85 = v27 / v79; - v15->zCalc3 = -(v27 / v79); + //v79 = v15->pFacePlane_old.vNormal.z; + //v85 = v15->pFacePlane_old.dist; + LODWORD(v27) = v15->pFacePlane_old.dist << 16; + HIDWORD(v27) = v15->pFacePlane_old.dist >> 16; + //v85 = v27 / v15->pFacePlane_old.vNormal.z; + v15->zCalc3 = -v27 / v15->pFacePlane_old.vNormal.z; } - else + /*else { v26 = v87; - } + }*/ if ( BYTE2(v15->uAttributes) & 4 || pRenderer->pRenderD3D ) - v15->_get_normals((Vec3_int_ *)&v70, (Vec3_int_ *)&v67); + v15->_get_normals(&v70, &v67); v28 = &pIndoor->pFaceExtras[v15->uFaceExtraID]; if ( !pRenderer->pRenderD3D ) { if ( !(BYTE2(v15->uAttributes) & 4) ) goto LABEL_59; - v79 = v26->vDirection.x; - v83 = (unsigned __int64)(v79 * (signed __int64)v70) >> 16; - v85 = v71; - v79 = v26->vDirection.y; - v85 = (unsigned __int64)(v79 * (signed __int64)v71) >> 16; - v84 = v72; - v79 = v26->vDirection.z; - v84 = (unsigned __int64)(v79 * (signed __int64)v72) >> 16; - v79 = v83 + v85 + ((unsigned __int64)(v79 * (signed __int64)v72) >> 16); + //v79 = door->vDirection.x; + v83 = (unsigned __int64)(door->vDirection.x * (signed __int64)v70.x) >> 16; + //v85 = v71; + //v79 = door->vDirection.y; + v85 = (unsigned __int64)(door->vDirection.y * (signed __int64)v70.y) >> 16; + //v84 = v72; + //v79 = door->vDirection.z; + v84 = (unsigned __int64)(door->vDirection.z * (signed __int64)v70.z) >> 16; + //v79 = v83 + v85 + v84; v29 = v89; - v83 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; - v28->sTextureDeltaU = -((unsigned int)(v79 * v89) >> 16); - v79 = v26->vDirection.x; - v85 = (unsigned __int64)(v79 * (signed __int64)v67) >> 16; - v83 = v68; - v79 = v26->vDirection.y; - v83 = (unsigned __int64)(v79 * (signed __int64)v68) >> 16; - v84 = v69; - v79 = v26->vDirection.z; - v84 = (unsigned __int64)(v79 * (signed __int64)v69) >> 16; - v30 = v83 + ((unsigned __int64)(v79 * (signed __int64)v69) >> 16); - v79 = v85 + v30; - v31 = (v85 + v30) * (signed __int64)v29; - v83 = v31 >> 16; + //v83 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; + v28->sTextureDeltaU = -((v83 + v85 + v84) * (signed __int64)v89) >> 16; + //v79 = door->vDirection.x; + v85 = (unsigned __int64)(door->vDirection.x * (signed __int64)v67.x) >> 16; + //v83 = v68; + //v79 = door->vDirection.y; + v83 = (unsigned __int64)(door->vDirection.y * (signed __int64)v67.y) >> 16; + //v84 = v69; + //v79 = door->vDirection.z; + v84 = (unsigned __int64)(door->vDirection.z * (signed __int64)v67.z) >> 16; + //v30 = v83 + v84; + //v79 = v85 + v30; + v31 = (v85 + v83 + v84) * (signed __int64)v29; + //v83 = v31 >> 16; v32 = v31 >> 16; goto LABEL_58; } v28->sTextureDeltaU = 0; v28->sTextureDeltaV = 0; - v33 = v15->pVertexIDs; - v85 = 1; - v34 = &pIndoor->pVertices[*v33]; + //v33 = v15->pVertexIDs; + //v85 = 1; + v34 = &pIndoor->pVertices[v15->pVertexIDs[0]]; v35 = v34->z; v36 = v34->y; v82 = v34->x; - v79 = v36; - v37 = v70 * v82 + v71 * v36 + v72 * v35; - v38 = v67 * v82 + v68 * v36 + v35 * v69; + //v79 = v36; + v37 = v70.x * v82 + v70.y * v36 + v70.z * v35; + v38 = v67.x * v82 + v67.y * v36 + v67.z * v35; v39 = v37 >> 16; *v15->pVertexUIDs = v39; v40 = v38 >> 16; *v15->pVertexVIDs = v40; - v41 = v15->uNumVertices < 1u; - v9 = v15->uNumVertices == 1; - v83 = v40; + //v41 = v15->uNumVertices < 1u; + //v9 = v15->uNumVertices == 1; + //v83 = v40; v84 = v39; v82 = v40; - if ( !(v41 | v9) ) + //if (v15->uNumVertices > 1) + for (uint j = 1; j < v15->uNumVertices; ++j) { - do - { - v42 = v15->pVertexIDs; - v75 = 2 * v85; - v43 = &pIndoor->pVertices[v42[v85]]; - v79 = v43->z; - v44 = v43->y; - v45 = v43->x; - v78 = v44; - v76 = (v72 * v79 + v70 * v45 + v71 * v44) >> 16; - v46 = (v67 * v45 + v68 * v44 + v79 * v69) >> 16; - v77 = v46; + //do + //{ + //v42 = v15->pVertexIDs; + //v75 = 2 * v85; + v43 = &pIndoor->pVertices[v15->pVertexIDs[j]]; + //v79 = v43->z; + //v44 = v43->y; + //v45 = v43->x; + //v78 = v43->y; + v76 = ((__int64)v70.z * v43->z + (__int64)v70.x * v43->x + (__int64)v70.y * v43->y) >> 16; + //v46 = (v67 * v45 + v68 * v44 + v79 * v69) >> 16; + v77 = ((__int64)v67.x * v43->x + (__int64)v67.y * v43->y + (__int64)v43->z * v67.z) >> 16; if ( v76 < v39 ) v39 = v76; - if ( v46 < v40 ) - v83 = v46; + if ( v77 < v40 ) + v40 = v77; if ( v76 > v84 ) v84 = v76; - if ( v46 > v82 ) - v82 = v46; - v47 = v15->pVertexUIDs; - v48 = v75; - ++v85; - *(unsigned __int16 *)((char *)v47 + v75) = v76; - *(unsigned __int16 *)((char *)v15->pVertexVIDs + v48) = v77; - v40 = v83; - } - while ( v85 < v15->uNumVertices ); - v26 = v87; + if ( v77 > v82 ) + v82 = v77; + //v40 = v83; + //v47 = v15->pVertexUIDs; + //v48 = v75; + //++v85; + v15->pVertexUIDs[j] = v76; + v15->pVertexVIDs[j] = v77; + //} + //while ( v85 < v15->uNumVertices ); + //v26 = v87; } v49 = v15->uAttributes; if ( BYTE1(v49) & 0x10 ) @@ -3836,61 +3843,61 @@ } if ( BYTE2(v15->uAttributes) & 4 ) { - v75 = v26->vDirection.x; - v84 = (unsigned __int64)(v75 * (signed __int64)v70) >> 16; - v82 = v71; - v75 = v26->vDirection.y; - v82 = (unsigned __int64)(v75 * (signed __int64)v71) >> 16; - v83 = v72; - v75 = v26->vDirection.z; - v83 = (unsigned __int64)(v75 * (signed __int64)v72) >> 16; - v75 = v84 + v82 + ((unsigned __int64)(v75 * (signed __int64)v72) >> 16); + //v75 = door->vDirection.x; + v84 = (unsigned __int64)(door->vDirection.x * (signed __int64)v70.x) >> 16; + //v82 = v71; + //v75 = door->vDirection.y; + v82 = (unsigned __int64)(door->vDirection.y * (signed __int64)v70.y) >> 16; + //v83 = v72; + //v75 = door->vDirection.z; + v83 = (unsigned __int64)(door->vDirection.z * (signed __int64)v70.z) >> 16; + v75 = v84 + v82 + v83; v53 = v89; v82 = (unsigned __int64)(v75 * (signed __int64)v89) >> 16; - v28->sTextureDeltaU = -((unsigned int)(v75 * v89) >> 16); - v75 = v26->vDirection.x; - v84 = (unsigned __int64)(v75 * (signed __int64)v67) >> 16; - v82 = v68; - v75 = v26->vDirection.y; - v82 = (unsigned __int64)(v75 * (signed __int64)v68) >> 16; - v83 = v69; - v75 = v26->vDirection.z; - v83 = (unsigned __int64)(v75 * (signed __int64)v69) >> 16; - v54 = v82 + ((unsigned __int64)(v75 * (signed __int64)v69) >> 16); - v75 = v84 + v54; - v55 = (v84 + v54) * (signed __int64)v53; - v82 = v55 >> 16; + v28->sTextureDeltaU = -v82; + //v75 = door->vDirection.x; + v84 = (unsigned __int64)(door->vDirection.x * (signed __int64)v67.x) >> 16; + //v82 = v68; + //v75 = door->vDirection.y; + v82 = (unsigned __int64)(door->vDirection.y * (signed __int64)v67.y) >> 16; + //v83 = v69; + //v75 = door->vDirection.z; + v83 = (unsigned __int64)(door->vDirection.z * (signed __int64)v67.z) >> 16; + //v54 = v82 + v83; + v75 = v84 + v82 + v83; + v55 = v75 * (signed __int64)v53; + //v82 = v55 >> 16; v32 = v55 >> 16; LABEL_58: v56 = v88; v57 = -v32; v28->sTextureDeltaV = v57; - v28->sTextureDeltaU += v26->pDeltaUs[v56]; - v28->sTextureDeltaV = v57 + v26->pDeltaVs[v56]; + v28->sTextureDeltaU += door->pDeltaUs[v56]; + v28->sTextureDeltaV = v57 + door->pDeltaVs[v56]; } LABEL_59: - v58 = v26->uNumFaces; + //v58 = door->uNumFaces; ++v88; - if ( v88 >= v58 ) + if ( v88 >= door->uNumFaces) { - v1 = v81; - v0 = 0; + //v1 = v81; + //v0 = 0; goto LABEL_62; } - v2 = v87; + //v2 = v87; } - LOWORD(v39) = v84 - + ((signed __int16)v39 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v39].uTextureWidth : 24); + LOWORD(v39) = v84 + ((signed __int16)v39 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v39].uTextureWidth : 24); LABEL_50: v28->sTextureDeltaU -= v39; goto LABEL_51; } LABEL_62: - v80 += 80; - ++v1; - v81 = v1; - } - while ( v1 < pIndoor->uNumDoors ); + ; + //v80 += 80; + //++v1; + //v81 = v1; + //} + //while ( v1 < pIndoor->uNumDoors ); } } // 6BE13C: using guessed type int dword_6BE13C_uCurrentlyLoadedLocationID; diff -r c43f156a95c9 -r 7dfe960c323c Overlays.cpp --- a/Overlays.cpp Mon Feb 25 23:33:15 2013 +0400 +++ b/Overlays.cpp Tue Feb 26 05:00:40 2013 +0200 @@ -152,12 +152,8 @@ //----- (00458D97) -------------------------------------------------------- void OverlayList::InitializeSprites() { - OverlayList *v1; // esi@1 - signed int i; // edi@1 - - v1 = this; - for ( i = 0; i < (signed int)v1->uNumOverlays; ++i ) - pSpriteFrameTable->InitializeSprite(v1->pOverlays[i].uSpriteFramesetID); + for (uint i = 0; i < uNumOverlays; ++i) + pSpriteFrameTable->InitializeSprite(pOverlays[i].uSpriteFramesetID); } //----- (00458DBC) -------------------------------------------------------- diff -r c43f156a95c9 -r 7dfe960c323c mm7_2.cpp --- a/mm7_2.cpp Mon Feb 25 23:33:15 2013 +0400 +++ b/mm7_2.cpp Tue Feb 26 05:00:40 2013 +0200 @@ -7871,9 +7871,9 @@ //----- (0044FFD8) -------------------------------------------------------- int MapInfo::SpawnRandomTreasure(SpawnPointMM7 *a2) { - MapInfo *v2; // ebx@1 - SpawnPointMM7 *v3; // esi@1 - int v4; // eax@1 + //MapInfo *v2; // ebx@1 + //SpawnPointMM7 *v3; // esi@1 + //int v4; // eax@1 int v5; // edx@1 int v6; // eax@1 int v7; // ecx@1 @@ -7896,69 +7896,66 @@ unsigned __int16 v24; // dx@29 char *v25; // ecx@30 unsigned __int16 v26; // ax@33 - int v27; // ecx@35 - int v28; // eax@35 - int v29; // esi@35 - __int16 v30; // ax@35 + //int v27; // ecx@35 + //int v28; // eax@35 + //int v29; // esi@35 + //__int16 v30; // ax@35 LayingItem a1a; // [sp+Ch] [bp-7Ch]@1 - int v32; // [sp+7Ch] [bp-Ch]@1 - int v33; // [sp+80h] [bp-8h]@1 + //int v32; // [sp+7Ch] [bp-Ch]@1 + //int v33; // [sp+80h] [bp-8h]@1 int v34; // [sp+84h] [bp-4h]@1 - __debugbreak(); - - auto a1 = this; - - v2 = a1; - v3 = a2; - v4 = rand(); + //auto a1 = this; + //v2 = a1; + //v3 = a2; + //v4 = rand(); v34 = 0; - v5 = v4 % 100; + v5 = rand() % 100; // v6 = 2 * (v2->Treasure_prob + 7 * v3->uIndex) - 14; - v7 = (unsigned __int8)byte_4E8168[v3->uIndex-1][2*v2->Treasure_prob]; - v8 = (unsigned __int8)byte_4E8168[v3->uIndex-1][2*v2->Treasure_prob+1]; - v32 = v5; - v33 = v7; + v7 = (unsigned __int8)byte_4E8168[a2->uIndex - 1][2 * Treasure_prob]; + v8 = (unsigned __int8)byte_4E8168[a2->uIndex - 1][2 * Treasure_prob + 1]; + //v32 = v5; + //v33 = v7; v9 = rand(); - v10 = v8 - v33 + 1; + v10 = v8 - v7 + 1; v12 = v9; result = v9 / v10; - v13 = v33 + (unsigned __int64)(v12 % v10); + v13 = v7 + (unsigned __int64)(v12 % v10); if ( v13 < 7 ) { - if ( v32 < 20 ) + if ( v5 < 20 ) return result; - if ( v32 >= 60 ) - { - v19 = v3->vPosition.z; - v20 = v3->vPosition.y; - v21 = v3->vPosition.x; + if ( v5 >= 60 ) + { + v19 = a2->vPosition.z; + v20 = a2->vPosition.y; + v21 = a2->vPosition.x; v22 = rand(); return sub_450521_ProllyDropItemAt(v13, v22 % 27 + 20, v21, v20, v19, 0); } - if ( v3->uIndex == 1 ) + if ( a2->uIndex == 1 ) { v14 = rand() % 51 + 50; } else { - if ( v3->uIndex != 2 ) - { - if ( v3->uIndex == 3 ) + if ( a2->uIndex != 2 ) + { + if ( a2->uIndex == 3 ) { v14 = rand() % 301 + 200; } else { - if ( v3->uIndex != 4 ) - { - if ( v3->uIndex == 5 ) + if ( a2->uIndex != 4 ) + { + if ( a2->uIndex == 5 ) { v14 = rand() % 1001 + 1000; } else { - if ( v3->uIndex != 6 ) + if ( a2->uIndex != 6 ) { LABEL_20: v15 = 0; @@ -8028,24 +8025,21 @@ } a1a.uObjectDescID = v26; a1a.stru_24.Reset(); + LABEL_35: - v27 = v3->vPosition.y; - v28 = v3->vPosition.x; - v29 = v3->vPosition.z; - a1a.vPosition.y = v27; + a1a.vPosition.y = a2->vPosition.y; a1a.uAttributes = 0; a1a.uSoundID = 0; a1a.uFacing = 0; - a1a.vPosition.z = v29; - a1a.vPosition.x = v28; + a1a.vPosition.z = a2->vPosition.z; + a1a.vPosition.x = a2->vPosition.x; a1a.field_50 = 0; a1a.field_4C = 0; a1a.field_48 = 0; - v30 = pIndoor->GetSector(v28, v27, v29); a1a.field_5C = 0; a1a.field_58_pid = 0; a1a.uSpriteFrameID = 0; - a1a.uSectorID = v30; + a1a.uSectorID = pIndoor->GetSector(a2->vPosition.x, a2->vPosition.y, a2->vPosition.z);; return a1a.Create(0, 0, 0, 0); } @@ -13368,7 +13362,7 @@ } } else - Log::Warning(L"MM init: failed"); + Log::Warning(L"MM init: failed"); pGame->Deinitialize(); }