comparison Render.cpp @ 75:6ef241d53522

28.01.13
author Ritor1
date Mon, 28 Jan 2013 14:52:05 +0600
parents 3b4f8bd48e3b
children 7ad8eaa172c5
comparison
equal deleted inserted replaced
67:3b4f8bd48e3b 75:6ef241d53522
7129 7129
7130 //----- (004A26BC) -------------------------------------------------------- 7130 //----- (004A26BC) --------------------------------------------------------
7131 void Render::DrawTerrainPolygon(unsigned int uNumVertices, stru148 *a4, IDirect3DTexture2 *a5, int a6, int a7) 7131 void Render::DrawTerrainPolygon(unsigned int uNumVertices, stru148 *a4, IDirect3DTexture2 *a5, int a6, int a7)
7132 { 7132 {
7133 RenderVertexSoft *pVertices; // esi@0 7133 RenderVertexSoft *pVertices; // esi@0
7134 Render *v7; // edi@1 7134 int v7; // edi@1
7135 unsigned int v8; // ebx@1 7135 unsigned int v8; // ebx@1
7136 LightmapBuilder *v9; // esi@3 7136 LightmapBuilder *v9; // esi@3
7137 unsigned int v10; // edx@3 7137 unsigned int v10; // edx@3
7138 int v11; // eax@5 7138 int v11; // eax@5
7139 int v12; // eax@11 7139 int v12; // eax@11
7191 int v64; // [sp+84h] [bp-8h]@0 7191 int v64; // [sp+84h] [bp-8h]@0
7192 LightmapBuilder *v65; // [sp+88h] [bp-4h]@3 7192 LightmapBuilder *v65; // [sp+88h] [bp-4h]@3
7193 unsigned int v66; // [sp+88h] [bp-4h]@40 7193 unsigned int v66; // [sp+88h] [bp-4h]@40
7194 unsigned int a6a; // [sp+A0h] [bp+14h]@11 7194 unsigned int a6a; // [sp+A0h] [bp+14h]@11
7195 7195
7196 v7 = this; 7196 v7 = (int)this;
7197 v8 = 0; 7197 v8 = 0;
7198 if ( this->uNumD3DSceneBegins && (signed int)uNumVertices >= 3 ) 7198 if ( !this->uNumD3DSceneBegins )
7199 { 7199 return;
7200 v61 = pVertices; 7200 if ( uNumVertices < 3)
7201 v9 = pGame->pLightmapBuilder; 7201 return;
7202
7203 v61 = pVertices;
7204 /* v9 = pGame->pLightmapBuilder;
7202 v65 = v9; 7205 v65 = v9;
7203 v10 = v9->std__vector_000004_size; 7206 v10 = v9->std__vector_000004_size;*/
7204 if ( byte_4D864C && pGame->uFlags & 1 ) 7207 if ( byte_4D864C && pGame->uFlags & 1 )
7205 { 7208 {
7206 v11 = GetActorTintColor(a4->field_58, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0); 7209 v11 = GetActorTintColor(a4->field_58, 0, array_50AC10[0].vWorldViewPosition.x, 0, 0);
7207 v9->_45D74F_MessWithLight(v11, 0); 7210 pGame->pLightmapBuilder->_45D74F_MessWithLight(v11, 0);
7208 } 7211 }
7209 else 7212 else
7210 { 7213 {
7211 if ( a6 || !v10 || byte_4D864C && pGame->uFlags & 2 ) 7214 if ( a6 || !pGame->pLightmapBuilder->std__vector_000004_size ||
7212 { 7215 byte_4D864C && pGame->uFlags & 2 )
7213 if ( (char)a7 ) 7216 {
7217 if ( (_BYTE)a7 )
7214 v60 = 3; 7218 v60 = 3;
7215 else 7219 else
7216 v60 = 1; 7220 v60 = 1;
7217 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, v60)); 7221 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, v60);
7218 if ( a6 || v7->bUsingSpecular ) 7222 if ( a6 || this->bUsingSpecular )
7219 { 7223 {
7220 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1u)); 7224 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, 1);
7221 //v49 = v7->pRenderD3D->pDevice; 7225 v49 = this->pRenderD3D->pDevice;
7222 //v50 = v49->lpVtbl; 7226 //v50 = v49->lpVtbl;
7223 if ( a6 ) 7227 if ( a6 )
7224 { 7228 {
7225 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 5)); 7229 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 5);
7226 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 6)); 7230 //this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 6);
7227 } 7231 }
7228 else 7232 else
7229 { 7233 {
7230 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2)); 7234 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 2);
7231 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1)); 7235 //this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 1);
7236 __debugbreak;//it's error
7232 } 7237 }
7233 7238
7234 } 7239 }
7235 if ( (signed int)uNumVertices > 0 ) 7240 if ( (signed int)uNumVertices > 0 )
7236 { 7241 {
7248 *(float *)(v51 + 8) = 1.0 / (*(float *)v52 + 0.0000001); 7253 *(float *)(v51 + 8) = 1.0 / (*(float *)v52 + 0.0000001);
7249 v55 = GetActorTintColor(a4->field_58, 0, *(float *)v52, 0, 0); 7254 v55 = GetActorTintColor(a4->field_58, 0, *(float *)v52, 0, 0);
7250 v56 = a7; 7255 v56 = a7;
7251 v57 = *(float *)v52; 7256 v57 = *(float *)v52;
7252 *(int *)(a7 + 12) = v55; 7257 *(int *)(a7 + 12) = v55;
7253 if ( v7->bUsingSpecular ) 7258 if ( this->bUsingSpecular )
7254 { 7259 {
7255 v58 = v57; 7260 v58 = v57;
7256 v59 = sub_47C3D7_get_fog_related_stuff(0, 0, v58); 7261 v59 = sub_47C3D7_get_fog_related_stuff(0, 0, v58);
7257 v56 = a7; 7262 v56 = a7;
7258 } 7263 }
7303 *(float *)(v12 + 8) = 1.0 / (*(float *)v13 + 0.0000001); 7308 *(float *)(v12 + 8) = 1.0 / (*(float *)v13 + 0.0000001);
7304 v16 = GetActorTintColor(a4->field_58, 0, *(float *)v13, 0, 0); 7309 v16 = GetActorTintColor(a4->field_58, 0, *(float *)v13, 0, 0);
7305 v17 = a7; 7310 v17 = a7;
7306 v18 = *(float *)v13; 7311 v18 = *(float *)v13;
7307 *(int *)(a7 + 12) = v16; 7312 *(int *)(a7 + 12) = v16;
7308 if ( v7->bUsingSpecular ) 7313 if ( this->bUsingSpecular )
7309 { 7314 {
7310 v19 = v18; 7315 v19 = v18;
7311 v20 = sub_47C3D7_get_fog_related_stuff(0, 0, v19); 7316 v20 = sub_47C3D7_get_fog_related_stuff(0, 0, v19);
7312 v17 = a7; 7317 v17 = a7;
7313 } 7318 }
7385 --v37; 7390 --v37;
7386 *((int *)v38 - 9) = pRenderer->uFogColor | v39 & 0xFF000000; 7391 *((int *)v38 - 9) = pRenderer->uFogColor | v39 & 0xFF000000;
7387 } 7392 }
7388 while ( v37 ); 7393 while ( v37 );
7389 } 7394 }
7390 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0)); 7395 ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0));//problem
7391 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 6u)); 7396 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, 6u));
7392 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 5u)); 7397 ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, 5u));
7393 ErrD3D(pRenderD3D->pDevice->DrawPrimitive( 7398 ErrD3D(pRenderD3D->pDevice->DrawPrimitive(
7394 D3DPT_TRIANGLEFAN, 7399 D3DPT_TRIANGLEFAN,
7395 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, 7400 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
7409 } 7414 }
7410 } 7415 }
7411 if ( pIndoorCamera->field_4C & 2 || pBLVRenderParams->uFlags & 2 ) 7416 if ( pIndoorCamera->field_4C & 2 || pBLVRenderParams->uFlags & 2 )
7412 pGame->pIndoorCameraD3D->debug_outline_d3d(arary_77E5C8, uNumVertices, 0xFFFFFFu, 0.0); 7417 pGame->pIndoorCameraD3D->debug_outline_d3d(arary_77E5C8, uNumVertices, 0xFFFFFFu, 0.0);
7413 } 7418 }
7414 } 7419
7415 // 4A26BC: could not find valid save-restore pair for esi 7420 // 4A26BC: could not find valid save-restore pair for esi
7416 // 4D864C: using guessed type char byte_4D864C; 7421 // 4D864C: using guessed type char byte_4D864C;
7417 7422
7418 //----- (004A2DA3) -------------------------------------------------------- 7423 //----- (004A2DA3) --------------------------------------------------------
7419 void Render::DrawStrip(unsigned int uNumVertices, struct stru148 *a3, IDirect3DTexture2 *pTexture) 7424 void Render::DrawStrip(unsigned int uNumVertices, struct stru148 *a3, IDirect3DTexture2 *pTexture)