-
Notifications
You must be signed in to change notification settings - Fork 1
/
trekc.for
3346 lines (2504 loc) · 81.5 KB
/
trekc.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
C TREK7 MODULE C
C
C M-O SHIP OPERATIONS
C
C SULU DUNSEL LAUREL HARDY SPOCK SAREK
C MUDD HARPO TPRING CHICO ZEPPO TANRU
C LARRY CURLY MOE
C
C=====================================================
C -- DONALD ECCLESTONE SUBPROGRAM FOR T R E K 7
C CONVERTED TO PC BY: DAN GAHLINGER
C TYPE-EXACT CHECK 04/26/2000 BY: D.G.
C
C SSSS U U L U U
C S U U L U U
C SSS U U L U U
C S U U L U U
C SSSS UUU LLLLL UUU
CV MOVE M-O SHIPS TO INTERMEDIATE / TARGET POSITION
CV INCLUDING ALL POSSIBLE OBSTACLES AND ADVERSITIES
CV
CV ==========================
CV INPUT TRANSFER PARAMETERS
CV ==========================
CV J - NOT USED ALTHOUGH PARAMETER TO SULU ???
CV IT - INDEX OF M-O SHIP TO MOVE
CV IENTR - CURRENT M-O SHIP ROW
CV IENTC - CURRENT M-O SHIP COL
CV ITROW - TARGET ROW
CV ITCOL - TARGET COL
CV
CV ===================
CV INTERNAL VARIABLES
CV ===================
CV Q - ACTUAL WARP SPEED
CV
CV ==================
CV OUTPUT PARAMETERS
CV
CV ISTAT - ???
CV
CV ======
CV STEPS (NOT NECESSARILY EXECUTED IN THAT ORDER!)
CV ======
CV 1. DAMAGES DISTINCTION
CV 2. POTENTIONAL WEB TRAPPING/ESCAPING
CV 3. POTENTIONAL DAMAGES BY WEB (LAUREL)
CV 4. SPEED MANAGEMENT & POTENTIAL VEERING
CV 5. CALCULATE RANDOM VEERING TARGET
CV 6. ARRIVED AT TARGET / INTERMEDIATE POSITION
CV 7. POTENTIONAL DEFLECTOR BEAM / TRACTOR BEAM (DUNSEL, HORTA)
CV 8. POTENTIONAL COLLISION WITH C-O SHIP
CV 9. POTENTIAL M-O SHIP / ANOTHER M-O SHIP RAMMING
CV 10. POTENTIAL COURSE BLOCKAGE BY A STAR (HORTA)
CV 11. MOVE M-O SHIP TO INTERMEDIATE / TARGET POSITION
CV 12. POTENTIAL DILITHIUM SENSING
CV 13. POTENTIAL DILITHIUM ACQUISITION AND PROCESSING
CV 14. POTENTIAL TARGET POSITION IN ION STORM
CV 15. POTENTIAL COLLISION OF OBJECT AND MINE
CV 16. POTENTIAL COLLISION OF OBJECT AND EAGLE
CV 17. DAMAGE CALCULATION FROM MINE OR EAGLE COLLISION (GRUP1)
CV FINISH
CV
LOGICAL FUNCTION SULU(J)
LOGICAL CYRANO
C
C
INTEGER ITZRO,ITVL1
REAL RTZRO,RTVL1
C INSERTED TO TAKE CARE OF CALL LIST PROBLEMS
C***
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 /D/DFLCT(4),DFLCK(8),DFLCB(2)
COMMON /E/PHASR(4),TWARP(4),IPHOT(4),NDEAD(4),ISURR(4)
COMMON /F/WARP(4),ITROW(4),ITCOL(4)
COMMON /I/IDNK(8),ISPOK(8),ION(4),ISPOT(4)
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 /O/MA(4,33),K(4,14),NOMAP(4),MANUM(4),HIVEL(4,2),ITEMP(4),
*NOMOV(4)
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 SET "REACHED TARGET COORDINATES" TO FALSE
SULU=.FALSE.
CV ???
ISTAT=0
CV IF REACHED TARGET COORDINATES (ITCOL/ITROW) YES:
CV GOTO 1002 (VEERING DECISION)
IF(ITCOL(IT).EQ.IENTC(IT).AND.ITROW(IT).EQ.IENTR(IT))GO TO 1002
CV ====================
CV DAMAGES DISTINCTION
CV ====================
CV IF NOT ANY OF THE ENGINE NACELLES DESTROYED: CV LOOP OVER WEBS (110)
IF(MA(IT,29).NE.9.OR.MA(IT,30).NE.9)GO TO 110
CV IF IMPULSE ENGINE DESTROYED: MESSAGE, WARP 0, RETURN
IF(MA(IT,28).EQ.9)GO TO 111
CV IF WARP < 2: CV LOOP OVER WEBS (110)
IF(WARP(IT).LT.2.0)GO TO 110
CV ELSE (ANY OF THE ENGINE NACELLES DESTROYED)
CV SET WARP TO 1.5
WARP(IT)=1.5
WRITE(L,113)
113 FORMAT(' WARP ENGINE NACELLES ARE DESTROYED AND THUS WARP GREATER
* THAN 1 IS IMPOSSIBLE')
GO TO 110
111 WRITE(L,112)
112 FORMAT(' ALL ENGINES ARE DESTROYED - MOVEMENT IMPOSSIBLE')
WARP(IT)=0.0
RETURN
CV ==================================
CV POTENTIONAL WEB TRAPPING/ESCAPING
CV ==================================
CV LOOP OVER WEBS (J) FOR 1 TO 2
110 DO 1000 J=1,2
CV IF WEB NOT FOR CURRENT SHIP: NO ESCAPE, NEXT WEB
IF(IWEB(J).NE.IT)GO TO 1000
CV IF WARP < 10: NO ESCAPE, NEXT WEB
IF(WARP(IT).LT.10.)GO TO 1000
CV CALCULATE WEB ESCAPE FACTOR IV (1/6 PROBABILITY)
CALL RANDO(IV,1,7)
CV IF WEB ESCAPE FACTOR IV > 1: NO ESCAPE, NEXT WEB
IF(IV.GT.1)GO TO 1000
CV ELSE (IV=1) WEB ESCAPE SUCCESSFUL!
IWEB(J)=0
WRITE(L,1001)(INAME(IQ0,IT),IQ0=1,3)
1001 FORMAT(' THE ',3A4,' HAS BROKEN FREE OF THE WEB')
CV NEXT WEB
1000 CONTINUE
CV IF BOTH WEBS NOT FOR CURRENT SHIP: 1004
IF(IWEB(1).NE.IT.AND.IWEB(2).NE.IT)GO TO 1004
CV WRITE TRAPPING MESSAGE
WRITE(L,1003)(INAME(IQ0,IT),IQ0=1,3)
1003 FORMAT(' THE ',3A4,' IS TRAPPED IN A WEB')
RETURN
CV ===========================
CV POTENTIONAL DAMAGES BY WEB
CV ===========================
CV LOOP OVER WEBS (J) FOR 1 TO 2
1004 DO 100 J=1,2
CV CALCULATE DECK DAMAGE DEPENDENT NACELLE DAMAGE
IF(MA(IT,J+30).EQ.0.OR.MA(IT,J+28).EQ.9)GO TO 100
IF(MA(IT,J+30).EQ.9.AND.WARP(IT).GT.1.)GO TO 109
IF(HIVEL(IT,J).GE.WARP(IT))GO TO 100
I7=10*(WARP(IT)-HIVEL(IT,J))
IF(I7.GT.0)I7=I7+10
CV CALCULATE DAMAGE FACTOR IV (1-100)
CALL RANDO(IV,1,100)
CV IF DAMAGE FACTOR IV > I7: SKIP NACELLE DAMAGE
IF(IV.GT.I7)GO TO 100
CV NACELLE DAMAGE
109 CALL LAUREL(J)
CV NEXT WEB
100 CONTINUE
CV =====================================
CV SPEED MANAGEMENT & POTENTIAL VEERING
CV =====================================
CV IF ACTUAL SPEED > AVAILABLE SPEED
205 IF(WARP(IT).GT.TWARP(IT))WARP(IT)=TWARP(IT)
CV IF WARP <= 1: NO VEERING
1002 IF(WARP(IT).LE.1.)GO TO 10020
CV CALCULATE RANDOM VEERING FACTOR I7 (FROM 1 TO 100)
CV HIGHER VEERING FACTOR: LESS PROBABILITY OF VEERING
CV IF VEERING FACTOR > 33: NO VEERING REGARDLESS OF DAMAGE
CALL RANDO(I7,1,100)
CV IF VEERING FACTOR I7 > (DAMAGE FACTOR OF RELEVANT DECKS (#20)+1)*3:
CV NO VEERING
CV IF NO DAMAGE: VEERING FACTOR I7 > 3: NO VEERING
IF(I7.GT.(MA(IT,20)+1)*3)GO TO 10020
CV J = INTEGER(AVAILABLE WARP POWER)
J=IFIX(TWARP(IT))
CV IF AVAILABLE WARP POWER < 1: RETURN
IF(J.EQ.0)RETURN
WRITE(L,200)
200 FORMAT(' SHORT-CIRCUIT IN WARP DRIVE ENGINEERING ROOM-'/' OUR SHIP
* HAS LOST STEERING CONTROL AND IS VEERING OFF COURSE')
CV ================================
CV CALCULATE RANDOM VEERING TARGET
CV ================================
CV CALCULATE RANDOM VEERING FACTOR IV IN RANGE 0 TO J
201 CALL RANDO(IV,0,J)
CV CALCULATE RANDOM VEERING ROW TARGET
CV IN RANGE ROW +/- RANDOM VEERING FACTOR IV
CALL RANDO(I7,IENTR(IT)-IV,IENTR(IT)+IV)
CV CALCULATE RANDOM VEERING COL TARGET
CV IN RANGE COL +/- RANDOM VEERING FACTOR IV
CALL RANDO(I8,IENTC(IT)-IV,IENTC(IT)+IV)
CV I7: ROW POSITION
CV I8: COLUMN POSITION
CV IF RANDOM VEERING TARGET OUT OF 60X60 AREA: GOTO 201 (RECALCULATE TARGET)
IF(CYRANO(I7,I8))GO TO 201
CV GET NA (WHAT IS AT CALCULATED RANDOM VEERING TARGET)
NA=MAP(I7,I8)
CV IF AT RANDOM VEERING TARGET TARGET THERE IS NEITHER BLANK (EMPTY)
CV NOR ION STORM (THEN THERE IS ANOTHER OBJECT):
CV RECALCULATE RANDOM VEERING TARGET
IF(NA.NE.IBLK.AND.NA.NE.III)GO TO 201
CV ???
J=0
CV MOVE M-O SHIP TO VEERING TARGET
GO TO 5327
CV ==========================================
CV ARRIVED AT TARGET / INTERMEDIATE POSITION
CV ==========================================
CV IF TARGET COORDINATES (ITCOL/ITROW) REACHED:
CV WRITE "... REACHED TARGET COORDINATES" MESSAGE (600)
10020 IF(ITCOL(IT).EQ.IENTC(IT).AND.ITROW(IT).EQ.IENTR(IT))GO TO 600
CV ELSE: ARRIVED AT INTERMEDIATE POSITION
CV SET LOCAL VARIABLE Q TO ACTUAL WARP SPEED
Q=WARP(IT)
CV ==========================================
CV POTENTIONAL DEFLECTOR BEAM / TRACTOR BEAM
CV ==========================================
CV CALCULATE BEARING ANGLE
BERNG=ANG(ITROW(IT)-IENTR(IT),ITCOL(IT)-IENTC(IT))
CV LOOP OVER M-O SHIPS I7 FOR 1 TO 4
DO 224 I7=1,4
CV IF SHIP IS NOT IN GAME: NEXT M-O SHIP
IF(ICHOE(I7).NE.1)GO TO 224
CV IF SHIP IS ACTUAL SHIP: NEXT M-O SHIP
IF(I7.EQ.IT)GO TO 224
CV "CAUGHT IN A DEFLECTOR BEAM" FACTOR ???
MIN=0
CV CALCULATE EFFECT OF DEFLECT AND YANK COMMANDS (IF A TARGET IS HIT)
CALL DUNSEL(IENTR(IT),IENTC(IT),Q,BERNG)
CV MEANING OF MIN VALUES RETURNED BY DUNSEL:
CV MIN=0: NEITHER PUSH NOR PULL
CV MIN=1: PULL
CV MIN=2: PUSH
CV MIN=3: PULL&PUSH
CV IF MIN < 2: SKIP MESSAGE "CAUGHT IN A DEFLECTOR BEAM"
IF(MIN.LT.2)GO TO 222
CV DECREASE MIN BY 2
MIN=MIN-2
CV WRITE MESSAGE "CAUGHT IN A DEFLECTOR BEAM"
WRITE(L,223)(INAME(IQ0,I7),IQ0=1,3)
223 FORMAT(' THE ',3A4,' HAS US CAUGHT IN A DEFLECTOR BEAM')
CV IF MIN = 0: SKIP MESSAGE "CAUGHT IN A TRACTOR BEAM", NEXT M-O SHIP
222 IF(MIN.EQ.0)GO TO 224
WRITE(L,225)(INAME(IQ0,I7),IQ0=1,3)
225 FORMAT(' THE ',3A4,' HAS US CAUGHT IN A TRACTOR BEAM')
CV NEXT M-O SHIP
224 CONTINUE
CV IF ACTUAL WARP SPEED < 1: RETURN
CV (WARP < 1 DOES NOT MOVE THE SHIP, NOT EVEN IF GO/MOVE SEVERAL TIMES!)
IF(Q.LT.1.)RETURN
CV ELSE (ACTUAL WARP SPEED >= 1):
N=1
IV=IT
IGNORE=0
ITZRO=0
RTZRO=0.0
ITVL1=1
CV CALCULATE WHERE THE COURSE LEADS TO AND WHAT IS AT THAT POSITION
770 CALL HORTA(IENTR(IT),IENTC(IT),ITROW(IT),ITCOL(IT),Q,
*RTZRO,ITVL1,RTZRO,IGNORE,RTZRO,ITZRO)
CV WHY SET "J=0" HERE?
CV (SEE DO LOOP "DO 1390 J=1,4" BELOW)
J=0
CV ====================================
CV POTENTIONAL COLLISION WITH C-O SHIP
CV ====================================
CV IF NEITHER M-O SHIP NOR C-O SHIP:
CV POTENTIAL COURSE BLOCKAGE BY A STAR (532)
IF(MIN.GT.12)GO TO 532
CV SET DESTRUCTION FLAG FOR M-O SHIP INDEX IT
DFLCT(IT)=-1.
CV IF OBJECT IS M-O SHIP: POTENTIAL M-O SHIP /
CV ANOTHER M-O SHIP RAMMING (166)
IF(MIN.LT.5)GO TO 166
CV RESET OBJECT INDEX MIN TO C-O SHIP INDEX
MIN=MIN-4
CV LOOP OVER M-O SHIPS J FOR 1 TO 4
DO 1390 J=1,4
CV IF M-O SHIP NOT IN GAME: NEXT M-O SHIP
IF(ICHOE(J).EQ.0)GO TO 1390
CV SET TERMINAL INDEX TO J+4
N=J+4
CV WRITE COLLISON MESSAGE
WRITE(N,235)(INAME(IQ0,IT),IQ0=1,3),(IENM2(IV,MIN),IV=1,4)
235 FORMAT(' THE ', 3A4, ' HAS COLLIDED WITH THE ',4A4/' WHICH HAS
* EXPLODED')
CV NEXT M-O SHIP
1390 CONTINUE
CV SET DESCTRUCTION FLAG FOR COLLIDED C-O SHIP INDEX MIN
CV (MIN NOW: C-O SHIP INDEX)
DFLCK(MIN)=-1.
CV
GO TO 343
CV ==============================================
CV POTENTIAL M-O SHIP / ANOTHER M-O SHIP RAMMING
CV ==============================================
CV LOOP OVER M-O SHIPS J FOR 1 TO 4
166 DO 167 J=1,4
CV IF M-O SHIP NOT IN GAME: NEXT M-O SHIP
IF(ICHOE(J).EQ.0)GO TO 167
CV SET TERMINAL INDEX TO J+4
N=J+4
CV WRITE RAMMING MESSAGE
WRITE(N,168)(INAME(IQ0,IT),IQ0=1,3),(INAME(IQ0,MIN),IQ0=1,3)
168 FORMAT(' THE ',3A4,' HAS RAMMED THE ',3A4)
CV NEXT M-O SHIP
167 CONTINUE
CV SET DESCTRUCTION FLAG FOR OTHER M-O SHIP (INDEX MIN)
DFLCT(MIN)=-1.
CV DELETE OBJECT IN MAP AT I7/I8
343 MAP(I7,I8)=IBLK
CV DELETE OBJECT IN MAP AT IENTR(IT)/IENTR(IT)
MAP(IENTR(IT),IENTC(IT))=IBLK
CV IF ION STORM FLAG SET: RESTORE ION STORM FLAG AT IENTR(IT)/IENTR(IT)
IF(ISPOT(IT).EQ.1)MAP(IENTR(IT),IENTC(IT))=III
RETURN
CV ====================================
CV POTENTIAL COURSE BLOCKAGE BY A STAR
CV ====================================
CV IF OBJECT IS NOT A STAR: 5330
532 IF(MIN.NE.13)GO TO 5330
CV ELSE: COURSE BLOCKED BY A STAR
5320 WRITE(L,535)
535 FORMAT(' OUR COURSE IS BLOCKED BY A STAR')
IV1=I7
IVV=I8
RTVL1=1.5
ITVL1=1
ITZRO=0
RTZRO=0.0
CV CALCULATE INTERMEDIATE POSITION IN FRONT OF BLOCKING STAR
CALL HORTA(IV1,IVV,IENTR(IT),IENTC(IT),RTVL1,RTZRO,ITZRO,
*RTZRO,ITVL1,RTZRO,ITZRO)
CV ================================================
CV MOVE M-O SHIP TO INTERMEDIATE / TARGET POSITION
CV ================================================
CV SET MAP POSITION TO EMPTY (BLANK)
5327 MAP(IENTR(IT),IENTC(IT))=IBLK
CV IF THERE WAS AN ION STORM IN THIS POSITION: RESTORE IT
IF(ISPOT(IT).EQ.1)MAP(IENTR(IT),IENTC(IT))=III
ISPOT(IT)=0
IENTR(IT)=I7
IENTC(IT)=I8
CV IF MOVEBILITY OF SHIP = FULL: SET MOVEBILITY TO REDUCED
IF(IGO(IT).EQ.2)IGO(IT)=1
IF(MAP(IENTR(IT),IENTC(IT)).EQ.III)ISPOT(IT)=1
IF(J.EQ.1)GO TO 770
CV PUT M-O SHIP SYMBOL INTO NEW POSITION IENTR/IENTC
MAP(IENTR(IT),IENTC(IT))=IEE(IT)
CV IF NOT AT TARGET COORDINATES: SKIP "... REACHED TARGET COORDINATES" MESSAGE
IF(IENTR(IT).NE.ITROW(IT).OR.IENTC(IT).NE.ITCOL(IT))GO TO 550
CV WRITE "... REACHED TARGET COORDINATES" MESSAGE
600 WRITE(L,601)
601 FORMAT(' WE''VE REACHED TARGET COORDINATES')
CV
SULU=.TRUE.
CV ============================
CV POTENTIAL DILITHIUM SENSING
CV ============================
CV LOOP OVER DILITHIUM STARS I7 FOR 1 TO 5
550 DO 552 I7=1,5
CV IF DILITHIUM STAR I7 NOT IN GAME: NEXT DILITHIUM STAR (552)
IF(LI2R(I7).EQ.0)GO TO 552
CV IF DILITHIUM STAR CLAIMED BY M-O SHIP : NEXT DILITHIUM STAR (552)
IF(LI2(IT).EQ.I7)GO TO 552
CV IF DILITHIUM STAR MORE THAN 5 ROWS AWAY: SKIP DETECTION MESSAGE,
CV NEXT DILITHIUM STAR (552)
IF(IABS(IENTR(IT)-LI2R(I7)).GT.5)GO TO 552
CV IF DILITHIUM STAR MORE THAN 5 COLS AWAY: SKIP DETECTION MESSAGE,
CV NEXT DILITHIUM STAR (552)
IF(IABS(IENTC(IT)-LI2C(I7)).GT.5)GO TO 552
CV CALCULATE RANDOM PLANET NUMBER I8
CALL RANDO(I8,1,12)
WRITE(L,553)I8,LI2C(I7),LI2R(I7)
553 FORMAT(' SENSORS DETECT A DEPOSIT OF DILITHIUM CRYSTALS ON PLANET
* ',I2/' OF SYSTEM (',I2,',',I2,'). ACQUISITION OPERATIONS WILL COM
*MENCE'/' IF WE CLOSE TO WITHIN 1 UNIT OF THE SYSTEM.')
CV SET M-O SHIP IT CLAIM FOR DILITHIUM STAR I7
LI2(IT)=I7
CV GO TO POTENTIAL DILITHIUM ACQUISITION AND PROCESSING
GO TO 430
CV NEXT DILITHIUM STAR
552 CONTINUE
CV ===============================================
CV POTENTIAL DILITHIUM ACQUISITION AND PROCESSING
CV ===============================================
CV LOOP OVER DILITHIUM STARS I7 FOR 1 TO 5
430 DO 5520 I7=1,5
CV IF DILITHIUM STAR I7 NOT IN GAME: NEXT DILITHIUM STAR (5520)
IF(LI2R(I7).EQ.0)GO TO 5520
CV IF DILITHIUM STAR MORE THAN 1 ROW AWAY: NEXT DILITHIUM STAR
IF(IABS(IENTR(IT)-LI2R(I7)).GT.1)GO TO 5520
CV IF DILITHIUM STAR MORE THAN 1 COL AWAY: NEXT DILITHIUM STAR
IF(IABS(IENTC(IT)-LI2C(I7)).GT.1)GO TO 5520
CV CALCULATE RANDOM DILITHIUM PHASER POWER J
CALL RANDO(J,3500,6500)
CV WRITE MESSAGE "ACQUISITION AND PROCESSING OF DILITHIUM CRYSTALS..."
WRITE(L,551)LI2C(I7),LI2R(I7),J
551 FORMAT(' ACQUISITION AND PROCESSING OF DILITHIUM CRYSTALS FROM SYS
*TEM (',I2,',',I2,') PROCEEDING. '/' PHASER ENERGY INCREASED BY',I5,
*' UNITS. ACQUISITION TERMINATED.')
CV INCREASE AVAILABLE PHASER POWER BY DILITHIUM PHASER POWER
PHASR(IT)=PHASR(IT)+J
CV SET DILITHIUM STAR OUT OF GAME (THE STAR ITSELF REMAINS UNTOUCHED)
LI2R(I7)=0
LI2C(I7)=0
CV SET DILITHIUM STAR CLAIM OF M-O SHIP IT TO "0"
5501 LI2(IT)=0
CV NEXT DILITHIUM STAR
5520 CONTINUE
5321 RETURN
CV =======================================
CV POTENTIAL TARGET POSITION IN ION STORM
CV =======================================
5322 IF(MIN.NE.19)GO TO 5327
ION(IT)=1
IGNORE=1
Q=(Q-DISTP)/2.
J=1
IF(I7.EQ.ITROW(IT).AND.I8.EQ.ITCOL(IT))J=0
GO TO 5327
CV =======================================
CV POTENTIAL COLLISION OF OBJECT AND MINE
CV =======================================
5323 IF(MIN.GT.18)GO TO 5322
DO 228 IV=1,4
IF(ICHOE(IV).EQ.0)GO TO 228
N=IV+4
WRITE(N,16)(INAME(IQ0,IT),IQ0=1,3),
*(INAME(IQ0,MIN-14),IQ0=1,3),I8,I7
16 FORMAT(1X,3A4,' COLLIDED WITH ',3A4,' MINE AT (',I2,',',I2,')')
228 CONTINUE
CV GO TO DAMAGE CALCULATION FROM MINE OR EAGLE COLLISION
GO TO 227
CV ========================================
CV POTENTIAL COLLISION OF OBJECT AND EAGLE
CV ========================================
CV IF OBJECT IS NOT AN EAGLE: 5323
5330 IF(MIN.NE.14)GO TO 5323
CV LOOP OVER EAGLES IV FOR 1 TO LAUNCH
DO 5331 IV=1,LAUNCH
CV IF TARGET POSITION = EAGLE POSITION: 5332
IF(I7.EQ.IGLER(IV).AND.I8.EQ.IGLEC(IV))GO TO 5332
CV NEXT EAGLE
5331 CONTINUE
5332 DO 226 N=1,4
IF(ICHOE(N).EQ.0)GO TO 226
IVV=N+4
WRITE(IVV,5333)(INAME(IQ0,IT),IQ0=1,3),IV,I8,I7,IV,
*(INAME(IQ0,IT),IQ0=1,3)
5333 FORMAT(1X,3A4,' COLLIDED WITH EAGLE',I3,' AT (',I2,',',I2,')'/' EA
*GLE',I3,' DESTROYED'/' DAMAGE REPORT TO THE ',3A4)
226 CONTINUE
CALL BOOM(IV)
CV ================================================
CV DAMAGE CALCULATION FROM MINE OR EAGLE COLLISION
CV ================================================
CV CALCULATE RANDOM DAMAGE FACTOR IV (1-100)
227 CALL RANDO(IV,1,100)
CV CALCULATE DAMAGE NUMBER IVV FROM DEFLECTOR STRENGTH AND DAMAGE FACTOR IV
IVV=ALOG((101.-DFLCT(IT))*IV+10.)/0.700619195-1.8185
CV DAMAGE MANAGEMENT FOR M-O SHIPS
CALL GRUP1(IVV,IT)
GO TO 5327
END
C -- DONALD ECCLESTONE SUBPROGRAM FOR T R E K 7 --
C CONVERTED TO PC BY: DAN GAHLINGER
C TYPE-EXACT CHECK 04/26/2000 BY: D.G.
C
C - DUNSEL -
C
CV RESULT OF PUSH (DEFLECT) AND PULL (YANK) COMMANDS
SUBROUTINE DUNSEL(J1,J2,Q1,Q2)
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 /P/IPULL(4),IPUSH(4),PULL(4),PUSH(4),IPULLR(4),IPULLC(4),
*IPUSHR(4),IPUSHC(4)
CV IF PULL = 0: SKIP PULL CALCULATIONS
IF(IPULL(I7).EQ.0)GO TO 1
IF(IPULLC(I7).NE.J2.OR.IPULLR(I7).NE.J1)GO TO 1
IPULL(I7)=0
B=ANG(IENTR(I7)-J1,IENTC(I7)-J2)
IV=ABS(B-Q2)
IF(IV.LT.90.GT.IV.GT.270)GO TO 1
MIN=1
Q1=Q1/2.0**(PULL(I7)*2.0)
CV IF PUSH = 0: SKIP PUSH CALCULATIONS (IE. RETURN)
1 IF(IPUSH(I7).EQ.0)GO TO 2
IF(IPUSHC(I7).NE.J2.OR.IPUSHR(I7).NE.J1)GO TO 2
IPUSH(I7)=0
B=ANG(J1-IENTR(I7),J2-IENTC(I7))
IV=ABS(B-Q2)
IF(IV.LT.90.OR.IV.GT.270)GO TO 2
Q1=Q1/2.0**(PUSH(I7)/5.)
MIN=MIN+2
2 RETURN
END
C -- DONALD ECCLESTONE SUBPROGRAM FOR T R E K 7 --
C CONVERTED TO PC BY: DAN GAHLINGER
C TYPE-EXACT CHECK 04/26/2000 BY: D.G.
C
C - LAUREL -
C
CV NACELLE DAMAGE
SUBROUTINE LAUREL(J)
INTEGER ITZRO,ITVL1
REAL RTZRO,RTVL1
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 /E/PHASR(4),TWARP(4),IPHOT(4),NDEAD(4),ISURR(4)
COMMON /F/WARP(4),ITROW(4),ITCOL(4)
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 /O/MA(4,33),K(4,14),NOMAP(4),MANUM(4),HIVEL(4,2),ITEMP(4),
*NOMOV(4)
COMMON /T/ICHOE(4),ICHOS(8),ICHOB(2)
COMMON /U/LAUNCH,NUMOUT,NUME(2)
CV WRITE NUMBER OF DAMAGED NACELLE
109 WRITE(L,102)J
102 FORMAT(' NACELLE',I2,' HAS RIPPED FREE OF THE SECONDARY HULL')
CV IF MOVEBILITY OF SHIP = FULL: SET MOVEBILITY TO REDUCED
IF(IGO(IT).EQ.2)IGO(IT)=1
CV IF DAMAGE OF DECK J+28 > 0: REDUCE NUMBER OF DAMAGED DECKS BY 1 (?)
IF(MA(IT,J+28).GT.0)MANUM(IT)=MANUM(IT)-1
CV RAISE NUMBER OF DAMAGED DECKS BY 1
MANUM(IT)=MANUM(IT)+1
CV SET DAMAGE FACTOR TO MAXIMUM FOR RELEVANT TWO DECKS
MA(IT,J+28)=9
MA(IT,J+30)=9
CV CALCULATE REDUCED AVAILABLE WARP POWER TWARP
TWARP(IT)=TWARP(IT)-FLOAT(MA(IT,J+28)-K(IT,J+3))/2.
CV AVAILABLE WARP POWER TWARP CANNOT SINK BELOW ZERO
IF(TWARP(IT).LT.0)TWARP(IT)=0.
CV CALCULATE SPECIAL DAMAGE FACTOR "K"
K(IT,J+3)=MA(IT,J+28)
N=2
ITZRO=0
RTZRO=0.
RTVL1=85.0
ITVL1=1
IV=IT
CV
CALL HORTA(IENTR(IT),IENTC(IT),ITROW(IT),ITCOL(IT),
*RTVL1,RTZRO,ITZRO,RTZRO,ITVL1,RTZRO,ITZRO)
CV =========
CV M-O SHIP
CV =========
CV IF NOT AN M-O SHIP (MIN > 4): SKIP TO 202
IF(MIN.GT.4)GO TO 202
CV LOOP OVER M-O SHIPS FOR 1 TO 4
DO 203 N=1,4
CV IF M-O SHIP NOT IN GAME: SKIP "NACELLE HIT ..." MESSAGE, NEXT SHIP
IF(ICHOE(N).EQ.0)GO TO 203
CV CALCULATE TERMINAL NUMBER IV
IV=N+4
CV WRITE "NACELLE HIT ..." MESSAGE
WRITE(IV,204)(INAME(IQ0,IT),IQ0=1,3),J,(INAME(IQ0,MIN),IQ0=1,3)
204 FORMAT(1X,3A4,' NACELLE',I2,' HIT THE ',3A4)
CV NEXT M-O SHIP
203 CONTINUE
CV DAMAGE MANAGEMENT FOR MANUALLY OPERATED SHIPS
CALL GRUP1(10,MIN)
CV MESSAGE "DAMAGE FROM SECONDARY EXPLOSIONS"
CALL HARDY
CV DAMAGE MANAGEMENT FOR MANUALLY OPERATED SHIPS
CALL GRUP1(10,MIN)
CV RETURN
GO TO 205
CV =========
CV C-O SHIP
CV =========
CV IF NEITHER M-O NOR C-O SHIP: 206
202 IF(MIN.GT.12)GO TO 206
CV ELSE: C-O SHIP
MIN=MIN-4
CV LOOP OVER M-O SHIPS N FOR 1 TO 4
DO 207 N=1,4
CV IF SHIP NOT IN GAME: SKIP "NACELLE ... HIT" MESSAGE, NEXT SHIP
IF(ICHOE(N).EQ.0)GO TO 207
CV CALCULATE TERMINAL NUMBER IV
IV=N+4
CV WRITE "NACELLE ... HIT" MESSAGE
WRITE(IV,208)(INAME(IQ0,IT),IQ0=1,3),J,(IENM2(IVV,MIN),IVV=1,4)
208 FORMAT(1X,3A4,' NACELLE',I2,' HIT ',4A4)
CV NEXT C-O SHIP
207 CONTINUE
CV DAMAGE MANAGEMENT FOR C-O SHIPS
CALL GRUP3(10,MIN)
CV MESSAGE "DAMAGE FROM SECONDARY EXPLOSIONS"
CALL HARDY
CV DAMAGE MANAGEMENT FOR C-O SHIPS
CALL GRUP3(10,MIN)
CV RETURN
GO TO 205
CV ==============
CV STAR/STARBASE
CV ==============
CV IF MIN <> 13: SKIP TO 209
206 IF(MIN.NE.13)GO TO 209
CV LOOP OVER STARBASES MI FOR 1 TO 2
DO 210 MI=1,2
CV IF POSITION I7,I8 NOT POSITION OF STARBASE:
CV SKIP OVER DAMAGE MANAGEMENT FOR STARBASES
IF(I7.NE.IBASR(MI))GO TO 210
IF(I8.NE.IBASC(MI))GO TO 210
CV LOOP OVER M-O SHIPS N FOR 1 TO 4
DO 211 N=1,4
CV IF SHIP NOT IN GAME: SKIP "NACELLE ... HIT ... STARBASE" MESSAGE, NEXT SHIP
IF(ICHOE(N).EQ.0)GO TO 211
CV CALCULATE TERMINAL NUMBER IV
IV=N+4
CV WRITE "NACELLE ... HIT ... STARBASE" MESSAGE
WRITE(IV,212)(INAME(IQ0,IT),IQ0=1,3),J,(ISIDE(IQ0,MI),IQ0=1,3),
*IBASE(MI)
212 FORMAT(1X,3A4,' NACELLE',I2,' HIT ',3A4,' STARBASE',I3)
CV NEXT STARBASE
211 CONTINUE
CV DAMAGE MANAGEMENT FOR STARBASES
CALL GRUP2(10,MI)
CV MESSAGE "DAMAGE FROM SECONDARY EXPLOSIONS"
CALL HARDY
CV DAMAGE MANAGEMENT FOR STARBASES
CALL GRUP2(10,MI)
CV RETURN
GO TO 205
CV NEXT STARBASE
210 CONTINUE
CV LOOP OVER M-O SHIPS N FOR 1 TO 4
DO 213 N=1,4
CV IF SHIP NOT IN GAME: SKIP "NACELLE ... HIT" MESSAGE, NEXT SHIP
IF(ICHOE(N).EQ.0)GO TO 213
CV CALCULATE TERMINAL NUMBER IV
IV=N+4
CV WRITE "NACELLE ... HIT STAR AT ..." MESSAGE
WRITE(IV,214)(INAME(IQ0,IT),IQ0=1,3),J,I8,I7
214 FORMAT(1X,3A4,' NACELLE',I2,' HIT STAR AT (',I2,',',I2,')')
CV NEXT M-O SHIP
213 CONTINUE
CV RETURN
GO TO 205
CV ======
CV EAGLE
CV ======
209 IF(MIN.NE.14)GO TO 216
CV LOOP OVER ALL LAUNCHED EAGLES
DO 217 MI=1,LAUNCH
CV IF POSITION I7,I8 NOT POSITION OF EAGLE:
CV SKIP OVER DAMAGE MANAGEMENT FOR EAGLES
IF(I7.NE.IGLER(MI))GO TO 217
IF(I8.NE.IGLEC(MI))GO TO 217
CV LOOP OVER ALL M-O SHIPS
DO 218 N=1,4
CV IF SHIP NOT IN GAME:
CV SKIP "NACELLE ... DESTROYED EAGLE ..." MESSAGE, NEXT SHIP
IF(ICHOE(N).EQ.0)GO TO 218
CV CALCULATE TERMINAL NUMBER IV
IV=N+4
CV WRITE MESSAGE "NACELLE ... DESTROYED EAGLE ..."
WRITE(IV,219)(INAME(IQ0,IT),IQ0=1,3),J,MIN
219 FORMAT(1X,3A4,' NACELLE',I2,' DESTROYED EAGLE',I3)
CV NEXT M-O SHIP
218 CONTINUE
CV EAGLES DAMAGE HANDLING
CALL BOOM(MIN)
CV RETURN
GO TO 205
CV NEXT EAGLE
217 CONTINUE
CV ======
CV MINES
CV ======
CV IF MIN > 18: RETURN
216 IF(MIN.GT.18)GO TO 205
CV DELETE MAP ENTRY AT I7,I8
MAP(I7,I8)=IBLK
CV LOOP OVER ALL M-O SHIPS
DO 220 N=1,4
CV IF SHIP NOT IN GAME: SKIP "NACELLE ... DESTROYED MINE AT ..." MESSAGE,
CV NEXT SHIP
IF(ICHOE(N).EQ.0)GO TO 220
CV WRITE MESSAGE "NACELLE ... DESTROYED MINE AT ..."
WRITE(IV,221)(INAME(IQ0,IT),IQ0=1,3),J,I8,I7
221 FORMAT(1X,3A4,' NACELLE',I2,' DESTROYED MINE AT (',I2,',',I2,')')
CV NEXT M-O SHIP
220 CONTINUE
205 RETURN
END
C -- DONALD ECCLESTONE SUBPROGRAM FOR T R E K 7
C CONVERTED TO PC BY: DAN GAHLINGER
C TYPE-EXACT CHECK 04/26/2000 BY: D.G.
C
C - HARDY -
SUBROUTINE HARDY
COMMON /T/ICHOE(4),ICHOS(8),ICHOB(2)
CV LOOP OVER ALL M-O SHIPS
DO 1 I=1,4
CV IF M-O SHIP NOT IN GAME: SKIP MESSAGE
IF(ICHOE(I).EQ.0)GO TO 1
CV CALCULATE FORTRAN UNIT NUMBER FOR SHIP'S TERMINAL
J=I+4
CV WRITE MESSAGE
WRITE(J,2)
2 FORMAT(' DAMAGE FROM SECONDARY EXPLOSIONS-')
CV NEXT M-O SHIP
1 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/26/2000 BY: D.G.
C
C SSSS PPPP OOO CCCC K K
C S P P O O C K K
C SSS PPPP O O C KKK
C S P O O C K K
C SSSS P OOO CCCC K K
CV CALCULATE RESULT OF TORPEDO ATTACK (ON TORPEDO BANK AND ENEMY)
LOGICAL FUNCTION SPOCK(J)
INTEGER ITZRO,ITVL1
REAL RTZRO,RTVL1
DIMENSION IBOLT(4,2),KPLOT(10)
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 /D/DFLCT(4),DFLCK(8),DFLCB(2)
COMMON /E/PHASR(4),TWARP(4),IPHOT(4),NDEAD(4),ISURR(4)
COMMON /H/ANGLE(4),RANG(4),LOCKT(4)
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 /U/LAUNCH,NUMOUT,NUME(2)
COMMON /V/IWEB(2),IWEBZ,INVIS(4)
COMMON /TOM/ITOM
DATA IBOLT/'PHOT','ON T','ORPE','DO ','DISR','UPTO','R BO','LT'/
DATA FUDGE/0.700619195/
CV CALCULATE TORPEDO DAMAGE FACTOR IWOW FROM SHORT-CIRCUIT FACTOR IV1 (???)
IWOW(X)=IFIX(ALOG((101.-X)*IV1)/FUDGE-1.8185)
CV DEFAULT: TORPEDO NOT SUCCESSFUL
SPOCK=.FALSE.
CV CALCULATE RANDOM SHORT-CIRCUIT FACTOR (IV1) IN RANGE 1 TO 100
CALL RANDO(IV1,1,100)