console line scrolling fix, MDL/MD2/MD3/ZYM/DPM loading will no longer Sys_Error (still need bounds checking)

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2095 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-03-12 08:01:48 +00:00
parent 3b73a69432
commit 2df1c6674b
5 changed files with 293 additions and 101 deletions

View file

@ -519,6 +519,7 @@ Interactive line editing and console scrollback
void Key_Console (int key) void Key_Console (int key)
{ {
char *clipText; char *clipText;
int upperconbound;
if (con_current->redirect) if (con_current->redirect)
{ {
@ -693,15 +694,21 @@ void Key_Console (int key)
return; return;
} }
upperconbound = con_current->current - con_current->totallines + 1;
if (key == K_PGUP || key==K_MWHEELUP) if (key == K_PGUP || key==K_MWHEELUP)
{ {
con_current->display -= 2; con_current->display -= 2;
if (con_current->display < upperconbound)
con_current->display = upperconbound;
return; return;
} }
if (key == K_PGDN || key==K_MWHEELDOWN) if (key == K_PGDN || key==K_MWHEELDOWN)
{ {
con_current->display += 2; con_current->display += 2;
if (con_current->display < upperconbound)
con_current->display = upperconbound;
if (con_current->display > con_current->current) if (con_current->display > con_current->current)
con_current->display = con_current->current; con_current->display = con_current->current;
return; return;
@ -710,7 +717,7 @@ void Key_Console (int key)
if (key == K_HOME) if (key == K_HOME)
{ {
if (keydown[K_CTRL]) if (keydown[K_CTRL])
con_current->display = con_current->current - con_current->totallines + 10; con_current->display = upperconbound;
else else
key_linepos = 1; key_linepos = 1;
return; return;

View file

@ -3081,7 +3081,8 @@ static void *Q1_LoadFrameGroup (daliasframetype_t *pframetype, int *seamremaps)
pframetype = (daliasframetype_t *)pinframe; pframetype = (daliasframetype_t *)pinframe;
break; break;
default: default:
Sys_Error("Bad frame type in %s\n", loadmodel->name); Con_Printf(S_ERROR "Bad frame type in %s\n", loadmodel->name);
return NULL;
} }
frame++; frame++;
} }
@ -3315,7 +3316,7 @@ static void *Q1_LoadSkins (daliasskintype_t *pskintype, qboolean alpha)
} }
#endif #endif
void GL_LoadQ1Model (model_t *mod, void *buffer) qboolean GL_LoadQ1Model (model_t *mod, void *buffer)
{ {
#ifndef SERVERONLY #ifndef SERVERONLY
vec2_t *st_array; vec2_t *st_array;
@ -3345,8 +3346,11 @@ void GL_LoadQ1Model (model_t *mod, void *buffer)
version = pq1inmodel->version; version = pq1inmodel->version;
if (version != ALIAS_VERSION) if (version != ALIAS_VERSION)
Sys_Error ("%s has wrong version number (%i should be %i)", {
Con_Printf (S_ERROR "%s has wrong version number (%i should be %i)",
mod->name, version, ALIAS_VERSION); mod->name, version, ALIAS_VERSION);
return false;
}
if (pq1inmodel->numframes < 1 || if (pq1inmodel->numframes < 1 ||
pq1inmodel->numskins < 1 || pq1inmodel->numskins < 1 ||
@ -3354,7 +3358,10 @@ void GL_LoadQ1Model (model_t *mod, void *buffer)
pq1inmodel->numverts < 3 || pq1inmodel->numverts < 3 ||
pq1inmodel->skinheight < 1 || pq1inmodel->skinheight < 1 ||
pq1inmodel->skinwidth < 1) pq1inmodel->skinwidth < 1)
Sys_Error("Model %s has an invalid quantity\n", mod->name); {
Con_Printf(S_ERROR "Model %s has an invalid quantity\n", mod->name);
return false;
}
mod->flags = pq1inmodel->flags; mod->flags = pq1inmodel->flags;
@ -3437,8 +3444,15 @@ void GL_LoadQ1Model (model_t *mod, void *buffer)
} }
//frames //frames
Q1_LoadFrameGroup((daliasframetype_t *)&pintriangles[pq1inmodel->numtris], seamremap); if (Q1_LoadFrameGroup((daliasframetype_t *)&pintriangles[pq1inmodel->numtris], seamremap) == NULL)
{
BZ_Free(seamremap);
Hunk_FreeToLowMark (hunkstart);
return false;
}
BZ_Free(seamremap); BZ_Free(seamremap);
#ifndef SERVERONLY #ifndef SERVERONLY
if (r_shadows.value) if (r_shadows.value)
{ {
@ -3462,13 +3476,15 @@ void GL_LoadQ1Model (model_t *mod, void *buffer)
if (!mod->cache.data) if (!mod->cache.data)
{ {
Hunk_FreeToLowMark (hunkstart); Hunk_FreeToLowMark (hunkstart);
return; return false;
} }
memcpy (mod->cache.data, galias, hunktotal); memcpy (mod->cache.data, galias, hunktotal);
Hunk_FreeToLowMark (hunkstart); Hunk_FreeToLowMark (hunkstart);
mod->funcs.Trace = GLMod_Trace; mod->funcs.Trace = GLMod_Trace;
return true;
} }
#endif #endif
@ -3554,7 +3570,7 @@ static void Q2_LoadSkins(char *skins)
} }
#define MD2_MAX_TRIANGLES 4096 #define MD2_MAX_TRIANGLES 4096
void GL_LoadQ2Model (model_t *mod, void *buffer) qboolean GL_LoadQ2Model (model_t *mod, void *buffer)
{ {
#ifndef SERVERONLY #ifndef SERVERONLY
dmd2stvert_t *pinstverts; dmd2stvert_t *pinstverts;
@ -3596,8 +3612,11 @@ void GL_LoadQ2Model (model_t *mod, void *buffer)
version = LittleLong (pq2inmodel->version); version = LittleLong (pq2inmodel->version);
if (version != MD2ALIAS_VERSION) if (version != MD2ALIAS_VERSION)
Sys_Error ("%s has wrong version number (%i should be %i)", {
Con_Printf (S_ERROR "%s has wrong version number (%i should be %i)",
mod->name, version, MD2ALIAS_VERSION); mod->name, version, MD2ALIAS_VERSION);
return false;
}
if (LittleLong(pq2inmodel->num_frames) < 1 || if (LittleLong(pq2inmodel->num_frames) < 1 ||
LittleLong(pq2inmodel->num_skins) < 0 || LittleLong(pq2inmodel->num_skins) < 0 ||
@ -3606,7 +3625,10 @@ void GL_LoadQ2Model (model_t *mod, void *buffer)
LittleLong(pq2inmodel->num_st) < 3 || LittleLong(pq2inmodel->num_st) < 3 ||
LittleLong(pq2inmodel->skinheight) < 1 || LittleLong(pq2inmodel->skinheight) < 1 ||
LittleLong(pq2inmodel->skinwidth) < 1) LittleLong(pq2inmodel->skinwidth) < 1)
Sys_Error("Model %s has an invalid quantity\n", mod->name); {
Con_Printf(S_ERROR "Model %s has an invalid quantity\n", mod->name);
return false;
}
mod->flags = 0; mod->flags = 0;
@ -3788,13 +3810,15 @@ void GL_LoadQ2Model (model_t *mod, void *buffer)
if (!mod->cache.data) if (!mod->cache.data)
{ {
Hunk_FreeToLowMark (hunkstart); Hunk_FreeToLowMark (hunkstart);
return; return false;
} }
memcpy (mod->cache.data, galias, hunktotal); memcpy (mod->cache.data, galias, hunktotal);
Hunk_FreeToLowMark (hunkstart); Hunk_FreeToLowMark (hunkstart);
mod->funcs.Trace = GLMod_Trace; mod->funcs.Trace = GLMod_Trace;
return true;
} }
#endif #endif
@ -4117,7 +4141,7 @@ typedef struct {
} md3Shader_t; } md3Shader_t;
//End of Tenebrae 'assistance' //End of Tenebrae 'assistance'
void GL_LoadQ3Model(model_t *mod, void *buffer) qboolean GL_LoadQ3Model(model_t *mod, void *buffer)
{ {
#ifndef SERVERONLY #ifndef SERVERONLY
galiasskin_t *skin; galiasskin_t *skin;
@ -4181,7 +4205,7 @@ void GL_LoadQ3Model(model_t *mod, void *buffer)
for (s = 0; s < LittleLong(header->numSurfaces); s++) for (s = 0; s < LittleLong(header->numSurfaces); s++)
{ {
if (LittleLong(surf->ident) != MD3_IDENT) if (LittleLong(surf->ident) != MD3_IDENT)
Con_Printf("Warning: md3 sub-surface doesn't match ident\n"); Con_Printf(S_WARNING "Warning: md3 sub-surface doesn't match ident\n");
size = sizeof(galiasinfo_t) + sizeof(galiasgroup_t)*LittleLong(header->numFrames); size = sizeof(galiasinfo_t) + sizeof(galiasgroup_t)*LittleLong(header->numFrames);
galias = Hunk_Alloc(size); galias = Hunk_Alloc(size);
galias->groupofs = sizeof(*galias); //frame groups galias->groupofs = sizeof(*galias); //frame groups
@ -4450,13 +4474,15 @@ void GL_LoadQ3Model(model_t *mod, void *buffer)
if (!mod->cache.data) if (!mod->cache.data)
{ {
Hunk_FreeToLowMark (hunkstart); Hunk_FreeToLowMark (hunkstart);
return; return false;
} }
memcpy (mod->cache.data, root, hunktotal); memcpy (mod->cache.data, root, hunktotal);
Hunk_FreeToLowMark (hunkstart); Hunk_FreeToLowMark (hunkstart);
mod->funcs.Trace = GLMod_Trace; mod->funcs.Trace = GLMod_Trace;
return true;
} }
#endif #endif
@ -4521,7 +4547,7 @@ typedef struct zymvertex_s
//this can generate multiple meshes (one for each shader). //this can generate multiple meshes (one for each shader).
//but only one set of transforms are ever generated. //but only one set of transforms are ever generated.
void GLMod_LoadZymoticModel(model_t *mod, void *buffer) qboolean GLMod_LoadZymoticModel(model_t *mod, void *buffer)
{ {
#ifndef SERVERONLY #ifndef SERVERONLY
galiasskin_t *skin; galiasskin_t *skin;
@ -4568,20 +4594,31 @@ void GLMod_LoadZymoticModel(model_t *mod, void *buffer)
header = buffer; header = buffer;
if (memcmp(header->id, "ZYMOTICMODEL", 12)) if (memcmp(header->id, "ZYMOTICMODEL", 12))
Sys_Error("GLMod_LoadZymoticModel: doesn't appear to BE a zymotic!\n"); {
Con_Printf("GLMod_LoadZymoticModel: %s, doesn't appear to BE a zymotic!\n", mod->name);
return false;
}
if (BigLong(header->type) != 1) if (BigLong(header->type) != 1)
Sys_Error("GLMod_LoadZymoticModel: only type 1 is supported\n"); {
Con_Printf("GLMod_LoadZymoticModel: %s, only type 1 is supported\n", mod->name);
return false;
}
for (i = 0; i < sizeof(zymtype1header_t)/4; i++) for (i = 0; i < sizeof(zymtype1header_t)/4; i++)
((int*)header)[i] = BigLong(((int*)header)[i]); ((int*)header)[i] = BigLong(((int*)header)[i]);
if (!header->numverts) if (!header->numverts)
Sys_Error("GLMod_LoadZymoticModel: no vertexes\n"); {
Con_Printf("GLMod_LoadZymoticModel: %s, no vertexes\n", mod->name);
return false;
}
if (!header->numsurfaces) if (!header->numsurfaces)
Sys_Error("GLMod_LoadZymoticModel: no surfaces\n"); {
Con_Printf("GLMod_LoadZymoticModel: %s, no surfaces\n", mod->name);
return false;
}
VectorCopy(header->mins, mod->mins); VectorCopy(header->mins, mod->mins);
VectorCopy(header->maxs, mod->maxs); VectorCopy(header->maxs, mod->maxs);
@ -4603,7 +4640,11 @@ void GLMod_LoadZymoticModel(model_t *mod, void *buffer)
{ {
v++; v++;
if (v == header->numverts) if (v == header->numverts)
Sys_Error("GLMod_LoadZymoticModel: Too many transformations\n"); {
Con_Printf("GLMod_LoadZymoticModel: %s, too many transformations\n", mod->name);
Hunk_FreeToLowMark(hunkstart);
return false;
}
vertbonecounts[v] = BigLong(vertbonecounts[v]); vertbonecounts[v] = BigLong(vertbonecounts[v]);
multiplier = 1.0f / vertbonecounts[v]; multiplier = 1.0f / vertbonecounts[v];
} }
@ -4616,10 +4657,17 @@ void GLMod_LoadZymoticModel(model_t *mod, void *buffer)
vertbonecounts[v]--; vertbonecounts[v]--;
} }
if (intrans != (zymvertex_t *)((char*)header + header->lump_verts.start)) if (intrans != (zymvertex_t *)((char*)header + header->lump_verts.start))
Sys_Error("Vertex transforms list appears corrupt."); {
Con_Printf(S_ERROR "%s, Vertex transforms list appears corrupt.", mod->name);
Hunk_FreeToLowMark(hunkstart);
return false;
}
if (vertbonecounts != (int *)((char*)header + header->lump_vertbonecounts.start)) if (vertbonecounts != (int *)((char*)header + header->lump_vertbonecounts.start))
Sys_Error("Vertex bone counts list appears corrupt."); {
Con_Printf(S_ERROR "%s, Vertex bone counts list appears corrupt.", mod->name);
Hunk_FreeToLowMark(hunkstart);
return false;
}
root->numverts = v+1; root->numverts = v+1;
@ -4651,7 +4699,11 @@ void GLMod_LoadZymoticModel(model_t *mod, void *buffer)
renderlist += root[i].numindexes; renderlist += root[i].numindexes;
} }
if (renderlist != (int*)((char*)header + header->lump_render.start + header->lump_render.length)) if (renderlist != (int*)((char*)header + header->lump_render.start + header->lump_render.length))
Sys_Error("Render list appears corrupt."); {
Con_Printf(S_ERROR "%s, render list appears corrupt.", mod->name);
Hunk_FreeToLowMark(hunkstart);
return false;
}
grp = Hunk_Alloc(sizeof(*grp)*header->numscenes*header->numsurfaces); grp = Hunk_Alloc(sizeof(*grp)*header->numscenes*header->numsurfaces);
matrix = Hunk_Alloc(header->lump_poses.length); matrix = Hunk_Alloc(header->lump_poses.length);
@ -4714,7 +4766,11 @@ void GLMod_LoadZymoticModel(model_t *mod, void *buffer)
} }
if (inscene != (zymscene_t*)((char*)header + header->lump_scenes.start+header->lump_scenes.length)) if (inscene != (zymscene_t*)((char*)header + header->lump_scenes.start+header->lump_scenes.length))
Sys_Error("scene list appears corrupt."); {
Con_Printf(S_ERROR "%s, scene list appears corrupt.", mod->name);
Hunk_FreeToLowMark(hunkstart);
return false;
}
for (i = 0; i < header->numsurfaces-1; i++) for (i = 0; i < header->numsurfaces-1; i++)
root[i].nextsurf = sizeof(galiasinfo_t); root[i].nextsurf = sizeof(galiasinfo_t);
@ -4745,7 +4801,7 @@ void GLMod_LoadZymoticModel(model_t *mod, void *buffer)
if (!mod->cache.data) if (!mod->cache.data)
{ {
Hunk_FreeToLowMark (hunkstart); Hunk_FreeToLowMark (hunkstart);
return; return false;
} }
memcpy (mod->cache.data, root, hunktotal); memcpy (mod->cache.data, root, hunktotal);
@ -4753,6 +4809,8 @@ void GLMod_LoadZymoticModel(model_t *mod, void *buffer)
mod->funcs.Trace = GLMod_Trace; mod->funcs.Trace = GLMod_Trace;
return true;
} }
@ -4846,7 +4904,7 @@ typedef struct dpmvertex_s
// immediately followed by 1 or more dpmbonevert_t structures // immediately followed by 1 or more dpmbonevert_t structures
} dpmvertex_t; } dpmvertex_t;
void GLMod_LoadDarkPlacesModel(model_t *mod, void *buffer) qboolean GLMod_LoadDarkPlacesModel(model_t *mod, void *buffer)
{ {
#ifndef SERVERONLY #ifndef SERVERONLY
galiasskin_t *skin; galiasskin_t *skin;
@ -4890,20 +4948,35 @@ void GLMod_LoadDarkPlacesModel(model_t *mod, void *buffer)
header = buffer; header = buffer;
if (memcmp(header->id, "DARKPLACESMODEL\0", 16)) if (memcmp(header->id, "DARKPLACESMODEL\0", 16))
Sys_Error("GLMod_LoadDarkPlacesModel: doesn't appear to be a darkplaces model!\n"); {
Con_Printf(S_ERROR "GLMod_LoadDarkPlacesModel: %s, doesn't appear to be a darkplaces model!\n", mod->name);
return false;
}
if (BigLong(header->type) != 2) if (BigLong(header->type) != 2)
Sys_Error("GLMod_LoadDarkPlacesModel: only type 2 is supported\n"); {
Con_Printf(S_ERROR "GLMod_LoadDarkPlacesModel: %s, only type 2 is supported\n", mod->name);
return false;
}
for (i = 0; i < sizeof(dpmheader_t)/4; i++) for (i = 0; i < sizeof(dpmheader_t)/4; i++)
((int*)header)[i] = BigLong(((int*)header)[i]); ((int*)header)[i] = BigLong(((int*)header)[i]);
if (!header->num_bones) if (!header->num_bones)
Sys_Error("GLMod_LoadDarkPlacesModel: no bones\n"); {
Con_Printf(S_ERROR "GLMod_LoadDarkPlacesModel: %s, no bones\n", mod->name);
return false;
}
if (!header->num_frames) if (!header->num_frames)
Sys_Error("GLMod_LoadDarkPlacesModel: no frames\n"); {
Con_Printf(S_ERROR "GLMod_LoadDarkPlacesModel: %s, no frames\n", mod->name);
return false;
}
if (!header->num_meshs) if (!header->num_meshs)
Sys_Error("GLMod_LoadDarkPlacesModel: no surfaces\n"); {
Con_Printf(S_ERROR "GLMod_LoadDarkPlacesModel: %s, no surfaces\n", mod->name);
return false;
}
VectorCopy(header->mins, mod->mins); VectorCopy(header->mins, mod->mins);
@ -4989,7 +5062,11 @@ void GLMod_LoadDarkPlacesModel(model_t *mod, void *buffer)
{ {
outbone[i].parent = BigLong(inbone[i].parent); outbone[i].parent = BigLong(inbone[i].parent);
if (outbone[i].parent >= i || outbone[i].parent < -1) if (outbone[i].parent >= i || outbone[i].parent < -1)
Sys_Error("GLMod_LoadDarkPlacesModel: bad bone index in %s\n", mod->name); {
Con_Printf(S_ERROR "GLMod_LoadDarkPlacesModel: bad bone index in %s\n", mod->name);
Hunk_FreeToLowMark(hunkstart);
return false;
}
Q_strncpyz(outbone[i].name, inbone[i].name, sizeof(outbone[i].name)); Q_strncpyz(outbone[i].name, inbone[i].name, sizeof(outbone[i].name));
//throw away the flags. //throw away the flags.
@ -5083,7 +5160,7 @@ void GLMod_LoadDarkPlacesModel(model_t *mod, void *buffer)
if (!mod->cache.data) if (!mod->cache.data)
{ {
Hunk_FreeToLowMark (hunkstart); Hunk_FreeToLowMark (hunkstart);
return; return false;
} }
memcpy (mod->cache.data, root, hunktotal); memcpy (mod->cache.data, root, hunktotal);
@ -5091,6 +5168,8 @@ void GLMod_LoadDarkPlacesModel(model_t *mod, void *buffer)
mod->funcs.Trace = GLMod_Trace; mod->funcs.Trace = GLMod_Trace;
return true;
} }

View file

@ -48,7 +48,7 @@ void CM_Init(void);
void GLMod_LoadCompositeAnim(model_t *mod, void *buffer); void GLMod_LoadCompositeAnim(model_t *mod, void *buffer);
void GL_LoadHeightmapModel (model_t *mod, void *buffer); void GL_LoadHeightmapModel (model_t *mod, void *buffer);
void GLMod_LoadDarkPlacesModel(model_t *mod, void *buffer); qboolean GLMod_LoadDarkPlacesModel(model_t *mod, void *buffer);
void GLMod_LoadSpriteModel (model_t *mod, void *buffer); void GLMod_LoadSpriteModel (model_t *mod, void *buffer);
void GLMod_LoadSprite2Model (model_t *mod, void *buffer); void GLMod_LoadSprite2Model (model_t *mod, void *buffer);
void GLMod_LoadBrushModel (model_t *mod, void *buffer); void GLMod_LoadBrushModel (model_t *mod, void *buffer);
@ -59,7 +59,7 @@ void Mod_LoadHLModel (model_t *mod, void *buffer);
void Mod_LoadAlias3Model (model_t *mod, void *buffer); void Mod_LoadAlias3Model (model_t *mod, void *buffer);
void Mod_LoadGroupModel (model_t *mod, void *buffer); void Mod_LoadGroupModel (model_t *mod, void *buffer);
#ifdef ZYMOTICMODELS #ifdef ZYMOTICMODELS
void GLMod_LoadZymoticModel(model_t *mod, void *buffer); qboolean GLMod_LoadZymoticModel(model_t *mod, void *buffer);
#endif #endif
#ifdef MD5MODELS #ifdef MD5MODELS
void GLMod_LoadMD5MeshModel(model_t *mod, void *buffer); void GLMod_LoadMD5MeshModel(model_t *mod, void *buffer);
@ -70,12 +70,12 @@ model_t *GLMod_LoadModel (model_t *mod, qboolean crash);
qboolean Mod_LoadDoomLevel(model_t *mod); qboolean Mod_LoadDoomLevel(model_t *mod);
#endif #endif
void GL_LoadQ1Model (model_t *mod, void *buffer); qboolean GL_LoadQ1Model (model_t *mod, void *buffer);
#ifdef MD2MODELS #ifdef MD2MODELS
void GL_LoadQ2Model (model_t *mod, void *buffer); qboolean GL_LoadQ2Model (model_t *mod, void *buffer);
#endif #endif
#ifdef MD3MODELS #ifdef MD3MODELS
void GL_LoadQ3Model (model_t *mod, void *buffer); qboolean GL_LoadQ3Model (model_t *mod, void *buffer);
#endif #endif
#ifdef DOOMWADS #ifdef DOOMWADS
@ -528,18 +528,21 @@ couldntload:
switch (LittleLong(*(unsigned *)buf)) switch (LittleLong(*(unsigned *)buf))
{ {
case IDPOLYHEADER: case IDPOLYHEADER:
GL_LoadQ1Model(mod, buf); if (!GL_LoadQ1Model(mod, buf))
goto couldntload;
break; break;
#ifdef MD2MODELS #ifdef MD2MODELS
case MD2IDALIASHEADER: case MD2IDALIASHEADER:
GL_LoadQ2Model(mod, buf); if (!GL_LoadQ2Model(mod, buf))
goto couldntload;
break; break;
#endif #endif
#ifdef MD3MODELS #ifdef MD3MODELS
case MD3_IDENT: case MD3_IDENT:
GL_LoadQ3Model (mod, buf); if (!GL_LoadQ3Model (mod, buf))
goto couldntload;
break; break;
#endif #endif
@ -582,10 +585,12 @@ couldntload:
break; break;
#ifdef ZYMOTICMODELS #ifdef ZYMOTICMODELS
case (('O'<<24)+('M'<<16)+('Y'<<8)+'Z'): case (('O'<<24)+('M'<<16)+('Y'<<8)+'Z'):
GLMod_LoadZymoticModel(mod, buf); if (!GLMod_LoadZymoticModel(mod, buf))
goto couldntload;
break; break;
case (('K'<<24)+('R'<<16)+('A'<<8)+'D'): case (('K'<<24)+('R'<<16)+('A'<<8)+'D'):
GLMod_LoadDarkPlacesModel(mod, buf); if (!GLMod_LoadDarkPlacesModel(mod, buf))
goto couldntload;
break; break;
#endif #endif
default: default:
@ -611,7 +616,7 @@ couldntload:
} }
#endif #endif
Con_Printf("Unrecognised model format %i\n", LittleLong(*(unsigned *)buf)); Con_Printf(S_ERROR "Unrecognised model format %i loading %s\n", LittleLong(*(unsigned *)buf), mod->name);
goto couldntload; goto couldntload;
} }

