-
Notifications
You must be signed in to change notification settings - Fork 1
/
MAZE.BAS
executable file
·1542 lines (1507 loc) · 46.5 KB
/
MAZE.BAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
DECLARE SUB fadeout ()
DECLARE SUB fadein ()
DECLARE SUB waitkey ()
DECLARE SUB help ()
DECLARE FUNCTION addzeros$ (n!)
DECLARE SUB editor.editmaze (thefilename$)
DECLARE SUB editor ()
DECLARE SUB playmaze ()
'standard grey block
DATA 015,015,015,015,015,015,015,015,015,008
DATA 015,007,007,007,007,007,007,007,007,008
DATA 015,007,007,007,007,007,007,007,007,008
DATA 015,007,007,007,007,007,007,007,007,008
DATA 015,007,007,007,007,007,007,007,007,008
DATA 015,007,007,007,007,007,007,007,007,008
DATA 015,007,007,007,007,007,007,007,007,008
DATA 015,007,007,007,007,007,007,007,007,008
DATA 015,007,007,007,007,007,007,007,007,008
DATA 015,008,008,008,008,008,008,008,008,008
'left arrow
DATA 015,015,015,015,015,015,015,015,015,008
DATA 015,007,007,007,007,007,007,007,007,008
DATA 015,007,007,007,006,007,007,007,007,008
DATA 015,007,007,006,007,007,007,007,007,008
DATA 015,007,006,006,006,006,006,006,007,008
DATA 015,007,007,006,007,007,007,007,007,008
DATA 015,007,007,007,006,007,007,007,007,008
DATA 015,007,007,007,007,007,007,007,007,008
DATA 015,007,007,007,007,007,007,007,007,008
DATA 015,008,008,008,008,008,008,008,008,008
'right arrow
DATA 015,015,015,015,015,015,015,015,015,008
DATA 015,007,007,007,007,007,007,007,007,008
DATA 015,007,007,007,007,006,007,007,007,008
DATA 015,007,007,007,007,007,006,007,007,008
DATA 015,007,006,006,006,006,006,006,007,008
DATA 015,007,007,007,007,007,006,007,007,008
DATA 015,007,007,007,007,006,007,007,007,008
DATA 015,007,007,007,007,007,007,007,007,008
DATA 015,007,007,007,007,007,007,007,007,008
DATA 015,008,008,008,008,008,008,008,008,008
'finish block
DATA 015,000,015,000,015,000,015,000,015,000
DATA 000,015,000,015,000,015,000,015,000,015
DATA 015,000,015,000,015,000,015,000,015,000
DATA 000,015,000,015,000,015,000,015,000,015
DATA 015,000,015,000,015,000,015,000,015,000
DATA 000,015,000,015,000,015,000,015,000,015
DATA 015,000,015,000,015,000,015,000,015,000
DATA 000,015,000,015,000,015,000,015,000,015
DATA 015,000,015,000,015,000,015,000,015,000
DATA 000,015,000,015,000,015,000,015,000,015
'color data (color 1-15)
DATA 00,00,42
DATA 00,42,00
DATA 00,42,42
DATA 42,00,00
DATA 42,00,42
DATA 42,21,00
DATA 42,42,42
DATA 21,21,21
DATA 21,21,62
DATA 21,62,21
DATA 21,62,62
DATA 62,21,21
DATA 62,21,62
DATA 62,62,21
DATA 62,62,62
CLS
SCREEN 13
FOR dy = 1 TO 10
FOR dx = 1 TO 10
READ dc
PSET (dx, dy), dc
NEXT dx
NEXT dy
DIM SHARED block(25)
GET (1, 1)-(10, 10), block
CLS
SCREEN 13
FOR dy = 1 TO 10
FOR dx = 1 TO 10
READ dc
PSET (dx, dy), dc
NEXT dx
NEXT dy
DIM SHARED leftarr(25)
GET (1, 1)-(10, 10), leftarr
CLS
SCREEN 13
FOR dy = 1 TO 10
FOR dx = 1 TO 10
READ dc
PSET (dx, dy), dc
NEXT dx
NEXT dy
DIM SHARED rightarr(25)
GET (1, 1)-(10, 10), rightarr
CLS
SCREEN 13
FOR dy = 1 TO 10
FOR dx = 1 TO 10
READ dc
PSET (dx, dy), dc
NEXT dx
NEXT dy
DIM SHARED finishblock(25)
GET (1, 1)-(10, 10), finishblock
DIM SHARED colors(15, 3) AS INTEGER
FOR a = 1 TO 15
FOR b = 1 TO 3
READ colors(a, b)
NEXT b
NEXT a
CLS
thebegin:
fadeout
CLS
SCREEN 13
FOR x = 6 TO 310 STEP 10
FOR y = 1 TO 190 STEP 10
PUT (x, y), block
NEXT y
NEXT x
FOR x = 116 TO 196 STEP 10
PUT (x, 11), block
PUT (x, 21), block
NEXT x
COLOR 10
LOCATE 3, 19
PRINT "MAZE"
LINE (116, 11)-(205, 30), 14, B
FOR x = 96 TO 216 STEP 10
FOR y = 61 TO 151 STEP 10
PUT (x, y), block
NEXT y
NEXT x
LINE (96, 61)-(225, 160), 13, B
LOCATE 10, 19
PRINT "PLAY" 'menuoption 1
LOCATE 13, 16
PRINT "MAZE EDITOR" 'menuoption 2
LOCATE 16, 19
PRINT "HELP" 'menuoption 3
LOCATE 19, 19
PRINT "EXIT" 'menuoption 4
'menu navigation stuff
seloption = 1 'var holding the selected menu option
DIM linevals(4) AS INTEGER
linevals(1) = 10
linevals(2) = 13
linevals(3) = 16
linevals(4) = 19
fadein
DO
FOR a = 1 TO 4
LOCATE linevals(a), 14
PRINT " "
LOCATE linevals(a), 28
PRINT " "
NEXT a
COLOR 12
LOCATE linevals(seloption), 14: PRINT "["
LOCATE linevals(seloption), 28: PRINT "]"
DO
key$ = INKEY$
LOOP UNTIL key$ <> ""
SELECT CASE key$
'72,80,75,77 up down left right
CASE CHR$(0) + CHR$(72)
IF seloption = 1 THEN
seloption = 4
ELSE
seloption = seloption - 1
END IF
CASE CHR$(0) + CHR$(80)
IF seloption = 4 THEN
seloption = 1
ELSE
seloption = seloption + 1
END IF
CASE CHR$(0) + CHR$(75)
IF seloption = 1 THEN
seloption = 4
ELSE
seloption = seloption - 1
END IF
CASE CHR$(0) + CHR$(77)
IF seloption = 4 THEN
seloption = 1
ELSE
seloption = seloption + 1
END IF
CASE CHR$(13)
SELECT CASE seloption
CASE 1
playmaze
GOTO thebegin
CASE 2
editor
GOTO thebegin
CASE 3
help
GOTO thebegin
CASE 4
fadeout
END
END SELECT
CASE CHR$(27)
fadeout
END
END SELECT
LOOP
FUNCTION addzeros$ (n)
strn$ = RTRIM$(LTRIM$(STR$(n)))
SELECT CASE LEN(strn$)
CASE 1
strn$ = "00" + strn$
CASE 2
strn$ = "0" + strn$
CASE ELSE
strn$ = strn$
END SELECT
addzeros$ = strn$
END FUNCTION
SUB editor
DIM linevals(3) AS INTEGER
begin.of.editor:
fadeout
CLS
SCREEN 13
FOR x = 6 TO 310 STEP 10
FOR y = 1 TO 190 STEP 10
PUT (x, y), block
NEXT y
NEXT x
FOR x = 106 TO 206 STEP 10
PUT (x, 11), block
PUT (x, 21), block
NEXT x
COLOR 10
LOCATE 3, 16
PRINT "MAZE EDITOR"
LINE (106, 11)-(215, 30), 14, B
FOR x = 96 TO 216 STEP 10
FOR y = 61 TO 131 STEP 10
PUT (x, y), block
NEXT y
NEXT x
LINE (96, 61)-(225, 140), 13, B
LOCATE 10, 17: PRINT "NEW MAZE"
LOCATE 13, 17: PRINT "EDIT MAZE"
LOCATE 16, 19: PRINT "BACK"
fadein
seloption = 1
linevals(1) = 10
linevals(2) = 13
linevals(3) = 16
DO
FOR a = 1 TO 3
LOCATE linevals(a), 14
PRINT " "
LOCATE linevals(a), 28
PRINT " "
NEXT a
COLOR 12
LOCATE linevals(seloption), 14: PRINT "["
LOCATE linevals(seloption), 28: PRINT "]"
DO
key$ = INKEY$
LOOP UNTIL key$ <> ""
SELECT CASE key$
'72,80,75,77 up down left right
CASE CHR$(0) + CHR$(72)
IF seloption = 1 THEN
seloption = 3
ELSE
seloption = seloption - 1
END IF
CASE CHR$(0) + CHR$(80)
IF seloption = 3 THEN
seloption = 1
ELSE
seloption = seloption + 1
END IF
CASE CHR$(0) + CHR$(75)
IF seloption = 1 THEN
seloption = 3
ELSE
seloption = seloption - 1
END IF
CASE CHR$(0) + CHR$(77)
IF seloption = 3 THEN
seloption = 1
ELSE
seloption = seloption + 1
END IF
CASE CHR$(13)
SELECT CASE seloption
CASE 1
'newmaze
GOSUB editor.newmaze
GOTO begin.of.editor
CASE 2
'editmaze
GOSUB editor.editexistingmaze
GOTO begin.of.editor
CASE 3 'back
EXIT SUB
END SELECT
CASE CHR$(27)
EXIT SUB
END SELECT
LOOP
editor.newmaze: '< < < < < < < < < < < - MAAKT NIEUWE MAZE
fadeout
CLS
SCREEN 13
FOR x = 6 TO 310 STEP 10
FOR y = 1 TO 190 STEP 10
PUT (x, y), block
NEXT y
NEXT x
FOR x = 16 TO 296 STEP 10
PUT (x, 11), block
PUT (x, 21), block
NEXT x
COLOR 10
LOCATE 3, 4
PRINT "NAME YOUR MAZE (MAX 16 CHARACTERS)"
LINE (16, 11)-(305, 30), 14, B
FOR x = 96 TO 216 STEP 10
PUT (x, 71), block
NEXT x
LOCATE 10, 13
fadein
INPUT "", mazname$
IF LEN(mazname$) > 16 THEN mazname$ = LEFT$(mazname$, 16)
fadeout
CLS
SCREEN 13
FOR x = 6 TO 310 STEP 10
FOR y = 1 TO 190 STEP 10
PUT (x, y), block
NEXT y
NEXT x
FOR x = 16 TO 296 STEP 10
PUT (x, 11), block
PUT (x, 21), block
NEXT x
COLOR 10
LOCATE 3, 4
PRINT "FILENAME FOR MAZE? (EXT. IS ADDED)"
LINE (16, 11)-(305, 30), 14, B
FOR x = 96 TO 216 STEP 10
PUT (x, 71), block
NEXT x
LOCATE 10, 13
fadein
INPUT "", mazfilename$
IF LEN(mazfilename$) > 8 THEN mazname$ = LEFT$(mazname$, 8)
mazfilename$ = mazfilename$ + ".maz"
OPEN mazfilename$ FOR OUTPUT AS #1
PRINT #1, mazname$
PRINT #1, "<startcoords>"
PRINT #1, "1, 1"
PRINT #1, "<endcoords>"
PRINT #1, "31, 19"
PRINT #1, "<wall>"
PRINT #1, "015,015,015,015,015,015,015,015,015,008"
PRINT #1, "015,007,007,007,007,007,007,007,007,008"
PRINT #1, "015,007,007,007,007,007,007,007,007,008"
PRINT #1, "015,007,007,007,007,007,007,007,007,008"
PRINT #1, "015,007,007,007,007,007,007,007,007,008"
PRINT #1, "015,007,007,007,007,007,007,007,007,008"
PRINT #1, "015,007,007,007,007,007,007,007,007,008"
PRINT #1, "015,007,007,007,007,007,007,007,007,008"
PRINT #1, "015,007,007,007,007,007,007,007,007,008"
PRINT #1, "015,008,008,008,008,008,008,008,008,008"
PRINT #1, "<character>"
PRINT #1, "000,000,000,000,000,000,000,000,000,000"
PRINT #1, "000,000,000,000,015,015,000,000,000,000"
PRINT #1, "000,000,000,015,007,007,015,000,000,000"
PRINT #1, "000,000,000,015,007,007,015,000,000,000"
PRINT #1, "000,000,000,000,015,015,000,000,000,000"
PRINT #1, "000,000,000,007,007,007,007,000,000,000"
PRINT #1, "000,000,015,000,015,015,000,015,000,000"
PRINT #1, "000,000,000,000,015,015,000,000,000,000"
PRINT #1, "000,000,000,007,015,015,007,000,000,000"
PRINT #1, "000,000,007,015,008,008,015,007,000,000"
PRINT #1, "<wallcoordinates>"
CLOSE (1)
OPEN "mazes.dat" FOR APPEND AS #9
WRITE #9, mazfilename$
editor.editmaze (mazfilename$)'< < < < << < < < < - Calls the main editor to edit the file
RETURN
editor.editexistingmaze:
CLOSE
a = 0
OPEN "mazes.dat" FOR INPUT AS #2
DO
INPUT #2, filename$
a = a + 1
LOOP UNTIL EOF(2)
CLOSE (2)
DIM mazelist(a, 2) AS STRING
OPEN "mazes.dat" FOR INPUT AS #2
nrmazes = a
IF a <> 0 THEN
FOR b = 1 TO a
INPUT #2, filename$
OPEN filename$ FOR INPUT AS #3
mazelist(b, 1) = filename$
INPUT #3, mazelist(b, 2)
CLOSE (3)
NEXT b
END IF
CLOSE (2)
'here comes some nice layout stuff, like beginmenu
fadeout
CLS
SCREEN 13
FOR x = 6 TO 310 STEP 10
FOR y = 1 TO 190 STEP 10
PUT (x, y), block
NEXT y
NEXT x
FOR x = 66 TO 246 STEP 10
PUT (x, 11), block
PUT (x, 21), block
NEXT x
COLOR 10
LOCATE 3, 11
PRINT "SELECT A MAZE TO EDIT"
LINE (66, 11)-(255, 30), 14, B
FOR x = 96 TO 216 STEP 10
PUT (x, 71), block
NEXT x
PUT (86, 71), block
PUT (86, 71), leftarr
PUT (226, 71), block
PUT (226, 71), rightarr
FOR x = 126 TO 186 STEP 10
PUT (x, 101), block
PUT (x, 111), block
PUT (x, 121), block
PUT (x, 131), block
NEXT x
selmaze = 1
LOCATE 10, 13: PRINT mazelist(selmaze, 2)
LINE (126, 101)-(195, 140), 17, BF
OPEN mazelist(selmaze, 1) FOR INPUT AS #4
FOR l = 1 TO 28
LINE INPUT #4, l$
NEXT l
DO
INPUT #4, a, b
PSET (a + 144, b + 110), 7
LOOP UNTIL EOF(4)
CLOSE (4)
fadein
DO
DO
key$ = INKEY$
LOOP UNTIL key$ <> ""
SELECT CASE key$
CASE CHR$(0) + CHR$(75) 'left arrow
IF selmaze = 1 THEN
selmaze = nrmazes
ELSE
selmaze = selmaze - 1
END IF
CASE CHR$(0) + CHR$(77) 'right arrow
IF selmaze = nrmazes THEN
selmaze = 1
ELSE
selmaze = selmaze + 1
END IF
CASE CHR$(13)
mazefile$ = mazelist(selmaze, 1)
GOSUB editit
GOTO begin.of.editor
CASE CHR$(27)
RETURN
END SELECT
LOCATE 10, 13: PRINT " "
LOCATE 10, 13: PRINT mazelist(selmaze, 2)
LINE (126, 101)-(195, 140), 17, BF
OPEN mazelist(selmaze, 1) FOR INPUT AS #4
FOR l = 1 TO 28
LINE INPUT #4, l$
NEXT l
DO UNTIL EOF(4)
INPUT #4, a, b
PSET (a + 144, b + 110), 7
LOOP
CLOSE (4)
LOOP
editit:
editor.editmaze (mazefile$)
RETURN
END SUB
SUB editor.editmaze (thefilename$)
'let's make clear what variables we're going to use here:
'thefilename$ is already used, it holds the filename of the maze
'beginx is the x-component of the begincoordinates (integer)
'beginy is the y-component of the begincoordinates (integer)
'endx is the x-component of the endcoordinates (integer)
'endy is the y-component of the endcoordinates (integer)
'wallsprite(10,10) will hold the pixel color data for the wall sprite (integer)
'charsprite(10,10) will hold the pixel color data for the character sprite (integer)
'mazecoords(31,19) will hold the wall data (1 if wall at coord, 0 if no wall) (integer)
'selcolor is the current selected color in sprite editing (integer)
'curx is the x-component of the cursor (in 10x10) (integer)
'cury is the y-component of the cursor (in 10x10) (integer)
'mazx is the x-component of the cursor (in 31x19) (integer)
'mazy is the y-component of the cursor (in 31x19) (integer)
'Now that that's said, let's go and declare them, then load them with data
DIM beginx, beginy, endx, endy, curx, cury, mazx, mazy, selcolor AS INTEGER
DIM wallsprite(10, 10) AS INTEGER
DIM charsprite(10, 10) AS INTEGER
DIM mazecoords(31, 19) AS INTEGER
OPEN thefilename$ FOR INPUT AS #7
INPUT #7, b$
INPUT #7, b$
INPUT #7, beginx, beginy
INPUT #7, b$
INPUT #7, endx, endy
INPUT #7, b$
'load the wall sprite
FOR y = 1 TO 10
FOR x = 1 TO 10
INPUT #7, wallsprite(x, y)
NEXT x
NEXT y
INPUT #7, b$
'load the character sprite
FOR y = 1 TO 10
FOR x = 1 TO 10
INPUT #7, charsprite(x, y)
NEXT x
NEXT y
INPUT #7, b$
'set 0 in every coordinate of mazecoords (clear it)
FOR a = 1 TO 31
FOR b = 1 TO 19
mazecoords(a, b) = 0
NEXT b
NEXT a
'load the wall data into mazecoords
DO UNTIL EOF(7)
INPUT #7, a, b
mazecoords(a, b) = 1
LOOP
'everything is loaded in our vars, let's close the file
CLOSE (7)
'Now we can start the stuff for the user:
DIM linevals(4) AS INTEGER
linevals(1) = 10
linevals(2) = 13
linevals(3) = 16
linevals(4) = 19
menuagain:
fadeout
CLS
SCREEN 13
FOR x = 6 TO 310 STEP 10
FOR y = 1 TO 190 STEP 10
PUT (x, y), block
NEXT y
NEXT x
FOR x = 116 TO 196 STEP 10
PUT (x, 11), block
PUT (x, 21), block
NEXT x
COLOR 10
LOCATE 3, 19
PRINT "EDIT:"
LINE (116, 11)-(205, 30), 14, B
FOR x = 96 TO 216 STEP 10
FOR y = 61 TO 151 STEP 10
PUT (x, y), block
NEXT y
NEXT x
LINE (96, 61)-(225, 160), 13, B
LOCATE 10, 16
PRINT "WALL IMAGE" 'menuoption 1
LOCATE 13, 16
PRINT "CHAR IMAGE" 'menuoption 2
LOCATE 16, 16
PRINT "MAZE COORDS" 'menuoption 3
LOCATE 19, 19
PRINT "BACK" 'menuoption 4
'menu navigation stuff
seloption = 1 'var holding the selected menu option
fadein
DO
FOR a = 1 TO 4
LOCATE linevals(a), 14
PRINT " "
LOCATE linevals(a), 28
PRINT " "
NEXT a
COLOR 12
LOCATE linevals(seloption), 14: PRINT "["
LOCATE linevals(seloption), 28: PRINT "]"
DO
key$ = INKEY$
LOOP UNTIL key$ <> ""
SELECT CASE key$
'72,80,75,77 up down left right
CASE CHR$(0) + CHR$(72)
IF seloption = 1 THEN
seloption = 4
ELSE
seloption = seloption - 1
END IF
CASE CHR$(0) + CHR$(80)
IF seloption = 4 THEN
seloption = 1
ELSE
seloption = seloption + 1
END IF
CASE CHR$(0) + CHR$(75)
IF seloption = 1 THEN
seloption = 4
ELSE
seloption = seloption - 1
END IF
CASE CHR$(0) + CHR$(77)
IF seloption = 4 THEN
seloption = 1
ELSE
seloption = seloption + 1
END IF
CASE CHR$(13)
SELECT CASE seloption
CASE 1
GOSUB editwall
GOTO menuagain
CASE 2
GOSUB editcharacter
GOTO menuagain
CASE 3
GOSUB editmaze
GOTO menuagain
CASE 4
EXIT SUB
END SELECT
CASE CHR$(27)
EXIT SUB
END SELECT
LOOP
'--------------------------------------------<WALL SPRITE EDITOR>
editwall:
fadeout
CLS
SCREEN 13
FOR x = 6 TO 310 STEP 10
FOR y = 1 TO 190 STEP 10
PUT (x, y), block
NEXT y
NEXT x
FOR x = 86 TO 226 STEP 10
PUT (x, 11), block
PUT (x, 21), block
NEXT x
COLOR 10
LOCATE 3, 14
PRINT "EDIT WALL IMAGE"
LINE (86, 11)-(235, 30), 14, B
FOR x = 26 TO 286 STEP 10
FOR y = 151 TO 171 STEP 10
PUT (x, y), block
NEXT y
NEXT x
'LINE (26, 151)-(295, 180), 13, B
LOCATE 20, 5: PRINT "S=Save ESC=Back C=Next color"
LOCATE 21, 5: PRINT "V=Prev. color Arrows=Move"
LOCATE 22, 5: PRINT "ENTER=apply new color"
FOR x = 126 TO 186 STEP 10
FOR y = 61 TO 101 STEP 10
PUT (x, y), block
NEXT y
NEXT x
PUT (86, 61), block
PUT (96, 61), block
PUT (86, 71), block
PUT (96, 71), block
LINE (154, 79)-(167, 92), 15, B
curx = 1: cury = 1: selcolor = 0
fadein
DO
LINE (156, 81)-(165, 90), 0, BF
LINE (87, 62)-(104, 79), selcolor, BF
FOR x = 1 TO 10
FOR y = 1 TO 10
PSET (155 + x, 80 + y), wallsprite(x, y)
NEXT y
NEXT x
PSET (155 + curx, 80 + cury), selcolor
DO
key$ = INKEY$
LOOP UNTIL key$ <> ""
SELECT CASE key$
CASE CHR$(0) + CHR$(72) 'up arrow
IF cury > 1 THEN
curx = curx
cury = cury - 1
ELSE
curx = curx
cury = cury
END IF
CASE CHR$(0) + CHR$(80) 'down arrow
IF cury < 10 THEN
curx = curx
cury = cury + 1
ELSE
curx = curx
cury = cury
END IF
CASE CHR$(0) + CHR$(75) 'left arrow
IF curx > 1 THEN
curx = curx - 1
cury = cury
ELSE
curx = curx
cury = cury
END IF
CASE CHR$(0) + CHR$(77) 'right arrow
IF curx < 10 THEN
curx = curx + 1
cury = cury
ELSE
curx = curx
cury = cury
END IF
CASE CHR$(13) 'enter
wallsprite(curx, cury) = selcolor
CASE "c"
IF selcolor = 255 THEN
selcolor = 0
ELSE
selcolor = selcolor + 1
END IF
CASE "C"
IF selcolor = 255 THEN
selcolor = 0
ELSE
selcolor = selcolor + 1
END IF
CASE "v"
IF selcolor = 0 THEN
selcolor = 255
ELSE
selcolor = selcolor - 1
END IF
CASE "V"
IF selcolor = 0 THEN
selcolor = 255
ELSE
selcolor = selcolor - 1
END IF
CASE "s"
GOSUB saveroutine
CASE "S"
GOSUB saveroutine
CASE CHR$(27)
RETURN
END SELECT
LOOP
'--------------------------------------------</WALL SPRITE EDITOR>
'--------------------------------------------<CHARACTER SPRITE EDITOR>
editcharacter:
fadeout
CLS
SCREEN 13
FOR x = 6 TO 310 STEP 10
FOR y = 1 TO 190 STEP 10
PUT (x, y), block
NEXT y
NEXT x
FOR x = 86 TO 226 STEP 10
PUT (x, 11), block
PUT (x, 21), block
NEXT x
COLOR 10
LOCATE 3, 14
PRINT "EDIT CHAR IMAGE"
LINE (86, 11)-(235, 30), 14, B
FOR x = 26 TO 286 STEP 10
FOR y = 151 TO 171 STEP 10
PUT (x, y), block
NEXT y
NEXT x
'LINE (26, 151)-(295, 180), 13, B
LOCATE 20, 5: PRINT "S=Save ESC=Back C=Next color"
LOCATE 21, 5: PRINT "V=Prev. color Arrows=Move"
LOCATE 22, 5: PRINT "ENTER=apply new color"
FOR x = 126 TO 186 STEP 10
FOR y = 61 TO 101 STEP 10
PUT (x, y), block
NEXT y
NEXT x
PUT (86, 61), block
PUT (96, 61), block
PUT (86, 71), block
PUT (96, 71), block
LINE (154, 79)-(167, 92), 15, B
curx = 1: cury = 1: selcolor = 0
fadein
DO
LINE (156, 81)-(165, 90), 0, BF
LINE (87, 62)-(104, 79), selcolor, BF
FOR x = 1 TO 10
FOR y = 1 TO 10
PSET (155 + x, 80 + y), charsprite(x, y)
NEXT y
NEXT x
PSET (155 + curx, 80 + cury), selcolor
DO
key$ = INKEY$
LOOP UNTIL key$ <> ""
SELECT CASE key$
CASE CHR$(0) + CHR$(72) 'up arrow
IF cury > 1 THEN
curx = curx
cury = cury - 1
ELSE
curx = curx
cury = cury
END IF
CASE CHR$(0) + CHR$(80) 'down arrow
IF cury < 10 THEN
curx = curx
cury = cury + 1
ELSE
curx = curx
cury = cury
END IF
CASE CHR$(0) + CHR$(75) 'left arrow
IF curx > 1 THEN
curx = curx - 1
cury = cury
ELSE
curx = curx
cury = cury
END IF
CASE CHR$(0) + CHR$(77) 'right arrow
IF curx < 10 THEN
curx = curx + 1
cury = cury
ELSE
curx = curx
cury = cury
END IF
CASE CHR$(13) 'enter
charsprite(curx, cury) = selcolor
CASE "c"
IF selcolor = 255 THEN
selcolor = 0
ELSE
selcolor = selcolor + 1
END IF
CASE "C"
IF selcolor = 255 THEN
selcolor = 0
ELSE
selcolor = selcolor + 1
END IF
CASE "v"
IF selcolor = 0 THEN
selcolor = 255
ELSE
selcolor = selcolor - 1
END IF
CASE "V"
IF selcolor = 0 THEN
selcolor = 255
ELSE
selcolor = selcolor - 1
END IF
CASE "s"
GOSUB saveroutine
CASE "S"
GOSUB saveroutine
CASE CHR$(27)
RETURN
END SELECT
LOOP
'--------------------------------------------</CHARACTER SPRITE EDITOR>
'--------------------------------------------<MAZE ITSELF EDITOR>
editmaze:
fadeout
CLS
SCREEN 13
mazx = 1
mazy = 1
DO
LINE (1, 1)-(319, 195), 0, BF
FOR x = 1 TO 31
FOR y = 1 TO 19
LINE (((x - 1) * 10) + 1, ((y - 1) * 10) + 1)-(((x - 1) * 10) + 11, ((y - 1) * 10) + 11), 8, B
IF mazecoords(x, y) = 1 THEN
LINE (((x - 1) * 10) + 1, ((y - 1) * 10) + 1)-(((x - 1) * 10) + 11, ((y - 1) * 10) + 11), 14, BF
END IF
NEXT y
NEXT x
LINE (((beginx - 1) * 10) + 1, ((beginy - 1) * 10) + 1)-(((beginx - 1) * 10) + 11, ((beginy - 1) * 10) + 11), 10, BF
LINE (((endx - 1) * 10) + 1, ((endy - 1) * 10) + 1)-(((endx - 1) * 10) + 11, ((endy - 1) * 10) + 11), 12, BF
LINE (((mazx - 1) * 10) + 1, ((mazy - 1) * 10) + 1)-(((mazx - 1) * 10) + 11, ((mazy - 1) * 10) + 11), 13, B
fadein
DO
key$ = INKEY$
LOOP UNTIL key$ <> ""
SELECT CASE key$
CASE CHR$(0) + CHR$(72) 'up arrow
IF mazy > 1 THEN
mazx = mazx
mazy = mazy - 1
ELSE
mazx = mazx
mazy = mazy
END IF
CASE CHR$(0) + CHR$(80) 'down arrow
IF mazy < 19 THEN
mazx = mazx
mazy = mazy + 1
ELSE
mazx = mazx
mazy = mazy
END IF
CASE CHR$(0) + CHR$(75) 'left arrow
IF mazx > 1 THEN
mazx = mazx - 1
mazy = mazy
ELSE
mazx = mazx
mazy = mazy
END IF
CASE CHR$(0) + CHR$(77) 'right arrow
IF mazx < 31 THEN
mazx = mazx + 1
mazy = mazy
ELSE
mazx = mazx
mazy = mazy
END IF
CASE CHR$(13) 'enter
IF mazecoords(mazx, mazy) = 1 THEN
mazecoords(mazx, mazy) = 0
ELSE
IF mazx = beginx AND mazy = beginy THEN
ELSEIF mazx = endx AND mazy = endy THEN
ELSE
mazecoords(mazx, mazy) = 1
END IF
END IF
CASE "b"
IF mazecoords(mazx, mazy) <> 1 THEN
beginx = mazx
beginy = mazy
END IF
CASE "B"
IF mazecoords(mazx, mazy) <> 1 THEN
beginx = mazx
beginy = mazy
END IF
CASE "e"
IF mazecoords(mazx, mazy) <> 1 THEN
endx = mazx
endy = mazy
END IF
CASE "E"
IF mazecoords(mazx, mazy) <> 1 THEN
endx = mazx
endy = mazy
END IF
CASE "s"
GOSUB saveroutine
CASE "S"
GOSUB saveroutine
CASE CHR$(27)
RETURN
END SELECT
LOOP
'--------------------------------------------</MAZE ITSELF EDITOR>
'--------------------------------------------<MAZEFILE SAVER>
saveroutine:
OPEN thefilename$ FOR INPUT AS #8
INPUT #8, thamazename$