Ejemplo n.º 1
0
//
// W_FindMapInLevelWad
//
// Finds the first MAPxy or ExMy map in the given wad directory, assuming it
// is a single-level wad. Returns NULL if no such map exists. Note that the
// map is not guaranteed to be valid; code in P_SetupLevel is expected to deal
// with that possibility.
//
char *W_FindMapInLevelWad(WadDirectory *dir, bool mapxy)
{
    char *name = NULL;
    int          numlumps = dir->getNumLumps();
    lumpinfo_t **lumpinfo = dir->getLumpInfo();

    for(int i = 0; i < numlumps; i++)
    {
        lumpinfo_t *lump = lumpinfo[i];

        if(mapxy)
        {
            if(isMAPxy(lump->name))
                name = lump->name;
        }
        else if(isExMy(lump->name))
            name = lump->name;
    }

    return name;
}
Ejemplo n.º 2
0
static void HI_loadData(void)
{
   int i;
   char mapname[9];

   memset(mapname, 0, 9);

   // load interpic
   hi_interpic = NULL;
   hi_exitpic = nullptr;

   if(estrnonempty(hi_wbs.li_lastexitpic))
   {
      hi_exitpic = PatchLoader::CacheName(wGlobalDir, hi_wbs.li_lastexitpic,
                                          PU_STATIC);
   }

   if(estrnonempty(hi_wbs.li_nextenterpic))
   {
      hi_interpic = PatchLoader::CacheName(wGlobalDir, hi_wbs.li_nextenterpic,
                                           PU_STATIC);
   }
   else if(gameepisode <= 3)
   {
      sprintf(mapname, "MAPE%d", gameepisode);
      hi_interpic = PatchLoader::CacheName(wGlobalDir, mapname, PU_STATIC);
   }

   // load positional indicators
   hi_in_x   = PatchLoader::CacheName(wGlobalDir, "IN_X",   PU_STATIC);
   hi_in_yah = PatchLoader::CacheName(wGlobalDir, "IN_YAH", PU_STATIC);

   // get lump numbers for faces
   for(i = 0; i < 4; i++)
   {
      char tempstr[9];

      memset(tempstr, 0, 9);

      sprintf(tempstr, "FACEA%.1d", i);
      hi_faces[i] = W_GetNumForName(tempstr);

      sprintf(tempstr, "FACEB%.1d", i);
      hi_dead_faces[i] = W_GetNumForName(tempstr);
   }

   // haleyjd 03/27/05: EDF-defined intermission map names
   mapName     = NULL;
   nextMapName = NULL;

   {
      char nameBuffer[24];
      const char *basename;
      edf_string_t *str;

      // set current map
      if(hi_wbs.li_lastlevelname && *hi_wbs.li_lastlevelname)
         mapName = hi_wbs.li_lastlevelname;
      else
      {
         psnprintf(nameBuffer, 24, "_IN_NAME_%s", gamemapname);
         if((str = E_StringForName(nameBuffer)))
            mapName = str->string;
      }

      if(hi_wbs.li_nextlevelname && *hi_wbs.li_nextlevelname)
      {
         nextMapName = hi_wbs.li_nextlevelname;
         return;
      }

      // are we going to a secret level?
      basename = hi_wbs.gotosecret ? LevelInfo.nextSecret : LevelInfo.nextLevel;

      // set next map
      if(*basename)
      {
         psnprintf(nameBuffer, 24, "_IN_NAME_%s", basename);

         if((str = E_StringForName(nameBuffer)))
            nextMapName = str->string;
      }
      else
      {
         // try ExMy and MAPxy defaults for normally-named maps
         if(isExMy(gamemapname))
         {
            psnprintf(nameBuffer, 24, "_IN_NAME_E%01dM%01d", 
                      hi_wbs.epsd + 1, hi_wbs.next + 1);
            if((str = E_StringForName(nameBuffer)))
               nextMapName = str->string;
         }
         else if(isMAPxy(gamemapname))
         {
            psnprintf(nameBuffer, 24, "_IN_NAME_MAP%02d", hi_wbs.next + 1);
            if((str = E_StringForName(nameBuffer)))
               nextMapName = str->string;
         }
      }
   }
}