View file

@ -25,17 +25,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
model_t *loadmodel; model_t *loadmodel;
char loadname[32]; // for hunk tags char loadname[32]; // for hunk tags
void Mod_LoadSpriteModel (model_t *mod, void *buffer);
void Mod_LoadBrushModel (model_t *mod, void *buffer); void Mod_LoadBrushModel (model_t *mod, void *buffer);
void Mod_LoadQ2BrushModel (model_t *mod, void *buffer); void Mod_LoadQ2BrushModel (model_t *mod, void *buffer);
void Mod_LoadAliasModel (model_t *mod, void *buffer);
model_t *Mod_LoadModel (model_t *mod, qboolean crash);
void GL_LoadQ1Model (model_t *mod, void *buffer); qboolean GL_LoadQ1Model (model_t *mod, void *buffer);
void GL_LoadQ2Model (model_t *mod, void *buffer); qboolean GL_LoadQ2Model (model_t *mod, void *buffer);
void GL_LoadQ3Model (model_t *mod, void *buffer); qboolean GL_LoadQ3Model (model_t *mod, void *buffer);
void GLMod_LoadZymoticModel (model_t *mod, void *buffer); qboolean GLMod_LoadZymoticModel (model_t *mod, void *buffer);
void GLMod_LoadDarkPlacesModel(model_t *mod, void *buffer); qboolean GLMod_LoadDarkPlacesModel(model_t *mod, void *buffer);
qbyte mod_novis[MAX_MAP_LEAFS/8]; qbyte mod_novis[MAX_MAP_LEAFS/8];
@ -294,26 +291,31 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash)
case IDPOLYHEADER: case IDPOLYHEADER:
GL_LoadQ1Model(mod, buf); if (!GL_LoadQ1Model(mod, buf))
return NULL;
break; break;
#ifdef MD2MODELS #ifdef MD2MODELS
case MD2IDALIASHEADER: case MD2IDALIASHEADER:
GL_LoadQ2Model(mod, buf); if (!GL_LoadQ2Model(mod, buf))
return NULL;
break; break;
#endif #endif
#ifdef MD3MODELS #ifdef MD3MODELS
case MD3_IDENT: case MD3_IDENT:
GL_LoadQ3Model (mod, buf); if (!GL_LoadQ3Model (mod, buf))
return NULL;
break; break;
#endif #endif
#ifdef ZYMOTICMODELS #ifdef ZYMOTICMODELS
case (('O'<<24)+('M'<<16)+('Y'<<8)+'Z'): case (('O'<<24)+('M'<<16)+('Y'<<8)+'Z'):
GLMod_LoadZymoticModel(mod, buf); if (!GLMod_LoadZymoticModel(mod, buf))
return NULL;
break; break;
#endif #endif
#ifdef ZYMOTICMODELS #ifdef ZYMOTICMODELS
case (('K'<<24)+('R'<<16)+('A'<<8)+'D'): case (('K'<<24)+('R'<<16)+('A'<<8)+'D'):
GLMod_LoadDarkPlacesModel(mod, buf); if (!GLMod_LoadDarkPlacesModel(mod, buf))
return NULL;
break; break;
#endif #endif

