From af6e132b37e8b7e89e4c0c7a52e5bb81e4b1b9a8 Mon Sep 17 00:00:00 2001 From: bigbossbro08 Date: Sun, 10 May 2020 19:54:37 +0600 Subject: defined out asserts. --- src/animation/AnimBlendAssociation.h | 3 +++ src/animation/AnimBlendHierarchy.h | 3 +++ src/animation/AnimBlendNode.h | 3 +++ 3 files changed, 9 insertions(+) (limited to 'src/animation') diff --git a/src/animation/AnimBlendAssociation.h b/src/animation/AnimBlendAssociation.h index dd4c7a34..4f3be016 100644 --- a/src/animation/AnimBlendAssociation.h +++ b/src/animation/AnimBlendAssociation.h @@ -84,4 +84,7 @@ public: return (CAnimBlendAssociation*)((uint8*)l - offsetof(CAnimBlendAssociation, link)); } }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CAnimBlendAssociation) == 0x40, "CAnimBlendAssociation: error"); +#endif \ No newline at end of file diff --git a/src/animation/AnimBlendHierarchy.h b/src/animation/AnimBlendHierarchy.h index 917e1585..1bf687cc 100644 --- a/src/animation/AnimBlendHierarchy.h +++ b/src/animation/AnimBlendHierarchy.h @@ -24,4 +24,7 @@ public: void Uncompress(void); void RemoveUncompressedData(void); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CAnimBlendHierarchy) == 0x28, "CAnimBlendHierarchy: error"); +#endif \ No newline at end of file diff --git a/src/animation/AnimBlendNode.h b/src/animation/AnimBlendNode.h index 361a4134..46f2fee4 100644 --- a/src/animation/AnimBlendNode.h +++ b/src/animation/AnimBlendNode.h @@ -26,4 +26,7 @@ public: void GetCurrentTranslation(CVector &trans, float weight); void GetEndTranslation(CVector &trans, float weight); }; + +#ifdef CHECK_STRUCT_SIZES static_assert(sizeof(CAnimBlendNode) == 0x1C, "CAnimBlendNode: error"); +#endif \ No newline at end of file -- cgit v1.2.3 From 5b605c127144ab805581f62015ef3742c1d4a64e Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 10 May 2020 17:09:57 +0200 Subject: some fixes and cosmetic changes --- src/animation/AnimManager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/animation') diff --git a/src/animation/AnimManager.h b/src/animation/AnimManager.h index d27e4512..de15602c 100644 --- a/src/animation/AnimManager.h +++ b/src/animation/AnimManager.h @@ -22,7 +22,7 @@ enum AssocGroupId ASSOCGRP_BUSYWOMAN, ASSOCGRP_SEXYWOMAN, ASSOCGRP_OLDWOMAN, - ASSOCGRP_FARWOMAN, + ASSOCGRP_FATWOMAN, ASSOCGRP_PANICCHUNKY, ASSOCGRP_PLAYERBACK, ASSOCGRP_PLAYERLEFT, -- cgit v1.2.3 From c798e1bacdaabaf140ff3904948fd7cec46c09bb Mon Sep 17 00:00:00 2001 From: bigbossbro08 Date: Sun, 10 May 2020 21:49:33 +0600 Subject: Fixed typos and made all assert functions optional --- src/animation/AnimBlendAssociation.h | 4 +--- src/animation/AnimBlendClumpData.h | 4 ++-- src/animation/AnimBlendHierarchy.h | 4 +--- src/animation/AnimBlendNode.h | 5 ++--- src/animation/AnimBlendSequence.h | 2 +- 5 files changed, 7 insertions(+), 12 deletions(-) (limited to 'src/animation') diff --git a/src/animation/AnimBlendAssociation.h b/src/animation/AnimBlendAssociation.h index 4f3be016..d0c60a88 100644 --- a/src/animation/AnimBlendAssociation.h +++ b/src/animation/AnimBlendAssociation.h @@ -85,6 +85,4 @@ public: } }; -#ifdef CHECK_STRUCT_SIZES -static_assert(sizeof(CAnimBlendAssociation) == 0x40, "CAnimBlendAssociation: error"); -#endif \ No newline at end of file +VALIDATE_SIZE(CAnimBlendAssociation, 0x40); diff --git a/src/animation/AnimBlendClumpData.h b/src/animation/AnimBlendClumpData.h index a537425a..5c511ab8 100644 --- a/src/animation/AnimBlendClumpData.h +++ b/src/animation/AnimBlendClumpData.h @@ -26,7 +26,7 @@ struct AnimBlendFrameData #endif }; #ifndef PED_SKIN -static_assert(sizeof(AnimBlendFrameData) == 0x14, "AnimBlendFrameData: error"); +VALIDATE_SIZE(AnimBlendFrameData, 0x14); #endif @@ -51,5 +51,5 @@ public: void ForAllFrames(void (*cb)(AnimBlendFrameData*, void*), void *arg); }; #ifndef PED_SKIN -static_assert(sizeof(CAnimBlendClumpData) == 0x14, "CAnimBlendClumpData: error"); +VALIDATE_SIZE(CAnimBlendClumpData, 0x14); #endif diff --git a/src/animation/AnimBlendHierarchy.h b/src/animation/AnimBlendHierarchy.h index 1bf687cc..0144108d 100644 --- a/src/animation/AnimBlendHierarchy.h +++ b/src/animation/AnimBlendHierarchy.h @@ -25,6 +25,4 @@ public: void RemoveUncompressedData(void); }; -#ifdef CHECK_STRUCT_SIZES -static_assert(sizeof(CAnimBlendHierarchy) == 0x28, "CAnimBlendHierarchy: error"); -#endif \ No newline at end of file +VALIDATE_SIZE(CAnimBlendHierarchy, 0x28); \ No newline at end of file diff --git a/src/animation/AnimBlendNode.h b/src/animation/AnimBlendNode.h index 46f2fee4..89924d6a 100644 --- a/src/animation/AnimBlendNode.h +++ b/src/animation/AnimBlendNode.h @@ -27,6 +27,5 @@ public: void GetEndTranslation(CVector &trans, float weight); }; -#ifdef CHECK_STRUCT_SIZES -static_assert(sizeof(CAnimBlendNode) == 0x1C, "CAnimBlendNode: error"); -#endif \ No newline at end of file + +VALIDATE_SIZE(CAnimBlendNode, 0x1C); diff --git a/src/animation/AnimBlendSequence.h b/src/animation/AnimBlendSequence.h index 1246d7b4..44ac8886 100644 --- a/src/animation/AnimBlendSequence.h +++ b/src/animation/AnimBlendSequence.h @@ -51,5 +51,5 @@ public: #endif }; #ifndef PED_SKIN -static_assert(sizeof(CAnimBlendSequence) == 0x2C, "CAnimBlendSequence: error"); +VALIDATE_SIZE(CAnimBlendSequence, 0x2C); #endif -- cgit v1.2.3 From b11715608f5d12d82ecb364b0d2dc76c24d6ab1f Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 11 May 2020 09:18:41 +0200 Subject: few fixes --- src/animation/FrameUpdate.cpp | 42 ++++++++++++++++++++++++++++++++++++------ src/animation/RpAnimBlend.cpp | 8 +++++--- 2 files changed, 41 insertions(+), 9 deletions(-) (limited to 'src/animation') 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 -- cgit v1.2.3