components/prboom/d_main.c
//
// D_AddFile
//
// Rewritten by Lee Killough
//
// Ty 08/29/98 - add source parm to indicate where this came from
// CPhipps - static, const char* parameter
//         - source is an enum
//         - modified to allocate & use new wadfiles array
D_AddFile
Rewritten by Lee Killough

Ty 08/29/98 - add source parm to indicate where this came from
CPhipps - static, const char* parameter
source is an enum
modified to allocate & use new wadfiles array
D_AddFile Rewritten by Lee Killough Ty 08 / 29 / 98 - add source parm to indicate where this came from CPhipps - static const char * parameter source is an enum modified to allocate & use new wadfiles array
void D_AddFile (const char *file, wad_source_t source)
{
  char *gwa_filename=NULL;
  wadfiles = realloc(wadfiles, sizeof(*wadfiles)*(numwadfiles+1));
  wadfiles[numwadfiles].name =
    AddDefaultExtension(strcpy(malloc(strlen(file)+5), file), ".wad");
  wadfiles[numwadfiles].src = source; 
  numwadfiles++;
  gwa_filename=AddDefaultExtension(strcpy(malloc(strlen(file)+5), file), ".wad");
  if (strlen(gwa_filename)>4)
    if (!strcasecmp(gwa_filename+(strlen(gwa_filename)-4),".wad"))
    {
      char *ext;
      ext = &gwa_filename[strlen(gwa_filename)-4];
      ext[1] = 'g'; ext[2] = 'w'; ext[3] = 'a';
      wadfiles = realloc(wadfiles, sizeof(*wadfiles)*(numwadfiles+1));
      wadfiles[numwadfiles].name = gwa_filename;
      wadfiles[numwadfiles].src = source; 
      numwadfiles++;
    }
}
void D_AddFile ( const char * file , wad_source_t source ) { char * gwa_filename = NULL ; wadfiles = realloc ( wadfiles , sizeof ( * wadfiles ) * ( numwadfiles + 1 ) ) ; wadfiles [ numwadfiles ] . name = AddDefaultExtension ( strcpy ( malloc ( strlen ( file ) + 5 ) , file ) , " " ) ; wadfiles [ numwadfiles ] . src = source ; numwadfiles ++ ; gwa_filename = AddDefaultExtension ( strcpy ( malloc ( strlen ( file ) + 5 ) , file ) , " " ) ; if ( strlen ( gwa_filename ) > 4 ) if ( ! strcasecmp ( gwa_filename + ( strlen ( gwa_filename ) - 4 ) , " " ) ) { char * ext ; ext = & gwa_filename [ strlen ( gwa_filename ) - 4 ] ; ext [ 1 ] = ' ' ; ext [ 2 ] = ' ' ; ext [ 3 ] = ' ' ; wadfiles = realloc ( wadfiles , sizeof ( * wadfiles ) * ( numwadfiles + 1 ) ) ; wadfiles [ numwadfiles ] . name = gwa_filename ; wadfiles [ numwadfiles ] . src = source ; numwadfiles ++ ; } }
D_AddFile
Rewritten by Lee Killough
D_AddFile Rewritten by Lee Killough
// Ty 08/29/98 // proff: automatically try to add the gwa files // proff - moved from w_wad.c // Ty 08/29/98