Mercurial > mm7
diff mm7_4.cpp @ 728:9f596a163257
Merge
author | Nomad |
---|---|
date | Fri, 22 Mar 2013 00:06:50 +0200 |
parents | da130dd3092a 9d13d2ec35a6 |
children | 8323734d58c8 |
line wrap: on
line diff
--- a/mm7_4.cpp Fri Mar 22 00:02:31 2013 +0200 +++ b/mm7_4.cpp Fri Mar 22 00:06:50 2013 +0200 @@ -238,16 +238,8 @@ // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; //----- (0046CEC3) -------------------------------------------------------- -int _46CEC3_get_floor_level(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID) +int BLV_GetFloorLevel(int x, int y, int z, unsigned int uSectorID, unsigned int *pFaceID) { - //BLVSector *v5; // edi@1 - //int v6; // ecx@1 - //Vec3_short_ *v7; // edx@1 - //BLVFace *v8; // esi@2 - //int v9; // eax@8 - //int v10; // edi@8 - //int v11; // eax@10 - int v12; // ecx@10 int v13; // ecx@13 signed int v14; // ebx@14 int v15; // eax@16 @@ -255,14 +247,8 @@ int v17; // ST18_4@19 signed int v18; // edx@19 signed __int64 v19; // qtt@19 - PolygonType v20; // al@25 int v21; // eax@27 int v22; // ecx@29 - //BLVFace *v23; // eax@33 - //int v24; // esi@39 - //int v25; // edi@39 - //int v26; // esi@41 - int v27; // ecx@43 signed int v28; // eax@45 int v29; // ebx@47 int v30; // edx@49 @@ -272,51 +258,22 @@ signed int v34; // eax@54 signed int v35; // esi@56 int result; // eax@57 - int v37; // edi@61 int v38; // edx@62 - //int v39; // [sp+Ch] [bp-34h]@1 - //int v40; // [sp+10h] [bp-30h]@2 - int v41; // [sp+14h] [bp-2Ch]@12 - //unsigned __int16 *v42; // [sp+18h] [bp-28h]@1 - //BLVSector *v43; // [sp+1Ch] [bp-24h]@1 int v44; // [sp+20h] [bp-20h]@10 - int v45; // [sp+24h] [bp-1Ch]@10 - //signed int v46; // [sp+24h] [bp-1Ch]@38 bool v47; // [sp+24h] [bp-1Ch]@43 bool v48; // [sp+28h] [bp-18h]@10 bool v49; // [sp+28h] [bp-18h]@41 bool v50; // [sp+2Ch] [bp-14h]@12 - int v51; // [sp+2Ch] [bp-14h]@41 - //signed int v52; // [sp+30h] [bp-10h]@7 signed int v53; // [sp+30h] [bp-10h]@10 signed int v54; // [sp+30h] [bp-10h]@41 signed int v55; // [sp+34h] [bp-Ch]@1 - //signed int v56; // [sp+38h] [bp-8h]@1 - //signed int v57; // [sp+3Ch] [bp-4h]@1 - //int uSectorIDa; // [sp+4Ch] [bp+Ch]@1 - //signed int uSectorIDb; // [sp+4Ch] [bp+Ch]@32 LOG_DECOMPILATION_WARNING(); - //auto a1 = x; - //auto a2 = y; - //auto a3 = z; - - //v5 = &pIndoor->pSectors[uSectorID]; auto pSector = &pIndoor->pSectors[uSectorID]; - //v57 = y; - //v56 = x; - //v6 = 0; - v55 = 0; - //v43 = v5; - //v42 = v5->pFloors; - //v7 = pIndoor->pVertices; - //v39 = v5->uNumFloors; - //for ( uSectorIDa = 0; uSectorIDa < v39; ++uSectorIDa ) + v55 = 1; for (uint i = 0; i < pSector->uNumFloors; ++i) { - //v40 = (int)&v42[v6]; - //v8 = &pIndoor->pFaces[pSector->pFloors[i]]; auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; if (pFloor->Clickable()) continue; @@ -324,227 +281,164 @@ if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) { - //v52 = 0; for (uint j = 0; j < pFloor->uNumVertices; ++j) { - //v9 = v52; - //v10 = 2 * v52; word_721460[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; word_721460[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; word_721390[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; word_721390[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; - //} - //while ( v52 < v8->uNumVertices ); - //v5 = v43; } v44 = 2 * pFloor->uNumVertices; - //v11 = 2 * pFloor->uNumVertices; word_721460[2 * pFloor->uNumVertices] = word_721460[0]; word_721390[2 * pFloor->uNumVertices] = word_721390[0]; v48 = word_721390[0] >= y; - v12 = 0; v53 = 0; - v45 = 0; if ( pFloor->uNumVertices > 0 ) { - do + for ( int i = 0; i < v44; i++ ) { if ( v53 >= 2 ) break; - v41 = word_721390[v12 + 1]; - v50 = word_721390[v12 + 1] >= y; + v50 = word_721390[i + 1] >= y; if ( v48 == v50 ) { - v13 = v45; + v13 = i; } else { - v13 = v45; - if ( word_721460[v45 + 1] >= x ) - v14 = 0; - else - v14 = 2; - v15 = v14 | word_721460[v45] < x; + v13 = i; + v14 = word_721460[i + 1] >= x ? 0 : 2; + v15 = v14 | word_721460[i] < x; if ( v15 != 3 ) { - if ( !v15 - || (v16 = word_721390[v45], - v17 = v41 - v16, - v18 = y - v16, - LODWORD(v19) = v18 << 16, - HIDWORD(v19) = v18 >> 16, - //v7 = pIndoor->pVertices, - (signed int)(((unsigned __int64)(((signed int)word_721460[v45 + 1] - (signed int)word_721460[v45]) - * v19 - / v17) >> 16) - + word_721460[v45]) >= x) ) - ++v53; + if ( !v15 ) + { + LODWORD(v19) = (y - word_721390[i]) << 16; + HIDWORD(v19) = (y - word_721390[i]) >> 16; + v16 = ((((word_721460[i + 1] - word_721460[i]) * v19 / (word_721390[i + 1] - word_721390[i])) >> 16) + word_721460[i]); + if ( v16 >= x) + ++v53; + } } } - v12 = v13 + 1; v48 = v50; - v45 = v12; - } - while ( v12 < v44 ); - + } if ( v53 == 1 ) { if ( v55 >= 50 ) break; - v20 = pFloor->uPolygonType; - if ( v20 == 3 || v20 == 5 ) + if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) { - v21 = pIndoor->pVertices[*pFloor->pVertexIDs].z; + v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z; } else { - //v7 = pIndoor->pVertices; - v21 = ((unsigned __int64)(pFloor->zCalc1 * (signed __int64)x) >> 16) - + ((unsigned __int64)(pFloor->zCalc2 * (signed __int64)y) >> 16) + v21 = ((unsigned __int64)(pFloor->zCalc1 * (signed __int64)x) >> 16) + ((unsigned __int64)(pFloor->zCalc2 * (signed __int64)y) >> 16) + HIWORD(pFloor->zCalc3); } v22 = v55++; - dword_7212C8[v22] = v21; + blv_floor_level[v22] = v21; dword_721200[v22] = pSector->pFloors[i]; } } } - //v6 = uSectorIDa + 1; } if ( pSector->field_0 & 8 ) { for (uint i = 0; i < pSector->uNumPortals; ++i) { - //v23 = &pIndoor->pFaces[v5->pPortals[uSectorIDb]]; auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; if (portal->uPolygonType != POLYGON_Floor) continue; - if (x <= portal->pBounding.x2 && - x >= portal->pBounding.x1 && - y <= portal->pBounding.y2 && - y >= portal->pBounding.y1 ) - { - //v46 = 0; + if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && + y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) + { for (uint j = 0; j < portal->uNumVertices; ++j) { - //v24 = v46; - //v25 = 2 * v46; word_721460[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; word_721460[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; word_721390[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; word_721390[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; - //} - //while ( v46 < v23->uNumVertices ); - //v5 = v43; - } - - //v26 = 2 * v23->uNumVertices; + } word_721460[2 * portal->uNumVertices] = word_721460[0]; word_721390[2 * portal->uNumVertices] = word_721390[0]; v54 = 0; - v51 = 0; v49 = word_721390[0] >= y; if ( portal->uNumVertices > 0 ) { - do + for ( int i = 0; i < 2 * portal->uNumVertices; ++i ) { if ( v54 >= 2 ) break; - v27 = v51; - v47 = word_721390[v51 + 1] >= y; + v47 = word_721390[i + 1] >= y; if ( v49 != v47 ) { - if ( word_721460[v27 + 1] >= x ) - v28 = 0; - else - v28 = 2; - v29 = v28 | word_721460[v27] < x; + v28 = word_721460[i + 1] >= x ? 0 : 2; + v29 = v28 | word_721460[i] < x; if ( v29 != 3 ) { - if ( !v29 - || (v30 = word_721390[v27], - v31 = word_721390[v51 + 1] - v30, - v32 = y - v30, - LODWORD(v33) = v32 << 16, - HIDWORD(v33) = v32 >> 16, - //v7 = pIndoor->pVertices, - (signed int)(((unsigned __int64)(((signed int)word_721460[v27 + 1] - (signed int)word_721460[v27]) - * v33 - / v31) >> 16) - + word_721460[v27]) >= x) ) - ++v54; + if ( !v29 ) + LODWORD(v33) = (y - word_721390[i]) << 16; + HIDWORD(v33) = (y - word_721390[i]) >> 16; + v30 = ((((word_721460[i + 1] - word_721460[i]) * v33 / (word_721390[i + 1] - word_721390[i])) >> 16) + word_721460[i]); + if ( v30 >= x) + ++v54; } } - ++v51; v49 = v47; } - while ( v51 < 2 * portal->uNumVertices ); - if ( v54 == 1 ) { if ( v55 >= 50 ) break; v34 = v55++; - dword_7212C8[v34] = -29000; + blv_floor_level[v34] = -29000; dword_721200[v34] = pSector->pPortals[i]; } } } } } - - v35 = 1; if ( v55 == 1 ) { *pFaceID = dword_721200[0]; - return dword_7212C8[0]; + return blv_floor_level[0]; } if ( !v55 ) return -30000; *pFaceID = dword_721200[0]; - result = dword_7212C8[0]; + //result = blv_floor_level[0]; if ( v55 > 1 ) { - v37 = z + 5; - while ( 1 ) - { - v38 = dword_7212C8[v35]; - if ( result <= v37 ) - break; - if ( v38 < result ) - goto LABEL_67; -LABEL_68: - ++v35; - if ( v35 >= v55 ) - return result; - } - if ( v38 <= result || v38 > v37 ) - goto LABEL_68; -LABEL_67: - result = dword_7212C8[v35]; - *pFaceID = dword_721200[v35]; - goto LABEL_68; - } - return result; + for ( v35 = 1; v35 < v55; ++v35 ) + { + if ( blv_floor_level[0] <= z + 5 ) + { + if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) + continue; + blv_floor_level[0] = blv_floor_level[v35]; + *pFaceID = dword_721200[v35]; + continue; + } + if ( blv_floor_level[v35] < blv_floor_level[0] ) + { + blv_floor_level[0] = blv_floor_level[v35]; + *pFaceID = dword_721200[v35]; + } + } + } + return blv_floor_level[0]; } //----- (0046D49E) -------------------------------------------------------- -int __fastcall sub_46D49E_prolly_get_world_y_under_party(int a1, signed int a2, int a3, int a4, int *a5, int *a6, int a7) +int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int a4, int *a5, int *a6, int a7) { - signed int v7; // edi@1 - int v8; // ebx@1 - int v9; // eax@1 - BSPModel *v10; // esi@4 - ODMFace *v11; // ecx@11 - unsigned __int8 v12; // al@11 - char *v13; // eax@19 + BSPModel *pBModel; // esi@4 + ODMFace *pFace; // ecx@11 int v14; // edx@20 - int v15; // eax@22 - int v16; // edx@22 - int v17; // edi@24 signed int v18; // edx@26 int v19; // eax@28 int v20; // edx@30 @@ -561,201 +455,146 @@ int v31; // eax@45 ODMFace *v32; // eax@57 int v33; // ecx@59 - int v34; // [sp+Ch] [bp-34h]@8 - int v35; // [sp+10h] [bp-30h]@22 int v36; // [sp+14h] [bp-2Ch]@24 - int v37; // [sp+18h] [bp-28h]@22 int v38; // [sp+1Ch] [bp-24h]@2 int v39; // [sp+20h] [bp-20h]@9 - int v40; // [sp+24h] [bp-1Ch]@1 - signed int v41; // [sp+28h] [bp-18h]@1 - int v42; // [sp+2Ch] [bp-14h]@8 + signed int pBModelNum; // [sp+28h] [bp-18h]@1 + int pFaceNum; // [sp+2Ch] [bp-14h]@8 bool v43; // [sp+30h] [bp-10h]@22 bool v44; // [sp+34h] [bp-Ch]@24 - signed int v45; // [sp+38h] [bp-8h]@1 signed int v46; // [sp+3Ch] [bp-4h]@1 - signed int v47; // [sp+58h] [bp+18h]@18 signed int v48; // [sp+58h] [bp+18h]@22 signed int v49; // [sp+58h] [bp+18h]@43 - v7 = a2; - v8 = a1; - v45 = a2; - v40 = a1; v46 = 1; - v9 = GetTerrainHeightsAroundParty2(a1, a2, a5, a7); dword_721160[0] = -1; dword_721110[0] = -1; - dword_7211B0[0] = v9; - v41 = 0; + odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, a5, a7); if ( (signed int)pOutdoor->uNumBModels <= 0 ) - goto LABEL_63; + { + *a6 = 0; + return odm_floor_level[0]; + } v38 = 0; - while ( 1 ) - { - v10 = &pOutdoor->pBModels[v38]; - if ( v8 <= pOutdoor->pBModels[v38].sMaxX ) - { - if ( v8 >= v10->sMinX ) - { - if ( v7 <= v10->sMaxY ) - { - if ( v7 >= v10->sMinY ) + for ( pBModelNum = 0; pBModelNum < (signed int)pOutdoor->uNumBModels; ++pBModelNum ) + { + pBModel = &pOutdoor->pBModels[v38]; + if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && Y <= pBModel->sMaxY && Y >= pBModel->sMinY ) + { + if ( (signed int)pBModel->uNumFaces > 0 ) + { + v39 = 0; + for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) + { + pFace = &pBModel->pFaces[v39]; + if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) + && !(pFace->uAttributes & 0x20000000) + && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 + && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) { - v42 = 0; - v34 = v10->uNumFaces; - if ( (signed int)v10->uNumFaces > 0 ) + if ( pFace->uNumVertices ) { - v39 = 0; - while ( 1 ) + for ( uint i = 0; i < pFace->uNumVertices; ++i) { - v11 = &v10->pFaces[v39]; - v12 = v11->uPolygonType; - if ( (v12 == 3 || v12 == 4) - && !(v11->uAttributes & 0x20000000) - && v8 <= v11->pBoundingBox.x2 - && v8 >= v11->pBoundingBox.x1 - && v7 <= v11->pBoundingBox.y2 - && v7 >= v11->pBoundingBox.y1 ) + word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; + word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; + word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; + word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; + } + } + word_721040[2 * pFace->uNumVertices] = word_721040[0]; + word_720F70[2 * pFace->uNumVertices] = word_720F70[0]; + v43 = word_720F70[0] >= Y; + v48 = 0; + if ( 2 * pFace->uNumVertices > 0 ) + { + for ( int i = 0; i < 2 * pFace->uNumVertices; ++i ) + { + if ( v48 >= 2 ) + break; + v36 = word_720F70[i + 1]; + v44 = word_720F70[i + 1] >= Y; + if ( v43 != v44 ) { - v47 = 0; - if ( v11->uNumVertices ) + v18 = word_721040[i + 1] >= X ? 0 : 2; + v19 = v18 | word_721040[i] < X; + if ( v19 != 3 ) { - v13 = (char *)v11->pXInterceptDisplacements; - do + if ( !v19 ) { - v14 = 2 * v47; - word_721040[2 * v47] = *(short *)v13 + LOWORD(v10->pVertices.pVertices[*((short *)v13 - 60)].x); - word_720F70[2 * v47] = *((short *)v13 + 20) - + LOWORD(v10->pVertices.pVertices[*((short *)v13 - 60)].y); - word_721040[2 * v47++ + 1] = *(short *)v13 - + LOWORD(v10->pVertices.pVertices[*((short *)v13 - 59)].x); - word_720F70[v14 + 1] = *((short *)v13 + 20) - + LOWORD(v10->pVertices.pVertices[*((short *)v13 - 59)].y); - v13 += 2; - } - while ( v47 < v11->uNumVertices ); - v8 = v40; - } - v15 = 2 * v11->uNumVertices; - word_721040[2 * v11->uNumVertices] = word_721040[0]; - word_720F70[v15] = word_720F70[0]; - v35 = v15; - v16 = 0; - v43 = word_720F70[0] >= v45; - v48 = 0; - v37 = 0; - if ( v15 > 0 ) - { - do - { - if ( v48 >= 2 ) - break; - v17 = v16; - v8 = v40; - v36 = word_720F70[v16 + 1]; - v44 = word_720F70[v16 + 1] >= v45; - if ( v43 != v44 ) - { - v18 = word_721040[v17 + 1] >= v40 ? 0 : 2; - v19 = v18 | word_721040[v17] < v40; - if ( v19 != 3 ) - { - if ( !v19 - || (v20 = word_720F70[v17], - v21 = v36 - v20, - v22 = v45 - v20, - LODWORD(v23) = v22 << 16, - HIDWORD(v23) = v22 >> 16, - (signed int)(((unsigned __int64)(((signed int)word_721040[v17 + 1] - - (signed int)word_721040[v17]) - * v23 - / v21) >> 16) - + word_721040[v17]) >= v40) ) - ++v48; - } - } - v16 = v37 + 1; - v43 = v44; - ++v37; - } - while ( v37 < v35 ); - if ( v48 == 1 ) - { - if ( v46 >= 20 ) - break; - if ( v11->uPolygonType == 3 ) - v24 = v10->pVertices.pVertices[v11->pVertexIDs[0]].z; - else - v24 = ((unsigned __int64)(v11->zCalc1 * (signed __int64)v8) >> 16) - + ((unsigned __int64)(v11->zCalc2 * (signed __int64)v45) >> 16) - + HIWORD(v11->zCalc3); - v25 = v46++; - dword_7211B0[v25] = v24; - dword_721160[v25] = v41; - dword_721110[v25] = v42; + LODWORD(v23) = (Y - word_720F70[i]) << 16; + HIDWORD(v23) = (Y - word_720F70[i]) >> 16; + v22 = ((((word_721040[i + 1] - word_721040[i]) * v23 / (v36 - word_720F70[i])) >> 16) + word_721040[i]); + if ( v22 >= X) + ++v48; } } } - ++v42; - ++v39; - if ( v42 >= v34 ) + v43 = v44; + } + if ( v48 == 1 ) + { + if ( v46 >= 20 ) break; - v7 = v45; + if ( pFace->uPolygonType == POLYGON_Floor ) + v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z; + else + v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16) + + HIWORD(pFace->zCalc3); + v25 = v46++; + odm_floor_level[v25] = v24; + dword_721160[v25] = pBModelNum; + dword_721110[v25] = pFaceNum; } } } - } - } - } - ++v41; + ++v39; + } + } + } ++v38; - if ( v41 >= (signed int)pOutdoor->uNumBModels ) - break; - v7 = v45; } if ( v46 == 1 ) { -LABEL_63: *a6 = 0; - return dword_7211B0[0]; + return odm_floor_level[0]; } v27 = 0; - v49 = 1; if ( v46 <= 1 ) - { -LABEL_55: *a6 = 0; - goto LABEL_56; - } - v28 = 0; - v29 = 1; - do - { - v30 = dword_7211B0[v29]; - v31 = *(int *)((char *)dword_7211B0 + v28); - if ( v30 == v31 ) - goto LABEL_51; - if ( v31 > a3 + 5 ) - { - if ( v30 >= v31 ) - goto LABEL_52; -LABEL_51: - v27 = v49; - v28 = v29 * 4; - goto LABEL_52; - } - if ( v30 > v31 && v30 <= a3 + 5 ) - goto LABEL_51; -LABEL_52: - ++v49; - ++v29; - } - while ( v49 < v46 ); - if ( !v27 ) - goto LABEL_55; - *a6 = dword_721110[v27] | (dword_721160[v27] << 6); -LABEL_56: + else + { + //v29 = 1; + for ( v49 = 1; v49 < v46; ++v49 ) + { + if ( odm_floor_level[v49] == odm_floor_level[0] ) + { + v27 = v49; + //++v29; + break; + } + if ( odm_floor_level[0] > Z + 5 ) + { + if ( odm_floor_level[v49] >= odm_floor_level[0] ) + { + //++v29; + break; + } + v27 = v49; + //++v29; + break; + } + if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 ) + { + v27 = v49; + //++v29; + } + } + if ( !v27 ) + *a6 = 0; + else + *a6 = dword_721110[v27] | (dword_721160[v27] << 6); + } if ( v27 ) { v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]]; @@ -763,11 +602,9 @@ if ( v32->uAttributes & 0x10 ) *a5 = 1; } - v33 = dword_7211B0[v27]; - result = dword_7211B0[0]; - if ( v33 >= dword_7211B0[0] ) - result = v33; - return result; + if ( odm_floor_level[v27] >= odm_floor_level[0] ) + odm_floor_level[0] = odm_floor_level[v27]; + return odm_floor_level[0]; } //----- (0046D8E3) -------------------------------------------------------- @@ -5921,10 +5758,10 @@ //----- (004AD504) -------------------------------------------------------- -int __fastcall sub_4AD504(unsigned int uFaceID) +int __fastcall sub_4AD504(signed int sFaceID) { int result; // eax@1 - unsigned int v2; // ebx@1 + signed int v2; // ebx@1 BLVFace *v3; // esi@3 Texture *v4; // edi@6 int v5; // eax@7 @@ -6048,17 +5885,17 @@ unsigned int v123; // [sp+A0h] [bp-4h]@13 result = pRenderer->uTargetSurfacePitch; - v2 = uFaceID; + v2 = sFaceID; v95 = pRenderer->uTargetSurfacePitch; - if ( (uFaceID & 0x80000000u) == 0 ) - { - if ( (signed int)uFaceID < (signed int)pIndoor->uNumFaces ) - { - v3 = &pIndoor->pFaces[uFaceID]; - v91 = &pIndoor->pFaces[uFaceID]; + if ( sFaceID >= 0 ) + { + if ( sFaceID < (signed int)pIndoor->uNumFaces ) + { + v3 = &pIndoor->pFaces[sFaceID]; + v91 = &pIndoor->pFaces[sFaceID]; if ( !pRenderer->pRenderD3D ) { - result = sub_423B5D(uFaceID); + result = sub_423B5D(sFaceID); if ( result ) { result = sub_424829(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); @@ -8763,7 +8600,7 @@ v2 = pTransitionStrings[uHouse_ExitPic]; if ( !v2 ) { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0); + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0); v2 = pTmpBuf; } v3 = v2; @@ -9621,7 +9458,7 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - if ( (sDialogue_SpeakingActorNPC_ID & 0x80000000u) == 0 ) + if ( sDialogue_SpeakingActorNPC_ID >= 0 ) pDialogue_SpeakingActor->uAIState = Removed; if ( uActiveCharacter ) pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); @@ -9842,8 +9679,8 @@ //----- (004B6478) -------------------------------------------------------- -int __cdecl sub_4B6478() -{ +void sub_4B6478() + { GUIWindow *v0; // ebx@1 Player *v1; // edi@1 unsigned int v2; // eax@1 @@ -9950,7 +9787,7 @@ ++pMessageQueue_50CBD0->uNumMessages; }*/ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); - return result; // void func + return; // void func } if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) { @@ -9958,13 +9795,12 @@ v25 = v31; v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); - result = (int)pDialogueWindow; pDialogueWindow->pNumPresenceButton = 0; - return result; - } - result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( !result ) - return result; + return ; + } + + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; v8 = pDialogueWindow; v33 = 0; v34 = 0; @@ -9995,17 +9831,18 @@ strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); v22 = v31; v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0); - return (int)v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); + v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); + return; } sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32); v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); v32 = (149 - v33) / v34; if ( (149 - v33) / v34 > 32 ) v32 = 32; - result = v8->pStartingPosActiveItem; - v35 = result; + + v35 = v8->pStartingPosActiveItem; v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162; - if ( result < result + v8->pNumPresenceButton ) + if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton ) { v33 = 2; do @@ -10043,11 +9880,10 @@ v8 = v29; ++v35; ++v33; - result = v29->pNumPresenceButton + v29->pStartingPosActiveItem; - } - while ( v35 < result ); - } - return result; + } + while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); + } + return; } @@ -10973,10 +10809,7 @@ v14 = pMapStats->GetMapInfo(pCurrentMapName); if ( v14 ) { - v20 = pMapStats->pInfos[v14].pName; - v18 = pGlobalTXT_LocalizationStrings[410]; -LABEL_10: - sprintf(sHouseName, v18, v20); + sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); goto LABEL_20; } v21 = pGlobalTXT_LocalizationStrings[79]; @@ -10989,9 +10822,8 @@ v16 = pMapStats->GetMapInfo(v15); if ( v16 ) { - v20 = pMapStats->pInfos[v16].pName; - v18 = pGlobalTXT_LocalizationStrings[411]; - goto LABEL_10; + sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName); + goto LABEL_20; } v21 = pGlobalTXT_LocalizationStrings[73]; LABEL_19: