Mercurial > mm7
diff Indoor.cpp @ 1544:499761153844
stru149
author | Nomad |
---|---|
date | Sat, 07 Sep 2013 15:20:57 +0200 |
parents | 965af46e8793 |
children | c4ab816fcc5e |
line wrap: on
line diff
--- a/Indoor.cpp Sat Sep 07 13:26:15 2013 +0200 +++ b/Indoor.cpp Sat Sep 07 15:20:57 2013 +0200 @@ -4828,11 +4828,12 @@ } else { - LODWORD(v19) = pBLVRenderParams->field_40 << 16; + __debugbreak(); // sw rendering + /*LODWORD(v19) = pBLVRenderParams->field_40 << 16; HIDWORD(v19) = pBLVRenderParams->field_40 >> 16; v20 = v19 / x; v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v19 / x) >> 16; - v31 = (unsigned __int64)(v24->scale * (signed __int64)v20) >> 16; + v31 = (unsigned __int64)(v24->scale * (signed __int64)v20) >> 16;*/ } //HIWORD(v21) = HIWORD(x); //LOWORD(v21) = 0; @@ -4942,7 +4943,7 @@ } } //----- (0043FA33) -------------------------------------------------------- -void __fastcall PrepareDecorationsRenderList_BLV(unsigned int uDecorationID, unsigned int uSectorID) +void PrepareDecorationsRenderList_BLV(unsigned int uDecorationID, unsigned int uSectorID) { LevelDecoration *v2; // esi@1 DecorationDesc *v3; // ebx@2 @@ -5152,113 +5153,97 @@ } } //----- (0048653D) -------------------------------------------------------- -int stru149::_48653D(int a2, int a3, int a4, int a5, int a6, int a7)//portal frustum culling +void stru149::_48653D_frustum_blv(int a2, int a3, int a4, int a5, int a6, int a7)//portal frustum culling { - stru149 *v7; // esi@1 + //stru149 *v7; // esi@1 int v8; // edi@1 int v9; // eax@1 //int v10; // edx@1 //int v11; // ecx@1 - int v12; // eax@1 - int v13; // ebx@2 - int v14; // ecx@2 - int v15; // eax@2 + //int v12; // eax@1 + //int v13; // ebx@2 + //int v14; // ecx@2 + //int v15; // eax@2 int v16; // ST14_4@3 int v17; // ST10_4@3 - int v18; // eax@5 + //int v18; // eax@5 int v19; // ST10_4@6 - int v20; // eax@8 + //int v20; // eax@8 int v21; // ST10_4@9 - int v22; // eax@10 - int v23; // ecx@10 - int v24; // eax@10 - int result; // eax@10 + //int v22; // eax@10 + //int v23; // ecx@10 + //int v24; // eax@10 + //int result; // eax@10 //int v26; // [sp+14h] [bp-14h]@1 - int v27; // [sp+18h] [bp-10h]@1 + //int v27; // [sp+18h] [bp-10h]@1 int v28; // [sp+1Ch] [bp-Ch]@1 int v29; // [sp+24h] [bp-4h]@1 - int v30; // [sp+30h] [bp+8h]@10 - int v31; // [sp+3Ch] [bp+14h]@10 - - v7 = this; + //int v30; // [sp+30h] [bp+8h]@10 + //int v31; // [sp+3Ch] [bp+14h]@10 + v8 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotY); v29 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotY); v28 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotX); v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX); //v11 = -pBLVRenderParams->vPartyPos.y; //v26 = -pBLVRenderParams->vPartyPos.x; - v27 = v9; - v12 = -pBLVRenderParams->vPartyPos.z; + //v27 = v9; + //v12 = -pBLVRenderParams->vPartyPos.z; if ( pBLVRenderParams->sPartyRotX ) { v16 = v8 * -pBLVRenderParams->vPartyPos.x + v29 * -pBLVRenderParams->vPartyPos.y; - v13 = v28; v17 = -65536 * pBLVRenderParams->vPartyPos.z; - v7->field_0_party_dir_x = ((unsigned __int64)(v16 * (signed __int64)v28) >> 16) - + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)v27) >> 16); - v7->field_4_party_dir_y = v8 * -pBLVRenderParams->vPartyPos.y - v29 * -pBLVRenderParams->vPartyPos.x; - v14 = v27; - v15 = ((unsigned __int64)(v17 * (signed __int64)v28) >> 16) - ((unsigned __int64)(v16 * (signed __int64)v27) >> 16); + this->field_0_party_dir_x = fixpoint_sub0(v16, v28) + fixpoint_sub0((-pBLVRenderParams->vPartyPos.z) << 16, v9); + this->field_4_party_dir_y = v8 * -pBLVRenderParams->vPartyPos.y - v29 * -pBLVRenderParams->vPartyPos.x; + this->field_8_party_dir_z = fixpoint_sub0(v17, v28) - fixpoint_sub0(v16, v9); } else { - v7->field_0_party_dir_x = v8 * -pBLVRenderParams->vPartyPos.x + v29 * -pBLVRenderParams->vPartyPos.y; - v13 = v28; - v7->field_4_party_dir_y = v8 * -pBLVRenderParams->vPartyPos.y - v29 * -pBLVRenderParams->vPartyPos.x; - v14 = v27; - v15 = v12 << 16; + this->field_0_party_dir_x = v8 * -pBLVRenderParams->vPartyPos.x + v29 * -pBLVRenderParams->vPartyPos.y; + this->field_4_party_dir_y = v8 * -pBLVRenderParams->vPartyPos.y - v29 * -pBLVRenderParams->vPartyPos.x; + this->field_8_party_dir_z = (-pBLVRenderParams->vPartyPos.z) << 16; } - v7->field_8 = v15; - if ( pBLVRenderParams->sPartyRotX ) + + if (pBLVRenderParams->sPartyRotX) { - v19 = ((unsigned __int64)(a2 * (signed __int64)v8) >> 16) + ((unsigned __int64)(a3 * (signed __int64)v29) >> 16); - v7->field_C = ((unsigned __int64)(v19 * (signed __int64)v13) >> 16) - + ((unsigned __int64)(a4 * (signed __int64)v14) >> 16); - v7->field_10 = ((unsigned __int64)(a3 * (signed __int64)v8) >> 16) - - ((unsigned __int64)(a2 * (signed __int64)v29) >> 16); - v18 = ((unsigned __int64)(a4 * (signed __int64)v13) >> 16) - ((unsigned __int64)(v19 * (signed __int64)v14) >> 16); + v19 = fixpoint_sub0(a2, v8) + fixpoint_sub0(a3, v29); + + this->field_C = fixpoint_sub0(v19, v28) + fixpoint_sub0(a4, v9); + this->field_10 = fixpoint_sub0(a3, v8) - fixpoint_sub0(a2, v29); + this->field_14 = fixpoint_sub0(a4, v28) - fixpoint_sub0(v19, v9); } else { - v7->field_C = ((unsigned __int64)(a2 * (signed __int64)v8) >> 16) - + ((unsigned __int64)(a3 * (signed __int64)v29) >> 16); - v7->field_10 = ((unsigned __int64)(a3 * (signed __int64)v8) >> 16) - - ((unsigned __int64)(a2 * (signed __int64)v29) >> 16); - v18 = a4; + this->field_C = fixpoint_sub0(a2, v8) + fixpoint_sub0(a3, v29); + this->field_10 = fixpoint_sub0(a3, v8) - fixpoint_sub0(a2, v29); + this->field_14 = a4; } - v7->field_14 = v18; - if ( pBLVRenderParams->sPartyRotX ) + + if (pBLVRenderParams->sPartyRotX) { - v21 = ((unsigned __int64)(a5 * (signed __int64)v8) >> 16) + ((unsigned __int64)(a6 * (signed __int64)v29) >> 16); - v7->field_18 = ((unsigned __int64)(v21 * (signed __int64)v13) >> 16) - + ((unsigned __int64)(a7 * (signed __int64)v14) >> 16); - v7->field_1C = ((unsigned __int64)(a6 * (signed __int64)v8) >> 16) - - ((unsigned __int64)(a5 * (signed __int64)v29) >> 16); - v20 = ((unsigned __int64)(a7 * (signed __int64)v13) >> 16) - ((unsigned __int64)(v21 * (signed __int64)v14) >> 16); + v21 = fixpoint_sub0(a5, v8) + fixpoint_sub0(a6, v29); + + this->field_18 = fixpoint_sub0(v21, v28) + fixpoint_sub0(a7, v9); + this->field_1C = fixpoint_sub0(a6, v8) - fixpoint_sub0(a5, v29); + this->field_20 = fixpoint_sub0(a7, v28) - fixpoint_sub0(v21, v9); } else { - v7->field_18 = ((unsigned __int64)(a5 * (signed __int64)v8) >> 16) - + ((unsigned __int64)(a6 * (signed __int64)v29) >> 16); - v7->field_1C = ((unsigned __int64)(a6 * (signed __int64)v8) >> 16) - - ((unsigned __int64)(a5 * (signed __int64)v29) >> 16); - v20 = a7; + this->field_18 = fixpoint_sub0(a5, v8) + fixpoint_sub0(a6, v29); + this->field_1C = fixpoint_sub0(a6, v8) - fixpoint_sub0(a5, v29); + this->field_20 = a7; } - v7->field_18 = -v7->field_18; - v7->field_1C = -v7->field_1C; - v7->field_20 = v20; - v22 = v7->field_C; - v7->field_20 = -v7->field_20; - v23 = ((unsigned __int64)(v22 * (signed __int64)v7->field_0_party_dir_x) >> 16) - + ((unsigned __int64)(v7->field_10 * (signed __int64)v7->field_4_party_dir_y) >> 16) - + ((unsigned __int64)(v7->field_14 * (signed __int64)v7->field_8) >> 16); - v30 = v7->field_18; - v24 = v7->field_0_party_dir_x; - v7->field_24 = v23; - v31 = (unsigned __int64)(v30 * (signed __int64)v24) >> 16; - result = (unsigned __int64)(v7->field_1C * (signed __int64)v7->field_4_party_dir_y) >> 16; - v7->field_28 = v31 + result + ((unsigned __int64)(v7->field_20 * (signed __int64)v7->field_8) >> 16); - return result; + + this->field_18 = -this->field_18; + this->field_1C = -this->field_1C; + this->field_20 = -this->field_20; + + this->field_24 = fixpoint_dot(this->field_C, this->field_0_party_dir_x, + this->field_10, this->field_4_party_dir_y, + this->field_14, this->field_8_party_dir_z); + this->field_28 = fixpoint_dot(this->field_18, this->field_0_party_dir_x, + this->field_1C, this->field_4_party_dir_y, + this->field_20, this->field_8_party_dir_z); } //----- (00407A1C) -------------------------------------------------------- bool __fastcall sub_407A1C(int x, int z, int y, Vec3_int_ v) @@ -5373,7 +5358,7 @@ int v112; // [sp+18h] [bp-64h]@128 signed int v113; // [sp+20h] [bp-5Ch]@1 signed int v114; // [sp+24h] [bp-58h]@1 - unsigned __int64 a4; // [sp+28h] [bp-54h]@1 + //unsigned __int64 a4; // [sp+28h] [bp-54h]@1 unsigned int a4_8; // [sp+30h] [bp-4Ch]@1 int v117; // [sp+34h] [bp-48h]@4 int v118; // [sp+34h] [bp-48h]@39 @@ -5442,13 +5427,13 @@ __debugbreak(); - a4 = __PAIR__(z, x); v4 = stru_5C6E00->Atan2(v.x - x, v.y - z); v114 = 0; v97.z = y; + v97.x = x; + v97.y = z; v113 = 0; a4_8 = v4; - *(_QWORD *)&v97.x = a4; if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) { Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz); @@ -5602,10 +5587,12 @@ v54 = pOut.x; } v72.z = y; - *(_QWORD *)&v72.x = a4; + v72.x = x; + v72.y = z; Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v72, &pOut.x, &pOut.y, &outz); v73.z = v.z; - *(_QWORD *)&v73.x = *(_QWORD *)&v; + v73.x = v.x; + v73.y = v.y; Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v73, &outx, &outy, &v163); v74 = outy - pOut.y; v75 = v163 - outz; @@ -5892,10 +5879,12 @@ } LABEL_37: v27.z = y; - *(_QWORD *)&v27.x = a4; + v27.x = x; + v27.y = z; Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v27, &pOut.x, &pOut.y, &outz); v28.z = v.z; - *(_QWORD *)&v28.x = *(_QWORD *)&v; + v28.x = v.x; + v28.y = v.y; Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v28, &outx, &outy, &v163); v29 = outy - pOut.y; v30 = v163 - outz;