From 4fe4ccd7b0494a34dc9ee67ca5d36bc94321c883 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Fri, 30 Mar 2012 22:27:09 +0000 Subject: [PATCH] Added safeties for Mode5: Mode will only switch on if the image has the required layers and a compatible width. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1941 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- src/buttons_effects.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/buttons_effects.c b/src/buttons_effects.c index 59dcc4e6..17948bb8 100644 --- a/src/buttons_effects.c +++ b/src/buttons_effects.c @@ -169,16 +169,13 @@ void Button_Constraint_mode(void) { if (Main_backups->Pages->Image_mode == IMAGE_MODE_LAYERED) { - Main_backups->Pages->Image_mode = IMAGE_MODE_MODE5; + if (Main_backups->Pages->Nb_layers!=5 || (Main_image_width%48)) + { + Verbose_message("Error!", "This emulation of Amstrad CPC's Mode5 can only be used on a 5-layer image whose width is a multiple of 48."); + return; + } // TODO backup - // CPC Mode 5 - ensure there are at least 5 layers - while(Main_backups->Pages->Nb_layers < 5) - { - Add_layer(Main_backups, 0); - // Add layers below, so the picture is kept on the top one - // (the valuable pixel data) - } - + Main_backups->Pages->Image_mode = IMAGE_MODE_MODE5; // TODO set the palette to a CPC one ? } else if (Main_backups->Pages->Image_mode == IMAGE_MODE_MODE5)