aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/tsage/blue_force/blueforce_logic.h2
-rw-r--r--engines/tsage/core.cpp102
-rw-r--r--engines/tsage/core.h6
-rw-r--r--engines/tsage/events.h1
-rw-r--r--engines/tsage/ringworld/ringworld_logic.h1
-rw-r--r--engines/tsage/ringworld2/ringworld2_logic.cpp99
-rw-r--r--engines/tsage/ringworld2/ringworld2_logic.h7
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes3.cpp9
8 files changed, 130 insertions, 97 deletions
diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h
index f5a3938f2b..65cea8efae 100644
--- a/engines/tsage/blue_force/blueforce_logic.h
+++ b/engines/tsage/blue_force/blueforce_logic.h
@@ -338,10 +338,8 @@ public:
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);
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index 6c015ab45f..a32f445194 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -34,6 +34,7 @@
#include "tsage/globals.h"
#include "tsage/sound.h"
#include "tsage/blue_force/blueforce_logic.h"
+#include "tsage/ringworld2/ringworld2_logic.h"
namespace TsAGE {
@@ -1511,6 +1512,14 @@ 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() {
@@ -1533,25 +1542,30 @@ bool SceneItem::startAction(CursorType action, Event &event) {
void SceneItem::doAction(int action) {
const char *msg = NULL;
- switch ((int)action) {
- case CURSOR_LOOK:
- msg = LOOK_SCENE_HOTSPOT;
- break;
- case CURSOR_USE:
- msg = USE_SCENE_HOTSPOT;
- break;
- case CURSOR_TALK:
- msg = TALK_SCENE_HOTSPOT;
- break;
- case 0x1000:
- msg = SPECIAL_SCENE_HOTSPOT;
- break;
- default:
- msg = DEFAULT_SCENE_HOTSPOT;
- break;
- }
+ if (g_vm->getGameID() == GType_Ringworld2) {
+ Event dummyEvent;
+ ((Ringworld2::SceneExt *)GLOBALS._sceneManager._scene)->display((CursorType)action, dummyEvent);
+ } else {
+ switch ((int)action) {
+ case CURSOR_LOOK:
+ msg = LOOK_SCENE_HOTSPOT;
+ break;
+ case CURSOR_USE:
+ msg = USE_SCENE_HOTSPOT;
+ break;
+ case CURSOR_TALK:
+ msg = TALK_SCENE_HOTSPOT;
+ break;
+ case 0x1000:
+ msg = SPECIAL_SCENE_HOTSPOT;
+ break;
+ default:
+ msg = DEFAULT_SCENE_HOTSPOT;
+ break;
+ }
- GUIErrorMessage(msg);
+ GUIErrorMessage(msg);
+ }
}
bool SceneItem::contains(const Common::Point &pt) {
@@ -1760,6 +1774,58 @@ 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;
+ }
+}
+
+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;
+
+ // 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;
+ }
+}
+
/*--------------------------------------------------------------------------*/
bool SceneHotspot::startAction(CursorType action, Event &event) {
diff --git a/engines/tsage/core.h b/engines/tsage/core.h
index e887be050b..98efaf9881 100644
--- a/engines/tsage/core.h
+++ b/engines/tsage/core.h
@@ -412,6 +412,8 @@ public:
Common::Point _position;
int _yDiff;
int _sceneRegionId;
+
+ int _resNum, _lookLineNum, _useLineNum, _talkLineNum;
public:
SceneItem() : EventHandler() { _msg = "Feature"; _action = NULL; _sceneRegionId = 0; }
@@ -428,6 +430,10 @@ 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 {
diff --git a/engines/tsage/events.h b/engines/tsage/events.h
index fe4d3ecde6..dcff1b45b8 100644
--- a/engines/tsage/events.h
+++ b/engines/tsage/events.h
@@ -95,6 +95,7 @@ enum CursorType {
R2_36 = 36, R2_37 = 37, R2_38 = 38, R2_39 = 39, R2_40 = 40, R2_41 = 41, R2_42 = 42,
R2_43 = 43, R2_44 = 44, R2_45 = 45, R2_46 = 46, R2_47 = 47, R2_48 = 48, R2_49 = 49,
R2_50 = 50, R2_51 = 51, R2_52 = 52,
+ R2_LAST_INVENT = 53,
// Ringworld 2 cursors
R2CURSORS_START = 0x8000, EXITCURSOR_N = 0x8007, EXITCURSOR_S = 0x8008, EXITCURSOR_W = 0x8009,
diff --git a/engines/tsage/ringworld/ringworld_logic.h b/engines/tsage/ringworld/ringworld_logic.h
index 6f6a66cc26..b3f103f293 100644
--- a/engines/tsage/ringworld/ringworld_logic.h
+++ b/engines/tsage/ringworld/ringworld_logic.h
@@ -161,7 +161,6 @@ public:
class NamedHotspot : public SceneHotspot {
public:
- int _resNum, _lookLineNum, _useLineNum, _talkLineNum;
NamedHotspot();
virtual void doAction(int action);
diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp
index 0844a48ed8..470cdab10c 100644
--- a/engines/tsage/ringworld2/ringworld2_logic.cpp
+++ b/engines/tsage/ringworld2/ringworld2_logic.cpp
@@ -303,7 +303,7 @@ void SceneExt::loadScene(int sceneNum) {
}
}
-bool SceneExt::display(CursorType action) {
+bool SceneExt::display(CursorType action, Event &event) {
switch (action) {
case CURSOR_CROSSHAIRS:
return false;
@@ -316,10 +316,41 @@ bool SceneExt::display(CursorType action) {
case CURSOR_TALK:
SceneItem::display2(1, R2_GLOBALS._randomSource.getRandomNumber(4) + 10);
break;
+ case R2_NEGATOR_GUN:
+ if (R2_GLOBALS.getFlag(1))
+ SceneItem::display2(2, action);
+ else
+ SceneItem::display2(5, 0);
+ break;
+ case R2_7:
+ if ((R2_GLOBALS._v565F1[1] == 2) || ((R2_GLOBALS._v565F1[1] == 1) &&
+ (R2_GLOBALS._v565F1[2] == 2) && (R2_GLOBALS._sceneManager._previousScene == 300))) {
+ R2_GLOBALS._sound4.stop();
+ R2_GLOBALS._sound3.play(46);
+ SceneItem::display2(5, 15);
+ } else {
+ R2_GLOBALS._sound3.play(43, 0);
+ SceneItem::display2(2, 0);
+ }
+
+ R2_GLOBALS._sound4.play(45);
+ break;
+ case R2_9:
+ case R2_39:
+ R2_GLOBALS._sound3.play(44);
+ SceneItem::display2(2, action);
+ R2_GLOBALS._sound3.stop();
+ break;
+ case R2_44:
+ R2_GLOBALS._sound3.play(99);
+ SceneItem::display2(2, action);
+ break;
default:
- return false;
+ SceneItem::display2(2, action);
+ break;
}
+ event.handled = true;
return true;
}
@@ -840,68 +871,6 @@ bool NamedHotspot::startAction(CursorType action, Event &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);
-}
-
void SceneActor::postInit(SceneObjectList *OwnerList) {
_lookLineNum = _talkLineNum = _useLineNum = -1;
SceneObject::postInit();
@@ -943,7 +912,7 @@ bool SceneActor::startAction(CursorType action, Event &event) {
}
if (!handled)
- handled = ((SceneExt *)R2_GLOBALS._sceneManager._scene)->display(action);
+ handled = ((SceneExt *)R2_GLOBALS._sceneManager._scene)->display(action, event);
return handled;
}
diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h
index 9eaa1b0cd1..67346bcc80 100644
--- a/engines/tsage/ringworld2/ringworld2_logic.h
+++ b/engines/tsage/ringworld2/ringworld2_logic.h
@@ -102,7 +102,7 @@ public:
virtual void refreshBackground(int xAmount, int yAmount);
virtual void saveCharacter(int characterIndex);
- bool display(CursorType action);
+ bool display(CursorType action, Event &event);
void fadeOut();
void clearScreen();
};
@@ -233,15 +233,10 @@ public:
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 = 0);
};
class NamedHotspotExt : public NamedHotspot {
diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp
index 8ea83a2527..5b1e05ebc8 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp
@@ -233,8 +233,7 @@ bool Scene3125::Item1::startAction(CursorType action, Event &event) {
SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
break;
default:
- warning("scene->display() called with two parameters");
- return scene->display(action);
+ return scene->display(action, event);
break;
}
@@ -822,8 +821,8 @@ bool Scene3175::Item1::startAction(CursorType action, Event &event) {
default:
break;
}
- warning("scene->display() called with two parameters");
- return scene->display(action);
+
+ return scene->display(action, event);
}
bool Scene3175::Actor3::startAction(CursorType action, Event &event) {
@@ -852,7 +851,7 @@ bool Scene3175::Actor3::startAction(CursorType action, Event &event) {
break;
}
warning("scene->display() called with two parameters");
- return scene->display(action);
+ return scene->display(action, event);
}
bool Scene3175::Actor1::startAction(CursorType action, Event &event) {