返回
{***************************************************************}
{*** FVision Unit Version1.0 ***}
{*** 蓝蚂蚁工作室 ***}
{***************************************************************}
{*** 3D动画文件单元 ***}
{***************************************************************}
{$F+,O+,X+,S-,D-}
Unit FLics;
Interface
Uses SvgaDrv;
Implementation
Uses Dos,FTool;
const
sg=65535;
sh=32768;
Type
fileheader=record
reserved1:array [0..7] of byte;
width:word;
height:word;
reserved2:array [0..115] of byte;
end;
frameheader=record
framesize:longint;
frameidentifier:word;
chunknumber:word;
reserved: array[0..7] of byte;
end;
chunkheader=record
chunksize:longint;
chunktype:word;
end;
var
hf1:fileheader;
procedure wordsmove(sg,sc,off,w:integer);assembler;
asm
push ds
push es
mov si,sg
mov ds,si
mov di,0a000h
mov es,di
mov si,sc
mov di,off
mov cx,w
rep movsw
pop es
pop ds
end;
procedure wordsstore(pxl,off,w:integer);assembler;
asm
push es
mov ax,pxl
mov di,0a000h
mov es,di
mov di,off
mov cx,w
rep stosw
pop es
end;
{
procedure chunk4(var po;tp:word);
begin
if tp=4 then cv:=4 else cv:=1;
color:=0;
p:=po;
nb:=p;
inc(p,2);
for i:=0 to nb do
begin
jmp:=
end;
procedure chunk7(var po;sz:longint);
begin
p:=po;
y:=0;i:=0;
while (p-po<sz)and(i<n) do begin
while (word=p)<0 do begin
if (word>-16384) then dec(y,word);
inc(p,2);
end;
inc(i);
end;
inc(p,2);
x:=0;w:=0;
for j:=0 to word do
begin
inc(x,p+2*w);
inc(p);
ab:=y*bytewide+x;
pg:=ab/sg;
off:=ab mod sg;
if (pg<>pg_) then
begin
pg:=pg_;
page(pg,ng,mode);
end;
w:=abs(p);
if (p>=0) then begin
sg:=seg(p+1);
sc:=ofs(p+1);
if (off+2*w)<sg then
wordsmove(sg,sc,off,w)
else begin
rst:=off+2*w-sg;
w2:=rst/2;
w1:=w-w2;
prst:=sc+2*w-rst;
wordsmove(sg,sc,off,w1);
inc(pg);
page(pg,ng,mode);
wordsmove(sg,prst,0,w2);
end;
data:=2*w;
end else begin
px1:=p+1;
if
}
procedure runflic(st:pathstr;mode:integer);
begin
if not exist_fi(st) then exit;
assign(fp,st);
{$i-}reset(fp,1);{$i+}
blockread(fp,hfl,sizeof(filefeader),result);
if mode>=$100 then
begin
getmodeinfo(mode);
bytewide:=mi.bytesperscanline;
runwidth:=mi.xresolution;
runheight:=mi.yresolution;
ng:=mi.winsize div mi.wingranularity;
end;
fristfrm:=tell(fp);
setmode(mode);
while not keypressed do
begin
while result>0 do
begin
blockread(fp,hfr,sizeof(frameheader),result);
if result<=0 then exit;
if hfr.frameidentifier=$f100 then
begin
seek(fp,hfr.framesize-sizeof(frameheader));
blockread(fp,hfr,sizeof(frameheader),result);
end;
sz:=hfr.framesize-sizeof(frameheader)-sizeof(chunkheader);
getmem(frame,sz);
hch:=frame;
blockread(fp,frame,6,result);
chunk:=frame+6;
nr:=sz div sh;
lst:=sz mod sh;
p:=chunk;
end.