1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-10-06 09:07:19 +02:00

Convert INFO:entries and ANIM:frames to std::uint32_t

This commit is contained in:
Filip Gawin 2018-12-09 01:27:05 +01:00
parent 8fbf201b8d
commit 8c7e94a600
2 changed files with 9 additions and 9 deletions

View File

@ -63,7 +63,7 @@ bool LoaderIFP::loadFromMemory(char* data) {
ANPK* fileRoot = read<ANPK>(data, dataI);
std::string listname = readString(data, dataI);
for (int a = 0; a < fileRoot->info.entries; ++a) {
for (auto a = 0u; a < fileRoot->info.entries; ++a) {
// something about a name?
/*NAME* n =*/read<NAME>(data, dataI);
std::string animname = readString(data, dataI);
@ -76,16 +76,16 @@ bool LoaderIFP::loadFromMemory(char* data) {
DGAN* animroot = read<DGAN>(data, dataI);
std::string infoname = readString(data, dataI);
animation->bones.reserve(static_cast<unsigned>(animroot->info.entries));
animation->bones.reserve(animroot->info.entries);
for (int c = 0; c < animroot->info.entries; ++c) {
for (auto c = 0u; c < animroot->info.entries; ++c) {
size_t start = data_offs;
CPAN* cpan = read<CPAN>(data, dataI);
ANIM* frames = read<ANIM>(data, dataI);
AnimationBone boneData{};
boneData.name = frames->name;
boneData.frames.reserve(static_cast<unsigned>(frames->frames));
boneData.frames.reserve(frames->frames);
data_offs += ((8 + frames->base.size) - sizeof(ANIM));
@ -96,7 +96,7 @@ bool LoaderIFP::loadFromMemory(char* data) {
if (type == "KR00") {
boneData.type = AnimationBone::R00;
for (int d = 0; d < frames->frames; ++d) {
for (auto d = 0u; d < frames->frames; ++d) {
glm::quat q = glm::conjugate(*read<glm::quat>(data, dataI));
time = *read<float>(data, dataI);
boneData.frames.emplace_back(q, glm::vec3(0.f, 0.f, 0.f),
@ -105,7 +105,7 @@ bool LoaderIFP::loadFromMemory(char* data) {
}
} else if (type == "KRT0") {
boneData.type = AnimationBone::RT0;
for (int d = 0; d < frames->frames; ++d) {
for (auto d = 0u; d < frames->frames; ++d) {
glm::quat q = glm::conjugate(*read<glm::quat>(data, dataI));
glm::vec3 p = *read<glm::vec3>(data, dataI);
time = *read<float>(data, dataI);
@ -114,7 +114,7 @@ bool LoaderIFP::loadFromMemory(char* data) {
}
} else if (type == "KRTS") {
boneData.type = AnimationBone::RTS;
for (int d = 0; d < frames->frames; ++d) {
for (auto d = 0u; d < frames->frames; ++d) {
glm::quat q = glm::conjugate(*read<glm::quat>(data, dataI));
glm::vec3 p = *read<glm::vec3>(data, dataI);
glm::vec3 s = *read<glm::vec3>(data, dataI);

View File

@ -96,7 +96,7 @@ public:
struct INFO {
BASE base;
int32_t entries;
std::uint32_t entries;
// null terminated string
// entry data
};
@ -122,7 +122,7 @@ public:
struct ANIM {
BASE base;
char name[28];
int32_t frames;
std::uint32_t frames;
int32_t unk;
int32_t next;
int32_t prev;