[Scummvm-git-logs] scummvm master -> 74c8de72407493ad504cc25acc6098409f187536
mduggan
noreply at scummvm.org
Tue Nov 19 10:02:40 UTC 2024
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e9fe7a468b DGDS: Implement some more things for Willy Beamish
582528e371 DGDS: Implement another Willy Beamish global
93829050df DGDS: Partially fix Willy Beamish inventory and main menu
74c8de7240 DGDS: Implement another Willy Beamish global
Commit: e9fe7a468bbbe0d5285dd21780d22238b13032ed
https://github.com/scummvm/scummvm/commit/e9fe7a468bbbe0d5285dd21780d22238b13032ed
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2024-11-19T21:01:41+11:00
Commit Message:
DGDS: Implement some more things for Willy Beamish
Can now give the hair to the school principal near the start.
Changed paths:
engines/dgds/globals.cpp
engines/dgds/globals.h
engines/dgds/scene.cpp
engines/dgds/scene.h
engines/dgds/ttm.cpp
diff --git a/engines/dgds/globals.cpp b/engines/dgds/globals.cpp
index a8fe03a5b96..523eedbac33 100644
--- a/engines/dgds/globals.cpp
+++ b/engines/dgds/globals.cpp
@@ -329,13 +329,13 @@ public:
WillyGlobals::WillyGlobals(Clock &clock) : Globals(clock),
_unk2(4), _unk3(0), _unk4(0), _unk5(0), _unk74(0), _unk75(300),
- _palFade(255), _unk78(0), _unk79(0), _unk80(0), _unk81(3), _unk82(1) {
+ _palFade(255), _droppedItemNum(0), _unk79(0), _unk80(0), _unk81(3), _unk82(1) {
_globals.push_back(new DetailLevelROGlobal(0x53));
_globals.push_back(new RWI16Global(0x52, &_unk82));
_globals.push_back(new RWI16Global(0x51, &_unk81));
_globals.push_back(new RWI16Global(0x50, &_unk80));
_globals.push_back(new RWI16Global(0x4F, &_unk79));
- _globals.push_back(new RWI16Global(0x4E, &_unk78));
+ _globals.push_back(new RWI16Global(0x4E, &_droppedItemNum));
_globals.push_back(new RWI16Global(0x4D, &_palFade));
_globals.push_back(new PaletteFadeGlobal(0x4C, &_palFade));
_globals.push_back(new RWI16Global(0x4B, &_unk75));
@@ -355,7 +355,7 @@ Common::Error WillyGlobals::syncState(Common::Serializer &s) {
s.syncAsSint16LE(_unk74);
s.syncAsSint16LE(_unk75);
s.syncAsSint16LE(_palFade);
- s.syncAsSint16LE(_unk78);
+ s.syncAsSint16LE(_droppedItemNum);
s.syncAsSint16LE(_unk79);
s.syncAsSint16LE(_unk80);
s.syncAsSint16LE(_unk81);
diff --git a/engines/dgds/globals.h b/engines/dgds/globals.h
index dd5a3cf2d16..8f406cf7834 100644
--- a/engines/dgds/globals.h
+++ b/engines/dgds/globals.h
@@ -198,6 +198,8 @@ public:
void setPalFade(int16 val) { _palFade = val; }
int16 getPalFade() const { return _palFade; }
+ void setDroppedItemNum(int16 val) { _droppedItemNum = val; }
+
private:
// Willy-specific globals
int16 _unk2;
@@ -207,7 +209,7 @@ private:
int16 _unk74;
int16 _unk75;
int16 _palFade;
- int16 _unk78;
+ int16 _droppedItemNum;
int16 _unk79;
int16 _unk80;
int16 _unk81;
diff --git a/engines/dgds/scene.cpp b/engines/dgds/scene.cpp
index a1f36f9ba47..dbed0dfb2c2 100644
--- a/engines/dgds/scene.cpp
+++ b/engines/dgds/scene.cpp
@@ -100,8 +100,8 @@ Common::String SceneConditions::dump(const Common::String &indent) const {
Common::String HotArea::dump(const Common::String &indent) const {
- Common::String str = Common::String::format("%sHotArea<%s num %d cursor %d cursor2 %d interactionFlag %d",
- indent.c_str(), _rect.dump("").c_str(), _num, _cursorNum, _otherCursorNum, _objInteractionListFlag);
+ Common::String str = Common::String::format("%sHotArea<%s num %d cursor %d cursor2 %d interactionRectNum %d",
+ indent.c_str(), _rect.dump("").c_str(), _num, _cursorNum, _otherCursorNum, _objInteractionRectNum);
str += _dumpStructList(indent, "enableConditions", enableConditions);
str += _dumpStructList(indent, "onRClickOps", onRClickOps);
str += _dumpStructList(indent, "onLDownOps", onLDownOps);
@@ -309,12 +309,12 @@ bool Scene::readHotArea(Common::SeekableReadStream *s, HotArea &dst) const {
dst._otherCursorNum = 0;
if (isVersionOver(" 1.218")) {
- dst._objInteractionListFlag = s->readUint16LE();
- if (dst._objInteractionListFlag) {
+ dst._objInteractionRectNum = s->readUint16LE();
+ if (dst._objInteractionRectNum) {
dst._rect = DgdsRect();
}
} else {
- dst._objInteractionListFlag = 0;
+ dst._objInteractionRectNum = 0;
}
readConditionList(s, dst.enableConditions);
readOpList(s, dst.onRClickOps);
@@ -402,7 +402,7 @@ bool Scene::readOpList(Common::SeekableReadStream *s, Common::Array<SceneOp> &li
for (SceneOp &dst : list) {
readConditionList(s, dst._conditionList);
dst._opCode = static_cast<SceneOpCode>(s->readUint16LE());
- if ((dst._opCode & 0x7fff) > kSceneOpMaxCode || dst._opCode == kSceneOpNone)
+ if ((dst._opCode & ~kSceneOpHasConditionalOpsFlag) > kSceneOpMaxCode || dst._opCode == kSceneOpNone)
error("Unexpected scene opcode %d", (int)dst._opCode);
uint16 nvals = s->readUint16LE();
_checkListNotTooLong(nvals, "scene op args");
@@ -834,8 +834,8 @@ bool Scene::runChinaOp(const SceneOp &op) {
bool Scene::runBeamishOp(const SceneOp &op) {
DgdsEngine *engine = DgdsEngine::getInstance();
- if (op._opCode & 0x8000) {
- uint16 opcode = op._opCode & 0x7fff;
+ if (op._opCode & kSceneOpHasConditionalOpsFlag) {
+ uint16 opcode = op._opCode & ~kSceneOpHasConditionalOpsFlag;
for (const ConditionalSceneOp &cop : engine->getScene()->getConditionalOps()) {
if (cop._opCode == opcode && checkConditions(cop._conditionList)) {
if (!runOps(cop._opList))
@@ -1062,6 +1062,7 @@ void SDSScene::unload() {
_dialogs.clear();
_triggers.clear();
_talkData.clear();
+ _dynamicRects.clear();
_sceneDialogFlags = kDlgFlagNone;
}
@@ -1225,8 +1226,8 @@ bool SDSScene::readTalkData(Common::SeekableReadStream *s, TalkData &dst) {
h._headFrames.resize(nsub);
for (auto &sub : h._headFrames) {
sub._frameNo = s->readUint16LE();
- sub._xoff = s->readUint16LE();
- sub._yoff = s->readUint16LE();
+ sub._xoff = s->readSint16LE();
+ sub._yoff = s->readSint16LE();
if (isVersionOver(" 1.221")) {
sub._flipFlags = s->readUint16LE();
}
@@ -1850,9 +1851,13 @@ void SDSScene::onDragFinish(const Common::Point &pt) {
GameItem *dragItem = _dragItem;
DgdsEngine *engine = DgdsEngine::getInstance();
- const Globals *globals = engine->getGameGlobals();
+ Globals *globals = engine->getGameGlobals();
GDSScene *gdsScene = engine->getGDSScene();
+ if (engine->getGameId() == GID_WILLY) {
+ static_cast<WillyGlobals *>(globals)->setDroppedItemNum(dragItem->_num);
+ }
+
runOps(dragItem->onDragFinishedOps, globals->getGameMinsToAddOnDragFinished());
// TODO: Both these loops are very similar.. there should be a cleaner way.
@@ -1975,6 +1980,35 @@ bool SDSScene::hasVisibleOrOpeningDialog() const {
return false;
}
+void SDSScene::setDynamicSceneRect(int16 num, int16 x, int16 y, int16 width, int16 height) {
+ for (auto &dynamicRect : _dynamicRects) {
+ if (dynamicRect._num == num) {
+ dynamicRect._rect = DgdsRect(x, y, width, height);
+ return;
+ }
+ }
+
+ _dynamicRects.push_back(DynamicRect());
+ _dynamicRects.back()._num = num;
+ _dynamicRects.back()._rect = DgdsRect(x, y, width, height);
+}
+
+
+void SDSScene::updateHotAreasFromDynamicRects() {
+ if (_dynamicRects.empty())
+ return;
+ for (auto &hotArea : _hotAreaList) {
+ if (!hotArea._objInteractionRectNum)
+ continue;
+ for (const auto &dynamicRect : _dynamicRects) {
+ if (hotArea._objInteractionRectNum == dynamicRect._num) {
+ hotArea._rect = dynamicRect._rect;
+ break;
+ }
+ }
+ }
+}
+
HotArea *SDSScene::findAreaUnderMouse(const Common::Point &pt) {
for (auto &item : DgdsEngine::getInstance()->getGDSScene()->getGameItems()) {
if (item._inSceneNum == _num && checkConditions(item.enableConditions)
@@ -2016,7 +2050,7 @@ void SDSScene::addInvButtonToHotAreaList() {
area._rect.x = SCREEN_WIDTH - area._rect.width;
area._rect.y = SCREEN_HEIGHT - area._rect.height;
area._otherCursorNum = 0;
- area._objInteractionListFlag = 0;
+ area._objInteractionRectNum = 0;
// Add swap character button for HoC
if (engine->getGameId() == GID_HOC && engine->getGDSScene()->getGlobal(0x34) != 0) {
@@ -2030,7 +2064,7 @@ void SDSScene::addInvButtonToHotAreaList() {
area2._rect.x = 5;
area2._rect.y = SCREEN_HEIGHT - area2._rect.height - 5;
area2._otherCursorNum = 0;
- area2._objInteractionListFlag = 0;
+ area2._objInteractionRectNum = 0;
_hotAreaList.push_front(area2);
}
diff --git a/engines/dgds/scene.h b/engines/dgds/scene.h
index 783dd0c06e5..5e2c0b52206 100644
--- a/engines/dgds/scene.h
+++ b/engines/dgds/scene.h
@@ -71,7 +71,7 @@ public:
// Used in Willy Beamish
uint16 _otherCursorNum;
- uint16 _objInteractionListFlag;
+ uint16 _objInteractionRectNum;
Common::Array<SceneConditions> enableConditions;
Common::Array<SceneOp> onRClickOps;
@@ -83,6 +83,13 @@ public:
virtual Common::String dump(const Common::String &indent) const;
};
+class DynamicRect {
+public:
+ DynamicRect() : _num(0) {};
+ uint16 _num;
+ DgdsRect _rect;
+};
+
enum SceneOpCode {
kSceneOpNone = 0,
kSceneOpChangeScene = 1, // args: scene num
@@ -149,6 +156,8 @@ enum SceneOpCode {
kSceneOpOpenBeamishOpenSkipCreditsMenu = 101,
kSceneOpMaxCode = 255, // for checking file load
+
+ kSceneOpHasConditionalOpsFlag = 0x8000,
};
class SceneOp {
@@ -204,7 +213,8 @@ public:
Common::Array<SceneOp> opList;
bool matches(uint16 droppedItemNum, uint16 targetItemNum) const {
- return _droppedItemNum == droppedItemNum && _targetItemNum == targetItemNum;
+ return (_droppedItemNum == 0xFFFF || _droppedItemNum == droppedItemNum)
+ && _targetItemNum == targetItemNum;
}
Common::String dump(const Common::String &indent) const;
@@ -257,8 +267,8 @@ public:
Common::String dump(const Common::String &indent) const;
uint16 _frameNo;
- uint16 _xoff;
- uint16 _yoff;
+ int16 _xoff;
+ int16 _yoff;
uint16 _flipFlags;
};
@@ -472,7 +482,6 @@ public:
// dragon-specific scene ops
void addAndShowTiredDialog();
- void sceneOpUpdatePasscodeGlobal();
void prevChoice();
void nextChoice();
@@ -482,6 +491,8 @@ public:
bool isRButtonDown() const { return _rbuttonDown; }
void showDialog(uint16 fileNum, uint16 dlgNum);
const Common::Array<ConditionalSceneOp> &getConditionalOps() { return _conditionalOps; }
+ void updateHotAreasFromDynamicRects();
+ void setDynamicSceneRect(int16 num, int16 x, int16 y, int16 width, int16 height);
protected:
HotArea *findAreaUnderMouse(const Common::Point &pt);
@@ -506,6 +517,7 @@ private:
Common::List<HotArea> _hotAreaList;
Common::Array<ObjectInteraction> _objInteractions1;
Common::Array<ObjectInteraction> _objInteractions2;
+ Common::Array<DynamicRect> _dynamicRects; // Only used in Willy Beamish
//uint _field12_0x2b;
//uint _field15_0x33;
diff --git a/engines/dgds/ttm.cpp b/engines/dgds/ttm.cpp
index 774b1580a3f..7f6402eb254 100644
--- a/engines/dgds/ttm.cpp
+++ b/engines/dgds/ttm.cpp
@@ -35,6 +35,7 @@
#include "dgds/font.h"
#include "dgds/sound_raw.h"
#include "dgds/drawing.h"
+#include "dgds/scene.h"
namespace Dgds {
@@ -176,6 +177,7 @@ static const char *ttmOpName(uint16 op) {
case 0x4120: return "FADE IN";
case 0x4200: return "STORE AREA";
case 0x4210: return "SAVE GETPUT REGION";
+ case 0x5000: return "SET DYNAMIC RECT";
case 0xa000: return "DRAW PIXEL";
case 0xa010: return "WIPE DISSOLVE";
@@ -840,10 +842,8 @@ void TTMInterpreter::handleOperation(TTMEnviro &env, TTMSeq &seq, uint16 op, byt
env._getPuts[seq._currentGetPutId]._surf.reset(surf);
break;
}
- case 0x5000:
- // This opcode does nothing in SQ5 demo
- debug(1, "TTM: 0x5000: Implement opcode? (%d %d %d %d %d)",
- ivals[0], ivals[1], ivals[2], ivals[3], ivals[4]);
+ case 0x5000: // SET DYNAMIC RECT: x,y,w,h,num ??
+ _vm->getScene()->setDynamicSceneRect(ivals[4], ivals[0], ivals[1], ivals[2], ivals[3]);
break;
case 0xa000: // DRAW PIXEL x,y:int
if (seq._drawWin.contains(ivals[0], ivals[1]))
Commit: 582528e371df6cddc8eb527c0019790479b995af
https://github.com/scummvm/scummvm/commit/582528e371df6cddc8eb527c0019790479b995af
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2024-11-19T21:01:41+11:00
Commit Message:
DGDS: Implement another Willy Beamish global
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 8e83eba1c27..0400c005cd9 100644
--- a/engines/dgds/dgds.cpp
+++ b/engines/dgds/dgds.cpp
@@ -743,6 +743,10 @@ Common::Error DgdsEngine::run() {
_lastGlobalFade = fade;
_lastGlobalFadedPal = _gamePals->getCurPalNum();
}
+
+ // TODO: When should we show the cursor again?
+ if (globals->isHideMouseCursor())
+ CursorMan.showMouse(false);
}
g_system->updateScreen();
diff --git a/engines/dgds/globals.cpp b/engines/dgds/globals.cpp
index 523eedbac33..0996c0671e2 100644
--- a/engines/dgds/globals.cpp
+++ b/engines/dgds/globals.cpp
@@ -328,7 +328,7 @@ public:
WillyGlobals::WillyGlobals(Clock &clock) : Globals(clock),
- _unk2(4), _unk3(0), _unk4(0), _unk5(0), _unk74(0), _unk75(300),
+ _unk2(4), _unk3(0), _unk4(0), _hideMouseCursor(0), _unk74(0), _unk75(300),
_palFade(255), _droppedItemNum(0), _unk79(0), _unk80(0), _unk81(3), _unk82(1) {
_globals.push_back(new DetailLevelROGlobal(0x53));
_globals.push_back(new RWI16Global(0x52, &_unk82));
@@ -340,7 +340,7 @@ WillyGlobals::WillyGlobals(Clock &clock) : Globals(clock),
_globals.push_back(new PaletteFadeGlobal(0x4C, &_palFade));
_globals.push_back(new RWI16Global(0x4B, &_unk75));
_globals.push_back(new RWI16Global(0x4A, &_unk74));
- _globals.push_back(new RWI16Global(0x05, &_unk5));
+ _globals.push_back(new RWI16Global(0x05, &_hideMouseCursor));
_globals.push_back(new RWI16Global(0x04, &_unk4));
_globals.push_back(new RWI16Global(0x03, &_unk3));
_globals.push_back(new WillyDrawGlobal(0x02, &_unk2));
@@ -351,7 +351,7 @@ Common::Error WillyGlobals::syncState(Common::Serializer &s) {
s.syncAsSint16LE(_unk2);
s.syncAsSint16LE(_unk3);
s.syncAsSint16LE(_unk4);
- s.syncAsSint16LE(_unk5);
+ s.syncAsSint16LE(_hideMouseCursor);
s.syncAsSint16LE(_unk74);
s.syncAsSint16LE(_unk75);
s.syncAsSint16LE(_palFade);
diff --git a/engines/dgds/globals.h b/engines/dgds/globals.h
index 8f406cf7834..5e567f67581 100644
--- a/engines/dgds/globals.h
+++ b/engines/dgds/globals.h
@@ -199,13 +199,14 @@ public:
int16 getPalFade() const { return _palFade; }
void setDroppedItemNum(int16 val) { _droppedItemNum = val; }
+ bool isHideMouseCursor() const { return _hideMouseCursor != 0; }
private:
// Willy-specific globals
int16 _unk2;
int16 _unk3;
int16 _unk4;
- int16 _unk5;
+ int16 _hideMouseCursor;
int16 _unk74;
int16 _unk75;
int16 _palFade;
Commit: 93829050dfd1e58c96f0c1d3fd40c6525dbe8f9d
https://github.com/scummvm/scummvm/commit/93829050dfd1e58c96f0c1d3fd40c6525dbe8f9d
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2024-11-19T21:01:41+11:00
Commit Message:
DGDS: Partially fix Willy Beamish inventory and main menu
Changed paths:
engines/dgds/dgds.cpp
engines/dgds/menu.h
engines/dgds/request.cpp
engines/dgds/scene.h
engines/dgds/sound.cpp
diff --git a/engines/dgds/dgds.cpp b/engines/dgds/dgds.cpp
index 0400c005cd9..f6d4db2eb21 100644
--- a/engines/dgds/dgds.cpp
+++ b/engines/dgds/dgds.cpp
@@ -182,7 +182,8 @@ bool DgdsEngine::changeScene(int sceneNum) {
}
const Common::String sceneFile = Common::String::format("S%d.SDS", sceneNum);
- if (!_resource->hasResource(sceneFile)) {
+ bool haveSceneFile = _resource->hasResource(sceneFile);
+ if (!haveSceneFile && sceneNum != 2) {
warning("Tried to switch to non-existent scene %d", sceneNum);
return false;
}
@@ -217,7 +218,11 @@ bool DgdsEngine::changeScene(int sceneNum) {
_storedAreaBuffer.fillRect(Common::Rect(SCREEN_WIDTH, SCREEN_HEIGHT), 0);
- _scene->load(sceneFile, _resource, _decompressor);
+ if (haveSceneFile)
+ _scene->load(sceneFile, _resource, _decompressor);
+ else
+ _scene->setSceneNum(sceneNum);
+
// These are done inside the load function in the original.. cleaner here..
if (!_isDemo)
_scene->addInvButtonToHotAreaList();
@@ -745,7 +750,7 @@ Common::Error DgdsEngine::run() {
}
// TODO: When should we show the cursor again?
- if (globals->isHideMouseCursor())
+ if (globals->isHideMouseCursor() && !_menu->menuShown())
CursorMan.showMouse(false);
}
diff --git a/engines/dgds/menu.h b/engines/dgds/menu.h
index b91c8633180..1df2beae5c3 100644
--- a/engines/dgds/menu.h
+++ b/engines/dgds/menu.h
@@ -42,8 +42,9 @@ namespace Dgds {
class REQFileData;
enum MenuId {
- // Request data numbers, same in both RoTD and China VCRs
+ // Request data numbers, most are same in both RoTD and China VCRs
kMenuNone = 0,
+ kMenuMainBeamish = 3,
kMenuMain = 5,
kMenuControls = 7,
kMenuOptions = 29,
diff --git a/engines/dgds/request.cpp b/engines/dgds/request.cpp
index a345669b0cb..3594882d8a1 100644
--- a/engines/dgds/request.cpp
+++ b/engines/dgds/request.cpp
@@ -224,6 +224,10 @@ bool RequestParser::parseREQChunk(RequestData &data, DgdsChunkReader &chunk, int
uint16 chunkNum = str->readUint16LE();
+ // Slight HACK - only Willy Beamish has a different number for the main menu
+ if (chunkNum == kMenuMainBeamish)
+ chunkNum = kMenuMain;
+
// Note: The original has some logic about loading single request blocks
// here, is only ever called with "num" of -1 (load all),
// so maybe just skip it?
diff --git a/engines/dgds/scene.h b/engines/dgds/scene.h
index 5e2c0b52206..7a2c17b6c81 100644
--- a/engines/dgds/scene.h
+++ b/engines/dgds/scene.h
@@ -493,6 +493,7 @@ public:
const Common::Array<ConditionalSceneOp> &getConditionalOps() { return _conditionalOps; }
void updateHotAreasFromDynamicRects();
void setDynamicSceneRect(int16 num, int16 x, int16 y, int16 width, int16 height);
+ void setSceneNum(int16 num) { _num = num; }
protected:
HotArea *findAreaUnderMouse(const Common::Point &pt);
diff --git a/engines/dgds/sound.cpp b/engines/dgds/sound.cpp
index baa9f9cecc2..4940b483a7b 100644
--- a/engines/dgds/sound.cpp
+++ b/engines/dgds/sound.cpp
@@ -330,7 +330,7 @@ bool Sound::loadSXSoundData(const Common::String &filename, Common::Array<SoundD
debug(1, " SX INF %u [%u entries]: (%s)", type, count, filename.c_str());
for (uint16 k = 0; k < count; k++) {
uint16 idx = stream->readUint16LE();
- debug(1, " %2u: %u", k, idx);
+ debug(10, " %2u: %u", k, idx);
idMap[idx] = k;
}
} else if (chunk.isSection(ID_TAG) || chunk.isSection(ID_FNM)) {
@@ -414,7 +414,7 @@ void Sound::loadSNGSoundData(const Common::String &filename, Common::Array<Sound
debug(1, " SNG INF [%u entries]", count);
for (uint32 k = 0; k < count; k++) {
uint16 flags = stream->readUint16LE();
- debug(1, " %2u: 0x%04x", k, flags);
+ debug(10, " %2u: 0x%04x", k, flags);
dataArray[k]._flags = flags;
}
} else {
Commit: 74c8de72407493ad504cc25acc6098409f187536
https://github.com/scummvm/scummvm/commit/74c8de72407493ad504cc25acc6098409f187536
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2024-11-19T21:01:41+11:00
Commit Message:
DGDS: Implement another Willy Beamish global
This controls visibility of some buttons in the inventory screen.
Changed paths:
engines/dgds/globals.cpp
engines/dgds/globals.h
engines/dgds/inventory.cpp
diff --git a/engines/dgds/globals.cpp b/engines/dgds/globals.cpp
index 0996c0671e2..c9d1d12d1a4 100644
--- a/engines/dgds/globals.cpp
+++ b/engines/dgds/globals.cpp
@@ -328,7 +328,7 @@ public:
WillyGlobals::WillyGlobals(Clock &clock) : Globals(clock),
- _unk2(4), _unk3(0), _unk4(0), _hideMouseCursor(0), _unk74(0), _unk75(300),
+ _unk2(4), _unk3(0), _invDrawTimeSkipButtons(0), _hideMouseCursor(0), _unk74(0), _unk75(300),
_palFade(255), _droppedItemNum(0), _unk79(0), _unk80(0), _unk81(3), _unk82(1) {
_globals.push_back(new DetailLevelROGlobal(0x53));
_globals.push_back(new RWI16Global(0x52, &_unk82));
@@ -341,7 +341,7 @@ WillyGlobals::WillyGlobals(Clock &clock) : Globals(clock),
_globals.push_back(new RWI16Global(0x4B, &_unk75));
_globals.push_back(new RWI16Global(0x4A, &_unk74));
_globals.push_back(new RWI16Global(0x05, &_hideMouseCursor));
- _globals.push_back(new RWI16Global(0x04, &_unk4));
+ _globals.push_back(new RWI16Global(0x04, &_invDrawTimeSkipButtons));
_globals.push_back(new RWI16Global(0x03, &_unk3));
_globals.push_back(new WillyDrawGlobal(0x02, &_unk2));
}
@@ -350,7 +350,7 @@ Common::Error WillyGlobals::syncState(Common::Serializer &s) {
Globals::syncState(s);
s.syncAsSint16LE(_unk2);
s.syncAsSint16LE(_unk3);
- s.syncAsSint16LE(_unk4);
+ s.syncAsSint16LE(_invDrawTimeSkipButtons);
s.syncAsSint16LE(_hideMouseCursor);
s.syncAsSint16LE(_unk74);
s.syncAsSint16LE(_unk75);
diff --git a/engines/dgds/globals.h b/engines/dgds/globals.h
index 5e567f67581..e901e8f0550 100644
--- a/engines/dgds/globals.h
+++ b/engines/dgds/globals.h
@@ -200,12 +200,13 @@ public:
void setDroppedItemNum(int16 val) { _droppedItemNum = val; }
bool isHideMouseCursor() const { return _hideMouseCursor != 0; }
+ bool isDrawTimeSkipButtons() const { return _invDrawTimeSkipButtons != 0; }
private:
// Willy-specific globals
int16 _unk2;
int16 _unk3;
- int16 _unk4;
+ int16 _invDrawTimeSkipButtons;
int16 _hideMouseCursor;
int16 _unk74;
int16 _unk75;
diff --git a/engines/dgds/inventory.cpp b/engines/dgds/inventory.cpp
index 21bb3728033..79de9f3f1c0 100644
--- a/engines/dgds/inventory.cpp
+++ b/engines/dgds/inventory.cpp
@@ -28,6 +28,7 @@
#include "dgds/font.h"
#include "dgds/request.h"
#include "dgds/includes.h"
+#include "dgds/globals.h"
namespace Dgds {
@@ -156,14 +157,24 @@ void Inventory::draw(Graphics::ManagedSurface &surf, int itemCount) {
_nextPageBtn->setVisible(needPageButtons);
//
- // Decide whether the time buttons should be visible (only in Dragon)
+ // Decide whether the time buttons should be visible (only in Dragon and Willy Beamish)
+ // In Willy Beamish the buttons are controlled by a global.
//
- if (gameId != GID_DRAGON) {
- if (_clockSkipMinBtn)
- _clockSkipMinBtn->setVisible(false);
- if (_clockSkipHrBtn)
- _clockSkipHrBtn->setVisible(false);
+ bool showTimeButtons;
+ switch (gameId) {
+ case GID_DRAGON:
+ showTimeButtons = true;
+ break;
+ case GID_WILLY:
+ showTimeButtons = static_cast<WillyGlobals *>(engine->getGameGlobals())->isDrawTimeSkipButtons();
+ default:
+ showTimeButtons = false;
+ break;
}
+ if (_clockSkipMinBtn)
+ _clockSkipMinBtn->setVisible(showTimeButtons);
+ if (_clockSkipHrBtn)
+ _clockSkipHrBtn->setVisible(showTimeButtons);
//
// Decide whether the give-to and swap char buttons should be visible (only in China)
More information about the Scummvm-git-logs
mailing list