# HG changeset patch # User Ritor1 # Date 1358854670 -21600 # Node ID 5a08b193507f83d001f368d334f6e7d3fdf7d632 # Parent 5629105aa1781d02a1b6e85140abb8abd5fe7c26 22.01.13 diff -r 5629105aa178 -r 5a08b193507f GUIWindow.cpp --- a/GUIWindow.cpp Mon Jan 21 14:37:14 2013 +0600 +++ b/GUIWindow.cpp Tue Jan 22 17:37:50 2013 +0600 @@ -1369,7 +1369,7 @@ if ( v13 < 0 ) v13 = 0; pFont->DrawTextLine(uDefaultColor, v11 + v13, v12, Stra, 640); - v12 += LOBYTE(pFont->uFontHeight) - uLineSpacing; + v12 += pFont->uFontHeight - uLineSpacing; result = strtok(0, "\n"); } return result; diff -r 5629105aa178 -r 5a08b193507f LightmapBuilder.cpp --- a/LightmapBuilder.cpp Mon Jan 21 14:37:14 2013 +0600 +++ b/LightmapBuilder.cpp Tue Jan 22 17:37:50 2013 +0600 @@ -964,7 +964,7 @@ RenderD3D *v13; // ecx@11 char v14; // dl@11 - __debugbreak(); + //__debugbreak(); v6 = pLight->uRadius; if ( v6 > 0 diff -r 5629105aa178 -r 5a08b193507f Outdoor.cpp --- a/Outdoor.cpp Mon Jan 21 14:37:14 2013 +0600 +++ b/Outdoor.cpp Tue Jan 22 17:37:50 2013 +0600 @@ -235,6 +235,11 @@ //----- (00488F2E) -------------------------------------------------------- int OutdoorLocation::GetHeightOnTerrain(int sX, int sZ) + /* Функция предоставляет возможность перемещать камеру таким образом, чтобы она имитировала ходьбу по ландшафту. + То есть нам надо менять высоту камеры (координату Y) в зависимости от того, в каком месте ландшафта мы находимся. + Для этого мы сначала должны определить по координатам X и Z камеры квадрат ландшафта в котором мы находимся. + Все это делает функция Terrain::getHeight; в своих параметрах она получает координаты X и Z камеры и возвращает высоту, + на которой должна быть расположена камера, чтобы она оказалась над ландшафтом.*/ { int result; // eax@5 @@ -707,7 +712,7 @@ } //----- (0047C7C2) -------------------------------------------------------- -void OutdoorLocationTerrain::Release() +void OutdoorLocationTerrain::Release()//очистить локацию { if (pHeightmap) { @@ -736,7 +741,7 @@ //----- (0047C80A) -------------------------------------------------------- int OutdoorLocationTerrain::_47C80A(int a2, int a3, int a4, int a5) { - OutdoorLocationTerrain *v5; // ebx@1 + OutdoorLocationTerrain *pOutLocTerrain; // ebx@1 double v6; // st7@1 double v7; // st7@2 double v8; // st7@2 @@ -747,7 +752,7 @@ int v13; // edi@7 int v14; // edx@9 int v15; // eax@15 - unsigned __int8 *v16; // ebx@15 + unsigned __int8 *pMapHeight; // ebx@15 int v17; // eax@15 int v18; // ecx@15 int v19; // esi@15 @@ -774,7 +779,7 @@ int v40; // [sp+18h] [bp-30h]@15 int v41; // [sp+1Ch] [bp-2Ch]@15 int v42; // [sp+20h] [bp-28h]@15 - OutdoorLocationTerrain *v43; // [sp+24h] [bp-24h]@1 + OutdoorLocationTerrain *pOutLocTerrain2; // [sp+24h] [bp-24h]@1 int v44; // [sp+28h] [bp-20h]@21 float v45; // [sp+2Ch] [bp-1Ch]@1 float v46; // [sp+30h] [bp-18h]@1 @@ -792,9 +797,9 @@ v46 = -64.0; v47 = -64.0; - v5 = this; + pOutLocTerrain = this; v45 = 64.0; - v43 = this; + pOutLocTerrain2 = this; v6 = sqrt(12288.0); if ( v6 != 0.0 ) { @@ -835,17 +840,17 @@ { if ( v13 >= 0 && result >= -32256 && v13 <= 127 && result <= 32768 ) { - v15 = v5->field_10; + v15 = pOutLocTerrain->field_10; v55 = v15; - v16 = v5->pHeightmap; - v17 = (int)(&v16[v13 * v15] + v14); + pMapHeight = pOutLocTerrain->pHeightmap; + v17 = (int)(&pMapHeight[v13 * v15] + v14); v18 = -v13; v19 = (64 - v13) << 9; v20 = 32 * *(char *)v17; v21 = 32 * *(char *)(v17 + 1); v22 = (v18 + 63) << 9; v41 = v22; - v23 = (int)(&v16[v55 * (v48 + 1)] + v50); + v23 = (int)(&pMapHeight[v55 * (v48 + 1)] + v50); v24 = v22 - v19; v40 = 32 * *(char *)v23; v42 = 32 * *(char *)(v23 + 1); @@ -869,9 +874,9 @@ v31 = 0.0; if ( v31 > 31.0 ) v31 = 31.0; - v44 = 2 * (v50 + v48 * v43->field_10); - v5 = v43; - *((char *)v43->ptr_C + v44 + 1) = (signed __int64)v31; + v44 = 2 * (v50 + v48 * pOutLocTerrain2->field_10); + pOutLocTerrain = pOutLocTerrain2; + *((char *)pOutLocTerrain2->ptr_C + v44 + 1) = (signed __int64)v31; v32 = v49 - (v49 - 512); v33 = (double)-((v42 - v40) * (v19 - v41)); v52 = v33; @@ -893,7 +898,7 @@ if ( v38 > 31.0 ) v38 = 31.0; v13 = v48; - *((char *)v43->ptr_C + v44) = (signed __int64)v38; + *((char *)pOutLocTerrain2->ptr_C + v44) = (signed __int64)v38; v14 = v50; result = v49; } @@ -1038,12 +1043,12 @@ void *v6; // eax@5 v1 = this; - v2 = pAllocator->AllocNamedChunk(this->pHeightmap, 0x4000u, "HMAP"); + v2 = pAllocator->AllocNamedChunk(this->pHeightmap, 0x4000u, "HMAP");//карта высот v1->pHeightmap = (unsigned __int8 *)v2; if ( v2 - && (v4 = pAllocator->AllocNamedChunk(v1->pTilemap, 0x4000u, "TMAP"), + && (v4 = pAllocator->AllocNamedChunk(v1->pTilemap, 0x4000u, "TMAP"),//карта тайлов (v1->pTilemap = (unsigned __int8 *)v4) != 0) - && (v5 = pAllocator->AllocNamedChunk(v1->pAttributemap, 0x4000u, "AMAP"), + && (v5 = pAllocator->AllocNamedChunk(v1->pAttributemap, 0x4000u, "AMAP"),//карта атрибутов (v1->pAttributemap = (unsigned __int8 *)v5) != 0) ) { v6 = pAllocator->AllocNamedChunk(v1->ptr_C, 0x8000u, "DMAP"); @@ -1177,7 +1182,7 @@ } //----- (0047D0A6) -------------------------------------------------------- -bool OutdoorLocation::Load(char *pFilename, ODMFace *File, size_t pNumItems, int thisa) +bool OutdoorLocation::Load(char *pFilename, ODMFace *File, size_t pNumItems, int thisa)//загрузка локации { //OutdoorLocation *pOutdoorLocation; // esi@1 /*bool result; // eax@9 @@ -2447,7 +2452,7 @@ { int result; // eax@5 - if ( (uX & 0x80000000u) != 0 || (signed int)uX > 127 || (uZ & 0x80000000u) != 0 || (signed int)uZ > 127 ) + if ( (signed int)uX < 0 || (signed int)uX > 127 || (signed int)uZ < 0 || (signed int)uZ > 127 ) result = 0; else result = 32 * *(&this->pTerrain.pHeightmap[128 * uZ] + uX); diff -r 5629105aa178 -r 5a08b193507f ParticleEngine.cpp --- a/ParticleEngine.cpp Mon Jan 21 14:37:14 2013 +0600 +++ b/ParticleEngine.cpp Tue Jan 22 17:37:50 2013 +0600 @@ -748,11 +748,7 @@ v14.uScreenSpaceX = v13->uScreenSpaceX; v14.uScreenSpaceY = v13->uScreenSpaceY; v14.sZValue = v13->sZValue; - pRenderer->MakeParticleBillboardAndPush_ODM( - &v14, - 0, - v13->uLightColor, - v13->_rotation); + pRenderer->MakeParticleBillboardAndPush_ODM(&v14, 0, v13->uLightColor, v13->_rotation); return; } if ( BYTE1(v8) & 2 ) @@ -763,11 +759,7 @@ v1->pLines.pLineVertices[2 * v9].pos.x = (double)*(signed int *)(v7 - 18); v1->pLines.pLineVertices[2 * v1->pLines.uNumLines].pos.y = (double)*(signed int *)(v7 - 14); v15 = *(short *)v7; - v1->pLines.pLineVertices[2 * v1->pLines.uNumLines].pos.z = 1.0 - - 1.0 - / ((double)v15 - * 1000.0 - / (double)pOutdoorCamera->shading_dist_mist); + v1->pLines.pLineVertices[2 * v1->pLines.uNumLines].pos.z = 1.0 - 1.0 / ((double)v15 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); v1->pLines.pLineVertices[2 * v1->pLines.uNumLines].rhw = 1.0; v1->pLines.pLineVertices[2 * v1->pLines.uNumLines].diffuse = *(int *)(v7 + 18); v1->pLines.pLineVertices[2 * v1->pLines.uNumLines].specular = 0; @@ -776,11 +768,7 @@ v1->pLines.pLineVertices[2 * v1->pLines.uNumLines + 1].pos.x = (double)*(signed int *)(v7 - 10); v1->pLines.pLineVertices[2 * v1->pLines.uNumLines + 1].pos.y = (double)*(signed int *)(v7 - 6); v15 = *(short *)v7; - v1->pLines.pLineVertices[2 * v1->pLines.uNumLines + 1].pos.z = 1.0 - - 1.0 - / ((double)v15 - * 1000.0 - / (double)pOutdoorCamera->shading_dist_mist); + v1->pLines.pLineVertices[2 * v1->pLines.uNumLines + 1].pos.z = 1.0 - 1.0 / ((double)v15 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); v1->pLines.pLineVertices[2 * v1->pLines.uNumLines + 1].rhw = 1.0; v1->pLines.pLineVertices[2 * v1->pLines.uNumLines + 1].diffuse = *(int *)(v7 + 18); v1->pLines.pLineVertices[2 * v1->pLines.uNumLines + 1].specular = 0; @@ -795,11 +783,7 @@ v14.uScreenSpaceX = *(int *)(v7 - 18); v14.uScreenSpaceY = *(int *)(v7 - 14); v14.sZValue = *(int *)(v7 - 2); - pRenderer->MakeParticleBillboardAndPush_ODM( - &v14, - pBitmaps_LOD->pHardwareTextures[*(int *)(v7 - 46)], - *(int *)(v7 + 18), - *(int *)(v7 - 22)); + pRenderer->MakeParticleBillboardAndPush_ODM(&v14, pBitmaps_LOD->pHardwareTextures[*(int *)(v7 - 46)], *(int *)(v7 + 18), *(int *)(v7 - 22)); } if ( *(v7 - 81) & 8 ) { @@ -808,10 +792,7 @@ v14.uScreenSpaceX = *(int *)(v7 - 18); v14.uScreenSpaceY = *(int *)(v7 - 14); v14.sZValue = *(int *)(v7 - 2); - pRenderer->MakeParticleBillboardAndPush_ODM( - &v14, - pSprites_LOD->pHardwareSprites[*(int *)(v7 - 46)].pTexture, - *(int *)(v7 + 18), + pRenderer->MakeParticleBillboardAndPush_ODM(&v14, pSprites_LOD->pHardwareSprites[*(int *)(v7 - 46)].pTexture, *(int *)(v7 + 18), *(int *)(v7 - 22)); } } diff -r 5629105aa178 -r 5a08b193507f Render.cpp --- a/Render.cpp Mon Jan 21 14:37:14 2013 +0600 +++ b/Render.cpp Tue Jan 22 17:37:50 2013 +0600 @@ -1593,18 +1593,18 @@ v105 = v79; v111 = v75 - v77; do - { + {// высота четырех вершин ячейки *(float *)&v106 = (double)v105; - *(float *)((char *)&ptr_801A08->vWorldPosition.x + v127) = *(float *)&v106; + *(float *)((char *)&ptr_801A08->vWorldPosition.x + v127) = *(float *)&v106;//x v105 = (64 - *(int *)((char *)terrain_76D9C8 + v70)) << 9; - *(float *)((char *)&ptr_801A08->vWorldPosition.y + v127) = (double)v105; + *(float *)((char *)&ptr_801A08->vWorldPosition.y + v127) = (double)v105;//y v105 = pOutdoor->GetHeightOnTerrain(v112, *(int *)((char *)terrain_76D9C8 + v70)); - *(float *)((char *)&ptr_801A08->vWorldPosition.z + v127) = (double)v105; - *(float *)((char *)&ptr_801A04->vWorldPosition.x + v127) = *(float *)&v106; + *(float *)((char *)&ptr_801A08->vWorldPosition.z + v127) = (double)v105;//z + *(float *)((char *)&ptr_801A04->vWorldPosition.x + v127) = *(float *)&v106;//x v105 = (63 - *(int *)((char *)terrain_76D9C8 + v70)) << 9; - *(float *)((char *)&ptr_801A04->vWorldPosition.y + v127) = (double)v105; + *(float *)((char *)&ptr_801A04->vWorldPosition.y + v127) = (double)v105;//y v105 = pOutdoor->GetHeightOnTerrain(v112, *(int *)((char *)terrain_76D9C8 + v70) + 1); - *(float *)((char *)&ptr_801A04->vWorldPosition.z + v127) = (double)v105; + *(float *)((char *)&ptr_801A04->vWorldPosition.z + v127) = (double)v105;//z if ( !byte_4D864C || !(pGame->uFlags & 0x80) ) { a1->ViewTransform((RenderVertexSoft *)(char *)ptr_801A08 + v127, 1); @@ -2878,11 +2878,7 @@ { billboard.sZValue = v7; billboard.uFlags = v2; - pRenderer->TransformBillboard( - &billboard, - &pSprites_LOD->pHardwareSprites[v6], - v8, - (RenderBillboard *)(v1 - 40)); + pRenderer->TransformBillboard(&billboard, &pSprites_LOD->pHardwareSprites[v6], v8, (RenderBillboard *)(v1 - 40)); } else { @@ -7083,7 +7079,7 @@ if (pRenderD3D) { pGame->draw_debug_outlines(); - //DoRenderBillboards_D3D(); //Ritor1: it's temporarily + DoRenderBillboards_D3D(); //Ritor1: it's temporarily pGame->pStru6Instance->RenderSpecialEffects(); pRenderD3D->pDevice->EndScene(); } @@ -8228,10 +8224,10 @@ if ( a1->uNumD3DSceneBegins ) { v5 = a2; - v6 = (double)HIWORD(a2->sZValue); + v6 = (double)a2->sZValue; v31 = v6; v7 = v6; - v8 = Billboard_ProbablyAddToListAndSortByZOrder(LODWORD(v7)); + v8 = Billboard_ProbablyAddToListAndSortByZOrder(v7); if ( BYTE3(v5->uTintColor) ) pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_3; else @@ -8267,8 +8263,7 @@ pBillboardRenderListD3D[v8].pQuards[0].pos.y = a1b - v26 * v29; v27 = v31 * 1000.0; v13 = 1.0; - pBillboardRenderListD3D[v8].pQuards[0].pos.z = 1.0 - - 1.0 / (v27 / (double)pOutdoorCamera->shading_dist_mist); + pBillboardRenderListD3D[v8].pQuards[0].pos.z = 1.0 - 1.0 / (v27 / (double)pOutdoorCamera->shading_dist_mist); v25 = 1.0 / v31; pBillboardRenderListD3D[v8].pQuards[0].rhw = v25; if ( a3->bUsingSpecular ) diff -r 5629105aa178 -r 5a08b193507f Vis.cpp --- a/Vis.cpp Mon Jan 21 14:37:14 2013 +0600 +++ b/Vis.cpp Tue Jan 22 17:37:50 2013 +0600 @@ -1819,7 +1819,7 @@ v9 = v8 < fDepth, v10 = 0, v11 = v8 == fDepth, - BYTE1(result) = HIBYTE(v7), + //BYTE1(result) = HIBYTE(v7), v9 | v11) ) { LOWORD(v5) = 0; @@ -1850,7 +1850,7 @@ v15 = v14 < fBillboardCenterY, v16 = 0, v17 = v14 == fBillboardCenterY, - BYTE1(result) = HIBYTE(v13), + //BYTE1(result) = HIBYTE(v13), v14 < fBillboardCenterY) ) { a3a = 0; diff -r 5629105aa178 -r 5a08b193507f mm7_2.cpp --- a/mm7_2.cpp Mon Jan 21 14:37:14 2013 +0600 +++ b/mm7_2.cpp Tue Jan 22 17:37:50 2013 +0600 @@ -12980,6 +12980,7 @@ bDialogueUI_InitializeActor_NPC_ID = 0; OnMapLoad(); pGameLoadingUI_ProgressBar->Progress(); +memset(&pRenderer->pBillboardRenderListD3D, 0, sizeof(pRenderer->pBillboardRenderListD3D)); pGameLoadingUI_ProgressBar->Release(); _flushall(); } diff -r 5629105aa178 -r 5a08b193507f mm7_5.cpp --- a/mm7_5.cpp Mon Jan 21 14:37:14 2013 +0600 +++ b/mm7_5.cpp Tue Jan 22 17:37:50 2013 +0600 @@ -16446,8 +16446,8 @@ pWindow.uFrameZ = pWindow.uFrameX + pWindow.uFrameWidth - 1; pWindow.uFrameW = pWindow.uFrameY + pWindow.uFrameHeight - 1; pColor = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0x9B); - sprintf(pTmpBuf, format_4E2D80, pColor, pStr); - pWindow.DrawText(pFontCreate, 0, 0, 0, pTmpBuf, 3, 0, 0); //DrawTitleText + sprintf(pTmpBuf, format_4E2D80, pColor, pStr);//"\f%05d%s\f00000\n" + pWindow.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf, 3); pWindow.DrawText(pFontSmallnum, 1, pFontLucida->uFontHeight, 0, pHint, 0, 0, 0); } LABEL_132: