fixed bug with loading artwork if only one special artwork set exists
authorHolger Schemel <info@artsoft.org>
Thu, 23 Nov 2023 23:21:38 +0000 (00:21 +0100)
committerHolger Schemel <info@artsoft.org>
Thu, 23 Nov 2023 23:42:44 +0000 (00:42 +0100)
R'n'D supports using additional special artwork, like "ECS" and "AGA"
graphics sets or "default" and "lowpass" sound sets, which can be
selected from the game engines setup menu. This works fine if both
artwork sets are defined (and also if no special artwork is defined).

However, it did not work correctly if only one special artwork set was
defined, in addition to the "standard" artwork set, like this:

graphics_set:                   gfx_bond_mine_01
graphics_set.aga:               gfx_bond_mine_01.aga

In this case, it was not possible to use the "standard" graphics set,
but only the "AGA" graphics set (because the "standard" graphics set
was internally overridden by the "AGA" graphics set when selecting to
use "AGA" graphics in the game engines setup menu, and selecting to
use "ECS" graphics later could not recover this). (This bug could be
seen in level set "emc_bond_mine_01" when starting the game with "AGA"
graphics preferred in the setup menu, which resulted in not being able
to select the "standard" graphics by setting graphics preference to
"ECS" in the game engines setup menu.)

This is fixed now (by internally setting the "ECS" artwork set, which
is not explicitly defined, to the "standard" artwork before internally
overriding it with either the "ECS" or "AGA" graphics set).

This bug was caused by commit 4bc6719c.

src/libgame/setup.c

index db49f46739e511710e53df7e1ea85059e5cf6f68..493fc74e53283bc6dacc901bc5e6e7ec783c4e5d 100644 (file)
@@ -1713,12 +1713,26 @@ static boolean adjustTreeArtworkForEMC(char **artwork_set_1,
                                       char **artwork_set_2,
                                       char **artwork_set, boolean prefer_2)
 {
+  // do nothing if neither special artwork set 1 nor 2 are defined
+  if (!*artwork_set_1 && !*artwork_set_2)
+    return FALSE;
+
   boolean want_1 = (prefer_2 == FALSE);
   boolean want_2 = (prefer_2 == TRUE);
   boolean has_only_1 = (!*artwork_set && !*artwork_set_2);
   boolean has_only_2 = (!*artwork_set && !*artwork_set_1);
   char *artwork_set_new = NULL;
 
+  // replace missing special artwork 1 or 2 with (optional) standard artwork
+
+  if (!*artwork_set_1)
+    setString(artwork_set_1, *artwork_set);
+
+  if (!*artwork_set_2)
+    setString(artwork_set_2, *artwork_set);
+
+  // set standard artwork to either special artwork 1 or 2, as requested
+
   if (*artwork_set_1 && (want_1 || has_only_1))
     artwork_set_new = *artwork_set_1;