From: Aida JonikienÄ— aidas957@gmail.com
The subsequent tests reveal the angle between front and top vectors must be higher than 0 degrees. --- dlls/dsound/sound3d.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/dlls/dsound/sound3d.c b/dlls/dsound/sound3d.c index 8fe10788235..554d1de3b8f 100644 --- a/dlls/dsound/sound3d.c +++ b/dlls/dsound/sound3d.c @@ -969,16 +969,22 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_SetOrientation(IDirectSound3DLi D3DVALUE xFront, D3DVALUE yFront, D3DVALUE zFront, D3DVALUE xTop, D3DVALUE yTop, D3DVALUE zTop, DWORD dwApply) { - IDirectSoundBufferImpl *This = impl_from_IDirectSound3DListener(iface); + IDirectSoundBufferImpl *This = impl_from_IDirectSound3DListener(iface); + D3DVECTOR front = {.x = xFront, .y = yFront, .z = zFront}; + D3DVECTOR top = {.x = xTop, .y = yTop, .z = zTop}; + D3DVALUE angle = 0;
TRACE("setting: Front vector = (%f,%f,%f); Top vector = (%f,%f,%f); dwApply = %ld\n", xFront, yFront, zFront, xTop, yTop, zTop, dwApply); - This->device->ds3dl.vOrientFront.x = xFront; - This->device->ds3dl.vOrientFront.y = yFront; - This->device->ds3dl.vOrientFront.z = zFront; - This->device->ds3dl.vOrientTop.x = xTop; - This->device->ds3dl.vOrientTop.y = yTop; - This->device->ds3dl.vOrientTop.z = zTop; + + if ((angle = AngleBetweenVectorsDeg(&front, &top)) == 0.0f) + { + WARN("Angle %f is 0 degrees\n", angle); + return DSERR_INVALIDPARAM; + } + + This->device->ds3dl.vOrientFront = front; + This->device->ds3dl.vOrientTop = top; if (dwApply == DS3D_IMMEDIATE) { This->device->ds3dl_need_recalc = FALSE;