[Scummvm-git-logs] scummvm master -> 6780a9227a693dbbfb056502bdde9d3506e85490
mduggan
noreply at scummvm.org
Thu Dec 5 09:03:55 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:
6780a9227a DGDS: Fix rendering issues in HoC inventory
Commit: 6780a9227a693dbbfb056502bdde9d3506e85490
https://github.com/scummvm/scummvm/commit/6780a9227a693dbbfb056502bdde9d3506e85490
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2024-12-05T19:59:09+11:00
Commit Message:
DGDS: Fix rendering issues in HoC inventory
* Fix header location, color, border
* Properly filter items when counting if we need to show arrows
The arrow buttons were being shown when the total held items filled the
inventory, not when the current character's items filled it.
Changed paths:
engines/dgds/dgds.cpp
engines/dgds/inventory.cpp
engines/dgds/scene.cpp
engines/dgds/scene.h
diff --git a/engines/dgds/dgds.cpp b/engines/dgds/dgds.cpp
index bf2b7f92dc4..af8dc46f44f 100644
--- a/engines/dgds/dgds.cpp
+++ b/engines/dgds/dgds.cpp
@@ -636,7 +636,7 @@ Common::Error DgdsEngine::run() {
_compositionBuffer.blitFrom(_backgroundBuffer);
if (_inventory->isOpen() && _scene->getNum() == 2) {
- int invCount = _gdsScene->countItemsInScene2();
+ int invCount = _gdsScene->countItemsInInventory();
_inventory->draw(_compositionBuffer, invCount);
}
diff --git a/engines/dgds/inventory.cpp b/engines/dgds/inventory.cpp
index ffc66e8b0a1..0ca90231c06 100644
--- a/engines/dgds/inventory.cpp
+++ b/engines/dgds/inventory.cpp
@@ -117,20 +117,29 @@ void Inventory::drawHeader(Graphics::ManagedSurface &surf) {
else
error("Unsupported language %d", DgdsEngine::getInstance()->getGameLang());
+ DgdsGameId gameId = DgdsEngine::getInstance()->getGameId();
+ byte txtColor = (gameId == GID_DRAGON ? 0 : 25);
+
int titleWidth = font->getStringWidth(title);
- int y1 = r._rect.y + 7;
- int x1 = r._rect.x + 112;
- font->drawString(&surf, title, x1 + 4, y1 + 2, titleWidth, 0);
+ 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)
+ x1 = r._rect.x + 112;
+ else
+ x1 = r._rect.x + (r._rect.width - font->getStringWidth(title)) / 2 - 3;
+ font->drawString(&surf, title, x1 + 4, y1 + 2, titleWidth, txtColor);
- // Only draw the box around the title in DRAGON
- DgdsEngine *engine = DgdsEngine::getInstance();
- if (engine->getGameId() == GID_DRAGON) {
+ // 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, 0xdf);
- surf.drawLine(x2, y1 + 1, x2, y2, 0xdf);
- surf.drawLine(x1, y1 + 1, x1, y2, 0xff);
- surf.drawLine(x1 + 1, y2, x1 + titleWidth + 5, y2, 0xff);
+ 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);
}
}
diff --git a/engines/dgds/scene.cpp b/engines/dgds/scene.cpp
index 0671b64876b..0150fed0df7 100644
--- a/engines/dgds/scene.cpp
+++ b/engines/dgds/scene.cpp
@@ -2465,7 +2465,7 @@ void GDSScene::globalOps(const Common::Array<uint16> &args) {
}
}
-int16 GDSScene::getGlobal(uint16 num) {
+int16 GDSScene::getGlobal(uint16 num) const {
DgdsEngine *engine = DgdsEngine::getInstance();
int curSceneNum = engine->getScene()->getNum();
DgdsGameId gameId = engine->getGameId();
@@ -2541,11 +2541,19 @@ void GDSScene::drawItems(Graphics::ManagedSurface &surf) {
}
}
-int GDSScene::countItemsInScene2() const {
+int GDSScene::countItemsInInventory() const {
int result = 0;
+ bool isHoc = DgdsEngine::getInstance()->getGameId() == GID_HOC;
for (const auto &item : _gameItems) {
- if (item._inSceneNum == 2)
- result++;
+ if (item._inSceneNum == 2) {
+ if (isHoc) {
+ int16 currentCharacter = getGlobal(0x33);
+ if (item._quality == Inventory::HOC_CHARACTER_QUALS[currentCharacter])
+ result++;
+ } else {
+ result++;
+ }
+ }
}
return result;
}
diff --git a/engines/dgds/scene.h b/engines/dgds/scene.h
index 12ff2aeac24..5b7ccd89113 100644
--- a/engines/dgds/scene.h
+++ b/engines/dgds/scene.h
@@ -387,13 +387,13 @@ public:
void runQuitGameOps() { runOps(_quitGameOps); }
void runChangeSceneOps() { runOps(_onChangeSceneOps); }
void globalOps(const Common::Array<uint16> &args);
- int16 getGlobal(uint16 num);
+ int16 getGlobal(uint16 num) const;
int16 setGlobal(uint16 num, int16 val);
const Common::Array<MouseCursor> &getCursorList() const { return _cursorList; }
void drawItems(Graphics::ManagedSurface &surf);
Common::Array<GameItem> &getGameItems() { return _gameItems; }
- int countItemsInScene2() const;
+ int countItemsInInventory() const;
const Common::Array<ObjectInteraction> &getObjInteractions1() { return _objInteractions1; }
const Common::Array<ObjectInteraction> &getObjInteractions2() { return _objInteractions2; }
More information about the Scummvm-git-logs
mailing list