DXGL r73 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r72‎ | r73 | r74 >
Date:17:03, 8 January 2012
Author:admin
Status:new
Tags:
Comment:
Add SetLight
Add LightEnable with bEnable FALSE
Modified paths:
  • /ddraw/glDirect3DDevice.cpp (modified) (history)
  • /ddraw/glDirect3DLight.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirect3DDevice.cpp
@@ -393,6 +393,18 @@
394394 if(!foundlight) return D3DERR_LIGHT_SET_FAILED;
395395 lights[dwLightIndex]->SetGLLight(i);
396396 }
 397+ else
 398+ {
 399+ for(i = 0; i < 8; i++)
 400+ {
 401+ if(gllights[i] == dwLightIndex)
 402+ {
 403+ lights[dwLightIndex]->SetGLLight(-1);
 404+ gllights[i] = -1;
 405+ }
 406+ }
 407+ return D3D_OK;
 408+ }
397409 return D3D_OK;
398410 }
399411 HRESULT WINAPI glDirect3DDevice7::Load(LPDIRECTDRAWSURFACE7 lpDestTex, LPPOINT lpDestPoint, LPDIRECTDRAWSURFACE7 lpSrcTex,
@@ -423,8 +435,14 @@
424436 }
425437 HRESULT WINAPI glDirect3DDevice7::SetLight(DWORD dwLightIndex, LPD3DLIGHT7 lpLight)
426438 {
427 - FIXME("glDirect3DDevice7::SetLight: stub");
428 - ERR(DDERR_GENERIC);
 439+ bool foundlight = false;
 440+ if(dwLightIndex >= lightsmax)
 441+ {
 442+ if(!ExpandLightBuffer(&lights,&lightsmax,dwLightIndex-1)) return DDERR_OUTOFMEMORY;
 443+ }
 444+ if(!lights[dwLightIndex]) lights[dwLightIndex] = new glDirect3DLight;
 445+ lights[dwLightIndex]->SetLight7(lpLight);
 446+ return D3D_OK;
429447 }
430448 HRESULT WINAPI glDirect3DDevice7::SetMaterial(LPD3DMATERIAL7 lpMaterial)
431449 {
Index: ddraw/glDirect3DLight.cpp
@@ -75,6 +75,7 @@
7676 void glDirect3DLight::SetLight7(LPD3DLIGHT7 lpLight7)
7777 {
7878 memcpy(&light,lpLight7,sizeof(D3DLIGHT7));
 79+ if(gllight != -1) SetGLLight(gllight);
7980 }
8081
8182 HRESULT WINAPI glDirect3DLight::GetLight(LPD3DLIGHT lpLight)