comparison mm7_3.cpp @ 1809:8f20f7e1091d

original DrawSkyD3D() fix
author Ritor1
date Mon, 07 Oct 2013 15:20:32 +0600
parents 3a41be960164
children 8b08005c0bcd
comparison
equal deleted inserted replaced
1808:4002c0fe5efc 1809:8f20f7e1091d
4877 } 4877 }
4878 4878
4879 //----- (00479543) -------------------------------------------------------- 4879 //----- (00479543) --------------------------------------------------------
4880 void Render::DrawSkyD3D() 4880 void Render::DrawSkyD3D()
4881 { 4881 {
4882 int v0; // esi@2
4883 int v1; // eax@2
4884 int v8; // eax@4
4885 int v9; // eax@4 4882 int v9; // eax@4
4886 int v10; // ebx@4 4883 int v10; // ebx@4
4887 signed __int64 v11; // qax@6
4888 int v13; // edi@6 4884 int v13; // edi@6
4889 int v14; // ecx@6 4885 int v14; // ecx@6
4886 int v15; // eax@8
4890 int v16; // eax@12 4887 int v16; // eax@12
4891 //signed __int64 v17; // qtt@13 4888 signed __int64 v17; // qtt@13
4892 signed int pShading; // ecx@13 4889 signed int v18; // ecx@13
4893 struct Polygon pSkyPolygon; // [sp+14h] [bp-150h]@1 4890 struct Polygon pSkyPolygon; // [sp+14h] [bp-150h]@1
4894 float v28; // [sp+12Ch] [bp-38h]@2 4891 double v26; // [sp+120h] [bp-44h]@4
4895 int v29; // [sp+130h] [bp-34h]@4
4896 int v30; // [sp+134h] [bp-30h]@1 4892 int v30; // [sp+134h] [bp-30h]@1
4897 int v32; // [sp+13Ch] [bp-28h]@6 4893 int v32; // [sp+13Ch] [bp-28h]@6
4898 int v33; // [sp+140h] [bp-24h]@2 4894 int v33; // [sp+140h] [bp-24h]@2
4899 int v34; // [sp+144h] [bp-20h]@1 4895 signed __int64 v34; // [sp+144h] [bp-20h]@1
4900 int v35; // [sp+148h] [bp-1Ch]@4 4896 int v35; // [sp+148h] [bp-1Ch]@4
4901 int screen_center_x; // [sp+14Ch] [bp-18h]@2 4897 int v36; // [sp+14Ch] [bp-18h]@2
4902 int v37; // [sp+154h] [bp-10h]@8 4898 int v37; // [sp+154h] [bp-10h]@8
4903 int pViewportBR_Y; // [sp+158h] [bp-Ch]@1 4899 int v38; // [sp+158h] [bp-Ch]@1
4904 int v39; // [sp+15Ch] [bp-8h]@4 4900 int v39; // [sp+15Ch] [bp-8h]@4
4905 //int v40; // [sp+160h] [bp-4h]@7 4901 int v40; // [sp+160h] [bp-4h]@7
4906 4902
4907 //Хотя сами двухмерные изображения основаны на системе координат XY, накладываются текстуры на объект, основанный на 4903 v30 = (signed __int64)((double)(pODMRenderParams->int_fov_rad * pGame->pIndoorCameraD3D->vPartyPos.z)
4908 //осях координат U (горизонталь) и V (вертикаль), обхватывающих поверхность объекта. 4904 / ((double)pODMRenderParams->int_fov_rad + 8192.0)
4909 4905 + (double)(pViewport->uScreenCenterY + 7));//include "+ 7"
4910 extern bool new_sky; 4906 v34 = cos((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064) * 0x2000;//(double)pODMRenderParams->shading_dist_mist
4911 if (new_sky) 4907 v38 = (signed __int64)((double)(pViewport->uScreenCenterY + 7)
4912 { 4908 - (double)pODMRenderParams->int_fov_rad
4913 if (DrawSkyD3D_Skybox()) 4909 / (v34 + 0.0000001)
4914 return; 4910 * (sin((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064)
4915 } 4911 * (double)-0x2000//(double)pODMRenderParams->shading_dist_mist
4916 4912 - (double)pGame->pIndoorCameraD3D->vPartyPos.z));
4917 v30 = ((double)(pODMRenderParams->int_fov_rad * pGame->pIndoorCameraD3D->vPartyPos.z) 4913 pSkyPolygon.Create_48607B(&stru_8019C8);//заполняется ptr_38
4918 / ((double)pODMRenderParams->int_fov_rad + 8192.0) + pViewport->uScreenCenterY);//184 изменяется при подъёме на высоту 4914 pSkyPolygon.ptr_38->_48694B_frustum_sky();
4919 pViewportBR_Y = pViewport->uScreenCenterY - pODMRenderParams->int_fov_rad / 4915 pSkyPolygon.uTileBitmapID = pOutdoor->uSky_TextureID;//179(original 166)
4920 (pODMRenderParams->shading_dist_mist * cos(pGame->pIndoorCameraD3D->sRotationX * 0.003066406352445483) + 0.0000001000000011686097) * 4916 pSkyPolygon.pTexture = (Texture *)(SLOWORD(pOutdoor->uSky_TextureID) != -1 ? (int)&pBitmaps_LOD->pTextures[SLOWORD(pOutdoor->uSky_TextureID)] : 0);
4921 (pODMRenderParams->shading_dist_mist * -sin(pGame->pIndoorCameraD3D->sRotationX * 0.003066406352445483) - pGame->pIndoorCameraD3D->vPartyPos.z);//61 / 184 / 310 изменяется при наклоне камеры 4917 if ( pSkyPolygon.pTexture )
4922 4918 {
4923 pSkyPolygon.Create_48607B(&stru_8019C8); 4919 pSkyPolygon.dimming_level = 0;
4924 pSkyPolygon.ptr_38->_48694B_frustum_sky();//maybe creating skydome(возможно создание купола неба) 4920 pSkyPolygon.uNumVertices = 4;
4925 pSkyPolygon.uTileBitmapID = pOutdoor->uSky_TextureID;//номер текстуры 4921 //centering(центруем)--наклон камеры ----------------------------------------
4926 pSkyPolygon.pTexture = (Texture *)(pOutdoor->uSky_TextureID != -1 ? &pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID] : 0);//текстура неба 4922 pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);
4927 if (pOutdoor->uSky_TextureID == -1) 4923 pSkyPolygon.v_18.y = 0;
4928 return; 4924 pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16);
4929
4930 pSkyPolygon.dimming_level = 0;//затемнение
4931 pSkyPolygon.uNumVertices = 4;//количество вершин
4932
4933 //centering(центруем)--наклон камеры ----------------------------------------//
4934 pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);//-3216, вверх: -28020, вниз: 22078
4935 pSkyPolygon.v_18.y = 0;
4936 pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16);//-65457, вверх: -59244, вниз: -61705
4937 //---------------------------------------------------------------------------//
4938
4939 pSkyPolygon.field_24 = 0x2000000;
4940
4941 pSkyPolygon.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed;//60928
4942 pSkyPolygon.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed;
4943 4925
4944 //sky wiew position(положение неба)------------------------------------------ 4926 //sky wiew position(положение неба на экране)------------------------------------------
4945 // X 4927 // X
4946 // 0._____________________________.3 4928 // 0._____________________________.3
4947 // |8,8 468,8 | 4929 // |8,8 468,8 |
4948 // | | 4930 // | |
4949 // | | 4931 // | |
4950 // Y| | 4932 // Y| |
4951 // | | 4933 // | |
4952 // |8,351 468,351 | 4934 // |8,351 468,351 |
4953 // 1._____________________________.2 4935 // 1._____________________________.2
4954 // 4936 //
4955 4937 array_50AC10[0].vWorldViewProjX = (double)(signed int)pViewport->uViewportTL_X;
4956 array_50AC10[0].vWorldViewProjX = pViewport->uViewportTL_X;//8 4938 array_50AC10[0].vWorldViewProjY = (double)(signed int)pViewport->uViewportTL_Y;
4957 array_50AC10[0].vWorldViewProjY = pViewport->uViewportTL_Y;//8 4939
4958 4940 array_50AC10[1].vWorldViewProjX = (double)(signed int)pViewport->uViewportTL_X;
4959 array_50AC10[1].vWorldViewProjX = pViewport->uViewportTL_X;//8 4941 array_50AC10[1].vWorldViewProjY = (double)v38;
4960 array_50AC10[1].vWorldViewProjY = pViewportBR_Y;//61 / 184 / 310 4942
4961 4943 array_50AC10[2].vWorldViewProjX = (double)(signed int)pViewport->uViewportBR_X;
4962 array_50AC10[2].vWorldViewProjX = pViewport->uViewportBR_X;//468 4944 array_50AC10[2].vWorldViewProjY = (double)v38;
4963 array_50AC10[2].vWorldViewProjY = pViewportBR_Y;//61 / 184 / 310 4945
4964 4946 array_50AC10[3].vWorldViewProjX = (double)(signed int)pViewport->uViewportBR_X;
4965 array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X;//468 4947 array_50AC10[3].vWorldViewProjY = (double)(signed int)pViewport->uViewportTL_Y;
4966 array_50AC10[3].vWorldViewProjY = pViewport->uViewportTL_Y;//8 4948
4967 //--------------------------------------------------------------------------
4968
4969 //pParty->sRotationY / 2048.0f
4970 // move sky(движение неба)--------------include(вставка)---------------------
4971 float t = (GetTickCount() % 96000) / 96000.0f;
4972 array_50AC10[0].u = t - pParty->sRotationY / 1024.0f;
4973 array_50AC10[0].v = t - pParty->sRotationX / 512.0f;
4974
4975 array_50AC10[1].u = t - pParty->sRotationY / 1024.0f;
4976 array_50AC10[1].v = 1 + t - pParty->sRotationX / 512.0f;
4977
4978 array_50AC10[2].u = 1 + t - pParty->sRotationY / 1024.0f;
4979 array_50AC10[2].v = 1 + t - pParty->sRotationX / 512.0f;
4980
4981 array_50AC10[3].u = 1 + t - pParty->sRotationY / 1024.0f;
4982 array_50AC10[3].v = t - pParty->sRotationX / 512.0f;
4983 //--------------------------------------------------------------------------//
4984
4985 //rotate skydome(вращение купола неба)--------------------------------------
4986 // В игре принята своя система измерения углов. Полный угол в 2П радиан соответствует 65536 еденицам. Значению угла 0 соответствует
4987 // направление на восток, значению 16384(0х4000) - на север и т.д..
4988
4989 //нахождение вектора взгляда------------------------------------------------
4990 //положение камеры----------------------------------------------------------
4991 screen_center_x = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2;//центр экрана по X = 230
4992 v33 = 65536 / (signed int)(screen_center_x / tan(0.6457717418670654) + 0.5);//360 : (расстояние от экрана до камеры в пикселях) = 214
4993 //--------------------------------------------------------------------------
4994
4995 for ( uint vertex_id = 0; vertex_id < pSkyPolygon.uNumVertices; ++vertex_id )
4996 {
4997 v29 = floorf(array_50AC10[vertex_id].vWorldViewProjY + 0.5f);//8
4998 v39 = (unsigned __int64)(pSkyPolygon.ptr_38->field_14 * v33 * (v30 - v29)) / 65536;//0
4999 v8 = v39 + pSkyPolygon.ptr_38->field_C;//0
5000
5001 v39 = (unsigned __int64)(pSkyPolygon.ptr_38->field_20 * v33 * (v30 - v29)) / 65536;//0
5002 screen_center_x = v39 + pSkyPolygon.ptr_38->field_18;//65536
5003
5004 v9 = (unsigned __int64)(pSkyPolygon.v_18.z * v33 * (v30 - v29)) / 65536;//27917
5005 v10 = pSkyPolygon.v_18.x + v9;//24701
5006 v39 = pSkyPolygon.v_18.x + v9;//24701
5007 if ( pSkyPolygon.v_18.x + v9 > 0 )
5008 {
5009 v10 = 0;
5010 v39 = 0;
5011 }
5012 //v11 = (signed __int64)array_50AC10[i].vWorldViewProjX;
5013 pViewportBR_Y = v10;
5014 //v12 = array_50AC10[i].vWorldViewProjY - 1.0;
5015 v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)array_50AC10[vertex_id].vWorldViewProjX);
5016 v34 = -pSkyPolygon.field_24;
5017 v32 = (signed __int64)array_50AC10[vertex_id].vWorldViewProjY - 1.0;
5018 v14 = v33 * (v30 - v32);
5019
5020 while ( 1 )
5021 {
5022 //v40 = v14;
5023 if ( !v10 )
5024 {
5025 v37 = pSkyPolygon.v_18.z;
5026 v16 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)v14) >> 16;
5027 --v32;
5028 v14 += v33;
5029 v10 = pSkyPolygon.v_18.x + v16;
5030 v39 = pSkyPolygon.v_18.x + v16;
5031 pViewportBR_Y = pSkyPolygon.v_18.x + v16;
5032 break;
5033 }
5034 v37 = abs(v34 >> 14);//2048
5035 if ( abs(v34 >> 14) <= abs(v10) || v32 <= pViewport->uViewportTL_Y )
5036 {
5037 if ( v39 <= 0 )
5038 break;
5039 }
5040 //v14 = v40;
5041 v37 = pSkyPolygon.v_18.z;
5042 v16 = (unsigned __int64)(pSkyPolygon.v_18.z * v14) >> 16;
5043 --v32;
5044 v14 += v33;
5045 v10 = pSkyPolygon.v_18.x + v16;
5046 v39 = pSkyPolygon.v_18.x + v16;
5047 pViewportBR_Y = pSkyPolygon.v_18.x + v16;
5048 break;
5049 }
5050
5051 pShading = fixpoint_div(v34, pViewportBR_Y);//53570690 = -33554432 / -41049
5052 if ( pShading < 0 )
5053 pShading = pODMRenderParams->shading_dist_mist;
5054 int a = ((unsigned __int64)(pSkyPolygon.ptr_38->field_10 * v13) >> 16);//16316
5055 v37 += ((unsigned __int64)(pSkyPolygon.ptr_38->field_10 * v13) >> 16);
5056 int b = ((unsigned __int64)(pSkyPolygon.ptr_38->field_1C * v13) >> 16);
5057 screen_center_x += ((unsigned __int64)(pSkyPolygon.ptr_38->field_1C * v13) >> 16);
5058 v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_mul(v37, pShading) / 8;// Медленно вращаем небесный купол
5059 screen_center_x = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_mul(screen_center_x, pShading) / 8;
5060
5061 array_50AC10[vertex_id].vWorldViewPosition.x = pODMRenderParams->shading_dist_mist;
5062 //array_50AC10[vertex_id].vWorldPosition.x = v36 / (pSkyPolygon.pTexture->uTextureHeight * 65536.0);
5063 //array_50AC10[vertex_id].vWorldPosition.y = 1.0 / (pODMRenderParams->shading_dist_mist >> 16);
5064 //array_50AC10[vertex_id].vWorldPosition.z = v35 / (pSkyPolygon.pTexture->uTextureWidth * 65536.0);
5065 //array_50AC10[vertex_id]._rhw = 1.0f / (pShading >> 16);//1.0 / (array_50AC10[vertex_id].vWorldViewPosition.x + 0.0000001);
5066 //array_50AC10[vertex_id].u = (double)v35 / (65536.0 * pSkyPolygon.pTexture->uTextureWidth);//t - pParty->sRotationY / 1024.0f
5067 //array_50AC10[vertex_id].v = (double)screen_center_x / (65536.0 * pSkyPolygon.pTexture->uTextureHeight);
5068 //-----------------------------------------------------------------------------------------
5069
5070 array_50AC10[vertex_id]._rhw = 1.0f;
5071 }
5072 //if ( i == _this.uNumVertices - 1 )
5073 //{
5074 pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[pSkyPolygon.uTileBitmapID]);
5075
5076 array_50AC10[0].vWorldViewProjY = pViewportBR_Y;
5077 array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0;
5078 array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0;
5079 array_50AC10[3].vWorldViewProjY = pViewportBR_Y;
5080
5081 pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[pSkyPolygon.uTileBitmapID]);
5082 //}
5083 }
5084 /*void Render::DrawSkyD3D()
5085 {
5086 int v0; // esi@2
5087 int v1; // eax@2
5088 double v2; // st7@2
5089 double v3; // st6@2
5090 double v4; // st5@2
5091 double v5; // st4@2
5092 double v6; // st7@2
5093 char *v7; // esi@3
5094 int v8; // eax@4
5095 int v9; // eax@4
5096 int v10; // ebx@4
5097 signed __int64 v11; // qax@6
5098 double v12; // st7@6
5099 int v13; // edi@6
5100 int v14; // ecx@6
5101 int v15; // eax@8
5102 int v16; // eax@12
5103 signed __int64 v17; // qtt@13
5104 signed int v18; // ecx@13
5105 Texture *v19; // eax@15
5106 double v20; // st6@15
5107 double v21; // st7@15
5108 double v22; // st6@15
5109 unsigned __int8 v23; // sf@15
5110 unsigned __int8 v24; // of@15
5111 struct Polygon pSkyPolygon; // [sp+14h] [bp-150h]@1
5112 double v26; // [sp+120h] [bp-44h]@4
5113 float v27; // [sp+128h] [bp-3Ch]@4
5114 float v28; // [sp+12Ch] [bp-38h]@2
5115 int v29; // [sp+130h] [bp-34h]@4
5116 int v30; // [sp+134h] [bp-30h]@1
5117 int v31; // [sp+138h] [bp-2Ch]@2
5118 int v32; // [sp+13Ch] [bp-28h]@6
5119 int v33; // [sp+140h] [bp-24h]@2
5120 signed __int64 v34; // [sp+144h] [bp-20h]@1
5121 int v35; // [sp+148h] [bp-1Ch]@4
5122 double v36; // [sp+14Ch] [bp-18h]@2
5123 int v37; // [sp+154h] [bp-10h]@8
5124 int v38; // [sp+158h] [bp-Ch]@1
5125 int v39; // [sp+15Ch] [bp-8h]@4
5126 int v40; // [sp+160h] [bp-4h]@7
5127
5128 v30 = (signed __int64)((double)(pODMRenderParams->int_fov_rad * pGame->pIndoorCameraD3D->vPartyPos.z)
5129 / ((double)pODMRenderParams->int_fov_rad + 8192.0)
5130 + (double)(pViewport->uScreenCenterY + 7));//include "+ 7"
5131 //v34 = cos((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064) * (double)pODMRenderParams->shading_dist_mist;
5132 /*v38 = (signed __int64)((double)(pViewport->uScreenCenterY + 7)
5133 - (double)pODMRenderParams->int_fov_rad
5134 / (v34 + 0.0000001)
5135 * (sin((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064)
5136 * (double)-pODMRenderParams->shading_dist_mist
5137 - (double)pGame->pIndoorCameraD3D->vPartyPos.z));*/
5138 /*v34 = cos((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064) * 0x2000;
5139 v38 = (signed __int64)((double)(pViewport->uScreenCenterY + 7)
5140 - (double)pODMRenderParams->int_fov_rad
5141 / (v34 + 0.0000001)
5142 * (sin((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064)
5143 * (double)-0x2000
5144 - (double)pGame->pIndoorCameraD3D->vPartyPos.z));
5145 pSkyPolygon.Create_48607B(&stru_8019C8);//заполняется ptr_38
5146 pSkyPolygon.ptr_38->_48694B_frustum_sky();
5147 pSkyPolygon.uTileBitmapID = pOutdoor->uSky_TextureID;//179(original 166)
5148 pSkyPolygon.pTexture = (Texture *)(SLOWORD(pOutdoor->uSky_TextureID) != -1 ? (int)&pBitmaps_LOD->pTextures[SLOWORD(pOutdoor->uSky_TextureID)] : 0);
5149 if ( pSkyPolygon.pTexture )
5150 {
5151 v0 = pGame->pIndoorCameraD3D->sRotationX;
5152 pSkyPolygon.dimming_level = 0;
5153 pSkyPolygon.uNumVertices = 4;
5154 pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);
5155 pSkyPolygon.v_18.y = 0;
5156 v1 = stru_5C6E00->Cos(v0 + 16);
5157 v2 = (double)(signed int)pViewport->uViewportTL_X;
5158 pSkyPolygon.v_18.z = -v1;
5159 array_50AC10[0].vWorldViewProjX = v2;
5160 v3 = (double)(signed int)pViewport->uViewportTL_Y;
5161 array_50AC10[0].vWorldViewProjY = v3;
5162 array_50AC10[1].vWorldViewProjX = v2;
5163 v4 = (double)v38;
5164 pSkyPolygon.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed; 4949 pSkyPolygon.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed;
5165 pSkyPolygon.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed; 4950 pSkyPolygon.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed;
5166 v28 = v4; 4951
5167 array_50AC10[1].vWorldViewProjY = v4;
5168 v5 = (double)(signed int)pViewport->uViewportBR_X;
5169 array_50AC10[2].vWorldViewProjX = v5;
5170 v38 = pViewport->uViewportBR_X - pViewport->uViewportTL_X;
5171 pSkyPolygon.field_24 = 0x2000000u; 4952 pSkyPolygon.field_24 = 0x2000000u;
5172 array_50AC10[2].vWorldViewProjY = v4; 4953 v33 = 65536 / (signed int)(signed __int64)(((double)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5) / tan(0.6457717418670654) + 0.5);
5173 array_50AC10[3].vWorldViewProjX = v5; 4954 for ( uint i = 0; i < pSkyPolygon.uNumVertices; ++i )
5174 array_50AC10[3].vWorldViewProjY = v3; 4955 {
5175 v36 = (double)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5; 4956 v26 = array_50AC10[i].vWorldViewProjY + 6.7553994e15;
5176 v6 = tan(0.6457717418670654); 4957 //rotate skydome(вращение купола неба)--------------------------------------
5177 v31 = 0; 4958 // В игре принята своя система измерения углов. Полный угол (180). Значению угла 0 соответствует
5178 v33 = 65536 / (signed int)(signed __int64)(v36 / v6 + 0.5); 4959 // направление на север и/или юг (либо на восток и/или запад), значению 65536 еденицам(0х10000) соответствует угол 90.
5179 if ( (signed int)pSkyPolygon.uNumVertices <= 0 ) 4960 v39 = (unsigned __int64)(pSkyPolygon.ptr_38->field_14 * (signed __int64)(v33 * (v30 - array_50AC10[i].vWorldViewProjY))) >> 16;
5180 goto LABEL_16; 4961 v35 = v39 + pSkyPolygon.ptr_38->angle_from_north;
5181 v7 = (char *)&array_50AC10[0].vWorldViewProjY; 4962
5182 while ( 1 ) 4963 v39 = (unsigned __int64)(pSkyPolygon.ptr_38->field_20 * (signed __int64)(v33 * (v30 - array_50AC10[i].vWorldViewProjY))) >> 16;
5183 { 4964 v36 = v39 + pSkyPolygon.ptr_38->angle_from_east;
5184 LODWORD(v27) = *(_DWORD *)v7; 4965
5185 v26 = v27 + 6.7553994e15;
5186 v29 = v27;
5187 v38 = pSkyPolygon.ptr_38->field_14;
5188 v39 = (unsigned __int64)(v38 * (signed __int64)(v33 * (v30 - v27))) >> 16;
5189 v8 = v39 + pSkyPolygon.ptr_38->field_C;
5190 v39 = v33 * (v30 - v27);
5191 v35 = v8;
5192 v38 = pSkyPolygon.ptr_38->field_20;
5193 v39 = (unsigned __int64)(v38 * (signed __int64)(v33 * (v30 - v27))) >> 16;
5194 v36 = v39 + pSkyPolygon.ptr_38->field_18;
5195 v38 = pSkyPolygon.v_18.z; 4966 v38 = pSkyPolygon.v_18.z;
5196 v9 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)(v33 * (v30 - v27))) >> 16; 4967 v9 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)(v33 * (v30 - array_50AC10[i].vWorldViewProjY))) >> 16;
5197 v10 = pSkyPolygon.v_18.x + v9; 4968 v10 = pSkyPolygon.v_18.x + v9;
5198 v39 = pSkyPolygon.v_18.x + v9; 4969 v39 = pSkyPolygon.v_18.x + v9;
5199 if ( pSkyPolygon.v_18.x + v9 > 0 ) 4970 if ( pSkyPolygon.v_18.x + v9 > 0 )
5200 { 4971 {
5201 v10 = 0; 4972 v10 = 0;
5202 v39 = 0; 4973 v39 = 0;
5203 } 4974 }
5204 v11 = (signed __int64)*((float *)v7 - 1);
5205 v38 = v10; 4975 v38 = v10;
5206 v12 = *(float *)v7 - 1.0; 4976 v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)array_50AC10[i].vWorldViewProjX);
5207 v13 = v33 * (pViewport->uScreenCenterX - v11);
5208 v34 = -pSkyPolygon.field_24; 4977 v34 = -pSkyPolygon.field_24;
5209 v32 = (signed __int64)v12; 4978 v32 = (signed __int64)array_50AC10[i].vWorldViewProjX;
5210 v14 = v33 * (v30 - v32); 4979 v14 = v33 * (v30 - (signed __int64)array_50AC10[i].vWorldViewProjX);
5211 while ( 1 ) 4980 while ( 1 )
5212 { 4981 {
5213 v40 = v14; 4982 v40 = v14;
5214 if ( !v10 ) 4983 if ( !v10 )
5215 goto LABEL_12; 4984 goto LABEL_12;
5229 v10 = pSkyPolygon.v_18.x + v16; 4998 v10 = pSkyPolygon.v_18.x + v16;
5230 v39 = pSkyPolygon.v_18.x + v16; 4999 v39 = pSkyPolygon.v_18.x + v16;
5231 v38 = pSkyPolygon.v_18.x + v16; 5000 v38 = pSkyPolygon.v_18.x + v16;
5232 } 5001 }
5233 LODWORD(v17) = LODWORD(v34) << 16; 5002 LODWORD(v17) = LODWORD(v34) << 16;
5234 //HIDWORD(v17) = LODWORD(v34) >> 16;
5235 HIDWORD(v17) = v34 >> 16; 5003 HIDWORD(v17) = v34 >> 16;
5236 //v17 = (int)v34 >> 16; 5004 v40 = v17 / v38;
5237 //v17 = v17 << 16;
5238 v40 = v17 / v38;//v38 = -42331
5239 v18 = v17 / v38; 5005 v18 = v17 / v38;
5240 if ( v18 < 0 ) 5006 if ( v18 < 0 )
5241 v18 = pODMRenderParams->shading_dist_mist; 5007 v18 = pODMRenderParams->shading_dist_mist;
5242 v40 = v13; 5008 v37 = v35 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_west * (signed __int64)v13) >> 16);
5243 v37 = pSkyPolygon.ptr_38->field_10;
5244 v40 = v13;
5245 v37 = v35 + ((unsigned __int64)(v37 * (signed __int64)v13) >> 16);
5246 v35 = pSkyPolygon.ptr_38->field_1C;
5247 v36 += (unsigned __int64)(v35 * (signed __int64)v13) >> 16;
5248 v35 = 224 * pMiscTimer->uTotalGameTimeElapsed 5009 v35 = 224 * pMiscTimer->uTotalGameTimeElapsed
5249 + ((signed int)((unsigned __int64)(v37 * (signed __int64)v18) >> 16) >> 3); 5010 + ((signed int)((unsigned __int64)(v37 * (signed __int64)v18) >> 16) >> 3);
5250 v40 = (unsigned __int64)(v36 * (signed __int64)v18) >> 16; 5011 array_50AC10[i].u = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureWidth * 65536.0);
5251 v19 = pSkyPolygon.pTexture; 5012
5252 v36 = pSkyPolygon.pTexture->uTextureWidth; 5013 v36 = v36 + ((unsigned __int64)(pSkyPolygon.ptr_38->angle_from_south * (signed __int64)v13) >> 16);
5253 v7 += 48; 5014 v35 = 224 * pMiscTimer->uTotalGameTimeElapsed
5254 v20 = (double)v36 * 65536.0; 5015 + ((signed int)((unsigned __int64)(v36 * (signed __int64)v18) >> 16) >> 3);
5255 HIDWORD(v36) = 224 * pMiscTimer->uTotalGameTimeElapsed + (v40 >> 3); 5016 array_50AC10[i].v = (double)v35 / ((double)pSkyPolygon.pTexture->uTextureHeight * 65536.0);
5256 ++v31; 5017
5257 array_50AC10[v31 - 1].u = (double)v35 / v20; 5018 array_50AC10[i].vWorldViewPosition.x = (double)0x2000;//pODMRenderParams->shading_dist_mist
5258 v21 = (double)SHIDWORD(v36); 5019 array_50AC10[i]._rhw = 1.0 / (double)(v18 >> 16);
5259 HIDWORD(v36) = v19->uTextureHeight; 5020 }
5260 v22 = (double)SHIDWORD(v36); 5021 pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
5261 HIDWORD(v36) = v18 >> 16; 5022 array_50AC10[0].vWorldViewProjY = (double)v38;
5262 //v24 = __OFSUB__(v31, pSkyPolygon.uNumVertices); 5023 array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0;
5263 //v23 = ((v31 - pSkyPolygon.uNumVertices) & 0x80000000u) != 0; 5024 array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0;
5264 array_50AC10[v31 - 1].v = v21 / (v22 * 65536.0); 5025 array_50AC10[3].vWorldViewProjY = (double)v38;
5265 //array_50AC10[v31 - 1].vWorldViewPosition.x = (double)pODMRenderParams->shading_dist_mist; 5026 pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
5266 array_50AC10[v31 - 1].vWorldViewPosition.x = (double)0x2000; 5027 return;
5267 array_50AC10[v31 - 1]._rhw = 1.0 / (double)SHIDWORD(v36); 5028 }
5268 //if ( !(v23 ^ v24) ) 5029 }
5269 if ( v31 == pSkyPolygon.uNumVertices )
5270 {
5271 LABEL_16:
5272 pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices,
5273 &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
5274 array_50AC10[0].vWorldViewProjY = v28;
5275 array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0;
5276 array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0;
5277 array_50AC10[3].vWorldViewProjY = v28;
5278 pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[(signed __int16)pSkyPolygon.uTileBitmapID]);
5279 return;
5280 }
5281 }
5282 }
5283 }*/
5284 5030
5285 //----- (0047A384) -------------------------------------------------------- 5031 //----- (0047A384) --------------------------------------------------------
5286 void ODM_LoadAndInitialize(const char *pLevelFilename, ODMRenderParams *thisa) 5032 void ODM_LoadAndInitialize(const char *pLevelFilename, ODMRenderParams *thisa)
5287 { 5033 {
5288 int v2; // ebx@3 5034 int v2; // ebx@3
5974 5720
5975 if (pGame->pIndoorCameraD3D->sRotationX) 5721 if (pGame->pIndoorCameraD3D->sRotationX)
5976 { 5722 {
5977 v17 = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7); 5723 v17 = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7);
5978 5724
5979 this->field_C = fixpoint_mul(v17, v25) + fixpoint_mul(a4, v27); 5725 this->angle_from_north = fixpoint_mul(v17, v25) + fixpoint_mul(a4, v27);
5980 this->field_10 = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7); 5726 this->angle_from_west = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7);
5981 this->field_14 = fixpoint_mul(a4, v25) - fixpoint_mul(v17, v27); 5727 this->field_14 = fixpoint_mul(a4, v25) - fixpoint_mul(v17, v27);
5982 } 5728 }
5983 else 5729 else
5984 { 5730 {
5985 this->field_C = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7); 5731 this->angle_from_north = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7);
5986 this->field_10 = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7); 5732 this->angle_from_west = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7);
5987 this->field_14 = a4; 5733 this->field_14 = a4;
5988 } 5734 }
5989 5735
5990 if (pGame->pIndoorCameraD3D->sRotationX) 5736 if (pGame->pIndoorCameraD3D->sRotationX)
5991 { 5737 {
5992 v19 = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7); 5738 v19 = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7);
5993 5739
5994 this->field_18 = fixpoint_mul(v19, v25) + fixpoint_mul(a7, v27); 5740 this->angle_from_east = fixpoint_mul(v19, v25) + fixpoint_mul(a7, v27);
5995 this->field_1C = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7); 5741 this->angle_from_south = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7);
5996 this->field_20 = fixpoint_mul(a7, v25) - fixpoint_mul(v19, v27); 5742 this->field_20 = fixpoint_mul(a7, v25) - fixpoint_mul(v19, v27);
5997 } 5743 }
5998 else 5744 else
5999 { 5745 {
6000 this->field_18 = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7); 5746 this->angle_from_east = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7);
6001 this->field_1C = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7); 5747 this->angle_from_south = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7);
6002 this->field_20 = a7; 5748 this->field_20 = a7;
6003 } 5749 }
6004 5750
6005 this->field_18 = -this->field_18; 5751 this->angle_from_east = -this->angle_from_east;
6006 this->field_1C = -this->field_1C; 5752 this->angle_from_south = -this->angle_from_south;
6007 this->field_20 = -this->field_20; 5753 this->field_20 = -this->field_20;
6008 5754
6009 this->field_24 = fixpoint_dot(this->field_C, this->field_0_party_dir_x, 5755 this->field_24 = fixpoint_dot(this->angle_from_north, this->field_0_party_dir_x,
6010 this->field_10, this->field_4_party_dir_y, 5756 this->angle_from_west, this->field_4_party_dir_y,
6011 this->field_14, this->field_8_party_dir_z); 5757 this->field_14, this->field_8_party_dir_z);
6012 this->field_28 = fixpoint_dot(this->field_18, this->field_0_party_dir_x, 5758 this->field_28 = fixpoint_dot(this->angle_from_east, this->field_0_party_dir_x,
6013 this->field_1C, this->field_4_party_dir_y, 5759 this->angle_from_south, this->field_4_party_dir_y,
6014 this->field_20, this->field_8_party_dir_z); 5760 this->field_20, this->field_8_party_dir_z);
6015 } 5761 }
6016 5762
6017 //----- (0048694B) -------------------------------------------------------- 5763 //----- (0048694B) --------------------------------------------------------
6018 void stru149::_48694B_frustum_sky() 5764 void stru149::_48694B_frustum_sky()
6019 { 5765 {
6020 this->field_18 = -this->field_18; 5766 this->angle_from_east = -this->angle_from_east;
6021 this->field_1C = -this->field_1C; 5767 this->angle_from_south = -this->angle_from_south;
6022 this->field_20 = -this->field_20; 5768 this->field_20 = -this->field_20;
6023 5769
6024 this->field_24 = fixpoint_dot(this->field_C, this->field_0_party_dir_x, 5770 this->field_24 = fixpoint_dot(this->angle_from_north, this->field_0_party_dir_x,
6025 this->field_10, this->field_4_party_dir_y, 5771 this->angle_from_west, this->field_4_party_dir_y,
6026 this->field_14, this->field_8_party_dir_z); 5772 this->field_14, this->field_8_party_dir_z);
6027 this->field_28 = fixpoint_dot(this->field_18, this->field_0_party_dir_x, 5773 this->field_28 = fixpoint_dot(this->angle_from_east, this->field_0_party_dir_x,
6028 this->field_1C, this->field_4_party_dir_y, 5774 this->angle_from_south, this->field_4_party_dir_y,
6029 this->field_20, this->field_8_party_dir_z); 5775 this->field_20, this->field_8_party_dir_z);
6030 } 5776 }
6031 5777
6032 //----- (0044100D) -------------------------------------------------------- 5778 //----- (0044100D) --------------------------------------------------------
6033 bool sub_44100D() 5779 bool sub_44100D()