r_phase5.c
//
// Cache all graphics needed to render the current frame
//
Cache all graphics needed to render the current frame
Cache all graphics needed to render the current frame
void R_Cache(void)
{
   viswall_t   *wall;
   vissprite_t *spr;
   wall = viswalls;
   while(wall < lastwallcmd)
   {
      if(wall->actionbits & AC_TOPTEXTURE)
      {
         if(wall->t_texture->data == NULL)
            wall->t_texture->data = R_LoadPixels(wall->t_texture->lumpnum);
      }
      if(wall->actionbits & AC_BOTTOMTEXTURE)
      {
         if(wall->b_texture->data == NULL)
            wall->b_texture->data = R_LoadPixels(wall->b_texture->lumpnum);
      }
      int floorpicnum = wall->floorpicnum;
      int ceilingpicnum = wall->ceilingpicnum;
      if(flatpixels[floorpicnum] == NULL)
          flatpixels[floorpicnum] = R_LoadPixels(firstflat + floorpicnum);
      if(ceilingpicnum == -1) 
      {
         if(skytexturep->data == NULL)
            skytexturep->data = R_LoadPixels(skytexturep->lumpnum);
      }
      else if(flatpixels[ceilingpicnum] == NULL)
          flatpixels[ceilingpicnum] = R_LoadPixels(firstflat + ceilingpicnum);
      ++wall;
   }
   spr = vissprites;
   while(spr < vissprite_p)
   {
      if(spr->pixels == NULL)
         spr->pixels = R_LoadPixels(spr->patchnum + 1);
      ++spr;
   }
}
void R_Cache ( void ) { viswall_t * wall ; vissprite_t * spr ; wall = viswalls ; while ( wall < lastwallcmd ) { if ( wall -> actionbits & AC_TOPTEXTURE ) { if ( wall -> t_texture -> data == NULL ) wall -> t_texture -> data = R_LoadPixels ( wall -> t_texture -> lumpnum ) ; } if ( wall -> actionbits & AC_BOTTOMTEXTURE ) { if ( wall -> b_texture -> data == NULL ) wall -> b_texture -> data = R_LoadPixels ( wall -> b_texture -> lumpnum ) ; } int floorpicnum = wall -> floorpicnum ; int ceilingpicnum = wall -> ceilingpicnum ; if ( flatpixels [ floorpicnum ] == NULL ) flatpixels [ floorpicnum ] = R_LoadPixels ( firstflat + floorpicnum ) ; if ( ceilingpicnum == -1 ) { if ( skytexturep -> data == NULL ) skytexturep -> data = R_LoadPixels ( skytexturep -> lumpnum ) ; } else if ( flatpixels [ ceilingpicnum ] == NULL ) flatpixels [ ceilingpicnum ] = R_LoadPixels ( firstflat + ceilingpicnum ) ; ++ wall ; } spr = vissprites ; while ( spr < vissprite_p ) { if ( spr -> pixels == NULL ) spr -> pixels = R_LoadPixels ( spr -> patchnum + 1 ) ; ++ spr ; } }
Cache all graphics needed to render the current frame
Cache all graphics needed to render the current frame
// load upper or middle texture if needed // load lower texture if needed // load floorpic // load sky or normal ceilingpic // sky 