mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-01-22 09:11:33 +00:00
models: add mdl hack for subframes
Fixes wizard spark spawn errors.
This commit is contained in:
parent
0d48f5e0ec
commit
416e4b1269
1 changed files with 29 additions and 6 deletions
|
@ -682,12 +682,11 @@ Mod_LoadModel_MDL(const char *mod_name, const void *buffer, int modfilelen,
|
||||||
/* register all frames */
|
/* register all frames */
|
||||||
for (i = 0; i < num_frames; ++i)
|
for (i = 0; i < num_frames; ++i)
|
||||||
{
|
{
|
||||||
|
int frame_type, j, frames_skip;
|
||||||
daliasframe_t *frame;
|
daliasframe_t *frame;
|
||||||
int frame_type, j;
|
|
||||||
dxtrivertx_t* poutvertx;
|
dxtrivertx_t* poutvertx;
|
||||||
dtrivertx_t *pinvertx;
|
dtrivertx_t *pinvertx;
|
||||||
|
|
||||||
|
|
||||||
frame = (daliasframe_t *) ((byte *)pheader + ofs_frames + i * framesize);
|
frame = (daliasframe_t *) ((byte *)pheader + ofs_frames + i * framesize);
|
||||||
frame->scale[0] = LittleFloat(pinmodel->scale[0]) / 0xFF;
|
frame->scale[0] = LittleFloat(pinmodel->scale[0]) / 0xFF;
|
||||||
frame->scale[1] = LittleFloat(pinmodel->scale[1]) / 0xFF;
|
frame->scale[1] = LittleFloat(pinmodel->scale[1]) / 0xFF;
|
||||||
|
@ -702,14 +701,28 @@ Mod_LoadModel_MDL(const char *mod_name, const void *buffer, int modfilelen,
|
||||||
/* 0 = simple, !0 = group */
|
/* 0 = simple, !0 = group */
|
||||||
/* this program can't read models composed of group frames! */
|
/* this program can't read models composed of group frames! */
|
||||||
frame_type = LittleLong(((int *)curr_pos)[0]);
|
frame_type = LittleLong(((int *)curr_pos)[0]);
|
||||||
curr_pos += sizeof(frame_type);
|
curr_pos += sizeof(int);
|
||||||
|
|
||||||
|
frames_skip = 1;
|
||||||
|
|
||||||
if (frame_type)
|
if (frame_type)
|
||||||
{
|
{
|
||||||
R_Printf(PRINT_ALL, "%s: model %s has unsupported frame type %d",
|
frames_skip = LittleLong(((int *)curr_pos)[0]);
|
||||||
__func__, mod_name, frame_type);
|
/* skip count of frames */
|
||||||
return NULL;
|
curr_pos += sizeof(int);
|
||||||
|
/* skip bboxmin, bouding box min */
|
||||||
|
curr_pos += sizeof(dtrivertx_t);
|
||||||
|
/* skip bboxmax, bouding box max */
|
||||||
|
curr_pos += sizeof(dtrivertx_t);
|
||||||
|
|
||||||
|
/* skip intervals */
|
||||||
|
curr_pos += frames_skip * sizeof(float);
|
||||||
|
|
||||||
|
R_Printf(PRINT_DEVELOPER,
|
||||||
|
"%s: model %s have used first one of %d subframes\n",
|
||||||
|
__func__, mod_name, frames_skip);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* skip bboxmin, bouding box min */
|
/* skip bboxmin, bouding box min */
|
||||||
curr_pos += sizeof(dtrivertx_t);
|
curr_pos += sizeof(dtrivertx_t);
|
||||||
/* skip bboxmax, bouding box max */
|
/* skip bboxmax, bouding box max */
|
||||||
|
@ -727,6 +740,16 @@ Mod_LoadModel_MDL(const char *mod_name, const void *buffer, int modfilelen,
|
||||||
poutvertx[j].lightnormalindex = pinvertx[j].lightnormalindex;
|
poutvertx[j].lightnormalindex = pinvertx[j].lightnormalindex;
|
||||||
}
|
}
|
||||||
curr_pos += sizeof(dtrivertx_t) * num_xyz;
|
curr_pos += sizeof(dtrivertx_t) * num_xyz;
|
||||||
|
|
||||||
|
/* next frames in frame group is unsupported */
|
||||||
|
curr_pos += (frames_skip - 1) * (
|
||||||
|
/* bouding box */
|
||||||
|
sizeof(dtrivertx_t) * 2 +
|
||||||
|
/* name */
|
||||||
|
16 +
|
||||||
|
/* verts */
|
||||||
|
sizeof(dtrivertx_t) * num_xyz
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue