home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Party 1994: Try This At Home
/
disk_image.bin
/
source
/
gallery
/
subdirs.exe
/
MAP
/
SPATH.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-07-21
|
2KB
|
81 lines
{$N+}
type real=single;
const wallHeight = 200;
{var P : array[1..500,0..3] of real;}
var Iname, Oname : string;
I : Text;
O : Text;
lastt,t,x,y,th,lastth : real; cth : integer;
procedure WritePos( freq, time, X, Y, Th : real; cTh : integer; Eye : real; Fog : integer );
const HexD : string[16] = '0123456789abcdef';
function ToHex( w : longint; l : byte ) : string;
var s : string;
i : integer;
begin
s := '';
for i := 1 to 2*l do begin
s := HexD[ (w mod 16)+1 ] + s;
w := w div 16;
end;
ToHex := '0'+s+'h';
end;
function spos(X:real):string;
begin
spos := ToHex( round(X*$10000), 4 );
end;
function sang(X:real):string;
begin
sang := ToHex( round((X+cTH*360)/45*$100), 2 );
end;
var ed : word;
begin
ed := round(Eye*WallHeight);
if ed <= 5 then ed := 5;
if ed >195 then ed := 195;
writeln(O,' SKey <',round(TIME*freq):6,', ',spos(X),', ',spos(Y),', ',sang(Th),', ',round(ed):3,', ',Fog:3,' >');
end;
BEGIN
writeln('SPATH - script generator from TPATH output // A.R-M. 7/93');
writeln;
if paramcount<2 then begin
writeln('Usage: SPATH InputFile OutputFile');
Halt(1);
end;
Iname := ParamStr(1);
Oname := ParamStr(2);
cTH := 16;
lastth := 180;
lastt := -1;
assign(I,Iname); reset(I);
assign(O,Oname); rewrite(O);
writeln(O,'; script created from "',Iname,'"');
writeln(O);
repeat
readln(I, t,x,y,th);
if abs(th-lastth)>180 then begin
if th>lastth then cTH := cTH-1 else cTH := cTH+1;
end;
lastth := th;
if abs(lastt-t)>0.05 then WritePos( 1, t, x, y, th, cth, 0.5, 9 );
lastt := t;
until EOF(I);
WritePos( 1, t*4, x, y, th, cth, 0.5, 255 );
close(O);
close(I);
END.