(mode5 branch) Fix a bug in saving, including autosave every few minutes, that auto-selects the last layer to draw.
git-svn-id: svn://pulkomandy.tk/GrafX2/branches/cpcmode5@1743 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
9058926e4b
commit
55422d160e
@ -2085,7 +2085,7 @@ void Load_GIF(T_IO_Context * context)
|
|||||||
// This a second layer/frame, or more.
|
// This a second layer/frame, or more.
|
||||||
// Attempt to add a layer to current image
|
// Attempt to add a layer to current image
|
||||||
current_layer++;
|
current_layer++;
|
||||||
Set_layer(context, current_layer);
|
Set_loading_layer(context, current_layer);
|
||||||
}
|
}
|
||||||
number_LID++;
|
number_LID++;
|
||||||
|
|
||||||
@ -2444,7 +2444,7 @@ void Save_GIF(T_IO_Context * context)
|
|||||||
GCE_block[3] |= 1; // Transparent color flag
|
GCE_block[3] |= 1; // Transparent color flag
|
||||||
GCE_block[6] = context->Transparent_color;
|
GCE_block[6] = context->Transparent_color;
|
||||||
|
|
||||||
Set_layer(context, current_layer);
|
Set_saving_layer(context, current_layer);
|
||||||
|
|
||||||
if (current_layer == context->Nb_layers -1)
|
if (current_layer == context->Nb_layers -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -436,7 +436,7 @@ void Pre_load(T_IO_Context *context, short width, short height, long file_size,
|
|||||||
context->Nb_layers=1;
|
context->Nb_layers=1;
|
||||||
Main_current_layer=0;
|
Main_current_layer=0;
|
||||||
Main_layers_visible=1<<0;
|
Main_layers_visible=1<<0;
|
||||||
Set_layer(context,0);
|
Set_loading_layer(context,0);
|
||||||
|
|
||||||
// Remove previous comment, unless we load just a palette
|
// Remove previous comment, unless we load just a palette
|
||||||
if (! Get_fileformat(context->Format)->Palette_only)
|
if (! Get_fileformat(context->Format)->Palette_only)
|
||||||
@ -1261,7 +1261,18 @@ void Init_context_surface(T_IO_Context * context, char *file_name, char *file_di
|
|||||||
|
|
||||||
}
|
}
|
||||||
/// Function to call when need to switch layers.
|
/// Function to call when need to switch layers.
|
||||||
void Set_layer(T_IO_Context *context, byte layer)
|
void Set_saving_layer(T_IO_Context *context, byte layer)
|
||||||
|
{
|
||||||
|
context->Current_layer = layer;
|
||||||
|
|
||||||
|
if (context->Type == CONTEXT_MAIN_IMAGE)
|
||||||
|
{
|
||||||
|
context->Target_address=Main_backups->Pages->Image[layer];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Function to call when need to switch layers.
|
||||||
|
void Set_loading_layer(T_IO_Context *context, byte layer)
|
||||||
{
|
{
|
||||||
context->Current_layer = layer;
|
context->Current_layer = layer;
|
||||||
|
|
||||||
@ -1280,9 +1291,8 @@ void Set_layer(T_IO_Context *context, byte layer)
|
|||||||
context->Nb_layers = Main_backups->Pages->Nb_layers;
|
context->Nb_layers = Main_backups->Pages->Nb_layers;
|
||||||
Main_layers_visible = (2<<layer)-1;
|
Main_layers_visible = (2<<layer)-1;
|
||||||
}
|
}
|
||||||
context->Target_address=Main_backups->Pages->Image[layer];
|
|
||||||
|
|
||||||
Main_current_layer = layer;
|
Main_current_layer = layer;
|
||||||
|
context->Target_address=Main_backups->Pages->Image[layer];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -215,7 +215,9 @@ void Set_pixel(T_IO_Context *context, short x, short y, byte c);
|
|||||||
/// Set the color of a 24bit pixel (on load)
|
/// Set the color of a 24bit pixel (on load)
|
||||||
void Set_pixel_24b(T_IO_Context *context, short x, short y, byte r, byte g, byte b);
|
void Set_pixel_24b(T_IO_Context *context, short x, short y, byte r, byte g, byte b);
|
||||||
/// Function to call when need to switch layers.
|
/// Function to call when need to switch layers.
|
||||||
void Set_layer(T_IO_Context *context, byte layer);
|
void Set_loading_layer(T_IO_Context *context, byte layer);
|
||||||
|
/// Function to call when need to switch layers.
|
||||||
|
void Set_saving_layer(T_IO_Context *context, byte layer);
|
||||||
|
|
||||||
|
|
||||||
// =================================================================
|
// =================================================================
|
||||||
|
|||||||
@ -2206,7 +2206,7 @@ void Load_C64_fli(T_IO_Context *context, byte *bitmap, byte *screen_ram, byte *c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Set_layer(context, 1);
|
Set_loading_layer(context, 1);
|
||||||
for(cy=0; cy<25; cy++)
|
for(cy=0; cy<25; cy++)
|
||||||
{
|
{
|
||||||
for(cx=0; cx<40; cx++)
|
for(cx=0; cx<40; cx++)
|
||||||
@ -2222,7 +2222,7 @@ void Load_C64_fli(T_IO_Context *context, byte *bitmap, byte *screen_ram, byte *c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Set_layer(context, 2);
|
Set_loading_layer(context, 2);
|
||||||
for(cy=0; cy<25; cy++)
|
for(cy=0; cy<25; cy++)
|
||||||
{
|
{
|
||||||
for(cx=0; cx<40; cx++)
|
for(cx=0; cx<40; cx++)
|
||||||
@ -2244,7 +2244,7 @@ void Load_C64_fli(T_IO_Context *context, byte *bitmap, byte *screen_ram, byte *c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Set_layer(context, 3);
|
Set_loading_layer(context, 3);
|
||||||
for(y=0; y<200; y++)
|
for(y=0; y<200; y++)
|
||||||
{
|
{
|
||||||
for(x=0; x<160; x++)
|
for(x=0; x<160; x++)
|
||||||
@ -3015,7 +3015,7 @@ void Load_CM5(T_IO_Context* context)
|
|||||||
if (Read_byte(file, &value)!=1)
|
if (Read_byte(file, &value)!=1)
|
||||||
File_error = 2;
|
File_error = 2;
|
||||||
|
|
||||||
Set_layer(context, 0);
|
Set_loading_layer(context, 0);
|
||||||
for(ty=0; ty<context->Height; ty++)
|
for(ty=0; ty<context->Height; ty++)
|
||||||
for(tx=0; tx<context->Width; tx++)
|
for(tx=0; tx<context->Width; tx++)
|
||||||
{
|
{
|
||||||
@ -3029,19 +3029,19 @@ void Load_CM5(T_IO_Context* context)
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
// This is color for layer 1
|
// This is color for layer 1
|
||||||
Set_layer(context, 1);
|
Set_loading_layer(context, 1);
|
||||||
for(tx=0; tx<context->Width; tx++)
|
for(tx=0; tx<context->Width; tx++)
|
||||||
Set_pixel(context, tx, line, value);
|
Set_pixel(context, tx, line, value);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
// This is color for layer 2
|
// This is color for layer 2
|
||||||
Set_layer(context, 2);
|
Set_loading_layer(context, 2);
|
||||||
for(tx=0; tx<context->Width; tx++)
|
for(tx=0; tx<context->Width; tx++)
|
||||||
Set_pixel(context, tx, line, value);
|
Set_pixel(context, tx, line, value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// This is color for a block in layer 4
|
// This is color for a block in layer 4
|
||||||
Set_layer(context, 3);
|
Set_loading_layer(context, 3);
|
||||||
for(tx=(mod-2)*48; tx<(mod-1)*48; tx++)
|
for(tx=(mod-2)*48; tx<(mod-1)*48; tx++)
|
||||||
Set_pixel(context, tx, line, value);
|
Set_pixel(context, tx, line, value);
|
||||||
break;
|
break;
|
||||||
@ -3065,7 +3065,7 @@ void Load_CM5(T_IO_Context* context)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Set_layer(context, 4);
|
Set_loading_layer(context, 4);
|
||||||
|
|
||||||
for (ty = 0; ty < 256; ty++)
|
for (ty = 0; ty < 256; ty++)
|
||||||
{
|
{
|
||||||
@ -3106,15 +3106,15 @@ void Save_CM5(T_IO_Context* context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write layer 0
|
// Write layer 0
|
||||||
Set_layer(context, 0);
|
Set_saving_layer(context, 0);
|
||||||
Write_byte(file, Get_pixel(context, 0, 0));
|
Write_byte(file, Get_pixel(context, 0, 0));
|
||||||
for(ty = 0; ty < 256; ty++)
|
for(ty = 0; ty < 256; ty++)
|
||||||
{
|
{
|
||||||
Set_layer(context, 1);
|
Set_saving_layer(context, 1);
|
||||||
Write_byte(file, Get_pixel(context, 0, ty));
|
Write_byte(file, Get_pixel(context, 0, ty));
|
||||||
Set_layer(context, 2);
|
Set_saving_layer(context, 2);
|
||||||
Write_byte(file, Get_pixel(context, 0, ty));
|
Write_byte(file, Get_pixel(context, 0, ty));
|
||||||
Set_layer(context, 3);
|
Set_saving_layer(context, 3);
|
||||||
for(tx = 0; tx < 6; tx++)
|
for(tx = 0; tx < 6; tx++)
|
||||||
{
|
{
|
||||||
Write_byte(file, Get_pixel(context, tx*48, ty));
|
Write_byte(file, Get_pixel(context, tx*48, ty));
|
||||||
@ -3132,7 +3132,7 @@ void Save_CM5(T_IO_Context* context)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Set_layer(context, 4);
|
Set_saving_layer(context, 4);
|
||||||
|
|
||||||
for (ty = 0; ty < 256; ty++)
|
for (ty = 0; ty < 256; ty++)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user