diff options
Diffstat (limited to 'engines/mads')
-rw-r--r-- | engines/mads/hotspots.cpp | 41 | ||||
-rw-r--r-- | engines/mads/hotspots.h | 5 | ||||
-rw-r--r-- | engines/mads/phantom/phantom_scenes1.cpp | 1 |
3 files changed, 41 insertions, 6 deletions
diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index 098313eca4..06d5756cec 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -31,7 +31,9 @@ DynamicHotspot::DynamicHotspot() { _facing = FACING_NONE; _descId = 0; _verbId = 0; + _valid = false; // V2 _articleNumber = 0; + _syntax = 0; // V2 _cursor = CURSOR_NONE; _active = false; } @@ -53,9 +55,36 @@ DynamicHotspots::DynamicHotspots(MADSEngine *vm) : _vm(vm) { _count = 0; } -int DynamicHotspots::add(int descId, int verbId, int syntax, int seqIndex, const Common::Rect &bounds) { - warning("TODO: DynamicHotspots::add(5 params))"); - return add(descId, verbId, seqIndex, bounds); +int DynamicHotspots::add(int descId, int verbId, byte syntax, int seqIndex, const Common::Rect &bounds) { + // Find a free slot + uint idx = 0; + while ((idx < _entries.size()) && _entries[idx]._active) + ++idx; + if (idx == _entries.size()) + error("DynamicHotspots overflow"); + + _entries[idx]._active = true; + _entries[idx]._descId = descId; + _entries[idx]._seqIndex = seqIndex; + _entries[idx]._bounds = bounds; + _entries[idx]._feetPos = Common::Point(-3, 0); + _entries[idx]._facing = FACING_NONE; + _entries[idx]._verbId = verbId; + _entries[idx]._articleNumber = PREP_IN; + _entries[idx]._syntax = syntax; + _entries[idx]._cursor = CURSOR_NONE; + _entries[idx]._valid = true; + _entries[idx]._animIndex = -1; + + ++_count; + _changed = true; + + if (seqIndex >= 0) { + _vm->_game->_scene._sequences[seqIndex]._dynamicHotspotIndex = idx; + _entries[idx]._valid = false; + } + + return idx; } int DynamicHotspots::add(int descId, int verbId, int seqIndex, const Common::Rect &bounds) { @@ -138,11 +167,13 @@ void DynamicHotspots::refresh() { ScreenObjects &scrObjects = _vm->_game->_screenObjects; scrObjects.resize(scrObjects._uiCount); + bool isV2 = (_vm->getGameID() != GType_RexNebular); + // Loop through adding hotspots for (uint i = 0; i < _entries.size(); ++i) { DynamicHotspot &dh = (*this)[i]; - if ((*this)[i]._active) { + if ((*this)[i]._active && (!isV2 || (*this)[i]._valid)) { switch (scrObjects._inputMode) { case kInputBuildingSentences: case kInputLimitedSentences: @@ -203,7 +234,7 @@ Hotspot::Hotspot(Common::SeekableReadStream &f, bool isV2) { _cursor = (CursorType)f.readByte(); if (isV2) { f.skip(1); // cursor - f.skip(1); // syntax + _syntax = f.readByte(); } _vocabId = f.readUint16LE(); _verbId = f.readUint16LE(); diff --git a/engines/mads/hotspots.h b/engines/mads/hotspots.h index ffd53e5a70..1b6fb35a0f 100644 --- a/engines/mads/hotspots.h +++ b/engines/mads/hotspots.h @@ -41,7 +41,9 @@ public: Facing _facing; int _descId; int _verbId; + bool _valid; // V2 int _articleNumber; + byte _syntax; // V2 CursorType _cursor; /** @@ -79,7 +81,7 @@ public: Common::Array<MADS::DynamicHotspot>::size_type size() const { return _entries.size(); } DynamicHotspot &operator[](uint idx) { return _entries[idx]; } - int add(int descId, int verbId, int syntax, int seqIndex, const Common::Rect &bounds); + int add(int descId, int verbId, byte syntax, int seqIndex, const Common::Rect &bounds); // V2 int add(int descId, int verbId, int seqIndex, const Common::Rect &bounds); int setPosition(int index, const Common::Point &pos, Facing facing); int setCursor(int index, CursorType cursor); @@ -107,6 +109,7 @@ public: Facing _facing; int _articleNumber; bool _active; + byte _syntax; // V2 CursorType _cursor; int _vocabId; int _verbId; diff --git a/engines/mads/phantom/phantom_scenes1.cpp b/engines/mads/phantom/phantom_scenes1.cpp index 91f75558db..2ce08ef7aa 100644 --- a/engines/mads/phantom/phantom_scenes1.cpp +++ b/engines/mads/phantom/phantom_scenes1.cpp @@ -271,6 +271,7 @@ void Scene101::step() { _talkCounter = 0; } + // Monsieur Brie beckons Raul if (_game._trigger == 50) { _vm->_gameConv->run(0); _callingStatus = 1; |