-+-+-+-+-+-+-+-+ START OF PART 65 -+-+-+-+-+-+-+-+ X csleep := 500 X END X`7Bcan't (quite) sleep`7D else X`7Bgive small chance`7D if ( randint(20) > 18 ) then X BEGIN X if ( rad > 5 ) then X`7Blet 'em guess for sleep III`7D prt('',1,1) X else X msg_print('The ' + name + ' goes into dreamlan Vd.'); X sleep_monsters2_3 := true; X`7Bbetter than none!`7D csleep := 13 + randint(7) X END X else X if ( rad > 5 ) then X prt('',1,1) X else X msg_print('The ' + name + ' is unaffected.') X END; X`20 X`7B Detect any treasures on the current panel `7D X`5Bpsect(misc6$code)`5D function detect_treasure : boolean; X VAR `20 X i1,i2 : integer; X BEGIN X detect_treasure := false; X for i1 := panel_row_min to panel_row_max do X for i2 := panel_col_min to panel_col_max do X with cave`5Bi1,i2`5D do X if (tptr > 0) then X if (t_list`5Btptr`5D.tval = 100) then X if (not (test_light(i1,i2))) then X BEGIN X lite_spot(i1,i2); X tl := true; X detect_treasure := true X END X END; X`20 X`7B Detect all objects on the current panel `7D X`5Bpsect(misc6$code)`5D function detect_object : boolean; X VAR X i1,i2 : integer; X BEGIN X detect_object := false; X for i1 := panel_row_min to panel_row_max do X for i2 := panel_col_min to panel_col_max do X with cave`5Bi1,i2`5D do X if (tptr > 0) then X if (t_list`5Btptr`5D.tval < 100) then X if (not (test_light(i1,i2))) then X BEGIN X lite_spot(i1,i2); X tl := true; X detect_object := true X END X END; X`20 X`7B Locates and displays traps on current panel `7D X`5Bpsect(misc6$code)`5D function detect_trap : boolean; X VAR X i1,i2 : integer; X BEGIN X detect_trap := false; X for i1 := panel_row_min to panel_row_max do X for i2 := panel_col_min to panel_col_max do X with cave`5Bi1,i2`5D do X if (tptr > 0) then X if (t_list`5Btptr`5D.tval = 101) then X BEGIN X change_trap(i1,i2); X fm := true; X detect_trap := true X END X else if (t_list`5Btptr`5D.tval = 2) then X with t_list`5Btptr`5D do X known2(name) X END; X`20 X`7B Locates and displays all secret doors on current panel `7D X`5Bpsect(misc6$code)`5D function detect_sdoor : boolean; `20 X VAR X i1,i2 : integer; X BEGIN X detect_sdoor := false; X for i1 := panel_row_min to panel_row_max do X for i2 := panel_col_min to panel_col_max do X with cave`5Bi1,i2`5D do X if (tptr > 0) then X`7B Secret doors `7D X if (t_list`5Btptr`5D.tval = 109) then X BEGIN X fval := corr_floor3.ftval; X change_trap(i1,i2); X fm := true; X detect_sdoor := true X END X`7B staircases `7D else if (t_list`5Btptr`5D.tval in `5B107,108`5D) then X if (not(fm)) then X BEGIN X fm := true; X lite_spot(i1,i2); X detect_sdoor := true X END X END; X `20 X`7B Locates and displays all invisible creatures on current panel `7D X`5Bpsect(misc6$code)`5D function detect_invisible : boolean; X VAR X i1 : integer; X dummy : char; X flag : boolean; X BEGIN `20 X flag := false; X i1 := muptr; X repeat X with m_list`5Bi1`5D do X if (panel_contains(fy,fx)) then X if (uand(%X'10000',c_list`5Bmptr`5D.cmove) <> 0) then X BEGIN X ml := true; X print(c_list`5Bmptr`5D.cchar,fy,fx); X flag := true X END; X i1 := m_list`5Bi1`5D.nptr; X until(i1 = 0); X if (flag) then X BEGIN X msg_print('You sense the presence of invisible creatures!'); X msg_print(' '); X msg_flag := false X END; X detect_invisible := flag X END; X`7B lights/darkens a circular area around the `5By,x`5D of radius r. --jeb` V7D X`5Bpsect(misc6$code)`5D procedure make_light(y,x,r : integer; light : boolea Vn); X X var d,ty,tx : real; `7Bd = distance, ty,tx=temp real x,y`7D X`09 i1,i2`09 : integer; `7Bi1,i2 = cave co-ordinates`7D X`09 row,col : integer; X`09 sym_char : char; X`09 temp_char : dtype; X`09 `20 X BEGIN X ty := 1.0*y; X`09tx := 1.0*x; X for i1 := y-r to y+r do X`09 for i2 := x-2*r to x+2*r do X`09 if (in_bounds(i1,i2)) then X`09 begin X`09 d := sqrt(sqr(1.0*i1-ty)+sqr(0.7*(1.0*i2-tx))); `20 X`09 if ((trunc(d) <= r) and`20 X`09 (cave`5Bi1,i2`5D.fval in (pwall_set+floor_set))) then X`09 begin X`09 cave`5Bi1,i2`5D.pl := light; X`09`09 row := i1 - panel_row_prt; `7Bconvert `5Bi1,i2`5D to screen pos`7 VD X`09`09 col := i2 - panel_col_prt; X`09`09 if ((row in `5B2..23`5D) and (col in `5B15..80`5D)) then`20 X`09`09 begin X`09`09 if (light) then X`09`09 loc_symbol(i1,i2,sym_char) X`09`09`09else X`09`09`09 sym_char := ' '; X`09`09`09used_line`5Brow`5D := true; X`09`09`09temp_char := sym_char;`20 X`09`09`09put_buffer(temp_char,row,col); X`09`09 end; X`09 `09 end; X`09 end; X END; X X`7B Light an area: 1. If corridor then light immediate area X 2. If room then light entire room. `7D X`5Bpsect(misc6$code)`5D function light_area(y,x : integer) : boolean; X VAR X i1,i2 `09`09: integer; X`09 radius`09`09: integer; X`09 out_val`09: vtype; X BEGIN X writev(out_val, X 'You are surrounded by a ',colors`5Brandint(max_colors)`5D,' light.'); X msg_print(out_val); X light_area := true; X if ((cave`5By,x`5D.fval in `5B1,2`5D) and (dun_level > 0)) then X`09 begin X`09 radius := trunc((1.0*py.misc.lev) / 3.0); X`09 if (radius < 3) then radius := 3; X`09 if ((dun_level mod 10) in open_cave_set) then X make_light(y,x,radius,true) X`09 else X `09 light_room(y,x); X`09 creatures(false); X`09 end X else X for i1 := y-1 to y+1 do X for i2 := x-1 to x+1 do X if (in_bounds(i1,i2)) then X BEGIN X if (not (test_light(i1,i2))) then X lite_spot(i1,i2); X cave`5Bi1,i2`5D.pl := true; X END X END; X`20 X`7B Darken an area, opposite of light area `7D X`5Bpsect(misc6$code)`5D function unlight_area(y,x : integer) : boolean; X VAR X i1,i2,i3,tmp1,tmp2,start_row,start_col,END_row,END_col : integer; X flag : boolean; X BEGIN X flag := false; X if ((cave`5By,x`5D.fval in `5B1,2`5D) and (dun_level > 0)) then X BEGIN X tmp1 := trunc(screen_height/2); X tmp2 := trunc(screen_width /2); X start_row := trunc(y/tmp1)*tmp1 + 1; X start_col := trunc(x/tmp2)*tmp2 + 1; X end_row := start_row + tmp1 - 1; X end_col := start_col + tmp2 - 1; X for i1 := start_row to END_row do X BEGIN X out_val := ''; X i3 := 0; X for i2 := start_col to END_col do X with cave`5Bi1,i2`5D do X if (fval in `5B1,2`5D) then X BEGIN X pl := false; X fval := 1; X if (not(test_light(i1,i2))) then X BEGIN X if (i3 = 0) then X i3 := i2; X out_val := out_val + ' ' X END X else if (i3 > 0) then X BEGIN X flag := true; X print(out_val,i1,i3); X out_val := ''; X i3 := 0 X END X END X else if (i3 > 0) then X BEGIN X flag := true; X print(out_val,i1,i3); X out_val := ''; X i3 := 0 X END; X if (i3 > 0) then X BEGIN X flag := true; X print(out_val,i1,i3) X END X END X END X else X for i1 := y-1 to y+1 do X for i2 := x-1 to x+1 do X if (in_bounds(i1,i2)) then X with cave`5Bi1,i2`5D do X if (fval in `5B4,5,6`5D) then X if (pl) then X BEGIN X pl := false; X flag := true X END; X if (flag) then X BEGIN X msg_print('Darkness pervades the area around you...'); X unlight_area := true X END X else `20 X unlight_area := false X END; X`20 X`7B Map the current area plus some `7D X`5Bpsect(misc6$code)`5D function map_area : boolean; X VAR X i1,i2,i3,i4,i5,i6,i7,i8 : integer; X BEGIN X map_area := true; X i1 := panel_row_min - randint(10); X i2 := panel_row_max + randint(10); X i3 := panel_col_min - randint(20); X i4 := panel_col_max + randint(20); X for i5 := i1 to i2 do X for i6 := i3 to i4 do X if (in_bounds(i5,i6)) then X if (cave`5Bi5,i6`5D.fval in floor_set) then X for i7 := i5-1 to i5+1 do X for i8 := i6-1 to i6+1 do X with cave`5Bi7,i8`5D do X if (fval in pwall_set) then X pl := true X else if (tptr > 0) then X if (t_list`5Btptr`5D.tval in light_set) then X fm := true; X prt_map X END; X`20 X`7B Identify an object `7D X`5Bpsect(misc6$code)`5D function ident_spell : boolean; X var X item_val : integer; X out_val : vtype; X redraw : boolean; X BEGIN X ident_spell := false; X redraw := false; X if (get_item(item_val,'Identify which item?', redraw,1,inven_ctr)) t Vhen X with inventory`5Bitem_val`5D do X BEGIN X ident_spell := true; X identify(inventory`5Bitem_val`5D); X known2(name); X objdes(out_val,item_val,true,'i'); X msg_print(chr(item_val+96) + cur_char2(item_val)+' ' + out_val V) X END; X if (redraw) then X BEGIN X msg_print(' '); X draw_cave X END X END; `20 X`20 X`7B Get all the monsters on the level pissed off. `7D X`5Bpsect(misc6$code)`5D function aggravate_monster(dis_affect : integer ) : V boolean; X VAR X i1 : integer; X BEGIN X aggravate_monster := true; X i1 := muptr; X repeat X with m_list`5Bi1`5D do X BEGIN X csleep := 0; X if (cdis <= dis_affect) then X if (cspeed < 2) then X cspeed := cspeed + 1 X END; X i1 := m_list`5Bi1`5D.nptr; X until(i1 = 0) X END; X`20 X`7B Surround the fool with traps (chuckle) `7D X`5Bpsect(misc6$code)`5D function trap_creation : boolean; X VAR X i1,i2 : integer; X BEGIN X trap_creation := true; X for i1 := char_row-1 to char_row+1 do X for i2 := char_col-1 to char_col+1 do X with cave`5Bi1,i2`5D do X if (fval in floor_set) then X BEGIN X if (tptr > 0) then X delete_object(i1,i2); X place_trap(i1,i2,1,randint(max_trapa)) X END X END; X`20 X`7B Surround the player with doors. `7D X`5Bpsect(misc6$code)`5D function door_creation : boolean; X VAR X i1,i2,i3 : integer; X BEGIN X door_creation := true; X for i1 := char_row-1 to char_row+1 do X for i2 := char_col-1 to char_col+1 do X if ((i1 <> char_row) or (i2 <> char_col)) then X with cave`5Bi1,i2`5D do X if (fval in floor_set) then X BEGIN X popt(i3); X if (tptr > 0) then X delete_object(i1,i2); X fopen := false; X tptr := i3; X t_list`5Bi3`5D := door_list`5B2`5D; X if (test_light(i1,i2)) then X lite_spot(i1,i2) X END X END; X`20 X`7B Destroys any adjacent door(s)/trap(s) `7D X`5Bpsect(misc6$code)`5D function td_destroy : boolean; X VAR X i1,i2 : integer; X BEGIN X td_destroy := false; X for i1 := char_row-1 to char_row+1 do X for i2 := char_col-1 to char_col+1 do X with cave`5Bi1,i2`5D do X if (tptr > 0) then X if (t_list`5Btptr`5D.tval in `5B101,102,104,105,109`5D) then X BEGIN X if (delete_object(i1,i2)) then X td_destroy := true X END X END; X `20 X`7B Display all creatures on the current panel `7D X`5Bpsect(misc6$code)`5D function detect_monsters : boolean; X VAR X i1,i2 : integer; X flag : boolean; +-+-+-+-+-+-+-+- END OF PART 65 +-+-+-+-+-+-+-+-