ddraw: Fix some material related bugs.
This commit is contained in:
parent
44ace22445
commit
b0c7bee2ef
|
@ -1639,7 +1639,7 @@ IDirect3DDeviceImpl_3_GetCurrentViewport(IDirect3DDevice3 *iface,
|
|||
*Direct3DViewport3 = ICOM_INTERFACE(This->current_viewport, IDirect3DViewport3);
|
||||
|
||||
/* AddRef the returned viewport */
|
||||
IDirect3DViewport3_AddRef(*Direct3DViewport3);
|
||||
if(*Direct3DViewport3) IDirect3DViewport3_AddRef(*Direct3DViewport3);
|
||||
|
||||
TRACE(" returning interface %p\n", *Direct3DViewport3);
|
||||
|
||||
|
@ -2279,7 +2279,23 @@ IDirect3DDeviceImpl_3_SetLightState(IDirect3DDevice3 *iface,
|
|||
|
||||
if (LightStateType == D3DLIGHTSTATE_MATERIAL /* 1 */)
|
||||
{
|
||||
IDirect3DMaterialImpl *mat = (IDirect3DMaterialImpl *) Value;
|
||||
IDirect3DMaterialImpl *mat;
|
||||
|
||||
if(Value == 0) mat = NULL;
|
||||
else if(Value > This->numHandles)
|
||||
{
|
||||
ERR("Material handle out of range(%ld)\n", Value);
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
else if(This->Handles[Value - 1].type != DDrawHandle_Material)
|
||||
{
|
||||
ERR("Invalid handle %ld\n", Value);
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
else
|
||||
{
|
||||
mat = (IDirect3DMaterialImpl *) This->Handles[Value - 1].ptr;
|
||||
}
|
||||
|
||||
if (mat != NULL)
|
||||
{
|
||||
|
|
|
@ -311,6 +311,7 @@ IDirect3DMaterialImpl_GetHandle(IDirect3DMaterial3 *iface,
|
|||
IDirect3DDeviceImpl *device = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice3, lpDirect3DDevice3);
|
||||
TRACE("(%p/%p)->(%p,%p)\n", This, iface, device, lpHandle);
|
||||
|
||||
This->active_device = device;
|
||||
if(!This->Handle)
|
||||
{
|
||||
This->Handle = IDirect3DDeviceImpl_CreateHandle(device);
|
||||
|
|
|
@ -310,7 +310,7 @@ IDirect3DViewportImpl_SetViewport(IDirect3DViewport3 *iface,
|
|||
IDirect3DDevice3_GetCurrentViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice3), ¤t_viewport);
|
||||
if (ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport) == This)
|
||||
This->activate(This);
|
||||
IDirect3DViewport3_Release(current_viewport);
|
||||
if(current_viewport) IDirect3DViewport3_Release(current_viewport);
|
||||
}
|
||||
|
||||
return DD_OK;
|
||||
|
|
Loading…
Reference in New Issue