| Index: ddraw/glDirect3DDevice.cpp |
| — | — | @@ -215,7 +215,9 @@ |
| 216 | 216 | materials = (glDirect3DMaterial3**)malloc(32*sizeof(glDirect3DMaterial3*));
|
| 217 | 217 | materialcount = 1;
|
| 218 | 218 | materials[0] = NULL;
|
| | 219 | + currentmaterial = NULL;
|
| 219 | 220 | maxviewports = 32;
|
| | 221 | + currentviewport = NULL;
|
| 220 | 222 | viewportcount = 0;
|
| 221 | 223 | viewports = (glDirect3DViewport3**)malloc(32*sizeof(glDirect3DViewport3*));
|
| 222 | 224 | ZeroMemory(viewports,32*sizeof(glDirect3DViewport3*));
|
| — | — | @@ -283,7 +285,7 @@ |
| 284 | 286 |
|
| 285 | 287 | HRESULT WINAPI glDirect3DDevice7::QueryInterface(REFIID riid, void** ppvObj)
|
| 286 | 288 | {
|
| 287 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 289 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 288 | 290 | if(!ppvObj) return DDERR_INVALIDPARAMS;
|
| 289 | 291 | if(riid == IID_IUnknown)
|
| 290 | 292 | {
|
| — | — | @@ -324,13 +326,13 @@ |
| 325 | 327 |
|
| 326 | 328 | HRESULT WINAPI glDirect3DDevice7::ApplyStateBlock(DWORD dwBlockHandle)
|
| 327 | 329 | {
|
| 328 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 330 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 329 | 331 | FIXME("glDirect3DDevice7::ApplyStateBlock: stub");
|
| 330 | 332 | ERR(DDERR_GENERIC);
|
| 331 | 333 | }
|
| 332 | 334 | HRESULT WINAPI glDirect3DDevice7::BeginScene()
|
| 333 | 335 | {
|
| 334 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 336 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 335 | 337 | if(inscene) return D3DERR_SCENE_IN_SCENE;
|
| 336 | 338 | inscene = true;
|
| 337 | 339 | return D3D_OK;
|
| — | — | @@ -337,25 +339,25 @@ |
| 338 | 340 | }
|
| 339 | 341 | HRESULT WINAPI glDirect3DDevice7::BeginStateBlock()
|
| 340 | 342 | {
|
| 341 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 343 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 342 | 344 | FIXME("glDirect3DDevice7::BeginStateBlock: stub");
|
| 343 | 345 | ERR(DDERR_GENERIC);
|
| 344 | 346 | }
|
| 345 | 347 | HRESULT WINAPI glDirect3DDevice7::CaptureStateBlock(DWORD dwBlockHandle)
|
| 346 | 348 | {
|
| 347 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 349 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 348 | 350 | FIXME("glDirect3DDevice7::CaptureStateBlock: stub");
|
| 349 | 351 | ERR(DDERR_GENERIC);
|
| 350 | 352 | }
|
| 351 | 353 | HRESULT WINAPI glDirect3DDevice7::CreateStateBlock(D3DSTATEBLOCKTYPE d3dsbtype, LPDWORD lpdwBlockHandle)
|
| 352 | 354 | {
|
| 353 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 355 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 354 | 356 | FIXME("glDirect3DDevice7::CreateStateBlock: stub");
|
| 355 | 357 | ERR(DDERR_GENERIC);
|
| 356 | 358 | }
|
| 357 | 359 | HRESULT WINAPI glDirect3DDevice7::Clear(DWORD dwCount, LPD3DRECT lpRects, DWORD dwFlags, DWORD dwColor, D3DVALUE dvZ, DWORD dwStencil)
|
| 358 | 360 | {
|
| 359 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 361 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 360 | 362 | if(dwCount && !lpRects) return DDERR_INVALIDPARAMS;
|
| 361 | 363 | return renderer->Clear(glDDS7,dwCount,lpRects,dwFlags,dwColor,dvZ,dwStencil);
|
| 362 | 364 | }
|
| — | — | @@ -362,13 +364,13 @@ |
| 363 | 365 | HRESULT WINAPI glDirect3DDevice7::ComputeSphereVisibility(LPD3DVECTOR lpCenters, LPD3DVALUE lpRadii, DWORD dwNumSpheres,
|
| 364 | 366 | DWORD dwFlags, LPDWORD lpdwReturnValues)
|
| 365 | 367 | {
|
| 366 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 368 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 367 | 369 | FIXME("glDirect3DDevice7::ComputeSphereVisibility: stub");
|
| 368 | 370 | ERR(DDERR_GENERIC);
|
| 369 | 371 | }
|
| 370 | 372 | HRESULT WINAPI glDirect3DDevice7::DeleteStateBlock(DWORD dwBlockHandle)
|
| 371 | 373 | {
|
| 372 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 374 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 373 | 375 | FIXME("glDirect3DDevice7::DeleteStateBlock: stub");
|
| 374 | 376 | ERR(DDERR_GENERIC);
|
| 375 | 377 | }
|
| — | — | @@ -551,7 +553,7 @@ |
| 552 | 554 | HRESULT WINAPI glDirect3DDevice7::DrawIndexedPrimitive(D3DPRIMITIVETYPE d3dptPrimitiveType, DWORD dwVertexTypeDesc,
|
| 553 | 555 | LPVOID lpvVertices, DWORD dwVertexCount, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags)
|
| 554 | 556 | {
|
| 555 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 557 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 556 | 558 | if(!inscene) return D3DERR_SCENE_NOT_IN_SCENE;
|
| 557 | 559 | HRESULT err = fvftoglvertex(dwVertexTypeDesc,(LPDWORD)lpvVertices);
|
| 558 | 560 | if(err != D3D_OK) return err;
|
| — | — | @@ -561,7 +563,7 @@ |
| 562 | 564 | HRESULT WINAPI glDirect3DDevice7::DrawIndexedPrimitiveStrided(D3DPRIMITIVETYPE d3dptPrimitiveType, DWORD dwVertexTypeDesc,
|
| 563 | 565 | LPD3DDRAWPRIMITIVESTRIDEDDATA lpvVerticexArray, DWORD dwVertexCount, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags)
|
| 564 | 566 | {
|
| 565 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 567 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 566 | 568 | FIXME("glDirect3DDevice7::DrawIndexedPrimitiveStrided: stub");
|
| 567 | 569 | ERR(DDERR_GENERIC);
|
| 568 | 570 | }
|
| — | — | @@ -568,7 +570,7 @@ |
| 569 | 571 | HRESULT WINAPI glDirect3DDevice7::DrawIndexedPrimitiveVB(D3DPRIMITIVETYPE d3dptPrimitiveType, LPDIRECT3DVERTEXBUFFER7 lpd3dVertexBuffer,
|
| 570 | 572 | DWORD dwStartVertex, DWORD dwNumVertices, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags)
|
| 571 | 573 | {
|
| 572 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 574 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 573 | 575 | FIXME("glDirect3DDevice7::DrawIndexedPrimitiveVB: stub");
|
| 574 | 576 | ERR(DDERR_GENERIC);
|
| 575 | 577 | }
|
| — | — | @@ -575,13 +577,13 @@ |
| 576 | 578 | HRESULT WINAPI glDirect3DDevice7::DrawPrimitive(D3DPRIMITIVETYPE dptPrimitiveType, DWORD dwVertexTypeDesc, LPVOID lpVertices,
|
| 577 | 579 | DWORD dwVertexCount, DWORD dwFlags)
|
| 578 | 580 | {
|
| 579 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 581 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 580 | 582 | return DrawIndexedPrimitive(dptPrimitiveType,dwVertexTypeDesc,lpVertices,dwVertexCount,NULL,0,dwFlags);
|
| 581 | 583 | }
|
| 582 | 584 | HRESULT WINAPI glDirect3DDevice7::DrawPrimitiveStrided(D3DPRIMITIVETYPE dptPrimitiveType, DWORD dwVertexTypeDesc,
|
| 583 | 585 | LPD3DDRAWPRIMITIVESTRIDEDDATA lpVertexArray, DWORD dwVertexCount, DWORD dwFlags)
|
| 584 | 586 | {
|
| 585 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 587 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 586 | 588 | FIXME("glDirect3DDevice7::DrawPrimitiveStrided: stub");
|
| 587 | 589 | ERR(DDERR_GENERIC);
|
| 588 | 590 | }
|
| — | — | @@ -588,13 +590,13 @@ |
| 589 | 591 | HRESULT WINAPI glDirect3DDevice7::DrawPrimitiveVB(D3DPRIMITIVETYPE d3dptPrimitiveType, LPDIRECT3DVERTEXBUFFER7 lpd3dVertexBuffer,
|
| 590 | 592 | DWORD dwStartVertex, DWORD dwNumVertices, DWORD dwFlags)
|
| 591 | 593 | {
|
| 592 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 594 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 593 | 595 | FIXME("glDirect3DDevice7::DrawPrimitiveVB: stub");
|
| 594 | 596 | ERR(DDERR_GENERIC);
|
| 595 | 597 | }
|
| 596 | 598 | HRESULT WINAPI glDirect3DDevice7::EndScene()
|
| 597 | 599 | {
|
| 598 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 600 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 599 | 601 | if(!inscene) return D3DERR_SCENE_NOT_IN_SCENE;
|
| 600 | 602 | inscene = false;
|
| 601 | 603 | renderer->Flush();
|
| — | — | @@ -602,7 +604,7 @@ |
| 603 | 605 | }
|
| 604 | 606 | HRESULT WINAPI glDirect3DDevice7::EndStateBlock(LPDWORD lpdwBlockHandle)
|
| 605 | 607 | {
|
| 606 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 608 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 607 | 609 | FIXME("glDirect3DDevice7::EndStateBlock: stub");
|
| 608 | 610 | ERR(DDERR_GENERIC);
|
| 609 | 611 | }
|
| — | — | @@ -624,7 +626,7 @@ |
| 625 | 627 |
|
| 626 | 628 | HRESULT WINAPI glDirect3DDevice7::EnumTextureFormats(LPD3DENUMPIXELFORMATSCALLBACK lpd3dEnumPixelProc, LPVOID lpArg)
|
| 627 | 629 | {
|
| 628 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 630 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 629 | 631 | HRESULT result;
|
| 630 | 632 | DDPIXELFORMAT fmt;
|
| 631 | 633 | for(int i = 0; i < numtexfmt; i++)
|
| — | — | @@ -637,7 +639,7 @@ |
| 638 | 640 | }
|
| 639 | 641 | HRESULT WINAPI glDirect3DDevice7::GetCaps(LPD3DDEVICEDESC7 lpD3DDevDesc)
|
| 640 | 642 | {
|
| 641 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 643 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 642 | 644 | D3DDEVICEDESC7 desc = d3ddesc;
|
| 643 | 645 | desc.dwDevCaps |= D3DDEVCAPS_HWRASTERIZATION | D3DDEVCAPS_HWTRANSFORMANDLIGHT;
|
| 644 | 646 | desc.deviceGUID = IID_IDirect3DTnLHalDevice;
|
| — | — | @@ -646,31 +648,31 @@ |
| 647 | 649 | }
|
| 648 | 650 | HRESULT WINAPI glDirect3DDevice7::GetClipPlane(DWORD dwIndex, D3DVALUE *pPlaneEquation)
|
| 649 | 651 | {
|
| 650 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 652 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 651 | 653 | FIXME("glDirect3DDevice7::GetClipPlane: stub");
|
| 652 | 654 | ERR(DDERR_GENERIC);
|
| 653 | 655 | }
|
| 654 | 656 | HRESULT WINAPI glDirect3DDevice7::GetClipStatus(LPD3DCLIPSTATUS lpD3DClipStatus)
|
| 655 | 657 | {
|
| 656 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 658 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 657 | 659 | FIXME("glDirect3DDevice7::GetClipStatus: stub");
|
| 658 | 660 | ERR(DDERR_GENERIC);
|
| 659 | 661 | }
|
| 660 | 662 | HRESULT WINAPI glDirect3DDevice7::GetDirect3D(LPDIRECT3D7 *lplpD3D)
|
| 661 | 663 | {
|
| 662 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 664 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 663 | 665 | *lplpD3D = glD3D7;
|
| 664 | 666 | return D3D_OK;
|
| 665 | 667 | }
|
| 666 | 668 | HRESULT WINAPI glDirect3DDevice7::GetInfo(DWORD dwDevInfoID, LPVOID pDevInfoStruct, DWORD dwSize)
|
| 667 | 669 | {
|
| 668 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 670 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 669 | 671 | FIXME("glDirect3DDevice7::GetInfo: stub");
|
| 670 | 672 | ERR(DDERR_GENERIC);
|
| 671 | 673 | }
|
| 672 | 674 | HRESULT WINAPI glDirect3DDevice7::GetLight(DWORD dwLightIndex, LPD3DLIGHT7 lpLight)
|
| 673 | 675 | {
|
| 674 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 676 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 675 | 677 | if(!lpLight) return DDERR_INVALIDPARAMS;
|
| 676 | 678 | if(dwLightIndex >= lightsmax) ERR(DDERR_INVALIDOBJECT);
|
| 677 | 679 | if(!lights[dwLightIndex]) ERR(DDERR_INVALIDOBJECT);
|
| — | — | @@ -679,7 +681,7 @@ |
| 680 | 682 | }
|
| 681 | 683 | HRESULT WINAPI glDirect3DDevice7::GetLightEnable(DWORD dwLightIndex, BOOL* pbEnable)
|
| 682 | 684 | {
|
| 683 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 685 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 684 | 686 | if(dwLightIndex >= lightsmax) ERR(DDERR_INVALIDOBJECT);
|
| 685 | 687 | if(!lights[dwLightIndex]) ERR(DDERR_INVALIDOBJECT);
|
| 686 | 688 | if(!pbEnable) return DDERR_INVALIDPARAMS;
|
| — | — | @@ -690,7 +692,7 @@ |
| 691 | 693 | }
|
| 692 | 694 | HRESULT WINAPI glDirect3DDevice7::GetMaterial(LPD3DMATERIAL7 lpMaterial)
|
| 693 | 695 | {
|
| 694 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 696 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 695 | 697 | if(!lpMaterial) return DDERR_INVALIDPARAMS;
|
| 696 | 698 | memcpy(lpMaterial,&material,sizeof(D3DMATERIAL7));
|
| 697 | 699 | return D3D_OK;
|
| — | — | @@ -697,7 +699,7 @@ |
| 698 | 700 | }
|
| 699 | 701 | HRESULT WINAPI glDirect3DDevice7::GetRenderState(D3DRENDERSTATETYPE dwRenderStateType, LPDWORD lpdwRenderState)
|
| 700 | 702 | {
|
| 701 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 703 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 702 | 704 | if(dwRenderStateType <= 152)
|
| 703 | 705 | {
|
| 704 | 706 | *lpdwRenderState = renderstate[dwRenderStateType];
|
| — | — | @@ -707,7 +709,7 @@ |
| 708 | 710 | }
|
| 709 | 711 | HRESULT WINAPI glDirect3DDevice7::GetRenderTarget(LPDIRECTDRAWSURFACE7 *lplpRenderTarget)
|
| 710 | 712 | {
|
| 711 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 713 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 712 | 714 | if(!lplpRenderTarget) return DDERR_INVALIDPARAMS;
|
| 713 | 715 | glDDS7->AddRef();
|
| 714 | 716 | *lplpRenderTarget = glDDS7;
|
| — | — | @@ -715,7 +717,7 @@ |
| 716 | 718 | }
|
| 717 | 719 | HRESULT WINAPI glDirect3DDevice7::GetStateData(DWORD dwState, LPVOID* lplpStateData)
|
| 718 | 720 | {
|
| 719 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 721 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 720 | 722 | FIXME("glDirect3DDevice7::GetStateData: stub");
|
| 721 | 723 | ERR(DDERR_GENERIC);
|
| 722 | 724 | }
|
| — | — | @@ -722,7 +724,7 @@ |
| 723 | 725 | HRESULT WINAPI glDirect3DDevice7::GetTexture(DWORD dwStage, LPDIRECTDRAWSURFACE7 *lplpTexture)
|
| 724 | 726 | {
|
| 725 | 727 | if(!lplpTexture) return DDERR_INVALIDPARAMS;
|
| 726 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 728 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 727 | 729 | if(dwStage > 7) return DDERR_INVALIDPARAMS;
|
| 728 | 730 | if(!texstages[dwStage].texture) return DDERR_INVALIDOBJECT;
|
| 729 | 731 | *lplpTexture = texstages[dwStage].texture;
|
| — | — | @@ -733,7 +735,7 @@ |
| 734 | 736 | {
|
| 735 | 737 | if(dwStage > 7) return DDERR_INVALIDPARAMS;
|
| 736 | 738 | if(!lpdwValue) return DDERR_INVALIDPARAMS;
|
| 737 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 739 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 738 | 740 | switch(dwState)
|
| 739 | 741 | {
|
| 740 | 742 | case D3DTSS_COLOROP:
|
| — | — | @@ -813,7 +815,7 @@ |
| 814 | 816 | }
|
| 815 | 817 | HRESULT WINAPI glDirect3DDevice7::GetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix)
|
| 816 | 818 | {
|
| 817 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 819 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 818 | 820 | switch(dtstTransformStateType)
|
| 819 | 821 | {
|
| 820 | 822 | case D3DTRANSFORMSTATE_WORLD:
|
| — | — | @@ -831,13 +833,13 @@ |
| 832 | 834 | }
|
| 833 | 835 | HRESULT WINAPI glDirect3DDevice7::GetViewport(LPD3DVIEWPORT7 lpViewport)
|
| 834 | 836 | {
|
| 835 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 837 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 836 | 838 | memcpy(lpViewport,&viewport,sizeof(D3DVIEWPORT7));
|
| 837 | 839 | return D3D_OK;
|
| 838 | 840 | }
|
| 839 | 841 | HRESULT WINAPI glDirect3DDevice7::LightEnable(DWORD dwLightIndex, BOOL bEnable)
|
| 840 | 842 | {
|
| 841 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 843 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 842 | 844 | int i;
|
| 843 | 845 | D3DLIGHT7 light;
|
| 844 | 846 | bool foundlight = false;
|
| — | — | @@ -877,37 +879,37 @@ |
| 878 | 880 | HRESULT WINAPI glDirect3DDevice7::Load(LPDIRECTDRAWSURFACE7 lpDestTex, LPPOINT lpDestPoint, LPDIRECTDRAWSURFACE7 lpSrcTex,
|
| 879 | 881 | LPRECT lprcSrcRect, DWORD dwFlags)
|
| 880 | 882 | {
|
| 881 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 883 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 882 | 884 | FIXME("glDirect3DDevice7::Load: stub");
|
| 883 | 885 | ERR(DDERR_GENERIC);
|
| 884 | 886 | }
|
| 885 | 887 | HRESULT WINAPI glDirect3DDevice7::MultiplyTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix)
|
| 886 | 888 | {
|
| 887 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 889 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 888 | 890 | FIXME("glDirect3DDevice7::MultiplyTransform: stub");
|
| 889 | 891 | ERR(DDERR_GENERIC);
|
| 890 | 892 | }
|
| 891 | 893 | HRESULT WINAPI glDirect3DDevice7::PreLoad(LPDIRECTDRAWSURFACE7 lpddsTexture)
|
| 892 | 894 | {
|
| 893 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 895 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 894 | 896 | FIXME("glDirect3DDevice7::PreLoad: stub");
|
| 895 | 897 | ERR(DDERR_GENERIC);
|
| 896 | 898 | }
|
| 897 | 899 | HRESULT WINAPI glDirect3DDevice7::SetClipPlane(DWORD dwIndex, D3DVALUE* pPlaneEquation)
|
| 898 | 900 | {
|
| 899 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 901 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 900 | 902 | FIXME("glDirect3DDevice7::SetClipPland: stub");
|
| 901 | 903 | ERR(DDERR_GENERIC);
|
| 902 | 904 | }
|
| 903 | 905 | HRESULT WINAPI glDirect3DDevice7::SetClipStatus(LPD3DCLIPSTATUS lpD3DClipStatus)
|
| 904 | 906 | {
|
| 905 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 907 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 906 | 908 | FIXME("glDirect3DDevice7::SetClipStatus: stub");
|
| 907 | 909 | ERR(DDERR_GENERIC);
|
| 908 | 910 | }
|
| 909 | 911 | HRESULT WINAPI glDirect3DDevice7::SetLight(DWORD dwLightIndex, LPD3DLIGHT7 lpLight)
|
| 910 | 912 | {
|
| 911 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 913 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 912 | 914 | bool foundlight = false;
|
| 913 | 915 | if(dwLightIndex >= lightsmax)
|
| 914 | 916 | {
|
| — | — | @@ -919,7 +921,7 @@ |
| 920 | 922 | }
|
| 921 | 923 | HRESULT WINAPI glDirect3DDevice7::SetMaterial(LPD3DMATERIAL7 lpMaterial)
|
| 922 | 924 | {
|
| 923 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 925 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 924 | 926 | if(!lpMaterial) return DDERR_INVALIDPARAMS;
|
| 925 | 927 | memcpy(&material,lpMaterial,sizeof(D3DMATERIAL7));
|
| 926 | 928 | return D3D_OK;
|
| — | — | @@ -927,7 +929,7 @@ |
| 928 | 930 |
|
| 929 | 931 | HRESULT WINAPI glDirect3DDevice7::SetRenderState(D3DRENDERSTATETYPE dwRendStateType, DWORD dwRenderState)
|
| 930 | 932 | {
|
| 931 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 933 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 932 | 934 | if(dwRendStateType > 152) return DDERR_INVALIDPARAMS;
|
| 933 | 935 | if(dwRendStateType < 0) return DDERR_INVALIDPARAMS;
|
| 934 | 936 | renderstate[dwRendStateType] = dwRenderState;
|
| — | — | @@ -935,7 +937,7 @@ |
| 936 | 938 | }
|
| 937 | 939 | HRESULT WINAPI glDirect3DDevice7::SetRenderTarget(LPDIRECTDRAWSURFACE7 lpNewRenderTarget, DWORD dwFlags)
|
| 938 | 940 | {
|
| 939 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 941 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 940 | 942 | if(!lpNewRenderTarget) return DDERR_INVALIDPARAMS;
|
| 941 | 943 | if(dwFlags) return DDERR_INVALIDPARAMS;
|
| 942 | 944 | DDSURFACEDESC2 ddsd;
|
| — | — | @@ -949,13 +951,13 @@ |
| 950 | 952 | }
|
| 951 | 953 | HRESULT WINAPI glDirect3DDevice7::SetStateData(DWORD dwState, LPVOID lpStateData)
|
| 952 | 954 | {
|
| 953 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 955 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 954 | 956 | FIXME("glDirect3DDevice7::SetStateData: stub");
|
| 955 | 957 | ERR(DDERR_GENERIC);
|
| 956 | 958 | }
|
| 957 | 959 | HRESULT WINAPI glDirect3DDevice7::SetTexture(DWORD dwStage, LPDIRECTDRAWSURFACE7 lpTexture)
|
| 958 | 960 | {
|
| 959 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 961 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 960 | 962 | if(dwStage > 7) return DDERR_INVALIDPARAMS;
|
| 961 | 963 | if(texstages[dwStage].texture) texstages[dwStage].texture->Release();
|
| 962 | 964 | texstages[dwStage].texture = (glDirectDrawSurface7*)lpTexture;
|
| — | — | @@ -965,7 +967,7 @@ |
| 966 | 968 | }
|
| 967 | 969 | HRESULT WINAPI glDirect3DDevice7::SetTextureStageState(DWORD dwStage, D3DTEXTURESTAGESTATETYPE dwState, DWORD dwValue)
|
| 968 | 970 | {
|
| 969 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 971 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 970 | 972 | if(dwStage > 7) return DDERR_INVALIDPARAMS;
|
| 971 | 973 | switch(dwState)
|
| 972 | 974 | {
|
| — | — | @@ -1179,7 +1181,7 @@ |
| 1180 | 1182 | }
|
| 1181 | 1183 | HRESULT WINAPI glDirect3DDevice7::SetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix)
|
| 1182 | 1184 | {
|
| 1183 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 1185 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 1184 | 1186 | switch(dtstTransformStateType)
|
| 1185 | 1187 | {
|
| 1186 | 1188 | case D3DTRANSFORMSTATE_WORLD:
|
| — | — | @@ -1199,13 +1201,13 @@ |
| 1200 | 1202 | }
|
| 1201 | 1203 | HRESULT WINAPI glDirect3DDevice7::SetViewport(LPD3DVIEWPORT7 lpViewport)
|
| 1202 | 1204 | {
|
| 1203 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 1205 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 1204 | 1206 | memcpy(&viewport,lpViewport,sizeof(D3DVIEWPORT7));
|
| 1205 | 1207 | return D3D_OK;
|
| 1206 | 1208 | }
|
| 1207 | 1209 | HRESULT WINAPI glDirect3DDevice7::ValidateDevice(LPDWORD lpdwPasses)
|
| 1208 | 1210 | {
|
| 1209 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 1211 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 1210 | 1212 | for(int i = 0; i < 8; i++)
|
| 1211 | 1213 | {
|
| 1212 | 1214 | switch(texstages[i].colorop)
|
| — | — | @@ -1338,6 +1340,184 @@ |
| 1339 | 1341 | return D3D_OK;
|
| 1340 | 1342 | }
|
| 1341 | 1343 |
|
| | 1344 | +HRESULT glDirect3DDevice7::DeleteViewport(LPDIRECT3DVIEWPORT3 lpDirect3DViewport)
|
| | 1345 | +{
|
| | 1346 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 1347 | + if(!lpDirect3DViewport) return DDERR_INVALIDPARAMS;
|
| | 1348 | + for(int i = 0; i < maxviewports; i++)
|
| | 1349 | + {
|
| | 1350 | + if(viewports[i] == lpDirect3DViewport)
|
| | 1351 | + {
|
| | 1352 | + viewports[i]->SetCurrent(false);
|
| | 1353 | + viewports[i]->Release();
|
| | 1354 | + if(currentviewport == viewports[i]) currentviewport = NULL;
|
| | 1355 | + viewports[i] = NULL;
|
| | 1356 | + return D3D_OK;
|
| | 1357 | + }
|
| | 1358 | + }
|
| | 1359 | + return DDERR_INVALIDPARAMS;
|
| | 1360 | +}
|
| | 1361 | +
|
| | 1362 | +HRESULT glDirect3DDevice7::NextViewport(LPDIRECT3DVIEWPORT3 lpDirect3DViewport, LPDIRECT3DVIEWPORT3 *lplpAnotherViewport, DWORD dwFlags)
|
| | 1363 | +{
|
| | 1364 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 1365 | + if(!lpDirect3DViewport) return DDERR_INVALIDPARAMS;
|
| | 1366 | + if(!lplpAnotherViewport) return DDERR_INVALIDPARAMS;
|
| | 1367 | + FIXME("glDirect3DDevice7::NextViewport: stub");
|
| | 1368 | + return DDERR_GENERIC;
|
| | 1369 | +}
|
| | 1370 | +
|
| | 1371 | +HRESULT glDirect3DDevice7::GetCurrentViewport(LPDIRECT3DVIEWPORT3 *lplpd3dViewport)
|
| | 1372 | +{
|
| | 1373 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 1374 | + if(!lplpd3dViewport) return DDERR_INVALIDPARAMS;
|
| | 1375 | + if(!currentviewport) return D3DERR_NOCURRENTVIEWPORT;
|
| | 1376 | + *lplpd3dViewport = currentviewport;
|
| | 1377 | + currentviewport->AddRef();
|
| | 1378 | + return D3D_OK;
|
| | 1379 | +}
|
| | 1380 | +
|
| | 1381 | +HRESULT glDirect3DDevice7::SetCurrentViewport(LPDIRECT3DVIEWPORT3 lpd3dViewport)
|
| | 1382 | +{
|
| | 1383 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 1384 | + if(!lpd3dViewport) return DDERR_INVALIDPARAMS;
|
| | 1385 | + if(currentviewport == lpd3dViewport) return D3D_OK;
|
| | 1386 | + for(int i = 0; i < maxviewports; i++)
|
| | 1387 | + {
|
| | 1388 | + if(lpd3dViewport == viewports[i])
|
| | 1389 | + {
|
| | 1390 | + viewports[i]->SetCurrent(true);
|
| | 1391 | + currentviewport = (glDirect3DViewport3*)lpd3dViewport;
|
| | 1392 | + return D3D_OK;
|
| | 1393 | + }
|
| | 1394 | + }
|
| | 1395 | + return DDERR_INVALIDPARAMS;
|
| | 1396 | +}
|
| | 1397 | +
|
| | 1398 | +HRESULT glDirect3DDevice7::Begin(D3DPRIMITIVETYPE d3dpt, DWORD dwVertexTypeDesc, DWORD dwFlags)
|
| | 1399 | +{
|
| | 1400 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 1401 | + FIXME("glDirect3DDevice7::Begin: stub");
|
| | 1402 | + return DDERR_GENERIC;
|
| | 1403 | +}
|
| | 1404 | +HRESULT glDirect3DDevice7::BeginIndexed(D3DPRIMITIVETYPE dptPrimitiveType, DWORD dwVertexTypeDesc, LPVOID lpvVertices, DWORD dwNumVertices, DWORD dwFlags)
|
| | 1405 | +{
|
| | 1406 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 1407 | + if(!lpvVertices) return DDERR_INVALIDPARAMS;
|
| | 1408 | + FIXME("glDirect3DDevice7::BeginIndexed: stub");
|
| | 1409 | + return DDERR_GENERIC;
|
| | 1410 | +}
|
| | 1411 | +HRESULT glDirect3DDevice7::Index(WORD wVertexIndex)
|
| | 1412 | +{
|
| | 1413 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 1414 | + FIXME("glDirect3DDevice7::Index: stub");
|
| | 1415 | + return DDERR_GENERIC;
|
| | 1416 | +}
|
| | 1417 | +HRESULT glDirect3DDevice7::Vertex(LPVOID lpVertex)
|
| | 1418 | +{
|
| | 1419 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 1420 | + if(!lpVertex) return DDERR_INVALIDPARAMS;
|
| | 1421 | + FIXME("glDirect3DDevice7::Vertex: stub");
|
| | 1422 | + return DDERR_GENERIC;
|
| | 1423 | +}
|
| | 1424 | +HRESULT glDirect3DDevice7::End(DWORD dwFlags)
|
| | 1425 | +{
|
| | 1426 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 1427 | + FIXME("glDirect3DDevice7::End: stub");
|
| | 1428 | + return DDERR_GENERIC;
|
| | 1429 | +}
|
| | 1430 | +
|
| | 1431 | +HRESULT glDirect3DDevice7::ComputeSphereVisibility3(LPD3DVECTOR lpCenters, LPD3DVALUE lpRadii, DWORD dwNumSpheres, DWORD dwFlags, LPDWORD lpdwReturnValues)
|
| | 1432 | +{
|
| | 1433 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 1434 | + FIXME("glDirect3DDevice3::ComputeSphereVisibility: stub");
|
| | 1435 | + return DDERR_GENERIC;
|
| | 1436 | +}
|
| | 1437 | +
|
| | 1438 | +HRESULT glDirect3DDevice7::GetCaps3(LPD3DDEVICEDESC lpD3DHWDevDesc, LPD3DDEVICEDESC lpD3DHELDevDesc)
|
| | 1439 | +{
|
| | 1440 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 1441 | + if(!lpD3DHWDevDesc && !lpD3DHELDevDesc) return DDERR_INVALIDPARAMS;
|
| | 1442 | + D3DDEVICEDESC desc = d3ddesc3;
|
| | 1443 | + if(lpD3DHELDevDesc) *lpD3DHELDevDesc = desc;
|
| | 1444 | + desc.dwDevCaps |= D3DDEVCAPS_HWRASTERIZATION;
|
| | 1445 | + if(lpD3DHWDevDesc) *lpD3DHWDevDesc = desc;
|
| | 1446 | + return D3D_OK;
|
| | 1447 | +}
|
| | 1448 | +
|
| | 1449 | +HRESULT glDirect3DDevice7::GetLightState(D3DLIGHTSTATETYPE dwLightStateType, LPDWORD lpdwLightState)
|
| | 1450 | +{
|
| | 1451 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 1452 | + if(!lpdwLightState)return DDERR_INVALIDPARAMS;
|
| | 1453 | + switch(dwLightStateType)
|
| | 1454 | + {
|
| | 1455 | + default:
|
| | 1456 | + return DDERR_INVALIDPARAMS;
|
| | 1457 | + case D3DLIGHTSTATE_MATERIAL:
|
| | 1458 | + *lpdwLightState = (DWORD)currentmaterial;
|
| | 1459 | + return D3D_OK;
|
| | 1460 | + case D3DLIGHTSTATE_AMBIENT:
|
| | 1461 | + return GetRenderState(D3DRENDERSTATE_AMBIENT,lpdwLightState);
|
| | 1462 | + case D3DLIGHTSTATE_COLORMODEL:
|
| | 1463 | + *lpdwLightState = D3DCOLOR_RGB;
|
| | 1464 | + return D3D_OK;
|
| | 1465 | + case D3DLIGHTSTATE_FOGMODE:
|
| | 1466 | + return GetRenderState(D3DRENDERSTATE_FOGVERTEXMODE,lpdwLightState);
|
| | 1467 | + case D3DLIGHTSTATE_FOGSTART:
|
| | 1468 | + return GetRenderState(D3DRENDERSTATE_FOGSTART,lpdwLightState);
|
| | 1469 | + case D3DLIGHTSTATE_FOGEND:
|
| | 1470 | + return GetRenderState(D3DRENDERSTATE_FOGEND,lpdwLightState);
|
| | 1471 | + case D3DLIGHTSTATE_FOGDENSITY:
|
| | 1472 | + return GetRenderState(D3DRENDERSTATE_FOGDENSITY,lpdwLightState);
|
| | 1473 | + case D3DLIGHTSTATE_COLORVERTEX:
|
| | 1474 | + return GetRenderState(D3DRENDERSTATE_COLORVERTEX,lpdwLightState);
|
| | 1475 | + }
|
| | 1476 | +}
|
| | 1477 | +HRESULT glDirect3DDevice7::SetLightState(D3DLIGHTSTATETYPE dwLightStateType, DWORD dwLightState)
|
| | 1478 | +{
|
| | 1479 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 1480 | + switch(dwLightStateType)
|
| | 1481 | + {
|
| | 1482 | + default:
|
| | 1483 | + return DDERR_INVALIDPARAMS;
|
| | 1484 | + case D3DLIGHTSTATE_MATERIAL:
|
| | 1485 | + if(dwLightState == (DWORD)currentmaterial) return D3D_OK;
|
| | 1486 | + if(!dwLightState) return DDERR_INVALIDPARAMS;
|
| | 1487 | + for(int i = 0; i < materialcount; i++)
|
| | 1488 | + {
|
| | 1489 | + if((DWORD)materials[i] == dwLightState)
|
| | 1490 | + {
|
| | 1491 | + if(currentmaterial) currentmaterial->SetCurrent(false);
|
| | 1492 | + materials[i]->SetCurrent(true);
|
| | 1493 | + currentmaterial = materials[i];
|
| | 1494 | + }
|
| | 1495 | + }
|
| | 1496 | + return D3D_OK;
|
| | 1497 | + case D3DLIGHTSTATE_AMBIENT:
|
| | 1498 | + return SetRenderState(D3DRENDERSTATE_AMBIENT,dwLightState);
|
| | 1499 | + case D3DLIGHTSTATE_COLORMODEL:
|
| | 1500 | + return D3D_OK;
|
| | 1501 | + case D3DLIGHTSTATE_FOGMODE:
|
| | 1502 | + return SetRenderState(D3DRENDERSTATE_FOGVERTEXMODE,dwLightState);
|
| | 1503 | + case D3DLIGHTSTATE_FOGSTART:
|
| | 1504 | + return SetRenderState(D3DRENDERSTATE_FOGSTART,dwLightState);
|
| | 1505 | + case D3DLIGHTSTATE_FOGEND:
|
| | 1506 | + return SetRenderState(D3DRENDERSTATE_FOGEND,dwLightState);
|
| | 1507 | + case D3DLIGHTSTATE_FOGDENSITY:
|
| | 1508 | + return SetRenderState(D3DRENDERSTATE_FOGDENSITY,dwLightState);
|
| | 1509 | + case D3DLIGHTSTATE_COLORVERTEX:
|
| | 1510 | + return SetRenderState(D3DRENDERSTATE_COLORVERTEX,dwLightState);
|
| | 1511 | + }
|
| | 1512 | +}
|
| | 1513 | +
|
| | 1514 | +HRESULT glDirect3DDevice7::GetStats(LPD3DSTATS lpD3DStats)
|
| | 1515 | +{
|
| | 1516 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 1517 | + if(!lpD3DStats) return DDERR_INVALIDPARAMS;
|
| | 1518 | + FIXME("glDirect3DDevice7::GetStats: stub");
|
| | 1519 | + return DDERR_GENERIC;
|
| | 1520 | +}
|
| | 1521 | +
|
| 1342 | 1522 | // IDirect3DDevice3 wrapper
|
| 1343 | 1523 | glDirect3DDevice3::glDirect3DDevice3(glDirect3DDevice7 *glD3DDev7)
|
| 1344 | 1524 | {
|
| — | — | @@ -1352,7 +1532,7 @@ |
| 1353 | 1533 |
|
| 1354 | 1534 | HRESULT WINAPI glDirect3DDevice3::QueryInterface(REFIID riid, void** ppvObj)
|
| 1355 | 1535 | {
|
| 1356 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 1536 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 1357 | 1537 | if(riid == IID_IUnknown)
|
| 1358 | 1538 | {
|
| 1359 | 1539 | this->AddRef();
|
| Index: ddraw/glDirect3DDevice.h |
| — | — | @@ -128,6 +128,7 @@ |
| 129 | 129 | HRESULT AddViewport(LPDIRECT3DVIEWPORT3 lpDirect3DViewport);
|
| 130 | 130 | HRESULT DeleteViewport(LPDIRECT3DVIEWPORT3 lpDirect3DViewport);
|
| 131 | 131 | HRESULT NextViewport(LPDIRECT3DVIEWPORT3 lpDirect3DViewport, LPDIRECT3DVIEWPORT3 *lplpAnotherViewport, DWORD dwFlags);
|
| | 132 | + HRESULT GetCurrentViewport(LPDIRECT3DVIEWPORT3 *lplpd3dViewport);
|
| 132 | 133 | HRESULT SetCurrentViewport(LPDIRECT3DVIEWPORT3 lpd3dViewport);
|
| 133 | 134 | HRESULT Begin(D3DPRIMITIVETYPE d3dpt, DWORD dwVertexTypeDesc, DWORD dwFlags);
|
| 134 | 135 | HRESULT BeginIndexed(D3DPRIMITIVETYPE dptPrimitiveType, DWORD dwVertexTypeDesc, LPVOID lpvVertices, DWORD dwNumVertices, DWORD dwFlags);
|
| — | — | @@ -136,7 +137,6 @@ |
| 137 | 138 | HRESULT End(DWORD dwFlags);
|
| 138 | 139 | HRESULT ComputeSphereVisibility3(LPD3DVECTOR lpCenters, LPD3DVALUE lpRadii, DWORD dwNumSpheres, DWORD dwFlags, LPDWORD lpdwReturnValues);
|
| 139 | 140 | HRESULT GetCaps3(LPD3DDEVICEDESC lpD3DHWDevDesc, LPD3DDEVICEDESC lpD3DHELDevDesc);
|
| 140 | | - HRESULT GetCurrentViewport(LPDIRECT3DVIEWPORT3 *lplpd3dViewport);
|
| 141 | 141 | HRESULT GetLightState(D3DLIGHTSTATETYPE dwLightStateType, LPDWORD lpdwLightState);
|
| 142 | 142 | HRESULT SetLightState(D3DLIGHTSTATETYPE dwLightStateType, DWORD dwLightState);
|
| 143 | 143 | HRESULT GetStats(LPD3DSTATS lpD3DStats);
|
| — | — | @@ -156,6 +156,7 @@ |
| 157 | 157 | TEXTURESTAGE texstages[8];
|
| 158 | 158 | glDirect3D7 *glD3D7;
|
| 159 | 159 | glDirect3DMaterial3 **materials;
|
| | 160 | + glDirect3DMaterial3 *currentmaterial;
|
| 160 | 161 | int materialcount;
|
| 161 | 162 |
|
| 162 | 163 | private:
|
| — | — | @@ -177,6 +178,7 @@ |
| 178 | 179 | int texformats[8];
|
| 179 | 180 | int maxmaterials;
|
| 180 | 181 | glDirect3DViewport3 **viewports;
|
| | 182 | + glDirect3DViewport3 *currentviewport;
|
| 181 | 183 | int viewportcount;
|
| 182 | 184 | int maxviewports;
|
| 183 | 185 | };
|
| Index: ddraw/glDirect3DMaterial.cpp |
| — | — | @@ -98,6 +98,7 @@ |
| 99 | 99 | if(!this) return DDERR_INVALIDOBJECT;
|
| 100 | 100 | if(lpMat->dwSize != sizeof(D3DMATERIAL)) return DDERR_INVALIDPARAMS;
|
| 101 | 101 | memcpy(&material,lpMat,sizeof(D3DMATERIAL));
|
| | 102 | + if(device && current) Sync();
|
| 102 | 103 | return D3D_OK;
|
| 103 | 104 | }
|
| 104 | 105 |
|
| — | — | @@ -104,5 +105,24 @@ |
| 105 | 106 | void glDirect3DMaterial3::unbind()
|
| 106 | 107 | {
|
| 107 | 108 | device = NULL;
|
| | 109 | + current = false;
|
| 108 | 110 | handle = 0;
|
| | 111 | +}
|
| | 112 | +
|
| | 113 | +void glDirect3DMaterial3::SetCurrent(bool current)
|
| | 114 | +{
|
| | 115 | + if(this->current == current) return;
|
| | 116 | + this->current = current;
|
| | 117 | + if(current) Sync();
|
| | 118 | +}
|
| | 119 | +
|
| | 120 | +void glDirect3DMaterial3::Sync()
|
| | 121 | +{
|
| | 122 | + D3DMATERIAL7 mat7;
|
| | 123 | + mat7.diffuse = material.diffuse;
|
| | 124 | + mat7.ambient = material.ambient;
|
| | 125 | + mat7.specular = material.specular;
|
| | 126 | + mat7.emissive = material.emissive;
|
| | 127 | + mat7.power = material.power;
|
| | 128 | + device->SetMaterial(&mat7);
|
| 109 | 129 | } |
| \ No newline at end of file |
| Index: ddraw/glDirect3DMaterial.h |
| — | — | @@ -30,10 +30,13 @@ |
| 31 | 31 | HRESULT WINAPI GetHandle(LPDIRECT3DDEVICE3 lpDirect3DDevice, LPD3DMATERIALHANDLE lpHandle);
|
| 32 | 32 | HRESULT WINAPI GetMaterial(LPD3DMATERIAL lpMat);
|
| 33 | 33 | HRESULT WINAPI SetMaterial(LPD3DMATERIAL lpMat);
|
| | 34 | + void Sync();
|
| | 35 | + void SetCurrent(bool current);
|
| 34 | 36 | void unbind();
|
| 35 | 37 | D3DMATERIAL material;
|
| 36 | 38 | private:
|
| 37 | 39 | ULONG refcount;
|
| | 40 | + bool current;
|
| 38 | 41 | glDirect3DDevice7 *device;
|
| 39 | 42 | D3DMATERIALHANDLE handle;
|
| 40 | 43 | };
|
| Index: ddraw/glDirect3DTexture.cpp |
| — | — | @@ -65,14 +65,17 @@ |
| 66 | 66 | {
|
| 67 | 67 | if(!this) return DDERR_INVALIDOBJECT;
|
| 68 | 68 | FIXME("glDirect3DTexture2::GetHandle: stub");
|
| | 69 | + return DDERR_GENERIC;
|
| 69 | 70 | }
|
| 70 | 71 | HRESULT WINAPI glDirect3DTexture2::Load(LPDIRECT3DTEXTURE2 lpD3DTexture2)
|
| 71 | 72 | {
|
| 72 | 73 | if(!this) return DDERR_INVALIDOBJECT;
|
| 73 | 74 | FIXME("glDirect3DTexture2::Load: stub");
|
| | 75 | + return DDERR_GENERIC;
|
| 74 | 76 | }
|
| 75 | 77 | HRESULT WINAPI glDirect3DTexture2::PaletteChanged(DWORD dwStart, DWORD dwCount)
|
| 76 | 78 | {
|
| 77 | 79 | if(!this) return DDERR_INVALIDOBJECT;
|
| 78 | 80 | FIXME("glDirect3DTexture2::PaletteChanged: stub");
|
| | 81 | + return DDERR_GENERIC;
|
| 79 | 82 | }
|
| Index: ddraw/glDirect3DViewport.cpp |
| — | — | @@ -44,6 +44,7 @@ |
| 45 | 45 | for(int i = 0; i < 8; i++)
|
| 46 | 46 | lights[i] = NULL;
|
| 47 | 47 | refcount = 1;
|
| | 48 | + current = false;
|
| 48 | 49 | }
|
| 49 | 50 |
|
| 50 | 51 | glDirect3DViewport3::~glDirect3DViewport3()
|
| — | — | @@ -242,6 +243,7 @@ |
| 243 | 244 | vp.dvClipX = viewport.dvClipX;
|
| 244 | 245 | vp.dvClipY = viewport.dvClipY;
|
| 245 | 246 | viewport = vp;
|
| | 247 | + if(current && device) Sync();
|
| 246 | 248 | return D3D_OK;
|
| 247 | 249 | }
|
| 248 | 250 | HRESULT WINAPI glDirect3DViewport3::SetViewport2(LPD3DVIEWPORT2 lpData)
|
| — | — | @@ -250,6 +252,7 @@ |
| 251 | 253 | if(!device) return D3DERR_VIEWPORTHASNODEVICE;
|
| 252 | 254 | if(!lpData) return DDERR_INVALIDPARAMS;
|
| 253 | 255 | viewport = *lpData;
|
| | 256 | + if(current && device) Sync();
|
| 254 | 257 | return D3D_OK;
|
| 255 | 258 | }
|
| 256 | 259 | HRESULT WINAPI glDirect3DViewport3::TransformVertices(DWORD dwVertexCount, LPD3DTRANSFORMDATA lpData, DWORD dwFlags, LPDWORD lpOffscreen)
|
| — | — | @@ -257,4 +260,23 @@ |
| 258 | 261 | if(!this) return DDERR_INVALIDOBJECT;
|
| 259 | 262 | FIXME("glDirect3DViewport3::TransformVertices: stub");
|
| 260 | 263 | return DDERR_GENERIC;
|
| | 264 | +}
|
| | 265 | +
|
| | 266 | +void glDirect3DViewport3::SetCurrent(bool current)
|
| | 267 | +{
|
| | 268 | + if(this->current && current) return;
|
| | 269 | + this->current = current;
|
| | 270 | + if(current && device) Sync();
|
| | 271 | +}
|
| | 272 | +
|
| | 273 | +void glDirect3DViewport3::Sync()
|
| | 274 | +{
|
| | 275 | + D3DVIEWPORT7 vp7;
|
| | 276 | + vp7.dwX = viewport.dwX;
|
| | 277 | + vp7.dwY = viewport.dwY;
|
| | 278 | + vp7.dwHeight = viewport.dwHeight;
|
| | 279 | + vp7.dwWidth = viewport.dwWidth;
|
| | 280 | + vp7.dvMinZ = viewport.dvMinZ;
|
| | 281 | + vp7.dvMaxZ = viewport.dvMaxZ;
|
| | 282 | + device->SetViewport(&vp7);
|
| 261 | 283 | } |
| \ No newline at end of file |
| Index: ddraw/glDirect3DViewport.h |
| — | — | @@ -48,6 +48,8 @@ |
| 49 | 49 | HRESULT WINAPI SetViewport(LPD3DVIEWPORT lpData);
|
| 50 | 50 | HRESULT WINAPI SetViewport2(LPD3DVIEWPORT2 lpData);
|
| 51 | 51 | HRESULT WINAPI TransformVertices(DWORD dwVertexCount, LPD3DTRANSFORMDATA lpData, DWORD dwFlags, LPDWORD lpOffscreen);
|
| | 52 | + void SetCurrent(bool current);
|
| | 53 | + void Sync();
|
| 52 | 54 | private:
|
| 53 | 55 | ULONG refcount;
|
| 54 | 56 | glDirect3DLight *lights[8];
|
| — | — | @@ -59,6 +61,7 @@ |
| 60 | 62 | D3DVALUE maxY;
|
| 61 | 63 | D3DVALUE scaleX;
|
| 62 | 64 | D3DVALUE scaleY;
|
| | 65 | + bool current;
|
| 63 | 66 | };
|
| 64 | 67 |
|
| 65 | 68 | #endif //__GLDIRECT3DVIEWPORT_H |
| \ No newline at end of file |
| Index: ddraw/glDirectDrawSurface.cpp |
| — | — | @@ -22,6 +22,7 @@ |
| 23 | 23 | #include "glDirect3DDevice.h"
|
| 24 | 24 | #include "glDirectDraw.h"
|
| 25 | 25 | #include "glDirectDrawSurface.h"
|
| | 26 | +#include "glDirect3DTexture.h"
|
| 26 | 27 | #include "glDirectDrawPalette.h"
|
| 27 | 28 | #include "glDirectDrawClipper.h"
|
| 28 | 29 | #include "glRenderer.h"
|
| — | — | @@ -519,6 +520,12 @@ |
| 520 | 521 | return DD_OK;
|
| 521 | 522 | }
|
| 522 | 523 | }
|
| | 524 | + if(riid == IID_IDirect3DTexture2)
|
| | 525 | + {
|
| | 526 | + this->AddRef();
|
| | 527 | + *ppvObj = new glDirect3DTexture2(this);
|
| | 528 | + return DD_OK;
|
| | 529 | + }
|
| 523 | 530 | ERR(E_NOINTERFACE);
|
| 524 | 531 | }
|
| 525 | 532 | ULONG WINAPI glDirectDrawSurface7::AddRef()
|