/* Coded by Sol/Trauma (aka Jari Komppa), public domain. * * "old style" txtfli. Works okay with 80x50 sized flics. */ #include #include #include #include #include #include #include "textfx2.h" #include "fliflc.h" short int textpalette[256]; void waitframes(int numframes) { for (;numframes;numframes--) vrc(); } void fli_frame2text(FLIDATA *flidata) { short int * screenpos; int x,y,fli_ypos; int xpos,ypos,xstep,ystep; xstep=(flidata->x_size*(1<<16))/80; ystep=(flidata->y_size*(1<<16))/50; screenpos=(short int *)0xb8000; for (y=0,ypos=0,fli_ypos=0;y<50;y++,ypos+=ystep,fli_ypos=(ypos>>16)*flidata->x_size) for (x=0,xpos=0;x<80;x++,xpos+=xstep,screenpos++) *screenpos=textpalette[*(flidata->framebuffer+fli_ypos+(xpos>>16))]; } void main(int argc,char **argv) { FLIDATA * flic; int a; int speed; if (argc<2) { cprintf("------------------------------------------------------------------------------\r\n" "TXTFLI_O - 80x50 Textmode Fli/Flc player by Sol_HSA aka Sol/Trauma.Version 1.2\r\n" "\r\n" "Usage: TXTFLI_O <.fli/flc file of any size> \r\n" "(speed = retraces to wait before next frame. Default = 2)\r\n" "------------------------------------------------------------------------------\r\n"); return; } flic=fli_open(argv[1],0); speed=2; if (argc>2) speed=strtol(argv[2],0,10); set80x50(); memset(textpalette,0,256*2); while (!kbhit()) { fli_renderframe(flic); if (!flic->looped) if (flic->palette_change) { for (a=0;a<256;a++) textpalette[a]=calcpal(*(flic->palette+a*3+0),*(flic->palette+a*3+1),*(flic->palette+a*3+2)); flic->palette_change=0; } fli_frame2text(flic); waitframes(speed); } fli_zap(flic); set80x25(); cprintf("Remember: EVERYTHING looks good while viewed from 20 meters in free fall.\r\n"); }