Merge pull request #3743 from Garux/Q1MDLgroup

Fix Q1 MDL group frame loading, e.g. Q1 progs/flame2.mdl
kimkulling-issues-3726
Kim Kulling 2021-10-01 14:03:08 +02:00 committed by GitHub
commit 2f5a31110c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -696,14 +696,16 @@ struct GroupFrame
//! 0 = simple frame, !0 = group frame
int32_t type;
int32_t numframes;
//! Minimum vertex for all single frames
Vertex min;
//! Maximum vertex for all single frames
Vertex max;
//! Time for all single frames
float *time;
//! List of times for all single frames
float *times;
//! List of single frames
SimpleFrame *frames;

View File

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