diff options
author | Paul Gilbert | 2011-10-12 21:12:34 +1100 |
---|---|---|
committer | Paul Gilbert | 2011-10-12 21:12:34 +1100 |
commit | 8a8fd94f100ec4e8891bf8c81a2c4de70d1bfd87 (patch) | |
tree | 685e739db6705f10eed8d83518d052373ea4b2ff /engines/tsage/blue_force | |
parent | 01666659264ece2cd33b0ecc53dd5fc8c3d7de5c (diff) | |
download | scummvm-rg350-8a8fd94f100ec4e8891bf8c81a2c4de70d1bfd87.tar.gz scummvm-rg350-8a8fd94f100ec4e8891bf8c81a2c4de70d1bfd87.tar.bz2 scummvm-rg350-8a8fd94f100ec4e8891bf8c81a2c4de70d1bfd87.zip |
TSAGE: Separated the NamedHotspot class into separate versions for Ringworld and Blue Force
This fixes bug #3422141, which was also caused by special checks introduced to try and handle Blue Force hotspots differently
Diffstat (limited to 'engines/tsage/blue_force')
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.cpp | 95 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.h | 26 |
2 files changed, 121 insertions, 0 deletions
diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index b945343ce7..1c50e7f079 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -1278,6 +1278,101 @@ void BlueForceInvObjectList::alterInventory(int mode) { /*--------------------------------------------------------------------------*/ +NamedHotspot::NamedHotspot() : SceneHotspot() { + _resNum = 0; + _lookLineNum = _useLineNum = _talkLineNum = -1; +} + +bool NamedHotspot::startAction(CursorType action, Event &event) { + switch (action) { + case CURSOR_WALK: + // Nothing + return false; + case CURSOR_LOOK: + if (_lookLineNum == -1) + return SceneHotspot::startAction(action, event); + + SceneItem::display2(_resNum, _lookLineNum); + return true; + case CURSOR_USE: + if (_useLineNum == -1) + return SceneHotspot::startAction(action, event); + + SceneItem::display2(_resNum, _useLineNum); + return true; + case CURSOR_TALK: + if (_talkLineNum == -1) + return SceneHotspot::startAction(action, event); + + SceneItem::display2(_resNum, _talkLineNum); + return true; + default: + return SceneHotspot::startAction(action, event); + } +} + +void NamedHotspot::setDetails(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum) { + setBounds(ys, xe, ye, xs); + _resNum = resnum; + _lookLineNum = lookLineNum; + _useLineNum = useLineNum; + _talkLineNum = -1; + g_globals->_sceneItems.addItems(this, NULL); +} + +void NamedHotspot::setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) { + setBounds(bounds); + _resNum = resNum; + _lookLineNum = lookLineNum; + _talkLineNum = talkLineNum; + _useLineNum = useLineNum; + + switch (mode) { + case 2: + g_globals->_sceneItems.push_front(this); + break; + case 4: + g_globals->_sceneItems.addBefore(item, this); + break; + case 5: + g_globals->_sceneItems.addAfter(item, this); + break; + default: + g_globals->_sceneItems.push_back(this); + break; + } +} + +void NamedHotspot::setDetails(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode) { + _sceneRegionId = sceneRegionId; + _resNum = resNum; + _lookLineNum = lookLineNum; + _talkLineNum = talkLineNum; + _useLineNum = useLineNum; + + // Handle adding hotspot to scene items list as necessary + switch (mode) { + case 2: + GLOBALS._sceneItems.push_front(this); + break; + case 3: + break; + default: + GLOBALS._sceneItems.push_back(this); + break; + } +} + +void NamedHotspot::synchronize(Serializer &s) { + SceneHotspot::synchronize(s); + s.syncAsSint16LE(_resNum); + s.syncAsSint16LE(_lookLineNum); + s.syncAsSint16LE(_useLineNum); + + if (g_vm->getGameID() == GType_BlueForce) + s.syncAsSint16LE(_talkLineNum); +} + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h index a39e19ae3d..8764d0b856 100644 --- a/engines/tsage/blue_force/blueforce_logic.h +++ b/engines/tsage/blue_force/blueforce_logic.h @@ -328,6 +328,32 @@ public: virtual Common::String getClassName() { return "BlueForceInvObjectList"; } }; +class NamedHotspot : public SceneHotspot { +public: + int _resNum, _lookLineNum, _useLineNum, _talkLineNum; + NamedHotspot(); + + + virtual bool startAction(CursorType action, Event &event); + virtual Common::String getClassName() { return "NamedHotspot"; } + virtual void synchronize(Serializer &s); + virtual void setDetails(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum); + virtual void setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item); + virtual void setDetails(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode); +}; + +class NamedHotspotExt : public NamedHotspot { +public: + int _flag; + NamedHotspotExt() { _flag = 0; } + + virtual Common::String getClassName() { return "NamedHotspot"; } + virtual void synchronize(Serializer &s) { + NamedHotspot::synchronize(s); + s.syncAsSint16LE(_flag); + } +}; + } // End of namespace BlueForce } // End of namespace TsAGE |