program bomby;
uses graph,crtp2,dos;
var p1,zb,p2,p3,ty,a,c,d,h,v,b,konec,s,stav,pocet:integer;
    size,body:word;
    body1:string;
    txt:array[1..15] of string;
    zn:char;
    p,po,poi:pointer;
    r:registers;
    fi:text;
    bomba:array[1..5] of record
                         a:integer;
                         b:integer;
                         end;

label kop;
const hlaska:array[0..22] of string [16] =
     ((''),
      ('Zaciname...'),
      ('Absolutni nula'),
      ('Nula'),
      ('To snad ne...'),
      ('Hodne chaby'),
      ('Podprumerny'),
      ('Horsi prumer'),
      ('Prumer'),
      ('Lepsi prumer'),
      ('Jde to'),
      ('Dobry'),
      ('Dost dobry'),
      ('Hodne dobry'),
      ('Super'),
      ('Bomba'),
      ('Absolutni bomba'),
      ('Totalni bomba'),
      ('???'),
      ('!!!!!'),
      ('Hey, to staci !'),
      ('Uz jsi to vyhral'),
      ('No tak zastav !!!'));

procedure mouse (var button,horiz,vert:integer);
          begin
          r.ax:=3;
          intr ($33,r);
          button:=r.bx;
          horiz:=r.cx div 3;
          vert:=r.dx;
          end;
begin
stav:=1;
randomize;
for p1:=1 to 4 do begin
                  bomba[p1].a:=random(200)+220;
                  bomba[p1].b:=0-((p1)*110);
                  end;
p1:=0;
p2:=0;
initgraph (p1,p2,'system');
kop:
cleardevice;
assign (fi,'hlmenu.gra');
reset (fi);
for a:=0 to 224 do
    for b:=0 to 566 do begin
        read (fi,zn);
        putpixel (b+37,a,ord (zn));
    end;
setlinestyle (0,0,3);
delay (130);
line (100,270,539,282);
delay (130);
line (110,450,535,447);
delay (130);
line (107,282,121,439);
delay (130);
line (530,279,545,430);
settextstyle (5,0,5);
outtextxy (140,280,'1 ............. Hraj !');
outtextxy (150,330,'2 ......... Precti si...');
outtextxy (160,380,'3 ........... Konec');
while keypressed do readkey;
repeat
zn:=readkey;
until (zn='1') or (zn='2') or (zn='3');
case zn of
'1' : begin
setlinestyle (0,0,1);
cleardevice;
settextstyle (0,0,0);
setcolor (15);
setfillstyle (1,7);
fillellipse (4,7,4,4);
{setcolor (8);
circle (3,6,2);}
setcolor (8);
circle (3,6,1);
setcolor (15);
circle (4,7,4);
putpixel (4,2,15);
putpixel (4,1,15);
putpixel (5,0,15);
putpixel (6,0,15);
putpixel (7,0,15);
putpixel (8,0,15);
putpixel (9,1,15);
putpixel (8,0,14);
putpixel (9,0,14);
Size := ImageSize(0,0,9,11);
GetMem(P, Size);
getimage (0,0,9,11,p^);
for s:=1 to 5 do begin
cleardevice;
setfillstyle (8,1);
bar (185,0,475,479);
for p1:=0 to 27 do putimage (180+(p1*10),1,p^,normalput);
for p1:=0 to 27 do putimage (185+(p1*10),15,p^,normalput);
for p1:=0 to 27 do putimage (180+(p1*10),30,p^,normalput);
setfillstyle (9,1);
bar (0,0,185,479);
setfillstyle (9,1);
bar (450,0,639,479);
setfillstyle (0,0);
bar (490,3,520,475);
setwritemode (0);
rectangle (0,0,639,479);
rectangle (0,0,185,479);
rectangle (450,0,639,479);
rectangle (490,3,520,475);
rectangle (0,170,185,220);
setfillstyle (1,0);
bar (0,170,185,220);
rectangle (0,170,185,220);
bar (40,170,145,140);
rectangle (40,170,145,140);
str (body,body1);
outtextxy (105,150,body1);
outtextxy (55,150,'score:');

