{$M 2024,0,176400}

program week;

uses crush13h,crt,mse_tp,sound;

var muzak,font : integer;
    x,y:integer;
    c:char;

procedure terminate;
begin
     if font=1 then unloadfont(1);

     closevirt;
     video_mode ( 03);

     if muzak=1 then
     begin
     stopmusic;
     stopoutput;
     unloadmodule;
     freemse;
     end;

     cls (0,vga);

     writeln ('000000000000000000000000000000000000000000000');
     writeln ('001000100001110000111100001001000001000001100');
     writeln ('001000100010001000100010001010000001000001100');
     writeln ('000101000010001000100010001100000010100001100');
     writeln ('000101000010001000100010001100000011100000000');
     writeln ('000010000010001000100010001010000100010001100');
     writeln ('000010000001110000111100001001000100010001100');
     writeln ('000000000000000000000000000000000000000000000');
     writeln ('Take a wild guess at what i like drinking...');
     halt;
end;



begin
     muzak:=2;
     writeln ('Esc   means silence...');
     writeln ('Enter means dolby sound surround where available (in selected theatres only!)...');
     writeln ('You DID run setup first right? (DUH!)');
     repeat
     c:=readkey;
     if c=#27 then muzak:=0;
     if c=#13 then muzak:=1;
     until muzak<>2;
     if muzak=1 then readconfig ('sound.dat');
     if muzak=1 then loadmodule('southern.gdm');
     if muzak=1 then startmusic;

     loadfont ('b17x22.fnt',1);
     font:=1;

     video_mode ( $13);
     initvirt;
     c:=' ';

     cls (0,vp[1]);
     putstring (10,175,132,17,0,'wait!',1,vp[1]);

     move (mem[vp[1]:0],mem[vga:0],64000);

     loadpcx ('cloud2.pcx',vp[2]);

     {for y:=0 to 140 do
         begin
              for x:=0 to 319 do
              begin
                   mem[vp[1]:x+y*320]:=y*2;
              end;
         end;

     for y:=128 to 199 do
         begin
              for x:=0 to 319 do
              begin
                   mem[vp[1]:x+y*320]:=245-y;
              end;
        end;}

     move (mem[vp[2]:0],mem[vp[1]:0],64000);

     cls (0,vp[1]);
     putstring (10,175,132,17,0,'wait!',1,vp[1]);

     repeat

     if musicorder($FF)=1 then if musicrow=2 then putstring (10,10,132,17,0,'vodka rules!',1,vp[1]);
     if musicorder($FF)=2 then if musicrow=2 then putstring (10,35,132,17,0,'vodka/lemon',1,vp[1]);
     if musicorder($FF)=3 then if musicrow=2 then putstring (10,60,132,17,0,'vodka/orange',1,vp[1]);
     if musicorder($FF)=4 then if musicrow=2 then putstring (10,85,132,17,0,'vodka/melon',1,vp[1]);
     if musicorder($FF)=5 then if musicrow=2 then putstring (10,110,132,17,0,'vodka/pisang',1,vp[1]);
     if musicorder($FF)=6 then if musicrow=2 then putstring (10,135,132,17,0,'vodka/tequilla',1,vp[1]);
     if musicorder($FF)=7 then if musicrow=2 then putstring (10,160,132,17,0,'vodka/gold strike',1,vp[1]);
     if musicorder($FF)=8 then if musicrow=2 then putstring (10,10,132,17,0,'vodka/baileys',1,vp[1]);
     if musicorder($FF)=9 then if musicrow=2 then putstring (10,35,132,17,0,'vodka/vodka',1,vp[1]);
     if musicorder($FF)=10 then if musicrow=2 then putstring (10,60,132,17,0,'vodka/abesinto',1,vp[1]);
     if musicorder($FF)=11 then if musicrow=2 then putstring (10,85,132,17,0,'vodka/whiskey',1,vp[1]);
     if musicorder($FF)=12 then if musicrow=2 then putstring (10,110,132,17,0,'vodka/martini',1,vp[1]);
     if musicorder($FF)=13 then if musicrow=2 then putstring (10,135,132,17,0,'vodka/ice',1,vp[1]);
     if musicorder($FF)=14 then if musicrow=2 then putstring (10,160,132,17,0,'vodka/shot',1,vp[1]);
     if musicorder($FF)=15 then if musicrow=2 then putstring (10,10,132,17,0,'vodka/long',1,vp[1]);
     if musicorder($FF)=16 then if musicrow=2 then putstring (10,35,132,17,0,'vodka/straight up',1,vp[1]);
     if musicorder($FF)=17 then if musicrow=2 then putstring (10,60,132,17,0,'vodka/red wine',1,vp[1]);
     if musicorder($FF)=18 then if musicrow=2 then putstring (10,85,132,17,0,'vodka/white wine',1,vp[1]);
     if musicorder($FF)=19 then if musicrow=2 then putstring (10,110,132,17,0,'vodka/oporto wine',1,vp[1]);
     if musicorder($FF)=20 then if musicrow=2 then putstring (10,135,132,17,0,'vodka/music',1,vp[1]);
     if musicorder($FF)=21 then if musicrow=2 then putstring (10,160,132,17,0,'vodka/concert',1,vp[1]);
     if musicorder($FF)=22 then if musicrow=2 then putstring (10,10,132,17,0,'vodka/love',1,vp[1]);
     if musicorder($FF)=23 then if musicrow=2 then putstring (10,35,132,17,0,'vodka/4ever!',1,vp[1]);

     if musicorder($FF)=1 then if musicrow=32 then putstring (10,35,132,17,0,'what a week!',1,vp[1]);
     if musicorder($FF)=2 then if musicrow=32 then putstring (10,60,132,17,0,'after 7 days party!',1,vp[1]);
     if musicorder($FF)=3 then if musicrow=32 then putstring (10,85,132,17,0,'i cant sleep...',1,vp[1]);
     if musicorder($FF)=4 then if musicrow=32 then putstring (10,110,132,17,0,'so, i tell you',1,vp[1]);
     if musicorder($FF)=5 then if musicrow=32 then putstring (10,135,132,17,0,'a short story:',1,vp[1]);
     if musicorder($FF)=6 then if musicrow=32 then putstring (10,160,132,17,0,'music pounding',1,vp[1]);
     if musicorder($FF)=7 then if musicrow=32 then putstring (10,10,132,17,0,'vodka in my veins',1,vp[1]);
     if musicorder($FF)=8 then if musicrow=32 then putstring (10,35,132,17,0,'my mind is gone',1,vp[1]);
     if musicorder($FF)=9 then if musicrow=32 then putstring (10,60,132,17,0,'adrenaline rushing',1,vp[1]);
     if musicorder($FF)=10 then if musicrow=32 then putstring (10,85,132,17,0,'people jumping',1,vp[1]);
     if musicorder($FF)=11 then if musicrow=32 then putstring (10,110,132,17,0,'people falling',1,vp[1]);
     if musicorder($FF)=12 then if musicrow=32 then putstring (10,135,132,17,0,'people laughing',1,vp[1]);
     if musicorder($FF)=13 then if musicrow=32 then putstring (10,160,132,17,0,'people smilling',1,vp[1]);
     if musicorder($FF)=14 then if musicrow=32 then putstring (10,10,132,17,0,'another shot...',1,vp[1]);
     if musicorder($FF)=15 then if musicrow=32 then putstring (10,35,132,17,0,'stand still!',1,vp[1]);
     if musicorder($FF)=16 then if musicrow=32 then putstring (10,60,132,17,0,'music pounding',1,vp[1]);
     if musicorder($FF)=17 then if musicrow=32 then putstring (10,85,132,17,0,'louder and louder',1,vp[1]);
     if musicorder($FF)=18 then if musicrow=32 then putstring (10,110,132,17,0,'in my head...',1,vp[1]);
     if musicorder($FF)=19 then if musicrow=32 then putstring (10,135,132,17,0,'i love vodka!',1,vp[1]);
     if musicorder($FF)=20 then if musicrow=32 then putstring (10,160,132,17,0,'k0de: psychic',1,vp[1]);
     if musicorder($FF)=21 then if musicrow=32 then putstring (10,10,132,17,0,'music: dune',1,vp[1]);
     if musicorder($FF)=22 then if musicrow=32 then putstring (10,35,132,17,0,'dune is a god! ;)',1,vp[1]);
     if musicorder($FF)=23 then if musicrow=32 then putstring (10,60,132,17,0,'get his work...',1,vp[1]);

     for y:=0 to 199 do
         begin
              for x:=0 to 319 do
              begin
                   if mem[vp[1]:x+y*320]>mem[vp[2]:x+y*320] then mem[vp[1]:x+y*320]:=mem[vp[1]:x+y*320]-1;
                   if mem[vp[1]:x+y*320]>mem[vp[2]:x+y*320] then mem[vp[1]:x+y*320]:=mem[vp[1]:x+y*320]-1;
                   if mem[vp[1]:x+y*320]<mem[vp[2]:x+y*320] then mem[vp[1]:x+y*320]:=mem[vp[1]:x+y*320]+1;
                   if mem[vp[1]:x+y*320]<mem[vp[2]:x+y*320] then mem[vp[1]:x+y*320]:=mem[vp[1]:x+y*320]+1;
              end;
         end;

     move (mem[vp[1]:0],mem[vga:0],64000);

     if keypressed=true then c:=readkey;
     if musicorder($FF)=23 then if musicrow>50 then terminate;
     until c=#27;

     terminate;
end.