Mercurial > mm7
diff Indoor.cpp @ 1391:cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
stru148 -> struct Polygon
author | Nomad |
---|---|
date | Thu, 18 Jul 2013 14:42:54 +0200 |
parents | 613c77e51e38 |
children | 8ea496564034 |
line wrap: on
line diff
--- a/Indoor.cpp Thu Jul 18 04:08:20 2013 +0200 +++ b/Indoor.cpp Thu Jul 18 14:42:54 2013 +0200 @@ -314,8 +314,9 @@ } else for (uint j = 0; j < pBspRenderer->num_faces; ++j ) { - pBLVRenderParams->field_7C = &pBspRenderer->nodes[pBspRenderer->faces[j].uNodeID].PortalScreenData; - IndoorLocation::ExecDraw_sw(pBspRenderer->faces[j].uFaceID); + __debugbreak(); // no SW + //pBLVRenderParams->field_7C = &pBspRenderer->nodes[pBspRenderer->faces[j].uNodeID].PortalScreenData; + //IndoorLocation::ExecDraw_sw(pBspRenderer->faces[j].uFaceID); } } @@ -598,619 +599,6 @@ } } -//----- (004AFF79) -------------------------------------------------------- -void IndoorLocation::ExecDraw_sw(unsigned int uFaceID) -{ - unsigned int v1; // ebx@1 - BLVFace *v2; // esi@3 - unsigned int v3; // eax@3 - Texture *v4; // eax@8 - Texture *v5; // edi@8 - int v6; // eax@9 - int v7; // eax@9 - int v8; // ecx@17 - int v9; // ebx@17 - int v10; // eax@17 - int v11; // esi@17 - unsigned int v12; // eax@17 - int j; // ecx@19 - int v14; // edx@20 - int v15; // eax@20 - int v16; // edx@20 - int i; // ebx@22 - int v18; // ecx@23 - int v19; // eax@23 - int v20; // eax@23 - int v21; // eax@24 - unsigned __int8 *v22; // ecx@24 - int v23; // ebx@24 - int v24; // esi@25 - int v25; // eax@28 - unsigned __int16 *v26; // eax@28 - unsigned int v27; // eax@29 - int v28; // eax@30 - char *v29; // esi@31 - int v30; // eax@33 - int v31; // eax@33 - int v32; // eax@35 - int v33; // edx@35 - signed int v34; // ebx@35 - int v35; // eax@35 - int v36; // ebx@35 - signed int v37; // ebx@35 - signed int v38; // edi@35 - unsigned int v39; // edi@36 - int v40; // edx@40 - int v41; // ecx@40 - signed int v42; // edx@40 - int v43; // edx@42 - int v44; // eax@42 - unsigned __int16 *v45; // eax@43 - int *v46; // esi@44 - unsigned __int16 *v47; // edi@44 - unsigned int v48; // edx@44 - int v49; // ebx@44 - char v50; // cl@44 - char v51; // ch@44 - unsigned int v52; // ebx@46 - int v53; // edx@46 - unsigned int v54; // ebx@46 - int v55; // edx@46 - unsigned int v56; // ebx@47 - int v57; // edx@47 - int v58; // ebx@47 - int v59; // edx@47 - unsigned __int16 *v60; // eax@50 - int *v61; // esi@51 - unsigned __int16 *v62; // edi@51 - unsigned int v63; // edx@51 - int v64; // ebx@51 - char v65; // cl@51 - char v66; // ch@51 - unsigned int v67; // ebx@53 - int v68; // edx@53 - unsigned int v69; // ebx@53 - int v70; // edx@53 - unsigned int v71; // ebx@54 - int v72; // edx@54 - int v73; // ebx@54 - int v74; // edx@54 - unsigned __int16 *v75; // eax@58 - int *v76; // esi@59 - int v77; // edi@59 - unsigned int v78; // edx@59 - int v79; // ebx@59 - char v80; // cl@59 - char v81; // ch@59 - int v82; // ebx@61 - int v83; // edx@61 - unsigned int v84; // ebx@62 - int v85; // edx@62 - unsigned __int16 *v86; // eax@65 - int *v87; // esi@66 - int v88; // edi@66 - unsigned int v89; // edx@66 - int v90; // ebx@66 - char v91; // cl@66 - char v92; // ch@66 - int v93; // ebx@68 - int v94; // edx@68 - unsigned __int16 v95; // bx@69 - int v96; // edx@69 - unsigned __int8 *v97; // [sp+Ch] [bp-9Ch]@24 - unsigned __int8 *v98; // [sp+10h] [bp-98h]@24 - unsigned __int8 *v99; // [sp+14h] [bp-94h]@24 - unsigned __int8 *v100; // [sp+18h] [bp-90h]@24 - int v101; // [sp+1Ch] [bp-8Ch]@40 - int v102; // [sp+20h] [bp-88h]@31 - BLVFace *v103; // [sp+24h] [bp-84h]@3 - unsigned __int16 *v104; // [sp+28h] [bp-80h]@24 - int v105; // [sp+2Ch] [bp-7Ch]@30 - int v106; // [sp+30h] [bp-78h]@24 - int v107; // [sp+34h] [bp-74h]@9 - Texture *v108; // [sp+38h] [bp-70h]@8 - int v109; // [sp+3Ch] [bp-6Ch]@9 - unsigned int v110; // [sp+40h] [bp-68h]@24 - unsigned int v111; // [sp+44h] [bp-64h]@1 - int *k; // [sp+48h] [bp-60h]@31 - int v113; // [sp+4Ch] [bp-5Ch]@35 - int v114; // [sp+50h] [bp-58h]@35 - int v115; // [sp+54h] [bp-54h]@42 - unsigned __int8 *v116; // [sp+58h] [bp-50h]@35 - int v117; // [sp+5Ch] [bp-4Ch]@33 - int a1; // [sp+60h] [bp-48h]@27 - int v119; // [sp+64h] [bp-44h]@17 - int v120; // [sp+68h] [bp-40h]@23 - unsigned int v121; // [sp+6Ch] [bp-3Ch]@40 - unsigned int v122; // [sp+70h] [bp-38h]@35 - int v123; // [sp+74h] [bp-34h]@30 - int v124; // [sp+78h] [bp-30h]@17 - int v125; // [sp+7Ch] [bp-2Ch]@35 - unsigned int v126; // [sp+80h] [bp-28h]@9 - int v127; // [sp+84h] [bp-24h]@17 - int v128; // [sp+88h] [bp-20h]@9 - int *pZPixel; // [sp+8Ch] [bp-1Ch]@28 - int a2; // [sp+90h] [bp-18h]@16 - unsigned int v131; // [sp+94h] [bp-14h]@17 - unsigned __int16 *pColorPixel; // [sp+98h] [bp-10h]@28 - int v133; // [sp+9Ch] [bp-Ch]@17 - int v134; // [sp+A0h] [bp-8h]@17 - int v135; // [sp+A4h] [bp-4h]@24 - - v1 = uFaceID; - v111 = pRenderer->uTargetSurfacePitch; - if ( (uFaceID & 0x80000000u) == 0 ) - { - if ( (signed int)uFaceID < (signed int)pIndoor->uNumFaces ) - { - v2 = &pIndoor->pFaces[uFaceID]; - v103 = v2; - v3 = v2->uAttributes; - if ( !(BYTE1(v3) & 0x20) ) - { - if ( v3 & 0x400000 ) - { - sub_4ADD1D(uFaceID); - return; - } - if ( !(v3 & 0x10) || (sub_4AD504(uFaceID), pRenderer->pRenderD3D) ) - { - v4 = v2->GetTexture(); - ++pBLVRenderParams->uNumFacesRenderedThisFrame; - v5 = v4; - v108 = v4; - if ( v4 ) - { - v6 = v4->palette_id2; - LOBYTE(v2->uAttributes) |= 0x80u; - v109 = v6; - sub_4AE5F1(v1); - v126 = stru_F8AD28.pDeltaUV[0]; - v128 = stru_F8AD28.pDeltaUV[1]; - v107 = bUseLoResSprites; - v7 = GetPortalScreenCoord(v1); - if ( v7 ) - { - if ( PortalFrustrum(v7, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) - { - if ( v2->uPolygonType == 1 ) - { - for ( i = 0; i < stru_F8AD28.uNumLightsApplied; stru_F8AD28._blv_lights_ys[v18] = v20 ) - { - v18 = i; - v120 = stru_F8AD28._blv_lights_xs[i]; - v134 = (unsigned __int64)(v120 * (signed __int64)-stru_F8AD28.plane_4.vNormal.y) >> 16; - v133 = stru_F8AD28.plane_4.vNormal.x; - v120 = stru_F8AD28._blv_lights_ys[i]; - v133 = (unsigned __int64)(v120 * (signed __int64)stru_F8AD28.plane_4.vNormal.x) >> 16; - v19 = v128; - stru_F8AD28._blv_lights_xs[i] = v126 - + v134 - + ((unsigned __int64)(v120 - * (signed __int64)stru_F8AD28.plane_4.vNormal.x) >> 16); - v20 = v19 - stru_F8AD28._blv_lights_zs[i++]; - } - } - else - { - if ( v2->uPolygonType != 3 ) - { - if ( v2->uPolygonType == 4 ) - { -LABEL_16: - a2 = 0; - if ( stru_F8AD28.uNumLightsApplied > 0 ) - { - do - { - v8 = a2; - v9 = stru_F8AD28._blv_lights_xs[a2]; - v131 = stru_F8AD28._blv_lights_ys[a2]; - v10 = stru_F8AD28._blv_lights_zs[a2]; - v11 = (signed int)(v10 * stru_F8AD28.plane_4.vNormal.z - + stru_F8AD28.plane_4.dist - + v9 * stru_F8AD28.plane_4.vNormal.x - + v131 * stru_F8AD28.plane_4.vNormal.y) >> 16; - v119 = v9 - - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x - * (signed __int64)((signed int)(v10 * stru_F8AD28.plane_4.vNormal.z - + stru_F8AD28.plane_4.dist - + v9 * stru_F8AD28.plane_4.vNormal.x - + v131 * stru_F8AD28.plane_4.vNormal.y) >> 16)) >> 16); - v131 -= (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)v11) >> 16; - v127 = v10 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)v11) >> 16); - stru_F8AD28._blv_lights_xs[a2] = ((unsigned __int64)(v119 - * (signed __int64)stru_F8AD28.vec_14.x) >> 16) - + ((unsigned __int64)((signed int)v131 - * (signed __int64)stru_F8AD28.vec_14.y) >> 16); - v124 = (unsigned __int64)(v119 * (signed __int64)stru_F8AD28.vec_20.x) >> 16; - v134 = (unsigned __int64)((signed int)v131 * (signed __int64)stru_F8AD28.vec_20.y) >> 16; - v133 = (unsigned __int64)(v127 * (signed __int64)stru_F8AD28.vec_20.z) >> 16; - v12 = v126; - stru_F8AD28._blv_lights_ys[v8] = v124 - + ((unsigned __int64)((signed int)v131 - * (signed __int64)stru_F8AD28.vec_20.y) >> 16) - + ((unsigned __int64)(v127 - * (signed __int64)stru_F8AD28.vec_20.z) >> 16); - stru_F8AD28._blv_lights_xs[v8] += v12; - stru_F8AD28._blv_lights_ys[v8] += v128; - ++a2; - } - while ( a2 < stru_F8AD28.uNumLightsApplied ); - v2 = v103; - } - goto LABEL_24; - } - if ( v2->uPolygonType != 5 ) - { - if ( v2->uPolygonType != 6 ) - goto LABEL_24; - goto LABEL_16; - } - } - for ( j = 0; j < stru_F8AD28.uNumLightsApplied; *(int *)v15 = v16 ) - { - v14 = v128; - stru_F8AD28._blv_lights_xs[j] += v126; - v15 = 4 * j + 16297672; - v16 = v14 - stru_F8AD28._blv_lights_ys[j++]; - } - } -LABEL_24: - v135 = 1; - pGame->_44ED0A(v2, &v135, 31); - v104 = sr_sub_47C24C_get_palette(v2, v109, 0, 1); - v134 = stru_F8AD28.field_44; - v106 = stru_F8AD28.field_48; - v21 = stru_F8A590._viewport_space_y; - a2 = stru_F8A590._viewport_space_y; - v110 = v111 * stru_F8A590._viewport_space_y; - v97 = v5->pLevelOfDetail0_prolly_alpha_mask; - v98 = v5->pLevelOfDetail1; - v99 = v5->pLevelOfDetail2; - v22 = v5->pLevelOfDetail3; - v23 = 640 * stru_F8A590._viewport_space_y; - v119 = 640 * stru_F8A590._viewport_space_y; - v100 = v22; - if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) - { - v24 = 2 * stru_F8A590._viewport_space_y; - v120 = 2 * stru_F8A590._viewport_space_y; - while ( 1 ) - { - a1 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v24); - sub_4AE313(a1, v21, &stru_F81018.field_0); - if ( LOBYTE(viewparams->field_20) ) - { - v27 = v111 * (v24 - pBLVRenderParams->uViewportY); - pZPixel = &pBLVRenderParams->pTargetZBuffer[2 - * (*(__int16 *)((char *)stru_F8A590.viewport_left_side + v24) - + 320 * (v24 - pBLVRenderParams->uViewportY)) - - pBLVRenderParams->uViewportX]; - pColorPixel = &pBLVRenderParams->pRenderTarget[v27 - + 2 * *(__int16 *)((char *)stru_F8A590.viewport_left_side + v24) - - pBLVRenderParams->uViewportX]; - v26 = &pBLVRenderParams->pRenderTarget[v27 - + 2 * *(__int16 *)((char *)stru_F8A590.viewport_right_side + v24) - - pBLVRenderParams->uViewportX]; - v23 = v119; - } - else - { - v25 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v24); - pZPixel = &pBLVRenderParams->pTargetZBuffer[v25 + v23]; - pColorPixel = &pBLVRenderParams->pRenderTarget[v25 + v110]; - v26 = &pBLVRenderParams->pRenderTarget[v110 + *(__int16 *)((char *)stru_F8A590.viewport_right_side + v24)]; - } - v131 = (unsigned int)v26; - HIWORD(v28) = HIWORD(stru_F81018.field_0.field_0); - LOWORD(v28) = 0; - v105 = stru_F8AD28.field_0 | v28; - v123 = sub_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); - if ( (unsigned int)pColorPixel < v131 ) - { - v102 = v107 + v106; - v29 = (char *)&stru_F81018.field_34.field_8; - a1 += v134; - for ( k = &stru_F81018.field_34.field_8; ; v29 = (char *)k ) - { - sub_4AE313(a1, a2, (stru337_stru0 *)(v29 - 8)); - v30 = *((int *)v29 - 2); - LOWORD(v30) = 0; - v117 = v105; - v31 = stru_F8AD28.field_0 | v30; - if ( v105 <= (unsigned int)v31 ) - v117 = v31; - v105 = v31; - v32 = *((int *)v29 - 14); - v122 = *((int *)v29 - 14) >> v107; - v33 = *((int *)v29 - 13); - v125 = *((int *)v29 - 13) >> v107; - v34 = *((int *)v29 - 1) - v32; - v113 = (*(int *)v29 - v33) >> v102; - v35 = *((int *)v29 - 11); - v114 = v34 >> v102; - v116 = (&v97)[4 * v35]; - v36 = v35 + 16 - v5->uWidthLn2; - v133 = v35 + 16; - v127 = v35 + v36; - v37 = v5->uWidthMinus1 >> v35; - v38 = v5->uHeightMinus1 >> v35 << (v35 + 16); - v128 = v37; - v126 = v38; - v39 = (unsigned int)(LOBYTE(viewparams->field_20) ? &pColorPixel[2 * v134] : &pColorPixel[v134]); - if ( v39 > v131 ) - v39 = v131; - v40 = *((short *)v29 + 1); - v41 = *((short *)v29 - 1); - v121 = v39; - v42 = sub_4AE491(v41, v40); - v101 = v42; - v124 = (signed int)(v39 - (int)pColorPixel) >> 1; - if ( v123 >> 16 == v42 >> 16 || v135 & 2 ) - { - v123 = (int)sr_sub_47C24C_get_palette(v103, v109, v123 >> 16, 1); - if ( LOBYTE(viewparams->field_20) ) - { - v86 = pColorPixel; - if ( (unsigned int)pColorPixel < v121 ) - { - v87 = pZPixel; - v88 = v123; - v89 = v122; - v90 = v125; - v91 = v133; - v92 = v127; - if ( v124 & 2 ) - { - *pZPixel = v117; - v87 -= 2; - v86 = pColorPixel + 2; - goto LABEL_69; - } - do - { - v86 += 4; - v93 = *(&v116[v128 & (v89 >> v91)] + ((v126 & v90) >> v92)); - v94 = v117; - LOWORD(v93) = *(short *)(v88 + 2 * v93); - *v87 = v117; - v87[1] = v94; - v87[640] = v94; - v87[641] = v94; - *(v86 - 4) = v93; - *(v86 - 3) = v93; - v86[636] = v93; - v86[637] = v93; - v87[2] = v94; - v87[3] = v94; - v87[642] = v94; - v87[643] = v94; - v122 += v114; - v125 += v113; - v89 = v122; - v90 = v125; -LABEL_69: - v87 += 4; - v95 = *(short *)(v88 + 2 * *(&v116[v128 & (v89 >> v91)] + ((v126 & v90) >> v92))); - v96 = v114; - *(v86 - 2) = v95; - *(v86 - 1) = v95; - v86[638] = v95; - v86[639] = v95; - v122 += v96; - v125 += v113; - v89 = v122; - v90 = v125; - } - while ( (unsigned int)v86 < v121 ); - pColorPixel = v86; - pZPixel = v87; - } - } - else - { - v75 = pColorPixel; - if ( (unsigned int)pColorPixel < v121 ) - { - v76 = pZPixel; - v77 = v123; - v78 = v122; - v79 = v125; - v80 = v133; - v81 = v127; - if ( v124 & 1 ) - { - *pZPixel = v117; - --v76; - v75 = pColorPixel + 1; - goto LABEL_62; - } - do - { - v75 += 2; - v82 = *(&v116[v128 & (v78 >> v80)] + ((v126 & v79) >> v81)); - v83 = v117; - LOWORD(v82) = *(short *)(v77 + 2 * v82); - *v76 = v117; - *(v75 - 2) = v82; - v76[1] = v83; - v122 += v114; - v125 += v113; - v78 = v122; - v79 = v125; -LABEL_62: - v84 = (unsigned int)(&v116[v128 & (v78 >> v80)] + ((v126 & v79) >> v81)); - v76 += 2; - v85 = v114; - *(v75 - 1) = *(short *)(v77 + 2 * *(char *)v84); - v122 += v85; - v125 += v113; - v78 = v122; - v79 = v125; - } - while ( (unsigned int)v75 < v121 ); - pColorPixel = v75; - pZPixel = v76; - } - } - } - else - { - v43 = (v42 - v123) >> v106; - v44 = v123 - v43; - v123 = v43; - v115 = v44; - if ( LOBYTE(viewparams->field_20) ) - { - v60 = pColorPixel; - if ( (unsigned int)pColorPixel < v121 ) - { - v61 = pZPixel; - v62 = v104; - v63 = v122; - v64 = v125; - v65 = v133; - v66 = v127; - if ( v124 & 2 ) - { - *pZPixel = v117; - v61 += 2; - v60 = pColorPixel + 2; - goto LABEL_54; - } - do - { - v67 = (v128 & (v63 >> v65)) + ((v126 & v64) >> v66); - v68 = v123 + v115; - v60 += 4; - v115 = v68; - v69 = ((v68 & 0xFFFF0000u) >> 8) + v116[v67]; - v70 = v117; - LOWORD(v69) = v62[v69]; - *v61 = v117; - v61[1] = v70; - v61[640] = v70; - v61[641] = v70; - *(v60 - 4) = v69; - *(v60 - 3) = v69; - v60[636] = v69; - v60[637] = v69; - v61[2] = v70; - v61[3] = v70; - v61[642] = v70; - v61[643] = v70; - v122 += v114; - v125 += v113; - v63 = v122; - v64 = v125; - v61 += 4; -LABEL_54: - v71 = (v128 & (v63 >> v65)) + ((v126 & v64) >> v66); - v72 = v123 + v115; - v73 = v116[v71]; - v115 = v72; - LOWORD(v73) = v62[((v72 & 0xFFFF0000u) >> 8) + v73]; - v74 = v114; - *(v60 - 2) = v73; - *(v60 - 1) = v73; - v60[638] = v73; - v60[639] = v73; - v122 += v74; - v125 += v113; - v63 = v122; - v64 = v125; - } - while ( (unsigned int)v60 < v121 ); - pColorPixel = v60; - pZPixel = v61; - } - } - else - { - v45 = pColorPixel; - if ( (unsigned int)pColorPixel < v121 ) - { - v46 = pZPixel; - v47 = v104; - v48 = v122; - v49 = v125; - v50 = v133; - v51 = v127; - if ( v124 & 1 ) - { - *pZPixel = v117; - ++v46; - v45 = pColorPixel + 1; - goto LABEL_47; - } - do - { - v52 = (v128 & (v48 >> v50)) + ((v126 & v49) >> v51); - v53 = v123 + v115; - v45 += 2; - v115 = v53; - v54 = ((v53 & 0xFFFF0000u) >> 8) + v116[v52]; - v55 = v117; - LOWORD(v54) = v47[v54]; - *v46 = v117; - *(v45 - 2) = v54; - v46[1] = v55; - v122 += v114; - v125 += v113; - v48 = v122; - v49 = v125; - v46 += 2; -LABEL_47: - v56 = (v128 & (v48 >> v50)) + ((v126 & v49) >> v51); - v57 = v123 + v115; - v58 = v116[v56]; - v115 = v57; - LOWORD(v58) = v47[((v57 & 0xFFFF0000u) >> 8) + v58]; - v59 = v114; - *(v45 - 1) = v58; - v122 += v59; - v125 += v113; - v48 = v122; - v49 = v125; - } - while ( (unsigned int)v45 < v121 ); - pColorPixel = v45; - pZPixel = v46; - } - } - } - k += 13; - v5 = v108; - v123 = v101; - a1 += v134; - if ( (unsigned int)pColorPixel >= v131 ) - break; - } - v23 = v119; - v24 = v120; - } - ++a2; - v110 += v111; - v23 += 640; - v24 += 2; - v120 = v24; - v119 = v23; - if ( a2 > stru_F8A590._viewport_space_w ) - break; - v21 = a2; - } - } - return; - } - } - } - } - } - } - } -} -// 4AE491: using guessed type int __fastcall sub_4AE491(int, int);