Mercurial > mm7
comparison Render.cpp @ 1410:38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
stru167 -> TrailParticle
stru167warp -> TrailParticleGenerator
author | Nomad |
---|---|
date | Fri, 26 Jul 2013 22:19:29 +0200 |
parents | c9e3b93ec570 |
children | 3881d2f94eb1 b67a3e0d6fc3 |
comparison
equal
deleted
inserted
replaced
1409:c9e3b93ec570 | 1410:38df78aba732 |
---|---|
23 #include "Math.h" | 23 #include "Math.h" |
24 #include "PaletteManager.h" | 24 #include "PaletteManager.h" |
25 #include "Time.h" | 25 #include "Time.h" |
26 #include "Game.h" | 26 #include "Game.h" |
27 #include "LightmapBuilder.h" | 27 #include "LightmapBuilder.h" |
28 #include "stru220.h" | |
29 #include "ObjectList.h" | 28 #include "ObjectList.h" |
30 #include "SpriteObject.h" | 29 #include "SpriteObject.h" |
31 #include "DecorationList.h" | 30 #include "DecorationList.h" |
32 #include "Allocator.h" | 31 #include "Allocator.h" |
33 #include "OSInfo.h" | 32 #include "OSInfo.h" |
515 { | 514 { |
516 v5 = abs(X);//v5 = 13108 | 515 v5 = abs(X);//v5 = 13108 |
517 v6 = abs(v83);//v6 = 13108 | 516 v6 = abs(v83);//v6 = 13108 |
518 --X; | 517 --X; |
519 //__debugbreak(); // uncoment & refactor following large if | 518 //__debugbreak(); // uncoment & refactor following large if |
520 v93 = (int)&stru_76E5C8[(v5 << 7) + v6]; | 519 v93 = (int)&terrain_76E5C8[(v5 << 7) + v6]; |
521 /*if ( !v93->field_0 || ((v7 = 48 * v4, v8 = &pVerticesSR_806210[v4], a2 = v8, !v82) ? (v9 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7), | 520 /*if ( !v93->field_0 || ((v7 = 48 * v4, v8 = &pVerticesSR_806210[v4], a2 = v8, !v82) ? (v9 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7), |
522 v10 = &pVerticesSR_806210[1] + v7) : (v9 = &pVerticesSR_806210[1] + v7, v10 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7)), | 521 v10 = &pVerticesSR_806210[1] + v7) : (v9 = &pVerticesSR_806210[1] + v7, v10 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7)), |
523 ((a8 = v9, | 522 ((a8 = v9, |
524 pVertices = &pVerticesSR_801A10[1] + v7, | 523 pVertices = &pVerticesSR_801A10[1] + v7, |
525 v11 = v8->vWorldPosition.x, | 524 v11 = v8->vWorldPosition.x, |
536 _this = (LightmapBuilder *)WorldPosToGridCellZ(floorf(thisd + 0.5f)),//maybe current camera position Z | 535 _this = (LightmapBuilder *)WorldPosToGridCellZ(floorf(thisd + 0.5f)),//maybe current camera position Z |
537 WorldPosToGridCellX(sX), | 536 WorldPosToGridCellX(sX), |
538 WorldPosToGridCellZ(sY), | 537 WorldPosToGridCellZ(sY), |
539 !byte_4D864C) | 538 !byte_4D864C) |
540 || !(pGame->uFlags & 0x80)) | 539 || !(pGame->uFlags & 0x80)) |
541 && !sub_481EFA(v8, v9, v101, pVertices, 1)) )*/ | 540 && !_481EFA_clip_terrain_poly(v8, v9, v101, pVertices, 1)) )*/ |
542 /*if ( !&stru_76E5C8[(v5 << 7) + v6] ) | 541 /*if ( !&terrain_76E5C8[(v5 << 7) + v6] ) |
543 goto LABEL_162*/ | 542 goto LABEL_162*/ |
544 v8 = &pVerticesSR_806210[v4]; | 543 v8 = &pVerticesSR_806210[v4]; |
545 //pVertices2 = &pVerticesSR_801A10[v4 + 1]; | 544 //pVertices2 = &pVerticesSR_801A10[v4 + 1]; |
546 //v102 = v8; | 545 //v102 = v8; |
547 if (!v82) | 546 if (!v82) |
558 sY = floorf(v8->vWorldPosition.z + 0.5f); | 557 sY = floorf(v8->vWorldPosition.z + 0.5f); |
559 v89 = WorldPosToGridCellX(floorf((v101->vWorldPosition.x + v8->vWorldPosition.x) / 2 + 0.5f)); | 558 v89 = WorldPosToGridCellX(floorf((v101->vWorldPosition.x + v8->vWorldPosition.x) / 2 + 0.5f)); |
560 v97 = WorldPosToGridCellZ(floorf((pVertices->vWorldPosition.z + v8->vWorldPosition.z) / 2 + 0.5f)); | 559 v97 = WorldPosToGridCellZ(floorf((pVertices->vWorldPosition.z + v8->vWorldPosition.z) / 2 + 0.5f)); |
561 /*WorldPosToGridCellX(sX); | 560 /*WorldPosToGridCellX(sX); |
562 WorldPosToGridCellZ(sY); | 561 WorldPosToGridCellZ(sY); |
563 if ((!byte_4D864C || !(pGame->uFlags & 0x80)) && !sub_481EFA(v8, pVertices, v101, pVertices2, 1)) | 562 if ((!byte_4D864C || !(pGame->uFlags & 0x80)) && !_481EFA_clip_terrain_poly(v8, pVertices, v101, pVertices2, 1)) |
564 if ( v8->vWorldPosition.y != pVertices->vWorldPosition.y || pVertices->vWorldPosition.y != pVertices2->vWorldPosition.y | 563 if ( v8->vWorldPosition.y != pVertices->vWorldPosition.y || pVertices->vWorldPosition.y != pVertices2->vWorldPosition.y |
565 || pVertices2->vWorldPosition.y != v101->vWorldPosition.y ) | 564 || pVertices2->vWorldPosition.y != v101->vWorldPosition.y ) |
566 break;*/ | 565 break;*/ |
567 pTile = &array_77EC08[pOutdoorCamera->uNumPolygons]; | 566 pTile = &array_77EC08[pOutdoorCamera->uNumPolygons]; |
568 pTile->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); | 567 pTile->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); |
588 //v26 = pOutdoorCamera->uNumPolygons - 1999 < 0; | 587 //v26 = pOutdoorCamera->uNumPolygons - 1999 < 0; |
589 pTile->dimming_level = floorf(thisf + 0.5f); | 588 pTile->dimming_level = floorf(thisf + 0.5f); |
590 if ( pOutdoorCamera->uNumPolygons >= 1999 ) | 589 if ( pOutdoorCamera->uNumPolygons >= 1999 ) |
591 return; | 590 return; |
592 ++pOutdoorCamera->uNumPolygons; | 591 ++pOutdoorCamera->uNumPolygons; |
593 //if ( !sub_481FC9(v8, pVertices, v101, v16) )//Ritor1: It's temporary | 592 //if ( !_481FC9_terrain(v8, pVertices, v101, v16) )//Ritor1: It's temporary |
594 //goto LABEL_126; | 593 //goto LABEL_126; |
595 //{ | 594 //{ |
596 //--pOutdoorCamera->uNumPolygons; | 595 //--pOutdoorCamera->uNumPolygons; |
597 //goto LABEL_162; | 596 //goto LABEL_162; |
598 //} | 597 //} |
729 if ( LOBYTE(v50) < 0 ) | 728 if ( LOBYTE(v50) < 0 ) |
730 v40->dimming_level = 0; | 729 v40->dimming_level = 0; |
731 if ( pOutdoorCamera->uNumPolygons >= 1999 ) | 730 if ( pOutdoorCamera->uNumPolygons >= 1999 ) |
732 return; | 731 return; |
733 ++pOutdoorCamera->uNumPolygons; | 732 ++pOutdoorCamera->uNumPolygons; |
734 /*if ( !sub_481FC9(pVertices, pVertices2, v8, v40) ) // Ritor1: It's temporary | 733 /*if ( !_481FC9_terrain(pVertices, pVertices2, v8, v40) ) // Ritor1: It's temporary |
735 //goto LABEL_77; | 734 //goto LABEL_77; |
736 { | 735 { |
737 --pOutdoorCamera->uNumPolygons; | 736 --pOutdoorCamera->uNumPolygons; |
738 goto LABEL_112; | 737 goto LABEL_112; |
739 }*/ | 738 }*/ |
858 if ( v59->dimming_level < 0 ) | 857 if ( v59->dimming_level < 0 ) |
859 v59->dimming_level = 0; | 858 v59->dimming_level = 0; |
860 if ( pOutdoorCamera->uNumPolygons >= 1999 ) | 859 if ( pOutdoorCamera->uNumPolygons >= 1999 ) |
861 return; | 860 return; |
862 ++pOutdoorCamera->uNumPolygons; | 861 ++pOutdoorCamera->uNumPolygons; |
863 if ( !sub_481FC9(v101, v102, pVertices2, v59) ) | 862 if ( !_481FC9_terrain(v101, v102, pVertices2, v59) ) |
864 { | 863 { |
865 //LABEL_126: | 864 //LABEL_126: |
866 --pOutdoorCamera->uNumPolygons; | 865 --pOutdoorCamera->uNumPolygons; |
867 goto LABEL_162; | 866 goto LABEL_162; |
868 } | 867 } |
1013 billboard._screenspace_y_scaler_packedfloat = pBillboard->_screenspace_y_scaler_packedfloat; | 1012 billboard._screenspace_y_scaler_packedfloat = pBillboard->_screenspace_y_scaler_packedfloat; |
1014 billboard.sZValue = pBillboard->sZValue; | 1013 billboard.sZValue = pBillboard->sZValue; |
1015 billboard.uFlags = pBillboard->field_1E; | 1014 billboard.uFlags = pBillboard->field_1E; |
1016 if (pBillboard->uHwSpriteID != -1) | 1015 if (pBillboard->uHwSpriteID != -1) |
1017 { | 1016 { |
1018 if (pRenderer->pRenderD3D) | 1017 if (!pRenderer->pRenderD3D) __debugbreak(); // no sw rendering |
1018 //if (pRenderer->pRenderD3D) | |
1019 pRenderer->TransformBillboard(&billboard, | 1019 pRenderer->TransformBillboard(&billboard, |
1020 &pSprites_LOD->pHardwareSprites[pBillboard->uHwSpriteID], | 1020 &pSprites_LOD->pHardwareSprites[pBillboard->uHwSpriteID], |
1021 pBillboard->dimming_level, pBillboard); | 1021 pBillboard->dimming_level, pBillboard); |
1022 else | 1022 /*else |
1023 { | 1023 { |
1024 assert(false); | 1024 assert(false); |
1025 | 1025 |
1026 auto v1 = (char *)&pBillboard->uScreenSpaceY; | 1026 auto v1 = (char *)&pBillboard->uScreenSpaceY; |
1027 if ( *(v1 - 10) & 2 ) | 1027 if ( *(v1 - 10) & 2 ) |
1028 v9 = PaletteManager::Get_Dark_or_Red_LUT(*((short *)v1 - 7), 0, 1); | 1028 v9 = PaletteManager::Get_Dark_or_Red_LUT(*((short *)v1 - 7), 0, 1); |
1029 else | 1029 else |
1030 v9 = GetBillboardPalette((RenderBillboard *)(v1 - 40), *((short *)v1 - 7), pBillboard->sZValue, *((short *)v1 + 1)); | 1030 v9 = sr_GetBillboardPalette((RenderBillboard *)(v1 - 40), *((short *)v1 - 7), pBillboard->sZValue, *((short *)v1 + 1)); |
1031 v10 = (*(v1 - 9) & 1) == 0; | 1031 v10 = (*(v1 - 9) & 1) == 0; |
1032 billboard.pPalette = v9; | 1032 billboard.pPalette = v9; |
1033 if ( !v10 ) | 1033 if ( !v10 ) |
1034 billboard.pPalette = pPaletteManager->field_261600[*((short *)v1 - 7)]; | 1034 billboard.pPalette = pPaletteManager->field_261600[*((short *)v1 - 7)]; |
1035 if ( !(billboard.uFlags & 0x40) && billboard.uFlags & 0x80 ) | 1035 if ( !(billboard.uFlags & 0x40) && billboard.uFlags & 0x80 ) |
1040 billboard.pPalette2 = PaletteManager::Get_Dark_or_Red_LUT(*((short *)v1 - 7), 15 - v18, 1); | 1040 billboard.pPalette2 = PaletteManager::Get_Dark_or_Red_LUT(*((short *)v1 - 7), 15 - v18, 1); |
1041 } | 1041 } |
1042 v13 = *((short *)v1 - 8); | 1042 v13 = *((short *)v1 - 8); |
1043 if ( v13 >= 0 ) | 1043 if ( v13 >= 0 ) |
1044 pSprites_LOD->pSpriteHeaders[v13].DrawSprite_sw(&billboard, 1); | 1044 pSprites_LOD->pSpriteHeaders[v13].DrawSprite_sw(&billboard, 1); |
1045 } | 1045 }*/ |
1046 } | 1046 } |
1047 } | 1047 } |
1048 } | 1048 } |
1049 | 1049 |
1050 //----- (0047AF11) -------------------------------------------------------- | 1050 //----- (0047AF11) -------------------------------------------------------- |