Upload
This commit is contained in:
commit
43352ff262
1291 changed files with 220976 additions and 0 deletions
BIN
GRAB/FLIC/AA.CFG
Normal file
BIN
GRAB/FLIC/AA.CFG
Normal file
Binary file not shown.
BIN
GRAB/FLIC/ANIM.FCA
Normal file
BIN
GRAB/FLIC/ANIM.FCA
Normal file
Binary file not shown.
165
GRAB/FLIC/FLI.FOR
Normal file
165
GRAB/FLIC/FLI.FOR
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
Autodesk Animator files explanation (.FLI only excerpted). I believe
|
||||
that the original programmer wrote up this doc. It's correct, as I've
|
||||
used the info to realtime playback stock .FLIs on a 680x0 machine.
|
||||
All numbers in a .FLI file are in Intel format, so you may have to
|
||||
compensate for that, of course. - kevin
|
||||
|
||||
8.1 Flic Files (.FLI)
|
||||
|
||||
The details of a FLI file are moderately complex, but the
|
||||
idea behind it is simple: don't bother storing the parts of a
|
||||
frame that are the same as the last frame. Not only does this
|
||||
save space, but it's very quick. It's faster to leave a pixel
|
||||
alone than to set it.
|
||||
|
||||
A FLI file has a 128-byte header followed by a sequence of
|
||||
frames. The first frame is compressed using a bytewise run-length
|
||||
compression scheme. Subsequent frames are stored as the
|
||||
difference from the previous frame. (Occasionally the first
|
||||
frame and/or subsequent frames are uncompressed.) There is one
|
||||
extra frame at the end of a FLI which contains the difference
|
||||
between the last frame and the first frame.
|
||||
|
||||
The FLI header:
|
||||
|
||||
byte size name meaning
|
||||
offset
|
||||
|
||||
0 4 size Length of file, for programs that want
|
||||
to read the FLI all at once if possible.
|
||||
4 2 magic Set to hex AF11. Please use another
|
||||
value here if you change format (even to
|
||||
a different resolution) so Autodesk
|
||||
Animator won't crash trying to read it.
|
||||
6 2 frames Number of frames in FLI. FLI files have
|
||||
a maxium length of 4000 frames.
|
||||
8 2 width Screen width (320).
|
||||
10 2 height Screen height (200).
|
||||
12
|
||||
14 2 flags Must be 0.
|
||||
16 2 speed Number of video ticks between frames.
|
||||
18 4 next Set to 0.
|
||||
22 4 frit Set to 0.
|
||||
26 102 expand All zeroes -- for future enhancement.
|
||||
|
||||
Next are the frames, each of which has a header:
|
||||
|
||||
byte size name meaning
|
||||
offset
|
||||
0 4 size Bytes in this frame. Autodesk Animator
|
||||
demands that this be less than 64K.
|
||||
4 2 magic Always hexadecimal F1FA
|
||||
6 2 chunks Number of 'chunks' in frame.
|
||||
8 8 expand Space for future enhancements. All zeros.
|
||||
|
||||
After the frame header come the chunks that make up the
|
||||
frame. First comes a color chunk if the color map has changed
|
||||
from the last frame. Then comes a pixel chunk if the pixels have
|
||||
changed. If the frame is absolutely identical to the last frame
|
||||
there will be no chunks at all.
|
||||
|
||||
A chunk itself has a header, followed by the data. The
|
||||
chunk header is:
|
||||
|
||||
byte size name meaning
|
||||
offset
|
||||
0 4 size Bytes in this chunk.
|
||||
4 2 type Type of chunk (see below).
|
||||
|
||||
There are currently five types of chunks you'll see in a FLI
|
||||
file:
|
||||
|
||||
number name meaning
|
||||
11 FLI_COLOR Compressed color map
|
||||
12 FLI_LC Line compressed -- the most common type
|
||||
of compression for any but the first
|
||||
frame. Describes the pixel difference
|
||||
from the previous frame.
|
||||
13 FLI_BLACK Set whole screen to color 0 (only occurs
|
||||
on the first frame).
|
||||
15 FLI_BRUN Bytewise run-length compression -- first
|
||||
frame only
|
||||
16 FLI_COPY Indicates uncompressed 64000 bytes soon
|
||||
to follow. For those times when
|
||||
compression just doesn't work!
|
||||
|
||||
The compression schemes are all byte-oriented. If the
|
||||
compressed data ends up being an odd length a single pad byte is
|
||||
inserted so that the FLI_COPY's always start at an even address
|
||||
for faster DMA.
|
||||
|
||||
FLI_COLOR Chunks
|
||||
|
||||
The first word is the number of packets in this chunk. This
|
||||
is followed directly by the packets. The first byte of a packet
|
||||
says how many colors to skip. The next byte says how many colors
|
||||
to change. If this byte is zero it is interpreted to mean 256.
|
||||
Next follows 3 bytes for each color to change (one each for red,
|
||||
green and blue).
|
||||
|
||||
FLI_LC Chunks
|
||||
|
||||
This is the most common, and alas, most complex chunk. The
|
||||
first word (16 bits) is the number of lines starting from the top
|
||||
of the screen that are the same as the previous frame. (For
|
||||
example, if there is motion only on the bottom line of screen
|
||||
you'd have a 199 here.) The next word is the number of lines
|
||||
that do change. Next there is the data for the changing lines
|
||||
themselves. Each line is compressed individually; among other
|
||||
things this makes it much easier to play back the FLI at a
|
||||
reduced size.
|
||||
|
||||
The first byte of a compressed line is the number of packets
|
||||
in this line. If the line is unchanged from the last frame this
|
||||
is zero. The format of an individual packet is:
|
||||
|
||||
skip_count
|
||||
size_count
|
||||
data
|
||||
|
||||
The skip count is a single byte. If more than 255 pixels
|
||||
are to be skipped it must be broken into 2 packets. The size
|
||||
count is also a byte. If it is positive, that many bytes of data
|
||||
follow and are to be copied to the screen. If it's negative a
|
||||
single byte follows, and is repeated -skip_count times.
|
||||
|
||||
In the worst case a FLI_LC frame can be about 70K. If it
|
||||
comes out to be 60000 bytes or more Autodesk Animator decides
|
||||
compression isn't worthwhile and saves the frame as FLI_COPY.
|
||||
|
||||
FLI_BLACK Chunks
|
||||
|
||||
These are very simple. There is no data associated with
|
||||
them at all. In fact they are only generated for the first frame
|
||||
in Autodesk Animator after the user selects NEW under the FLIC menu.
|
||||
|
||||
FLI_BRUN Chunks
|
||||
|
||||
These are much like FLI_LC chunks without the skips. They
|
||||
start immediately with the data for the first line, and go line-
|
||||
by-line from there. The first byte contains the number of
|
||||
packets in that line. The format for a packet is:
|
||||
|
||||
size_count
|
||||
data
|
||||
|
||||
If size_count is positive the data consists of a single byte
|
||||
which is repeated size_count times. If size_count is negative
|
||||
there are -size_count bytes of data which are copied to the
|
||||
screen. In Autodesk Animator if the "compressed" data shows signs
|
||||
of exceeding 60000 bytes the frame is stored as FLI_COPY instead.
|
||||
|
||||
FLI_COPY Chunks
|
||||
|
||||
These are 64000 bytes of data for direct reading onto the
|
||||
screen.
|
||||
|
||||
-eof-
|
||||
|
||||
Notes: Since these are animations, the last frame will delta into a
|
||||
copy of the first one (which was usually a large BRUN chunk). Therefore,
|
||||
looping should go back to the _second_ frame chunk (usually a LC
|
||||
or COLOR chunk) instead of all the way back to the file beginning, to
|
||||
avoid a "stutter" caused by unnecessarily redecoding the original frame.
|
||||
Also, a very few files may have palette animation, so write your code
|
||||
so that COLOR chunks can be found at any time. - kevin
|
||||
1
GRAB/FLIC/KOE.BAT
Normal file
1
GRAB/FLIC/KOE.BAT
Normal file
|
|
@ -0,0 +1 @@
|
|||
vw2 d:\3ds\images\fcsten.fli
|
||||
BIN
GRAB/FLIC/PIC000.LBM
Normal file
BIN
GRAB/FLIC/PIC000.LBM
Normal file
Binary file not shown.
33
GRAB/FLIC/SHOW.C
Normal file
33
GRAB/FLIC/SHOW.C
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#include <stdio.h>
|
||||
|
||||
char far *vram=(char far *)0xa0000000L;
|
||||
|
||||
main()
|
||||
{
|
||||
unsigned int u;
|
||||
int xit=0;
|
||||
int a,b,c;
|
||||
FILE *f1;
|
||||
f1=fopen("anim.fca","rb");
|
||||
_asm mov ax,13h
|
||||
_asm int 10h
|
||||
outp(0x3c8,0);
|
||||
for(a=0;a<768;a++) outp(0x3c9,getc(f1));
|
||||
while(!kbhit() && !xit)
|
||||
{
|
||||
u=0;
|
||||
for(;;)
|
||||
{
|
||||
a=getc(f1);
|
||||
if(a==254) { xit=1; break; }
|
||||
else if(a==255) break;
|
||||
else
|
||||
{
|
||||
u+=a;
|
||||
c=getc(f1);
|
||||
while(c--) vram[u++]=getc(f1);
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(f1);
|
||||
}
|
||||
BIN
GRAB/FLIC/SHOW.EXE
Normal file
BIN
GRAB/FLIC/SHOW.EXE
Normal file
Binary file not shown.
3
GRAB/FLIC/VF
Normal file
3
GRAB/FLIC/VF
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
vf.exe : vf.c
|
||||
qcl /AL vf.c
|
||||
|
||||
369
GRAB/FLIC/VF.C
Normal file
369
GRAB/FLIC/VF.C
Normal file
|
|
@ -0,0 +1,369 @@
|
|||
#include <stdio.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
unsigned char far *vram=(char far *)0xa0000000;
|
||||
|
||||
int blocksleft=999;
|
||||
|
||||
int wid,hig,pics;
|
||||
|
||||
long cnt[256];
|
||||
char lookup[256];
|
||||
|
||||
char palette[768];
|
||||
char ownpal[768];
|
||||
|
||||
int docoltable;
|
||||
int colorlookup;
|
||||
int oktoviewpal;
|
||||
int useownpal;
|
||||
int savefcp;
|
||||
|
||||
FILE *out;
|
||||
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
int a;
|
||||
FILE *f1;
|
||||
out=fopen("fcp","wb");
|
||||
if(out==NULL) return(0);
|
||||
f1=fopen(argv[1],"rb");
|
||||
if(f1==NULL) return(0);
|
||||
_asm mov ax,19
|
||||
_asm int 10h
|
||||
|
||||
for(a=0;a<256;a++) lookup[a]=a;
|
||||
docoltable=1;
|
||||
oktoviewpal=0;
|
||||
useownpal=0;
|
||||
savefcp=0;
|
||||
rewind(f1); readflic(f1,0);
|
||||
|
||||
{
|
||||
long ol,l;
|
||||
int a;
|
||||
ol=hig*(wid+8)+10+2;
|
||||
fprintf(out,"FCP\x1a");
|
||||
putc(0x10,out);
|
||||
putc(0x01,out);
|
||||
putw(pics,out);
|
||||
for(a=0;a<pics;a++)
|
||||
{
|
||||
l=8L+pics*4L+768L+ol*a;
|
||||
putw(l&65535,out);
|
||||
putw(l>>16,out);
|
||||
}
|
||||
}
|
||||
donewpalette(256-32,31);
|
||||
for(a=0;a<768;a++)
|
||||
{
|
||||
putc(ownpal[a],out);
|
||||
}
|
||||
docoltable=0;
|
||||
oktoviewpal=1;
|
||||
useownpal=1;
|
||||
savefcp=1;
|
||||
rewind(f1); readflic(f1,0);
|
||||
|
||||
_asm mov ax,3
|
||||
_asm int 10h
|
||||
fclose(f1);
|
||||
}
|
||||
|
||||
int brightcmp(unsigned char *s1,unsigned char *s2)
|
||||
{
|
||||
int v1,v2;
|
||||
v1=*s1+*(s1+1)+*(s1+2);
|
||||
v2=*s2+*(s2+1)+*(s2+2);
|
||||
if(v1<v2) return(-1);
|
||||
else if(v1>v2) return(1);
|
||||
else return(0);
|
||||
}
|
||||
|
||||
int donewpalette(int first,int num)
|
||||
{
|
||||
int cc,c,c2,a;
|
||||
int d,rr,gg,bb;
|
||||
long ba;
|
||||
int bi,bd;
|
||||
memset(ownpal,0,768);
|
||||
for(cc=0;cc<num;cc++)
|
||||
{
|
||||
printf("done: %i/%i \r",cc,num);
|
||||
ba=bi=0;
|
||||
for(c=0;c<256;c++)
|
||||
{
|
||||
rr=palette[c*3+0];
|
||||
gg=palette[c*3+1];
|
||||
bb=palette[c*3+2];
|
||||
if(rr!=0 && gg!=0 && bb!=0 && cnt[c]>ba)
|
||||
{
|
||||
ba=cnt[c];
|
||||
bi=c;
|
||||
}
|
||||
}
|
||||
cnt[bi]=0;
|
||||
memcpy(ownpal+cc*3,palette+bi*3,3);
|
||||
}
|
||||
/* sort by brightness/move */
|
||||
qsort(ownpal,num,3,brightcmp);
|
||||
/* create lookup index */
|
||||
for(cc=0;cc<256;cc++)
|
||||
{
|
||||
bi=0; bd=32767;
|
||||
rr=palette[cc*3+0];
|
||||
gg=palette[cc*3+1];
|
||||
bb=palette[cc*3+2];
|
||||
if(rr==0 && gg==0 && bb==0) lookup[cc]=0;
|
||||
else
|
||||
{
|
||||
for(c=0;c<num;c++)
|
||||
{
|
||||
d=0;
|
||||
a=ownpal[c*3+0]-rr; if(a<0) d+=-a; else d+=a;
|
||||
a=ownpal[c*3+1]-gg; if(a<0) d+=-a; else d+=a;
|
||||
a=ownpal[c*3+2]-bb; if(a<0) d+=-a; else d+=a;
|
||||
if(d<bd)
|
||||
{
|
||||
bd=d;
|
||||
bi=c;
|
||||
}
|
||||
}
|
||||
lookup[cc]=bi+first;
|
||||
}
|
||||
}
|
||||
memmove(ownpal+first*3,ownpal,num*3);
|
||||
memset(ownpal,0,first*3);
|
||||
}
|
||||
|
||||
int readflic(FILE *f1,int flag)
|
||||
{
|
||||
int a;
|
||||
long len,l,ll;
|
||||
len=getw(f1);
|
||||
len+=(long)getw(f1)<<16;
|
||||
getw(f1);
|
||||
pics=getw(f1);
|
||||
wid=getw(f1);
|
||||
hig=getw(f1);
|
||||
fseek(f1,0x80L,SEEK_SET);
|
||||
printf("\n\n\n\n\n\n\n\n\n\n\n");
|
||||
for(;;)
|
||||
{
|
||||
l=ftell(f1);
|
||||
l+=(long)getw(f1);
|
||||
l+=(long)getw(f1)<<16;
|
||||
a=getw(f1);
|
||||
if(feof(f1)) break;
|
||||
if(a==0xf1fa)
|
||||
{
|
||||
int a;
|
||||
blocksleft=getw(f1);
|
||||
for(a=0;a<8;a++) getc(f1);
|
||||
ll=l;
|
||||
}
|
||||
else
|
||||
{
|
||||
doblock(f1,(unsigned)a);
|
||||
fseek(f1,l,SEEK_SET);
|
||||
blocksleft--;
|
||||
if(blocksleft==0)
|
||||
{
|
||||
fseek(f1,ll,SEEK_SET);
|
||||
{
|
||||
int x,y;
|
||||
unsigned u;
|
||||
for(y=0;y<hig;y++)
|
||||
{
|
||||
u=y*320;
|
||||
for(x=0;x<wid;x++) cnt[vram[u++]]++;
|
||||
}
|
||||
}
|
||||
if(savefcp)
|
||||
{
|
||||
static int framecnt=0;
|
||||
int x,y;
|
||||
printf("Frame:%i\r",framecnt++);
|
||||
/* save fcp */
|
||||
putc(0x10,out);
|
||||
putc(0x0f,out);
|
||||
putw(0,out);
|
||||
putw(0,out);
|
||||
putw(wid-1,out);
|
||||
putw(hig-1,out);
|
||||
for(y=0;y<hig;y++)
|
||||
{
|
||||
putw(y,out);
|
||||
putw(0,out);
|
||||
putw(1,out);
|
||||
putw(wid,out);
|
||||
for(x=0;x<wid;x++) putc(vram[y*320+x],out);
|
||||
}
|
||||
putw(32768,out);
|
||||
}
|
||||
if(flag&1) getch();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int viewpal(void)
|
||||
{
|
||||
int a;
|
||||
unsigned u;
|
||||
for(a=0;a<256;a++)
|
||||
{
|
||||
u=(a>>4)*3+320-48+((a&15)*3+200-48)*320;
|
||||
vram[u]=a;
|
||||
vram[u+1]=a;
|
||||
vram[u+2]=a;
|
||||
vram[320+u]=a;
|
||||
vram[320+u+1]=a;
|
||||
vram[320+u+2]=a;
|
||||
vram[640+u]=a;
|
||||
vram[640+u+1]=a;
|
||||
vram[640+u+2]=a;
|
||||
}
|
||||
}
|
||||
|
||||
int doblock(FILE *f1,unsigned type)
|
||||
{
|
||||
if((type==0x000b || type==0x0004) && useownpal)
|
||||
{
|
||||
int a;
|
||||
outp(0x3c8,0);
|
||||
for(a=0;a<768;a++) outp(0x3c9,ownpal[a]);
|
||||
if(oktoviewpal) viewpal();
|
||||
return(0);
|
||||
}
|
||||
if(type==0x000b)
|
||||
{
|
||||
int a,c,d;
|
||||
c=getc(f1)*256; /* count */
|
||||
c+=getc(f1);
|
||||
c*=3;
|
||||
a=getc(f1)*256; /* first */
|
||||
a+=getc(f1);
|
||||
outp(0x3c8,a);
|
||||
for(a=0;a<c;a++) outp(0x3c9,palette[a]=getc(f1));
|
||||
if(oktoviewpal) viewpal();
|
||||
}
|
||||
else if(type==0x0004)
|
||||
{
|
||||
int a,c,d;
|
||||
c=getc(f1)*256; /* count */
|
||||
c+=getc(f1);
|
||||
c*=3;
|
||||
a=getc(f1)*256; /* first */
|
||||
a+=getc(f1);
|
||||
outp(0x3c8,a);
|
||||
for(a=0;a<c;a++) outp(0x3c9,palette[a]=(getc(f1)>>2));
|
||||
if(oktoviewpal) viewpal();
|
||||
}
|
||||
else if(type==0x000c)
|
||||
{
|
||||
int a,b,c,lc,cc,cm,lb,le,lad;
|
||||
long l;
|
||||
unsigned int u;
|
||||
lb=getw(f1);
|
||||
le=lb+getw(f1);
|
||||
for(lc=lb;lc<le;lc++)
|
||||
{
|
||||
cm=getc(f1);
|
||||
u=lc*320;
|
||||
for(cc=0;cc<cm && u<64000;cc++)
|
||||
{
|
||||
a=getc(f1);
|
||||
u+=a;
|
||||
a=getc(f1);
|
||||
if(a<0x80)
|
||||
{
|
||||
for(c=0;c<a;c++) vram[u++]=lookup[getc(f1)];
|
||||
}
|
||||
else
|
||||
{
|
||||
a=256-a;
|
||||
b=lookup[getc(f1)];
|
||||
for(c=0;c<a;c++) vram[u++]=b;
|
||||
}
|
||||
}
|
||||
}
|
||||
u=0;
|
||||
}
|
||||
else if(type==0x0007)
|
||||
{
|
||||
int a,b,b1,b2,c,lc,cc,cm,lb,le,lad;
|
||||
int skipcnt;
|
||||
long l;
|
||||
unsigned int u;
|
||||
le=getw(f1);
|
||||
for(lc=lad=0;lc<le;lc++)
|
||||
{
|
||||
cm=getw(f1);
|
||||
while(cm<0)
|
||||
{
|
||||
lad=320*-cm;
|
||||
cm=getw(f1);
|
||||
}
|
||||
u=lc*320+lad;
|
||||
for(cc=0;cc<cm && u<64000;cc++)
|
||||
{
|
||||
a=getc(f1);
|
||||
u+=a;
|
||||
a=getc(f1);
|
||||
if(a<0x80)
|
||||
{
|
||||
for(c=0;c<a;c++)
|
||||
{
|
||||
vram[u++]=lookup[getc(f1)];
|
||||
vram[u++]=lookup[getc(f1)];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
a=256-a;
|
||||
b1=lookup[getc(f1)];
|
||||
b2=lookup[getc(f1)];
|
||||
for(c=0;c<a;c++)
|
||||
{
|
||||
vram[u++]=b1;
|
||||
vram[u++]=b2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
u=0;
|
||||
}
|
||||
else if(type==0x000f)
|
||||
{
|
||||
int a,b,c,lc,cc,cm;
|
||||
long l;
|
||||
unsigned int u;
|
||||
for(lc=0;lc<hig;lc++)
|
||||
{
|
||||
u=lc*320;
|
||||
cm=getc(f1);
|
||||
for(cc=0;cc<cm && u<64000;cc++)
|
||||
{
|
||||
a=getc(f1);
|
||||
if(a<0x80)
|
||||
{
|
||||
b=lookup[getc(f1)];
|
||||
for(c=0;c<a;c++) vram[u++]=b;
|
||||
}
|
||||
else
|
||||
{
|
||||
a=256-a;
|
||||
for(c=0;c<a;c++) vram[u++]=lookup[getc(f1)];
|
||||
}
|
||||
}
|
||||
}
|
||||
u=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("UNKNOWN BLOCK TYPE: %04X\n",type);
|
||||
getch();
|
||||
}
|
||||
}
|
||||
BIN
GRAB/FLIC/VF.EXE
Normal file
BIN
GRAB/FLIC/VF.EXE
Normal file
Binary file not shown.
339
GRAB/FLIC/VFLI.C
Normal file
339
GRAB/FLIC/VFLI.C
Normal file
|
|
@ -0,0 +1,339 @@
|
|||
#include <stdio.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
unsigned char far *vram=(char far *)0xa0000000;
|
||||
|
||||
int blocksleft=999;
|
||||
|
||||
int wid,hig,pics;
|
||||
|
||||
long cnt[256];
|
||||
char lookup[256];
|
||||
|
||||
char palette[768];
|
||||
char ownpal[768];
|
||||
|
||||
int docoltable;
|
||||
int colorlookup;
|
||||
int oktoviewpal;
|
||||
int useownpal;
|
||||
int savefcp;
|
||||
|
||||
FILE *out;
|
||||
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
int a;
|
||||
FILE *f1;
|
||||
f1=fopen(argv[1],"rb");
|
||||
if(f1==NULL) return(0);
|
||||
_asm mov ax,19
|
||||
_asm int 10h
|
||||
|
||||
for(a=0;a<256;a++) lookup[a]=a;
|
||||
|
||||
docoltable=1;
|
||||
oktoviewpal=0;
|
||||
useownpal=0;
|
||||
savefcp=0;
|
||||
rewind(f1); readflic(f1,0);
|
||||
|
||||
donewpalette(256-32,31);
|
||||
docoltable=0;
|
||||
oktoviewpal=1;
|
||||
useownpal=1;
|
||||
savefcp=1;
|
||||
rewind(f1); readflic(f1,0);
|
||||
|
||||
_asm mov ax,3
|
||||
_asm int 10h
|
||||
fclose(f1);
|
||||
}
|
||||
|
||||
int brightcmp(unsigned char *s1,unsigned char *s2)
|
||||
{
|
||||
int v1,v2;
|
||||
v1=*s1+*(s1+1)+*(s1+2);
|
||||
v2=*s2+*(s2+1)+*(s2+2);
|
||||
if(v1<v2) return(-1);
|
||||
else if(v1>v2) return(1);
|
||||
else return(0);
|
||||
}
|
||||
|
||||
int donewpalette(int first,int num)
|
||||
{
|
||||
int cc,c,c2,a;
|
||||
int d,rr,gg,bb;
|
||||
long ba;
|
||||
int bi,bd;
|
||||
memset(ownpal,0,768);
|
||||
for(cc=0;cc<num;cc++)
|
||||
{
|
||||
/*printf("done: %i/%i \r",cc,num);*/
|
||||
ba=bi=0;
|
||||
for(c=0;c<256;c++)
|
||||
{
|
||||
rr=palette[c*3+0];
|
||||
gg=palette[c*3+1];
|
||||
bb=palette[c*3+2];
|
||||
if(rr!=0 && gg!=0 && bb!=0 && cnt[c]>ba)
|
||||
{
|
||||
ba=cnt[c];
|
||||
bi=c;
|
||||
}
|
||||
}
|
||||
cnt[bi]=0;
|
||||
memcpy(ownpal+cc*3,palette+bi*3,3);
|
||||
}
|
||||
/* sort by brightness/move */
|
||||
qsort(ownpal,num,3,brightcmp);
|
||||
/* create lookup index */
|
||||
for(cc=0;cc<256;cc++)
|
||||
{
|
||||
bi=0; bd=32767;
|
||||
rr=palette[cc*3+0];
|
||||
gg=palette[cc*3+1];
|
||||
bb=palette[cc*3+2];
|
||||
if(rr==0 && gg==0 && bb==0) lookup[cc]=0;
|
||||
else
|
||||
{
|
||||
for(c=0;c<num;c++)
|
||||
{
|
||||
d=0;
|
||||
a=ownpal[c*3+0]-rr; if(a<0) d+=-a; else d+=a;
|
||||
a=ownpal[c*3+1]-gg; if(a<0) d+=-a; else d+=a;
|
||||
a=ownpal[c*3+2]-bb; if(a<0) d+=-a; else d+=a;
|
||||
if(d<bd)
|
||||
{
|
||||
bd=d;
|
||||
bi=c;
|
||||
}
|
||||
}
|
||||
lookup[cc]=bi+first;
|
||||
}
|
||||
}
|
||||
memmove(ownpal+first*3,ownpal,num*3);
|
||||
memset(ownpal,0,first*3);
|
||||
}
|
||||
|
||||
int readflic(FILE *f1,int flag)
|
||||
{
|
||||
int a;
|
||||
long len,l,ll;
|
||||
len=getw(f1);
|
||||
len+=(long)getw(f1)<<16;
|
||||
getw(f1);
|
||||
pics=getw(f1);
|
||||
wid=getw(f1);
|
||||
hig=getw(f1);
|
||||
fseek(f1,0x80L,SEEK_SET);
|
||||
/*printf("\n\n\n\n\n\n\n\n\n\n\n");*/
|
||||
for(;;)
|
||||
{
|
||||
l=ftell(f1);
|
||||
l+=(long)getw(f1);
|
||||
l+=(long)getw(f1)<<16;
|
||||
a=getw(f1);
|
||||
if(feof(f1)) break;
|
||||
if(a==0xf1fa)
|
||||
{
|
||||
int a;
|
||||
blocksleft=getw(f1);
|
||||
for(a=0;a<8;a++) getc(f1);
|
||||
ll=l;
|
||||
}
|
||||
else
|
||||
{
|
||||
doblock(f1,(unsigned)a);
|
||||
fseek(f1,l,SEEK_SET);
|
||||
blocksleft--;
|
||||
if(blocksleft==0)
|
||||
{
|
||||
fseek(f1,ll,SEEK_SET);
|
||||
{
|
||||
int x,y;
|
||||
unsigned u;
|
||||
for(y=0;y<hig;y++)
|
||||
{
|
||||
u=y*320;
|
||||
for(x=0;x<wid;x++) cnt[vram[u++]]++;
|
||||
}
|
||||
}
|
||||
if(savefcp)
|
||||
{
|
||||
static int framecnt=0;
|
||||
int x,y;
|
||||
{
|
||||
outp(0x3c8,7);
|
||||
outp(0x3c9,47);
|
||||
outp(0x3c9,47);
|
||||
outp(0x3c9,47);
|
||||
printf("Saveframe:%i\r",framecnt++);
|
||||
}
|
||||
}
|
||||
if(flag&1) getch();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int viewpal(void)
|
||||
{
|
||||
int a;
|
||||
unsigned u;
|
||||
for(a=0;a<256;a++)
|
||||
{
|
||||
u=(a>>4)*3+320-48+((a&15)*3+200-48)*320;
|
||||
vram[u]=a;
|
||||
vram[u+1]=a;
|
||||
vram[u+2]=a;
|
||||
vram[320+u]=a;
|
||||
vram[320+u+1]=a;
|
||||
vram[320+u+2]=a;
|
||||
vram[640+u]=a;
|
||||
vram[640+u+1]=a;
|
||||
vram[640+u+2]=a;
|
||||
}
|
||||
}
|
||||
|
||||
int doblock(FILE *f1,unsigned type)
|
||||
{
|
||||
if((type==0x000b || type==0x0004) && useownpal)
|
||||
{
|
||||
int a;
|
||||
outp(0x3c8,0);
|
||||
for(a=0;a<768;a++) outp(0x3c9,ownpal[a]);
|
||||
if(oktoviewpal) viewpal();
|
||||
return(0);
|
||||
}
|
||||
if(type==0x000b)
|
||||
{
|
||||
int a,c,d;
|
||||
c=getc(f1)*256; /* count */
|
||||
c+=getc(f1);
|
||||
c*=3;
|
||||
a=getc(f1)*256; /* first */
|
||||
a+=getc(f1);
|
||||
outp(0x3c8,a);
|
||||
for(a=0;a<c;a++) outp(0x3c9,palette[a]=getc(f1));
|
||||
if(oktoviewpal) viewpal();
|
||||
}
|
||||
else if(type==0x0004)
|
||||
{
|
||||
int a,c,d;
|
||||
c=getc(f1)*256; /* count */
|
||||
c+=getc(f1);
|
||||
c*=3;
|
||||
a=getc(f1)*256; /* first */
|
||||
a+=getc(f1);
|
||||
outp(0x3c8,a);
|
||||
for(a=0;a<c;a++) outp(0x3c9,palette[a]=(getc(f1)>>2));
|
||||
if(oktoviewpal) viewpal();
|
||||
}
|
||||
else if(type==0x000c)
|
||||
{
|
||||
int a,b,c,lc,cc,cm,lb,le,lad;
|
||||
long l;
|
||||
unsigned int u;
|
||||
lb=getw(f1);
|
||||
le=lb+getw(f1);
|
||||
for(lc=lb;lc<le;lc++)
|
||||
{
|
||||
cm=getc(f1);
|
||||
u=lc*320;
|
||||
for(cc=0;cc<cm && u<64000;cc++)
|
||||
{
|
||||
a=getc(f1);
|
||||
u+=a;
|
||||
a=getc(f1);
|
||||
if(a<0x80)
|
||||
{
|
||||
for(c=0;c<a;c++) vram[u++]=lookup[getc(f1)];
|
||||
}
|
||||
else
|
||||
{
|
||||
a=256-a;
|
||||
b=lookup[getc(f1)];
|
||||
for(c=0;c<a;c++) vram[u++]=b;
|
||||
}
|
||||
}
|
||||
}
|
||||
u=0;
|
||||
}
|
||||
else if(type==0x0007)
|
||||
{
|
||||
int a,b,b1,b2,c,lc,cc,cm,lb,le,lad;
|
||||
int skipcnt;
|
||||
long l;
|
||||
unsigned int u;
|
||||
le=getw(f1);
|
||||
for(lc=lad=0;lc<le;lc++)
|
||||
{
|
||||
cm=getw(f1);
|
||||
while(cm<0)
|
||||
{
|
||||
lad=320*-cm;
|
||||
cm=getw(f1);
|
||||
}
|
||||
u=lc*320+lad;
|
||||
for(cc=0;cc<cm && u<64000;cc++)
|
||||
{
|
||||
a=getc(f1);
|
||||
u+=a;
|
||||
a=getc(f1);
|
||||
if(a<0x80)
|
||||
{
|
||||
for(c=0;c<a;c++)
|
||||
{
|
||||
vram[u++]=lookup[getc(f1)];
|
||||
vram[u++]=lookup[getc(f1)];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
a=256-a;
|
||||
b1=lookup[getc(f1)];
|
||||
b2=lookup[getc(f1)];
|
||||
for(c=0;c<a;c++)
|
||||
{
|
||||
vram[u++]=b1;
|
||||
vram[u++]=b2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
u=0;
|
||||
}
|
||||
else if(type==0x000f)
|
||||
{
|
||||
int a,b,c,lc,cc,cm;
|
||||
long l;
|
||||
unsigned int u;
|
||||
for(lc=0;lc<hig;lc++)
|
||||
{
|
||||
u=lc*320;
|
||||
cm=getc(f1);
|
||||
for(cc=0;cc<cm && u<64000;cc++)
|
||||
{
|
||||
a=getc(f1);
|
||||
if(a<0x80)
|
||||
{
|
||||
b=lookup[getc(f1)];
|
||||
for(c=0;c<a;c++) vram[u++]=b;
|
||||
}
|
||||
else
|
||||
{
|
||||
a=256-a;
|
||||
for(c=0;c<a;c++) vram[u++]=lookup[getc(f1)];
|
||||
}
|
||||
}
|
||||
}
|
||||
u=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("UNKNOWN BLOCK TYPE: %04X\n",type);
|
||||
getch();
|
||||
}
|
||||
}
|
||||
BIN
GRAB/FLIC/VFLI.EXE
Normal file
BIN
GRAB/FLIC/VFLI.EXE
Normal file
Binary file not shown.
221
GRAB/FLIC/VFOK.C
Normal file
221
GRAB/FLIC/VFOK.C
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
#include <stdio.h>
|
||||
|
||||
char far *vram=(char far *)0xa0000000;
|
||||
|
||||
int blocksleft=999;
|
||||
|
||||
int wid,hig,pics;
|
||||
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
FILE *f1;
|
||||
int a;
|
||||
long len,l,ll;
|
||||
f1=fopen(argv[1],"rb");
|
||||
if(f1==NULL) return(0);
|
||||
_asm mov ax,19
|
||||
_asm int 10h
|
||||
len=getw(f1);
|
||||
len+=(long)getw(f1)<<16;
|
||||
getw(f1);
|
||||
pics=getw(f1);
|
||||
wid=getw(f1);
|
||||
hig=getw(f1);
|
||||
fseek(f1,0x80L,SEEK_SET);
|
||||
printf("\n\n\n\n\n\n\n\n\n\n\n");
|
||||
for(;;)
|
||||
{
|
||||
l=ftell(f1);
|
||||
l+=(long)getw(f1);
|
||||
l+=(long)getw(f1)<<16;
|
||||
a=getw(f1);
|
||||
if(feof(f1)) break;
|
||||
if(a==0xf1fa)
|
||||
{
|
||||
int a;
|
||||
blocksleft=getw(f1);
|
||||
for(a=0;a<8;a++) getc(f1);
|
||||
ll=l;
|
||||
}
|
||||
else
|
||||
{
|
||||
doblock(f1,(unsigned)a);
|
||||
fseek(f1,l,SEEK_SET);
|
||||
blocksleft--;
|
||||
if(blocksleft==0)
|
||||
{
|
||||
fseek(f1,ll,SEEK_SET);
|
||||
getch();
|
||||
}
|
||||
}
|
||||
}
|
||||
_asm mov ax,3
|
||||
_asm int 10h
|
||||
fclose(f1);
|
||||
}
|
||||
|
||||
int viewpal(void)
|
||||
{
|
||||
int a;
|
||||
unsigned u;
|
||||
for(a=0;a<256;a++)
|
||||
{
|
||||
u=(a>>4)*3+320-48+((a&15)*3+200-48)*320;
|
||||
vram[u]=a;
|
||||
vram[u+1]=a;
|
||||
vram[u+2]=a;
|
||||
vram[320+u]=a;
|
||||
vram[320+u+1]=a;
|
||||
vram[320+u+2]=a;
|
||||
vram[640+u]=a;
|
||||
vram[640+u+1]=a;
|
||||
vram[640+u+2]=a;
|
||||
}
|
||||
}
|
||||
|
||||
int doblock(FILE *f1,unsigned type)
|
||||
{
|
||||
if(type==0x000b)
|
||||
{
|
||||
int a,c,d;
|
||||
c=getc(f1)*256; /* count */
|
||||
c+=getc(f1);
|
||||
c*=3;
|
||||
a=getc(f1)*256; /* first */
|
||||
a+=getc(f1);
|
||||
outp(0x3c8,a);
|
||||
for(a=0;a<c;a++) outp(0x3c9,getc(f1));
|
||||
viewpal();
|
||||
}
|
||||
else if(type==0x0004)
|
||||
{
|
||||
int a,c,d;
|
||||
c=getc(f1)*256; /* count */
|
||||
c+=getc(f1);
|
||||
c*=3;
|
||||
a=getc(f1)*256; /* first */
|
||||
a+=getc(f1);
|
||||
outp(0x3c8,a);
|
||||
for(a=0;a<c;a++) outp(0x3c9,getc(f1)>>2);
|
||||
viewpal();
|
||||
}
|
||||
else if(type==0x000c)
|
||||
{
|
||||
int a,b,c,lc,cc,cm,lb,le,lad;
|
||||
long l;
|
||||
unsigned int u;
|
||||
lb=getw(f1);
|
||||
le=lb+getw(f1);
|
||||
for(lc=lb;lc<le;lc++)
|
||||
{
|
||||
cm=getc(f1);
|
||||
u=lc*320;
|
||||
for(cc=0;cc<cm && u<64000;cc++)
|
||||
{
|
||||
a=getc(f1);
|
||||
u+=a;
|
||||
a=getc(f1);
|
||||
if(a<0x80)
|
||||
{
|
||||
for(c=0;c<a;c++) vram[u++]=getc(f1);
|
||||
}
|
||||
else
|
||||
{
|
||||
a=256-a;
|
||||
b=getc(f1);
|
||||
for(c=0;c<a;c++) vram[u++]=b;
|
||||
}
|
||||
}
|
||||
if(u>64000 || kbhit()) break;
|
||||
}
|
||||
u=0;
|
||||
}
|
||||
else if(type==0x0007)
|
||||
{
|
||||
int a,b,b1,b2,c,lc,cc,cm,lb,le,lad;
|
||||
int skipcnt,flag=0;
|
||||
long l;
|
||||
unsigned int u;
|
||||
le=getw(f1);
|
||||
for(lc=lad=0;lc<le;lc++)
|
||||
{
|
||||
cm=getw(f1);
|
||||
while(cm<0)
|
||||
{
|
||||
lad=320*-cm;
|
||||
cm=getw(f1);
|
||||
}
|
||||
u=lc*320+lad;
|
||||
for(cc=0;cc<cm && u<64000;cc++)
|
||||
{
|
||||
a=getc(f1);
|
||||
u+=a;
|
||||
a=getc(f1);
|
||||
if(a<0x80)
|
||||
{
|
||||
for(c=0;c<a;c++)
|
||||
{
|
||||
vram[u++]=getc(f1);
|
||||
vram[u++]=getc(f1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
a=256-a;
|
||||
b1=getc(f1);
|
||||
b2=getc(f1);
|
||||
for(c=0;c<a;c++)
|
||||
{
|
||||
vram[u++]=b1;
|
||||
vram[u++]=b2;
|
||||
}
|
||||
}
|
||||
if(flag) getch();
|
||||
}
|
||||
if(u>64000 || kbhit()) break;
|
||||
}
|
||||
u=0;
|
||||
}
|
||||
else if(type==0x000f)
|
||||
{
|
||||
int a,b,c,lc,cc,cm;
|
||||
long l;
|
||||
unsigned int u;
|
||||
for(lc=0;lc<hig;lc++)
|
||||
{
|
||||
u=lc*320;
|
||||
cm=getc(f1);
|
||||
for(cc=0;cc<cm && u<64000;cc++)
|
||||
{
|
||||
a=getc(f1);
|
||||
if(a<0x80)
|
||||
{
|
||||
b=getc(f1);
|
||||
for(c=0;c<a;c++) vram[u++]=b;
|
||||
}
|
||||
else
|
||||
{
|
||||
a=256-a;
|
||||
for(c=0;c<a;c++) vram[u++]=getc(f1);
|
||||
}
|
||||
}
|
||||
if(u>64000 || kbhit()) break;
|
||||
}
|
||||
u=0;
|
||||
/*for(a=0;a<200;a+=2)
|
||||
{
|
||||
vram[a*320]=15;
|
||||
vram[a*320+321]=14;
|
||||
}
|
||||
for(a=0;a<320;a+=2)
|
||||
{
|
||||
vram[a]=15;
|
||||
vram[a+201]=14;
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("UNKNOWN BLOCK TYPE: %04X\n",type);
|
||||
getch();
|
||||
}
|
||||
}
|
||||
233
GRAB/FLIC/VW.C
Normal file
233
GRAB/FLIC/VW.C
Normal file
|
|
@ -0,0 +1,233 @@
|
|||
/* view flic */
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
|
||||
int doframe(FILE *f1);
|
||||
int dochunk(FILE *f1);
|
||||
int doline1(unsigned u,FILE *f1);
|
||||
int doline2(unsigned u,FILE *f1);
|
||||
int saveframe(int frame);
|
||||
|
||||
char far *vram=(char far *)0xa0000000L;
|
||||
|
||||
char buf[64000];
|
||||
char pal[768];
|
||||
char savebuf[64000];
|
||||
|
||||
int lw;
|
||||
|
||||
struct
|
||||
{
|
||||
long filesize;
|
||||
unsigned magic; /* 0xaf11 */
|
||||
int frames;
|
||||
int width;
|
||||
int heigth;
|
||||
int RESERVED1;
|
||||
int flags; /*0*/
|
||||
int speed;
|
||||
long next; /*0*/
|
||||
long frit; /*0*/
|
||||
char RESERVED2[102];
|
||||
} header;
|
||||
|
||||
struct
|
||||
{
|
||||
long size;
|
||||
unsigned magic; /* 0xf1fa */
|
||||
int chunks;
|
||||
int RESERVED[4];
|
||||
} frameheader;
|
||||
|
||||
struct
|
||||
{
|
||||
long size;
|
||||
unsigned type;
|
||||
} chunkheader;
|
||||
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
FILE *f1;
|
||||
int f;
|
||||
f1=fopen(argv[1],"rb");
|
||||
if(f1==NULL) return(0);
|
||||
fread(&header,sizeof(header),1,f1);
|
||||
lw=header.heigth;
|
||||
/**/
|
||||
_asm mov ax,13h
|
||||
_asm int 10h
|
||||
saveframe(-1);
|
||||
for(f=0;f<header.frames;f++)
|
||||
{
|
||||
doframe(f1);
|
||||
saveframe(f);
|
||||
}
|
||||
saveframe(-2);
|
||||
/**/
|
||||
fclose(f1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
int doframe(FILE *f1)
|
||||
{
|
||||
int c;
|
||||
long framestart;
|
||||
framestart=ftell(f1);
|
||||
fread(&frameheader,sizeof(frameheader),1,f1);
|
||||
for(c=0;c<frameheader.chunks;c++) dochunk(f1);
|
||||
fseek(f1,framestart+frameheader.size,SEEK_SET);
|
||||
return(0);
|
||||
}
|
||||
|
||||
int dochunk(FILE *f1)
|
||||
{
|
||||
unsigned u;
|
||||
int a,b,c;
|
||||
long chunkstart;
|
||||
chunkstart=ftell(f1);
|
||||
fread(&chunkheader,sizeof(chunkheader),1,f1);
|
||||
switch(chunkheader.type)
|
||||
{
|
||||
case 11 : /* FLI_COLOR */
|
||||
c=getw(f1);
|
||||
a=0;
|
||||
while(c--)
|
||||
{
|
||||
a+=getc(f1);
|
||||
b=getc(f1); if(!b) b=256;
|
||||
outp(0x3c8,a);
|
||||
while(b--)
|
||||
{
|
||||
outp(0x3c9,getc(f1));
|
||||
outp(0x3c9,getc(f1));
|
||||
outp(0x3c9,getc(f1));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 12 : /* FLI_LC */
|
||||
u=getw(f1)*lw;
|
||||
c=getw(f1);
|
||||
while(c--)
|
||||
{
|
||||
doline1(u,f1);
|
||||
u+=lw;
|
||||
}
|
||||
break;
|
||||
case 13 : /* FLI_BLACK */
|
||||
memset(vram,0,64000U);
|
||||
break;
|
||||
case 15 : /* FLI_BRUN */
|
||||
u=0;
|
||||
c=200;
|
||||
while(c--)
|
||||
{
|
||||
doline2(u,f1);
|
||||
u+=lw;
|
||||
}
|
||||
break;
|
||||
case 16 : /* FLI_COPY */
|
||||
fread(buf,1,64000U,f1);
|
||||
memcpy(vram,buf,64000U);
|
||||
break;
|
||||
}
|
||||
fseek(f1,chunkstart+chunkheader.size,SEEK_SET);
|
||||
return(0);
|
||||
}
|
||||
|
||||
int doline1(unsigned u,FILE *f1)
|
||||
{
|
||||
int a,b,c;
|
||||
c=getc(f1);
|
||||
while(c--)
|
||||
{
|
||||
u+=getc(f1);
|
||||
b=(char)getc(f1);
|
||||
if(b>0)
|
||||
{
|
||||
while(b--) vram[u++]=(char)getc(f1);
|
||||
}
|
||||
else
|
||||
{
|
||||
a=getc(f1);
|
||||
while(b++) vram[u++]=(char)a;
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
int doline2(unsigned u,FILE *f1)
|
||||
{
|
||||
int a,b,c;
|
||||
c=getc(f1);
|
||||
while(c--)
|
||||
{
|
||||
b=(char)getc(f1);
|
||||
if(b<0)
|
||||
{
|
||||
while(b++) vram[u++]=(char)getc(f1);
|
||||
}
|
||||
else
|
||||
{
|
||||
a=getc(f1);
|
||||
while(b--) vram[u++]=(char)a;
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
int saveframe(int frame)
|
||||
{
|
||||
unsigned u,u0,ua;
|
||||
int a,b,c;
|
||||
static FILE *fo;
|
||||
switch(frame)
|
||||
{
|
||||
case -1 : /* open */
|
||||
fo=fopen("anim.fca","wb");
|
||||
break;
|
||||
case -2 : /* close */
|
||||
putc(254,fo);
|
||||
fclose(fo);
|
||||
break;
|
||||
default : /* save */
|
||||
if(frame==0)
|
||||
{
|
||||
outp(0x3c7,0);
|
||||
for(a=0;a<768;a++) pal[a]=(char)inp(0x3c9);
|
||||
memset(savebuf,0,64000U);
|
||||
fwrite(pal,1,768U,fo);
|
||||
}
|
||||
{
|
||||
for(u0=u=0;u<64000;u++)
|
||||
{
|
||||
if(vram[u]!=savebuf[u])
|
||||
{
|
||||
ua=u-u0;
|
||||
while(ua>253)
|
||||
{
|
||||
putc(253,fo);
|
||||
putc(0,fo);
|
||||
ua-=253;
|
||||
}
|
||||
putc(ua,fo);
|
||||
for(a=0;a<255 && (unsigned)a+u<64000;a++)
|
||||
{
|
||||
if(vram[u+a]==savebuf[u+a]) break;
|
||||
}
|
||||
putc(a,fo);
|
||||
for(b=0;b<a;b++)
|
||||
{
|
||||
putc(savebuf[u+b]=vram[u+b],fo);
|
||||
}
|
||||
u+=a;
|
||||
u0=u;
|
||||
}
|
||||
}
|
||||
putc(255,fo);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
216
GRAB/FLIC/VW2.C
Normal file
216
GRAB/FLIC/VW2.C
Normal file
|
|
@ -0,0 +1,216 @@
|
|||
/* view flic */
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
|
||||
int doframe(FILE *f1);
|
||||
int dochunk(FILE *f1);
|
||||
int doline1(unsigned u,FILE *f1);
|
||||
int doline2(unsigned u,FILE *f1);
|
||||
int saveframe(int frame);
|
||||
|
||||
char far *vram=(char far *)0xa0000000L;
|
||||
|
||||
char buf[64000];
|
||||
char pal[768];
|
||||
char savebuf[64000];
|
||||
|
||||
int lw;
|
||||
|
||||
struct
|
||||
{
|
||||
long filesize;
|
||||
unsigned magic; /* 0xaf11 */
|
||||
int frames;
|
||||
int width;
|
||||
int heigth;
|
||||
int RESERVED1;
|
||||
int flags; /*0*/
|
||||
int speed;
|
||||
long next; /*0*/
|
||||
long frit; /*0*/
|
||||
char RESERVED2[102];
|
||||
} header;
|
||||
|
||||
struct
|
||||
{
|
||||
long size;
|
||||
unsigned magic; /* 0xf1fa */
|
||||
int chunks;
|
||||
int RESERVED[4];
|
||||
} frameheader;
|
||||
|
||||
struct
|
||||
{
|
||||
long size;
|
||||
unsigned type;
|
||||
} chunkheader;
|
||||
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
FILE *f1;
|
||||
int f;
|
||||
f1=fopen(argv[1],"rb");
|
||||
if(f1==NULL) return(0);
|
||||
fread(&header,sizeof(header),1,f1);
|
||||
lw=header.width;
|
||||
/**/
|
||||
_asm mov ax,13h
|
||||
_asm int 10h
|
||||
saveframe(-1);
|
||||
for(f=0;f<header.frames;f++)
|
||||
{
|
||||
doframe(f1);
|
||||
saveframe(f);
|
||||
}
|
||||
saveframe(-2);
|
||||
/**/
|
||||
fclose(f1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
int doframe(FILE *f1)
|
||||
{
|
||||
int c;
|
||||
long framestart;
|
||||
framestart=ftell(f1);
|
||||
fread(&frameheader,sizeof(frameheader),1,f1);
|
||||
for(c=0;c<frameheader.chunks;c++) dochunk(f1);
|
||||
fseek(f1,framestart+frameheader.size,SEEK_SET);
|
||||
return(0);
|
||||
}
|
||||
|
||||
int dochunk(FILE *f1)
|
||||
{
|
||||
unsigned u;
|
||||
int a,b,c;
|
||||
long chunkstart;
|
||||
chunkstart=ftell(f1);
|
||||
fread(&chunkheader,sizeof(chunkheader),1,f1);
|
||||
switch(chunkheader.type)
|
||||
{
|
||||
case 11 : /* FLI_COLOR */
|
||||
c=getw(f1);
|
||||
a=0;
|
||||
while(c--)
|
||||
{
|
||||
a+=getc(f1);
|
||||
b=getc(f1); if(!b) b=256;
|
||||
outp(0x3c8,a);
|
||||
while(b--)
|
||||
{
|
||||
outp(0x3c9,getc(f1));
|
||||
outp(0x3c9,getc(f1));
|
||||
outp(0x3c9,getc(f1));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 12 : /* FLI_LC */
|
||||
u=getw(f1)*lw;
|
||||
c=getw(f1);
|
||||
while(c--)
|
||||
{
|
||||
doline1(u,f1);
|
||||
u+=lw;
|
||||
}
|
||||
break;
|
||||
case 13 : /* FLI_BLACK */
|
||||
memset(vram,0,64000U);
|
||||
break;
|
||||
case 15 : /* FLI_BRUN */
|
||||
u=0;
|
||||
c=header.heigth;
|
||||
while(c--)
|
||||
{
|
||||
doline2(u,f1);
|
||||
u+=lw;
|
||||
}
|
||||
break;
|
||||
case 16 : /* FLI_COPY */
|
||||
fread(buf,1,64000U,f1);
|
||||
memcpy(vram,buf,64000U);
|
||||
break;
|
||||
}
|
||||
fseek(f1,chunkstart+chunkheader.size,SEEK_SET);
|
||||
return(0);
|
||||
}
|
||||
|
||||
int doline1(unsigned u,FILE *f1)
|
||||
{
|
||||
int a,b,c;
|
||||
c=getc(f1);
|
||||
while(c--)
|
||||
{
|
||||
u+=getc(f1);
|
||||
b=(char)getc(f1);
|
||||
if(b>0)
|
||||
{
|
||||
while(b--) vram[u++]=(char)getc(f1);
|
||||
}
|
||||
else
|
||||
{
|
||||
a=getc(f1);
|
||||
while(b++) vram[u++]=(char)a;
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
int doline2(unsigned u,FILE *f1)
|
||||
{
|
||||
int a,b,c;
|
||||
c=getc(f1);
|
||||
while(c--)
|
||||
{
|
||||
b=(char)getc(f1);
|
||||
if(b<0)
|
||||
{
|
||||
while(b++) vram[u++]=(char)getc(f1);
|
||||
}
|
||||
else
|
||||
{
|
||||
a=getc(f1);
|
||||
while(b--) vram[u++]=(char)a;
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
int saveframe(int frame)
|
||||
{
|
||||
unsigned u,u0,ua;
|
||||
int a,b,c;
|
||||
static FILE *fo;
|
||||
switch(frame)
|
||||
{
|
||||
case -1 : /* open */
|
||||
fo=fopen("anim.fca","wb");
|
||||
break;
|
||||
case -2 : /* close */
|
||||
putc(254,fo);
|
||||
fclose(fo);
|
||||
break;
|
||||
default : /* save */
|
||||
if(frame==0)
|
||||
{
|
||||
outp(0x3c7,0);
|
||||
for(a=0;a<768;a++) pal[a]=(char)inp(0x3c9);
|
||||
memset(savebuf,0,64000U);
|
||||
fwrite(pal,1,768U,fo);
|
||||
}
|
||||
{
|
||||
int x1=160-32-3;
|
||||
int y1=100-32;
|
||||
int x2=160+32-3;
|
||||
int y2=100+32;
|
||||
int x,y;
|
||||
for(y=y1;y<y2;y++) for(x=x1;x<x2;x++)
|
||||
{
|
||||
vram[x+y*320]^=128;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
BIN
GRAB/FLIC/XO2.LBM
Normal file
BIN
GRAB/FLIC/XO2.LBM
Normal file
Binary file not shown.
Loading…
Reference in a new issue