[Scummvm-git-logs] scummvm master -> d308c4cbae27338fa7bb973b840a95d081b32e90

bluegr noreply at scummvm.org
Sun Jul 7 00:28:01 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:
3e6f6b7fae DGDS: Rename game IDs to match the internal game names
679e34ca70 DGDS: Remove unnecessary casts for game globals
d308c4cbae DGDS: Split game-specific globals


Commit: 3e6f6b7fae435bb38c660496cef916dbf97ede34
    https://github.com/scummvm/scummvm/commit/3e6f6b7fae435bb38c660496cef916dbf97ede34
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2024-07-07T03:27:38+03:00

Commit Message:
DGDS: Rename game IDs to match the internal game names

Changed paths:
    engines/dgds/dgds.cpp
    engines/dgds/dgds.h
    engines/dgds/font.cpp
    engines/dgds/globals.cpp
    engines/dgds/inventory.cpp
    engines/dgds/menu.cpp
    engines/dgds/scene.cpp


diff --git a/engines/dgds/dgds.cpp b/engines/dgds/dgds.cpp
index 35a51bca7ea..85e41958d4a 100644
--- a/engines/dgds/dgds.cpp
+++ b/engines/dgds/dgds.cpp
@@ -87,9 +87,9 @@ DgdsEngine::DgdsEngine(OSystem *syst, const ADGameDescription *gameDesc)
 	if (!strcmp(gameDesc->gameId, "rise"))
 		_gameId = GID_DRAGON;
 	else if (!strcmp(gameDesc->gameId, "china"))
-		_gameId = GID_CHINA;
+		_gameId = GID_HOC;
 	else if (!strcmp(gameDesc->gameId, "beamish"))
-		_gameId = GID_BEAMISH;
+		_gameId = GID_WILLY;
 	else if (!strcmp(gameDesc->gameId, "sq5demo"))
 		_gameId = GID_SQ5DEMO;
 	else if (!strcmp(gameDesc->gameId, "comingattractions"))
