From: Stephan Stahl Date: Mon, 17 May 2010 10:59:09 +0000 (+0000) Subject: stop old slider animation before starting a new one X-Git-Tag: xonotic-v0.1.0preview~578^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b1d878aa39a1051142f3182603478eed02bc7b4f;p=xonotic%2Fxonotic-data.pk3dir.git stop old slider animation before starting a new one --- diff --git a/qcsrc/menu/anim/animhost.c b/qcsrc/menu/anim/animhost.c index 1052e2a1b..38c9894ea 100644 --- a/qcsrc/menu/anim/animhost.c +++ b/qcsrc/menu/anim/animhost.c @@ -3,7 +3,9 @@ CLASS(AnimHost) EXTENDS(Object) METHOD(AnimHost, addAnim, void(entity, entity)) METHOD(AnimHost, removeAnim, void(entity, entity)) METHOD(AnimHost, stopAllAnim, void(entity)) + METHOD(AnimHost, stopObjAnim, void(entity, entity)) METHOD(AnimHost, finishAllAnim, void(entity)) + METHOD(AnimHost, finishObjAnim, void(entity, entity)) METHOD(AnimHost, tickAll, void(entity)) ATTRIB(AnimHost, firstChild, entity, NULL) ATTRIB(AnimHost, lastChild, entity, NULL) @@ -70,6 +72,18 @@ void stopAllAnimAnimHost(entity me) } } +void stopObjAnimAnimHost(entity me, entity obj) +{ + entity e; + for(e = me.firstChild; e; e = e.nextSibling) + { + if (e.object == obj) + { + e.stopAnim(e); + } + } +} + void finishAllAnimAnimHost(entity me) { entity e, tmp; @@ -78,7 +92,22 @@ void finishAllAnimAnimHost(entity me) tmp = e; e = tmp.prevSibling; me.removeAnim(me, tmp); - e.finishAnim(tmp); + tmp.finishAnim(tmp); + } +} + +void finishObjAnimAnimHost(entity me, entity obj) +{ + entity e, tmp; + for(e = me.firstChild; e; e = e.nextSibling) + { + if (e.object == obj) + { + tmp = e; + e = tmp.prevSibling; + me.removeAnim(me, tmp); + tmp.finishAnim(tmp); + } } } diff --git a/qcsrc/menu/item/slider.c b/qcsrc/menu/item/slider.c index 38b6ef3c2..c5605affe 100644 --- a/qcsrc/menu/item/slider.c +++ b/qcsrc/menu/item/slider.c @@ -47,6 +47,7 @@ ENDCLASS(Slider) void setValueSlider(entity me, float val) { if (me.animated) { + anim.finishObjAnim(anim, me); makeHostedEasing(me, setSliderValueSlider, easingQuadInOut, 1, me.sliderValue, val); } else { me.setSliderValue(me, val);