diff options
author | Paul Gilbert | 2014-03-03 20:53:27 -0500 |
---|---|---|
committer | Paul Gilbert | 2014-03-03 20:53:27 -0500 |
commit | 3a3a295758a87817e9d66d3c06df56859ef55529 (patch) | |
tree | 429deeae20d459baabe3d0b3aa302f9706baff9b /engines/mads/scene_data.cpp | |
parent | d8026b9ef72d7ca22721486244309ccd4a003cae (diff) | |
download | scummvm-rg350-3a3a295758a87817e9d66d3c06df56859ef55529.tar.gz scummvm-rg350-3a3a295758a87817e9d66d3c06df56859ef55529.tar.bz2 scummvm-rg350-3a3a295758a87817e9d66d3c06df56859ef55529.zip |
MADS: Implemented sequence list, improvements for sprite assets
Diffstat (limited to 'engines/mads/scene_data.cpp')
-rw-r--r-- | engines/mads/scene_data.cpp | 112 |
1 files changed, 77 insertions, 35 deletions
diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 10d346ed11..6fa2f5b326 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -223,54 +223,96 @@ DynamicHotspot::DynamicHotspot() { /*------------------------------------------------------------------------*/ DynamicHotspots::DynamicHotspots(MADSEngine *vm): _vm(vm) { - _changed = false; + for (int i = 0; i < DYNAMIC_HOTSPOTS_SIZE; ++i) { + DynamicHotspot rec; + rec._active = false; + _entries.push_back(rec); + } + + _changed = true; + _count = 0; } -void DynamicHotspots::clear() { - Common::Array<DynamicHotspot>::clear(); - _changed = false; +int DynamicHotspots::add(int descId, int field14, 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.x = -3; + _entries[idx]._feetPos.y = 0; + _entries[idx]._facing = 5; + _entries[idx]._field14 = field14; + _entries[idx]._articleNumber = 6; + _entries[idx]._cursor = CURSOR_NONE; + + ++_count; + _changed = true; + + if (seqIndex >= 0) + _vm->_game->_scene._sequences[seqIndex]._dynamicHotspotIndex = idx; + + return idx; } -void DynamicHotspots::refresh() { +int DynamicHotspots::setPosition(int index, int xp, int yp, int facing) { + if (index >= 0) { + _entries[index]._feetPos.x = xp; + _entries[index]._feetPos.y = yp; + _entries[index]._facing = facing; + } + + return index; +} + +int DynamicHotspots::setCursor(int index, CursorType cursor) { + if (index >= 0) + _entries[index]._cursor = cursor; + + return index; +} + +void DynamicHotspots::remove(int index) { Scene &scene = _vm->_game->_scene; - for (uint idx = 0; idx < size(); ++idx) { - DynamicHotspot &dh = (*this)[idx]; + if (_entries[index]._active) { + if (_entries[index]._seqIndex >= 0) + scene._sequences[_entries[index]._seqIndex]._dynamicHotspotIndex = -1; + _entries[index]._active = false; - switch (scene._screenObjects._v832EC) { - case 0: - case 2: - scene._screenObjects.add(dh._bounds, CAT_12, dh._descId); - scene._screenObjects._v8333C = true; - default: - break; - } + --_count; + _changed = true; } } -/*------------------------------------------------------------------------*/ +void DynamicHotspots::clear() { + for (uint i = 0; i < _entries.size(); ++i) + _entries[i]._active = false; -SequenceEntry::SequenceEntry() { - _spritesIndex = 0; - _flipped =0; - _frameIndex = 0; - _frameStart = 0; - _numSprites = 0; - _animType = 0; - _frameInc = 0; - _depth = 0; - _scale = 0; - _dynamicHotspotIndex = -1; - _triggerCountdown = 0; - _doneFlag = 0; - _entries._count = 0; - _abortMode = 0; - _actionNouns[0] = _actionNouns[1] = _actionNouns[2] = 0; - _numTicks = 0; - _extraTicks = 0; - _timeout = 0; + _changed = false; + _count = 0; } +void DynamicHotspots::reset() { + for (uint i = 0; i < _entries.size(); ++i) + remove(i); + + _count = 0; + _changed = false; +} + +void DynamicHotspots::refresh() { + error("DynamicHotspots::refresh"); +} + +/*------------------------------------------------------------------------*/ + KernelMessage::KernelMessage() { _flags = 0; _seqInex = 0; |