Pass through floats correctly to the render states at initialization. Fixes point problems
Jason
diff -u3 dx92/stateblock.c ./stateblock.c --- dx92/stateblock.c 2003-10-28 21:31:03.000000000 +0000 +++ ./stateblock.c 2003-11-01 16:18:34.000000000 +0000 @@ -57,6 +57,7 @@ D3DLINEPATTERN lp; int i; int j; + float tmpfloat = 0.0f; LPDIRECT3DDEVICE8 iface = (LPDIRECT3DDEVICE8) This; /* Note this may have a large overhead but it should only be executed @@ -97,9 +98,9 @@ IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_ZVISIBLE, 0); IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_FOGCOLOR, 0); IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_FOGTABLEMODE, D3DFOG_NONE); - IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_FOGSTART, 0.0f); - IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_FOGEND, 1.0f); - IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_FOGDENSITY, 1.0f); + tmpfloat = 0.0f; IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_FOGSTART, *((DWORD *)&tmpfloat)); + tmpfloat = 1.0f; IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_FOGEND, *((DWORD *)&tmpfloat)); + tmpfloat = 1.0f; IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_FOGDENSITY, *((DWORD *)&tmpfloat)); IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_EDGEANTIALIAS, FALSE); IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_ZBIAS, 0); IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_RANGEFOGENABLE, FALSE); @@ -141,8 +142,8 @@ IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_VERTEXBLEND, D3DVBF_DISABLE); IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_CLIPPLANEENABLE, 0); IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_SOFTWAREVERTEXPROCESSING, FALSE); - IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POINTSIZE, 1.0f); - IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POINTSIZE_MIN, 0.0f); + tmpfloat = 1.0f; IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POINTSIZE, *((DWORD *)&tmpfloat)); + tmpfloat = 0.0f; IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POINTSIZE_MIN, *((DWORD *)&tmpfloat)); IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POINTSPRITEENABLE, FALSE); IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POINTSCALEENABLE, FALSE); IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POINTSCALE_A, TRUE); @@ -151,12 +152,12 @@ IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_MULTISAMPLEANTIALIAS, TRUE); IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF); IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_PATCHEDGESTYLE, D3DPATCHEDGE_DISCRETE); - IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_PATCHSEGMENTS, 1.0f); + tmpfloat = 1.0f; IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_PATCHSEGMENTS, *((DWORD *)&tmpfloat)); IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_DEBUGMONITORTOKEN, D3DDMT_DISABLE); - IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POINTSIZE_MAX, (DWORD) 64.0f); + tmpfloat = 64.0f; IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POINTSIZE_MAX, (DWORD) *((DWORD *)&tmpfloat)); IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_INDEXEDVERTEXBLENDENABLE, FALSE); IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_COLORWRITEENABLE, 0x0000000F); - IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_TWEENFACTOR, (DWORD) 0.0f); + tmpfloat = 0.0f; IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_TWEENFACTOR, (DWORD) *((DWORD *)&tmpfloat)); IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_BLENDOP, D3DBLENDOP_ADD); IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POSITIONORDER, D3DORDER_CUBIC); IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_NORMALORDER, D3DORDER_LINEAR); diff -u3 dx92/surface.c ./surface.c --- dx92/surface.c 2003-10-31 00:33:59.000000000 +0000 +++ ./surface.c 2003-11-01 16:20:24.000000000 +0000 @@ -284,7 +284,7 @@ ICOM_THIS(IDirect3DSurface8Impl,iface); if (FALSE == This->locked) { - ERR("trying to lock unlocked surf@%p\n", This); + ERR("trying to Unlock an unlocked surf@%p\n", This); return D3DERR_INVALIDCALL; }