#endif
#ifndef MENUQC
-.float skeletonmodelindex; // used to check if the model has changed
-float Update_Skeleton(entity e)
-{
- // updates the fake skeleton if needed, and returns the total number of bones
- if(e.skeletonmodelindex != e.modelindex)
- {
- if(e.fake_skeletonindex)
- skel_delete(e.fake_skeletonindex);
- e.fake_skeletonindex = skel_create(e.modelindex);
- e.skeletonmodelindex = e.modelindex;
- }
- return skel_get_numbones(e.fake_skeletonindex);
+.float skeleton_bones_index;
+void Skeleton_SetBones(entity e)
+{
+ // set skeleton_bones to the total number of bones on the model
+ if(e.skeleton_bones_index == e.modelindex)
+ return; // same model, nothing to update
+
+ float skelindex;
+ skelindex = skel_create(e.modelindex);
+ e.skeleton_bones = skel_get_numbones(skelindex);
+ skel_delete(skelindex);
+ e.skeleton_bones_index = e.modelindex;
}
#endif
void Shutdown();
#ifndef MENUQC
-.float fake_skeletonindex; // maintains a fake skeleton for property checking without affecting the actual mesh
-float Update_Skeleton(entity e);
+.float skeleton_bones;
+void Skeleton_SetBones(entity e);
// loops through the tags of model v using counter tagnum
-#define FOR_EACH_TAG(v) float tagnum, tags; tags = Update_Skeleton(v); for(tagnum = 0; tagnum < tags; tagnum++, gettaginfo(v, tagnum))
+#define FOR_EACH_TAG(v) float tagnum; Skeleton_SetBones(v); for(tagnum = 0; tagnum < v.skeleton_bones; tagnum++, gettaginfo(v, tagnum))
#endif
#ifdef SVQC
void WriteApproxPastTime(float dst, float t);