components/prboom/wi_stuff.c
// ====================================================================
// WI_updateAnimatedBack
// Purpose: Figure out what animation we do on this iteration
// Args:    none
// Returns: void
//
WI_updateAnimatedBack
Purpose: Figure out what animation we do on this iteration
Args:    none
Returns: void
WI_updateAnimatedBack Purpose : Figure out what animation we do on this iteration Args : none Returns : void
void WI_updateAnimatedBack(void)
{
  int   i;
  anim_t* a;
  if (gamemode == commercial)
    return;
  if (wbs->epsd > 2)
    return;
  for (i=0;i<NUMANIMS[wbs->epsd];i++)
  {
    a = &anims[wbs->epsd][i];
    if (bcnt == a->nexttic)
    {
      switch (a->type)
      {
        case ANIM_ALWAYS:
             if (++a->ctr >= a->nanims) a->ctr = 0;
             a->nexttic = bcnt + a->period;
             break;
        case ANIM_RANDOM:
             a->ctr++;
             if (a->ctr == a->nanims)
             {
               a->ctr = -1;
               a->nexttic = bcnt+a->data2+(M_Random()%a->data1);
             }
             else
               a->nexttic = bcnt + a->period;
             break;
        case ANIM_LEVEL:
             if (!(state == StatCount && i == 7)
                && wbs->next == a->data1)
             {
               a->ctr++;
               if (a->ctr == a->nanims) a->ctr--;
               a->nexttic = bcnt + a->period;
             }
             break;
      }
    }
  }
}
void WI_updateAnimatedBack ( void ) { int i ; anim_t * a ; if ( gamemode == commercial ) return ; if ( wbs -> epsd > 2 ) return ; for ( i = 0 ; i < NUMANIMS [ wbs -> epsd ] ; i ++ ) { a = & anims [ wbs -> epsd ] [ i ] ; if ( bcnt == a -> nexttic ) { switch ( a -> type ) { case ANIM_ALWAYS : if ( ++ a -> ctr >= a -> nanims ) a -> ctr = 0 ; a -> nexttic = bcnt + a -> period ; break ; case ANIM_RANDOM : a -> ctr ++ ; if ( a -> ctr == a -> nanims ) { a -> ctr = -1 ; a -> nexttic = bcnt + a -> data2 + ( M_Random ( ) % a -> data1 ) ; } else a -> nexttic = bcnt + a -> period ; break ; case ANIM_LEVEL : if ( ! ( state == StatCount && i == 7 ) && wbs -> next == a -> data1 ) { a -> ctr ++ ; if ( a -> ctr == a -> nanims ) a -> ctr -- ; a -> nexttic = bcnt + a -> period ; } break ; } } } }
WI_updateAnimatedBack
Purpose: Figure out what animation we do on this iteration
Args:    none
Returns: void
WI_updateAnimatedBack Purpose : Figure out what animation we do on this iteration Args : none Returns : void
// gawd-awful hack for level anims