R_StainNode(model->nodes + model->hulls[0].firstclipnode, model, origin, radius, icolor);
// look for embedded bmodels
- for (n = 1;n < MAX_EDICTS;n++)
+ for (n = 0;n < cl_num_brushmodel_entities;n++)
{
- ent = &cl_entities[n].render;
+ ent = cl_brushmodel_entities[n];
model = ent->model;
if (model && model->name[0] == '*')
{
lightmap = surf->samples;
// set to full bright if no light data
- if ((currentrenderentity->effects & EF_FULLBRIGHT) || !cl.worldmodel->lightdata)
+ if ((currentrenderentity->effects & EF_FULLBRIGHT) || !currentrenderentity->model->lightdata)
{
bl = blocklights;
for (i = 0;i < size3;i++)
else
{
// clear to no light
- j = r_ambient.value * 512.0f; // would be 256.0f logically, but using 512.0f to match winquake style
+ j = r_ambient.value * 512.0f; // would be 128.0f logically, but using 512.0f to match winquake style
if (j)
{
bl = blocklights;
void R_PrepareSurfaces(void)
{
- int i;
+ int i, alttextures, texframe, framecount;
texture_t *t;
model_t *model;
msurface_t *surf;
Cshaders[i]->chain = NULL;
model = currentrenderentity->model;
+ alttextures = currentrenderentity->frame != 0;
+ texframe = (int)(cl.time * 5.0f);
for (i = 0;i < model->nummodelsurfaces;i++)
{
surf->insertframe = r_framecount;
c_faces++;
t = surf->texinfo->texture;
- if (t->alternate_anims != NULL && currentrenderentity->frame)
- t = t->alternate_anims;
- if (t->anim_total >= 2)
- t = t->anim_frames[(int)(cl.time * 5.0f) % t->anim_total];
- surf->currenttexture = t;
+ if (t->animated)
+ {
+ framecount = t->anim_total[alttextures];
+ if (framecount >= 2)
+ surf->currenttexture = t->anim_frames[alttextures][texframe % framecount];
+ else
+ surf->currenttexture = t->anim_frames[alttextures][0];
+ }
+ else
+ surf->currenttexture = t;
}
surf->chain = surf->shader->chain;