aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage/ringworld
diff options
context:
space:
mode:
Diffstat (limited to 'engines/tsage/ringworld')
-rw-r--r--engines/tsage/ringworld/ringworld_logic.cpp99
-rw-r--r--engines/tsage/ringworld/ringworld_logic.h25
2 files changed, 124 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
diff --git a/engines/tsage/ringworld/ringworld_logic.h b/engines/tsage/ringworld/ringworld_logic.h
index 84816347af..6adc8c41da 100644
--- a/engines/tsage/ringworld/ringworld_logic.h
+++ b/engines/tsage/ringworld/ringworld_logic.h
@@ -157,6 +157,31 @@ public:
virtual void rightClick();
};
+class NamedHotspot : public SceneHotspot {
+public:
+ int _resNum, _lookLineNum, _useLineNum, _talkLineNum;
+ NamedHotspot();
+
+ virtual void doAction(int action);
+ 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 Ringworld
} // End of namespace TsAGE