]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/anim/animhost.qc
take3: format 903 files
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / anim / animhost.qc
index 3009ab4eaf8b00f47fd4efdf362b3c0ba42b67b0..d5419f88e5025452beb3d963d2fb4892d096362a 100644 (file)
 
 #include "animation.qh"
 
-    .entity parent;
-       METHOD(AnimHost, addAnim, void(entity this, entity other))
-       {
-               if (other.parent) error("Can't add already added anim!");
+.entity parent;
+METHOD(AnimHost, addAnim, void(entity this, entity other))
+{
+       if (other.parent) { error("Can't add already added anim!"); }
 
-               if (other.isFinished(other)) error("Can't add finished anim!");
+       if (other.isFinished(other)) { error("Can't add finished anim!"); }
 
-               other.parent = this;
+       other.parent = this;
 
-               entity l = this.lastChild;
+       entity l = this.lastChild;
 
-               if (l) l.nextSibling = other;
-               else this.firstChild = other;
+       if (l) { l.nextSibling = other; } else { this.firstChild = other; }
 
-               other.prevSibling = l;
-               other.nextSibling = NULL;
-               this.lastChild = 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!"); }
 
-       METHOD(AnimHost, removeAnim, void(entity this, entity other))
-       {
-               if (other.parent != this) error("Can't remove from wrong AnimHost!");
+       other.parent = NULL;
 
-               other.parent = NULL;
+       entity n = other.nextSibling;
+       entity p = other.prevSibling;
 
-               entity n = other.nextSibling;
-               entity p = other.prevSibling;
+       if (p) { p.nextSibling = n; } else { this.firstChild = n; }
 
-               if (p) p.nextSibling = n;
-               else this.firstChild = n;
+       if (n) { n.prevSibling = p; } else { this.lastChild = p; }
+       delete(other);
+}
 
-               if (n) n.prevSibling = p;
-               else this.lastChild = p;
-               delete(other);
+METHOD(AnimHost, removeAllAnim, void(entity this))
+{
+       for (entity e = this.firstChild; e; e = e.nextSibling) {
+               entity tmp = e;
+               e = tmp.prevSibling;
+               this.removeAnim(this, tmp);
        }
+}
 
-       METHOD(AnimHost, removeAllAnim, void(entity this))
-       {
-               for (entity e = this.firstChild; e; e = e.nextSibling)
-               {
+METHOD(AnimHost, removeObjAnim, void(entity this, entity obj))
+{
+       for (entity e = this.firstChild; e; e = e.nextSibling) {
+               if (e.object == obj) {
                        entity tmp = e;
                        e = tmp.prevSibling;
                        this.removeAnim(this, tmp);
                }
        }
+}
 
-       METHOD(AnimHost, removeObjAnim, void(entity this, entity obj))
-       {
-               for (entity e = this.firstChild; e; e = e.nextSibling)
-               {
-                       if (e.object == obj)
-                       {
-                               entity tmp = e;
-                               e = tmp.prevSibling;
-                               this.removeAnim(this, tmp);
-                       }
-               }
-       }
-
-       METHOD(AnimHost, stopAllAnim, void(entity this))
-       {
-               for (entity e = this.firstChild; e; e = e.nextSibling)
-                       e.stopAnim(e);
+METHOD(AnimHost, stopAllAnim, void(entity this))
+{
+       for (entity e = this.firstChild; e; e = e.nextSibling) {
+               e.stopAnim(e);
        }
-
-       METHOD(AnimHost, stopObjAnim, void(entity this, entity obj))
-       {
-               for (entity e = this.firstChild; e; e = e.nextSibling)
-                       if (e.object == obj) e.stopAnim(e);
+}
+
+METHOD(AnimHost, stopObjAnim, void(entity this, entity obj))
+{
+       for (entity e = this.firstChild; e; e = e.nextSibling) {
+               if (e.object == obj) { e.stopAnim(e); } }
+}
+
+METHOD(AnimHost, resumeAllAnim, void(entity this))
+{
+       for (entity e = this.firstChild; e; e = e.nextSibling) {
+               e.resumeAnim(e);
        }
-
-       METHOD(AnimHost, resumeAllAnim, void(entity this))
-       {
-               for (entity e = this.firstChild; e; e = e.nextSibling)
-                       e.resumeAnim(e);
+}
+
+METHOD(AnimHost, resumeObjAnim, void(entity this, entity obj))
+{
+       for (entity e = this.firstChild; e; e = e.nextSibling) {
+               if (e.object == obj) { e.resumeAnim(e); } }
+}
+
+METHOD(AnimHost, finishAllAnim, void(entity this))
+{
+       for (entity e = this.firstChild; e; e = e.nextSibling) {
+               entity tmp = e;
+               e = tmp.prevSibling;
+               tmp.finishAnim(tmp);
        }
+}
 
-       METHOD(AnimHost, resumeObjAnim, void(entity this, entity obj))
-       {
-               for (entity e = this.firstChild; e; e = e.nextSibling)
-                       if (e.object == obj) e.resumeAnim(e);
-       }
-
-       METHOD(AnimHost, finishAllAnim, void(entity this))
-       {
-               for (entity e = this.firstChild; e; e = e.nextSibling)
-               {
+METHOD(AnimHost, finishObjAnim, void(entity this, entity obj))
+{
+       for (entity e = this.firstChild; e; e = e.nextSibling) {
+               if (e.object == obj) {
                        entity tmp = e;
                        e = tmp.prevSibling;
                        tmp.finishAnim(tmp);
                }
        }
+}
 
-       METHOD(AnimHost, finishObjAnim, void(entity this, entity obj))
-       {
-               for (entity e = this.firstChild; e; e = e.nextSibling)
-               {
-                       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);
-                       }
+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);
                }
        }
+}