5 #include "animation.qh"
8 METHOD(AnimHost, addAnim, void(entity this, entity other))
10 if (other.parent) error("Can't add already added anim!");
12 if (other.isFinished(other)) error("Can't add finished anim!");
16 entity l = this.lastChild;
18 if (l) l.nextSibling = other;
19 else this.firstChild = other;
21 other.prevSibling = l;
22 other.nextSibling = NULL;
23 this.lastChild = other;
26 METHOD(AnimHost, removeAnim, void(entity this, entity other))
28 if (other.parent != this) error("Can't remove from wrong AnimHost!");
32 entity n = other.nextSibling;
33 entity p = other.prevSibling;
35 if (p) p.nextSibling = n;
36 else this.firstChild = n;
38 if (n) n.prevSibling = p;
39 else this.lastChild = p;
43 METHOD(AnimHost, removeAllAnim, void(entity this))
45 for (entity e = this.firstChild; e; e = e.nextSibling)
49 this.removeAnim(this, tmp);
53 METHOD(AnimHost, removeObjAnim, void(entity this, entity obj))
55 for (entity e = this.firstChild; e; e = e.nextSibling)
61 this.removeAnim(this, tmp);
66 METHOD(AnimHost, stopAllAnim, void(entity this))
68 for (entity e = this.firstChild; e; e = e.nextSibling)
72 METHOD(AnimHost, stopObjAnim, void(entity this, entity obj))
74 for (entity e = this.firstChild; e; e = e.nextSibling)
75 if (e.object == obj) e.stopAnim(e);
78 METHOD(AnimHost, resumeAllAnim, void(entity this))
80 for (entity e = this.firstChild; e; e = e.nextSibling)
84 METHOD(AnimHost, resumeObjAnim, void(entity this, entity obj))
86 for (entity e = this.firstChild; e; e = e.nextSibling)
87 if (e.object == obj) e.resumeAnim(e);
90 METHOD(AnimHost, finishAllAnim, void(entity this))
92 for (entity e = this.firstChild; e; e = e.nextSibling)
100 METHOD(AnimHost, finishObjAnim, void(entity this, entity obj))
102 for (entity e = this.firstChild; e; e = e.nextSibling)
113 METHOD(AnimHost, tickAll, void(entity this))
115 for (entity e = this.firstChild; e; e = e.nextSibling)
122 this.removeAnim(this, tmp);