summaryrefslogtreecommitdiffstats
path: root/src/animation
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-05-11 09:18:41 +0200
committeraap <aap@papnet.eu>2020-05-11 09:18:41 +0200
commitb11715608f5d12d82ecb364b0d2dc76c24d6ab1f (patch)
tree89ee629dac2cee3c3ab7020e394a50f1054c186d /src/animation
parentMerge pull request #509 from Fire-Head/master (diff)
downloadre3-b11715608f5d12d82ecb364b0d2dc76c24d6ab1f.tar
re3-b11715608f5d12d82ecb364b0d2dc76c24d6ab1f.tar.gz
re3-b11715608f5d12d82ecb364b0d2dc76c24d6ab1f.tar.bz2
re3-b11715608f5d12d82ecb364b0d2dc76c24d6ab1f.tar.lz
re3-b11715608f5d12d82ecb364b0d2dc76c24d6ab1f.tar.xz
re3-b11715608f5d12d82ecb364b0d2dc76c24d6ab1f.tar.zst
re3-b11715608f5d12d82ecb364b0d2dc76c24d6ab1f.zip
Diffstat (limited to 'src/animation')
-rw-r--r--src/animation/FrameUpdate.cpp42
-rw-r--r--src/animation/RpAnimBlend.cpp8
2 files changed, 41 insertions, 9 deletions
diff --git a/src/animation/FrameUpdate.cpp b/src/animation/FrameUpdate.cpp
index a1121282..8697e7c6 100644
--- a/src/animation/FrameUpdate.cpp
+++ b/src/animation/FrameUpdate.cpp
@@ -47,7 +47,12 @@ FrameUpdateCallBackNonSkinned(AnimBlendFrameData *frame, void *arg)
(*node)->Update(vec, q, 1.0f-totalBlendAmount);
if((*node)->sequence->HasTranslation())
pos += vec;
- rot += q;
+#ifdef FIX_BUGS
+ if(DotProduct(rot, q) < 0.0f)
+ rot -= q;
+ else
+#endif
+ rot += q;
}
++*node;
}
@@ -101,7 +106,12 @@ FrameUpdateCallBackWithVelocityExtractionNonSkinned(AnimBlendFrameData *frame, v
for(node = updateData->nodes; *node; node++){
if((*node)->sequence){
bool nodelooped = (*node)->Update(vec, q, 1.0f-totalBlendAmount);
- rot += q;
+#ifdef FIX_BUGS
+ if(DotProduct(rot, q) < 0.0f)
+ rot -= q;
+ else
+#endif
+ rot += q;
if((*node)->sequence->HasTranslation()){
pos += vec;
if((*node)->association->HasTranslation()){
@@ -179,7 +189,12 @@ FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(AnimBlendFrameData *frame,
for(node = updateData->nodes; *node; node++){
if((*node)->sequence){
bool nodelooped = (*node)->Update(vec, q, 1.0f-totalBlendAmount);
- rot += q;
+#ifdef FIX_BUGS
+ if(DotProduct(rot, q) < 0.0f)
+ rot -= q;
+ else
+#endif
+ rot += q;
if((*node)->sequence->HasTranslation()){
pos += vec;
if((*node)->association->HasTranslation()){
@@ -243,7 +258,12 @@ FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg)
(*node)->Update(vec, q, 1.0f-totalBlendAmount);
if((*node)->sequence->HasTranslation())
pos += vec;
- rot += q;
+#ifdef FIX_BUGS
+ if(DotProduct(rot, q) < 0.0f)
+ rot -= q;
+ else
+#endif
+ rot += q;
}
++*node;
}
@@ -298,7 +318,12 @@ FrameUpdateCallBackWithVelocityExtractionSkinned(AnimBlendFrameData *frame, void
for(node = updateData->nodes; *node; node++){
if((*node)->sequence){
bool nodelooped = (*node)->Update(vec, q, 1.0f-totalBlendAmount);
- rot += q;
+#ifdef FIX_BUGS
+ if(DotProduct(rot, q) < 0.0f)
+ rot -= q;
+ else
+#endif
+ rot += q;
if((*node)->sequence->HasTranslation()){
pos += vec;
if((*node)->association->HasTranslation()){
@@ -376,7 +401,12 @@ FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, vo
for(node = updateData->nodes; *node; node++){
if((*node)->sequence){
bool nodelooped = (*node)->Update(vec, q, 1.0f-totalBlendAmount);
- rot += q;
+#ifdef FIX_BUGS
+ if(DotProduct(rot, q) < 0.0f)
+ rot -= q;
+ else
+#endif
+ rot += q;
if((*node)->sequence->HasTranslation()){
pos += vec;
if((*node)->association->HasTranslation()){
diff --git a/src/animation/RpAnimBlend.cpp b/src/animation/RpAnimBlend.cpp
index d3e10889..be70ad66 100644
--- a/src/animation/RpAnimBlend.cpp
+++ b/src/animation/RpAnimBlend.cpp
@@ -348,9 +348,11 @@ CAnimBlendAssociation*
RpAnimBlendClumpGetFirstAssociation(RpClump *clump)
{
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
- if(clumpData == nil) return nil;
- if(clumpData->link.next == nil) return nil;
- return CAnimBlendAssociation::FromLink(clumpData->link.next);
+ if(!RpAnimBlendClumpIsInitialized(clump))
+ return nil;
+ if(clumpData->link.next)
+ return CAnimBlendAssociation::FromLink(clumpData->link.next);
+ return nil;
}
// FillFrameArrayCallBack on PS2