[Scummvm-git-logs] scummvm master -> 49e5ccf79343aeab4e79b22c23ce8b86ee8d4441

mduggan noreply at scummvm.org
Sat Dec 21 06:53:05 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:
03e8c688f4 DGDS: Don't show inventory button by default in Willy Beamish
aacfc96983 DGDS: Fix fonts for Beamish dialogs
49e5ccf793 DGDS: Fix opening and rendering of Willy Beamish inventory


Commit: 03e8c688f40f81f3bb77c2e5b79da394db470078
    https://github.com/scummvm/scummvm/commit/03e8c688f40f81f3bb77c2e5b79da394db470078
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2024-12-21T17:52:57+11:00

Commit Message:
DGDS: Don't show inventory button by default in Willy Beamish

Confirmed that it does not automatically add the button to the scene like the
other games do.

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


diff --git a/engines/dgds/clock.cpp b/engines/dgds/clock.cpp
index 38c41ee993d..449f5e82c00 100644
--- a/engines/dgds/clock.cpp
+++ b/engines/dgds/clock.cpp
@@ -124,12 +124,13 @@ Common::String Clock::getTimeStr() const {
 }
 
 void Clock::draw(Graphics::ManagedSurface &surf) {
-	if (!_visibleUser || !_visibleScript)
+	DgdsEngine *engine = DgdsEngine::getInstance();
+	if (!_visibleUser || !_visibleScript || engine->getGameId() != GID_DRAGON)
 		return;
 
 	const Common::String clockStr = getTimeStr();
 
-	const FontManager *fontman = DgdsEngine::getInstance()->getFontMan();
+	const FontManager *fontman = engine->getFontMan();
 	const DgdsFont *font = fontman->getFont(FontManager::k4x5Font);
 	int width = font->getMaxCharWidth() * 12 + 3;
 	_drawPos.top = 0;
diff --git a/engines/dgds/dgds.cpp b/engines/dgds/dgds.cpp
index ade2606fc88..e5a539de025 100644
--- a/engines/dgds/dgds.cpp
+++ b/engines/dgds/dgds.cpp
@@ -226,9 +226,9 @@ bool DgdsEngine::changeScene(int sceneNum) {
 		_scene->setSceneNum(sceneNum);
 
 	// These are done inside the load function in the original.. cleaner here..
-	if (!_isDemo)
+	if (!_isDemo && getGameId() != GID_WILLY)
 		_scene->addInvButtonToHotAreaList();
-	if (_gameId == GID_DRAGON)
+	if (getGameId() == GID_DRAGON)
 		_clock.setVisibleScript(true);
 
 	if (_scene->getMagic() != _gdsScene->getMagic())
@@ -362,9 +362,9 @@ void DgdsEngine::init(bool restarting) {
 	_menu = new Menu();
 	_adsInterp = new ADSInterpreter(this);
 	_inventory = new Inventory();
-	if (_gameId == GID_DRAGON)
+	if (getGameId() == GID_DRAGON)
 		_dragonArcade = new DragonArcade();
-	else if (_gameId == GID_HOC) {
+	else if (getGameId() == GID_HOC) {
 		_shellGame = new ShellGame();
 		_hocIntro = new HocIntro();
 		_chinaTank = new ChinaTank();
@@ -743,7 +743,7 @@ Common::Error DgdsEngine::run() {
 		}
 
 		// Willy Beamish dims the palette of the screen while dialogs are active
-		if (_gameId == GID_WILLY) {
+		if (getGameId() == GID_WILLY) {
 			WillyGlobals *globals = static_cast<WillyGlobals *>(_gameGlobals);
 			int16 fade = globals->getPalFade();
 			fade = CLIP(fade, (int16)0, (int16)255);
@@ -888,7 +888,7 @@ Common::Error DgdsEngine::syncGame(Common::Serializer &s) {
 
 	// Add inv button - we deferred this to now to make sure globals etc
 	// are in the right state.
-	if (s.isLoading())
+	if (s.isLoading() && getGameId() != GID_WILLY)
 		_scene->addInvButtonToHotAreaList();
 
 	if (s.getVersion() < 4) {
diff --git a/engines/dgds/scene.cpp b/engines/dgds/scene.cpp
index 45a7ca23425..63f5ec52b2c 100644
--- a/engines/dgds/scene.cpp
+++ b/engines/dgds/scene.cpp
@@ -981,6 +981,10 @@ void SDSScene::addAndShowTiredDialog() {
 
 
 void SDSScene::showDialog(uint16 fileNum, uint16 dlgNum) {
+	// TODO: In Willy Beamish, if the inventory button is visible here then
+	// it should be hidden and a flag set to re-enabled it once the dialog
+	// is closed.  Other games leave it visible.
+
 	if (fileNum)
 		loadDialogData(fileNum);
 
@@ -1548,7 +1552,7 @@ void SDSScene::addInvButtonToHotAreaList() {
 	area._rect.height = icons->height(invButtonIcon);
 	area._rect.x = SCREEN_WIDTH - area._rect.width;
 	area._rect.y = SCREEN_HEIGHT - area._rect.height;
-	area._cursorNum2 = 0;
+	area._cursorNum2 = engine->getGDSScene()->getInvIconMouseCursor();
 	area._objInteractionRectNum = 0;
 
 	// Add swap character button for HoC


Commit: aacfc96983697fcbabce3d976e96abac8244b6a7
    https://github.com/scummvm/scummvm/commit/aacfc96983697fcbabce3d976e96abac8244b6a7
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2024-12-21T17:52:57+11:00

Commit Message:
DGDS: Fix fonts for Beamish dialogs

Changed paths:
    engines/dgds/dialog.cpp
    engines/dgds/font.cpp


diff --git a/engines/dgds/dialog.cpp b/engines/dgds/dialog.cpp
index b88af143da3..aa471c75cd8 100644
--- a/engines/dgds/dialog.cpp
+++ b/engines/dgds/dialog.cpp
@@ -73,7 +73,7 @@ const DgdsFont *Dialog::getDlgTextFont() const {
 	else if (_fontSize == 3)
 		fontType = FontManager::k4x5Font;
 	else if (_fontSize == 4 && DgdsEngine::getInstance()->getGameId() == GID_WILLY)
-		fontType = FontManager::kGameFont;
+		fontType = FontManager::kGameDlgFont;
 	else if (_fontSize == 5 && DgdsEngine::getInstance()->getGameId() == GID_HOC)
 		fontType = FontManager::kChinaFont;
 	return fontman->getFont(fontType);
diff --git a/engines/dgds/font.cpp b/engines/dgds/font.cpp
index 2c9600fd550..ff0e19ca62e 100644
--- a/engines/dgds/font.cpp
+++ b/engines/dgds/font.cpp
@@ -220,8 +220,8 @@ FontManager::FontType FontManager::fontTypeByName(const Common::String &filename
 	if (filename == "HOC.FNT") return kGameFont;
 	if (filename == "CHINA.FNT") return kGameDlgFont;
 	if (filename == "CHINESE.FNT") return kChinaFont;
-	if (filename == "WILLY.FNT") return kVCRFont;
-	if (filename == "COMIX_16.FNT") return kGameDlgFont;
+	if (filename == "WILLY.FNT") return kGameDlgFont;
+	if (filename == "COMIX_16.FNT") return kVCRFont;
 	if (filename == "WVCR.FNT") return kGameFont;
 	if (filename == "EXIT.FNT") return kVCRFont;
 	if (filename == "SSM1_12.FNT") return kGameFont;


Commit: 49e5ccf79343aeab4e79b22c23ce8b86ee8d4441
    https://github.com/scummvm/scummvm/commit/49e5ccf79343aeab4e79b22c23ce8b86ee8d4441
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2024-12-21T17:52:57+11:00

Commit Message:
DGDS: Fix opening and rendering of Willy Beamish inventory

Changed paths:
    engines/dgds/clock.cpp
    engines/dgds/dgds.cpp
    engines/dgds/inventory.cpp
    engines/dgds/request.cpp
    engines/dgds/scene.cpp


diff --git a/engines/dgds/clock.cpp b/engines/dgds/clock.cpp
index 449f5e82c00..e6f248fd86f 100644
--- a/engines/dgds/clock.cpp
+++ b/engines/dgds/clock.cpp
@@ -114,9 +114,13 @@ Common::String Clock::getTimeStr() const {
 			month = 0;
 	}
 
-	if (DgdsEngine::getInstance()->getGameLang() == Common::EN_ANY) {
+	DgdsEngine *engine = DgdsEngine::getInstance();
+
+	if (engine->getGameId() == GID_WILLY) {
+		return Common::String::format("DAY %d, %2d:%02d", day - 1, _hours, _mins);
+	} else if (engine->getGameLang() == Common::EN_ANY) {
 		return Common::String::format("%2d/%02d %2d:%02d", month + 1, day, _hours, _mins);
-	} else if (DgdsEngine::getInstance()->getGameLang() == Common::DE_DEU) {
+	} else if (engine->getGameLang() == Common::DE_DEU) {
 		return Common::String::format("%2d.%d %2d.%02d", day, month + 1, _hours, _mins);
 	} else {
 		error("Unsupported language %d", DgdsEngine::getInstance()->getGameLang());
diff --git a/engines/dgds/dgds.cpp b/engines/dgds/dgds.cpp
index e5a539de025..435b5e01bb9 100644
--- a/engines/dgds/dgds.cpp
+++ b/engines/dgds/dgds.cpp
@@ -186,6 +186,11 @@ bool DgdsEngine::changeScene(int sceneNum) {
 	if (!haveSceneFile && sceneNum != 2) {
 		warning("Tried to switch to non-existent scene %d", sceneNum);
 		return false;
+	} else if (!haveSceneFile && getGameId() == GID_WILLY) {
+		// Willy does not have a separate scene file for inventory.
+		// Leave the currenty scene data loaded and just show the inventory.
+		_inventory->open();
+		return true;
 	}
 
 	_gameGlobals->setLastSceneNum(sceneNum);
@@ -641,12 +646,14 @@ Common::Error DgdsEngine::run() {
 
 			_compositionBuffer.blitFrom(_backgroundBuffer);
 
-			if (_inventory->isOpen() && _scene->getNum() == 2) {
+			if (_inventory->isOpen() && (_scene->getNum() == 2 || getGameId() == GID_WILLY)) {
 				int invCount = _gdsScene->countItemsInInventory();
 				_inventory->draw(_compositionBuffer, invCount);
 			}
 
-			_compositionBuffer.transBlitFrom(_storedAreaBuffer);
+			// Don't draw stored buffer over Willy Beamish inventory
+			if (!(_inventory->isOpen() && getGameId() == GID_WILLY))
+				_compositionBuffer.transBlitFrom(_storedAreaBuffer);
 
 			//
 			// The originals do something about drawing the background of dialogs here
@@ -657,7 +664,7 @@ Common::Error DgdsEngine::run() {
 			//
 			//_scene->drawActiveDialogBgs(&_compositionBuffer);
 
-			if (_scene->getNum() != 2 || _inventory->isZoomVisible())
+			if (!_inventory->isOpen() || _inventory->isZoomVisible())
 				_adsInterp->run();
 
 			if (mouseEvent != Common::EVENT_INVALID) {
diff --git a/engines/dgds/inventory.cpp b/engines/dgds/inventory.cpp
index 0ca90231c06..ecab7d84aab 100644
--- a/engines/dgds/inventory.cpp
+++ b/engines/dgds/inventory.cpp
@@ -48,6 +48,10 @@ void Inventory::open() {
 	// descriptions.
 	_isOpen = true;
 	DgdsEngine *engine = DgdsEngine::getInstance();
+
+	if (engine->getGameId() == GID_WILLY)
+		return;
+
 	int curScene = engine->getScene()->getNum();
 	if (curScene != 2) {
 		_openedFromSceneNum = curScene;
@@ -60,10 +64,14 @@ void Inventory::open() {
 void Inventory::close() {
 	if (!_isOpen)
 		return;
-	assert(_openedFromSceneNum != 0);
+
 	_isOpen = false;
 	DgdsEngine *engine = DgdsEngine::getInstance();
-	engine->changeScene(_openedFromSceneNum);
+	if (engine->getGameId() != GID_WILLY) {
+		assert(_openedFromSceneNum != 0);
+		engine->changeScene(_openedFromSceneNum);
+	}
+
 	_showZoomBox = false;
 	_openedFromSceneNum = 0;
 	_highlightItemNo = -1;
@@ -118,29 +126,39 @@ void Inventory::drawHeader(Graphics::ManagedSurface &surf) {
 		error("Unsupported language %d", DgdsEngine::getInstance()->getGameLang());
 
 	DgdsGameId gameId = DgdsEngine::getInstance()->getGameId();
-	byte txtColor = (gameId == GID_DRAGON ? 0 : 25);
+	byte txtColor = (gameId == GID_HOC ? 25 : 0);
 
 	int titleWidth = font->getStringWidth(title);
 	int y1 = r._rect.y + (gameId == GID_DRAGON ? 7 : 11);
 	// Dragon always draws the header in the same spot; HoC centers it.
 	int x1;
-	if (gameId == GID_DRAGON)
+	if (gameId == GID_DRAGON) {
+		// Constant offset
 		x1 = r._rect.x + 112;
-	else
+	} else if (gameId == GID_HOC) {
+		// Centered on window
 		x1 = r._rect.x + (r._rect.width - font->getStringWidth(title)) / 2 - 3;
+	} else { // GID_WILLY
+		// Constant offset
+		x1 = r._rect.x + 155;
+	}
+
+	// Draw the border around the text
+	byte topColor = (gameId == GID_DRAGON ? 0xdf : (gameId == GID_HOC ? 16 : 15));
+	byte botColor = (gameId == GID_DRAGON ? 0xff : (gameId == GID_HOC ? 20 : 19));
+	int x2 = x1 + titleWidth + 6;
+	int y2 = y1 + font->getFontHeight();
+	surf.drawLine(x1, y1, x2, y1, topColor);
+	surf.drawLine(x2, y1 + 1, x2, y2, topColor);
+	surf.drawLine(x1, y1 + 1, x1, y2, botColor);
+	surf.drawLine(x1 + 1, y2, x1 + titleWidth + 5, y2, botColor);
+
+	// In willy also fill the area in the middle
+	if (gameId == GID_WILLY)
+		surf.fillRect(Common::Rect(Common::Point(x1 + 1, y1 + 1), titleWidth + 5, font->getFontHeight() - 1), 17);
+
 	font->drawString(&surf, title, x1 + 4, y1 + 2, titleWidth, txtColor);
 
-	// Only draw the box around the title in DRAGON and HOC
-	if (gameId == GID_DRAGON || gameId == GID_HOC) {
-		byte topColor = (gameId == GID_DRAGON ? 0xdf : 16);
-		byte botColor = (gameId == GID_DRAGON ? 0xff : 20);
-		int x2 = x1 + titleWidth + 6;
-		int y2 = y1 + font->getFontHeight();
-		surf.drawLine(x1, y1, x2, y1, topColor);
-		surf.drawLine(x2, y1 + 1, x2, y2, topColor);
-		surf.drawLine(x1, y1 + 1, x1, y2, botColor);
-		surf.drawLine(x1 + 1, y2, x1 + titleWidth + 5, y2, botColor);
-	}
 }
 
 void Inventory::draw(Graphics::ManagedSurface &surf, int itemCount) {
@@ -149,10 +167,12 @@ void Inventory::draw(Graphics::ManagedSurface &surf, int itemCount) {
 	DgdsGameId gameId = engine->getGameId();
 
 	if (_showZoomBox) {
-		_itemZoomBox->setVisible(true);
+		if (gameId != GID_WILLY)
+			_itemZoomBox->setVisible(true);
 		boxreq._rect.width = _fullWidth;
 	} else {
-		_itemZoomBox->setVisible(false);
+		if (gameId != GID_WILLY)
+			_itemZoomBox->setVisible(false);
 		boxreq._rect.width = _itemBox->_width + _itemBox->_x * 2;
 	}
 
@@ -212,15 +232,22 @@ void Inventory::draw(Graphics::ManagedSurface &surf, int itemCount) {
 
 void Inventory::drawTime(Graphics::ManagedSurface &surf) {
 	DgdsEngine *engine = DgdsEngine::getInstance();
-	if (engine->getGameId() != GID_DRAGON)
+	if (engine->getGameId() == GID_HOC)
 		return;
 
 	const DgdsFont *font = RequestData::getMenuFont();
 	const Common::String timeStr = engine->getClock().getTimeStr();
-	Common::Point clockpos = Common::Point(_invClock->_x + _invClock->_parentX, _invClock->_y + _invClock->_parentY);
-	surf.fillRect(Common::Rect(clockpos, _invClock->_width, _invClock->_height), 0);
-	RequestData::drawCorners(&surf, 19, clockpos.x - 2, clockpos.y - 2,
-								_invClock->_width + 4, _invClock->_height + 4);
+	const Common::Point clockpos = _invClock->topLeft();
+	if (engine->getGameId() == GID_DRAGON) {
+		surf.fillRect(Common::Rect(clockpos, _invClock->_width, _invClock->_height), 0);
+		RequestData::drawCorners(&surf, 19, clockpos.x - 2, clockpos.y - 2,
+					_invClock->_width + 4, _invClock->_height + 4);
+	} else { // GID_WILLY
+		surf.fillRect(Common::Rect(Common::Point(clockpos.x, clockpos.y - 1),
+					_invClock->_width, _invClock->_height + 2), 0);
+		RequestData::drawCorners(&surf, 25, clockpos.x - 2, clockpos.y - 5,
+					_invClock->_width + 8, _invClock->_height + 7);
+	}
 	font->drawString(&surf, timeStr, clockpos.x + 4, clockpos.y, font->getStringWidth(timeStr), _invClock->_col3);
 }
 
diff --git a/engines/dgds/request.cpp b/engines/dgds/request.cpp
index c74368efc8b..9ac8c6ed545 100644
--- a/engines/dgds/request.cpp
+++ b/engines/dgds/request.cpp
@@ -822,18 +822,27 @@ void ImageGadget::draw(Graphics::ManagedSurface *dst) const {
 	if (!xstep || !ystep)
 		return;
 
+	const DgdsGameId gameId = DgdsEngine::getInstance()->getGameId();
+
 	int xoff = _x + _parentX;
 	int yoff = _y + _parentY;
-	Common::Rect drawRect(Common::Point(xoff, yoff), _width, _height);
+	int fillHeight = _height;
+	if (gameId == GID_WILLY)
+		fillHeight++;
+
+	Common::Rect drawRect(Common::Point(xoff, yoff), _width, fillHeight);
 	dst->fillRect(drawRect, _col1);
 	// Note: not quite the same as the original logic here, but gets the same result.
 	_drawFrame(dst, xoff, yoff, _width, _height, _sval1I, _sval1I);
 
-	// NOTE: This only done in inventory in originals
-	if (DgdsEngine::getInstance()->getGameId() == GID_DRAGON)
+	// NOTE: This only done in inventory in originals, but no other
+	// Request uses the ImageGadget.
+	if (gameId == GID_DRAGON)
 		RequestData::drawCorners(dst, 19, xoff - 2, yoff - 2, _width + 4, _height + 4);
-	else
+	else if (gameId == GID_HOC)
 		RequestData::drawCorners(dst, 19, xoff - 4, yoff - 4, _width + 8, _height + 8);
+	else if (gameId == GID_WILLY)
+		RequestData::drawCorners(dst, 25, xoff - 4, yoff - 4, _width + 8, _height + 8);
 }
 
 Common::String RequestData::dump() const {
diff --git a/engines/dgds/scene.cpp b/engines/dgds/scene.cpp
index 63f5ec52b2c..6f7122e1fd3 100644
--- a/engines/dgds/scene.cpp
+++ b/engines/dgds/scene.cpp
@@ -1301,7 +1301,7 @@ void SDSScene::mouseLUp(const Common::Point &pt) {
 
 	GDSScene *gds = engine->getGDSScene();
 
-	if (area->_num == 0) {
+	if (area->_num == 0 || area->_objInteractionRectNum == 1) {
 		debug(1, "Mouseup on inventory.");
 		engine->getInventory()->open();
 	} else if (area->_num == 0xffff) {




More information about the Scummvm-git-logs mailing list