Commit 1f38c0b1 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d3drm: Store animation options.

parent 9c84b065
......@@ -214,6 +214,7 @@ struct d3drm_animation
LONG ref;
IDirect3DRM *d3drm;
IDirect3DRMFrame3 *frame;
D3DRMANIMATIONOPTIONS options;
};
struct d3drm_wrap
......
......@@ -3238,11 +3238,38 @@ static HRESULT WINAPI d3drm_animation1_GetClassName(IDirect3DRMAnimation *iface,
return d3drm_animation2_GetClassName(&animation->IDirect3DRMAnimation2_iface, size, name);
}
static HRESULT WINAPI d3drm_animation2_SetOptions(IDirect3DRMAnimation2 *iface, D3DRMANIMATIONOPTIONS options)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
static const DWORD supported_options = D3DRMANIMATION_OPEN | D3DRMANIMATION_CLOSED | D3DRMANIMATION_LINEARPOSITION
| D3DRMANIMATION_SPLINEPOSITION | D3DRMANIMATION_SCALEANDROTATION | D3DRMANIMATION_POSITION;
TRACE("iface %p, options %#x.\n", iface, options);
if (!(options & supported_options))
return D3DRMERR_BADVALUE;
if ((options & (D3DRMANIMATION_OPEN | D3DRMANIMATION_CLOSED)) == (D3DRMANIMATION_OPEN | D3DRMANIMATION_CLOSED) ||
(options & (D3DRMANIMATION_LINEARPOSITION | D3DRMANIMATION_SPLINEPOSITION)) ==
(D3DRMANIMATION_LINEARPOSITION | D3DRMANIMATION_SPLINEPOSITION) ||
(options & (D3DRMANIMATION_SCALEANDROTATION | D3DRMANIMATION_POSITION)) ==
(D3DRMANIMATION_SCALEANDROTATION | D3DRMANIMATION_POSITION))
{
return D3DRMERR_BADVALUE;
}
animation->options = options;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_animation1_SetOptions(IDirect3DRMAnimation *iface, D3DRMANIMATIONOPTIONS options)
{
FIXME("iface %p, %#x.\n", iface, options);
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
return E_NOTIMPL;
TRACE("iface %p, %#x.\n", iface, options);
return d3drm_animation2_SetOptions(&animation->IDirect3DRMAnimation2_iface, options);
}
static HRESULT WINAPI d3drm_animation1_AddRotateKey(IDirect3DRMAnimation *iface, D3DVALUE time, D3DRMQUATERNION *q)
......@@ -3301,18 +3328,22 @@ static HRESULT WINAPI d3drm_animation1_SetTime(IDirect3DRMAnimation *iface, D3DV
return E_NOTIMPL;
}
static D3DRMANIMATIONOPTIONS WINAPI d3drm_animation1_GetOptions(IDirect3DRMAnimation *iface)
static D3DRMANIMATIONOPTIONS WINAPI d3drm_animation2_GetOptions(IDirect3DRMAnimation2 *iface)
{
FIXME("iface %p.\n", iface);
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
return 0;
TRACE("iface %p.\n", iface);
return animation->options;
}
static HRESULT WINAPI d3drm_animation2_SetOptions(IDirect3DRMAnimation2 *iface, D3DRMANIMATIONOPTIONS options)
static D3DRMANIMATIONOPTIONS WINAPI d3drm_animation1_GetOptions(IDirect3DRMAnimation *iface)
{
FIXME("iface %p, options %#x.\n", iface, options);
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
return E_NOTIMPL;
TRACE("iface %p.\n", iface);
return d3drm_animation2_GetOptions(&animation->IDirect3DRMAnimation2_iface);
}
static HRESULT WINAPI d3drm_animation2_AddRotateKey(IDirect3DRMAnimation2 *iface, D3DVALUE time, D3DRMQUATERNION *q)
......@@ -3363,13 +3394,6 @@ static HRESULT WINAPI d3drm_animation2_SetTime(IDirect3DRMAnimation2 *iface, D3D
return E_NOTIMPL;
}
static D3DRMANIMATIONOPTIONS WINAPI d3drm_animation2_GetOptions(IDirect3DRMAnimation2 *iface)
{
FIXME("iface %p.\n", iface);
return 0;
}
static HRESULT WINAPI d3drm_animation2_GetFrame(IDirect3DRMAnimation2 *iface, IDirect3DRMFrame3 **frame)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
......@@ -3481,6 +3505,7 @@ HRESULT d3drm_animation_create(struct d3drm_animation **animation, IDirect3DRM *
object->IDirect3DRMAnimation2_iface.lpVtbl = &d3drm_animation2_vtbl;
object->d3drm = d3drm;
object->ref = 1;
object->options = D3DRMANIMATION_CLOSED | D3DRMANIMATION_LINEARPOSITION;
d3drm_object_init(&object->obj, classname);
......
......@@ -6706,6 +6706,7 @@ static void test_animation(void)
{
IDirect3DRMAnimation2 *animation2;
IDirect3DRMAnimation *animation;
D3DRMANIMATIONOPTIONS options;
IDirect3DRMObject *obj, *obj2;
IDirect3DRMFrame3 *frame3;
IDirect3DRMFrame *frame;
......@@ -6776,6 +6777,51 @@ static void test_animation(void)
IDirect3DRMFrame3_Release(frame3);
IDirect3DRMFrame_Release(frame);
/* Animation options. */
options = IDirect3DRMAnimation_GetOptions(animation);
ok(options == (D3DRMANIMATION_CLOSED | D3DRMANIMATION_LINEARPOSITION),
"Unexpected default options %#x.\n", options);
/* Undefined mask value */
hr = IDirect3DRMAnimation_SetOptions(animation, 0xf0000000);
ok(hr == D3DRMERR_BADVALUE, "Unexpected hr %#x.\n", hr);
options = IDirect3DRMAnimation_GetOptions(animation);
ok(options == (D3DRMANIMATION_CLOSED | D3DRMANIMATION_LINEARPOSITION),
"Unexpected default options %#x.\n", options);
/* Ambiguous mask */
hr = IDirect3DRMAnimation_SetOptions(animation, D3DRMANIMATION_OPEN | D3DRMANIMATION_CLOSED);
ok(hr == D3DRMERR_BADVALUE, "Unexpected hr %#x.\n", hr);
hr = IDirect3DRMAnimation_SetOptions(animation, D3DRMANIMATION_LINEARPOSITION | D3DRMANIMATION_SPLINEPOSITION);
ok(hr == D3DRMERR_BADVALUE, "Unexpected hr %#x.\n", hr);
hr = IDirect3DRMAnimation_SetOptions(animation, D3DRMANIMATION_SCALEANDROTATION | D3DRMANIMATION_POSITION);
ok(hr == D3DRMERR_BADVALUE, "Unexpected hr %#x.\n", hr);
options = IDirect3DRMAnimation_GetOptions(animation);
ok(options == (D3DRMANIMATION_CLOSED | D3DRMANIMATION_LINEARPOSITION),
"Unexpected default options %#x.\n", options);
hr = IDirect3DRMAnimation_SetOptions(animation, D3DRMANIMATION_SCALEANDROTATION);
ok(SUCCEEDED(hr), "Failed to set animation options, hr %#x.\n", hr);
options = IDirect3DRMAnimation_GetOptions(animation);
ok(options == D3DRMANIMATION_SCALEANDROTATION, "Unexpected options %#x.\n", options);
hr = IDirect3DRMAnimation_SetOptions(animation, D3DRMANIMATION_OPEN);
ok(SUCCEEDED(hr), "Failed to set animation options, hr %#x.\n", hr);
options = IDirect3DRMAnimation_GetOptions(animation);
ok(options == D3DRMANIMATION_OPEN, "Unexpected options %#x.\n", options);
hr = IDirect3DRMAnimation_SetOptions(animation, 0);
ok(hr == D3DRMERR_BADVALUE, "Unexpected hr %#x.\n", hr);
options = IDirect3DRMAnimation_GetOptions(animation);
ok(options == D3DRMANIMATION_OPEN, "Unexpected options %#x.\n", options);
IDirect3DRMAnimation2_Release(animation2);
IDirect3DRMAnimation_Release(animation);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment