comparison Render.cpp @ 179:f102bbff6fd8

15.02.13 Water
author Ritor1
date Fri, 15 Feb 2013 17:14:24 +0600
parents d1dde383af89
children d65528fc3bda 038a4d09406f
comparison
equal deleted inserted replaced
178:1dfa65be220e 179:f102bbff6fd8
18 #include "DecorationList.h" 18 #include "DecorationList.h"
19 #include "Allocator.h" 19 #include "Allocator.h"
20 #include "OSInfo.h" 20 #include "OSInfo.h"
21 #include "Actor.h" 21 #include "Actor.h"
22 #include "Log.h" 22 #include "Log.h"
23 #include "TileFrameTable.h"
23 24
24 #include "mm7_data.h" 25 #include "mm7_data.h"
25 26
26 27
27 #pragma comment(lib, "lib\\legacy_dx\\lib\\ddraw.lib") 28 #pragma comment(lib, "lib\\legacy_dx\\lib\\ddraw.lib")
1709 //int v2; // ebx@4 1710 //int v2; // ebx@4
1710 //struct ODMFace *v4; // esi@6 1711 //struct ODMFace *v4; // esi@6
1711 int v6; // ecx@8 1712 int v6; // ecx@8
1712 //int v7; // ecx@8 1713 //int v7; // ecx@8
1713 struct stru148 *v8; // ebx@8 1714 struct stru148 *v8; // ebx@8
1715 // RenderVertexSoft *v8a; // edi@3
1714 //char v11; // zf@8 1716 //char v11; // zf@8
1715 struct stru148 *v16; 1717 struct stru148 *v16;
1716 unsigned int v18; // edi@22 1718 unsigned int v18; // edi@22
1717 //int v20; // edi@34 1719 //int v20; // edi@34
1718 //int v28; // eax@50 1720 //int v28; // eax@50
1737 int v58; // [sp+3Ch] [bp-1Ch]@8 1739 int v58; // [sp+3Ch] [bp-1Ch]@8
1738 int v63; // [sp+50h] [bp-8h]@3 1740 int v63; // [sp+50h] [bp-8h]@3
1739 int v64; // [sp+57h] [bp-1h]@2 1741 int v64; // [sp+57h] [bp-1h]@2
1740 int v62; 1742 int v62;
1741 //struct IndoorCameraD3D *pIndoorCameraD3D; 1743 //struct IndoorCameraD3D *pIndoorCameraD3D;
1744 //RenderVertexSoft *pVertices; // [sp+C4h] [bp-Ch]@6
1742 1745
1743 v63 = 0; 1746 v63 = 0;
1744 // basic optimizations 1747 // basic optimizations
1745 unsigned int uStartX, uEndX, 1748 unsigned int uStartX, uEndX,
1746 uStartZ, uEndZ; 1749 uStartZ, uEndZ;
1785 { 1788 {
1786 v8 = &array_77EC08[pOutdoorCamera->numStru148s]; 1789 v8 = &array_77EC08[pOutdoorCamera->numStru148s];
1787 v8->flags = 0; 1790 v8->flags = 0;
1788 v8->field_32 = 0; 1791 v8->field_32 = 0;
1789 //unsigned int uTileID = pOutdoor->pTerrain.pTilemap[z * 128 + x]; 1792 //unsigned int uTileID = pOutdoor->pTerrain.pTilemap[z * 128 + x];
1790 //struct TileDesc *pTile = pOutdoor->pTerrain->pTileTable->GetTileById(uTileID); 1793 //struct TileDesc *pTile = pTileTable->GetTileById(uTileID);
1791 v8->uTileBitmapID = pOutdoor->DoGetTileTexture(x, z); 1794 v8->uTileBitmapID = pOutdoor->DoGetTileTexture(x, z);
1792 v6 = v8->uTileBitmapID; 1795 //v6 = v8->uTileBitmapID;
1793 v8->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v6]; 1796 v8->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v8->uTileBitmapID];
1794 if (v8->uTileBitmapID == 0xFFFF) 1797 if (v8->uTileBitmapID == 0xFFFF)
1795 continue; 1798 continue;
1799 v8->flags = 0x8010 |pOutdoor->GetSomeOtherTileInfo(x, z);
1800 v8->field_32 = 0;
1801 v8->field_59 = 1;
1802 //v8->field_5D = (char)WorldPosToGridCellZ(floorf((pVertices->vWorldPosition.z + v8a->vWorldPosition.z) / 2 + 0.5f));
1803 //v8->field_5C = WorldPosToGridCellX(floorf((v101->vWorldPosition.x + v8->vWorldPosition.x) / 2 + 0.5f));;
1796 v8->sTextureDeltaU = 0; 1804 v8->sTextureDeltaU = 0;
1797 v8->sTextureDeltaV = 0; 1805 v8->sTextureDeltaV = 0;
1798 memcpy(array_73D150 + 0, &pTerrainVertices[z * 128 + x], sizeof(RenderVertexSoft)); 1806 memcpy(array_73D150 + 0, &pTerrainVertices[z * 128 + x], sizeof(RenderVertexSoft));
1799 array_73D150[0].u = 0; 1807 array_73D150[0].u = 0;
1800 array_73D150[0].v = 0; 1808 array_73D150[0].v = 0;
1825 for (unsigned int k = 0; k < 4; ++k) 1833 for (unsigned int k = 0; k < 4; ++k)
1826 { 1834 {
1827 memcpy(&array_50AC10[k], &array_73D150[k], sizeof(struct RenderVertexSoft)); 1835 memcpy(&array_50AC10[k], &array_73D150[k], sizeof(struct RenderVertexSoft));
1828 array_50AC10[k]._rhw = 1.0 / (array_73D150[k].vWorldViewPosition.x + 0.0000001000000011686097); 1836 array_50AC10[k]._rhw = 1.0 / (array_73D150[k].vWorldViewPosition.x + 0.0000001000000011686097);
1829 } 1837 }
1838
1839 if ( v8->flags & 2 && v8->uTileBitmapID == pRenderer->field_1036AC_bitmapid )
1840 {
1841 //v80 = false;
1842 v6 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid];
1843 }
1844 else
1845 {
1846 v6 = v8->uTileBitmapID;
1847 //v80 = true;
1848 }
1830 1849
1831 assert(v6 < 1000); // many random crashes here 1850 assert(v6 < 1000); // many random crashes here
1832 pRenderer->DrawTerrainPolygon(v8, pBitmaps_LOD->pHardwareTextures[v6]); 1851 pRenderer->DrawTerrainPolygon(v8, pBitmaps_LOD->pHardwareTextures[v6]);
1833 --pOutdoorCamera->numStru148s; 1852 --pOutdoorCamera->numStru148s;
1834 --pOutdoorCamera->field_44; 1853 --pOutdoorCamera->field_44;