diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 55753c4fcd6834cbe530a889ba789b0935ee63b6..28af7d06eece29a9dbce1d3e1c967cf3ee299a2c 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -4375,9 +4375,7 @@ static HRESULT WINAPI d3d3_CreateLight(IDirect3D3 *iface, IDirect3DLight **light return DDERR_OUTOFMEMORY; } - object->lpVtbl = &IDirect3DLight_Vtbl; - object->ref = 1; - object->ddraw = ddraw_from_d3d3(iface); + d3d_light_init(object, ddraw_from_d3d3(iface)); TRACE("Created light %p.\n", object); *light = (IDirect3DLight *)object; diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index fe65b79d2165f609c1257ddb206d1d3eb89f4c37..f7ea61dac0a5e7f8a7ceab913bf43c2d63984db5 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -525,12 +525,10 @@ struct IDirect3DLightImpl IDirect3DLightImpl *next; }; -/* Vtable */ -extern const IDirect3DLightVtbl IDirect3DLight_Vtbl DECLSPEC_HIDDEN; - /* Helper functions */ void light_activate(IDirect3DLightImpl *light) DECLSPEC_HIDDEN; void light_deactivate(IDirect3DLightImpl *light) DECLSPEC_HIDDEN; +void d3d_light_init(IDirect3DLightImpl *light, IDirectDrawImpl *ddraw) DECLSPEC_HIDDEN; /****************************************************************************** * IDirect3DMaterial implementation structure - Wraps to D3D7 diff --git a/dlls/ddraw/light.c b/dlls/ddraw/light.c index 9726d862b1b10c8b91a1c0f805187893f9bc4874..3cf26b505c5f12cb819da963c53218c7787dbc89 100644 --- a/dlls/ddraw/light.c +++ b/dlls/ddraw/light.c @@ -287,7 +287,7 @@ IDirect3DLightImpl_GetLight(IDirect3DLight *iface, return DD_OK; } -const IDirect3DLightVtbl IDirect3DLight_Vtbl = +static const struct IDirect3DLightVtbl d3d_light_vtbl = { /*** IUnknown Methods ***/ IDirect3DLightImpl_QueryInterface, @@ -298,3 +298,10 @@ const IDirect3DLightVtbl IDirect3DLight_Vtbl = IDirect3DLightImpl_SetLight, IDirect3DLightImpl_GetLight }; + +void d3d_light_init(IDirect3DLightImpl *light, IDirectDrawImpl *ddraw) +{ + light->lpVtbl = &d3d_light_vtbl; + light->ref = 1; + light->ddraw = ddraw; +}