diff --git a/dlls/ddraw/d3dlight.c b/dlls/ddraw/d3dlight.c
index 71d597b632a6c210dbb9dedb93ca1d53a0746e6a..7c0a2f9ae2efa908b51db03588900e31cb8752af 100644
--- a/dlls/ddraw/d3dlight.c
+++ b/dlls/ddraw/d3dlight.c
@@ -49,17 +49,17 @@ static void update(IDirect3DLightImpl* This) {
     
     TRACE("Activating DIRECTIONAL\n");
     TRACE("  direction : %f %f %f\n",
-	  This->light.dvDirection.x.x,
-	  This->light.dvDirection.y.y,
-	  This->light.dvDirection.z.z);
+	  This->light.dvDirection.u1.x,
+	  This->light.dvDirection.u2.y,
+	  This->light.dvDirection.u3.z);
     _dump_colorvalue(" color    ", This->light.dcvColor);
 
     glLightfv(dlpriv->light_num, GL_AMBIENT, (float *) zero_value);
     glLightfv(dlpriv->light_num, GL_DIFFUSE, (float *) &(This->light.dcvColor));
 
-    direction[0] = -This->light.dvDirection.x.x;
-    direction[1] = -This->light.dvDirection.y.y;
-    direction[2] = -This->light.dvDirection.z.z;
+    direction[0] = -This->light.dvDirection.u1.x;
+    direction[1] = -This->light.dvDirection.u2.y;
+    direction[2] = -This->light.dvDirection.u3.z;
     direction[3] = 0.0; /* This is a directional light */
 
     glLightfv(dlpriv->light_num, GL_POSITION, (float *) direction);
diff --git a/dlls/ddraw/mesa_private.h b/dlls/ddraw/mesa_private.h
index 6daf951977abc45a71ba6641a03801c4fcdb586d..5aa5c947fb8343d3f386c3e0d3576957db3c186e 100644
--- a/dlls/ddraw/mesa_private.h
+++ b/dlls/ddraw/mesa_private.h
@@ -103,7 +103,7 @@ typedef struct mesa_d3dd_private {
 
 #define _dump_colorvalue(s,v)               \
     TRACE(" " s " : %f %f %f %f\n",           \
-	    (v).r.r, (v).g.g, (v).b.b, (v).a.a);
+	    (v).u1.r, (v).u2.g, (v).u3.b, (v).u4.a);
 
 /* Common functions defined in d3dcommon.c */
 void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
