REM Bernie PROC main: GLOBAL d%(31),d$(31,30),o%(20),o$(20,20),p%,i$(100),c%,t%(12),sc%,o$(100),go%,f%,l%,info%(32),tp%,lev% LOADM "Objects" LOADM "Level"+NUM$(lev%,1) init: inito: initt: score: disp: intro: DO print: input: UNTIL 0 ENDP PROC init: STATUSWIN ON FONT 1,0 f%=8 font: l%=1 p%=1 sc%=-1 ENDP PROC score: sc%=sc%+1 ENDP PROC disp: DIAMINIT 1,"Score:",NUM$(sc%,6),"Turns:",NUM$(go%,6) DIAMPOS 0 ENDP PROC intro: out:("You are Bernard (but you prefer to be called Bernie) and it came as no great surprise to you when Zames started another plan for world domination.") out:("As if that wasn't enough the local weatherman has turned into a demented tyrant, bent on taking over the world's atmosphere. Your amplifier is broken, you've got to go to your girlfriend's concert and you can't find any damn fish food...") out:("") ENDP PROC wait: BUSY "Press a key..." GET BUSY OFF ENDP PROC print: LOCAL a%,b% IF d%(p%) :out:(d$(p%)) ELSE :long: :d%(p%)=1 ENDIF a%=1: b%=0 DO IF o%(a%)=lev%*100+p% IF b%=0 :out:("You can see the following:") :b%=1 :ENDIF out:(o$(a%)) ENDIF a%=a%+1 UNTIL a%>20 ENDP PROC input: c%=0 DO in: l%=1 parse: UNTIL c% ENDP PROC parse: i$=LOWER$(i$) o$=RIGHT$(i$,LEN(i$)-LOC(i$," ")) go%=go%+1 IF i$="n" OR i$="north" :gn: ELSEIF i$="w" OR i$="west" :gw: ELSEIF i$="s" OR i$="south" :gs: ELSEIF i$="e" OR i$="east" :ge: ELSEIF i$="d" OR i$="down" :gd: ELSEIF i$="u" OR i$="up" :gu: ELSEIF i$="l" OR i$="look" :d%(p%)=0 :c%=1 ELSEIF LEFT$(i$,4)="get " OR LEFT$(i$,5)="take " OR LEFT$(i$,5)="wear " :get: ELSEIF LEFT$(i$,5)="drop " :drop: ELSEIF i$="i" OR i$="inventory" :inv: ELSEIF LEFT$(i$,2)="x " OR LEFT$(i$,8)="examine " OR LEFT$(i$,8)="look at " :x: ELSEIF LEFT$(i$,4)="use " :use: ELSEIF LEFT$(i$,4)="eat " OR LEFT$(i$,6)="drink " :eat: ELSEIF LEFT$(i$,4)="say " :say: ELSEIF i$="" :out:("Typing something would help...") :go%=go%-1 ELSE out:("I don't understand '"+i$+"'") :go%=go%-1 ENDIF IF tp% :nextlev: :tp%=0 :ENDIF disp: ENDP PROC nogo: out:("You can't go that way") c%=0 ENDP PROC get: LOCAL a%,b% a%=1 :b%=0 DO IF o%(a%)=lev%*100+p% AND o$(a%)=o$ o%(a%)=-1 out:("Taken") b%=1 ENDIF a%=a%+1 UNTIL a%>20 OR b% IF b%=0 :out:("There doesn't seem to be anything like that here") :ENDIF ENDP PROC drop: LOCAL a%,b% a%=1 :b%=0 DO IF o%(a%)=-1 AND o$(a%)=o$ o%(a%)=lev%*100+p% out:("Dropped") b%=1 ENDIF a%=a%+1 UNTIL a%>20 OR b% IF b%=0 :out:("You don't seem to have anything like that") :ENDIF ENDP PROC inv: LOCAL a%,b% a%=1 DO IF o%(a%)=-1 IF b%=0 :out:("You are carrying the following:") :b%=1 :ENDIF out:(o$(a%)) ENDIF a%=a%+1 UNTIL a%>20 IF b%=0: out:("You are not carrying anything") :ENDIF ENDP PROC x: LOCAL a%,b% a%=1 :b%=0 DO IF (o%(a%)=-1 OR o%(a%)=lev%*100+p%) AND o$(a%)=o$ xo:(a%) b%=1 ENDIF a%=a%+1 UNTIL a%>20 OR b% IF b%=0 :out:("There doesn't seem to be anything like that around") :ENDIF ENDP PROC use: LOCAL a%,b% a%=1 :b%=0 DO IF (o%(a%)=-1 OR o%(a%)=lev%*100+p%) AND o$(a%)=o$ useo:(a%) b%=1 ENDIF a%=a%+1 UNTIL a%>20 OR b% IF b%=0 :out:("There doesn't seem to be anything like that around") :ENDIF ENDP PROC eat: LOCAL a%,b% a%=1 :b%=0 DO IF (o%(a%)=-1 OR o%(a%)=lev%*100+p%) AND o$(a%)=o$ eato:(a%) b%=1 ENDIF a%=a%+1 UNTIL a%>20 OR b% IF b%=0 :out:("There doesn't seem to be anything like that around") :ENDIF ENDP PROC end: out:("") out:("GAME OVER") out:("Your score was "+NUM$(sc%,10)) out:("") out:("") BUSY "Press a key to exit" GET STOP ENDP PROC win: out:("") out:("GAME COMPLETED") out:("Your score was "+NUM$(sc%,10)) out:("") out:("") BUSY "Press a key to exit" GET STOP ENDP PROC nextlev: LOCAL a% UNLOADM "Level"+NUM$(lev%,1) lev%=lev%+1 LOADM "Level"+NUM$(lev%,1) p%=1 initt: a%=1 :DO :d%(a%)=0 :a%=a%+1 :UNTIL a%=32 a%=1 :DO :t%(a%)=0 :a%=a%+1 :UNTIL a%=13 c%=1 ENDP PROC out:(text$) LOCAL t$(255),space%,w$(100),c$(1),swidth% t$=text$ swidth%=gTWIDTH(" ") l%=l%+1 IF l%*(info%(3)+4)>gHEIGHT :wait: :l%=2 :ENDIF gSCROLL 0,-(info%(3)+4) gAT 2,gHEIGHT-(info%(4)+2) DO space%=LOC(t$," ") IF space% w$=LEFT$(t$,space%-1) t$=RIGHT$(t$,LEN(t$)-space%) ELSE w$=t$ t$="" ENDIF c$=LEFT$(w$,1) IF c$="*" :gSTYLE 1 :w$=RIGHT$(w$,LEN(w$)-1) ELSEIF c$="/" :gSTYLE 32 :w$=RIGHT$(w$,LEN(w$)-1) ELSEIF c$="+" :gSTYLE 33 :w$=RIGHT$(w$,LEN(w$)-1) ELSEIF c$="#" :gSTYLE 0 :w$=RIGHT$(w$,LEN(w$)-1) ENDIF IF w$>"" AND gX+gTWIDTH(w$)>gWIDTH l%=l%+1 IF l%*(info%(3)+4)>gHEIGHT :wait: :l%=2 :ENDIF gSCROLL 0,-(info%(3)+4) gAT 2,gHEIGHT-(info%(4)+2) ENDIF gPRINT w$+" " UNTIL t$="" ENDP PROC in: LOCAL w%,g% l%=1 out:(">") w%=gTWIDTH(">") i$="" gSTYLE 1 DO gAT 4+w%,gY gPRINTB i$,gWIDTH g%=GET IF g%=8 IF i$>"" :i$=LEFT$(i$,LEN(i$)-1) :ENDIF ELSEIF g%>31 AND g%<256 i$=i$+CHR$(g%) ELSEIF g%=292 IF f%>8 :f%=f%-4 :ELSE :f%=f%+4 :ENDIF font: out:(">") w%=gTWIDTH(">") gSTYLE 1 ELSEIF g%=634 f%=f%+1 IF f%=9 :f%=5 :ELSEIF f%=13 :f%=9 :ENDIF font: out:(">") w%=gTWIDTH(">") gSTYLE 1 ENDIF UNTIL g%=13 gSTYLE 0 ENDP PROC font: gFONT f% gSTYLE 0 gCLS gINFO info%() l%=1 ENDP