aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage/ringworld/ringworld_logic.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2011-10-12 21:12:34 +1100
committerPaul Gilbert2011-10-12 21:12:34 +1100
commit8a8fd94f100ec4e8891bf8c81a2c4de70d1bfd87 (patch)
tree685e739db6705f10eed8d83518d052373ea4b2ff /engines/tsage/ringworld/ringworld_logic.cpp
parent01666659264ece2cd33b0ecc53dd5fc8c3d7de5c (diff)
downloadscummvm-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/ringworld/ringworld_logic.cpp')
-rw-r--r--engines/tsage/ringworld/ringworld_logic.cpp99
1 files changed, 99 insertions, 0 deletions
diff --git a/engines/tsage/ringworld/ringworld_logic.cpp b/engines/tsage/ringworld/ringworld_logic.cpp
index 3fb284f5da..38ce8954d2 100644
--- a/engines/tsage/ringworld/ringworld_logic.cpp
+++ b/engines/tsage/ringworld/ringworld_logic.cpp
@@ -572,6 +572,105 @@ void RingworldGame::rightClick() {
delete dlg;
}
+/*--------------------------------------------------------------------------*/
+
+NamedHotspot::NamedHotspot() : SceneHotspot() {
+ _resNum = 0;
+ _lookLineNum = _useLineNum = _talkLineNum = -1;
+}
+
+void NamedHotspot::doAction(int action) {
+ switch (action) {
+ case CURSOR_WALK:
+ // Nothing
+ return;
+ case CURSOR_LOOK:
+ if (_lookLineNum == -1)
+ break;
+
+ SceneItem::display(_resNum, _lookLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
+ break;
+ case CURSOR_USE:
+ if (_useLineNum == -1)
+ break;
+
+ SceneItem::display(_resNum, _useLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
+ break;
+ case CURSOR_TALK:
+ if (_talkLineNum == -1)
+ break;
+
+ SceneItem::display(_resNum, _lookLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
+ break;
+ default:
+ SceneHotspot::doAction(action);
+ break;
+ }
+}
+
+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 Ringworld
} // End of namespace TsAGE