diff options
author | Paul Gilbert | 2011-04-03 10:50:52 +1000 |
---|---|---|
committer | Paul Gilbert | 2011-04-03 10:50:52 +1000 |
commit | 1df668bd1e674c5c72c4a92c9de9bc01bf6d4479 (patch) | |
tree | 87d992039881e99b1b06087a20215e333af79814 /engines | |
parent | 499d1751c747fb481c9390513a2ec90653af852f (diff) | |
download | scummvm-rg350-1df668bd1e674c5c72c4a92c9de9bc01bf6d4479.tar.gz scummvm-rg350-1df668bd1e674c5c72c4a92c9de9bc01bf6d4479.tar.bz2 scummvm-rg350-1df668bd1e674c5c72c4a92c9de9bc01bf6d4479.zip |
TSAGE: Properly implemented the PlayerMover2 class
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tsage/core.cpp | 37 | ||||
-rw-r--r-- | engines/tsage/core.h | 13 |
2 files changed, 44 insertions, 6 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 4a3ade08ce..d3bbe582bd 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -449,7 +449,7 @@ void ObjectMover3::dispatch() { } void ObjectMover3::startMove(SceneObject *sceneObj, va_list va) { - _sceneObject = va_arg(va, SceneObject *); + _sceneObject = sceneObj; _destObject = va_arg(va, SceneObject *); _minArea = va_arg(va, int); _action = va_arg(va, Action *); @@ -996,6 +996,38 @@ bool PlayerMover::sub_F8E5(const Common::Point &pt1, const Common::Point &pt2, c /*--------------------------------------------------------------------------*/ +void PlayerMover2::synchronise(Serialiser &s) { + SYNC_POINTER(_destObject); + s.syncAsSint16LE(_field7E); + s.syncAsSint16LE(_minArea); +} + +void PlayerMover2::dispatch() { + int total = _sceneObject->getSpliceArea(_destObject); + + if (total <= _minArea) + endMove(); + else { + setDest(_destObject->_position); + ObjectMover::dispatch(); + } +} + +void PlayerMover2::startMove(SceneObject *sceneObj, va_list va) { + _sceneObject = sceneObj; + _field7E = va_arg(va, int); + _minArea = va_arg(va, int); + _destObject = va_arg(va, SceneObject *); + + PlayerMover::setDest(_destObject->_position); +} + +void PlayerMover2::endMove() { + _sceneObject->_field6E = 0x40; +} + +/*--------------------------------------------------------------------------*/ + PaletteModifier::PaletteModifier() { _scenePalette = NULL; _action = NULL; @@ -1045,8 +1077,7 @@ void PaletteRotation::signal() { if (_disabled) return; - bool flag = true; - switch (_rotationMode) { + bool flag = true; switch (_rotationMode) { case -1: if (--_currIndex < _start) { flag = decDuration(); diff --git a/engines/tsage/core.h b/engines/tsage/core.h index 5e668d1829..a811b53f4e 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -259,7 +259,7 @@ public: }; class PlayerMover: public NpcMover { -private: +protected: void setDest(const Common::Point &destPos); void pathfind(Common::Point *routeList, Common::Point srcPos, Common::Point destPos, RouteEnds routeEnds); int regionIndexOf(const Common::Point &pt); @@ -286,9 +286,16 @@ public: class PlayerMover2: public PlayerMover { public: - int _field7A; + SceneObject *_destObject; int _field7E; - PlayerMover2(): PlayerMover() { _field7A = 0; } + int _minArea; + PlayerMover2(): PlayerMover() { _destObject = NULL; } + + virtual void synchronise(Serialiser &s); + virtual Common::String getClassName() { return "PlayerMover2"; } + virtual void dispatch(); + virtual void startMove(SceneObject *sceneObj, va_list va); + virtual void endMove(); }; /*--------------------------------------------------------------------------*/ |