diff --git a/spine-c/include/spine/AnimationState.h b/spine-c/include/spine/AnimationState.h index 44093f43a..ca9ce553f 100644 --- a/spine-c/include/spine/AnimationState.h +++ b/spine-c/include/spine/AnimationState.h @@ -50,6 +50,7 @@ typedef void (*spAnimationStateListener) (spAnimationState* state, int trackInde typedef struct spTrackEntry spTrackEntry; struct spTrackEntry { + spAnimationState* const state; spTrackEntry* next; spTrackEntry* previous; spAnimation* animation; diff --git a/spine-c/include/spine/extension.h b/spine-c/include/spine/extension.h index cb0b78dcb..b8ce9ee80 100644 --- a/spine-c/include/spine/extension.h +++ b/spine-c/include/spine/extension.h @@ -115,11 +115,11 @@ typedef struct { spEvent** events; spTrackEntry* (*createTrackEntry) (spAnimationState* self); - void (*disposeTrackEntry) (spAnimationState* self, spTrackEntry* entry); + void (*disposeTrackEntry) (spTrackEntry* entry); } _spAnimationState; -spTrackEntry* _spTrackEntry_create (); -void _spTrackEntry_dispose (spTrackEntry* entry); +spTrackEntry* _spTrackEntry_create (spAnimationState* self); +void _spTrackEntry_dispose (spTrackEntry* self); /**/ diff --git a/spine-c/src/spine/AnimationState.c b/spine-c/src/spine/AnimationState.c index 2e2030020..d5a769538 100644 --- a/spine-c/src/spine/AnimationState.c +++ b/spine-c/src/spine/AnimationState.c @@ -32,26 +32,27 @@ #include #include -spTrackEntry* _spTrackEntry_create () { - spTrackEntry* entry = NEW(spTrackEntry); - entry->timeScale = 1; - entry->lastTime = -1; - entry->mix = 1; - return entry; +spTrackEntry* _spTrackEntry_create (spAnimationState* state) { + spTrackEntry* self = NEW(spTrackEntry); + CONST_CAST(spAnimationState*, self->state) = state; + self->timeScale = 1; + self->lastTime = -1; + self->mix = 1; + return self; } -void _spTrackEntry_dispose (spTrackEntry* entry) { - if (entry->previous) _spTrackEntry_dispose(entry->previous); - FREE(entry); +void _spTrackEntry_dispose (spTrackEntry* self) { + if (self->previous) SUB_CAST(_spAnimationState, self->state)->disposeTrackEntry(self->previous); + FREE(self); } /**/ spTrackEntry* _spAnimationState_createTrackEntry (spAnimationState* self) { - return _spTrackEntry_create(); + return _spTrackEntry_create(self); } -void _spAnimationState_disposeTrackEntry (spAnimationState* self, spTrackEntry* entry) { +void _spAnimationState_disposeTrackEntry (spTrackEntry* entry) { _spTrackEntry_dispose(entry); } @@ -70,7 +71,7 @@ void _spAnimationState_disposeAllEntries (spAnimationState* self, spTrackEntry* _spAnimationState* internal = SUB_CAST(_spAnimationState, self); while (entry) { spTrackEntry* next = entry->next; - internal->disposeTrackEntry(self, entry); + internal->disposeTrackEntry(entry); entry = next; } } @@ -147,7 +148,7 @@ void spAnimationState_apply (spAnimationState* self, spSkeleton* skeleton) { if (alpha >= 1) { alpha = 1; - internal->disposeTrackEntry(self, current->previous); + internal->disposeTrackEntry(current->previous); current->previous = 0; } spAnimation_mix(current->animation, skeleton, current->lastTime, time, @@ -212,7 +213,7 @@ void spAnimationState_clearTrack (spAnimationState* self, int trackIndex) { self->tracks[trackIndex] = 0; - if (current->previous) internal->disposeTrackEntry(self, current->previous); + if (current->previous) internal->disposeTrackEntry(current->previous); _spAnimationState_disposeAllEntries(self, current); } @@ -248,9 +249,9 @@ void _spAnimationState_setCurrent (spAnimationState* self, int index, spTrackEnt } else entry->previous = current; } else - internal->disposeTrackEntry(self, current); + internal->disposeTrackEntry(current); - if (previous) internal->disposeTrackEntry(self, previous); + if (previous) internal->disposeTrackEntry(previous); } self->tracks[index] = entry; diff --git a/spine-cocos2d-iphone/2/src/spine/SkeletonAnimation.m b/spine-cocos2d-iphone/2/src/spine/SkeletonAnimation.m index 443b94f52..2f3226568 100644 --- a/spine-cocos2d-iphone/2/src/spine/SkeletonAnimation.m +++ b/spine-cocos2d-iphone/2/src/spine/SkeletonAnimation.m @@ -55,7 +55,7 @@ static _TrackEntryListeners* getListeners (spTrackEntry* entry) { return (_TrackEntryListeners*)entry->rendererObject; } -void disposeTrackEntry (spAnimationState* self, spTrackEntry* entry) { +void disposeTrackEntry (spTrackEntry* entry) { if (entry->rendererObject) { _TrackEntryListeners* listeners = (_TrackEntryListeners*)entry->rendererObject; [listeners->startListener release]; diff --git a/spine-cocos2dx/2/src/spine/SkeletonAnimation.cpp b/spine-cocos2dx/2/src/spine/SkeletonAnimation.cpp index 0e729947b..25b5d4b5d 100644 --- a/spine-cocos2dx/2/src/spine/SkeletonAnimation.cpp +++ b/spine-cocos2dx/2/src/spine/SkeletonAnimation.cpp @@ -63,7 +63,7 @@ static _TrackEntryListeners* getListeners (spTrackEntry* entry) { return (_TrackEntryListeners*)entry->rendererObject; } -void disposeTrackEntry (spAnimationState* self, spTrackEntry* entry) { +void disposeTrackEntry (spTrackEntry* entry) { if (entry->rendererObject) FREE(entry->rendererObject); _spTrackEntry_dispose(entry); } diff --git a/spine-cocos2dx/3.0/src/spine/SkeletonAnimation.cpp b/spine-cocos2dx/3.0/src/spine/SkeletonAnimation.cpp index fbf85529e..611916ea3 100644 --- a/spine-cocos2dx/3.0/src/spine/SkeletonAnimation.cpp +++ b/spine-cocos2dx/3.0/src/spine/SkeletonAnimation.cpp @@ -63,7 +63,7 @@ static _TrackEntryListeners* getListeners (spTrackEntry* entry) { return (_TrackEntryListeners*)entry->rendererObject; } -void disposeTrackEntry (spAnimationState* self, spTrackEntry* entry) { +void disposeTrackEntry (spTrackEntry* entry) { if (entry->rendererObject) FREE(entry->rendererObject); _spTrackEntry_dispose(entry); } diff --git a/spine-cocos2dx/3.1/src/spine/SkeletonAnimation.cpp b/spine-cocos2dx/3.1/src/spine/SkeletonAnimation.cpp index fbf85529e..611916ea3 100644 --- a/spine-cocos2dx/3.1/src/spine/SkeletonAnimation.cpp +++ b/spine-cocos2dx/3.1/src/spine/SkeletonAnimation.cpp @@ -63,7 +63,7 @@ static _TrackEntryListeners* getListeners (spTrackEntry* entry) { return (_TrackEntryListeners*)entry->rendererObject; } -void disposeTrackEntry (spAnimationState* self, spTrackEntry* entry) { +void disposeTrackEntry (spTrackEntry* entry) { if (entry->rendererObject) FREE(entry->rendererObject); _spTrackEntry_dispose(entry); } diff --git a/spine-sfml/src/spine/spine-sfml.cpp b/spine-sfml/src/spine/spine-sfml.cpp index cfd54e8a4..ef1c717f2 100644 --- a/spine-sfml/src/spine/spine-sfml.cpp +++ b/spine-sfml/src/spine/spine-sfml.cpp @@ -37,7 +37,7 @@ #include #ifndef SPINE_MESH_VERTEX_COUNT_MAX -#define SPINE_MESH_VERTEX_COUNT_MAX 200 +#define SPINE_MESH_VERTEX_COUNT_MAX 1000 #endif using namespace sf; @@ -154,7 +154,7 @@ void SkeletonDrawable::draw (RenderTarget& target, RenderStates states) const { } else if (attachment->type == ATTACHMENT_MESH) { MeshAttachment* mesh = (MeshAttachment*)attachment; - if (mesh->uvsCount > SPINE_MESH_VERTEX_COUNT_MAX) continue; + if (mesh->verticesCount > SPINE_MESH_VERTEX_COUNT_MAX) continue; texture = (Texture*)((AtlasRegion*)mesh->rendererObject)->page->rendererObject; MeshAttachment_computeWorldVertices(mesh, slot->skeleton->x, slot->skeleton->y, slot, worldVertices);