In any given game, either the Islands or the Swamp will be generated (50% chance of each) as Lair subbranches. The Islands have a ranged-attackers theme and are 5 levels deep. THIS IMPLEMENTATION IS INCOMPLETE, so beware! The following things need to be added:
I also put in various minor fixes.
Breaks savefiles, possibly highscores too. I'll put in a savefile version bump later.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1289 c06c8d41-db1a-0410-9941-cceddc491573
TZ55IZNANEJO2WDTKYWVLY2W2VV6BR7WKIN7XLNISAMMFT6LG2WQC KKROXTUPBNEXXEUUDJNADATK3BCQPSQWFZ6L4VTKBPTYXJLYUHDQC SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC 5ASC3STDYCNLZFEBN6UTMUCGDETHBR2OCBZCF5VIAZ5RRWLOTDYQC T4IH76FA5TWHFOZUJFHLQXQJENJHWTUZZP4EGNA7D4GTZY7D4ZKAC RC6L3CIBLJEH4GWRFD7UQNGI6PZT74FRUVOYHSAN2XCC74NZUASQC 5UVDIVD4NSXA52U4QMQIVST3GSZJ2A2YZK3RUEXKPM43YVQ7LI5AC TCB6NKWD6VFEKM43J3ZIJJPRL7M4PRNWTELT4G2XWI4EMUDZIZLQC XAFFD52IHN6FWFR2TT5F2KCUS7HAVCBI5CWTFMKPQG77GGTGAHLAC 3XZOL3FFQZITUJIGDD6B6V6ZYMBN524JKNN6ZPJAXEC7RY433I3QC case DNGN_ENTER_ORCISH_MINES:which_branch = BRANCH_ORCISH_MINES;break;case DNGN_ENTER_HIVE:which_branch = BRANCH_HIVE;break;case DNGN_ENTER_LAIR:which_branch = BRANCH_LAIR;break;case DNGN_ENTER_SLIME_PITS:which_branch = BRANCH_SLIME_PITS;break;case DNGN_ENTER_VAULTS:which_branch = BRANCH_VAULTS;break;case DNGN_ENTER_CRYPT:which_branch = BRANCH_CRYPT;break;case DNGN_ENTER_HALL_OF_BLADES:which_branch = BRANCH_HALL_OF_BLADES;break;case DNGN_ENTER_ZOT:which_branch = BRANCH_HALL_OF_ZOT;break;case DNGN_ENTER_TEMPLE:which_branch = BRANCH_ECUMENICAL_TEMPLE;break;case DNGN_ENTER_SNAKE_PIT:which_branch = BRANCH_SNAKE_PIT;break;case DNGN_ENTER_ELVEN_HALLS:which_branch = BRANCH_ELVEN_HALLS;break;case DNGN_ENTER_TOMB:which_branch = BRANCH_TOMB;break;case DNGN_ENTER_SWAMP:which_branch = BRANCH_SWAMP;break;case DNGN_ENTER_DIS:which_branch = BRANCH_DIS;break;case DNGN_ENTER_GEHENNA:which_branch = BRANCH_GEHENNA;break;case DNGN_ENTER_COCYTUS:which_branch = BRANCH_COCYTUS;break;case DNGN_ENTER_TARTARUS:which_branch = BRANCH_TARTARUS;break;default:break;
if ( branches[i].entry_stairs == which_staircase ){stair_level[branches[i].id] = level_id::current();break;}
branches[BRANCH_SWAMP].startdepth = random_range(2, 7);
if ( coinflip() ){branches[BRANCH_SWAMP].startdepth = random_range(2, 7);branches[BRANCH_ISLANDS].startdepth = -1;}else{branches[BRANCH_SWAMP].startdepth = -1;branches[BRANCH_ISLANDS].startdepth = random_range(2, 7);}
case MONS_CENTAUR:case MONS_ETTIN:case MONS_SHEEP:mlev++;break;case MONS_CENTAUR_WARRIOR:case MONS_CYCLOPS: // will have a sheep bandcase MONS_YAKTAUR:mlev += 2;break;case MONS_STONE_GIANT:case MONS_YAKTAUR_CAPTAIN:case MONS_OKLOB_PLANT:mlev += 4;break;default:mlev += 99;}return mlev;}int mons_islands_rare(int mcls){switch (mcls){case MONS_PLANT:return 150;case MONS_ETTIN:case MONS_CENTAUR:return 50;case MONS_SHEEP:case MONS_BUTTERFLY:case MONS_YAKTAUR:return 35;case MONS_CYCLOPS:case MONS_CENTAUR_WARRIOR:return 20;case MONS_STONE_GIANT:case MONS_YAKTAUR_CAPTAIN:return 10;case MONS_OKLOB_PLANT:return 5;default:return 0;}}
int i, j; // loop variablesint temp_rand; // probability determination {dlb}
for (int i = std::max(x-a,margin); i <= std::min(x+a,GXM-margin); ++i)for (int j = std::max(y-b,margin); j <= std::min(y+b, GYM-margin); ++j)if ( (x-i)*(x-i)*b*b + (y-j)*(y-j)*a*a <=a*a*b*b/2 + roll_dice(2, a*a*b*b)/4 + random2(3) )grd[i][j] = feat;}// count how many neighbours of grd[x][y] are the feature feat.static int count_neighbours(int x, int y, int feat){int result = 0;for ( int i = -1; i <= 1; ++i )for ( int j = -1; j <= 1; ++j )if ( grd[x+i][y+j] == feat )++result;return result;}static void prepare_islands(){// dpeg's algorithm.// We could have just used spotty_level() and changed rock to// water, but this is much cooler. Right?const int margin = 6;coord_def centres[10];// It seems very difficult to get these numbers right, so I'm// fixing them for now.// const int estradius = std::max(50 - num_islands*10, 10);// const int num_islands = std::min(player_branch_depth(), 10);const int num_islands = 4;const int estradius = 12;for (int x = margin; x < GXM-margin; ++x)for (int y = margin; y < GYM-margin; ++y)grd[x][y] = DNGN_DEEP_WATER;for (int i = 0; i < num_islands; ++i){// smaller axisint b = (2 * estradius + roll_dice(3, estradius)) / 4;b = std::max(b,4);b = std::min(b, (GYM - margin) / 2);int a = b + roll_dice(2,b)/3; // more wide than talla = std::min(a, (GXM - margin) / 2);int island_distance = estradius*estradius * (2 + num_islands/3);bool centre_ok;do{centre_ok = true;centres[i].x = a + random2(GXM-2*a-1);centres[i].y = b + random2(GYM-2*b-1);for (int j = 0; j < i; ++j){// calculate the distance from the centers of// previous islandsif ( distance(centres[i].x, centres[i].y,centres[j].x, centres[j].y) < island_distance ){centre_ok = false;break;}}if ( random2(num_islands) && island_distance )--island_distance;} while ( !centre_ok );// place an ellipse around the new coordinateplace_ellipse( centres[i].x, centres[i].y, a, b, DNGN_FLOOR, margin);}// Adding shallow water at deep water adjacent to floor.// Randomisation: place shallow water if at least 1d(1d3) floor neighboursfor ( int i = margin; i < GXM - margin; ++i)for ( int j = margin; j < GYM - margin; ++j)if (grd[i][j] == DNGN_DEEP_WATER &&count_neighbours(i, j, DNGN_FLOOR) > random2(random2(3)+1))grd[i][j] = DNGN_SHALLOW_WATER;// Placing sandbanksfor (int banks = 0; banks < 8; ++banks){int xsize = 3+random2(3); // random rectangleint ysize = 3+random2(3);int xb = random2(GXM - 2 * margin - 10) + margin + 2;int yb = random2(GYM - 2 * margin - 10) + margin + 2;bool ok_place = true;for ( int i = xb; i < xb + xsize; ++i )for ( int j = yb; j < yb + ysize; ++j )if ( grd[i][j] != DNGN_DEEP_WATER )ok_place = false;if (ok_place){for ( int i = xb; i < xb + xsize; ++i )for ( int j = yb; j < yb + ysize; ++j )if ( !one_chance_in(3) )grd[i][j] = DNGN_SHALLOW_WATER;}}
// XXX TODO: fractalisation// Place stairs randomly. No elevators.for ( int i = 0; i < 3; ++i ){int x, y;do {x = random2(GXM);y = random2(GYM);} while ( grd[x][y] != DNGN_FLOOR );grd[x][y] = DNGN_STONE_STAIRS_DOWN_I + i;do {x = random2(GXM);y = random2(GYM);} while ( grd[x][y] != DNGN_FLOOR );grd[x][y] = DNGN_STONE_STAIRS_UP_I + i;}}static void prepare_swamp(){