[Scummvm-git-logs] scummvm master -> 993e2d58903ed0fde6ce5e2a4d43dda697b941bd

bluegr bluegr at gmail.com
Sun Nov 8 20:34:19 UTC 2020


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
8cfef6c696 SCI: Add GUIO flags for hires SCI16 games and SQ4 CD
e9e30b0c23 SCI: Change the generated SCIFX code to arrays
993e2d5890 NEWS: Mention the support of SCI Korean fan translated games


Commit: 8cfef6c69614a6c2076fa1db008f29a92d0890f0
    https://github.com/scummvm/scummvm/commit/8cfef6c69614a6c2076fa1db008f29a92d0890f0
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2020-11-08T22:27:46+02:00

Commit Message:
SCI: Add GUIO flags for hires SCI16 games and SQ4 CD

Changed paths:
    engines/sci/detection_tables.h


diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index b77904e4f1..f36c28f6cf 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -23,6 +23,7 @@
 namespace Sci {
 
 #define GUIO_STD16 GUIO5(GUIO_NOSPEECH, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_MIDI_MODE, GAMEOPTION_RGB_RENDERING)
+#define GUIO_STD16_HIRES GUIO6(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_MIDI_MODE, GAMEOPTION_RGB_RENDERING)
 #define GUIO_STD16_UNDITHER GUIO6(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_MIDI_MODE, GAMEOPTION_RGB_RENDERING)
 #define GUIO_STD16_PALETTEMODS GUIO7(GUIO_NOSPEECH, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_MIDI_MODE, GAMEOPTION_RGB_RENDERING, GAMEOPTION_PALETTE_MODS)
 #define GUIO_STD16_SPEECH GUIO4(GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_MIDI_MODE, GAMEOPTION_RGB_RENDERING)
@@ -189,7 +190,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		{"resource.000", 0, "27ec5fa09cd12a7fd16e86d96a2ed245", 548272},
 		{"resource.001", 0, "7c3e82c390e934de9b7afcab6de9cec4", 1117317},
 		AD_LISTEND},
-		Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO6(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_MIDI_MODE, GAMEOPTION_RGB_RENDERING)	},
+		Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO_STD16_HIRES	},
 
 #ifdef ENABLE_SCI32
 	// Inside the Chest / Behind the Developer's Shield
@@ -1949,7 +1950,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		{"resource.004", 0, "e114ce8f884601c43308fb5cbbea4874", 1174129},
 		{"resource.005", 0, "349ad9438172265d00680075c5a988d0", 1019669},
 		AD_LISTEND},
-		Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO6(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_MIDI_MODE, GAMEOPTION_RGB_RENDERING)	},
+		Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO_STD16_HIRES	},
 
 	// King's Quest 6 - English DOS Non-Interactive Demo
 	// Executable scanning reports "1.001.055", VERSION file reports "1.000.000"
@@ -5126,6 +5127,19 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		AD_LISTEND},
 		Common::EN_ANY, Common::kPlatformMacintosh, ADGF_UNSTABLE, GUIO_STD16_PALETTEMODS	},
 
+#define GUIO_SQ4_CD GUIO5(GAMEOPTION_SQ4_SILVER_CURSORS,	\
+                          GAMEOPTION_PREFER_DIGITAL_SFX,	\
+                          GAMEOPTION_ORIGINAL_SAVELOAD,		\
+                          GAMEOPTION_MIDI_MODE,				\
+                          GAMEOPTION_RGB_RENDERING)
+
+#define GUIO_SQ4_CD_WINDOWS GUIO6(GUIO_MIDIGM				\
+                          GAMEOPTION_SQ4_SILVER_CURSORS,	\
+	                      GAMEOPTION_PREFER_DIGITAL_SFX,	\
+	                      GAMEOPTION_ORIGINAL_SAVELOAD,		\
+	                      GAMEOPTION_MIDI_MODE,				\
+	                      GAMEOPTION_RGB_RENDERING)
+
 	// Space Quest 4 - English Amiga
 	// Executable scanning reports "1.004.024"
 	// SCI interpreter version 1.000.200
@@ -5261,7 +5275,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		{"resource.001", 0, "454684e3a7a68cbca073945e50778447", 1187088},
 		{"resource.002", 0, "6dc668326cc22cb9e8bd8ca9e68d2a66", 1181249},
 		AD_LISTEND},
-		Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO6(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_MIDI_MODE, GAMEOPTION_RGB_RENDERING)	},
+		Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO_STD16_HIRES	},
 
 	// Space Quest 4 - Japanese PC-98 5.25" Floppy (also includes english language)
 	// SCI interpreter version 1.000.1068
@@ -5271,7 +5285,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		{"resource.001", 0, "454684e3a7a68cbca073945e50778447", 1187088},
 		{"resource.002", 0, "6dc668326cc22cb9e8bd8ca9e68d2a66", 1181249},
 		AD_LISTEND},
-		Common::EN_ANY, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO6(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_MIDI_MODE, GAMEOPTION_RGB_RENDERING)	},
+		Common::EN_ANY, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO_STD16_HIRES	},
 
 	// Space Quest 4 - English DOS CD (from the Space Quest Collection)
 	// Executable scanning reports "1.001.064", VERSION file reports "1.0"
@@ -5279,7 +5293,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		{"resource.map", 0, "ed90a8e3ccc53af6633ff6ab58392bae", 7054},
 		{"resource.000", 0, "63247e3901ab8963d4eece73747832e0", 5157378},
 		AD_LISTEND},
-		Common::EN_ANY, Common::kPlatformDOS, ADGF_CD, GUIO5(GAMEOPTION_SQ4_SILVER_CURSORS, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_MIDI_MODE, GAMEOPTION_RGB_RENDERING)	},
+		Common::EN_ANY, Common::kPlatformDOS, ADGF_CD, GUIO_SQ4_CD	},
 
 	// Space Quest 4 - English Windows CD (from the Space Quest Collection)
 	// Executable scanning reports "1.001.064", VERSION file reports "1.0"
@@ -5289,7 +5303,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		{"resource.map", 0, "ed90a8e3ccc53af6633ff6ab58392bae", 7054},
 		{"resource.000", 0, "63247e3901ab8963d4eece73747832e0", 5157378},
 		AD_LISTEND},
-		Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO6(GUIO_MIDIGM, GAMEOPTION_SQ4_SILVER_CURSORS, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_MIDI_MODE, GAMEOPTION_RGB_RENDERING)	},
+		Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO_SQ4_CD_WINDOWS	},
 
 	// Space Quest 4 - Korean fan translation, based on English DOS CD (from the Space Quest Collection)
 	// Executable scanning reports "1.001.064", VERSION file reports "1.0"
@@ -5309,7 +5323,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		{"resource.map", 0, "38287a646458a1dabded55d094407793", 7139},
 		{"resource.000", 0, "231fd8421e1f211e1bcf9d7b8b6408e7", 9525849},
 		AD_LISTEND},
-		Common::EN_ANY, Common::kPlatformDOS, ADGF_PIRATED, GUIO5(GAMEOPTION_SQ4_SILVER_CURSORS, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_MIDI_MODE, GAMEOPTION_RGB_RENDERING)	},
+		Common::EN_ANY, Common::kPlatformDOS, ADGF_PIRATED, GUIO_SQ4_CD	},
 
 	// Space Quest 4 - Spanish DOS CD (from jvprat, is still text only, not talkie, also includes english language)
 	// Executable scanning reports "1.SQ4.057", VERSION file reports "1.000"
@@ -5323,7 +5337,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		{"resource.004", 0, "776fba81c110d1908776232cbe190e20", 1253752},
 		{"resource.005", 0, "55fae26c2a92f16ef72c1e216e827c0f", 1098328},
 		AD_LISTEND},
-		Common::ES_ESP, Common::kPlatformDOS, ADGF_ADDENGLISH, GUIO5(GAMEOPTION_SQ4_SILVER_CURSORS, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_MIDI_MODE, GAMEOPTION_RGB_RENDERING)	},
+		Common::ES_ESP, Common::kPlatformDOS, ADGF_ADDENGLISH, GUIO_SQ4_CD	},
 
 	// Space Quest 4 - Spanish DOS Floppy (from jvprat, also includes english language)
 	// Executable scanning reports "1.SQ4.056", VERSION file reports "1.000"
@@ -5379,6 +5393,9 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		AD_LISTEND},
 		Common::RU_RUS, Common::kPlatformDOS, 0, GUIO_STD16	},
 
