Mod_LoadMD2: Set max/min

This commit is contained in:
Denis Pauk 2022-10-08 23:29:58 +03:00
parent e01e5273f8
commit 1dc617dee6
5 changed files with 16 additions and 29 deletions

View file

@ -32,7 +32,8 @@ Mod_LoadAliasModel/Mod_LoadMD2
=================
*/
dmdl_t *
Mod_LoadMD2 (const char *mod_name, const void *buffer, int modfilelen, void **extradata)
Mod_LoadMD2 (const char *mod_name, const void *buffer, int modfilelen,
vec3_t mins, vec3_t maxs, void **extradata)
{
int i, j;
dmdl_t *pinmodel, *pheader;
@ -179,6 +180,13 @@ Mod_LoadMD2 (const char *mod_name, const void *buffer, int modfilelen, void **ex
memcpy ((char *)pheader + pheader->ofs_skins, (char *)pinmodel + pheader->ofs_skins,
pheader->num_skins*MAX_SKINNAME);
mins[0] = -32;
mins[1] = -32;
mins[2] = -32;
maxs[0] = 32;
maxs[1] = 32;
maxs[2] = 32;
return pheader;
}

View file

@ -184,13 +184,6 @@ Mod_AliasModelFixup(model_t *mod, const dmdl_t *pheader)
it_skin);
}
}
mod->mins[0] = -32;
mod->mins[1] = -32;
mod->mins[2] = -32;
mod->maxs[0] = 32;
mod->maxs[1] = 32;
mod->maxs[2] = 32;
}
/*
@ -207,7 +200,6 @@ Mod_SP2Fixup(model_t *mod, const dsprite_t *sprout)
{
int i;
/* byte swap everything */
for (i = 0; i < sprout->numframes; i++)
{
mod->skins[i] = R_FindImage((char *)sprout->frames[i].name,
@ -302,7 +294,8 @@ Mod_ForName (char *name, model_t *parent_model, qboolean crash)
{
const dmdl_t *pheader;
pheader = Mod_LoadMD2(mod->name, buf, modfilelen, &(mod->extradata));
pheader = Mod_LoadMD2(mod->name, buf, modfilelen,
mod->mins, mod->maxs, &(mod->extradata));
if (!pheader)
{
ri.Sys_Error(ERR_DROP, "%s: Failed to load %s",

View file

@ -983,13 +983,6 @@ Mod_AliasModelFixup(gl3model_t *mod, const dmdl_t *pheader)
it_skin);
}
}
mod->mins[0] = -32;
mod->mins[1] = -32;
mod->mins[2] = -32;
mod->maxs[0] = 32;
mod->maxs[1] = 32;
mod->maxs[2] = 32;
}
/*
@ -1006,7 +999,6 @@ Mod_SP2Fixup(gl3model_t *mod, const dsprite_t *sprout)
{
int i;
/* byte swap everything */
for (i = 0; i < sprout->numframes; i++)
{
mod->skins[i] = GL3_FindImage((char *)sprout->frames[i].name,
@ -1101,7 +1093,8 @@ Mod_ForName (char *name, gl3model_t *parent_model, qboolean crash)
{
const dmdl_t *pheader;
pheader = Mod_LoadMD2(mod->name, buf, modfilelen, &(mod->extradata));
pheader = Mod_LoadMD2(mod->name, buf, modfilelen,
mod->mins, mod->maxs, &(mod->extradata));
if (!pheader)
{
ri.Sys_Error(ERR_DROP, "%s: Failed to load %s",

View file

@ -95,7 +95,7 @@ extern const byte* Mod_DecompressVis(const byte *in, int row);
/* Shared models load */
dmdl_t * Mod_LoadMD2 (const char *mod_name, const void *buffer, int modfilelen,
void **extradata);
vec3_t mins, vec3_t maxs, void **extradata);
dsprite_t *Mod_LoadSP2 (const char *mod_name, const void *buffer, int modfilelen,
void **extradata);

View file

@ -143,13 +143,6 @@ Mod_AliasModelFixup(model_t *mod, const dmdl_t *pheader)
it_skin);
}
}
mod->mins[0] = -32;
mod->mins[1] = -32;
mod->mins[2] = -32;
mod->maxs[0] = 32;
mod->maxs[1] = 32;
mod->maxs[2] = 32;
}
/*
@ -166,7 +159,6 @@ Mod_SP2Fixup(model_t *mod, const dsprite_t *sprout)
{
int i;
/* byte swap everything */
for (i = 0; i < sprout->numframes; i++)
{
mod->skins[i] = R_FindImage ((char *)sprout->frames[i].name,
@ -260,7 +252,8 @@ Mod_ForName (char *name, model_t *parent_model, qboolean crash)
{
const dmdl_t *pheader;
pheader = Mod_LoadMD2(mod->name, buf, modfilelen, &(mod->extradata));
pheader = Mod_LoadMD2(mod->name, buf, modfilelen,
mod->mins, mod->maxs, &(mod->extradata));
if (!pheader)
{
ri.Sys_Error(ERR_DROP, "%s: Failed to load %s",