-
Notifications
You must be signed in to change notification settings - Fork 12
/
DXREntranceRando.uc
1489 lines (1280 loc) · 44.7 KB
/
DXREntranceRando.uc
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
//=============================================================================
// DXREntranceRando.
//=============================================================================
class DXREntranceRando expands DXRActorsBase transient;
//Defines an edge of a map where you can transfer between maps
//Via Teleporter or MapExit
//In the main game, all of them have an inbound point and an outbound one
//The outbound one is only identifiable by it's destination, while the inbound
//One has the tag set.
struct MapTransfer
{
var() string mapname;
var() string inTag;
var() string outTag;
var() bool used;
};
//Defines a connection between two MapTransfer points
struct Connection
{
var() MapTransfer a;
var() MapTransfer b;
};
//This structure is used for rando validation
struct MapConnection
{
var() string mapname;
var() int numDests;
var() string dest[15]; //List of maps that can be reached from this one
var() string depends[15]; //The map each dest depends on
};
var Connection conns[20];
var int numConns;
var Connection fixed_conns[8];
var int numFixedConns;
var MapTransfer xfers[50];
var int numXfers;
// caches
var int numInvalids[50];
var int numXfersMaps[50];
var int invalidCons[2500];// 2d array of xfers[a] to xfers[b], cache of IsConnectionValid
struct BanConnection
{
var string map_a;
var string map_b;
};
var config BanConnection BannedConnections[32];
var config string dead_ends[32];
//var config string unreachable_conns[16];
var DXRMapVariants mapvariants;
struct Dependency
{
// this is mostly for keys that are needed from other areas
// the key would be inside the map dependency
// dependent would be the teleporter that is behind the locked door, which may end up going to a different map
var string dependent;
var string dependency;
};
var config Dependency dependencies[16];
var config int min_connections_selfconnect;
function CheckConfig()
{
local int i, k;
if( ConfigOlderThan(1,6,0,1) ) {
for(i=0; i < ArrayCount(BannedConnections); i++) {
BannedConnections[i].map_a = "";
BannedConnections[i].map_b = "";
}
min_connections_selfconnect = 999;
i = 0;
//dead_ends[i++] = "06_HONGKONG_WANCHAI_GARAGE#Teleporter";
dead_ends[i++] = "06_HONGKONG_Storage#waterpipe";
//dead_ends[i++] = "06_HONGKONG_MJ12LAB#tubeend";
/*i=0;
unreachable_conns[i++] = "12_VANDENBERG_CMD#storage";*/
i=0;// dependencies[i].dependent = source map and outTag
dependencies[i].dependent = "02_NYC_Street#ToNYCUndergroundSewer2";
dependencies[i].dependency = "02_NYC_Smug";
i++;
dependencies[i].dependent = "02_NYC_Street#ToNYCSump";
dependencies[i].dependency = "02_NYC_Smug";
i++;
dependencies[i].dependent = "04_NYC_STREET#ToNSFHQ";
dependencies[i].dependency = "04_NYC_HOTEL";
i++;
dependencies[i].dependent = "06_HongKong_WanChai_Market#Lobby";
dependencies[i].dependency = "06_HongKong_WanChai_Street";
i++;
dependencies[i].dependent = "06_HongKong_WanChai_Market#Lobby";
dependencies[i].dependency = "06_HongKong_WanChai_Underworld";
i++;
dependencies[i].dependent = "06_HONGKONG_STORAGE#CANAL";
dependencies[i].dependency = "06_HongKong_WanChai_Underworld";
i++;
dependencies[i].dependent = "06_HONGKONG_MJ12LAB#basement";
dependencies[i].dependency = "06_HongKong_WanChai_Underworld";
i++;
/*dependencies[i].dependent = "06_HONGKONG_wanchai_garage#BackDoor";
dependencies[i].dependency = "06_HongKong_WanChai_Underworld";
i++;*/
dependencies[i].dependent = "06_HongKong_Storage#canal";
dependencies[i].dependency = "06_HongKong_WanChai_MJ12Lab";
i++;
dependencies[i].dependent = "10_paris_metro#?toname=PathNode447";
dependencies[i].dependency = "10_PARIS_CLUB";
i++;
dependencies[i].dependent = "12_VANDENBERG_CMD#gas_start";
dependencies[i].dependency = "12_VANDENBERG_COMPUTER";
i++;
dependencies[i].dependent = "12_VANDENBERG_CMD#computer";
dependencies[i].dependency = "12_VANDENBERG_TUNNELS";
i++;
dependencies[i].dependent = "14_Vandenberg_Sub#frontgate";
dependencies[i].dependency = "14_OceanLab_UC";//format has to match the connection not the teleporter
i++;
}
k=0;
for(i=0; i < ArrayCount(BannedConnections); i++) {
if( BannedConnections[i].map_a == "" ) continue;
BannedConnections[k].map_a = Caps(BannedConnections[i].map_a);
BannedConnections[k].map_b = Caps(BannedConnections[i].map_b);
k++;
}
k=0;
for(i=0; i < ArrayCount(dead_ends); i++) {
if( dead_ends[i] == "" ) continue;
dead_ends[k++] = Caps(dead_ends[i]);
}
k=0;
for(i=0; i < ArrayCount(dependencies); i++) {
if( dependencies[i].dependent == "" ) continue;
dependencies[k].dependent = Caps(dependencies[i].dependent);
dependencies[k].dependency = Caps(dependencies[i].dependency);
k++;
}
Super.CheckConfig();
}
function Connection GetConnection(int idx, optional bool fixed)
{
if (fixed){
return fixed_conns[idx];
} else {
return conns[idx];
}
}
function int GetNextTransferIdx()
{
local int i;
i = 0;
for (i=0;i<numXfers;i++)
{
if (xfers[i].used==False)
{
return i;
}
}
return -1;
}
function int GetNextPickiestTransfer()
{
local int idx, pickiestIdx, pickiestCount;
pickiestCount = -1;
for(idx=0;idx<numXfers;idx++)
{
if( (!xfers[idx].used) && numInvalids[idx] > pickiestCount ) {
pickiestIdx = idx;
pickiestCount = numInvalids[idx];
}
}
return pickiestIdx;
}
//This gets the <offset>th unused transfer and returns its index
function int GetUnusedTransferByOffset(int offset)
{
local int idx;
local int numUnused;
idx = 0;
numUnused = 0;
for(idx=0;idx<numXfers;idx++)
{
if (xfers[idx].used == False)
{
if (numUnused==offset)
return idx;
else
numUnused++;
}
}
return -1;
}
//This gets the <offset>th unused transfer for a connection and returns its index
function int GetNextUnusedTransferByOffset(int nextAvailIdx, int offset)
{
local int idx;
local int numUnused;
idx = 0;
numUnused = 0;
for(idx=0;idx<numXfers;idx++)
{
if (xfers[idx].used == False && invalidCons[ (nextAvailIdx*ArrayCount(xfers)) + idx ] == 0 )
{
if (numUnused==offset)
return idx;
else
numUnused++;
}
}
return -1;
}
function int GetNumXfersByMap(string mapname)
{
local int i;
local int count;
count = 0;
for (i=0;i<numXfers;i++)
{
if (xfers[i].mapname == mapname)
{
count++;
}
}
return count;
}
function bool IsDeadEndMap(int idx)
{
return numXfersMaps[idx]==1;
}
function bool CanSelfConnect(int idx)
{
return numXfersMaps[idx] >= min_connections_selfconnect;
}
function bool IsConnectionValid(int idx_a, int idx_b)
{
local int i;
local MapTransfer a,b;
a = xfers[idx_a];
b = xfers[idx_b];
if( a.mapname == b.mapname && a.inTag == b.inTag && a.outTag == b.outTag ) {
err("IsConnectionValid got duplicate MapTransfers? mapname: " $ a.mapname $", inTag: " $ a.inTag $", outTag: " $a.outTag);
return False;
}
if ( IsDeadEndMap(idx_a) && IsDeadEndMap(idx_b) )
{
return False;
}
if ( a.mapname == b.mapname)
{
if ( !CanSelfConnect(idx_a))
{
return False;
}
}
for(i=0; i < ArrayCount(BannedConnections); i++) {
if( BannedConnections[i].map_a == "" ) break;
if(
(a.mapname == BannedConnections[i].map_a && b.mapname == BannedConnections[i].map_b)
||
(b.mapname == BannedConnections[i].map_a && a.mapname == BannedConnections[i].map_b)
) {
return false;
}
}
return True;
}
function bool ValidateConnections()
{
local MapConnection mapdests[15];
local int numMaps;
local int numPasses;
local int i,j,k;
local bool foundMap;
local string canvisit[15];
local int visitable, oldVisitable;
local bool canVisitMap;
numPasses = numConns;
numMaps = GetAllMapNames(mapdests);
if( DuplicateConnections() > 0 ) return false;
//Determine what maps can be visited from each map
for (i=0;i<numConns;i++)
{
MarkMapsConnected(mapdests, numMaps, conns[i].a, conns[i].b);
}
//Start finding out what maps we can visit
visitable = 0;
oldVisitable = 0;
canvisit[visitable]=mapdests[0].mapname;
visitable++;
for( i=0;i<numPasses;i++)
{
for ( j=0;j<numMaps;j++)
{
//See if map j can be visited
canVisitMap = False;
for (k=0;k<visitable;k++)
{
if (mapdests[j].mapname == canvisit[k])
{
canVisitMap = true;
}
}
//If map can be visited, go through all the places it can go
if (canVisitMap)
{
MarkMapDestinationsVisitible(mapdests[j], canvisit, visitable);
}
}
if( visitable == numMaps ) break;
if( visitable == oldVisitable ) break;
oldVisitable = visitable;
}
//Theoretically I should probably actually check to see if the maps match,
//but this is fairly safe...
if( visitable != numMaps )
debug("ValidateConnections visitable: " $ visitable $", numMaps: " $ numMaps $", i: "$i$", numConns: "$numConns);
return visitable == numMaps;
}
function int GetAllMapNames(out MapConnection mapdests[15])
{
local int i, j, numMaps;
local bool found;
for(i=0;i<numFixedConns;i++) {
found=false;
for(j=0; j<numMaps; j++) {
if( fixed_conns[i].a.mapname == mapdests[j].mapname ) {
found=true;
break;
}
}
if (found == false)
{
mapdests[numMaps].mapname = fixed_conns[i].a.mapname;
mapdests[numMaps].numDests = 0;
numMaps++;
}
found=false;
for(j=0; j<numMaps; j++) {
if( fixed_conns[i].b.mapname == mapdests[j].mapname ) {
found=true;
break;
}
}
if (found == false)
{
mapdests[numMaps].mapname = fixed_conns[i].b.mapname;
mapdests[numMaps].numDests = 0;
numMaps++;
}
}
for (i=0;i<numXfers;i++)
{
found=false;
for(j=0; j<numMaps; j++) {
if( xfers[i].mapname == mapdests[j].mapname ) {
found=true;
break;
}
}
if (found == false)
{
mapdests[numMaps].mapname = xfers[i].mapname;
mapdests[numMaps].numDests = 0;
numMaps++;
}
}
return numMaps;
}
function MarkMapsConnected(out MapConnection mapdests[15], int numMaps, MapTransfer a, MapTransfer b)
{
// can you get from A to B?
_MarkMapConnected(mapdests, numMaps, a, b);
// can you get from B to A?
_MarkMapConnected(mapdests, numMaps, b, a);
}
function bool _MarkMapConnected(out MapConnection mapdests[15], int numMaps, MapTransfer a, MapTransfer b)
{
local int mapidx, i;
local string maptag, depends;
// can you get from A to B?
if( IsDeadEndConnection(b, a) ) return false;
mapidx = FindMapDestinations(mapdests, numMaps, a.mapname);
if(mapidx == -1) {
err("failed _MarkMapConnected("$numMaps$", "$a.mapname$", "$b.mapname$")");
return false;
}
maptag = a.mapname $ "#" $ a.outTag;
for(i=0;i<ArrayCount(dependencies);i++) {
if( dependencies[i].dependent == "" ) break;
if( maptag == dependencies[i].dependent ) {
depends = dependencies[i].dependency;
break;
}
}
// write B into the destinations of A
AddDestination( mapdests[mapidx], b.mapname, depends);
return true;
}
function bool IsDeadEndConnection(MapTransfer m, MapTransfer from)
{
local int i;
local string s;
if(from.outTag == "") return true;
if(m.inTag == "") return true;
s = Caps(m.mapname $"#"$ m.inTag);
for(i=0; i < ArrayCount(dead_ends); i++) {
if( dead_ends[i] == "" ) break;
if( s == dead_ends[i] ) {
return true;
}
}
return false;
}
function int FindMapDestinations(MapConnection mapdests[15], int numMaps, string mapname)
{
local int i;
for (i=0;i<numMaps;i++)
{
if (mapdests[i].mapname == mapname)
{
return i;
}
}
err("failed to FindMapDestinations for "$mapname);
return -1;
}
function AddDestination( out MapConnection map, string mapname, string depends )
{
local int i;
for(i=0; i < map.numDests; i++) {
if( map.dest[i] == mapname ) {
if( depends != "" ) map.depends[i] = depends;
return;
}
}
map.dest[map.numDests] = mapname;
map.depends[map.numDests] = depends;
map.numDests++;
}
function int DuplicateConnections()
{
local int dupes, i, j;
for(i=0; i < numConns; i++) {
for(j=i+1; j < numConns; j++) {
if( CheckDuplicate(conns[i].a, conns[j].a)
|| CheckDuplicate(conns[i].a, conns[j].b)
|| CheckDuplicate(conns[i].b, conns[j].b)
|| CheckDuplicate(conns[i].b, conns[j].a)
) {
dupes++;
}
}
}
return dupes;
}
function bool CheckDuplicate(MapTransfer a, MapTransfer b)
{
if( a.mapname != b.mapname ) return false;
if( a.inTag == b.inTag
|| a.outTag == b.outTag
) {
return true;
}
return false;
}
function bool CheckDependencies(string depends, string canvisit[15], int visitable)
{
local int i;
if( depends == "" ) return true;
for(i=0;i<visitable;i++) {
if( depends == canvisit[i] ) {
return true;
}
}
return false;
}
function MarkMapDestinationsVisitible(MapConnection m, out string canvisit[15], out int visitable)
{
local int k, p;
local bool canVisitDest;
for (k=0;k<m.numDests;k++)
{
//If any of those destinations are not in the places we can visit, add them
canVisitDest = False;
for (p=0;p<visitable;p++)
{
if ( canvisit[p]==m.dest[k] )
{
canVisitDest = True;
}
}
if (canVisitDest == False && CheckDependencies(m.depends[k], canvisit, visitable) )
{
canvisit[visitable] = m.dest[k];
visitable++;
}
}
}
function GenerateConnections(int missionNum)
{
local int attempts, genconsfails, validatefails;
local bool isValid;
isValid = False;
BuildCache();
for(attempts=0; attempts<200; attempts++)
{
if( ! _GenerateConnections(missionNum) ) {
genconsfails++;
continue;// save a bunch of loops if we know we failed?
}
if(ValidateConnections()) {
if( attempts > 20 ) warning("GenerateConnections("$missionNum$") succeeded but took "$attempts$" attempts! seed: "$dxr.seed $", genconsfails: "$genconsfails$", validatefails: "$validatefails);
return;
}
validatefails++;
}
err("GenerateConnections("$missionNum$") failed after "$attempts$" attempts! seed: "$dxr.seed $", genconsfails: "$genconsfails$", validatefails: "$validatefails);
numConns = 0;// vanilla on failure
}
function BuildCache()
{
local int idx, destIdx;
for(idx=0; idx<numXfers; idx++) {
numXfersMaps[idx] = GetNumXfersByMap(xfers[idx].mapname);
// don't link to self
invalidCons[ (idx*ArrayCount(xfers)) + idx ] = 1;
numInvalids[idx] = 1;
}
//2d loop
for(idx=0; idx<numXfers; idx++) {
for(destIdx=idx+1; destIdx<numXfers; destIdx++) {
// check validity, also reversed
invalidCons[ (idx*ArrayCount(xfers)) + destIdx ] = 0;
invalidCons[ (destIdx*ArrayCount(xfers)) + idx ] = 0;
if ( ! IsConnectionValid(idx, destIdx) ) {
invalidCons[ (idx*ArrayCount(xfers)) + destIdx ] = 1;
invalidCons[ (destIdx*ArrayCount(xfers)) + idx ] = 1;
numInvalids[idx]++;
numInvalids[destIdx]++;
}
//
}
}
}
function bool _GenerateConnections(int missionNum)
{
local int xfersUsed;
local int connsMade;
local int nextAvailIdx;
local int destIdx;
local int i;
for(i=0;i<numXfers;i++)
{
xfers[i].used = False;
}
xfersUsed = 0;
connsMade = 0;
for(i=0; i < numFixedConns; i++) {
conns[i] = fixed_conns[i];
connsMade++;
}
while (xfersUsed < numXfers)
{
nextAvailIdx = GetNextPickiestTransfer();
conns[connsMade].a = xfers[nextAvailIdx];
xfers[nextAvailIdx].used = True;
xfersUsed++;
//Get a random unused transfer
destIdx = _FindConnectionFor(xfersUsed, nextAvailIdx);
if( destIdx == -1 ) {
return false;
}
xfers[destIdx].used = True;
xfersUsed++;
conns[connsMade].b = xfers[destIdx];
connsMade++;
}
numConns = connsMade;
return true;
}
function int _FindConnectionFor(int xfersUsed, int nextAvailIdx)
{
local int xferOffset, destIdx;
//count how many invalidCons we have
for(destIdx=0; destIdx<numXfers; destIdx++) {
if( xfers[destIdx].used ) {
continue;
}
else if( invalidCons[ (nextAvailIdx*ArrayCount(xfers)) + destIdx ] == 1 ) {
xfersUsed++;
}
}
//Get a random unused transfer
for (destIdx=-1; xfersUsed <= numXfers; xfersUsed++)
{
xferOffset = rng(numXfers-xfersUsed);
destIdx = GetNextUnusedTransferByOffset(nextAvailIdx, xferOffset);
if( destIdx == -1 )
break;
return destIdx;
}
l("didn't find valid connection for "
$ xfers[nextAvailIdx].mapname $ "#" $ xfers[nextAvailIdx].inTag $ " / #" $ xfers[nextAvailIdx].outTag
$ " with "$numXfers$" numXfers" );
return -1;
}
function AddXfer(string mapname, string inTag, string outTag)
{
xfers[numXfers].mapname = Caps(mapname);
xfers[numXfers].inTag = Caps(inTag);
xfers[numXfers].outTag = Caps(outTag);
xfers[numXfers].used = False;
numXfers++;
}
function AddDoubleXfer(string mapname_a, string inTag, string mapname_b, string outTag)
{
AddXfer(mapname_a, inTag, outTag);//we might need to also store mapname_b in the case of duplicate tags
AddXfer(mapname_b, outTag, inTag);
}
function AddFixedConn(string map_a, string inTag_a, string map_b, string outTag_a)
{
fixed_conns[numFixedConns].a.mapname = Caps(map_a);
fixed_conns[numFixedConns].a.inTag = Caps(inTag_a);
fixed_conns[numFixedConns].a.outTag = Caps(outTag_a);
fixed_conns[numFixedConns].b.mapname = Caps(map_b);
fixed_conns[numFixedConns].b.inTag = Caps(outTag_a);
fixed_conns[numFixedConns].b.outTag = Caps(inTag_a);
numFixedConns++;
}
// ApplyFixes is for backtracking that we don't want in the normal game
function ApplyFixes()
{
switch(dxr.localURL) {
case "06_HONGKONG_WANCHAI_CANAL":
FixHongKongCanal();
break;
/*case "06_HONGKONG_STORAGE":
foreach AllActors(class'WaterZone', w) {
//if( w.Name == 'WaterZone5' || w.Name == 'WaterZone1' )
w.ZoneVelocity = vectm(0,0,0);
}
break;*/
case "12_VANDENBERG_CMD":
FixVandebergCmd();
break;
case "14_OceanLab_Lab":
FixOceanLab();
break;
}
}
function FixHongKongCanal()
{
local HKTukTuk tuktuk;
local #var(prefix)Containers box;
local DynamicBlockPlayer dbp;
local vector loc;
local int i;
foreach AllActors(class'HKTukTuk', tuktuk) {
if( tuktuk.Name != 'HKTukTuk0' ) continue;
tuktuk.SetCollision(false,false,false);
tuktuk.bCollideWorld = false;
tuktuk.SetLocation(vectm(1162.203735, 1370, -482.995361));
break;
}
loc = vectm(1074.268188, 1368.834106, -535);
for(i=0; i < 5; i++) {
dbp = Spawn(class'DynamicBlockPlayer',,, loc);
dbp.SetBase(tuktuk);
dbp.SetCollisionSize(dbp.CollisionRadius*4, dbp.CollisionHeight*4);
if( i == 2 )// only the middle one will collide with the box
dbp.SetCollision(true, true, true);
if( i == 3 )// the roof thing on the boat is a bit higher
dbp.SetLocation(loc+vectm(0,0,16));
loc += vectm(38, 0, 0);
}
box = AddBox(class'#var(prefix)BoxMedium', vectm(1151.214355, 1370, -400));
box.bCollideWorld = false;
box.bPushable = false;
box.bHighlight = false;
}
function FixVandebergCmd()
{
local DeusExMover d;
local #var(prefix)Nanokey n;
local DXRKeys dxrk;
foreach AllActors(class'DeusExMover', d, 'security_tunnels') {
d.KeyIDNeeded = 'storage_door';
}
/*foreach AllActors(class'DeusExMover', d) {
switch(d.Tag) {
case 'security_tunnels':
d.KeyIDNeeded = 'storage_door';
case 'door_controlroom':
class'DXRDoors'.static.StaticMakePickable(d);
class'DXRDoors'.static.StaticMakeDestructible(d);
break;
}
}*/
n = Spawn(class'#var(prefix)NanoKey',,, vectm(2048.289063, 4712.830078, -2052.789551) );
n.Description = "Storage door key";
n.KeyID = 'storage_door';
// this is called from PostFirstEntry, so it's after DXRKeys already ran
dxrk = DXRKeys(dxr.FindModule(class'DXRKeys'));
if( dxrk != None ) dxrk.RandoKey(n);
}
function FixOceanLab()
{
local NanoKey n;
n = Spawn(class'NanoKey',,, vectm(1913.437012, 3191.914063, -2282.776855) );
n.Description = "Crew Module Access";
n.KeyID = 'crewkey';
n = Spawn(class'NanoKey',,, vectm(1583.074585, 462.036804, -1762.375610) );
n.Description = "Greasel Laboratory Key";
n.KeyID = 'Glab';
}
function RandoMission2()
{
AddFixedConn("02_NYC_BatteryPark","ToBatteryPark", "02_NYC_Street","ToStreet");
AddDoubleXfer("02_NYC_Bar","ToBarBackEntrance","02_NYC_Street","FromBarBackEntrance");
AddDoubleXfer("02_NYC_Bar","ToBarFrontEntrance","02_NYC_Street","FromBarFrontEntrance");
AddDoubleXfer("02_NYC_FreeClinic","FromStreet","02_NYC_Street","FromClinic");
AddDoubleXfer("02_NYC_Hotel","ToHotelBedroom","02_NYC_Street","BedroomWindow");
AddDoubleXfer("02_NYC_Hotel","ToHotelFrontDoor","02_NYC_Street","FromHotelFrontDoor");
AddDoubleXfer("02_NYC_Smug","?toname=PathNode83","02_NYC_Street","FromSmugFrontDoor");
AddDoubleXfer("02_NYC_Smug","ToSmugBackDoor","02_NYC_Street","FromSmugBackDoor");
AddDoubleXfer("02_NYC_Underground","ToNYCUndergroundSewer2","02_NYC_Street","FromNYCUndergroundSewer2");
AddDoubleXfer("02_NYC_Underground","ToNYCSump","02_NYC_Street","FromNYCSump");
AddDoubleXfer("02_NYC_Warehouse","ToRoofTop","02_NYC_Street","FromRoofTop");
AddDoubleXfer("02_NYC_Warehouse","ToWarehouseAlley","02_NYC_Street","FromWarehouseAlley");
}
function RandoMission3()
{
AddFixedConn("03_NYC_BatteryPark","x", "03_NYC_BatteryPark","x");//just make sure the traversal in ValidateConnections starts from the same place the player starts at
AddDoubleXfer("03_NYC_BatteryPark","BBSExit","03_NYC_BrooklynBridgeStation","FromNYCStreets");
AddDoubleXfer("03_NYC_BrooklynBridgeStation","MoleExit","03_NYC_MolePeople","MoleEnt");
AddDoubleXfer("03_NYC_MolePeople","SewerExit","03_NYC_AirfieldHeliBase","SewerEnt");
AddDoubleXfer("03_NYC_AirfieldHeliBase","BHElevatorEnt","03_NYC_Airfield","BHElevatorExit");
AddDoubleXfer("03_NYC_AirfieldHeliBase","FromOcean","03_NYC_Airfield","ToOcean");
AddDoubleXfer("03_NYC_Airfield","HangarExit","03_NYC_Hangar","HangarEnt");
AddDoubleXfer("03_NYC_Hangar","747PassExit","03_NYC_747","747PassEnt");
}
function RandoMission4()
{
AddFixedConn("04_NYC_Street","x", "04_NYC_Street","x");
//AddDoubleXfer("04_NYC_BATTERYPARK","ToBatteryPark","04_NYC_Street","ToStreet");
AddDoubleXfer("04_NYC_STREET","FromSmugBackDoor","04_NYC_Smug","ToSmugBackDoor");
AddDoubleXfer("04_NYC_STREET","FromSmugFrontDoor","04_NYC_Smug","?toname=PathNode83");
AddDoubleXfer("04_NYC_STREET","FromBarBackEntrance","04_NYC_Bar","ToBarBackEntrance");
AddDoubleXfer("04_NYC_STREET","FromBarFrontEntrance","04_NYC_Bar","ToBarFrontEntrance");
AddDoubleXfer("04_NYC_STREET","FromHotelFrontDoor","04_NYC_Hotel","ToHotelFrontDoor");
AddDoubleXfer("04_NYC_STREET","BedroomWindow","04_NYC_Hotel","ToHotelBedroom");
AddDoubleXfer("04_NYC_STREET","FromNSFHQ","04_NYC_NSFHQ","ToNSFHQ");
AddDoubleXfer("04_NYC_STREET","FromNYCUndergroundSewer2","04_NYC_Underground","ToNYCUndergroundSewer2");
AddDoubleXfer("04_NYC_STREET","FromNYCSump","04_NYC_Underground","ToNYCSump");
}
function RandoMission6()
{
AddFixedConn("06_HONGKONG_HELIBASE","Helibase","06_HongKong_WanChai_Market","cargoup");
AddDoubleXfer("06_HONGKONG_MJ12LAB","cathedral","06_HongKong_VersaLife","secret");
AddDoubleXfer("06_HONGKONG_MJ12LAB","tubeend","06_HongKong_Storage","basement");
AddDoubleXfer("06_HONGKONG_STORAGE","waterpipe","06_HongKong_WanChai_Canal","canal");
//AddXfer("06_HongKong_Storage","BackDoor","06_HONGKONG_WANCHAI_GARAGE#Teleporter");//one way
//AddFixedConn("06_HONGKONG_TONGBASE","lab","06_HongKong_WanChai_Market","compound");
AddDoubleXfer("06_HONGKONG_VERSALIFE","Lobby","06_HongKong_WanChai_Market","market");
AddDoubleXfer("06_HONGKONG_WANCHAI_CANAL","Street","06_HongKong_WanChai_Street","Canal");
AddDoubleXfer("06_HONGKONG_WANCHAI_CANAL","market01","06_HongKong_WanChai_Market","canal01");
AddDoubleXfer("06_HONGKONG_WANCHAI_CANAL","double","06_HongKong_WanChai_Market","chinahand");
AddDoubleXfer("06_HONGKONG_WANCHAI_GARAGE","market04","06_HongKong_WanChai_Market","garage01");
AddDoubleXfer("06_HONGKONG_WANCHAI_MARKET","canal03","06_HongKong_WanChai_Underworld","market03");
AddDoubleXfer("06_HongKong_WanChai_Street","alleyout","06_HongKong_WanChai_Canal","alleyin");
}
function RandoMission8()
{
AddFixedConn("08_NYC_Street","x", "08_NYC_Street","x");
AddDoubleXfer("08_NYC_BAR","ToBarFrontEntrance","08_NYC_Street","FromBarFrontEntrance");
AddDoubleXfer("08_NYC_BAR","ToBarBackEntrance","08_NYC_Street","FromBarBackEntrance");
AddDoubleXfer("08_NYC_FREECLINIC","FromStreet","08_NYC_Street","FromClinic");
AddDoubleXfer("08_NYC_HOTEL","ToHotelFrontDoor","08_NYC_Street","FromHotelFrontDoor");
AddDoubleXfer("08_NYC_HOTEL","ToHotelBedroom","08_NYC_Street","BedroomWindow");
AddDoubleXfer("08_NYC_SMUG","?toname=PathNode83","08_NYC_Street","FromSmugFrontDoor");
AddDoubleXfer("08_NYC_SMUG","ToSmugBackDoor","08_NYC_Street","FromSmugBackDoor");
AddDoubleXfer("08_NYC_UNDERGROUND","ToNYCSump","08_NYC_Street","FromNYCSump");
AddDoubleXfer("08_NYC_UNDERGROUND","ToNYCUndergroundSewer2","08_NYC_Street","FromNYCUndergroundSewer2");
}
function RandoMission9()
{
AddFixedConn("09_NYC_DOCKYARD","x", "09_NYC_DOCKYARD","x");
AddDoubleXfer("09_NYC_DOCKYARD","ToDockyardSewer","09_NYC_Ship","FromDockyardSewer");
AddDoubleXfer("09_NYC_DOCKYARD","FromAircondDuct","09_NYC_ShipFan","ToAircondDuct");
AddDoubleXfer("09_NYC_DOCKYARD","ExitShip","09_NYC_Ship","EnterShip");
//AddDoubleXfer("09_NYC_DOCKYARD","","09_NYC_Graveyard","");
//AddDoubleXfer("09_NYC_GRAVEYARD","","10_Paris_Catacombs","");
AddDoubleXfer("09_NYC_SHIP","FromFanRoom","09_NYC_ShipFan","ToFanRoom");
AddDoubleXfer("09_NYC_SHIP","FromDuctRoom","09_NYC_ShipFan","ToDuctRoom");
AddDoubleXfer("09_NYC_SHIP","FromBelow","09_NYC_ShipBelow","FromAbove");
}
function RandoMission10()
{
AddFixedConn("10_PARIS_CATACOMBS","x", "10_PARIS_CATACOMBS","x");
AddDoubleXfer("10_PARIS_CATACOMBS","spiralstair","10_Paris_Catacombs_Tunnels","spiralstair");//same tag on both sides?
AddDoubleXfer("10_PARIS_CATACOMBS_TUNNELS","?toname=AmbientSound10","10_Paris_Metro","sewer");
AddDoubleXfer("10_PARIS_CHATEAU","Chateau_start", "10_paris_metro","?toname=PathNode447");
AddDoubleXfer("10_PARIS_CHATEAU","?toname=Light135","11_Paris_Cathedral","cathedralstart");
AddDoubleXfer("10_PARIS_CLUB","Paris_Club1","10_Paris_Metro","Paris_Metro1");
AddDoubleXfer("10_PARIS_CLUB","Paris_Club2","10_Paris_Metro","Paris_Metro2");
AddDoubleXfer("11_PARIS_CATHEDRAL","Paris_Underground","11_Paris_Underground","Paris_Underground");
}
function RandoMission12()
{
// I'm not sure what arrangements I would want for vandenberg? maybe I should just make a key for the storage door and stick it somewhere in cmd?
AddFixedConn("12_VANDENBERG_CMD","x","12_VANDENBERG_CMD", "x");
AddDoubleXfer("12_VANDENBERG_CMD","commstat","12_vandenberg_tunnels","start");
AddDoubleXfer("12_VANDENBERG_CMD","storage","12_vandenberg_tunnels","end");
AddDoubleXfer("12_VANDENBERG_CMD","hall","12_vandenberg_computer","computer");
AddDoubleXfer("12_VANDENBERG_CMD","?toname=PathNode8", "12_Vandenberg_gas","gas_start");
AddDoubleXfer("12_VANDENBERG_GAS","?toname=PathNode98", "14_Vandenberg_sub","PlayerStart");
AddDoubleXfer("14_OCEANLAB_LAB","Sunkentunnel","14_OceanLab_UC","UC");//we don't care about what map name the teleporter says, the real map name is what matters
AddDoubleXfer("14_OCEANLAB_LAB","Sunkenlab","14_Vandenberg_sub","subbay");
AddDoubleXfer("14_Vandenberg_Sub","?toname=InterpolationPoint39", "14_Oceanlab_silo","frontgate");
}
function RandoMission15()
{
AddFixedConn("15_AREA51_BUNKER","x","15_AREA51_BUNKER", "x");
//AddDoubleXfer("15_AREA51_BUNKER","commstat","","");
AddDoubleXfer("15_AREA51_BUNKER","?toname=Light188","15_Area51_entrance","start");
AddDoubleXfer("15_Area51_entrance","?toname=Light73","15_AREA51_FINAL","start");
AddDoubleXfer("15_AREA51_FINAL","final_end","15_Area51_page","page_start");
//AddDoubleXfer("15_AREA51_FINAL","Start","");
}
function GenerateXfers(int missionNum)
{
switch(missionNum)
{
case 2:
RandoMission2();
break;
case 3:
RandoMission3();
break;
case 4:
RandoMission4();
break;
case 6:
RandoMission6();
break;
case 8:
RandoMission8();
break;
case 9:
RandoMission9();
break;
case 10:
RandoMission10();
break;
case 11:
//RandoMission11();
break;
case 12:
RandoMission12();
break;
case 14:
//RandoMission14();
break;
case 15: