FLI/FLC: fix loading of "empty" frames
This commit is contained in:
		
							parent
							
								
									713bf5a590
								
							
						
					
					
						commit
						c6014da99f
					
				@ -3928,13 +3928,6 @@ void Load_FLI(T_IO_Context * context)
 | 
				
			|||||||
      header.speed = 10;  // 10ms
 | 
					      header.speed = 10;  // 10ms
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Pre_load(context, header.width,header.height,file_size,FORMAT_FLI,PIXEL_SIMPLE,header.depth);
 | 
					 | 
				
			||||||
  if (context->Type == CONTEXT_MAIN_IMAGE)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    Main.backups->Pages->Image_mode = IMAGE_MODE_ANIMATION;
 | 
					 | 
				
			||||||
    Update_screen_targets();
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  while (File_error == 0
 | 
					  while (File_error == 0
 | 
				
			||||||
     && Read_dword_le(file,&chunk_size) && Read_word_le(file,&chunk_type))
 | 
					     && Read_dword_le(file,&chunk_size) && Read_word_le(file,&chunk_type))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@ -3954,6 +3947,36 @@ void Load_FLI(T_IO_Context * context)
 | 
				
			|||||||
        if (frame_delay == 0)
 | 
					        if (frame_delay == 0)
 | 
				
			||||||
          frame_delay = header.speed;
 | 
					          frame_delay = header.speed;
 | 
				
			||||||
        chunk_size -= 10;
 | 
					        chunk_size -= 10;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (current_frame == 0)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          Pre_load(context, header.width,header.height,file_size,FORMAT_FLI,PIXEL_SIMPLE,header.depth);
 | 
				
			||||||
 | 
					          if (context->Type == CONTEXT_MAIN_IMAGE)
 | 
				
			||||||
 | 
					          {
 | 
				
			||||||
 | 
					            Main.backups->Pages->Image_mode = IMAGE_MODE_ANIMATION;
 | 
				
			||||||
 | 
					            Update_screen_targets();
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					          if (Config.Clear_palette)
 | 
				
			||||||
 | 
					            memset(context->Palette,0,sizeof(T_Palette));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          Set_loading_layer(context, current_frame);
 | 
				
			||||||
 | 
					          if (context->Type == CONTEXT_MAIN_IMAGE && Main.backups->Pages->Image_mode == IMAGE_MODE_ANIMATION)
 | 
				
			||||||
 | 
					          {
 | 
				
			||||||
 | 
					            // Copy the content of previous frame
 | 
				
			||||||
 | 
					            memcpy(
 | 
				
			||||||
 | 
					                Main.backups->Pages->Image[Main.current_layer].Pixels,
 | 
				
			||||||
 | 
					                Main.backups->Pages->Image[Main.current_layer-1].Pixels,
 | 
				
			||||||
 | 
					                Main.backups->Pages->Width*Main.backups->Pages->Height);
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (header.type == 0xAF11) // FLI
 | 
				
			||||||
 | 
					          Set_frame_duration(context, (frame_delay * 100) / 7); // 1/70th sec
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
 | 
					          Set_frame_duration(context, frame_delay); // msec
 | 
				
			||||||
 | 
					        current_frame++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (sub_chunk_index = 0; sub_chunk_index < sub_chunk_count; sub_chunk_index++)
 | 
					        for (sub_chunk_index = 0; sub_chunk_index < sub_chunk_count; sub_chunk_index++)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          if (!(Read_dword_le(file,&sub_chunk_size) && Read_word_le(file,&sub_chunk_type)))
 | 
					          if (!(Read_dword_le(file,&sub_chunk_size) && Read_word_le(file,&sub_chunk_type)))
 | 
				
			||||||
@ -4005,10 +4028,6 @@ void Load_FLI(T_IO_Context * context)
 | 
				
			|||||||
            else if (sub_chunk_type == 0x0f)  // full frame RLE
 | 
					            else if (sub_chunk_type == 0x0f)  // full frame RLE
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
              word x, y;
 | 
					              word x, y;
 | 
				
			||||||
              if (header.type == 0xAF11) // FLI
 | 
					 | 
				
			||||||
                Set_frame_duration(context, (frame_delay * 100) / 7); // 1/70th sec
 | 
					 | 
				
			||||||
              else
 | 
					 | 
				
			||||||
                Set_frame_duration(context, frame_delay); // msec
 | 
					 | 
				
			||||||
              for (y = 0; y < frame_height && File_error == 0; y++)
 | 
					              for (y = 0; y < frame_height && File_error == 0; y++)
 | 
				
			||||||
              {
 | 
					              {
 | 
				
			||||||
                byte count, data;
 | 
					                byte count, data;
 | 
				
			||||||
@ -4056,20 +4075,6 @@ void Load_FLI(T_IO_Context * context)
 | 
				
			|||||||
            {
 | 
					            {
 | 
				
			||||||
              word x, y, line_count;
 | 
					              word x, y, line_count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              Set_loading_layer(context, ++current_frame);
 | 
					 | 
				
			||||||
              if (header.type == 0xAF11) // FLI
 | 
					 | 
				
			||||||
                Set_frame_duration(context, (frame_delay * 100) / 7); // 1/70th sec
 | 
					 | 
				
			||||||
              else
 | 
					 | 
				
			||||||
                Set_frame_duration(context, frame_delay); // msec
 | 
					 | 
				
			||||||
              if (context->Type == CONTEXT_MAIN_IMAGE && Main.backups->Pages->Image_mode == IMAGE_MODE_ANIMATION)
 | 
					 | 
				
			||||||
              {
 | 
					 | 
				
			||||||
                // Copy the content of previous frame
 | 
					 | 
				
			||||||
                memcpy(
 | 
					 | 
				
			||||||
                  Main.backups->Pages->Image[Main.current_layer].Pixels,
 | 
					 | 
				
			||||||
                  Main.backups->Pages->Image[Main.current_layer-1].Pixels,
 | 
					 | 
				
			||||||
                  Main.backups->Pages->Width*Main.backups->Pages->Height);
 | 
					 | 
				
			||||||
              }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
              Read_word_le(file, &y);
 | 
					              Read_word_le(file, &y);
 | 
				
			||||||
              Read_word_le(file, &line_count);
 | 
					              Read_word_le(file, &line_count);
 | 
				
			||||||
              sub_chunk_size -= 4;
 | 
					              sub_chunk_size -= 4;
 | 
				
			||||||
@ -4117,20 +4122,6 @@ void Load_FLI(T_IO_Context * context)
 | 
				
			|||||||
            {
 | 
					            {
 | 
				
			||||||
              word opcode, y, line_count;
 | 
					              word opcode, y, line_count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              Set_loading_layer(context, ++current_frame);
 | 
					 | 
				
			||||||
              if (header.type == 0xAF11) // FLI
 | 
					 | 
				
			||||||
                Set_frame_duration(context, (frame_delay * 100) / 7); // 1/70th sec
 | 
					 | 
				
			||||||
              else
 | 
					 | 
				
			||||||
                Set_frame_duration(context, frame_delay); // msec
 | 
					 | 
				
			||||||
              if (context->Type == CONTEXT_MAIN_IMAGE && Main.backups->Pages->Image_mode == IMAGE_MODE_ANIMATION)
 | 
					 | 
				
			||||||
              {
 | 
					 | 
				
			||||||
                // Copy the content of previous frame
 | 
					 | 
				
			||||||
                memcpy(
 | 
					 | 
				
			||||||
                  Main.backups->Pages->Image[Main.current_layer].Pixels,
 | 
					 | 
				
			||||||
                  Main.backups->Pages->Image[Main.current_layer-1].Pixels,
 | 
					 | 
				
			||||||
                  Main.backups->Pages->Width*Main.backups->Pages->Height);
 | 
					 | 
				
			||||||
              }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
              y = 0;
 | 
					              y = 0;
 | 
				
			||||||
              Read_word_le(file, &line_count);
 | 
					              Read_word_le(file, &line_count);
 | 
				
			||||||
              sub_chunk_size -= 2;
 | 
					              sub_chunk_size -= 2;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user