-+-+-+-+-+-+-+-+ START OF PART 31 -+-+-+-+-+-+-+-+ X`09y := trunc(cur_height/2.0) + 11 - randint(23); X`09x := trunc(cur_width/2.0) + 16 - randint(33); X end; X X X`09`7B Place a trap with a given displacement of point`09-RAK-`09`7D X procedure vault_trap(y,x,yd,xd,num : integer); X var X`09count,y1,x1,i1`09`09: integer; X`09flag`09`09`09: boolean; X begin X`09for i1 := 1 to num do X`09 begin X`09 flag := false; X`09 count := 0; X`09 repeat X`09 y1 := y - yd - 1 + randint(2*yd+1); X`09 x1 := x - xd - 1 + randint(2*xd+1); X`09 with cave`5By1,x1`5D do X`09 if (fval in floor_set) then X`09 if (tptr = 0) then X`09`09 begin X`09`09 place_trap(y1,x1,1,randint(max_trapa)); X`09`09 flag := true; X`09`09 end; X`09 count := count + 1; X`09 until((flag) or (count > 5)); X`09 end; X end; X X X`09`7B Place a trap with a given displacement of point`09-RAK-`09`7D X procedure vault_monster(y,x,num : integer); X var X`09`09i1,y1,x1`09`09: integer; X begin X`09for i1 := 1 to num do X`09 begin X`09 y1 := y; X`09 x1 := x; X`09 summon_land_monster(y1,x1,true); X`09 end; X end; X X X`09`7B Builds a room at a row,column coordinate`09`09-RAK-`09`7D X procedure build_room(yval,xval : integer); X var X`09`09y_height,y_depth`09: integer; X`09`09x_left,x_right`09`09: integer; X`09`09i1,i2`09`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`09y_height := yval - randint(4); X`09y_depth := yval + randint(3); X`09x_left := xval - randint(11); X`09x_right := xval + randint(11); 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 cave`5Bi1,x_left-1`5D.fval := rock_wall1.ftval; X`09 cave`5Bi1,x_left-1`5D.fopen := rock_wall1.ftopen; X`09 cave`5Bi1,x_right+1`5D.fval := rock_wall1.ftval; X`09 cave`5Bi1,x_right+1`5D.fopen := rock_wall1.ftopen; X`09 end; X`09for i1 := x_left to x_right do X`09 begin 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 end; X X X`09`7B Builds a room at a row,column coordinate`09`09-RAK-`09`7D X`09`7B Type 1 unusual rooms are several overlapping rectangular ones`09`7D X procedure build_type1(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`09for i0 := 1 to (1 + randint(2)) do X`09 begin X`09 y_height := yval - randint(4); X`09 y_depth := yval + randint(3); X`09 x_left := xval - randint(11); X`09 x_right := xval + randint(11); X`09 for i1 := y_height to y_depth do X`09 for i2 := x_left to x_right do X`09`09begin X`09`09 cave`5Bi1,i2`5D.fval := cur_floor.ftval; X`09`09 cave`5Bi1,i2`5D.fopen := cur_floor.ftopen; X`09`09end; X`09 for i1 := (y_height - 1) to (y_depth + 1) do X`09 begin X`09`09with cave`5Bi1,x_left-1`5D do X`09`09 if (fval <> cur_floor.ftval) then X`09`09 begin X`09`09 fval := rock_wall1.ftval; X`09`09 fopen := rock_wall1.ftopen; X`09`09 end; X`09`09with cave`5Bi1,x_right+1`5D do X`09`09 if (fval <> cur_floor.ftval) then X`09`09 begin X`09`09 fval := rock_wall1.ftval; X`09`09 fopen := rock_wall1.ftopen; X`09`09 end; X`09 end; X`09 for i1 := x_left to x_right do X`09 begin X`09`09with cave`5By_height-1,i1`5D do X`09`09 if (fval <> cur_floor.ftval) then X`09`09 begin X`09`09 fval := rock_wall1.ftval; X`09`09 fopen := rock_wall1.ftopen; X`09`09 end; X`09`09with cave`5By_depth+1,i1`5D do X`09`09 if (fval <> cur_floor.ftval) then X`09`09 begin X`09`09 fval := rock_wall1.ftval; X`09`09 fopen := rock_wall1.ftopen; X`09`09 end; X`09 end; X`09 end; X end; X X X`09`7B Builds an unusual room at a row,column coordinate`09-RAK-`09`7D X`09`7B Type 2 unusual rooms all have an inner room:`09`09`09`7D X`09`7B 1 - Just an inner room with one door`09`09`09`7D X`09`7B 2 - An inner room within an inner room`09`09`09`7D X`09`7B 3 - An inner room with pillar(s)`09`09`09`09`7D X`09`7B 4 - Inner room has a maze`09`09`09`09`09`7D X`09`7B 5 - A set of four inner rooms`09`09`09`09`7D X procedure build_type2(yval,xval : integer); X var X`09`09y_height,y_depth`09: integer; X`09`09x_left,x_right`09`09: integer; X`09`09i1,i2`09`09`09: integer; X`09`09cur_floor`09`09: floor_type; X begin X`09if (dun_level <= randint(30)) 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`09y_height := yval - 4; X`09y_depth := yval + 4; X`09x_left := xval - 11; X`09x_right := xval + 11; 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 cave`5Bi1,x_left-1`5D.fval := rock_wall1.ftval; X`09 cave`5Bi1,x_left-1`5D.fopen := rock_wall1.ftopen; X`09 cave`5Bi1,x_right+1`5D.fval := rock_wall1.ftval; X`09 cave`5Bi1,x_right+1`5D.fopen := rock_wall1.ftopen; X`09 end; X`09for i1 := x_left to x_right do X`09 begin 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_a_staircase(yval,xval,up_staircase); X`09`09 2 : place_a_staircase(yval,xval,down_staircase); 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; +-+-+-+-+-+-+-+- END OF PART 31 +-+-+-+-+-+-+-+-