home *** CD-ROM | disk | FTP | other *** search
/ PC & Mediji 1996 July / PCM_9607.iso / igre / dos / ettv / ettv.pas < prev    next >
Pascal/Delphi Source File  |  1996-05-18  |  101KB  |  3,387 lines

  1. program fly_inside;
  2. {$M $4000,0,300000 }
  3. uses dos,crt, VOCs;
  4. label next_level,fly_again,escape,jump_over;
  5. type screen=array[0..65499] of byte;
  6.      yesno=array[1..90,1..240] of byte;
  7.      enemy1=array[1..28,1..50] of byte;
  8.      enemy2=array[1..22,1..60] of byte;
  9.      enemy3=array[1..10,1..51] of byte;
  10.      enemy4=array[1..38,1..29] of byte;
  11.      enemy5=array[1..26,1..53] of byte;
  12.      enemy6=array[1..29,1..48] of byte;
  13.      enemy7=array[1..29,1..59] of byte;
  14.      enemy8=array[1..31,1..64] of byte;
  15.      menemy1=array[1..103,1..79] of byte;
  16.      menemy2=array[1..140,1..115] of byte;
  17.      menemy3=array[1..127,1..120] of byte;
  18.      missile=array[1..10,1..25] of byte;
  19.      gun=array[1..7,1..37] of byte;
  20.      facna=array[1..15,1..16] of byte;
  21.      lvlcmp=array[1..75,1..248] of byte;
  22.      meteor1=array[1..47,1..69] of byte;
  23.      meteor2=array[1..21,1..38] of byte;
  24.      meteor3=array[1..22,1..39] of byte;
  25.      meteor4=array[1..25,1..43] of byte;
  26.      meteor5=array[1..36,1..43] of byte;
  27.      { SOUND TYPES }
  28.      chntype=1..6;
  29.      boolnum=0..1;
  30.      halfbyte=0..15;
  31.      sound_record=record
  32.        sound_page:word;
  33.        channel:chntype;
  34.        shape:word;
  35.        m,s,st:byte;
  36.        msb,oct:byte;
  37.        lsb:array[1..2] of char;
  38.        played:boolean;
  39.      end;
  40.      sound_shape_record=record
  41.        name:string[8];
  42.        am,vib:boolean;
  43.        ar1,dr1,ar2,dr2:0..15;
  44.      end;
  45. const pcy=15;
  46.       pcx=50;
  47.       enemy_num=100;
  48.       { SOUND CONST }
  49.       chop1:array[chntype] of byte=(0,1,2,8,9,$A);
  50.       chop2:array[chntype] of byte=(3,4,5,$B,$C,$D);
  51.       limit_of_sounds=999;
  52.       limit_of_shapes=96;
  53.       limit_of_pages=60;
  54.       max_page_length=100;
  55.       mm=2;
  56. var hole,e_whole_damage,major_st,i,j,ei,ej,x,y,ch_pal_pos:word;
  57.     msnum,crashed,level,main_dead,damage,fire_delay,missile_delay,flame_lenght,px,py,ch:byte;
  58.     mx,my,mdx,mdy:word;
  59.     nx,ny,ox,oy,dx,dy,m_pause:integer;
  60.     bonus:byte;
  61.     db:shortint;
  62.     score,hiscore:longint;
  63.     reg:registers;
  64.     keyboard,joystick,mouse,flyagain,moved,over:boolean;
  65.     num:array[32..100,1..7] of word;
  66.     bnum:array[32..90,1..7] of word;
  67.     parts:array[0..9,0..1,0..1] of byte;
  68.     pic:^screen;
  69.     plane:array[1..15,1..50] of byte;
  70.     firey:array[1..100] of byte;
  71.     firex:array[1..100] of word;
  72.     sx:array[1..200] of integer;
  73.     sy,sd:array[1..200] of byte;
  74.     ch1,ch2,ch3:char;
  75.     t:text;
  76.     mouse_cursor:array[1..5,1..5] of byte;
  77.     box:byte;
  78.     bmx,bmy:integer;
  79.     best_players:array[1..10] of record
  80.                                    name:string[6];
  81.                                    score:longint;
  82.                                  end;
  83.     name:array[1..6] of char;
  84.     number_of_the_best:word;
  85.     calibration_faze:byte;
  86.     jb1,jb2:byte;
  87.     jx,jy,jcx,jcy,jminx,jminy,jmaxx,jmaxy:word;
  88.     slow_down:word;
  89.  
  90.     { ENEMIES }
  91.     e1:^enemy1;
  92.     e2:^enemy2;
  93.     e3p1,e3p2:^enemy3;
  94.     e4:^enemy4;
  95.     e5:^enemy5;
  96.     e6:^enemy6;
  97.     e7p1,e7p2:^enemy7;
  98.     e8:^enemy8;
  99.     m1:^menemy1;
  100.     m2:^menemy2;
  101.     m3:^menemy3;
  102.     mtr1:^meteor1;
  103.     mtr2:^meteor2;
  104.     mtr3:^meteor3;
  105.     mtr4:^meteor4;
  106.     mtr5:^meteor5;
  107.     ms:missile;
  108.     myms:missile;
  109.     mmiss:array[1..8,1..6] of byte;
  110.     brdr:array[1..20,1..97] of byte;
  111.     guns:array[1..5] of ^gun;
  112.     facne:array[1..5] of ^facna;
  113.     sign:^lvlcmp;
  114.     et:array[0..enemy_num] of byte;
  115.     ex,ey,esx,esy:array[1..enemy_num] of real;
  116.     e_existence,e_where_sy,e_damage:array[1..enemy_num] of word;
  117.     bonus_missile:array[1..enemy_num] of boolean;
  118.     st1:byte;
  119.     enemy_palette:array [0..127,1..3] of byte;
  120.     ef_x,ef_y,ef_dx,ef_dy:array[1..500] of integer;
  121.     ef_t:array[1..500] of byte;
  122.  
  123.     { EXPLOSION }
  124.     exp_x,exp_y,exp_dx,exp_dy:array[1..2500] of integer;
  125.     exp_t,exp_ty:array[1..2500] of byte;
  126.  
  127.     { TIME VARIABLES }
  128.     bu2:byte;
  129.     timer:longint;
  130.     su1,sm1,ss1,sst1:longint;
  131.     su2,sm2,ss2,sst2:longint;
  132.  
  133.     { SOUND VARIABLES }
  134.     page_length:1..max_page_length;
  135.     pages:1..limit_of_pages;
  136.     sounds:array[1..limit_of_sounds] of ^sound_record;
  137.     sound_st:longint;
  138.     shapes:array[1..limit_of_shapes] of ^sound_shape_record;
  139.     music_set:boolean;
  140.     sound_set:boolean;
  141.     volume:byte;
  142.     Fire1,Exp,FM: VOCDataRec;
  143.     Firepl,Exppl,FMpl: boolean;
  144.  
  145.     { KEYBOARD VARIABLES }
  146. const kbd_inited : boolean = false;
  147. var   key : array [0 .. 127] of boolean;
  148.       old_key : array [0 .. 127] of boolean;
  149.       last_key : byte;
  150.       old_9 : pointer;
  151.       value : byte;
  152.  
  153. procedure reset_kbd;
  154. (* restores normal keyboard interrupt routine call *)
  155. begin
  156.   if kbd_inited then
  157.   begin
  158.     kbd_inited := false;
  159.     setintvec (9, old_9);
  160.   end;
  161. end;
  162.  
  163. (*$F+*)
  164. procedure game_kbd_int; interrupt;
  165. (* new interrupt handling routine *)
  166. (*$F-*)
  167. begin
  168.   last_key := port [$60];
  169.   if last_key = 1 then reset_kbd; (* ESC ends emulation *)
  170.   value      := port [$61];
  171.   port [$61] := value or 128;
  172.   port [$61] := value;
  173.   port [$20] := $20;
  174.   if (last_key and 128) = 0
  175.     then key [last_key        ] := true
  176.     else key [last_key and 127] := false;
  177. end;
  178.  
  179. procedure init_kbd;
  180. (* initializes keyboard tables and keyboard interrupt procedure *)
  181. var i : integer;
  182. begin
  183.   if not kbd_inited then begin
  184.     kbd_inited := true;
  185.     getintvec (9, old_9);
  186.     setintvec (9, addr (game_kbd_int));
  187.     last_key := 0;
  188.     for i := 0 to 127 do key [i] := false;
  189.   end;
  190. end;
  191.  
  192. function exist( name : string ) : boolean;
  193. var
  194.   x : file;
  195. begin
  196.   assign( x, name );
  197.   {$I-}
  198.   reset( x );
  199.   {$I+}
  200.   if IOResult <> 0 then begin
  201.     exist := false;
  202.   end else begin
  203.     exist := true;
  204.     close(x);
  205.   end;
  206. end;
  207.  
  208. procedure beep;
  209. begin
  210.   sound(200);
  211.   delay(50);
  212.   nosound;
  213. end;
  214.  
  215. procedure uncomprx(str1:string;n:word);
  216. var i,st:word;
  217.     chnum:byte;
  218.     ch1,ch2:char;
  219.     mode:boolean;
  220. begin
  221.   assign(t,str1);
  222.   reset(t);
  223.   read(t,ch1);
  224.   chnum:=ord(ch1);
  225.   mode:=false;
  226.   st:=0;
  227.   while (st<n) do
  228.     if mode=false then
  229.     begin
  230.       read(t,ch1);
  231.       if ord(ch1)=chnum then mode:=true
  232.                         else
  233.                         begin
  234.                           pic^[st]:=ord(ch1);
  235.                           inc(st);
  236.                         end
  237.     end
  238.     else
  239.     begin
  240.       read(t,ch1);
  241.       if ord(ch1)=chnum then mode:=false
  242.                         else
  243.                         begin
  244.                           read(t,ch2);
  245.                           for i:=1 to ord(ch2) do
  246.                             pic^[st+i-1]:=ord(ch1);
  247.                           st:=st+ord(ch2);
  248.                         end
  249.     end;
  250.   close(t);
  251. end;
  252.  
  253. procedure numero(x,y:integer;vr,col:byte;over,in_mem:boolean;style:byte);
  254. var i,j:byte;
  255.     z:word;
  256. begin
  257.   for i:=1 to 7 do
  258.   begin
  259.     z:=num[vr,i];
  260.     for j:=1 to 5 do
  261.     begin
  262.       if in_mem then
  263.       begin
  264.         if over=true then if z mod 10>0 then mem[$A000:320*(y-1+i)+x+4-j]:=col else mem[$A000:320*(y-1+i)+x+4-j]:=0
  265.                      else if z mod 10>0 then mem[$A000:320*(y-1+i)+x+4-j]:=col;
  266.       end
  267.                 else
  268.         if over=true then if z mod 10>0 then pic^[320*(y-1+i)+x+4-j]:=col else pic^[320*(y-1+i)+x+4-j]:=0
  269.                      else if z mod 10>0 then pic^[320*(y-1+i)+x+4-j]:=col;
  270.       z:=z div 10;
  271.     end;
  272.     if style=1 then inc(col);
  273.     if style=2 then if i<=3 then dec(col) else inc(col);
  274.   end;
  275. end;
  276.  
  277. procedure outtextxy(x,y:word;string1:string;space,col:byte;over,in_mem:boolean;style:byte);
  278. var i,l:byte;
  279. begin
  280.   l:=length(string1);
  281.   for i:=1 to l do numero(x+(i-1)*space,y,ord(string1[i]),col,over,in_mem,style)
  282. end;
  283.  
  284. procedure mouttextxy(x,y:word;string1:string;space,col:byte);
  285. var i,l:byte;
  286. begin
  287.   l:=length(string1);
  288.   for i:=1 to l do numero(x+(i-1)*space,y,ord(string1[i]),col,false,false,1)
  289. end;
  290.  
  291. procedure signs(x,y:integer;vr:byte;col:byte);
  292. var i,j,k,l:integer;
  293.     z,x1,y1,y1320,i3,j3:word;
  294. begin
  295.   for i:=1 to 7 do
  296.   begin
  297.     i3:=y-1+i*2;
  298.     z:=bnum[vr,i];
  299.     for j:=1 to 5 do
  300.     begin
  301.       j3:=x+4-j*2;
  302.       if z mod 10>0 then
  303.       for k:=0 to 1 do
  304.         for l:=0 to 1 do
  305.           if parts[z mod 10,k,l]>0 then
  306.           begin
  307.             y1:=i3+k;
  308.             y1320:=320*y1;
  309.             x1:=j3+l;
  310.             if (x1>=0) and (x1<=319) and (y1>=0) and (y1<=199) then pic^[y1320+x1]:=128+col+12-2*abs((i*2+k)-8);
  311.           end;
  312.       z:=z div 10;
  313.     end;
  314.   end;
  315. end;
  316.  
  317. procedure options(x,y:word;string1:string;space:byte;col:byte);
  318. var i,l:byte;
  319. begin
  320.   l:=length(string1);
  321.   for i:=1 to l do signs(x+(i-1)*space,y,ord(string1[i]),col)
  322. end;
  323.  
  324. { SOUND STAFF }
  325. procedure ports(reg,byt:byte);
  326. var cnt,dummy:integer;
  327. begin
  328.   port[$388]:=reg;
  329.   for cnt:=0 to 5 do dummy:=port[$388];
  330.   port[$389]:=byt;
  331.   for cnt:=0 to 34 do dummy:=port[$389];
  332. end;
  333.  
  334. procedure reset_card;     { ADLib total SOFT (silent) reset }
  335. var a,b:integer;
  336. begin
  337.   for b:=0 to 2 do
  338.     for a:=0 to $14 do
  339.     begin
  340.       ports($60+a,255);
  341.       ports($80+a,255);
  342.     end;
  343.   for a:=0 to $14 do
  344.   begin
  345.     ports($B0+a,0);
  346.     ports($c0+a,0);
  347.     ports($e0+a,0);
  348.   end;
  349.   ports($bd,0);
  350.   for b:=0 to 2 do
  351.     for a:=0 to $14 do
  352.     begin
  353.       ports($60+a,0);
  354.       ports($80+a,0);
  355.     end;
  356.   for a:=0 to $14 do ports($40+a,63);
  357.   ports(1,$20);
  358. end;
  359.  
  360. procedure detect_sb;
  361. var vr1,vr2:byte;
  362. begin
  363.   ports(4,$60);
  364.   ports(4,$80);
  365.   vr1:=port[$388];
  366.   ports(2,$FF);
  367.   ports(4,$21);
  368.   delay(1);
  369.   vr2:=port[$388];
  370.   ports(4,$60);
  371.   ports(4,$80);
  372.   if (vr1 and $E0=00) and (vr2 and $E0=$C0) then writeln('SB/Adlib detected')
  373.                                             else writeln('SB/Adlib not detected');
  374. end;
  375.  
  376. procedure detect_mouse;
  377. begin
  378.   reg.ax:=0;
  379.   intr($33,reg);
  380.   if reg.ax=$FFFF then writeln('Mouse detected')
  381.                   else
  382.                   begin
  383.                     writeln('Mouse not detected');
  384.                     writeln;
  385.                     writeln('U can''t play this version of game without mouse!!!');
  386.                     writeln('Sorry!');
  387.                     halt(1);
  388.                   end;
  389. end;
  390.  
  391. procedure detect_VGA;
  392. begin
  393.   reg.ax:=$1A00;
  394.   intr($10,reg);
  395.   if reg.al=$1A then writeln('VGA detected')
  396.                   else
  397.                   begin
  398.                     writeln('VGA not detected');
  399.                     writeln;
  400.                     writeln('U can''t play this game without VGA graphics card!!!');
  401.                     writeln('Sorry!');
  402.                     halt(1);
  403.                   end;
  404. end;
  405.  
  406. procedure initialization;
  407. begin
  408.   for i:=1 to limit_of_sounds do
  409.     if sounds[i]^.sound_page>0 then
  410.       sounds[i]^.sound_page:=0;
  411.   for i:=1 to limit_of_shapes do
  412.   begin
  413.     shapes[i]^.name:='        ';
  414.     shapes[i]^.am:=false;
  415.     shapes[i]^.vib:=false;
  416.     shapes[i]^.ar1:=0;
  417.     shapes[i]^.dr1:=0;
  418.     shapes[i]^.ar2:=0;
  419.     shapes[i]^.dr2:=0;
  420.   end;
  421. end;
  422.  
  423. procedure load_song(mfile:string);
  424. var useless:char;
  425.     amn,vibn:byte;
  426.     line:byte;
  427. begin
  428.   initialization;
  429.   assign(t,mfile);
  430.   reset(t);
  431.   readln(t,pages,page_length);
  432.   while i<>0 do
  433.   begin
  434.     read(t,i);
  435.     if i>0 then
  436.       with shapes[i]^ do
  437.       begin
  438.         readln(t,useless,name,amn,vibn,ar1,dr1,ar2,dr2);
  439.         if amn=1 then am:=true else am:=false;
  440.         if vibn=1 then vib:=true else vib:=false;
  441.       end;
  442.   end;
  443.   i:=1;
  444.   while not(eof(t)) do
  445.   begin
  446.     with sounds[i]^ do
  447.       readln(t,sound_page,channel,line,shape,m,s,st,msb,oct,useless,lsb[1],lsb[2]);
  448.     inc(i);
  449.   end;
  450.   close(t);
  451. end;
  452.  
  453. procedure set_play_variables;
  454. var u1,m1,s1,st1:word;
  455. begin
  456.   for i:=1 to limit_of_sounds do
  457.     with sounds[i]^ do
  458.       if sound_page>0 then played:=false;
  459.   gettime(u1,m1,s1,st1);
  460.   su1:=u1;
  461.   sm1:=m1;
  462.   ss1:=s1;
  463.   sst1:=st1;
  464.   bu2:=0;
  465. end;
  466.  
  467. procedure set_sound_pointers;
  468. begin
  469.   for i:=1 to limit_of_sounds do new(sounds[i]);
  470.   for i:=1 to limit_of_shapes do new(shapes[i]);
  471. end;
  472.  
  473. var time1,time2:longint;
  474.  
  475. function izracunaj_cas:longint;
  476. var u2,m2,s2,st2:word;
  477. begin
  478.   gettime(u2,m2,s2,st2);
  479.   su2:=u2;
  480.   sm2:=m2;
  481.   ss2:=s2;
  482.   sst2:=st2;
  483.   if su2+bu2<su1 then bu2:=bu2+24;
  484.   time1:=su1*360000+sm1*6000+ss1*100+sst1;
  485.   time2:=(su2+bu2)*360000+sm2*6000+ss2*100+sst2;
  486.   izracunaj_cas:=time2-time1;
  487. end;
  488.  
  489. procedure soundt(channel:chntype;Fnum,Lnum:byte;oct:byte;am,vib:boolnum;ar1,dr1,ar2,dr2:halfbyte);
  490. begin
  491.     ports($B0+channel-1,0);
  492.     ports($20+chop1[channel],1+am*128+vib*64);
  493.     ports($40+chop1[channel],16);
  494.     ports($60+chop1[channel],ar1*16+dr1);
  495.     ports($80+chop1[channel],$77);
  496.     ports($A0+channel-1,Lnum);
  497.     ports($20+chop2[channel],1);
  498.     ports($40+chop2[channel],32-volume);
  499.     ports($60+chop2[channel],ar2*16+dr2);
  500.     ports($80+chop2[channel],$77);
  501.     ports($B0+channel-1,32+(Oct*4)+Fnum);
  502.     inc(sound_st);
  503. end;
  504.  
  505. procedure lover_volume;
  506. var i:byte;
  507. begin
  508.   if volume>0 then
  509.   begin
  510.     dec(volume);
  511.     for i:=1 to 6 do
  512.       ports($40+chop2[i],32-volume);
  513.   end;
  514. end;
  515.  
  516. procedure higher_volume;
  517. var i:byte;
  518. begin
  519.   if volume<32 then
  520.   begin
  521.     inc(volume);
  522.     for i:=1 to 6 do
  523.       ports($40+chop2[i],32-volume);
  524.   end;
  525. end;
  526.  
  527. var appointed_time:longint;
  528.  
  529. procedure repeat_at(m,s,st:longint);
  530. var u1,m1,s1,st1:word;
  531. begin
  532.   appointed_time:=m*6000+s*100+st;
  533.   if timer>=appointed_time then
  534.   begin
  535.     gettime(u1,m1,s1,st1);
  536.     su1:=u1;
  537.     sm1:=m1;
  538.     ss1:=s1;
  539.     sst1:=st1;
  540.     bu2:=0;
  541.     sound_st:=1;
  542.     for i:=1 to limit_of_sounds do
  543.       with sounds[i]^ do
  544.         if sound_page>0 then played:=false;
  545.   end;
  546. end;
  547.  
  548. procedure casovni_razpored;
  549. var lsbb:byte;
  550.     sh:1..limit_of_shapes;
  551.     ammod,vibrat:0..1;
  552. begin
  553.   {sound(hour,min,sec,hun,channel,fnum-most,fnum-least,octave,amset,vibset,
  554.          attack_rate1,decay_rate1,attack_rate2,decay_rate2 }
  555.   for i:=1 to limit_of_sounds do
  556.     with sounds[i]^ do
  557.     begin
  558.       if (sound_page>0) and (not(played)) then
  559.       begin
  560.          appointed_time:=m*6000+s*100+st;
  561.          if (timer>=appointed_time) then
  562.          begin
  563.            case lsb[1] of
  564.            '0'..'9':lsbb:=16*(ord(lsb[1])-48);
  565.            'A':lsbb:=160;
  566.            'B':lsbb:=176;
  567.            'C':lsbb:=192;
  568.            'D':lsbb:=208;
  569.            'E':lsbb:=224;
  570.            'F':lsbb:=240;
  571.            end;
  572.            case lsb[2] of
  573.            '0'..'9':lsbb:=lsbb+(ord(lsb[2])-48);
  574.            'A':lsbb:=lsbb+10;
  575.            'B':lsbb:=lsbb+11;
  576.            'C':lsbb:=lsbb+12;
  577.            'D':lsbb:=lsbb+13;
  578.            'E':lsbb:=lsbb+14;
  579.            'F':lsbb:=lsbb+15;
  580.            end;
  581.            sh:=shape;
  582.            if shapes[sh]^.am=true then ammod:=1 else ammod:=0;
  583.            if shapes[sh]^.vib then vibrat:=1 else vibrat:=0;
  584.            soundt(channel,msb,lsbb,oct,ammod,vibrat,shapes[shape]^.ar1,shapes[sh]^.dr1,shapes[sh]^.ar2,shapes[sh]^.dr2);
  585.            played:=true;
  586.         end;
  587.       end;
  588.     end;
  589.   repeat_at(0,page_length * pages div 10,page_length * pages mod 10 * 10);
  590. end;
  591.  
  592. { SOUND STAFF }
  593.  
  594. procedure omejitev_miske(x1,y1,x2,y2:word);
  595. begin
  596.   reg.ax:=7;
  597.   reg.cx:=x1;
  598.   reg.dx:=x2;
  599.   intr($33,reg);
  600.   reg.ax:=8;
  601.   reg.cx:=y1;
  602.   reg.dx:=y2;
  603.   intr($33,reg);
  604. end;
  605.  
  606. procedure set_mouse(x,y:word);
  607. begin
  608.   reg.ax:=4;
  609.   reg.cx:=x;
  610.   reg.dx:=y;
  611.   intr($33,reg);
  612. end;
  613.  
  614. procedure read_mouse_cursor;
  615. var i,j:word;
  616. begin
  617.   assign(t,'GFX\CURSOR.DAT');
  618.   reset(t);
  619.   for i:=1 to 5 do
  620.   begin
  621.     for j:=1 to 5 do
  622.     begin
  623.       read(t,ch1);
  624.       if ord(ch1)>0 then mouse_cursor[i,j]:=ord(ch1)-2
  625.                     else mouse_cursor[i,j]:=0
  626.     end;
  627.     readln(t);
  628.   end;
  629.   close(t);
  630. end;
  631.  
  632. procedure setpall(i,a,b,c:byte);
  633. begin
  634.     port[$03C8]:=i;
  635.     port[$03C9]:=c;
  636.     port[$03C9]:=a;
  637.     port[$03C9]:=b;
  638. end;
  639.  
  640. procedure make_bck;
  641. var i:word;
  642.     st:real;
  643.     x,y:real;
  644. begin
  645.   st:=0;
  646.   i:=0;
  647.   repeat
  648.     x:=sin(st)*(i div 2)+160;
  649.     y:=cos(st)*(i div 3)+100;
  650.     st:=st+0.001;
  651.     inc(i);
  652.     pic^[320*(trunc(y) mod 200)+(trunc(x) mod 320)]:=63;
  653.     if st*10=trunc(st*10) then
  654.     begin
  655.       timer:=izracunaj_cas;
  656.       casovni_razpored;
  657.     end;
  658.   until st>5*pi;
  659. end;
  660.  
  661. procedure fill_emptiness;
  662. var i,j,vs:word;
  663.     t:text;
  664. begin
  665.   for i:=0 to 63999 do
  666.   begin
  667.     j:=i mod 320;
  668.     vs:=0;
  669.     if i > 319 then vs:=pic^[i-320];
  670.     if i < 63680 then vs:=vs+pic^[i+320];
  671.     if j > 0 then vs:=vs+pic^[i-1];
  672.     if j < 319 then vs:=vs+pic^[i+1];
  673.     vs:=vs div 4;
  674.     pic^[i]:=vs;
  675.   end;
  676.   move(pic^[0],mem[$A000:0000],64000);
  677. end;
  678.  
  679. procedure show_best;
  680. var i,j:byte;
  681.     m:longint;
  682.     col:byte;
  683. begin
  684.   outtextxy(120,20,'HALL OF FAME',6,75,false,true,1);
  685.   for i:=1 to 10 do
  686.   begin
  687.     if number_of_the_best=i then col:=92-i else col:=75-i;
  688.     outtextxy(80,30+15*i,best_players[i].name,6,col,false,true,1);
  689.     m:=100000;
  690.     for j:=1 to 13 do numero(111+j*6,30+15*i,46,col,false,true,1);
  691.     for j:=1 to 6 do
  692.     begin
  693.       numero(190+j*6,30+15*i,best_players[i].score div m mod 10 + 48,col,false,true,1);
  694.       m:=m div 10;
  695.     end;
  696.   end;
  697. end;
  698.  
  699. procedure show_hof(lovering:boolean);
  700. var i,st:word;
  701.     ch:char;
  702.     endy,left_button,right_button:boolean;
  703. begin
  704.   reset_kbd;
  705.   fillchar(pic^[0],64000,0);
  706.   make_bck;
  707.   fillchar(mem[$A000:0000],64000,0);
  708.   for i:=1 to 63 do
  709.   begin
  710.     if i>16 then j:=i-12 else j:=5;
  711.     setpall(i,j div 2,i div 3+16,j div 2);
  712.     if i mod 5=0 then
  713.     begin
  714.       timer:=izracunaj_cas;
  715.       casovni_razpored;
  716.     end;
  717.   end;
  718.   for i:=0 to 16 do setpall(65+i,i*2+24,8+i,0); { PALETA ZA CRKE }
  719.   for i:=0 to 16 do setpall(82+i,0,8+i,i*2+24);
  720.   fill_emptiness;
  721.   show_best;
  722.   endy:=false;
  723.   left_button:=false;
  724.   right_button:=false;
  725.   st:=0;
  726.   repeat
  727.     timer:=izracunaj_cas;
  728.     casovni_razpored;
  729.     if keypressed then
  730.     begin
  731.       ch:=readkey;
  732.       endy:=true;
  733.     end;
  734.     reg.ax:=3;
  735.     intr($33,reg);
  736.     if reg.bx and 1=1 then left_button:=true;
  737.     if reg.bx and 2=2 then right_button:=true;
  738.     if (reg.bx and 1<>1) and (left_button) then endy:=true;
  739.     if (reg.bx and 2<>2) and (right_button) then endy:=true;
  740.     if st=20000 then endy:=true else inc(st);
  741.   until endy;
  742.   for i:=0 to 25 do
  743.   begin
  744.     fill_emptiness;
  745.     timer:=izracunaj_cas;
  746.     casovni_razpored;
  747.     if lovering then lover_volume;
  748.   end;
  749.   fillchar(pic^[0],64000,0);
  750.   number_of_the_best:=0;
  751. end;
  752.  
  753. procedure load_best_scores;
  754. var t:text;
  755.     i,j:byte;
  756.     m:longint;
  757.     ch:char;
  758. begin
  759.   if exist('LEVELS\BSTSCR.DAT') then
  760.   begin
  761.     assign(t,'LEVELS\BSTSCR.DAT');
  762.     reset(t);
  763.     for i:=1 to 10 do
  764.     begin
  765.       best_players[i].name:='';
  766.       for j:=1 to 6 do
  767.       begin
  768.         read(t,ch);
  769.         best_players[i].name:=best_players[i].name+ch;
  770.       end;
  771.       m:=100000;
  772.       for j:=1 to 6 do
  773.       begin
  774.         read(t,ch);
  775.         best_players[i].score:=best_players[i].score+(ord(ch)-48)*m;
  776.         m:=m div 10;
  777.       end;
  778.       readln(t);
  779.     end;
  780.     close(t);
  781.   end
  782.   else
  783.     for i:=1 to 10 do
  784.     begin
  785.       best_players[i].name:='GRANDY';
  786.       best_players[i].score:=1000;
  787.     end;
  788. end;
  789.  
  790. procedure save_best_scores;
  791. var t:text;
  792.     i,j:byte;
  793.     m:longint;
  794.     ch:char;
  795. begin
  796.   assign(t,'LEVELS\BSTSCR.DAT');
  797.   rewrite(t);
  798.   for i:=1 to 10 do
  799.   begin
  800.     for j:=1 to 6 do
  801.       write(t,best_players[i].name[j]);
  802.     m:=100000;
  803.     for j:=1 to 6 do
  804.     begin
  805.        write(t,chr(best_players[i].score div m mod 10 +48));
  806.       m:=m div 10;
  807.     end;
  808.     writeln(t);
  809.     timer:=izracunaj_cas;
  810.     casovni_razpored;
  811.   end;
  812.   close(t);
  813. end;
  814.  
  815. procedure equal(n:byte;str:string);
  816. var i,j:byte;
  817. begin
  818.   assign(t,str);
  819.   reset(t);
  820.   for i:=1 to 15 do
  821.   begin
  822.     for j:=1 to 16 do
  823.     begin
  824.       read(t,ch1);
  825.       facne[n]^[i,j]:=ord(ch1);
  826.     end;
  827.     readln(t);
  828.   end;
  829.   close(t);
  830. end;
  831.  
  832. procedure load_cursor;
  833. var i:byte;
  834. begin
  835.   for i:=1 to 5 do
  836.   begin
  837.     new(facne[i]);
  838.     equal(i,'GFX\CURSOR\FACNA'+chr(48+i)+'.BLK');
  839.   end;
  840. end;
  841.  
  842. procedure load_cursor_palette(n:byte);
  843. var i:byte;
  844. begin
  845.   assign(t,'GFX\CURSOR\UNIPALL.DAT');
  846.   reset(t);
  847.   for i:=n to n+8 do
  848.   begin
  849.     readln(t,ch1,ch2,ch3);
  850.     setpall(i,ord(ch1),ord(ch2),ord(ch3));
  851.   end;
  852.   close(t);
  853. end;
  854.  
  855. procedure cursor(n,mpal:byte;x,y:word);
  856. var i,j:word;
  857. begin
  858.   for i:=1 to 15 do
  859.     for j:=1 to 16 do
  860.       if facne[n]^[i,j]>0 then pic^[320*(y+i)+x+j]:=facne[n]^[i,j]+mpal;
  861. end;
  862.  
  863. procedure spremeni_sign;
  864. var i,j:word;
  865. begin
  866.   for i:=1 to 40 do
  867.     for j:=1 to 248 do
  868.       if sign^[i,j]>0 then pic^[320*(i+50)+j+40]:=sign^[i,j] div 4+107+(i-1 mod 35) div 6+bonus;
  869.   for i:=40 to 75 do
  870.     for j:=1 to 248 do
  871.       if sign^[i,j]>0 then pic^[320*(i+50)+j+40]:=sign^[i,j] div 4+107+((i-44) mod 35) div 6+bonus;
  872. end;
  873.  
  874. procedure initialize;
  875. begin
  876.   for i:=1 to 100 do
  877.   begin
  878.     firex[i]:=0;
  879.     firey[i]:=0;
  880.   end;
  881.   for i:=0 to enemy_num do
  882.   begin
  883.     et[i]:=0;
  884.     ef_t[i]:=0;
  885.     e_existence[i]:=0;
  886.     bonus_missile[i]:=false;
  887.   end;
  888.   for i:=1 to 2500 do exp_t[i]:=0;
  889. end;
  890.  
  891. procedure univerzalna_paleta;
  892. var i,j:byte;
  893. begin
  894.   assign(t,'objects\unipall.dat');
  895.   reset(t);
  896.   for i:=0 to 127 do
  897.   begin
  898.     readln(t,ch1,ch2,ch3);
  899.     setpall(i+128,ord(ch1),ord(ch2),ord(ch3));
  900.   end;
  901.   close(t);
  902. end;
  903.  
  904. procedure load_enemy_palette;
  905. var i:byte;
  906. begin
  907.   case level of
  908.   1:begin
  909.       assign(t,'objects\m1palc.dat');
  910.       reset(t);
  911.       for i:=0 to 66 do
  912.       begin
  913.         readln(t,ch1,ch2,ch3);
  914.         enemy_palette[i,1]:=ord(ch1);
  915.         enemy_palette[i,2]:=ord(ch2);
  916.         enemy_palette[i,3]:=ord(ch3);
  917.       end;
  918.       close(t);
  919.     end;
  920.   2:begin
  921.       assign(t,'objects\m2palc.dat');
  922.       reset(t);
  923.       for i:=0 to 69 do
  924.       begin
  925.         readln(t,ch1,ch2,ch3);
  926.         enemy_palette[i,1]:=ord(ch1);
  927.         enemy_palette[i,2]:=ord(ch2);
  928.         enemy_palette[i,3]:=ord(ch3);
  929.       end;
  930.       close(t);
  931.     end;
  932.   3:begin
  933.       assign(t,'objects\m3palc.dat');
  934.       reset(t);
  935.       for i:=0 to 71 do
  936.       begin
  937.         readln(t,ch1,ch2,ch3);
  938.         enemy_palette[i,1]:=ord(ch1);
  939.         enemy_palette[i,2]:=ord(ch2);
  940.         enemy_palette[i,3]:=ord(ch3);
  941.       end;
  942.       close(t);
  943.     end;
  944.   end;
  945. end;
  946.  
  947. procedure read_right(name:string;lim1,lim2,n:byte;dir:shortint;k:byte);
  948. var i,j:byte;
  949. begin
  950.   assign(t,name);
  951.   reset(t);
  952.   for i:=1 to lim1 do
  953.     if dir=1 then
  954.     begin
  955.       for j:=1 to lim2 do
  956.       begin
  957.         read(t,ch1);
  958.         case n of
  959.         0:plane[i,j]:=ord(ch1) div 2;
  960.         1:e1^[i,j]:=ord(ch1)+128;
  961.         2:e2^[i,j]:=ord(ch1)+128;
  962.         3:e3p1^[i,j]:=ord(ch1)+128;
  963.         4:e3p2^[i,j]:=ord(ch1)+128;
  964.         6:e5^[i,j]:=ord(ch1)+128;
  965.         7:e6^[i,j]:=ord(ch1)+128;
  966.         8:e7p1^[i,j]:=ord(ch1)+128;
  967.         9:e7p2^[i,j]:=ord(ch1)+128;
  968.         12:m3^[i,j]:=ord(ch1)+128;
  969.         101:m2^[i,j]:=ord(ch1)+128;
  970.         201:mtr1^[i,j]:=ord(ch1)+128;
  971.         202:mtr2^[i,j]:=ord(ch1)+128;
  972.         203:mtr3^[i,j]:=ord(ch1)+128;
  973.         204:mtr4^[i,j]:=ord(ch1)+128;
  974.         205:mtr5^[i,j]:=ord(ch1)+128;
  975.         254:sign^[i,j]:=ord(ch1);
  976.         255:brdr[i,j]:=ord(ch1);
  977.         98:if ord(ch1)>20 then myms[i,j]:=ord(ch1); {MISSILE}
  978.         end;
  979.       end;
  980.       readln(t);
  981.     end
  982.     else
  983.     begin
  984.       for j:=lim2 downto 1 do
  985.       begin
  986.         read(t,ch1);
  987.         case n of
  988.         5:e4^[i,j]:=ord(ch1)+128;
  989.         10:e8^[i,j]:=ord(ch1)+128;
  990.         11:guns[k]^[i,j]:=ord(ch1)+128;
  991.         99:if ord(ch1)>20 then ms[i,j]:=ord(ch1); {MISSILE}
  992.         100:m1^[i,j]:=ord(ch1)+128;
  993.         end;
  994.       end;
  995.       readln(t);
  996.     end;
  997.   close(t);
  998. end;
  999.  
  1000. procedure read_enemy;
  1001. var i,j:byte;
  1002. begin
  1003.   case level of
  1004.   1:begin
  1005.       new(e1);
  1006.       read_right('objects\enemy1up.blk',28,50,1,1,0);
  1007.       new(e2);
  1008.       read_right('objects\enemy2p2.blk',22,60,2,1,0);
  1009.       new(e3p1);
  1010.       read_right('objects\enemy3p1.blk',10,51,3,1,0);
  1011.       new(e3p2);
  1012.       read_right('objects\enemy3p2.blk',10,51,4,1,0);
  1013.       new(e4);
  1014.       read_right('objects\enemy4up.blk',38,29,5,-1,0);
  1015.       new(m1);
  1016.       read_right('objects\enemym1c.blk',103,79,100,-1,0);
  1017.     end;
  1018.   2:begin
  1019.       new(e3p1);
  1020.       read_right('objects\enemy3p1.blk',10,51,3,1,0);
  1021.       new(e3p2);
  1022.       read_right('objects\enemy3p2.blk',10,51,4,1,0);
  1023.       new(e4);
  1024.       read_right('objects\enemy4up.blk',38,29,5,-1,0);
  1025.       new(e5);
  1026.       read_right('objects\enemy5up.blk',26,53,6,1,0);
  1027.       new(e6);
  1028.       read_right('objects\enemy6u2.blk',29,48,7,1,0);
  1029.       new(m2);
  1030.       read_right('objects\enemym2c.blk',140,115,101,1,0);
  1031.     end;
  1032.   3:begin
  1033.       new(e2);
  1034.       read_right('objects\enemy2p2.blk',22,60,2,1,0);
  1035.       new(e6);
  1036.       read_right('objects\enemy6u2.blk',29,48,7,1,0);
  1037.       new(e7p1);
  1038.       read_right('objects\enemy7u3.blk',29,59,8,1,0);
  1039.       new(e7p2);
  1040.       read_right('objects\enemy7u4.blk',29,59,9,1,0);
  1041.       new(e8);
  1042.       read_right('objects\enemy8up.blk',31,64,10,-1,0);
  1043.       for i:=1 to 5 do
  1044.       begin
  1045.         new(guns[i]);
  1046.         read_right('objects\gun\g'+chr(48+i)+'up.blk',7,37,11,-1,i);
  1047.       end;
  1048.       new(mtr1);
  1049.       read_right('objects\meteors\m1up.blk',47,68,201,1,0);
  1050.       new(mtr2);
  1051.       read_right('objects\meteors\m2up.blk',21,38,202,1,0);
  1052.       new(mtr3);
  1053.       read_right('objects\meteors\m3up.blk',22,39,203,1,0);
  1054.       new(mtr4);
  1055.       read_right('objects\meteors\m4up.blk',25,43,204,1,0);
  1056.       new(mtr5);
  1057.       read_right('objects\meteors\m5up.blk',36,43,205,1,0);
  1058.       new(m3);
  1059.       read_right('objects\enemym3c.blk',127,120,12,1,0);
  1060.     end;
  1061.   end;
  1062. end;
  1063.  
  1064. procedure read_gfx;
  1065. var i,j:byte;
  1066. begin
  1067.   read_right('objects\plane.blk',pcy,pcx,0,1,0);
  1068.   read_right('gfx\brdrup.blk',20,97,255,1,0);
  1069.   new(sign);
  1070.   read_right('gfx\lvlcmp.blk',75,248,254,1,0);
  1071.   for i:=0 to 20 do setpall(i+107,0,trunc(i*1.2)+5,trunc(i*1.2)+5);
  1072. end;
  1073.  
  1074. procedure set_low_colors;
  1075. var i:byte;
  1076. begin
  1077.   assign(t,'GFX\UNIPALL.DAT');
  1078.   reset(t);
  1079.   for i:=0 to 107 do
  1080.   begin
  1081.     readln(t,ch1,ch2,ch3);
  1082.     setpall(i,ord(ch1),ord(ch2),ord(ch3));
  1083.   end;
  1084.   close(t);
  1085. end;
  1086.  
  1087. procedure make_missile;
  1088. var i,j:byte;
  1089. begin
  1090.   read_right('gfx\mis1.blk',10,25,98,1,0);
  1091.   read_right('gfx\mis2.blk',10,25,99,2,0);
  1092. end;
  1093.  
  1094. procedure stars_initialization;
  1095. var i:word;
  1096. begin
  1097.   for i:=1 to 200 do
  1098.   begin
  1099.     sx[i]:=random(1000);
  1100.     sy[i]:=random(170);
  1101.     sd[i]:=random(8);
  1102.   end;
  1103. end;
  1104.  
  1105. procedure enemies_timing;
  1106. var i,j:word;
  1107.     n:real;
  1108. begin
  1109.   if level=1 then assign(t,'LEVELS\LEVEL1.DAT');
  1110.   if level=2 then assign(t,'LEVELS\LEVEL2.DAT');
  1111.   if level=3 then assign(t,'LEVELS\LEVEL3.DAT');
  1112.   reset(t);
  1113.   i:=0;
  1114.   while not(eof(t)) do
  1115.   begin
  1116.     inc(i);
  1117.     j:=1;
  1118.     while not(eoln(t)) do
  1119.     begin
  1120.       read(t,n);
  1121.       if j=1 then et[i]:=trunc(n);
  1122.       if j=2 then ex[i]:=n;
  1123.       if j=3 then ey[i]:=n-5;
  1124.       if j=4 then esx[i]:=n;
  1125.       case et[i] of
  1126.       1:if j=5 then bonus_missile[i]:=true;
  1127.       2:e_damage[i]:=3;
  1128.       3:begin
  1129.           if j=5 then esy[i]:=n;
  1130.           if j=6 then e_where_sy[i]:=trunc(n);
  1131.         end;
  1132.       4:e_damage[i]:=2;
  1133.       5:begin
  1134.           if j=5 then esy[i]:=n;
  1135.           e_damage[i]:=5;
  1136.         end;
  1137.       6:begin
  1138.           if j=5 then bonus_missile[i]:=true;
  1139.           e_damage[i]:=3;
  1140.         end;
  1141.       7:begin
  1142.           if j=5 then bonus_missile[i]:=true;
  1143.           e_damage[i]:=15;
  1144.         end;
  1145.       8:begin
  1146.           if j=5 then esy[i]:=n;
  1147.           e_damage[i]:=5;
  1148.         end;
  1149.       100:begin
  1150.           if j=2 then ch_pal_pos:=trunc(n)-340;
  1151.           if j=5 then esy[i]:=n;
  1152.           if j=6 then e_where_sy[i]:=trunc(n);
  1153.           e_damage[i]:=100;
  1154.           e_whole_damage:=100;
  1155.         end;
  1156.       101:begin
  1157.           if j=2 then ch_pal_pos:=trunc(n)-340;
  1158.           m_pause:=30;
  1159.           e_damage[i]:=200;
  1160.           e_whole_damage:=200;
  1161.         end;
  1162.       102:begin
  1163.           esx[i]:=0;
  1164.           esy[i]:=0;
  1165.           if j=2 then ch_pal_pos:=trunc(n)-340;
  1166.           e_damage[i]:=100;
  1167.           e_whole_damage:=100;
  1168.         end;
  1169.       end;
  1170.       inc(j);
  1171.     end;
  1172.     readln(t);
  1173.   end;
  1174.   close(t);
  1175. end;
  1176.  
  1177. procedure dispose_enemies;
  1178. var i:byte;
  1179. begin
  1180.   case level of
  1181.   1:begin
  1182.       dispose(e1);
  1183.       dispose(e2);
  1184.       dispose(e3p1);
  1185.       dispose(e3p2);
  1186.       dispose(e4);
  1187.       dispose(m1);
  1188.     end;
  1189.   2:begin
  1190.       dispose(e3p1);
  1191.       dispose(e3p2);
  1192.       dispose(e4);
  1193.       dispose(e5);
  1194.       dispose(e6);
  1195.       dispose(m2);
  1196.     end;
  1197.   3:begin
  1198.       dispose(e2);
  1199.       dispose(e7p1);
  1200.       dispose(e7p2);
  1201.       dispose(e6);
  1202.       dispose(e8);
  1203.       for i:=1 to 5 do dispose(guns[i]);
  1204.       dispose(mtr1);
  1205.       dispose(mtr2);
  1206.       dispose(mtr3);
  1207.       dispose(mtr4);
  1208.       dispose(mtr5);
  1209.       dispose(m3);
  1210.     end;
  1211.   end;
  1212. end;
  1213.  
  1214. procedure end_level;
  1215. begin
  1216.   dispose_enemies;
  1217.   if level<3 then inc(level) else level:=1;
  1218. end;
  1219.  
  1220. procedure show_text;
  1221. var i,j:byte;
  1222. begin
  1223.   for i:=1 to 15 do
  1224.   begin
  1225.     for j:=1 to 97 do
  1226.       mem[$A000:320*(i-1)+j-1]:=brdr[i,j];
  1227.     for j:=1 to 55 do
  1228.       mem[$A000:320*(i-1)+210+j-1]:=brdr[i,j];
  1229.     for j:=1 to 54 do
  1230.       mem[$A000:320*(i-1)+265+j-1]:=brdr[i,j+42];
  1231.     for j:=1 to 56 do
  1232.       mem[$A000:320*(i-1)+97+j-1]:=brdr[i,j];
  1233.     for j:=1 to 56 do
  1234.       mem[$A000:320*(i-1)+154+j-1]:=brdr[i,j+41];
  1235.     for j:=1 to 80 do
  1236.       mem[$A000:320*(i+184)+j-1]:=brdr[i,j];
  1237.     for j:=1 to 80 do
  1238.       mem[$A000:320*(i+184)+80+j-1]:=brdr[i,j+17];
  1239.     for j:=1 to 80 do
  1240.       mem[$A000:320*(i+184)+160+j-1]:=brdr[i,j];
  1241.     for j:=1 to 80 do
  1242.       mem[$A000:320*(i+184)+240+j-1]:=brdr[i,j+17];
  1243.   end;
  1244.   outtextxy(13,4,'SCORE',6,81,false,true,2);
  1245.   outtextxy(106,4,'MISSILES',6,81,false,true,2);
  1246.   outtextxy(222,4,'HISCORE',6,81,false,true,2);
  1247.   outtextxy(10,189,'SHIELD',6,81,false,true,2);
  1248.   outtextxy(225,189,'LEVEL',6,81,false,true,2);
  1249.   numero(262,189,level+48,81,false,true,2);
  1250. end;
  1251.  
  1252. procedure show_score;
  1253. var tmp_score,i:longint;
  1254. begin
  1255.   tmp_score:=score;
  1256.   for i:=1 to 6 do
  1257.   begin
  1258.     numero(87-i*7,4,tmp_score mod 10 + 48,81,true,true,2);
  1259.     tmp_score:=tmp_score div 10;
  1260.   end;
  1261. end;
  1262.  
  1263. procedure show_hiscore;
  1264. var tmp_score,i:longint;
  1265. begin
  1266.   tmp_score:=hiscore;
  1267.   for i:=1 to 6 do
  1268.   begin
  1269.     numero(310-i*7,4,tmp_score mod 10 + 48,81,true,true,2);
  1270.     tmp_score:=tmp_score div 10;
  1271.   end;
  1272. end;
  1273.  
  1274. procedure show_damage;
  1275. var i,j:byte;
  1276. begin
  1277.   for i:=1 to 100 do
  1278.     if i>damage then for j:=1 to 7 do mem[$A000:320*(188+j)+i+50]:=0
  1279.                 else for j:=1 to 7 do mem[$A000:320*(188+j)+i+50]:=i div 5+j+10;
  1280. end;
  1281.  
  1282. procedure enemy_damage(t:byte);
  1283. var i,j,col:byte;
  1284. begin
  1285.   for i:=1 to 100 do
  1286.   begin
  1287.     case level of
  1288.     1:col:=i div 4+160;
  1289.     2:col:=(i+15) div 4+160;
  1290.     3:col:=i div 3+150;
  1291.     end;
  1292.     if i>t then for j:=1 to 7 do mem[$A000:320*(188+j)+i+208]:=0
  1293.            else for j:=1 to 7 do mem[$A000:320*(188+j)+i+208]:=col+j;
  1294.   end;
  1295. end;
  1296.  
  1297. procedure show_pos(pos:byte);
  1298. var i,j:word;
  1299. begin
  1300.   if pos=1 then
  1301.     for i:=85 to 125 do
  1302.       for j:=80 to 170 do
  1303.         if pic^[320*i+j]=0 then pic^[320*i+j]:=33+(i-85) div 6 else
  1304.   else
  1305.     for i:=85 to 125 do
  1306.       for j:=175 to 245 do
  1307.         if pic^[320*i+j]=0 then pic^[320*i+j]:=33+(i-85) div 6;
  1308. end;
  1309.  
  1310. procedure make_bck2;
  1311. var i:word;
  1312.     st:real;
  1313.     x,y:real;
  1314. begin
  1315.   st:=0;
  1316.   i:=0;
  1317.   repeat
  1318.     x:=sin(st)*(i div 2)+160;
  1319.     y:=sqr(st)*(i div 3)+100;
  1320.     st:=st+0.001;
  1321.     inc(i);
  1322.     pic^[320*(trunc(y) mod 200)+(trunc(x) mod 320)]:=63;
  1323.   until st>5*pi;
  1324. end;
  1325.  
  1326. procedure fill_emptiness2;
  1327. var i,j,vs:word;
  1328.     t:text;
  1329. begin
  1330.   for i:=0 to 63999 do
  1331.   begin
  1332.     j:=i mod 320;
  1333.     vs:=0;
  1334.     if i > 319 then vs:=pic^[i-320];
  1335.     if i < 63680 then vs:=vs+pic^[i+320];
  1336.     if j > 0 then vs:=vs+pic^[i-1];
  1337.     if j < 319 then vs:=vs+pic^[i+1];
  1338.     vs:=vs div 4;
  1339.     pic^[i]:=vs;
  1340.   end;
  1341. end;
  1342.  
  1343. procedure show_chars(st:byte);
  1344. var i:byte;
  1345. begin
  1346.   mouttextxy(120,35,'INPUT YOUR NAME',6,66);
  1347.   mouttextxy(70,65,'A B C D E F G H I J',10,70);
  1348.   mouttextxy(70,85,'K L M N O P Q R S T',10,70);
  1349.   mouttextxy(70,105,'U V W X Y Z 0 1 2 3',10,70);
  1350.   mouttextxy(70,125,'4 5 6 7 8 9 '' _ < >',10,70);
  1351.   for i:=1 to 6 do
  1352.   begin
  1353.     mouttextxy(137+8*i,157,name[i],8,70);
  1354.     if st=i then mouttextxy(137+8*i,160,'_',8,70)
  1355.             else mouttextxy(137+8*i,160,'_',8,63);
  1356.   end;
  1357. end;
  1358.  
  1359. procedure input_name(n:byte);
  1360. label jump_over;
  1361. var sign:^screen;
  1362.     i,j,x,y,nx,ny,st,lb_delay:word;
  1363.     ch:char;
  1364.     endy,left_button,right_button:boolean;
  1365. begin
  1366.   new(sign);
  1367.   read_mouse_cursor;
  1368.   omejitev_miske(0,0,628,386);
  1369.   fillchar(pic^[0],64000,0);
  1370.   make_bck2;
  1371.   fill_emptiness2;
  1372.   move(pic^[0],sign^[0],64000);
  1373.   fillchar(mem[$A000:0000],64000,0);
  1374.   for i:=1 to 63 do
  1375.   begin
  1376.     if i>16 then j:=i-12 else j:=5;
  1377.     setpall(i,j div 2,j div 2,i div 3+16);
  1378.   end;
  1379.   for i:=0 to 16 do setpall(65+i,i*2+24,8+i,0); {PALETA ZA CRKE }
  1380.   setpall(127,32,32,32);
  1381.   set_play_variables;
  1382.   load_song('LEVELS\HOF2SONG.SNG');
  1383.   endy:=false;
  1384.   left_button:=false;
  1385.   st:=1;
  1386.   lb_delay:=0;
  1387.   repeat
  1388.     higher_volume;
  1389.     move(sign^[0],pic^[0],64000);
  1390.     show_chars(st);
  1391.     timer:=izracunaj_cas;
  1392.     casovni_razpored;
  1393.     if keypressed then ch:=readkey;
  1394.     reg.ax:=3;
  1395.     intr($33,reg);
  1396.     nx:=reg.cx div 2;
  1397.     ny:=reg.dx div 2;
  1398.     if reg.bx and 1=1 then left_button:=true
  1399.                       else
  1400.                       begin
  1401.                         if lb_delay>0 then dec(lb_delay);
  1402.                         left_button:=false;
  1403.                       end;
  1404.     for y:=0 to 3 do            { ckeck_mouse }
  1405.       for x:=0 to 9 do
  1406.         if (ny>=64+20*y) and (ny<=72+20*y) and (nx>=69+20*x) and (nx<=75+20*x) and (left_button) and (lb_delay=0) then
  1407.         begin
  1408.           ch:=chr(0);
  1409.           case (y*10+x+1) of
  1410.           1..26:ch:=chr(64+(y*10+x+1));
  1411.           27..36:ch:=chr(21+(y*10+x+1));
  1412.           37:ch:=chr(39);
  1413.           38:ch:=chr(32);
  1414.           39:begin
  1415.                if st>1 then
  1416.                begin
  1417.                  dec(st);
  1418.                  name[st]:=chr(32);
  1419.                  lb_delay:=5;
  1420.                end;
  1421.              end;
  1422.           40:endy:=true;
  1423.           end;
  1424.           if (st<7) and (ord(ch)<>0) then
  1425.           begin
  1426.             name[st]:=ch;
  1427.             inc(st);
  1428.             lb_delay:=5;
  1429.           end;
  1430.         end;
  1431. jump_over:
  1432.     for x:=1 to 5 do            { show_mouse }
  1433.       for y:=1 to 5 do
  1434.         if mouse_cursor[x,y]>0 then pic^[320*(ny+x)+nx+y]:=127;
  1435.     move(pic^[0],mem[$A000:0000],64000);
  1436.   until endy;
  1437.   fillchar(pic^[0],64000,0);
  1438.   dispose(sign);
  1439.   best_players[n].name:=name;
  1440. end;
  1441.  
  1442. procedure chk_top_score;
  1443. label out;
  1444. var i,j:word;
  1445. begin
  1446.   for i:=1 to 10 do
  1447.     if score>best_players[i].score then
  1448.     begin
  1449.       if i<10 then
  1450.       begin
  1451.         for j:=9 downto i do
  1452.         begin
  1453.           best_players[j+1].name:=best_players[j].name;
  1454.           best_players[j+1].score:=best_players[j].score;
  1455.         end;
  1456.       end;
  1457.       input_name(i);
  1458.       best_players[i].score:=score;
  1459.       number_of_the_best:=i;
  1460.       save_best_scores;
  1461.       show_hof(true);
  1462.       reset_card;
  1463.       goto out;
  1464.     end;
  1465. out:
  1466. end;
  1467.  
  1468. procedure fly_agen;
  1469. var i,j,k,x,y,cx,cy,p:word;
  1470.     key,pos,r,last_button:byte;
  1471.     fablk:^yesno;
  1472. begin
  1473.   LoadVOC('SOUND\TOING.VOC', 0, Ram , Fire1) ;
  1474.   reset_kbd;
  1475.   chk_top_score;
  1476.   omejitev_miske(0,0,600,370);
  1477.   new(fablk);
  1478.   fillchar(pic^[0],64000,0);
  1479.   move(pic^[0],mem[$A000:0000],64000);
  1480.   assign(t,'GFX\FLYAGEN.PAL');
  1481.   reset(t);
  1482.   for k:=0 to 32 do
  1483.   begin
  1484.     readln(t,ch1,ch2,ch3);
  1485.     setpall(k,ord(ch1),ord(ch2),ord(ch3));
  1486.   end;
  1487.   for k:=0 to 7 do setpall(33+k,k+15,k+20,0);
  1488.   load_cursor_palette(41);
  1489.   uncomprx('GFX\FLYAGEN.CMX',64000);
  1490.   for k:=31 downto 1 do
  1491.   begin
  1492.     for i:=12800 to 41599 do
  1493.       if pic^[i]>k then mem[$A000:i]:=pic^[i]-k;
  1494.     delay(50);
  1495.   end;
  1496.   for i:=1 to 90 do
  1497.     for j:=1 to 240 do
  1498.       fablk^[i,j]:=mem[$A000:320*(35+i)+40+j];
  1499.   pos:=1;
  1500.   show_pos(pos);
  1501.   reg.bx:=0;
  1502.   repeat
  1503.     if keypressed then
  1504.     begin
  1505.       key:=ord(readkey);
  1506.       if key=0 then key:=ord(readkey);
  1507.       if (key=75) and (pos=2) then pos:=1;
  1508.       if (key=77) and (pos=1) then pos:=2;
  1509.     end;
  1510.     if ((reg.bx and 1)=1) and (last_button=0) then
  1511.     begin
  1512.       if (y>75) and (y<115) then
  1513.       begin
  1514.         if (x>75) and (x<165) then
  1515.         begin
  1516.           key:=13;
  1517.           pos:=1;
  1518.         end;
  1519.         if (x>175) and (x<245) then
  1520.         begin
  1521.           key:=13;
  1522.           pos:=2;
  1523.         end;
  1524.       end;
  1525.       if sound_set then playvoc(fire1);
  1526.     end;
  1527.   for i:=1 to 90 do
  1528.     for j:=1 to 240 do
  1529.       pic^[320*(35+i)+40+j]:=fablk^[i,j];
  1530.     show_pos(pos);
  1531.     last_button:=reg.bx and 1;
  1532.     reg.ax:=3;
  1533.     intr($33,reg);
  1534.     x:=reg.cx div 2;
  1535.     y:=reg.dx div 2;
  1536.     p:=1;
  1537.     r:=random(500);
  1538.     if (cx=x) and (cy=y) then
  1539.       if ((r=19) or (r=20)) then
  1540.       begin
  1541.         cursor(pos+2,41,x,y);
  1542.         p:=100;
  1543.       end
  1544.       else if (r=21) and (pos=1) then
  1545.       begin
  1546.         cursor(5,41,x,y);
  1547.         p:=400;
  1548.       end
  1549.       else cursor(pos,41,x,y)
  1550.     else cursor(pos,41,x,y);
  1551.     move(pic^[0],mem[$A000:0000],64000);
  1552.     delay(p);
  1553.     fillchar(pic^[0],64000,0);
  1554.     cx:=x;
  1555.     cy:=y;
  1556.   until key=13;
  1557.   for k:=1 to 31 do
  1558.   begin
  1559.   for i:=1 to 90 do
  1560.     for j:=1 to 240 do
  1561.       if fablk^[i,j]>k then mem[$A000:320*(35+i)+40+j]:=fablk^[i,j]-k else mem[$A000:320*(35+i)+40+j]:=0;
  1562.     delay(20);
  1563.   end;
  1564.   fillchar(mem[$A000:0],64000,0);
  1565.   fillchar(pic^[0],64000,0);
  1566.   if pos=1 then flyagain:=true else over:=true;
  1567.   dispose(fablk);
  1568. end;
  1569.  
  1570. procedure error_msg(str:string);
  1571. begin
  1572.   reg.ah:=0;
  1573.   reg.al:=3;
  1574.   intr($10,reg);
  1575.   writeln(str);
  1576.   halt(1);
  1577. end;
  1578.  
  1579. procedure set_my_pieces(t:byte);
  1580. var r:byte;
  1581. begin
  1582.   for i:=5 to 10 do
  1583.   begin
  1584.     r:=random(20);
  1585.     for j:=20-t+r to 17+t+r do
  1586.       if plane[i,j]>0 then
  1587.       begin
  1588.         while exp_t[hole]>0 do
  1589.         begin
  1590.           inc(hole);
  1591.           if hole>2500 then error_msg('POVECAJ MATRIKE (IN OSTALO) ZA EXSPLOZIJE!');
  1592.         end;
  1593.         exp_x[hole]:=(px+j)*100;
  1594.         exp_y[hole]:=(py+i)*100;
  1595.         if t>10 then exp_dx[hole]:=(random(35)-17)*5
  1596.                 else exp_dx[hole]:=-(random(35))*5;
  1597.         exp_dy[hole]:=(random(35)-17)*5;
  1598.         exp_t[hole]:=t*2;
  1599.         exp_ty[hole]:=2;
  1600.       end;
  1601.   end;
  1602. end;
  1603.  
  1604. procedure play_exp;
  1605. begin
  1606.   if sound_set then
  1607.   begin
  1608.     if (StatusWord<>0) then stopvoc;
  1609.     playvoc(exp);
  1610.     firepl:=false;
  1611.     exppl:=true;
  1612.     fmpl:=false;
  1613.   end;
  1614. end;
  1615.  
  1616. procedure plane_crash;
  1617. var k:byte;
  1618. begin
  1619.   if crashed=0 then
  1620.   begin
  1621.     crashed:=100;
  1622.     damage:=0;
  1623.     show_damage;
  1624.     set_my_pieces(12);
  1625.     set_my_pieces(12);
  1626.     set_my_pieces(12);
  1627.   end;
  1628.   play_exp;
  1629. end;
  1630.  
  1631. procedure set_shoot(a,b,c,d:integer;e:byte);
  1632. begin
  1633.   while ef_t[hole]>0 do
  1634.   begin
  1635.     inc(hole);
  1636.     if hole>500 then error_msg('POVECAJ MATRIKE (IN OSTALO) ZA SOVRAZNIKOVE STRELE!');
  1637.   end;
  1638.   ef_x[hole]:=a;
  1639.   ef_y[hole]:=b;
  1640.   ef_dx[hole]:=c;
  1641.   ef_dy[hole]:=d;
  1642.   ef_t[hole]:=e;
  1643. end;
  1644.  
  1645. procedure chk_shooting;
  1646. var i,r:word;
  1647.     tmpe:integer;
  1648. begin
  1649.   hole:=1;
  1650.   for i:=1 to enemy_num do
  1651.   if et[i]>0 then
  1652.   begin
  1653.     tmpe:=trunc(ex[i])-(major_st+30);
  1654.     if (e_existence[i]>0) and (tmpe>60) then
  1655.     begin
  1656.       case et[i] of
  1657.       1:if (e_existence[i]>50) and (e_existence[i] mod 50=0) then
  1658.           begin
  1659.             set_shoot((tmpe+25)*100,trunc(ey[i]+4)*100,-300,random(100)-50,7);
  1660.             set_shoot((tmpe+25)*100,trunc(ey[i]+18)*100,-300,random(100)-50,7);
  1661.           end;
  1662.       2:if e_existence[i] mod 10=0 then
  1663.         begin
  1664.           set_shoot((tmpe+10)*100,trunc(ey[i]+5)*100,-500,0,1);
  1665.           set_shoot((tmpe+10)*100,trunc(ey[i]+20)*100,-500,0,1);
  1666.         end;
  1667.       4:if e_existence[i] mod 20=0 then
  1668.         begin
  1669.           set_shoot((tmpe+5)*100,trunc(ey[i]+15)*100,-500,random(400)-200,2);
  1670.           set_shoot((tmpe+5)*100,trunc(ey[i]+25)*100,-500,random(400)-200,2);
  1671.         end;
  1672.       5:if e_existence[i] mod 20=0 then
  1673.         begin
  1674.           set_shoot((tmpe+15)*100,trunc(ey[i]+3)*100,0,0,3);
  1675.           set_shoot((tmpe+15)*100,trunc(ey[i]+23)*100,0,0,3);
  1676.         end;
  1677.       6:if e_existence[i] mod 15=0 then
  1678.         begin
  1679.           set_shoot((tmpe+15)*100,trunc(ey[i]+3)*100,-200,-random(50),4);
  1680.           set_shoot((tmpe+15)*100,trunc(ey[i]+23)*100,-200,random(50),4);
  1681.         end;
  1682.       7:if (e_existence[i] mod 2=0) and (e_existence[i]>40) then
  1683.         begin
  1684.           r:=e_existence[i] mod 16 div 2;
  1685.           case r of
  1686.           0:set_shoot((tmpe+20)*100,trunc(ey[i]+16)*100,-200,random(50)-25,5);
  1687.           1:set_shoot((tmpe+28)*100,trunc(ey[i]+7)*100,-140+random(50)-25,random(50)-125,5);
  1688.           2:set_shoot((tmpe+40)*100,trunc(ey[i]+4)*100,random(50)-125,-150,5);
  1689.           3:set_shoot((tmpe+45)*100,trunc(ey[i]+7)*100,+40+random(50)-25,random(50)-125,5);
  1690.           4:set_shoot((tmpe+50)*100,trunc(ey[i]+16)*100,100,random(50)-25,5);
  1691.           5:set_shoot((tmpe+45)*100,trunc(ey[i]+22)*100,+40+random(50)-25,random(50)+75,5);
  1692.           6:set_shoot((tmpe+40)*100,trunc(ey[i]+25)*100,random(50)-125,150,5);
  1693.           7:set_shoot((tmpe+28)*100,trunc(ey[i]+22)*100,-140+random(50)-25,random(50)+75,5);
  1694.           end;
  1695.         end;
  1696.       8:if (e_existence[i] mod 50<24) and (e_existence[i] mod 7=0) and (e_existence[i]>61) then
  1697.           set_shoot((tmpe+25)*100,trunc(ey[i]+15)*100,-500,0,6);
  1698.       100:if (e_existence[i] mod 10=0) and (e_existence[i]>100) then
  1699.         begin
  1700.           set_shoot((tmpe+45)*100,trunc(ey[i]+10)*100,-500,random(100)-50,1);
  1701.           set_shoot((tmpe+40)*100,trunc(ey[i]+30)*100,-500,random(100)-50,1);
  1702.           set_shoot((tmpe+40)*100,trunc(ey[i]+73)*100,-500,random(100)-50,1);
  1703.           set_shoot((tmpe+45)*100,trunc(ey[i]+93)*100,-500,random(100)-50,1);
  1704.         end;
  1705.       101:if (m_pause>1) and (e_existence[i]>50) then
  1706.         begin
  1707.           if (e_existence[i] mod 5=0) then
  1708.           begin
  1709.             set_shoot((tmpe+5)*100,trunc(ey[i]+70)*100,-500,random(400)-200,2);
  1710.             set_shoot((tmpe+5)*100,trunc(ey[i]+71)*100,-500,random(400)-200,2);
  1711.           end;
  1712.           if (e_existence[i] mod 10=0) then
  1713.           begin
  1714.             set_shoot((tmpe+50)*100,trunc(ey[i]+60)*100,-200,-random(50),4);
  1715.             set_shoot((tmpe+50)*100,trunc(ey[i]+80)*100,-200,random(50),4);
  1716.           end;
  1717.         end;
  1718.       102:if (e_existence[i]>80) then
  1719.         begin
  1720.           if (e_existence[i] mod 10=0) and (m_pause=0) then
  1721.           begin
  1722.             r:=random(6);
  1723.             case r of
  1724.             0:set_shoot((tmpe+65)*100,trunc(ey[i]+20)*100,-300,random(100)-50,7);
  1725.             1:set_shoot((tmpe+65)*100,trunc(ey[i]+30)*100,-300,random(100)-50,7);
  1726.             2:set_shoot((tmpe+65)*100,trunc(ey[i]+40)*100,-300,random(100)-50,7);
  1727.             3:set_shoot((tmpe+65)*100,trunc(ey[i]+77)*100,-300,random(100)-50,7);
  1728.             4:set_shoot((tmpe+65)*100,trunc(ey[i]+87)*100,-300,random(100)-50,7);
  1729.             5:set_shoot((tmpe+65)*100,trunc(ey[i]+97)*100,-300,random(100)-50,7);
  1730.             end;
  1731.           end;
  1732.           if m_pause>0 then set_shoot((tmpe+15)*100,trunc(ey[i]+60+random(6))*100,-200,random(50)-25,4);
  1733.         end;
  1734.       end;
  1735.     end;
  1736.   end;
  1737. end;
  1738.  
  1739. procedure stars_to_pic;
  1740. var i:word;
  1741. begin
  1742.   for i:=1 to 200 do
  1743.   begin
  1744.     sx[i]:=sx[i]-(sd[i] div 5+1);
  1745.     if sx[i]<=0 then
  1746.     begin
  1747.       sx[i]:=random(600)+400;
  1748.       sy[i]:=random(170);
  1749.       sd[i]:=random(8);
  1750.     end
  1751.     else if (sx[i]<320) then pic^[320*sy[i]+sx[i]]:=69+sd[i];
  1752.   end;
  1753. end;
  1754.  
  1755. procedure explosions_to_pic;
  1756. var i:word;
  1757.     color:byte;
  1758.     exptx,expty:word;
  1759. begin
  1760.   for i:=1 to 2000 do
  1761.     if exp_t[i]>0 then
  1762.     begin
  1763.       exp_x[i]:=exp_x[i]+exp_dx[i];
  1764.       exp_y[i]:=exp_y[i]+exp_dy[i];
  1765.       exptx:=exp_x[i] div 100;
  1766.       expty:=exp_y[i] div 100;
  1767.       if (exptx>0) and (exptx<319) and (expty>0) and (expty<170) then
  1768.       begin
  1769.         if exp_t[i]>8 then color:=8 else color:=exp_t[i];
  1770.         if exp_ty[i]=1 then pic^[320*expty+exptx]:=85-color
  1771.                        else pic^[320*expty+exptx]:=84+color;
  1772.       end
  1773.       else exp_t[i]:=1;
  1774.       if exp_ty[i]=1 then
  1775.       begin
  1776.         if exp_dx[i]>0 then exp_dx[i]:=exp_dx[i]+100 else exp_dx[i]:=exp_dx[i]-100;
  1777.         if exp_dy[i]>0 then exp_dy[i]:=exp_dy[i]+100 else exp_dy[i]:=exp_dy[i]-100;
  1778.       end
  1779.       else
  1780.       begin
  1781.         if exp_dx[i]>0 then exp_dx[i]:=exp_dx[i]+10 else exp_dx[i]:=exp_dx[i]-10;
  1782.         if exp_dy[i]>0 then exp_dy[i]:=exp_dy[i]+10 else exp_dy[i]:=exp_dy[i]-10;
  1783.       end;
  1784.       dec(exp_t[i]);
  1785.     end;
  1786. end;
  1787.  
  1788. procedure plane_to_pic;
  1789. var i,j,k:byte;
  1790.     tmp_i:word;
  1791. begin
  1792.   for i:=1 to pcy do
  1793.   begin
  1794.     tmp_i:=320*(i+py);
  1795.     for j:=1 to pcx do
  1796.       if plane[i,j]>0 then
  1797.       begin
  1798.         if pic^[tmp_i+j+px]>127 then plane_crash;
  1799.         pic^[tmp_i+j+px]:=plane[i,j];
  1800.       end;
  1801.   end;
  1802. end;
  1803.  
  1804. procedure flame;
  1805. var i:byte;
  1806. begin
  1807.   if (crashed=0) and ((main_dead=0) or (main_dead>140)) then
  1808.     for i:=1 to flame_lenght do pic^[320*(py+11)+px+1-i]:=63+i;
  1809. end;
  1810.  
  1811. procedure fire;
  1812. var i:byte;
  1813.     out:boolean;
  1814. begin
  1815.   if (crashed=0) and ((main_dead=0) or (main_dead>140)) then
  1816.   begin
  1817.     out:=false;
  1818.     i:=0;
  1819.     repeat
  1820.       inc(i);
  1821.       if (firex[i]=0) and (firey[i]=0) then
  1822.       begin
  1823.         firey[i]:=py+11;
  1824.         firex[i]:=px+50;
  1825.         out:=true;
  1826.         fire_delay:=4;
  1827.       end;
  1828.       if i>100 then out:=true;
  1829.     until out;
  1830.     if (sound_set) then
  1831.     begin
  1832.       if (exppl) and (StatusWord<>0) then
  1833.                                      else
  1834.                                      begin
  1835.                                        stopvoc;
  1836.                                        playvoc(fire1);
  1837.                                        firepl:=true;
  1838.                                        exppl:=false;
  1839.                                        fmpl:=false;
  1840.                                      end;
  1841.     end;
  1842.   end;
  1843. end;
  1844.  
  1845. procedure show_missiles;
  1846. var i,j,k:byte;
  1847. begin
  1848.   for j:=1 to 6 do
  1849.     for k:=1 to 50 do
  1850.       mem[$A000:320*(j+4)+154+k]:=0;
  1851.   for i:=1 to 5 do
  1852.     for j:=1 to 10 do
  1853.       for k:=1 to 25 do
  1854.         if (i<=msnum) and (myms[j,k]>0) then mem[$A000:320*(j+2)+146+7*i+k]:=myms[j,k]
  1855. end;
  1856.  
  1857. procedure fire_missile;
  1858. var i:byte;
  1859. begin
  1860.   if (msnum>0) and (crashed=0) and ((main_dead=0) or (main_dead>140)) then
  1861.   begin
  1862.     missile_delay:=1;
  1863.     fire_delay:=4;
  1864.     mx:=(px+15)*100;
  1865.     my:=(py+6)*100;
  1866.     mdx:=0;
  1867.     mdy:=random(25)-12;
  1868.     dec(msnum);
  1869.     show_missiles;
  1870.     if sound_set then
  1871.     begin
  1872.       if (StatusWord<>0) then stopvoc;
  1873.       playvoc(fm);
  1874.       firepl:=false;
  1875.       exppl:=false;
  1876.       fmpl:=true;
  1877.     end;
  1878.   end;
  1879. end;
  1880.  
  1881. procedure enemies_to_pic;
  1882. const bx:array[1..5] of byte=(25,25,26,43,43);
  1883. var i,sbs,overy1,overy2:word;
  1884.     j,k,gunfaze,r:byte;
  1885.     tr,tmpb,cut_l,cut_r:integer;
  1886. begin
  1887.   for i:=1 to enemy_num do
  1888.   begin
  1889.     if (et[i]>0) and (ex[i]>major_st-30) and (ex[i]<major_st+329) then
  1890.     begin
  1891.       inc(e_existence[i]);
  1892.       tmpb:=trunc(ex[i])-(major_st+20);
  1893.       if tmpb<0 then cut_l:=abs(tmpb) else cut_l:=0;
  1894.       case et[i] of
  1895.       1:begin
  1896.           if tmpb>269 then cut_r:=tmpb-269 else cut_r:=0;
  1897.           for j:=1 to 28 do
  1898.           begin
  1899.             sbs:=320*(trunc(ey[i])+j);
  1900.             for k:=1+cut_l to 50-cut_r do
  1901.               if e1^[j,k]>128 then pic^[sbs+tmpb+k]:=e1^[j,k]
  1902.           end;
  1903.           ex[i]:=ex[i]-(esx[i]-1);
  1904.         end;
  1905.       2:begin
  1906.           if tmpb>259 then cut_r:=tmpb-259 else cut_r:=0;
  1907.           for j:=1 to 22 do
  1908.           begin
  1909.             sbs:=320*(trunc(ey[i])+j);
  1910.             for k:=1+cut_l to 60-cut_r do
  1911.               if e2^[j,k]>128 then pic^[sbs+tmpb+k]:=e2^[j,k]
  1912.           end;
  1913.           ex[i]:=ex[i]-(esx[i]-1);
  1914.         end;
  1915.       3:begin
  1916.           if tmpb>259 then cut_r:=tmpb-259 else cut_r:=0;
  1917.           if major_st mod 6<3 then
  1918.             for j:=1 to 10 do
  1919.             begin
  1920.               sbs:=320*(trunc(ey[i])+j);
  1921.               for k:=1+cut_l to 51-cut_r do
  1922.                 if e3p1^[j,k]>128 then pic^[sbs+tmpb+k]:=e3p1^[j,k]
  1923.  
  1924.             end
  1925.           else
  1926.             for j:=1 to 10 do
  1927.             begin
  1928.               sbs:=320*(trunc(ey[i])+j);
  1929.               for k:=1+cut_l to 51-cut_r do
  1930.                 if e3p2^[j,k]>128 then pic^[sbs+tmpb+k]:=e3p2^[j,k]
  1931.             end;
  1932.           ex[i]:=ex[i]-(esx[i]-1);
  1933.           if esy[i]<>0 then if tmpb+k<e_where_sy[i] then ey[i]:=ey[i]+esy[i];
  1934.         end;
  1935.         4:begin
  1936.           if tmpb>284 then cut_r:=tmpb-284 else cut_r:=0;
  1937.           for j:=1 to 38 do
  1938.           begin
  1939.             sbs:=320*(trunc(ey[i])+j);
  1940.             for k:=1+cut_l to 29-cut_r do
  1941.               if e4^[j,k]>128 then pic^[sbs+tmpb+k]:=e4^[j,k]
  1942.           end;
  1943.           ex[i]:=ex[i]-esx[i];
  1944.         end;
  1945.         5:begin
  1946.           if tmpb>265 then cut_r:=tmpb-265 else cut_r:=0;
  1947.           for j:=1 to 26 do
  1948.           begin
  1949.             sbs:=320*(trunc(ey[i])+j);
  1950.             for k:=1+cut_l to 53-cut_r do
  1951.               if e5^[j,k]>128 then pic^[sbs+tmpb+k]:=e5^[j,k]
  1952.           end;
  1953.            if ((esx[i]<0) and (tmpb<150)) or ((esx[i]>0) and (tmpb>250)) then esx[i]:=-esx[i];
  1954.            if ((esy[i]<0) and (ey[i]>130)) or ((esy[i]>0) and (ey[i]<10)) then esy[i]:=-esy[i];
  1955.            ex[i]:=ex[i]+esx[i];
  1956.            ey[i]:=ey[i]-esy[i];
  1957.           end;
  1958.         6:begin
  1959.             if tmpb>265 then cut_r:=tmpb-265 else cut_r:=0;
  1960.             for j:=1 to 29 do
  1961.             begin
  1962.               sbs:=320*(trunc(ey[i])+j);
  1963.               for k:=1+cut_l to 48-cut_r do
  1964.                 if e6^[j,k]>128 then pic^[sbs+tmpb+k]:=e6^[j,k]
  1965.             end;
  1966.             ex[i]:=ex[i]-esx[i];
  1967.           end;
  1968.         7:begin
  1969.             if tmpb>255 then cut_r:=tmpb-255 else cut_r:=0;
  1970.             for j:=1 to 29 do
  1971.             begin
  1972.               sbs:=320*(trunc(ey[i])+j);
  1973.               if major_st mod 8<4 then
  1974.                 for k:=1+cut_l to 59-cut_r do
  1975.                   if e7p1^[j,k]>128 then pic^[sbs+tmpb+k]:=e7p1^[j,k] else
  1976.                                   else
  1977.                 for k:=1+cut_l to 59-cut_r do
  1978.                   if e7p2^[j,k]>128 then pic^[sbs+tmpb+k]:=e7p2^[j,k]
  1979.             end;
  1980.           end;
  1981.         8:begin
  1982.             if tmpb>250 then cut_r:=tmpb-250 else cut_r:=0;
  1983.             for j:=1 to 31 do
  1984.             begin
  1985.               sbs:=320*(trunc(ey[i])+j);
  1986.               for k:=1+cut_l to 64-cut_r do
  1987.                 if e8^[j,k]>128 then pic^[sbs+tmpb+k]:=e8^[j,k]
  1988.             end;
  1989.             case e_existence[i] of
  1990.             1..49:gunfaze:=5;
  1991.             50..53:gunfaze:=4;
  1992.             54..57:gunfaze:=3;
  1993.             58..61:gunfaze:=2;
  1994.             else gunfaze:=1;
  1995.             end;
  1996.             for j:=1 to 7 do
  1997.             begin
  1998.               sbs:=320*(trunc(ey[i])+j+12);
  1999.               for k:=1 to 37 do
  2000.                 if (guns[gunfaze]^[j,k]>128) and (tmpb+k+bx[gunfaze]<310) and (tmpb+k+bx[gunfaze]>0) then
  2001.                   pic^[sbs+tmpb+k+bx[gunfaze]]:=guns[gunfaze]^[j,k];
  2002.             end;
  2003.             if (e_existence[i]<50) then ex[i]:=ex[i]-esx[i]
  2004.                                    else begin
  2005.                                            if major_st>2600 then ex[i]:=ex[i]-1;
  2006.                                            ex[i]:=ex[i]+1;
  2007.                                            ey[i]:=ey[i]+esy[i];
  2008.                                            if ey[i]<=5 then esy[i]:=-esy[i];
  2009.                                            if ey[i]>=130 then esy[i]:=-esy[i];
  2010.                                         end;
  2011.           end;
  2012.        100:begin
  2013.              if tmpb>235 then cut_r:=tmpb-235 else cut_r:=0;
  2014.              for j:=1 to 103 do
  2015.              begin
  2016.                sbs:=320*(trunc(ey[i])+j);
  2017.                for k:=1+cut_l to 79-cut_r do
  2018.                  if m1^[j,k]>128 then pic^[sbs+tmpb+k]:=m1^[j,k]
  2019.              end;
  2020.              if major_st>ch_pal_pos+120 then
  2021.                                         begin
  2022.                                            ex[i]:=ex[i]+1;
  2023.                                            ey[i]:=ey[i]+esy[i];
  2024.                                            if ey[i]<=8 then esy[i]:=-esy[i];
  2025.                                            if ey[i]>=62 then esy[i]:=-esy[i];
  2026.                                         end;
  2027.            end;
  2028.        101:begin
  2029.              if tmpb>199 then cut_r:=tmpb-199 else cut_r:=0;
  2030.              for j:=1 to 140 do
  2031.              begin
  2032.                sbs:=320*(trunc(ey[i])+j);
  2033.                if (ey[i]+j>0) and (ey[i]+j<165) then
  2034.                  for k:=1+cut_l to 115-cut_r do
  2035.                    if m2^[j,k]>128 then pic^[sbs+tmpb+k]:=m2^[j,k]
  2036.              end;
  2037.              { MASTERS MOVING }
  2038.              if major_st>ch_pal_pos+90 then
  2039.              begin
  2040.                if m_pause=0 then
  2041.                begin
  2042.                  ex[i]:=ex[i]+esx[i];
  2043.                  ey[i]:=ey[i]+esy[i];
  2044.                  if (tmpb<30) and (esx[i]<0) then
  2045.                  begin
  2046.                    esx[i]:=-esx[i]+2;
  2047.                    esy[i]:=-esy[i];
  2048.                  end;
  2049.                  if (tmpb>220) and (esx[i]>0) then m_pause:=30;
  2050.                end;
  2051.                if m_pause=1 then
  2052.                begin
  2053.                  tr:=random(3)+1;
  2054.                  esx[i]:=-2;
  2055.                  case tr of
  2056.                  1:esy[i]:=-0.5;
  2057.                  2:esy[i]:=0;
  2058.                  3:esy[i]:=0.5;
  2059.                  end;
  2060.                  m_pause:=0;
  2061.                end;
  2062.                if m_pause>1 then
  2063.                begin
  2064.                  ex[i]:=ex[i]+1;
  2065.                  dec(m_pause);
  2066.                end;
  2067.              end;
  2068.            end;
  2069.        102:begin
  2070.              if tmpb>195 then cut_r:=tmpb-195 else cut_r:=0;
  2071.              if ey[i]<0 then overy1:=trunc(-ey[i]) else overy1:=0;
  2072.              if ey[i]>40 then overy2:=trunc(ey[i]-40) else overy2:=0;
  2073.              for j:=1+overy1 to 127-overy2 do
  2074.              begin
  2075.                sbs:=320*(trunc(ey[i])+j);
  2076.                for k:=1+cut_l to 120-cut_r do
  2077.                  if m3^[j,k]>128 then pic^[sbs+tmpb+k]:=m3^[j,k]
  2078.              end;
  2079.              if m_pause=0 then
  2080.              begin
  2081.                ex[i]:=ex[i]+esx[i];
  2082.                ey[i]:=ey[i]+esy[i];
  2083.                if (tmpb<=150) and (esx[i]<>2) then
  2084.                begin
  2085.                  esx[i]:=2;
  2086.                  r:=random(2);
  2087.                  if r=0 then esy[i]:=-0.5 else esy[i]:=0.5;
  2088.                  m_pause:=20;
  2089.                end;
  2090.                if (ey[i]<=-20) then
  2091.                begin
  2092.                  if esx[i]=2 then
  2093.                  begin
  2094.                    esx[i]:=1;
  2095.                    esy[i]:=2;
  2096.                  end
  2097.                  else
  2098.                  begin
  2099.                    esx[i]:=0;
  2100.                    esy[i]:=0.5;
  2101.                  end;
  2102.                  m_pause:=20;
  2103.                end;
  2104.                if ey[i]>=62 then
  2105.                begin
  2106.                  if esx[i]=1 then
  2107.                  begin
  2108.                    esx[i]:=0;
  2109.                    esy[i]:=-0.5;
  2110.                  end
  2111.                  else
  2112.                  begin
  2113.                    esx[i]:=1;
  2114.                    esy[i]:=-2;
  2115.                  end;
  2116.                  m_pause:=20;
  2117.                end;
  2118.              end
  2119.              else
  2120.              begin
  2121.                dec(m_pause);
  2122.                ex[i]:=ex[i]+1;
  2123.              end;
  2124.            end;
  2125.        201:begin
  2126.              if tmpb>245 then cut_r:=tmpb-245 else cut_r:=0;
  2127.              for j:=1 to 47 do
  2128.              begin
  2129.                sbs:=320*(trunc(ey[i])+j);
  2130.                for k:=1+cut_l to 68-cut_r do
  2131.                  if mtr1^[j,k]>128 then pic^[sbs+tmpb+k]:=mtr1^[j,k]
  2132.              end;
  2133.              ex[i]:=ex[i]-esx[i];
  2134.            end;
  2135.        202:begin
  2136.              if tmpb>275 then cut_r:=tmpb-275 else cut_r:=0;
  2137.              for j:=1 to 21 do
  2138.              begin
  2139.                sbs:=320*(trunc(ey[i])+j);
  2140.                for k:=1+cut_l to 38-cut_r do
  2141.                  if mtr2^[j,k]>128 then pic^[sbs+tmpb+k]:=mtr2^[j,k]
  2142.              end;
  2143.              ex[i]:=ex[i]-esx[i];
  2144.            end;
  2145.        203:begin
  2146.              if tmpb>275 then cut_r:=tmpb-275 else cut_r:=0;
  2147.              for j:=1 to 22 do
  2148.              begin
  2149.                sbs:=320*(trunc(ey[i])+j);
  2150.                for k:=1+cut_l to 39-cut_r do
  2151.                  if mtr3^[j,k]>128 then pic^[sbs+tmpb+k]:=mtr3^[j,k]
  2152.              end;
  2153.              ex[i]:=ex[i]-esx[i];
  2154.            end;
  2155.        204:begin
  2156.              if tmpb>270 then cut_r:=tmpb-270 else cut_r:=0;
  2157.              for j:=1 to 25 do
  2158.              begin
  2159.                sbs:=320*(trunc(ey[i])+j);
  2160.                for k:=1+cut_l to 43-cut_r do
  2161.                  if mtr4^[j,k]>128 then pic^[sbs+tmpb+k]:=mtr4^[j,k]
  2162.              end;
  2163.              ex[i]:=ex[i]-esx[i];
  2164.            end;
  2165.        205:begin
  2166.              if tmpb>270 then cut_r:=tmpb-270 else cut_r:=0;
  2167.              for j:=1 to 36 do
  2168.              begin
  2169.                sbs:=320*(trunc(ey[i])+j);
  2170.                for k:=1+cut_l to 43-cut_r do
  2171.                  if mtr5^[j,k]>128 then pic^[sbs+tmpb+k]:=mtr5^[j,k]
  2172.              end;
  2173.              ex[i]:=ex[i]-esx[i];
  2174.            end;
  2175.       end;
  2176.     end;
  2177.   end;
  2178. end;
  2179.  
  2180. procedure set_pieces(k:word;t:byte);
  2181. begin
  2182.   while exp_t[hole]>0 do
  2183.   begin
  2184.     inc(hole);
  2185.     if hole>2500 then error_msg('POVECAJ MATRIKE (IN OSTALO) ZA EXSPLOZIJE!');
  2186.   end;
  2187.   exp_x[hole]:=(trunc(ex[k])-(major_st+30)+ej)*100;
  2188.   exp_y[hole]:=trunc((ey[k]+ei)*100);
  2189.   exp_dx[hole]:=(random(45)-22)*10;
  2190.   exp_dy[hole]:=(random(35)-17)*10;
  2191.   exp_t[hole]:=t;
  2192.   exp_ty[hole]:=1;
  2193. end;
  2194.  
  2195. procedure clean_enemy_damage;
  2196. begin
  2197.   for ei:=164 to 220 do
  2198.     for ej:=1 to 7 do
  2199.       mem[$A000:320*(188+ej)+ei]:=0;
  2200. end;
  2201.  
  2202. procedure hit(n,i1,j1,i2,j2:byte;scr,k:word;shpgone:boolean;mind:word);
  2203. begin
  2204.   for ei:=i1 to i2 do
  2205.     for ej:=j1 to j2 do
  2206.     case n of
  2207.     1:if e1^[ei,ej]>128 then set_pieces(k,8);
  2208.     2:if e2^[ei,ej]>128 then set_pieces(k,10);
  2209.     3:if e3p1^[ei,ej]>128 then set_pieces(k,10);
  2210.     4:if e4^[ei,ej]>128 then set_pieces(k,10);
  2211.     5:if e5^[ei,ej]>128 then set_pieces(k,10);
  2212.     6:if e6^[ei,ej]>128 then set_pieces(k,9);
  2213.     7:if e7p1^[ei,ej]>128 then set_pieces(k,9);
  2214.     8:if e8^[ei,ej]>128 then set_pieces(k,9);
  2215.     end;
  2216.   if scr>0 then
  2217.   begin
  2218.     score:=score+scr;
  2219.     show_score;
  2220.   end;
  2221.   if shpgone then et[k]:=0 else dec(e_damage[k],mind);
  2222. end;
  2223.  
  2224. procedure chk_bonus_missile(k:word);
  2225. begin
  2226.   if bonus_missile[k]=true then
  2227.   begin
  2228.     bmy:=trunc(ey[k]) + 10;
  2229.     bmx:=trunc(ex[k])-(major_st+30) + 10;
  2230.     bonus_missile[k]:=false;
  2231.   end;
  2232. end;
  2233.  
  2234. procedure bonus_missile_to_pic;
  2235. var i,j,hit_st:integer;
  2236. begin
  2237.   if (bmy>0) and (bmx>0) then
  2238.   begin
  2239.     hit_st:=0;
  2240.     for i:=1 to 10 do
  2241.       for j:=1 to 25 do
  2242.         if (myms[i,j]>0) and (bmx+j>=0) then
  2243.         begin
  2244.           if (pic^[320*(bmy+i)+bmx+j]>0) and (pic^[320*(bmy+i)+bmx+j]<40) then inc(hit_st);
  2245.           pic^[320*(bmy+i)+bmx+j]:=myms[i,j];
  2246.         end;
  2247.     if major_st mod 2 = 0 then inc(bmy);
  2248.     bmx:=bmx-2;
  2249.     if hit_st>30 then
  2250.     begin
  2251.       bmy:=0;
  2252.       bmx:=0;
  2253.       if msnum<5 then inc(msnum);
  2254.       show_missiles;
  2255.     end;
  2256.     if (bmy>=170) then
  2257.     begin
  2258.       bmy:=0;
  2259.       bmx:=0;
  2260.     end;
  2261.   end;
  2262. end;
  2263.  
  2264. procedure check_enemy(fy,fx,mind:word);
  2265. var k,l,m:word;
  2266.     tmpe:integer;
  2267. begin
  2268.   for k:=1 to enemy_num do
  2269.   if et[k]>0 then
  2270.   begin
  2271.     tmpe:=trunc(ex[k])-(major_st+30);
  2272.     case et[k] of
  2273.     1:if (fx>=tmpe) and (fx<=tmpe+50) and (fy>=ey[k]) and (fy<=ey[k]+28) then
  2274.       begin
  2275.         chk_bonus_missile(k);
  2276.         hit(1,1,1,28,50,20,k,true,mind);
  2277.         play_exp;
  2278.       end;
  2279.     2:if (fx>=tmpe) and (fx<=tmpe+60) and (fy>=ey[k]) and (fy<=ey[k]+22) then
  2280.         if e_damage[k]<=mind then
  2281.                              begin
  2282.                                hit(2,1,1,22,60,50,k,true,mind);
  2283.                                play_exp;
  2284.                              end
  2285.                              else hit(2,10,25,14,40,0,k,false,mind);
  2286.     3:if (fx>=tmpe) and (fx<=tmpe+51) and (fy>=ey[k]) and (fy<=ey[k]+10) then
  2287.     begin
  2288.       hit(3,1,1,10,51,150,k,true,mind);
  2289.       play_exp;
  2290.     end;
  2291.     4:if (fx>=tmpe) and (fx<=tmpe+29) and (fy>=ey[k]) and (fy<=ey[k]+38) then
  2292.         if e_damage[k]<=mind then
  2293.                              begin
  2294.                                hit(4,1,1,38,29,100,k,true,mind);
  2295.                                play_exp;
  2296.                              end
  2297.                              else hit(4,10,10,28,19,0,k,false,mind);
  2298.     5:if (fx>=tmpe) and (fx<=tmpe+53) and (fy>=ey[k]) and (fy<=ey[k]+26) then
  2299.         if e_damage[k]<=mind then
  2300.                              begin
  2301.                                hit(5,1,1,26,53,210,k,true,mind);
  2302.                                play_exp;
  2303.                              end
  2304.                              else hit(5,12,31,17,45,0,k,false,mind);
  2305.     6:if (fx>=tmpe) and (fx<=tmpe+48) and (fy>=ey[k]) and (fy<=ey[k]+29) then
  2306.           if e_damage[k]<=mind then
  2307.                                begin
  2308.                                  chk_bonus_missile(k);
  2309.                                  hit(6,1,1,29,48,100,k,true,mind);
  2310.                                  play_exp;
  2311.                                end
  2312.                                else hit(6,10,20,19,38,0,k,false,mind);
  2313.     7:if (fx>=tmpe) and (fx<=tmpe+59) and (fy>=ey[k]) and (fy<=ey[k]+29) then
  2314.           if e_damage[k]<=mind then
  2315.                                begin
  2316.                                  chk_bonus_missile(k);
  2317.                                  hit(7,5,10,25,40,150,k,true,mind);
  2318.                                  play_exp;
  2319.                                end
  2320.                                else hit(7,10,30,19,42,0,k,false,mind);
  2321.     8:if (fx>=tmpe+5) and (fx<=tmpe+30) and (fy>=ey[k]+10) and (fy<=ey[k]+23) and (e_existence[k]>61) then
  2322.           if e_damage[k]<=mind then
  2323.           begin
  2324.             hit(8,1,1,31,64,250,k,true,mind);
  2325.             play_exp;
  2326.           end
  2327.           else
  2328.           begin
  2329.             for l:=1 to 7 do
  2330.               for m:=1 to 37 do
  2331.               begin
  2332.                 ei:=l+12;
  2333.                 ej:=m+35;
  2334.                 if guns[1]^[ei,ej]>128 then set_pieces(k,10);
  2335.               end;
  2336.             dec(e_damage[k],mind);
  2337.           end;
  2338.     100:if (fx>=tmpe) and (fx<=tmpe+79) and (fy>=ey[k]) and (fy<=ey[k]+103) then
  2339.           if e_damage[k]<=mind then
  2340.           begin
  2341.             for l:=1 to 39 do
  2342.               for ej:=1 to 103 do
  2343.               begin
  2344.                 ei:=l*2;
  2345.                 if m1^[ei,ej]>128 then set_pieces(k,10);
  2346.               end;
  2347.               et[k]:=0;
  2348.               score:=score+2000;
  2349.               show_score;
  2350.               main_dead:=200;
  2351.               clean_enemy_damage;
  2352.               play_exp;
  2353.             end
  2354.             else
  2355.             begin
  2356.               for l:=24 to 27 do
  2357.                 for ej:=40 to 63 do
  2358.                 begin
  2359.                   ei:=l*2;
  2360.                   if m1^[ei,ej]>128 then set_pieces(k,10);
  2361.                 end;
  2362.               dec(e_damage[k],mind);
  2363.               enemy_damage(trunc(e_damage[k]/e_whole_damage*100));
  2364.             end;
  2365.     101:if (fx>=tmpe) and (fx<=tmpe+115) and (fy>=ey[k]) and (fy<=ey[k]+140) then
  2366.           if e_damage[k]<=mind then
  2367.           begin
  2368.             for l:=1 to 70 do
  2369.               for m:=1 to 57 do
  2370.               begin
  2371.                 ei:=l*2;
  2372.                 ej:=m*2;
  2373.                 if m2^[ei,ej]>128 then set_pieces(k,10);
  2374.               end;
  2375.             et[k]:=0;
  2376.             score:=score+5000;
  2377.             show_score;
  2378.             main_dead:=200;
  2379.             clean_enemy_damage;
  2380.             play_exp;
  2381.           end
  2382.           else
  2383.           begin
  2384.             for l:=32 to 37 do
  2385.               for ej:=15 to 35 do
  2386.               begin
  2387.                 ei:=l*2;
  2388.                 if m2^[ei,ej]>128 then set_pieces(k,8);
  2389.               end;
  2390.             dec(e_damage[k],mind);
  2391.             enemy_damage(trunc(e_damage[k]/e_whole_damage*100));
  2392.           end;
  2393.     102:if (fx>=tmpe) and (fx<=tmpe+120) and (fy>=ey[k]) and (fy<=ey[k]+127) then
  2394.           if e_damage[k]<=mind then
  2395.           begin
  2396.             for l:=1 to 70 do
  2397.               for m:=1 to 57 do
  2398.               begin
  2399.                 ei:=l*2;
  2400.                 ej:=m*2;
  2401.                 if m3^[ei,ej]>128 then set_pieces(k,10);
  2402.               end;
  2403.             et[k]:=0;
  2404.             score:=score+6000;
  2405.             show_score;
  2406.             main_dead:=200;
  2407.             clean_enemy_damage;
  2408.             play_exp;
  2409.           end
  2410.           else
  2411.           begin
  2412.             for ei:=trunc(fy-ey[k]) to trunc(fy-ey[k]+10) do
  2413.               for ej:=25 to 45 do
  2414.                 if m3^[ei,ej]>128 then set_pieces(k,8);
  2415.             dec(e_damage[k],mind);
  2416.             enemy_damage(trunc(e_damage[k]/e_whole_damage*100));
  2417.           end;
  2418.     end;
  2419.   end;
  2420. end;
  2421.  
  2422. procedure plane_fire_to_pic;
  2423. label skip;
  2424. var i,j:byte;
  2425. begin
  2426.   hole:=1;
  2427.   for i:=1 to 100 do
  2428.     if (firex[i]>0) and (firey[i]>0) then
  2429.     begin
  2430.       firex[i]:=firex[i]+3;
  2431.       for j:=4 downto 0 do if firex[i]+j<320 then
  2432.         if pic^[320*(firey[i])+firex[i]+j]>127 then
  2433.         begin
  2434.           check_enemy(firey[i],firex[i]+j,1);
  2435.           firex[i]:=0;
  2436.           firey[i]:=0;
  2437.           goto skip;
  2438.         end else pic^[320*(firey[i])+firex[i]+j]:=40+j;
  2439.       if firex[i]=319 then
  2440.       begin
  2441.         firex[i]:=0;
  2442.         firey[i]:=0;
  2443.       end;
  2444. skip:
  2445.     end;
  2446. end;
  2447.  
  2448. procedure enemy_fire_to_pic;
  2449. label skip;
  2450. var i,j,k:word;
  2451.     hx,hy,shy:word;
  2452.     dx,dy:integer;
  2453. begin
  2454.   for i:=1 to 500 do
  2455.     if ef_t[i]>0 then
  2456.     begin
  2457.       hx:=ef_x[i] div 100;
  2458.       hy:=ef_y[i] div 100;
  2459.       shy:=320*hy;
  2460.       case ef_t[i] of
  2461.       1:begin
  2462.           if (pic^[shy+hx]>0) and (pic^[shy+hx]<41) then
  2463.             if damage>2 then
  2464.             begin
  2465.               damage:=damage-2;
  2466.               set_my_pieces(7);
  2467.               show_damage;
  2468.               ef_t[i]:=0;
  2469.             end
  2470.             else plane_crash;
  2471.           for j:=0 to 3 do pic^[shy+hx+j]:=46+j;
  2472.           ef_x[i]:=ef_x[i]+ef_dx[i];
  2473.           ef_y[i]:=ef_y[i]+ef_dy[i];
  2474.           if ef_x[i]<=500 then ef_t[i]:=0;
  2475.         end;
  2476.       2:begin
  2477.           if (pic^[shy+hx]>0) and (pic^[shy+hx]<41) then
  2478.             if damage>3 then
  2479.             begin
  2480.               damage:=damage-3;
  2481.               set_my_pieces(8);
  2482.               show_damage;
  2483.               ef_t[i]:=0;
  2484.             end
  2485.             else plane_crash;
  2486.           for j:=0 to 3 do pic^[shy+hx+j]:=41+j;
  2487.           ef_x[i]:=ef_x[i]+ef_dx[i];
  2488.           ef_y[i]:=ef_y[i]+ef_dy[i];
  2489.           if (ef_x[i]<=500) or (ef_y[i]<=500) or (ef_y[i]>=16500) then ef_t[i]:=0;
  2490.         end;
  2491.       3:begin
  2492.           for j:=hx downto 0 do
  2493.             if (pic^[shy+j]>0) and (pic^[shy+j]<41) then
  2494.             begin
  2495.               if damage>1 then
  2496.               begin
  2497.                 damage:=damage-1;
  2498.                 set_my_pieces(6);
  2499.                 show_damage;
  2500.               end
  2501.               else plane_crash;
  2502.               j:=1;
  2503.             end;
  2504.             if hx>20 then ef_x[i]:=ef_x[i]-2000 else ef_t[i]:=0;
  2505.           for j:=0 to hx do pic^[shy+hx-j]:=50+j div 40;
  2506.         end;
  2507.       4:begin
  2508.           if (pic^[shy+hx]>0) and (pic^[shy+hx]<41) then
  2509.             if damage>2 then
  2510.             begin
  2511.               damage:=damage-2;
  2512.               set_my_pieces(7);
  2513.               show_damage;
  2514.               ef_t[i]:=0;
  2515.             end
  2516.             else plane_crash;
  2517.             if hx mod 8<4 then
  2518.             begin
  2519.               pic^[shy+hx-1]:=43;
  2520.               pic^[shy+hx]:=44;
  2521.               pic^[shy+hx+1]:=43;
  2522.             end
  2523.             else
  2524.             begin
  2525.               pic^[shy-320+hx]:=43;
  2526.               pic^[shy+hx]:=44;
  2527.               pic^[shy+320+hx]:=43;
  2528.             end;
  2529.             ef_x[i]:=ef_x[i]+ef_dx[i];
  2530.             ef_y[i]:=ef_y[i]+ef_dy[i];
  2531.             if (ef_x[i]<=200) or (ef_y[i]<=500) or (ef_y[i]>=16500) then ef_t[i]:=0;
  2532.         end;
  2533.       5:begin
  2534.           if (pic^[shy+hx]>0) and (pic^[shy+hx]<41) then
  2535.             if damage>1 then
  2536.             begin
  2537.               damage:=damage-1;
  2538.               set_my_pieces(6);
  2539.               show_damage;
  2540.               ef_t[i]:=0;
  2541.             end
  2542.             else plane_crash;
  2543.           if ef_dx[i]>0 then dx:=ef_dx[i] div 100+1
  2544.                         else dx:=ef_dx[i] div 100;
  2545.           dy:=ef_dy[i] div 70;
  2546.           for j:=0 to 3 do pic^[shy+hx+trunc(320*j*dy)+trunc(dx*j)]:=41+j;
  2547.           ef_x[i]:=ef_x[i]+ef_dx[i];
  2548.           ef_y[i]:=ef_y[i]+ef_dy[i];
  2549.           if (ef_x[i]<=500) or (ef_x[i]>=31500) or (ef_y[i]<=500) or (ef_y[i]>=16500) then ef_t[i]:=0;
  2550.         end;
  2551.       6:begin
  2552.           if (pic^[shy+hx]>0) and (pic^[shy+hx]<41) then
  2553.             if damage>2 then
  2554.             begin
  2555.               damage:=damage-2;
  2556.               set_my_pieces(7);
  2557.               show_damage;
  2558.               ef_t[i]:=0;
  2559.             end
  2560.             else plane_crash;
  2561.           for j:=0 to 5 do pic^[shy+hx+j]:=127-j;
  2562.           ef_x[i]:=ef_x[i]+ef_dx[i];
  2563.           ef_dx[i]:=ef_dx[i]+3;
  2564.           if (ef_x[i]<=500) then ef_t[i]:=0;
  2565.         end;
  2566.       7:begin
  2567.         for j:=1 to 10 do
  2568.           for k:=1 to 25 do
  2569.             if (ms[j,k]>0) and (hx+k<319) then
  2570.             if (pic^[shy+hx+(320*j)+k]>0) and (pic^[shy+hx+(320*j)+k]<40) and (ms[j,k]>0) then
  2571.               if damage>10 then
  2572.               begin
  2573.                 damage:=damage-10;
  2574.                 set_my_pieces(9);
  2575.                 set_my_pieces(9);
  2576.                 show_damage;
  2577.                 ef_t[i]:=0;
  2578.                 goto skip;
  2579.               end
  2580.               else
  2581.               begin
  2582.                 plane_crash;
  2583.                 goto skip;
  2584.               end;
  2585. skip:
  2586.           for j:=1 to 10 do
  2587.             for k:=1 to 25 do
  2588.               if (ms[j,k]>0) and (hx+k<319) then pic^[shy+hx+(320*j)+k]:=ms[j,k];
  2589.           ef_x[i]:=ef_x[i]-ef_dx[i];
  2590.           ef_y[i]:=ef_y[i]-ef_dy[i];
  2591.           ef_dx[i]:=ef_dx[i]+20;
  2592.           if (ef_x[i]<=500) or (ef_y[i]<=100) or (ef_y[i]>=16500) then ef_t[i]:=0;
  2593.         end;
  2594.       end;
  2595.     end;
  2596. end;
  2597.  
  2598. procedure missile_to_pic;
  2599. label skip;
  2600. var j,k:byte;
  2601.     sw:word;
  2602. begin
  2603.   hole:=1;
  2604.   for j:=1 to 10 do
  2605.   begin
  2606.     sw:=320*(my div 100+j);
  2607.     for k:=1 to 25 do
  2608.       if (myms[j,k]>0) and (mx div 100+k<319) then
  2609.       begin
  2610.         if pic^[sw+mx div 100+k]>127 then
  2611.         begin
  2612.           check_enemy(my div 100+j,mx div 100+k,10);
  2613.           missile_delay:=0;
  2614.           goto skip;
  2615.         end
  2616.         else pic^[sw+mx div 100+k]:=myms[j,k];
  2617.       end;
  2618.   end;
  2619.   mx:=mx+mdx;
  2620.   mdx:=mdx+20;
  2621.   if mx>=31800 then missile_delay:=0;
  2622. skip:
  2623. end;
  2624.  
  2625. procedure beri_cfg;
  2626. var ch:char;
  2627. begin
  2628.   if exist('ETTV.CFG') then
  2629.   begin
  2630.     assign(t,'ETTV.CFG');
  2631.     reset(t);
  2632.     read(t,ch);if ch='Y' then music_set:=true else music_set:=false;
  2633.     read(t,ch);if ch='Y' then sound_set:=true else sound_set:=false;
  2634.     read(t,ch);if ch='Y' then keyboard:=true else keyboard:=false;
  2635.     read(t,ch);if ch='Y' then mouse:=true else mouse:=false;
  2636.     readln(t,ch);if ch='Y' then joystick:=true else joystick:=false;
  2637.     readln(t,jminx);readln(t,jminy);readln(t,jmaxx);readln(t,jmaxy);
  2638.     readln(t,jcx);readln(t,jcy);
  2639.     close(t);
  2640.   end
  2641.   else
  2642.   begin
  2643.     music_set:=true;
  2644.     sound_set:=false;
  2645.     keyboard:=false;
  2646.     mouse:=true;
  2647.     joystick:=false;
  2648.   end;
  2649. end;
  2650.  
  2651. procedure pisi_cfg;
  2652. var ch:char;
  2653. begin
  2654.   assign(t,'ETTV.CFG');
  2655.   rewrite(t);
  2656.   if music_set=true then write(t,'Y') else write(t,'N');
  2657.   if sound_set=true then write(t,'Y') else write(t,'N');
  2658.   if keyboard=true then write(t,'Y') else write(t,'N');
  2659.   if mouse=true then write(t,'Y') else write(t,'N');
  2660.   if joystick=true then writeln(t,'Y') else writeln(t,'N');
  2661.   writeln(t,jminx);writeln(t,jminy);writeln(t,jmaxx);writeln(t,jmaxy);
  2662.   writeln(t,jcx);writeln(t,jcy);
  2663.   close(t);
  2664. end;
  2665.  
  2666. procedure draw_page(page:byte);
  2667. begin
  2668.   case page of
  2669.   1:begin
  2670.       options(104,118,'PLAY GAME',13,33);
  2671.       options(120,144,'OPT',13,33);options(156,144,'I',13,33);options(167,144,'ONS',13,33);
  2672.       options(93,170,'EX',13,33);options(117,170,'I',13,33);options(127,170,'T TO DOS',13,33);
  2673.     end;
  2674.   2:begin
  2675.       options(112,118,'CONTROLS',13,33);
  2676.       if sound_set then options(107,144,'SOUND  ON',13,33)
  2677.                    else options(107,144,'SOUND OFF',13,33);
  2678.       if music_set=true then options(106,170,'MUSIC  ON',13,33)
  2679.                         else options(106,170,'MUSIC OFF',13,33)
  2680.     end;
  2681.   3:begin
  2682.       if keyboard then options(85,113,'KEYBOARD  ON',13,33)
  2683.                   else options(85,113,'KEYBOARD OFF',13,33);
  2684.       if joystick then options(85,135,'JOYSTICK  ON',13,33)
  2685.                   else options(85,135,'JOYSTICK OFF',13,33);
  2686.       if mouse then options(103,157,'MOUSE  ON',13,33)
  2687.                else options(103,157,'MOUSE OFF',13,33);
  2688.       options(103,179,'CALIBRATE',13,33);
  2689.     end;
  2690.   4:begin
  2691.       case calibration_faze of
  2692.       1:mouttextxy(55,160,'MOVE JOYSTICK TO UPPER LEFT CORNER',6,33);
  2693.       2:mouttextxy(50,160,'MOVE JOYSTICK TO BOTTOM RIGHT CORNER',6,33);
  2694.       3:mouttextxy(85,160,'MOVE JOYSTICK IN CENTER',6,33);
  2695.       end;
  2696.       mouttextxy(115,175,'AND PRESS FIRE',6,33);
  2697.     end;
  2698.   end;
  2699. end;
  2700.  
  2701. procedure chk_joystick;
  2702. var B_status1,B_status2,st:byte;
  2703.     port201:byte;
  2704. begin
  2705.   jx:=0;
  2706.   jy:=0;
  2707.   port[$201]:=255;
  2708.   for i:=1 to 1000 do
  2709.   begin
  2710.     st:=port[$201];
  2711.     if st and 1=1 then inc(jx);
  2712.     if st and 2=2 then inc(jy);
  2713.   end;
  2714.   port201:=port[$201];
  2715.   jb1:=port201 and $10;
  2716.   jb2:=port201 and $20;
  2717. end;
  2718.  
  2719. procedure meni;
  2720. label again,again2,renew;
  2721. var sign:^screen;
  2722.     x,y,i,j:integer;
  2723.     gone,page,n:byte;
  2724.     s:word;
  2725.     st:longint;
  2726.     ch:char;
  2727.     finished,right_button,left_button,unpressedl,unpressedr,game:boolean;
  2728.     junpressed:boolean;
  2729. begin
  2730.   LoadVOC('SOUND\TOING.VOC', 0, Ram , Fire1) ;
  2731.   new(sign);
  2732.   read_mouse_cursor;
  2733.   omejitev_miske(0,0,628,386);
  2734.   set_play_variables;
  2735.   load_song('LEVELS\OPEN.SNG');
  2736. renew:
  2737.   setpall(127,32,32,32);
  2738.   assign(t,'GFX\SIGN.PAL');
  2739.   reset(t);
  2740.   for i:=0 to 70 do
  2741.   begin
  2742.     readln(t,ch1,ch2,ch3);
  2743.     setpall(i,ord(ch1),ord(ch2)+2,ord(ch3));
  2744.     if i mod 5=0 then
  2745.     begin
  2746.       timer:=izracunaj_cas;
  2747.       casovni_razpored;
  2748.     end;
  2749.   end;
  2750.   close(t);
  2751.   for i:=0 to 50 do setpall(i+128,i div 2,i div 2,0);
  2752.   page:=1;
  2753.   uncomprx('GFX\SIGN.cmx',64000);
  2754.   move(pic^[0],sign^[0],64000);
  2755.   i:=-90;
  2756.   unpressedl:=true;
  2757.   unpressedr:=true;
  2758.   junpressed:=true;
  2759.   game:=false;
  2760.   gone:=0;
  2761.   finished:=false;
  2762.   st:=0;
  2763.   calibration_faze:=1;
  2764.   jb1:=1;
  2765.   jb2:=1;
  2766.   repeat
  2767.     box:=0;
  2768.     reg.ax:=3;
  2769.     intr($33,reg);
  2770.     nx:=reg.cx div 2;
  2771.     ny:=reg.dx div 2;
  2772.     if ((reg.bx and 1)=1) then
  2773.                           begin
  2774.                             left_button:=true;
  2775.                             if sound_set then playvoc(fire1);
  2776.                           end
  2777.                           else
  2778.                           begin
  2779.                             left_button:=false;
  2780.                             if not(unpressedl) then unpressedl:=true;
  2781.                           end;
  2782.     if ((reg.bx and 2)=2) then
  2783.                           begin
  2784.                             right_button:=true;
  2785.                             if sound_set then playvoc(fire1);
  2786.                           end
  2787.                           else
  2788.                           begin
  2789.                             right_button:=false;
  2790.                             unpressedr:=true;
  2791.                           end;
  2792.     if page=4 then
  2793.     begin
  2794.       chk_joystick;
  2795.       if (jb1<>0) and (jb2<>0) then junpressed:=true;
  2796.     end;
  2797.     move(sign^[0],pic^[0],64000);
  2798.     if page<3 then
  2799.     begin
  2800.       for x:=0 to 2 do           { chk_mouse }
  2801.         if (ny>=116+x*26) and (ny<=136+x*26) then box:=x+1;
  2802.       if box>0 then            { draw box }
  2803.         for y:=0 to 20 do
  2804.           for x:=68 to 240 do
  2805.             pic^[320*(116+26*(box-1)+y)+x]:=15;
  2806.     end;
  2807.     if page=3 then
  2808.     begin
  2809.       for x:=0 to 3 do           { chk_mouse }
  2810.         if (ny>=112+x*22) and (ny<=129+x*22) then box:=x+1;
  2811.       if box>0 then              { draw box }
  2812.         for y:=0 to 19 do
  2813.           for x:=68 to 240 do
  2814.             pic^[320*(111+22*(box-1)+y)+x]:=15;
  2815.     end;
  2816.     draw_page(page);
  2817.     for x:=1 to 5 do            { show_mouse }
  2818.       for y:=1 to 5 do
  2819.         if mouse_cursor[x,y]>0 then pic^[320*(ny+x)+nx+y]:=127;
  2820.     for y:=0 to 90 do
  2821.       for x:=0 to 19 do
  2822.         if sign^[320*(10+y)+80+x+i+y]>5 then
  2823.           pic^[320*(10+y)+80+x+i+y]:=sign^[320*(10+y)+80+x+i+y]+10-abs(8-x div 2);
  2824.     if (unpressedl) and (left_button) and (gone=0) then
  2825.     begin
  2826.       case page of
  2827.       1:begin
  2828.           if box=1 then gone:=1;
  2829.           if box=2 then
  2830.           begin
  2831.             page:=2;
  2832.             unpressedl:=false;
  2833.           end;
  2834.           if box=3 then
  2835.           begin
  2836.             finished:=true;
  2837.             gone:=1;
  2838.           end;
  2839.         end;
  2840.       2:begin
  2841.           if box=1 then
  2842.           begin
  2843.             page:=3;
  2844.             unpressedl:=false;
  2845.           end;
  2846.           if box=3 then
  2847.           begin
  2848.             if music_set=true then
  2849.                               begin
  2850.                                 music_set:=false;
  2851.                                 volume:=0;
  2852.                                 reset_card;
  2853.                               end
  2854.                               else
  2855.                               begin
  2856.                                 music_set:=true;
  2857.                                 set_play_variables;
  2858.                                 volume:=32;
  2859.                               end;
  2860.              unpressedl:=false;
  2861.            end;
  2862.           if box=2 then
  2863.           begin
  2864.             if sound_set=true then sound_set:=false
  2865.                               else sound_set:=true;
  2866.              unpressedl:=false;
  2867.            end;
  2868.          end;
  2869.       3:begin
  2870.           if (box=1) and (keyboard=false) then
  2871.           begin
  2872.             keyboard:=true;
  2873.             joystick:=false;
  2874.             mouse:=false;
  2875.           end;
  2876.           if (box=2) and (joystick=false) then
  2877.           begin
  2878.             keyboard:=false;
  2879.             joystick:=true;
  2880.             mouse:=false;
  2881.           end;
  2882.           if (box=3) and (mouse=false) then
  2883.           begin
  2884.             keyboard:=false;
  2885.             joystick:=false;
  2886.             mouse:=true;
  2887.           end;
  2888.           if box=4 then page:=4;
  2889.         end;
  2890.       end;
  2891.     end;
  2892.     if (unpressedr) and (right_button) and (page>1) then
  2893.     begin
  2894.       dec(page);
  2895.       unpressedr:=false;
  2896.     end;
  2897.     if gone>0 then
  2898.     begin
  2899.       for s:=0 to 63999 do if pic^[s]<70 then pic^[s]:=pic^[s] div (gone * 3 div 2 )
  2900.                          else if pic^[s]>128 then pic^[s]:=(pic^[s]-128) div gone + 128;
  2901.       lover_volume;
  2902.       if (i mod 4=0) then
  2903.       begin
  2904.         inc(gone);
  2905.         if gone=8 then game:=true;
  2906.       end;
  2907.     end;
  2908.     if page=4 then
  2909.       if (junpressed) and ((jb1=0) or (jb2=0)) then
  2910.       begin
  2911.         junpressed:=false;
  2912.         inc(calibration_faze);
  2913.         case calibration_faze of
  2914.         2:begin
  2915.             jminx:=jx;
  2916.             jminy:=jy;
  2917.           end;
  2918.         3:begin
  2919.             jmaxx:=jx;
  2920.             jmaxy:=jy;
  2921.           end;
  2922.         4:begin
  2923.             jcx:=jx;
  2924.             jcy:=jy;
  2925.             calibration_faze:=1;
  2926.             page:=3;
  2927.           end;
  2928.         end;
  2929.       end;
  2930.     if (gone=0) and (volume<32) and (i mod 4=0) then higher_volume;
  2931.     if music_set then
  2932.     begin
  2933.       timer:=izracunaj_cas;
  2934.       casovni_razpored;
  2935.     end;
  2936.     move(pic^[0],mem[$A000:0000],64000);
  2937.     if i>=140 then i:=-120 else i:=i+2;
  2938.     if page>1 then st:=0;
  2939.     if st=1000 then
  2940.     begin
  2941.       show_hof(false);
  2942.       goto renew;
  2943.     end
  2944.     else inc(st);
  2945.     if keypressed then ch:=readkey;
  2946.   until game;
  2947.   if finished then
  2948.   begin
  2949.     pisi_cfg;
  2950.     reg.ah:=0;
  2951.     reg.al:=3;
  2952.     intr($10,reg);
  2953.     reset_card;
  2954.     resetdrv;
  2955.     writeln('  My address:  Bostjan Grandovec');
  2956.     writeln('               Sorlijeva 5');
  2957.     writeln('               4000 Kranj');
  2958.     writeln('               Slovenija');
  2959.     writeln('  Tel:  064/215-428 (for Slovenija)');
  2960.     writeln('  E-Mail: BOSTJAN.GRANDOVEC@FOV.UNI-MB.SI');
  2961.     halt(1);
  2962.   end;
  2963.   volume:=32;
  2964.   fillchar(pic^[0],64000,0);
  2965.   fillchar(mem[$A000:0000],64000,0);
  2966.   dispose(sign);
  2967.   freevoc(fire1);
  2968. end;
  2969.  
  2970. procedure get_num;
  2971. begin
  2972.   num[33,1]:=01000;num[33,2]:=01000;num[33,3]:=01000;num[33,4]:=01000;num[33,5]:=01000;num[33,6]:=00000;num[33,7]:=01000;
  2973.   num[39,1]:=00010;num[39,2]:=00100;num[39,3]:=00000;num[39,4]:=00000;num[39,5]:=00000;num[39,6]:=00000;num[39,7]:=00000;
  2974.   num[44,1]:=01110;num[44,2]:=10101;num[44,3]:=10011;num[44,4]:=11111;num[44,5]:=10000;num[44,6]:=10001;num[44,7]:=01110;
  2975.   num[45,1]:=00000;num[45,2]:=00000;num[45,3]:=00000;num[45,4]:=11111;num[45,5]:=00000;num[45,6]:=00000;num[45,7]:=00000;
  2976.   num[46,1]:=00000;num[46,2]:=00000;num[46,3]:=00000;num[46,4]:=00000;num[46,5]:=00000;num[46,6]:=00000;num[46,7]:=01000;
  2977.   num[48,1]:=01110;num[48,2]:=10001;num[48,3]:=10011;num[48,4]:=10101;num[48,5]:=11001;num[48,6]:=10001;num[48,7]:=01110;
  2978.   num[49,1]:=00100;num[49,2]:=01100;num[49,3]:=00100;num[49,4]:=00100;num[49,5]:=00100;num[49,6]:=00100;num[49,7]:=01110;
  2979.   num[50,1]:=01110;num[50,2]:=10001;num[50,3]:=00001;num[50,4]:=00010;num[50,5]:=00100;num[50,6]:=01000;num[50,7]:=11111;
  2980.   num[51,1]:=01110;num[51,2]:=10001;num[51,3]:=00001;num[51,4]:=00110;num[51,5]:=00001;num[51,6]:=10001;num[51,7]:=01110;
  2981.   num[52,1]:=00010;num[52,2]:=00100;num[52,3]:=01000;num[52,4]:=11111;num[52,5]:=00010;num[52,6]:=00010;num[52,7]:=00010;
  2982.   num[53,1]:=11111;num[53,2]:=10000;num[53,3]:=10000;num[53,4]:=11110;num[53,5]:=00001;num[53,6]:=00001;num[53,7]:=11110;
  2983.   num[54,1]:=01110;num[54,2]:=10000;num[54,3]:=10000;num[54,4]:=11110;num[54,5]:=10001;num[54,6]:=10001;num[54,7]:=01110;
  2984.   num[55,1]:=11111;num[55,2]:=00001;num[55,3]:=00010;num[55,4]:=00100;num[55,5]:=00100;num[55,6]:=01000;num[55,7]:=01000;
  2985.   num[56,1]:=01110;num[56,2]:=10001;num[56,3]:=10001;num[56,4]:=01110;num[56,5]:=10001;num[56,6]:=10001;num[56,7]:=01110;
  2986.   num[57,1]:=01110;num[57,2]:=10001;num[57,3]:=10001;num[57,4]:=01111;num[57,5]:=00001;num[57,6]:=00001;num[57,7]:=01110;
  2987.   num[58,1]:=00000;num[58,2]:=00100;num[58,3]:=00000;num[58,4]:=00000;num[58,5]:=00000;num[58,6]:=00100;num[58,7]:=00000;
  2988.   num[60,1]:=00000;num[60,2]:=00010;num[60,3]:=00110;num[60,4]:=01110;num[60,5]:=00110;num[60,6]:=00010;num[60,7]:=00000;
  2989.   num[62,1]:=11100;num[62,2]:=10000;num[62,3]:=11110;num[62,4]:=10101;num[62,5]:=11101;num[62,6]:=00101;num[62,7]:=00110;
  2990.   num[65,1]:=00100;num[65,2]:=01010;num[65,3]:=10001;num[65,4]:=10001;num[65,5]:=11111;num[65,6]:=10001;num[65,7]:=10001;
  2991.   num[66,1]:=11110;num[66,2]:=10001;num[66,3]:=10001;num[66,4]:=11110;num[66,5]:=10001;num[66,6]:=10001;num[66,7]:=11110;
  2992.   num[67,1]:=01110;num[67,2]:=10001;num[67,3]:=10000;num[67,4]:=10000;num[67,5]:=10000;num[67,6]:=10001;num[67,7]:=01110;
  2993.   num[68,1]:=11110;num[68,2]:=10001;num[68,3]:=10001;num[68,4]:=10001;num[68,5]:=10001;num[68,6]:=10001;num[68,7]:=11110;
  2994.   num[69,1]:=11111;num[69,2]:=10000;num[69,3]:=10000;num[69,4]:=11100;num[69,5]:=10000;num[69,6]:=10000;num[69,7]:=11111;
  2995.   num[70,1]:=11111;num[70,2]:=10000;num[70,3]:=10000;num[70,4]:=11100;num[70,5]:=10000;num[70,6]:=10000;num[70,7]:=10000;
  2996.   num[71,1]:=01110;num[71,2]:=10001;num[71,3]:=10000;num[71,4]:=10110;num[71,5]:=10001;num[71,6]:=10001;num[71,7]:=01110;
  2997.   num[72,1]:=10001;num[72,2]:=10001;num[72,3]:=10001;num[72,4]:=11111;num[72,5]:=10001;num[72,6]:=10001;num[72,7]:=10001;
  2998.   num[73,1]:=00100;num[73,2]:=00100;num[73,3]:=00100;num[73,4]:=00100;num[73,5]:=00100;num[73,6]:=00100;num[73,7]:=00100;
  2999.   num[74,1]:=00001;num[74,2]:=00001;num[74,3]:=00001;num[74,4]:=00001;num[74,5]:=10001;num[74,6]:=10001;num[74,7]:=01110;
  3000.   num[75,1]:=10001;num[75,2]:=10001;num[75,3]:=10010;num[75,4]:=11100;num[75,5]:=10010;num[75,6]:=10001;num[75,7]:=10001;
  3001.   num[76,1]:=10000;num[76,2]:=10000;num[76,3]:=10000;num[76,4]:=10000;num[76,5]:=10000;num[76,6]:=10000;num[76,7]:=11111;
  3002.   num[77,1]:=10001;num[77,2]:=11011;num[77,3]:=10101;num[77,4]:=10001;num[77,5]:=10001;num[77,6]:=10001;num[77,7]:=10001;
  3003.   num[78,1]:=10001;num[78,2]:=11001;num[78,3]:=10101;num[78,4]:=10011;num[78,5]:=10001;num[78,6]:=10001;num[78,7]:=10001;
  3004.   num[79,1]:=01110;num[79,2]:=10001;num[79,3]:=10001;num[79,4]:=10001;num[79,5]:=10001;num[79,6]:=10001;num[79,7]:=01110;
  3005.   num[80,1]:=11110;num[80,2]:=10001;num[80,3]:=10001;num[80,4]:=11110;num[80,5]:=10000;num[80,6]:=10000;num[80,7]:=10000;
  3006.   num[81,1]:=01110;num[81,2]:=10001;num[81,3]:=10001;num[81,4]:=10001;num[81,5]:=10101;num[81,6]:=10011;num[81,7]:=01111;
  3007.   num[82,1]:=11110;num[82,2]:=10001;num[82,3]:=10001;num[82,4]:=11110;num[82,5]:=10001;num[82,6]:=10001;num[82,7]:=10001;
  3008.   num[83,1]:=01111;num[83,2]:=10001;num[83,3]:=10000;num[83,4]:=01110;num[83,5]:=00001;num[83,6]:=10001;num[83,7]:=11110;
  3009.   num[84,1]:=11111;num[84,2]:=00100;num[84,3]:=00100;num[84,4]:=00100;num[84,5]:=00100;num[84,6]:=00100;num[84,7]:=00100;
  3010.   num[85,1]:=10001;num[85,2]:=10001;num[85,3]:=10001;num[85,4]:=10001;num[85,5]:=10001;num[85,6]:=10001;num[85,7]:=01110;
  3011.   num[86,1]:=10001;num[86,2]:=10001;num[86,3]:=10001;num[86,4]:=10001;num[86,5]:=01010;num[86,6]:=01010;num[86,7]:=00100;
  3012.   num[87,1]:=10001;num[87,2]:=10001;num[87,3]:=10001;num[87,4]:=10001;num[87,5]:=10101;num[87,6]:=10101;num[87,7]:=01010;
  3013.   num[88,1]:=10001;num[88,2]:=10001;num[88,3]:=01010;num[88,4]:=00100;num[88,5]:=01010;num[88,6]:=10001;num[88,7]:=10001;
  3014.   num[89,1]:=10001;num[89,2]:=10001;num[89,3]:=01010;num[89,4]:=00100;num[89,5]:=00100;num[89,6]:=00100;num[89,7]:=00100;
  3015.   num[90,1]:=11111;num[90,2]:=00001;num[90,3]:=00010;num[90,4]:=00100;num[90,5]:=01000;num[90,6]:=10000;num[90,7]:=11111;
  3016.   num[95,1]:=00000;num[95,2]:=00000;num[95,3]:=00000;num[95,4]:=00000;num[95,5]:=00000;num[95,6]:=00000;num[95,7]:=11111;
  3017.   parts[0,0,0]:=0;parts[0,0,1]:=0;
  3018.     parts[0,1,0]:=0;parts[0,1,1]:=0;
  3019.   parts[1,0,0]:=1;parts[1,0,1]:=1;
  3020.     parts[1,1,0]:=1;parts[1,1,1]:=1;
  3021.   parts[2,0,0]:=0;parts[2,0,1]:=1;
  3022.     parts[2,1,0]:=1;parts[2,1,1]:=1;
  3023.   parts[3,0,0]:=1;parts[3,0,1]:=1;
  3024.     parts[3,1,0]:=1;parts[3,1,1]:=0;
  3025.   parts[4,0,0]:=1;parts[4,0,1]:=0;
  3026.     parts[4,1,0]:=1;parts[4,1,1]:=1;
  3027.   parts[5,0,0]:=1;parts[5,0,1]:=1;
  3028.     parts[5,1,0]:=0;parts[5,1,1]:=1;
  3029.   parts[6,0,0]:=0;parts[6,0,1]:=0;
  3030.     parts[6,1,0]:=1;parts[6,1,1]:=1;
  3031.   parts[7,0,0]:=1;parts[7,0,1]:=0;
  3032.     parts[7,1,0]:=1;parts[7,1,1]:=0;
  3033.   parts[8,0,0]:=0;parts[8,0,1]:=0;
  3034.     parts[8,1,0]:=1;parts[8,1,1]:=0;
  3035.   parts[9,0,0]:=0;parts[9,0,1]:=0;
  3036.     parts[9,1,0]:=0;parts[9,1,1]:=1;
  3037.  bnum[33,1]:=01000;bnum[33,2]:=01000;bnum[33,3]:=01000;bnum[33,4]:=01000;bnum[33,5]:=01000;bnum[33,6]:=00000;bnum[33,7]:=01000;
  3038.  bnum[34,1]:=00100;bnum[34,2]:=00100;bnum[34,3]:=01000;bnum[34,4]:=00000;bnum[34,5]:=00000;bnum[34,6]:=00000;bnum[34,7]:=00000;
  3039.  bnum[38,1]:=00000;bnum[38,2]:=00000;bnum[38,3]:=00000;bnum[38,4]:=00000;bnum[38,5]:=00000;bnum[38,6]:=00000;bnum[38,7]:=05630;
  3040.  bnum[44,1]:=01110;bnum[44,2]:=10101;bnum[44,3]:=10011;bnum[44,4]:=11111;bnum[44,5]:=10000;bnum[44,6]:=10001;bnum[44,7]:=01110;
  3041.  bnum[45,1]:=00000;bnum[45,2]:=00000;bnum[45,3]:=00000;bnum[45,4]:=11111;bnum[45,5]:=00000;bnum[45,6]:=00000;bnum[45,7]:=00000;
  3042.  bnum[46,1]:=00000;bnum[46,2]:=00000;bnum[46,3]:=00000;bnum[46,4]:=00000;bnum[46,5]:=00000;bnum[46,6]:=00000;bnum[46,7]:=01000;
  3043.  bnum[48,1]:=01110;bnum[48,2]:=10001;bnum[48,3]:=10011;bnum[48,4]:=10101;bnum[48,5]:=11001;bnum[48,6]:=10001;bnum[48,7]:=01110;
  3044.  bnum[49,1]:=00100;bnum[49,2]:=01100;bnum[49,3]:=00100;bnum[49,4]:=00100;bnum[49,5]:=00100;bnum[49,6]:=00100;bnum[49,7]:=01110;
  3045.  bnum[50,1]:=01110;bnum[50,2]:=10001;bnum[50,3]:=00001;bnum[50,4]:=00010;bnum[50,5]:=00100;bnum[50,6]:=01000;bnum[50,7]:=11111;
  3046.  bnum[51,1]:=01110;bnum[51,2]:=10001;bnum[51,3]:=00001;bnum[51,4]:=00110;bnum[51,5]:=00001;bnum[51,6]:=10001;bnum[51,7]:=01110;
  3047.  bnum[52,1]:=00010;bnum[52,2]:=00100;bnum[52,3]:=01000;bnum[52,4]:=11111;bnum[52,5]:=00010;bnum[52,6]:=00010;bnum[52,7]:=00010;
  3048.  bnum[53,1]:=11111;bnum[53,2]:=10000;bnum[53,3]:=10000;bnum[53,4]:=11110;bnum[53,5]:=00001;bnum[53,6]:=00001;bnum[53,7]:=11110;
  3049.  bnum[54,1]:=01110;bnum[54,2]:=10000;bnum[54,3]:=10000;bnum[54,4]:=11110;bnum[54,5]:=10001;bnum[54,6]:=10001;bnum[54,7]:=01110;
  3050.  bnum[55,1]:=11111;bnum[55,2]:=00001;bnum[55,3]:=00010;bnum[55,4]:=00100;bnum[55,5]:=00100;bnum[55,6]:=01000;bnum[55,7]:=01000;
  3051.  bnum[56,1]:=01110;bnum[56,2]:=10001;bnum[56,3]:=10001;bnum[56,4]:=01110;bnum[56,5]:=10001;bnum[56,6]:=10001;bnum[56,7]:=01110;
  3052.  bnum[57,1]:=01110;bnum[57,2]:=10001;bnum[57,3]:=10001;bnum[57,4]:=01111;bnum[57,5]:=00001;bnum[57,6]:=00001;bnum[57,7]:=01110;
  3053.  bnum[58,1]:=00000;bnum[58,2]:=00100;bnum[58,3]:=00000;bnum[58,4]:=00000;bnum[58,5]:=00000;bnum[58,6]:=00100;bnum[58,7]:=00000;
  3054.  bnum[65,1]:=02140;bnum[65,2]:=23054;bnum[65,3]:=10001;bnum[65,4]:=10001;bnum[65,5]:=11111;bnum[65,6]:=10001;bnum[65,7]:=10001;
  3055.  bnum[66,1]:=11140;bnum[66,2]:=10010;bnum[66,3]:=10230;bnum[66,4]:=11114;bnum[66,5]:=10001;bnum[66,6]:=10001;bnum[66,7]:=11113;
  3056.  bnum[67,1]:=21114;bnum[67,2]:=10005;bnum[67,3]:=10000;bnum[67,4]:=10000;bnum[67,5]:=10000;bnum[67,6]:=10002;bnum[67,7]:=51113;
  3057.  bnum[68,1]:=11114;bnum[68,2]:=10001;bnum[68,3]:=10001;bnum[68,4]:=10001;bnum[68,5]:=10001;bnum[68,6]:=10001;bnum[68,7]:=11113;
  3058.  bnum[69,1]:=11113;bnum[69,2]:=10000;bnum[69,3]:=10000;bnum[69,4]:=11100;bnum[69,5]:=10000;bnum[69,6]:=10000;bnum[69,7]:=11114;
  3059.  bnum[70,1]:=11113;bnum[70,2]:=10000;bnum[70,3]:=10000;bnum[70,4]:=11300;bnum[70,5]:=10000;bnum[70,6]:=10000;bnum[70,7]:=10000;
  3060.  bnum[71,1]:=21114;bnum[71,2]:=10001;bnum[71,3]:=10000;bnum[71,4]:=10511;bnum[71,5]:=10001;bnum[71,6]:=10001;bnum[71,7]:=51113;
  3061.  bnum[72,1]:=10001;bnum[72,2]:=10001;bnum[72,3]:=10001;bnum[72,4]:=11111;bnum[72,5]:=10001;bnum[72,6]:=10001;bnum[72,7]:=10001;
  3062.  bnum[73,1]:=00100;bnum[73,2]:=00100;bnum[73,3]:=00100;bnum[73,4]:=00100;bnum[73,5]:=00100;bnum[73,6]:=00100;bnum[73,7]:=00100;
  3063.  bnum[74,1]:=00001;bnum[74,2]:=00001;bnum[74,3]:=00001;bnum[74,4]:=00001;bnum[74,5]:=00001;bnum[74,6]:=10001;bnum[74,7]:=51113;
  3064.  bnum[75,1]:=10001;bnum[75,2]:=10023;bnum[75,3]:=10230;bnum[75,4]:=11140;bnum[75,5]:=10054;bnum[75,6]:=10001;bnum[75,7]:=10001;
  3065.  bnum[76,1]:=10000;bnum[76,2]:=10000;bnum[76,3]:=10000;bnum[76,4]:=10000;bnum[76,5]:=10000;bnum[76,6]:=10000;bnum[76,7]:=11114;
  3066.  bnum[77,1]:=18091;bnum[77,2]:=14021;bnum[77,3]:=15031;bnum[77,4]:=10001;bnum[77,5]:=10001;bnum[77,6]:=10001;bnum[77,7]:=10001;
  3067.  bnum[78,1]:=10001;bnum[78,2]:=14001;bnum[78,3]:=15401;bnum[78,4]:=10541;bnum[78,5]:=10051;bnum[78,6]:=10001;bnum[78,7]:=10001;
  3068.  bnum[79,1]:=21114;bnum[79,2]:=10001;bnum[79,3]:=10001;bnum[79,4]:=10001;bnum[79,5]:=10001;bnum[79,6]:=10001;bnum[79,7]:=51113;
  3069.  bnum[80,1]:=11114;bnum[80,2]:=10001;bnum[80,3]:=10001;bnum[80,4]:=11113;bnum[80,5]:=10000;bnum[80,6]:=10000;bnum[80,7]:=10000;
  3070.  bnum[81,1]:=01110;bnum[81,2]:=10001;bnum[81,3]:=10001;bnum[81,4]:=10001;bnum[81,5]:=10101;bnum[81,6]:=10011;bnum[81,7]:=01111;
  3071.  bnum[82,1]:=11140;bnum[82,2]:=10010;bnum[82,3]:=10230;bnum[82,4]:=11114;bnum[82,5]:=10001;bnum[82,6]:=10001;bnum[82,7]:=10001;
  3072.  bnum[83,1]:=21113;bnum[83,2]:=10000;bnum[83,3]:=10000;bnum[83,4]:=51114;bnum[83,5]:=00001;bnum[83,6]:=00001;bnum[83,7]:=21113;
  3073.  bnum[84,1]:=11111;bnum[84,2]:=00100;bnum[84,3]:=00100;bnum[84,4]:=00100;bnum[84,5]:=00100;bnum[84,6]:=00100;bnum[84,7]:=00100;
  3074.  bnum[85,1]:=10001;bnum[85,2]:=10001;bnum[85,3]:=10001;bnum[85,4]:=10001;bnum[85,5]:=10001;bnum[85,6]:=10001;bnum[85,7]:=51113;
  3075.  bnum[86,1]:=10001;bnum[86,2]:=10001;bnum[86,3]:=10001;bnum[86,4]:=10001;bnum[86,5]:=54023;bnum[86,6]:=05630;bnum[86,7]:=00800;
  3076.  bnum[87,1]:=10001;bnum[87,2]:=10001;bnum[87,3]:=10001;bnum[87,4]:=10001;bnum[87,5]:=10101;bnum[87,6]:=10101;bnum[87,7]:=01010;
  3077.  bnum[88,1]:=10001;bnum[88,2]:=54023;bnum[88,3]:=05130;bnum[88,4]:=02140;bnum[88,5]:=23054;bnum[88,6]:=10001;bnum[88,7]:=10001;
  3078.  bnum[89,1]:=40002;bnum[89,2]:=10001;bnum[89,3]:=54023;bnum[89,4]:=05130;bnum[89,5]:=00100;bnum[89,6]:=00100;bnum[89,7]:=00100;
  3079.  bnum[90,1]:=11111;bnum[90,2]:=00001;bnum[90,3]:=00010;bnum[90,4]:=00100;bnum[90,5]:=01000;bnum[90,6]:=10000;bnum[90,7]:=11111;
  3080. end;
  3081.  
  3082. procedure test_speed;
  3083. var timer1,timer2:longint;
  3084.     u,m,s,st,mst:word;
  3085. begin
  3086.   reg.ah:=0;
  3087.   reg.al:=19;
  3088.   intr($10,reg);
  3089.   gettime(u,m,s,st);
  3090.   timer1:=360000*u+6000*m+100*s+st;
  3091.   mst:=0;
  3092.   repeat
  3093.     gettime(u,m,s,st);
  3094.     timer2:=360000*u+6000*m+100*s+st;
  3095.     move(pic^[0],mem[$A000:4800],54280);
  3096.     inc(mst);
  3097.   until timer2-timer1>200;
  3098.   reg.ah:=0;
  3099.   reg.al:=3;
  3100.   intr($10,reg);
  3101.   writeln('Speed = ',mst);
  3102.   slow_down:=0;
  3103.   if mst>115 then slow_down:=18-1000 div ((mst) div 2);
  3104. end;
  3105.  
  3106. procedure paused;
  3107. var pressed2,unpressed1,unpressed2:boolean;
  3108. begin
  3109.   pressed2:=false;
  3110.   unpressed1:=false;
  3111.   unpressed2:=false;
  3112.   repeat
  3113.     if not(key[25]) and not(unpressed1) then unpressed1:=true;
  3114.     if (key[25]) and (unpressed1) then pressed2:=true;
  3115.     if not(key[25]) and (pressed2) then unpressed2:=true;
  3116.     if (major_st>10) and not(over) and (music_set) then
  3117.     begin
  3118.       timer:=izracunaj_cas;
  3119.       casovni_razpored;
  3120.     end;
  3121.   until unpressed2;
  3122. end;
  3123.  
  3124. begin
  3125.   detect_VGA;
  3126.   delay(50);
  3127.   detect_sb;
  3128.   delay(50);
  3129.   detect_mouse;
  3130.   delay(50);
  3131.   new(pic);
  3132.   fillchar(pic^[0],64000,0);
  3133.   test_speed;
  3134.   delay(500);
  3135.   set_sound_pointers;
  3136.   randomize;
  3137.   reg.ah:=0;
  3138.   reg.al:=19;
  3139.   intr($10,reg);
  3140.   get_num;
  3141.   beri_cfg;
  3142.   If StatusWord = $8000 Then sound_set:=false;
  3143.   Speaker(ON);
  3144.   load_cursor;
  3145.   load_best_scores;
  3146.   for i:=1 to 6 do name[i]:=' ';
  3147. escape:
  3148.   over:=false;
  3149.   reset_card;
  3150.   volume:=0;
  3151.   meni;
  3152.   read_gfx;
  3153.   make_missile;
  3154.   level:=1;
  3155.   load_song('LEVELS\LEVEL'+chr(level+48)+'.SNG');
  3156. fly_again:
  3157.   hiscore:=best_players[1].score;
  3158.   volume:=32;
  3159.   score:=0;
  3160.   msnum:=2;
  3161.   damage:=100;
  3162.   crashed:=0;
  3163. next_level:
  3164.   reset_card;
  3165.   case level of
  3166.     1:load_song('LEVELS\LEVEL1.SNG');
  3167.     2:load_song('LEVELS\LEVEL2.SNG');
  3168.     3:load_song('LEVELS\LEVEL3.SNG');
  3169.   end;
  3170.   bonus:=0;
  3171.   db:=1;
  3172.   read_enemy;
  3173.   initialize;
  3174.   { BARVE }
  3175.   flyagain:=false;
  3176.   set_low_colors;
  3177.   univerzalna_paleta;
  3178.   load_enemy_palette;
  3179.   px:=20;
  3180.   py:=100;
  3181.   ox:=0;
  3182.   oy:=0;
  3183.   bmx:=0;
  3184.   bmy:=0;
  3185.   fire_delay:=0;
  3186.   omejitev_miske(0,0,600,370);
  3187.   set_mouse(20,100);
  3188.   ch_pal_pos:=0;
  3189.   enemies_timing;
  3190.   stars_initialization;
  3191.   show_text;
  3192.   show_score;
  3193.   show_hiscore;
  3194.   show_damage;
  3195.   show_missiles;
  3196.   major_st:=0;
  3197.   main_dead:=0;
  3198.   number_of_the_best:=0;
  3199.   init_kbd;
  3200.   LoadVOC('SOUND\FIRE.VOC', 0, Ram , Fire1) ;
  3201.   LoadVOC('SOUND\EXP.VOC', 0, Ram ,  Exp) ;
  3202.   LoadVOC('SOUND\MF.VOC', 0, Ram ,  FM);
  3203.   repeat
  3204.     if key[1] then over:=true;
  3205.     if (key[25]) then paused;
  3206.     if keyboard then
  3207.     begin
  3208.       if (key[75]) and (px>1) then
  3209.         if old_key[75] then px:=px-2
  3210.                        else px:=px-1;
  3211.       if (key[77]) and (px<100) then
  3212.       begin
  3213.         if old_key[77] then px:=px+2
  3214.                        else px:=px+1;
  3215.         flame;
  3216.         if flame_lenght<6 then inc(flame_lenght);
  3217.       end;
  3218.       if not(key[77]) then flame_lenght:=0;
  3219.       if (key[72]) and (py>1) then
  3220.         if old_key[72] then py:=py-2
  3221.                        else py:=py-1;
  3222.       if (key[80]) and (py<150) then
  3223.         if old_key[80] then py:=py+2
  3224.                        else py:=py+1;
  3225.       if (key[29]) and (fire_delay=0) then fire;
  3226.       if not(key[29]) and (fire_delay>0) then dec(fire_delay);
  3227.       if (key[56]) and (missile_delay=0) then fire_missile;
  3228.       for i:=0 to 127 do old_key[i]:=key[i];
  3229.     end;
  3230.     if mouse then
  3231.     begin
  3232.       moved:=false;
  3233.       reg.ax:=3;
  3234.       intr($33,reg);
  3235.       nx:=reg.cx;
  3236.       ny:=reg.dx;
  3237.       dx:=nx-ox;
  3238.       dy:=ny-oy;
  3239.       if (dx>0) and (px<100) then
  3240.       begin
  3241.         if dx>1 then px:=px+mm else inc(mx);
  3242.         moved:=true;
  3243.         flame;
  3244.         if flame_lenght<6 then inc(flame_lenght);
  3245.       end;
  3246.       if (dx<-0) and (px>1) then
  3247.       begin
  3248.         if dx<-1 then px:=px-mm else dec(mx);
  3249.         moved:=true;
  3250.       end;
  3251.       if (dy<-0) and (py>1) then
  3252.       begin
  3253.         if dy<-1 then py:=py-mm else dec(my);
  3254.         moved:=true;
  3255.       end;
  3256.       if (dy>0) and (py<150) then
  3257.       begin
  3258.         if dy>1 then py:=py+mm else inc(my);
  3259.         moved:=true;
  3260.       end;
  3261.       if moved then
  3262.       begin
  3263.         set_mouse(px,py);
  3264.         ox:=px;
  3265.         oy:=py;
  3266.       end
  3267.       else
  3268.       begin
  3269.         ox:=nx;
  3270.         oy:=ny;
  3271.       end;
  3272.       if ((reg.bx and 1)=1) and (fire_delay=0) then fire;
  3273.       if ((reg.bx and 2)=2) and (missile_delay=0) then fire_missile;
  3274.       if ((reg.bx and 1)<>1) and (fire_delay>0) then dec(fire_delay);
  3275.     end;
  3276.     if joystick then
  3277.     begin
  3278.       chk_joystick;
  3279.       if (jx>jcx+2) and (px<100) then
  3280.       begin
  3281.         if jx<(jmaxx-5) then px:=px+1
  3282.                         else px:=px+2;
  3283.         flame;
  3284.         if flame_lenght<6 then inc(flame_lenght);
  3285.       end;
  3286.       if (jx<jcx-2) and (px>1) then
  3287.       begin
  3288.         if jx>(jminx+5) then px:=px-1
  3289.                         else px:=px-2;
  3290.       end;
  3291.       if (jy<jcy+2) and (py>1) then
  3292.       begin
  3293.         if jy>(jminy+5) then py:=py-1
  3294.                         else py:=py-2;
  3295.       end;
  3296.       if (jy>jcy-2) and (py<150) then
  3297.       begin
  3298.         if jy<(jmaxy-5) then py:=py+1
  3299.                         else py:=py+2;
  3300.       end;
  3301.       if (jb1=0) and (fire_delay=0) then fire;
  3302.       if (jb2=0) and (missile_delay=0) then fire_missile;
  3303.       if (jb1<>0) and (fire_delay>0) then dec(fire_delay);
  3304.     end;
  3305.     if (major_st=ch_pal_pos) and (ch_pal_pos>0) then
  3306.     begin
  3307. { NEW PALETTE }
  3308.       case level of
  3309.       1:for i:=0 to 66 do setpall(i+128,enemy_palette[i,1],enemy_palette[i,2],enemy_palette[i,3]);
  3310.       2:for i:=0 to 69 do setpall(i+128,enemy_palette[i,1],enemy_palette[i,2],enemy_palette[i,3]);
  3311.       3:for i:=0 to 71 do setpall(i+128,enemy_palette[i,1],enemy_palette[i,2],enemy_palette[i,3]);
  3312.       end;
  3313.       outtextxy(172,189,'ENEMY',6,81,false,true,2);
  3314.       enemy_damage(100);
  3315.     end;
  3316.     chk_shooting;
  3317.     stars_to_pic;
  3318.     enemies_to_pic;
  3319.     if crashed=0 then
  3320.       if (main_dead=0) or (main_dead>150) then plane_to_pic else
  3321.                  else if crashed=1 then
  3322.                  begin
  3323.                    reset_card;
  3324.                    fly_agen;
  3325.                    goto jump_over;
  3326.                  end
  3327.                  else
  3328.                  begin
  3329.                    dec(crashed);
  3330.                    if crashed mod 2 = 0 then lover_volume;
  3331.                  end;
  3332.     explosions_to_pic;
  3333.     plane_fire_to_pic;
  3334.     if missile_delay=1 then missile_to_pic;
  3335.     enemy_fire_to_pic;
  3336.     bonus_missile_to_pic;
  3337. jump_over:
  3338.     if flyagain=true then
  3339.     begin
  3340.       dispose_enemies;
  3341.       freevoc(fire1);
  3342.       freevoc(exp);
  3343.       freevoc(fm);
  3344.       goto fly_again;
  3345.     end;
  3346.     if main_dead>0 then if main_dead=1 then
  3347.     begin
  3348.       end_level;
  3349.       volume:=32;
  3350.       goto next_level;
  3351.     end
  3352.     else
  3353.     begin
  3354.       if (main_dead<150) then
  3355.       begin
  3356.         if (bonus=3) and (db>0) then db:=-db;
  3357.         if (bonus=0) and (db<0) then db:=-db;
  3358.         if main_dead mod 3=0 then bonus:=bonus+db;
  3359.         spremeni_sign;
  3360.         if main_dead mod 5=0 then lover_volume;
  3361.       end;
  3362.       dec(main_dead);
  3363.     end;
  3364. {   while ((port[$3DA] and 8) > 0) do;
  3365.     while ((port[$3DA] and 8) = 0) do;}
  3366.     move(pic^[0],mem[$A000:4800],54280);
  3367.     fillchar(pic^[0],54280,0);
  3368.     { SOUND}
  3369.     if major_st=10 then set_play_variables;
  3370.     if (major_st>10) and not(over) and (music_set) then
  3371.     begin
  3372.       timer:=izracunaj_cas;
  3373.       casovni_razpored;
  3374.     end;
  3375.     inc(major_st);
  3376.     delay(slow_down);
  3377.   until over=true;
  3378.   if StatusWord <> 0 then StopVoc;
  3379.   freevoc(fire1);
  3380.   freevoc(exp);
  3381.   freevoc(fm);
  3382.   goto escape;
  3383. {  reg.ah:=0;
  3384.   reg.al:=3;
  3385.   intr($10,reg);
  3386.   reset_card;}
  3387. end.