View file

@ -32,9 +32,9 @@ void SWMod_LoadSpriteModel (model_t *mod, void *buffer);
void SWMod_LoadSprite2Model (model_t *mod, void *buffer); void SWMod_LoadSprite2Model (model_t *mod, void *buffer);
void SWMod_LoadBrushModel (model_t *mod, void *buffer); void SWMod_LoadBrushModel (model_t *mod, void *buffer);
void Mod_LoadQ2BrushModel (model_t *mod, void *buffer); void Mod_LoadQ2BrushModel (model_t *mod, void *buffer);
void SWMod_LoadAliasModel (model_t *mod, void *buffer); qboolean SWMod_LoadAliasModel (model_t *mod, void *buffer);
void SWMod_LoadAlias2Model (model_t *mod, void *buffer); qboolean SWMod_LoadAlias2Model (model_t *mod, void *buffer);
void SWMod_LoadAlias3Model (model_t *mod, void *buffer); qboolean SWMod_LoadAlias3Model (model_t *mod, void *buffer);
model_t *SWMod_LoadModel (model_t *mod, qboolean crash); model_t *SWMod_LoadModel (model_t *mod, qboolean crash);
int Mod_ReadFlagsFromMD1(char *name, int md3version); int Mod_ReadFlagsFromMD1(char *name, int md3version);
@ -375,15 +375,18 @@ model_t *SWMod_LoadModel (model_t *mod, qboolean crash)
{ {
#ifndef SERVERONLY #ifndef SERVERONLY
case IDPOLYHEADER: case IDPOLYHEADER:
SWMod_LoadAliasModel (mod, buf); if (!SWMod_LoadAliasModel (mod, buf))
goto couldntload;
break; break;
case MD2IDALIASHEADER: case MD2IDALIASHEADER:
SWMod_LoadAlias2Model (mod, buf); if (!SWMod_LoadAlias2Model (mod, buf))
goto couldntload;
break; break;
case MD3_IDENT: case MD3_IDENT:
SWMod_LoadAlias3Model (mod, buf); if (!SWMod_LoadAlias3Model (mod, buf))
goto couldntload;
break; break;
case IDSPRITEHEADER: case IDSPRITEHEADER:
@ -407,6 +410,7 @@ model_t *SWMod_LoadModel (model_t *mod, qboolean crash)
break; break;
default: //some telejano mods can do this default: //some telejano mods can do this
couldntload:
if (crash) if (crash)
Sys_Error ("Mod_NumForName: %s not found", mod->name); Sys_Error ("Mod_NumForName: %s not found", mod->name);
@ -2124,7 +2128,7 @@ void * SWMod_LoadAliasGroup (void * pin, int *pframeindex, int numv,
{ {
*poutintervals = LittleFloat (pin_intervals->interval); *poutintervals = LittleFloat (pin_intervals->interval);
if (*poutintervals <= 0.0) if (*poutintervals <= 0.0)
Sys_Error ("Mod_LoadAliasGroup: interval<=0"); return NULL;
poutintervals++; poutintervals++;
pin_intervals++; pin_intervals++;
@ -2140,6 +2144,8 @@ void * SWMod_LoadAliasGroup (void * pin, int *pframeindex, int numv,
&paliasgroup->frames[i].bboxmin, &paliasgroup->frames[i].bboxmin,
&paliasgroup->frames[i].bboxmax, &paliasgroup->frames[i].bboxmax,
pheader, name); pheader, name);
if (ptemp == NULL)
return NULL;
} }
return ptemp; return ptemp;
@ -2252,7 +2258,7 @@ void * SWMod_LoadAliasSkinGroup (void * pin, int *pskinindex, int skinsize,
Mod_LoadAliasModel Mod_LoadAliasModel
================= =================
*/ */
void SWMod_LoadAliasModel (model_t *mod, void *buffer) qboolean SWMod_LoadAliasModel (model_t *mod, void *buffer)
{ {
int i; int i;
mmdl_t *pmodel; mmdl_t *pmodel;
@ -2300,8 +2306,11 @@ void SWMod_LoadAliasModel (model_t *mod, void *buffer)
version = LittleLong (pinmodel->version); version = LittleLong (pinmodel->version);
if (version != ALIAS_VERSION) if (version != ALIAS_VERSION)
Sys_Error ("%s has wrong version number (%i should be %i)", {
Con_Printf (S_ERROR "%s has wrong version number (%i should be %i)",
mod->name, version, ALIAS_VERSION); mod->name, version, ALIAS_VERSION);
return false;
}
// //
// allocate space for a working header, plus all the data except the frames, // allocate space for a working header, plus all the data except the frames,
@ -2330,21 +2339,38 @@ void SWMod_LoadAliasModel (model_t *mod, void *buffer)
pmodel->skinheight = LittleLong (pinmodel->skinheight); pmodel->skinheight = LittleLong (pinmodel->skinheight);
if (pmodel->skinheight > MAX_LBM_HEIGHT) if (pmodel->skinheight > MAX_LBM_HEIGHT)
Sys_Error ("model %s has a skin taller than %d", mod->name, {
// TODO: at least downsize the skin
Con_Printf (S_ERROR "model %s has a skin taller than %d", mod->name,
MAX_LBM_HEIGHT); MAX_LBM_HEIGHT);
Hunk_FreeToLowMark(start);
return false;
}
pmodel->numstverts = pmodel->numverts = LittleLong (pinmodel->numverts); pmodel->numstverts = pmodel->numverts = LittleLong (pinmodel->numverts);
if (pmodel->numverts <= 0) if (pmodel->numverts <= 0)
Sys_Error ("model %s has no vertices", mod->name); {
Con_Printf (S_ERROR "model %s has no vertices", mod->name);
Hunk_FreeToLowMark(start);
return false;
}
if (pmodel->numverts > MAXALIASVERTS) if (pmodel->numverts > MAXALIASVERTS)
Sys_Error ("model %s has too many vertices", mod->name); {
Con_Printf (S_ERROR "model %s has too many vertices", mod->name);
Hunk_FreeToLowMark(start);
return false;
}
pmodel->numtris = LittleLong (pinmodel->numtris); pmodel->numtris = LittleLong (pinmodel->numtris);
if (pmodel->numtris <= 0) if (pmodel->numtris <= 0)
Sys_Error ("model %s has no triangles", mod->name); {
Con_Printf (S_ERROR "model %s has no triangles", mod->name);
Hunk_FreeToLowMark(start);
return false;
}
pmodel->numframes = LittleLong (pinmodel->numframes); pmodel->numframes = LittleLong (pinmodel->numframes);
pmodel->size = LittleFloat (pinmodel->size) * ALIAS_BASE_SIZE_RATIO; pmodel->size = LittleFloat (pinmodel->size) * ALIAS_BASE_SIZE_RATIO;
@ -2362,7 +2388,11 @@ void SWMod_LoadAliasModel (model_t *mod, void *buffer)
numframes = pmodel->numframes; numframes = pmodel->numframes;
if (pmodel->skinwidth & 0x03) if (pmodel->skinwidth & 0x03)
Sys_Error ("Mod_LoadAliasModel: \"%s\" skinwidth not multiple of 4", loadmodel->name); {
Con_Printf (S_ERROR "Mod_LoadAliasModel: \"%s\" skinwidth not multiple of 4", loadmodel->name);
Hunk_FreeToLowMark(start);
return false;
}
pheader->model = (qbyte *)pmodel - (qbyte *)pheader; pheader->model = (qbyte *)pmodel - (qbyte *)pheader;
@ -2372,7 +2402,11 @@ void SWMod_LoadAliasModel (model_t *mod, void *buffer)
skinsize = pmodel->skinheight * pmodel->skinwidth; skinsize = pmodel->skinheight * pmodel->skinwidth;
if (numskins < 1) if (numskins < 1)
Sys_Error ("Mod_LoadAliasModel: Invalid # of skins: %d\n", numskins); {
Con_Printf (S_ERROR "Mod_LoadAliasModel: %s, invalid # of skins: %d\n", loadmodel->name, numskins);
Hunk_FreeToLowMark(start);
return false;
}
pskintype = (daliasskintype_t *)&pinmodel[1]; pskintype = (daliasskintype_t *)&pinmodel[1];
@ -2454,7 +2488,11 @@ void SWMod_LoadAliasModel (model_t *mod, void *buffer)
// load the frames // load the frames
// //
if (numframes < 1) if (numframes < 1)
Sys_Error ("Mod_LoadAliasModel: Invalid # of frames: %d\n", numframes); {
Con_Printf (S_ERROR "Mod_LoadAliasModel: %s, invalid # of frames: %d\n", mod->name, numframes);
Hunk_FreeToLowMark(start);
return false;
}
pframetype = (daliasframetype_t *)&pintriangles[pmodel->numtris]; pframetype = (daliasframetype_t *)&pintriangles[pmodel->numtris];
@ -2488,6 +2526,13 @@ void SWMod_LoadAliasModel (model_t *mod, void *buffer)
&pheader->frames[i].bboxmax, &pheader->frames[i].bboxmax,
pheader, pheader->frames[i].name); pheader, pheader->frames[i].name);
} }
if (pframetype == NULL)
{
Con_Printf (S_ERROR "SWMod_LoadAliasModel: %s, couldn't load frame data\n", mod->name);
Hunk_FreeToLowMark(start);
return false;
}
} }
mod->type = mod_alias; mod->type = mod_alias;
@ -2511,10 +2556,11 @@ void SWMod_LoadAliasModel (model_t *mod, void *buffer)
Cache_Alloc (&mod->cache, total, loadname); Cache_Alloc (&mod->cache, total, loadname);
if (!mod->cache.data) if (!mod->cache.data)
return; return false;
memcpy (mod->cache.data, pheader, total); memcpy (mod->cache.data, pheader, total);
Hunk_FreeToLowMark (start); Hunk_FreeToLowMark (start);
return true;
} }
typedef struct typedef struct
@ -2525,7 +2571,7 @@ typedef struct
dtrivertx_t verts[1]; // variable sized dtrivertx_t verts[1]; // variable sized
} dmd2aliasframe_t; } dmd2aliasframe_t;
void SWMod_LoadAlias2Model (model_t *mod, void *buffer) qboolean SWMod_LoadAlias2Model (model_t *mod, void *buffer)
{ {
int i, j; int i, j;
mmdl_t *pmodel; mmdl_t *pmodel;
@ -2577,8 +2623,11 @@ void SWMod_LoadAlias2Model (model_t *mod, void *buffer)
version = LittleLong (pinmodel->version); version = LittleLong (pinmodel->version);
if (version != MD2ALIAS_VERSION) if (version != MD2ALIAS_VERSION)
Sys_Error ("%s has wrong version number (%i should be %i)", {
Con_Printf (S_ERROR "%s has wrong version number (%i should be %i)",
mod->name, version, MD2ALIAS_VERSION); mod->name, version, MD2ALIAS_VERSION);
return false;
}
// //
// allocate space for a working header, plus all the data except the frames, // allocate space for a working header, plus all the data except the frames,
@ -2606,22 +2655,38 @@ void SWMod_LoadAlias2Model (model_t *mod, void *buffer)
pmodel->skinheight = LittleLong (pinmodel->skinheight); pmodel->skinheight = LittleLong (pinmodel->skinheight);
if (pmodel->skinheight > MAX_LBM_HEIGHT) if (pmodel->skinheight > MAX_LBM_HEIGHT)
Sys_Error ("model %s has a skin taller than %d", mod->name, {
Con_Printf (S_ERROR "model %s has a skin taller than %d", mod->name,
MAX_LBM_HEIGHT); MAX_LBM_HEIGHT);
Hunk_FreeToLowMark(start);
return false;
}
pmodel->numverts = LittleLong (pinmodel->num_xyz); pmodel->numverts = LittleLong (pinmodel->num_xyz);
pmodel->numstverts = LittleLong (pinmodel->num_st); pmodel->numstverts = LittleLong (pinmodel->num_st);
if (pmodel->numverts <= 0) if (pmodel->numverts <= 0)
Sys_Error ("model %s has no vertices", mod->name); {
Con_Printf (S_ERROR "model %s has no vertices", mod->name);
Hunk_FreeToLowMark(start);
return false;
}
if (pmodel->numverts > MAXALIASVERTS) if (pmodel->numverts > MAXALIASVERTS)
Sys_Error ("model %s has too many vertices", mod->name); {
Con_Printf (S_ERROR "model %s has too many vertices", mod->name);
Hunk_FreeToLowMark(start);
return false;
}
pmodel->numtris = LittleLong (pinmodel->num_tris); pmodel->numtris = LittleLong (pinmodel->num_tris);
if (pmodel->numtris <= 0) if (pmodel->numtris <= 0)
Sys_Error ("model %s has no triangles", mod->name); {
Con_Printf (S_ERROR "model %s has no triangles", mod->name);
Hunk_FreeToLowMark(start);
return false;
}
pmodel->numframes = LittleLong (pinmodel->num_frames); pmodel->numframes = LittleLong (pinmodel->num_frames);
pmodel->size = 1000;//LittleFloat (pinmodel->size) * ALIAS_BASE_SIZE_RATIO; pmodel->size = 1000;//LittleFloat (pinmodel->size) * ALIAS_BASE_SIZE_RATIO;
@ -2639,7 +2704,11 @@ void SWMod_LoadAlias2Model (model_t *mod, void *buffer)
numframes = pmodel->numframes; numframes = pmodel->numframes;
if (pmodel->skinwidth & 0x03) if (pmodel->skinwidth & 0x03)
Sys_Error ("Mod_LoadAliasModel: skinwidth not multiple of 4"); {
Con_Printf (S_ERROR "Mod_LoadAliasModel: %s, skinwidth not multiple of 4", mod->name);
Hunk_FreeToLowMark(start);
return false;
}
pheader->model = (qbyte *)pmodel - (qbyte *)pheader; pheader->model = (qbyte *)pmodel - (qbyte *)pheader;
@ -2681,7 +2750,11 @@ void SWMod_LoadAlias2Model (model_t *mod, void *buffer)
// load the frames // load the frames
// //
if (numframes < 1) if (numframes < 1)
Sys_Error ("Mod_LoadAliasModel: Invalid # of frames: %d\n", numframes); {
Con_Printf (S_ERROR "Mod_LoadAliasModel: %s, Invalid # of frames: %d\n", mod->name, numframes);
Hunk_FreeToLowMark(start);
return false;
}
for (i=0 ; i<numframes ; i++) for (i=0 ; i<numframes ; i++)
{ {
@ -2757,20 +2830,20 @@ void SWMod_LoadAlias2Model (model_t *mod, void *buffer)
buffer = COM_LoadTempFile(skinnames); buffer = COM_LoadTempFile(skinnames);
if (!buffer) if (!buffer)
{ {
Con_Printf("Skin %s not found\n", skinnames); Con_Printf(S_WARNING "Skin %s not found\n", skinnames);
continue; continue;
} }
texture = ReadPCXFile(buffer, com_filesize, &width, &height); texture = ReadPCXFile(buffer, com_filesize, &width, &height);
// BZ_Free(buffer); // BZ_Free(buffer);
if (!texture) if (!texture)
{ {
Con_Printf("Skin %s not a pcx\n", skinnames); Con_Printf(S_WARNING "Skin %s not a pcx\n", skinnames);
continue; continue;
} }
if (width != pmodel->skinwidth || height != pmodel->skinheight) //FIXME: scale if (width != pmodel->skinwidth || height != pmodel->skinheight) //FIXME: scale
{ {
BZ_Free(texture); BZ_Free(texture);
Con_Printf("Skin %s not same size as model specifies it should be\n", skinnames); Con_Printf(S_WARNING "Skin %s not same size as model specifies it should be\n", skinnames);
continue; continue;
} }
@ -2811,10 +2884,11 @@ void SWMod_LoadAlias2Model (model_t *mod, void *buffer)
Cache_Alloc (&mod->cache, total, loadname); Cache_Alloc (&mod->cache, total, loadname);
if (!mod->cache.data) if (!mod->cache.data)
return; return false;
memcpy (mod->cache.data, pheader, total); memcpy (mod->cache.data, pheader, total);
Hunk_FreeToLowMark (start); Hunk_FreeToLowMark (start);
return true;
} }
@ -2915,7 +2989,7 @@ qbyte *LoadTextureFile(char *texturename)
return NULL; return NULL;
} }
void SWMod_LoadAlias3Model (model_t *mod, void *buffer) qboolean SWMod_LoadAlias3Model (model_t *mod, void *buffer)
{ {
int i, j; int i, j;
mmdl_t *pmodel; mmdl_t *pmodel;
@ -3001,22 +3075,38 @@ void SWMod_LoadAlias3Model (model_t *mod, void *buffer)
// pmodel->skinheight = LittleLong (pinmodel->skinheight); // pmodel->skinheight = LittleLong (pinmodel->skinheight);
if (pmodel->skinheight > MAX_LBM_HEIGHT) if (pmodel->skinheight > MAX_LBM_HEIGHT)
Sys_Error ("model %s has a skin taller than %d", mod->name, {
Con_Printf (S_ERROR "model %s has a skin taller than %d", mod->name,
MAX_LBM_HEIGHT); MAX_LBM_HEIGHT);
Hunk_FreeToLowMark(start);
return false;
}
pmodel->numverts = LittleLong (surface->numVerts); pmodel->numverts = LittleLong (surface->numVerts);
pmodel->numstverts = LittleLong (surface->numVerts); pmodel->numstverts = LittleLong (surface->numVerts);
if (surface->numVerts <= 0) if (surface->numVerts <= 0)
Sys_Error ("model %s has no vertices", mod->name); {
Con_Printf (S_ERROR "model %s has no vertices", mod->name);
Hunk_FreeToLowMark(start);
return false;
}
if (pmodel->numverts > MAXALIASVERTS) if (pmodel->numverts > MAXALIASVERTS)
Sys_Error ("model %s has too many vertices", mod->name); {
Con_Printf (S_ERROR "model %s has too many vertices", mod->name);
Hunk_FreeToLowMark(start);
return false;
}
pmodel->numtris = LittleLong (surface->numTriangles); pmodel->numtris = LittleLong (surface->numTriangles);
if (pmodel->numtris <= 0) if (pmodel->numtris <= 0)
Sys_Error ("model %s has no triangles", mod->name); {
Con_Printf (S_ERROR "model %s has no triangles", mod->name);
Hunk_FreeToLowMark(start);
return false;
}
pmodel->numframes = LittleLong (surface->numFrames); pmodel->numframes = LittleLong (surface->numFrames);
pmodel->size = 1000;//LittleFloat (pinmodel->size) * ALIAS_BASE_SIZE_RATIO; pmodel->size = 1000;//LittleFloat (pinmodel->size) * ALIAS_BASE_SIZE_RATIO;
@ -3066,7 +3156,7 @@ void SWMod_LoadAlias3Model (model_t *mod, void *buffer)
if (!buffer) if (!buffer)
{ {
Con_Printf("Skin %s not found\n", pinskin->name); Con_Printf(S_WARNING "Skin %s not found\n", pinskin->name);
continue; continue;
} }
texture = ReadTargaFile(buffer, com_filesize, &width, &height, false); texture = ReadTargaFile(buffer, com_filesize, &width, &height, false);
@ -3083,7 +3173,7 @@ void SWMod_LoadAlias3Model (model_t *mod, void *buffer)
BZ_Free(buffer); BZ_Free(buffer);
if (!texture) if (!texture)
{ {
Con_Printf("Skin %s filetype not recognised\n", pinskin->name); Con_Printf(S_WARNING "Skin %s filetype not recognised\n", pinskin->name);
continue; continue;
} }
if (!pmodel->numskins) //this is the first skin. if (!pmodel->numskins) //this is the first skin.
@ -3095,7 +3185,7 @@ void SWMod_LoadAlias3Model (model_t *mod, void *buffer)
if (width != pmodel->skinwidth || height != pmodel->skinheight) //FIXME: scale if (width != pmodel->skinwidth || height != pmodel->skinheight) //FIXME: scale
{ {
BZ_Free(texture); BZ_Free(texture);
Con_Printf("Skin %s not same size as model specifies it should be\n", pinskin->name); Con_Printf(S_WARNING "Skin %s not same size as model specifies it should be\n", pinskin->name);
continue; continue;
} }
@ -3127,11 +3217,14 @@ void SWMod_LoadAlias3Model (model_t *mod, void *buffer)
} }
if (!pmodel->numskins) if (!pmodel->numskins)
Con_Printf("model %s has no skins\n", loadmodel->name); Con_Printf(S_WARNING "model %s has no skins\n", loadmodel->name);
if (pmodel->skinwidth & 0x03) if (pmodel->skinwidth & 0x03)
Sys_Error ("Mod_LoadAliasModel: skinwidth not multiple of 4"); {
Con_Printf (S_ERROR "Mod_LoadAliasModel: %s, skinwidth not multiple of 4", mod->name);
Hunk_FreeToLowMark(start);
return false;
}
// //
// set base s and t vertices // set base s and t vertices
@ -3170,7 +3263,11 @@ void SWMod_LoadAlias3Model (model_t *mod, void *buffer)
// load the frames // load the frames
// //
if (numframes < 1) if (numframes < 1)
Sys_Error ("Mod_LoadAliasModel: Invalid # of frames: %d\n", numframes); {
Con_Printf (S_ERROR "Mod_LoadAliasModel: %s, Invalid # of frames: %d\n", mod->name, numframes);
Hunk_FreeToLowMark(start);
return false;
}
pinverts = (md3XyzNormal_t *)((qbyte *)surface + surface->ofsXyzNormals); pinverts = (md3XyzNormal_t *)((qbyte *)surface + surface->ofsXyzNormals);
for (i=0 ; i<numframes ; i++) for (i=0 ; i<numframes ; i++)
@ -3241,13 +3338,15 @@ void SWMod_LoadAlias3Model (model_t *mod, void *buffer)
Cache_Alloc (&mod->cache, total, loadname); Cache_Alloc (&mod->cache, total, loadname);
if (!mod->cache.data) if (!mod->cache.data)
return; return false;
memcpy (mod->cache.data, pheader, total); memcpy (mod->cache.data, pheader, total);
Hunk_FreeToLowMark (start); Hunk_FreeToLowMark (start);
#ifdef RGLQUAKE #ifdef RGLQUAKE
mod->flags = Mod_ReadFlagsFromMD1(mod->name, 0); mod->flags = Mod_ReadFlagsFromMD1(mod->name, 0);
#endif #endif
return true;
} }