]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/anim/animhost.qc
Fix FL_WEAPON flag overlapping FL_JUMPRELEASED. This unintentional change was introdu...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / anim / animhost.qc
index c46334d530aed763cd3e0c8706e387131e0d1730..3009ab4eaf8b00f47fd4efdf362b3c0ba42b67b0 100644 (file)
+#include "animhost.qh"
+
 #include "../menu.qh"
 
-#ifdef INTERFACE
-CLASS(AnimHost) EXTENDS(Object)
-       METHOD(AnimHost, addAnim, void(entity, entity))
-       METHOD(AnimHost, removeAnim, void(entity, entity))
-       METHOD(AnimHost, removeAllAnim, void(entity))
-       METHOD(AnimHost, removeObjAnim, void(entity, entity))
-       METHOD(AnimHost, stopAllAnim, void(entity))
-       METHOD(AnimHost, stopObjAnim, void(entity, entity))
-       METHOD(AnimHost, resumeAllAnim, void(entity))
-       METHOD(AnimHost, resumeObjAnim, 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)
-ENDCLASS(AnimHost)
-.entity nextSibling;
-.entity prevSibling;
-#endif
-
-#ifdef IMPLEMENTATION
-void AnimHost_addAnim(entity me, entity other)
-{
-       if(other.parent)
-               error("Can't add already added anim!");
-
-       if(other.isFinished(other))
-               error("Can't add finished anim!");
-
-       other.parent = me;
-
-       entity l;
-       l = me.lastChild;
-
-       if(l)
-               l.nextSibling = other;
-       else
-               me.firstChild = other;
-
-       other.prevSibling = l;
-       other.nextSibling = NULL;
-       me.lastChild = other;
-}
-
-void AnimHost_removeAnim(entity me, entity other)
-{
-       if(other.parent != me)
-               error("Can't remove from wrong AnimHost!");
-
-       other.parent = NULL;
-
-       entity n, p;
-       n = other.nextSibling;
-       p = other.prevSibling;
-
-       if(p)
-               p.nextSibling = n;
-       else
-               me.firstChild = n;
-
-       if(n)
-               n.prevSibling = p;
-       else
-               me.lastChild = p;
-       remove(other);
-}
-
-void AnimHost_removeAllAnim(entity me)
-{
-       entity e, tmp;
-       for(e = me.firstChild; e; e = e.nextSibling)
+#include "animation.qh"
+
+    .entity parent;
+       METHOD(AnimHost, addAnim, void(entity this, entity other))
        {
-               tmp = e;
-               e = tmp.prevSibling;
-               me.removeAnim(me, tmp);
+               if (other.parent) error("Can't add already added anim!");
+
+               if (other.isFinished(other)) error("Can't add finished anim!");
+
+               other.parent = this;
+
+               entity l = this.lastChild;
+
+               if (l) l.nextSibling = other;
+               else this.firstChild = other;
+
+               other.prevSibling = l;
+               other.nextSibling = NULL;
+               this.lastChild = other;
+       }
+
+       METHOD(AnimHost, removeAnim, void(entity this, entity other))
+       {
+               if (other.parent != this) error("Can't remove from wrong AnimHost!");
+
+               other.parent = NULL;
+
+               entity n = other.nextSibling;
+               entity p = other.prevSibling;
+
+               if (p) p.nextSibling = n;
+               else this.firstChild = n;
+
+               if (n) n.prevSibling = p;
+               else this.lastChild = p;
+               delete(other);
        }
-}
 
-void AnimHost_removeObjAnim(entity me, entity obj)
-{
-       entity e, tmp;
-       for(e = me.firstChild; e; e = e.nextSibling)
+       METHOD(AnimHost, removeAllAnim, void(entity this))
        {
-               if (e.object == obj)
+               for (entity e = this.firstChild; e; e = e.nextSibling)
                {
-                       tmp = e;
+                       entity tmp = e;
                        e = tmp.prevSibling;
-                       me.removeAnim(me, tmp);
+                       this.removeAnim(this, tmp);
                }
        }
-}
 
