merge attempt

This commit is contained in:
Nikolay Korolev
2020-12-19 03:21:04 +03:00
68 changed files with 2149 additions and 316 deletions

View File

@ -107,3 +107,14 @@ CAnimBlendHierarchy::RemoveUncompressedData(void)
// useless
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

View File

@ -2,6 +2,10 @@
#include "templates.h"
#ifdef MoveMemory
#undef MoveMemory // windows shit
#endif
class CAnimBlendSequence;
// A collection of sequences
@ -25,6 +29,7 @@ public:
void RemoveAnimSequences(void);
void Uncompress(void);
void RemoveUncompressedData(void);
void MoveMemory(bool onlyone = false);
bool IsCompressed() { return !!compressed; };
};

View File

@ -1,6 +1,7 @@
#include "common.h"
#include "AnimBlendSequence.h"
#include "MemoryHeap.h"
//--MIAMI: file done
@ -65,3 +66,25 @@ CAnimBlendSequence::RemoveQuaternionFlips(void)
last = frame->rotation;
}
}
#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

View File

@ -2,6 +2,10 @@
#include "Quaternion.h"
#ifdef MoveMemory
#undef MoveMemory // windows shit
#endif
// TODO: put them somewhere else?
struct KeyFrame {
CQuaternion rotation;
@ -44,10 +48,7 @@ public:
&((KeyFrame*)keyFramesCompressed)[n];
}
bool HasTranslation(void) { return !!(type & KF_TRANS); }
// TODO? these are unused
// void Uncompress(void);
// void CompressKeyframes(void);
// void RemoveUncompressedData(void);
bool MoveMemory(void);
void SetBoneTag(int tag) { boneTag = tag; }
};