-+-+-+-+-+-+-+-+ START OF PART 23 -+-+-+-+-+-+-+-+ X`09`09 if (p1 > obj$lamp_max) then p1 := obj$lamp_max; X`09`09end; X`09 desc_remain(i1); X`09 inven_destroy(i1); X`09 prt_weight ; X`09 end X`09 else X`09 msg_print('You have no oil.') X`09else X`09 msg_print('But you are not using a lamp.'); X end; X X`09`7B Check for message from AST message trapper`09-DMF-`09`7D X procedure dump_ast_mess; X var X`09cur`09`09: integer; X`09str1,str2`09: string; X`09ptr,ptr2`09: message_ptr; X`09messagestr : string; X begin X`09if caught_count > 0 then X`09begin X`09 if (caught_count > 1) then X`09 msg_print('You hear some messages from a distant location...') X`09 else X`09 msg_print('You hear a message from a distant location...'); X`09 while (caught_message <> nil) do X`09 begin X`09 messagestr := caught_message`5E.data; X`09 for cur := 0 to 31 do X`09`09while (index(messagestr,chr(cur)) <> 0) do X`09`09 begin X`09`09 writev(str1,'`5E',chr(cur + 64)); X`09`09 writev(str2,chr(cur)); X`09`09 insert_str(messagestr,str2,str1); X`09`09 end; X`09 while (length(messagestr) > 71) do X`09`09begin X`09`09 tmp_str := substr(messagestr,1,71); X`09`09 messagestr := substr(messagestr,72,length(messagestr)-71); X`09`09 msg_print(tmp_str); X`09`09end; X`09 msg_print(messagestr); X`09 caught_count := caught_count - 1; X`09 message_cursor := caught_message; X`09 caught_message := caught_message`5E.next; X`09 if (old_message = nil) then X`09`09begin X`09`09 old_message := message_cursor; X`09`09 old_message`5E.next := nil; X`09`09 old_mess_count := 1; X`09`09end X`09 else X`09`09begin X`09`09 message_cursor`5E.next := old_message; X`09`09 old_message := message_cursor; X`09`09 old_mess_count := old_mess_count + 1; X`09`09 if (old_mess_count > max_mess_keep) then X`09`09 begin X`09`09 ptr := old_message; X`09`09 while (ptr`5E.next`5E.next <> nil) do X`09`09`09ptr := ptr`5E.next; X`09`09 ptr2 := ptr`5E.next; X`09`09 dispose(ptr2); X`09`09 ptr`5E.next := nil; X`09`09 old_mess_count := old_mess_count - 1; X`09`09 end; X`09`09end; X`09 end; X`09end; X end; X X procedure view_old_mess; X var X`09done`09: boolean; X`09ptr`09: message_ptr; X`09cur`09: integer; X`09out_mess: string; X begin X`09ptr := old_message; X`09done := false; X`09while (ptr <> nil) and (not(done)) do X`09 begin X`09 out_mess := ptr`5E.data; X`09 if length(out_mess) > 71 then X`09 begin X`09`09while (length(out_mess) > 71) do X`09`09 begin X`09`09 tmp_str := substr(out_mess,1,71); X`09`09 out_mess := substr(out_mess,72,length(out_mess)-71); X`09`09 done := msg_print(tmp_str); X`09`09 end; X`09 end; X`09 done := msg_print(out_mess); X`09 ptr := ptr`5E.next; X`09 end; X end; X X`09`7B Using objects `7D X`09%INCLUDE 'SCROLLS.INC' X`09%INCLUDE 'POTIONS.INC' X`09%INCLUDE 'EAT.INC' X`09%INCLUDE 'WANDS.INC' X`09%INCLUDE 'STAFFS.INC' X`09%INCLUDE 'BLOW.INC' X`09`7B Spell casting `7D X`09%INCLUDE 'MAGIC.INC' X`09%INCLUDE 'PRAYER.INC' X`09%INCLUDE 'PLAY.INC' X`09%INCLUDE 'SING.INC' X`09%INCLUDE 'MONK.INC' X X procedure bother(num : integer); X`09begin X`09 if (num > 5) then X`09 msg_print('Your sword screams insults at passing monsters!') X`09 else X`09 begin X`09 msg_print('Your sword loudly shouts to all nearby creatures,'); X`09`09case num of X1 : msg_print('What kinda monsters are you, mice -- or giant mice???'); X2 : msg_print('You pathetic creatures are not worth tarnishing my blade!'); X3 : msg_print('Attention all monsters: SUPPERTIME!!!'); X4 : msg_print('Boy are we wounded!! Sure hope we don''t run into a kobold!') V; X5 : msg_print('Now where did I misplace my armor? Hmmm...'); X`09`09end; X`09 end; X`09 if (aggravate_monster(20)) then X`09 msg_print('You hear the sounds of movement in the distance!'); X`09 msg_print(' '); X`09end; X X function water_move_item(row,col,num : integer) : boolean; X begin X`09water_move_item := true; X end; X X procedure water_move_player; X begin X end; X X function water_move_creature(num : integer) : boolean; X begin X`09water_move_creature := true; X end; X X procedure water_move; X var X`09`09i1,i2`09`09: integer; X`09`09flag`09`09: boolean; X begin X`7B`09for i1 := 1 to max_height do X`09 for i2 := 1 to max_width do X`09 cave`5Bi1,i2`5D.moved := false; X`09for i1 := 1 to max_height do X`09 for i2 := 1 to max_width do X`09 begin X`09 if (cave`5Bi1,i2`5D.tptr > 0) and X`09`09 (t_list`5Bcave`5Bi1,i2`5D.tptr`5D.tval < unseen_trap) then X`09`09begin X`09`09 flag := water_move_item(i1,i2,cave`5Bi1,i2`5D.tptr); X`09`09end; X`09 end; X`7D`09water_move_player; X`09i1 := muptr; X`09while (i1 <> 0) do X`09 begin X`09 m_list`5Bi1`5D.moved := false; X`09 i1 := m_list`5Bi1`5D.nptr; X`09 end; X`09i1 := muptr; X`09while (i1 <> 0) do X`09 begin X`09 flag := water_move_creature(i1); X`09 i1 := m_list`5Bi1`5D.nptr; X`09 end; X end; X X X`09`7B Main procedure for dungeon... `09`09`09-RAK-`09`7D X`09`7B Note: There is a lot of prelinimary magic going on here at first`7D X begin X s1 := ''; X s2 := ''; X s3 := ''; X s4 := ''; X cur_inven := inventory_list; X i_summ_count := 0; X`09`7B Check light status for setup `7D X with equipment`5BEquipment_light`5D do X`09if (p1 > 0) then X`09 player_light := true X`09else X`09 player_light := false; X`09`7B Check for a maximum level `7D X with py.misc do X`09if (dun_level > max_lev) then max_lev := dun_level; X`09`7B Set up the character co-ords `7D X if ((char_row = -1) or (char_col = -1)) then X`09repeat X`09 char_row := randint(cur_height); X`09 char_col := randint(cur_width); X`09until (cave`5Bchar_row,char_col`5D.fopen)`09`09and X`09 (cave`5Bchar_row,char_col`5D.cptr = 0)`09and X`09 (cave`5Bchar_row,char_col`5D.tptr = 0)`09and X`09 (not(cave`5Bchar_row,char_col`5D.fval in water_set)); X`09`7B Reset flags and initialize variables `7D X moria_flag := false; X cave_flag := false; X find_flag := false; X search_flag := false; X teleport_flag := false; X mon_tot_mult := 0; X cave`5Bchar_row,char_col`5D.cptr := 1; X old_chp := trunc(py.misc.chp); X old_cmana := trunc(py.misc.cmana); X`09`7B Light up the area around character `7D X move_char(5); X`09`7B Light, but do not move critters `7D X creatures(false); X`09`7B Print the depth `7D X prt_depth; X X`09`7B Loop until dead, or new level `09`09`7D X repeat X X`09`7B Check for the AST's`09`09`09-DMF-`09`7D X`09if (want_trap) then dump_ast_mess; X X`09`7B Increment turn counter`09`09`09`7D X`09turn := turn + 1; X`09if (py.flags.speed > 0) or X`09 ((turn mod (abs(py.flags.speed) + 1)) = 0) then X`09 begin X`09 water_move; X`09 adv_time(true);`09`7B Increment game time `7D X`09 end; X`09`7B Sunrise and Sunset`09`09`09 -KRC-`09`7D X`09with py.misc.cur_age do X`09 if (dun_level = 0) then X`09 if ((hour = 6) and (secs = 0)) then X`09 begin X`09 for i1 := 1 to cur_height do X`09`09 for i2 := 1 to cur_width do X`09`09 cave`5Bi1,i2`5D.pl := true; X`09`09store_maint; X`09`09draw_cave; X`09 end X`09 else if ((hour = 18) and (secs = 0)) then X`09 begin X`09 for i1 := 1 to cur_height do X`09`09 for i2 := 1 to cur_width do X`09`09 if (cave`5Bi1,i2`5D.fval <> dopen_floor.ftval) then X`09`09 cave`5Bi1,i2`5D.pl := true X`09`09 else X`09`09 cave`5Bi1,i2`5D.pl := false; X`09`09store_maint; X`09`09draw_cave; X`09 end; X`09`7B Check for kickout`09`09`09`09`7D X`09check_kickout_time(turn,10); X`09`7B Check for game hours `7D X`09if (not(wizard1)) then X`09 if ((turn mod 100) = 1) then X`09 if not(check_time) then X`09 if (closing_flag > 2) then X`09`09begin X`09`09 if (search_flag) then X`09`09 search_off; X`09`09 if (py.flags.rest > 0) then X`09`09 rest_off; X`09`09 find_flag := false; X`09`09 msg_print('The gates to Moria are now closed.'); X`09`09 msg_print(''); X`09`09 repeat X`09`09 py.flags.dead := false; X`09`09 save_char(true); X`09`09 until(false); X`09`09end X`09 else X`09`09begin X`09`09 if (search_flag) then X`09`09 search_off; X`09`09 if (py.flags.rest > 0) then X`09`09 rest_off; X`09`09 move_char(5); X`09`09 closing_flag := closing_flag + 1; X`09`09 msg_print('The gates to Moria are closing...'); X`09`09 msg_print('Please finish up or save your game.'); X`09`09 msg_print(''); X`09`09end; X X`09`7B Check for creature generation `09`09`7D X`09if (randint(max_malloc_chance) = 1) then X`09 alloc_land_monster(floor_set,1,max_sight,false,false); X`09`7B Screen may need updating, used mostly for stats`7D X`09if (print_stat > 0) then X`09 begin X`09 if (uand(%X'0001',print_stat) <> 0) then X`09 prt_a_stat(sr); X`09 if (uand(%X'0002',print_stat) <> 0) then X`09 prt_a_stat(dx); X`09 if (uand(%X'0004',print_stat) <> 0) then X`09 prt_a_stat(cn); X`09 if (uand(%X'0008',print_stat) <> 0) then X`09 prt_a_stat(iq); X`09 if (uand(%X'0010',print_stat) <> 0) then X`09 prt_a_stat(ws); X`09 if (uand(%X'0020',print_stat) <> 0) then X`09 prt_a_stat(ca); X`09 if (uand(%X'0040',print_stat) <> 0) then X`09 prt_pac; X`09 if (uand(%X'0100',print_stat) <> 0) then X`09 prt_hp; X`09 if (uand(%X'0200',print_stat) <> 0) then X`09 prt_title; X`09 if (uand(%X'0400',print_stat) <> 0) then X`09 prt_level; X`09 end; X`09`7B Check light status `7D X`09with equipment`5BEquipment_light`5D do X`09 if (player_light) then X`09 if (p1 > 0) then X`09 begin X`09`09p1 := p1 - 1; X`09`09if (p1 = 0) then X`09`09 begin X`09`09 msg_print('Your light has gone out!'); X`09`09 player_light := false; X`09`09 find_flag := false; X`09`09 move_light(char_row,char_col,char_row,char_col); X`09`09 end X`09`09else if (p1 < 40) then X`09`09 if (randint(5) = 1) then X`09`09 begin X`09`09 if (find_flag) then X`09`09`09begin X`09`09`09 find_flag := false; X`09`09`09 move_light(char_row,char_col,char_row,char_col); X`09`09`09end; X`09`09 msg_print('Your light is growing faint.'); X`09`09 end; X`09 end X`09 else X`09 begin X`09`09player_light := false; X`09`09find_flag := false; X`09`09move_light(char_row,char_col,char_row,char_col); X`09 end X`09 else if (p1 > 0) then X`09 begin X`09 p1 := p1 - 1; X`09 player_light := true; X`09 move_light(char_row,char_col,char_row,char_col); X`09 end; X X`09`7B Update counters and messages`09`09`09`7D X`09with py.flags do X`09 begin X`09`09`7B Check food status `7D X`09 regen_amount := player$regen_normal; X`09 if ((hunger_item) and (food > (player_food_alert + 15))) then`20 X`09 food := player_food_alert + 15; X `09 if (food < player_food_alert) then X`09 begin X`09`09if (food < player_food_weak) then X`09`09 begin X`09`09 if (food < 0) then X`09`09 regen_amount := 0 X`09`09 else if (food < player_food_faint) then X`09`09 regen_amount := player$regen_faint X`09`09 else if (food < player_food_weak) then X`09`09 regen_amount := player$regen_weak; X`09`09 if (uand(%X'00000002',status) = 0) then X`09`09 begin X`09`09`09status := uor(%X'00000003',status); X`09`09`09msg_print('You are getting weak from hunger.'); X`09`09`09if (find_flag) then X`09`09`09 move_char(5); X`09`09`09prt_hunger; X`09`09`09py.misc.wt := py.misc.wt - trunc(py.misc.wt*0.015); X`09`09`09msg_print ( 'Your clothes seem to be getting loose.' ) ; X`09`09`09if py.misc.wt < min_allowable_weight then X`09`09`09 begin X`09`09`09 msg_print ( 'Oh no... Now you''ve done it.' ) ; X`09`09`09 death := true ; X`09`09`09 moria_flag := true ; X`09`09`09 total_winner := false ; X`09`09`09 died_from := 'starvation.' X`09`09`09 end ;`09 X`09`09 end; X`09`09 if (food < 0) then X`09`09 if (randint(5) = 1) then X`09`09`09begin X`09`09`09 paralysis := paralysis + randint(3); X`09`09`09 msg_print('You faint from the lack of food.'); X`09`09`09 if (find_flag) then X`09`09`09 move_char(5); X`09`09`09end X`09`09 else if (food < player_food_faint) then X`09`09 if (randint(8) = 1) then X`09`09`09begin X`09`09`09 paralysis := paralysis + randint(5); X`09`09`09 msg_print('You faint from the lack of food.'); X`09`09`09 if (find_flag) then X`09`09`09 move_char(5); X`09`09`09end; X`09`09 end X`09`09else X`09`09 begin X`09`09 if (uand(%X'00000001',status) = 0) then X`09`09 begin X`09`09`09status := uor(%X'00000001',status); X`09`09`09msg_print('You are getting hungry.'); X`09`09`09if (find_flag) then X`09`09`09 move_char(5); X`09`09`09prt_hunger; X`09`09 end; X`09`09 end; X`09 end; X`09`7B Food consumtion `7D X`09`7B Note: Speeded up characters really burn up the food! `7D X`09 if (speed < 0) then X`09 food := food - (speed*speed) - food_digested X`09 else X`09 food := food - food_digested; X`09`7B Regenerate `7D X`09 with py.misc do X`09 begin X`09`09if (regenerate) then regen_amount := regen_amount*1.5; X`09`09if (rest > 0) then regen_amount := regen_amount*2; X`09`09if (py.flags.poisoned < 1) then X`09`09 if (chp < mhp) then X`09`09 regenhp(regen_amount); X`09`09if (cmana < mana) then X`09`09 regenmana(regen_amount); X`09 end; X`09`7B Blindness `7D X`09 if (blind > 0) then X`09 begin X`09`09if (uand(%X'00000004',status) = 0) then X`09`09 begin X`09`09 status := uor(%X'00000004',status); X`09`09 prt_map; X`09`09 prt_blind; X`09`09 if (search_flag) then X`09`09 search_off; X`09`09 end; X`09`09blind := blind - 1; X`09`09if (blind = 0) then X`09`09 begin X`09`09 status := uand(%X'FFFFFFFB',status); X`09`09 prt_blind; X`09`09 prt_map; X`09`09 msg_print('The veil of darkness lifts.'); X`09`09 if (find_flag) then X`09`09 move_char(5); X`09`09 end; +-+-+-+-+-+-+-+- END OF PART 23 +-+-+-+-+-+-+-+-