forked from y-salnikov/ironseed_fpc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
weird.pas
1310 lines (1254 loc) · 31.8 KB
/
weird.pas
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
unit weird;
(********************************************************************
This file is part of Ironseed.
Ironseed is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Ironseed is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Ironseed. If not, see <http://www.gnu.org/licenses/>.
********************************************************************)
{*********************************************
CatchAll unit for IronSeed
Copyright:
1994 Channel 7, Destiny: Virtual
2013 y-salnikov
2020 Matija Nalis <[email protected]>
**********************************************}
interface
const
maxeventsystems= 11;
eventsystems: array[0..maxeventsystems] of byte =
(211,129,182, 31, 98,138,229, 28,182,119,182, 14);
eventstorun: array[0..maxeventsystems] of integer =
( 12, 13, 15, 14, 16, 17, 20, 24,14,10000,10002,25);
{ NB: this comment is historic. see eventsystems[]/eventstorun[] above for real info.
sys event place
--- ----- -------------------
211 202 satellite from is2
119 203 phaedor moch 1
129 206 hallifax (&260)
182 220 trojan gate
31 220 lix
123 223 aria
169 229 aard ship
205 234 titerian worshipers <- check 265 again!
98 235 monks
138 241 derelict
164 nova
229 248 shuntship
28 265 temple
33 derrack
14 derrack base
241 ermigen
23 scav system
247 god's eye
129 260 hallifax 2
}
function skillcheck(n: integer): boolean;
procedure sanitycheck(n: integer);
{$IFNDEF DEMO}
procedure easteregg2;
procedure easteregg3;
procedure easteregg4;
procedure easteregg5;
procedure easteregg6;
{$ENDIF}
procedure bossmode;
procedure deathsequence(n: integer);
procedure event(n: integer);
procedure clearevent(n: integer);
procedure screensaver;
procedure lifesupportfailure;
procedure addpending(n, t : integer);
procedure tickpending(ticks : integer; background : boolean);
procedure blast(c1,c2,c3: integer);
implementation
uses utils_, data, utils, gmouse, journey, comm2, comm, combat, modplay, utils2, ending;
{$IFNDEF DEMO}
var
done: boolean;
{$ENDIF}
procedure blast(c1,c2,c3: integer);
var a,b,j: integer;
temppal: paltype;
begin
temppal[0,1]:=0; // to turn off warnings, variables are actually correctly initialized by function below
move(colors,temppal,sizeof(paltype));
b:=tslice*4;
for a:=1 to 63 do
begin
for j:=0 to 255 do
begin
colors[j,1]:=colors[j,1] + round(a*(c1-colors[j,1])/63);
colors[j,2]:=colors[j,2] + round(a*(c2-colors[j,2])/63);
colors[j,3]:=colors[j,3] + round(a*(c3-colors[j,3])/63);
end;
set256colors(colors);
delay(b);
end;
set256colors(colors);
move(temppal,colors,sizeof(paltype));
end;
{ add event "n" to happen in some time "t" in the future }
procedure addpending(n, t : integer);
var
i : integer;
begin
for i := 0 to 127 do
begin
if logpending[i].log = n then
begin
if logpending[i].time > t then
logpending[i].time := t;
exit;
end;
if logpending[i].log < 0 then
begin
logpending[i].log := n;
logpending[i].time := t;
exit;
end;
end;
end; { addpending }
{ move logpending[] to events[]/logs[] when it's time happens }
procedure tickpending(ticks : integer; background : boolean);
var
i, j : integer;
begin
i := 0;
while i < 128 do
begin
if logpending[i].log < 0 then
break;
dec(logpending[i].time, ticks);
if logpending[i].time <= 0 then
begin
if background then
begin
logpending[i].time := 0;
end else begin
event(logpending[i].log);
for j:= i + 1 to 127 do
begin
logpending[j - 1] := logpending[j];
if logpending[j].log < 0 then
break;
end;
logpending[127].log := -1;
dec(i);
end;
end;
inc(i);
end;
end; { tickpending }
{ just sets the bit in events[] bitmap (and in ship.events bitmap for events 50-500) }
procedure setevent(n: integer);
var i,j: word;
begin
if n >= 8192 then
exit;
events[n shr 3] := events[n shr 3] or (1 shl (n and 7));
if (n<50) or (n>=500) then exit;
n:=n-50;
i:=50+(n div 8); { same as 50+(n shr 3) ? }
j:=n mod 8; { same as (n and 7) ? }
assert (i<=64, 'ship.events index out of bounds1');
ship.events[i]:=ship.events[i] or (1 shl j);
end;
{ just clears the bit in events[] bitmap (and in ship.events bitmap for events 50-500) }
procedure clearevent(n: integer);
var i,j: word;
begin
if n >= 8192 then
exit;
events[n shr 3] := events[n shr 3] and not (1 shl (n and 7));
if (n<50) or (n>=500) then exit;
n:=n-50;
i:=50+(n div 8);
j:=n mod 8;
assert (i<=64, 'ship.events index out of bounds2');
ship.events[i]:=ship.events[i] and not (1 shl j);
end;
{ add and display a log "n" to first unused (-1) space in logs[256].
Also sets an event "n".
For events < 50, also add compatibility to ship.events[] }
procedure addlog(n: integer);
var i: integer;
begin
setevent(n);
i:=0;
while logs[i] <> -1 do
inc(i);
assert (i<=255, 'logs index out of bounds');
logs[i] := n;
if n < 50 then
begin
{Set old style log/events.}
i:=0;
while ship.events[i]<>255 do inc(i);
assert (i<50, 'ship.events (non-bitmapped) index out of bounds');
ship.events[i]:=n;
end;
computerlogs(n);
end;
procedure startphaedormoch;
begin
getspecial(10,1010);
addtofile;
createwandering(WNDORDER_RETREAT);
end;
procedure startarmada;
begin
getspecial(7,1007);
addtofile;
createwandering(WNDORDER_ATTACK);
initiatecombat;
end;
{ this handles all associated things that happen related to that event (like cargo/systems update, endgame etc.)
It might add a log for that event (but not always)
and it might mark that event as happened via setevent() (but not for events 0-50 nor 1000-1999 !)
}
procedure event(n: integer);
var i,j: integer;
// p:^byte;
begin
if (n=10)then
begin
// p^:=0;
end;
if chevent(n) then exit;
{Don't set log events. Some logs won't activate unless another event has been activated.}
if not (((n >= 0) and (n < 50)) or ((n >= 1000) and (n <= 1999))) then
begin
setevent(n);
end;
case n of
0..9 : addlog(n); { alien races: 0=Sengzhac 1=D'phak 2=Aard 3=Ermigen 4=Titarian 5=Quai_Paloi 6=Scavengers 7=Icon 8=The_Guild 9=Void_Dwellers }
11 : addlog(11); { sector codex }
12 : begin { second buoy }
systems[145].notes:=systems[145].notes or 1;
systems[211].notes:=systems[211].notes or 1;
systems[115].notes:=systems[115].notes or 1;
systems[ 18].notes:=systems[ 18].notes or 1;
systems[199].notes:=systems[199].notes or 1;
systems[103].notes:=systems[103].notes or 1;
systems[216].notes:=systems[216].notes or 1;
systems[105].notes:=systems[105].notes or 1;
systems[ 93].notes:=systems[ 93].notes or 1;
addlog(12);
event(1001);
end;
13 : addlog(13); { hallifax }
14 : begin { trojan gate }
addlog(14);
redoscreen(2389,1695,1314);
end;
15 : addlog(15); { planets des. }
16 : addlog(16); { monks }
17 : begin { derelict }
addcargo(ID_ART_THERMAL_PLATING, true);
for j:=0 to 3 do addcargo(ID_UNKNOWN_COMPONENT, true);
addcargo(ID_UNKNOWN_MATERIAL, true);
addlog(17);
end;
18 : addlog(18); { thermoplast }
19 : begin { nova }
blast(63,63,63);
addlog(19);
end;
20 : begin { shunt ship }
addcargo(ID_ART_SHUNT_DRIVE, true);
addlog(20);
end;
21 : if chevent(36) then addlog(21); { malzatoir }
22 : if chevent(21) then addlog(22); { icon data }
24 : if (incargo(ID_ART_DETONATOR)>0) and (chevent(42)) then
begin { in temple }
removecargo(ID_ART_DETONATOR);
addcargo(ID_ART_CHANNELER, true);
addcargo(ID_ART_IRON_SEED, true);
addcargo(ID_ART_HOMING_DEVICE, true);
addlog(24);
end;
25 : if (incargo(ID_ART_HOMING_DEVICE)>0) and (chevent(24)) then
begin { pirate base }
removecargo(ID_STASIS_GENERATOR);
removecargo(ID_ART_HOMING_DEVICE);
addcargo(ID_ART_SHUNT_DRIVE, true);
for j:=1 to random(3) do
if random(2)=0 then addcargo(random(400)+1+ID_ARTIFACT_OFFSET, true)
else addcargo(random(100)+1+ID_ARTIFACT2_OFFSET, true);
for j:=1 to 3 do addcargo(ID_UNKNOWN_COMPONENT, true);
addlog(25);
end;
26 : if chevent(24) then
begin { piracy }
removecargo(ID_ART_SHUNT_DRIVE);
addlog(26);
end;
27 : if chevent(25) then addlog(27); { icon trans }
28 : if chevent(30) then
begin { find ermigen data tapes }
addcargo(ID_ART_ERMIGEN_DATA_TAPES, true);
addlog(28);
{erase notes on star}
for i := 1 to 1000 do
if (tempplan^[i].system = 45) and (tempplan^[i].orbit = 0) then
tempplan^[i].notes := 0;
end;
29 : errorhandler('Log #29 ain''t suppose to happen!',7); { kill this! blank!!! }
36 : begin { research drv }
addcargo(ID_ART_SHUNT_DRIVE, true);
addlog(36);
end;
39 : begin
addcargo(ID_ART_DETONATOR, true);
addlog(39);
end;
40 : begin { glyptic scythe } {FIXME: from logs.txt Phaedor_Moch LOG is #40, but it seem to be handled by event40 GLYPTIC SCYTHE here - but shouldn't that be log @1101? what if we don't give them items for repair?? would we get log of them at all?) however it did seem to work previously, so I won't be touchinh this unless it turns out to be a problem}
addcargo(ID_ART_GLYPTIC_SCYTHE, true);
addlog(40);
end;
42 : addlog(42); { temple found }
43 : begin { guild get genes }
removecargo(ID_ART_YLINTH_MUTAGENICS);
addlog(43);
end;
45 : begin { doom gate }
addcargo(ID_DOOM_GATE, true);
addlog(45);
end;
46 : begin { thaumaturge }
addcargo(ID_THAUMATURGE, true);
addlog(46);
end;
47 : begin { titarian like shuntdrive }
removecargo(ID_ART_SHUNT_DRIVE);
addlog(47);
end;
48 : begin { quai pa'loi join }
addcargo(ID_ART_MULTI_IMAGER, true);
addlog(48);
end;
49 : begin { find genes }
addcargo(ID_ART_YLINTH_MUTAGENICS, true);
addlog(49);
end;
1103 : begin {Recovery of the Cargan (Ermigen flagship)}
addlog(1103);
end;
// end;
//case n of
10,23,30..35,37,38,41,44: addlog(n); { catch the other logs too }
1000..1102,1104..1999: addlog(n); { catch the new logs also }
10000 : begin
println;
tcolor:=94;
print('SECURITY: Scanners detect alien ship.');
startphaedormoch;
tcolor:=94;
println;
print('SCIENCE: Perhaps we should initiate contact, Laird.');
end;
10001 : removecargo(ID_ART_MULTI_IMAGER); { remove multi-imager }
10002 : begin { scavenger armada }
if (chevent(45)) and (chevent(46)) and (chevent(31))
and ((chevent(34)) or (chevent(30)))
and (chevent(47)) and (chevent(48)) and (chevent(21))
and (chevent(23))
then
begin
startarmada;
endgame;
end;
repeat
startarmada;
until quit;
end;
end; { case }
end;
procedure tempinsanity(n: integer);
var i: integer;
s: string[80];
begin
set256colors(colors);
if (random(5)>0) then exit;
i:=random(19);
case i of
0: s:='Out of memory error on brain '+chr(n+64)+'.';
1: s:='Brain '+chr(n+64)+' not a supported device.';
2: s:='Read error on brain '+chr(n+64)+' incompatible media.';
3: s:='CRC checksum error on brain '+chr(n+64)+'.';
4: s:='Brain '+chr(n+64)+' has been upgraded to patch level 3.';
5: s:='Segmentation error on brain '+chr(n+64)+'. Reboot?';
6: s:='Mentation error, corpse dumped.';
7: s:='Network error on brain '+chr(n+64)+'. Abandom, Retry, Apologize?';
8: s:='Brain '+chr(n+64)+' is not a system brain.';
9: s:='Runtime error in LIFE.BIN.';
10: s:='Runtime error 226 in LIFE.BIN exceeded 10.';
11: s:='Divide by zero error in brain '+chr(n+64)+'.';
12: s:='Write protection fault on core sector 02AF'+chr(n+64)+'.';
13: s:='Runtime error 1 in program CHECKING.BIN.';
14: s:='Underflow error in CHECKING.EXE.';
15: s:='Overflow in TOWELETBOWEL.EXE. Flush stack?';
16: s:='Interrupt vector table restored.';
17: s:='Default settings.';
18: s:='Power fluxuation detected on brain '+chr(n+64)+'.';
end;
showchar(n,s);
end;
procedure sanitycheck(n: integer);
var i: integer;
begin
with ship.crew[n] do
begin
if san>0 then dec(san);
if emo>1 then dec(emo,2) else emo:=0;
if men>0 then dec(men);
if phy<99 then inc(phy);
if san=0 then
begin
tempinsanity(n);
exit;
end;
i:=random(80);
if i>san then
begin
tempinsanity(n);
exit;
end;
end;
end;
function skillcheck(n: integer): boolean;
var i: integer;
begin
i:=random(80);
with ship.crew[n] do
begin
if i>skill then
begin
skillcheck:=false;
i:=random(80);
if i>perf then
begin
if perf>0 then dec(perf);
if men>1 then dec(men,2) else men:=0;
if phy>0 then dec(phy);
if emo<99 then inc(emo);
end;
if perf=0 then
begin
sanitycheck(n);
if skill>0 then dec(skill);
if phy>1 then dec(phy,2) else phy:=0;
if emo>0 then dec(emo);
if men<99 then inc(men);
end;
end
else skillcheck:=true;
end;
end;
{$IFNDEF DEMO}
procedure easteregg2;
var
c,i,j: integer;
portrait: ^portraittype;
begin
mousehide;
compressfile(loc_tmp()+'current2',@screen);
bkcolor:=5;
fading;
scr_fillchar(screen,sizeof(screen),0);
for i:=0 to 199 do
for j:=0 to 319 do
screen[i,j]:=random(16)+200+(i mod 2)*16;
graybutton(40,53,280,153);
tcolor:=47;
graybutton(110,25,210,61);
printxy(134,30,'Channel 7');
printxy(116,50,'Destiny: Virtual');
tcolor:=188;
printxy(139,70,'Welcome');
printxy(141,80,'To The');
printxy(134,90,'Channel 7');
printxy(134,100,'Easteregg');
printxy(144,110,'Hunt!');
tcolor:=92;
graybutton(80,146,240,160);
revgraybutton(49,68,120,139);
revgraybutton(200,68,271,139);
printxy(91,150,'DON''T TOUCH THIS BUTTON!!!');
new(portrait);
loadscreen(loc_data()+'image31',portrait);
for i:=0 to 69 do
for j:=0 to 69 do
if portrait^[i,j]<32 then portrait^[i,j]:=portrait^[i,j] div 2
else portrait^[i,j]:=(portrait^[i,j]-128) div 2;
for i:=0 to 69 do
scrto_move(portrait^[i],screen[i+69,50],70);
loadscreen(loc_data()+'image32',portrait);
for i:=0 to 69 do
for j:=0 to 69 do
if portrait^[i,j]<32 then portrait^[i,j]:=portrait^[i,j] div 2
else portrait^[i,j]:=(portrait^[i,j]-128) div 2;
for i:=0 to 69 do
scrto_move(portrait^[i],screen[i+69,201],70);
dispose(portrait);
mouseshow;
c:=0;
set256colors(colors);
repeat
for i:=200 to 215 do
colors[i]:=colors[random(22)];
for i:=216 to 231 do
colors[i]:=colors[0];
set256colors(colors);
delay(tslice div 2);
done:=mouse.getstatus;
if (c=0) and (mouse.y>145) and (mouse.y<161) and (mouse.x>79) and (mouse.x<241) then
begin
c:=1;
mousehide;
plainfadearea(80,146,240,160,3);
mouseshow;
end
else if (c=1) and ((mouse.y<146) or (mouse.y>160) or (mouse.x<80) or (mouse.x>240)) then
begin
c:=0;
mousehide;
plainfadearea(80,146,240,160,-3);
mouseshow;
end;
if fastkeypressed then readkey;
for i:=216 to 231 do
colors[i]:=colors[random(16)];
for i:=200 to 215 do
colors[i]:=colors[0];
set256colors(colors);
delay(tslice div 2+7);
until (done) and (c=1);
fading;
mousehide;
loadscreen(loc_tmp()+'current2',@screen);
set256colors(colors);
bkcolor:=3;
mouseshow;
end;
procedure easteregg3;
var
j,c: integer;
s: string[12];
s2: string[3];
begin
mousehide;
compressfile(loc_tmp()+'current',@screen);
tcolor:=92;
bkcolor:=5;
graybutton(0,0,319,199);
graybutton(80,166,240,180);
printxy(91,170,'DON''T TOUCH THIS BUTTON!!!');
printxy(113,5,'Set Default Song');
for j:=0 to 3 do
begin
graybutton(5,35+j*34,105,47+j*34);
graybutton(109,35+j*34,209,47+j*34);
graybutton(213,35+j*34,313,47+j*34);
end;
tcolor:=22;
printxy(30,38,'Sengzhac');
printxy(35,72,'D''Pahk');
printxy(40,106,'Aard');
printxy(33,140,'Ermigen');
printxy(134,38,'Titarian');
printxy(125,72,'Quai Pa''Loi');
printxy(130,106,'Scavengers');
printxy(144,140,'Icon');
printxy(236,38,'The Guild');
printxy(229,72,'Phaedor Moch');
printxy(226,106,'Void Dwellers');
printxy(241,140,'Generic');
tcolor:=188;
printxy(56,183,'Welcome To The Channel 7 Easteregg Hunt!');
c:=0;
s2:=' ';
printxy(130,155,'/'+s2);
printxy(175,155,'/63');
mouseshow;
repeat
s2:=' ';
printxy(120,155,s2);
s2:=' ';
printxy(165,155,s2);
done:=mouse.getstatus;
if (c=0) and (mouse.y>165) and (mouse.y<181) and (mouse.x>79) and (mouse.x<241) then
begin
c:=1;
mousehide;
plainfadearea(80,166,240,180,3);
mouseshow;
end
else if (c=1) and ((mouse.y<166) or (mouse.y>180) or (mouse.x<80) or (mouse.x>240)) then
begin
c:=0;
mousehide;
plainfadearea(80,166,240,180,-3);
mouseshow;
end;
if done then
begin
s:='';
case mouse.x of
5..105: case mouse.y of
35..47: s:='SENGZHAC.MOD';
69..81: s:='DPAK.MOD';
103..115: s:='AARD.MOD';
137..149: s:='ERMIGEN.MOD';
end;
109..209: case mouse.y of
35..47: s:='TITARIAN.MOD';
69..81: s:='QUAI.MOD';
103..115: s:='SCAVENG.MOD';
137..149: s:='ICON.MOD';
end;
213..313: case mouse.y of
35..47: s:='GUILD.MOD';
69..81: s:='PHADOR.MOD';
103..115: s:='VOID.MOD';
137..149: s:='SECTOR.MOD';
end;
end;
if s<>'' then
begin
playmod(true,loc_sound()+s);
s2:=' ';
mousehide;
printxy(130,155,'/'+s2);
mouseshow;
defaultsong:=s;
end;
end;
if fastkeypressed then readkey;
until (done) and (c=1);
fading;
mousehide;
loadscreen(loc_tmp()+'current',@screen);
set256colors(colors);
mouseshow;
end;
procedure easteregg4;
var i,j,c: integer;
begin
mousehide;
compressfile(loc_tmp()+'current2',@screen);
bkcolor:=5;
fading;
scr_fillchar(screen,sizeof(screen),0);
for i:=0 to 199 do
for j:=0 to 319 do
screen[i,j]:=random(16)+200+(i mod 2)*16;
graybutton(40,53,280,153);
tcolor:=47;
graybutton(110,25,210,61);
printxy(134,30,'Channel 7');
printxy(116,50,'Destiny: Virtual');
tcolor:=188;
printxy(56,130,'Welcome To The Channel 7 Easteregg Hunt!');
tcolor:=92;
graybutton(80,146,240,160);
printxy(91,150,'DON''T TOUCH THIS BUTTON!!!');
graybutton(56,80,156,95);
graybutton(163,80,263,95);
graybutton(56,100,156,115);
graybutton(163,100,263,115);
printxy(57,84,'Repair Hull Damage');
printxy(67,104,'Fill Fuel Tank');
printxy(174,84,'Repair Damages');
printxy(169,104,'Recharge Battery');
mouseshow;
c:=0;
set256colors(colors);
repeat
for i:=200 to 215 do
colors[i]:=colors[random(22)];
for i:=216 to 231 do
colors[i]:=colors[0];
set256colors(colors);
delay(tslice div 2);
done:=mouse.getstatus;
if (c=0) and (mouse.y>145) and (mouse.y<161) and (mouse.x>79) and (mouse.x<241) then
begin
c:=1;
mousehide;
plainfadearea(80,146,240,160,3);
mouseshow;
end
else if (c=1) and ((mouse.y<146) or (mouse.y>160) or (mouse.x<80) or (mouse.x>240)) then
begin
c:=0;
mousehide;
plainfadearea(80,146,240,160,-3);
mouseshow;
end;
if done then
case mouse.x of
56..156: case mouse.y of
80..95: ship.hullintegrity:=ship.hullmax;
100..115: ship.fuel:=ship.fuelmax;
end;
163..263: case mouse.y of
80..95: for j:=1 to 7 do ship.damages[j]:=0;
100..115: ship.battery:=32000;
end;
end;
if fastkeypressed then readkey;
for i:=216 to 231 do
colors[i]:=colors[random(16)];
for i:=200 to 215 do
colors[i]:=colors[0];
set256colors(colors);
delay(tslice div 2+7);
until (done) and (c=1);
fading;
mousehide;
loadscreen(loc_tmp()+'current2',@screen);
set256colors(colors);
bkcolor:=3;
mouseshow;
end;
procedure easteregg5;
var i,j,c: integer;
begin
mousehide;
compressfile(loc_tmp()+'current2',@screen);
bkcolor:=5;
fading;
scr_fillchar(screen,sizeof(screen),0);
for i:=0 to 199 do
for j:=0 to 319 do
screen[i,j]:=random(16)+200+(i mod 2)*16;
graybutton(40,53,280,153);
tcolor:=47;
graybutton(110,25,210,61);
printxy(134,30,'Channel 7');
printxy(116,50,'Destiny: Virtual');
tcolor:=188;
printxy(56,130,'Welcome To The Channel 7 Easteregg Hunt!');
tcolor:=92;
graybutton(80,146,240,160);
printxy(91,150,'DON''T TOUCH THIS BUTTON!!!');
graybutton(56,80,156,95);
graybutton(163,80,263,95);
graybutton(56,100,156,115);
graybutton(163,100,263,115);
printxy(77,84,'Add a Dirk');
printxy(54,104,'Add Reflective Hull');
printxy(177,84,'Add Component');
printxy(179,104,'Add Material');
mouseshow;
c:=0;
set256colors(colors);
repeat
for i:=200 to 215 do
colors[i]:=colors[random(22)];
for i:=216 to 231 do
colors[i]:=colors[0];
set256colors(colors);
delay(tslice div 2);
done:=mouse.getstatus;
if (c=0) and (mouse.y>145) and (mouse.y<161) and (mouse.x>79) and (mouse.x<241) then
begin
c:=1;
mousehide;
plainfadearea(80,146,240,160,3);
mouseshow;
end
else if (c=1) and ((mouse.y<146) or (mouse.y>160) or (mouse.x<80) or (mouse.x>240)) then
begin
c:=0;
mousehide;
plainfadearea(80,146,240,160,-3);
mouseshow;
end;
if done then
case mouse.x of
56..156: case mouse.y of
80..95: if incargo(ID_DIRK)<5 then addcargo2(ID_DIRK, true);
100..115: if incargo(ID_REFLECTIVEHULL)<5 then addcargo2(ID_REFLECTIVEHULL, true);
end;
163..263: case mouse.y of
80..95: if incargo(ID_UNKNOWN_COMPONENT)<16 then addcargo2(ID_UNKNOWN_COMPONENT, true);
100..115: if incargo(ID_UNKNOWN_MATERIAL)<16 then addcargo2(ID_UNKNOWN_MATERIAL, true);
end;
end;
if fastkeypressed then readkey;
for i:=216 to 231 do
colors[i]:=colors[random(16)];
for i:=200 to 215 do
colors[i]:=colors[0];
set256colors(colors);
delay(tslice div 2+7);
until (done) and (c=1);
fading;
mousehide;
loadscreen(loc_tmp()+'current2',@screen);
set256colors(colors);
bkcolor:=0;
mouseshow;
end;
procedure easteregg6;
begin
while fastkeypressed do readkey;
fading;
mousehide;
loadscreen(loc_data()+'intro3',@screen);
soundeffect(loc_sound()+'explode3.sam',9500);
fadein;
mouseshow;
repeat
if mouse.getstatus then soundeffect(loc_sound()+'explode3.sam',9500);
until fastkeypressed;
stopmod;
fading;
closegraph;
halt(3);
end;
{$ENDIF}
procedure bossmode;
{type
texttype= array[0..24,0..79] of integer;}
var
{ textscreen: texttype absolute $B800:0000;
f: file of texttype;
s: string[13];}
temppal: paltype;
begin
{ mousehide;
compressfile(loc_tmp()+'current3',@screen);
//textmode(co80);
case random(2) of
0: begin
s:='boss1.dta';
gotoxy(2,3);
end;
1: begin
s:='boss2.dta';
gotoxy(10,25);
end;
end;
assign(f,loc_data()+s);
reset(f);
if ioresult<>0 then errorhandler('data/boss1.dta',1);
read(f,textscreen);
if ioresult<>0 then errorhandler('data/boss1.dta',5);
close(f);}
pausemod;
temppal[0,1]:=0; // to turn off warnings, variables are actually correctly initialized by function below
fillchar(temppal,sizeof(paltype),0);
set256colors(temppal);
repeat until (fastkeypressed) or (mouse.getstatus);
delay(150);
while fastkeypressed do begin
if (upcase(readkey_utf8) = '7') and (mouse.getstatus) then
begin
{$IFNDEF DEMO}
easteregg6;
{$ENDIF}
end;
end;
{ setgraphmode(0);
asm
mov ax, 0013h
int 10h
end; }
set256colors(colors);
continuemod;
{ loadscreen(loc_tmp()+'current3',@screen);
mouseshow;}
end;
procedure savepal;
var f: file of paltype;
begin
assign(f,loc_tmp()+'current.pal');
rewrite(f);
if ioresult<>0 then errorhandler(loc_tmp()+'current.pal',1);
write(f,colors);
if ioresult<>0 then errorhandler(loc_tmp()+'current.pal',5);
close(f);
end;
(*
procedure loadpaldbg;
begin
loadpal(loc_tmp()+'current.pal';);
set256colors(colors);
end;
procedure loopscale(startx,starty,sizex,sizey,newx,newy: word; var s,t);
var sety, py, pdy, px, pdx, dcx, dcy, ofsy: word;
begin
// asm
// push ds
// push es
// les si, [s] { es: si is our source location }
// mov [ofsy], si
// lds di, [t]
// imul di, [starty], 320
// mov [sety], di
// add di, [startx]
//
// mov ax, [sizex]
// xor dx, dx
// mov cx, [newx]
// div cx
// mov [px], ax
// mov [pdx], dx { set up py and pdy }
//
// mov ax, [sizey]
// xor dx, dx
// mov cx, [newy]
// div cx
// mov [py], ax
// mov [pdy], dx { set up py and pdy }
//
// xor cx, cx
// mov [dcx], cx
// mov [dcy], cx
//
// mov dx, [sizey]
//
//@@iloop:
// add cx, [py]
//
// mov ax, [pdy]
// add [dcy], ax
// mov ax, [newy]
// cmp ax, [dcy]
// jg @@nodcychange
//
// inc cx
// sub [dcy], ax
//
//@@nodcychange:
//
// cmp cx, [sizey]
// jb @@noloopy
// xor cx, cx
//
//@@noloopy:
//
// imul si, cx, 320
// add si, [ofsy]
//
// mov bx, [sizex]
//
// mov [dcx], 0
//
//@@jloop:
// add si, [px]
//
// mov ax, [pdx]
// add [dcx], ax
// mov ax, [newx]
// cmp ax, [dcx]
// jg @@nodcxchange
//
// inc si
// sub [dcx], ax
//
//@@nodcxchange:
//