-
Notifications
You must be signed in to change notification settings - Fork 43
/
CATACOMB.PAS
2270 lines (1919 loc) · 52.8 KB
/
CATACOMB.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
{ Catacomb Source Code
Copyright (C) 1993-2014 Flat Rock Software
This program 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 2 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
}
program Catacombs;
{$DEFINE SOUNDS}
{$DEFINE SAMPLER}
Uses
SPKlib,CTRlib,CGAscr,crt,dos,printer,CGAdata,EGAdata;
Const
maxpics = 2047;
numtiles = 24*24-1; {number of tiles displayed on screen}
numlevels = 10;
maxobj = 200; {maximum possible active objects}
solidwall = 129;
blankfloor = 128;
leftoff = 11;
topoff = 11;
tile2s = 256; {tile number where the 2*2 pictures start}
tile3s = tile2s+64*4;
tile4s = tile3s+19*9;
tile5s = tile4s+19*16;
lasttile = tile5s+19*25;
Type
soundtype = (nosnd,blockedsnd,itemsnd,treasuresnd,bigshotsnd,shotsnd,
tagwallsnd,tagmonsnd,tagplayersnd,killmonsnd,killplayersnd,opendoorsnd,
potionsnd,spellsnd,noitemsnd,gameoversnd,highscoresnd,leveldonesnd,
foundsnd);
thinktype = (playercmd,gargcmd,dragoncmd,ramstraight,ramdiag,straight,idle,fade);
tagtype = (benign,monster,pshot,mshot,nukeshot);
classtype = (nothing,player,goblin,skeleton,ogre,gargoyle,dragon,wallhit,
shot,bigshot,rock,dead1,dead2,dead3,dead4,dead5,dead6,teleporter,
torch,lastclass);
ActiveObj = Record
active : boolean; {if false, the object has not seen the player yet}
class : classtype;
x,y, {location of upper left corner in world}
stage, {animation frame being drawn}
delay:byte; {number of frames to pause without doing anything}
dir : dirtype; {direction facing}
hp : byte; {hit points}
oldx,oldy: byte; {position where it was last drawn}
oldtile : integer; {origin tile when last drawn}
filler : array [1..4] of byte; {pad to 16 bytes}
end;
objdesc = record {holds a copy of ActiveObj, and its class info}
active : boolean;
class : classtype;
x,y,stage,delay:byte;
dir : dirtype;
hp : shortint;
oldx,oldy: byte;
oldtile : integer;
filler1 : array [1..4] of byte; {pad to 16 bytes}
think : thinktype;
contact : tagtype;
solid : boolean;
firstchar : word;
size : byte;
stages : byte;
dirmask : byte;
speed : word;
hitpoints : byte;
damage : byte;
points : word;
filler2 : array [1..2] of byte; {pad to 32 bytes}
end;
{=================}
{ }
{ typed constants }
{ }
{=================}
Const
altmeters : array [0..13] of string[13] =
(#0#0#0#0#0#0#0#0#0#0#0#0#0,#190#0#0#0#0#0#0#0#0#0#0#0#0,
#190#192#0#0#0#0#0#0#0#0#0#0#0,#190#191#192#0#0#0#0#0#0#0#0#0#0,
#190#191#191#192#0#0#0#0#0#0#0#0#0,#190#191#191#191#192#0#0#0#0#0#0#0#0,
#190#191#191#191#191#192#0#0#0#0#0#0#0,#190#191#191#191#191#191#192#0#0#0#0#0#0,
#190#191#191#191#191#191#191#192#0#0#0#0#0,#190#191#191#191#191#191#191#191#192#0#0#0#0,
#190#191#191#191#191#191#191#191#191#192#0#0#0,#190#191#191#191#191#191#191#191#191#191#192#0#0,
#190#191#191#191#191#191#191#191#191#191#191#192#0,#190#191#191#191#191#191#191#191#191#191#191#191#193);
meters : array [0..13] of string[13] =
(#0#0#0#0#0#0#0#0#0#0#0#0#0,#194#0#0#0#0#0#0#0#0#0#0#0#0,
#194#196#0#0#0#0#0#0#0#0#0#0#0,#194#195#196#0#0#0#0#0#0#0#0#0#0,
#194#195#195#196#0#0#0#0#0#0#0#0#0,#194#195#195#195#196#0#0#0#0#0#0#0#0,
#194#195#195#195#195#196#0#0#0#0#0#0#0,#194#195#195#195#195#195#196#0#0#0#0#0#0,
#194#195#195#195#195#195#195#196#0#0#0#0#0,#194#195#195#195#195#195#195#195#196#0#0#0#0,
#194#195#195#195#195#195#195#195#195#196#2#0#0,#194#195#195#195#195#195#195#195#195#195#196#0#0,
#194#195#195#195#195#195#195#195#195#195#195#196#0,#194#195#195#195#195#195#195#195#195#195#195#195#197);
const
opposite: array[north..nodir] of dirtype=
(south,west,north,east,southwest,northwest,northeast,southeast,nodir);
{==================}
{ }
{ global variables }
{ }
{==================}
var
inpmode : (kbd,joy,mouse);
graphmode : (CGAgr,EGAgr,VGAgr); {video adapter to use}
playmode : (game,demogame,demosave,editor); {game / demo / editor}
gamexit : (quited,killed,reseted,victorious); {determines what to do after playloop}
exitsave: pointer; {old exit routine}
mouseok: boolean;
pics : pointer; {grab an entire segment for pics}
xormask : word; {each character drawn is EOR'd}
sx, sy, leftedge : integer; {0-39, 0-24 print cursor/return}
oldtiles : array [0..numtiles] of integer; {tile displayed last refresh}
Background : array [0..86,0..85] of integer; {base map}
View : array [0..86,0..85] of integer; {base map with objects drawn in}
originx, originy : integer; {current world location of UL corn}
priority : array [0..maxpics] of byte; {tile draw overlap priorities}
items : array [1..5] of integer;
shotpower : integer; {0-13 characters in power meter}
side : integer; {which side shots come from}
level : integer;
score: longint;
boltsleft: integer; {number of shots left in a bolt}
highscores : Array [1..5] of record
score : longint;
level : integer;
initials : Array [1..3] of char;
End;
o : array [0..maxobj] of activeobj; {everything that moves is here}
obj , altobj : objdesc; {total info about objecton and alt}
altnum : integer; {o[#] of altobj}
numobj,objecton : integer; {number of objects in O now}
ObjDef : array [nothing..lastclass] of Record
think : thinktype; {some of these sizes are for the}
contact : tagtype; {convenience of the assembly routines}
solid : boolean;
firstchar : word;
size : byte;
stages : byte;
dirmask : byte;
speed : word;
hitpoints : byte;
damage : byte;
points : word;
filler : array [1..2] of byte;
end;
i,j,k,x,y,z : integer;
playdone, leveldone: boolean;
tempb: boolean; tempp: pointer;
ch: char; altkey:boolean; {last key fetched by GET}
chkx,chky,chkspot: integer; {spot being checked by WALK}
regs: registers; {for INTR calls}
dir: dirtype;
button1, button2: boolean; {returned by playerIO}
democmds: array[0..3000] of byte; {bits 1-3=dir, 4=b1, 5=b2}
frameon: word;
grmem: pointer;
clvar: classtype;
packbuffer: array[0..4095] of byte;
{**************************************************************************}
{L VGAPALET.OBJ}
Procedure VGAPALET; {not realy a procedure, just data...}
begin
end;
{$L CATASM.OBJ}
{=========================================}
{ }
{ DRAWOBJ }
{ Draws the object to TILES in the proper }
{ direction and state. }
{ }
{=========================================}
Procedure DrawObj;
External;
Procedure EraseObj;
External;
Procedure DoAll;
External;
Procedure InitRnd (randomize:boolean);
External;
Function Random (maxval:word):WORD;
External;
Procedure WaitVBL;
External;
Procedure EGAmove;
External;
Procedure CGArefresh;
External;
Procedure EGArefresh;
External;
Procedure VGArefresh;
External;
Procedure CGAcharout (x,y,ch:integer);
external;
Procedure EGAcharout (x,y,ch:integer);
external;
Procedure VGAcharout (x,y,ch:integer);
external;
Function VideoID: integer;
external;
Procedure RLEexpand (source:pointer;dest:pointer;length:longint);
external;
Procedure RLEcompress (source:pointer;dest:pointer;length:longint);
external;
{==================================}
{ }
{ xxxCHAROUT }
{ Draw a single character at SX,SY }
{ in the various modes. }
{ }
{==================================}
Procedure CharOut (x,y,ch:integer);
{call proper charout based on GRMODE}
Begin
case graphmode of
CGAgr: CGAcharout (x,y,ch);
EGAgr: EGAcharout (x,y,ch);
VGAgr: VGAcharout (x,y,ch);
end;
End;
{======================================}
{ }
{ PLAYSOUND }
{ Starts a sound playing. Sounds play }
{ until they are through, then quit. }
{ }
{======================================}
Procedure PlaySound (soundnum: soundtype);
Begin
{$ifdef sounds}
if playmode<>demogame then {demo is allways silent}
PlaySound1 (integer(soundnum));
{$endif}
End;
{========================================}
{ }
{ GETGRMODE }
{ SHows the title page and gets graphic }
{ mode from user. }
{ }
{========================================}
Procedure GetGrMode;
var
screen: byte absolute $b800:0000;
gotmode: boolean;
source: pointer;
vidcard: integer;
Begin
{
; Subsystem ID values:
; 0 = (none)
; 1 = MDA
; 2 = CGA
; 3 = EGA
; 4 = MCGA
; 5 = VGA
; 80h = HGC
; 81h = HGC+
; 82h = Hercules InColor
;
}
regs.ax:=$0004;
intr($10,regs); {set graphic mode to 320*200 * 4 color}
source := @titlescr;
move (source^,screen,$4000);
vidcard:=VideoID;
gotmode := false;
ch:=upcase(readkey);
case ch of
'C': Begin
graphmode:=CGAgr;
gotmode:=true;
end;
'E': if (vidcard=3) or (vidcard=5) then
begin
graphmode:=EGAgr;
gotmode:=true;
end;
{$IFNDEF SAMPLER}
'V': if (vidcard=4) or (vidcard=5) then
begin
graphmode:=VGAgr;
gotmode:=true;
end;
{$ENDIF}
end;
if not gotmode then
begin
if (vidcard=3) or (vidcard=5) then
graphmode:=EGAgr
else
graphmode:=CGAgr;
end
end;
{=================================}
{ }
{ PRINT }
{ Prints the string to the screen }
{ at SX,SY. ']' does a return to }
{ LEFTEDGE. }
{ Automatically converts to lower }
{ case set for window drawing }
{ }
{=================================}
Procedure Print (s:string);
Var
i,cn:integer;
Begin
For i:=1 to length (s) do
If s[i]=']' then
Begin
sy:=sy+1;
sx:=leftedge; {return to left margin, and down a line}
End
Else
Begin
cn:=ord(s[i]);
if (cn>=ord('a')) and (cn<=ord('z')) then
cn:=cn-32;
charout (sx,sy,cn);
sx:=sx+1;
End;
End;
{====================}
{ }
{ SHORTNUM / LONGNUM }
{ PRINT's the number }
{ }
{====================}
Procedure ShortNum (i:integer);
Var
s: string [10];
e: integer;
Begin
str (i:1,s);
print (s);
End;
Procedure LongNum (i:longint);
Var
s: string [10];
e: integer;
Begin
str (i:1,s);
print (s);
End;
{==============================}
{ }
{ xxxREFRESH }
{ Refresh the changed areas of }
{ the tiles map in the various }
{ graphics modes. }
{ }
{==============================}
Procedure Refresh;
const
demowin : array[0..4] of string[16] =
(#14#15#15#15#15#15#15#15#15#15#15#15#15#15#15#16,
#17' --- DEMO --- '#18,
#17'SPACE TO START'#18,
#17'F1 TO GET HELP'#18,
#19#20#20#20#20#20#20#20#20#20#20#20#20#20#20#21);
var
x,y,basex,basey: integer;
underwin : array[0..4,0..15] of word;
Begin
basex:=originx+4;
basey:=originy+17;
if playmode=demogame then
for y:=0 to 4 do
for x:=0 to 15 do
begin
underwin[y,x]:=view[y+basey,x+basex];
view[y+basey,x+basex]:=word(demowin[y][x+1]) and $00ff;
end;
WaitVBL;
case graphmode of
CGAgr: CGArefresh;
EGAgr: EGArefresh;
VGAgr: VGArefresh;
end;
if playmode=demogame then
for y:=0 to 4 do
for x:=0 to 15 do
view[y+basey,x+basex]:=underwin[y,x];
waitVBL;
End;
Procedure SimpleRefresh;
Begin
WaitVBL;
case graphmode of
CGAgr: CGArefresh;
EGAgr: EGArefresh;
VGAgr: VGArefresh;
end;
end;
{======================================}
{ }
{ RESTORE }
{ Redraws every tile on the tiled area }
{ by setting oldtiles to -1. Used to }
{ erase any temporary windows. }
{ }
{======================================}
Procedure ClearOld;
Begin
fillchar (oldtiles,sizeof(oldtiles),chr($FF)); {clear all oldtiles}
end;
Procedure Restore;
Var
i,j:integer;
Begin
clearold;
SimpleRefresh;
End;
{===============================}
{ }
{ DRAWWINDOW }
{ Draws a window that will fill }
{ the given rectangle. The text}
{ area of the window DOES NOT }
{ go to the edge. A 3-D effect }
{ is produced. }
{ }
{===============================}
Procedure DrawWindow (left,top,right,bottom:integer);
Var
x,y:integer;
Begin
charout (left,top,14);
for x:=left+1 to right-1 do
charout (x,top,15);
charout (right,top,16);
for y:=top+1 to bottom-1 do
begin
charout (left,y,17);
for x:=left+1 to right-1 do
charout (x,y,32);
charout (right,y,18);
end;
charout (left,bottom,19);
for x:=left+1 to right-1 do
charout (x,bottom,20);
charout (right,bottom,21);
sx:=left+1;
leftedge:=sx;
sy:=top+1;
End;
{======================}
{ }
{ CENTERWINDOW }
{ Centers a drawwindow }
{ that can hold a TEXT }
{ area of width/height }
{======================}
Procedure CenterWindow (width,height:integer);
Var
x1,y1 : integer;
Begin
if width>2 then
centerwindow (width-2,height);
{ restore; }
WaitVBL;
x1:=11-width div 2;
y1:=11-height div 2;
DrawWindow (x1,y1,x1+width+1,y1+height+1);
End;
{==============}
{ }
{ ClearKeyDown }
{ }
{==============}
Procedure ClearkeyDown;
var
ch: char;
Begin
fillchar (keydown,sizeof(keydown),0);
while keypressed do
ch:=readkey;
end;
{================================}
{ }
{ GET }
{ Basic keyboard input routine }
{ returns upercase only. Cursor }
{ appears at SX,SY }
{ F keys are NOT handled }
{================================}
Procedure Get (var ch:char);
Var
cycle,direc,a:integer;
Begin
clearkeydown;
cycle:=10;
direc:=1;
While not Keypressed do
Begin
charout (sx,sy,cycle);
for a:=1 to 5 do
waitvbl;
cycle:=cycle+direc;
if cycle=14 then
Begin
direc:=-1;
cycle:=13;
end;
if cycle=9 then
Begin
direc:=1;
cycle:=10;
end
End;
charout (sx,sy,ord(' '));
altkey:=false;
ch:=upcase(readkey);
if ch=chr(0) then
begin
altkey:=true;
ch:=readkey;
end;
clearkeydown;
end;
{============================================}
{ }
{ INPUT }
{ Reads a string of LENGTH from the keyboard }
{ Cursor is displayed at SX,SY }
{ }
{============================================}
Procedure Input (var s:string; length:integer);
var
i:integer;
Begin
i:=1;
Repeat
get (ch);
if altkey or (ord(ch)=8) then
Begin
if (i>1) and ( (ord(ch)=75) or (not altkey)) then{backspace}
begin
dec(i);
sx:=sx-1;
end;
end
else
begin
if (ch>=' ') and (ch<chr(127)) and (i<=length) then
Begin
charout (sx,sy,ord(ch));
s[i]:=ch;
inc (i);
inc(sx);
end;
end;
if ch=chr(27) then
s[1]:=ch;
until (ch=chr(13)) or (ch=chr(27));
s[0]:=chr(i-1);
end;
{===========================}
{ }
{ CHECKKEYS }
{ If a key has been pressed }
{ it will be assigned to CH/}
{ altkey, and if it is an F }
{ key, it will be processed.}
{ }
{===========================}
procedure CheckKeys;
{ }
{ Help }
{ }
Procedure Help;
Var
x,y:integer;
Function Wantmore:boolean;
Begin
sx:=2;
sy:=20;
Print ('(SPACE for more/ESC)');
sx:=12;
sy:=21;
get (ch);
if ch=chr(27) then
wantmore:=false
else
wantmore:=true;
end;
{ }
{ DrawPic }
{ }
Procedure DrawPic(x,y:integer; c:classtype; dir:dirtype; stage:integer);
var
xx,yy,size,tilenum:integer;
Begin
size:=ObjDef[c].size;
tilenum:=ObjDef[c].firstchar+size*size
*((integer(dir) and ObjDef[c].dirmask)*ObjDef[c].stages+stage);
For yy:=y to y+size-1 do
for xx:=x to x+size-1 do
Begin
charout (xx,yy,tilenum);
inc(tilenum);
end;
End;
Begin
CenterWindow (20,20);
Print (' C A T A C O M B ]');
Print (' - - - - - - - ]');
Print (' By John Carmack & ]');
Print (' PC Arcade ]');
Print (']');
Print ('F1 = Help ]');
Print ('F2 = Sound on / off ]');
Print ('F3 = Controls ]');
Print ('F4 = Game reset ]');
Print ('F9 = Pause ]');
Print ('F10= Quit ]');
Print (']');
Print ('Watch the demo for ]');
Print ('a play example. ]');
Print (']');
Print ('Hit fire at the demo]');
Print ('to begin playing. ]');
if not Wantmore then
exit;
CenterWindow (20,20);
Print (']Keyboard controls: ]]');
Print ('Move : Arrows ]');
Print ('Button1 : Ctrl ]');
Print ('Button2 : Alt ]');
Print (']To switch to mouse ]');
Print ('or joystick control,]');
Print ('hit F3. ]');
if not Wantmore then
exit;
CenterWindow (20,20);
Print ('Button 1 / CTRL key:]');
Print ('Builds shot power. ]');
Print ('If the shot power ]');
Print ('meter is full when ]');
Print ('the button is ]');
Print ('released, a super ]');
Print ('shot will be ]');
Print ('launched. ]');
Print (']');
For y:=11 to 18 do
For x:=3 to 20 do
Charout (x,y,128);
DrawPic (4,14,player,east,2);
DrawPic (19,15,shot,east,1);
DrawPic (17,14,shot,east,0);
DrawPic (15,15,shot,east,1);
DrawPic (8,14,bigshot,east,0);
if not Wantmore then
exit;
CenterWindow (20,20);
Print ('Button 2 / ALT key:]');
Print ('Allows you to move ]');
Print ('without changing the]');
Print ('direction you are ]');
Print ('facing. Good for ]');
Print ('searching walls and ]');
Print ('fighting retreats. ]');
For y:=11 to 18 do
For x:=3 to 20 do
if y=15 then
charout (x,y,129)
else if y=16 then
charout (x,y,131)
else
charout (x,y,128);
DrawPic (6,13,player,south,2);
sx:=6;
sy:=15;
print (#29#29#30#30#31#31);
if not Wantmore then
exit;
CenterWindow (20,20);
Print ('"P" or "SPACE" will ]');
Print ('take a healing ]');
Print ('potion if you have ]');
Print ('one. This restores ]');
Print ('the body meter to ]');
Print ('full strength. Keep]');
Print ('a sharp eye on the ]');
Print ('meter, because when ]');
Print ('it runs out, you are]');
Print ('dead! ]]');
Print ('"B" will cast a bolt]');
Print ('spell if you have ]');
Print ('any. You can mow ]');
Print ('down a lot of ]');
Print ('monsters with a bit ]');
Print ('of skill. ]');
if not Wantmore then
exit;
CenterWindow (20,20);
Print ('"N" or "ENTER" will ]');
Print ('cast a nuke spell. ]');
Print ('This usually wipes ]');
Print ('out all the monsters]');
Print ('near you. Consider ]');
Print ('it a panic button ]');
Print ('when you are being ]');
Print ('mobbed by monsters! ]]');
Print (' '#128#128#128']');
Print ('Potions: '#128#162#128']');
Print (' '#128#128#128']');
Print ('Scrolls: '#128#163#128']');
Print (' (bolts/nukes) '#128#128#128']');
Print ('Treasure: '#128#167#128']');
Print (' (points) '#128#128#128']');
Print (' '#128#128#128']');
if not Wantmore then
exit;
End;
{ }
{ SoundChange }
{ }
Procedure SoundChange;
label
select;
Begin
CenterWindow (15,1);
Print ('Sound: ]');
select:
sx:=11;
sy:=12;
if soundon then
xormask:=$FFFF
else
xormask:=0;
Print (' ON ');
xormask:=xormask xor $FFFF;
Print (' OFF ');
xormask:=0;
sx:=10;
Get (ch);
if altkey and ( (ord(ch)=75) or (ord(ch)=77) ) then
Begin
soundon:=not soundon;
goto select;
end
end;
{ }
{ InputChange }
{ }
Procedure InputChange;
label
switch;
var
oldmode: integer;
procedure calibrate;
var
xl,yl,xh,yh,ox,dx,dy: integer;
begin
restore;
centerwindow (20,9);
Print ('Joystick calibration]');
Print ('--------------------]');
Print ('Push the joystick to]');
Print ('the UPPER LEFT and]');
ox:=sx+10;
Print ('hit fire:(');
Repeat
sx:=ox;
Rd_Joy (1,xl,yl);
shortnum (xl);
print (',');
shortnum (yl);
print (') ');
Rd_Joystick1 (dir,button1,button2);
until keypressed or button1 or button2;
while button1 or button2 do
Rd_Joystick1 (dir,button1,button2);
Print (']]Push the joystick to]');
Print ('the LOWER RIGHT and]');
Print ('hit fire:(');
Repeat
sx:=ox;
Rd_Joy (1,xh,yh);
shortnum (xh);
print (',');
shortnum (yh);
print (') ');
Rd_Joystick1 (dir,button1,button2);
until keypressed or button1 or button2;
while button1 or button2 do
Rd_Joystick1 (dir,button1,button2);
dx:=(xh-xl) div 4;
dy:=(yh-yl) div 4;
joy_xlow:=xl+dx;
joy_xhigh:=xh-dx;
joy_ylow:=yl+dy;
joy_yhigh:=yh-dy;
end;
Begin
oldmode:=ord(inpmode);
CenterWindow (15,5);
Print ('Player Control:]]');
switch:
sx:=leftedge;
sy:=12;
if inpmode=kbd then
xormask:=$FFFF
else
xormask:=0;
Print (' KEYBOARD ]');
if inpmode=joy then
xormask:=$FFFF
else
xormask:=0;
Print (' JOYSTICK ]');
if inpmode=mouse then
xormask:=$FFFF
else
xormask:=0;
Print (' MOUSE ]');
xormask:=0;
sx:=12;
sy:=11;
Get (ch);
if altkey and ( (ord(ch)=80) or (ord(ch)=77) ) then
Begin
if inpmode=mouse then
inpmode:=kbd
else
inpmode:=succ(inpmode);
goto switch;
end;
if altkey and ( (ord(ch)=72) or (ord(ch)=75) ) then
Begin
if inpmode=kbd then
inpmode:=mouse
else
inpmode:=pred(inpmode);
goto switch;
end;
if inpmode=mouse then
Begin
if not mouseok then
begin
playsound (blockedsnd);
goto switch;
end;
regs.ax:=0;
intr($33,regs); {initialize the mouse}
end;
if (inpmode=joy) { and (oldmode<>ord(joy)) } then
calibrate;
end;
{ }
{ Reset }
{ }
Procedure Reset;
Begin
CenterWindow (18,1);
Print ('Reset game (Y/N)?');
Get (ch);
if ch='Y' then
Begin