Mercurial > mm7
changeset 1544:499761153844
stru149
author | Nomad |
---|---|
date | Sat, 07 Sep 2013 15:20:57 +0200 |
parents | 888157f45502 |
children | c4ab816fcc5e |
files | Indoor.cpp Math.h Outdoor_stuff.h Render.cpp _deleted.cpp mm7_1.cpp mm7_3.cpp mm7_data.h |
diffstat | 8 files changed, 156 insertions(+), 176 deletions(-) [+] |
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;
--- a/Math.h Sat Sep 07 13:26:15 2013 +0200 +++ b/Math.h Sat Sep 07 15:20:57 2013 +0200 @@ -25,6 +25,7 @@ #pragma pack(pop) int fixpoint_sub0(int, int); +int fixpoint_dot(int x1, int x2, int y1, int y2, int z1, int z2); int fixpoint_div(int, int); int fixpoint_mul(int, int); int fixpoint_from_float(float value);
--- a/Outdoor_stuff.h Sat Sep 07 13:26:15 2013 +0200 +++ b/Outdoor_stuff.h Sat Sep 07 15:20:57 2013 +0200 @@ -68,13 +68,13 @@ #pragma pack(push, 1) struct stru149 { - int _48616B(int a2, int a3, int a4, int a5, int a6, int a7); - int _48653D(int a2, int a3, int a4, int a5, int a6, int a7); - void Inverse_sky_48694B(); + void _48616B_frustum_odm(int a2, int a3, int a4, int a5, int a6, int a7); + void _48653D_frustum_blv(int a2, int a3, int a4, int a5, int a6, int a7); + void _48694B_frustum_sky(); int field_0_party_dir_x; int field_4_party_dir_y; - int field_8; + int field_8_party_dir_z; int field_C; int field_10; int field_14;
--- a/Render.cpp Sat Sep 07 13:26:15 2013 +0200 +++ b/Render.cpp Sat Sep 07 15:20:57 2013 +0200 @@ -5145,7 +5145,7 @@ v7 = pFace->uPolygonType; if ( v7 == 4 || v7 == 3 ) v70 = v6; - stru_8019C8._48653D(65536, 0, 0, 0, 65536, 0); + stru_8019C8._48653D_frustum_blv(65536, 0, 0, 0, 65536, 0); v62.Create_48607B(&stru_8019C8); v62.uTileBitmapID = pFace->uBitmapID; v62.pTexture = (Texture *)((signed __int16)v62.uTileBitmapID != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62.uTileBitmapID] : 0);
--- a/_deleted.cpp Sat Sep 07 13:26:15 2013 +0200 +++ b/_deleted.cpp Sat Sep 07 15:20:57 2013 +0200 @@ -2120,7 +2120,7 @@ return; array_77EC08[1999].Create_48607B(&stru_8019C8); - array_77EC08[1999].ptr_38->Inverse_sky_48694B(); + array_77EC08[1999].ptr_38->_48694B_frustum_sky(); if (pOutdoor->uMainTile_BitmapID == -1) { @@ -2143,7 +2143,7 @@ cos((double)pIndoorCamera->sRotationX * 0.0030664064); sin((double)pIndoorCamera->sRotationX * 0.0030664064); array_77EC08[1999].Create_48607B(&stru_8019C8); - array_77EC08[1999].ptr_38->Inverse_sky_48694B(); + array_77EC08[1999].ptr_38->_48694B_frustum_sky(); if (pOutdoor->uSky_TextureID == -1) {
--- a/mm7_1.cpp Sat Sep 07 13:26:15 2013 +0200 +++ b/mm7_1.cpp Sat Sep 07 15:20:57 2013 +0200 @@ -68,6 +68,13 @@ return ((__int64)a1 * (__int64)a2) >> 16; } +int fixpoint_dot(int x1, int x2, int y1, int y2, int z1, int z2) +{ + return fixpoint_sub0(x1, x2) + + fixpoint_sub0(y1, y2) + + fixpoint_sub0(z1, z2); +} + //----- (0041D20D) -------------------------------------------------------- void __fastcall sub_41D20D_buff_remaining_time_string( int ecx0, struct GUIWindow *edx0, __int64 a3, struct GUIFont *a2 ) {
--- a/mm7_3.cpp Sat Sep 07 13:26:15 2013 +0200 +++ b/mm7_3.cpp Sat Sep 07 15:20:57 2013 +0200 @@ -4856,7 +4856,7 @@ v7 = v3; v8 = ptr_38; sTextureDeltaV = v2->sTextureDeltaV; - v8->_48616B(v4, v7, 0, 0, v5, v6); + v8->_48616B_frustum_odm(v4, v7, 0, 0, v5, v6); return 1; } @@ -5377,7 +5377,7 @@ (pOutdoorCamera->shading_dist_mist * -sin(pIndoorCamera->sRotationX * 0.003066406352445483) - pIndoorCamera->pos.z);//61 / 184 / 310 изменяется при наклоне камеры pSkyPolygon.Create_48607B(&stru_8019C8); - pSkyPolygon.ptr_38->Inverse_sky_48694B();//maybe creating skydome(возможно создание купола неба) + pSkyPolygon.ptr_38->_48694B_frustum_sky();//maybe creating skydome(возможно создание купола неба) pSkyPolygon.uTileBitmapID = pOutdoor->uSky_TextureID;//номер текстуры pSkyPolygon.pTexture = (Texture *)(pOutdoor->uSky_TextureID != -1 ? &pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID] : 0);//текстура неба if (pOutdoor->uSky_TextureID == -1) @@ -5956,7 +5956,7 @@ //----- (00481ED9) -------------------------------------------------------- void sub_481ED9_MessWithOutdoorCamera() { - stru_8019C8._48616B(65536, 0, 0, 0, 65536, 0); + stru_8019C8._48616B_frustum_odm(65536, 0, 0, 0, 65536, 0); pOutdoorCamera->uNumPolygons = 0; pOutdoorCamera->uNumEdges = 0; pOutdoorCamera->uNumSpans = 0; @@ -6179,126 +6179,109 @@ } //----- (0048616B) -------------------------------------------------------- -int stru149::_48616B(int a2, int a3, int a4, int a5, int a6, int a7) +void stru149::_48616B_frustum_odm(int a2, int a3, int a4, int a5, int a6, int a7) { int v7; // ebx@1 - int v8; // esi@1 + //int v8; // esi@1 int v9; // edi@1 - int v10; // eax@1 + //int v10; // eax@1 int v11; // edx@1 - int v12; // esi@2 - int v13; // eax@2 - int v14; // ST10_4@3 - int v15; // esi@3 - int v16; // eax@5 + //int v12; // esi@2 + //int v13; // eax@2 + //int v14; // ST10_4@3 + //int v15; // esi@3 + //int v16; // eax@5 int v17; // ST0C_4@6 - int v18; // eax@8 + //int v18; // eax@8 int v19; // ST0C_4@9 - int v20; // eax@10 - int v21; // edx@10 - int v22; // eax@10 - int result; // eax@10 + //int v20; // eax@10 + //int v21; // edx@10 + //int v22; // eax@10 + //int result; // eax@10 int v24; // [sp+14h] [bp-14h]@1 int v25; // [sp+18h] [bp-10h]@1 - int v26; // [sp+1Ch] [bp-Ch]@1 + //int v26; // [sp+1Ch] [bp-Ch]@1 int v27; // [sp+24h] [bp-4h]@1 - int v28; // [sp+30h] [bp+8h]@10 - int v29; // [sp+3Ch] [bp+14h]@10 + //int v28; // [sp+30h] [bp+8h]@10 + //int v29; // [sp+3Ch] [bp+14h]@10 v25 = pOutdoorCamera->camera_rotation_x_int_cosine; v7 = pOutdoorCamera->camera_rotation_y_int_sine; v27 = pOutdoorCamera->camera_rotation_x_int_sine; - v8 = -pIndoorCamera->pos.y; + //v8 = -pIndoorCamera->pos.y; v9 = pOutdoorCamera->camera_rotation_y_int_cosine; - v26 = -pIndoorCamera->pos.z; - v24 = -pIndoorCamera->pos.x; - v10 = pOutdoorCamera->camera_rotation_y_int_cosine * -pIndoorCamera->pos.x; - v11 = v10 + pOutdoorCamera->camera_rotation_y_int_sine * -pIndoorCamera->pos.y; + //v26 = -pIndoorCamera->pos.z; + v11 = pOutdoorCamera->camera_rotation_y_int_cosine * -pIndoorCamera->pos.x + pOutdoorCamera->camera_rotation_y_int_sine * -pIndoorCamera->pos.y; + v24 = pOutdoorCamera->camera_rotation_y_int_cosine * -pIndoorCamera->pos.y - pOutdoorCamera->camera_rotation_y_int_sine * -pIndoorCamera->pos.x; if ( pIndoorCamera->sRotationX ) { - v14 = v10 + pOutdoorCamera->camera_rotation_y_int_sine * -pIndoorCamera->pos.y; - v15 = pOutdoorCamera->camera_rotation_y_int_cosine * v8 - pOutdoorCamera->camera_rotation_y_int_sine * v24; - this->field_0_party_dir_x = ((unsigned __int64)(v11 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16) - + ((unsigned __int64)(-65536 - * pIndoorCamera->pos.z - * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); - this->field_4_party_dir_y = v15; - v12 = v25; - v13 = ((unsigned __int64)((v26 << 16) * (signed __int64)v25) >> 16) - - ((unsigned __int64)(v14 * (signed __int64)v27) >> 16); + this->field_0_party_dir_x = fixpoint_sub0(v11, pOutdoorCamera->camera_rotation_x_int_cosine) + + fixpoint_sub0((-pIndoorCamera->pos.z) << 16, pOutdoorCamera->camera_rotation_x_int_sine); + this->field_4_party_dir_y = v24; + this->field_8_party_dir_z = fixpoint_sub0((-pIndoorCamera->pos.z) << 16, v25) - fixpoint_sub0(v11, v27); } else { - this->field_4_party_dir_y = pOutdoorCamera->camera_rotation_y_int_cosine * v8 - pOutdoorCamera->camera_rotation_y_int_sine * v24; - v12 = v25; this->field_0_party_dir_x = v11; - v13 = v26 << 16; - } - this->field_8 = v13; - if ( pIndoorCamera->sRotationX ) - { - v17 = ((unsigned __int64)(a2 * (signed __int64)v9) >> 16) + ((unsigned __int64)(a3 * (signed __int64)v7) >> 16); - this->field_C = ((unsigned __int64)(v17 * (signed __int64)v12) >> 16) - + ((unsigned __int64)(a4 * (signed __int64)v27) >> 16); - this->field_10 = ((unsigned __int64)(a3 * (signed __int64)v9) >> 16) - - ((unsigned __int64)(a2 * (signed __int64)v7) >> 16); - v16 = ((unsigned __int64)(a4 * (signed __int64)v12) >> 16) - ((unsigned __int64)(v17 * (signed __int64)v27) >> 16); + this->field_4_party_dir_y = v24; + this->field_8_party_dir_z = (-pIndoorCamera->pos.z) << 16; + } + + if (pIndoorCamera->sRotationX) + { + v17 = fixpoint_sub0(a2, v9) + fixpoint_sub0(a3, v7); + + this->field_C = fixpoint_sub0(v17, v25) + fixpoint_sub0(a4, v27); + this->field_10 = fixpoint_sub0(a3, v9) - fixpoint_sub0(a2, v7); + this->field_14 = fixpoint_sub0(a4, v25) - fixpoint_sub0(v17, v27); } else { - this->field_C = ((unsigned __int64)(a2 * (signed __int64)v9) >> 16) - + ((unsigned __int64)(a3 * (signed __int64)v7) >> 16); - this->field_10 = ((unsigned __int64)(a3 * (signed __int64)v9) >> 16) - - ((unsigned __int64)(a2 * (signed __int64)v7) >> 16); - v16 = a4; - } - this->field_14 = v16; - if ( pIndoorCamera->sRotationX ) - { - v19 = ((unsigned __int64)(a5 * (signed __int64)v9) >> 16) + ((unsigned __int64)(a6 * (signed __int64)v7) >> 16); - this->field_18 = ((unsigned __int64)(v19 * (signed __int64)v12) >> 16) - + ((unsigned __int64)(a7 * (signed __int64)v27) >> 16); - this->field_1C = ((unsigned __int64)(a6 * (signed __int64)v9) >> 16) - - ((unsigned __int64)(a5 * (signed __int64)v7) >> 16); - v18 = ((unsigned __int64)(a7 * (signed __int64)v12) >> 16) - ((unsigned __int64)(v19 * (signed __int64)v27) >> 16); + this->field_C = fixpoint_sub0(a2, v9) + fixpoint_sub0(a3, v7); + this->field_10 = fixpoint_sub0(a3, v9) - fixpoint_sub0(a2, v7); + this->field_14 = a4; + } + + if (pIndoorCamera->sRotationX) + { + v19 = fixpoint_sub0(a5, v9) + fixpoint_sub0(a6, v7); + + this->field_18 = fixpoint_sub0(v19, v25) + fixpoint_sub0(a7, v27); + this->field_1C = fixpoint_sub0(a6, v9) - fixpoint_sub0(a5, v7); + this->field_20 = fixpoint_sub0(a7, v25) - fixpoint_sub0(v19, v27); } else { - this->field_18 = ((unsigned __int64)(a5 * (signed __int64)v9) >> 16) - + ((unsigned __int64)(a6 * (signed __int64)v7) >> 16); - this->field_1C = ((unsigned __int64)(a6 * (signed __int64)v9) >> 16) - - ((unsigned __int64)(a5 * (signed __int64)v7) >> 16); - v18 = a7; - } + this->field_18 = fixpoint_sub0(a5, v9) + fixpoint_sub0(a6, v7); + this->field_1C = fixpoint_sub0(a6, v9) - fixpoint_sub0(a5, v7); + this->field_20 = a7; + } + this->field_18 = -this->field_18; this->field_1C = -this->field_1C; - this->field_20 = v18; - v20 = this->field_C; this->field_20 = -this->field_20; - v21 = ((unsigned __int64)(v20 * (signed __int64)this->field_0_party_dir_x) >> 16) - + ((unsigned __int64)(this->field_10 * (signed __int64)this->field_4_party_dir_y) >> 16) - + ((unsigned __int64)(this->field_14 * (signed __int64)this->field_8) >> 16); - v28 = this->field_18; - v22 = this->field_0_party_dir_x; - this->field_24 = v21; - v29 = (unsigned __int64)(v28 * (signed __int64)v22) >> 16; - result = (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16; - this->field_28 = v29 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16); - return result; + + 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); } //----- (0048694B) -------------------------------------------------------- -void stru149::Inverse_sky_48694B() +void stru149::_48694B_frustum_sky() { this->field_18 = -this->field_18; this->field_1C = -this->field_1C; this->field_20 = -this->field_20; - this->field_24 = ((unsigned __int64)(this->field_C * (signed __int64)this->field_0_party_dir_x) >> 16) - + ((unsigned __int64)(this->field_10 * (signed __int64)this->field_4_party_dir_y) >> 16) - + ((unsigned __int64)(this->field_14 * (signed __int64)this->field_8) >> 16); - this->field_28 = ((unsigned __int64)(this->field_18 * (signed __int64)this->field_0_party_dir_x) >> 16) - + ((unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16) - + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16); + + 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); } //----- (0044100D) --------------------------------------------------------
--- a/mm7_data.h Sat Sep 07 13:26:15 2013 +0200 +++ b/mm7_data.h Sat Sep 07 15:20:57 2013 +0200 @@ -1165,7 +1165,7 @@ int __fastcall _43F55F_get_billboard_light_level(struct RenderBillboard *a1, int uBaseLightLevel); int __fastcall _43F5C8_get_point_light_level_with_respect_to_lights(unsigned int uBaseLightLevel, int uSectorID, float x, float y, float z); void PrepareBspRenderList_BLV(); -void __fastcall PrepareDecorationsRenderList_BLV(unsigned int uDecorationID, unsigned int uSectorID); +void PrepareDecorationsRenderList_BLV(unsigned int uDecorationID, unsigned int uSectorID); void PrepareActorRenderList_BLV(); void PrepareItemsRenderList_BLV(); void AddBspNodeToRenderList(unsigned int node_id);