mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 23:11:38 +00:00
Merge out R_TextureAnimation.
This commit is contained in:
parent
179c349bb3
commit
ec7d01f9b2
4 changed files with 34 additions and 98 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue