[Scummvm-git-logs] scummvm master -> fdfbdb8433498dc511b1700b512c054b06e1f68d
mduggan
noreply at scummvm.org
Sat Jul 13 11:05:41 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
fdfbdb8433 DGDS: Add more char swap features for HoC
Commit: fdfbdb8433498dc511b1700b512c054b06e1f68d
https://github.com/scummvm/scummvm/commit/fdfbdb8433498dc511b1700b512c054b06e1f68d
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2024-07-13T21:03:34+10:00
Commit Message:
DGDS: Add more char swap features for HoC
Changed paths:
engines/dgds/dgds.cpp
engines/dgds/dgds.h
engines/dgds/globals.cpp
engines/dgds/scene.cpp
diff --git a/engines/dgds/dgds.cpp b/engines/dgds/dgds.cpp
index 6fa1eec14a7..c12b2bc6a7d 100644
--- a/engines/dgds/dgds.cpp
+++ b/engines/dgds/dgds.cpp
@@ -246,11 +246,14 @@ void DgdsEngine::setShowClock(bool val) {
_clock.setVisibleScript(val);
}
+bool DgdsEngine::isInvButtonVisible() const {
+ return (_gdsScene->getCursorList().size() >= 2 && _icons->loadedFrameCount() >= 2 &&
+ !_scene->getHotAreas().empty() && _scene->getHotAreas().front()._num == 0);
+}
+
void DgdsEngine::checkDrawInventoryButton() {
- if (_gdsScene->getCursorList().size() < 2 || _icons->loadedFrameCount() < 2 ||
- _scene->getHotAreas().size() < 1 || _scene->getHotAreas().front()._num != 0)
+ if (!isInvButtonVisible())
return;
-
static const Common::Rect drawWin(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
int16 invButtonIcon = 2;
diff --git a/engines/dgds/dgds.h b/engines/dgds/dgds.h
index 3c3b682b91a..464d020e80b 100644
--- a/engines/dgds/dgds.h
+++ b/engines/dgds/dgds.h
@@ -206,6 +206,7 @@ public:
void setBackgroundFile(const Common::String &name) { _backgroundFile = name; }
const Common::String &getBackgroundFile() const { return _backgroundFile; }
void setMenuToTrigger(MenuId menu) { _menuToTrigger = menu; }
+ bool isInvButtonVisible() const;
private:
Common::Error syncGame(Common::Serializer &s);
diff --git a/engines/dgds/globals.cpp b/engines/dgds/globals.cpp
index 65417380f53..69f5be95fea 100644
--- a/engines/dgds/globals.cpp
+++ b/engines/dgds/globals.cpp
@@ -204,6 +204,22 @@ Common::Error DragonGlobals::syncState(Common::Serializer &s) {
return Common::kNoError;
}
+class HocCharacterGlobal : public RWI16Global {
+public:
+ HocCharacterGlobal(uint16 num, int16 *val) : RWI16Global(num, val) {}
+ int16 set(int16 val) override {
+ DgdsEngine *engine = static_cast<DgdsEngine *>(g_engine);
+ bool buttonVisible = engine->isInvButtonVisible();
+ if (buttonVisible)
+ engine->getScene()->removeInvButtonFromHotAreaList();
+ RWI16Global::set(val);
+ if (buttonVisible)
+ engine->getScene()->addInvButtonToHotAreaList();
+ return get();
+ }
+};
+
+
HocGlobals::HocGlobals(Clock &clock) : Globals(clock), _unk82(1), _unk55(0),
_unkDlgFileNum(0), _unkDlgDlgNum(0), _currentCharacter2(0), _currentCharacter(0),
_unk50(0), _unk49(0), _unk48(0), _unk47(0), _unk46(0), _unk45(0x3f), _unk44(0),
@@ -213,8 +229,8 @@ HocGlobals::HocGlobals(Clock &clock) : Globals(clock), _unk82(1), _unk55(0),
_globals.push_back(new RWI16Global(0x37, &_unk55)); // TODO: Special update function FUN_1407_080d, sound init related
_globals.push_back(new RWI16Global(0x36, &_unkDlgFileNum));
_globals.push_back(new RWI16Global(0x35, &_unkDlgDlgNum));
- _globals.push_back(new RWI16Global(0x34, &_currentCharacter)); // TODO: Special update function FUN_174e_8f31
- _globals.push_back(new RWI16Global(0x33, &_currentCharacter2)); // TODO: Special update function FUN_174e_8ee0
+ _globals.push_back(new HocCharacterGlobal(0x34, &_currentCharacter));
+ _globals.push_back(new HocCharacterGlobal(0x33, &_currentCharacter2));
_globals.push_back(new RWI16Global(0x32, &_unk50));
_globals.push_back(new RWI16Global(0x31, &_unk49));
_globals.push_back(new RWI16Global(0x30, &_unk48));
diff --git a/engines/dgds/scene.cpp b/engines/dgds/scene.cpp
index e73aecd9337..3ac81f33cb9 100644
--- a/engines/dgds/scene.cpp
+++ b/engines/dgds/scene.cpp
@@ -1711,6 +1711,13 @@ void SDSScene::mouseRUp(const Common::Point &pt) {
engine->getInventory()->setShowZoomBox(true);
engine->getInventory()->open();
return;
+ } else if (area->_num == 0xffff) {
+ debug("Right mouseup on character swap.");
+ int16 swapDlgFile = engine->getGDSScene()->getGlobal(0x36);
+ int16 swapDlgNum = engine->getGDSScene()->getGlobal(0x35);
+ if (swapDlgFile && swapDlgNum)
+ showDialog(swapDlgFile, swapDlgNum);
+ return;
}
int16 addmins = engine->getGameGlobals()->getGameMinsToAddOnLClick();
More information about the Scummvm-git-logs
mailing list