+#undef GUIO_SQ4_CD
+#undef GUIO_SQ4_CD_WINDOWS
+
 	// Space Quest 5 - English DOS (from the Space Quest Collection)
 	// Executable scanning reports "1.001.068", VERSION file reports "1.04"
 	{"sq5", "", {


Commit: e9e30b0c239c71427a7bb949ce5fc7202e10546e
    https://github.com/scummvm/scummvm/commit/e9e30b0c239c71427a7bb949ce5fc7202e10546e
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2020-11-08T22:27:46+02:00

Commit Message:
SCI: Change the generated SCIFX code to arrays

The end result of these rules is palette adjustments, so there's no
reason to create custom code for each effect. Searching for palette
mods has an O(n) complexity, but the dataset is quite small, so it
should be negligible.

Changed paths:
    devtools/sci/scifx/scifx_to_cpp.py
    engines/sci/graphics/helpers.h
    engines/sci/graphics/scifx.cpp
    engines/sci/graphics/scifx.h


diff --git a/devtools/sci/scifx/scifx_to_cpp.py b/devtools/sci/scifx/scifx_to_cpp.py
index 864ecdf95e..fb97b2981d 100644
--- a/devtools/sci/scifx/scifx_to_cpp.py
+++ b/devtools/sci/scifx/scifx_to_cpp.py
@@ -37,53 +37,66 @@ print("""
 namespace Sci {
 """)
 
+def Chunker(seq, size):
+    return (seq[pos:pos + size] for pos in range(0, len(seq), size))
+
 def ModToIndex(m):
   try:
-    return M.index(m)
+    return Mods.index(m)
   except ValueError:
-    M.append(m)
-    return len(M)-1
+    Mods.append(m)
+    return len(Mods)-1
 
 def PrintMods():
-  L = [ "\t{ " + ", ".join( [ "%4d" % (round(128 * (val - 1)),) for val in m ] )  + " }" for m in M ]
+  L = [ "\t{ " + ", ".join( [ "%4d" % (round(128 * (val - 1)),) for val in m ] )  + " }" for m in Mods ]
   print("static const PaletteMod paletteMods" + GID + "[] = {")
   print( ",\n".join(L) )
   print("};")
 
-def PrintPic(pic):
-  print("static void doCustomPic" + GID + "(GfxScreen *screen, int x) {")
-  print("\tbyte val = 0;")
-  print(pic)
-  print("\tif (val)")
-  print("\t\tscreen->setCurPaletteMapValue(val);")
-  print("}")
-
-def PrintView(view):
-  print("static void doCustomView" + GID + "(GfxScreen *screen, int x, int y, int z) {")
-  print("\tbyte val = 0;")
-  print(view)
-  print("\tif (val)")
-  print("\t\tscreen->setCurPaletteMapValue(val);")
-  print("}")
-
-def ParseList(l, v):
+def PrintPic(pics, comments):
+  print("static const PicMod picMods" + GID + "[] = {")
+
+  for comment in comments:
+    print("\t// " + comment)
+
+  for chunk in Chunker(pics, 5):
+    t = ""
+    for pic in chunk:
+      t = t + "{ " + str(pic[0]).rjust(3, ' ') + ", " + str(pic[1]).rjust(2, ' ') + " }, "
+    print("\t" + t)
+
+  print("};")
+
+def PrintView(views, comments):
+  print("static const ViewMod viewMods" + GID + "[] = {")
+
+  for comment in comments:
+    print("\t// " + comment)
+
+  for chunk in Chunker(views, 5):
+    t = ""
+    for view in chunk:
+      t = t + "{ " + str(view[0]).rjust(3, ' ') + ", " + str(view[1]).rjust(2, ' ') + ", " + str(view[2]).rjust(2, ' ') + ", " + str(view[3]).rjust(2, ' ') + " }, "
+    print("\t" + t)
+
+  print("};")
+
+def ParseList(l):
   assert(l[0] == '(')
   e = l.find(")")
   L = l[1:e].split(",")
-  tests = ""
+  tests = []
   for t in L:
     t = t.strip()
     ell = t.find('..')
     if ell >= 0:
+      start = int(t[0:ell])
+      end = int(t[ell+2:])
       # interval
-      test = "(" + v + " >= " + t[0:ell] + " && " + v + " <= " + t[ell+2:] + ")"
-    else:
-      test = v + " == " + t
-    if tests:
-      tests = tests + " || " + test
+      for x in range(start, end + 1):
+        tests.append(x)
     else:
-      tests = test
-  tests = "(" + tests + ")"
+      tests.append(t)
   return l[e+1:], tests
 
 def ParseTriple(l):
@@ -96,10 +109,11 @@ def ParseTriple(l):
 GIDs = []
 
 for F in sys.argv[1:]:
-  pic = ""
-  view = ""
-  M = [(1.,1.,1.)]
-  GID=""
+  comments = []
+  pics = []
+  views = []
+  Mods = [(1.,1.,1.)]
+  GID = ""
 
   for l in open(F, "r").readlines():
     l = l.strip()
@@ -107,8 +121,9 @@ for F in sys.argv[1:]:
       continue
     if l[0] == '#':
       comment = l[1:].strip()
-      pic += "	// " + comment + "\n"
-      view += "	// " + comment + "\n"
+      # Only add the top comments (before the game ID is set)
+      if (GID == ""):
+        comments.append(comment)
       continue
     if l[0:6] == "gameid":
       assert(GID == "")
@@ -128,15 +143,14 @@ for F in sys.argv[1:]:
     else:
       assert(False)
   
-    S = ""
-    l,t = ParseList(l, "x")
-    S = S + "\tif " + t + "\n	"
+    ids = []
+    loops = [-1]
+    cels = [-1]
+    l,ids = ParseList(l)
     if l[0] == "(":
-      l,t = ParseList(l, "y")
-      S = S + "\tif " + t + "\n		"
+      l,loops = ParseList(l)
     if l[0] == "(":
-      l,t = ParseList(l, "z")
-      S = S + "\tif " + t + "\n			"
+      l,cels = ParseList(l)
     l = l.strip()
     assert(l[0:2] == "*=")
     assert(l[-1] == ";")
@@ -146,11 +160,14 @@ for F in sys.argv[1:]:
       val = (float(v) for v in val)
     else:
       val = (float(l), float(l), float(l))
-    S = S + "\tval = " + str(ModToIndex(val)) + ";     // color * " + l + "\n"
     if ruletype == "pic":
-      pic = pic + S
+      for pic in ids:
+        pics.append([pic, ModToIndex(val)])
     elif ruletype == "view":
-      view = view + S
+      for view in ids:
+        for loop in loops:
+          for cel in cels:
+            views.append([view, loop, cel, ModToIndex(val)])
 
   if GID == "":
     raise ValueError("No gameid specified")
@@ -159,45 +176,56 @@ for F in sys.argv[1:]:
 
   PrintMods()
   print()
-  PrintPic(pic)
+  PrintPic(pics, comments)
   print()
-  PrintView(view)
+  PrintView(views, comments)
   print()
 
-print("void setupCustomPaletteMods(GfxScreen *screen) {")
-print("\tswitch (g_sci->getGameId()) {")
+print("static const SciFxMod mods[] = {")
 for GID in GIDs:
-  print("\tcase GID_" + GID + ":")
-  print("\t\tscreen->setPaletteMods(paletteMods" + GID + ", ARRAYSIZE(paletteMods" + GID + "));")
-  print("\t\tbreak;")
-print("\tdefault:")
-print("\t\tbreak;")
-print("\t}")
-print("}")
-print()
-
-print("void doCustomViewPalette(GfxScreen *screen, int x, int y, int z) {")
-print("\tswitch (g_sci->getGameId()) {")
-for GID in GIDs:
-  print("\tcase GID_" + GID + ":")
-  print("\t\tdoCustomView" + GID + "(screen, x, y, z);")
-  print("\t\tbreak;")
-print("\tdefault:")
-print("\t\tbreak;")
-print("\t}")
-print("}")
-print()
-
-print("void doCustomPicPalette(GfxScreen *screen, int x) {")
-print("\tswitch (g_sci->getGameId()) {")
-for GID in GIDs:
-  print("\tcase GID_" + GID + ":")
-  print("\t\tdoCustomPic" + GID + "(screen, x);")
-  print("\t\tbreak;")
-print("\tdefault:")
-print("\t\tbreak;")
-print("\t}")
-print("}")
-print()
-
-print("}")
+  print("\t{{ GID_{0}, paletteMods{0}, ARRAYSIZE(paletteMods{0}), picMods{0}, ARRAYSIZE(picMods{0}), viewMods{0}, ARRAYSIZE(viewMods{0}) }},".format(GID));
+print("};")
+
+print("""
+void setupCustomPaletteMods(GfxScreen *screen) {
+	for (int i = 0; i < ARRAYSIZE(mods); i++) {
+		if (mods[i].gameId == g_sci->getGameId()) {
+			screen->setPaletteMods(mods[i].paletteMods, mods[i].paletteModsSize);
+			break;
+		}
+	}
+}
+
+void doCustomViewPalette(GfxScreen *screen, GuiResourceId view, int16 loop, int16 cel) {
+	for (int i = 0; i < ARRAYSIZE(mods); i++) {
+		SciFxMod mod = mods[i];
+		if (mod.gameId == g_sci->getGameId()) {
+			for (int j = 0; j < mod.viewModsSize; j++) {
+				ViewMod m = mod.viewMods[j];
+				if (m.id == view && (m.loop == -1 || m.loop == loop) && (m.cel == -1 || m.cel == cel)) {
+					screen->setCurPaletteMapValue(m.multiplier);
+					break;
+				}
+			}
+			break;
+		}
+	}
+}
+
+void doCustomPicPalette(GfxScreen *screen, GuiResourceId pic) {
+	for (int i = 0; i < ARRAYSIZE(mods); i++) {
+		SciFxMod mod = mods[i];
+		if (mod.gameId == g_sci->getGameId()) {
+			for (int j = 0; j < mod.picModsSize; j++) {
+				PicMod m = mod.picMods[j];
+				if (m.id == pic) {
+					screen->setCurPaletteMapValue(m.multiplier);
+					break;
+				}
+			}
+			break;
+		}
+	}
+}
+
+}""")
diff --git a/engines/sci/graphics/helpers.h b/engines/sci/graphics/helpers.h
index 9ca1346c4c..fcc24cda5e 100644
--- a/engines/sci/graphics/helpers.h
+++ b/engines/sci/graphics/helpers.h
@@ -31,6 +31,7 @@
 #include "graphics/pixelformat.h"
 #include "graphics/surface.h"
 #endif
+#include "sci/detection.h"
 #include "sci/engine/vm_types.h"
 #include "sci/graphics/helpers_detection_enums.h" // for enum ViewType
 
@@ -269,6 +270,28 @@ struct PaletteMod {
 	int8 r, g, b;
 };
 
+struct PicMod {
+	uint16 id;
+	byte multiplier;
+};
+
+struct ViewMod {
+	uint16 id;
+	int16 loop;
+	int16 cel;
+	byte multiplier;
+};
+
+struct SciFxMod {
+	SciGameId gameId;
+	const PaletteMod *paletteMods;
+	const int paletteModsSize;
+	const PicMod *picMods;
+	const int picModsSize;
+	const ViewMod *viewMods;
+	const int viewModsSize;
+};
+
 struct PalSchedule {
 	byte from;
 	uint32 schedule;
diff --git a/engines/sci/graphics/scifx.cpp b/engines/sci/graphics/scifx.cpp
index 81d8361712..d296be5d27 100644
--- a/engines/sci/graphics/scifx.cpp
+++ b/engines/sci/graphics/scifx.cpp
@@ -49,112 +49,70 @@ static const PaletteMod paletteModsLSL2[] = {
 	{   13,    0,    0 }
 };
 
-static void doCustomPicLSL2(GfxScreen *screen, int x) {
-	byte val = 0;
+static const PicMod picModsLSL2[] = {
 	// LSL2 per-resource palette configuration
 	// Copyright (C) 2006 Matt Hargett
-	// ego
-	if (x == 28 || x == 99)
-		val = 1;     // color * 1.25
-	if (x == 96)
-		val = 5;     // color * 1.1
-	if (x == 92 || x == 93 || x == 18 || (x >= 20 && x <= 26) || x == 134 || x == 40 || x == 50 || (x >= 76 && x <= 82) || x == 181)
-		val = 2;     // color * 0.9
-	if ((x >= 114 && x <= 118) || x == 125 || (x >= 11 && x <= 17) || x == 19 || x == 43 || (x >= 70 && x <= 74) || x == 44 || x == 86 || (x >= 101 && x <= 104) || x == 32 || x == 33 || x == 35 || x == 36 || x == 95)
-		val = 13;     // color * 0.85
-	// titles
-	if (x == 10 || x == 90 || x == 91)
-		val = 15;     // color * 0.4
-	// misc effects
-
-	if (val)
-		screen->setCurPaletteMapValue(val);
-}
+	{  28,  1 }, {  99,  1 }, {  96,  5 }, {  92,  2 }, {  93,  2 }, 
+	{  18,  2 }, {  20,  2 }, {  21,  2 }, {  22,  2 }, {  23,  2 }, 
+	{  24,  2 }, {  25,  2 }, {  26,  2 }, { 134,  2 }, {  40,  2 }, 
+	{  50,  2 }, {  76,  2 }, {  77,  2 }, {  78,  2 }, {  79,  2 }, 
+	{  80,  2 }, {  81,  2 }, {  82,  2 }, { 181,  2 }, { 114, 13 }, 
+	{ 115, 13 }, { 116, 13 }, { 117, 13 }, { 118, 13 }, { 125, 13 }, 
+	{  11, 13 }, {  12, 13 }, {  13, 13 }, {  14, 13 }, {  15, 13 }, 
+	{  16, 13 }, {  17, 13 }, {  19, 13 }, {  43, 13 }, {  70, 13 }, 
+	{  71, 13 }, {  72, 13 }, {  73, 13 }, {  74, 13 }, {  44, 13 }, 
+	{  86, 13 }, { 101, 13 }, { 102, 13 }, { 103, 13 }, { 104, 13 }, 
+	{  32, 13 }, {  33, 13 }, {  35, 13 }, {  36, 13 }, {  95, 13 }, 
+	{  10, 15 }, {  90, 15 }, {  91, 15 }, 
+};
 
-static void doCustomViewLSL2(GfxScreen *screen, int x, int y, int z) {
-	byte val = 0;
+static const ViewMod viewModsLSL2[] = {
 	// LSL2 per-resource palette configuration
 	// Copyright (C) 2006 Matt Hargett
-	// ego
-	if (x == 507 || x == 155 || x == 161 || x == 163 || x == 170 || x == 197 || x == 198 || x == 431 || x == 432 || (x >= 145 && x <= 159) || (x >= 131 && x <= 141) || x == 191 || x == 104 || x == 244 || x == 215 || x == 217 || x == 219 || x == 100 || x == 101 || x == 110 || x == 111 || x == 112 || x == 113 || x == 192 || x == 193 || x == 604 || (x >= 704 && x <= 706) || x == 717 || x == 718 || x == 818 || x == 819 || x == 822 || x == 823 || x == 824 || x == 831 || x == 832 || x == 833 || x == 834 || x == 835)
-		val = 1;     // color * 1.25
-	if (x == 218)
-		if (y == 3)
-			val = 1;     // color * 1.25
-	if (x == 218)
-		if ((y >= 0 && y <= 2))
-			val = 2;     // color * 0.9
-	if (x == 820)
-		if (y == 0 || y == 1)
-			val = 2;     // color * 0.9
-	if (x == 227 || x == 224 || x == 206 || x == 208 || x == 209 || x == 220)
-		val = 2;     // color * 0.9
-	if (x == 221 || x == 254 || x == 252)
-		val = 3;     // color * 0.7
-	if (x == 820)
-		if ((y >= 2 && y <= 4))
-			val = 4;     // color * 1.2
-	if (x == 816)
-		if (y == 5)
-			if (z == 0)
-				val = 4;     // color * 1.2
-	if (x == 516 || x == 509 || (x >= 501 && x <= 504) || (x >= 401 && x <= 403) || x == 408 || x == 409 || x == 411 || x == 413 || x == 414 || x == 417 || x == 418 || x == 419 || x == 430 || x == 310 || x == 302 || x == 303 || (x >= 120 && x <= 124) || x == 232 || x == 223 || x == 208 || x == 710 || x == 716 || x == 714)
-		val = 5;     // color * 1.1
-	if ((x >= 434 && x <= 438) || x == 311 || x == 313 || x == 316 || x == 319 || x == 321 || x == 323 || x == 324 || (x >= 306 && x <= 309) || x == 248 || x == 245 || x == 246 || (x >= 233 && x <= 235) || x == 237 || x == 226 || x == 229 || x == 222 || x == 203 || x == 204 || x == 205 || x == 600 || x == 525 || x == 524 || x == 523 || x == 522 || x == 520 || x == 602 || x == 605 || x == 608 || (x >= 707 && x <= 708))
-		val = 4;     // color * 1.2
-	if (x == 305)
-		if (y == 4)
-			val = 5;     // color * 1.1
-	if (x == 305)
-		if ((y >= 0 && y <= 3))
-			val = 6;     // color * 0.6
-	if (x == 661)
-		if (y == 0 || y == 1 || (y >= 3 && y <= 5))
-			val = 4;     // color * 1.2
-	if (x == 661)
-		if (y == 2)
-			val = 3;     // color * 0.7
-	if (x == 711 || x == 712 || x == 713 || x == 60)
-		val = 7;     // color * (0.9, 1.0, 1.0)
-	if (x == 816)
-		if ((y >= 0 && y <= 4))
-			val = 2;     // color * 0.9
-	if (x == 506 || x == 508 || x == 500 || x == 252 || x == 803 || x == 804 || x == 433)
-		val = 6;     // color * 0.6
-	if (x == 513)
-		if ((y >= 0 && y <= 5))
-			val = 8;     // color * 0.5
-	if ((x >= 240 && x <= 243) || x == 701 || x == 722)
-		val = 9;     // color * 0.8
-	if (x == 700)
-		if (y == 1)
-			val = 10;     // color * (0.6, 0.9, 1.0)
-	if (x == 610 || x == 611)
-		val = 11;     // color * (0.9, 1.0, 1.1)
-	if (x == 607)
-		if (y == 1)
-			val = 9;     // color * 0.8
-	if (x == 253 || x == 228 || x == 247 || x == 300 || x == 326)
-		val = 9;     // color * 0.8
-	if (x == 412)
-		val = 12;     // color * 1.3
-	// titles
-	if (x == 800 || x == 801)
-		val = 14;     // color * 1.5
-	// misc effects
-	if (x == 702)
-		val = 16;     // color * (1.1, 1.0, 1.0)
-	if (x == 519)
-		val = 9;     // color * 0.8
-	if (x == 200)
-		if (y == 0)
-			val = 3;     // color * 0.7
-	if (x == 201 || x == 202)
-		val = 9;     // color * 0.8
-
-	if (val)
-		screen->setCurPaletteMapValue(val);
-}
+	{ 507, -1, -1,  1 }, { 155, -1, -1,  1 }, { 161, -1, -1,  1 }, { 163, -1, -1,  1 }, { 170, -1, -1,  1 }, 
+	{ 197, -1, -1,  1 }, { 198, -1, -1,  1 }, { 431, -1, -1,  1 }, { 432, -1, -1,  1 }, { 145, -1, -1,  1 }, 
+	{ 146, -1, -1,  1 }, { 147, -1, -1,  1 }, { 148, -1, -1,  1 }, { 149, -1, -1,  1 }, { 150, -1, -1,  1 }, 
+	{ 151, -1, -1,  1 }, { 152, -1, -1,  1 }, { 153, -1, -1,  1 }, { 154, -1, -1,  1 }, { 155, -1, -1,  1 }, 
+	{ 156, -1, -1,  1 }, { 157, -1, -1,  1 }, { 158, -1, -1,  1 }, { 159, -1, -1,  1 }, { 131, -1, -1,  1 }, 
+	{ 132, -1, -1,  1 }, { 133, -1, -1,  1 }, { 134, -1, -1,  1 }, { 135, -1, -1,  1 }, { 136, -1, -1,  1 }, 
+	{ 137, -1, -1,  1 }, { 138, -1, -1,  1 }, { 139, -1, -1,  1 }, { 140, -1, -1,  1 }, { 141, -1, -1,  1 }, 
+	{ 191, -1, -1,  1 }, { 104, -1, -1,  1 }, { 244, -1, -1,  1 }, { 215, -1, -1,  1 }, { 217, -1, -1,  1 }, 
+	{ 219, -1, -1,  1 }, { 100, -1, -1,  1 }, { 101, -1, -1,  1 }, { 110, -1, -1,  1 }, { 111, -1, -1,  1 }, 
+	{ 112, -1, -1,  1 }, { 113, -1, -1,  1 }, { 192, -1, -1,  1 }, { 193, -1, -1,  1 }, { 604, -1, -1,  1 }, 
+	{ 704, -1, -1,  1 }, { 705, -1, -1,  1 }, { 706, -1, -1,  1 }, { 717, -1, -1,  1 }, { 718, -1, -1,  1 }, 
+	{ 818, -1, -1,  1 }, { 819, -1, -1,  1 }, { 822, -1, -1,  1 }, { 823, -1, -1,  1 }, { 824, -1, -1,  1 }, 
+	{ 831, -1, -1,  1 }, { 832, -1, -1,  1 }, { 833, -1, -1,  1 }, { 834, -1, -1,  1 }, { 835, -1, -1,  1 }, 
+	{ 218,  3, -1,  1 }, { 218,  0, -1,  2 }, { 218,  1, -1,  2 }, { 218,  2, -1,  2 }, { 820,  0, -1,  2 }, 
+	{ 820,  1, -1,  2 }, { 227, -1, -1,  2 }, { 224, -1, -1,  2 }, { 206, -1, -1,  2 }, { 208, -1, -1,  2 }, 
+	{ 209, -1, -1,  2 }, { 220, -1, -1,  2 }, { 221, -1, -1,  3 }, { 254, -1, -1,  3 }, { 252, -1, -1,  3 }, 
+	{ 820,  2, -1,  4 }, { 820,  3, -1,  4 }, { 820,  4, -1,  4 }, { 816,  5,  0,  4 }, { 516, -1, -1,  5 }, 
+	{ 509, -1, -1,  5 }, { 501, -1, -1,  5 }, { 502, -1, -1,  5 }, { 503, -1, -1,  5 }, { 504, -1, -1,  5 }, 
+	{ 401, -1, -1,  5 }, { 402, -1, -1,  5 }, { 403, -1, -1,  5 }, { 408, -1, -1,  5 }, { 409, -1, -1,  5 }, 
+	{ 411, -1, -1,  5 }, { 413, -1, -1,  5 }, { 414, -1, -1,  5 }, { 417, -1, -1,  5 }, { 418, -1, -1,  5 }, 
+	{ 419, -1, -1,  5 }, { 430, -1, -1,  5 }, { 310, -1, -1,  5 }, { 302, -1, -1,  5 }, { 303, -1, -1,  5 }, 
+	{ 120, -1, -1,  5 }, { 121, -1, -1,  5 }, { 122, -1, -1,  5 }, { 123, -1, -1,  5 }, { 124, -1, -1,  5 }, 
+	{ 232, -1, -1,  5 }, { 223, -1, -1,  5 }, { 208, -1, -1,  5 }, { 710, -1, -1,  5 }, { 716, -1, -1,  5 }, 
+	{ 714, -1, -1,  5 }, { 434, -1, -1,  4 }, { 435, -1, -1,  4 }, { 436, -1, -1,  4 }, { 437, -1, -1,  4 }, 
+	{ 438, -1, -1,  4 }, { 311, -1, -1,  4 }, { 313, -1, -1,  4 }, { 316, -1, -1,  4 }, { 319, -1, -1,  4 }, 
+	{ 321, -1, -1,  4 }, { 323, -1, -1,  4 }, { 324, -1, -1,  4 }, { 306, -1, -1,  4 }, { 307, -1, -1,  4 }, 
+	{ 308, -1, -1,  4 }, { 309, -1, -1,  4 }, { 248, -1, -1,  4 }, { 245, -1, -1,  4 }, { 246, -1, -1,  4 }, 
+	{ 233, -1, -1,  4 }, { 234, -1, -1,  4 }, { 235, -1, -1,  4 }, { 237, -1, -1,  4 }, { 226, -1, -1,  4 }, 
+	{ 229, -1, -1,  4 }, { 222, -1, -1,  4 }, { 203, -1, -1,  4 }, { 204, -1, -1,  4 }, { 205, -1, -1,  4 }, 
+	{ 600, -1, -1,  4 }, { 525, -1, -1,  4 }, { 524, -1, -1,  4 }, { 523, -1, -1,  4 }, { 522, -1, -1,  4 }, 
+	{ 520, -1, -1,  4 }, { 602, -1, -1,  4 }, { 605, -1, -1,  4 }, { 608, -1, -1,  4 }, { 707, -1, -1,  4 }, 
+	{ 708, -1, -1,  4 }, { 305,  4, -1,  5 }, { 305,  0, -1,  6 }, { 305,  1, -1,  6 }, { 305,  2, -1,  6 }, 
+	{ 305,  3, -1,  6 }, { 661,  0, -1,  4 }, { 661,  1, -1,  4 }, { 661,  3, -1,  4 }, { 661,  4, -1,  4 }, 
+	{ 661,  5, -1,  4 }, { 661,  2, -1,  3 }, { 711, -1, -1,  7 }, { 712, -1, -1,  7 }, { 713, -1, -1,  7 }, 
+	{  60, -1, -1,  7 }, { 816,  0, -1,  2 }, { 816,  1, -1,  2 }, { 816,  2, -1,  2 }, { 816,  3, -1,  2 }, 
+	{ 816,  4, -1,  2 }, { 506, -1, -1,  6 }, { 508, -1, -1,  6 }, { 500, -1, -1,  6 }, { 252, -1, -1,  6 }, 
+	{ 803, -1, -1,  6 }, { 804, -1, -1,  6 }, { 433, -1, -1,  6 }, { 513,  0, -1,  8 }, { 513,  1, -1,  8 }, 
+	{ 513,  2, -1,  8 }, { 513,  3, -1,  8 }, { 513,  4, -1,  8 }, { 513,  5, -1,  8 }, { 240, -1, -1,  9 }, 
+	{ 241, -1, -1,  9 }, { 242, -1, -1,  9 }, { 243, -1, -1,  9 }, { 701, -1, -1,  9 }, { 722, -1, -1,  9 }, 
+	{ 700,  1, -1, 10 }, { 610, -1, -1, 11 }, { 611, -1, -1, 11 }, { 607,  1, -1,  9 }, { 253, -1, -1,  9 }, 
+	{ 228, -1, -1,  9 }, { 247, -1, -1,  9 }, { 300, -1, -1,  9 }, { 326, -1, -1,  9 }, { 412, -1, -1, 12 }, 
+	{ 800, -1, -1, 14 }, { 801, -1, -1, 14 }, { 702, -1, -1, 16 }, { 519, -1, -1,  9 }, { 200,  0, -1,  3 }, 
+	{ 201, -1, -1,  9 }, { 202, -1, -1,  9 }, 
+};
 
 static const PaletteMod paletteModsSQ3[] = {
 	{    0,    0,    0 },
@@ -171,227 +129,97 @@ static const PaletteMod paletteModsSQ3[] = {
 	{   64,   64,   64 }
 };
 
-static void doCustomPicSQ3(GfxScreen *screen, int x) {
-	byte val = 0;
+static const PicMod picModsSQ3[] = {
 	// SQ3 per-resource palette configuration
 	// Copyright (C) 2006 Matt Hargett
-	// ego
-	// ego on garbage lifter -- lighten but not so as to make the lifter be obviously weird
-	// ego's shadow
-	// ego's hands controlling robot
-	if (x == 96)
-		val = 2;     // color * 1.15
-	// peeking at scumsoft
-	if (x == 81 || x == 82)
-		val = 2;     // color * 1.15
-	// lifted by robot
-	if (x == 430)
-		val = 2;     // color * 1.15
-	// computer controls
-	if (x == 17 || x == 18 || (x >= 162 && x <= 164) || x == 170 || x == 180 || x == 191 || x == 300)
-		val = 6;     // color * 0.75
-	// title screen
-	if (x == 1)
-		val = 4;     // color * 0.9
-	if (x == 926)
-		val = 4;     // color * 0.9
-	// humans(?)
-	if (x == 117)
-		val = 2;     // color * 1.15
-	// ships, planets, and robots
-	if ((x >= 205 && x <= 209) || (x >= 112 && x <= 115))
-		val = 4;     // color * 0.9
-	if ((x >= 60 && x <= 72))
-		val = 4;     // color * 0.9
-	if (x == 153)
-		val = 5;     // color * 0.8
-	if (x == 690)
-		val = 4;     // color * 0.9
-	// in the garbage scow
-	if ((x >= 1 && x <= 20))
-		val = 6;     // color * 0.75
-	if (x == 157)
-		val = 9;     // color * 0.6
-	// rats
-	// guys from andromeda
-	// misc text bubbles, effects, etc
-
-	if (val)
-		screen->setCurPaletteMapValue(val);
-}
+	{  96,  2 }, {  81,  2 }, {  82,  2 }, { 430,  2 }, {  17,  6 }, 
+	{  18,  6 }, { 162,  6 }, { 163,  6 }, { 164,  6 }, { 170,  6 }, 
+	{ 180,  6 }, { 191,  6 }, { 300,  6 }, {   1,  4 }, { 926,  4 }, 
+	{ 117,  2 }, { 205,  4 }, { 206,  4 }, { 207,  4 }, { 208,  4 }, 
+	{ 209,  4 }, { 112,  4 }, { 113,  4 }, { 114,  4 }, { 115,  4 }, 
+	{  60,  4 }, {  61,  4 }, {  62,  4 }, {  63,  4 }, {  64,  4 }, 
+	{  65,  4 }, {  66,  4 }, {  67,  4 }, {  68,  4 }, {  69,  4 }, 
+	{  70,  4 }, {  71,  4 }, {  72,  4 }, { 153,  5 }, { 690,  4 }, 
+	{   1,  6 }, {   2,  6 }, {   3,  6 }, {   4,  6 }, {   5,  6 }, 
+	{   6,  6 }, {   7,  6 }, {   8,  6 }, {   9,  6 }, {  10,  6 }, 
+	{  11,  6 }, {  12,  6 }, {  13,  6 }, {  14,  6 }, {  15,  6 }, 
+	{  16,  6 }, {  17,  6 }, {  18,  6 }, {  19,  6 }, {  20,  6 }, 
+	{ 157,  9 }, 
+};
 
-static void doCustomViewSQ3(GfxScreen *screen, int x, int y, int z) {
-	byte val = 0;
+static const ViewMod viewModsSQ3[] = {
 	// SQ3 per-resource palette configuration
 	// Copyright (C) 2006 Matt Hargett
-	// ego
-	if (x == 0 || x == 8 || x == 11 || x == 12 || x == 14 || x == 68 || x == 17 || (x >= 22 && x <= 26) || x == 32 || x == 35 || x == 751 || x == 289 || x == 288 || x == 261 || x == 260 || x == 257 || x == 213 || x == 199 || x == 193 || x == 192 || x == 138 || x == 137 || x == 134 || x == 109 || x == 110 || x == 113 || x == 114 || x == 117 || x == 122 || x == 123 || x == 100 || x == 99 || x == 97 || x == 95 || x == 89 || x == 88 || x == 87 || x == 85 || x == 84 || x == 82 || x == 76 || x == 68 || x == 63 || x == 104)
-		val = 1;     // color * 1.25
-	if (x == 136)
-		val = 2;     // color * 1.15
-	if (x == 106)
-		if (y == 4 || y == 5 || y == 9)
-			val = 1;     // color * 1.25
-	if (x == 105)
-		if (y == 0 || y == 1)
-			val = 1;     // color * 1.25
-	// ego on garbage lifter -- lighten but not so as to make the lifter be obviously weird
-	if (x == 13)
-		if (y == 0)
-			if (z == 2)
-				val = 2;     // color * 1.15
-	if (x == 31)
-		val = 2;     // color * 1.15
-	if (x == 15)
-		if (y == 3)
-			if (z == 0)
-				val = 1;     // color * 1.25
-	if (x == 16 || x == 19)
-		if (y == 0)
-			val = 1;     // color * 1.25
-	if (x == 57)
-		if ((y >= 5 && y <= 6))
-			val = 1;     // color * 1.25
-	if (x == 21)
-		if (y == 1)
-			val = 1;     // color * 1.25
-	// ego's shadow
-	if (x == 7 || x == 18)
-		val = 3;     // color * 0.5
-	if ((x >= 6 && x <= 8) || x == 18)
-		val = 4;     // color * 0.9
-	if (x == 901)
-		val = 1;     // color * 1.25
-	if (x == 751)
-		val = 1;     // color * 1.25
-	if (x == 750)
-		if (y == 1)
-			val = 1;     // color * 1.25
-	if (x == 92)
-		if (y == 4)
-			val = 1;     // color * 1.25
-	if (x == 83)
-		if (y == 0)
-			val = 1;     // color * 1.25
-	if (x == 83)
-		if (y == 1)
-			if (z == 2)
-				val = 2;     // color * 1.15
-	if (x == 83)
-		if (y == 2)
-			if (z == 2)
-				val = 2;     // color * 1.15
-	if (x == 78)
-		if (y == 3)
-			val = 1;     // color * 1.25
-	if (x == 64)
-		if (y == 2 || y == 3)
-			val = 1;     // color * 1.25
-	// ego's hands controlling robot
-	// peeking at scumsoft
-	// lifted by robot
-	// computer controls
-	if (x == 40 || x == 41 || x == 42 || x == 149 || x == 146 || x == 141 || x == 151 || x == 152)
-		val = 5;     // color * 0.8
-	if (x == 70 || x == 2)
-		val = 4;     // color * 0.9
-	// title screen
-	if (x == 900)
-		val = 4;     // color * 0.9
-	// humans(?)
-	if (x == 593 || x == 93 || x == 103 || (x >= 131 && x <= 133) || x == 210 || x == 130 || x == 115)
-		val = 7;     // color * 1.2
-	if (x == 116)
-		if ((y >= 1 && y <= 2))
-			val = 7;     // color * 1.2
-	// ships, planets, and robots
-	if (x == 39)
-		val = 4;     // color * 0.9
-	if (x == 1)
-		val = 6;     // color * 0.75
-	if (x == 96)
-		val = 4;     // color * 0.9
-	if (x == 77)
-		if ((y >= 0 && y <= 2))
-			val = 8;     // color * 0.7
-	if (x == 259)
-		val = 2;     // color * 1.15
-	// in the garbage scow
-	if (x == 20)
-		if (y == 0)
-			val = 3;     // color * 0.5
-	// rats
-	if (x == 15)
-		if (y == 0 || y == 1)
-			val = 9;     // color * 0.6
-	if (x == 34)
-		val = 9;     // color * 0.6
-	// guys from andromeda
-	if (x == 128)
-		val = 4;     // color * 0.9
-	if (x == 601 || x == 602)
-		val = 4;     // color * 0.9
-	// misc text bubbles, effects, etc
-	if (x == 94)
-		val = 10;     // color * 1.1
-	if (x == 91 || x == 73)
-		val = 11;     // color * 1.5
-	if (x == 57)
-		if (y == 3 || y == 4)
-			val = 11;     // color * 1.5
-	if (x == 15)
-		if (y == 4)
-			val = 11;     // color * 1.5
-	if (x == 64)
-		if (y == 0)
-			val = 11;     // color * 1.5
-	if (x == 71)
-		if (y == 8)
-			val = 11;     // color * 1.5
-	if (x == 10)
-		if (y == 6)
-			val = 11;     // color * 1.5
+	{   0, -1, -1,  1 }, {   8, -1, -1,  1 }, {  11, -1, -1,  1 }, {  12, -1, -1,  1 }, {  14, -1, -1,  1 }, 
+	{  68, -1, -1,  1 }, {  17, -1, -1,  1 }, {  22, -1, -1,  1 }, {  23, -1, -1,  1 }, {  24, -1, -1,  1 }, 
+	{  25, -1, -1,  1 }, {  26, -1, -1,  1 }, {  32, -1, -1,  1 }, {  35, -1, -1,  1 }, { 751, -1, -1,  1 }, 
+	{ 289, -1, -1,  1 }, { 288, -1, -1,  1 }, { 261, -1, -1,  1 }, { 260, -1, -1,  1 }, { 257, -1, -1,  1 }, 
+	{ 213, -1, -1,  1 }, { 199, -1, -1,  1 }, { 193, -1, -1,  1 }, { 192, -1, -1,  1 }, { 138, -1, -1,  1 }, 
+	{ 137, -1, -1,  1 }, { 134, -1, -1,  1 }, { 109, -1, -1,  1 }, { 110, -1, -1,  1 }, { 113, -1, -1,  1 }, 
+	{ 114, -1, -1,  1 }, { 117, -1, -1,  1 }, { 122, -1, -1,  1 }, { 123, -1, -1,  1 }, { 100, -1, -1,  1 }, 
+	{  99, -1, -1,  1 }, {  97, -1, -1,  1 }, {  95, -1, -1,  1 }, {  89, -1, -1,  1 }, {  88, -1, -1,  1 }, 
+	{  87, -1, -1,  1 }, {  85, -1, -1,  1 }, {  84, -1, -1,  1 }, {  82, -1, -1,  1 }, {  76, -1, -1,  1 }, 
+	{  68, -1, -1,  1 }, {  63, -1, -1,  1 }, { 104, -1, -1,  1 }, { 136, -1, -1,  2 }, { 106,  4, -1,  1 }, 
+	{ 106,  5, -1,  1 }, { 106,  9, -1,  1 }, { 105,  0, -1,  1 }, { 105,  1, -1,  1 }, {  13,  0,  2,  2 }, 
+	{  31, -1, -1,  2 }, {  15,  3,  0,  1 }, {  16,  0, -1,  1 }, {  19,  0, -1,  1 }, {  57,  5, -1,  1 }, 
+	{  57,  6, -1,  1 }, {  21,  1, -1,  1 }, {   7, -1, -1,  3 }, {  18, -1, -1,  3 }, {   6, -1, -1,  4 }, 
+	{   7, -1, -1,  4 }, {   8, -1, -1,  4 }, {  18, -1, -1,  4 }, { 901, -1, -1,  1 }, { 751, -1, -1,  1 }, 
+	{ 750,  1, -1,  1 }, {  92,  4, -1,  1 }, {  83,  0, -1,  1 }, {  83,  1,  2,  2 }, {  83,  2,  2,  2 }, 
+	{  78,  3, -1,  1 }, {  64,  2, -1,  1 }, {  64,  3, -1,  1 }, {  40, -1, -1,  5 }, {  41, -1, -1,  5 }, 
+	{  42, -1, -1,  5 }, { 149, -1, -1,  5 }, { 146, -1, -1,  5 }, { 141, -1, -1,  5 }, { 151, -1, -1,  5 }, 
+	{ 152, -1, -1,  5 }, {  70, -1, -1,  4 }, {   2, -1, -1,  4 }, { 900, -1, -1,  4 }, { 593, -1, -1,  7 }, 
+	{  93, -1, -1,  7 }, { 103, -1, -1,  7 }, { 131, -1, -1,  7 }, { 132, -1, -1,  7 }, { 133, -1, -1,  7 }, 
+	{ 210, -1, -1,  7 }, { 130, -1, -1,  7 }, { 115, -1, -1,  7 }, { 116,  1, -1,  7 }, { 116,  2, -1,  7 }, 
+	{  39, -1, -1,  4 }, {   1, -1, -1,  6 }, {  96, -1, -1,  4 }, {  77,  0, -1,  8 }, {  77,  1, -1,  8 }, 
+	{  77,  2, -1,  8 }, { 259, -1, -1,  2 }, {  20,  0, -1,  3 }, {  15,  0, -1,  9 }, {  15,  1, -1,  9 }, 
+	{  34, -1, -1,  9 }, { 128, -1, -1,  4 }, { 601, -1, -1,  4 }, { 602, -1, -1,  4 }, {  94, -1, -1, 10 }, 
+	{  91, -1, -1, 11 }, {  73, -1, -1, 11 }, {  57,  3, -1, 11 }, {  57,  4, -1, 11 }, {  15,  4, -1, 11 }, 
+	{  64,  0, -1, 11 }, {  71,  8, -1, 11 }, {  10,  6, -1, 11 }, 
+};
 
-	if (val)
-		screen->setCurPaletteMapValue(val);
-}
+static const SciFxMod mods[] = {
+	{ GID_LSL2, paletteModsLSL2, ARRAYSIZE(paletteModsLSL2), picModsLSL2, ARRAYSIZE(picModsLSL2), viewModsLSL2, ARRAYSIZE(viewModsLSL2) },
+	{ GID_SQ3, paletteModsSQ3, ARRAYSIZE(paletteModsSQ3), picModsSQ3, ARRAYSIZE(picModsSQ3), viewModsSQ3, ARRAYSIZE(viewModsSQ3) },
+};
 
 void setupCustomPaletteMods(GfxScreen *screen) {
-	switch (g_sci->getGameId()) {
-	case GID_LSL2:
-		screen->setPaletteMods(paletteModsLSL2, ARRAYSIZE(paletteModsLSL2));
-		break;
-	case GID_SQ3:
-		screen->setPaletteMods(paletteModsSQ3, ARRAYSIZE(paletteModsSQ3));
-		break;
-	default:
-		break;
+	for (int i = 0; i < ARRAYSIZE(mods); i++) {
+		if (mods[i].gameId == g_sci->getGameId()) {
+			screen->setPaletteMods(mods[i].paletteMods, mods[i].paletteModsSize);
+			break;
+		}
 	}
 }
 
-void doCustomViewPalette(GfxScreen *screen, int x, int y, int z) {
-	switch (g_sci->getGameId()) {
-	case GID_LSL2:
-		doCustomViewLSL2(screen, x, y, z);
-		break;
-	case GID_SQ3:
-		doCustomViewSQ3(screen, x, y, z);
-		break;
-	default:
-		break;
+void doCustomViewPalette(GfxScreen *screen, GuiResourceId view, int16 loop, int16 cel) {
+	for (int i = 0; i < ARRAYSIZE(mods); i++) {
+		SciFxMod mod = mods[i];
+		if (mod.gameId == g_sci->getGameId()) {
+			for (int j = 0; j < mod.viewModsSize; j++) {
+				ViewMod m = mod.viewMods[j];
+				if (m.id == view && (m.loop == -1 || m.loop == loop) && (m.cel == -1 || m.cel == cel)) {
+					screen->setCurPaletteMapValue(m.multiplier);
+					break;
+				}
+			}
+			break;
+		}
 	}
 }
 
-void doCustomPicPalette(GfxScreen *screen, int x) {
-	switch (g_sci->getGameId()) {
-	case GID_LSL2:
-		doCustomPicLSL2(screen, x);
-		break;
-	case GID_SQ3:
-		doCustomPicSQ3(screen, x);
-		break;
-	default:
-		break;
+void doCustomPicPalette(GfxScreen *screen, GuiResourceId pic) {
+	for (int i = 0; i < ARRAYSIZE(mods); i++) {
+		SciFxMod mod = mods[i];
+		if (mod.gameId == g_sci->getGameId()) {
+			for (int j = 0; j < mod.picModsSize; j++) {
+				PicMod m = mod.picMods[j];
+				if (m.id == pic) {
+					screen->setCurPaletteMapValue(m.multiplier);
+					break;
+				}
+			}
+			break;
+		}
 	}
 }
 
diff --git a/engines/sci/graphics/scifx.h b/engines/sci/graphics/scifx.h
index a45eb4fc24..9a3c5a2595 100644
--- a/engines/sci/graphics/scifx.h
+++ b/engines/sci/graphics/scifx.h
@@ -23,7 +23,7 @@
 namespace Sci {
 
 void setupCustomPaletteMods(GfxScreen *screen);
-void doCustomViewPalette(GfxScreen *screen, int x, int y, int z);
-void doCustomPicPalette(GfxScreen *screen, int x);
+void doCustomViewPalette(GfxScreen *screen, GuiResourceId view, int16 loop, int16 cel);
+void doCustomPicPalette(GfxScreen *screen, GuiResourceId pic);
 
 }


Commit: 993e2d58903ed0fde6ce5e2a4d43dda697b941bd
    https://github.com/scummvm/scummvm/commit/993e2d58903ed0fde6ce5e2a4d43dda697b941bd
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2020-11-08T22:33:56+02:00

Commit Message:
NEWS: Mention the support of SCI Korean fan translated games

Changed paths:
    NEWS.md


diff --git a/NEWS.md b/NEWS.md
index 47b01bd6ad..f14144a656 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -39,8 +39,10 @@ For a more comprehensive changelog of the latest experimental code, see:
      issues in screen transitions and avoids mode changes when playing Mac QuickTime videos.
    - Added custom palette mods for SQ3 and LSL2 from the FreeSCI project. When enabled, the mods improve the visuals
      in these two games.
+   - Added support for the Korean fan translations of Castle of Dr. Brain, Eco Quest, Gabriel Knight,
+     King's Quest 1, 5 and 6, Laura Bow 2: Dagger of Amon Ra and Space Quest 4
 
-SCUMM:
+ SCUMM:
    - Fixed Chinese, Japanese and Korean text display for The Dig and for The Curse of Monkey Island. These fixes
      also include some improvements to the common text display (mainly the formatting of wrapped texts).
    - Fixed display of Chinese, Japanese and Korean pause and restart dialogs.




More information about the Scummvm-git-logs mailing list