/[james]/archive/bernie/Bernie.opl
ViewVC logotype

Contents of /archive/bernie/Bernie.opl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 23 - (show annotations) (download)
Thu Mar 13 12:07:05 2003 UTC (21 years, 9 months ago) by james
File size: 5521 byte(s)
Initial import.

1 REM Bernie
2
3 PROC main:
4 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%
5 LOADM "Objects"
6 LOADM "Level"+NUM$(lev%,1)
7 init:
8 inito:
9 initt:
10 score:
11 disp:
12 intro:
13 DO
14 print:
15 input:
16 UNTIL 0
17 ENDP
18
19 PROC init:
20 STATUSWIN ON
21 FONT 1,0
22 f%=8
23 font:
24 l%=1
25 p%=1
26 sc%=-1
27 ENDP
28
29 PROC score:
30 sc%=sc%+1
31 ENDP
32
33 PROC disp:
34 DIAMINIT 1,"Score:",NUM$(sc%,6),"Turns:",NUM$(go%,6)
35 DIAMPOS 0
36 ENDP
37
38 PROC intro:
39 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.")
40 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...")
41 out:("")
42 ENDP
43
44 PROC wait:
45 BUSY "Press a key..."
46 GET
47 BUSY OFF
48 ENDP
49
50 PROC print:
51 LOCAL a%,b%
52 IF d%(p%) :out:(d$(p%))
53 ELSE :long: :d%(p%)=1
54 ENDIF
55 a%=1: b%=0
56 DO
57 IF o%(a%)=lev%*100+p%
58 IF b%=0 :out:("You can see the following:") :b%=1 :ENDIF
59 out:(o$(a%))
60 ENDIF
61 a%=a%+1
62 UNTIL a%>20
63 ENDP
64
65 PROC input:
66 c%=0
67 DO
68 in:
69 l%=1
70 parse:
71 UNTIL c%
72 ENDP
73
74 PROC parse:
75 i$=LOWER$(i$)
76 o$=RIGHT$(i$,LEN(i$)-LOC(i$," "))
77 go%=go%+1
78 IF i$="n" OR i$="north" :gn:
79 ELSEIF i$="w" OR i$="west" :gw:
80 ELSEIF i$="s" OR i$="south" :gs:
81 ELSEIF i$="e" OR i$="east" :ge:
82 ELSEIF i$="d" OR i$="down" :gd:
83 ELSEIF i$="u" OR i$="up" :gu:
84 ELSEIF i$="l" OR i$="look" :d%(p%)=0 :c%=1
85 ELSEIF LEFT$(i$,4)="get " OR LEFT$(i$,5)="take " OR LEFT$(i$,5)="wear " :get:
86 ELSEIF LEFT$(i$,5)="drop " :drop:
87 ELSEIF i$="i" OR i$="inventory" :inv:
88 ELSEIF LEFT$(i$,2)="x " OR LEFT$(i$,8)="examine " OR LEFT$(i$,8)="look at " :x:
89 ELSEIF LEFT$(i$,4)="use " :use:
90 ELSEIF LEFT$(i$,4)="eat " OR LEFT$(i$,6)="drink " :eat:
91 ELSEIF LEFT$(i$,4)="say " :say:
92 ELSEIF i$="" :out:("Typing something would help...") :go%=go%-1
93 ELSE out:("I don't understand '"+i$+"'") :go%=go%-1
94 ENDIF
95 IF tp% :nextlev: :tp%=0 :ENDIF
96 disp:
97 ENDP
98
99 PROC nogo:
100 out:("You can't go that way")
101 c%=0
102 ENDP
103
104 PROC get:
105 LOCAL a%,b%
106 a%=1 :b%=0
107 DO
108 IF o%(a%)=lev%*100+p% AND o$(a%)=o$
109 o%(a%)=-1
110 out:("Taken")
111 b%=1
112 ENDIF
113 a%=a%+1
114 UNTIL a%>20 OR b%
115 IF b%=0 :out:("There doesn't seem to be anything like that here") :ENDIF
116 ENDP
117
118 PROC drop:
119 LOCAL a%,b%
120 a%=1 :b%=0
121 DO
122 IF o%(a%)=-1 AND o$(a%)=o$
123 o%(a%)=lev%*100+p%
124 out:("Dropped")
125 b%=1
126 ENDIF
127 a%=a%+1
128 UNTIL a%>20 OR b%
129 IF b%=0 :out:("You don't seem to have anything like that") :ENDIF
130 ENDP
131
132 PROC inv:
133 LOCAL a%,b%
134 a%=1
135 DO
136 IF o%(a%)=-1
137 IF b%=0 :out:("You are carrying the following:") :b%=1 :ENDIF
138 out:(o$(a%))
139 ENDIF
140 a%=a%+1
141 UNTIL a%>20
142 IF b%=0: out:("You are not carrying anything") :ENDIF
143 ENDP
144
145 PROC x:
146 LOCAL a%,b%
147 a%=1 :b%=0
148 DO
149 IF (o%(a%)=-1 OR o%(a%)=lev%*100+p%) AND o$(a%)=o$
150 xo:(a%)
151 b%=1
152 ENDIF
153 a%=a%+1
154 UNTIL a%>20 OR b%
155 IF b%=0 :out:("There doesn't seem to be anything like that around") :ENDIF
156 ENDP
157
158 PROC use:
159 LOCAL a%,b%
160 a%=1 :b%=0
161 DO
162 IF (o%(a%)=-1 OR o%(a%)=lev%*100+p%) AND o$(a%)=o$
163 useo:(a%)
164 b%=1
165 ENDIF
166 a%=a%+1
167 UNTIL a%>20 OR b%
168 IF b%=0 :out:("There doesn't seem to be anything like that around") :ENDIF
169 ENDP
170
171 PROC eat:
172 LOCAL a%,b%
173 a%=1 :b%=0
174 DO
175 IF (o%(a%)=-1 OR o%(a%)=lev%*100+p%) AND o$(a%)=o$
176 eato:(a%)
177 b%=1
178 ENDIF
179 a%=a%+1
180 UNTIL a%>20 OR b%
181 IF b%=0 :out:("There doesn't seem to be anything like that around") :ENDIF
182 ENDP
183
184 PROC end:
185 out:("")
186 out:("GAME OVER")
187 out:("Your score was "+NUM$(sc%,10))
188 out:("")
189 out:("")
190 BUSY "Press a key to exit"
191 GET
192 STOP
193 ENDP
194
195 PROC win:
196 out:("")
197 out:("GAME COMPLETED")
198 out:("Your score was "+NUM$(sc%,10))
199 out:("")
200 out:("")
201 BUSY "Press a key to exit"
202 GET
203 STOP
204 ENDP
205
206 PROC nextlev:
207 LOCAL a%
208 UNLOADM "Level"+NUM$(lev%,1)
209 lev%=lev%+1
210 LOADM "Level"+NUM$(lev%,1)
211 p%=1
212 initt:
213 a%=1 :DO :d%(a%)=0 :a%=a%+1 :UNTIL a%=32
214 a%=1 :DO :t%(a%)=0 :a%=a%+1 :UNTIL a%=13
215 c%=1
216 ENDP
217
218 PROC out:(text$)
219 LOCAL t$(255),space%,w$(100),c$(1),swidth%
220 t$=text$
221 swidth%=gTWIDTH(" ")
222 l%=l%+1
223 IF l%*(info%(3)+4)>gHEIGHT :wait: :l%=2 :ENDIF
224 gSCROLL 0,-(info%(3)+4)
225 gAT 2,gHEIGHT-(info%(4)+2)
226 DO
227 space%=LOC(t$," ")
228 IF space%
229 w$=LEFT$(t$,space%-1)
230 t$=RIGHT$(t$,LEN(t$)-space%)
231 ELSE
232 w$=t$
233 t$=""
234 ENDIF
235 c$=LEFT$(w$,1)
236 IF c$="*" :gSTYLE 1 :w$=RIGHT$(w$,LEN(w$)-1)
237 ELSEIF c$="/" :gSTYLE 32 :w$=RIGHT$(w$,LEN(w$)-1)
238 ELSEIF c$="+" :gSTYLE 33 :w$=RIGHT$(w$,LEN(w$)-1)
239 ELSEIF c$="#" :gSTYLE 0 :w$=RIGHT$(w$,LEN(w$)-1)
240 ENDIF
241 IF w$>"" AND gX+gTWIDTH(w$)>gWIDTH
242 l%=l%+1
243 IF l%*(info%(3)+4)>gHEIGHT :wait: :l%=2 :ENDIF
244 gSCROLL 0,-(info%(3)+4)
245 gAT 2,gHEIGHT-(info%(4)+2)
246 ENDIF
247 gPRINT w$+" "
248 UNTIL t$=""
249 ENDP
250
251 PROC in:
252 LOCAL w%,g%
253 l%=1
254 out:(">")
255 w%=gTWIDTH(">")
256 i$=""
257 gSTYLE 1
258 DO
259 gAT 4+w%,gY
260 gPRINTB i$,gWIDTH
261 g%=GET
262 IF g%=8
263 IF i$>"" :i$=LEFT$(i$,LEN(i$)-1) :ENDIF
264 ELSEIF g%>31 AND g%<256
265 i$=i$+CHR$(g%)
266 ELSEIF g%=292
267 IF f%>8 :f%=f%-4 :ELSE :f%=f%+4 :ENDIF
268 font:
269 out:(">")
270 w%=gTWIDTH(">")
271 gSTYLE 1
272 ELSEIF g%=634
273 f%=f%+1
274 IF f%=9 :f%=5 :ELSEIF f%=13 :f%=9 :ENDIF
275 font:
276 out:(">")
277 w%=gTWIDTH(">")
278 gSTYLE 1
279 ENDIF
280 UNTIL g%=13
281 gSTYLE 0
282 ENDP
283
284 PROC font:
285 gFONT f%
286 gSTYLE 0
287 gCLS
288 gINFO info%()
289 l%=1
290 ENDP
291

  ViewVC Help
Powered by ViewVC 1.1.26