diff options
-rw-r--r-- | engines/mads/animation.cpp | 1 | ||||
-rw-r--r-- | engines/mads/animation.h | 1 | ||||
-rw-r--r-- | engines/mads/hotspots.cpp | 4 | ||||
-rw-r--r-- | engines/mads/hotspots.h | 3 | ||||
-rw-r--r-- | engines/mads/scene.cpp | 14 |
5 files changed, 21 insertions, 2 deletions
diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index e4f44fc308..1c492bbee5 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -177,6 +177,7 @@ Animation::Animation(MADSEngine *vm, Scene *scene) : _vm(vm), _scene(scene) { _oldFrameEntry = 0; _rgbResult = -1; _palIndex1 = _palIndex2 = -1; + _dynamicHotspotIndex = -1; } Animation::~Animation() { diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 46ef85c5eb..45e6e3cce9 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -191,6 +191,7 @@ public: bool _resetFlag; int _currentFrame; int _oldFrameEntry; + int _dynamicHotspotIndex; static Animation *init(MADSEngine *vm, Scene *scene); /* diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index 526654d0ff..098313eca4 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -27,6 +27,7 @@ namespace MADS { DynamicHotspot::DynamicHotspot() { _seqIndex = 0; + _animIndex = -1; _facing = FACING_NONE; _descId = 0; _verbId = 0; @@ -74,6 +75,7 @@ int DynamicHotspots::add(int descId, int verbId, int seqIndex, const Common::Rec _entries[idx]._verbId = verbId; _entries[idx]._articleNumber = PREP_IN; _entries[idx]._cursor = CURSOR_NONE; + _entries[idx]._animIndex = -1; ++_count; _changed = true; @@ -106,6 +108,8 @@ void DynamicHotspots::remove(int index) { if (index >= 0 && _entries[index]._active) { if (_entries[index]._seqIndex >= 0) scene._sequences[_entries[index]._seqIndex]._dynamicHotspotIndex = -1; + if (_entries[index]._animIndex >= 0) + scene._animation[_entries[index]._animIndex]->_dynamicHotspotIndex = -1; _entries[index]._active = false; --_count; diff --git a/engines/mads/hotspots.h b/engines/mads/hotspots.h index e556c29fb6..ffd53e5a70 100644 --- a/engines/mads/hotspots.h +++ b/engines/mads/hotspots.h @@ -35,6 +35,7 @@ class DynamicHotspot { public: bool _active; int _seqIndex; + int _animIndex; Common::Rect _bounds; Common::Point _feetPos; Facing _facing; @@ -54,7 +55,7 @@ public: void synchronize(Common::Serializer &s); }; -#define DYNAMIC_HOTSPOTS_SIZE 10 +#define DYNAMIC_HOTSPOTS_SIZE 16 #define SYNTAX_SINGULAR 0 #define SYNTAX_PLURAL 1 diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 07e67c04d6..daa50aacbc 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -771,7 +771,19 @@ int Scene::getAnimFrame(int id) { } void Scene::setDynamicAnim(int id, int anim_id, int segment) { - warning("TODO: Scene::setDynamicAnim"); + if (id >= 0 && id <= DYNAMIC_HOTSPOTS_SIZE && _animation[anim_id]) { + _animation[anim_id]->_dynamicHotspotIndex = id; + if (_dynamicHotspots[id]._animIndex < 0) + _dynamicHotspots[id]._active = false; + _dynamicHotspots[id]._animIndex = anim_id; + + // TODO: Anim segments + + // NOTE: Only remove the TODO below when _dynamicHotspotIndex + // in the Animation class is actually used in the engine! + + warning("TODO: Scene::setDynamicAnim"); + } } void Scene::setCamera(Common::Point pos) { |