CAnimationLoader: Make use of std::array

Prevents implicit array to pointer decay.
This commit is contained in:
Lioncash 2020-06-12 12:43:07 -04:00
parent 12ccb2fbd4
commit 9e2a8bd693
1 changed files with 13 additions and 12 deletions

View File

@ -4,36 +4,37 @@
#include "Core/Resource/TResPtr.h" #include "Core/Resource/TResPtr.h"
#include "Core/Resource/Animation/CAnimation.h" #include "Core/Resource/Animation/CAnimation.h"
#include <Common/EGame.h> #include <Common/EGame.h>
#include <array>
#include <memory> #include <memory>
class CAnimationLoader class CAnimationLoader
{ {
TResPtr<CAnimation> mpAnim; TResPtr<CAnimation> mpAnim;
IInputStream *mpInput; IInputStream *mpInput = nullptr;
EGame mGame; EGame mGame{};
// Compression data // Compression data
std::vector<bool> mKeyFlags; std::vector<bool> mKeyFlags;
float mTranslationMultiplier; float mTranslationMultiplier = 0.0f;
uint32 mRotationDivisor; uint32 mRotationDivisor = 0;
float mScaleMultiplier; float mScaleMultiplier = 0.0f;
struct SCompressedChannel struct SCompressedChannel
{ {
uint32 BoneID; uint32 BoneID;
uint16 NumRotationKeys; uint16 NumRotationKeys;
int16 Rotation[3]; std::array<int16, 3> Rotation;
uint8 RotationBits[3]; std::array<uint8, 3> RotationBits;
uint16 NumTranslationKeys; uint16 NumTranslationKeys;
int16 Translation[3]; std::array<int16, 3> Translation;
uint8 TranslationBits[3]; std::array<uint8, 3> TranslationBits;
uint16 NumScaleKeys; uint16 NumScaleKeys;
int16 Scale[3]; std::array<int16, 3> Scale;
uint8 ScaleBits[3]; std::array<uint8, 3> ScaleBits;
}; };
std::vector<SCompressedChannel> mCompressedChannels; std::vector<SCompressedChannel> mCompressedChannels;
CAnimationLoader() {} CAnimationLoader() = default;
bool UncompressedCheckEchoes(); bool UncompressedCheckEchoes();
EGame UncompressedCheckVersion(); EGame UncompressedCheckVersion();
void ReadUncompressedANIM(); void ReadUncompressedANIM();