Animate surfaces at twice the speed when rendering HLBSP.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6147 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Eukara 2022-01-03 01:57:23 +00:00
parent cfaef2bf11
commit f612b97fc9
1 changed files with 34 additions and 1 deletions

View File

@ -2709,6 +2709,37 @@ static void Mod_UpdateBatchShader_Q1 (struct batch_s *batch)
batch->shader = base->shader;
}
// copy of Q1s, but with a different framerate
static void Mod_UpdateBatchShader_HL (struct batch_s *batch)
{
texture_t *base = batch->texture;
unsigned int relative;
int count;
if (batch->ent->framestate.g[FS_REG].frame[0])
{
if (base->alternate_anims)
base = base->alternate_anims;
}
if (base->anim_total)
{
relative = (unsigned int)(cl.time*20) % base->anim_total;
count = 0;
while (base->anim_min > relative || base->anim_max <= relative)
{
base = base->anim_next;
if (!base)
Sys_Error ("R_TextureAnimation: broken cycle");
if (++count > 100)
Sys_Error ("R_TextureAnimation: infinite cycle");
}
}
batch->shader = base->shader;
}
#endif
#ifdef Q2BSPS
@ -2882,9 +2913,11 @@ static int Mod_Batches_Generate(model_t *mod)
#endif
#ifdef Q1BSPS
case fg_quake:
case fg_halflife:
batch->buildmeshes = Mod_UpdateBatchShader_Q1;
break;
case fg_halflife:
batch->buildmeshes = Mod_UpdateBatchShader_HL;
break;
#endif
default:
break;