From e99bf2b0369a7a80823cf3579a1d6394f998efae Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Mon, 19 Dec 2022 13:36:25 +0100 Subject: [PATCH] Update and clean up UE1 model loader. --- src/common/models/model_ue1.h | 5 ++--- src/common/models/models_ue1.cpp | 37 +++++++++++++++++--------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/common/models/model_ue1.h b/src/common/models/model_ue1.h index 5123a22e9e..9b529b44c7 100644 --- a/src/common/models/model_ue1.h +++ b/src/common/models/model_ue1.h @@ -35,7 +35,6 @@ public: { mDataLump = -1; mAnivLump = -1; - mDataLoaded = false; dhead = NULL; dpolys = NULL; ahead = NULL; @@ -49,7 +48,6 @@ public: private: int mDataLump, mAnivLump; - bool mDataLoaded; // raw data structures struct d3dhead @@ -105,9 +103,10 @@ private: int numFrames; int numPolys; int numGroups; - TArray specialPolys; // for future model attachment support, unused for now + bool hasWeaponTriangle; TArray verts; TArray polys; TArray groups; + //TArray weapondata; // pseudo-bone generated from weapon triangle (not yet implemented) }; diff --git a/src/common/models/models_ue1.cpp b/src/common/models/models_ue1.cpp index 70245bc458..5db36a672b 100644 --- a/src/common/models/models_ue1.cpp +++ b/src/common/models/models_ue1.cpp @@ -165,13 +165,17 @@ void FUE1Model::LoadGeometry() // populate poly groups (subdivided by texture number and type) // this method minimizes searches in the group list as much as possible // while still doing a single pass through the poly list + groups.Reset(); int curgroup = -1; UE1Group Group; + hasWeaponTriangle = false; + int weapontri = -1; for ( int i=0; iGetType())) return; - if ( !mDataLoaded ) - LoadGeometry(); + LoadGeometry(); int vsize = 0; for ( int i=0; iUnlockVertexBuffer(); + UnloadGeometry(); // don't forget this, save precious RAM } void FUE1Model::AddSkins( uint8_t *hitlist, const FTextureID* surfaceskinids) @@ -320,5 +323,5 @@ void FUE1Model::AddSkins( uint8_t *hitlist, const FTextureID* surfaceskinids) FUE1Model::~FUE1Model() { - UnloadGeometry(); + groups.Reset(); }