From dfeb802602904aafbe69fa20c2c233e620755bed Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 31 Aug 2013 18:22:14 +0200 Subject: [PATCH 01/24] TSAGE: Some renaming in Scene250 --- .../tsage/ringworld2/ringworld2_scenes0.cpp | 42 +++++++++---------- engines/tsage/ringworld2/ringworld2_scenes0.h | 2 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 1439557d1ee..3cec7015631 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2504,7 +2504,7 @@ bool Scene250::Button::startAction(CursorType action, Event &event) { switch (action) { case CURSOR_USE: - if (scene->_field414) { + if (scene->_destButtonY) { SceneItem::display2(250, 15); } else { switch (_floorNumber) { @@ -2580,14 +2580,14 @@ void Scene250::Button::setFloor(int floorNumber) { /*--------------------------------------------------------------------------*/ Scene250::Scene250(): SceneExt() { - _field412 = _field414 = _field416 = _field418 = _field41A = 0; + _currButtonY = _destButtonY = _field416 = _field418 = _field41A = 0; } void Scene250::synchronize(Serializer &s) { SceneExt::synchronize(s); - s.syncAsSint16LE(_field412); - s.syncAsSint16LE(_field414); + s.syncAsSint16LE(_currButtonY); + s.syncAsSint16LE(_destButtonY); s.syncAsSint16LE(_field416); s.syncAsSint16LE(_field418); s.syncAsSint16LE(_field41A); @@ -2632,24 +2632,24 @@ void Scene250::postInit(SceneObjectList *OwnerList) { switch (R2_GLOBALS._sceneManager._previousScene) { case 200: - _field412 = 55; + _currButtonY = 55; break; case 300: - _field412 = 43; + _currButtonY = 43; break; case 700: - _field412 = 139; + _currButtonY = 139; break; case 850: - _field412 = 91; + _currButtonY = 91; break; default: R2_GLOBALS._sceneManager._previousScene = 200; - _field412 = 55; + _currButtonY = 55; break; } - _currentFloor.setPosition(Common::Point(111, _field412)); + _currentFloor.setPosition(Common::Point(111, _currButtonY)); } void Scene250::signal() { @@ -2668,16 +2668,16 @@ void Scene250::signal() { _sceneMode = 2; break; case 2: - _sceneMode = ((_field414 - 12) == _field412) ? 4 : 3; + _sceneMode = ((_destButtonY - 12) == _currButtonY) ? 4 : 3; signal(); break; case 3: _currentFloor.setPosition(Common::Point(111, _currentFloor._position.y + 12)); - _field412 += 12; + _currButtonY += 12; R2_GLOBALS._player.setPosition(Common::Point(261, 185)); ADD_MOVER(R2_GLOBALS._player, 261, 15); - if ((_field414 - 12) == _field412) + if ((_destButtonY - 12) == _currButtonY) _sceneMode = 4; break; case 4: @@ -2704,7 +2704,7 @@ void Scene250::signal() { break; case 7: _field418 = 1; - if ((_field414 + 12) == _field412) + if ((_destButtonY + 12) == _currButtonY) _sceneMode = 9; else _sceneMode = 8; @@ -2712,11 +2712,11 @@ void Scene250::signal() { break; case 8: _currentFloor.setPosition(Common::Point(111, _currentFloor._position.y - 12)); - _field412 -= 12; + _currButtonY -= 12; R2_GLOBALS._player.setPosition(Common::Point(261, 15)); ADD_MOVER(R2_GLOBALS._player, 261, 185); - if ((_field414 + 12) == _field412) + if ((_destButtonY + 12) == _currButtonY) _sceneMode = 9; break; case 9: @@ -2732,7 +2732,7 @@ void Scene250::signal() { break; case 20: // Handle changing scene - switch (_field414) { + switch (_destButtonY) { case 55: R2_GLOBALS._sceneManager.changeScene(200); break; @@ -2755,12 +2755,12 @@ void Scene250::signal() { } void Scene250::changeFloor(int floorNumber) { - _field414 = (floorNumber - 1) * 12 + 43; - _button1.setPosition(Common::Point(111, _field414)); + _destButtonY = (floorNumber - 1) * 12 + 43; + _button1.setPosition(Common::Point(111, _destButtonY)); _button1.show(); - _sceneMode = (_field412 >= _field414) ? 6 : 1; - if (_field414 == _field412) + _sceneMode = (_currButtonY >= _destButtonY) ? 6 : 1; + if (_destButtonY == _currButtonY) _sceneMode = 20; signal(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index a2f2accabae..c909a4170c8 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -318,7 +318,7 @@ class Scene250: public SceneExt { virtual bool startAction(CursorType action, Event &event); }; public: - int _field412, _field414, _field416, _field418, _field41A; + int _currButtonY, _destButtonY, _field416, _field418, _field41A; NamedHotspot _background, _item2, _item3, _item4; Button _button1, _currentFloor; Button _floor1, _floor2, _floor3, _floor4, _floor5; From 008016db37ae91ab24cec1ca77d7e1a861819add Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 1 Sep 2013 02:10:14 +0200 Subject: [PATCH 02/24] TSAGE: R2R - Fix elevator behavior (scene 250) --- .../tsage/ringworld2/ringworld2_scenes0.cpp | 25 ++++++++++++------- engines/tsage/ringworld2/ringworld2_scenes0.h | 3 ++- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 3cec7015631..186fb1ff5c5 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2580,7 +2580,8 @@ void Scene250::Button::setFloor(int floorNumber) { /*--------------------------------------------------------------------------*/ Scene250::Scene250(): SceneExt() { - _currButtonY = _destButtonY = _field416 = _field418 = _field41A = 0; + _currButtonY = _destButtonY = _field416 = 0; + _skippingFl = _skippableFl = false; } void Scene250::synchronize(Serializer &s) { @@ -2589,8 +2590,8 @@ void Scene250::synchronize(Serializer &s) { s.syncAsSint16LE(_currButtonY); s.syncAsSint16LE(_destButtonY); s.syncAsSint16LE(_field416); - s.syncAsSint16LE(_field418); - s.syncAsSint16LE(_field41A); + s.syncAsSint16LE(_skippableFl); + s.syncAsSint16LE(_skippingFl); } void Scene250::postInit(SceneObjectList *OwnerList) { @@ -2653,7 +2654,7 @@ void Scene250::postInit(SceneObjectList *OwnerList) { } void Scene250::signal() { - if (_field41A) + if (_skippingFl) _sceneMode = 20; switch (_sceneMode) { @@ -2668,7 +2669,11 @@ void Scene250::signal() { _sceneMode = 2; break; case 2: - _sceneMode = ((_destButtonY - 12) == _currButtonY) ? 4 : 3; + if (_destButtonY - 12 == _currButtonY) + _sceneMode = 4; + else + _sceneMode = 3; + signal(); break; case 3: @@ -2703,7 +2708,7 @@ void Scene250::signal() { _sceneMode = 7; break; case 7: - _field418 = 1; + _skippableFl = true; if ((_destButtonY + 12) == _currButtonY) _sceneMode = 9; else @@ -2759,6 +2764,7 @@ void Scene250::changeFloor(int floorNumber) { _button1.setPosition(Common::Point(111, _destButtonY)); _button1.show(); + _skippableFl = true; _sceneMode = (_currButtonY >= _destButtonY) ? 6 : 1; if (_destButtonY == _currButtonY) _sceneMode = 20; @@ -2768,8 +2774,9 @@ void Scene250::changeFloor(int floorNumber) { void Scene250::process(Event &event) { if (!event.handled) { - if (((event.eventType == EVENT_KEYPRESS) || (event.btnState != 0)) && _field418) { - _field41A = 1; + warning("%d", event.btnState); + if (((event.eventType == EVENT_KEYPRESS) || (event.btnState == BTNSHIFT_RIGHT)) && _skippableFl) { + _skippingFl = true; event.handled = true; } @@ -2787,7 +2794,7 @@ void Scene250::dispatch() { if (((_sceneMode == 5) || (_sceneMode == 10)) && (R2_GLOBALS._player._moveDiff.y > 4)) { --_field416; - R2_GLOBALS._player._moveDiff.y = _field416 / 7 + 3; + R2_GLOBALS._player._moveDiff.y = (_field416 / 7) + 3; } } diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index c909a4170c8..cfaa560d112 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -318,7 +318,8 @@ class Scene250: public SceneExt { virtual bool startAction(CursorType action, Event &event); }; public: - int _currButtonY, _destButtonY, _field416, _field418, _field41A; + int _currButtonY, _destButtonY, _field416; + bool _skippingFl, _skippableFl; NamedHotspot _background, _item2, _item3, _item4; Button _button1, _currentFloor; Button _floor1, _floor2, _floor3, _floor4, _floor5; From e25b9b602b5cd1590b209a03a256bfdd3f0d6c74 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 1 Sep 2013 02:13:14 +0200 Subject: [PATCH 03/24] TSAGE: R2R - More renaming in scene 250 --- .../tsage/ringworld2/ringworld2_scenes0.cpp | 18 +++++++++--------- engines/tsage/ringworld2/ringworld2_scenes0.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 186fb1ff5c5..21dd05c214b 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2580,7 +2580,7 @@ void Scene250::Button::setFloor(int floorNumber) { /*--------------------------------------------------------------------------*/ Scene250::Scene250(): SceneExt() { - _currButtonY = _destButtonY = _field416 = 0; + _currButtonY = _destButtonY = _elevatorSpeed = 0; _skippingFl = _skippableFl = false; } @@ -2589,7 +2589,7 @@ void Scene250::synchronize(Serializer &s) { s.syncAsSint16LE(_currButtonY); s.syncAsSint16LE(_destButtonY); - s.syncAsSint16LE(_field416); + s.syncAsSint16LE(_elevatorSpeed); s.syncAsSint16LE(_skippableFl); s.syncAsSint16LE(_skippingFl); } @@ -2665,7 +2665,7 @@ void Scene250::signal() { R2_GLOBALS._player.setPosition(Common::Point(261, 185)); ADD_MOVER(R2_GLOBALS._player, 261, 15); - _field416 = 0; + _elevatorSpeed = 0; _sceneMode = 2; break; case 2: @@ -2704,7 +2704,7 @@ void Scene250::signal() { R2_GLOBALS._player.setup(250, 1, 2); R2_GLOBALS._player.setPosition(Common::Point(261, 15)); ADD_MOVER(R2_GLOBALS._player, 261, 185); - _field416 = 0; + _elevatorSpeed = 0; _sceneMode = 7; break; case 7: @@ -2787,14 +2787,14 @@ void Scene250::process(Event &event) { void Scene250::dispatch() { SceneExt::dispatch(); - if (((_sceneMode == 2) || (_sceneMode == 7)) && (_field416 < 100)) { - ++_field416; - R2_GLOBALS._player._moveDiff.y = _field416 / 5; + if (((_sceneMode == 2) || (_sceneMode == 7)) && (_elevatorSpeed < 100)) { + ++_elevatorSpeed; + R2_GLOBALS._player._moveDiff.y = _elevatorSpeed / 5; } if (((_sceneMode == 5) || (_sceneMode == 10)) && (R2_GLOBALS._player._moveDiff.y > 4)) { - --_field416; - R2_GLOBALS._player._moveDiff.y = (_field416 / 7) + 3; + --_elevatorSpeed; + R2_GLOBALS._player._moveDiff.y = (_elevatorSpeed / 7) + 3; } } diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index cfaa560d112..ff62fc83d60 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -318,7 +318,7 @@ class Scene250: public SceneExt { virtual bool startAction(CursorType action, Event &event); }; public: - int _currButtonY, _destButtonY, _field416; + int _currButtonY, _destButtonY, _elevatorSpeed; bool _skippingFl, _skippableFl; NamedHotspot _background, _item2, _item3, _item4; Button _button1, _currentFloor; From bba18d8699970493fdda66a80b0231c99dc297ed Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 1 Sep 2013 02:16:29 +0200 Subject: [PATCH 04/24] TSAGE: R2R - Remove useless variable in scene 250 --- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 4 +--- engines/tsage/ringworld2/ringworld2_scenes0.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 21dd05c214b..9c4cc100108 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2489,14 +2489,13 @@ void Scene205::handleText() { *--------------------------------------------------------------------------*/ Scene250::Button::Button(): SceneActor() { - _floorNumber = _v2 = 0; + _floorNumber = 0; } void Scene250::Button::synchronize(Serializer &s) { SceneActor::synchronize(s); s.syncAsSint16LE(_floorNumber); - s.syncAsSint16LE(_v2); } bool Scene250::Button::startAction(CursorType action, Event &event) { @@ -2555,7 +2554,6 @@ bool Scene250::Button::startAction(CursorType action, Event &event) { void Scene250::Button::setFloor(int floorNumber) { SceneActor::postInit(); _floorNumber = floorNumber; - _v2 = 0; if (_floorNumber <= 9) { SceneObject::setup(250, 1, 4); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index ff62fc83d60..df0b4d8fc69 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -310,7 +310,7 @@ public: class Scene250: public SceneExt { class Button: public SceneActor { public: - int _floorNumber, _v2; + int _floorNumber; Button(); void setFloor(int floorNumber); From 355ad485badafeb00a0ca41793a8953db19d11fd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 1 Sep 2013 12:17:55 +0200 Subject: [PATCH 05/24] TSAGE: R2R - Get rid of some magic values related to eventType --- engines/tsage/ringworld2/ringworld2_scenes2.cpp | 4 ++-- engines/tsage/ringworld2/ringworld2_scenes3.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index 432f2848904..f802f0b2e50 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -3057,7 +3057,7 @@ void Scene2700::Action4::signal() { void Scene2700::Area1::process(Event &event) { SceneArea::process(event); - if ((event.eventType == 1) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos))) { + if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos))) { Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; R2_GLOBALS._player.disableControl(); scene->_sceneMode = 10; @@ -3107,7 +3107,7 @@ void Scene2700::Area1::process(Event &event) { void Scene2700::Area2::process(Event &event) { SceneArea::process(event); - if ((event.eventType == 1) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos))) { + if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._player._canWalk) && (_bounds.contains(event.mousePos))) { Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene; R2_GLOBALS._player.disableControl(); scene->_sceneMode = 10; diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index b2958a3d5e1..7703d491888 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -5319,7 +5319,7 @@ void Scene3800::signal() { } void Scene3800::process(Event &event) { - if ((R2_GLOBALS._player._uiEnabled) && (event.eventType == 1) && (_rect1.contains(event.mousePos))) { + if ((R2_GLOBALS._player._uiEnabled) && (event.eventType == EVENT_BUTTON_DOWN) && (_rect1.contains(event.mousePos))) { event.handled = true; switch (R2_GLOBALS._events.getCursor()) { case R2_NEGATOR_GUN: @@ -5582,7 +5582,7 @@ void Scene3900::signal() { } void Scene3900::process(Event &event) { - if ((R2_GLOBALS._player._uiEnabled) && (event.eventType == 1) && (_rect1.contains(event.mousePos))) { + if ((R2_GLOBALS._player._uiEnabled) && (event.eventType == EVENT_BUTTON_DOWN) && (_rect1.contains(event.mousePos))) { event.handled = true; switch (R2_GLOBALS._events.getCursor()) { case R2_NEGATOR_GUN: From c8058434eb43da654f046e3aa56b43b4e04a8f9d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 1 Sep 2013 12:23:32 +0200 Subject: [PATCH 06/24] TSAGE: BF - Fix erroneous check of eventType --- engines/tsage/blue_force/blueforce_scenes1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/tsage/blue_force/blueforce_scenes1.cpp b/engines/tsage/blue_force/blueforce_scenes1.cpp index 32d87581c0c..d26e34ae23a 100644 --- a/engines/tsage/blue_force/blueforce_scenes1.cpp +++ b/engines/tsage/blue_force/blueforce_scenes1.cpp @@ -2649,7 +2649,7 @@ void Scene160::Action2::signal() { } void Scene160::Action2::process(Event &event) { - if ((event.handled) || (event.eventType == 5)) + if ((event.handled) || ((event.eventType != EVENT_BUTTON_DOWN) && (event.eventType != EVENT_KEYPRESS))) return; if (_actionIndex == 25) { From 488d263aafc3d723172b1676011ae3011c34aae7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 1 Sep 2013 12:28:41 +0200 Subject: [PATCH 07/24] TSAGE: R2R - Remove leftover warning --- engines/tsage/ringworld2/ringworld2_scenes0.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 9c4cc100108..a0846d386a6 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2772,7 +2772,6 @@ void Scene250::changeFloor(int floorNumber) { void Scene250::process(Event &event) { if (!event.handled) { - warning("%d", event.btnState); if (((event.eventType == EVENT_KEYPRESS) || (event.btnState == BTNSHIFT_RIGHT)) && _skippableFl) { _skippingFl = true; event.handled = true; From 198ee3528a48c1a07b8040ad37d762fa27f99ea6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 1 Sep 2013 12:33:43 +0200 Subject: [PATCH 08/24] TSAGE: BF - Get rid of some magic values related to btnState --- engines/tsage/blue_force/blueforce_logic.cpp | 2 +- engines/tsage/blue_force/blueforce_scenes5.cpp | 2 +- engines/tsage/blue_force/blueforce_scenes8.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index 3aef18f4f0b..63f84d25e1a 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -678,7 +678,7 @@ void FocusObject::process(Event &event) { BF_GLOBALS._events.setCursor(BF_GLOBALS._events.getCursor()); if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == CURSOR_WALK) && - (event.btnState == 3)) { + (event.btnState == BTNSHIFT_RIGHT)) { BF_GLOBALS._events.setCursor(CURSOR_USE); event.handled = true; } diff --git a/engines/tsage/blue_force/blueforce_scenes5.cpp b/engines/tsage/blue_force/blueforce_scenes5.cpp index 25accbb8a6c..0cf487daa9e 100644 --- a/engines/tsage/blue_force/blueforce_scenes5.cpp +++ b/engines/tsage/blue_force/blueforce_scenes5.cpp @@ -1220,7 +1220,7 @@ void Scene560::SafeInset::process(Event &event) { } if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == CURSOR_WALK) && - (event.btnState == 3)) { + (event.btnState == BTNSHIFT_RIGHT)) { BF_GLOBALS._events.setCursor(CURSOR_USE); event.handled = true; } diff --git a/engines/tsage/blue_force/blueforce_scenes8.cpp b/engines/tsage/blue_force/blueforce_scenes8.cpp index 5a60cd7c5e9..9a20788b6a9 100644 --- a/engines/tsage/blue_force/blueforce_scenes8.cpp +++ b/engines/tsage/blue_force/blueforce_scenes8.cpp @@ -1984,7 +1984,7 @@ void Scene840::BoatKeysInset::process(Event &event) { CursorType cursorId = BF_GLOBALS._events.getCursor(); BF_GLOBALS._events.setCursor(cursorId); - if ((event.eventType == EVENT_BUTTON_DOWN) && (cursorId == CURSOR_WALK) && (event.btnState == 3)) { + if ((event.eventType == EVENT_BUTTON_DOWN) && (cursorId == CURSOR_WALK) && (event.btnState == BTNSHIFT_RIGHT)) { BF_GLOBALS._events.setCursor(CURSOR_USE); event.handled = true; } From 587063afba31f5e48b0ae29f8ba2397ef3183b45 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 1 Sep 2013 12:34:09 +0200 Subject: [PATCH 09/24] TSAGE: Core - Get rid of some magic values related to btnState --- engines/tsage/events.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp index 5ca531fdb97..ac6ce0bf8ec 100644 --- a/engines/tsage/events.cpp +++ b/engines/tsage/events.cpp @@ -113,7 +113,7 @@ bool EventsClass::getEvent(Event &evt, int eventMask) { case Common::EVENT_RBUTTONUP: case Common::EVENT_MBUTTONUP: evt.eventType = EVENT_BUTTON_UP; - evt.btnState = 0; + evt.btnState = BTNSHIFT_LEFT; break; case Common::EVENT_KEYDOWN: evt.eventType = EVENT_KEYPRESS; From cf7d1378c8b79a97278211af797000b846b69be9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 Sep 2013 10:03:30 -0400 Subject: [PATCH 10/24] TSAGE: Fix for initialising inventory for new R2R games --- engines/tsage/globals.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 71ea160cf52..3e0ef4744ff 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -381,6 +381,9 @@ void Ringworld2Globals::reset() { if (!_scannerDialog) _scannerDialog = new ScannerDialog(); + // Default to Quinn as the active character + T2_GLOBALS._player._characterIndex = R2_QUINN; + // Reset the inventory R2_INVENTORY.reset(); T2_GLOBALS._uiElements.updateInventory(); From 33445aeaa35eafb24b9ebf9d79f1dc79d8a5a5f8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 1 Sep 2013 16:41:46 +0200 Subject: [PATCH 11/24] TSAGE: R2R - Some renaming in scene 1000 --- .../tsage/ringworld2/ringworld2_scenes1.cpp | 38 +++++++++---------- engines/tsage/ringworld2/ringworld2_scenes1.h | 4 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 33eb9b9afb4..2ad40e93031 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -38,8 +38,8 @@ Scene1000::Scene1000(): SceneExt() { R2_GLOBALS._sceneManager._hasPalette = false; R2_GLOBALS._uiElements._active = false; _gameTextSpeaker._displayMode = 9; - _fieldD2E = 0; - _field412 = 0; + _forceCheckAnimationFl = false; + _animCounter = 0; } void Scene1000::postInit(SceneObjectList *OwnerList) { @@ -116,7 +116,7 @@ void Scene1000::signal() { R2_GLOBALS._sceneManager._hasPalette = false; _animationPlayer.dispatch(); - _fieldD2E = 1; + _forceCheckAnimationFl = true; R2_GLOBALS._scenePalette.fade((const byte *)&black, true, 0); for (int percent = 0; percent < 100; percent += 5) @@ -141,7 +141,7 @@ void Scene1000::signal() { R2_GLOBALS._player.setPosition(Common::Point(160, 100)); R2_GLOBALS._player.show(); - _field412 = 0; + _animCounter = 0; _stripManager.start(29, this); break; @@ -149,7 +149,7 @@ void Scene1000::signal() { if (R2_GLOBALS._speechSubtitles & SPEECH_TEXT) { setAction(&_sequenceManager1, this, 1, &R2_GLOBALS._player, NULL); } else { - if (++_field412 < 3) + if (++_animCounter < 3) _sceneMode = 2; setAction(&_sequenceManager1, this, 2, &R2_GLOBALS._player, NULL); @@ -174,7 +174,7 @@ void Scene1000::signal() { _animationPlayer.dispatch(); - _fieldD2E = 1; + _forceCheckAnimationFl = true; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); for (int percent = 0; percent < 100; percent += 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); @@ -204,7 +204,7 @@ void Scene1000::signal() { R2_GLOBALS._sceneManager._hasPalette = false; _animationPlayer.dispatch(); - _fieldD2E = 1; + _forceCheckAnimationFl = true; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); for (int percent = 0; percent < 100; percent += 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); @@ -226,7 +226,7 @@ void Scene1000::signal() { R2_GLOBALS._sceneManager._hasPalette = false; _animationPlayer.dispatch(); - _fieldD2E = 1; + _forceCheckAnimationFl = true; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); for (int percent = 0; percent < 100; percent += 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); @@ -246,7 +246,7 @@ void Scene1000::signal() { R2_GLOBALS._sceneManager._hasPalette = false; _animationPlayer.dispatch(); - _fieldD2E = 1; + _forceCheckAnimationFl = true; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); for (int percent = 0; percent < 100; percent += 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); @@ -271,7 +271,7 @@ void Scene1000::signal() { R2_GLOBALS._sceneManager._hasPalette = false; _animationPlayer.dispatch(); - _fieldD2E = 1; + _forceCheckAnimationFl = true; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); for (int percent = 0; percent < 100; percent += 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); @@ -297,7 +297,7 @@ void Scene1000::signal() { R2_GLOBALS._sceneManager._hasPalette = false; _animationPlayer.dispatch(); - _fieldD2E = 1; + _forceCheckAnimationFl = true; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); for (int percent = 0; percent < 100; percent += 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); @@ -319,7 +319,7 @@ void Scene1000::signal() { R2_GLOBALS._sceneManager._hasPalette = false; _animationPlayer.dispatch(); - _fieldD2E = 1; + _forceCheckAnimationFl = true; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); for (int percent = 0; percent < 100; percent += 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); @@ -346,7 +346,7 @@ void Scene1000::signal() { R2_GLOBALS._sceneManager._hasPalette = false; _animationPlayer.dispatch(); - _fieldD2E = 1; + _forceCheckAnimationFl = true; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); for (int percent = 0; percent < 100; percent += 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); @@ -371,7 +371,7 @@ void Scene1000::signal() { R2_GLOBALS._sceneManager._hasPalette = false; _animationPlayer.dispatch(); - _fieldD2E = 1; + _forceCheckAnimationFl = true; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); for (int percent = 0; percent < 100; percent += 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); @@ -394,7 +394,7 @@ void Scene1000::signal() { R2_GLOBALS._sceneManager._hasPalette = false; _animationPlayer.dispatch(); - _fieldD2E = 1; + _forceCheckAnimationFl = true; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); for (int percent = 0; percent < 100; percent += 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); @@ -412,7 +412,7 @@ void Scene1000::signal() { R2_GLOBALS._sceneManager._hasPalette = false; _animationPlayer.dispatch(); - _fieldD2E = 1; + _forceCheckAnimationFl = true; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); for (int percent = 0; percent < 100; percent += 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); @@ -439,7 +439,7 @@ void Scene1000::signal() { R2_GLOBALS._sceneManager._hasPalette = false; _animationPlayer.dispatch(); - _fieldD2E = 1; + _forceCheckAnimationFl = true; R2_GLOBALS._scenePalette.fade((const byte *)&black, 1, 0); for (int percent = 0; percent < 100; percent += 5) R2_GLOBALS._scenePalette.fade((const byte *)&black, true, percent); @@ -455,9 +455,9 @@ void Scene1000::signal() { } void Scene1000::dispatch() { - if (_fieldD2E) { + if (_forceCheckAnimationFl) { if (_animationPlayer.isCompleted()) { - _fieldD2E = 0; + _forceCheckAnimationFl = false; _animationPlayer.close(); _animationPlayer.remove(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index f984a6986a8..f1700ea0253 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -46,8 +46,8 @@ public: SpeakerGameText _gameTextSpeaker; AnimationPlayer _animationPlayer; - int _field412; - int _fieldD2E; + int _animCounter; + bool _forceCheckAnimationFl; public: Scene1000(); From 6d945f8c9ac3a6a1e6f030c1d59f3b840ec50d24 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 Sep 2013 11:55:46 -0400 Subject: [PATCH 12/24] TSAGE: Bugfixes for component slots in intact ship --- .../tsage/ringworld2/ringworld2_scenes1.cpp | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 2ad40e93031..d15d0f0a092 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -7384,43 +7384,43 @@ void Scene1550::ShipComponent::setupShipComponent(int componentId) { postInit(); setup(1517, _componentId, 1); - switch (_componentId - 1) { - case 0: + switch (_componentId) { + case 1: if (R2_INVENTORY.getObjectScene(R2_GUIDANCE_MODULE) == 0) setFrame(5); setPosition(Common::Point(287, 85)); break; - case 1: + case 2: if (R2_INVENTORY.getObjectScene(R2_RADAR_MECHANISM) == 0) setFrame(5); setPosition(Common::Point(248, 100)); break; - case 2: - if (R2_INVENTORY.getObjectScene(R2_DIAGNOSTICS_DISPLAY) == 0) + case 3: + if (R2_INVENTORY.getObjectScene(R2_GYROSCOPE) == 0) setFrame(5); setPosition(Common::Point(217, 85)); break; - case 3: - if (R2_INVENTORY.getObjectScene(R2_THRUSTER_VALVE)) + case 4: + if (R2_INVENTORY.getObjectScene(R2_THRUSTER_VALVE) == 0) setFrame(5); setPosition(Common::Point(161, 121)); break; - case 4: - if (R2_INVENTORY.getObjectScene(R2_IGNITOR)) + case 5: + if (R2_INVENTORY.getObjectScene(R2_IGNITOR) == 0) setFrame(5); setPosition(Common::Point(117, 121)); break; - case 5: - if (R2_INVENTORY.getObjectScene(R2_FUEL_CELL)) + case 6: + if (R2_INVENTORY.getObjectScene(R2_FUEL_CELL) == 0) setFrame(5); setPosition(Common::Point(111, 85)); break; - case 6: - if (R2_INVENTORY.getObjectScene(R2_BATTERY)) + case 7: + if (R2_INVENTORY.getObjectScene(R2_BATTERY) == 0) setFrame(5); setPosition(Common::Point(95, 84)); break; - case 7: { + case 8: { setup(1516, 1, 1); setPosition(Common::Point(201, 45)); Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; @@ -7433,6 +7433,9 @@ void Scene1550::ShipComponent::setupShipComponent(int componentId) { default: break; } + + fixPriority(92); + setDetails(1550, 70, -1, -1, 2, (SceneItem *)NULL); } Scene1550::UnkObj15503::UnkObj15503() { From 24fe3f38a52e35326b3abe3e29dd2a22695d4467 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 Sep 2013 15:17:16 -0400 Subject: [PATCH 13/24] TSAGE: Minor fixes for ship console display and scene 1700 setup --- .../tsage/ringworld2/ringworld2_scenes1.cpp | 46 +++++++++---------- engines/tsage/ringworld2/ringworld2_scenes1.h | 4 +- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index d15d0f0a092..7a33f777bd4 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -9977,7 +9977,7 @@ void Scene1580::signal() { _arrActor[4].setPosition(Common::Point(108, 54)); } - if (R2_INVENTORY.getObjectScene(R2_JOYSTICK) != 0) { + if (R2_INVENTORY.getObjectScene(R2_JOYSTICK) != 1580) { _arrActor[5].postInit(); _arrActor[5].setup(1580, 2, 6); _arrActor[5].setPosition(Common::Point(110, 64)); @@ -10284,6 +10284,7 @@ void Scene1625::process(Event &event) { * Scene 1700 - * *--------------------------------------------------------------------------*/ + Scene1700::Scene1700() { _field77A = 0; _field77C = 0; @@ -10366,7 +10367,7 @@ void Scene1700::Exit3::changeScene() { R2_GLOBALS._player.addMover(mover, &pt, scene); } -void Scene1700::subAF3F8() { +void Scene1700::enterArea() { Rect tmpRect; R2_GLOBALS._walkRegions.load(1700); @@ -10377,9 +10378,9 @@ void Scene1700::subAF3F8() { _actor7.remove(); _actor8.remove(); _actor11.remove(); - + if (_sceneMode != 40) { - _actor9.remove(); + _ledgeHopper.remove(); _actor10.remove(); } @@ -10396,10 +10397,10 @@ void Scene1700::subAF3F8() { warning("set_pane_p(_paneNumber);"); if ((_sceneMode != 40) && (R2_GLOBALS._v565F6 != 0)){ - _actor9.postInit(); - _actor9.setup(1701, 1, 1); - _actor9.setPosition(Common::Point(220, 137)); - _actor9.setDetails(1700, 6, -1, -1, 2, (SceneItem *) NULL); + _ledgeHopper.postInit(); + _ledgeHopper.setup(1701, 1, 1); + _ledgeHopper.setPosition(Common::Point(220, 137)); + _ledgeHopper.setDetails(1700, 6, -1, -1, 2, (SceneItem *) NULL); R2_GLOBALS._walkRegions.enableRegion(2); R2_GLOBALS._walkRegions.enableRegion(12); } @@ -10470,12 +10471,9 @@ void Scene1700::postInit(SceneObjectList *OwnerList) { _stripManager.addSpeaker(&_quinnSpeaker); _stripManager.addSpeaker(&_seekerSpeaker); - _field77A = 0; - _field77C = 0; - _exit1.setDetails(Rect(94, 0, 319, 12), EXITCURSOR_N, 1700); _exit2.setDetails(Rect(0, 161, 319, 168), EXITCURSOR_S, 1700); - _exit3.setDetails(Rect(0, 0, 2, 138), EXITCURSOR_W, 1800); + _exit3.setDetails(Rect(0, 0, 12, 138), EXITCURSOR_W, 1800); R2_GLOBALS._player.postInit(); R2_GLOBALS._player.setPosition(Common::Point(0, 0)); @@ -10540,10 +10538,10 @@ void Scene1700::postInit(SceneObjectList *OwnerList) { warning("_actor10._actorName = \"hatch\";"); _actor10.hide(); - _actor9.postInit(); - _actor9.setup(1701, 1, 1); - _actor9.setPosition(Common::Point(220, 137)); - _actor9.setDetails(1700, 6, -1, -1, 1, (SceneItem *) NULL); + _ledgeHopper.postInit(); + _ledgeHopper.setup(1701, 1, 1); + _ledgeHopper.setPosition(Common::Point(220, 137)); + _ledgeHopper.setDetails(1700, 6, -1, -1, 1, (SceneItem *) NULL); _actor1.hide(); _actor2.hide(); @@ -10600,7 +10598,7 @@ void Scene1700::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player._oldCharacterScene[2] = 1700; R2_GLOBALS._v558B6.set(20, 0, 320, 200); - subAF3F8(); + enterArea(); _item1.setDetails(1, 1700, 3, -1, -1); _item2.setDetails(Rect(0, 0, 480, 200), 1700, 0, -1, -1, 1, NULL); } @@ -10616,7 +10614,7 @@ void Scene1700::signal() { _sceneMode = 3; if ((R2_GLOBALS._v565F6 < 2400) && (R2_GLOBALS._v565F6 >= 0)) ++R2_GLOBALS._v565F6; - subAF3F8(); + enterArea(); R2_GLOBALS._player.setPosition(Common::Point(235 - (((((235 - R2_GLOBALS._player._position.x) * 100) / 103) * 167) / 100), 170)); Common::Point pt(R2_GLOBALS._player._position.x, 160); NpcMover *mover = new NpcMover(); @@ -10641,7 +10639,7 @@ void Scene1700::signal() { _sceneMode = 3; if ((R2_GLOBALS._v565F6 > -2400) && (R2_GLOBALS._v565F6 < 0)) R2_GLOBALS._v565F6--; - subAF3F8(); + enterArea(); R2_GLOBALS._player.setPosition(Common::Point(235 - (((((235 - R2_GLOBALS._player._position.x) * 100) / 167) * 103) / 100), 0)); Common::Point pt(R2_GLOBALS._player._position.x, 10); NpcMover *mover = new NpcMover(); @@ -10664,7 +10662,7 @@ void Scene1700::signal() { break; case 3: if (_field77C == 0) { - R2_GLOBALS._player.enableControl(CURSOR_ARROW); + R2_GLOBALS._player.enableControl(CURSOR_CROSSHAIRS); } else { R2_GLOBALS.setFlag(15); _field77C = 0; @@ -10698,13 +10696,13 @@ void Scene1700::signal() { R2_GLOBALS._player._strip = 1; _actor12.setObjectWrapper(new SceneObjectWrapper()); _actor12._strip = 1; - R2_GLOBALS._player.enableControl(CURSOR_ARROW); + R2_GLOBALS._player.enableControl(CURSOR_CROSSHAIRS); R2_GLOBALS._walkRegions.enableRegion(14); break; case 8: R2_GLOBALS._player._strip = 2; _actor12._strip = 1; - R2_GLOBALS._player.enableControl(CURSOR_ARROW); + R2_GLOBALS._player.enableControl(CURSOR_CROSSHAIRS); R2_GLOBALS._walkRegions.enableRegion(12); break; case 30: @@ -10723,7 +10721,7 @@ void Scene1700::signal() { case 40: R2_GLOBALS._player.disableControl(); _sceneMode = 1704; - setAction(&_sequenceManager, this, 1704, &R2_GLOBALS._player, &_actor12, &_actor10, &_actor9, &_actor1, &_actor2, NULL); + setAction(&_sequenceManager, this, 1704, &R2_GLOBALS._player, &_actor12, &_actor10, &_ledgeHopper, &_actor1, &_actor2, NULL); break; case 50: if (R2_GLOBALS._player._characterIndex == R2_QUINN) @@ -10739,7 +10737,7 @@ void Scene1700::signal() { R2_GLOBALS._walkRegions.enableRegion(2); R2_GLOBALS._walkRegions.enableRegion(12); R2_GLOBALS._player.fixPriority(-1); - R2_GLOBALS._player.enableControl(CURSOR_ARROW); + R2_GLOBALS._player.enableControl(CURSOR_CROSSHAIRS); break; default: R2_GLOBALS._player.enableControl(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index f1700ea0253..fc86dd7b458 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -755,7 +755,7 @@ public: SceneActor _actor6; SceneActor _actor7; SceneActor _actor8; - SceneActor _actor9; + SceneActor _ledgeHopper; SceneActor _actor10; Actor11 _actor11; Actor12 _actor12; @@ -769,7 +769,7 @@ public: Scene1700(); void synchronize(Serializer &s); - void subAF3F8(); + void enterArea(); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void remove(); From 25de29386167c2ee16bbd278fca0c7b283ea47b6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 Sep 2013 15:55:42 -0400 Subject: [PATCH 14/24] TSAGE: Necessary synchronisation fixes to R2R SceneExt and SceneArea classes --- engines/tsage/ringworld2/ringworld2_logic.cpp | 16 ++++++++++------ engines/tsage/ringworld2/ringworld2_logic.h | 6 +----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index a50dccda03f..d06fb5cb650 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -319,11 +319,10 @@ SceneExt::SceneExt(): Scene() { for (int i = 0; i < 256; i++) _field312[i] = 0; - _field372 = _field37A = 0; + _savedPlayerEnabled = false; _savedUiEnabled = false; _savedCanWalk = false; - _focusObject = NULL; // WORKAROUND: In the original, playing animations don't reset the global _animationCtr // counter as scene changes unless the playing animation explicitly finishes. For now, @@ -332,6 +331,13 @@ SceneExt::SceneExt(): Scene() { R2_GLOBALS._animationCtr = 0; } +void SceneExt::synchronize(Serializer &s) { + Scene::synchronize(s); + + s.syncBytes(&_field312[0], 256); + _sceneAreas.synchronize(s); +} + void SceneExt::postInit(SceneObjectList *OwnerList) { Scene::postInit(OwnerList); @@ -445,7 +451,6 @@ void SceneExt::fadeOut() { void SceneExt::startStrip() { SceneExt *scene = (SceneExt *)R2_GLOBALS._sceneManager._scene; - scene->_field372 = 1; scene->_savedPlayerEnabled = R2_GLOBALS._player._enabled; if (scene->_savedPlayerEnabled) { @@ -461,7 +466,6 @@ void SceneExt::startStrip() { void SceneExt::endStrip() { SceneExt *scene = (SceneExt *)R2_GLOBALS._sceneManager._scene; - scene->_field372 = 0; if (scene->_savedPlayerEnabled) { R2_GLOBALS._player.enableControl(); @@ -1319,8 +1323,8 @@ void SceneArea::synchronize(Serializer &s) { _bounds.synchronize(s); s.syncAsSint16LE(_enabled); s.syncAsSint16LE(_insideArea); - s.syncAsSint16LE(_cursorNum); - s.syncAsSint16LE(_savedCursorNum); + s.syncAsSint32LE(_cursorNum); + s.syncAsSint32LE(_savedCursorNum); s.syncAsSint16LE(_cursorState); } diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 2b2a28aff8e..c7e36fc5f08 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -82,21 +82,17 @@ private: static void endStrip(); public: byte _field312[256]; - int _field372; bool _savedPlayerEnabled; bool _savedUiEnabled; bool _savedCanWalk; - int _field37A; - SceneObject *_focusObject; Visage _cursorVisage; SynchronizedList _sceneAreas; - - Rect _v51C34; public: SceneExt(); virtual Common::String getClassName() { return "SceneExt"; } + virtual void synchronize(Serializer &s); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void remove(); virtual void process(Event &event); From 909d8828fc3ac418e6cdd11a9b0228099b22aaa2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 1 Sep 2013 22:17:47 +0200 Subject: [PATCH 15/24] TSAGE: R2R - Some renaming in Scene 1100 --- .../tsage/ringworld2/ringworld2_scenes1.cpp | 30 +++++++++---------- engines/tsage/ringworld2/ringworld2_scenes1.h | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 7a33f777bd4..51b47d7f49f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -662,15 +662,15 @@ void Scene1020::dispatch() { * *--------------------------------------------------------------------------*/ Scene1100::Scene1100() { - _field412 = 0; - _field414 = 0; + _nextStripNum = 0; + _paletteRefreshStatus = 0; } void Scene1100::synchronize(Serializer &s) { SceneExt::synchronize(s); - s.syncAsSint16LE(_field412); - s.syncAsSint16LE(_field414); + s.syncAsSint16LE(_nextStripNum); + s.syncAsSint16LE(_paletteRefreshStatus); } bool Scene1100::Seeker::startAction(CursorType action, Event &event) { @@ -682,9 +682,9 @@ bool Scene1100::Seeker::startAction(CursorType action, Event &event) { if (R2_GLOBALS.getFlag(52)) { R2_GLOBALS._player.disableControl(); if (R2_GLOBALS._player._characterIndex == R2_QUINN) - scene->_field412 = 327; + scene->_nextStripNum = 327; else - scene->_field412 = 328; + scene->_nextStripNum = 328; scene->_sceneMode = 53; scene->setAction(&scene->_sequenceManager1, scene, 1122, &R2_GLOBALS._player, NULL); } else { @@ -757,7 +757,7 @@ bool Scene1100::Chief::startAction(CursorType action, Event &event) { Scene1100 *scene = (Scene1100 *)R2_GLOBALS._sceneManager._scene; if ((action == CURSOR_TALK) && (!R2_GLOBALS.getFlag(54)) && (R2_GLOBALS.getFlag(52))) { - scene->_field412 = 0; + scene->_nextStripNum = 0; R2_GLOBALS._player.disableControl(); scene->_sceneMode = 53; scene->setAction(&scene->_sequenceManager1, scene, 1122, &R2_GLOBALS._player, NULL); @@ -860,7 +860,7 @@ void Scene1100::postInit(SceneObjectList *OwnerList) { setAction(&_sequenceManager1, this, 1, &R2_GLOBALS._player, NULL); } else if (R2_GLOBALS._sceneManager._previousScene == 1000) { _actor2.setPosition(Common::Point(50, 30)); - _field414 = 0; + _paletteRefreshStatus = 0; _palette1.loadPalette(1101); R2_GLOBALS._player.postInit(); R2_GLOBALS._player.disableControl(); @@ -1055,7 +1055,7 @@ void Scene1100::signal() { } break; case 7: - setAction(&_sequenceManager1, this, 1103, &_chief, &_actor10); + setAction(&_sequenceManager1, this, 1103, &_chief, &_actor10, NULL); break; case 8: R2_GLOBALS._player._effect = 0; @@ -1185,7 +1185,7 @@ void Scene1100::signal() { case 53: _sceneMode = 54; R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); - if (_field412 == 0) { + if (_nextStripNum == 0) { R2_GLOBALS.setFlag(55); if (R2_GLOBALS.getFlag(55)) { if (R2_GLOBALS._player._characterIndex == R2_QUINN) @@ -1200,7 +1200,7 @@ void Scene1100::signal() { _stripManager.start(322, this); } } else { - _stripManager.start3(_field412, this, _stripManager._lookupList); + _stripManager.start3(_nextStripNum, this, _stripManager._lookupList); } break; case 54: @@ -1270,14 +1270,14 @@ void Scene1100::signal() { void Scene1100::dispatch() { if ((g_globals->_sceneObjects->contains(&_actor10)) && (_actor10._visage == 1102) && (_actor10._strip == 4) && (_actor10._frame == 1) && (_actor10._flags & OBJFLAG_HIDING)) { - if (_field414 == 1) { - _field414 = 2; + if (_paletteRefreshStatus == 1) { + _paletteRefreshStatus = 2; R2_GLOBALS._scenePalette.refresh(); } } else { - if (_field414 == 2) + if (_paletteRefreshStatus == 2) R2_GLOBALS._scenePalette.refresh(); - _field414 = 1; + _paletteRefreshStatus = 1; } Scene::dispatch(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index fc86dd7b458..1f1a7ab4c88 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -89,7 +89,7 @@ class Scene1100 : public SceneExt { }; public: - int _field412, _field414; + int _nextStripNum, _paletteRefreshStatus; SpeakerSeeker1100 _seekerSpeaker; SpeakerQuinn1100 _quinnSpeaker; SpeakerChief1100 _chiefSpeaker; From 3ab88c464aed6ec81f1b9596914b17ffb4e4ab99 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sun, 1 Sep 2013 21:59:59 +0100 Subject: [PATCH 16/24] MORTEVIELLE: Fix computation of elapsed time around midnight Replace use of getTimeAndDate() by getMillis() when computing elapsed time. This fixes an issue when playing around midnight. Also rename some variables for clarity (since they contain a time in seconds having Hour in the name was a bit confusing). --- engines/mortevielle/mortevielle.h | 6 +++--- engines/mortevielle/utils.cpp | 33 +++++++++++++------------------ 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 4c096c1f71f..cf49be1cf9e 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -214,8 +214,8 @@ private: int _minute; int _curSearchObjId; int _controlMenu; - int _startHour; - int _endHour; + int _startTime; + int _endTime; Common::Point _stdPal[91][17]; int _x26KeyCount; @@ -229,7 +229,7 @@ private: int _x; int _y; int _currentHourCount; - int _currentDayHour; + int _currentTime; Common::String _hintPctMessage; byte *_cfiecBuffer; diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 5ca29d849cb..78091431767 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -413,8 +413,8 @@ void MortevielleEngine::prepareScreenType3() { * @remarks Originally called 'calch' */ void MortevielleEngine::updateHour(int &day, int &hour, int &minute) { - int newHour = readclock(); - int th = _currentHourCount + ((newHour - _currentDayHour) / _inGameHourDuration); + int newTime = readclock(); + int th = _currentHourCount + ((newTime - _currentTime) / _inGameHourDuration); minute = ((th % 2) + _currHalfHour) * 30; hour = ((uint)th >> 1) + _currHour; if (minute == 60) { @@ -1082,7 +1082,7 @@ void MortevielleEngine::initGame() { if (!_coreVar._alreadyEnteredManor) _blo = true; _inGameHourDuration = kTime1; - _currentDayHour = readclock(); + _currentTime = readclock(); } /** @@ -1465,8 +1465,8 @@ void MortevielleEngine::gameLoaded() { _x = 0; _y = 0; _num = 0; - _startHour = 0; - _endHour = 0; + _startTime = 0; + _endTime = 0; _searchCount = 0; _roomDoorId = OWN_ROOM; _syn = true; @@ -2156,12 +2156,7 @@ void MortevielleEngine::drawRightFrame() { * Read the current system time */ int MortevielleEngine::readclock() { - TimeDate dateTime; - g_system->getTimeAndDate(dateTime); - - int m = dateTime.tm_min * 60; - int h = dateTime.tm_hour * 3600; - return h + m + dateTime.tm_sec; + return (int)(g_system->getMillis() / 1000); } /** @@ -2224,12 +2219,12 @@ void MortevielleEngine::prepareRoom() { if (_coreVar._faithScore > 65) _inGameHourDuration -= ((_inGameHourDuration / 3) * 2); - int newHour = readclock(); - if ((newHour - _currentDayHour) > _inGameHourDuration) { + int newTime = readclock(); + if ((newTime - _currentTime) > _inGameHourDuration) { bool activeMenu = _menu._menuActive; _menu.eraseMenu(); - _currentHourCount += ((newHour - _currentDayHour) / _inGameHourDuration); - _currentDayHour = newHour; + _currentHourCount += ((newTime - _currentTime) / _inGameHourDuration); + _currentTime = newTime; switch (_place) { case GREEN_ROOM: case DARKBLUE_ROOM: @@ -2279,7 +2274,7 @@ void MortevielleEngine::prepareRoom() { _currBitIndex = 0; if (!_uptodatePresence) { _uptodatePresence = true; - _startHour = readclock(); + _startTime = readclock(); if (getRandomNumber(1, 5) < 5) { clearVerbBar(); prepareScreenType2(); @@ -2297,11 +2292,11 @@ void MortevielleEngine::prepareRoom() { _menu.drawMenu(); } } - _endHour = readclock(); - if ((_uptodatePresence) && ((_endHour - _startHour) > 17)) { + _endTime = readclock(); + if ((_uptodatePresence) && ((_endTime - _startTime) > 17)) { getPresenceBitIndex(_place); _uptodatePresence = false; - _startHour = 0; + _startTime = 0; if ((_coreVar._currPlace > OWN_ROOM) && (_coreVar._currPlace < DINING_ROOM)) _anyone = true; } From 8216e6dabfb2f460ff92fd7d04688fb0b34072fa Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sun, 1 Sep 2013 22:04:20 +0100 Subject: [PATCH 17/24] MORTEVIELLE: Freeze clock in game when pausing the game --- engines/mortevielle/mortevielle.cpp | 20 ++++++++++++++++++++ engines/mortevielle/mortevielle.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index f13f8cb65b2..d4341509772 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -63,6 +63,7 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const MortevielleGameDescr _mouseClick = false; _inMainGameLoop = false; _quitGame = false; + _pauseStartTime = -1; _roomPresenceLuc = false; _roomPresenceIda = false; @@ -164,6 +165,25 @@ Common::String MortevielleEngine::generateSaveFilename(const Common::String &tar return Common::String::format("%s.%03d", target.c_str(), slot); } +/** + * Pause the game. + */ +void MortevielleEngine::pauseEngineIntern(bool pause) { + Engine::pauseEngineIntern(pause); + if (pause) { + if (_pauseStartTime == -1) + _pauseStartTime = readclock(); + } else { + if (_pauseStartTime != -1) { + int pauseEndTime = readclock(); + _currentTime += (pauseEndTime - _pauseStartTime); + if (_uptodatePresence) + _startTime += (pauseEndTime - _pauseStartTime); + } + _pauseStartTime = -1; + } +} + /** * Initialize the game state */ diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index cf49be1cf9e..fc4961be8cd 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -230,6 +230,7 @@ private: int _y; int _currentHourCount; int _currentTime; + int _pauseStartTime; Common::String _hintPctMessage; byte *_cfiecBuffer; @@ -446,6 +447,7 @@ public: virtual Common::Error loadGameState(int slot); virtual Common::Error saveGameState(int slot, const Common::String &desc); virtual Common::Error run(); + virtual void pauseEngineIntern(bool pause); uint32 getGameFlags() const; Common::Language getLanguage() const; Common::Language getOriginalLanguage() const; From 6478a78a8ed66d27a4612540a8a442a61eb83b0b Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sun, 1 Sep 2013 22:28:03 +0100 Subject: [PATCH 18/24] MORTEVIELLE: Implement Engine::getDebugger() --- engines/mortevielle/mortevielle.h | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index fc4961be8cd..5ae94987a0e 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -448,6 +448,7 @@ public: virtual Common::Error saveGameState(int slot, const Common::String &desc); virtual Common::Error run(); virtual void pauseEngineIntern(bool pause); + virtual GUI::Debugger *getDebugger() {return &_debugger;} uint32 getGameFlags() const; Common::Language getLanguage() const; Common::Language getOriginalLanguage() const; From 41cb4023e620cd77ee336912dc6d83511e3fb67f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 Sep 2013 17:40:57 -0400 Subject: [PATCH 19/24] TSAGE: Cleanup and fixes for R2R ring edge --- .../tsage/ringworld2/ringworld2_scenes1.cpp | 32 +++++++++---------- engines/tsage/ringworld2/ringworld2_scenes1.h | 12 +++---- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 51b47d7f49f..36836ffa63c 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -10331,7 +10331,7 @@ bool Scene1700::Actor12::startAction(CursorType action, Event &event) { return true; } -void Scene1700::Exit1::changeScene() { +void Scene1700::NorthExit::changeScene() { Scene1700 *scene = (Scene1700 *)R2_GLOBALS._sceneManager._scene; R2_GLOBALS._player.disableControl(); @@ -10343,7 +10343,7 @@ void Scene1700::Exit1::changeScene() { R2_GLOBALS._player.addMover(mover, &pt, scene); } -void Scene1700::Exit2::changeScene() { +void Scene1700::SouthExit::changeScene() { Scene1700 *scene = (Scene1700 *)R2_GLOBALS._sceneManager._scene; R2_GLOBALS._player.disableControl(); @@ -10355,7 +10355,7 @@ void Scene1700::Exit2::changeScene() { R2_GLOBALS._player.addMover(mover, &pt, scene); } -void Scene1700::Exit3::changeScene() { +void Scene1700::WestExit::changeScene() { Scene1700 *scene = (Scene1700 *)R2_GLOBALS._sceneManager._scene; R2_GLOBALS._player.disableControl(); @@ -10396,7 +10396,7 @@ void Scene1700::enterArea() { warning("set_pane_p(_paneNumber);"); - if ((_sceneMode != 40) && (R2_GLOBALS._v565F6 != 0)){ + if (_sceneMode != 40 && R2_GLOBALS._v565F6 == 0 && R2_GLOBALS._v565F8 == 0) { _ledgeHopper.postInit(); _ledgeHopper.setup(1701, 1, 1); _ledgeHopper.setPosition(Common::Point(220, 137)); @@ -10435,10 +10435,10 @@ void Scene1700::enterArea() { _actor7.fixPriority(0); _actor7.setDetails(100, -1, -1, -1, 2, (SceneItem *) NULL); - _exit3._enabled = true; + _westExit._enabled = true; } else { R2_GLOBALS._walkRegions.enableRegion(1); - _exit3._enabled = false; + _westExit._enabled = false; } if ( ((!R2_GLOBALS.getFlag(15)) && ((R2_GLOBALS._v565F6 == 25) || (R2_GLOBALS._v565F6 == -3))) @@ -10471,9 +10471,9 @@ void Scene1700::postInit(SceneObjectList *OwnerList) { _stripManager.addSpeaker(&_quinnSpeaker); _stripManager.addSpeaker(&_seekerSpeaker); - _exit1.setDetails(Rect(94, 0, 319, 12), EXITCURSOR_N, 1700); - _exit2.setDetails(Rect(0, 161, 319, 168), EXITCURSOR_S, 1700); - _exit3.setDetails(Rect(0, 0, 12, 138), EXITCURSOR_W, 1800); + _northExit.setDetails(Rect(94, 0, 319, 12), EXITCURSOR_N, 1700); + _southExit.setDetails(Rect(0, 161, 319, 168), EXITCURSOR_S, 1700); + _westExit.setDetails(Rect(0, 0, 12, 138), EXITCURSOR_W, 1800); R2_GLOBALS._player.postInit(); R2_GLOBALS._player.setPosition(Common::Point(0, 0)); @@ -10545,7 +10545,7 @@ void Scene1700::postInit(SceneObjectList *OwnerList) { _actor1.hide(); _actor2.hide(); - R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + R2_GLOBALS._events.setCursor(CURSOR_WALK); _stripManager.start(539, this); _sceneMode = 40; break; @@ -10662,12 +10662,12 @@ void Scene1700::signal() { break; case 3: if (_field77C == 0) { - R2_GLOBALS._player.enableControl(CURSOR_CROSSHAIRS); + R2_GLOBALS._player.enableControl(CURSOR_WALK); } else { R2_GLOBALS.setFlag(15); _field77C = 0; _sceneMode = 31; - R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); + R2_GLOBALS._events.setCursor(CURSOR_WALK); if (R2_GLOBALS._player._characterIndex == R2_QUINN) _stripManager.start(542, this); else @@ -10696,13 +10696,13 @@ void Scene1700::signal() { R2_GLOBALS._player._strip = 1; _actor12.setObjectWrapper(new SceneObjectWrapper()); _actor12._strip = 1; - R2_GLOBALS._player.enableControl(CURSOR_CROSSHAIRS); + R2_GLOBALS._player.enableControl(CURSOR_WALK); R2_GLOBALS._walkRegions.enableRegion(14); break; case 8: R2_GLOBALS._player._strip = 2; _actor12._strip = 1; - R2_GLOBALS._player.enableControl(CURSOR_CROSSHAIRS); + R2_GLOBALS._player.enableControl(CURSOR_WALK); R2_GLOBALS._walkRegions.enableRegion(12); break; case 30: @@ -10737,7 +10737,7 @@ void Scene1700::signal() { R2_GLOBALS._walkRegions.enableRegion(2); R2_GLOBALS._walkRegions.enableRegion(12); R2_GLOBALS._player.fixPriority(-1); - R2_GLOBALS._player.enableControl(CURSOR_CROSSHAIRS); + R2_GLOBALS._player.enableControl(CURSOR_WALK); break; default: R2_GLOBALS._player.enableControl(); @@ -11018,8 +11018,6 @@ void Scene1750::postInit(SceneObjectList *OwnerList) { } void Scene1750::remove() { - _rotation->remove(); - if (R2_GLOBALS._v565F6 == 2400) R2_GLOBALS._v565F6 = 2399; diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index 1f1a7ab4c88..eb0ae4d71d0 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -730,15 +730,15 @@ class Scene1700 : public SceneExt { virtual bool startAction(CursorType action, Event &event); }; - class Exit1 : public SceneExit { + class NorthExit : public SceneExit { public: virtual void changeScene(); }; - class Exit2 : public SceneExit { + class SouthExit : public SceneExit { public: virtual void changeScene(); }; - class Exit3 : public SceneExit { + class WestExit : public SceneExit { public: virtual void changeScene(); }; @@ -759,9 +759,9 @@ public: SceneActor _actor10; Actor11 _actor11; Actor12 _actor12; - Exit1 _exit1; - Exit2 _exit2; - Exit3 _exit3; + NorthExit _northExit; + SouthExit _southExit; + WestExit _westExit; SequenceManager _sequenceManager; int _field77A; From 6ad9f5158c6c79362a22bc49ec56b73c16130164 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 Sep 2013 19:20:45 -0400 Subject: [PATCH 20/24] TSAGE: Fix for reseting linked actors in R2R when changing scene --- engines/tsage/core.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 0080226cbee..5ad5b01f8b0 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -3267,6 +3267,7 @@ void Player::postInit(SceneObjectList *OwnerList) { _moveDiff.y = 2; _effect = 1; _shade = 0; + _linkedActor = NULL; setObjectWrapper(new SceneObjectWrapper()); setPosition(_characterPos[_characterIndex]); From 22b30152a0c32000be5cfcda57d764c92c4d2510 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 2 Sep 2013 01:27:21 +0200 Subject: [PATCH 21/24] TSAGE: R2R - More renaming in Scene 1100 --- .../tsage/ringworld2/ringworld2_scenes1.cpp | 137 +++++++++--------- engines/tsage/ringworld2/ringworld2_scenes1.h | 28 ++-- 2 files changed, 83 insertions(+), 82 deletions(-) diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 36836ffa63c..776c56c69f1 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -873,25 +873,25 @@ void Scene1100::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player._moveRate = 30; R2_GLOBALS._player._moveDiff = Common::Point(16, 2); - _object1.setup2(1104, 2, 1, 175, 125, 102, 1); + _rightLandslide.setup2(1104, 2, 1, 175, 125, 102, 1); _object2.setup2(1102, 5, 1, 216, 167, 1, 0); - _actor12.postInit(); - _actor12.setup(1113, 2, 1); - _actor12.setPosition(Common::Point(67, 151)); - _actor12.fixPriority(255); + _leftImpacts.postInit(); + _leftImpacts.setup(1113, 2, 1); + _leftImpacts.setPosition(Common::Point(67, 151)); + _leftImpacts.fixPriority(255); - _actor3.postInit(); - _actor3.setup(1102, 6, 1); - _actor3._moveRate = 30; - _actor3._moveDiff.x = 2; + _shipFormation.postInit(); + _shipFormation.setup(1102, 6, 1); + _shipFormation._moveRate = 30; + _shipFormation._moveDiff.x = 2; - _actor4.postInit(); - _actor4.setup(1102, 6, 2); - _actor4._moveRate = 30; - _actor4._moveDiff.x = 2; - _actor4._effect = 5; - _actor4._field9C = _field312; + _shipFormationShadow.postInit(); + _shipFormationShadow.setup(1102, 6, 2); + _shipFormationShadow._moveRate = 30; + _shipFormationShadow._moveDiff.x = 2; + _shipFormationShadow._effect = 5; + _shipFormationShadow._field9C = _field312; R2_GLOBALS._sound1.play(86); @@ -993,30 +993,30 @@ void Scene1100::remove() { void Scene1100::signal() { switch (_sceneMode++) { case 0: - _actor3.setPosition(Common::Point(350, 20)); + _shipFormation.setPosition(Common::Point(350, 20)); setAction(&_sequenceManager1, this, 1, &R2_GLOBALS._player, NULL); break; case 1:{ Common::Point pt(-150, 20); NpcMover *mover = new NpcMover(); - _actor3.addMover(mover, &pt, this); - _actor4.setPosition(Common::Point(350, 55)); + _shipFormation.addMover(mover, &pt, this); + _shipFormationShadow.setPosition(Common::Point(350, 55)); Common::Point pt2(-150, 55); NpcMover *mover2 = new NpcMover(); - _actor4.addMover(mover2, &pt2, NULL); + _shipFormationShadow.addMover(mover2, &pt2, NULL); } break; case 2: - _actor3.remove(); - _actor4.remove(); - _actor5.postInit(); - _actor6.postInit(); - _actor7.postInit(); - _actor8.postInit(); - _actor9.postInit(); - _actor10.postInit(); - setAction(&_sequenceManager1, this, 1102, &_actor5, &_actor6, &_actor7, &_actor8, &_actor9, &_actor10, NULL); + _shipFormation.remove(); + _shipFormationShadow.remove(); + _shotImpact1.postInit(); + _shotImpact2.postInit(); + _shotImpact3.postInit(); + _shotImpact4.postInit(); + _shotImpact5.postInit(); + _laserShot.postInit(); + setAction(&_sequenceManager1, this, 1102, &_shotImpact1, &_shotImpact2, &_shotImpact3, &_shotImpact4, &_shotImpact5, &_laserShot, NULL); break; case 3: { R2_GLOBALS._sound2.play(84); @@ -1029,24 +1029,24 @@ void Scene1100::signal() { case 4: _chief.postInit(); _chief.show(); - setAction(&_sequenceManager1, this, 1101, &_chief, &_actor10, NULL); + setAction(&_sequenceManager1, this, 1101, &_chief, &_laserShot, NULL); break; case 5: - _actor13.postInit(); - _actor13._effect = 6; - _actor13.setup(1103, 3, 1); - _actor13._moveRate = 30; + _runningGuy1.postInit(); + _runningGuy1._effect = 6; + _runningGuy1.setup(1103, 3, 1); + _runningGuy1._moveRate = 30; - _actor14.postInit(); - _actor14._effect = 6; - _actor14.setup(1103, 4, 1); - _actor4._moveRate = 25; + _runningGuy2.postInit(); + _runningGuy2._effect = 6; + _runningGuy2.setup(1103, 4, 1); + _runningGuy2._moveRate = 25; - _actor13.setAction(&_sequenceManager2, this, 1109, &_actor13, &_actor14, NULL); + _runningGuy1.setAction(&_sequenceManager2, this, 1109, &_runningGuy1, &_runningGuy2, NULL); break; case 6: { - _actor13.remove(); - _actor14.remove(); + _runningGuy1.remove(); + _runningGuy2.remove(); R2_GLOBALS._player.setPosition(Common::Point(-50, 136)); R2_GLOBALS._sound2.play(84); Common::Point pt(350, 236); @@ -1055,29 +1055,30 @@ void Scene1100::signal() { } break; case 7: - setAction(&_sequenceManager1, this, 1103, &_chief, &_actor10, NULL); + setAction(&_sequenceManager1, this, 1103, &_chief, &_laserShot, NULL); break; case 8: R2_GLOBALS._player._effect = 0; - _actor11.postInit(); - setAction(&_sequenceManager1, this, 1105, &R2_GLOBALS._player, &_actor10, &_actor11, &_chief, NULL); + _animation.postInit(); + setAction(&_sequenceManager1, this, 1105, &R2_GLOBALS._player, &_laserShot, &_animation, &_chief, NULL); break; case 9: - _object1.copySceneToBackground(); + _rightLandslide.copySceneToBackground(); - _actor15.postInit(); - _actor15.setup(1103, 2, 1); - _actor15._moveRate = 30; - _actor15.setAction(&_sequenceManager3, this, 1107, &_actor15, NULL); + _runningGuy3.postInit(); + _runningGuy3.setup(1103, 2, 1); + _runningGuy3._moveRate = 30; + _runningGuy3.setAction(&_sequenceManager3, this, 1107, &_runningGuy3, NULL); break; case 10: - _actor13.postInit(); - _actor13.setup(1103, 1, 1); - _actor13._moveRate = 15; - _actor13.setAction(&_sequenceManager2, this, 1108, &_actor13, NULL); + _runningGuy1.postInit(); + _runningGuy1.setup(1103, 1, 1); + _runningGuy1._moveRate = 15; + _runningGuy1.setAction(&_sequenceManager2, this, 1108, &_runningGuy1, NULL); break; case 11: { - setAction(&_sequenceManager1, this, 1106, &_actor11, &_actor10, &_actor12, NULL); + setAction(&_sequenceManager1, this, 1106, &_animation, &_laserShot, &_leftImpacts, NULL); + R2_GLOBALS._player._effect = 5; R2_GLOBALS._player.setup(1102, 3, 2); R2_GLOBALS._player.setPosition(Common::Point(-50, 131)); @@ -1094,16 +1095,16 @@ void Scene1100::signal() { _trooper.postInit(); R2_GLOBALS._scrollFollower = &_trooper; - _actor11.setup(1100, 2, 1); - _actor11.setPosition(Common::Point(408, 121)); + _animation.setup(1100, 2, 1); + _animation.setPosition(Common::Point(408, 121)); - _actor10.setup(1100, 3, 5); - _actor10.setPosition(Common::Point(409, 121)); + _laserShot.setup(1100, 3, 5); + _laserShot.setPosition(Common::Point(409, 121)); setAction(&_sequenceManager1, this, 1104, &_trooper, NULL); break; case 14: - setAction(&_sequenceManager1, this, 1100, &_actor11, &_actor10, NULL); + setAction(&_sequenceManager1, this, 1100, &_animation, &_laserShot, NULL); break; case 15: R2_GLOBALS._sceneManager.changeScene(1000); @@ -1269,7 +1270,7 @@ void Scene1100::signal() { } void Scene1100::dispatch() { - if ((g_globals->_sceneObjects->contains(&_actor10)) && (_actor10._visage == 1102) && (_actor10._strip == 4) && (_actor10._frame == 1) && (_actor10._flags & OBJFLAG_HIDING)) { + if ((g_globals->_sceneObjects->contains(&_laserShot)) && (_laserShot._visage == 1102) && (_laserShot._strip == 4) && (_laserShot._frame == 1) && (_laserShot._flags & OBJFLAG_HIDING)) { if (_paletteRefreshStatus == 1) { _paletteRefreshStatus = 2; R2_GLOBALS._scenePalette.refresh(); @@ -1282,20 +1283,20 @@ void Scene1100::dispatch() { Scene::dispatch(); - if (R2_GLOBALS._player._bounds.contains(_actor13._position)) - _actor13._shade = 3; + if (R2_GLOBALS._player._bounds.contains(_runningGuy1._position)) + _runningGuy1._shade = 3; else - _actor13._shade = 0; + _runningGuy1._shade = 0; - if (R2_GLOBALS._player._bounds.contains(_actor14._position)) - _actor14._shade = 3; + if (R2_GLOBALS._player._bounds.contains(_runningGuy2._position)) + _runningGuy2._shade = 3; else - _actor14._shade = 0; + _runningGuy2._shade = 0; - if (R2_GLOBALS._player._bounds.contains(_actor15._position)) - _actor15._shade = 3; + if (R2_GLOBALS._player._bounds.contains(_runningGuy3._position)) + _runningGuy3._shade = 3; else - _actor15._shade = 0; + _runningGuy3._shade = 0; } void Scene1100::saveCharacter(int characterIndex) { diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index eb0ae4d71d0..6449f5bae1b 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -103,20 +103,20 @@ public: NamedHotspot _item7; 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; - BackgroundSceneObject _object1; + SceneActor _shipFormation; + SceneActor _shipFormationShadow; + SceneActor _shotImpact1; + SceneActor _shotImpact2; + SceneActor _shotImpact3; + SceneActor _shotImpact4; + SceneActor _shotImpact5; + SceneActor _laserShot; + SceneActor _animation; + SceneActor _leftImpacts; + SceneActor _runningGuy1; + SceneActor _runningGuy2; + SceneActor _runningGuy3; + BackgroundSceneObject _rightLandslide; BackgroundSceneObject _object2; Seeker _seeker; Trooper _trooper; From dce42abe46a578621b691311cb82de1c2cd62895 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 Sep 2013 22:23:35 -0400 Subject: [PATCH 22/24] TSAGE: Implemented dispatch method for R2R scene 1750 --- engines/tsage/globals.cpp | 4 +- engines/tsage/globals.h | 1 - engines/tsage/ringworld2/ringworld2_logic.cpp | 4 +- .../tsage/ringworld2/ringworld2_scenes1.cpp | 383 +++++++++++------- engines/tsage/ringworld2/ringworld2_scenes1.h | 48 +-- 5 files changed, 257 insertions(+), 183 deletions(-) diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 3e0ef4744ff..22b0d7280ae 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -410,7 +410,6 @@ void Ringworld2Globals::reset() { _v565EB = 26; _foodCount = 0; _v565F6 = 0; - _v565F8 = 0; _v565FA = 0; _v565AE = 0; _v56605[0] = 0; @@ -525,8 +524,7 @@ void Ringworld2Globals::synchronize(Serializer &s) { s.syncAsSint16LE(_v565E9); s.syncAsSint16LE(_v565EB); s.syncAsSint16LE(_foodCount); - s.syncAsSint16LE(_v565F6); - s.syncAsSint16LE(_v565F8); + s.syncAsSint32LE(_v565F6); s.syncAsSint16LE(_v565FA); s.syncAsSint16LE(_landerSuitNumber); s.syncAsSint16LE(_v566A6); diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 839895cea53..01e1594502a 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -266,7 +266,6 @@ public: int _v565EB; int _foodCount; int _v565F6; - int _v565F8; int _v565FA; int _v5657C; byte _v565AE; diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index d06fb5cb650..2d55b8c524e 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -2271,9 +2271,9 @@ void ScannerDialog::Button::reset() { break; case 1700: case 1800: - if (R2_GLOBALS._v565F8 < 0 || (R2_GLOBALS._v565F8 == 0 && R2_GLOBALS._v565F6 < 1201)) + if (R2_GLOBALS._v565F6 < 1201) scanner._obj4.setup(4, 3, 3); - else if (R2_GLOBALS._v565F8 > 0 || (R2_GLOBALS._v565F8 == 0 && R2_GLOBALS._v565F6 < 1201)) + else if (R2_GLOBALS._v565F6 < 1201) scanner._obj4.setup(4, 3, 4); else scanner._obj4.setup(4, 3, 5); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 776c56c69f1..2925347d789 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -10397,7 +10397,7 @@ void Scene1700::enterArea() { warning("set_pane_p(_paneNumber);"); - if (_sceneMode != 40 && R2_GLOBALS._v565F6 == 0 && R2_GLOBALS._v565F8 == 0) { + if (_sceneMode != 40 && R2_GLOBALS._v565F6 == 0) { _ledgeHopper.postInit(); _ledgeHopper.setup(1701, 1, 1); _ledgeHopper.setPosition(Common::Point(220, 137)); @@ -10747,43 +10747,154 @@ void Scene1700::signal() { } /*-------------------------------------------------------------------------- - * Scene 1750 - + * Scene 1750 - Rim Transport * *--------------------------------------------------------------------------*/ -Scene1750::Actor4::Actor4() { - _fieldA4 = 0; - _fieldA6 = 0; - _fieldA8 = 0; - _fieldAA = 0; - _fieldAC = 0; - _fieldAE = 0; + +Scene1750::Button::Button() { + _buttonId = 0; } -void Scene1750::Actor4::synchronize(Serializer &s) { +void Scene1750::Button::synchronize(Serializer &s) { SceneActor::synchronize(s); - s.syncAsSint16LE(_fieldA4); - s.syncAsSint16LE(_fieldA6); - s.syncAsSint16LE(_fieldA8); - s.syncAsSint16LE(_fieldAA); - s.syncAsSint16LE(_fieldAC); - s.syncAsSint16LE(_fieldAE); + s.syncAsSint16LE(_buttonId); } -Scene1750::Actor5::Actor5() { - _fieldA4 = 0; +bool Scene1750::Button::startAction(CursorType action, Event &event) { + if (action != CURSOR_USE) + return SceneActor::startAction(action, event); + + Scene1750 *scene = (Scene1750 *)R2_GLOBALS._sceneManager._scene; + + switch (_buttonId) { + case 1: + // Forward button + show(); + scene->_backwardButton.hide(); + if (scene->_speed < 0) + scene->_speed = -scene->_speed; + scene->_direction = 1; + break; + case 2: + // Backwards button + show(); + scene->_forwardButton.hide(); + if (scene->_speed > 0) + scene->_speed = -scene->_speed; + scene->_direction = -1; + break; + case 3: + // Exit button + if (scene->_rotation->_idxChange == 0) { + show(); + R2_GLOBALS._sceneManager.changeScene(1700); + } else { + scene->_speed = 0; + scene->_speedSlider._moveRate = 20; + scene->_forwardButton._moveDiff.y = 1; + Common::Point pt(286, 143); + NpcMover *mover = new NpcMover(); + scene->_speedSlider.addMover(mover, &pt, NULL); + } + default: + break; + } + + return true; } -void Scene1750::Actor5::synchronize(Serializer &s) { +/*------------------------------------------------------------------------*/ + +Scene1750::SpeedSlider::SpeedSlider() { + _incrAmount = 0; + _xp = 0; + _ys = 0; + _height = 0; + _thumbHeight = 0; + _mouseDown = false; +} + +void Scene1750::SpeedSlider::synchronize(Serializer &s) { SceneActor::synchronize(s); - s.syncAsSint16LE(_fieldA4); + s.syncAsSint16LE(_incrAmount); + s.syncAsSint16LE(_xp); + s.syncAsSint16LE(_ys); + s.syncAsSint16LE(_height); + s.syncAsSint16LE(_thumbHeight); + s.syncAsSint16LE(_mouseDown); } +void Scene1750::SpeedSlider::setupSlider(int incrAmount, int xp, int ys, int height, int thumbHeight) { + _mouseDown = false; + _incrAmount = incrAmount; + _xp = xp; + _ys = ys; + _height = height; + _thumbHeight = thumbHeight; + + postInit(); + setup(1750, 1, 1); + fixPriority(255); + setPosition(Common::Point(_xp, _ys + ((_height * (incrAmount - 1)) / (_thumbHeight - 1)))); +} + +void Scene1750::SpeedSlider::calculateSlider() { + Scene1750 *scene = (Scene1750 *)R2_GLOBALS._sceneManager._scene; + + int tmpVar = (_height / (_thumbHeight - 1)) / 2; + int tmpVar2 = ((_position.y - _ys + tmpVar) * _thumbHeight) / (_height + 2 * tmpVar); + + setPosition(Common::Point(_xp, _ys + ((_height * tmpVar2) / (_thumbHeight - 1)))); + scene->_speed = scene->_direction * tmpVar2; +} + +void Scene1750::SpeedSlider::remove() { + // Function kept to match IDA. Could be removed. + SceneActor::remove(); +} + +void Scene1750::SpeedSlider::process(Event &event) { + if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_USE) && + (_bounds.contains(event.mousePos))) { + _mouseDown = true; + event.eventType = EVENT_NONE; + } + + if ((event.eventType == EVENT_BUTTON_UP) && _mouseDown) { + _mouseDown = false; + event.handled = true; + addMover(NULL); + calculateSlider(); + } + + if (_mouseDown) { + event.handled = true; + if (event.mousePos.y >= _ys) { + if (_ys + _height >= event.mousePos.y) + setPosition(Common::Point(_xp, event.mousePos.y)); + else + setPosition(Common::Point(_xp, _ys + _height)); + } else { + setPosition(Common::Point(_xp, _ys)); + } + } +} + +bool Scene1750::SpeedSlider::startAction(CursorType action, Event &event) { + if (action == CURSOR_USE) + return SceneActor::startAction(action, event); + + return false; +} + +/*------------------------------------------------------------------------*/ + Scene1750::Scene1750() { - _field412 = 0; + _direction = 0; _field413 = 0; - _field415 = 0; + _speed = 0; _field417 = 0; _field419 = 0; _field41B = 0; @@ -10794,117 +10905,15 @@ void Scene1750::synchronize(Serializer &s) { SceneExt::synchronize(s); SYNC_POINTER(_rotation); - s.syncAsSint16LE(_field412); + s.syncAsSint16LE(_direction); s.syncAsSint16LE(_field413); - s.syncAsSint16LE(_field415); + s.syncAsSint16LE(_speed); s.syncAsSint16LE(_field417); s.syncAsSint16LE(_field419); s.syncAsSint16LE(_field41B); s.syncAsSint16LE(_field41D); } -void Scene1750::Actor4::subB1A76(int arg1, int arg2, int arg3, int arg4, int arg5) { - _fieldA4 = arg1; - _fieldAE = 0; - _fieldA6 = arg2; - _fieldA8 = arg3; - _fieldAA = arg4; - _fieldAC = arg5; - - postInit(); - setup(1750, 1, 1); - fixPriority(255); - setPosition(Common::Point(_fieldA6, _fieldA8 + ((_fieldAA * (arg1 - 1)) / (_fieldAC - 1)))); -} - -void Scene1750::Actor4::subB1B27() { - Scene1750 *scene = (Scene1750 *)R2_GLOBALS._sceneManager._scene; - - int tmpVar = (_fieldAA / (_fieldAC - 1)) / 2; - int tmpVar2 = ((_position.y - _fieldA8 + tmpVar) * _fieldAC) / (_fieldAA + 2 * tmpVar); - - setPosition(Common::Point(_fieldA6, _fieldA8 + ((_fieldAA * tmpVar2) / (_fieldAC - 1)))); - scene->_field415 = scene->_field412 * tmpVar2; -} - -void Scene1750::Actor4::remove() { - // Function kept to match IDA. Could be removed. - SceneActor::remove(); -} - -void Scene1750::Actor4::process(Event &event) { - if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_USE) && (_bounds.contains(event.mousePos))) { - _fieldAE = 1; - event.eventType = EVENT_NONE; - } - - if ((event.eventType == EVENT_BUTTON_UP) && (_fieldAE != 0)) { - _fieldAE = 0; - event.handled = true; - addMover(NULL); - subB1B27(); - } - - if (_fieldAE != 0) { - event.handled = true; - if (event.mousePos.y >= _fieldA8) { - if (_fieldA8 + _fieldAA >= event.mousePos.y) - setPosition(Common::Point(_fieldA6, event.mousePos.y)); - else - setPosition(Common::Point(_fieldA6, _fieldA8 + _fieldAA)); - } else { - setPosition(Common::Point(_fieldA6, _fieldA8)); - } - } -} - -bool Scene1750::Actor4::startAction(CursorType action, Event &event) { - if (action == CURSOR_USE) - return SceneActor::startAction(action, event); - - return false; -} - -bool Scene1750::Actor5::startAction(CursorType action, Event &event) { - if (action != CURSOR_USE) - return SceneActor::startAction(action, event); - - Scene1750 *scene = (Scene1750 *)R2_GLOBALS._sceneManager._scene; - - switch (_fieldA4) { - case 1: - show(); - scene->_actor6.hide(); - if (scene->_field415 < 0) - scene->_field415 ^= 0xFFFE; - scene->_field412 = 1; - break; - case 2: - show(); - scene->_actor5.hide(); - if (scene->_field415 > 0) - scene->_field415 ^= 0xFFFE; - scene->_field412 = -1; - break; - case 3: - if (scene->_rotation->_idxChange == 0) { - show(); - R2_GLOBALS._sceneManager.changeScene(1700); - } else { - scene->_field415 = 0; - scene->_actor4._moveRate = 20; - scene->_actor5._moveDiff.y = 1; - Common::Point pt(286, 143); - NpcMover *mover = new NpcMover(); - scene->_actor4.addMover(mover, &pt, NULL); - } - default: - break; - } - - return true; -} - void Scene1750::postInit(SceneObjectList *OwnerList) { loadScene(1750); R2_GLOBALS._sound1.play(115); @@ -10983,39 +10992,39 @@ void Scene1750::postInit(SceneObjectList *OwnerList) { else _actor2.setPosition(Common::Point(148, (tmpVar * 7) + 122)); - _actor4.subB1A76(1, 286, 143, 41, 15); - _actor4.setDetails(1750, 24, 1, -1, 1, (SceneItem *) NULL); + _speedSlider.setupSlider(1, 286, 143, 41, 15); + _speedSlider.setDetails(1750, 24, 1, -1, 1, (SceneItem *) NULL); - _actor5.postInit(); - _actor5._fieldA4 = 1; - _actor5.setup(1750, 1, 2); - _actor5.setPosition(Common::Point(192, 140)); - _actor5.setDetails(1750, 18, 1, -1, 1, (SceneItem *) NULL); + _forwardButton.postInit(); + _forwardButton._buttonId = 1; + _forwardButton.setup(1750, 1, 2); + _forwardButton.setPosition(Common::Point(192, 140)); + _forwardButton.setDetails(1750, 18, 1, -1, 1, (SceneItem *) NULL); - _actor6.postInit(); - _actor6._fieldA4 = 2; - _actor6.setup(1750, 1, 3); - _actor6.setPosition(Common::Point(192, 163)); - _actor6.setDetails(1750, 18, 1, -1, 1, (SceneItem *) NULL); - _actor6.hide(); + _backwardButton.postInit(); + _backwardButton._buttonId = 2; + _backwardButton.setup(1750, 1, 3); + _backwardButton.setPosition(Common::Point(192, 163)); + _backwardButton.setDetails(1750, 18, 1, -1, 1, (SceneItem *) NULL); + _backwardButton.hide(); - _actor7.postInit(); - _actor7._fieldA4 = 3; - _actor7.setup(1750, 1, 5); - _actor7.setPosition(Common::Point(230, 183)); - _actor7.setDetails(1750, 27, 1, -1, 1, (SceneItem *) NULL); + _exitButton.postInit(); + _exitButton._buttonId = 3; + _exitButton.setup(1750, 1, 5); + _exitButton.setPosition(Common::Point(230, 183)); + _exitButton.setDetails(1750, 27, 1, -1, 1, (SceneItem *) NULL); - _field412 = 1; + _direction = 1; // Forward by default _field417 = 0; _field413 = 0; - _field415 = 0; + _speed = 0; _field419 = ((_rotation->_currIndex - 218) / 4) % 4; - _item2.setDetails(Rect(129, 112, 155, 175), 1750, 21, -1, -1, 1, NULL); - _item3.setDetails(Rect(93, 122, 126, 172), 1750, 15, -1, -1, 1, NULL); - _item4.setDetails(Rect(3, 3, 157, 99), 1750, 9, -1, -1, 1, NULL); - _item5.setDetails(Rect(162, 3, 316, 99), 1750, 12, -1, -1, 1, NULL); - _item1.setDetails(Rect(0, 0, 320, 200), 1750, 6, 1, -1, 1, NULL); + _redLights.setDetails(Rect(129, 112, 155, 175), 1750, 21, -1, -1, 1, NULL); + _greenLights.setDetails(Rect(93, 122, 126, 172), 1750, 15, -1, -1, 1, NULL); + _frontView.setDetails(Rect(3, 3, 157, 99), 1750, 9, -1, -1, 1, NULL); + _rearView.setDetails(Rect(162, 3, 316, 99), 1750, 12, -1, -1, 1, NULL); + _background.setDetails(Rect(0, 0, 320, 200), 1750, 6, 1, -1, 1, NULL); } void Scene1750::remove() { @@ -11041,10 +11050,78 @@ void Scene1750::signal() { void Scene1750::process(Event &event) { Scene::process(event); if (!event.handled) - _actor4.process(event); + _speedSlider.process(event); } -void Scene1750::dispatch() {} +void Scene1750::dispatch() { + if (_rotation) { + if (!_field417 && (_speed != _field413)) { + if (_field413 >= _speed) + --_field413; + else + ++_field413; + + _field417 = 21 - ABS(_field413); + } + + if (_field417 == 1) { + if (_field413 == 0) { + _actor3.show(); + _rotation->_idxChange = 0; + } else { + if (_rotation->_idxChange == 0) + _actor3.hide(); + + if (_field413 < -12) { + _rotation->setDelay(15 - ABS(_field413)); + _rotation->_idxChange = -2; + } else if (_field413 < 0) { + _rotation->setDelay(10 - ABS(_field413)); + _rotation->_idxChange = -1; + } else if (_field413 < 11) { + _rotation->setDelay(10 - _field413); + _rotation->_idxChange = 1; + } else { + _rotation->setDelay(15 - _field413); + _rotation->_idxChange = 2; + } + } + } + + if (_field417) + --_field417; + + _field41B = _field419; + _field419 = ((_rotation->_currIndex - 218) / 4) / 4; + + if ((_field41B + 1) == _field419 || (_field41B - 3) == _field419) { + if (R2_GLOBALS._v565F6 >= 2400) { + ++R2_GLOBALS._v565F6; + } + } + + if ((_field41B - 1) == _field419 || (_field41B + 3) == _field419) { + if (R2_GLOBALS._v565F6 > -2400) { + --R2_GLOBALS._v565F6; + } + } + + if (_rotation->_currIndex != _field41D) { + _field41D = _rotation->_currIndex; + _actor1.setPosition(Common::Point(35, ((_rotation->_currIndex - 218) / 4) + + ((R2_GLOBALS._v565F6 % 800) * 4))); + } + } + + int v = ABS(_actor1._position.y - 158) / 100; + if (v < 8) { + _actor2.show(); + _actor2.setPosition(Common::Point((_actor1._position.y <= 158) ? 137 : 148, + v * 7 + 122)); + } else { + _actor2.hide(); + } +} /*-------------------------------------------------------------------------- * Scene 1800 - diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index 6449f5bae1b..0e929b3ef3b 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -777,54 +777,54 @@ public: }; class Scene1750 : public SceneExt { - class Actor4 : public SceneActor { + class SpeedSlider : public SceneActor { public: - int _fieldA4; - int _fieldA6; - int _fieldA8; - int _fieldAA; - int _fieldAC; - int _fieldAE; + int _incrAmount; + int _xp; + int _ys; + int _height; + int _thumbHeight; + bool _mouseDown; - Actor4(); + SpeedSlider(); virtual void synchronize(Serializer &s); - void subB1A76(int arg1, int arg2, int arg3, int arg4, int arg5); - void subB1B27(); + void setupSlider(int incrAmount, int xp, int ys, int height, int thumbHeight); + void calculateSlider(); virtual void remove(); virtual void process(Event &event); virtual bool startAction(CursorType action, Event &event); }; - class Actor5 : public SceneActor { + class Button : public SceneActor { public: - int _fieldA4; + int _buttonId; - Actor5(); + Button(); virtual void synchronize(Serializer &s); virtual bool startAction(CursorType action, Event &event); }; public: - NamedHotspot _item1; - NamedHotspot _item2; - NamedHotspot _item3; - NamedHotspot _item4; - NamedHotspot _item5; + NamedHotspot _background; + NamedHotspot _redLights; + NamedHotspot _greenLights; + NamedHotspot _frontView; + NamedHotspot _rearView; SceneActor _actor1; SceneActor _actor2; SceneActor _actor3; - Actor4 _actor4; - Actor5 _actor5; - Actor5 _actor6; - Actor5 _actor7; + SpeedSlider _speedSlider; + Button _forwardButton; + Button _backwardButton; + Button _exitButton; SequenceManager _sequenceManager; PaletteRotation *_rotation; - int _field412; + int _direction; int _field413; - int _field415; + int _speed; int _field417; int _field419; int _field41B; From 18b21c52c3b8c18d20ae7ac1c9b0dfb4b0113e00 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 2 Sep 2013 13:58:46 +0300 Subject: [PATCH 23/24] TOLTECS: Add an alternate English version (bug #3614933) --- engines/toltecs/detection.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/engines/toltecs/detection.cpp b/engines/toltecs/detection.cpp index c5652f0c8df..380f4a3a26e 100644 --- a/engines/toltecs/detection.cpp +++ b/engines/toltecs/detection.cpp @@ -72,6 +72,20 @@ static const ToltecsGameDescription gameDescriptions[] = { }, }, + { + // 3 Skulls of the Toltecs English version (alternate) + // From bug #3614933 + { + "toltecs", + 0, + AD_ENTRY1s("WESTERN", "a9c9cfef9d05b8f7a5573b626fa4ea87", 337643527), + Common::EN_ANY, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, + { // 3 Skulls of the Toltecs Russian version { From 023783907fa21ec3ac38364ae44d55c813617e27 Mon Sep 17 00:00:00 2001 From: athrxx Date: Mon, 2 Sep 2013 19:59:59 +0200 Subject: [PATCH 24/24] LOL: fix bug #3614957 (LOL : Crash when subtitles displayed) --- engines/kyra/text_rpg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/kyra/text_rpg.cpp b/engines/kyra/text_rpg.cpp index a19d678e35e..24c523c856c 100644 --- a/engines/kyra/text_rpg.cpp +++ b/engines/kyra/text_rpg.cpp @@ -129,7 +129,7 @@ void TextDisplayer_rpg::displayText(char *str, ...) { uint16 charsPerLine = (sd->w << 3) / (_screen->getFontWidth() + _screen->_charWidth); while (c) { - char a = tolower(_ctrl[1]); + char a = tolower((unsigned char)_ctrl[1]); if (!_tempString2 && c == '%') { if (a == 'd') {