home *** CD-ROM | disk | FTP | other *** search
- {
- This SimPle prOGRAM precals an analraid-precalc ..
- Used math is very basic..
- It draws only circles and tries to calculate perspective too.
- Use FPU if you have it..
- This program is NOT optimized !! ..but works..
-
- PlastiikkiPaketti / Skraappa!Skruuppi
- }
-
- {$N+}
- {$g+}
-
- uses crt;
-
- const
- mk = 1024; {how many pixels in circle}
- radiv = 4; {radius divider : how many pixels in txtmap (1024/4=256!)}
- cirx = 160; {X resolution}
- ciry = 100; {Y resolution}
- rays = 75 ; {Radius in start}
- aspcor = 0.8; {aspect ratio correction multiplier}
- radsub = 0.5; {how many pixels to jump (should be very slow)}
- persm = 0.035;{perspective multiplier (use as you like)}
- zrsub = 0.5; {radius substraction value}
- filename = 'analraid.dat'; {guess}
-
-
- type alue = array[0..ciry-1,0..cirx-1] of byte;
-
- var
- f : file;
- x,y,z : integer;
- pr,soiro,kulma,pers,xr,yr,zr : real;
- i,k,l,w : word;
- t,b,c,kb : byte;
- sb : shortint;
- cnt : longint;
- xalue : ^alue;
- yalue : ^alue;
-
- label hust; {.. if you want to stop precalccing}
-
- begin
-
- new(xalue);
- new(yalue);
-
- t:=0;
-
- asm
- mov ax,13h
- int 10h
-
- { mov dx,3c8h No need to palette, but..
- xor al,al
- out dx,al
- inc dx
- mov cx,255
- @@pal:
- mov al,cl
- neg al
- shr al,2
- out dx,al
- out dx,al
- out dx,al
- loop @@pal}
-
- end;
-
- zr:=rays;
- kulma:=mk-1;
- cnt:=0;
-
- soiro:=0;
- pers:=0;
- pr:=0;
-
- repeat
-
- xr:=zr*sin(kulma*pi/(mk/2)) - zr*cos(kulma*pi/(mk/2));
- yr:=zr*cos(kulma*pi/(mk/2)) + zr*sin(kulma*pi/(mk/2));
-
- yr:=yr * aspcor;
-
- x:=round(xr+(cirx div 2));
- y:=round(yr+(ciry div 2));
-
- kulma:=kulma-radsub;
- if kulma<0 then begin
- kulma:=kulma+mk;
- pers:=pers + pers * persm;
- zr:=zr-zrsub;
- end;
-
- if (x>=0) and (x<cirx) and (y>=0) and (y<ciry) then
- if mem[$a000:word(y*320+x)]=0 then
- begin
- if t=0 then begin pers:=1; t:=1; b:=0; end;
- kb:=round(kulma/radiv);
- xalue^[y,x]:=kb;
- yalue^[y,x]:=byte(round(pers));
- mem[$a000:word(y*320+x)]:=byte(round(pers));
- mem[$a000:word(y*320+x+160)]:=kb;
- mem[$a000:word(y*320+x+32000)]:=byte(round(pers+kb));
- end;
-
- if keypressed then goto hust;
-
- inc(cnt);
-
- until zr<0;
-
-
- hust:
-
- assign(f,filename);
- rewrite(f,1);
-
- for y:=0 to ciry-1 do
- for x:=0 to cirx-1 do
- begin
- blockwrite(f,xalue^[y,x],1);
- blockwrite(f,yalue^[y,x],1);
- end;
- close(f);
-
- asm
- mov ax,3h
- int 10h
- end;
- end.
-