comparison Indoor.cpp @ 2275:8193a64c7461

Слияние
author Ritor1
date Fri, 14 Mar 2014 09:32:42 +0600
parents 42b6a910b5d8
children e2433db49428
comparison
equal deleted inserted replaced
2274:90f56da08d76 2275:8193a64c7461
91 91
92 92
93 //----- (0043F39E) -------------------------------------------------------- 93 //----- (0043F39E) --------------------------------------------------------
94 void __fastcall PrepareDrawLists_BLV() 94 void __fastcall PrepareDrawLists_BLV()
95 { 95 {
96 //int *v1; // ecx@1
97 //double v2; // ST30_8@3
98 //double v3; // ST30_8@6
99 //double v4; // ST28_8@6
100 int v5; // eax@4 96 int v5; // eax@4
101 //int v6; // eax@7
102 unsigned int v7; // ebx@8 97 unsigned int v7; // ebx@8
103 BLVSector *v8; // esi@8 98 BLVSector *v8; // esi@8
104 //unsigned __int16 *v9; // edi@8
105 //int i; // [sp+18h] [bp-8h]@7
106 //unsigned __int8 v11; // [sp+1Ch] [bp-4h]@3
107 //signed int v12; // [sp+1Ch] [bp-4h]@8
108 99
109 pBLVRenderParams->Reset(); 100 pBLVRenderParams->Reset();
110 pMobileLightsStack->uNumLightsActive = 0; 101 pMobileLightsStack->uNumLightsActive = 0;
111 //uNumMobileLightsApplied = 0; 102 //uNumMobileLightsApplied = 0;
112 uNumDecorationsDrawnThisFrame = 0; 103 uNumDecorationsDrawnThisFrame = 0;
135 } 126 }
136 PrepareBspRenderList_BLV(); 127 PrepareBspRenderList_BLV();
137 PrepareItemsRenderList_BLV(); 128 PrepareItemsRenderList_BLV();
138 PrepareActorRenderList_BLV(); 129 PrepareActorRenderList_BLV();
139 130
140 //v6 = 0;
141 for (uint i = 0; i < pBspRenderer->uNumVisibleNotEmptySectors; ++i) 131 for (uint i = 0; i < pBspRenderer->uNumVisibleNotEmptySectors; ++i)
142 { 132 {
143 v7 = pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[i]; 133 v7 = pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[i];
144 //v12 = 0;
145 v8 = &pIndoor->pSectors[pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[i]]; 134 v8 = &pIndoor->pSectors[pBspRenderer->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[i]];
146 //v9 = v8->pDecorationIDs;
147 135
148 for (uint j = 0; j < v8->uNumDecorations; ++j) 136 for (uint j = 0; j < v8->uNumDecorations; ++j)
149 //if ( v8->uNumDecorations > 0 )
150 {
151 // do
152 PrepareDecorationsRenderList_BLV(v8->pDecorationIDs[j], v7); 137 PrepareDecorationsRenderList_BLV(v8->pDecorationIDs[j], v7);
153 // while ( v12 < v8->uNumDecorations );
154 }
155 //v6 = i + 1;
156 } 138 }
157 FindBillboardsLightLevels_BLV(); 139 FindBillboardsLightLevels_BLV();
158 pGame->PrepareBloodsplats(); 140 pGame->PrepareBloodsplats();
159 } 141 }
160 142
161
162
163 //----- (004407D9) -------------------------------------------------------- 143 //----- (004407D9) --------------------------------------------------------
164 void BLVRenderParams::Reset() 144 void BLVRenderParams::Reset()
165 { 145 {
166 //IndoorLocation_drawstru *v2; // ebx@1
167 //int v4; // ST08_4@1
168 //int v5; // ST04_4@1
169 //int v6; // ST00_4@1
170 int v7; // eax@1 146 int v7; // eax@1
171 int v8; // ST08_4@2 147 int v8; // ST08_4@2
172 int v9; // ST04_4@2 148 int v9; // ST04_4@2
173 int v10; // ST00_4@2 149 int v10; // ST00_4@2
174 //unsigned int v11; // edi@4
175 //unsigned int v12; // ecx@4
176 //int v13; // edx@4
177 //signed int v14; // ecx@4
178 //unsigned int v15; // edx@4
179 //unsigned int v16; // eax@4
180 double v17; // st7@5 150 double v17; // st7@5
181 int v18; // eax@5 151 int v18; // eax@5
182 double v19; // st7@5 152 double v19; // st7@5
183 int v20; // eax@5 153 int v20; // eax@5
184 double v21; // st7@5 154 double v21; // st7@5
186 unsigned int v23; // edx@5 156 unsigned int v23; // edx@5
187 unsigned int v24; // ecx@5 157 unsigned int v24; // ecx@5
188 int v25; // eax@5 158 int v25; // eax@5
189 int v26; // eax@5 159 int v26; // eax@5
190 signed int v27; // eax@6 160 signed int v27; // eax@6
191 //int result; // eax@6
192 int v29; // [sp+24h] [bp+8h]@5 161 int v29; // [sp+24h] [bp+8h]@5
193 162
194 this->field_0_timer_ = pEventTimer->uTotalGameTimeElapsed; 163 this->field_0_timer_ = pEventTimer->uTotalGameTimeElapsed;
195 164
196 pGame->pIndoorCameraD3D->debug_flags = 0; 165 pGame->pIndoorCameraD3D->debug_flags = 0;
293 } 262 }
294 263
295 //----- (00440B44) -------------------------------------------------------- 264 //----- (00440B44) --------------------------------------------------------
296 void IndoorLocation::ExecDraw(bool bD3D) 265 void IndoorLocation::ExecDraw(bool bD3D)
297 { 266 {
298 int v2; // eax@3
299 //IndoorCameraD3D_Vec4 *v3; // edx@4
300 //unsigned int v5; // ecx@9
301 //RenderVertexSoft *v6; // [sp-4h] [bp-8h]@4
302
303 if (bD3D) 267 if (bD3D)
304 { 268 {
305 pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); 269 pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
306 for (uint i = 0; i < pBspRenderer->num_faces; ++i) 270 for (uint i = 0; i < pBspRenderer->num_faces; ++i)
307 { 271 {
308 //v2 = pBspRenderer->faces[i].uNodeID;
309 if (pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].viewing_portal_id == -1) 272 if (pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].viewing_portal_id == -1)
310 IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID, nullptr, 4, nullptr); 273 IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID, nullptr, 4, nullptr);
311 else 274 else
312 IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID, pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].std__vector_0007AC, 4, pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].pPortalBounding); 275 IndoorLocation::ExecDraw_d3d(pBspRenderer->faces[i].uFaceID,
276 pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].std__vector_0007AC, 4,
277 pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].pPortalBounding);
313 } 278 }
314 } 279 }
315 else for (uint j = 0; j < pBspRenderer->num_faces; ++j ) 280 else for (uint j = 0; j < pBspRenderer->num_faces; ++j )
316 { 281 {
317 __debugbreak(); // no SW 282 __debugbreak(); // no SW
370 } 335 }
371 } 336 }
372 } 337 }
373 } 338 }
374 */ 339 */
375
376
377
378 340
379 //----- (00441BD4) -------------------------------------------------------- 341 //----- (00441BD4) --------------------------------------------------------
380 void IndoorLocation::Draw() 342 void IndoorLocation::Draw()
381 { 343 {
382 //int v0; // eax@1 344 //int v0; // eax@1
868 memset(pNodes, 0, 5000*sizeof(BSPNode)); 830 memset(pNodes, 0, 5000*sizeof(BSPNode));
869 memset(pMapOutlines,0, sizeof(BLVMapOutlines)); 831 memset(pMapOutlines,0, sizeof(BLVMapOutlines));
870 return true; 832 return true;
871 } 833 }
872 else 834 else
873 {
874 return false; 835 return false;
875 }
876 } 836 }
877 837
878 //----- (00444810) -------------------------------------------------------- 838 //----- (00444810) --------------------------------------------------------
879 unsigned int IndoorLocation::GetLocationIndex(const char *Str1) 839 unsigned int IndoorLocation::GetLocationIndex(const char *Str1)
880 { 840 {
893 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && (sLightID <= pIndoor->uNumLights - 1) && (sLightID >= 0) ) 853 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && (sLightID <= pIndoor->uNumLights - 1) && (sLightID >= 0) )
894 { 854 {
895 if ( bToggle ) 855 if ( bToggle )
896 pIndoor->pLights[sLightID].uAtributes &= 0xFFFFFFF7u; 856 pIndoor->pLights[sLightID].uAtributes &= 0xFFFFFFF7u;
897 else 857 else
898 pIndoor->pLights[sLightID].uAtributes |= 8u; 858 pIndoor->pLights[sLightID].uAtributes |= 8;
899 pParty->uFlags |= 2u; 859 pParty->uFlags |= 2;
900 } 860 }
901 } 861 }
902 862
903 //----- (00498E0A) -------------------------------------------------------- 863 //----- (00498E0A) --------------------------------------------------------
904 bool IndoorLocation::Load(char *pFilename, int a3, size_t _i, char *pDest) 864 bool IndoorLocation::Load(char *pFilename, int a3, size_t _i, char *pDest)
1956 if (_v244) 1916 if (_v244)
1957 ++dlv.uNumRespawns; 1917 ++dlv.uNumRespawns;
1958 //v201 = pFilename; 1918 //v201 = pFilename;
1959 *(int *)pDest = 1; 1919 *(int *)pDest = 1;
1960 File = pGames_LOD->FindContainer(pFilename, 0); 1920 File = pGames_LOD->FindContainer(pFilename, 0);
1961 fread(&header, 0x10u, 1u, File); 1921 fread(&header, 0x10u, 1, File);
1962 uint v155 = header.uCompressedSize; 1922 uint v155 = header.uCompressedSize;
1963 uint Count = header.uDecompressedSize; 1923 uint Count = header.uDecompressedSize;
1964 BLVFace* Src = (BLVFace *)malloc(header.uDecompressedSize); 1924 BLVFace* Src = (BLVFace *)malloc(header.uDecompressedSize);
1965 pRawDLV = Src; 1925 pRawDLV = Src;
1966 if ( v155 <= Count ) 1926 if ( v155 <= Count )
1967 { 1927 {
1968 if ( v155 == Count ) 1928 if ( v155 == Count )
1969 {
1970 fread(Src, 1, Count, File); 1929 fread(Src, 1, Count, File);
1971 }
1972 else 1930 else
1973 { 1931 {
1974 void* _uSourceLen = malloc(v155); 1932 void* _uSourceLen = malloc(v155);
1975 fread(_uSourceLen, v155, 1, File); 1933 fread(_uSourceLen, v155, 1, File);
1976 zlib::MemUnzip(Src, &Count, _uSourceLen, v155); 1934 zlib::MemUnzip(Src, &Count, _uSourceLen, v155);
1977 free(_uSourceLen); 1935 free(_uSourceLen);
1978 } 1936 }
1979 } 1937 }
1980 else 1938 else
1981 { 1939 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1195", 0);
1982 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Polydata.cpp:1195", 0);
1983 }
1984 pData = ((char *)Src + 40); 1940 pData = ((char *)Src + 40);
1985 //v154 = 875; 1941 //v154 = 875;
1986 goto LABEL_140; 1942 goto LABEL_140;
1987 } 1943 }
1988 *(int *)pDest = 0; 1944 *(int *)pDest = 0;
2373 } 2329 }
2374 2330
2375 v4 = v43[0]; 2331 v4 = v43[0];
2376 if ( v55 == 1 ) 2332 if ( v55 == 1 )
2377 return this->pFaces[v4].uSectorID; 2333 return this->pFaces[v4].uSectorID;
2378 v37 = 0;
2379 if ( !v55 ) 2334 if ( !v55 )
2380 return 0; 2335 return 0;
2381 pSectorID = 0; 2336 pSectorID = 0;
2382 v53 = 0xFFFFFFu; 2337 v53 = 0xFFFFFFu;
2383 if ( v55 > 0 ) 2338 if ( v55 > 0 )
2384 { 2339 {
2385 v39 = sY; 2340 v39 = sY;
2386 while ( 1 ) 2341 for ( v37 = 0; v37 < v55; ++v37 )
2387 { 2342 {
2388 pFace = &this->pFaces[v43[v37]]; 2343 if ( this->pFaces[v43[v37]].uPolygonType == POLYGON_Floor )
2389 //pPolygonType = pFace->uPolygonType; 2344 v39 = sZ - this->pVertices[*this->pFaces[v43[v37]].pVertexIDs].z;
2390 if ( pFace->uPolygonType == POLYGON_Floor ) 2345 if ( this->pFaces[v43[v37]].uPolygonType == POLYGON_InBetweenFloorAndWall )
2391 { 2346 {
2392 v42 = this->pVertices[*pFace->pVertexIDs].z; 2347 v39 = sZ - ((fixpoint_mul(this->pFaces[v43[v37]].zCalc1, (sX << 16))
2393 v39 = sZ - v42; 2348 + fixpoint_mul(this->pFaces[v43[v37]].zCalc2, (sY << 16))
2394 //goto LABEL_47; 2349 + this->pFaces[v43[v37]].zCalc3
2395 } 2350 + 0x8000) >> 16);
2396 if ( pFace->uPolygonType == POLYGON_InBetweenFloorAndWall ) 2351 }
2397 {
2398 //v51 = pFace->zCalc1;
2399 v57 = fixpoint_mul(pFace->zCalc1, (sX << 16));
2400 //v56 = sY << 16;
2401 //v51 = pFace->zCalc2;
2402 v56 = fixpoint_mul(pFace->zCalc2, (sY << 16));
2403 v42 = (v56 + pFace->zCalc3 + v57 + 32768) >> 16;
2404 v39 = sZ - v42;
2405 }
2406 //LABEL_47:
2407 if ( v39 >= 0 ) 2352 if ( v39 >= 0 )
2408 { 2353 {
2409 if ( v39 < v53 ) 2354 if ( v39 < v53 )
2410 { 2355 {
2411 pSectorID = pFace->uSectorID; 2356 pSectorID = this->pFaces[v43[v37]].uSectorID;
2412 v53 = v39; 2357 v53 = v39;
2413 } 2358 }
2414 } 2359 }
2415 ++v37;
2416 if ( v37 >= v55 )
2417 return pSectorID;
2418 } 2360 }
2419 } 2361 }
2420 return pSectorID; 2362 return pSectorID;
2421 } 2363 }
2422 // 49AC17: using guessed type int var_108[50]; 2364 // 49AC17: using guessed type int var_108[50];
2496 return; 2438 return;
2497 } 2439 }
2498 2440
2499 //----- (0044C23B) -------------------------------------------------------- 2441 //----- (0044C23B) --------------------------------------------------------
2500 bool BLVFaceExtra::HasEventint() 2442 bool BLVFaceExtra::HasEventint()
2501 { 2443 {
2502 signed int event_index; // eax@1 2444 signed int event_index; // eax@1
2503 _evt_raw* start_evt; 2445 _evt_raw* start_evt;
2504 _evt_raw* end_evt; 2446 _evt_raw* end_evt;
2505 2447
2506 event_index = 0; 2448 event_index = 0;
2546 Vec3_short_ *v43; // edi@36 2488 Vec3_short_ *v43; // edi@36
2547 unsigned int v49; // ecx@46 2489 unsigned int v49; // ecx@46
2548 unsigned __int16 v50; // ax@48 2490 unsigned __int16 v50; // ax@48
2549 unsigned int v51; // eax@51 2491 unsigned int v51; // eax@51
2550 unsigned __int16 v52; // ax@54 2492 unsigned __int16 v52; // ax@54
2551 int v53; // ecx@57
2552 unsigned __int64 v55; // qax@57
2553 int v56; // ecx@58 2493 int v56; // ecx@58
2554 int v57; // eax@58 2494 int v57; // eax@58
2555 Vec3_int_ v67; 2495 Vec3_int_ v67;
2556 Vec3_int_ v70; 2496 Vec3_int_ v70;
2557 int v73; // [sp+20h] [bp-44h]@24 2497 int v73; // [sp+20h] [bp-44h]@24
2648 v85 = (unsigned __int64)(door->vDirection.x * (signed __int64)v67.x) >> 16; 2588 v85 = (unsigned __int64)(door->vDirection.x * (signed __int64)v67.x) >> 16;
2649 v83 = (unsigned __int64)(door->vDirection.y * (signed __int64)v67.y) >> 16; 2589 v83 = (unsigned __int64)(door->vDirection.y * (signed __int64)v67.y) >> 16;
2650 v84 = (unsigned __int64)(door->vDirection.z * (signed __int64)v67.z) >> 16; 2590 v84 = (unsigned __int64)(door->vDirection.z * (signed __int64)v67.z) >> 16;
2651 v31 = (v85 + v83 + v84) * (signed __int64)v29; 2591 v31 = (v85 + v83 + v84) * (signed __int64)v29;
2652 v32 = v31 >> 16; 2592 v32 = v31 >> 16;
2653 goto LABEL_58; 2593 v57 = -v32;
2594 v28->sTextureDeltaV = v57;
2595 v28->sTextureDeltaU += door->pDeltaUs[v88];
2596 v28->sTextureDeltaV = v57 + door->pDeltaVs[v88];
2597 continue;
2654 }*/ 2598 }*/
2655 v28->sTextureDeltaU = 0; 2599 v28->sTextureDeltaU = 0;
2656 v28->sTextureDeltaV = 0; 2600 v28->sTextureDeltaV = 0;
2657 v34 = &pIndoor->pVertices[face->pVertexIDs[0]]; 2601 v34 = &pIndoor->pVertices[face->pVertexIDs[0]];
2658 v35 = v34->z; 2602 v35 = v34->z;
2694 } 2638 }
2695 if ( face->uAttributes & 8 ) 2639 if ( face->uAttributes & 8 )
2696 v28->sTextureDeltaV -= v40; 2640 v28->sTextureDeltaV -= v40;
2697 else 2641 else
2698 { 2642 {
2699 if ( face->uAttributes & 0x20000 ) 2643 if ( face->uAttributes & FACE_UNKNOW7 )
2700 { 2644 {
2701 if ( face->uBitmapID != -1 ) 2645 if ( face->uBitmapID != -1 )
2702 v28->sTextureDeltaV -= v82 + pBitmaps_LOD->GetTexture(face->uBitmapID)->uTextureHeight; 2646 v28->sTextureDeltaV -= v82 + pBitmaps_LOD->GetTexture(face->uBitmapID)->uTextureHeight;
2703 } 2647 }
2704 } 2648 }
2706 { 2650 {
2707 v84 = fixpoint_mul(door->vDirection.x, v70.x); 2651 v84 = fixpoint_mul(door->vDirection.x, v70.x);
2708 v82 = fixpoint_mul(door->vDirection.y, v70.y); 2652 v82 = fixpoint_mul(door->vDirection.y, v70.y);
2709 v83 = fixpoint_mul(door->vDirection.z, v70.z); 2653 v83 = fixpoint_mul(door->vDirection.z, v70.z);
2710 v75 = v84 + v82 + v83; 2654 v75 = v84 + v82 + v83;
2711 v53 = v89;
2712 v82 = fixpoint_mul(v75, v89); 2655 v82 = fixpoint_mul(v75, v89);
2713 v28->sTextureDeltaU = -v82; 2656 v28->sTextureDeltaU = -v82;
2714 v84 = fixpoint_mul(door->vDirection.x, v67.x); 2657 v84 = fixpoint_mul(door->vDirection.x, v67.x);
2715 v82 = fixpoint_mul(door->vDirection.y, v67.y); 2658 v82 = fixpoint_mul(door->vDirection.y, v67.y);
2716 v83 = fixpoint_mul(door->vDirection.z, v67.z); 2659 v83 = fixpoint_mul(door->vDirection.z, v67.z);
2717 v75 = v84 + v82 + v83; 2660 v75 = v84 + v82 + v83;
2718 v55 = v75 * (signed __int64)v53; 2661 v32 = fixpoint_mul(v75, v89);
2719 v32 = v55 >> 16;
2720 LABEL_58:
2721 v57 = -v32; 2662 v57 = -v32;
2722 v28->sTextureDeltaV = v57; 2663 v28->sTextureDeltaV = v57;
2723 v28->sTextureDeltaU += door->pDeltaUs[v88]; 2664 v28->sTextureDeltaU += door->pDeltaUs[v88];
2724 v28->sTextureDeltaV = v57 + door->pDeltaVs[v88]; 2665 v28->sTextureDeltaV = v57 + door->pDeltaVs[v88];
2725 } 2666 }