Commit e137ee5d authored by ROOL's avatar ROOL 🤖

Fix to artist friendly remapping

Detail:
  Remapping would never occur if the confirmation box was disabled.
Admin:
  Submission for the Paint bounty.

Version 2.28. Not tagged
parent b886fe56
...@@ -1606,6 +1606,21 @@ static void Apply_Colour (dboxtcol_colour col, void *handle) ...@@ -1606,6 +1606,21 @@ static void Apply_Colour (dboxtcol_colour col, void *handle)
{ main_sprite *sprite = (main_sprite *) handle; { main_sprite *sprite = (main_sprite *) handle;
sprite_header *spr = psprite_address (sprite); sprite_header *spr = psprite_address (sprite);
/* If we need to remap the palette layout to artist-friendly
without showing the confirmation dbox, then we must do it AFTER
the user has edited the colour, so it's on a click rather than
just a menu hit */
BOOL could_remap = main_current_options.advanced.artist_friendly
&& main_current_options.advanced.remap_palette
&& colours_is_artist_friendly (sprite);
if (could_remap && !main_current_options.advanced.ask_remap_palette)
{ sprite->artistfriendly = artist_friendly;
colours_remap_to_artist_friendly (sprite);
/* Don't forget to remap the currently selected colours too! */
sprite->gcol.colour = colours_get_artist_friendly_index (sprite->gcol.colour, sprite);
sprite->gcol2.colour = colours_get_artist_friendly_index (sprite->gcol2.colour, sprite);
sprite->artistfriendly = artist_unfriendly;
}
int *colour = &(&spr->mode + 1) [2*sprite->gcol.colour]; int *colour = &(&spr->mode + 1) [2*sprite->gcol.colour];
ftracef0 ("Apply_Colour\n"); ftracef0 ("Apply_Colour\n");
...@@ -2108,25 +2123,11 @@ void menus_sprite_handler (void *handle, char *hit) ...@@ -2108,25 +2123,11 @@ void menus_sprite_handler (void *handle, char *hit)
/* Enable nulls, so slider drags work */ /* Enable nulls, so slider drags work */
event_setmask ((wimp_emask) (((emask = event_getmask ()) & ~wimp_EMNULL))); event_setmask ((wimp_emask) (((emask = event_getmask ()) & ~wimp_EMNULL)));
BOOL chosen = dboxtcol (colour, /*allow transparent?*/ FALSE, dboxtcol (colour, /*allow transparent?*/ FALSE,
msgs_lookup ("PntW8"), &Apply_Colour, (void *) sprite); msgs_lookup ("PntW8"), &Apply_Colour, (void *) sprite);
event_setmask (emask); event_setmask (emask);
/* If we need to remap the palette layout to artist-friendly
without showing the confirmation dbox, then we must do it AFTER
the user has edited the colour, so it's on a click rather than
just a menu hit */
if (chosen && couldRemap &&
!main_current_options.advanced.ask_remap_palette)
{ colours_remap_to_artist_friendly (sprite);
/* Don't forget to remap the currently selected colours too! */
sprite->gcol.colour = colours_get_artist_friendly_index (sprite->gcol.colour, sprite);
sprite->gcol2.colour = colours_get_artist_friendly_index (sprite->gcol2.colour, sprite);
sprite_palette_has_changed (sprite);
sprite->artistfriendly = artist_unfriendly;
}
destroy_artistfriendly_dbox (); destroy_artistfriendly_dbox ();
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment