X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fanimdecide.qh;h=bfbba7cb80b5ebb7a32988175e40878390deb773;hb=be67100213718a57e4d0607466ecc1d98f803fc4;hp=578a30f68bccab793dbadf9e6e8b956be4dc677e;hpb=f1a87492d9fed27a64d0e99c068705aba5509f26;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/animdecide.qh b/qcsrc/common/animdecide.qh index 578a30f68..bfbba7cb8 100644 --- a/qcsrc/common/animdecide.qh +++ b/qcsrc/common/animdecide.qh @@ -1,5 +1,4 @@ -#ifndef ANIMDECIDE_H -#define ANIMDECIDE_H +#pragma once // must be called at least once to initialize, or when modelindex is changed void animdecide_load_if_needed(entity e); @@ -9,7 +8,7 @@ void animdecide_setimplicitstate(entity e, float onground); void animdecide_setframes(entity e, bool support_blending, .int fld_frame, .int fld_frame1time, .int fld_frame2, .int fld_frame2time); CLASS(Animation, Object) - ATTRIB(Animation, m_framenames, string, string_null) + ATTRIB(Animation, m_framenames, string); STATIC_METHOD(Animation, getframe, int(Animation this, int mdlidx)) { FOREACH_WORD(this.m_framenames, true, { @@ -17,7 +16,7 @@ CLASS(Animation, Object) if (f != -1) return f; }); #ifdef CSQC - LOG_DEBUGF("Missing animation for %s: %s\n", modelnameforindex(mdlidx), this.registered_id); + LOG_DEBUGF("Missing animation for %s: %s", modelnameforindex(mdlidx), this.registered_id); #endif return -1; } @@ -25,9 +24,10 @@ ENDCLASS(Animation) REGISTRY(Animations, BITS(8)) REGISTER_REGISTRY(Animations) -#define Animations_from(id) _Animations_from(id, NULL) -#define WriteAnimation(to, it) WriteRegistry(Animations, to, it) -#define ReadAnimation() ReadRegistry(Animations) + +REGISTRY_DEFINE_GET(Animations, NULL) +#define WriteAnimation(to, it) WriteRegistered(Animations, to, it) +#define ReadAnimation() ReadRegistered(Animations) #define REGISTER_ANIMATION(id, framenames) \ .vector anim_##id; \ REGISTER(Animations, ANIM_##id, m_id, NEW(Animation)) { \ @@ -145,4 +145,3 @@ const int ANIMACTION_PAIN2 = 3; // pain const int ANIMACTION_SHOOT = 4; // shoot const int ANIMACTION_TAUNT = 5; // taunt const int ANIMACTION_MELEE = 6; // melee -#endif