Merge out R_TextureAnimation.

This commit is contained in:
Bill Currie 2012-01-08 10:21:08 +09:00
parent 179c349bb3
commit ec7d01f9b2
4 changed files with 34 additions and 98 deletions

View file

@ -169,36 +169,6 @@ R_ClearTextures (void)
}
/*
R_TextureAnimation
Returns the proper texture for a given time and base texture
*/
texture_t *
R_TextureAnimation (msurface_t *surf)
{
texture_t *base = surf->texinfo->texture;
int count, relative;
if (currententity->frame) {
if (base->alternate_anims)
base = base->alternate_anims;
}
relative = (int) (r_realtime * 10) % 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");
}
return base;
}
// BRUSH MODELS ===============================================================
static void

View file

@ -38,6 +38,7 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$";
#endif
#include "QF/cvar.h"
#include "QF/sys.h"
#include "r_cvar.h"
#include "r_local.h"
@ -91,3 +92,36 @@ R_MarkLeaves (void)
}
}
}
/*
R_TextureAnimation
Returns the proper texture for a given time and base texture
*/
texture_t *
R_TextureAnimation (msurface_t *surf)
{
texture_t *base = surf->texinfo->texture;
int count, relative;
if (currententity->frame) {
if (base->alternate_anims)
base = base->alternate_anims;
}
if (!base->anim_total)
return base;
relative = (int) (r_realtime * 10) % 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");
}
return base;
}

View file

@ -174,40 +174,6 @@ R_BuildLightMap (void)
}
}
/*
R_TextureAnimation
Returns the proper texture for a given time and base texture
*/
texture_t *
R_TextureAnimation (msurface_t *surf)
{
texture_t *base = surf->texinfo->texture;
int relative;
int count;
if (currententity->frame) {
if (base->alternate_anims)
base = base->alternate_anims;
}
if (!base->anim_total)
return base;
relative = (int) (r_realtime * 10) % 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");
}
return base;
}
void
R_DrawSurface (void)
{

View file

@ -200,40 +200,6 @@ R_BuildLightMap (void)
*/
}
/*
R_TextureAnimation
Returns the proper texture for a given time and base texture
*/
texture_t *
R_TextureAnimation (msurface_t *surf)
{
texture_t *base = surf->texinfo->texture;
int relative;
int count;
if (currententity->frame) {
if (base->alternate_anims)
base = base->alternate_anims;
}
if (!base->anim_total)
return base;
relative = (int) (r_realtime * 10) % 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");
}
return base;
}
void
R_DrawSurface (void)
{