-void AnimHost_stopAllAnim(entity me)
-{
-       entity e;
-       for(e = me.firstChild; e; e = e.nextSibling)
+       METHOD(AnimHost, removeObjAnim, void(entity this, entity obj))
        {
-               e.stopAnim(e);
+               for (entity e = this.firstChild; e; e = e.nextSibling)
+               {
+                       if (e.object == obj)
+                       {
+                               entity tmp = e;
+                               e = tmp.prevSibling;
+                               this.removeAnim(this, tmp);
+                       }
+               }
        }
-}
 
-void AnimHost_stopObjAnim(entity me, entity obj)
-{
-       entity e;
-       for(e = me.firstChild; e; e = e.nextSibling)
+       METHOD(AnimHost, stopAllAnim, void(entity this))
        {
-               if (e.object == obj)
-               {
+               for (entity e = this.firstChild; e; e = e.nextSibling)
                        e.stopAnim(e);
-               }
        }
-}
 
-void AnimHost_resumeAllAnim(entity me)
-{
-       entity e;
-       for(e = me.firstChild; e; e = e.nextSibling)
+       METHOD(AnimHost, stopObjAnim, void(entity this, entity obj))
        {
-               e.resumeAnim(e);
+               for (entity e = this.firstChild; e; e = e.nextSibling)
+                       if (e.object == obj) e.stopAnim(e);
        }
-}
 
-void AnimHost_resumeObjAnim(entity me, entity obj)
-{
-       entity e;
-       for(e = me.firstChild; e; e = e.nextSibling)
+       METHOD(AnimHost, resumeAllAnim, void(entity this))
        {
-               if (e.object == obj)
-               {
+               for (entity e = this.firstChild; e; e = e.nextSibling)
                        e.resumeAnim(e);
-               }
        }
-}
 
-void AnimHost_finishAllAnim(entity me)
-{
-       entity e, tmp;
-       for(e = me.firstChild; e; e = e.nextSibling)
+       METHOD(AnimHost, resumeObjAnim, void(entity this, entity obj))
        {
-               tmp = e;
-               e = tmp.prevSibling;
-               tmp.finishAnim(tmp);
+               for (entity e = this.firstChild; e; e = e.nextSibling)
+                       if (e.object == obj) e.resumeAnim(e);
        }
-}
 
-void AnimHost_finishObjAnim(entity me, entity obj)
-{
-       entity e, tmp;
-       for(e = me.firstChild; e; e = e.nextSibling)
+       METHOD(AnimHost, finishAllAnim, void(entity this))
        {
-               if (e.object == obj)
+               for (entity e = this.firstChild; e; e = e.nextSibling)
                {
-                       tmp = e;
+                       entity tmp = e;
                        e = tmp.prevSibling;
                        tmp.finishAnim(tmp);
                }
        }
-}
 
-void AnimHost_tickAll(entity me)
-{
-       entity e, tmp;
-       for(e = me.firstChild; e; e = e.nextSibling)
+       METHOD(AnimHost, finishObjAnim, void(entity this, entity obj))
        {
-               e.tick(e, time);
-               if (e.isFinished(e))
+               for (entity e = this.firstChild; e; e = e.nextSibling)
                {
-                       tmp = e;
-                       e = tmp.prevSibling;
-                       me.removeAnim(me, tmp);
+                       if (e.object == obj)
+                       {
+                               entity tmp = e;
+                               e = tmp.prevSibling;
+                               tmp.finishAnim(tmp);
+                       }
+               }
+       }
+
+       METHOD(AnimHost, tickAll, void(entity this))
+       {
+               for (entity e = this.firstChild; e; e = e.nextSibling)
+               {
+                       e.tick(e, time);
+                       if (e.isFinished(e))
+                       {
+                               entity tmp = e;
+                               e = tmp.prevSibling;
+                               this.removeAnim(this, tmp);
+                       }
                }
        }
-}
-#endif