Mercurial > mm7
changeset 107:23b213c3f8e1
Слияние
author | Ritor1 |
---|---|
date | Fri, 08 Feb 2013 18:34:09 +0600 |
parents | efece1632349 (diff) dd570dea0632 (current diff) |
children | 2baff1256844 |
files | Outdoor.cpp Render.cpp |
diffstat | 2 files changed, 85 insertions(+), 203 deletions(-) [+] |
line wrap: on
line diff
--- a/Outdoor.cpp Fri Feb 08 16:05:20 2013 +0600 +++ b/Outdoor.cpp Fri Feb 08 18:34:09 2013 +0600 @@ -61,7 +61,7 @@ pIndoorCamera->pos.x = pParty->vPosition.x - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY) * (signed __int64)pParty->field_18) >> 16); - v3 = stru_5C6E00->SinCos(pParty->sRotationY - stru_5C6E00->uIntegerHalfPi); + //v3 = stru_5C6E00->SinCos(pParty->sRotationY - stru_5C6E00->uIntegerHalfPi); pIndoorCamera->field_4C = v1; pIndoorCamera->pos.y = pParty->vPosition.y - pParty->field_18 * ((stru_5C6E00->SinCos(pParty->sRotationY)) >> 16); pIndoorCamera->pos.z = pParty->vPosition.z + pParty->sEyelevel;
--- a/Render.cpp Fri Feb 08 16:05:20 2013 +0600 +++ b/Render.cpp Fri Feb 08 18:34:09 2013 +0600 @@ -1566,7 +1566,7 @@ ptr_801A08 = pVerticesSR_806210; ptr_801A04 = pVerticesSR_801A10; v126 = v69; - if ( v105 && v105 != 7 && v105 != 3 && v105 != 4 ) + if ( v105 && v105 != 7 && v105 != 3 && v105 != 4 )// { for ( i = v69; i >= 1; --i ) { @@ -1599,14 +1599,12 @@ v111 = v75 - uStartZ; for (int z = uStartZ; z < uEndZ; ++z) { - ptr_801A08[v127].vWorldPosition.x = (-64 + x) * 512; + ptr_801A08[v127].vWorldPosition.x = (-64 + x) * 512;//pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * 512; ptr_801A08[v127].vWorldPosition.y = (64 - terrain_76D9C8[i]) * 512; ptr_801A08[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( z, terrain_76D9C8[i]); - ptr_801A04[v127].vWorldPosition.x = (-64 + x) * 512; ptr_801A04[v127].vWorldPosition.y = (63 - terrain_76D9C8[i]) * 512; ptr_801A04[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( z, terrain_76D9C8[i] + 1); - if ( !byte_4D864C || !(pGame->uFlags & 0x80) ) { pIndoorCameraD3D_4->ViewTransform(&ptr_801A08[v127], 1); @@ -1618,12 +1616,12 @@ v127 ++; //++v116; //pHeight = v79; - } + } //while ( v116 < v107 ); } - v102.v103 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[i]); + v102.v103 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[i]); v102.v104 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[i]); - if ( pRenderer->pRenderD3D )//Ritor1: do comment to test + if ( pRenderer->pRenderD3D )//Ritor1: do comment to test Render::RenderTerrainD3D();//Render::DrawTerrainD3D(v111, 0, (int)&v102); else Render::DrawTerrainSW(v111, 0, (int)&v102); @@ -1737,217 +1735,101 @@ int v63; // [sp+50h] [bp-8h]@3 int v64; // [sp+57h] [bp-1h]@2 int v62; + struct IndoorCameraD3D *pIndoorCameraD3D; v63 = 0; - // basic optimizations - unsigned int uStartX, uEndX, - uStartZ, uEndZ; - if (pIndoorCamera->sRotationY >= 0 && pIndoorCamera->sRotationY <= 1024) - { - /* CAMERA - /2 512 - ^ - \ | / - \ | / - _____\|/______ + 0 - 1024 | x 0 - | - - y - 3/2 1536 - */ - uStartX = 0, uEndX = 128; - uStartZ = 0, uEndZ = 64 + 16; - } - else if (pIndoorCamera->sRotationY >= 512 && pIndoorCamera->sRotationY <= 1536) - { - /* /2 512 - + y - \ | - \ | -CAMERA _____\| ______ + 0 - 1024 /| x 0 - / | - / - y - 3/2 1536 - */ - uStartX = 0, uEndX = 64 + 16; - uStartZ = 0, uEndZ = 128; - } - else if (pIndoorCamera->sRotationY >= 1536 || pIndoorCamera->sRotationY <= 512) - { - /* /2 512 - + y - | / - | / - _____ |/______ + 0 CAMERA - 1024 |\ x 0 - | \ - - y \ - 3/2 1536 - */ - uStartX = 64 - 16, uEndX = 128; - uStartZ = 0, uEndZ = 128; - } - else - { - uStartX = 0, uEndX = 128; - uStartZ = 64 - 16, uEndZ = 128; - } - -// uStartX = 0, uEndX = 128; -// uStartZ = 0, uEndZ = 128; - - - static RenderVertexSoft pTerrainVertices[128 * 128]; - for (unsigned int z = uStartZ; z < uEndZ; ++z) - for (unsigned int x = uStartX; x < uEndX; ++x) - { - pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * 512; - pTerrainVertices[z * 128 + x].vWorldPosition.y = (64 - (signed)z) * 512; - pTerrainVertices[z * 128 + x].vWorldPosition.z = 32 * pOutdoor->pTerrain.pHeightmap[z * 128 + x]; - - struct IndoorCameraD3D *pIndoorCameraD3D = pGame->pIndoorCameraD3D; - pIndoorCameraD3D->ViewTransform(&pTerrainVertices[z * 128 + x], 1); - pIndoorCameraD3D->Project(&pTerrainVertices[z * 128 + x], 1, 0); - } - - - - for (unsigned int z = uStartZ; z < uEndZ - 1; ++z) - for (unsigned int x = uStartX; x < uEndX - 1; ++x) - { - v8 = &array_77EC08[pOutdoorCamera->numStru148s]; - v8->flags = 0; - v8->field_32 = 0; - - //unsigned int uTileID = pOutdoor->pTerrain.pTilemap[z * 128 + x]; - //struct TileDesc *pTile = pOutdoor->pTerrain->pTileTable->GetTileById(uTileID); - v8->uTileBitmapID = pOutdoor->DoGetTileTexture(x, z); - /*if (uTileID == 1 || //dirttyl BitmapID 88 - uTileID == 2 || //dirt1 BitmapID 126 - uTileID == 3 || //dirttyl BitmapID 88 - uTileID == 4 || //dirt2 BitmapID 127 - uTileID == 11 || //dirttyl BitmapID 127 - - uTileID == 90 || //grastyl BitmapID 110 - uTileID == 92 || //grastyl BitmapID 110 - - uTileID == 102 || //grdrtNE BitmapID 128 - uTileID == 104 || //grdrtNW BitmapID 130 - uTileID == 105 || //grdrtSW BitmapID 131 - uTileID == 106 || //grdrtE BitmapID 132 - uTileID == 107 || //grdrtW BitmapID 133 - uTileID == 108 || //grdrtN BitmapID 134 - uTileID == 109 || //grdrtS BitmapID 135 - uTileID == 110 || //grdrtXNE BitmapID 136 - uTileID == 112 || //grdrtXNW BitmapID 138 - uTileID == 113 || //grdrtXSW BitmapID 139 - - uTileID == 126 || uTileID == 127 || uTileID == 128 || uTileID == 129 || - uTileID == 130 || //wtrtyl BitmapID 89 - uTileID == 131 || //wtrtyl BitmapID 89 - uTileID == 132 || //wtrtyl BitmapID 89 - uTileID == 133 || //wtrtyl BitmapID 89 - uTileID == 134 || //wtrtyl BitmapID 89 - uTileID == 135 || //wtrtyl BitmapID 89 - uTileID == 136 || //wtrtyl BitmapID 89 - uTileID == 137 || //wtrtyl BitmapID 89 - - uTileID == 139 || //wtrdrSE BitmapID 141 - uTileID == 141 || //wrtdrSW BitmapID 143 - uTileID == 142 || //wrtdrE BitmapID 144 - uTileID == 143 || //wrtdrW BitmapID 145 - uTileID == 145 || //wtrdrS BitmapID 147 - uTileID == 147 || //wtrdrXSE BitmapID 149 - uTileID == 149 ) //wtrdrXSW BitmapID 151 - continue;*/ - - /*if (uTileID == 199 || //dirttyl BitmapID 0 - uTileID == 200 || //dirttyl BitmapID 0 - uTileID == 201 || //dirttyl BitmapID 0 - uTileID == 202 || //dirttyl BitmapID 0 - uTileID == 203 || //dirttyl BitmapID 0 - uTileID == 204 || //dirttyl BitmapID 0 - uTileID == 212 || //dirttyl BitmapID 0 - uTileID == 217) //dirttyl BitmapID 0 - continue;*/ - - v6 = v8->uTileBitmapID; - v8->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v6]; - - if (v8->uTileBitmapID == 0xFFFF) - continue; - - v8->sTextureDeltaU = 0; - v8->sTextureDeltaV = 0; - - -/* world coordinates, z -> height - 32767 - +y - - -32768 -x +x 32767 - - -y - -32768 -*/ - - memcpy(array_73D150 + 0, &pTerrainVertices[z * 128 + x], sizeof(RenderVertexSoft)); - array_73D150[0].u = 0; - array_73D150[0].v = 0; - - memcpy(array_73D150 + 1, &pTerrainVertices[z * 128 + x + 1], sizeof(RenderVertexSoft)); - array_73D150[1].u = 1; - array_73D150[1].v = 0; - - memcpy(array_73D150 + 2, &pTerrainVertices[(z + 1) * 128 + x + 1], sizeof(RenderVertexSoft)); - array_73D150[2].u = 1; - array_73D150[2].v = 1; - - memcpy(array_73D150 + 3, &pTerrainVertices[(z + 1) * 128 + x], sizeof(RenderVertexSoft)); - array_73D150[3].u = 0; - array_73D150[3].v = 1; - - + unsigned int uStartX, uEndX, + uStartZ, uEndZ; + if (pIndoorCamera->sRotationY >= 0 && pIndoorCamera->sRotationY <= 1024) + { + uStartX = 0, uEndX = 128; + uStartZ = 0, uEndZ = 64 + 16; + } + else if (pIndoorCamera->sRotationY >= 512 && pIndoorCamera->sRotationY <= 1536) + { + uStartX = 0, uEndX = 64 + 16; + uStartZ = 0, uEndZ = 128; + } + else if (pIndoorCamera->sRotationY >= 1536 || pIndoorCamera->sRotationY <= 512) + { + uStartX = 64 - 16, uEndX = 128; + uStartZ = 0, uEndZ = 128; + } + else + { + uStartX = 0, uEndX = 128; + uStartZ = 64 - 16, uEndZ = 128; + } +// uStartX = 0, uEndX = 128; +// uStartZ = 0, uEndZ = 128; + static RenderVertexSoft pTerrainVertices[128 * 128]; + for (unsigned int z = uStartZ; z < uEndZ; ++z) + { + for (unsigned int x = uStartX; x < uEndX; ++x) + { + pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * 512; + pTerrainVertices[z * 128 + x].vWorldPosition.y = (64 - (signed)z) * 512; + pTerrainVertices[z * 128 + x].vWorldPosition.z = 32 * pOutdoor->pTerrain.pHeightmap[z * 128 + x]; + pIndoorCameraD3D = pGame->pIndoorCameraD3D; + pIndoorCameraD3D->ViewTransform(&pTerrainVertices[z * 128 + x], 1); + pIndoorCameraD3D->Project(&pTerrainVertices[z * 128 + x], 1, 0); + } + } + for (unsigned int z = uStartZ; z < uEndZ - 1; ++z) + { + for (unsigned int x = uStartX; x < uEndX - 1; ++x) + { + v8 = &array_77EC08[pOutdoorCamera->numStru148s]; + v8->flags = 0; + v8->field_32 = 0; + //unsigned int uTileID = pOutdoor->pTerrain.pTilemap[z * 128 + x]; + //struct TileDesc *pTile = pOutdoor->pTerrain->pTileTable->GetTileById(uTileID); + v8->uTileBitmapID = pOutdoor->DoGetTileTexture(x, z); + v6 = v8->uTileBitmapID; + v8->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v6]; + if (v8->uTileBitmapID == 0xFFFF) + continue; + v8->sTextureDeltaU = 0; + v8->sTextureDeltaV = 0; + memcpy(array_73D150 + 0, &pTerrainVertices[z * 128 + x], sizeof(RenderVertexSoft)); + array_73D150[0].u = 0; + array_73D150[0].v = 0; + memcpy(array_73D150 + 1, &pTerrainVertices[z * 128 + x + 1], sizeof(RenderVertexSoft)); + array_73D150[1].u = 1; + array_73D150[1].v = 0; + memcpy(array_73D150 + 2, &pTerrainVertices[(z + 1) * 128 + x + 1], sizeof(RenderVertexSoft)); + array_73D150[2].u = 1; + array_73D150[2].v = 1; + memcpy(array_73D150 + 3, &pTerrainVertices[(z + 1) * 128 + x], sizeof(RenderVertexSoft)); + array_73D150[3].u = 0; + array_73D150[3].v = 1; v55 = 0; v54 = false; v58 = 0; - if (v58 == 4) // if all y == first y; primitive in xz plane v8->field_32 |= 0x0001; - v8->pODMFace = nullptr; v8->uNumVertices = 4; v8->field_59 = 5; - v8->field_58 = 0; - ++pOutdoorCamera->numStru148s; ++pOutdoorCamera->field_44; - - - - v8->uBModelID = 0; - v8->uBModelFaceID = 0; - v31 = (8 * (0 | (0 << 6))); - v8->field_50 = v31 | 6; - - for (unsigned int k = 0; k < 4; ++k) - { - memcpy(&array_50AC10[k], &array_73D150[k], sizeof(struct RenderVertexSoft)); - array_50AC10[k].flt_20 = 1.0 / (array_73D150[k].vWorldViewPosition.x + 0.0000001000000011686097); - } - - - pRenderer->DrawTerrainPolygon(v8, pBitmaps_LOD->pHardwareTextures[v6]); - + v8->uBModelID = 0; + v8->uBModelFaceID = 0; + v31 = (8 * (0 | (0 << 6))); + v8->field_50 = v31 | 6; + for (unsigned int k = 0; k < 4; ++k) + { + memcpy(&array_50AC10[k], &array_73D150[k], sizeof(struct RenderVertexSoft)); + array_50AC10[k].flt_20 = 1.0 / (array_73D150[k].vWorldViewPosition.x + 0.0000001000000011686097); + } + pRenderer->DrawTerrainPolygon(v8, pBitmaps_LOD->pHardwareTextures[v6]); --pOutdoorCamera->numStru148s; --pOutdoorCamera->field_44; - - } - - } + } + } +} //----- (0048034E) -------------------------------------------------------- void Render::DrawTerrainD3D(int a1, int a2, int a3)