Skip to content

Commit

Permalink
Change MAXALIASVERTS/TRIS errors to QS compat dev warnings (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-drexler committed Nov 9, 2024
1 parent 2bb6644 commit df8f926
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 27 deletions.
30 changes: 16 additions & 14 deletions Quake/gl_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -2728,10 +2728,10 @@ ALIAS MODELS
==============================================================================
*/

aliashdr_t *pheader;
aliashdr_t *pheader;

stvert_t stverts[MAXALIASVERTS];
mtriangle_t triangles[MAXALIASTRIS];
const stvert_t *stverts;
const dtriangle_t *triangles;

// a pose is a single set of vertexes. a frame may be
// an animating sequence of poses
Expand Down Expand Up @@ -3257,16 +3257,16 @@ static void Mod_LoadAliasModel (qmodel_t *mod, void *buffer)
if (pheader->numverts <= 0)
Sys_Error ("model %s has no vertices", mod->name);

if (pheader->numverts > MAXALIASVERTS)
Sys_Error ("model %s has too many vertices (%d; max = %d)", mod->name, pheader->numverts, MAXALIASVERTS);
if (pheader->numverts > MAXALIASVERTS_QS && (developer.value || map_checks.value))
Con_Warning ("model %s vertex count of %d exceeds QS limit of %d\n", mod->name, pheader->numverts, MAXALIASVERTS_QS);

pheader->numtris = LittleLong (pinmodel->numtris);

if (pheader->numtris <= 0)
Sys_Error ("model %s has no triangles", mod->name);

if (pheader->numtris > MAXALIASTRIS)
Sys_Error ("model %s has too many triangles (%d; max = %d)", mod->name, pheader->numtris, MAXALIASTRIS);
if (pheader->numtris > MAXALIASTRIS_QS && (developer.value || map_checks.value))
Con_Warning ("model %s triangle count of %d exceeds QS limit of %d\n", mod->name, pheader->numtris, MAXALIASTRIS_QS);

pheader->numframes = LittleLong (pinmodel->numframes);
numframes = pheader->numframes;
Expand All @@ -3291,29 +3291,31 @@ static void Mod_LoadAliasModel (qmodel_t *mod, void *buffer)
pskintype = (daliasskintype_t *) Mod_LoadAllSkins (pheader->numskins, pskintype);

//
// load base s and t vertices
// endian-swap base s and t vertices in place
//
pinstverts = (stvert_t *)pskintype;
stverts = pinstverts;

for (i=0 ; i<pheader->numverts ; i++)
{
stverts[i].onseam = LittleLong (pinstverts[i].onseam);
stverts[i].s = LittleLong (pinstverts[i].s);
stverts[i].t = LittleLong (pinstverts[i].t);
pinstverts[i].onseam = LittleLong (pinstverts[i].onseam);
pinstverts[i].s = LittleLong (pinstverts[i].s);
pinstverts[i].t = LittleLong (pinstverts[i].t);
}

//
// load triangle lists
// endian-swap triangle lists in place
//
pintriangles = (dtriangle_t *)&pinstverts[pheader->numverts];
triangles = pintriangles;

for (i=0 ; i<pheader->numtris ; i++)
{
triangles[i].facesfront = LittleLong (pintriangles[i].facesfront);
pintriangles[i].facesfront = LittleLong (pintriangles[i].facesfront);

for (j=0 ; j<3 ; j++)
{
triangles[i].vertindex[j] =
pintriangles[i].vertindex[j] =
LittleLong (pintriangles[i].vertindex[j]);
}
}
Expand Down
20 changes: 7 additions & 13 deletions Quake/gl_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,6 @@ typedef struct
maliasgroupframedesc_t frames[1];
} maliasgroup_t;

// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct mtriangle_s {
int facesfront;
int vertindex[3];
} mtriangle_t;


#define MAX_SKINS 32
typedef struct {
Expand Down Expand Up @@ -386,13 +380,13 @@ typedef struct
bonepose_t inverse;
} boneinfo_t;

#define MAXALIASVERTS 2000 //johnfitz -- was 1024
#define MAXALIASFRAMES 1024 //spike -- was 256
#define MAXALIASTRIS 4096 //ericw -- was 2048
extern aliashdr_t *pheader;
extern stvert_t stverts[MAXALIASVERTS];
extern mtriangle_t triangles[MAXALIASTRIS];
extern trivertx_t *poseverts[MAXALIASFRAMES];
#define MAXALIASVERTS_QS 2000 //johnfitz -- was 1024
#define MAXALIASFRAMES 1024 //spike -- was 256
#define MAXALIASTRIS_QS 4096 //ericw -- was 2048
extern aliashdr_t *pheader;
extern const stvert_t *stverts;
extern const dtriangle_t *triangles;
extern trivertx_t *poseverts[MAXALIASFRAMES];

//===================================================================

Expand Down

0 comments on commit df8f926

Please sign in to comment.