-+-+-+-+-+-+-+-+ START OF PART 8 -+-+-+-+-+-+-+-+ X loop := 0; X repeat X loop := loop + 1; X lib$wait(0.05); X open (high_f,high,history:=old,error:=continue); X until (status (high_f) = 3) or (status (high_f) = 0) or (loop = 100); X X if not (loop = 100) then X begin X if status (high_f) = 3 then `7Bif no existing file, create one`7D X begin X open (high_f,high,history:=new,error:=continue); X rewrite (high_f); X for loop := 1 to history do X begin X high_r`5Bloop`5D.score := 0; X high_r`5Bloop`5D.games := 0; X high_r`5Bloop`5D.level := 0; X high_r`5Bloop`5D.alias := ' '; X high_r`5Bloop`5D.user := ' '; X write (high_f,high_r`5Bloop`5D); X end; X end; X player.games := 1; X games := 1; X X reset (high_f); X X for loop := 1 to 30 do `7Binitialize player.alias to null string`7D X player.alias `5Bloop`5D := chr(32); X X count := 0; X for loop := 1 to history do `7Bcheck to see if already on HS, add 1 to g Vames`7D X begin X read (high_f,high_r`5Bloop`5D); X if (w.score > high_r`5Bloop`5D.score) and not (loop > 10) then X count := count + 1; X if high_r`5Bloop`5D.user = w.user then X begin X player.games := high_r`5Bloop`5D.games + 1; X player.level := high_r`5Bloop`5D.level; X player.score := high_r`5Bloop`5D.score; X player.alias := high_r`5Bloop`5D.alias; X games := high_r`5Bloop`5D.games + 1; X if high_r`5Bloop`5D.score >= w.score then DEJAVU := True; X end; X if high_r`5Bloop`5D.score < w.score then POST := True; X end; X X if not DEJAVU and POST and (count > 0) then X POST := True X else X POST := False; X X if POST then X begin X close (high_f); `7Bget the hell out so other people can put up their n Vames`7D X loop := 1; X smg$create_virtual_display(5,30,highdisp,smg$m_border); X smg$paste_virtual_display(highdisp,pasty,round((sheight-5)/2),round((s Vwidth-30)/2),); X smg$put_line (highdisp,'Hey You made it in the top 10!',2,smg$m_underl Vine); X smg$put_line (highdisp,' Put in your name dude!',2,smg$m_blink); X smg$put_line (highdisp,player.alias); X smg$set_cursor_abs (highdisp,5,1); X repeat X smg$read_keystroke(keyboard,temp,,); X smg$begin_pasteboard_update (pasty); X if (temp > smg$k_trm_us) and (temp < smg$k_trm_delete) then X begin X if not (loop > 30) then player.alias `5Bloop`5D := chr(temp); X loop := loop + 1; X if loop > 31 then loop := 31; X end; X if (temp = smg$k_trm_delete) or (temp = smg$k_trm_ctrlh) then X begin X if (loop-1) > 0 then player.alias `5Bloop-1`5D := chr(32); X loop := loop - 1; X if loop < 1 then loop := 1; X end; X if (temp = smg$k_trm_right) then X begin X loop := loop + 1; X if loop > 31 then loop := 31; X end; X if (temp = smg$k_trm_left) then X begin X loop := loop - 1; X if loop < 1 then loop := 1; X end; X smg$put_chars (highdisp,player.alias,5,1); X smg$end_pasteboard_update (pasty); X smg$set_cursor_abs (highdisp,5,loop); X until temp = smg$k_trm_ctrlm; X center (player.alias); X smg$delete_virtual_display(highdisp); X repeat `7Breopen file to write`7D X lib$wait(0.05); X open (high_f,high,history:=old,error:=continue); X until status (high_f) = 0; X player.score := w.score; X player.user := w.user; X player.level := w.level; X end; X player.user := w.user; X X reset (high_f); X for loop := 1 to history do X read (high_f,high_r`5Bloop`5D); X X rewrite (high_f); X loop := 0; X repeat `7Bwrite out higher scores, then his score`7D X loop := loop + 1; X if player.score > high_r`5Bloop`5D.score then X write (high_f,player) X else X begin X if not (high_r`5Bloop`5D.user = player.user) then X write (high_f,high_r`5Bloop`5D); X end; X until (loop = history) or (player.score > high_r`5Bloop`5D.score); X X for loop2 := loop to history do `7Bfinish off the rest`7D X if not(player.user = high_r`5Bloop2`5D.user) then write (high_f,high_r V`5Bloop2`5D); X X reset (high_f); `7Bnow print out scores to screen`7D X X smg$create_virtual_display(14,54,highdisp,smg$m_border); X smg$paste_virtual_display(highdisp,pasty,round((sheight-14)/2),round((sw Vidth-54)/2),); X smg$put_line (highdisp,' ...Psychedelic...',2,smg$m_bli Vnk); X smg$put_line (highdisp,' score alias level acc Vount ',2,smg$m_underline); X for loop := 1 to 10 do X begin X read (high_f,player); X smg$put_line (highdisp,intstr(player.score)+' '+player.alias+intstr V(player.level)+' '+player.user,1); X end; X close (high_f); X write (chr(27),'`5B22;1HYour score was: ',w.score:3); X write (chr(27),'`5B23;1Hand your addiction is rated to be: '); X if games < 5 then writeln ('not a habit, yet'); X if (games > 4) and (games < 10) then writeln ('just a social thing'); X if (games > 9) and (games < 15) then writeln ('physical dependancy'); X if (games > 14) and (games < 20) then writeln ('junkie'); X if (games > 19) and (games < 25) then writeln ('you like it better than V sex'); X if (games > 24) and (games < 30) then writeln ('Betty Ford Clinic'); X if games > 29 then writeln ('Total Geek, GET A LIFE!!!'); X end X else X smg$put_chars(stat,' Bummer!! The high score file couldn''t V be opened!!! ',1,1,,smg$m_bold+smg$m_reverse) X Xend; X Xprocedure levelup ( A : string ); X Xvar X title1 : varying `5B19`5D of char; X title2 : varying `5B19`5D of char; X level_f : text; X charact : varying `5B1`5D of char; X tdisp : unsigned; X Xbegin X muno := 0; `7Bnumber of mushrooms`7D X loop := 0; X repeat X lib$wait (0.05); X loop := loop + 1; X open (level_f,A,history:=old,error:=continue); X until (status (level_f) = 0) or (loop = 100); X if not (status (level_f) = 0) then X begin X smg$put_chars (stat,' I am unable to access the file which con Vtains the level!!! ',1,1,,smg$m_blink+smg$m_reverse); X lib$wait (4); X smg$put_chars (stat,' I will attempt to make an ermergency save of your V game, check the level file!! ',1,1,,smg$m_blink+smg$m_reverse); X lib$wait (6); X save; X lib$wait (2); X smg$put_chars (stat,' Ignore the errors procedding this.....',1,1,smg$m_ Verase_to_eol,smg$m_bold); X writeln (chr(27),'`5B?25h'); X end; X reset (level_f); X readln (level_f,muno); X if muno > 20 then muno := 20; X smg$begin_pasteboard_update(pasty); X for loop := 1 to sheight do X begin X for loop2 := 1 to swidth do X begin X read (level_f,charact); X if charact = '#' then X begin X bump `5Bloop2,loop`5D := True; X smg$put_chars (display,wallseg,loop,loop2); X end; X end; X writeln; X readln (level_f); X end; X smg$end_pasteboard_update(pasty); X if SHOW then X begin X readln (level_f,title1); X readln (level_f,title2); X smg$create_virtual_display(2,19,tdisp,smg$m_border); X smg$paste_virtual_display(tdisp,pasty,(round((sheight-2)/2))+2,(round((s Vwidth-20)/2))+2,); X smg$put_line(tdisp,title1,1); X smg$put_line(tdisp,title2,1); X lib$wait(4); X smg$delete_virtual_display (tdisp); X end; X close (level_f); Xend; X Xprocedure clean; X Xbegin X for loop := 1 to swidth do X for loop2 := 1 to sheight do X bump `5Bloop,loop2`5D := False; Xend; X Xprocedure random ( var a : integer; X var b : integer ); X Xbegin X repeat X randomn := mth$random(seed); X a := 1+(round (randomn*(swidth-1))); X randomn := mth$random(seed); X b := 1+(round (randomn*(sheight-1))); X X until not bump`5Bw.mushx,w.mushy`5D; Xend; X Xprocedure erase; X Xbegin X w.point := w.point + 1; X if w.point > buf then w.point := 1; X w.histx`5Bw.point`5D := w.x; X w.histy`5Bw.point`5D := w.y; X if (w.point-w.lengw) > 0 then X begin X if (bump `5Bw.histx`5Bw.point-w.lengw`5D,w.histy`5Bw.point-w.lengw`5D`5D V) then X begin X if not ((w.x = w.histx`5B(w.point-w.lengw)`5D) and (w.y = w.histy`5B(w V.point-w.lengw)`5D)) then X smg$erase_chars (display,1,w.histy`5Bw.point-w.lengw`5D,w.histx`5Bw. Vpoint-w.lengw`5D); X bump `5Bw.histx`5Bw.point-w.lengw`5D,w.histy`5Bw.point-w.lengw`5D`5D : V= False; X w.histx`5Bw.point-w.lengw`5D := 0; X w.histy`5Bw.point-w.lengw`5D := 0; X end; X end X else X begin X if (bump `5Bw.histx`5Bbuf+(w.point-w.lengw)`5D,w.histy`5Bbuf+(w.point-w. Vlengw)`5D`5D) and`20 X not (w.histy`5Bbuf+(w.point-w.lengw)`5D = 0) and X not (w.histx`5Bbuf+(w.point-w.lengw)`5D = 0) then X begin X if not ((w.x = w.histx`5Bbuf+(w.point-w.lengw)`5D) and (w.y = w.hist Vy`5Bbuf+(w.point-w.lengw)`5D)) then X smg$erase_chars (display,1,w.histy`5Bbuf+(w.point-w.lengw)`5D,w.h Vistx`5Bbuf+(w.point-w.lengw)`5D); X bump `5Bw.histx`5Bbuf+(w.point-w.lengw)`5D,w.histy`5Bbuf+(w.point-w. Vlengw)`5D`5D := False; X w.histx `5Bbuf+(w.point-w.lengw)`5D := 0; X w.histy `5Bbuf+(w.point-w.lengw)`5D := 0; X end; X end; Xend; X Xprocedure splat; X Xbegin X if bump `5Bw.x,w.y`5D = True then DEAD := True; X bump `5Bw.x,w.y`5D := True; Xend; X Xprocedure yumyum; X Xbegin X if (w.mushx = w.x) and (w.mushy = w.y) then X begin X w.lengw := w.lengw + 10; X w.cur := w.cur + 1; X w.score := w.score + 10; X smg$put_chars (stat,'SCORE: '+substr(intstr(w.score),2,2),1,1); X smg$put_chars (stat,'SHROOMS TO EAT: '+substr(intstr(muno-w.cur),3,2),1, Vrights-18); X if not (w.cur = muno ) then X begin X random (w.mushx,w.mushy); X smg$put_chars (display,mushseg,w.mushy,w.mushx); X end; X end; Xend; X Xprocedure main; X Xbegin X if not STORED then X begin X for loop := 1 to 100 do X smg$read_keystroke(keyboard,temp,,0); X w.cur := 0; X w.lengw := 10; X w.point := 0; X lastkey := 1000; X w.x := round (swidth/2); X w.y := round (sheight/2); X smg$put_chars (display,'`5E',w.y,w.x); X bump `5Bw.x,w.y`5D := True; X random (w.mushx,w.mushy); X for loop := 1 to buf do X begin X w.histy`5Bloop`5D := 0; X w.histx`5Bloop`5D := 0; X end; X end; X smg$put_chars (display,mushseg,w.mushy,w.mushx); X smg$put_chars (stat,'SCORE: '+substr(intstr(w.score),2,2),1,1); X smg$put_chars (stat,'SHROOMS TO EAT: '+substr(intstr(muno-w.cur),3,2),1,ri Vghts-18); X X repeat X if (temp = smg$k_trm_ctrll) or (temp = smg$k_trm_ctrlw) then smg$repaint V_screen (pasty); X if STORED then X begin X lib$wait (1.5); X if (round (swidth/2) = w.x) and (round (sheight/2) = w.y) then X smg$put_chars (display,'`5E',w.y,w.x) X else X smg$put_chars (display,wormseg,w.y,w.x) X end; X STORED := False; X if (lastkey = up) or (lastkey = down) then X lib$wait (0.3) X else X lib$wait (0.2); X smg$read_keystroke(keyboard,temp,,0); X if (temp = left) or (temp = right) or (temp = up) or (temp = down) then X lastkey := temp; X if not (lastkey = 1000) and not (temp = smg$k_trm_ctrlz) then X begin X if lastkey = up then w.y := w.y-1; X if lastkey = down then w.y := w.y+1; X if lastkey = left then w.x := w.x-1; X if lastkey = right then w.x := w.x+1; X smg$begin_pasteboard_update(pasty); X smg$put_chars (display,wormseg,w.y,w.x); X erase; X splat; X yumyum; X smg$end_pasteboard_update(pasty); X end; X if (w.x<1) or (w.y<1) or (w.x>swidth) or (w.y>sheight) then DEAD := True V; X until DEAD or (w.cur = muno) or (temp = smg$k_trm_ctrlz); X if temp = 26 then X begin X save; X w.lives := 0; X end X else X begin X if (w.x < 1) or (w.y < 1) or (w.x > swidth) or (w.y > sheight) then X begin X if w.x < 1 then w.x := 1; X if w.y < 1 then w.y := 1; X if w.x > swidth then w.x := swidth; X if w.y > sheight then w.y := sheight; X smg$put_chars (display,'*',w.y,w.x,,smg$m_bold); X lib$wait(1); X end X else X begin X if DEAD then X begin X smg$put_chars (display,'X',w.y,w.x,,smg$m_bold); X lib$wait(1); X end X else X begin X smg$put_chars (display,'URP!',w.y,w.x,,smg$m_bold); X lib$wait(2); X end; X end; X end; Xend; X Xbegin `7Bthis is not a procedure!`7D X writeln (chr(27),'`5B?25l'); `7Bturn the cursor off, smg$ is unreliable... V`7D X if (odd(cli$present('MAPKEY'))) then X begin X clistat := cli$get_value('MAPKEY',%descr mapkey); X up := ord (mapkey`5B1`5D); X right := ord (mapkey`5B2`5D); X down := ord (mapkey`5B3`5D); X left := ord (mapkey`5B4`5D); X end X else X begin X up := smg$k_trm_up; X right := smg$k_trm_right; X down := smg$k_trm_down; X left := smg$k_trm_left; X end; X X if (odd(cli$present('WALL'))) then X clistat := cli$get_value('WALL',wallseg) X else X wallseg := '`7C'; X if (odd(cli$present('MUSHROOM'))) then X clistat := cli$get_value('MUSHROOM',mushseg) X else X mushseg := '@'; X if (odd(cli$present('SEGMENT'))) then X clistat := cli$get_value('SEGMENT',wormseg) X else X wormseg := 'o'; X if (odd(cli$present('DIRECTORY'))) then X clistat := cli$get_value('DIRECTORY',%descr prefix) X else X prefix := prefixd; X X`7Bsetup seed for random selection of shrooms`7D X lib$date_time (%descr datestr); X datestr := (substr(datestr,22,2))+(substr(datestr,19,2))+(substr(datestr,1 V6,2)); X seed := 2*(strint (datestr))+1; X w.level := 0; X w.lives := 3; X w.score := 0; X DEAD := False; X SHOW := True; X lib$getjpi(jpi$_username,,,,%descr w.user); X smg$create_virtual_keyboard(keyboard,,,); X X `7Bdisplay 1`7D X smg$create_virtual_display(sheight,swidth,display,smg$m_border); X smg$create_pasteboard(pasty,,,);`20 X smg$paste_virtual_display(display,pasty,3,2,); +-+-+-+-+-+-+-+- END OF PART 8 +-+-+-+-+-+-+-+-