Mercurial > mm7
changeset 63:a96ebf3123d2
23.01.13 (Rotate)
author | Ritor1 |
---|---|
date | Wed, 23 Jan 2013 13:14:10 +0600 |
parents | 63cfe63ac4c5 |
children | f6e7d7110512 |
files | LightmapBuilder.cpp ParticleEngine.cpp Render.cpp Vis.cpp mm7_3.cpp |
diffstat | 5 files changed, 84 insertions(+), 212 deletions(-) [+] |
line wrap: on
line diff
--- a/LightmapBuilder.cpp Tue Jan 22 17:50:36 2013 +0600 +++ b/LightmapBuilder.cpp Wed Jan 23 13:14:10 2013 +0600 @@ -1183,7 +1183,7 @@ v19 = v16 < v17; v20 = 0; v21 = v16 == v17; - BYTE1(result) = HIBYTE(v18); +// BYTE1(result) = HIBYTE(v18); if ( v16 <= v17 || (v22 = *(float *)&X + *(float *)&uStripType, //UNDEF(v23),
--- a/ParticleEngine.cpp Tue Jan 22 17:50:36 2013 +0600 +++ b/ParticleEngine.cpp Wed Jan 23 13:14:10 2013 +0600 @@ -93,10 +93,10 @@ uTimeElapsed += pEventTimer->uTimeElapsed; pLines.uNumLines = 0; - if (uCurrentlyLoadedLevelType == LEVEL_Indoor) - DrawParticles_BLV(); - else - DrawParticles_ODM(); + //if (uCurrentlyLoadedLevelType == LEVEL_Indoor) + //DrawParticles_BLV(); + //else + //DrawParticles_ODM(); if (pRenderer->pRenderD3D) {
--- a/Render.cpp Tue Jan 22 17:50:36 2013 +0600 +++ b/Render.cpp Wed Jan 23 13:14:10 2013 +0600 @@ -1621,10 +1621,10 @@ } v103 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[v70]); v104 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[v70]); - if ( pRenderer->pRenderD3D ) - Render::DrawTerrainD3D(v111, 0, (int)&v102); - else - Render::DrawTerrainSW(v111, 0, (int)&v102); + //if ( pRenderer->pRenderD3D ) + //Render::DrawTerrainD3D(v111, 0, (int)&v102); + //else + //Render::DrawTerrainSW(v111, 0, (int)&v102); } } else @@ -1686,10 +1686,10 @@ } v103 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[v86]); v104 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[v86]); - if ( pRenderer->pRenderD3D ) - Render::DrawTerrainD3D(v111, 1, (int)&v102); - else - Render::DrawTerrainSW(v111, 1, (int)&v102); + //if ( pRenderer->pRenderD3D ) + //Render::DrawTerrainD3D(v111, 1, (int)&v102); + //else + //Render::DrawTerrainSW(v111, 1, (int)&v102); } } result = v126; @@ -2836,7 +2836,7 @@ int v13; // eax@14 RenderBillboardTransform_local0 billboard; // [sp+4h] [bp-60h]@1 int v15; // [sp+54h] [bp-10h]@13 - int v16; // [sp+58h] [bp-Ch]@1 + int i; // [sp+58h] [bp-Ch]@1 int v17; // [sp+5Ch] [bp-8h]@2 int v18; // [sp+60h] [bp-4h]@13 @@ -2850,39 +2850,41 @@ billboard.uViewportW = pViewport->uViewportW; v0 = 0; pOutdoorCamera->uNumBillboards = uNumBillboardsToDraw; - v16 = 0; - if ( (signed int)uNumBillboardsToDraw > 0 ) + //v16 = 0; + for (i = 0; i < uNumBillboardsToDraw; ++i)//if ( (signed int)uNumBillboardsToDraw > 0 ) { v17 = 0; + struct RenderBillboard *pBillboard; + pBillboard = &pBillboardRenderList[i]; v1 = (char *)&pBillboardRenderList[0].uScreenSpaceY; - do - { - billboard.uScreenSpaceX = *((short *)v1 - 1); - v2 = *((short *)v1 - 5); - billboard.uScreenSpaceY = *(short *)v1; - v3 = *((int *)v1 - 10); - billboard.uParentBillboardID = v0; - v4 = *((int *)v1 + 1); - billboard.field_10 = v3; - v5 = *((int *)v1 - 9); - billboard.uTintColor = v4; - v6 = *((short *)v1 - 8); - billboard.field_14 = v5; - v7 = *((int *)v1 - 6); - billboard.sZValue = *((int *)v1 - 6); - billboard.uFlags = v2; - if ( v6 != -1 ) - { - v8 = *((short *)v1 + 1); - if ( pRenderer->pRenderD3D ) - { - billboard.sZValue = v7; - billboard.uFlags = v2; - pRenderer->TransformBillboard(&billboard, &pSprites_LOD->pHardwareSprites[v6], v8, (RenderBillboard *)(v1 - 40)); - } - else - { - if ( *(v1 - 10) & 2 ) + //do + //{ + billboard.uScreenSpaceX = pBillboard->uScreenSpaceX;; + v2 = pBillboard->field_1E; + billboard.uScreenSpaceY = pBillboard->uScreenSpaceY; + //v3 = *((int *)v1 - 10); + billboard.uParentBillboardID = i; + //v4 = *((int *)v1 + 1); + billboard.field_10 = pBillboard->field_0; + //v5 = *((int *)v1 - 9); + billboard.uTintColor = pBillboard->uTintColor; + //v6 = *((short *)v1 - 8); + billboard.field_14 = pBillboard->field_4; + //v7 = *((int *)v1 - 6); + billboard.sZValue = pBillboard->sZValue; + billboard.uFlags = pBillboard->field_1E; + if ( pBillboard->uHwSpriteID != -1 ) + { + v8 = pBillboard->uPaletteSubindex;; + //if ( pRenderer->pRenderD3D ) + //{ + billboard.sZValue = pBillboard->sZValue; + billboard.uFlags = pBillboard->field_1E; + pRenderer->TransformBillboard(&billboard, &pSprites_LOD->pHardwareSprites[pBillboard->uHwSpriteID], pBillboard->uPaletteSubindex, pBillboard); + //} + //else + //{ + /*if ( *(v1 - 10) & 2 ) v9 = PaletteManager::Get_Dark_or_Red_LUT(*((short *)v1 - 7), 0, 1); else v9 = GetBillboardPalette((RenderBillboard *)(v1 - 40), *((short *)v1 - 7), v7, *((short *)v1 + 1)); @@ -2900,15 +2902,15 @@ } v13 = *((short *)v1 - 8); if ( v13 >= 0 ) - pSprites_LOD->pSpriteHeaders[v13]._4ACC38(&billboard, 1); - } + pSprites_LOD->pSpriteHeaders[v13]._4ACC38(&billboard, 1);*/ + //} } v17 += 5; - v0 = v16 + 1; + //v0 = i + 1; v1 += 52; - ++v16; - } - while ( v16 < (signed int)uNumBillboardsToDraw ); + //++v16; + //} + //while ( v16 < (signed int)uNumBillboardsToDraw ); } } @@ -7079,7 +7081,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(); }
--- a/Vis.cpp Tue Jan 22 17:50:36 2013 +0600 +++ b/Vis.cpp Wed Jan 23 13:14:10 2013 +0600 @@ -1605,7 +1605,7 @@ stru1.uNumPointers = 0; CastPickRay(pMouseRay, fMouseX, fMouseY, fDepth); - PickBillboards(fDepth, fMouseX, fMouseY, &stru1, a5); + //PickBillboards(fDepth, fMouseX, fMouseY, &stru1, a5); if (uCurrentlyLoadedLevelType == LEVEL_Indoor) PickIndoor(fDepth, pMouseRay, &stru1, a6); else
--- a/mm7_3.cpp Tue Jan 22 17:50:36 2013 +0600 +++ b/mm7_3.cpp Wed Jan 23 13:14:10 2013 +0600 @@ -9360,166 +9360,36 @@ } //----- (00481FC9) -------------------------------------------------------- -int __fastcall sub_481FC9(RenderVertexSoft *_ECX, RenderVertexSoft *a2, RenderVertexSoft *a3, stru148 *a4) -{ - __debugbreak(); - return 0; - /*signed int result; // eax@5 - __int64 v11; // ST08_8@6 - __int64 v12; // ST08_8@6 - __int64 v13; // ST08_8@6 - __int64 v14; // ST08_8@6 - - __asm { fld dword ptr [ecx+8] } - _ESI = a2; - _EDX = a3; - __asm { fcomp dword ptr [esi+8] } - _EDI = a4; - __asm { fnstsw ax } - if ( !__SETP__(HIBYTE(_AX) & 0x44, 0) ) - { - __asm - { - fld dword ptr [esi+8] - fcomp dword ptr [edx+8] - fnstsw ax - } - if ( !__SETP__(HIBYTE(_AX) & 0x44, 0) ) - *(int *)&a4->flags |= 0x10u; - } - __asm - { - fld dword ptr [ecx+0Ch] - fsub dword ptr [esi+0Ch] - fstp [ebp+var_C] - fld dword ptr [ecx+10h] - fsub dword ptr [esi+10h] - fstp [ebp+var_14] - fld dword ptr [ecx+14h] - fsub dword ptr [esi+14h] - fstp [ebp+arg_0] - fld dword ptr [edx+0Ch] - fsub dword ptr [esi+0Ch] - fstp [ebp+var_10] - fld dword ptr [edx+10h] - fsub dword ptr [esi+10h] - fstp [ebp+var_8] - fld dword ptr [edx+14h] - fsub dword ptr [esi+14h] - fstp [ebp+var_4] - fld dword ptr [ecx] - fsub dword ptr [esi] - fld dword ptr [ecx+4] - fsub dword ptr [esi+4] - fld dword ptr [ecx+8] - fsub dword ptr [esi+8] - fld dword ptr [edx] - fsub dword ptr [esi] - fld dword ptr [edx+4] - fsub dword ptr [esi+4] - fld dword ptr [edx+8] - fsub dword ptr [esi+8] - fstp [ebp+arg_4] - fld st - fmul st, st(3) - fld [ebp+arg_4] - fmul st, st(5) - fsubp st(1), st - fild pIndoorCamera->pos.x - fsub dword ptr [esi] - fmulp st(1), st - fld [ebp+arg_4] - fmul st, st(6) - fld st(3) - fmul st, st(5) - fsubp st(1), st - fild pIndoorCamera->pos.y - fsub dword ptr [esi+4] - fmulp st(1), st - faddp st(1), st - fld st(2) - fmul st, st(5) - fld st(2) - fmul st, st(7) - fsubp st(1), st - fild pIndoorCamera->pos.z - fsub dword ptr [esi+8] - fmulp st(1), st - faddp st(1), st - fcomp ds:flt_4D84E8 - fstp st - fstp st - fstp st - fnstsw ax - fstp st - fstp st - } - if ( __SETP__(HIBYTE(_AX) & 0x41, 0) ) - { - __asm - { - fld [ebp+var_4] - fmul [ebp+var_14] - fld [ebp+var_8] - fmul [ebp+arg_0] - fsubp st(1), st - fstp [ebp+arg_4] - fld [ebp+arg_4] - fadd ds:flt_4D87D0 - fstp [ebp+var_20] - fld [ebp+var_10] - fmul [ebp+arg_0] - fld [ebp+var_4] - fmul [ebp+var_C] - } - _EDI->v_18.x = v11; - __asm - { - fsubp st(1), st - fstp [ebp+arg_4] - fld [ebp+arg_4] - fadd ds:flt_4D87D0 - fstp [ebp+var_20] - fld [ebp+var_8] - fmul [ebp+var_C] - fld [ebp+var_10] - fmul [ebp+var_14] - } - _EDI->v_18.y = v12; - __asm - { - fsubp st(1), st - fstp [ebp+arg_4] - fld [ebp+arg_4] - fadd ds:flt_4D87D0 - fstp [ebp+var_20] - } - _EDI->v_18.z = v13; - stru148::_486089_normalize_v_18(_EDI); - __asm - { - fild dword ptr [edi+18h] - fmul dword ptr [esi+0Ch] - fchs - fild dword ptr [edi+1Ch] - fmul dword ptr [esi+10h] - fsubp st(1), st - fild dword ptr [edi+20h] - fmul dword ptr [esi+14h] - fsubp st(1), st - fstp [ebp+arg_4] - fld [ebp+arg_4] - fadd ds:flt_4D87D0 - fstp [ebp+var_20] - } - _EDI->field_24 = v14; - result = 1; - } - else - { - result = 0; - } - return result;*/ +int __fastcall sub_481FC9(RenderVertexSoft *a1, RenderVertexSoft *a2, RenderVertexSoft *a3, stru148 *a4) +{ + float arg_0, arg_4, var_4, var_8, var_c, var_10, var_14; + + if (a1->vWorldPosition.y == a2->vWorldPosition.y && a2->vWorldPosition.y == a3->vWorldPosition.y) + a4->flags |= 0x10; + var_c = a1->vWorldViewPosition.x - a2->vWorldViewPosition.x; + var_14 = a1->vWorldViewPosition.y - a2->vWorldViewPosition.y; + arg_0 = a1->vWorldViewPosition.z - a2->vWorldViewPosition.z; + var_10 = a3->vWorldViewPosition.x - a2->vWorldViewPosition.x; + var_8 = a3->vWorldViewPosition.y - a2->vWorldViewPosition.y; + var_4 = a3->vWorldViewPosition.z - a2->vWorldViewPosition.z; + arg_4 = a3->vWorldPosition.y - a2->vWorldPosition.y; + if (((a3->vWorldPosition.y - a2->vWorldPosition.y) * (a1->vWorldPosition.x - a2->vWorldPosition.x) - (a3->vWorldPosition.x - a2->vWorldPosition.x) * (a1->vWorldPosition.y - a2->vWorldPosition.y)) * (pIndoorCamera->pos.y - a2->vWorldPosition.z) + + ((a3->vWorldPosition.z - a2->vWorldPosition.z) * (a1->vWorldPosition.y - a2->vWorldPosition.y) - (a3->vWorldPosition.y - a2->vWorldPosition.y) * (a1->vWorldPosition.z - a2->vWorldPosition.z)) * (pIndoorCamera->pos.x - a2->vWorldPosition.x) + + ((a3->vWorldPosition.x - a2->vWorldPosition.x) * (a1->vWorldPosition.z - a2->vWorldPosition.z) - (a3->vWorldPosition.z - a2->vWorldPosition.z) * (a1->vWorldPosition.x - a2->vWorldPosition.x)) * (pIndoorCamera->pos.z - a2->vWorldPosition.y) < 0) + { + arg_4 = var_4 * var_14 - var_8 * arg_0; + a4->v_18.x = floorf(arg_4 + 0.5f); + arg_4 = var_10 * arg_0 - var_4 * var_c; + a4->v_18.y = floorf(arg_4 + 0.5f); + arg_4 = var_8 * var_c - var_10 * var_14; + a4->v_18.z = floorf(arg_4 + 0.5f); + a4->_486089_normalize_v_18(); + arg_4 = -(a4->v_18.x * a2->vWorldViewPosition.x) - a4->v_18.y * a2->vWorldViewPosition.y - a4->v_18.z * a2->vWorldViewPosition.z; + a4->field_24 = floorf(arg_4 + 0.5f); + return true; + } + else + return false; }