The Star Trek game and its version in the text mode

Delphi & Pascal (esk wiki)
Pejt na: navigace, hledn
Category:

Author: Ivan Dimov
Program: Star.pas
File exe: Star.exe

The Star Trek game and its version in the text mode.
{ STAR.PAS                                                          }
{                                                                   }
{ Author: Ivan Dimov                                                }
{ Date  : 15.02.1997                           http://www.trsek.com }
 
program StarTrek;
uses crt;
var  i  : integer;
     mm : byte;
     v  : char;
 
procedure Pause;
begin
 gotoxy(35,25);write('Stlac klaves ...');
 v:=readkey;
end;
 
procedure Menu;
begin
 clrscr;
 textcolor(yellow);
 textbackground(lightgray);
 gotoxy(30,10);write(' 1/Start hry ');
 textbackground(black);
 gotoxy(30,11);write(' 2/Koniec    ');
 
 mm:=1;
 repeat
  v:=readkey;
  if (v=#0) then begin  { bol sedy klaves }
     textbackground(black);
     gotoxy(30,10);write(' 1/Start hry ');
     gotoxy(30,11);write(' 2/Koniec    ');
     textbackground(lightgray);
     v:=readkey;
     if (v=#72) then begin
        gotoxy(30,10);write(' 1/Start hry ');
        mm:=1;
       end;
     if (v=#80) then begin
        gotoxy(30,11);write(' 2/Koniec    ');
        mm:=2;
       end;
    end;
 until (v in [#27,#13]);
 textbackground(black);
end;
 
procedure GameOver;
begin
 textcolor(4);
 for i:=1 to 6 do writeln;
 writeln('                               ');
 writeln('                                               ');
 writeln('                                                        ');
 writeln('                                                      ');
 writeln('                                               ');
 writeln('                                                 ');
 writeln('                                                       ');
 writeln('                                                  ');
 writeln('                                         ');
end;
 
procedure Demo;
begin
 textcolor(7);
 gotoxy(10,10);
 write('Toto');delay(500);
 write(' su');delay(500);
 write(' lety');delay(500);
 write(' vesmirnej');delay(500);
 write(' lode');delay(500);
 write(' ENTERPRISE,');delay(500);
 write(' ktora');delay(500);
 write(' ma trvale');delay(500);
 writeln(' poslanie,');delay(500);
 write('               poznavat');delay(500);
 write(' nove svety');delay(500);
 write(' a hladat');delay(500);
 write(' nove formy'); delay(500);
 write(' zivota.');delay(5000);
end;
 
procedure Guns;
begin
 clrscr;
 textcolor(10);
 writeln;
 writeln;
 writeln;
 writeln('           ͻ');
 writeln('                                -O-VLADACI PANEL                       ');
 writeln('           ͹');
 writeln('             Ŀ                                ');
 writeln('               -P-HOTONOVE TORPEDA        ');
 writeln('                                             ');
 writeln('             Ŀ                                ');
 writeln('                     P-H-ASERY            ');
 writeln('                                             ');
 writeln('             Ŀ                                ');
 writeln('                     -S-TITY              ');
 writeln('                                             ');
 writeln('             Ŀ                                ');
 writeln('                  -T-RANSPORTER           ');
 writeln('                                             ');
 writeln('           ͼ');
end;
 
procedure Kokpit;
begin
 clrscr;
 textcolor(3);
 writeln('ͻ');
 writeln('  ENERGIA                                                       STAV STITOV  ');
 writeln('               .......    Ŀ    .......               ');
 writeln('              .......               *      .      .......              ');
 writeln('              .......      *            .          .......              ');
 writeln('              .......         .           *        .......              ');
 writeln('              .......     .                .      .......              ');
 writeln('              .......             .    .           .......              ');
 writeln('              .......      .   *            *       .......              ');
 writeln('              .......      *    .     *     .     .......              ');
 writeln('              .......        .......              ');
 writeln('    /\    ');
 writeln('  /   ͻ      ͻ      ͻ   \  ');
 writeln('/                                                                   \');
 writeln('                                                                     ');
 writeln('      ͼ      ͼ      ͼ      ');
 writeln('Ķ');
 writeln(' -O-VLADACI PANEL           PALUBNY -D-ENNIK                     ');
 writeln(' NASTAVENIE -R-YCHLOSTI     NADVIAZAT KON-T-AKT                    ');
 writeln(' VESMIRNA -M-APA            OSETRO-V-NA                          ');
 writeln(' STAV MOTO-R-OV           Ĵ                  ');
 writeln(' STANDART OR-B-IT          RYCHLOST:0                            ');
 writeln(' NASTAVENIE -K-URSU        STAV STITOV:        %                   ');
 writeln('ͼ');
 gotoxy(44,23);
end;
 
procedure Mapa;
begin
 clrscr;
 textcolor(14);
 writeln('ͻ');
 writeln('                                                                   ');
 writeln('                                                                   ');
 writeln('Ķ');
 writeln('                                                                   ');
 writeln('                                                                   ');
 writeln('Ķ');
 writeln('                                                                   ');
 writeln('                                                                   ');
 writeln('Ķ');
 writeln('                                                                   ');
 writeln('                                                                   ');
 writeln('Ķ');
 writeln('                                                                   ');
 writeln('                                                                   ');
 writeln('Ķ');
 writeln('                                                                   ');
 writeln('                                                                   ');
 writeln('Ķ');
 writeln('                                                                   ');
 writeln('                                                                   ');
 writeln('Ķ');
 writeln('                                                                   ');
 writeln('ͼ');
end;
 
procedure Demo3;
begin
 clrscr;
 textcolor(3);
 textbackground(0);
 clrscr;
 gotoxy(30,12);write('DIMOVsoft. present');
 delay(3000);
 clrscr;
 textcolor(9);
 sound(150);
 
 for i:=1 to 6 do writeln;
 writeln('                                                 ');
 writeln('                                                         ');
 writeln('                                         ');
 writeln('                                            ');
 writeln('                                                 ');
 writeln('                                                   ');
 writeln('                                   ');
 writeln;
 writeln('                              THE NEXT GENERATION                            ');
 writeln;
 
 delay(1000);
 nosound;
 sound(200);
 gotoxy(35,23);write('LOADING...');
 delay(2000);
 nosound;
 clrscr;
 demo;
 delay(3000);
 clrscr;
 textcolor(8);
 
 for i:=1 to 40 do begin
     gotoxy(i, 8);write('                                  ');
     gotoxy(i, 9);write('                     ');
     gotoxy(i,10);write('            ');
     gotoxy(i,11);write('                           ');
     gotoxy(i,12);write('                                ');
     gotoxy(i,13);write('                     ');
     gotoxy(i,14);write('                        ');
     delay(100);
    end;
end;
 
BEGIN
 Demo3;
 delay(2000);
 Menu;
 if (mm=1) then begin
    Kokpit;
    Pause;
    Guns;
    Pause;
    clrscr;
    Mapa;
    Pause;
   end;
 clrscr;
 GameOver;
 Pause;
END.