[Scummvm-git-logs] scummvm master -> 68852b1a59c94f0fb88788cebcd45dfbc3eeea55

mduggan noreply at scummvm.org
Thu Jan 23 10:35:12 UTC 2025


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

Summary:
58593724e5 DGDS: Fix EGA menu colors
817ff4d8d5 DGDS: Correct a hack that breaks shooting snakes in HoC
b344d053a5 DGDS: Fixes for willy beamish interactions
45a553d749 DGDS: Dump DDS data version and id on load
b0e6fdaff7 DGDS: Fix DDS unload operation
68852b1a59 DGDS: Don't need return val from load dialog op


Commit: 58593724e5d357cb19611d88fb03d34c297c8fb8
    https://github.com/scummvm/scummvm/commit/58593724e5d357cb19611d88fb03d34c297c8fb8
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-01-23T19:50:48+11:00

Commit Message:
DGDS: Fix EGA menu colors

Dragon EGA menus now look right.  Heart of China still needs correct palette
overall but the color number should now be right.

Changed paths:
    engines/dgds/request.cpp


diff --git a/engines/dgds/request.cpp b/engines/dgds/request.cpp
index 1ed0046c6e7..d0687243b35 100644
--- a/engines/dgds/request.cpp
+++ b/engines/dgds/request.cpp
@@ -45,24 +45,36 @@ static const byte DragonSliderColors[] = {
 	0x7B, 0x4D, 0xF4, 0x54, 0xDF, 0x74, 0x58
 };
 
+static const byte DragonEGAButtonColors[] = {
+	0x7, 0x8, 0x7, 0x0, 0xF, 0x7, 0xC, 0x4, 0x0, 0xF, 0xF, 0xC, 0x4
+};
+
+static const byte DragonEGASliderColors[] {
+	0x7, 0xF, 0x8, 0x7, 0x0, 0x7, 0x7
+};
+
 static const byte DragonHeaderTxtColor = 0;
 static const byte DragonHeaderTopColor = 0;
 static const byte DragonHeaderBottomColor = 15;
