comparison mm7_3.cpp @ 1640:afc1c3514dd5

Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
author Nomad
date Tue, 17 Sep 2013 17:40:59 +0200
parents ccde94f02b75
children 466c5e15f524
comparison
equal deleted inserted replaced
1639:b60ddd777d50 1640:afc1c3514dd5
4059 do 4059 do
4060 { 4060 {
4061 v4 = *(float *)(v3 - 4); 4061 v4 = *(float *)(v3 - 4);
4062 LODWORD(v37) = *(int *)v3; 4062 LODWORD(v37) = *(int *)v3;
4063 LODWORD(v36) = *(int *)(v3 + 4); 4063 LODWORD(v36) = *(int *)(v3 + 4);
4064 if ( pBLVRenderParams->sPartyRotX ) 4064 if (pGame->pIndoorCameraD3D->sRotationX)
4065 { 4065 {
4066 v5 = v4 - (double)pBLVRenderParams->vPartyPos.x; 4066 v5 = v4 - (double)pGame->pIndoorCameraD3D->vPartyPos.x;
4067 v6 = v37 - (double)pBLVRenderParams->vPartyPos.y; 4067 v6 = v37 - (double)pGame->pIndoorCameraD3D->vPartyPos.y;
4068 if ( pRenderer->pRenderD3D ) 4068 //if ( pRenderer->pRenderD3D )
4069 { 4069 //{
4070 v41 = pBLVRenderParams->fSineY * v6 + pBLVRenderParams->fCosineY * v5; 4070 v41 = pBLVRenderParams->fSineY * v6 + pBLVRenderParams->fCosineY * v5;
4071 v7 = pBLVRenderParams->fSineY * v5 - pBLVRenderParams->fCosineY * v6; 4071 v7 = pBLVRenderParams->fSineY * v5 - pBLVRenderParams->fCosineY * v6;
4072 } 4072 /*}
4073 else 4073 else
4074 { 4074 {
4075 v41 = pBLVRenderParams->fCosineY * v5 - pBLVRenderParams->fSineY * v6; 4075 v41 = pBLVRenderParams->fCosineY * v5 - pBLVRenderParams->fSineY * v6;
4076 v7 = pBLVRenderParams->fSineY * v5 + pBLVRenderParams->fCosineY * v6; 4076 v7 = pBLVRenderParams->fSineY * v5 + pBLVRenderParams->fCosineY * v6;
4077 } 4077 }*/
4078 v8 = v7; 4078 v8 = v7;
4079 v9 = v36 - (double)pBLVRenderParams->vPartyPos.z; 4079 v9 = v36 - (double)pGame->pIndoorCameraD3D->vPartyPos.z;
4080 v10 = pBLVRenderParams->fCosineNegX * v41 - pBLVRenderParams->fSineNegX * v9; 4080 v10 = pBLVRenderParams->fCosineNegX * v41 - pBLVRenderParams->fSineNegX * v9;
4081 v11 = v8; 4081 v11 = v8;
4082 v12 = pBLVRenderParams->fCosineNegX * v9 + pBLVRenderParams->fSineNegX * v41; 4082 v12 = pBLVRenderParams->fCosineNegX * v9 + pBLVRenderParams->fSineNegX * v41;
4083 } 4083 }
4084 else 4084 else
4085 { 4085 {
4086 v42 = v4 - (double)pBLVRenderParams->vPartyPos.x; 4086 v42 = v4 - (double)pGame->pIndoorCameraD3D->vPartyPos.x;
4087 v39 = v37 - (double)pBLVRenderParams->vPartyPos.y; 4087 v39 = v37 - (double)pGame->pIndoorCameraD3D->vPartyPos.y;
4088 if ( pRenderer->pRenderD3D ) 4088 //if ( pRenderer->pRenderD3D )
4089 { 4089 //{
4090 v10 = pBLVRenderParams->fSineY * v39 + pBLVRenderParams->fCosineY * v42; 4090 v10 = pBLVRenderParams->fSineY * v39 + pBLVRenderParams->fCosineY * v42;
4091 v11 = pBLVRenderParams->fSineY * v42 - pBLVRenderParams->fCosineY * v39; 4091 v11 = pBLVRenderParams->fSineY * v42 - pBLVRenderParams->fCosineY * v39;
4092 } 4092 /*}
4093 else 4093 else
4094 { 4094 {
4095 v10 = pBLVRenderParams->fCosineY * v42 - pBLVRenderParams->fSineY * v39; 4095 v10 = pBLVRenderParams->fCosineY * v42 - pBLVRenderParams->fSineY * v39;
4096 v11 = pBLVRenderParams->fSineY * v42 + pBLVRenderParams->fCosineY * v39; 4096 v11 = pBLVRenderParams->fSineY * v42 + pBLVRenderParams->fCosineY * v39;
4097 } 4097 }*/
4098 v12 = v36 - (double)pBLVRenderParams->vPartyPos.z; 4098 v12 = v36 - (double)pGame->pIndoorCameraD3D->vPartyPos.z;
4099 } 4099 }
4100 v13 = v12; 4100 v13 = v12;
4101 ++v2; 4101 ++v2;
4102 *(int *)(v3 + 84) = LODWORD(v13); 4102 *(int *)(v3 + 84) = LODWORD(v13);
4103 v14 = *(int *)(v3 + 8); 4103 v14 = *(int *)(v3 + 8);
4113 { 4113 {
4114 v15 = (char *)&this->field_14[1]; 4114 v15 = (char *)&this->field_14[1];
4115 v31 = 3; 4115 v31 = 3;
4116 do 4116 do
4117 { 4117 {
4118 v40 = (double)stru_5C6E00->Cos(pODMRenderParams->rotation_x) * 0.0000152587890625; 4118 v40 = (double)stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX) * 0.0000152587890625;
4119 v32 = (double)stru_5C6E00->Sin(pODMRenderParams->rotation_x) * 0.0000152587890625; 4119 v32 = (double)stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX) * 0.0000152587890625;
4120 v34 = (double)stru_5C6E00->Cos(pODMRenderParams->rotation_y) * 0.0000152587890625; 4120 v34 = (double)stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY) * 0.0000152587890625;
4121 v33 = (double)stru_5C6E00->Sin(pODMRenderParams->rotation_y) * 0.0000152587890625; 4121 v33 = (double)stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY) * 0.0000152587890625;
4122 //v16 = stru_5C6E00->Sin(pODMRenderParams->rotation_y); 4122 //v16 = stru_5C6E00->Sin(pODMRenderParams->rotation_y);
4123 LODWORD(v38) = *(int *)v15; 4123 LODWORD(v38) = *(int *)v15;
4124 //UNDEF(v17); 4124 //UNDEF(v17);
4125 v20 = *((float *)v15 - 1) - (double)pODMRenderParams->vPartyPos.x; 4125 v20 = *((float *)v15 - 1) - (double)pGame->pIndoorCameraD3D->vPartyPos.x;
4126 //if ( v19 | v18 ) 4126 //if ( v19 | v18 )
4127 if (pODMRenderParams->vPartyPos.x == 0) 4127 if (pGame->pIndoorCameraD3D->vPartyPos.x == 0)
4128 { 4128 {
4129 v27 = v20; 4129 v27 = v20;
4130 LODWORD(v35) = *((int *)v15 + 1); 4130 LODWORD(v35) = *((int *)v15 + 1);
4131 v28 = v38 - (double)pODMRenderParams->vPartyPos.y; 4131 v28 = v38 - (double)pGame->pIndoorCameraD3D->vPartyPos.y;
4132 v25 = v33 * v28 + v34 * v27; 4132 v25 = v33 * v28 + v34 * v27;
4133 v26 = v34 * v28 - v33 * v27; 4133 v26 = v34 * v28 - v33 * v27;
4134 } 4134 }
4135 else 4135 else
4136 { 4136 {
4137 v21 = v20; 4137 v21 = v20;
4138 v22 = v38 - (double)pODMRenderParams->vPartyPos.y; 4138 v22 = v38 - (double)pGame->pIndoorCameraD3D->vPartyPos.y;
4139 v23 = v33 * v22 + v34 * v21; 4139 v23 = v33 * v22 + v34 * v21;
4140 v24 = *((float *)v15 + 1) - (double)pODMRenderParams->vPartyPos.z; 4140 v24 = *((float *)v15 + 1) - (double)pGame->pIndoorCameraD3D->vPartyPos.z;
4141 v25 = v32 * v24 + v40 * v23; 4141 v25 = v32 * v24 + v40 * v23;
4142 v26 = v34 * v22 - v33 * v21; 4142 v26 = v34 * v22 - v33 * v21;
4143 v35 = v40 * v24 - v32 * v23; 4143 v35 = v40 * v24 - v32 * v23;
4144 } 4144 }
4145 *((int *)v15 + 21) = LODWORD(v35); 4145 *((int *)v15 + 21) = LODWORD(v35);
4708 4708
4709 //v16 = unused; 4709 //v16 = unused;
4710 angle = (signed int)(pODMRenderParams->uCameraFovInDegrees << 11) / 360 >> 1; 4710 angle = (signed int)(pODMRenderParams->uCameraFovInDegrees << 11) / 360 >> 1;
4711 //v14 = uModelID; 4711 //v14 = uModelID;
4712 v2 = &pOutdoor->pBModels[uModelID]; 4712 v2 = &pOutdoor->pBModels[uModelID];
4713 v3 = v2->vBoundingCenter.x - pODMRenderParams->vPartyPos.x; 4713 v3 = v2->vBoundingCenter.x - pGame->pIndoorCameraD3D->vPartyPos.x;
4714 v4 = v2->vBoundingCenter.y - pODMRenderParams->vPartyPos.y; 4714 v4 = v2->vBoundingCenter.y - pGame->pIndoorCameraD3D->vPartyPos.y;
4715 v5 = stru_5C6E00->Cos(pODMRenderParams->rotation_y); 4715 v5 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY);
4716 v21 = stru_5C6E00->Sin(pODMRenderParams->rotation_y); 4716 v21 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY);
4717 v18 = stru_5C6E00->Cos(pODMRenderParams->rotation_x); 4717 v18 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX);
4718 stru_5C6E00->Sin(pODMRenderParams->rotation_x); 4718 stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX);
4719 v6 = v5; 4719 v6 = v5;
4720 v17 = v3 * v5 + v4 * v21; 4720 v17 = v3 * v5 + v4 * v21;
4721 if (pODMRenderParams->rotation_x) 4721 if (pGame->pIndoorCameraD3D->sRotationX)
4722 v17 = (unsigned __int64)(v17 * (signed __int64)v18) >> 16; 4722 v17 = (unsigned __int64)(v17 * (signed __int64)v18) >> 16;
4723 v19 = v4 * v6 - v3 * v21; 4723 v19 = v4 * v6 - v3 * v21;
4724 v7 = abs(v4); 4724 v7 = abs(v4);
4725 v8 = abs(v3); 4725 v8 = abs(v3);
4726 v9 = int_get_vector_length(v8, v7, 0); 4726 v9 = int_get_vector_length(v8, v7, 0);
5306 { 5306 {
5307 if (DrawSkyD3D_Skybox()) 5307 if (DrawSkyD3D_Skybox())
5308 return; 5308 return;
5309 } 5309 }
5310 5310
5311 v30 = ((double)(pODMRenderParams->int_fov_rad * pODMRenderParams->vPartyPos.z) 5311 v30 = ((double)(pODMRenderParams->int_fov_rad * pGame->pIndoorCameraD3D->vPartyPos.z)
5312 / ((double)pODMRenderParams->int_fov_rad + 8192.0) + pViewport->uScreenCenterY);//184 изменяется при подъёме на высоту 5312 / ((double)pODMRenderParams->int_fov_rad + 8192.0) + pViewport->uScreenCenterY);//184 изменяется при подъёме на высоту
5313 v38 = pViewport->uScreenCenterY - pODMRenderParams->int_fov_rad / 5313 v38 = pViewport->uScreenCenterY - pODMRenderParams->int_fov_rad /
5314 (pODMRenderParams->shading_dist_mist * cos(pODMRenderParams->rotation_x * 0.003066406352445483) + 0.0000001000000011686097) * 5314 (pODMRenderParams->shading_dist_mist * cos(pGame->pIndoorCameraD3D->sRotationX * 0.003066406352445483) + 0.0000001000000011686097) *
5315 (pODMRenderParams->shading_dist_mist * -sin(pODMRenderParams->rotation_x * 0.003066406352445483) - pODMRenderParams->vPartyPos.z);//61 / 184 / 310 изменяется при наклоне камеры 5315 (pODMRenderParams->shading_dist_mist * -sin(pGame->pIndoorCameraD3D->sRotationX * 0.003066406352445483) - pGame->pIndoorCameraD3D->vPartyPos.z);//61 / 184 / 310 изменяется при наклоне камеры
5316 5316
5317 pSkyPolygon.Create_48607B(&stru_8019C8); 5317 pSkyPolygon.Create_48607B(&stru_8019C8);
5318 pSkyPolygon.ptr_38->_48694B_frustum_sky();//maybe creating skydome(возможно создание купола неба) 5318 pSkyPolygon.ptr_38->_48694B_frustum_sky();//maybe creating skydome(возможно создание купола неба)
5319 pSkyPolygon.uTileBitmapID = pOutdoor->uSky_TextureID;//номер текстуры 5319 pSkyPolygon.uTileBitmapID = pOutdoor->uSky_TextureID;//номер текстуры
5320 pSkyPolygon.pTexture = (Texture *)(pOutdoor->uSky_TextureID != -1 ? &pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID] : 0);//текстура неба 5320 pSkyPolygon.pTexture = (Texture *)(pOutdoor->uSky_TextureID != -1 ? &pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID] : 0);//текстура неба
5323 5323
5324 pSkyPolygon.dimming_level = 0;//затемнение 5324 pSkyPolygon.dimming_level = 0;//затемнение
5325 pSkyPolygon.uNumVertices = 4;//количество вершин 5325 pSkyPolygon.uNumVertices = 4;//количество вершин
5326 5326
5327 //centering(центруем)--наклон камеры ----------------------------------------// 5327 //centering(центруем)--наклон камеры ----------------------------------------//
5328 pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pODMRenderParams->rotation_x + 16);//-3216, вверх: -28020, вниз: 22078 5328 pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16);//-3216, вверх: -28020, вниз: 22078
5329 pSkyPolygon.v_18.y = 0; 5329 pSkyPolygon.v_18.y = 0;
5330 pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pODMRenderParams->rotation_x + 16);//-65457, вверх: -59244, вниз: -61705 5330 pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16);//-65457, вверх: -59244, вниз: -61705
5331 //---------------------------------------------------------------------------// 5331 //---------------------------------------------------------------------------//
5332 5332
5333 pSkyPolygon.field_24 = 0x2000000; 5333 pSkyPolygon.field_24 = 0x2000000;
5334 5334
5335 pSkyPolygon.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed;//60928 5335 pSkyPolygon.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed;//60928
5556 pOutdoor->MessWithLUN(); 5556 pOutdoor->MessWithLUN();
5557 v7 = strlen("levels\\"); 5557 v7 = strlen("levels\\");
5558 strcpy(Source, &pFilename[v7]); 5558 strcpy(Source, &pFilename[v7]);
5559 strcpy(pOutdoor->pLevelFilename, Source); 5559 strcpy(pOutdoor->pLevelFilename, Source);
5560 pWeather->Initialize(); 5560 pWeather->Initialize();
5561 pODMRenderParams->rotation_y = pParty->sRotationY; 5561 pGame->pIndoorCameraD3D->sRotationY = pParty->sRotationY;
5562 pODMRenderParams->rotation_x = pParty->sRotationX; 5562 pGame->pIndoorCameraD3D->sRotationX = pParty->sRotationX;
5563 pODMRenderParams->RotationToInts(); 5563 pODMRenderParams->RotationToInts();
5564 pOutdoor->UpdateSunlightVectors(); 5564 pOutdoor->UpdateSunlightVectors();
5565 5565
5566 float fov_rad; 5566 float fov_rad;
5567 float fov_rad_inv; 5567 float fov_rad_inv;
6154 v7 = pODMRenderParams->camera_rotation_y_int_sine; 6154 v7 = pODMRenderParams->camera_rotation_y_int_sine;
6155 v27 = pODMRenderParams->camera_rotation_x_int_sine; 6155 v27 = pODMRenderParams->camera_rotation_x_int_sine;
6156 //v8 = -pIndoorCamera->pos.y; 6156 //v8 = -pIndoorCamera->pos.y;
6157 v9 = pODMRenderParams->camera_rotation_y_int_cosine; 6157 v9 = pODMRenderParams->camera_rotation_y_int_cosine;
6158 //v26 = -pIndoorCamera->pos.z; 6158 //v26 = -pIndoorCamera->pos.z;
6159 v11 = pODMRenderParams->camera_rotation_y_int_cosine * -pODMRenderParams->vPartyPos.x + pODMRenderParams->camera_rotation_y_int_sine * -pODMRenderParams->vPartyPos.y; 6159 v11 = pODMRenderParams->camera_rotation_y_int_cosine * -pGame->pIndoorCameraD3D->vPartyPos.x + pODMRenderParams->camera_rotation_y_int_sine * -pGame->pIndoorCameraD3D->vPartyPos.y;
6160 v24 = pODMRenderParams->camera_rotation_y_int_cosine * -pODMRenderParams->vPartyPos.y - pODMRenderParams->camera_rotation_y_int_sine * -pODMRenderParams->vPartyPos.x; 6160 v24 = pODMRenderParams->camera_rotation_y_int_cosine * -pGame->pIndoorCameraD3D->vPartyPos.y - pODMRenderParams->camera_rotation_y_int_sine * -pGame->pIndoorCameraD3D->vPartyPos.x;
6161 if (pODMRenderParams->rotation_x) 6161 if (pGame->pIndoorCameraD3D->sRotationX)
6162 { 6162 {
6163 this->field_0_party_dir_x = fixpoint_sub0(v11, pODMRenderParams->camera_rotation_x_int_cosine) + 6163 this->field_0_party_dir_x = fixpoint_sub0(v11, pODMRenderParams->camera_rotation_x_int_cosine) +
6164 fixpoint_sub0((-pODMRenderParams->vPartyPos.z) << 16, pODMRenderParams->camera_rotation_x_int_sine); 6164 fixpoint_sub0((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pODMRenderParams->camera_rotation_x_int_sine);
6165 this->field_4_party_dir_y = v24; 6165 this->field_4_party_dir_y = v24;
6166 this->field_8_party_dir_z = fixpoint_sub0((-pODMRenderParams->vPartyPos.z) << 16, v25) - fixpoint_sub0(v11, v27); 6166 this->field_8_party_dir_z = fixpoint_sub0((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v25) - fixpoint_sub0(v11, v27);
6167 } 6167 }
6168 else 6168 else
6169 { 6169 {
6170 this->field_0_party_dir_x = v11; 6170 this->field_0_party_dir_x = v11;
6171 this->field_4_party_dir_y = v24; 6171 this->field_4_party_dir_y = v24;
6172 this->field_8_party_dir_z = (-pODMRenderParams->vPartyPos.z) << 16; 6172 this->field_8_party_dir_z = (-pGame->pIndoorCameraD3D->vPartyPos.z) << 16;
6173 } 6173 }
6174 6174
6175 if (pODMRenderParams->rotation_x) 6175 if (pGame->pIndoorCameraD3D->sRotationX)
6176 { 6176 {
6177 v17 = fixpoint_sub0(a2, v9) + fixpoint_sub0(a3, v7); 6177 v17 = fixpoint_sub0(a2, v9) + fixpoint_sub0(a3, v7);
6178 6178
6179 this->field_C = fixpoint_sub0(v17, v25) + fixpoint_sub0(a4, v27); 6179 this->field_C = fixpoint_sub0(v17, v25) + fixpoint_sub0(a4, v27);
6180 this->field_10 = fixpoint_sub0(a3, v9) - fixpoint_sub0(a2, v7); 6180 this->field_10 = fixpoint_sub0(a3, v9) - fixpoint_sub0(a2, v7);
6185 this->field_C = fixpoint_sub0(a2, v9) + fixpoint_sub0(a3, v7); 6185 this->field_C = fixpoint_sub0(a2, v9) + fixpoint_sub0(a3, v7);
6186 this->field_10 = fixpoint_sub0(a3, v9) - fixpoint_sub0(a2, v7); 6186 this->field_10 = fixpoint_sub0(a3, v9) - fixpoint_sub0(a2, v7);
6187 this->field_14 = a4; 6187 this->field_14 = a4;
6188 } 6188 }
6189 6189
6190 if (pODMRenderParams->rotation_x) 6190 if (pGame->pIndoorCameraD3D->sRotationX)
6191 { 6191 {
6192 v19 = fixpoint_sub0(a5, v9) + fixpoint_sub0(a6, v7); 6192 v19 = fixpoint_sub0(a5, v9) + fixpoint_sub0(a6, v7);
6193 6193
6194 this->field_18 = fixpoint_sub0(v19, v25) + fixpoint_sub0(a7, v27); 6194 this->field_18 = fixpoint_sub0(v19, v25) + fixpoint_sub0(a7, v27);
6195 this->field_1C = fixpoint_sub0(a6, v9) - fixpoint_sub0(a5, v7); 6195 this->field_1C = fixpoint_sub0(a6, v9) - fixpoint_sub0(a5, v7);