#include "xanimdynamicframes.h"

XAnimDynamicFrames::XAnimDynamicFrames()
    : XAsset()
    , mFrames(3)
{
    SetName("Animation Dynamic Frames");
}

void XAnimDynamicFrames::ParseData(XDataStream *aStream) {
    if (GetPtr() == -1) {
        qint32 framePtr = aStream->ParseInt32(QString("%1 frames ptr").arg(GetName()));
        if (framePtr == -1)
        {
            mFrames[0] = aStream->ParseUInt8(QString("%1 frame %2").arg(GetName()).arg(0));
            mFrames[1] = aStream->ParseUInt8(QString("%1 frame %2").arg(GetName()).arg(1));
            mFrames[2] = aStream->ParseUInt8(QString("%1 frame %2").arg(GetName()).arg(2));
        }
    }
}

void XAnimDynamicFrames::Clear()
{
    mFrames.clear();
}

QVector<quint8> XAnimDynamicFrames::GetFrames() const {
    return mFrames;
}

void XAnimDynamicFrames::SetFrames(QVector<quint8> aFrames) {
    mFrames = aFrames;
}
