summaryrefslogtreecommitdiffstats
path: root/src/animation
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-12-01 17:42:18 +0100
committeraap <aap@papnet.eu>2020-12-01 17:42:18 +0100
commit83bbb631d1105502fb3c5b3af90578226ba35583 (patch)
treef317568c6c19250fa29b41ac0d2a99003f4cc169 /src/animation
parentfix cam-fix (diff)
downloadre3-83bbb631d1105502fb3c5b3af90578226ba35583.tar
re3-83bbb631d1105502fb3c5b3af90578226ba35583.tar.gz
re3-83bbb631d1105502fb3c5b3af90578226ba35583.tar.bz2
re3-83bbb631d1105502fb3c5b3af90578226ba35583.tar.lz
re3-83bbb631d1105502fb3c5b3af90578226ba35583.tar.xz
re3-83bbb631d1105502fb3c5b3af90578226ba35583.tar.zst
re3-83bbb631d1105502fb3c5b3af90578226ba35583.zip
Diffstat (limited to 'src/animation')
-rw-r--r--src/animation/AnimBlendHierarchy.cpp11
-rw-r--r--src/animation/AnimBlendHierarchy.h5
-rw-r--r--src/animation/AnimBlendSequence.cpp21
-rw-r--r--src/animation/AnimBlendSequence.h5
4 files changed, 42 insertions, 0 deletions
diff --git a/src/animation/AnimBlendHierarchy.cpp b/src/animation/AnimBlendHierarchy.cpp
index 67b19019..c7800de5 100644
--- a/src/animation/AnimBlendHierarchy.cpp
+++ b/src/animation/AnimBlendHierarchy.cpp
@@ -82,3 +82,14 @@ CAnimBlendHierarchy::RemoveUncompressedData(void)
#endif
compressed = 1;
}
+
+#ifdef USE_CUSTOM_ALLOCATOR
+void
+CAnimBlendHierarchy::MoveMemory(bool onlyone)
+{
+ int i;
+ for(i = 0; i < numSequences; i++)
+ if(sequences[i].MoveMemory() && onlyone)
+ return;
+}
+#endif
diff --git a/src/animation/AnimBlendHierarchy.h b/src/animation/AnimBlendHierarchy.h
index 0144108d..e35b4925 100644
--- a/src/animation/AnimBlendHierarchy.h
+++ b/src/animation/AnimBlendHierarchy.h
@@ -2,6 +2,10 @@
#include "templates.h"
+#ifdef MoveMemory
+#undef MoveMemory // windows shit
+#endif
+
class CAnimBlendSequence;
// A collection of sequences
@@ -23,6 +27,7 @@ public:
void RemoveAnimSequences(void);
void Uncompress(void);
void RemoveUncompressedData(void);
+ void MoveMemory(bool onlyone = false);
};
VALIDATE_SIZE(CAnimBlendHierarchy, 0x28); \ No newline at end of file
diff --git a/src/animation/AnimBlendSequence.cpp b/src/animation/AnimBlendSequence.cpp
index 5a2fa605..c958b71a 100644
--- a/src/animation/AnimBlendSequence.cpp
+++ b/src/animation/AnimBlendSequence.cpp
@@ -176,3 +176,24 @@ CAnimBlendSequence::RemoveUncompressedData(void)
keyFrames = nil;
}
+#ifdef USE_CUSTOM_ALLOCATOR
+bool
+CAnimBlendSequence::MoveMemory(void)
+{
+ if(keyFrames){
+ void *newaddr = gMainHeap.MoveMemory(keyFrames);
+ if(newaddr != keyFrames){
+ keyFrames = newaddr;
+ return true;
+ }
+ }else if(keyFramesCompressed){
+ void *newaddr = gMainHeap.MoveMemory(keyFramesCompressed);
+ if(newaddr != keyFramesCompressed){
+ keyFramesCompressed = newaddr;
+ return true;
+ }
+ }
+ return false;
+}
+#endif
+
diff --git a/src/animation/AnimBlendSequence.h b/src/animation/AnimBlendSequence.h
index e51e5aaa..c6e70f22 100644
--- a/src/animation/AnimBlendSequence.h
+++ b/src/animation/AnimBlendSequence.h
@@ -2,6 +2,10 @@
#include "Quaternion.h"
+#ifdef MoveMemory
+#undef MoveMemory // windows shit
+#endif
+
// TODO: put them somewhere else?
struct KeyFrame {
CQuaternion rotation;
@@ -53,6 +57,7 @@ public:
void Uncompress(void);
void CompressKeyframes(void);
void RemoveUncompressedData(void);
+ bool MoveMemory(void);
#ifdef PED_SKIN
void SetBoneTag(int tag) { boneTag = tag; }