bar (40,220,145,250);
rectangle (40,220,145,250);
zb:=336-(body mod 336);
str (zb,body1);
outtextxy (105,230,body1);
outtextxy (55,230,'zbyva:');
setcolor (9);
outtextxy (92-(length(hlaska[stav-1])*4),178,hlaska[stav-1]);
setcolor (14);
outtextxy (92-(length(hlaska[stav])*4),191,hlaska[stav]);
setcolor (9);
outtextxy (92-(length(hlaska[stav+1])*4),204,hlaska[stav+1]);
setcolor (15);
{str (5-s,body1);
outtextxy (105,244,body1);}
setfillstyle (5,14);
for p3:=0 to 5-s do fillellipse (108+(p3*8),287,3,3);
outtextxy (55,284,'lives:');
mouse(b,h,v);
setwritemode(1);
{for a:=1 to pocet do putimage (500,a*13,p^,xorput);}
line (h+200,450,h+225,450);
setwritemode (0);
setfillstyle (8,1);
settextstyle (7,0,9);
outtextxy (290,200,'3');
delay (500);
bar (280,200,360,300);
outtextxy (290,200,'2');
delay (500);
bar (280,200,360,300);
outtextxy (295,200,'1');
delay (500);
bar (280,200,360,300);
setwritemode (1);
settextstyle (0,0,0);
repeat
if keypressed then begin
   zn :=readkey;
   if zn=chr(27) then halt;
   end;
