-
Notifications
You must be signed in to change notification settings - Fork 0
/
CONQMISC.R
2422 lines (2091 loc) · 59.5 KB
/
CONQMISC.R
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 O N Q M I S C
#
# Copyright (C)1983-1986 by Jef Poskanzer and Craig Leres
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby granted,
# provided that this copyright notice appear in all copies and in all
# supporting documentation. Jef Poskanzer and Craig Leres make no
# representations about the suitability of this software for any
# purpose. It is provided "as is" without express or implied warranty.
#
###############################################################################
#
# Detailed revision history lives in "incl/conqdef"
#
###############################################################################
include "conqdef"
### appkb - append killed by string
#
# SYNOPSIS
# integer kb
# character buf()
# call appkb( kb, buf )
#
subroutine appkb( kb, buf )
NOIMPLICIT
integer kb
character buf(ARB)
include "conqcom"
switch ( kb )
{
case KB_SELF:
call appstr( "self", buf )
case KB_NEGENB:
call appstr( "negenb", buf )
case KB_CONQUER:
call appstr( "conquer", buf )
case KB_NEWGAME:
call appstr( "newgame", buf )
case KB_EVICT:
call appstr( "evict", buf )
case KB_SHIT:
call appstr( "shit", buf )
case KB_DOOMSDAY:
call appstr( "doomsday", buf )
case KB_GOTDOOMSDAY:
call appstr( "gotdoomsday", buf )
case KB_GOD:
call appstr( "GOD", buf )
default:
if ( kb >= 1 & kb <= MAXSHIPS )
call appship( kb, buf )
else if ( -kb >= 1 & -kb <= NUMPLANETS )
call appstr( pname(1,-kb), buf )
else
call appint( kb, buf )
}
return
end
### appship - append a ship number to a string
#
# SYNOPSIS
# integer snum
# character str()
# call appship( snum, str )
#
subroutine appship( snum, str )
NOIMPLICIT
integer snum
character str(ARB)
integer i
character ch
include "conqcom"
ch = 'S'
if ( snum >= 1 & snum <= MAXSHIPS )
{
i = steam(snum)
if ( i >= 1 & i <= NUMTEAMS )
ch = chrteams(i)
}
call appchr( ch, str )
call appint( snum, str )
return
end
### canread - determine if a message is readable
#
# SYNOPSIS
# logical ok, canread
# integer snum, msgnum
# ok = canread( snum, msgnum )
#
logical function canread( snum, msgnum )
NOIMPLICIT
integer snum, msgnum
integer from, to
include "conqcom"
from = msgfrom(msgnum)
to = msgto(msgnum)
# If we're GOD, we can read it.
if ( snum == MSG_GOD )
return ( .true. )
# It's to us.
if ( to == snum )
return ( .true. )
# It's to everybody.
if ( to == MSG_ALL )
return ( .true. )
# Only check these if we're a ship.
if ( snum >= 1 & snum <= MAXSHIPS )
{
# We can only read team messages if we're not self-war.
if ( ( -to == steam(snum) ) & ! selfwar(snum) )
{
# Planet alert for our team.
if ( -from >= 1 & -from <= NUMPLANETS )
return ( soption(snum,OPT_INTRUDERALERT) )
else
return ( .true. )
}
# See if we are allowed to read GOD messages.
if ( to == MSG_GOD | from == MSG_GOD | to == MSG_IMPLEMENTORS )
return ( uooption(suser(snum),OOPT_GODMSG) )
}
# If we got here, we can't read it.
return ( .false. )
end
### clearships - reset ships and torpedoes
#
# SYNOPSIS
# call clearships
#
subroutine clearships
NOIMPLICIT
integer i
for ( i = 1; i <= MAXSHIPS; i = i + 1 )
call zeroship( i )
return
end
### cvtcoords - convert from internal coords to screen coords
#
# SYNOPSIS
# logical inbounds, cvtcoords
# real cenx, ceny, x, y, scale
# integer lin, col
# inbounds = cvtcoords( ceny, ceny, x, y, scale, lin, col )
#
logical function cvtcoords( cenx, ceny, x, y, scale, lin, col )
NOIMPLICIT
real cenx, ceny, x, y, scale
integer lin, col
include "conqcom"
include "conqcom2"
col = round( (cmaxcol-STAT_COLS)/2 + (x-cenx) / scale * WIDTH_FAC ) +
STAT_COLS
lin = round( (DISPLAY_LINS/2+1) - (y-ceny) / scale )
if ( lin < 1 | lin > DISPLAY_LINS | col <= STAT_COLS | col > cmaxcol )
return ( .false. )
return ( .true. )
end
### doomfind - find a planet or ship for the doomsday machine to head for
#
# SYNOPSIS
# call doomfind
#
subroutine doomfind
NOIMPLICIT
integer i
real taste, tastiness, angle
include "conqcom"
tastiness = 0.0
dlock = -PNUM_MURISAK
for ( i = 1; i <= NUMPLANETS; i = i + 1 )
if ( preal(i) )
if ( parmies(i) > 0 & pteam(i) != TEAM_NOTEAM )
{
taste = parmies(i)*BOMBARD_KILLS / dist(dx, dy, px(i), py(i))
if ( taste > tastiness )
{
tastiness = taste
dlock = -i
}
}
for ( i = 1; i <= MAXSHIPS; i = i + 1 )
if ( sstatus(i) == SS_LIVE )
{
taste = ( 1.0 +
skills(i) * KILLS_KILLS +
sarmies(i) * ARMY_KILLS ) / dist(dx, dy, sx(i), sy(i))
if ( taste > tastiness )
{
tastiness = taste
dlock = i
}
}
if ( dlock < 0 )
dhead = angle( dx, dy, px(-dlock), py(-dlock) )
else if ( dlock > 0 )
dhead = angle( dx, dy, sx(dlock), sy(dlock) )
return
end
### doomsday - start the doomsday device
#
# SYNOPSIS
# call doomsday
#
subroutine doomsday
NOIMPLICIT
real rnduni
include "conqcom"
dhead = rnduni( 0.0, 360.0 )
dx = DOOMSDAY_START_DIST * cosd(dhead)
dy = DOOMSDAY_START_DIST * sind(dhead)
call doomfind
dstatus = DS_LIVE
return
end
### findorbit - find a planet for a ship to orbit
#
# SYNOPSIS
# integer snum, pnum
# logical flag, findorbit
# flag = findorbit( snum, pnum )
#
logical function findorbit( snum, pnum )
NOIMPLICIT
integer snum, pnum
integer i
include "conqcom"
for ( i = 1; i <= NUMPLANETS; i = i + 1 )
if ( preal(i) &
( dist( sx(snum), sy(snum), px(i), py(i) ) <= ORBIT_DIST ) )
{
pnum = i
return ( .true. )
}
# Didn't find one.
pnum = 0
return ( .false. )
end
### findship - find a free ship and reserve it (DOES LOCKING)
#
# SYNOPSIS
# integer snum
# logical truth, findship
# truth = findship( snum )
#
logical function findship( snum )
NOIMPLICIT
integer snum
integer i
include "conqcom"
PVLOCK(lockword)
snum = 0
for ( i = 1; i <= MAXSHIPS; i = i + 1 )
if ( sstatus(i) == SS_OFF )
{
snum = i
call zeroship( snum )
sstatus(snum) = SS_RESERVED
slastmsg(snum) = LMSG_NEEDINIT
ssdfuse(snum) = -TIMEOUT_PLAYER
sctime(snum) = 0
setime(snum) = 0
scacc(snum) = 0
seacc(snum) = 0
break
}
PVUNLOCK(lockword)
return ( snum != 0 )
end
### findspecial - search for nearest some-thing
#
# SYNOPSIS
# logical flag, findspecial
# integer snum, token, count, sorpnum, xsorpnum
# flag = findspecial( snum, token, count, sorpnum, xsorpnum )
#
logical function findspecial( snum, token, count, sorpnum, xsorpnum )
NOIMPLICIT
integer snum, token, count, sorpnum, xsorpnum
integer i, a, na, ta, u, nu, tu
real d, nd, td
logical valid, peaceful, spwar
include "conqcom"
sorpnum = 0 # zero nearest
xsorpnum = 0 # zero second nearest
d = 2e20 # distance from nearest
nd = 3e20 # distance from second nearest
a = 20000 # armies of nearest
na = 30000 # armies of second nearest
u = 20000 # uninhabitable time of nearest
nu = 20000 # uninhabitable time of next
switch ( token )
{
case SPECIAL_SHIP, SPECIAL_ENEMYSHIP, SPECIAL_TEAMSHIP:
# Nearest ship, nearest enemy ship, and nearest team ship.
for ( i = 1; i <= MAXSHIPS; i = i + 1 )
if ( i != snum & sstatus(i) == SS_LIVE )
{
switch ( token )
{
case SPECIAL_ENEMYSHIP:
valid = satwar(snum, i)
case SPECIAL_SHIP:
valid = .true.
case SPECIAL_TEAMSHIP:
valid = ( steam(i) == steam(snum) &
! satwar(snum, i) )
default:
return ( .false. ) # this can't happen
}
if ( valid )
{
td = dist(sx(snum), sy(snum), sx(i), sy(i))
if ( td < nd )
if ( td < d )
{
xsorpnum = sorpnum
nd = d
sorpnum = i
d = td
}
else
{
xsorpnum = i
nd = td
}
}
}
case SPECIAL_HOMEPLANET:
# Home planet.
switch ( steam(snum) )
{
case TEAM_FEDERATION:
sorpnum = homeplanet(TEAM_FEDERATION)
case TEAM_ROMULAN:
sorpnum = homeplanet(TEAM_ROMULAN)
case TEAM_KLINGON:
sorpnum = homeplanet(TEAM_KLINGON)
case TEAM_ORION:
sorpnum = homeplanet(TEAM_ORION)
default:
return ( .false. )
}
case SPECIAL_WEAKPLANET:
# Weakest non-team planet.
for ( i = 1; i <= NUMPLANETS; i = i + 1 )
{
# Only can look for "real" planets.
if ( ! preal(i) )
next
# Ignore suns and moons.
if ( ptype(i) == PLANET_SUN | ptype(i) == PLANET_MOON )
next
switch ( token )
{
case SPECIAL_WEAKPLANET:
valid = ( pscanned(i,steam(snum)) &
pteam(i) != steam(snum) )
default:
return ( .false. ) # this can't happen
}
# Handle army threshold logic.
if ( valid )
switch ( token )
{
case SPECIAL_WEAKPLANET:
valid = ( parmies(i) >= count )
default:
return ( .false. ) # this can't happen
}
if ( valid )
{
ta = parmies(i)
tu = puninhabtime(i)
td = dist(sx(snum), sy(snum), px(i), py(i))
# Uninhabitable time is of next importance,
# number of armies is of first importantance, and
# distance is of last importance.
if ( tu < nu |
( tu == nu & ( ta < na | ( ta == na & td < nd ) ) ) )
if ( tu < u |
( tu == u & ( ta < a | ( ta == a & td < d ) ) ) )
{
xsorpnum = sorpnum
na = a
nu = u
nd = d
sorpnum = i
a = ta
u = tu
d = td
}
else
{
xsorpnum = i
na = ta
nu = tu
nd = td
}
}
}
case SPECIAL_ARMYPLANET, SPECIAL_ENEMYPLANET, SPECIAL_FUELPLANET,
SPECIAL_PLANET, SPECIAL_REPAIRPLANET, SPECIAL_TEAMPLANET:
# Determine if we at peace with all teams.
peaceful = .true.
for ( i = 1; i <= NUMTEAMS; i = i + 1 )
if ( swar(snum,i) )
{
peaceful = .false.
break
}
# Loop through the planets.
for ( i = 1; i <= NUMPLANETS; i = i + 1 )
{
# Only can look for "real" planets.
if ( ! preal(i) )
next
# Ignore suns and moons.
if ( ptype(i) == PLANET_SUN | ptype(i) == PLANET_MOON )
next
switch ( token )
{
case SPECIAL_ARMYPLANET:
valid = ( pteam(i) == steam(snum) )
case SPECIAL_ENEMYPLANET:
valid = ( ! pscanned(i,steam(snum)) |
( parmies(i) > 0 &
spwar( snum, i ) &
ptype(i) != PLANET_MOON ) )
case SPECIAL_FUELPLANET:
valid = ( ( pscanned(i,steam(snum)) | peaceful ) &
! spwar( snum, i ) &
parmies(i) > 0 &
ptype(i) == PLANET_CLASSM )
case SPECIAL_PLANET:
valid = .true.
case SPECIAL_REPAIRPLANET:
valid = ( ( pscanned(i,steam(snum)) | peaceful ) &
! spwar( snum, i ) &
parmies(i) > 0 &
ptype(i) != PLANET_MOON )
case SPECIAL_TEAMPLANET:
valid = ( pteam(i) == steam(snum) )
default:
return ( .false. ) # this can't happen
}
# Handle army threshold logic.
if ( valid )
switch ( token )
{
case SPECIAL_ARMYPLANET:
valid = ( ( parmies(i) - 3 ) >= count )
case SPECIAL_PLANET, SPECIAL_ENEMYPLANET:
valid = ( ! pscanned(i,steam(snum)) |
parmies(i) >= count )
case SPECIAL_FUELPLANET, SPECIAL_REPAIRPLANET,
SPECIAL_TEAMPLANET:
valid = ( parmies(i) >= count )
default:
return ( .false. ) # this can't happen
}
if ( valid )
{
td = dist(sx(snum), sy(snum), px(i), py(i))
if ( td < nd )
if ( td < d )
{
xsorpnum = sorpnum
nd = d
sorpnum = i
d = td
}
else
{
xsorpnum = i
nd = td
}
}
}
default:
return ( .false. ) # this can't happen
}
return ( sorpnum != 0 )
end
### fixdeltas - update sdx and sdy
#
# SYNOPSIS
# integer snum
# call fixdeltas( snum )
#
subroutine fixdeltas( snum )
NOIMPLICIT
integer snum
real speed
include "conqcom"
speed = swarp(snum) * MM_PER_SEC_PER_WARP * ITER_SECONDS
sdx(snum) = speed * cosd(shead(snum))
sdy(snum) = speed * sind(shead(snum))
return
end
### gunum - get the user number of the specified user
#
# SYNOPSIS
# logical truth, gunum
# integer unum
# character lname()
# truth = gunum( unum, lname )
#
logical function gunum( unum, lname )
NOIMPLICIT
integer unum
character lname(ARB)
integer i, strcmp
include "conqcom"
unum = 0
for ( i = 1; i <= MAXUSERS; i = i + 1 )
if ( ulive(i) )
if ( strcmp( lname, uname(1,i) ) == 0 )
{
unum = i
return ( .true. )
}
return ( .false. )
end
### histlist - display the last usage list
#
# SYNOPSIS
# integer godlike
# call histlist( godlike )
#
real function histlist( godlike )
NOIMPLICIT
integer godlike
integer i, j, unum, lin, col, fline, lline, thistptr, modp1
character ch
logical iogtimed, stillalive
include "conqcom"
include "conqcom2"
# Do some screen setup.
call cdclear
fline = 1
lline = MSG_LIN1 - 1
call cdputc( "C O N Q U E S T U S E R H I S T O R Y", fline )
fline = fline + 2
thistptr = -1 # force an update the first time
repeat
{
if ( ! godlike )
if ( ! stillalive( csnum ) )
break
if ( thistptr != histptr )
{
# Need to update the display
thistptr = histptr
lin = fline
col = 8
call cdclrl( fline, lline - fline + 1 )
i = modp1( thistptr + 1, MAXHISTLOG ) # gag...
for ( j = 1; j <= MAXHISTLOG; j = j + 1 )
{
i = modp1( i - 1, MAXHISTLOG )
unum = histunum(i)
if ( unum < 1 | unum > unum )
next
if ( ! ulive(unum) )
next
call prints( cbuf, "%-12s %s", uname(1,unum), histlog(1,i) )
call cdputs( cbuf, lin, col )
lin = lin + 1
if ( lin > lline )
{
col = 43
lin = fline
}
}
}
call putpmt( "--- press space when done ---", MSG_LIN2 )
call cdplay( .true. )
if ( iogtimed( ch, 1 ) )
break # exit loop if we got one
}
return
end
### initeverything - initialize (with extra cheese and tomato) (DOES LOCKING)
#
# SYNOPSIS
# call initeverything
#
subroutine initeverything
NOIMPLICIT
integer i, j
include "conqcom"
# Zero EVERYTHING.
call zeroeverything
# Twiddle the lockword.
PVUNLOCK(lockword)
PVLOCK(lockword)
# Turn off the universe.
closed = .true.
# Zero team stats.
for ( i = 1; i <= NUMTEAMS; i = i + 1 )
for ( j = 1; j <= MAXTSTATS; j = j + 1 )
tstats(i,j) = 0
# De-register all users.
for ( i = 1; i <= MAXUSERS; i = i + 1 )
ulive(i) = .false.
celapsedseconds = 0
ccpuseconds = 0
delapsedseconds = 0
dcpuseconds = 0
relapsedseconds = 0
rcpuseconds = 0
raccum = 0
call stcpn( "never", lastupchuck, DATESIZE )
call getdandt( inittime )
call getdandt( conqtime )
call stcpn( "GOD", conqueror, MAXUSERPNAME )
call stcpn( "self ruled", conqteam, MAXTEAMNAME )
call stcpn( "Let there be light...", lastwords, MAXLASTWORDS )
# Un-twiddle the lockwords.
PVUNLOCK(lockword)
PVUNLOCK(lockmesg)
call initrobots
call inituniverse
return
end
### initgame - initialize the game-permanent variables
#
# SYNOPSIS
# call initgame
#
subroutine initgame
NOIMPLICIT
integer i, j
include "conqcom"
# Twiddle the lockword.
PVUNLOCK(lockword)
PVLOCK(lockword)
# Driver.
drivsecs = 0
# Doomsday machine.
dstatus = DS_OFF
dtype = 0 # should have constants for this
dx = 0.0
dy = 0.0
ddx = 0.0
ddy = 0.0
dhead = 0.0
dlock = 0
call stcpn( "Doomsday Machine", dname, MAXUSERPNAME )
# Set up initial armies on planets.
pteam(PNUM_SOL) = TEAM_NOTEAM
pteam(PNUM_EARTH) = TEAM_FEDERATION
pteam(PNUM_TELOS) = TEAM_FEDERATION
pteam(PNUM_OMEGA) = TEAM_FEDERATION
pteam(PNUM_SIRIUS) = TEAM_NOTEAM
pteam(PNUM_ROMULUS) = TEAM_ROMULAN
pteam(PNUM_REMUS) = TEAM_ROMULAN
pteam(PNUM_RHO) = TEAM_ROMULAN
pteam(PNUM_KEJELA) = TEAM_NOTEAM
pteam(PNUM_KLINGUS) = TEAM_KLINGON
pteam(PNUM_LEUDUS) = TEAM_KLINGON
pteam(PNUM_TARSUS) = TEAM_KLINGON
pteam(PNUM_BETELGEUSE) = TEAM_NOTEAM
pteam(PNUM_ORION) = TEAM_ORION
pteam(PNUM_OBERON) = TEAM_ORION
pteam(PNUM_UMBRIEL) = TEAM_ORION
pteam(PNUM_MURISAK) = TEAM_NOTEAM
pteam(PNUM_JANUS) = TEAM_SELFRULED
pteam(PNUM_SERITIL) = TEAM_SELFRULED
pteam(PNUM_ELAS) = TEAM_SELFRULED
pteam(PNUM_SHERMAN) = TEAM_SELFRULED
pteam(PNUM_CHERON) = TEAM_SELFRULED
pteam(PNUM_DAKEL) = TEAM_SELFRULED
pteam(PNUM_OLDAR) = TEAM_SELFRULED
pteam(PNUM_SARAC) = TEAM_SELFRULED
pteam(PNUM_EMINIAR) = TEAM_SELFRULED
pteam(PNUM_VENAR) = TEAM_SELFRULED
pteam(PNUM_DYNEB) = TEAM_SELFRULED
pteam(PNUM_XIDEX) = TEAM_SELFRULED
pteam(PNUM_RIGELB) = TEAM_SELFRULED
pteam(PNUM_SYRINX) = TEAM_NOTEAM
pteam(PNUM_SHITFACE) = TEAM_GOD
pteam(PNUM_HELL) = TEAM_GOD
pteam(PNUM_JINX) = TEAM_GOD
pteam(PNUM_LUNA) = TEAM_NOTEAM
pteam(PNUM_GHOST1) = TEAM_NOTEAM
pteam(PNUM_GHOST2) = TEAM_NOTEAM
pteam(PNUM_GHOST3) = TEAM_NOTEAM
pteam(PNUM_GHOST4) = TEAM_NOTEAM
pteam(PNUM_SPARE1) = TEAM_NOTEAM
parmies(PNUM_SOL) = 100
parmies(PNUM_EARTH) = 50
parmies(PNUM_TELOS) = 50
parmies(PNUM_OMEGA) = 50
parmies(PNUM_SIRIUS) = 100
parmies(PNUM_ROMULUS) = 50
parmies(PNUM_REMUS) = 50
parmies(PNUM_RHO) = 50
parmies(PNUM_KEJELA) = 100
parmies(PNUM_KLINGUS) = 50
parmies(PNUM_LEUDUS) = 50
parmies(PNUM_TARSUS) = 50
parmies(PNUM_BETELGEUSE) = 100
parmies(PNUM_ORION) = 50
parmies(PNUM_OBERON) = 50
parmies(PNUM_UMBRIEL) = 50
parmies(PNUM_MURISAK) = 100
parmies(PNUM_JANUS) = 25
parmies(PNUM_SERITIL) = 25
parmies(PNUM_ELAS) = 25
parmies(PNUM_SHERMAN) = 25
parmies(PNUM_CHERON) = 25
parmies(PNUM_DAKEL) = 25
parmies(PNUM_OLDAR) = 25
parmies(PNUM_SARAC) = 25
parmies(PNUM_EMINIAR) = 25
parmies(PNUM_VENAR) = 25
parmies(PNUM_DYNEB) = 25
parmies(PNUM_XIDEX) = 25
parmies(PNUM_RIGELB) = 25
# The rest don't matter since you don't have to conquer them.
parmies(PNUM_SYRINX) = 100
parmies(PNUM_SHITFACE) = 256
parmies(PNUM_HELL) = 128
parmies(PNUM_JINX) = 512
parmies(PNUM_LUNA) = 0
parmies(PNUM_GHOST1) = 0
parmies(PNUM_GHOST2) = 0
parmies(PNUM_GHOST3) = 0
parmies(PNUM_GHOST4) = 0
parmies(PNUM_SPARE1) = 0
# Set up the pscanned array so that each team has scanned its own planets.
for ( i = 1; i <= NUMPLANETS; i = i + 1 )
{
puninhabtime(i) = 0 # planets start out inhabitable
for ( j = 1; j <= NUMTEAMS; j = j + 1 )
pscanned(i,j) = .false.
}
for ( i = 1; i <= NUMTEAMS; i = i + 1 )
{
# Each team has scanned its own planets.
for ( j = 1; j <= 3; j = j + 1 )
pscanned(teamplanets(i,j),i) = .true.
couptime(i) = 0 # time left to coup starts at zero.
tcoupinfo(i) = .false. # don't know coup time
}
# Un-twiddle the lockword.
PVUNLOCK(lockword)
# Set up the physical universe.
call initplanets
return
end
### initmsgs - initialize the message data structures
#
# SYNOPSIS
# call initmsgs
#
subroutine initmsgs
NOIMPLICIT
integer i
include "conqcom"
# Zero the message buffer.
for ( i = 1; i <= MAXMESSAGES; i = i + 1 )
{
msgbuf(1,i) = EOS
msgfrom(i) = 0
msgto(i) = 0
}
lastmsg = 1
glastmsg = lastmsg
return
end
### initplanets - initialize the planets
#
# SYNOPSIS
# call initplanets
#
subroutine initplanets
NOIMPLICIT
# SETPLANET( name, pnum )
define(SETPLANET,
call stcpn( $1, pname(1,$2), MAXPLANETNAME ))
integer i, rndint
real rnduni, rndnor, mod360, orbang, orbvel
include "conqcom"
# Twiddle the lockword.
PVUNLOCK(lockword)
PVLOCK(lockword)
SETPLANET( "Sol", PNUM_SOL )
SETPLANET( "Earth", PNUM_EARTH )
SETPLANET( "Telos", PNUM_TELOS )
SETPLANET( "Omega", PNUM_OMEGA )
SETPLANET( "Sirius", PNUM_SIRIUS )
SETPLANET( "Romulus", PNUM_ROMULUS )
SETPLANET( "Remus", PNUM_REMUS )
SETPLANET( "Rho", PNUM_RHO )
SETPLANET( "Kejela", PNUM_KEJELA )
SETPLANET( "Klingus", PNUM_KLINGUS )
SETPLANET( "Leudus", PNUM_LEUDUS )
SETPLANET( "Tarsus", PNUM_TARSUS )
SETPLANET( "Betelgeuse", PNUM_BETELGEUSE )
SETPLANET( "Orion", PNUM_ORION )
SETPLANET( "Oberon", PNUM_OBERON )
SETPLANET( "Umbriel", PNUM_UMBRIEL )
SETPLANET( "Murisak", PNUM_MURISAK )
SETPLANET( "Janus", PNUM_JANUS )
SETPLANET( "Seritil", PNUM_SERITIL )
SETPLANET( "Elas", PNUM_ELAS )
SETPLANET( "Sherman", PNUM_SHERMAN )
SETPLANET( "Cheron", PNUM_CHERON )
SETPLANET( "Dakel", PNUM_DAKEL )
SETPLANET( "Oldar", PNUM_OLDAR )
SETPLANET( "Sarac", PNUM_SARAC )
SETPLANET( "Eminiar", PNUM_EMINIAR )
SETPLANET( "Venar", PNUM_VENAR )
SETPLANET( "Dyneb", PNUM_DYNEB )
SETPLANET( "Xidex", PNUM_XIDEX )
SETPLANET( "RigelB", PNUM_RIGELB )
SETPLANET( "Syrinx", PNUM_SYRINX )
SETPLANET( "Luna", PNUM_LUNA )
SETPLANET( "Shitface", PNUM_SHITFACE )
SETPLANET( "Hell", PNUM_HELL )
SETPLANET( "Jinx", PNUM_JINX )
SETPLANET( "Ghost 1", PNUM_GHOST1 )
SETPLANET( "Ghost 2", PNUM_GHOST2 )
SETPLANET( "Ghost 3", PNUM_GHOST3 )
SETPLANET( "Ghost 4", PNUM_GHOST4 )
SETPLANET( "Spare 1", PNUM_SPARE1 )
ptype(PNUM_SOL) = PLANET_SUN
ptype(PNUM_EARTH) = PLANET_CLASSM
ptype(PNUM_TELOS) = PLANET_DEAD
ptype(PNUM_OMEGA) = PLANET_DEAD
ptype(PNUM_SIRIUS) = PLANET_SUN
ptype(PNUM_ROMULUS) = PLANET_CLASSM
ptype(PNUM_REMUS) = PLANET_DEAD
ptype(PNUM_RHO) = PLANET_DEAD
ptype(PNUM_KEJELA) = PLANET_SUN
ptype(PNUM_KLINGUS) = PLANET_CLASSM
ptype(PNUM_LEUDUS) = PLANET_DEAD
ptype(PNUM_TARSUS) = PLANET_DEAD
ptype(PNUM_BETELGEUSE) = PLANET_SUN
ptype(PNUM_ORION) = PLANET_CLASSM
ptype(PNUM_OBERON) = PLANET_DEAD
ptype(PNUM_UMBRIEL) = PLANET_DEAD
ptype(PNUM_MURISAK) = PLANET_SUN
ptype(PNUM_JANUS) = PLANET_CLASSM
ptype(PNUM_SERITIL) = PLANET_DEAD
ptype(PNUM_ELAS) = PLANET_CLASSM
ptype(PNUM_SHERMAN) = PLANET_CLASSM
ptype(PNUM_CHERON) = PLANET_DEAD
ptype(PNUM_DAKEL) = PLANET_CLASSM
ptype(PNUM_OLDAR) = PLANET_DEAD
ptype(PNUM_SARAC) = PLANET_CLASSM
ptype(PNUM_EMINIAR) = PLANET_DEAD
ptype(PNUM_VENAR) = PLANET_CLASSM