diff --git a/dlls/dsound/dsound_main.c b/dlls/dsound/dsound_main.c
index 90c3d01b74ff41df77fd0c3fdfa810d9b479d47a..f9bd75250a33441b5c155849a10c5135c75bab92 100644
--- a/dlls/dsound/dsound_main.c
+++ b/dlls/dsound/dsound_main.c
@@ -1732,18 +1732,18 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface(
 		*ppobj = (LPVOID)dsl;
 
                 dsl->ds3dl.dwSize = sizeof(DS3DLISTENER);
-                dsl->ds3dl.vPosition.x.x = 0.0;
-                dsl->ds3dl.vPosition.x.x = 0.0;
-                dsl->ds3dl.vPosition.z.z = 0.0;
-                dsl->ds3dl.vVelocity.x.x = 0.0;
-                dsl->ds3dl.vVelocity.y.y = 0.0;
-                dsl->ds3dl.vVelocity.z.z = 0.0;
-                dsl->ds3dl.vOrientFront.x.x = 0.0;
-                dsl->ds3dl.vOrientFront.y.y = 0.0;
-                dsl->ds3dl.vOrientFront.z.z = 1.0;
-                dsl->ds3dl.vOrientTop.x.x = 0.0;
-                dsl->ds3dl.vOrientTop.y.y = 1.0;
-                dsl->ds3dl.vOrientTop.z.z = 0.0;
+                dsl->ds3dl.vPosition.u1.x = 0.0;
+                dsl->ds3dl.vPosition.u2.y = 0.0;
+                dsl->ds3dl.vPosition.u3.z = 0.0;
+                dsl->ds3dl.vVelocity.u1.x = 0.0;
+                dsl->ds3dl.vVelocity.u2.y = 0.0;
+                dsl->ds3dl.vVelocity.u3.z = 0.0;
+                dsl->ds3dl.vOrientFront.u1.x = 0.0;
+                dsl->ds3dl.vOrientFront.u2.y = 0.0;
+                dsl->ds3dl.vOrientFront.u3.z = 1.0;
+                dsl->ds3dl.vOrientTop.u1.x = 0.0;
+                dsl->ds3dl.vOrientTop.u2.y = 1.0;
+                dsl->ds3dl.vOrientTop.u3.z = 0.0;
                 dsl->ds3dl.flDistanceFactor = DS3D_DEFAULTDISTANCEFACTOR;
                 dsl->ds3dl.flRolloffFactor = DS3D_DEFAULTROLLOFFFACTOR;
 
@@ -2169,18 +2169,18 @@ static HRESULT WINAPI IDirectSoundImpl_QueryInterface(
 		This->listener->dsb = NULL; 
 
 		This->listener->ds3dl.dwSize = sizeof(DS3DLISTENER);
-		This->listener->ds3dl.vPosition.x.x = 0.0;
-		This->listener->ds3dl.vPosition.x.x = 0.0;
-		This->listener->ds3dl.vPosition.z.z = 0.0;
-		This->listener->ds3dl.vVelocity.x.x = 0.0;
-		This->listener->ds3dl.vVelocity.y.y = 0.0;
-		This->listener->ds3dl.vVelocity.z.z = 0.0;
-		This->listener->ds3dl.vOrientFront.x.x = 0.0;
-		This->listener->ds3dl.vOrientFront.y.y = 0.0;
-		This->listener->ds3dl.vOrientFront.z.z = 1.0;
-		This->listener->ds3dl.vOrientTop.x.x = 0.0;
-		This->listener->ds3dl.vOrientTop.y.y = 1.0;
-		This->listener->ds3dl.vOrientTop.z.z = 0.0;
+		This->listener->ds3dl.vPosition.u1.x = 0.0;
+		This->listener->ds3dl.vPosition.u2.y = 0.0;
+		This->listener->ds3dl.vPosition.u3.z = 0.0;
+		This->listener->ds3dl.vVelocity.u1.x = 0.0;
+		This->listener->ds3dl.vVelocity.u2.y = 0.0;
+		This->listener->ds3dl.vVelocity.u3.z = 0.0;
+		This->listener->ds3dl.vOrientFront.u1.x = 0.0;
+		This->listener->ds3dl.vOrientFront.u2.y = 0.0;
+		This->listener->ds3dl.vOrientFront.u3.z = 1.0;
+		This->listener->ds3dl.vOrientTop.u1.x = 0.0;
+		This->listener->ds3dl.vOrientTop.u2.y = 1.0;
+		This->listener->ds3dl.vOrientTop.u3.z = 0.0;
 		This->listener->ds3dl.flDistanceFactor = DS3D_DEFAULTDISTANCEFACTOR;
 		This->listener->ds3dl.flRolloffFactor = DS3D_DEFAULTROLLOFFFACTOR;
 		This->listener->ds3dl.flDopplerFactor = DS3D_DEFAULTDOPPLERFACTOR;
diff --git a/include/d3dtypes.h b/include/d3dtypes.h
index 67f71d26ca521f3691027f44786a1612c5cad4aa..cbfd9141202afa27213312e068ab5c477c24ae50 100644
--- a/include/d3dtypes.h
+++ b/include/d3dtypes.h
@@ -69,54 +69,86 @@ typedef struct _D3DCOLORVALUE {
         union {
                 D3DVALUE r;
                 D3DVALUE dvR;
-        } r;
+        } DUMMYUNIONNAME1;
         union {
                 D3DVALUE g;
                 D3DVALUE dvG;
-        } g;
+        } DUMMYUNIONNAME2;
         union {
                 D3DVALUE b;
                 D3DVALUE dvB;
-        } b;
+        } DUMMYUNIONNAME3;
         union {
                 D3DVALUE a;
                 D3DVALUE dvA;
-        } a;
+        } DUMMYUNIONNAME4;
 } D3DCOLORVALUE,*LPD3DCOLORVALUE;
 
 typedef struct _D3DRECT {
   union {
     LONG x1;
     LONG lX1;
-  } x1;
+  } DUMMYUNIONNAME1;
   union {
     LONG y1;
     LONG lY1;
-  } y1;
+  } DUMMYUNIONNAME2;
   union {
     LONG x2;
     LONG lX2;
-  } x2;
+  } DUMMYUNIONNAME3;
   union {
     LONG y2;
     LONG lY2;
-  } y2;
+  } DUMMYUNIONNAME4;
 } D3DRECT, *LPD3DRECT;
 
 typedef struct _D3DVECTOR {
   union {
         D3DVALUE        x;
     D3DVALUE dvX;
-  } x;
+  } DUMMYUNIONNAME1;
   union {
         D3DVALUE        y;
     D3DVALUE dvY;
-  } y;
+  } DUMMYUNIONNAME2;
   union {
         D3DVALUE        z;
     D3DVALUE dvZ;
-  } z;
-  /* the C++ variant has operator overloads etc. too */
+  } DUMMYUNIONNAME3;
+#if defined(__cplusplus) && defined(D3D_OVERLOADS)
+  /* the definitions for these methods are in d3dvec.inl */
+public:
+  /*** constructors ***/
+  _D3DVECTOR() {}
+  _D3DVECTOR(D3DVALUE f);
+  _D3DVECTOR(D3DVALUE _x, D3DVALUE _y, D3DVALUE _z);
+  _D3DVECTOR(const D3DVALUE f[3]);
+
+  /*** assignment operators ***/
+  _D3DVECTOR& operator += (const _D3DVECTOR& v);
+  _D3DVECTOR& operator -= (const _D3DVECTOR& v);
+  _D3DVECTOR& operator *= (const _D3DVECTOR& v);
+  _D3DVECTOR& operator /= (const _D3DVECTOR& v);
+  _D3DVECTOR& operator *= (D3DVALUE s);
+  _D3DVECTOR& operator /= (D3DVALUE s);
+
+  /*** binary operators ***/
+  friend _D3DVECTOR operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
+  friend _D3DVECTOR operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2);
+
+  friend _D3DVECTOR operator * (const _D3DVECTOR& v, D3DVALUE s);
+  friend _D3DVECTOR operator * (D3DVALUE s, const _D3DVECTOR& v);
+  friend _D3DVECTOR operator / (const _D3DVECTOR& v, D3DVALUE s);
+
+  friend D3DVALUE SquareMagnitude(const _D3DVECTOR& v);
+  friend D3DVALUE Magnitude(const _D3DVECTOR& v);
+
+  friend _D3DVECTOR Normalize(const _D3DVECTOR& v);
+
+  friend D3DVALUE DotProduct(const _D3DVECTOR& v1, const _D3DVECTOR& v2);
+  friend _D3DVECTOR CrossProduct(const _D3DVECTOR& v1, const _D3DVECTOR& v2);
+#endif
 } D3DVECTOR,*LPD3DVECTOR;
 
 typedef struct _D3DHVERTEX {
@@ -250,6 +282,10 @@ typedef struct {
   /* FIXME: Some C++ stuff here */
 } D3DMATRIX, *LPD3DMATRIX;
 
+#if defined(__cplusplus) && defined(D3D_OVERLOADS)
+#include "d3dvec.inl"
+#endif
+
 typedef struct _D3DVIEWPORT {
   DWORD       dwSize;
   DWORD       dwX;
@@ -421,23 +457,23 @@ typedef struct _D3DMATERIAL7 {
   union {
     D3DCOLORVALUE   diffuse;
     D3DCOLORVALUE   dcvDiffuse;
-  }a;
+  } DUMMYUNIONNAME;
   union {
     D3DCOLORVALUE   ambient;
     D3DCOLORVALUE   dcvAmbient;
-  }b;
+  } DUMMYUNIONNAME1;
   union {
     D3DCOLORVALUE   specular;
     D3DCOLORVALUE   dcvSpecular;
-  }c;
+  } DUMMYUNIONNAME2;
   union {
     D3DCOLORVALUE   emissive;
     D3DCOLORVALUE   dcvEmissive;
-  }d;
+  } DUMMYUNIONNAME3;
   union {
     D3DVALUE        power;
     D3DVALUE        dvPower;
-  }e;
+  } DUMMYUNIONNAME4;
 } D3DMATERIAL7, *LPD3DMATERIAL7;
 
 typedef enum {
diff --git a/include/d3dvec.inl b/include/d3dvec.inl
new file mode 100644
index 0000000000000000000000000000000000000000..03dc5f59a210cc686814b5ae5a6226db4afbeaaf
--- /dev/null
+++ b/include/d3dvec.inl
@@ -0,0 +1,111 @@
+#ifndef __WINE_D3DVEC_INL
+#define __WINE_D3DVEC_INL
+
+/*** constructors ***/
+
+inline _D3DVECTOR::_D3DVECTOR(D3DVALUE f)
+{
+  x = y = z = f;
+}
+
+inline _D3DVECTOR::_D3DVECTOR(D3DVALUE _x, D3DVALUE _y, D3DVALUE _z)
+{
+  x = _x; y = _y; z = _z;
+}
+
+/*** assignment operators ***/
+
+inline _D3DVECTOR& _D3DVECTOR::operator += (const _D3DVECTOR& v)
+{
+  x += v.x; y += v.y; z += v.z;
+  return *this;
+}
+
+inline _D3DVECTOR& _D3DVECTOR::operator -= (const _D3DVECTOR& v)
+{
+  x -= v.x; y -= v.y; z -= v.z;
+  return *this;
+}
+
+inline _D3DVECTOR& _D3DVECTOR::operator *= (const _D3DVECTOR& v)
+{
+  x *= v.x; y *= v.y; z *= v.z;
+  return *this;
+}
+
+inline _D3DVECTOR& _D3DVECTOR::operator /= (const _D3DVECTOR& v)
+{
+  x /= v.x; y /= v.y; z /= v.z;
+  return *this;
+}
+
+inline _D3DVECTOR& _D3DVECTOR::operator *= (D3DVALUE s)
+{
+  x *= s; y *= s; z *= s;
+  return *this;
+}
+
+inline _D3DVECTOR& _D3DVECTOR::operator /= (D3DVALUE s)
+{
+  x /= s; y /= s; z /= s;
+  return *this;
+}
+
+/*** binary operators ***/
+
+inline _D3DVECTOR operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
+{
+  return _D3DVECTOR(v1.x+v2.x, v1.y+v2.y, v1.z+v2.z);
+}
+
+inline _D3DVECTOR operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
+{
+  return _D3DVECTOR(v1.x-v2.x, v1.y-v2.y, v1.z-v2.z);
+}
+
+inline _D3DVECTOR operator * (const _D3DVECTOR& v, D3DVALUE s)
+{
+  return _D3DVECTOR(v.x*s, v.y*s, v.z*s);
+}
+
+inline _D3DVECTOR operator * (D3DVALUE s, const _D3DVECTOR& v)
+{
+  return _D3DVECTOR(v.x*s, v.y*s, v.z*s);
+}
+
+inline _D3DVECTOR operator / (const _D3DVECTOR& v, D3DVALUE s)
+{
+  return _D3DVECTOR(v.x/s, v.y/s, v.z/s);
+}
+
+inline D3DVALUE SquareMagnitude(const _D3DVECTOR& v)
+{
+  return v.x*v.x + v.y*v.y + v.z*v.z; /* DotProduct(v, v) */
+}
+
+inline D3DVALUE Magnitude(const _D3DVECTOR& v)
+{
+  return sqrt(SquareMagnitude(v));
+}
+
+inline _D3DVECTOR Normalize(const _D3DVECTOR& v)
+{
+  return v / Magnitude(v);
+}
+
+inline D3DVALUE DotProduct(const _D3DVECTOR& v1, const _D3DVECTOR& v2)
+{
+  return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z;
+}
+
+inline _D3DVECTOR CrossProduct(const _D3DVECTOR& v1, const _D3DVECTOR& v2)
+{
+  _D3DVECTOR res;
+  /* this is a left-handed cross product, right? */
+  res.x = v1.y * v2.z - v1.z * v2.y;
+  res.y = v1.z * v2.x - v1.x * v2.z;
+  res.z = v1.x * v2.y - v1.y * v2.x;
+  return res;
+}
+
+#endif