[Scummvm-git-logs] scummvm master -> eb86d2794ced96c929a090efbb5d6a525b0e2fa5
moralrecordings
noreply at scummvm.org
Tue Jun 18 10:25:11 UTC 2024
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:
e1f2418c17 GRAPHICS: MACGUI: Fix MacMenu to support 32-bit graphics
fb77e59dd5 DIRECTOR: Update detection table for karma
eb86d2794c DIRECTOR: Check output of thawLingoPlayState
Commit: e1f2418c17b5fb6cff31c8a59b8fc8db07e4acd9
https://github.com/scummvm/scummvm/commit/e1f2418c17b5fb6cff31c8a59b8fc8db07e4acd9
Author: Scott Percival (code at moral.net.au)
Date: 2024-06-18T18:24:08+08:00
Commit Message:
GRAPHICS: MACGUI: Fix MacMenu to support 32-bit graphics
Changed paths:
graphics/macgui/macmenu.cpp
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index fa1d7eefde9..b9281ce655e 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -91,7 +91,7 @@ MacMenu::MacMenu(int id, const Common::Rect &bounds, MacWindowManager *wm)
_type = MacWindowConstants::kWindowMenu;
- _screen.create(bounds.width(), bounds.height(), PixelFormat::createFormatCLUT8());
+ _screen.create(bounds.width(), bounds.height(), _wm->_pixelformat);
_bbox.left = 0;
_bbox.top = 0;
@@ -129,7 +129,7 @@ MacMenu::MacMenu(int id, const Common::Rect &bounds, MacWindowManager *wm)
_isModal = false;
- _tempSurface.create(_screen.w, _font->getFontHeight(), PixelFormat::createFormatCLUT8());
+ _tempSurface.create(_screen.w, _font->getFontHeight(), _wm->_pixelformat);
}
MacMenu::~MacMenu() {
@@ -966,15 +966,45 @@ void MacMenu::calcSubMenuBounds(MacMenuSubMenu *submenu, int x, int y) {
}
}
+template <typename T>
static void drawPixelPlain(int x, int y, int color, void *data) {
ManagedSurface *surface = (ManagedSurface *)data;
if (x >= 0 && x < surface->w && y >= 0 && y < surface->h)
- *((byte *)surface->getBasePtr(x, y)) = (byte)color;
+ *((T *)surface->getBasePtr(x, y)) = (T)color;
}
+template <typename T>
static void drawFilledRoundRect(ManagedSurface *surface, Common::Rect &rect, int arc, int color) {
- drawRoundRect(rect, arc, color, true, drawPixelPlain, surface);
+ drawRoundRect(rect, arc, color, true, drawPixelPlain<T>, surface);
+}
+
+template <typename T>
+static void drawMenuPattern(ManagedSurface &srcSurf, ManagedSurface &destSurf, const byte *pattern, int x, int y, int width, uint32 colorKey) {
+ // I am lazy to extend drawString() with plotProc as a parameter, so
+ // fake it here
+
+ for (int ii = 0; ii < srcSurf.h; ii++) {
+ const T *src = (const T *)srcSurf.getBasePtr(0, ii);
+ T *dst = (T *)destSurf.getBasePtr(x, y + ii);
+ byte pat = pattern[ii % 8];
+ for (int j = 0; j < width; j++) {
+ if (*src != colorKey && (pat & (1 << (7 - (x + j) % 8))))
+ *dst = *src;
+ src++;
+ dst++;
+ }
+ }
+}
+
+template <typename T>
+static void drawMenuDelimiter(ManagedSurface &srcSurf, Common::Rect *r, int y, uint32 black, uint32 white) {
+ bool flip = r->left & 2;
+ T *ptr = (T *)srcSurf.getBasePtr(r->left + 1, y);
+ for (int xx = r->left + 1; xx <= r->right - 1; xx++, ptr++) {
+ *ptr = flip ? black : white;
+ flip = !flip;
+ }
}
static void underlineAccelerator(ManagedSurface *dst, const Font *font, const Common::UnicodeBiDiText &txt, int x, int y, int shortcutPos, uint32 color) {
@@ -1016,7 +1046,11 @@ bool MacMenu::draw(ManagedSurface *g, bool forceRedraw) {
// Fill in the corners with black
_screen.fillRect(r, _wm->_colorBlack);
- drawFilledRoundRect(&_screen, r, shouldUseDesktopArc ? kDesktopArc : 0, _wm->_colorWhite);
+ if (_wm->_pixelformat.bytesPerPixel == 1) {
+ drawFilledRoundRect<byte>(&_screen, r, shouldUseDesktopArc ? kDesktopArc : 0, _wm->_colorWhite);
+ } else {
+ drawFilledRoundRect<uint32>(&_screen, r, shouldUseDesktopArc ? kDesktopArc : 0, _wm->_colorWhite);
+ }
r.top = 7;
_screen.fillRect(r, _wm->_colorWhite);
@@ -1184,27 +1218,18 @@ void MacMenu::renderSubmenu(MacMenuSubMenu *menu, bool recursive) {
drawSubMenuArrow(s, arrowX, ty, color);
if (!menu->items[i]->enabled) {
- // I am lazy to extend drawString() with plotProc as a parameter, so
- // fake it here
- for (int ii = 0; ii < _tempSurface.h; ii++) {
- const byte *src = (const byte *)_tempSurface.getBasePtr(0, ii);
- byte *dst = (byte *)_screen.getBasePtr(x, y + ii);
- byte pat = _wm->getBuiltinPatterns()[kPatternCheckers2 - 1][ii % 8];
- for (int j = 0; j < r->width(); j++) {
- if (*src != _wm->_colorGreen && (pat & (1 << (7 - (x + j) % 8))))
- *dst = *src;
- src++;
- dst++;
- }
+ if (_wm->_pixelformat.bytesPerPixel == 1) {
+ drawMenuPattern<byte>(_tempSurface, _screen, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, r->width(), _wm->_colorGreen);
+ } else {
+ drawMenuPattern<uint32>(_tempSurface, _screen, _wm->getBuiltinPatterns()[kPatternCheckers2 - 1], x, y, r->width(), _wm->_colorGreen);
}
}
} else { // Delimiter
- bool flip = r->left & 2;
- byte *ptr = (byte *)_screen.getBasePtr(r->left + 1, y + _menuDropdownItemHeight / 2);
- for (int xx = r->left + 1; xx <= r->right - 1; xx++, ptr++) {
- *ptr = flip ? _wm->_colorBlack : _wm->_colorWhite;
- flip = !flip;
+ if (_wm->_pixelformat.bytesPerPixel == 1) {
+ drawMenuDelimiter<byte>(_screen, r, y + _menuDropdownItemHeight / 2, _wm->_colorBlack, _wm->_colorWhite);
+ } else {
+ drawMenuDelimiter<uint32>(_screen, r, y + _menuDropdownItemHeight / 2, _wm->_colorBlack, _wm->_colorWhite);
}
}
Commit: fb77e59dd5d11f4b79f61629618629815f1c888e
https://github.com/scummvm/scummvm/commit/fb77e59dd5d11f4b79f61629618629815f1c888e
Author: Scott Percival (code at moral.net.au)
Date: 2024-06-18T18:24:08+08:00
Commit Message:
DIRECTOR: Update detection table for karma
Changed paths:
engines/director/detection_tables.h
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index c9efaaaea91..fe02b421df5 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -4645,8 +4645,8 @@ static const DirectorGameDescription gameDescriptions[] = {
// Original Taiwan release is called å¡å
æçå¹²âæ¦ç
ä¼ å¥ (Taklamakan: Dunhuang Chuanqi)
MACGAME1("karma", "", "Karma", "ea646eccc9a53f44ce082459d4809a06", 485279, 404),
- WINGAME2("karma", "", "KARMA.EXE", "e830af6b5dfca4964184e7d61039e120", 697047,
- "01_0Y.BIM", "246c2f5ab5499d46f395aa9d0da05c9a", 780158, 404),
+ WINGAME2("karma", "", "USER/KARMA.EXE", "t:72d9457a163a02702d4550fe53833c17", 697047,
+ "USER/01_0Y.BIM", "f:246c2f5ab5499d46f395aa9d0da05c9a", 780158, 404),
WINGAME1_l("karma", "", "DH.EXE", "f917ac9c649bff9eaf538ae69432a145", 690991, Common::ZH_TWN, 400),
MACGAME1_l("karma", "", "Karma", "rt:a002b7710fd2a968ff1ddd5aa9819f8f", 485279, Common::DE_DEU, 404),
WINGAME2_l("karma", "", "KARMA.EXE", "t:abe9fe1d7ae185cacb6f9f3e5fa8fe77", 697079,
Commit: eb86d2794ced96c929a090efbb5d6a525b0e2fa5
https://github.com/scummvm/scummvm/commit/eb86d2794ced96c929a090efbb5d6a525b0e2fa5
Author: Scott Percival (code at moral.net.au)
Date: 2024-06-18T18:24:08+08:00
Commit Message:
DIRECTOR: Check output of thawLingoPlayState
Changed paths:
engines/director/score.cpp
engines/director/window.cpp
engines/director/window.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index ee9150f5ff1..50712f51ab1 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -135,17 +135,18 @@ bool Score::processFrozenScripts(bool recursion, int count) {
// Unfreeze the play script if the special flag is set
if (g_lingo->_playDone) {
g_lingo->_playDone = false;
- _window->thawLingoPlayState();
- Symbol currentScript = _window->getLingoState()->callstack.front()->sp;
- g_lingo->switchStateFromWindow();
- bool completed = g_lingo->execute();
- if (!completed) {
- debugC(3, kDebugLingoExec, "Score::processFrozenScripts(): State froze again mid-thaw, interrupting");
- return false;
- } else if (currentScript == g_lingo->_currentInputEvent) {
- // script that just completed was the current input event, clear the flag
- debugC(3, kDebugEvents, "Score::processFrozenScripts(): Input event completed");
- g_lingo->_currentInputEvent = Symbol();
+ if (_window->thawLingoPlayState()) {
+ Symbol currentScript = _window->getLingoState()->callstack.front()->sp;
+ g_lingo->switchStateFromWindow();
+ bool completed = g_lingo->execute();
+ if (!completed) {
+ debugC(3, kDebugLingoExec, "Score::processFrozenScripts(): State froze again mid-thaw, interrupting");
+ return false;
+ } else if (currentScript == g_lingo->_currentInputEvent) {
+ // script that just completed was the current input event, clear the flag
+ debugC(3, kDebugEvents, "Score::processFrozenScripts(): Input event completed");
+ g_lingo->_currentInputEvent = Symbol();
+ }
}
}
diff --git a/engines/director/window.cpp b/engines/director/window.cpp
index b96e2633372..6b65cb85559 100644
--- a/engines/director/window.cpp
+++ b/engines/director/window.cpp
@@ -649,19 +649,20 @@ void Window::freezeLingoPlayState() {
debugC(kDebugLingoExec, 3, "Freezing Lingo play state");
}
-void Window::thawLingoPlayState() {
+bool Window::thawLingoPlayState() {
if (!_lingoPlayState) {
warning("Tried to thaw when there's no frozen play state, ignoring");
- return;
+ return false;
}
if (!_lingoState->callstack.empty()) {
warning("Can't thaw a Lingo state in mid-execution, ignoring");
- return;
+ return false;
}
delete _lingoState;
debugC(kDebugLingoExec, 3, "Thawing Lingo play state");
_lingoState = _lingoPlayState;
_lingoPlayState = nullptr;
+ return true;
}
diff --git a/engines/director/window.h b/engines/director/window.h
index 4f8f1fef761..8a3e877d0ce 100644
--- a/engines/director/window.h
+++ b/engines/director/window.h
@@ -164,7 +164,7 @@ public:
void freezeLingoState();
void thawLingoState();
void freezeLingoPlayState();
- void thawLingoPlayState();
+ bool thawLingoPlayState();
LingoState *getLastFrozenLingoState() { return _frozenLingoStates.empty() ? nullptr : _frozenLingoStates[_frozenLingoStates.size() - 1]; }
// events.cpp
More information about the Scummvm-git-logs
mailing list