setwritemode(1);
line (h+200,450,h+225,450);
mouse(b,h,v);
setcolor (15);
line (h+200,450,h+225,450);
for p2:=1 to 4 do begin
                  nosound;
                  putimage (bomba[p2].a,bomba[p2].b,p^,xorput);
                  bomba[p2].b:=bomba[p2].b+1;
                  if (bomba[p2].b=438) and (bomba[p2].a>h+195) and (bomba[p2].a<h+226) then begin
                                          pocet:=pocet+1;
                                          body:=body+25;
                                          setfillstyle (0,0);
                                          bar (1,171,184,219);
                                          stav := body div 336 + 1;
                                          if stav > 22  then stav :=22;
                                          setcolor (9);
                                          outtextxy (92-(length(hlaska[stav-1])*4),178,hlaska[stav-1]);
                                          setcolor (14);
                                          outtextxy (92-(length(hlaska[stav])*4),191,hlaska[stav]);
                                          setcolor (9);
                                          outtextxy (92-(length(hlaska[stav+1])*4),204,hlaska[stav+1]);
                                          setcolor (15);
                                          str (body,body1);
                                          setfillstyle (0,0);
                                          bar (100,150,144,159);
                                          outtextxy (105,150,body1);
                                          bar (101,225,144,245);
                                          zb:=336-(body mod 336);
                                          str (zb,body1);
                                          outtextxy (105,230,body1);
                                          if pocet=35 then begin;
                                          putimage (500,pocet*13,p^,xorput);
                                          outtextxy (40,334,'B O N U S  ! ! !');
                                          for a:=pocet downto 1 do begin
                                                                   putimage (500,a*13,p^,xorput);
                                                                   body:=body+7;
                                                                   str (body,body1);
                                                                   setfillstyle (0,0);
                                                                   bar (100,150,144,159);
                                                                   outtextxy (105,150,body1);
                                          setfillstyle (0,0);
                                          bar (1,171,184,219);
                                          stav := body div 336 + 1;
                                          if stav > 22  then stav :=22;
                                          setcolor (9);
                                          outtextxy (92-(length(hlaska[stav-1])*4),178,hlaska[stav-1]);
                                          setcolor (14);
                                          outtextxy (92-(length(hlaska[stav])*4),191,hlaska[stav]);
                                          setcolor (9);
                                          outtextxy (92-(length(hlaska[stav+1])*4),204,hlaska[stav+1]);
                                          setcolor (15);
                                          str (body,body1);
                                          setfillstyle (0,0);
                                          bar (100,150,144,159);
                                          outtextxy (105,150,body1);
                                          bar (101,225,144,245);
                                          zb:=336-(body mod 336);
                                          str (zb,body1);
                                          outtextxy (105,230,body1);
{                                                                   for p3:=125 to 175 do begin
                                                                                         sound (p3*2);
                                                                                         delay (1);
                                                                                         end;
{                                                                  sound (250);
                                                                   delay (2);
                                                                   sound (260);
                                                                   delay (2);
                                                                   sound (270);
                                                                   delay (2);
                                                                   sound (280);
                                                                   delay (2);
                                                                   sound (290);
                                                                   delay (2);
                                                                   sound (300);
                                                                   delay (2);
                                                                   sound (310);
                                                                   delay (2);
                                                                   sound (320);
                                                                   delay (2);
                                                                   sound (330);
                                                                   delay (2);
                                                                   sound (340);
                                                                   delay (2);
                                                                   sound (350);
                                                                   delay (2);}
                                                                   nosound;
                                                                   delay (65);
                                                                   end;
                                          pocet:=1;
                                          setfillstyle (9,1);
                                          bar (40,334,169,350);
                                          end;
                                          putimage (500,pocet*13,p^,xorput);
                                          SOUND (400);
                                          bomba[p2].a:=random(200)+220;
                                          bomba[p2].b:=0+random(20);
                                          end;
                  if (bomba[p2].b=479) then begin
                                            setcolor (14);
                                            for p1:=1 to 100 do begin
                                                                circle (bomba[p2].a,477,p1*2);
                                                                delay (2);
                                                                end;
                                            setcolor (0);
                                            setcolor (15);
                                            nosound;
{                                            setbkcolor (7);
                                            delay (20);
                                            cleardevice;
                                            setbkcolor (0);
                                            delay (100);
                                            setbkcolor (15);
                                            delay (20);
                                            setbkcolor (0);
                                            delay (200);
                                            delay (50);
                                            delay (200);
                                            delay (50);
                                            delay (50);
                                            setbkcolor (7);
                                            delay (10);
                                            setbkcolor (8);
                                            delay (80);
                                            setbkcolor (0);
                                            delay (30);
                                            delay (90);
                                            delay (100);
                                            setbkcolor (8);
                                            delay (20);
                                            setbkcolor (0);
                                            delay (200);}
                                            konec:=1;
for p1:=1 to 4 do begin
                  bomba[p1].a:=random(200)+220;
                  bomba[p1].b:=0-((p1)*110);
                  end;
                                            end;
                  putimage (bomba[p2].a,bomba[p2].b,p^,xorput);
                  delay (1);
                  end;
{delay (1);}
until konec=1;
konec:=0;
pocet:=0;
end;
end;
'2':begin
cleardevice;
settextstyle (2,0,7);
txt[3] :='         Informace o programu  B O M B Y';
txt[4] :='  ';
txt[5] :='Hra BOMBY ma velmi jednoducha pravidla. Cilem hry je';
txt[6] :='(co jineho) zachranit planetu Zemi. Na ni totiz nez-';
txt[7] :='namy utocnik hazi bomby. Vam nezbyva nez je vsechny ';
txt[8] :='pochytat. Hra je napsana v paskalu a je volne siri- ';
txt[9] :='telna. Program pro svuj beh potrebuje 386 s 4 MB   ';
txt[10] :='RAM. Chcete-li se mnou spolupracovat, piste na adre-';
txt[11] :='su :  Pavel Kopecky';
txt[12] :='      Mazancova 3055';
txt[13] :='      143 00  Praha 4 - Modrany';
setcolor (6);
outtextxy (0,1*24+40,txt[1]);
delay (70);
setcolor (14);
outtextxy (0,1*24+40,txt[1]);
delay (100);

for a:=2 to 15 do begin
for b:=1 to length(txt[a]) do begin
 setcolor (15);
 settextstyle (2,0,5);
 outtextxy (b*12,a*24+40,txt[a,b]);
 delay (40);
 setcolor (0);
 settextstyle (2,0,5);
 outtextxy (b*12,a*24+40,txt[a,b]);
 setcolor (15);
 settextstyle (2,0,7);
 outtextxy (b*12,a*24+40,txt[a,b]);
 if txt[a,b]<>' ' then begin
 sound (ord(txt[a,b]));
 delay (1);
 nosound;
 delay (40);
 end else delay (30);
 end;
end;
readkey;
goto kop;
end;
'3':begin
cleardevice;
for a:=1 to 8 do begin
setcolor (15);
settextstyle (3,0,a);
outtextxy (100,150,'Opravdu ?!');
delay (30);
end;
delay (70);
for a:=1 to 7 do begin
delay (30);
setcolor (0);
settextstyle (3,0,a);
outtextxy (100,150,'Opravdu ?!');
end;
settextstyle (3,0,8);
setcolor (15);
outtextxy (100,150,'Opravdu ?!');
delay (60);
settextstyle (3,0,6);
setcolor (8);
outtextxy (185,235,'Ano/Ne');
delay (100);
setcolor (7);
outtextxy (185,235,'Ano/Ne');
repeat
zn:=readkey;
until (zn='a') or (zn='A') or (zn='n') or (zn='N');
if (zn='n') or (zn='N') then begin
   setcolor (15);
   goto kop
   end;
end;
end;
end.

