Mercurial > mm7
diff _deleted.cpp @ 2069:259df09dfb50
32bits almost there
author | Nomad |
---|---|
date | Tue, 03 Dec 2013 20:18:17 +0200 |
parents | b2a434d65344 |
children | 92511cd8fcdb |
line wrap: on
line diff
--- a/_deleted.cpp Mon Dec 02 15:13:49 2013 +0200 +++ b/_deleted.cpp Tue Dec 03 20:18:17 2013 +0200 @@ -13196,6 +13196,269 @@ return bUserDirect3D == 0; } + +//----- (004A46E6) -------------------------------------------------------- +int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int _z, int a4, unsigned int lightColor) +{ + int v5; // eax@1 + int z; // eax@1 + unsigned int v7; // eax@9 + unsigned int v8; // ecx@9 + int v9; // eax@9 + unsigned int v10; // eax@10 + int *v11; // esi@10 + int *v12; // edi@10 + int v13; // ecx@10 + int v14; // edx@10 + unsigned int v15; // eax@22 + int *v16; // esi@22 + int *v17; // edi@22 + int v18; // ecx@22 + int v19; // edx@22 + unsigned __int16 *pTarget; // [sp+Ch] [bp-8h]@9 + int *pTargetZ; // [sp+10h] [bp-4h]@9 + unsigned int v22; // [sp+1Ch] [bp+8h]@9 + signed int v23; // [sp+20h] [bp+Ch]@1 + + v5 = a4; + v23 = _z >> 16; + z = x + v5; + if ( z >= (signed int)pViewport->uViewportTL_X + && (signed int)x <= (signed int)pViewport->uViewportBR_X + && y >= (signed int)pViewport->uViewportTL_Y + && y <= (signed int)pViewport->uViewportBR_Y ) + { + if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) + x = pViewport->uViewportTL_X; + if ( z > (signed int)pViewport->uViewportBR_X ) + z = pViewport->uViewportBR_X; + pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; + v22 = z - x; + pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; + v7 = lightColor >> 3; + v8 = lightColor & 0xF0; + v9 = v7 & 0x1E0000; + if ( pRenderer->uTargetGBits == 5 ) + { + v10 = (v8 | (((unsigned __int16)(lightColor & 0xF000) | (unsigned int)v9) >> 3)) >> 4; + v11 = (int *)pTarget; + v12 = pTargetZ; + v13 = v22; + v14 = (v10 << 16) | v10; + z = (unsigned __int8)pTarget & 2; + if ( (unsigned __int8)pTarget & 2 ) + { + z = (unsigned int)*pTargetZ >> 16; + if ( z > v23 ) + { + z = v14 + ((*pTarget & 0x7BDEu) >> 1); + *pTarget = z; + } + v13 = v22 - 1; + v11 = (int *)(pTarget + 1); + v12 = pTargetZ + 1; + } + while ( v13 != 1 ) + { + if ( v13 < 1 ) + return z; + z = (unsigned int)*v12 >> 16; + if ( z <= v23 ) + { + v13 -= 2; + ++v11; + v12 += 2; + } + else + { + v12 += 2; + z = v14 + ((*v11 & 0x7BDE7BDEu) >> 1); + v13 -= 2; + *v11 = z; + ++v11; + } + } + z = (unsigned int)*v12 >> 16; + if ( z > v23 ) + { + z = v14 + ((*(short *)v11 & 0x7BDEu) >> 1); + *(short *)v11 = z; + } + } + else + { + v15 = (v8 | (((unsigned __int16)(lightColor & 0xF800) | (unsigned int)v9) >> 2)) >> 4; + v16 = (int *)pTarget; + v17 = pTargetZ; + v18 = v22; + v19 = (v15 << 16) | v15; + z = (unsigned __int8)pTarget & 2; + if ( (unsigned __int8)pTarget & 2 ) + { + z = (unsigned int)*pTargetZ >> 16; + if ( z > v23 ) + { + z = v19 + ((*pTarget & 0xF7DEu) >> 1); + *pTarget = z; + } + v18 = v22 - 1; + v16 = (int *)(pTarget + 1); + v17 = pTargetZ + 1; + } + while ( v18 != 1 ) + { + if ( v18 < 1 ) + return z; + z = (unsigned int)*v17 >> 16; + if ( z <= v23 ) + { + v18 -= 2; + ++v16; + v17 += 2; + } + else + { + v17 += 2; + z = v19 + ((*v16 & 0xF7DEF7DEu) >> 1); + v18 -= 2; + *v16 = z; + ++v16; + } + } + z = (unsigned int)*v17 >> 16; + if ( z > v23 ) + { + z = v19 + ((*(short *)v16 & 0xF7DEu) >> 1); + *(short *)v16 = z; + } + } + } + return z; +} + + +//----- (004A57E9) -------------------------------------------------------- +void Present_ColorKey() +{ + HRESULT v0; // eax@3 + HRESULT v1; // eax@3 + HRESULT v2; // eax@3 + HRESULT v3; // eax@3 + HRESULT v4; // eax@3 + RECT a2; // [sp+4h] [bp-14h]@3 + //CheckHRESULT_stru0 this; // [sp+14h] [bp-4h]@3 + + if ( !pRenderer->uNumSceneBegins ) + { + if ( pRenderer->using_software_screen_buffer ) + { + a2.bottom = pViewport->uViewportTL_Y; + a2.left = 0; + a2.top = 0; + a2.right = 640; + ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); + a2.right = 640; + a2.left = 0; + a2.top = pViewport->uViewportBR_Y + 1; + a2.bottom = 480; + ErrD3D(pRenderer->pBackBuffer4->BltFast( + 0, + pViewport->uViewportBR_Y + 1, + pRenderer->pColorKeySurface4, + &a2, + 16u)); + a2.right = pViewport->uViewportTL_X; + a2.bottom = pViewport->uViewportBR_Y + 1; + a2.left = 0; + a2.top = pViewport->uViewportTL_Y; + ErrD3D(pRenderer->pBackBuffer4->BltFast( + 0, + pViewport->uViewportTL_Y, + pRenderer->pColorKeySurface4, + &a2, + 16u)); + a2.left = pViewport->uViewportBR_X; + a2.top = pViewport->uViewportTL_Y; + a2.right = 640; + a2.bottom = pViewport->uViewportBR_Y + 1; + ErrD3D(pRenderer->pBackBuffer4->BltFast( + pViewport->uViewportBR_X, + pViewport->uViewportTL_Y, + pRenderer->pColorKeySurface4, + &a2, + 16u)); + a2.right = pViewport->uViewportBR_X; + a2.bottom = pViewport->uViewportBR_Y + 1; + a2.left = pViewport->uViewportTL_X; + a2.top = pViewport->uViewportTL_Y; + ErrD3D(pRenderer->pBackBuffer4->BltFast( + pViewport->uViewportTL_X, + pViewport->uViewportTL_Y, + pRenderer->pColorKeySurface4, + &a2, + 17u)); + } + } +} + + +//----- (004A48E4) -------------------------------------------------------- +int Render::MakeParticleBillboardAndPush_BLV_Software(int screenSpaceX, int screenSpaceY, int z, int lightColor, int a6) +{ + int v6; // ecx@1 + int v7; // ebx@1 + int v8; // ecx@1 + int v9; // edx@1 + int v10; // edi@1 + unsigned int x; // esi@1 + int result; // eax@8 + int v13; // [sp+Ch] [bp-10h]@1 + int v14; // [sp+10h] [bp-Ch]@1 + int v15; // [sp+14h] [bp-8h]@1 + int v16; // [sp+18h] [bp-4h]@1 + int v17; // [sp+24h] [bp+8h]@1 + unsigned int v18; // [sp+28h] [bp+Ch]@1 + int v19; // [sp+34h] [bp+18h]@1 + + v6 = screenSpaceX; + v7 = (a6 >> 1) + screenSpaceY; + v17 = 0; + v15 = 0; + v8 = (a6 >> 1) + v6; + v14 = (a6 >> 1) * (a6 >> 1); + v9 = 2 * (a6 >> 1); + v10 = (a6 >> 1) * ((a6 >> 1) - 1); + x = v8 - (a6 >> 1); + v16 = (a6 >> 1) + screenSpaceY - v8; + v19 = a6 >> 1; + v13 = v9; + v18 = v8; + do + { + sr_4A46E6_draw_particle_segment(x, v16 + v18, z, 2 * v19, lightColor); + if ( v15 ) + sr_4A46E6_draw_particle_segment(x, v17 + v7, z, 2 * v19, lightColor); + v14 -= v15; + if ( v14 <= v10 ) + { + if ( v19 != v17 ) + { + sr_4A46E6_draw_particle_segment(v18, v16 + x, z, 2 * v17, lightColor); + sr_4A46E6_draw_particle_segment(v18, v19 + v7, z, 2 * v17, lightColor); + } + --v19; + v13 -= 2; + ++x; + v10 -= v13; + } + result = v17++; + v15 += 2; + --v18; + } + while ( result < v19 ); + return result; +} + //----- (004637EB) -------------------------------------------------------- int __stdcall aWinProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -14045,4 +14308,104 @@ return v19; } + +//----- (0049EBF1) -------------------------------------------------------- +void Render::_stub_49EBF1() +{ + signed int uNumRedBits; // edx@1 + signed int uNuGreenBits; // edi@1 + signed int uNumBlueBits; // esi@1 + unsigned int v4; // edx@4 + unsigned int v5; // edi@4 + int v6; // ebx@4 + int v7; // edx@4 + signed int v8; // [sp+8h] [bp-24h]@1 + signed int v9; // [sp+Ch] [bp-20h]@1 + signed int v10; // [sp+20h] [bp-Ch]@1 + signed int i; // [sp+24h] [bp-8h]@2 + signed int v12; // [sp+28h] [bp-4h]@3 + + v10 = 0; + uNumRedBits = 1 << this->uTargetRBits; + uNuGreenBits = 1 << this->uTargetGBits; + uNumBlueBits = 1 << this->uTargetBBits; + v9 = 1 << this->uTargetRBits; + v8 = 1 << this->uTargetGBits; + if ( uNumRedBits > 0 ) + { + do + { + for ( i = 0; i < uNuGreenBits; ++i ) + { + v12 = 0; + if ( uNumBlueBits > 0 ) + { + do + { + v4 = this->uTargetBBits; + v5 = v4 + this->uTargetGBits; + v6 = (v12 >> 1) + (v10 >> 1 << v5) + (i >> 1 << this->uTargetBBits); + v7 = (v10 << v5) + v12++ + (i << v4); + this->unused_2C[v7] = v6; + } + while ( v12 < uNumBlueBits ); + uNumRedBits = v9; + uNuGreenBits = v8; + } + } + ++v10; + } + while ( v10 < uNumRedBits ); + } +} + + +//----- (004B0967) -------------------------------------------------------- +void BspRenderer::DrawFaceOutlines() +{ + signed int i; // edi@1 + int v1; // esi@2 + unsigned int v2; // ecx@4 + int v3; // eax@4 + int v4; // eax@6 + unsigned __int16 *v5; // edx@6 + int v6; // ecx@7 + int v7; // esi@8 + + for ( i = 0; i < (signed int)pBspRenderer->num_faces; ++i ) + { + v1 = pBspRenderer->faces[i].uFaceID; + if ( v1 >= 0 ) + { + if ( v1 < (signed int)pIndoor->uNumFaces ) + { + v2 = pBspRenderer->faces[i].uFaceID; + pBLVRenderParams->field_7C = &pBspRenderer->nodes[pBspRenderer->faces[i].uNodeID].PortalScreenData; + v3 = GetPortalScreenCoord(v2); + if ( v3 ) + { + if ( PortalFrustrum(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) + { + v4 = stru_F8A590._viewport_space_y; + v5 = pBLVRenderParams->pRenderTarget; + if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) + { + v6 = 640 * stru_F8A590._viewport_space_y; + do + { + v5[v6 + stru_F8A590.viewport_left_side[v4]] = -1; + v7 = v6 + stru_F8A590.viewport_right_side[v4]; + v6 += 640; + v5[v7] = -1; + ++v4; + } + while ( v4 <= stru_F8A590._viewport_space_w ); + } + } + } + } + } + } +} + */ \ No newline at end of file