Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » FLIC Video help

This thread is locked; no one can reply to it. rss feed Print
FLIC Video help
Eagle11
Member #10,454
December 2008

I have been trying for days without success to get an FLIC animation to play at the beginning of my game. There does not seem to be a problem with the code. Everything compiles fine. When I run the program it seems to just skip the video or just display a black screen (I've tried several different ways of playing it). I thought that it might be a problem with the file itself, so I tried using a file that I know worked with the same results.
Here is the relevant code.

[code]
// Part of the initialization
allegro_init();
install_timer();
install_keyboard();
set_color_depth(16);
set_gfx_mode(MODE, WIDTH, HEIGHT, 0, 0);

// Called at the beginning of the game to play the intro movie.
void PlayIntro()
{
int FliFrames = 0;

// Load the intro
open_fli("introex.flc");

if (fli_timer)
{
FliFrames++;

// Open next frame
next_fli_frame(1);

// Make sure that the next frame isn't null before drawing
if (fli_bitmap)
{
// Adjust the palette
set_palette(fli_palette);

// Blit to the screen
blit(fli_bitmap, screen, 0, 0, 0, 30,
fli_bitmap->w, fli_bitmap->h);
}
}
// Remove the intro fram memory
close_fli();
}

someone972
Member #7,719
August 2006
avatar

#SelectExpand
1if (fli_timer) 2{ 3 FliFrames++; 4 5 // Open next frame 6 next_fli_frame(1); 7 8 // Make sure that the next frame isn't null before drawing 9 if (fli_bitmap) 10 { 11 // Adjust the palette 12 set_palette(fli_palette); 13 14 // Blit to the screen 15 blit(fli_bitmap, screen, 0, 0, 0, 30, 16 fli_bitmap->w, fli_bitmap->h); 17 } 18}

This part doesn't seem right. Wouldn't you want it to run in a loop instead of just once with the if statement?

The [code] tags have changed to <code> tags, by the way.

______________________________________
As long as it remains classified how long it took me to make I'll be deemed a computer game genius. - William Labbett
Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why. -Unknown
I have recklessly set in motion a chain of events with the potential to so-drastically change the path of my life that I can only find it to be beautifully frightening.

Eagle11
Member #10,454
December 2008

Yes, you're right. I messed up and posted the wrong code. Here is what it should be.

#SelectExpand
1void PlayIntro() 2{ 3 int FliFrames = 0; 4 int finishedflag = 0; 5 // Load the intro 6 open_fli("introex.flc"); 7 //play_fli("introex.flc", screen, 1, NULL); 8 9 // Loop while the video isn't finished 10 while (!finishedflag) 11 { 12 // If it is time for the next frame 13 if (fli_timer) 14 { 15 // Open next frame 16 next_fli_frame(1); 17 18 // Make sure that the next frame isn't null before drawing 19 if (fli_bitmap) 20 { 21 // Adjust the palette 22 set_palette(fli_palette); 23 24 // Blit to the screen 25 blit(fli_bitmap, screen, 0, 0, 0, 30, 26 fli_bitmap->w, fli_bitmap->h); 27 } 28 // The next frame is null, so the video is over 29 else 30 { 31 finishedflag = 1; 32 } 33 } 34 } 35 36 // Remove the intro fram memory 37 close_fli(); 38}

someone972
Member #7,719
August 2006
avatar

Are you sure the flv is being opened ok? next_fli_frame returns FLI_NOT_OPEN if it's not.

______________________________________
As long as it remains classified how long it took me to make I'll be deemed a computer game genius. - William Labbett
Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why. -Unknown
I have recklessly set in motion a chain of events with the potential to so-drastically change the path of my life that I can only find it to be beautifully frightening.

Eagle11
Member #10,454
December 2008

I'm not sure. I'll test and post back tomorrow evening.

Go to: