aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage
diff options
context:
space:
mode:
authorPaul Gilbert2011-03-23 00:31:29 +1100
committerPaul Gilbert2011-03-23 00:31:29 +1100
commit71354fdf13f84573acba278b420c9d87ede16925 (patch)
tree07d07bb39cb01d4663b750328577c8d815d91395 /engines/tsage
parent0e35331302c2a132e092fb699b9ae1bcee8f1d17 (diff)
downloadscummvm-rg350-71354fdf13f84573acba278b420c9d87ede16925.tar.gz
scummvm-rg350-71354fdf13f84573acba278b420c9d87ede16925.tar.bz2
scummvm-rg350-71354fdf13f84573acba278b420c9d87ede16925.zip
TSAGE: Initial implementation of Scene #4025
Diffstat (limited to 'engines/tsage')
-rw-r--r--engines/tsage/ringworld_logic.cpp2
-rw-r--r--engines/tsage/ringworld_scenes1.cpp2
-rw-r--r--engines/tsage/ringworld_scenes5.cpp336
-rw-r--r--engines/tsage/ringworld_scenes5.h56
-rw-r--r--engines/tsage/staticres.cpp2
-rw-r--r--engines/tsage/staticres.h2
6 files changed, 397 insertions, 3 deletions
diff --git a/engines/tsage/ringworld_logic.cpp b/engines/tsage/ringworld_logic.cpp
index bac1085161..19128d0d07 100644
--- a/engines/tsage/ringworld_logic.cpp
+++ b/engines/tsage/ringworld_logic.cpp
@@ -110,6 +110,8 @@ Scene *SceneFactory::createScene(int sceneNumber) {
case 4000: return new Scene4000();
// Village - Outside Lander
case 4010: return new Scene4010();
+ // Village - Puzzle Board
+ case 4025: return new Scene4025();
/* Scene group 6 */
diff --git a/engines/tsage/ringworld_scenes1.cpp b/engines/tsage/ringworld_scenes1.cpp
index b156b8961f..b1bcaabf28 100644
--- a/engines/tsage/ringworld_scenes1.cpp
+++ b/engines/tsage/ringworld_scenes1.cpp
@@ -2378,7 +2378,7 @@ void Scene60::signal() {
_globals->_player._uiEnabled = true;
_globals->_events.setCursor(CURSOR_USE);
- _gfxButton.setText(SCENE60_EXIT_MSG);
+ _gfxButton.setText(EXIT_MSG);
_gfxButton._bounds.centre(160, 193);
_gfxButton.draw();
_gfxButton._bounds.expandPanes();
diff --git a/engines/tsage/ringworld_scenes5.cpp b/engines/tsage/ringworld_scenes5.cpp
index 85d0689c26..a1cecca5d2 100644
--- a/engines/tsage/ringworld_scenes5.cpp
+++ b/engines/tsage/ringworld_scenes5.cpp
@@ -1284,4 +1284,340 @@ void Scene4010::signal() {
_globals->_sceneManager.changeScene(4000);
}
+/*--------------------------------------------------------------------------
+ * Scene 4025 - Village - Puzzle Board
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene4025::Action1::signal() {
+ Scene4025 *scene = (Scene4025 *)_globals->_sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ scene->_armHotspot._strip = scene->_pegPtr->_armStrip;
+ scene->_armHotspot._frame = 4;
+ scene->_armHotspot.animate(ANIM_MODE_4, 2, -1, this);
+
+ if (scene->_pegPtr->_armStrip > 3) {
+ if (scene->_hole1._armStrip == scene->_pegPtr->_armStrip)
+ scene->_hole1._pegPtr = NULL;
+ if (scene->_hole2._armStrip == scene->_pegPtr->_armStrip)
+ scene->_hole2._pegPtr = NULL;
+ if (scene->_hole3._armStrip == scene->_pegPtr->_armStrip)
+ scene->_hole3._pegPtr = NULL;
+ if (scene->_hole4._armStrip == scene->_pegPtr->_armStrip)
+ scene->_hole4._pegPtr = NULL;
+ if (scene->_hole5._armStrip == scene->_pegPtr->_armStrip)
+ scene->_hole5._pegPtr = NULL;
+ }
+ break;
+ case 1:
+ scene->_pegPtr->flag100();
+
+ if (scene->_pegPtr2) {
+ if (scene->_pegPtr->_armStrip == 3)
+ scene->_pegPtr2->_strip = 2;
+
+ scene->_pegPtr2->setPosition(scene->_pegPtr->_position);
+ scene->_pegPtr2->unflag100();
+ scene->_pegPtr2->_armStrip = scene->_pegPtr->_armStrip;
+ }
+
+ scene->_pegPtr->_armStrip = 0;
+ scene->_pegPtr->setPosition(Common::Point(-10, -10));
+ scene->_pegPtr2 = scene->_pegPtr;
+ scene->_armHotspot.animate(ANIM_MODE_5, this);
+ break;
+
+ case 2:
+ _globals->_player._uiEnabled = true;
+ _globals->_events.setCursor(CURSOR_USE);
+ remove();
+ break;
+ }
+}
+
+void Scene4025::Action2::signal() {
+ Scene4025 *scene = (Scene4025 *)_globals->_sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ scene->_armHotspot._strip = scene->_holePtr->_armStrip;
+ scene->_armHotspot.animate(ANIM_MODE_4, 2, -1, this);
+ break;
+ case 1:
+ if (!scene->_pegPtr2) {
+ // Getting a peg
+ scene->_holePtr->_pegPtr->flag100();
+ scene->_pegPtr = scene->_holePtr->_pegPtr;
+ scene->_pegPtr->_armStrip = 0;
+ scene->_pegPtr->setPosition(Common::Point(-10, -10));
+ scene->_pegPtr2 = scene->_pegPtr;
+ scene->_pegPtr = NULL;
+ } else {
+ // Placing a peg
+ scene->_pegPtr2 = NULL;
+ if (scene->_holePtr->_pegPtr) {
+ scene->_holePtr->_pegPtr->flag100();
+ scene->_pegPtr2 = scene->_holePtr->_pegPtr;
+ }
+
+ assert(scene->_pegPtr);
+ scene->_pegPtr->setPosition(scene->_holePtr->_newPosition);
+ scene->_pegPtr->setStrip(1);
+ scene->_pegPtr->unflag100();
+ scene->_pegPtr->_armStrip = scene->_holePtr->_armStrip;
+
+ scene->_holePtr->_pegPtr = scene->_pegPtr;
+ scene->_pegPtr = scene->_pegPtr2;
+ }
+ scene->_armHotspot.animate(ANIM_MODE_5, this);
+ break;
+ case 2:
+ _globals->_player._uiEnabled = true;
+ _globals->_events.setCursor(CURSOR_USE);
+ remove();
+ break;
+ }
+}
+
+void Scene4025::Action3::signal() {
+ switch (_actionIndex++) {
+ case 0:
+ _globals->_player.disableControl();
+ _globals->_scenePalette.addRotation(64, 111, -1);
+ setDelay(120);
+ break;
+ case 1:
+ _globals->clearFlag(34);
+ _globals->_stripNum = 4025;
+ _globals->_sceneManager.changeScene(4000);
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene4025::Hole::synchronise(Serialiser &s) {
+ SceneObject::synchronise(s);
+ SYNC_POINTER(_pegPtr);
+ s.syncAsSint16LE(_armStrip);
+ s.syncAsSint16LE(_newPosition.x);
+ s.syncAsSint16LE(_newPosition.y);
+}
+
+void Scene4025::Hole::doAction(int action) {
+ Scene4025 *scene = (Scene4025 *)_globals->_sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(4025, 3);
+ break;
+ case CURSOR_USE:
+ if (!scene->_holePtr && !_pegPtr) {
+ setAction(&scene->_sequenceManager, scene, 4028, NULL);
+ } else {
+ _globals->_player.disableControl();
+ scene->_holePtr = this;
+ scene->setAction(&scene->_action2);
+ }
+ break;
+ case OBJECT_PEG:
+ if (!scene->_pegPtr2) {
+ _globals->_player.disableControl();
+ _globals->_events.setCursor(CURSOR_USE);
+ _globals->_inventory._peg._sceneNumber = 4025;
+
+ scene->_pegPtr = &scene->_peg5;
+ scene->_holePtr = this;
+ scene->_pegPtr->_armStrip = 0;
+ scene->_pegPtr2 = scene->_pegPtr;
+
+ scene->setAction(&scene->_action2);
+ } else {
+ scene->_sceneMode = 4027;
+ scene->setAction(&scene->_sequenceManager, scene, 4027, NULL);
+ }
+ break;
+ }
+}
+
+void Scene4025::Peg::synchronise(Serialiser &s) {
+ SceneObject::synchronise(s);
+ s.syncAsSint16LE(_field88);
+ SYNC_POINTER(_armStrip);
+}
+
+void Scene4025::Peg::doAction(int action) {
+ Scene4025 *scene = (Scene4025 *)_globals->_sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(4025, 1);
+ break;
+ case CURSOR_USE:
+ _globals->_player.disableControl();
+ scene->_pegPtr = this;
+ scene->setAction(&scene->_action1);
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene4025::postInit(SceneObjectList *OwnerList) {
+ loadScene(4025);
+ Scene::postInit();
+ setZoomPercents(0, 100, 200, 100);
+
+ _globals->_events.setCursor(CURSOR_USE);
+ _pegPtr = _pegPtr2 = NULL;
+
+ _peg1.postInit();
+ _peg1._field88 = 1;
+ _peg1.setVisage(4025);
+ _peg1.setStrip(2);
+ _peg1.setFrame(1);
+ _peg1.setPosition(Common::Point(203, 61));
+
+ _peg2.postInit();
+ _peg2._field88 = 4;
+ _peg2.setVisage(4025);
+ _peg2.setStrip(2);
+ _peg2.setFrame(2);
+ _peg2.setPosition(Common::Point(195, 57));
+
+ _peg3.postInit();
+ _peg3._field88 = 0;
+ _peg3.setVisage(4025);
+ _peg3.setStrip(2);
+ _peg3.setFrame(3);
+ _peg3.setPosition(Common::Point(202, 66));
+
+ _peg4.postInit();
+ _peg4._field88 = 3;
+ _peg4.setVisage(4025);
+ _peg4.setStrip(2);
+ _peg4.setFrame(4);
+ _peg4.setPosition(Common::Point(194, 68));
+
+ _peg5.postInit();
+ _peg5._field88 = 2;
+ _peg5.setVisage(4025);
+ _peg5.setStrip(1);
+ _peg5.setFrame(5);
+ _peg5.flag100();
+
+ _hole1.postInit();
+ _hole1.setVisage(4025);
+ _hole1.setStrip(1);
+ _hole1.setFrame2(6);
+ _hole1.setPosition(Common::Point(123, 51));
+ _hole1._pegPtr = NULL;
+ _hole1._newPosition = Common::Point(123, 44);
+ _hole1._armStrip = 8;
+
+ _hole2.postInit();
+ _hole2.setVisage(4025);
+ _hole2.setStrip(1);
+ _hole2.setFrame2(7);
+ _hole2.setPosition(Common::Point(167, 51));
+ _hole2._pegPtr = NULL;
+ _hole2._newPosition = Common::Point(166, 44);
+ _hole2._armStrip = 7;
+
+ _hole3.postInit();
+ _hole3.setVisage(4025);
+ _hole3.setStrip(1);
+ _hole3.setFrame2(8);
+ _hole3.setPosition(Common::Point(145, 69));
+ _hole3._pegPtr = NULL;
+ _hole3._newPosition = Common::Point(145, 60);
+ _hole3._armStrip = 6;
+
+ _hole4.postInit();
+ _hole4.setVisage(4025);
+ _hole4.setStrip(1);
+ _hole4.setFrame2(6);
+ _hole4.setPosition(Common::Point(123, 87));
+ _hole4._pegPtr = NULL;
+ _hole4._newPosition = Common::Point(123, 80);
+ _hole4._armStrip = 5;
+
+ _hole5.postInit();
+ _hole5.setVisage(4025);
+ _hole5.setStrip(1);
+ _hole5.setFrame2(10);
+ _hole5.setPosition(Common::Point(167, 87));
+ _hole5._pegPtr = NULL;
+ _hole5._newPosition = Common::Point(166, 80);
+ _hole5._armStrip = 4;
+
+ _hole1.setPriority2(1);
+ _hole2.setPriority2(1);
+ _hole3.setPriority2(1);
+ _hole4.setPriority2(1);
+ _hole5.setPriority2(1);
+
+ _armHotspot.postInit();
+ _armHotspot.setVisage(4025);
+ _armHotspot.setPosition(Common::Point(190, 161));
+ _armHotspot.setStrip(3);
+ _armHotspot.setFrame(4);
+
+ _globals->_sceneItems.addItems(&_hole1, &_hole2, &_hole3, &_hole4, &_hole5,
+ &_peg1, &_peg2, &_peg3, &_peg4, &_peg5, NULL);
+
+ _globals->_player._uiEnabled = true;
+ _globals->_player.disableControl();
+ setAction(&_sequenceManager, this, 4026, NULL);
+}
+
+void Scene4025::synchronise(Serialiser &s) {
+ Scene::synchronise(s);
+ SYNC_POINTER(_pegPtr);
+ SYNC_POINTER(_pegPtr2);
+ SYNC_POINTER(_holePtr);
+}
+
+void Scene4025::remove() {
+ _globals->_scenePalette.clearListeners();
+ Scene::remove();
+}
+
+void Scene4025::signal() {
+ if (_sceneMode != 4027) {
+ if (_sceneMode != 4028) {
+ _gfxButton.setText(EXIT_MSG);
+ _gfxButton._bounds.centre(144, 107);
+ _gfxButton.draw();
+ _gfxButton._bounds.expandPanes();
+ }
+
+ _globals->_player._uiEnabled = true;
+ }
+
+ _globals->_events.setCursor(CURSOR_USE);
+}
+
+void Scene4025::process(Event &event) {
+ Scene::process(event);
+
+ if (_gfxButton.process(event)) {
+ if (_globals->_inventory._peg._sceneNumber == 4025)
+ _globals->_inventory._peg._sceneNumber = 1;
+
+ _globals->_sceneManager.changeScene(4000);
+ }
+}
+
+void Scene4025::dispatch() {
+ if ((_peg1._armStrip == 7) && (_peg2._armStrip == 4) && (_peg3._armStrip == 8) &&
+ (_peg4._armStrip == 5) && (_peg5._armStrip == 6))
+ setAction(&_action3);
+
+ Scene::dispatch();
+}
+
+
} // End of namespace tSage
diff --git a/engines/tsage/ringworld_scenes5.h b/engines/tsage/ringworld_scenes5.h
index 7dc7a9b88b..b6a6a49278 100644
--- a/engines/tsage/ringworld_scenes5.h
+++ b/engines/tsage/ringworld_scenes5.h
@@ -198,6 +198,62 @@ public:
virtual void signal();
};
+class Scene4025: public Scene {
+ /* Custom classes */
+ class Peg;
+
+ class Hole: public SceneObject {
+ public:
+ Peg *_pegPtr;
+ int _armStrip;
+ Common::Point _newPosition;
+
+ virtual void synchronise(Serialiser &s);
+ virtual void doAction(int action);
+ };
+ class Peg: public SceneObject {
+ public:
+ int _field88;
+ int _armStrip;
+
+ Peg(): SceneObject() { _field88 = 0; _armStrip = 3; }
+ virtual void synchronise(Serialiser &s);
+ virtual void doAction(int action);
+ };
+
+ /* Actions */
+ class Action1: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action2: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action3: public Action {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager;
+ GfxButton _gfxButton;
+ SceneObject _armHotspot;
+ Hole _hole1, _hole2, _hole3, _hole4, _hole5;
+ Peg _peg1, _peg2, _peg3, _peg4, _peg5;
+ Action1 _action1;
+ Action2 _action2;
+ Action3 _action3;
+ Peg *_pegPtr, *_pegPtr2;
+ Hole *_holePtr;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void synchronise(Serialiser &s);
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
} // End of namespace tSage
#endif
diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp
index a29bf22617..59fca196b1 100644
--- a/engines/tsage/staticres.cpp
+++ b/engines/tsage/staticres.cpp
@@ -99,7 +99,7 @@ const char *PICK_BTN_STRING = "Pick";
const char *START_PLAY_BTN_STRING = " Start Play ";
const char *INTRODUCTION_BTN_STRING = "Introduction";
-const char *SCENE60_EXIT_MSG = " EXIT ";
+const char *EXIT_MSG = " EXIT ";
const char *SCENE6100_CAREFUL = "Be careful! The probe cannot handle too much of that.";
const char *SCENE6100_TOUGHER = "Hey! This is tougher than it looks!";
const char *SCENE6100_ONE_MORE_HIT = "You had better be more careful. One more hit like that \
diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h
index 75a0de4cf7..d4690e47bc 100644
--- a/engines/tsage/staticres.h
+++ b/engines/tsage/staticres.h
@@ -66,7 +66,7 @@ extern const char *START_PLAY_BTN_STRING;
extern const char *INTRODUCTION_BTN_STRING;
// Scene specific resources
-extern const char *SCENE60_EXIT_MSG;
+extern const char *EXIT_MSG;
extern const char *SCENE6100_CAREFUL;
extern const char *SCENE6100_TOUGHER;
extern const char *SCENE6100_ONE_MORE_HIT;