-+-+-+-+-+-+-+-+ START OF PART 37 -+-+-+-+-+-+-+-+ X`09`09 cave`5Bi1,i2`5D.fval := rock_wall1.ftval; X`09`09`09 cave`5Bi1,i2`5D.fopen := rock_wall1.ftopen; X`09`09 end X`09`09 else X`09`09 cave`5Bi1,i2`5D.fval := lopen_floor.ftval; X`09`09 end; X`09 End; X X`09 2: Begin X`09 for i1 := 1 to cur_height do X`09 for i2 := 1 to cur_width do X`09`09 begin X`09`09 cave`5Bi1,i2`5D.fval := dopen_floor.ftval; X`09`09 cave`5Bi1,i2`5D.fopen := dopen_floor.ftopen; X`09`09 if (randint(10) > 3) then `7Bmake dungeon 70% lit`7D X`09`09 cave`5Bi1,i2`5D.pl := true; X`09`09 end;`09 `20 X`09 for i1 := 1 to 90 do X`09 begin X`09`09 ry := randint(cur_height-2)+1;`09 X`09`09 rx := randint(cur_width-2)+1; X`09`09 for i2 := 1 to 60 do X`09`09 begin`09 `09`09 `09`20 X`09`09 rand_dir(row_dir,col_dir,0,0,0,0,4); X`09`09 if in_bounds(ry+row_dir,rx+col_dir) then X`09`09 begin X `09`09 ry := ry + row_dir; X `09`09 rx := rx + col_dir; X`09`09 cave`5Bry,rx`5D.fval := rock_wall2.ftval; X`09`09 cave`5Bry,rx`5D.fopen := rock_wall2.ftopen; X`09`09 end; X`09`09 end;`09`09 `09`09 `20 X`09`09 end;`09`09 `20 X`09 End;`09 `20 X`09 3: Begin X`09 fill_cave(rock_wall3); X`09 for i1 := 1 to 300 do X`09 begin X`09`09 ry := randint(cur_height-2)+1;`09 X`09`09 rx := randint(cur_width-2)+1; X`09`09 for i2 := 1 to 60 do X`09`09 begin`09 `09`09 `09`20 X`09`09 rand_dir(row_dir,col_dir,0,0,0,0,4); X`09`09 if in_bounds(ry+row_dir,rx+col_dir) then X`09`09 begin X `09`09 ry := ry + row_dir; X `09`09 rx := rx + col_dir; X`09`09 cave`5Bry,rx`5D.fval := dopen_floor.ftval; X`09`09 cave`5Bry,rx`5D.fopen := dopen_floor.ftopen; X`09`09 end; X`09`09 end;`09`09 `09`09 `20 X`09`09 end;`09`09 `20 X`09 End;`09 `20 X`09end; `7Bcase`7D X place_boundry; X alloc_level := dun_power div 3; X if (alloc_level < 2) then X alloc_level := 2 X else if (alloc_level > 10) then X alloc_level := 10; X if (dun_level < townlist`5Btown_num`5D.max_depth) then X`09 place_stairs(2,randint(5)+5,3); X place_stairs(1,randint(5)+5,3); X alloc_monster(`5B1,2`5D,(randint(40)+min_malloc_level+alloc_level),0 V,true); X alloc_object(`5B1,2`5D,5,randnor(treas_room_alloc,3)); X alloc_object(`5B1,2`5D,5,randnor(treas_any_alloc,3)); X alloc_object(`5B1,2`5D,4,randnor(treas_gold_alloc,3)); X alloc_object(`5B1,2`5D,1,randint(alloc_level)); XEND; X X X`7BLogic Flow for special "Bottom of Cave" type.`7D`20 X procedure bottom_cave_gen; X X type X spot_type = record X ENDx : integer; X ENDy : integer; X END; X room_type = array `5B1..20,1..20`5D of boolean; X var X room_map : room_type; X i1,i2,i3,i4,y1,x1,y2,x2,pick1,pick2,row_rooms,col_rooms, X alloc_level,bx,by : integer; X yloc,xloc : array `5B1..400`5D of worlint; X BEGIN X seed := get_seed; X row_rooms := 2*trunc(cur_height/screen_height); X col_rooms := 2*trunc(cur_width /screen_width); X for i1 := 1 to row_rooms do X for i2 := 1 to col_rooms do X room_map`5Bi1,i2`5D := false; X for i1 := 1 to randnor(dun_roo_mea,2) do X room_map`5Brandint(row_rooms),randint(col_rooms)`5D := true; X i3 := 0; X for i1 := 1 to row_rooms do X for i2 := 1 to col_rooms do X if (room_map`5Bi1,i2`5D = true) then X BEGIN X i3 := i3 + 1; X yloc`5Bi3`5D := (i1-1)*(quart_height*2 + 1) + quart_height + V 1; X xloc`5Bi3`5D := (i2-1)*(quart_width*2 + 1) + quart_width + V 1; X CASE randint(5) of X 1 : build_type1(yloc`5Bi3`5D,xloc`5Bi3`5D); X 2 : build_type2(yloc`5Bi3`5D,xloc`5Bi3`5D); X 3 : build_type3(yloc`5Bi3`5D,xloc`5Bi3`5D); X 4 : build_type4(yloc`5Bi3`5D,xloc`5Bi3`5D); X 5 : build_type5(yloc`5Bi3`5D,xloc`5Bi3`5D); X END X END; X place_boundry;`09 `20 X for i1 := 1 to cur_height do X`09 for i2 := 1 to cur_width do X`09 with cave`5Bi1,i2`5D do X`09 if ((fval = rock_wall1.ftval) and (randint(10) = 1)) then X`09 place_secret_door(i1,i2) X`09 else if (fval = 0) then X`09 begin X`09 fval := dopen_floor.ftval; `7Btval=1`7D X`09`09 fopen := dopen_floor.ftopen; `20 X`09`09end X`09 else if (fval in `5B8,9`5D) then X`09 begin X`09 fval := rock_wall1.ftval; X`09`09 fopen := rock_wall1.ftopen; X`09`09end; X if (dun_level < townlist`5Btown_num`5D.max_depth) then X place_stairs(2,randint(3)+5,3); X place_stairs(1,randint(3)+5,3); X alloc_monster(`5B1`5D,(randint(20)+min_malloc_level),0,true); X if (dun_power = win_mon_appear) then X`09 if (not(is_boss_dead or out_of_time)) then`20 X`09 place_the_boss; X`09if ((dun_level = 10) and (not(defeated_badguy))) then X`09 place_badguy_monster(town_num); X END; X X`7B Town :: Builds a store at a row,column coordinate `7D X procedure build_store(store_num,y,x,num_in_row : integer); X var X yval,y_height,y_depth,xval,x_adjst,x_left,x_right,i1,i2,cur_pos : integ Ver; X BEGIN X yval := (y-1)*6 + 5; X xval := (x-1)*(40-6*num_in_row) + (21-3*num_in_row); X `7B this formula yields xval=(x-1)*22+11 if 3 stores in the row X and xval=(x-1)*16+8 for 4 stores in the row. `7D X x_adjst := 6 - (num_in_row - 3)*3; X y_height := yval - randint(2); X y_depth := yval + randint(2); X x_left := xval - 1 - randint(x_adjst); X x_right := xval + 1 + randint(x_adjst); X for i1 := y_height to y_depth do X for i2 := x_left to x_right do X BEGIN X cave`5Bi1,i2`5D.fval := boundry_wall.ftval; X cave`5Bi1,i2`5D.fopen := boundry_wall.ftopen; X END; X CASE randint(4) of `7B determines which wall and where to put the do Vor `7D X 1 : BEGIN X i1 := randint(y_depth-y_height) + y_height - 1; X i2 := x_left; X END; X 2 : BEGIN X i1 := randint(y_depth-y_height) + y_height - 1; X i2 := x_right; X END; X 3 : BEGIN X i1 := y_depth; X i2 := randint(x_right-x_left) + x_left - 1; X END; X 4 : BEGIN X i1 := y_height; X i2 := randint(x_right-x_left) + x_left - 1; X END; X END; X with cave`5Bi1,i2`5D do X BEGIN X fval := corr_floor3.ftval; X fopen := corr_floor3.ftopen; X popt(cur_pos); X tptr := cur_pos; X t_list`5Bcur_pos`5D := store_door`5Bstore_num`5D; X END; X END; X`20 X X`7B Town logic flow for generation of new town `7D X procedure town_gen; X type X room_type = array `5B1..3,1..3`5D of boolean; X var X y,x,i1,i2,i3,i4,i5 : integer; X rooms : array `5B1..max_doors`5D of integer; X`20 X BEGIN X seed := town_seed; X for i1 := 1 to max_doors do rooms`5Bi1`5D := i1; X i4 := max_doors; `7Bi4 is store counter`7D X for i1 := 1 to 3 do `7By value`7D X for i2 := 1 to 4 do `7Bx value`7D X BEGIN X i3 := randint(i4); X build_store(rooms`5Bi3`5D,i1,i2,4); `7B4 is number in row`7D X for i5 := i3 to i4-1 do rooms`5Bi5`5D := rooms`5Bi5+1`5D; X i4 := i4 - 1; X END; X fill_cave(dopen_floor); X place_boundry; X if ((turn < 4320) or (turn > 12960)) then X BEGIN `7BNight`7D X for i1 := 1 to cur_height do X for i2 := 1 to cur_width do X if (cave`5Bi1,i2`5D.fval <> dopen_floor.ftval) then X cave`5Bi1,i2`5D.pl := true; X place_stairs(2,3,0); X seed := get_seed; X alloc_monster(`5B1,2`5D,min_malloc_tn,3,true); X END X else X BEGIN `7B Day `7D X for i1 := 1 to cur_height do X for i2 := 1 to cur_width do X cave`5Bi1,i2`5D.pl := true; X place_stairs(2,3,0); X seed := get_seed; X alloc_monster(`5B1,2`5D,min_malloc_td,3,true); X END; X END; X X`7B Logic flow for generation of tall building `7D X procedure building_gen;`20 X X var`09 i1,i2,cur_pos `09: `09integer; X X X procedure place_building_door(spoty,spotx,door_num : integer); X X Begin X with cave`5Bspoty,spotx`5D do X begin X fval := corr_floor3.ftval; X fopen := corr_floor3.ftopen; X popt(cur_pos); X tptr := cur_pos; X t_list`5Bcur_pos`5D := building_door`5Bdoor_num`5D; X`09end X End; X X BEGIN X fill_cave(lopen_floor); X`09place_boundry;`09 X`09for i2 := 1 to 30 do X`09 with cave`5B5,i2`5D do X`09 begin X`09 fval := boundry_wall.ftval; X`09 fopen := boundry_wall.ftopen; X`09 end;`09 `20 X`09for i1 := 2 to 9 do X`09 begin X`09 for i2 := 2 to 7 do X`09 with cave`5Bi1,i2`5D do X`09 begin X`09`09 fval := boundry_wall.ftval; X`09`09 fopen := boundry_wall.ftopen; X`09`09end; X`09 for i2 := 23 to 29 do X`09 with cave`5Bi1,i2`5D do X`09 begin X`09`09 fval := boundry_wall.ftval; X`09`09 fopen := boundry_wall.ftopen; X`09`09end; X end; X place_building_door(7,7,1); `7BHotel`7D X place_building_door(7,23,2); `7BBank`7D X place_building_door(3,7,3); `7BClinic`7D X place_building_door(3,23,4); `7BNewsInc`7D X`09place_closed_door(5,15); X`09place_down_stairs(9,15); X`09char_row := 8; X`09char_col := 15; X END; X`20 X X`7BMain procedure`7D`20 X BEGIN X panel_row_min := 0; X panel_row_max := 0; X panel_col_min := 0; X panel_col_max := 0; X char_row := -1; X char_col := -1; X tlink; X mlink; X blank_cave; X`20 X if (dun_level < 0) then`20 X Begin X cur_height := 10; X cur_width := 30; X max_panel_rows := 0; X max_panel_cols := 0; X panel_row := max_panel_rows; X panel_col := max_panel_cols; X`09 dun_power := 0; X building_gen; X End X else if (dun_level = 0) then X BEGIN X cur_height := screen_height; X cur_width := screen_width; X max_panel_rows := trunc(cur_height/screen_height)*2 - 2; X max_panel_cols := trunc(cur_width /screen_width )*2 - 2; X panel_row := max_panel_rows; X panel_col := max_panel_cols; X`09 dun_power := 0; X town_gen; X`09 if (exited_office) then X`09 begin X`09 char_row := office_char_row; X`09 char_col := office_char_col; X`09 exited_office := false; X`09 end; X END X else X BEGIN X cur_height := max_height; X cur_width := max_width; X max_panel_rows := trunc(cur_height/screen_height)*2 - 2; X max_panel_cols := trunc(cur_width /screen_width )*2 - 2; X panel_row := max_panel_rows; X panel_col := max_panel_cols; X`09 dun_power := dun_level + townlist`5Btown_num`5D.lev_plus; X`09 case (dun_level mod 10) of X`09 0: bottom_cave_gen; X`09 5: special_cave_gen(1); X`09 3,8: special_cave_gen(2); X`09 2,7: special_cave_gen(3); X`09 otherwise cave_gen;`09`20 X`09 end; X END; X END; X X X X X $ CALL UNPACK [.INC]GENERATE.INC;1 894363187 $ create 'f' X`5Bpsect(misc2$code)`5D procedure ident_char; X var X command : char; X BEGIN X if (get_com('Enter character to be identified :',command)) then X case command of X ' ' : prt(' - An open pit.',1,1); X '!' : prt('! - A potion.',1,1); X '"' : prt('" - An amulet, periapt, or necklace.',1,1); X '#' : prt('# - A stone wall, or box.',1,1); X '$' : prt('$ - Treasure.',1,1); X '%' : prt('% - Computer.',1,1); X '&' : prt('& - Treasure chest.',1,1); X '''': prt(''' - An open door.',1,1); X '(' : prt('( - Soft armor.',1,1); X ')' : prt(') - A shield.',1,1); X '*' : prt('* - Grenade,or Treasure.',1,1);`20 X '+' : prt('+ - A closed door.',1,1); X ',' : prt(', - Food.',1,1); X '-' : prt('- - A ray gun',1,1); X '.' : prt('. - Floor.',1,1); X '/' : prt('/ - Sports Equipment.',1,1); X ':' : prt(': - Rubble.',1,1); X ';' : prt('; - A loose rock.',1,1); X '<' : prt('< - An up staircase.',1,1); X '=' : prt('= - A ring.',1,1); X '>' : prt('> - A down staircase.',1,1); X '?' : prt('? - A floppy disk.',1,1); X '0' : prt('0 - ???.',1,1); X '@' : prt(py.misc.name,1,1); X 'A' : prt('A - Alien Daysians.',1,1); X 'B' : prt('B - The Boss.',1,1); X 'C' : prt('C - Acidic Cubes.',1,1); X 'D' : prt('D - Droids.',1,1); X 'E' : prt('E - Evil Things.',1,1); X 'F' : prt('F - Flayers.',1,1); X 'G' : prt('G - Guards.',1,1); X 'H' : prt('H - Hounds or Horses.',1,1); X 'I' : prt('I - Insane Lads.',1,1); X 'J' : prt('J - Jarwangian Molds.',1,1); X `7B'K' : prt('K - ???.',1,1);`7D X 'L' : prt('L - ???.',1,1); X 'M' : prt('M - Mutants.',1,1); X `7B'N' : prt('N - Negative Beings.',1,1);`7D X 'O' : prt('O - Oozes.',1,1); X 'P' : prt('P - Giant/Powerful humanoids.',1,1); X `7B'Q' : prt('Q - ???.',1,1);`7D X 'R' : prt('R - Robots.',1,1); X 'S' : prt('S - ???.',1,1); X 'T' : prt('T - ???.',1,1); X 'U' : prt('U - ???.',1,1); X 'V' : prt('V - Vortexes.',1,1); X 'W' : prt('W - Warbots.',1,1); +-+-+-+-+-+-+-+- END OF PART 37 +-+-+-+-+-+-+-+-