-
Notifications
You must be signed in to change notification settings - Fork 1
/
treke.for
2137 lines (1590 loc) · 48.2 KB
/
treke.for
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
C====================================================
C TREK7 MODULE E
C CONVERTED TO PC BY: DAN GAHLINGER
C ENTIRE MODULE TYPE-EXACT CHECK 04/27/2000 BY: D.G.
C
C C-O SHIP OPERATIONS
C
C ATACK MORDOR PIKE DOOMVE EDIBLE MNERVA
C ASIMOV NIVEN WODEN ALPHA SIMAK LEGUIN
C
C====================================================
C -- DONALD ECCLESTONE SUBPROGRAM FOR T R E K 7
C
C CONVERTED TO PC BY: DAN GAHLINGER
C TYPE-EXACT CHECK 04/27/2000 BY: D.G.
C
C AAA TTTTT AAA CCC K K
C A A T A A C K K
C AAAAA T AAAAA C KKK
C A A T A A C K K
C A A T A A CCC K K
C
CV COMPUTER-OPERATED ENEMIES ATTACK ROUTINE
CV ==========================
CV INPUT TRANSFER PARAMETERS
CV ==========================
CV J1 - ROW OF NEAREST M-O SHIP TO EAGLE?
CV KOENIG - EAGLE PARTY ATTACK
CV
CV ===================
CV INTERNAL VARIABLES
CV ===================
CV I - C-O SHIP INDEX
CV IVV - INTERNAL FLAG FOR ??? (VALUES: 0/1/2)
CV
CV ==================
CV OUTPUT PARAMETERS
CV ==================
CV J1 - ROW OF NEAREST M-O SHIP TO EAGLE?
CV J2 - COL OF NEAREST M-O SHIP TO EAGLE?
CV N - ??? (4/2)
CV DIST - CURRENT TURNS DISTANCE TO (NEAREST) VESSEL(INDEX)
CV KOENIG - EAGLE PARTY ATTACK FLAG
CV
SUBROUTINE ATACK
LOGICAL MORDOR
INTEGER ITZRO,ITVL1
REAL RTZRO,RTVL1
COMMON /C/L,A,B,I,NA,IV,I7,I8,N,DISTP,AJUST,MIN,ISTAT,JTK,KOENIG,
*IGNORE,IO,IGOL(80)
COMMON /D/DFLCT(4),DFLCK(8),DFLCB(2)
COMMON /I/IONK(8),ISPOK(8),ION(4),ISPOT(4)
COMMON /K/IWHO(8),DIST(8),KILLZ,KILLR,KILLD,KILLG,IGOCO(8)
COMMON /L/IENTR(4),IENTC(4),IKLNR(8),IKLNC(8),IGLER(25),IGLEC(25),
*IBASR(2),IBASC(2),LI2(4),LI2R(5),LI2C(5),IGO(4),MINES
COMMON /M/MAP(60,60),IBLK,IENM1(8),IEE(4),IGLE,IM(4),III,ISTAR
COMMON /N/INAME(3,4),IENM2(4,8),ISIDE(3,2),IBASE(2)
COMMON /Q/IARMZ(6),INDUZ,IXRYZ,IMAGZ,IMAGRZ,IABSZ,ISTAZ,INVIZ(4),
*ICLOZ,IONNO,IPLANZ,IRUNZ,IDEVZ,IDRIZ,IMAXZ
COMMON /T/ICHOE(4),ICHOS(8),ICHOB(2)
COMMON /U/LAUNCH,NUMOUT,NUME(2)
COMMON /V/IWEB(2),IWEBZ,INVIS(4)
COMMON /TOM/ITOM
CV ========================
CV LOOP OVER C-O SHIPS (I)
CV ========================
CV LOOP OVER C-O SHIPS (I) FOR 1 TO 8
DO 1000 I=1,8
N=4
DIST(I)=100.
CV IF C-O SHIP NOT IN GAME: CV NEXT C-O SHIP
IF(ICHOS(I).NE.1)GO TO 1000
CV IF C-O SHIP CAUGHT IN WEB OF ...: CV NEXT C-O SHIP
IF(IWEB(1).EQ.I+4)GO TO 1000
CV IF C-O SHIP CAUGHT IN WEB OF ...: CV NEXT C-O SHIP
IF(IWEB(2).EQ.I+4)GO TO 1000
CV
IF(IO.EQ.1)TYPE 1970,I
1970 FORMAT(' BEGIN ATACK I=',I)
CV IF NO RELEVANT C-O SHIP FOUND (MORDOR = TRUE): NEXT C-O SHIP
IF(MORDOR(MM,MN,RAD,BERNG))GO TO 1000
CV ELSE:
CV IF C-O SHIP = ORION OR KZINTI: 10100 (SKIP N=4)
IF(I.EQ.5.OR.I.EQ.6)GO TO 10100
CV GO TO 1010 (WHY GO TO???, 1010 IS NEXT ANYWAY!; CHECKED AGAINST SCAN)
GO TO 1010
1010 N=4
CV CONVERT BEARING ANGLE FROM RADIAN TO DEGREES
10100 BERNG=BERNG*3.14159265/180.
AJUST=0.0
IGNORE=0
IV=I+4
IF(IONNO.EQ.1.AND.I.EQ.6)IGNORE=1
ITZRO=0
CV
10101 CALL HORTA(IKLNR(I),IKLNC(I),MM,MN,RAD,BERNG,
*ITZRO,AJUST,IGNORE,DIST(I),ITZRO)
IF(IO.EQ.1)TYPE 1972,MIN,I7,I8,DISTP
1972 FORMAT(' MIN=',I,' I7=',I,' I8=',I,' DISTP=',F)
CV M-O SHIP
IF(MIN.LT.5)GO TO 101
CV C-O SHIP, STARBASE, STAR OR EAGLE
IF(MIN.LT.15)GO TO 100
CV MINE
IF(MIN.LT.19)GO TO 103
CV ION STORM
IF(MIN.EQ.19)GO TO 102
CV OUT OF RANGE
IF(MIN.EQ.21)GO TO 108
CV IF C-0 SHIP IS NOT ANY OF (KLINGONS, ROMULANS, THOLIANS)
CV BUT (GORNS, ORIONS, KZINTI, DOOMSDAY, MOONBASE)
CV : 106
100 IF(I.GT.3)GO TO 106
CV INCREASE AJUST BY PI/12 (15 DEGREES)
AJUST=AJUST+0.2617993
CV IF AJUST > 2PI (360 DEGREES): 107
IF(AJUST.GT.6.283184)GO TO 107
IONK(I)=0
IGNORE=0
CV REPEAT HORTA
GO TO 10101
CV
106 RAD=RAD-DISTP+1.42
IVV=0
CV
IF(IONNO.EQ.1.AND.I.EQ.6)IGNORE=1
1060 IVVV=N
N=2
10801 I81=I8
I71=I7
RTZRO=0.0
ITVL1=1
RTVL1=1.5
CALL HORTA(I71,I81,IKLNR(I),IKLNC(I),
*RTVL1,RTZRO,ITZRO,RTZRO,ITVL1,RTZRO,ITZRO)
CV
IF(MIN.NE.I+4.AND.MIN.NE.19.AND.MIN.LT.21)GO TO 10801
CV =====
CV MOVE
CV =====
CV SET POSTION "IKLNR(I),IKLNC(I)" TO "BLANK" (=EMPTY)
CV := MOVE C-O SHIP TO I7,I8, BUT NOT DISPLAYED IN MAP
1080 MAP(IKLNR(I),IKLNC(I))=IBLK
IF(ISPOK(I).EQ.1)MAP(IKLNR(I),IKLNC(I))=III
ISPOK(I)=0
IKLNR(I)=I7
IKLNC(I)=I8
IF(MAP(I7,I8).EQ.III)ISPOK(I)=1
IF(IVV.EQ.1)GO TO 10093
CV REPEAT HORTA
IF(IVV.EQ.2)GO TO 10101
N=IVVV
AJUST=AJUST+0.785398163
CV 0.785398163
CV
IF(AJUST.GT.10.)GO TO 10093
CV REPEAT HORTA
GO TO 10101
CV M-O SHIP
101 IF(N.EQ.5)GO TO 106
IF(N.EQ.6)GO TO 1061
IVV=1
GO TO 1060
CV ION-STORM
102 RAD=(RAD-DISTP)/2.
IONK(I)=1
IGNORE=1
IVV=2
GO TO 1080
CV
107 IVV=1
GO TO 1060
CV C-O SHIP (I) - MINE COLLISION
103 CALL MNERVA(I)
IVV=1
MAP(I7,I8)=IBLK
GO TO 1080
CV OUT OF RANGE
108 IVV=1
GO TO 1080
1061 DO 535 IV=1,4
IF(ICHOE(IV).EQ.0)GO TO 535
L=IV+4
WRITE(L,1062)(INAME(IQ0,MIN),IQ0=1,3)
1062 FORMAT(' THE KZINTI WARSHIP HAS RAMMED THE ',3A4)
535 CONTINUE
MAP(I7,I8)=IBLK
MAP(IKLNR(6),IKLNC(6))=IBLK
IF(ISPOK(6).EQ.1)MAP(IKLNR(6),IKLNC(6))=III
DFLCT(MIN)=-1.
DFLCK(6)=-1.
ISTAT=2
RETURN
10093 IF(I.NE.6)GO TO 1063
CALL NIVEN
CV NEXT C-O SHIP
GO TO 1000
1063 CALL ASIMOV(MAP(IKLNR(I),IKLNC(I)),I)
IF(I.NE.2)GO TO 1029
1205 N=DFLCK(I)/5.
IF(N.EQ.0)GO TO 672
CALL RANDO(J,1,N)
IF(J.GT.1)GO TO 1029
672 DO 536 IV=1,4
IF(ICHOE(IV).NE.1)GO TO 536
L=IV+4
INVIS(IV)=1
WRITE(L,1030)
1030 FORMAT(' THERE HAS BEEN A BREAKDOWN IN THE ROMULAN WARSHIP''S CLO
*AKNG DEVICE'/' AND THE SHIP CAN NOW BE PICKED UP BY OUR SENSORS')
536 CONTINUE
1029 MAP(I7,I8)=IENM1(I)
CV NEXT C-O SHIP
1000 CONTINUE
CV ===================================
CV PROCESS MOONBASE AND EAGLES IF ANY
CV ===================================
CV IF NO MOONBASE AND NO EAGLES OUT: RETURN
IF(ICHOS(8).EQ.0.AND.NUMOUT.EQ.0)RETURN
CV ELSE:
CV SET EAGLE PARTY ATTACK FLAG TO 1
KOENIG=1
CV MANAGE EAGLE LAUNCHING
CALL ALPHA
RETURN
END
C DONALD ECCLESTONE SUBPROGRAM FOR T R E K 7 --
C CONVERTED TO PC BY: DAN GAHLINGER
C TYPE-EXACT CHECK 04/27/2000 BY: D.G.
C
C - MORDOR
C
C -WHERE THE SHADOWS LIE
CV C-O SHIP ACTIONS COMMON MAIN ROUTINE
LOGICAL FUNCTION MORDOR(MM,MN,RAD,BERNG)
COMMON /C/L,A,B,I,NA,IV,I7,I8,N,DISTP,AJUST,MIN,ISTAT,JTK,KOENIG,
*IGNORE,IO,IGOL(80)
COMMON /D/DFLCT(4),DFLCK(8),DFLCB(2)
COMMON /I/IONK(8),ISPOK(8),ION(4),ISPOT(4)
COMMON /K/IWHO(8),DIST(8),KILLZ,KILLR,KILLD,KILLG,IGOCO(8)
COMMON /L/IENTR(4),IENTC(4),IKLNR(8),IKLNC(8),IGLER(25),IGLEC(25),
*IBASR(2),IBASC(2),LI2(4),LI2R(5),LI2C(5),IGO(4),MINES
COMMON /Q/IARMZ(6),INDUZ,IXRYZ,IMAGZ,IMAGRZ,IABSZ,ISTAZ,INVIZ(4),
*ICLOZ,IONNO,IPLANZ,IRUNZ,IDEVZ,IDRIZ,IMAXZ
COMMON /R/IBPSC(4),IBPSB(8),IBPSS(2),IBPSE(25)
COMMON /T/ICHOE(4),ICHOS(8),ICHOB(2)
COMMON /V/IWEB(2),IWEBZ,INVIS(4)
COMMON /TOM/ITOM
CV SET DEFAULT TO TRUE
MORDOR=.TRUE.
CV CALCULATE NEAREST "IBPSB(I)" ??? TO C-O SHIP
CALL PIKE(IKLNR(I),IKLNC(I),IBPSB(I))
CV IF MIN=0 (NO NEAREST VESSEL): RETURN
IF(MIN.EQ.0)GO TO 1000
CV ELSE: MIN<>0 THERE IS A NEAREST VESSEL
DIST(I)=DISTP
CV SAVE NEAREST VESSEL INDEX TO "IWHO"
IWHO(I)=MIN
CV IF I=8 (MOONBASE): RETURN
IF(I.EQ.8)GO TO 1000
CV IF 6>=MIN>4 (STARBASE): 500
IF(MIN.GT.4)GO TO 500
CV ==========
CV M-O SHIPS
CV ==========
CV ELSE: MIN<=4 (=> M-O SHIP(I7))
CV MM = M-O SHIP ROW
MM=IENTR(MIN)
CV MN = M-O SHIP COL
MN=IENTC(MIN)
CV A = M-O SHIP DEFLECTOR STRENGTH
A=DFLCT(MIN)
CV SKIP OTHER OBJECT TYPES
GO TO 501
CV ==============
CV M-O STARBASES
CV ==============
CV IF 14>=MIN>6: 502
500 IF(MIN.GT.6)GO TO 502
CV ELSE: 6>=MIN>4: (=> STARBASE(I7))
CV CALCULATE STARBASE INDEX I7
I7=MIN-4
CV MM = STARBASE ROW
MM=IBASR(I7)
CV MN = STARBASE COL
MN=IBASC(I7)
CV A = STARBASE DEFLECTOR STRENGTH
A=DFLCB(I7)
CV SKIP OTHER OBJECT TYPES
GO TO 501
CV ==========
CV C-O SHIPS
CV ==========
CV IF MIN>14: 503
502 IF(MIN.GT.14)GO TO 503
CV ELSE: 14>=MIN>6 (=> C-O SHIP(I7))
CV CALCULATE C-O SHIP INDEX I7
I7=MIN-6
CV MM = C-O SHIP ROW
MM=IKLNR(I7)
CV MN = C-O SHIP COL
MN=IKLNC(I7)
CV A = C-O SHIP DEFLECTOR STRENGTH
A=DFLCK(I7)
CV SKIP OTHER OBJECT TYPES
GO TO 501
CV ===========
CV C-O EAGLES
CV ===========
CV MIN>14: (=> EAGLE(I7))
CV CALCULATE EAGLE INDEX I7
503 I7=MIN-14
CV MM = EAGLE ROW
MM=IGLER(I7)
CV MN = EAGLE COL
MN=IGLEC(I7)
CV A = 0 (EAGLE DEFLECTOR STRENGTH)
A=0
CV ====
CV ???
CV ====
CV ???
501 AJUST=0.
CV RESET ION STORM FLAG FOR C-O SHIP (?)
IONK(I)=0
CV GO TO THE LABELS CORRESPONDUNG TO C-O SHIP INDEX (I)
GO TO (1006,1001,1002,1007,1011,110,1012),I
CV ===============
CV I=1 (KLINGONS)
CV ===============
CV CALCULATE RANDOM MAX WARP J (7-9)
1006 CALL RANDO(J,7,9)
CV IF (DIST(I) (?) <=1.5: RETURN
IF(DIST(I).LE.1.5)GO TO 1000
CV SET MAX WARP (RAD) TO FLOAT(J)
RAD=FLOAT(J)
CV
1005 AJUST=0.0
CV =========================================
CV NOT BOARDED OR ??? CHECK FOR ALL VESSELS
CV =========================================
CV IF C-O SHIP (I) IS NOT BOARDED OR GO FLAG IS NOT SET?:
CV CALCULATE BEARING ANGLE (600)
1009 IF(IBPSB(I).EQ.0.OR.IGOCO(I).EQ.0)GO TO 600
CV ELSE:
DISTP=100.
CV NO NEAREST SHIP
IVV=0
CV ===============================================================
CV ITERATIVELY CALCULATE DISTANCE OF THE NEAREST M-O SHIP (DISTP)
CV ===============================================================
CV LOOP OVER ALL M-O SHIPS IV FOR 1 TO 4
DO 601 IV=1,4
CV IF M-O SHIP IS NOT IN GAME
CV OR OWNER OF M-O SHIP IS NOT M-O SHIP PARTY (M-O SHIP IS BOARDED):
CV NEXT M-O SHIP
IF(ICHOE(IV).NE.1.OR.(IBPSC(IV)+1)/2.NE.IBPSB(I))GO TO 601
CV CALCULATE DISTANCE (B) BETWEEN C-O SHIP (I) AND CURRENT M-O SHIP (IV)
B=DI(IKLNR(I),IKLNC(I),IENTR(IV),IENTC(IV))
CV IF DISTANCE BETWEEN C-O SHIP AND M-O SHIP > DISTP: NEXT M-O SHIP
CV => CURRENT M-O SHIP IS FURTHER AWAY THAN THE NEAREST OF THE M-O SHIPS
CV BEFORE
IF(B.GT.DISTP)GO TO 601
CV ELSE: CURRENT M-O SHIP IS NEARER THAN THE NEAREST OF THE M-O SHIPS BEFORE
CV SET IVV TO INDEX OF NEAREST M-O SHIP
IVV=IV
CV SET DISTANCE OF THE NEAREST M-O SHIP TO DISTANCE OF CURRENT SHIP
DISTP=B
CV NEXT M-O SHIP
601 CONTINUE
CV ===============================================================
CV IF NO NEAREST M-O SHIP (?): SKIP SETTING MM/MN TO POSITION
CV OF NEAREST M-O SHIP; CALCULATE BEARING ANGLE
IF(IVV.EQ.0)GO TO 600
CV SET MM TO ROW OF NEAREST M-O SHIP
MM=IENTR(IVV)
CV SET MN TO COL OF NEAREST M-O SHIP
MN=IENTC(IVV)
CV SET ADJUSTMENT ANGLE TO 0
AJUST=0.
CV SET N TO 4 (WHY?)
N=4
CV ========================
CV CALCULATE BEARING ANGLE
CV ========================
CV SET IV TO ROW DISTANCE TO C-O SHIP
600 IV=MM-IKLNR(I)
CV SET IVV TO COL DISTANCE TO C-O SHIP
IVV=MN-IKLNC(I)
CV CALCULATE BEARING ANGLE FOM IV/IVV
BERNG=ANG(IV,IVV)
CV ADD ADJUSTMENT ANGLE TO BEARING ANGLE
1101 BERNG=BERNG+AJUST
CV CONVERT BEARING ANGLE TO RANGE 0 TO 360
IF(BERNG.LT.0)BERNG=BERNG+360.
IF(BERNG.GT.360.)BERNG=BERNG-360.
CV =============================
CV APPLY PUSH/PULL TO M-O SHIPS
CV =============================
CV LOOP OVER M-O SHIPS (I7) FOR 1 TO 4
DO 504 I7=1,4
CV SKIP PUSH/PULL TO M-O SHIP IF M-O SHIP NOT IN GAME
IF(ICHOE(I7).NE.1)GO TO 504
CV APPLY PUSH (DEFLECT) AND PULL (YANK) TO C-O SHIP
CALL DUNSEL(IKLNR(I),IKLNC(I),RAD,BERNG)
CV NEXT M-O SHIP
504 CONTINUE
MORDOR=.FALSE.
CV RETURN
1000 RETURN
CV ===============
CV I=2 (ROMULANS)
CV ===============
CV CALCULATE RANDOM MAX WARP J (7-9)
1001 CALL RANDO(J,7,9)
CV SET MAX WARP (RAD) TO FLOAT(J)
RAD=FLOAT(J)
CV ROMULANS BEHAVIOR
CV KILLR = 1 => NEUTRAL
CV KILLR = 2 => ATTACK
CV KILLR = 3 => RETREAT
CV SET IV TO KILLR SO FAR (INITIALLY: 1)
IV=KILLR
CV LOOP OVER ... ()
DO 10010 J=1,4
CV
10010 INVIS(J)=0
CV IF DISTANCE TO OTHER SHIP <=10 OR KILLR<>1: ATTACK
IF(DISTP.LE.10..OR.KILLR.NE.1)KILLR=2
CV IF DEFLEKTOR STRENGTH OF OTHER SHIP - ROMULAN DEFLEKTOR STRENGTH > 20:
CV RETREAT
IF(A-DFLCK(2).GT.20.)KILLR=3
CV SET IV CHANGE OF KILLR - 0 = NO CHANGE
IV=IV-KILLR
CV
I71=MIN+4
CV GO TO KILLR DEPENDENT LABELS
GO TO (1003,10031,1004),KILLR
CV ===================
CV KILLR=1 => NEUTRAL
CV ===================
CV CALCULATE RANDOM ANGLE BERNG (1-360)
1003 CALL RANDO(J,1,360)
BERNG=FLOAT(J)
CV RE-CALCULATE BEARING ANGLE (1009)
GO TO 1009
CV ==================
CV KILLR=2 => ATTACK
CV ==================
CV CALCULATE RANDOM ANGLE (?) AJUST (-90-+90)
10031 CALL RANDO(J,-90,90)
AJUST=FLOAT(J)
CV IF OPPONENT = M-O SHIP AND CHANGE OF KILLR:
CV WRITE MESSAGE "ROMULAN SHIP ATTACKING"
IF(MIN.LT.5.AND.IV.NE.0)WRITE(I71,10032)
10032 FORMAT(' ROMULAN SHIP ATTACKING')
CV RE-CALCULATE BEARING ANGLE (1009)
GO TO 1009
CV ===================
CV KILLR=3 => RETREAT
CV ===================
CV CALCULATE RANDOM ANGLE (?) AJUST (90-270)
1004 CALL RANDO(J,90,270)
AJUST=FLOAT(J)
CV IF OPPONENT = M-O SHIP AND CHANGE OF KILLR:
CV WRITE MESSAGE "ROMULAN SHIP RETREATING"
IF(MIN.LT.5.AND.IV.NE.0)WRITE(I71,10033)
10033 FORMAT(' ROMULAN SHIP RETREATING')
CV RE-CALCULATE BEARING ANGLE (1009)
GO TO 1009
CV ===============
CV I=3 (THOLIANS)
CV ===============
1002 IF(DISTP.LE.8.)GO TO 1000
CV CALCULATE RANDOM MAX WARP (J)
CALL RANDO(J,5,10)
CV SET MAX WARP TO J
RAD=FLOAT(J)
CV
IF(DISTP-8..LT.RAD)RAD=DISTP-6.5
GO TO 1005
CV ============
CV I=4 (GORNS)
CV ============
CV SET MAXIMUM WARP=11
1007 RAD=11.
KILLG=1
CV
IF(DFLCK(4)-A.LT.25.)KILLG=2
CV
IF(KILLG.EQ.1)GO TO 1005
1008 AJUST=180.
CV RE-CALCULATE BEARING ANGLE (1009)
GO TO 1009
CV =============
CV I=5 (ORIONS)
CV =============
CV SET MAXIMUM WARP=12
1011 RAD=12.
CV STRATEGY CLOSE PASSES
123 AJUST=ABS(ATAN(1.1/DISTP))*180./3.14159265
N=5
CV RE-CALCULATE BEARING ANGLE (1009)
GO TO 1009
CV =============
CV I=6 (KZINTI)
CV =============
CV SET MAXIMUM WARP (RAD) = PROGRMMED MAX WARP (IMAXZ)
110 RAD=IMAXZ
N=4
CV IF KZINTI TYPE OF ENGINES = IONIC DRIVE (1): ISTAT = 11
IF(IDRIZ.EQ.1)ISTAT=11
CV IF SET KZINTI NEUTRAL DISTANCE (KILLZ) = 100: 124
IF(KILLZ.EQ.100)GO TO 124
CV IF DISTANCE OF THE NEAREST SHIP (DISTP)
CV <= KZINTI NEUTRAL DISTANCE (KILLZ): 125
IF(DISTP.LE.KILLZ)GO TO 125
CV
CALL RANDO(I7,1,360)
AJUST=I7
CV RE-CALCULATE BEARING ANGLE (1009)
GO TO 1009
CV SET KZINTI NEUTRAL DISTANCE (KILLZ) TO 100
125 KILLZ=100
CV GO TO LABELS ACCORDING TO KZINTI TYPE OF STRATEGY INDEX
124 GO TO (121,122,123),IPLANZ
CV STRATEGY ATTACK/RETREAT
121 AJUST=0.
IF(A-DFLCK(6).GT.IRUNZ)AJUST=180.
CALL RANDO(I7,-IDEVZ,IDEVZ)
AJUST=AJUST+I7
CV RE-CALCULATE BEARING ANGLE (1009)
GO TO 1009
CV STRATEGY KAMIKAZE
122 AJUST=0.
N=6
CV RE-CALCULATE BEARING ANGLE (1009)
GO TO 1009
CV ===============
CV I=7 (DOOMSDAY)
CV ===============
CV CALL DOOMSDAY ACTIONS FOR OBEJCTS AT MN/MM
1012 CALL DOOMVE(MM,MN)
GO TO 1000
END
C -- DONALD ECCLESTONE SUBPROGRAM FOR T R E K
C CONVERTED TO PC BY: DAN GAHLINGER
C TYPE-EXACT CHECK 04/27/2000 BY: D.G.
C
C - PIKE -
C
CV CALCULATE MIN (NEAREST VESSEL TO PIKE SHIP) FOR:
CV M-O SHIPS, STARBASES, C-O SHIPS AND EAGLES
CV ==========================
CV INPUT TRANSFER PARAMETERS
CV ==========================
CV J1 - ROW OF PIKE (REQUESTING) SHIP
CV J2 - COL OF PIKE SHIP
CV J3 - REQUESTING SHIP OWNER INDEX (1-4)
CV ===================
CV INTERNAL VARIABLES
CV ===================
CV
CV ==================
CV OUTPUT PARAMETERS
CV ==================
CV MIN - NEAREST VESSEL TO PIKE SHIP INDEX
CV NEAREST = M-O SHIP: MIN=1,2,3,4
CV NEAREST = STARBASE: MIN=5,6
CV NEAREST = C-O SHIP: MIN=7,8,9,10,11,12,13,14
CV NEAREST = EAGLE : MIN=15,16,17,...
CV DISTP - DISTANCE TO NEAREST VESSEL
CV
SUBROUTINE PIKE(J1,J2,J3)
COMMON /A/IT,IS,II(2),IJ(2),I3,JS,ISHAK,NOSTOP
COMMON /C/L,A,B,I,NA,IV,I7,I8,N,DISTP,AJUST,MIN,ISTAT,JTK,KOENIG,
*IGNORE,IO,IGOL(80)
COMMON /L/IENTR(4),IENTC(4),IKLNR(8),IKLNC(8),IGLER(25),IGLEC(25),
*IBASR(2),IBASC(2),LI2(4),LI2R(5),LI2C(5),IGO(4),MINES
COMMON /Q/IARMZ(6),INDUZ,IXRYZ,IMAGZ,IMAGRZ,IABSZ,ISTAZ,INVIZ(4),
*ICLOZ,IONNO,IPLANZ,IRUNZ,IDEVZ,IDRIZ,IMAXZ
COMMON /R/IBPSC(4),IBPSB(8),IBPSS(2),IBPSE(25)
COMMON /T/ICHOE(4),ICHOS(8),ICHOB(2)
COMMON /U/LAUNCH,NUMOUT,NUME(2)
COMMON /V/IWEB(2),IWEBZ,INVIS(4)
CV SET START VALUES FOR DISTP AND MIN (NEAREST VESSEL TO PIKE SHIP)
DISTP=100.
MIN=0
CV ==========
CV M-O SHIPS
CV ==========
CV LOOP OVER M-O SHIPS IN RANGE 1 TO 4
DO 1 IVV=1,4
CV IF M-O SHIP NOT IN GAME OR SHIP = HAVOC: NEXT M-O SHIP
IF(ICHOE(IVV).EQ.0.OR.ICHOE(IVV).EQ.3)GO TO 1
CV IF PIKE SHIP (J3) HAS THE SAME STARBASE AS M-O SHIP: NEXT M-O SHIP
IF(J3.EQ.(IBPSC(IVV)+1)/2)GO TO 1
CV SET AJUST = DISTANCE BETWEEN PIKE SHIP (J1,J2) AND M-O SHIP POSITION
AJUST=DI(J1,J2,IENTR(IVV),IENTC(IVV))
CV IF M-O SHIP DISTANCE >= DISTP: NEXT M-O SHIP
IF(AJUST.GE.DISTP)GO TO 1
CV IF M-O SHIP DISTANCE = 0: NEXT M-O SHIP
IF(AJUST.EQ.0)GO TO 1
CV ELSE: SET DISTP = M-O SHIP DISTANCE
DISTP=AJUST
CV NEAREST VESSEL TO PIKE SHIP = IVV (1/2/3/4)
MIN=IVV
CV NEXT M-O SHIP
1 CONTINUE
CV ==========
CV STARBASES
CV ==========
CV LOOP OVER STARBASES IN RANGE 1 TO 2
DO 2 IVV=1,2
CV IF STARBASE NOT IN GAME: NEXT STARBASE
IF(ICHOB(IVV).EQ.0)GO TO 2
CV IF PIKE SHIP (J3) HAS CURRENT STARBASE: NEXT STARBASE
IF(J3.EQ.IBPSS(IVV))GO TO 2
CV SET AJUST = DISTANCE BETWEEN PIKE SHIP (J1,J2) AND STARBASE POSITION
AJUST=DI(J1,J2,IBASR(IVV),IBASC(IVV))
CV IF STARBASE DISTANCE >= DISTP: NEXT STARBASE
IF(AJUST.GE.DISTP)GO TO 2
CV IF STARBASE DISTANCE = 0: NEXT STARBASE
IF(AJUST.EQ.0)GO TO 2
CV IF PIKE OWNER = 0 (NONE) AND STARBASE OWNER SHIP = 0: NEXT STARBASE
IF(J3.EQ.0.AND.IJ(IBPSS(IVV)).EQ.0)GO TO 2
CV ELSE: SET DISTP = STARBASE DISTANCE
DISTP=AJUST
CV NEAREST VESSEL TO PIKE SHIP = IVV+4 (5/6)
MIN=IVV+4
CV NEXT STARBASE
2 CONTINUE
CV ==========
CV C-O SHIPS
CV ==========
CV LOOP OVER C-O SHIPS IN RANGE 1 TO 8
DO 3 IVV=1,8
CV IF C-O SHIP <> KLINGON: NEXT C-O SHIP
IF(ICHOS(IVV).NE.1)GO TO 3
CV IF PIKE SHIP (J3) HAS THE SAME STARBASE AS C-O SHIP: NEXT C-O SHIP
IF(J3.EQ.IBPSB(IVV))GO TO 3
CV SET AJUST = DISTANCE BETWEEN PIKE SHIP (J1,J2) AND C-O SHIP POSITION
AJUST=DI(J1,J2,IKLNR(IVV),IKLNC(IVV))
CV IF C-O SHIP DISTANCE >= DISTP: NEXT C-O SHIP
IF(AJUST.GE.DISTP)GO TO 3
CV IF C-O SHIP DISTANCE = 0: NEXT C-O SHIP
IF(AJUST.EQ.0)GO TO 3
CV IF C-O SHIP <> ROMULAN: 10
IF(IVV.NE.2)GO TO 10
CV IF SUM OF INVISIBILITY FACTORS=0 OR C-O SHIP DISTANCE > 5: NEXT C-O SHIP
IF(INVIS(2*J3-1)+INVIS(2*J3).EQ.0.OR.AJUST.GT.5)GO TO 3
CV SET DISTP = C-O SHIP DISTANCE
GO TO 11
CV IF C-O SHIP IS NOT KZINTI OR KZINTI ARE NOT CLOAKED:
CV SET DISTP = C-O SHIP DISTANCE
10 IF(IVV.NE.6.OR.IARMZ(5).EQ.0)GO TO 11
CV IF SUM OF INVISIBILITY FACTORS=0 OR C-O SHIP DISTANCE > ICLOZ:
CV NEXT C-O SHIP
IF(INVIZ(2*J3-1)+INVIZ(2*J3).EQ.0.OR.AJUST.GT.ICLOZ)GO TO 3
CV ELSE: SET DISTP = C-O SHIP DISTANCE
11 DISTP=AJUST
CV NEAREST VESSEL TO PIKE SHIP = IVV+6 (7/8/9/10/11/12/13/14)
MIN=IVV+6
CV NEXT C-O SHIP
3 CONTINUE
CV =======
CV EAGLES
CV =======
CV IF NO EAGLES ARE OUT: RETURN
4 IF(NUMOUT.EQ.0)RETURN
CV ELSE: EAGLES ARE OUT
CV LOOP OVER EAGLES IVV FOR 1 TO LAUNCH
DO 5 IVV=1,LAUNCH
CV IF EAGLE IVV NOT IN GAME: NEXT EAGLE
IF(IGLER(IVV).EQ.0)GO TO 5
CV IF PIKE SHIP (J3) HAS THE SAME STARBASE AS EAGLE: NEXT EAGLE
IF(J3.EQ.IBPSE(IVV))GO TO 5
CV SET AJUST = DISTANCE BETWEEN PIKE SHIP (J1,J2) AND EAGLE POSITION
AJUST=DI(J1,J2,IGLER(IVV),IGLEC(IVV))
CV IF EAGLE DISTANCE >= DISTP: NEXT EAGLE
IF(AJUST.GE.DISTP)GO TO 5
CV IF EAGLE DISTANCE = 0: NEXT EAGLE
IF(AJUST.EQ.0)GO TO 5
CV ELSE: SET DISTP = EAGLE DISTANCE
DISTP=AJUST
CV NEAREST VESSEL TO PIKE SHIP = IVV+14 (15/16/.../35)
MIN=IVV+14
CV NEXT EAGLE
5 CONTINUE
RETURN
END
C DONALD ECCLESTONE SUBPROGRAM FOR T R E K 7
C CONVERTED TO PC BY: DAN GAHLINGER
C TYPE-EXACT CHECK 04/27/2000 BY: D.G.
C
C - DOOMVE -
C
CV DOOMSDAY MACHINE ACTIONS
CV ==========================
CV INPUT TRANSFER PARAMETERS
CV ==========================
CV MM - TARGET OBJECT ROW
CV MN - TARGET OBJECT COL
CV
CV ===================
CV INTERNAL VARIABLES
CV ===================
CV IGNORE - INTEGER OF CURRENT DISTANCE TO NEAREST VESSEL
CV ISMINE - TRUE IF EDIBLE OBJECT IS A MINE
CV J - EDIBILITY FACTOR OF OBJECT AT MM/MN
CV
CV ==================
CV OUTPUT PARAMETERS
CV ==================
CV
SUBROUTINE DOOMVE(MM,MN)
INTEGER EDIBLE
COMMON /C/L,A,B,I,NA,IV,I7,I8,N,DISTP,AJUST,MIN,ISTAT,JTK,KOENIG,
*IGNORE,IO,IGOL(80)
COMMON /D/DFLCT(4),DFLCK(8),DFLCB(2)
COMMON /I/IONK(8),ISPOK(8),ION(4),ISPOT(4)
COMMON /K/IWHO(8),DIST(8),KILLZ,KILLR,KILLD,KILLG,IGOCO(8)
COMMON /L/IENTR(4),IENTC(4),IKLNR(8),IKLNC(8),IGLER(25),IGLEC(25),
*IBASR(2),IBASC(2),LI2(4),LI2R(5),LI2C(5),IGO(4),MINES
COMMON /M/MAP(60,60),IBLK,IENM1(8),IEE(4),IGLE,IM(4),III,ISTAR
COMMON /N/INAME(3,4),IENM2(4,8),ISIDE(3,2),IBASE(2)
COMMON /T/ICHOE(4),ICHOS(8),ICHOB(2)
COMMON /V/IWEB(2),IWEBZ,INVIS(4)
COMMON /TOM/ITOM
LOGICAL ISMINE
CV SET IGNORE TO INTEGER OF CURRENT DISTANCE TO NEAREST VESSEL
1012 IGNORE=IFIX(DISTP)
CV ===========================
CV FIND NEAREST EDIBLE OBJECT
CV ===========================
CV LOOP OVER N (?) FROM 1 TO IGNORE (?)
DO 506 N=1,IGNORE
CV IVVV = DOOMSDAY ROW-N+1
IVVV=IKLNR(7)-N+1
CV IVV = DOOMSDAY ROW-N1-1
IVV=IKLNR(7)+N-1
CV I71 = DOOMSDAY COL-N
I71=IKLNC(7)-N
CV I81 = DOOMSDAY COL+N
I81=IKLNC(7)+N
CV IVVV MINIMUM=1
IF(IVVV.LT.1)IVVV=1