aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage
diff options
context:
space:
mode:
authorStrangerke2012-01-22 11:50:15 +0100
committerStrangerke2012-01-22 11:50:15 +0100
commit888c341c7a5738ef8cfd838ab711d864f4ebd0c3 (patch)
tree3c5e981b2356233f8b2ef92c0c5a4fa44351b4cc /engines/tsage
parent4e118ccf98e3cc442636da3dddaf965e587ccf15 (diff)
downloadscummvm-rg350-888c341c7a5738ef8cfd838ab711d864f4ebd0c3.tar.gz
scummvm-rg350-888c341c7a5738ef8cfd838ab711d864f4ebd0c3.tar.bz2
scummvm-rg350-888c341c7a5738ef8cfd838ab711d864f4ebd0c3.zip
TSAGE: R2R - Implement scene 1925
Diffstat (limited to 'engines/tsage')
-rw-r--r--engines/tsage/globals.cpp4
-rw-r--r--engines/tsage/globals.h2
-rw-r--r--engines/tsage/ringworld2/ringworld2_logic.cpp1
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes1.cpp324
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes1.h49
5 files changed, 375 insertions, 5 deletions
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index f0f02d4acb..1c2b83c81b 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -408,7 +408,7 @@ void Ringworld2Globals::reset() {
_v566AB[i] = 0;
_v56A93 = -1;
_v56A99 = 5;
- _v56A9C = 0;
+ _scene1925CurrLevel = 0; //_v56A9C
_v56A9E = 0;
_v56AA0 = 0;
_v56AA1 = 0;
@@ -462,7 +462,7 @@ void Ringworld2Globals::synchronize(Serializer &s) {
s.syncAsSint16LE(_v566A3);
s.syncAsSint16LE(_v566A6);
s.syncAsSint16LE(_v56A93);
- s.syncAsSint16LE(_v56A9C);
+ s.syncAsSint16LE(_scene1925CurrLevel); // _v56A9C
s.syncAsSint16LE(_v56A9E);
s.syncAsSint16LE(_v56AA2);
s.syncAsSint16LE(_v56AA4);
diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h
index b9babde131..c4ab3e695c 100644
--- a/engines/tsage/globals.h
+++ b/engines/tsage/globals.h
@@ -270,7 +270,7 @@ public:
byte _v566AB[1000];
int _v56A93;
byte _v56A99;
- int _v56A9C;
+ int _scene1925CurrLevel; //_v56A9C
int _v56A9E;
byte _v56AA0;
byte _v56AA1;
diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp
index d81672807a..21fd638870 100644
--- a/engines/tsage/ringworld2/ringworld2_logic.cpp
+++ b/engines/tsage/ringworld2/ringworld2_logic.cpp
@@ -142,6 +142,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) {
case 1900:
return new Scene1900();
case 1925:
+ return new Scene1925();
case 1945:
case 1950:
error("Missing scene %d from group 1", sceneNumber);
diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
index 18ca3b060d..58f5a31f17 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
@@ -6601,7 +6601,7 @@ void Scene1900::signal() {
_actor1.setAction(&_sequenceManager2, this, 1910, &_actor1, NULL);
break;
case 1904:
- R2_GLOBALS._v56A9C = -3;
+ R2_GLOBALS._scene1925CurrLevel = -3;
// No break on purpose
case 1905:
R2_GLOBALS._player.disableControl(CURSOR_ARROW);
@@ -6615,7 +6615,7 @@ void Scene1900::signal() {
R2_GLOBALS._sceneManager.changeScene(2450);
break;
case 1906:
- R2_GLOBALS._v56A9C = -3;
+ R2_GLOBALS._scene1925CurrLevel = -3;
// No break on purpose
default:
R2_GLOBALS._player.enableControl();
@@ -6623,5 +6623,325 @@ void Scene1900::signal() {
}
}
+/*--------------------------------------------------------------------------
+ * Scene 1925 -
+ *
+ *--------------------------------------------------------------------------*/
+Scene1925::Scene1925() {
+ _field9B8 = 0;
+ for (int i = 0; i < 5; i++)
+ _levelResNum[i] = 0;
+}
+
+void Scene1925::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_field9B8);
+ for (int i = 0; i < 5; i++)
+ s.syncAsSint16LE(_levelResNum[i]);
+}
+
+bool Scene1925::Hotspot2::startAction(CursorType action, Event &event) {
+ Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action != CURSOR_USE)
+ return SceneHotspot::startAction(action, event);
+
+ if ((R2_GLOBALS._player._position.x == 110) && (R2_GLOBALS._player._position.y == 100))
+ return SceneHotspot::startAction(action, event);
+
+ if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 20))
+ scene->_sceneMode = 1928;
+ else if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 200))
+ scene->_sceneMode = 1929;
+ else
+ scene->_sceneMode = 1930;
+
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL);
+ return true;
+}
+
+bool Scene1925::Hotspot3::startAction(CursorType action, Event &event) {
+ if ((!R2_GLOBALS.getFlag(29)) || (action != CURSOR_USE))
+ return SceneHotspot::startAction(action, event);
+
+ Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl(CURSOR_USE);
+ scene->_sceneMode = 0;
+
+ if ((R2_GLOBALS._player._position.x == 110) && (R2_GLOBALS._player._position.y == 100)) {
+ scene->_exit3._enabled = false;
+ scene->_sceneMode = 1925;
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL);
+ return true;
+ }
+
+ if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 20) && (event.mousePos.y >= 30)) {
+ scene->_sceneMode = 1931;
+ } else if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 200) && (event.mousePos.y < 140)) {
+ scene->_sceneMode = 1932;
+ } else if ( ( ((R2_GLOBALS._player._position.x == 112) && (R2_GLOBALS._player._position.y == 101))
+ || ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 110))
+ ) && (event.mousePos.y >= 100)) {
+ scene->_sceneMode = 1926;
+ } else if ( ( ((R2_GLOBALS._player._position.x == 112) && (R2_GLOBALS._player._position.y == 101))
+ || ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 110))
+ ) && (event.mousePos.y < 60)) {
+ scene->_sceneMode = 1927;
+ } else {
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ }
+
+ if (scene->_sceneMode != 0)
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
+
+ return true;
+}
+
+void Scene1925::Exit1::changeScene() {
+ Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene;
+
+ _moving = false;
+ R2_GLOBALS._player.disableControl(CURSOR_USE);
+ scene->_sceneMode = 0;
+
+ if ((R2_GLOBALS._player._position.x == 110) && (R2_GLOBALS._player._position.y == 100)) {
+ scene->_exit3._enabled = false;
+ scene->_field9B8 = 1927;
+ scene->_sceneMode = 1925;
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL);
+ return;
+ }
+
+ if ( ((R2_GLOBALS._player._position.x == 112) && (R2_GLOBALS._player._position.y == 101))
+ || ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 110))) {
+ scene->_sceneMode = 1927;
+ } else if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 200)) {
+ scene->_sceneMode = 1932;
+ }
+
+ if (scene->_sceneMode == 0)
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
+ else {
+ scene->_sceneMode = 1932;
+ scene->signal();
+ }
+}
+
+void Scene1925::Exit2::changeScene() {
+ Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene;
+
+ _moving = false;
+ R2_GLOBALS._player.disableControl(CURSOR_USE);
+ scene->_sceneMode = 0;
+
+ if ((R2_GLOBALS._player._position.x == 110) && (R2_GLOBALS._player._position.y == 100)) {
+ scene->_exit3._enabled = false;
+ scene->_field9B8 = 1926;
+ scene->_sceneMode = 1925;
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL);
+ return;
+ }
+
+ if ( ((R2_GLOBALS._player._position.x == 112) && (R2_GLOBALS._player._position.y == 101))
+ || ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 110))) {
+ scene->_sceneMode = 1926;
+ } else if ((R2_GLOBALS._player._position.x == 154) && (R2_GLOBALS._player._position.y == 20)) {
+ scene->_sceneMode = 1931;
+ }
+
+ if (scene->_sceneMode == 0) {
+ scene->_sceneMode = 1931;
+ scene->signal();
+ } else
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
+}
+
+void Scene1925::Exit3::changeScene() {
+ Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene;
+
+ _moving = false;
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ scene->_sceneMode = 1921;
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
+}
+
+void Scene1925::Exit4::changeScene() {
+ Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene;
+
+ _moving = false;
+ R2_GLOBALS._player.disableControl(CURSOR_ARROW);
+ scene->_sceneMode = 1920;
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
+}
+
+void Scene1925::changeLevel(bool upFlag) {
+ if (R2_GLOBALS._scene1925CurrLevel <= 0)
+ R2_GLOBALS._scene1925CurrLevel = 3;
+
+ if (upFlag) {
+ R2_GLOBALS._player.setup(1925, 1, 1);
+ R2_GLOBALS._player.setPosition(Common::Point(154, 200));
+ ++R2_GLOBALS._scene1925CurrLevel;
+ } else {
+ R2_GLOBALS._player.setup(1925, 1, 1);
+ R2_GLOBALS._player.setPosition(Common::Point(154, 20));
+ R2_GLOBALS._scene1925CurrLevel--;
+ }
+
+ switch (R2_GLOBALS._scene1925CurrLevel) {
+ case -1:
+ R2_GLOBALS._sceneManager.changeScene(1945);
+ return;
+ break;
+ case 3:
+ loadScene(_levelResNum[4]);
+ _item2.setDetails(Rect(133, 68, 140, 77), 1925, 3, -1, 5, 2, NULL);
+ _actor1.setDetails(1925, 0, 1, 2, 2, (SceneItem *) NULL);
+ _actor1.show();
+ break;
+ case 512:
+ R2_GLOBALS._scene1925CurrLevel = 508;
+ // No break on purpose
+ default:
+ loadScene(_levelResNum[(R2_GLOBALS._scene1925CurrLevel % 4)]);
+ R2_GLOBALS._sceneItems.remove(&_item2);
+ R2_GLOBALS._sceneItems.remove(&_actor1);
+ _actor1.hide();
+ break;
+ }
+
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+}
+
+void Scene1925::postInit(SceneObjectList *OwnerList) {
+ _levelResNum[0] = 1930;
+ _levelResNum[1] = 1935;
+ _levelResNum[2] = 1940;
+ _levelResNum[3] = 1935;
+ _levelResNum[4] = 1925;
+
+ if (R2_GLOBALS.getFlag(29)) {
+ if ((R2_GLOBALS._scene1925CurrLevel == -3) || (R2_GLOBALS._scene1925CurrLevel == 3))
+ loadScene(_levelResNum[4]);
+ else
+ loadScene(_levelResNum[R2_GLOBALS._scene1925CurrLevel % 4]);
+ } else {
+ R2_GLOBALS._scene1925CurrLevel = -2;
+ loadScene(1920);
+ }
+ SceneExt::postInit();
+ R2_GLOBALS._sound1.play(220);
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._player._characterScene[2] = 1925;
+ R2_GLOBALS._player._characterIndex = R2_SEEKER;
+ switch (R2_GLOBALS._scene1925CurrLevel) {
+ case -2:
+ _exit4.setDetails(Rect(203, 44, 247, 111), EXITCURSOR_E, 1925);
+ _item3.setDetails(Rect(31, 3, 45, 167), 1925, 6, -1, 8, 1, NULL);
+ break;
+ case 3:
+ _actor1.setDetails(1925, 0, 1, 2, 1, (SceneItem *) NULL);
+ _item2.setDetails(Rect(133, 68, 140, 77), 1925, 3, -1, 5, 1, NULL);
+ // No break on purpose
+ case -3:
+ _exit3.setDetails(Rect(83, 38, 128, 101), EXITCURSOR_W, 1925);
+ // No break on purpose
+ default:
+ _exit1.setDetails(Rect(128, 0, 186, 10), EXITCURSOR_N, 1925);
+ _exit2.setDetails(Rect(128, 160, 190, 167), EXITCURSOR_S, 1925);
+ _item3.setDetails(Rect(141, 11, 167, 159), 1925, 6, -1, -1, 1, NULL);
+ break;
+ }
+
+ _actor1.postInit();
+ _actor1.setup(1925, 5, 1);
+ _actor1.setPosition(Common::Point(128, 35));
+ _actor1.hide();
+
+ if (R2_GLOBALS._scene1925CurrLevel == 3)
+ _actor1.show();
+
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ switch (R2_GLOBALS._scene1925CurrLevel) {
+ case -2:
+ R2_GLOBALS._player.setup(20, 6, 1);
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._player.setPosition(Common::Point(224, 109));
+ break;
+ case -3:
+ _actor1.hide();
+ R2_GLOBALS._player.setup(20, 5, 1);
+ R2_GLOBALS._player.setPosition(Common::Point(110, 100));
+ break;
+ case 0:
+ R2_GLOBALS._player.setup(1925, 1, 1);
+ R2_GLOBALS._player.setPosition(Common::Point(154, 200));
+ break;
+ default:
+ R2_GLOBALS._player.setup(1925, 1, 3);
+ R2_GLOBALS._player.setPosition(Common::Point(154, 110));
+ break;
+ }
+
+ R2_GLOBALS._player._canWalk = false;
+ _field9B8 = 0;
+ R2_GLOBALS._sceneManager._previousScene = 1925;
+ _item1.setDetails(Rect(27, 0, 292, 200), 1925, 9, -1, -1, 1, NULL);
+}
+
+void Scene1925::remove() {
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+ R2_GLOBALS._player._oldCharacterScene[2] = 1925;
+ SceneExt::remove();
+}
+
+void Scene1925::signal() {
+ switch (_sceneMode) {
+ case 1920:
+ // No break on purpose
+ case 1921:
+ // No break on purpose
+ case 1928:
+ // No break on purpose
+ case 1929:
+ // No break on purpose
+ case 1930:
+ R2_GLOBALS._scene1925CurrLevel = -3;
+ R2_GLOBALS._sceneManager.changeScene(1900);
+ break;
+ case 1926:
+ // No break on purpose
+ case 1931:
+ // Change level, down
+ changeLevel(false);
+ break;
+ case 1927:
+ // No break on purpose
+ case 1932:
+ // Change level, up
+ changeLevel(true);
+ break;
+ case 1925:
+ _exit3._enabled = false;
+ if (_field9B8 != 0) {
+ _sceneMode = _field9B8;
+ _field9B8 = 0;
+ setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ }
+ // No break on purpose
+ default:
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ break;
+ }
+
+ R2_GLOBALS._player._canWalk = false;
+}
+
} // End of namespace Ringworld2
} // End of namespace TsAGE
diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h
index 66c3371410..df6789efbd 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.h
@@ -699,6 +699,55 @@ public:
virtual void remove();
virtual void signal();
};
+
+class Scene1925 : public SceneExt {
+ class Hotspot2 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Hotspot3 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Exit1 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit2 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit3 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit4 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+public:
+ NamedHotspot _item1;
+ Hotspot2 _item2;
+ Hotspot3 _item3;
+ SceneActor _actor1;
+ Exit1 _exit1;
+ Exit2 _exit2;
+ Exit3 _exit3;
+ Exit4 _exit4;
+ SequenceManager _sequenceManager;
+
+ int _field9B8;
+ int _levelResNum[5];
+
+ Scene1925();
+ void synchronize(Serializer &s);
+
+ void changeLevel(bool upFlag);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+};
} // End of namespace Ringworld2
} // End of namespace TsAGE