Difference for random_maps/random_map.c from version 1.6 to 1.7


version 1.6 version 1.7
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_random_map_c =   * static char *rcsid_random_map_c =
  *   "$Id: random_map.c,v 1.6 2000/06/19 01:34:31 cvs Exp $";   *   "$Id: random_map.c,v 1.7 2000/12/15 03:09:19 peterm Exp $";
  */   */
   
 /*  /*
Line 39
 
Line 39
   
   
   
 int Xsize;  
 int Ysize;  
   
 char wallstyle[512];  
 char wall_name[512];  
 char floorstyle[512];  
 char monsterstyle[512];  
 char treasurestyle[512];  
 char layoutstyle[512];  
 char decorstyle[512];  
 char doorstyle[512];  
 char exitstyle[512];  
 char final_map[512];  
 char origin_map[512];  
 char this_map[HUGE_BUF];  
   
 int layoutoptions1=0;  
 int layoutoptions2=0;  
 int layoutoptions3=0;  
 int symmetry=0;  
 int difficulty=0;  
 int difficulty_given=0;  
 int dungeon_level=0;  
 int dungeon_depth=0;  
 int decoroptions=0;  
 int orientation=0;  
 int origin_x=0;  
 int origin_y=0;  
 int random_seed=0;  
 long unsigned int total_map_hp=0;  
 int map_layout_style=0;  
 int treasureoptions=0;  
 int symmetry_used=0;  
 int generate_treasure_now=1; /* assume memory operation */  
   
 EXTERN FILE *logfile;  EXTERN FILE *logfile;
 mapstruct *generate_random_map(char *InFileName,char *OutFileName) {  mapstruct *generate_random_map(char *InFileName,char *OutFileName) {
   FILE *InFile;    FILE *InFile;
   char **layout;    char **layout;
   mapstruct *theMap;    mapstruct *theMap;
     RMParms *RP;
     RP = (RMParms *) calloc(1,sizeof(RMParms));
   
   /* set up the random numbers */    /* set up the random numbers */
   
   Xsize=-1;Ysize=-1;    RP->Xsize=-1;
   exitstyle[0]=final_map[0]=doorstyle[0]=decorstyle[0]=0;    RP->Ysize=-1;
   wallstyle[0]=floorstyle[0]=monsterstyle[0]=treasurestyle[0]=layoutstyle[0]=0;  
   
   treasureoptions=0;  
   layoutoptions1=0;  
   layoutoptions2=0;  
   layoutoptions3=0;  
   symmetry=0;  
   difficulty=0;  
   dungeon_level=0;  
   dungeon_depth=0;  
   decoroptions=0;  
   orientation=0;  
   origin_x=0;  
   origin_y=0;  
   random_seed=0;  
   total_map_hp=0;  
   map_layout_style=0;  
   symmetry_used=0;  
   difficulty_given=0;  
   
   /*  strcpy(this_map,OutFileName);    RP->generate_treasure_now=1;
  sprintf(OutFilePath,"%s/maps%s",LIBDIR,OutFileName); */  
      
   if((InFile=fopen(InFileName,"r"))==NULL) {    if((InFile=fopen(InFileName,"r"))==NULL) {
     printf("\nError:  can't open %s\n",InFileName);      printf("\nError:  can't open %s\n",InFileName);
     return(0);      return(0);
   }     }
   /*  if((OutFile=fopen(OutFilePath,"wb"))==NULL) {  
     printf("\nError:  can't open %s\n",OutFilePath);    load_parameters(InFile,LO_NEWFILE,RP);
     return(0);  
  } */  
   load_parameters(InFile,LO_NEWFILE);  
   
   /* pick a random seed, or use the one from the input file */    /* pick a random seed, or use the one from the input file */
   if(random_seed == 0)    SRANDOM(time(0));    if(RP->random_seed == 0)    SRANDOM(time(0));
   else SRANDOM(random_seed);    else SRANDOM(RP->random_seed);
   
   if(difficulty==0)    if(RP->difficulty==0)
     difficulty = dungeon_level; /* use this instead of a map difficulty  */      RP->difficulty = RP->dungeon_level; /* use this instead of a map difficulty  */
   else    else
  difficulty_given=1;      RP->difficulty_given=1;
   
   layout = layoutgen();    layout = layoutgen(RP);
   
   /* increment these for the current map */    /* increment these for the current map */
   dungeon_level+=1;    RP->dungeon_level+=1;
   /* allow constant-difficulty maps. */    /* allow constant-difficulty maps. */
 /*  difficulty+=1; */  /*  difficulty+=1; */
   
   /*  rotate the layout randomly */    /*  rotate the layout randomly */
   layout=rotate_layout(layout,RANDOM()%4);    layout=rotate_layout(layout,RANDOM()%4,RP);
   
   /* allocate the map and set the floor */    /* allocate the map and set the floor */
   theMap = make_map_floor(layout,floorstyle);     theMap = make_map_floor(layout,RP->floorstyle,RP);
   
   /* set the name of the map. */    /* set the name of the map. */
   strcpy(theMap->path,OutFileName);    strcpy(theMap->path,OutFileName);
   
   make_map_walls(theMap,layout,wallstyle);    make_map_walls(theMap,layout,RP->wallstyle,RP);
   
   put_doors(theMap,layout,doorstyle);    put_doors(theMap,layout,RP->doorstyle,RP);
   
   place_exits(theMap,layout,exitstyle,orientation);    place_exits(theMap,layout,RP->exitstyle,RP->orientation,RP);
   
   place_monsters(theMap,monsterstyle,difficulty);    place_monsters(theMap,RP->monsterstyle,RP->difficulty,RP);
   
   place_specials_in_map(theMap,layout);    place_specials_in_map(theMap,layout,RP);
   
   /* treasures needs to have a proper difficulty set for    /* treasures needs to have a proper difficulty set for
      the map. */       the map. */
   theMap->difficulty=calculate_difficulty(theMap);    theMap->difficulty=calculate_difficulty(theMap);
   
   place_treasure(theMap,layout,treasurestyle,treasureoptions);    place_treasure(theMap,layout,RP->treasurestyle,RP->treasureoptions,RP);
   
   put_decor(theMap,layout,decorstyle,decoroptions);    put_decor(theMap,layout,RP->decorstyle,RP->decoroptions,RP);
   
   /* generate treasures, etc. */    /* generate treasures, etc. */
   if(generate_treasure_now)    if(RP->generate_treasure_now)
     fix_auto_apply(theMap);      fix_auto_apply(theMap);
   
   /* print a schematic of the maze */    /* print a schematic of the maze */
Line 183
 
Line 128
   
 /*  function selects the layout function and gives it whatever  /*  function selects the layout function and gives it whatever
     arguments it needs.  */      arguments it needs.  */
 char **layoutgen() {  char **layoutgen(RMParms *RP) {
   char **maze=0;    char **maze=0;
   if(symmetry!=NO_SYM) {    if(RP->symmetry!=NO_SYM) {
  if(Xsize<15) Xsize = 15 + RANDOM()%25;      if(RP->Xsize<15) RP->Xsize = 15 + RANDOM()%25;
  if(Ysize<15) Ysize = 15 + RANDOM()%25;      if(RP->Ysize<15) RP->Ysize = 15 + RANDOM()%25;
   }    }
   else    else
  {   {
  if(Xsize<4) Xsize = 15 + RANDOM()%25;        if(RP->Xsize<4) RP->Xsize = 15 + RANDOM()%25;
  if(Ysize<4) Ysize = 15 + RANDOM()%25;        if(RP->Ysize<4) RP->Ysize = 15 + RANDOM()%25;
  }   }
      
   if(symmetry == RANDOM_SYM) {    if(RP->symmetry == RANDOM_SYM) {
     symmetry_used = (RANDOM() % ( XY_SYM))+1;      RP->symmetry_used = (RANDOM() % ( XY_SYM))+1;
     if(symmetry_used==Y_SYM||symmetry_used==XY_SYM) Ysize = Ysize/2+1;      if(RP->symmetry_used==Y_SYM||RP->symmetry_used==XY_SYM) RP->Ysize = RP->Ysize/2+1;
  if(symmetry_used==X_SYM||symmetry_used==XY_SYM) Xsize = Xsize/2+1;      if(RP->symmetry_used==X_SYM||RP->symmetry_used==XY_SYM) RP->Xsize = RP->Xsize/2+1;
   }    }
   else symmetry_used = symmetry;    else RP->symmetry_used = RP->symmetry;
   
   if(symmetry==Y_SYM||symmetry==XY_SYM) Ysize = Ysize/2+1;    if(RP->symmetry==Y_SYM||RP->symmetry==XY_SYM) RP->Ysize = RP->Ysize/2+1;
   if(symmetry==X_SYM||symmetry==XY_SYM) Xsize = Xsize/2+1;    if(RP->symmetry==X_SYM||RP->symmetry==XY_SYM) RP->Xsize = RP->Xsize/2+1;
   
   if(strstr(layoutstyle,"onion")) {    if(strstr(RP->layoutstyle,"onion")) {
     maze = map_gen_onion(Xsize,Ysize,layoutoptions1,layoutoptions2);      maze = map_gen_onion(RP->Xsize,RP->Ysize,RP->layoutoptions1,RP->layoutoptions2);
     if(!(RANDOM()%3)&& !(layoutoptions1 & OPT_WALLS_ONLY)) roomify_layout(maze);      RP->map_layout_style = ONION_LAYOUT;
       if(!(RANDOM()%3)&& !(RP->layoutoptions1 & OPT_WALLS_ONLY)) roomify_layout(maze,RP);
   }    }
   
   if(strstr(layoutstyle,"maze")) {    if(strstr(RP->layoutstyle,"maze")) {
     maze = maze_gen(Xsize,Ysize,layoutoptions1);      maze = maze_gen(RP->Xsize,RP->Ysize,RP->layoutoptions1,RP);
     if(!(RANDOM()%2)) doorify_layout(maze);      RP->map_layout_style = MAZE_LAYOUT;
   
       if(!(RANDOM()%2)) doorify_layout(maze,RP);
   }    }
   
   if(maze == 0) /* unknown or unspecified layout type, pick one at random */    if(maze == 0) /* unknown or unspecified layout type, pick one at random */
     switch(RANDOM()%NROFLAYOUTS) {      switch(RANDOM()%NROFLAYOUTS) {
     case 0:      case 0:
       maze = maze_gen(Xsize,Ysize,RANDOM()%2);        maze = maze_gen(RP->Xsize,RP->Ysize,RANDOM()%2,RP);
       if(!(RANDOM()%2)) doorify_layout(maze);        if(!(RANDOM()%2)) doorify_layout(maze,RP);
       break;        break;
     case 1:      case 1:
       maze = map_gen_onion(Xsize,Ysize,layoutoptions1,layoutoptions2);        maze = map_gen_onion(RP->Xsize,RP->Ysize,RP->layoutoptions1,RP->layoutoptions2);
       if(!(RANDOM()%3)&& !(layoutoptions1 & OPT_WALLS_ONLY)) roomify_layout(maze);        if(!(RANDOM()%3)&& !(RP->layoutoptions1 & OPT_WALLS_ONLY)) roomify_layout(maze,RP);
       break;        break;
     }      }
   
   maze = symmetrize_layout(maze, symmetry_used);    maze = symmetrize_layout(maze, RP->symmetry_used,RP);
   
   return maze;     return maze;
 }  }
Line 236
 
Line 184
 /*  takes a map and makes it symmetric:  adjusts Xsize and  /*  takes a map and makes it symmetric:  adjusts Xsize and
 Ysize to produce a symmetric map. */  Ysize to produce a symmetric map. */
   
 char **symmetrize_layout(char **maze, int sym) {  char **symmetrize_layout(char **maze, int sym,RMParms *RP) {
   int i,j;    int i,j;
   char **sym_maze;    char **sym_maze;
   int Xsize_orig,Ysize_orig;    int Xsize_orig,Ysize_orig;
   Xsize_orig = Xsize;    Xsize_orig = RP->Xsize;
   Ysize_orig = Ysize;    Ysize_orig = RP->Ysize;
   symmetry_used = sym;  /* tell everyone else what sort of symmetry is used.*/    RP->symmetry_used = sym;  /* tell everyone else what sort of symmetry is used.*/
   if(sym == NO_SYM) {    if(sym == NO_SYM) {
  Xsize = Xsize_orig;      RP->Xsize = Xsize_orig;
  Ysize = Ysize_orig;      RP->Ysize = Ysize_orig;
  return maze;   return maze;
   }    }
   /* pick new sizes */    /* pick new sizes */
   Xsize = ((sym==X_SYM||sym==XY_SYM)?Xsize*2-3:Xsize);    RP->Xsize = ((sym==X_SYM||sym==XY_SYM)?RP->Xsize*2-3:RP->Xsize);
   Ysize = ((sym==Y_SYM||sym==XY_SYM)?Ysize*2-3:Ysize);    RP->Ysize = ((sym==Y_SYM||sym==XY_SYM)?RP->Ysize*2-3:RP->Ysize);
   
   sym_maze = (char **)calloc(sizeof(char*),Xsize);    sym_maze = (char **)calloc(sizeof(char*),RP->Xsize);
   for(i=0;i<Xsize;i++)    for(i=0;i<RP->Xsize;i++)
     sym_maze[i] = (char *)calloc(sizeof(char),Ysize);      sym_maze[i] = (char *)calloc(sizeof(char),RP->Ysize);
   
   if(sym==X_SYM)    if(sym==X_SYM)
     for(i=0;i<Xsize/2+1;i++)      for(i=0;i<RP->Xsize/2+1;i++)
       for(j=0;j<Ysize;j++) {        for(j=0;j<RP->Ysize;j++) {
    sym_maze[i][j] = maze[i][j];     sym_maze[i][j] = maze[i][j];
    sym_maze[Xsize - i-1][j] = maze[i][j];          sym_maze[RP->Xsize - i-1][j] = maze[i][j];
       };        };
   if(sym==Y_SYM)    if(sym==Y_SYM)
     for(i=0;i<Xsize;i++)      for(i=0;i<RP->Xsize;i++)
       for(j=0;j<Ysize/2+1;j++) {        for(j=0;j<RP->Ysize/2+1;j++) {
    sym_maze[i][j] = maze[i][j];     sym_maze[i][j] = maze[i][j];
    sym_maze[i][Ysize-j-1] = maze[i][j];          sym_maze[i][RP->Ysize-j-1] = maze[i][j];
       }        }
   if(sym==XY_SYM)    if(sym==XY_SYM)
     for(i=0;i<Xsize/2+1;i++)      for(i=0;i<RP->Xsize/2+1;i++)
       for(j=0;j<Ysize/2+1;j++) {        for(j=0;j<RP->Ysize/2+1;j++) {
    sym_maze[i][j] = maze[i][j];     sym_maze[i][j] = maze[i][j];
    sym_maze[i][Ysize-j-1] = maze[i][j];          sym_maze[i][RP->Ysize-j-1] = maze[i][j];
    sym_maze[Xsize - i-1][j] = maze[i][j];          sym_maze[RP->Xsize - i-1][j] = maze[i][j];
    sym_maze[Xsize - i-1][Ysize-j-1] = maze[i][j];          sym_maze[RP->Xsize - i-1][RP->Ysize-j-1] = maze[i][j];
       }        }
   /* delete the old maze */    /* delete the old maze */
   for(i=0;i<Xsize_orig;i++)    for(i=0;i<Xsize_orig;i++)
Line 289
 
Line 237
     It'll modify Xsize and Ysize if they're swapped.      It'll modify Xsize and Ysize if they're swapped.
 */  */
   
 char ** rotate_layout(char **maze,int rotation) {  char ** rotate_layout(char **maze,int rotation,RMParms *RP) {
   char **new_maze;    char **new_maze;
   int i,j;    int i,j;
   
Line 299
 
Line 247
     break;      break;
   case 2:  /* a reflection */    case 2:  /* a reflection */
     {      {
       char *new=malloc(sizeof(char) * Xsize*Ysize);        char *new=malloc(sizeof(char) * RP->Xsize*RP->Ysize);
       for(i=0;i<Xsize;i++) {  /* make a copy */        for(i=0;i<RP->Xsize;i++) {  /* make a copy */
    for(j=0;j<Ysize;j++) {          for(j=0;j<RP->Ysize;j++) {
  new[i * Ysize + j] = maze[i][j];            new[i * RP->Ysize + j] = maze[i][j];
    }     }
       }        }
       for(i=0;i<Xsize;i++) { /* copy a reflection back */        for(i=0;i<RP->Xsize;i++) { /* copy a reflection back */
    for(j=0;j<Ysize;j++) {          for(j=0;j<RP->Ysize;j++) {
  maze[i][j]= new[(Xsize-i-1)*Ysize + Ysize-j-1];            maze[i][j]= new[(RP->Xsize-i-1)*RP->Ysize + RP->Ysize-j-1];
    }     }
       }        }
       return maze;        return maze;
Line 316
 
Line 264
   case 1:    case 1:
   case 3:    case 3:
     { int swap;      { int swap;
     new_maze = (char **) calloc(sizeof(char *),Ysize);      new_maze = (char **) calloc(sizeof(char *),RP->Ysize);
     for(i=0;i<Ysize;i++) {      for(i=0;i<RP->Ysize;i++) {
       new_maze[i] = (char *) calloc(sizeof(char),Xsize);        new_maze[i] = (char *) calloc(sizeof(char),RP->Xsize);
     }      }
     if(rotation == 1) /* swap x and y */      if(rotation == 1) /* swap x and y */
       for(i=0;i<Xsize;i++)        for(i=0;i<RP->Xsize;i++)
    for(j=0;j<Ysize;j++)          for(j=0;j<RP->Ysize;j++)
  new_maze[j][i] = maze[i][j];   new_maze[j][i] = maze[i][j];
   
     if(rotation == 3) { /* swap x and y */      if(rotation == 3) { /* swap x and y */
       for(i=0;i<Xsize;i++)        for(i=0;i<RP->Xsize;i++)
    for(j=0;j<Ysize;j++)          for(j=0;j<RP->Ysize;j++)
  new_maze[j][i] = maze[Xsize -i-1][Ysize - j-1];            new_maze[j][i] = maze[RP->Xsize -i-1][RP->Ysize - j-1];
     }      }
   
     /* delete the old layout */      /* delete the old layout */
     for(i=0;i<Xsize;i++)      for(i=0;i<RP->Xsize;i++)
       free(maze[i]);        free(maze[i]);
     free(maze);      free(maze);
   
     swap = Ysize;      swap = RP->Ysize;
     Ysize = Xsize;      RP->Ysize = RP->Xsize;
     Xsize = swap;      RP->Xsize = swap;
     return new_maze;      return new_maze;
     break;      break;
     }      }
Line 348
 
Line 296
   
 /*  take a layout and make some rooms in it.   /*  take a layout and make some rooms in it.
     --works best on onions.*/      --works best on onions.*/
 void roomify_layout(char **maze) {  void roomify_layout(char **maze,RMParms *RP) {
   int tries = Xsize*Ysize/30;    int tries = RP->Xsize*RP->Ysize/30;
   int ti;    int ti;
   
   for(ti=0;ti<tries;ti++) {    for(ti=0;ti<tries;ti++) {
     int dx,dy;  /* starting location for looking at creating a door */      int dx,dy;  /* starting location for looking at creating a door */
     int cx,cy;  /* results of checking on creating walls. */      int cx,cy;  /* results of checking on creating walls. */
     dx = RANDOM() % Xsize;      dx = RANDOM() % RP->Xsize;
     dy = RANDOM() % Ysize;      dy = RANDOM() % RP->Ysize;
     cx = can_make_wall(maze,dx,dy,0);  /* horizontal */      cx = can_make_wall(maze,dx,dy,0,RP);  /* horizontal */
     cy = can_make_wall(maze,dx,dy,1);  /* vertical */      cy = can_make_wall(maze,dx,dy,1,RP);  /* vertical */
     if(cx == -1) {      if(cx == -1) {
       if(cy != -1)        if(cy != -1)
    make_wall(maze,dx,dy,1);     make_wall(maze,dx,dy,1);
Line 378
 
Line 326
     (or vertical, dir == 1)      (or vertical, dir == 1)
     here which ends up on other walls sensibly.  */      here which ends up on other walls sensibly.  */
          
 int can_make_wall(char **maze,int dx,int dy,int dir) {  int can_make_wall(char **maze,int dx,int dy,int dir,RMParms *RP) {
   int i1;    int i1;
   int length=0;    int length=0;
   
   /* dont make walls if we're on the edge. */    /* dont make walls if we're on the edge. */
   if(dx == 0 || dx == (Xsize -1) || dy == 0 || dy == (Ysize-1)) return -1;    if(dx == 0 || dx == (RP->Xsize -1) || dy == 0 || dy == (RP->Ysize-1)) return -1;
   
   /* don't make walls if we're ON a wall. */    /* don't make walls if we're ON a wall. */
   if(maze[dx][dy]!=0) return -1;    if(maze[dx][dy]!=0) return -1;
Line 392
 
Line 340
     {      {
       int y = dy;        int y = dy;
       for(i1=dx-1;i1>0;i1--) {        for(i1=dx-1;i1>0;i1--) {
    int sindex=surround_flag(maze,i1,y);          int sindex=surround_flag(maze,i1,y,RP);
    if(sindex == 1) break;       if(sindex == 1) break; 
    if(sindex != 0) return -1;  /* can't make horiz.  wall here */     if(sindex != 0) return -1;  /* can't make horiz.  wall here */
    length++;     length++;
       }        }
    
       for(i1=dx+1;i1<Xsize-1;i1++) {        for(i1=dx+1;i1<RP->Xsize-1;i1++) {
    int sindex=surround_flag(maze,i1,y);          int sindex=surround_flag(maze,i1,y,RP);
    if(sindex == 2) break;       if(sindex == 2) break; 
    if(sindex != 0) return -1;  /* can't make horiz.  wall here */     if(sindex != 0) return -1;  /* can't make horiz.  wall here */
    length++;     length++;
Line 409
 
Line 357
   else {  /* vertical */    else {  /* vertical */
  int x = dx;   int x = dx;
  for(i1=dy-1;i1>0;i1--) {   for(i1=dy-1;i1>0;i1--) {
  int sindex=surround_flag(maze,x,i1);        int sindex=surround_flag(maze,x,i1,RP);
  if(sindex == 4) break;     if(sindex == 4) break; 
  if(sindex != 0) return -1;  /* can't make vert. wall here */   if(sindex != 0) return -1;  /* can't make vert. wall here */
  length++;   length++;
  }   }
    
  for(i1=dy+1;i1<Ysize-1;i1++) {      for(i1=dy+1;i1<RP->Ysize-1;i1++) {
  int sindex=surround_flag(maze,x,i1);        int sindex=surround_flag(maze,x,i1,RP);
  if(sindex == 8) break;     if(sindex == 8) break; 
  if(sindex != 0) return -1;  /* can't make verti. wall here */   if(sindex != 0) return -1;  /* can't make verti. wall here */
  length++;   length++;
Line 455
 
Line 403
   
 /*  puts doors at appropriate locations in a layout. */  /*  puts doors at appropriate locations in a layout. */
   
 void doorify_layout(char **maze) {  void doorify_layout(char **maze,RMParms *RP) {
   int ndoors = Xsize*Ysize/60;  /* reasonable number of doors. */    int ndoors = RP->Xsize*RP->Ysize/60;  /* reasonable number of doors. */
   int *doorlist_x;    int *doorlist_x;
   int *doorlist_y;    int *doorlist_y;
   int doorlocs = 0;  /* # of available doorlocations */    int doorlocs = 0;  /* # of available doorlocations */
   int i,j;    int i,j;
      
   doorlist_x = malloc(sizeof(int) * Xsize*Ysize);    doorlist_x = malloc(sizeof(int) * RP->Xsize*RP->Ysize);
   doorlist_y = malloc(sizeof(int) * Xsize*Ysize);    doorlist_y = malloc(sizeof(int) * RP->Xsize*RP->Ysize);
   
   
   /* make a list of possible door locations */    /* make a list of possible door locations */
   for(i=1;i<Xsize-1;i++)    for(i=1;i<RP->Xsize-1;i++)
     for(j=1;j<Ysize-1;j++) {      for(j=1;j<RP->Ysize-1;j++) {
       int sindex = surround_flag(maze,i,j);        int sindex = surround_flag(maze,i,j,RP);
       if(sindex == 3 || sindex == 12) /* these are possible door sindex*/        if(sindex == 3 || sindex == 12) /* these are possible door sindex*/
    {     {
  doorlist_x[doorlocs]=i;   doorlist_x[doorlocs]=i;
Line 483
 
Line 431
     di = RANDOM() % doorlocs;      di = RANDOM() % doorlocs;
     i=doorlist_x[di];      i=doorlist_x[di];
     j=doorlist_y[di];      j=doorlist_y[di];
     sindex= surround_flag(maze,i,j);      sindex= surround_flag(maze,i,j,RP);
     if(sindex == 3 || sindex == 12) /* these are possible door sindex*/      if(sindex == 3 || sindex == 12) /* these are possible door sindex*/
       {        {
    maze[i][j] = '*';     maze[i][j] = '*';
Line 497
 
Line 445
 }  }
   
   
 void write_map_parameters_to_string(char *buf) {  void write_map_parameters_to_string(char *buf,RMParms *RP) {
   
   char small_buf[256];    char small_buf[256];
   sprintf(buf,"xsize %d\nysize %d\n",Xsize,Ysize);    sprintf(buf,"xsize %d\nysize %d\n",RP->Xsize,RP->Ysize);
   
   if(wallstyle[0]) {    if(RP->wallstyle[0]) {
     sprintf(small_buf,"wallstyle %s\n",wallstyle);      sprintf(small_buf,"wallstyle %s\n",RP->wallstyle);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   if(floorstyle[0]) {    if(RP->floorstyle[0]) {
     sprintf(small_buf,"floorstyle %s\n",floorstyle);      sprintf(small_buf,"floorstyle %s\n",RP->floorstyle);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   if(monsterstyle[0]) {    if(RP->monsterstyle[0]) {
     sprintf(small_buf,"monsterstyle %s\n",monsterstyle);      sprintf(small_buf,"monsterstyle %s\n",RP->monsterstyle);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   if(treasurestyle[0]) {    if(RP->treasurestyle[0]) {
     sprintf(small_buf,"treasurestyle %s\n",treasurestyle);      sprintf(small_buf,"treasurestyle %s\n",RP->treasurestyle);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   if(layoutstyle[0]) {    if(RP->layoutstyle[0]) {
     sprintf(small_buf,"layoutstyle %s\n",layoutstyle);      sprintf(small_buf,"layoutstyle %s\n",RP->layoutstyle);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   if(decorstyle[0]) {    if(RP->decorstyle[0]) {
     sprintf(small_buf,"decorstyle %s\n",decorstyle);      sprintf(small_buf,"decorstyle %s\n",RP->decorstyle);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   if(doorstyle[0]) {    if(RP->doorstyle[0]) {
     sprintf(small_buf,"doorstyle %s\n",doorstyle);      sprintf(small_buf,"doorstyle %s\n",RP->doorstyle);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   if(exitstyle[0]) {    if(RP->exitstyle[0]) {
     sprintf(small_buf,"exitstyle %s\n",exitstyle);      sprintf(small_buf,"exitstyle %s\n",RP->exitstyle);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   if(final_map[0]) {    if(RP->final_map[0]) {
     sprintf(small_buf,"final_map %s\n",final_map);      sprintf(small_buf,"final_map %s\n",RP->final_map);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   if(this_map[0]) {    if(RP->this_map[0]) {
     sprintf(small_buf,"origin_map %s\n",this_map);      sprintf(small_buf,"origin_map %s\n",RP->this_map);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   if(layoutoptions1) {    if(RP->layoutoptions1) {
     sprintf(small_buf,"layoutoptions1 %d\n",layoutoptions1);      sprintf(small_buf,"layoutoptions1 %d\n",RP->layoutoptions1);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   
   if(layoutoptions2) {    if(RP->layoutoptions2) {
     sprintf(small_buf,"layoutoptions2 %d\n",layoutoptions2);      sprintf(small_buf,"layoutoptions2 %d\n",RP->layoutoptions2);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   
   if(layoutoptions3) {    if(RP->layoutoptions3) {
     sprintf(small_buf,"layoutoptions3 %d\n",layoutoptions3);      sprintf(small_buf,"layoutoptions3 %d\n",RP->layoutoptions3);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   if(symmetry) {    if(RP->symmetry) {
     sprintf(small_buf,"symmetry %d\n",symmetry);      sprintf(small_buf,"symmetry %d\n",RP->symmetry);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   
   if(difficulty && difficulty_given ) {    if(RP->difficulty && RP->difficulty_given ) {
     sprintf(small_buf,"difficulty %d\n",difficulty);      sprintf(small_buf,"difficulty %d\n",RP->difficulty);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   sprintf(small_buf,"dungeon_level %d\n",dungeon_level);    sprintf(small_buf,"dungeon_level %d\n",RP->dungeon_level);
   strcat(buf,small_buf);    strcat(buf,small_buf);
   
   if(dungeon_depth) {    if(RP->dungeon_depth) {
     sprintf(small_buf,"dungeon_depth %d\n",dungeon_depth);      sprintf(small_buf,"dungeon_depth %d\n",RP->dungeon_depth);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   if(decoroptions) {    if(RP->decoroptions) {
     sprintf(small_buf,"decoroptions %d\n",decoroptions);      sprintf(small_buf,"decoroptions %d\n",RP->decoroptions);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   if(orientation) {    if(RP->orientation) {
     sprintf(small_buf,"orientation %d\n",orientation);      sprintf(small_buf,"orientation %d\n",RP->orientation);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   if(origin_x) {    if(RP->origin_x) {
     sprintf(small_buf,"origin_x %d\n",origin_x);      sprintf(small_buf,"origin_x %d\n",RP->origin_x);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   if(origin_y) {    if(RP->origin_y) {
     sprintf(small_buf,"origin_y %d\n",origin_y);      sprintf(small_buf,"origin_y %d\n",RP->origin_y);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   if(random_seed) {    if(RP->random_seed) {
     sprintf(small_buf,"random_seed %d\n",random_seed + 1);      sprintf(small_buf,"random_seed %d\n",RP->random_seed + 1);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
   if(treasureoptions) {    if(RP->treasureoptions) {
     sprintf(small_buf,"treasureoptions %d\n",treasureoptions);      sprintf(small_buf,"treasureoptions %d\n",RP->treasureoptions);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   
Line 626
 
Line 574
    char *wallstyle_n,     char *wallstyle_n,
    char *floorstyle_n,     char *floorstyle_n,
    char *monsterstyle_n,     char *monsterstyle_n,
   
    char *treasurestyle_n,     char *treasurestyle_n,
    char *layoutstyle_n,     char *layoutstyle_n,
    char *decorstyle_n,     char *decorstyle_n,
Line 634
 
Line 581
    char *exitstyle_n,     char *exitstyle_n,
    char *final_map_n,     char *final_map_n,
    char *this_map_n,     char *this_map_n,
   
    int layoutoptions1_n,     int layoutoptions1_n,
    int layoutoptions2_n,     int layoutoptions2_n,
    int layoutoptions3_n,     int layoutoptions3_n,
    int symmetry_n,     int symmetry_n,
    int dungeon_depth_n,     int dungeon_depth_n,
    int dungeon_level_n,     int dungeon_level_n,
   
    int difficulty_n,     int difficulty_n,
    int difficulty_given_n,     int difficulty_given_n,
    int decoroptions_n,     int decoroptions_n,
Line 649
 
Line 594
    int origin_x_n,     int origin_x_n,
    int origin_y_n,     int origin_y_n,
    int random_seed_n,     int random_seed_n,
    int treasureoptions_n                                  int treasureoptions_n )
    )   
 {  {
   
   char small_buf[256];    char small_buf[256];
Line 697
 
Line 641
   }    }
   
   if(final_map_n && final_map_n[0]) {    if(final_map_n && final_map_n[0]) {
     sprintf(small_buf,"final_map %s\n",final_map);      sprintf(small_buf,"final_map %s\n",final_map_n);
     strcat(buf,small_buf);      strcat(buf,small_buf);
   }    }
   


Legend:
line(s) removed in v.1.6 
line(s) changed
 line(s) added in v.1.7

File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:56