]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
stop old slider animation before starting a new one
authorStephan Stahl <esteel@eos.franken.de>
Mon, 17 May 2010 10:59:09 +0000 (10:59 +0000)
committerStephan Stahl <esteel@eos.franken.de>
Mon, 17 May 2010 10:59:09 +0000 (10:59 +0000)
qcsrc/menu/anim/animhost.c
qcsrc/menu/item/slider.c

index 1052e2a1bcb99e6b91306fcbc2bbe4833fa1a806..38c9894eaf6a76437a33057706cdc37650f7334e 100644 (file)
@@ -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);
+               }
        }
 }
 
index 38b6ef3c294056f913d303f79a117faca013691b..c5605affed01261268c976ac7ff581ebf84a201a 100644 (file)
@@ -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);