diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tsage/globals.cpp | 4 | ||||
-rw-r--r-- | engines/tsage/globals.h | 2 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_dialogs.cpp | 14 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.cpp | 134 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.h | 36 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes0.cpp | 4 |
6 files changed, 102 insertions, 92 deletions
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 8970d08e4d..27cda63aaa 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -478,7 +478,7 @@ void Ringworld2Globals::reset() { _v565EC[2] = 27; _v565EC[3] = 4; _v565EC[4] = 4; - Common::fill(&_v565F1[0], &_v565F1[MAX_CHARACTERS], 1); + Common::fill(&_scannerFrequencies[0], &_scannerFrequencies[MAX_CHARACTERS], 1); _speechSubtitles = SPEECH_VOICE | SPEECH_TEXT; _insetUp = 0; _frameEdgeColour = 2; @@ -541,7 +541,7 @@ void Ringworld2Globals::synchronize(Serializer &s) { s.syncAsByte(_v565EC[i]); for (i = 0; i < MAX_CHARACTERS; ++i) - s.syncAsByte(_v565F1[i]); + s.syncAsByte(_scannerFrequencies[i]); s.syncAsByte(_v565AE); s.syncAsByte(_v566A4); diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 88fc0821df..40254bd11e 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -305,7 +305,7 @@ public: int _v57C2C; int _speechSubtitles; byte _v565EC[5]; - byte _v565F1[4]; + byte _scannerFrequencies[4]; byte _stripManager_lookupList[12]; ScannerDialog *_scannerDialog; diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.cpp b/engines/tsage/ringworld2/ringworld2_dialogs.cpp index 478fdcf5a5..57fdef6405 100644 --- a/engines/tsage/ringworld2/ringworld2_dialogs.cpp +++ b/engines/tsage/ringworld2/ringworld2_dialogs.cpp @@ -236,7 +236,7 @@ void CharacterDialog::show() { // Play a transition sound as the character is changed if (R2_GLOBALS._player._characterScene[0] != 300) { - switch (R2_GLOBALS._v565F1[R2_GLOBALS._player._characterIndex]) { + switch (R2_GLOBALS._scannerFrequencies[R2_GLOBALS._player._characterIndex]) { case 0: R2_GLOBALS._sound4.stop(); break; @@ -255,8 +255,8 @@ void CharacterDialog::show() { default: break; } - } else if (R2_GLOBALS._v565F1[R2_GLOBALS._player._characterIndex] > 1) { - switch (R2_GLOBALS._v565F1[R2_GLOBALS._player._characterIndex]) { + } else if (R2_GLOBALS._scannerFrequencies[R2_GLOBALS._player._characterIndex] > 1) { + switch (R2_GLOBALS._scannerFrequencies[R2_GLOBALS._player._characterIndex]) { case 2: R2_GLOBALS._sound4.play(45); break; @@ -272,8 +272,8 @@ void CharacterDialog::show() { default: break; } - } else if ((R2_GLOBALS._player._characterScene[1] == 300) && (R2_GLOBALS._v565F1[1] != 1)) { - switch (R2_GLOBALS._v565F1[1]) { + } else if ((R2_GLOBALS._player._characterScene[1] == 300) && (R2_GLOBALS._scannerFrequencies[1] != 1)) { + switch (R2_GLOBALS._scannerFrequencies[1]) { case 2: R2_GLOBALS._sound4.play(45); break; @@ -291,10 +291,10 @@ void CharacterDialog::show() { } } else if (R2_GLOBALS._player._characterScene[2] != 300) { R2_GLOBALS._sound4.stop(); - } else if (R2_GLOBALS._v565F1[2] == 1) { + } else if (R2_GLOBALS._scannerFrequencies[2] == 1) { R2_GLOBALS._sound4.stop(); } else { - switch (R2_GLOBALS._v565F1[1]) { + switch (R2_GLOBALS._scannerFrequencies[1]) { case 2: R2_GLOBALS._sound4.play(45); break; diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 1ddaa5e6c2..b0d8d29843 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -417,8 +417,10 @@ bool SceneExt::display(CursorType action, Event &event) { SceneItem::display2(5, 0); break; case R2_SONIC_STUNNER: - if ((R2_GLOBALS._v565F1[1] == 2) || ((R2_GLOBALS._v565F1[1] == 1) && - (R2_GLOBALS._v565F1[2] == 2) && (R2_GLOBALS._sceneManager._previousScene == 300))) { + if ((R2_GLOBALS._scannerFrequencies[R2_QUINN] == 2) + || ((R2_GLOBALS._scannerFrequencies[R2_QUINN] == 1) && + (R2_GLOBALS._scannerFrequencies[R2_SEEKER] == 2) && + (R2_GLOBALS._sceneManager._previousScene == 300))) { R2_GLOBALS._sound4.stop(); R2_GLOBALS._sound3.play(46); SceneItem::display2(5, 15); @@ -2124,62 +2126,63 @@ void ModalDialog::proc13(int resNum, int lookLineNum, int talkLineNum, int useLi /*--------------------------------------------------------------------------*/ -ScannerDialog::ScannerActor::ScannerActor() { - _v1 = _v2 = 0; +ScannerDialog::Button::Button() { + _buttonId = 0; + _buttonDown = false; } -void ScannerDialog::ScannerActor::setup(int v) { - _v1 = v; - _v2 = 0; +void ScannerDialog::Button::setup(int buttonId) { + _buttonId = buttonId; + _buttonDown = false; SceneActor::postInit(); SceneObject::setup(4, 2, 2); fixPriority(255); - if (_v1 == 1) + if (_buttonId == 1) setPosition(Common::Point(141, 99)); - else if (_v1 == 2) + else if (_buttonId == 2) setPosition(Common::Point(141, 108)); static_cast<SceneExt *>(R2_GLOBALS._sceneManager._scene)->_sceneAreas.push_front(this); } -void ScannerDialog::ScannerActor::synchronize(Serializer &s) { +void ScannerDialog::Button::synchronize(Serializer &s) { SceneActor::synchronize(s); - s.syncAsSint16LE(_v1); - s.syncAsSint16LE(_v2); + s.syncAsSint16LE(_buttonId); } -void ScannerDialog::ScannerActor::process(Event &event) { +void ScannerDialog::Button::process(Event &event) { if (event.eventType == EVENT_BUTTON_DOWN && R2_GLOBALS._events.getCursor() == CURSOR_USE - && _bounds.contains(event.mousePos) && !_v2) { + && _bounds.contains(event.mousePos) && !_buttonDown) { setFrame(3); - _v2 = 1; + _buttonDown = true; event.handled = true; } - if (event.eventType == EVENT_BUTTON_UP && _v2) { + if (event.eventType == EVENT_BUTTON_UP && _buttonDown) { setFrame(2); - _v2 = 0; + _buttonDown = false; event.handled = true; reset(); } } -bool ScannerDialog::ScannerActor::startAction(CursorType action, Event &event) { +bool ScannerDialog::Button::startAction(CursorType action, Event &event) { if (action == CURSOR_USE) return false; return startAction(action, event); } -void ScannerDialog::ScannerActor::reset() { +void ScannerDialog::Button::reset() { Scene *scene = R2_GLOBALS._sceneManager._scene; ScannerDialog &scanner = *R2_GLOBALS._scannerDialog; - switch (_v1) { + switch (_buttonId) { case 1: + // Talk button switch (R2_GLOBALS._sceneManager._sceneNumber) { case 1550: scene->_sceneMode = 80; @@ -2195,6 +2198,7 @@ void ScannerDialog::ScannerActor::reset() { } break; case 2: + // Scan button switch (R2_GLOBALS._sceneManager._sceneNumber) { case 1550: scanner._obj4.setup(4, 3, 1); @@ -2244,66 +2248,66 @@ void ScannerDialog::ScannerActor::reset() { /*--------------------------------------------------------------------------*/ -ScannerDialog::ScannerActor2::ScannerActor2() { - _v1 = _v2 = _yp = 0; - _v4 = _v5 = _v6 = 0; +ScannerDialog::Slider::Slider() { + _initial = _xStart = _yp = 0; + _width = _xInc = 0; + _sliderDown = false; } -void ScannerDialog::ScannerActor2::synchronize(Serializer &s) { +void ScannerDialog::Slider::synchronize(Serializer &s) { SceneActor::synchronize(s); - s.syncAsSint16LE(_v1); - s.syncAsSint16LE(_v2); + s.syncAsSint16LE(_initial); + s.syncAsSint16LE(_xStart); s.syncAsSint16LE(_yp); - s.syncAsSint16LE(_v4); - s.syncAsSint16LE(_v5); - s.syncAsSint16LE(_v6); + s.syncAsSint16LE(_width); + s.syncAsSint16LE(_xInc); } -void ScannerDialog::ScannerActor2::remove() { +void ScannerDialog::Slider::remove() { static_cast<SceneExt *>(R2_GLOBALS._sceneManager._scene)->_sceneAreas.remove(this); SceneActor::remove(); } -void ScannerDialog::ScannerActor2::process(Event &event) { +void ScannerDialog::Slider::process(Event &event) { if (event.eventType == EVENT_BUTTON_DOWN && R2_GLOBALS._events.getCursor() == CURSOR_USE - && _bounds.contains(event.mousePos) && !_v2) { - _v6 = 1; + && _bounds.contains(event.mousePos)) { + _sliderDown = true; } - if (event.eventType == EVENT_BUTTON_UP && _v6) { - _v6 = 0; - event.handled = 1; + if (event.eventType == EVENT_BUTTON_UP && _sliderDown) { + _sliderDown = false; + event.handled = true; update(); } - if (_v6) { + if (_sliderDown) { event.handled = true; - if (event.mousePos.x < _v2) { - setPosition(Common::Point(_v2, _yp)); - } else if (event.mousePos.x >= (_v2 + _v4)) { - setPosition(Common::Point(_v2 + _v4, _yp)); + if (event.mousePos.x < _xStart) { + setPosition(Common::Point(_xStart, _yp)); + } else if (event.mousePos.x >= (_xStart + _width)) { + setPosition(Common::Point(_xStart + _width, _yp)); } else { setPosition(Common::Point(event.mousePos.x, _yp)); } } } -bool ScannerDialog::ScannerActor2::startAction(CursorType action, Event &event) { +bool ScannerDialog::Slider::startAction(CursorType action, Event &event) { if (action == CURSOR_USE) return false; return startAction(action, event); } -void ScannerDialog::ScannerActor2::update() { - int v = (_v4 / (_v5 - 1)) / 2; - int v2 = ((_position.x - _v2 + v) * _v5) / (_v4 + v * 2); - setPosition(Common::Point(_v2 + ((_v4 * v2) / (_v5 - 1)), _yp)); +void ScannerDialog::Slider::update() { + int incHalf = (_width / (_xInc - 1)) / 2; + int newFrequency = ((_position.x - _xStart + incHalf) * _xInc) / (_width + incHalf * 2); + setPosition(Common::Point(_xStart + ((_width * newFrequency) / (_xInc - 1)), _yp)); - R2_GLOBALS._v565F1[R2_GLOBALS._player._characterIndex] = v2; + R2_GLOBALS._scannerFrequencies[R2_GLOBALS._player._characterIndex] = newFrequency + 1; - switch (v2 - 1) { + switch (newFrequency) { case 0: R2_GLOBALS._sound4.stop(); break; @@ -2324,16 +2328,17 @@ void ScannerDialog::ScannerActor2::update() { } } -void ScannerDialog::ScannerActor2::setup(int v1, int v2, int yp, int v4, int v5) { - _v1 = v1; - _v2 = v2; +void ScannerDialog::Slider::setup(int initial, int xStart, int yp, int width, int xInc) { + _initial = initial; + _xStart = xStart; _yp = yp; - _v4 = v4; - _v5 = v5; - _v6 = 0; + _width = width; + _xInc = xInc; + _sliderDown = false; SceneActor::postInit(); + SceneObject::setup(4, 2, 1); fixPriority(255); - setPosition(Common::Point(_v4 * (_v1 - 1) / (_v5 - 1) + _v2, yp)); + setPosition(Common::Point(_width * (_initial - 1) / (_xInc - 1) + _xStart, yp)); static_cast<SceneExt *>(R2_GLOBALS._sceneManager._scene)->_sceneAreas.push_front(this); } @@ -2361,11 +2366,11 @@ void ScannerDialog::remove() { } SceneExt *scene = static_cast<SceneExt *>(R2_GLOBALS._sceneManager._scene); - scene->_sceneAreas.remove(&_obj1); - scene->_sceneAreas.remove(&_obj2); - _obj1.remove(); - _obj2.remove(); - _obj3.remove(); + scene->_sceneAreas.remove(&_talkButton); + scene->_sceneAreas.remove(&_scanButton); + _talkButton.remove(); + _scanButton.remove(); + _slider.remove(); _obj4.remove(); _obj5.remove(); _obj6.remove(); @@ -2379,13 +2384,14 @@ void ScannerDialog::proc12(int visage, int stripFrameNum, int frameNum, int posX if (R2_GLOBALS._player._mover) R2_GLOBALS._player.addMover(NULL); - R2_GLOBALS._events.setCursor(EXITCURSOR_LEFT_HAND); + R2_GLOBALS._events.setCursor(CURSOR_USE); ModalDialog::proc12(visage, stripFrameNum, frameNum, posX, posY); proc13(100, -1, -1, -1); - _obj1.setup(1); - _obj2.setup(2); - _obj3.setup(R2_GLOBALS._v565F1[R2_GLOBALS._player._characterIndex], 142, 124, 35, 5); + _talkButton.setup(1); + _scanButton.setup(2); + _slider.setup(R2_GLOBALS._scannerFrequencies[R2_GLOBALS._player._characterIndex], 142, 124, 35, 5); + _obj4.postInit(); _obj4.setup(4, 3, 2); _obj4.setPosition(Common::Point(160, 83)); diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 20ba999b00..2e7dd64fa2 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -453,6 +453,7 @@ public: virtual void remove(); virtual void synchronize(Serializer &s); + virtual Common::String getClassName() { return "ModalDialog"; } virtual void process(Event &event); virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); virtual void proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum); @@ -460,43 +461,45 @@ public: class ScannerDialog: public ModalDialog { - class ScannerActor: public SceneActor { + class Button: public SceneActor { private: void reset(); public: - int _v1; - int _v2; + int _buttonId; + bool _buttonDown; public: - ScannerActor(); - void setup(int v); + Button(); + void setup(int buttonId); virtual void synchronize(Serializer &s); + virtual Common::String getClassName() { return "ScannerButton"; } virtual void process(Event &event); virtual bool startAction(CursorType action, Event &event); }; - class ScannerActor2: public SceneActor { + class Slider: public SceneActor { private: void update(); public: - int _v1; - int _v2; + int _initial; + int _xStart; int _yp; - int _v4; - int _v5; - int _v6; + int _width; + int _xInc; + bool _sliderDown; public: - ScannerActor2(); - void setup(int v1, int v2, int v3, int v4, int v5); + Slider(); + void setup(int initial, int xStart, int yp, int width, int xInc); virtual void synchronize(Serializer &s); + virtual Common::String getClassName() { return "ScannerSlider"; } virtual void remove(); virtual void process(Event &event); virtual bool startAction(CursorType action, Event &event); }; public: - ScannerActor _obj1; - ScannerActor _obj2; - ScannerActor2 _obj3; + Button _talkButton; + Button _scanButton; + Slider _slider; SceneActor _obj4; SceneActor _obj5; SceneActor _obj6; @@ -504,6 +507,7 @@ public: public: ScannerDialog(); + virtual Common::String getClassName() { return "ScannerDialog"; } virtual void remove(); void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); }; diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index d1deac7c3e..1dd9c9c25f 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -5548,7 +5548,7 @@ bool Scene600::Actor8::startAction(CursorType action, Event &event) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 615; scene->setAction(&scene->_sequenceManager1, scene, 615, &R2_GLOBALS._player, &scene->_actor8, NULL); - } else if ((action == R2_SONIC_STUNNER) && (R2_INVENTORY.getObjectScene(9) == 600) && (R2_GLOBALS._v565F1[1] == 2) && (!R2_GLOBALS.getFlag(8))){ + } else if ((action == R2_SONIC_STUNNER) && (R2_INVENTORY.getObjectScene(9) == 600) && (R2_GLOBALS._scannerFrequencies[1] == 2) && (!R2_GLOBALS.getFlag(8))){ R2_GLOBALS._player.disableControl(); scene->_sceneMode = 608; scene->setAction(&scene->_sequenceManager1, scene, 608, &R2_GLOBALS._player, &scene->_actor4, NULL); @@ -5582,7 +5582,7 @@ void Scene600::postInit(SceneObjectList *OwnerList) { _actor8.setup(602, 5, 1); _actor8.setPosition(Common::Point(246, 41)); _actor8.setDetails(600, 20, -1, -1, 1, (SceneItem *) NULL); - switch (R2_GLOBALS._v565F1[1] - 2) { + switch (R2_GLOBALS._scannerFrequencies[1] - 2) { case 0: R2_GLOBALS._sound4.play(45); break; |