-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMenu.bas
1163 lines (955 loc) · 27 KB
/
Menu.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
'****************************************************************
'***** ARRAKIS MAIN MENU FILE, AND RMG INCLUDED AS S12.BAS *****
'****************************************************************
'COPYRIGHTED BY STEFAN HENDRIKS
'****************************************************************
'***** ARRAKIS MAIN MENU FILE, AND RMG INCLUDED AS S12.BAS *****
'****************************************************************
DECLARE SUB setatreidesfont ()
DECLARE SUB setharkonnenfont ()
DECLARE SUB setordosfont ()
DECLARE SUB setnormalfont ()
DECLARE SUB center (y%, tekst$, kleur%)
DECLARE SUB setselectedfont ()
DECLARE FUNCTION checkcenter% (y%, txt$)
DECLARE SUB menucode ()
DECLARE SUB processhouses ()
DECLARE SUB getskirmaps ()
DECLARE SUB makespot (cll%, duration%, tp%)
DECLARE SUB fillgaps (sort%)
DECLARE SUB checkais ()
DECLARE SUB clearspice ()
DECLARE SUB makeborders ()
DECLARE SUB writefile ()
DECLARE FUNCTION checkspot% (cl%)
DEFINT A-Z
'$INCLUDE: 'directqb.bi'
COMMON SHARED playinghouse, menuitem, speed, penemyhouse, maxskirmaps, mlist, skirmish
COMMON SHARED playmap$, sizerock, sizespice, amountrock, amountspice
COMMON SHARED dif, keer, cl, afstand, startcell1, startcell2, mx, my, filename$
RANDOMIZE TIMER
DIM SHARED posities(50)
DIM SHARED map(4095)
DIM SHARED mapstr(4095)
t = DQBinit(2, 0)
IF t <> 0 THEN DQBclose: END
DIM SHARED mapfile$(200)
'penemyhouse = INT(RND * 3)
OPEN "DATA\ARRAKIS.INI" FOR INPUT AS #1
INPUT #1, hss$ 'Actually Not important
INPUT #1, hss2$ 'Actually Not important
INPUT #1, enemycolor 'Actually Not important
INPUT #1, mycolor 'Actually Not important
INPUT #1, skipframes 'Importans
INPUT #1, penemyhouse 'Important
INPUT #1, playinghouse 'Important
INPUT #1, amountspice 'Important
INPUT #1, amountrock 'Important
INPUT #1, sizespice 'Important
INPUT #1, sizerock 'Important
CLOSE #1
IF skipframes = 0 THEN speed = 0
IF skipframes = 1 THEN speed = 1
IF skipframes = 2 THEN speed = 2
IF skipframes = 4 THEN speed = 3
IF skipframes = 8 THEN speed = 4
DIM SHARED textu(50)
DIM SHARED Pal AS STRING * 786
getskirmaps
DQBinitVGA
c% = DQBloadLayer(2, "DATA\MENU\MEN.PCX", Pal)
DQBsetPal Pal
DQBsetTextStyle TEXTURED
c% = DQBloadFont("DATA\FONT\ARRAKIS.FNT")
DO
k$ = INKEY$
DQBclearLayer 1
DQBcopyLayer 2, 1
menucode ' Here the menu code
DQBxPut 2, 1, 45, 8, 58, 1, DQBmouseX, DQBmouseY
DQBcopyLayer 1, 0
LOOP
DQBclose
END
REM $DYNAMIC
SUB center (y, tekst$, kleur)
tekst$ = UCASE$(tekst$)
l = LEN(tekst$)
l = l * 8 'Real size in pixels
xplaats = 320 / 2 - (l / 2)
y = y * 8
DQBprint 1, tekst$, xplaats, y, kleur
END SUB
SUB checkais
'This sub checks on startcell1 and startcell2 if there is enough room
'for building, it will automaticly fill up sand.
basetype = INT(RND * 2) '2 base types
keer1 = 0
weer:
IF keer1 = 0 THEN c = startcell1
IF keer1 = 1 THEN c = startcell2
IF keer1 > 1 THEN EXIT SUB
y11 = INT(c / 64)
x11 = c - INT(y11 * 64)
map(c) = 5
IF c + 1 < 64 THEN map(c + 1) = 5
IF c + 64 < 64 THEN map(c + 64) = 5
IF c + 65 < 64 THEN map(c + 65) = 5
x1 = x11 - 6
x2 = x11 + 7
y1 = y11 - 6
y2 = y11 + 7
IF x1 < 0 THEN x1 = 0
IF y1 < 0 THEN y1 = 0
IF x2 > 63 THEN x2 = 63
IF y2 > 63 THEN y2 = 63
IF keer1 = 0 THEN
cell = c
my = INT(cell / 64)
mx = cell - INT(my * 64)
my = my - 5
mx = mx - 7
IF mx > 48 THEN mx = 48
IF mx < 0 THEN mx = 0
IF my > 50 THEN my = 50
IF my < 0 THEN my = 0
END IF
nogeens3:
ja = 0: nee = 0
FOR cx = x1 TO x2
FOR cy = y1 TO y2
c = cy * 64 + cx
IF extra > 10 THEN extra = 0: GOTO neenietnogeens
IF map(c) <> 5 THEN
IF extra > 0 THEN makespot c, (40 * extra), 5
END IF
IF map(c) = 5 THEN ja = ja + 1
IF map(c) <> 5 THEN nee = nee + 1
NEXT cy
NEXT cx
LOCATE 10, 1: 'PRINT proc
proc = INT((ja / 169) * 100)
IF proc < 60 THEN extra = extra + 1: GOTO nogeens3
neenietnogeens:
'Ok if keer = 1 then place ai structures variables
IF keer1 = 1 THEN
'Ok add ai
cell = startcell2
OPEN "DATA\MAPS\ADDAI.NON" FOR OUTPUT AS #1
PRINT #1, "-1,-1"
PRINT #1, "0 , -1 ,"; startcell1
PRINT #1, "1 , -1 ,"; startcell2
PRINT #1, "-1 , -1 , -1"
'Starting units
c1 = startcell1 - 2
c2 = startcell1 + 3
IF c1 < 0 THEN c1 = 0
IF c2 > 3967 THEN c1 = 3967
PRINT #1, "0 , 4 ,"; c1; ","; c1; ",0"
PRINT #1, "0 , 4 ,"; c2; ","; c2; ",0"
PRINT #1, "-1 , -1 , -1 , -1 , -1"
'Now for AI to add structures
'First a windtrap
addbuilding:
building = building + 1
t = 0
GOTO zoekdir
nogeens1:
IF checkspot(cell) = 0 THEN
c = cell
LOCATE 11, 1: 'PRINT building
'Base type = 1
IF basetype = 0 THEN
IF building = 1 THEN PRINT #1, "4 , 0,"; c; ", 1"
IF building = 2 THEN PRINT #1, "12 , 1,"; c; ", 1"
IF building = 3 THEN PRINT #1, "22 , 2,"; c; ", 1"
IF building = 4 THEN PRINT #1, "30 , 0,"; c; ", 1"
IF building = 5 THEN PRINT #1, "35 , 0,"; c; ", 1"
IF building = 6 THEN PRINT #1, "42 , 4,"; c; ", 1"
IF building = 7 THEN PRINT #1, "52 , 3,"; c; ", 1"
IF building = 8 THEN PRINT #1, "62 , 6,"; c; ", 1"
IF building = 9 THEN PRINT #1, "82 , 5,"; c; ", 1"
IF building = 3 OR building = 2 OR building = 7 OR building = 8 THEN
IF c + 128 <= 4095 THEN mapstr(c + 128) = 1
IF c + 129 <= 4095 THEN mapstr(c + 129) = 1
END IF
END IF
'Other base type
IF basetype = 1 THEN
IF building = 1 THEN PRINT #1, "4 , 0,"; c; ", 1"
IF building = 2 THEN PRINT #1, "12 , 1,"; c; ", 1"
IF building = 3 THEN PRINT #1, "22 , 0,"; c; ", 1"
IF building = 4 THEN PRINT #1, "30 , 2,"; c; ", 1"
IF building = 5 THEN PRINT #1, "35 , 6,"; c; ", 1"
IF building = 6 THEN PRINT #1, "42 , 4,"; c; ", 1"
IF building = 7 THEN PRINT #1, "52 , 3,"; c; ", 1"
IF building = 8 THEN PRINT #1, "62 , 5,"; c; ", 1"
IF building = 9 THEN PRINT #1, "82 , 6,"; c; ", 1"
IF building = 2 OR building = 4 OR building = 7 OR building = 8 THEN
IF c + 128 <= 4095 THEN mapstr(c + 128) = 1
IF c + 129 <= 4095 THEN mapstr(c + 129) = 1
END IF
END IF
mapstr(c) = 1
mapstr(c + 1) = 1
mapstr(c + 64) = 1
mapstr(c + 65) = 1
ELSE
zoekdir:
a = INT(RND * 50)
IF a < 25 THEN cell = cell - (INT(RND * 3) * 64) - INT(RND * 6)
IF a >= 25 THEN cell = cell + (INT(RND * 3) * 64) + INT(RND * 6)
IF cell > 3967 THEN cell = 3967
IF cell < 0 THEN cell = 0
GOTO nogeens1
END IF
IF building < 10 THEN GOTO addbuilding
PRINT #1, c1; " , 3,"; startcell1; ", 2"
rein = INT(RND * 5)
t = INT(RND * 30)
IF rein > 0 THEN
FOR r = 1 TO rein
PRINT #1, t; " , 5,"; startcell1; ", 2"
NEXT r
PRINT #1, "1 , 1,"; (t - 1); ", 2"
END IF
PRINT #1, "-1, -1, -1, -1"
PRINT #1, "3500 , 6"
CLOSE #1
END IF
keer1 = keer1 + 1
GOTO weer
END SUB
FUNCTION checkcenter (y, txt$)
y1 = (y * 8)
y2 = y1 + 7
tekst$ = UCASE$(tekst$)
l = LEN(txt$)
l = l * 8 'Real size in pixels
x1 = 320 / 2 - (l / 2)
x2 = x1 + l
IF DQBmouseX >= x1 AND DQBmouseX <= x2 AND DQBmouseY >= y1 AND DQBmouseY <= y2 THEN checkcenter = -1
END FUNCTION
FUNCTION checkspot (cl)
checkspot = 0
my1 = INT(cl / 64)
mx1 = cl - INT(my1 * 64)
my2 = INT(startcell2 / 64)
mx2 = startcell2 - INT(my2 * 64)
IF cl > 4095 THEN checkspot = 1: cl = 4095
IF cl < 0 THEN checkspot = 1: cl = 0
IF mx1 > mx2 THEN vx = mx1 - mx2
IF mx2 > mx1 THEN vx = mx2 - mx1
IF my1 > my2 THEN vy = my1 - my2
IF my2 > my1 THEN vy = my2 - my1
IF vx > 6 THEN checkspot = 1
IF vy > 6 THEN checkspot = 1
IF mx1 + 1 >= 62 THEN checkspot = 1
IF my1 + 1 >= 62 THEN checkspot = 1
IF mapstr(cl) <> 0 THEN checkspot = 1
IF mapstr(cl + 1) <> 0 THEN checkspot = 1
IF mapstr(cl + 64) <> 0 THEN checkspot = 1
IF mapstr(cl + 65) <> 0 THEN checkspot = 1
END FUNCTION
SUB clearmap
FOR i = 0 TO 4095
map(i) = 0
mapstr(i) = 0
NEXT i
END SUB
SUB clearspice
'no spice attached to rock
FOR i = 0 TO 4095
IF map(i) = 5 THEN
links = i - 1
rechts = i + 1
boven = i - 64
onder = i + 64
IF links < 0 THEN links = 0
IF rechts < 0 THEN rechts = 0
IF boven < 0 THEN boven = 0
IF onder < 0 THEN onder = 0
IF links > 4095 THEN links = 4095
IF rechts > 4095 THEN rechts = 4095
IF boven > 4095 THEN boven = 4095
IF onder > 4095 THEN onder = 4095
tekenlinks = map(links)
tekenrechts = map(rechts)
tekenboven = map(boven)
tekenonder = map(onder)
IF tekenlinks = 25 THEN map(links) = 0
IF tekenrechts = 25 THEN map(rechts) = 0
IF tekenboven = 25 THEN map(boven) = 0
IF tekenonder = 25 THEN map(onder) = 0
END IF
NEXT i
END SUB
SUB drawmap
FOR i = 0 TO 4095
begin = i
y11 = INT(begin / 64)
x11 = begin - INT(y11 * 64)
c = 25 'sand
IF map(i) >= 5 THEN c = 22
IF map(i) >= 25 AND map(i) <= 27 THEN c = 29
IF i = startcell1 THEN c = 15
IF i = startcell2 THEN c = 14
PSET (x11, 100 + y11), c
NEXT i
LINE (mx, 100 + my)-(mx + 15, 100 + my + 13), 15, B
END SUB
SUB fillgaps (sort)
'Fill gaps
'1 = ROCK
'2 = SPICE
IF sort = 1 THEN
FOR i = 0 TO 4095
IF map(i) = 0 THEN
links = i - 1
rechts = i + 1
boven = i - 64
onder = i + 64
IF links < 0 THEN links = 0
IF rechts < 0 THEN rechts = 0
IF boven < 0 THEN boven = 0
IF onder < 0 THEN onder = 0
IF links > 4095 THEN links = 4095
IF rechts > 4095 THEN rechts = 4095
IF boven > 4095 THEN boven = 4095
IF onder > 4095 THEN onder = 4095
tekenlinks = map(links)
tekenrechts = map(rechts)
tekenboven = map(boven)
tekenonder = map(onder)
IF tekenlinks = 25 THEN tekenlinks = 0
IF tekenrechts = 25 THEN tekenrechts = 0
IF tekenboven = 25 THEN tekenboven = 0
IF tekenonder = 25 THEN tekenonder = 0
IF tekenlinks <> 5 THEN tekenlinks = 0
IF tekenrechts <> 5 THEN tekenrechts = 0
IF tekenboven <> 5 THEN tekenboven = 0
IF tekenonder <> 5 THEN tekenonder = 0
som = tekenlinks + tekenrechts + tekenboven + tekenonder
IF som > 10 THEN map(i) = 5
IF som = 10 THEN
keer = INT(RND * 100)
IF keer < 50 THEN
map(i) = 5
END IF
IF keer >= 50 THEN
map(i) = 0
END IF
END IF
END IF
NEXT i
END IF
IF sort = 2 THEN
FOR i = 0 TO 4095
IF map(i) = 0 THEN
links = i - 1
rechts = i + 1
boven = i - 64
onder = i + 64
IF links < 0 THEN links = 0
IF rechts < 0 THEN rechts = 0
IF boven < 0 THEN boven = 0
IF onder < 0 THEN onder = 0
IF links > 4095 THEN links = 4095
IF rechts > 4095 THEN rechts = 4095
IF boven > 4095 THEN boven = 4095
IF onder > 4095 THEN onder = 4095
tekenlinks = map(links)
tekenrechts = map(rechts)
tekenboven = map(boven)
tekenonder = map(onder)
IF tekenlinks = 25 THEN tekenlinks = 5
IF tekenrechts = 25 THEN tekenrechts = 5
IF tekenboven = 25 THEN tekenboven = 5
IF tekenonder = 25 THEN tekenonder = 5
IF tekenlinks <> 25 THEN tekenlinks = 0
IF tekenrechts <> 25 THEN tekenrechts = 0
IF tekenboven <> 25 THEN tekenboven = 0
IF tekenonder <> 25 THEN tekenonder = 0
som = tekenlinks + tekenrechts + tekenboven + tekenonder
IF som > 10 THEN map(i) = 25
IF som = 10 THEN
keer = INT(RND * 100)
IF keer < 50 THEN
map(i) = 25
END IF
IF keer >= 50 THEN
map(i) = 0
END IF
END IF
END IF
NEXT i
END IF
END SUB
SUB getskirmaps
'First clear all
playmap$ = ""
maxskirmaps = -1
DIM temp$(200)
FOR m = 0 TO 200
mapfile$(m) = ""
NEXT m
SHELL "DIR DATA\MAPS\*.MAP > TEMP.SKR"
OPEN "TEMP.SKR" FOR INPUT AS #1
regel = 0
DO WHILE NOT EOF(1)
regel = regel + 1
LINE INPUT #1, dat$
IF regel > 5 THEN
temp$(l) = MID$(dat$, 1, 8)
l = l + 1
END IF
LOOP
CLOSE #1
OPEN "TEMP.OUT" FOR OUTPUT AS #2
FOR w = 0 TO (l - 3)
PRINT #2, temp$(w)
NEXT w
CLOSE #2
'Now read all
OPEN "TEMP.OUT" FOR INPUT AS #1
DO WHILE NOT EOF(1)
IF f <= 200 THEN INPUT #1, mapfile$(f)
IF f > 200 THEN EXIT DO
f = f + 1
LOOP
CLOSE #1
IF f = 1 AND mapfile$(0) = "" THEN
maxskirmaps = -1
ELSE
maxskirmaps = (f - 1)
nr$ = MID$(mapfile$(f - 1), 4, 8)
nrr = VAL(nr$)
END IF
'Now delete temp files
KILL "TEMP.SKR"
KILL "TEMP.OUT"
OPEN "DATA\MAPS\RMG.INI" FOR OUTPUT AS #1
PRINT #1, nrr
CLOSE #1
END SUB
SUB makeborders
'smooth map
DIM newmap(4095)
FOR i = 0 TO 4095
newmap(i) = 0
NEXT i
FOR i = 0 TO 4095
IF map(i) = 5 THEN
'change borders
links = i - 1
rechts = i + 1
boven = i - 64
onder = i + 64
IF links < 0 THEN links = 0
IF rechts < 0 THEN rechts = 0
IF boven < 0 THEN boven = 0
IF onder < 0 THEN onder = 0
IF links > 4095 THEN links = 4095
IF rechts > 4095 THEN rechts = 4095
IF boven > 4095 THEN boven = 4095
IF onder > 4095 THEN onder = 4095
tekenlinks = 0: tekenrechts = 0: tekenonder = 0: tekenboven = 0
tekenlinks = map(links)
tekenrechts = map(rechts)
tekenboven = map(boven)
tekenonder = map(onder)
links2 = 0: rechts2 = 0: boven2 = 0: onder2 = 0
IF tekenlinks = 5 THEN links2 = 1
IF tekenrechts = 5 THEN rechts2 = 1
IF tekenboven = 5 THEN boven2 = 1
IF tekenonder = 5 THEN onder2 = 1
'Nothing around it
IF links2 = 0 AND rechts2 = 0 AND boven2 = 0 AND onder2 = 0 THEN newmap(i) = 23
'Everything around it
IF links2 = 1 AND rechts2 = 1 AND boven2 = 1 AND onder2 = 1 THEN newmap(i) = 5 + INT(RND * 2)
'Only at the left rock
IF links2 = 1 AND rechts2 = 0 AND boven2 = 0 AND onder2 = 0 THEN newmap(i) = 28
'Only at the right rock
IF links2 = 0 AND rechts2 = 1 AND boven2 = 0 AND onder2 = 0 THEN newmap(i) = 29
'Only at the up rock
IF links2 = 0 AND rechts2 = 0 AND boven2 = 1 AND onder2 = 0 THEN newmap(i) = 30
'Only at the down rock
IF links2 = 0 AND rechts2 = 0 AND boven2 = 0 AND onder2 = 1 THEN newmap(i) = 31
'Only at the left and right rock
IF links2 = 1 AND rechts2 = 1 AND boven2 = 0 AND onder2 = 0 THEN newmap(i) = 33
'Only at the up and down
IF links2 = 0 AND rechts2 = 0 AND boven2 = 1 AND onder2 = 1 THEN newmap(i) = 32
'Only at the left up
IF links2 = 1 AND rechts2 = 0 AND boven2 = 1 AND onder2 = 0 THEN newmap(i) = 18
'Only at the left down
IF links2 = 1 AND rechts2 = 0 AND boven2 = 0 AND onder2 = 1 THEN newmap(i) = 16
'Only at the right down
IF links2 = 0 AND rechts2 = 1 AND boven2 = 0 AND onder2 = 1 THEN newmap(i) = 15
'Only at the right up
IF links2 = 0 AND rechts2 = 1 AND boven2 = 1 AND onder2 = 0 THEN newmap(i) = 17
'Only at the right up
IF links2 = 1 AND rechts2 = 1 AND boven2 = 1 AND onder2 = 0 THEN newmap(i) = 11 + INT(RND * 2)
'Only at the right down
IF links2 = 1 AND rechts2 = 1 AND boven2 = 0 AND onder2 = 1 THEN newmap(i) = 13 + INT(RND * 2)
'Only at the right
IF links2 = 1 AND rechts2 = 0 AND boven2 = 1 AND onder2 = 1 THEN newmap(i) = 9 + INT(RND * 2)
'Only at the left
IF links2 = 0 AND rechts2 = 1 AND boven2 = 1 AND onder2 = 1 THEN newmap(i) = 7 + INT(RND * 2)
END IF
NEXT i
'Ok now change all rocks
FOR i = 0 TO 4095
IF map(i) = 5 THEN map(i) = newmap(i)
IF map(i) = 25 THEN map(i) = map(i) + INT(RND * 3)
NEXT i
END SUB
SUB makespot (cll, duration, tp)
'create a random spot of tpe on cell, at duration
c = cll
cl = cll
FOR i = 0 TO duration
dir = INT(RND * 4)
IF dir = 0 THEN c2 = -1
IF dir = 1 THEN c2 = 1
IF dir = 2 THEN c2 = -64
IF dir = 3 THEN c2 = 64
c = c + c2
IF c > 4095 THEN c = 0
IF c < 0 THEN c = 4095
IF map(c) = 0 THEN map(c) = tp
NEXT i
END SUB
SUB menucode
dqbboxf 1, 0, 0, 8, 60, 35
skirmish = 0
IF menuitem = 0 THEN
setnormalfont
'MAIN MENU
center 7, "- MAIN MENU -", 2
IF checkcenter(11, "PLAY ARRAKIS") <> 0 THEN pulldown = 1
IF checkcenter(13, "SELECT HOUSE") <> 0 THEN pulldown = 2
IF checkcenter(15, "SETTINGS") <> 0 THEN pulldown = 3
IF checkcenter(17, "PLAY SKIRMISH") <> 0 THEN pulldown = 4
IF checkcenter(19, "EXIT GAME") <> 0 THEN pulldown = 5
setnormalfont
IF pulldown = 1 THEN setselectedfont
center 11, "PLAY ARRAKIS", 2
setnormalfont
IF pulldown = 2 THEN setselectedfont
center 13, "SET HOUSES", 2
setnormalfont
IF pulldown = 3 THEN setselectedfont
center 15, "SETTINGS", 2
setnormalfont
IF pulldown = 4 THEN setselectedfont
center 17, "PLAY SKIRMISH", 2
setnormalfont
IF pulldown = 5 THEN setselectedfont
center 19, "EXIT GAME", 2
'Mouse clicked
IF DQBmouseLB = -1 THEN
IF pulldown = 1 THEN spelen = TRUE
IF pulldown = 2 THEN menuitem = 1 'Select house
IF pulldown = 3 THEN menuitem = 2 'Settings
IF pulldown = 4 THEN menuitem = 3 'Play Skirmish
IF pulldown = 5 THEN
DQBclose
CLS
PRINT "Thanks for Playing Arrakis"
PRINT
PRINT "Version : 1.12"
PRINT
OPEN "DATA\TEMPR.TMP" FOR OUTPUT AS #1
PRINT #1, "2"
CLOSE #1
'Save last settings
END
END IF
END IF
END IF
IF spelen = TRUE THEN
playgame:
processhouses
spelen = FALSE
END IF
' SELECT HOUSE!!!!!!!!!!!!!!!
IF menuitem = 1 THEN
setnormalfont
'SELECT HOUSE
center 7, "- SET HOUSES -", 2
setselectedfont
center 8, "CHOOSE YOUR HOUSE HERE", 2
setnormalfont
center 10, "PLAY AS:", 2
IF playinghouse = 0 THEN h$ = "ATREIDES": setatreidesfont
IF playinghouse = 1 THEN h$ = "HARKONNEN": setharkonnenfont
IF playinghouse = 2 THEN h$ = "ORDOS": setordosfont
IF checkcenter(11, "HARKONNEN") <> 0 THEN
setselectedfont
otherenemy = 0
IF DQBmouseLB = TRUE THEN playinghouse = playinghouse + 1: dqbwait 10: otherenemy = 1
IF DQBmouseRB = TRUE THEN playinghouse = playinghouse - 1: dqbwait 10: otherenemy = 1
IF playinghouse < 0 THEN playinghouse = 2
IF playinghouse > 2 THEN playinghouse = 0
END IF
center 11, UCASE$(h$), 2
setnormalfont
center 13, "PLAY AGAINST:", 2
IF otherenemy <> 0 THEN
again:
penemyhouse = INT(RND * 3)
IF penemyhouse = playinghouse THEN GOTO again
END IF
IF penemyhouse = 0 THEN h$ = "ATREIDES": setatreidesfont
IF penemyhouse = 1 THEN h$ = "HARKONNEN": setharkonnenfont
IF penemyhouse = 2 THEN h$ = "ORDOS": setordosfont
center 14, UCASE$(h$), 2
setnormalfont
IF checkcenter(18, "BACK") <> 0 THEN
setselectedfont
IF DQBmouseLB = TRUE THEN menuitem = 0
END IF
center 18, "BACK", 2
setnormalfont
END IF
' SETTINGS
IF menuitem = 2 THEN
setnormalfont
center 7, "- SETTINGS MENU -", 2
setnormalfont
center 10, "GAME SPEED:", 2
setharkonnenfont
IF speed = 0 THEN h$ = "PENTIUM II OR BETTER"
IF speed = 1 THEN h$ = "PENTIUM I 200MHZ"
IF speed = 2 THEN h$ = "PENTIUM I 166MHZ"
IF speed = 3 THEN h$ = "PENTIUM I 75MHZ"
IF speed = 4 THEN h$ = "486 PC"
IF checkcenter(11, "PENTIUM II OR BETTER") <> 0 THEN
setselectedfont
IF DQBmouseLB = TRUE THEN speed = speed + 1: dqbwait 10
IF DQBmouseRB = TRUE THEN speed = speed - 1: dqbwait 10
IF speed < 0 THEN speed = 4
IF speed > 4 THEN speed = 0
END IF
center 11, UCASE$(h$), 2
setnormalfont
s$ = STR$(amountspice)
r$ = STR$(amountrock)
zs$ = STR$(sizespice)
ZR$ = STR$(sizerock)
setatreidesfont
center 15, "RANDOM MAP GENERATOR", 2
setnormalfont
IF checkcenter(16, "ROCK PLATES:" + UCASE$(r$)) <> 0 THEN
setselectedfont
IF DQBmouseLB = TRUE THEN amountrock = amountrock + 1: dqbwait 10
IF DQBmouseRB = TRUE THEN amountrock = amountrock - 1: dqbwait 10
END IF
center 16, "ROCK PLATES:" + UCASE$(r$), 2
setnormalfont
IF checkcenter(17, "SPICE FIELDS:" + UCASE$(s$)) <> 0 THEN
setselectedfont
IF DQBmouseLB = TRUE THEN amountspice = amountspice + 1: dqbwait 10
IF DQBmouseRB = TRUE THEN amountspice = amountspice - 1: dqbwait 10
END IF
center 17, "SPICE FIELDS:" + UCASE$(s$), 2
setnormalfont
IF checkcenter(18, "SIZE ROCK PLATES:" + UCASE$(ZR$)) <> 0 THEN
setselectedfont
IF DQBmouseLB = TRUE THEN sizerock = sizerock + 10: dqbwait 10
IF DQBmouseRB = TRUE THEN sizerock = sizerock - 10: dqbwait 10
END IF
center 18, "SIZE ROCK PLATES:" + UCASE$(ZR$), 2
setnormalfont
IF checkcenter(19, "SIZE SPICE FIELDS:" + UCASE$(zs$)) <> 0 THEN
setselectedfont
IF DQBmouseLB = TRUE THEN sizespice = sizespice + 10: dqbwait 10
IF DQBmouseRB = TRUE THEN sizespice = sizespice - 10: dqbwait 10
END IF
center 19, "SIZE SPICE FIELDS:" + UCASE$(zs$), 2
IF amountspice < 1 THEN amountspice = 1
IF amountrock < 1 THEN amountrock = 1
IF sizespice < 50 THEN sizespice = 50
IF sizerock < 50 THEN sizerock = 50
IF amountspice > 25 THEN amountspice = 25
IF amountrock > 25 THEN amountrock = 25
IF sizespice > 500 THEN sizespice = 500
IF sizerock > 500 THEN sizerock = 500
som = (amountspice * sizespice) + (amountrock * sizerock)
s = amountspice
zs = sizespice
r = amountrock
ZR = sizerock
IF som >= 15000 THEN
setharkonnenfont
center 13, "HIGH AMOUNTS WILL TAKE LONG TIME TO", 2
center 14, "CREATE A MAP. KEEP IT REASONABLE...", 2
setnormalfont
END IF
setnormalfont
IF checkcenter(21, "BACK") <> 0 THEN
setselectedfont
IF DQBmouseLB = TRUE THEN menuitem = 0
END IF
center 21, "BACK", 2
setnormalfont
END IF
'SKIRMISH
IF menuitem = 3 THEN
setnormalfont
center 7, "- PLAY SKIRMISH -", 2
setselectedfont
center 8, "PLAY RANDOM GENERATED MAPS", 2
IF maxskirmaps >= 0 THEN setharkonnenfont ELSE setnormalfont
IF checkcenter(9, " PREVIOUS ") <> 0 AND maxskirmaps >= 0 THEN
setselectedfont
IF DQBmouseLB = TRUE THEN
'previous mission
mlist = mlist - 1
dqbwait 10
IF mlist < 0 THEN mlist = 0
END IF
END IF
center 9, " PREVIOUS ", 2
IF maxskirmaps >= 0 THEN
FOR lm = mlist TO maxskirmaps
t = t + 1
IF t = 1 THEN setselectedfont: playmap$ = mapfile$(lm): ELSE setnormalfont
center 10 + t, mapfile$(lm), 2
IF t > 4 THEN EXIT FOR
NEXT lm
dqbbox 1, 200, 80, 210, 134, 100
groottey = (52 / (maxskirmaps + 1))
posy = (groottey * (mlist))
IF DQBmouseX >= 200 AND DQBmouseX <= 210 AND DQBmouseY >= 80 AND DQBmouseY <= 134 THEN
dqbbox 1, 200, 80, 210, 134, 200
pos1 = DQBmouseY - 80
IF DQBmouseLB = TRUE THEN
IF pos1 < posy THEN mlist = mlist - 1
IF pos1 > posy THEN mlist = mlist + 1
IF mlist < 0 THEN mlist = 0
IF mlist > maxskirmaps THEN mlist = maxskirmaps
END IF
END IF
dqbboxf 1, 201, 81 + posy, 209, 81 + posy + groottey, 150
ELSE
setordosfont
center 12, "NO MAPS AVAILABLE", 2
END IF
IF maxskirmaps >= 0 THEN setharkonnenfont ELSE setnormalfont
IF checkcenter(17, " NEXT ") <> 0 AND maxskirmaps >= 0 THEN
setselectedfont
IF DQBmouseLB = TRUE THEN
'previous mission
mlist = mlist + 1
dqbwait 10
IF mlist > maxskirmaps THEN mlist = maxskirmaps
END IF
END IF
center 17, " NEXT ", 2
setnormalfont
IF checkcenter(18, "PLAY NEW MISSION") <> 0 THEN
setselectedfont
IF DQBmouseLB = TRUE THEN
'Play a new mission, random generate it, set flag SKIRMIS
skirmish = 2 'Create new map
GOTO playgame
END IF
END IF
center 18, "PLAY NEW MISSION", 2
setnormalfont
IF checkcenter(19, "PLAY MAP<" + UCASE$(playmap$) + ">") <> 0 AND maxskirmaps >= 0 THEN
setselectedfont
IF DQBmouseLB = TRUE THEN
'Play a selected mission, random generate it, set flag SKIRMIS
skirmish = 1 'Dont create new map
GOTO playgame
END IF
END IF
center 19, "PLAY MAP<" + UCASE$(playmap$) + ">", 2
setnormalfont
IF checkcenter(21, "BACK") <> 0 THEN
setselectedfont
IF DQBmouseLB = TRUE THEN menuitem = 0
END IF
center 21, "BACK", 2
setnormalfont
END IF
END SUB
SUB processhouses
'This will copy the house you want to play with to the specific dir
'DATA\GRAPHICS\ATR
'DATA\GRAPHICS\COMMON
'Also the ARRAKIS.DAT from that house will be copied as ARRAKIS.EXE
'Into the ARRAKIS dir , and we can play!
'Ok, now convert variables
currenthouse = playinghouse + 1
enemyhouse = penemyhouse + 1
'If arrakis locks up, the program FIX.EXE will check the Arrakis dir
'and then fix any errors.
'Ok
'the dir we should copy from is...
IF currenthouse = 1 THEN dir$ = "DATA\HOUSES\ATREIDES\": mycolor = 40 'Atreides
IF currenthouse = 2 THEN dir$ = "DATA\HOUSES\HARKONN\": mycolor = 170'Harkonnen
IF currenthouse = 3 THEN dir$ = "DATA\HOUSES\ORDOS\": mycolor = 201 'Ordos
'Ok
'the dir we copy TO is DATA\GRAPHICS\ATR, and ...\COMMON
'These dir names are also in the house dirs.
'We also have an enemy, SO, we need an enemy, well that is a house
'but NOT our house!
'Ok, now we have enemy houses
'the dir we should copy from for enemy
'House colors:
'170 = Hark
'40 = Atr
'201 = Ord
IF enemyhouse = 1 THEN dir2$ = "DATA\HOUSES\ATREIDES\" 'Atreides
IF enemyhouse = 2 THEN dir2$ = "DATA\HOUSES\HARKONN\" 'Harkonnen
IF enemyhouse = 3 THEN dir2$ = "DATA\HOUSES\ORDOS\" 'Ordos
'Ok string for HSS file
IF enemyhouse = 1 THEN hss$ = "ATREIDES": enemycolor = 40
IF enemyhouse = 2 THEN hss$ = "HARKONNEN": enemycolor = 170
IF enemyhouse = 3 THEN hss$ = "ORDOS": enemycolor = 201
'For myhouse too
IF currenthouse = 1 THEN hss2$ = "ATREIDES"
IF currenthouse = 2 THEN hss2$ = "HARKONNEN"