void Play_Fli( const char *filename ) { flic_header header; /* Header for the entire file */ FILE *fp; /* Pointer to opened .fli file */ unsigned char exit = 0; /* Flag for the loop */ char newfilename[512]; uint32_t time; sprintf(newfilename,"%s%s",g_DataPath,filename); fp = fopen( newfilename, "rb" ); /* Open file */ fread( &header, sizeof( flic_header ), 1, fp ); /* Get the flic header */ fseek( fp, 128, SEEK_SET ); /* Move to end of header */ DB_Clear_Screen(); /* Clear the double buffer */ time = SYS_GetTimeMS(); while ( !feof( fp ) && !exit ) { if ( Read_Chunk( fp ) == 0 ) /* If we reach the last chunk */ exit = 1; if( exit == 1 ) /* Reset to first frame (set in color_chunk) */ { fseek( fp, first_frame, SEEK_SET ); /* exit = 0; */ } Swap_Buffer(); /* Swap the double buffer into video memory */ while ( SYS_GetTimeMS() < (time + 33) ); time = SYS_GetTimeMS(); // AJT: // if( Jon_Kbhit() ) /* If the user presses a key, exit */ // { // exit = 1; // } } fclose( fp ); /* Close the file */ }
int PlayFliProcess() { int exit = 0; if ( feof( gCurrentFile ) ) return 0; if ( SYS_GetTimeMS() < (gFrameTime + 33) ) return 1; gFrameTime = SYS_GetTimeMS(); if ( Read_Chunk( gCurrentFile ) == 0 ) /* If we reach the last chunk */ return 0; Swap_Buffer(); /* Swap the double buffer into video memory */ return 1; }
void PlayFliEnter( const char* filename ) { char newfilename[512]; sprintf( newfilename, "%s%s", g_DataPath, filename ); // open the fli gCurrentFile = fopen( newfilename, "rb" ); if ( !gCurrentFile ) { SYS_Error( "could not open FLI file!\n" ); return; } fread( &gCurrentHeader, sizeof( flic_header ), 1, gCurrentFile ); /* Get the flic header */ fseek( gCurrentFile, 128, SEEK_SET ); /* Move to end of header */ DB_Clear_Screen(); /* Clear the double buffer */ gFrameTime = SYS_GetTimeMS(); }