Mercurial > mm7
comparison Engine/Graphics/Render.cpp @ 2541:a902abdfc7f2
1. Renamed class Game to class Engine.
2. Separated game logic as state of FSM from game logic as engine.
3. Found out that many UI screen initializers were optimized away, intially
they all returned newly created window as separate object like it is done
in CharacterUI_Initialize.
author | a.parshin |
---|---|
date | Sun, 10 May 2015 01:29:11 +0200 |
parents | 407263babde8 |
children | b6140dfeac27 |
comparison
equal
deleted
inserted
replaced
2540:abc6a9d079b9 | 2541:a902abdfc7f2 |
---|---|
2 #include <stdlib.h> | 2 #include <stdlib.h> |
3 #include <crtdbg.h> | 3 #include <crtdbg.h> |
4 | 4 |
5 #define _CRT_SECURE_NO_WARNINGS | 5 #define _CRT_SECURE_NO_WARNINGS |
6 | 6 |
7 #include "../ZlibWrapper.h" | 7 #include "Engine/Engine.h" |
8 #include "../ErrorHandling.h" | 8 |
9 | 9 #include "Engine/ZlibWrapper.h" |
10 #include "Render.h" | 10 #include "Render.h" |
11 #include "Media/MediaPlayer.h" | 11 #include "Media/MediaPlayer.h" |
12 #include "Sprites.h" | 12 #include "Sprites.h" |
13 #include "IO/Mouse.h" | 13 #include "IO/Mouse.h" |
14 #include "GammaControl.h" | 14 #include "GammaControl.h" |
15 #include "stru6.h" | 15 #include "stru6.h" |
16 #include "GUI/GUIWindow.h" | 16 #include "GUI/GUIWindow.h" |
17 #include "DecalBuilder.h" | 17 #include "DecalBuilder.h" |
18 #include "ParticleEngine.h" | 18 #include "ParticleEngine.h" |
19 #include "Outdoor.h" | 19 #include "Outdoor.h" |
20 #include "../Party.h" | 20 #include "Engine/Party.h" |
21 #include "../LOD.h" | 21 #include "Engine/LOD.h" |
22 #include "Viewport.h" | 22 #include "Viewport.h" |
23 #include "../OurMath.h" | 23 #include "Engine/OurMath.h" |
24 #include "PaletteManager.h" | 24 #include "PaletteManager.h" |
25 #include "../Timer.h" | 25 #include "Engine/Timer.h" |
26 #include "../Game.h" | |
27 #include "LightmapBuilder.h" | 26 #include "LightmapBuilder.h" |
28 #include "../Objects/ObjectList.h" | 27 #include "Engine/Objects/ObjectList.h" |
29 #include "../Objects/SpriteObject.h" | 28 #include "Engine/Objects/SpriteObject.h" |
30 #include "DecorationList.h" | 29 #include "DecorationList.h" |
31 #include "../Objects/Actor.h" | 30 #include "Engine/Objects/Actor.h" |
32 #include "../Log.h" | |
33 #include "../MM7.h" | |
34 #include "Lights.h" | 31 #include "Lights.h" |
35 #include "Level/Decoration.h" | 32 #include "Level/Decoration.h" |
36 #include "Vis.h" | 33 #include "Vis.h" |
37 #include "../Registry.h" | 34 #include "Engine/Registry.h" |
38 #include "Weather.h" | 35 #include "Weather.h" |
39 #include "../MMT.h" | 36 #include "Engine/MMT.h" |
40 | 37 |
41 | 38 |
42 //#pragma comment(lib, "lib\\legacy_dx\\lib\\ddraw.lib") | 39 //#pragma comment(lib, "lib\\legacy_dx\\lib\\ddraw.lib") |
43 //#pragma comment(lib, "lib\\legacy_dx\\lib\\dxguid.lib") | 40 //#pragma comment(lib, "lib\\legacy_dx\\lib\\dxguid.lib") |
44 | 41 |
260 for (unsigned int x = 0; x < 128; ++x) | 257 for (unsigned int x = 0; x < 128; ++x) |
261 { | 258 { |
262 pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * blockScale; | 259 pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * blockScale; |
263 pTerrainVertices[z * 128 + x].vWorldPosition.y = (64 - (signed)z) * blockScale; | 260 pTerrainVertices[z * 128 + x].vWorldPosition.y = (64 - (signed)z) * blockScale; |
264 pTerrainVertices[z * 128 + x].vWorldPosition.z = heightScale * pOutdoor->pTerrain.pHeightmap[z * 128 + x]; | 261 pTerrainVertices[z * 128 + x].vWorldPosition.z = heightScale * pOutdoor->pTerrain.pHeightmap[z * 128 + x]; |
265 pGame->pIndoorCameraD3D->ViewTransform(&pTerrainVertices[z * 128 + x], 1); | 262 pEngine->pIndoorCameraD3D->ViewTransform(&pTerrainVertices[z * 128 + x], 1); |
266 pGame->pIndoorCameraD3D->Project(&pTerrainVertices[z * 128 + x], 1, 0); | 263 pEngine->pIndoorCameraD3D->Project(&pTerrainVertices[z * 128 + x], 1, 0); |
267 } | 264 } |
268 } | 265 } |
269 //-------(Отсечение невидимой части карты)------------------------------------------------------------------------------------------ | 266 //-------(Отсечение невидимой части карты)------------------------------------------------------------------------------------------ |
270 float direction = (float)(pGame->pIndoorCameraD3D->sRotationY / 256);//direction of the camera(напрвление камеры) | 267 float direction = (float)(pEngine->pIndoorCameraD3D->sRotationY / 256);//direction of the camera(напрвление камеры) |
271 //0-East(B) | 268 //0-East(B) |
272 //1-NorthEast(CB) | 269 //1-NorthEast(CB) |
273 //2-North(C) | 270 //2-North(C) |
274 //3-WestNorth(CЗ) | 271 //3-WestNorth(CЗ) |
275 //4-West(З) | 272 //4-West(З) |
389 if (for_refactoring) | 386 if (for_refactoring) |
390 { | 387 { |
391 //MessageBoxA(nullptr, "Ritor1: function StackLights_TerrainFace needed refactoring and result - slows", "", 0); | 388 //MessageBoxA(nullptr, "Ritor1: function StackLights_TerrainFace needed refactoring and result - slows", "", 0); |
392 //__debugbreak(); | 389 //__debugbreak(); |
393 | 390 |
394 pGame->pLightmapBuilder->StackLights_TerrainFace(norm, &Light_tile_dist, array_50AC10, 4, 1);//Ritor1: slows | 391 pEngine->pLightmapBuilder->StackLights_TerrainFace(norm, &Light_tile_dist, array_50AC10, 4, 1);//Ritor1: slows |
395 //pDecalBuilder->_49BE8A(pTilePolygon, norm, &Light_tile_dist, array_50AC10, 4, 1); | 392 //pDecalBuilder->_49BE8A(pTilePolygon, norm, &Light_tile_dist, array_50AC10, 4, 1); |
396 } | 393 } |
397 unsigned int a5 = 4; | 394 unsigned int a5 = 4; |
398 | 395 |
399 //---------Draw distance(Дальность отрисовки)------------------------------- | 396 //---------Draw distance(Дальность отрисовки)------------------------------- |
409 || (double)pODMRenderParams->shading_dist_mist < array_73D150[2].vWorldViewPosition.x | 406 || (double)pODMRenderParams->shading_dist_mist < array_73D150[2].vWorldViewPosition.x |
410 || (double)pODMRenderParams->shading_dist_mist < array_73D150[3].vWorldViewPosition.x; | 407 || (double)pODMRenderParams->shading_dist_mist < array_73D150[3].vWorldViewPosition.x; |
411 | 408 |
412 int v33 = 0; | 409 int v33 = 0; |
413 static stru154 static_sub_0048034E_stru_154; | 410 static stru154 static_sub_0048034E_stru_154; |
414 pGame->pLightmapBuilder->std__vector_000004_size = 0; | 411 pEngine->pLightmapBuilder->std__vector_000004_size = 0; |
415 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) | 412 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) |
416 { | 413 { |
417 if ( neer_clip ) | 414 if ( neer_clip ) |
418 v33 = 3; | 415 v33 = 3; |
419 else | 416 else |
420 v33 = far_clip != 0 ? 5 : 0; | 417 v33 = far_clip != 0 ? 5 : 0; |
421 static_sub_0048034E_stru_154.ClassifyPolygon(norm, Light_tile_dist); | 418 static_sub_0048034E_stru_154.ClassifyPolygon(norm, Light_tile_dist); |
422 if ( pDecalBuilder->uNumDecals > 0 ) | 419 if ( pDecalBuilder->uNumDecals > 0 ) |
423 pDecalBuilder->ApplyDecals(31 - pTilePolygon->dimming_level, 4, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, *(float *)&v33, -1); | 420 pDecalBuilder->ApplyDecals(31 - pTilePolygon->dimming_level, 4, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, *(float *)&v33, -1); |
424 if ( stru_F8AD28.uNumLightsApplied > 0 ) | 421 if ( stru_F8AD28.uNumLightsApplied > 0 ) |
425 pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, v33); | 422 pEngine->pLightmapBuilder->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, v33); |
426 } | 423 } |
427 | 424 |
428 if ( !byte_4D864C || ~pGame->uFlags & 0x80 ) | 425 if ( !byte_4D864C || ~pEngine->uFlags & 0x80 ) |
429 { | 426 { |
430 //if ( neer_clip ) //Ritor1: Даёт искажения на подъёме, возможно требуется ф-ция Безье | 427 //if ( neer_clip ) //Ritor1: Даёт искажения на подъёме, возможно требуется ф-ция Безье |
431 //{ | 428 //{ |
432 // pTilePolygon->uNumVertices = ODM_NearClip(pTilePolygon->uNumVertices); | 429 // pTilePolygon->uNumVertices = ODM_NearClip(pTilePolygon->uNumVertices); |
433 // ODM_Project(pTilePolygon->uNumVertices); | 430 // ODM_Project(pTilePolygon->uNumVertices); |
605 //if ( !(v1->uFlags & 1) ) | 602 //if ( !(v1->uFlags & 1) ) |
606 //{ | 603 //{ |
607 //v2 = *((short *)v0 - 14) | 604 //v2 = *((short *)v0 - 14) |
608 //v2 = object->uType; | 605 //v2 = object->uType; |
609 if ( (object->uType < 1000 || object->uType >= 10000) && (object->uType < 500 || object->uType >= 600) | 606 if ( (object->uType < 1000 || object->uType >= 10000) && (object->uType < 500 || object->uType >= 600) |
610 || pGame->pStru6Instance->_4A81CA(object) ) | 607 || pEngine->pStru6Instance->_4A81CA(object) ) |
611 { | 608 { |
612 //a5 = *(short *)v0; | 609 //a5 = *(short *)v0; |
613 x = object->vPosition.x; | 610 x = object->vPosition.x; |
614 y = object->vPosition.y; | 611 y = object->vPosition.y; |
615 z = object->vPosition.z; | 612 z = object->vPosition.z; |
616 frame = pSpriteFrameTable->GetFrame(object_desc->uSpriteID, object->uSpriteFrameID); | 613 frame = pSpriteFrameTable->GetFrame(object_desc->uSpriteID, object->uSpriteFrameID); |
617 a6 = frame->uGlowRadius * object->field_22_glow_radius_multiplier; | 614 a6 = frame->uGlowRadius * object->field_22_glow_radius_multiplier; |
618 v6 = stru_5C6E00->Atan2(object->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, object->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); | 615 v6 = stru_5C6E00->Atan2(object->vPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x, object->vPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y); |
619 //LOWORD(v7) = object->uFacing; | 616 //LOWORD(v7) = object->uFacing; |
620 //v8 = v36; | 617 //v8 = v36; |
621 v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + object->uFacing - v6) >> 8) & 7; | 618 v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + object->uFacing - v6) >> 8) & 7; |
622 pBillboardRenderList[::uNumBillboardsToDraw].HwSpriteID = frame->pHwSpriteIDs[v9]; | 619 pBillboardRenderList[::uNumBillboardsToDraw].HwSpriteID = frame->pHwSpriteIDs[v9]; |
623 if ( frame->uFlags & 0x20 ) | 620 if ( frame->uFlags & 0x20 ) |
638 if ( a6 ) | 635 if ( a6 ) |
639 { | 636 { |
640 //LOBYTE(v11) = _4E94D3_light_type; | 637 //LOBYTE(v11) = _4E94D3_light_type; |
641 pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFF, 0xFF, 0xFF, _4E94D3_light_type); | 638 pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFF, 0xFF, 0xFF, _4E94D3_light_type); |
642 } | 639 } |
643 if (pGame->pIndoorCameraD3D->sRotationX) | 640 if (pEngine->pIndoorCameraD3D->sRotationX) |
644 { | 641 { |
645 v30 = fixpoint_mul((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16, pGame->pIndoorCameraD3D->int_cosine_y) | 642 v30 = fixpoint_mul((x - pEngine->pIndoorCameraD3D->vPartyPos.x) << 16, pEngine->pIndoorCameraD3D->int_cosine_y) |
646 + fixpoint_mul((y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16, pGame->pIndoorCameraD3D->int_sine_y); | 643 + fixpoint_mul((y - pEngine->pIndoorCameraD3D->vPartyPos.y) << 16, pEngine->pIndoorCameraD3D->int_sine_y); |
647 v37 = fixpoint_mul((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16, pGame->pIndoorCameraD3D->int_sine_y); | 644 v37 = fixpoint_mul((x - pEngine->pIndoorCameraD3D->vPartyPos.x) << 16, pEngine->pIndoorCameraD3D->int_sine_y); |
648 v42 = fixpoint_mul((z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_sine_x) | 645 v42 = fixpoint_mul((z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16, pEngine->pIndoorCameraD3D->int_sine_x) |
649 + fixpoint_mul(v30, pGame->pIndoorCameraD3D->int_cosine_x); | 646 + fixpoint_mul(v30, pEngine->pIndoorCameraD3D->int_cosine_x); |
650 if ( v42 >= 0x40000 && v42 <= pODMRenderParams->shading_dist_mist << 16 ) | 647 if ( v42 >= 0x40000 && v42 <= pODMRenderParams->shading_dist_mist << 16 ) |
651 { | 648 { |
652 v17 = fixpoint_mul((y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16, pGame->pIndoorCameraD3D->int_cosine_y) - v37; | 649 v17 = fixpoint_mul((y - pEngine->pIndoorCameraD3D->vPartyPos.y) << 16, pEngine->pIndoorCameraD3D->int_cosine_y) - v37; |
653 v18 = fixpoint_mul((z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_cosine_x) | 650 v18 = fixpoint_mul((z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16, pEngine->pIndoorCameraD3D->int_cosine_x) |
654 - fixpoint_mul(v30, pGame->pIndoorCameraD3D->int_sine_x); | 651 - fixpoint_mul(v30, pEngine->pIndoorCameraD3D->int_sine_x); |
655 if ( abs(v42) >= abs(v17) ) | 652 if ( abs(v42) >= abs(v17) ) |
656 { | 653 { |
657 LODWORD(v23) = 0; | 654 LODWORD(v23) = 0; |
658 HIDWORD(v23) = SLOWORD(pODMRenderParams->int_fov_rad); | 655 HIDWORD(v23) = SLOWORD(pODMRenderParams->int_fov_rad); |
659 | 656 |
690 } | 687 } |
691 } | 688 } |
692 } | 689 } |
693 else | 690 else |
694 { | 691 { |
695 v42 = fixpoint_mul((y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16, pGame->pIndoorCameraD3D->int_sine_y) | 692 v42 = fixpoint_mul((y - pEngine->pIndoorCameraD3D->vPartyPos.y) << 16, pEngine->pIndoorCameraD3D->int_sine_y) |
696 + fixpoint_mul((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16, pGame->pIndoorCameraD3D->int_cosine_y); | 693 + fixpoint_mul((x - pEngine->pIndoorCameraD3D->vPartyPos.x) << 16, pEngine->pIndoorCameraD3D->int_cosine_y); |
697 if ( v42 >= 0x40000 && v42 <= pODMRenderParams->shading_dist_mist << 16 ) | 694 if ( v42 >= 0x40000 && v42 <= pODMRenderParams->shading_dist_mist << 16 ) |
698 { | 695 { |
699 v17 = fixpoint_mul((y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16, pGame->pIndoorCameraD3D->int_cosine_y) | 696 v17 = fixpoint_mul((y - pEngine->pIndoorCameraD3D->vPartyPos.y) << 16, pEngine->pIndoorCameraD3D->int_cosine_y) |
700 - fixpoint_mul(((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16), pGame->pIndoorCameraD3D->int_sine_y); | 697 - fixpoint_mul(((x - pEngine->pIndoorCameraD3D->vPartyPos.x) << 16), pEngine->pIndoorCameraD3D->int_sine_y); |
701 v18 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; | 698 v18 = (z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16; |
702 if ( abs(v42) >= abs(v17) ) | 699 if ( abs(v42) >= abs(v17) ) |
703 { | 700 { |
704 LODWORD(v23) = 0; | 701 LODWORD(v23) = 0; |
705 HIDWORD(v23) = SLOWORD(pODMRenderParams->int_fov_rad); | 702 HIDWORD(v23) = SLOWORD(pODMRenderParams->int_fov_rad); |
706 | 703 |
1026 else | 1023 else |
1027 frame = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); | 1024 frame = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); |
1028 #pragma endregion | 1025 #pragma endregion |
1029 //v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); | 1026 //v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); |
1030 | 1027 |
1031 v10 = (unsigned __int16 *)stru_5C6E00->Atan2(pLevelDecorations[i].vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, | 1028 v10 = (unsigned __int16 *)stru_5C6E00->Atan2(pLevelDecorations[i].vPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x, |
1032 pLevelDecorations[i].vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); | 1029 pLevelDecorations[i].vPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y); |
1033 v38 = 0; | 1030 v38 = 0; |
1034 v13 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + pLevelDecorations[i].field_10_y_rot - (signed int)v10) >> 8) & 7; | 1031 v13 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + pLevelDecorations[i].field_10_y_rot - (signed int)v10) >> 8) & 7; |
1035 v37 = (unsigned __int16 *)v13; | 1032 v37 = (unsigned __int16 *)v13; |
1036 if ( frame->uFlags & 2 ) | 1033 if ( frame->uFlags & 2 ) |
1037 v38 = 2; | 1034 v38 = 2; |
1058 pLevelDecorations[i].vPosition.y, | 1055 pLevelDecorations[i].vPosition.y, |
1059 pLevelDecorations[i].vPosition.z + decor_desc->uDecorationHeight / 2, | 1056 pLevelDecorations[i].vPosition.z + decor_desc->uDecorationHeight / 2, |
1060 frame->uGlowRadius, r, g, b_, _4E94D0_light_type); | 1057 frame->uGlowRadius, r, g, b_, _4E94D0_light_type); |
1061 }//for light | 1058 }//for light |
1062 | 1059 |
1063 v17 = (pLevelDecorations[i].vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; | 1060 v17 = (pLevelDecorations[i].vPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x) << 16; |
1064 if (pGame->pIndoorCameraD3D->sRotationX) | 1061 if (pEngine->pIndoorCameraD3D->sRotationX) |
1065 { | 1062 { |
1066 v40 = (pLevelDecorations[i].vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; | 1063 v40 = (pLevelDecorations[i].vPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y) << 16; |
1067 v18 = fixpoint_mul(v17, pGame->pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v40, pGame->pIndoorCameraD3D->int_sine_y); | 1064 v18 = fixpoint_mul(v17, pEngine->pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v40, pEngine->pIndoorCameraD3D->int_sine_y); |
1068 v41 = fixpoint_mul((pLevelDecorations[i].vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_sine_x); | 1065 v41 = fixpoint_mul((pLevelDecorations[i].vPosition.z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16, pEngine->pIndoorCameraD3D->int_sine_x); |
1069 v19 = fixpoint_mul(v18, pGame->pIndoorCameraD3D->int_cosine_x); | 1066 v19 = fixpoint_mul(v18, pEngine->pIndoorCameraD3D->int_cosine_x); |
1070 v20 = v19 + fixpoint_mul((pLevelDecorations[i].vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_sine_x); | 1067 v20 = v19 + fixpoint_mul((pLevelDecorations[i].vPosition.z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16, pEngine->pIndoorCameraD3D->int_sine_x); |
1071 if ( v20 >= 0x40000 && v20 <= pODMRenderParams->shading_dist_mist << 16 ) | 1068 if ( v20 >= 0x40000 && v20 <= pODMRenderParams->shading_dist_mist << 16 ) |
1072 { | 1069 { |
1073 v21 = fixpoint_mul(v40, pGame->pIndoorCameraD3D->int_cosine_y) - fixpoint_mul(v17, pGame->pIndoorCameraD3D->int_sine_y); | 1070 v21 = fixpoint_mul(v40, pEngine->pIndoorCameraD3D->int_cosine_y) - fixpoint_mul(v17, pEngine->pIndoorCameraD3D->int_sine_y); |
1074 v22 = fixpoint_mul((pLevelDecorations[i].vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(v18, pGame->pIndoorCameraD3D->int_sine_x); | 1071 v22 = fixpoint_mul((pLevelDecorations[i].vPosition.z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16, pEngine->pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(v18, pEngine->pIndoorCameraD3D->int_sine_x); |
1075 if ( 2 * abs(v20) >= abs(v21) ) | 1072 if ( 2 * abs(v20) >= abs(v21) ) |
1076 { | 1073 { |
1077 LODWORD(v24) = 0; | 1074 LODWORD(v24) = 0; |
1078 HIDWORD(v24) = SLOWORD(pODMRenderParams->int_fov_rad); | 1075 HIDWORD(v24) = SLOWORD(pODMRenderParams->int_fov_rad); |
1079 v25 = pViewport->uScreenCenterX - ((signed int)(fixpoint_mul(v24 / v20, v21) + 0x8000) >> 16); | 1076 v25 = pViewport->uScreenCenterX - ((signed int)(fixpoint_mul(v24 / v20, v21) + 0x8000) >> 16); |
1117 continue; | 1114 continue; |
1118 } | 1115 } |
1119 } | 1116 } |
1120 else | 1117 else |
1121 { | 1118 { |
1122 v42 = (pLevelDecorations[i].vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; | 1119 v42 = (pLevelDecorations[i].vPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x) << 16; |
1123 v40 = (pLevelDecorations[i].vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; | 1120 v40 = (pLevelDecorations[i].vPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y) << 16; |
1124 v20 = fixpoint_mul(v17, pGame->pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v40, pGame->pIndoorCameraD3D->int_sine_y); | 1121 v20 = fixpoint_mul(v17, pEngine->pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v40, pEngine->pIndoorCameraD3D->int_sine_y); |
1125 if ( v20 >= 0x40000 && v20 <= pODMRenderParams->shading_dist_mist << 16 ) | 1122 if ( v20 >= 0x40000 && v20 <= pODMRenderParams->shading_dist_mist << 16 ) |
1126 { | 1123 { |
1127 v21 = fixpoint_mul(v40, pGame->pIndoorCameraD3D->int_cosine_y) - fixpoint_mul(v42, pGame->pIndoorCameraD3D->int_sine_y); | 1124 v21 = fixpoint_mul(v40, pEngine->pIndoorCameraD3D->int_cosine_y) - fixpoint_mul(v42, pEngine->pIndoorCameraD3D->int_sine_y); |
1128 v22 = (pLevelDecorations[i].vPosition.z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; | 1125 v22 = (pLevelDecorations[i].vPosition.z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16; |
1129 v42 = v22; | 1126 v42 = v22; |
1130 if ( 2 * abs(v20) >= abs(v21) ) | 1127 if ( 2 * abs(v20) >= abs(v21) ) |
1131 { | 1128 { |
1132 LODWORD(v24) = 0; | 1129 LODWORD(v24) = 0; |
1133 HIDWORD(v24) = SLOWORD(pODMRenderParams->int_fov_rad); | 1130 HIDWORD(v24) = SLOWORD(pODMRenderParams->int_fov_rad); |
1186 local_0.g = 0.0; | 1183 local_0.g = 0.0; |
1187 local_0.b = 0.0; | 1184 local_0.b = 0.0; |
1188 local_0.flt_28 = 1.0; | 1185 local_0.flt_28 = 1.0; |
1189 local_0.timeToLive = (rand() & 0x80) + 128; | 1186 local_0.timeToLive = (rand() & 0x80) + 128; |
1190 local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); | 1187 local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); |
1191 pGame->pParticleEngine->AddParticle(&local_0); | 1188 pEngine->pParticleEngine->AddParticle(&local_0); |
1192 } | 1189 } |
1193 } | 1190 } |
1194 } | 1191 } |
1195 } | 1192 } |
1196 | 1193 |
1987 signed int a2; // [sp+64h] [bp-4h]@4 | 1984 signed int a2; // [sp+64h] [bp-4h]@4 |
1988 | 1985 |
1989 v6 = 0; | 1986 v6 = 0; |
1990 if ( this->uNumD3DSceneBegins && (signed int)uNumVertices >= 3 ) | 1987 if ( this->uNumD3DSceneBegins && (signed int)uNumVertices >= 3 ) |
1991 { | 1988 { |
1992 //v54 = pGame->pLightmapBuilder->std__vector_000004_size; | 1989 //v54 = pEngine->pLightmapBuilder->std__vector_000004_size; |
1993 if ( pGame->pLightmapBuilder->std__vector_000004_size) | 1990 if ( pEngine->pLightmapBuilder->std__vector_000004_size) |
1994 a2 = -1; | 1991 a2 = -1; |
1995 pGame->AlterGamma_ODM(a4, &a2); | 1992 pEngine->AlterGamma_ODM(a4, &a2); |
1996 if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01_lightmap_related) | 1993 if ( byte_4D864C && pEngine->uFlags & GAME_FLAGS_1_01_lightmap_related) |
1997 { | 1994 { |
1998 v8 = ::GetActorTintColor(a3->dimming_level, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); | 1995 v8 = ::GetActorTintColor(a3->dimming_level, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); |
1999 pGame->pLightmapBuilder->DrawLightmaps(/*v8, 0*/); | 1996 pEngine->pLightmapBuilder->DrawLightmaps(/*v8, 0*/); |
2000 } | 1997 } |
2001 else | 1998 else |
2002 { | 1999 { |
2003 if ( !pGame->pLightmapBuilder->std__vector_000004_size || byte_4D864C && pGame->uFlags & 2 ) | 2000 if ( !pEngine->pLightmapBuilder->std__vector_000004_size || byte_4D864C && pEngine->uFlags & 2 ) |
2004 { | 2001 { |
2005 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | 2002 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
2006 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); | 2003 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); |
2007 if (bUsingSpecular) | 2004 if (bUsingSpecular) |
2008 { | 2005 { |
2016 d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; | 2013 d3d_vertex_buffer[i].pos.x = array_50AC10[i].vWorldViewProjX; |
2017 d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; | 2014 d3d_vertex_buffer[i].pos.y = array_50AC10[i].vWorldViewProjY; |
2018 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pODMRenderParams->shading_dist_mist); | 2015 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / ((array_50AC10[i].vWorldViewPosition.x * 1000) / (double)pODMRenderParams->shading_dist_mist); |
2019 d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); | 2016 d3d_vertex_buffer[i].rhw = 1.0 / (array_50AC10[i].vWorldViewPosition.x + 0.0000001); |
2020 d3d_vertex_buffer[i].diffuse = ::GetActorTintColor(a3->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); | 2017 d3d_vertex_buffer[i].diffuse = ::GetActorTintColor(a3->dimming_level, 0, array_50AC10[i].vWorldViewPosition.x, 0, 0); |
2021 pGame->AlterGamma_ODM(a4, &d3d_vertex_buffer[i].diffuse); | 2018 pEngine->AlterGamma_ODM(a4, &d3d_vertex_buffer[i].diffuse); |
2022 | 2019 |
2023 if ( this->bUsingSpecular ) | 2020 if ( this->bUsingSpecular ) |
2024 d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_specular(0, 0, array_50AC10[i].vWorldViewPosition.x); | 2021 d3d_vertex_buffer[i].specular = sub_47C3D7_get_fog_specular(0, 0, array_50AC10[i].vWorldViewPosition.x); |
2025 else | 2022 else |
2026 d3d_vertex_buffer[i].specular = 0; | 2023 d3d_vertex_buffer[i].specular = 0; |
2078 uNumVertices, | 2075 uNumVertices, |
2079 D3DDP_DONOTLIGHT)); | 2076 D3DDP_DONOTLIGHT)); |
2080 //v50 = (const char *)v5->pRenderD3D->pDevice; | 2077 //v50 = (const char *)v5->pRenderD3D->pDevice; |
2081 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | 2078 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
2082 //(*(void (**)(void))(*(int *)v50 + 88))(); | 2079 //(*(void (**)(void))(*(int *)v50 + 88))(); |
2083 pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); | 2080 pEngine->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); |
2084 for (uint i = 0; i < uNumVertices; ++i) | 2081 for (uint i = 0; i < uNumVertices; ++i) |
2085 { | 2082 { |
2086 d3d_vertex_buffer[i].diffuse = a2; | 2083 d3d_vertex_buffer[i].diffuse = a2; |
2087 } | 2084 } |
2088 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pTexture)); | 2085 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pTexture)); |
4448 if (uNumD3DSceneBegins) | 4445 if (uNumD3DSceneBegins) |
4449 return; | 4446 return; |
4450 | 4447 |
4451 if (pRenderD3D) | 4448 if (pRenderD3D) |
4452 { | 4449 { |
4453 pGame->draw_debug_outlines(); | 4450 pEngine->draw_debug_outlines(); |
4454 DoRenderBillboards_D3D(); | 4451 DoRenderBillboards_D3D(); |
4455 pGame->pStru6Instance->RenderSpecialEffects(); | 4452 pEngine->pStru6Instance->RenderSpecialEffects(); |
4456 pRenderD3D->pDevice->EndScene(); | 4453 pRenderD3D->pDevice->EndScene(); |
4457 } | 4454 } |
4458 else | 4455 else |
4459 pGame->pStru6Instance->RenderSpecialEffects(); | 4456 pEngine->pStru6Instance->RenderSpecialEffects(); |
4460 } | 4457 } |
4461 | 4458 |
4462 //----- (004A2031) -------------------------------------------------------- | 4459 //----- (004A2031) -------------------------------------------------------- |
4463 unsigned int Render::GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6) | 4460 unsigned int Render::GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6) |
4464 { | 4461 { |
4594 if ( uNumVertices < 3) | 4591 if ( uNumVertices < 3) |
4595 return; | 4592 return; |
4596 | 4593 |
4597 //v61 = pVertices; | 4594 //v61 = pVertices; |
4598 | 4595 |
4599 /* v9 = pGame->pLightmapBuilder; | 4596 /* v9 = pEngine->pLightmapBuilder; |
4600 v65 = v9; | 4597 v65 = v9; |
4601 v10 = v9->std__vector_000004_size;*/ | 4598 v10 = v9->std__vector_000004_size;*/ |
4602 if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01_lightmap_related) | 4599 if ( byte_4D864C && pEngine->uFlags & GAME_FLAGS_1_01_lightmap_related) |
4603 { | 4600 { |
4604 v11 = ::GetActorTintColor(a4->dimming_level, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); | 4601 v11 = ::GetActorTintColor(a4->dimming_level, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); |
4605 pGame->pLightmapBuilder->DrawLightmaps(/*v11, 0*/); | 4602 pEngine->pLightmapBuilder->DrawLightmaps(/*v11, 0*/); |
4606 } | 4603 } |
4607 else | 4604 else |
4608 { | 4605 { |
4609 if (transparent || !pGame->pLightmapBuilder->std__vector_000004_size || | 4606 if (transparent || !pEngine->pLightmapBuilder->std__vector_000004_size || |
4610 byte_4D864C && pGame->uFlags & 2 ) | 4607 byte_4D864C && pEngine->uFlags & 2 ) |
4611 { | 4608 { |
4612 if (clampAtTextureBorders) | 4609 if (clampAtTextureBorders) |
4613 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP); | 4610 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP); |
4614 else | 4611 else |
4615 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); | 4612 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); |
4695 uNumVertices, | 4692 uNumVertices, |
4696 16)); | 4693 16)); |
4697 //v63 = (const char *)v7->pRenderD3D->pDevice; | 4694 //v63 = (const char *)v7->pRenderD3D->pDevice; |
4698 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | 4695 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
4699 //(*(void (**)(void))(*(int *)v63 + 88))(); | 4696 //(*(void (**)(void))(*(int *)v63 + 88))(); |
4700 pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); | 4697 pEngine->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); |
4701 for (uint i = 0; i < uNumVertices; ++i) | 4698 for (uint i = 0; i < uNumVertices; ++i) |
4702 { | 4699 { |
4703 d3d_vertex_buffer[i].diffuse = -1; | 4700 d3d_vertex_buffer[i].diffuse = -1; |
4704 } | 4701 } |
4705 ErrD3D(pRenderD3D->pDevice->SetTexture(0, a5)); | 4702 ErrD3D(pRenderD3D->pDevice->SetTexture(0, a5)); |
4746 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, v8)); | 4743 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, v8)); |
4747 } | 4744 } |
4748 } | 4745 } |
4749 | 4746 |
4750 //if (pIndoorCamera->flags & INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES || pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES) | 4747 //if (pIndoorCamera->flags & INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES || pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES) |
4751 if (pGame->pIndoorCameraD3D->debug_flags & ODM_RENDER_DRAW_TERRAIN_OUTLINES) | 4748 if (pEngine->pIndoorCameraD3D->debug_flags & ODM_RENDER_DRAW_TERRAIN_OUTLINES) |
4752 pGame->pIndoorCameraD3D->debug_outline_d3d(d3d_vertex_buffer, uNumVertices, 0x00FFFFFF, 0.0); | 4749 pEngine->pIndoorCameraD3D->debug_outline_d3d(d3d_vertex_buffer, uNumVertices, 0x00FFFFFF, 0.0); |
4753 } | 4750 } |
4754 // 4A26BC: could not find valid save-restore pair for esi | 4751 // 4A26BC: could not find valid save-restore pair for esi |
4755 // 4D864C: using guessed type char byte_4D864C; | 4752 // 4D864C: using guessed type char byte_4D864C; |
4756 | 4753 |
4757 //----- (004A2DA3) -------------------------------------------------------- | 4754 //----- (004A2DA3) -------------------------------------------------------- |
4871 | 4868 |
4872 pFace = &pIndoor->pFaces[uFaceID]; | 4869 pFace = &pIndoor->pFaces[uFaceID]; |
4873 //for floor and wall(for example Selesta)------------------- | 4870 //for floor and wall(for example Selesta)------------------- |
4874 if (pFace->uPolygonType == POLYGON_InBetweenFloorAndWall || pFace->uPolygonType == POLYGON_Floor) | 4871 if (pFace->uPolygonType == POLYGON_InBetweenFloorAndWall || pFace->uPolygonType == POLYGON_Floor) |
4875 { | 4872 { |
4876 int v69 = (GetTickCount() / 32) - pGame->pIndoorCameraD3D->vPartyPos.x; | 4873 int v69 = (GetTickCount() / 32) - pEngine->pIndoorCameraD3D->vPartyPos.x; |
4877 int v55 = (GetTickCount() / 32) + pGame->pIndoorCameraD3D->vPartyPos.y; | 4874 int v55 = (GetTickCount() / 32) + pEngine->pIndoorCameraD3D->vPartyPos.y; |
4878 for (uint i = 0; i < uNumVertices; ++i) | 4875 for (uint i = 0; i < uNumVertices; ++i) |
4879 { | 4876 { |
4880 array_507D30[i].u = (v69 + array_507D30[i].u) * 0.25f; | 4877 array_507D30[i].u = (v69 + array_507D30[i].u) * 0.25f; |
4881 array_507D30[i].v = (v55 + array_507D30[i].v) * 0.25f; | 4878 array_507D30[i].v = (v55 + array_507D30[i].v) * 0.25f; |
4882 } | 4879 } |
4883 pRenderer->DrawIndoorPolygon(uNumVertices, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], pFace->GetTexture(), PID(OBJECT_BModel, uFaceID), -1, 0); | 4880 pRenderer->DrawIndoorPolygon(uNumVertices, pFace, pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID], pFace->GetTexture(), PID(OBJECT_BModel, uFaceID), -1, 0); |
4884 return; | 4881 return; |
4885 } | 4882 } |
4886 //--------------------------------------- | 4883 //--------------------------------------- |
4887 v70 = (signed __int64)((double)(pBLVRenderParams->fov_rad_fixpoint * pGame->pIndoorCameraD3D->vPartyPos.z)//179 | 4884 v70 = (signed __int64)((double)(pBLVRenderParams->fov_rad_fixpoint * pEngine->pIndoorCameraD3D->vPartyPos.z)//179 |
4888 / (((double)pBLVRenderParams->fov_rad_fixpoint + 16192.0) | 4885 / (((double)pBLVRenderParams->fov_rad_fixpoint + 16192.0) |
4889 * 65536.0) | 4886 * 65536.0) |
4890 + (double)pBLVRenderParams->uViewportCenterY); | 4887 + (double)pBLVRenderParams->uViewportCenterY); |
4891 v5 = (double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064;//0 | 4888 v5 = (double)pEngine->pIndoorCameraD3D->sRotationX * 0.0030664064;//0 |
4892 v6 = (signed __int64)((double)pBLVRenderParams->uViewportCenterY//183 | 4889 v6 = (signed __int64)((double)pBLVRenderParams->uViewportCenterY//183 |
4893 - (double)pBLVRenderParams->fov_rad_fixpoint | 4890 - (double)pBLVRenderParams->fov_rad_fixpoint |
4894 / ((cos(v5) * 16192.0 + 0.0000001) | 4891 / ((cos(v5) * 16192.0 + 0.0000001) |
4895 * 65535.0) | 4892 * 65535.0) |
4896 * (sin(v5) * -16192.0 - (double)pGame->pIndoorCameraD3D->vPartyPos.z)); | 4893 * (sin(v5) * -16192.0 - (double)pEngine->pIndoorCameraD3D->vPartyPos.z)); |
4897 | 4894 |
4898 stru_8019C8._48653D_frustum_blv(65536, 0, 0, 0, 65536, 0); | 4895 stru_8019C8._48653D_frustum_blv(65536, 0, 0, 0, 65536, 0); |
4899 pSkyPolygon.Create_48607B(&stru_8019C8); | 4896 pSkyPolygon.Create_48607B(&stru_8019C8); |
4900 pSkyPolygon.uTileBitmapID = pFace->uBitmapID; | 4897 pSkyPolygon.uTileBitmapID = pFace->uBitmapID; |
4901 | 4898 |
4904 return; | 4901 return; |
4905 | 4902 |
4906 pSkyPolygon.dimming_level = 0; | 4903 pSkyPolygon.dimming_level = 0; |
4907 pSkyPolygon.uNumVertices = uNumVertices; | 4904 pSkyPolygon.uNumVertices = uNumVertices; |
4908 | 4905 |
4909 pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16); | 4906 pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationX + 16); |
4910 pSkyPolygon.v_18.y = 0; | 4907 pSkyPolygon.v_18.y = 0; |
4911 pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16); | 4908 pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationX + 16); |
4912 | 4909 |
4913 memcpy(&array_507D30[uNumVertices], array_507D30, sizeof(array_507D30[uNumVertices])); | 4910 memcpy(&array_507D30[uNumVertices], array_507D30, sizeof(array_507D30[uNumVertices])); |
4914 pSkyPolygon.field_24 = 0x2000000; | 4911 pSkyPolygon.field_24 = 0x2000000; |
4915 | 4912 |
4916 extern float _calc_fov(int viewport_width, int angle_degree); | 4913 extern float _calc_fov(int viewport_width, int angle_degree); |
5156 if (!uNumD3DSceneBegins || uNumVertices < 3) | 5153 if (!uNumD3DSceneBegins || uNumVertices < 3) |
5157 return; | 5154 return; |
5158 | 5155 |
5159 int sCorrectedColor = uColor; | 5156 int sCorrectedColor = uColor; |
5160 | 5157 |
5161 if (pGame->pLightmapBuilder->std__vector_000004_size) | 5158 if (pEngine->pLightmapBuilder->std__vector_000004_size) |
5162 sCorrectedColor = -1; | 5159 sCorrectedColor = -1; |
5163 pGame->AlterGamma_BLV(pFace, &sCorrectedColor); | 5160 pEngine->AlterGamma_BLV(pFace, &sCorrectedColor); |
5164 | 5161 |
5165 if (pFace->uAttributes & FACE_OUTLINED) | 5162 if (pFace->uAttributes & FACE_OUTLINED) |
5166 { | 5163 { |
5167 if (GetTickCount() % 300 >= 150) | 5164 if (GetTickCount() % 300 >= 150) |
5168 uColor = sCorrectedColor = 0xFF20FF20; | 5165 uColor = sCorrectedColor = 0xFF20FF20; |
5169 else | 5166 else |
5170 uColor = sCorrectedColor = 0xFF109010; | 5167 uColor = sCorrectedColor = 0xFF109010; |
5171 } | 5168 } |
5172 | 5169 |
5173 if (byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01_lightmap_related) | 5170 if (byte_4D864C && pEngine->uFlags & GAME_FLAGS_1_01_lightmap_related) |
5174 { | 5171 { |
5175 __debugbreak(); | 5172 __debugbreak(); |
5176 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); | 5173 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); |
5177 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | 5174 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
5178 for (uint i = 0; i < uNumVertices; ++i) | 5175 for (uint i = 0; i < uNumVertices; ++i) |
5190 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | 5187 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
5191 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); | 5188 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
5192 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | 5189 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
5193 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 5190 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
5194 d3d_vertex_buffer, uNumVertices, 28)); | 5191 d3d_vertex_buffer, uNumVertices, 28)); |
5195 pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); | 5192 pEngine->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); |
5196 } | 5193 } |
5197 else | 5194 else |
5198 { | 5195 { |
5199 if (!pGame->pLightmapBuilder->std__vector_000004_size || byte_4D864C && pGame->uFlags & 2) | 5196 if (!pEngine->pLightmapBuilder->std__vector_000004_size || byte_4D864C && pEngine->uFlags & 2) |
5200 { | 5197 { |
5201 for (uint i = 0; i < uNumVertices; ++i) | 5198 for (uint i = 0; i < uNumVertices; ++i) |
5202 { | 5199 { |
5203 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; | 5200 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; |
5204 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; | 5201 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; |
5235 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | 5232 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
5236 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 5233 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
5237 d3d_vertex_buffer, uNumVertices, 28)); | 5234 d3d_vertex_buffer, uNumVertices, 28)); |
5238 | 5235 |
5239 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | 5236 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
5240 pGame->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); | 5237 pEngine->pLightmapBuilder->DrawLightmaps(/*-1, 0*/); |
5241 | 5238 |
5242 for (uint i = 0; i < uNumVertices; ++i) | 5239 for (uint i = 0; i < uNumVertices; ++i) |
5243 d3d_vertex_buffer[i].diffuse = sCorrectedColor; | 5240 d3d_vertex_buffer[i].diffuse = sCorrectedColor; |
5244 | 5241 |
5245 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); | 5242 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); |
8500 } | 8497 } |
8501 for ( uint i = 1; i <= pOutdoor->pBModels[model_id].pFaces[face_id].uNumVertices; i++ ) | 8498 for ( uint i = 1; i <= pOutdoor->pBModels[model_id].pFaces[face_id].uNumVertices; i++ ) |
8502 { | 8499 { |
8503 if ( pOutdoor->pBModels[model_id].pVertices.pVertices[pOutdoor->pBModels[model_id].pFaces[face_id].pVertexIDs[0]].z == array_73D150[i - 1].vWorldPosition.z ) | 8500 if ( pOutdoor->pBModels[model_id].pVertices.pVertices[pOutdoor->pBModels[model_id].pFaces[face_id].pVertexIDs[0]].z == array_73D150[i - 1].vWorldPosition.z ) |
8504 ++v53; | 8501 ++v53; |
8505 pGame->pIndoorCameraD3D->ViewTransform(&array_73D150[i - 1], 1); | 8502 pEngine->pIndoorCameraD3D->ViewTransform(&array_73D150[i - 1], 1); |
8506 if ( array_73D150[i - 1].vWorldViewPosition.x < 8.0 || array_73D150[i - 1].vWorldViewPosition.x > pODMRenderParams->shading_dist_mist ) | 8503 if ( array_73D150[i - 1].vWorldViewPosition.x < 8.0 || array_73D150[i - 1].vWorldViewPosition.x > pODMRenderParams->shading_dist_mist ) |
8507 { | 8504 { |
8508 if ( array_73D150[i - 1].vWorldViewPosition.x >= 8.0 ) | 8505 if ( array_73D150[i - 1].vWorldViewPosition.x >= 8.0 ) |
8509 v49 = 1; | 8506 v49 = 1; |
8510 else | 8507 else |
8511 v50 = 1; | 8508 v50 = 1; |
8512 } | 8509 } |
8513 else | 8510 else |
8514 pGame->pIndoorCameraD3D->Project(&array_73D150[i - 1], 1, 0); | 8511 pEngine->pIndoorCameraD3D->Project(&array_73D150[i - 1], 1, 0); |
8515 } | 8512 } |
8516 } | 8513 } |
8517 if ( v53 == pOutdoor->pBModels[model_id].pFaces[face_id].uNumVertices ) | 8514 if ( v53 == pOutdoor->pBModels[model_id].pFaces[face_id].uNumVertices ) |
8518 LOBYTE(array_77EC08[pODMRenderParams->uNumPolygons].field_32) |= 1; | 8515 LOBYTE(array_77EC08[pODMRenderParams->uNumPolygons].field_32) |= 1; |
8519 array_77EC08[pODMRenderParams->uNumPolygons].pODMFace = &pOutdoor->pBModels[model_id].pFaces[face_id]; | 8516 array_77EC08[pODMRenderParams->uNumPolygons].pODMFace = &pOutdoor->pBModels[model_id].pFaces[face_id]; |
8551 stru154::stru154(&static_RenderBuildingsD3D_stru_73C834); | 8548 stru154::stru154(&static_RenderBuildingsD3D_stru_73C834); |
8552 atexit(loc_4789D4); | 8549 atexit(loc_4789D4); |
8553 }*/ | 8550 }*/ |
8554 | 8551 |
8555 v40 = (int)&pOutdoor->pBModels[model_id].pFaces[face_id]; | 8552 v40 = (int)&pOutdoor->pBModels[model_id].pFaces[face_id]; |
8556 pGame->pLightmapBuilder->ApplyLights_OutdoorFace(&pOutdoor->pBModels[model_id].pFaces[face_id]); | 8553 pEngine->pLightmapBuilder->ApplyLights_OutdoorFace(&pOutdoor->pBModels[model_id].pFaces[face_id]); |
8557 pDecalBuilder->ApplyDecals_OutdoorFace(&pOutdoor->pBModels[model_id].pFaces[face_id]); | 8554 pDecalBuilder->ApplyDecals_OutdoorFace(&pOutdoor->pBModels[model_id].pFaces[face_id]); |
8558 pGame->pLightmapBuilder->std__vector_000004_size = 0; | 8555 pEngine->pLightmapBuilder->std__vector_000004_size = 0; |
8559 int v31 = 0; | 8556 int v31 = 0; |
8560 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) | 8557 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) |
8561 { | 8558 { |
8562 v31 = v50 ? 3 : v49 != 0 ? 5 : 0; | 8559 v31 = v50 ? 3 : v49 != 0 ? 5 : 0; |
8563 static_RenderBuildingsD3D_stru_73C834.GetFacePlaneAndClassify(&pOutdoor->pBModels[model_id].pFaces[face_id], &pOutdoor->pBModels[model_id].pVertices); | 8560 static_RenderBuildingsD3D_stru_73C834.GetFacePlaneAndClassify(&pOutdoor->pBModels[model_id].pFaces[face_id], &pOutdoor->pBModels[model_id].pVertices); |
8567 pDecalBuilder->ApplyDecals(31 - array_77EC08[pODMRenderParams->uNumPolygons].dimming_level, 2, &static_RenderBuildingsD3D_stru_73C834, | 8564 pDecalBuilder->ApplyDecals(31 - array_77EC08[pODMRenderParams->uNumPolygons].dimming_level, 2, &static_RenderBuildingsD3D_stru_73C834, |
8568 pOutdoor->pBModels[model_id].pFaces[face_id].uNumVertices, array_50AC10, 0, (char)v31, -1); | 8565 pOutdoor->pBModels[model_id].pFaces[face_id].uNumVertices, array_50AC10, 0, (char)v31, -1); |
8569 } | 8566 } |
8570 } | 8567 } |
8571 if ( stru_F8AD28.uNumLightsApplied > 0 ) | 8568 if ( stru_F8AD28.uNumLightsApplied > 0 ) |
8572 pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &static_RenderBuildingsD3D_stru_73C834, uNumVertices, array_50AC10, 0, (char)v31); | 8569 pEngine->pLightmapBuilder->ApplyLights(&stru_F8AD28, &static_RenderBuildingsD3D_stru_73C834, uNumVertices, array_50AC10, 0, (char)v31); |
8573 if ( v50 ) | 8570 if ( v50 ) |
8574 { | 8571 { |
8575 array_77EC08[pODMRenderParams->uNumPolygons].uNumVertices = ODM_NearClip(pOutdoor->pBModels[model_id].pFaces[face_id].uNumVertices); | 8572 array_77EC08[pODMRenderParams->uNumPolygons].uNumVertices = ODM_NearClip(pOutdoor->pBModels[model_id].pFaces[face_id].uNumVertices); |
8576 uNumVertices = array_77EC08[pODMRenderParams->uNumPolygons].uNumVertices; | 8573 uNumVertices = array_77EC08[pODMRenderParams->uNumPolygons].uNumVertices; |
8577 ODM_Project(array_77EC08[pODMRenderParams->uNumPolygons].uNumVertices); | 8574 ODM_Project(array_77EC08[pODMRenderParams->uNumPolygons].uNumVertices); |
8625 int v36; // [sp+14Ch] [bp-18h]@2 | 8622 int v36; // [sp+14Ch] [bp-18h]@2 |
8626 int v37; // [sp+154h] [bp-10h]@8 | 8623 int v37; // [sp+154h] [bp-10h]@8 |
8627 int v38; // [sp+158h] [bp-Ch]@1 | 8624 int v38; // [sp+158h] [bp-Ch]@1 |
8628 int v39; // [sp+15Ch] [bp-8h]@4 | 8625 int v39; // [sp+15Ch] [bp-8h]@4 |
8629 | 8626 |
8630 v30 = (signed __int64)((double)(pODMRenderParams->int_fov_rad * pGame->pIndoorCameraD3D->vPartyPos.z) | 8627 v30 = (signed __int64)((double)(pODMRenderParams->int_fov_rad * pEngine->pIndoorCameraD3D->vPartyPos.z) |
8631 / ((double)pODMRenderParams->int_fov_rad + 8192.0) | 8628 / ((double)pODMRenderParams->int_fov_rad + 8192.0) |
8632 + (double)(pViewport->uScreenCenterY)); | 8629 + (double)(pViewport->uScreenCenterY)); |
8633 v34 = cos((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064) * 0x2000;//(double)pODMRenderParams->shading_dist_mist, 8192 | 8630 v34 = cos((double)pEngine->pIndoorCameraD3D->sRotationX * 0.0030664064) * 0x2000;//(double)pODMRenderParams->shading_dist_mist, 8192 |
8634 v38 = (signed __int64)((double)(pViewport->uScreenCenterY) | 8631 v38 = (signed __int64)((double)(pViewport->uScreenCenterY) |
8635 - (double)pODMRenderParams->int_fov_rad | 8632 - (double)pODMRenderParams->int_fov_rad |
8636 / (v34 + 0.0000001) | 8633 / (v34 + 0.0000001) |
8637 * (sin((double)pGame->pIndoorCameraD3D->sRotationX * 0.0030664064) | 8634 * (sin((double)pEngine->pIndoorCameraD3D->sRotationX * 0.0030664064) |
8638 * (double)-0x2000//(double)pODMRenderParams->shading_dist_mist | 8635 * (double)-0x2000//(double)pODMRenderParams->shading_dist_mist |
8639 - (double)pGame->pIndoorCameraD3D->vPartyPos.z)); | 8636 - (double)pEngine->pIndoorCameraD3D->vPartyPos.z)); |
8640 pSkyPolygon.Create_48607B(&stru_8019C8);//заполняется ptr_38 | 8637 pSkyPolygon.Create_48607B(&stru_8019C8);//заполняется ptr_38 |
8641 pSkyPolygon.ptr_38->_48694B_frustum_sky(); | 8638 pSkyPolygon.ptr_38->_48694B_frustum_sky(); |
8642 | 8639 |
8643 //if ( pParty->uCurrentHour > 20 || pParty->uCurrentHour < 5 ) | 8640 //if ( pParty->uCurrentHour > 20 || pParty->uCurrentHour < 5 ) |
8644 //pSkyPolygon.uTileBitmapID = pOutdoor->New_SKY_NIGHT_ID; | 8641 //pSkyPolygon.uTileBitmapID = pOutdoor->New_SKY_NIGHT_ID; |
8648 if ( pSkyPolygon.pTexture ) | 8645 if ( pSkyPolygon.pTexture ) |
8649 { | 8646 { |
8650 pSkyPolygon.dimming_level = 0; | 8647 pSkyPolygon.dimming_level = 0; |
8651 pSkyPolygon.uNumVertices = 4; | 8648 pSkyPolygon.uNumVertices = 4; |
8652 //centering(центруем)----------------------------------------------------------------- | 8649 //centering(центруем)----------------------------------------------------------------- |
8653 pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX + 16); | 8650 pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationX + 16); |
8654 pSkyPolygon.v_18.y = 0; | 8651 pSkyPolygon.v_18.y = 0; |
8655 pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX + 16); | 8652 pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationX + 16); |
8656 | 8653 |
8657 //sky wiew position(положение неба на экране)------------------------------------------ | 8654 //sky wiew position(положение неба на экране)------------------------------------------ |
8658 // X | 8655 // X |
8659 // 0._____________________________.3 | 8656 // 0._____________________________.3 |
8660 // |8,8 468,8 | | 8657 // |8,8 468,8 | |
8746 } | 8743 } |
8747 } | 8744 } |
8748 //----- (004226C2) -------------------------------------------------------- | 8745 //----- (004226C2) -------------------------------------------------------- |
8749 bool PauseGameDrawing() | 8746 bool PauseGameDrawing() |
8750 { | 8747 { |
8751 if ( pCurrentScreen != SCREEN_GAME | 8748 if ( current_screen_type != SCREEN_GAME |
8752 && pCurrentScreen != SCREEN_NPC_DIALOGUE | 8749 && current_screen_type != SCREEN_NPC_DIALOGUE |
8753 && pCurrentScreen != SCREEN_CHANGE_LOCATION ) | 8750 && current_screen_type != SCREEN_CHANGE_LOCATION ) |
8754 { | 8751 { |
8755 if (pCurrentScreen == SCREEN_INPUT_BLV) | 8752 if (current_screen_type == SCREEN_INPUT_BLV) |
8756 return pMovie_Track;//pSmackerMovie != 0; | 8753 return pMovie_Track;//pSmackerMovie != 0; |
8757 if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG ) | 8754 if ( current_screen_type != SCREEN_BRANCHLESS_NPC_DIALOG ) |
8758 return true; | 8755 return true; |
8759 } | 8756 } |
8760 return false; | 8757 return false; |
8761 } | 8758 } |
8762 | 8759 |
8861 && pActors[v6].uAIState != Dying | 8858 && pActors[v6].uAIState != Dying |
8862 && pActors[v6].uAIState != Removed | 8859 && pActors[v6].uAIState != Removed |
8863 && pActors[v6].uAIState != Disabled | 8860 && pActors[v6].uAIState != Disabled |
8864 && pActors[v6].uAIState != Summoned ) | 8861 && pActors[v6].uAIState != Summoned ) |
8865 { | 8862 { |
8866 if ( pGame->pVisInstance->DoesRayIntersectBillboard((double)pDepth, a1a) ) | 8863 if ( pEngine->pVisInstance->DoesRayIntersectBillboard((double)pDepth, a1a) ) |
8867 { | 8864 { |
8868 if ( mon_num < 100 ) | 8865 if ( mon_num < 100 ) |
8869 { | 8866 { |
8870 _50BF30_actors_in_viewport_ids[mon_num] = v6; | 8867 _50BF30_actors_in_viewport_ids[mon_num] = v6; |
8871 mon_num++; | 8868 mon_num++; |
8889 if (bUsingSpecular) | 8886 if (bUsingSpecular) |
8890 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE); | 8887 pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE); |
8891 | 8888 |
8892 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | 8889 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
8893 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); | 8890 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); |
8894 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pGame->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03"))); | 8891 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pEngine->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03"))); |
8895 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | 8892 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
8896 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); | 8893 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); |
8897 } | 8894 } |
8898 | 8895 |
8899 void Render::EndLightmaps() | 8896 void Render::EndLightmaps() |
8919 | 8916 |
8920 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | 8917 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
8921 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); | 8918 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE)); |
8922 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); | 8919 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE)); |
8923 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); | 8920 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); |
8924 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pGame->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03"))); | 8921 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pEngine->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("effpar03"))); |
8925 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | 8922 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
8926 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); | 8923 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); |
8927 } | 8924 } |
8928 | 8925 |
8929 | 8926 |
9010 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); | 9007 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE)); |
9011 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); | 9008 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
9012 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); | 9009 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE)); |
9013 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); | 9010 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE)); |
9014 | 9011 |
9015 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pGame->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("hwsplat04"))); | 9012 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pEngine->pIndoorCameraD3D->LoadTextureAndGetHardwarePtr("hwsplat04"))); |
9016 } | 9013 } |
9017 | 9014 |
9018 | 9015 |
9019 void Render::EndDecals() | 9016 void Render::EndDecals() |
9020 { | 9017 { |
9065 uFinalG = floorf(uTintG / 255.0 * color_mult * uDecalColorMultG + 0.0f), | 9062 uFinalG = floorf(uTintG / 255.0 * color_mult * uDecalColorMultG + 0.0f), |
9066 uFinalB = floorf(uTintB / 255.0 * color_mult * uDecalColorMultB + 0.0f); | 9063 uFinalB = floorf(uTintB / 255.0 * color_mult * uDecalColorMultB + 0.0f); |
9067 | 9064 |
9068 float v15; | 9065 float v15; |
9069 if (fabs(z_bias) < 1e-5) | 9066 if (fabs(z_bias) < 1e-5) |
9070 v15 = 1.0 - 1.0 / ((1.0f / pGame->pIndoorCameraD3D->GetShadingDistMist()) * pDecal->pVertices[i].vWorldViewPosition.x * 1000.0); | 9067 v15 = 1.0 - 1.0 / ((1.0f / pEngine->pIndoorCameraD3D->GetShadingDistMist()) * pDecal->pVertices[i].vWorldViewPosition.x * 1000.0); |
9071 else | 9068 else |
9072 { | 9069 { |
9073 v15 = 1.0 - 1.0 / ((1.0f / pGame->pIndoorCameraD3D->GetShadingDistMist()) * pDecal->pVertices[i].vWorldViewPosition.x * 1000.0) - z_bias; | 9070 v15 = 1.0 - 1.0 / ((1.0f / pEngine->pIndoorCameraD3D->GetShadingDistMist()) * pDecal->pVertices[i].vWorldViewPosition.x * 1000.0) - z_bias; |
9074 if (v15 < 0.000099999997) | 9071 if (v15 < 0.000099999997) |
9075 v15 = 0.000099999997; | 9072 v15 = 0.000099999997; |
9076 } | 9073 } |
9077 | 9074 |
9078 pVerticesD3D[i].pos.x = pDecal->pVertices[i].vWorldViewProjX; | 9075 pVerticesD3D[i].pos.x = pDecal->pVertices[i].vWorldViewProjX; |
10514 int v17; // [sp+1Ch] [bp-10h]@1 | 10511 int v17; // [sp+1Ch] [bp-10h]@1 |
10515 int v19; // [sp+20h] [bp-Ch]@3 | 10512 int v19; // [sp+20h] [bp-Ch]@3 |
10516 int angle; // [sp+24h] [bp-8h]@1 | 10513 int angle; // [sp+24h] [bp-8h]@1 |
10517 | 10514 |
10518 angle = (signed int)(pODMRenderParams->uCameraFovInDegrees << 11) / 360 / 2; | 10515 angle = (signed int)(pODMRenderParams->uCameraFovInDegrees << 11) / 360 / 2; |
10519 v3 = pOutdoor->pBModels[uModelID].vBoundingCenter.x - pGame->pIndoorCameraD3D->vPartyPos.x; | 10516 v3 = pOutdoor->pBModels[uModelID].vBoundingCenter.x - pEngine->pIndoorCameraD3D->vPartyPos.x; |
10520 v4 = pOutdoor->pBModels[uModelID].vBoundingCenter.y - pGame->pIndoorCameraD3D->vPartyPos.y; | 10517 v4 = pOutdoor->pBModels[uModelID].vBoundingCenter.y - pEngine->pIndoorCameraD3D->vPartyPos.y; |
10521 stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX); | 10518 stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationX); |
10522 v17 = v3 * stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY) + v4 * stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); | 10519 v17 = v3 * stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationY) + v4 * stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationY); |
10523 if (pGame->pIndoorCameraD3D->sRotationX) | 10520 if (pEngine->pIndoorCameraD3D->sRotationX) |
10524 v17 = fixpoint_mul(v17, stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX)); | 10521 v17 = fixpoint_mul(v17, stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationX)); |
10525 v19 = v4 * stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY) - v3 * stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); | 10522 v19 = v4 * stru_5C6E00->Cos(pEngine->pIndoorCameraD3D->sRotationY) - v3 * stru_5C6E00->Sin(pEngine->pIndoorCameraD3D->sRotationY); |
10526 v9 = int_get_vector_length(abs(v3), abs(v4), 0); | 10523 v9 = int_get_vector_length(abs(v3), abs(v4), 0); |
10527 //v10 = v14 * 188; | 10524 //v10 = v14 * 188; |
10528 //v22 = v9; | 10525 //v22 = v9; |
10529 *reachable = false; | 10526 *reachable = false; |
10530 if (v9 < pOutdoor->pBModels[uModelID].sBoundingRadius + 256) | 10527 if (v9 < pOutdoor->pBModels[uModelID].sBoundingRadius + 256) |
11117 int v19; // ST0C_4@9 | 11114 int v19; // ST0C_4@9 |
11118 int v24; // [sp+14h] [bp-14h]@1 | 11115 int v24; // [sp+14h] [bp-14h]@1 |
11119 int v25; // [sp+18h] [bp-10h]@1 | 11116 int v25; // [sp+18h] [bp-10h]@1 |
11120 int v27; // [sp+24h] [bp-4h]@1 | 11117 int v27; // [sp+24h] [bp-4h]@1 |
11121 | 11118 |
11122 v25 = pGame->pIndoorCameraD3D->int_cosine_x; | 11119 v25 = pEngine->pIndoorCameraD3D->int_cosine_x; |
11123 v7 = pGame->pIndoorCameraD3D->int_sine_y; | 11120 v7 = pEngine->pIndoorCameraD3D->int_sine_y; |
11124 v27 = pGame->pIndoorCameraD3D->int_sine_x; | 11121 v27 = pEngine->pIndoorCameraD3D->int_sine_x; |
11125 //v8 = -pIndoorCamera->pos.y; | 11122 //v8 = -pIndoorCamera->pos.y; |
11126 v9 = pGame->pIndoorCameraD3D->int_cosine_y; | 11123 v9 = pEngine->pIndoorCameraD3D->int_cosine_y; |
11127 //v26 = -pIndoorCamera->pos.z; | 11124 //v26 = -pIndoorCamera->pos.z; |
11128 v11 = pGame->pIndoorCameraD3D->int_cosine_y * -pGame->pIndoorCameraD3D->vPartyPos.x + pGame->pIndoorCameraD3D->int_sine_y * -pGame->pIndoorCameraD3D->vPartyPos.y; | 11125 v11 = pEngine->pIndoorCameraD3D->int_cosine_y * -pEngine->pIndoorCameraD3D->vPartyPos.x + pEngine->pIndoorCameraD3D->int_sine_y * -pEngine->pIndoorCameraD3D->vPartyPos.y; |
11129 v24 = pGame->pIndoorCameraD3D->int_cosine_y * -pGame->pIndoorCameraD3D->vPartyPos.y - pGame->pIndoorCameraD3D->int_sine_y * -pGame->pIndoorCameraD3D->vPartyPos.x; | 11126 v24 = pEngine->pIndoorCameraD3D->int_cosine_y * -pEngine->pIndoorCameraD3D->vPartyPos.y - pEngine->pIndoorCameraD3D->int_sine_y * -pEngine->pIndoorCameraD3D->vPartyPos.x; |
11130 if (pGame->pIndoorCameraD3D->sRotationX) | 11127 if (pEngine->pIndoorCameraD3D->sRotationX) |
11131 { | 11128 { |
11132 this->field_0_party_dir_x = fixpoint_mul(v11, pGame->pIndoorCameraD3D->int_cosine_x) + | 11129 this->field_0_party_dir_x = fixpoint_mul(v11, pEngine->pIndoorCameraD3D->int_cosine_x) + |
11133 fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_sine_x); | 11130 fixpoint_mul((-pEngine->pIndoorCameraD3D->vPartyPos.z) << 16, pEngine->pIndoorCameraD3D->int_sine_x); |
11134 this->field_4_party_dir_y = v24; | 11131 this->field_4_party_dir_y = v24; |
11135 this->field_8_party_dir_z = fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v25) - fixpoint_mul(v11, v27); | 11132 this->field_8_party_dir_z = fixpoint_mul((-pEngine->pIndoorCameraD3D->vPartyPos.z) << 16, v25) - fixpoint_mul(v11, v27); |
11136 } | 11133 } |
11137 else | 11134 else |
11138 { | 11135 { |
11139 this->field_0_party_dir_x = v11; | 11136 this->field_0_party_dir_x = v11; |
11140 this->field_4_party_dir_y = v24; | 11137 this->field_4_party_dir_y = v24; |
11141 this->field_8_party_dir_z = (-pGame->pIndoorCameraD3D->vPartyPos.z) << 16; | 11138 this->field_8_party_dir_z = (-pEngine->pIndoorCameraD3D->vPartyPos.z) << 16; |
11142 } | 11139 } |
11143 | 11140 |
11144 if (pGame->pIndoorCameraD3D->sRotationX) | 11141 if (pEngine->pIndoorCameraD3D->sRotationX) |
11145 { | 11142 { |
11146 v17 = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7); | 11143 v17 = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7); |
11147 | 11144 |
11148 this->angle_from_north = fixpoint_mul(v17, v25) + fixpoint_mul(a4, v27); | 11145 this->angle_from_north = fixpoint_mul(v17, v25) + fixpoint_mul(a4, v27); |
11149 this->angle_from_west = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7); | 11146 this->angle_from_west = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7); |
11154 this->angle_from_north = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7); | 11151 this->angle_from_north = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7); |
11155 this->angle_from_west = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7); | 11152 this->angle_from_west = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7); |
11156 this->viewing_angle_from_west_east = a4; | 11153 this->viewing_angle_from_west_east = a4; |
11157 } | 11154 } |
11158 | 11155 |
11159 if (pGame->pIndoorCameraD3D->sRotationX) | 11156 if (pEngine->pIndoorCameraD3D->sRotationX) |
11160 { | 11157 { |
11161 v19 = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7); | 11158 v19 = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7); |
11162 | 11159 |
11163 this->angle_from_east = fixpoint_mul(v19, v25) + fixpoint_mul(a7, v27); | 11160 this->angle_from_east = fixpoint_mul(v19, v25) + fixpoint_mul(a7, v27); |
11164 this->angle_from_south = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7); | 11161 this->angle_from_south = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7); |