aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2012-01-17 00:46:13 +0100
committerStrangerke2012-01-17 00:46:13 +0100
commit63c13f91c15dd5fc5bdbf11390ce7c6f0a7cd619 (patch)
treea5922210a1ce766292eab3e83eddc57fd5fb4acd
parent4a1da069f425ac0d65d2d5d5476c1efdab8b06c2 (diff)
downloadscummvm-rg350-63c13f91c15dd5fc5bdbf11390ce7c6f0a7cd619.tar.gz
scummvm-rg350-63c13f91c15dd5fc5bdbf11390ce7c6f0a7cd619.tar.bz2
scummvm-rg350-63c13f91c15dd5fc5bdbf11390ce7c6f0a7cd619.zip
TSAGE: R2R - Partial implementation of scene 1575
-rw-r--r--engines/tsage/ringworld2/ringworld2_logic.cpp1
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes1.cpp380
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes1.h53
-rw-r--r--engines/tsage/staticres.cpp20
-rw-r--r--engines/tsage/staticres.h1
5 files changed, 455 insertions, 0 deletions
diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp
index 2f537c4ebe..1a03cffc5c 100644
--- a/engines/tsage/ringworld2/ringworld2_logic.cpp
+++ b/engines/tsage/ringworld2/ringworld2_logic.cpp
@@ -119,6 +119,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) {
case 1550:
return new Scene1550();
case 1575:
+ return new Scene1575();
case 1580:
case 1625:
case 1700:
diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
index e1796a40c8..576d4e5beb 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
@@ -4168,5 +4168,385 @@ void Scene1550::subA2B2F() {
R2_GLOBALS._uiElements.updateInventory();
}
+/*--------------------------------------------------------------------------
+ * Scene 1575 -
+ *
+ *--------------------------------------------------------------------------*/
+Scene1575::Scene1575() {
+ _field412 = 0;
+ _field414 = 0;
+ _field416 = 0;
+ _field418 = 0;
+ _field41A = 0;
+}
+
+void Scene1575::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_field412);
+ s.syncAsSint16LE(_field414);
+ s.syncAsSint16LE(_field416);
+ s.syncAsSint16LE(_field418);
+ s.syncAsSint16LE(_field41A);
+}
+
+Scene1575::Hotspot1::Hotspot1() {
+ _field34 = 0;
+ _field36 = 0;
+}
+
+void Scene1575::Hotspot1::synchronize(Serializer &s) {
+ NamedHotspot::synchronize(s);
+
+ s.syncAsSint16LE(_field34);
+ s.syncAsSint16LE(_field36);
+}
+
+void Scene1575::Hotspot1::process(Event &event) {
+ if ((event.eventType != EVENT_BUTTON_DOWN) || (R2_GLOBALS._events.getCursor() != R2_STEPPING_DISKS) || (!_bounds.contains(event.mousePos))) {
+ if (_field36 == 0)
+ return;
+ if ((_field34 == 1) || (event.eventType == EVENT_BUTTON_UP) || (!_bounds.contains(event.mousePos))) {
+ _field36 = 0;
+ return;
+ }
+ }
+ _field36 = 1;
+ Scene1575 *scene = (Scene1575 *)R2_GLOBALS._sceneManager._scene;
+
+ event.handled = true;
+ if (R2_GLOBALS.getFlag(18) && (_field34 > 1) && (_field34 < 6)) {
+ warning("sub1A03B(\"Better not move the laser while it\'s firing!\", 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);");
+ return;
+ }
+ int di = scene->_actor1._position.x;
+
+ switch (_field34 - 1) {
+ case 0:
+ if (R2_GLOBALS.getFlag(18)) {
+ scene->_actor14.hide();
+ scene->_actor15.hide();
+ R2_GLOBALS.clearFlag(18);
+ } else if ((scene->_actor12._position.x == 85) && (scene->_actor12._position.y == 123)) {
+ scene->_actor14.show();
+ scene->_actor15.show();
+ R2_GLOBALS.setFlag(18);
+ } else {
+ warning("sub1A03B(\"That\'s probably not a good thing, ya know!\", 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);");
+ }
+ break;
+ case 1:
+ if (scene->_field41A < 780) {
+ if (di > 54)
+ di -= 65;
+ di += 2;
+ scene->_field41A += 2;
+
+ for (int i = 0; i < 17; i++)
+ scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x + 2, scene->_arrActor[i]._position.y));
+
+ scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x + 2, scene->_actor13._position.y));
+ scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x + 2, scene->_actor12._position.y));
+ scene->_actor1.setPosition(Common::Point(di, scene->_actor1._position.y));
+ scene->_actor2.setPosition(Common::Point(di + 65, scene->_actor1._position.y));
+ scene->_actor3.setPosition(Common::Point(di + 130, scene->_actor1._position.y));
+ }
+ break;
+ case 2:
+ if (scene->_field41A > 0) {
+ if (di < -8)
+ di += 65;
+
+ di -= 2;
+ scene->_field41A -= 2;
+ for (int i = 0; i < 178; i++)
+ scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x - 2, scene->_arrActor[i]._position.y));
+
+ scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x - 2, scene->_actor13._position.y));
+ scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x - 2, scene->_actor12._position.y));
+ scene->_actor1.setPosition(Common::Point(di, scene->_actor1._position.y));
+ scene->_actor2.setPosition(Common::Point(di + 65, scene->_actor1._position.y));
+ scene->_actor3.setPosition(Common::Point(di + 130, scene->_actor1._position.y));
+ }
+ break;
+ case 3: {
+ int tmpPosY = scene->_actor1._position.y;
+ if (tmpPosY < 176) {
+ ++tmpPosY;
+ for (int i = 0; i < 17; ++i)
+ scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x, scene->_arrActor[i]._position.y + 1));
+
+ scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x, scene->_actor13._position.y + 1));
+ scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x, scene->_actor12._position.y + 1));
+ scene->_actor1.setPosition(Common::Point(di, scene->_actor1._position.y));
+ scene->_actor2.setPosition(Common::Point(di + 65, scene->_actor1._position.y));
+ scene->_actor3.setPosition(Common::Point(di + 130, scene->_actor1._position.y));
+ }
+ }
+ break;
+ case 4: {
+ int tmpPosY = scene->_actor1._position.y;
+ if (tmpPosY > 145) {
+ tmpPosY--;
+ for (int i = 0; i < 17; ++i)
+ scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x, scene->_arrActor[i]._position.y - 1));
+
+ scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x, scene->_actor13._position.y - 1));
+ scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x, scene->_actor12._position.y - 1));
+ scene->_actor1.setPosition(Common::Point(di, scene->_actor1._position.y));
+ scene->_actor2.setPosition(Common::Point(di + 65, scene->_actor1._position.y));
+ scene->_actor3.setPosition(Common::Point(di + 130, scene->_actor1._position.y));
+ }
+ }
+ break;
+ case 5:
+ R2_GLOBALS._sceneManager.changeScene(1550);
+ break;
+ default:
+ break;
+ }
+
+ int j = 0;
+ for (int i = 0; i < 17; i++) {
+ if (scene->_arrActor[i]._bounds.contains(85, 116))
+ j = i;
+ }
+
+ if (scene->_actor13._bounds.contains(85, 116))
+ j = 18;
+
+ if (scene->_actor12._bounds.contains(85, 116))
+ j = 19;
+
+ if (j)
+ scene->_actor11.show();
+ else
+ scene->_actor11.hide();
+}
+
+bool Scene1575::Hotspot1::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_USE)
+ return false;
+ return SceneHotspot::startAction(action, event);
+}
+
+void Scene1575::Hotspot1::subA910D(int indx) {
+ warning("STUB: Scene1575:Hotspot1::subA910D(%d)", indx);
+}
+
+void Scene1575::postInit(SceneObjectList *OwnerList) {
+ loadScene(1575);
+ R2_GLOBALS._v58CE2 = 0;
+ R2_GLOBALS._v5589E = Rect(0, 0, 320, 200);
+ SceneExt::postInit();
+ _field414 = 390;
+
+ _actor1.postInit();
+ _actor1.setup(1575, 1, 1);
+ _actor1.setPosition(Common::Point(54, 161));
+ _actor1.fixPriority(5);
+
+ _actor2.postInit();
+ _actor2.setup(1575, 1, 1);
+ _actor2.setPosition(Common::Point(119, 161));
+ _actor2.fixPriority(5);
+
+ _actor3.postInit();
+ _actor3.setup(1575, 1, 1);
+ _actor3.setPosition(Common::Point(184, 161));
+ _actor3.fixPriority(5);
+
+ for (int i = 0; i < 17; i++) {
+ _arrActor[i].postInit();
+ _arrActor[i].setup(1575, 2, k5A7F6[(3 * i) + 2]);
+ warning("TODO: immense pile of floating operations");
+ _arrActor[i].fixPriority(6);
+ }
+
+ _actor4.postInit();
+ _actor4.setup(1575, 3, 1);
+ _actor4.setPosition(Common::Point(48, 81));
+
+ _actor5.postInit();
+ _actor5.setup(1575, 3,1);
+ _actor5.setPosition(Common::Point(121, 81));
+
+ _actor6.postInit();
+ _actor6.setup(1575, 3, 2);
+ _actor6.setPosition(Common::Point(203, 80));
+
+ _actor7.postInit();
+ _actor7.setup(1575, 3, 2);
+ _actor7.setPosition(Common::Point(217, 80));
+
+ _actor8.postInit();
+ _actor8.setup(1575, 3, 2);
+ _actor8.setPosition(Common::Point(231, 80));
+
+ _actor9.postInit();
+ _actor9.setup(1575, 3, 2);
+ _actor9.setPosition(Common::Point(273, 91));
+
+ _actor10.postInit();
+ _actor10.setup(1575, 3, 2);
+ _actor10.setPosition(Common::Point(287, 91));
+
+ _item1.subA910D(1);
+ _item1.subA910D(2);
+ _item1.subA910D(3);
+ _item1.subA910D(4);
+ _item1.subA910D(5);
+ _item1.subA910D(6);
+
+ _actor11.postInit();
+ _actor11.setup(1575, 4, 2);
+ _actor11.setPosition(Common::Point(84, 116));
+ _actor11.hide();
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.hide();
+ R2_GLOBALS._player.enableControl();
+
+ do {
+ _field412 = R2_GLOBALS._randomSource.getRandomNumber(20) - 10;
+ _field414 = R2_GLOBALS._randomSource.getRandomNumber(20) - 10;
+ } while ((_field412) && (_field414));
+
+ if (_field412 < 0)
+ _actor4.hide();
+
+ if (_field414 < 0)
+ _actor5.hide();
+
+ _field416 = R2_GLOBALS._randomSource.getRandomNumber(4) + 1;
+ _field418 = R2_GLOBALS._randomSource.getRandomNumber(4) + 1;
+
+ _actor13.postInit();
+ _actor13.setup(1575, 2, 4);
+
+ warning("TODO: another immense pile of floating operations");
+
+ _actor12.postInit();
+ _actor12.fixPriority(12);
+
+ if (R2_GLOBALS.getFlag(17)) {
+ _actor13.setPosition(Common::Point(_actor13._position.x + 5, _actor13._position.y));
+ _actor12.setPosition(Common::Point(_actor12._position.x + 5, _actor12._position.y));
+ }
+
+ _actor14.postInit();
+ _actor14.setup(1575, 5, 1);
+ _actor14.setPosition(Common::Point(85, 176));
+ _actor14.fixPriority(7);
+ _actor14.hide();
+
+ _actor15.postInit();
+ _actor15.setup(1575, 5, 2);
+ _actor15.setPosition(Common::Point(85, 147));
+ _actor15.fixPriority(7);
+ _actor15.hide();
+}
+
+void Scene1575::remove() {
+ SceneExt::remove();
+ R2_GLOBALS._v5589E.top = 3;
+ R2_GLOBALS._v5589E.bottom = 168;
+ R2_GLOBALS._v58CE2 = 1;
+}
+
+void Scene1575::signal() {
+ R2_GLOBALS._player.enableControl();
+}
+
+void Scene1575::process(Event &event) {
+ Scene::process(event);
+
+ g_globals->_sceneObjects->recurse(SceneHandler::dispatchObject);
+ warning("TODO: check Scene1575::process");
+}
+
+void Scene1575::dispatch() {
+ if (_field412 <= 0) {
+ ++_field412;
+ if (_field412 == 0) {
+ _actor4.show();
+ _field412 = R2_GLOBALS._randomSource.getRandomNumber(9) + 1;
+ }
+ } else {
+ _field412--;
+ if (_field412 ==0) {
+ _actor4.hide();
+ _field412 = R2_GLOBALS._randomSource.getRandomNumber(9) + 1;
+ }
+ }
+
+ if (_field414 <= 0) {
+ ++_field414;
+ if (_field414 == 0) {
+ _actor5.show();
+ _field414 = R2_GLOBALS._randomSource.getRandomNumber(9) + 1;
+ }
+ } else {
+ _field414--;
+ if (_field414 == 0) {
+ _actor5.hide();
+ _field414 = R2_GLOBALS._randomSource.getRandomNumber(9) + 1;
+ }
+ }
+
+ if (_field416 == 0) {
+ switch(R2_GLOBALS._randomSource.getRandomNumber(3)) {
+ case 0:
+ _actor6.hide();
+ _actor7.hide();
+ _actor8.hide();
+ break;
+ case 1:
+ _actor6.show();
+ _actor7.hide();
+ _actor8.hide();
+ break;
+ case 2:
+ _actor6.show();
+ _actor7.show();
+ _actor8.hide();
+ break;
+ case 3:
+ _actor6.show();
+ _actor7.show();
+ _actor8.show();
+ break;
+ default:
+ break;
+ }
+ _field416 = R2_GLOBALS._randomSource.getRandomNumber(4) + 1;
+ } else {
+ --_field416;
+ }
+
+ if (_field418 == 0) {
+ switch(R2_GLOBALS._randomSource.getRandomNumber(2)) {
+ case 0:
+ _actor9.hide();
+ _actor10.hide();
+ break;
+ case 1:
+ _actor9.show();
+ _actor10.hide();
+ break;
+ case 2:
+ _actor9.show();
+ _actor10.show();
+ break;
+ default:
+ break;
+ }
+ _field418 = R2_GLOBALS._randomSource.getRandomNumber(4) + 1;
+ } else {
+ _field418--;
+ }
+ Scene::dispatch();
+}
+
} // 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 d62700c686..07813f16d7 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.h
@@ -380,6 +380,59 @@ public:
virtual void dispatch();
virtual void saveCharacter(int characterIndex);
};
+
+class Scene1575 : public SceneExt {
+ class Hotspot1 : public NamedHotspot {
+ public:
+ int _field34;
+ int _field36;
+
+ Hotspot1();
+ void synchronize(Serializer &s);
+ void subA910D(int indx);
+
+ virtual void process(Event &event);
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ int _field412;
+ int _field414;
+ int _field416;
+ int _field418;
+ int _field41A;
+ Hotspot1 _item1;
+ Hotspot1 _item2;
+ Hotspot1 _item3;
+ Hotspot1 _item4;
+ Hotspot1 _item5;
+ Hotspot1 _item6;
+ SceneActor _actor1;
+ SceneActor _actor2;
+ SceneActor _actor3;
+ SceneActor _actor4;
+ SceneActor _actor5;
+ SceneActor _actor6;
+ SceneActor _actor7;
+ SceneActor _actor8;
+ SceneActor _actor9;
+ SceneActor _actor10;
+ SceneActor _actor11;
+ SceneActor _actor12;
+ SceneActor _actor13;
+ SceneActor _actor14;
+ SceneActor _actor15;
+ SceneActor _arrActor[17];
+ SequenceManager _sequenceManager1;
+
+ Scene1575();
+ void synchronize(Serializer &s);
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
} // End of namespace Ringworld2
} // End of namespace TsAGE
diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp
index 398d06881b..543dbe86a9 100644
--- a/engines/tsage/staticres.cpp
+++ b/engines/tsage/staticres.cpp
@@ -421,6 +421,26 @@ const byte k5A79B[] = {
9, 11, 12
};
+const byte k5A7F6[] = {
+ 4, 11, 6,
+ 5, 14, 5,
+ 5, 11, 6,
+ 5, 7, 5,
+ 6, 9, 6,
+ 7, 16, 7,
+ 7, 12, 7,
+ 8, 6, 5,
+ 9, 9, 7,
+ 10, 13, 9,
+ 10, 6, 8,
+ 11, 10, 9,
+ 12, 15, 10,
+ 13, 12, 11,
+ 14, 8, 9,
+ 15, 16, 1,
+ 15, 10, 11
+};
+
} // End of namespace Ringworld2
} // End of namespace TsAGE
diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h
index b2489b7e3d..2a5d5c76ba 100644
--- a/engines/tsage/staticres.h
+++ b/engines/tsage/staticres.h
@@ -199,6 +199,7 @@ extern const byte k5A750[];
extern const byte k5A76D[];
extern const byte k5A78A[];
extern const byte k5A79B[];
+extern const byte k5A7F6[];
} // End of namespace Ringworld2