mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-26 05:41:52 +00:00
cosmetic fixes, no Sys_Errors in heightmap/hlmdl loading
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2096 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
2df1c6674b
commit
4b4a26aae0
7 changed files with 60 additions and 39 deletions
|
@ -3347,7 +3347,7 @@ qboolean GL_LoadQ1Model (model_t *mod, void *buffer)
|
|||
version = pq1inmodel->version;
|
||||
if (version != ALIAS_VERSION)
|
||||
{
|
||||
Con_Printf (S_ERROR "%s has wrong version number (%i should be %i)",
|
||||
Con_Printf (S_ERROR "%s has wrong version number (%i should be %i)\n",
|
||||
mod->name, version, ALIAS_VERSION);
|
||||
return false;
|
||||
}
|
||||
|
@ -3613,7 +3613,7 @@ qboolean GL_LoadQ2Model (model_t *mod, void *buffer)
|
|||
version = LittleLong (pq2inmodel->version);
|
||||
if (version != MD2ALIAS_VERSION)
|
||||
{
|
||||
Con_Printf (S_ERROR "%s has wrong version number (%i should be %i)",
|
||||
Con_Printf (S_ERROR "%s has wrong version number (%i should be %i)\n",
|
||||
mod->name, version, MD2ALIAS_VERSION);
|
||||
return false;
|
||||
}
|
||||
|
@ -4658,13 +4658,13 @@ qboolean GLMod_LoadZymoticModel(model_t *mod, void *buffer)
|
|||
}
|
||||
if (intrans != (zymvertex_t *)((char*)header + header->lump_verts.start))
|
||||
{
|
||||
Con_Printf(S_ERROR "%s, Vertex transforms list appears corrupt.", mod->name);
|
||||
Con_Printf(S_ERROR "%s, Vertex transforms list appears corrupt.\n", mod->name);
|
||||
Hunk_FreeToLowMark(hunkstart);
|
||||
return false;
|
||||
}
|
||||
if (vertbonecounts != (int *)((char*)header + header->lump_vertbonecounts.start))
|
||||
{
|
||||
Con_Printf(S_ERROR "%s, Vertex bone counts list appears corrupt.", mod->name);
|
||||
Con_Printf(S_ERROR "%s, Vertex bone counts list appears corrupt.\n", mod->name);
|
||||
Hunk_FreeToLowMark(hunkstart);
|
||||
return false;
|
||||
}
|
||||
|
@ -4700,7 +4700,7 @@ qboolean GLMod_LoadZymoticModel(model_t *mod, void *buffer)
|
|||
}
|
||||
if (renderlist != (int*)((char*)header + header->lump_render.start + header->lump_render.length))
|
||||
{
|
||||
Con_Printf(S_ERROR "%s, render list appears corrupt.", mod->name);
|
||||
Con_Printf(S_ERROR "%s, render list appears corrupt.\n", mod->name);
|
||||
Hunk_FreeToLowMark(hunkstart);
|
||||
return false;
|
||||
}
|
||||
|
@ -4767,7 +4767,7 @@ qboolean GLMod_LoadZymoticModel(model_t *mod, void *buffer)
|
|||
|
||||
if (inscene != (zymscene_t*)((char*)header + header->lump_scenes.start+header->lump_scenes.length))
|
||||
{
|
||||
Con_Printf(S_ERROR "%s, scene list appears corrupt.", mod->name);
|
||||
Con_Printf(S_ERROR "%s, scene list appears corrupt.\n", mod->name);
|
||||
Hunk_FreeToLowMark(hunkstart);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -615,7 +615,7 @@ int Heightmap_LeafForPoint (model_t *model, vec3_t point)
|
|||
|
||||
//Heightmap_NativeBoxContents
|
||||
|
||||
void GL_LoadHeightmapModel (model_t *mod, void *buffer)
|
||||
qboolean GL_LoadHeightmapModel (model_t *mod, void *buffer)
|
||||
{
|
||||
heightmap_t *hm;
|
||||
unsigned short *heightmap;
|
||||
|
@ -648,7 +648,10 @@ void GL_LoadHeightmapModel (model_t *mod, void *buffer)
|
|||
|
||||
buffer = COM_Parse(buffer);
|
||||
if (strcmp(com_token, "terrain"))
|
||||
Sys_Error("Wasn't terrain map"); //shouldn't happen
|
||||
{
|
||||
Con_Printf(S_ERROR "%s wasn't terrain map\n", mod->name); //shouldn't happen
|
||||
return false;
|
||||
}
|
||||
for(;;)
|
||||
{
|
||||
buffer = COM_Parse(buffer);
|
||||
|
@ -711,11 +714,17 @@ void GL_LoadHeightmapModel (model_t *mod, void *buffer)
|
|||
numsegs = atoi(com_token);
|
||||
}
|
||||
else
|
||||
Sys_Error("Unrecognised token in terrain map\n");
|
||||
{
|
||||
Con_Printf(S_ERROR "%s, unrecognised token in terrain map\n", mod->name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (numsegs > SECTIONS)
|
||||
Sys_Error("Heightmap uses too many sections max is %i\n", SECTIONS);
|
||||
{
|
||||
Con_Printf(S_ERROR "%s, heightmap uses too many sections max is %i\n", mod->name, SECTIONS);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
mod->type = mod_heightmap;
|
||||
|
@ -724,7 +733,10 @@ void GL_LoadHeightmapModel (model_t *mod, void *buffer)
|
|||
|
||||
size = sqrt(com_filesize/2);
|
||||
if (size % numsegs)
|
||||
Sys_Error("Heightmap is not a multiple of %i\n", numsegs);
|
||||
{
|
||||
Con_Printf(S_ERROR "%s, heightmap is not a multiple of %i\n", mod->name, numsegs);
|
||||
return false;
|
||||
}
|
||||
|
||||
hm = Hunk_Alloc(sizeof(*hm) + com_filesize);
|
||||
memset(hm, 0, sizeof(*hm));
|
||||
|
@ -780,5 +792,7 @@ void GL_LoadHeightmapModel (model_t *mod, void *buffer)
|
|||
*/
|
||||
|
||||
mod->terrain = hm;
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -76,7 +76,7 @@ void GL_Draw_HL_AliasFrame(short *order, vec3_t *transformed, float tex_w, float
|
|||
=======================================================================================================================
|
||||
*/
|
||||
extern char loadname[];
|
||||
void Mod_LoadHLModel (model_t *mod, void *buffer)
|
||||
qboolean Mod_LoadHLModel (model_t *mod, void *buffer)
|
||||
{
|
||||
/*~~*/
|
||||
int i;
|
||||
|
@ -127,7 +127,11 @@ void Mod_LoadHLModel (model_t *mod, void *buffer)
|
|||
memcpy(header, buffer, com_filesize);
|
||||
|
||||
if (header->version != 10)
|
||||
Host_EndGame("Cannot load model %s - unknown version %i\n", mod->name, header->version);
|
||||
{
|
||||
Con_Printf(S_ERROR "Cannot load model %s - unknown version %i\n", mod->name, header->version);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
}
|
||||
|
||||
tex = (hlmdl_tex_t *) ((qbyte *) header + header->textures);
|
||||
bones = (hlmdl_bone_t *) ((qbyte *) header + header->boneindex);
|
||||
|
@ -170,10 +174,11 @@ void Mod_LoadHLModel (model_t *mod, void *buffer)
|
|||
|
||||
Cache_Alloc (&mod->cache, total, loadname);
|
||||
if (!mod->cache.data)
|
||||
return;
|
||||
return false;
|
||||
memcpy (mod->cache.data, model, total);
|
||||
|
||||
Hunk_FreeToLowMark (start);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -47,7 +47,7 @@ extern char loadname[32]; // for hunk tags
|
|||
void CM_Init(void);
|
||||
|
||||
void GLMod_LoadCompositeAnim(model_t *mod, void *buffer);
|
||||
void GL_LoadHeightmapModel (model_t *mod, void *buffer);
|
||||
qboolean GL_LoadHeightmapModel (model_t *mod, void *buffer);
|
||||
qboolean GLMod_LoadDarkPlacesModel(model_t *mod, void *buffer);
|
||||
void GLMod_LoadSpriteModel (model_t *mod, void *buffer);
|
||||
void GLMod_LoadSprite2Model (model_t *mod, void *buffer);
|
||||
|
@ -55,9 +55,7 @@ void GLMod_LoadBrushModel (model_t *mod, void *buffer);
|
|||
#ifdef Q2BSPS
|
||||
void Mod_LoadQ2BrushModel (model_t *mod, void *buffer);
|
||||
#endif
|
||||
void Mod_LoadHLModel (model_t *mod, void *buffer);
|
||||
void Mod_LoadAlias3Model (model_t *mod, void *buffer);
|
||||
void Mod_LoadGroupModel (model_t *mod, void *buffer);
|
||||
qboolean Mod_LoadHLModel (model_t *mod, void *buffer);
|
||||
#ifdef ZYMOTICMODELS
|
||||
qboolean GLMod_LoadZymoticModel(model_t *mod, void *buffer);
|
||||
#endif
|
||||
|
@ -563,7 +561,8 @@ couldntload:
|
|||
#endif
|
||||
#ifdef HALFLIFEMODELS
|
||||
case (('T'<<24)+('S'<<16)+('D'<<8)+'I'):
|
||||
Mod_LoadHLModel (mod, buf);
|
||||
if (!Mod_LoadHLModel (mod, buf))
|
||||
goto couldntload;
|
||||
break;
|
||||
#endif
|
||||
#ifdef TERRAINMAPS
|
||||
|
@ -611,7 +610,8 @@ couldntload:
|
|||
#ifdef TERRAIN
|
||||
if (!strcmp(com_token, "terrain"))
|
||||
{
|
||||
GL_LoadHeightmapModel(mod, buf);
|
||||
if (!GL_LoadHeightmapModel(mod, buf))
|
||||
goto couldntload;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -334,7 +334,7 @@ void GLQ3_LightGrid(vec3_t point, vec3_t res_diffuse, vec3_t res_ambient, vec3_t
|
|||
|
||||
//gl_heightmap.c
|
||||
void GL_DrawHeightmapModel (entity_t *e);
|
||||
void GL_LoadHeightmapModel (model_t *mod, void *buffer);
|
||||
qboolean GL_LoadHeightmapModel (model_t *mod, void *buffer);
|
||||
|
||||
//gl_bloom.c
|
||||
void R_BloomRegister(void);
|
||||
|
|
|
@ -230,7 +230,7 @@ void QuaternionGLMatrix(float x, float y, float z, float w, vec4_t *GLM);
|
|||
//void UploadTexture(hlmdl_tex_t *ptexture, qbyte *data, qbyte *pal);
|
||||
|
||||
/* HL drawing */
|
||||
void Mod_LoadHLModel (model_t *mod, void *buffer);
|
||||
qboolean Mod_LoadHLModel (model_t *mod, void *buffer);
|
||||
int HL_CurSequence(hlmodel_t model);
|
||||
int HL_NewSequence(hlmodel_t * model, int _inew);
|
||||
void HL_SetController(hlmodel_t *model, int num, float value);
|
||||
|
|
|
@ -410,7 +410,9 @@ model_t *SWMod_LoadModel (model_t *mod, qboolean crash)
|
|||
break;
|
||||
|
||||
default: //some telejano mods can do this
|
||||
Con_Printf(S_ERROR "model %s, unrecognized format %i\n", mod->name, LittleLong(*(unsigned *)buf));
|
||||
couldntload:
|
||||
|
||||
if (crash)
|
||||
Sys_Error ("Mod_NumForName: %s not found", mod->name);
|
||||
|
||||
|
@ -2307,7 +2309,7 @@ qboolean SWMod_LoadAliasModel (model_t *mod, void *buffer)
|
|||
version = LittleLong (pinmodel->version);
|
||||
if (version != ALIAS_VERSION)
|
||||
{
|
||||
Con_Printf (S_ERROR "%s has wrong version number (%i should be %i)",
|
||||
Con_Printf (S_ERROR "%s has wrong version number (%i should be %i)\n",
|
||||
mod->name, version, ALIAS_VERSION);
|
||||
return false;
|
||||
}
|
||||
|
@ -2341,7 +2343,7 @@ qboolean SWMod_LoadAliasModel (model_t *mod, void *buffer)
|
|||
if (pmodel->skinheight > MAX_LBM_HEIGHT)
|
||||
{
|
||||
// TODO: at least downsize the skin
|
||||
Con_Printf (S_ERROR "model %s has a skin taller than %d", mod->name,
|
||||
Con_Printf (S_ERROR "model %s has a skin taller than %d\n", mod->name,
|
||||
MAX_LBM_HEIGHT);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
|
@ -2351,14 +2353,14 @@ qboolean SWMod_LoadAliasModel (model_t *mod, void *buffer)
|
|||
|
||||
if (pmodel->numverts <= 0)
|
||||
{
|
||||
Con_Printf (S_ERROR "model %s has no vertices", mod->name);
|
||||
Con_Printf (S_ERROR "model %s has no vertices\n", mod->name);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pmodel->numverts > MAXALIASVERTS)
|
||||
{
|
||||
Con_Printf (S_ERROR "model %s has too many vertices", mod->name);
|
||||
Con_Printf (S_ERROR "model %s has too many vertices\n", mod->name);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
}
|
||||
|
@ -2367,7 +2369,7 @@ qboolean SWMod_LoadAliasModel (model_t *mod, void *buffer)
|
|||
|
||||
if (pmodel->numtris <= 0)
|
||||
{
|
||||
Con_Printf (S_ERROR "model %s has no triangles", mod->name);
|
||||
Con_Printf (S_ERROR "model %s has no triangles\n", mod->name);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
}
|
||||
|
@ -2389,7 +2391,7 @@ qboolean SWMod_LoadAliasModel (model_t *mod, void *buffer)
|
|||
|
||||
if (pmodel->skinwidth & 0x03)
|
||||
{
|
||||
Con_Printf (S_ERROR "Mod_LoadAliasModel: \"%s\" skinwidth not multiple of 4", loadmodel->name);
|
||||
Con_Printf (S_ERROR "Mod_LoadAliasModel: \"%s\" skinwidth not multiple of 4\n", loadmodel->name);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
}
|
||||
|
@ -2624,7 +2626,7 @@ qboolean SWMod_LoadAlias2Model (model_t *mod, void *buffer)
|
|||
version = LittleLong (pinmodel->version);
|
||||
if (version != MD2ALIAS_VERSION)
|
||||
{
|
||||
Con_Printf (S_ERROR "%s has wrong version number (%i should be %i)",
|
||||
Con_Printf (S_ERROR "%s has wrong version number (%i should be %i)\n",
|
||||
mod->name, version, MD2ALIAS_VERSION);
|
||||
return false;
|
||||
}
|
||||
|
@ -2656,7 +2658,7 @@ qboolean SWMod_LoadAlias2Model (model_t *mod, void *buffer)
|
|||
|
||||
if (pmodel->skinheight > MAX_LBM_HEIGHT)
|
||||
{
|
||||
Con_Printf (S_ERROR "model %s has a skin taller than %d", mod->name,
|
||||
Con_Printf (S_ERROR "model %s has a skin taller than %d\n", mod->name,
|
||||
MAX_LBM_HEIGHT);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
|
@ -2667,14 +2669,14 @@ qboolean SWMod_LoadAlias2Model (model_t *mod, void *buffer)
|
|||
|
||||
if (pmodel->numverts <= 0)
|
||||
{
|
||||
Con_Printf (S_ERROR "model %s has no vertices", mod->name);
|
||||
Con_Printf (S_ERROR "model %s has no vertices\n", mod->name);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pmodel->numverts > MAXALIASVERTS)
|
||||
{
|
||||
Con_Printf (S_ERROR "model %s has too many vertices", mod->name);
|
||||
Con_Printf (S_ERROR "model %s has too many vertices\n", mod->name);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
}
|
||||
|
@ -2683,7 +2685,7 @@ qboolean SWMod_LoadAlias2Model (model_t *mod, void *buffer)
|
|||
|
||||
if (pmodel->numtris <= 0)
|
||||
{
|
||||
Con_Printf (S_ERROR "model %s has no triangles", mod->name);
|
||||
Con_Printf (S_ERROR "model %s has no triangles\n", mod->name);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
}
|
||||
|
@ -2705,7 +2707,7 @@ qboolean SWMod_LoadAlias2Model (model_t *mod, void *buffer)
|
|||
|
||||
if (pmodel->skinwidth & 0x03)
|
||||
{
|
||||
Con_Printf (S_ERROR "Mod_LoadAliasModel: %s, skinwidth not multiple of 4", mod->name);
|
||||
Con_Printf (S_ERROR "Mod_LoadAliasModel: %s, skinwidth not multiple of 4\n", mod->name);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
}
|
||||
|
@ -3076,7 +3078,7 @@ qboolean SWMod_LoadAlias3Model (model_t *mod, void *buffer)
|
|||
|
||||
if (pmodel->skinheight > MAX_LBM_HEIGHT)
|
||||
{
|
||||
Con_Printf (S_ERROR "model %s has a skin taller than %d", mod->name,
|
||||
Con_Printf (S_ERROR "model %s has a skin taller than %d\n", mod->name,
|
||||
MAX_LBM_HEIGHT);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
|
@ -3087,14 +3089,14 @@ qboolean SWMod_LoadAlias3Model (model_t *mod, void *buffer)
|
|||
|
||||
if (surface->numVerts <= 0)
|
||||
{
|
||||
Con_Printf (S_ERROR "model %s has no vertices", mod->name);
|
||||
Con_Printf (S_ERROR "model %s has no vertices\n", mod->name);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pmodel->numverts > MAXALIASVERTS)
|
||||
{
|
||||
Con_Printf (S_ERROR "model %s has too many vertices", mod->name);
|
||||
Con_Printf (S_ERROR "model %s has too many vertices\n", mod->name);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
}
|
||||
|
@ -3103,7 +3105,7 @@ qboolean SWMod_LoadAlias3Model (model_t *mod, void *buffer)
|
|||
|
||||
if (pmodel->numtris <= 0)
|
||||
{
|
||||
Con_Printf (S_ERROR "model %s has no triangles", mod->name);
|
||||
Con_Printf (S_ERROR "model %s has no triangles\n", mod->name);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
}
|
||||
|
@ -3221,7 +3223,7 @@ qboolean SWMod_LoadAlias3Model (model_t *mod, void *buffer)
|
|||
|
||||
if (pmodel->skinwidth & 0x03)
|
||||
{
|
||||
Con_Printf (S_ERROR "Mod_LoadAliasModel: %s, skinwidth not multiple of 4", mod->name);
|
||||
Con_Printf (S_ERROR "Mod_LoadAliasModel: %s, skinwidth not multiple of 4\n", mod->name);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue