Modifying Beyond The Titanic to compile with the Free Pascal compiler and run on...
[beyond-the-titanic.git] / src / COMMANDS.PAS
1 {//-------------------------------------------------------------------------}
2 {/*                                                                         }
3 {Copyright (C) 2014 Jason Self <j@jxself.org>                               }
4 {                                                                           }
5 {This file is free software: you may copy, redistribute and/or modify it    }
6 {under the terms of the GNU Affero General Public License as published by   }
7 {the Free Software Foundation, either version 3 of the License, or (at your }
8 {option) any later version.                                                 }
9 {                                                                           }
10 {This file is distributed in the hope that it will be useful, but WITHOUT   }
11 {ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      }
12 {FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License}
13 {for more details.                                                          }
14 {                                                                           }
15 {You should have received a copy of the GNU Affero General Public License   }
16 {along with this program; if not, see https://gnu.org/licenses or write to: }
17 {  Free Software Foundation, Inc.                                           }
18 {  51 Franklin Street, Fifth Floor                                          }
19 {  Boston, MA 02110-1301                                                    }
20 {  USA                                                                      }
21 {                                                                           }
22 {This file incorporates work covered by the following copyright and         }
23 {permission notice:                                                         }
24 {                                                                           }
25 {Copyright (C) 1990, 2009 - Apogee Software, Ltd.                           }
26 {                                                                           }
27 {This file is part of Beyond The Titanic. Beyond The Titanic is free        }
28 {software; you can redistribute it and/or modify it under the terms of the  }
29 {GNU General Public License as published by the Free Software Foundation;   }
30 {either version 3 of the License, or (at your option) any later version.    }
31 {                                                                           }
32 {This program is distributed in the hope that it will be useful, but WITHOUT}
33 {ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      }
34 {FITNESS FOR A PARTICULAR PURPOSE.                                          }
35 {                                                                           }
36 {See the GNU General Public License for more details.                       }
37 {                                                                           }
38 {You should have received a copy of the GNU General Public License          }
39 {along with this program; if not, write to:                                 }
40 {  Free Software Foundation, Inc.                                           }
41 {  51 Franklin Street, Fifth Floor                                          }
42 {  Boston, MA 02110-1301                                                    }
43 {  USA                                                                      }
44 {                                                                           }
45 {Original Source: 1990 Scott Miller                                         }
46 {Prepared for public release: 03/19/09 - Joe Siegler, Apogee Software, Ltd. }
47 {*/                                                                         }
48 {//-------------------------------------------------------------------------}
49 {****************************************************************************}
50 {*                                COMMANDS                                  *}
51 {*                            by Scott Miller                               *}
52 {*  These are misc procedures and functions used with the main file: AdGame *}
53 {*                        Copyright 1984 Pending                            *}
54 {****************************************************************************}
55
56
57
58 procedure SA;
59    begin FlagSA:='s' end;
60
61 function En(c : char) : boolean;
62    begin
63      if(c in Ev)then En:=True else En:=False
64    end;
65
66 function Here(noun : integer): Boolean;
67    begin
68      if(noun in Inven)or(r[noun]=Prm)or(noun in p[Prm])then Here:=True
69      else Here:=False
70    end;
71
72 procedure Crazy;
73    begin SA;
74     if(random(2)=1)then RL(107+random(7))else RL(300+random(6));
75    end;
76
77 procedure DEAD;
78     var FileName : file;
79     var x,b,c:Integer;
80    begin SA; NoSound;
81      gotoxy(1,25);for x:=1 to 7 do writeln;
82      Textcolor(1);TextBackground(m9);
83      gotoxy(1,18);
84      write('*********************************************************',
85            '***********************');writeln;
86      gotoxy(1,19); for x:=1 to 3 do
87      write('*                                                        ',
88              '                      *');writeln;
89      gotoxy(1,22);
90      write('*********************************************************',
91            '***********************');writeln;
92      TextColor(m0);gotoxy(32,20);writeln('YOU HAVE DIED!!!');
93      Textcolor(m2);Textbackground(0);
94      for c:=700 downto 20 do
95         for b:=70 downto 1 do sound(b*c);nosound;
96      close(Rooms1);close(rooms2);close(special1);close(special2);close(line1);
97      gotoxy(1,23);DelLine;DelLine;writeln;write('Do you wish to play again? ');
98      flag:=ReadKey;
99      if(upcase(flag)<>'N')then
100       begin
101        writeln('Restarting...');window(1,1,80,25);
102        assign(rooms1,'BEYOND.com');
103        { execute(rooms1); }
104        end
105      else
106       begin
107        textcolor(7);
108        textbackground(0);
109        window(1,1,80,25);
110        clrscr;
111        writeln('    Beyond the Titanic');
112        writeln('A Scott Miller Production');
113        writeln('    Have a nice day...');
114        delay(2000);
115        assign(FileName,'MENU.COM');
116        {$I-}
117        {execute(FileName);}
118        {$I+}
119        if IOResult <> 0 then HALT;
120       end
121    end;
122
123 procedure Home;
124   var b,c,x,y,o:Integer;
125    begin SA;
126      gotoxy(1,25);for x:=1 to 7 do writeln;
127      Textcolor(25);Textbackground(m7);
128      gotoxy(1,18);
129      write('#########################################################',
130            '#######################');writeln;
131      gotoxy(1,19); for x:=1 to 3 do
132      write('#                                                        ',
133              '                      #');writeln;
134      gotoxy(1,22);
135      write('#########################################################',
136            '#######################');writeln;
137      TextColor(31);gotoxy(25,20);writeln('Y O U   H A V E   W O N ! ! !');
138      Textcolor(m2);Textbackground(0);
139      gotoxy(1,23);DelLine;DelLine;writeln;
140      for x:=150 downto 1 do begin sound(x*55);delay(8);nosound;delay(20)end;
141      if(Sc>1000)then Sc:=1000;
142      write('You finished with a score of ',Sc,', which makes you a ');
143      if(Sc=1000)then
144       begin writeln('Perfect Adventurer!!!');
145         for y:=1 to 7 do
146          for o:=0 to 20 do
147            for x:= 99+(o*430)to 998+(o*430)do begin sound(25);sound(x)end
148       end
149      else writeln('Master Adventurer!');
150      for c:=1 to 999 do for b:=1 to 61 do sound(b*c);nosound;
151      writeln;nosound;
152      writeln('Reboot your computer to regain control...')
153   end;
154
155 procedure Say(o : integer; p : str14);
156    begin
157      writeln('The ',n[o,1],' is already ',p,'.'); SA
158    end;
159
160 procedure Diagnose;
161    begin
162      RL(191);
163      if((tic>42)and not(en('c')))or((tic>146)and not(en('n')))or(en('r'))then
164       begin
165        if(tic>42)and (not(en('c')))then RL(192)
166         else if(tic>146)and not(en('n'))then RL(192);
167        if(en('r'))then RL(51)
168       end
169      else RL(207)
170    end;
171
172 procedure Monster(var NewRm : integer);
173    begin
174     if(NewRm=MnRm)and(MnRm=25)then begin Attack:=False;RL(384)end else
175     if(NewRm<>35)or not(en('v'))then
176      begin
177       p[Prm]:=p[Prm]-[23];p[NewRm]:=p[NewRm]+[23];MnRm:=NewRm;Attack:=False;
178        if not((NewRm=30)and(Verb in[27,28]))then
179         case random(7) of
180          0:RS(71);1:RS(72);2:RL(359);3:RL(360);4:RL(361);5:RL(362);6:RL(363)
181         end
182      end
183     else begin RL(383);Attack:=False end
184    end;
185
186 procedure DescribeRm;
187    var o : integer;
188   procedure s(r : str14);
189      begin TextColor(m8);writeln(r);TextColor(m2);loc:=r;end;
190    begin SA;
191 if((en('a'))and(here(29)))or not(Prm in [6..24])then begin
192      case Prm of
193 0:s('Ship''s Fore');1:s('Ship Mid-Deck');2:s('Rear of Ship');
194 3:s('Life Boat');4:s('Ocean Surface');5:s('Huge Cavern');
195 6:s('Cave of Pins');7:s('Ocean Bottom');8:s('Squeaky Cave');
196 9:s('Stream Bend');10:s('Waterfall');13:s('Sloppy Cave');
197 11:s('Hex Cave');12:s('Shallow Cleft');20:s('Zoo');
198 14:s('Winding Tunnel');15:s('Chasm');17:s('Chasm Bottom');
199 18:s('Tiny Opening');19:s('Etched Stairs');
200 21:s('Edge of Saucer');22:s('Side of Saucer');
201 23:s('Top of Saucer');24:s('Airlock');16:s('End of Rope');
202 76:s('Locked Cabin');25:s('Central Entry');
203 26:s('Lower Entry');27:s('Ship''s Systems');
204 30:s('Time Chamber');28:s('Ship''s Lab');34:s('Bridge');
205 29:s('Inside Tube');31:s('Life Support');58,69:s('Inside Shuttle');
206 32:s('Supply Chamber');33:s('Sleep Chamber');
207 35:s('Engine Room');36:s('Cargo Deck #1');37:s('Cargo Deck #2');
208 38:s('Cargo Deck #3');39:s('Cargo Deck #4');40:s('Large Cage');
209 41:s('Wooden Bridge');42:s('Broken End');43:s('South End');
210 44..46:s('Deserted Road');47:s('Crater Edge');48:s('Crater Floor');
211 49:s('Building Front');50:s('Lobby');51..54:s('Office Room');
212 55:s('Basement');56:s('Ladder Room');57:s('Building Roof');
213 59:case ShRm of 0:s('Above Mud Lake');
214 1:s('Above Rubble');2:s('Above Desert');3:s('Above Pits');
215 4:s('Above River');5:s('Above Stream');6:s('Above Town');
216 7:s('Above Mountain');8:s('Above Crator');9:s('Above Hills');
217 10:s('Above Canyon');11:s('Above Flatland');12:s('Above Dry Lake');
218 13:s('Above Desert');14:s('Above Bridge')end;{of Above Rooms}
219 63,64:s('Above Clouds');65..68:s('Outside City');70:s('Landing Bay');
220 71:s('Power Plant');72..74:s('Dark Corridor');75:s('Food Supply')
221      end; {of case}
222
223     if Verbose then begin FlagSA:='r';
224       case Prm of
225        2 :if(40 in p[2])then begin RR(2);RL(416)end;
226        4 :if(en('B'))then RR(4)else begin RR(4);
227            writeln('There is a safety harness here.')end;
228        11:if(en('C'))then RS(15);
229        40:if(en('g'))then RS(17);
230        12:if not(en('G'))then begin RR(12);RL(146)end;
231        31:if not(en('I'))then begin RR(31);RL(156)end;
232        34:if(74 in p[34])then begin RR(34);RL(273)end;
233        35:if(77 in p[35])then begin RR(35);RL(381);RL(382)end else
234            if(en('W'))then begin RR(35);RL(381)end;
235        42:if(13 in p[42])then begin RR(42);RL(214)end;
236        48:if(27 in p[48])then begin RR(48);RL(276)end;
237        59..69:begin SA;
238                if(Prm=59)and not(ShRm in RmSh)then
239                 begin RmSh:=RmSh+[ShRm];RS(ShRm+46)end
240                else if(Prm<>59)then RR(Prm);
241                if KeyHole and here(63)then
242                 writeln('The shiny key is in the keyhole.')
243               end
244        else RR(Prm)
245       end; {of case}
246       if(FlagSA='r')and(Prm<>59)then RR(Prm)end;
247
248      for o:= 0 to NMax do begin
249        if(o in Mov)then
250          if(r[o]=Prm)then
251           if not((Prm in[59..69])and(KeyHole)and(o=63))then
252            begin writeln('There is a ',n[o,1],' here.');
253             if(here(ropecon))and(o=ropecon)and not(ropecon in inven)then
254              writeln('  The rope is attatched to the ',n[o,1],'.');
255             if(en('d'))and(o=70)and(here(70))then RL(147);
256             if(o=SlotCon)and(here(o))then RL(388);
257             if(o in CabiSet)and(here(o))then RL(389);
258             if(o=PanelCon)and(here(o))then RL(390);
259             if(o in KitSet)and(here(o))then RL(391);
260            end
261      end end
262     else RL(54)
263    end;  {of DescribeRm}
264
265 procedure SAVE;
266    begin SA; for x:=1 to 24 do writeln; nosound;
267    window(1,3,80,25);
268    gotoxy(1,4);
269    if(Drive='A:')then
270     writeln('Remove the GAME disk and insert your SAVE/RESTORE disk ',
271             'in drive A:')else
272     writeln('Make sure your SAVE/RESTORE disk is in drive B:');
273    writeln('  (Press any key to continue...)');flag:=ReadKey;
274    writeln;writeln;
275    write('Save under what name? ');
276    {BufLen:=8;}
277    readln(input);
278    while pos(' ',input)>0 do delete(input,pos(' ',input),1);
279    while pos('.',input)>0 do delete(input,pos('.',input),1);
280    if(input='')then input:='LastRoom';
281    writeln;writeln;input:=Drive+input;
282    writeln('If your SAVE/RESTORE disk is in drive ',Drive,
283             ' then press any key to start.');
284    flag:=ReadKey;
285    with DiskSave do
286     begin
287      aInven:=Inven;aKitSet:=KitSet;aCabiSet:=CabiSet;aPanelCon:=PanelCon;
288      aSlotCon:=SlotCon;aCompCon:=CompCon;aRopeCon:=RopeCon;aTic:=Tic;
289      aYearDial:=YearDial;aPrm:=Prm;aMnRm:=MnRm;aSc:=Sc;aShots:=Shots;
290      aShRm:=ShRm;aRx:=Rx;aEv:=Ev;aCode:=Code;aLoc:=Loc;aKeyHole:=KeyHole;
291     end;
292    assign(GameSave,input+'.a');
293    rewrite(GameSave);
294    write(GameSave,DiskSave);
295    close(GameSave);
296    assign(Objects,input+'.b');
297    rewrite(Objects);
298    for x:=0 to RMax do write(Objects,p[x]);
299    close(Objects);
300    assign(WordList,input+'.c');
301    rewrite(Wordlist);
302    for x:= 0 to NMax do
303     for y:= 1 to 5 do
304      write(WordList,n[x,y]);
305    for x:= 0 to VMax do
306     for y:= 1 to 5 do
307      write(WordList,v[x,y]);
308    close(WordList);
309    assign(Things,input+'.d');
310    rewrite(Things);
311    for x:= 0 to NMax do write(Things,r[x]);
312    close(Things);
313    writeln; delete(input,1,2);
314    writeln('Your present game location is now',
315            ' SAVED to disk under the name ''',input,'.''');
316    if(Drive='A:')then begin writeln;
317     writeln('Remove the SAVE/RESTORE disk and insert your GAME disk.')end;
318    writeln('  (Press any key to continue...)');flag:=ReadKey;
319    writeln;writeln;
320    if(Verb<>54)then writeln('You may now resume your game...');
321    if(Line='')then Line:='look';Tic:=Tic-2;Back:=True;
322    if(Prm in[59..68])then sound(20);
323    window(1,2,80,25)
324    end; {of Save}
325
326 procedure RESTORE;
327  function Exist:Boolean;
328  begin
329  assign(GameSave,input+'.a');
330  {$I-}
331  Reset(GameSave);
332  {$I+}
333  Exist:=(IOresult=0)
334  end;
335    begin SA; for x:=1 to 24 do writeln; nosound;
336    window(1,3,80,25);gotoxy(1,4);
337    if(Drive='A:')then
338     writeln('Remove the GAME disk and insert your SAVE/RESTORE disk ',
339             'in drive ',Drive)else
340     writeln('Make sure your SAVE/RESTORE disk is in drive B:');
341    writeln('  (Press any key to continue...)');flag:=ReadKey;
342    writeln;writeln;
343    write('Which file name do you want to RESTORE? ');
344    {BufLen:=8;}
345    readln(input);
346    while pos(' ',input)>0 do delete(input,pos(' ',input),1);
347    while pos('.',input)>0 do delete(input,pos('.',input),1);
348    if(input='')then input:='LastRoom';
349    writeln;writeln;input:=Drive+input;
350    writeln('If your SAVE/RESTORE disk is now in drive ',Drive,
351            ' then press any key to start.');
352    flag:=ReadKey;
353    if Exist then
354     begin
355      close(GameSave);
356      assign(GameSave,input+'.a');
357      reset(GameSave);
358      read(GameSave,DiskSave);
359      close(GameSave);
360      with DiskSave do
361       begin
362        Inven:=aInven;KitSet:=aKitSet;CabiSet:=aCabiSet;PanelCon:=aPanelCon;
363        SlotCon:=aSlotCon;CompCon:=aCompCon;RopeCon:=aRopeCon;Tic:=aTic;
364        YearDial:=aYearDial;Prm:=aPrm;MnRm:=aMnRm;Sc:=aSc;Shots:=aShots;
365        ShRm:=aShRm;Rx:=aRx;Ev:=aEv;Code:=aCode;Loc:=aLoc;KeyHole:=aKeyHole;
366       end;
367      assign(Objects,input+'.b');
368      reset(Objects);
369      for x:=0 to RMax do read(Objects,p[x]);
370      close(Objects);
371      assign(WordList,input+'.c');
372      reset(Wordlist);
373      for x:= 0 to NMax do
374       for y:= 1 to 5 do
375        read(WordList,n[x,y]);
376      for x:= 0 to VMax do
377       for y:= 1 to 5 do
378        read(WordList,v[x,y]);
379      close(WordList);
380      assign(Things,input+'.d');
381      reset(Things);
382      for x:= 0 to NMax do read(Things,r[x]);
383      close(Things);
384      writeln; delete(input,1,2);
385      writeln('Your previously SAVED game location is now',
386              ' RESTORED from the file ''',input,'.''');
387      if(Drive='A:')then begin writeln;
388       writeln('Remove the SAVE/RESTORE disk and insert your GAME disk.')end;
389      writeln('  (Press any key to continue...)');flag:=ReadKey;
390     end
391    else
392     begin writeln;TextColor(28);
393      writeln('             That name does not exist on this',
394              ' SAVE/RESTORE disk.',^g);
395      TextColor(m2);writeln;
396      if(Drive='A:')then
397       writeln('Put your GAME disk back in the disk drive and press any key.')
398      else writeln('  (Press any key to continue...)');
399      flag:=ReadKey;
400     end;
401    writeln;writeln;writeln('You may now resume you game...');
402    if(Line='')then Line:='look';Tic:=Tic-2;Back:=True;
403    if(Prm in[59..68])then sound(20);
404    window(1,2,80,25)
405    end; {of Restore}
406
407 procedure Vanish(o : integer);
408    begin SA;
409      inven:=inven-[o];
410      r[o]:=Null;
411      p[Prm]:=p[Prm]-[o];
412      if(o=7)and not(en('I'))then Ev:=Ev+['I'];
413      if(o=13)and(13 in p[42])then p[42]:=p[42]-[13];
414      if(o=PanelCon)then PanelCon:=Null;
415      if(o=SlotCon)then SlotCon:=Null;
416      if(o in CabiSet)then CabiSet:=CabiSet-[o];
417      if(o in kitset)then kitset:=kitset-[o];
418      if(o=63)and KeyHole then KeyHole:=False;
419      if(o=74)then Ev:=Ev-['p'];
420      if(o=89)then Ev:=Ev-['i'];
421      if(o=RopeCon)and(verb=36)then begin RopeCon:=Null;RL(402)end;
422      if(o=RopeCon)and not(Verb in[9,14])then RopeCon:=Null
423    end;
424
425 procedure Play( Start, Stop, Wait: integer);
426    var x : integer;
427    begin
428     if(Start<=Stop)then
429      for x:= Start to Stop do
430       begin sound(x); delay(Wait); end
431     else
432      for x:= Start downto Stop do
433       begin sound(x); delay(Wait); end;
434     if(Prm in[59..68])then sound(20)else nosound
435    end; {of Play}
436
437 procedure DropAll;
438    var o : integer;
439    begin
440      for o:= 0 to NMax do
441        if(o in inven)then
442          begin
443            r[o]:=Prm;
444            inven:=inven-[o];writeln(n[o,1],': Dropped.');
445          end;
446      RL(106);
447    end;  {of DropAll}
448
449 function FlasOff : Boolean;
450    begin
451      if not(En('a'))then FlasOff:=True
452      else
453        if(r[29]=Prm)or(29 in inven)then FlasOff:=False
454        else FlasOff:=True;
455    end;
456
457 procedure  MoveTo(NewRm : integer);
458  var o : integer;
459  begin
460    if(57 in inven)and(ropecon<>Null)and not(ropecon in inven)
461      and(ropecon in mov)and not(ropecon=70)then
462       begin r[ropecon]:=Prm;RL(158);end
463    else if(57 in inven)and(ropecon<>Null)and(not(ropecon in mov)or
464         ((ropecon=70)and(en('d'))))then
465           begin RL(55);inven:=inven-[57];r[57]:=Prm;end
466    else if not(57 in inven)and((ropecon in inven)or
467           (ropecon in[60,56,44]))then r[57]:=NewRm
468    else if not(57 in inven)and(r[57]=Prm)and(r[ropecon]=NewRm)then
469           begin r[57]:=NewRm;RopeOld:=Prm;end
470    else if not(57 in inven)and(r[57]=Prm)and(NewRm=RopeOld)and
471               (r[ropecon]=Prm)then
472           begin r[57]:=RopeOld;RopeOld:=Null;end;
473    if(ropecon=Null)or((NewRm<>RopeOld)and(Prm<>RopeOld))then RopeOld:=Null;
474    if(MnRm<>Null)then Monster(NewRm);
475    if(Prm in[63..68])and not(NewRm in[59,69])then RL(343);
476    if(Prm in[59,63..68])then for o:=0 to NMax do if(r[o]=Prm)then r[o]:=NewRm;
477    Prm:=NewRm;
478    DescribeRm
479  end;  {of MoveTo}
480
481 procedure Time;
482    begin
483      Tic:=Tic+1;
484   case Tic of
485     3:RL(280);
486     4:RS(1);
487     17:if not(en('A'))then begin RS(3);DEAD end else RS(5);
488     19:RL(4);
489     20:RL(5);
490     21:RL(6);
491     23:RS(6);
492     24:if(en('B'))then begin RS(8);writeln;RL(16);moveto(5);Sc:=Sc+25;
493          n[64,5]:='ship';v[26,2]:='pick' end
494        else begin RS(7);DEAD;end;
495     43:if(not(en('c'))and not(en('n')))then RL(31);
496     73:if(not(en('c'))and not(en('n')))then RL(32);
497     93:if(not(en('c'))and not(en('n')))then begin RL(33); DEAD end;
498     99:if(Prm in[6..24])and(here(29))and not(flasoff)and(not(en('s')))then
499          begin RL(41);Ev:=Ev+['s'] end;
500     147:if not(en('n'))then RL(31);
501     149:if(here(29))and not(flasoff)then RL(59);
502     153:if(Prm in[6..23])and(here(29))and not(flasoff)then
503           begin RS(14);vanish(29) end;
504     170:if not(en('n'))then RL(32);
505     181:if not(en('n'))then begin RL(33); DEAD end;
506     549:RL(281);
507     586:RL(282);
508     598:RL(283);
509     607:begin RL(284);DEAD;end;
510   end; {of case}
511
512 case Prm of
513     1..3:if(tic>4)and(random(4)=1)then RL(405);
514   36..39:if(random(5)=2)then RL(219);
515      7  :if(random(8)=2)then RL(266);
516      8  :if(random(3)=2)then begin RL(265);play(6666,7000,0);end;
517   13..24:if(random(16)=2)then RL(246);
518   25..35:if(random(30)=2)then RL(267);
519    47,48:if(random(5)=2)and(inven <>[])then
520            begin
521             if(Prm=48)then begin writeln;RS(40)end
522             else begin writeln;RS(44);moveto(48)end;
523             o:=1;flag:='?';
524             repeat o:=o+1;
525              if(o in inven)then
526              begin vanish(o);r[o]:=random(9)+41;flag:='g';end;
527             until Flag = 'g';
528            end;
529 end;
530 case Prm of
531   5,6,9,10:if(random(9)=2)then RL(268);
532   7,8,11..40:if(here(84))and(random(20)=2)then RL(269)
533         else if(random(75)=2)then RS(36)
534         else if(Prm in[5..22])and(random(33)=2)then
535          begin RL(265);play(6500,6950,0)end;
536   41..49:if(random(27)=2)then RL(285);
537     59  :if(random(15)=1)then RL(406);
538 end;
539 if Attack and(MnRm=Prm)and(not Back)then
540  begin case random(3) of 0:RS(80); 1:RS(81); 2:RS(82)end;DEAD end
541 else if(MnRm=Prm)then Attack:=True
542    end;  {of Time}
543
544 function Present : Boolean;
545    begin
546     if(noun<>Null)and(noun<>1)then
547      if(here(noun))then
548       if(noun2<>Null)then
549        if(here(noun2))then Present:=true
550        else begin
551          writeln('You can''t see any ',n[noun2,1],' here.');Present:=false end
552       else Present:=true
553      else begin
554        writeln('You can''t see any ',n[noun,1],' here.');Present:=false end
555     else Present:=true
556    end;
557
558 procedure Initialize;
559  var S: string;
560
561  procedure Cn(S : Str80);
562  begin
563   gotoxy(40-(length(S)div 2),wherey);
564   writeln(S);
565  end;
566   begin
567    textcolor(15);
568    writeln('Prepare to engage yourself in a most exciting adventure.');
569    writeln('But first, two simple questions:');
570    gotoxy(1,4);write('Are you using a COLOR screen (Y/N)? ');
571    nosound; play(72,80,45);
572    flag:='Y'; play(2500,2490,6);
573    m0:=20;m1:=14;m2:=11;m3:=4;m4:=15;m5:=28;m6:=1;m7:=4;m8:=10;m9:=10;
574    if upcase(flag)='N' then
575     begin
576      writeln('No, I don''t have a color screen.');
577      m0:=31;m1:=15;m2:=15;m3:=7;m4:=0;m5:=31;m6:=7;m7:=8;m8:=7;m9:=0;
578     end else writeln('Yes, I do have a color screen.');writeln;
579    write('How many disk drives do you have (1/2)? ');
580    play(80,88,30);
581    flag:='2';play(2500,2490,6);
582    Drive:='B:';
583    if(upcase(flag)='O')or(flag='1')then
584     begin Drive:='A:';writeln('I have ONE disk drive.')end else
585     writeln('I have TWO disk drives.');
586    delay(999);clrscr;textcolor(15);gotoxy(1,5);writeln;textcolor(7);
587    cn('Beyond the Titanic');textcolor(6);cn('------------------');writeln;
588    textcolor(7);
589    cn('A Text & Sound Adventure Fantasy');writeln;writeln;
590    cn('An Apogee Software Production');writeln;writeln;writeln;
591    cn('Written and Programmed by Scott Miller');
592    textcolor(11);
593    gotoxy(32,24);textcolor(7);
594    write('Press any key...');{flag:=ReadKey;}clrscr;
595
596    {                      *** SHAREWARE SCREEN ***                            }
597
598    textcolor(15);
599    writeln('Please note that Beyond the Titanic is a SHAREWARE game.');
600    writeln;
601    textcolor(7);
602    writeln('This game has been placed in the public domain for your enjoyment.');
603    writeln;
604    writeln('If you like the game the author (Scott Miller) asks that you please');
605    writeln('contribute $5 or $10 (your discretion) to him.  This minimal payment');
606    writeln('will help compensent the author for the year of work that went into');
607    writeln('Beyond the Titanic.  It will also encourage the author to make new and');
608    writeln('better games, like Supernova and Kingdom of Kroz, both of which are');
609    writeln('also shareware games recently released.');
610    writeln;
611    writeln('This fee also registers the payer for telephone support and clues.');
612    writeln;writeln;
613    writeln('Please make checks payable to Scott Miller.');
614    writeln;
615    textcolor(15);
616    writeln('        Scott Miller           (214) 240-0614');
617    writeln('        4206 Mayflower Dr.');
618    writeln('        Garland, TX  75043');
619    writeln;
620    textcolor(7);
621    writeln('Thanks, enjoy the game...');
622    gotoxy(23,25);
623    {delay(12000);}
624    while keypressed do flag:=ReadKey;
625    write('Press any key to start the game...');
626    {flag:=ReadKey;}
627    while keypressed do flag:=ReadKey;
628    clrscr;
629    {                      ************************                            }
630    window(1,2,80,25);
631    gotoxy(1,1);
632    TextColor(m1);
633 cn('APRIL 14, 1912    11:43 PM');
634 cn('You never knew the black canvas of the night was so full'+
635    ' of twinkling detail.');
636 cn('Standing on deck of the White Star''s new super luxury liner, deep at sea,');
637 cn('where the bright lights of San Francisco don''t fade the night, you');
638 cn('can view thousands of stars you never realized existed.');
639 cn('Looking out over the icy sea you can barely see small pieces of'+
640    ' broken ice');
641 cn('bobbing in the water.  Rumor has it that icebergs the size of small');
642 cn('mountains can be found in this region.  You don''t feel');
643 cn('too worried, though, the Titanic has been touted as');
644 cn('"unsinkable," and every single passenger knows');
645 cn('that White Star, the premier ship builder,');
646 cn('knows their stuff...');
647 for x:= 1 to 3 do writeln;
648 Line        :='';
649 LastNoun    :='';
650 KitSet      :=[2,29,57];
651 CabiSet     :=[89,63];
652 CompCon     :=Null;
653 PanelCon    :=8;
654 RopeCon     :=Null;
655 SlotCon     :=Null;
656 RopeOld     :=Null;
657 RmSh        :=[];
658 Mov         :=[2,7,8,13,27,29,32,34,40,52,51,57,63,70,74,77,89];
659 OneWordCommands:=[1,4,5,7,8,16,18,19,22,31,33..35,41,43..54,56..59,61..65];
660 Ev          :=[];
661 Inven       :=[];
662 Prm         :=0;
663 MnRm        :=Null;
664 Tic         :=Prm;
665 Sc          :=0;
666 Shots       :=6;
667 KeyHole     :=false;
668 Verbose     :=true;
669 Attack      :=False;
670 YearDial    :=135;
671 DayDial     :=60;
672 assignfile(rooms1,'ROOMS1');
673 assignfile(rooms2,'ROOMS2');
674 assignfile(special1,'SPECIAL1');
675 assignfile(special2,'SPECIAL2');
676 assignfile(line1,'LINE');
677
678 getdir(0,S);
679 chdir(S);
680 {Writeln ('Current directory is : ',S);}
681
682
683 {$I+}
684
685 {filemode:=1;}
686 reset(rooms1);
687
688 reset(rooms2);
689 reset(special1);
690 reset(special2);
691 reset(line1);
692
693
694 Str(Random(9998)+1,Code);
695
696    DescribeRm;
697    writeln;
698    randomize;
699    gotoxy(1,1);
700    TextBackGround(m6);
701    for x:=1 to 80 do write(' ');
702    writeln;
703    TextColor(m4);
704
705    gotoxy(4,1);
706    writeln('Move');
707
708    gotoxy(68,1);
709    writeln('Score');
710    TextColor(m2);
711    TextBackGround(0);
712    Window(1,2,80,25);
713
714   end; {of Initialize}
715 {***************************** END OF COMMANDS *****************************}