2011/5/24 Dylan Smith <dylan.ah.smith(a)gmail.com>:
--- dlls/d3dx9_36/mesh.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 112 insertions(+), 5 deletions(-)
diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c index fa32797..20b3262 100644 --- a/dlls/d3dx9_36/mesh.c +++ b/dlls/d3dx9_36/mesh.c ... + strcpy(defaults->pParamName, diffuse_paramname); + defaults->pValue = defaults->pParamName + sizeof(diffuse_paramname); + defaults->Type = D3DXEDT_FLOATS; + defaults->NumBytes = sizeof(D3DCOLORVALUE); + memcpy(defaults->pValue, &material_ptr->MatD3D.Diffuse, sizeof(D3DCOLORVALUE)); + (defaults + 1)->pParamName = (LPSTR)((D3DCOLORVALUE*)defaults->pValue + 1); + defaults++; + + strcpy(defaults->pParamName, power_paramname); + defaults->pValue = defaults->pParamName + sizeof(power_paramname); + defaults->Type = D3DXEDT_FLOATS; + defaults->NumBytes = sizeof(FLOAT); + *(FLOAT*)defaults->pValue = material_ptr->MatD3D.Power; + (defaults + 1)->pParamName = (LPSTR)((FLOAT*)defaults->pValue + 1); + defaults++; ...
A nitpick maybe, but I think you could avoid to repeat the same code for each parameter by means of a loop driven by a table. It may be worth a try if it doesn't become more cumbersome than the current approach.