Load_IFF() support ILBM animations type 74
This commit is contained in:
parent
e31fbabbd7
commit
f0c5854021
@ -785,6 +785,11 @@ void Load_IFF(T_IO_Context * context)
|
|||||||
dword offsets[16];
|
dword offsets[16];
|
||||||
dword current_offset = 0;
|
dword current_offset = 0;
|
||||||
|
|
||||||
|
if (Image_HAM > 1)
|
||||||
|
{
|
||||||
|
Warning("HAM animations are not supported");
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (previous_frame == NULL)
|
if (previous_frame == NULL)
|
||||||
{
|
{
|
||||||
real_line_size = (context->Width+15) & ~15;
|
real_line_size = (context->Width+15) & ~15;
|
||||||
@ -804,6 +809,8 @@ void Load_IFF(T_IO_Context * context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Set_loading_layer(context, ++current_frame);
|
Set_loading_layer(context, ++current_frame);
|
||||||
|
if(aheader.operation == 5)
|
||||||
|
{
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
if (!Read_dword_be(IFF_file, offsets+i))
|
if (!Read_dword_be(IFF_file, offsets+i))
|
||||||
@ -886,11 +893,113 @@ void Load_IFF(T_IO_Context * context)
|
|||||||
y_pos += op;
|
y_pos += op;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (y_pos > 0 && y_pos != context->Height)
|
if (y_pos > context->Height)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if(aheader.operation==74)
|
||||||
|
{
|
||||||
|
// from sources found on aminet :
|
||||||
|
// http://aminet.net/package/gfx/conv/unmovie
|
||||||
|
while (current_offset < section_size)
|
||||||
|
{
|
||||||
|
word change_type;
|
||||||
|
word uni_flag;
|
||||||
|
word y_size;
|
||||||
|
word x_size;
|
||||||
|
word num_blocks;
|
||||||
|
word offset;
|
||||||
|
word x_start, y_start;
|
||||||
|
|
||||||
|
Read_word_be(IFF_file, &change_type);
|
||||||
|
current_offset += 2;
|
||||||
|
if (change_type == 0)
|
||||||
|
break;
|
||||||
|
else if (change_type == 1)
|
||||||
|
{ // "Wall"
|
||||||
|
Read_word_be(IFF_file, &uni_flag);
|
||||||
|
Read_word_be(IFF_file, &y_size);
|
||||||
|
Read_word_be(IFF_file, &num_blocks);
|
||||||
|
current_offset += 6;
|
||||||
|
while (num_blocks-- > 0)
|
||||||
|
{
|
||||||
|
Read_word_be(IFF_file, &offset);
|
||||||
|
current_offset += 2;
|
||||||
|
x_start = offset % plane_line_size;
|
||||||
|
y_start = offset / plane_line_size;
|
||||||
|
for (plane = 0; plane < real_bit_planes; plane++)
|
||||||
|
{
|
||||||
|
byte * p = previous_frame + plane * plane_line_size;
|
||||||
|
p += x_start + y_start*line_size;
|
||||||
|
for (y_pos=0; y_pos < y_size; y_pos++)
|
||||||
|
{
|
||||||
|
byte value;
|
||||||
|
Read_byte(IFF_file, &value);
|
||||||
|
current_offset++;
|
||||||
|
if (uni_flag)
|
||||||
|
*p ^= value;
|
||||||
|
else
|
||||||
|
*p = value;
|
||||||
|
}
|
||||||
|
p += line_size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (change_type == 2)
|
||||||
|
{ // "Pile"
|
||||||
|
Read_word_be(IFF_file, &uni_flag);
|
||||||
|
Read_word_be(IFF_file, &y_size);
|
||||||
|
Read_word_be(IFF_file, &x_size);
|
||||||
|
Read_word_be(IFF_file, &num_blocks);
|
||||||
|
current_offset += 8;
|
||||||
|
while (num_blocks-- > 0)
|
||||||
|
{
|
||||||
|
Read_word_be(IFF_file, &offset);
|
||||||
|
current_offset += 2;
|
||||||
|
x_start = offset % plane_line_size;
|
||||||
|
y_start = offset / plane_line_size;
|
||||||
|
for (plane = 0; plane < real_bit_planes; plane++)
|
||||||
|
{
|
||||||
|
byte * p = previous_frame + plane * plane_line_size;
|
||||||
|
p += x_start + y_start*line_size;
|
||||||
|
for (y_pos=0; y_pos < y_size; y_pos++)
|
||||||
|
{
|
||||||
|
for (x_pos=0; x_pos < x_size; x_pos++)
|
||||||
|
{
|
||||||
|
byte value;
|
||||||
|
Read_byte(IFF_file, &value);
|
||||||
|
current_offset++;
|
||||||
|
if (uni_flag)
|
||||||
|
p[x_pos] ^= value;
|
||||||
|
else
|
||||||
|
p[x_pos] = value;
|
||||||
|
}
|
||||||
|
p += line_size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Warning("Unknown change type in type 74 DLTA");
|
||||||
|
File_error = 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (current_offset & 1) // align to WORD boundary
|
||||||
|
{
|
||||||
|
byte junk;
|
||||||
|
Read_byte(IFF_file, &junk);
|
||||||
|
current_offset++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Warning("Unsupported compression type in ILBM DLTA chunk");
|
||||||
|
}
|
||||||
|
|
||||||
if (File_error == 0)
|
if (File_error == 0)
|
||||||
{
|
{
|
||||||
for (y_pos=0; y_pos<context->Height; y_pos++)
|
for (y_pos=0; y_pos<context->Height; y_pos++)
|
||||||
@ -1477,6 +1586,10 @@ printf("%d x %d = %d %d\n", tiny_width, tiny_height, tiny_width*tiny_height, s
|
|||||||
}
|
}
|
||||||
if (section_size & 1)
|
if (section_size & 1)
|
||||||
fseek(IFF_file, 1, SEEK_CUR); // SKIP one byte
|
fseek(IFF_file, 1, SEEK_CUR); // SKIP one byte
|
||||||
|
if (context->Type == CONTEXT_PREVIEW || context->Type == CONTEXT_PREVIEW_PALETTE)
|
||||||
|
{
|
||||||
|
break; // dont load animations in Preview mode
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -5497,3 +5610,4 @@ void Save_PNG(T_IO_Context * context)
|
|||||||
}
|
}
|
||||||
#endif // __no_pnglib__
|
#endif // __no_pnglib__
|
||||||
|
|
||||||
|
plane, x_pos, y_pos, context->Height, i, op_count, current_offset)2
|
||||||
|
|||||||
@ -164,7 +164,7 @@ void Load_SDL_Image(T_IO_Context *);
|
|||||||
|
|
||||||
// ENUM Name TestFunc LoadFunc SaveFunc PalOnly Comment Layers Ext Exts
|
// ENUM Name TestFunc LoadFunc SaveFunc PalOnly Comment Layers Ext Exts
|
||||||
const T_Format File_formats[] = {
|
const T_Format File_formats[] = {
|
||||||
{FORMAT_ALL_IMAGES, "(all)", NULL, NULL, NULL, 0, 0, 0, "", "gif;png;bmp;2bp;pcx;pkm;iff;lbm;ilbm;sham;ham;ham6;ham8;acbm;pic;img;sci;scq;scf;scn;sco;pi1;pc1;cel;neo;c64;koa;koala;fli;bml;cdu;prg;tga;pnm;xpm;xcf;jpg;jpeg;tif;tiff;ico;ic2;cur;cm5;pph"},
|
{FORMAT_ALL_IMAGES, "(all)", NULL, NULL, NULL, 0, 0, 0, "", "gif;png;bmp;2bp;pcx;pkm;iff;lbm;ilbm;sham;ham;ham6;ham8;acbm;pic;anim;img;sci;scq;scf;scn;sco;pi1;pc1;cel;neo;c64;koa;koala;fli;bml;cdu;prg;tga;pnm;xpm;xcf;jpg;jpeg;tif;tiff;ico;ic2;cur;cm5;pph"},
|
||||||
{FORMAT_ALL_PALETTES, "(pal)", NULL, NULL, NULL, 1, 0, 0, "", "kcf;pal;gpl"},
|
{FORMAT_ALL_PALETTES, "(pal)", NULL, NULL, NULL, 1, 0, 0, "", "kcf;pal;gpl"},
|
||||||
{FORMAT_ALL_FILES, "(*.*)", NULL, NULL, NULL, 0, 0, 0, "", "*"},
|
{FORMAT_ALL_FILES, "(*.*)", NULL, NULL, NULL, 0, 0, 0, "", "*"},
|
||||||
{FORMAT_GIF, " gif", Test_GIF, Load_GIF, Save_GIF, 0, 1, 1, "gif", "gif"},
|
{FORMAT_GIF, " gif", Test_GIF, Load_GIF, Save_GIF, 0, 1, 1, "gif", "gif"},
|
||||||
@ -174,7 +174,7 @@ const T_Format File_formats[] = {
|
|||||||
{FORMAT_BMP, " bmp", Test_BMP, Load_BMP, Save_BMP, 0, 0, 0, "bmp", "bmp;2bp"},
|
{FORMAT_BMP, " bmp", Test_BMP, Load_BMP, Save_BMP, 0, 0, 0, "bmp", "bmp;2bp"},
|
||||||
{FORMAT_PCX, " pcx", Test_PCX, Load_PCX, Save_PCX, 0, 0, 0, "pcx", "pcx"},
|
{FORMAT_PCX, " pcx", Test_PCX, Load_PCX, Save_PCX, 0, 0, 0, "pcx", "pcx"},
|
||||||
{FORMAT_PKM, " pkm", Test_PKM, Load_PKM, Save_PKM, 0, 1, 0, "pkm", "pkm"},
|
{FORMAT_PKM, " pkm", Test_PKM, Load_PKM, Save_PKM, 0, 1, 0, "pkm", "pkm"},
|
||||||
{FORMAT_LBM, " lbm", Test_LBM, Load_IFF, Save_IFF, 0, 1, 0, "iff", "iff;lbm;ilbm;sham;ham;ham6;ham8"},
|
{FORMAT_LBM, " lbm", Test_LBM, Load_IFF, Save_IFF, 0, 1, 0, "iff", "iff;lbm;ilbm;sham;ham;ham6;ham8;anim"},
|
||||||
{FORMAT_PBM, " pbm", Test_PBM, Load_IFF, Save_IFF, 0, 1, 0, "iff", "iff;pbm;lbm"},
|
{FORMAT_PBM, " pbm", Test_PBM, Load_IFF, Save_IFF, 0, 1, 0, "iff", "iff;pbm;lbm"},
|
||||||
{FORMAT_ACBM," acbm",Test_ACBM,Load_IFF, NULL, 0, 1, 0, "iff", "iff;pic;acbm"},
|
{FORMAT_ACBM," acbm",Test_ACBM,Load_IFF, NULL, 0, 1, 0, "iff", "iff;pic;acbm"},
|
||||||
{FORMAT_IMG, " img", Test_IMG, Load_IMG, Save_IMG, 0, 0, 0, "img", "img"},
|
{FORMAT_IMG, " img", Test_IMG, Load_IMG, Save_IMG, 0, 0, 0, "img", "img"},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user