-+-+-+-+-+-+-+-+ START OF PART 27 -+-+-+-+-+-+-+-+ X`09 end; X`09 if present('score') then X`09 begin X`09`09max_score := 0; X`09`09if (get_value('score',out_val) and (length(out_val) > 0)) then X`09`09 readv(out_val,max_score,error:=continue); X`09`09if (max_score < 1) or (max_score > max_high_scores) then X`09`09 max_score := 20; X`09`09top_twenty; X`09`09exit; X`09 end; X`09 if present('wizard') then X`09 begin X`09`09if (get_value('wizard',wiz_pass) and X`09`09 (length(wiz_pass) > 0)) then X`09`09 check_pswd(wiz_pass,true) X`09`09else X`09`09 check_pswd('',false); X`09 end; X`09 if present('trap') then X`09 begin X`09`09want_trap := true; X`09`09if (get_value('trap',out_val)) then X`09`09 begin X`09`09 readv(out_val,max_mess_keep,error:=continue); X`09`09 if (max_mess_keep < 1) then max_mess_keep := 1; X`09`09 if (max_mess_keep > 1000) then max_mess_keep := 1000; X`09`09 end; X`09 end X`09 else X`09 want_trap := false; X`09 if present('warn') then X`09 want_warn := true X`09 else X`09 want_warn := false; X`09 if present('difficulty') then X`09 if (get_value('difficulty',out_val)) then X`09`09begin X`09`09 readv(out_val,py.misc.diffic,error:=continue); X`09`09 if (py.misc.diffic > 5) then py.misc.diffic := 5; X`09`09 if (py.misc.diffic < 1) then py.misc.diffic := 1; X`09`09end; X`09 if present('restore') then X`09 begin X`09`09if (get_value('restore',restore_name) and X`09`09 (length(restore_name) > 0)) then X`09`09 begin X`09`09 if not(wizard1) then check_pswd('',false); X`09`09 if (wizard1) then restore_char(restore_name,true,false); X`09`09 exit; X`09`09 end X`09`09else X`09`09 begin X`09`09 if not(wizard1) then check_pswd('',false); X`09`09 if (wizard1) then restore_char('',false,false); X`09`09 exit; X`09`09 end; X`09 end; X`09 if present('undead') then X`09 begin X`09`09if (get_value('undead',restore_name) and X`09`09 (length(restore_name) > 0)) then X`09`09 begin X`09`09 if not(wizard1) then check_pswd('',false); X`09`09 if (wizard1) then restore_char(restore_name,true,true); X`09`09 exit; X`09`09 end X`09`09else X`09`09 begin X`09`09 if not(wizard1) then check_pswd('',false); X`09`09 if (wizard1) then restore_char('',false,true); X`09`09 exit; X`09`09 end; X`09 end; X`09 if (not(wizard1)) then X`09 begin X`09`09no_controly; X`09`09if uw$id then X`09`09 if already_playing then X`09`09 begin X`09`09 writeln ( 'Hey bub, you''re already playing a game.' ); X`09`09 exit; X`09`09 end ; X`09 end; 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,'UW Modifications by : Kenneth Case, Mary Conner,'); Xwriteln(file1,' Robert DeLoura, Dan Flye,'); Xwriteln(file1,' Todd Gardiner, Dave Jungck,'); Xwriteln(file1,' Andy Walker, Dean Yasuda.'); Xwriteln(file1,' '); Xwriteln(file1,'University of Washington version 4.8'); 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 high score file`09`09`09`09`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`09`7B Check for death log file`09`09`09`09`7D X`09priv_switch(1); X`09open (file1,file_name:=moria_dth, 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_dth, 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,'Moria death log file'); Xwriteln(file1); Xwriteln(file1,'Key to abbreviations:'); Xwriteln(file1); Xwriteln(file1,'For Race: For Class:'); Xwriteln(file1,' 1 = Human 1 = Warrior'); Xwriteln(file1,' 2 = Half-Elf 2 = Mage'); Xwriteln(file1,' 3 = Elf 3 = Priest'); Xwriteln(file1,' 4 = Halfling 4 = Rogue'); Xwriteln(file1,' 5 = Gnome 5 = Ranger'); Xwriteln(file1,' 6 = Dwarf 6 = Paladin'); Xwriteln(file1,' 7 = Half-Orc 7 = Druid'); Xwriteln(file1,' 8 = Half-Troll 8 = Bard'); Xwriteln(file1,' 9 = Phraint 9 = Adventurer'); Xwriteln(file1,' 10 = Dryad 10 = Monk'); Xwriteln(file1); Xwriteln(file1,' Dif Class Dung Dung'); Xwriteln(file1,' Username Race Lvl Cur Max Died from'); Xwriteln(file1,' ------------ - -- -- -- ---- ---- -------------------------- V------------------'); X`09`09close(file1,error:=continue); X`09`09writeln('Created ',MORIA_DTH); X`09`09exit_flag := true; X`09 end; 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`09if present('top') then X`09 begin X`09 max_score := 0; X`09 if (get_value('top',out_val) and (length(out_val) > 0)) then X`09 readv(out_val,max_score,error:=continue); X`09 if (max_score < 1) or (max_score > max_high_scores) then X`09 max_score := max_high_scores; X`09 end X`09else X`09 max_score := 0; X`09if present('finam') then X`09 begin X`09 if (get_value('finam',out_val) and (length(out_val) > 0)) then X`09 begin X`09`09loc := index(out_val,'/'); X`09`09while (loc <> 0) and (length(out_val) > 0) do X`09`09 begin X`09`09 if (loc = 1) and (length(out_val) = 0) then X`09`09 begin X`09`09`09loc := 0; X`09`09`09out_val := ''; X`09`09 end X`09`09 else X`09`09 begin X`09`09`09out_val := substr(out_val,loc+1,length(out_val)-loc); X`09`09`09loc := index(out_val,' '); X`09`09`09while (loc <> 0) and (length(out_val) > 0) do X`09`09`09 begin X`09`09`09 if (loc = 1) and (length(out_val) = 0) then X`09`09`09 begin X`09`09`09 loc := 0; X`09`09`09 out_val := ''; X`09`09`09 end X`09`09`09 else X`09`09`09 begin X`09`09`09 out_val := substr(out_val,loc+1, X`09`09`09`09`09`09 length(out_val)-loc); X`09`09`09 loc := index(out_val,' '); X`09`09`09 end; X`09`09`09 end; X`09`09`09loc := index(out_val,'/'); X`09`09 end; X`09`09 end; X`09`09finam := out_val; X`09 end X`09 else X`09 finam := ''; X`09 end; X end; X X X`09`7B Prints dungeon map to external file`09`09`09-RAK-`09`7D X`5Bglobal,psect(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`5Bglobal,psect(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; X`09 prt('File name: ',1,1); X`09 if (get_string(filename1,1,12,64)) then X`09 begin X`09 if (length(filename1) = 0) then filename1 := 'MORIAOBJ.DAT'; X`09 open(file1,filename1,error:=continue); X`09 if (status(file1) = 0) then X`09`09begin X`09`09 writev(tmp_str,nobj:1); +-+-+-+-+-+-+-+- END OF PART 27 +-+-+-+-+-+-+-+-