-+-+-+-+-+-+-+-+ START OF PART 25 -+-+-+-+-+-+-+-+ X`09 cave`5By_height-1,i1`5D.fval := rock_wall1.ftval; X`09 cave`5By_height-1,i1`5D.fopen := rock_wall1.ftopen; X`09 cave`5By_depth+1,i1`5D.fval := rock_wall1.ftval; X`09 cave`5By_depth+1,i1`5D.fopen := rock_wall1.ftopen; X`09 end; X`09`7B The inner room`09`09`7D X`09y_height := y_height + 2; X`09y_depth := y_depth - 2; X`09x_left := x_left + 2; X`09x_right := x_right - 2; X`09for i1 := (y_height - 1) to (y_depth + 1) do X`09 begin X`09 cave`5Bi1,x_left-1`5D.fval := 8; X`09 cave`5Bi1,x_right+1`5D.fval := 8; X`09 end; X`09for i1 := x_left to x_right do X`09 begin X`09 cave`5By_height-1,i1`5D.fval := 8; X`09 cave`5By_depth+1,i1`5D.fval := 8; X`09 end; X`09`7B Inner room varitions`09`09`7D X`09case randint(5) of X`09 1 :`09begin`09`7B Just an inner room...`09`7D X`09`09 case randint(4) of`09`7B Place a door`09`7D X`09`09 1 :`09place_secret_door(y_height-1,xval); X`09`09 2 :`09place_secret_door(y_depth+1,xval); X`09`09 3 :`09place_secret_door(yval,x_left-1); X`09`09 4 :`09place_secret_door(yval,x_right+1); X`09`09 end; X`09`09 vault_monster(yval,xval,1); X`09`09end; X`09 2 :`09begin`09`7B Treasure Vault`09`7D X`09`09 case randint(4) of`09`7B Place a door`09`7D X`09`09 1 :`09place_secret_door(y_height-1,xval); X`09`09 2 :`09place_secret_door(y_depth+1,xval); X`09`09 3 :`09place_secret_door(yval,x_left-1); X`09`09 4 :`09place_secret_door(yval,x_right+1); X`09`09 end; X`09`09 for i1 := yval-1 to yval+1 do X`09`09 begin X`09`09 cave`5Bi1,xval-1`5D.fval := 8; X`09`09 cave`5Bi1,xval+1`5D.fval := 8; X`09`09 end; X`09`09 cave`5Byval-1,xval`5D.fval := 8; X`09`09 cave`5Byval+1,xval`5D.fval := 8; X`09`09 case randint(4) of`09`7B Place a door`09`7D X`09`09 1 :`09place_locked_door(yval-1,xval); X`09`09 2 :`09place_locked_door(yval+1,xval); X`09`09 3 :`09place_locked_door(yval,xval-1); X`09`09 4 :`09place_locked_door(yval,xval+1); X`09`09 end; X`09`09`09`7B Place an object in the treasure vault`09`7D X`09`09 case randint(10) of X`09`09 1 : place_up_stairs(yval,xval); X`09`09 2 : place_down_stairs(yval,xval); X`09`09 otherwise place_object(yval,xval); X`09`09 end; X`09`09`09`7B Guard the treasure well`09`09`7D X`09`09 vault_monster(yval,xval,2+randint(3)); X`09`09`09`7B If the monsters don't get 'em...`09`7D X`09`09 vault_trap(yval,xval,4,10,2+randint(3)); X`09`09end; X`09 3 :`09begin`09`7B Inner pillar(s)...`09`7D X`09`09 case randint(4) of`09`7B Place a door`09`7D X`09`09 1 :`09place_secret_door(y_height-1,xval); X`09`09 2 :`09place_secret_door(y_depth+1,xval); X`09`09 3 :`09place_secret_door(yval,x_left-1); X`09`09 4 :`09place_secret_door(yval,x_right+1); X`09`09 end; X`09`09 for i1 := yval-1 to yval+1 do X`09`09 for i2 := xval-1 to xval+1 do X`09`09 cave`5Bi1,i2`5D.fval := 8; X`09`09 if (randint(2) = 1) then X`09`09 begin X`09`09 case randint(2) of X`09`09 1 : begin X`09`09 for i1 := yval-1 to yval+1 do X`09`09`09 for i2 := xval-6 to xval-4 do X`09`09`09 cave`5Bi1,i2`5D.fval := 8; X`09`09 for i1 := yval-1 to yval+1 do X`09`09`09 for i2 := xval+4 to xval+6 do X`09`09`09 cave`5Bi1,i2`5D.fval := 8; X`09`09 end; X`09`09 2 : begin X`09`09 for i1 := yval-1 to yval+1 do X`09`09`09 for i2 := xval-7 to xval-5 do X`09`09`09 cave`5Bi1,i2`5D.fval := 8; X`09`09 for i1 := yval-1 to yval+1 do X`09`09`09 for i2 := xval+5 to xval+7 do X`09`09`09 cave`5Bi1,i2`5D.fval := 8; X`09`09 end; X`09`09 end; X`09`09 if (randint(3) = 1) then`09`7B Inner rooms`09`7D X`09`09`09begin X`09`09`09 for i1 := xval-5 to xval+5 do X`09`09`09 begin X`09`09`09 cave`5Byval-1,i1`5D.fval := 8; X`09`09`09 cave`5Byval+1,i1`5D.fval := 8; X`09`09`09 end; X`09`09`09 case randint(2) of X`09`09`09 1 : place_secret_door(yval+1,xval-3); X`09`09`09 2 : place_secret_door(yval-1,xval-3); X`09`09`09 end; X`09`09`09 case randint(2) of X`09`09`09 1 : place_secret_door(yval+1,xval+3); X`09`09`09 2 : place_secret_door(yval-1,xval+3); X`09`09`09 end; X`09`09`09 if (randint(3) = 1) then place_object(yval,xval-2); X`09`09`09 if (randint(3) = 1) then place_object(yval,xval+2); X`09`09`09 vault_monster(yval,xval-2,randint(2)); X`09`09`09 vault_monster(yval,xval+2,randint(2)); X`09`09`09end; X`09`09 end; X`09`09end; X`09 4 :`09begin`09`7B Maze inside...`09`7D X`09`09 case randint(4) of`09`7B Place a door`09`7D X`09`09 1 :`09place_secret_door(y_height-1,xval); X`09`09 2 :`09place_secret_door(y_depth+1,xval); X`09`09 3 :`09place_secret_door(yval,x_left-1); X`09`09 4 :`09place_secret_door(yval,x_right+1); X`09`09 end; X`09`09 for i1 := y_height to y_depth do X`09`09 for i2 := x_left to x_right do X`09`09 if (odd(i2+i1)) then X`09`09`09cave`5Bi1,i2`5D.fval := 8; X`09`09`7B Monsters just love mazes...`09`09`7D X`09`09 vault_monster(yval,xval-5,randint(3)); X`09`09 vault_monster(yval,xval+5,randint(3)); X`09`09`7B Traps make them entertaining...`09`7D X`09`09 vault_trap(yval,xval-3,2,8,randint(3)); X`09`09 vault_trap(yval,xval+3,2,8,randint(3)); X`09`09`7B Mazes should have some treasure too..`09`7D X`09`09 for i1 := 1 to 3 do X`09`09 random_object(yval,xval,1); X`09`09end; X`09 5 :`09begin`09`7B Four small rooms...`09`7D X`09`09 for i1 := y_height to y_depth do X`09`09 cave`5Bi1,xval`5D.fval := 8; X`09`09 for i1 := x_left to x_right do X`09`09 cave`5Byval,i1`5D.fval := 8; X`09`09 case randint(2) of X`09`09 1 :`09begin X`09`09`09 i1 := randint(10); X`09`09`09 place_secret_door(y_height-1,xval-i1); X`09`09`09 place_secret_door(y_height-1,xval+i1); X`09`09`09 place_secret_door(y_depth+1,xval-i1); X`09`09`09 place_secret_door(y_depth+1,xval+i1); X`09`09`09end; X`09`09 2 :`09begin X`09`09`09 i1 := randint(3); X`09`09`09 place_secret_door(yval+i1,x_left-1); X`09`09`09 place_secret_door(yval-i1,x_left-1); X`09`09`09 place_secret_door(yval+i1,x_right+1); X`09`09`09 place_secret_door(yval-i1,x_right+1); X`09`09`09end; X`09`09 end; X`09`09`7B Treasure in each one...`09`09`7D X`09`09 random_object(yval,xval,2+randint(2)); X`09`09`7B Gotta have some monsters...`09`09`7D X`09`09 vault_monster(yval+2,xval-4,randint(2)); X`09`09 vault_monster(yval+2,xval+4,randint(2)); X`09`09 vault_monster(yval-2,xval-4,randint(2)); X`09`09 vault_monster(yval-2,xval+4,randint(2)); X`09`09end; X`09end; X end; X X X`09`7B Builds a room at a row,column coordinate`09`09-RAK-`09`7D X`09`7B Type 3 unusual rooms are cross shaped`09`09`09`09`7D X procedure build_type3(yval,xval : integer); X var X`09`09y_height,y_depth`09: integer; X`09`09x_left,x_right`09`09: integer; X`09`09i0,i1,i2`09`09: integer; X`09`09cur_floor`09`09: floor_type; X begin X`09if (dun_level <= randint(25)) then X`09 cur_floor := lopen_floor`09`7B Floor with light`09`7D X`09else X`09 cur_floor := dopen_floor;`09`7B Dark floor`09`09`7D X`09i0 := 2 + randint(2); X`09y_height := yval - i0; X`09y_depth := yval + i0; X`09x_left := xval - 1; X`09x_right := xval + 1; X`09for i1 := y_height to y_depth do X`09 for i2 := x_left to x_right do X`09 begin X`09 cave`5Bi1,i2`5D.fval := cur_floor.ftval; X`09 cave`5Bi1,i2`5D.fopen := cur_floor.ftopen; X`09 end; X`09for i1 := (y_height - 1) to (y_depth + 1) do X`09 begin X`09 with cave`5Bi1,x_left-1`5D do X`09 begin X`09`09fval := rock_wall1.ftval; X`09`09fopen := rock_wall1.ftopen; X`09 end; X`09 with cave`5Bi1,x_right+1`5D do X`09 begin X`09`09fval := rock_wall1.ftval; X`09`09fopen := rock_wall1.ftopen; X`09 end; X`09 end; X`09for i1 := x_left to x_right do X`09 begin X`09 with cave`5By_height-1,i1`5D do X`09 begin X`09`09fval := rock_wall1.ftval; X`09`09fopen := rock_wall1.ftopen; X`09 end; X`09 with cave`5By_depth+1,i1`5D do X`09 begin X`09`09fval := rock_wall1.ftval; X`09`09fopen := rock_wall1.ftopen; X`09 end; X`09 end; X`09i0 := 2 + randint(9); X`09y_height := yval - 1; X`09y_depth := yval + 1; X`09x_left := xval - i0; X`09x_right := xval + i0; X`09for i1 := y_height to y_depth do X`09 for i2 := x_left to x_right do X`09 begin X`09 cave`5Bi1,i2`5D.fval := cur_floor.ftval; X`09 cave`5Bi1,i2`5D.fopen := cur_floor.ftopen; X`09 end; X`09for i1 := (y_height - 1) to (y_depth + 1) do X`09 begin X`09 with cave`5Bi1,x_left-1`5D do X`09 if (fval <> cur_floor.ftval) then X`09`09begin X`09`09 fval := rock_wall1.ftval; X`09`09 fopen := rock_wall1.ftopen; X`09`09end; X`09 with cave`5Bi1,x_right+1`5D do X`09 if (fval <> cur_floor.ftval) then X`09`09begin X`09`09 fval := rock_wall1.ftval; X`09`09 fopen := rock_wall1.ftopen; X`09`09end; X`09 end; X`09for i1 := x_left to x_right do X`09 begin X`09 with cave`5By_height-1,i1`5D do X`09 if (fval <> cur_floor.ftval) then X`09`09begin X`09`09 fval := rock_wall1.ftval; X`09`09 fopen := rock_wall1.ftopen; X`09`09end; X`09 with cave`5By_depth+1,i1`5D do X`09 if (fval <> cur_floor.ftval) then X`09`09begin X`09`09 fval := rock_wall1.ftval; X`09`09 fopen := rock_wall1.ftopen; X`09`09end; X`09 end; X`09`7B Special features...`09`09`09`7D X`09case randint(4) of X`09 1 :`09begin`09`7B Large middle pillar`09`09`7D X`09`09 for i1 := yval-1 to yval+1 do X`09`09 for i2 := xval-1 to xval+1 do X`09`09 cave`5Bi1,i2`5D.fval := 8; X`09`09end; X`09 2 :`09begin`09`7B Inner treasure vault`09`09`7D X`09`09 for i1 := yval-1 to yval+1 do X`09`09 begin X`09`09 cave`5Bi1,xval-1`5D.fval := 8; X`09`09 cave`5Bi1,xval+1`5D.fval := 8; X`09`09 end; X`09`09 cave`5Byval-1,xval`5D.fval := 8; X`09`09 cave`5Byval+1,xval`5D.fval := 8; X`09`09 case randint(4) of`09`7B Place a door`09`7D X`09`09 1 :`09place_secret_door(yval-1,xval); X`09`09 2 :`09place_secret_door(yval+1,xval); X`09`09 3 :`09place_secret_door(yval,xval-1); X`09`09 4 :`09place_secret_door(yval,xval+1); X`09`09 end; X`09`09`7B Place a treasure in the vault`09`09`7D X`09`09 place_object(yval,xval); X`09`09`7B Let's gaurd the treasure well...`09`7D X`09`09 vault_monster(yval,xval,2+randint(2)); X`09`09`7B Traps naturally`09`09`09`7D X`09`09 vault_trap(yval,xval,4,4,1+randint(3)); X`09`09end; X`09 3 :`09begin X`09`09 if (randint(3) = 1) then X`09`09 begin X`09`09 cave`5Byval-1,xval-2`5D.fval := 8; X`09`09 cave`5Byval+1,xval-2`5D.fval := 8; X`09`09 cave`5Byval-1,xval+2`5D.fval := 8; X`09`09 cave`5Byval-1,xval+2`5D.fval := 8; X`09`09 cave`5Byval-2,xval-1`5D.fval := 8; X`09`09 cave`5Byval-2,xval+1`5D.fval := 8; X`09`09 cave`5Byval+2,xval-1`5D.fval := 8; X`09`09 cave`5Byval+2,xval+1`5D.fval := 8; X`09`09 if (randint(3) = 1) then X`09`09`09begin X`09`09`09 place_secret_door(yval,xval-2); X`09`09`09 place_secret_door(yval,xval+2); X`09`09`09 place_secret_door(yval-2,xval); X`09`09`09 place_secret_door(yval+2,xval); X`09`09`09end; X`09`09 end X`09`09 else if (randint(3) = 1) then X`09`09 begin X`09`09 cave`5Byval,xval`5D.fval := 8; X`09`09 cave`5Byval-1,xval`5D.fval := 8; X`09`09 cave`5Byval+1,xval`5D.fval := 8; X`09`09 cave`5Byval,xval-1`5D.fval := 8; X`09`09 cave`5Byval,xval+1`5D.fval := 8; X`09`09 end X`09`09 else if (randint(3) = 1) then X`09`09 cave`5Byval,xval`5D.fval := 8; X`09`09end; X`09 4 :`09; X`09end; X end; X X X`09`7B Constructs a tunnel between two points`09`09`7D X procedure tunnel(row1,col1,row2,col2 : integer); X var X`09tmp_row,tmp_col`09`09: integer; X`09row_dir,col_dir `09: integer; X`09i1,i2,tmp`09`09: integer; X`09tunstk`09`09`09: array `5B1..1000`5D of coords; X`09wallstk`09`09`09: array `5B1..1000`5D of coords; X`09tunptr`09`09`09: integer; X`09wallptr`09`09`09: integer; X`09stop_flag,door_flag`09: boolean; X X X`09`7B Main procedure for Tunnel`09`09`09`7D X`09`7B Note: 9 is a temporary value`09`09`7D X begin X`09stop_flag := false; X`09door_flag := false; X`09tunptr := 0; X`09wallptr := 0; X`09correct_dir(row_dir,col_dir,row1,col1,row2,col2); X`09repeat X`09 if (randint(100) > dun_tun_chg) then X`09 rand_dir(row_dir,col_dir,row1,col1,row2,col2,dun_tun_rnd); X`09 tmp_row := row1 + row_dir; X`09 tmp_col := col1 + col_dir; X`09 while (not(in_bounds(tmp_row,tmp_col))) do X`09 begin X`09 rand_dir(row_dir,col_dir,row1,col1,row2,col2,dun_tun_rnd); X`09 tmp_row := row1 + row_dir; X`09 tmp_col := col1 + col_dir; X`09 end; X`09 with cave`5Btmp_row,tmp_col`5D do X`09 if (fval = rock_wall1.ftval) then X`09 begin X`09`09row1 := tmp_row; X`09`09col1 := tmp_col; X`09`09if (wallptr < 1000) then X`09`09 wallptr := wallptr + 1; X`09`09wallstk`5Bwallptr`5D.y := row1; X`09`09wallstk`5Bwallptr`5D.x := col1; X`09`09for i1 := row1-1 to row1+1 do X`09`09 for i2 := col1-1 to col1+1 do X`09`09 if (in_bounds(i1,i2)) then X`09`09 with cave`5Bi1,i2`5D do X`09`09`09if (fval in wall_set) then X`09`09`09 fval := 9; X`09 end X`09 else if (fval = corr_floor1.ftval) then X`09 begin X`09`09row1 := tmp_row; X`09`09col1 := tmp_col; X`09`09if (not(door_flag)) then X`09`09 begin X`09`09 if (doorptr <= 100) then X`09`09 begin X`09`09`09doorptr := doorptr + 1; X`09`09`09doorstk`5Bdoorptr`5D.y := row1; X`09`09`09doorstk`5Bdoorptr`5D.x := col1; X`09`09 end; X`09`09 door_flag := true; X`09`09 end; X`09`09if (randint(100) > dun_tun_con) then X`09`09 stop_flag := true; X`09 end X`09 else if (fval = 0) then X`09 begin X`09`09row1 := tmp_row; X`09`09col1 := tmp_col; X`09`09if (tunptr < 1000) then X`09`09 tunptr := tunptr + 1; X`09`09tunstk`5Btunptr`5D.y := row1; X`09`09tunstk`5Btunptr`5D.x := col1; X`09`09door_flag := false; X`09 end X`09 else if (fval <> 9) then X`09 begin X`09`09row1 := tmp_row; X`09`09col1 := tmp_col; X`09 end; X`09until (((row1 = row2) and (col1 = col2)) or (stop_flag)); X`09for i1 := 1 to tunptr do X`09 begin X`09 cave`5Btunstk`5Bi1`5D.y,tunstk`5Bi1`5D.x`5D.fval := corr_floor1.ftva Vl; X`09 cave`5Btunstk`5Bi1`5D.y,tunstk`5Bi1`5D.x`5D.fopen := corr_floor1.ftop Ven; X`09 end; X`09for i1 := 1 to wallptr do X`09 with cave`5Bwallstk`5Bi1`5D.y,wallstk`5Bi1`5D.x`5D do +-+-+-+-+-+-+-+- END OF PART 25 +-+-+-+-+-+-+-+-