From d6e290855c68e4033557305d0e39c5efc710cd30 Mon Sep 17 00:00:00 2001 From: lzwdgc Date: Wed, 9 Dec 2020 18:45:55 +0300 Subject: [PATCH] Clarify animated textures. --- src/model/model.cpp | 8 ++------ src/model/model.h | 25 +++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/model/model.cpp b/src/model/model.cpp index 9bc9675..ecfb4f1 100644 --- a/src/model/model.cpp +++ b/src/model/model.cpp @@ -535,11 +535,7 @@ void block::loadPayload(const buffer &data) break; } - // unk - // seen: 0,2,3,4,8,9,516 - READ(data, unk7); - // seen: 0.0, 0.0222222, 0.0444444, 0.0555556, 0.03125, 0.0375, 0.0625, 0.1, 0.125, 100, inf - READ(data, unk9); // scale? probably no + READ(data, atex); READ(data, unk10); READ(data, auto_animation); READ(data, animation_cycle); @@ -594,7 +590,7 @@ void block::loadPayload(const buffer &data) read_more_faces(); } - if (unk7 != 0) + if (atex.is_present()) return; std::string s = "extraction error: block: " + std::string(h.name); diff --git a/src/model/model.h b/src/model/model.h index e4ef175..0a9ba6c 100644 --- a/src/model/model.h +++ b/src/model/model.h @@ -329,6 +329,28 @@ struct block aim_vector4 max; }; + struct animated_texture + { + uint16_t zeros0; + uint8_t multiplier_of_number_of_gradations; + uint8_t number_of_gradations; + float time_of_full_cycle; + + float get_actual_number_of_gradations() const + { + if (!multiplier_of_number_of_gradations) + return multiplier_of_number_of_gradations * number_of_gradations; + return number_of_gradations * number_of_gradations; + } + + float get_actual_time_of_full_cycle() const + { + return get_actual_number_of_gradations() * time_of_full_cycle; + } + + bool is_present() const { return number_of_gradations; } + }; + header h; // data @@ -349,10 +371,9 @@ struct block // animations std::vector animations; std::vector damage_models; + animated_texture atex; // unk - uint32_t unk7; - float unk9; uint32_t unk10; float unk8; uint32_t unk11;