예제 #1
0
파일: w_wad.c 프로젝트: CaptainHIT/prboom
void W_Init(void)
{
  // CPhipps - start with nothing

  numlumps = 0; lumpinfo = NULL;

  { // CPhipps - new wadfiles array used 
    // open all the files, load headers, and count lumps
    int i;
    for (i=0; (size_t)i<numwadfiles; i++)
      W_AddFile(&wadfiles[i]);
  }

  if (!numlumps)
    I_Error ("W_Init: No files found");

  //jff 1/23/98
  // get all the sprites and flats into one marked block each
  // killough 1/24/98: change interface to use M_START/M_END explicitly
  // killough 4/17/98: Add namespace tags to each entry
  // killough 4/4/98: add colormap markers
  W_CoalesceMarkedResource("S_START", "S_END", ns_sprites);
  W_CoalesceMarkedResource("F_START", "F_END", ns_flats);
  W_CoalesceMarkedResource("C_START", "C_END", ns_colormaps);
  W_CoalesceMarkedResource("B_START", "B_END", ns_prboom);
  W_CoalesceMarkedResource("HI_START", "HI_END", ns_hires);

  // killough 1/31/98: initialize lump hash table
  W_HashLumps();

  /* cph 2001/07/07 - separated cache setup */
  lprintf(LO_INFO,"W_InitCache\n");
  W_InitCache();
}
예제 #2
0
파일: w_wad.c 프로젝트: camgunz/d2k
void W_Init(void) {
  // CPhipps - start with nothing

  numlumps = 0;
  lumpinfo = NULL;

  // CPhipps - new wadfiles array used
  // open all the files, load headers, and count lumps
  for (unsigned int i = 0; i < resource_files->len; i++)
    W_AddFile(i);

  if (!numlumps)
    I_Error("W_Init: No files found");

  //jff 1/23/98
  // get all the sprites and flats into one marked block each
  // killough 1/24/98: change interface to use M_START/M_END explicitly
  // killough 4/17/98: Add namespace tags to each entry
  // killough 4/4/98: add colormap markers
  W_CoalesceMarkedResource("S_START", "S_END", ns_sprites);
  W_CoalesceMarkedResource("F_START", "F_END", ns_flats);
  W_CoalesceMarkedResource("C_START", "C_END", ns_colormaps);
  W_CoalesceMarkedResource("B_START", "B_END", ns_prboom);
  r_have_internal_hires = (
    0 < W_CoalesceMarkedResource("HI_START", "HI_END", ns_hires)
  );

  // killough 1/31/98: initialize lump hash table
  W_HashLumps();

  /* cph 2001/07/07 - separated cache setup */
  W_InitCache();

  V_FreePlaypal();
}
예제 #3
0
파일: w_wad.cpp 프로젝트: WChrisK/OdaStats
//
// W_InitMultipleFiles
// Pass a null terminated list of files to use.
// All files are optional, but at least one file
//  must be found.
// Files with a .wad extension are idlink files
//  with multiple lumps.
// Other files are single lumps with the base filename
//  for the lump name.
// Lump names can appear multiple times.
// The name searcher looks backwards, so a later file
//  does override all earlier ones.
//
std::vector<std::string> W_InitMultipleFiles (std::vector<std::string> &filenames)
{
	size_t		size, i;

    // open all the files, load headers, and count lumps
    // will be realloced as lumps are added
	numlumps = 0;

	M_Free(lumpinfo);

	std::vector<std::string> hashes(filenames);

	// open each file once, load headers, and count lumps
	int j = 0;
	std::vector<std::string> loaded;
	for(i = 0; i < filenames.size(); i++)
	{
		if(std::find(loaded.begin(), loaded.end(), filenames[i].c_str()) == loaded.end())
		{
			hashes[j++] = W_AddFile(filenames[i].c_str());
			loaded.push_back(filenames[i].c_str());
		}
	}
	filenames = loaded;
	hashes.resize(j);

	if (!numlumps)
		I_Error ("W_InitFiles: no files found");

	// [RH] Set namespace markers to global for everything
	for (i = 0; i < numlumps; i++)
		lumpinfo[i].namespc = ns_global;

	// [RH] Merge sprite and flat groups.
	//		(We don't need to bother with patches, since
	//		Doom doesn't use markers to identify them.)
	W_MergeLumps ("S_START", "S_END", ns_sprites); // denis - fixme - security
	W_MergeLumps ("F_START", "F_END", ns_flats);
	W_MergeLumps ("C_START", "C_END", ns_colormaps);

    // set up caching
	M_Free(lumpcache);

	size = numlumps * sizeof(*lumpcache);
	lumpcache = (void **)Malloc (size);

	if (!lumpcache)
		I_Error ("Couldn't allocate lumpcache");

	memset (lumpcache,0, size);

	// killough 1/31/98: initialize lump hash table
	W_HashLumps();

	stdisk_lumpnum = W_GetNumForName("STDISK");

	return hashes;
}