Fix Q1 MDL group frame loading, e.g. Q1 progs/flame2.mdl

pull/3743/head
Garux 2021-04-05 17:06:49 +03:00
parent 06a60c43cf
commit 856547be23
2 changed files with 4 additions and 2 deletions

View File

@ -696,6 +696,8 @@ struct GroupFrame
//! 0 = simple frame, !0 = group frame //! 0 = simple frame, !0 = group frame
int32_t type; int32_t type;
int32_t numframes;
//! Minimum vertex for all single frames //! Minimum vertex for all single frames
Vertex min; Vertex min;
@ -703,7 +705,7 @@ struct GroupFrame
Vertex max; Vertex max;
//! Time for all single frames //! Time for all single frames
float *time; float time; // float[numframes]
//! List of single frames //! List of single frames
SimpleFrame *frames; SimpleFrame *frames;

View File

@ -428,7 +428,7 @@ void MDLImporter::InternReadFile_Quake1() {
} else { } else {
// get the first frame in the group // get the first frame in the group
BE_NCONST MDL::GroupFrame *pcFrames2 = (BE_NCONST MDL::GroupFrame *)pcFrames; BE_NCONST MDL::GroupFrame *pcFrames2 = (BE_NCONST MDL::GroupFrame *)pcFrames;
pcFirstFrame = &(pcFrames2->frames[0]); pcFirstFrame = (MDL::SimpleFrame *)( &pcFrames2->time + pcFrames2->numframes );
} }
BE_NCONST MDL::Vertex *pcVertices = (BE_NCONST MDL::Vertex *)((pcFirstFrame->name) + sizeof(pcFirstFrame->name)); BE_NCONST MDL::Vertex *pcVertices = (BE_NCONST MDL::Vertex *)((pcFirstFrame->name) + sizeof(pcFirstFrame->name));
VALIDATE_FILE_SIZE((const unsigned char *)(pcVertices + pcHeader->num_verts)); VALIDATE_FILE_SIZE((const unsigned char *)(pcVertices + pcHeader->num_verts));