components/prboom/d_main.c
//
// GetFirstMap
//
// Ty 08/29/98 - determine first available map from the loaded wads and run it
//
GetFirstMap
Ty 08/29/98 - determine first available map from the loaded wads and run it
GetFirstMap Ty 08 / 29 / 98 - determine first available map from the loaded wads and run it
void GetFirstMap(int *ep, int *map)
{
  int i,j; 
  boolean done = false;  
  char test[6];  
  char name[6];  
  boolean newlevel = false;  
  int ix;  
  strcpy(name,""); 
  if (*map == 0) 
  {
    *ep = 1;
    *map = 1; 
    if (gamemode == commercial)
    {
      for (i=1;!done && i<33;i++)  
      {
        sprintf(test,"MAP%02d",i);
        ix = W_CheckNumForName(test);
        if (ix != -1)  
        {
          if (lumpinfo[ix].source == source_pwad)
          {
            *map = i;
            strcpy(name,test);  
            done = true;  
            newlevel = true; 
          }
          else
          {
            if (!*name)  
               strcpy(name,test);
          }
        }
      }
    }
    else 
    {
      strcpy(name,"E1M1");   - default for display
      for (i=1;!done && i<5;i++)  
      {
        for (j=1;!done && j<10;j++)  
        {
          sprintf(test,"E%dM%d",i,j);
          ix = W_CheckNumForName(test);
          if (ix != -1)  
          {
            if (lumpinfo[ix].source == source_pwad)
            {
              *ep = i;
              *map = j;
              strcpy(name,test); 
              done = true;  
              newlevel = true; 
            }
            else
            {
              if (!*name)  
                 strcpy(name,test);
            }
          }
        }
      }
    }
    lprintf(LO_CONFIRM,"Auto-warping to first %slevel: %s\n",
      newlevel ? "new " : "", name);   - new level test
  }
}
void GetFirstMap ( int * ep , int * map ) { int i , j ; boolean done = false ; char test [ 6 ] ; char name [ 6 ] ; boolean newlevel = false ; int ix ; strcpy ( name , " " ) ; if ( * map == 0 ) { * ep = 1 ; * map = 1 ; if ( gamemode == commercial ) { for ( i = 1 ; ! done && i < 33 ; i ++ ) { sprintf ( test , " " , i ) ; ix = W_CheckNumForName ( test ) ; if ( ix != -1 ) { if ( lumpinfo [ ix ] . source == source_pwad ) { * map = i ; strcpy ( name , test ) ; done = true ; newlevel = true ; } else { if ( ! * name ) strcpy ( name , test ) ; } } } } else { strcpy ( name , " " ) ; for ( i = 1 ; ! done && i < 5 ; i ++ ) { for ( j = 1 ; ! done && j < 10 ; j ++ ) { sprintf ( test , " " , i , j ) ; ix = W_CheckNumForName ( test ) ; if ( ix != -1 ) { if ( lumpinfo [ ix ] . source == source_pwad ) { * ep = i ; * map = j ; strcpy ( name , test ) ; done = true ; newlevel = true ; } else { if ( ! * name ) strcpy ( name , test ) ; } } } } } lprintf ( LO_CONFIRM , " \n " , newlevel ? " " : " " , name ) ; } }
GetFirstMap
Ty 08/29/98 - determine first available map from the loaded wads and run it
GetFirstMap Ty 08 / 29 / 98 - determine first available map from the loaded wads and run it
// used to generate map name // Ty 09/13/98 - to exit inner loops // MAPxx or ExMx plus terminator for testing // MAPxx or ExMx plus terminator for display // Ty 10/04/98 - to test for new level // index for lookup // initialize // unknown so go search for first changed one // default E1M1 or MAP01 // Ty 09/13/98 - add use of !done // Ty 10/04/98 avoid -1 subscript // Ty 10/04/98 // Ty 09/13/98 // Ty 10/04/98 // found one, not pwad.  First default. // one of the others // Ty 10/04/98 - default for display // Ty 09/13/98 - add use of !done // Ty 09/13/98 - add use of !done // Ty 10/04/98 avoid -1 subscript // Ty 10/04/98 // Ty 09/13/98 // Ty 10/04/98 // found one, not pwad.  First default. //jff 9/3/98 use logical output routine // Ty 10/04/98 - new level test