Compucolor.org – Virtual Media

Listing of file='DUNGEN.BAS;01' on disk='vmedia/games3-sector.ccvf'

1 CLEAR 1000
2 PLOT 15
3 REM  DUNGEON BY BILL AND ANTONY WOODS,18 GRACE AVE. BEECROFT
4 GOSUB 211:PLOT 12,3,26,15:PRINT "LOADING DATA":PLOT 3,64,0,30,16,29,22,15
5 GOSUB 400
6
7 POKE 33283,0:POKE 33284,191
8 PLOT 27,4:PRINT "LOA MONSTR.IMG":PLOT 27,27
9 DIM LD(18),MQ$(18),MN$(18)
10 FOR I= 1TO 16:READ NN,B$,A$
11 LD(I)= NN:MQ$(I)= B$:MN$(I)= A$:NEXT I
12 DATA  1,A,POISONED APPLE
13 DATA  2,A,ROARING VOLCANO
14 DATA  3,A,GIANT TOAD
15 DATA  4,A,JELLYFISH
16 DATA  5,AN,ELEPHANT
17 DATA  6,AN,EVIL WITCH
18 DATA  7,AN,EVIL SUN SPIRIT
19 DATA  8,A,UNICORN
20 DATA  9,A,WALRUS
21 DATA  10,A,WITCH'S OWL
22 DATA  12,A,PIRANHA
23 DATA  13,A,TORTURER
24 DATA  14,AN,EVIL WIZARD
25 DATA  17,AN,ICE MONSTER
26 DATA  19,A,WITCH'S CROW
27 DATA  26,AN,INVISIBLE NETMAN
28 PLOT 12,29,19:INPUT "ENTER SIZE OF DUNGEON ( X,Y ): ";MX,MY:MX= INT (MX)+ 1:MY= INT (MY)+ 1
29 PRINT :PRINT :INPUT "ENTER YOUR NAME: ";NA$
30 RS= PEEK (33209)+ PEEK (33210):IF RS= 0THEN 30
31 N= RND (- RS)
32 XT= 2:YT= 2
33 HY= 1:TR= 2000
34 EL= MY/ 2:MO= INT (SQR (MX+ MY)/ 4+ .8)
35 PLOT 12,3,0,31:PRINT "########## PLEASE WAIT WHILE I BUILD THE DUNGEON ##########"
36 PLOT 30,16
37 PLOT 27,88:PLOT 15
38 RESTORE 209
39 DIM DE(200),DC(200),DX(200),DT(200)
40 DE(0)= 1:DX(0)= 1:DC(0)= 18
41 DIM A(MX+ 2,MY+ 2),CX(24),CY(24):FOR X= 1TO 24:READ CX(X),CY(X):NEXT X
42 DEF FN R(RN)= INT (RN* RND (1))
43 A(1,1)= 1
44 PLOT 30,18,3,1,1,32,30,17,29,23
45 X= 1:Y= 1
46 IF X+ Y= 3THEN 81
47 IF RND (1)> .7THEN SD= SD+ 1:IF SD< 7THEN D= LD:GOSUB 59:IF GM= 1THEN 50
48 SD= 0:D= FN R(4)
49 GOSUB 59
50 IF GM= 1AND TX< MXAND TX> - 1AND TY< MYAND TY> - 1THEN 53
51 NM= NM+ 1:IF NM> 4THEN NM= 0:GOTO 67
52 GOTO 46
53 A(TX,TY)= 1:X= TX:Y= TY:PLOT 3,X,Y,32
54 LD= D
55 NM= 0
56 IF EF= 0AND X= (MX- 1)AND Y> ELTHEN 64
57 GOTO 46
58 REM  165-190 PRE-CHECKS DIRECTION BEFORE TESTING FOR GM
59 IF D= 0AND X< MXAND Y> 0THEN GOSUB 84:RETURN
60 IF D= 1AND X> 0AND Y< (MY- 1)THEN GOSUB 87:RETURN
61 IF D= 2AND X> 1AND Y> 0THEN GOSUB 90:RETURN
62 IF D= 3AND Y> 1AND X> 0THEN GOSUB 93:RETURN
63 RETURN
64 EF= 1:DE(HY)= X:DX(HY)= Y:DC(HY)= INT (5* RND (1)+ 19):HY= HY+ 1
65 EX= X:EY= Y
66 REM  THIS ROUTINE STARTS A NEW CORRIDOR AFTER ONE DEAD-ENDS
67 DE(HY)= X:DX(HY)= Y:DC(HY)= INT (5* RND (1)+ 19):HY= HY+ 1
68 FOR XT= XTTO (MX- 2):FOR YT= YTTO (MY- 2)
69 PLOT 3,XT,YT,42
70 IF A(XT,YT)= 1THEN X= XT:Y= YT:GOTO 73
71 PLOT 30,16,3,XT,YT,32,17
72 GOTO 78
73 GOSUB 84:IF GM= 1THEN D= 0:GOTO 49
74 GOSUB 87:IF GM= 1THEN D= 1:GOTO 49
75 GOSUB 90:IF GM= 1THEN D= 2:GOTO 49
76 GOSUB 93:IF GM= 1THEN D= 3:GOTO 49
77 PLOT 3,XT,YT,32
78 NEXT YT:YT= 2:NEXT XT
79 IF EF= 0THEN PLOT 30,16,29,17,12:PRINT "PROGRAM ERROR - NO END":END
80 GOTO 106
81 IF X= 2THEN D= 1:GOTO 49
82 D= 0:GOTO 49
83 REM  LINES 1000-4000 CHECK IF A DIRECTION IS VALID
84 T= A(X+ 1,Y+ 1)+ A(X+ 2,Y+ 1)+ A(X+ 1,Y)+ A(X+ 2,Y)+ A(X+ 1,Y- 1)+ A(X+ 2,Y- 1):IF T= 0THEN 86
85 GM= 0:RETURN
86 GM= 1:TX= X+ 1:TY= Y:RETURN
87 T= A(X- 1,Y+ 1)+ A(X- 1,Y+ 2)+ A(X,Y+ 1)+ A(X,Y+ 2)+ A(X+ 1,Y+ 1)+ A(X+ 1,Y+ 2):IF T= 0THEN 89
88 GM= 0:RETURN
89 GM= 1:TX= X:TY= Y+ 1:RETURN
90 T= A(X- 2,Y+ 1)+ A(X- 1,Y+ 1)+ A(X- 2,Y)+ A(X- 1,Y)+ A(X- 2,Y- 1)+ A(X- 1,Y- 1):IF T= 0THEN 92
91 GM= 0:RETURN
92 GM= 1:TX= X- 1:TY= Y:RETURN
93 T= A(X- 1,Y- 1)+ A(X- 1,Y- 2)+ A(X,Y- 1)+ A(X,Y- 2)+ A(X+ 1,Y- 1)+ A(X+ 1,Y- 2):IF T= 0THEN 95
94 GM= 0:RETURN
95 GM= 1:TX= X:TY= Y- 1:RETURN
96 PLOT 30,16,12,17
97 FOR Y2= 1TO MY:FOR X2= 1TO MX
98 IF A(X2,Y2)> 0THEN PLOT 32:GOTO 100
99 PLOT 25
100 NEXT X2:PLOT 13,10
101 IF MX= 64THEN PLOT 28
102 NEXT Y2
103 PLOT 30,18,8:PRINT " ":FOR DF= 1TO HY- 1:PLOT 30,DC(DF),3,DE(DF)- 1,DX(DF)- 1:PRINT " ":NEXT DF
104 PLOT 30,16,29,17
105 RETURN
106 REM  START GAME
107 FOR DF= 1TO HY- 1:PLOT 30,DC(DF),3,DE(DF),DX(DF),32:NEXT DF
108 FOR X= 1TO 3000:NEXT X
109 PLOT 30,16,29,17
110 PLOT 12
111 X= 1:Y= 1
112 IF A(1,2)= 1THEN XD= 0:YD= 1:GOTO 114
113 IF A(2,1)= 1THEN XD= 1:YD= 0
114 REM  CONTINUE HERE
115
116
117 IF XD= 1THEN LX= 0:LY= - 1:RX= 0:RY= 1:DR$= "EAST"
118 IF XD= - 1THEN LX= 0:LY= 1:RX= 0:RY= - 1:DR$= "WEST"
119 IF YD= 1THEN LX= 1:LY= 0:RX= - 1:RY= 0:DR$= "SOUTH"
120 IF YD= - 1THEN LX= - 1:LY= 0:RX= 1:RY= 0:DR$= "NORTH"
121 PLOT 3,22,31,29,19:PRINT "YOU ARE GOING ";DR$;""
122 REM  CORRIDOR DISPLAY ROUT.  PH IS PHASE, N IS CORRIDOR SEGMENT
123 FOR PH= 1TO 2
124 FOR N= 1TO 5
125 PLOT 17
126 P1= 2* N- (PH- 1):P2= 2* (N+ 1)- (PH- 1)
127 P3= 25- P1:P4= 25- P2
128 XF= XD* (N- 1):YF= YD* (N- 1)
129 IF A(X+ XF,Y+ YF)= 0THEN 138
130 IF FP= 1AND A(X+ XF,Y+ YF)= 1.5THEN GOSUB 207
131 PLOT 17
132 IF PH= 5THEN END
133 IF A(X+ XF+ LX,Y+ YF+ LY)> 0THEN GOSUB 202:GOTO 135
134 GOSUB 203
135 IF A(X+ XF+ RX,Y+ YF+ RY)> 0THEN GOSUB 205:GOTO 137
136 GOSUB 206
137 IF A(X+ XF,Y+ YF)> 0THEN 143
138 FOR XX= 0TO HY- 1:IF X+ XD* (N- 2)= DE(XX)AND Y+ YD* (N- 2)= DX(XX)THEN PLOT DC(XX):GOTO 140
139 NEXT XX:XX= 0
140 P1= P1- 2:P2= P2- 2:P3= P3+ 2:P4= P4+ 2
141 GOSUB 204
142 GOTO 144
143 NEXT N
144 IF PH= 1THEN 149
145 FOR TT= 1TO 150
146 NEXT TT:PLOT 12:NEXT PH:A(X,Y)= 1.5:X= X+ XD:Y= Y+ YD:GOTO 114
147 GOTO 149
148 REM  12000-12900 CHECKS TURNS, ALLOWS PLAYER TO SEE MAP
149 R$= "":L$= "":F$= "":B$= "":M$= "":Q$= ""
150 XF= XD:YF= YD
151 IF A(X,Y)= 2THEN 147
152 IF A(X+ LX,Y+ LY)> 0THEN L$= "LEFT "
153 IF A(X+ RX,Y+ RY)> 0THEN R$= "RIGHT "
154 IF A(X+ XF,Y+ YF)> 0THEN F$= "STRAIGHT "
155 IF A(X- XF,Y- YF)> 0THEN B$= "BACKWARDS "
156 IF XX> 0AND F$= ""THEN M$= "OR FIGHT MONSTER"
157 IF L$= ""AND R$= ""AND F$< > ""THEN 145
158 Q$= "QUIT "
159 TM= TM+ 1
160 FOR PY= 27TO 31:PLOT 3,0,PY:PLOT 11:NEXT PY:PLOT 3,0,28
161
162 PLOT 8
163 PRINT "THE WALL YOU ARE FACING IS LOCATED AT "X+ XD* (N- 2)","Y+ YD* (N- 2)
164 IF B$< > ""AND F$= ""AND L$= ""AND R$= ""AND M$= ""THEN 339
165 TR= TR- 20:IF TR< 0THEN 288
166 IF DC(XX)= 17THEN M$= ""
167 PLOT 3,0,26,19:PRINT "YOUR TREASURE AMOUNTS TO "TR" GOLD PIECES"
168 PLOT 3,0,30,19:PRINT "PRESS 'M' FOR MAP"
169 POKE 33278,0
170 PLOT 3,0,28,19:PRINT "DO YOU WANT TO GO ";Q$;L$;R$;F$;B$;M$;"?";
171 BN= PEEK (33278):IF BN= 0THEN 171
172 D$= CHR$ (BN)
173 PRINT :IF D$= "M"THEN 186
174 IF D$= "F"THEN 230
175 IF D$< > "L"AND D$< > "R"AND D$< > "S"AND D$< > "B"AND D$< > "F"AND D$< > "Q"THEN 160
176 IF D$= "L"AND L$= ""THEN 160
177 IF D$= "R"AND R$= ""THEN 160
178 IF D$= "S"AND F$= ""THEN 160
179 IF D$= "B"AND B$= ""THEN 160
180 IF D$= "F"AND M$= ""THEN 160
181 IF D$= "B"THEN 192
182 IF D$= "L"THEN 194
183 IF D$= "R"THEN 196
184 IF D$= "Q"THEN PLOT 1
185 GOTO 198
186 MT= MT+ 1
187 GOSUB 96
188 PLOT 3,20,31:INPUT "PRESS RETURN TO CONTINUE:";E$
189
190 RD= 1
191 PLOT 12:GOTO 123
192 XD= - XD:YD= - YD
193 GOSUB 199:GOTO 114
194 XD= LX:YD= LY
195 GOSUB 199:GOTO 114
196 XD= RX:YD= RY
197 GOSUB 199:GOTO 114
198 GOTO 145
199 FOR EL= 0TO 26:PLOT 3,0,EL:PLOT 11:NEXT EL:RETURN
200 REM  15000-15800 DISPLAY THE '3-D' CORRIDOR USING THE
201 REM  COORDINATES STORED IN THE CX & CY ARRAYS
202 PLOT 2,CX(P1),CY(P2),242,CX(P2),CY(P2),CX(P2),CY(P4),CX(P1),CY(P4),255:RETURN
203 PLOT 2,CX(P1),CY(P1),242,CX(P2),CY(P2),CX(P2),CY(P4),CX(P1),CY(P3),255:RETURN
204 PLOT 2,CX(P2),CY(P2),242,CX(P4),CY(P2),CX(P4),CY(P4),CX(P2),CY(P4),CX(P2),CY(P2),255:RETURN
205 PLOT 2,CX(P3),CY(P2),242,CX(P4),CY(P2),CX(P4),CY(P4),CX(P3),CY(P4),255:RETURN
206 PLOT 2,CX(P3),CY(P1),242,CX(P4),CY(P2),CX(P4),CY(P4),CX(P3),CY(P3),255:RETURN
207 RETURN
208 PRINT "ERROR-1";N;"":END
209 DATA 0,126,0,126,10,118,21,110,30,103,37,97,44,91,49,87,54,83,57,81,61,77,64,75,65,72,68,70
210 DATA 72,66,75,64,80,60,85,56,92,50,99,44,108,37,117,28,127,20,127,20
211 PLOT 30,16,12,29,19,14
212 PLOT 3,17,11:PRINT "WOODS ENTERPRISES PRESENTS DUNGEON!"
213 PLOT 15,3,0,20,11,3,22,20:INPUT "INSTRUCTIONS? (Y/N) ";I$
214 IF I$< > "Y"AND I$< > "N"THEN 213
215 IF I$= "Y"THEN PLOT 27,4:PRINT "LOAD DUNGEN.DSP":PLOT 27,27,6,3,3,18,30:GOTO 217
216 GOTO 218
217 INPUT "PRESS ENTER TO CONTINUE";E$
218 RETURN
219 REM
220 GOTO 230
221 PLOT 3,20,8:PRINT " tttt```````uuuu"
222 PLOT 3,20,9:PRINT "tttttd`````duuuuu"
223 PLOT 3,20,10:PRINT "vvvvv{`````}wwwww"
224 PLOT 3,20,11:PRINT "`````````````````"
225 PLOT 3,20,12:PRINT "{{jjjjjjjjjjjjjjj}"
226 PLOT 3,15,13:PRINT "t``u```````````````````t``u"
227 PLOT 3,14,14:PRINT "t```u```````````````````t```u"
228 PLOT 3,13,15:PRINT "t```ut```````````````````ut```u"
229 GOTO 239
230 ZL= INT (5* RND (1)+ DC(XX)- 15)
231 AL= INT (16* RND (1)+ 1)
232 LD= LD(AL):MQ$= MQ$(AL):MN$= MN$(AL):IF AL= 5THEN 221
233 XC= (LD- 1)* 300+ 49152
234 POKE 49043,50:POKE 49044,100
235 YC= CALL (XC)
236 POKE 33283,105
237 POKE  33283,0
238 MH$= MN$:MZ= LEN (MH$):FOR BM= 1TO 17- MZ:MH$= MH$+ " ":NEXT BM
239 MV$= "YOU ARE FIGHTING ":MX$= " ":MZ$= MV$+ MQ$+ MX$+ MH$
240 PLOT 3,39,6:PRINT "      ":PLOT 3,15,6:PRINT MZ$
241 PLOT 3,16,19:PRINT "TO KILL THE MONSTER ROLL"ZL" OR MORE"
242 PLOT 3,0,30:INPUT "PRESS RETURN TO ROLL DICE:";LI
243 ZZ= 0
244 FOR BN= 1TO 2
245 IF BN= 1THEN R= 10
246 IF BN= 2THEN R= 15
247 DD= PEEK (33209):FOR Q= 1TO DD+ 10
248 FB= INT (6* RND (1)+ 1)
249 NEXT Q
250 ZZ= ZZ+ FB
251 IF GN= 0THEN GOSUB 253:GN= GN+ 1
252 ON FBGOTO 260,263,266,269,272,275
253 R1$(1)= "   ":R1$(2)= " d ":R1$(3)= R1$(1)
254 R2$(1)= "  d":R2$(2)= R1$(3):R2$(3)= "d  "
255 R3$(1)= R2$(1):R3$(2)= R1$(2):R3$(3)= R2$(3)
256 R4$(1)= "d d":R4$(2)= R1$(1):R4$(3)= R4$(1)
257 R5$(1)= R4$(1):R5$(2)= R1$(2):R5$(3)= R4$(1)
258 R6$(1)= "d d":R6$(2)= R6$(1):R6$(3)= R6$(1)
259 RETURN
260 FOR HN= 1TO 3:PLOT 3,0,R:PRINT R1$(HN):R= R+ 1:NEXT HN
261 NEXT BN
262 GOTO 277
263 FOR HN= 1TO 3:PLOT 3,0,R:PRINT R2$(HN):R= R+ 1:NEXT HN
264 NEXT BN
265 GOTO 277
266 FOR HN= 1TO 3:PLOT 3,0,R:PRINT R3$(HN):R= R+ 1:NEXT HN
267 NEXT BN
268 GOTO 277
269 FOR HN= 1TO 3:PLOT 3,0,R:PRINT R4$(HN):R= R+ 1:NEXT HN
270 NEXT BN
271 GOTO 277
272 FOR HN= 1TO 3:PLOT 3,0,R:PRINT R5$(HN):R= R+ 1:NEXT HN
273 NEXT BN
274 GOTO 277
275 FOR HN= 1TO 3:PLOT 3,0,R:PRINT R6$(HN):R= R+ 1:NEXT HN
276 NEXT BN
277 IF PP= 8THEN PP= 0:RETURN
278
279 IF ZZ- ZL< 0THEN 281
280 GOSUB 298:TG= INT ((DC(XX)- 18)* 800+ 1000* RND (1)):TG= TG+ DT(XX):DT(XX)= 0:GOTO 282
281 PLOT 3,47,19:PRINT "       ":PLOT 3,16,19:INPUT "PRESS RETURN FOR MONSTER'S ROLL:";LI:GOTO 285
282 PLOT 8:PRINT "YOU'VE KILLED THE MONSTER AND RECEIVE TREASURE AMOUNTING TO:"
283 PRINT :PRINT ""TG" GOLD PIECES":TR= TR+ TG
284 FOR I= 1TO 1000:NEXT I:DC(XX)= 17:PLOT 12:GOTO 192
285 PP= 8:GOSUB 243
286 ON ZZ- 1GOTO 288,289,292,292,294,296,294,292,292,296,289
287 END
288 MN$= NA$:DC(XX)= 18:GOSUB 298:PLOT 3,0,30:PRINT "YOU DIED IN THE DUNGEON!":GOTO 347
289 PLOT 3,0,30:PRINT "                                    "
290 PLOT 3,0,30:PRINT "RETURN TO START!":X= 1:Y= 1:FOR I= 1TO 1000:NEXT I
291 GOTO 196
292 TR= TR- 1000:DT(XX)= DT(XX)+ 1000:IF TR< 0THEN 288
293 PLOT 3,0,30:PRINT "THE MONSTER STOLE 1000 GOLD PIECES!":FOR I= 1TO 500:NEXT I:GOTO 123
294 TR= TR- 500:DT(XX)= DT(XX)+ 500:IF TR< 0THEN 288
295 PLOT 3,0,30:PRINT "THE MONSTER STOLE  500 GOLD PIECES!":FOR I= 1TO 500:NEXT I:GOTO 123
296 PLOT 3,0,30:PRINT "                                  "
297 PLOT 3,0,30:PRINT "NO EFFECT:":FOR I= 1TO 500:NEXT I:PLOT 12:GOTO 123
298 PLOT 12,15
299 FOR I= 1TO 5
300 PLOT 6,27,12,6,0,12,6,9,12
301 FOR J= 1TO 25:NEXT
302 NEXT
303 REM
304 PLOT 6,6,12,30,2
305 PLOT 246,12,54,87
306 PLOT 246,12,88,87
307 PLOT 246,16,93,91
308 PLOT 250,54,87,88
309 PLOT 250,60,91,93
310 PLOT 253,54,87,242,59,91
311 PLOT 253,88,87,242,93,91
312 PLOT 255,3,64,0
313 PLOT 3,30,15,123,100
314 PLOT 3,34,15,101,110
315 PLOT 3,38,15,123,100
316 PLOT 3,30,16,97,124
317 PLOT 3,34,16,127,108
318 PLOT 3,38,16,97
319 PLOT 2,250,54,12,88
320 PLOT 253,88,12,242,93,16
321 PLOT 253,93,16,255
322 PLOT 6,2,14,29
323 FOR I= 24TO 28STEP 2:PLOT 3,36,I,109:NEXT
324 PLOT 6,1,2,250,71,35,74
325 PLOT 250,70,34,75
326 PLOT 250,71,33,74
327 PLOT 250,72,32,73
328 PLOT 255,6,2,2
329 PLOT 253,68,15,69,14,70,13,70,12,71,11,71,10
330 PLOT 72,9,72,8,70,19,70,18,71,17,71,16,71,15
331 PLOT 72,14,72,13,72,12,71,11,77,23,77,22,76,21
332 PLOT 76,20,75,19,75,18,75,17,74,16,74,15,74,14
333 PLOT 74,13,73,12,73,11,73,10
334 PLOT 255,6,2,15,3,64,2
335 PLOT 3,36- LEN (MN$)/ 2,19
336 PLOT DC(XX),14:PRINT MN$:PLOT 15
337 FOR I= 1TO 4000:NEXT
338 RETURN
339 PLOT 3,0,27:PRINT "YOU ARE BACK AT THE START."
340 IF TR> 19999THEN 344
341 PLOT 3,0,30:PRINT "YOU DON'T HAVE ENOUGH TREASURE - BACK TO THE DUNGEON!"
342 FOR AA= 1TO 1000:NEXT AA:PLOT 12
343 GOTO 192
344 PLOT 3,0,30:PRINT "BE THANKFUL! YOU ARE NOW PERMITTED TO LEAVE THE DUNGEON":
345 PLOT 3,0,31:PRINT "YOU USED "MT" MAPS AND TOOK "TM" TIME UNITS:"
346 FOR I= 1TO 1000:NEXT I:GOTO 349
347 IF TR< 0THEN PLOT 3,0,31:PRINT "YOU RAN OUT OF TREASURE!"
348 IF ZZ= 2THEN PLOT 3,0,31:PRINT "THE MONSTER ROLLED A DOUBLE ONE!"
349 PLOT 1:END
400 Z= PEEK (0001):IF Z< > 186THEN 430
410 PLOT 27,4:PRINT "LOA DRAW8.PRG BF00":PLOT 27,27
420 RETURN
430 PLOT 27,4:PRINT "LOA DRAW6.PRG BF00":PLOT 27,27
440 RETURN