aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/tsage/core.cpp144
-rw-r--r--engines/tsage/core.h15
2 files changed, 97 insertions, 62 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index a32f445194..f894d2d33a 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -1512,14 +1512,6 @@ void SceneItem::synchronize(Serializer &s) {
s.syncAsSint16LE(_position.x); s.syncAsSint32LE(_position.y);
s.syncAsSint16LE(_yDiff);
s.syncAsSint32LE(_sceneRegionId);
-
- if (g_vm->getGameID() == GType_Ringworld2) {
- // In R2R, the following fields were moved into the SceneItem class
- s.syncAsSint16LE(_resNum);
- s.syncAsSint16LE(_lookLineNum);
- s.syncAsSint16LE(_useLineNum);
- s.syncAsSint16LE(_talkLineNum);
- }
}
void SceneItem::remove() {
@@ -1774,60 +1766,24 @@ void SceneItem::display(const Common::String &msg) {
SET_EXT_FGCOLOR, 13, LIST_END);
}
-void SceneItem::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 SceneItem::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;
- }
+SceneHotspot::SceneHotspot(): SceneItem() {
+ _lookLineNum = _useLineNum = _talkLineNum = 0;
}
-void SceneItem::setDetails(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode) {
- _sceneRegionId = sceneRegionId;
- _resNum = resNum;
- _lookLineNum = lookLineNum;
- _talkLineNum = talkLineNum;
- _useLineNum = useLineNum;
+void SceneHotspot::synchronize(Serializer &s) {
+ SceneItem::synchronize(s);
- // 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;
+ if (g_vm->getGameID() == GType_Ringworld2) {
+ // In R2R, the following fields were moved into the SceneItem class
+ s.syncAsSint16LE(_resNum);
+ s.syncAsSint16LE(_lookLineNum);
+ s.syncAsSint16LE(_useLineNum);
+ s.syncAsSint16LE(_talkLineNum);
}
}
-/*--------------------------------------------------------------------------*/
-
bool SceneHotspot::startAction(CursorType action, Event &event) {
switch (g_vm->getGameID()) {
case GType_BlueForce: {
@@ -1835,6 +1791,32 @@ bool SceneHotspot::startAction(CursorType action, Event &event) {
assert(scene);
return scene->display(action);
}
+ case GType_Ringworld2: {
+ switch (action) {
+ case CURSOR_LOOK:
+ if (_lookLineNum != -1) {
+ SceneItem::display2(_resNum, _lookLineNum);
+ return true;
+ }
+ break;
+ case CURSOR_USE:
+ if (_useLineNum != -1) {
+ SceneItem::display2(_resNum, _useLineNum);
+ return true;
+ }
+ break;
+ case CURSOR_TALK:
+ if (_talkLineNum != -1) {
+ SceneItem::display2(_resNum, _talkLineNum);
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return ((Ringworld2::SceneExt *)GLOBALS._sceneManager._scene)->display(action, event);
+ }
default:
return SceneItem::startAction(action, event);
}
@@ -1871,6 +1853,58 @@ void SceneHotspot::doAction(int action) {
}
}
+void SceneHotspot::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 SceneHotspot::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 SceneHotspot::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 SceneObjectWrapper::setSceneObject(SceneObject *so) {
diff --git a/engines/tsage/core.h b/engines/tsage/core.h
index 98efaf9881..ca691ec618 100644
--- a/engines/tsage/core.h
+++ b/engines/tsage/core.h
@@ -412,8 +412,6 @@ public:
Common::Point _position;
int _yDiff;
int _sceneRegionId;
-
- int _resNum, _lookLineNum, _useLineNum, _talkLineNum;
public:
SceneItem() : EventHandler() { _msg = "Feature"; _action = NULL; _sceneRegionId = 0; }
@@ -430,10 +428,6 @@ public:
static void display(int resNum, int lineNum, ...);
static void display2(int resNum, int lineNum);
static void display(const Common::String &msg);
-
- 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 = 0);
};
class SceneItemExt : public SceneItem {
@@ -449,10 +443,17 @@ public:
class SceneHotspot : public SceneItem {
public:
- SceneHotspot() : SceneItem() {}
+ int _resNum, _lookLineNum, _useLineNum, _talkLineNum;
+public:
+ SceneHotspot();
+ virtual void synchronize(Serializer &s);
virtual bool startAction(CursorType action, Event &event);
virtual Common::String getClassName() { return "SceneHotspot"; }
virtual void doAction(int action);
+
+ 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 = 0);
};
enum AnimateMode {ANIM_MODE_NONE = 0, ANIM_MODE_1 = 1, ANIM_MODE_2 = 2, ANIM_MODE_3 = 3,