aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage
diff options
context:
space:
mode:
authorPaul Gilbert2011-10-30 19:47:51 +1100
committerPaul Gilbert2011-10-30 19:47:51 +1100
commit7ec4052c1b0ef9a83c4bb79b7d9fccc701fd0046 (patch)
treeb5f898e08bd0a4b6c64e5ec0d79c722419b1f79d /engines/tsage
parent7bc23905143f11f44ea8b566dbafa20cddbcdf9b (diff)
downloadscummvm-rg350-7ec4052c1b0ef9a83c4bb79b7d9fccc701fd0046.tar.gz
scummvm-rg350-7ec4052c1b0ef9a83c4bb79b7d9fccc701fd0046.tar.bz2
scummvm-rg350-7ec4052c1b0ef9a83c4bb79b7d9fccc701fd0046.zip
TSAGE: In progress implementation of R2RW scene 125 - Console
Diffstat (limited to 'engines/tsage')
-rw-r--r--engines/tsage/core.cpp23
-rw-r--r--engines/tsage/core.h10
-rw-r--r--engines/tsage/events.h4
-rw-r--r--engines/tsage/globals.cpp11
-rw-r--r--engines/tsage/globals.h5
-rw-r--r--engines/tsage/ringworld2/ringworld2_logic.cpp5
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes0.cpp767
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes0.h56
-rw-r--r--engines/tsage/sound.h9
-rw-r--r--engines/tsage/staticres.cpp13
-rw-r--r--engines/tsage/staticres.h7
11 files changed, 907 insertions, 3 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index da8450e499..7ad4eff585 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -2929,6 +2929,16 @@ Player::Player(): SceneObject() {
_enabled = false;
_uiEnabled = false;
_field8C = 0;
+
+ // Return to Ringworld specific fields
+ _characterIndex = 0;
+ _oldSceneNumber = 0;
+
+ for (int i = 0; i < MAX_CHARACTERS; ++i) {
+ _characterScene[i] = 0;
+ _characterStrip[i] = 0;
+ _characterFrame[i] = 0;
+ }
}
void Player::postInit(SceneObjectList *OwnerList) {
@@ -3017,6 +3027,19 @@ void Player::synchronize(Serializer &s) {
if (g_vm->getGameID() != GType_Ringworld)
s.syncAsByte(_enabled);
+
+ if (g_vm->getGameID() == GType_Ringworld2) {
+ s.syncAsSint16LE(_characterIndex);
+ s.syncAsSint16LE(_oldSceneNumber);
+
+ for (int i = 0; i < MAX_CHARACTERS; ++i) {
+ s.syncAsSint16LE(_characterScene[i]);
+ s.syncAsSint16LE(_characterPos[i].x);
+ s.syncAsSint16LE(_characterPos[i].y);
+ s.syncAsSint16LE(_characterStrip[i]);
+ s.syncAsSint16LE(_characterFrame[i]);
+ }
+ }
}
/*--------------------------------------------------------------------------*/
diff --git a/engines/tsage/core.h b/engines/tsage/core.h
index f8c4bd5161..b553db67d9 100644
--- a/engines/tsage/core.h
+++ b/engines/tsage/core.h
@@ -616,12 +616,22 @@ public:
virtual void updateScreen();
};
+#define MAX_CHARACTERS 4
+
class Player : public SceneObject {
public:
bool _canWalk;
bool _uiEnabled;
int _field8C;
bool _enabled;
+
+ // Return to Ringworld specific fields
+ int _characterIndex;
+ int _oldSceneNumber;
+ int _characterScene[MAX_CHARACTERS];
+ Common::Point _characterPos[MAX_CHARACTERS];
+ int _characterStrip[MAX_CHARACTERS];
+ int _characterFrame[MAX_CHARACTERS];
public:
Player();
diff --git a/engines/tsage/events.h b/engines/tsage/events.h
index 67d56ceb87..2ffa862ca6 100644
--- a/engines/tsage/events.h
+++ b/engines/tsage/events.h
@@ -83,8 +83,8 @@ enum CursorType {
INV_CARAVAN_KEY = 67, BF_LAST_INVENT = 68,
// Ringworld 2 objects
- R2_1 = 1, R2_2 = 2, R2_NEGATOR_GUN = 3, R2_STEPPING_DISKS = 4, R2_5 = 5, R2_6 = 6, R2_7 = 7,
- R2_8 = 8, R2_9 = 9, R2_10 = 10, R2_11 = 11, R2_12 = 12, R2_13 = 13, R2_14 = 14,
+ R2_OPTO_DISK = 1, R2_2 = 2, R2_NEGATOR_GUN = 3, R2_STEPPING_DISKS = 4, R2_5 = 5, R2_6 = 6,
+ R2_7 = 7, R2_8 = 8, R2_9 = 9, R2_10 = 10, R2_11 = 11, R2_12 = 12, R2_13 = 13, R2_14 = 14,
R2_15 = 15, R2_16 = 16, R2_17 = 17, R2_18 = 18, R2_19 = 19, R2_20 = 20, R2_21 = 21,
R2_22 = 22, R2_23 = 23, R2_24 = 24, R2_25 = 25, R2_26 = 26, R2_27 = 27, R2_28 = 28,
R2_29 = 29, R2_30 = 30, R2_31 = 31, R2_32 = 32, R2_33 = 33, R2_34 = 34, R2_35 = 35,
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index 9bae180bc6..5baf7b7041 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -367,10 +367,21 @@ void Ringworld2Globals::reset() {
R2_INVENTORY.reset();
T2_GLOBALS._uiElements.updateInventory();
T2_GLOBALS._uiElements._active = false;
+
+ // Reset fields
+ _v5657C = 0;
+ _v565F5 = 0;
+ _diskScene = 0;
+ _v57C2C = 0;
}
void Ringworld2Globals::synchronize(Serializer &s) {
TsAGE2Globals::synchronize(s);
+
+ s.syncAsSint16LE(_v5657C);
+ s.syncAsSint16LE(_v565F5);
+ s.syncAsSint16LE(_diskScene);
+ s.syncAsSint16LE(_v57C2C);
}
} // end of namespace Ringworld2
diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h
index 1e50c08f56..14cf590f38 100644
--- a/engines/tsage/globals.h
+++ b/engines/tsage/globals.h
@@ -243,6 +243,11 @@ namespace Ringworld2 {
class Ringworld2Globals: public TsAGE2Globals {
public:
ASoundExt _sound1, _sound2, _sound3, _sound4;
+ PlayStream _playStream;
+ int _diskScene;
+ int _v565F5;
+ int _v5657C;
+ int _v57C2C;
virtual void reset();
virtual void synchronize(Serializer &s);
diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp
index d033627ae9..f9ac2efcbf 100644
--- a/engines/tsage/ringworld2/ringworld2_logic.cpp
+++ b/engines/tsage/ringworld2/ringworld2_logic.cpp
@@ -38,6 +38,9 @@ Scene *Ringworld2Game::createScene(int sceneNumber) {
// Quinn's room
case 100: return new Scene100();
+ // Computer console
+ case 125: return new Scene125();
+
default:
error("Unknown scene number - %d", sceneNumber);
break;
@@ -398,7 +401,7 @@ void Ringworld2InvObjectList::reset() {
}
// Set up default inventory
- setObjectScene(R2_1, 800);
+ setObjectScene(R2_OPTO_DISK, 800);
setObjectScene(R2_2, 400);
setObjectScene(R2_NEGATOR_GUN, 100);
setObjectScene(R2_STEPPING_DISKS, 100);
diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp
index a2fb011d23..c03005ba8f 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp
@@ -346,6 +346,773 @@ void Scene100::dispatch() {
}
}
+/*--------------------------------------------------------------------------
+ * Scene 125 - Computer Terminal
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene125::Object5::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_USE)
+ return true;
+ else
+ return SceneActor::startAction(action, event);
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene125::Icon::postInit(SceneObjectList *OwnerList) {
+ SceneObject::postInit();
+ _lookLineNum = 0;
+ _pressed = false;
+
+ _object1.postInit();
+ _object1.hide();
+
+ _sceneText1._color1 = 92;
+ _sceneText1._color2 = 0;
+ _sceneText1._width = 200;
+ _sceneText2._color1 = 0;
+ _sceneText2._color2 = 0;
+ _sceneText2._width = 200;
+ setDetails(125, -1, -1, -1, 2, NULL);
+}
+
+void Scene125::Icon::synchronize(Serializer &s) {
+ SceneActor::synchronize(s);
+ s.syncAsSint16LE(_lookLineNum);
+ s.syncAsSint16LE(_field98);
+ s.syncAsSint16LE(_pressed);
+}
+
+void Scene125::Icon::process(Event &event) {
+ Scene125 *scene = (Scene125 *)R2_GLOBALS._sceneManager._scene;
+
+ if (!event.handled && !(_flags & OBJFLAG_HIDING) && R2_GLOBALS._player._uiEnabled &&
+ (event.eventType == EVENT_BUTTON_DOWN)) {
+
+ int regionIndex = R2_GLOBALS._sceneRegions.indexOf(event.mousePos);
+
+ switch (R2_GLOBALS._events.getCursor()) {
+ case CURSOR_LOOK:
+ if (regionIndex == _sceneRegionId) {
+ event.handled = true;
+ if (_lookLineNum == 26) {
+ SceneItem::display2(130, 7);
+ } else {
+ SceneItem::display2(130, _lookLineNum);
+ }
+ }
+ break;
+
+ case CURSOR_USE:
+ if ((regionIndex == _sceneRegionId) && !_pressed) {
+ scene->_sound1.play(14);
+ setFrame(2);
+
+ switch (_object1._strip) {
+ case 1:
+ _object1.setStrip(2);
+ break;
+ case 3:
+ _object1.setStrip(4);
+ break;
+ case 5:
+ _object1.setStrip(6);
+ break;
+ default:
+ break;
+ }
+
+ _pressed = true;
+ event.handled = true;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if ((event.eventType == EVENT_BUTTON_UP) && _pressed) {
+ switch (_object1._strip) {
+ case 2:
+ _object1.setStrip(1);
+ break;
+ case 4:
+ _object1.setStrip(3);
+ break;
+ case 6:
+ _object1.setStrip(5);
+ break;
+ default:
+ break;
+ }
+
+ _pressed = false;
+ event.handled = true;
+ scene->consoleAction(_lookLineNum);
+ }
+ }
+}
+
+void Scene125::Icon::setIcon(int id) {
+ Scene125 *scene = (Scene125 *)R2_GLOBALS._sceneManager._scene;
+
+ _lookLineNum = _field98 = id;
+ SceneActor::_lookLineNum = id;
+
+ _sceneText1.remove();
+ _sceneText2.remove();
+
+ if (_lookLineNum) {
+ showIcon();
+ _object1.setup(161, ((id - 1) / 10) * 2 + 1, ((id - 1) % 10) + 1);
+ _object1.setPosition(_position);
+
+ _sceneText1._fontNumber = scene->_iconFontNumber;
+ _sceneText1.setup(CONSOLE_MESSAGES[id]);
+ _sceneText1.fixPriority(20);
+
+ _sceneText2._fontNumber = scene->_iconFontNumber;
+ _sceneText2.setup(CONSOLE_MESSAGES[id]);
+ _sceneText2.fixPriority(20);
+
+ _sceneText2._fontNumber = scene->_iconFontNumber;
+ _sceneText2.setup(CONSOLE_MESSAGES[id]);
+ _sceneText2.fixPriority(10);
+
+ switch (_lookLineNum) {
+ case 5:
+ _sceneText1.setPosition(Common::Point(62, _position.y + 8));
+ _sceneText2.setPosition(Common::Point(64, _position.y + 10));
+ break;
+ case 6:
+ case 7:
+ case 24:
+ case 25:
+ _sceneText1.setPosition(Common::Point(65, _position.y + 8));
+ _sceneText2.setPosition(Common::Point(67, _position.y + 10));
+ break;
+ case 26:
+ _sceneText1.setPosition(Common::Point(83, _position.y + 8));
+ _sceneText2.setPosition(Common::Point(85, _position.y + 10));
+ break;
+ default:
+ _sceneText1.setPosition(Common::Point(121, _position.y + 8));
+ _sceneText2.setPosition(Common::Point(123, _position.y + 10));
+ break;
+ }
+ } else {
+ hideIcon();
+ }
+}
+
+void Scene125::Icon::showIcon() {
+ _sceneText1.show();
+ _sceneText2.show();
+ _object1.show();
+ _object2.show();
+ show();
+}
+
+void Scene125::Icon::hideIcon() {
+ _sceneText1.hide();
+ _sceneText2.hide();
+ _object1.hide();
+ _object2.hide();
+ hide();
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene125::Item4::startAction(CursorType action, Event &event) {
+ Scene125 *scene = (Scene125 *)R2_GLOBALS._sceneManager._scene;
+ switch (action) {
+ case CURSOR_USE:
+ if (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == R2_GLOBALS._diskScene) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 126;
+ scene->setAction(&scene->_sequenceManager, scene, 126, &scene->_object7, NULL);
+ return true;
+ }
+ break;
+ case R2_OPTO_DISK:
+ if (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == 1) {
+ R2_GLOBALS._player.disableControl();
+ scene->_object7.postInit();
+ scene->_sceneMode = 125;
+ scene->setAction(&scene->_sequenceManager, scene, 125, &scene->_object7, NULL);
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return SceneHotspot::startAction(action, event);
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene125::Scene125(): SceneExt() {
+ _soundCount = _soundIndex = 0;
+ _iconFontNumber = 50;
+ _field412 = 5;
+}
+
+void Scene125::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(160);
+ _palette.loadPalette(0);
+
+ if (R2_GLOBALS._v5657C == 125)
+ R2_GLOBALS._diskScene = R2_GLOBALS._sceneManager._previousScene;
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.hide();
+ R2_GLOBALS._player.disableControl();
+
+ if (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == R2_GLOBALS._diskScene) {
+ _object7.postInit();
+ _object7.setup(160, 3, 5);
+ _object7.setPosition(Common::Point(47, 167));
+ }
+
+ _object6.postInit();
+ _object6.setup(162, 1, 1);
+ _object6.setPosition(Common::Point(214, 168));
+
+ _item4.setDetails(Rect(27, 145, 81, 159), 126, 9, -1, -1, 1, NULL);
+ _item3.setDetails(Rect(144, 119, 286, 167), 126, 6, 7, 8, 1, NULL);
+ _item2.setDetails(1, 126, 3, 4, 5);
+ _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 126, 0, 1, -1, 1, NULL);
+
+ _sceneMode = 1;
+ signal();
+}
+
+void Scene125::signal() {
+ switch (_sceneMode) {
+ case 1:
+ _icon1.postInit();
+ _icon1._sceneRegionId = 2;
+ _icon2.postInit();
+ _icon2._sceneRegionId = 3;
+ _icon3.postInit();
+ _icon3._sceneRegionId = 4;
+ _icon4.postInit();
+ _icon4._sceneRegionId = 5;
+
+ setAction(&_sequenceManager, this, 127, &_icon1, &_icon2, &_icon3, &_icon4, &R2_GLOBALS._player, NULL);
+ break;
+ case 2:
+ _icon1.setup(160, 1, 1);
+ _icon1.setPosition(Common::Point(65, 17));
+ _icon1._object2.postInit();
+ _icon1._object2.setup(160, 7, 1);
+ _icon1._object2.setPosition(Common::Point(106, 41));
+
+ _icon2.setup(160, 1, 1);
+ _icon2.setPosition(Common::Point(80, 32));
+ _icon2._object2.postInit();
+ _icon2._object2.setup(160, 7, 2);
+ _icon2._object2.setPosition(Common::Point(106, 56));
+
+ _icon3.setup(160, 1, 1);
+ _icon3.setPosition(Common::Point(65, 47));
+ _icon3._object2.postInit();
+ _icon3._object2.setup(160, 7, 1);
+ _icon3._object2.setPosition(Common::Point(106, 71));
+
+ _icon4.setup(160, 1, 1);
+ _icon4.setPosition(Common::Point(80, 62));
+ _icon4._sceneRegionId = 5;
+ _icon4._object2.postInit();
+ _icon4._object2.setup(160, 7, 2);
+ _icon4._object2.setPosition(Common::Point(106, 86));
+
+ _icon5.postInit();
+ _icon5.setup(160, 1, 1);
+ _icon5.setPosition(Common::Point(37, 92));
+ _icon5.setIcon(6);
+ _icon5._sceneRegionId = 7;
+
+ _icon6.postInit();
+ _icon6.setPosition(Common::Point(106, 110));
+ _icon6.setIcon(5);
+ _icon6._sceneRegionId = 8;
+
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ case 10:
+ switch (_field412) {
+ case 12:
+ _sceneMode = 129;
+
+ _object1.postInit();
+ _object2.postInit();
+ _object3.postInit();
+
+ if (R2_GLOBALS.getFlag(13)) {
+ _object4.postInit();
+ setAction(&_sequenceManager, this, 130, &R2_GLOBALS._player, &_object1, &_object2,
+ &_object3, &_object4, NULL);
+ } else {
+ setAction(&_sequenceManager, this, 129, &R2_GLOBALS._player, &_object1, &_object2, &_object3, NULL);
+ }
+ break;
+ case 13:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ _field41A = 0;
+ setDetails(129, 0);
+ break;
+ case 23:
+ R2_GLOBALS._sceneManager.changeScene(1330);
+ break;
+ case 27:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ _field418 = 0;
+ setDetails(128, 0);
+ break;
+ case 28:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ _field418 = 37;
+ setDetails(128, 37);
+ break;
+ case 29:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ _field418 = 68;
+ setDetails(128, 68);
+ break;
+ case 30:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ _field418 = 105;
+ setDetails(128, 105);
+ break;
+ default:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ _field416 = 0;
+ setDetails(127, 0);
+ break;
+ }
+ break;
+ case 11:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+
+ if ((_field412 >= 27) && (_field412 <= 30)) {
+ consoleAction(11);
+ }
+ consoleAction(2);
+ _icon6.setIcon(5);
+ break;
+ case 12:
+ if (_soundCount > 0)
+ --_soundCount;
+ if (!_soundCount || (R2_GLOBALS._v57C2C == 2)) {
+ _soundIndex = 0;
+ R2_GLOBALS._playStream.stop();
+ } else {
+ _sceneMode = 12;
+ R2_GLOBALS._playStream.play(_soundIndexes[_soundIndex++], this);
+ }
+ break;
+ case 125:
+ warning("TODO: Scene125::signal #125");
+ break;
+ case 126:
+ R2_INVENTORY.setObjectScene(R2_OPTO_DISK, 1);
+ _object7.remove();
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ case 128:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ SceneItem::display2(126, 12);
+ break;
+ default:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ }
+}
+
+void Scene125::synchronize(Serializer &s) {
+ error("TODO");
+}
+
+void Scene125::process(Event &event) {
+ SceneExt::process(event);
+
+ if (R2_GLOBALS._player._uiEnabled) {
+ _icon1.process(event);
+ _icon2.process(event);
+ _icon3.process(event);
+ _icon4.process(event);
+ _icon5.process(event);
+ _icon6.process(event);
+ }
+}
+
+void Scene125::dispatch() {
+ if (_soundCount)
+ R2_GLOBALS._playStream.proc1();
+
+ Scene::dispatch();
+}
+
+void Scene125::consoleAction(int id) {
+ _icon3.setIcon(0);
+ _icon4.setIcon(0);
+
+ if (id == 5)
+ _icon5.setIcon(5);
+ else {
+ switch (_field412) {
+ case 10:
+ case 12:
+ case 13:
+ case 27:
+ case 28:
+ case 29:
+ case 30:
+ break;
+ default:
+ _icon5.setIcon(7);
+ break;
+ }
+ }
+
+ switch (id) {
+ case 0:
+ _icon1.setIcon(8);
+ _icon2.setIcon(9);
+ break;
+ case 1:
+ _icon1.setIcon(10);
+ _icon2.setIcon(11);
+ _icon3.setIcon(12);
+ _icon4.setIcon(13);
+ break;
+ case 2:
+ _icon1.setIcon(15);
+ _icon2.setIcon(16);
+ _icon3.setIcon(17);
+ break;
+ case 3:
+ _icon1.setIcon(22);
+ _icon2.setIcon(23);
+ break;
+ case 5:
+ R2_GLOBALS._sceneManager.changeScene(R2_GLOBALS._player._oldSceneNumber);
+ break;
+ case 6:
+ if (_field412 == 11)
+ consoleAction(2);
+ else if (_field412 == 22)
+ consoleAction(4);
+ else
+ consoleAction(5);
+ break;
+ case 7:
+ _iconFontNumber = 50;
+ stop();
+ _icon6.setIcon(5);
+ consoleAction(1);
+ break;
+ case 8:
+ _iconFontNumber = 52;
+ stop();
+ _icon6.setIcon(5);
+ consoleAction(1);
+ break;
+ case 9:
+ R2_GLOBALS._player.disableControl();
+ consoleAction(2);
+ _icon1.hideIcon();
+ _icon2.hideIcon();
+ _icon3.hideIcon();
+ _icon5.setIcon(24);
+
+ _icon4.setPosition(Common::Point(52, 107));
+ _icon4._sceneRegionId = 9;
+ _icon4.setIcon(25);
+ _icon4._object2.hide();
+
+ _icon6.setIcon(26);
+ _sceneMode = 10;
+
+ _palette.loadPalette(161);
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this);
+ break;
+ case 10:
+ _icon1.setIcon(27);
+ _icon2.setIcon(28);
+ _icon3.setIcon(29);
+ _icon4.setIcon(30);
+ break;
+ case 11:
+ R2_GLOBALS._player.disableControl();
+ consoleAction(2);
+ _icon1.hideIcon();
+ _icon2.hideIcon();
+ _icon3.hideIcon();
+ _icon4.hideIcon();
+ _icon5.hideIcon();
+
+ _icon6.setIcon(26);
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this);
+ break;
+ case 12:
+ consoleAction(2);
+ if (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) != R2_GLOBALS._player._oldSceneNumber) {
+ SceneItem::display2(126, 17);
+ } else {
+ R2_GLOBALS._player.disableControl();
+
+ _icon1.hideIcon();
+ _icon2.hideIcon();
+ _icon3.hideIcon();
+ _icon5.setIcon(24);
+
+ _icon4.setPosition(Common::Point(52, 107));
+ _icon4._sceneRegionId = 9;
+ _icon4.setIcon(25);
+ _icon4._object2.hide();
+
+ _icon6.setIcon(26);
+ _sceneMode = 10;
+
+ _palette.loadPalette(161);
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this);
+ }
+ break;
+ case 14:
+ consoleAction(3);
+
+ if (R2_GLOBALS._v565F5 < 3) {
+ R2_GLOBALS._player.disableControl();
+ _object5.postInit();
+ _object5.setup(162, 2, 2);
+ _object5.setPosition(Common::Point(216, UI_INTERFACE_Y));
+
+ R2_GLOBALS._v565F5 += 2;
+ } else if (R2_GLOBALS._v565F5 == 3) {
+ SceneItem::display2(126, 13);
+ } else {
+ SceneItem::display2(126, 14);
+ }
+ break;
+ case 15:
+ consoleAction(3);
+
+ if (R2_GLOBALS._v565F5 < 4) {
+ R2_GLOBALS._player.disableControl();
+ _object5.postInit();
+ _object5.setup(162, 2, 3);
+ _object5.setPosition(Common::Point(218, UI_INTERFACE_Y));
+
+ ++R2_GLOBALS._v565F5;
+ } else {
+ SceneItem::display2(126, 15);
+ }
+ break;
+ case 16:
+ consoleAction(3);
+
+ if (R2_GLOBALS._v565F5 < 4) {
+ R2_GLOBALS._player.disableControl();
+ _object5.postInit();
+ _object5.setup(162, 2, 1);
+ _object5.setPosition(Common::Point(215, UI_INTERFACE_Y));
+
+ ++R2_GLOBALS._v565F5;
+ } else {
+ SceneItem::display2(126, 16);
+ }
+ break;
+ case 21:
+ _icon1.setIcon(31);
+ _icon2.setIcon(32);
+ _icon3.setIcon(33);
+ _icon4.setIcon(34);
+ break;
+ case 22:
+ R2_GLOBALS._player.disableControl();
+ consoleAction(4);
+ _icon1.hideIcon();
+ _icon2.hideIcon();
+ _icon3.hideIcon();
+ _icon4.hideIcon();
+ _icon5.hideIcon();
+ _icon6.hideIcon();
+
+ _sceneMode = 10;
+ _palette.loadPalette(161);
+ break;
+ case 23:
+ _icon4.setIcon(25);
+ _icon4._object2.hide();
+
+ if (_field412 == 10) {
+ setDetails(127, --_field416);
+ } else if (_field412 == 13) {
+ setDetails(129, --_field41A);
+ } else {
+ setDetails(128, --_field418);
+ }
+ break;
+ case 24:
+ _icon4.setIcon(25);
+ _icon4._object2.hide();
+
+ if (_field412 == 10) {
+ setDetails(127, ++_field416);
+ } else if (_field412 == 13) {
+ setDetails(129, ++_field41A);
+ } else {
+ setDetails(128, ++_field418);
+ }
+ break;
+ case 25:
+ R2_GLOBALS._player.disableControl();
+ stop();
+ _icon4.setPosition(Common::Point(80, 62));
+ _icon4._sceneRegionId = 5;
+ _icon4.hideIcon();
+
+ R2_GLOBALS._player.hide();
+ _object1.hide();
+ _object2.hide();
+ _object3.hide();
+ _object4.hide();
+
+ _sceneMode = 11;
+ _palette.loadPalette(160);
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this);
+ break;
+ case 26:
+ case 27:
+ case 28:
+ case 29:
+ R2_GLOBALS._player.disableControl();
+ consoleAction(11);
+ _field412 = id;
+
+ _icon1.hideIcon();
+ _icon2.hideIcon();
+ _icon3.hideIcon();
+ _icon4.hideIcon();
+ _icon5.setIcon(24);
+
+ _icon4.setPosition(Common::Point(52, 107));
+ _icon4._sceneRegionId = 9;
+ _icon4.setIcon(25);
+ _icon4._object2.hide();
+
+ _icon6.setIcon(26);
+ _sceneMode = 10;
+
+ _palette.loadPalette(161);
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this);
+ break;
+ case 30:
+ consoleAction(22);
+ R2_GLOBALS._sound1.play((R2_GLOBALS._sound1.getSoundNum() == 10) ? 63 : 10);
+ break;
+ case 31:
+ consoleAction(22);
+ R2_GLOBALS._sound1.play((R2_GLOBALS._sound1.getSoundNum() == 10) ? 64 : 10);
+ break;
+ case 32:
+ consoleAction(22);
+ R2_GLOBALS._sound1.play((R2_GLOBALS._sound1.getSoundNum() == 10) ? 65 : 10);
+ break;
+ case 33:
+ consoleAction(22);
+ R2_GLOBALS._sound1.play((R2_GLOBALS._sound1.getSoundNum() == 10) ? 66 : 10);
+ break;
+ default:
+ _icon1.setIcon(1);
+ _icon2.setIcon(2);
+ _icon3.setIcon(3);
+ _icon4.setIcon(4);
+ break;
+ }
+
+ if ((id != 6) && (id != 7) && (id != 23) && (id != 24))
+ _field412 = id;
+}
+
+void Scene125::setDetails(int resNum, int lineNum) {
+ stop();
+
+ Common::String msg = g_resourceManager->getMessage(resNum, lineNum);
+
+ if (msg.empty()) {
+ // Check for any specified sound numbers embedded in the message
+ Common::String msg = parseMessage(msg);
+
+ _sceneText._fontNumber = _iconFontNumber;
+ _sceneText._color1 = 92;
+ _sceneText._color2 = 0;
+ _sceneText._width = 221;
+ _sceneText.fixPriority(20);
+ _sceneText.setup(msg);
+ _sceneText.setPosition(Common::Point(49, 19));
+
+ R2_GLOBALS._sceneObjects->draw();
+
+ if ((_soundCount > 0) && (R2_GLOBALS._v57C2C != 2)) {
+ _sceneMode = 12;
+ R2_GLOBALS._playStream.play(_soundIndexes[_soundIndex], this);
+ }
+ } else {
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._player.hide();
+
+ _icon4.setPosition(Common::Point(80, 62));
+ _icon4._sceneRegionId = 5;
+ _icon4.hideIcon();
+
+ _field412 = 0;
+ _palette.loadPalette(160);
+ _sceneMode = 11;
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this);
+ }
+}
+
+void Scene125::stop() {
+ _sceneText.remove();
+ _soundIndex = 0;
+ _soundCount = 0;
+
+ R2_GLOBALS._playStream.stop();
+}
+
+Common::String Scene125::parseMessage(const Common::String &msg) {
+ _soundIndex = 0;
+ _soundCount = 0;
+
+ const char *msgP = msg.c_str();
+ while (*msgP == '!') {
+ // Get the sound number
+ _soundIndexes[_soundCount++] = atoi(++msgP);
+
+ while (!((*msgP == '\0') || (*msgP < '0') || (*msgP > '9')))
+ ++msgP;
+ }
+
+ return Common::String(msgP);
+}
+
} // End of namespace Ringworld2
} // End of namespace TsAGE
diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h
index a80bda0726..9ffe10f132 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes0.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes0.h
@@ -85,6 +85,62 @@ public:
virtual void dispatch();
};
+class Scene125: public SceneExt {
+ /* Objects */
+ class Object5: public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Icon: public SceneActor {
+ public:
+ int _lookLineNum, _field98;
+ bool _pressed;
+ SceneObject _object1, _object2;
+ SceneText _sceneText1, _sceneText2;
+
+ virtual Common::String getClassName() { return "Scene125_Icon"; }
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void synchronize(Serializer &s);
+ virtual void process(Event &event);
+
+ void setIcon(int id);
+ void showIcon();
+ void hideIcon();
+ };
+
+ /* Items */
+ class Item4: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+public:
+ ScenePalette _palette;
+ ASoundExt _sound1;
+ NamedHotspot _background, _item2, _item3;
+ Item4 _item4;
+ SceneActor _object1, _object2, _object3, _object4, _object5, _object6, _object7;
+ Icon _icon1, _icon2, _icon3, _icon4, _icon5, _icon6;
+ SequenceManager _sequenceManager;
+ SceneText _sceneText;
+ int _field412, _iconFontNumber, _field416, _field418, _field41A;
+ int _soundCount, _soundIndex;
+ int _soundIndexes[10];
+
+ Scene125();
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void synchronize(Serializer &s);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+
+ void consoleAction(int id);
+ void setDetails(int resNum, int lineNum);
+ void stop();
+ Common::String parseMessage(const Common::String &msg);
+};
+
} // End of namespace Ringworld2
} // End of namespace TsAGE
diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h
index 2c5d2ac951..3eb2432563 100644
--- a/engines/tsage/sound.h
+++ b/engines/tsage/sound.h
@@ -414,6 +414,15 @@ public:
virtual void signal();
};
+class PlayStream {
+public:
+ Sound _sound;
+
+ void setFile(const Common::String &filename) {}
+ void play(int soundNum, EventHandler *endAction) {}
+ void stop() {}
+ void proc1() {}
+};
#define ADLIB_CHANNEL_COUNT 9
diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp
index c98d9d2e53..a6e6eae84e 100644
--- a/engines/tsage/staticres.cpp
+++ b/engines/tsage/staticres.cpp
@@ -180,4 +180,17 @@ const char *THE_NEXT_DAY = "The Next Day";
} // End of namespace BlueForce
+namespace Ringworld2 {
+
+const char *CONSOLE_MESSAGES[] = {
+ NULL, "Select Language", "Computer Services", "Food Services", "Entertainment Services",
+ "Main Menu", "Exit Menu", "Previous Menu", "Interworld", "Hero's Tongue", "Personal Log",
+ "Database", "Starchart", "Iso-Opto Disk Reader", "Eject Disk", "Meals", "Snacks",
+ "Beverages", "Human Basic Snacks", "Kzin Basic Snacks", "Hot Beverages", "Cold Beverages",
+ "Music", "Outpost Alpha", " ", " ", "Done", "A-G", "H-O", "P-S", "T-Z", "Tchaikovsky",
+ "Mozart", "Bach", "Rossini"
+};
+
+} // End of namespace Ringworld2
+
} // End of namespace TsAGE
diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h
index 203fa1481d..b2c0b0f262 100644
--- a/engines/tsage/staticres.h
+++ b/engines/tsage/staticres.h
@@ -143,6 +143,13 @@ extern const char *THE_NEXT_DAY;
} // End of namespace BlueForce
+namespace Ringworld2 {
+
+// Scene 125 - Console messages
+extern const char *CONSOLE_MESSAGES[];
+
+} // End of namespace Ringworld2
+
} // End of namespace TsAGE
#endif