]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/anim/animhost.c
Use one less loop
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / anim / animhost.c
index 41a26d5e0dace443b32be76b912810c04d4e9a38..48a45bda8465795e8883373ab088918783c4c0d3 100644 (file)
@@ -19,7 +19,7 @@ ENDCLASS(AnimHost)
 #endif
 
 #ifdef IMPLEMENTATION
-void addAnimAnimHost(entity me, entity other)
+void AnimHost_addAnim(entity me, entity other)
 {
        if(other.parent)
                error("Can't add already added anim!");
@@ -43,7 +43,7 @@ void addAnimAnimHost(entity me, entity other)
        me.lastChild = other;
 }
 
-void removeAnimAnimHost(entity me, entity other)
+void AnimHost_removeAnim(entity me, entity other)
 {
        if(other.parent != me)
                error("Can't remove from wrong AnimHost!");
@@ -65,9 +65,10 @@ void removeAnimAnimHost(entity me, entity other)
                n.prevSibling = p;
        else
                me.lastChild = p;
+       remove(other);
 }
 
-void removeAllAnimAnimHost(entity me)
+void AnimHost_removeAllAnim(entity me)
 {
        entity e, tmp;
        for(e = me.firstChild; e; e = e.nextSibling)
@@ -78,7 +79,7 @@ void removeAllAnimAnimHost(entity me)
        }
 }
 
-void removeObjAnimAnimHost(entity me, entity obj)
+void AnimHost_removeObjAnim(entity me, entity obj)
 {
        entity e, tmp;
        for(e = me.firstChild; e; e = e.nextSibling)
@@ -92,7 +93,7 @@ void removeObjAnimAnimHost(entity me, entity obj)
        }
 }
 
-void stopAllAnimAnimHost(entity me)
+void AnimHost_stopAllAnim(entity me)
 {
        entity e;
        for(e = me.firstChild; e; e = e.nextSibling)
@@ -101,7 +102,7 @@ void stopAllAnimAnimHost(entity me)
        }
 }
 
-void stopObjAnimAnimHost(entity me, entity obj)
+void AnimHost_stopObjAnim(entity me, entity obj)
 {
        entity e;
        for(e = me.firstChild; e; e = e.nextSibling)
@@ -113,7 +114,7 @@ void stopObjAnimAnimHost(entity me, entity obj)
        }
 }
 
-void resumeAllAnimAnimHost(entity me)
+void AnimHost_resumeAllAnim(entity me)
 {
        entity e;
        for(e = me.firstChild; e; e = e.nextSibling)
@@ -122,7 +123,7 @@ void resumeAllAnimAnimHost(entity me)
        }
 }
 
-void resumeObjAnimAnimHost(entity me, entity obj)
+void AnimHost_resumeObjAnim(entity me, entity obj)
 {
        entity e;
        for(e = me.firstChild; e; e = e.nextSibling)
@@ -134,19 +135,18 @@ void resumeObjAnimAnimHost(entity me, entity obj)
        }
 }
 
-void finishAllAnimAnimHost(entity me)
+void AnimHost_finishAllAnim(entity me)
 {
        entity e, tmp;
        for(e = me.firstChild; e; e = e.nextSibling)
        {
                tmp = e;
                e = tmp.prevSibling;
-               me.removeAnim(me, tmp);
                tmp.finishAnim(tmp);
        }
 }
 
-void finishObjAnimAnimHost(entity me, entity obj)
+void AnimHost_finishObjAnim(entity me, entity obj)
 {
        entity e, tmp;
        for(e = me.firstChild; e; e = e.nextSibling)
@@ -155,27 +155,22 @@ void finishObjAnimAnimHost(entity me, entity obj)
                {
                        tmp = e;
                        e = tmp.prevSibling;
-                       me.removeAnim(me, tmp);
                        tmp.finishAnim(tmp);
                }
        }
 }
 
-void tickAllAnimHost(entity me)
+void AnimHost_tickAll(entity me)
 {
        entity e, tmp;
        for(e = me.firstChild; e; e = e.nextSibling)
        {
                e.tick(e, time);
-       }
-       for(e = me.firstChild; e; e = e.nextSibling)
-       {
                if (e.isFinished(e))
                {
                        tmp = e;
                        e = tmp.prevSibling;
                        me.removeAnim(me, tmp);
-                       remove(tmp);
                }
        }
 }