[Scummvm-git-logs] scummvm master -> 30ac9cb74d2adfb7d34f3a08ef3a4760e2b68a6c
neuromancer
noreply at scummvm.org
Thu Sep 24 07:21:55 UTC 2026
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
8154fcc080 EEM: use mac ui for eem1 mac
30ac9cb74d EEM: better color match for eem1 mac
Commit: 8154fcc080a1b173fa42953435cc7893dfc7ea5e
https://github.com/scummvm/scummvm/commit/8154fcc080a1b173fa42953435cc7893dfc7ea5e
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-09-24T08:46:29+02:00
Commit Message:
EEM: use mac ui for eem1 mac
Changed paths:
engines/eem/clues.cpp
engines/eem/eem.h
engines/eem/mac_ui.cpp
engines/eem/ui.cpp
diff --git a/engines/eem/clues.cpp b/engines/eem/clues.cpp
index f05194df612..260734143f0 100644
--- a/engines/eem/clues.cpp
+++ b/engines/eem/clues.cpp
@@ -1752,6 +1752,9 @@ void EEMEngine::displayFloppyHotspotDialog(uint siteNum, uint hotIdx) {
}
bool EEMEngine::areYouSure() {
+ if (isMacintosh())
+ return areYouSureMac();
+
Graphics::Surface *screen = g_system->lockScreen();
Graphics::ManagedSurface saved(kScreenWidth, kScreenHeight,
Graphics::PixelFormat::createFormatCLUT8());
diff --git a/engines/eem/eem.h b/engines/eem/eem.h
index 7654c23d174..550cc51447f 100644
--- a/engines/eem/eem.h
+++ b/engines/eem/eem.h
@@ -302,6 +302,7 @@ public:
private:
void applyStartupTestOverrides();
+ bool areYouSureMac();
bool areMysteriesSolved(uint lo, uint hi) const;
/// True if *any* mystery in the inclusive 1-based range [lo, hi] is
diff --git a/engines/eem/mac_ui.cpp b/engines/eem/mac_ui.cpp
index a72acee1a6e..68f069f84ed 100644
--- a/engines/eem/mac_ui.cpp
+++ b/engines/eem/mac_ui.cpp
@@ -35,7 +35,7 @@ namespace EEM {
namespace {
-struct MacPuzzleItem {
+struct MacDialogItem {
Common::Rect rect;
byte type;
uint16 picture;
@@ -50,15 +50,16 @@ Common::Rect readPuzzleRect(Common::SeekableReadStream &stream) {
return Common::Rect(left, top, right, bottom);
}
-bool loadPuzzleDialog(uint16 id, Common::Rect &rect, Common::Array<MacPuzzleItem> &items) {
+bool loadMacDialog(const Common::Path &application, uint16 id, Common::Rect &rect,
+ Common::Array<MacDialogItem> &items) {
Common::ScopedPtr<Common::SeekableReadStream> dialog(
- openMacResource(Common::Path("EEM London CD"), MKTAG('D', 'L', 'O', 'G'), id));
+ openMacResource(application, MKTAG('D', 'L', 'O', 'G'), id));
if (!dialog || dialog->size() < 20)
return false;
rect = readPuzzleRect(*dialog);
dialog->seek(18);
Common::ScopedPtr<Common::SeekableReadStream> list(
- openMacResource(Common::Path("EEM London CD"), MKTAG('D', 'I', 'T', 'L'), dialog->readUint16BE()));
+ openMacResource(application, MKTAG('D', 'I', 'T', 'L'), dialog->readUint16BE()));
if (!list || list->size() < 2)
return false;
const uint count = list->readUint16BE() + 1;
@@ -66,7 +67,7 @@ bool loadPuzzleDialog(uint16 id, Common::Rect &rect, Common::Array<MacPuzzleItem
if (list->size() - list->pos() < 14)
return false;
list->skip(4);
- MacPuzzleItem item;
+ MacDialogItem item;
item.rect = readPuzzleRect(*list);
item.rect.translate(rect.left, rect.top);
item.type = list->readByte();
@@ -119,8 +120,118 @@ void drawPuzzleButton(Graphics::ManagedSurface &surface, const Common::Rect &rec
surface.drawLine(rect.right - 4, rect.bottom - 1, rect.right - 1, rect.bottom - 4, color);
}
+// Mac EEM1 CODE 2:3248 opens DLOG/DITL 131 and returns true for item 1.
+bool runMacQuitDialog(const Common::Path &application) {
+ Common::Rect dialogRect;
+ Common::Array<MacDialogItem> items;
+ if (!loadMacDialog(application, 131, dialogRect, items) || items.size() < 3 ||
+ items[0].type != 4 || items[1].type != 4) {
+ warning("Unable to load Mac quit dialog");
+ return true;
+ }
+
+ Graphics::ManagedSurface saved;
+ Graphics::Surface *screen = g_system->lockScreen();
+ if (!screen)
+ return false;
+ saved.copyFrom(*screen);
+ g_system->unlockScreen();
+ byte colors[kPalSize];
+ g_system->getPaletteManager()->grabPalette(colors, 0, 256);
+ const Graphics::Palette palette(colors, 256);
+ const byte black = palette.findBestColor(0, 0, 0);
+ const byte white = palette.findBestColor(255, 255, 255);
+ Graphics::MacFontManager fontManager(0, Common::EN_ANY);
+ const Graphics::Font *font = fontManager.getFont(Graphics::MacFont(Graphics::kMacFontSystem, 12));
+ const int lineHeight = font->getFontHeight();
+
+ Graphics::ManagedSurface base;
+ base.copyFrom(saved);
+ Common::Rect border = dialogRect;
+ border.grow(5);
+ base.fillRect(border, white);
+ base.frameRect(border, black);
+ border.grow(-3);
+ base.frameRect(border, black);
+ border.grow(-1);
+ base.frameRect(border, black);
+ for (const MacDialogItem &item : items) {
+ if ((item.type & 0x7f) != 8)
+ continue;
+ Common::Array<Common::String> lines;
+ font->wordWrapText(item.text, item.rect.width(), lines);
+ for (uint i = 0; i < lines.size(); ++i)
+ font->drawString(base.surfacePtr(), lines[i], item.rect.left,
+ item.rect.top + i * lineHeight, item.rect.width(), black);
+ }
+
+ Graphics::ManagedSurface frame;
+ auto drawDialog = [&](int pressed) {
+ frame.copyFrom(base);
+ for (uint i = 0; i < 2; ++i) {
+ const Common::Rect &r = items[i].rect;
+ if ((int)i == pressed)
+ frame.drawRoundRect(r, 4, black, true);
+ drawPuzzleButton(frame, r, black);
+ font->drawString(frame.surfacePtr(), items[i].text, r.left,
+ r.top + (r.height() - lineHeight) / 2, r.width(),
+ (int)i == pressed ? white : black, Graphics::kTextAlignCenter);
+ if (i == 0) {
+ Common::Rect ring = r;
+ ring.grow(3);
+ drawPuzzleButton(frame, ring, black);
+ }
+ }
+ g_system->copyRectToScreen(frame.getPixels(), frame.pitch, 0, 0, frame.w, frame.h);
+ g_system->updateScreen();
+ };
+
+ drawDialog(-1);
+ int pressed = -1;
+ int choice = -1;
+ while (choice < 0 && !Engine::shouldQuit()) {
+ Common::Event event;
+ while (g_system->getEventManager()->pollEvent(event)) {
+ if (event.type == Common::EVENT_QUIT || event.type == Common::EVENT_RETURN_TO_LAUNCHER) {
+ choice = 0;
+ } else if (event.type == Common::EVENT_KEYDOWN) {
+ if (event.kbd.keycode == Common::KEYCODE_RETURN || event.kbd.keycode == Common::KEYCODE_KP_ENTER)
+ choice = 0;
+ else if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
+ choice = 1;
+ } else if (event.type == Common::EVENT_LBUTTONDOWN) {
+ for (uint i = 0; i < 2; ++i) {
+ if (items[i].rect.contains(event.mouse))
+ pressed = i;
+ }
+ drawDialog(pressed);
+ } else if (event.type == Common::EVENT_MOUSEMOVE && pressed >= 0) {
+ drawDialog(items[pressed].rect.contains(event.mouse) ? pressed : -1);
+ } else if (event.type == Common::EVENT_LBUTTONUP && pressed >= 0) {
+ if (items[pressed].rect.contains(event.mouse))
+ choice = pressed;
+ pressed = -1;
+ drawDialog(-1);
+ }
+ if (choice >= 0)
+ break;
+ }
+ g_system->updateScreen();
+ g_system->delayMillis(10);
+ }
+ g_system->copyRectToScreen(saved.getPixels(), saved.pitch, 0, 0, saved.w, saved.h);
+ g_system->updateScreen();
+ return choice == 0 || Engine::shouldQuit();
+}
+
} // namespace
+bool EEMEngine::areYouSureMac() {
+ const Common::Path application(isLondon() ? "EEM London CD" :
+ isMacCD() ? "Eagle Eye Mysteries CD" : "Eagle Eye Mysteries");
+ return runMacQuitDialog(application);
+}
+
// Mac London CODE 6:5554/5a1a; the Mac release has no TRAVEL*.ANM files.
bool EEMEngine::playMacLondonTravelAnimation(uint8 travelKind) {
static const struct TravelScene {
@@ -278,8 +389,8 @@ bool EEMEngine::doMacLondonPuzzle(Common::SeekableReadStream &stream) {
}
}
Common::Rect dialogRect;
- Common::Array<MacPuzzleItem> items;
- if (stream.err() || !loadPuzzleDialog(dialogId, dialogRect, items) || items.size() < 5) {
+ Common::Array<MacDialogItem> items;
+ if (stream.err() || !loadMacDialog(Common::Path("EEM London CD"), dialogId, dialogRect, items) || items.size() < 5) {
warning("Unable to load Mac London puzzle dialog %u", dialogId);
return false;
}
@@ -351,7 +462,7 @@ bool EEMEngine::doMacLondonPuzzle(Common::SeekableReadStream &stream) {
frame.blitFrom(selectionPictures[selected], Common::Rect(selectionPictures[selected].w,
selectionPictures[selected].h), selectionRects[selected]);
for (uint i = 0; i < items.size(); ++i) {
- const MacPuzzleItem &item = items[i];
+ const MacDialogItem &item = items[i];
const byte itemType = item.type & 0x7f;
const Common::Rect &r = item.rect;
if (itemType == 4) {
diff --git a/engines/eem/ui.cpp b/engines/eem/ui.cpp
index f9d9ef2f1f4..38499892f1d 100644
--- a/engines/eem/ui.cpp
+++ b/engines/eem/ui.cpp
@@ -2903,8 +2903,13 @@ void EEMEngine::doCaseSelection() {
break;
}
if (kChooserExitRect.contains(mouse.x, mouse.y)) {
- _mystery.clear();
- return;
+ if (areYouSure()) {
+ _mystery.clear();
+ _nextScreen = kScreenInvalid;
+ return;
+ }
+ dirty = true;
+ continue;
}
if (kChooserHelpRect.contains(mouse.x, mouse.y)) {
saveProfile(_playerName);
Commit: 30ac9cb74d2adfb7d34f3a08ef3a4760e2b68a6c
https://github.com/scummvm/scummvm/commit/30ac9cb74d2adfb7d34f3a08ef3a4760e2b68a6c
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-09-24T09:21:41+02:00
Commit Message:
EEM: better color match for eem1 mac
Changed paths:
engines/eem/clues.cpp
engines/eem/eem.cpp
engines/eem/eem.h
engines/eem/graphics.cpp
engines/eem/mac_ui.cpp
engines/eem/map_ui.cpp
engines/eem/site.cpp
engines/eem/ui.cpp
diff --git a/engines/eem/clues.cpp b/engines/eem/clues.cpp
index 260734143f0..dc995989a26 100644
--- a/engines/eem/clues.cpp
+++ b/engines/eem/clues.cpp
@@ -388,7 +388,7 @@ void EEMEngine::playMacLondonInitCluesAnim(uint16 caseType, const Picture &bg,
byte pal[kPalSize];
const bool havePalette = getSitePalette(0x39, pal);
byte black[kPalSize] = {};
- g_system->getPaletteManager()->setPalette(black, 0, 256);
+ getPaletteManager()->setPalette(black, 0, 256);
const uint16 music[] = { 27, 36, 28, 29, 36 };
bool firstFrame = true;
@@ -486,7 +486,7 @@ void EEMEngine::playLondonInitCluesAnim(uint16 caseType, const Picture &bg,
byte pal[kPalSize];
const bool havePal = getSitePalette(0x39, pal);
byte black[kPalSize] = {};
- g_system->getPaletteManager()->setPalette(black, 0, 256);
+ getPaletteManager()->setPalette(black, 0, 256);
g_system->updateScreen();
bool skip = false;
@@ -784,7 +784,7 @@ void EEMEngine::doInitClues() {
const bool haveDemoPalette = demo && getSitePalette(0x22, demoPalette);
if (demo && haveDemoPalette) {
byte black[kPalSize] = {};
- g_system->getPaletteManager()->setPalette(black, 0, 256);
+ getPaletteManager()->setPalette(black, 0, 256);
} else {
setSitePalette(isLondon() ? 0x39 : 0x22);
}
diff --git a/engines/eem/eem.cpp b/engines/eem/eem.cpp
index d414f195f31..4dc423d9866 100644
--- a/engines/eem/eem.cpp
+++ b/engines/eem/eem.cpp
@@ -36,6 +36,7 @@
#include "graphics/cursorman.h"
#include "graphics/maccursor.h"
+#include "graphics/macgamma.h"
#include "graphics/macgui/macwindowmanager.h"
#include "graphics/paletteman.h"
@@ -155,12 +156,12 @@ Common::String londonProfileKeyFromDisplayName(const Common::String &name) {
void fadeCurrentPaletteToBlack(uint delayMs) {
byte start[kPalSize];
byte stepPal[kPalSize];
- g_system->getPaletteManager()->grabPalette(start, 0, 256);
+ getPaletteManager()->grabPalette(start, 0, 256);
for (int step = 15; step >= 0; step--) {
for (uint i = 0; i < kPalSize; i++)
stepPal[i] = (byte)((uint)start[i] * step / 16);
- g_system->getPaletteManager()->setPalette(stepPal, 0, 256);
+ getPaletteManager()->setPalette(stepPal, 0, 256);
g_system->updateScreen();
if (delayMs)
g_system->delayMillis(delayMs);
@@ -173,7 +174,7 @@ void fadePaletteFromBlack(const byte *target, uint delayMs) {
for (uint step = 1; step <= 16; step++) {
for (uint i = 0; i < kPalSize; i++)
stepPal[i] = (byte)((uint)target[i] * step / 16);
- g_system->getPaletteManager()->setPalette(stepPal, 0, 256);
+ getPaletteManager()->setPalette(stepPal, 0, 256);
g_system->updateScreen();
if (delayMs)
g_system->delayMillis(delayMs);
@@ -247,7 +248,10 @@ bool installMacCursor(uint16 resourceId, bool london) {
Graphics::MacCursor macCursor;
if (macCursor.readFromStream(*crsrStream)) {
CursorMan.replaceCursor(&macCursor);
- CursorMan.replaceCursorPalette(macCursor.getPalette(), 0, 256);
+ byte palette[kPalSize];
+ for (uint color = 0; color < kPalSize; ++color)
+ palette[color] = Graphics::macGammaCorrectionLookUp[macCursor.getPalette()[color]];
+ CursorMan.replaceCursorPalette(palette, 0, 256);
return true;
}
}
@@ -599,7 +603,7 @@ Common::Error EEMEngine::run() {
// _AllBlack @ 172b:0d4b.
byte black[3 * 256] = { 0 };
- g_system->getPaletteManager()->setPalette(black, 0, 256);
+ getPaletteManager()->setPalette(black, 0, 256);
debugC(1, kDebugGeneral, "EEM engine starting");
@@ -1050,7 +1054,7 @@ void EEMEngine::setSitePalette(uint num) {
warning("setSitePalette: index %u out of range", num);
return;
}
- g_system->getPaletteManager()->setPalette(expanded, 0, 256);
+ getPaletteManager()->setPalette(expanded, 0, 256);
}
bool EEMEngine::setAnmPalette(const Common::Path &anmPath) {
@@ -1067,7 +1071,7 @@ bool EEMEngine::setAnmPalette(const Common::Path &anmPath) {
byte expanded[kPalSize];
for (uint i = 0; i < kPalSize; i++)
expanded[i] = (byte)(raw[i] << 2);
- g_system->getPaletteManager()->setPalette(expanded, 0, 256);
+ getPaletteManager()->setPalette(expanded, 0, 256);
return true;
}
@@ -1099,7 +1103,7 @@ void EEMEngine::playFlc(const Common::Path &path, bool fadeIn,
const int h = MIN(fh, screenHeight() - oy);
byte black[3 * 256] = { 0 };
- g_system->getPaletteManager()->setPalette(black, 0, 256);
+ getPaletteManager()->setPalette(black, 0, 256);
if (Graphics::Surface *screen = g_system->lockScreen()) {
screen->fillRect(Common::Rect(screen->w, screen->h), 0);
g_system->unlockScreen();
@@ -1118,7 +1122,7 @@ void EEMEngine::playFlc(const Common::Path &path, bool fadeIn,
if (fadeIn && !paletteApplied)
fadePaletteFromBlack(flic.getPalette());
else
- g_system->getPaletteManager()->setPalette(
+ getPaletteManager()->setPalette(
flic.getPalette(), 0, 256);
paletteApplied = true;
}
@@ -1182,7 +1186,7 @@ void EEMEngine::playAnm(const Common::Path &path, uint frameDelayMs,
if (fadeIn)
fadePaletteFromBlack(palette);
else
- g_system->getPaletteManager()->setPalette(palette, 0, 256);
+ getPaletteManager()->setPalette(palette, 0, 256);
paletteApplied = true;
}
g_system->updateScreen();
@@ -1337,8 +1341,7 @@ void openColorCycle(byte *fpal, uint8 start, uint8 end, bool show) {
fpal[start * 3 + 1] = savedG;
fpal[start * 3 + 2] = savedB;
if (show) {
- g_system->getPaletteManager()->setPalette(fpal + start * 3, start,
- end - start);
+ getPaletteManager()->setPalette(fpal + start * 3, start, end - start);
}
}
// _ShowEAKids @ 2520:05f0:
@@ -1428,7 +1431,7 @@ void EEMEngine::showHighScoreLogo() {
return;
}
byte black[kPalSize] = {};
- g_system->getPaletteManager()->setPalette(black, 0, 256);
+ getPaletteManager()->setPalette(black, 0, 256);
g_system->updateScreen();
fadePaletteFromBlack(target);
@@ -1570,7 +1573,7 @@ void EEMEngine::showMacStillLogo(uint picId, uint palId, uint holdMs,
}
byte black[kPalSize] = {};
- g_system->getPaletteManager()->setPalette(black, 0, 256);
+ getPaletteManager()->setPalette(black, 0, 256);
g_system->updateScreen();
fadePaletteFromBlack(target);
@@ -1632,7 +1635,7 @@ void EEMEngine::showMacTitleIntro() {
copyNativeSurfaceToScreen(frame);
byte black[kPalSize] = {};
- g_system->getPaletteManager()->setPalette(black, 0, 256);
+ getPaletteManager()->setPalette(black, 0, 256);
g_system->updateScreen();
fadePaletteFromBlack(target);
@@ -1744,7 +1747,7 @@ void EEMEngine::playMacCDIntro() {
g_system->copyRectToScreen(frame->getPixels(), frame->pitch, 0, 0,
MIN<int>(frame->w, screenWidth()), MIN<int>(frame->h, screenHeight()));
if (flic.hasDirtyPalette())
- g_system->getPaletteManager()->setPalette(flic.getPalette(), 0, 256);
+ getPaletteManager()->setPalette(flic.getPalette(), 0, 256);
g_system->updateScreen();
lastFrameMs = g_system->getMillis();
@@ -1857,7 +1860,7 @@ void EEMEngine::showStillPicture(uint picId, uint palId, uint holdMs,
SWAP(target[i], target[255 * 3 + i]);
}
byte black[kPalSize] = {};
- g_system->getPaletteManager()->setPalette(black, 0, 256);
+ getPaletteManager()->setPalette(black, 0, 256);
blitAt(pic, 0, 0);
g_system->updateScreen();
fadePaletteFromBlack(target);
@@ -1996,7 +1999,7 @@ void EEMEngine::showLondonCharSelect() {
byte pal[kPalSize];
byte black[kPalSize] = {};
- g_system->getPaletteManager()->setPalette(black, 0, 256);
+ getPaletteManager()->setPalette(black, 0, 256);
g_system->updateScreen();
const bool havePal = getSitePalette(0, pal);
if (!havePal)
@@ -2216,7 +2219,7 @@ void EEMEngine::showFloppyStormLogo() {
return;
}
byte black[kPalSize] = {};
- g_system->getPaletteManager()->setPalette(black, 0, 256);
+ getPaletteManager()->setPalette(black, 0, 256);
g_system->updateScreen();
if (_audio && !isDemo())
diff --git a/engines/eem/eem.h b/engines/eem/eem.h
index 550cc51447f..855ac3b0107 100644
--- a/engines/eem/eem.h
+++ b/engines/eem/eem.h
@@ -38,6 +38,8 @@
#include "engines/engine.h"
#include "engines/savestate.h"
+#include "graphics/paletteman.h"
+
#include "eem/animation.h"
#include "eem/font.h"
#include "eem/mystery.h"
@@ -53,6 +55,19 @@ class MusicPlayer;
/// VGA palette size in bytes (256 colours à RGB)
const uint kPalSize = 768;
+// Keep game colors uncorrected for fades and color matching. Apply the Mac
+// monitor gamma curve only when sending a palette to the backend.
+class MacPaletteManager : public PaletteManager {
+public:
+ void setPalette(const byte *colors, uint start, uint num) override;
+ void grabPalette(byte *colors, uint start, uint num) const override;
+
+private:
+ byte _colors[kPalSize] = {};
+};
+
+PaletteManager *getPaletteManager();
+
void fadeCurrentPaletteToBlack(uint delayMs = 8);
void fadePaletteFromBlack(const byte *target, uint delayMs = 8);
@@ -131,6 +146,7 @@ public:
~EEMEngine() override;
Common::Error run() override;
+ PaletteManager *getPaletteManager();
const char *getGameId() const;
Common::Platform getPlatform() const;
@@ -650,6 +666,7 @@ private:
EEMFont _newspaperFont;
Common::Array<byte> _sitePals; ///< 40 Ã 768 bytes, 6-bit VGA.
+ MacPaletteManager _macPaletteManager;
uint16 _lastScreen; ///< `_LastScreen @ 2d5d:3f24`.
uint16 _nextScreen; ///< `_NextScreen @ 2d5d:3f26`.
diff --git a/engines/eem/graphics.cpp b/engines/eem/graphics.cpp
index fee4139ff41..05f268de39a 100644
--- a/engines/eem/graphics.cpp
+++ b/engines/eem/graphics.cpp
@@ -29,6 +29,7 @@
#include "common/textconsole.h"
#include "graphics/cursorman.h"
+#include "graphics/macgamma.h"
#include "graphics/managed_surface.h"
#include "eem/audio.h"
@@ -39,6 +40,28 @@
namespace EEM {
+void MacPaletteManager::setPalette(const byte *colors, uint start, uint num) {
+ assert(start <= 256 && num <= 256 - start);
+ memcpy(_colors + start * 3, colors, num * 3);
+ byte corrected[kPalSize];
+ for (uint i = 0; i < num * 3; ++i)
+ corrected[i] = Graphics::macGammaCorrectionLookUp[colors[i]];
+ g_system->getPaletteManager()->setPalette(corrected, start, num);
+}
+
+void MacPaletteManager::grabPalette(byte *colors, uint start, uint num) const {
+ assert(start <= 256 && num <= 256 - start);
+ memcpy(colors, _colors + start * 3, num * 3);
+}
+
+PaletteManager *EEMEngine::getPaletteManager() {
+ return isMacintosh() ? &_macPaletteManager : g_system->getPaletteManager();
+}
+
+PaletteManager *getPaletteManager() {
+ return static_cast<EEMEngine *>(g_engine)->getPaletteManager();
+}
+
const uint16 kHelpPics[][2] = {
{ 0x0063, 0x01ae },
{ 0x0192, 0x01b1 },
diff --git a/engines/eem/mac_ui.cpp b/engines/eem/mac_ui.cpp
index 68f069f84ed..0de0696144d 100644
--- a/engines/eem/mac_ui.cpp
+++ b/engines/eem/mac_ui.cpp
@@ -137,7 +137,7 @@ bool runMacQuitDialog(const Common::Path &application) {
saved.copyFrom(*screen);
g_system->unlockScreen();
byte colors[kPalSize];
- g_system->getPaletteManager()->grabPalette(colors, 0, 256);
+ getPaletteManager()->grabPalette(colors, 0, 256);
const Graphics::Palette palette(colors, 256);
const byte black = palette.findBestColor(0, 0, 0);
const byte white = palette.findBestColor(255, 255, 255);
@@ -398,7 +398,7 @@ bool EEMEngine::doMacLondonPuzzle(Common::SeekableReadStream &stream) {
selectionRects[i].translate(dialogRect.left, dialogRect.top);
byte oldPalette[kPalSize];
- g_system->getPaletteManager()->grabPalette(oldPalette, 0, 256);
+ getPaletteManager()->grabPalette(oldPalette, 0, 256);
Graphics::Palette palette(oldPalette, 256);
Graphics::ManagedSurface background;
if (!loadPuzzlePicture(backgroundId, background, palette, true)) {
@@ -452,7 +452,7 @@ bool EEMEngine::doMacLondonPuzzle(Common::SeekableReadStream &stream) {
bool accepted = false;
bool done = false;
setInteractiveMouseCursor(false);
- g_system->getPaletteManager()->setPalette(palette.data(), 0, 256);
+ getPaletteManager()->setPalette(palette.data(), 0, 256);
if (type == 0)
g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
while (!done && !shouldQuit()) {
@@ -553,7 +553,7 @@ bool EEMEngine::doMacLondonPuzzle(Common::SeekableReadStream &stream) {
}
if (type == 0)
g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
- g_system->getPaletteManager()->setPalette(oldPalette, 0, 256);
+ getPaletteManager()->setPalette(oldPalette, 0, 256);
g_system->copyRectToScreen(saved.getPixels(), saved.pitch, 0, 0, saved.w, saved.h);
input.trim();
input.toUppercase();
diff --git a/engines/eem/map_ui.cpp b/engines/eem/map_ui.cpp
index dbf48790555..50cb9dfe8e8 100644
--- a/engines/eem/map_ui.cpp
+++ b/engines/eem/map_ui.cpp
@@ -999,7 +999,7 @@ bool EEMEngine::doLondonApproach(uint16 approachId) {
if (flic.hasDirtyPalette()) {
const byte *fpal = flic.getPalette();
if (fpal)
- g_system->getPaletteManager()->setPalette(fpal, 0, 256);
+ getPaletteManager()->setPalette(fpal, 0, 256);
}
g_system->updateScreen();
diff --git a/engines/eem/site.cpp b/engines/eem/site.cpp
index 592dd8eee03..d4bf4b6ddff 100644
--- a/engines/eem/site.cpp
+++ b/engines/eem/site.cpp
@@ -111,7 +111,7 @@ static byte findPaletteEndpoint(const byte *palette, bool wantWhite,
MacSpritePaletteMap getMacSpritePaletteMap() {
byte palette[256 * 3];
- g_system->getPaletteManager()->grabPalette(palette, 0, 256);
+ getPaletteManager()->grabPalette(palette, 0, 256);
MacSpritePaletteMap map;
map.white = findPaletteEndpoint(palette, true, 0x00, 0xFF, 0x00);
@@ -242,7 +242,7 @@ void cyclePaletteRange(uint8 start, uint8 end) {
return;
const uint count = (uint)end - (uint)start + 1;
byte buf[256 * 3];
- g_system->getPaletteManager()->grabPalette(buf, start, count);
+ getPaletteManager()->grabPalette(buf, start, count);
const byte savedR = buf[0];
const byte savedG = buf[1];
const byte savedB = buf[2];
@@ -254,7 +254,7 @@ void cyclePaletteRange(uint8 start, uint8 end) {
buf[(count - 1) * 3 + 0] = savedR;
buf[(count - 1) * 3 + 1] = savedG;
buf[(count - 1) * 3 + 2] = savedB;
- g_system->getPaletteManager()->setPalette(buf, start, count);
+ getPaletteManager()->setPalette(buf, start, count);
}
// `_OpenColorCycle @ 2520:04f7`
void cyclePaletteRangeReverse(uint8 start, uint8 end) {
@@ -262,7 +262,7 @@ void cyclePaletteRangeReverse(uint8 start, uint8 end) {
return;
const uint count = (uint)end - (uint)start + 1;
byte buf[256 * 3];
- g_system->getPaletteManager()->grabPalette(buf, start, count);
+ getPaletteManager()->grabPalette(buf, start, count);
const uint last = count - 1;
const byte savedR = buf[last * 3 + 0];
const byte savedG = buf[last * 3 + 1];
@@ -275,7 +275,7 @@ void cyclePaletteRangeReverse(uint8 start, uint8 end) {
buf[0] = savedR;
buf[1] = savedG;
buf[2] = savedB;
- g_system->getPaletteManager()->setPalette(buf, start, count);
+ getPaletteManager()->setPalette(buf, start, count);
}
void applyHotspotGlowPalette(bool macCD) {
@@ -286,7 +286,7 @@ void applyHotspotGlowPalette(bool macCD) {
0x0C, 0x9C, 0xBC, 0x20, 0xBC, 0xD0, 0x38, 0xDC, 0xE4,
0x0C, 0x9C, 0xBC
};
- g_system->getPaletteManager()->setPalette(kMacGlow, 0xF8, 7);
+ getPaletteManager()->setPalette(kMacGlow, 0xF8, 7);
return;
}
static const byte kAntsGlow[6 * 3] = {
@@ -297,7 +297,7 @@ void applyHotspotGlowPalette(bool macCD) {
0xC0, 0xC0, 0x00, // FD
0x80, 0x80, 0x00, // FE
};
- g_system->getPaletteManager()->setPalette(kAntsGlow, 0xF9, 6);
+ getPaletteManager()->setPalette(kAntsGlow, 0xF9, 6);
}
// `_WaitAnims @ 29be:021c`. 12 bytes per entry, indexed by `siteData[+8]`:
@@ -1759,7 +1759,7 @@ bool SiteScreen::enterMacSiteAnim(const Graphics::ManagedSurface &bg) {
};
byte palette[256 * 3];
- g_system->getPaletteManager()->grabPalette(palette, 0, 256);
+ getPaletteManager()->grabPalette(palette, 0, 256);
_vm->startTravelMusic();
fadePaletteFromBlack(palette);
@@ -2395,7 +2395,7 @@ void bumpHotspotEdgeColor(byte &color) {
byte currentWhitePaletteIndex(byte fallback) {
byte palette[256 * 3];
- g_system->getPaletteManager()->grabPalette(palette, 0, 256);
+ getPaletteManager()->grabPalette(palette, 0, 256);
for (uint i = 0; i < 256; i++) {
const byte *rgb = palette + i * 3;
if (rgb[0] >= 0xFC && rgb[1] >= 0xFC && rgb[2] >= 0xFC)
diff --git a/engines/eem/ui.cpp b/engines/eem/ui.cpp
index 38499892f1d..d3e015dec34 100644
--- a/engines/eem/ui.cpp
+++ b/engines/eem/ui.cpp
@@ -1088,6 +1088,19 @@ void clampProfileScroll(int &selected, int &start, int count) {
start = CLIP<int>(start, 0, maxStart);
}
+struct ChooserTextColors {
+ byte selected;
+ byte normal;
+ byte disabled;
+};
+
+ChooserTextColors getChooserTextColors(const EEMEngine *vm) {
+ // Mac EEM1 CD CODE 6:016e uses these SITEPALS indices in DrawList.
+ if (vm->isMacintosh())
+ return { 0x13, 0x5c, 0x1b };
+ return { 0x0f, 0x07, 0x08 };
+}
+
void drawProfilePickerFrame(const ProfilePickerView &v) {
Graphics::ManagedSurface scratch(v.vm->screenWidth(), v.vm->screenHeight(),
Graphics::PixelFormat::createFormatCLUT8());
@@ -1099,12 +1112,14 @@ void drawProfilePickerFrame(const ProfilePickerView &v) {
v.vm->scaleX(kProfilePickerRevealX),
v.vm->scaleY(kProfilePickerRevealY));
+ const ChooserTextColors colors = getChooserTextColors(v.vm);
const int count = v.entries ? (int)v.entries->size() : 0;
for (int row = 0; row < kProfileVisibleRows; row++) {
const int idx = v.start + row;
if (idx >= count)
break;
- const byte color = idx == v.selected ? 0xF : 0x8;
+ const byte color = idx == v.selected ? colors.selected :
+ v.vm->isMacintosh() ? colors.normal : colors.disabled;
v.vm->getFont().drawString(&scratch, (*v.entries)[idx].label,
v.vm->scaleX(kProfileListX),
v.vm->scaleY(kProfileListY + row * kProfileLineH),
@@ -1351,20 +1366,19 @@ void drawCaseSubmenu(const CaseSubmenuView &v) {
const int kLineH = 10;
const int kVisible = 12;
const uint count = (uint)v.names->size();
+ const ChooserTextColors colors = getChooserTextColors(v.vm);
for (int r = 0; r < kVisible; r++) {
const uint idx = v.topRow + (uint)r;
if (idx >= count)
break;
const Common::String &name = (*v.names)[idx];
- byte color = 0xF; // default
+ byte color = colors.normal;
if (idx == v.selRow) {
- color = 0xF; // highlighted
+ color = colors.selected;
} else if (v.solvedFlags && idx < v.solvedFlags->size() &&
(*v.solvedFlags)[idx]) {
- color = 0x8; // greyed (already solved)
- } else {
- color = 0x7; // normal
+ color = colors.disabled;
}
v.vm->getFont().drawString(&scratch, name,
v.vm->scaleX(kListX), v.vm->scaleY(kListY0 + r * kLineH),
@@ -1376,7 +1390,7 @@ void drawCaseSubmenu(const CaseSubmenuView &v) {
const int r = (int)(v.selRow - v.topRow);
v.vm->getFont().drawString(&scratch, ">",
v.vm->scaleX(kListX - 6), v.vm->scaleY(kListY0 + r * kLineH),
- v.vm->scaleX(6), 0xF);
+ v.vm->scaleX(6), colors.selected);
}
// Scrollbar thumb at (240, 45..146), proportional to scroll position.
@@ -1413,6 +1427,7 @@ void drawActionMenuFrame(const ActionMenuView &v) {
const int kListW = 238 - kListX;
const int kListY0 = 35;
const int kLineH = 10;
+ const ChooserTextColors colors = getChooserTextColors(v.vm);
// Separator/item pairs (0=sep, 1=Choose A Mystery, ..., trailing sep):
// 11 rows for EEM1's five picks, 9 for London's four (no ScrapBook 3).
@@ -1422,13 +1437,14 @@ void drawActionMenuFrame(const ActionMenuView &v) {
if ((r & 1) == 0) {
v.vm->getFont().drawString(&scratch, v.separator,
v.vm->scaleX(kListX), v.vm->scaleY(y),
- v.vm->scaleX(kListW), 0x7);
+ v.vm->scaleX(kListW),
+ v.vm->isMacintosh() ? colors.disabled : colors.normal);
continue;
}
const uint mp = (uint)(r >> 1);
const bool isSel = (mp == v.pick);
- const byte color = isSel ? 0xF :
- v.pickEnabled[mp] ? 0x7 : 0x8;
+ const byte color = isSel ? colors.selected :
+ v.pickEnabled[mp] ? colors.normal : colors.disabled;
v.vm->getFont().drawString(&scratch, v.pickLabel[mp],
v.vm->scaleX(kListX), v.vm->scaleY(y),
v.vm->scaleX(kListW), color);
More information about the Scummvm-git-logs
mailing list