comparison Render.cpp @ 872:2db21a810d48

Merge
author Nomad
date Mon, 01 Apr 2013 13:39:39 +0200
parents 710cf848ad24 f4394e320312
children 10fa7dad1391
comparison
equal deleted inserted replaced
871:710cf848ad24 872:2db21a810d48
21 #include "Actor.h" 21 #include "Actor.h"
22 #include "Log.h" 22 #include "Log.h"
23 #include "TileFrameTable.h" 23 #include "TileFrameTable.h"
24 #include "texts.h" 24 #include "texts.h"
25 #include "mm7_data.h" 25 #include "mm7_data.h"
26 #include "MM7.h"
26 27
27 #pragma comment(lib, "lib\\legacy_dx\\lib\\ddraw.lib") 28 #pragma comment(lib, "lib\\legacy_dx\\lib\\ddraw.lib")
28 #pragma comment(lib, "lib\\legacy_dx\\lib\\dxguid.lib") 29 #pragma comment(lib, "lib\\legacy_dx\\lib\\dxguid.lib")
29 30
30 struct IDirectDrawClipper *pDDrawClipper; 31 struct IDirectDrawClipper *pDDrawClipper;
3180 v3->uScreenSpaceX = v35; 3181 v3->uScreenSpaceX = v35;
3181 v3->uScreenSpaceY = v32; 3182 v3->uScreenSpaceY = v32;
3182 HIWORD(v26) = HIWORD(v42); 3183 HIWORD(v26) = HIWORD(v42);
3183 LOWORD(v26) = 0; 3184 LOWORD(v26) = 0;
3184 v27 = (object->uAttributes & 0x20) == 0; 3185 v27 = (object->uAttributes & 0x20) == 0;
3185 v3->sZValue = v26 + (8 * i | OBJECT_Item); 3186 v3->sZValue = v26 + (PID(OBJECT_Item,i));
3186 v3->dimming_level = 0; 3187 v3->dimming_level = 0;
3187 v3->uTintColor = 0; 3188 v3->uTintColor = 0;
3188 if ( !v27 ) 3189 if ( !v27 )
3189 { 3190 {
3190 if ( !pRenderer->pRenderD3D ) 3191 if ( !pRenderer->pRenderD3D )
3680 v27->world_x = decor->vPosition.x; 3681 v27->world_x = decor->vPosition.x;
3681 v27->world_y = decor->vPosition.y; 3682 v27->world_y = decor->vPosition.y;
3682 v27->world_z = decor->vPosition.z; 3683 v27->world_z = decor->vPosition.z;
3683 v27->uScreenSpaceY = v40; 3684 v27->uScreenSpaceY = v40;
3684 HIWORD(v30) = HIWORD(v39); 3685 HIWORD(v30) = HIWORD(v39);
3685 v31 = 8 * i | OBJECT_Decoration; 3686 v31 = PID(OBJECT_Decoration,i);
3686 LOWORD(v30) = 0; 3687 LOWORD(v30) = 0;
3687 v27->uIndoorSectorID = 0; 3688 v27->uIndoorSectorID = 0;
3688 v27->sZValue = v30 + v31; 3689 v27->sZValue = v30 + v31;
3689 v27->dimming_level = 0; 3690 v27->dimming_level = 0;
3690 v27->pSpriteFrame = v8; 3691 v27->pSpriteFrame = v8;
7597 } 7598 }
7598 // 4A26BC: could not find valid save-restore pair for esi 7599 // 4A26BC: could not find valid save-restore pair for esi
7599 // 4D864C: using guessed type char byte_4D864C; 7600 // 4D864C: using guessed type char byte_4D864C;
7600 7601
7601 //----- (004A2DA3) -------------------------------------------------------- 7602 //----- (004A2DA3) --------------------------------------------------------
7602 void Render::DrawStrip(unsigned int uNumVertices, struct stru148 *a3, IDirect3DTexture2 *pTexture) 7603 void Render::DrawSkyPolygon(unsigned int uNumVertices, stru148 *a3, IDirect3DTexture2 *pTexture)
7603 { 7604 {
7604 int v4; // ebx@1
7605 int v7; // eax@7
7606 float v12; // ST3C_4@8
7607 int i;
7608
7609 v4 = (int)this;
7610 if (!this->uNumD3DSceneBegins)
7611 return;
7612
7613 if (uNumVertices >= 3)
7614 {
7615 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP);
7616 if (this->bUsingSpecular)
7617 {
7618 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE);
7619 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE);
7620 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO);
7621 }
7622
7623 for (i = 0; i < uNumVertices; ++i)
7624 {
7625 pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX;
7626 pVertices[i].pos.y = array_50AC10[i].vWorldViewProjY;
7627 pVertices[i].pos.z = 0.99989998;
7628 pVertices[i].rhw = array_50AC10[i]._rhw;
7629
7630 pVertices[i].diffuse = ::GetActorTintColor(31, 0, array_50AC10[i].vWorldViewPosition.x, true, false);
7631 v7 = 0;
7632 if (this->bUsingSpecular)
7633 {
7634 v12 = array_50AC10[i].vWorldViewPosition.x;
7635 v7 = sub_47C3D7_get_fog_related_stuff(0, 1, v12);
7636 }
7637 pVertices[i].specular = v7;
7638 pVertices[i].texcoord.x = array_50AC10[i].u;
7639 pVertices[i].texcoord.y = array_50AC10[i].v;
7640 }
7641 pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture);
7642 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT);
7643 }
7644 }
7645
7646 //----- (004A2DA3) --------------------------------------------------------
7647 void Render::DrawFan(unsigned int uNumVertices, stru148 *a3, IDirect3DTexture2 *pTexture)
7648 {
7649 int v4; // ebx@1
7650 int v7; // eax@7 7605 int v7; // eax@7
7651 float v13; // ST3C_4@8 7606 float v13; // ST3C_4@8
7652 int i; 7607 int i;
7653 7608
7654 v4 = (int)this;
7655 if ( !this->uNumD3DSceneBegins ) 7609 if ( !this->uNumD3DSceneBegins )
7656 return; 7610 return;
7657 if ( uNumVertices >= 3 ) 7611 if ( uNumVertices >= 3 )
7658 { 7612 {
7659 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP); 7613 this->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP);
7661 { 7615 {
7662 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); 7616 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE);
7663 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); 7617 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE);
7664 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO); 7618 this->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO);
7665 } 7619 }
7666 for (i = 0; i < uNumVertices; ++i) 7620 for ( i = 0; i < uNumVertices; ++i )
7667 { 7621 {
7668 pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX; 7622 pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX;
7669 pVertices[i].pos.y = array_50AC10[i].vWorldViewProjY; 7623 pVertices[i].pos.y = array_50AC10[i].vWorldViewProjY;
7670 pVertices[i].pos.z = 0.99989998; 7624 pVertices[i].pos.z = 0.99989998;
7671 pVertices[i].rhw = array_50AC10[i]._rhw; 7625 pVertices[i].rhw = array_50AC10[i]._rhw;
7672 7626
7673 pVertices[i].diffuse = GetActorTintColor(31, 0, array_50AC10[i].vWorldViewPosition.x, 1, 0); 7627 pVertices[i].diffuse = ::GetActorTintColor(31, 0, array_50AC10[i].vWorldViewPosition.x, 1, 0);
7674 v7 = 0; 7628 v7 = 0;
7675 if (this->bUsingSpecular) 7629 if (this->bUsingSpecular)
7676 { 7630 {
7677 v13 = array_50AC10[i].vWorldViewPosition.x; 7631 v13 = array_50AC10[i].vWorldViewPosition.x;
7678 v7 = sub_47C3D7_get_fog_related_stuff(0, 1, v13); 7632 v7 = sub_47C3D7_get_fog_related_stuff(0, 1, v13);
7681 pVertices[i].texcoord.x = array_50AC10[i].u; 7635 pVertices[i].texcoord.x = array_50AC10[i].u;
7682 pVertices[i].texcoord.y = array_50AC10[i].v; 7636 pVertices[i].texcoord.y = array_50AC10[i].v;
7683 } 7637 }
7684 pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture); 7638 pRenderer->pRenderD3D->pDevice->SetTexture(0, pTexture);
7685 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, 7639 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
7686 pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); 7640 pVertices, uNumVertices, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT);
7687 } 7641 }
7688 } 7642 }
7689 7643
7690 //----- (004A2ED5) -------------------------------------------------------- 7644 //----- (004A2ED5) --------------------------------------------------------
7691 void Render::_4A2ED5(signed int a2, stru148 *a3, IDirect3DTexture2 *pHwTex) 7645 void Render::_4A2ED5(signed int a2, stru148 *a3, IDirect3DTexture2 *pHwTex)