Christian Costa : ddraw: Implement IDirect3DViewportImpl_NextLight.
Alexandre Julliard
julliard at winehq.org
Wed Mar 4 09:00:55 CST 2009
Module: wine
Branch: master
Commit: f716306f366744ec205bc0485b04d18bab74d080
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f716306f366744ec205bc0485b04d18bab74d080
Author: Christian Costa <titan.costa at wanadoo.fr>
Date: Tue Mar 3 22:45:21 2009 +0100
ddraw: Implement IDirect3DViewportImpl_NextLight.
---
dlls/ddraw/viewport.c | 47 +++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/dlls/ddraw/viewport.c b/dlls/ddraw/viewport.c
index 299d92d..30d5e18 100644
--- a/dlls/ddraw/viewport.c
+++ b/dlls/ddraw/viewport.c
@@ -829,8 +829,51 @@ IDirect3DViewportImpl_NextLight(IDirect3DViewport3 *iface,
DWORD dwFlags)
{
IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface;
- FIXME("(%p)->(%p,%p,%08x): stub!\n", This, lpDirect3DLight, lplpDirect3DLight, dwFlags);
- return D3D_OK;
+ IDirect3DLightImpl *cur_light, *prev_light = NULL;
+
+ TRACE("(%p)->(%p,%p,%08x)\n", This, lpDirect3DLight, lplpDirect3DLight, dwFlags);
+
+ if (!lplpDirect3DLight)
+ return DDERR_INVALIDPARAMS;
+
+ *lplpDirect3DLight = NULL;
+
+ EnterCriticalSection(&ddraw_cs);
+
+ cur_light = This->lights;
+
+ switch (dwFlags) {
+ case D3DNEXT_NEXT:
+ if (!lpDirect3DLight) {
+ LeaveCriticalSection(&ddraw_cs);
+ return DDERR_INVALIDPARAMS;
+ }
+ while (cur_light != NULL) {
+ if (cur_light == (IDirect3DLightImpl *)lpDirect3DLight) {
+ *lplpDirect3DLight = (IDirect3DLight*)cur_light->next;
+ break;
+ }
+ cur_light = cur_light->next;
+ }
+ break;
+ case D3DNEXT_HEAD:
+ *lplpDirect3DLight = (IDirect3DLight*)This->lights;
+ break;
+ case D3DNEXT_TAIL:
+ while (cur_light != NULL) {
+ prev_light = cur_light;
+ cur_light = cur_light->next;
+ }
+ *lplpDirect3DLight = (IDirect3DLight*)prev_light;
+ break;
+ default:
+ ERR("Unknown flag %d\n", dwFlags);
+ break;
+ }
+
+ LeaveCriticalSection(&ddraw_cs);
+
+ return *lplpDirect3DLight ? D3D_OK : DDERR_INVALIDPARAMS;
}
/*****************************************************************************
More information about the wine-cvs
mailing list