-+-+-+-+-+-+-+-+ START OF PART 22 -+-+-+-+-+-+-+-+ X`09`09 end; X`09 5 :`09with py.flags do X`09`09 image := image + randint(200) + 25*level + 200; X`09 6 :`09ident := cure_poison; X`09 7 :`09ident := cure_blindness; X`09 8 :`09with py.flags do X`09`09 if (afraid > 1) then X`09`09 begin X`09`09 afraid := 1; X`09`09 ident := true; X`09`09 end; X`09 9 :`09ident := cure_confusion; X`09 10 :`09ident := lose_str; X`09 11 :`09ident := lose_con; X`09 12 :`09ident := lose_int; X`09 13 :`09ident := lose_wis; X`09 14 :`09ident := lose_dex; X`09 15 :`09ident := lose_chr; X`09 16 :`09with py.stat do X`09`09 if (str > cstr) then X`09`09 begin X`09`09 cstr := str; X`09`09 msg_print('You feel your strength returning.'); X`09`09 prt_strength; X`09`09 ident := true; X`09`09 end; X`09 17 :`09with py.stat do X`09`09 if (con > ccon) then X`09`09 begin X`09`09 ccon := con; X`09`09 msg_print('You feel your health returning.'); X`09`09 prt_constitution; X`09`09 ident := true; X`09`09 end; X`09 18 :`09with py.stat do X`09`09 if (py.stat.int > cint) then X`09`09 begin X`09`09 cint := py.stat.int; X`09`09 msg_print('Your head spins a moment.'); X`09`09 prt_intelligence; X`09`09 ident := true; X`09`09 end; X`09 19 :`09with py.stat do X`09`09 if (wis > cwis) then X`09`09 begin X`09`09 cwis := wis; X`09`09 msg_print('You feel your wisdom returning.'); X`09`09 prt_wisdom; X`09`09 ident := true; X`09`09 end; X`09 20 :`09with py.stat do X`09`09 if (dex > cdex) then X`09`09 begin X`09`09 cdex := dex; X`09`09 msg_print('You more dexteritous.'); X`09`09 prt_dexterity; X`09`09 ident := true; X`09`09 end; X`09 21 :`09with py.stat do X`09`09 if (chr > cchr) then X`09`09 begin X`09`09 cchr := chr; X`09`09 msg_print('Your skins starts itching.'); X`09`09 prt_charisma; X`09`09 ident := true; X`09`09 end; X`09 22 :`09ident := hp_player(randint(3),'poisoness food.'); X`09 23 :`09ident := hp_player(randint(6),'poisoness food.'); X`09 24 :`09ident := hp_player(randint(12),'poisoness food.'); X`09 25 :`09ident := hp_player(damroll('3d6'),'poisoness food.'); X`09 26 :`09ident := hp_player(damroll('3d12'),'poisoness food.'); X`09 27 :`09ident := hp_player(-randint(4),'poisoness food.'); X`09 28 :`09ident := hp_player(-randint(8),'poisoness food.'); X`09 29 :`09ident := hp_player(-damroll('2d8'),'poisoness food.'); X`09 30 :`09ident := hp_player(-damroll('3d8'),'poisoness food.'); X`09 31 :`09with py.misc do X`09`09 begin X`09`09 mhp := mhp - 1; X`09`09 if (mhp < chp) then X`09`09 chp := mhp; X`09`09 take_hit(1,'poisoness food.'); X`09`09 prt_mhp; X`09`09 prt_chp; X`09`09 ident := true; X`09`09 end; X`09 otherwise ; X`09end; X`09`7B End of food actions...`09`09`09`09`7D X`09`09`09end; X`09`09 if (ident) then X`09`09`09identify(inventory`5Bitem_val`5D); X`09`09 if (flags <> 0) then X`09`09`09with py.misc do X`09`09`09 begin X`09`09`09 exp := exp + round(level/lev); X`09`09`09 prt_experience; X`09`09`09 end; X`09`09 add_food(p1); X`09`09 py.flags.status := uand(%X'FFFFFFFC',py.flags.status); X`09`09 prt_hunger; X`09`09 desc_remain(item_val); X`09`09 inven_destroy(item_val); X`09`09 end X`09`09else X`09`09 if (redraw) then draw_cave; X`09 end X`09 else X`09 msg_print('You are not carrying any food.'); X`09 end X`09else X`09 msg_print('But you are not carrying anything.'); X end; $ CALL UNPACK [.SOURCE.INCLUDE]EAT.INC;1 2133704953 $ create 'f' X`09`7B Attempt to open the intro file`09`09`09-RAK-`09`7D X`5Bpsect(setup$code)`5D procedure intro(var finam : vtype); X var X`09xpos,i1 : integer; X`09dummy : char; X`09day_test,in_line : vtype; X`09file1 : text; X`09file2 : file of key_type; X`09exit_flag : boolean; X begin X`09exit_flag := false; X`09clear(1,1); X`09`7B Attempt to read hours.dat. If it does not exist, `7D X`09`7B then create a standard one. `7D X`09priv_switch(1); X`09open(file1,file_name:=MORIA_HOU, X`09`09history:=readonly,sharing:=readonly,error:=continue); X`09if (status(file1) = 0) then X`09 begin X`09 reset(file1); X`09 repeat X`09 readln(file1,in_line,error:=continue); X`09 if (length(in_line) > 3) then X`09`09begin X`09`09 day_test := substr(in_line,1,4); X`09`09 if (day_test = 'SUN:') then days`5B1`5D := in_line X`09`09 else if (day_test = 'MON:') then days`5B2`5D := in_line X`09`09 else if (day_test = 'TUE:') then days`5B3`5D := in_line X`09`09 else if (day_test = 'WED:') then days`5B4`5D := in_line X`09`09 else if (day_test = 'THU:') then days`5B5`5D := in_line X`09`09 else if (day_test = 'FRI:') then days`5B6`5D := in_line X`09`09 else if (day_test = 'SAT:') then days`5B7`5D := in_line; X`09`09end; X`09 until(eof(file1)); X`09 close(file1,error:=continue); X`09 priv_switch(0); X`09 end X`09else `7B Create a standard hours file `7D X`09 begin X`09 priv_switch(0); X`09 open(file1,file_name:=MORIA_HOU, X`09`09organization:=sequential,history:=new, X`09`09sharing:=readwrite,error:=continue); X`09 if (status(file1) = 0) then X`09 begin X`09`09rewrite(file1,error:=continue); X`09`09writeln(file1,' Moria operating hours are:'); X`09`09writeln(file1,' `7C AM `7C PM `7C'); X`09`09writeln(file1,' 1 111 111'); X`09`09writeln(file1,' 2123456789012123456789012'); X`09`09for i1 := 1 to 7 do X`09`09 writeln(file1,days`5Bi1`5D); X`09`09writeln(file1,' (X=Open; .=Closed)'); X`09`09close(file1,error:=continue); X`09`09writeln('Created ',MORIA_HOU); X`09`09exit_flag := true; X`09 end X`09 else X`09 begin X`09`09writeln('Error in creating ',MORIA_HOU); X`09`09exit; X`09 end; X`09 end; X X`09`7B Check the hours, if closed then require password`09`7D X`09if (not(exit_flag)) then X`09 begin X`09 xpos := index(finam,'/WIZARD'); X`09 if ( xpos > 0) then X`09 if (check_pswd) then X`09`09insert_str(finam,'/WIZARD',''); X`09 if (not(wizard1)) then X`09 no_controly; X`09 if (not(check_time)) then X`09 if (not(wizard1)) then X`09`09begin X`09`09 priv_switch(1); X`09`09 open(file1,file_name:=MORIA_HOU, X`09`09`09history:=readonly,sharing:=readonly,error:=continue); X`09`09 if (status(file1) = 0) then X`09`09 begin X`09`09 reset(file1); X`09`09 repeat X`09`09`09readln(file1,in_line); X`09`09`09writeln(in_line); X`09`09 until(eof(file1)); X`09`09 close(file1,error:=continue); X`09`09 end; X`09`09 priv_switch(0); X`09`09 exit; X`09`09end; X`09 end; X X`09`7B Print the introduction message, news, ect...`09`09`7D X`09priv_switch(1); X`09open(file1,file_name:=MORIA_MOR, X`09`09organization:=sequential,history:=readonly, X`09`09sharing:=readwrite,error:=continue); X`09if (status(file1) = 0) then X`09 begin X`09 if (not(exit_flag)) then X`09 begin X`09`09reset(file1); X`09`09repeat X`09`09 readln(file1,in_line,error:=continue); X`09`09 writeln(in_line); X`09`09until (eof(file1)); X`09`09pause_exit(24,0); X`09`09close(file1,error:=continue); X`09 end X`09 else X`09 close(file1,error:=continue); X`09 priv_switch(0); X`09 end X`09else `7B Create one... `7D X`09 begin X`09 priv_switch(0); X`09 open(file1,file_name:=MORIA_MOR, X`09`09organization:=sequential,history:=new, X`09`09sharing:=readwrite,error:=continue); X`09 if (status(file1) = 0) then X`09 begin X`09`09rewrite(file1,error:=continue); Xwriteln(file1,' *********************'); Xwriteln(file1,' ** Moria ',cur_version:4:2,' ** V'); Xwriteln(file1,' *********************'); Xwriteln(file1,' COPYRIGHT (c) Robert Alan Koeneke'); Xwriteln(file1,' '); Xwriteln(file1,'Programers : Robert Alan Koeneke / University of Oklahoma'); Xwriteln(file1,' Jimmey Wayne Todd / University of Oklahoma'); Xwriteln(file1,' '); Xwriteln(file1,'Dungeon Master: This file may contain updates and news.'); X`09`09close(file1,error:=continue); X`09`09writeln('Created ',MORIA_MOR); X`09`09exit_flag := true; X`09 end X`09 else X`09 begin X`09`09writeln('Error in creating ',MORIA_MOR); X`09`09exit; X`09 end; X`09 end; X`09`7B Check for MASTER.DAT `7D X`09priv_switch(1); X`09open (file2,file_name:=moria_mas, X`09`09access_method:=keyed,organization:=indexed,history:=readonly, X`09`09sharing:=readwrite,error:=continue); X`09if (status(file2) <> 0) then X`09 begin X`09 priv_switch(0); X`09 open (file2,file_name:=moria_mas, X`09`09access_method:=keyed,organization:=indexed,history:=new, X`09`09sharing:=readwrite,error:=continue); X`09 if (status(file2) = 0) then X`09 begin X`09`09writeln('Created ',MORIA_MAS); X`09`09close(file2,error:=continue); X`09`09exit_flag := true; X`09 end X`09 else X`09 begin X`09`09writeln('Error in creating ',MORIA_MAS); X`09`09exit; X`09 end; X`09 end X`09else X`09 begin X`09 close(file2,error:=continue); X`09 priv_switch(0); X`09 end; X`09`7B Check for TOPTWENTY.DAT `7D X`09priv_switch(1); X`09open (file1,file_name:=moria_top, X`09`09organization:=sequential,history:=readonly, X`09`09sharing:=readwrite,error:=continue); X`09if ((status(file1) <> 0) and (status(file1) <> 2)) then X`09 begin X`09 priv_switch(0); X`09 open (file1,file_name:=moria_top, X`09`09organization:=sequential,history:=new, X`09`09sharing:=readwrite,error:=continue); X`09 if (status(file1) = 0) then X`09 begin X`09`09writeln('Created ',MORIA_TOP); X`09`09close(file1,error:=continue); X`09`09exit_flag := true; X`09 end X`09 else X`09 begin X`09`09writeln('Error in creating ',MORIA_TOP); X`09`09exit; X`09 end; X`09 end X`09else X`09 begin X`09 close(file1,error:=continue); X`09 priv_switch(0); X`09 end; X`09if (exit_flag) then X`09 begin X`09 writeln('Notice: System MORIA wizard should set the protection'); X`09 writeln(' on files just created. See INSTALL.HLP for'); X`09 writeln(' help on setting protection on the files.'); X`09 writeln('Notice: File HOURS.DAT may be edited to set operating'); X`09 writeln(' hours for MORIA.'); X`09 writeln('Notice: File MORIA.DAT may be edited to contain news'); X`09 writeln(' items, etc...'); X`09 exit; X`09 end; X end; X X X`09`7B Prints dungeon map to external file`09`09`09-RAK-`09`7D X`5Bpsect(misc2$code)`5D procedure print_map; X var X`09i1,i2,i3,i4,i5,i6,i7,i8 : integer; X`09dun_line : varying `5B133`5D of char; X`09filename1 : varying `5B80`5D of char; X`09tmp : char; X`09file1 : text; X begin X prt('File name: ',1,1); X if (get_string(filename1,1,12,64)) then X`09begin X`09 if (length(filename1) = 0) then filename1 := 'MORIAMAP.DAT'; X`09 open(file1,filename1,error:=continue); X`09 if (status(file1) = 0) then X`09 begin X`09 prt('Writing Moria Dungeon Map...',1,1); X`09 put_qio; X`09 rewrite(file1,error:=continue); X`09 i1 := 1; X`09 i7 := 0; X`09 repeat X`09`09i2 := 1; X`09`09i3 := i1 + outpage_height - 1; X`09`09if (i3 > cur_height) then X`09`09 i3 := cur_height; X`09`09i7 := i7 + 1; X`09`09i8 := 0; X`09`09repeat X`09`09 i4 := i2 + outpage_width - 1; X`09`09 if (i4 > cur_width) then X`09`09 i4 := cur_width; X`09`09 i8 := i8 + 1; X`09`09 writeln(file1,chr(12),error:=continue); X`09`09 write(file1,'Section`5B',i7:1,',',i8:1,'`5D; ', X`09`09`09`09`09`09`09error:=continue); X`09`09 writeln(file1,'Depth : ',(dun_level*50):1,' (feet)', X`09`09`09`09`09`09`09error:=continue); X`09`09 writeln(file1,' ',error:=continue); X`09`09 write(file1,' ',error:=continue); X`09`09 for i5 := i2 to i4 do X`09`09 begin X`09`09 i6 := trunc(i5/100); X`09`09 write(file1,i6:1,error:=continue); X`09`09 end; X`09`09 writeln(file1,error:=continue); X`09`09 write(file1,' ',error:=continue); X`09`09 for i5 := i2 to i4 do X`09`09 begin X`09`09 i6 := trunc(i5/10) - trunc(i5/100)*10; X`09`09 write(file1,i6:1,error:=continue); X`09`09 end; X`09`09 writeln(file1,error:=continue); X`09`09 write(file1,' ',error:=continue); X`09`09 for i5 := i2 to i4 do X`09`09 begin X`09`09 i6 := i5 - trunc(i5/10)*10; X`09`09 write(file1,i6:1,error:=continue); X`09`09 end; X`09`09 writeln(file1,error:=continue); X`09`09 for i5 := i1 to i3 do X`09`09 begin X`09`09 writev(dun_line,i5:3); X`09`09 for i6 := i2 to i4 do X`09`09`09begin X`09`09`09 if (test_light(i5,i6)) then X`09`09`09 loc_symbol(i5,i6,tmp) X`09`09`09 else X`09`09`09 tmp := ' '; X`09`09`09 dun_line := dun_line + tmp; X`09`09`09end; X`09`09 writeln(file1,dun_line,error:=continue); X`09`09 end; X`09`09 i2 := i2 + outpage_width; X`09`09until (i2 >= cur_width); X`09`09i1 := i1 + outpage_height; X`09 until (i1 >= cur_height); X`09 close(file1,error:=continue); X`09 prt('Completed.',1,1); X`09 end; X`09end X end; X X X`09`7B Prints a list of random objects to a file. Note that -RAK-`09`7D X`09`7B the objects produced is a sampling of objects which `7D X`09`7B be expected to appear on that level. `7D X`5Bpsect(misc2$code)`5D procedure print_objects; X var X`09nobj,i1,i2,level : integer; X`09filename1,tmp_str : varying `5B80`5D of char; X`09file1 : text; X begin X prt('Produce objects on what level?: ',1,1); X get_string(tmp_str,1,33,10); X level := 0; X readv(tmp_str,level,error:=continue); X prt('Produce how many objects?: ',1,1); X get_string(tmp_str,1,28,10); X nobj := 0; X readv(tmp_str,nobj,error:=continue); X if ((nobj > 0) and (level > -1) and (level < 1201)) then X`09begin X`09 if (nobj > 9999) then nobj := 9999; +-+-+-+-+-+-+-+- END OF PART 22 +-+-+-+-+-+-+-+-