Mercurial > mm7
diff mm7_6.cpp @ 1449:27b7ee003c7c
Merge
author | Gloval |
---|---|
date | Tue, 06 Aug 2013 00:56:33 +0400 |
parents | 5a5d0c713d47 9a1adf08f4ed |
children | 8ff3c675a726 |
line wrap: on
line diff
--- a/mm7_6.cpp Tue Aug 06 00:52:46 2013 +0400 +++ b/mm7_6.cpp Tue Aug 06 00:56:33 2013 +0400 @@ -127,7 +127,20 @@ { v11 = 0; v12 = *(float *)v4 == *((float *)v7 - 5); - goto LABEL_19; + if ( ! (v12 | v11) ) + { + v26 += 48; + ++v24; + v25 += 48; + v27 += 48; + v28 += 48; + v5 += 48; + v4 += 48; + ++v22; + v23 += 48; + v21 = v5; + v20 = v4; + } } } else @@ -136,13 +149,22 @@ { v11 = 0; v12 = *(float *)v4 == *((float *)v7 + 7); -LABEL_19: - if ( v12 | v11 ) - goto LABEL_21; - goto LABEL_20; + if ( !(v12 | v11) ) + { + v26 += 48; + ++v24; + v25 += 48; + v27 += 48; + v28 += 48; + v5 += 48; + v4 += 48; + ++v22; + v23 += 48; + v21 = v5; + v20 = v4; + } } } -LABEL_20: v26 += 48; ++v24; v25 += 48; @@ -155,7 +177,6 @@ v21 = v5; v20 = v4; } -LABEL_21: if ( v19 ) { v13 = v24; @@ -188,899 +209,8 @@ return result; } -//----- (004250FE) -------------------------------------------------------- -signed int __fastcall sr_4250FE(unsigned int uVertexID) -{ - unsigned int v1; // edx@1 - char *v2; // edi@5 - char *v3; // esi@5 - char *v4; // ecx@5 - int v5; // ebx@6 - double v6; // st6@11 - double v7; // st5@11 - double v8; // st6@12 - unsigned __int8 v9; // c2@16 - unsigned __int8 v10; // c3@16 - void *v11; // edi@23 - double v12; // st6@23 - char *v13; // ecx@23 - char v14; // zf@24 - signed int result; // eax@25 - unsigned int v16; // [sp+8h] [bp-28h]@5 - bool v17; // [sp+Ch] [bp-24h]@2 - bool v18; // [sp+10h] [bp-20h]@7 - char *v19; // [sp+14h] [bp-1Ch]@5 - char *v20; // [sp+18h] [bp-18h]@5 - signed int v21; // [sp+1Ch] [bp-14h]@1 - RenderVertexSoft *v22; // [sp+20h] [bp-10h]@5 - char *v23; // [sp+24h] [bp-Ch]@5 - char *v24; // [sp+28h] [bp-8h]@5 - char *v25; // [sp+2Ch] [bp-4h]@5 - - v1 = uVertexID; - memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); - v21 = 0; - v17 = array_50AC10[0].vWorldViewPosition.x >= 8.0; - if ( (signed int)(uVertexID + 1) <= 1 ) - return 0; - v2 = (char *)&array_507D30[0].vWorldViewPosition.z; - v3 = (char *)&array_507D30[0].vWorldViewPosition.y; - v24 = (char *)&array_507D30[0]._rhw; - v22 = array_507D30; - v19 = (char *)&array_507D30[0].vWorldViewPosition.z; - v20 = (char *)&array_507D30[0].vWorldViewPosition.y; - v23 = (char *)&array_507D30[0].vWorldViewPosition; - v25 = (char *)&array_507D30[0].flt_2C; - v4 = (char *)&array_50AC10[0].vWorldViewPosition; - v16 = v1; - do - { - v5 = (int)(v4 + 48); - v18 = *((float *)v4 + 12) >= 8.0; - if ( v17 != v18 ) - { - if ( v18 ) - { - v6 = (8.0 - *(float *)v4) / (*(float *)v5 - *(float *)v4); - *(float *)v3 = (*((float *)v4 + 13) - *((float *)v4 + 1)) * v6 + *((float *)v4 + 1); - *(float *)v2 = (*((float *)v4 + 14) - *((float *)v4 + 2)) * v6 + *((float *)v4 + 2); - v7 = (*((float *)v4 + 20) - *((float *)v4 + 8)) * v6 + *((float *)v4 + 8); - } - else - { - v8 = (8.0 - *(float *)v5) / (*(float *)v4 - *(float *)v5); - *(float *)v3 = (*((float *)v4 + 1) - *((float *)v4 + 13)) * v8 + *((float *)v4 + 13); - *(float *)v2 = (*((float *)v4 + 2) - *((float *)v4 + 14)) * v8 + *((float *)v4 + 14); - v7 = (*((float *)v4 + 8) - *((float *)v4 + 20)) * v8 + *((float *)v4 + 20); - } - *(float *)v25 = v7; - *(float *)v23 = 8.0; - *(int *)v24 = 0x3E000000u; - if ( v17 ) - { - if ( 8.0 == *(float *)v4 && *(float *)v3 == *((float *)v4 + 1) ) - { - v9 = 0; - v10 = *(float *)v2 == *((float *)v4 + 2); - goto LABEL_20; - } - } - else - { - if ( 8.0 == *(float *)v5 && *(float *)v3 == *((float *)v4 + 13) ) - { - v9 = 0; - v10 = *(float *)v2 == *((float *)v4 + 14); -LABEL_20: - if ( v10 | v9 ) - goto LABEL_22; - goto LABEL_21; - } - } -LABEL_21: - ++v22; - v23 += 48; - v25 += 48; - v3 += 48; - v2 += 48; - ++v21; - v24 += 48; - v20 = v3; - v19 = v2; - } -LABEL_22: - if ( v18 ) - { - v11 = v22; - v20 += 48; - v19 += 48; - v12 = 1.0 / (*(float *)v5 + 0.0000001); - ++v21; - v25 += 48; - v23 += 48; - ++v22; - memcpy(v11, v4 + 36, 0x30u); - v13 = v24; - v24 += 48; - v3 = v20; - v2 = v19; - *(float *)v13 = v12; - } - v14 = v16-- == 1; - v17 = v18; - v4 = (char *)v5; - } - while ( !v14 ); - result = v21; - if ( v21 < 3 ) - return 0; - return result; -} - -//----- (004252E8) -------------------------------------------------------- -signed int __fastcall sr_4252E8(unsigned int uVertexID) -{ - unsigned int v1; // edx@1 - double v2; // st7@1 - char *v3; // edi@5 - char *v4; // esi@5 - char *v5; // ecx@5 - int v6; // ebx@6 - double v7; // st6@11 - double v8; // st5@11 - double v9; // st6@12 - unsigned __int8 v10; // c2@16 - unsigned __int8 v11; // c3@16 - void *v12; // edi@23 - double v13; // st6@23 - char *v14; // ecx@23 - char v15; // zf@24 - signed int result; // eax@25 - unsigned int v17; // [sp+8h] [bp-28h]@5 - bool v18; // [sp+Ch] [bp-24h]@2 - bool v19; // [sp+10h] [bp-20h]@7 - char *v20; // [sp+14h] [bp-1Ch]@5 - char *v21; // [sp+18h] [bp-18h]@5 - signed int v22; // [sp+1Ch] [bp-14h]@1 - RenderVertexSoft *v23; // [sp+20h] [bp-10h]@5 - char *v24; // [sp+24h] [bp-Ch]@5 - char *v25; // [sp+28h] [bp-8h]@5 - char *v26; // [sp+2Ch] [bp-4h]@5 - - v1 = uVertexID; - v2 = (double)pOutdoorCamera->shading_dist_mist; - memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); - v22 = 0; - v18 = array_50AC10[0].vWorldViewPosition.x <= v2; - if ( (signed int)(uVertexID + 1) <= 1 ) - return 0; - v3 = (char *)&array_507D30[0].vWorldViewPosition.z; - v4 = (char *)&array_507D30[0].vWorldViewPosition.y; - v25 = (char *)&array_507D30[0]._rhw; - v23 = array_507D30; - v20 = (char *)&array_507D30[0].vWorldViewPosition.z; - v21 = (char *)&array_507D30[0].vWorldViewPosition.y; - v24 = (char *)&array_507D30[0].vWorldViewPosition; - v26 = (char *)&array_507D30[0].flt_2C; - v5 = (char *)&array_50AC10[0].vWorldViewPosition; - v17 = v1; - do - { - v6 = (int)(v5 + 48); - v19 = v2 >= *((float *)v5 + 12); - if ( v18 != v19 ) - { - if ( v19 ) - { - v7 = (v2 - *(float *)v5) / (*(float *)v6 - *(float *)v5); - *(float *)v4 = (*((float *)v5 + 13) - *((float *)v5 + 1)) * v7 + *((float *)v5 + 1); - *(float *)v3 = (*((float *)v5 + 14) - *((float *)v5 + 2)) * v7 + *((float *)v5 + 2); - v8 = (*((float *)v5 + 20) - *((float *)v5 + 8)) * v7 + *((float *)v5 + 8); - } - else - { - v9 = (v2 - *(float *)v6) / (*(float *)v5 - *(float *)v6); - *(float *)v4 = (*((float *)v5 + 1) - *((float *)v5 + 13)) * v9 + *((float *)v5 + 13); - *(float *)v3 = (*((float *)v5 + 2) - *((float *)v5 + 14)) * v9 + *((float *)v5 + 14); - v8 = (*((float *)v5 + 8) - *((float *)v5 + 20)) * v9 + *((float *)v5 + 20); - } - *(float *)v26 = v8; - *(float *)v24 = v2; - *(float *)v25 = 1.0 / v2; - if ( v18 ) - { - if ( v2 == *(float *)v5 && *(float *)v4 == *((float *)v5 + 1) ) - { - v10 = 0; - v11 = *(float *)v3 == *((float *)v5 + 2); - goto LABEL_20; - } - } - else - { - if ( v2 == *(float *)v6 && *(float *)v4 == *((float *)v5 + 13) ) - { - v10 = 0; - v11 = *(float *)v3 == *((float *)v5 + 14); -LABEL_20: - if ( v11 | v10 ) - goto LABEL_22; - goto LABEL_21; - } - } -LABEL_21: - ++v23; - v24 += 48; - v26 += 48; - v4 += 48; - v3 += 48; - ++v22; - v25 += 48; - v21 = v4; - v20 = v3; - } -LABEL_22: - if ( v19 ) - { - v12 = v23; - v21 += 48; - v20 += 48; - v13 = 1.0 / (*(float *)v6 + 0.0000001); - ++v22; - v26 += 48; - v24 += 48; - ++v23; - memcpy(v12, v5 + 36, 0x30u); - v14 = v25; - v25 += 48; - v4 = v21; - v3 = v20; - *(float *)v14 = v13; - } - v15 = v17-- == 1; - v18 = v19; - v5 = (char *)v6; - } - while ( !v15 ); - result = v22; - if ( v22 < 3 ) - return 0; - return result; -} - -//----- (004254D2) -------------------------------------------------------- -int __fastcall sr_4254D2(signed int a1) -{ - signed int v1; // ebx@2 - int v2; // ecx@2 - int result; // eax@11 - double v4; // ST74_8@12 - bool v5; // edi@12 - char *v6; // esi@13 - char *v7; // ebx@13 - double v8; // st7@15 - double v9; // st7@16 - double v10; // st6@16 - double v11; // st7@17 - float v12; // eax@18 - double v13; // ST4C_8@19 - double v14; // ST10_8@19 - double v15; // ST28_8@20 - double v16; // ST34_8@20 - char v17; // zf@20 - double v18; // ST18_8@21 - double v19; // ST3C_8@21 - double v20; // ST44_8@22 - double v21; // ST54_8@22 - void *v22; // edi@26 - double v23; // ST54_8@29 - bool v24; // esi@29 - char *v25; // edi@30 - char *v26; // ebx@30 - bool v27; // ecx@32 - double v28; // st7@33 - double v29; // st7@34 - double v30; // st6@34 - double v31; // st7@35 - double v32; // ST44_8@37 - double v33; // ST3C_8@37 - double v34; // ST18_8@38 - double v35; // ST34_8@38 - char v36; // zf@38 - double v37; // ST28_8@39 - double v38; // ST10_8@39 - double v39; // ST20_8@40 - double v40; // ST5C_8@40 - void *v41; // edi@44 - double v42; // ST5C_8@47 - bool v43; // edi@47 - char *v44; // esi@48 - char *v45; // ebx@48 - bool v46; // ecx@49 - double v47; // st6@50 - double v48; // st6@51 - double v49; // st5@51 - double v50; // st6@52 - double v51; // ST20_8@54 - double v52; // ST54_8@54 - double v53; // ST44_8@55 - double v54; // ST3C_8@55 - char v55; // zf@55 - double v56; // ST18_8@56 - double v57; // ST34_8@56 - double v58; // ST28_8@57 - double v59; // ST10_8@57 - void *v60; // edi@61 - double v61; // ST5C_8@64 - bool v62; // edi@64 - char *v63; // esi@65 - char *v64; // ebx@65 - bool v65; // ecx@66 - double v66; // st6@67 - double v67; // st6@68 - double v68; // st5@68 - double v69; // st6@69 - double v70; // ST20_8@71 - double v71; // ST54_8@71 - double v72; // ST44_8@72 - double v73; // ST3C_8@72 - char v74; // zf@72 - double v75; // ST18_8@73 - double v76; // ST34_8@73 - double v77; // ST28_8@74 - double v78; // ST10_8@74 - void *v79; // edi@78 - int v80; // ebx@81 - char *v81; // ecx@82 - signed int v82; // esi@82 - float v83; // ST78_4@83 - double v84; // ST5C_8@83 - float v85; // eax@84 - double v86; // ST20_8@85 - double v87; // ST54_8@88 - float v88; // eax@89 - double v89; // ST44_8@90 - unsigned __int8 v90; // sf@94 - unsigned __int8 v91; // of@94 - int v92; // edx@97 - int v93; // esi@97 - int v94; // edi@97 - int v95; // eax@97 - int v96; // eax@104 - double v97; // [sp+4Ch] [bp-8Ch]@32 - double v98; // [sp+54h] [bp-84h]@49 - double v99; // [sp+54h] [bp-84h]@66 - float v100; // [sp+5Ch] [bp-7Ch]@1 - float v101; // [sp+60h] [bp-78h]@1 - float v102; // [sp+64h] [bp-74h]@1 - double v103; // [sp+6Ch] [bp-6Ch]@14 - float v104; // [sp+A8h] [bp-30h]@1 - signed int v105; // [sp+A8h] [bp-30h]@96 - bool v106; // [sp+ACh] [bp-2Ch]@14 - bool v107; // [sp+ACh] [bp-2Ch]@32 - bool v108; // [sp+ACh] [bp-2Ch]@49 - bool v109; // [sp+ACh] [bp-2Ch]@66 - signed int v110; // [sp+B0h] [bp-28h]@12 - char *v111; // [sp+B8h] [bp-20h]@30 - signed int v112; // [sp+B8h] [bp-20h]@48 - signed int v113; // [sp+B8h] [bp-20h]@65 - char *v114; // [sp+BCh] [bp-1Ch]@13 - signed int v115; // [sp+BCh] [bp-1Ch]@29 - signed int v116; // [sp+BCh] [bp-1Ch]@64 - signed int v117; // [sp+C0h] [bp-18h]@1 - char *v118; // [sp+C0h] [bp-18h]@30 - char *v119; // [sp+C0h] [bp-18h]@48 - char *v120; // [sp+C0h] [bp-18h]@65 - char *v121; // [sp+C4h] [bp-14h]@13 - char *v122; // [sp+C4h] [bp-14h]@30 - signed int v123; // [sp+C4h] [bp-14h]@47 - char *v124; // [sp+C8h] [bp-10h]@30 - char *v125; // [sp+C8h] [bp-10h]@48 - char *v126; // [sp+C8h] [bp-10h]@65 - signed int v127; // [sp+CCh] [bp-Ch]@2 - char *v128; // [sp+CCh] [bp-Ch]@13 - char *v129; // [sp+CCh] [bp-Ch]@30 - RenderVertexSoft *v130; // [sp+CCh] [bp-Ch]@48 - RenderVertexSoft *v131; // [sp+CCh] [bp-Ch]@65 - RenderVertexSoft *v132; // [sp+D0h] [bp-8h]@13 - char *v133; // [sp+D0h] [bp-8h]@30 - char *v134; // [sp+D0h] [bp-8h]@48 - char *v135; // [sp+D0h] [bp-8h]@65 - signed int v136; // [sp+D4h] [bp-4h]@1 - char *v137; // [sp+D4h] [bp-4h]@13 - RenderVertexSoft *v138; // [sp+D4h] [bp-4h]@30 - char *v139; // [sp+D4h] [bp-4h]@48 - char *v140; // [sp+D4h] [bp-4h]@65 - - v101 = (double)(signed int)pViewport->uViewportTL_X; - v100 = (double)(signed int)pViewport->uViewportBR_X; - v117 = a1; - v136 = 1; - v104 = (double)(signed int)pViewport->uViewportTL_Y; - v102 = (double)(pViewport->uViewportBR_Y + 1); - if ( a1 <= 0 ) - return v117; - v127 = a1; - v1 = a1; - memcpy(array_508690, array_50AC10, 4 * ((unsigned int)(48 * a1) >> 2)); - v2 = 0; - do - { - if ( array_50AC10[v2].vWorldViewProjX < (double)v101 || array_50AC10[v2].vWorldViewProjX > (double)v100 ) - v136 = 0; - if ( *(float *)(v2 * 48 + 5286956) < (double)v104 || *(float *)(v2 * 48 + 5286956) > (double)v102 ) - v136 = 0; - ++v2; - --v127; - } - while ( v127 ); - if ( v136 ) - return v117; - v110 = 0; - memcpy(&array_50AC10[v1], array_50AC10, sizeof(array_50AC10[v1])); - v4 = array_50AC10[0].vWorldViewProjX + 6.7553994e15; - v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportTL_X; - if ( v117 < 1 ) - goto LABEL_112; - v6 = (char *)&array_50A2B0[0].vWorldViewProjY; - v132 = array_50A2B0; - v137 = (char *)&array_50A2B0[0].vWorldViewProjX; - v128 = (char *)&array_50A2B0[0].vWorldViewProjY; - v121 = (char *)&array_50A2B0[0].flt_2C; - v114 = (char *)&array_50A2B0[0]._rhw; - v7 = (char *)&array_50AC10[0].flt_2C; - do - { - v103 = *((float *)v7 + 7) + 6.7553994e15; - v106 = SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X; - if ( !(v5 ^ v106) ) - goto LABEL_25; - v8 = v101; - if ( SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X ) - { - v9 = (v8 - *((float *)v7 - 5)) / (*((float *)v7 + 7) - *((float *)v7 - 5)); - *(float *)v6 = (*((float *)v7 + 8) - *((float *)v7 - 4)) * v9 + *((float *)v7 - 4); - *(float *)v114 = (*((float *)v7 + 9) - *((float *)v7 - 3)) * v9 + *((float *)v7 - 3); - v10 = (*((float *)v7 + 12) - *(float *)v7) * v9 + *(float *)v7; - } - else - { - v11 = (v8 - *((float *)v7 + 7)) / (*((float *)v7 - 5) - *((float *)v7 + 7)); - *(float *)v6 = (*((float *)v7 - 4) - *((float *)v7 + 8)) * v11 + *((float *)v7 + 8); - *(float *)v114 = (*((float *)v7 - 3) - *((float *)v7 + 9)) * v11 + *((float *)v7 + 9); - v10 = (*(float *)v7 - *((float *)v7 + 12)) * v11 + *((float *)v7 + 12); - } - *(float *)v121 = v10; - *(int *)v137 = LODWORD(v101); - LODWORD(v12) = *(int *)v6; - if ( v5 ) - { - v13 = v12 + 6.7553994e15; - v14 = *((float *)v7 - 4) + 6.7553994e15; - if ( LODWORD(v13) == LODWORD(v14) ) - { - v15 = *(float *)v137 + 6.7553994e15; - v16 = *((float *)v7 - 5) + 6.7553994e15; - v17 = LODWORD(v15) == LODWORD(v16); - goto LABEL_23; - } - } - else - { - v18 = v12 + 6.7553994e15; - v19 = *((float *)v7 + 8) + 6.7553994e15; - if ( LODWORD(v18) == LODWORD(v19) ) - { - v20 = *(float *)v137 + 6.7553994e15; - v21 = *((float *)v7 + 7) + 6.7553994e15; - v17 = LODWORD(v20) == LODWORD(v21); -LABEL_23: - if ( v17 ) - goto LABEL_25; - goto LABEL_24; - } - } -LABEL_24: - v121 += 48; - v114 += 48; - v6 += 48; - ++v110; - ++v132; - v128 = v6; - v137 += 48; -LABEL_25: - if ( v106 ) - { - v22 = v132; - v128 += 48; - ++v110; - v114 += 48; - v121 += 48; - v137 += 48; - ++v132; - memcpy(v22, v7 + 4, 0x30u); - v6 = v128; - } - v5 = v106; - v7 += 48; - --v117; - } - while ( v117 ); - if ( v110 < 3 - || (v115 = 0, - memcpy(&array_50A2B0[v110], array_50A2B0, sizeof(array_50A2B0[v110])), - v23 = array_50A2B0[0].vWorldViewProjX + 6.7553994e15, - v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportBR_X, - v110 < 1) ) - goto LABEL_112; - v25 = (char *)&array_509950[0]._rhw; - v138 = array_509950; - v129 = (char *)&array_50A2B0[0].vWorldViewProjX; - v118 = (char *)&array_50A2B0[0].vWorldViewProjY; - v133 = (char *)&array_509950[0].vWorldViewProjX; - v122 = (char *)&array_509950[0].vWorldViewProjY; - v124 = (char *)&array_509950[0].flt_2C; - v111 = (char *)&array_509950[0]._rhw; - v26 = (char *)&array_50A2B0[0].flt_2C; - while ( 2 ) - { - v97 = *((float *)v26 + 7) + 6.7553994e15; - v27 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; - v107 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; - if ( v24 != v27 ) - { - v28 = v100; - if ( SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X ) - { - v29 = (v28 - *((float *)v26 - 5)) / (*((float *)v26 + 7) - *((float *)v26 - 5)); - *(float *)v122 = (*((float *)v26 + 8) - *((float *)v26 - 4)) * v29 + *((float *)v26 - 4); - *(float *)v25 = (*((float *)v26 + 9) - *((float *)v26 - 3)) * v29 + *((float *)v26 - 3); - v30 = (*((float *)v26 + 12) - *(float *)v26) * v29 + *(float *)v26; - } - else - { - v31 = (v28 - *((float *)v26 + 7)) / (*((float *)v26 - 5) - *((float *)v26 + 7)); - *(float *)v122 = (*((float *)v26 - 4) - *((float *)v26 + 8)) * v31 + *((float *)v26 + 8); - *(float *)v25 = (*((float *)v26 - 3) - *((float *)v26 + 9)) * v31 + *((float *)v26 + 9); - v30 = (*(float *)v26 - *((float *)v26 + 12)) * v31 + *((float *)v26 + 12); - } - *(float *)v124 = v30; - *(int *)v133 = LODWORD(v100); - if ( v24 ) - { - v32 = *(float *)v122 + 6.7553994e15; - v33 = *((float *)v26 - 4) + 6.7553994e15; - if ( LODWORD(v32) == LODWORD(v33) ) - { - v34 = *(float *)v133 + 6.7553994e15; - v35 = *((float *)v26 - 5) + 6.7553994e15; - v36 = LODWORD(v34) == LODWORD(v35); - goto LABEL_41; - } - goto LABEL_42; - } - v37 = *(float *)v118 + 6.7553994e15; - v38 = *((float *)v26 + 8) + 6.7553994e15; - if ( LODWORD(v37) != LODWORD(v38) ) - goto LABEL_42; - v39 = *(float *)v129 + 6.7553994e15; - v40 = *((float *)v26 + 7) + 6.7553994e15; - v36 = LODWORD(v39) == LODWORD(v40); -LABEL_41: - if ( !v36 ) - { -LABEL_42: - v129 += 48; - v118 += 48; - v133 += 48; - v122 += 48; - v124 += 48; - v111 += 48; - ++v115; - ++v138; - } - } - if ( v27 ) - { - v41 = v138; - ++v115; - v111 += 48; - v124 += 48; - v122 += 48; - v133 += 48; - v118 += 48; - v129 += 48; - ++v138; - memcpy(v41, v26 + 4, 0x30u); - } - v24 = v107; - v26 += 48; - --v110; - if ( v110 ) - { - v25 = v111; - continue; - } - break; - } - if ( v115 < 3 - || (v123 = 0, - memcpy(&array_509950[v115], array_509950, sizeof(array_509950[v115])), - v42 = array_509950[0].vWorldViewProjY + 6.7553994e15, - v43 = SLODWORD(v42) >= (signed int)pViewport->uViewportTL_Y, - v115 < 1) ) - goto LABEL_112; - v44 = (char *)&array_508FF0[0].vWorldViewProjX; - v130 = array_508FF0; - v119 = (char *)&array_508FF0[0].vWorldViewProjX; - v139 = (char *)&array_508FF0[0].vWorldViewProjY; - v125 = (char *)&array_508FF0[0].flt_2C; - v134 = (char *)&array_508FF0[0]._rhw; - v45 = (char *)&array_509950[0].flt_2C; - v112 = v115; - while ( 2 ) - { - v98 = *((float *)v45 + 8) + 6.7553994e15; - v46 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; - v108 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; - if ( v43 != v46 ) - { - v47 = v104; - if ( SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y ) - { - v48 = (v47 - *((float *)v45 - 4)) / (*((float *)v45 + 8) - *((float *)v45 - 4)); - *(float *)v44 = (*((float *)v45 + 7) - *((float *)v45 - 5)) * v48 + *((float *)v45 - 5); - *(float *)v134 = (*((float *)v45 + 9) - *((float *)v45 - 3)) * v48 + *((float *)v45 - 3); - v49 = (*((float *)v45 + 12) - *(float *)v45) * v48 + *(float *)v45; - } - else - { - v50 = (v47 - *((float *)v45 + 8)) / (*((float *)v45 - 4) - *((float *)v45 + 8)); - *(float *)v44 = (*((float *)v45 - 5) - *((float *)v45 + 7)) * v50 + *((float *)v45 + 7); - *(float *)v134 = (*((float *)v45 - 3) - *((float *)v45 + 9)) * v50 + *((float *)v45 + 9); - v49 = (*(float *)v45 - *((float *)v45 + 12)) * v50 + *((float *)v45 + 12); - } - *(float *)v125 = v49; - *(float *)v139 = v104; - if ( v43 ) - { - v51 = v104 + 6.7553994e15; - v52 = *((float *)v45 - 4) + 6.7553994e15; - if ( LODWORD(v51) == LODWORD(v52) ) - { - v53 = *(float *)v44 + 6.7553994e15; - v54 = *((float *)v45 - 5) + 6.7553994e15; - v55 = LODWORD(v53) == LODWORD(v54); - goto LABEL_58; - } - goto LABEL_59; - } - v56 = v104 + 6.7553994e15; - v57 = *((float *)v45 + 8) + 6.7553994e15; - if ( LODWORD(v56) != LODWORD(v57) ) - goto LABEL_59; - v58 = *(float *)v44 + 6.7553994e15; - v59 = *((float *)v45 + 7) + 6.7553994e15; - v55 = LODWORD(v58) == LODWORD(v59); -LABEL_58: - if ( !v55 ) - { -LABEL_59: - v139 += 48; - v125 += 48; - v134 += 48; - v44 += 48; - ++v123; - ++v130; - v119 = v44; - } - } - if ( v46 ) - { - v60 = v130; - v119 += 48; - ++v123; - v134 += 48; - v125 += 48; - v139 += 48; - ++v130; - memcpy(v60, v45 + 4, 0x30u); - v44 = v119; - } - v43 = v108; - v45 += 48; - --v112; - if ( v112 ) - continue; - break; - } - if ( v123 < 3 - || (v116 = 0, - memcpy(&array_508FF0[v123], array_508FF0, sizeof(array_508FF0[v123])), - v61 = array_508FF0[0].vWorldViewProjY + 6.7553994e15, - v62 = SLODWORD(v61) <= (signed int)pViewport->uViewportBR_Y, - v123 < 1) ) - goto LABEL_112; - v63 = (char *)&array_508690[0].vWorldViewProjX; - v131 = array_508690; - v120 = (char *)&array_508690[0].vWorldViewProjX; - v140 = (char *)&array_508690[0].vWorldViewProjY; - v126 = (char *)&array_508690[0].flt_2C; - v135 = (char *)&array_508690[0]._rhw; - v64 = (char *)&array_508FF0[0].flt_2C; - v113 = v123; - while ( 2 ) - { - v99 = *((float *)v64 + 8) + 6.7553994e15; - v65 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; - v109 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; - if ( v62 != v65 ) - { - v66 = v102; - if ( SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y ) - { - v67 = (v66 - *((float *)v64 - 4)) / (*((float *)v64 + 8) - *((float *)v64 - 4)); - *(float *)v63 = (*((float *)v64 + 7) - *((float *)v64 - 5)) * v67 + *((float *)v64 - 5); - *(float *)v135 = (*((float *)v64 + 9) - *((float *)v64 - 3)) * v67 + *((float *)v64 - 3); - v68 = (*((float *)v64 + 12) - *(float *)v64) * v67 + *(float *)v64; - } - else - { - v69 = (v66 - *((float *)v64 + 8)) / (*((float *)v64 - 4) - *((float *)v64 + 8)); - *(float *)v63 = (*((float *)v64 - 5) - *((float *)v64 + 7)) * v69 + *((float *)v64 + 7); - *(float *)v135 = (*((float *)v64 - 3) - *((float *)v64 + 9)) * v69 + *((float *)v64 + 9); - v68 = (*(float *)v64 - *((float *)v64 + 12)) * v69 + *((float *)v64 + 12); - } - *(float *)v126 = v68; - *(float *)v140 = v102; - if ( v62 ) - { - v70 = v102 + 6.7553994e15; - v71 = *((float *)v64 - 4) + 6.7553994e15; - if ( LODWORD(v70) == LODWORD(v71) ) - { - v72 = *(float *)v63 + 6.7553994e15; - v73 = *((float *)v64 - 5) + 6.7553994e15; - v74 = LODWORD(v72) == LODWORD(v73); - goto LABEL_75; - } - goto LABEL_76; - } - v75 = v102 + 6.7553994e15; - v76 = *((float *)v64 + 8) + 6.7553994e15; - if ( LODWORD(v75) != LODWORD(v76) ) - goto LABEL_76; - v77 = *(float *)v63 + 6.7553994e15; - v78 = *((float *)v64 + 7) + 6.7553994e15; - v74 = LODWORD(v77) == LODWORD(v78); -LABEL_75: - if ( !v74 ) - { -LABEL_76: - v140 += 48; - v126 += 48; - v135 += 48; - v63 += 48; - ++v116; - ++v131; - v120 = v63; - } - } - if ( v65 ) - { - v79 = v131; - v120 += 48; - ++v116; - v135 += 48; - v126 += 48; - v140 += 48; - ++v131; - memcpy(v79, v64 + 4, 0x30u); - v63 = v120; - } - v62 = v109; - v64 += 48; - --v113; - if ( v113 ) - continue; - break; - } - if ( v116 < 3 ) - goto LABEL_112; - v80 = v116; - memcpy(&array_508690[v116], array_508690, sizeof(array_508690[v116])); - if ( v116 > 0 ) - { - v81 = (char *)&array_508690[0].vWorldViewProjX; - v82 = v116; - do - { - LODWORD(v83) = *(int *)v81; - *((float *)v81 - 3) = 1.0 / *((float *)v81 + 2); - v84 = v83 + 6.7553994e15; - if ( SLODWORD(v84) <= (signed int)pViewport->uViewportBR_X ) - { - v86 = *(float *)v81 + 6.7553994e15; - if ( SLODWORD(v86) >= (signed int)pViewport->uViewportTL_X ) - goto LABEL_88; - v85 = v101; - } - else - { - v85 = v100; - } - *(int *)v81 = LODWORD(v85); -LABEL_88: - v87 = *((float *)v81 + 1) + 6.7553994e15; - if ( SLODWORD(v87) > (signed int)pViewport->uViewportBR_Y ) - { - v88 = v102; -LABEL_92: - *((int *)v81 + 1) = LODWORD(v88); - goto LABEL_93; - } - v89 = *((float *)v81 + 1) + 6.7553994e15; - if ( SLODWORD(v89) < (signed int)pViewport->uViewportTL_Y ) - { - v88 = v104; - goto LABEL_92; - } -LABEL_93: - v81 += 48; - --v82; - } - while ( v82 ); - } - v91 = __OFSUB__(v116, 3); - v90 = v116 - 3 < 0; - if ( v116 > 3 ) - { - memcpy(&array_508690[v116 + 1], &array_508690[1], sizeof(array_508690[v116 + 1])); - if ( v116 > 0 ) - { - v105 = 1; - do - { - v92 = v105; - v93 = v105 - 1; - v94 = v105 + 1; - v95 = v105 + 1; - if ( v105 - 1 >= v80 ) - v93 -= v80; - if ( v105 >= v80 ) - v92 = v105 - v80; - if ( v94 >= v80 ) - v95 = v94 - v80; - if ( (array_508690[v92].vWorldViewProjX - array_508690[v93].vWorldViewProjX) - * (array_508690[v95].vWorldViewProjY - array_508690[v93].vWorldViewProjY) - - (array_508690[v95].vWorldViewProjX - array_508690[v93].vWorldViewProjX) - * (array_508690[v92].vWorldViewProjY - array_508690[v93].vWorldViewProjY) < 0.0 ) - { - ++v105; - } - else - { - v96 = v105; - if ( v105 < v80 || (v96 = v105 - v80, v105 - v80 < v80) ) - memcpy(&array_508690[v96], &array_508690[v96 + 1], 4 * ((unsigned int)(48 * v80 - 48 * v96) >> 2)); - --v80; - } - } - while ( v105 - 1 < v80 ); - } - v91 = __OFSUB__(v80, 3); - v90 = v80 - 3 < 0; - } - if ( v90 ^ v91 ) -LABEL_112: - result = 0; - else - result = v80; - return result; -} - //----- (0042620A) -------------------------------------------------------- -bool __thiscall sr_42620A(RenderVertexSoft *p) +bool sr_42620A(RenderVertexSoft *p) { __int16 v1; // fps@1 unsigned __int8 v2; // c0@2 @@ -1219,28 +349,34 @@ v14 = 0; if ( v3 ) { - if ( !pActor->pMonsterInfo.uTreasureDiceRolls ) - goto LABEL_9; - do - { - ++v2; - v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1; - } - while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls ); + if ( pActor->pMonsterInfo.uTreasureDiceRolls ) + { + do + { + ++v2; + v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1; + } + while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls ); + if ( v14 ) + { + party_finds_gold(v14, 0); + viewparams->bRedrawGameUI = 1; + } + } } else { - if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType != 18 ) - goto LABEL_9; - v14 = pActor->array_000234[3].uSpecEnchantmentType; - pActor->array_000234[3].Reset(); + if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType == 18 ) + { + v14 = pActor->array_000234[3].uSpecEnchantmentType; + pActor->array_000234[3].Reset(); + if ( v14 ) + { + party_finds_gold(v14, 0); + viewparams->bRedrawGameUI = 1; + } + } } - if ( v14 ) - { - party_finds_gold(v14, 0); - viewparams->bRedrawGameUI = 1; - } -LABEL_9: if ( pActor->uCarriedItemID ) { Dst.Reset(); @@ -1285,7 +421,6 @@ } pActor->array_000234[1].Reset(); } -LABEL_55: pActor->Remove(); return; } @@ -1346,7 +481,9 @@ pActor->array_000234[1].Reset(); } if ( !v13 || rand() % 100 < 90 ) - goto LABEL_55; + { + pActor->Remove(); + } } //----- (00426E10) -------------------------------------------------------- @@ -1515,7 +652,7 @@ } while ( v17 ^ v18 ); if ( v2 ) - goto LABEL_61; + return v23[rand() % v2]; } v19 = 0; do @@ -1527,7 +664,6 @@ } while ( v19 < 4 ); if ( v2 ) -LABEL_61: result = v23[rand() % v2]; else result = 0; @@ -1751,6 +887,8 @@ { v14 = a4 + v9; v15 = ((v7 + 15) >> 1) + v7 + 15; + v13 = __OFSUB__(v14, v15); + v12 = v14 - v15 < 0; } else { @@ -1760,14 +898,15 @@ v11 = v7 + 15; v13 = __OFSUB__(v10, v11); v12 = v10 - v11 < 0; - goto LABEL_16; } - v14 = a4 + v9; - v15 = 2 * v7 + 30; + else + { + v14 = a4 + v9; + v15 = 2 * v7 + 30; + v13 = __OFSUB__(v14, v15); + v12 = v14 - v15 < 0; + } } - v13 = __OFSUB__(v14, v15); - v12 = v14 - v15 < 0; -LABEL_16: if ( v12 ^ v13 ) result = 0; else @@ -1872,25 +1011,29 @@ break; case 0: v6 = pActor->pMonsterInfo.uResFire; - goto LABEL_12; + v4 = v5; + break; case 1: v6 = pActor->pMonsterInfo.uResAir; - goto LABEL_12; + v4 = v5; + break; case 2: v6 = pActor->pMonsterInfo.uResWater; - goto LABEL_12; + v4 = v5; + break; case 3: v6 = pActor->pMonsterInfo.uResEarth; - goto LABEL_12; + v4 = v5; + break; case 6: v6 = pActor->pMonsterInfo.uResSpirit; break; case 7: v6 = pActor->pMonsterInfo.uResMind; - goto LABEL_12; + v4 = v5; + break; case 8: v6 = pActor->pMonsterInfo.uResBody; -LABEL_12: v4 = v5; break; case 9: @@ -1941,52 +1084,41 @@ case 0u: v3 = pActor; v4 = pActor->pMonsterInfo.uResFire; - goto LABEL_12; case 1u: v3 = pActor; v4 = pActor->pMonsterInfo.uResAir; - goto LABEL_12; case 2u: v3 = pActor; v4 = pActor->pMonsterInfo.uResWater; - goto LABEL_12; case 3u: v3 = pActor; v4 = pActor->pMonsterInfo.uResEarth; - goto LABEL_12; case 7u: v3 = pActor; v4 = pActor->pMonsterInfo.uResMind; - goto LABEL_12; case 6u: v3 = pActor; v4 = pActor->pMonsterInfo.uResSpirit; - goto LABEL_12; case 8u: v3 = pActor; v4 = pActor->pMonsterInfo.uResBody; - goto LABEL_12; case 9u: v3 = pActor; v4 = pActor->pMonsterInfo.uResLight; - goto LABEL_12; case 0xAu: v3 = pActor; v4 = pActor->pMonsterInfo.uResDark; - goto LABEL_12; case 4u: v3 = pActor; v4 = pActor->pMonsterInfo.uResPhysical; -LABEL_12: - if ( v4 < 200 ) - result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30; - else - result = 0; break; default: - result = 1; - break; + return 1; } + if ( v4 < 200 ) + result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30; + else + result = 0; return result; } @@ -2073,7 +1205,7 @@ //v31 = player->pEquipment.uBow; int bow_idx = player->pEquipment.uBow; - if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken()) + if (bow_idx && player->pInventoryItemList[bow_idx - 1].Broken()) bow_idx = 0; //v32 = 0; @@ -2085,7 +1217,7 @@ int main_hand_idx = player->pEquipment.uMainHand; if (main_hand_idx) { - auto item = &player->pInventoryItems[main_hand_idx - 1]; + auto item = &player->pInventoryItemList[main_hand_idx - 1]; //v5 = (char *)v1 + 36 * v4; if (!item->Broken()) { @@ -2144,9 +1276,9 @@ shooting_wand = true; int main_hand_idx = player->pEquipment.uMainHand; - _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); + _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItemList[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); - if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) + if (!--player->pInventoryItemList[main_hand_idx - 1].uNumCharges) player->pEquipment.uMainHand = 0; } else if (target_type == OBJECT_Actor && actor_distance <= 407.2) @@ -2201,7 +1333,7 @@ { int main_hand_idx = player->pEquipment.uMainHand; if (player->HasItemEquipped(EQUIP_MAIN_HAND)) - v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType; + v34 = pItemsTable->pItems[*(int *)&player->pInventoryItemList[main_hand_idx - 1]].uSkillType; pTurnEngine->ApplyPlayerAction(); } @@ -2440,7 +1572,6 @@ v13 = 0; if ( (signed int)uNumActors <= 0 ) { -LABEL_20: result = 0; } else @@ -2488,7 +1619,7 @@ ++v13; ++v1; if ( v13 >= (signed int)uNumActors ) - goto LABEL_20; + return 0; } result = 1; } @@ -2498,118 +1629,74 @@ //----- (0042F7EB) -------------------------------------------------------- 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) { - unsigned int v9; // edi@1 - signed int v10; // edx@3 - char *v11; // ecx@4 - unsigned __int16 v12; // ax@7 - unsigned int v13; // edx@9 - char *v14; // ecx@10 - int v15; // esi@17 - int v16; // eax@18 - int v17; // edi@20 - int v18; // esi@20 - //SpriteObject a1a; // [sp+Ch] [bp-78h]@1 - int v21; // [sp+7Ch] [bp-8h]@1 - unsigned int v22; // [sp+80h] [bp-4h]@1 - - v9 = uSpriteID; - v21 = x; - v22 = uSpriteID; + unsigned __int16 pObjectDescID; // ax@7 + SpriteObject pSpellObject; // [sp+Ch] [bp-78h]@1 - SpriteObject a1a; // [sp+Ch] [bp-78h]@1 - //SpriteObject::SpriteObject(&a1a); - a1a.stru_24.Reset(); - + pSpellObject.stru_24.Reset(); if ( a9 ) - { - memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24)); - v9 = v22; - } - v10 = 0; - a1a.spell_skill = 0; - a1a.spell_level = 0; - a1a.spell_id = 0; - a1a.field_54 = 0; - a1a.uType = v9; + memcpy(&pSpellObject.stru_24, a9, sizeof(pSpellObject.stru_24)); + pSpellObject.spell_skill = 0; + pSpellObject.spell_level = 0; + pSpellObject.spell_id = 0; + pSpellObject.field_54 = 0; + pSpellObject.uType = uSpriteID; if ( (signed int)pObjectList->uNumObjects <= 0 ) - { -LABEL_7: - v12 = 0; - } + pObjectDescID = 0; else { - v11 = (char *)&pObjectList->pObjects->uObjectID; - while ( (short)v9 != *(short *)v11 ) + pObjectDescID = 0; + for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i ) { - ++v10; - v11 += 56; - if ( v10 >= (signed int)pObjectList->uNumObjects ) - goto LABEL_7; - } - v12 = v10; - } - a1a.uObjectDescID = v12; - a1a.vPosition.z = z; - a1a.vPosition.x = v21; - a1a.vPosition.y = y; - a1a.uSoundID = 0; - a1a.uAttributes = attributes; - a1a.uSectorID = pIndoor->GetSector(v21, y, z); - a1a.uSpriteFrameID = 0; - a1a.spell_caster_pid = 0; - a1a.spell_target_pid = 0; - if ( !(a1a.uAttributes & 0x10) ) - { - v13 = 0; - if ( (signed int)pItemsTable->uAllItemsCount > 0 ) - { - v14 = (char *)&pItemsTable->pItems[0].uSpriteID; - while ( *(short *)v14 != v9 ) - { - ++v13; - v14 += 48; - if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount ) - goto LABEL_16; - } - a1a.stru_24.uItemID = v13; + if ( (short)uSpriteID == pObjectList->pObjects[i].uObjectID ) + pObjectDescID = i; } } -LABEL_16: + pSpellObject.uObjectDescID = pObjectDescID; + pSpellObject.vPosition.x = x; + pSpellObject.vPosition.y = y; + pSpellObject.vPosition.z = z; + pSpellObject.uSoundID = 0; + pSpellObject.uAttributes = attributes; + pSpellObject.uSectorID = pIndoor->GetSector(x, y, z); + pSpellObject.uSpriteFrameID = 0; + pSpellObject.spell_caster_pid = 0; + pSpellObject.spell_target_pid = 0; + if ( !(pSpellObject.uAttributes & 0x10) ) + { + if ( pItemsTable->uAllItemsCount ) + { + for ( uint i = 0; i < pItemsTable->uAllItemsCount; ++i ) + { + if ( pItemsTable->pItems[i].uSpriteID == uSpriteID ) + pSpellObject.stru_24.uItemID = i; + } + } + } if ( a7 ) { - v15 = count; if ( count > 0 ) { - do + for ( uint i = count; i; --i ) { - a1a.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; - v16 = rand(); - a1a.Create( - (signed __int16)a1a.uFacing, - ((signed int)stru_5C6E00->uIntegerHalfPi >> 1) + (v16 % (signed int)stru_5C6E00->uIntegerHalfPi >> 1), - a4, - 0); - --v15; + pSpellObject.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; + pSpellObject.Create((signed __int16)pSpellObject.uFacing, + ((signed int)stru_5C6E00->uIntegerHalfPi / 2) + (rand() % ((signed int)stru_5C6E00->uIntegerHalfPi / 2)), a4, 0); + } - while ( v15 ); } } else { - v17 = count; - v18 = stru_5C6E00->uIntegerHalfPi; - a1a.uFacing = 0; + pSpellObject.uFacing = 0; if ( count > 0 ) { - do + for ( uint i = count; i; --i ) { - a1a.Create((signed __int16)a1a.uFacing, v18, a4, 0); - --v17; + pSpellObject.Create((signed __int16)pSpellObject.uFacing, stru_5C6E00->uIntegerHalfPi, a4, 0); } - while ( v17 ); } } - return 1; + return true; } //----- (0042F960) --------------------------------------------------------