Mercurial > mm7
comparison Render.cpp @ 1072:48168499f52e
pointer cleaning
author | zipi |
---|---|
date | Sat, 25 May 2013 11:24:10 +0100 |
parents | 39f42990698f |
children | d4a1a46192ba |
comparison
equal
deleted
inserted
replaced
1071:a7e63532b9a8 | 1072:48168499f52e |
---|---|
7657 void Render::_4A2ED5(signed int a2, stru148 *a3, IDirect3DTexture2 *pHwTex) | 7657 void Render::_4A2ED5(signed int a2, stru148 *a3, IDirect3DTexture2 *pHwTex) |
7658 { | 7658 { |
7659 signed int v4; // edi@2 | 7659 signed int v4; // edi@2 |
7660 int v5; // eax@3 | 7660 int v5; // eax@3 |
7661 int v6; // edx@5 | 7661 int v6; // edx@5 |
7662 char *v7; // eax@6 | 7662 RenderVertexD3D3 *v7; // eax@6 |
7663 char *v8; // ecx@6 | 7663 RenderVertexSoft *v8; // ecx@6 |
7664 double v9; // st6@7 | 7664 //double v9; // st6@7 |
7665 int v10; // ebx@7 | 7665 //int v10; // ebx@7 |
7666 int v11; // ebx@7 | 7666 //int v11; // ebx@7 |
7667 | 7667 |
7668 if ( this->uNumD3DSceneBegins ) | 7668 if ( this->uNumD3DSceneBegins ) |
7669 { | 7669 { |
7670 v4 = a2; | 7670 v4 = a2; |
7671 if ( a2 >= 3 ) | 7671 if ( a2 >= 3 ) |
7673 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | 7673 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
7674 v5 = 31 - (a3->dimming_level & 0x1F); | 7674 v5 = 31 - (a3->dimming_level & 0x1F); |
7675 if ( v5 < pOutdoor->max_terrain_dimming_level ) | 7675 if ( v5 < pOutdoor->max_terrain_dimming_level ) |
7676 v5 = pOutdoor->max_terrain_dimming_level; | 7676 v5 = pOutdoor->max_terrain_dimming_level; |
7677 v6 = 8 * v5 | ((8 * v5 | (v5 << 11)) << 8); | 7677 v6 = 8 * v5 | ((8 * v5 | (v5 << 11)) << 8); |
7678 if ( a2 > 0 ) | 7678 for (uint i = 0; i < a2; ++i) |
7679 { | 7679 { |
7680 v7 = (char *)&d3d_vertex_buffer[0].pos.y; | 7680 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; |
7681 v8 = (char *)&array_507D30[0].vWorldViewProjY; | 7681 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; |
7682 do | 7682 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / array_507D30[i].vWorldViewPosition.y; |
7683 { | 7683 d3d_vertex_buffer[i].rhw = array_507D30[i]._rhw; |
7684 v9 = *((float *)v8 - 4) * 0.061758894; | 7684 d3d_vertex_buffer[i].diffuse = v6; |
7685 v10 = *((int *)v8 - 1); | 7685 d3d_vertex_buffer[i].specular = 0; |
7686 *((int *)v7 + 4) = 0; | 7686 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u; |
7687 *((int *)v7 - 1) = v10; | 7687 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v; |
7688 *(int *)v7 = *(int *)v8; | 7688 } |
7689 *((int *)v7 + 2) = *((int *)v8 + 1); | 7689 |
7690 *((int *)v7 + 5) = *((int *)v8 + 2); | |
7691 v11 = *((int *)v8 + 3); | |
7692 *((int *)v7 + 3) = v6; | |
7693 *((int *)v7 + 6) = v11; | |
7694 v8 += 48; | |
7695 v7 += 32; | |
7696 --v4; | |
7697 *((float *)v7 - 7) = 1.0 - 1.0 / v9; | |
7698 } | |
7699 while ( v4 ); | |
7700 } | |
7701 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); | 7690 ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex)); |
7702 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | 7691 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
7703 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 7692 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |
7704 d3d_vertex_buffer, | 7693 d3d_vertex_buffer, |
7705 a2, | 7694 a2, |
7711 //----- (004A2FC0) -------------------------------------------------------- | 7700 //----- (004A2FC0) -------------------------------------------------------- |
7712 void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8) | 7701 void Render::DrawIndoorPolygon(unsigned int uNumVertices, BLVFace *pFace, IDirect3DTexture2 *pHwTex, Texture *pTex, int uPackedID, unsigned int uColor, int a8) |
7713 { | 7702 { |
7714 //Render *v8; // edi@1 | 7703 //Render *v8; // edi@1 |
7715 //unsigned int v9; // esi@3 | 7704 //unsigned int v9; // esi@3 |
7716 char *v12; // ecx@9 | 7705 RenderVertexSoft *v12; // ecx@9 |
7717 char *v13; // eax@9 | 7706 RenderVertexD3D3 *v13; // eax@9 |
7718 double v14; // st6@10 | 7707 double v14; // st6@10 |
7719 int v15; // edx@10 | 7708 int v15; // edx@10 |
7720 Texture *v16; // edx@10 | 7709 Texture *v16; // edx@10 |
7721 double v17; // st6@10 | 7710 double v17; // st6@10 |
7722 //char v18; // zf@10 | 7711 //char v18; // zf@10 |
7770 if (byte_4D864C && pGame->uFlags & 1) | 7759 if (byte_4D864C && pGame->uFlags & 1) |
7771 { | 7760 { |
7772 __debugbreak(); | 7761 __debugbreak(); |
7773 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); | 7762 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false)); |
7774 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | 7763 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
7775 if ( (signed int)uNumVertices > 0 ) | 7764 for (uint i = 0; i < uNumVertices; ++i) |
7776 { | 7765 { |
7777 v12 = (char *)&array_507D30[0].vWorldViewPosition; | 7766 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; |
7778 v13 = (char *)&d3d_vertex_buffer[0].pos.y; | 7767 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; |
7779 auto a7 = uNumVertices; | 7768 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894); |
7780 uint v18; | 7769 d3d_vertex_buffer[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x; |
7781 do | 7770 d3d_vertex_buffer[i].diffuse = uCorrectedColor; |
7782 { | 7771 d3d_vertex_buffer[i].specular = 0; |
7783 v14 = *(float *)v12 * 0.061758894; | 7772 d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth; |
7784 v15 = *((int *)v12 + 3); | 7773 d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight; |
7785 *((int *)v13 + 4) = 0; | 7774 } |
7786 *((int *)v13 - 1) = v15; | 7775 |
7787 *(int *)v13 = *((int *)v12 + 4); | |
7788 *((int *)v13 + 3) = uCorrectedColor; | |
7789 v16 = pTex; | |
7790 v13 += 32; | |
7791 *((float *)v13 - 7) = 1.0 - 1.0 / v14; | |
7792 v17 = 1.0 / *(float *)v12; | |
7793 v12 += 48; | |
7794 v18 = a7-- == 1; | |
7795 *((float *)v13 - 6) = v17; | |
7796 pHwTex = (IDirect3DTexture2 *)v16->uTextureWidth; | |
7797 v19 = pTex; | |
7798 *((float *)v13 - 3) = *((float *)v12 - 6) / (double)(signed int)pHwTex; | |
7799 pHwTex = (IDirect3DTexture2 *)v19->uTextureHeight; | |
7800 *((float *)v13 - 2) = *((float *)v12 - 5) / (double)(signed int)pHwTex; | |
7801 } | |
7802 while ( !v18 ); | |
7803 } | |
7804 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); | 7776 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); |
7805 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); | 7777 ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr)); |
7806 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( | 7778 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( |
7807 D3DPT_TRIANGLEFAN, | 7779 D3DPT_TRIANGLEFAN, |
7808 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | 7780 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, |