-+-+-+-+-+-+-+-+ START OF PART 30 -+-+-+-+-+-+-+-+ X show_inven(cur_top,inven_ctr); X`09`09`09 end; X X otherwise begin X`09`09`09 com_val := index(alpha_set,command); X`09`09`09 if (com_val in `5B1..inven_ctr`5D) then X`09`09`09`09 test_flag := true; X`09`09`09 end; X`09 end; `7Bcase`7D X until (test_flag); X if (not(exit_flag)) then `7B Main logic for wearing `7D X BEGIN X reset_flag := false; `7B Player turn `7D X test_flag := true; X CASE inventory`5Bcom_val`5D.tval of `7B Slot for equipment ` V7D X 15 : i1 := 33; X 19,20,21,23,25 : i1 := 23; X`09`09 29 : i1 := 35; X 30 : i1 := 31; X 31 : i1 := 28; X 32 : i1 := 32; X 33 : i1 := 24; X 34 : i1 := 27; X 35,36 : i1 := 26; X 40 : i1 := 25; X 45 : if (equipment`5B29`5D.tval = 0) then `7B Rings `7D X i1 := 29 X else X i1 := 30; X otherwise X BEGIN X msg_print('Sorry, you can''t wear or wield that. V'); X`09`09`09 msg_print(''); X test_flag := false; X com_val := 0; X END; X END; X if (test_flag) then X if (equipment`5Bi1`5D.tval > 0) then X BEGIN X if (uand(%X'80000000',equipment`5Bi1`5D.flags) <> 0) t Vhen X BEGIN X objdes(out_val,i1,false,'e'); X out_val := 'The ' + out_val + ' you are '; X CASE i1 of X 23 : out_val := out_val + 'wielding '; X otherwise out_val := out_val + 'wearing '; X END; X msg_print(out_val + 'appears to be cursed.'); X`09`09`09 msg_print(''); X test_flag := false; X com_val := 0; X END X else if (inven_ctr > inven_max-1) then X if (inventory`5Bcom_val`5D.number > 1) then X if (inventory`5Bcom_val`5D.subval < 512) then X BEGIN X msg_print('You will have to drop something first.'); X test_flag := false; X com_val := 0; X END; X END; X if (test_flag) then X BEGIN X unwear_obj := equipment`5Bi1`5D; X equipment`5Bi1`5D := inventory`5Bcom_val`5D; X with equipment`5Bi1`5D do X`09`09 Begin X`7BFix for weight`7D inven_weight := inven_weight + weight*number; X`09`09`09if ((subval >= 255) and (subval < 512)) then X`09`09`09 begin X`09`09`09 number := 1; X`7BFix for flashlights`7D `09 if (i1 = 33) then subval := subval - 255; X end; X End; X inven_destroy(com_val); `7B Subtracts weight `7D X`09`09 if (scr_state <> 0) then X`09`09 show_inven(cur_top,inven_ctr); X equip_ctr := equip_ctr + 1; X py_bonuses(equipment`5Bi1`5D,1); X if (unwear_obj.tval > 0) then X BEGIN X temporary_slot := unwear_obj; X tmp := remove(-1); X if (tmp < com_val) then X com_val := tmp; X`09`09 if (scr_state <> 0) then X`09`09 show_inven(cur_top,inven_ctr); X END; X CASE i1 of X 23 : prt1 := 'You are wielding '; X 33 : prt1 := 'Your light source is '; X otherwise prt1 := 'You are wearing '; X END; X objdes(prt2,i1,true,'e'); X i2 := 0; X i3 := 22; X repeat `7B Get the right letter of equipment `7D X i3 := i3 + 1; X if (equipment`5Bi3`5D.tval > 0) then X i2 := i2 + 1; X until (i3 = i1); X out_val := prt1 + prt2 + ' (' + chr(i2+96)+cur_char2(i1) V; X msg_print(out_val); X`09`09 msg_print(''); X END; X END; X if (scr_state = 0) then X exit_flag := true X else if (inven_ctr = 0) then X exit_flag := true; X until(exit_flag); X if (scr_state <> 0) then prt('You are currently carrying -',1,1); X END; X`20 X`7B Switch primary and secondary weapons `7D X procedure switch_weapon; X var X`09 prt1,prt2 : vtype; X tmp_obj : treasure_type; X BEGIN X if (uand(%X'80000000',equipment`5B23`5D.flags) <> 0) then X BEGIN X objdes(prt1,23,false,'e'); X msg_print('The ' + prt1 + X ' you are wielding is really stuck to you.'); X`09 msg_print(''); X END X else X BEGIN `7B Switch weapons `7D X reset_flag := false; X tmp_obj := equipment`5B34`5D; X equipment`5B34`5D := equipment`5B23`5D; X equipment`5B23`5D := tmp_obj; X py_bonuses(equipment`5B34`5D,-1); `7B Subtract bonuses `7D X py_bonuses(equipment`5B23`5D,1); `7B Add bonuses `7D X if (equipment`5B23`5D.tval > 0) then X BEGIN X prt1 := 'Primary weapon: '; X objdes(prt2,23,true,'e'); X msg_print(prt1 + prt2); X`09`09 msg_print(''); X END; X if (equipment`5B34`5D.tval > 0) then X BEGIN X prt1 := 'Secondary weapon : '; X objdes(prt2,34,true,'e'); X msg_print(prt1 + prt2); X`09`09 msg_print(''); X END; X END; X if (scr_state <> 0) then X BEGIN X msg_print(''); X clear(1,1); X prt('You are currently using -',1,1); X show_equip(1); X END; X END; X`20 X`7B Main logic for INVEN_COMMAND `7D X BEGIN X inven_command := false; X exit_flag := false; X scr_state := 0; X`09cur_top := 1; X repeat X CASE command of X 'i' : BEGIN `7B Inventory `7D X if (inven_ctr = 0) then X msg_print('You are not carrying anything.') X else if (scr_state <> 1) then X BEGIN `7B Sets scr_state to 1 `7D X`09`09 erase_line(1,1); X prt('You are currently carrying -',1,1); X show_inven(cur_top,inven_ctr); X END; X END; X`09 ' ' : BEGIN X`09`09 if (cur_top+inven_per_page <= inven_ctr) then X`09`09 cur_top := cur_top + inven_per_page X`09`09 else X`09`09 cur_top := 1; X`09`09 show_inven(cur_top,inven_ctr); X`09`09 END; X`09 'c' : BEGIN `7B Clean `7D X`09`09 if (inven_ctr = 0) then X`09`09 msg_print('You are not carrying anything.') X`09`09 else clean; X`09`09 END; X 'e' : BEGIN `7B Equipment `7D X if (equip_ctr = 0) then X msg_print('You are not using any equipment.') X else if (scr_state <> 2) then X BEGIN `7B Sets scr_state to 2 `7D X clear(1,1); X prt('You are currently using -',1,1); X show_equip(1); X END; X END; X 't' : BEGIN `7B Take off `7D X if (equip_ctr = 0) then X msg_print('You are not using any equipment.') X else if (inven_ctr > inven_max-1) then X msg_print('You will have to drop something first.') X else X unwear; `7B May set scr_state to 2 `7D X END; X 'w' : BEGIN `7B Wear/wield `7D X if (inven_ctr = 0) then X msg_print('You are not carrying anything.') X else X wear; `7B May set scr_state to 1 `7D X END; X 'x' : BEGIN X if (equipment`5B23`5D.tval <> 0) then X switch_weapon X else if (equipment`5B34`5D.tval <> 0) then X switch_weapon X else X msg_print('But you are wielding no weapons.'); X END; X`7B Special function for other routines `7D X '?' : BEGIN `7B Displays part inven, returns`7D X show_inven(r1,r2); X scr_state := 0; `7B Clear screen state `7D X END; X`7B Nonsense command `7D X otherwise ; X END; X if (scr_state > 0) then X BEGIN X`09 prt('quip, inven, ake-off, ear/wield, ' + X`09`09 'echange, lean, `5EZ to exit.',24,2); X test_flag := false; X`09 if (scr_state = 1) then`20 X`09 count_inventory; X repeat X inkey(command); X com_val := ord(command); X CASE com_val of X 0,3,25,26,27 : BEGIN `7B Exit from module `7D X exit_flag := true; X test_flag := true; X END; X`09 otherwise X CASE command of `7B Module commands `7D X`09`09 ' ' : test_flag := true; X 'c' : test_flag := true; X`09`09 'e' : test_flag := true; X 'i' : test_flag := true; X 't' : test_flag := true; X 'w' : test_flag := true; X 'x' : test_flag := true; X '?' : ; `7B Trap special feature`7D X otherwise ; `7B Nonsense command `7D X END; X END; X until (test_flag); X prt('',24,1); X END X else X exit_flag := true; X until(exit_flag); X if (scr_state > 0) then `7B If true, must redraw screen `7D X inven_command := true; X END; X`20 X `7B Get the ID of an item and return the CTR value of it `7D X function get_item( var com_val : integer; X pmt : vtype; X var redraw: boolean; X r1,r2 : integer) : boolean; X var X command`09 : char; X `09 cur_top`09 : integer; X out_val`09 : vtype; X exit_flag`09 : boolean; X`09 `09 `20 X BEGIN X cur_top := r1; X`09get_item := false; X`09redraw := false; X`09exit_flag := false; X if (inven_ctr > 0) then X BEGIN X writev(out_val,' (',raoul_label(r1),'-',raoul_label(r2), X`09 `09') for list, to exit. ',pmt); X prt(out_val,1,1); X repeat X`09 inkey(command); X`09 com_val := ord(command); X`09 case com_val of X 0,3,13,25,26,27 : begin `7B Exit from module `7D X exit_flag := true; X`09`09`09 reset_flag := true; X end; X X 32 : if (not redraw) then X`09`09`09 begin X`09`09`09 inven_command('?',cur_top,r2); X`09`09`09 redraw := true; X`09`09`09 end X`09`09`09 else X`09`09`09 begin X`09`09`09 if (cur_top+inven_per_page <= r2) then X `09`09`09`09 cur_top := cur_top + inven_per_page X`09`09`09 else X`09`09`09`09 cur_top := r1; X inven_command('?',cur_top,r2); X end; X X otherwise begin X`09`09`09 com_val := index(alpha_set,command); X`09`09`09 if ((com_val >= r1) and (com_val <= r2)) then X begin X exit_flag := true; X get_item := true; X end; X`09`09`09 end; X`09 end; X until (exit_flag); X erase_line(msg_line,msg_line); X END X else X msg_print('You are not carrying anything.'); X END; $ CALL UNPACK [.INC]DISPLAY.INC;1 2034879415 $ create 'f' X`7B Eat some food.`7D X`5Bpsect(misc2$code)`5D procedure eat; X var X i1 : unsigned; X i2,i3,item_val : integer; X out_val : vtype; X redraw,ident : boolean; X BEGIN X reset_flag := true; X if (inven_ctr > 0) then X BEGIN X if (find_range(`5B80`5D,i2,i3)) then X BEGIN X redraw := false; X if (get_item(item_val,'Eat which food?',redraw,i2,i3)) then X with inventory`5Bitem_val`5D do X BEGIN X if (redraw) then draw_cave; X reset_flag := false; X i1 := flags; X ident := false; X while (i1 > 0) do X BEGIN X i2 := bit_pos(i1); X`7B Foods `7D X CASE (i2) of X 1 : with py.flags do X BEGIN X poisoned := poisoned + randint(10) + level; X Opusii_vomit(35); X ident := true; X END; X 2 : with py.flags do X BEGIN X blind := blind + randint(250) + 10*level + 100; X draw_cave; X msg_print('A veil of darkness surrounds you.'); X ident := true; X END; X 3 : with py.flags do +-+-+-+-+-+-+-+- END OF PART 30 +-+-+-+-+-+-+-+-