home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC & Mediji 1996 July
/
PCM_9607.iso
/
igre
/
dos
/
ettv
/
ettv.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-05-18
|
101KB
|
3,387 lines
program fly_inside;
{$M $4000,0,300000 }
uses dos,crt, VOCs;
label next_level,fly_again,escape,jump_over;
type screen=array[0..65499] of byte;
yesno=array[1..90,1..240] of byte;
enemy1=array[1..28,1..50] of byte;
enemy2=array[1..22,1..60] of byte;
enemy3=array[1..10,1..51] of byte;
enemy4=array[1..38,1..29] of byte;
enemy5=array[1..26,1..53] of byte;
enemy6=array[1..29,1..48] of byte;
enemy7=array[1..29,1..59] of byte;
enemy8=array[1..31,1..64] of byte;
menemy1=array[1..103,1..79] of byte;
menemy2=array[1..140,1..115] of byte;
menemy3=array[1..127,1..120] of byte;
missile=array[1..10,1..25] of byte;
gun=array[1..7,1..37] of byte;
facna=array[1..15,1..16] of byte;
lvlcmp=array[1..75,1..248] of byte;
meteor1=array[1..47,1..69] of byte;
meteor2=array[1..21,1..38] of byte;
meteor3=array[1..22,1..39] of byte;
meteor4=array[1..25,1..43] of byte;
meteor5=array[1..36,1..43] of byte;
{ SOUND TYPES }
chntype=1..6;
boolnum=0..1;
halfbyte=0..15;
sound_record=record
sound_page:word;
channel:chntype;
shape:word;
m,s,st:byte;
msb,oct:byte;
lsb:array[1..2] of char;
played:boolean;
end;
sound_shape_record=record
name:string[8];
am,vib:boolean;
ar1,dr1,ar2,dr2:0..15;
end;
const pcy=15;
pcx=50;
enemy_num=100;
{ SOUND CONST }
chop1:array[chntype] of byte=(0,1,2,8,9,$A);
chop2:array[chntype] of byte=(3,4,5,$B,$C,$D);
limit_of_sounds=999;
limit_of_shapes=96;
limit_of_pages=60;
max_page_length=100;
mm=2;
var hole,e_whole_damage,major_st,i,j,ei,ej,x,y,ch_pal_pos:word;
msnum,crashed,level,main_dead,damage,fire_delay,missile_delay,flame_lenght,px,py,ch:byte;
mx,my,mdx,mdy:word;
nx,ny,ox,oy,dx,dy,m_pause:integer;
bonus:byte;
db:shortint;
score,hiscore:longint;
reg:registers;
keyboard,joystick,mouse,flyagain,moved,over:boolean;
num:array[32..100,1..7] of word;
bnum:array[32..90,1..7] of word;
parts:array[0..9,0..1,0..1] of byte;
pic:^screen;
plane:array[1..15,1..50] of byte;
firey:array[1..100] of byte;
firex:array[1..100] of word;
sx:array[1..200] of integer;
sy,sd:array[1..200] of byte;
ch1,ch2,ch3:char;
t:text;
mouse_cursor:array[1..5,1..5] of byte;
box:byte;
bmx,bmy:integer;
best_players:array[1..10] of record
name:string[6];
score:longint;
end;
name:array[1..6] of char;
number_of_the_best:word;
calibration_faze:byte;
jb1,jb2:byte;
jx,jy,jcx,jcy,jminx,jminy,jmaxx,jmaxy:word;
slow_down:word;
{ ENEMIES }
e1:^enemy1;
e2:^enemy2;
e3p1,e3p2:^enemy3;
e4:^enemy4;
e5:^enemy5;
e6:^enemy6;
e7p1,e7p2:^enemy7;
e8:^enemy8;
m1:^menemy1;
m2:^menemy2;
m3:^menemy3;
mtr1:^meteor1;
mtr2:^meteor2;
mtr3:^meteor3;
mtr4:^meteor4;
mtr5:^meteor5;
ms:missile;
myms:missile;
mmiss:array[1..8,1..6] of byte;
brdr:array[1..20,1..97] of byte;
guns:array[1..5] of ^gun;
facne:array[1..5] of ^facna;
sign:^lvlcmp;
et:array[0..enemy_num] of byte;
ex,ey,esx,esy:array[1..enemy_num] of real;
e_existence,e_where_sy,e_damage:array[1..enemy_num] of word;
bonus_missile:array[1..enemy_num] of boolean;
st1:byte;
enemy_palette:array [0..127,1..3] of byte;
ef_x,ef_y,ef_dx,ef_dy:array[1..500] of integer;
ef_t:array[1..500] of byte;
{ EXPLOSION }
exp_x,exp_y,exp_dx,exp_dy:array[1..2500] of integer;
exp_t,exp_ty:array[1..2500] of byte;
{ TIME VARIABLES }
bu2:byte;
timer:longint;
su1,sm1,ss1,sst1:longint;
su2,sm2,ss2,sst2:longint;
{ SOUND VARIABLES }
page_length:1..max_page_length;
pages:1..limit_of_pages;
sounds:array[1..limit_of_sounds] of ^sound_record;
sound_st:longint;
shapes:array[1..limit_of_shapes] of ^sound_shape_record;
music_set:boolean;
sound_set:boolean;
volume:byte;
Fire1,Exp,FM: VOCDataRec;
Firepl,Exppl,FMpl: boolean;
{ KEYBOARD VARIABLES }
const kbd_inited : boolean = false;
var key : array [0 .. 127] of boolean;
old_key : array [0 .. 127] of boolean;
last_key : byte;
old_9 : pointer;
value : byte;
procedure reset_kbd;
(* restores normal keyboard interrupt routine call *)
begin
if kbd_inited then
begin
kbd_inited := false;
setintvec (9, old_9);
end;
end;
(*$F+*)
procedure game_kbd_int; interrupt;
(* new interrupt handling routine *)
(*$F-*)
begin
last_key := port [$60];
if last_key = 1 then reset_kbd; (* ESC ends emulation *)
value := port [$61];
port [$61] := value or 128;
port [$61] := value;
port [$20] := $20;
if (last_key and 128) = 0
then key [last_key ] := true
else key [last_key and 127] := false;
end;
procedure init_kbd;
(* initializes keyboard tables and keyboard interrupt procedure *)
var i : integer;
begin
if not kbd_inited then begin
kbd_inited := true;
getintvec (9, old_9);
setintvec (9, addr (game_kbd_int));
last_key := 0;
for i := 0 to 127 do key [i] := false;
end;
end;
function exist( name : string ) : boolean;
var
x : file;
begin
assign( x, name );
{$I-}
reset( x );
{$I+}
if IOResult <> 0 then begin
exist := false;
end else begin
exist := true;
close(x);
end;
end;
procedure beep;
begin
sound(200);
delay(50);
nosound;
end;
procedure uncomprx(str1:string;n:word);
var i,st:word;
chnum:byte;
ch1,ch2:char;
mode:boolean;
begin
assign(t,str1);
reset(t);
read(t,ch1);
chnum:=ord(ch1);
mode:=false;
st:=0;
while (st<n) do
if mode=false then
begin
read(t,ch1);
if ord(ch1)=chnum then mode:=true
else
begin
pic^[st]:=ord(ch1);
inc(st);
end
end
else
begin
read(t,ch1);
if ord(ch1)=chnum then mode:=false
else
begin
read(t,ch2);
for i:=1 to ord(ch2) do
pic^[st+i-1]:=ord(ch1);
st:=st+ord(ch2);
end
end;
close(t);
end;
procedure numero(x,y:integer;vr,col:byte;over,in_mem:boolean;style:byte);
var i,j:byte;
z:word;
begin
for i:=1 to 7 do
begin
z:=num[vr,i];
for j:=1 to 5 do
begin
if in_mem then
begin
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
else if z mod 10>0 then mem[$A000:320*(y-1+i)+x+4-j]:=col;
end
else
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
else if z mod 10>0 then pic^[320*(y-1+i)+x+4-j]:=col;
z:=z div 10;
end;
if style=1 then inc(col);
if style=2 then if i<=3 then dec(col) else inc(col);
end;
end;
procedure outtextxy(x,y:word;string1:string;space,col:byte;over,in_mem:boolean;style:byte);
var i,l:byte;
begin
l:=length(string1);
for i:=1 to l do numero(x+(i-1)*space,y,ord(string1[i]),col,over,in_mem,style)
end;
procedure mouttextxy(x,y:word;string1:string;space,col:byte);
var i,l:byte;
begin
l:=length(string1);
for i:=1 to l do numero(x+(i-1)*space,y,ord(string1[i]),col,false,false,1)
end;
procedure signs(x,y:integer;vr:byte;col:byte);
var i,j,k,l:integer;
z,x1,y1,y1320,i3,j3:word;
begin
for i:=1 to 7 do
begin
i3:=y-1+i*2;
z:=bnum[vr,i];
for j:=1 to 5 do
begin
j3:=x+4-j*2;
if z mod 10>0 then
for k:=0 to 1 do
for l:=0 to 1 do
if parts[z mod 10,k,l]>0 then
begin
y1:=i3+k;
y1320:=320*y1;
x1:=j3+l;
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);
end;
z:=z div 10;
end;
end;
end;
procedure options(x,y:word;string1:string;space:byte;col:byte);
var i,l:byte;
begin
l:=length(string1);
for i:=1 to l do signs(x+(i-1)*space,y,ord(string1[i]),col)
end;
{ SOUND STAFF }
procedure ports(reg,byt:byte);
var cnt,dummy:integer;
begin
port[$388]:=reg;
for cnt:=0 to 5 do dummy:=port[$388];
port[$389]:=byt;
for cnt:=0 to 34 do dummy:=port[$389];
end;
procedure reset_card; { ADLib total SOFT (silent) reset }
var a,b:integer;
begin
for b:=0 to 2 do
for a:=0 to $14 do
begin
ports($60+a,255);
ports($80+a,255);
end;
for a:=0 to $14 do
begin
ports($B0+a,0);
ports($c0+a,0);
ports($e0+a,0);
end;
ports($bd,0);
for b:=0 to 2 do
for a:=0 to $14 do
begin
ports($60+a,0);
ports($80+a,0);
end;
for a:=0 to $14 do ports($40+a,63);
ports(1,$20);
end;
procedure detect_sb;
var vr1,vr2:byte;
begin
ports(4,$60);
ports(4,$80);
vr1:=port[$388];
ports(2,$FF);
ports(4,$21);
delay(1);
vr2:=port[$388];
ports(4,$60);
ports(4,$80);
if (vr1 and $E0=00) and (vr2 and $E0=$C0) then writeln('SB/Adlib detected')
else writeln('SB/Adlib not detected');
end;
procedure detect_mouse;
begin
reg.ax:=0;
intr($33,reg);
if reg.ax=$FFFF then writeln('Mouse detected')
else
begin
writeln('Mouse not detected');
writeln;
writeln('U can''t play this version of game without mouse!!!');
writeln('Sorry!');
halt(1);
end;
end;
procedure detect_VGA;
begin
reg.ax:=$1A00;
intr($10,reg);
if reg.al=$1A then writeln('VGA detected')
else
begin
writeln('VGA not detected');
writeln;
writeln('U can''t play this game without VGA graphics card!!!');
writeln('Sorry!');
halt(1);
end;
end;
procedure initialization;
begin
for i:=1 to limit_of_sounds do
if sounds[i]^.sound_page>0 then
sounds[i]^.sound_page:=0;
for i:=1 to limit_of_shapes do
begin
shapes[i]^.name:=' ';
shapes[i]^.am:=false;
shapes[i]^.vib:=false;
shapes[i]^.ar1:=0;
shapes[i]^.dr1:=0;
shapes[i]^.ar2:=0;
shapes[i]^.dr2:=0;
end;
end;
procedure load_song(mfile:string);
var useless:char;
amn,vibn:byte;
line:byte;
begin
initialization;
assign(t,mfile);
reset(t);
readln(t,pages,page_length);
while i<>0 do
begin
read(t,i);
if i>0 then
with shapes[i]^ do
begin
readln(t,useless,name,amn,vibn,ar1,dr1,ar2,dr2);
if amn=1 then am:=true else am:=false;
if vibn=1 then vib:=true else vib:=false;
end;
end;
i:=1;
while not(eof(t)) do
begin
with sounds[i]^ do
readln(t,sound_page,channel,line,shape,m,s,st,msb,oct,useless,lsb[1],lsb[2]);
inc(i);
end;
close(t);
end;
procedure set_play_variables;
var u1,m1,s1,st1:word;
begin
for i:=1 to limit_of_sounds do
with sounds[i]^ do
if sound_page>0 then played:=false;
gettime(u1,m1,s1,st1);
su1:=u1;
sm1:=m1;
ss1:=s1;
sst1:=st1;
bu2:=0;
end;
procedure set_sound_pointers;
begin
for i:=1 to limit_of_sounds do new(sounds[i]);
for i:=1 to limit_of_shapes do new(shapes[i]);
end;
var time1,time2:longint;
function izracunaj_cas:longint;
var u2,m2,s2,st2:word;
begin
gettime(u2,m2,s2,st2);
su2:=u2;
sm2:=m2;
ss2:=s2;
sst2:=st2;
if su2+bu2<su1 then bu2:=bu2+24;
time1:=su1*360000+sm1*6000+ss1*100+sst1;
time2:=(su2+bu2)*360000+sm2*6000+ss2*100+sst2;
izracunaj_cas:=time2-time1;
end;
procedure soundt(channel:chntype;Fnum,Lnum:byte;oct:byte;am,vib:boolnum;ar1,dr1,ar2,dr2:halfbyte);
begin
ports($B0+channel-1,0);
ports($20+chop1[channel],1+am*128+vib*64);
ports($40+chop1[channel],16);
ports($60+chop1[channel],ar1*16+dr1);
ports($80+chop1[channel],$77);
ports($A0+channel-1,Lnum);
ports($20+chop2[channel],1);
ports($40+chop2[channel],32-volume);
ports($60+chop2[channel],ar2*16+dr2);
ports($80+chop2[channel],$77);
ports($B0+channel-1,32+(Oct*4)+Fnum);
inc(sound_st);
end;
procedure lover_volume;
var i:byte;
begin
if volume>0 then
begin
dec(volume);
for i:=1 to 6 do
ports($40+chop2[i],32-volume);
end;
end;
procedure higher_volume;
var i:byte;
begin
if volume<32 then
begin
inc(volume);
for i:=1 to 6 do
ports($40+chop2[i],32-volume);
end;
end;
var appointed_time:longint;
procedure repeat_at(m,s,st:longint);
var u1,m1,s1,st1:word;
begin
appointed_time:=m*6000+s*100+st;
if timer>=appointed_time then
begin
gettime(u1,m1,s1,st1);
su1:=u1;
sm1:=m1;
ss1:=s1;
sst1:=st1;
bu2:=0;
sound_st:=1;
for i:=1 to limit_of_sounds do
with sounds[i]^ do
if sound_page>0 then played:=false;
end;
end;
procedure casovni_razpored;
var lsbb:byte;
sh:1..limit_of_shapes;
ammod,vibrat:0..1;
begin
{sound(hour,min,sec,hun,channel,fnum-most,fnum-least,octave,amset,vibset,
attack_rate1,decay_rate1,attack_rate2,decay_rate2 }
for i:=1 to limit_of_sounds do
with sounds[i]^ do
begin
if (sound_page>0) and (not(played)) then
begin
appointed_time:=m*6000+s*100+st;
if (timer>=appointed_time) then
begin
case lsb[1] of
'0'..'9':lsbb:=16*(ord(lsb[1])-48);
'A':lsbb:=160;
'B':lsbb:=176;
'C':lsbb:=192;
'D':lsbb:=208;
'E':lsbb:=224;
'F':lsbb:=240;
end;
case lsb[2] of
'0'..'9':lsbb:=lsbb+(ord(lsb[2])-48);
'A':lsbb:=lsbb+10;
'B':lsbb:=lsbb+11;
'C':lsbb:=lsbb+12;
'D':lsbb:=lsbb+13;
'E':lsbb:=lsbb+14;
'F':lsbb:=lsbb+15;
end;
sh:=shape;
if shapes[sh]^.am=true then ammod:=1 else ammod:=0;
if shapes[sh]^.vib then vibrat:=1 else vibrat:=0;
soundt(channel,msb,lsbb,oct,ammod,vibrat,shapes[shape]^.ar1,shapes[sh]^.dr1,shapes[sh]^.ar2,shapes[sh]^.dr2);
played:=true;
end;
end;
end;
repeat_at(0,page_length * pages div 10,page_length * pages mod 10 * 10);
end;
{ SOUND STAFF }
procedure omejitev_miske(x1,y1,x2,y2:word);
begin
reg.ax:=7;
reg.cx:=x1;
reg.dx:=x2;
intr($33,reg);
reg.ax:=8;
reg.cx:=y1;
reg.dx:=y2;
intr($33,reg);
end;
procedure set_mouse(x,y:word);
begin
reg.ax:=4;
reg.cx:=x;
reg.dx:=y;
intr($33,reg);
end;
procedure read_mouse_cursor;
var i,j:word;
begin
assign(t,'GFX\CURSOR.DAT');
reset(t);
for i:=1 to 5 do
begin
for j:=1 to 5 do
begin
read(t,ch1);
if ord(ch1)>0 then mouse_cursor[i,j]:=ord(ch1)-2
else mouse_cursor[i,j]:=0
end;
readln(t);
end;
close(t);
end;
procedure setpall(i,a,b,c:byte);
begin
port[$03C8]:=i;
port[$03C9]:=c;
port[$03C9]:=a;
port[$03C9]:=b;
end;
procedure make_bck;
var i:word;
st:real;
x,y:real;
begin
st:=0;
i:=0;
repeat
x:=sin(st)*(i div 2)+160;
y:=cos(st)*(i div 3)+100;
st:=st+0.001;
inc(i);
pic^[320*(trunc(y) mod 200)+(trunc(x) mod 320)]:=63;
if st*10=trunc(st*10) then
begin
timer:=izracunaj_cas;
casovni_razpored;
end;
until st>5*pi;
end;
procedure fill_emptiness;
var i,j,vs:word;
t:text;
begin
for i:=0 to 63999 do
begin
j:=i mod 320;
vs:=0;
if i > 319 then vs:=pic^[i-320];
if i < 63680 then vs:=vs+pic^[i+320];
if j > 0 then vs:=vs+pic^[i-1];
if j < 319 then vs:=vs+pic^[i+1];
vs:=vs div 4;
pic^[i]:=vs;
end;
move(pic^[0],mem[$A000:0000],64000);
end;
procedure show_best;
var i,j:byte;
m:longint;
col:byte;
begin
outtextxy(120,20,'HALL OF FAME',6,75,false,true,1);
for i:=1 to 10 do
begin
if number_of_the_best=i then col:=92-i else col:=75-i;
outtextxy(80,30+15*i,best_players[i].name,6,col,false,true,1);
m:=100000;
for j:=1 to 13 do numero(111+j*6,30+15*i,46,col,false,true,1);
for j:=1 to 6 do
begin
numero(190+j*6,30+15*i,best_players[i].score div m mod 10 + 48,col,false,true,1);
m:=m div 10;
end;
end;
end;
procedure show_hof(lovering:boolean);
var i,st:word;
ch:char;
endy,left_button,right_button:boolean;
begin
reset_kbd;
fillchar(pic^[0],64000,0);
make_bck;
fillchar(mem[$A000:0000],64000,0);
for i:=1 to 63 do
begin
if i>16 then j:=i-12 else j:=5;
setpall(i,j div 2,i div 3+16,j div 2);
if i mod 5=0 then
begin
timer:=izracunaj_cas;
casovni_razpored;
end;
end;
for i:=0 to 16 do setpall(65+i,i*2+24,8+i,0); { PALETA ZA CRKE }
for i:=0 to 16 do setpall(82+i,0,8+i,i*2+24);
fill_emptiness;
show_best;
endy:=false;
left_button:=false;
right_button:=false;
st:=0;
repeat
timer:=izracunaj_cas;
casovni_razpored;
if keypressed then
begin
ch:=readkey;
endy:=true;
end;
reg.ax:=3;
intr($33,reg);
if reg.bx and 1=1 then left_button:=true;
if reg.bx and 2=2 then right_button:=true;
if (reg.bx and 1<>1) and (left_button) then endy:=true;
if (reg.bx and 2<>2) and (right_button) then endy:=true;
if st=20000 then endy:=true else inc(st);
until endy;
for i:=0 to 25 do
begin
fill_emptiness;
timer:=izracunaj_cas;
casovni_razpored;
if lovering then lover_volume;
end;
fillchar(pic^[0],64000,0);
number_of_the_best:=0;
end;
procedure load_best_scores;
var t:text;
i,j:byte;
m:longint;
ch:char;
begin
if exist('LEVELS\BSTSCR.DAT') then
begin
assign(t,'LEVELS\BSTSCR.DAT');
reset(t);
for i:=1 to 10 do
begin
best_players[i].name:='';
for j:=1 to 6 do
begin
read(t,ch);
best_players[i].name:=best_players[i].name+ch;
end;
m:=100000;
for j:=1 to 6 do
begin
read(t,ch);
best_players[i].score:=best_players[i].score+(ord(ch)-48)*m;
m:=m div 10;
end;
readln(t);
end;
close(t);
end
else
for i:=1 to 10 do
begin
best_players[i].name:='GRANDY';
best_players[i].score:=1000;
end;
end;
procedure save_best_scores;
var t:text;
i,j:byte;
m:longint;
ch:char;
begin
assign(t,'LEVELS\BSTSCR.DAT');
rewrite(t);
for i:=1 to 10 do
begin
for j:=1 to 6 do
write(t,best_players[i].name[j]);
m:=100000;
for j:=1 to 6 do
begin
write(t,chr(best_players[i].score div m mod 10 +48));
m:=m div 10;
end;
writeln(t);
timer:=izracunaj_cas;
casovni_razpored;
end;
close(t);
end;
procedure equal(n:byte;str:string);
var i,j:byte;
begin
assign(t,str);
reset(t);
for i:=1 to 15 do
begin
for j:=1 to 16 do
begin
read(t,ch1);
facne[n]^[i,j]:=ord(ch1);
end;
readln(t);
end;
close(t);
end;
procedure load_cursor;
var i:byte;
begin
for i:=1 to 5 do
begin
new(facne[i]);
equal(i,'GFX\CURSOR\FACNA'+chr(48+i)+'.BLK');
end;
end;
procedure load_cursor_palette(n:byte);
var i:byte;
begin
assign(t,'GFX\CURSOR\UNIPALL.DAT');
reset(t);
for i:=n to n+8 do
begin
readln(t,ch1,ch2,ch3);
setpall(i,ord(ch1),ord(ch2),ord(ch3));
end;
close(t);
end;
procedure cursor(n,mpal:byte;x,y:word);
var i,j:word;
begin
for i:=1 to 15 do
for j:=1 to 16 do
if facne[n]^[i,j]>0 then pic^[320*(y+i)+x+j]:=facne[n]^[i,j]+mpal;
end;
procedure spremeni_sign;
var i,j:word;
begin
for i:=1 to 40 do
for j:=1 to 248 do
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;
for i:=40 to 75 do
for j:=1 to 248 do
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;
end;
procedure initialize;
begin
for i:=1 to 100 do
begin
firex[i]:=0;
firey[i]:=0;
end;
for i:=0 to enemy_num do
begin
et[i]:=0;
ef_t[i]:=0;
e_existence[i]:=0;
bonus_missile[i]:=false;
end;
for i:=1 to 2500 do exp_t[i]:=0;
end;
procedure univerzalna_paleta;
var i,j:byte;
begin
assign(t,'objects\unipall.dat');
reset(t);
for i:=0 to 127 do
begin
readln(t,ch1,ch2,ch3);
setpall(i+128,ord(ch1),ord(ch2),ord(ch3));
end;
close(t);
end;
procedure load_enemy_palette;
var i:byte;
begin
case level of
1:begin
assign(t,'objects\m1palc.dat');
reset(t);
for i:=0 to 66 do
begin
readln(t,ch1,ch2,ch3);
enemy_palette[i,1]:=ord(ch1);
enemy_palette[i,2]:=ord(ch2);
enemy_palette[i,3]:=ord(ch3);
end;
close(t);
end;
2:begin
assign(t,'objects\m2palc.dat');
reset(t);
for i:=0 to 69 do
begin
readln(t,ch1,ch2,ch3);
enemy_palette[i,1]:=ord(ch1);
enemy_palette[i,2]:=ord(ch2);
enemy_palette[i,3]:=ord(ch3);
end;
close(t);
end;
3:begin
assign(t,'objects\m3palc.dat');
reset(t);
for i:=0 to 71 do
begin
readln(t,ch1,ch2,ch3);
enemy_palette[i,1]:=ord(ch1);
enemy_palette[i,2]:=ord(ch2);
enemy_palette[i,3]:=ord(ch3);
end;
close(t);
end;
end;
end;
procedure read_right(name:string;lim1,lim2,n:byte;dir:shortint;k:byte);
var i,j:byte;
begin
assign(t,name);
reset(t);
for i:=1 to lim1 do
if dir=1 then
begin
for j:=1 to lim2 do
begin
read(t,ch1);
case n of
0:plane[i,j]:=ord(ch1) div 2;
1:e1^[i,j]:=ord(ch1)+128;
2:e2^[i,j]:=ord(ch1)+128;
3:e3p1^[i,j]:=ord(ch1)+128;
4:e3p2^[i,j]:=ord(ch1)+128;
6:e5^[i,j]:=ord(ch1)+128;
7:e6^[i,j]:=ord(ch1)+128;
8:e7p1^[i,j]:=ord(ch1)+128;
9:e7p2^[i,j]:=ord(ch1)+128;
12:m3^[i,j]:=ord(ch1)+128;
101:m2^[i,j]:=ord(ch1)+128;
201:mtr1^[i,j]:=ord(ch1)+128;
202:mtr2^[i,j]:=ord(ch1)+128;
203:mtr3^[i,j]:=ord(ch1)+128;
204:mtr4^[i,j]:=ord(ch1)+128;
205:mtr5^[i,j]:=ord(ch1)+128;
254:sign^[i,j]:=ord(ch1);
255:brdr[i,j]:=ord(ch1);
98:if ord(ch1)>20 then myms[i,j]:=ord(ch1); {MISSILE}
end;
end;
readln(t);
end
else
begin
for j:=lim2 downto 1 do
begin
read(t,ch1);
case n of
5:e4^[i,j]:=ord(ch1)+128;
10:e8^[i,j]:=ord(ch1)+128;
11:guns[k]^[i,j]:=ord(ch1)+128;
99:if ord(ch1)>20 then ms[i,j]:=ord(ch1); {MISSILE}
100:m1^[i,j]:=ord(ch1)+128;
end;
end;
readln(t);
end;
close(t);
end;
procedure read_enemy;
var i,j:byte;
begin
case level of
1:begin
new(e1);
read_right('objects\enemy1up.blk',28,50,1,1,0);
new(e2);
read_right('objects\enemy2p2.blk',22,60,2,1,0);
new(e3p1);
read_right('objects\enemy3p1.blk',10,51,3,1,0);
new(e3p2);
read_right('objects\enemy3p2.blk',10,51,4,1,0);
new(e4);
read_right('objects\enemy4up.blk',38,29,5,-1,0);
new(m1);
read_right('objects\enemym1c.blk',103,79,100,-1,0);
end;
2:begin
new(e3p1);
read_right('objects\enemy3p1.blk',10,51,3,1,0);
new(e3p2);
read_right('objects\enemy3p2.blk',10,51,4,1,0);
new(e4);
read_right('objects\enemy4up.blk',38,29,5,-1,0);
new(e5);
read_right('objects\enemy5up.blk',26,53,6,1,0);
new(e6);
read_right('objects\enemy6u2.blk',29,48,7,1,0);
new(m2);
read_right('objects\enemym2c.blk',140,115,101,1,0);
end;
3:begin
new(e2);
read_right('objects\enemy2p2.blk',22,60,2,1,0);
new(e6);
read_right('objects\enemy6u2.blk',29,48,7,1,0);
new(e7p1);
read_right('objects\enemy7u3.blk',29,59,8,1,0);
new(e7p2);
read_right('objects\enemy7u4.blk',29,59,9,1,0);
new(e8);
read_right('objects\enemy8up.blk',31,64,10,-1,0);
for i:=1 to 5 do
begin
new(guns[i]);
read_right('objects\gun\g'+chr(48+i)+'up.blk',7,37,11,-1,i);
end;
new(mtr1);
read_right('objects\meteors\m1up.blk',47,68,201,1,0);
new(mtr2);
read_right('objects\meteors\m2up.blk',21,38,202,1,0);
new(mtr3);
read_right('objects\meteors\m3up.blk',22,39,203,1,0);
new(mtr4);
read_right('objects\meteors\m4up.blk',25,43,204,1,0);
new(mtr5);
read_right('objects\meteors\m5up.blk',36,43,205,1,0);
new(m3);
read_right('objects\enemym3c.blk',127,120,12,1,0);
end;
end;
end;
procedure read_gfx;
var i,j:byte;
begin
read_right('objects\plane.blk',pcy,pcx,0,1,0);
read_right('gfx\brdrup.blk',20,97,255,1,0);
new(sign);
read_right('gfx\lvlcmp.blk',75,248,254,1,0);
for i:=0 to 20 do setpall(i+107,0,trunc(i*1.2)+5,trunc(i*1.2)+5);
end;
procedure set_low_colors;
var i:byte;
begin
assign(t,'GFX\UNIPALL.DAT');
reset(t);
for i:=0 to 107 do
begin
readln(t,ch1,ch2,ch3);
setpall(i,ord(ch1),ord(ch2),ord(ch3));
end;
close(t);
end;
procedure make_missile;
var i,j:byte;
begin
read_right('gfx\mis1.blk',10,25,98,1,0);
read_right('gfx\mis2.blk',10,25,99,2,0);
end;
procedure stars_initialization;
var i:word;
begin
for i:=1 to 200 do
begin
sx[i]:=random(1000);
sy[i]:=random(170);
sd[i]:=random(8);
end;
end;
procedure enemies_timing;
var i,j:word;
n:real;
begin
if level=1 then assign(t,'LEVELS\LEVEL1.DAT');
if level=2 then assign(t,'LEVELS\LEVEL2.DAT');
if level=3 then assign(t,'LEVELS\LEVEL3.DAT');
reset(t);
i:=0;
while not(eof(t)) do
begin
inc(i);
j:=1;
while not(eoln(t)) do
begin
read(t,n);
if j=1 then et[i]:=trunc(n);
if j=2 then ex[i]:=n;
if j=3 then ey[i]:=n-5;
if j=4 then esx[i]:=n;
case et[i] of
1:if j=5 then bonus_missile[i]:=true;
2:e_damage[i]:=3;
3:begin
if j=5 then esy[i]:=n;
if j=6 then e_where_sy[i]:=trunc(n);
end;
4:e_damage[i]:=2;
5:begin
if j=5 then esy[i]:=n;
e_damage[i]:=5;
end;
6:begin
if j=5 then bonus_missile[i]:=true;
e_damage[i]:=3;
end;
7:begin
if j=5 then bonus_missile[i]:=true;
e_damage[i]:=15;
end;
8:begin
if j=5 then esy[i]:=n;
e_damage[i]:=5;
end;
100:begin
if j=2 then ch_pal_pos:=trunc(n)-340;
if j=5 then esy[i]:=n;
if j=6 then e_where_sy[i]:=trunc(n);
e_damage[i]:=100;
e_whole_damage:=100;
end;
101:begin
if j=2 then ch_pal_pos:=trunc(n)-340;
m_pause:=30;
e_damage[i]:=200;
e_whole_damage:=200;
end;
102:begin
esx[i]:=0;
esy[i]:=0;
if j=2 then ch_pal_pos:=trunc(n)-340;
e_damage[i]:=100;
e_whole_damage:=100;
end;
end;
inc(j);
end;
readln(t);
end;
close(t);
end;
procedure dispose_enemies;
var i:byte;
begin
case level of
1:begin
dispose(e1);
dispose(e2);
dispose(e3p1);
dispose(e3p2);
dispose(e4);
dispose(m1);
end;
2:begin
dispose(e3p1);
dispose(e3p2);
dispose(e4);
dispose(e5);
dispose(e6);
dispose(m2);
end;
3:begin
dispose(e2);
dispose(e7p1);
dispose(e7p2);
dispose(e6);
dispose(e8);
for i:=1 to 5 do dispose(guns[i]);
dispose(mtr1);
dispose(mtr2);
dispose(mtr3);
dispose(mtr4);
dispose(mtr5);
dispose(m3);
end;
end;
end;
procedure end_level;
begin
dispose_enemies;
if level<3 then inc(level) else level:=1;
end;
procedure show_text;
var i,j:byte;
begin
for i:=1 to 15 do
begin
for j:=1 to 97 do
mem[$A000:320*(i-1)+j-1]:=brdr[i,j];
for j:=1 to 55 do
mem[$A000:320*(i-1)+210+j-1]:=brdr[i,j];
for j:=1 to 54 do
mem[$A000:320*(i-1)+265+j-1]:=brdr[i,j+42];
for j:=1 to 56 do
mem[$A000:320*(i-1)+97+j-1]:=brdr[i,j];
for j:=1 to 56 do
mem[$A000:320*(i-1)+154+j-1]:=brdr[i,j+41];
for j:=1 to 80 do
mem[$A000:320*(i+184)+j-1]:=brdr[i,j];
for j:=1 to 80 do
mem[$A000:320*(i+184)+80+j-1]:=brdr[i,j+17];
for j:=1 to 80 do
mem[$A000:320*(i+184)+160+j-1]:=brdr[i,j];
for j:=1 to 80 do
mem[$A000:320*(i+184)+240+j-1]:=brdr[i,j+17];
end;
outtextxy(13,4,'SCORE',6,81,false,true,2);
outtextxy(106,4,'MISSILES',6,81,false,true,2);
outtextxy(222,4,'HISCORE',6,81,false,true,2);
outtextxy(10,189,'SHIELD',6,81,false,true,2);
outtextxy(225,189,'LEVEL',6,81,false,true,2);
numero(262,189,level+48,81,false,true,2);
end;
procedure show_score;
var tmp_score,i:longint;
begin
tmp_score:=score;
for i:=1 to 6 do
begin
numero(87-i*7,4,tmp_score mod 10 + 48,81,true,true,2);
tmp_score:=tmp_score div 10;
end;
end;
procedure show_hiscore;
var tmp_score,i:longint;
begin
tmp_score:=hiscore;
for i:=1 to 6 do
begin
numero(310-i*7,4,tmp_score mod 10 + 48,81,true,true,2);
tmp_score:=tmp_score div 10;
end;
end;
procedure show_damage;
var i,j:byte;
begin
for i:=1 to 100 do
if i>damage then for j:=1 to 7 do mem[$A000:320*(188+j)+i+50]:=0
else for j:=1 to 7 do mem[$A000:320*(188+j)+i+50]:=i div 5+j+10;
end;
procedure enemy_damage(t:byte);
var i,j,col:byte;
begin
for i:=1 to 100 do
begin
case level of
1:col:=i div 4+160;
2:col:=(i+15) div 4+160;
3:col:=i div 3+150;
end;
if i>t then for j:=1 to 7 do mem[$A000:320*(188+j)+i+208]:=0
else for j:=1 to 7 do mem[$A000:320*(188+j)+i+208]:=col+j;
end;
end;
procedure show_pos(pos:byte);
var i,j:word;
begin
if pos=1 then
for i:=85 to 125 do
for j:=80 to 170 do
if pic^[320*i+j]=0 then pic^[320*i+j]:=33+(i-85) div 6 else
else
for i:=85 to 125 do
for j:=175 to 245 do
if pic^[320*i+j]=0 then pic^[320*i+j]:=33+(i-85) div 6;
end;
procedure make_bck2;
var i:word;
st:real;
x,y:real;
begin
st:=0;
i:=0;
repeat
x:=sin(st)*(i div 2)+160;
y:=sqr(st)*(i div 3)+100;
st:=st+0.001;
inc(i);
pic^[320*(trunc(y) mod 200)+(trunc(x) mod 320)]:=63;
until st>5*pi;
end;
procedure fill_emptiness2;
var i,j,vs:word;
t:text;
begin
for i:=0 to 63999 do
begin
j:=i mod 320;
vs:=0;
if i > 319 then vs:=pic^[i-320];
if i < 63680 then vs:=vs+pic^[i+320];
if j > 0 then vs:=vs+pic^[i-1];
if j < 319 then vs:=vs+pic^[i+1];
vs:=vs div 4;
pic^[i]:=vs;
end;
end;
procedure show_chars(st:byte);
var i:byte;
begin
mouttextxy(120,35,'INPUT YOUR NAME',6,66);
mouttextxy(70,65,'A B C D E F G H I J',10,70);
mouttextxy(70,85,'K L M N O P Q R S T',10,70);
mouttextxy(70,105,'U V W X Y Z 0 1 2 3',10,70);
mouttextxy(70,125,'4 5 6 7 8 9 '' _ < >',10,70);
for i:=1 to 6 do
begin
mouttextxy(137+8*i,157,name[i],8,70);
if st=i then mouttextxy(137+8*i,160,'_',8,70)
else mouttextxy(137+8*i,160,'_',8,63);
end;
end;
procedure input_name(n:byte);
label jump_over;
var sign:^screen;
i,j,x,y,nx,ny,st,lb_delay:word;
ch:char;
endy,left_button,right_button:boolean;
begin
new(sign);
read_mouse_cursor;
omejitev_miske(0,0,628,386);
fillchar(pic^[0],64000,0);
make_bck2;
fill_emptiness2;
move(pic^[0],sign^[0],64000);
fillchar(mem[$A000:0000],64000,0);
for i:=1 to 63 do
begin
if i>16 then j:=i-12 else j:=5;
setpall(i,j div 2,j div 2,i div 3+16);
end;
for i:=0 to 16 do setpall(65+i,i*2+24,8+i,0); {PALETA ZA CRKE }
setpall(127,32,32,32);
set_play_variables;
load_song('LEVELS\HOF2SONG.SNG');
endy:=false;
left_button:=false;
st:=1;
lb_delay:=0;
repeat
higher_volume;
move(sign^[0],pic^[0],64000);
show_chars(st);
timer:=izracunaj_cas;
casovni_razpored;
if keypressed then ch:=readkey;
reg.ax:=3;
intr($33,reg);
nx:=reg.cx div 2;
ny:=reg.dx div 2;
if reg.bx and 1=1 then left_button:=true
else
begin
if lb_delay>0 then dec(lb_delay);
left_button:=false;
end;
for y:=0 to 3 do { ckeck_mouse }
for x:=0 to 9 do
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
begin
ch:=chr(0);
case (y*10+x+1) of
1..26:ch:=chr(64+(y*10+x+1));
27..36:ch:=chr(21+(y*10+x+1));
37:ch:=chr(39);
38:ch:=chr(32);
39:begin
if st>1 then
begin
dec(st);
name[st]:=chr(32);
lb_delay:=5;
end;
end;
40:endy:=true;
end;
if (st<7) and (ord(ch)<>0) then
begin
name[st]:=ch;
inc(st);
lb_delay:=5;
end;
end;
jump_over:
for x:=1 to 5 do { show_mouse }
for y:=1 to 5 do
if mouse_cursor[x,y]>0 then pic^[320*(ny+x)+nx+y]:=127;
move(pic^[0],mem[$A000:0000],64000);
until endy;
fillchar(pic^[0],64000,0);
dispose(sign);
best_players[n].name:=name;
end;
procedure chk_top_score;
label out;
var i,j:word;
begin
for i:=1 to 10 do
if score>best_players[i].score then
begin
if i<10 then
begin
for j:=9 downto i do
begin
best_players[j+1].name:=best_players[j].name;
best_players[j+1].score:=best_players[j].score;
end;
end;
input_name(i);
best_players[i].score:=score;
number_of_the_best:=i;
save_best_scores;
show_hof(true);
reset_card;
goto out;
end;
out:
end;
procedure fly_agen;
var i,j,k,x,y,cx,cy,p:word;
key,pos,r,last_button:byte;
fablk:^yesno;
begin
LoadVOC('SOUND\TOING.VOC', 0, Ram , Fire1) ;
reset_kbd;
chk_top_score;
omejitev_miske(0,0,600,370);
new(fablk);
fillchar(pic^[0],64000,0);
move(pic^[0],mem[$A000:0000],64000);
assign(t,'GFX\FLYAGEN.PAL');
reset(t);
for k:=0 to 32 do
begin
readln(t,ch1,ch2,ch3);
setpall(k,ord(ch1),ord(ch2),ord(ch3));
end;
for k:=0 to 7 do setpall(33+k,k+15,k+20,0);
load_cursor_palette(41);
uncomprx('GFX\FLYAGEN.CMX',64000);
for k:=31 downto 1 do
begin
for i:=12800 to 41599 do
if pic^[i]>k then mem[$A000:i]:=pic^[i]-k;
delay(50);
end;
for i:=1 to 90 do
for j:=1 to 240 do
fablk^[i,j]:=mem[$A000:320*(35+i)+40+j];
pos:=1;
show_pos(pos);
reg.bx:=0;
repeat
if keypressed then
begin
key:=ord(readkey);
if key=0 then key:=ord(readkey);
if (key=75) and (pos=2) then pos:=1;
if (key=77) and (pos=1) then pos:=2;
end;
if ((reg.bx and 1)=1) and (last_button=0) then
begin
if (y>75) and (y<115) then
begin
if (x>75) and (x<165) then
begin
key:=13;
pos:=1;
end;
if (x>175) and (x<245) then
begin
key:=13;
pos:=2;
end;
end;
if sound_set then playvoc(fire1);
end;
for i:=1 to 90 do
for j:=1 to 240 do
pic^[320*(35+i)+40+j]:=fablk^[i,j];
show_pos(pos);
last_button:=reg.bx and 1;
reg.ax:=3;
intr($33,reg);
x:=reg.cx div 2;
y:=reg.dx div 2;
p:=1;
r:=random(500);
if (cx=x) and (cy=y) then
if ((r=19) or (r=20)) then
begin
cursor(pos+2,41,x,y);
p:=100;
end
else if (r=21) and (pos=1) then
begin
cursor(5,41,x,y);
p:=400;
end
else cursor(pos,41,x,y)
else cursor(pos,41,x,y);
move(pic^[0],mem[$A000:0000],64000);
delay(p);
fillchar(pic^[0],64000,0);
cx:=x;
cy:=y;
until key=13;
for k:=1 to 31 do
begin
for i:=1 to 90 do
for j:=1 to 240 do
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;
delay(20);
end;
fillchar(mem[$A000:0],64000,0);
fillchar(pic^[0],64000,0);
if pos=1 then flyagain:=true else over:=true;
dispose(fablk);
end;
procedure error_msg(str:string);
begin
reg.ah:=0;
reg.al:=3;
intr($10,reg);
writeln(str);
halt(1);
end;
procedure set_my_pieces(t:byte);
var r:byte;
begin
for i:=5 to 10 do
begin
r:=random(20);
for j:=20-t+r to 17+t+r do
if plane[i,j]>0 then
begin
while exp_t[hole]>0 do
begin
inc(hole);
if hole>2500 then error_msg('POVECAJ MATRIKE (IN OSTALO) ZA EXSPLOZIJE!');
end;
exp_x[hole]:=(px+j)*100;
exp_y[hole]:=(py+i)*100;
if t>10 then exp_dx[hole]:=(random(35)-17)*5
else exp_dx[hole]:=-(random(35))*5;
exp_dy[hole]:=(random(35)-17)*5;
exp_t[hole]:=t*2;
exp_ty[hole]:=2;
end;
end;
end;
procedure play_exp;
begin
if sound_set then
begin
if (StatusWord<>0) then stopvoc;
playvoc(exp);
firepl:=false;
exppl:=true;
fmpl:=false;
end;
end;
procedure plane_crash;
var k:byte;
begin
if crashed=0 then
begin
crashed:=100;
damage:=0;
show_damage;
set_my_pieces(12);
set_my_pieces(12);
set_my_pieces(12);
end;
play_exp;
end;
procedure set_shoot(a,b,c,d:integer;e:byte);
begin
while ef_t[hole]>0 do
begin
inc(hole);
if hole>500 then error_msg('POVECAJ MATRIKE (IN OSTALO) ZA SOVRAZNIKOVE STRELE!');
end;
ef_x[hole]:=a;
ef_y[hole]:=b;
ef_dx[hole]:=c;
ef_dy[hole]:=d;
ef_t[hole]:=e;
end;
procedure chk_shooting;
var i,r:word;
tmpe:integer;
begin
hole:=1;
for i:=1 to enemy_num do
if et[i]>0 then
begin
tmpe:=trunc(ex[i])-(major_st+30);
if (e_existence[i]>0) and (tmpe>60) then
begin
case et[i] of
1:if (e_existence[i]>50) and (e_existence[i] mod 50=0) then
begin
set_shoot((tmpe+25)*100,trunc(ey[i]+4)*100,-300,random(100)-50,7);
set_shoot((tmpe+25)*100,trunc(ey[i]+18)*100,-300,random(100)-50,7);
end;
2:if e_existence[i] mod 10=0 then
begin
set_shoot((tmpe+10)*100,trunc(ey[i]+5)*100,-500,0,1);
set_shoot((tmpe+10)*100,trunc(ey[i]+20)*100,-500,0,1);
end;
4:if e_existence[i] mod 20=0 then
begin
set_shoot((tmpe+5)*100,trunc(ey[i]+15)*100,-500,random(400)-200,2);
set_shoot((tmpe+5)*100,trunc(ey[i]+25)*100,-500,random(400)-200,2);
end;
5:if e_existence[i] mod 20=0 then
begin
set_shoot((tmpe+15)*100,trunc(ey[i]+3)*100,0,0,3);
set_shoot((tmpe+15)*100,trunc(ey[i]+23)*100,0,0,3);
end;
6:if e_existence[i] mod 15=0 then
begin
set_shoot((tmpe+15)*100,trunc(ey[i]+3)*100,-200,-random(50),4);
set_shoot((tmpe+15)*100,trunc(ey[i]+23)*100,-200,random(50),4);
end;
7:if (e_existence[i] mod 2=0) and (e_existence[i]>40) then
begin
r:=e_existence[i] mod 16 div 2;
case r of
0:set_shoot((tmpe+20)*100,trunc(ey[i]+16)*100,-200,random(50)-25,5);
1:set_shoot((tmpe+28)*100,trunc(ey[i]+7)*100,-140+random(50)-25,random(50)-125,5);
2:set_shoot((tmpe+40)*100,trunc(ey[i]+4)*100,random(50)-125,-150,5);
3:set_shoot((tmpe+45)*100,trunc(ey[i]+7)*100,+40+random(50)-25,random(50)-125,5);
4:set_shoot((tmpe+50)*100,trunc(ey[i]+16)*100,100,random(50)-25,5);
5:set_shoot((tmpe+45)*100,trunc(ey[i]+22)*100,+40+random(50)-25,random(50)+75,5);
6:set_shoot((tmpe+40)*100,trunc(ey[i]+25)*100,random(50)-125,150,5);
7:set_shoot((tmpe+28)*100,trunc(ey[i]+22)*100,-140+random(50)-25,random(50)+75,5);
end;
end;
8:if (e_existence[i] mod 50<24) and (e_existence[i] mod 7=0) and (e_existence[i]>61) then
set_shoot((tmpe+25)*100,trunc(ey[i]+15)*100,-500,0,6);
100:if (e_existence[i] mod 10=0) and (e_existence[i]>100) then
begin
set_shoot((tmpe+45)*100,trunc(ey[i]+10)*100,-500,random(100)-50,1);
set_shoot((tmpe+40)*100,trunc(ey[i]+30)*100,-500,random(100)-50,1);
set_shoot((tmpe+40)*100,trunc(ey[i]+73)*100,-500,random(100)-50,1);
set_shoot((tmpe+45)*100,trunc(ey[i]+93)*100,-500,random(100)-50,1);
end;
101:if (m_pause>1) and (e_existence[i]>50) then
begin
if (e_existence[i] mod 5=0) then
begin
set_shoot((tmpe+5)*100,trunc(ey[i]+70)*100,-500,random(400)-200,2);
set_shoot((tmpe+5)*100,trunc(ey[i]+71)*100,-500,random(400)-200,2);
end;
if (e_existence[i] mod 10=0) then
begin
set_shoot((tmpe+50)*100,trunc(ey[i]+60)*100,-200,-random(50),4);
set_shoot((tmpe+50)*100,trunc(ey[i]+80)*100,-200,random(50),4);
end;
end;
102:if (e_existence[i]>80) then
begin
if (e_existence[i] mod 10=0) and (m_pause=0) then
begin
r:=random(6);
case r of
0:set_shoot((tmpe+65)*100,trunc(ey[i]+20)*100,-300,random(100)-50,7);
1:set_shoot((tmpe+65)*100,trunc(ey[i]+30)*100,-300,random(100)-50,7);
2:set_shoot((tmpe+65)*100,trunc(ey[i]+40)*100,-300,random(100)-50,7);
3:set_shoot((tmpe+65)*100,trunc(ey[i]+77)*100,-300,random(100)-50,7);
4:set_shoot((tmpe+65)*100,trunc(ey[i]+87)*100,-300,random(100)-50,7);
5:set_shoot((tmpe+65)*100,trunc(ey[i]+97)*100,-300,random(100)-50,7);
end;
end;
if m_pause>0 then set_shoot((tmpe+15)*100,trunc(ey[i]+60+random(6))*100,-200,random(50)-25,4);
end;
end;
end;
end;
end;
procedure stars_to_pic;
var i:word;
begin
for i:=1 to 200 do
begin
sx[i]:=sx[i]-(sd[i] div 5+1);
if sx[i]<=0 then
begin
sx[i]:=random(600)+400;
sy[i]:=random(170);
sd[i]:=random(8);
end
else if (sx[i]<320) then pic^[320*sy[i]+sx[i]]:=69+sd[i];
end;
end;
procedure explosions_to_pic;
var i:word;
color:byte;
exptx,expty:word;
begin
for i:=1 to 2000 do
if exp_t[i]>0 then
begin
exp_x[i]:=exp_x[i]+exp_dx[i];
exp_y[i]:=exp_y[i]+exp_dy[i];
exptx:=exp_x[i] div 100;
expty:=exp_y[i] div 100;
if (exptx>0) and (exptx<319) and (expty>0) and (expty<170) then
begin
if exp_t[i]>8 then color:=8 else color:=exp_t[i];
if exp_ty[i]=1 then pic^[320*expty+exptx]:=85-color
else pic^[320*expty+exptx]:=84+color;
end
else exp_t[i]:=1;
if exp_ty[i]=1 then
begin
if exp_dx[i]>0 then exp_dx[i]:=exp_dx[i]+100 else exp_dx[i]:=exp_dx[i]-100;
if exp_dy[i]>0 then exp_dy[i]:=exp_dy[i]+100 else exp_dy[i]:=exp_dy[i]-100;
end
else
begin
if exp_dx[i]>0 then exp_dx[i]:=exp_dx[i]+10 else exp_dx[i]:=exp_dx[i]-10;
if exp_dy[i]>0 then exp_dy[i]:=exp_dy[i]+10 else exp_dy[i]:=exp_dy[i]-10;
end;
dec(exp_t[i]);
end;
end;
procedure plane_to_pic;
var i,j,k:byte;
tmp_i:word;
begin
for i:=1 to pcy do
begin
tmp_i:=320*(i+py);
for j:=1 to pcx do
if plane[i,j]>0 then
begin
if pic^[tmp_i+j+px]>127 then plane_crash;
pic^[tmp_i+j+px]:=plane[i,j];
end;
end;
end;
procedure flame;
var i:byte;
begin
if (crashed=0) and ((main_dead=0) or (main_dead>140)) then
for i:=1 to flame_lenght do pic^[320*(py+11)+px+1-i]:=63+i;
end;
procedure fire;
var i:byte;
out:boolean;
begin
if (crashed=0) and ((main_dead=0) or (main_dead>140)) then
begin
out:=false;
i:=0;
repeat
inc(i);
if (firex[i]=0) and (firey[i]=0) then
begin
firey[i]:=py+11;
firex[i]:=px+50;
out:=true;
fire_delay:=4;
end;
if i>100 then out:=true;
until out;
if (sound_set) then
begin
if (exppl) and (StatusWord<>0) then
else
begin
stopvoc;
playvoc(fire1);
firepl:=true;
exppl:=false;
fmpl:=false;
end;
end;
end;
end;
procedure show_missiles;
var i,j,k:byte;
begin
for j:=1 to 6 do
for k:=1 to 50 do
mem[$A000:320*(j+4)+154+k]:=0;
for i:=1 to 5 do
for j:=1 to 10 do
for k:=1 to 25 do
if (i<=msnum) and (myms[j,k]>0) then mem[$A000:320*(j+2)+146+7*i+k]:=myms[j,k]
end;
procedure fire_missile;
var i:byte;
begin
if (msnum>0) and (crashed=0) and ((main_dead=0) or (main_dead>140)) then
begin
missile_delay:=1;
fire_delay:=4;
mx:=(px+15)*100;
my:=(py+6)*100;
mdx:=0;
mdy:=random(25)-12;
dec(msnum);
show_missiles;
if sound_set then
begin
if (StatusWord<>0) then stopvoc;
playvoc(fm);
firepl:=false;
exppl:=false;
fmpl:=true;
end;
end;
end;
procedure enemies_to_pic;
const bx:array[1..5] of byte=(25,25,26,43,43);
var i,sbs,overy1,overy2:word;
j,k,gunfaze,r:byte;
tr,tmpb,cut_l,cut_r:integer;
begin
for i:=1 to enemy_num do
begin
if (et[i]>0) and (ex[i]>major_st-30) and (ex[i]<major_st+329) then
begin
inc(e_existence[i]);
tmpb:=trunc(ex[i])-(major_st+20);
if tmpb<0 then cut_l:=abs(tmpb) else cut_l:=0;
case et[i] of
1:begin
if tmpb>269 then cut_r:=tmpb-269 else cut_r:=0;
for j:=1 to 28 do
begin
sbs:=320*(trunc(ey[i])+j);
for k:=1+cut_l to 50-cut_r do
if e1^[j,k]>128 then pic^[sbs+tmpb+k]:=e1^[j,k]
end;
ex[i]:=ex[i]-(esx[i]-1);
end;
2:begin
if tmpb>259 then cut_r:=tmpb-259 else cut_r:=0;
for j:=1 to 22 do
begin
sbs:=320*(trunc(ey[i])+j);
for k:=1+cut_l to 60-cut_r do
if e2^[j,k]>128 then pic^[sbs+tmpb+k]:=e2^[j,k]
end;
ex[i]:=ex[i]-(esx[i]-1);
end;
3:begin
if tmpb>259 then cut_r:=tmpb-259 else cut_r:=0;
if major_st mod 6<3 then
for j:=1 to 10 do
begin
sbs:=320*(trunc(ey[i])+j);
for k:=1+cut_l to 51-cut_r do
if e3p1^[j,k]>128 then pic^[sbs+tmpb+k]:=e3p1^[j,k]
end
else
for j:=1 to 10 do
begin
sbs:=320*(trunc(ey[i])+j);
for k:=1+cut_l to 51-cut_r do
if e3p2^[j,k]>128 then pic^[sbs+tmpb+k]:=e3p2^[j,k]
end;
ex[i]:=ex[i]-(esx[i]-1);
if esy[i]<>0 then if tmpb+k<e_where_sy[i] then ey[i]:=ey[i]+esy[i];
end;
4:begin
if tmpb>284 then cut_r:=tmpb-284 else cut_r:=0;
for j:=1 to 38 do
begin
sbs:=320*(trunc(ey[i])+j);
for k:=1+cut_l to 29-cut_r do
if e4^[j,k]>128 then pic^[sbs+tmpb+k]:=e4^[j,k]
end;
ex[i]:=ex[i]-esx[i];
end;
5:begin
if tmpb>265 then cut_r:=tmpb-265 else cut_r:=0;
for j:=1 to 26 do
begin
sbs:=320*(trunc(ey[i])+j);
for k:=1+cut_l to 53-cut_r do
if e5^[j,k]>128 then pic^[sbs+tmpb+k]:=e5^[j,k]
end;
if ((esx[i]<0) and (tmpb<150)) or ((esx[i]>0) and (tmpb>250)) then esx[i]:=-esx[i];
if ((esy[i]<0) and (ey[i]>130)) or ((esy[i]>0) and (ey[i]<10)) then esy[i]:=-esy[i];
ex[i]:=ex[i]+esx[i];
ey[i]:=ey[i]-esy[i];
end;
6:begin
if tmpb>265 then cut_r:=tmpb-265 else cut_r:=0;
for j:=1 to 29 do
begin
sbs:=320*(trunc(ey[i])+j);
for k:=1+cut_l to 48-cut_r do
if e6^[j,k]>128 then pic^[sbs+tmpb+k]:=e6^[j,k]
end;
ex[i]:=ex[i]-esx[i];
end;
7:begin
if tmpb>255 then cut_r:=tmpb-255 else cut_r:=0;
for j:=1 to 29 do
begin
sbs:=320*(trunc(ey[i])+j);
if major_st mod 8<4 then
for k:=1+cut_l to 59-cut_r do
if e7p1^[j,k]>128 then pic^[sbs+tmpb+k]:=e7p1^[j,k] else
else
for k:=1+cut_l to 59-cut_r do
if e7p2^[j,k]>128 then pic^[sbs+tmpb+k]:=e7p2^[j,k]
end;
end;
8:begin
if tmpb>250 then cut_r:=tmpb-250 else cut_r:=0;
for j:=1 to 31 do
begin
sbs:=320*(trunc(ey[i])+j);
for k:=1+cut_l to 64-cut_r do
if e8^[j,k]>128 then pic^[sbs+tmpb+k]:=e8^[j,k]
end;
case e_existence[i] of
1..49:gunfaze:=5;
50..53:gunfaze:=4;
54..57:gunfaze:=3;
58..61:gunfaze:=2;
else gunfaze:=1;
end;
for j:=1 to 7 do
begin
sbs:=320*(trunc(ey[i])+j+12);
for k:=1 to 37 do
if (guns[gunfaze]^[j,k]>128) and (tmpb+k+bx[gunfaze]<310) and (tmpb+k+bx[gunfaze]>0) then
pic^[sbs+tmpb+k+bx[gunfaze]]:=guns[gunfaze]^[j,k];
end;
if (e_existence[i]<50) then ex[i]:=ex[i]-esx[i]
else begin
if major_st>2600 then ex[i]:=ex[i]-1;
ex[i]:=ex[i]+1;
ey[i]:=ey[i]+esy[i];
if ey[i]<=5 then esy[i]:=-esy[i];
if ey[i]>=130 then esy[i]:=-esy[i];
end;
end;
100:begin
if tmpb>235 then cut_r:=tmpb-235 else cut_r:=0;
for j:=1 to 103 do
begin
sbs:=320*(trunc(ey[i])+j);
for k:=1+cut_l to 79-cut_r do
if m1^[j,k]>128 then pic^[sbs+tmpb+k]:=m1^[j,k]
end;
if major_st>ch_pal_pos+120 then
begin
ex[i]:=ex[i]+1;
ey[i]:=ey[i]+esy[i];
if ey[i]<=8 then esy[i]:=-esy[i];
if ey[i]>=62 then esy[i]:=-esy[i];
end;
end;
101:begin
if tmpb>199 then cut_r:=tmpb-199 else cut_r:=0;
for j:=1 to 140 do
begin
sbs:=320*(trunc(ey[i])+j);
if (ey[i]+j>0) and (ey[i]+j<165) then
for k:=1+cut_l to 115-cut_r do
if m2^[j,k]>128 then pic^[sbs+tmpb+k]:=m2^[j,k]
end;
{ MASTERS MOVING }
if major_st>ch_pal_pos+90 then
begin
if m_pause=0 then
begin
ex[i]:=ex[i]+esx[i];
ey[i]:=ey[i]+esy[i];
if (tmpb<30) and (esx[i]<0) then
begin
esx[i]:=-esx[i]+2;
esy[i]:=-esy[i];
end;
if (tmpb>220) and (esx[i]>0) then m_pause:=30;
end;
if m_pause=1 then
begin
tr:=random(3)+1;
esx[i]:=-2;
case tr of
1:esy[i]:=-0.5;
2:esy[i]:=0;
3:esy[i]:=0.5;
end;
m_pause:=0;
end;
if m_pause>1 then
begin
ex[i]:=ex[i]+1;
dec(m_pause);
end;
end;
end;
102:begin
if tmpb>195 then cut_r:=tmpb-195 else cut_r:=0;
if ey[i]<0 then overy1:=trunc(-ey[i]) else overy1:=0;
if ey[i]>40 then overy2:=trunc(ey[i]-40) else overy2:=0;
for j:=1+overy1 to 127-overy2 do
begin
sbs:=320*(trunc(ey[i])+j);
for k:=1+cut_l to 120-cut_r do
if m3^[j,k]>128 then pic^[sbs+tmpb+k]:=m3^[j,k]
end;
if m_pause=0 then
begin
ex[i]:=ex[i]+esx[i];
ey[i]:=ey[i]+esy[i];
if (tmpb<=150) and (esx[i]<>2) then
begin
esx[i]:=2;
r:=random(2);
if r=0 then esy[i]:=-0.5 else esy[i]:=0.5;
m_pause:=20;
end;
if (ey[i]<=-20) then
begin
if esx[i]=2 then
begin
esx[i]:=1;
esy[i]:=2;
end
else
begin
esx[i]:=0;
esy[i]:=0.5;
end;
m_pause:=20;
end;
if ey[i]>=62 then
begin
if esx[i]=1 then
begin
esx[i]:=0;
esy[i]:=-0.5;
end
else
begin
esx[i]:=1;
esy[i]:=-2;
end;
m_pause:=20;
end;
end
else
begin
dec(m_pause);
ex[i]:=ex[i]+1;
end;
end;
201:begin
if tmpb>245 then cut_r:=tmpb-245 else cut_r:=0;
for j:=1 to 47 do
begin
sbs:=320*(trunc(ey[i])+j);
for k:=1+cut_l to 68-cut_r do
if mtr1^[j,k]>128 then pic^[sbs+tmpb+k]:=mtr1^[j,k]
end;
ex[i]:=ex[i]-esx[i];
end;
202:begin
if tmpb>275 then cut_r:=tmpb-275 else cut_r:=0;
for j:=1 to 21 do
begin
sbs:=320*(trunc(ey[i])+j);
for k:=1+cut_l to 38-cut_r do
if mtr2^[j,k]>128 then pic^[sbs+tmpb+k]:=mtr2^[j,k]
end;
ex[i]:=ex[i]-esx[i];
end;
203:begin
if tmpb>275 then cut_r:=tmpb-275 else cut_r:=0;
for j:=1 to 22 do
begin
sbs:=320*(trunc(ey[i])+j);
for k:=1+cut_l to 39-cut_r do
if mtr3^[j,k]>128 then pic^[sbs+tmpb+k]:=mtr3^[j,k]
end;
ex[i]:=ex[i]-esx[i];
end;
204:begin
if tmpb>270 then cut_r:=tmpb-270 else cut_r:=0;
for j:=1 to 25 do
begin
sbs:=320*(trunc(ey[i])+j);
for k:=1+cut_l to 43-cut_r do
if mtr4^[j,k]>128 then pic^[sbs+tmpb+k]:=mtr4^[j,k]
end;
ex[i]:=ex[i]-esx[i];
end;
205:begin
if tmpb>270 then cut_r:=tmpb-270 else cut_r:=0;
for j:=1 to 36 do
begin
sbs:=320*(trunc(ey[i])+j);
for k:=1+cut_l to 43-cut_r do
if mtr5^[j,k]>128 then pic^[sbs+tmpb+k]:=mtr5^[j,k]
end;
ex[i]:=ex[i]-esx[i];
end;
end;
end;
end;
end;
procedure set_pieces(k:word;t:byte);
begin
while exp_t[hole]>0 do
begin
inc(hole);
if hole>2500 then error_msg('POVECAJ MATRIKE (IN OSTALO) ZA EXSPLOZIJE!');
end;
exp_x[hole]:=(trunc(ex[k])-(major_st+30)+ej)*100;
exp_y[hole]:=trunc((ey[k]+ei)*100);
exp_dx[hole]:=(random(45)-22)*10;
exp_dy[hole]:=(random(35)-17)*10;
exp_t[hole]:=t;
exp_ty[hole]:=1;
end;
procedure clean_enemy_damage;
begin
for ei:=164 to 220 do
for ej:=1 to 7 do
mem[$A000:320*(188+ej)+ei]:=0;
end;
procedure hit(n,i1,j1,i2,j2:byte;scr,k:word;shpgone:boolean;mind:word);
begin
for ei:=i1 to i2 do
for ej:=j1 to j2 do
case n of
1:if e1^[ei,ej]>128 then set_pieces(k,8);
2:if e2^[ei,ej]>128 then set_pieces(k,10);
3:if e3p1^[ei,ej]>128 then set_pieces(k,10);
4:if e4^[ei,ej]>128 then set_pieces(k,10);
5:if e5^[ei,ej]>128 then set_pieces(k,10);
6:if e6^[ei,ej]>128 then set_pieces(k,9);
7:if e7p1^[ei,ej]>128 then set_pieces(k,9);
8:if e8^[ei,ej]>128 then set_pieces(k,9);
end;
if scr>0 then
begin
score:=score+scr;
show_score;
end;
if shpgone then et[k]:=0 else dec(e_damage[k],mind);
end;
procedure chk_bonus_missile(k:word);
begin
if bonus_missile[k]=true then
begin
bmy:=trunc(ey[k]) + 10;
bmx:=trunc(ex[k])-(major_st+30) + 10;
bonus_missile[k]:=false;
end;
end;
procedure bonus_missile_to_pic;
var i,j,hit_st:integer;
begin
if (bmy>0) and (bmx>0) then
begin
hit_st:=0;
for i:=1 to 10 do
for j:=1 to 25 do
if (myms[i,j]>0) and (bmx+j>=0) then
begin
if (pic^[320*(bmy+i)+bmx+j]>0) and (pic^[320*(bmy+i)+bmx+j]<40) then inc(hit_st);
pic^[320*(bmy+i)+bmx+j]:=myms[i,j];
end;
if major_st mod 2 = 0 then inc(bmy);
bmx:=bmx-2;
if hit_st>30 then
begin
bmy:=0;
bmx:=0;
if msnum<5 then inc(msnum);
show_missiles;
end;
if (bmy>=170) then
begin
bmy:=0;
bmx:=0;
end;
end;
end;
procedure check_enemy(fy,fx,mind:word);
var k,l,m:word;
tmpe:integer;
begin
for k:=1 to enemy_num do
if et[k]>0 then
begin
tmpe:=trunc(ex[k])-(major_st+30);
case et[k] of
1:if (fx>=tmpe) and (fx<=tmpe+50) and (fy>=ey[k]) and (fy<=ey[k]+28) then
begin
chk_bonus_missile(k);
hit(1,1,1,28,50,20,k,true,mind);
play_exp;
end;
2:if (fx>=tmpe) and (fx<=tmpe+60) and (fy>=ey[k]) and (fy<=ey[k]+22) then
if e_damage[k]<=mind then
begin
hit(2,1,1,22,60,50,k,true,mind);
play_exp;
end
else hit(2,10,25,14,40,0,k,false,mind);
3:if (fx>=tmpe) and (fx<=tmpe+51) and (fy>=ey[k]) and (fy<=ey[k]+10) then
begin
hit(3,1,1,10,51,150,k,true,mind);
play_exp;
end;
4:if (fx>=tmpe) and (fx<=tmpe+29) and (fy>=ey[k]) and (fy<=ey[k]+38) then
if e_damage[k]<=mind then
begin
hit(4,1,1,38,29,100,k,true,mind);
play_exp;
end
else hit(4,10,10,28,19,0,k,false,mind);
5:if (fx>=tmpe) and (fx<=tmpe+53) and (fy>=ey[k]) and (fy<=ey[k]+26) then
if e_damage[k]<=mind then
begin
hit(5,1,1,26,53,210,k,true,mind);
play_exp;
end
else hit(5,12,31,17,45,0,k,false,mind);
6:if (fx>=tmpe) and (fx<=tmpe+48) and (fy>=ey[k]) and (fy<=ey[k]+29) then
if e_damage[k]<=mind then
begin
chk_bonus_missile(k);
hit(6,1,1,29,48,100,k,true,mind);
play_exp;
end
else hit(6,10,20,19,38,0,k,false,mind);
7:if (fx>=tmpe) and (fx<=tmpe+59) and (fy>=ey[k]) and (fy<=ey[k]+29) then
if e_damage[k]<=mind then
begin
chk_bonus_missile(k);
hit(7,5,10,25,40,150,k,true,mind);
play_exp;
end
else hit(7,10,30,19,42,0,k,false,mind);
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
if e_damage[k]<=mind then
begin
hit(8,1,1,31,64,250,k,true,mind);
play_exp;
end
else
begin
for l:=1 to 7 do
for m:=1 to 37 do
begin
ei:=l+12;
ej:=m+35;
if guns[1]^[ei,ej]>128 then set_pieces(k,10);
end;
dec(e_damage[k],mind);
end;
100:if (fx>=tmpe) and (fx<=tmpe+79) and (fy>=ey[k]) and (fy<=ey[k]+103) then
if e_damage[k]<=mind then
begin
for l:=1 to 39 do
for ej:=1 to 103 do
begin
ei:=l*2;
if m1^[ei,ej]>128 then set_pieces(k,10);
end;
et[k]:=0;
score:=score+2000;
show_score;
main_dead:=200;
clean_enemy_damage;
play_exp;
end
else
begin
for l:=24 to 27 do
for ej:=40 to 63 do
begin
ei:=l*2;
if m1^[ei,ej]>128 then set_pieces(k,10);
end;
dec(e_damage[k],mind);
enemy_damage(trunc(e_damage[k]/e_whole_damage*100));
end;
101:if (fx>=tmpe) and (fx<=tmpe+115) and (fy>=ey[k]) and (fy<=ey[k]+140) then
if e_damage[k]<=mind then
begin
for l:=1 to 70 do
for m:=1 to 57 do
begin
ei:=l*2;
ej:=m*2;
if m2^[ei,ej]>128 then set_pieces(k,10);
end;
et[k]:=0;
score:=score+5000;
show_score;
main_dead:=200;
clean_enemy_damage;
play_exp;
end
else
begin
for l:=32 to 37 do
for ej:=15 to 35 do
begin
ei:=l*2;
if m2^[ei,ej]>128 then set_pieces(k,8);
end;
dec(e_damage[k],mind);
enemy_damage(trunc(e_damage[k]/e_whole_damage*100));
end;
102:if (fx>=tmpe) and (fx<=tmpe+120) and (fy>=ey[k]) and (fy<=ey[k]+127) then
if e_damage[k]<=mind then
begin
for l:=1 to 70 do
for m:=1 to 57 do
begin
ei:=l*2;
ej:=m*2;
if m3^[ei,ej]>128 then set_pieces(k,10);
end;
et[k]:=0;
score:=score+6000;
show_score;
main_dead:=200;
clean_enemy_damage;
play_exp;
end
else
begin
for ei:=trunc(fy-ey[k]) to trunc(fy-ey[k]+10) do
for ej:=25 to 45 do
if m3^[ei,ej]>128 then set_pieces(k,8);
dec(e_damage[k],mind);
enemy_damage(trunc(e_damage[k]/e_whole_damage*100));
end;
end;
end;
end;
procedure plane_fire_to_pic;
label skip;
var i,j:byte;
begin
hole:=1;
for i:=1 to 100 do
if (firex[i]>0) and (firey[i]>0) then
begin
firex[i]:=firex[i]+3;
for j:=4 downto 0 do if firex[i]+j<320 then
if pic^[320*(firey[i])+firex[i]+j]>127 then
begin
check_enemy(firey[i],firex[i]+j,1);
firex[i]:=0;
firey[i]:=0;
goto skip;
end else pic^[320*(firey[i])+firex[i]+j]:=40+j;
if firex[i]=319 then
begin
firex[i]:=0;
firey[i]:=0;
end;
skip:
end;
end;
procedure enemy_fire_to_pic;
label skip;
var i,j,k:word;
hx,hy,shy:word;
dx,dy:integer;
begin
for i:=1 to 500 do
if ef_t[i]>0 then
begin
hx:=ef_x[i] div 100;
hy:=ef_y[i] div 100;
shy:=320*hy;
case ef_t[i] of
1:begin
if (pic^[shy+hx]>0) and (pic^[shy+hx]<41) then
if damage>2 then
begin
damage:=damage-2;
set_my_pieces(7);
show_damage;
ef_t[i]:=0;
end
else plane_crash;
for j:=0 to 3 do pic^[shy+hx+j]:=46+j;
ef_x[i]:=ef_x[i]+ef_dx[i];
ef_y[i]:=ef_y[i]+ef_dy[i];
if ef_x[i]<=500 then ef_t[i]:=0;
end;
2:begin
if (pic^[shy+hx]>0) and (pic^[shy+hx]<41) then
if damage>3 then
begin
damage:=damage-3;
set_my_pieces(8);
show_damage;
ef_t[i]:=0;
end
else plane_crash;
for j:=0 to 3 do pic^[shy+hx+j]:=41+j;
ef_x[i]:=ef_x[i]+ef_dx[i];
ef_y[i]:=ef_y[i]+ef_dy[i];
if (ef_x[i]<=500) or (ef_y[i]<=500) or (ef_y[i]>=16500) then ef_t[i]:=0;
end;
3:begin
for j:=hx downto 0 do
if (pic^[shy+j]>0) and (pic^[shy+j]<41) then
begin
if damage>1 then
begin
damage:=damage-1;
set_my_pieces(6);
show_damage;
end
else plane_crash;
j:=1;
end;
if hx>20 then ef_x[i]:=ef_x[i]-2000 else ef_t[i]:=0;
for j:=0 to hx do pic^[shy+hx-j]:=50+j div 40;
end;
4:begin
if (pic^[shy+hx]>0) and (pic^[shy+hx]<41) then
if damage>2 then
begin
damage:=damage-2;
set_my_pieces(7);
show_damage;
ef_t[i]:=0;
end
else plane_crash;
if hx mod 8<4 then
begin
pic^[shy+hx-1]:=43;
pic^[shy+hx]:=44;
pic^[shy+hx+1]:=43;
end
else
begin
pic^[shy-320+hx]:=43;
pic^[shy+hx]:=44;
pic^[shy+320+hx]:=43;
end;
ef_x[i]:=ef_x[i]+ef_dx[i];
ef_y[i]:=ef_y[i]+ef_dy[i];
if (ef_x[i]<=200) or (ef_y[i]<=500) or (ef_y[i]>=16500) then ef_t[i]:=0;
end;
5:begin
if (pic^[shy+hx]>0) and (pic^[shy+hx]<41) then
if damage>1 then
begin
damage:=damage-1;
set_my_pieces(6);
show_damage;
ef_t[i]:=0;
end
else plane_crash;
if ef_dx[i]>0 then dx:=ef_dx[i] div 100+1
else dx:=ef_dx[i] div 100;
dy:=ef_dy[i] div 70;
for j:=0 to 3 do pic^[shy+hx+trunc(320*j*dy)+trunc(dx*j)]:=41+j;
ef_x[i]:=ef_x[i]+ef_dx[i];
ef_y[i]:=ef_y[i]+ef_dy[i];
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;
end;
6:begin
if (pic^[shy+hx]>0) and (pic^[shy+hx]<41) then
if damage>2 then
begin
damage:=damage-2;
set_my_pieces(7);
show_damage;
ef_t[i]:=0;
end
else plane_crash;
for j:=0 to 5 do pic^[shy+hx+j]:=127-j;
ef_x[i]:=ef_x[i]+ef_dx[i];
ef_dx[i]:=ef_dx[i]+3;
if (ef_x[i]<=500) then ef_t[i]:=0;
end;
7:begin
for j:=1 to 10 do
for k:=1 to 25 do
if (ms[j,k]>0) and (hx+k<319) then
if (pic^[shy+hx+(320*j)+k]>0) and (pic^[shy+hx+(320*j)+k]<40) and (ms[j,k]>0) then
if damage>10 then
begin
damage:=damage-10;
set_my_pieces(9);
set_my_pieces(9);
show_damage;
ef_t[i]:=0;
goto skip;
end
else
begin
plane_crash;
goto skip;
end;
skip:
for j:=1 to 10 do
for k:=1 to 25 do
if (ms[j,k]>0) and (hx+k<319) then pic^[shy+hx+(320*j)+k]:=ms[j,k];
ef_x[i]:=ef_x[i]-ef_dx[i];
ef_y[i]:=ef_y[i]-ef_dy[i];
ef_dx[i]:=ef_dx[i]+20;
if (ef_x[i]<=500) or (ef_y[i]<=100) or (ef_y[i]>=16500) then ef_t[i]:=0;
end;
end;
end;
end;
procedure missile_to_pic;
label skip;
var j,k:byte;
sw:word;
begin
hole:=1;
for j:=1 to 10 do
begin
sw:=320*(my div 100+j);
for k:=1 to 25 do
if (myms[j,k]>0) and (mx div 100+k<319) then
begin
if pic^[sw+mx div 100+k]>127 then
begin
check_enemy(my div 100+j,mx div 100+k,10);
missile_delay:=0;
goto skip;
end
else pic^[sw+mx div 100+k]:=myms[j,k];
end;
end;
mx:=mx+mdx;
mdx:=mdx+20;
if mx>=31800 then missile_delay:=0;
skip:
end;
procedure beri_cfg;
var ch:char;
begin
if exist('ETTV.CFG') then
begin
assign(t,'ETTV.CFG');
reset(t);
read(t,ch);if ch='Y' then music_set:=true else music_set:=false;
read(t,ch);if ch='Y' then sound_set:=true else sound_set:=false;
read(t,ch);if ch='Y' then keyboard:=true else keyboard:=false;
read(t,ch);if ch='Y' then mouse:=true else mouse:=false;
readln(t,ch);if ch='Y' then joystick:=true else joystick:=false;
readln(t,jminx);readln(t,jminy);readln(t,jmaxx);readln(t,jmaxy);
readln(t,jcx);readln(t,jcy);
close(t);
end
else
begin
music_set:=true;
sound_set:=false;
keyboard:=false;
mouse:=true;
joystick:=false;
end;
end;
procedure pisi_cfg;
var ch:char;
begin
assign(t,'ETTV.CFG');
rewrite(t);
if music_set=true then write(t,'Y') else write(t,'N');
if sound_set=true then write(t,'Y') else write(t,'N');
if keyboard=true then write(t,'Y') else write(t,'N');
if mouse=true then write(t,'Y') else write(t,'N');
if joystick=true then writeln(t,'Y') else writeln(t,'N');
writeln(t,jminx);writeln(t,jminy);writeln(t,jmaxx);writeln(t,jmaxy);
writeln(t,jcx);writeln(t,jcy);
close(t);
end;
procedure draw_page(page:byte);
begin
case page of
1:begin
options(104,118,'PLAY GAME',13,33);
options(120,144,'OPT',13,33);options(156,144,'I',13,33);options(167,144,'ONS',13,33);
options(93,170,'EX',13,33);options(117,170,'I',13,33);options(127,170,'T TO DOS',13,33);
end;
2:begin
options(112,118,'CONTROLS',13,33);
if sound_set then options(107,144,'SOUND ON',13,33)
else options(107,144,'SOUND OFF',13,33);
if music_set=true then options(106,170,'MUSIC ON',13,33)
else options(106,170,'MUSIC OFF',13,33)
end;
3:begin
if keyboard then options(85,113,'KEYBOARD ON',13,33)
else options(85,113,'KEYBOARD OFF',13,33);
if joystick then options(85,135,'JOYSTICK ON',13,33)
else options(85,135,'JOYSTICK OFF',13,33);
if mouse then options(103,157,'MOUSE ON',13,33)
else options(103,157,'MOUSE OFF',13,33);
options(103,179,'CALIBRATE',13,33);
end;
4:begin
case calibration_faze of
1:mouttextxy(55,160,'MOVE JOYSTICK TO UPPER LEFT CORNER',6,33);
2:mouttextxy(50,160,'MOVE JOYSTICK TO BOTTOM RIGHT CORNER',6,33);
3:mouttextxy(85,160,'MOVE JOYSTICK IN CENTER',6,33);
end;
mouttextxy(115,175,'AND PRESS FIRE',6,33);
end;
end;
end;
procedure chk_joystick;
var B_status1,B_status2,st:byte;
port201:byte;
begin
jx:=0;
jy:=0;
port[$201]:=255;
for i:=1 to 1000 do
begin
st:=port[$201];
if st and 1=1 then inc(jx);
if st and 2=2 then inc(jy);
end;
port201:=port[$201];
jb1:=port201 and $10;
jb2:=port201 and $20;
end;
procedure meni;
label again,again2,renew;
var sign:^screen;
x,y,i,j:integer;
gone,page,n:byte;
s:word;
st:longint;
ch:char;
finished,right_button,left_button,unpressedl,unpressedr,game:boolean;
junpressed:boolean;
begin
LoadVOC('SOUND\TOING.VOC', 0, Ram , Fire1) ;
new(sign);
read_mouse_cursor;
omejitev_miske(0,0,628,386);
set_play_variables;
load_song('LEVELS\OPEN.SNG');
renew:
setpall(127,32,32,32);
assign(t,'GFX\SIGN.PAL');
reset(t);
for i:=0 to 70 do
begin
readln(t,ch1,ch2,ch3);
setpall(i,ord(ch1),ord(ch2)+2,ord(ch3));
if i mod 5=0 then
begin
timer:=izracunaj_cas;
casovni_razpored;
end;
end;
close(t);
for i:=0 to 50 do setpall(i+128,i div 2,i div 2,0);
page:=1;
uncomprx('GFX\SIGN.cmx',64000);
move(pic^[0],sign^[0],64000);
i:=-90;
unpressedl:=true;
unpressedr:=true;
junpressed:=true;
game:=false;
gone:=0;
finished:=false;
st:=0;
calibration_faze:=1;
jb1:=1;
jb2:=1;
repeat
box:=0;
reg.ax:=3;
intr($33,reg);
nx:=reg.cx div 2;
ny:=reg.dx div 2;
if ((reg.bx and 1)=1) then
begin
left_button:=true;
if sound_set then playvoc(fire1);
end
else
begin
left_button:=false;
if not(unpressedl) then unpressedl:=true;
end;
if ((reg.bx and 2)=2) then
begin
right_button:=true;
if sound_set then playvoc(fire1);
end
else
begin
right_button:=false;
unpressedr:=true;
end;
if page=4 then
begin
chk_joystick;
if (jb1<>0) and (jb2<>0) then junpressed:=true;
end;
move(sign^[0],pic^[0],64000);
if page<3 then
begin
for x:=0 to 2 do { chk_mouse }
if (ny>=116+x*26) and (ny<=136+x*26) then box:=x+1;
if box>0 then { draw box }
for y:=0 to 20 do
for x:=68 to 240 do
pic^[320*(116+26*(box-1)+y)+x]:=15;
end;
if page=3 then
begin
for x:=0 to 3 do { chk_mouse }
if (ny>=112+x*22) and (ny<=129+x*22) then box:=x+1;
if box>0 then { draw box }
for y:=0 to 19 do
for x:=68 to 240 do
pic^[320*(111+22*(box-1)+y)+x]:=15;
end;
draw_page(page);
for x:=1 to 5 do { show_mouse }
for y:=1 to 5 do
if mouse_cursor[x,y]>0 then pic^[320*(ny+x)+nx+y]:=127;
for y:=0 to 90 do
for x:=0 to 19 do
if sign^[320*(10+y)+80+x+i+y]>5 then
pic^[320*(10+y)+80+x+i+y]:=sign^[320*(10+y)+80+x+i+y]+10-abs(8-x div 2);
if (unpressedl) and (left_button) and (gone=0) then
begin
case page of
1:begin
if box=1 then gone:=1;
if box=2 then
begin
page:=2;
unpressedl:=false;
end;
if box=3 then
begin
finished:=true;
gone:=1;
end;
end;
2:begin
if box=1 then
begin
page:=3;
unpressedl:=false;
end;
if box=3 then
begin
if music_set=true then
begin
music_set:=false;
volume:=0;
reset_card;
end
else
begin
music_set:=true;
set_play_variables;
volume:=32;
end;
unpressedl:=false;
end;
if box=2 then
begin
if sound_set=true then sound_set:=false
else sound_set:=true;
unpressedl:=false;
end;
end;
3:begin
if (box=1) and (keyboard=false) then
begin
keyboard:=true;
joystick:=false;
mouse:=false;
end;
if (box=2) and (joystick=false) then
begin
keyboard:=false;
joystick:=true;
mouse:=false;
end;
if (box=3) and (mouse=false) then
begin
keyboard:=false;
joystick:=false;
mouse:=true;
end;
if box=4 then page:=4;
end;
end;
end;
if (unpressedr) and (right_button) and (page>1) then
begin
dec(page);
unpressedr:=false;
end;
if gone>0 then
begin
for s:=0 to 63999 do if pic^[s]<70 then pic^[s]:=pic^[s] div (gone * 3 div 2 )
else if pic^[s]>128 then pic^[s]:=(pic^[s]-128) div gone + 128;
lover_volume;
if (i mod 4=0) then
begin
inc(gone);
if gone=8 then game:=true;
end;
end;
if page=4 then
if (junpressed) and ((jb1=0) or (jb2=0)) then
begin
junpressed:=false;
inc(calibration_faze);
case calibration_faze of
2:begin
jminx:=jx;
jminy:=jy;
end;
3:begin
jmaxx:=jx;
jmaxy:=jy;
end;
4:begin
jcx:=jx;
jcy:=jy;
calibration_faze:=1;
page:=3;
end;
end;
end;
if (gone=0) and (volume<32) and (i mod 4=0) then higher_volume;
if music_set then
begin
timer:=izracunaj_cas;
casovni_razpored;
end;
move(pic^[0],mem[$A000:0000],64000);
if i>=140 then i:=-120 else i:=i+2;
if page>1 then st:=0;
if st=1000 then
begin
show_hof(false);
goto renew;
end
else inc(st);
if keypressed then ch:=readkey;
until game;
if finished then
begin
pisi_cfg;
reg.ah:=0;
reg.al:=3;
intr($10,reg);
reset_card;
resetdrv;
writeln(' My address: Bostjan Grandovec');
writeln(' Sorlijeva 5');
writeln(' 4000 Kranj');
writeln(' Slovenija');
writeln(' Tel: 064/215-428 (for Slovenija)');
writeln(' E-Mail: BOSTJAN.GRANDOVEC@FOV.UNI-MB.SI');
halt(1);
end;
volume:=32;
fillchar(pic^[0],64000,0);
fillchar(mem[$A000:0000],64000,0);
dispose(sign);
freevoc(fire1);
end;
procedure get_num;
begin
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
parts[0,0,0]:=0;parts[0,0,1]:=0;
parts[0,1,0]:=0;parts[0,1,1]:=0;
parts[1,0,0]:=1;parts[1,0,1]:=1;
parts[1,1,0]:=1;parts[1,1,1]:=1;
parts[2,0,0]:=0;parts[2,0,1]:=1;
parts[2,1,0]:=1;parts[2,1,1]:=1;
parts[3,0,0]:=1;parts[3,0,1]:=1;
parts[3,1,0]:=1;parts[3,1,1]:=0;
parts[4,0,0]:=1;parts[4,0,1]:=0;
parts[4,1,0]:=1;parts[4,1,1]:=1;
parts[5,0,0]:=1;parts[5,0,1]:=1;
parts[5,1,0]:=0;parts[5,1,1]:=1;
parts[6,0,0]:=0;parts[6,0,1]:=0;
parts[6,1,0]:=1;parts[6,1,1]:=1;
parts[7,0,0]:=1;parts[7,0,1]:=0;
parts[7,1,0]:=1;parts[7,1,1]:=0;
parts[8,0,0]:=0;parts[8,0,1]:=0;
parts[8,1,0]:=1;parts[8,1,1]:=0;
parts[9,0,0]:=0;parts[9,0,1]:=0;
parts[9,1,0]:=0;parts[9,1,1]:=1;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
end;
procedure test_speed;
var timer1,timer2:longint;
u,m,s,st,mst:word;
begin
reg.ah:=0;
reg.al:=19;
intr($10,reg);
gettime(u,m,s,st);
timer1:=360000*u+6000*m+100*s+st;
mst:=0;
repeat
gettime(u,m,s,st);
timer2:=360000*u+6000*m+100*s+st;
move(pic^[0],mem[$A000:4800],54280);
inc(mst);
until timer2-timer1>200;
reg.ah:=0;
reg.al:=3;
intr($10,reg);
writeln('Speed = ',mst);
slow_down:=0;
if mst>115 then slow_down:=18-1000 div ((mst) div 2);
end;
procedure paused;
var pressed2,unpressed1,unpressed2:boolean;
begin
pressed2:=false;
unpressed1:=false;
unpressed2:=false;
repeat
if not(key[25]) and not(unpressed1) then unpressed1:=true;
if (key[25]) and (unpressed1) then pressed2:=true;
if not(key[25]) and (pressed2) then unpressed2:=true;
if (major_st>10) and not(over) and (music_set) then
begin
timer:=izracunaj_cas;
casovni_razpored;
end;
until unpressed2;
end;
begin
detect_VGA;
delay(50);
detect_sb;
delay(50);
detect_mouse;
delay(50);
new(pic);
fillchar(pic^[0],64000,0);
test_speed;
delay(500);
set_sound_pointers;
randomize;
reg.ah:=0;
reg.al:=19;
intr($10,reg);
get_num;
beri_cfg;
If StatusWord = $8000 Then sound_set:=false;
Speaker(ON);
load_cursor;
load_best_scores;
for i:=1 to 6 do name[i]:=' ';
escape:
over:=false;
reset_card;
volume:=0;
meni;
read_gfx;
make_missile;
level:=1;
load_song('LEVELS\LEVEL'+chr(level+48)+'.SNG');
fly_again:
hiscore:=best_players[1].score;
volume:=32;
score:=0;
msnum:=2;
damage:=100;
crashed:=0;
next_level:
reset_card;
case level of
1:load_song('LEVELS\LEVEL1.SNG');
2:load_song('LEVELS\LEVEL2.SNG');
3:load_song('LEVELS\LEVEL3.SNG');
end;
bonus:=0;
db:=1;
read_enemy;
initialize;
{ BARVE }
flyagain:=false;
set_low_colors;
univerzalna_paleta;
load_enemy_palette;
px:=20;
py:=100;
ox:=0;
oy:=0;
bmx:=0;
bmy:=0;
fire_delay:=0;
omejitev_miske(0,0,600,370);
set_mouse(20,100);
ch_pal_pos:=0;
enemies_timing;
stars_initialization;
show_text;
show_score;
show_hiscore;
show_damage;
show_missiles;
major_st:=0;
main_dead:=0;
number_of_the_best:=0;
init_kbd;
LoadVOC('SOUND\FIRE.VOC', 0, Ram , Fire1) ;
LoadVOC('SOUND\EXP.VOC', 0, Ram , Exp) ;
LoadVOC('SOUND\MF.VOC', 0, Ram , FM);
repeat
if key[1] then over:=true;
if (key[25]) then paused;
if keyboard then
begin
if (key[75]) and (px>1) then
if old_key[75] then px:=px-2
else px:=px-1;
if (key[77]) and (px<100) then
begin
if old_key[77] then px:=px+2
else px:=px+1;
flame;
if flame_lenght<6 then inc(flame_lenght);
end;
if not(key[77]) then flame_lenght:=0;
if (key[72]) and (py>1) then
if old_key[72] then py:=py-2
else py:=py-1;
if (key[80]) and (py<150) then
if old_key[80] then py:=py+2
else py:=py+1;
if (key[29]) and (fire_delay=0) then fire;
if not(key[29]) and (fire_delay>0) then dec(fire_delay);
if (key[56]) and (missile_delay=0) then fire_missile;
for i:=0 to 127 do old_key[i]:=key[i];
end;
if mouse then
begin
moved:=false;
reg.ax:=3;
intr($33,reg);
nx:=reg.cx;
ny:=reg.dx;
dx:=nx-ox;
dy:=ny-oy;
if (dx>0) and (px<100) then
begin
if dx>1 then px:=px+mm else inc(mx);
moved:=true;
flame;
if flame_lenght<6 then inc(flame_lenght);
end;
if (dx<-0) and (px>1) then
begin
if dx<-1 then px:=px-mm else dec(mx);
moved:=true;
end;
if (dy<-0) and (py>1) then
begin
if dy<-1 then py:=py-mm else dec(my);
moved:=true;
end;
if (dy>0) and (py<150) then
begin
if dy>1 then py:=py+mm else inc(my);
moved:=true;
end;
if moved then
begin
set_mouse(px,py);
ox:=px;
oy:=py;
end
else
begin
ox:=nx;
oy:=ny;
end;
if ((reg.bx and 1)=1) and (fire_delay=0) then fire;
if ((reg.bx and 2)=2) and (missile_delay=0) then fire_missile;
if ((reg.bx and 1)<>1) and (fire_delay>0) then dec(fire_delay);
end;
if joystick then
begin
chk_joystick;
if (jx>jcx+2) and (px<100) then
begin
if jx<(jmaxx-5) then px:=px+1
else px:=px+2;
flame;
if flame_lenght<6 then inc(flame_lenght);
end;
if (jx<jcx-2) and (px>1) then
begin
if jx>(jminx+5) then px:=px-1
else px:=px-2;
end;
if (jy<jcy+2) and (py>1) then
begin
if jy>(jminy+5) then py:=py-1
else py:=py-2;
end;
if (jy>jcy-2) and (py<150) then
begin
if jy<(jmaxy-5) then py:=py+1
else py:=py+2;
end;
if (jb1=0) and (fire_delay=0) then fire;
if (jb2=0) and (missile_delay=0) then fire_missile;
if (jb1<>0) and (fire_delay>0) then dec(fire_delay);
end;
if (major_st=ch_pal_pos) and (ch_pal_pos>0) then
begin
{ NEW PALETTE }
case level of
1:for i:=0 to 66 do setpall(i+128,enemy_palette[i,1],enemy_palette[i,2],enemy_palette[i,3]);
2:for i:=0 to 69 do setpall(i+128,enemy_palette[i,1],enemy_palette[i,2],enemy_palette[i,3]);
3:for i:=0 to 71 do setpall(i+128,enemy_palette[i,1],enemy_palette[i,2],enemy_palette[i,3]);
end;
outtextxy(172,189,'ENEMY',6,81,false,true,2);
enemy_damage(100);
end;
chk_shooting;
stars_to_pic;
enemies_to_pic;
if crashed=0 then
if (main_dead=0) or (main_dead>150) then plane_to_pic else
else if crashed=1 then
begin
reset_card;
fly_agen;
goto jump_over;
end
else
begin
dec(crashed);
if crashed mod 2 = 0 then lover_volume;
end;
explosions_to_pic;
plane_fire_to_pic;
if missile_delay=1 then missile_to_pic;
enemy_fire_to_pic;
bonus_missile_to_pic;
jump_over:
if flyagain=true then
begin
dispose_enemies;
freevoc(fire1);
freevoc(exp);
freevoc(fm);
goto fly_again;
end;
if main_dead>0 then if main_dead=1 then
begin
end_level;
volume:=32;
goto next_level;
end
else
begin
if (main_dead<150) then
begin
if (bonus=3) and (db>0) then db:=-db;
if (bonus=0) and (db<0) then db:=-db;
if main_dead mod 3=0 then bonus:=bonus+db;
spremeni_sign;
if main_dead mod 5=0 then lover_volume;
end;
dec(main_dead);
end;
{ while ((port[$3DA] and 8) > 0) do;
while ((port[$3DA] and 8) = 0) do;}
move(pic^[0],mem[$A000:4800],54280);
fillchar(pic^[0],54280,0);
{ SOUND}
if major_st=10 then set_play_variables;
if (major_st>10) and not(over) and (music_set) then
begin
timer:=izracunaj_cas;
casovni_razpored;
end;
inc(major_st);
delay(slow_down);
until over=true;
if StatusWord <> 0 then StopVoc;
freevoc(fire1);
freevoc(exp);
freevoc(fm);
goto escape;
{ reg.ah:=0;
reg.al:=3;
intr($10,reg);
reset_card;}
end.