@@ -318,7 +318,7 @@ void DgdsEngine::loadGameFiles() {
 		reqParser.parse(&invRequestData, "DINV.REQ");
 		reqParser.parse(&vcrRequestData, "DVCR.REQ");
 		break;
-	case GID_CHINA:
+	case GID_HOC:
 		// TODO: Create a better type for this..
 		_gameGlobals = new Globals(_clock);
 		_gamePals->loadPalette("HOC.PAL");
@@ -331,7 +331,7 @@ void DgdsEngine::loadGameFiles() {
 		reqParser.parse(&invRequestData, "HINV.REQ");
 		reqParser.parse(&vcrRequestData, "HVCR.REQ");
 		break;
-	case GID_BEAMISH:
+	case GID_WILLY:
 		// TODO: Create a better type for this..
 		_gameGlobals = new Globals(_clock);
 		if (_resource->hasResource("WILLY.GDS")) {
diff --git a/engines/dgds/dgds.h b/engines/dgds/dgds.h
index 0a321a0a2f6..3c3b682b91a 100644
--- a/engines/dgds/dgds.h
+++ b/engines/dgds/dgds.h
@@ -63,8 +63,8 @@ const float MS_PER_FRAME = 16.6667f;
 
 enum DgdsGameId {
 	GID_DRAGON,
-	GID_CHINA,
-	GID_BEAMISH,
+	GID_HOC,
+	GID_WILLY,
 	GID_SQ5DEMO,
 	GID_COMINGATTRACTIONS,
 };
diff --git a/engines/dgds/font.cpp b/engines/dgds/font.cpp
index e39088a20e4..7beb57644ac 100644
--- a/engines/dgds/font.cpp
+++ b/engines/dgds/font.cpp
@@ -253,11 +253,11 @@ void FontManager::loadFonts(DgdsGameId gameId, ResourceManager *resMgr, Decompre
 			tryLoadFont("DRAGON.FNT", resMgr, decomp);
 			tryLoadFont("7X8.FNT", resMgr, decomp);
 			tryLoadFont("P6X6.FNT", resMgr, decomp);
-		} else if (gameId == GID_CHINA) {
+		} else if (gameId == GID_HOC) {
 			tryLoadFont("HOC.FNT", resMgr, decomp);
 			tryLoadFont("CHINA.FNT", resMgr, decomp);
 			tryLoadFont("CHINESE.FNT", resMgr, decomp);
-		} else if (gameId == GID_BEAMISH) {
+		} else if (gameId == GID_WILLY) {
 			tryLoadFont("WILLY.FNT", resMgr, decomp);
 			tryLoadFont("WVCR.FNT", resMgr, decomp);
 			tryLoadFont("COMIX_16.FNT", resMgr, decomp);
diff --git a/engines/dgds/globals.cpp b/engines/dgds/globals.cpp
index 2da9f56b326..2cafc9ed931 100644
--- a/engines/dgds/globals.cpp
+++ b/engines/dgds/globals.cpp
@@ -83,7 +83,7 @@ _sceneOpcode15ToScene(0), _unk2(0), _unk5(0), _unk39(0), _unk40(0), _unk45(0), _
 	_globals.push_back(new RWI16Global(0x55, &_sceneOpcode15FromScene));
 	_globals.push_back(new RWI16Global(0x54, &_sceneOpcode15ToScene));
 
-	if (gameId == GID_CHINA) {
+	if (gameId == GID_HOC) {
 		_globals.push_back(new RWI16Global(0x36, &_unk54));
 		_globals.push_back(new RWI16Global(0x34, &_unk52));
 		_globals.push_back(new RWI16Global(0x33, &_unk51));
@@ -92,7 +92,7 @@ _sceneOpcode15ToScene(0), _unk2(0), _unk5(0), _unk39(0), _unk40(0), _unk45(0), _
 		_globals.push_back(new RWI16Global(0x27, &_unk39));
 	}
 
-	if (gameId == GID_BEAMISH) {
+	if (gameId == GID_WILLY) {
 		_globals.push_back(new RWI16Global(0x51, &_unk81));
 		_globals.push_back(new RWI16Global(0x05, &_unk5));
 		_globals.push_back(new RWI16Global(0x02, &_unk2));
diff --git a/engines/dgds/inventory.cpp b/engines/dgds/inventory.cpp
index cdc47bd60a6..c82df45d4a4 100644
--- a/engines/dgds/inventory.cpp
+++ b/engines/dgds/inventory.cpp
@@ -86,7 +86,7 @@ void Inventory::setRequestData(const REQFileData &data) {
 	_fullWidth = req._rect.width;
 
 	// TODO! Beamish doesn't have a zoom box, or it's a different ID?
-	if (static_cast<DgdsEngine *>(g_engine)->getGameId() == GID_BEAMISH)
+	if (static_cast<DgdsEngine *>(g_engine)->getGameId() == GID_WILLY)
 		_itemZoomBox = _itemBox;
 
 	if (!_prevPageBtn || !_nextPageBtn || !_itemZoomBox || !_exitButton || !_itemArea)
diff --git a/engines/dgds/menu.cpp b/engines/dgds/menu.cpp
index 730ff6aa4f9..00d7cc20f25 100644
--- a/engines/dgds/menu.cpp
+++ b/engines/dgds/menu.cpp
@@ -413,7 +413,6 @@ void Menu::handleClick(const Common::Point &mouse) {
 }
 
 void Menu::handleClickOptionsMenu(const Common::Point &mouse) {
-	DgdsEngine *engine = static_cast<DgdsEngine *>(g_engine);
 	Gadget *gadget = getClickedMenuItem(mouse);
 	int16 clickedMenuItem = gadget->_gadgetNo;
 
@@ -447,9 +446,9 @@ void Menu::handleClickSkipPlayIntroMenu(const Common::Point &mouse) {
 		break;
 	case kMenuIntroJumpToIntroduction:
 		hideMenu();
-		if (engine->getGameId() == GID_CHINA)
+		if (engine->getGameId() == GID_HOC)
 			engine->changeScene(98);
-		else if (engine->getGameId() == GID_BEAMISH)
+		else if (engine->getGameId() == GID_WILLY)
 			engine->changeScene(24);
 		break;
 	case kMenuIntroJumpToGame:
diff --git a/engines/dgds/scene.cpp b/engines/dgds/scene.cpp
index 47df31e89ec..ec7f3bb3383 100644
--- a/engines/dgds/scene.cpp
+++ b/engines/dgds/scene.cpp
@@ -745,10 +745,10 @@ bool Scene::runOps(const Common::Array<SceneOp> &ops, int16 addMinuites /* = 0 *
 			case GID_DRAGON:
 				keepGoing = runDragonOp(op);
 				break;
-			case GID_CHINA:
+			case GID_HOC:
 				keepGoing = runChinaOp(op);
 				break;
-			case GID_BEAMISH:
+			case GID_WILLY:
 				keepGoing = runBeamishOp(op);
 				break;
 			default:


Commit: 679e34ca709445cda3003e3a313be9a55c2868ec
    https://github.com/scummvm/scummvm/commit/679e34ca709445cda3003e3a313be9a55c2868ec
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2024-07-07T03:27:39+03:00

Commit Message:
DGDS: Remove unnecessary casts for game globals

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


diff --git a/engines/dgds/dgds.cpp b/engines/dgds/dgds.cpp
index 85e41958d4a..fba18a2033a 100644
--- a/engines/dgds/dgds.cpp
+++ b/engines/dgds/dgds.cpp
@@ -158,9 +158,7 @@ bool DgdsEngine::changeScene(int sceneNum) {
 		return false;
 	}
 
-	// TODO: For non-dragon games this will need tweaking.
-	DragonGlobals *globals = static_cast<DragonGlobals *>(_gameGlobals);
-	globals->setLastSceneNum(sceneNum);
+	_gameGlobals->setLastSceneNum(sceneNum);
 
 	// Save the current foreground if we are going to the inventory, clear it otherwise.
 	if (sceneNum == 2)
@@ -325,7 +323,7 @@ void DgdsEngine::loadGameFiles() {
 		_gdsScene->load("HOC.GDS", _resource, _decompressor);
 		_rstFileName = "HOC.RST";
 
-		//debug("%s", _gdsScene->dump("").c_str());
+		debug("%s", _gdsScene->dump("").c_str());
 
 		loadCorners("HCORNERS.BMP");
 		reqParser.parse(&invRequestData, "HINV.REQ");
diff --git a/engines/dgds/scene.cpp b/engines/dgds/scene.cpp
index ec7f3bb3383..2a655e52a33 100644
--- a/engines/dgds/scene.cpp
+++ b/engines/dgds/scene.cpp
@@ -1283,7 +1283,7 @@ void SDSScene::mouseLDown(const Common::Point &pt) {
 			area->_rect.width, area->_rect.height, area->_cursorNum);
 
 	DgdsEngine *engine = static_cast<DgdsEngine *>(g_engine);
-	int16 addmins = static_cast<DragonGlobals *>(engine->getGameGlobals())->getGameMinsToAddOnStartDrag();
+	int16 addmins = engine->getGameGlobals()->getGameMinsToAddOnStartDrag();
 	runOps(area->onLDownOps, addmins);
 	GameItem *item = dynamic_cast<GameItem *>(area);
 	if (item) {
@@ -1320,7 +1320,7 @@ void SDSScene::mouseLUp(const Common::Point &pt) {
 		engine->getInventory()->open();
 	} else {
 		debug(" --> exec %d click ops for area %d", area->onLClickOps.size(), area->_num);
-		int16 addmins = static_cast<DragonGlobals *>(engine->getGameGlobals())->getGameMinsToAddOnLClick();
+		int16 addmins = engine->getGameGlobals()->getGameMinsToAddOnLClick();
 		runOps(area->onLClickOps, addmins);
 	}
 }
@@ -1340,7 +1340,7 @@ void SDSScene::onDragFinish(const Common::Point &pt) {
 	GameItem *dragItem = _dragItem;
 
 	DgdsEngine *engine = static_cast<DgdsEngine *>(g_engine);
-	const DragonGlobals *globals = static_cast<DragonGlobals *>(engine->getGameGlobals());
+	const Globals *globals = engine->getGameGlobals();
 
 	runOps(dragItem->onDragFinishedOps, globals->getGameMinsToAddOnDragFinished());
 
@@ -1407,7 +1407,7 @@ void SDSScene::mouseRUp(const Common::Point &pt) {
 		return;
 	}
 
-	int16 addmins = static_cast<DragonGlobals *>(engine->getGameGlobals())->getGameMinsToAddOnLClick();
+	int16 addmins = engine->getGameGlobals()->getGameMinsToAddOnLClick();
 	runOps(area->onRClickOps, addmins);
 }
 


Commit: d308c4cbae27338fa7bb973b840a95d081b32e90
    https://github.com/scummvm/scummvm/commit/d308c4cbae27338fa7bb973b840a95d081b32e90
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2024-07-07T03:27:39+03:00

Commit Message:
DGDS: Split game-specific globals

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


diff --git a/engines/dgds/dgds.cpp b/engines/dgds/dgds.cpp
index fba18a2033a..7b994fc2149 100644
--- a/engines/dgds/dgds.cpp
+++ b/engines/dgds/dgds.cpp
@@ -317,8 +317,7 @@ void DgdsEngine::loadGameFiles() {
 		reqParser.parse(&vcrRequestData, "DVCR.REQ");
 		break;
 	case GID_HOC:
-		// TODO: Create a better type for this..
-		_gameGlobals = new Globals(_clock);
+		_gameGlobals = new HocGlobals(_clock);
 		_gamePals->loadPalette("HOC.PAL");
 		_gdsScene->load("HOC.GDS", _resource, _decompressor);
 		_rstFileName = "HOC.RST";
@@ -330,8 +329,7 @@ void DgdsEngine::loadGameFiles() {
 		reqParser.parse(&vcrRequestData, "HVCR.REQ");
 		break;
 	case GID_WILLY:
-		// TODO: Create a better type for this..
-		_gameGlobals = new Globals(_clock);
+		_gameGlobals = new WillyGlobals(_clock);
 		if (_resource->hasResource("WILLY.GDS")) {
 			_gdsScene->load("WILLY.GDS", _resource, _decompressor);
 			_rstFileName = "WILLY.RST";
diff --git a/engines/dgds/globals.cpp b/engines/dgds/globals.cpp
index 2cafc9ed931..53053598565 100644
--- a/engines/dgds/globals.cpp
+++ b/engines/dgds/globals.cpp
@@ -60,9 +60,8 @@ Globals::Globals(Clock &clock) :
 _lastOpcode1SceneChageNum(0), _sceneOp12SceneNum(0), _currentSelectedItem(0),
 _gameMinsToAddOnLClick(0), _gameMinsToAddOnStartDrag(0), _gameMinsToAddOnRClick(0), _gameMinsToAddOnDragFinished(0),
 _gameMinsToAddOnObjInteraction(0), _gameIsInteractiveGlobal(0), _sceneOpcode15FromScene(0),
-_sceneOpcode15ToScene(0), _unk2(0), _unk5(0), _unk39(0), _unk40(0), _unk45(0), _unk51(0), _unk52(0), _unk54(0), _unk81(0) {
+_sceneOpcode15ToScene(0) {
 	DgdsEngine *engine = static_cast<DgdsEngine *>(g_engine);
-	DgdsGameId gameId = engine->getGameId();
 
 	_globals.push_back(clock.getGameMinsAddedGlobal(1));
 	_globals.push_back(clock.getGameTicksUpGlobal(0x64));
@@ -82,21 +81,6 @@ _sceneOpcode15ToScene(0), _unk2(0), _unk5(0), _unk39(0), _unk40(0), _unk45(0), _
 	_globals.push_back(clock.getDays2Global(0x56));
 	_globals.push_back(new RWI16Global(0x55, &_sceneOpcode15FromScene));
 	_globals.push_back(new RWI16Global(0x54, &_sceneOpcode15ToScene));
-
-	if (gameId == GID_HOC) {
-		_globals.push_back(new RWI16Global(0x36, &_unk54));
-		_globals.push_back(new RWI16Global(0x34, &_unk52));
-		_globals.push_back(new RWI16Global(0x33, &_unk51));
-		_globals.push_back(new RWI16Global(0x2D, &_unk45));
-		_globals.push_back(new RWI16Global(0x28, &_unk40));
-		_globals.push_back(new RWI16Global(0x27, &_unk39));
-	}
-
-	if (gameId == GID_WILLY) {
-		_globals.push_back(new RWI16Global(0x51, &_unk81));
-		_globals.push_back(new RWI16Global(0x05, &_unk5));
-		_globals.push_back(new RWI16Global(0x02, &_unk2));
-	}
 }
 
 Globals::~Globals() {
@@ -225,4 +209,42 @@ Common::Error DragonGlobals::syncState(Common::Serializer &s) {
 	return Common::kNoError;
 }
 
+HocGlobals::HocGlobals(Clock &clock) : Globals(clock),
+	_unk39(0), _unk40(0), _unk45(0), _unk51(0), _unk52(0), _unk54(0) {
+	_globals.push_back(new RWI16Global(0x36, &_unk54));
+	_globals.push_back(new RWI16Global(0x34, &_unk52));
+	_globals.push_back(new RWI16Global(0x33, &_unk51));
+	_globals.push_back(new RWI16Global(0x2D, &_unk45));
+	_globals.push_back(new RWI16Global(0x28, &_unk40));
+	_globals.push_back(new RWI16Global(0x27, &_unk39));
+}
+
+Common::Error HocGlobals::syncState(Common::Serializer &s) {
+	Globals::syncState(s);
+	s.syncAsSint16LE(_unk39);
+	s.syncAsSint16LE(_unk40);
+	s.syncAsSint16LE(_unk45);
+	s.syncAsSint16LE(_unk51);
+	s.syncAsSint16LE(_unk52);
+	s.syncAsSint16LE(_unk54);
+
+	return Common::kNoError;
+}
+
+WillyGlobals::WillyGlobals(Clock &clock) : Globals(clock),
+	_unk2(0), _unk5(0), _unk81(0) {
+	_globals.push_back(new RWI16Global(0x51, &_unk81));
+	_globals.push_back(new RWI16Global(0x05, &_unk5));
+	_globals.push_back(new RWI16Global(0x02, &_unk2));
+}
+
+Common::Error WillyGlobals::syncState(Common::Serializer &s) {
+	Globals::syncState(s);
+	s.syncAsSint16LE(_unk2);
+	s.syncAsSint16LE(_unk5);
+	s.syncAsSint16LE(_unk81);
+
+	return Common::kNoError;
+}
+
 } // end namespace Dgds
diff --git a/engines/dgds/globals.h b/engines/dgds/globals.h
index 883d5db6ddd..341fa00e9ab 100644
--- a/engines/dgds/globals.h
+++ b/engines/dgds/globals.h
@@ -110,17 +110,6 @@ protected:
 	int16 _gameIsInteractiveGlobal; // used to decide if the game can start a "meanwhile" sequence
 	int16 _sceneOpcode15FromScene;
 	int16 _sceneOpcode15ToScene;
-	// HoC
-	int16 _unk39;
-	int16 _unk40;
-	int16 _unk45;
-	int16 _unk51;
-	int16 _unk52;
-	int16 _unk54;
-	// Beamish
-	int16 _unk2;
-	int16 _unk5;
-	int16 _unk81;
 
 	Common::Array<Global *> _globals;
 };
@@ -155,6 +144,35 @@ private:
 	Common::Error syncState(Common::Serializer &s) override;
 };
 
+class HocGlobals : public Globals {
+public:
+	HocGlobals(Clock &clock);
+
+private:
+	// HoC-specific globals
+	int16 _unk39;
+	int16 _unk40;
+	int16 _unk45;
+	int16 _unk51;
+	int16 _unk52;
+	int16 _unk54;
+
+	Common::Error syncState(Common::Serializer &s) override;
+};
+
+class WillyGlobals : public Globals {
+public:
+	WillyGlobals(Clock &clock);
+
+private:
+	// Willy-specific globals
+	int16 _unk2;
+	int16 _unk5;
+	int16 _unk81;
+
+	Common::Error syncState(Common::Serializer &s) override;
+};
+
 } // end namespace Dgds
 
 #endif // DGDS_GLOBALS_H




More information about the Scummvm-git-logs mailing list