diff --git a/src/graph.c b/src/graph.c index 82b03756..7e1bae28 100644 --- a/src/graph.c +++ b/src/graph.c @@ -3143,7 +3143,8 @@ void Pixel_in_screen_overlay(word x,word y,byte color) // Paste in depth buffer *(Main_visible_image_depth_buffer.Image+x+y*Main_image_width)=color; // Fetch pixel color from the target raster layer - color=*(Main_backups->Pages->Image[color].Pixels + x+y*Main_image_width); + if (Main_layers_visible & (1 << color)) + color=*(Main_backups->Pages->Image[color].Pixels + x+y*Main_image_width); // Draw that color on the visible image buffer *(x+y*Main_image_width+Main_screen)=color; } @@ -3159,7 +3160,8 @@ void Pixel_in_screen_overlay_with_preview(word x,word y,byte color) // Paste in depth buffer *(Main_visible_image_depth_buffer.Image+x+y*Main_image_width)=color; // Fetch pixel color from the target raster layer - color=*(Main_backups->Pages->Image[color].Pixels + x+y*Main_image_width); + if (Main_layers_visible & (1 << color)) + color=*(Main_backups->Pages->Image[color].Pixels + x+y*Main_image_width); // Draw that color on the visible image buffer *(x+y*Main_image_width+Main_screen)=color; diff --git a/src/miscfileformats.c b/src/miscfileformats.c index cbd1614d..cda0f312 100644 --- a/src/miscfileformats.c +++ b/src/miscfileformats.c @@ -3101,14 +3101,25 @@ void Load_CM5(T_IO_Context* context) fclose(file); // Load the pixeldata to the 5th layer - filename[strlen(filename) - 3] = 0; - strcat(filename,"gfx"); - if (!(file = fopen(filename, "rb"))) { - File_error = 1; - return; - } + char* ext = filename + strlen(filename) - 3; + int idx = 8; + do { + if (-- idx < 0) + { + File_error = 1; + return; + } + ext[0] = (idx & 1) ? 'g':'G'; + ext[1] = (idx & 2) ? 'f':'F'; + ext[2] = (idx & 4) ? 'x':'X'; + + printf("trying to load %s...\n", filename); + + file = fopen(filename, "rb"); + } while(file == NULL); + } Set_loading_layer(context, 4); for (ty = 0; ty < 256; ty++) diff --git a/src/pages.c b/src/pages.c index fe511e5c..0864482c 100644 --- a/src/pages.c +++ b/src/pages.c @@ -212,7 +212,10 @@ void Redraw_layered_image(void) for (i=0; i< Main_image_width*Main_image_height; i++) { layer = *(Main_backups->Pages->Image[4].Pixels+i); - Main_visible_image.Image[i]=*(Main_backups->Pages->Image[layer].Pixels+i); + if (Main_layers_visible & (1 << layer)) + Main_visible_image.Image[i]=*(Main_backups->Pages->Image[layer].Pixels+i); + else + Main_visible_image.Image[i] = layer; } // Copy it to the depth buffer