Modifying software to compile with the Free Pascal compiler and run on modern systems...
[supernova.git] / src / NOVA.PAS
1 {//-------------------------------------------------------------------------}\r
2 {/*                                                                         }\r
3 {Copyright (C) 2014 Jason Self <j@jxself.org>                               }\r
4 {                                                                           }\r
5 {This file is free software: you may copy, redistribute and/or modify it    }\r
6 {under the terms of the GNU Affero General Public License as published by   }\r
7 {the Free Software Foundation, either version 3 of the License, or (at your }\r
8 {option) any later version.                                                 }\r
9 {                                                                           }\r
10 {This file is distributed in the hope that it will be useful, but WITHOUT   }\r
11 {ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      }\r
12 {FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License}\r
13 {for more details.                                                          }\r
14 {                                                                           }\r
15 {You should have received a copy of the GNU Affero General Public License   }\r
16 {along with this program; if not, see https://gnu.org/licenses or write to: }\r
17 {  Free Software Foundation, Inc.                                           }\r
18 {  51 Franklin Street, Fifth Floor                                          }\r
19 {  Boston, MA 02110-1301                                                    }\r
20 {  USA                                                                      }\r
21 {                                                                           }\r
22 {This file incorporates work covered by the following copyright and         }\r
23 {permission notice:                                                         }\r
24 {                                                                           }\r
25 {Copyright (C) 1990, 2009 - Apogee Software, Ltd.                           }\r
26 {                                                                           }\r
27 {This file is part of Supernova.  Supernova is free software; you can       }\r
28 {redistribute it and/or modify it under the terms of the GNU General Public }\r
29 {License as published by the Free Software Foundation; either version 3     }\r
30 {of the License, or (at your option) any later version.                     }\r
31 {                                                                           }\r
32 {This program is distributed in the hope that it will be useful,            }\r
33 {but WITHOUT ANY WARRANTY; without even the implied warranty of             }\r
34 {MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                       }\r
35 {                                                                           }\r
36 {See the GNU General Public License for more details.                       }\r
37 {                                                                           }\r
38 {You should have received a copy of the GNU General Public License          }\r
39 {along with this program; if not, see https://gnu.org/licenses or write to: }\r
40 {  Free Software Foundation, Inc.                                           }\r
41 {  51 Franklin Street, Fifth Floor                                          }\r
42 {  Boston, MA 02110-1301                                                    }\r
43 {  USA                                                                      }\r
44 {                                                                           }\r
45 {Original Source: 1990 Scott Miller                                         }\r
46 {Prepared for public release: 03/19/09 - Joe Siegler, Apogee Software, Ltd. }\r
47 {*/                                                                         }\r
48 {//-------------------------------------------------------------------------}\r
49 (****************************************************************************)\r
50 (*                             SUPERNOVA VERSION B                          *)\r
51 (*     >> This file contains the special room routines for Supernova <<     *)\r
52 (*                         Programmer: Scott Miller                         *)\r
53 (*                       << Began February 2, 1985 >>                       *)\r
54 (*                       Copyright 1985 Scott Miller                        *)\r
55 (****************************************************************************)\r
56 \r
57 {$C-,R-,V-,S-}\r
58 {$IFDEF UNIX}\r
59 uses ncurses,ocrt,sysutils,SDL;\r
60 {$ELSE}\r
61 uses crt,sysutils,SDL;\r
62 {$ENDIF}\r
63 \r
64 const\r
65    VMax    = 95;     { Verbs   }\r
66    NMax    = 133;    { Nouns   }\r
67    PMax    = 11;     { Preps   }\r
68    AMax    = 4;      { Adverbs }\r
69    TMax    = 30;     { Timers  }\r
70    RMax    = 109;    { Rooms   }\r
71    MMax    = 29;     { Mov's   }\r
72    Null    = 0;\r
73    Legal   = 255;\r
74    audio_FREQ    = 22050;  { SDL Audio parameters }\r
75    audio_SAMPLES = 512;\r
76    audio_STEP    = 16;\r
77    audio_VOLUME  = 24;\r
78    audio_MAXENTRIES = 50000;\r
79 \r
80 type\r
81    Str1    = string[1];\r
82    Str9    = string[9];\r
83    Str19   = string[19];\r
84    Str29   = string[29];\r
85    Str53   = string[53];\r
86    Str77   = string[77];\r
87    Str78   = string[78];\r
88    Str130  = string[131];\r
89    Str234  = string[234];\r
90    Str255  = string[255];\r
91    {Entr    = record AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags:integer;end;}\r
92 {$IFNDEF UNIX}\r
93    TWindow = record x,y,x1,y1:integer;end;\r
94    PWin    = ^TWindow;\r
95 {$ENDIF}\r
96    LSet    = set of 1..NMax;\r
97    SaveSet = record\r
98               aInv    : set of 1..MMax;\r
99               aPStat  : set of 1..6;\r
100               aEvents : set of 1..255;\r
101               aSocket,\r
102               aWear   : set of 1..MMax\r
103              end;\r
104 \r
105 var\r
106    buflen  : byte;\r
107    sound_i,\r
108    sound_play   : integer;\r
109    sound_Freqs  : array [0..audio_MAXENTRIES] of Integer;\r
110    sound_supported,\r
111    speaker_on   : boolean;\r
112    lasttime,  \r
113    sound_ticks  : UInt32;\r
114    lastfreq,\r
115    current_freq : Real;\r
116    win1,win2,\r
117    stdscr  : pwin;\r
118    UTF8Scr : boolean;\r
119 {$IFNDEF UNIX}\r
120    win_arr : array [1..3] of TWindow;\r
121 {$ENDIF}\r
122    SetSave : SaveSet;\r
123    Sets    : file of SaveSet;\r
124    Objects : file of LSet;\r
125    Things  : file of byte;\r
126    Timers  : file of integer;\r
127    V{erb}  : array [1..VMax] of Str29;\r
128    N{oun}  : array [1..NMax] of Str29;\r
129    P{rep}  : array [1..PMax] of Str29;\r
130    A{dvb}  : array [1..AMax] of Str53;\r
131    RN{ame} : array [1..RMax]   of Str19;{ Name of each room stored here.      }\r
132    R{oom}  : array [1..MMax] of byte;   { Knows which room a Mov object is in.}\r
133    L{ocate}: array [0..RMax] of LSet;   { Locates all non-Mov objects.        }\r
134    T{imer} : array [1..TMax] of integer;\r
135    Dir     : array [1..8]    of Str9;\r
136    M{max}  : array [1..3]    of byte;    {******************}\r
137    PStat        : set of 1..6;           {* Player Status: *}\r
138    NoNounOnly   : set of 1..VMax;        {* [] = Healthy   *}\r
139    OneNounMaybe : set of 1..VMax;        {*  2 = Hungry    *}\r
140    ToNounOnly   : set of 1..VMax;        {*  3 = Sick      *}\r
141    ToNounMaybe  : set of 1..VMax;        {*  4 = Injured   *}\r
142    Events       : set of 1..255;         {*  5 = Tired     *}\r
143    Mov{able objects},                    {*  6 = Thirsty   *}\r
144    Inv{ventory},                         {******************}\r
145    Socket,\r
146    Wear         : set of 1..MMax;\r
147    Brief        : set of 1..RMax;\r
148    NounSet      : set of 1..NMax;\r
149    MugCon,         { All -Con variables are containers. }\r
150    FoodCon,\r
151    SatchCon,\r
152    HolstCon,\r
153    NicheCon,\r
154    PyraCon,\r
155    HingeCon,\r
156    PodumCon,\r
157    RobotCon,\r
158    CodeSet,\r
159    ScrnSet,\r
160    Vb,\r
161    N1,\r
162    N2,\r
163    Pr,\r
164    Md,\r
165    VNP,\r
166    Prm,      { Player Room }\r
167    EFlag,    { Error Flag  }\r
168    FFlag,    { Format Flag }\r
169    TFlag,    { Timer Flag  }\r
170    list,\r
171    Num,\r
172    Region,   { Knows what room to go in when exiting the player's ship }\r
173    AlienRm,\r
174    FriendRm,\r
175    SinkRm,\r
176    Serum,    { Begins at zero, dispenser jams at 2! }\r
177    Weight,\r
178    Old,      { for Block Reader }\r
179    Old2,\r
180    x,y,o   : byte;\r
181    xi,yi   : integer;\r
182    Code,     { dials, etc }\r
183    Tic,\r
184    StoreR,   { Knows if the previous Room that was read is the same as the  }\r
185    StoreS,   { Room that is about to be read.  If so, then it simply writes }\r
186    StoreL,   { that variable again! }\r
187    StoreC,\r
188    RC,       { Endless Room Counter }\r
189    Sc,       { Score       }\r
190    TestC,\r
191    Floor,\r
192    i,j     : integer;\r
193    Input,\r
194    Again,\r
195    Line    : Str130;\r
196    Text1,\r
197    Text2,\r
198    Text4   : Str234;\r
199    Text3   : Str78;\r
200    Text5   : Str77;\r
201    R1,R2,S1: file of Str234;\r
202    L1      : file of Str78;\r
203    C1      : file of Str77;\r
204    T1,T2   : Text;\r
205    Identity,\r
206    VStr,\r
207    NStr,\r
208    PStr,\r
209    LastNoun,\r
210    Word    : Str29;\r
211    {Result  : Entr;}\r
212    Drive,\r
213    Log,\r
214    CFlag   : char;\r
215    Maze,\r
216    Crawl,\r
217    Color,\r
218    QFlag,\r
219    SFlag   : boolean;  { If TRUE then a Special action took place. }\r
220 {----------}\r
221 \r
222 {$I ADPAR.pas   <<<<<------  LOADS IN MANY PARSER COMMANDS  ***************}\r
223 \r
224 procedure Describe(Room:byte);\r
225  begin\r
226   col(9,9);write(RN[Prm]);col(11,7);writeln;\r
227   if(en(1))or(not(en(1))and not(Prm in Brief))then\r
228    begin Brief:=Brief+[Prm];\r
229     case Prm of   { Alternate Room Descriptions }\r
230      29:if en(35) then begin RS(130);RS(131)end else RR(29);\r
231      34:if en(30) then begin RS(81);RS(82)end else RR(34);\r
232      52:if en(39) then RS(126)else RR(52);\r
233      91:if en(51) then begin RS(157);RS(158)end else RR(91)\r
234      else RR(Room)\r
235     end;\r
236    end;\r
237   case Prm of     { For initial object's description }\r
238     1:if 16 in L[1] then RL(150);\r
239    107:if 19 in L[107] then RL(518);\r
240    38:if 17 in L[38] then RL(260);\r
241    41:if(18 in L[41])and not en(34)then RS(96);\r
242    55:if 11 in L[55] then RL(290);\r
243    63:if 20 in L[63] then RL(356);\r
244    73:if 28 in L[73] then RL(352);\r
245    80:if 17 in L[80] then RL(395);\r
246    94:begin if 26 in L[94] then RL(397);if 2 in L[94] then RL(398)end;\r
247   end;\r
248   for o:=1 to MMax do  { Print the objects that are lying in the room }\r
249    if r[o]=Prm then\r
250     begin\r
251      if o=6 then write('There is some ',FN(o),' here.')\r
252      else\r
253       begin Word:=FN(o);\r
254        if Word[1] in['a','e','i','o','u']then\r
255         write('There is an ',FN(o),' here.')else\r
256         write('There is a ',FN(o),' here.')\r
257       end;\r
258      if((o=29)and(MugCon<>Null))or((o=7)and(HolstCon<>Null))or\r
259        ((o=5)and(SatchCon<>Null))then write('  (with something in it)');\r
260      if(o=5)and(R[5]=20)then write('  (lying in some trash)');\r
261      if(o=7)and(7 in L[12])and(R[7]=12)then write('  (on the shelf)');\r
262      if o=NicheCon then write('  (on the niche)');\r
263      if(en(6))and(o=16)then write('  (on the seat)');\r
264      if o=PyraCon then write('  (in the pyramid''s slot)');\r
265      if o=HingeCon then write('  (inside the statue''s mouth)');\r
266      if o=PodumCon then write('  (on top of the podium)');\r
267      if(o=16)and en(37)then write('  (under the crystal)');\r
268      if o=RobotCon then write('  (in the robot''s panel)');\r
269      if o in Socket then write('  (in one of the regulator''s sockets)');\r
270      writeln;\r
271     end;\r
272  end; { Describe }\r
273 \r
274 procedure Move(New:byte);\r
275  begin SF;\r
276   if en(7) then RL(22) else\r
277   if en(8) then RL(23) else\r
278   begin\r
279    if(MugCon<>Null)and(29 in Inv)then\r
280     begin if Prm<>8 then L[Prm]:=L[Prm]-[MugCon];L[New]:=L[New]+[MugCon]end;\r
281    if(SatchCon<>Null)and(5 in Inv)then\r
282     begin L[Prm]:=L[Prm]-[SatchCon];L[New]:=L[New]+[SatchCon]end;\r
283    if(HolstCon<>Null)and(7 in Inv)then\r
284     begin L[Prm]:=L[Prm]-[HolstCon];L[New]:=L[New]+[HolstCon]end;\r
285    Prm:=New;\r
286    Describe(Prm);\r
287   end\r
288  end; { Move }\r
289 \r
290 \r
291 {$I VOCAB.pas    <<<<<-------  Loads in VOCABULARY LIST  **********}\r
292 \r
293 \r
294 {****************************** ROOM ROUTINES *******************************}\r
295 procedure Room1;   { The Player's Ship }\r
296 begin\r
297 case Prm of\r
298  1:case Vb of  { Bridge }\r
299    2,13:Door(2,50);\r
300    11:RL(199);\r
301    22,24,28:case N1 of\r
302         37,38,55,44:if Md<>Null then RL(534)else RB(3,11);103:RL(317);\r
303         35:if en(6)then RL(542)else RL(543);\r
304         59:case Region of\r
305             1:RS(46);\r
306             2:RS(63);\r
307             4:RS(T[9]+46);\r
308            end\r
309        end;\r
310    35:if N1 in[16,35] then\r
311        if(here(16))and(en(6))then\r
312         if not en(4) then\r
313          begin Add(7);sound(440);RS(19);T[6]:=4;for x:=1 to random(30)+9 do\r
314           begin y:=random(6000)+60;play(y,y,70);delay(9)end;Score(10,67)\r
315          end\r
316         else begin Add(7);RL(149); for x:=1 to random(9)+9 do\r
317             begin y:=random(9999);play(y,y,30);delay(55)end;end\r
318        else RL(141);\r
319    56:if en(7)and en(6)then\r
320        if T[6]>0 then\r
321         if input=Identity then\r
322          begin RS(21);T[6]:=Null;Score(15,4);play(400,400,200)end\r
323         else RL(142)\r
324        else\r
325         if input='r2/20-8 d2/vega' then\r
326          if not(Region in[2,4]) then\r
327           begin RS(28);Add(26);Min(27);play(600,600,99)end\r
328          else RL(154)\r
329         else\r
330          begin Min(26);RS(39);Min(27);play(600,600,99)end\r
331        else RL(179);\r
332    44:if en(7)and en(6)then\r
333        case N1 of\r
334         43:begin play(750,750,200);  { Purple }\r
335             if Region=4 then\r
336              if T[9]=11 then begin Score(5,68);Region:=2;T[13]:=3;TFlag:=2;\r
337               n[126]:='hinged mouth\mouth\hinge\';\r
338               RB(9,11);Explode(30)end\r
339              else RS(64)\r
340             else RL(198)\r
341            end;\r
342         40:begin play(900,900,200);  { Cyan }\r
343             if en(26) then begin RS(37);Add(27)end\r
344             else RL(195)\r
345            end;\r
346         41:begin play(600,600,200);  { Tan }\r
347             if en(27) then\r
348              if not(en(22))and not(en(23))then\r
349               begin col(28,23);RL(180);col(11,7);\r
350                RS(38);T[8]:=7;\r
351                for x:=1 to 6 do\r
352                 for y:=30 to 200 do begin sound(y);delay(5)end;nosound;\r
353               end\r
354              else begin RS(40);play(500,999,3);Min(26);Min(27)end\r
355             else if en(26)then RL(184)else RL(185)\r
356            end;\r
357        end {case}\r
358       else RL(179);\r
359    39:if(16 in NounSet)and en(6)then\r
360        if en(7)then RL(575)else begin Min(6);RL(145);SFlag:=false;end;\r
361    end; {Vb}\r
362  end; {main case}\r
363 end; { Room1 }\r
364 {----------}\r
365 procedure Room2;   { The Player's Ship }\r
366 begin\r
367 case Prm of\r
368  2:case Vb of  { Forward Corridor }\r
369    9,13,51:if(n1 in[0,62,64,71])then\r
370      if en(23) then begin RL(237);case Region of 1:move(22);2:move(24);end end\r
371      else RL(99);\r
372    1,11:Door(1,50);\r
373    2:move(3);\r
374    4:move(4);\r
375    24,28:if NStr='hatch' then if en(23) then RL(163)else RL(99);\r
376    50:if N1=78 then\r
377        if en(22)then begin RL(160);Min(22)end else\r
378         begin RL(161);Add(22);\r
379          if T[8]>0 then begin RS(40);play(500,999,3);T[8]:=0;Min(27)end end;\r
380    41:if NStr='hatch' then\r
381        if Region<>4 then\r
382         if en(22) then\r
383          begin RL(96);Add(23);\r
384           if(not en(44))and(Region=2)then\r
385            begin Add(44);RL(327);for i:=1 to 400 do sounddelayed(random(3500)+999);\r
386             for i:=7500 downto 500 do begin sounddelayed(random(i)+i);\r
387              sounddelayed(random(3500)+2000)end;\r
388             for i:=1 to 300 do sounddelayed(random(3500)+2500);nosound;\r
389            end\r
390          end\r
391         else RL(97)\r
392        else begin RS(45);DEAD end;\r
393    53:if N1=56 then\r
394        if en(23) then begin RL(98);Min(23)end else say('hatch','closed');\r
395    end; {Vb}\r
396 \r
397  3:case Vb of  { Rear Corridor }\r
398    1,13:move(2);\r
399    3:move(6);\r
400    4:move(7);\r
401    28,31:if N1 in[55,81] then begin RB2(4,12);Pause;end;\r
402    24,41,76:if N1=55 then if Md in[1,4]then RL(533)else begin RS(22);DEAD;end;\r
403    end; {Vb}\r
404  end; {main case}\r
405 end; { Room2 }\r
406 {----------}\r
407 procedure Room3;   { The Player's Ship }\r
408 begin\r
409 case Prm of\r
410 \r
411  4:case Vb of  { Ship's Lab }\r
412    3,13:move(2);\r
413    28,22:case N1 of\r
414           90:RS(23); 52:RS(26); 38:RS(27); 55:RS(31);\r
415           81,119:begin RB(10,14);Pause;end;\r
416           64:if NicheCon<>Null then\r
417               writeln('There is a ',FN(NicheCon),' sitting on the niche.')\r
418              else RL(152);\r
419          end;\r
420    31:if N1 in[81,119] then begin RB(10,14);Pause;end;\r
421    41..44,88:if N1=55 then RL(174);\r
422    33:if N2=64 then\r
423        if N1 in[3,4,8,9,12,17,29] then\r
424         if Pr in[1,5,10] then\r
425          if NicheCon=Null then\r
426           begin Van(N1);R[N1]:=4;NicheCon:=N1;RL(147)end\r
427          else RL(148)\r
428         else crazy\r
429        else RL(146);\r
430    54:if N1 in[38,90]then begin RL(321);Serum:=1;end;\r
431    56:begin Serum:=Serum+1;\r
432        if Serum<3 then\r
433         if NicheCon=Null then RS(24)\r
434         else if NicheCon<>29 then\r
435          writeln('A small amount of serum drips onto the ',FN(NicheCon),' and ',\r
436                   'dries up.')\r
437          else\r
438           if MugCon=Null then begin MugCon:=92;RS(25);L[4]:=L[4]+[92];\r
439            if input='6' then Add(42)else Min(42)end\r
440           else\r
441            if MugCon in[79,92,99] then\r
442             writeln('The serum mixes with the ',FN(MugCon),' inside the mug.')\r
443            else\r
444             writeln('The serum drips on the ',FN(MugCon),' inside the mug and',\r
445                     ' quickly evaporates.')\r
446        else RS(135)\r
447       end; {type}\r
448 \r
449    end; {Vb}\r
450 \r
451  5:case Vb of  { Sanitary Facilities }\r
452    2,13:move(6);\r
453    22,28:if N1=98 then RL(122);\r
454    end; {Vb}\r
455 \r
456  6:case Vb of  { Sleep Chamber }\r
457    1,11:move(5);\r
458    4,13:move(3);\r
459    28:case N1 of 80:RL(159); 69:RS(29) end;\r
460    51:if N1=69 then Vb:=35;\r
461    end; {Vb}\r
462 \r
463  7:case Vb of  { Cargo Area }\r
464    3,13:move(3);\r
465    22,28:if N1=32 then RL(155);\r
466    24:if N1=32 then RL(156);\r
467    41,53:if N1=32 then RL(157);\r
468    39:if 32 in NounSet then RL(158);\r
469    end; {Vb}\r
470 \r
471  end; {main case}\r
472 end; { Room3 }\r
473 {----------}\r
474 procedure Room4;   { The Tavern }\r
475 begin\r
476 case Prm of\r
477  8:case Vb of  { Tavern }\r
478    2,13:if en(7)then RL(22)else begin RL(93);move(13)end;\r
479    3,9,11,51:if en(7)then RL(22)\r
480        else if(N1 in[null,71])then begin RL(283);move(9)end\r
481        else if N1=126 then RL(473);\r
482    31:if N1 in[81,119]then RB(2,9);\r
483    35:case N1 of\r
484       83:if T[1] in[4..7,11..17] then RS(8) else begin Add(19);Add(7);RL(30)end;\r
485       35,84,85:begin Add(7);RL(30);if N1 in[35,84] then Add(2)else Min(2)end;\r
486       end;\r
487    65:if N1=124 then\r
488        if en(2) then\r
489         if T[1] in[5..7,11..18] then\r
490          if(md=1)or(en(18))then begin RL(31);Score(20,3);\r
491           if not en(18)then begin Add(18);T[1]:=8;end end\r
492          else RL(32)\r
493         else RL(41)\r
494        else RL(33);\r
495    28:case N1 of 56:RL(371);81,119:RB(2,9);111:RL(44)end;\r
496    41:if N1=56 then RL(394);\r
497    39:if(29 in NounSet)and not en(21)then RL(86);\r
498    54,93:if N1=111 then begin RS(32);DEAD;end;\r
499    42,44,75:if N1=111 then RL(474);\r
500    59:if N1=126 then RL(473);\r
501    20:if N1=126 then RL(178);\r
502    end; {Vb}\r
503 \r
504  9:case Vb of  { West Hallway }\r
505    1,2:RL(89);\r
506    3,11:move(10);\r
507    28:if N1=56 then RL(92);\r
508    4,10,13,51:if(n1 in[null,71])then begin RL(284);move(8)end;\r
509    54:if(N1=56)and(T[1]<1)then RS(13)else RL(123);\r
510    41,88:if N1=56 then\r
511           case N2 of 0:RL(107);3:RL(101)else RL(137)end;\r
512    end; {Vb}\r
513 \r
514 10:case Vb of  { Central Hallway }\r
515    1:RL(89);\r
516    4,13:move(9);\r
517    3:move(11);\r
518    28:if N1=56 then if en(11)then RL(370)else RL(92);\r
519    2,11:if en(11) then begin RL(90);Score(5,69);move(12);Min(11)end\r
520         else RL(89);\r
521    41,88:if N1=56 then case N2 of 0:RL(107);3:begin;end else RL(137)end;\r
522    54:if N1=56 then RL(123);\r
523    end; {Vb}\r
524 \r
525 11:case Vb of  { East Hallway }\r
526    1,2:RL(89);\r
527    4,13:move(10);\r
528    28:if N1=56 then RL(92);\r
529    41,88:if N1=56 then\r
530           case N2 of 0:RL(107);3:RL(101)else RL(137)end;\r
531    54:if N1=56 then RL(123);\r
532    53:if N1=56 then begin RL(92);Min(11)end;\r
533    end; {Vb}\r
534 \r
535 12:case Vb of  { Suite #4 }\r
536    1,13:if en(7)then RL(22)else\r
537         if en(11) then begin RL(91);move(10);Min(11)end else RL(92);\r
538    41,88:if N1=56 then begin RL(104);Add(11)end;\r
539    22,28,76:\r
540       case N1 of\r
541        56:if en(11)then RL(370)else RL(92);\r
542        80:if Md<>Null then RL(535)else RL(536);\r
543        87:if 7 in L[12] then begin RL(106);R[7]:=12;Score(5,24)end;\r
544        98:RL(121);\r
545       end;\r
546    53:if N1=56 then begin RL(92);Min(11)end;\r
547    39:if(7 in NounSet)or(30 in NounSet)then Score(5,24);\r
548    end; {vb}\r
549 \r
550  end; {main case}\r
551 end; { Room4 }\r
552 {----------}\r
553 procedure Room5;   { Barre-An Planet }\r
554  procedure Zap; begin for x:=1 to 29 do if R[x]=Prm then Van(x) end;\r
555 begin\r
556 case Prm of\r
557 13:case Vb of  { Crossroads }\r
558    1,11:if en(7)then RL(22)else begin RL(93);move(8)end;\r
559    2:move(18);\r
560    3:move(16);\r
561    4:move(14);\r
562    28,31:if N1 in[81,88] then begin Score(5,70);RB2(5,6);Pause;end;\r
563    41:if N1=56 then RL(394);\r
564    end; {Vb}\r
565 \r
566 14:case Vb of  { Dusty Road }\r
567    3:move(13);\r
568    4:begin RC:=1;move(15)end;\r
569    end; {Vb}\r
570 \r
571 15:case Vb of  { Dusty Road (endless) }\r
572    3:begin Zap;RC:=RC-1;if RC<1 then move(14)else move(15)end;\r
573    4:begin Zap;RC:=RC+1;move(15);if RC=40 then\r
574       writeln('You notice something unusual.')end;\r
575    11,13:if RC=40 then begin RL(135);Explode(3);play(1,9999,0);play(9999,1,0);\r
576           walls(10);Explode(5);TFlag:=4;Inv:=[1,6,12,17,20,26,28,29];move(78);\r
577           T[3]:=120;T[4]:=120;T[5]:=120;PStat:=[];MugCon:=79;Bor(0,0)end;\r
578    end; {Vb}\r
579 \r
580 16:case Vb of  { Gravel Road }\r
581    2,11:begin RL(108);move(20)end;\r
582    3:begin RC:=1;move(17)end;\r
583    4:move(13);\r
584    28,31:if N1=81 then RL(109);\r
585    end; {Vb}\r
586 \r
587 17:case Vb of  { Gravel Road (endless) }\r
588    3:begin Zap;RC:=RC+1;if(RC=80)and(Inv<>[])then\r
589        begin move(17);RS(17);Inv:=[];end\r
590       else move(17)end;\r
591    4:begin Zap;RC:=RC-1;if RC<1 then move(16)else move(17)end;\r
592    end; {Vb}\r
593 \r
594 18:case Vb of  { Paved Road }\r
595    1:move(13);\r
596    2:begin RC:=1;move(19);end;\r
597    4,11:move(21);\r
598    end; {Vb}\r
599 \r
600 19:case Vb of  { Paved Road (endless) }\r
601    1:begin Zap;RC:=RC-1;if RC<1then move(18)else move(19)end;\r
602    2:if RC=60 then RS(18) else begin Zap;RC:=RC+1;move(19)end;\r
603    end; {Vb}\r
604 \r
605 20:case Vb of  { General Store }\r
606    1,13:move(16);\r
607    28:if N1=132 then RL(88);\r
608    20,26,76:if(N1 in[86,87])and(5 in L[20])then\r
609        begin RS(14);R[5]:=20;Score(15,20)end;\r
610    39:if(5 in NounSet)or(30 in NounSet)then Score(15,20);\r
611    end; {Vb}\r
612 \r
613 21:case Vb of  { Gravel Lot }\r
614    3,13:move(18);\r
615    1,4..8:RL(27);\r
616    2,9,51:if N1 in[Null,62,71] then begin RL(234);move(22)end;\r
617    28,31:if n1=81 then begin Score(5,71);RB(1,7);Pause;end;\r
618    end; {Vb}\r
619 \r
620 22:case Vb of  { Top of Ship (Barre-An) }\r
621    1:begin RL(235);move(21)end;\r
622    10,11,51:if(n1 in[null,62,64,71])then\r
623         if en(23) then begin RL(236);move(2);Score(15,72)end else RL(99);\r
624    24,28,31:case N1 of\r
625        56:if en(23) then RL(163)else RL(99);81:begin RB(1,7);Pause;end end;\r
626    50:if N1=78 then\r
627        if en(22)then begin RL(94);Min(22)end else begin RL(95);Add(22)end;\r
628    41:if N1=56 then\r
629        if en(22) then begin RL(96);Add(23);Score(5,73)end else RL(97);\r
630    53:if N1=56 then\r
631        if en(23) then begin RL(98);Min(23)end else say('hatch','closed');\r
632    59:if(N1 in[49,122])or(VStr='jump off')then move(21);\r
633    end; {Vb}\r
634 \r
635  end {main case}\r
636 end; { Room5 }\r
637 {----------}\r
638 procedure Room6;   { Jungle Planet }\r
639 begin\r
640 case Prm of\r
641 23:case Vb of  { Deep Pit }\r
642     1..13,51:RL(217);\r
643     28,31:case N1 of  73:RL(218); 81,116:RS(80) end;\r
644     75:if N1=73 then move(34);\r
645    end;\r
646 \r
647 24:case Vb of { Top of Ship (Jungle planet) }\r
648    3:begin RL(235);move(25)end;\r
649    10,11,51:if(n1 in[null,62,64,71])then\r
650         if en(23) then begin Score(5,74);RL(236);move(2)end else RL(99);\r
651    24,28:if N1=56 then if en(23) then RL(163)else RL(99);\r
652    50:if N1=78 then\r
653        if en(22)then begin RL(94);Min(22)end else begin RL(95);Add(22)end;\r
654    41:if N1=56 then\r
655        if en(22) then begin RL(96);Add(23)end else RL(97);\r
656    53:if N1=56 then\r
657        if en(23) then begin RL(98);Min(23)end else say('hatch','closed');\r
658    59:if(N1 in[49,122])or(VStr='jump off')then move(25);\r
659    end; {Vb}\r
660 \r
661 25:case Vb of { Sandy Clearing }\r
662    4,9,51:if N1 in[Null,62,71] then begin RL(234);move(24)end;\r
663    1:begin move(26);Score(5,75)end;\r
664    2,3,5..8:RL(200);\r
665    end; {Vb}\r
666 \r
667 26:case Vb of { Winding Path 1 }\r
668    2:move(25);\r
669    5:begin RS(65);DEAD;end;\r
670    59:if N1=66 then\r
671        if VStr='jump in' then begin RL(288);DEAD;end\r
672        else begin RS(66);move(27);Score(25,76)end;\r
673    1,3,4,6..8:RL(200);\r
674    9,51:if N1=112 then RL(204);\r
675    28:if N1=66 then RS(85);\r
676    35,62:if N1=66 then begin RL(288);DEAD;end;\r
677    75,76:if N1=66 then RL(285);\r
678    83:if N1=66 then RL(286);\r
679    84:if N1=66 then begin RL(287);DEAD;end;\r
680    end;\r
681 \r
682 27:case Vb of { Winding Path 2 }\r
683    6:move(28);\r
684    8,11:begin RS(65);DEAD;end;\r
685    1..5,7:RL(200);\r
686    9,51:if N1=112 then RL(204);\r
687    59:if N1=66 then\r
688        if VStr='jump in' then begin RL(288);DEAD;end\r
689        else begin RS(66);move(26)end;\r
690    28:if N1=66 then RS(85);\r
691    35,62:if N1=66 then begin RL(288);DEAD;end;\r
692    75,76:if N1=66 then RL(285);\r
693    83:if N1=66 then RL(286);\r
694    84:if N1=66 then begin RL(287);DEAD;end;\r
695    end;\r
696 \r
697 28:case Vb of { Winding Path 3 }\r
698    7:move(27);\r
699    6:move(29);\r
700    8:begin RS(67);DEAD;end;\r
701    1..5:RL(200);\r
702    9,51:if N1=112 then RL(204);\r
703    28:if N1=112 then RS(86);\r
704    24:if N1=112 then RL(553);\r
705    end;\r
706 \r
707 29:case Vb of { Winding Path 4 }\r
708    7:move(28);\r
709    5:if en(29) then move(32) else\r
710       begin col(10,7);RS(72);col(11,7);T[12]:=146;Add(29);move(32)end;\r
711    9,51:if N1 in[Null,112] then begin RL(201);move(30)end;\r
712    6:begin RS(69);Prm:=31;T[11]:=4;end;\r
713    8:if en(35)or en(130)then begin RC:=1;move(59);Score(20,77)end;\r
714    1..4:RL(200);\r
715    28:case N1 of 112:RL(238);120:RL(544);\r
716        113:if Md=1 then begin RL(314);Add(130)end end;\r
717    59:if N1=120 then begin RL(541);Prm:=31;T[11]:=4;end;\r
718    end;\r
719 \r
720  end {main case}\r
721 end; { Room6 }\r
722 {----------}\r
723 procedure Room7;   { Jungle Planet }\r
724 begin\r
725 case Prm of\r
726 30:case Vb of { Top of Tree }\r
727    9:RL(202);\r
728    10,51:if N1 in[Null,112] then begin RL(203);move(29)end;\r
729    1..8:RL(200);\r
730    20..28:if N1=68 then RS(79);\r
731    18,17:RL(603);\r
732    end;\r
733 \r
734 31:case Vb of { Quicksand Pit }\r
735    1..8:RL(206);\r
736    9,51:if N1=112 then RL(204);\r
737    39,42,76:if N1=47 then\r
738      if en(78)then RL(549)else begin T[11]:=0;RS(71);Prm:=29;Score(25,78)end;\r
739    28:case N1 of 47:RL(239); 120:RL(240);end\r
740    end;\r
741 \r
742 32:case Vb of { Winding Path 5 }\r
743    1:move(33);\r
744    8:begin move(29);if en(35) and not en(40) then begin RL(314);Add(40)end end;\r
745    2..7:RL(200);\r
746    9,51:if N1=112 then RL(204);\r
747    end;\r
748 \r
749 33:case Vb of { Winding Path 6 }\r
750    2:move(32);\r
751    6:if not en(28)then begin RS(68);Add(28);move(34)end else move(34);\r
752    1,3,4,5,7,8:RL(200);\r
753    9,51:if N1=112 then RL(204);\r
754    end;\r
755 \r
756 34:case Vb of { Front of Pyramid }\r
757    7:move(33);\r
758    41..44,54,75,88:if N1=56 then RL(220) else\r
759       if N1=126 then\r
760        if HingeCon<>Null then\r
761         begin writeln('The hinged mouth opens, revealing a ',FN(HingeCon),\r
762                       ' inside.');Add(31);R[HingeCon]:=34;Score(25,79)end\r
763        else begin RL(226);Add(31)end;\r
764     53:if N1=56 then RL(220) else\r
765        if N1=126 then\r
766         begin RL(227);if HingeCon<>Null then R[HingeCon]:=Null;Min(31)end;\r
767    1,11:if en(30) then begin Score(25,80);move(35)end else RL(219);\r
768    39:if(PyraCon in NounSet)or((30 in Nounset)and(PyraCon=9))then\r
769        begin RL(225);Min(30);SFlag:=false;end else\r
770       if HingeCon in NounSet then begin RL(228);SFlag:=false;end;\r
771    2..6,8:RL(200);\r
772    9,51:if N1=112 then RL(204);\r
773    92:if N1 in[Null,49,122] then begin RL(216);move(23) end;\r
774    31:if N1 in[81,89,119] then begin RB(8,7);Pause;end;\r
775    28,24:case N1 of 68:RS(87); 89:RS(88); 81,119:begin RB(8,7);Pause;end;\r
776           64:if PyraCon=Null then RL(241)else\r
777               writeln('The small slot contains a ',FN(PyraCon),'.');\r
778           56:if en(30) then RL(244)else RL(245);\r
779           126:if en(31)then\r
780                if HingeCon=Null then RL(242)else\r
781                writeln('The open mouth contains a ',FN(HingeCon),'.')\r
782               else RL(243);\r
783          end;\r
784    end;\r
785 \r
786  end {main case}\r
787 end; { Room7 }\r
788 {----------}\r
789 procedure Room8;   { Inside Pyramid (Top Level) }\r
790 begin\r
791 case Prm of\r
792 35:case Vb of  { Vestibule }\r
793    2,13:move(34);\r
794    10,11,51:if N1 in[Null,71] then\r
795      if en(32) then move(36) else begin RS(84);Add(32);move(36)end;\r
796    28:if N1=56 then if en(30) then RL(244)else RL(245);\r
797    end;\r
798 \r
799 36:case Vb of  { Descending Stairs }\r
800    10,11,51:if N1 in[Null,71] then move(37);\r
801    9,13:move(35);\r
802    end;\r
803 \r
804 37:case Vb of  { Halcyon Hall }\r
805    1:if T[16]>1 then begin RL(278);DEAD;end else move(39);\r
806    3:move(38);\r
807    10,51:if N1 in[Null,71] then move(42);\r
808    9,13:move(36);\r
809    end;\r
810 \r
811 38:case Vb of  { Departure Room }\r
812    4,13:move(37);\r
813    28:case N1 of\r
814        73:if 10 in L[38] then begin RL(253);RL(252)end else RL(253);\r
815        10:if 10 in L[38] then RL(254);\r
816        30:if 17 in L[38] then begin SF;writeln('It''s a grey disk!')end\r
817       end;\r
818    26:if(N1=10)and(10 in L[38])then RL(255);\r
819    42,44:if N1 in[10,73] then RL(256);\r
820    75:if N1=73 then RL(257);\r
821    47,83,84:RL(258);\r
822    39:if(10 in L[38])and(10 in NounSet)then\r
823        begin L[38]:=L[38]+[17];RL(259);Score(15,81);SFlag:=false;end\r
824       else if(30 in NounSet)and(17 in L[38])then R[17]:=38;\r
825    end;\r
826 \r
827  end {main case}\r
828 end; { Room8 }\r
829 {----------}\r
830 procedure Room9;   { Inside Pyramid (Top Level) }\r
831 begin\r
832 case Prm of\r
833 39:case Vb of  { Holey Hall }\r
834    2,13:if T[15]>1 then begin RL(269);move(37);Score(5,82)end else move(37);\r
835    4,11:if T[15]>1 then begin RS(95);DEAD;end else move(40);\r
836    end;\r
837 \r
838 40:case Vb of  { Pyramid Lobby }\r
839    1,11:if T[14]>1 then\r
840          begin n[68]:='podium\alter\column\';WRITE('');move(41)end;\r
841    3,13:if(18 in Inv)or(4 in Inv)then begin Brief:=Brief-[39];move(39);\r
842           T[15]:=3;T[16]:=9;col(10,7);RS(93);\r
843           for i:=500 to 5500 do sounddelayed(random(i)+random(i));\r
844           for j:=1 to 7000 do sounddelayed(random(i)+random(i));\r
845           for j:=i downto 500 do sounddelayed(random(j)+random(j));nosound;\r
846          end\r
847         else move(39);\r
848    42,44,51,75,84,94:\r
849      if N1=68 then\r
850       if T[14]>1 then RL(246) else\r
851        if en(33) then begin T[14]:=7;RL(261);Walls(8);end\r
852        else begin T[14]:=7;Score(20,33);RS(89);Walls(8);end;\r
853    28:case N1 of 56:if T[14]>1 then RL(370)else RL(92);68:RL(247)end;\r
854    end;\r
855 \r
856 41:case Vb of  { Treasure's Keeper }\r
857    2,13:if T[14]>1 then begin n[68]:='pyramid\podium\';WRITE('');move(40)end\r
858         else RL(248);\r
859    28,22:case N1 of\r
860           56:if T[14]>1 then RL(370)else RL(92);\r
861           68:if PodumCon=Null then RL(264) else\r
862              writeln('There is a ',FN(PodumCon),' on the podium.');\r
863           18:if(18 in L[41])and not en(34)then RS(90);\r
864          end;\r
865    33:if N2=68 then\r
866        if Pr=1 then\r
867         if N1 in Mov then\r
868          if PodumCon=Null then\r
869           begin Van(N1);R[N1]:=41;PodumCon:=N1;RL(266)end\r
870          else RL(268)\r
871        else crazy;\r
872    75:if N1=68 then RL(276);\r
873    50:if N1=68 then begin RL(277);Walls(8);T[14]:=7;end;\r
874    39:if(30 in NounSet)and(18 in L[41])then R[18]:=41;\r
875    end;\r
876 \r
877  end {main case}\r
878 end; { Room9 }\r
879 {----------}\r
880 procedure Room10;   { Pyramid Maze }\r
881 begin\r
882 case Prm of\r
883 42:case Vb of  { Ladder Room }\r
884    1..13:if Maze then case Vb of 9,13:move(37);6:move(43);3,8:move(42)end\r
885          else case Vb of 9,13:move(37)end;\r
886    41..44,50,55:if N1=116 then RL(325);\r
887    28:if N1=116 then RL(547);\r
888    end;\r
889 \r
890 43:case Vb of  { Shifting Room NW }\r
891    1..8:if Maze then case Vb of 7:move(42)end\r
892         else case Vb of 2:move(44);8:move(45)end;\r
893    41..44,50,55:if N1=116 then RL(325);\r
894    28:if N1=116 then RL(547);\r
895    end;\r
896 \r
897 44:case Vb of  { Shifting Room W }\r
898    1..8:if Maze then case Vb of 7:move(47);2:move(45)end\r
899         else case Vb of 1:move(43);5:move(44)end;\r
900    41..44,50,55:if N1=116 then RL(325);\r
901    28:if N1=116 then RL(547);\r
902    end;\r
903 \r
904 45:case Vb of  { Shifting Room SW }\r
905    1..8:if Maze then case Vb of 1,3:move(45)end\r
906         else case Vb of 1:move(45);6:move(43)end;\r
907    41..44,50,55:if N1=116 then RL(325);\r
908    28:if N1=116 then RL(547);\r
909    end;\r
910 \r
911 46:case Vb of  { Shifting Room N }\r
912    1..8:if Maze then\r
913          case Vb of 1:begin RS(98);DEAD;end;\r
914           7:begin Score(50,84);move(50)end end\r
915         else\r
916          case Vb of 1:begin RS(98);DEAD;end;\r
917           7:begin Score(50,84);move(50)end;3:move(48);8:move(45)end;\r
918    41..44,50,55:if N1=116 then RL(325);\r
919    28:if N1=116 then RL(547);\r
920    end;\r
921 \r
922 47:case Vb of  { Shifting Room S }\r
923    1..8:if Maze then case Vb of 6:move(44)end\r
924         else case Vb of 3:move(49);1:move(47);4:move(45)end;\r
925    41..44,50,55:if N1=116 then RL(325);\r
926    28:if N1=116 then RL(547);\r
927    end;\r
928 \r
929 48:case Vb of  { Shifting Room NE }\r
930    1..8:if Maze then case Vb of 7:move(49);3,4:move(48)end\r
931         else case Vb of 4:move(46);1,2:move(48)end;\r
932    41..44,50,55:if N1=116 then RL(325);\r
933    28:if N1=116 then RL(547);\r
934    end;\r
935 \r
936 49:case Vb of  { Shifting Room SE }\r
937    1..8:if Maze then case Vb of 5:move(48)end\r
938         else case Vb of 4:move(47);2:move(45)end;\r
939    41..44,50,55:if N1=116 then RL(325);\r
940    28:if N1=116 then RL(547);\r
941    end;\r
942 \r
943 50:case Vb of  { Stairway Room E }\r
944    6:move(46);\r
945    4,10,13,51:move(51);\r
946    41..44,50,55:if N1=116 then RL(325);\r
947    end;\r
948 \r
949  end {main case}\r
950 end; { Room10 }\r
951 {----------}\r
952 procedure Room11;   { Inside Pyramid (Bottom Level) }\r
953 begin\r
954 case Prm of\r
955 51:case Vb of  { Lower Stairway }\r
956    3,9,13,51:move(50);\r
957    1:move(52);\r
958    end;\r
959 \r
960 52:case Vb of  { Misty Passage }\r
961    2:if T[19]>1 then begin RS(129);DEAD;end else move(51);\r
962    4:if en(35)then begin RL(305);DEAD;end else move(53);\r
963    33:if(N1=11)and(11 in Inv)then\r
964        if Pr in[1,5,7,10] then\r
965         if N2 in[34,49,64] then\r
966          if T[19]>0 then\r
967           begin Score(40,39);Van(11);L[52]:=L[52]+[11];T[19]:=0;RS(127)end\r
968          else begin Van(N1);R[N1]:=52;RL(586)end;\r
969    39:if(11 in NounSet)and en(39)then RL(307);\r
970    28:case N1 of 11:RL(312); 64:RL(313) end;\r
971    42,44,55:case N1 of 11:RL(307); 34:RL(308); end;\r
972 \r
973    end;\r
974 \r
975 53:case Vb of  { Damp Passage }\r
976    2:begin move(54);if en(35)then begin RS(122);DEAD;end end;\r
977    3:if T[18]>1 then begin RL(305);DEAD;end else move(52);\r
978    59:if N1=66 then\r
979        begin RS(125);Brief:=Brief-[52];move(52);T[18]:=0;T[19]:=3;\r
980         col(10,7);RL(306);Walls(12);Score(20,85)end;\r
981    end;\r
982 \r
983 54:case Vb of  { Dark Passage }\r
984    1:move(53);\r
985    2:move(55);\r
986    end;\r
987 \r
988 55:case Vb of  { Circular Chamber }\r
989    1:begin Brief:=Brief-[54];move(54);\r
990       if en(35)then\r
991        if Crawl=true then\r
992         begin col(10,7);RS(119);RS(120);Pause;L[53]:=L[53]+[66];Score(20,86);\r
993          Brief:=Brief-[53];move(53);col(10,7);RS(121);Walls(12);T[18]:=4;end\r
994        else begin col(10,7);RS(118);DEAD;end end;\r
995    2:if Md=1 then RS(230)else\r
996       if random(2)=1 then begin Prm:=58;RL(563)end else begin RS(100);DEAD;end;\r
997    3:begin move(56);if 11 in Inv then begin RS(102);DEAD;end end;\r
998    4:if Md=1 then RS(231)else begin RS(99);DEAD;end;\r
999    39:if(11 in NounSet)then begin RS(101);SFlag:=false;end\r
1000       else if(30 in Nounset)and(11 in L[55])then R[11]:=55;\r
1001    end;\r
1002 \r
1003  end {main case}\r
1004 end; { Room11 }\r
1005 {----------}\r
1006 procedure Room12;   { Inside Pyramid (Bottom Level) }\r
1007 begin\r
1008 case Prm of\r
1009 56:case Vb of  { The Erusaert }\r
1010    2,11:if en(36) then begin Score(5,88);move(57)end;\r
1011    4,13:if T[17]>4 then begin RS(108);DEAD;end else move(55);\r
1012    22,28:case N1 of\r
1013          1:if not en(35) then RL(292);\r
1014          34:if 1 in L[56]then RL(291)\r
1015             else if not en(35)then begin RS(103);L[56]:=L[56]+[1]end;\r
1016          49:RS(105);\r
1017          56:RL(370);\r
1018          66:RL(295);\r
1019          68:RS(104);\r
1020          110:RL(293);\r
1021          end;\r
1022    26:if N1 in[49,68] then RL(295);\r
1023    39:if 1 in NounSet then\r
1024        begin\r
1025         if not en(35)then RL(300) else\r
1026         if T[17]>4 then\r
1027          begin RS(113);T[17]:=3;Van(1);Inv:=Inv+[1];Score(50,87)end\r
1028        end\r
1029       else if(30 in NounSet)then RL(578);\r
1030    37:if not(1 in NounSet)and(not en(35))then RL(300);\r
1031    35,51,62:if N1=68 then begin RS(106);DEAD;end;\r
1032    59:begin RS(107);DEAD;end;\r
1033    41,88:if N1 in[68,110] then\r
1034           if N2=4 then\r
1035            if not en(35)then\r
1036             if here(16)and en(37)then\r
1037              begin RS(117);T[17]:=6;L[56]:=L[56]+[1,56];Add(35);Min(37)end\r
1038             else begin RS(111);DEAD;end\r
1039            else RL(273)\r
1040           else RL(296);\r
1041    33:if N1=16 then\r
1042        begin\r
1043         if Pr in[1,10] then\r
1044          if N2 in[49,1] then\r
1045           begin Van(16);Add(37);R[16]:=56;\r
1046            if not en(35)then\r
1047             if Pr=1 then RL(297)else RL(298)\r
1048            else RL(297)\r
1049           end\r
1050          else\r
1051           if(N2=34)and(Pr=10)then\r
1052            begin writeln('Done.');Van(16);SF;R[16]:=56;end\r
1053           else if N2=68 then RL(299)\r
1054        end\r
1055       else\r
1056        if N2 in[68,110] then\r
1057         if Pr=1 then RL(299) else\r
1058         if Pr=5 then\r
1059          if N1=4 then\r
1060           if not en(35)then\r
1061            if here(16)and en(37)then\r
1062             begin RS(117);T[17]:=6;L[56]:=L[56]+[1];Add(35);Min(37)end\r
1063            else begin RS(111);DEAD;end\r
1064           else RL(273)\r
1065          else RL(296);\r
1066    54,75,76:case N1 of\r
1067             1:if 1 in L[56] then RL(300);\r
1068             34:RL(304);\r
1069             end;\r
1070    end; {Vb}\r
1071 \r
1072  end {main case}\r
1073 end; { Room12 }\r
1074 {----------}\r
1075 procedure Room13;   { Inside Pyramid (Bottom Level) }\r
1076 begin\r
1077 case Prm of\r
1078 57:case Vb of  { Solar Chamber }\r
1079    1,13:move(56);\r
1080    28:case N1 of 56:RL(370);72,82,116:RS(149);109:RS(150)end;\r
1081    44,75:if N1=103 then begin Prm:=58;RS(233);Walls(5);Static end;\r
1082    end; {Vb}\r
1083 \r
1084 58:case Vb of  { Eternal Trap }\r
1085    9,13,51:RL(554);\r
1086    92:RL(555)\r
1087    end;\r
1088 \r
1089 59:case Vb of  { Overgrown Path }\r
1090    5:begin RC:=RC-1;if RC<1 then begin RL(309);move(29)end else RL(310)end;\r
1091    8:begin RC:=RC+1;if RC>7 then begin RL(309);move(60)end else RL(310)end;\r
1092    1..4,6,7:RL(200);\r
1093    9,51:if N1=112 then RL(204);\r
1094    end;\r
1095 \r
1096 60:case Vb of  { Antenna Building (Outside) }\r
1097    4,11:begin Door(61,25);\r
1098          if not en(43)then begin RS(137);Score(10,43)end end;\r
1099    5:move(59);\r
1100    1..3,6,7,8:RL(200);\r
1101    28:case N1 of 96:RL(323);115:RL(324)end;\r
1102    41..44,54,75,88:if N1=56 then RL(315);\r
1103    9,51:if N1=112 then RL(204)else RL(316);\r
1104    end;\r
1105 \r
1106 61:case Vb of  { Monitor Outpost }\r
1107    3,13:Door(60,25);\r
1108    2,11:move(62);\r
1109    28,24,31:case N1 of 37,59:RS(133);38,44:RL(322);93:RL(319);\r
1110              94:RS(134)end;\r
1111    42,44,75:if N1 in[37,38,44] then RL(318);\r
1112    end;\r
1113 \r
1114 62:case Vb of  { Booth (Jungle Planet) }\r
1115    1,13:move(61);\r
1116    42,44,75:\r
1117      case N1 of\r
1118       37,38:RL(318);\r
1119       44:begin RS(138);\r
1120           for yi:=60 downto 1 do for xi:=800 downto 1 do sounddelayed(xi*yi);\r
1121           nosound;TFlag:=3;Brief:=Brief-[70];Score(10,89);\r
1122           for x:=1 to MMax do if R[x]=62 then R[x]:=70;move(70)\r
1123          end\r
1124      end;\r
1125    28,24,31:case N1 of 37,59:RS(133);38:RL(322);93:RL(319);\r
1126              94:RS(134);44:RL(320);end;\r
1127    end; {Vb}\r
1128 \r
1129 63:case Vb of  { Booth (Ringed Planet) }\r
1130    1,13:RL(328);\r
1131    42,44,75:case N1 of\r
1132             37,38:RL(318);\r
1133             44:begin RS(138);\r
1134                 for yi:=60 downto 1 do for xi:=800 downto 1 do sounddelayed(xi*yi);\r
1135                 nosound;TFlag:=3;Brief:=Brief-[70];\r
1136                 for x:=1 to MMax do if R[x]=63 then R[x]:=70;move(70)\r
1137                end\r
1138             end;\r
1139    28,24,31:case N1 of 37,59:RS(133);38:RL(322);93:RL(319);\r
1140              94:RS(134);44:RL(320);end;\r
1141    39:if(30 in NounSet)and(20 in L[63])then R[20]:=63;\r
1142    end; {Vb}\r
1143 \r
1144  end {main case}\r
1145 end; { Room13 }\r
1146 {----------}\r
1147 procedure Room14;   { Inner Planet }\r
1148 begin\r
1149 case Prm of\r
1150 64:case Vb of  { Lobby }\r
1151    1,13:begin DOpen(99);RS(139);DEAD;end;\r
1152    2,11:move(65);\r
1153    28:case N1 of 35:RL(330);49,122:RL(334);72,116:begin Score(5,90);RS(148)end;\r
1154        81:RB(5,11);86:RL(333);127:RL(351)end;\r
1155    31:if N1=81 then RB(5,11);\r
1156    20,24:if N1=127 then RS(142);\r
1157    54:if N1=127 then if Md=3 then begin RL(537);DEAD;end else RL(538);\r
1158    end;\r
1159 \r
1160 65:case Vb of  { North Corridor }\r
1161    1:move(64);\r
1162    2:move(66);\r
1163    4:Door(68,20);\r
1164    28:if N1=56 then RL(92);\r
1165    end;\r
1166 \r
1167 66:case Vb of  { Central Corridor }\r
1168    1:move(65);\r
1169    2:move(67);\r
1170    3:if T[20]>1 then begin Score(15,91);move(73)end else RL(92);\r
1171    4:move(72);\r
1172    28:case N1 of 56:if T[20]>1 then RL(370)else RL(92);64:RL(335)end;\r
1173    33:if N2=64 then\r
1174        if Pr=5 then\r
1175         if N1=12 then\r
1176          begin RL(336);T[20]:=3;DOpen(20);Score(5,92)end\r
1177         else RL(137);\r
1178    end; {Vb}\r
1179 \r
1180 67:case Vb of  { South Corridor }\r
1181    1:move(66);\r
1182    2,11:Door(75,5);\r
1183    4:move(71);\r
1184    end;\r
1185 \r
1186 71:case Vb of  { Monitor Station }\r
1187    3:move(67);\r
1188    28:case N1 of 59:if CodeSet=4 then RL(353)else RL(355);116:RL(354)end;\r
1189    31:if N1=59 then\r
1190        if CodeSet=4 then begin RB2(11,14);Pause;end else RL(355);\r
1191    end;\r
1192 \r
1193 72:case Vb of  { Reactor Control }\r
1194    3:move(66);\r
1195    28,24:case N1 of 128:RL(560);\r
1196        37,38:RL(339);46:if Md<>Null then begin Score(5,93);RL(343)end\r
1197               else RS(145);\r
1198        55:if en(46)then\r
1199            if RobotCon<>Null then\r
1200             writeln('The robot''s panel contains a ',FN(RobotCon),'.')\r
1201            else RL(346)\r
1202           else RL(344);\r
1203       end;\r
1204    33:if N2=55 then\r
1205        if Pr=5 then\r
1206         if en(46)then\r
1207          if RobotCon=Null then\r
1208           if N1 in[3,4,8,12,17]then\r
1209            begin Van(N1);RL(347);R[N1]:=72;RobotCon:=N1;end\r
1210           else RL(137)\r
1211          else RL(348)\r
1212         else RL(344);\r
1213    41:if N1 in[55,46] then\r
1214        if RobotCon=Null then RL(558)else\r
1215         begin R[RobotCon]:=72;Add(46);Score(25,94);\r
1216          writeln('The panel slides open, revealing a ',FN(RobotCon),' inside.')\r
1217         end;\r
1218    53:if N1=55 then begin Van(RobotCon);Min(46);RL(344)end;\r
1219    42,44:case N1 of\r
1220           37,38,44:begin RL(340);Walls(9);gotoxy(43,wherey-1);col(28,31);\r
1221                     writeln('BOOM!');Explode(32);DEAD;end;\r
1222           46:if(VStr='turn on')or(VStr='activat')or\r
1223                (VStr='turn off')then RL(341)\r
1224              else if(not en(94))and(not en(93))then begin RL(342);RL(559)end\r
1225                   else RL(342)\r
1226          end;\r
1227    end; {Vb}\r
1228 \r
1229  end {main case}\r
1230 end; { Room14 }\r
1231 {----------}\r
1232 procedure Room15;   { Inner Planet }\r
1233 begin\r
1234 case Prm of\r
1235 68:case Vb of  { Decontamination }\r
1236    3,13:if en(45)then Door(65,20) else RL(331);\r
1237    4,11:Door(69,20);\r
1238    28,24:case N1 of 131:RL(329);end;\r
1239    42,44,75:if N1=44 then begin RL(332);Add(45);play(20,99,7);play(99,99,600);\r
1240       play(99,20,7);Score(10,95)end;\r
1241    end;\r
1242 \r
1243 69:case Vb of  { Waiting Room }\r
1244    2,11:Door(70,50);\r
1245    3,13:Door(68,20);\r
1246    28,24:case N1 of 35:RL(330);131:RL(329);end;\r
1247    end;\r
1248 \r
1249 70:case Vb of  { Transporter Booth }\r
1250    1,13:Door(69,50);\r
1251    28,24:case N1 of 44:RS(140);93:RL(319);94:RS(141);end;\r
1252    42,44,75:\r
1253      if N1 in[40..43]then\r
1254       begin Brief:=Brief-[62,63,78];RS(138);Min(45);\r
1255        for yi:=60 downto 1 do for xi:=800 downto 1 do sounddelayed(xi*yi);nosound;\r
1256         case N1 of\r
1257          40:begin for x:=1 to MMax do if R[x]=70 then R[x]:=78;\r
1258              TFlag:=4;move(78);Score(15,97)end;\r
1259          41:begin for x:=1 to MMax do if R[x]=70 then R[x]:=62;\r
1260              TFlag:=2;move(62)end;\r
1261          43:begin for x:=1 to MMax do if R[x]=70 then R[x]:=63;\r
1262              TFlag:=2;move(63);Score(10,96)end\r
1263         end;\r
1264       end;\r
1265    end; {Vb}\r
1266 \r
1267 { 71 and 72 are in Room14 }\r
1268 \r
1269  end {main case}\r
1270 end; { Room15 }\r
1271 {----------}\r
1272 procedure Room16;   { Inner Planet }\r
1273 begin\r
1274 case Prm of\r
1275 73:case Vb of  { Communications }\r
1276    1:move(74);\r
1277    4:Door(66,20);\r
1278    28:case N1 of\r
1279        48:begin RL(366);writeln('The dial is set at number ',CodeSet,'.')end;\r
1280        115:RL(350);121:RL(367);127:RL(351)\r
1281       end;\r
1282    50:if N1=48 then\r
1283        if Pr>Null then\r
1284         if(code>0)and(code<11)then\r
1285          begin RL(363);CodeSet:=Code;if Code=4 then Score(10,98)end\r
1286         else RL(362)\r
1287        else RL(365);\r
1288    end; {Vb}\r
1289 \r
1290 74:case Vb of  { Computer Station }\r
1291    2:move(73);\r
1292    28:case N1 of 37:RL(349);38:RL(322);52:RL(37);\r
1293        59:begin RB2(7,10);col(26,23);RL(364);Score(5,47)end end;\r
1294    31:if N1=59 then begin RB2(7,10);col(26,23);RL(364);Add(47)end;\r
1295    end;\r
1296 \r
1297 75:case Vb of  { Elevator  1st Floor }\r
1298    1:Door(67,5);\r
1299    42,44,75:begin RS(143);play(20,42,20);sound(42);delay(5500);RL(338);\r
1300    play(42,20,20);Prm:=76;for x:=1 to MMax do if R[x]=75 then R[x]:=76;end;\r
1301    end;\r
1302 \r
1303 76:case Vb of  { Elevator  2nd  Floor }\r
1304    1:begin Score(5,99);Door(77,5)end;\r
1305    42,44,75:begin RS(144);play(20,42,20);sound(42);delay(5500);RL(338);\r
1306              play(42,20,20);Prm:=75;for x:=1 to MMax do if R[x]=76 then R[x]:=75;end;\r
1307    end;\r
1308 \r
1309 77:case Vb of  { Observatory }\r
1310    2:Door(76,5);\r
1311    28:case N1 of 34:RL(562);104:if Nstr='eyepiec' then RL(561)else RS(146)end;\r
1312    24:if N1=104 then\r
1313        if 20 in Wear then begin Score(5,100);RS(147)end\r
1314        else begin RL(368);RL(369)end;\r
1315    end;\r
1316 \r
1317  end {main case}\r
1318 end; { Room16 }\r
1319 {----------}\r
1320 procedure Room17;   { Planetship }\r
1321 begin\r
1322 case Prm of\r
1323 78:case Vb of  { Icy Platform }\r
1324    3,11:door(79,25);\r
1325    28:case N1 of\r
1326        54:RL(379);93:RL(380);96:RL(381);103:RL(500);115:RL(350);118:RL(382)\r
1327       end;\r
1328    59:if N1=54 then begin RL(400);DEAD;end;\r
1329    end;\r
1330 \r
1331 79:case Vb of  { Confirmation Port }\r
1332    4,13:door(78,25);\r
1333    28:case N1 of 44:RL(383);64:RL(384);116:RL(600)end;\r
1334    44,75:if N1=44 then begin RS(156);Score(10,50);\r
1335           play(20,99,7);play(99,99,600);play(99,20,7)end;\r
1336    33:if N2=64 then\r
1337        if Pr=5 then\r
1338         if N1=17 then\r
1339          begin Explode(1);sound(50);RS(151);\r
1340           for i:=9000 downto 1 do\r
1341            for j:=1 to 4 do sound(random(i div 2 + 400)+i);nosound;\r
1342           Van(17);L[80]:=L[80]+[17];move(80);Add(7);T[22]:=3;T[26]:=91;\r
1343           delay(900);sound(70);RL(399);delay(999);nosound;Score(25,101);\r
1344           n[40]:='sockets\socket\';\r
1345           n[82]:='laser beam\laser\beam\';\r
1346           n[110]:='speaker\';\r
1347          end\r
1348         else RL(137);\r
1349    end;\r
1350 \r
1351 80:case Vb of  { Inspection Lobby }\r
1352    4,13:door(81,65);\r
1353    9:RL(523);\r
1354    28:case N1 of 55:RL(385);86:if 17 in L[80]then RL(395);72,116:RS(148)end;\r
1355    41..44,88,53:if N1=55 then RL(405);\r
1356    end;\r
1357 \r
1358  end {main case}\r
1359 end; { Room17 }\r
1360 {----------}\r
1361 procedure Room18;   { Planetship }\r
1362 begin\r
1363 case Prm of\r
1364 81:case Vb of  { Circular Corridor }\r
1365    2:move(82);\r
1366    3,11:door(80,65);\r
1367    6:move(88);\r
1368    28:case N1 of 72:RL(386)end;\r
1369    end;\r
1370 \r
1371 82:case Vb of  { Circular Corridor }\r
1372    1:move(81);\r
1373    3:door(96,50);\r
1374    4:door(93,5);\r
1375    8:move(83);\r
1376    28:case N1 of 72,103:RL(387)end;\r
1377    end;\r
1378 \r
1379 83:case Vb of  { Circular Corridor }\r
1380    2,11:door(95,25);\r
1381    4:move(84);\r
1382    5:move(82);\r
1383    28:case N1 of 72,115:RL(388)end;\r
1384    end;\r
1385 \r
1386 93:case Vb of  { Central Elevator }\r
1387    3,11,13:case Floor of\r
1388       1:door(82,5);\r
1389       2..5,30..40,89..95,170..230,333..444,543..600,793..812:RL(413);\r
1390       480:if en(64)then\r
1391            begin door(98,5);delay(999);RS(217);Score(20,102);\r
1392             for x:=1 to 7 do begin i:=random(7000)+1500;j:=random(600)+400;\r
1393              play(i,i,j)end;\r
1394             RL(516)end\r
1395            else RL(413)\r
1396       else begin door(97,5);Score(5,103)end\r
1397      end;\r
1398    28:if N1 in[44,52] then RS(188);\r
1399    56:begin val(input,i,testc);\r
1400        if testc=0 then\r
1401         if(i>0)and(i<837)then\r
1402          if i<>Floor then\r
1403           begin j:=i;i:=abs(floor-i);Floor:=j;RL(411);play(20,36,35);\r
1404            sound(37);for x:=1 to 200 do delay(i div 4);\r
1405            RL(412);play(36,20,35);\r
1406           end\r
1407          else RL(410)\r
1408         else RL(410)\r
1409        else crazy\r
1410       end\r
1411    end;\r
1412 \r
1413 95:case Vb of  { Transmission Room }\r
1414    1,13:door(83,25);\r
1415    28:if N1 in[38,121]then RS(191);\r
1416    42,44,75:if N1=44 then begin Score(5,104);RL(404);play(1200,1200,99);\r
1417      if en(48)then Min(48)else Add(48)end;\r
1418    end;\r
1419 \r
1420 96:case Vb of  { Station Control }\r
1421    4,13:door(82,50);\r
1422    28:case N1 of 38:RS(192);59:begin Score(5,105);RB2(11,5);Pause;end end;\r
1423    31:if N1=59 then begin Score(5,105);RB2(11,5);Pause;end;\r
1424    end;\r
1425 \r
1426  end {main case}\r
1427 end; { Room18 }\r
1428 {----------}\r
1429 procedure Room19;   { Planetship }\r
1430 begin\r
1431 case Prm of\r
1432 84:case Vb of  { Circular Corridor }\r
1433    2,11:door(94,65);\r
1434    3:move(83);\r
1435    6:move(85);\r
1436    28:case N1 of 72,46:RL(389)end;\r
1437    end;\r
1438 \r
1439 85:case Vb of  { Circular Corridor }\r
1440    1:move(86);\r
1441    4,11:door(92,65);\r
1442    7:move(84);\r
1443    28:case N1 of 72:RL(390)end;\r
1444    end;\r
1445 \r
1446 86:case Vb of  { Circular Corridor }\r
1447    2:move(85);\r
1448    4,11:if T[21]>1 then begin Score(15,107);move(91);\r
1449       if en(52)then T[23]:=2;end else RL(92);\r
1450    5:move(87);\r
1451    28:case N1 of 56:if T[21]>1 then RL(370);64:RL(335);72,69:RL(391)end;\r
1452    33:if N2=64 then\r
1453        if Pr=5 then\r
1454         if N1=12 then\r
1455          begin RL(336);T[21]:=3;DOpen(15);Score(5,106)end\r
1456         else RL(137);\r
1457    end;\r
1458 \r
1459 87:case Vb of  { Circular Corridor }\r
1460    1,11:door(89,65);\r
1461    3:move(88);\r
1462    8:move(86);\r
1463    28:case N1 of 72:RL(392)end;\r
1464    end;\r
1465 \r
1466 88:case Vb of  { Circular Corridor }\r
1467    1,11:door(90,65);\r
1468    4:move(87);\r
1469    7:move(81);\r
1470    28:case N1 of 72:RL(392)end;\r
1471    end;\r
1472 \r
1473 89:case Vb of  { Reactors West }\r
1474    2,13:door(87,65);\r
1475    3:move(90);\r
1476    28:case N1 of 38:RL(414);59:RL(401);128:RS(189)end;\r
1477    31:if N1=59 then\r
1478        case ScrnSet of\r
1479         1:RB2(8,6);   { Orange Crystal }\r
1480         2:RB2(10,10); { Green Crystal  }\r
1481         3:RB2(12,14); { Yellow Crystal }\r
1482         4:begin RB2(14,9);  { Blue Crystal (Cracked) }\r
1483            x:=wherex;y:=wherey;gotoxy(40,14);col(25,23);write('LACITIRC');\r
1484            gotoxy(x,y);Score(20,108)\r
1485           end;\r
1486        end;\r
1487     44,75:if N1=44 then\r
1488            begin RL(402);ScrnSet:=ScrnSet+1;if ScrnSet>4 then ScrnSet:=1;\r
1489             for x:=1 to 30 do\r
1490              begin i:=random(7000)+999;play(i,i,50);delay(random(15)+5)end\r
1491            end else\r
1492           if N1 in[38,128]then RL(403);\r
1493      42:if N1 in[38,128]then RL(403);\r
1494    end;\r
1495 \r
1496  end {main case}\r
1497 end; { Room19 }\r
1498 {----------}\r
1499 procedure Room20;   { Planetship }\r
1500 begin\r
1501 case Prm of\r
1502 90:case Vb of  { Reactors East }\r
1503    2,13:door(88,65);\r
1504    4:move(89);\r
1505    28:case N1 of 38:RL(393);59:RL(402);128:RS(190)end;\r
1506    31:if N1=59 then begin Score(5,109);RB2(9,random(14)+1)end;\r
1507    42,44,75:if N1 in[38,128]then RL(403);\r
1508    end;\r
1509 \r
1510 91:case Vb of  { Emergency Override }\r
1511    3,13:begin if T[25]>2 then\r
1512       begin Col(10,7);RL(424);T[25]:=Null;T[24]:=Null;T[26]:=14;Add(52)end;\r
1513       door(86,15);\r
1514       if(T[24]>0)and not en(64)then begin T[24]:=Null;T[26]:=14;Add(52)end\r
1515      end;\r
1516    4,11:RL(92);\r
1517    28:case N1 of 37,38,51:RL(393);44:RL(469);59:RL(468);64:RL(335);\r
1518        69:if en(51)then RL(426)else if Md=1 then RL(467)else RS(182);\r
1519       end;\r
1520    31:if N1=59 then RL(468);\r
1521    24:if N1=69 then if en(51)then crazy else RL(427);\r
1522    75:if N1=69 then if en(51)then crazy else RL(428);\r
1523    54:case N1 of\r
1524        69:if en(51)then RL(426)else\r
1525           if N2 in[0,60]then RL(601)else\r
1526           if not(N2 in[10,18,29])then RL(602)else\r
1527            begin RS(160);L[91]:=L[91]+[123];L[91]:=L[91]-[44,129];T[23]:=15;\r
1528             Add(51)end;\r
1529       end;\r
1530    42,44:if(N1=69)and not en(51)then RL(470)else\r
1531          if N1=44 then begin RL(471);play(20,440,1);play(440,440,500);\r
1532           play(440,20,1);end;\r
1533    41,88:if N1=69 then if en(51)then crazy else RL(467);\r
1534    39:if N1=95 then RL(442);\r
1535    49:if N2=123 then\r
1536        if Pr=1 then\r
1537         if N1=1 then\r
1538          if(T[24]>1)and(T[24]<6)then\r
1539           begin T[24]:=Null;T[25]:=7;RS(181)end\r
1540          else RL(429)\r
1541         else RL(425);\r
1542    33:if N2=64 then\r
1543        if Pr=5 then\r
1544         if N1=12 then RL(577);\r
1545    end;\r
1546 \r
1547 92:case Vb of  { Climate Control }\r
1548    3,13:door(85,65);\r
1549    28,31:case N1 of 59:RS(152);end;\r
1550    end;\r
1551 \r
1552  end {main case}\r
1553 end; { Room20 }\r
1554 {----------}\r
1555 procedure Room21;   { Planetship }\r
1556 begin\r
1557 case Prm of\r
1558 94:case Vb of  { Maintenance }\r
1559    1,13:door(84,65);\r
1560    28:case N1 of\r
1561        51:RL(489);\r
1562        87:begin RL(490);Score(15,110);\r
1563            if not en(49)then\r
1564             begin Score(10,49);RL(396);L[94]:=L[94]+[26];end\r
1565            else if 26 in L[94] then RL(397);\r
1566           end;\r
1567       end; {case}\r
1568    39:begin\r
1569        if(30 in NounSet)then\r
1570         begin if 2 in L[94] then R[2]:=94;if 26 in L[94] then R[26]:=94;end;\r
1571        if(51 in NounSet)then\r
1572         begin RL(491);NounSet:=NounSet-[51];\r
1573          if not(NounSet=[])then SFlag:=false end\r
1574       end;\r
1575    end;\r
1576 \r
1577 97:case Vb of  { Cryogenic Chamber }\r
1578    4,11,13:door(93,5);\r
1579    28:if N1=69 then RS(193);\r
1580    18:begin RS(194);Van(N1)end;\r
1581    end;\r
1582 \r
1583 98:case Vb of  { Identity Booth }\r
1584    2,11:begin door(99,0);\r
1585       if T[27]>1 then begin Col(10,7);RS(208);delay(999);Blast;DEAD end\r
1586       else begin T[27]:=2000;Col(10,7);RL(504);play(22,22,999);RS(210);\r
1587             delay(999);Blast;RL(505)end\r
1588      end;\r
1589    4,13:door(93,5);\r
1590    28,31:case N1 of 81,119:if NStr='message' then RL(517)else RB2(13,13);\r
1591           59:RL(517)end;\r
1592    end;\r
1593 \r
1594 99:case Vb of  { Security Tunnel #1 }\r
1595    1,13:door(98,0);\r
1596    2,11:begin Score(15,111);door(100,0)end;\r
1597    4:RL(506);\r
1598    41,88:if N1=55 then RL(509);\r
1599    28:case N1 of 46:RS(216);55:RL(510);88:RL(511)end;\r
1600    42,44,75:if N1=46 then begin RL(513);T[27]:=2000;Add(7)end;\r
1601    39:if 88 in NounSet then begin RL(513);T[27]:=2000;Add(7)end;\r
1602    end;\r
1603 \r
1604 100:case Vb of  { Security Tunnel #2 }\r
1605     1,13:begin door(99,0);Col(10,7);RS(208);delay(999);Blast;DEAD end;\r
1606     2,11:begin door(101,0);\r
1607        if T[28]>1 then begin Col(10,7);RS(209);delay(999);Blast;DEAD end\r
1608        else begin T[28]:=2000;Col(10,7);RL(504);play(22,22,999);RS(211);\r
1609              delay(999);Blast;RS(212);PStat:=PStat+[4];T[29]:=14;end;\r
1610       end;\r
1611     41,88:if N1=55 then RL(512);\r
1612     end;\r
1613 \r
1614  end {main case}\r
1615 end; { Room21 }\r
1616 {----------}\r
1617 procedure Room22;   { Planetship (Lower Level) }\r
1618 begin\r
1619 case Prm of\r
1620 101:case Vb of  { Security Tunnel #3 }\r
1621     1,13:door(100,0);\r
1622     2,11:begin Region:=5;door(102,0);Score(20,112);\r
1623        if not(20 in Wear)then RL(492)end;\r
1624     41,88:if N1=55 then RL(509);\r
1625     28:case N1 of 46:RS(216);55:RL(510);88:RL(511)end;\r
1626     42,44,75:if N1=46 then begin RL(513);T[28]:=2000;Add(7)end;\r
1627     39:if 88 in NounSet then begin RL(513);T[28]:=2000;Add(7)end;\r
1628     end;\r
1629 \r
1630 102:if(Vb in[1..14,16,20..31,33..44,48..64,73..76,83..85,88..94])and\r
1631       not(20 in Wear)then RL(491) else\r
1632     case Vb of  { North Catwalk }\r
1633     1,11,13:begin Region:=Null;Door(101,0);Col(10,7);RS(209);delay(999);\r
1634        Blast;DEAD end;\r
1635     7:move(103);\r
1636     8:move(105);\r
1637     24,25,28:case N1 of 34,49:RL(493);\r
1638       131:if NStr='catwalk' then RL(494)else begin RS(195);RS(196)end end;\r
1639     75,76:if N1=42 then RL(495);\r
1640     51,59:if N1 in[42,54,131]then begin RL(496);DEAD;end;\r
1641     end;\r
1642 \r
1643 103:if(Vb in[1..14,16,20..31,33..44,48..64,73..76,83..85,88..94])and\r
1644       not(20 in Wear)then RL(491) else\r
1645     case Vb of  { East Catwalk }\r
1646     6:move(102);\r
1647     8:move(104);\r
1648     24,25,28:case N1 of 34,49:RL(493);\r
1649       131:if NStr='catwalk' then RL(494)else begin RS(195);RS(196)end end;\r
1650     75,76:if N1=42 then RL(495);\r
1651     51,59:if N1 in[42,54,131]then begin RL(496);DEAD;end;\r
1652     end;\r
1653 \r
1654 104:if(Vb in[1..14,16,20..31,33..44,48..64,73..76,83..85,88..94])and\r
1655       not(20 in Wear)then RL(491) else\r
1656     case Vb of  { South Catwalk }\r
1657     2,13:begin Region:=Null;Door(106,5);Score(20,113)end;\r
1658     5:move(103);\r
1659     6:move(105);\r
1660     24,25,28:case N1 of 34,49:RL(493);\r
1661       131:if NStr='catwalk' then RL(494)else begin RS(195);RS(196)end end;\r
1662     75,76:if N1=42 then RL(495);\r
1663     51,59:if N1 in[42,54,131]then begin RL(496);DEAD;end;\r
1664     end;\r
1665 \r
1666 105:if(Vb in[1..14,16,20..31,33..44,48..64,73..76,83..85,88..94])and\r
1667       not(20 in Wear)then RL(491) else\r
1668     case Vb of  { West Catwalk }\r
1669     5:move(102);\r
1670     7:move(104);\r
1671     24,25,28:case N1 of 34,49:RL(493);\r
1672       131:if NStr='catwalk' then RL(494)else begin RS(195);RS(196)end end;\r
1673     75,76:if N1=42 then RL(495);\r
1674     51,59:if N1 in[42,54,131]then begin RL(496);DEAD;end;\r
1675     end;\r
1676 \r
1677  end {main case}\r
1678 end; { Room22 }\r
1679 {----------}\r
1680 procedure Room23;   { Planetship (Lower Level) }\r
1681  label JUMP;\r
1682 begin\r
1683 case Prm of\r
1684 106:case Vb of  { Junction }\r
1685     1:begin Region:=5;Door(104,5);if not(20 in Wear)then RL(492)end;\r
1686     2:RL(328);\r
1687     3:door(108,5);\r
1688     4,11,13:door(107,20);\r
1689     41..44,88:if N1=56 then RL(532);\r
1690     end;\r
1691 \r
1692 107:case Vb of  { Conference Room }\r
1693     3,13:door(106,20);\r
1694     39:if(30 in NounSet)and(19 in L[107])then R[19]:=107;\r
1695     end;\r
1696 \r
1697 108:case Vb of  { Reactor Regulators }\r
1698     4,13:door(106,5);\r
1699     41:if N1=55 then\r
1700         if not en(65)then\r
1701          begin Add(65);L[108]:=L[108]+[40];Score(5,114);\r
1702           for x:=22 to 25 do R[x]:=108;RL(519);RL(520);\r
1703          end\r
1704         else RL(521);\r
1705     53:if en(65)then RL(522)else RL(523);\r
1706     28,24:case N1 of 55:if en(65)then goto JUMP else RL(523);\r
1707          40:JUMP:\r
1708            begin RL(525);\r
1709             for x:=1 to 25 do if x in Socket then\r
1710              if x=22 then writeln('  An ',FN(x),' is in one of the sockets.')\r
1711              else writeln('  A ',FN(x),' is in one of the sockets.')\r
1712            end;\r
1713           end;\r
1714     33:if(N2 in[40,55])and en(65)then\r
1715         begin i:=0;for x:=1 to 25 do if x in Socket then i:=i+1;\r
1716          if i<4 then\r
1717           if N1 in Inv then\r
1718            if N1 in[1,22..25]then\r
1719             begin\r
1720              writeln('The ',FN(N1),' fits perfectly in an open socket.');\r
1721              Van(N1);Socket:=Socket+[N1];R[N1]:=108;\r
1722              i:=0;for x:=1 to 25 do if x in Socket then i:=i+1;\r
1723              if(i>3)and(1 in Socket) and not(25 in Socket)then\r
1724               begin { ####  You have won the game!!!!!  #### }\r
1725                Col(10,7);delay(999);Static;Static;RS(221);Static;Static;\r
1726                delay(999);explode(1);sound(20);RS(222);delay(999);RS(223);\r
1727                Pause;Bor(0,0);writeln;Score(55,115);\r
1728                Add(66);Prm:=109;PStat:=[];PlayerInput(Line);\r
1729                Col(10,15);for x:=224 to 229 do RS(x);\r
1730                writeln;writeln;Pause;writeln;\r
1731                WON;  {  <<<-----  END OF GAME !!! *************}\r
1732               end\r
1733             end\r
1734            else writeln('The ',FN(N1),' won''t fit in any of the sockets.')\r
1735           else writeln('First you must have the ',FN(N1),'.')\r
1736          else RL(526)\r
1737         end;\r
1738     end;\r
1739 \r
1740  end {main case}\r
1741 end; { Room23 }\r
1742 {----------}\r
1743 {**************************** END OF ROOM ROUTINES **************************}\r
1744 \r
1745 \r
1746 {$I DEFAULT.pas   <<<<<------  LOADS IN DEFAULT ROUTINES  *******************}\r
1747 \r
1748 \r
1749 BEGIN { Main Program }\r
1750 Assign1;Assign2;Assign3;Assign4;Assign5;\r
1751 Names1;Names2;Names3;\r
1752 InitScrKbd;\r
1753 Title;\r
1754 Init1;Init2;Init3;\r
1755 Place1;Place2;\r
1756 Describe(Prm);\r
1757 \r
1758 repeat\r
1759 \r
1760 PlayerInput(LINE);\r
1761 if length(input)>0 then Parser_Syntax(input);\r
1762 if EFlag=Legal then\r
1763  begin\r
1764   MoreThanOne;\r
1765   if Present then\r
1766    if T[2]>1 then\r
1767     begin RL(11);Time1;\r
1768      case TFlag of 1:Time2A;2:Time2B;3:Time2C;4:Time2D;end end\r
1769    else\r
1770     begin SFlag:=false; if(Vb=71)and(Prm=55)and not en(35)then Vb:=1;\r
1771      case Prm of\r
1772        1                          :Room1;\r
1773        2,3                        :Room2;\r
1774        4..7                       :Room3;\r
1775        8..12                      :Room4;\r
1776       13..22                      :Room5;\r
1777       23..29                      :Room6;\r
1778       30..34                      :Room7;\r
1779       35..38                      :Room8;\r
1780       39..41                      :Room9;\r
1781       42..50                      :Room10;\r
1782       51..55                      :Room11;\r
1783       56                          :Room12;\r
1784       57..63                      :Room13;\r
1785       64..67,71,72                :Room14;\r
1786       68..70                      :Room15;\r
1787       73..77                      :Room16;\r
1788       78..80                      :Room17;\r
1789       81..83,93,95,96             :Room18;\r
1790       84..89                      :Room19;\r
1791       90..92                      :Room20;\r
1792       94,97..100                  :Room21;\r
1793       101..105                    :Room22;\r
1794       106..108                    :Room23;\r
1795      end; { Room Defaults }\r
1796      if not SFlag then\r
1797       case Vb of\r
1798        1..8,30,82,87              :Default0;\r
1799        16,17,18                   :Default1;\r
1800        9..15,32,35,51,77,79,62    :Default2;\r
1801        28,47                      :Default3;\r
1802        37,39                      :Default4;\r
1803        46,64                      :Default5;\r
1804        66..69,71                  :Default6;\r
1805        31,65,75,80,81,83,84,93,95 :Default7;\r
1806        41,50,88                   :Default8;\r
1807        20,22,24,26,70,76          :Default9;\r
1808        33                         :Default10;\r
1809        42,44,73,86,89,90,94       :Default11;\r
1810        48,54                      :Default12;\r
1811        19,53,56,72,74,78,91       :Default13;\r
1812        21,25,49,59,92             :Default14\r
1813       end;\r
1814      if en(128)then DEAD;Min(128);\r
1815      if not(Vb in[77..79,82,86,87,95])then\r
1816       begin Time1;case TFlag of 1:Time2A;2:Time2B;3:Time2C;4:Time2D;end end;\r
1817     end;\r
1818  end;\r
1819 \r
1820 until false;\r
1821 END. { ADGAME2 (Supernova) }\r
1822 \1a\r