components/prboom/p_spec.c
//
// P_InitPicAnims
//
// Load the table of animation definitions, checking for existence of
// the start and end of each frame. If the start doesn't exist the sequence
// is skipped, if the last doesn't exist, BOOM exits.
//
// Wall/Flat animation sequences, defined by name of first and last frame,
// The full animation sequence is given using all lumps between the start
// and end entry, in the order found in the WAD file.
//
// This routine modified to read its data from a predefined lump or
// PWAD lump called ANIMATED rather than a static table in this module to
// allow wad designers to insert or modify animation sequences.
//
// Lump format is an array of byte packed animdef_t structures, terminated
// by a structure with istexture == -1. The lump can be generated from a
// text source file using SWANTBLS.EXE, distributed with the BOOM utils.
// The standard list of switches and animations is contained in the example
// source text file DEFSWANI.DAT also in the BOOM util distribution.
//
//
P_InitPicAnims
Load the table of animation definitions, checking for existence of
the start and end of each frame. If the start doesn't exist the sequence
is skipped, if the last doesn't exist, BOOM exits.

Wall/Flat animation sequences, defined by name of first and last frame,
The full animation sequence is given using all lumps between the start
and end entry, in the order found in the WAD file.

This routine modified to read its data from a predefined lump or
PWAD lump called ANIMATED rather than a static table in this module to
allow wad designers to insert or modify animation sequences.

Lump format is an array of byte packed animdef_t structures, terminated
by a structure with istexture == -1. The lump can be generated from a
text source file using SWANTBLS.EXE, distributed with the BOOM utils.
The standard list of switches and animations is contained in the example
source text file DEFSWANI.DAT also in the BOOM util distribution.
P_InitPicAnims Load the table of animation definitions checking for existence of the start and end of each frame . If the start doesn ' t exist the sequence is skipped if the last doesn ' t exist BOOM exits . Wall / Flat animation sequences defined by name of first and last frame The full animation sequence is given using all lumps between the start and end entry in the order found in the WAD file . This routine modified to read its data from a predefined lump or PWAD lump called ANIMATED rather than a static table in this module to allow wad designers to insert or modify animation sequences . Lump format is an array of byte packed animdef_t structures terminated by a structure with istexture == - 1 . The lump can be generated from a text source file using SWANTBLS . EXE distributed with the BOOM utils . The standard list of switches and animations is contained in the example source text file DEFSWANI . DAT also in the BOOM util distribution .
void P_InitPicAnims (void)
{
  int         i;
  const animdef_t *animdefs; 
  int         lump = W_GetNumForName("ANIMATED"); 
  animdefs = (const animdef_t *)W_CacheLumpNum(lump);
  lastanim = anims;
  for (i=0 ; animdefs[i].istexture != -1 ; i++)
  {
    if (lastanim >= anims + maxanims)
    {
      size_t newmax = maxanims ? maxanims*2 : MAXANIMS;
      anims = realloc(anims, newmax*sizeof(*anims));   
      lastanim = anims + maxanims;
      maxanims = newmax;
    }
    if (animdefs[i].istexture)
    {
      if (R_CheckTextureNumForName(animdefs[i].startname) == -1)
          continue;
      lastanim->picnum = R_TextureNumForName (animdefs[i].endname);
      lastanim->basepic = R_TextureNumForName (animdefs[i].startname);
    }
    else
    {
      if ((W_CheckNumForName)(animdefs[i].startname, ns_flats) == -1)   4/17/98
          continue;
      lastanim->picnum = R_FlatNumForName (animdefs[i].endname);
      lastanim->basepic = R_FlatNumForName (animdefs[i].startname);
    }
    lastanim->istexture = animdefs[i].istexture;
    lastanim->numpics = lastanim->picnum - lastanim->basepic + 1;
    if (lastanim->numpics < 2)
        I_Error ("P_InitPicAnims: bad cycle from %s to %s",
                  animdefs[i].startname,
                  animdefs[i].endname);
    lastanim->speed = LONG(animdefs[i].speed);  5/5/98: add LONG()
    lastanim++;
  }
  W_UnlockLumpNum(lump);
}
void P_InitPicAnims ( void ) { int i ; const animdef_t * animdefs ; int lump = W_GetNumForName ( " " ) ; animdefs = ( const animdef_t * ) W_CacheLumpNum ( lump ) ; lastanim = anims ; for ( i = 0 ; animdefs [ i ] . istexture != -1 ; i ++ ) { if ( lastanim >= anims + maxanims ) { size_t newmax = maxanims ? maxanims * 2 : MAXANIMS ; anims = realloc ( anims , newmax * sizeof ( * anims ) ) ; lastanim = anims + maxanims ; maxanims = newmax ; } if ( animdefs [ i ] . istexture ) { if ( R_CheckTextureNumForName ( animdefs [ i ] . startname ) == -1 ) continue ; lastanim -> picnum = R_TextureNumForName ( animdefs [ i ] . endname ) ; lastanim -> basepic = R_TextureNumForName ( animdefs [ i ] . startname ) ; } else { if ( ( W_CheckNumForName ) ( animdefs [ i ] . startname , ns_flats ) == -1 ) continue ; lastanim -> picnum = R_FlatNumForName ( animdefs [ i ] . endname ) ; lastanim -> basepic = R_FlatNumForName ( animdefs [ i ] . startname ) ; } lastanim -> istexture = animdefs [ i ] . istexture ; lastanim -> numpics = lastanim -> picnum - lastanim -> basepic + 1 ; if ( lastanim -> numpics < 2 ) I_Error ( " " , animdefs [ i ] . startname , animdefs [ i ] . endname ) ; lastanim -> speed = LONG ( animdefs [ i ] . speed ) ; lastanim ++ ; } W_UnlockLumpNum ( lump ) ; }
P_InitPicAnims
Load the table of animation definitions, checking for existence of
the start and end of each frame.
P_InitPicAnims Load the table of animation definitions checking for existence of the start and end of each frame .
//jff 3/23/98 pointer to animation lump // cph - new wad lump handling //  Init animation //jff 3/23/98 read from predefined or wad lump instead of table // 1/11/98 killough -- removed limit by array-doubling // killough // different episode ? // killough 4/17/98 // killough 5/5/98: add LONG()