-static const byte DragonFallbackColors[] = {
-	0x7, 0x7, 0x8, 0x7, 0x0, 0xF, 0x7, 0xC,
-	0x4, 0x0, 0xF, 0xF, 0xC, 0x4, 0x7, 0xF,
-	0x8, 0x7, 0x0, 0x7, 0x7
-};
+static const byte DragonBackgroundColor = 7;
 
 static const byte ChinaBackgroundColor = 23;
 static const byte ChinaHeaderTxtColor = 25;
 static const byte ChinaHeaderTopColor = 16;
 static const byte ChinaHeaderBottomColor = 20;
 static const byte ChinaButtonColorsOn[] = {
-	0x10, 0x11, 0x10, 0x10, 0x10, 0x06, 0x14, 0x1A,
+	0x10, 0x11, 0x10, 0x10, 0x10, 0x06, 0x14, 0x1A
 };
 static const byte ChinaButtonColorsOff[] = {
-	0x10, 0x14, 0x06, 0x18, 0x10, 0x11, 0x14, 0x13,
+	0x10, 0x14, 0x06, 0x18, 0x10, 0x11, 0x14, 0x13
+};
+
+static const byte ChinaEGAButtonColorsOn[] = {
+	8, 15, 14, 14, 14, 6, 0, 8
+};
+
+static const byte ChinaEGAButtonColorsOff[] = {
+	6, 0, 8, 6, 14, 7, 0, 0
 };
 
 static const byte ChinaSliderColors[] = {
@@ -356,25 +368,27 @@ byte ButtonGadget::drawDragonBg(Graphics::ManagedSurface *dst, bool enabled) con
 	int16 x2 = right - 1;
 	int16 bottom = (y + _height) - 1;
 
-	byte fill = DragonButtonColors[0];
-	dst->drawLine(x, y, x2, y, fill);
-	dst->drawLine(x + 2, y + 2, right - 3, y + 2, fill);
-	dst->drawLine(x + 1, bottom - 2, x + 1, bottom - 2, fill);
-	dst->drawLine(right - 2, bottom - 2, right - 2, bottom - 2, fill);
-	dst->drawLine(x + 1, bottom - 1, right - 2, bottom - 1, fill);
-
-	fill = DragonButtonColors[1];
-	dst->drawLine(x, y + 1, x, bottom, fill);
-	dst->drawLine(x2, y + 1, x2, bottom, fill);
-	dst->drawLine(x + 2, y + 3, x + 2, bottom - 2, fill);
-	dst->drawLine(right - 3, y + 3, right - 3, bottom - 2, fill);
-	dst->drawLine(x + 3,bottom - 2, right - 4, bottom - 2, fill);
-
-	fill = DragonButtonColors[2];
-	dst->drawLine(x + 1, y + 2, x + 1, bottom - 3, fill);
-	dst->drawLine(right - 2, y + 2, right - 2, bottom - 3, fill);
-	dst->drawLine(x + 1, bottom, right - 2, bottom, DragonButtonColors[3]);
-	dst->drawLine(x + 1, y + 1, right - 2, y + 1, DragonButtonColors[4]);
+	const byte *colors = DgdsEngine::getInstance()->isEGA() ? DragonEGAButtonColors : DragonButtonColors;
+
+	byte fill = colors[0];
+	dst->hLine(x, y, x2, fill);
+	dst->hLine(x + 2, y + 2, right - 3, fill);
+	dst->hLine(x + 1, bottom - 2, x + 1, fill);
+	dst->hLine(right - 2, bottom - 2, right - 2, fill);
+	dst->hLine(x + 1, bottom - 1, right - 2, fill);
+
+	fill = colors[1];
+	dst->vLine(x, y + 1,  bottom, fill);
+	dst->vLine(x2, y + 1, bottom, fill);
+	dst->vLine(x + 2, y + 3, bottom - 2, fill);
+	dst->vLine(right - 3, y + 3, bottom - 2, fill);
+	dst->hLine(x + 3,bottom - 2, right - 4, fill);
+
+	fill = colors[2];
+	dst->vLine(x + 1, y + 2, bottom - 3, fill);
+	dst->vLine(right - 2, y + 2, bottom - 3, fill);
+	dst->hLine(x + 1, bottom, right - 2, colors[3]);
+	dst->hLine(x + 1, y + 1, right - 2, colors[4]);
 
 	int colOffset;
 	if (enabled) {
@@ -383,14 +397,14 @@ byte ButtonGadget::drawDragonBg(Graphics::ManagedSurface *dst, bool enabled) con
 		colOffset = 9;
 	}
 
-	dst->drawLine(x + 3, y + 3, right - 4, y + 3, DragonButtonColors[colOffset + 1]);
+	dst->hLine(x + 3, y + 3, right - 4, colors[colOffset + 1]);
 
 	// TODO: This is done with a different call in the game.. is there some reason for that?
-	dst->fillRect(Common::Rect(x + 3, y + 4, x + 3 + _width - 6, y + 4 + _height - 8), DragonButtonColors[colOffset + 2]);
+	dst->fillRect(Common::Rect(x + 3, y + 4, x + 3 + _width - 6, y + 4 + _height - 8), colors[colOffset + 2]);
 
-	dst->drawLine(x + 3, bottom - 3, right - 4, bottom - 3, DragonButtonColors[colOffset + 3]);
+	dst->hLine(x + 3, bottom - 3, right - 4, colors[colOffset + 3]);
 
-	return DragonButtonColors[colOffset];
+	return colors[colOffset];
 }
 
 byte ButtonGadget::drawChinaBg(Graphics::ManagedSurface *dst, bool enabled) const {
@@ -400,14 +414,16 @@ byte ButtonGadget::drawChinaBg(Graphics::ManagedSurface *dst, bool enabled) cons
 	int16 y = pt.y;
 	int16 y2 = y + _height - 1;
 	int cnum = 0;
-	const byte *colors = (enabled ? ChinaButtonColorsOn : ChinaButtonColorsOff);
+	const byte *colors = DgdsEngine::getInstance()->isEGA() ?
+			(enabled ? ChinaEGAButtonColorsOn : ChinaEGAButtonColorsOff) :
+			(enabled ? ChinaButtonColorsOn : ChinaButtonColorsOff);
 
 	for (int i = 0; i < 7; i++) {
 		byte drawCol = colors[cnum];
 		cnum++;
 		if (i < 3) {
-			dst->drawLine(x + i + 1, y + i, x2 - i, y + i, drawCol);
-			dst->drawLine(x2 - i, y + i + 1, x2 - i, y2 - i, drawCol);
+			dst->hLine(x + i + 1, y + i, x2 - i, drawCol);
+			dst->vLine(x2 - i, y + i + 1, y2 - i, drawCol);
 		} else if (i < 4) {
 			int16 rheight, rwidth;
 			if (_height + -6 < 3)
@@ -423,8 +439,8 @@ byte ButtonGadget::drawChinaBg(Graphics::ManagedSurface *dst, bool enabled) cons
 			dst->fillRect(Common::Rect(Common::Point(x + 3, y + 3), rwidth, rheight), drawCol);
 		} else {
 			int16 x2_ = 6 - i;
-			dst->drawLine(x + x2_, y + x2_, x + x2_, y2 - x2_, drawCol);
-			dst->drawLine(x + x2_, y2 - x2_, (x2 - x2_) + -1, y2 - x2_, drawCol);
+			dst->vLine(x + x2_, y + x2_, y2 - x2_, drawCol);
+			dst->hLine(x + x2_, y2 - x2_, (x2 - x2_) + -1, drawCol);
 		}
 	}
 	return colors[7];
@@ -645,19 +661,22 @@ void SliderGadget::drawDragonBg(Graphics::ManagedSurface *dst) const {
 	int16 y2 = (y + _height) - 1;
 
 	int16 y1 = y - 1;
-	dst->drawLine(x - 2, y - 1, x - 2, y2, DragonSliderColors[0]);
-	dst->drawLine(x - 1, y1, x - 1, y2, DragonSliderColors[1]);
-	dst->drawLine(x, y2, x2 - 1, y2, DragonSliderColors[1]);
-	dst->drawLine(x, y1, x2, y1, DragonSliderColors[2]);
-	dst->drawLine(x2, y1, x2, y2, DragonSliderColors[2]);
-	dst->drawLine(x2 + 1, y1, x2 + 1, y2, DragonSliderColors[3]);
-	dst->drawLine(x, y, x2 - 1, y, DragonSliderColors[4]);
-	dst->drawLine(x2 - 1, y + 1, x2 - 1, (y + _height) - 2, DragonSliderColors[4]);
+
+	static const byte *colors = DgdsEngine::getInstance()->isEGA() ? DragonEGASliderColors : DragonSliderColors;
+
+	dst->vLine(x - 2, y - 1, y2, colors[0]);
+	dst->vLine(x - 1, y1, y2, colors[1]);
+	dst->hLine(x, y2, x2 - 1, colors[1]);
+	dst->hLine(x, y1, x2, colors[2]);
+	dst->vLine(x2, y1, y2, colors[2]);
+	dst->vLine(x2 + 1, y1, y2, colors[3]);
+	dst->hLine(x, y, x2 - 1, colors[4]);
+	dst->vLine(x2 - 1, y + 1, (y + _height) - 2, colors[4]);
 	// This is not exactly what happens in the original, but gets the same result
 	Common::Rect fillrect = Common::Rect(x, y + 1, x + _width - 1, y + _height - 1);
-	dst->fillRect(fillrect, DragonSliderColors[5]);
+	dst->fillRect(fillrect, colors[5]);
 	fillrect.grow(-1);
-	dst->fillRect(fillrect, DragonSliderColors[6]);
+	dst->fillRect(fillrect, colors[6]);
 }
 
 void SliderGadget::drawChinaBg(Graphics::ManagedSurface *dst) const {
@@ -667,32 +686,32 @@ void SliderGadget::drawChinaBg(Graphics::ManagedSurface *dst) const {
 	int16 x2 = x + _width + 2;
 
 	// left 1st
-    dst->drawLine(x - 2, y - 1, x - 2, y2 + 1, ChinaSliderColors[0]);
+    dst->vLine(x - 2, y - 1, y2 + 1, ChinaSliderColors[0]);
     // left 2nd
-    dst->drawLine(x - 1, y, x - 1, y2, ChinaSliderColors[1]);
+    dst->vLine(x - 1, y, y2, ChinaSliderColors[1]);
     // left 3rd
-	dst->drawLine(x, y + 1, x, y2 - 1, ChinaSliderColors[2]);
+	dst->vLine(x, y + 1, y2 - 1, ChinaSliderColors[2]);
 
 	// top 1st
-	dst->drawLine(x - 1, y - 1, x2, y - 1, ChinaSliderColors[2]);
+	dst->hLine(x - 1, y - 1, x2,ChinaSliderColors[2]);
 	// top 2nd
-	dst->drawLine(x, y, x2 - 1, y, ChinaSliderColors[0]);
+	dst->hLine(x, y, x2 - 1,  ChinaSliderColors[0]);
 	// top 3rd
-	dst->drawLine(x + 1, y + 1, x2 - 2, y + 1, ChinaSliderColors[3]);
+	dst->hLine(x + 1, y + 1, x2 - 2, ChinaSliderColors[3]);
 
 	// right 1st
-	dst->drawLine(x2 - 1, y + 1, x2 - 1, y2 - 1, ChinaSliderColors[3]);
+	dst->vLine(x2 - 1, y + 1, y2 - 1, ChinaSliderColors[3]);
 	// right 2nd
-	dst->drawLine(x2, y, x2, y2, ChinaSliderColors[0]);
+	dst->vLine(x2, y, y2, ChinaSliderColors[0]);
 	// right 3rd
-	dst->drawLine(x2 + 1, y - 1, x2 + 1, y2 + 1, ChinaSliderColors[2]);
+	dst->vLine(x2 + 1, y - 1, y2 + 1, ChinaSliderColors[2]);
 
 	// bottom 1st
-	dst->drawLine(x + 1, y2 - 1, x2 - 2, y2 - 1, ChinaSliderColors[2]);
+	dst->hLine(x + 1, y2 - 1, x2 - 2, ChinaSliderColors[2]);
 	// bottom 2nd
-	dst->drawLine(x, y2, x2 - 1, y2, ChinaSliderColors[1]);
+	dst->hLine(x, y2, x2 - 1, ChinaSliderColors[1]);
 	// bottom 3rd
-	dst->drawLine(x - 1, y2 + 1, x2, y2 + 1, ChinaSliderColors[0]);
+	dst->hLine(x - 1, y2 + 1, x2, ChinaSliderColors[0]);
 
 	Common::Rect fillrect = Common::Rect(x + 1, y + 2, x2 - 1, y2 - 1);
 	dst->fillRect(fillrect, ChinaSliderColors[4]);
@@ -986,10 +1005,10 @@ void RequestData::drawHeader(Graphics::ManagedSurface *dst, int16 x, int16 y, in
 
 		font->drawString(dst, header, hleft + 1, htop + 2, hwidth, fontCol);
 		if (drawBox) {
-			dst->drawLine(hleft - 3, htop, hright, htop, boxTopColor);
-			dst->drawLine(hright, htop + 1, hright, hbottom, boxTopColor);
-			dst->drawLine(hleft - 3, htop + 1, hleft - 3, hbottom, boxBottomColor);
-			dst->drawLine(hleft - 2, hbottom, hleft + hwidth + 2, hbottom, boxBottomColor);
+			dst->hLine(hleft - 3, htop, hright, boxTopColor);
+			dst->vLine(hright, htop + 1, hbottom, boxTopColor);
+			dst->vLine(hleft - 3, htop + 1, hbottom, boxBottomColor);
+			dst->hLine(hleft - 2, hbottom, hleft + hwidth + 2, boxBottomColor);
 		}
 	}
 }
@@ -1090,7 +1109,7 @@ void RequestData::fillBackground(Graphics::ManagedSurface *dst, uint16 x, uint16
 				coloffset = ARRAYSIZE(MenuBackgroundColors) - 1;
 		}
 	} else {
-		byte bgCol = DragonFallbackColors[0];
+		byte bgCol = DragonBackgroundColor;
 		if (engine->getGameId() == GID_HOC)
 			bgCol = ChinaBackgroundColor;
 		else if (engine->getGameId() == GID_WILLY)


Commit: 817ff4d8d59d9a51e1dc935532db75690fa8c39d
    https://github.com/scummvm/scummvm/commit/817ff4d8d59d9a51e1dc935532db75690fa8c39d
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-01-23T19:50:48+11:00

Commit Message:
DGDS: Correct a hack that breaks shooting snakes in HoC

This hack was put in before dialogs were working correctly, change it to work
more closely to how the left button down should work

Changed paths:
    engines/dgds/scene.cpp


diff --git a/engines/dgds/scene.cpp b/engines/dgds/scene.cpp
index d828fd9f41d..5f3ecf4e655 100644
--- a/engines/dgds/scene.cpp
+++ b/engines/dgds/scene.cpp
@@ -1428,18 +1428,20 @@ void SDSScene::onDragFinish(const Common::Point &pt) {
 }
 
 void SDSScene::mouseRDown(const Common::Point &pt) {
+	Dialog *dlg = getVisibleDialog();
+	if (dlg) {
+		// also allow right-click to clear dialogs
+		_shouldClearDlg = true;
+		return;
+	}
 	_rbuttonDown = true;
 }
 
 void SDSScene::mouseRUp(const Common::Point &pt) {
-	_rbuttonDown = false;
-	Dialog *dlg = getVisibleDialog();
-	if (dlg) {
-		// HACK: Check for dialog action selection! for now, just close
-		// it here to make game playable.
-		dlg->clear();
+	if (!_rbuttonDown)
 		return;
-	}
+
+	_rbuttonDown = false;
 
 	DgdsEngine *engine = DgdsEngine::getInstance();
 	if (engine->getGameId() == GID_WILLY) {


Commit: b344d053a5f352db9497084f6a3d11a027e16198
    https://github.com/scummvm/scummvm/commit/b344d053a5f352db9497084f6a3d11a027e16198
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-01-23T19:50:48+11:00

Commit Message:
DGDS: Fixes for willy beamish interactions

Willy handles dragging of items a bit differently to the other games, try to be
a bit more like the original.  Specifically:
* Drag-drop does not need the mouse to be held down
* Don't reopen the inventory if that's where we dragged an item from

Also fix some small crashes in an older Willy Beamish demo.

Changed paths:
    engines/dgds/detection_tables.h
    engines/dgds/dgds.cpp
    engines/dgds/dgds.h
    engines/dgds/dialog.cpp
    engines/dgds/inventory.cpp
    engines/dgds/scene.cpp
    engines/dgds/scene.h
    engines/dgds/scene_op.cpp


diff --git a/engines/dgds/detection_tables.h b/engines/dgds/detection_tables.h
index 6712b7be996..1436c89b5b4 100644
--- a/engines/dgds/detection_tables.h
+++ b/engines/dgds/detection_tables.h
@@ -23,6 +23,7 @@ namespace Dgds {
 
 enum DgdsADGFFlags {
 	ADGF_DGDS_EGA = 1,
+	ADGF_DGDS_ALT_DIALOG_COLORS = 2,
 };
 
 static const ADGameDescription gameDescriptions[] = {
@@ -250,7 +251,11 @@ static const ADGameDescription gameDescriptions[] = {
 		GUIO1(GUIO_NONE)
 	},
 
+	//
 	// Adventures of Willy Beamish Demo from Joystick Magazine 1995 September disk
+	// Interactive demo with different dialog rendering which needs some hard-coded
+	// color differences
+	//
 	{
 		"beamish",
 		0,
@@ -261,7 +266,7 @@ static const ADGameDescription gameDescriptions[] = {
 		},
 		Common::EN_ANY,
 		Common::kPlatformDOS,
-		ADGF_UNSTABLE | ADGF_DEMO,
+		ADGF_UNSTABLE | ADGF_DEMO | ADGF_DGDS_ALT_DIALOG_COLORS,
 		GUIO1(GUIO_NONE)
 	},
 
@@ -398,7 +403,7 @@ static const ADGameDescription gameDescriptions[] = {
 		},
 		Common::EN_ANY,
 		Common::kPlatformDOS,
-		ADGF_DEMO | ADGF_UNSTABLE,
+		ADGF_DEMO,
 		GUIO1(GUIO_NONE)
 	},
 
diff --git a/engines/dgds/dgds.cpp b/engines/dgds/dgds.cpp
index bd6bb9ee383..77cf29eecab 100644
--- a/engines/dgds/dgds.cpp
+++ b/engines/dgds/dgds.cpp
@@ -88,13 +88,14 @@ DgdsEngine::DgdsEngine(OSystem *syst, const ADGameDescription *gameDesc)
 	_detailLevel(kDgdsDetailHigh), _textSpeed(1), _justChangedScene1(false), _justChangedScene2(false),
 	_random("dgds"), _currentCursor(-1), _menuToTrigger(kMenuNone), _isLoading(true), _flipMode(false),
 	_rstFileName(nullptr), _difficulty(1), _menu(nullptr), _adsInterp(nullptr), _isDemo(false),
-	_dragonArcade(nullptr), _chinaTank(nullptr), _chinaTrain(nullptr), _skipNextFrame(false),
+	_dragonArcade(nullptr), _chinaTank(nullptr), _chinaTrain(nullptr), _isAltDlgColors(false),
 	_gameId(GID_INVALID), _thisFrameMs(0), _lastGlobalFade(-1), _lastGlobalFadedPal(0),
 	_debugShowHotAreas(false), _lastMouseEvent(Common::EVENT_INVALID) {
 
 	_platform = gameDesc->platform;
 	_gameLang = gameDesc->language;
 	_isEGA = (gameDesc->flags & ADGF_DGDS_EGA);
+	_isAltDlgColors = (gameDesc->flags & ADGF_DGDS_ALT_DIALOG_COLORS);
 
 	if (!strcmp(gameDesc->gameId, "rise")) {
 		_gameId = GID_DRAGON;
@@ -819,10 +820,6 @@ Common::Error DgdsEngine::run() {
 		static const int framesPerSecond = 15;
 
 		frameCount++;
-		if (_skipNextFrame) {
-			frameCount++;
-			_skipNextFrame = false;
-		}
 
 		uint32 thisFrameEndMillis = g_system->getMillis();
 		uint32 elapsedMillis = thisFrameEndMillis - startMillis;
diff --git a/engines/dgds/dgds.h b/engines/dgds/dgds.h
index a715611e11a..418d9eee821 100644
--- a/engines/dgds/dgds.h
+++ b/engines/dgds/dgds.h
@@ -183,8 +183,8 @@ private:
 
 	bool _isDemo;
 	bool _isEGA;
+	bool _isAltDlgColors;
 	bool _flipMode;
-	bool _skipNextFrame;
 	uint32 _thisFrameMs;
 	int16 _lastGlobalFade; // Only used in Willy Beamish
 	uint _lastGlobalFadedPal;
@@ -269,13 +269,14 @@ public:
 	ChinaTrain *getChinaTrain() { return _chinaTrain; }
 	ChinaTank *getChinaTank() { return _chinaTank; }
 	DragonArcade *getDragonArcade() { return _dragonArcade; }
-	void setSkipNextFrame() { _skipNextFrame = true; }
 	uint32 getThisFrameMs() const { return _thisFrameMs; }
 
 	static DgdsEngine *getInstance() { return static_cast<DgdsEngine *>(g_engine); }
 	void setFlipMode(bool mode) { _flipMode = mode; }
 
 	bool isEGA() const { return _isEGA; }
+	bool isDemo() const { return _isDemo; }
+	bool isAltDlgColors() const { return _isAltDlgColors; }
 
 	void enableKeymapper();
 	void disableKeymapper();
diff --git a/engines/dgds/dialog.cpp b/engines/dgds/dialog.cpp
index 1daaf9013f1..ef28d8efdef 100644
--- a/engines/dgds/dialog.cpp
+++ b/engines/dgds/dialog.cpp
@@ -143,13 +143,17 @@ void Dialog::drawType2BackgroundChina(Graphics::ManagedSurface *dst, const Commo
 }
 
 void Dialog::drawType2BackgroundBeamish(Graphics::ManagedSurface *dst, const Common::String &title) {
-	// TODO: This needs updating.
+	byte fillCol = 0;
+	if (DgdsEngine::getInstance()->isAltDlgColors())
+		fillCol = 20;
+
 	_state->_loc = DgdsRect(_rect.x + 11, _rect.y + 10, _rect.width - 22, _rect.height - 20);
 	if (title.empty()) {
-		dst->fillRect(Common::Rect(Common::Point(_rect.x + 2, _rect.y + 2), _rect.width - 4, _rect.height - 4), 0);
-		RequestData::drawCorners(dst, 54, _rect.x, _rect.y, _rect.width, _rect.height);
+		dst->fillRect(Common::Rect(Common::Point(_rect.x + 2, _rect.y + 2), _rect.width - 4, _rect.height - 4), fillCol);
+		uint16 cornerOffset = DgdsEngine::getInstance()->isAltDlgColors() ? 46 : 54;
+		RequestData::drawCorners(dst, cornerOffset, _rect.x, _rect.y, _rect.width, _rect.height);
 	} else {
-		dst->fillRect(Common::Rect(Common::Point(_rect.x + 2, _rect.y + 2), _rect.width - 4, _rect.height - 4), 0);
+		dst->fillRect(Common::Rect(Common::Point(_rect.x + 2, _rect.y + 2), _rect.width - 4, _rect.height - 4), fillCol);
 		RequestData::drawCorners(dst, 46, _rect.x, _rect.y, _rect.width, _rect.height);
 		_state->_loc.y += 15;
 		_state->_loc.height -= 15;
diff --git a/engines/dgds/inventory.cpp b/engines/dgds/inventory.cpp
index 555223017ae..ed21cf6d6ae 100644
--- a/engines/dgds/inventory.cpp
+++ b/engines/dgds/inventory.cpp
@@ -238,7 +238,7 @@ void Inventory::draw(Graphics::ManagedSurface &surf, int itemCount) {
 
 void Inventory::drawTime(Graphics::ManagedSurface &surf) {
 	DgdsEngine *engine = DgdsEngine::getInstance();
-	if (engine->getGameId() == GID_HOC)
+	if (engine->getGameId() == GID_HOC || !_invClock)
 		return;
 
 	const DgdsFont *font = RequestData::getMenuFont();
@@ -396,6 +396,7 @@ void Inventory::mouseLDown(const Common::Point &pt) {
 			_highlightItemNo = underMouse->_num;
 			engine->getScene()->runOps(underMouse->onLDownOps);
 			engine->getScene()->setDragItem(underMouse);
+			underMouse->_flags |= kItemStateWasInInv;
 			if (underMouse->_iconNum)
 				engine->setMouseCursor(underMouse->_iconNum);
 		}
diff --git a/engines/dgds/scene.cpp b/engines/dgds/scene.cpp
index 5f3ecf4e655..0cfad0f4f42 100644
--- a/engines/dgds/scene.cpp
+++ b/engines/dgds/scene.cpp
@@ -59,7 +59,7 @@ Common::String GameItem::dump(const Common::String &indent) const {
 	Common::String super = HotArea::dump(indent + "  ");
 
 	Common::String str = Common::String::format(
-			"%sGameItem<\n%s\n%saltCursor %d icon %d sceneNum %d flags %d quality %d",
+			"%sGameItem<\n%s\n%saltCursor %d icon %d sceneNum %d flags 0x%x quality %d",
 			indent.c_str(), super.c_str(), indent.c_str(), _altCursor,
 			_iconNum, _inSceneNum, _flags, _quality);
 	str += DebugUtil::dumpStructList(indent, "onDragFinishedOps", onDragFinishedOps);
@@ -411,6 +411,8 @@ void Scene::setDragItemOp(const Common::Array<uint16> &args) {
 
 		bool inScene = (item._inSceneNum == engine->getScene()->getNum());
 		engine->getScene()->setDragItem(&item);
+		if (item._inSceneNum == 2)
+			item._flags |= kItemStateWasInInv;
 		if (!inScene)
 			item._inSceneNum = engine->getScene()->getNum(); // else do some redraw??
 
@@ -510,7 +512,7 @@ bool SDSScene::_dlgWithFlagLo8IsClosing = false;
 DialogFlags SDSScene::_sceneDialogFlags = kDlgFlagNone;
 
 SDSScene::SDSScene() : _num(-1), _dragItem(nullptr), _shouldClearDlg(false), _ignoreMouseUp(false),
-_field6_0x14(0), _rbuttonDown(false), _lbuttonDown(false), _lookMode(0) {
+_field6_0x14(0), _rbuttonDown(false), _lbuttonDown(false), _lookMode(0), _lbuttonDownWithDrag(false) {
 }
 
 bool SDSScene::load(const Common::String &filename, ResourceManager *resourceManager, Decompressor *decompressor) {
@@ -1209,7 +1211,7 @@ void SDSScene::mouseMoved(const Common::Point &pt) {
 	GameItem *activeItem = engine->getGDSScene()->getActiveItem();
 
 	if (_dragItem) {
-		if (area && area->_objInteractionRectNum == 1) {
+		if (area && area->_objInteractionRectNum == 1 && !(_dragItem->_flags & kItemStateWasInInv)) {
 			// drag over Willy Beamish
 			engine->getInventory()->open();
 			return;
@@ -1233,8 +1235,13 @@ void SDSScene::mouseLDown(const Common::Point &pt) {
 		_shouldClearDlg = true;
 		_ignoreMouseUp = true;
 		return;
+	} else if (_dragItem) {
+		// Nothing to do if we have a drag item, will be handled on mouseup.
+		_lbuttonDownWithDrag = true;
+		return;
 	}
 
+	_lbuttonDownWithDrag = false;
 	_ignoreMouseUp = false;
 
 	// Don't start drag in look/target mode.
@@ -1255,6 +1262,8 @@ void SDSScene::mouseLDown(const Common::Point &pt) {
 	GameItem *item = dynamic_cast<GameItem *>(area);
 	if (item) {
 		_dragItem = item;
+		if (item->_inSceneNum == 2)
+			item->_flags |= kItemStateWasInInv;
 		if (item->_iconNum)
 			engine->setMouseCursor(item->_iconNum);
 	}
@@ -1284,8 +1293,16 @@ void SDSScene::mouseLUp(const Common::Point &pt) {
 		return;
 	}
 
+	//
+	// HoC and Dragon drop as soon as the mouse is released.
+	// Willy keeps dragging the item until another click.
+	//
 	if (_dragItem) {
-		onDragFinish(pt);
+		if (engine->getGameId() != GID_WILLY || _lbuttonDownWithDrag) {
+			_dragItem->_flags &= ~kItemStateWasInInv;
+			onDragFinish(pt);
+			_lbuttonDownWithDrag = false;
+		}
 		return;
 	}
 
@@ -1340,7 +1357,7 @@ void SDSScene::mouseLUp(const Common::Point &pt) {
 					return;
 			}
 		} else {
-			debug(1, " --> exec %d click ops for area %d", area->onLClickOps.size(), area->_num);
+			debug(1, " --> exec %d L click ops for area %d", area->onLClickOps.size(), area->_num);
 			int16 addmins = engine->getGameGlobals()->getGameMinsToAddOnLClick();
 			runOps(area->onLClickOps, addmins);
 		}
@@ -1369,8 +1386,7 @@ void SDSScene::onDragFinish(const Common::Point &pt) {
 
 	runOps(dragItem->onDragFinishedOps, globals->getGameMinsToAddOnDragFinished());
 
-	// TODO: Both these loops are very similar.. there should be a cleaner way.
-
+	// Check for dropping on an object
 	for (const auto &item : gdsScene->getGameItems()) {
 		if (item._inSceneNum == dropSceneNum && _isInRect(pt, item._rect)) {
 			debug(1, "Dragged item %d onto item %d @ (%d, %d)", dragItem->_num, item._num, pt.x, pt.y);
@@ -1383,6 +1399,7 @@ void SDSScene::onDragFinish(const Common::Point &pt) {
 		}
 	}
 
+	// Check for dropping on an area
 	const SDSScene *scene = engine->getScene();
 	for (const auto &area : _hotAreaList) {
 		if (!_isInRect(pt, area._rect))
@@ -2031,7 +2048,7 @@ void GDSScene::drawItems(Graphics::ManagedSurface &surf) {
 	const int maxx = SCREEN_WIDTH - (icons->width(2) + 10);
 	for (auto &item : _gameItems) {
 		if (item._inSceneNum == currentScene && &item != engine->getScene()->getDragItem()) {
-			if (!(item._flags & 1)) {
+			if (!(item._flags & kItemStateDragging)) {
 				// Dropped item.
 				// Update the rect for the icon - Note: original doesn't do this,
 				// but then the napent icon is offset??
diff --git a/engines/dgds/scene.h b/engines/dgds/scene.h
index ec84a3bbcd1..7a4cce6dc8b 100644
--- a/engines/dgds/scene.h
+++ b/engines/dgds/scene.h
@@ -71,6 +71,11 @@ public:
 };
 
 
+enum GameItemState {
+	kItemStateDragging = 1,
+	kItemStateWasInInv = 0x10000,
+};
+
 class GameItem : public HotArea {
 public:
 	Common::Array<SceneOp> onDragFinishedOps;
@@ -80,7 +85,7 @@ public:
 
 	// mutable values
 	uint16 _inSceneNum;
-	uint16 _flags;
+	uint32 _flags;
 	uint16 _quality;
 
 	Common::String dump(const Common::String &indent) const override;
@@ -371,6 +376,7 @@ private:
 	bool _ignoreMouseUp;
 	bool _lbuttonDown;
 	bool _rbuttonDown;
+	bool _lbuttonDownWithDrag;
 
 	/// Only changes in beamish - toggle between use (0), look (1) and target (2)
 	int16 _lookMode;
diff --git a/engines/dgds/scene_op.cpp b/engines/dgds/scene_op.cpp
index 7b99943c15d..176d747bcb6 100644
--- a/engines/dgds/scene_op.cpp
+++ b/engines/dgds/scene_op.cpp
@@ -227,7 +227,7 @@ bool SceneOp::runCommonOp() const {
 	case kSceneOpAddFlagToDragItem: {
 		GameItem *item = engine->getScene()->getDragItem();
 		if (item) {
-			item->_flags |= 1;
+			item->_flags |= kItemStateDragging;
 			// TODO: Use hot x/y or just position?
 			Common::Point lastMouse = engine->getLastMouseMinusHot();
 			item->_rect.x = lastMouse.x;


Commit: 45a553d7491cf82477d750665fb7f808aa5d07ee
    https://github.com/scummvm/scummvm/commit/45a553d7491cf82477d750665fb7f808aa5d07ee
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-01-23T19:50:48+11:00

Commit Message:
DGDS: Dump DDS data version and id on load

Changed paths:
    engines/dgds/scene.cpp


diff --git a/engines/dgds/scene.cpp b/engines/dgds/scene.cpp
index 0cfad0f4f42..ae437c902d1 100644
--- a/engines/dgds/scene.cpp
+++ b/engines/dgds/scene.cpp
@@ -698,6 +698,8 @@ Dialog *SDSScene::loadDialogData(uint16 num) {
 
 	uint prevSize = _dialogs.size();
 
+	Common::String fileVersion;
+	Common::String fileId;
 	while (chunk.readNextHeader(EX_DDS, filename)) {
 		if (chunk.isContainer()) {
 			continue;
@@ -710,8 +712,8 @@ Dialog *SDSScene::loadDialogData(uint16 num) {
 			uint32 magic = stream->readUint32LE();
 			if (magic != _magic)
 				error("Dialog file magic mismatch %08x vs scene %08x", magic, _magic);
-			Common::String fileVersion = stream->readString();
-			Common::String fileId = stream->readString();
+			fileVersion = stream->readString();
+			fileId = stream->readString();
 			// slight hack, set file version while loading
 			Common::String oldVer = _version;
 			_version = fileVersion;
@@ -723,7 +725,8 @@ Dialog *SDSScene::loadDialogData(uint16 num) {
 	delete dlgFile;
 
 	if (_dialogs.size() != prevSize) {
-		debug(10, "Read %d dialogs from DDS %s:", _dialogs.size() - prevSize, filename.c_str());
+		debug(10, "Read %d dialogs from DDS %s (ver %s id '%s'):", _dialogs.size() - prevSize,
+			filename.c_str(), fileVersion.c_str(), fileId.c_str());
 		for (uint i = prevSize; i < _dialogs.size(); i++)
 			debug(10, "%s", _dialogs[i].dump("").c_str());
 	}


Commit: b0e6fdaff7133a61712ea5ece6750b908fd806f2
    https://github.com/scummvm/scummvm/commit/b0e6fdaff7133a61712ea5ece6750b908fd806f2
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-01-23T19:50:48+11:00

Commit Message:
DGDS: Fix DDS unload operation

It should unload based on file num not dialog num

Changed paths:
    engines/dgds/scene.cpp


diff --git a/engines/dgds/scene.cpp b/engines/dgds/scene.cpp
index ae437c902d1..20fb784dc91 100644
--- a/engines/dgds/scene.cpp
+++ b/engines/dgds/scene.cpp
@@ -669,15 +669,15 @@ void SDSScene::checkTriggers() {
 }
 
 
-Dialog *SDSScene::loadDialogData(uint16 num) {
-	if (num == 0)
+Dialog *SDSScene::loadDialogData(uint16 fileNum) {
+	if (fileNum == 0)
 		return &_dialogs.front();
 
 	for (auto &dlg: _dialogs)
-		if (dlg._fileNum == num)
+		if (dlg._fileNum == fileNum)
 			return &dlg;
 
-	const Common::String filename = Common::String::format("D%d.DDS", num);
+	const Common::String filename = Common::String::format("D%d.DDS", fileNum);
 	DgdsEngine *engine = DgdsEngine::getInstance();
 	ResourceManager *resourceManager = engine->getResourceManager();
 	Common::SeekableReadStream *dlgFile = resourceManager->getResource(filename);
@@ -717,7 +717,7 @@ Dialog *SDSScene::loadDialogData(uint16 num) {
 			// slight hack, set file version while loading
 			Common::String oldVer = _version;
 			_version = fileVersion;
-			result = readDialogList(stream, _dialogs, num);
+			result = readDialogList(stream, _dialogs, fileNum);
 			_version = oldVer;
 		}
 	}
@@ -736,7 +736,7 @@ Dialog *SDSScene::loadDialogData(uint16 num) {
 
 	for (auto &dlg : _dialogs) {
 		if (dlg._nextDialogDlgNum && !dlg._nextDialogFileNum) {
-			dlg._nextDialogFileNum = num;
+			dlg._nextDialogFileNum = fileNum;
 		}
 	}
 
@@ -744,12 +744,12 @@ Dialog *SDSScene::loadDialogData(uint16 num) {
 	return &_dialogs.front();
 }
 
-void SDSScene::freeDialogData(uint16 num) {
-	if (!num)
+void SDSScene::freeDialogData(uint16 fileNum) {
+	if (!fileNum)
 		return;
 
 	for (int i = 0; i < (int)_dialogs.size(); i++) {
-		if (_dialogs[i]._num == num) {
+		if (_dialogs[i]._fileNum == fileNum) {
 			_dialogs.remove_at(i);
 			i--;
 		}


Commit: 68852b1a59c94f0fb88788cebcd45dfbc3eeea55
    https://github.com/scummvm/scummvm/commit/68852b1a59c94f0fb88788cebcd45dfbc3eeea55
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2025-01-23T21:21:32+11:00

Commit Message:
DGDS: Don't need return val from load dialog op

Changed paths:
    engines/dgds/scene.cpp
    engines/dgds/scene.h


diff --git a/engines/dgds/scene.cpp b/engines/dgds/scene.cpp
index 20fb784dc91..47c4be39bfa 100644
--- a/engines/dgds/scene.cpp
+++ b/engines/dgds/scene.cpp
@@ -669,13 +669,14 @@ void SDSScene::checkTriggers() {
 }
 
 
-Dialog *SDSScene::loadDialogData(uint16 fileNum) {
+void SDSScene::loadDialogData(uint16 fileNum) {
 	if (fileNum == 0)
-		return &_dialogs.front();
+		return;
 
 	for (auto &dlg: _dialogs)
 		if (dlg._fileNum == fileNum)
-			return &dlg;
+			// already loaded
+			return;
 
 	const Common::String filename = Common::String::format("D%d.DDS", fileNum);
 	DgdsEngine *engine = DgdsEngine::getInstance();
@@ -688,7 +689,7 @@ Dialog *SDSScene::loadDialogData(uint16 fileNum) {
 		// version.
 		//
 		warning("Dialog file %s not found", filename.c_str());
-		return nullptr;
+		return;
 	}
 
 	DgdsChunkReader chunk(dlgFile);
@@ -732,16 +733,13 @@ Dialog *SDSScene::loadDialogData(uint16 fileNum) {
 	}
 
 	if (!result)
-		return nullptr;
+		return;
 
 	for (auto &dlg : _dialogs) {
 		if (dlg._nextDialogDlgNum && !dlg._nextDialogFileNum) {
 			dlg._nextDialogFileNum = fileNum;
 		}
 	}
-
-	// TODO: Maybe not this?
-	return &_dialogs.front();
 }
 
 void SDSScene::freeDialogData(uint16 fileNum) {
diff --git a/engines/dgds/scene.h b/engines/dgds/scene.h
index 7a4cce6dc8b..cb148da9318 100644
--- a/engines/dgds/scene.h
+++ b/engines/dgds/scene.h
@@ -315,7 +315,7 @@ public:
 	void onDragFinish(const Common::Point &pt);
 	void enableTrigger(uint16 sceneNum, uint16 num, bool enable = true);
 
-	Dialog *loadDialogData(uint16 num);
+	void loadDialogData(uint16 num);
 	void freeDialogData(uint16 num);
 	bool loadTalkData(uint16 num);
 	bool freeTalkData(uint16 num);




More information about the Scummvm-git-logs mailing list