comparison Indoor.cpp @ 1544:499761153844

stru149
author Nomad
date Sat, 07 Sep 2013 15:20:57 +0200
parents 965af46e8793
children c4ab816fcc5e
comparison
equal deleted inserted replaced
1543:888157f45502 1544:499761153844
4826 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v18) >> 16; 4826 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v18) >> 16;
4827 v31 = (unsigned __int64)(v24->scale * v18) >> 16; 4827 v31 = (unsigned __int64)(v24->scale * v18) >> 16;
4828 } 4828 }
4829 else 4829 else
4830 { 4830 {
4831 LODWORD(v19) = pBLVRenderParams->field_40 << 16; 4831 __debugbreak(); // sw rendering
4832 /*LODWORD(v19) = pBLVRenderParams->field_40 << 16;
4832 HIDWORD(v19) = pBLVRenderParams->field_40 >> 16; 4833 HIDWORD(v19) = pBLVRenderParams->field_40 >> 16;
4833 v20 = v19 / x; 4834 v20 = v19 / x;
4834 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v19 / x) >> 16; 4835 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v19 / x) >> 16;
4835 v31 = (unsigned __int64)(v24->scale * (signed __int64)v20) >> 16; 4836 v31 = (unsigned __int64)(v24->scale * (signed __int64)v20) >> 16;*/
4836 } 4837 }
4837 //HIWORD(v21) = HIWORD(x); 4838 //HIWORD(v21) = HIWORD(x);
4838 //LOWORD(v21) = 0; 4839 //LOWORD(v21) = 0;
4839 v3->_screenspace_y_scaler_packedfloat = v31; 4840 v3->_screenspace_y_scaler_packedfloat = v31;
4840 v3->field_1E = v34; 4841 v3->field_1E = v34;
4940 break; 4941 break;
4941 uFirstNode = v9; 4942 uFirstNode = v9;
4942 } 4943 }
4943 } 4944 }
4944 //----- (0043FA33) -------------------------------------------------------- 4945 //----- (0043FA33) --------------------------------------------------------
4945 void __fastcall PrepareDecorationsRenderList_BLV(unsigned int uDecorationID, unsigned int uSectorID) 4946 void PrepareDecorationsRenderList_BLV(unsigned int uDecorationID, unsigned int uSectorID)
4946 { 4947 {
4947 LevelDecoration *v2; // esi@1 4948 LevelDecoration *v2; // esi@1
4948 DecorationDesc *v3; // ebx@2 4949 DecorationDesc *v3; // ebx@2
4949 __int16 v4; // ax@2 4950 __int16 v4; // ax@2
4950 double v5; // st7@3 4951 double v5; // st7@3
5150 viewport_right_side[i] = z; 5151 viewport_right_side[i] = z;
5151 } 5152 }
5152 } 5153 }
5153 } 5154 }
5154 //----- (0048653D) -------------------------------------------------------- 5155 //----- (0048653D) --------------------------------------------------------
5155 int stru149::_48653D(int a2, int a3, int a4, int a5, int a6, int a7)//portal frustum culling 5156 void stru149::_48653D_frustum_blv(int a2, int a3, int a4, int a5, int a6, int a7)//portal frustum culling
5156 { 5157 {
5157 stru149 *v7; // esi@1 5158 //stru149 *v7; // esi@1
5158 int v8; // edi@1 5159 int v8; // edi@1
5159 int v9; // eax@1 5160 int v9; // eax@1
5160 //int v10; // edx@1 5161 //int v10; // edx@1
5161 //int v11; // ecx@1 5162 //int v11; // ecx@1
5162 int v12; // eax@1 5163 //int v12; // eax@1
5163 int v13; // ebx@2 5164 //int v13; // ebx@2
5164 int v14; // ecx@2 5165 //int v14; // ecx@2
5165 int v15; // eax@2 5166 //int v15; // eax@2
5166 int v16; // ST14_4@3 5167 int v16; // ST14_4@3
5167 int v17; // ST10_4@3 5168 int v17; // ST10_4@3
5168 int v18; // eax@5 5169 //int v18; // eax@5
5169 int v19; // ST10_4@6 5170 int v19; // ST10_4@6
5170 int v20; // eax@8 5171 //int v20; // eax@8
5171 int v21; // ST10_4@9 5172 int v21; // ST10_4@9
5172 int v22; // eax@10 5173 //int v22; // eax@10
5173 int v23; // ecx@10 5174 //int v23; // ecx@10
5174 int v24; // eax@10 5175 //int v24; // eax@10
5175 int result; // eax@10 5176 //int result; // eax@10
5176 //int v26; // [sp+14h] [bp-14h]@1 5177 //int v26; // [sp+14h] [bp-14h]@1
5177 int v27; // [sp+18h] [bp-10h]@1 5178 //int v27; // [sp+18h] [bp-10h]@1
5178 int v28; // [sp+1Ch] [bp-Ch]@1 5179 int v28; // [sp+1Ch] [bp-Ch]@1
5179 int v29; // [sp+24h] [bp-4h]@1 5180 int v29; // [sp+24h] [bp-4h]@1
5180 int v30; // [sp+30h] [bp+8h]@10 5181 //int v30; // [sp+30h] [bp+8h]@10
5181 int v31; // [sp+3Ch] [bp+14h]@10 5182 //int v31; // [sp+3Ch] [bp+14h]@10
5182 5183
5183 v7 = this;
5184 v8 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotY); 5184 v8 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotY);
5185 v29 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotY); 5185 v29 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotY);
5186 v28 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotX); 5186 v28 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotX);
5187 v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX); 5187 v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX);
5188 //v11 = -pBLVRenderParams->vPartyPos.y; 5188 //v11 = -pBLVRenderParams->vPartyPos.y;
5189 //v26 = -pBLVRenderParams->vPartyPos.x; 5189 //v26 = -pBLVRenderParams->vPartyPos.x;
5190 v27 = v9; 5190 //v27 = v9;
5191 v12 = -pBLVRenderParams->vPartyPos.z; 5191 //v12 = -pBLVRenderParams->vPartyPos.z;
5192 if ( pBLVRenderParams->sPartyRotX ) 5192 if ( pBLVRenderParams->sPartyRotX )
5193 { 5193 {
5194 v16 = v8 * -pBLVRenderParams->vPartyPos.x + v29 * -pBLVRenderParams->vPartyPos.y; 5194 v16 = v8 * -pBLVRenderParams->vPartyPos.x + v29 * -pBLVRenderParams->vPartyPos.y;
5195 v13 = v28;
5196 v17 = -65536 * pBLVRenderParams->vPartyPos.z; 5195 v17 = -65536 * pBLVRenderParams->vPartyPos.z;
5197 v7->field_0_party_dir_x = ((unsigned __int64)(v16 * (signed __int64)v28) >> 16) 5196 this->field_0_party_dir_x = fixpoint_sub0(v16, v28) + fixpoint_sub0((-pBLVRenderParams->vPartyPos.z) << 16, v9);
5198 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)v27) >> 16); 5197 this->field_4_party_dir_y = v8 * -pBLVRenderParams->vPartyPos.y - v29 * -pBLVRenderParams->vPartyPos.x;
5199 v7->field_4_party_dir_y = v8 * -pBLVRenderParams->vPartyPos.y - v29 * -pBLVRenderParams->vPartyPos.x; 5198 this->field_8_party_dir_z = fixpoint_sub0(v17, v28) - fixpoint_sub0(v16, v9);
5200 v14 = v27;
5201 v15 = ((unsigned __int64)(v17 * (signed __int64)v28) >> 16) - ((unsigned __int64)(v16 * (signed __int64)v27) >> 16);
5202 } 5199 }
5203 else 5200 else
5204 { 5201 {
5205 v7->field_0_party_dir_x = v8 * -pBLVRenderParams->vPartyPos.x + v29 * -pBLVRenderParams->vPartyPos.y; 5202 this->field_0_party_dir_x = v8 * -pBLVRenderParams->vPartyPos.x + v29 * -pBLVRenderParams->vPartyPos.y;
5206 v13 = v28; 5203 this->field_4_party_dir_y = v8 * -pBLVRenderParams->vPartyPos.y - v29 * -pBLVRenderParams->vPartyPos.x;
5207 v7->field_4_party_dir_y = v8 * -pBLVRenderParams->vPartyPos.y - v29 * -pBLVRenderParams->vPartyPos.x; 5204 this->field_8_party_dir_z = (-pBLVRenderParams->vPartyPos.z) << 16;
5208 v14 = v27; 5205 }
5209 v15 = v12 << 16; 5206
5210 } 5207 if (pBLVRenderParams->sPartyRotX)
5211 v7->field_8 = v15; 5208 {
5212 if ( pBLVRenderParams->sPartyRotX ) 5209 v19 = fixpoint_sub0(a2, v8) + fixpoint_sub0(a3, v29);
5213 { 5210
5214 v19 = ((unsigned __int64)(a2 * (signed __int64)v8) >> 16) + ((unsigned __int64)(a3 * (signed __int64)v29) >> 16); 5211 this->field_C = fixpoint_sub0(v19, v28) + fixpoint_sub0(a4, v9);
5215 v7->field_C = ((unsigned __int64)(v19 * (signed __int64)v13) >> 16) 5212 this->field_10 = fixpoint_sub0(a3, v8) - fixpoint_sub0(a2, v29);
5216 + ((unsigned __int64)(a4 * (signed __int64)v14) >> 16); 5213 this->field_14 = fixpoint_sub0(a4, v28) - fixpoint_sub0(v19, v9);
5217 v7->field_10 = ((unsigned __int64)(a3 * (signed __int64)v8) >> 16)
5218 - ((unsigned __int64)(a2 * (signed __int64)v29) >> 16);
5219 v18 = ((unsigned __int64)(a4 * (signed __int64)v13) >> 16) - ((unsigned __int64)(v19 * (signed __int64)v14) >> 16);
5220 } 5214 }
5221 else 5215 else
5222 { 5216 {
5223 v7->field_C = ((unsigned __int64)(a2 * (signed __int64)v8) >> 16) 5217 this->field_C = fixpoint_sub0(a2, v8) + fixpoint_sub0(a3, v29);
5224 + ((unsigned __int64)(a3 * (signed __int64)v29) >> 16); 5218 this->field_10 = fixpoint_sub0(a3, v8) - fixpoint_sub0(a2, v29);
5225 v7->field_10 = ((unsigned __int64)(a3 * (signed __int64)v8) >> 16) 5219 this->field_14 = a4;
5226 - ((unsigned __int64)(a2 * (signed __int64)v29) >> 16); 5220 }
5227 v18 = a4; 5221
5228 } 5222 if (pBLVRenderParams->sPartyRotX)
5229 v7->field_14 = v18; 5223 {
5230 if ( pBLVRenderParams->sPartyRotX ) 5224 v21 = fixpoint_sub0(a5, v8) + fixpoint_sub0(a6, v29);
5231 { 5225
5232 v21 = ((unsigned __int64)(a5 * (signed __int64)v8) >> 16) + ((unsigned __int64)(a6 * (signed __int64)v29) >> 16); 5226 this->field_18 = fixpoint_sub0(v21, v28) + fixpoint_sub0(a7, v9);
5233 v7->field_18 = ((unsigned __int64)(v21 * (signed __int64)v13) >> 16) 5227 this->field_1C = fixpoint_sub0(a6, v8) - fixpoint_sub0(a5, v29);
5234 + ((unsigned __int64)(a7 * (signed __int64)v14) >> 16); 5228 this->field_20 = fixpoint_sub0(a7, v28) - fixpoint_sub0(v21, v9);
5235 v7->field_1C = ((unsigned __int64)(a6 * (signed __int64)v8) >> 16)
5236 - ((unsigned __int64)(a5 * (signed __int64)v29) >> 16);
5237 v20 = ((unsigned __int64)(a7 * (signed __int64)v13) >> 16) - ((unsigned __int64)(v21 * (signed __int64)v14) >> 16);
5238 } 5229 }
5239 else 5230 else
5240 { 5231 {
5241 v7->field_18 = ((unsigned __int64)(a5 * (signed __int64)v8) >> 16) 5232 this->field_18 = fixpoint_sub0(a5, v8) + fixpoint_sub0(a6, v29);
5242 + ((unsigned __int64)(a6 * (signed __int64)v29) >> 16); 5233 this->field_1C = fixpoint_sub0(a6, v8) - fixpoint_sub0(a5, v29);
5243 v7->field_1C = ((unsigned __int64)(a6 * (signed __int64)v8) >> 16) 5234 this->field_20 = a7;
5244 - ((unsigned __int64)(a5 * (signed __int64)v29) >> 16); 5235 }
5245 v20 = a7; 5236
5246 } 5237 this->field_18 = -this->field_18;
5247 v7->field_18 = -v7->field_18; 5238 this->field_1C = -this->field_1C;
5248 v7->field_1C = -v7->field_1C; 5239 this->field_20 = -this->field_20;
5249 v7->field_20 = v20; 5240
5250 v22 = v7->field_C; 5241 this->field_24 = fixpoint_dot(this->field_C, this->field_0_party_dir_x,
5251 v7->field_20 = -v7->field_20; 5242 this->field_10, this->field_4_party_dir_y,
5252 v23 = ((unsigned __int64)(v22 * (signed __int64)v7->field_0_party_dir_x) >> 16) 5243 this->field_14, this->field_8_party_dir_z);
5253 + ((unsigned __int64)(v7->field_10 * (signed __int64)v7->field_4_party_dir_y) >> 16) 5244 this->field_28 = fixpoint_dot(this->field_18, this->field_0_party_dir_x,
5254 + ((unsigned __int64)(v7->field_14 * (signed __int64)v7->field_8) >> 16); 5245 this->field_1C, this->field_4_party_dir_y,
5255 v30 = v7->field_18; 5246 this->field_20, this->field_8_party_dir_z);
5256 v24 = v7->field_0_party_dir_x;
5257 v7->field_24 = v23;
5258 v31 = (unsigned __int64)(v30 * (signed __int64)v24) >> 16;
5259 result = (unsigned __int64)(v7->field_1C * (signed __int64)v7->field_4_party_dir_y) >> 16;
5260 v7->field_28 = v31 + result + ((unsigned __int64)(v7->field_20 * (signed __int64)v7->field_8) >> 16);
5261 return result;
5262 } 5247 }
5263 //----- (00407A1C) -------------------------------------------------------- 5248 //----- (00407A1C) --------------------------------------------------------
5264 bool __fastcall sub_407A1C(int x, int z, int y, Vec3_int_ v) 5249 bool __fastcall sub_407A1C(int x, int z, int y, Vec3_int_ v)
5265 { 5250 {
5266 unsigned int v4; // esi@1 5251 unsigned int v4; // esi@1
5371 int v110; // [sp+18h] [bp-64h]@31 5356 int v110; // [sp+18h] [bp-64h]@31
5372 int i; // [sp+18h] [bp-64h]@90 5357 int i; // [sp+18h] [bp-64h]@90
5373 int v112; // [sp+18h] [bp-64h]@128 5358 int v112; // [sp+18h] [bp-64h]@128
5374 signed int v113; // [sp+20h] [bp-5Ch]@1 5359 signed int v113; // [sp+20h] [bp-5Ch]@1
5375 signed int v114; // [sp+24h] [bp-58h]@1 5360 signed int v114; // [sp+24h] [bp-58h]@1
5376 unsigned __int64 a4; // [sp+28h] [bp-54h]@1 5361 //unsigned __int64 a4; // [sp+28h] [bp-54h]@1
5377 unsigned int a4_8; // [sp+30h] [bp-4Ch]@1 5362 unsigned int a4_8; // [sp+30h] [bp-4Ch]@1
5378 int v117; // [sp+34h] [bp-48h]@4 5363 int v117; // [sp+34h] [bp-48h]@4
5379 int v118; // [sp+34h] [bp-48h]@39 5364 int v118; // [sp+34h] [bp-48h]@39
5380 int v119; // [sp+34h] [bp-48h]@75 5365 int v119; // [sp+34h] [bp-48h]@75
5381 int v120; // [sp+34h] [bp-48h]@113 5366 int v120; // [sp+34h] [bp-48h]@113
5440 int v_4c; // [sp+8Ch] [bp+10h]@141 5425 int v_4c; // [sp+8Ch] [bp+10h]@141
5441 int v_8; // [sp+90h] [bp+14h]@53 5426 int v_8; // [sp+90h] [bp+14h]@53
5442 5427
5443 __debugbreak(); 5428 __debugbreak();
5444 5429
5445 a4 = __PAIR__(z, x);
5446 v4 = stru_5C6E00->Atan2(v.x - x, v.y - z); 5430 v4 = stru_5C6E00->Atan2(v.x - x, v.y - z);
5447 v114 = 0; 5431 v114 = 0;
5448 v97.z = y; 5432 v97.z = y;
5433 v97.x = x;
5434 v97.y = z;
5449 v113 = 0; 5435 v113 = 0;
5450 a4_8 = v4; 5436 a4_8 = v4;
5451 *(_QWORD *)&v97.x = a4;
5452 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) 5437 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor)
5453 { 5438 {
5454 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz); 5439 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz);
5455 v45.z = v.z; 5440 v45.z = v.z;
5456 *(_QWORD *)&v45.x = *(_QWORD *)&v; 5441 *(_QWORD *)&v45.x = *(_QWORD *)&v;
5600 v58 = outz; 5585 v58 = outz;
5601 v55 = pOut.y; 5586 v55 = pOut.y;
5602 v54 = pOut.x; 5587 v54 = pOut.x;
5603 } 5588 }
5604 v72.z = y; 5589 v72.z = y;
5605 *(_QWORD *)&v72.x = a4; 5590 v72.x = x;
5591 v72.y = z;
5606 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v72, &pOut.x, &pOut.y, &outz); 5592 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v72, &pOut.x, &pOut.y, &outz);
5607 v73.z = v.z; 5593 v73.z = v.z;
5608 *(_QWORD *)&v73.x = *(_QWORD *)&v; 5594 v73.x = v.x;
5595 v73.y = v.y;
5609 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v73, &outx, &outy, &v163); 5596 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v73, &outx, &outy, &v163);
5610 v74 = outy - pOut.y; 5597 v74 = outy - pOut.y;
5611 v75 = v163 - outz; 5598 v75 = v163 - outz;
5612 v76 = outx - pOut.x; 5599 v76 = outx - pOut.x;
5613 v77 = integer_sqrt(v76 * v76 + v74 * v74 + v75 * v75); 5600 v77 = integer_sqrt(v76 * v76 + v74 * v74 + v75 * v75);
5890 goto LABEL_36; 5877 goto LABEL_36;
5891 } 5878 }
5892 } 5879 }
5893 LABEL_37: 5880 LABEL_37:
5894 v27.z = y; 5881 v27.z = y;
5895 *(_QWORD *)&v27.x = a4; 5882 v27.x = x;
5883 v27.y = z;
5896 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v27, &pOut.x, &pOut.y, &outz); 5884 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v27, &pOut.x, &pOut.y, &outz);
5897 v28.z = v.z; 5885 v28.z = v.z;
5898 *(_QWORD *)&v28.x = *(_QWORD *)&v; 5886 v28.x = v.x;
5887 v28.y = v.y;
5899 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v28, &outx, &outy, &v163); 5888 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v28, &outx, &outy, &v163);
5900 v29 = outy - pOut.y; 5889 v29 = outy - pOut.y;
5901 v30 = v163 - outz; 5890 v30 = v163 - outz;
5902 v31 = outx - pOut.x; 5891 v31 = outx - pOut.x;
5903 v32 = integer_sqrt(v31 * v31 + v29 * v29 + v30 * v30); 5892 v32 = integer_sqrt(v31 * v31 + v29 * v29 + v30 * v30);