memset(mod_novis, 0xff, sizeof(mod_novis));
}
-void Mod_Brush_SERAddEntity(void)
-{
- R_Clip_AddBox(currentrenderentity->mins, currentrenderentity->maxs, R_Entity_Callback, currentrenderentity, NULL);
-}
-
/*
===============
Mod_PointInLeaf
*/
static void Mod_LoadTextures (lump_t *l)
{
- int i, j, k, num, max, altmax, mtwidth, mtheight, *dofs;
- miptex_t *dmiptex;
- texture_t *tx, *tx2, *anims[10], *altanims[10];
- dmiptexlump_t *m;
- qbyte *data, *mtdata, *data2;
- char name[256];
+ int i, j, k, num, max, altmax, mtwidth, mtheight, *dofs, incomplete;
+ miptex_t *dmiptex;
+ texture_t *tx, *tx2, *anims[10], *altanims[10];
+ dmiptexlump_t *m;
+ qbyte *data, *mtdata, *data2;
+ char name[256];
loadmodel->textures = NULL;
// LordHavoc: HL sky textures are entirely different than quake
if (!loadmodel->ishlbsp && !strncmp(tx->name, "sky", 3) && mtwidth == 256 && mtheight == 128)
{
- data = loadimagepixels(tx->name, false, 0, 0);
- if (data)
+ if (loadmodel->isworldmodel)
{
- if (image_width == 256 && image_height == 128)
- {
- if (loadmodel->isworldmodel)
- R_InitSky (data, 4);
- Mem_Free(data);
- }
- else
+ data = loadimagepixels(tx->name, false, 0, 0);
+ if (data)
{
- Mem_Free(data);
- Con_Printf ("Invalid replacement texture for sky \"%s\" in %\"%s\", must be 256x128 pixels\n", tx->name, loadmodel->name);
+ if (image_width == 256 && image_height == 128)
+ {
+ R_InitSky (data, 4);
+ Mem_Free(data);
+ }
+ else
+ {
+ Mem_Free(data);
+ Con_Printf ("Invalid replacement texture for sky \"%s\" in %\"%s\", must be 256x128 pixels\n", tx->name, loadmodel->name);
+ if (mtdata != NULL)
+ R_InitSky (mtdata, 1);
+ }
}
+ else if (mtdata != NULL)
+ R_InitSky (mtdata, 1);
}
- else if (loadmodel->isworldmodel)
- R_InitSky (mtdata, 1);
}
else if ((tx->texture = loadtextureimagewithmask(loadmodel->texturepool, tx->name, 0, 0, false, true, true)))
{
tx = loadmodel->textures[i];
if (!tx || tx->name[0] != '+' || tx->name[1] == 0 || tx->name[2] == 0)
continue;
- if (tx->anim_total)
+ if (tx->anim_total[0] || tx->anim_total[1])
continue; // already sequenced
// find the number of frames in the animation
else if (num >= 'a' && num <= 'j')
altanims[num - 'a'] = tx2;
else
- Host_Error ("Bad animating texture %s", tx->name);
+ Con_Printf ("Bad animating texture %s\n", tx->name);
}
max = altmax = 0;
for (j = 0;j < 10;j++)
{
- if (anims[j] != NULL)
+ if (anims[j])
max = j + 1;
- if (altanims[j] != NULL)
+ if (altanims[j])
altmax = j + 1;
}
+ //Con_Printf("linking animation %s (%i:%i frames)\n\n", tx->name, max, altmax);
+
+ incomplete = false;
+ for (j = 0;j < max;j++)
+ {
+ if (!anims[j])
+ {
+ Con_Printf ("Missing frame %i of %s\n", j, tx->name);
+ incomplete = true;
+ }
+ }
+ for (j = 0;j < altmax;j++)
+ {
+ if (!altanims[j])
+ {
+ Con_Printf ("Missing altframe %i of %s\n", j, tx->name);
+ incomplete = true;
+ }
+ }
+ if (incomplete)
+ continue;
+
if (altmax < 1)
{
// if there is no alternate animation, duplicate the primary
// animation into the alternate
altmax = max;
for (k = 0;k < 10;k++)
- anims[k] = altanims[k];
+ altanims[k] = anims[k];
}
// link together the primary animation
for (j = 0;j < max;j++)
{
tx2 = anims[j];
- if (!tx2)
- Host_Error ("Missing frame %i of %s", j, tx->name);
tx2->animated = true;
tx2->anim_total[0] = max;
tx2->anim_total[1] = altmax;
}
}
- // link together the alternate animation
- for (j = 0;j < altmax;j++)
+ // if there really is an alternate anim...
+ if (anims[0] != altanims[0])
{
- tx2 = altanims[j];
- if (!tx2)
- Host_Error ("Missing frame %i of %s", j, tx->name);
- tx2->animated = true;
- // the primary/alternate are reversed here
- tx2->anim_total[0] = altmax;
- tx2->anim_total[1] = max;
- for (k = 0;k < 10;k++)
+ // link together the alternate animation
+ for (j = 0;j < altmax;j++)
{
- tx2->anim_frames[0][k] = altanims[k];
- tx2->anim_frames[1][k] = anims[k];
+ tx2 = altanims[j];
+ tx2->animated = true;
+ // the primary/alternate are reversed here
+ tx2->anim_total[0] = altmax;
+ tx2->anim_total[1] = max;
+ for (k = 0;k < 10;k++)
+ {
+ tx2->anim_frames[0][k] = altanims[k];
+ tx2->anim_frames[1][k] = anims[k];
+ }
}
}
}
mod->numleafs = bm->visleafs;
- mod->SERAddEntity = Mod_Brush_SERAddEntity;
mod->Draw = R_DrawBrushModelNormal;
mod->DrawShadow = NULL;