[c] Add spTrackEntry_resetRotationDirections(), update CHANGELOG, fix warnings.

This commit is contained in:
Mario Zechner 2022-10-06 16:59:00 +02:00
parent 98c10437c5
commit ecd0aca61c
3 changed files with 70 additions and 3 deletions

View File

@ -1,3 +1,62 @@
# 4.2
## C
* **Additions**
* Added `spTrackEntry_resetRotationDirections()`
* **Breaking changes**
### SFML
## C++
* **Additions**
* **Breaking changes**
### Cocos2d-x
### SFML
### SDL
### UE4
## C#
* **Additions**
* **Breaking changes**
### Unity
* **Officially supported Unity versions are 2017.1-2022.1**.
* **Additions**
* **Breaking changes**
* **Changes of default values**
* **Deprecated**
* **Restructuring (Non-Breaking)**
### XNA/MonoGame
## Java
* **Additions**
* **Breaking changes**
### libGDX
## Typescript/Javascript
* **Additions**
* **Breaking changes**
### WebGL backend
### Canvas backend
### Three.js backend
### Player
# 4.1
## C

View File

@ -142,6 +142,8 @@ SP_API void spAnimationState_clearListenerNotifications(spAnimationState *self);
SP_API float spTrackEntry_getAnimationTime(spTrackEntry *entry);
SP_API void spTrackEntry_resetRotationDirections(spTrackEntry *entry);
SP_API float spTrackEntry_getTrackComplete(spTrackEntry *entry);
SP_API void spAnimationState_clearNext(spAnimationState *self, spTrackEntry *entry);

View File

@ -668,7 +668,7 @@ void _spAnimationState_applyRotateTimeline(spAnimationState *self, spTimeline *t
if (diff == 0) {
total = timelinesRotation[i];
} else {
float lastTotal, lastDiff;
float lastTotal, lastDiff, loops;
if (firstFrame) {
lastTotal = 0;
lastDiff = diff;
@ -676,9 +676,9 @@ void _spAnimationState_applyRotateTimeline(spAnimationState *self, spTimeline *t
lastTotal = timelinesRotation[i];
lastDiff = timelinesRotation[i + 1];
}
float loops = lastTotal - FMOD(lastTotal, 360);
loops = lastTotal - FMOD(lastTotal, 360);
total = diff + loops;
int current = diff >= 0, dir = lastTotal >= 0;
current = diff >= 0, dir = lastTotal >= 0;
if (ABS(lastDiff) <= 90 && SIGNUM(lastDiff) != SIGNUM(diff)) {
if (ABS(lastTotal - loops) > 180) {
total += 360 * SIGNUM(lastTotal);
@ -1036,6 +1036,12 @@ float spTrackEntry_getAnimationTime(spTrackEntry *entry) {
return MIN(entry->trackTime + entry->animationStart, entry->animationEnd);
}
void spTrackEntry_resetRotationDirections(spTrackEntry *entry) {
FREE(entry->timelinesRotation);
entry->timelinesRotation = NULL;
entry->timelinesRotationCount = 0;
}
float spTrackEntry_getTrackComplete(spTrackEntry *entry) {
float duration = entry->animationEnd - entry->animationStart;
if (duration != 0) {